@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
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./get-offline-session"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/server/unauthenticated/helpers/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC"}
@@ -0,0 +1,4 @@
1
+ import { BasicParams } from '../../types';
2
+ import { GetUnauthenticatedStorefrontContext } from './types';
3
+ export declare function unauthenticatedStorefrontContextFactory(params: BasicParams): GetUnauthenticatedStorefrontContext;
4
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../../src/server/unauthenticated/storefront/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAIxC,OAAO,EAEL,mCAAmC,EACpC,MAAM,SAAS,CAAC;AAEjB,wBAAgB,uCAAuC,CACrD,MAAM,EAAE,WAAW,GAClB,mCAAmC,CAerC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unauthenticatedStorefrontContextFactory = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var shopify_api_1 = require("@shopify/shopify-api");
6
+ var storefront_1 = require("../../clients/storefront");
7
+ var helpers_1 = require("../helpers");
8
+ function unauthenticatedStorefrontContextFactory(params) {
9
+ var _this = this;
10
+ return function (shop) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
11
+ var session;
12
+ return tslib_1.__generator(this, function (_a) {
13
+ switch (_a.label) {
14
+ case 0: return [4 /*yield*/, (0, helpers_1.getOfflineSession)(shop, params)];
15
+ case 1:
16
+ session = _a.sent();
17
+ if (!session) {
18
+ throw new shopify_api_1.ShopifyError("Could not find a session for shop ".concat(shop, " when creating unauthenticated storefront context"));
19
+ }
20
+ return [2 /*return*/, {
21
+ session: session,
22
+ storefront: (0, storefront_1.storefrontClientFactory)({ params: params, session: session }),
23
+ }];
24
+ }
25
+ });
26
+ }); };
27
+ }
28
+ exports.unauthenticatedStorefrontContextFactory = unauthenticatedStorefrontContextFactory;
29
+ //# sourceMappingURL=factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../../../src/server/unauthenticated/storefront/factory.ts"],"names":[],"mappings":";;;;AAAA,oDAAkD;AAGlD,uDAAiE;AACjE,sCAA6C;AAO7C,SAAgB,uCAAuC,CACrD,MAAmB;IADrB,iBAiBC;IAdC,OAAO,UAAO,IAAY;;;;wBACR,qBAAM,IAAA,2BAAiB,EAAC,IAAI,EAAE,MAAM,CAAC,EAAA;;oBAA/C,OAAO,GAAG,SAAqC;oBAErD,IAAI,CAAC,OAAO,EAAE;wBACZ,MAAM,IAAI,0BAAY,CACpB,4CAAqC,IAAI,sDAAmD,CAC7F,CAAC;qBACH;oBAED,sBAAO;4BACL,OAAO,SAAA;4BACP,UAAU,EAAE,IAAA,oCAAuB,EAAC,EAAC,MAAM,QAAA,EAAE,OAAO,SAAA,EAAC,CAAC;yBACvD,EAAC;;;SACH,CAAC;AACJ,CAAC;AAjBD,0FAiBC"}
@@ -0,0 +1,2 @@
1
+ export * from './factory';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/server/unauthenticated/storefront/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./factory"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/server/unauthenticated/storefront/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B"}
@@ -0,0 +1,34 @@
1
+ import { Session } from '@shopify/shopify-api';
2
+ import type { StorefrontContext } from '../../clients';
3
+ export interface UnauthenticatedStorefrontContext {
4
+ /**
5
+ * The session for the given shop.
6
+ *
7
+ * This comes from the session storage which `shopifyApp` uses to store sessions in your database of choice.
8
+ *
9
+ * This will always be an offline session. You can use this to get shop specific data.
10
+ *
11
+ * @example
12
+ * <caption>Using the offline session.</caption>
13
+ * <description>Get your app's shop-specific data using the returned offline `session` object.</description>
14
+ * ```ts
15
+ * // app/routes/**\/.ts
16
+ * import { LoaderFunctionArgs, json } from "@remix-run/node";
17
+ * import { unauthenticated } from "../shopify.server";
18
+ * import { getMyAppData } from "~/db/model.server";
19
+ *
20
+ * export const loader = async ({ request }: LoaderFunctionArgs) => {
21
+ * const shop = getShopFromExternalRequest(request);
22
+ * const { session } = await unauthenticated.storefront(shop);
23
+ * return json(await getMyAppData({shop: session.shop));
24
+ * };
25
+ * ```
26
+ */
27
+ session: Session;
28
+ /**
29
+ * Method for interacting with the Shopify GraphQL Storefront API for the given store.
30
+ */
31
+ storefront: StorefrontContext;
32
+ }
33
+ export type GetUnauthenticatedStorefrontContext = (shop: string) => Promise<UnauthenticatedStorefrontContext>;
34
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/server/unauthenticated/storefront/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAE7C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,gCAAgC;IAC/C;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,UAAU,EAAE,iBAAiB,CAAC;CAC/B;AAED,MAAM,MAAM,mCAAmC,GAAG,CAChD,IAAI,EAAE,MAAM,KACT,OAAO,CAAC,gCAAgC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/server/unauthenticated/storefront/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { ReferenceEntityTemplateSchema } from '@shopify/generate-docs';
2
+ declare const data: ReferenceEntityTemplateSchema;
3
+ export default data;
4
+ //# sourceMappingURL=unauthenticated.storefront.doc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unauthenticated.storefront.doc.d.ts","sourceRoot":"","sources":["../../../../../src/server/unauthenticated/storefront/unauthenticated.storefront.doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,6BAyBX,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var data = {
4
+ name: 'Unauthenticated storefront',
5
+ description: "Allows interacting with the Storefront API on requests that didn't come from Shopify." +
6
+ '\n\n> Caution: This should only be used for Requests that do not originate from Shopify.' +
7
+ '\n> You must do your own authentication before using this method.' +
8
+ "\n>This function doesn't perform **any** validation and shouldn't rely on unvalidated user input.",
9
+ category: 'Unauthenticated',
10
+ type: 'object',
11
+ isVisualComponent: false,
12
+ definitions: [
13
+ {
14
+ title: 'unauthenticated.storefront',
15
+ description: 'Creates an unauthenticated Storefront context.',
16
+ type: 'GetUnauthenticatedStorefrontContext',
17
+ },
18
+ ],
19
+ jsDocTypeExamples: ['UnauthenticatedStorefrontContext', 'StorefrontContext'],
20
+ related: [
21
+ {
22
+ name: 'API context',
23
+ subtitle: 'Interact with the Storefront API.',
24
+ url: '/docs/api/shopify-app-remix/apis/storefront-api',
25
+ },
26
+ ],
27
+ };
28
+ exports.default = data;
29
+ //# sourceMappingURL=unauthenticated.storefront.doc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unauthenticated.storefront.doc.js","sourceRoot":"","sources":["../../../../../src/server/unauthenticated/storefront/unauthenticated.storefront.doc.ts"],"names":[],"mappings":";;AAEA,IAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,4BAA4B;IAClC,WAAW,EACT,uFAAuF;QACvF,0FAA0F;QAC1F,mEAAmE;QACnE,mGAAmG;IACrG,QAAQ,EAAE,iBAAiB;IAC3B,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,KAAK;IACxB,WAAW,EAAE;QACX;YACE,KAAK,EAAE,4BAA4B;YACnC,WAAW,EAAE,gDAAgD;YAC7D,IAAI,EAAE,qCAAqC;SAC5C;KACF;IACD,iBAAiB,EAAE,CAAC,kCAAkC,EAAE,mBAAmB,CAAC;IAC5E,OAAO,EAAE;QACP;YACE,IAAI,EAAE,aAAa;YACnB,QAAQ,EAAE,mCAAmC;YAC7C,GAAG,EAAE,iDAAiD;SACvD;KACF;CACF,CAAC;AAEF,kBAAe,IAAI,CAAC"}
@@ -0,0 +1,66 @@
1
+ import type { ShopifyRestResources } from '@shopify/shopify-api';
2
+ import type { GetUnauthenticatedAdminContext } from './admin/types';
3
+ import type { GetUnauthenticatedStorefrontContext } from './storefront/types';
4
+ export interface Unauthenticated<Resources extends ShopifyRestResources> {
5
+ /**
6
+ * Get an admin context by passing a shop
7
+ *
8
+ * **Warning** This should only be used for Requests that do not originate from Shopify.
9
+ * You must do your own authentication before using this method.
10
+ * This method throws an error if there is no session for the shop.
11
+ *
12
+ * @example
13
+ * <caption>Responding to a request not controlled by Shopify.</caption>
14
+ * ```ts
15
+ * // /app/shopify.server.ts
16
+ * import { LATEST_API_VERSION, shopifyApp } from "@shopify/shopify-app-remix/server";
17
+ * import { restResources } from "@shopify/shopify-api/rest/admin/2023-04";
18
+ *
19
+ * const shopify = shopifyApp({
20
+ * restResources,
21
+ * // ...etc
22
+ * });
23
+ * export default shopify;
24
+ * ```
25
+ * ```ts
26
+ * // /app/routes/**\/*.jsx
27
+ * import { LoaderFunctionArgs, json } from "@remix-run/node";
28
+ * import { authenticateExternal } from "~/helpers/authenticate"
29
+ * import shopify from "../../shopify.server";
30
+ *
31
+ * export async function loader({ request }: LoaderFunctionArgs) {
32
+ * const shop = await authenticateExternal(request)
33
+ * const {admin} = await shopify.unauthenticated.admin(shop);
34
+ *
35
+ * return json(await admin.rest.resources.Product.count({ session }));
36
+ * }
37
+ * ```
38
+ */
39
+ admin: GetUnauthenticatedAdminContext<Resources>;
40
+ /**
41
+ * Get a storefront context by passing a shop
42
+ *
43
+ * **Warning** This should only be used for Requests that do not originate from Shopify.
44
+ * You must do your own authentication before using this method.
45
+ * This method throws an error if there is no session for the shop.
46
+ *
47
+ * @example
48
+ * <caption>Responding to a request not controlled by Shopify</caption>
49
+ * ```ts
50
+ * // /app/routes/**\/*.jsx
51
+ * import { LoaderFunctionArgs, json } from "@remix-run/node";
52
+ * import { authenticateExternal } from "~/helpers/authenticate"
53
+ * import shopify from "../../shopify.server";
54
+ *
55
+ * export async function loader({ request }: LoaderFunctionArgs) {
56
+ * const shop = await authenticateExternal(request)
57
+ * const {storefront} = await shopify.unauthenticated.storefront(shop);
58
+ * const response = await storefront.graphql(`{blogs(first: 10) { edges { node { id } } } }`);
59
+ *
60
+ * return json(await response.json());
61
+ * }
62
+ * ```
63
+ */
64
+ storefront: GetUnauthenticatedStorefrontContext;
65
+ }
66
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/server/unauthenticated/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAE/D,OAAO,KAAK,EAAC,8BAA8B,EAAC,MAAM,eAAe,CAAC;AAClE,OAAO,KAAK,EAAC,mCAAmC,EAAC,MAAM,oBAAoB,CAAC;AAE5E,MAAM,WAAW,eAAe,CAAC,SAAS,SAAS,oBAAoB;IACrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,KAAK,EAAE,8BAA8B,CAAC,SAAS,CAAC,CAAC;IAEjD;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,UAAU,EAAE,mCAAmC,CAAC;CACjD"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/server/unauthenticated/types.ts"],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- export declare const SHOPIFY_REMIX_LIBRARY_VERSION = "1.2.1";
1
+ export declare const SHOPIFY_REMIX_LIBRARY_VERSION = "2.0.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SHOPIFY_REMIX_LIBRARY_VERSION = void 0;
4
- exports.SHOPIFY_REMIX_LIBRARY_VERSION = '1.2.1';
4
+ exports.SHOPIFY_REMIX_LIBRARY_VERSION = '2.0.0';
5
5
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopify/shopify-app-remix",
3
- "version": "1.2.1",
3
+ "version": "2.0.0",
4
4
  "description": "Shopify Remix - to simplify the building of Shopify Apps with Remix",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,6 +30,10 @@
