@shopify/shopify-app-remix 1.2.1 → 2.0.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/README.md +35 -284
- package/build/cjs/react/components/AppProvider/AppProvider.js +35 -4
- package/build/cjs/server/authenticate/admin/billing/request.js +4 -2
- package/build/cjs/server/authenticate/public/appProxy/authenticate.js +7 -1
- package/build/cjs/server/authenticate/public/factory.js +1 -1
- package/build/cjs/server/authenticate/webhooks/authenticate.js +38 -20
- package/build/cjs/server/boundary/index.js +6 -6
- package/build/cjs/server/clients/storefront/factory.js +35 -0
- package/build/cjs/server/shopify-app.js +11 -9
- package/build/cjs/server/types.js +1 -1
- package/build/cjs/server/unauthenticated/admin/factory.js +2 -2
- package/build/cjs/server/unauthenticated/helpers/get-offline-session.js +14 -0
- package/build/cjs/server/unauthenticated/storefront/factory.js +25 -0
- package/build/cjs/server/version.js +1 -1
- package/build/ts/react/components/AppProvider/AppProvider.d.ts +48 -8
- package/build/ts/react/components/AppProvider/AppProvider.d.ts.map +1 -1
- package/build/ts/react/components/AppProvider/AppProvider.doc.d.ts +4 -0
- package/build/ts/react/components/AppProvider/AppProvider.doc.d.ts.map +1 -0
- package/build/ts/react/components/AppProvider/AppProvider.doc.js +34 -0
- package/build/ts/react/components/AppProvider/AppProvider.doc.js.map +1 -0
- package/build/ts/react/components/AppProvider/AppProvider.js +35 -3
- package/build/ts/react/components/AppProvider/AppProvider.js.map +1 -1
- package/build/ts/server/__test-helpers/expect-admin-api-client.d.ts +1 -1
- package/build/ts/server/__test-helpers/expect-admin-api-client.d.ts.map +1 -1
- package/build/ts/server/__test-helpers/expect-storefront-api-client.d.ts +8 -0
- package/build/ts/server/__test-helpers/expect-storefront-api-client.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/expect-storefront-api-client.js +57 -0
- package/build/ts/server/__test-helpers/expect-storefront-api-client.js.map +1 -0
- package/build/ts/server/__test-helpers/index.d.ts +1 -0
- package/build/ts/server/__test-helpers/index.d.ts.map +1 -1
- package/build/ts/server/__test-helpers/index.js +1 -0
- package/build/ts/server/__test-helpers/index.js.map +1 -1
- package/build/ts/server/__test-helpers/test-config.d.ts +9 -4
- package/build/ts/server/__test-helpers/test-config.d.ts.map +1 -1
- package/build/ts/server/__test-helpers/test-config.js +2 -2
- package/build/ts/server/__test-helpers/test-config.js.map +1 -1
- package/build/ts/server/authenticate/admin/authenticate.admin.doc.d.ts +4 -0
- package/build/ts/server/authenticate/admin/authenticate.admin.doc.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/authenticate.admin.doc.js +35 -0
- package/build/ts/server/authenticate/admin/authenticate.admin.doc.js.map +1 -0
- package/build/ts/server/authenticate/admin/authenticate.d.ts.map +1 -1
- package/build/ts/server/authenticate/admin/authenticate.js.map +1 -1
- package/build/ts/server/authenticate/admin/billing/authenticate.admin.billing.doc.d.ts +4 -0
- package/build/ts/server/authenticate/admin/billing/authenticate.admin.billing.doc.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/billing/authenticate.admin.billing.doc.js +26 -0
- package/build/ts/server/authenticate/admin/billing/authenticate.admin.billing.doc.js.map +1 -0
- package/build/ts/server/authenticate/admin/billing/request.d.ts +1 -1
- package/build/ts/server/authenticate/admin/billing/request.d.ts.map +1 -1
- package/build/ts/server/authenticate/admin/billing/request.js +2 -8
- package/build/ts/server/authenticate/admin/billing/request.js.map +1 -1
- package/build/ts/server/authenticate/admin/billing/types.d.ts +71 -63
- package/build/ts/server/authenticate/admin/billing/types.d.ts.map +1 -1
- package/build/ts/server/authenticate/admin/types.d.ts +76 -40
- package/build/ts/server/authenticate/admin/types.d.ts.map +1 -1
- package/build/ts/server/authenticate/helpers/add-response-headers.d.ts +2 -1
- package/build/ts/server/authenticate/helpers/add-response-headers.d.ts.map +1 -1
- package/build/ts/server/authenticate/helpers/add-response-headers.js.map +1 -1
- package/build/ts/server/authenticate/public/appProxy/authenticate.d.ts.map +1 -1
- package/build/ts/server/authenticate/public/appProxy/authenticate.js +4 -2
- package/build/ts/server/authenticate/public/appProxy/authenticate.js.map +1 -1
- package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.d.ts +4 -0
- package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.d.ts.map +1 -0
- package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.js +32 -0
- package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.js.map +1 -0
- package/build/ts/server/authenticate/public/appProxy/types.d.ts +64 -8
- package/build/ts/server/authenticate/public/appProxy/types.d.ts.map +1 -1
- package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.d.ts +4 -0
- package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.d.ts.map +1 -0
- package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.js +21 -0
- package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.js.map +1 -0
- package/build/ts/server/authenticate/public/checkout/types.d.ts +19 -17
- package/build/ts/server/authenticate/public/checkout/types.d.ts.map +1 -1
- package/build/ts/server/authenticate/public/factory.js +1 -1
- package/build/ts/server/authenticate/public/types.d.ts +23 -21
- package/build/ts/server/authenticate/public/types.d.ts.map +1 -1
- package/build/ts/server/authenticate/webhooks/authenticate.d.ts +3 -2
- package/build/ts/server/authenticate/webhooks/authenticate.d.ts.map +1 -1
- package/build/ts/server/authenticate/webhooks/authenticate.js +31 -19
- package/build/ts/server/authenticate/webhooks/authenticate.js.map +1 -1
- package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.d.ts +4 -0
- package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.d.ts.map +1 -0
- package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.js +27 -0
- package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.js.map +1 -0
- package/build/ts/server/authenticate/webhooks/types.d.ts +170 -6
- package/build/ts/server/authenticate/webhooks/types.d.ts.map +1 -1
- package/build/ts/server/boundary/index.d.ts +6 -6
- package/build/ts/server/boundary/index.js +6 -6
- package/build/ts/server/clients/admin/authenticate.admin.api.doc.d.ts +4 -0
- package/build/ts/server/clients/admin/authenticate.admin.api.doc.d.ts.map +1 -0
- package/build/ts/server/clients/admin/authenticate.admin.api.doc.js +32 -0
- package/build/ts/server/clients/admin/authenticate.admin.api.doc.js.map +1 -0
- package/build/ts/server/clients/admin/factory.d.ts +1 -1
- package/build/ts/server/clients/admin/factory.d.ts.map +1 -1
- package/build/ts/server/clients/admin/factory.js.map +1 -1
- package/build/ts/server/clients/admin/graphql.d.ts +3 -15
- package/build/ts/server/clients/admin/graphql.d.ts.map +1 -1
- package/build/ts/server/clients/admin/graphql.js.map +1 -1
- package/build/ts/server/clients/admin/index.d.ts +1 -0
- package/build/ts/server/clients/admin/index.d.ts.map +1 -1
- package/build/ts/server/clients/admin/index.js +1 -0
- package/build/ts/server/clients/admin/index.js.map +1 -1
- package/build/ts/server/clients/admin/rest.d.ts +1 -1
- package/build/ts/server/clients/admin/rest.d.ts.map +1 -1
- package/build/ts/server/clients/admin/types.d.ts +105 -1
- package/build/ts/server/clients/admin/types.d.ts.map +1 -1
- package/build/ts/server/clients/index.d.ts +3 -0
- package/build/ts/server/clients/index.d.ts.map +1 -0
- package/build/ts/server/clients/index.js +6 -0
- package/build/ts/server/clients/index.js.map +1 -0
- package/build/ts/server/clients/storefront/authenticate.storefront.api.doc.d.ts +4 -0
- package/build/ts/server/clients/storefront/authenticate.storefront.api.doc.d.ts.map +1 -0
- package/build/ts/server/clients/storefront/authenticate.storefront.api.doc.js +32 -0
- package/build/ts/server/clients/storefront/authenticate.storefront.api.doc.js.map +1 -0
- package/build/ts/server/clients/storefront/factory.d.ts +8 -0
- package/build/ts/server/clients/storefront/factory.d.ts.map +1 -0
- package/build/ts/server/clients/storefront/factory.js +39 -0
- package/build/ts/server/clients/storefront/factory.js.map +1 -0
- package/build/ts/server/clients/storefront/index.d.ts +3 -0
- package/build/ts/server/clients/storefront/index.d.ts.map +1 -0
- package/build/ts/server/clients/storefront/index.js +6 -0
- package/build/ts/server/clients/storefront/index.js.map +1 -0
- package/build/ts/server/clients/storefront/types.d.ts +29 -0
- package/build/ts/server/clients/storefront/types.d.ts.map +1 -0
- package/build/ts/server/clients/storefront/types.js +3 -0
- package/build/ts/server/clients/storefront/types.js.map +1 -0
- package/build/ts/server/clients/types.d.ts +15 -0
- package/build/ts/server/clients/types.d.ts.map +1 -0
- package/build/ts/server/clients/types.js +3 -0
- package/build/ts/server/clients/types.js.map +1 -0
- package/build/ts/server/config-types.d.ts +39 -121
- package/build/ts/server/config-types.d.ts.map +1 -1
- package/build/ts/server/future/flags.d.ts +11 -0
- package/build/ts/server/future/flags.d.ts.map +1 -0
- package/build/ts/server/future/flags.js +3 -0
- package/build/ts/server/future/flags.js.map +1 -0
- package/build/ts/server/shopify-app.d.ts +3 -3
- package/build/ts/server/shopify-app.d.ts.map +1 -1
- package/build/ts/server/shopify-app.doc.d.ts +4 -0
- package/build/ts/server/shopify-app.doc.d.ts.map +1 -0
- package/build/ts/server/shopify-app.doc.js +42 -0
- package/build/ts/server/shopify-app.doc.js.map +1 -0
- package/build/ts/server/shopify-app.js +9 -8
- package/build/ts/server/shopify-app.js.map +1 -1
- package/build/ts/server/types.d.ts +202 -170
- package/build/ts/server/types.d.ts.map +1 -1
- package/build/ts/server/types.js.map +1 -1
- package/build/ts/server/unauthenticated/admin/factory.d.ts.map +1 -1
- package/build/ts/server/unauthenticated/admin/factory.js +3 -4
- package/build/ts/server/unauthenticated/admin/factory.js.map +1 -1
- package/build/ts/server/unauthenticated/admin/types.d.ts +11 -9
- package/build/ts/server/unauthenticated/admin/types.d.ts.map +1 -1
- package/build/ts/server/unauthenticated/admin/unauthenticated.admin.doc.d.ts +4 -0
- package/build/ts/server/unauthenticated/admin/unauthenticated.admin.doc.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/admin/unauthenticated.admin.doc.js +29 -0
- package/build/ts/server/unauthenticated/admin/unauthenticated.admin.doc.js.map +1 -0
- package/build/ts/server/unauthenticated/helpers/get-offline-session.d.ts +4 -0
- package/build/ts/server/unauthenticated/helpers/get-offline-session.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/helpers/get-offline-session.js +22 -0
- package/build/ts/server/unauthenticated/helpers/get-offline-session.js.map +1 -0
- package/build/ts/server/unauthenticated/helpers/index.d.ts +2 -0
- package/build/ts/server/unauthenticated/helpers/index.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/helpers/index.js +5 -0
- package/build/ts/server/unauthenticated/helpers/index.js.map +1 -0
- package/build/ts/server/unauthenticated/storefront/factory.d.ts +4 -0
- package/build/ts/server/unauthenticated/storefront/factory.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/storefront/factory.js +29 -0
- package/build/ts/server/unauthenticated/storefront/factory.js.map +1 -0
- package/build/ts/server/unauthenticated/storefront/index.d.ts +2 -0
- package/build/ts/server/unauthenticated/storefront/index.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/storefront/index.js +5 -0
- package/build/ts/server/unauthenticated/storefront/index.js.map +1 -0
- package/build/ts/server/unauthenticated/storefront/types.d.ts +34 -0
- package/build/ts/server/unauthenticated/storefront/types.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/storefront/types.js +3 -0
- package/build/ts/server/unauthenticated/storefront/types.js.map +1 -0
- package/build/ts/server/unauthenticated/storefront/unauthenticated.storefront.doc.d.ts +4 -0
- package/build/ts/server/unauthenticated/storefront/unauthenticated.storefront.doc.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/storefront/unauthenticated.storefront.doc.js +29 -0
- package/build/ts/server/unauthenticated/storefront/unauthenticated.storefront.doc.js.map +1 -0
- package/build/ts/server/unauthenticated/types.d.ts +66 -0
- package/build/ts/server/unauthenticated/types.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/types.js +3 -0
- package/build/ts/server/unauthenticated/types.js.map +1 -0
- package/build/ts/server/version.d.ts +1 -1
- package/build/ts/server/version.js +1 -1
- package/package.json +11 -6
- package/build/tsconfig.tsbuildinfo +0 -1
|
@@ -15,17 +15,18 @@ require('isbot');
|
|
|
15
15
|
var login = require('./authenticate/login/login.js');
|
|
16
16
|
var factory$1 = require('./unauthenticated/admin/factory.js');
|
|
17
17
|
var factory = require('./authenticate/public/factory.js');
|
|
18
|
+
var factory$2 = require('./unauthenticated/storefront/factory.js');
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Creates an object your app will use to interact with Shopify.
|
|
21
22
|
*
|
|
22
|
-
* @param appConfig Configuration options for your
|
|
23
|
+
* @param appConfig Configuration options for your Shopify app, such as the scopes your app needs.
|
|
23
24
|
* @returns `ShopifyApp` An object constructed using your appConfig. It has methods for interacting with Shopify.
|
|
24
25
|
*
|
|
25
26
|
* @example
|
|
26
|
-
* The minimum viable configuration
|
|
27
|
+
* <caption>The minimum viable configuration</caption>
|
|
27
28
|
* ```ts
|
|
28
|
-
* import { shopifyApp } from "@shopify/shopify-app-remix";
|
|
29
|
+
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
29
30
|
*
|
|
30
31
|
* const shopify = shopifyApp({
|
|
31
32
|
* apiKey: process.env.SHOPIFY_API_KEY!,
|
|
@@ -59,7 +60,8 @@ function shopifyApp(appConfig) {
|
|
|
59
60
|
webhook: authenticate.authenticateWebhookFactory(params)
|
|
60
61
|
},
|
|
61
62
|
unauthenticated: {
|
|
62
|
-
admin: factory$1.unauthenticatedAdminContextFactory(params)
|
|
63
|
+
admin: factory$1.unauthenticatedAdminContextFactory(params),
|
|
64
|
+
storefront: factory$2.unauthenticatedStorefrontContextFactory(params)
|
|
63
65
|
}
|
|
64
66
|
};
|
|
65
67
|
if (isAppStoreApp(shopify, appConfig) || isSingleMerchantApp(shopify, appConfig)) {
|
|
@@ -92,7 +94,7 @@ function deriveApi(appConfig) {
|
|
|
92
94
|
if (appConfig.userAgentPrefix) {
|
|
93
95
|
userAgentPrefix = `${appConfig.userAgentPrefix} | ${userAgentPrefix}`;
|
|
94
96
|
}
|
|
95
|
-
|
|
97
|
+
return shopifyApi.shopifyApi({
|
|
96
98
|
...appConfig,
|
|
97
99
|
hostName: appUrl.host,
|
|
98
100
|
hostScheme: appUrl.protocol.replace(':', ''),
|
|
@@ -100,13 +102,12 @@ function deriveApi(appConfig) {
|
|
|
100
102
|
isEmbeddedApp: (_appConfig$isEmbedded = appConfig.isEmbeddedApp) !== null && _appConfig$isEmbedded !== void 0 ? _appConfig$isEmbedded : true,
|
|
101
103
|
apiVersion: (_appConfig$apiVersion = appConfig.apiVersion) !== null && _appConfig$apiVersion !== void 0 ? _appConfig$apiVersion : shopifyApi.LATEST_API_VERSION,
|
|
102
104
|
isCustomStoreApp: appConfig.distribution === types.AppDistribution.ShopifyAdmin
|
|
103
|
-
};
|
|
104
|
-
return shopifyApi.shopifyApi(cleanApiConfig);
|
|
105
|
+
});
|
|
105
106
|
}
|
|
106
107
|
function deriveConfig(appConfig, apiConfig) {
|
|
107
|
-
var _appConfig$distributi, _appConfig$useOnlineT, _appConfig$hooks;
|
|
108
|
+
var _appConfig$distributi, _appConfig$useOnlineT, _appConfig$hooks, _appConfig$future;
|
|
108
109
|
if (!appConfig.sessionStorage) {
|
|
109
|
-
throw new shopifyApi.ShopifyError('Please provide a valid session storage.
|
|
110
|
+
throw new shopifyApi.ShopifyError('Please provide a valid session storage. Refer to https://github.com/Shopify/shopify-app-js/blob/main/README.md#session-storage-options for options.');
|
|
110
111
|
}
|
|
111
112
|
const authPathPrefix = appConfig.authPathPrefix || '/auth';
|
|
112
113
|
appConfig.distribution = (_appConfig$distributi = appConfig.distribution) !== null && _appConfig$distributi !== void 0 ? _appConfig$distributi : types.AppDistribution.AppStore;
|
|
@@ -117,6 +118,7 @@ function deriveConfig(appConfig, apiConfig) {
|
|
|
117
118
|
useOnlineTokens: (_appConfig$useOnlineT = appConfig.useOnlineTokens) !== null && _appConfig$useOnlineT !== void 0 ? _appConfig$useOnlineT : false,
|
|
118
119
|
hooks: (_appConfig$hooks = appConfig.hooks) !== null && _appConfig$hooks !== void 0 ? _appConfig$hooks : {},
|
|
119
120
|
sessionStorage: appConfig.sessionStorage,
|
|
121
|
+
future: (_appConfig$future = appConfig.future) !== null && _appConfig$future !== void 0 ? _appConfig$future : {},
|
|
120
122
|
auth: {
|
|
121
123
|
path: authPathPrefix,
|
|
122
124
|
callbackPath: `${authPathPrefix}/callback`,
|
|
@@ -19,7 +19,7 @@ let LoginErrorType = /*#__PURE__*/function (LoginErrorType) {
|
|
|
19
19
|
/**
|
|
20
20
|
* An object your app can use to interact with Shopify.
|
|
21
21
|
*
|
|
22
|
-
* By default, the app's distribution
|
|
22
|
+
* By default, the app's distribution is `AppStore`.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
exports.AppDistribution = AppDistribution;
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var shopifyApi = require('@shopify/shopify-api');
|
|
6
6
|
var factory = require('../../clients/admin/factory.js');
|
|
7
|
+
var getOfflineSession = require('../helpers/get-offline-session.js');
|
|
7
8
|
|
|
8
9
|
function unauthenticatedAdminContextFactory(params) {
|
|
9
10
|
return async shop => {
|
|
10
|
-
const
|
|
11
|
-
const session = await params.config.sessionStorage.loadSession(offlineSessionId);
|
|
11
|
+
const session = await getOfflineSession.getOfflineSession(shop, params);
|
|
12
12
|
if (!session) {
|
|
13
13
|
throw new shopifyApi.ShopifyError(`Could not find a session for shop ${shop} when creating unauthenticated admin context`);
|
|
14
14
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
async function getOfflineSession(shop, {
|
|
6
|
+
api,
|
|
7
|
+
config
|
|
8
|
+
}) {
|
|
9
|
+
const offlineSessionId = api.session.getOfflineId(shop);
|
|
10
|
+
const session = await config.sessionStorage.loadSession(offlineSessionId);
|
|
11
|
+
return session;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.getOfflineSession = getOfflineSession;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var shopifyApi = require('@shopify/shopify-api');
|
|
6
|
+
var factory = require('../../clients/storefront/factory.js');
|
|
7
|
+
var getOfflineSession = require('../helpers/get-offline-session.js');
|
|
8
|
+
|
|
9
|
+
function unauthenticatedStorefrontContextFactory(params) {
|
|
10
|
+
return async shop => {
|
|
11
|
+
const session = await getOfflineSession.getOfflineSession(shop, params);
|
|
12
|
+
if (!session) {
|
|
13
|
+
throw new shopifyApi.ShopifyError(`Could not find a session for shop ${shop} when creating unauthenticated storefront context`);
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
session,
|
|
17
|
+
storefront: factory.storefrontClientFactory({
|
|
18
|
+
params,
|
|
19
|
+
session
|
|
20
|
+
})
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
exports.unauthenticatedStorefrontContextFactory = unauthenticatedStorefrontContextFactory;
|
|
@@ -1,30 +1,43 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { AppProviderProps as PolarisAppProviderProps } from '@shopify/polaris';
|
|
3
2
|
export interface AppProviderProps extends Omit<PolarisAppProviderProps, 'linkComponent' | 'i18n'> {
|
|
4
|
-
children: React.ReactNode;
|
|
5
3
|
/**
|
|
6
|
-
* The API key for your Shopify app.
|
|
4
|
+
* The API key for your Shopify app. This is the `Client ID` from the Partner Dashboard.
|
|
5
|
+
*
|
|
6
|
+
* When using the Shopify CLI, this is the `SHOPIFY_API_KEY` environment variable. If you're using the environment
|
|
7
|
+
* variable, then you need to pass it from the loader to the component.
|
|
7
8
|
*/
|
|
8
9
|
apiKey: string;
|
|
9
10
|
/**
|
|
10
|
-
* Whether the app is
|
|
11
|
+
* Whether the app is loaded inside the Shopify Admin. Default is `true`.
|
|
12
|
+
*
|
|
13
|
+
* {@link https://shopify.dev/docs/apps/admin/embedded-app-home}
|
|
11
14
|
*/
|
|
12
15
|
isEmbeddedApp?: boolean;
|
|
13
16
|
/**
|
|
14
|
-
* The i18n configuration for your Polaris provider.
|
|
17
|
+
* The internationalization (i18n) configuration for your Polaris provider.
|
|
15
18
|
*
|
|
16
19
|
* {@link https://polaris.shopify.com/components/utilities/app-provider}
|
|
17
20
|
*/
|
|
18
21
|
i18n?: PolarisAppProviderProps['i18n'];
|
|
22
|
+
/**
|
|
23
|
+
* Used internally by Shopify. You don't need to set this.
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
__APP_BRIDGE_URL?: string;
|
|
19
27
|
}
|
|
20
28
|
/**
|
|
21
|
-
* Sets up the Polaris AppProvider and injects the App Bridge script.
|
|
29
|
+
* Sets up the Polaris `AppProvider` and injects the App Bridge script.
|
|
30
|
+
*
|
|
31
|
+
* This component extends the [`AppProvider`](https://polaris.shopify.com/components/utilities/app-provider) component
|
|
32
|
+
* from Polaris, and accepts all of its props except for `linkComponent`, which is overridden to use the Remix `Link`
|
|
33
|
+
* component.
|
|
22
34
|
*
|
|
23
35
|
* {@link https://polaris.shopify.com/components/utilities/app-provider}
|
|
24
36
|
* {@link https://shopify.dev/tools/app-bridge}
|
|
25
37
|
*
|
|
26
38
|
* @example
|
|
27
|
-
*
|
|
39
|
+
* <caption>Set up AppProvider.</caption>
|
|
40
|
+
* <description>Wrap your app in the `AppProvider` component and pass in your API key.</description>
|
|
28
41
|
* ```ts
|
|
29
42
|
* import {authenticate} from '~/shopify.server';
|
|
30
43
|
* import {AppProvider} from '@shopify/shopify-app-remix/react';
|
|
@@ -39,7 +52,34 @@ export interface AppProviderProps extends Omit<PolarisAppProviderProps, 'linkCom
|
|
|
39
52
|
* const { apiKey } = useLoaderData();
|
|
40
53
|
*
|
|
41
54
|
* return (
|
|
42
|
-
* <AppProvider apiKey={apiKey}>
|
|
55
|
+
* <AppProvider isEmbeddedApp apiKey={apiKey}>
|
|
56
|
+
* <Outlet />
|
|
57
|
+
* </AppProvider>
|
|
58
|
+
* );
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* <caption>Localize Polaris components.</caption>
|
|
64
|
+
* <description>Pass in a different locale for Polaris to translate its components.</description>
|
|
65
|
+
* ```ts
|
|
66
|
+
* import {authenticate} from '~/shopify.server';
|
|
67
|
+
* import {AppProvider} from '@shopify/shopify-app-remix/react';
|
|
68
|
+
*
|
|
69
|
+
* export async function loader({ request }) {
|
|
70
|
+
* await authenticate.admin(request);
|
|
71
|
+
*
|
|
72
|
+
* return json({
|
|
73
|
+
* apiKey: process.env.SHOPIFY_API_KEY,
|
|
74
|
+
* polarisTranslations: require("@shopify/polaris/locales/fr.json"),
|
|
75
|
+
* });
|
|
76
|
+
* }
|
|
77
|
+
*
|
|
78
|
+
* export default function App() {
|
|
79
|
+
* const { apiKey, polarisTranslations } = useLoaderData();
|
|
80
|
+
*
|
|
81
|
+
* return (
|
|
82
|
+
* <AppProvider apiKey={apiKey} i18n={polarisTranslations}>
|
|
43
83
|
* <Outlet />
|
|
44
84
|
* </AppProvider>
|
|
45
85
|
* );
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppProvider.d.ts","sourceRoot":"","sources":["../../../../../src/react/components/AppProvider/AppProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AppProvider.d.ts","sourceRoot":"","sources":["../../../../../src/react/components/AppProvider/AppProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,IAAI,uBAAuB,EAC5C,MAAM,kBAAkB,CAAC;AAM1B,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,uBAAuB,EAAE,eAAe,GAAG,MAAM,CAAC;IAC/D;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,IAAI,CAAC,EAAE,uBAAuB,CAAC,MAAM,CAAC,CAAC;IACvC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAsBlD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppProvider.doc.d.ts","sourceRoot":"","sources":["../../../../../src/react/components/AppProvider/AppProvider.doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,6BA6BX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var data = {
|
|
4
|
+
name: 'AppProvider',
|
|
5
|
+
descriptionType: 'AppProviderGeneratedType',
|
|
6
|
+
description: '',
|
|
7
|
+
category: 'Entrypoints',
|
|
8
|
+
type: 'component',
|
|
9
|
+
isVisualComponent: false,
|
|
10
|
+
definitions: [
|
|
11
|
+
{
|
|
12
|
+
title: 'AppProviderProps',
|
|
13
|
+
description: 'Props for the `AppProvider` component.',
|
|
14
|
+
type: 'AppProviderProps',
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
jsDocTypeExamples: ['AppProviderGeneratedType'],
|
|
18
|
+
related: [
|
|
19
|
+
{
|
|
20
|
+
name: 'App bridge',
|
|
21
|
+
subtitle: 'Learn more about App Bridge.',
|
|
22
|
+
url: '/docs/api/app-bridge-library',
|
|
23
|
+
type: 'shopify',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'Polaris',
|
|
27
|
+
subtitle: 'Learn more about Polaris.',
|
|
28
|
+
url: '/docs/apps/tools/polaris',
|
|
29
|
+
type: 'shopify',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
exports.default = data;
|
|
34
|
+
//# sourceMappingURL=AppProvider.doc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppProvider.doc.js","sourceRoot":"","sources":["../../../../../src/react/components/AppProvider/AppProvider.doc.ts"],"names":[],"mappings":";;AAEA,IAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,aAAa;IACnB,eAAe,EAAE,0BAA0B;IAC3C,WAAW,EAAE,EAAE;IACf,QAAQ,EAAE,aAAa;IACvB,IAAI,EAAE,WAAW;IACjB,iBAAiB,EAAE,KAAK;IACxB,WAAW,EAAE;QACX;YACE,KAAK,EAAE,kBAAkB;YACzB,WAAW,EAAE,wCAAwC;YACrD,IAAI,EAAE,kBAAkB;SACzB;KACF;IACD,iBAAiB,EAAE,CAAC,0BAA0B,CAAC;IAC/C,OAAO,EAAE;QACP;YACE,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE,8BAA8B;YACxC,GAAG,EAAE,8BAA8B;YACnC,IAAI,EAAE,SAAS;SAChB;QACD;YACE,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,2BAA2B;YACrC,GAAG,EAAE,0BAA0B;YAC/B,IAAI,EAAE,SAAS;SAChB;KACF;CACF,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
|
@@ -8,13 +8,18 @@ var en_json_1 = tslib_1.__importDefault(require("@shopify/polaris/locales/en.jso
|
|
|
8
8
|
var const_1 = require("../../const");
|
|
9
9
|
var RemixPolarisLink_1 = require("../RemixPolarisLink");
|
|
10
10
|
/**
|
|
11
|
-
* Sets up the Polaris AppProvider and injects the App Bridge script.
|
|
11
|
+
* Sets up the Polaris `AppProvider` and injects the App Bridge script.
|
|
12
|
+
*
|
|
13
|
+
* This component extends the [`AppProvider`](https://polaris.shopify.com/components/utilities/app-provider) component
|
|
14
|
+
* from Polaris, and accepts all of its props except for `linkComponent`, which is overridden to use the Remix `Link`
|
|
15
|
+
* component.
|
|
12
16
|
*
|
|
13
17
|
* {@link https://polaris.shopify.com/components/utilities/app-provider}
|
|
14
18
|
* {@link https://shopify.dev/tools/app-bridge}
|
|
15
19
|
*
|
|
16
20
|
* @example
|
|
17
|
-
*
|
|
21
|
+
* <caption>Set up AppProvider.</caption>
|
|
22
|
+
* <description>Wrap your app in the `AppProvider` component and pass in your API key.</description>
|
|
18
23
|
* ```ts
|
|
19
24
|
* import {authenticate} from '~/shopify.server';
|
|
20
25
|
* import {AppProvider} from '@shopify/shopify-app-remix/react';
|
|
@@ -29,7 +34,34 @@ var RemixPolarisLink_1 = require("../RemixPolarisLink");
|
|
|
29
34
|
* const { apiKey } = useLoaderData();
|
|
30
35
|
*
|
|
31
36
|
* return (
|
|
32
|
-
* <AppProvider apiKey={apiKey}>
|
|
37
|
+
* <AppProvider isEmbeddedApp apiKey={apiKey}>
|
|
38
|
+
* <Outlet />
|
|
39
|
+
* </AppProvider>
|
|
40
|
+
* );
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* <caption>Localize Polaris components.</caption>
|
|
46
|
+
* <description>Pass in a different locale for Polaris to translate its components.</description>
|
|
47
|
+
* ```ts
|
|
48
|
+
* import {authenticate} from '~/shopify.server';
|
|
49
|
+
* import {AppProvider} from '@shopify/shopify-app-remix/react';
|
|
50
|
+
*
|
|
51
|
+
* export async function loader({ request }) {
|
|
52
|
+
* await authenticate.admin(request);
|
|
53
|
+
*
|
|
54
|
+
* return json({
|
|
55
|
+
* apiKey: process.env.SHOPIFY_API_KEY,
|
|
56
|
+
* polarisTranslations: require("@shopify/polaris/locales/fr.json"),
|
|
57
|
+
* });
|
|
58
|
+
* }
|
|
59
|
+
*
|
|
60
|
+
* export default function App() {
|
|
61
|
+
* const { apiKey, polarisTranslations } = useLoaderData();
|
|
62
|
+
*
|
|
63
|
+
* return (
|
|
64
|
+
* <AppProvider apiKey={apiKey} i18n={polarisTranslations}>
|
|
33
65
|
* <Outlet />
|
|
34
66
|
* </AppProvider>
|
|
35
67
|
* );
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppProvider.js","sourceRoot":"","sources":["../../../../../src/react/components/AppProvider/AppProvider.tsx"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"AppProvider.js","sourceRoot":"","sources":["../../../../../src/react/components/AppProvider/AppProvider.tsx"],"names":[],"mappings":";;;;;AAAA,4CAG0B;AAC1B,qFAA2D;AAE3D,qCAA2C;AAC3C,wDAAqD;AA8BrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,SAAgB,WAAW,CAAC,KAAuB;IAE/C,IAAA,QAAQ,GAMN,KAAK,SANC,EACR,MAAM,GAKJ,KAAK,OALD,EACN,IAAI,GAIF,KAAK,KAJH,EACJ,KAGE,KAAK,cAHa,EAApB,aAAa,mBAAG,IAAI,KAAA,EACpB,KAEE,KAAK,iBAF0B,EAAjC,gBAAgB,mBAAG,sBAAc,KAAA,EAC9B,YAAY,kBACb,KAAK,EAPH,mEAOL,CADgB,CACP;IAEV,OAAO,CACL,6DACG,aAAa,IAAI,mCAAQ,GAAG,EAAE,gBAAgB,kBAAgB,MAAM,GAAI,EACzE,uBAAC,qBAAkB,uBACb,YAAY,IAChB,aAAa,EAAE,mCAAgB,EAC/B,IAAI,EAAE,IAAI,IAAI,iBAAW,gBAExB,QAAQ,IACU,IACpB,CACJ,CAAC;AACJ,CAAC;AAtBD,kCAsBC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Session } from '@shopify/shopify-api';
|
|
2
|
-
import { AdminApiContext } from '../
|
|
2
|
+
import type { AdminApiContext } from '../clients';
|
|
3
3
|
export declare function expectAdminApiClient(factory: () => Promise<{
|
|
4
4
|
admin: AdminApiContext;
|
|
5
5
|
expectedSession: Session;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expect-admin-api-client.d.ts","sourceRoot":"","sources":["../../../../src/server/__test-helpers/expect-admin-api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAG7C,OAAO,EAAC,eAAe,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"expect-admin-api-client.d.ts","sourceRoot":"","sources":["../../../../src/server/__test-helpers/expect-admin-api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAG7C,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAOhD,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,OAAO,CAAC;IACrB,KAAK,EAAE,eAAe,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,QAqGH"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Session } from '@shopify/shopify-api';
|
|
2
|
+
import type { StorefrontContext } from '../clients';
|
|
3
|
+
export declare function expectStorefrontApiClient(factory: () => Promise<{
|
|
4
|
+
storefront: StorefrontContext;
|
|
5
|
+
expectedSession: Session;
|
|
6
|
+
actualSession: Session;
|
|
7
|
+
}>): void;
|
|
8
|
+
//# sourceMappingURL=expect-storefront-api-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expect-storefront-api-client.d.ts","sourceRoot":"","sources":["../../../../src/server/__test-helpers/expect-storefront-api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAG7C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAKlD,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,OAAO,CAAC;IACrB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,QAoCH"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.expectStorefrontApiClient = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var __1 = require("..");
|
|
6
|
+
var request_mock_1 = require("./request-mock");
|
|
7
|
+
var const_1 = require("./const");
|
|
8
|
+
function expectStorefrontApiClient(factory) {
|
|
9
|
+
var _this = this;
|
|
10
|
+
it('Storefront client can perform GraphQL Requests', function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
11
|
+
var _a, storefront, actualSession, apiResponse, response, _b;
|
|
12
|
+
return tslib_1.__generator(this, function (_c) {
|
|
13
|
+
switch (_c.label) {
|
|
14
|
+
case 0: return [4 /*yield*/, factory()];
|
|
15
|
+
case 1:
|
|
16
|
+
_a = _c.sent(), storefront = _a.storefront, actualSession = _a.actualSession;
|
|
17
|
+
apiResponse = { blogs: { nodes: [{ id: 1 }] } };
|
|
18
|
+
return [4 /*yield*/, (0, request_mock_1.mockExternalRequest)({
|
|
19
|
+
request: new Request("https://".concat(const_1.TEST_SHOP, "/api/").concat(__1.LATEST_API_VERSION, "/graphql.json"), {
|
|
20
|
+
method: 'POST',
|
|
21
|
+
headers: {
|
|
22
|
+
'Shopify-Storefront-Private-Token': actualSession.accessToken,
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
response: new Response(JSON.stringify(apiResponse)),
|
|
26
|
+
})];
|
|
27
|
+
case 2:
|
|
28
|
+
_c.sent();
|
|
29
|
+
return [4 /*yield*/, storefront.graphql('blogs(first: 1) { nodes { id }}')];
|
|
30
|
+
case 3:
|
|
31
|
+
response = _c.sent();
|
|
32
|
+
// THEN
|
|
33
|
+
expect(response.status).toEqual(200);
|
|
34
|
+
_b = expect;
|
|
35
|
+
return [4 /*yield*/, response.json()];
|
|
36
|
+
case 4:
|
|
37
|
+
_b.apply(void 0, [_c.sent()]).toEqual(apiResponse);
|
|
38
|
+
return [2 /*return*/];
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}); });
|
|
42
|
+
it('Storefront client uses the correct session', function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
43
|
+
var _a, expectedSession, actualSession;
|
|
44
|
+
return tslib_1.__generator(this, function (_b) {
|
|
45
|
+
switch (_b.label) {
|
|
46
|
+
case 0: return [4 /*yield*/, factory()];
|
|
47
|
+
case 1:
|
|
48
|
+
_a = _b.sent(), expectedSession = _a.expectedSession, actualSession = _a.actualSession;
|
|
49
|
+
// THEN
|
|
50
|
+
expect(expectedSession).toEqual(actualSession);
|
|
51
|
+
return [2 /*return*/];
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}); });
|
|
55
|
+
}
|
|
56
|
+
exports.expectStorefrontApiClient = expectStorefrontApiClient;
|
|
57
|
+
//# sourceMappingURL=expect-storefront-api-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expect-storefront-api-client.js","sourceRoot":"","sources":["../../../../src/server/__test-helpers/expect-storefront-api-client.ts"],"names":[],"mappings":";;;;AAEA,wBAAsC;AAGtC,+CAAmD;AACnD,iCAAkC;AAElC,SAAgB,yBAAyB,CACvC,OAIE;IALJ,iBAyCC;IAlCC,EAAE,CAAC,gDAAgD,EAAE;;;;wBAEf,qBAAM,OAAO,EAAE,EAAA;;oBAA7C,KAA8B,SAAe,EAA5C,UAAU,gBAAA,EAAE,aAAa,mBAAA;oBAC1B,WAAW,GAAG,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,CAAC,EAAC,EAAE,EAAE,CAAC,EAAC,CAAC,EAAC,EAAC,CAAC;oBAChD,qBAAM,IAAA,kCAAmB,EAAC;4BACxB,OAAO,EAAE,IAAI,OAAO,CAClB,kBAAW,iBAAS,kBAAQ,sBAAkB,kBAAe,EAC7D;gCACE,MAAM,EAAE,MAAM;gCACd,OAAO,EAAE;oCACP,kCAAkC,EAAE,aAAa,CAAC,WAAY;iCAC/D;6BACF,CACF;4BACD,QAAQ,EAAE,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;yBACpD,CAAC,EAAA;;oBAXF,SAWE,CAAC;oBAGc,qBAAM,UAAU,CAAC,OAAO,CACvC,iCAAiC,CAClC,EAAA;;oBAFK,QAAQ,GAAG,SAEhB;oBAED,OAAO;oBACP,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;oBACrC,KAAA,MAAM,CAAA;oBAAC,qBAAM,QAAQ,CAAC,IAAI,EAAE,EAAA;;oBAA5B,kBAAO,SAAqB,EAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;;;;SACpD,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EAAE;;;;wBAEN,qBAAM,OAAO,EAAE,EAAA;;oBAAlD,KAAmC,SAAe,EAAjD,eAAe,qBAAA,EAAE,aAAa,mBAAA;oBAErC,OAAO;oBACP,MAAM,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;;;;SAChD,CAAC,CAAC;AACL,CAAC;AAzCD,8DAyCC"}
|
|
@@ -6,6 +6,7 @@ export * from './expect-begin-auth-redirect';
|
|
|
6
6
|
export * from './expect-document-request-headers';
|
|
7
7
|
export * from './expect-exit-iframe';
|
|
8
8
|
export * from './expect-login-redirect';
|
|
9
|
+
export * from './expect-storefront-api-client';
|
|
9
10
|
export * from './get-hmac';
|
|
10
11
|
export * from './get-jwt';
|
|
11
12
|
export * from './get-thrown-response';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/__test-helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,uCAAuC,CAAC;AAC/C,OAAO,kBAAkB,CAAC;AAE1B,cAAc,SAAS,CAAC;AACxB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/__test-helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,uCAAuC,CAAC;AAC/C,OAAO,kBAAkB,CAAC;AAE1B,cAAc,SAAS,CAAC;AACxB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC"}
|
|
@@ -9,6 +9,7 @@ tslib_1.__exportStar(require("./expect-begin-auth-redirect"), exports);
|
|
|
9
9
|
tslib_1.__exportStar(require("./expect-document-request-headers"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./expect-exit-iframe"), exports);
|
|
11
11
|
tslib_1.__exportStar(require("./expect-login-redirect"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./expect-storefront-api-client"), exports);
|
|
12
13
|
tslib_1.__exportStar(require("./get-hmac"), exports);
|
|
13
14
|
tslib_1.__exportStar(require("./get-jwt"), exports);
|
|
14
15
|
tslib_1.__exportStar(require("./get-thrown-response"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/server/__test-helpers/index.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,4BAA0B;AAE1B,kDAAwB;AACxB,oEAA0C;AAC1C,uEAA6C;AAC7C,4EAAkD;AAClD,+DAAqC;AACrC,kEAAwC;AACxC,qDAA2B;AAC3B,oDAA0B;AAC1B,gEAAsC;AACtC,yDAA+B;AAC/B,gEAAsC;AACtC,gEAAsC;AACtC,wDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/server/__test-helpers/index.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,4BAA0B;AAE1B,kDAAwB;AACxB,oEAA0C;AAC1C,uEAA6C;AAC7C,4EAAkD;AAClD,+DAAqC;AACrC,kEAAwC;AACxC,yEAA+C;AAC/C,qDAA2B;AAC3B,oDAA0B;AAC1B,gEAAsC;AACtC,yDAA+B;AAC/B,gEAAsC;AACtC,gEAAsC;AACtC,wDAA8B"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { AppConfigArg } from '../config-types';
|
|
2
|
+
import type { FutureFlags } from '../future/flags';
|
|
3
|
+
type DefaultedFutureFlag<Overrides extends Partial<AppConfigArg>, Flag extends keyof FutureFlags> = Overrides['future'] extends FutureFlags ? Overrides['future'][Flag] : true;
|
|
4
|
+
type TestConfig<Overrides extends Partial<AppConfigArg>> = Omit<AppConfigArg, 'billing'> & Overrides & {
|
|
5
|
+
future: {
|
|
6
|
+
v3_webhookAdminContext: DefaultedFutureFlag<Overrides, 'v3_webhookAdminContext'>;
|
|
7
|
+
};
|
|
5
8
|
};
|
|
9
|
+
export declare function testConfig<Overrides extends Partial<AppConfigArg>>(overrides?: Overrides): TestConfig<Overrides>;
|
|
10
|
+
export {};
|
|
6
11
|
//# sourceMappingURL=test-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-config.d.ts","sourceRoot":"","sources":["../../../../src/server/__test-helpers/test-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test-config.d.ts","sourceRoot":"","sources":["../../../../src/server/__test-helpers/test-config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAIjD,KAAK,mBAAmB,CACtB,SAAS,SAAS,OAAO,CAAC,YAAY,CAAC,EACvC,IAAI,SAAS,MAAM,WAAW,IAC5B,SAAS,CAAC,QAAQ,CAAC,SAAS,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAE/E,KAAK,UAAU,CAAC,SAAS,SAAS,OAAO,CAAC,YAAY,CAAC,IAErD,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,GAC3B,SAAS,GAAG;IAEV,MAAM,EAAE;QACN,sBAAsB,EAAE,mBAAmB,CACzC,SAAS,EACT,wBAAwB,CACzB,CAAC;KACH,CAAC;CACH,CAAC;AAEN,wBAAgB,UAAU,CAAC,SAAS,SAAS,OAAO,CAAC,YAAY,CAAC,EAChE,SAAS,GAAE,SAA2B,GACrC,UAAU,CAAC,SAAS,CAAC,CAmBvB"}
|
|
@@ -7,10 +7,10 @@ var shopify_app_session_storage_memory_1 = require("@shopify/shopify-app-session
|
|
|
7
7
|
var const_1 = require("./const");
|
|
8
8
|
function testConfig(overrides) {
|
|
9
9
|
if (overrides === void 0) { overrides = {}; }
|
|
10
|
-
return tslib_1.__assign({ apiKey: const_1.API_KEY, apiSecretKey: const_1.API_SECRET_KEY, scopes: ['testScope'], apiVersion: shopify_api_1.LATEST_API_VERSION, appUrl: const_1.APP_URL, logger: {
|
|
10
|
+
return tslib_1.__assign(tslib_1.__assign({ apiKey: const_1.API_KEY, apiSecretKey: const_1.API_SECRET_KEY, scopes: ['testScope'], apiVersion: shopify_api_1.LATEST_API_VERSION, appUrl: const_1.APP_URL, logger: {
|
|
11
11
|
log: jest.fn(),
|
|
12
12
|
level: shopify_api_1.LogSeverity.Debug,
|
|
13
|
-
}, isEmbeddedApp: true, sessionStorage: new shopify_app_session_storage_memory_1.MemorySessionStorage() }, overrides);
|
|
13
|
+
}, isEmbeddedApp: true, sessionStorage: new shopify_app_session_storage_memory_1.MemorySessionStorage() }, overrides), { future: tslib_1.__assign({ v3_webhookAdminContext: true }, overrides.future) });
|
|
14
14
|
}
|
|
15
15
|
exports.testConfig = testConfig;
|
|
16
16
|
//# sourceMappingURL=test-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-config.js","sourceRoot":"","sources":["../../../../src/server/__test-helpers/test-config.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"test-config.js","sourceRoot":"","sources":["../../../../src/server/__test-helpers/test-config.ts"],"names":[],"mappings":";;;;AAAA,oDAAqE;AACrE,kGAAiF;AAKjF,iCAAyD;AAoBzD,SAAgB,UAAU,CACxB,SAAsC;IAAtC,0BAAA,EAAA,YAAuB,EAAe;IAEtC,2CACE,MAAM,EAAE,eAAO,EACf,YAAY,EAAE,sBAAc,EAC5B,MAAM,EAAE,CAAC,WAAW,CAAC,EACrB,UAAU,EAAE,gCAAkB,EAC9B,MAAM,EAAE,eAAO,EACf,MAAM,EAAE;YACN,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;YACd,KAAK,EAAE,yBAAW,CAAC,KAAK;SACzB,EACD,aAAa,EAAE,IAAI,EACnB,cAAc,EAAE,IAAI,yDAAoB,EAAE,IACvC,SAAS,KACZ,MAAM,qBACJ,sBAAsB,EAAE,IAAI,IACxB,SAAS,CAAC,MAA8B,KAE9C;AACJ,CAAC;AArBD,gCAqBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticate.admin.doc.d.ts","sourceRoot":"","sources":["../../../../../src/server/authenticate/admin/authenticate.admin.doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,6BAgCX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var data = {
|
|
4
|
+
name: 'Admin',
|
|
5
|
+
description: 'Contains functions for authenticating and interacting with the Admin API.\n\nThis function can handle requests for apps embedded in the Admin, Admin extensions, or non-embedded apps.',
|
|
6
|
+
category: 'Authenticate',
|
|
7
|
+
type: 'object',
|
|
8
|
+
isVisualComponent: false,
|
|
9
|
+
definitions: [
|
|
10
|
+
{
|
|
11
|
+
title: 'authenticate.admin',
|
|
12
|
+
description: 'Authenticates requests coming from the Shopify admin.\n\nThe shape of the returned object changes depending on the `isEmbeddedApp` config.',
|
|
13
|
+
type: 'AuthenticateAdmin',
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
jsDocTypeExamples: [
|
|
17
|
+
'EmbeddedAdminContext',
|
|
18
|
+
'AdminApiContext',
|
|
19
|
+
'BillingContext',
|
|
20
|
+
],
|
|
21
|
+
related: [
|
|
22
|
+
{
|
|
23
|
+
name: 'API context',
|
|
24
|
+
subtitle: 'Interact with the Admin API.',
|
|
25
|
+
url: '/docs/api/shopify-app-remix/apis/admin-api',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'Billing context',
|
|
29
|
+
subtitle: 'Bill merchants for your app using the Admin API.',
|
|
30
|
+
url: '/docs/api/shopify-app-remix/apis/billing',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
exports.default = data;
|
|
35
|
+
//# sourceMappingURL=authenticate.admin.doc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticate.admin.doc.js","sourceRoot":"","sources":["../../../../../src/server/authenticate/admin/authenticate.admin.doc.ts"],"names":[],"mappings":";;AAEA,IAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,OAAO;IACb,WAAW,EACT,wLAAwL;IAC1L,QAAQ,EAAE,cAAc;IACxB,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,KAAK;IACxB,WAAW,EAAE;QACX;YACE,KAAK,EAAE,oBAAoB;YAC3B,WAAW,EACT,4IAA4I;YAC9I,IAAI,EAAE,mBAAmB;SAC1B;KACF;IACD,iBAAiB,EAAE;QACjB,sBAAsB;QACtB,iBAAiB;QACjB,gBAAgB;KACjB;IACD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,aAAa;YACnB,QAAQ,EAAE,8BAA8B;YACxC,GAAG,EAAE,4CAA4C;SAClD;QACD;YACE,IAAI,EAAE,iBAAiB;YACvB,QAAQ,EAAE,kDAAkD;YAC5D,GAAG,EAAE,0CAA0C;SAChD;KACF;CACF,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../../../../src/server/authenticate/admin/authenticate.ts"],"names":[],"mappings":"AACA,OAAO,EAQL,OAAO,EACP,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../../../../src/server/authenticate/admin/authenticate.ts"],"names":[],"mappings":"AACA,OAAO,EAQL,OAAO,EACP,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAC,SAAS,EAAE,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAehE,OAAO,KAAK,EACV,YAAY,EAGb,MAAM,SAAS,CAAC;AAiBjB,qBAAa,YAAY,CACvB,MAAM,SAAS,YAAY,EAC3B,SAAS,SAAS,oBAAoB,GAAG,oBAAoB;IAE7D,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC;IAC5B,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAEjB,EAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAC,EAAE,WAAW;IAMxC,iBAAiB,CAC5B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;YAuC7B,gCAAgC;YA8ChC,sBAAsB;YAqBtB,yBAAyB;YAsDzB,iBAAiB;YAuBjB,qBAAqB;YAqFrB,WAAW;IAkBzB,OAAO,CAAC,oBAAoB;YAcd,6BAA6B;YAY7B,uCAAuC;YAgBvC,mBAAmB;YAsCnB,4BAA4B;YAoB5B,WAAW;YAwBX,0BAA0B;IAiBxC,OAAO,CAAC,oBAAoB;IAgB5B,OAAO,CAAC,oBAAoB;IAa5B,OAAO,CAAC,qBAAqB;CAgB9B"}
|