Skip to content

Commit

Permalink
Merge pull request #914 from Shopify/javascript_updates
Browse files Browse the repository at this point in the history
Convert template to Javascript
  • Loading branch information
lizkenyon authored Dec 19, 2024
2 parents 221eabe + b4aab6c commit bfcfe60
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @shopify/shopify-app-template-remix

## 2024.12.18

- [875](https://github.com/Shopify/shopify-app-template-remix/pull/875) Add Scopes Update Webhook

## 2024.12.05

- [#910](https://github.com/Shopify/shopify-app-template-remix/pull/910) Install `openssl` in Docker image to fix Prisma (see [#25817](https://github.com/prisma/prisma/issues/25817#issuecomment-2538544254))
Expand All @@ -12,7 +16,6 @@
- [#891](https://github.com/Shopify/shopify-app-template-remix/pull/891) Enable remix future flags.

## 2024.11.26

- [888](https://github.com/Shopify/shopify-app-template-remix/pull/888) Update restResources version to 2024-10

## 2024.11.06
Expand All @@ -33,7 +36,7 @@

## 2024.09.17

- [842](https://github.com/Shopify/shopify-app-template-remix/pull/842)Move webhook processing to individual routes
- [842](https://github.com/Shopify/shopify-app-template-remix/pull/842) Move webhook processing to individual routes

## 2024.08.19

Expand Down
22 changes: 22 additions & 0 deletions app/routes/webhooks.app.scopes_update.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { authenticate } from "../shopify.server";
import db from "../db.server";

export const action = async ({ request }) => {
const { payload, session, topic, shop } = await authenticate.webhook(request);

console.log(`Received ${topic} webhook for ${shop}`);
const current = payload.current;

if (session) {
await db.session.update({
where: {
id: session.id,
},
data: {
scope: current.toString(),
},
});
}

return new Response();
};
5 changes: 5 additions & 0 deletions shopify.app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ api_version = "2024-10"
uri = "/webhooks/app/uninstalled"
topics = ["app/uninstalled"]

# Handled by: /app/routes/webhooks.app.scopes_update.tsx
[[webhooks.subscriptions]]
topics = [ "app/scopes_update" ]
uri = "/webhooks/app/scopes_update"

# Webhooks can have filters
# Only receive webhooks for product updates with a product price >= 10.00
# See: https://shopify.dev/docs/apps/build/webhooks/customize/filters
Expand Down

0 comments on commit bfcfe60

Please sign in to comment.