30
30
  "default": "./build/cjs/react/index.js"
31
31
  }
32
32
  },
33
+ "scripts": {
34
+ "build-docs": "sh docs/build-docs.sh",
35
+ "validate-docs": "sh ./docs/build-docs.sh isTest && yarn compare-docs"
36
+ },
33
37
  "publishConfig": {
34
38
  "access": "public"
35
39
  },
@@ -46,10 +50,11 @@
46
50
  "Storefront API"
47
51
  ],
48
52
  "devDependencies": {
49
- "@remix-run/react": "^1.19.0",
53
+ "@remix-run/react": "^2.0.0",
54
+ "@shopify/generate-docs": "^0.11.1",
50
55
  "@shopify/polaris": "^11.8.0",
51
56
  "@shopify/react-testing": "^5.1.3",
52
- "@shopify/shopify-app-session-storage-memory": "^1.0.12",
57
+ "@shopify/shopify-app-session-storage-memory": "^2.0.0",
53
58
  "@types/jest": "^29.5.1",
54
59
  "@types/jsonwebtoken": "^9.0.2",
55
60
  "@types/react": "^18.2.18",
@@ -62,9 +67,9 @@
62
67
  "ts-jest": "^29.1.0"
63
68
  },
64
69
  "dependencies": {
65
- "@remix-run/server-runtime": "^1.17.1",
66
- "@shopify/shopify-api": "7.6.0",
67
- "@shopify/shopify-app-session-storage": "^1.1.9",
70
+ "@remix-run/server-runtime": "^2.0.0",
71
+ "@shopify/shopify-api": "^8.0.1",
72
+ "@shopify/shopify-app-session-storage": "^2.0.0",
68
73
  "isbot": "^3.6.5",
69
74
  "semver": "^7.5.0",
70
75
  "tslib": "^2.5.0"