@shopify/shopify-app-remix 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/server/authenticate/admin/authenticate.js +119 -501
- package/build/cjs/server/authenticate/admin/billing/cancel.js +1 -0
- package/build/cjs/server/authenticate/admin/billing/request.js +1 -0
- package/build/cjs/server/authenticate/admin/billing/require.js +1 -0
- package/build/cjs/server/authenticate/admin/helpers/create-admin-api-context.js +18 -0
- package/build/cjs/server/authenticate/admin/helpers/ensure-app-is-embedded-if-required.js +27 -0
- package/build/cjs/server/authenticate/admin/helpers/ensure-session-token-search-param-if-required.js +25 -0
- package/build/cjs/server/authenticate/admin/helpers/redirect-to-bounce-page.js +22 -0
- package/build/cjs/server/authenticate/admin/helpers/redirect-to-shopify-or-app-root.js +22 -0
- package/build/cjs/server/authenticate/admin/helpers/trigger-after-auth-hook.js +21 -0
- package/build/cjs/server/authenticate/admin/helpers/validate-shop-and-host-params.js +32 -0
- package/build/cjs/server/authenticate/admin/strategies/auth-code-flow.js +310 -0
- package/build/cjs/server/authenticate/helpers/get-session-token-header.js +6 -0
- package/build/cjs/server/authenticate/helpers/reject-bot-request.js +2 -2
- package/build/cjs/server/authenticate/public/checkout/authenticate.js +1 -1
- package/build/cjs/server/authenticate/webhooks/authenticate.js +14 -5
- package/build/cjs/server/clients/admin/graphql.js +6 -8
- package/build/cjs/server/shopify-app.js +12 -6
- package/build/cjs/server/version.js +1 -1
- package/build/ts/server/__test-helpers/test-config.d.ts +36 -7
- package/build/ts/server/__test-helpers/test-config.d.ts.map +1 -1
- package/build/ts/server/__test-helpers/test-config.js +34 -6
- package/build/ts/server/__test-helpers/test-config.js.map +1 -1
- package/build/ts/server/authenticate/admin/authenticate.d.ts +8 -25
- package/build/ts/server/authenticate/admin/authenticate.d.ts.map +1 -1
- package/build/ts/server/authenticate/admin/authenticate.js +124 -488
- package/build/ts/server/authenticate/admin/authenticate.js.map +1 -1
- package/build/ts/server/authenticate/admin/billing/types.d.ts +11 -3
- package/build/ts/server/authenticate/admin/billing/types.d.ts.map +1 -1
- package/build/ts/server/authenticate/admin/helpers/create-admin-api-context.d.ts +5 -0
- package/build/ts/server/authenticate/admin/helpers/create-admin-api-context.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/create-admin-api-context.js +16 -0
- package/build/ts/server/authenticate/admin/helpers/create-admin-api-context.js.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/ensure-app-is-embedded-if-required.d.ts +3 -0
- package/build/ts/server/authenticate/admin/helpers/ensure-app-is-embedded-if-required.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/ensure-app-is-embedded-if-required.js +25 -0
- package/build/ts/server/authenticate/admin/helpers/ensure-app-is-embedded-if-required.js.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/ensure-session-token-search-param-if-required.d.ts +3 -0
- package/build/ts/server/authenticate/admin/helpers/ensure-session-token-search-param-if-required.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/ensure-session-token-search-param-if-required.js +23 -0
- package/build/ts/server/authenticate/admin/helpers/ensure-session-token-search-param-if-required.js.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/index.d.ts +7 -0
- package/build/ts/server/authenticate/admin/helpers/index.d.ts.map +1 -1
- package/build/ts/server/authenticate/admin/helpers/index.js +7 -0
- package/build/ts/server/authenticate/admin/helpers/index.js.map +1 -1
- package/build/ts/server/authenticate/admin/helpers/redirect-to-bounce-page.d.ts +3 -0
- package/build/ts/server/authenticate/admin/helpers/redirect-to-bounce-page.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/redirect-to-bounce-page.js +16 -0
- package/build/ts/server/authenticate/admin/helpers/redirect-to-bounce-page.js.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/redirect-to-shopify-or-app-root.d.ts +3 -0
- package/build/ts/server/authenticate/admin/helpers/redirect-to-shopify-or-app-root.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/redirect-to-shopify-or-app-root.js +32 -0
- package/build/ts/server/authenticate/admin/helpers/redirect-to-shopify-or-app-root.js.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/trigger-after-auth-hook.d.ts +4 -0
- package/build/ts/server/authenticate/admin/helpers/trigger-after-auth-hook.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/trigger-after-auth-hook.js +28 -0
- package/build/ts/server/authenticate/admin/helpers/trigger-after-auth-hook.js.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/validate-shop-and-host-params.d.ts +3 -0
- package/build/ts/server/authenticate/admin/helpers/validate-shop-and-host-params.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/validate-shop-and-host-params.js +26 -0
- package/build/ts/server/authenticate/admin/helpers/validate-shop-and-host-params.js.map +1 -0
- package/build/ts/server/authenticate/admin/strategies/auth-code-flow.d.ts +22 -0
- package/build/ts/server/authenticate/admin/strategies/auth-code-flow.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/strategies/auth-code-flow.js +323 -0
- package/build/ts/server/authenticate/admin/strategies/auth-code-flow.js.map +1 -0
- package/build/ts/server/authenticate/admin/strategies/types.d.ts +11 -0
- package/build/ts/server/authenticate/admin/strategies/types.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/strategies/types.js +3 -0
- package/build/ts/server/authenticate/admin/strategies/types.js.map +1 -0
- package/build/ts/server/authenticate/admin/types.d.ts +4 -0
- package/build/ts/server/authenticate/admin/types.d.ts.map +1 -1
- package/build/ts/server/authenticate/helpers/get-session-token-header.d.ts +1 -0
- package/build/ts/server/authenticate/helpers/get-session-token-header.d.ts.map +1 -1
- package/build/ts/server/authenticate/helpers/get-session-token-header.js +7 -1
- package/build/ts/server/authenticate/helpers/get-session-token-header.js.map +1 -1
- package/build/ts/server/authenticate/helpers/reject-bot-request.d.ts +1 -1
- package/build/ts/server/authenticate/helpers/reject-bot-request.d.ts.map +1 -1
- package/build/ts/server/authenticate/helpers/reject-bot-request.js +3 -3
- package/build/ts/server/authenticate/helpers/reject-bot-request.js.map +1 -1
- package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.d.ts.map +1 -1
- package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.js +2 -2
- package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.js.map +1 -1
- package/build/ts/server/authenticate/public/appProxy/types.d.ts +6 -3
- package/build/ts/server/authenticate/public/appProxy/types.d.ts.map +1 -1
- package/build/ts/server/authenticate/public/checkout/authenticate.js +1 -1
- package/build/ts/server/authenticate/public/checkout/authenticate.js.map +1 -1
- package/build/ts/server/authenticate/webhooks/authenticate.d.ts.map +1 -1
- package/build/ts/server/authenticate/webhooks/authenticate.js +12 -2
- package/build/ts/server/authenticate/webhooks/authenticate.js.map +1 -1
- package/build/ts/server/clients/admin/graphql.js +2 -2
- package/build/ts/server/clients/admin/graphql.js.map +1 -1
- package/build/ts/server/clients/admin/types.d.ts +51 -10
- package/build/ts/server/clients/admin/types.d.ts.map +1 -1
- package/build/ts/server/clients/storefront/types.d.ts +4 -4
- package/build/ts/server/config-types.d.ts +5 -5
- package/build/ts/server/config-types.d.ts.map +1 -1
- package/build/ts/server/future/flags.d.ts.map +1 -1
- package/build/ts/server/shopify-app.d.ts.map +1 -1
- package/build/ts/server/shopify-app.js +5 -3
- package/build/ts/server/shopify-app.js.map +1 -1
- package/build/ts/server/types.d.ts +2 -2
- package/build/ts/server/version.d.ts +1 -1
- package/build/ts/server/version.js +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../../../../src/server/clients/admin/graphql.ts"],"names":[],"mappings":";;;;AAAA,wDAAyD;AAWzD,+CAA+C;AAC/C,uHAAuH;AACvH,wHAAwH;AACxH,wBAAwB;AACxB,SAAgB,oBAAoB,CAAC,EAIhB;QAHnB,MAAM,YAAA,EACN,iBAAiB,uBAAA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,CAAC;AACJ,CAAC;AA9BD,oDA8BC"}
|
|
@@ -22,7 +22,19 @@ export interface AdminApiContext<Resources extends ShopifyRestResources = Shopif
|
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
24
|
* <caption>Using REST resources.</caption>
|
|
25
|
-
* <description>Getting the number of orders in a store using REST resources
|
|
25
|
+
* <description>Getting the number of orders in a store using REST resources. Visit the [Admin REST API references](/docs/api/admin-rest) for examples on using each resource. </description>
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* // /app/routes/**\/*.ts
|
|
29
|
+
* import { LoaderFunctionArgs, json } from "@remix-run/node";
|
|
30
|
+
* import { authenticate } from "../shopify.server";
|
|
31
|
+
*
|
|
32
|
+
* export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|
33
|
+
* const { admin, session } = await authenticate.admin(request);
|
|
34
|
+
* return json(admin.rest.resources.Order.count({ session }));
|
|
35
|
+
* };
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
26
38
|
*
|
|
27
39
|
* ```ts
|
|
28
40
|
* // /app/shopify.server.ts
|
|
@@ -37,6 +49,11 @@ export interface AdminApiContext<Resources extends ShopifyRestResources = Shopif
|
|
|
37
49
|
* export const authenticate = shopify.authenticate;
|
|
38
50
|
* ```
|
|
39
51
|
*
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* <caption>Performing a GET request to the REST API.</caption>
|
|
55
|
+
* <description>Use `admin.rest.get` to make custom requests to make a request to to the `customer/count` endpoint</description>
|
|
56
|
+
*
|
|
40
57
|
* ```ts
|
|
41
58
|
* // /app/routes/**\/*.ts
|
|
42
59
|
* import { LoaderFunctionArgs, json } from "@remix-run/node";
|
|
@@ -44,14 +61,12 @@ export interface AdminApiContext<Resources extends ShopifyRestResources = Shopif
|
|
|
44
61
|
*
|
|
45
62
|
* export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|
46
63
|
* const { admin, session } = await authenticate.admin(request);
|
|
47
|
-
*
|
|
64
|
+
* const response = await admin.rest.get({ path: "/customers/count.json" });
|
|
65
|
+
* const customers = await response.json();
|
|
66
|
+
* return json({ customers });
|
|
48
67
|
* };
|
|
49
68
|
* ```
|
|
50
69
|
*
|
|
51
|
-
* @example
|
|
52
|
-
* <caption>Performing a GET request to the REST API.</caption>
|
|
53
|
-
* <description>Use `admin.rest.<method>` to make custom requests to the API.</description>
|
|
54
|
-
*
|
|
55
70
|
* ```ts
|
|
56
71
|
* // /app/shopify.server.ts
|
|
57
72
|
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
@@ -64,7 +79,9 @@ export interface AdminApiContext<Resources extends ShopifyRestResources = Shopif
|
|
|
64
79
|
* export default shopify;
|
|
65
80
|
* export const authenticate = shopify.authenticate;
|
|
66
81
|
* ```
|
|
67
|
-
*
|
|
82
|
+
* @example
|
|
83
|
+
* <caption>Performing a POST request to the REST API.</caption>
|
|
84
|
+
* <description>Use `admin.rest.post` to make custom requests to make a request to to the `customers.json` endpoint to send a welcome email</description>
|
|
68
85
|
* ```ts
|
|
69
86
|
* // /app/routes/**\/*.ts
|
|
70
87
|
* import { LoaderFunctionArgs, json } from "@remix-run/node";
|
|
@@ -72,11 +89,35 @@ export interface AdminApiContext<Resources extends ShopifyRestResources = Shopif
|
|
|
72
89
|
*
|
|
73
90
|
* export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|
74
91
|
* const { admin, session } = await authenticate.admin(request);
|
|
75
|
-
* const response =
|
|
76
|
-
*
|
|
77
|
-
*
|
|
92
|
+
* const response = admin.rest.post({
|
|
93
|
+
* path: "customers/7392136888625/send_invite.json",
|
|
94
|
+
* body: {
|
|
95
|
+
* customer_invite: {
|
|
96
|
+
* to: "new_test_email@shopify.com",
|
|
97
|
+
* from: "j.limited@example.com",
|
|
98
|
+
* bcc: ["j.limited@example.com"],
|
|
99
|
+
* subject: "Welcome to my new shop",
|
|
100
|
+
* custom_message: "My awesome new store",
|
|
101
|
+
* },
|
|
102
|
+
* },
|
|
103
|
+
* });
|
|
104
|
+
* const customerInvite = await response.json();
|
|
105
|
+
* return json({ customerInvite });
|
|
78
106
|
* };
|
|
79
107
|
* ```
|
|
108
|
+
*
|
|
109
|
+
* ```ts
|
|
110
|
+
* // /app/shopify.server.ts
|
|
111
|
+
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
112
|
+
* import { restResources } from "@shopify/shopify-api/rest/admin/2023-04";
|
|
113
|
+
*
|
|
114
|
+
* const shopify = shopifyApp({
|
|
115
|
+
* restResources,
|
|
116
|
+
* // ...etc
|
|
117
|
+
* });
|
|
118
|
+
* export default shopify;
|
|
119
|
+
* export const authenticate = shopify.authenticate;
|
|
120
|
+
* ```
|
|
80
121
|
*/
|
|
81
122
|
rest: RestClientWithResources<Resources>;
|
|
82
123
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/admin/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAEvC,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAEpD,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;CAC5C;AAED,MAAM,MAAM,sBAAsB,GAAG,CAAC,GAAG,EAAE;IACzC,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEpB,MAAM,WAAW,eAAe,CAC9B,SAAS,SAAS,oBAAoB,GAAG,oBAAoB;IAE7D
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/admin/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAEvC,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAEpD,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;CAC5C;AAED,MAAM,MAAM,sBAAsB,GAAG,CAAC,GAAG,EAAE;IACzC,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEpB,MAAM,WAAW,eAAe,CAC9B,SAAS,SAAS,oBAAoB,GAAG,oBAAoB;IAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyGG;IACH,IAAI,EAAE,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,OAAO,EAAE,aAAa,CAAC;CACxB"}
|
|
@@ -11,16 +11,16 @@ export interface StorefrontContext {
|
|
|
11
11
|
* <caption>Querying the GraphQL API.</caption>
|
|
12
12
|
* <description>Use `storefront.graphql` to make query / mutation requests.</description>
|
|
13
13
|
* ```ts
|
|
14
|
-
*
|
|
14
|
+
* // app/routes/**\/.ts
|
|
15
|
+
* import { json } from "@remix-run/node";
|
|
15
16
|
* import { authenticate } from "../shopify.server";
|
|
16
17
|
*
|
|
17
18
|
* export async function action({ request }: ActionFunctionArgs) {
|
|
18
|
-
* const { storefront } = await authenticate.
|
|
19
|
+
* const { storefront } = await authenticate.public.appProxy(request);
|
|
19
20
|
*
|
|
20
21
|
* const response = await storefront.graphql(`{blogs(first: 10) { edges { node { id } } } }`);
|
|
21
22
|
*
|
|
22
|
-
*
|
|
23
|
-
* return json({ data: productData.data });
|
|
23
|
+
* return json(await response.json());
|
|
24
24
|
* }
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ConfigParams as ApiConfigArg, ConfigInterface as ApiConfig, ShopifyRestResources, Session, ApiVersion, WebhookHandler } from '@shopify/shopify-api';
|
|
2
2
|
import { SessionStorage } from '@shopify/shopify-app-session-storage';
|
|
3
|
-
import type { FutureFlags } from './future/flags';
|
|
3
|
+
import type { FutureFlagOptions, FutureFlags } from './future/flags';
|
|
4
4
|
import type { AppDistribution } from './types';
|
|
5
5
|
import type { AdminApiContext } from './clients';
|
|
6
|
-
export interface AppConfigArg<Resources extends ShopifyRestResources = ShopifyRestResources, Storage extends SessionStorage = SessionStorage> extends Omit<ApiConfigArg<Resources>, 'hostName' | 'hostScheme' | 'isEmbeddedApp' | 'apiVersion' | 'isCustomStoreApp'> {
|
|
6
|
+
export interface AppConfigArg<Resources extends ShopifyRestResources = ShopifyRestResources, Storage extends SessionStorage = SessionStorage, Future extends FutureFlagOptions = FutureFlagOptions> extends Omit<ApiConfigArg<Resources>, 'hostName' | 'hostScheme' | 'isEmbeddedApp' | 'apiVersion' | 'isCustomStoreApp' | 'future'> {
|
|
7
7
|
/**
|
|
8
8
|
* The URL your app is running on.
|
|
9
9
|
*
|
|
@@ -191,9 +191,9 @@ export interface AppConfigArg<Resources extends ShopifyRestResources = ShopifyRe
|
|
|
191
191
|
* You can opt in to these features by setting the corresponding flags. By doing so, you can prepare for future
|
|
192
192
|
* releases in advance and provide feedback on the new features.
|
|
193
193
|
*/
|
|
194
|
-
future?:
|
|
194
|
+
future?: Future;
|
|
195
195
|
}
|
|
196
|
-
export interface AppConfig<Storage extends SessionStorage = SessionStorage> extends ApiConfig {
|
|
196
|
+
export interface AppConfig<Storage extends SessionStorage = SessionStorage> extends Omit<ApiConfig, 'future'> {
|
|
197
197
|
canUseLoginForm: boolean;
|
|
198
198
|
appUrl: string;
|
|
199
199
|
auth: AuthConfig;
|
|
@@ -202,7 +202,7 @@ export interface AppConfig<Storage extends SessionStorage = SessionStorage> exte
|
|
|
202
202
|
hooks: HooksConfig;
|
|
203
203
|
future: FutureFlags;
|
|
204
204
|
}
|
|
205
|
-
interface AuthConfig {
|
|
205
|
+
export interface AuthConfig {
|
|
206
206
|
path: string;
|
|
207
207
|
callbackPath: string;
|
|
208
208
|
exitIframePath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-types.d.ts","sourceRoot":"","sources":["../../../src/server/config-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,IAAI,YAAY,EAC5B,eAAe,IAAI,SAAS,EAC5B,oBAAoB,EACpB,OAAO,EACP,UAAU,EACV,cAAc,EACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC;AAEpE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"config-types.d.ts","sourceRoot":"","sources":["../../../src/server/config-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,IAAI,YAAY,EAC5B,eAAe,IAAI,SAAS,EAC5B,oBAAoB,EACpB,OAAO,EACP,UAAU,EACV,cAAc,EACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC;AAEpE,OAAO,KAAK,EAAC,iBAAiB,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AACnE,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,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IACzB,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,cAAc,EAAE,CAAC;CAClD;AAED,UAAU,WAAW;IACnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE;AAED,MAAM,WAAW,gBAAgB,CAC/B,CAAC,SAAS,oBAAoB,GAAG,oBAAoB;IAErD,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;CAC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../../../src/server/future/flags.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../../../src/server/future/flags.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,SAAS,CAAC;AAExD,MAAM,MAAM,cAAc,CACxB,MAAM,SAAS,iBAAiB,EAChC,IAAI,SAAS,MAAM,WAAW,IAC5B,MAAM,SAAS,WAAW,GAC1B,MAAM,CAAC,IAAI,CAAC,SAAS,IAAI,GACvB,IAAI,GACJ,KAAK,GACP,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shopify-app.d.ts","sourceRoot":"","sources":["../../../src/server/shopify-app.ts"],"names":[],"mappings":"AAAA,OAAO,uCAAuC,CAAC;AAC/C,OAAO,EAIL,oBAAoB,EAErB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC;AAEpE,OAAO,EAAiB,KAAK,YAAY,EAAC,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAIL,KAAK,UAAU,EAKhB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"shopify-app.d.ts","sourceRoot":"","sources":["../../../src/server/shopify-app.ts"],"names":[],"mappings":"AAAA,OAAO,uCAAuC,CAAC;AAC/C,OAAO,EAIL,oBAAoB,EAErB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC;AAEpE,OAAO,EAAiB,KAAK,YAAY,EAAC,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAIL,KAAK,UAAU,EAKhB,MAAM,SAAS,CAAC;AAajB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CACxB,MAAM,SAAS,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,EAC/C,SAAS,SAAS,oBAAoB,EACtC,OAAO,SAAS,cAAc,EAC9B,SAAS,EAAE,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CA8CvC"}
|
|
@@ -15,6 +15,7 @@ var login_1 = require("./authenticate/login/login");
|
|
|
15
15
|
var admin_1 = require("./unauthenticated/admin");
|
|
16
16
|
var public_1 = require("./authenticate/public");
|
|
17
17
|
var storefront_1 = require("./unauthenticated/storefront");
|
|
18
|
+
var auth_code_flow_1 = require("./authenticate/admin/strategies/auth-code-flow");
|
|
18
19
|
/**
|
|
19
20
|
* Creates an object your app will use to interact with Shopify.
|
|
20
21
|
*
|
|
@@ -43,13 +44,14 @@ function shopifyApp(appConfig) {
|
|
|
43
44
|
api.webhooks.addHandlers(appConfig.webhooks);
|
|
44
45
|
}
|
|
45
46
|
var params = { api: api, config: config, logger: logger };
|
|
46
|
-
var oauth = new
|
|
47
|
+
var oauth = new auth_code_flow_1.AuthCodeFlowStrategy(params);
|
|
48
|
+
var authStrategy = (0, authenticate_1.authStrategyFactory)(tslib_1.__assign(tslib_1.__assign({}, params), { strategy: oauth }));
|
|
47
49
|
var shopify = {
|
|
48
50
|
sessionStorage: config.sessionStorage,
|
|
49
51
|
addDocumentResponseHeaders: (0, helpers_1.addDocumentResponseHeadersFactory)(params),
|
|
50
52
|
registerWebhooks: (0, webhooks_1.registerWebhooksFactory)(params),
|
|
51
53
|
authenticate: {
|
|
52
|
-
admin:
|
|
54
|
+
admin: authStrategy,
|
|
53
55
|
public: (0, public_1.authenticatePublicFactory)(params),
|
|
54
56
|
webhook: (0, authenticate_2.authenticateWebhookFactory)(params),
|
|
55
57
|
},
|
|
@@ -90,7 +92,7 @@ function deriveApi(appConfig) {
|
|
|
90
92
|
if (appConfig.userAgentPrefix) {
|
|
91
93
|
userAgentPrefix = "".concat(appConfig.userAgentPrefix, " | ").concat(userAgentPrefix);
|
|
92
94
|
}
|
|
93
|
-
return (0, shopify_api_1.shopifyApi)(tslib_1.__assign(tslib_1.__assign({}, appConfig), { hostName: appUrl.host, hostScheme: appUrl.protocol.replace(':', ''), userAgentPrefix: userAgentPrefix, isEmbeddedApp: (_a = appConfig.isEmbeddedApp) !== null && _a !== void 0 ? _a : true, apiVersion: (_b = appConfig.apiVersion) !== null && _b !== void 0 ? _b : shopify_api_1.LATEST_API_VERSION, isCustomStoreApp: appConfig.distribution === types_1.AppDistribution.ShopifyAdmin }));
|
|
95
|
+
return (0, shopify_api_1.shopifyApi)(tslib_1.__assign(tslib_1.__assign({}, appConfig), { hostName: appUrl.host, hostScheme: appUrl.protocol.replace(':', ''), userAgentPrefix: userAgentPrefix, isEmbeddedApp: (_a = appConfig.isEmbeddedApp) !== null && _a !== void 0 ? _a : true, apiVersion: (_b = appConfig.apiVersion) !== null && _b !== void 0 ? _b : shopify_api_1.LATEST_API_VERSION, isCustomStoreApp: appConfig.distribution === types_1.AppDistribution.ShopifyAdmin, future: {} }));
|
|
94
96
|
}
|
|
95
97
|
function deriveConfig(appConfig, apiConfig) {
|
|
96
98
|
var _a, _b, _c, _d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shopify-app.js","sourceRoot":"","sources":["../../../src/server/shopify-app.ts"],"names":[],"mappings":";;;;AAAA,iDAA+C;AAC/C,oDAM8B;AAI9B,iCASiB;AACjB,qCAAwD;AACxD,oDAAgE;AAChE,
|
|
1
|
+
{"version":3,"file":"shopify-app.js","sourceRoot":"","sources":["../../../src/server/shopify-app.ts"],"names":[],"mappings":";;;;AAAA,iDAA+C;AAC/C,oDAM8B;AAI9B,iCASiB;AACjB,qCAAwD;AACxD,oDAAgE;AAChE,kEAAsE;AACtE,qEAAgF;AAChF,qDAAiD;AACjD,kDAAyE;AACzE,oDAAwD;AACxD,iDAA2E;AAC3E,gDAAgE;AAChE,2DAAqF;AACrF,iFAAoF;AAEpF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,UAAU,CAIxB,SAAiB;IACjB,IAAM,GAAG,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,IAAM,MAAM,GAAG,YAAY,CAAU,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5D,IAAM,MAAM,GAAG,IAAA,gCAAc,EAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAE1C,IAAI,SAAS,CAAC,QAAQ,EAAE;QACtB,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;KAC9C;IAED,IAAM,MAAM,GAAgB,EAAC,GAAG,KAAA,EAAE,MAAM,QAAA,EAAE,MAAM,QAAA,EAAC,CAAC;IAClD,IAAM,KAAK,GAAG,IAAI,qCA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EACxE,eAAe,EAAE,MAAA,SAAS,CAAC,eAAe,mCAAI,KAAK,EACnD,KAAK,EAAE,MAAA,SAAS,CAAC,KAAK,mCAAI,EAAE,EAC5B,cAAc,EAAE,SAAS,CAAC,cAAyB,EACnD,MAAM,EAAE,MAAA,SAAS,CAAC,MAAM,mCAAI,EAAE,EAC9B,IAAI,EAAE;YACJ,IAAI,EAAE,cAAc;YACpB,YAAY,EAAE,UAAG,cAAc,cAAW;YAC1C,qBAAqB,EAAE,UAAG,cAAc,mBAAgB;YACxD,cAAc,EAAE,UAAG,cAAc,iBAAc;YAC/C,SAAS,EAAE,UAAG,cAAc,WAAQ;SACrC,IACD;AACJ,CAAC"}
|
|
@@ -216,8 +216,8 @@ export interface ShopifyAppBase<Config extends AppConfigArg> {
|
|
|
216
216
|
* Register webhook topics for a store using the given session. Most likely you want to use this in combination with the afterAuth hook.
|
|
217
217
|
*
|
|
218
218
|
* @example
|
|
219
|
-
* <caption>Registering webhooks
|
|
220
|
-
* <description>Trigger the registration after a merchant installs your app using the `afterAuth` hook
|
|
219
|
+
* <caption>Registering webhooks after install</caption>
|
|
220
|
+
* <description>Trigger the registration to create the webhook subscriptions after a merchant installs your app using the `afterAuth` hook. Learn more about [subscribing to webhooks.](/docs/api/shopify-app-remix/v1/guide-webhooks)</description>
|
|
221
221
|
* ```ts
|
|
222
222
|
* import { DeliveryMethod, shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
223
223
|
*
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SHOPIFY_REMIX_LIBRARY_VERSION = "2.
|
|
1
|
+
export declare const SHOPIFY_REMIX_LIBRARY_VERSION = "2.2.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopify/shopify-app-remix",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Shopify Remix - to simplify the building of Shopify Apps with Remix",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@shopify/generate-docs": "^0.11.1",
|
|
55
55
|
"@shopify/polaris": "^11.8.0",
|
|
56
56
|
"@shopify/react-testing": "^5.1.3",
|
|
57
|
-
"@shopify/shopify-app-session-storage-memory": "^2.0.
|
|
57
|
+
"@shopify/shopify-app-session-storage-memory": "^2.0.2",
|
|
58
58
|
"@types/jest": "^29.5.1",
|
|
59
59
|
"@types/jsonwebtoken": "^9.0.2",
|
|
60
60
|
"@types/react": "^18.2.18",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@remix-run/server-runtime": "^2.0.0",
|
|
71
|
-
"@shopify/shopify-api": "^8.
|
|
72
|
-
"@shopify/shopify-app-session-storage": "^2.0.
|
|
71
|
+
"@shopify/shopify-api": "^8.1.1",
|
|
72
|
+
"@shopify/shopify-app-session-storage": "^2.0.2",
|
|
73
73
|
"isbot": "^3.6.5",
|
|
74
74
|
"semver": "^7.5.0",
|
|
75
75
|
"tslib": "^2.5.0"
|