@anker-in/lib 0.0.0-beta.1 → 0.0.0-beta.3
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/.gitkeep +0 -0
- package/.turbo/turbo-build.log +22 -0
- package/.turbo/turbo-test.log +5 -0
- package/dist/cjs/context/HeadlessProvider.js +1 -1
- package/dist/cjs/context/HeadlessProvider.js.map +2 -2
- package/dist/context/HeadlessProvider.d.ts.map +1 -1
- package/dist/esm/cart/const.js +2 -0
- package/dist/esm/cart/const.js.map +7 -0
- package/dist/esm/cart/hooks/basic/useBuyNow.js +2 -0
- package/dist/esm/cart/hooks/basic/useBuyNow.js.map +7 -0
- package/dist/esm/cart/index.js +2 -0
- package/dist/esm/cart/index.js.map +7 -0
- package/dist/esm/cart/track/fbq.js +2 -0
- package/dist/esm/cart/track/fbq.js.map +7 -0
- package/dist/esm/cart/types/index.js +1 -0
- package/dist/esm/cart/types/index.js.map +7 -0
- package/dist/esm/cart/utils/index.js +2 -0
- package/dist/esm/cart/utils/index.js.map +7 -0
- package/dist/esm/context/HeadlessProvider.js +2 -0
- package/dist/esm/context/HeadlessProvider.js.map +7 -0
- package/dist/esm/context/config.js +1 -0
- package/dist/esm/context/config.js.map +7 -0
- package/dist/esm/context/index.js +2 -0
- package/dist/esm/context/index.js.map +7 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/shopify/fetchers/add-cart-lines.js +2 -0
- package/dist/esm/shopify/fetchers/add-cart-lines.js.map +7 -0
- package/dist/esm/shopify/fetchers/create-cart.js +2 -0
- package/dist/esm/shopify/fetchers/create-cart.js.map +7 -0
- package/dist/esm/shopify/fetchers/get-cart.js +2 -0
- package/dist/esm/shopify/fetchers/get-cart.js.map +7 -0
- package/dist/esm/shopify/fetchers/get-products-by-handles.js +2 -0
- package/dist/esm/shopify/fetchers/get-products-by-handles.js.map +7 -0
- package/dist/esm/shopify/fetchers/index.js +2 -0
- package/dist/esm/shopify/fetchers/index.js.map +7 -0
- package/dist/esm/shopify/fetchers/remove-cart-lines.js +2 -0
- package/dist/esm/shopify/fetchers/remove-cart-lines.js.map +7 -0
- package/dist/esm/shopify/fetchers/update-cart-attributes.js +2 -0
- package/dist/esm/shopify/fetchers/update-cart-attributes.js.map +7 -0
- package/dist/esm/shopify/fetchers/update-cart-buyer-identity.js +2 -0
- package/dist/esm/shopify/fetchers/update-cart-buyer-identity.js.map +7 -0
- package/dist/esm/shopify/fetchers/update-cart-codes.js +2 -0
- package/dist/esm/shopify/fetchers/update-cart-codes.js.map +7 -0
- package/dist/esm/shopify/fetchers/update-cart-lines.js +2 -0
- package/dist/esm/shopify/fetchers/update-cart-lines.js.map +7 -0
- package/dist/esm/shopify/fragments/article.js +50 -0
- package/dist/esm/shopify/fragments/article.js.map +7 -0
- package/dist/esm/shopify/fragments/blog.js +11 -0
- package/dist/esm/shopify/fragments/blog.js.map +7 -0
- package/dist/esm/shopify/fragments/cart.js +189 -0
- package/dist/esm/shopify/fragments/cart.js.map +7 -0
- package/dist/esm/shopify/fragments/collection.js +16 -0
- package/dist/esm/shopify/fragments/collection.js.map +7 -0
- package/dist/esm/shopify/fragments/image.js +9 -0
- package/dist/esm/shopify/fragments/image.js.map +7 -0
- package/dist/esm/shopify/fragments/index.js +2 -0
- package/dist/esm/shopify/fragments/index.js.map +7 -0
- package/dist/esm/shopify/fragments/metafields.js +16 -0
- package/dist/esm/shopify/fragments/metafields.js.map +7 -0
- package/dist/esm/shopify/fragments/page-info.js +9 -0
- package/dist/esm/shopify/fragments/page-info.js.map +7 -0
- package/dist/esm/shopify/fragments/page.js +13 -0
- package/dist/esm/shopify/fragments/page.js.map +7 -0
- package/dist/esm/shopify/fragments/product.js +72 -0
- package/dist/esm/shopify/fragments/product.js.map +7 -0
- package/dist/esm/shopify/fragments/seo.js +7 -0
- package/dist/esm/shopify/fragments/seo.js.map +7 -0
- package/dist/esm/shopify/fragments/variant.js +30 -0
- package/dist/esm/shopify/fragments/variant.js.map +7 -0
- package/dist/esm/shopify/gql/fragment-masking.js +2 -0
- package/dist/esm/shopify/gql/fragment-masking.js.map +7 -0
- package/dist/esm/shopify/gql/gql.js +2 -0
- package/dist/esm/shopify/gql/gql.js.map +7 -0
- package/dist/esm/shopify/gql/graphql.js +2 -0
- package/dist/esm/shopify/gql/graphql.js.map +7 -0
- package/dist/esm/shopify/gql/index.js +2 -0
- package/dist/esm/shopify/gql/index.js.map +7 -0
- package/dist/esm/shopify/hooks/index.js +2 -0
- package/dist/esm/shopify/hooks/index.js.map +7 -0
- package/dist/esm/shopify/hooks/useProductsByHandles.js +2 -0
- package/dist/esm/shopify/hooks/useProductsByHandles.js.map +7 -0
- package/dist/esm/shopify/index.js +2 -0
- package/dist/esm/shopify/index.js.map +7 -0
- package/dist/esm/shopify/mutations/add-cart-lines.js +15 -0
- package/dist/esm/shopify/mutations/add-cart-lines.js.map +7 -0
- package/dist/esm/shopify/mutations/create-cart.js +21 -0
- package/dist/esm/shopify/mutations/create-cart.js.map +7 -0
- package/dist/esm/shopify/mutations/remove-cart-items.js +15 -0
- package/dist/esm/shopify/mutations/remove-cart-items.js.map +7 -0
- package/dist/esm/shopify/mutations/update-cart-attributes.js +15 -0
- package/dist/esm/shopify/mutations/update-cart-attributes.js.map +7 -0
- package/dist/esm/shopify/mutations/update-cart-buyer-identity.js +15 -0
- package/dist/esm/shopify/mutations/update-cart-buyer-identity.js.map +7 -0
- package/dist/esm/shopify/mutations/update-cart-discount-code.js +15 -0
- package/dist/esm/shopify/mutations/update-cart-discount-code.js.map +7 -0
- package/dist/esm/shopify/mutations/update-cart-items.js +15 -0
- package/dist/esm/shopify/mutations/update-cart-items.js.map +7 -0
- package/dist/esm/shopify/queries/get-cart.js +13 -0
- package/dist/esm/shopify/queries/get-cart.js.map +7 -0
- package/dist/esm/shopify/queries/get-product-by-handles.js +29 -0
- package/dist/esm/shopify/queries/get-product-by-handles.js.map +7 -0
- package/dist/esm/shopify/queries/index.js +2 -0
- package/dist/esm/shopify/queries/index.js.map +7 -0
- package/dist/esm/shopify/types/article.js +1 -0
- package/dist/esm/shopify/types/article.js.map +7 -0
- package/dist/esm/shopify/types/cart.js +1 -0
- package/dist/esm/shopify/types/cart.js.map +7 -0
- package/dist/esm/shopify/types/checkout.js +1 -0
- package/dist/esm/shopify/types/checkout.js.map +7 -0
- package/dist/esm/shopify/types/collection.js +1 -0
- package/dist/esm/shopify/types/collection.js.map +7 -0
- package/dist/esm/shopify/types/common.js +1 -0
- package/dist/esm/shopify/types/common.js.map +7 -0
- package/dist/esm/shopify/types/config.js +1 -0
- package/dist/esm/shopify/types/config.js.map +7 -0
- package/dist/esm/shopify/types/customer.js +1 -0
- package/dist/esm/shopify/types/customer.js.map +7 -0
- package/dist/esm/shopify/types/fetcher.js +2 -0
- package/dist/esm/shopify/types/fetcher.js.map +7 -0
- package/dist/esm/shopify/types/index.js +2 -0
- package/dist/esm/shopify/types/index.js.map +7 -0
- package/dist/esm/shopify/types/page.js +1 -0
- package/dist/esm/shopify/types/page.js.map +7 -0
- package/dist/esm/shopify/types/product.js +1 -0
- package/dist/esm/shopify/types/product.js.map +7 -0
- package/dist/esm/shopify/types/search.js +1 -0
- package/dist/esm/shopify/types/search.js.map +7 -0
- package/dist/esm/shopify/types/site.js +1 -0
- package/dist/esm/shopify/types/site.js.map +7 -0
- package/dist/esm/shopify/types/type-helper.js +1 -0
- package/dist/esm/shopify/types/type-helper.js.map +7 -0
- package/dist/esm/shopify/utils/colors.js +2 -0
- package/dist/esm/shopify/utils/colors.js.map +7 -0
- package/dist/esm/shopify/utils/const.js +2 -0
- package/dist/esm/shopify/utils/const.js.map +7 -0
- package/dist/esm/shopify/utils/cookie.js +2 -0
- package/dist/esm/shopify/utils/cookie.js.map +7 -0
- package/dist/esm/shopify/utils/errors.js +3 -0
- package/dist/esm/shopify/utils/errors.js.map +7 -0
- package/dist/esm/shopify/utils/fetch-graphql-api.js +3 -0
- package/dist/esm/shopify/utils/fetch-graphql-api.js.map +7 -0
- package/dist/esm/shopify/utils/handle-fetch-response.js +2 -0
- package/dist/esm/shopify/utils/handle-fetch-response.js.map +7 -0
- package/dist/esm/shopify/utils/helper.js +2 -0
- package/dist/esm/shopify/utils/helper.js.map +7 -0
- package/dist/esm/shopify/utils/normalize/cart.js +2 -0
- package/dist/esm/shopify/utils/normalize/cart.js.map +7 -0
- package/dist/esm/shopify/utils/normalize/customer.js +2 -0
- package/dist/esm/shopify/utils/normalize/customer.js.map +7 -0
- package/dist/esm/shopify/utils/normalize/index.js +2 -0
- package/dist/esm/shopify/utils/normalize/index.js.map +7 -0
- package/dist/esm/shopify/utils/normalize/metafield.js +2 -0
- package/dist/esm/shopify/utils/normalize/metafield.js.map +7 -0
- package/dist/esm/shopify/utils/normalize/product.js +2 -0
- package/dist/esm/shopify/utils/normalize/product.js.map +7 -0
- package/dist/esm/shopify/utils/store.js +2 -0
- package/dist/esm/shopify/utils/store.js.map +7 -0
- package/dist/esm/shopify/utils/type-helper.js +1 -0
- package/dist/esm/shopify/utils/type-helper.js.map +7 -0
- package/esbuild-cjs.mjs +23 -0
- package/esbuild-esm.mjs +30 -0
- package/jest.config.ts +12 -0
- package/package.json +10 -15
- package/src/cart/const.ts +23 -0
- package/src/cart/hooks/basic/useBuyNow.ts +105 -0
- package/src/cart/index.ts +19 -0
- package/src/cart/track/fbq.ts +63 -0
- package/src/cart/types/index.ts +25 -0
- package/src/cart/utils/index.ts +22 -0
- package/src/context/HeadlessProvider.tsx +30 -0
- package/src/context/config.ts +10 -0
- package/src/context/index.ts +3 -0
- package/src/index.ts +22 -0
- package/src/shopify/fetchers/add-cart-lines.ts +53 -0
- package/src/shopify/fetchers/create-cart.ts +43 -0
- package/src/shopify/fetchers/get-cart.ts +48 -0
- package/src/shopify/fetchers/get-products-by-handles.ts +48 -0
- package/src/shopify/fetchers/index.ts +10 -0
- package/src/shopify/fetchers/remove-cart-lines.ts +31 -0
- package/src/shopify/fetchers/update-cart-attributes.ts +29 -0
- package/src/shopify/fetchers/update-cart-buyer-identity.ts +32 -0
- package/src/shopify/fetchers/update-cart-codes.ts +32 -0
- package/src/shopify/fetchers/update-cart-lines.ts +42 -0
- package/src/shopify/fragments/article.ts +51 -0
- package/src/shopify/fragments/blog.ts +10 -0
- package/src/shopify/fragments/cart.ts +193 -0
- package/src/shopify/fragments/collection.ts +15 -0
- package/src/shopify/fragments/image.ts +8 -0
- package/src/shopify/fragments/index.ts +11 -0
- package/src/shopify/fragments/metafields.ts +17 -0
- package/src/shopify/fragments/page-info.ts +8 -0
- package/src/shopify/fragments/page.ts +12 -0
- package/src/shopify/fragments/product.ts +71 -0
- package/src/shopify/fragments/seo.ts +6 -0
- package/src/shopify/fragments/variant.ts +29 -0
- package/src/shopify/gql/fragment-masking.ts +85 -0
- package/src/shopify/gql/gql.ts +110 -0
- package/src/shopify/gql/graphql.ts +11780 -0
- package/src/shopify/gql/index.ts +4 -0
- package/src/shopify/hooks/index.ts +1 -0
- package/src/shopify/hooks/useProductsByHandles.ts +24 -0
- package/src/shopify/index.ts +5 -0
- package/src/shopify/mutations/add-cart-lines.ts +16 -0
- package/src/shopify/mutations/create-cart.ts +22 -0
- package/src/shopify/mutations/remove-cart-items.ts +16 -0
- package/src/shopify/mutations/update-cart-attributes.ts +16 -0
- package/src/shopify/mutations/update-cart-buyer-identity.ts +16 -0
- package/src/shopify/mutations/update-cart-discount-code.ts +16 -0
- package/src/shopify/mutations/update-cart-items.ts +16 -0
- package/src/shopify/queries/get-cart.ts +14 -0
- package/src/shopify/queries/get-product-by-handles.ts +32 -0
- package/src/shopify/queries/index.ts +2 -0
- package/src/shopify/types/article.ts +46 -0
- package/src/shopify/types/cart.ts +204 -0
- package/src/shopify/types/checkout.ts +44 -0
- package/src/shopify/types/collection.ts +104 -0
- package/src/shopify/types/common.ts +53 -0
- package/src/shopify/types/config.ts +14 -0
- package/src/shopify/types/customer.ts +31 -0
- package/src/shopify/types/fetcher.ts +67 -0
- package/src/shopify/types/index.ts +11 -0
- package/src/shopify/types/page.ts +45 -0
- package/src/shopify/types/product.ts +176 -0
- package/src/shopify/types/search.ts +62 -0
- package/src/shopify/types/site.ts +38 -0
- package/src/shopify/types/type-helper.ts +5 -0
- package/src/shopify/utils/colors.ts +206 -0
- package/src/shopify/utils/const.ts +115 -0
- package/src/shopify/utils/cookie.ts +28 -0
- package/src/shopify/utils/errors.ts +65 -0
- package/src/shopify/utils/fetch-graphql-api.ts +67 -0
- package/src/shopify/utils/handle-fetch-response.ts +60 -0
- package/src/shopify/utils/helper.ts +89 -0
- package/src/shopify/utils/normalize/cart.ts +106 -0
- package/src/shopify/utils/normalize/customer.ts +18 -0
- package/src/shopify/utils/normalize/index.ts +2 -0
- package/src/shopify/utils/normalize/metafield.ts +69 -0
- package/src/shopify/utils/normalize/product.ts +193 -0
- package/src/shopify/utils/store.ts +5 -0
- package/src/shopify/utils/type-helper.ts +7 -0
- package/tsconfig.json +20 -0
- package/tsup.config.ts +17 -0
- package/dist/index.esm.js +0 -1669
- package/dist/index.js +0 -1679
- package/dist/index.mjs +0 -1669
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import n from"swr";import{useHeadlessContext as i}from"../../context";import{getProductsByHandles as d}from"../fetchers/get-products-by-handles";function H({handles:o,metafieldIdentifiers:e}){const{storefrontToken:t,storeDomain:r,comboMetafieldsNamespace:s}=i();return n(o?.length?{handles:o,metafieldIdentifiers:e}:void 0,async()=>d({options:{handles:o,metafieldIdentifiers:e,comboMetafieldsNamespace:s},config:{storefrontToken:t,storeDomain:r}}))}export{H as useProductsByHandles};
|
|
2
|
+
//# sourceMappingURL=useProductsByHandles.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/shopify/hooks/useProductsByHandles.ts"],
|
|
4
|
+
"sourcesContent": ["import useSWR from 'swr'\nimport { useHeadlessContext } from '../../context'\n\nimport { getProductsByHandles, GetProductsMetafieldQueryRoot } from '../fetchers/get-products-by-handles'\nimport { ShopifyHookOptions } from '../types/fetcher'\nimport { GetProductsByHandlesReq } from '../fetchers/get-products-by-handles'\n\nexport function useProductsByHandles({\n handles,\n metafieldIdentifiers,\n}: ShopifyHookOptions<GetProductsByHandlesReq, GetProductsMetafieldQueryRoot>) {\n const { storefrontToken, storeDomain, comboMetafieldsNamespace } = useHeadlessContext()\n\n return useSWR(handles?.length ? { handles, metafieldIdentifiers } : undefined, async () => {\n return getProductsByHandles({\n options: {\n handles: handles,\n metafieldIdentifiers: metafieldIdentifiers,\n comboMetafieldsNamespace,\n },\n config: { storefrontToken, storeDomain },\n })\n })\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAOA,MAAY,MACnB,OAAS,sBAAAC,MAA0B,gBAEnC,OAAS,wBAAAC,MAA2D,sCAI7D,SAASC,EAAqB,CACnC,QAAAC,EACA,qBAAAC,CACF,EAA+E,CAC7E,KAAM,CAAE,gBAAAC,EAAiB,YAAAC,EAAa,yBAAAC,CAAyB,EAAIP,EAAmB,EAEtF,OAAOD,EAAOI,GAAS,OAAS,CAAE,QAAAA,EAAS,qBAAAC,CAAqB,EAAI,OAAW,SACtEH,EAAqB,CAC1B,QAAS,CACP,QAASE,EACT,qBAAsBC,EACtB,yBAAAG,CACF,EACA,OAAQ,CAAE,gBAAAF,EAAiB,YAAAC,CAAY,CACzC,CAAC,CACF,CACH",
|
|
6
|
+
"names": ["useSWR", "useHeadlessContext", "getProductsByHandles", "useProductsByHandles", "handles", "metafieldIdentifiers", "storefrontToken", "storeDomain", "comboMetafieldsNamespace"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/shopify/index.ts"],
|
|
4
|
+
"sourcesContent": ["export * from './fetchers'\nexport * from './hooks'\nexport * from './queries'\nexport * from './fragments'\nexport * from './types'\n"],
|
|
5
|
+
"mappings": "AAAA,WAAc,aACd,WAAc,UACd,WAAc,YACd,WAAc,cACd,WAAc",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{cartFragment as t}from"../fragments/cart";const a=`
|
|
2
|
+
mutation addCartLines($cartId: ID!, $lines: [CartLineInput!]!) {
|
|
3
|
+
cartLinesAdd(cartId: $cartId, lines: $lines) {
|
|
4
|
+
cart {
|
|
5
|
+
...cart
|
|
6
|
+
}
|
|
7
|
+
userErrors {
|
|
8
|
+
field
|
|
9
|
+
message
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
${t}
|
|
14
|
+
`;export{a as addCartLinesMutation};
|
|
15
|
+
//# sourceMappingURL=add-cart-lines.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/shopify/mutations/add-cart-lines.ts"],
|
|
4
|
+
"sourcesContent": ["import { cartFragment } from '../fragments/cart'\n\nexport const addCartLinesMutation = /* GraphQL */ `\n mutation addCartLines($cartId: ID!, $lines: [CartLineInput!]!) {\n cartLinesAdd(cartId: $cartId, lines: $lines) {\n cart {\n ...cart\n }\n userErrors {\n field\n message\n }\n }\n }\n ${cartFragment}\n`\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,gBAAAA,MAAoB,oBAEtB,MAAMC,EAAqC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAY9CD,CAAY;",
|
|
6
|
+
"names": ["cartFragment", "addCartLinesMutation"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{cartFragment as t}from"../fragments/cart";const i=`
|
|
2
|
+
mutation createCart(
|
|
3
|
+
$lines: [CartLineInput!]
|
|
4
|
+
$discountCodes: [String!]
|
|
5
|
+
$attributes: [AttributeInput!] = []
|
|
6
|
+
$productMetafieldIdentifiers: [HasMetafieldsIdentifier!] = []
|
|
7
|
+
$variantMetafieldIdentifiers: [HasMetafieldsIdentifier!] = []
|
|
8
|
+
) {
|
|
9
|
+
cartCreate(input: { lines: $lines, discountCodes: $discountCodes, attributes: $attributes }) {
|
|
10
|
+
cart {
|
|
11
|
+
...cart
|
|
12
|
+
}
|
|
13
|
+
userErrors {
|
|
14
|
+
field
|
|
15
|
+
message
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
${t}
|
|
20
|
+
`;export{i as createCartMutation};
|
|
21
|
+
//# sourceMappingURL=create-cart.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/shopify/mutations/create-cart.ts"],
|
|
4
|
+
"sourcesContent": ["import { cartFragment } from '../fragments/cart'\n\nexport const createCartMutation = /* GraphQL */ `\n mutation createCart(\n $lines: [CartLineInput!]\n $discountCodes: [String!]\n $attributes: [AttributeInput!] = []\n $productMetafieldIdentifiers: [HasMetafieldsIdentifier!] = []\n $variantMetafieldIdentifiers: [HasMetafieldsIdentifier!] = []\n ) {\n cartCreate(input: { lines: $lines, discountCodes: $discountCodes, attributes: $attributes }) {\n cart {\n ...cart\n }\n userErrors {\n field\n message\n }\n }\n }\n ${cartFragment}\n`\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,gBAAAA,MAAoB,oBAEtB,MAAMC,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAkB5CD,CAAY;",
|
|
6
|
+
"names": ["cartFragment", "createCartMutation"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{cartFragment as r}from"../fragments/cart";const e=`
|
|
2
|
+
mutation removeFromCart($cartId: ID!, $lineIds: [ID!]!) {
|
|
3
|
+
cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {
|
|
4
|
+
cart {
|
|
5
|
+
...cart
|
|
6
|
+
}
|
|
7
|
+
userErrors {
|
|
8
|
+
field
|
|
9
|
+
message
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
${r}
|
|
14
|
+
`;export{e as removeCartItemsMutation};
|
|
15
|
+
//# sourceMappingURL=remove-cart-items.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/shopify/mutations/remove-cart-items.ts"],
|
|
4
|
+
"sourcesContent": ["import { cartFragment } from '../fragments/cart'\n\nexport const removeCartItemsMutation = /* GraphQL */ `\n mutation removeFromCart($cartId: ID!, $lineIds: [ID!]!) {\n cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {\n cart {\n ...cart\n }\n userErrors {\n field\n message\n }\n }\n }\n ${cartFragment}\n`\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,gBAAAA,MAAoB,oBAEtB,MAAMC,EAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAYjDD,CAAY;",
|
|
6
|
+
"names": ["cartFragment", "removeCartItemsMutation"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{cartFragment as t}from"../fragments/cart";const a=`
|
|
2
|
+
mutation updateCartAttributes($cartId: ID!, $attributes: [AttributeInput!]!) {
|
|
3
|
+
cartAttributesUpdate(cartId: $cartId, attributes: $attributes) {
|
|
4
|
+
cart {
|
|
5
|
+
...cart
|
|
6
|
+
}
|
|
7
|
+
userErrors {
|
|
8
|
+
field
|
|
9
|
+
message
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
${t}
|
|
14
|
+
`;export{a as updateCartAttributesMutation};
|
|
15
|
+
//# sourceMappingURL=update-cart-attributes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/shopify/mutations/update-cart-attributes.ts"],
|
|
4
|
+
"sourcesContent": ["import { cartFragment } from '../fragments/cart'\n\nexport const updateCartAttributesMutation = /* GraphQL */ `\n mutation updateCartAttributes($cartId: ID!, $attributes: [AttributeInput!]!) {\n cartAttributesUpdate(cartId: $cartId, attributes: $attributes) {\n cart {\n ...cart\n }\n userErrors {\n field\n message\n }\n }\n }\n ${cartFragment}\n`\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,gBAAAA,MAAoB,oBAEtB,MAAMC,EAA6C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAYtDD,CAAY;",
|
|
6
|
+
"names": ["cartFragment", "updateCartAttributesMutation"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{cartFragment as t}from"../fragments/cart";const e=`
|
|
2
|
+
mutation updateCartBuyerIdentity($cartId: ID!, $buyerIdentity: CartBuyerIdentityInput!) {
|
|
3
|
+
cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {
|
|
4
|
+
cart {
|
|
5
|
+
...cart
|
|
6
|
+
}
|
|
7
|
+
userErrors {
|
|
8
|
+
field
|
|
9
|
+
message
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
${t}
|
|
14
|
+
`;export{e as updateCartBuyerIdentityMutation};
|
|
15
|
+
//# sourceMappingURL=update-cart-buyer-identity.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/shopify/mutations/update-cart-buyer-identity.ts"],
|
|
4
|
+
"sourcesContent": ["import { cartFragment } from '../fragments/cart'\n\nexport const updateCartBuyerIdentityMutation = /* GraphQL */ `\n mutation updateCartBuyerIdentity($cartId: ID!, $buyerIdentity: CartBuyerIdentityInput!) {\n cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {\n cart {\n ...cart\n }\n userErrors {\n field\n message\n }\n }\n }\n ${cartFragment}\n`\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,gBAAAA,MAAoB,oBAEtB,MAAMC,EAAgD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAYzDD,CAAY;",
|
|
6
|
+
"names": ["cartFragment", "updateCartBuyerIdentityMutation"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{cartFragment as t}from"../fragments/cart";const r=`
|
|
2
|
+
mutation updateCartDiscountCodes($cartId: ID!, $discountCodes: [String!]) {
|
|
3
|
+
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
4
|
+
cart {
|
|
5
|
+
...cart
|
|
6
|
+
}
|
|
7
|
+
userErrors {
|
|
8
|
+
field
|
|
9
|
+
message
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
${t}
|
|
14
|
+
`;export{r as updateCartDiscountCodeMutation};
|
|
15
|
+
//# sourceMappingURL=update-cart-discount-code.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/shopify/mutations/update-cart-discount-code.ts"],
|
|
4
|
+
"sourcesContent": ["import { cartFragment } from '../fragments/cart'\n\nexport const updateCartDiscountCodeMutation = /* GraphQL */ `\n mutation updateCartDiscountCodes($cartId: ID!, $discountCodes: [String!]) {\n cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {\n cart {\n ...cart\n }\n userErrors {\n field\n message\n }\n }\n }\n ${cartFragment}\n`\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,gBAAAA,MAAoB,oBAEtB,MAAMC,EAA+C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAYxDD,CAAY;",
|
|
6
|
+
"names": ["cartFragment", "updateCartDiscountCodeMutation"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{cartFragment as t}from"../fragments/cart";const r=`
|
|
2
|
+
mutation updateCartLines($cartId: ID!, $lines: [CartLineUpdateInput!]!) {
|
|
3
|
+
cartLinesUpdate(cartId: $cartId, lines: $lines) {
|
|
4
|
+
cart {
|
|
5
|
+
...cart
|
|
6
|
+
}
|
|
7
|
+
userErrors {
|
|
8
|
+
field
|
|
9
|
+
message
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
${t}
|
|
14
|
+
`;export{r as updateCartLinesMutation};
|
|
15
|
+
//# sourceMappingURL=update-cart-items.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/shopify/mutations/update-cart-items.ts"],
|
|
4
|
+
"sourcesContent": ["import { cartFragment } from '../fragments/cart'\n\nexport const updateCartLinesMutation = /* GraphQL */ `\n mutation updateCartLines($cartId: ID!, $lines: [CartLineUpdateInput!]!) {\n cartLinesUpdate(cartId: $cartId, lines: $lines) {\n cart {\n ...cart\n }\n userErrors {\n field\n message\n }\n }\n }\n ${cartFragment}\n`\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,gBAAAA,MAAoB,oBAEtB,MAAMC,EAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAYjDD,CAAY;",
|
|
6
|
+
"names": ["cartFragment", "updateCartLinesMutation"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{cartFragment as t}from"../fragments";const r=`
|
|
2
|
+
query getCart(
|
|
3
|
+
$cartId: ID!
|
|
4
|
+
$productMetafieldIdentifiers: [HasMetafieldsIdentifier!] = []
|
|
5
|
+
$variantMetafieldIdentifiers: [HasMetafieldsIdentifier!] = []
|
|
6
|
+
) {
|
|
7
|
+
cart(id: $cartId) {
|
|
8
|
+
...cart
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
${t}
|
|
12
|
+
`;export{r as getCartQuery};
|
|
13
|
+
//# sourceMappingURL=get-cart.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/shopify/queries/get-cart.ts"],
|
|
4
|
+
"sourcesContent": ["import { cartFragment } from '../fragments'\n\nexport const getCartQuery = /* GraphQL */ `\n query getCart(\n $cartId: ID!\n $productMetafieldIdentifiers: [HasMetafieldsIdentifier!] = []\n $variantMetafieldIdentifiers: [HasMetafieldsIdentifier!] = []\n ) {\n cart(id: $cartId) {\n ...cart\n }\n }\n ${cartFragment}\n`\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,gBAAAA,MAAoB,eAEtB,MAAMC,EAA6B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUtCD,CAAY;",
|
|
6
|
+
"names": ["cartFragment", "getCartQuery"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import{imageFragment as r,metafieldFragment as a,productFragment as d,seoFragment as n,variantFragment as f}from"../fragments";const m=e=>`
|
|
2
|
+
query GetProductByHandles(
|
|
3
|
+
$productMetafieldIdentifiers: [HasMetafieldsIdentifier!] = []
|
|
4
|
+
$variantMetafieldIdentifiers: [HasMetafieldsIdentifier!] = []
|
|
5
|
+
) {
|
|
6
|
+
${e.map((t,i)=>`
|
|
7
|
+
product${i}: product(handle: "${t}") {
|
|
8
|
+
...product
|
|
9
|
+
metafields(identifiers: $productMetafieldIdentifiers) {
|
|
10
|
+
...metafield
|
|
11
|
+
}
|
|
12
|
+
variants(first: 250) {
|
|
13
|
+
nodes {
|
|
14
|
+
...variant
|
|
15
|
+
metafields(identifiers: $variantMetafieldIdentifiers) {
|
|
16
|
+
...metafield
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`)}
|
|
22
|
+
}
|
|
23
|
+
${d}
|
|
24
|
+
${f}
|
|
25
|
+
${a}
|
|
26
|
+
${n}
|
|
27
|
+
${r}
|
|
28
|
+
`;export{m as getProductsByHandlesQuery};
|
|
29
|
+
//# sourceMappingURL=get-product-by-handles.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/shopify/queries/get-product-by-handles.ts"],
|
|
4
|
+
"sourcesContent": ["import { imageFragment, metafieldFragment, productFragment, seoFragment, variantFragment } from '../fragments'\n\nexport const getProductsByHandlesQuery = (handles: string[]) => /* GraphQL */ `\nquery GetProductByHandles(\n $productMetafieldIdentifiers: [HasMetafieldsIdentifier!] = []\n $variantMetafieldIdentifiers: [HasMetafieldsIdentifier!] = []\n) {\n ${handles.map(\n (handle, index: number) => /* GraphQL */ `\n product${index}: product(handle: \"${handle}\") {\n ...product\n metafields(identifiers: $productMetafieldIdentifiers) {\n ...metafield\n }\n variants(first: 250) {\n nodes {\n ...variant\n metafields(identifiers: $variantMetafieldIdentifiers) {\n ...metafield\n }\n }\n }\n }\n `\n )}\n}\n${productFragment}\n${variantFragment}\n${metafieldFragment}\n${seoFragment}\n${imageFragment}\n`\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,iBAAAA,EAAe,qBAAAC,EAAmB,mBAAAC,EAAiB,eAAAC,EAAa,mBAAAC,MAAuB,eAEzF,MAAMC,EAA6BC,GAAoC;AAAA;AAAA;AAAA;AAAA;AAAA,IAK1EA,EAAQ,IACR,CAACC,EAAQC,IAAgC;AAAA,aAChCA,CAAK,sBAAsBD,CAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAe5C,CAAC;AAAA;AAAA,EAEDL,CAAe;AAAA,EACfE,CAAe;AAAA,EACfH,CAAiB;AAAA,EACjBE,CAAW;AAAA,EACXH,CAAa;",
|
|
6
|
+
"names": ["imageFragment", "metafieldFragment", "productFragment", "seoFragment", "variantFragment", "getProductsByHandlesQuery", "handles", "handle", "index"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=article.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=cart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=checkout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=customer.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var t=(e=>(e.Product="product",e.Variant="variant",e.Page="page",e.Article="article",e.Blog="blog",e.Collection="collection",e.Shop="shop",e.Cart="product | variant",e.Customer="customer",e.Location="location",e.Market="market",e.Order="order",e))(t||{});export{t as HasMetafieldQueryRoot};
|
|
2
|
+
//# sourceMappingURL=fetcher.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/shopify/types/fetcher.ts"],
|
|
4
|
+
"sourcesContent": ["import { HasMetafieldsIdentifier } from '../gql'\nimport { PartialRecord } from './type-helper'\nimport { SWRMutationResponse } from 'swr/mutation'\nimport { ShopifyConfig } from './config'\n\ntype RequestBasicParams = {\n query?: string\n config: ShopifyConfig\n}\n\nexport enum HasMetafieldQueryRoot {\n Product = 'product',\n Variant = 'variant',\n Page = 'page',\n Article = 'article',\n Blog = 'blog',\n Collection = 'collection',\n Shop = 'shop',\n Cart = 'product | variant',\n Customer = 'customer',\n Location = 'location',\n Market = 'market',\n Order = 'order',\n}\n\nexport type ConstructMetafieldIdentifiersQueryInput<Roots extends HasMetafieldQueryRoot> = Partial<\n Record<Roots, HasMetafieldsIdentifier[]>\n>\nexport type metafieldIdentifiersGroup<M extends HasMetafieldQueryRoot> = {\n metafieldIdentifiers?: PartialRecord<\n M,\n HasMetafieldsIdentifier[] // MetafieldIdentifiers[]\n >\n comboMetafieldsNamespace?: string\n}\n\ntype RequestWithOptions<T, M extends HasMetafieldQueryRoot> = RequestBasicParams & {\n options: T & metafieldIdentifiersGroup<M>\n}\n\nexport type ShopifyFetcherVariables<T, M extends HasMetafieldQueryRoot> = M extends HasMetafieldQueryRoot\n ? T & PartialRecord<`${M}MetafieldIdentifiers`, HasMetafieldsIdentifier[]>\n : T\n\n// Shopify Fetcher \u5DE5\u5177\u7C7B\uFF0C\u65B0\u589E\u9664\u8BF7\u6C42\u53C2\u6570\u5916\u7EDF\u4E00\u7684 shopify config\uFF08\u5E97\u94FA\u57DF\u540D\uFF0C storefront token) \u548C metafields \u76F8\u5173\u53C2\u6570\nexport type ShopifyFetcher<\n Data = Record<string, any>,\n Req = undefined,\n Metafields extends HasMetafieldQueryRoot = HasMetafieldQueryRoot,\n> = (\n req: Req extends Record<string, any>\n ? RequestWithOptions<Req, Metafields> & { config: ShopifyConfig }\n : RequestBasicParams & { config: ShopifyConfig }\n) => Promise<Data>\n\nexport type ShopifyHookOptions<T, M extends HasMetafieldQueryRoot> = {\n locale?: string\n query?: string\n metafieldIdentifiers?: PartialRecord<\n M,\n HasMetafieldsIdentifier[] // MetafieldIdentifiers[]\n >\n} & T\n\nexport type ShopifyMutationHook<Req, Metafields extends HasMetafieldQueryRoot> = (\n options: ShopifyHookOptions<Req, Metafields>\n) => SWRMutationResponse\n"],
|
|
5
|
+
"mappings": "AAUO,IAAKA,OACVA,EAAA,QAAU,UACVA,EAAA,QAAU,UACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,KAAO,OACPA,EAAA,WAAa,aACbA,EAAA,KAAO,OACPA,EAAA,KAAO,oBACPA,EAAA,SAAW,WACXA,EAAA,SAAW,WACXA,EAAA,OAAS,SACTA,EAAA,MAAQ,QAZEA,OAAA",
|
|
6
|
+
"names": ["HasMetafieldQueryRoot"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export*from"./common";export*from"./cart";export*from"./checkout";export*from"./page";export*from"./product";export*from"./site";export*from"./collection";export*from"./search";export*from"./article";export*from"./customer";export*from"./config";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/shopify/types/index.ts"],
|
|
4
|
+
"sourcesContent": ["export * from './common'\nexport * from './cart'\nexport * from './checkout'\nexport * from './page'\nexport * from './product'\nexport * from './site'\nexport * from './collection'\nexport * from './search'\nexport * from './article'\nexport * from './customer'\nexport * from './config'\n"],
|
|
5
|
+
"mappings": "AAAA,WAAc,WACd,WAAc,SACd,WAAc,aACd,WAAc,SACd,WAAc,YACd,WAAc,SACd,WAAc,eACd,WAAc,WACd,WAAc,YACd,WAAc,aACd,WAAc",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=product.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=site.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=type-helper.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import d from"lodash.random";function u(){const e=["#37B679","#DA3C3C","#3291FF","#7928CA","#79FFE1"],F=()=>d(0,e.length-1);let r=F(),a=F();for(;a===r;)a=F();return[e[r],e[a]]}function n(e=""){const F=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!F)return[0,0,0];let r=F[0];F[0].length===3&&(r=r.split("").map(l=>l+l).join(""));const a=parseInt(r,16),o=a>>16&255,t=a>>8&255,g=a&255;return[o,t,g]}const i={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#00FFFF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blue:"#0000FF",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",burgandy:"#800020",burgundy:"#800020",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgreen:"#006400",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#FF00FF",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",green:"#008000",greenyellow:"#ADFF2F",grey:"#808080",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgreen:"#90EE90",lightgrey:"#D3D3D3",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#00FF00",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#FF0000",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",spacegrey:"#65737e",spacegray:"#65737e",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFFFFF",whitesmoke:"#F5F5F5",yellow:"#FFFF00",yellowgreen:"#9ACD32"};function D(e=""){e=e.toLowerCase();let F=i[e]?n(i[e]):n(e);return(F[0]*299+F[1]*587+F[2]*114)/1e3<128}export{i as colorMap,u as getRandomPairOfColors,D as isDark};
|
|
2
|
+
//# sourceMappingURL=colors.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/shopify/utils/colors.ts"],
|
|
4
|
+
"sourcesContent": ["import random from 'lodash.random'\n\nexport function getRandomPairOfColors() {\n const colors = ['#37B679', '#DA3C3C', '#3291FF', '#7928CA', '#79FFE1']\n const getRandomIdx = () => random(0, colors.length - 1)\n let idx = getRandomIdx()\n let idx2 = getRandomIdx()\n\n // Has to be a different color\n while (idx2 === idx) {\n idx2 = getRandomIdx()\n }\n\n // Returns a pair of colors\n return [colors[idx], colors[idx2]]\n}\n\nfunction hexToRgb(hex: string = '') {\n // @ts-ignore\n const match = hex.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i)\n\n if (!match) {\n return [0, 0, 0]\n }\n\n let colorString = match[0]\n\n if (match[0].length === 3) {\n colorString = colorString\n .split('')\n .map((char: string) => {\n return char + char\n })\n .join('')\n }\n\n const integer = parseInt(colorString, 16)\n const r = (integer >> 16) & 0xff\n const g = (integer >> 8) & 0xff\n const b = integer & 0xff\n\n return [r, g, b]\n}\n\nexport const colorMap: Record<string, string> = {\n aliceblue: '#F0F8FF',\n antiquewhite: '#FAEBD7',\n aqua: '#00FFFF',\n aquamarine: '#7FFFD4',\n azure: '#F0FFFF',\n beige: '#F5F5DC',\n bisque: '#FFE4C4',\n black: '#000000',\n blanchedalmond: '#FFEBCD',\n blue: '#0000FF',\n blueviolet: '#8A2BE2',\n brown: '#A52A2A',\n burlywood: '#DEB887',\n burgandy: '#800020',\n burgundy: '#800020',\n cadetblue: '#5F9EA0',\n chartreuse: '#7FFF00',\n chocolate: '#D2691E',\n coral: '#FF7F50',\n cornflowerblue: '#6495ED',\n cornsilk: '#FFF8DC',\n crimson: '#DC143C',\n cyan: '#00FFFF',\n darkblue: '#00008B',\n darkcyan: '#008B8B',\n darkgoldenrod: '#B8860B',\n darkgray: '#A9A9A9',\n darkgreen: '#006400',\n darkgrey: '#A9A9A9',\n darkkhaki: '#BDB76B',\n darkmagenta: '#8B008B',\n darkolivegreen: '#556B2F',\n darkorange: '#FF8C00',\n darkorchid: '#9932CC',\n darkred: '#8B0000',\n darksalmon: '#E9967A',\n darkseagreen: '#8FBC8F',\n darkslateblue: '#483D8B',\n darkslategray: '#2F4F4F',\n darkslategrey: '#2F4F4F',\n darkturquoise: '#00CED1',\n darkviolet: '#9400D3',\n deeppink: '#FF1493',\n deepskyblue: '#00BFFF',\n dimgray: '#696969',\n dimgrey: '#696969',\n dodgerblue: '#1E90FF',\n firebrick: '#B22222',\n floralwhite: '#FFFAF0',\n forestgreen: '#228B22',\n fuchsia: '#FF00FF',\n gainsboro: '#DCDCDC',\n ghostwhite: '#F8F8FF',\n gold: '#FFD700',\n goldenrod: '#DAA520',\n gray: '#808080',\n green: '#008000',\n greenyellow: '#ADFF2F',\n grey: '#808080',\n honeydew: '#F0FFF0',\n hotpink: '#FF69B4',\n indianred: '#CD5C5C',\n indigo: '#4B0082',\n ivory: '#FFFFF0',\n khaki: '#F0E68C',\n lavender: '#E6E6FA',\n lavenderblush: '#FFF0F5',\n lawngreen: '#7CFC00',\n lemonchiffon: '#FFFACD',\n lightblue: '#ADD8E6',\n lightcoral: '#F08080',\n lightcyan: '#E0FFFF',\n lightgoldenrodyellow: '#FAFAD2',\n lightgray: '#D3D3D3',\n lightgreen: '#90EE90',\n lightgrey: '#D3D3D3',\n lightpink: '#FFB6C1',\n lightsalmon: '#FFA07A',\n lightseagreen: '#20B2AA',\n lightskyblue: '#87CEFA',\n lightslategray: '#778899',\n lightslategrey: '#778899',\n lightsteelblue: '#B0C4DE',\n lightyellow: '#FFFFE0',\n lime: '#00FF00',\n limegreen: '#32CD32',\n linen: '#FAF0E6',\n magenta: '#FF00FF',\n maroon: '#800000',\n mediumaquamarine: '#66CDAA',\n mediumblue: '#0000CD',\n mediumorchid: '#BA55D3',\n mediumpurple: '#9370DB',\n mediumseagreen: '#3CB371',\n mediumslateblue: '#7B68EE',\n mediumspringgreen: '#00FA9A',\n mediumturquoise: '#48D1CC',\n mediumvioletred: '#C71585',\n midnightblue: '#191970',\n mintcream: '#F5FFFA',\n mistyrose: '#FFE4E1',\n moccasin: '#FFE4B5',\n navajowhite: '#FFDEAD',\n navy: '#000080',\n oldlace: '#FDF5E6',\n olive: '#808000',\n olivedrab: '#6B8E23',\n orange: '#FFA500',\n orangered: '#FF4500',\n orchid: '#DA70D6',\n palegoldenrod: '#EEE8AA',\n palegreen: '#98FB98',\n paleturquoise: '#AFEEEE',\n palevioletred: '#DB7093',\n papayawhip: '#FFEFD5',\n peachpuff: '#FFDAB9',\n peru: '#CD853F',\n pink: '#FFC0CB',\n plum: '#DDA0DD',\n powderblue: '#B0E0E6',\n purple: '#800080',\n rebeccapurple: '#663399',\n red: '#FF0000',\n rosybrown: '#BC8F8F',\n royalblue: '#4169E1',\n saddlebrown: '#8B4513',\n salmon: '#FA8072',\n sandybrown: '#F4A460',\n seagreen: '#2E8B57',\n seashell: '#FFF5EE',\n sienna: '#A0522D',\n silver: '#C0C0C0',\n skyblue: '#87CEEB',\n slateblue: '#6A5ACD',\n slategray: '#708090',\n slategrey: '#708090',\n spacegrey: '#65737e',\n spacegray: '#65737e',\n snow: '#FFFAFA',\n springgreen: '#00FF7F',\n steelblue: '#4682B4',\n tan: '#D2B48C',\n teal: '#008080',\n thistle: '#D8BFD8',\n tomato: '#FF6347',\n turquoise: '#40E0D0',\n violet: '#EE82EE',\n wheat: '#F5DEB3',\n white: '#FFFFFF',\n whitesmoke: '#F5F5F5',\n yellow: '#FFFF00',\n yellowgreen: '#9ACD32',\n}\n\nexport function isDark(color: string = ''): boolean {\n color = color.toLowerCase()\n // Equation from http://24ways.org/2010/calculating-color-contrast\n let rgb = colorMap[color] ? hexToRgb(colorMap[color]) : hexToRgb(color)\n const res = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000\n return res < 128\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["random", "getRandomPairOfColors", "colors", "getRandomIdx", "idx", "idx2", "hexToRgb", "hex", "match", "colorString", "char", "integer", "r", "g", "b", "colorMap", "isDark", "color", "rgb"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var E=(o=>(o.Storefront="storefront",o.Theme="theme",o))(E||{});const d=300,D=999999999e-2;var i=(t=>(t.Page="page",t.Product="product",t.Collection="collection",t.Blog="blog",t.Article="article",t))(i||{}),g=(o=>(o.fixedAmount="fixed_amount",o.percentage="percentage",o))(g||{});const x=s=>{const{env:r,brand:o,locales:n,googleClientId:_,facebookAppId:t,applicationName:c}=s;return{locales:n,env:r,applicationName:c?JSON.parse(c):void 0,host:r==="production"?`www.${o}.com`:`beta.${o}.com`,brand:o,googleClientId:_,facebookAppId:t}},A=["color","colour","couleur","cor","colore","farbe","\uC0C9","\u8272","\u30AB\u30E9\u30FC","f\xE4rg","farve"];var O=(e=>(e.LIGHTNING_DEAL="LIGHTNING_DEAL",e.DEAL="LIGHTNING_DEAL",e.COUPON="COUPON",e.PED="PED",e.WS24="WS24",e.WSTD="WSTD",e.WSCH="WSCH",e))(O||{});const I={us:"$",uk:"\xA3",ca:"$",eu:"\u20AC",pl:"z\u0142",fr:"\u20AC",de:"\u20AC",vn:"\u20AB",cl:"$",sg:"$",ae:"AED",es:"\u20AC"},N={us:"USD",uk:"GBP",ca:"CAD",eu:"EUR",pl:"PL",fr:"EUR",de:"EUR",vn:"VND",cl:"CLP",es:"EUR"},P={pl:"PL"},R={pl:"PL"},S="_discounts_function_env",p="_giveaway_gradient_gifts",L="_sku_code_money",a="_code_money",l=["WS24","WSTD","WS7D","WSCP","WSPE","WSPD"];export{L as CODE_AMOUNT_KEY,A as COLOR_LABEL,P as COUNTRY_CODE,N as CURRENCY_CODE,S as CUSTOMER_ATTRIBUTE_KEY,p as CUSTOMER_SCRIPT_GIFT_KEY,E as CartDataSource,O as CouponChannel,g as DiscountType,R as LANGUAGE_CODE,l as MAIN_PRODUCT_CODE,I as PRICE_SYMBOL,d as REVALIDATE_TIME,a as SCRIPT_CODE_AMOUNT_KEY,D as SOLD_OUT_PRICE,i as TemplateType,x as createConstants};
|
|
2
|
+
//# sourceMappingURL=const.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/shopify/utils/const.ts"],
|
|
4
|
+
"sourcesContent": ["// \u8D2D\u7269\u8F66\u6570\u636E\u6765\u6E90\nexport enum CartDataSource {\n Storefront = 'storefront',\n Theme = 'theme',\n}\n\nexport const REVALIDATE_TIME = 60 * 5\n\nexport const SOLD_OUT_PRICE = 9999999.99\n\nexport enum TemplateType {\n Page = 'page',\n Product = 'product',\n Collection = 'collection',\n Blog = 'blog',\n Article = 'article',\n}\n\nexport enum DiscountType {\n fixedAmount = 'fixed_amount',\n percentage = 'percentage',\n}\n\n// \u5DE5\u5177\u51FD\u6570\uFF1A\u6839\u636E\u914D\u7F6E\u751F\u6210\u5E38\u91CF\nexport const createConstants = (config: {\n env: string\n brand: string\n locales: string[]\n googleClientId?: string\n facebookAppId?: string\n applicationName?: string\n}) => {\n const { env, brand, locales, googleClientId, facebookAppId, applicationName } = config\n\n return {\n locales,\n env,\n applicationName: applicationName ? JSON.parse(applicationName) : undefined,\n host: env === 'production' ? `www.${brand}.com` : `beta.${brand}.com`,\n brand,\n googleClientId,\n facebookAppId,\n }\n}\n\n\nexport const COLOR_LABEL = [\n 'color',\n 'colour',\n 'couleur',\n 'cor',\n 'colore',\n 'farbe',\n '\uC0C9',\n '\u8272',\n '\u30AB\u30E9\u30FC',\n 'f\u00E4rg',\n 'farve',\n]\n\nexport enum CouponChannel {\n LIGHTNING_DEAL = 'LIGHTNING_DEAL',\n DEAL = 'LIGHTNING_DEAL',\n COUPON = 'COUPON',\n PED = 'PED',\n WS24 = 'WS24',\n WSTD = 'WSTD',\n WSCH = 'WSCH',\n}\n\nexport const PRICE_SYMBOL = {\n us: '$',\n uk: '\u00A3',\n ca: '$',\n eu: '\u20AC',\n pl: 'z\u0142',\n fr: '\u20AC',\n de: '\u20AC',\n vn: '\u20AB',\n cl: '$',\n sg: '$',\n ae: 'AED',\n es: '\u20AC',\n}\n\nexport const CURRENCY_CODE = {\n us: 'USD',\n uk: 'GBP',\n ca: 'CAD',\n eu: 'EUR',\n pl: 'PL',\n fr: 'EUR',\n de: 'EUR',\n vn: 'VND',\n cl: 'CLP',\n es: 'EUR',\n}\n\nexport const COUNTRY_CODE = {\n pl: 'PL',\n} as Record<string, string>\n\nexport const LANGUAGE_CODE = {\n pl: 'PL',\n} as Record<string, string>\n\n\nexport const CUSTOMER_ATTRIBUTE_KEY = '_discounts_function_env'\nexport const CUSTOMER_SCRIPT_GIFT_KEY = '_giveaway_gradient_gifts'\n\nexport const CODE_AMOUNT_KEY = '_sku_code_money'\nexport const SCRIPT_CODE_AMOUNT_KEY = '_code_money'\n\n// \u4E3B\u4EA7\u54C1\u516C\u5F00 code\nexport const MAIN_PRODUCT_CODE = ['WS24', 'WSTD', 'WS7D', 'WSCP', 'WSPE', 'WSPD']\n"],
|
|
5
|
+
"mappings": "AACO,IAAKA,OACVA,EAAA,WAAa,aACbA,EAAA,MAAQ,QAFEA,OAAA,IAKL,MAAMC,EAAkB,IAElBC,EAAiB,aAEvB,IAAKC,OACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,WAAa,aACbA,EAAA,KAAO,OACPA,EAAA,QAAU,UALAA,OAAA,IAQAC,OACVA,EAAA,YAAc,eACdA,EAAA,WAAa,aAFHA,OAAA,IAML,MAAMC,EAAmBC,GAO1B,CACJ,KAAM,CAAE,IAAAC,EAAK,MAAAC,EAAO,QAAAC,EAAS,eAAAC,EAAgB,cAAAC,EAAe,gBAAAC,CAAgB,EAAIN,EAEhF,MAAO,CACL,QAAAG,EACA,IAAAF,EACA,gBAAiBK,EAAkB,KAAK,MAAMA,CAAe,EAAI,OACjE,KAAML,IAAQ,aAAe,OAAOC,CAAK,OAAS,QAAQA,CAAK,OAC/D,MAAAA,EACA,eAAAE,EACA,cAAAC,CACF,CACF,EAGaE,EAAc,CACzB,QACA,SACA,UACA,MACA,SACA,QACA,SACA,SACA,qBACA,UACA,OACF,EAEO,IAAKC,OACVA,EAAA,eAAiB,iBACjBA,EAAA,KAAO,iBACPA,EAAA,OAAS,SACTA,EAAA,IAAM,MACNA,EAAA,KAAO,OACPA,EAAA,KAAO,OACPA,EAAA,KAAO,OAPGA,OAAA,IAUL,MAAMC,EAAe,CAC1B,GAAI,IACJ,GAAI,OACJ,GAAI,IACJ,GAAI,SACJ,GAAI,UACJ,GAAI,SACJ,GAAI,SACJ,GAAI,SACJ,GAAI,IACJ,GAAI,IACJ,GAAI,MACJ,GAAI,QACN,EAEaC,EAAgB,CAC3B,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,KACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,KACN,EAEaC,EAAe,CAC1B,GAAI,IACN,EAEaC,EAAgB,CAC3B,GAAI,IACN,EAGaC,EAAyB,0BACzBC,EAA2B,2BAE3BC,EAAkB,kBAClBC,EAAyB,cAGzBC,EAAoB,CAAC,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,MAAM",
|
|
6
|
+
"names": ["CartDataSource", "REVALIDATE_TIME", "SOLD_OUT_PRICE", "TemplateType", "DiscountType", "createConstants", "config", "env", "brand", "locales", "googleClientId", "facebookAppId", "applicationName", "COLOR_LABEL", "CouponChannel", "PRICE_SYMBOL", "CURRENCY_CODE", "COUNTRY_CODE", "LANGUAGE_CODE", "CUSTOMER_ATTRIBUTE_KEY", "CUSTOMER_SCRIPT_GIFT_KEY", "CODE_AMOUNT_KEY", "SCRIPT_CODE_AMOUNT_KEY", "MAIN_PRODUCT_CODE"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import t from"js-cookie";const a=30,n=14;var c=(r=>(r.Necessary="necessary",r.Functional="functional",r.Performance="performance",r.Targeting="targeting",r))(c||{});const o=()=>({category:"necessary",domain:window.location.host.split(".").reverse().slice(0,2).reverse().join("."),expires:n}),p=(e,s)=>{t.set(e,s,o())},m=e=>{t.remove(e,o())};export{c as CookieCategory,n as SHOPIFY_CART_COOKIE_EXPIRE,a as SHOPIFY_COOKIE_EXPIRE,o as createCartCookieOptions,m as removeCartCookies,p as setCartCookies};
|
|
2
|
+
//# sourceMappingURL=cookie.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/shopify/utils/cookie.ts"],
|
|
4
|
+
"sourcesContent": ["import Cookies from 'js-cookie'\n\nexport const SHOPIFY_COOKIE_EXPIRE = 30\nexport const SHOPIFY_CART_COOKIE_EXPIRE = 14\n\nexport enum CookieCategory {\n Necessary = 'necessary', // \u5FC5\u8981\u7C7Bcookie\n Functional = 'functional', // \u529F\u80FD\u7C7B\u3001\u914D\u7F6E\u7C7Bcookie\n Performance = 'performance', // \u6027\u80FD\u3001\u7EDF\u8BA1\u7C7Bcookie\n Targeting = 'targeting', // \u5E7F\u544A\u3001\u8FFD\u8E2A\u7C7Bcookie\n}\n\nexport const createCartCookieOptions = () => {\n const hostUrl = window.location.host.split('.')\n return {\n category: CookieCategory.Necessary,\n domain: hostUrl.reverse().slice(0, 2).reverse().join('.'), // \u4E00\u4E8C\u7EA7\u57DF\u540D\n expires: SHOPIFY_CART_COOKIE_EXPIRE,\n }\n}\n\nexport const setCartCookies = (name: string, value: string) => {\n Cookies.set(name, value, createCartCookieOptions())\n}\n\nexport const removeCartCookies = (name: string) => {\n Cookies.remove(name, createCartCookieOptions())\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAOA,MAAa,YAEb,MAAMC,EAAwB,GACxBC,EAA6B,GAEnC,IAAKC,OACVA,EAAA,UAAY,YACZA,EAAA,WAAa,aACbA,EAAA,YAAc,cACdA,EAAA,UAAY,YAJFA,OAAA,IAOL,MAAMC,EAA0B,KAE9B,CACL,SAAU,YACV,OAHc,OAAO,SAAS,KAAK,MAAM,GAAG,EAG5B,QAAQ,EAAE,MAAM,EAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAG,EACxD,QAASF,CACX,GAGWG,EAAiB,CAACC,EAAcC,IAAkB,CAC7DP,EAAQ,IAAIM,EAAMC,EAAOH,EAAwB,CAAC,CACpD,EAEaI,EAAqBF,GAAiB,CACjDN,EAAQ,OAAOM,EAAMF,EAAwB,CAAC,CAChD",
|
|
6
|
+
"names": ["Cookies", "SHOPIFY_COOKIE_EXPIRE", "SHOPIFY_CART_COOKIE_EXPIRE", "CookieCategory", "createCartCookieOptions", "setCartCookies", "name", "value", "removeCartCookies"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var u=Object.defineProperty;var g=(e,s,r)=>s in e?u(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r;var t=(e,s,r)=>(g(e,typeof s!="symbol"?s+"":s,r),r);class c extends Error{constructor({message:r,code:o,errors:n}){const a=r?{message:r,...o?{code:o}:{}}:n[0];super(a.message);t(this,"code");t(this,"errors");this.errors=r?[a]:n,a.code&&(this.code=a.code)}}class d extends c{constructor(s){super(s)}}class E extends c{constructor(r){super(r);t(this,"status");this.status=r.status}}class m extends Error{constructor(r){const o=r.message||r.errors?.join(`
|
|
2
|
+
`);super(o);t(this,"status");t(this,"errors");t(this,"errorCode");this.status=r.status,this.errors=r.errors||[],this.errorCode=r.errorCode||""}}export{c as CommerceError,E as CommerceFetcherError,m as FetcherError,d as ValidationError};
|
|
3
|
+
//# sourceMappingURL=errors.js.map
|