Skip to content

Commit 72241e9

Browse files
Convert from v6 api lib to v1 express lib
1 parent f71967c commit 72241e9

File tree

13 files changed

+150
-588
lines changed

13 files changed

+150
-588
lines changed

sample-apps/discounts-tutorial/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ The database that works best for you depends on the data your app needs and how
108108
| Redis | Key-value | [Digital Ocean](https://www.digitalocean.com/try/managed-databases-redis), [Amazon MemoryDB](https://aws.amazon.com/memorydb/) |
109109
| MongoDB | NoSQL / Document | [Digital Ocean](https://www.digitalocean.com/try/managed-databases-mongodb), [MongoDB Atlas](https://www.mongodb.com/atlas/database) |
110110

111-
To use one of these, you need to change your session storage configuration. To help, here’s a list of [SessionStorage adapters](https://github.com/Shopify/shopify-api-node/tree/main/src/auth/session/storage).
111+
To use one of these, you need to change your session storage configuration. To help, here’s a list of [SessionStorage adapters](https://github.com/Shopify/shopify-api-node/blob/main/docs/usage/session-storage.md).
112112

113113
### Build
114114

sample-apps/discounts-tutorial/web/app_installations.js

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 55 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,80 @@
11
import { DeliveryMethod } from "@shopify/shopify-api";
2-
import shopify from "./shopify.js";
32

4-
export async function setupGDPRWebHooks(path) {
3+
export default {
54
/**
65
* Customers can request their data from a store owner. When this happens,
76
* Shopify invokes this webhook.
87
*
98
* https://shopify.dev/apps/webhooks/configuration/mandatory-webhooks#customers-data_request
109
*/
11-
await shopify.webhooks.addHandlers({
12-
CUSTOMERS_DATA_REQUEST: {
13-
deliveryMethod: DeliveryMethod.Http,
14-
callbackUrl: path,
15-
callback: async (topic, shop, body) => {
16-
const payload = JSON.parse(body);
17-
// Payload has the following shape:
18-
// {
19-
// "shop_id": 954889,
20-
// "shop_domain": "{shop}.myshopify.com",
21-
// "orders_requested": [
22-
// 299938,
23-
// 280263,
24-
// 220458
25-
// ],
26-
// "customer": {
27-
// "id": 191167,
28-
// "email": "john@example.com",
29-
// "phone": "555-625-1199"
30-
// },
31-
// "data_request": {
32-
// "id": 9999
33-
// }
34-
// }
35-
},
10+
CUSTOMERS_DATA_REQUEST: {
11+
deliveryMethod: DeliveryMethod.Http,
12+
callback: async (topic, shop, body) => {
13+
const payload = JSON.parse(body);
14+
// Payload has the following shape:
15+
// {
16+
// "shop_id": 954889,
17+
// "shop_domain": "{shop}.myshopify.com",
18+
// "orders_requested": [
19+
// 299938,
20+
// 280263,
21+
// 220458
22+
// ],
23+
// "customer": {
24+
// "id": 191167,
25+
// "email": "john@example.com",
26+
// "phone": "555-625-1199"
27+
// },
28+
// "data_request": {
29+
// "id": 9999
30+
// }
31+
// }
3632
},
37-
});
33+
},
3834

3935
/**
4036
* Store owners can request that data is deleted on behalf of a customer. When
4137
* this happens, Shopify invokes this webhook.
4238
*
4339
* https://shopify.dev/apps/webhooks/configuration/mandatory-webhooks#customers-redact
4440
*/
45-
await shopify.webhooks.addHandlers({
46-
CUSTOMERS_REDACT: {
47-
deliveryMethod: DeliveryMethod.Http,
48-
callbackUrl: path,
49-
callback: async (topic, shop, body) => {
50-
const payload = JSON.parse(body);
51-
// Payload has the following shape:
52-
// {
53-
// "shop_id": 954889,
54-
// "shop_domain": "{shop}.myshopify.com",
55-
// "customer": {
56-
// "id": 191167,
57-
// "email": "john@example.com",
58-
// "phone": "555-625-1199"
59-
// },
60-
// "orders_to_redact": [
61-
// 299938,
62-
// 280263,
63-
// 220458
64-
// ]
65-
// }
66-
},
41+
CUSTOMERS_REDACT: {
42+
deliveryMethod: DeliveryMethod.Http,
43+
callback: async (topic, shop, body) => {
44+
const payload = JSON.parse(body);
45+
// Payload has the following shape:
46+
// {
47+
// "shop_id": 954889,
48+
// "shop_domain": "{shop}.myshopify.com",
49+
// "customer": {
50+
// "id": 191167,
51+
// "email": "john@example.com",
52+
// "phone": "555-625-1199"
53+
// },
54+
// "orders_to_redact": [
55+
// 299938,
56+
// 280263,
57+
// 220458
58+
// ]
59+
// }
6760
},
68-
});
61+
},
6962

7063
/**
7164
* 48 hours after a store owner uninstalls your app, Shopify invokes this
7265
* webhook.
7366
*
7467
* https://shopify.dev/apps/webhooks/configuration/mandatory-webhooks#shop-redact
7568
*/
76-
await shopify.webhooks.addHandlers({
77-
SHOP_REDACT: {
78-
deliveryMethod: DeliveryMethod.Http,
79-
callbackUrl: path,
80-
callback: async (topic, shop, body) => {
81-
const payload = JSON.parse(body);
82-
// Payload has the following shape:
83-
// {
84-
// "shop_id": 954889,
85-
// "shop_domain": "{shop}.myshopify.com"
86-
// }
87-
},
69+
SHOP_REDACT: {
70+
deliveryMethod: DeliveryMethod.Http,
71+
callback: async (topic, shop, body) => {
72+
const payload = JSON.parse(body);
73+
// Payload has the following shape:
74+
// {
75+
// "shop_id": 954889,
76+
// "shop_domain": "{shop}.myshopify.com"
77+
// }
8878
},
89-
});
90-
}
79+
},
80+
};

sample-apps/discounts-tutorial/web/helpers/ensure-billing.js

Lines changed: 0 additions & 37 deletions
This file was deleted.

sample-apps/discounts-tutorial/web/helpers/redirect-to-auth.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

sample-apps/discounts-tutorial/web/helpers/return-top-level-redirection.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)