@shopify/hydrogen-react 2022.7.0 → 2022.10.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 +7 -5
- package/dist/dev/CartProvider.cjs +485 -0
- package/dist/dev/CartProvider.cjs.map +1 -0
- package/dist/dev/CartProvider.js +485 -0
- package/dist/dev/CartProvider.js.map +1 -0
- package/dist/dev/MediaFile.cjs.map +1 -1
- package/dist/dev/MediaFile.js.map +1 -1
- package/dist/dev/Metafield.cjs +2 -2
- package/dist/dev/Metafield.cjs.map +1 -1
- package/dist/dev/Metafield.js.map +1 -1
- package/dist/dev/ModelViewer.cjs +4 -4
- package/dist/dev/ModelViewer.cjs.map +1 -1
- package/dist/dev/Money.cjs.map +1 -1
- package/dist/dev/Money.js.map +1 -1
- package/dist/dev/ProductPrice.cjs.map +1 -1
- package/dist/dev/ProductPrice.js.map +1 -1
- package/dist/dev/ProductProvider.cjs +14 -14
- package/dist/dev/ProductProvider.cjs.map +1 -1
- package/dist/dev/ShopPayButton.cjs.map +1 -1
- package/dist/dev/ShopPayButton.js.map +1 -1
- package/dist/dev/ShopifyProvider.cjs +4 -4
- package/dist/dev/ShopifyProvider.cjs.map +1 -1
- package/dist/dev/Video.cjs +2 -2
- package/dist/dev/_virtual/index.cjs +5 -0
- package/dist/dev/_virtual/index.cjs.map +1 -0
- package/dist/dev/_virtual/index.js +5 -0
- package/dist/dev/_virtual/index.js.map +1 -0
- package/dist/dev/_virtual/use-sync-external-store-shim.development.cjs +5 -0
- package/dist/dev/_virtual/use-sync-external-store-shim.development.cjs.map +1 -0
- package/dist/dev/_virtual/use-sync-external-store-shim.development.js +5 -0
- package/dist/dev/_virtual/use-sync-external-store-shim.development.js.map +1 -0
- package/dist/dev/_virtual/use-sync-external-store-shim.production.min.cjs +5 -0
- package/dist/dev/_virtual/use-sync-external-store-shim.production.min.cjs.map +1 -0
- package/dist/dev/_virtual/use-sync-external-store-shim.production.min.js +5 -0
- package/dist/dev/_virtual/use-sync-external-store-shim.production.min.js.map +1 -0
- package/dist/dev/_virtual/with-selector.cjs +5 -0
- package/dist/dev/_virtual/with-selector.cjs.map +1 -0
- package/dist/dev/_virtual/with-selector.development.cjs +5 -0
- package/dist/dev/_virtual/with-selector.development.cjs.map +1 -0
- package/dist/dev/_virtual/with-selector.development.js +5 -0
- package/dist/dev/_virtual/with-selector.development.js.map +1 -0
- package/dist/dev/_virtual/with-selector.js +5 -0
- package/dist/dev/_virtual/with-selector.js.map +1 -0
- package/dist/dev/_virtual/with-selector.production.min.cjs +5 -0
- package/dist/dev/_virtual/with-selector.production.min.cjs.map +1 -0
- package/dist/dev/_virtual/with-selector.production.min.js +5 -0
- package/dist/dev/_virtual/with-selector.production.min.js.map +1 -0
- package/dist/dev/cart-constants.cjs +17 -0
- package/dist/dev/cart-constants.cjs.map +1 -0
- package/dist/dev/cart-constants.js +17 -0
- package/dist/dev/cart-constants.js.map +1 -0
- package/dist/dev/cart-hooks.cjs +48 -0
- package/dist/dev/cart-hooks.cjs.map +1 -0
- package/dist/dev/cart-hooks.js +48 -0
- package/dist/dev/cart-hooks.js.map +1 -0
- package/dist/dev/cart-queries.cjs +114 -0
- package/dist/dev/cart-queries.cjs.map +1 -0
- package/dist/dev/cart-queries.js +114 -0
- package/dist/dev/cart-queries.js.map +1 -0
- package/dist/dev/flatten-connection.cjs +6 -0
- package/dist/dev/flatten-connection.cjs.map +1 -1
- package/dist/dev/flatten-connection.js +6 -0
- package/dist/dev/flatten-connection.js.map +1 -1
- package/dist/dev/index.cjs +3 -0
- package/dist/dev/index.cjs.map +1 -1
- package/dist/dev/index.js +3 -0
- package/dist/dev/index.js.map +1 -1
- package/dist/dev/load-script.cjs +3 -3
- package/dist/dev/load-script.cjs.map +1 -1
- package/dist/dev/node_modules/@xstate/fsm/es/index.cjs +158 -0
- package/dist/dev/node_modules/@xstate/fsm/es/index.cjs.map +1 -0
- package/dist/dev/node_modules/@xstate/fsm/es/index.js +159 -0
- package/dist/dev/node_modules/@xstate/fsm/es/index.js.map +1 -0
- package/dist/dev/node_modules/@xstate/react/es/fsm.cjs +94 -0
- package/dist/dev/node_modules/@xstate/react/es/fsm.cjs.map +1 -0
- package/dist/dev/node_modules/@xstate/react/es/fsm.js +94 -0
- package/dist/dev/node_modules/@xstate/react/es/fsm.js.map +1 -0
- package/dist/dev/node_modules/@xstate/react/es/useConstant.cjs +30 -0
- package/dist/dev/node_modules/@xstate/react/es/useConstant.cjs.map +1 -0
- package/dist/dev/node_modules/@xstate/react/es/useConstant.js +12 -0
- package/dist/dev/node_modules/@xstate/react/es/useConstant.js.map +1 -0
- package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.cjs +5 -0
- package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.cjs.map +1 -0
- package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js +6 -0
- package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js.map +1 -0
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.cjs +107 -0
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.cjs.map +1 -0
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +105 -0
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -0
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.cjs +74 -0
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.cjs.map +1 -0
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +72 -0
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -0
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs +138 -0
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs.map +1 -0
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +136 -0
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -0
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.cjs +60 -0
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.cjs.map +1 -0
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +58 -0
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -0
- package/dist/dev/node_modules/use-sync-external-store/shim/index.cjs +21 -0
- package/dist/dev/node_modules/use-sync-external-store/shim/index.cjs.map +1 -0
- package/dist/dev/node_modules/use-sync-external-store/shim/index.js +21 -0
- package/dist/dev/node_modules/use-sync-external-store/shim/index.js.map +1 -0
- package/dist/dev/node_modules/use-sync-external-store/shim/with-selector.cjs +12 -0
- package/dist/dev/node_modules/use-sync-external-store/shim/with-selector.cjs.map +1 -0
- package/dist/dev/node_modules/use-sync-external-store/shim/with-selector.js +11 -0
- package/dist/dev/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -0
- package/dist/dev/node_modules/worktop/cookie/index.cjs +27 -0
- package/dist/dev/node_modules/worktop/cookie/index.cjs.map +1 -0
- package/dist/dev/node_modules/worktop/cookie/index.js +27 -0
- package/dist/dev/node_modules/worktop/cookie/index.js.map +1 -0
- package/dist/dev/storefront-api-constants.cjs +1 -1
- package/dist/dev/storefront-api-constants.cjs.map +1 -1
- package/dist/dev/storefront-api-constants.js +1 -1
- package/dist/dev/storefront-api-constants.js.map +1 -1
- package/dist/dev/useCartAPIStateMachine.cjs +326 -0
- package/dist/dev/useCartAPIStateMachine.cjs.map +1 -0
- package/dist/dev/useCartAPIStateMachine.js +326 -0
- package/dist/dev/useCartAPIStateMachine.js.map +1 -0
- package/dist/dev/useCartActions.cjs +123 -0
- package/dist/dev/useCartActions.cjs.map +1 -0
- package/dist/dev/useCartActions.js +123 -0
- package/dist/dev/useCartActions.js.map +1 -0
- package/dist/dev/useMoney.cjs +5 -5
- package/dist/dev/useMoney.cjs.map +1 -1
- package/dist/prod/CartProvider.cjs +485 -0
- package/dist/prod/CartProvider.cjs.map +1 -0
- package/dist/prod/CartProvider.js +485 -0
- package/dist/prod/CartProvider.js.map +1 -0
- package/dist/prod/MediaFile.cjs.map +1 -1
- package/dist/prod/MediaFile.js.map +1 -1
- package/dist/prod/Metafield.cjs +2 -2
- package/dist/prod/Metafield.cjs.map +1 -1
- package/dist/prod/Metafield.js.map +1 -1
- package/dist/prod/ModelViewer.cjs +4 -4
- package/dist/prod/ModelViewer.cjs.map +1 -1
- package/dist/prod/Money.cjs.map +1 -1
- package/dist/prod/Money.js.map +1 -1
- package/dist/prod/ProductPrice.cjs.map +1 -1
- package/dist/prod/ProductPrice.js.map +1 -1
- package/dist/prod/ProductProvider.cjs +14 -14
- package/dist/prod/ProductProvider.cjs.map +1 -1
- package/dist/prod/ShopPayButton.cjs.map +1 -1
- package/dist/prod/ShopPayButton.js.map +1 -1
- package/dist/prod/ShopifyProvider.cjs +4 -4
- package/dist/prod/ShopifyProvider.cjs.map +1 -1
- package/dist/prod/Video.cjs +2 -2
- package/dist/prod/_virtual/index.cjs +5 -0
- package/dist/prod/_virtual/index.cjs.map +1 -0
- package/dist/prod/_virtual/index.js +5 -0
- package/dist/prod/_virtual/index.js.map +1 -0
- package/dist/prod/_virtual/use-sync-external-store-shim.development.cjs +5 -0
- package/dist/prod/_virtual/use-sync-external-store-shim.development.cjs.map +1 -0
- package/dist/prod/_virtual/use-sync-external-store-shim.development.js +5 -0
- package/dist/prod/_virtual/use-sync-external-store-shim.development.js.map +1 -0
- package/dist/prod/_virtual/use-sync-external-store-shim.production.min.cjs +5 -0
- package/dist/prod/_virtual/use-sync-external-store-shim.production.min.cjs.map +1 -0
- package/dist/prod/_virtual/use-sync-external-store-shim.production.min.js +5 -0
- package/dist/prod/_virtual/use-sync-external-store-shim.production.min.js.map +1 -0
- package/dist/prod/_virtual/with-selector.cjs +5 -0
- package/dist/prod/_virtual/with-selector.cjs.map +1 -0
- package/dist/prod/_virtual/with-selector.development.cjs +5 -0
- package/dist/prod/_virtual/with-selector.development.cjs.map +1 -0
- package/dist/prod/_virtual/with-selector.development.js +5 -0
- package/dist/prod/_virtual/with-selector.development.js.map +1 -0
- package/dist/prod/_virtual/with-selector.js +5 -0
- package/dist/prod/_virtual/with-selector.js.map +1 -0
- package/dist/prod/_virtual/with-selector.production.min.cjs +5 -0
- package/dist/prod/_virtual/with-selector.production.min.cjs.map +1 -0
- package/dist/prod/_virtual/with-selector.production.min.js +5 -0
- package/dist/prod/_virtual/with-selector.production.min.js.map +1 -0
- package/dist/prod/cart-constants.cjs +17 -0
- package/dist/prod/cart-constants.cjs.map +1 -0
- package/dist/prod/cart-constants.js +17 -0
- package/dist/prod/cart-constants.js.map +1 -0
- package/dist/prod/cart-hooks.cjs +48 -0
- package/dist/prod/cart-hooks.cjs.map +1 -0
- package/dist/prod/cart-hooks.js +48 -0
- package/dist/prod/cart-hooks.js.map +1 -0
- package/dist/prod/cart-queries.cjs +114 -0
- package/dist/prod/cart-queries.cjs.map +1 -0
- package/dist/prod/cart-queries.js +114 -0
- package/dist/prod/cart-queries.js.map +1 -0
- package/dist/prod/flatten-connection.cjs +7 -0
- package/dist/prod/flatten-connection.cjs.map +1 -1
- package/dist/prod/flatten-connection.js +7 -0
- package/dist/prod/flatten-connection.js.map +1 -1
- package/dist/prod/index.cjs +3 -0
- package/dist/prod/index.cjs.map +1 -1
- package/dist/prod/index.js +3 -0
- package/dist/prod/index.js.map +1 -1
- package/dist/prod/load-script.cjs +3 -3
- package/dist/prod/load-script.cjs.map +1 -1
- package/dist/prod/node_modules/@xstate/fsm/es/index.cjs +158 -0
- package/dist/prod/node_modules/@xstate/fsm/es/index.cjs.map +1 -0
- package/dist/prod/node_modules/@xstate/fsm/es/index.js +159 -0
- package/dist/prod/node_modules/@xstate/fsm/es/index.js.map +1 -0
- package/dist/prod/node_modules/@xstate/react/es/fsm.cjs +94 -0
- package/dist/prod/node_modules/@xstate/react/es/fsm.cjs.map +1 -0
- package/dist/prod/node_modules/@xstate/react/es/fsm.js +94 -0
- package/dist/prod/node_modules/@xstate/react/es/fsm.js.map +1 -0
- package/dist/prod/node_modules/@xstate/react/es/useConstant.cjs +30 -0
- package/dist/prod/node_modules/@xstate/react/es/useConstant.cjs.map +1 -0
- package/dist/prod/node_modules/@xstate/react/es/useConstant.js +12 -0
- package/dist/prod/node_modules/@xstate/react/es/useConstant.js.map +1 -0
- package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.cjs +5 -0
- package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.cjs.map +1 -0
- package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js +6 -0
- package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js.map +1 -0
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.cjs +107 -0
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.cjs.map +1 -0
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +105 -0
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -0
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.cjs +74 -0
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.cjs.map +1 -0
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +72 -0
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -0
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs +138 -0
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs.map +1 -0
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +136 -0
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -0
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.cjs +60 -0
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.cjs.map +1 -0
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +58 -0
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -0
- package/dist/prod/node_modules/use-sync-external-store/shim/index.cjs +21 -0
- package/dist/prod/node_modules/use-sync-external-store/shim/index.cjs.map +1 -0
- package/dist/prod/node_modules/use-sync-external-store/shim/index.js +21 -0
- package/dist/prod/node_modules/use-sync-external-store/shim/index.js.map +1 -0
- package/dist/prod/node_modules/use-sync-external-store/shim/with-selector.cjs +12 -0
- package/dist/prod/node_modules/use-sync-external-store/shim/with-selector.cjs.map +1 -0
- package/dist/prod/node_modules/use-sync-external-store/shim/with-selector.js +11 -0
- package/dist/prod/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -0
- package/dist/prod/node_modules/worktop/cookie/index.cjs +27 -0
- package/dist/prod/node_modules/worktop/cookie/index.cjs.map +1 -0
- package/dist/prod/node_modules/worktop/cookie/index.js +27 -0
- package/dist/prod/node_modules/worktop/cookie/index.js.map +1 -0
- package/dist/prod/storefront-api-constants.cjs +1 -1
- package/dist/prod/storefront-api-constants.cjs.map +1 -1
- package/dist/prod/storefront-api-constants.js +1 -1
- package/dist/prod/storefront-api-constants.js.map +1 -1
- package/dist/prod/useCartAPIStateMachine.cjs +326 -0
- package/dist/prod/useCartAPIStateMachine.cjs.map +1 -0
- package/dist/prod/useCartAPIStateMachine.js +326 -0
- package/dist/prod/useCartAPIStateMachine.js.map +1 -0
- package/dist/prod/useCartActions.cjs +123 -0
- package/dist/prod/useCartActions.cjs.map +1 -0
- package/dist/prod/useCartActions.js +123 -0
- package/dist/prod/useCartActions.js.map +1 -0
- package/dist/prod/useMoney.cjs +5 -5
- package/dist/prod/useMoney.cjs.map +1 -1
- package/dist/types/CartProvider.d.ts +61 -0
- package/dist/types/MediaFile.d.ts +0 -1
- package/dist/types/Money.d.ts +1 -1
- package/dist/types/ProductPrice.d.ts +0 -1
- package/dist/types/cart-constants.d.ts +8 -0
- package/dist/types/cart-hooks.d.ts +24 -0
- package/dist/types/cart-queries.d.ts +10 -0
- package/dist/types/cart-types.d.ts +289 -0
- package/dist/types/flatten-connection.d.ts +3 -1
- package/dist/types/index.d.cts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/storefront-api-constants.d.ts +1 -1
- package/dist/types/storefront-api-types.d.ts +278 -73
- package/dist/types/useCartAPIStateMachine.d.ts +25 -0
- package/dist/types/useCartActions.d.ts +64 -0
- package/dist/umd/hydrogen-react.dev.js +1815 -109
- package/dist/umd/hydrogen-react.dev.js.map +1 -1
- package/dist/umd/hydrogen-react.prod.js +239 -2
- package/dist/umd/hydrogen-react.prod.js.map +1 -1
- package/package.json +24 -12
- package/storefront.schema.json +1 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const CartLineAdd = (cartFragment) => `
|
|
4
|
+
mutation CartLineAdd($cartId: ID!, $lines: [CartLineInput!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
|
|
5
|
+
cartLinesAdd(cartId: $cartId, lines: $lines) {
|
|
6
|
+
cart {
|
|
7
|
+
...CartFragment
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
${cartFragment}
|
|
13
|
+
`;
|
|
14
|
+
const CartCreate = (cartFragment) => `
|
|
15
|
+
mutation CartCreate($input: CartInput!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
|
|
16
|
+
cartCreate(input: $input) {
|
|
17
|
+
cart {
|
|
18
|
+
...CartFragment
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
${cartFragment}
|
|
24
|
+
`;
|
|
25
|
+
const CartLineRemove = (cartFragment) => `
|
|
26
|
+
mutation CartLineRemove($cartId: ID!, $lines: [ID!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
|
|
27
|
+
cartLinesRemove(cartId: $cartId, lineIds: $lines) {
|
|
28
|
+
cart {
|
|
29
|
+
...CartFragment
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
${cartFragment}
|
|
35
|
+
`;
|
|
36
|
+
const CartLineUpdate = (cartFragment) => `
|
|
37
|
+
mutation CartLineUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
|
|
38
|
+
cartLinesUpdate(cartId: $cartId, lines: $lines) {
|
|
39
|
+
cart {
|
|
40
|
+
...CartFragment
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
${cartFragment}
|
|
46
|
+
`;
|
|
47
|
+
const CartNoteUpdate = (cartFragment) => `
|
|
48
|
+
mutation CartNoteUpdate($cartId: ID!, $note: String, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
|
|
49
|
+
cartNoteUpdate(cartId: $cartId, note: $note) {
|
|
50
|
+
cart {
|
|
51
|
+
...CartFragment
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
${cartFragment}
|
|
57
|
+
`;
|
|
58
|
+
const CartBuyerIdentityUpdate = (cartFragment) => `
|
|
59
|
+
mutation CartBuyerIdentityUpdate(
|
|
60
|
+
$cartId: ID!
|
|
61
|
+
$buyerIdentity: CartBuyerIdentityInput!
|
|
62
|
+
$numCartLines: Int = 250
|
|
63
|
+
$country: CountryCode = ZZ
|
|
64
|
+
) @inContext(country: $country) {
|
|
65
|
+
cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {
|
|
66
|
+
cart {
|
|
67
|
+
...CartFragment
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
${cartFragment}
|
|
73
|
+
`;
|
|
74
|
+
const CartAttributesUpdate = (cartFragment) => `
|
|
75
|
+
mutation CartAttributesUpdate($attributes: [AttributeInput!]!, $cartId: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
|
|
76
|
+
cartAttributesUpdate(attributes: $attributes, cartId: $cartId) {
|
|
77
|
+
cart {
|
|
78
|
+
...CartFragment
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
${cartFragment}
|
|
84
|
+
`;
|
|
85
|
+
const CartDiscountCodesUpdate = (cartFragment) => `
|
|
86
|
+
mutation CartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!], $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
|
|
87
|
+
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
88
|
+
cart {
|
|
89
|
+
...CartFragment
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
${cartFragment}
|
|
95
|
+
`;
|
|
96
|
+
const CartQuery = (cartFragment) => `
|
|
97
|
+
query CartQuery($id: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
|
|
98
|
+
cart(id: $id) {
|
|
99
|
+
...CartFragment
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
${cartFragment}
|
|
104
|
+
`;
|
|
105
|
+
exports.CartAttributesUpdate = CartAttributesUpdate;
|
|
106
|
+
exports.CartBuyerIdentityUpdate = CartBuyerIdentityUpdate;
|
|
107
|
+
exports.CartCreate = CartCreate;
|
|
108
|
+
exports.CartDiscountCodesUpdate = CartDiscountCodesUpdate;
|
|
109
|
+
exports.CartLineAdd = CartLineAdd;
|
|
110
|
+
exports.CartLineRemove = CartLineRemove;
|
|
111
|
+
exports.CartLineUpdate = CartLineUpdate;
|
|
112
|
+
exports.CartNoteUpdate = CartNoteUpdate;
|
|
113
|
+
exports.CartQuery = CartQuery;
|
|
114
|
+
//# sourceMappingURL=cart-queries.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cart-queries.cjs","sources":["../../src/cart-queries.ts"],"sourcesContent":["export const CartLineAdd = (cartFragment: string) => `\nmutation CartLineAdd($cartId: ID!, $lines: [CartLineInput!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartLinesAdd(cartId: $cartId, lines: $lines) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartCreate = (cartFragment: string) => `\nmutation CartCreate($input: CartInput!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartCreate(input: $input) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartLineRemove = (cartFragment: string) => `\nmutation CartLineRemove($cartId: ID!, $lines: [ID!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartLinesRemove(cartId: $cartId, lineIds: $lines) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartLineUpdate = (cartFragment: string) => `\nmutation CartLineUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartLinesUpdate(cartId: $cartId, lines: $lines) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartNoteUpdate = (cartFragment: string) => `\nmutation CartNoteUpdate($cartId: ID!, $note: String, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartNoteUpdate(cartId: $cartId, note: $note) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartBuyerIdentityUpdate = (cartFragment: string) => `\nmutation CartBuyerIdentityUpdate(\n $cartId: ID!\n $buyerIdentity: CartBuyerIdentityInput!\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n) @inContext(country: $country) {\n cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartAttributesUpdate = (cartFragment: string) => `\nmutation CartAttributesUpdate($attributes: [AttributeInput!]!, $cartId: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartAttributesUpdate(attributes: $attributes, cartId: $cartId) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartDiscountCodesUpdate = (cartFragment: string) => `\nmutation CartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!], $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartQuery = (cartFragment: string) => `\nquery CartQuery($id: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cart(id: $id) {\n ...CartFragment\n }\n}\n\n${cartFragment}\n`;\n\nexport const defaultCartFragment = `\nfragment CartFragment on Cart {\n id\n checkoutUrl\n totalQuantity\n buyerIdentity {\n countryCode\n customer {\n id\n email\n firstName\n lastName\n displayName\n }\n email\n phone\n }\n lines(first: $numCartLines) {\n edges {\n node {\n id\n quantity\n attributes {\n key\n value\n }\n cost {\n totalAmount {\n amount\n currencyCode\n }\n compareAtAmountPerQuantity {\n amount\n currencyCode\n }\n }\n merchandise {\n ... on ProductVariant {\n id\n availableForSale\n compareAtPriceV2 {\n ...MoneyFragment\n }\n priceV2 {\n ...MoneyFragment\n }\n requiresShipping\n title\n image {\n ...ImageFragment\n }\n product {\n handle\n title\n id\n }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }\n cost {\n subtotalAmount {\n ...MoneyFragment\n }\n totalAmount {\n ...MoneyFragment\n }\n totalDutyAmount {\n ...MoneyFragment\n }\n totalTaxAmount {\n ...MoneyFragment\n }\n }\n note\n attributes {\n key\n value\n }\n discountCodes {\n code\n }\n}\n\nfragment MoneyFragment on MoneyV2 {\n currencyCode\n amount\n}\nfragment ImageFragment on Image {\n id\n url\n altText\n width\n height\n}\n`;\n"],"names":[],"mappings":";;AAAa,MAAA,cAAc,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASnD;AAAA;AAGW,MAAA,aAAa,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASlD;AAAA;AAGW,MAAA,iBAAiB,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAStD;AAAA;AAGW,MAAA,iBAAiB,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAStD;AAAA;AAGW,MAAA,iBAAiB,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAStD;AAAA;AAGW,MAAA,0BAA0B,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAc/D;AAAA;AAGW,MAAA,uBAAuB,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS5D;AAAA;AAGW,MAAA,0BAA0B,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS/D;AAAA;AAGW,MAAA,YAAY,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOjD;AAAA;;;;;;;;;;"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
const CartLineAdd = (cartFragment) => `
|
|
2
|
+
mutation CartLineAdd($cartId: ID!, $lines: [CartLineInput!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
|
|
3
|
+
cartLinesAdd(cartId: $cartId, lines: $lines) {
|
|
4
|
+
cart {
|
|
5
|
+
...CartFragment
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
${cartFragment}
|
|
11
|
+
`;
|
|
12
|
+
const CartCreate = (cartFragment) => `
|
|
13
|
+
mutation CartCreate($input: CartInput!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
|
|
14
|
+
cartCreate(input: $input) {
|
|
15
|
+
cart {
|
|
16
|
+
...CartFragment
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
${cartFragment}
|
|
22
|
+
`;
|
|
23
|
+
const CartLineRemove = (cartFragment) => `
|
|
24
|
+
mutation CartLineRemove($cartId: ID!, $lines: [ID!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
|
|
25
|
+
cartLinesRemove(cartId: $cartId, lineIds: $lines) {
|
|
26
|
+
cart {
|
|
27
|
+
...CartFragment
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
${cartFragment}
|
|
33
|
+
`;
|
|
34
|
+
const CartLineUpdate = (cartFragment) => `
|
|
35
|
+
mutation CartLineUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
|
|
36
|
+
cartLinesUpdate(cartId: $cartId, lines: $lines) {
|
|
37
|
+
cart {
|
|
38
|
+
...CartFragment
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
${cartFragment}
|
|
44
|
+
`;
|
|
45
|
+
const CartNoteUpdate = (cartFragment) => `
|
|
46
|
+
mutation CartNoteUpdate($cartId: ID!, $note: String, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
|
|
47
|
+
cartNoteUpdate(cartId: $cartId, note: $note) {
|
|
48
|
+
cart {
|
|
49
|
+
...CartFragment
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
${cartFragment}
|
|
55
|
+
`;
|
|
56
|
+
const CartBuyerIdentityUpdate = (cartFragment) => `
|
|
57
|
+
mutation CartBuyerIdentityUpdate(
|
|
58
|
+
$cartId: ID!
|
|
59
|
+
$buyerIdentity: CartBuyerIdentityInput!
|
|
60
|
+
$numCartLines: Int = 250
|
|
61
|
+
$country: CountryCode = ZZ
|
|
62
|
+
) @inContext(country: $country) {
|
|
63
|
+
cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {
|
|
64
|
+
cart {
|
|
65
|
+
...CartFragment
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
${cartFragment}
|
|
71
|
+
`;
|
|
72
|
+
const CartAttributesUpdate = (cartFragment) => `
|
|
73
|
+
mutation CartAttributesUpdate($attributes: [AttributeInput!]!, $cartId: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
|
|
74
|
+
cartAttributesUpdate(attributes: $attributes, cartId: $cartId) {
|
|
75
|
+
cart {
|
|
76
|
+
...CartFragment
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
${cartFragment}
|
|
82
|
+
`;
|
|
83
|
+
const CartDiscountCodesUpdate = (cartFragment) => `
|
|
84
|
+
mutation CartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!], $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
|
|
85
|
+
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
86
|
+
cart {
|
|
87
|
+
...CartFragment
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
${cartFragment}
|
|
93
|
+
`;
|
|
94
|
+
const CartQuery = (cartFragment) => `
|
|
95
|
+
query CartQuery($id: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
|
|
96
|
+
cart(id: $id) {
|
|
97
|
+
...CartFragment
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
${cartFragment}
|
|
102
|
+
`;
|
|
103
|
+
export {
|
|
104
|
+
CartAttributesUpdate,
|
|
105
|
+
CartBuyerIdentityUpdate,
|
|
106
|
+
CartCreate,
|
|
107
|
+
CartDiscountCodesUpdate,
|
|
108
|
+
CartLineAdd,
|
|
109
|
+
CartLineRemove,
|
|
110
|
+
CartLineUpdate,
|
|
111
|
+
CartNoteUpdate,
|
|
112
|
+
CartQuery
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=cart-queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cart-queries.js","sources":["../../src/cart-queries.ts"],"sourcesContent":["export const CartLineAdd = (cartFragment: string) => `\nmutation CartLineAdd($cartId: ID!, $lines: [CartLineInput!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartLinesAdd(cartId: $cartId, lines: $lines) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartCreate = (cartFragment: string) => `\nmutation CartCreate($input: CartInput!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartCreate(input: $input) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartLineRemove = (cartFragment: string) => `\nmutation CartLineRemove($cartId: ID!, $lines: [ID!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartLinesRemove(cartId: $cartId, lineIds: $lines) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartLineUpdate = (cartFragment: string) => `\nmutation CartLineUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartLinesUpdate(cartId: $cartId, lines: $lines) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartNoteUpdate = (cartFragment: string) => `\nmutation CartNoteUpdate($cartId: ID!, $note: String, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartNoteUpdate(cartId: $cartId, note: $note) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartBuyerIdentityUpdate = (cartFragment: string) => `\nmutation CartBuyerIdentityUpdate(\n $cartId: ID!\n $buyerIdentity: CartBuyerIdentityInput!\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n) @inContext(country: $country) {\n cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartAttributesUpdate = (cartFragment: string) => `\nmutation CartAttributesUpdate($attributes: [AttributeInput!]!, $cartId: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartAttributesUpdate(attributes: $attributes, cartId: $cartId) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartDiscountCodesUpdate = (cartFragment: string) => `\nmutation CartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!], $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {\n cart {\n ...CartFragment\n }\n }\n}\n\n${cartFragment}\n`;\n\nexport const CartQuery = (cartFragment: string) => `\nquery CartQuery($id: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {\n cart(id: $id) {\n ...CartFragment\n }\n}\n\n${cartFragment}\n`;\n\nexport const defaultCartFragment = `\nfragment CartFragment on Cart {\n id\n checkoutUrl\n totalQuantity\n buyerIdentity {\n countryCode\n customer {\n id\n email\n firstName\n lastName\n displayName\n }\n email\n phone\n }\n lines(first: $numCartLines) {\n edges {\n node {\n id\n quantity\n attributes {\n key\n value\n }\n cost {\n totalAmount {\n amount\n currencyCode\n }\n compareAtAmountPerQuantity {\n amount\n currencyCode\n }\n }\n merchandise {\n ... on ProductVariant {\n id\n availableForSale\n compareAtPriceV2 {\n ...MoneyFragment\n }\n priceV2 {\n ...MoneyFragment\n }\n requiresShipping\n title\n image {\n ...ImageFragment\n }\n product {\n handle\n title\n id\n }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }\n cost {\n subtotalAmount {\n ...MoneyFragment\n }\n totalAmount {\n ...MoneyFragment\n }\n totalDutyAmount {\n ...MoneyFragment\n }\n totalTaxAmount {\n ...MoneyFragment\n }\n }\n note\n attributes {\n key\n value\n }\n discountCodes {\n code\n }\n}\n\nfragment MoneyFragment on MoneyV2 {\n currencyCode\n amount\n}\nfragment ImageFragment on Image {\n id\n url\n altText\n width\n height\n}\n`;\n"],"names":[],"mappings":"AAAa,MAAA,cAAc,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASnD;AAAA;AAGW,MAAA,aAAa,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASlD;AAAA;AAGW,MAAA,iBAAiB,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAStD;AAAA;AAGW,MAAA,iBAAiB,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAStD;AAAA;AAGW,MAAA,iBAAiB,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAStD;AAAA;AAGW,MAAA,0BAA0B,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAc/D;AAAA;AAGW,MAAA,uBAAuB,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS5D;AAAA;AAGW,MAAA,0BAA0B,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS/D;AAAA;AAGW,MAAA,YAAY,CAAC,iBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOjD;AAAA;"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
function flattenConnection(connection) {
|
|
4
|
+
if (!connection) {
|
|
5
|
+
const noConnectionErr = `flattenConnection(): needs a 'connection' to flatten, but received '${connection}' instead`;
|
|
6
|
+
{
|
|
7
|
+
throw new Error(noConnectionErr);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
4
10
|
if (connection.nodes) {
|
|
5
11
|
return connection.nodes;
|
|
6
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flatten-connection.cjs","sources":["../../src/flatten-connection.ts"],"sourcesContent":["import type {PartialDeep} from 'type-fest';\n\n/**\n * The `flattenConnection` utility transforms a connection object from the Storefront API (for example, [Product-related connections](https://shopify.dev/api/storefront/reference/products/product)) into a flat array of nodes.\n * The utility works with either `nodes` or `edges.node`.\n */\nexport function flattenConnection<T>(\n connection
|
|
1
|
+
{"version":3,"file":"flatten-connection.cjs","sources":["../../src/flatten-connection.ts"],"sourcesContent":["import type {PartialDeep} from 'type-fest';\n\n/**\n * The `flattenConnection` utility transforms a connection object from the Storefront API (for example, [Product-related connections](https://shopify.dev/api/storefront/reference/products/product)) into a flat array of nodes.\n * The utility works with either `nodes` or `edges.node`.\n *\n * If `connection` is null or undefined, will return an empty array instead in production. In development, an error will be thrown.\n */\nexport function flattenConnection<T>(\n connection?: PartialDeep<GraphQLConnection<T>, {recurseIntoArrays: true}>\n): PartialDeep<T, {recurseIntoArrays: true}>[] {\n if (!connection) {\n const noConnectionErr = `flattenConnection(): needs a 'connection' to flatten, but received '${connection}' instead`;\n if (__HYDROGEN_DEV__) {\n throw new Error(noConnectionErr);\n } else {\n console.error(noConnectionErr);\n return [];\n }\n }\n\n if (connection.nodes) {\n return connection.nodes as PartialDeep<T, {recurseIntoArrays: true}>[];\n }\n\n if (connection.edges) {\n return connection.edges.map((edge) => {\n if (!edge?.node) {\n throw new Error('Connection edges must contain nodes');\n }\n return edge.node;\n });\n }\n\n if (__HYDROGEN_DEV__) {\n console.warn(\n `The connection did not contain either \"nodes\" or \"edges.node\". A empty array will be returned in its place.`\n );\n }\n\n return [];\n}\n\ninterface GraphQLConnection<T> {\n edges?: {node: T}[];\n nodes?: T[];\n}\n"],"names":[],"mappings":";;AAQO,SAAS,kBACd,YAC6C;AAC7C,MAAI,CAAC,YAAY;AACf,UAAM,kBAAkB,uEAAuE;AACzE;AACd,YAAA,IAAI,MAAM,eAAe;AAAA,IAIjC;AAAA,EACF;AAEA,MAAI,WAAW,OAAO;AACpB,WAAO,WAAW;AAAA,EACpB;AAEA,MAAI,WAAW,OAAO;AACpB,WAAO,WAAW,MAAM,IAAI,CAAC,SAAS;AAChC,UAAA,EAAC,6BAAM,OAAM;AACT,cAAA,IAAI,MAAM,qCAAqC;AAAA,MACvD;AACA,aAAO,KAAK;AAAA,IAAA,CACb;AAAA,EACH;AAEsB;AACZ,YAAA;AAAA,MACN;AAAA,IAAA;AAAA,EAEJ;AAEA,SAAO;AACT;;"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
function flattenConnection(connection) {
|
|
2
|
+
if (!connection) {
|
|
3
|
+
const noConnectionErr = `flattenConnection(): needs a 'connection' to flatten, but received '${connection}' instead`;
|
|
4
|
+
{
|
|
5
|
+
throw new Error(noConnectionErr);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
2
8
|
if (connection.nodes) {
|
|
3
9
|
return connection.nodes;
|
|
4
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flatten-connection.js","sources":["../../src/flatten-connection.ts"],"sourcesContent":["import type {PartialDeep} from 'type-fest';\n\n/**\n * The `flattenConnection` utility transforms a connection object from the Storefront API (for example, [Product-related connections](https://shopify.dev/api/storefront/reference/products/product)) into a flat array of nodes.\n * The utility works with either `nodes` or `edges.node`.\n */\nexport function flattenConnection<T>(\n connection
|
|
1
|
+
{"version":3,"file":"flatten-connection.js","sources":["../../src/flatten-connection.ts"],"sourcesContent":["import type {PartialDeep} from 'type-fest';\n\n/**\n * The `flattenConnection` utility transforms a connection object from the Storefront API (for example, [Product-related connections](https://shopify.dev/api/storefront/reference/products/product)) into a flat array of nodes.\n * The utility works with either `nodes` or `edges.node`.\n *\n * If `connection` is null or undefined, will return an empty array instead in production. In development, an error will be thrown.\n */\nexport function flattenConnection<T>(\n connection?: PartialDeep<GraphQLConnection<T>, {recurseIntoArrays: true}>\n): PartialDeep<T, {recurseIntoArrays: true}>[] {\n if (!connection) {\n const noConnectionErr = `flattenConnection(): needs a 'connection' to flatten, but received '${connection}' instead`;\n if (__HYDROGEN_DEV__) {\n throw new Error(noConnectionErr);\n } else {\n console.error(noConnectionErr);\n return [];\n }\n }\n\n if (connection.nodes) {\n return connection.nodes as PartialDeep<T, {recurseIntoArrays: true}>[];\n }\n\n if (connection.edges) {\n return connection.edges.map((edge) => {\n if (!edge?.node) {\n throw new Error('Connection edges must contain nodes');\n }\n return edge.node;\n });\n }\n\n if (__HYDROGEN_DEV__) {\n console.warn(\n `The connection did not contain either \"nodes\" or \"edges.node\". A empty array will be returned in its place.`\n );\n }\n\n return [];\n}\n\ninterface GraphQLConnection<T> {\n edges?: {node: T}[];\n nodes?: T[];\n}\n"],"names":[],"mappings":"AAQO,SAAS,kBACd,YAC6C;AAC7C,MAAI,CAAC,YAAY;AACf,UAAM,kBAAkB,uEAAuE;AACzE;AACd,YAAA,IAAI,MAAM,eAAe;AAAA,IAIjC;AAAA,EACF;AAEA,MAAI,WAAW,OAAO;AACpB,WAAO,WAAW;AAAA,EACpB;AAEA,MAAI,WAAW,OAAO;AACpB,WAAO,WAAW,MAAM,IAAI,CAAC,SAAS;AAChC,UAAA,EAAC,6BAAM,OAAM;AACT,cAAA,IAAI,MAAM,qCAAqC;AAAA,MACvD;AACA,aAAO,KAAK;AAAA,IAAA,CACb;AAAA,EACH;AAEsB;AACZ,YAAA;AAAA,MACN;AAAA,IAAA;AAAA,EAEJ;AAEA,SAAO;AACT;"}
|
package/dist/dev/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const CartProvider = require("./CartProvider.cjs");
|
|
3
4
|
const ExternalVideo = require("./ExternalVideo.cjs");
|
|
4
5
|
const flattenConnection = require("./flatten-connection.cjs");
|
|
5
6
|
const Image = require("./Image.cjs");
|
|
@@ -14,6 +15,8 @@ const ShopPayButton = require("./ShopPayButton.cjs");
|
|
|
14
15
|
const storefrontClient = require("./storefront-client.cjs");
|
|
15
16
|
const useMoney = require("./useMoney.cjs");
|
|
16
17
|
const Video = require("./Video.cjs");
|
|
18
|
+
exports.CartProvider = CartProvider.CartProvider;
|
|
19
|
+
exports.useCart = CartProvider.useCart;
|
|
17
20
|
exports.ExternalVideo = ExternalVideo.ExternalVideo;
|
|
18
21
|
exports.flattenConnection = flattenConnection.flattenConnection;
|
|
19
22
|
exports.Image = Image.Image;
|
package/dist/dev/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/dev/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CartProvider, useCart } from "./CartProvider.js";
|
|
1
2
|
import { ExternalVideo } from "./ExternalVideo.js";
|
|
2
3
|
import { flattenConnection } from "./flatten-connection.js";
|
|
3
4
|
import { Image } from "./Image.js";
|
|
@@ -13,6 +14,7 @@ import { createStorefrontClient } from "./storefront-client.js";
|
|
|
13
14
|
import { useMoney } from "./useMoney.js";
|
|
14
15
|
import { Video } from "./Video.js";
|
|
15
16
|
export {
|
|
17
|
+
CartProvider,
|
|
16
18
|
ExternalVideo,
|
|
17
19
|
Image,
|
|
18
20
|
MediaFile,
|
|
@@ -28,6 +30,7 @@ export {
|
|
|
28
30
|
flattenConnection,
|
|
29
31
|
parseMetafield,
|
|
30
32
|
parseMetafieldValue,
|
|
33
|
+
useCart,
|
|
31
34
|
useMoney,
|
|
32
35
|
useProduct,
|
|
33
36
|
useShop
|
package/dist/dev/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
package/dist/dev/load-script.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const
|
|
3
|
+
const require$$0 = require("react");
|
|
4
4
|
const SCRIPTS_LOADED = {};
|
|
5
5
|
function loadScript(src, options) {
|
|
6
6
|
const isScriptLoaded = SCRIPTS_LOADED[src];
|
|
@@ -31,9 +31,9 @@ function loadScript(src, options) {
|
|
|
31
31
|
return promise;
|
|
32
32
|
}
|
|
33
33
|
function useLoadScript(url, options) {
|
|
34
|
-
const [status, setStatus] =
|
|
34
|
+
const [status, setStatus] = require$$0.useState("loading");
|
|
35
35
|
const stringifiedOptions = JSON.stringify(options);
|
|
36
|
-
|
|
36
|
+
require$$0.useEffect(() => {
|
|
37
37
|
async function loadScriptWrapper() {
|
|
38
38
|
try {
|
|
39
39
|
setStatus("loading");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-script.cjs","sources":["../../src/load-script.tsx"],"sourcesContent":["import {useState, useEffect} from 'react';\n\nconst SCRIPTS_LOADED: Record<string, Promise<boolean>> = {};\n\nexport function loadScript(\n src: string,\n options?: {module?: boolean; in?: 'head' | 'body'}\n): Promise<boolean> {\n const isScriptLoaded: Promise<boolean> = SCRIPTS_LOADED[src];\n\n if (isScriptLoaded) {\n return isScriptLoaded;\n }\n\n const promise = new Promise<boolean>((resolve, reject) => {\n const script = document.createElement('script');\n if (options?.module) {\n script.type = 'module';\n } else {\n script.type = 'text/javascript';\n }\n script.src = src;\n script.onload = () => {\n resolve(true);\n };\n script.onerror = () => {\n reject(false);\n };\n if (options?.in === 'head') {\n document.head.appendChild(script);\n } else {\n document.body.appendChild(script);\n }\n });\n\n SCRIPTS_LOADED[src] = promise;\n\n return promise;\n}\n\ntype LoadScriptParams = Parameters<typeof loadScript>;\n\n/**\n * The `useLoadScript` hook loads an external script tag in the browser. It allows React components to lazy-load large third-party dependencies.\n */\nexport function useLoadScript(\n url: LoadScriptParams[0],\n options?: LoadScriptParams[1]\n): ScriptState {\n const [status, setStatus] = useState<ScriptState>('loading');\n const stringifiedOptions = JSON.stringify(options);\n\n useEffect(() => {\n async function loadScriptWrapper() {\n try {\n setStatus('loading');\n await loadScript(url, options);\n setStatus('done');\n } catch (error) {\n setStatus('error');\n }\n }\n\n loadScriptWrapper();\n }, [url, stringifiedOptions, options]);\n\n return status;\n}\n\ntype ScriptState = 'loading' | 'done' | 'error';\n"],"names":["SCRIPTS_LOADED","loadScript","src","options","isScriptLoaded","promise","Promise","resolve","reject","script","document","createElement","module","type","onload","onerror","in","head","appendChild","body","useLoadScript","url","status","setStatus","useState","stringifiedOptions","JSON","stringify","useEffect","loadScriptWrapper","error"],"mappings":";;;AAEA,MAAMA,iBAAmD,CAAA;AAEzCC,SAAAA,WACdC,KACAC,SACkB;AAClB,QAAMC,iBAAmCJ,eAAeE;AAExD,MAAIE,gBAAgB;AACXA,WAAAA;AAAAA,EACR;AAED,QAAMC,UAAU,IAAIC,QAAiB,CAACC,SAASC,WAAW;AAClDC,UAAAA,SAASC,SAASC,cAAc,QAAvB;AACf,QAAIR,mCAASS,QAAQ;AACnBH,aAAOI,OAAO;AAAA,IAAA,OACT;AACLJ,aAAOI,OAAO;AAAA,IACf;AACDJ,WAAOP,MAAMA;AACbO,WAAOK,SAAS,MAAM;AACpBP,cAAQ,IAAD;AAAA,IAAA;AAETE,WAAOM,UAAU,MAAM;AACrBP,aAAO,KAAD;AAAA,IAAA;AAEJL,SAAAA,mCAASa,QAAO,QAAQ;AACjBC,eAAAA,KAAKC,YAAYT,MAA1B;AAAA,IAAA,OACK;AACIU,eAAAA,KAAKD,YAAYT,MAA1B;AAAA,IACD;AAAA,EAAA,CAlBa;AAqBhBT,iBAAeE,OAAOG;AAEfA,SAAAA;AACR;AAOee,SAAAA,cACdC,KACAlB,SACa;AACb,QAAM,CAACmB,QAAQC,SAAT,IAAsBC,
|
|
1
|
+
{"version":3,"file":"load-script.cjs","sources":["../../src/load-script.tsx"],"sourcesContent":["import {useState, useEffect} from 'react';\n\nconst SCRIPTS_LOADED: Record<string, Promise<boolean>> = {};\n\nexport function loadScript(\n src: string,\n options?: {module?: boolean; in?: 'head' | 'body'}\n): Promise<boolean> {\n const isScriptLoaded: Promise<boolean> = SCRIPTS_LOADED[src];\n\n if (isScriptLoaded) {\n return isScriptLoaded;\n }\n\n const promise = new Promise<boolean>((resolve, reject) => {\n const script = document.createElement('script');\n if (options?.module) {\n script.type = 'module';\n } else {\n script.type = 'text/javascript';\n }\n script.src = src;\n script.onload = () => {\n resolve(true);\n };\n script.onerror = () => {\n reject(false);\n };\n if (options?.in === 'head') {\n document.head.appendChild(script);\n } else {\n document.body.appendChild(script);\n }\n });\n\n SCRIPTS_LOADED[src] = promise;\n\n return promise;\n}\n\ntype LoadScriptParams = Parameters<typeof loadScript>;\n\n/**\n * The `useLoadScript` hook loads an external script tag in the browser. It allows React components to lazy-load large third-party dependencies.\n */\nexport function useLoadScript(\n url: LoadScriptParams[0],\n options?: LoadScriptParams[1]\n): ScriptState {\n const [status, setStatus] = useState<ScriptState>('loading');\n const stringifiedOptions = JSON.stringify(options);\n\n useEffect(() => {\n async function loadScriptWrapper() {\n try {\n setStatus('loading');\n await loadScript(url, options);\n setStatus('done');\n } catch (error) {\n setStatus('error');\n }\n }\n\n loadScriptWrapper();\n }, [url, stringifiedOptions, options]);\n\n return status;\n}\n\ntype ScriptState = 'loading' | 'done' | 'error';\n"],"names":["SCRIPTS_LOADED","loadScript","src","options","isScriptLoaded","promise","Promise","resolve","reject","script","document","createElement","module","type","onload","onerror","in","head","appendChild","body","useLoadScript","url","status","setStatus","useState","stringifiedOptions","JSON","stringify","useEffect","loadScriptWrapper","error"],"mappings":";;;AAEA,MAAMA,iBAAmD,CAAA;AAEzCC,SAAAA,WACdC,KACAC,SACkB;AAClB,QAAMC,iBAAmCJ,eAAeE;AAExD,MAAIE,gBAAgB;AACXA,WAAAA;AAAAA,EACR;AAED,QAAMC,UAAU,IAAIC,QAAiB,CAACC,SAASC,WAAW;AAClDC,UAAAA,SAASC,SAASC,cAAc,QAAvB;AACf,QAAIR,mCAASS,QAAQ;AACnBH,aAAOI,OAAO;AAAA,IAAA,OACT;AACLJ,aAAOI,OAAO;AAAA,IACf;AACDJ,WAAOP,MAAMA;AACbO,WAAOK,SAAS,MAAM;AACpBP,cAAQ,IAAD;AAAA,IAAA;AAETE,WAAOM,UAAU,MAAM;AACrBP,aAAO,KAAD;AAAA,IAAA;AAEJL,SAAAA,mCAASa,QAAO,QAAQ;AACjBC,eAAAA,KAAKC,YAAYT,MAA1B;AAAA,IAAA,OACK;AACIU,eAAAA,KAAKD,YAAYT,MAA1B;AAAA,IACD;AAAA,EAAA,CAlBa;AAqBhBT,iBAAeE,OAAOG;AAEfA,SAAAA;AACR;AAOee,SAAAA,cACdC,KACAlB,SACa;AACb,QAAM,CAACmB,QAAQC,SAAT,IAAsBC,oBAAsB,SAAd;AAC9BC,QAAAA,qBAAqBC,KAAKC,UAAUxB,OAAf;AAE3ByB,aAAAA,UAAU,MAAM;AACd,mBAAeC,oBAAoB;AAC7B,UAAA;AACFN,kBAAU,SAAD;AACHtB,cAAAA,WAAWoB,KAAKlB,OAAN;AAChBoB,kBAAU,MAAD;AAAA,eACFO;AACPP,kBAAU,OAAD;AAAA,MACV;AAAA,IACF;AAEgB;EAChB,GAAA,CAACF,KAAKI,oBAAoBtB,OAA1B,CAZM;AAcFmB,SAAAA;AACR;;;"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
/*! *****************************************************************************
|
|
4
|
+
Copyright (c) Microsoft Corporation.
|
|
5
|
+
|
|
6
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
7
|
+
purpose with or without fee is hereby granted.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
+
***************************************************************************** */
|
|
17
|
+
function t(t2, n) {
|
|
18
|
+
var e2 = "function" == typeof Symbol && t2[Symbol.iterator];
|
|
19
|
+
if (!e2)
|
|
20
|
+
return t2;
|
|
21
|
+
var r2, i2, o2 = e2.call(t2), a2 = [];
|
|
22
|
+
try {
|
|
23
|
+
for (; (void 0 === n || n-- > 0) && !(r2 = o2.next()).done; )
|
|
24
|
+
a2.push(r2.value);
|
|
25
|
+
} catch (t3) {
|
|
26
|
+
i2 = { error: t3 };
|
|
27
|
+
} finally {
|
|
28
|
+
try {
|
|
29
|
+
r2 && !r2.done && (e2 = o2.return) && e2.call(o2);
|
|
30
|
+
} finally {
|
|
31
|
+
if (i2)
|
|
32
|
+
throw i2.error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return a2;
|
|
36
|
+
}
|
|
37
|
+
exports.InterpreterStatus = void 0;
|
|
38
|
+
!function(t2) {
|
|
39
|
+
t2[t2.NotStarted = 0] = "NotStarted", t2[t2.Running = 1] = "Running", t2[t2.Stopped = 2] = "Stopped";
|
|
40
|
+
}(exports.InterpreterStatus || (exports.InterpreterStatus = {}));
|
|
41
|
+
var e = { type: "xstate.init" };
|
|
42
|
+
function r(t2) {
|
|
43
|
+
return void 0 === t2 ? [] : [].concat(t2);
|
|
44
|
+
}
|
|
45
|
+
function i(t2) {
|
|
46
|
+
return { type: "xstate.assign", assignment: t2 };
|
|
47
|
+
}
|
|
48
|
+
function o(t2, n) {
|
|
49
|
+
return "string" == typeof (t2 = "string" == typeof t2 && n && n[t2] ? n[t2] : t2) ? { type: t2 } : "function" == typeof t2 ? { type: t2.name, exec: t2 } : t2;
|
|
50
|
+
}
|
|
51
|
+
function a(t2) {
|
|
52
|
+
return function(n) {
|
|
53
|
+
return t2 === n;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function u(t2) {
|
|
57
|
+
return "string" == typeof t2 ? { type: t2 } : t2;
|
|
58
|
+
}
|
|
59
|
+
function c(t2, n) {
|
|
60
|
+
return { value: t2, context: n, actions: [], changed: false, matches: a(t2) };
|
|
61
|
+
}
|
|
62
|
+
function f(t2, n, e2) {
|
|
63
|
+
var r2 = n, i2 = false;
|
|
64
|
+
return [t2.filter(function(t3) {
|
|
65
|
+
if ("xstate.assign" === t3.type) {
|
|
66
|
+
i2 = true;
|
|
67
|
+
var n2 = Object.assign({}, r2);
|
|
68
|
+
return "function" == typeof t3.assignment ? n2 = t3.assignment(r2, e2) : Object.keys(t3.assignment).forEach(function(i3) {
|
|
69
|
+
n2[i3] = "function" == typeof t3.assignment[i3] ? t3.assignment[i3](r2, e2) : t3.assignment[i3];
|
|
70
|
+
}), r2 = n2, false;
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
73
|
+
}), r2, i2];
|
|
74
|
+
}
|
|
75
|
+
function s(n, i2) {
|
|
76
|
+
void 0 === i2 && (i2 = {});
|
|
77
|
+
var s2 = t(f(r(n.states[n.initial].entry).map(function(t2) {
|
|
78
|
+
return o(t2, i2.actions);
|
|
79
|
+
}), n.context, e), 2), l2 = s2[0], v2 = s2[1], y = { config: n, _options: i2, initialState: { value: n.initial, actions: l2, context: v2, matches: a(n.initial) }, transition: function(e2, i3) {
|
|
80
|
+
var s3, l3, v3 = "string" == typeof e2 ? { value: e2, context: n.context } : e2, p = v3.value, g = v3.context, d = u(i3), x = n.states[p];
|
|
81
|
+
if (x.on) {
|
|
82
|
+
var m = r(x.on[d.type]);
|
|
83
|
+
try {
|
|
84
|
+
for (var h = function(t2) {
|
|
85
|
+
var n2 = "function" == typeof Symbol && Symbol.iterator, e3 = n2 && t2[n2], r2 = 0;
|
|
86
|
+
if (e3)
|
|
87
|
+
return e3.call(t2);
|
|
88
|
+
if (t2 && "number" == typeof t2.length)
|
|
89
|
+
return { next: function() {
|
|
90
|
+
return t2 && r2 >= t2.length && (t2 = void 0), { value: t2 && t2[r2++], done: !t2 };
|
|
91
|
+
} };
|
|
92
|
+
throw new TypeError(n2 ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
93
|
+
}(m), b = h.next(); !b.done; b = h.next()) {
|
|
94
|
+
var S = b.value;
|
|
95
|
+
if (void 0 === S)
|
|
96
|
+
return c(p, g);
|
|
97
|
+
var w = "string" == typeof S ? { target: S } : S, j = w.target, E = w.actions, R = void 0 === E ? [] : E, N = w.cond, O = void 0 === N ? function() {
|
|
98
|
+
return true;
|
|
99
|
+
} : N, _ = void 0 === j, k = null != j ? j : p, T = n.states[k];
|
|
100
|
+
if (O(g, d)) {
|
|
101
|
+
var q = t(f((_ ? r(R) : [].concat(x.exit, R, T.entry).filter(function(t2) {
|
|
102
|
+
return t2;
|
|
103
|
+
})).map(function(t2) {
|
|
104
|
+
return o(t2, y._options.actions);
|
|
105
|
+
}), g, d), 3), z = q[0], A = q[1], B = q[2], C = null != j ? j : p;
|
|
106
|
+
return { value: C, context: A, actions: z, changed: j !== p || z.length > 0 || B, matches: a(C) };
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
} catch (t2) {
|
|
110
|
+
s3 = { error: t2 };
|
|
111
|
+
} finally {
|
|
112
|
+
try {
|
|
113
|
+
b && !b.done && (l3 = h.return) && l3.call(h);
|
|
114
|
+
} finally {
|
|
115
|
+
if (s3)
|
|
116
|
+
throw s3.error;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return c(p, g);
|
|
121
|
+
} };
|
|
122
|
+
return y;
|
|
123
|
+
}
|
|
124
|
+
var l = function(t2, n) {
|
|
125
|
+
return t2.actions.forEach(function(e2) {
|
|
126
|
+
var r2 = e2.exec;
|
|
127
|
+
return r2 && r2(t2.context, n);
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
function v(t2) {
|
|
131
|
+
var r2 = t2.initialState, i2 = exports.InterpreterStatus.NotStarted, o2 = /* @__PURE__ */ new Set(), c2 = { _machine: t2, send: function(e2) {
|
|
132
|
+
i2 === exports.InterpreterStatus.Running && (r2 = t2.transition(r2, e2), l(r2, u(e2)), o2.forEach(function(t3) {
|
|
133
|
+
return t3(r2);
|
|
134
|
+
}));
|
|
135
|
+
}, subscribe: function(t3) {
|
|
136
|
+
return o2.add(t3), t3(r2), { unsubscribe: function() {
|
|
137
|
+
return o2.delete(t3);
|
|
138
|
+
} };
|
|
139
|
+
}, start: function(o3) {
|
|
140
|
+
if (o3) {
|
|
141
|
+
var u2 = "object" == typeof o3 ? o3 : { context: t2.config.context, value: o3 };
|
|
142
|
+
r2 = { value: u2.value, actions: [], context: u2.context, matches: a(u2.value) };
|
|
143
|
+
} else
|
|
144
|
+
r2 = t2.initialState;
|
|
145
|
+
return i2 = exports.InterpreterStatus.Running, l(r2, e), c2;
|
|
146
|
+
}, stop: function() {
|
|
147
|
+
return i2 = exports.InterpreterStatus.Stopped, o2.clear(), c2;
|
|
148
|
+
}, get state() {
|
|
149
|
+
return r2;
|
|
150
|
+
}, get status() {
|
|
151
|
+
return i2;
|
|
152
|
+
} };
|
|
153
|
+
return c2;
|
|
154
|
+
}
|
|
155
|
+
exports.assign = i;
|
|
156
|
+
exports.createMachine = s;
|
|
157
|
+
exports.interpret = v;
|
|
158
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../../../../../node_modules/@xstate/fsm/es/index.js"],"sourcesContent":["/*! *****************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\nfunction t(t,n){var e=\"function\"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,i,o=e.call(t),a=[];try{for(;(void 0===n||n-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(i)throw i.error}}return a}var n;!function(t){t[t.NotStarted=0]=\"NotStarted\",t[t.Running=1]=\"Running\",t[t.Stopped=2]=\"Stopped\"}(n||(n={}));var e={type:\"xstate.init\"};function r(t){return void 0===t?[]:[].concat(t)}function i(t){return{type:\"xstate.assign\",assignment:t}}function o(t,n){return\"string\"==typeof(t=\"string\"==typeof t&&n&&n[t]?n[t]:t)?{type:t}:\"function\"==typeof t?{type:t.name,exec:t}:t}function a(t){return function(n){return t===n}}function u(t){return\"string\"==typeof t?{type:t}:t}function c(t,n){return{value:t,context:n,actions:[],changed:!1,matches:a(t)}}function f(t,n,e){var r=n,i=!1;return[t.filter((function(t){if(\"xstate.assign\"===t.type){i=!0;var n=Object.assign({},r);return\"function\"==typeof t.assignment?n=t.assignment(r,e):Object.keys(t.assignment).forEach((function(i){n[i]=\"function\"==typeof t.assignment[i]?t.assignment[i](r,e):t.assignment[i]})),r=n,!1}return!0})),r,i]}function s(n,i){void 0===i&&(i={});var s=t(f(r(n.states[n.initial].entry).map((function(t){return o(t,i.actions)})),n.context,e),2),l=s[0],v=s[1],y={config:n,_options:i,initialState:{value:n.initial,actions:l,context:v,matches:a(n.initial)},transition:function(e,i){var s,l,v=\"string\"==typeof e?{value:e,context:n.context}:e,p=v.value,g=v.context,d=u(i),x=n.states[p];if(x.on){var m=r(x.on[d.type]);try{for(var h=function(t){var n=\"function\"==typeof Symbol&&Symbol.iterator,e=n&&t[n],r=0;if(e)return e.call(t);if(t&&\"number\"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(n?\"Object is not iterable.\":\"Symbol.iterator is not defined.\")}(m),b=h.next();!b.done;b=h.next()){var S=b.value;if(void 0===S)return c(p,g);var w=\"string\"==typeof S?{target:S}:S,j=w.target,E=w.actions,R=void 0===E?[]:E,N=w.cond,O=void 0===N?function(){return!0}:N,_=void 0===j,k=null!=j?j:p,T=n.states[k];if(O(g,d)){var q=t(f((_?r(R):[].concat(x.exit,R,T.entry).filter((function(t){return t}))).map((function(t){return o(t,y._options.actions)})),g,d),3),z=q[0],A=q[1],B=q[2],C=null!=j?j:p;return{value:C,context:A,actions:z,changed:j!==p||z.length>0||B,matches:a(C)}}}}catch(t){s={error:t}}finally{try{b&&!b.done&&(l=h.return)&&l.call(h)}finally{if(s)throw s.error}}}return c(p,g)}};return y}var l=function(t,n){return t.actions.forEach((function(e){var r=e.exec;return r&&r(t.context,n)}))};function v(t){var r=t.initialState,i=n.NotStarted,o=new Set,c={_machine:t,send:function(e){i===n.Running&&(r=t.transition(r,e),l(r,u(e)),o.forEach((function(t){return t(r)})))},subscribe:function(t){return o.add(t),t(r),{unsubscribe:function(){return o.delete(t)}}},start:function(o){if(o){var u=\"object\"==typeof o?o:{context:t.config.context,value:o};r={value:u.value,actions:[],context:u.context,matches:a(u.value)}}else r=t.initialState;return i=n.Running,l(r,e),c},stop:function(){return i=n.Stopped,o.clear(),c},get state(){return r},get status(){return i}};return c}export{n as InterpreterStatus,i as assign,s as createMachine,v as interpret};\n"],"names":["t","e","r","i","o","a","n","s","l","v","c","u"],"mappings":";;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcA,SAAS,EAAEA,IAAE,GAAE;AAAC,MAAIC,KAAE,cAAY,OAAO,UAAQD,GAAE,OAAO;AAAU,MAAG,CAACC;AAAE,WAAOD;AAAE,MAAIE,IAAEC,IAAEC,KAAEH,GAAE,KAAKD,EAAC,GAAEK,KAAE,CAAE;AAAC,MAAG;AAAC,YAAM,WAAS,KAAG,MAAK,MAAI,EAAEH,KAAEE,GAAE,KAAI,GAAI;AAAM,MAAAC,GAAE,KAAKH,GAAE,KAAK;AAAA,EAAC,SAAOF,IAAN;AAAS,IAAAG,KAAE,EAAC,OAAMH,GAAC;AAAA,EAAC,UAAC;AAAQ,QAAG;AAAC,MAAAE,MAAG,CAACA,GAAE,SAAOD,KAAEG,GAAE,WAASH,GAAE,KAAKG,EAAC;AAAA,IAAC,UAAC;AAAQ,UAAGD;AAAE,cAAMA,GAAE;AAAA,IAAK;AAAA,EAAC;AAAC,SAAOE;AAAC;AAAKC,QAAE,oBAAA;AAAA,CAAC,SAASN,IAAE;AAAC,EAAAA,GAAEA,GAAE,aAAW,KAAG,cAAaA,GAAEA,GAAE,UAAQ,KAAG,WAAUA,GAAEA,GAAE,UAAQ,KAAG;AAAS,EAAEM,QAAC,sBAAGA,4BAAE,CAAA,EAAG;AAAE,IAAI,IAAE,EAAC,M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