@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.
Files changed (187) hide show
  1. package/README.md +35 -284
  2. package/build/cjs/react/components/AppProvider/AppProvider.js +35 -4
  3. package/build/cjs/server/authenticate/admin/billing/request.js +4 -2
  4. package/build/cjs/server/authenticate/public/appProxy/authenticate.js +7 -1
  5. package/build/cjs/server/authenticate/public/factory.js +1 -1
  6. package/build/cjs/server/authenticate/webhooks/authenticate.js +38 -20
  7. package/build/cjs/server/boundary/index.js +6 -6
  8. package/build/cjs/server/clients/storefront/factory.js +35 -0
  9. package/build/cjs/server/shopify-app.js +11 -9
  10. package/build/cjs/server/types.js +1 -1
  11. package/build/cjs/server/unauthenticated/admin/factory.js +2 -2
  12. package/build/cjs/server/unauthenticated/helpers/get-offline-session.js +14 -0
  13. package/build/cjs/server/unauthenticated/storefront/factory.js +25 -0
  14. package/build/cjs/server/version.js +1 -1
  15. package/build/ts/react/components/AppProvider/AppProvider.d.ts +48 -8
  16. package/build/ts/react/components/AppProvider/AppProvider.d.ts.map +1 -1
  17. package/build/ts/react/components/AppProvider/AppProvider.doc.d.ts +4 -0
  18. package/build/ts/react/components/AppProvider/AppProvider.doc.d.ts.map +1 -0
  19. package/build/ts/react/components/AppProvider/AppProvider.doc.js +34 -0
  20. package/build/ts/react/components/AppProvider/AppProvider.doc.js.map +1 -0
  21. package/build/ts/react/components/AppProvider/AppProvider.js +35 -3
  22. package/build/ts/react/components/AppProvider/AppProvider.js.map +1 -1
  23. package/build/ts/server/__test-helpers/expect-admin-api-client.d.ts +1 -1
  24. package/build/ts/server/__test-helpers/expect-admin-api-client.d.ts.map +1 -1
  25. package/build/ts/server/__test-helpers/expect-storefront-api-client.d.ts +8 -0
  26. package/build/ts/server/__test-helpers/expect-storefront-api-client.d.ts.map +1 -0
  27. package/build/ts/server/__test-helpers/expect-storefront-api-client.js +57 -0
  28. package/build/ts/server/__test-helpers/expect-storefront-api-client.js.map +1 -0
  29. package/build/ts/server/__test-helpers/index.d.ts +1 -0
  30. package/build/ts/server/__test-helpers/index.d.ts.map +1 -1
  31. package/build/ts/server/__test-helpers/index.js +1 -0
  32. package/build/ts/server/__test-helpers/index.js.map +1 -1
  33. package/build/ts/server/__test-helpers/test-config.d.ts +9 -4
  34. package/build/ts/server/__test-helpers/test-config.d.ts.map +1 -1
  35. package/build/ts/server/__test-helpers/test-config.js +2 -2
  36. package/build/ts/server/__test-helpers/test-config.js.map +1 -1
  37. package/build/ts/server/authenticate/admin/authenticate.admin.doc.d.ts +4 -0
  38. package/build/ts/server/authenticate/admin/authenticate.admin.doc.d.ts.map +1 -0
  39. package/build/ts/server/authenticate/admin/authenticate.admin.doc.js +35 -0
  40. package/build/ts/server/authenticate/admin/authenticate.admin.doc.js.map +1 -0
  41. package/build/ts/server/authenticate/admin/authenticate.d.ts.map +1 -1
  42. package/build/ts/server/authenticate/admin/authenticate.js.map +1 -1
  43. package/build/ts/server/authenticate/admin/billing/authenticate.admin.billing.doc.d.ts +4 -0
  44. package/build/ts/server/authenticate/admin/billing/authenticate.admin.billing.doc.d.ts.map +1 -0
  45. package/build/ts/server/authenticate/admin/billing/authenticate.admin.billing.doc.js +26 -0
  46. package/build/ts/server/authenticate/admin/billing/authenticate.admin.billing.doc.js.map +1 -0
  47. package/build/ts/server/authenticate/admin/billing/request.d.ts +1 -1
  48. package/build/ts/server/authenticate/admin/billing/request.d.ts.map +1 -1
  49. package/build/ts/server/authenticate/admin/billing/request.js +2 -8
  50. package/build/ts/server/authenticate/admin/billing/request.js.map +1 -1
  51. package/build/ts/server/authenticate/admin/billing/types.d.ts +71 -63
  52. package/build/ts/server/authenticate/admin/billing/types.d.ts.map +1 -1
  53. package/build/ts/server/authenticate/admin/types.d.ts +76 -40
  54. package/build/ts/server/authenticate/admin/types.d.ts.map +1 -1
  55. package/build/ts/server/authenticate/helpers/add-response-headers.d.ts +2 -1
  56. package/build/ts/server/authenticate/helpers/add-response-headers.d.ts.map +1 -1
  57. package/build/ts/server/authenticate/helpers/add-response-headers.js.map +1 -1
  58. package/build/ts/server/authenticate/public/appProxy/authenticate.d.ts.map +1 -1
  59. package/build/ts/server/authenticate/public/appProxy/authenticate.js +4 -2
  60. package/build/ts/server/authenticate/public/appProxy/authenticate.js.map +1 -1
  61. package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.d.ts +4 -0
  62. package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.d.ts.map +1 -0
  63. package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.js +32 -0
  64. package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.js.map +1 -0
  65. package/build/ts/server/authenticate/public/appProxy/types.d.ts +64 -8
  66. package/build/ts/server/authenticate/public/appProxy/types.d.ts.map +1 -1
  67. package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.d.ts +4 -0
  68. package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.d.ts.map +1 -0
  69. package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.js +21 -0
  70. package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.js.map +1 -0
  71. package/build/ts/server/authenticate/public/checkout/types.d.ts +19 -17
  72. package/build/ts/server/authenticate/public/checkout/types.d.ts.map +1 -1
  73. package/build/ts/server/authenticate/public/factory.js +1 -1
  74. package/build/ts/server/authenticate/public/types.d.ts +23 -21
  75. package/build/ts/server/authenticate/public/types.d.ts.map +1 -1
  76. package/build/ts/server/authenticate/webhooks/authenticate.d.ts +3 -2
  77. package/build/ts/server/authenticate/webhooks/authenticate.d.ts.map +1 -1
  78. package/build/ts/server/authenticate/webhooks/authenticate.js +31 -19
  79. package/build/ts/server/authenticate/webhooks/authenticate.js.map +1 -1
  80. package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.d.ts +4 -0
  81. package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.d.ts.map +1 -0
  82. package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.js +27 -0
  83. package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.js.map +1 -0
  84. package/build/ts/server/authenticate/webhooks/types.d.ts +170 -6
  85. package/build/ts/server/authenticate/webhooks/types.d.ts.map +1 -1
  86. package/build/ts/server/boundary/index.d.ts +6 -6
  87. package/build/ts/server/boundary/index.js +6 -6
  88. package/build/ts/server/clients/admin/authenticate.admin.api.doc.d.ts +4 -0
  89. package/build/ts/server/clients/admin/authenticate.admin.api.doc.d.ts.map +1 -0
  90. package/build/ts/server/clients/admin/authenticate.admin.api.doc.js +32 -0
  91. package/build/ts/server/clients/admin/authenticate.admin.api.doc.js.map +1 -0
  92. package/build/ts/server/clients/admin/factory.d.ts +1 -1
  93. package/build/ts/server/clients/admin/factory.d.ts.map +1 -1
  94. package/build/ts/server/clients/admin/factory.js.map +1 -1
  95. package/build/ts/server/clients/admin/graphql.d.ts +3 -15
  96. package/build/ts/server/clients/admin/graphql.d.ts.map +1 -1
  97. package/build/ts/server/clients/admin/graphql.js.map +1 -1
  98. package/build/ts/server/clients/admin/index.d.ts +1 -0
  99. package/build/ts/server/clients/admin/index.d.ts.map +1 -1
  100. package/build/ts/server/clients/admin/index.js +1 -0
  101. package/build/ts/server/clients/admin/index.js.map +1 -1
  102. package/build/ts/server/clients/admin/rest.d.ts +1 -1
  103. package/build/ts/server/clients/admin/rest.d.ts.map +1 -1
  104. package/build/ts/server/clients/admin/types.d.ts +105 -1
  105. package/build/ts/server/clients/admin/types.d.ts.map +1 -1
  106. package/build/ts/server/clients/index.d.ts +3 -0
  107. package/build/ts/server/clients/index.d.ts.map +1 -0
  108. package/build/ts/server/clients/index.js +6 -0
  109. package/build/ts/server/clients/index.js.map +1 -0
  110. package/build/ts/server/clients/storefront/authenticate.storefront.api.doc.d.ts +4 -0
  111. package/build/ts/server/clients/storefront/authenticate.storefront.api.doc.d.ts.map +1 -0
  112. package/build/ts/server/clients/storefront/authenticate.storefront.api.doc.js +32 -0
  113. package/build/ts/server/clients/storefront/authenticate.storefront.api.doc.js.map +1 -0
  114. package/build/ts/server/clients/storefront/factory.d.ts +8 -0
  115. package/build/ts/server/clients/storefront/factory.d.ts.map +1 -0
  116. package/build/ts/server/clients/storefront/factory.js +39 -0
  117. package/build/ts/server/clients/storefront/factory.js.map +1 -0
  118. package/build/ts/server/clients/storefront/index.d.ts +3 -0
  119. package/build/ts/server/clients/storefront/index.d.ts.map +1 -0
  120. package/build/ts/server/clients/storefront/index.js +6 -0
  121. package/build/ts/server/clients/storefront/index.js.map +1 -0
  122. package/build/ts/server/clients/storefront/types.d.ts +29 -0
  123. package/build/ts/server/clients/storefront/types.d.ts.map +1 -0
  124. package/build/ts/server/clients/storefront/types.js +3 -0
  125. package/build/ts/server/clients/storefront/types.js.map +1 -0
  126. package/build/ts/server/clients/types.d.ts +15 -0
  127. package/build/ts/server/clients/types.d.ts.map +1 -0
  128. package/build/ts/server/clients/types.js +3 -0
  129. package/build/ts/server/clients/types.js.map +1 -0
  130. package/build/ts/server/config-types.d.ts +39 -121
  131. package/build/ts/server/config-types.d.ts.map +1 -1
  132. package/build/ts/server/future/flags.d.ts +11 -0
  133. package/build/ts/server/future/flags.d.ts.map +1 -0
  134. package/build/ts/server/future/flags.js +3 -0
  135. package/build/ts/server/future/flags.js.map +1 -0
  136. package/build/ts/server/shopify-app.d.ts +3 -3
  137. package/build/ts/server/shopify-app.d.ts.map +1 -1
  138. package/build/ts/server/shopify-app.doc.d.ts +4 -0
  139. package/build/ts/server/shopify-app.doc.d.ts.map +1 -0
  140. package/build/ts/server/shopify-app.doc.js +42 -0
  141. package/build/ts/server/shopify-app.doc.js.map +1 -0
  142. package/build/ts/server/shopify-app.js +9 -8
  143. package/build/ts/server/shopify-app.js.map +1 -1
  144. package/build/ts/server/types.d.ts +202 -170
  145. package/build/ts/server/types.d.ts.map +1 -1
  146. package/build/ts/server/types.js.map +1 -1
  147. package/build/ts/server/unauthenticated/admin/factory.d.ts.map +1 -1
  148. package/build/ts/server/unauthenticated/admin/factory.js +3 -4
  149. package/build/ts/server/unauthenticated/admin/factory.js.map +1 -1
  150. package/build/ts/server/unauthenticated/admin/types.d.ts +11 -9
  151. package/build/ts/server/unauthenticated/admin/types.d.ts.map +1 -1
  152. package/build/ts/server/unauthenticated/admin/unauthenticated.admin.doc.d.ts +4 -0
  153. package/build/ts/server/unauthenticated/admin/unauthenticated.admin.doc.d.ts.map +1 -0
  154. package/build/ts/server/unauthenticated/admin/unauthenticated.admin.doc.js +29 -0
  155. package/build/ts/server/unauthenticated/admin/unauthenticated.admin.doc.js.map +1 -0
  156. package/build/ts/server/unauthenticated/helpers/get-offline-session.d.ts +4 -0
  157. package/build/ts/server/unauthenticated/helpers/get-offline-session.d.ts.map +1 -0
  158. package/build/ts/server/unauthenticated/helpers/get-offline-session.js +22 -0
  159. package/build/ts/server/unauthenticated/helpers/get-offline-session.js.map +1 -0
  160. package/build/ts/server/unauthenticated/helpers/index.d.ts +2 -0
  161. package/build/ts/server/unauthenticated/helpers/index.d.ts.map +1 -0
  162. package/build/ts/server/unauthenticated/helpers/index.js +5 -0
  163. package/build/ts/server/unauthenticated/helpers/index.js.map +1 -0
  164. package/build/ts/server/unauthenticated/storefront/factory.d.ts +4 -0
  165. package/build/ts/server/unauthenticated/storefront/factory.d.ts.map +1 -0
  166. package/build/ts/server/unauthenticated/storefront/factory.js +29 -0
  167. package/build/ts/server/unauthenticated/storefront/factory.js.map +1 -0
  168. package/build/ts/server/unauthenticated/storefront/index.d.ts +2 -0
  169. package/build/ts/server/unauthenticated/storefront/index.d.ts.map +1 -0
  170. package/build/ts/server/unauthenticated/storefront/index.js +5 -0
  171. package/build/ts/server/unauthenticated/storefront/index.js.map +1 -0
  172. package/build/ts/server/unauthenticated/storefront/types.d.ts +34 -0
  173. package/build/ts/server/unauthenticated/storefront/types.d.ts.map +1 -0
  174. package/build/ts/server/unauthenticated/storefront/types.js +3 -0
  175. package/build/ts/server/unauthenticated/storefront/types.js.map +1 -0
  176. package/build/ts/server/unauthenticated/storefront/unauthenticated.storefront.doc.d.ts +4 -0
  177. package/build/ts/server/unauthenticated/storefront/unauthenticated.storefront.doc.d.ts.map +1 -0
  178. package/build/ts/server/unauthenticated/storefront/unauthenticated.storefront.doc.js +29 -0
  179. package/build/ts/server/unauthenticated/storefront/unauthenticated.storefront.doc.js.map +1 -0
  180. package/build/ts/server/unauthenticated/types.d.ts +66 -0
  181. package/build/ts/server/unauthenticated/types.d.ts.map +1 -0
  182. package/build/ts/server/unauthenticated/types.js +3 -0
  183. package/build/ts/server/unauthenticated/types.js.map +1 -0
  184. package/build/ts/server/version.d.ts +1 -1
  185. package/build/ts/server/version.js +1 -1
  186. package/package.json +11 -6
  187. 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 shopify app. For example, the scopes your app needs.
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
- const cleanApiConfig = {
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. See https://github.com/Shopify/shopify-app-js/blob/main/README.md#session-storage-options for options.');
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 will be AppStore.
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 offlineSessionId = params.api.session.getOfflineId(shop);
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;
@@ -2,6 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const SHOPIFY_REMIX_LIBRARY_VERSION = '1.2.1';
5
+ const SHOPIFY_REMIX_LIBRARY_VERSION = '2.0.0';
6
6
 
7
7
  exports.SHOPIFY_REMIX_LIBRARY_VERSION = SHOPIFY_REMIX_LIBRARY_VERSION;
@@ -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 embedded or not. Defaults to `true`.
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
- * Wrap your app in the `AppProvider` component and pass in your API key.
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,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,gBAAgB,IAAI,uBAAuB,EAC5C,MAAM,kBAAkB,CAAC;AAM1B,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,uBAAuB,EAAE,eAAe,GAAG,MAAM,CAAC;IAC/D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,IAAI,CAAC,EAAE,uBAAuB,CAAC,MAAM,CAAC,CAAC;CAMxC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAsBlD"}
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,4 @@
1
+ import { ReferenceEntityTemplateSchema } from '@shopify/generate-docs';
2
+ declare const data: ReferenceEntityTemplateSchema;
3
+ export default data;
4
+ //# sourceMappingURL=AppProvider.doc.d.ts.map
@@ -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
- * Wrap your app in the `AppProvider` component and pass in your API key.
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":";;;;;AACA,4CAG0B;AAC1B,qFAA2D;AAE3D,qCAA2C;AAC3C,wDAAqD;AA0BrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;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
+ {"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 '../config-types';
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,iBAAiB,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"}
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 { SessionStorage } from '@shopify/shopify-app-session-storage';
2
- import { AppConfigArg } from '../config-types';
3
- export declare function testConfig(overrides?: Partial<AppConfigArg>): AppConfigArg & {
4
- sessionStorage: SessionStorage;
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":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC;AAIpE,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAI7C,wBAAgB,UAAU,CACxB,SAAS,GAAE,OAAO,CAAC,YAAY,CAAM,GACpC,YAAY,GAAG;IAAC,cAAc,EAAE,cAAc,CAAA;CAAC,CAejD"}
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":";;;;AACA,oDAAqE;AACrE,kGAAiF;AAIjF,iCAAyD;AAEzD,SAAgB,UAAU,CACxB,SAAqC;IAArC,0BAAA,EAAA,cAAqC;IAErC,0BACE,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,EACZ;AACJ,CAAC;AAjBD,gCAiBC"}
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,4 @@
1
+ import { ReferenceEntityTemplateSchema } from '@shopify/generate-docs';
2
+ declare const data: ReferenceEntityTemplateSchema;
3
+ export default data;
4
+ //# sourceMappingURL=authenticate.admin.doc.d.ts.map
@@ -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,EAEV,SAAS,EACT,YAAY,EACb,MAAM,oBAAoB,CAAC;AAe5B,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"}
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"}