@shopify/shopify-app-remix 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/react/components/AppProvider/AppProvider.js.map +1 -1
- package/dist/cjs/react/components/AppProxyLink/AppProxyLink.js.map +1 -1
- package/dist/cjs/server/authenticate/admin/strategies/auth-code-flow.js.map +1 -1
- package/dist/cjs/server/authenticate/admin/strategies/merchant-custom-app.js.map +1 -1
- package/dist/cjs/server/authenticate/admin/strategies/token-exchange.js.map +1 -1
- package/dist/cjs/server/authenticate/webhooks/authenticate.js +34 -10
- package/dist/cjs/server/authenticate/webhooks/authenticate.js.map +1 -1
- package/dist/cjs/server/version.js +1 -1
- package/dist/cjs/server/version.js.map +1 -1
- package/dist/esm/react/components/AppProvider/AppProvider.mjs.map +1 -1
- package/dist/esm/react/components/AppProxyLink/AppProxyLink.mjs.map +1 -1
- package/dist/esm/server/authenticate/admin/strategies/auth-code-flow.mjs.map +1 -1
- package/dist/esm/server/authenticate/admin/strategies/merchant-custom-app.mjs.map +1 -1
- package/dist/esm/server/authenticate/admin/strategies/token-exchange.mjs.map +1 -1
- package/dist/esm/server/authenticate/webhooks/authenticate.mjs +35 -11
- package/dist/esm/server/authenticate/webhooks/authenticate.mjs.map +1 -1
- package/dist/esm/server/version.mjs +1 -1
- package/dist/esm/server/version.mjs.map +1 -1
- package/dist/ts/react/components/AppProvider/AppProvider.d.ts.map +1 -1
- package/dist/ts/react/components/AppProxyLink/AppProxyLink.d.ts.map +1 -1
- package/dist/ts/server/authenticate/admin/billing/types.d.ts.map +1 -1
- package/dist/ts/server/authenticate/admin/strategies/auth-code-flow.d.ts.map +1 -1
- package/dist/ts/server/authenticate/admin/strategies/merchant-custom-app.d.ts.map +1 -1
- package/dist/ts/server/authenticate/admin/strategies/token-exchange.d.ts.map +1 -1
- package/dist/ts/server/authenticate/admin/types.d.ts.map +1 -1
- package/dist/ts/server/authenticate/public/extension/types.d.ts.map +1 -1
- package/dist/ts/server/authenticate/webhooks/authenticate.d.ts.map +1 -1
- package/dist/ts/server/authenticate/webhooks/types.d.ts +34 -2
- package/dist/ts/server/authenticate/webhooks/types.d.ts.map +1 -1
- package/dist/ts/server/config-types.d.ts.map +1 -1
- package/dist/ts/server/version.d.ts +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +18 -14
- package/src/react/components/AppProvider/AppProvider.doc.ts +35 -0
- package/src/react/components/AppProvider/AppProvider.tsx +147 -0
- package/src/react/components/AppProvider/index.ts +1 -0
- package/src/react/components/AppProxyForm/AppProxyForm.doc.ts +28 -0
- package/src/react/components/AppProxyForm/AppProxyForm.tsx +82 -0
- package/src/react/components/AppProxyForm/index.ts +1 -0
- package/src/react/components/AppProxyLink/AppProxyLink.doc.ts +28 -0
- package/src/react/components/AppProxyLink/AppProxyLink.tsx +58 -0
- package/src/react/components/AppProxyLink/index.ts +1 -0
- package/src/react/components/AppProxyProvider/AppProxyProvider.doc.ts +40 -0
- package/src/react/components/AppProxyProvider/AppProxyProvider.tsx +100 -0
- package/src/react/components/AppProxyProvider/index.ts +5 -0
- package/src/react/components/RemixPolarisLink.tsx +14 -0
- package/src/react/components/index.ts +4 -0
- package/src/react/const.ts +2 -0
- package/src/react/index.ts +1 -0
- package/src/server/__test-helpers/const.ts +14 -0
- package/src/server/__test-helpers/expect-admin-api-client.ts +51 -0
- package/src/server/__test-helpers/expect-begin-auth-redirect.ts +22 -0
- package/src/server/__test-helpers/expect-document-request-headers.ts +25 -0
- package/src/server/__test-helpers/expect-exit-iframe.ts +37 -0
- package/src/server/__test-helpers/expect-login-redirect.ts +8 -0
- package/src/server/__test-helpers/expect-storefront-api-client.ts +49 -0
- package/src/server/__test-helpers/expect-token-refresh.ts +188 -0
- package/src/server/__test-helpers/get-hmac.ts +7 -0
- package/src/server/__test-helpers/get-jwt.ts +10 -0
- package/src/server/__test-helpers/get-thrown-error.ts +19 -0
- package/src/server/__test-helpers/get-thrown-response.ts +17 -0
- package/src/server/__test-helpers/index.ts +21 -0
- package/src/server/__test-helpers/mock-graphql-request.ts +60 -0
- package/src/server/__test-helpers/request-mock.ts +169 -0
- package/src/server/__test-helpers/setup-embedded-flow.ts +30 -0
- package/src/server/__test-helpers/setup-fetch-flow.ts +29 -0
- package/src/server/__test-helpers/setup-non-embedded-flow.ts +31 -0
- package/src/server/__test-helpers/setup-valid-request.ts +78 -0
- package/src/server/__test-helpers/setup-valid-session.ts +28 -0
- package/src/server/__test-helpers/sign-request-cookie.ts +21 -0
- package/src/server/__test-helpers/test-config.ts +56 -0
- package/src/server/adapters/node/index.ts +13 -0
- package/src/server/adapters/vercel/index.ts +13 -0
- package/src/server/authenticate/admin/authenticate.admin.doc.example.ts +34 -0
- package/src/server/authenticate/admin/authenticate.admin.doc.ts +51 -0
- package/src/server/authenticate/admin/authenticate.ts +232 -0
- package/src/server/authenticate/admin/billing/authenticate.admin.billing.doc.ts +29 -0
- package/src/server/authenticate/admin/billing/cancel.ts +38 -0
- package/src/server/authenticate/admin/billing/check.ts +41 -0
- package/src/server/authenticate/admin/billing/create-usage-record.ts +36 -0
- package/src/server/authenticate/admin/billing/helpers.ts +42 -0
- package/src/server/authenticate/admin/billing/index.ts +6 -0
- package/src/server/authenticate/admin/billing/request.ts +64 -0
- package/src/server/authenticate/admin/billing/require.ts +58 -0
- package/src/server/authenticate/admin/billing/types.ts +613 -0
- package/src/server/authenticate/admin/billing/update-usage-subscription-capped-amount.ts +55 -0
- package/src/server/authenticate/admin/helpers/begin-auth.ts +17 -0
- package/src/server/authenticate/admin/helpers/create-admin-api-context.ts +20 -0
- package/src/server/authenticate/admin/helpers/ensure-app-is-embedded-if-required.ts +18 -0
- package/src/server/authenticate/admin/helpers/ensure-session-token-search-param-if-required.ts +25 -0
- package/src/server/authenticate/admin/helpers/handle-client-error.ts +45 -0
- package/src/server/authenticate/admin/helpers/index.ts +14 -0
- package/src/server/authenticate/admin/helpers/redirect-to-auth-page.ts +28 -0
- package/src/server/authenticate/admin/helpers/redirect-to-bounce-page.ts +23 -0
- package/src/server/authenticate/admin/helpers/redirect-to-install-page.ts +53 -0
- package/src/server/authenticate/admin/helpers/redirect-to-shopify-or-app-root.ts +21 -0
- package/src/server/authenticate/admin/helpers/redirect-with-app-bridge-headers.ts +13 -0
- package/src/server/authenticate/admin/helpers/redirect-with-exitiframe.ts +28 -0
- package/src/server/authenticate/admin/helpers/redirect.ts +164 -0
- package/src/server/authenticate/admin/helpers/render-app-bridge.ts +46 -0
- package/src/server/authenticate/admin/helpers/trigger-after-auth-hook.ts +29 -0
- package/src/server/authenticate/admin/helpers/validate-redirect-url.ts +67 -0
- package/src/server/authenticate/admin/helpers/validate-shop-and-host-params.ts +46 -0
- package/src/server/authenticate/admin/scope/authenticate.admin.scopes.doc.ts +28 -0
- package/src/server/authenticate/admin/scope/client/fetch-scopes-details.ts +43 -0
- package/src/server/authenticate/admin/scope/client/revoke-scopes.ts +38 -0
- package/src/server/authenticate/admin/scope/factory.ts +21 -0
- package/src/server/authenticate/admin/scope/query.ts +51 -0
- package/src/server/authenticate/admin/scope/request.ts +32 -0
- package/src/server/authenticate/admin/scope/revoke.ts +48 -0
- package/src/server/authenticate/admin/scope/types.ts +126 -0
- package/src/server/authenticate/admin/strategies/auth-code-flow.ts +332 -0
- package/src/server/authenticate/admin/strategies/merchant-custom-app.ts +65 -0
- package/src/server/authenticate/admin/strategies/token-exchange.ts +188 -0
- package/src/server/authenticate/admin/strategies/types.ts +29 -0
- package/src/server/authenticate/admin/types.ts +216 -0
- package/src/server/authenticate/const.ts +15 -0
- package/src/server/authenticate/flow/authenticate.flow.doc.example.ts +39 -0
- package/src/server/authenticate/flow/authenticate.flow.doc.ts +47 -0
- package/src/server/authenticate/flow/authenticate.ts +68 -0
- package/src/server/authenticate/flow/types.ts +85 -0
- package/src/server/authenticate/fulfillment-service/authenticate.fulfillment-service.doc.example.ts +52 -0
- package/src/server/authenticate/fulfillment-service/authenticate.fulfillment-service.doc.ts +48 -0
- package/src/server/authenticate/fulfillment-service/authenticate.ts +82 -0
- package/src/server/authenticate/fulfillment-service/types.ts +82 -0
- package/src/server/authenticate/helpers/add-response-headers.ts +43 -0
- package/src/server/authenticate/helpers/app-bridge-url.ts +10 -0
- package/src/server/authenticate/helpers/ensure-cors-headers.ts +38 -0
- package/src/server/authenticate/helpers/get-session-token-header.ts +11 -0
- package/src/server/authenticate/helpers/get-shop-from-request.ts +4 -0
- package/src/server/authenticate/helpers/idempotent-promise-handler.ts +45 -0
- package/src/server/authenticate/helpers/index.ts +10 -0
- package/src/server/authenticate/helpers/invalidate-access-token.ts +17 -0
- package/src/server/authenticate/helpers/reject-bot-request.ts +27 -0
- package/src/server/authenticate/helpers/respond-to-invalid-session-token.ts +28 -0
- package/src/server/authenticate/helpers/respond-to-options-request.ts +26 -0
- package/src/server/authenticate/helpers/validate-session-token.ts +40 -0
- package/src/server/authenticate/login/login.ts +53 -0
- package/src/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.example.ts +27 -0
- package/src/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.ts +55 -0
- package/src/server/authenticate/public/appProxy/authenticate.ts +150 -0
- package/src/server/authenticate/public/appProxy/types.ts +215 -0
- package/src/server/authenticate/public/checkout/authenticate.public.checkout.doc.example.offers.ts +21 -0
- package/src/server/authenticate/public/checkout/authenticate.public.checkout.doc.example.ts +17 -0
- package/src/server/authenticate/public/checkout/authenticate.public.checkout.doc.ts +49 -0
- package/src/server/authenticate/public/checkout/authenticate.ts +13 -0
- package/src/server/authenticate/public/checkout/types.ts +65 -0
- package/src/server/authenticate/public/customer-account/authenticate.public.customerAccount.doc.example.offers.ts +36 -0
- package/src/server/authenticate/public/customer-account/authenticate.public.customerAccount.doc.example.ts +18 -0
- package/src/server/authenticate/public/customer-account/authenticate.public.customerAccount.doc.ts +49 -0
- package/src/server/authenticate/public/customer-account/authenticate.ts +13 -0
- package/src/server/authenticate/public/customer-account/types.ts +65 -0
- package/src/server/authenticate/public/extension/authenticate.ts +54 -0
- package/src/server/authenticate/public/extension/types.ts +11 -0
- package/src/server/authenticate/public/factory.ts +24 -0
- package/src/server/authenticate/public/index.ts +1 -0
- package/src/server/authenticate/public/pos/authenticate.ts +8 -0
- package/src/server/authenticate/public/pos/types.ts +65 -0
- package/src/server/authenticate/public/types.ts +96 -0
- package/src/server/authenticate/webhooks/authenticate.ts +105 -0
- package/src/server/authenticate/webhooks/authenticate.webhooks.doc.example.ts +43 -0
- package/src/server/authenticate/webhooks/authenticate.webhooks.doc.ts +39 -0
- package/src/server/authenticate/webhooks/index.ts +1 -0
- package/src/server/authenticate/webhooks/register.ts +48 -0
- package/src/server/authenticate/webhooks/types.ts +266 -0
- package/src/server/boundary/error.tsx +14 -0
- package/src/server/boundary/headers.ts +15 -0
- package/src/server/boundary/index.ts +39 -0
- package/src/server/boundary/types.ts +4 -0
- package/src/server/clients/admin/authenticate.admin.api.doc.ts +34 -0
- package/src/server/clients/admin/factory.ts +22 -0
- package/src/server/clients/admin/graphql.ts +39 -0
- package/src/server/clients/admin/index.ts +2 -0
- package/src/server/clients/admin/types.ts +120 -0
- package/src/server/clients/index.ts +2 -0
- package/src/server/clients/storefront/authenticate.storefront.api.doc.ts +34 -0
- package/src/server/clients/storefront/factory.ts +32 -0
- package/src/server/clients/storefront/index.ts +2 -0
- package/src/server/clients/storefront/types.ts +78 -0
- package/src/server/clients/types.ts +47 -0
- package/src/server/config-types.ts +309 -0
- package/src/server/errors.ts +3 -0
- package/src/server/future/flags.ts +62 -0
- package/src/server/helpers/create-or-load-offline-session.ts +19 -0
- package/src/server/helpers/ensure-offline-token-is-not-expired.ts +32 -0
- package/src/server/helpers/ensure-valid-offline-session.ts +15 -0
- package/src/server/helpers/index.ts +4 -0
- package/src/server/helpers/refresh-token.ts +35 -0
- package/src/server/index.ts +24 -0
- package/src/server/override-logger.ts +42 -0
- package/src/server/shopify-app.doc.ts +45 -0
- package/src/server/shopify-app.ts +215 -0
- package/src/server/test-helpers/index.ts +1 -0
- package/src/server/test-helpers/test-config.ts +79 -0
- package/src/server/types-contexts.ts +44 -0
- package/src/server/types.ts +507 -0
- package/src/server/unauthenticated/admin/factory.ts +23 -0
- package/src/server/unauthenticated/admin/index.ts +1 -0
- package/src/server/unauthenticated/admin/types.ts +79 -0
- package/src/server/unauthenticated/admin/unauthenticated.admin.doc.ts +40 -0
- package/src/server/unauthenticated/storefront/factory.ts +28 -0
- package/src/server/unauthenticated/storefront/index.ts +1 -0
- package/src/server/unauthenticated/storefront/types.ts +105 -0
- package/src/server/unauthenticated/storefront/unauthenticated.storefront.doc.ts +40 -0
- package/src/server/unauthenticated/types.ts +65 -0
- package/src/server/version.ts +1 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {redirect} from '@remix-run/server-runtime';
|
|
2
|
+
|
|
3
|
+
import {BasicParams, LoginError, LoginErrorType} from '../../types';
|
|
4
|
+
|
|
5
|
+
export function loginFactory(params: BasicParams) {
|
|
6
|
+
const {api, config, logger} = params;
|
|
7
|
+
|
|
8
|
+
return async function login(request: Request): Promise<LoginError | never> {
|
|
9
|
+
const url = new URL(request.url);
|
|
10
|
+
const shopParam = url.searchParams.get('shop');
|
|
11
|
+
|
|
12
|
+
if (request.method === 'GET' && !shopParam) {
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const shop: string | null =
|
|
17
|
+
shopParam || ((await request.formData()).get('shop') as string);
|
|
18
|
+
|
|
19
|
+
if (!shop) {
|
|
20
|
+
logger.debug('Missing shop parameter', {shop});
|
|
21
|
+
return {shop: LoginErrorType.MissingShop};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const shopWithoutProtocol = shop
|
|
25
|
+
.replace(/^https?:\/\//, '')
|
|
26
|
+
.replace(/\/$/, '');
|
|
27
|
+
const shopWithDomain =
|
|
28
|
+
shop?.indexOf('.') === -1
|
|
29
|
+
? `${shopWithoutProtocol}.myshopify.com`
|
|
30
|
+
: shopWithoutProtocol;
|
|
31
|
+
const sanitizedShop = api.utils.sanitizeShop(shopWithDomain);
|
|
32
|
+
|
|
33
|
+
if (!sanitizedShop) {
|
|
34
|
+
logger.debug('Invalid shop parameter', {shop});
|
|
35
|
+
return {shop: LoginErrorType.InvalidShop};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const authPath = `${config.appUrl}${config.auth.path}?shop=${sanitizedShop}`;
|
|
39
|
+
|
|
40
|
+
const adminPath = api.utils.legacyUrlToShopAdminUrl(sanitizedShop);
|
|
41
|
+
const installPath = `https://${adminPath}/oauth/install?client_id=${config.apiKey}`;
|
|
42
|
+
|
|
43
|
+
const shouldInstall =
|
|
44
|
+
config.isEmbeddedApp && config.future.unstable_newEmbeddedAuthStrategy;
|
|
45
|
+
const redirectUrl = shouldInstall ? installPath : authPath;
|
|
46
|
+
|
|
47
|
+
logger.info(`Redirecting login request to ${redirectUrl}`, {
|
|
48
|
+
shop: sanitizedShop,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
throw redirect(redirectUrl);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type {LoaderFunctionArgs} from '@remix-run/node';
|
|
2
|
+
|
|
3
|
+
import {authenticate} from '../shopify.server';
|
|
4
|
+
|
|
5
|
+
export const loader = async ({request}: LoaderFunctionArgs) => {
|
|
6
|
+
const {storefront, liquid} = await authenticate.public.appProxy(request);
|
|
7
|
+
|
|
8
|
+
if (!storefront) {
|
|
9
|
+
return new Response();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const response = await storefront.graphql(
|
|
13
|
+
`#graphql
|
|
14
|
+
query productTitle {
|
|
15
|
+
products(first: 1) {
|
|
16
|
+
nodes {
|
|
17
|
+
title
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}`,
|
|
21
|
+
);
|
|
22
|
+
const body = await response.json();
|
|
23
|
+
|
|
24
|
+
const title = body.data.products.nodes[0].title;
|
|
25
|
+
|
|
26
|
+
return liquid(`Found product ${title} from {{shop.name}}`);
|
|
27
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
|
|
2
|
+
|
|
3
|
+
const data: ReferenceEntityTemplateSchema = {
|
|
4
|
+
name: 'App proxy',
|
|
5
|
+
description:
|
|
6
|
+
'[App proxies](/docs/apps/online-store/app-proxies) take requests to Shopify links, and redirect them to external links.' +
|
|
7
|
+
'\nThe `authenticate.public.appProxy` function validates requests made to app proxies, and returns a context to enable querying Shopify APIs.' +
|
|
8
|
+
'\n\n> Note: If the store has not installed the app, store-related properties such as `admin` or `storefront` will be `undefined`',
|
|
9
|
+
category: 'Authenticate',
|
|
10
|
+
subCategory: 'Public',
|
|
11
|
+
type: 'object',
|
|
12
|
+
isVisualComponent: false,
|
|
13
|
+
definitions: [
|
|
14
|
+
{
|
|
15
|
+
title: 'authenticate.public.appProxy',
|
|
16
|
+
description:
|
|
17
|
+
'Authenticates requests coming to the app from Shopify app proxies.',
|
|
18
|
+
type: 'AuthenticateAppProxy',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
defaultExample: {
|
|
22
|
+
description: 'Authenticate and fetch product information',
|
|
23
|
+
codeblock: {
|
|
24
|
+
title: 'Authenticate and fetch product information',
|
|
25
|
+
tabs: [
|
|
26
|
+
{
|
|
27
|
+
title: '/app/routes/**.ts',
|
|
28
|
+
language: 'typescript',
|
|
29
|
+
code: './authenticate.public.app-proxy.doc.example.ts',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
jsDocTypeExamples: ['AppProxyContextWithSession'],
|
|
35
|
+
related: [
|
|
36
|
+
{
|
|
37
|
+
name: 'Admin API context',
|
|
38
|
+
subtitle: 'Interact with the Admin API.',
|
|
39
|
+
url: '/docs/api/shopify-app-remix/apis/admin-api',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'Storefront API context',
|
|
43
|
+
subtitle: 'Interact with the Storefront API.',
|
|
44
|
+
url: '/docs/api/shopify-app-remix/apis/storefront-api',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'Liquid reference',
|
|
48
|
+
subtitle: "Use the shop's theme to render a template.",
|
|
49
|
+
url: '/docs/api/liquid',
|
|
50
|
+
type: 'liquid',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default data;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import {adminClientFactory, storefrontClientFactory} from '../../../clients';
|
|
2
|
+
import {ensureValidOfflineSession} from '../../../helpers';
|
|
3
|
+
import {BasicParams} from '../../../types';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
AppProxyContext,
|
|
7
|
+
AppProxyContextWithSession,
|
|
8
|
+
AuthenticateAppProxy,
|
|
9
|
+
LiquidResponseFunction,
|
|
10
|
+
} from './types';
|
|
11
|
+
|
|
12
|
+
export function authenticateAppProxyFactory(
|
|
13
|
+
params: BasicParams,
|
|
14
|
+
): AuthenticateAppProxy {
|
|
15
|
+
const {logger} = params;
|
|
16
|
+
|
|
17
|
+
return async function authenticate(
|
|
18
|
+
request: Request,
|
|
19
|
+
): Promise<AppProxyContext | AppProxyContextWithSession> {
|
|
20
|
+
const url = new URL(request.url);
|
|
21
|
+
const shop = url.searchParams.get('shop')!;
|
|
22
|
+
logger.info('Authenticating app proxy request', {shop});
|
|
23
|
+
|
|
24
|
+
if (!(await validateAppProxyHmac(params, url))) {
|
|
25
|
+
logger.info('App proxy request has invalid signature', {shop});
|
|
26
|
+
throw new Response(undefined, {
|
|
27
|
+
status: 400,
|
|
28
|
+
statusText: 'Bad Request',
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const session = await ensureValidOfflineSession(params, shop);
|
|
33
|
+
|
|
34
|
+
if (!session) {
|
|
35
|
+
logger.debug('Could not find offline session, returning empty context', {
|
|
36
|
+
shop,
|
|
37
|
+
...Object.fromEntries(url.searchParams.entries()),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const context: AppProxyContext = {
|
|
41
|
+
liquid,
|
|
42
|
+
session: undefined,
|
|
43
|
+
admin: undefined,
|
|
44
|
+
storefront: undefined,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
return context;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const context: AppProxyContextWithSession = {
|
|
51
|
+
liquid,
|
|
52
|
+
session,
|
|
53
|
+
admin: adminClientFactory({params, session}),
|
|
54
|
+
storefront: storefrontClientFactory({params, session}),
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return context;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const liquid: LiquidResponseFunction = (body, initAndOptions) => {
|
|
62
|
+
const processedBody = processLiquidBody(body);
|
|
63
|
+
|
|
64
|
+
if (typeof initAndOptions !== 'object') {
|
|
65
|
+
return new Response(processedBody, {
|
|
66
|
+
status: initAndOptions || 200,
|
|
67
|
+
headers: {
|
|
68
|
+
'Content-Type': 'application/liquid',
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const {layout, ...responseInit} = initAndOptions || {};
|
|
74
|
+
const responseBody =
|
|
75
|
+
layout === false ? `{% layout none %} ${processedBody}` : processedBody;
|
|
76
|
+
|
|
77
|
+
const headers = new Headers(responseInit.headers);
|
|
78
|
+
headers.set('Content-Type', 'application/liquid');
|
|
79
|
+
|
|
80
|
+
return new Response(responseBody, {
|
|
81
|
+
...responseInit,
|
|
82
|
+
headers,
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
async function validateAppProxyHmac(
|
|
87
|
+
params: BasicParams,
|
|
88
|
+
url: URL,
|
|
89
|
+
): Promise<boolean> {
|
|
90
|
+
const {api, logger} = params;
|
|
91
|
+
|
|
92
|
+
try {
|
|
93
|
+
let searchParams = new URLSearchParams(url.search);
|
|
94
|
+
if (!searchParams.get('index')) {
|
|
95
|
+
searchParams.delete('index');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
let isValid = await api.utils.validateHmac(
|
|
99
|
+
Object.fromEntries(searchParams.entries()),
|
|
100
|
+
{signator: 'appProxy'},
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
if (!isValid) {
|
|
104
|
+
const cleanPath = url.pathname
|
|
105
|
+
.replace(/^\//, '')
|
|
106
|
+
.replace(/\/$/, '')
|
|
107
|
+
.replaceAll('/', '.');
|
|
108
|
+
const data = `routes%2F${cleanPath}`;
|
|
109
|
+
|
|
110
|
+
searchParams = new URLSearchParams(
|
|
111
|
+
`?_data=${data}&${searchParams.toString().replace(/^\?/, '')}`,
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
isValid = await api.utils.validateHmac(
|
|
115
|
+
Object.fromEntries(searchParams.entries()),
|
|
116
|
+
{signator: 'appProxy'},
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
if (!isValid) {
|
|
120
|
+
const searchParams = new URLSearchParams(
|
|
121
|
+
`?_data=${data}._index&${url.search.replace(/^\?/, '')}`,
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
isValid = await api.utils.validateHmac(
|
|
125
|
+
Object.fromEntries(searchParams.entries()),
|
|
126
|
+
{signator: 'appProxy'},
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return isValid;
|
|
132
|
+
} catch (error) {
|
|
133
|
+
const shop = url.searchParams.get('shop')!;
|
|
134
|
+
logger.info(error.message, {shop});
|
|
135
|
+
throw new Response(undefined, {status: 400, statusText: 'Bad Request'});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function processLiquidBody(body: string) {
|
|
140
|
+
return (
|
|
141
|
+
body
|
|
142
|
+
// Add trailing slashes to relative form action URLs
|
|
143
|
+
.replaceAll(
|
|
144
|
+
/<(form[^>]+)action="(\/[^"?]+)(\?[^"]+)?">/g,
|
|
145
|
+
'<$1action="$2/$3">',
|
|
146
|
+
)
|
|
147
|
+
// Add trailing slashes to relative link href URLs
|
|
148
|
+
.replaceAll(/<(a[^>]+)href="(\/[^"?]+)(\?[^"]+)?">/g, '<$1href="$2/$3">')
|
|
149
|
+
);
|
|
150
|
+
}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import {Session} from '@shopify/shopify-api';
|
|
2
|
+
|
|
3
|
+
import {AdminApiContext, StorefrontContext} from '../../../clients';
|
|
4
|
+
|
|
5
|
+
export type AuthenticateAppProxy = (
|
|
6
|
+
request: Request,
|
|
7
|
+
) => Promise<AppProxyContext | AppProxyContextWithSession>;
|
|
8
|
+
|
|
9
|
+
interface Options {
|
|
10
|
+
/**
|
|
11
|
+
* Whether to use the shop's theme layout around the Liquid content.
|
|
12
|
+
*/
|
|
13
|
+
layout?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type LiquidResponseFunction = (
|
|
17
|
+
body: string,
|
|
18
|
+
initAndOptions?: number | (ResponseInit & Options),
|
|
19
|
+
) => Response;
|
|
20
|
+
|
|
21
|
+
interface Context {
|
|
22
|
+
/**
|
|
23
|
+
* A utility for creating a Liquid Response.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* <caption>Rendering liquid content.</caption>
|
|
27
|
+
* <description>Use the `liquid` helper to render a `Response` with Liquid content using the shop's theme. See the [Liquid reference](https://shopify.dev/docs/api/liquid) for all the features it enables.</description>
|
|
28
|
+
* ```ts
|
|
29
|
+
* // /app/routes/**\/*.ts
|
|
30
|
+
* import {authenticate} from "~/shopify.server"
|
|
31
|
+
*
|
|
32
|
+
* export async function loader({ request }) {
|
|
33
|
+
* const {liquid} = await authenticate.public.appProxy(request);
|
|
34
|
+
*
|
|
35
|
+
* return liquid("Hello {{shop.name}}");
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* <caption>Rendering liquid content without a layout.</caption>
|
|
41
|
+
* <description>Set the `layout` option to `false` to render the Liquid content without a theme.</description>
|
|
42
|
+
* ```ts
|
|
43
|
+
* // /app/routes/**\/*.ts
|
|
44
|
+
* import {authenticate} from "~/shopify.server"
|
|
45
|
+
*
|
|
46
|
+
* export async function loader({ request }) {
|
|
47
|
+
* const {liquid} = await authenticate.public.appProxy(request);
|
|
48
|
+
*
|
|
49
|
+
* return liquid(
|
|
50
|
+
* "Hello {{shop.name}}",
|
|
51
|
+
* { layout: false }
|
|
52
|
+
* );
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* <caption>Rendering a form in a Liquid response.</caption>
|
|
58
|
+
* <description>Handle form submissions through an app proxy.</description>
|
|
59
|
+
* ```ts
|
|
60
|
+
* // app/routes/apps.proxy.my-action.tsx
|
|
61
|
+
* import { redirect } from "@remix-run/node";
|
|
62
|
+
* import { authenticate } from "~/shopify.server";
|
|
63
|
+
*
|
|
64
|
+
* export async function loader({ request }) {
|
|
65
|
+
* const { liquid } = await authenticate.public.appProxy(request);
|
|
66
|
+
*
|
|
67
|
+
* return liquid(`
|
|
68
|
+
* <form method="post" action="/apps/proxy/my-action">
|
|
69
|
+
* <input type="text" name="field" />
|
|
70
|
+
* <button type="submit">Submit</button>
|
|
71
|
+
* </form>
|
|
72
|
+
* `);
|
|
73
|
+
* }
|
|
74
|
+
*
|
|
75
|
+
* export async function action({ request }) {
|
|
76
|
+
* await authenticate.public.appProxy(request);
|
|
77
|
+
*
|
|
78
|
+
* const formData = await request.formData();
|
|
79
|
+
* const field = formData.get("field")?.toString();
|
|
80
|
+
*
|
|
81
|
+
* // Perform actions here
|
|
82
|
+
* if (field) {
|
|
83
|
+
* console.log("Field:", field);
|
|
84
|
+
* }
|
|
85
|
+
*
|
|
86
|
+
* // Return to the form page
|
|
87
|
+
* return redirect("/apps/proxy/my-action");
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
liquid: LiquidResponseFunction;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface AppProxyContext extends Context {
|
|
95
|
+
/**
|
|
96
|
+
* No session is available for the shop that made this request.
|
|
97
|
+
*
|
|
98
|
+
* This comes from the session storage which `shopifyApp` uses to store sessions in your database of choice.
|
|
99
|
+
*/
|
|
100
|
+
session: undefined;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* No session is available for the shop that made this request.
|
|
104
|
+
* Therefore no methods for interacting with the GraphQL Admin API are available.
|
|
105
|
+
*/
|
|
106
|
+
admin: undefined;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* No session is available for the shop that made this request.
|
|
110
|
+
* Therefore no method for interacting with the Storefront API is available.
|
|
111
|
+
*/
|
|
112
|
+
storefront: undefined;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface AppProxyContextWithSession extends Context {
|
|
116
|
+
/**
|
|
117
|
+
* The session for the shop that made the request.
|
|
118
|
+
*
|
|
119
|
+
* This comes from the session storage which `shopifyApp` uses to store sessions in your database of choice.
|
|
120
|
+
*
|
|
121
|
+
* Use this to get shop or user-specific data.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* <caption>Using the session object.</caption>
|
|
125
|
+
* <description>Get the session for the shop that initiated the request to the app proxy.</description>
|
|
126
|
+
* ```ts
|
|
127
|
+
* // app/routes/**\/.ts
|
|
128
|
+
* import { json } from "@remix-run/node";
|
|
129
|
+
* import { authenticate } from "../shopify.server";
|
|
130
|
+
* import { getMyAppModelData } from "~/db/model.server";
|
|
131
|
+
*
|
|
132
|
+
* export const loader = async ({ request }) => {
|
|
133
|
+
* // Get the session for the shop that initiated the request to the app proxy.
|
|
134
|
+
* const { session } =
|
|
135
|
+
* await authenticate.public.appProxy(request);
|
|
136
|
+
*
|
|
137
|
+
* // Use the session data to make to queries to your database or additional requests.
|
|
138
|
+
* return json(
|
|
139
|
+
* await getMyAppModelData({shop: session.shop})
|
|
140
|
+
* );
|
|
141
|
+
* };
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
session: Session;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Methods for interacting with the GraphQL Admin API for the store that made the request.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* <caption>Interacting with the Admin API.</caption>
|
|
151
|
+
* <description>Use the `admin` object to interact with the admin GraphQL API.</description>
|
|
152
|
+
* ```ts
|
|
153
|
+
* // app/routes/**\/.ts
|
|
154
|
+
* import { json } from "@remix-run/node";
|
|
155
|
+
* import { authenticate } from "../shopify.server";
|
|
156
|
+
*
|
|
157
|
+
* export async function action({ request }: ActionFunctionArgs) {
|
|
158
|
+
* const { admin } = await authenticate.public.appProxy(request);
|
|
159
|
+
*
|
|
160
|
+
* const response = await admin.graphql(
|
|
161
|
+
* `#graphql
|
|
162
|
+
* mutation populateProduct($input: ProductInput!) {
|
|
163
|
+
* productCreate(input: $input) {
|
|
164
|
+
* product {
|
|
165
|
+
* id
|
|
166
|
+
* }
|
|
167
|
+
* }
|
|
168
|
+
* }`,
|
|
169
|
+
* {
|
|
170
|
+
* variables: {
|
|
171
|
+
* input: { title: "Product Name" }
|
|
172
|
+
* }
|
|
173
|
+
* }
|
|
174
|
+
* );
|
|
175
|
+
*
|
|
176
|
+
* const productData = await response.json();
|
|
177
|
+
* return json({ data: productData.data });
|
|
178
|
+
* }
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
admin: AdminApiContext;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Method for interacting with the Shopify Storefront Graphql API for the store that made the request.
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* <caption>Interacting with the Storefront API.</caption>
|
|
188
|
+
* <description>Use the `storefront` object to interact with the GraphQL API.</description>
|
|
189
|
+
* ```ts
|
|
190
|
+
* // app/routes/**\/.ts
|
|
191
|
+
* import { json } from "@remix-run/node";
|
|
192
|
+
* import { authenticate } from "../shopify.server";
|
|
193
|
+
*
|
|
194
|
+
* export async function action({ request }: ActionFunctionArgs) {
|
|
195
|
+
* const { storefront } = await authenticate.public.appProxy(request);
|
|
196
|
+
*
|
|
197
|
+
* const response = await storefront.graphql(
|
|
198
|
+
* `#graphql
|
|
199
|
+
* query blogIds {
|
|
200
|
+
* blogs(first: 10) {
|
|
201
|
+
* edges {
|
|
202
|
+
* node {
|
|
203
|
+
* id
|
|
204
|
+
* }
|
|
205
|
+
* }
|
|
206
|
+
* }
|
|
207
|
+
* }`
|
|
208
|
+
* );
|
|
209
|
+
*
|
|
210
|
+
* return json(await response.json());
|
|
211
|
+
* }
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
214
|
+
storefront: StorefrontContext;
|
|
215
|
+
}
|
package/src/server/authenticate/public/checkout/authenticate.public.checkout.doc.example.offers.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Most apps would load this from their database
|
|
2
|
+
export function getOffers(shop: string) {
|
|
3
|
+
const offers: Record<any, any[]> = {
|
|
4
|
+
'shop.com': [
|
|
5
|
+
{
|
|
6
|
+
id: '1',
|
|
7
|
+
title: '10% off',
|
|
8
|
+
price: 10,
|
|
9
|
+
type: 'percentage',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: '2',
|
|
13
|
+
title: 'Free shipping',
|
|
14
|
+
price: 0,
|
|
15
|
+
type: 'shipping',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return offers[shop];
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type {ActionFunctionArgs, LoaderFunctionArgs} from '@remix-run/node';
|
|
2
|
+
import {json} from '@remix-run/node';
|
|
3
|
+
|
|
4
|
+
import {authenticate} from '../shopify.server';
|
|
5
|
+
import {getOffers} from '../offers.server';
|
|
6
|
+
|
|
7
|
+
// The loader responds to preflight requests from Shopify
|
|
8
|
+
export const loader = async ({request}: LoaderFunctionArgs) => {
|
|
9
|
+
await authenticate.public.checkout(request);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const action = async ({request}: ActionFunctionArgs) => {
|
|
13
|
+
const {cors, sessionToken} = await authenticate.public.checkout(request);
|
|
14
|
+
|
|
15
|
+
const offers = getOffers(sessionToken.dest);
|
|
16
|
+
return cors(json({offers}));
|
|
17
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
|
|
2
|
+
|
|
3
|
+
const data: ReferenceEntityTemplateSchema = {
|
|
4
|
+
name: 'Checkout',
|
|
5
|
+
description:
|
|
6
|
+
'The `authenticate.public.checkout` function ensures that checkout extension requests are coming from Shopify, and returns helpers to respond with the correct headers.',
|
|
7
|
+
category: 'Authenticate',
|
|
8
|
+
subCategory: 'Public',
|
|
9
|
+
type: 'object',
|
|
10
|
+
isVisualComponent: false,
|
|
11
|
+
definitions: [
|
|
12
|
+
{
|
|
13
|
+
title: 'authenticate.public.checkout',
|
|
14
|
+
description:
|
|
15
|
+
'Authenticates requests coming from Shopify checkout extensions.',
|
|
16
|
+
type: 'AuthenticateCheckout',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
defaultExample: {
|
|
20
|
+
description: 'Authenticate and return offers for the shop',
|
|
21
|
+
codeblock: {
|
|
22
|
+
title: 'Authenticate and return offers for the shop',
|
|
23
|
+
tabs: [
|
|
24
|
+
{
|
|
25
|
+
title: '/app/routes/**.ts',
|
|
26
|
+
language: 'typescript',
|
|
27
|
+
code: './authenticate.public.checkout.doc.example.ts',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
title: '/app/offers.server.ts',
|
|
31
|
+
language: 'typescript',
|
|
32
|
+
code: './authenticate.public.checkout.doc.example.offers.ts',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
jsDocTypeExamples: ['CheckoutContext'],
|
|
38
|
+
related: [
|
|
39
|
+
{
|
|
40
|
+
name: 'Session token API',
|
|
41
|
+
subtitle:
|
|
42
|
+
'Checkout UI extension API for interacting with session tokens.',
|
|
43
|
+
url: '/docs/api/checkout-ui-extensions/latest/apis/session-token',
|
|
44
|
+
type: 'shopify',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default data;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type {BasicParams} from '../../../types';
|
|
2
|
+
import {authenticateExtensionFactory} from '../extension/authenticate';
|
|
3
|
+
|
|
4
|
+
import type {AuthenticateCheckout} from './types';
|
|
5
|
+
|
|
6
|
+
export function authenticateCheckoutFactory(
|
|
7
|
+
params: BasicParams,
|
|
8
|
+
): AuthenticateCheckout {
|
|
9
|
+
return authenticateExtensionFactory(
|
|
10
|
+
params,
|
|
11
|
+
'checkout',
|
|
12
|
+
) as AuthenticateCheckout;
|
|
13
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {JwtPayload} from '@shopify/shopify-api';
|
|
2
|
+
|
|
3
|
+
import {EnsureCORSFunction} from '../../helpers/ensure-cors-headers';
|
|
4
|
+
|
|
5
|
+
export type AuthenticateCheckout = (
|
|
6
|
+
request: Request,
|
|
7
|
+
options?: AuthenticateCheckoutOptions,
|
|
8
|
+
) => Promise<CheckoutContext>;
|
|
9
|
+
|
|
10
|
+
export interface AuthenticateCheckoutOptions {
|
|
11
|
+
corsHeaders?: string[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Authenticated Context for a checkout request
|
|
16
|
+
*/
|
|
17
|
+
export interface CheckoutContext {
|
|
18
|
+
/**
|
|
19
|
+
* The decoded and validated session token for the request
|
|
20
|
+
*
|
|
21
|
+
* Refer to the OAuth docs for the [session token payload](https://shopify.dev/docs/apps/auth/oauth/session-tokens#payload).
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* <caption>Using the decoded session token.</caption>
|
|
25
|
+
* <description>Get store-specific data using the `sessionToken` object.</description>
|
|
26
|
+
* ```ts
|
|
27
|
+
* // app/routes/public/my-route.ts
|
|
28
|
+
* import { LoaderFunctionArgs, json } from "@remix-run/node";
|
|
29
|
+
* import { authenticate } from "../shopify.server";
|
|
30
|
+
* import { getMyAppData } from "~/db/model.server";
|
|
31
|
+
*
|
|
32
|
+
* export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|
33
|
+
* const { sessionToken } = await authenticate.public.checkout(
|
|
34
|
+
* request
|
|
35
|
+
* );
|
|
36
|
+
* return json(await getMyAppData({shop: sessionToken.dest}));
|
|
37
|
+
* };
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
sessionToken: JwtPayload;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A function that ensures the CORS headers are set correctly for the response.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* <caption>Setting CORS headers for a public request.</caption>
|
|
47
|
+
* <description>Use the `cors` helper to ensure your app can respond to checkout extension requests.</description>
|
|
48
|
+
* ```ts
|
|
49
|
+
* // app/routes/public/my-route.ts
|
|
50
|
+
* import { LoaderFunctionArgs, json } from "@remix-run/node";
|
|
51
|
+
* import { authenticate } from "../shopify.server";
|
|
52
|
+
* import { getMyAppData } from "~/db/model.server";
|
|
53
|
+
*
|
|
54
|
+
* export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|
55
|
+
* const { sessionToken, cors } = await authenticate.public.checkout(
|
|
56
|
+
* request,
|
|
57
|
+
* { corsHeaders: ["X-My-Custom-Header"] }
|
|
58
|
+
* );
|
|
59
|
+
* const data = await getMyAppData({shop: sessionToken.dest});
|
|
60
|
+
* return cors(json(data));
|
|
61
|
+
* };
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
cors: EnsureCORSFunction;
|
|
65
|
+
}
|