@plasmicpkgs/commerce-swell 0.0.215 → 0.0.217
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.
|
@@ -629,7 +629,7 @@ function normalizeCategory(_ref7) {
|
|
|
629
629
|
}
|
|
630
630
|
|
|
631
631
|
var handleFetchResponse = /*#__PURE__*/function () {
|
|
632
|
-
var _ref = /*#__PURE__*/_asyncToGenerator(
|
|
632
|
+
var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
|
|
633
633
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
634
634
|
while (1) switch (_context.prev = _context.next) {
|
|
635
635
|
case 0:
|
|
@@ -679,7 +679,7 @@ var checkoutToCart = function checkoutToCart(checkoutPayload) {
|
|
|
679
679
|
};
|
|
680
680
|
|
|
681
681
|
var checkoutCreate = /*#__PURE__*/function () {
|
|
682
|
-
var _ref = /*#__PURE__*/_asyncToGenerator(
|
|
682
|
+
var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(fetch) {
|
|
683
683
|
var cart, checkoutUrl, options;
|
|
684
684
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
685
685
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -729,7 +729,7 @@ var handler = {
|
|
|
729
729
|
method: 'get'
|
|
730
730
|
},
|
|
731
731
|
fetcher: function fetcher(_ref) {
|
|
732
|
-
return _asyncToGenerator(
|
|
732
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
733
733
|
var fetch, cart;
|
|
734
734
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
735
735
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -776,7 +776,7 @@ var handler$1 = {
|
|
|
776
776
|
method: 'addItem'
|
|
777
777
|
},
|
|
778
778
|
fetcher: function fetcher(_ref) {
|
|
779
|
-
return _asyncToGenerator(
|
|
779
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
780
780
|
var item, options, fetch, variables, response;
|
|
781
781
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
782
782
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -817,8 +817,8 @@ var handler$1 = {
|
|
|
817
817
|
return function () {
|
|
818
818
|
var _useCart = commerce.useCart(),
|
|
819
819
|
mutate = _useCart.mutate;
|
|
820
|
-
return React.useCallback(
|
|
821
|
-
var _addItem = _asyncToGenerator(
|
|
820
|
+
return React.useCallback(/*#__PURE__*/function () {
|
|
821
|
+
var _addItem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
|
|
822
822
|
var data;
|
|
823
823
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
824
824
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -854,7 +854,7 @@ var handler$2 = {
|
|
|
854
854
|
method: "removeItem"
|
|
855
855
|
},
|
|
856
856
|
fetcher: function fetcher(_ref) {
|
|
857
|
-
return _asyncToGenerator(
|
|
857
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
858
858
|
var itemId, options, fetch, response;
|
|
859
859
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
860
860
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -879,8 +879,8 @@ var handler$2 = {
|
|
|
879
879
|
return function () {
|
|
880
880
|
var _useCart = commerce.useCart(),
|
|
881
881
|
mutate = _useCart.mutate;
|
|
882
|
-
return React.useCallback(
|
|
883
|
-
var _removeItem = _asyncToGenerator(
|
|
882
|
+
return React.useCallback(/*#__PURE__*/function () {
|
|
883
|
+
var _removeItem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
|
|
884
884
|
var data;
|
|
885
885
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
886
886
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -918,7 +918,7 @@ var handler$3 = {
|
|
|
918
918
|
method: "updateItem"
|
|
919
919
|
},
|
|
920
920
|
fetcher: function fetcher(_ref) {
|
|
921
|
-
return _asyncToGenerator(
|
|
921
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
922
922
|
var _ref$input, itemId, item, options, fetch, response;
|
|
923
923
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
924
924
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -978,8 +978,8 @@ var handler$3 = {
|
|
|
978
978
|
item = _ctx.item;
|
|
979
979
|
var _useCart = commerce.useCart(),
|
|
980
980
|
mutate = _useCart.mutate;
|
|
981
|
-
return React.useCallback(debounce(
|
|
982
|
-
var _ref3 = _asyncToGenerator(
|
|
981
|
+
return React.useCallback(debounce(/*#__PURE__*/function () {
|
|
982
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
|
|
983
983
|
var _input$id;
|
|
984
984
|
var itemId, data;
|
|
985
985
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
@@ -1073,7 +1073,7 @@ var handler$4 = {
|
|
|
1073
1073
|
method: "list"
|
|
1074
1074
|
},
|
|
1075
1075
|
fetcher: function fetcher(_ref) {
|
|
1076
|
-
return _asyncToGenerator(
|
|
1076
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1077
1077
|
var input, options, fetch, sortMap, categoryId, includeSubCategories, categories, brandId, search, _input$sort, sort, count, mappedSort, includedCategories, _yield$fetch, products;
|
|
1078
1078
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1079
1079
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -1141,7 +1141,7 @@ var handler$5 = {
|
|
|
1141
1141
|
method: 'get'
|
|
1142
1142
|
},
|
|
1143
1143
|
fetcher: function fetcher(_ref) {
|
|
1144
|
-
return _asyncToGenerator(
|
|
1144
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1145
1145
|
var input, options, fetch, id, product;
|
|
1146
1146
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1147
1147
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -1192,7 +1192,7 @@ var handler$6 = {
|
|
|
1192
1192
|
method: "get"
|
|
1193
1193
|
},
|
|
1194
1194
|
fetcher: function fetcher(_ref) {
|
|
1195
|
-
return _asyncToGenerator(
|
|
1195
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
1196
1196
|
var _data$results;
|
|
1197
1197
|
var input, options, fetch, addIsEmptyField, categoryId, data, categories, normalizedCategories, _loop, _iterator, _step;
|
|
1198
1198
|
return _regeneratorRuntime().wrap(function _callee2$(_context3) {
|
|
@@ -1217,8 +1217,8 @@ var handler$6 = {
|
|
|
1217
1217
|
break;
|
|
1218
1218
|
}
|
|
1219
1219
|
_context3.next = 9;
|
|
1220
|
-
return Promise.all(categories.map(
|
|
1221
|
-
var _ref2 = _asyncToGenerator(
|
|
1220
|
+
return Promise.all(categories.map(/*#__PURE__*/function () {
|
|
1221
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(category) {
|
|
1222
1222
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1223
1223
|
while (1) switch (_context.prev = _context.next) {
|
|
1224
1224
|
case 0:
|
|
@@ -1319,7 +1319,7 @@ var handler$7 = {
|
|
|
1319
1319
|
method: "get"
|
|
1320
1320
|
},
|
|
1321
1321
|
fetcher: function fetcher(_ref) {
|
|
1322
|
-
return _asyncToGenerator(
|
|
1322
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1323
1323
|
var _yield$fetch$values, _yield$fetch;
|
|
1324
1324
|
var fetch, vendors;
|
|
1325
1325
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -1394,13 +1394,13 @@ var handler$7 = {
|
|
|
1394
1394
|
};
|
|
1395
1395
|
|
|
1396
1396
|
var fetcher = /*#__PURE__*/function () {
|
|
1397
|
-
var _ref2 = /*#__PURE__*/_asyncToGenerator(
|
|
1397
|
+
var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
1398
1398
|
var _ref$method, method, variables, query, callSwell, _callSwell;
|
|
1399
1399
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1400
1400
|
while (1) switch (_context2.prev = _context2.next) {
|
|
1401
1401
|
case 0:
|
|
1402
1402
|
_callSwell = function _callSwell3() {
|
|
1403
|
-
_callSwell = _asyncToGenerator(
|
|
1403
|
+
_callSwell = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1404
1404
|
var arg1, arg2, response, _response;
|
|
1405
1405
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1406
1406
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commerce-swell.cjs.development.js","sources":["../src/const.ts","../src/utils/normalize.ts","../src/utils/handle-fetch-response.ts","../src/utils/get-checkout-id.ts","../src/cart/utils/checkout-to-cart.ts","../src/cart/utils/checkout-create.ts","../src/cart/use-cart.tsx","../src/cart/use-add-item.tsx","../src/cart/use-remove-item.tsx","../src/cart/use-update-item.tsx","../src/utils/common.ts","../src/utils/category-tree.ts","../src/product/use-search.tsx","../src/product/use-product.tsx","../src/site/use-categories.ts","../src/site/use-brands.ts","../src/fetcher.ts","../src/provider.ts","../src/swell.ts","../src/registerCommerceProvider.tsx","../src/index.tsx"],"sourcesContent":["/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: Removed store id and public key\n*/\nexport const SWELL_CHECKOUT_ID_COOKIE = 'SWELL_checkoutId'\n\nexport const SWELL_CHECKOUT_URL_COOKIE = 'swell_checkoutUrl'\n\nexport const SWELL_CUSTOMER_TOKEN_COOKIE = 'swell_customerToken'\n\nexport const SWELL_COOKIE_EXPIRE = 30\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: Added \"Default Variant\" to default title when there's no product variant\n*/\nimport { MoneyV2 } from \"../schema\";\nimport type {\n Cart,\n CartLineItem,\n LineItem,\n ProductOptionValue,\n SwellCart,\n SwellImage,\n SwellProduct,\n SwellProductOptionValue,\n SwellVariant,\n} from \"../types\";\nimport { Product, ProductOption } from \"../types/product\";\nimport { Category, SwellCategoryChildren } from \"../types/site\";\n\nconst money = ({ amount, currencyCode }: MoneyV2) => {\n return {\n value: +amount,\n currencyCode,\n };\n};\n\ntype swellProductOption = {\n id: string;\n name: string;\n values: any[];\n};\n\ntype normalizedProductOption = {\n id: string;\n displayName: string;\n values: ProductOptionValue[];\n};\n\nconst normalizeProductOption = ({\n id,\n name: displayName = \"\",\n values = [],\n}: swellProductOption): ProductOption => {\n let returnValues = values.map((value) => {\n let output: any = {\n label: value.name,\n // id: value?.id || id,\n };\n if (displayName.match(/colou?r/gi)) {\n output = {\n ...output,\n hexColors: [value.name],\n };\n }\n return output;\n });\n return {\n __typename: \"MultipleChoiceOption\",\n id,\n displayName,\n values: returnValues,\n };\n};\n\nconst normalizeProductImages = (images: SwellImage[]) => {\n if (!images || images.length < 1) {\n return [{ url: \"/\" }];\n }\n return images?.map(({ file, ...rest }: SwellImage) => ({\n url: file?.url + \"\",\n height: Number(file?.height),\n width: Number(file?.width),\n ...rest,\n }));\n};\n\nconst normalizeProductVariants = (\n variants: SwellVariant[],\n productOptions: swellProductOption[]\n) => {\n return variants?.map(\n ({ id, name, price, option_value_ids: optionValueIds = [] }) => {\n const values = name\n .split(\",\")\n .map((i) => ({ name: i.trim(), label: i.trim() }));\n\n const options = optionValueIds.map((id) => {\n const matchingOption = productOptions.find((option) => {\n return option.values.find(\n (value: SwellProductOptionValue) => value.id == id\n );\n });\n return normalizeProductOption({\n id,\n name: matchingOption?.name ?? \"\",\n values,\n });\n });\n\n return {\n id,\n name,\n // sku: sku ?? id,\n price: price ?? undefined,\n // listPrice: price ?? null,\n // requiresShipping: true,\n options,\n };\n }\n );\n};\n\nexport function normalizeProduct(swellProduct: SwellProduct): Product {\n const {\n id,\n name,\n description,\n images,\n options,\n slug,\n variants,\n price: value,\n currency: currencyCode,\n } = swellProduct;\n // ProductView accesses variants for each product\n const emptyVariants = [{ options: [], id, name: \"Default variant\" }];\n\n const productOptions = options\n ? options.map((o) => normalizeProductOption(o))\n : [];\n const productVariants = variants\n ? normalizeProductVariants(variants.results, options)\n : [];\n\n const productImages = normalizeProductImages(images);\n const product = {\n ...swellProduct,\n description,\n id,\n vendor: \"\",\n path: `/${slug}`,\n images: productImages,\n variants:\n productVariants && productVariants.length\n ? productVariants\n : emptyVariants,\n options: productOptions,\n price: {\n value,\n currencyCode,\n },\n };\n return product;\n}\n\nexport function normalizeCart({\n id,\n account_id,\n date_created,\n currency,\n tax_included_total,\n items,\n sub_total,\n grand_total,\n discounts,\n}: SwellCart) {\n const cart: Cart = {\n id: id,\n customerId: account_id + \"\",\n email: \"\",\n createdAt: date_created,\n currency: { code: currency },\n taxesIncluded: tax_included_total > 0,\n lineItems: items?.map(normalizeLineItem) ?? [],\n lineItemsSubtotalPrice: +sub_total,\n subtotalPrice: +sub_total,\n totalPrice: grand_total,\n discounts: discounts?.map((discount) => ({ value: discount.amount })),\n };\n return cart;\n}\n/*\nexport function normalizeCustomer(customer: SwellCustomer): Customer {\n const { first_name: firstName, last_name: lastName } = customer\n return {\n ...customer,\n firstName,\n lastName,\n }\n}\n*/\nfunction normalizeLineItem({\n id,\n product,\n price,\n variant,\n quantity,\n}: CartLineItem): LineItem {\n const item = {\n id,\n variantId: variant?.id,\n productId: product.id ?? \"\",\n name: product?.name ?? \"\",\n quantity,\n variant: {\n id: variant?.id ?? \"\",\n sku: variant?.sku ?? \"\",\n name: variant?.name!,\n image: {\n url:\n product?.images && product.images.length > 0\n ? product?.images[0].file.url\n : \"/\",\n },\n requiresShipping: false,\n price: price,\n listPrice: price,\n },\n path: \"\",\n discounts: [],\n options: [\n {\n value: variant?.name,\n },\n ],\n };\n return item;\n}\n\nexport function normalizeChildren(children: SwellCategoryChildren) {\n return children?.results.map((ch) => ch.id);\n}\n\nexport function normalizeCategory({\n id,\n name,\n slug,\n products,\n images,\n depth,\n children,\n parent_id,\n}: any): Category {\n return {\n id,\n name,\n slug,\n path: `/${slug}`,\n isEmpty: products?.length === 0,\n images: images?.map((image: any) => ({\n url: image.file.url,\n })),\n depth,\n children: normalizeChildren(children),\n parentId: parent_id,\n };\n}\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport { CommerceError } from '@plasmicpkgs/commerce'\n\ntype SwellFetchResponse = {\n error: {\n message: string\n code?: string\n }\n}\n\nconst handleFetchResponse = async (res: SwellFetchResponse) => {\n if (res) {\n if (res.error) {\n throw new CommerceError(res.error)\n }\n return res\n }\n return null;\n}\n\nexport default handleFetchResponse\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport Cookies from 'js-cookie'\nimport { SWELL_CHECKOUT_ID_COOKIE } from '../const'\n\nconst getCheckoutId = (id?: string) => {\n return id ?? Cookies.get(SWELL_CHECKOUT_ID_COOKIE)\n}\n\nexport default getCheckoutId\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport { CommerceError } from '@plasmicpkgs/commerce'\nimport { CartType } from '@plasmicpkgs/commerce'\n\nimport {\n CheckoutLineItemsAddPayload,\n CheckoutLineItemsRemovePayload,\n CheckoutLineItemsUpdatePayload,\n Maybe,\n} from '../../schema'\nimport { normalizeCart } from '../../utils'\nexport type CheckoutPayload =\n | CheckoutLineItemsAddPayload\n | CheckoutLineItemsUpdatePayload\n | CheckoutLineItemsRemovePayload\n\nconst checkoutToCart = (checkoutPayload?: Maybe<CheckoutPayload>): CartType.Cart => {\n if (!checkoutPayload) {\n throw new CommerceError({\n message: 'Invalid response from Swell',\n })\n }\n return normalizeCart(checkoutPayload as any)\n}\n\nexport default checkoutToCart\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes:\n - Added sameSite and secure to the cookie options to allow third-party cookies.\n\t We need this to make work on the studio\n*/\nimport { SWELL_CHECKOUT_URL_COOKIE, SWELL_COOKIE_EXPIRE } from '../../const'\n\nimport Cookies from 'js-cookie'\n\nexport const checkoutCreate = async (fetch: any) => {\n const cart = await fetch({\n query: 'cart',\n method: 'get',\n })\n\n if (!cart) {\n await fetch({\n query: 'cart',\n method: 'setItems',\n variables: [[]],\n })\n }\n\n const checkoutUrl = cart?.checkout_url\n const options: Cookies.CookieAttributes = {\n expires: SWELL_COOKIE_EXPIRE,\n sameSite: \"none\",\n secure: true\n }\n if (checkoutUrl) {\n Cookies.set(SWELL_CHECKOUT_URL_COOKIE, checkoutUrl, options)\n }\n\n return cart\n}\n\nexport default checkoutCreate\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport { useCart, UseCart } from '@plasmicpkgs/commerce'\nimport { SWRHook } from '@plasmicpkgs/commerce'\nimport { useMemo } from 'react'\nimport { normalizeCart } from '../utils/normalize'\nimport { checkoutCreate, checkoutToCart } from './utils'\nimport type { CartType } from '@plasmicpkgs/commerce'\n\nexport default useCart as UseCart<typeof handler>\n\ntype GetCartHook = CartType.GetCartHook;\n\nexport const handler: SWRHook<GetCartHook> = {\n fetchOptions: {\n query: 'cart',\n method: 'get',\n },\n async fetcher({ fetch }) {\n const cart = await checkoutCreate(fetch)\n\n return cart ? normalizeCart(cart) : null\n },\n useHook:\n ({ useData }) =>\n (input) => {\n const response = useData({\n swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },\n })\n return useMemo(\n () =>\n Object.create(response, {\n isEmpty: {\n get() {\n return (response.data?.lineItems.length ?? 0) <= 0\n },\n enumerable: true,\n },\n }),\n [response]\n )\n },\n}\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport type { MutationHook } from '@plasmicpkgs/commerce'\nimport { CommerceError } from '@plasmicpkgs/commerce'\nimport { useAddItem, UseAddItem } from '@plasmicpkgs/commerce'\nimport useCart from './use-cart'\nimport { checkoutToCart } from './utils'\nimport { getCheckoutId } from '../utils'\nimport { useCallback } from 'react'\nimport { AddItemHook } from '../types/cart'\n\nexport default useAddItem as UseAddItem<typeof handler>\n\nexport const handler: MutationHook<AddItemHook> = {\n fetchOptions: {\n query: 'cart',\n method: 'addItem',\n },\n async fetcher({ input: item, options, fetch }) {\n if (\n item.quantity &&\n (!Number.isInteger(item.quantity) || item.quantity! < 1)\n ) {\n throw new CommerceError({\n message: 'The item quantity has to be a valid integer greater than 0',\n })\n }\n const variables: {\n product_id: string | undefined\n variant_id?: string\n checkoutId?: string\n quantity?: number\n } = {\n checkoutId: getCheckoutId(),\n product_id: item.productId,\n quantity: item.quantity,\n }\n if (item.productId !== item.variantId) {\n variables.variant_id = item.variantId\n }\n\n const response = await fetch({\n ...options,\n variables,\n })\n\n return checkoutToCart(response) as any\n },\n useHook:\n ({ fetch }) =>\n () => {\n const { mutate } = useCart()\n\n return useCallback(\n async function addItem(input) {\n const data = await fetch({ input })\n await mutate(data, false)\n return data\n },\n [fetch, mutate]\n )\n },\n}\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport type {\n HookFetcherContext,\n MutationHookContext,\n} from \"@plasmicpkgs/commerce\";\nimport { useCallback } from \"react\";\n\nimport { CartType, useRemoveItem, UseRemoveItem } from \"@plasmicpkgs/commerce\";\nimport useCart from \"./use-cart\";\nimport { checkoutToCart } from \"./utils\";\n\ntype Cart = CartType.Cart;\ntype LineItem = CartType.LineItem;\ntype RemoveItemHook = CartType.RemoveItemHook;\n\nexport type RemoveItemFn<T = any> = T extends LineItem\n ? (input?: RemoveItemActionInput<T>) => Promise<Cart | null | undefined>\n : (input: RemoveItemActionInput<T>) => Promise<Cart | null>;\n\nexport type RemoveItemActionInput<T = any> = T extends LineItem\n ? Partial<RemoveItemHook[\"actionInput\"]>\n : RemoveItemHook[\"actionInput\"];\n\nexport default useRemoveItem as UseRemoveItem<typeof handler>;\n\nexport const handler = {\n fetchOptions: {\n query: \"cart\",\n method: \"removeItem\",\n },\n async fetcher({\n input: { itemId },\n options,\n fetch,\n }: HookFetcherContext<RemoveItemHook>) {\n const response = await fetch({ ...options, variables: [itemId] });\n\n return checkoutToCart(response);\n },\n useHook: ({ fetch }: MutationHookContext<RemoveItemHook>) => () => {\n const { mutate } = useCart();\n\n return useCallback(\n async function removeItem(input: { id: string }) {\n const data = await fetch({ input: { itemId: input.id } });\n await mutate(data, false);\n\n return data;\n },\n [fetch, mutate]\n );\n },\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport type {\n HookFetcherContext,\n MutationHookContext,\n} from \"@plasmicpkgs/commerce\";\nimport { ValidationError } from \"@plasmicpkgs/commerce\";\nimport debounce from \"debounce\";\nimport { useCallback } from \"react\";\n// import useUpdateItem, {\n// UpdateItemInput as UpdateItemInputBase,\n// UseUpdateItem,\n// } from '@vercel/commerce/cart/use-update-item'\nimport { CartType, useUpdateItem, UseUpdateItem } from \"@plasmicpkgs/commerce\";\nimport { UpdateItemHook } from \"../types/cart\";\nimport useCart from \"./use-cart\";\nimport { handler as removeItemHandler } from \"./use-remove-item\";\nimport { checkoutToCart } from \"./utils\";\n// export type UpdateItemInput<T = any> = T extends LineItem\n// ? Partial<UpdateItemInputBase<LineItem>>\n// : UpdateItemInputBase<LineItem>\n\nexport default useUpdateItem as UseUpdateItem<typeof handler>;\n\ntype CartItemBody = CartType.CartItemBody;\ntype LineItem = CartType.LineItem;\n\nexport type UpdateItemActionInput<T = any> = T extends LineItem\n ? Partial<UpdateItemHook[\"actionInput\"]>\n : UpdateItemHook[\"actionInput\"];\n\nexport const handler = {\n fetchOptions: {\n query: \"cart\",\n method: \"updateItem\",\n },\n async fetcher({\n input: { itemId, item },\n options,\n fetch,\n }: HookFetcherContext<UpdateItemHook>) {\n if (Number.isInteger(item.quantity)) {\n // Also allow the update hook to remove an item if the quantity is lower than 1\n if (item.quantity! < 1) {\n return removeItemHandler.fetcher({\n options: removeItemHandler.fetchOptions,\n input: { itemId },\n fetch,\n });\n }\n } else if (item.quantity) {\n throw new ValidationError({\n message: \"The item quantity has to be a valid integer\",\n });\n }\n const response = await fetch({\n ...options,\n variables: [itemId, { quantity: item.quantity }],\n });\n\n return checkoutToCart(response);\n },\n useHook:\n ({ fetch }: MutationHookContext<UpdateItemHook>) =>\n <T extends LineItem | undefined = undefined>(\n ctx: {\n item?: T;\n wait?: number;\n } = {}\n ) => {\n const { item } = ctx;\n const { mutate, data: cartData } = useCart() as any;\n\n return useCallback(\n debounce(async (input: UpdateItemActionInput) => {\n const itemId = input.id ?? item?.id;\n if (!itemId) {\n throw new ValidationError({\n message: \"Invalid input used for this operation\",\n });\n }\n\n const data = await fetch({\n input: {\n item: {\n quantity: input.quantity,\n },\n itemId,\n },\n });\n await mutate(data, false);\n return data;\n }, ctx.wait ?? 500),\n [fetch, mutate]\n );\n },\n};\n","export function ensure<T>(x: T | null | undefined, msg = \"\"): T {\n if (x === null || x === undefined) {\n debugger;\n throw new Error(\n `Value must not be undefined or null${msg ? `- ${msg}` : \"\"}`\n );\n } else {\n return x;\n }\n}\n\nexport const ensureNoNilFields = (\n o: Record<string, any>\n): Record<string, any> =>\n Object.fromEntries(Object.entries(o).filter(([k, v]) => v != null));\n","import { Category } from \"../types/site\";\nimport { ensure } from \"./common\";\n\nexport const walkCategoryTree = (\n category?: Category,\n categories?: Category[]\n) => {\n if (!category || !categories) {\n return [];\n }\n\n const queue: Category[] = [category];\n const result: Category[] = [];\n while (queue.length > 0) {\n const curr = ensure(queue.shift());\n result.push(curr);\n queue.push(\n ...(curr.children?.map((child) =>\n ensure(\n categories.find((category) => category.id === child),\n \"The child category must always exist in the categories list\"\n )\n ) ?? [])\n );\n }\n return result;\n};\n\nexport const topologicalSortForCategoryTree = (categories: Category[]) => {\n return categories\n .filter((category) => !category.parentId)\n .flatMap((category) => walkCategoryTree(category, categories));\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: Added count as a parameter to input\n*/\nimport type { SearchProductsHook } from \"@plasmicpkgs/commerce\";\nimport {\n HookSWRInput,\n SWRHook,\n useSearch,\n UseSearch,\n} from \"@plasmicpkgs/commerce\";\nimport { SwellProduct } from \"../types\";\nimport { Category } from \"../types/site\";\nimport { normalizeProduct } from \"../utils\";\nimport { walkCategoryTree } from \"../utils/category-tree\";\nimport { ensureNoNilFields } from \"../utils/common\";\n\nexport type SearchProductsInput = {\n search?: string;\n categoryId?: string;\n brandId?: string;\n sort?: string;\n count?: number;\n includeSubCategories?: boolean;\n categories?: Category[];\n};\n\nconst useSearchTyped: UseSearch<typeof handler> = useSearch;\nexport default useSearchTyped;\n\nexport const handler: SWRHook<SearchProductsHook> = {\n fetchOptions: {\n query: \"products\",\n method: \"list\",\n },\n async fetcher({ input, options, fetch }) {\n const sortMap = new Map([\n [\"latest-desc\", \"\"],\n [\"price-asc\", \"price asc\"],\n [\"price-desc\", \"price desc\"],\n [\"trending-desc\", \"popularity\"],\n ]);\n const {\n categoryId,\n includeSubCategories,\n categories,\n brandId,\n search,\n sort = \"latest-desc\",\n count,\n } = input;\n const mappedSort = sortMap.get(sort);\n\n const includedCategories = includeSubCategories\n ? walkCategoryTree(\n categories?.find((category) => category.id === categoryId),\n categories\n )\n : undefined;\n\n const { results: products } = await fetch({\n query: options.query,\n method: options.method,\n variables: ensureNoNilFields({\n category: !includeSubCategories ? categoryId : undefined,\n brand: brandId,\n search,\n sort: mappedSort,\n expand: [\"variants\"],\n limit: count,\n $filters: {\n ...(includeSubCategories\n ? { category: includedCategories?.map((c) => c.id) }\n : {}),\n },\n }),\n });\n\n return {\n products: products.map((product: SwellProduct) =>\n normalizeProduct(product)\n ),\n found: products.length > 0,\n };\n },\n useHook:\n ({ useData }) =>\n (input = {}) => {\n return useData({\n input: [\n [\"search\", input.search],\n [\"categoryId\", input.categoryId],\n [\"includeSubCategories\", input.includeSubCategories],\n [\"categories\", input.categories],\n [\"brandId\", input.brandId],\n [\"sort\", input.sort],\n [\"count\", input.count],\n ] as HookSWRInput,\n swrOptions: {\n revalidateOnFocus: false,\n ...input.swrOptions,\n },\n });\n },\n};\n","import { GetProductHook, SWRHook, UseProduct, useProduct } from '@plasmicpkgs/commerce'\nimport { normalizeProduct } from '../utils'\nimport { SwellProduct } from '../types'\n\nexport type GetProductInput = {\n id?: string;\n}\n\nexport default useProduct as UseProduct<typeof handler>\n\nexport const handler: SWRHook<GetProductHook> = {\n fetchOptions: {\n query: 'products',\n method: 'get',\n },\n async fetcher({ input, options, fetch }) {\n const { id } = input;\n const product = await fetch({\n query: options.query,\n method: options.method,\n variables: [id],\n });\n if (!product) {\n return null;\n }\n return normalizeProduct(product);\n },\n useHook:\n ({ useData }) =>\n (input = {}) => {\n return useData({\n input: [\n ['id', input.id],\n ],\n swrOptions: {\n revalidateOnFocus: false,\n ...input.swrOptions,\n },\n })\n },\n}\n","import {\n SiteTypes,\n SWRHook,\n useCategories,\n UseCategories,\n} from \"@plasmicpkgs/commerce\";\nimport { useMemo } from \"react\";\nimport { Category } from \"../types/site\";\nimport { normalizeCategory } from \"../utils\";\nimport { topologicalSortForCategoryTree } from \"../utils/category-tree\";\nimport { ensureNoNilFields } from \"../utils/common\";\n\nexport default useCategories as UseCategories<typeof handler>;\n\ntype GetCategoriesHook = SiteTypes.GetCategoriesHook;\n\nexport const handler: SWRHook<GetCategoriesHook> = {\n fetchOptions: {\n query: \"categories\",\n method: \"get\",\n },\n async fetcher({ input, options, fetch }) {\n const { addIsEmptyField, categoryId } = input;\n\n const data = await fetch({\n query: options.query,\n method: options.method,\n variables: ensureNoNilFields({\n expand: [\"children\", \"parent_id\"],\n id: categoryId,\n }),\n });\n\n let categories = data?.results ?? [];\n if (addIsEmptyField) {\n categories = await Promise.all(\n categories.map(async (category: any) => ({\n ...category,\n products: (\n await fetch({\n query: \"products\",\n method: \"list\",\n variables: ensureNoNilFields({\n limit: 1,\n category: category.id,\n }),\n })\n ).results,\n }))\n );\n }\n\n const normalizedCategories: Category[] = !categoryId\n ? topologicalSortForCategoryTree(categories.map(normalizeCategory))\n : categories.map(normalizeCategory);\n\n for (const category of normalizedCategories) {\n category.depth =\n (normalizedCategories.find((c) => c.id === category.parentId)?.depth ??\n -1) + 1;\n }\n return normalizedCategories;\n },\n useHook: ({ useData }) => (input) => {\n const response = useData({\n input: [\n [\"addIsEmptyField\", input?.addIsEmptyField],\n [\"categoryId\", input?.categoryId],\n ],\n swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },\n });\n return useMemo(\n () =>\n Object.create(response, {\n isEmpty: {\n get() {\n return (response.data?.length ?? 0) <= 0;\n },\n enumerable: true,\n },\n }),\n [response]\n );\n },\n};\n","import {\n SiteTypes,\n SWRHook,\n useBrands,\n UseBrands,\n} from \"@plasmicpkgs/commerce\";\nimport { useMemo } from \"react\";\n\nexport default useBrands as UseBrands<typeof handler>;\n\ntype GetBrandsHook = SiteTypes.GetBrandsHook;\n\nexport const handler: SWRHook<GetBrandsHook> = {\n fetchOptions: {\n query: \"attributes\",\n method: \"get\",\n },\n async fetcher({ fetch }) {\n const vendors: [string] =\n (\n await fetch({\n query: \"attributes\",\n method: \"get\",\n variables: \"brand\",\n })\n )?.values ?? [];\n return Array.from(new Set(vendors).values()).map((v) => ({\n entityId: v,\n name: v,\n path: `brands/${v}`,\n }));\n },\n useHook: ({ useData }) => (input) => {\n const response = useData({\n swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },\n });\n return useMemo(\n () =>\n Object.create(response, {\n isEmpty: {\n get() {\n return (response.data?.length ?? 0) <= 0;\n },\n enumerable: true,\n },\n }),\n [response]\n );\n },\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport { Fetcher } from '@plasmicpkgs/commerce'\nimport { CommerceError } from '@plasmicpkgs/commerce'\nimport { handleFetchResponse } from './utils'\nimport swell from './provider'\n\nconst fetcher: Fetcher = async ({ method = 'get', variables, query }) => {\n async function callSwell() {\n if (Array.isArray(variables)) {\n const arg1 = variables[0]\n const arg2 = variables[1]\n const response = await swell[query!][method](arg1, arg2)\n return handleFetchResponse(response)\n } else {\n const response = await swell[query!][method](variables)\n return handleFetchResponse(response)\n }\n }\n\n if (query && query in swell) {\n return await callSwell()\n } else {\n throw new CommerceError({ message: 'Invalid query argument!' })\n }\n}\n\nexport default fetcher\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: Added storeId and publicKey parameters\n*/\n// @ts-ignore\nimport swell, { init } from \"swell-js\";\n\nimport { CommerceExtraFeatures, Provider } from \"@plasmicpkgs/commerce\";\nimport { SWELL_CHECKOUT_ID_COOKIE } from \"./const\";\nimport { handler as useCart } from \"./cart/use-cart\";\nimport { handler as useAddItem } from \"./cart/use-add-item\";\nimport { handler as useUpdateItem } from \"./cart/use-update-item\";\nimport { handler as useRemoveItem } from \"./cart/use-remove-item\";\nimport { handler as useSearch } from \"./product/use-search\";\nimport { handler as useProduct } from \"./product/use-product\";\nimport { handler as useCategories } from \"./site/use-categories\";\nimport { handler as useBrands } from \"./site/use-brands\";\nimport fetcher from \"./fetcher\";\nimport { Fetcher } from \"@plasmicpkgs/commerce\";\n\nexport const getSwellProvider = (storeId: string, publicKey: string) => {\n init(storeId, publicKey);\n\n return {\n locale: \"en-us\",\n cartCookie: SWELL_CHECKOUT_ID_COOKIE,\n swell,\n fetcher,\n cart: { useCart, useAddItem, useUpdateItem, useRemoveItem },\n products: { useSearch, useProduct },\n site: { useCategories, useBrands },\n extraFeatures: {\n includeSubCategories: true,\n },\n };\n};\n\nexport type SwellProvider = {\n locale: string;\n cartCookie: string;\n fetcher: Fetcher;\n cart: {\n useCart: typeof useCart;\n useAddItem: typeof useAddItem;\n useUpdateItem: typeof useUpdateItem;\n useRemoveItem: typeof useRemoveItem;\n };\n products: {\n useSearch: typeof useSearch;\n };\n site: {\n useCategories: typeof useCategories;\n useBrands: typeof useBrands;\n };\n extraFeatures: CommerceExtraFeatures;\n swell: any;\n};\n\nexport default swell as any;\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport {\n CommerceAPIConfig,\n getCommerceProvider as getCoreCommerceProvider,\n useCommerce as useCoreCommerce,\n} from '@plasmicpkgs/commerce'\nimport { SWELL_CHECKOUT_ID_COOKIE, SWELL_COOKIE_EXPIRE, SWELL_CUSTOMER_TOKEN_COOKIE } from './const'\nimport { getSwellProvider, SwellProvider } from './provider'\nimport fetchApi from './utils/fetch-swell-api'\n\nexport type { SwellProvider }\n\nexport const getCommerceProvider = (storeId: string, publicKey: string) => \n getCoreCommerceProvider(getSwellProvider(storeId, publicKey))\n\nexport const useCommerce = () => useCoreCommerce<SwellProvider>()\n\n\nexport interface SwellConfig extends CommerceAPIConfig {\n fetch: any\n}\n\nconst config: SwellConfig = {\n locale: 'en-US',\n commerceUrl: '',\n apiToken: ''!,\n cartCookie: SWELL_CHECKOUT_ID_COOKIE,\n cartCookieMaxAge: SWELL_COOKIE_EXPIRE,\n fetch: fetchApi,\n customerCookie: SWELL_CUSTOMER_TOKEN_COOKIE,\n}\n","import { GlobalContextMeta } from \"@plasmicapp/host\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport {\n CartActionsProvider,\n globalActionsRegistrations,\n} from \"@plasmicpkgs/commerce\";\nimport React from \"react\";\nimport { Registerable } from \"./registerable\";\nimport { getCommerceProvider } from \"./swell\";\n\ninterface CommerceProviderProps {\n children?: React.ReactNode;\n storeId: string;\n publicKey: string;\n}\n\nconst globalContextName = \"plasmic-commerce-swell-provider\";\n\nexport const commerceProviderMeta: GlobalContextMeta<CommerceProviderProps> = {\n name: \"plasmic-commerce-swell-provider\",\n displayName: \"Swell Provider\",\n props: {\n storeId: {\n type: \"string\",\n defaultValue: \"plasmic-sandbox\",\n },\n publicKey: {\n type: \"string\",\n defaultValue: \"pk_QaZeGhtpQaVbNQnWJdRlE1abE6Ezf9U9\",\n },\n },\n ...{ globalActions: globalActionsRegistrations },\n description: `Get your store ID and public storefront API key from the Swell admin UI under Developer > API Keys.\n\n[Watch how to use this integration](https://www.youtube.com/watch?v=b2mgOTbP2_8).`,\n importPath: \"@plasmicpkgs/commerce-swell\",\n importName: \"CommerceProviderComponent\",\n};\n\nexport function CommerceProviderComponent(props: CommerceProviderProps) {\n const { storeId, publicKey, children } = props;\n\n const CommerceProvider = React.useMemo(\n () => getCommerceProvider(storeId, publicKey),\n [storeId, publicKey]\n );\n\n return (\n <CommerceProvider>\n <CartActionsProvider globalContextName={globalContextName}>\n {children}\n </CartActionsProvider>\n </CommerceProvider>\n );\n}\n\nexport function registerCommerceProvider(\n loader?: Registerable,\n customCommerceProviderMeta?: GlobalContextMeta<CommerceProviderProps>\n) {\n const doRegisterComponent: typeof registerGlobalContext = (...args) =>\n loader\n ? loader.registerGlobalContext(...args)\n : registerGlobalContext(...args);\n doRegisterComponent(\n CommerceProviderComponent,\n customCommerceProviderMeta ?? commerceProviderMeta\n );\n}\n","import { Registerable } from \"./registerable\";\nimport { registerCommerceProvider } from \"./registerCommerceProvider\";\nexport * from \"./registerable\";\nexport * from \"./registerCommerceProvider\";\nexport * from \"./swell\";\nexport { registerCommerceProvider };\n\nexport function registerAll(loader?: Registerable) {\n registerCommerceProvider(loader);\n}\n"],"names":["SWELL_CHECKOUT_ID_COOKIE","SWELL_CHECKOUT_URL_COOKIE","SWELL_COOKIE_EXPIRE","normalizeProductOption","_ref2","id","_ref2$name","name","displayName","_ref2$values","values","returnValues","map","value","output","label","match","_extends","hexColors","__typename","normalizeProductImages","images","length","url","_ref3","file","rest","_objectWithoutPropertiesLoose","_excluded","height","Number","width","normalizeProductVariants","variants","productOptions","_ref4","price","_ref4$option_value_id","option_value_ids","optionValueIds","split","i","trim","options","matchingOption","find","option","_matchingOption$name","undefined","normalizeProduct","swellProduct","description","slug","currencyCode","currency","emptyVariants","o","productVariants","results","productImages","product","vendor","path","normalizeCart","_ref5","account_id","date_created","tax_included_total","items","sub_total","grand_total","discounts","cart","customerId","email","createdAt","code","taxesIncluded","lineItems","_items$map","normalizeLineItem","lineItemsSubtotalPrice","subtotalPrice","totalPrice","discount","amount","_ref6","variant","quantity","item","variantId","productId","_product$id","_product$name","_variant$id","sku","_variant$sku","image","requiresShipping","listPrice","normalizeChildren","children","ch","normalizeCategory","_ref7","products","depth","parent_id","isEmpty","parentId","handleFetchResponse","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","res","wrap","_callee$","_context","prev","next","error","CommerceError","abrupt","stop","_x","apply","arguments","getCheckoutId","Cookies","get","checkoutToCart","checkoutPayload","message","checkoutCreate","fetch","checkoutUrl","query","method","sent","variables","checkout_url","expires","sameSite","secure","set","handler","fetchOptions","fetcher","useHook","useData","input","response","swrOptions","revalidateOnFocus","useMemo","Object","create","_response$data$lineIt","_response$data","data","enumerable","isInteger","checkoutId","product_id","variant_id","_useCart","useCart","mutate","useCallback","_addItem","_callee2","_callee2$","_context2","addItem","itemId","_removeItem","removeItem","_ref$input","removeItemHandler","ValidationError","ctx","_ctx","debounce","_input$id","_ctx$wait","wait","ensure","x","msg","Error","ensureNoNilFields","fromEntries","entries","filter","v","walkCategoryTree","category","categories","queue","result","_curr$children$map","_curr$children","curr","shift","push","child","topologicalSortForCategoryTree","flatMap","sortMap","Map","categoryId","includeSubCategories","brandId","search","_input$sort","sort","count","mappedSort","includedCategories","brand","expand","limit","$filters","c","_yield$fetch","found","addIsEmptyField","_context3","_data$results","Promise","all","t0","t1","t2","t3","t4","normalizedCategories","_loop","_normalizedCategories","_normalizedCategories2","_loop$","_step","_iterator","_createForOfIteratorHelperLoose","done","delegateYield","_response$data$length","_yield$fetch$values","vendors","Array","from","Set","entityId","_ref$method","callSwell","_callSwell","_callSwell3","arg1","arg2","_response","isArray","swell","_callSwell2","getSwellProvider","storeId","publicKey","init","locale","cartCookie","useAddItem","useUpdateItem","useRemoveItem","useSearch","useProduct","site","useCategories","useBrands","extraFeatures","getCommerceProvider","getCoreCommerceProvider","useCommerce","useCoreCommerce","globalContextName","commerceProviderMeta","props","type","defaultValue","globalActions","globalActionsRegistrations","importPath","importName","CommerceProviderComponent","CommerceProvider","React","CartActionsProvider","registerCommerceProvider","loader","customCommerceProviderMeta","doRegisterComponent","registerGlobalContext","registerAll"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;AAIO,IAAMA,wBAAwB,GAAG,kBAAkB;AAEnD,IAAMC,yBAAyB,GAAG,mBAAmB;AAIrD,IAAMC,mBAAmB,GAAG,EAAE;;;ACSrC,AAmBA,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAAC,KAAA;MAC1BC,EAAE,GAAAD,KAAA,CAAFC,EAAE;IAAAC,UAAA,GAAAF,KAAA,CACFG,IAAI;IAAEC,WAAW,GAAAF,UAAA,cAAG,EAAE,GAAAA,UAAA;IAAAG,YAAA,GA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QpB,OAAO,GAA0BoB,KAAK,CAAtCpB,OAAO;IAAEC,SAAS,GAAemB,KAAK,CAA7BnB,SAAS;IAAEtK,QAAQ,GAAKyL,KAAK,CAAlBzL,QAAQ;EAEpC,IAAMiM,gBAAgB,GAAGC,cAAK,CAAC3I,OAAO,CACpC;IAAA,OAAM4H,mBAAmB,CAACd,OAAO,EAAEC,SAAS,CAAC;KAC7C,CAACD,OAAO,EAAEC,SAAS,CAAC,CACrB;EAED,OACE4B,6BAACD,gBAAgB,QACfC,6BAACC,4BAAmB;IAACZ,iBAAiB,EAAEA;KACrCvL,QAAQ,CACW,CACL;AAEvB;AAEA,SAAgBoM,wBAAwBA,CACtCC,MAAqB,EACrBC,0BAAqE;EAErE,IAAMC,mBAAmB,GAAiC,SAApDA,mBAAmBA;IAAA,OACvBF,MAAM,GACFA,MAAM,CAACG,qBAAqB,CAAA9K,KAAA,CAA5B2K,MAAM,EAAA1K,SAA8B,CAAC,GACrC6K,qBAAqB,CAAA9K,KAAA,SAAAC,SAAQ,CAAC;;EACpC4K,mBAAmB,CACjBP,yBAAyB,EACzBM,0BAA0B,WAA1BA,0BAA0B,GAAId,oBAAoB,CACnD;AACH;;SC7DgBiB,WAAWA,CAACJ,MAAqB;EAC/CD,wBAAwB,CAACC,MAAM,CAAC;AAClC;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"commerce-swell.cjs.development.js","sources":["../src/const.ts","../src/utils/normalize.ts","../src/utils/handle-fetch-response.ts","../src/utils/get-checkout-id.ts","../src/cart/utils/checkout-to-cart.ts","../src/cart/utils/checkout-create.ts","../src/cart/use-cart.tsx","../src/cart/use-add-item.tsx","../src/cart/use-remove-item.tsx","../src/cart/use-update-item.tsx","../src/utils/common.ts","../src/utils/category-tree.ts","../src/product/use-search.tsx","../src/product/use-product.tsx","../src/site/use-categories.ts","../src/site/use-brands.ts","../src/fetcher.ts","../src/provider.ts","../src/swell.ts","../src/registerCommerceProvider.tsx","../src/index.tsx"],"sourcesContent":["/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: Removed store id and public key\n*/\nexport const SWELL_CHECKOUT_ID_COOKIE = 'SWELL_checkoutId'\n\nexport const SWELL_CHECKOUT_URL_COOKIE = 'swell_checkoutUrl'\n\nexport const SWELL_CUSTOMER_TOKEN_COOKIE = 'swell_customerToken'\n\nexport const SWELL_COOKIE_EXPIRE = 30\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: Added \"Default Variant\" to default title when there's no product variant\n*/\nimport { MoneyV2 } from \"../schema\";\nimport type {\n Cart,\n CartLineItem,\n LineItem,\n ProductOptionValue,\n SwellCart,\n SwellImage,\n SwellProduct,\n SwellProductOptionValue,\n SwellVariant,\n} from \"../types\";\nimport { Product, ProductOption } from \"../types/product\";\nimport { Category, SwellCategoryChildren } from \"../types/site\";\n\nconst money = ({ amount, currencyCode }: MoneyV2) => {\n return {\n value: +amount,\n currencyCode,\n };\n};\n\ntype swellProductOption = {\n id: string;\n name: string;\n values: any[];\n};\n\ntype normalizedProductOption = {\n id: string;\n displayName: string;\n values: ProductOptionValue[];\n};\n\nconst normalizeProductOption = ({\n id,\n name: displayName = \"\",\n values = [],\n}: swellProductOption): ProductOption => {\n let returnValues = values.map((value) => {\n let output: any = {\n label: value.name,\n // id: value?.id || id,\n };\n if (displayName.match(/colou?r/gi)) {\n output = {\n ...output,\n hexColors: [value.name],\n };\n }\n return output;\n });\n return {\n __typename: \"MultipleChoiceOption\",\n id,\n displayName,\n values: returnValues,\n };\n};\n\nconst normalizeProductImages = (images: SwellImage[]) => {\n if (!images || images.length < 1) {\n return [{ url: \"/\" }];\n }\n return images?.map(({ file, ...rest }: SwellImage) => ({\n url: file?.url + \"\",\n height: Number(file?.height),\n width: Number(file?.width),\n ...rest,\n }));\n};\n\nconst normalizeProductVariants = (\n variants: SwellVariant[],\n productOptions: swellProductOption[]\n) => {\n return variants?.map(\n ({ id, name, price, option_value_ids: optionValueIds = [] }) => {\n const values = name\n .split(\",\")\n .map((i) => ({ name: i.trim(), label: i.trim() }));\n\n const options = optionValueIds.map((id) => {\n const matchingOption = productOptions.find((option) => {\n return option.values.find(\n (value: SwellProductOptionValue) => value.id == id\n );\n });\n return normalizeProductOption({\n id,\n name: matchingOption?.name ?? \"\",\n values,\n });\n });\n\n return {\n id,\n name,\n // sku: sku ?? id,\n price: price ?? undefined,\n // listPrice: price ?? null,\n // requiresShipping: true,\n options,\n };\n }\n );\n};\n\nexport function normalizeProduct(swellProduct: SwellProduct): Product {\n const {\n id,\n name,\n description,\n images,\n options,\n slug,\n variants,\n price: value,\n currency: currencyCode,\n } = swellProduct;\n // ProductView accesses variants for each product\n const emptyVariants = [{ options: [], id, name: \"Default variant\" }];\n\n const productOptions = options\n ? options.map((o) => normalizeProductOption(o))\n : [];\n const productVariants = variants\n ? normalizeProductVariants(variants.results, options)\n : [];\n\n const productImages = normalizeProductImages(images);\n const product = {\n ...swellProduct,\n description,\n id,\n vendor: \"\",\n path: `/${slug}`,\n images: productImages,\n variants:\n productVariants && productVariants.length\n ? productVariants\n : emptyVariants,\n options: productOptions,\n price: {\n value,\n currencyCode,\n },\n };\n return product;\n}\n\nexport function normalizeCart({\n id,\n account_id,\n date_created,\n currency,\n tax_included_total,\n items,\n sub_total,\n grand_total,\n discounts,\n}: SwellCart) {\n const cart: Cart = {\n id: id,\n customerId: account_id + \"\",\n email: \"\",\n createdAt: date_created,\n currency: { code: currency },\n taxesIncluded: tax_included_total > 0,\n lineItems: items?.map(normalizeLineItem) ?? [],\n lineItemsSubtotalPrice: +sub_total,\n subtotalPrice: +sub_total,\n totalPrice: grand_total,\n discounts: discounts?.map((discount) => ({ value: discount.amount })),\n };\n return cart;\n}\n/*\nexport function normalizeCustomer(customer: SwellCustomer): Customer {\n const { first_name: firstName, last_name: lastName } = customer\n return {\n ...customer,\n firstName,\n lastName,\n }\n}\n*/\nfunction normalizeLineItem({\n id,\n product,\n price,\n variant,\n quantity,\n}: CartLineItem): LineItem {\n const item = {\n id,\n variantId: variant?.id,\n productId: product.id ?? \"\",\n name: product?.name ?? \"\",\n quantity,\n variant: {\n id: variant?.id ?? \"\",\n sku: variant?.sku ?? \"\",\n name: variant?.name!,\n image: {\n url:\n product?.images && product.images.length > 0\n ? product?.images[0].file.url\n : \"/\",\n },\n requiresShipping: false,\n price: price,\n listPrice: price,\n },\n path: \"\",\n discounts: [],\n options: [\n {\n value: variant?.name,\n },\n ],\n };\n return item;\n}\n\nexport function normalizeChildren(children: SwellCategoryChildren) {\n return children?.results.map((ch) => ch.id);\n}\n\nexport function normalizeCategory({\n id,\n name,\n slug,\n products,\n images,\n depth,\n children,\n parent_id,\n}: any): Category {\n return {\n id,\n name,\n slug,\n path: `/${slug}`,\n isEmpty: products?.length === 0,\n images: images?.map((image: any) => ({\n url: image.file.url,\n })),\n depth,\n children: normalizeChildren(children),\n parentId: parent_id,\n };\n}\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport { CommerceError } from '@plasmicpkgs/commerce'\n\ntype SwellFetchResponse = {\n error: {\n message: string\n code?: string\n }\n}\n\nconst handleFetchResponse = async (res: SwellFetchResponse) => {\n if (res) {\n if (res.error) {\n throw new CommerceError(res.error)\n }\n return res\n }\n return null;\n}\n\nexport default handleFetchResponse\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport Cookies from 'js-cookie'\nimport { SWELL_CHECKOUT_ID_COOKIE } from '../const'\n\nconst getCheckoutId = (id?: string) => {\n return id ?? Cookies.get(SWELL_CHECKOUT_ID_COOKIE)\n}\n\nexport default getCheckoutId\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport { CommerceError } from '@plasmicpkgs/commerce'\nimport { CartType } from '@plasmicpkgs/commerce'\n\nimport {\n CheckoutLineItemsAddPayload,\n CheckoutLineItemsRemovePayload,\n CheckoutLineItemsUpdatePayload,\n Maybe,\n} from '../../schema'\nimport { normalizeCart } from '../../utils'\nexport type CheckoutPayload =\n | CheckoutLineItemsAddPayload\n | CheckoutLineItemsUpdatePayload\n | CheckoutLineItemsRemovePayload\n\nconst checkoutToCart = (checkoutPayload?: Maybe<CheckoutPayload>): CartType.Cart => {\n if (!checkoutPayload) {\n throw new CommerceError({\n message: 'Invalid response from Swell',\n })\n }\n return normalizeCart(checkoutPayload as any)\n}\n\nexport default checkoutToCart\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes:\n - Added sameSite and secure to the cookie options to allow third-party cookies.\n\t We need this to make work on the studio\n*/\nimport { SWELL_CHECKOUT_URL_COOKIE, SWELL_COOKIE_EXPIRE } from '../../const'\n\nimport Cookies from 'js-cookie'\n\nexport const checkoutCreate = async (fetch: any) => {\n const cart = await fetch({\n query: 'cart',\n method: 'get',\n })\n\n if (!cart) {\n await fetch({\n query: 'cart',\n method: 'setItems',\n variables: [[]],\n })\n }\n\n const checkoutUrl = cart?.checkout_url\n const options: Cookies.CookieAttributes = {\n expires: SWELL_COOKIE_EXPIRE,\n sameSite: \"none\",\n secure: true\n }\n if (checkoutUrl) {\n Cookies.set(SWELL_CHECKOUT_URL_COOKIE, checkoutUrl, options)\n }\n\n return cart\n}\n\nexport default checkoutCreate\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport { useCart, UseCart } from '@plasmicpkgs/commerce'\nimport { SWRHook } from '@plasmicpkgs/commerce'\nimport { useMemo } from 'react'\nimport { normalizeCart } from '../utils/normalize'\nimport { checkoutCreate, checkoutToCart } from './utils'\nimport type { CartType } from '@plasmicpkgs/commerce'\n\nexport default useCart as UseCart<typeof handler>\n\ntype GetCartHook = CartType.GetCartHook;\n\nexport const handler: SWRHook<GetCartHook> = {\n fetchOptions: {\n query: 'cart',\n method: 'get',\n },\n async fetcher({ fetch }) {\n const cart = await checkoutCreate(fetch)\n\n return cart ? normalizeCart(cart) : null\n },\n useHook:\n ({ useData }) =>\n (input) => {\n const response = useData({\n swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },\n })\n return useMemo(\n () =>\n Object.create(response, {\n isEmpty: {\n get() {\n return (response.data?.lineItems.length ?? 0) <= 0\n },\n enumerable: true,\n },\n }),\n [response]\n )\n },\n}\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport type { MutationHook } from '@plasmicpkgs/commerce'\nimport { CommerceError } from '@plasmicpkgs/commerce'\nimport { useAddItem, UseAddItem } from '@plasmicpkgs/commerce'\nimport useCart from './use-cart'\nimport { checkoutToCart } from './utils'\nimport { getCheckoutId } from '../utils'\nimport { useCallback } from 'react'\nimport { AddItemHook } from '../types/cart'\n\nexport default useAddItem as UseAddItem<typeof handler>\n\nexport const handler: MutationHook<AddItemHook> = {\n fetchOptions: {\n query: 'cart',\n method: 'addItem',\n },\n async fetcher({ input: item, options, fetch }) {\n if (\n item.quantity &&\n (!Number.isInteger(item.quantity) || item.quantity! < 1)\n ) {\n throw new CommerceError({\n message: 'The item quantity has to be a valid integer greater than 0',\n })\n }\n const variables: {\n product_id: string | undefined\n variant_id?: string\n checkoutId?: string\n quantity?: number\n } = {\n checkoutId: getCheckoutId(),\n product_id: item.productId,\n quantity: item.quantity,\n }\n if (item.productId !== item.variantId) {\n variables.variant_id = item.variantId\n }\n\n const response = await fetch({\n ...options,\n variables,\n })\n\n return checkoutToCart(response) as any\n },\n useHook:\n ({ fetch }) =>\n () => {\n const { mutate } = useCart()\n\n return useCallback(\n async function addItem(input) {\n const data = await fetch({ input })\n await mutate(data, false)\n return data\n },\n [fetch, mutate]\n )\n },\n}\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport type {\n HookFetcherContext,\n MutationHookContext,\n} from \"@plasmicpkgs/commerce\";\nimport { useCallback } from \"react\";\n\nimport { CartType, useRemoveItem, UseRemoveItem } from \"@plasmicpkgs/commerce\";\nimport useCart from \"./use-cart\";\nimport { checkoutToCart } from \"./utils\";\n\ntype Cart = CartType.Cart;\ntype LineItem = CartType.LineItem;\ntype RemoveItemHook = CartType.RemoveItemHook;\n\nexport type RemoveItemFn<T = any> = T extends LineItem\n ? (input?: RemoveItemActionInput<T>) => Promise<Cart | null | undefined>\n : (input: RemoveItemActionInput<T>) => Promise<Cart | null>;\n\nexport type RemoveItemActionInput<T = any> = T extends LineItem\n ? Partial<RemoveItemHook[\"actionInput\"]>\n : RemoveItemHook[\"actionInput\"];\n\nexport default useRemoveItem as UseRemoveItem<typeof handler>;\n\nexport const handler = {\n fetchOptions: {\n query: \"cart\",\n method: \"removeItem\",\n },\n async fetcher({\n input: { itemId },\n options,\n fetch,\n }: HookFetcherContext<RemoveItemHook>) {\n const response = await fetch({ ...options, variables: [itemId] });\n\n return checkoutToCart(response);\n },\n useHook: ({ fetch }: MutationHookContext<RemoveItemHook>) => () => {\n const { mutate } = useCart();\n\n return useCallback(\n async function removeItem(input: { id: string }) {\n const data = await fetch({ input: { itemId: input.id } });\n await mutate(data, false);\n\n return data;\n },\n [fetch, mutate]\n );\n },\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport type {\n HookFetcherContext,\n MutationHookContext,\n} from \"@plasmicpkgs/commerce\";\nimport { ValidationError } from \"@plasmicpkgs/commerce\";\nimport debounce from \"debounce\";\nimport { useCallback } from \"react\";\n// import useUpdateItem, {\n// UpdateItemInput as UpdateItemInputBase,\n// UseUpdateItem,\n// } from '@vercel/commerce/cart/use-update-item'\nimport { CartType, useUpdateItem, UseUpdateItem } from \"@plasmicpkgs/commerce\";\nimport { UpdateItemHook } from \"../types/cart\";\nimport useCart from \"./use-cart\";\nimport { handler as removeItemHandler } from \"./use-remove-item\";\nimport { checkoutToCart } from \"./utils\";\n// export type UpdateItemInput<T = any> = T extends LineItem\n// ? Partial<UpdateItemInputBase<LineItem>>\n// : UpdateItemInputBase<LineItem>\n\nexport default useUpdateItem as UseUpdateItem<typeof handler>;\n\ntype CartItemBody = CartType.CartItemBody;\ntype LineItem = CartType.LineItem;\n\nexport type UpdateItemActionInput<T = any> = T extends LineItem\n ? Partial<UpdateItemHook[\"actionInput\"]>\n : UpdateItemHook[\"actionInput\"];\n\nexport const handler = {\n fetchOptions: {\n query: \"cart\",\n method: \"updateItem\",\n },\n async fetcher({\n input: { itemId, item },\n options,\n fetch,\n }: HookFetcherContext<UpdateItemHook>) {\n if (Number.isInteger(item.quantity)) {\n // Also allow the update hook to remove an item if the quantity is lower than 1\n if (item.quantity! < 1) {\n return removeItemHandler.fetcher({\n options: removeItemHandler.fetchOptions,\n input: { itemId },\n fetch,\n });\n }\n } else if (item.quantity) {\n throw new ValidationError({\n message: \"The item quantity has to be a valid integer\",\n });\n }\n const response = await fetch({\n ...options,\n variables: [itemId, { quantity: item.quantity }],\n });\n\n return checkoutToCart(response);\n },\n useHook:\n ({ fetch }: MutationHookContext<UpdateItemHook>) =>\n <T extends LineItem | undefined = undefined>(\n ctx: {\n item?: T;\n wait?: number;\n } = {}\n ) => {\n const { item } = ctx;\n const { mutate, data: cartData } = useCart() as any;\n\n return useCallback(\n debounce(async (input: UpdateItemActionInput) => {\n const itemId = input.id ?? item?.id;\n if (!itemId) {\n throw new ValidationError({\n message: \"Invalid input used for this operation\",\n });\n }\n\n const data = await fetch({\n input: {\n item: {\n quantity: input.quantity,\n },\n itemId,\n },\n });\n await mutate(data, false);\n return data;\n }, ctx.wait ?? 500),\n [fetch, mutate]\n );\n },\n};\n","export function ensure<T>(x: T | null | undefined, msg = \"\"): T {\n if (x === null || x === undefined) {\n debugger;\n throw new Error(\n `Value must not be undefined or null${msg ? `- ${msg}` : \"\"}`\n );\n } else {\n return x;\n }\n}\n\nexport const ensureNoNilFields = (\n o: Record<string, any>\n): Record<string, any> =>\n Object.fromEntries(Object.entries(o).filter(([k, v]) => v != null));\n","import { Category } from \"../types/site\";\nimport { ensure } from \"./common\";\n\nexport const walkCategoryTree = (\n category?: Category,\n categories?: Category[]\n) => {\n if (!category || !categories) {\n return [];\n }\n\n const queue: Category[] = [category];\n const result: Category[] = [];\n while (queue.length > 0) {\n const curr = ensure(queue.shift());\n result.push(curr);\n queue.push(\n ...(curr.children?.map((child) =>\n ensure(\n categories.find((category) => category.id === child),\n \"The child category must always exist in the categories list\"\n )\n ) ?? [])\n );\n }\n return result;\n};\n\nexport const topologicalSortForCategoryTree = (categories: Category[]) => {\n return categories\n .filter((category) => !category.parentId)\n .flatMap((category) => walkCategoryTree(category, categories));\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: Added count as a parameter to input\n*/\nimport type { SearchProductsHook } from \"@plasmicpkgs/commerce\";\nimport {\n HookSWRInput,\n SWRHook,\n useSearch,\n UseSearch,\n} from \"@plasmicpkgs/commerce\";\nimport { SwellProduct } from \"../types\";\nimport { Category } from \"../types/site\";\nimport { normalizeProduct } from \"../utils\";\nimport { walkCategoryTree } from \"../utils/category-tree\";\nimport { ensureNoNilFields } from \"../utils/common\";\n\nexport type SearchProductsInput = {\n search?: string;\n categoryId?: string;\n brandId?: string;\n sort?: string;\n count?: number;\n includeSubCategories?: boolean;\n categories?: Category[];\n};\n\nconst useSearchTyped: UseSearch<typeof handler> = useSearch;\nexport default useSearchTyped;\n\nexport const handler: SWRHook<SearchProductsHook> = {\n fetchOptions: {\n query: \"products\",\n method: \"list\",\n },\n async fetcher({ input, options, fetch }) {\n const sortMap = new Map([\n [\"latest-desc\", \"\"],\n [\"price-asc\", \"price asc\"],\n [\"price-desc\", \"price desc\"],\n [\"trending-desc\", \"popularity\"],\n ]);\n const {\n categoryId,\n includeSubCategories,\n categories,\n brandId,\n search,\n sort = \"latest-desc\",\n count,\n } = input;\n const mappedSort = sortMap.get(sort);\n\n const includedCategories = includeSubCategories\n ? walkCategoryTree(\n categories?.find((category) => category.id === categoryId),\n categories\n )\n : undefined;\n\n const { results: products } = await fetch({\n query: options.query,\n method: options.method,\n variables: ensureNoNilFields({\n category: !includeSubCategories ? categoryId : undefined,\n brand: brandId,\n search,\n sort: mappedSort,\n expand: [\"variants\"],\n limit: count,\n $filters: {\n ...(includeSubCategories\n ? { category: includedCategories?.map((c) => c.id) }\n : {}),\n },\n }),\n });\n\n return {\n products: products.map((product: SwellProduct) =>\n normalizeProduct(product)\n ),\n found: products.length > 0,\n };\n },\n useHook:\n ({ useData }) =>\n (input = {}) => {\n return useData({\n input: [\n [\"search\", input.search],\n [\"categoryId\", input.categoryId],\n [\"includeSubCategories\", input.includeSubCategories],\n [\"categories\", input.categories],\n [\"brandId\", input.brandId],\n [\"sort\", input.sort],\n [\"count\", input.count],\n ] as HookSWRInput,\n swrOptions: {\n revalidateOnFocus: false,\n ...input.swrOptions,\n },\n });\n },\n};\n","import { GetProductHook, SWRHook, UseProduct, useProduct } from '@plasmicpkgs/commerce'\nimport { normalizeProduct } from '../utils'\nimport { SwellProduct } from '../types'\n\nexport type GetProductInput = {\n id?: string;\n}\n\nexport default useProduct as UseProduct<typeof handler>\n\nexport const handler: SWRHook<GetProductHook> = {\n fetchOptions: {\n query: 'products',\n method: 'get',\n },\n async fetcher({ input, options, fetch }) {\n const { id } = input;\n const product = await fetch({\n query: options.query,\n method: options.method,\n variables: [id],\n });\n if (!product) {\n return null;\n }\n return normalizeProduct(product);\n },\n useHook:\n ({ useData }) =>\n (input = {}) => {\n return useData({\n input: [\n ['id', input.id],\n ],\n swrOptions: {\n revalidateOnFocus: false,\n ...input.swrOptions,\n },\n })\n },\n}\n","import {\n SiteTypes,\n SWRHook,\n useCategories,\n UseCategories,\n} from \"@plasmicpkgs/commerce\";\nimport { useMemo } from \"react\";\nimport { Category } from \"../types/site\";\nimport { normalizeCategory } from \"../utils\";\nimport { topologicalSortForCategoryTree } from \"../utils/category-tree\";\nimport { ensureNoNilFields } from \"../utils/common\";\n\nexport default useCategories as UseCategories<typeof handler>;\n\ntype GetCategoriesHook = SiteTypes.GetCategoriesHook;\n\nexport const handler: SWRHook<GetCategoriesHook> = {\n fetchOptions: {\n query: \"categories\",\n method: \"get\",\n },\n async fetcher({ input, options, fetch }) {\n const { addIsEmptyField, categoryId } = input;\n\n const data = await fetch({\n query: options.query,\n method: options.method,\n variables: ensureNoNilFields({\n expand: [\"children\", \"parent_id\"],\n id: categoryId,\n }),\n });\n\n let categories = data?.results ?? [];\n if (addIsEmptyField) {\n categories = await Promise.all(\n categories.map(async (category: any) => ({\n ...category,\n products: (\n await fetch({\n query: \"products\",\n method: \"list\",\n variables: ensureNoNilFields({\n limit: 1,\n category: category.id,\n }),\n })\n ).results,\n }))\n );\n }\n\n const normalizedCategories: Category[] = !categoryId\n ? topologicalSortForCategoryTree(categories.map(normalizeCategory))\n : categories.map(normalizeCategory);\n\n for (const category of normalizedCategories) {\n category.depth =\n (normalizedCategories.find((c) => c.id === category.parentId)?.depth ??\n -1) + 1;\n }\n return normalizedCategories;\n },\n useHook: ({ useData }) => (input) => {\n const response = useData({\n input: [\n [\"addIsEmptyField\", input?.addIsEmptyField],\n [\"categoryId\", input?.categoryId],\n ],\n swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },\n });\n return useMemo(\n () =>\n Object.create(response, {\n isEmpty: {\n get() {\n return (response.data?.length ?? 0) <= 0;\n },\n enumerable: true,\n },\n }),\n [response]\n );\n },\n};\n","import {\n SiteTypes,\n SWRHook,\n useBrands,\n UseBrands,\n} from \"@plasmicpkgs/commerce\";\nimport { useMemo } from \"react\";\n\nexport default useBrands as UseBrands<typeof handler>;\n\ntype GetBrandsHook = SiteTypes.GetBrandsHook;\n\nexport const handler: SWRHook<GetBrandsHook> = {\n fetchOptions: {\n query: \"attributes\",\n method: \"get\",\n },\n async fetcher({ fetch }) {\n const vendors: [string] =\n (\n await fetch({\n query: \"attributes\",\n method: \"get\",\n variables: \"brand\",\n })\n )?.values ?? [];\n return Array.from(new Set(vendors).values()).map((v) => ({\n entityId: v,\n name: v,\n path: `brands/${v}`,\n }));\n },\n useHook: ({ useData }) => (input) => {\n const response = useData({\n swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },\n });\n return useMemo(\n () =>\n Object.create(response, {\n isEmpty: {\n get() {\n return (response.data?.length ?? 0) <= 0;\n },\n enumerable: true,\n },\n }),\n [response]\n );\n },\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport { Fetcher } from '@plasmicpkgs/commerce'\nimport { CommerceError } from '@plasmicpkgs/commerce'\nimport { handleFetchResponse } from './utils'\nimport swell from './provider'\n\nconst fetcher: Fetcher = async ({ method = 'get', variables, query }) => {\n async function callSwell() {\n if (Array.isArray(variables)) {\n const arg1 = variables[0]\n const arg2 = variables[1]\n const response = await swell[query!][method](arg1, arg2)\n return handleFetchResponse(response)\n } else {\n const response = await swell[query!][method](variables)\n return handleFetchResponse(response)\n }\n }\n\n if (query && query in swell) {\n return await callSwell()\n } else {\n throw new CommerceError({ message: 'Invalid query argument!' })\n }\n}\n\nexport default fetcher\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: Added storeId and publicKey parameters\n*/\n// @ts-ignore\nimport swell, { init } from \"swell-js\";\n\nimport { CommerceExtraFeatures, Provider } from \"@plasmicpkgs/commerce\";\nimport { SWELL_CHECKOUT_ID_COOKIE } from \"./const\";\nimport { handler as useCart } from \"./cart/use-cart\";\nimport { handler as useAddItem } from \"./cart/use-add-item\";\nimport { handler as useUpdateItem } from \"./cart/use-update-item\";\nimport { handler as useRemoveItem } from \"./cart/use-remove-item\";\nimport { handler as useSearch } from \"./product/use-search\";\nimport { handler as useProduct } from \"./product/use-product\";\nimport { handler as useCategories } from \"./site/use-categories\";\nimport { handler as useBrands } from \"./site/use-brands\";\nimport fetcher from \"./fetcher\";\nimport { Fetcher } from \"@plasmicpkgs/commerce\";\n\nexport const getSwellProvider = (storeId: string, publicKey: string) => {\n init(storeId, publicKey);\n\n return {\n locale: \"en-us\",\n cartCookie: SWELL_CHECKOUT_ID_COOKIE,\n swell,\n fetcher,\n cart: { useCart, useAddItem, useUpdateItem, useRemoveItem },\n products: { useSearch, useProduct },\n site: { useCategories, useBrands },\n extraFeatures: {\n includeSubCategories: true,\n },\n };\n};\n\nexport type SwellProvider = {\n locale: string;\n cartCookie: string;\n fetcher: Fetcher;\n cart: {\n useCart: typeof useCart;\n useAddItem: typeof useAddItem;\n useUpdateItem: typeof useUpdateItem;\n useRemoveItem: typeof useRemoveItem;\n };\n products: {\n useSearch: typeof useSearch;\n };\n site: {\n useCategories: typeof useCategories;\n useBrands: typeof useBrands;\n };\n extraFeatures: CommerceExtraFeatures;\n swell: any;\n};\n\nexport default swell as any;\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport {\n CommerceAPIConfig,\n getCommerceProvider as getCoreCommerceProvider,\n useCommerce as useCoreCommerce,\n} from '@plasmicpkgs/commerce'\nimport { SWELL_CHECKOUT_ID_COOKIE, SWELL_COOKIE_EXPIRE, SWELL_CUSTOMER_TOKEN_COOKIE } from './const'\nimport { getSwellProvider, SwellProvider } from './provider'\nimport fetchApi from './utils/fetch-swell-api'\n\nexport type { SwellProvider }\n\nexport const getCommerceProvider = (storeId: string, publicKey: string) => \n getCoreCommerceProvider(getSwellProvider(storeId, publicKey))\n\nexport const useCommerce = () => useCoreCommerce<SwellProvider>()\n\n\nexport interface SwellConfig extends CommerceAPIConfig {\n fetch: any\n}\n\nconst config: SwellConfig = {\n locale: 'en-US',\n commerceUrl: '',\n apiToken: ''!,\n cartCookie: SWELL_CHECKOUT_ID_COOKIE,\n cartCookieMaxAge: SWELL_COOKIE_EXPIRE,\n fetch: fetchApi,\n customerCookie: SWELL_CUSTOMER_TOKEN_COOKIE,\n}\n","import { GlobalContextMeta } from \"@plasmicapp/host\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport {\n CartActionsProvider,\n globalActionsRegistrations,\n} from \"@plasmicpkgs/commerce\";\nimport React from \"react\";\nimport { Registerable } from \"./registerable\";\nimport { getCommerceProvider } from \"./swell\";\n\ninterface CommerceProviderProps {\n children?: React.ReactNode;\n storeId: string;\n publicKey: string;\n}\n\nconst globalContextName = \"plasmic-commerce-swell-provider\";\n\nexport const commerceProviderMeta: GlobalContextMeta<CommerceProviderProps> = {\n name: \"plasmic-commerce-swell-provider\",\n displayName: \"Swell Provider\",\n props: {\n storeId: {\n type: \"string\",\n defaultValue: \"plasmic-sandbox\",\n },\n publicKey: {\n type: \"string\",\n defaultValue: \"pk_QaZeGhtpQaVbNQnWJdRlE1abE6Ezf9U9\",\n },\n },\n ...{ globalActions: globalActionsRegistrations },\n description: `Get your store ID and public storefront API key from the Swell admin UI under Developer > API Keys.\n\n[Watch how to use this integration](https://www.youtube.com/watch?v=b2mgOTbP2_8).`,\n importPath: \"@plasmicpkgs/commerce-swell\",\n importName: \"CommerceProviderComponent\",\n};\n\nexport function CommerceProviderComponent(props: CommerceProviderProps) {\n const { storeId, publicKey, children } = props;\n\n const CommerceProvider = React.useMemo(\n () => getCommerceProvider(storeId, publicKey),\n [storeId, publicKey]\n );\n\n return (\n <CommerceProvider>\n <CartActionsProvider globalContextName={globalContextName}>\n {children}\n </CartActionsProvider>\n </CommerceProvider>\n );\n}\n\nexport function registerCommerceProvider(\n loader?: Registerable,\n customCommerceProviderMeta?: GlobalContextMeta<CommerceProviderProps>\n) {\n const doRegisterComponent: typeof registerGlobalContext = (...args) =>\n loader\n ? loader.registerGlobalContext(...args)\n : registerGlobalContext(...args);\n doRegisterComponent(\n CommerceProviderComponent,\n customCommerceProviderMeta ?? commerceProviderMeta\n );\n}\n","import { Registerable } from \"./registerable\";\nimport { registerCommerceProvider } from \"./registerCommerceProvider\";\nexport * from \"./registerable\";\nexport * from \"./registerCommerceProvider\";\nexport * from \"./swell\";\nexport { registerCommerceProvider };\n\nexport function registerAll(loader?: Registerable) {\n registerCommerceProvider(loader);\n}\n"],"names":["SWELL_CHECKOUT_ID_COOKIE","SWELL_CHECKOUT_URL_COOKIE","SWELL_COOKIE_EXPIRE","normalizeProductOption","_ref2","id","_ref2$name","name","displayName","_ref2$values","values","returnValues","map","value","output","label","match","_extends","hexColors","__typename","normalizeProductImages","images","length","url","_ref3","file","rest","_objectWithoutPropertiesLoose","_excluded","height","Number","width","normalizeProductVariants","variants","productOptions","_ref4","price","_ref4$option_value_id","option_value_ids","optionValueIds","split","i","trim","options","matchingOption","find","option","_matchingOption$name","undefined","normalizeProduct","swellProduct","description","slug","currencyCode","currency","emptyVariants","o","productVariants","results","productImages","product","vendor","path","normalizeCart","_ref5","account_id","date_created","tax_included_total","items","sub_total","grand_total","discounts","cart","customerId","email","createdAt","code","taxesIncluded","lineItems","_items$map","normalizeLineItem","lineItemsSubtotalPrice","subtotalPrice","totalPrice","discount","amount","_ref6","variant","quantity","item","variantId","productId","_product$id","_product$name","_variant$id","sku","_variant$sku","image","requiresShipping","listPrice","normalizeChildren","children","ch","normalizeCategory","_ref7","products","depth","parent_id","isEmpty","parentId","handleFetchResponse","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","res","wrap","_callee$","_context","prev","next","error","CommerceError","abrupt","stop","_x","apply","arguments","getCheckoutId","Cookies","get","checkoutToCart","checkoutPayload","message","checkoutCreate","fetch","checkoutUrl","query","method","sent","variables","checkout_url","expires","sameSite","secure","set","handler","fetchOptions","fetcher","useHook","useData","input","response","swrOptions","revalidateOnFocus","useMemo","Object","create","_response$data$lineIt","_response$data","data","enumerable","isInteger","checkoutId","product_id","variant_id","_useCart","useCart","mutate","useCallback","_addItem","_callee2","_callee2$","_context2","addItem","itemId","_removeItem","removeItem","_ref$input","removeItemHandler","ValidationError","ctx","_ctx","debounce","_input$id","_ctx$wait","wait","ensure","x","msg","Error","ensureNoNilFields","fromEntries","entries","filter","v","walkCategoryTree","category","categories","queue","result","_curr$children$map","_curr$children","curr","shift","push","child","topologicalSortForCategoryTree","flatMap","sortMap","Map","categoryId","includeSubCategories","brandId","search","_input$sort","sort","count","mappedSort","includedCategories","brand","expand","limit","$filters","c","_yield$fetch","found","addIsEmptyField","_context3","_data$results","Promise","all","t0","t1","t2","t3","t4","normalizedCategories","_loop","_normalizedCategories","_normalizedCategories2","_loop$","_step","_iterator","_createForOfIteratorHelperLoose","done","delegateYield","_response$data$length","_yield$fetch$values","vendors","Array","from","Set","entityId","_ref$method","callSwell","_callSwell","_callSwell3","arg1","arg2","_response","isArray","swell","_callSwell2","getSwellProvider","storeId","publicKey","init","locale","cartCookie","useAddItem","useUpdateItem","useRemoveItem","useSearch","useProduct","site","useCategories","useBrands","extraFeatures","getCommerceProvider","getCoreCommerceProvider","useCommerce","useCoreCommerce","globalContextName","commerceProviderMeta","props","type","defaultValue","globalActions","globalActionsRegistrations","importPath","importName","CommerceProviderComponent","CommerceProvider","React","CartActionsProvider","registerCommerceProvider","loader","customCommerceProviderMeta","doRegisterComponent","registerGlobalContext","registerAll"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;AAIO,IAAMA,wBAAwB,GAAG,kBAAkB;AAEnD,IAAMC,yBAAyB,GAAG,mBAAmB;AAIrD,IAAMC,mBAAmB,GAAG,EAAE;;;ACSrC,AAmBA,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAAC,KAAA;MAC1BC,EAAE,GAAAD,KAAA,CAAFC,EAAE;I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ChFgP,UAAU,EAAE,6BAA6B;EACzCC,UAAU,EAAE;AAA2B,EACxC;AAED,SAAgBC,yBAAyBA,CAACP,KAA4B;EACpE,IAAQpB,OAAO,GAA0BoB,KAAK,CAAtCpB,OAAO;IAAEC,SAAS,GAAemB,KAAK,CAA7BnB,SAAS;IAAEtK,QAAQ,GAAKyL,KAAK,CAAlBzL,QAAQ;EAEpC,IAAMiM,gBAAgB,GAAGC,cAAK,CAAC3I,OAAO,CACpC;IAAA,OAAM4H,mBAAmB,CAACd,OAAO,EAAEC,SAAS,CAAC;KAC7C,CAACD,OAAO,EAAEC,SAAS,CAAC,CACrB;EAED,OACE4B,6BAACD,gBAAgB,QACfC,6BAACC,4BAAmB;IAACZ,iBAAiB,EAAEA;KACrCvL,QAAQ,CACW,CACL;AAEvB;AAEA,SAAgBoM,wBAAwBA,CACtCC,MAAqB,EACrBC,0BAAqE;EAErE,IAAMC,mBAAmB,GAAiC,SAApDA,mBAAmBA;IAAA,OACvBF,MAAM,GACFA,MAAM,CAACG,qBAAqB,CAAA9K,KAAA,CAA5B2K,MAAM,EAAA1K,SAA8B,CAAC,GACrC6K,qBAAqB,CAAA9K,KAAA,SAAAC,SAAQ,CAAC;;EACpC4K,mBAAmB,CACjBP,yBAAyB,EACzBM,0BAA0B,WAA1BA,0BAA0B,GAAId,oBAAoB,CACnD;AACH;;SC7DgBiB,WAAWA,CAACJ,MAAqB;EAC/CD,wBAAwB,CAACC,MAAM,CAAC;AAClC;;;;;;;;;"}
|
|
@@ -621,7 +621,7 @@ function normalizeCategory(_ref7) {
|
|
|
621
621
|
}
|
|
622
622
|
|
|
623
623
|
var handleFetchResponse = /*#__PURE__*/function () {
|
|
624
|
-
var _ref = /*#__PURE__*/_asyncToGenerator(
|
|
624
|
+
var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
|
|
625
625
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
626
626
|
while (1) switch (_context.prev = _context.next) {
|
|
627
627
|
case 0:
|
|
@@ -671,7 +671,7 @@ var checkoutToCart = function checkoutToCart(checkoutPayload) {
|
|
|
671
671
|
};
|
|
672
672
|
|
|
673
673
|
var checkoutCreate = /*#__PURE__*/function () {
|
|
674
|
-
var _ref = /*#__PURE__*/_asyncToGenerator(
|
|
674
|
+
var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(fetch) {
|
|
675
675
|
var cart, checkoutUrl, options;
|
|
676
676
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
677
677
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -721,7 +721,7 @@ var handler = {
|
|
|
721
721
|
method: 'get'
|
|
722
722
|
},
|
|
723
723
|
fetcher: function fetcher(_ref) {
|
|
724
|
-
return _asyncToGenerator(
|
|
724
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
725
725
|
var fetch, cart;
|
|
726
726
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
727
727
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -768,7 +768,7 @@ var handler$1 = {
|
|
|
768
768
|
method: 'addItem'
|
|
769
769
|
},
|
|
770
770
|
fetcher: function fetcher(_ref) {
|
|
771
|
-
return _asyncToGenerator(
|
|
771
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
772
772
|
var item, options, fetch, variables, response;
|
|
773
773
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
774
774
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -809,8 +809,8 @@ var handler$1 = {
|
|
|
809
809
|
return function () {
|
|
810
810
|
var _useCart = useCart(),
|
|
811
811
|
mutate = _useCart.mutate;
|
|
812
|
-
return useCallback(
|
|
813
|
-
var _addItem = _asyncToGenerator(
|
|
812
|
+
return useCallback(/*#__PURE__*/function () {
|
|
813
|
+
var _addItem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
|
|
814
814
|
var data;
|
|
815
815
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
816
816
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -846,7 +846,7 @@ var handler$2 = {
|
|
|
846
846
|
method: "removeItem"
|
|
847
847
|
},
|
|
848
848
|
fetcher: function fetcher(_ref) {
|
|
849
|
-
return _asyncToGenerator(
|
|
849
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
850
850
|
var itemId, options, fetch, response;
|
|
851
851
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
852
852
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -871,8 +871,8 @@ var handler$2 = {
|
|
|
871
871
|
return function () {
|
|
872
872
|
var _useCart = useCart(),
|
|
873
873
|
mutate = _useCart.mutate;
|
|
874
|
-
return useCallback(
|
|
875
|
-
var _removeItem = _asyncToGenerator(
|
|
874
|
+
return useCallback(/*#__PURE__*/function () {
|
|
875
|
+
var _removeItem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
|
|
876
876
|
var data;
|
|
877
877
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
878
878
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -910,7 +910,7 @@ var handler$3 = {
|
|
|
910
910
|
method: "updateItem"
|
|
911
911
|
},
|
|
912
912
|
fetcher: function fetcher(_ref) {
|
|
913
|
-
return _asyncToGenerator(
|
|
913
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
914
914
|
var _ref$input, itemId, item, options, fetch, response;
|
|
915
915
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
916
916
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -970,8 +970,8 @@ var handler$3 = {
|
|
|
970
970
|
item = _ctx.item;
|
|
971
971
|
var _useCart = useCart(),
|
|
972
972
|
mutate = _useCart.mutate;
|
|
973
|
-
return useCallback(debounce(
|
|
974
|
-
var _ref3 = _asyncToGenerator(
|
|
973
|
+
return useCallback(debounce(/*#__PURE__*/function () {
|
|
974
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
|
|
975
975
|
var _input$id;
|
|
976
976
|
var itemId, data;
|
|
977
977
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
@@ -1065,7 +1065,7 @@ var handler$4 = {
|
|
|
1065
1065
|
method: "list"
|
|
1066
1066
|
},
|
|
1067
1067
|
fetcher: function fetcher(_ref) {
|
|
1068
|
-
return _asyncToGenerator(
|
|
1068
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1069
1069
|
var input, options, fetch, sortMap, categoryId, includeSubCategories, categories, brandId, search, _input$sort, sort, count, mappedSort, includedCategories, _yield$fetch, products;
|
|
1070
1070
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1071
1071
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -1133,7 +1133,7 @@ var handler$5 = {
|
|
|
1133
1133
|
method: 'get'
|
|
1134
1134
|
},
|
|
1135
1135
|
fetcher: function fetcher(_ref) {
|
|
1136
|
-
return _asyncToGenerator(
|
|
1136
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1137
1137
|
var input, options, fetch, id, product;
|
|
1138
1138
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1139
1139
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -1184,7 +1184,7 @@ var handler$6 = {
|
|
|
1184
1184
|
method: "get"
|
|
1185
1185
|
},
|
|
1186
1186
|
fetcher: function fetcher(_ref) {
|
|
1187
|
-
return _asyncToGenerator(
|
|
1187
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
1188
1188
|
var _data$results;
|
|
1189
1189
|
var input, options, fetch, addIsEmptyField, categoryId, data, categories, normalizedCategories, _loop, _iterator, _step;
|
|
1190
1190
|
return _regeneratorRuntime().wrap(function _callee2$(_context3) {
|
|
@@ -1209,8 +1209,8 @@ var handler$6 = {
|
|
|
1209
1209
|
break;
|
|
1210
1210
|
}
|
|
1211
1211
|
_context3.next = 9;
|
|
1212
|
-
return Promise.all(categories.map(
|
|
1213
|
-
var _ref2 = _asyncToGenerator(
|
|
1212
|
+
return Promise.all(categories.map(/*#__PURE__*/function () {
|
|
1213
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(category) {
|
|
1214
1214
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1215
1215
|
while (1) switch (_context.prev = _context.next) {
|
|
1216
1216
|
case 0:
|
|
@@ -1311,7 +1311,7 @@ var handler$7 = {
|
|
|
1311
1311
|
method: "get"
|
|
1312
1312
|
},
|
|
1313
1313
|
fetcher: function fetcher(_ref) {
|
|
1314
|
-
return _asyncToGenerator(
|
|
1314
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1315
1315
|
var _yield$fetch$values, _yield$fetch;
|
|
1316
1316
|
var fetch, vendors;
|
|
1317
1317
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -1386,13 +1386,13 @@ var handler$7 = {
|
|
|
1386
1386
|
};
|
|
1387
1387
|
|
|
1388
1388
|
var fetcher = /*#__PURE__*/function () {
|
|
1389
|
-
var _ref2 = /*#__PURE__*/_asyncToGenerator(
|
|
1389
|
+
var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
1390
1390
|
var _ref$method, method, variables, query, callSwell, _callSwell;
|
|
1391
1391
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1392
1392
|
while (1) switch (_context2.prev = _context2.next) {
|
|
1393
1393
|
case 0:
|
|
1394
1394
|
_callSwell = function _callSwell3() {
|
|
1395
|
-
_callSwell = _asyncToGenerator(
|
|
1395
|
+
_callSwell = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1396
1396
|
var arg1, arg2, response, _response;
|
|
1397
1397
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1398
1398
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commerce-swell.esm.js","sources":["../src/const.ts","../src/utils/normalize.ts","../src/utils/handle-fetch-response.ts","../src/utils/get-checkout-id.ts","../src/cart/utils/checkout-to-cart.ts","../src/cart/utils/checkout-create.ts","../src/cart/use-cart.tsx","../src/cart/use-add-item.tsx","../src/cart/use-remove-item.tsx","../src/cart/use-update-item.tsx","../src/utils/common.ts","../src/utils/category-tree.ts","../src/product/use-search.tsx","../src/product/use-product.tsx","../src/site/use-categories.ts","../src/site/use-brands.ts","../src/fetcher.ts","../src/provider.ts","../src/swell.ts","../src/registerCommerceProvider.tsx","../src/index.tsx"],"sourcesContent":["/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: Removed store id and public key\n*/\nexport const SWELL_CHECKOUT_ID_COOKIE = 'SWELL_checkoutId'\n\nexport const SWELL_CHECKOUT_URL_COOKIE = 'swell_checkoutUrl'\n\nexport const SWELL_CUSTOMER_TOKEN_COOKIE = 'swell_customerToken'\n\nexport const SWELL_COOKIE_EXPIRE = 30\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: Added \"Default Variant\" to default title when there's no product variant\n*/\nimport { MoneyV2 } from \"../schema\";\nimport type {\n Cart,\n CartLineItem,\n LineItem,\n ProductOptionValue,\n SwellCart,\n SwellImage,\n SwellProduct,\n SwellProductOptionValue,\n SwellVariant,\n} from \"../types\";\nimport { Product, ProductOption } from \"../types/product\";\nimport { Category, SwellCategoryChildren } from \"../types/site\";\n\nconst money = ({ amount, currencyCode }: MoneyV2) => {\n return {\n value: +amount,\n currencyCode,\n };\n};\n\ntype swellProductOption = {\n id: string;\n name: string;\n values: any[];\n};\n\ntype normalizedProductOption = {\n id: string;\n displayName: string;\n values: ProductOptionValue[];\n};\n\nconst normalizeProductOption = ({\n id,\n name: displayName = \"\",\n values = [],\n}: swellProductOption): ProductOption => {\n let returnValues = values.map((value) => {\n let output: any = {\n label: value.name,\n // id: value?.id || id,\n };\n if (displayName.match(/colou?r/gi)) {\n output = {\n ...output,\n hexColors: [value.name],\n };\n }\n return output;\n });\n return {\n __typename: \"MultipleChoiceOption\",\n id,\n displayName,\n values: returnValues,\n };\n};\n\nconst normalizeProductImages = (images: SwellImage[]) => {\n if (!images || images.length < 1) {\n return [{ url: \"/\" }];\n }\n return images?.map(({ file, ...rest }: SwellImage) => ({\n url: file?.url + \"\",\n height: Number(file?.height),\n width: Number(file?.width),\n ...rest,\n }));\n};\n\nconst normalizeProductVariants = (\n variants: SwellVariant[],\n productOptions: swellProductOption[]\n) => {\n return variants?.map(\n ({ id, name, price, option_value_ids: optionValueIds = [] }) => {\n const values = name\n .split(\",\")\n .map((i) => ({ name: i.trim(), label: i.trim() }));\n\n const options = optionValueIds.map((id) => {\n const matchingOption = productOptions.find((option) => {\n return option.values.find(\n (value: SwellProductOptionValue) => value.id == id\n );\n });\n return normalizeProductOption({\n id,\n name: matchingOption?.name ?? \"\",\n values,\n });\n });\n\n return {\n id,\n name,\n // sku: sku ?? id,\n price: price ?? undefined,\n // listPrice: price ?? null,\n // requiresShipping: true,\n options,\n };\n }\n );\n};\n\nexport function normalizeProduct(swellProduct: SwellProduct): Product {\n const {\n id,\n name,\n description,\n images,\n options,\n slug,\n variants,\n price: value,\n currency: currencyCode,\n } = swellProduct;\n // ProductView accesses variants for each product\n const emptyVariants = [{ options: [], id, name: \"Default variant\" }];\n\n const productOptions = options\n ? options.map((o) => normalizeProductOption(o))\n : [];\n const productVariants = variants\n ? normalizeProductVariants(variants.results, options)\n : [];\n\n const productImages = normalizeProductImages(images);\n const product = {\n ...swellProduct,\n description,\n id,\n vendor: \"\",\n path: `/${slug}`,\n images: productImages,\n variants:\n productVariants && productVariants.length\n ? productVariants\n : emptyVariants,\n options: productOptions,\n price: {\n value,\n currencyCode,\n },\n };\n return product;\n}\n\nexport function normalizeCart({\n id,\n account_id,\n date_created,\n currency,\n tax_included_total,\n items,\n sub_total,\n grand_total,\n discounts,\n}: SwellCart) {\n const cart: Cart = {\n id: id,\n customerId: account_id + \"\",\n email: \"\",\n createdAt: date_created,\n currency: { code: currency },\n taxesIncluded: tax_included_total > 0,\n lineItems: items?.map(normalizeLineItem) ?? [],\n lineItemsSubtotalPrice: +sub_total,\n subtotalPrice: +sub_total,\n totalPrice: grand_total,\n discounts: discounts?.map((discount) => ({ value: discount.amount })),\n };\n return cart;\n}\n/*\nexport function normalizeCustomer(customer: SwellCustomer): Customer {\n const { first_name: firstName, last_name: lastName } = customer\n return {\n ...customer,\n firstName,\n lastName,\n }\n}\n*/\nfunction normalizeLineItem({\n id,\n product,\n price,\n variant,\n quantity,\n}: CartLineItem): LineItem {\n const item = {\n id,\n variantId: variant?.id,\n productId: product.id ?? \"\",\n name: product?.name ?? \"\",\n quantity,\n variant: {\n id: variant?.id ?? \"\",\n sku: variant?.sku ?? \"\",\n name: variant?.name!,\n image: {\n url:\n product?.images && product.images.length > 0\n ? product?.images[0].file.url\n : \"/\",\n },\n requiresShipping: false,\n price: price,\n listPrice: price,\n },\n path: \"\",\n discounts: [],\n options: [\n {\n value: variant?.name,\n },\n ],\n };\n return item;\n}\n\nexport function normalizeChildren(children: SwellCategoryChildren) {\n return children?.results.map((ch) => ch.id);\n}\n\nexport function normalizeCategory({\n id,\n name,\n slug,\n products,\n images,\n depth,\n children,\n parent_id,\n}: any): Category {\n return {\n id,\n name,\n slug,\n path: `/${slug}`,\n isEmpty: products?.length === 0,\n images: images?.map((image: any) => ({\n url: image.file.url,\n })),\n depth,\n children: normalizeChildren(children),\n parentId: parent_id,\n };\n}\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport { CommerceError } from '@plasmicpkgs/commerce'\n\ntype SwellFetchResponse = {\n error: {\n message: string\n code?: string\n }\n}\n\nconst handleFetchResponse = async (res: SwellFetchResponse) => {\n if (res) {\n if (res.error) {\n throw new CommerceError(res.error)\n }\n return res\n }\n return null;\n}\n\nexport default handleFetchResponse\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport Cookies from 'js-cookie'\nimport { SWELL_CHECKOUT_ID_COOKIE } from '../const'\n\nconst getCheckoutId = (id?: string) => {\n return id ?? Cookies.get(SWELL_CHECKOUT_ID_COOKIE)\n}\n\nexport default getCheckoutId\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport { CommerceError } from '@plasmicpkgs/commerce'\nimport { CartType } from '@plasmicpkgs/commerce'\n\nimport {\n CheckoutLineItemsAddPayload,\n CheckoutLineItemsRemovePayload,\n CheckoutLineItemsUpdatePayload,\n Maybe,\n} from '../../schema'\nimport { normalizeCart } from '../../utils'\nexport type CheckoutPayload =\n | CheckoutLineItemsAddPayload\n | CheckoutLineItemsUpdatePayload\n | CheckoutLineItemsRemovePayload\n\nconst checkoutToCart = (checkoutPayload?: Maybe<CheckoutPayload>): CartType.Cart => {\n if (!checkoutPayload) {\n throw new CommerceError({\n message: 'Invalid response from Swell',\n })\n }\n return normalizeCart(checkoutPayload as any)\n}\n\nexport default checkoutToCart\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes:\n - Added sameSite and secure to the cookie options to allow third-party cookies.\n\t We need this to make work on the studio\n*/\nimport { SWELL_CHECKOUT_URL_COOKIE, SWELL_COOKIE_EXPIRE } from '../../const'\n\nimport Cookies from 'js-cookie'\n\nexport const checkoutCreate = async (fetch: any) => {\n const cart = await fetch({\n query: 'cart',\n method: 'get',\n })\n\n if (!cart) {\n await fetch({\n query: 'cart',\n method: 'setItems',\n variables: [[]],\n })\n }\n\n const checkoutUrl = cart?.checkout_url\n const options: Cookies.CookieAttributes = {\n expires: SWELL_COOKIE_EXPIRE,\n sameSite: \"none\",\n secure: true\n }\n if (checkoutUrl) {\n Cookies.set(SWELL_CHECKOUT_URL_COOKIE, checkoutUrl, options)\n }\n\n return cart\n}\n\nexport default checkoutCreate\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport { useCart, UseCart } from '@plasmicpkgs/commerce'\nimport { SWRHook } from '@plasmicpkgs/commerce'\nimport { useMemo } from 'react'\nimport { normalizeCart } from '../utils/normalize'\nimport { checkoutCreate, checkoutToCart } from './utils'\nimport type { CartType } from '@plasmicpkgs/commerce'\n\nexport default useCart as UseCart<typeof handler>\n\ntype GetCartHook = CartType.GetCartHook;\n\nexport const handler: SWRHook<GetCartHook> = {\n fetchOptions: {\n query: 'cart',\n method: 'get',\n },\n async fetcher({ fetch }) {\n const cart = await checkoutCreate(fetch)\n\n return cart ? normalizeCart(cart) : null\n },\n useHook:\n ({ useData }) =>\n (input) => {\n const response = useData({\n swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },\n })\n return useMemo(\n () =>\n Object.create(response, {\n isEmpty: {\n get() {\n return (response.data?.lineItems.length ?? 0) <= 0\n },\n enumerable: true,\n },\n }),\n [response]\n )\n },\n}\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport type { MutationHook } from '@plasmicpkgs/commerce'\nimport { CommerceError } from '@plasmicpkgs/commerce'\nimport { useAddItem, UseAddItem } from '@plasmicpkgs/commerce'\nimport useCart from './use-cart'\nimport { checkoutToCart } from './utils'\nimport { getCheckoutId } from '../utils'\nimport { useCallback } from 'react'\nimport { AddItemHook } from '../types/cart'\n\nexport default useAddItem as UseAddItem<typeof handler>\n\nexport const handler: MutationHook<AddItemHook> = {\n fetchOptions: {\n query: 'cart',\n method: 'addItem',\n },\n async fetcher({ input: item, options, fetch }) {\n if (\n item.quantity &&\n (!Number.isInteger(item.quantity) || item.quantity! < 1)\n ) {\n throw new CommerceError({\n message: 'The item quantity has to be a valid integer greater than 0',\n })\n }\n const variables: {\n product_id: string | undefined\n variant_id?: string\n checkoutId?: string\n quantity?: number\n } = {\n checkoutId: getCheckoutId(),\n product_id: item.productId,\n quantity: item.quantity,\n }\n if (item.productId !== item.variantId) {\n variables.variant_id = item.variantId\n }\n\n const response = await fetch({\n ...options,\n variables,\n })\n\n return checkoutToCart(response) as any\n },\n useHook:\n ({ fetch }) =>\n () => {\n const { mutate } = useCart()\n\n return useCallback(\n async function addItem(input) {\n const data = await fetch({ input })\n await mutate(data, false)\n return data\n },\n [fetch, mutate]\n )\n },\n}\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport type {\n HookFetcherContext,\n MutationHookContext,\n} from \"@plasmicpkgs/commerce\";\nimport { useCallback } from \"react\";\n\nimport { CartType, useRemoveItem, UseRemoveItem } from \"@plasmicpkgs/commerce\";\nimport useCart from \"./use-cart\";\nimport { checkoutToCart } from \"./utils\";\n\ntype Cart = CartType.Cart;\ntype LineItem = CartType.LineItem;\ntype RemoveItemHook = CartType.RemoveItemHook;\n\nexport type RemoveItemFn<T = any> = T extends LineItem\n ? (input?: RemoveItemActionInput<T>) => Promise<Cart | null | undefined>\n : (input: RemoveItemActionInput<T>) => Promise<Cart | null>;\n\nexport type RemoveItemActionInput<T = any> = T extends LineItem\n ? Partial<RemoveItemHook[\"actionInput\"]>\n : RemoveItemHook[\"actionInput\"];\n\nexport default useRemoveItem as UseRemoveItem<typeof handler>;\n\nexport const handler = {\n fetchOptions: {\n query: \"cart\",\n method: \"removeItem\",\n },\n async fetcher({\n input: { itemId },\n options,\n fetch,\n }: HookFetcherContext<RemoveItemHook>) {\n const response = await fetch({ ...options, variables: [itemId] });\n\n return checkoutToCart(response);\n },\n useHook: ({ fetch }: MutationHookContext<RemoveItemHook>) => () => {\n const { mutate } = useCart();\n\n return useCallback(\n async function removeItem(input: { id: string }) {\n const data = await fetch({ input: { itemId: input.id } });\n await mutate(data, false);\n\n return data;\n },\n [fetch, mutate]\n );\n },\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport type {\n HookFetcherContext,\n MutationHookContext,\n} from \"@plasmicpkgs/commerce\";\nimport { ValidationError } from \"@plasmicpkgs/commerce\";\nimport debounce from \"debounce\";\nimport { useCallback } from \"react\";\n// import useUpdateItem, {\n// UpdateItemInput as UpdateItemInputBase,\n// UseUpdateItem,\n// } from '@vercel/commerce/cart/use-update-item'\nimport { CartType, useUpdateItem, UseUpdateItem } from \"@plasmicpkgs/commerce\";\nimport { UpdateItemHook } from \"../types/cart\";\nimport useCart from \"./use-cart\";\nimport { handler as removeItemHandler } from \"./use-remove-item\";\nimport { checkoutToCart } from \"./utils\";\n// export type UpdateItemInput<T = any> = T extends LineItem\n// ? Partial<UpdateItemInputBase<LineItem>>\n// : UpdateItemInputBase<LineItem>\n\nexport default useUpdateItem as UseUpdateItem<typeof handler>;\n\ntype CartItemBody = CartType.CartItemBody;\ntype LineItem = CartType.LineItem;\n\nexport type UpdateItemActionInput<T = any> = T extends LineItem\n ? Partial<UpdateItemHook[\"actionInput\"]>\n : UpdateItemHook[\"actionInput\"];\n\nexport const handler = {\n fetchOptions: {\n query: \"cart\",\n method: \"updateItem\",\n },\n async fetcher({\n input: { itemId, item },\n options,\n fetch,\n }: HookFetcherContext<UpdateItemHook>) {\n if (Number.isInteger(item.quantity)) {\n // Also allow the update hook to remove an item if the quantity is lower than 1\n if (item.quantity! < 1) {\n return removeItemHandler.fetcher({\n options: removeItemHandler.fetchOptions,\n input: { itemId },\n fetch,\n });\n }\n } else if (item.quantity) {\n throw new ValidationError({\n message: \"The item quantity has to be a valid integer\",\n });\n }\n const response = await fetch({\n ...options,\n variables: [itemId, { quantity: item.quantity }],\n });\n\n return checkoutToCart(response);\n },\n useHook:\n ({ fetch }: MutationHookContext<UpdateItemHook>) =>\n <T extends LineItem | undefined = undefined>(\n ctx: {\n item?: T;\n wait?: number;\n } = {}\n ) => {\n const { item } = ctx;\n const { mutate, data: cartData } = useCart() as any;\n\n return useCallback(\n debounce(async (input: UpdateItemActionInput) => {\n const itemId = input.id ?? item?.id;\n if (!itemId) {\n throw new ValidationError({\n message: \"Invalid input used for this operation\",\n });\n }\n\n const data = await fetch({\n input: {\n item: {\n quantity: input.quantity,\n },\n itemId,\n },\n });\n await mutate(data, false);\n return data;\n }, ctx.wait ?? 500),\n [fetch, mutate]\n );\n },\n};\n","export function ensure<T>(x: T | null | undefined, msg = \"\"): T {\n if (x === null || x === undefined) {\n debugger;\n throw new Error(\n `Value must not be undefined or null${msg ? `- ${msg}` : \"\"}`\n );\n } else {\n return x;\n }\n}\n\nexport const ensureNoNilFields = (\n o: Record<string, any>\n): Record<string, any> =>\n Object.fromEntries(Object.entries(o).filter(([k, v]) => v != null));\n","import { Category } from \"../types/site\";\nimport { ensure } from \"./common\";\n\nexport const walkCategoryTree = (\n category?: Category,\n categories?: Category[]\n) => {\n if (!category || !categories) {\n return [];\n }\n\n const queue: Category[] = [category];\n const result: Category[] = [];\n while (queue.length > 0) {\n const curr = ensure(queue.shift());\n result.push(curr);\n queue.push(\n ...(curr.children?.map((child) =>\n ensure(\n categories.find((category) => category.id === child),\n \"The child category must always exist in the categories list\"\n )\n ) ?? [])\n );\n }\n return result;\n};\n\nexport const topologicalSortForCategoryTree = (categories: Category[]) => {\n return categories\n .filter((category) => !category.parentId)\n .flatMap((category) => walkCategoryTree(category, categories));\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: Added count as a parameter to input\n*/\nimport type { SearchProductsHook } from \"@plasmicpkgs/commerce\";\nimport {\n HookSWRInput,\n SWRHook,\n useSearch,\n UseSearch,\n} from \"@plasmicpkgs/commerce\";\nimport { SwellProduct } from \"../types\";\nimport { Category } from \"../types/site\";\nimport { normalizeProduct } from \"../utils\";\nimport { walkCategoryTree } from \"../utils/category-tree\";\nimport { ensureNoNilFields } from \"../utils/common\";\n\nexport type SearchProductsInput = {\n search?: string;\n categoryId?: string;\n brandId?: string;\n sort?: string;\n count?: number;\n includeSubCategories?: boolean;\n categories?: Category[];\n};\n\nconst useSearchTyped: UseSearch<typeof handler> = useSearch;\nexport default useSearchTyped;\n\nexport const handler: SWRHook<SearchProductsHook> = {\n fetchOptions: {\n query: \"products\",\n method: \"list\",\n },\n async fetcher({ input, options, fetch }) {\n const sortMap = new Map([\n [\"latest-desc\", \"\"],\n [\"price-asc\", \"price asc\"],\n [\"price-desc\", \"price desc\"],\n [\"trending-desc\", \"popularity\"],\n ]);\n const {\n categoryId,\n includeSubCategories,\n categories,\n brandId,\n search,\n sort = \"latest-desc\",\n count,\n } = input;\n const mappedSort = sortMap.get(sort);\n\n const includedCategories = includeSubCategories\n ? walkCategoryTree(\n categories?.find((category) => category.id === categoryId),\n categories\n )\n : undefined;\n\n const { results: products } = await fetch({\n query: options.query,\n method: options.method,\n variables: ensureNoNilFields({\n category: !includeSubCategories ? categoryId : undefined,\n brand: brandId,\n search,\n sort: mappedSort,\n expand: [\"variants\"],\n limit: count,\n $filters: {\n ...(includeSubCategories\n ? { category: includedCategories?.map((c) => c.id) }\n : {}),\n },\n }),\n });\n\n return {\n products: products.map((product: SwellProduct) =>\n normalizeProduct(product)\n ),\n found: products.length > 0,\n };\n },\n useHook:\n ({ useData }) =>\n (input = {}) => {\n return useData({\n input: [\n [\"search\", input.search],\n [\"categoryId\", input.categoryId],\n [\"includeSubCategories\", input.includeSubCategories],\n [\"categories\", input.categories],\n [\"brandId\", input.brandId],\n [\"sort\", input.sort],\n [\"count\", input.count],\n ] as HookSWRInput,\n swrOptions: {\n revalidateOnFocus: false,\n ...input.swrOptions,\n },\n });\n },\n};\n","import { GetProductHook, SWRHook, UseProduct, useProduct } from '@plasmicpkgs/commerce'\nimport { normalizeProduct } from '../utils'\nimport { SwellProduct } from '../types'\n\nexport type GetProductInput = {\n id?: string;\n}\n\nexport default useProduct as UseProduct<typeof handler>\n\nexport const handler: SWRHook<GetProductHook> = {\n fetchOptions: {\n query: 'products',\n method: 'get',\n },\n async fetcher({ input, options, fetch }) {\n const { id } = input;\n const product = await fetch({\n query: options.query,\n method: options.method,\n variables: [id],\n });\n if (!product) {\n return null;\n }\n return normalizeProduct(product);\n },\n useHook:\n ({ useData }) =>\n (input = {}) => {\n return useData({\n input: [\n ['id', input.id],\n ],\n swrOptions: {\n revalidateOnFocus: false,\n ...input.swrOptions,\n },\n })\n },\n}\n","import {\n SiteTypes,\n SWRHook,\n useCategories,\n UseCategories,\n} from \"@plasmicpkgs/commerce\";\nimport { useMemo } from \"react\";\nimport { Category } from \"../types/site\";\nimport { normalizeCategory } from \"../utils\";\nimport { topologicalSortForCategoryTree } from \"../utils/category-tree\";\nimport { ensureNoNilFields } from \"../utils/common\";\n\nexport default useCategories as UseCategories<typeof handler>;\n\ntype GetCategoriesHook = SiteTypes.GetCategoriesHook;\n\nexport const handler: SWRHook<GetCategoriesHook> = {\n fetchOptions: {\n query: \"categories\",\n method: \"get\",\n },\n async fetcher({ input, options, fetch }) {\n const { addIsEmptyField, categoryId } = input;\n\n const data = await fetch({\n query: options.query,\n method: options.method,\n variables: ensureNoNilFields({\n expand: [\"children\", \"parent_id\"],\n id: categoryId,\n }),\n });\n\n let categories = data?.results ?? [];\n if (addIsEmptyField) {\n categories = await Promise.all(\n categories.map(async (category: any) => ({\n ...category,\n products: (\n await fetch({\n query: \"products\",\n method: \"list\",\n variables: ensureNoNilFields({\n limit: 1,\n category: category.id,\n }),\n })\n ).results,\n }))\n );\n }\n\n const normalizedCategories: Category[] = !categoryId\n ? topologicalSortForCategoryTree(categories.map(normalizeCategory))\n : categories.map(normalizeCategory);\n\n for (const category of normalizedCategories) {\n category.depth =\n (normalizedCategories.find((c) => c.id === category.parentId)?.depth ??\n -1) + 1;\n }\n return normalizedCategories;\n },\n useHook: ({ useData }) => (input) => {\n const response = useData({\n input: [\n [\"addIsEmptyField\", input?.addIsEmptyField],\n [\"categoryId\", input?.categoryId],\n ],\n swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },\n });\n return useMemo(\n () =>\n Object.create(response, {\n isEmpty: {\n get() {\n return (response.data?.length ?? 0) <= 0;\n },\n enumerable: true,\n },\n }),\n [response]\n );\n },\n};\n","import {\n SiteTypes,\n SWRHook,\n useBrands,\n UseBrands,\n} from \"@plasmicpkgs/commerce\";\nimport { useMemo } from \"react\";\n\nexport default useBrands as UseBrands<typeof handler>;\n\ntype GetBrandsHook = SiteTypes.GetBrandsHook;\n\nexport const handler: SWRHook<GetBrandsHook> = {\n fetchOptions: {\n query: \"attributes\",\n method: \"get\",\n },\n async fetcher({ fetch }) {\n const vendors: [string] =\n (\n await fetch({\n query: \"attributes\",\n method: \"get\",\n variables: \"brand\",\n })\n )?.values ?? [];\n return Array.from(new Set(vendors).values()).map((v) => ({\n entityId: v,\n name: v,\n path: `brands/${v}`,\n }));\n },\n useHook: ({ useData }) => (input) => {\n const response = useData({\n swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },\n });\n return useMemo(\n () =>\n Object.create(response, {\n isEmpty: {\n get() {\n return (response.data?.length ?? 0) <= 0;\n },\n enumerable: true,\n },\n }),\n [response]\n );\n },\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport { Fetcher } from '@plasmicpkgs/commerce'\nimport { CommerceError } from '@plasmicpkgs/commerce'\nimport { handleFetchResponse } from './utils'\nimport swell from './provider'\n\nconst fetcher: Fetcher = async ({ method = 'get', variables, query }) => {\n async function callSwell() {\n if (Array.isArray(variables)) {\n const arg1 = variables[0]\n const arg2 = variables[1]\n const response = await swell[query!][method](arg1, arg2)\n return handleFetchResponse(response)\n } else {\n const response = await swell[query!][method](variables)\n return handleFetchResponse(response)\n }\n }\n\n if (query && query in swell) {\n return await callSwell()\n } else {\n throw new CommerceError({ message: 'Invalid query argument!' })\n }\n}\n\nexport default fetcher\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: Added storeId and publicKey parameters\n*/\n// @ts-ignore\nimport swell, { init } from \"swell-js\";\n\nimport { CommerceExtraFeatures, Provider } from \"@plasmicpkgs/commerce\";\nimport { SWELL_CHECKOUT_ID_COOKIE } from \"./const\";\nimport { handler as useCart } from \"./cart/use-cart\";\nimport { handler as useAddItem } from \"./cart/use-add-item\";\nimport { handler as useUpdateItem } from \"./cart/use-update-item\";\nimport { handler as useRemoveItem } from \"./cart/use-remove-item\";\nimport { handler as useSearch } from \"./product/use-search\";\nimport { handler as useProduct } from \"./product/use-product\";\nimport { handler as useCategories } from \"./site/use-categories\";\nimport { handler as useBrands } from \"./site/use-brands\";\nimport fetcher from \"./fetcher\";\nimport { Fetcher } from \"@plasmicpkgs/commerce\";\n\nexport const getSwellProvider = (storeId: string, publicKey: string) => {\n init(storeId, publicKey);\n\n return {\n locale: \"en-us\",\n cartCookie: SWELL_CHECKOUT_ID_COOKIE,\n swell,\n fetcher,\n cart: { useCart, useAddItem, useUpdateItem, useRemoveItem },\n products: { useSearch, useProduct },\n site: { useCategories, useBrands },\n extraFeatures: {\n includeSubCategories: true,\n },\n };\n};\n\nexport type SwellProvider = {\n locale: string;\n cartCookie: string;\n fetcher: Fetcher;\n cart: {\n useCart: typeof useCart;\n useAddItem: typeof useAddItem;\n useUpdateItem: typeof useUpdateItem;\n useRemoveItem: typeof useRemoveItem;\n };\n products: {\n useSearch: typeof useSearch;\n };\n site: {\n useCategories: typeof useCategories;\n useBrands: typeof useBrands;\n };\n extraFeatures: CommerceExtraFeatures;\n swell: any;\n};\n\nexport default swell as any;\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport {\n CommerceAPIConfig,\n getCommerceProvider as getCoreCommerceProvider,\n useCommerce as useCoreCommerce,\n} from '@plasmicpkgs/commerce'\nimport { SWELL_CHECKOUT_ID_COOKIE, SWELL_COOKIE_EXPIRE, SWELL_CUSTOMER_TOKEN_COOKIE } from './const'\nimport { getSwellProvider, SwellProvider } from './provider'\nimport fetchApi from './utils/fetch-swell-api'\n\nexport type { SwellProvider }\n\nexport const getCommerceProvider = (storeId: string, publicKey: string) => \n getCoreCommerceProvider(getSwellProvider(storeId, publicKey))\n\nexport const useCommerce = () => useCoreCommerce<SwellProvider>()\n\n\nexport interface SwellConfig extends CommerceAPIConfig {\n fetch: any\n}\n\nconst config: SwellConfig = {\n locale: 'en-US',\n commerceUrl: '',\n apiToken: ''!,\n cartCookie: SWELL_CHECKOUT_ID_COOKIE,\n cartCookieMaxAge: SWELL_COOKIE_EXPIRE,\n fetch: fetchApi,\n customerCookie: SWELL_CUSTOMER_TOKEN_COOKIE,\n}\n","import { GlobalContextMeta } from \"@plasmicapp/host\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport {\n CartActionsProvider,\n globalActionsRegistrations,\n} from \"@plasmicpkgs/commerce\";\nimport React from \"react\";\nimport { Registerable } from \"./registerable\";\nimport { getCommerceProvider } from \"./swell\";\n\ninterface CommerceProviderProps {\n children?: React.ReactNode;\n storeId: string;\n publicKey: string;\n}\n\nconst globalContextName = \"plasmic-commerce-swell-provider\";\n\nexport const commerceProviderMeta: GlobalContextMeta<CommerceProviderProps> = {\n name: \"plasmic-commerce-swell-provider\",\n displayName: \"Swell Provider\",\n props: {\n storeId: {\n type: \"string\",\n defaultValue: \"plasmic-sandbox\",\n },\n publicKey: {\n type: \"string\",\n defaultValue: \"pk_QaZeGhtpQaVbNQnWJdRlE1abE6Ezf9U9\",\n },\n },\n ...{ globalActions: globalActionsRegistrations },\n description: `Get your store ID and public storefront API key from the Swell admin UI under Developer > API Keys.\n\n[Watch how to use this integration](https://www.youtube.com/watch?v=b2mgOTbP2_8).`,\n importPath: \"@plasmicpkgs/commerce-swell\",\n importName: \"CommerceProviderComponent\",\n};\n\nexport function CommerceProviderComponent(props: CommerceProviderProps) {\n const { storeId, publicKey, children } = props;\n\n const CommerceProvider = React.useMemo(\n () => getCommerceProvider(storeId, publicKey),\n [storeId, publicKey]\n );\n\n return (\n <CommerceProvider>\n <CartActionsProvider globalContextName={globalContextName}>\n {children}\n </CartActionsProvider>\n </CommerceProvider>\n );\n}\n\nexport function registerCommerceProvider(\n loader?: Registerable,\n customCommerceProviderMeta?: GlobalContextMeta<CommerceProviderProps>\n) {\n const doRegisterComponent: typeof registerGlobalContext = (...args) =>\n loader\n ? loader.registerGlobalContext(...args)\n : registerGlobalContext(...args);\n doRegisterComponent(\n CommerceProviderComponent,\n customCommerceProviderMeta ?? commerceProviderMeta\n );\n}\n","import { Registerable } from \"./registerable\";\nimport { registerCommerceProvider } from \"./registerCommerceProvider\";\nexport * from \"./registerable\";\nexport * from \"./registerCommerceProvider\";\nexport * from \"./swell\";\nexport { registerCommerceProvider };\n\nexport function registerAll(loader?: Registerable) {\n registerCommerceProvider(loader);\n}\n"],"names":["SWELL_CHECKOUT_ID_COOKIE","SWELL_CHECKOUT_URL_COOKIE","SWELL_COOKIE_EXPIRE","normalizeProductOption","_ref2","id","_ref2$name","name","displayName","_ref2$values","values","returnValues","map","value","output","label","match","_extends","hexColors","__typename","normalizeProductImages","images","length","url","_ref3","file","rest","_objectWithoutPropertiesLoose","_excluded","height","Number","width","normalizeProductVariants","variants","productOptions","_ref4","price","_ref4$option_value_id","option_value_ids","optionValueIds","split","i","trim","options","matchingOption","find","option","_matchingOption$name","undefined","normalizeProduct","swellProduct","description","slug","currencyCode","currency","emptyVariants","o","productVariants","results","productImages","product","vendor","path","normalizeCart","_ref5","account_id","date_created","tax_included_total","items","sub_total","grand_total","discounts","cart","customerId","email","createdAt","code","taxesIncluded","lineItems","_items$map","normalizeLineItem","lineItemsSubtotalPrice","subtotalPrice","totalPrice","discount","amount","_ref6","variant","quantity","item","variantId","productId","_product$id","_product$name","_variant$id","sku","_variant$sku","image","requiresShipping","listPrice","normalizeChildren","children","ch","normalizeCategory","_ref7","products","depth","parent_id","isEmpty","parentId","handleFetchResponse","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","res","wrap","_callee$","_context","prev","next","error","CommerceError","abrupt","stop","_x","apply","arguments","getCheckoutId","Cookies","get","checkoutToCart","checkoutPayload","message","checkoutCreate","fetch","checkoutUrl","query","method","sent","variables","checkout_url","expires","sameSite","secure","set","handler","fetchOptions","fetcher","useHook","useData","input","response","swrOptions","revalidateOnFocus","useMemo","Object","create","_response$data$lineIt","_response$data","data","enumerable","isInteger","checkoutId","product_id","variant_id","_useCart","useCart","mutate","useCallback","_addItem","_callee2","_callee2$","_context2","addItem","itemId","_removeItem","removeItem","_ref$input","removeItemHandler","ValidationError","ctx","_ctx","debounce","_input$id","_ctx$wait","wait","ensure","x","msg","Error","ensureNoNilFields","fromEntries","entries","filter","v","walkCategoryTree","category","categories","queue","result","_curr$children$map","_curr$children","curr","shift","push","child","topologicalSortForCategoryTree","flatMap","sortMap","Map","categoryId","includeSubCategories","brandId","search","_input$sort","sort","count","mappedSort","includedCategories","brand","expand","limit","$filters","c","_yield$fetch","found","addIsEmptyField","_context3","_data$results","Promise","all","t0","t1","t2","t3","t4","normalizedCategories","_loop","_normalizedCategories","_normalizedCategories2","_loop$","_step","_iterator","_createForOfIteratorHelperLoose","done","delegateYield","_response$data$length","_yield$fetch$values","vendors","Array","from","Set","entityId","_ref$method","callSwell","_callSwell","_callSwell3","arg1","arg2","_response","isArray","swell","_callSwell2","getSwellProvider","storeId","publicKey","init","locale","cartCookie","useAddItem","useUpdateItem","useRemoveItem","useSearch","useProduct","site","useCategories","useBrands","extraFeatures","getCommerceProvider","getCoreCommerceProvider","useCommerce","useCoreCommerce","globalContextName","commerceProviderMeta","props","type","defaultValue","globalActions","globalActionsRegistrations","importPath","importName","CommerceProviderComponent","CommerceProvider","React","CartActionsProvider","registerCommerceProvider","loader","customCommerceProviderMeta","doRegisterComponent","registerGlobalContext","registerAll"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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A,mBAAmBA;IAAA,OACvBF,MAAM,GACFA,MAAM,CAACG,qBAAqB,CAAA9K,KAAA,CAA5B2K,MAAM,EAAA1K,SAA8B,CAAC,GACrC6K,qBAAqB,CAAA9K,KAAA,SAAAC,SAAQ,CAAC;;EACpC4K,mBAAmB,CACjBP,yBAAyB,EACzBM,0BAA0B,WAA1BA,0BAA0B,GAAId,oBAAoB,CACnD;AACH;;SC7DgBiB,WAAWA,CAACJ,MAAqB;EAC/CD,wBAAwB,CAACC,MAAM,CAAC;AAClC;;;;"}
|
|
1
|
+
{"version":3,"file":"commerce-swell.esm.js","sources":["../src/const.ts","../src/utils/normalize.ts","../src/utils/handle-fetch-response.ts","../src/utils/get-checkout-id.ts","../src/cart/utils/checkout-to-cart.ts","../src/cart/utils/checkout-create.ts","../src/cart/use-cart.tsx","../src/cart/use-add-item.tsx","../src/cart/use-remove-item.tsx","../src/cart/use-update-item.tsx","../src/utils/common.ts","../src/utils/category-tree.ts","../src/product/use-search.tsx","../src/product/use-product.tsx","../src/site/use-categories.ts","../src/site/use-brands.ts","../src/fetcher.ts","../src/provider.ts","../src/swell.ts","../src/registerCommerceProvider.tsx","../src/index.tsx"],"sourcesContent":["/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: Removed store id and public key\n*/\nexport const SWELL_CHECKOUT_ID_COOKIE = 'SWELL_checkoutId'\n\nexport const SWELL_CHECKOUT_URL_COOKIE = 'swell_checkoutUrl'\n\nexport const SWELL_CUSTOMER_TOKEN_COOKIE = 'swell_customerToken'\n\nexport const SWELL_COOKIE_EXPIRE = 30\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: Added \"Default Variant\" to default title when there's no product variant\n*/\nimport { MoneyV2 } from \"../schema\";\nimport type {\n Cart,\n CartLineItem,\n LineItem,\n ProductOptionValue,\n SwellCart,\n SwellImage,\n SwellProduct,\n SwellProductOptionValue,\n SwellVariant,\n} from \"../types\";\nimport { Product, ProductOption } from \"../types/product\";\nimport { Category, SwellCategoryChildren } from \"../types/site\";\n\nconst money = ({ amount, currencyCode }: MoneyV2) => {\n return {\n value: +amount,\n currencyCode,\n };\n};\n\ntype swellProductOption = {\n id: string;\n name: string;\n values: any[];\n};\n\ntype normalizedProductOption = {\n id: string;\n displayName: string;\n values: ProductOptionValue[];\n};\n\nconst normalizeProductOption = ({\n id,\n name: displayName = \"\",\n values = [],\n}: swellProductOption): ProductOption => {\n let returnValues = values.map((value) => {\n let output: any = {\n label: value.name,\n // id: value?.id || id,\n };\n if (displayName.match(/colou?r/gi)) {\n output = {\n ...output,\n hexColors: [value.name],\n };\n }\n return output;\n });\n return {\n __typename: \"MultipleChoiceOption\",\n id,\n displayName,\n values: returnValues,\n };\n};\n\nconst normalizeProductImages = (images: SwellImage[]) => {\n if (!images || images.length < 1) {\n return [{ url: \"/\" }];\n }\n return images?.map(({ file, ...rest }: SwellImage) => ({\n url: file?.url + \"\",\n height: Number(file?.height),\n width: Number(file?.width),\n ...rest,\n }));\n};\n\nconst normalizeProductVariants = (\n variants: SwellVariant[],\n productOptions: swellProductOption[]\n) => {\n return variants?.map(\n ({ id, name, price, option_value_ids: optionValueIds = [] }) => {\n const values = name\n .split(\",\")\n .map((i) => ({ name: i.trim(), label: i.trim() }));\n\n const options = optionValueIds.map((id) => {\n const matchingOption = productOptions.find((option) => {\n return option.values.find(\n (value: SwellProductOptionValue) => value.id == id\n );\n });\n return normalizeProductOption({\n id,\n name: matchingOption?.name ?? \"\",\n values,\n });\n });\n\n return {\n id,\n name,\n // sku: sku ?? id,\n price: price ?? undefined,\n // listPrice: price ?? null,\n // requiresShipping: true,\n options,\n };\n }\n );\n};\n\nexport function normalizeProduct(swellProduct: SwellProduct): Product {\n const {\n id,\n name,\n description,\n images,\n options,\n slug,\n variants,\n price: value,\n currency: currencyCode,\n } = swellProduct;\n // ProductView accesses variants for each product\n const emptyVariants = [{ options: [], id, name: \"Default variant\" }];\n\n const productOptions = options\n ? options.map((o) => normalizeProductOption(o))\n : [];\n const productVariants = variants\n ? normalizeProductVariants(variants.results, options)\n : [];\n\n const productImages = normalizeProductImages(images);\n const product = {\n ...swellProduct,\n description,\n id,\n vendor: \"\",\n path: `/${slug}`,\n images: productImages,\n variants:\n productVariants && productVariants.length\n ? productVariants\n : emptyVariants,\n options: productOptions,\n price: {\n value,\n currencyCode,\n },\n };\n return product;\n}\n\nexport function normalizeCart({\n id,\n account_id,\n date_created,\n currency,\n tax_included_total,\n items,\n sub_total,\n grand_total,\n discounts,\n}: SwellCart) {\n const cart: Cart = {\n id: id,\n customerId: account_id + \"\",\n email: \"\",\n createdAt: date_created,\n currency: { code: currency },\n taxesIncluded: tax_included_total > 0,\n lineItems: items?.map(normalizeLineItem) ?? [],\n lineItemsSubtotalPrice: +sub_total,\n subtotalPrice: +sub_total,\n totalPrice: grand_total,\n discounts: discounts?.map((discount) => ({ value: discount.amount })),\n };\n return cart;\n}\n/*\nexport function normalizeCustomer(customer: SwellCustomer): Customer {\n const { first_name: firstName, last_name: lastName } = customer\n return {\n ...customer,\n firstName,\n lastName,\n }\n}\n*/\nfunction normalizeLineItem({\n id,\n product,\n price,\n variant,\n quantity,\n}: CartLineItem): LineItem {\n const item = {\n id,\n variantId: variant?.id,\n productId: product.id ?? \"\",\n name: product?.name ?? \"\",\n quantity,\n variant: {\n id: variant?.id ?? \"\",\n sku: variant?.sku ?? \"\",\n name: variant?.name!,\n image: {\n url:\n product?.images && product.images.length > 0\n ? product?.images[0].file.url\n : \"/\",\n },\n requiresShipping: false,\n price: price,\n listPrice: price,\n },\n path: \"\",\n discounts: [],\n options: [\n {\n value: variant?.name,\n },\n ],\n };\n return item;\n}\n\nexport function normalizeChildren(children: SwellCategoryChildren) {\n return children?.results.map((ch) => ch.id);\n}\n\nexport function normalizeCategory({\n id,\n name,\n slug,\n products,\n images,\n depth,\n children,\n parent_id,\n}: any): Category {\n return {\n id,\n name,\n slug,\n path: `/${slug}`,\n isEmpty: products?.length === 0,\n images: images?.map((image: any) => ({\n url: image.file.url,\n })),\n depth,\n children: normalizeChildren(children),\n parentId: parent_id,\n };\n}\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport { CommerceError } from '@plasmicpkgs/commerce'\n\ntype SwellFetchResponse = {\n error: {\n message: string\n code?: string\n }\n}\n\nconst handleFetchResponse = async (res: SwellFetchResponse) => {\n if (res) {\n if (res.error) {\n throw new CommerceError(res.error)\n }\n return res\n }\n return null;\n}\n\nexport default handleFetchResponse\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport Cookies from 'js-cookie'\nimport { SWELL_CHECKOUT_ID_COOKIE } from '../const'\n\nconst getCheckoutId = (id?: string) => {\n return id ?? Cookies.get(SWELL_CHECKOUT_ID_COOKIE)\n}\n\nexport default getCheckoutId\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport { CommerceError } from '@plasmicpkgs/commerce'\nimport { CartType } from '@plasmicpkgs/commerce'\n\nimport {\n CheckoutLineItemsAddPayload,\n CheckoutLineItemsRemovePayload,\n CheckoutLineItemsUpdatePayload,\n Maybe,\n} from '../../schema'\nimport { normalizeCart } from '../../utils'\nexport type CheckoutPayload =\n | CheckoutLineItemsAddPayload\n | CheckoutLineItemsUpdatePayload\n | CheckoutLineItemsRemovePayload\n\nconst checkoutToCart = (checkoutPayload?: Maybe<CheckoutPayload>): CartType.Cart => {\n if (!checkoutPayload) {\n throw new CommerceError({\n message: 'Invalid response from Swell',\n })\n }\n return normalizeCart(checkoutPayload as any)\n}\n\nexport default checkoutToCart\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes:\n - Added sameSite and secure to the cookie options to allow third-party cookies.\n\t We need this to make work on the studio\n*/\nimport { SWELL_CHECKOUT_URL_COOKIE, SWELL_COOKIE_EXPIRE } from '../../const'\n\nimport Cookies from 'js-cookie'\n\nexport const checkoutCreate = async (fetch: any) => {\n const cart = await fetch({\n query: 'cart',\n method: 'get',\n })\n\n if (!cart) {\n await fetch({\n query: 'cart',\n method: 'setItems',\n variables: [[]],\n })\n }\n\n const checkoutUrl = cart?.checkout_url\n const options: Cookies.CookieAttributes = {\n expires: SWELL_COOKIE_EXPIRE,\n sameSite: \"none\",\n secure: true\n }\n if (checkoutUrl) {\n Cookies.set(SWELL_CHECKOUT_URL_COOKIE, checkoutUrl, options)\n }\n\n return cart\n}\n\nexport default checkoutCreate\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport { useCart, UseCart } from '@plasmicpkgs/commerce'\nimport { SWRHook } from '@plasmicpkgs/commerce'\nimport { useMemo } from 'react'\nimport { normalizeCart } from '../utils/normalize'\nimport { checkoutCreate, checkoutToCart } from './utils'\nimport type { CartType } from '@plasmicpkgs/commerce'\n\nexport default useCart as UseCart<typeof handler>\n\ntype GetCartHook = CartType.GetCartHook;\n\nexport const handler: SWRHook<GetCartHook> = {\n fetchOptions: {\n query: 'cart',\n method: 'get',\n },\n async fetcher({ fetch }) {\n const cart = await checkoutCreate(fetch)\n\n return cart ? normalizeCart(cart) : null\n },\n useHook:\n ({ useData }) =>\n (input) => {\n const response = useData({\n swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },\n })\n return useMemo(\n () =>\n Object.create(response, {\n isEmpty: {\n get() {\n return (response.data?.lineItems.length ?? 0) <= 0\n },\n enumerable: true,\n },\n }),\n [response]\n )\n },\n}\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport type { MutationHook } from '@plasmicpkgs/commerce'\nimport { CommerceError } from '@plasmicpkgs/commerce'\nimport { useAddItem, UseAddItem } from '@plasmicpkgs/commerce'\nimport useCart from './use-cart'\nimport { checkoutToCart } from './utils'\nimport { getCheckoutId } from '../utils'\nimport { useCallback } from 'react'\nimport { AddItemHook } from '../types/cart'\n\nexport default useAddItem as UseAddItem<typeof handler>\n\nexport const handler: MutationHook<AddItemHook> = {\n fetchOptions: {\n query: 'cart',\n method: 'addItem',\n },\n async fetcher({ input: item, options, fetch }) {\n if (\n item.quantity &&\n (!Number.isInteger(item.quantity) || item.quantity! < 1)\n ) {\n throw new CommerceError({\n message: 'The item quantity has to be a valid integer greater than 0',\n })\n }\n const variables: {\n product_id: string | undefined\n variant_id?: string\n checkoutId?: string\n quantity?: number\n } = {\n checkoutId: getCheckoutId(),\n product_id: item.productId,\n quantity: item.quantity,\n }\n if (item.productId !== item.variantId) {\n variables.variant_id = item.variantId\n }\n\n const response = await fetch({\n ...options,\n variables,\n })\n\n return checkoutToCart(response) as any\n },\n useHook:\n ({ fetch }) =>\n () => {\n const { mutate } = useCart()\n\n return useCallback(\n async function addItem(input) {\n const data = await fetch({ input })\n await mutate(data, false)\n return data\n },\n [fetch, mutate]\n )\n },\n}\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport type {\n HookFetcherContext,\n MutationHookContext,\n} from \"@plasmicpkgs/commerce\";\nimport { useCallback } from \"react\";\n\nimport { CartType, useRemoveItem, UseRemoveItem } from \"@plasmicpkgs/commerce\";\nimport useCart from \"./use-cart\";\nimport { checkoutToCart } from \"./utils\";\n\ntype Cart = CartType.Cart;\ntype LineItem = CartType.LineItem;\ntype RemoveItemHook = CartType.RemoveItemHook;\n\nexport type RemoveItemFn<T = any> = T extends LineItem\n ? (input?: RemoveItemActionInput<T>) => Promise<Cart | null | undefined>\n : (input: RemoveItemActionInput<T>) => Promise<Cart | null>;\n\nexport type RemoveItemActionInput<T = any> = T extends LineItem\n ? Partial<RemoveItemHook[\"actionInput\"]>\n : RemoveItemHook[\"actionInput\"];\n\nexport default useRemoveItem as UseRemoveItem<typeof handler>;\n\nexport const handler = {\n fetchOptions: {\n query: \"cart\",\n method: \"removeItem\",\n },\n async fetcher({\n input: { itemId },\n options,\n fetch,\n }: HookFetcherContext<RemoveItemHook>) {\n const response = await fetch({ ...options, variables: [itemId] });\n\n return checkoutToCart(response);\n },\n useHook: ({ fetch }: MutationHookContext<RemoveItemHook>) => () => {\n const { mutate } = useCart();\n\n return useCallback(\n async function removeItem(input: { id: string }) {\n const data = await fetch({ input: { itemId: input.id } });\n await mutate(data, false);\n\n return data;\n },\n [fetch, mutate]\n );\n },\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport type {\n HookFetcherContext,\n MutationHookContext,\n} from \"@plasmicpkgs/commerce\";\nimport { ValidationError } from \"@plasmicpkgs/commerce\";\nimport debounce from \"debounce\";\nimport { useCallback } from \"react\";\n// import useUpdateItem, {\n// UpdateItemInput as UpdateItemInputBase,\n// UseUpdateItem,\n// } from '@vercel/commerce/cart/use-update-item'\nimport { CartType, useUpdateItem, UseUpdateItem } from \"@plasmicpkgs/commerce\";\nimport { UpdateItemHook } from \"../types/cart\";\nimport useCart from \"./use-cart\";\nimport { handler as removeItemHandler } from \"./use-remove-item\";\nimport { checkoutToCart } from \"./utils\";\n// export type UpdateItemInput<T = any> = T extends LineItem\n// ? Partial<UpdateItemInputBase<LineItem>>\n// : UpdateItemInputBase<LineItem>\n\nexport default useUpdateItem as UseUpdateItem<typeof handler>;\n\ntype CartItemBody = CartType.CartItemBody;\ntype LineItem = CartType.LineItem;\n\nexport type UpdateItemActionInput<T = any> = T extends LineItem\n ? Partial<UpdateItemHook[\"actionInput\"]>\n : UpdateItemHook[\"actionInput\"];\n\nexport const handler = {\n fetchOptions: {\n query: \"cart\",\n method: \"updateItem\",\n },\n async fetcher({\n input: { itemId, item },\n options,\n fetch,\n }: HookFetcherContext<UpdateItemHook>) {\n if (Number.isInteger(item.quantity)) {\n // Also allow the update hook to remove an item if the quantity is lower than 1\n if (item.quantity! < 1) {\n return removeItemHandler.fetcher({\n options: removeItemHandler.fetchOptions,\n input: { itemId },\n fetch,\n });\n }\n } else if (item.quantity) {\n throw new ValidationError({\n message: \"The item quantity has to be a valid integer\",\n });\n }\n const response = await fetch({\n ...options,\n variables: [itemId, { quantity: item.quantity }],\n });\n\n return checkoutToCart(response);\n },\n useHook:\n ({ fetch }: MutationHookContext<UpdateItemHook>) =>\n <T extends LineItem | undefined = undefined>(\n ctx: {\n item?: T;\n wait?: number;\n } = {}\n ) => {\n const { item } = ctx;\n const { mutate, data: cartData } = useCart() as any;\n\n return useCallback(\n debounce(async (input: UpdateItemActionInput) => {\n const itemId = input.id ?? item?.id;\n if (!itemId) {\n throw new ValidationError({\n message: \"Invalid input used for this operation\",\n });\n }\n\n const data = await fetch({\n input: {\n item: {\n quantity: input.quantity,\n },\n itemId,\n },\n });\n await mutate(data, false);\n return data;\n }, ctx.wait ?? 500),\n [fetch, mutate]\n );\n },\n};\n","export function ensure<T>(x: T | null | undefined, msg = \"\"): T {\n if (x === null || x === undefined) {\n debugger;\n throw new Error(\n `Value must not be undefined or null${msg ? `- ${msg}` : \"\"}`\n );\n } else {\n return x;\n }\n}\n\nexport const ensureNoNilFields = (\n o: Record<string, any>\n): Record<string, any> =>\n Object.fromEntries(Object.entries(o).filter(([k, v]) => v != null));\n","import { Category } from \"../types/site\";\nimport { ensure } from \"./common\";\n\nexport const walkCategoryTree = (\n category?: Category,\n categories?: Category[]\n) => {\n if (!category || !categories) {\n return [];\n }\n\n const queue: Category[] = [category];\n const result: Category[] = [];\n while (queue.length > 0) {\n const curr = ensure(queue.shift());\n result.push(curr);\n queue.push(\n ...(curr.children?.map((child) =>\n ensure(\n categories.find((category) => category.id === child),\n \"The child category must always exist in the categories list\"\n )\n ) ?? [])\n );\n }\n return result;\n};\n\nexport const topologicalSortForCategoryTree = (categories: Category[]) => {\n return categories\n .filter((category) => !category.parentId)\n .flatMap((category) => walkCategoryTree(category, categories));\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: Added count as a parameter to input\n*/\nimport type { SearchProductsHook } from \"@plasmicpkgs/commerce\";\nimport {\n HookSWRInput,\n SWRHook,\n useSearch,\n UseSearch,\n} from \"@plasmicpkgs/commerce\";\nimport { SwellProduct } from \"../types\";\nimport { Category } from \"../types/site\";\nimport { normalizeProduct } from \"../utils\";\nimport { walkCategoryTree } from \"../utils/category-tree\";\nimport { ensureNoNilFields } from \"../utils/common\";\n\nexport type SearchProductsInput = {\n search?: string;\n categoryId?: string;\n brandId?: string;\n sort?: string;\n count?: number;\n includeSubCategories?: boolean;\n categories?: Category[];\n};\n\nconst useSearchTyped: UseSearch<typeof handler> = useSearch;\nexport default useSearchTyped;\n\nexport const handler: SWRHook<SearchProductsHook> = {\n fetchOptions: {\n query: \"products\",\n method: \"list\",\n },\n async fetcher({ input, options, fetch }) {\n const sortMap = new Map([\n [\"latest-desc\", \"\"],\n [\"price-asc\", \"price asc\"],\n [\"price-desc\", \"price desc\"],\n [\"trending-desc\", \"popularity\"],\n ]);\n const {\n categoryId,\n includeSubCategories,\n categories,\n brandId,\n search,\n sort = \"latest-desc\",\n count,\n } = input;\n const mappedSort = sortMap.get(sort);\n\n const includedCategories = includeSubCategories\n ? walkCategoryTree(\n categories?.find((category) => category.id === categoryId),\n categories\n )\n : undefined;\n\n const { results: products } = await fetch({\n query: options.query,\n method: options.method,\n variables: ensureNoNilFields({\n category: !includeSubCategories ? categoryId : undefined,\n brand: brandId,\n search,\n sort: mappedSort,\n expand: [\"variants\"],\n limit: count,\n $filters: {\n ...(includeSubCategories\n ? { category: includedCategories?.map((c) => c.id) }\n : {}),\n },\n }),\n });\n\n return {\n products: products.map((product: SwellProduct) =>\n normalizeProduct(product)\n ),\n found: products.length > 0,\n };\n },\n useHook:\n ({ useData }) =>\n (input = {}) => {\n return useData({\n input: [\n [\"search\", input.search],\n [\"categoryId\", input.categoryId],\n [\"includeSubCategories\", input.includeSubCategories],\n [\"categories\", input.categories],\n [\"brandId\", input.brandId],\n [\"sort\", input.sort],\n [\"count\", input.count],\n ] as HookSWRInput,\n swrOptions: {\n revalidateOnFocus: false,\n ...input.swrOptions,\n },\n });\n },\n};\n","import { GetProductHook, SWRHook, UseProduct, useProduct } from '@plasmicpkgs/commerce'\nimport { normalizeProduct } from '../utils'\nimport { SwellProduct } from '../types'\n\nexport type GetProductInput = {\n id?: string;\n}\n\nexport default useProduct as UseProduct<typeof handler>\n\nexport const handler: SWRHook<GetProductHook> = {\n fetchOptions: {\n query: 'products',\n method: 'get',\n },\n async fetcher({ input, options, fetch }) {\n const { id } = input;\n const product = await fetch({\n query: options.query,\n method: options.method,\n variables: [id],\n });\n if (!product) {\n return null;\n }\n return normalizeProduct(product);\n },\n useHook:\n ({ useData }) =>\n (input = {}) => {\n return useData({\n input: [\n ['id', input.id],\n ],\n swrOptions: {\n revalidateOnFocus: false,\n ...input.swrOptions,\n },\n })\n },\n}\n","import {\n SiteTypes,\n SWRHook,\n useCategories,\n UseCategories,\n} from \"@plasmicpkgs/commerce\";\nimport { useMemo } from \"react\";\nimport { Category } from \"../types/site\";\nimport { normalizeCategory } from \"../utils\";\nimport { topologicalSortForCategoryTree } from \"../utils/category-tree\";\nimport { ensureNoNilFields } from \"../utils/common\";\n\nexport default useCategories as UseCategories<typeof handler>;\n\ntype GetCategoriesHook = SiteTypes.GetCategoriesHook;\n\nexport const handler: SWRHook<GetCategoriesHook> = {\n fetchOptions: {\n query: \"categories\",\n method: \"get\",\n },\n async fetcher({ input, options, fetch }) {\n const { addIsEmptyField, categoryId } = input;\n\n const data = await fetch({\n query: options.query,\n method: options.method,\n variables: ensureNoNilFields({\n expand: [\"children\", \"parent_id\"],\n id: categoryId,\n }),\n });\n\n let categories = data?.results ?? [];\n if (addIsEmptyField) {\n categories = await Promise.all(\n categories.map(async (category: any) => ({\n ...category,\n products: (\n await fetch({\n query: \"products\",\n method: \"list\",\n variables: ensureNoNilFields({\n limit: 1,\n category: category.id,\n }),\n })\n ).results,\n }))\n );\n }\n\n const normalizedCategories: Category[] = !categoryId\n ? topologicalSortForCategoryTree(categories.map(normalizeCategory))\n : categories.map(normalizeCategory);\n\n for (const category of normalizedCategories) {\n category.depth =\n (normalizedCategories.find((c) => c.id === category.parentId)?.depth ??\n -1) + 1;\n }\n return normalizedCategories;\n },\n useHook: ({ useData }) => (input) => {\n const response = useData({\n input: [\n [\"addIsEmptyField\", input?.addIsEmptyField],\n [\"categoryId\", input?.categoryId],\n ],\n swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },\n });\n return useMemo(\n () =>\n Object.create(response, {\n isEmpty: {\n get() {\n return (response.data?.length ?? 0) <= 0;\n },\n enumerable: true,\n },\n }),\n [response]\n );\n },\n};\n","import {\n SiteTypes,\n SWRHook,\n useBrands,\n UseBrands,\n} from \"@plasmicpkgs/commerce\";\nimport { useMemo } from \"react\";\n\nexport default useBrands as UseBrands<typeof handler>;\n\ntype GetBrandsHook = SiteTypes.GetBrandsHook;\n\nexport const handler: SWRHook<GetBrandsHook> = {\n fetchOptions: {\n query: \"attributes\",\n method: \"get\",\n },\n async fetcher({ fetch }) {\n const vendors: [string] =\n (\n await fetch({\n query: \"attributes\",\n method: \"get\",\n variables: \"brand\",\n })\n )?.values ?? [];\n return Array.from(new Set(vendors).values()).map((v) => ({\n entityId: v,\n name: v,\n path: `brands/${v}`,\n }));\n },\n useHook: ({ useData }) => (input) => {\n const response = useData({\n swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },\n });\n return useMemo(\n () =>\n Object.create(response, {\n isEmpty: {\n get() {\n return (response.data?.length ?? 0) <= 0;\n },\n enumerable: true,\n },\n }),\n [response]\n );\n },\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport { Fetcher } from '@plasmicpkgs/commerce'\nimport { CommerceError } from '@plasmicpkgs/commerce'\nimport { handleFetchResponse } from './utils'\nimport swell from './provider'\n\nconst fetcher: Fetcher = async ({ method = 'get', variables, query }) => {\n async function callSwell() {\n if (Array.isArray(variables)) {\n const arg1 = variables[0]\n const arg2 = variables[1]\n const response = await swell[query!][method](arg1, arg2)\n return handleFetchResponse(response)\n } else {\n const response = await swell[query!][method](variables)\n return handleFetchResponse(response)\n }\n }\n\n if (query && query in swell) {\n return await callSwell()\n } else {\n throw new CommerceError({ message: 'Invalid query argument!' })\n }\n}\n\nexport default fetcher\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: Added storeId and publicKey parameters\n*/\n// @ts-ignore\nimport swell, { init } from \"swell-js\";\n\nimport { CommerceExtraFeatures, Provider } from \"@plasmicpkgs/commerce\";\nimport { SWELL_CHECKOUT_ID_COOKIE } from \"./const\";\nimport { handler as useCart } from \"./cart/use-cart\";\nimport { handler as useAddItem } from \"./cart/use-add-item\";\nimport { handler as useUpdateItem } from \"./cart/use-update-item\";\nimport { handler as useRemoveItem } from \"./cart/use-remove-item\";\nimport { handler as useSearch } from \"./product/use-search\";\nimport { handler as useProduct } from \"./product/use-product\";\nimport { handler as useCategories } from \"./site/use-categories\";\nimport { handler as useBrands } from \"./site/use-brands\";\nimport fetcher from \"./fetcher\";\nimport { Fetcher } from \"@plasmicpkgs/commerce\";\n\nexport const getSwellProvider = (storeId: string, publicKey: string) => {\n init(storeId, publicKey);\n\n return {\n locale: \"en-us\",\n cartCookie: SWELL_CHECKOUT_ID_COOKIE,\n swell,\n fetcher,\n cart: { useCart, useAddItem, useUpdateItem, useRemoveItem },\n products: { useSearch, useProduct },\n site: { useCategories, useBrands },\n extraFeatures: {\n includeSubCategories: true,\n },\n };\n};\n\nexport type SwellProvider = {\n locale: string;\n cartCookie: string;\n fetcher: Fetcher;\n cart: {\n useCart: typeof useCart;\n useAddItem: typeof useAddItem;\n useUpdateItem: typeof useUpdateItem;\n useRemoveItem: typeof useRemoveItem;\n };\n products: {\n useSearch: typeof useSearch;\n };\n site: {\n useCategories: typeof useCategories;\n useBrands: typeof useBrands;\n };\n extraFeatures: CommerceExtraFeatures;\n swell: any;\n};\n\nexport default swell as any;\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/swell/src\n Changes: None\n*/\nimport {\n CommerceAPIConfig,\n getCommerceProvider as getCoreCommerceProvider,\n useCommerce as useCoreCommerce,\n} from '@plasmicpkgs/commerce'\nimport { SWELL_CHECKOUT_ID_COOKIE, SWELL_COOKIE_EXPIRE, SWELL_CUSTOMER_TOKEN_COOKIE } from './const'\nimport { getSwellProvider, SwellProvider } from './provider'\nimport fetchApi from './utils/fetch-swell-api'\n\nexport type { SwellProvider }\n\nexport const getCommerceProvider = (storeId: string, publicKey: string) => \n getCoreCommerceProvider(getSwellProvider(storeId, publicKey))\n\nexport const useCommerce = () => useCoreCommerce<SwellProvider>()\n\n\nexport interface SwellConfig extends CommerceAPIConfig {\n fetch: any\n}\n\nconst config: SwellConfig = {\n locale: 'en-US',\n commerceUrl: '',\n apiToken: ''!,\n cartCookie: SWELL_CHECKOUT_ID_COOKIE,\n cartCookieMaxAge: SWELL_COOKIE_EXPIRE,\n fetch: fetchApi,\n customerCookie: SWELL_CUSTOMER_TOKEN_COOKIE,\n}\n","import { GlobalContextMeta } from \"@plasmicapp/host\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport {\n CartActionsProvider,\n globalActionsRegistrations,\n} from \"@plasmicpkgs/commerce\";\nimport React from \"react\";\nimport { Registerable } from \"./registerable\";\nimport { getCommerceProvider } from \"./swell\";\n\ninterface CommerceProviderProps {\n children?: React.ReactNode;\n storeId: string;\n publicKey: string;\n}\n\nconst globalContextName = \"plasmic-commerce-swell-provider\";\n\nexport const commerceProviderMeta: GlobalContextMeta<CommerceProviderProps> = {\n name: \"plasmic-commerce-swell-provider\",\n displayName: \"Swell Provider\",\n props: {\n storeId: {\n type: \"string\",\n defaultValue: \"plasmic-sandbox\",\n },\n publicKey: {\n type: \"string\",\n defaultValue: \"pk_QaZeGhtpQaVbNQnWJdRlE1abE6Ezf9U9\",\n },\n },\n ...{ globalActions: globalActionsRegistrations },\n description: `Get your store ID and public storefront API key from the Swell admin UI under Developer > API Keys.\n\n[Watch how to use this integration](https://www.youtube.com/watch?v=b2mgOTbP2_8).`,\n importPath: \"@plasmicpkgs/commerce-swell\",\n importName: \"CommerceProviderComponent\",\n};\n\nexport function CommerceProviderComponent(props: CommerceProviderProps) {\n const { storeId, publicKey, children } = props;\n\n const CommerceProvider = React.useMemo(\n () => getCommerceProvider(storeId, publicKey),\n [storeId, publicKey]\n );\n\n return (\n <CommerceProvider>\n <CartActionsProvider globalContextName={globalContextName}>\n {children}\n </CartActionsProvider>\n </CommerceProvider>\n );\n}\n\nexport function registerCommerceProvider(\n loader?: Registerable,\n customCommerceProviderMeta?: GlobalContextMeta<CommerceProviderProps>\n) {\n const doRegisterComponent: typeof registerGlobalContext = (...args) =>\n loader\n ? loader.registerGlobalContext(...args)\n : registerGlobalContext(...args);\n doRegisterComponent(\n CommerceProviderComponent,\n customCommerceProviderMeta ?? commerceProviderMeta\n );\n}\n","import { Registerable } from \"./registerable\";\nimport { registerCommerceProvider } from \"./registerCommerceProvider\";\nexport * from \"./registerable\";\nexport * from \"./registerCommerceProvider\";\nexport * from \"./swell\";\nexport { registerCommerceProvider };\n\nexport function registerAll(loader?: Registerable) {\n registerCommerceProvider(loader);\n}\n"],"names":["SWELL_CHECKOUT_ID_COOKIE","SWELL_CHECKOUT_URL_COOKIE","SWELL_COOKIE_EXPIRE","normalizeProductOption","_ref2","id","_ref2$name","name","displayName","_ref2$values","values","returnValues","map","value","output","label","match","_extends","hexColors","__typename","normalizeProductImages","images","length","url","_ref3","file","rest","_objectWithoutPropertiesLoose","_excluded","height","Number","width","normalizeProductVariants","variants","productOptions","_ref4","price","_ref4$option_value_id","option_value_ids","optionValueIds","split","i","trim","options","matchingOption","find","option","_matchingOption$name","undefined","normalizeProduct","swellProduct","description","slug","currencyCode","currency","emptyVariants","o","productVariants","results","productImages","product","vendor","path","normalizeCart","_ref5","account_id","date_created","tax_included_total","items","sub_total","grand_total","discounts","cart","customerId","email","createdAt","code","taxesIncluded","lineItems","_items$map","normalizeLineItem","lineItemsSubtotalPrice","subtotalPrice","totalPrice","discount","amount","_ref6","variant","quantity","item","variantId","productId","_product$id","_product$name","_variant$id","sku","_variant$sku","image","requiresShipping","listPrice","normalizeChildren","children","ch","normalizeCategory","_ref7","products","depth","parent_id","isEmpty","parentId","handleFetchResponse","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","res","wrap","_callee$","_context","prev","next","error","CommerceError","abrupt","stop","_x","apply","arguments","getCheckoutId","Cookies","get","checkoutToCart","checkoutPayload","message","checkoutCreate","fetch","checkoutUrl","query","method","sent","variables","checkout_url","expires","sameSite","secure","set","handler","fetchOptions","fetcher","useHook","useData","input","response","swrOptions","revalidateOnFocus","useMemo","Object","create","_response$data$lineIt","_response$data","data","enumerable","isInteger","checkoutId","product_id","variant_id","_useCart","useCart","mutate","useCallback","_addItem","_callee2","_callee2$","_context2","addItem","itemId","_removeItem","removeItem","_ref$input","removeItemHandler","ValidationError","ctx","_ctx","debounce","_input$id","_ctx$wait","wait","ensure","x","msg","Error","ensureNoNilFields","fromEntries","entries","filter","v","walkCategoryTree","category","categories","queue","result","_curr$children$map","_curr$children","curr","shift","push","child","topologicalSortForCategoryTree","flatMap","sortMap","Map","categoryId","includeSubCategories","brandId","search","_input$sort","sort","count","mappedSort","includedCategories","brand","expand","limit","$filters","c","_yield$fetch","found","addIsEmptyField","_context3","_data$results","Promise","all","t0","t1","t2","t3","t4","normalizedCategories","_loop","_normalizedCategories","_normalizedCategories2","_loop$","_step","_iterator","_createForOfIteratorHelperLoose","done","delegateYield","_response$data$length","_yield$fetch$values","vendors","Array","from","Set","entityId","_ref$method","callSwell","_callSwell","_callSwell3","arg1","arg2","_response","isArray","swell","_callSwell2","getSwellProvider","storeId","publicKey","init","locale","cartCookie","useAddItem","useUpdateItem","useRemoveItem","useSearch","useProduct","site","useCategories","useBrands","extraFeatures","getCommerceProvider","getCoreCommerceProvider","useCommerce","useCoreCommerce","globalContextName","commerceProviderMeta","props","type","defaultValue","globalActions","globalActionsRegistrations","importPath","importName","CommerceProviderComponent","CommerceProvider","React","CartActionsProvider","registerCommerceProvider","loader","customCommerceProviderMeta","doRegisterComponent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AwBA,CACtCC,MAAqB,EACrBC,0BAAqE;EAErE,IAAMC,mBAAmB,GAAiC,SAApDA,mBAAmBA;IAAA,OACvBF,MAAM,GACFA,MAAM,CAACG,qBAAqB,CAAA9K,KAAA,CAA5B2K,MAAM,EAAA1K,SAA8B,CAAC,GACrC6K,qBAAqB,CAAA9K,KAAA,SAAAC,SAAQ,CAAC;;EACpC4K,mBAAmB,CACjBP,yBAAyB,EACzBM,0BAA0B,WAA1BA,0BAA0B,GAAId,oBAAoB,CACnD;AACH;;SC7DgBiB,WAAWA,CAACJ,MAAqB;EAC/CD,wBAAwB,CAACC,MAAM,CAAC;AAClC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicpkgs/commerce-swell",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.217",
|
|
4
4
|
"description": "Plasmic registration calls for swell commerce provider",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"analyze": "size-limit --why"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@plasmicapp/host": "1.0.
|
|
21
|
+
"@plasmicapp/host": "1.0.210",
|
|
22
22
|
"@size-limit/preset-small-lib": "^4.11.0",
|
|
23
23
|
"@types/debounce": "^1.2.3",
|
|
24
24
|
"@types/js-cookie": "^3.0.1",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"react": ">=16.8.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@plasmicpkgs/commerce": "0.0.
|
|
36
|
+
"@plasmicpkgs/commerce": "0.0.208",
|
|
37
37
|
"@types/react": "^18.0.27",
|
|
38
38
|
"debounce": "^1.2.1",
|
|
39
39
|
"js-cookie": "^3.0.5",
|
|
40
40
|
"swell-js": "^3.13.0"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "7f923856013e0efa4eb893fa16c2f48bd4edc9c3"
|
|
43
43
|
}
|