@agnostack/next-shopify 1.15.0-beta.9 → 1.15.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/CHANGELOG.md +189 -0
- package/README.md +9 -8
- package/dist/lib/handlers/api/auth.js +15 -11
- package/dist/lib/handlers/api/auth.js.map +1 -1
- package/dist/lib/handlers/api/billing.js +13 -9
- package/dist/lib/handlers/api/billing.js.map +1 -1
- package/dist/lib/handlers/api/callback.js +37 -33
- package/dist/lib/handlers/api/callback.js.map +1 -1
- package/dist/lib/handlers/api/index.js +25 -7
- package/dist/lib/handlers/api/index.js.map +1 -1
- package/dist/lib/handlers/api/uninstall.js +12 -8
- package/dist/lib/handlers/api/uninstall.js.map +1 -1
- package/dist/lib/handlers/api/verifiable/appInstallation.js +11 -7
- package/dist/lib/handlers/api/verifiable/appInstallation.js.map +1 -1
- package/dist/lib/handlers/api/verifiable/graph.js +26 -22
- package/dist/lib/handlers/api/verifiable/graph.js.map +1 -1
- package/dist/lib/handlers/api/verifiable/index.js +21 -5
- package/dist/lib/handlers/api/verifiable/index.js.map +1 -1
- package/dist/lib/handlers/api/verifiable/proxy.js +39 -32
- package/dist/lib/handlers/api/verifiable/proxy.js.map +1 -1
- package/dist/lib/handlers/api/verifiable/rest.js +23 -19
- package/dist/lib/handlers/api/verifiable/rest.js.map +1 -1
- package/dist/lib/handlers/api/verifiable/token.js +27 -23
- package/dist/lib/handlers/api/verifiable/token.js.map +1 -1
- package/dist/lib/handlers/api/webhook.js +13 -9
- package/dist/lib/handlers/api/webhook.js.map +1 -1
- package/dist/lib/handlers/index.js +18 -2
- package/dist/lib/handlers/index.js.map +1 -1
- package/dist/lib/handlers/ssr/index.js +18 -2
- package/dist/lib/handlers/ssr/index.js.map +1 -1
- package/dist/lib/handlers/ssr/protect.js +24 -17
- package/dist/lib/handlers/ssr/protect.js.map +1 -1
- package/dist/lib/handlers/ssr/wrap.js +10 -6
- package/dist/lib/handlers/ssr/wrap.js.map +1 -1
- package/dist/lib/index.js +23 -4
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/utils/billing.js +23 -18
- package/dist/lib/utils/billing.js.map +1 -1
- package/dist/lib/utils/crypto.js +25 -15
- package/dist/lib/utils/crypto.js.map +1 -1
- package/dist/lib/utils/firebase.js +29 -17
- package/dist/lib/utils/firebase.js.map +1 -1
- package/dist/lib/utils/headers.js +13 -6
- package/dist/lib/utils/headers.js.map +1 -1
- package/dist/lib/utils/index.js +24 -8
- package/dist/lib/utils/index.js.map +1 -1
- package/dist/lib/utils/session.js +64 -59
- package/dist/lib/utils/session.js.map +1 -1
- package/dist/lib/utils/shopify-api-js/oauth.js +23 -16
- package/dist/lib/utils/shopify-api-js/oauth.js.map +1 -1
- package/dist/lib/utils/shopify.js +37 -25
- package/dist/lib/utils/shopify.js.map +1 -1
- package/dist/lib/utils/token.js +15 -11
- package/dist/lib/utils/token.js.map +1 -1
- package/dist/plugins/index.js +18 -2
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/withShopify.js +83 -79
- package/dist/plugins/withShopify.js.map +1 -1
- package/dist/react/hooks/index.js +17 -1
- package/dist/react/hooks/index.js.map +1 -1
- package/dist/react/hooks/useVerification.d.ts +1 -1
- package/dist/react/hooks/useVerification.js +23 -7
- package/dist/react/hooks/useVerification.js.map +1 -1
- package/dist/react/index.js +18 -2
- package/dist/react/index.js.map +1 -1
- package/dist/runtime/index.js +17 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/shared/WebCrypto.d.ts +55 -0
- package/dist/shared/WebCrypto.d.ts.map +1 -0
- package/dist/shared/WebCrypto.js +342 -0
- package/dist/shared/WebCrypto.js.map +1 -0
- package/dist/shared/constants.js +15 -11
- package/dist/shared/constants.js.map +1 -1
- package/dist/shared/datetime.js +110 -83
- package/dist/shared/datetime.js.map +1 -1
- package/dist/shared/display.js +231 -151
- package/dist/shared/display.js.map +1 -1
- package/dist/shared/errors.js +12 -5
- package/dist/shared/errors.js.map +1 -1
- package/dist/shared/graph.js +14 -11
- package/dist/shared/graph.js.map +1 -1
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +32 -11
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/match.js +25 -17
- package/dist/shared/match.js.map +1 -1
- package/dist/shared/request.js +19 -13
- package/dist/shared/request.js.map +1 -1
- package/dist/shared/shopify.js +31 -21
- package/dist/shared/shopify.js.map +1 -1
- package/dist/shared/uuid.js +8 -3
- package/dist/shared/uuid.js.map +1 -1
- package/dist/shared/verification.d.ts +12 -5
- package/dist/shared/verification.d.ts.map +1 -1
- package/dist/shared/verification.js +34 -22
- package/dist/shared/verification.js.map +1 -1
- package/dist/umd/{verification.js → verification/index.js} +714 -352
- package/dist/umd/verification/index.js.map +1 -0
- package/dist/umd/{react → verification/react}/hooks/useVerification.d.ts +1 -1
- package/dist/umd/verification/shared/WebCrypto.d.ts +55 -0
- package/dist/umd/verification/shared/WebCrypto.d.ts.map +1 -0
- package/dist/umd/{shared → verification/shared}/index.d.ts +1 -1
- package/dist/umd/{shared → verification/shared}/index.d.ts.map +1 -1
- package/dist/umd/{shared → verification/shared}/verification.d.ts +12 -5
- package/dist/umd/{shared → verification/shared}/verification.d.ts.map +1 -1
- package/dist/umd/verification/{index.d.ts → verification/index.d.ts} +1 -0
- package/dist/umd/verification/{index.d.ts.map → verification/index.d.ts.map} +1 -1
- package/dist/umd/verification/{utils → verification/utils}/rawbody.d.ts.map +1 -1
- package/dist/umd/verification/verification/verification.d.ts +10 -0
- package/dist/umd/verification/{verification.d.ts.map → verification/verification.d.ts.map} +1 -1
- package/dist/verification/index.d.ts +1 -0
- package/dist/verification/index.d.ts.map +1 -1
- package/dist/verification/index.js +19 -2
- package/dist/verification/index.js.map +1 -1
- package/dist/verification/utils/errors.js +5 -1
- package/dist/verification/utils/errors.js.map +1 -1
- package/dist/verification/utils/index.js +18 -2
- package/dist/verification/utils/index.js.map +1 -1
- package/dist/verification/utils/rawbody.d.ts.map +1 -1
- package/dist/verification/utils/rawbody.js +39 -36
- package/dist/verification/utils/rawbody.js.map +1 -1
- package/dist/verification/verification.d.ts +3 -1
- package/dist/verification/verification.d.ts.map +1 -1
- package/dist/verification/verification.js +71 -61
- package/dist/verification/verification.js.map +1 -1
- package/node_modules/bytes/History.md +97 -0
- package/node_modules/bytes/LICENSE +23 -0
- package/node_modules/bytes/Readme.md +152 -0
- package/node_modules/bytes/index.js +170 -0
- package/node_modules/bytes/package.json +42 -0
- package/node_modules/depd/History.md +103 -0
- package/node_modules/depd/LICENSE +22 -0
- package/node_modules/depd/Readme.md +280 -0
- package/node_modules/depd/index.js +538 -0
- package/node_modules/depd/lib/browser/index.js +77 -0
- package/node_modules/depd/package.json +45 -0
- package/node_modules/http-errors/HISTORY.md +180 -0
- package/node_modules/http-errors/LICENSE +23 -0
- package/node_modules/http-errors/README.md +169 -0
- package/node_modules/http-errors/index.js +289 -0
- package/node_modules/http-errors/package.json +50 -0
- package/node_modules/iconv-lite/Changelog.md +162 -0
- package/node_modules/iconv-lite/LICENSE +21 -0
- package/node_modules/iconv-lite/README.md +156 -0
- package/node_modules/iconv-lite/encodings/dbcs-codec.js +555 -0
- package/node_modules/iconv-lite/encodings/dbcs-data.js +176 -0
- package/node_modules/iconv-lite/encodings/index.js +22 -0
- package/node_modules/iconv-lite/encodings/internal.js +188 -0
- package/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
- package/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
- package/node_modules/iconv-lite/encodings/sbcs-data.js +174 -0
- package/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
- package/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
- package/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
- package/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
- package/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
- package/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
- package/node_modules/iconv-lite/encodings/tables/gbk-added.json +55 -0
- package/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
- package/node_modules/iconv-lite/encodings/utf16.js +177 -0
- package/node_modules/iconv-lite/encodings/utf7.js +290 -0
- package/node_modules/iconv-lite/lib/bom-handling.js +52 -0
- package/node_modules/iconv-lite/lib/extend-node.js +217 -0
- package/node_modules/iconv-lite/lib/index.d.ts +24 -0
- package/node_modules/iconv-lite/lib/index.js +153 -0
- package/node_modules/iconv-lite/lib/streams.js +121 -0
- package/node_modules/iconv-lite/package.json +46 -0
- package/node_modules/inherits/LICENSE +16 -0
- package/node_modules/inherits/README.md +42 -0
- package/node_modules/inherits/inherits.js +9 -0
- package/node_modules/inherits/inherits_browser.js +27 -0
- package/node_modules/inherits/package.json +29 -0
- package/node_modules/raw-body/HISTORY.md +308 -0
- package/node_modules/raw-body/LICENSE +22 -0
- package/node_modules/raw-body/README.md +223 -0
- package/node_modules/raw-body/SECURITY.md +24 -0
- package/node_modules/raw-body/index.d.ts +87 -0
- package/node_modules/raw-body/index.js +336 -0
- package/node_modules/raw-body/package.json +49 -0
- package/node_modules/safer-buffer/LICENSE +21 -0
- package/node_modules/safer-buffer/Porting-Buffer.md +268 -0
- package/node_modules/safer-buffer/Readme.md +156 -0
- package/node_modules/safer-buffer/dangerous.js +58 -0
- package/node_modules/safer-buffer/package.json +34 -0
- package/node_modules/safer-buffer/safer.js +77 -0
- package/node_modules/safer-buffer/tests.js +406 -0
- package/node_modules/setprototypeof/LICENSE +13 -0
- package/node_modules/setprototypeof/README.md +31 -0
- package/node_modules/setprototypeof/index.d.ts +2 -0
- package/node_modules/setprototypeof/index.js +17 -0
- package/node_modules/setprototypeof/package.json +38 -0
- package/node_modules/setprototypeof/test/index.js +24 -0
- package/node_modules/statuses/HISTORY.md +82 -0
- package/node_modules/statuses/LICENSE +23 -0
- package/node_modules/statuses/README.md +136 -0
- package/node_modules/statuses/codes.json +65 -0
- package/node_modules/statuses/index.js +146 -0
- package/node_modules/statuses/package.json +49 -0
- package/node_modules/toidentifier/HISTORY.md +9 -0
- package/node_modules/toidentifier/LICENSE +21 -0
- package/node_modules/toidentifier/README.md +61 -0
- package/node_modules/toidentifier/index.js +32 -0
- package/node_modules/toidentifier/package.json +38 -0
- package/node_modules/unpipe/HISTORY.md +4 -0
- package/node_modules/unpipe/LICENSE +22 -0
- package/node_modules/unpipe/README.md +43 -0
- package/node_modules/unpipe/index.js +69 -0
- package/node_modules/unpipe/package.json +27 -0
- package/package.json +15 -14
- package/dist/shared/subtlecrypto.d.ts +0 -41
- package/dist/shared/subtlecrypto.d.ts.map +0 -1
- package/dist/shared/subtlecrypto.js +0 -256
- package/dist/shared/subtlecrypto.js.map +0 -1
- package/dist/umd/shared/subtlecrypto.d.ts +0 -41
- package/dist/umd/shared/subtlecrypto.d.ts.map +0 -1
- package/dist/umd/verification/verification.d.ts +0 -8
- package/dist/umd/verification.js.map +0 -1
- /package/dist/umd/{lib → verification/lib}/handlers/api/auth.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/auth.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/billing.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/billing.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/callback.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/callback.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/index.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/index.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/types.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/types.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/uninstall.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/uninstall.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/verifiable/appInstallation.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/verifiable/appInstallation.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/verifiable/graph.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/verifiable/graph.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/verifiable/index.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/verifiable/index.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/verifiable/proxy.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/verifiable/proxy.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/verifiable/rest.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/verifiable/rest.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/verifiable/token.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/verifiable/token.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/webhook.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/api/webhook.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/index.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/index.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/ssr/index.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/ssr/index.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/ssr/protect.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/ssr/protect.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/ssr/types.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/ssr/types.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/ssr/wrap.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/ssr/wrap.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/types.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/handlers/types.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/index.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/index.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/types.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/types.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/billing.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/billing.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/crypto.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/crypto.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/firebase.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/firebase.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/headers.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/headers.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/index.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/index.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/session.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/session.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/shopify-api-js/oauth.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/shopify-api-js/oauth.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/shopify.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/shopify.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/token.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/token.d.ts.map +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/types.d.ts +0 -0
- /package/dist/umd/{lib → verification/lib}/utils/types.d.ts.map +0 -0
- /package/dist/umd/{plugins → verification/plugins}/index.d.ts +0 -0
- /package/dist/umd/{plugins → verification/plugins}/index.d.ts.map +0 -0
- /package/dist/umd/{plugins → verification/plugins}/types.d.ts +0 -0
- /package/dist/umd/{plugins → verification/plugins}/types.d.ts.map +0 -0
- /package/dist/umd/{plugins → verification/plugins}/withShopify.d.ts +0 -0
- /package/dist/umd/{plugins → verification/plugins}/withShopify.d.ts.map +0 -0
- /package/dist/umd/{react → verification/react}/hooks/index.d.ts +0 -0
- /package/dist/umd/{react → verification/react}/hooks/index.d.ts.map +0 -0
- /package/dist/umd/{react → verification/react}/hooks/useVerification.d.ts.map +0 -0
- /package/dist/umd/{react → verification/react}/index.d.ts +0 -0
- /package/dist/umd/{react → verification/react}/index.d.ts.map +0 -0
- /package/dist/umd/{react → verification/react}/types.d.ts +0 -0
- /package/dist/umd/{react → verification/react}/types.d.ts.map +0 -0
- /package/dist/umd/{runtime → verification/runtime}/index.d.ts +0 -0
- /package/dist/umd/{runtime → verification/runtime}/index.d.ts.map +0 -0
- /package/dist/umd/{runtime → verification/runtime}/types.d.ts +0 -0
- /package/dist/umd/{runtime → verification/runtime}/types.d.ts.map +0 -0
- /package/dist/umd/{shared → verification/shared}/constants.d.ts +0 -0
- /package/dist/umd/{shared → verification/shared}/constants.d.ts.map +0 -0
- /package/dist/umd/{shared → verification/shared}/datetime.d.ts +0 -0
- /package/dist/umd/{shared → verification/shared}/datetime.d.ts.map +0 -0
- /package/dist/umd/{shared → verification/shared}/display.d.ts +0 -0
- /package/dist/umd/{shared → verification/shared}/display.d.ts.map +0 -0
- /package/dist/umd/{shared → verification/shared}/errors.d.ts +0 -0
- /package/dist/umd/{shared → verification/shared}/errors.d.ts.map +0 -0
- /package/dist/umd/{shared → verification/shared}/graph.d.ts +0 -0
- /package/dist/umd/{shared → verification/shared}/graph.d.ts.map +0 -0
- /package/dist/umd/{shared → verification/shared}/match.d.ts +0 -0
- /package/dist/umd/{shared → verification/shared}/match.d.ts.map +0 -0
- /package/dist/umd/{shared → verification/shared}/request.d.ts +0 -0
- /package/dist/umd/{shared → verification/shared}/request.d.ts.map +0 -0
- /package/dist/umd/{shared → verification/shared}/shopify.d.ts +0 -0
- /package/dist/umd/{shared → verification/shared}/shopify.d.ts.map +0 -0
- /package/dist/umd/{shared → verification/shared}/types.d.ts +0 -0
- /package/dist/umd/{shared → verification/shared}/types.d.ts.map +0 -0
- /package/dist/umd/{shared → verification/shared}/uuid.d.ts +0 -0
- /package/dist/umd/{shared → verification/shared}/uuid.d.ts.map +0 -0
- /package/dist/umd/verification/{types.d.ts → verification/types.d.ts} +0 -0
- /package/dist/umd/verification/{types.d.ts.map → verification/types.d.ts.map} +0 -0
- /package/dist/umd/verification/{utils → verification/utils}/errors.d.ts +0 -0
- /package/dist/umd/verification/{utils → verification/utils}/errors.d.ts.map +0 -0
- /package/dist/umd/verification/{utils → verification/utils}/index.d.ts +0 -0
- /package/dist/umd/verification/{utils → verification/utils}/index.d.ts.map +0 -0
- /package/dist/umd/verification/{utils → verification/utils}/rawbody.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,192 @@
|
|
|
1
|
+
# [1.15.0](https://github.com/agnostack/next-shopify/compare/v1.14.1...v1.15.0) (2023-12-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* bexploring adding @rollup/plugin-auto-install ([2c69837](https://github.com/agnostack/next-shopify/commit/2c698373bdfa0969a736f0a29f75e3d2e4074a09))
|
|
7
|
+
* bexploring adding @rollup/plugin-auto-install ([494609f](https://github.com/agnostack/next-shopify/commit/494609f0a4cff218a5fb4a0af26335e10490840f))
|
|
8
|
+
* bundled and cleaned some stuff ([376e767](https://github.com/agnostack/next-shopify/commit/376e7675565fba8912b3ef7145201484695f0426))
|
|
9
|
+
* bundled and cleaned some stuff ([b93b0ab](https://github.com/agnostack/next-shopify/commit/b93b0ab92f9fa2b8c3807e04bb9aabbb41dafeba))
|
|
10
|
+
* wip ([935a08b](https://github.com/agnostack/next-shopify/commit/935a08b2d51ba6c9c0c8f58cbc8bef5c8058a3cc))
|
|
11
|
+
* wip ([13fa469](https://github.com/agnostack/next-shopify/commit/13fa4698a0d16ce55822975db8fffed5c5f532ee))
|
|
12
|
+
* wip ([bf89fa0](https://github.com/agnostack/next-shopify/commit/bf89fa0483f6f4e4d7aba115b88015b115c40469))
|
|
13
|
+
* wip ([cb63ffb](https://github.com/agnostack/next-shopify/commit/cb63ffbe48f1cddbfd44b2ef9478f18bbb77efcb))
|
|
14
|
+
* wip ([5ec5a32](https://github.com/agnostack/next-shopify/commit/5ec5a32133b33fd03ffea47d8838d69cf97c63a3))
|
|
15
|
+
* wip ([f74a297](https://github.com/agnostack/next-shopify/commit/f74a297d0339e301cf388fff707953ae4375a5bc))
|
|
16
|
+
* wip ([c549241](https://github.com/agnostack/next-shopify/commit/c54924137d9ed48dfd1ae669bee56cea3c538463))
|
|
17
|
+
* wip ([b66479e](https://github.com/agnostack/next-shopify/commit/b66479efd9d31349c02384ae0220a99a1730b5ee))
|
|
18
|
+
* wip ([791a349](https://github.com/agnostack/next-shopify/commit/791a34942430f9ee44c31277f24537dc62ad182e))
|
|
19
|
+
* wip ([3909ac9](https://github.com/agnostack/next-shopify/commit/3909ac901df8adf3150509603f03c3a17a49c176))
|
|
20
|
+
* wip ([8d7f35b](https://github.com/agnostack/next-shopify/commit/8d7f35b4229defcfca7e42380d0b2d4761fbe29f))
|
|
21
|
+
* wip ([798a126](https://github.com/agnostack/next-shopify/commit/798a12693e4ed5a5e59f6ae2f39fb877f7996940))
|
|
22
|
+
* wip ([743cc75](https://github.com/agnostack/next-shopify/commit/743cc75006df98b64047d3bca774ea9360ca9688))
|
|
23
|
+
* wip ([6a6015d](https://github.com/agnostack/next-shopify/commit/6a6015d80186c32c651a2f5fe919a5bab095a5ed))
|
|
24
|
+
* wip ([1343a5c](https://github.com/agnostack/next-shopify/commit/1343a5c91e53b9cb228376281fe74b711c70b76b))
|
|
25
|
+
* wip ([d64b8b6](https://github.com/agnostack/next-shopify/commit/d64b8b67f27fe85737fbe3d91a9fcda4b2f5dd2c))
|
|
26
|
+
* wip ([7fdab0b](https://github.com/agnostack/next-shopify/commit/7fdab0bf556c2a42cfd02c300070bec28e64e6ff))
|
|
27
|
+
* wip ([184b9a3](https://github.com/agnostack/next-shopify/commit/184b9a34cf9aec415dd68405b90d29dd397631f4))
|
|
28
|
+
* wip ([eaf5173](https://github.com/agnostack/next-shopify/commit/eaf51735dc8434a3eb6ec3b259bbecbe527d2f5e))
|
|
29
|
+
* wip ([fcef3ef](https://github.com/agnostack/next-shopify/commit/fcef3ef05eb908e316481de551b8bdec4f781c70))
|
|
30
|
+
* wip ([ed66c80](https://github.com/agnostack/next-shopify/commit/ed66c801b2784cb79d260f3c02c86aa8cfb5b839))
|
|
31
|
+
* wip ([7364d71](https://github.com/agnostack/next-shopify/commit/7364d71f5034a22dba5599039c3eeb5781928e7d))
|
|
32
|
+
* wip ([43d0735](https://github.com/agnostack/next-shopify/commit/43d0735ac2e13938b2ec70b2681c0e0f24d5311f))
|
|
33
|
+
* wip ([df1d6b5](https://github.com/agnostack/next-shopify/commit/df1d6b54e0c20af22aefbd7706d81af288531402))
|
|
34
|
+
* wip ([298d01a](https://github.com/agnostack/next-shopify/commit/298d01a56eb38a90783c2fd0350b49d75822c884))
|
|
35
|
+
* wip ([5ede53a](https://github.com/agnostack/next-shopify/commit/5ede53ac1efe79eed1ee1a68d05e1bf7dd725cfa))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Features
|
|
39
|
+
|
|
40
|
+
* added 'plugins' export for next-config ([e550e3f](https://github.com/agnostack/next-shopify/commit/e550e3f8b9a1fba2a232760cf1ca6bb946b66494))
|
|
41
|
+
* added back bundle for monads ([99f8aa2](https://github.com/agnostack/next-shopify/commit/99f8aa25add4f7d1e7e364e9a6c33bd524ef3140))
|
|
42
|
+
* added rollup ([3745a20](https://github.com/agnostack/next-shopify/commit/3745a2085199583b002627c12564a3d79705691c))
|
|
43
|
+
* removed dep on raw-body ([761931c](https://github.com/agnostack/next-shopify/commit/761931c0c76be995d7217f96874ab7eaf642a659))
|
|
44
|
+
|
|
45
|
+
# [1.15.0-beta.29](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.28...v1.15.0-beta.29) (2023-12-09)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Bug Fixes
|
|
49
|
+
|
|
50
|
+
* wip ([935a08b](https://github.com/agnostack/next-shopify/commit/935a08b2d51ba6c9c0c8f58cbc8bef5c8058a3cc))
|
|
51
|
+
|
|
52
|
+
# [1.15.0-beta.28](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.27...v1.15.0-beta.28) (2023-12-09)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Bug Fixes
|
|
56
|
+
|
|
57
|
+
* wip ([13fa469](https://github.com/agnostack/next-shopify/commit/13fa4698a0d16ce55822975db8fffed5c5f532ee))
|
|
58
|
+
|
|
59
|
+
# [1.15.0-beta.27](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.26...v1.15.0-beta.27) (2023-12-09)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Bug Fixes
|
|
63
|
+
|
|
64
|
+
* wip ([bf89fa0](https://github.com/agnostack/next-shopify/commit/bf89fa0483f6f4e4d7aba115b88015b115c40469))
|
|
65
|
+
|
|
66
|
+
# [1.15.0-beta.26](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.25...v1.15.0-beta.26) (2023-12-09)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### Bug Fixes
|
|
70
|
+
|
|
71
|
+
* wip ([cb63ffb](https://github.com/agnostack/next-shopify/commit/cb63ffbe48f1cddbfd44b2ef9478f18bbb77efcb))
|
|
72
|
+
|
|
73
|
+
# [1.15.0-beta.25](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.24...v1.15.0-beta.25) (2023-12-09)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Bug Fixes
|
|
77
|
+
|
|
78
|
+
* wip ([5ec5a32](https://github.com/agnostack/next-shopify/commit/5ec5a32133b33fd03ffea47d8838d69cf97c63a3))
|
|
79
|
+
|
|
80
|
+
# [1.15.0-beta.24](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.23...v1.15.0-beta.24) (2023-12-09)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### Bug Fixes
|
|
84
|
+
|
|
85
|
+
* wip ([f74a297](https://github.com/agnostack/next-shopify/commit/f74a297d0339e301cf388fff707953ae4375a5bc))
|
|
86
|
+
|
|
87
|
+
# [1.15.0-beta.23](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.22...v1.15.0-beta.23) (2023-12-09)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
### Bug Fixes
|
|
91
|
+
|
|
92
|
+
* wip ([c549241](https://github.com/agnostack/next-shopify/commit/c54924137d9ed48dfd1ae669bee56cea3c538463))
|
|
93
|
+
* wip ([b66479e](https://github.com/agnostack/next-shopify/commit/b66479efd9d31349c02384ae0220a99a1730b5ee))
|
|
94
|
+
* wip ([791a349](https://github.com/agnostack/next-shopify/commit/791a34942430f9ee44c31277f24537dc62ad182e))
|
|
95
|
+
|
|
96
|
+
# [1.15.0-beta.22](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.21...v1.15.0-beta.22) (2023-12-08)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
### Bug Fixes
|
|
100
|
+
|
|
101
|
+
* wip ([3909ac9](https://github.com/agnostack/next-shopify/commit/3909ac901df8adf3150509603f03c3a17a49c176))
|
|
102
|
+
|
|
103
|
+
# [1.15.0-beta.21](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.20...v1.15.0-beta.21) (2023-12-08)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
### Bug Fixes
|
|
107
|
+
|
|
108
|
+
* wip ([8d7f35b](https://github.com/agnostack/next-shopify/commit/8d7f35b4229defcfca7e42380d0b2d4761fbe29f))
|
|
109
|
+
|
|
110
|
+
# [1.15.0-beta.20](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.19...v1.15.0-beta.20) (2023-12-08)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
### Bug Fixes
|
|
114
|
+
|
|
115
|
+
* wip ([798a126](https://github.com/agnostack/next-shopify/commit/798a12693e4ed5a5e59f6ae2f39fb877f7996940))
|
|
116
|
+
* wip ([743cc75](https://github.com/agnostack/next-shopify/commit/743cc75006df98b64047d3bca774ea9360ca9688))
|
|
117
|
+
|
|
118
|
+
# [1.15.0-beta.19](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.18...v1.15.0-beta.19) (2023-12-08)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
### Bug Fixes
|
|
122
|
+
|
|
123
|
+
* wip ([6a6015d](https://github.com/agnostack/next-shopify/commit/6a6015d80186c32c651a2f5fe919a5bab095a5ed))
|
|
124
|
+
|
|
125
|
+
# [1.15.0-beta.18](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.17...v1.15.0-beta.18) (2023-12-08)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
### Bug Fixes
|
|
129
|
+
|
|
130
|
+
* wip ([1343a5c](https://github.com/agnostack/next-shopify/commit/1343a5c91e53b9cb228376281fe74b711c70b76b))
|
|
131
|
+
|
|
132
|
+
# [1.15.0-beta.17](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.16...v1.15.0-beta.17) (2023-12-08)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
### Bug Fixes
|
|
136
|
+
|
|
137
|
+
* wip ([d64b8b6](https://github.com/agnostack/next-shopify/commit/d64b8b67f27fe85737fbe3d91a9fcda4b2f5dd2c))
|
|
138
|
+
* wip ([7fdab0b](https://github.com/agnostack/next-shopify/commit/7fdab0bf556c2a42cfd02c300070bec28e64e6ff))
|
|
139
|
+
* wip ([184b9a3](https://github.com/agnostack/next-shopify/commit/184b9a34cf9aec415dd68405b90d29dd397631f4))
|
|
140
|
+
|
|
141
|
+
# [1.15.0-beta.16](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.15...v1.15.0-beta.16) (2023-12-08)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
### Bug Fixes
|
|
145
|
+
|
|
146
|
+
* wip ([eaf5173](https://github.com/agnostack/next-shopify/commit/eaf51735dc8434a3eb6ec3b259bbecbe527d2f5e))
|
|
147
|
+
|
|
148
|
+
# [1.15.0-beta.15](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.14...v1.15.0-beta.15) (2023-12-08)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
### Bug Fixes
|
|
152
|
+
|
|
153
|
+
* wip ([fcef3ef](https://github.com/agnostack/next-shopify/commit/fcef3ef05eb908e316481de551b8bdec4f781c70))
|
|
154
|
+
|
|
155
|
+
# [1.15.0-beta.14](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.13...v1.15.0-beta.14) (2023-12-08)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
### Bug Fixes
|
|
159
|
+
|
|
160
|
+
* wip ([ed66c80](https://github.com/agnostack/next-shopify/commit/ed66c801b2784cb79d260f3c02c86aa8cfb5b839))
|
|
161
|
+
|
|
162
|
+
# [1.15.0-beta.13](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.12...v1.15.0-beta.13) (2023-12-08)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
### Bug Fixes
|
|
166
|
+
|
|
167
|
+
* wip ([7364d71](https://github.com/agnostack/next-shopify/commit/7364d71f5034a22dba5599039c3eeb5781928e7d))
|
|
168
|
+
|
|
169
|
+
# [1.15.0-beta.12](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.11...v1.15.0-beta.12) (2023-12-08)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
### Bug Fixes
|
|
173
|
+
|
|
174
|
+
* wip ([43d0735](https://github.com/agnostack/next-shopify/commit/43d0735ac2e13938b2ec70b2681c0e0f24d5311f))
|
|
175
|
+
|
|
176
|
+
# [1.15.0-beta.11](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.10...v1.15.0-beta.11) (2023-12-08)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
### Bug Fixes
|
|
180
|
+
|
|
181
|
+
* wip ([df1d6b5](https://github.com/agnostack/next-shopify/commit/df1d6b54e0c20af22aefbd7706d81af288531402))
|
|
182
|
+
|
|
183
|
+
# [1.15.0-beta.10](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.9...v1.15.0-beta.10) (2023-12-08)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
### Bug Fixes
|
|
187
|
+
|
|
188
|
+
* wip ([298d01a](https://github.com/agnostack/next-shopify/commit/298d01a56eb38a90783c2fd0350b49d75822c884))
|
|
189
|
+
|
|
1
190
|
# [1.15.0-beta.9](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.8...v1.15.0-beta.9) (2023-12-08)
|
|
2
191
|
|
|
3
192
|
|
package/README.md
CHANGED
|
@@ -11,11 +11,11 @@ yarn add @agnostack/next-shopify
|
|
|
11
11
|
|
|
12
12
|
Inside of `next.config.js`, add the following:
|
|
13
13
|
```js
|
|
14
|
-
const {
|
|
14
|
+
const { withShopify } = require('@agnostack/next-shopify')
|
|
15
15
|
|
|
16
16
|
const manifestTemplate = require('./manifestTemplate.json')
|
|
17
17
|
|
|
18
|
-
const nextConfig =
|
|
18
|
+
const nextConfig = withShopify({
|
|
19
19
|
zendesk: { manifestTemplate },
|
|
20
20
|
})
|
|
21
21
|
|
|
@@ -24,11 +24,11 @@ const nextConfig = withZendeskCLI({
|
|
|
24
24
|
Also, create an api route (`pages/api/apps.js`) containing the following:
|
|
25
25
|
```js
|
|
26
26
|
import getConfig from 'next/config'
|
|
27
|
-
import {
|
|
27
|
+
import { withShopify } from '@agnostack/next-shopify'
|
|
28
28
|
|
|
29
29
|
const { serverRuntimeConfig } = getConfig() ?? {}
|
|
30
30
|
|
|
31
|
-
export default
|
|
31
|
+
export default withShopify(serverRuntimeConfig)
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
|
|
@@ -36,12 +36,13 @@ export default zendeskCLIHandler(serverRuntimeConfig)
|
|
|
36
36
|
|
|
37
37
|
Inside of `next.config.js`, add the following:
|
|
38
38
|
```js
|
|
39
|
-
const { withPlugins
|
|
39
|
+
const { withPlugins } = require('@agnostack/next-plugins')
|
|
40
|
+
const { withShopify } = require('@agnostack/next-shopify')
|
|
40
41
|
|
|
41
42
|
const manifest = require('./manifest.json')
|
|
42
43
|
|
|
43
44
|
const nextPlugins = [{
|
|
44
|
-
[
|
|
45
|
+
[withShopify]: {
|
|
45
46
|
manifestTemplate: manifest,
|
|
46
47
|
/* NOTE: add optionale below
|
|
47
48
|
apiRoute: '/api/my-custom-api-json-route', // (defaults to /api/apps)
|
|
@@ -81,11 +82,11 @@ const nextConfig = withPlugins({
|
|
|
81
82
|
Also, create an api route (`pages/api/apps.js`) containing the following:
|
|
82
83
|
```js
|
|
83
84
|
import getConfig from 'next/config'
|
|
84
|
-
import {
|
|
85
|
+
import { withShopify } from '@agnostack/next-shopify'
|
|
85
86
|
|
|
86
87
|
const { publicRuntimeConfig } = getConfig() ?? {}
|
|
87
88
|
|
|
88
|
-
export default
|
|
89
|
+
export default withShopify(publicRuntimeConfig)
|
|
89
90
|
```
|
|
90
91
|
|
|
91
92
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -18,30 +19,32 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
18
19
|
}
|
|
19
20
|
return t;
|
|
20
21
|
};
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.handleAuth = void 0;
|
|
24
|
+
const utils_1 = require("../../utils");
|
|
25
|
+
const shared_1 = require("../../../shared");
|
|
23
26
|
// NOTE: typically handling: "/api/auth/online" and "/api/auth/offline"
|
|
24
|
-
|
|
27
|
+
const handleAuth = (serverRuntimeConfig) => (req, res, params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
28
|
var _a;
|
|
26
29
|
const { PAGE_PATHS, API_PATHS, API_URLS, APP_CONFIG, } = serverRuntimeConfig;
|
|
27
30
|
const { isOnline } = params !== null && params !== void 0 ? params : {};
|
|
28
31
|
const _b = (_a = req.query) !== null && _a !== void 0 ? _a : {}, { reAuth: _reAuth } = _b, query = __rest(_b, ["reAuth"]);
|
|
29
32
|
const { embedded, state, host, shop: _shop } = query;
|
|
30
|
-
const reAuth = isTrue(_reAuth, 'undefined');
|
|
31
|
-
const shopify = getInitializedShopify(serverRuntimeConfig);
|
|
33
|
+
const reAuth = (0, shared_1.isTrue)(_reAuth, 'undefined');
|
|
34
|
+
const shopify = (0, utils_1.getInitializedShopify)(serverRuntimeConfig);
|
|
32
35
|
const shop = shopify.utils.sanitizeShop(_shop);
|
|
33
|
-
if (stringEmpty(shop)) {
|
|
34
|
-
return res.redirect(`${PAGE_PATHS[PAGE_ROUTE_NAMES.ERROR]}?code=no_shop_provided&type=handleAuth`);
|
|
36
|
+
if ((0, shared_1.stringEmpty)(shop)) {
|
|
37
|
+
return res.redirect(`${PAGE_PATHS[shared_1.PAGE_ROUTE_NAMES.ERROR]}?code=no_shop_provided&type=handleAuth`);
|
|
35
38
|
}
|
|
36
39
|
if (embedded === '1') {
|
|
37
|
-
const callbackUrl = getCallback(API_URLS, { reAuth, isOnline });
|
|
40
|
+
const callbackUrl = (0, utils_1.getCallback)(API_URLS, { reAuth, isOnline });
|
|
38
41
|
// TODO: explore objectToQuerystring
|
|
39
42
|
const redirectUriParams = new URLSearchParams({ shop, host, state }).toString();
|
|
40
43
|
const queryParams = new URLSearchParams(Object.assign(Object.assign({}, query), { shop, redirectUri: `${callbackUrl}?${redirectUriParams}` })).toString();
|
|
41
|
-
return res.redirect(`${PAGE_PATHS[PAGE_ROUTE_NAMES.EXIT]}?${queryParams}`);
|
|
44
|
+
return res.redirect(`${PAGE_PATHS[shared_1.PAGE_ROUTE_NAMES.EXIT]}?${queryParams}`);
|
|
42
45
|
}
|
|
43
|
-
const callbackPath = getCallback(API_PATHS, { reAuth, isOnline });
|
|
44
|
-
return beginAuth({
|
|
46
|
+
const callbackPath = (0, utils_1.getCallback)(API_PATHS, { reAuth, isOnline });
|
|
47
|
+
return (0, utils_1.beginAuth)({
|
|
45
48
|
shop,
|
|
46
49
|
state,
|
|
47
50
|
isOnline,
|
|
@@ -51,4 +54,5 @@ export const handleAuth = (serverRuntimeConfig) => (req, res, params) => __await
|
|
|
51
54
|
config: APP_CONFIG,
|
|
52
55
|
});
|
|
53
56
|
});
|
|
57
|
+
exports.handleAuth = handleAuth;
|
|
54
58
|
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/lib/handlers/api/auth.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/lib/handlers/api/auth.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAIoB;AACpB,4CAIwB;AAExB,wEAAwE;AACjE,MAAM,UAAU,GAAG,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAO,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE;;IAC5E,MAAM,EACJ,UAAU,EACV,SAAS,EACT,QAAQ,EACR,UAAU,GACX,GAAG,mBAAmB,CAAA;IACvB,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAA;IACjC,MAAM,KAAgC,MAAA,GAAG,CAAC,KAAK,mCAAI,EAAE,EAA/C,EAAE,MAAM,EAAE,OAAO,OAA8B,EAAzB,KAAK,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;QACf,WAAW,EAAE,GAAG;QAChB,MAAM,EAAE,UAAU;KACnB,CAAC,CAAA;AACJ,CAAC,CAAA,CAAA;AA3CY,QAAA,UAAU,cA2CtB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -18,25 +19,27 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
18
19
|
}
|
|
19
20
|
return t;
|
|
20
21
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.handleAppBilling = void 0;
|
|
24
|
+
const utils_1 = require("../../utils");
|
|
25
|
+
const verification_1 = require("../../../verification");
|
|
26
|
+
const shared_1 = require("../../../shared");
|
|
24
27
|
const TERMINAL_STATUSES = [
|
|
25
28
|
'EXPIRED',
|
|
26
29
|
'DECLINED',
|
|
27
30
|
'CANCELLED'
|
|
28
31
|
];
|
|
29
32
|
// NOTE: typically handling: "/api/webhooks/app/billing"
|
|
30
|
-
|
|
33
|
+
const handleAppBilling = (serverRuntimeConfig) => (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
34
|
var _a;
|
|
32
35
|
try {
|
|
33
36
|
const { 'x-shop-domain': shopDomain, 'x-shopify-shop-domain': shopifyShopDomain, 'x-shopify-shop': shop = shopifyShopDomain !== null && shopifyShopDomain !== void 0 ? shopifyShopDomain : shopDomain, } = (_a = req.headers) !== null && _a !== void 0 ? _a : {};
|
|
34
|
-
if (stringEmpty(shop)) {
|
|
37
|
+
if ((0, shared_1.stringEmpty)(shop)) {
|
|
35
38
|
return res.status(200).json({ handler: 'billing', error: 'Missing shop' });
|
|
36
39
|
}
|
|
37
|
-
const { shopify, loadSession, updateSession, getVerifiedClients } = yield getShopifyHelpers(serverRuntimeConfig, { shop });
|
|
40
|
+
const { shopify, loadSession, updateSession, getVerifiedClients } = yield (0, utils_1.getShopifyHelpers)(serverRuntimeConfig, { shop });
|
|
38
41
|
// TODO: explore getVerificationHelpers?
|
|
39
|
-
const rawBody = yield ensureRawBody(req);
|
|
42
|
+
const rawBody = yield (0, verification_1.ensureRawBody)(req);
|
|
40
43
|
const _b = yield shopify.webhooks.validate({
|
|
41
44
|
rawBody,
|
|
42
45
|
rawRequest: req,
|
|
@@ -45,8 +48,8 @@ export const handleAppBilling = (serverRuntimeConfig) => (req, res) => __awaiter
|
|
|
45
48
|
if (valid) {
|
|
46
49
|
try {
|
|
47
50
|
let message = 'ignored';
|
|
48
|
-
const [eventType, { status } = {}] = Object.entries(safeParse(rawBody || '{}'))[0];
|
|
49
|
-
if ((eventType === BILLING_EVENT_TYPES.SUBSCRIPTION) && TERMINAL_STATUSES.includes(status)) {
|
|
51
|
+
const [eventType, { status } = {}] = Object.entries((0, shared_1.safeParse)(rawBody || '{}'))[0];
|
|
52
|
+
if ((eventType === shared_1.BILLING_EVENT_TYPES.SUBSCRIPTION) && TERMINAL_STATUSES.includes(status)) {
|
|
50
53
|
const { Rest } = yield getVerifiedClients();
|
|
51
54
|
// NOTE: this deletes the app in the case of subscription apps in a "terminal" state to cover the info in ShopifyApi docs for billing:
|
|
52
55
|
// "Note: the merchant may refuse payment when prompted or cancel subscriptions later on, but the app will already be installed at that point. We recommend using billing webhooks to revoke access for merchants when they cancel / decline payment."
|
|
@@ -74,4 +77,5 @@ export const handleAppBilling = (serverRuntimeConfig) => (req, res) => __awaiter
|
|
|
74
77
|
return res.status(200).json({ handler: 'billing', error: 'Error handling billing' });
|
|
75
78
|
}
|
|
76
79
|
});
|
|
80
|
+
exports.handleAppBilling = handleAppBilling;
|
|
77
81
|
//# sourceMappingURL=billing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../../../src/lib/handlers/api/billing.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../../../src/lib/handlers/api/billing.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA+C;AAC/C,wDAAqD;AACrD,4CAIwB;AAExB,MAAM,iBAAiB,GAAG;IACxB,SAAS;IACT,UAAU;IACV,WAAW;CACZ,CAAA;AAED,wDAAwD;AACjD,MAAM,gBAAgB,GAAG,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAO,GAAG,EAAE,GAAG,EAAE,EAAE;;IAC1E,IAAI;QACF,MAAM,EACJ,eAAe,EAAE,UAAU,EAC3B,uBAAuB,EAAE,iBAAiB,EAC1C,gBAAgB,EAAE,IAAI,GAAG,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,GAAI,UAAU,GACzD,GAAG,MAAA,GAAG,CAAC,OAAO,mCAAI,EAAE,CAAA;QAErB,IAAI,IAAA,oBAAW,EAAC,IAAI,CAAC,EAAE;YACrB,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAA;SAC3E;QAED,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,GAAG,MAAM,IAAA,yBAAiB,EAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;QAE1H,wCAAwC;QACxC,MAAM,OAAO,GAAG,MAAM,IAAA,4BAAa,EAAC,GAAG,CAAC,CAAA;QACxC,MAAM,KAA6B,MAAM,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;YACjE,OAAO;YACP,UAAU,EAAE,GAAG;YACf,WAAW,EAAE,GAAG;SACjB,CAAC,EAJI,EAAE,KAAK,OAIX,EAJgB,YAAY,cAAxB,SAA0B,CAI9B,CAAA;QAEF,IAAI,K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AE,YAAY,CAAC,CAAA;QAChE,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,oCAAoC,EAAE,CAAC,CAAA;KACjG;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAA;QAC9C,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,wBAAwB,EAAE,CAAC,CAAA;KACrF;AACH,CAAC,CAAA,CAAA;AAzDY,QAAA,gBAAgB,oBAyD5B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -18,39 +19,41 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
18
19
|
}
|
|
19
20
|
return t;
|
|
20
21
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.handleCallback = void 0;
|
|
24
|
+
const shopify_api_1 = require("@shopify/shopify-api");
|
|
25
|
+
const utils_1 = require("../../utils");
|
|
26
|
+
const shared_1 = require("../../../shared");
|
|
24
27
|
/* NOTE: typically handling:
|
|
25
28
|
* "/api/auth/online/callback"
|
|
26
29
|
* "/api/auth/offline/callback"
|
|
27
30
|
* "/api/auth/online/callback/reauth"
|
|
28
31
|
* "/api/auth/offline/callback/reauth"
|
|
29
32
|
*/
|
|
30
|
-
|
|
33
|
+
const handleCallback = (serverRuntimeConfig) => (req, res, params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
34
|
var _a, _b;
|
|
32
35
|
const _c = serverRuntimeConfig, { API_PATHS, PAGE_PATHS, PAYMENT_CONFIG } = _c, _d = _c.APP_WEBHOOKS, _e = _d === void 0 ? {} : _d,
|
|
33
36
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
34
|
-
_f = API_WEBHOOK_TOPICS.APP_UNINSTALLED,
|
|
37
|
+
_f = shared_1.API_WEBHOOK_TOPICS.APP_UNINSTALLED,
|
|
35
38
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
36
39
|
_uninstalledWebhook = _e[_f], webhooks = __rest(_e, [typeof _f === "symbol" ? _f : _f + ""]);
|
|
37
|
-
const errorPath = PAGE_PATHS[PAGE_ROUTE_NAMES.ERROR];
|
|
40
|
+
const errorPath = PAGE_PATHS[shared_1.PAGE_ROUTE_NAMES.ERROR];
|
|
38
41
|
const { isOnline, reAuth } = params !== null && params !== void 0 ? params : {};
|
|
39
42
|
const { shop, host, state } = (_a = req.query) !== null && _a !== void 0 ? _a : {};
|
|
40
43
|
const authPayload = { rawRequest: req, rawResponse: res };
|
|
41
|
-
if (stringEmpty(shop) || stringEmpty(host)) {
|
|
44
|
+
if ((0, shared_1.stringEmpty)(shop) || (0, shared_1.stringEmpty)(host)) {
|
|
42
45
|
// HMMM: why is this a 303 (rather than a 302 or or anything)??
|
|
43
|
-
return res.redirect(303, `${errorPath}?code=${ERROR_CODES.INVALID_CALLBACK}`);
|
|
46
|
+
return res.redirect(303, `${errorPath}?code=${shared_1.ERROR_CODES.INVALID_CALLBACK}`);
|
|
44
47
|
}
|
|
45
48
|
let redirectUrl = `${errorPath}?code=invalid_callback_response`;
|
|
46
49
|
let shopify;
|
|
47
50
|
try {
|
|
48
|
-
const { shopify: _shopify, loadAppData, storeSession: encryptStoreSession, ensureBilling: handleEnsureBilling, } = yield getShopifyHelpers(serverRuntimeConfig, { shop });
|
|
51
|
+
const { shopify: _shopify, loadAppData, storeSession: encryptStoreSession, ensureBilling: handleEnsureBilling, } = yield (0, utils_1.getShopifyHelpers)(serverRuntimeConfig, { shop });
|
|
49
52
|
shopify = _shopify;
|
|
50
53
|
const { session: _session } = yield shopify.auth.callback(authPayload);
|
|
51
54
|
const session = _session.toObject();
|
|
52
|
-
const shouldProcessOfflineAuth = (isOnline && objectNotEmpty(webhooks) && API_PATHS[API_ROUTE_NAMES.AUTH_OFFLINE]);
|
|
53
|
-
const shouldRegisterWebhooks = (!isTrue(session === null || session === void 0 ? void 0 : session.isOnline) || !API_PATHS[API_ROUTE_NAMES.AUTH_OFFLINE]);
|
|
55
|
+
const shouldProcessOfflineAuth = (isOnline && (0, shared_1.objectNotEmpty)(webhooks) && API_PATHS[shared_1.API_ROUTE_NAMES.AUTH_OFFLINE]);
|
|
56
|
+
const shouldRegisterWebhooks = (!(0, shared_1.isTrue)(session === null || session === void 0 ? void 0 : session.isOnline) || !API_PATHS[shared_1.API_ROUTE_NAMES.AUTH_OFFLINE]);
|
|
54
57
|
const shouldCheckBilling = PAYMENT_CONFIG === null || PAYMENT_CONFIG === void 0 ? void 0 : PAYMENT_CONFIG.required;
|
|
55
58
|
// NOTE: handleEnsureBilling below handles calling encryptStoreSession for offline session when shouldCheckBilling
|
|
56
59
|
if (isOnline || !shouldCheckBilling) {
|
|
@@ -60,36 +63,36 @@ export const handleCallback = (serverRuntimeConfig) => (req, res, params) => __a
|
|
|
60
63
|
if (shouldProcessOfflineAuth) {
|
|
61
64
|
// TODO: explore objectToQuerystring
|
|
62
65
|
const queryParams = new URLSearchParams({ host, shop, state, reAuth, isOnline: false }).toString();
|
|
63
|
-
return res.redirect(302, `${API_PATHS[API_ROUTE_NAMES.AUTH_OFFLINE]}?${queryParams}`);
|
|
66
|
+
return res.redirect(302, `${API_PATHS[shared_1.API_ROUTE_NAMES.AUTH_OFFLINE]}?${queryParams}`);
|
|
64
67
|
}
|
|
65
68
|
if (shouldRegisterWebhooks) {
|
|
66
69
|
let appId;
|
|
67
70
|
try {
|
|
68
71
|
const { appInfo } = yield loadAppData();
|
|
69
|
-
appId = normalizeShopifyId(appInfo === null || appInfo === void 0 ? void 0 : appInfo.id).id;
|
|
72
|
+
appId = (0, shared_1.normalizeShopifyId)(appInfo === null || appInfo === void 0 ? void 0 : appInfo.id).id;
|
|
70
73
|
// eslint-disable-next-line no-empty
|
|
71
74
|
}
|
|
72
75
|
catch (_ignore) {
|
|
73
76
|
console.info('Ignoring error loading appData', _ignore);
|
|
74
77
|
}
|
|
75
|
-
const webhookHandlers = prepareWebhookHandlers(serverRuntimeConfig, { appId });
|
|
78
|
+
const webhookHandlers = (0, utils_1.prepareWebhookHandlers)(serverRuntimeConfig, { appId });
|
|
76
79
|
shopify.webhooks.addHandlers(webhookHandlers);
|
|
77
80
|
// NOTE: webhooks cannot use an online session to make API calls to Shopify (but not all webooks may be doing that for all apps)
|
|
78
81
|
yield shopify.webhooks.register({ session });
|
|
79
82
|
}
|
|
80
83
|
const embeddedAppUrl = yield shopify.auth.getEmbeddedAppUrl(authPayload);
|
|
81
84
|
// NOTE this is the final/successful return URL
|
|
82
|
-
redirectUrl = `${embeddedAppUrl}${ensureLeadingSlash(PAGE_PATHS[PAGE_ROUTE_NAMES.SUCCESS])}`;
|
|
85
|
+
redirectUrl = `${embeddedAppUrl}${(0, shared_1.ensureLeadingSlash)(PAGE_PATHS[shared_1.PAGE_ROUTE_NAMES.SUCCESS])}`;
|
|
83
86
|
if (shouldCheckBilling) {
|
|
84
87
|
// NOTE: handleEnsureBilling handles calling encryptStoreSession for offline session when shouldCheckBilling
|
|
85
88
|
const confirmationUrl = yield handleEnsureBilling(session, reAuth);
|
|
86
|
-
if (stringNotEmpty(confirmationUrl)) {
|
|
89
|
+
if ((0, shared_1.stringNotEmpty)(confirmationUrl)) {
|
|
87
90
|
redirectUrl = confirmationUrl;
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
93
|
// NOTE confirm that state can be appended to the confirmationUrl,
|
|
91
94
|
// otherwise we can append to the redirectUrl above the billing check
|
|
92
|
-
redirectUrl = appendQuery(redirectUrl, new URLSearchParams({ state }).toString());
|
|
95
|
+
redirectUrl = (0, shared_1.appendQuery)(redirectUrl, new URLSearchParams({ state }).toString());
|
|
93
96
|
}
|
|
94
97
|
catch (error) {
|
|
95
98
|
console.error('Error handling callback route', error);
|
|
@@ -98,8 +101,8 @@ export const handleCallback = (serverRuntimeConfig) => (req, res, params) => __a
|
|
|
98
101
|
if (shopify) {
|
|
99
102
|
try {
|
|
100
103
|
const embeddedAppUrl = yield shopify.auth.getEmbeddedAppUrl(authPayload);
|
|
101
|
-
if (stringNotEmpty(embeddedAppUrl)) {
|
|
102
|
-
baseErrorUrl = `${embeddedAppUrl}${ensureLeadingSlash(errorPath)}`;
|
|
104
|
+
if ((0, shared_1.stringNotEmpty)(embeddedAppUrl)) {
|
|
105
|
+
baseErrorUrl = `${embeddedAppUrl}${(0, shared_1.ensureLeadingSlash)(errorPath)}`;
|
|
103
106
|
}
|
|
104
107
|
// eslint-disable-next-line no-empty
|
|
105
108
|
}
|
|
@@ -107,52 +110,53 @@ export const handleCallback = (serverRuntimeConfig) => (req, res, params) => __a
|
|
|
107
110
|
}
|
|
108
111
|
switch (true) {
|
|
109
112
|
// TODO implement a custom SessionNotFound error
|
|
110
|
-
case error instanceof InvalidHmacError: {
|
|
113
|
+
case error instanceof shopify_api_1.InvalidHmacError: {
|
|
111
114
|
console.warn(`${errorMessage}. InvalidHmac Error ${error.message}`);
|
|
112
115
|
// HMMMM: not sure
|
|
113
|
-
const authOnlinePath = API_PATHS[API_ROUTE_NAMES.AUTH_ONLINE];
|
|
116
|
+
const authOnlinePath = API_PATHS[shared_1.API_ROUTE_NAMES.AUTH_ONLINE];
|
|
114
117
|
const authPath = isOnline
|
|
115
118
|
? authOnlinePath
|
|
116
|
-
: API_PATHS[API_ROUTE_NAMES.AUTH_OFFLINE] || authOnlinePath;
|
|
119
|
+
: API_PATHS[shared_1.API_ROUTE_NAMES.AUTH_OFFLINE] || authOnlinePath;
|
|
117
120
|
// TODO: explore objectToQuerystring
|
|
118
121
|
const queryParams = new URLSearchParams({ host, shop, state }).toString();
|
|
119
122
|
redirectUrl = `${authPath}?${queryParams}`;
|
|
120
123
|
break;
|
|
121
124
|
}
|
|
122
|
-
case error instanceof CookieNotFound: {
|
|
125
|
+
case error instanceof shopify_api_1.CookieNotFound: {
|
|
123
126
|
console.warn(`${errorMessage}. This may occur if Cookie is already deleted. CookieNotFound Error ${error.message}`);
|
|
124
127
|
// HMMMM: not sure
|
|
125
|
-
const authOnlinePath = API_PATHS[API_ROUTE_NAMES.AUTH_ONLINE];
|
|
128
|
+
const authOnlinePath = API_PATHS[shared_1.API_ROUTE_NAMES.AUTH_ONLINE];
|
|
126
129
|
const authPath = isOnline
|
|
127
130
|
? authOnlinePath
|
|
128
|
-
: API_PATHS[API_ROUTE_NAMES.AUTH_OFFLINE] || authOnlinePath;
|
|
131
|
+
: API_PATHS[shared_1.API_ROUTE_NAMES.AUTH_OFFLINE] || authOnlinePath;
|
|
129
132
|
// TODO: explore objectToQuerystring
|
|
130
133
|
const queryParams = new URLSearchParams({ host, shop, state }).toString();
|
|
131
134
|
redirectUrl = `${authPath}?${queryParams}`;
|
|
132
135
|
break;
|
|
133
136
|
}
|
|
134
|
-
case error instanceof BillingError: {
|
|
137
|
+
case error instanceof shopify_api_1.BillingError: {
|
|
135
138
|
console.error(`${errorMessage}. Billing Error ${error.message}`, error.errorData);
|
|
136
|
-
redirectUrl = `${baseErrorUrl}?code=${ERROR_CODES.BILLING}`;
|
|
139
|
+
redirectUrl = `${baseErrorUrl}?code=${shared_1.ERROR_CODES.BILLING}`;
|
|
137
140
|
break;
|
|
138
141
|
}
|
|
139
|
-
case error instanceof GraphqlQueryError: {
|
|
140
|
-
const errorMessages = ensureArray((_b = error.response) === null || _b === void 0 ? void 0 : _b.errors).map(({ message }) => ensureString(message));
|
|
142
|
+
case error instanceof shopify_api_1.GraphqlQueryError: {
|
|
143
|
+
const errorMessages = (0, shared_1.ensureArray)((_b = error.response) === null || _b === void 0 ? void 0 : _b.errors).map(({ message }) => (0, shared_1.ensureString)(message));
|
|
141
144
|
console.error(`${errorMessage}. GraphqlQuery Error ${errorMessages.join('. ')}`);
|
|
142
|
-
redirectUrl = `${baseErrorUrl}?code=${ERROR_CODES.QUERY}`;
|
|
145
|
+
redirectUrl = `${baseErrorUrl}?code=${shared_1.ERROR_CODES.QUERY}`;
|
|
143
146
|
break;
|
|
144
147
|
}
|
|
145
|
-
case error instanceof InvalidOAuthError: {
|
|
148
|
+
case error instanceof shopify_api_1.InvalidOAuthError: {
|
|
146
149
|
console.error(`${errorMessage}. InvalidOAuth Error`, error);
|
|
147
|
-
redirectUrl = `${baseErrorUrl}?code=${ERROR_CODES.OAUTH}`;
|
|
150
|
+
redirectUrl = `${baseErrorUrl}?code=${shared_1.ERROR_CODES.OAUTH}`;
|
|
148
151
|
break;
|
|
149
152
|
}
|
|
150
153
|
default: {
|
|
151
154
|
console.error(errorMessage, error);
|
|
152
|
-
redirectUrl = `${baseErrorUrl}?code=${ERROR_CODES.CALLBACK}`;
|
|
155
|
+
redirectUrl = `${baseErrorUrl}?code=${shared_1.ERROR_CODES.CALLBACK}`;
|
|
153
156
|
}
|
|
154
157
|
}
|
|
155
158
|
}
|
|
156
159
|
return res.redirect(302, redirectUrl);
|
|
157
160
|
});
|
|
161
|
+
exports.handleCallback = handleCallback;
|
|
158
162
|
//# sourceMappingURL=callback.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callback.js","sourceRoot":"","sources":["../../../../src/lib/handlers/api/callback.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"callback.js","sourceRoot":"","sources":["../../../../src/lib/handlers/api/callback.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAM6B;AAE7B,uCAGoB;AACpB,4CAcwB;AAExB;;;;;EAKE;AACK,MAAM,cAAc,GAAG,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAO,GAAG,EAAE,GAAG,EAA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