@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
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.storefrontClientFactory = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var runtime_1 = require("@shopify/shopify-api/runtime");
|
|
6
|
+
function storefrontClientFactory(_a) {
|
|
7
|
+
var _this = this;
|
|
8
|
+
var params = _a.params, session = _a.session;
|
|
9
|
+
var api = params.api;
|
|
10
|
+
return {
|
|
11
|
+
graphql: function (query, options) {
|
|
12
|
+
if (options === void 0) { options = {}; }
|
|
13
|
+
return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
14
|
+
var client, apiResponse;
|
|
15
|
+
return tslib_1.__generator(this, function (_a) {
|
|
16
|
+
switch (_a.label) {
|
|
17
|
+
case 0:
|
|
18
|
+
client = new api.clients.Storefront({
|
|
19
|
+
session: session,
|
|
20
|
+
apiVersion: options.apiVersion,
|
|
21
|
+
});
|
|
22
|
+
return [4 /*yield*/, client.query({
|
|
23
|
+
data: { query: query, variables: options === null || options === void 0 ? void 0 : options.variables },
|
|
24
|
+
tries: options.tries,
|
|
25
|
+
extraHeaders: options.headers,
|
|
26
|
+
})];
|
|
27
|
+
case 1:
|
|
28
|
+
apiResponse = _a.sent();
|
|
29
|
+
return [2 /*return*/, new Response(JSON.stringify(apiResponse.body), {
|
|
30
|
+
headers: (0, runtime_1.flatHeaders)(apiResponse.headers),
|
|
31
|
+
})];
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
exports.storefrontClientFactory = storefrontClientFactory;
|
|
39
|
+
//# sourceMappingURL=factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../../../src/server/clients/storefront/factory.ts"],"names":[],"mappings":";;;;AAAA,wDAAyD;AAOzD,SAAgB,uBAAuB,CAAC,EAMvC;IAND,iBA2BC;QA1BC,MAAM,YAAA,EACN,OAAO,aAAA;IAKA,IAAA,GAAG,GAAI,MAAM,IAAV,CAAW;IAErB,OAAO;QACL,OAAO,EAAE,UAAO,KAAK,EAAE,OAAY;YAAZ,wBAAA,EAAA,YAAY;;;;;;4BAC3B,MAAM,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC;gCACxC,OAAO,SAAA;gCACP,UAAU,EAAE,OAAO,CAAC,UAAU;6BAC/B,CAAC,CAAC;4BAEiB,qBAAM,MAAM,CAAC,KAAK,CAAC;oCACrC,IAAI,EAAE,EAAC,KAAK,OAAA,EAAE,SAAS,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,EAAC;oCAC5C,KAAK,EAAE,OAAO,CAAC,KAAK;oCACpB,YAAY,EAAE,OAAO,CAAC,OAAO;iCAC9B,CAAC,EAAA;;4BAJI,WAAW,GAAG,SAIlB;4BAEF,sBAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;oCACpD,OAAO,EAAE,IAAA,qBAAW,EAAC,WAAW,CAAC,OAAO,CAAC;iCAC1C,CAAC,EAAC;;;;SACJ;KACF,CAAC;AACJ,CAAC;AA3BD,0DA2BC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/storefront/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/server/clients/storefront/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B;AAC1B,kDAAwB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { GraphQLClient } from '../types';
|
|
2
|
+
export interface StorefrontContext {
|
|
3
|
+
/**
|
|
4
|
+
* Method for interacting with the Shopify Storefront GraphQL API
|
|
5
|
+
*
|
|
6
|
+
* If you're getting incorrect type hints in the Shopify template, follow [these instructions](https://github.com/Shopify/shopify-app-template-remix/tree/main#incorrect-graphql-hints).
|
|
7
|
+
*
|
|
8
|
+
* {@link https://shopify.dev/docs/api/storefront}
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <caption>Querying the GraphQL API.</caption>
|
|
12
|
+
* <description>Use `storefront.graphql` to make query / mutation requests.</description>
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { ActionFunctionArgs } from "@remix-run/node";
|
|
15
|
+
* import { authenticate } from "../shopify.server";
|
|
16
|
+
*
|
|
17
|
+
* export async function action({ request }: ActionFunctionArgs) {
|
|
18
|
+
* const { storefront } = await authenticate.storefront(request);
|
|
19
|
+
*
|
|
20
|
+
* const response = await storefront.graphql(`{blogs(first: 10) { edges { node { id } } } }`);
|
|
21
|
+
*
|
|
22
|
+
* const productData = await response.json();
|
|
23
|
+
* return json({ data: productData.data });
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
graphql: GraphQLClient;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/storefront/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAEvC,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,OAAO,EAAE,aAAa,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/server/clients/storefront/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ApiVersion } from '@shopify/shopify-api';
|
|
2
|
+
interface QueryVariables {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}
|
|
5
|
+
export interface GraphQLQueryOptions {
|
|
6
|
+
variables?: QueryVariables;
|
|
7
|
+
apiVersion?: ApiVersion;
|
|
8
|
+
headers?: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
tries?: number;
|
|
12
|
+
}
|
|
13
|
+
export type GraphQLClient = (query: string, options?: GraphQLQueryOptions) => Promise<Response>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/server/clients/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAEhD,UAAU,cAAc;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,OAAO,CAAC,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,aAAa,GAAG,CAC1B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,mBAAmB,KAC1B,OAAO,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/server/clients/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import { ConfigParams as ApiConfigArg, ConfigInterface as ApiConfig, ShopifyRestResources, Session, ApiVersion, WebhookHandler } from '@shopify/shopify-api';
|
|
2
2
|
import { SessionStorage } from '@shopify/shopify-app-session-storage';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import type { FutureFlags } from './future/flags';
|
|
4
|
+
import type { AppDistribution } from './types';
|
|
5
|
+
import type { AdminApiContext } from './clients';
|
|
6
6
|
export interface AppConfigArg<Resources extends ShopifyRestResources = ShopifyRestResources, Storage extends SessionStorage = SessionStorage> extends Omit<ApiConfigArg<Resources>, 'hostName' | 'hostScheme' | 'isEmbeddedApp' | 'apiVersion' | 'isCustomStoreApp'> {
|
|
7
7
|
/**
|
|
8
8
|
* The URL your app is running on.
|
|
9
9
|
*
|
|
10
|
-
* The `@shopify/cli` provides this URL as `process.env.SHOPIFY_APP_URL`. For development this is probably a tunnel URL that points to your local machine. If production this is your production URL.
|
|
10
|
+
* The `@shopify/cli` provides this URL as `process.env.SHOPIFY_APP_URL`. For development this is probably a tunnel URL that points to your local machine. If this is a production app, this is your production URL.
|
|
11
11
|
*/
|
|
12
12
|
appUrl: string;
|
|
13
13
|
/**
|
|
14
14
|
* An adaptor for storing sessions in your database of choice.
|
|
15
15
|
*
|
|
16
|
-
* Shopify provides multiple session storage adaptors and you can create your own.
|
|
16
|
+
* Shopify provides multiple session storage adaptors and you can create your own.
|
|
17
|
+
*
|
|
18
|
+
* {@link https://github.com/Shopify/shopify-app-js/blob/main/README.md#session-storage-options}
|
|
17
19
|
*
|
|
18
20
|
* @example
|
|
19
|
-
*
|
|
21
|
+
* <caption>Storing sessions with Prisma.</caption>
|
|
22
|
+
* <description>Add the `@shopify/shopify-app-session-storage-prisma` package to use the Prisma session storage.</description>
|
|
20
23
|
* ```ts
|
|
21
|
-
* import { shopifyApp } from "@shopify/shopify-app-remix";
|
|
24
|
+
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
22
25
|
* import { PrismaSessionStorage } from "@shopify/shopify-app-session-storage-prisma";
|
|
23
26
|
*
|
|
24
27
|
* import prisma from "~/db.server";
|
|
@@ -32,9 +35,9 @@ export interface AppConfigArg<Resources extends ShopifyRestResources = ShopifyRe
|
|
|
32
35
|
*/
|
|
33
36
|
sessionStorage: Storage;
|
|
34
37
|
/**
|
|
35
|
-
*
|
|
38
|
+
* Whether your app use online or offline tokens.
|
|
36
39
|
*
|
|
37
|
-
* If your app uses online tokens both online and offline tokens will be saved to your database. This ensures your app can perform background jobs
|
|
40
|
+
* If your app uses online tokens, then both online and offline tokens will be saved to your database. This ensures your app can perform background jobs.
|
|
38
41
|
*
|
|
39
42
|
* {@link https://shopify.dev/docs/apps/auth/oauth/access-modes}
|
|
40
43
|
*
|
|
@@ -49,10 +52,10 @@ export interface AppConfigArg<Resources extends ShopifyRestResources = ShopifyRe
|
|
|
49
52
|
* This can be in used in conjunction with the afterAuth hook to register webhook topics when a user installs your app. Or you can use this function in other processes such as background jobs.
|
|
50
53
|
*
|
|
51
54
|
* @example
|
|
52
|
-
* Registering for a webhook when a merchant uninstalls your app
|
|
55
|
+
* <caption>Registering for a webhook when a merchant uninstalls your app.</caption>
|
|
53
56
|
* ```ts
|
|
54
|
-
* // app/shopify.server.ts
|
|
55
|
-
* import { DeliveryMethod, shopifyApp } from "@shopify/shopify-app-remix";
|
|
57
|
+
* // /app/shopify.server.ts
|
|
58
|
+
* import { DeliveryMethod, shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
56
59
|
*
|
|
57
60
|
* const shopify = shopifyApp({
|
|
58
61
|
* webhooks: {
|
|
@@ -71,13 +74,13 @@ export interface AppConfigArg<Resources extends ShopifyRestResources = ShopifyRe
|
|
|
71
74
|
* export default shopify;
|
|
72
75
|
* export const authenticate = shopify.authenticate;
|
|
73
76
|
*
|
|
74
|
-
* // app/routes/webhooks.jsx
|
|
75
|
-
* import {
|
|
77
|
+
* // /app/routes/webhooks.jsx
|
|
78
|
+
* import { ActionFunctionArgs } from "@remix-run/node";
|
|
76
79
|
*
|
|
77
80
|
* import { authenticate } from "../shopify.server";
|
|
78
81
|
* import db from "../db.server";
|
|
79
82
|
*
|
|
80
|
-
* export const action = async ({ request }:
|
|
83
|
+
* export const action = async ({ request }: ActionFunctionArgs) => {
|
|
81
84
|
* const { topic, shop } = await authenticate.webhook(request);
|
|
82
85
|
*
|
|
83
86
|
* switch (topic) {
|
|
@@ -101,9 +104,9 @@ export interface AppConfigArg<Resources extends ShopifyRestResources = ShopifyRe
|
|
|
101
104
|
* These functions are called in the context of the request that triggered them. This means you can access the session.
|
|
102
105
|
*
|
|
103
106
|
* @example
|
|
104
|
-
* Seeding your database custom data when a merchant installs your app
|
|
107
|
+
* <caption>Seeding your database custom data when a merchant installs your app.</caption>
|
|
105
108
|
* ```ts
|
|
106
|
-
* import { DeliveryMethod, shopifyApp } from "@shopify/shopify-app-remix";
|
|
109
|
+
* import { DeliveryMethod, shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
107
110
|
* import { seedStoreData } from "~/db/seeds"
|
|
108
111
|
*
|
|
109
112
|
* const shopify = shopifyApp({
|
|
@@ -126,7 +129,7 @@ export interface AppConfigArg<Resources extends ShopifyRestResources = ShopifyRe
|
|
|
126
129
|
*/
|
|
127
130
|
isEmbeddedApp?: boolean;
|
|
128
131
|
/**
|
|
129
|
-
* How your app is distributed.
|
|
132
|
+
* How your app is distributed. Default is `AppDistribution.AppStore`.
|
|
130
133
|
*
|
|
131
134
|
* {@link https://shopify.dev/docs/apps/distribution}
|
|
132
135
|
*/
|
|
@@ -139,9 +142,9 @@ export interface AppConfigArg<Resources extends ShopifyRestResources = ShopifyRe
|
|
|
139
142
|
* @defaultValue `LATEST_API_VERSION` from `@shopify/shopify-app-remix`
|
|
140
143
|
*
|
|
141
144
|
* @example
|
|
142
|
-
* Using the latest API Version (Recommended)
|
|
145
|
+
* <caption>Using the latest API Version (Recommended)</caption>
|
|
143
146
|
* ```ts
|
|
144
|
-
* import { LATEST_API_VERSION, shopifyApp } from "@shopify/shopify-app-remix";
|
|
147
|
+
* import { LATEST_API_VERSION, shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
145
148
|
*
|
|
146
149
|
* const shopify = shopifyApp({
|
|
147
150
|
* // ...etc
|
|
@@ -158,10 +161,10 @@ export interface AppConfigArg<Resources extends ShopifyRestResources = ShopifyRe
|
|
|
158
161
|
* @default `"/auth"`
|
|
159
162
|
*
|
|
160
163
|
* @example
|
|
161
|
-
* Using the latest API Version (Recommended)
|
|
164
|
+
* <caption>Using the latest API Version (Recommended)</caption>
|
|
162
165
|
* ```ts
|
|
163
|
-
* // app/shopify.server.ts
|
|
164
|
-
* import { LATEST_API_VERSION, shopifyApp } from "@shopify/shopify-app-remix";
|
|
166
|
+
* // /app/shopify.server.ts
|
|
167
|
+
* import { LATEST_API_VERSION, shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
165
168
|
*
|
|
166
169
|
* const shopify = shopifyApp({
|
|
167
170
|
* // ...etc
|
|
@@ -170,11 +173,11 @@ export interface AppConfigArg<Resources extends ShopifyRestResources = ShopifyRe
|
|
|
170
173
|
* export default shopify;
|
|
171
174
|
* export const authenticate = shopify.authenticate;
|
|
172
175
|
*
|
|
173
|
-
* // app/routes/auth/$.jsx
|
|
174
|
-
* import {
|
|
176
|
+
* // /app/routes/auth/$.jsx
|
|
177
|
+
* import { LoaderFunctionArgs } from "@remix-run/node";
|
|
175
178
|
* import { authenticate } from "../../shopify.server";
|
|
176
179
|
*
|
|
177
|
-
* export async function loader({ request }:
|
|
180
|
+
* export async function loader({ request }: LoaderFunctionArgs) {
|
|
178
181
|
* await authenticate.admin(request);
|
|
179
182
|
*
|
|
180
183
|
* return null
|
|
@@ -182,6 +185,13 @@ export interface AppConfigArg<Resources extends ShopifyRestResources = ShopifyRe
|
|
|
182
185
|
* ```
|
|
183
186
|
*/
|
|
184
187
|
authPathPrefix?: string;
|
|
188
|
+
/**
|
|
189
|
+
* Features that will be introduced in future releases of this package.
|
|
190
|
+
*
|
|
191
|
+
* You can opt in to these features by setting the corresponding flags. By doing so, you can prepare for future
|
|
192
|
+
* releases in advance and provide feedback on the new features.
|
|
193
|
+
*/
|
|
194
|
+
future?: FutureFlags;
|
|
185
195
|
}
|
|
186
196
|
export interface AppConfig<Storage extends SessionStorage = SessionStorage> extends ApiConfig {
|
|
187
197
|
canUseLoginForm: boolean;
|
|
@@ -190,6 +200,7 @@ export interface AppConfig<Storage extends SessionStorage = SessionStorage> exte
|
|
|
190
200
|
sessionStorage: Storage;
|
|
191
201
|
useOnlineTokens: boolean;
|
|
192
202
|
hooks: HooksConfig;
|
|
203
|
+
future: FutureFlags;
|
|
193
204
|
}
|
|
194
205
|
interface AuthConfig {
|
|
195
206
|
path: string;
|
|
@@ -210,9 +221,9 @@ interface HooksConfig {
|
|
|
210
221
|
* @param context.admin - An object with access to the Shopify Admin API's.
|
|
211
222
|
*
|
|
212
223
|
* @example
|
|
213
|
-
* Registering webhooks and seeding data when a merchant installs your app
|
|
224
|
+
* <caption>Registering webhooks and seeding data when a merchant installs your app.</caption>
|
|
214
225
|
* ```ts
|
|
215
|
-
* import { DeliveryMethod, shopifyApp } from "@shopify/shopify-app-remix";
|
|
226
|
+
* import { DeliveryMethod, shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
216
227
|
* import { seedStoreData } from "~/db/seeds"
|
|
217
228
|
*
|
|
218
229
|
* const shopify = shopifyApp({
|
|
@@ -238,98 +249,5 @@ export interface AfterAuthOptions<R extends ShopifyRestResources = ShopifyRestRe
|
|
|
238
249
|
session: Session;
|
|
239
250
|
admin: AdminApiContext<R>;
|
|
240
251
|
}
|
|
241
|
-
export interface AdminApiContext<Resources extends ShopifyRestResources = ShopifyRestResources> {
|
|
242
|
-
/**
|
|
243
|
-
* Methods for interacting with the Shopify Admin REST API
|
|
244
|
-
*
|
|
245
|
-
* There are methods for interacting with individual REST resources. You can also make plain `GET`, `POST`, `PUT` and `DELETE` requests should the REST resources not meet your needs.
|
|
246
|
-
*
|
|
247
|
-
* {@link https://shopify.dev/docs/api/admin-rest}
|
|
248
|
-
*
|
|
249
|
-
* @example
|
|
250
|
-
* Getting the number of orders in a store using rest resources
|
|
251
|
-
* ```ts
|
|
252
|
-
* // app/shopify.server.ts
|
|
253
|
-
* import { shopifyApp } from "@shopify/shopify-app-remix";
|
|
254
|
-
* import { restResources } from "@shopify/shopify-api/rest/admin/2023-07";
|
|
255
|
-
*
|
|
256
|
-
* const shopify = shopifyApp({
|
|
257
|
-
* restResources,
|
|
258
|
-
* // ...etc
|
|
259
|
-
* });
|
|
260
|
-
* export default shopify;
|
|
261
|
-
* export const authenticate = shopify.authenticate;
|
|
262
|
-
*
|
|
263
|
-
* // app/routes/**\/.ts
|
|
264
|
-
* import { LoaderArgs, json } from "@remix-run/node";
|
|
265
|
-
* import { authenticate } from "../shopify.server";
|
|
266
|
-
*
|
|
267
|
-
* export const loader = async ({ request }: LoaderArgs) => {
|
|
268
|
-
* const { admin, session } = await authenticate.admin(request);
|
|
269
|
-
* return json(admin.rest.resources.Order.count({ session }));
|
|
270
|
-
* };
|
|
271
|
-
* ```
|
|
272
|
-
*
|
|
273
|
-
* @example
|
|
274
|
-
* Making a GET request to the REST API
|
|
275
|
-
* ```ts
|
|
276
|
-
* // app/shopify.server.ts
|
|
277
|
-
* import { shopifyApp } from "@shopify/shopify-app-remix";
|
|
278
|
-
* import { restResources } from "@shopify/shopify-api/rest/admin/2023-04";
|
|
279
|
-
*
|
|
280
|
-
* const shopify = shopifyApp({
|
|
281
|
-
* restResources,
|
|
282
|
-
* // ...etc
|
|
283
|
-
* });
|
|
284
|
-
* export default shopify;
|
|
285
|
-
* export const authenticate = shopify.authenticate;
|
|
286
|
-
*
|
|
287
|
-
* // app/routes/**\/.ts
|
|
288
|
-
* import { LoaderArgs, json } from "@remix-run/node";
|
|
289
|
-
* import { authenticate } from "../shopify.server";
|
|
290
|
-
*
|
|
291
|
-
* export const loader = async ({ request }: LoaderArgs) => {
|
|
292
|
-
* const { admin, session } = await authenticate.admin(request);
|
|
293
|
-
* const response = await admin.rest.get({ path: "/customers/count.json" });
|
|
294
|
-
* const customers = await response.json();
|
|
295
|
-
* return json({ customers });
|
|
296
|
-
* };
|
|
297
|
-
* ```
|
|
298
|
-
*/
|
|
299
|
-
rest: RestClientWithResources<Resources>;
|
|
300
|
-
/**
|
|
301
|
-
* Methods for interacting with the Shopify Admin GraphQL API
|
|
302
|
-
*
|
|
303
|
-
* {@link https://shopify.dev/docs/api/admin-graphql}
|
|
304
|
-
* {@link https://github.com/Shopify/shopify-api-js/blob/main/docs/reference/clients/Graphql.md}
|
|
305
|
-
*
|
|
306
|
-
* @example
|
|
307
|
-
* Creating a new product
|
|
308
|
-
* ```ts
|
|
309
|
-
* import { ActionArgs } from "@remix-run/node";
|
|
310
|
-
* import { authenticate } from "../shopify.server";
|
|
311
|
-
*
|
|
312
|
-
* export async function action({ request }: ActionArgs) {
|
|
313
|
-
* const { admin } = await authenticate.admin(request);
|
|
314
|
-
*
|
|
315
|
-
* const response = await admin.graphql(
|
|
316
|
-
* `#graphql
|
|
317
|
-
* mutation populateProduct($input: ProductInput!) {
|
|
318
|
-
* productCreate(input: $input) {
|
|
319
|
-
* product {
|
|
320
|
-
* id
|
|
321
|
-
* }
|
|
322
|
-
* }
|
|
323
|
-
* }`,
|
|
324
|
-
* { variables: { input: { title: "Product Name" } } }
|
|
325
|
-
* );
|
|
326
|
-
*
|
|
327
|
-
* const productData = await response.json();
|
|
328
|
-
* return json({ data: productData.data });
|
|
329
|
-
* }
|
|
330
|
-
* ```
|
|
331
|
-
*/
|
|
332
|
-
graphql: GraphqlQueryFunction;
|
|
333
|
-
}
|
|
334
252
|
export {};
|
|
335
253
|
//# sourceMappingURL=config-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-types.d.ts","sourceRoot":"","sources":["../../../src/server/config-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,IAAI,YAAY,EAC5B,eAAe,IAAI,SAAS,EAC5B,oBAAoB,EACpB,OAAO,EACP,UAAU,EACV,cAAc,EACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,cAAc,E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;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,SAAS,CAAC,OAAO,SAAS,cAAc,GAAG,cAAc,CACxE,SAAQ,SAAS;IACjB,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,UAAU,CAAC;IACjB,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,cAAc,EAAE,CAAC;CAClD;AAED,UAAU,WAAW;IACnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE;AAED,MAAM,WAAW,gBAAgB,CAC/B,CAAC,SAAS,oBAAoB,GAAG,oBAAoB;IAErD,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;CAC3B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface FutureFlags {
|
|
2
|
+
/**
|
|
3
|
+
* When enabled, returns the same `admin` context (`AdminApiContext`) from `authenticate.webhook` that is returned from `authenticate.admin`.
|
|
4
|
+
*
|
|
5
|
+
* @default false
|
|
6
|
+
*/
|
|
7
|
+
v3_webhookAdminContext?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type FutureFlagOptions = FutureFlags | undefined;
|
|
10
|
+
export type FeatureEnabled<Future extends FutureFlagOptions, Flag extends keyof FutureFlags> = Future extends FutureFlags ? Future[Flag] extends true ? true : false : false;
|
|
11
|
+
//# sourceMappingURL=flags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../../../src/server/future/flags.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,SAAS,CAAC;AAExD,MAAM,MAAM,cAAc,CACxB,MAAM,SAAS,iBAAiB,EAChC,IAAI,SAAS,MAAM,WAAW,IAC5B,MAAM,SAAS,WAAW,GAC1B,MAAM,CAAC,IAAI,CAAC,SAAS,IAAI,GACvB,IAAI,GACJ,KAAK,GACP,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../../../../src/server/future/flags.ts"],"names":[],"mappings":""}
|
|
@@ -6,13 +6,13 @@ import { type ShopifyApp } from './types';
|
|
|
6
6
|
/**
|
|
7
7
|
* Creates an object your app will use to interact with Shopify.
|
|
8
8
|
*
|
|
9
|
-
* @param appConfig Configuration options for your
|
|
9
|
+
* @param appConfig Configuration options for your Shopify app, such as the scopes your app needs.
|
|
10
10
|
* @returns `ShopifyApp` An object constructed using your appConfig. It has methods for interacting with Shopify.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
|
-
* The minimum viable configuration
|
|
13
|
+
* <caption>The minimum viable configuration</caption>
|
|
14
14
|
* ```ts
|
|
15
|
-
* import { shopifyApp } from "@shopify/shopify-app-remix";
|
|
15
|
+
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
16
16
|
*
|
|
17
17
|
* const shopify = shopifyApp({
|
|
18
18
|
* apiKey: process.env.SHOPIFY_API_KEY!,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shopify-app.d.ts","sourceRoot":"","sources":["../../../src/server/shopify-app.ts"],"names":[],"mappings":"AAAA,OAAO,uCAAuC,CAAC;AAC/C,OAAO,
|
|
1
|
+
{"version":3,"file":"shopify-app.d.ts","sourceRoot":"","sources":["../../../src/server/shopify-app.ts"],"names":[],"mappings":"AAAA,OAAO,uCAAuC,CAAC;AAC/C,OAAO,EAIL,oBAAoB,EAErB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC;AAEpE,OAAO,EAAiB,KAAK,YAAY,EAAC,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAIL,KAAK,UAAU,EAKhB,MAAM,SAAS,CAAC;AAYjB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CACxB,MAAM,SAAS,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,EAC/C,SAAS,SAAS,oBAAoB,EACtC,OAAO,SAAS,cAAc,EAC9B,SAAS,EAAE,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CA0CvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shopify-app.doc.d.ts","sourceRoot":"","sources":["../../../src/server/shopify-app.doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,6BAuCX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var data = {
|
|
4
|
+
name: 'shopifyApp',
|
|
5
|
+
description: "Returns a set of functions that can be used by the app's backend to be able to respond to all Shopify requests." +
|
|
6
|
+
'\n\nThe shape of the returned object changes depending on the value of `distribution`. If it is `AppDistribution.ShopifyAdmin`, then only `ShopifyAppBase` objects are returned, otherwise `ShopifyAppLogin` objects are included.',
|
|
7
|
+
category: 'Entrypoints',
|
|
8
|
+
type: 'function',
|
|
9
|
+
isVisualComponent: false,
|
|
10
|
+
definitions: [
|
|
11
|
+
{
|
|
12
|
+
title: 'shopifyApp',
|
|
13
|
+
description: 'Function to create a new Shopify API object.',
|
|
14
|
+
type: 'ShopifyAppGeneratedType',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
title: 'Future flags',
|
|
18
|
+
description: 'Set future flags using the `future` configuration field to opt in to upcoming breaking changes.' +
|
|
19
|
+
'\n\nWith this feature, you can prepare for major releases ahead of time, as well as try out new features before they are released.',
|
|
20
|
+
type: 'FutureFlags',
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
jsDocTypeExamples: [
|
|
24
|
+
'ShopifyAppGeneratedType',
|
|
25
|
+
'ShopifyAppBase',
|
|
26
|
+
'ShopifyAppLogin',
|
|
27
|
+
],
|
|
28
|
+
related: [
|
|
29
|
+
{
|
|
30
|
+
name: 'Authenticated contexts',
|
|
31
|
+
subtitle: 'Authenticate requests coming from Shopify.',
|
|
32
|
+
url: '/docs/api/shopify-app-remix/authenticate',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'Unauthenticated contexts',
|
|
36
|
+
subtitle: 'Interact with the API on non-Shopify requests.',
|
|
37
|
+
url: '/docs/api/shopify-app-remix/unauthenticated',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
};
|
|
41
|
+
exports.default = data;
|
|
42
|
+
//# sourceMappingURL=shopify-app.doc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shopify-app.doc.js","sourceRoot":"","sources":["../../../src/server/shopify-app.doc.ts"],"names":[],"mappings":";;AAEA,IAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,YAAY;IAClB,WAAW,EACT,iHAAiH;QACjH,oOAAoO;IACtO,QAAQ,EAAE,aAAa;IACvB,IAAI,EAAE,UAAU;IAChB,iBAAiB,EAAE,KAAK;IACxB,WAAW,EAAE;QACX;YACE,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,8CAA8C;YAC3D,IAAI,EAAE,yBAAyB;SAChC;QACD;YACE,KAAK,EAAE,cAAc;YACrB,WAAW,EACT,iGAAiG;gBACjG,oIAAoI;YACtI,IAAI,EAAE,aAAa;SACpB;KACF;IACD,iBAAiB,EAAE;QACjB,yBAAyB;QACzB,gBAAgB;QAChB,iBAAiB;KAClB;IACD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,wBAAwB;YAC9B,QAAQ,EAAE,4CAA4C;YACtD,GAAG,EAAE,0CAA0C;SAChD;QACD;YACE,IAAI,EAAE,0BAA0B;YAChC,QAAQ,EAAE,gDAAgD;YAC1D,GAAG,EAAE,6CAA6C;SACnD;KACF;CACF,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
|
@@ -14,16 +14,17 @@ var helpers_1 = require("./authenticate/helpers");
|
|
|
14
14
|
var login_1 = require("./authenticate/login/login");
|
|
15
15
|
var admin_1 = require("./unauthenticated/admin");
|
|
16
16
|
var public_1 = require("./authenticate/public");
|
|
17
|
+
var storefront_1 = require("./unauthenticated/storefront");
|
|
17
18
|
/**
|
|
18
19
|
* Creates an object your app will use to interact with Shopify.
|
|
19
20
|
*
|
|
20
|
-
* @param appConfig Configuration options for your
|
|
21
|
+
* @param appConfig Configuration options for your Shopify app, such as the scopes your app needs.
|
|
21
22
|
* @returns `ShopifyApp` An object constructed using your appConfig. It has methods for interacting with Shopify.
|
|
22
23
|
*
|
|
23
24
|
* @example
|
|
24
|
-
* The minimum viable configuration
|
|
25
|
+
* <caption>The minimum viable configuration</caption>
|
|
25
26
|
* ```ts
|
|
26
|
-
* import { shopifyApp } from "@shopify/shopify-app-remix";
|
|
27
|
+
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
27
28
|
*
|
|
28
29
|
* const shopify = shopifyApp({
|
|
29
30
|
* apiKey: process.env.SHOPIFY_API_KEY!,
|
|
@@ -54,6 +55,7 @@ function shopifyApp(appConfig) {
|
|
|
54
55
|
},
|
|
55
56
|
unauthenticated: {
|
|
56
57
|
admin: (0, admin_1.unauthenticatedAdminContextFactory)(params),
|
|
58
|
+
storefront: (0, storefront_1.unauthenticatedStorefrontContextFactory)(params),
|
|
57
59
|
},
|
|
58
60
|
};
|
|
59
61
|
if (isAppStoreApp(shopify, appConfig) ||
|
|
@@ -88,17 +90,16 @@ function deriveApi(appConfig) {
|
|
|
88
90
|
if (appConfig.userAgentPrefix) {
|
|
89
91
|
userAgentPrefix = "".concat(appConfig.userAgentPrefix, " | ").concat(userAgentPrefix);
|
|
90
92
|
}
|
|
91
|
-
|
|
92
|
-
return (0, shopify_api_1.shopifyApi)(cleanApiConfig);
|
|
93
|
+
return (0, shopify_api_1.shopifyApi)(tslib_1.__assign(tslib_1.__assign({}, appConfig), { hostName: appUrl.host, hostScheme: appUrl.protocol.replace(':', ''), userAgentPrefix: userAgentPrefix, isEmbeddedApp: (_a = appConfig.isEmbeddedApp) !== null && _a !== void 0 ? _a : true, apiVersion: (_b = appConfig.apiVersion) !== null && _b !== void 0 ? _b : shopify_api_1.LATEST_API_VERSION, isCustomStoreApp: appConfig.distribution === types_1.AppDistribution.ShopifyAdmin }));
|
|
93
94
|
}
|
|
94
95
|
function deriveConfig(appConfig, apiConfig) {
|
|
95
|
-
var _a, _b, _c;
|
|
96
|
+
var _a, _b, _c, _d;
|
|
96
97
|
if (!appConfig.sessionStorage) {
|
|
97
|
-
throw new shopify_api_1.ShopifyError('Please provide a valid session storage.
|
|
98
|
+
throw new shopify_api_1.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.');
|
|
98
99
|
}
|
|
99
100
|
var authPathPrefix = appConfig.authPathPrefix || '/auth';
|
|
100
101
|
appConfig.distribution = (_a = appConfig.distribution) !== null && _a !== void 0 ? _a : types_1.AppDistribution.AppStore;
|
|
101
|
-
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, appConfig), apiConfig), { canUseLoginForm: appConfig.distribution !== types_1.AppDistribution.ShopifyAdmin, useOnlineTokens: (_b = appConfig.useOnlineTokens) !== null && _b !== void 0 ? _b : false, hooks: (_c = appConfig.hooks) !== null && _c !== void 0 ? _c : {}, sessionStorage: appConfig.sessionStorage, auth: {
|
|
102
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, appConfig), apiConfig), { canUseLoginForm: appConfig.distribution !== types_1.AppDistribution.ShopifyAdmin, useOnlineTokens: (_b = appConfig.useOnlineTokens) !== null && _b !== void 0 ? _b : false, hooks: (_c = appConfig.hooks) !== null && _c !== void 0 ? _c : {}, sessionStorage: appConfig.sessionStorage, future: (_d = appConfig.future) !== null && _d !== void 0 ? _d : {}, auth: {
|
|
102
103
|
path: authPathPrefix,
|
|
103
104
|
callbackPath: "".concat(authPathPrefix, "/callback"),
|
|
104
105
|
patchSessionTokenPath: "".concat(authPathPrefix, "/session-token"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shopify-app.js","sourceRoot":"","sources":["../../../src/server/shopify-app.ts"],"names":[],"mappings":";;;;AAAA,iDAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"shopify-app.js","sourceRoot":"","sources":["../../../src/server/shopify-app.ts"],"names":[],"mappings":";;;;AAAA,iDAA+C;AAC/C,oDAM8B;AAI9B,iCASiB;AACjB,qCAAwD;AACxD,oDAAgE;AAChE,kEAA+D;AAC/D,qEAAgF;AAChF,qDAAiD;AACjD,kDAAyE;AACzE,oDAAwD;AACxD,iDAA2E;AAC3E,gDAAgE;AAChE,2DAAqF;AAErF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,UAAU,CAIxB,SAAiB;IACjB,IAAM,GAAG,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,IAAM,M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