@shopify/shopify-app-remix 1.0.4 → 1.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/README.md +19 -23
- package/build/cjs/react/components/AppProvider/AppProvider.js +67 -0
- package/build/cjs/react/components/RemixPolarisLink.js +22 -0
- package/build/cjs/react/const.js +7 -0
- package/build/cjs/react/index.js +9 -0
- package/build/cjs/{adapters → server/adapters}/node/index.js +1 -3
- package/build/cjs/{auth → server/authenticate}/admin/authenticate.js +39 -94
- package/build/cjs/{billing → server/authenticate/admin/billing}/cancel.js +1 -2
- package/build/cjs/{billing → server/authenticate/admin/billing}/request.js +2 -3
- package/build/cjs/{billing → server/authenticate/admin/billing}/require.js +1 -2
- package/build/cjs/server/authenticate/admin/helpers/handle-client-error.js +39 -0
- package/build/cjs/{auth → server/authenticate/admin}/helpers/redirect-to-auth-page.js +6 -1
- package/build/cjs/{auth → server/authenticate/admin}/helpers/redirect-with-app-bridge-headers.js +2 -6
- package/build/cjs/server/authenticate/admin/helpers/redirect.js +67 -0
- package/build/cjs/server/authenticate/admin/helpers/render-app-bridge.js +30 -0
- package/build/cjs/{auth → server/authenticate}/helpers/ensure-cors-headers.js +3 -2
- package/build/cjs/{auth → server/authenticate}/helpers/respond-to-options-request.js +2 -2
- package/build/cjs/{auth → server/authenticate}/helpers/validate-session-token.js +6 -2
- package/build/cjs/{auth → server/authenticate}/login/login.js +1 -1
- package/build/cjs/server/authenticate/public/appProxy/authenticate.js +82 -0
- package/build/cjs/server/authenticate/public/checkout/authenticate.js +38 -0
- package/build/cjs/server/authenticate/public/factory.js +22 -0
- package/build/cjs/{boundary → server/boundary}/error.js +7 -1
- package/build/cjs/server/boundary/index.js +44 -0
- package/build/cjs/server/clients/admin/factory.js +27 -0
- package/build/cjs/{auth/admin/graphql-client.js → server/clients/admin/graphql.js} +10 -18
- package/build/cjs/{auth/admin/rest-client.js → server/clients/admin/rest.js} +54 -33
- package/build/cjs/server/index.js +39 -0
- package/build/cjs/{index.js → server/shopify-app.js} +13 -76
- package/build/cjs/server/unauthenticated/admin/factory.js +25 -0
- package/build/cjs/{version.js → server/version.js} +1 -1
- package/build/ts/react/components/AppProvider/AppProvider.d.ts +50 -0
- package/build/ts/react/components/AppProvider/AppProvider.d.ts.map +1 -0
- package/build/ts/react/components/AppProvider/AppProvider.js +44 -0
- package/build/ts/react/components/AppProvider/AppProvider.js.map +1 -0
- package/build/ts/react/components/AppProvider/index.d.ts +2 -0
- package/build/ts/react/components/AppProvider/index.d.ts.map +1 -0
- package/build/ts/react/components/AppProvider/index.js +5 -0
- package/build/ts/react/components/AppProvider/index.js.map +1 -0
- package/build/ts/react/components/RemixPolarisLink.d.ts +3 -0
- package/build/ts/react/components/RemixPolarisLink.d.ts.map +1 -0
- package/build/ts/react/components/RemixPolarisLink.js +12 -0
- package/build/ts/react/components/RemixPolarisLink.js.map +1 -0
- package/build/ts/react/components/index.d.ts +2 -0
- package/build/ts/react/components/index.d.ts.map +1 -0
- package/build/ts/react/components/index.js +5 -0
- package/build/ts/react/components/index.js.map +1 -0
- package/build/ts/react/const.d.ts +2 -0
- package/build/ts/react/const.d.ts.map +1 -0
- package/build/ts/react/const.js +5 -0
- package/build/ts/react/const.js.map +1 -0
- package/build/ts/react/index.d.ts +2 -0
- package/build/ts/react/index.d.ts.map +1 -0
- package/build/ts/react/index.js +5 -0
- package/build/ts/react/index.js.map +1 -0
- package/build/ts/server/__test-helpers/const.d.ts +9 -0
- package/build/ts/server/__test-helpers/const.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/const.js +13 -0
- package/build/ts/server/__test-helpers/const.js.map +1 -0
- package/build/ts/server/__test-helpers/expect-admin-api-client.d.ts +8 -0
- package/build/ts/server/__test-helpers/expect-admin-api-client.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/expect-admin-api-client.js +165 -0
- package/build/ts/server/__test-helpers/expect-admin-api-client.js.map +1 -0
- package/build/ts/server/__test-helpers/expect-begin-auth-redirect.d.ts +3 -0
- package/build/ts/server/__test-helpers/expect-begin-auth-redirect.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/expect-begin-auth-redirect.js +16 -0
- package/build/ts/server/__test-helpers/expect-begin-auth-redirect.js.map +1 -0
- package/build/ts/server/__test-helpers/expect-document-request-headers.d.ts +2 -0
- package/build/ts/server/__test-helpers/expect-document-request-headers.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/expect-document-request-headers.js +18 -0
- package/build/ts/server/__test-helpers/expect-document-request-headers.js.map +1 -0
- package/build/ts/server/__test-helpers/expect-exit-iframe.d.ts +8 -0
- package/build/ts/server/__test-helpers/expect-exit-iframe.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/expect-exit-iframe.js +17 -0
- package/build/ts/server/__test-helpers/expect-exit-iframe.js.map +1 -0
- package/build/ts/server/__test-helpers/expect-login-redirect.d.ts +2 -0
- package/build/ts/server/__test-helpers/expect-login-redirect.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/expect-login-redirect.js +11 -0
- package/build/ts/server/__test-helpers/expect-login-redirect.js.map +1 -0
- package/build/ts/server/__test-helpers/get-hmac.d.ts +2 -0
- package/build/ts/server/__test-helpers/get-hmac.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/get-hmac.js +14 -0
- package/build/ts/server/__test-helpers/get-hmac.js.map +1 -0
- package/build/ts/server/__test-helpers/get-jwt.d.ts +8 -0
- package/build/ts/server/__test-helpers/get-jwt.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/get-jwt.js +17 -0
- package/build/ts/server/__test-helpers/get-jwt.js.map +1 -0
- package/build/ts/server/__test-helpers/get-thrown-response.d.ts +2 -0
- package/build/ts/server/__test-helpers/get-thrown-response.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/get-thrown-response.js +28 -0
- package/build/ts/server/__test-helpers/get-thrown-response.js.map +1 -0
- package/build/ts/server/__test-helpers/index.d.ts +16 -0
- package/build/ts/server/__test-helpers/index.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/index.js +19 -0
- package/build/ts/server/__test-helpers/index.js.map +1 -0
- package/build/ts/server/__test-helpers/request-mock.d.ts +10 -0
- package/build/ts/server/__test-helpers/request-mock.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/request-mock.js +192 -0
- package/build/ts/server/__test-helpers/request-mock.js.map +1 -0
- package/build/ts/server/__test-helpers/setup-valid-session.d.ts +4 -0
- package/build/ts/server/__test-helpers/setup-valid-session.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/setup-valid-session.js +45 -0
- package/build/ts/server/__test-helpers/setup-valid-session.js.map +1 -0
- package/build/ts/server/__test-helpers/sign-request-cookie.d.ts +6 -0
- package/build/ts/server/__test-helpers/sign-request-cookie.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/sign-request-cookie.js +14 -0
- package/build/ts/server/__test-helpers/sign-request-cookie.js.map +1 -0
- package/build/ts/server/__test-helpers/test-config.d.ts +6 -0
- package/build/ts/server/__test-helpers/test-config.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/test-config.js +16 -0
- package/build/ts/server/__test-helpers/test-config.js.map +1 -0
- package/build/ts/server/adapters/node/index.d.ts.map +1 -0
- package/build/ts/{adapters → server/adapters}/node/index.js +1 -1
- package/build/ts/server/adapters/node/index.js.map +1 -0
- package/build/ts/{auth → server/authenticate}/admin/authenticate.d.ts +0 -2
- package/build/ts/server/authenticate/admin/authenticate.d.ts.map +1 -0
- package/build/ts/{auth → server/authenticate}/admin/authenticate.js +31 -78
- package/build/ts/server/authenticate/admin/authenticate.js.map +1 -0
- package/build/ts/{billing → server/authenticate/admin/billing}/cancel.d.ts +1 -1
- package/build/ts/server/authenticate/admin/billing/cancel.d.ts.map +1 -0
- package/build/ts/{billing → server/authenticate/admin/billing}/cancel.js +1 -1
- package/build/ts/server/authenticate/admin/billing/cancel.js.map +1 -0
- package/build/ts/server/authenticate/admin/billing/index.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/billing/index.js.map +1 -0
- package/build/ts/{billing → server/authenticate/admin/billing}/request.d.ts +2 -2
- package/build/ts/server/authenticate/admin/billing/request.d.ts.map +1 -0
- package/build/ts/{billing → server/authenticate/admin/billing}/request.js +2 -3
- package/build/ts/server/authenticate/admin/billing/request.js.map +1 -0
- package/build/ts/{billing → server/authenticate/admin/billing}/require.d.ts +2 -2
- package/build/ts/server/authenticate/admin/billing/require.d.ts.map +1 -0
- package/build/ts/{billing → server/authenticate/admin/billing}/require.js +1 -1
- package/build/ts/server/authenticate/admin/billing/require.js.map +1 -0
- package/build/ts/{billing → server/authenticate/admin/billing}/types.d.ts +1 -1
- package/build/ts/server/authenticate/admin/billing/types.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/billing/types.js.map +1 -0
- package/build/ts/{auth → server/authenticate/admin}/helpers/begin-auth.d.ts +1 -1
- package/build/ts/server/authenticate/admin/helpers/begin-auth.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/begin-auth.js.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/handle-client-error.d.ts +7 -0
- package/build/ts/server/authenticate/admin/helpers/handle-client-error.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/handle-client-error.js +41 -0
- package/build/ts/server/authenticate/admin/helpers/handle-client-error.js.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/index.d.ts +8 -0
- package/build/ts/server/authenticate/admin/helpers/index.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/index.js +11 -0
- package/build/ts/server/authenticate/admin/helpers/index.js.map +1 -0
- package/build/ts/{auth → server/authenticate/admin}/helpers/redirect-to-auth-page.d.ts +1 -1
- package/build/ts/server/authenticate/admin/helpers/redirect-to-auth-page.d.ts.map +1 -0
- package/build/ts/{auth → server/authenticate/admin}/helpers/redirect-to-auth-page.js +5 -2
- package/build/ts/server/authenticate/admin/helpers/redirect-to-auth-page.js.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/redirect-with-app-bridge-headers.d.ts +3 -0
- package/build/ts/server/authenticate/admin/helpers/redirect-with-app-bridge-headers.d.ts.map +1 -0
- package/build/ts/{auth → server/authenticate/admin}/helpers/redirect-with-app-bridge-headers.js +2 -4
- package/build/ts/server/authenticate/admin/helpers/redirect-with-app-bridge-headers.js.map +1 -0
- package/build/ts/{auth → server/authenticate/admin}/helpers/redirect-with-exitiframe.d.ts +1 -1
- package/build/ts/server/authenticate/admin/helpers/redirect-with-exitiframe.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/redirect-with-exitiframe.js.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/redirect.d.ts +9 -0
- package/build/ts/server/authenticate/admin/helpers/redirect.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/redirect.js +64 -0
- package/build/ts/server/authenticate/admin/helpers/redirect.js.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/render-app-bridge.d.ts +8 -0
- package/build/ts/server/authenticate/admin/helpers/render-app-bridge.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/render-app-bridge.js +22 -0
- package/build/ts/server/authenticate/admin/helpers/render-app-bridge.js.map +1 -0
- package/build/ts/{auth → server/authenticate}/admin/types.d.ts +22 -2
- package/build/ts/server/authenticate/admin/types.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/types.js.map +1 -0
- package/build/ts/server/authenticate/const.d.ts.map +1 -0
- package/build/ts/server/authenticate/const.js.map +1 -0
- package/build/ts/server/authenticate/helpers/add-response-headers.d.ts.map +1 -0
- package/build/ts/server/authenticate/helpers/add-response-headers.js.map +1 -0
- package/build/ts/server/authenticate/helpers/app-bridge-url.d.ts.map +1 -0
- package/build/ts/server/authenticate/helpers/app-bridge-url.js.map +1 -0
- package/build/ts/{auth → server/authenticate}/helpers/ensure-cors-headers.d.ts +1 -1
- package/build/ts/server/authenticate/helpers/ensure-cors-headers.d.ts.map +1 -0
- package/build/ts/{auth → server/authenticate}/helpers/ensure-cors-headers.js +8 -2
- package/build/ts/server/authenticate/helpers/ensure-cors-headers.js.map +1 -0
- package/build/ts/server/authenticate/helpers/get-session-token-header.d.ts.map +1 -0
- package/build/ts/server/authenticate/helpers/get-session-token-header.js.map +1 -0
- package/build/ts/{auth → server/authenticate}/helpers/index.d.ts +0 -4
- package/build/ts/server/authenticate/helpers/index.d.ts.map +1 -0
- package/build/ts/{auth → server/authenticate}/helpers/index.js +0 -4
- package/build/ts/server/authenticate/helpers/index.js.map +1 -0
- package/build/ts/server/authenticate/helpers/reject-bot-request.d.ts.map +1 -0
- package/build/ts/server/authenticate/helpers/reject-bot-request.js.map +1 -0
- package/build/ts/server/authenticate/helpers/respond-to-options-request.d.ts +3 -0
- package/build/ts/server/authenticate/helpers/respond-to-options-request.d.ts.map +1 -0
- package/build/ts/{auth → server/authenticate}/helpers/respond-to-options-request.js +2 -2
- package/build/ts/server/authenticate/helpers/respond-to-options-request.js.map +1 -0
- package/build/ts/server/authenticate/helpers/validate-session-token.d.ts +8 -0
- package/build/ts/server/authenticate/helpers/validate-session-token.d.ts.map +1 -0
- package/build/ts/{auth → server/authenticate}/helpers/validate-session-token.js +11 -8
- package/build/ts/server/authenticate/helpers/validate-session-token.js.map +1 -0
- package/build/ts/server/authenticate/login/login.d.ts.map +1 -0
- package/build/ts/{auth → server/authenticate}/login/login.js +3 -1
- package/build/ts/server/authenticate/login/login.js.map +1 -0
- package/build/ts/server/authenticate/public/appProxy/authenticate.d.ts +5 -0
- package/build/ts/server/authenticate/public/appProxy/authenticate.d.ts.map +1 -0
- package/build/ts/server/authenticate/public/appProxy/authenticate.js +79 -0
- package/build/ts/server/authenticate/public/appProxy/authenticate.js.map +1 -0
- package/build/ts/server/authenticate/public/appProxy/types.d.ts +70 -0
- package/build/ts/server/authenticate/public/appProxy/types.d.ts.map +1 -0
- package/build/ts/server/authenticate/public/appProxy/types.js.map +1 -0
- package/build/ts/server/authenticate/public/checkout/authenticate.d.ts +4 -0
- package/build/ts/server/authenticate/public/checkout/authenticate.d.ts.map +1 -0
- package/build/ts/server/authenticate/public/checkout/authenticate.js +42 -0
- package/build/ts/server/authenticate/public/checkout/authenticate.js.map +1 -0
- package/build/ts/{auth/public → server/authenticate/public/checkout}/types.d.ts +13 -7
- package/build/ts/server/authenticate/public/checkout/types.d.ts.map +1 -0
- package/build/ts/server/authenticate/public/checkout/types.js.map +1 -0
- package/build/ts/server/authenticate/public/factory.d.ts +5 -0
- package/build/ts/server/authenticate/public/factory.d.ts.map +1 -0
- package/build/ts/server/authenticate/public/factory.js +18 -0
- package/build/ts/server/authenticate/public/factory.js.map +1 -0
- package/build/ts/server/authenticate/public/index.d.ts +2 -0
- package/build/ts/server/authenticate/public/index.d.ts.map +1 -0
- package/build/ts/server/authenticate/public/index.js +5 -0
- package/build/ts/server/authenticate/public/index.js.map +1 -0
- package/build/ts/server/authenticate/public/types.d.ts +61 -0
- package/build/ts/server/authenticate/public/types.d.ts.map +1 -0
- package/build/ts/server/authenticate/public/types.js.map +1 -0
- package/build/ts/server/authenticate/webhooks/authenticate.d.ts.map +1 -0
- package/build/ts/server/authenticate/webhooks/authenticate.js.map +1 -0
- package/build/ts/server/authenticate/webhooks/index.d.ts.map +1 -0
- package/build/ts/server/authenticate/webhooks/index.js.map +1 -0
- package/build/ts/server/authenticate/webhooks/register.d.ts.map +1 -0
- package/build/ts/server/authenticate/webhooks/register.js.map +1 -0
- package/build/ts/server/authenticate/webhooks/types.d.ts.map +1 -0
- package/build/ts/server/authenticate/webhooks/types.js +3 -0
- package/build/ts/server/authenticate/webhooks/types.js.map +1 -0
- package/build/ts/server/boundary/error.d.ts +2 -0
- package/build/ts/server/boundary/error.d.ts.map +1 -0
- package/build/ts/{boundary → server/boundary}/error.js +2 -1
- package/build/ts/server/boundary/error.js.map +1 -0
- package/build/ts/server/boundary/headers.d.ts.map +1 -0
- package/build/ts/server/boundary/headers.js.map +1 -0
- package/build/ts/server/boundary/index.d.ts +38 -0
- package/build/ts/server/boundary/index.d.ts.map +1 -0
- package/build/ts/server/boundary/index.js +41 -0
- package/build/ts/server/boundary/index.js.map +1 -0
- package/build/ts/server/boundary/types.d.ts.map +1 -0
- package/build/ts/server/boundary/types.js +3 -0
- package/build/ts/{auth/admin → server/boundary}/types.js.map +1 -1
- package/build/ts/server/clients/admin/factory.d.ts +11 -0
- package/build/ts/server/clients/admin/factory.d.ts.map +1 -0
- package/build/ts/server/clients/admin/factory.js +18 -0
- package/build/ts/server/clients/admin/factory.js.map +1 -0
- package/build/ts/server/clients/admin/graphql.d.ts +17 -0
- package/build/ts/server/clients/admin/graphql.d.ts.map +1 -0
- package/build/ts/{auth/admin/graphql-client.js → server/clients/admin/graphql.js} +9 -14
- package/build/ts/server/clients/admin/graphql.js.map +1 -0
- package/build/ts/server/clients/admin/index.d.ts +2 -0
- package/build/ts/server/clients/admin/index.d.ts.map +1 -0
- package/build/ts/server/clients/admin/index.js +5 -0
- package/build/ts/server/clients/admin/index.js.map +1 -0
- package/build/ts/{auth/admin/rest-client.d.ts → server/clients/admin/rest.d.ts} +10 -13
- package/build/ts/server/clients/admin/rest.d.ts.map +1 -0
- package/build/ts/{auth/admin/rest-client.js → server/clients/admin/rest.js} +56 -25
- package/build/ts/server/clients/admin/rest.js.map +1 -0
- package/build/ts/server/clients/admin/types.d.ts +13 -0
- package/build/ts/server/clients/admin/types.d.ts.map +1 -0
- package/build/ts/server/clients/admin/types.js +3 -0
- package/build/ts/server/clients/admin/types.js.map +1 -0
- package/build/ts/{config-types.d.ts → server/config-types.d.ts} +3 -3
- package/build/ts/server/config-types.d.ts.map +1 -0
- package/build/ts/server/config-types.js.map +1 -0
- package/build/ts/server/index.d.ts +7 -0
- package/build/ts/server/index.d.ts.map +1 -0
- package/build/ts/server/index.js +22 -0
- package/build/ts/server/index.js.map +1 -0
- package/build/ts/server/override-logger.d.ts.map +1 -0
- package/build/ts/server/override-logger.js.map +1 -0
- package/build/ts/server/shopify-app.d.ts +27 -0
- package/build/ts/server/shopify-app.d.ts.map +1 -0
- package/build/ts/{index.js → server/shopify-app.js} +13 -59
- package/build/ts/server/shopify-app.js.map +1 -0
- package/build/ts/{types.d.ts → server/types.d.ts} +45 -13
- package/build/ts/server/types.d.ts.map +1 -0
- package/build/ts/server/types.js.map +1 -0
- package/build/ts/server/unauthenticated/admin/factory.d.ts +5 -0
- package/build/ts/server/unauthenticated/admin/factory.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/admin/factory.js +30 -0
- package/build/ts/server/unauthenticated/admin/factory.js.map +1 -0
- package/build/ts/server/unauthenticated/admin/index.d.ts +2 -0
- package/build/ts/server/unauthenticated/admin/index.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/admin/index.js +5 -0
- package/build/ts/server/unauthenticated/admin/index.js.map +1 -0
- package/build/ts/server/unauthenticated/admin/types.d.ts +32 -0
- package/build/ts/server/unauthenticated/admin/types.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/admin/types.js +3 -0
- package/build/ts/server/unauthenticated/admin/types.js.map +1 -0
- package/build/ts/server/version.d.ts +2 -0
- package/build/ts/server/version.d.ts.map +1 -0
- package/build/ts/{version.js → server/version.js} +1 -1
- package/build/ts/server/version.js.map +1 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +34 -10
- package/build/cjs/auth/helpers/handle-client-error.js +0 -37
- package/build/cjs/auth/public/authenticate.js +0 -36
- package/build/ts/adapters/node/index.d.ts.map +0 -1
- package/build/ts/adapters/node/index.js.map +0 -1
- package/build/ts/auth/admin/authenticate.d.ts.map +0 -1
- package/build/ts/auth/admin/authenticate.js.map +0 -1
- package/build/ts/auth/admin/graphql-client.d.ts +0 -22
- package/build/ts/auth/admin/graphql-client.d.ts.map +0 -1
- package/build/ts/auth/admin/graphql-client.js.map +0 -1
- package/build/ts/auth/admin/rest-client.d.ts.map +0 -1
- package/build/ts/auth/admin/rest-client.js.map +0 -1
- package/build/ts/auth/admin/types.d.ts.map +0 -1
- package/build/ts/auth/const.d.ts.map +0 -1
- package/build/ts/auth/const.js.map +0 -1
- package/build/ts/auth/helpers/add-response-headers.d.ts.map +0 -1
- package/build/ts/auth/helpers/add-response-headers.js.map +0 -1
- package/build/ts/auth/helpers/app-bridge-url.d.ts.map +0 -1
- package/build/ts/auth/helpers/app-bridge-url.js.map +0 -1
- package/build/ts/auth/helpers/begin-auth.d.ts.map +0 -1
- package/build/ts/auth/helpers/begin-auth.js.map +0 -1
- package/build/ts/auth/helpers/ensure-cors-headers.d.ts.map +0 -1
- package/build/ts/auth/helpers/ensure-cors-headers.js.map +0 -1
- package/build/ts/auth/helpers/get-session-token-header.d.ts.map +0 -1
- package/build/ts/auth/helpers/get-session-token-header.js.map +0 -1
- package/build/ts/auth/helpers/handle-client-error.d.ts +0 -11
- package/build/ts/auth/helpers/handle-client-error.d.ts.map +0 -1
- package/build/ts/auth/helpers/handle-client-error.js +0 -40
- package/build/ts/auth/helpers/handle-client-error.js.map +0 -1
- package/build/ts/auth/helpers/index.d.ts.map +0 -1
- package/build/ts/auth/helpers/index.js.map +0 -1
- package/build/ts/auth/helpers/redirect-to-auth-page.d.ts.map +0 -1
- package/build/ts/auth/helpers/redirect-to-auth-page.js.map +0 -1
- package/build/ts/auth/helpers/redirect-with-app-bridge-headers.d.ts +0 -4
- package/build/ts/auth/helpers/redirect-with-app-bridge-headers.d.ts.map +0 -1
- package/build/ts/auth/helpers/redirect-with-app-bridge-headers.js.map +0 -1
- package/build/ts/auth/helpers/redirect-with-exitiframe.d.ts.map +0 -1
- package/build/ts/auth/helpers/redirect-with-exitiframe.js.map +0 -1
- package/build/ts/auth/helpers/reject-bot-request.d.ts.map +0 -1
- package/build/ts/auth/helpers/reject-bot-request.js.map +0 -1
- package/build/ts/auth/helpers/respond-to-options-request.d.ts +0 -3
- package/build/ts/auth/helpers/respond-to-options-request.d.ts.map +0 -1
- package/build/ts/auth/helpers/respond-to-options-request.js.map +0 -1
- package/build/ts/auth/helpers/validate-session-token.d.ts +0 -4
- package/build/ts/auth/helpers/validate-session-token.d.ts.map +0 -1
- package/build/ts/auth/helpers/validate-session-token.js.map +0 -1
- package/build/ts/auth/login/login.d.ts.map +0 -1
- package/build/ts/auth/login/login.js.map +0 -1
- package/build/ts/auth/public/authenticate.d.ts +0 -4
- package/build/ts/auth/public/authenticate.d.ts.map +0 -1
- package/build/ts/auth/public/authenticate.js +0 -37
- package/build/ts/auth/public/authenticate.js.map +0 -1
- package/build/ts/auth/public/types.d.ts.map +0 -1
- package/build/ts/auth/public/types.js.map +0 -1
- package/build/ts/auth/webhooks/authenticate.d.ts.map +0 -1
- package/build/ts/auth/webhooks/authenticate.js.map +0 -1
- package/build/ts/auth/webhooks/index.d.ts.map +0 -1
- package/build/ts/auth/webhooks/index.js.map +0 -1
- package/build/ts/auth/webhooks/register.d.ts.map +0 -1
- package/build/ts/auth/webhooks/register.js.map +0 -1
- package/build/ts/auth/webhooks/types.d.ts.map +0 -1
- package/build/ts/auth/webhooks/types.js.map +0 -1
- package/build/ts/billing/cancel.d.ts.map +0 -1
- package/build/ts/billing/cancel.js.map +0 -1
- package/build/ts/billing/index.d.ts.map +0 -1
- package/build/ts/billing/index.js.map +0 -1
- package/build/ts/billing/request.d.ts.map +0 -1
- package/build/ts/billing/request.js.map +0 -1
- package/build/ts/billing/require.d.ts.map +0 -1
- package/build/ts/billing/require.js.map +0 -1
- package/build/ts/billing/types.d.ts.map +0 -1
- package/build/ts/billing/types.js.map +0 -1
- package/build/ts/boundary/error.d.ts +0 -2
- package/build/ts/boundary/error.d.ts.map +0 -1
- package/build/ts/boundary/error.js.map +0 -1
- package/build/ts/boundary/headers.d.ts.map +0 -1
- package/build/ts/boundary/headers.js.map +0 -1
- package/build/ts/boundary/types.d.ts.map +0 -1
- package/build/ts/boundary/types.js.map +0 -1
- package/build/ts/config-types.d.ts.map +0 -1
- package/build/ts/config-types.js.map +0 -1
- package/build/ts/index.d.ts +0 -67
- package/build/ts/index.d.ts.map +0 -1
- package/build/ts/index.js.map +0 -1
- package/build/ts/override-logger.d.ts.map +0 -1
- package/build/ts/override-logger.js.map +0 -1
- package/build/ts/types.d.ts.map +0 -1
- package/build/ts/types.js.map +0 -1
- package/build/ts/version.d.ts +0 -2
- package/build/ts/version.d.ts.map +0 -1
- package/build/ts/version.js.map +0 -1
- /package/build/cjs/{auth → server/authenticate/admin}/helpers/begin-auth.js +0 -0
- /package/build/cjs/{auth → server/authenticate/admin}/helpers/redirect-with-exitiframe.js +0 -0
- /package/build/cjs/{auth → server/authenticate}/const.js +0 -0
- /package/build/cjs/{auth → server/authenticate}/helpers/add-response-headers.js +0 -0
- /package/build/cjs/{auth → server/authenticate}/helpers/app-bridge-url.js +0 -0
- /package/build/cjs/{auth → server/authenticate}/helpers/get-session-token-header.js +0 -0
- /package/build/cjs/{auth → server/authenticate}/helpers/reject-bot-request.js +0 -0
- /package/build/cjs/{auth → server/authenticate}/webhooks/authenticate.js +0 -0
- /package/build/cjs/{auth → server/authenticate}/webhooks/register.js +0 -0
- /package/build/cjs/{boundary → server/boundary}/headers.js +0 -0
- /package/build/cjs/{override-logger.js → server/override-logger.js} +0 -0
- /package/build/cjs/{types.js → server/types.js} +0 -0
- /package/build/ts/{adapters → server/adapters}/node/index.d.ts +0 -0
- /package/build/ts/{billing → server/authenticate/admin/billing}/index.d.ts +0 -0
- /package/build/ts/{billing → server/authenticate/admin/billing}/index.js +0 -0
- /package/build/ts/{auth/admin → server/authenticate/admin/billing}/types.js +0 -0
- /package/build/ts/{auth → server/authenticate/admin}/helpers/begin-auth.js +0 -0
- /package/build/ts/{auth → server/authenticate/admin}/helpers/redirect-with-exitiframe.js +0 -0
- /package/build/ts/{auth/public → server/authenticate/admin}/types.js +0 -0
- /package/build/ts/{auth → server/authenticate}/const.d.ts +0 -0
- /package/build/ts/{auth → server/authenticate}/const.js +0 -0
- /package/build/ts/{auth → server/authenticate}/helpers/add-response-headers.d.ts +0 -0
- /package/build/ts/{auth → server/authenticate}/helpers/add-response-headers.js +0 -0
- /package/build/ts/{auth → server/authenticate}/helpers/app-bridge-url.d.ts +0 -0
- /package/build/ts/{auth → server/authenticate}/helpers/app-bridge-url.js +0 -0
- /package/build/ts/{auth → server/authenticate}/helpers/get-session-token-header.d.ts +0 -0
- /package/build/ts/{auth → server/authenticate}/helpers/get-session-token-header.js +0 -0
- /package/build/ts/{auth → server/authenticate}/helpers/reject-bot-request.d.ts +0 -0
- /package/build/ts/{auth → server/authenticate}/helpers/reject-bot-request.js +0 -0
- /package/build/ts/{auth → server/authenticate}/login/login.d.ts +0 -0
- /package/build/ts/{auth/webhooks → server/authenticate/public/appProxy}/types.js +0 -0
- /package/build/ts/{billing → server/authenticate/public/checkout}/types.js +0 -0
- /package/build/ts/{boundary → server/authenticate/public}/types.js +0 -0
- /package/build/ts/{auth → server/authenticate}/webhooks/authenticate.d.ts +0 -0
- /package/build/ts/{auth → server/authenticate}/webhooks/authenticate.js +0 -0
- /package/build/ts/{auth → server/authenticate}/webhooks/index.d.ts +0 -0
- /package/build/ts/{auth → server/authenticate}/webhooks/index.js +0 -0
- /package/build/ts/{auth → server/authenticate}/webhooks/register.d.ts +0 -0
- /package/build/ts/{auth → server/authenticate}/webhooks/register.js +0 -0
- /package/build/ts/{auth → server/authenticate}/webhooks/types.d.ts +0 -0
- /package/build/ts/{boundary → server/boundary}/headers.d.ts +0 -0
- /package/build/ts/{boundary → server/boundary}/headers.js +0 -0
- /package/build/ts/{boundary → server/boundary}/types.d.ts +0 -0
- /package/build/ts/{config-types.js → server/config-types.js} +0 -0
- /package/build/ts/{override-logger.d.ts → server/override-logger.d.ts} +0 -0
- /package/build/ts/{override-logger.js → server/override-logger.js} +0 -0
- /package/build/ts/{types.js → server/types.js} +0 -0
|
@@ -5,10 +5,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
async function validateSessionToken({
|
|
6
6
|
api,
|
|
7
7
|
logger
|
|
8
|
-
}, token
|
|
8
|
+
}, token, {
|
|
9
|
+
checkAudience = true
|
|
10
|
+
} = {}) {
|
|
9
11
|
logger.debug('Validating session token');
|
|
10
12
|
try {
|
|
11
|
-
const payload = await api.session.decodeSessionToken(token
|
|
13
|
+
const payload = await api.session.decodeSessionToken(token, {
|
|
14
|
+
checkAudience
|
|
15
|
+
});
|
|
12
16
|
logger.debug('Session token is valid', {
|
|
13
17
|
payload: JSON.stringify(payload)
|
|
14
18
|
});
|
|
@@ -26,7 +26,7 @@ function loginFactory(params) {
|
|
|
26
26
|
shop: types.LoginErrorType.MissingShop
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
const shopWithoutProtocol = shop.replace(/^https?:\/\//, '');
|
|
29
|
+
const shopWithoutProtocol = shop.replace(/^https?:\/\//, '').replace(/\/$/, '');
|
|
30
30
|
const shopWithDomain = (shop === null || shop === void 0 ? void 0 : shop.indexOf('.')) === -1 ? `${shopWithoutProtocol}.myshopify.com` : shopWithoutProtocol;
|
|
31
31
|
const sanitizedShop = api.utils.sanitizeShop(shopWithDomain);
|
|
32
32
|
if (!sanitizedShop) {
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var factory = require('../../../clients/admin/factory.js');
|
|
6
|
+
|
|
7
|
+
function authenticateAppProxyFactory(params) {
|
|
8
|
+
const {
|
|
9
|
+
api,
|
|
10
|
+
config,
|
|
11
|
+
logger
|
|
12
|
+
} = params;
|
|
13
|
+
return async function authenticate(request) {
|
|
14
|
+
logger.info('Authenticating app proxy request');
|
|
15
|
+
const {
|
|
16
|
+
searchParams
|
|
17
|
+
} = new URL(request.url);
|
|
18
|
+
const query = Object.fromEntries(searchParams.entries());
|
|
19
|
+
let isValid = false;
|
|
20
|
+
try {
|
|
21
|
+
isValid = await api.utils.validateHmac(query, {
|
|
22
|
+
signator: 'appProxy'
|
|
23
|
+
});
|
|
24
|
+
} catch (error) {
|
|
25
|
+
logger.info(error.message);
|
|
26
|
+
throw new Response(undefined, {
|
|
27
|
+
status: 400,
|
|
28
|
+
statusText: 'Bad Request'
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (!isValid) {
|
|
32
|
+
logger.info('App proxy request has invalid signature');
|
|
33
|
+
throw new Response(undefined, {
|
|
34
|
+
status: 400,
|
|
35
|
+
statusText: 'Bad Request'
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const shop = searchParams.get('shop');
|
|
39
|
+
const sessionId = api.session.getOfflineId(shop);
|
|
40
|
+
const session = await config.sessionStorage.loadSession(sessionId);
|
|
41
|
+
if (!session) {
|
|
42
|
+
const context = {
|
|
43
|
+
liquid,
|
|
44
|
+
session: undefined,
|
|
45
|
+
admin: undefined
|
|
46
|
+
};
|
|
47
|
+
return context;
|
|
48
|
+
}
|
|
49
|
+
const context = {
|
|
50
|
+
liquid,
|
|
51
|
+
session,
|
|
52
|
+
admin: factory.adminClientFactory({
|
|
53
|
+
params,
|
|
54
|
+
session
|
|
55
|
+
})
|
|
56
|
+
};
|
|
57
|
+
return context;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const liquid = (body, initAndOptions) => {
|
|
61
|
+
if (typeof initAndOptions !== 'object') {
|
|
62
|
+
return new Response(body, {
|
|
63
|
+
status: initAndOptions || 200,
|
|
64
|
+
headers: {
|
|
65
|
+
'Content-Type': 'application/liquid'
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const {
|
|
70
|
+
layout,
|
|
71
|
+
...responseInit
|
|
72
|
+
} = initAndOptions || {};
|
|
73
|
+
const responseBody = layout === false ? `{% layout none %} ${body}` : body;
|
|
74
|
+
const headers = new Headers(responseInit.headers);
|
|
75
|
+
headers.set('Content-Type', 'application/liquid');
|
|
76
|
+
return new Response(responseBody, {
|
|
77
|
+
...responseInit,
|
|
78
|
+
headers
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
exports.authenticateAppProxyFactory = authenticateAppProxyFactory;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var ensureCorsHeaders = require('../../helpers/ensure-cors-headers.js');
|
|
6
|
+
var validateSessionToken = require('../../helpers/validate-session-token.js');
|
|
7
|
+
var getSessionTokenHeader = require('../../helpers/get-session-token-header.js');
|
|
8
|
+
var rejectBotRequest = require('../../helpers/reject-bot-request.js');
|
|
9
|
+
var respondToOptionsRequest = require('../../helpers/respond-to-options-request.js');
|
|
10
|
+
|
|
11
|
+
function authenticateCheckoutFactory(params) {
|
|
12
|
+
return async function authenticateCheckout(request, options = {}) {
|
|
13
|
+
var _options$corsHeaders;
|
|
14
|
+
const {
|
|
15
|
+
logger
|
|
16
|
+
} = params;
|
|
17
|
+
const corsHeaders = (_options$corsHeaders = options.corsHeaders) !== null && _options$corsHeaders !== void 0 ? _options$corsHeaders : [];
|
|
18
|
+
rejectBotRequest.rejectBotRequest(params, request);
|
|
19
|
+
respondToOptionsRequest.respondToOptionsRequest(params, request, corsHeaders);
|
|
20
|
+
const sessionTokenHeader = getSessionTokenHeader.getSessionTokenHeader(request);
|
|
21
|
+
logger.info('Authenticating checkout request');
|
|
22
|
+
if (!sessionTokenHeader) {
|
|
23
|
+
logger.debug('Request did not contain a session token');
|
|
24
|
+
throw new Response(undefined, {
|
|
25
|
+
status: 401,
|
|
26
|
+
statusText: 'Unauthorized'
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
sessionToken: await validateSessionToken.validateSessionToken(params, sessionTokenHeader, {
|
|
31
|
+
checkAudience: false
|
|
32
|
+
}),
|
|
33
|
+
cors: ensureCorsHeaders.ensureCORSHeadersFactory(params, request, corsHeaders)
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.authenticateCheckoutFactory = authenticateCheckoutFactory;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var authenticate$1 = require('./checkout/authenticate.js');
|
|
6
|
+
var authenticate = require('./appProxy/authenticate.js');
|
|
7
|
+
|
|
8
|
+
function authenticatePublicFactory(params) {
|
|
9
|
+
const {
|
|
10
|
+
logger
|
|
11
|
+
} = params;
|
|
12
|
+
const authenticateCheckout = authenticate$1.authenticateCheckoutFactory(params);
|
|
13
|
+
const authenticatePublic = (request, options) => {
|
|
14
|
+
logger.deprecated('2.0.0', 'authenticate.public() will be deprecated in v2. Use authenticate.public.checkout() instead.');
|
|
15
|
+
return authenticateCheckout(request, options);
|
|
16
|
+
};
|
|
17
|
+
authenticatePublic.checkout = authenticateCheckout;
|
|
18
|
+
authenticatePublic.appProxy = authenticate.authenticateAppProxyFactory(params);
|
|
19
|
+
return authenticatePublic;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
exports.authenticatePublicFactory = authenticatePublicFactory;
|
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
5
7
|
function errorBoundary(error) {
|
|
6
8
|
if (error.constructor.name === 'ErrorResponse') {
|
|
7
|
-
return
|
|
9
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
10
|
+
dangerouslySetInnerHTML: {
|
|
11
|
+
__html: error.data || 'Handling response'
|
|
12
|
+
}
|
|
13
|
+
});
|
|
8
14
|
}
|
|
9
15
|
throw error;
|
|
10
16
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var headers = require('./headers.js');
|
|
6
|
+
var error = require('./error.js');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A collection of functions that handle the necessary code for error boundaries in routes using authenticate.admin.
|
|
10
|
+
*/
|
|
11
|
+
const boundary = {
|
|
12
|
+
/**
|
|
13
|
+
* A function that handles errors or thrown responses.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* Catching errors in a route
|
|
17
|
+
* ```ts
|
|
18
|
+
* // app/routes/admin/widgets.ts
|
|
19
|
+
* import { boundary } from "@shopify/shopify-app-remix";
|
|
20
|
+
*
|
|
21
|
+
* export function ErrorBoundary() {
|
|
22
|
+
* return boundary.error(useRouteError());
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
error: error.errorBoundary,
|
|
27
|
+
/**
|
|
28
|
+
* A function that sets the appropriate document repsonse headers.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* Catching errors in a route
|
|
32
|
+
* ```ts
|
|
33
|
+
* // app/routes/admin/widgets.ts
|
|
34
|
+
* import { boundary } from "@shopify/shopify-app-remix";
|
|
35
|
+
*
|
|
36
|
+
* export const headers = (headersArgs) => {
|
|
37
|
+
* return boundary.headers(headersArgs);
|
|
38
|
+
* };
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
headers: headers.headersBoundary
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.boundary = boundary;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var graphql = require('./graphql.js');
|
|
6
|
+
var rest = require('./rest.js');
|
|
7
|
+
|
|
8
|
+
function adminClientFactory({
|
|
9
|
+
params,
|
|
10
|
+
handleClientError,
|
|
11
|
+
session
|
|
12
|
+
}) {
|
|
13
|
+
return {
|
|
14
|
+
rest: rest.restClientFactory({
|
|
15
|
+
params,
|
|
16
|
+
session,
|
|
17
|
+
handleClientError
|
|
18
|
+
}),
|
|
19
|
+
graphql: graphql.graphqlClientFactory({
|
|
20
|
+
params,
|
|
21
|
+
session,
|
|
22
|
+
handleClientError
|
|
23
|
+
})
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
exports.adminClientFactory = adminClientFactory;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var runtime = require('@shopify/shopify-api/runtime');
|
|
6
|
-
var handleClientError = require('../helpers/handle-client-error.js');
|
|
7
6
|
|
|
8
7
|
// eslint-disable-next-line no-warning-comments
|
|
9
8
|
// TODO: This is actually just a call through to the Shopify API client, but with a different API. We should eventually
|
|
@@ -11,17 +10,12 @@ var handleClientError = require('../helpers/handle-client-error.js');
|
|
|
11
10
|
// client request calls.
|
|
12
11
|
function graphqlClientFactory({
|
|
13
12
|
params,
|
|
14
|
-
|
|
13
|
+
handleClientError,
|
|
15
14
|
session
|
|
16
15
|
}) {
|
|
17
16
|
return async function query(query, options) {
|
|
18
17
|
var _options;
|
|
19
|
-
const {
|
|
20
|
-
api,
|
|
21
|
-
config,
|
|
22
|
-
logger
|
|
23
|
-
} = params;
|
|
24
|
-
const client = new api.clients.Graphql({
|
|
18
|
+
const client = new params.api.clients.Graphql({
|
|
25
19
|
session,
|
|
26
20
|
apiVersion: (_options = options) === null || _options === void 0 ? void 0 : _options.apiVersion
|
|
27
21
|
});
|
|
@@ -40,16 +34,14 @@ function graphqlClientFactory({
|
|
|
40
34
|
headers: runtime.flatHeaders(apiResponse.headers)
|
|
41
35
|
});
|
|
42
36
|
} catch (error) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
shop: session.shop
|
|
52
|
-
});
|
|
37
|
+
if (handleClientError) {
|
|
38
|
+
throw await handleClientError({
|
|
39
|
+
error,
|
|
40
|
+
params,
|
|
41
|
+
session
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
throw error;
|
|
53
45
|
}
|
|
54
46
|
};
|
|
55
47
|
}
|
|
@@ -2,22 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
function restClientFactory({
|
|
6
|
+
params,
|
|
7
|
+
handleClientError,
|
|
8
|
+
session
|
|
9
|
+
}) {
|
|
10
|
+
const {
|
|
11
|
+
api
|
|
12
|
+
} = params;
|
|
13
|
+
const client = new RemixRestClient({
|
|
14
|
+
params,
|
|
15
|
+
handleClientError,
|
|
16
|
+
session
|
|
17
|
+
});
|
|
18
|
+
if (api.rest) {
|
|
19
|
+
client.resources = {};
|
|
20
|
+
const RestResourceClient = restResourceClientFactory({
|
|
21
|
+
params,
|
|
22
|
+
handleClientError,
|
|
23
|
+
session
|
|
24
|
+
});
|
|
25
|
+
Object.entries(api.rest).forEach(([name, resource]) => {
|
|
26
|
+
class RemixResource extends resource {}
|
|
27
|
+
RemixResource.Client = RestResourceClient;
|
|
28
|
+
Reflect.defineProperty(RemixResource, 'name', {
|
|
29
|
+
value: name
|
|
30
|
+
});
|
|
31
|
+
Reflect.set(client.resources, name, RemixResource);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return client;
|
|
35
|
+
}
|
|
9
36
|
class RemixRestClient {
|
|
10
37
|
constructor({
|
|
11
38
|
params,
|
|
12
|
-
|
|
13
|
-
|
|
39
|
+
session,
|
|
40
|
+
handleClientError
|
|
14
41
|
}) {
|
|
15
42
|
this.session = void 0;
|
|
16
|
-
this.resources = void 0;
|
|
17
43
|
this.params = void 0;
|
|
18
|
-
this.
|
|
44
|
+
this.handleClientError = void 0;
|
|
19
45
|
this.params = params;
|
|
20
|
-
this.
|
|
46
|
+
this.handleClientError = handleClientError;
|
|
21
47
|
this.session = session;
|
|
22
48
|
}
|
|
23
49
|
|
|
@@ -74,28 +100,27 @@ class RemixRestClient {
|
|
|
74
100
|
headers: apiResponse.headers
|
|
75
101
|
});
|
|
76
102
|
} catch (error) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
103
|
+
if (this.handleClientError) {
|
|
104
|
+
throw await this.handleClientError({
|
|
105
|
+
error,
|
|
106
|
+
session: this.session,
|
|
107
|
+
params: this.params
|
|
108
|
+
});
|
|
109
|
+
} else throw new Error(error);
|
|
83
110
|
}
|
|
84
111
|
}
|
|
85
112
|
}
|
|
86
113
|
function restResourceClientFactory({
|
|
87
114
|
params,
|
|
88
|
-
|
|
115
|
+
handleClientError,
|
|
89
116
|
session
|
|
90
117
|
}) {
|
|
91
118
|
const {
|
|
92
|
-
api
|
|
93
|
-
config,
|
|
94
|
-
logger
|
|
119
|
+
api
|
|
95
120
|
} = params;
|
|
96
121
|
const ApiClient = api.clients.Rest;
|
|
97
122
|
return class RestResourceClient extends ApiClient {
|
|
98
|
-
async request(
|
|
123
|
+
async request(requestParams) {
|
|
99
124
|
const originalClient = new api.clients.Rest({
|
|
100
125
|
session
|
|
101
126
|
});
|
|
@@ -103,22 +128,18 @@ function restResourceClientFactory({
|
|
|
103
128
|
try {
|
|
104
129
|
// We just call through to the API library client, and handle the error response here, so that data parsing
|
|
105
130
|
// behaves the same way.
|
|
106
|
-
return await originalRequest.call(originalClient,
|
|
131
|
+
return await originalRequest.call(originalClient, requestParams);
|
|
107
132
|
} catch (error) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
shop: session.shop,
|
|
116
|
-
error
|
|
117
|
-
});
|
|
133
|
+
if (handleClientError) {
|
|
134
|
+
throw await handleClientError({
|
|
135
|
+
error,
|
|
136
|
+
params,
|
|
137
|
+
session
|
|
138
|
+
});
|
|
139
|
+
} else throw new Error(error);
|
|
118
140
|
}
|
|
119
141
|
}
|
|
120
142
|
};
|
|
121
143
|
}
|
|
122
144
|
|
|
123
|
-
exports.
|
|
124
|
-
exports.restResourceClientFactory = restResourceClientFactory;
|
|
145
|
+
exports.restClientFactory = restClientFactory;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('@shopify/shopify-api/adapters/web-api');
|
|
6
|
+
var runtime = require('@shopify/shopify-api/runtime');
|
|
7
|
+
var shopifyApi = require('@shopify/shopify-api');
|
|
8
|
+
var types = require('./types.js');
|
|
9
|
+
var index = require('./boundary/index.js');
|
|
10
|
+
var shopifyApp = require('./shopify-app.js');
|
|
11
|
+
|
|
12
|
+
runtime.setAbstractRuntimeString(() => {
|
|
13
|
+
return `Remix`;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
Object.defineProperty(exports, 'ApiVersion', {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return shopifyApi.ApiVersion; }
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, 'BillingInterval', {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return shopifyApi.BillingInterval; }
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, 'DeliveryMethod', {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return shopifyApi.DeliveryMethod; }
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, 'LATEST_API_VERSION', {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return shopifyApi.LATEST_API_VERSION; }
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, 'LogSeverity', {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () { return shopifyApi.LogSeverity; }
|
|
35
|
+
});
|
|
36
|
+
exports.AppDistribution = types.AppDistribution;
|
|
37
|
+
exports.LoginErrorType = types.LoginErrorType;
|
|
38
|
+
exports.boundary = index.boundary;
|
|
39
|
+
exports.shopifyApp = shopifyApp.shopifyApp;
|
|
@@ -4,24 +4,17 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
require('@shopify/shopify-api/adapters/web-api');
|
|
6
6
|
var shopifyApi = require('@shopify/shopify-api');
|
|
7
|
-
var runtime = require('@shopify/shopify-api/runtime');
|
|
8
7
|
var types = require('./types.js');
|
|
9
8
|
var version = require('./version.js');
|
|
10
|
-
var register = require('./
|
|
11
|
-
var authenticate$
|
|
12
|
-
var authenticate
|
|
13
|
-
var authenticate = require('./auth/public/authenticate.js');
|
|
9
|
+
var register = require('./authenticate/webhooks/register.js');
|
|
10
|
+
var authenticate$1 = require('./authenticate/admin/authenticate.js');
|
|
11
|
+
var authenticate = require('./authenticate/webhooks/authenticate.js');
|
|
14
12
|
var overrideLogger = require('./override-logger.js');
|
|
15
|
-
var addResponseHeaders = require('./
|
|
16
|
-
require('@remix-run/server-runtime');
|
|
13
|
+
var addResponseHeaders = require('./authenticate/helpers/add-response-headers.js');
|
|
17
14
|
require('isbot');
|
|
18
|
-
var login = require('./
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
runtime.setAbstractRuntimeString(() => {
|
|
23
|
-
return `Remix`;
|
|
24
|
-
});
|
|
15
|
+
var login = require('./authenticate/login/login.js');
|
|
16
|
+
var factory$1 = require('./unauthenticated/admin/factory.js');
|
|
17
|
+
var factory = require('./authenticate/public/factory.js');
|
|
25
18
|
|
|
26
19
|
/**
|
|
27
20
|
* Creates an object your app will use to interact with Shopify.
|
|
@@ -55,15 +48,18 @@ function shopifyApp(appConfig) {
|
|
|
55
48
|
config,
|
|
56
49
|
logger
|
|
57
50
|
};
|
|
58
|
-
const oauth = new authenticate$
|
|
51
|
+
const oauth = new authenticate$1.AuthStrategy(params);
|
|
59
52
|
const shopify = {
|
|
60
53
|
sessionStorage: config.sessionStorage,
|
|
61
54
|
addDocumentResponseHeaders: addResponseHeaders.addDocumentResponseHeadersFactory(params),
|
|
62
55
|
registerWebhooks: register.registerWebhooksFactory(params),
|
|
63
56
|
authenticate: {
|
|
64
57
|
admin: oauth.authenticateAdmin.bind(oauth),
|
|
65
|
-
public:
|
|
66
|
-
webhook: authenticate
|
|
58
|
+
public: factory.authenticatePublicFactory(params),
|
|
59
|
+
webhook: authenticate.authenticateWebhookFactory(params)
|
|
60
|
+
},
|
|
61
|
+
unauthenticated: {
|
|
62
|
+
admin: factory$1.unauthenticatedAdminContextFactory(params)
|
|
67
63
|
}
|
|
68
64
|
};
|
|
69
65
|
if (isAppStoreApp(shopify, appConfig) || isSingleMerchantApp(shopify, appConfig)) {
|
|
@@ -71,42 +67,6 @@ function shopifyApp(appConfig) {
|
|
|
71
67
|
}
|
|
72
68
|
return shopify;
|
|
73
69
|
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* A collection of functions that handle the necessary code for error boundaries in routes using authenticate.admin.
|
|
77
|
-
*/
|
|
78
|
-
const boundary = {
|
|
79
|
-
/**
|
|
80
|
-
* A function that handles errors or thrown responses.
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* Catching errors in a route
|
|
84
|
-
* ```ts
|
|
85
|
-
* // app/routes/admin/widgets.ts
|
|
86
|
-
* import { boundary } from "@shopify/shopify-app-remix";
|
|
87
|
-
*
|
|
88
|
-
* export function ErrorBoundary() {
|
|
89
|
-
* return boundary.error(useRouteError());
|
|
90
|
-
* }
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
error: error.errorBoundary,
|
|
94
|
-
/**
|
|
95
|
-
* A function that sets the appropriate document repsonse headers.
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* Catching errors in a route
|
|
99
|
-
* ```ts
|
|
100
|
-
* // app/routes/admin/widgets.ts
|
|
101
|
-
* import { boundary } from "@shopify/shopify-app-remix";
|
|
102
|
-
*
|
|
103
|
-
* export const headers = (headersArgs) => {
|
|
104
|
-
* return boundary.headers(headersArgs);
|
|
105
|
-
* };
|
|
106
|
-
* ```
|
|
107
|
-
*/
|
|
108
|
-
headers: headers.headersBoundary
|
|
109
|
-
};
|
|
110
70
|
function isAppStoreApp(_shopify, config) {
|
|
111
71
|
return config.distribution === types.AppDistribution.AppStore;
|
|
112
72
|
}
|
|
@@ -167,27 +127,4 @@ function deriveConfig(appConfig, apiConfig) {
|
|
|
167
127
|
};
|
|
168
128
|
}
|
|
169
129
|
|
|
170
|
-
Object.defineProperty(exports, 'ApiVersion', {
|
|
171
|
-
enumerable: true,
|
|
172
|
-
get: function () { return shopifyApi.ApiVersion; }
|
|
173
|
-
});
|
|
174
|
-
Object.defineProperty(exports, 'BillingInterval', {
|
|
175
|
-
enumerable: true,
|
|
176
|
-
get: function () { return shopifyApi.BillingInterval; }
|
|
177
|
-
});
|
|
178
|
-
Object.defineProperty(exports, 'DeliveryMethod', {
|
|
179
|
-
enumerable: true,
|
|
180
|
-
get: function () { return shopifyApi.DeliveryMethod; }
|
|
181
|
-
});
|
|
182
|
-
Object.defineProperty(exports, 'LATEST_API_VERSION', {
|
|
183
|
-
enumerable: true,
|
|
184
|
-
get: function () { return shopifyApi.LATEST_API_VERSION; }
|
|
185
|
-
});
|
|
186
|
-
Object.defineProperty(exports, 'LogSeverity', {
|
|
187
|
-
enumerable: true,
|
|
188
|
-
get: function () { return shopifyApi.LogSeverity; }
|
|
189
|
-
});
|
|
190
|
-
exports.AppDistribution = types.AppDistribution;
|
|
191
|
-
exports.LoginErrorType = types.LoginErrorType;
|
|
192
|
-
exports.boundary = boundary;
|
|
193
130
|
exports.shopifyApp = shopifyApp;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var shopifyApi = require('@shopify/shopify-api');
|
|
6
|
+
var factory = require('../../clients/admin/factory.js');
|
|
7
|
+
|
|
8
|
+
function unauthenticatedAdminContextFactory(params) {
|
|
9
|
+
return async shop => {
|
|
10
|
+
const offlineSessionId = params.api.session.getOfflineId(shop);
|
|
11
|
+
const session = await params.config.sessionStorage.loadSession(offlineSessionId);
|
|
12
|
+
if (!session) {
|
|
13
|
+
throw new shopifyApi.ShopifyError(`Could not find a session for shop ${shop} when creating unauthenticated admin context`);
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
session,
|
|
17
|
+
admin: factory.adminClientFactory({
|
|
18
|
+
params,
|
|
19
|
+
session
|
|
20
|
+
})
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
exports.unauthenticatedAdminContextFactory = unauthenticatedAdminContextFactory;
|