@plasmicpkgs/commerce-commercetools 0.0.155 → 0.0.157

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.
@@ -410,7 +410,7 @@ var removeCartCookie = function removeCartCookie() {
410
410
  };
411
411
 
412
412
  var createCart = /*#__PURE__*/function () {
413
- var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(fetch) {
413
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(fetch) {
414
414
  var draft, cart;
415
415
  return _regeneratorRuntime().wrap(function _callee$(_context) {
416
416
  while (1) switch (_context.prev = _context.next) {
@@ -445,7 +445,7 @@ var createCart = /*#__PURE__*/function () {
445
445
  }();
446
446
 
447
447
  var getActiveCart = /*#__PURE__*/function () {
448
- var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(fetch) {
448
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(fetch) {
449
449
  var cartId, activeCart;
450
450
  return _regeneratorRuntime().wrap(function _callee$(_context) {
451
451
  while (1) switch (_context.prev = _context.next) {
@@ -655,7 +655,7 @@ var handler = {
655
655
  method: "get"
656
656
  },
657
657
  fetcher: function fetcher(_ref) {
658
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
658
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
659
659
  var fetch, provider, activeCart;
660
660
  return _regeneratorRuntime().wrap(function _callee$(_context) {
661
661
  while (1) switch (_context.prev = _context.next) {
@@ -702,7 +702,7 @@ var handler$1 = {
702
702
  method: "post"
703
703
  },
704
704
  fetcher: function fetcher(_ref) {
705
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
705
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
706
706
  var _item$quantity;
707
707
  var item, fetch, provider, activeCart, updatedCart;
708
708
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -756,8 +756,8 @@ var handler$1 = {
756
756
  return function () {
757
757
  var _useCart = commerce.useCart(),
758
758
  mutate = _useCart.mutate;
759
- return React.useCallback( /*#__PURE__*/function () {
760
- var _addItem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
759
+ return React.useCallback(/*#__PURE__*/function () {
760
+ var _addItem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
761
761
  var data;
762
762
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
763
763
  while (1) switch (_context2.prev = _context2.next) {
@@ -793,7 +793,7 @@ var handler$2 = {
793
793
  method: "post"
794
794
  },
795
795
  fetcher: function fetcher(_ref) {
796
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
796
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
797
797
  var itemId, fetch, provider, activeCart, updatedCart;
798
798
  return _regeneratorRuntime().wrap(function _callee$(_context) {
799
799
  while (1) switch (_context.prev = _context.next) {
@@ -850,7 +850,7 @@ var handler$2 = {
850
850
  var _useCart = commerce.useCart(),
851
851
  mutate = _useCart.mutate;
852
852
  var removeItem = /*#__PURE__*/function () {
853
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
853
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
854
854
  var _input$id;
855
855
  var itemId, data;
856
856
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -898,7 +898,7 @@ var handler$3 = {
898
898
  method: "post"
899
899
  },
900
900
  fetcher: function fetcher(_ref) {
901
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
901
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
902
902
  var _item$quantity;
903
903
  var _ref$input, item, itemId, fetch, provider, activeCart, updatedCart;
904
904
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -985,8 +985,8 @@ var handler$3 = {
985
985
  item = _ctx.item;
986
986
  var _useCart = commerce.useCart(),
987
987
  mutate = _useCart.mutate;
988
- return React.useCallback(debounce( /*#__PURE__*/function () {
989
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
988
+ return React.useCallback(debounce(/*#__PURE__*/function () {
989
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
990
990
  var _input$id;
991
991
  var itemId, data;
992
992
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -1058,7 +1058,7 @@ var getFetcher = function getFetcher(creds) {
1058
1058
  projectKey: creds.projectKey
1059
1059
  });
1060
1060
  return /*#__PURE__*/function () {
1061
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
1061
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
1062
1062
  var method, variables, query, body, queryBuilder;
1063
1063
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1064
1064
  while (1) switch (_context.prev = _context.next) {
@@ -1110,7 +1110,7 @@ var handler$4 = {
1110
1110
  method: "get"
1111
1111
  },
1112
1112
  fetcher: function fetcher(_ref) {
1113
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1113
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1114
1114
  var input, options, fetch, provider, id, product;
1115
1115
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1116
1116
  while (1) switch (_context.prev = _context.next) {
@@ -1161,7 +1161,7 @@ var handler$5 = {
1161
1161
  query: "productProjections"
1162
1162
  },
1163
1163
  fetcher: function fetcher(_ref) {
1164
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1164
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1165
1165
  var _search;
1166
1166
  var input, options, fetch, provider, search, categoryId, sort, count, response;
1167
1167
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -1219,7 +1219,7 @@ var handler$6 = {
1219
1219
  query: ""
1220
1220
  },
1221
1221
  fetcher: function fetcher(_ref) {
1222
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1222
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1223
1223
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1224
1224
  while (1) switch (_context.prev = _context.next) {
1225
1225
  case 0:
@@ -1260,7 +1260,7 @@ var handler$7 = {
1260
1260
  method: "get"
1261
1261
  },
1262
1262
  fetcher: function fetcher(_ref) {
1263
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1263
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1264
1264
  var input, options, fetch, provider, categoryId, categories, category;
1265
1265
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1266
1266
  while (1) switch (_context.prev = _context.next) {
@@ -1393,7 +1393,7 @@ function CommerceProviderComponent(props) {
1393
1393
  }, [projectKey, clientId, clientSecret, region]);
1394
1394
  var _usePlasmicQueryData = query.usePlasmicQueryData(JSON.stringify({
1395
1395
  creds: creds
1396
- }) + "locale", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1396
+ }) + "locale", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1397
1397
  var fetcher, project;
1398
1398
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1399
1399
  while (1) switch (_context.prev = _context.next) {
@@ -1 +1 @@
1
- {"version":3,"file":"commerce-commercetools.cjs.development.js","sources":["../src/utils/get-sort-variables.ts","../src/const.ts","../src/utils/cookies.ts","../src/utils/cart-cookie.ts","../src/utils/cart-create.ts","../src/utils/cart-active.ts","../src/utils/localized-string.ts","../src/utils/common.ts","../src/utils/normalize.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/client.ts","../src/fetcher.ts","../src/product/use-product.tsx","../src/product/use-search.tsx","../src/site/use-brands.tsx","../src/site/use-categories.tsx","../src/provider.ts","../src/commercetools.tsx","../src/registerCommerceProvider.tsx","../src/index.tsx"],"sourcesContent":["const getSortVariables = (sort?: string, isCategory: boolean = false) => {\n let output = undefined\n switch (sort) {\n case 'price-asc':\n output = 'price asc'\n break\n case 'price-desc':\n output = 'price desc'\n break\n case 'trending-desc': // default option\n output = undefined\n break\n case 'latest-desc':\n output = 'createdAt desc'\n break\n }\n return output\n}\n\nexport default getSortVariables\n","export const COMMERCETOOLS_COOKIE_EXPIRE = 30\n\nexport const COMMERCETOOLS_CART_COOKIE = 'commercetools_cart'\n\nexport const COMMERCETOOLS_CUSTOMER_COOKIE = 'commercetools_customer'\n\nexport const COMMERCETOOLS_WISHLIST_COOKIE = 'commercetools_wishlist'\n","import Cookies, { CookieAttributes } from 'js-cookie';\nimport { COMMERCETOOLS_COOKIE_EXPIRE } from '../const'\n\nconst options: CookieAttributes = {\n expires: COMMERCETOOLS_COOKIE_EXPIRE,\n sameSite: \"none\",\n secure: true\n}\n\nexport const getCookies = <T>(name: string) => {\n const cookie = Cookies.get(name);\n return cookie ? (JSON.parse(cookie) as T) : undefined\n}\n\nexport const setCookies = (name: string, value: any) => Cookies.set(name, JSON.stringify(value), options);\n\nexport const removeCookies = (name: string) => Cookies.remove(name);\n","import { COMMERCETOOLS_CART_COOKIE } from '../const'\nimport { getCookies, setCookies, removeCookies } from './cookies'\n\nexport const getCartId = () =>\n getCookies<string>(COMMERCETOOLS_CART_COOKIE)\n\nexport const setCartId = (id: string) =>\n setCookies(COMMERCETOOLS_CART_COOKIE, id)\n\nexport const removeCartCookie = () =>\n removeCookies(COMMERCETOOLS_CART_COOKIE)\n","import { Cart, CartDraft } from '@commercetools/platform-sdk'\nimport { ClientResponse } from '@commercetools/sdk-client-v2'\nimport { FetcherOptions } from '@plasmicpkgs/commerce'\nimport { removeCartCookie, setCartId } from './cart-cookie'\n\nconst createCart = async (\n fetch: <T = any, B = Body>(options: FetcherOptions<B>) => Promise<T>\n) => {\n const draft: CartDraft = {\n currency: 'USD',\n country: 'US',\n }\n\n const cart = await fetch<ClientResponse<Cart>, CartDraft>({\n query: 'carts',\n method: 'post',\n body: draft,\n })\n\n if (!cart.body) {\n removeCartCookie()\n } else {\n setCartId(cart.body.id)\n }\n return cart.body\n}\n\nexport default createCart\n","import { Cart, ClientResponse } from '@commercetools/platform-sdk'\nimport { FetcherOptions } from '@plasmicpkgs/commerce'\nimport { getCartId, removeCartCookie, setCartId } from './cart-cookie'\nimport createCart from './cart-create'\n\nconst getActiveCart = async (\n fetch: <T = any, B = Body>(options: FetcherOptions<B>) => Promise<T>\n) => {\n const cartId = getCartId()\n let activeCart\n if (cartId) {\n activeCart = (\n await fetch<ClientResponse<Cart>>({\n query: 'carts',\n method: 'get',\n variables: {\n id: cartId,\n },\n })\n ).body\n } else {\n activeCart = await createCart(fetch)\n }\n\n if (!activeCart) {\n removeCartCookie()\n } else {\n setCartId(activeCart.id)\n }\n return activeCart\n}\n\nexport default getActiveCart\n","const getLocalizedString = (\n localizedString: Record<string, string> | undefined,\n locale: string | undefined\n) =>\n !localizedString || !locale\n ? undefined\n : locale in localizedString\n ? localizedString[locale]\n : Object.values(localizedString)[0]\n\nexport default getLocalizedString\n","export const withoutNils = <T>(xs: Array<T | undefined | null>): T[] =>\n xs.filter((x): x is T => x != null)\n\nexport const dedup = <T>(xs: Array<T>): T[] => [...new Set(xs)]\n","import { Category } from '../types/site'\nimport {\n ProductProjection,\n Image,\n ProductVariant,\n Category as CommercetoolsCategory,\n Cart as CommercetoolsCart,\n LineItem as CommercetoolsLineItem,\n TypedMoney,\n Customer,\n ShoppingList,\n ProductData,\n} from '@commercetools/platform-sdk'\nimport { dedup, withoutNils } from './common'\nimport getLocalizedString from './localized-string'\nimport { Cart, LineItem } from '../types/cart'\nimport { Product, ProductOption } from '../types/product'\n\nconst currencyCode = 'USD'\n\nconst stringify = (value: any) =>\n typeof value === 'string' ? value : JSON.stringify(value)\n\nconst money = (price: TypedMoney | undefined) => {\n return price\n ? {\n value: price.centAmount / 100,\n currencyCode: price.currencyCode,\n }\n : {\n value: -1.0, // error\n currencyCode,\n }\n}\n\nconst normalizeProductOption = (option: {\n name: string\n value: string | string[]\n}): ProductOption => ({\n __typename: 'MultipleChoiceOption',\n id: option.name,\n displayName: option.name,\n values: dedup(\n Array.isArray(option.value) ? option.value : [option.value]\n ).map((val) => {\n if (\n option.name.match(/colou?r/gi) &&\n /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/i.test(val)\n ) {\n return {\n label: stringify(val),\n hexColors: [val],\n }\n } else {\n return {\n label: stringify(val),\n }\n }\n }),\n})\n\nconst normalizeProductImages = (images: Image[]) =>\n images.map((image) => ({\n url: image.url,\n ...(image.label ? { alt: image.label } : {}),\n width: image.dimensions.w,\n height: image.dimensions.h,\n }))\n\nconst normalizeProductVariant = (variant: ProductVariant) => {\n const price = money(\n variant.prices?.find((price) => price.value.currencyCode === currencyCode)\n ?.value ?? variant.prices?.[0]?.value\n ).value\n\n return {\n id: `${variant.id}`,\n name: `${variant.id}`,\n sku: variant.sku ?? '',\n price,\n options:\n variant.attributes?.map((attribute) =>\n normalizeProductOption({\n name: attribute.name,\n value: attribute.value.key,\n })\n ) ?? [],\n requiresShipping: false,\n listPrice: price,\n }\n}\n\nexport const normalizeProduct = (\n product: ProductProjection | (ProductData & { id: string }),\n locale: string,\n): Product => ({\n id: product.id,\n name: getLocalizedString(product.name, locale) ?? \"\",\n slug: getLocalizedString(product.slug, locale),\n path: `/${getLocalizedString(product.slug, locale)}`,\n description: getLocalizedString(product.description, locale) ?? '',\n price: money(\n product.masterVariant.prices?.find(\n (price) => price.value.currencyCode === currencyCode\n )?.value ?? product.masterVariant.prices?.[0]?.value\n ),\n images: normalizeProductImages(\n withoutNils([\n ...(product.masterVariant.images ? product.masterVariant.images : []),\n ...product.variants.flatMap((variant) => variant.images),\n ])\n ),\n variants: [product.masterVariant, ...product.variants].map(\n normalizeProductVariant\n ),\n options: withoutNils([\n ...(product.masterVariant.attributes\n ? product.masterVariant.attributes\n : []),\n ...product.variants.flatMap((variant) => variant.attributes),\n ])\n .reduce(\n (groupedAttributes, attribute) => {\n const groupedAttribute = groupedAttributes.find(\n (gAttr) => gAttr.name === attribute.name\n )\n if (groupedAttribute) {\n groupedAttribute.value.push(stringify(attribute.value.key))\n } else {\n groupedAttributes.push({\n name: attribute.name,\n value: [stringify(attribute.value.key)],\n })\n }\n return groupedAttributes\n },\n [] as {\n name: string\n value: string[]\n }[]\n )\n .map(normalizeProductOption),\n})\n\nconst normalizeLineItem = (\n lineItem: CommercetoolsLineItem,\n locale: string,\n): LineItem => ({\n id: lineItem.id,\n variantId: `${lineItem.variant.id}`,\n productId: lineItem.productId,\n name: getLocalizedString(lineItem.name, locale) ?? \"\",\n path: '',\n quantity: lineItem.quantity,\n discounts: [],\n variant: normalizeProductVariant(lineItem.variant),\n options:\n lineItem.variant.attributes?.map((attribute) => ({\n id: attribute.name,\n name: attribute.name,\n value: attribute.value.key,\n })) ?? [],\n})\n\nexport const normalizeCart = (\n cart: CommercetoolsCart,\n locale: string,\n): Cart => ({\n id: cart.id,\n customerId: cart.customerId,\n email: cart.customerEmail,\n createdAt: cart.createdAt,\n currency: {\n code: currencyCode,\n },\n taxesIncluded: cart.taxMode !== 'Disabled',\n lineItems: cart.lineItems.map((item) => normalizeLineItem(item, locale)),\n lineItemsSubtotalPrice: 0,\n subtotalPrice: money(cart.totalPrice).value,\n totalPrice: money(cart.totalPrice).value,\n discounts: [],\n})\n\nexport const normalizeCategory = (\n category: CommercetoolsCategory,\n locale: string,\n): Category => ({\n id: category.id,\n name: getLocalizedString(category.name, locale) ?? \"\",\n slug: getLocalizedString(category.slug, locale) ?? \"\",\n path: `/${getLocalizedString(category.slug, locale)}`,\n})\n\nexport const normalizeCustomer = (customer: Customer) => ({\n firstName: customer.firstName,\n lastName: customer.lastName,\n email: customer.email,\n})\n\nexport const normalizeWishlist = (wishlist: ShoppingList) => ({\n items:\n wishlist.lineItems?.map((item) => ({\n id: item.id,\n product_id: item.productId,\n variant_id: item.variantId!,\n })) ?? [],\n})\n","import { useMemo } from 'react'\nimport { useCart as useCommerceCart, UseCart } from '@plasmicpkgs/commerce'\nimport { SWRHook } from '@plasmicpkgs/commerce'\nimport { getActiveCart, normalizeCart } from '../utils'\nimport { GetCartHook } from '../types/cart'\n\nexport default useCommerceCart as UseCart<typeof handler>\n\nexport const handler: SWRHook<GetCartHook> = {\n fetchOptions: {\n query: \"cart\",\n method: \"get\",\n },\n async fetcher({ input, options, fetch, provider }) {\n const activeCart = await getActiveCart(fetch);\n return activeCart ? normalizeCart(activeCart, provider!.locale) : 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","import { Cart, CartUpdate, ClientResponse } from \"@commercetools/platform-sdk\";\nimport type { MutationHook } from \"@plasmicpkgs/commerce\";\nimport { useAddItem, UseAddItem } from \"@plasmicpkgs/commerce\";\nimport { useCallback } from \"react\";\nimport type { AddItemHook } from \"../types/cart\";\nimport {\n getActiveCart,\n normalizeCart,\n removeCartCookie,\n setCartId,\n} from \"../utils\";\nimport useCart from \"./use-cart\";\n\nexport default useAddItem as UseAddItem<typeof handler>;\n\nexport const handler: MutationHook<AddItemHook> = {\n fetchOptions: {\n query: \"cart\",\n method: \"post\",\n },\n async fetcher({ input: item, options, fetch, provider }) {\n const activeCart = await getActiveCart(fetch);\n if (\n (item.quantity &&\n (!Number.isInteger(item.quantity) || item.quantity! < 1)) ||\n !activeCart\n ) {\n return undefined;\n }\n const updatedCart = await fetch<ClientResponse<Cart>, CartUpdate>({\n query: \"carts\",\n method: \"post\",\n variables: {\n id: activeCart.id,\n },\n body: {\n version: activeCart.version,\n actions: [\n {\n action: \"addLineItem\",\n variantId: +item.variantId,\n productId: item.productId,\n quantity: item.quantity ?? 1,\n },\n ],\n },\n });\n if (updatedCart.body) {\n setCartId(updatedCart.body.id);\n } else {\n removeCartCookie();\n }\n return updatedCart.body\n ? normalizeCart(updatedCart.body, provider!.locale)\n : undefined;\n },\n useHook:\n ({ fetch }) =>\n () => {\n const { mutate } = useCart();\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","import {\n Cart as CommerceToolsCart,\n CartUpdate,\n ClientResponse,\n} from \"@commercetools/platform-sdk\";\nimport type {\n HookFetcherContext,\n MutationHook,\n MutationHookContext,\n} from \"@plasmicpkgs/commerce\";\nimport {\n UseRemoveItem,\n useRemoveItem,\n ValidationError,\n} from \"@plasmicpkgs/commerce\";\nimport { useCallback } from \"react\";\nimport type { Cart, LineItem, RemoveItemHook } from \"../types/cart\";\nimport {\n getActiveCart,\n normalizeCart,\n removeCartCookie,\n setCartId,\n} from \"../utils\";\nimport useCart from \"./use-cart\";\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: MutationHook<RemoveItemHook> = {\n fetchOptions: {\n query: \"cart\",\n method: \"post\",\n },\n async fetcher({\n input: { itemId },\n options,\n fetch,\n provider,\n }: HookFetcherContext<RemoveItemHook>) {\n const activeCart = await getActiveCart(fetch);\n if (!itemId || !activeCart) {\n return undefined;\n }\n const updatedCart = await fetch<\n ClientResponse<CommerceToolsCart>,\n CartUpdate\n >({\n query: \"carts\",\n method: \"post\",\n variables: {\n id: activeCart.id,\n },\n body: {\n version: activeCart.version,\n actions: [\n {\n action: \"removeLineItem\",\n lineItemId: itemId,\n },\n ],\n },\n });\n if (updatedCart.body) {\n setCartId(updatedCart.body.id);\n } else {\n removeCartCookie();\n }\n return normalizeCart(updatedCart.body, provider!.locale);\n },\n useHook:\n ({ fetch }: MutationHookContext<RemoveItemHook>) =>\n <T extends LineItem | undefined = undefined>(ctx: { item?: T } = {}) => {\n const { item } = ctx;\n const { mutate } = useCart();\n const removeItem: RemoveItemFn<LineItem> = async (input) => {\n const itemId = input?.id ?? item?.id;\n\n if (!itemId) {\n throw new ValidationError({\n message: \"Invalid input used for this operation\",\n });\n }\n\n const data = await fetch({ input: { itemId } });\n await mutate(data, false);\n return data;\n };\n\n return useCallback(removeItem as RemoveItemFn<T>, [fetch, mutate]);\n },\n};\n","import { Cart, CartUpdate, ClientResponse } from \"@commercetools/platform-sdk\";\nimport type { MutationHook, MutationHookContext } from \"@plasmicpkgs/commerce\";\nimport {\n useUpdateItem,\n UseUpdateItem,\n ValidationError,\n} from \"@plasmicpkgs/commerce\";\nimport debounce from \"debounce\";\nimport { useCallback } from \"react\";\nimport type { LineItem, UpdateItemHook } from \"../types/cart\";\nimport {\n getActiveCart,\n normalizeCart,\n removeCartCookie,\n setCartId,\n} from \"../utils\";\nimport useCart from \"./use-cart\";\nimport { handler as removeItemHandler } from \"./use-remove-item\";\n\nexport type UpdateItemActionInput<T = any> = T extends LineItem\n ? Partial<UpdateItemHook[\"actionInput\"]>\n : UpdateItemHook[\"actionInput\"];\n\nexport default useUpdateItem as UseUpdateItem<typeof handler>;\n\nexport const handler: MutationHook<UpdateItemHook> = {\n fetchOptions: {\n query: \"cart\",\n method: \"post\",\n },\n async fetcher({ input: { item, itemId }, options, fetch, provider }) {\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 provider,\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\n const activeCart = await getActiveCart(fetch);\n if (\n (item.quantity &&\n (!Number.isInteger(item.quantity) || item.quantity! < 1)) ||\n !activeCart\n ) {\n return undefined;\n }\n const updatedCart = await fetch<ClientResponse<Cart>, CartUpdate>({\n query: \"carts\",\n method: \"post\",\n variables: {\n id: activeCart.id,\n },\n body: {\n version: activeCart.version,\n actions: [\n {\n action: \"changeLineItemQuantity\",\n lineItemId: itemId,\n quantity: item.quantity ?? 1,\n },\n ],\n },\n });\n if (updatedCart.body) {\n setCartId(updatedCart.body.id);\n } else {\n removeCartCookie();\n }\n return updatedCart.body\n ? normalizeCart(updatedCart.body, provider!.locale)\n : undefined;\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 } = useCart() as any;\n\n return useCallback(\n debounce(async (input: UpdateItemActionInput<T>) => {\n const itemId = input.id ?? item?.id;\n if (!itemId || input.quantity == null) {\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","import {\n AuthMiddlewareOptions,\n ClientBuilder,\n HttpMiddlewareOptions,\n } from '@commercetools/sdk-client-v2'\nimport { CommercetoolsCredentials } from './provider'\n\nconst initCommercetoolsSDKClient = (creds: CommercetoolsCredentials) => {\n const scopes = [`manage_project:${creds.projectKey}`]\n \n // Configure authMiddlewareOptions\n const authMiddlewareOptions: AuthMiddlewareOptions = {\n host: `https://auth.${creds.region}.commercetools.com`,\n projectKey: creds.clientSecret,\n credentials: {\n clientId: creds.clientId,\n clientSecret: creds.clientSecret,\n },\n scopes,\n fetch,\n }\n \n // Configure httpMiddlewareOptions\n const httpMiddlewareOptions: HttpMiddlewareOptions = {\n host: `https://api.${creds.region}.commercetools.com`,\n fetch,\n }\n \n // Export the ClientBuilder\n return new ClientBuilder()\n .withProjectKey(creds.projectKey)\n .withClientCredentialsFlow(authMiddlewareOptions)\n .withHttpMiddleware(httpMiddlewareOptions)\n .build()\n}\n \n export default initCommercetoolsSDKClient","import { Fetcher } from '@plasmicpkgs/commerce'\nimport { CommercetoolsCredentials } from './provider'\nimport { createApiBuilderFromCtpClient } from '@commercetools/platform-sdk'\nimport initCommercetoolsSDKClient from './client'\n\nexport const getFetcher: \n (creds: CommercetoolsCredentials) => Fetcher =\n (creds) => {\n const client = initCommercetoolsSDKClient(creds);\n const apiRoot = createApiBuilderFromCtpClient(client).withProjectKey({\n projectKey: creds.projectKey!,\n })\n return async ({\n method, variables, query, body\n }) => {\n let queryBuilder: any = apiRoot;\n if (query) {\n queryBuilder = queryBuilder[query]();\n } \n if (variables?.id) {\n queryBuilder = queryBuilder.withId({ ID: variables.id });\n }\n if (variables?.search) {\n queryBuilder = queryBuilder.search();\n }\n return await queryBuilder[method!]({\n body,\n queryArgs: {\n expand: variables?.expand,\n limit: variables?.limit,\n ...(variables?.sort ? { sort: variables.sort } : {}),\n ...(variables?.search ? variables.search : {}),\n ...(variables?.filters ? { filter: variables.filters } : {}),\n ...(variables?.where ? { where: variables.where } : {})\n },\n })\n .execute()\n }\n}\n","import { SWRHook } from '@plasmicpkgs/commerce'\nimport { useProduct, UseProduct } from '@plasmicpkgs/commerce'\nimport {\n Product,\n ProductProjection,\n ClientResponse,\n} from '@commercetools/platform-sdk'\nimport { normalizeProduct } from '../utils'\nimport type { GetProductHook } from '@plasmicpkgs/commerce'\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: \"productProjections\",\n method: \"get\"\n },\n async fetcher({ input, options, fetch, provider }) {\n const { id } = input\n if (!id) {\n return null\n }\n\n const product = await fetch<ClientResponse<ProductProjection>>({\n ...options,\n variables: {\n id\n },\n });\n return product.body \n ? normalizeProduct(product.body, provider!.locale)\n : null\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 ClientResponse,\n ProductProjectionPagedQueryResponse,\n} from \"@commercetools/platform-sdk\";\nimport { useSearch } from \"@plasmicpkgs/commerce\";\nimport { getSortVariables, normalizeProduct } from \"../utils\";\n\nimport type {\n SearchProductsHook,\n SWRHook,\n UseSearch,\n} from \"@plasmicpkgs/commerce\";\n\nexport type SearchProductsInput = {\n search?: string;\n categoryId?: number;\n brandId?: number;\n sort?: string;\n locale?: string;\n count?: number;\n};\n\nconst useSearchTyped: UseSearch<typeof handler> = useSearch;\nexport default useSearchTyped;\n\nexport const handler: SWRHook<SearchProductsHook> = {\n fetchOptions: {\n method: \"get\",\n query: \"productProjections\",\n },\n async fetcher({ input, options, fetch, provider }) {\n const { search, categoryId, sort, count } = input;\n const response = await fetch<\n ClientResponse<ProductProjectionPagedQueryResponse>\n >({\n ...options,\n variables: {\n expand: [\"masterData.current\"],\n sort: getSortVariables(sort),\n limit: count,\n ...(search\n ? // eslint-disable-next-line\n { search: { [`text.${provider?.locale!}`]: search } }\n : {}),\n ...(categoryId\n ? { filters: `categories.id: subtree(\"${categoryId}\")` }\n : {}),\n },\n });\n return {\n products: response.body.results.map((product) =>\n normalizeProduct(product, provider!.locale)\n ),\n found: response.body.count > 0,\n };\n },\n useHook:\n ({ useData }) =>\n (input = {}) => {\n return useData({\n input: [\n [\"search\", input.search],\n [\"categoryId\", input.categoryId],\n [\"brandId\", input.brandId],\n [\"sort\", input.sort],\n [\"locale\", input.locale],\n [\"count\", input.count],\n ],\n swrOptions: {\n revalidateOnFocus: false,\n ...input.swrOptions,\n },\n });\n },\n};\n","import { SWRHook } from '@plasmicpkgs/commerce'\nimport { UseBrands, useBrands } from '@plasmicpkgs/commerce'\nimport { useMemo } from \"react\";\nimport { GetBrandsHook } from \"../types/site\"\n\nexport default useBrands as UseBrands<typeof handler>\n\nexport const handler: SWRHook<GetBrandsHook> = {\n fetchOptions: {\n query: \"\"\n },\n async fetcher({ input, options, fetch }) {\n return 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?.length ?? 0) <= 0\n },\n enumerable: true,\n },\n }),\n [response]\n )\n },\n}\n","import { SWRHook, UseCategories, useCategories } from \"@plasmicpkgs/commerce\";\nimport { useMemo } from \"react\";\nimport { GetCategoriesHook } from \"../types/site\";\nimport {\n ClientResponse,\n Category,\n CategoryPagedQueryResponse,\n} from '@commercetools/platform-sdk'\nimport { normalizeCategory } from \"../utils\";\n\nexport default useCategories as UseCategories<typeof handler>;\n\nexport const handler: SWRHook<GetCategoriesHook> = {\n fetchOptions: {\n query: \"categories\",\n method: \"get\",\n },\n async fetcher({ input, options, fetch, provider }) {\n const { categoryId } = input;\n if (!categoryId) {\n const categories = await fetch<ClientResponse<CategoryPagedQueryResponse>>({\n ...options\n })\n return categories.body ? categories.body.results.map((category) => normalizeCategory(category, provider!.locale)) : [];\n } else {\n const category = await fetch<ClientResponse<Category>>({\n ...options,\n variables: {\n ...(categoryId ? { id: categoryId } : { })\n }\n })\n return category.body ? [normalizeCategory(category.body, provider!.locale)] : [];\n }\n },\n useHook: ({ useData }) => (input) => {\n const response = useData({\n input: [[\"categoryId\", input?.categoryId]],\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 { Fetcher } from \"@plasmicpkgs/commerce\";\nimport { handler as useAddItem } from \"./cart/use-add-item\";\nimport { handler as useCart } from \"./cart/use-cart\";\nimport { handler as useRemoveItem } from \"./cart/use-remove-item\";\nimport { handler as useUpdateItem } from \"./cart/use-update-item\";\nimport { COMMERCETOOLS_CART_COOKIE } from \"./const\";\nimport { getFetcher } from \"./fetcher\";\nimport { handler as useProduct } from \"./product/use-product\";\nimport { handler as useSearch } from \"./product/use-search\";\nimport { handler as useBrands } from \"./site/use-brands\";\nimport { handler as useCategories } from \"./site/use-categories\";\n\nexport interface CommercetoolsCredentials {\n projectKey: string;\n clientId: string;\n clientSecret: string;\n region: string;\n}\n\nexport const getCommercetoolsProvider = (\n creds: CommercetoolsCredentials,\n locale: string\n) => ({\n locale,\n cartCookie: COMMERCETOOLS_CART_COOKIE,\n cart: { useCart, useAddItem, useRemoveItem, useUpdateItem },\n fetcher: getFetcher(creds),\n products: { useSearch, useProduct },\n site: { useCategories, useBrands },\n});\n\nexport type CommercetoolsProvider = {\n locale: string;\n cartCookie: string;\n fetcher: Fetcher;\n cart: {\n useCart: typeof useCart;\n useAddItem: typeof useAddItem;\n };\n products: {\n useSearch: typeof useSearch;\n useProduct: typeof useProduct;\n };\n site: {\n useCategories: typeof useCategories;\n useBrands: typeof useBrands;\n };\n};\n","import {\n getCommerceProvider as getCoreCommerceProvider,\n useCommerce as useCoreCommerce,\n} from '@plasmicpkgs/commerce'\nimport { getCommercetoolsProvider, CommercetoolsProvider, CommercetoolsCredentials } from './provider'\n\nexport type { CommercetoolsProvider }\n\nexport const useCommerce = () => useCoreCommerce<CommercetoolsProvider>()\n\nexport const getCommerceProvider = (creds: CommercetoolsCredentials, locale: string) => \n getCoreCommerceProvider(getCommercetoolsProvider(creds, locale))\n\n","import { ClientResponse, Project } from \"@commercetools/platform-sdk\";\nimport { GlobalContextMeta } from \"@plasmicapp/host\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport { usePlasmicQueryData } from \"@plasmicapp/query\";\nimport {\n CartActionsProvider,\n globalActionsRegistrations,\n} from \"@plasmicpkgs/commerce\";\nimport React from \"react\";\nimport { getCommerceProvider } from \"./commercetools\";\nimport { getFetcher } from \"./fetcher\";\nimport { CommercetoolsCredentials } from \"./provider\";\nimport { Registerable } from \"./registerable\";\n\ninterface CommerceProviderProps extends CommercetoolsCredentials {\n children?: React.ReactNode;\n}\n\nconst globalContextName = \"plasmic-commerce-commercetools-provider\";\n\nexport const commerceProviderMeta: GlobalContextMeta<CommerceProviderProps> = {\n name: globalContextName,\n displayName: \"Commercetools Provider\",\n props: {\n projectKey: {\n type: \"string\",\n defaultValue: \"plasmic-demo\",\n },\n clientId: {\n type: \"string\",\n defaultValue: \"B4hmK61xvz5LvdSDtsFmcflM\",\n },\n clientSecret: {\n type: \"string\",\n defaultValue: \"KhzjcjSu1Oul4aomSmOsLZOCZKbvfHqx\",\n },\n region: {\n type: \"choice\",\n options: [\n \"us-central1.gcp\",\n \"us-east-2.aws\",\n \"europe-west1.gcp\",\n \"eu-central-1.aws\",\n \"australia-southeast1.gcp\",\n ],\n defaultValue: \"us-central1.gcp\",\n },\n },\n ...{ globalActions: globalActionsRegistrations },\n importPath: \"@plasmicpkgs/commercetools\",\n importName: \"CommerceProviderComponent\",\n};\n\nexport function CommerceProviderComponent(props: CommerceProviderProps) {\n const { children, projectKey, clientId, clientSecret, region } = props;\n\n const creds = React.useMemo(\n () => ({ projectKey, clientId, clientSecret, region }),\n [projectKey, clientId, clientSecret, region]\n );\n\n const {\n data: locale,\n error,\n isLoading,\n } = usePlasmicQueryData(JSON.stringify({ creds }) + \"locale\", async () => {\n const fetcher = getFetcher(creds);\n const project: ClientResponse<Project> = await fetcher({ method: \"get\" });\n return project.body ? project.body.languages[0] : undefined;\n });\n\n const CommerceProvider = React.useMemo(\n () => getCommerceProvider(creds, locale ?? \"\"),\n [creds, locale]\n );\n\n if (isLoading) {\n return null;\n } else if (error || !locale) {\n throw new Error(error ? error.message : \"Project language not found\");\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 \"./commercetools\";\n\nexport function registerAll(loader?: Registerable) {\n registerCommerceProvider(loader);\n}\n"],"names":["getSortVariables","sort","isCategory","output","undefined","COMMERCETOOLS_COOKIE_EXPIRE","COMMERCETOOLS_CART_COOKIE","options","expires","sameSite","secure","getCookies","name","cookie","Cookies","get","JSON","parse","setCookies","value","set","stringify","removeCookies","remove","getCartId","setCartId","id","removeCartCookie","createCart","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","fetch","draft","cart","wrap","_callee$","_context","prev","next","currency","country","query","method","body","sent","abrupt","stop","_x","apply","arguments","getActiveCart","cartId","activeCart","variables","getLocalizedString","localizedString","locale","Object","values","withoutNils","xs","filter","x","dedup","concat","Set","currencyCode","money","price","centAmount","normalizeProductOption","option","__typename","displayName","Array","isArray","map","val","match","test","label","hexColors","normalizeProductImages","images","image","_extends","url","alt","width","dimensions","w","height","h","normalizeProductVariant","variant","_variant$prices$find$","_variant$prices","prices","find","_variant$prices2","sku","_variant$sku","_variant$attributes$m","_variant$attributes","attributes","attribute","key","requiresShipping","listPrice","normalizeProduct","product","_getLocalizedString","_getLocalizedString2","_product$masterVarian","_product$masterVarian2","_product$masterVarian3","slug","path","description","masterVariant","variants","flatMap","reduce","groupedAttributes","groupedAttribute","gAttr","push","normalizeLineItem","lineItem","_getLocalizedString3","_lineItem$variant$att","_lineItem$variant$att2","variantId","productId","quantity","discounts","normalizeCart","customerId","email","customerEmail","createdAt","code","taxesIncluded","taxMode","lineItems","item","lineItemsSubtotalPrice","subtotalPrice","totalPrice","normalizeCategory","category","_getLocalizedString4","_getLocalizedString5","handler","fetchOptions","fetcher","input","provider","useHook","_ref2","useData","response","swrOptions","revalidateOnFocus","useMemo","create","isEmpty","_response$data$lineIt","_response$data","data","length","enumerable","Number","isInteger","version","actions","action","_item$quantity","updatedCart","_useCart","useCart","mutate","useCallback","_addItem","_callee2","_callee2$","_context2","addItem","itemId","lineItemId","ctx","_ctx","removeItem","_ref3","_input$id","ValidationError","message","_ref$input","removeItemHandler","debounce","_ctx$wait","wait","initCommercetoolsSDKClient","creds","scopes","projectKey","authMiddlewareOptions","host","region","clientSecret","credentials","clientId","httpMiddlewareOptions","ClientBuilder","withProjectKey","withClientCredentialsFlow","withHttpMiddleware","build","getFetcher","client","apiRoot","createApiBuilderFromCtpClient","queryBuilder","withId","ID","search","queryArgs","expand","limit","filters","where","execute","categoryId","count","_search","products","results","found","brandId","_response$data$length","categories","getCommercetoolsProvider","cartCookie","useAddItem","useRemoveItem","useUpdateItem","useSearch","useProduct","site","useCategories","useBrands","useCommerce","useCoreCommerce","getCommerceProvider","getCoreCommerceProvider","globalContextName","commerceProviderMeta","props","type","defaultValue","globalActions","globalActionsRegistrations","importPath","importName","CommerceProviderComponent","children","React","_usePlasmicQueryData","usePlasmicQueryData","project","languages","error","isLoading","CommerceProvider","Error","CartActionsProvider","registerCommerceProvider","loader","customCommerceProviderMeta","doRegisterComponent","registerGlobalContext","registerA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,CAAZlG,IAAI;IACJsG,KAAK,GAAAJ,oBAAA,CAALI,KAAK;IACLC,SAAS,GAAAL,oBAAA,CAATK,SAAS;EAOX,IAAMC,gBAAgB,GAAGP,cAAK,CAACtG,OAAO,CACpC;IAAA,OAAMyF,mBAAmB,CAAClD,KAAK,EAAEnJ,MAAM,WAANA,MAAM,GAAI,EAAE,CAAC;KAC9C,CAACmJ,KAAK,EAAEnJ,MAAM,CAAC,CAChB;EAED,IAAIwN,SAAS,EAAE;IACb,OAAO,IAAI;GACZ,MAAM,IAAID,KAAK,IAAI,CAACvN,MAAM,EAAE;IAC3B,MAAM,IAAI0N,KAAK,CAACH,KAAK,GAAGA,KAAK,CAAC3E,OAAO,GAAG,4BAA4B,CAAC;;EAGvE,OACEsE,6BAACO,gBAAgB,QACfP,6BAACS,4BAAmB;IAACpB,iBAAiB,EAAEA;KACrCU,QAAQ,CACW,CACL;AAEvB;AAEA,SAAgBW,wBAAwBA,CACtCC,MAAqB,EACrBC,0BAAqE;EAErE,IAAMC,mBAAmB,GAAiC,SAApDA,mBAAmBA;IAAA,OACvBF,MAAM,GACFA,MAAM,CAACG,qBAAqB,CAAAxO,KAAA,CAA5BqO,MAAM,EAAApO,SAA8B,CAAC,GACrCuO,qBAAqB,CAAAxO,KAAA,SAAAC,SAAQ,CAAC;;EACpCsO,mBAAmB,CACjBf,yBAAyB,EACzBc,0BAA0B,WAA1BA,0BAA0B,GAAItB,oBAAoB,CACnD;AACH;;SCjGgByB,WAAWA,CAACJ,MAAqB;EAC/CD,wBAAwB,CAACC,MAAM,CAAC;AAClC;;;;;;;;;"}
1
+ {"version":3,"file":"commerce-commercetools.cjs.development.js","sources":["../src/utils/get-sort-variables.ts","../src/const.ts","../src/utils/cookies.ts","../src/utils/cart-cookie.ts","../src/utils/cart-create.ts","../src/utils/cart-active.ts","../src/utils/localized-string.ts","../src/utils/common.ts","../src/utils/normalize.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/client.ts","../src/fetcher.ts","../src/product/use-product.tsx","../src/product/use-search.tsx","../src/site/use-brands.tsx","../src/site/use-categories.tsx","../src/provider.ts","../src/commercetools.tsx","../src/registerCommerceProvider.tsx","../src/index.tsx"],"sourcesContent":["const getSortVariables = (sort?: string, isCategory: boolean = false) => {\n let output = undefined\n switch (sort) {\n case 'price-asc':\n output = 'price asc'\n break\n case 'price-desc':\n output = 'price desc'\n break\n case 'trending-desc': // default option\n output = undefined\n break\n case 'latest-desc':\n output = 'createdAt desc'\n break\n }\n return output\n}\n\nexport default getSortVariables\n","export const COMMERCETOOLS_COOKIE_EXPIRE = 30\n\nexport const COMMERCETOOLS_CART_COOKIE = 'commercetools_cart'\n\nexport const COMMERCETOOLS_CUSTOMER_COOKIE = 'commercetools_customer'\n\nexport const COMMERCETOOLS_WISHLIST_COOKIE = 'commercetools_wishlist'\n","import Cookies, { CookieAttributes } from 'js-cookie';\nimport { COMMERCETOOLS_COOKIE_EXPIRE } from '../const'\n\nconst options: CookieAttributes = {\n expires: COMMERCETOOLS_COOKIE_EXPIRE,\n sameSite: \"none\",\n secure: true\n}\n\nexport const getCookies = <T>(name: string) => {\n const cookie = Cookies.get(name);\n return cookie ? (JSON.parse(cookie) as T) : undefined\n}\n\nexport const setCookies = (name: string, value: any) => Cookies.set(name, JSON.stringify(value), options);\n\nexport const removeCookies = (name: string) => Cookies.remove(name);\n","import { COMMERCETOOLS_CART_COOKIE } from '../const'\nimport { getCookies, setCookies, removeCookies } from './cookies'\n\nexport const getCartId = () =>\n getCookies<string>(COMMERCETOOLS_CART_COOKIE)\n\nexport const setCartId = (id: string) =>\n setCookies(COMMERCETOOLS_CART_COOKIE, id)\n\nexport const removeCartCookie = () =>\n removeCookies(COMMERCETOOLS_CART_COOKIE)\n","import { Cart, CartDraft } from '@commercetools/platform-sdk'\nimport { ClientResponse } from '@commercetools/sdk-client-v2'\nimport { FetcherOptions } from '@plasmicpkgs/commerce'\nimport { removeCartCookie, setCartId } from './cart-cookie'\n\nconst createCart = async (\n fetch: <T = any, B = Body>(options: FetcherOptions<B>) => Promise<T>\n) => {\n const draft: CartDraft = {\n currency: 'USD',\n country: 'US',\n }\n\n const cart = await fetch<ClientResponse<Cart>, CartDraft>({\n query: 'carts',\n method: 'post',\n body: draft,\n })\n\n if (!cart.body) {\n removeCartCookie()\n } else {\n setCartId(cart.body.id)\n }\n return cart.body\n}\n\nexport default createCart\n","import { Cart, ClientResponse } from '@commercetools/platform-sdk'\nimport { FetcherOptions } from '@plasmicpkgs/commerce'\nimport { getCartId, removeCartCookie, setCartId } from './cart-cookie'\nimport createCart from './cart-create'\n\nconst getActiveCart = async (\n fetch: <T = any, B = Body>(options: FetcherOptions<B>) => Promise<T>\n) => {\n const cartId = getCartId()\n let activeCart\n if (cartId) {\n activeCart = (\n await fetch<ClientResponse<Cart>>({\n query: 'carts',\n method: 'get',\n variables: {\n id: cartId,\n },\n })\n ).body\n } else {\n activeCart = await createCart(fetch)\n }\n\n if (!activeCart) {\n removeCartCookie()\n } else {\n setCartId(activeCart.id)\n }\n return activeCart\n}\n\nexport default getActiveCart\n","const getLocalizedString = (\n localizedString: Record<string, string> | undefined,\n locale: string | undefined\n) =>\n !localizedString || !locale\n ? undefined\n : locale in localizedString\n ? localizedString[locale]\n : Object.values(localizedString)[0]\n\nexport default getLocalizedString\n","export const withoutNils = <T>(xs: Array<T | undefined | null>): T[] =>\n xs.filter((x): x is T => x != null)\n\nexport const dedup = <T>(xs: Array<T>): T[] => [...new Set(xs)]\n","import { Category } from '../types/site'\nimport {\n ProductProjection,\n Image,\n ProductVariant,\n Category as CommercetoolsCategory,\n Cart as CommercetoolsCart,\n LineItem as CommercetoolsLineItem,\n TypedMoney,\n Customer,\n ShoppingList,\n ProductData,\n} from '@commercetools/platform-sdk'\nimport { dedup, withoutNils } from './common'\nimport getLocalizedString from './localized-string'\nimport { Cart, LineItem } from '../types/cart'\nimport { Product, ProductOption } from '../types/product'\n\nconst currencyCode = 'USD'\n\nconst stringify = (value: any) =>\n typeof value === 'string' ? value : JSON.stringify(value)\n\nconst money = (price: TypedMoney | undefined) => {\n return price\n ? {\n value: price.centAmount / 100,\n currencyCode: price.currencyCode,\n }\n : {\n value: -1.0, // error\n currencyCode,\n }\n}\n\nconst normalizeProductOption = (option: {\n name: string\n value: string | string[]\n}): ProductOption => ({\n __typename: 'MultipleChoiceOption',\n id: option.name,\n displayName: option.name,\n values: dedup(\n Array.isArray(option.value) ? option.value : [option.value]\n ).map((val) => {\n if (\n option.name.match(/colou?r/gi) &&\n /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/i.test(val)\n ) {\n return {\n label: stringify(val),\n hexColors: [val],\n }\n } else {\n return {\n label: stringify(val),\n }\n }\n }),\n})\n\nconst normalizeProductImages = (images: Image[]) =>\n images.map((image) => ({\n url: image.url,\n ...(image.label ? { alt: image.label } : {}),\n width: image.dimensions.w,\n height: image.dimensions.h,\n }))\n\nconst normalizeProductVariant = (variant: ProductVariant) => {\n const price = money(\n variant.prices?.find((price) => price.value.currencyCode === currencyCode)\n ?.value ?? variant.prices?.[0]?.value\n ).value\n\n return {\n id: `${variant.id}`,\n name: `${variant.id}`,\n sku: variant.sku ?? '',\n price,\n options:\n variant.attributes?.map((attribute) =>\n normalizeProductOption({\n name: attribute.name,\n value: attribute.value.key,\n })\n ) ?? [],\n requiresShipping: false,\n listPrice: price,\n }\n}\n\nexport const normalizeProduct = (\n product: ProductProjection | (ProductData & { id: string }),\n locale: string,\n): Product => ({\n id: product.id,\n name: getLocalizedString(product.name, locale) ?? \"\",\n slug: getLocalizedString(product.slug, locale),\n path: `/${getLocalizedString(product.slug, locale)}`,\n description: getLocalizedString(product.description, locale) ?? '',\n price: money(\n product.masterVariant.prices?.find(\n (price) => price.value.currencyCode === currencyCode\n )?.value ?? product.masterVariant.prices?.[0]?.value\n ),\n images: normalizeProductImages(\n withoutNils([\n ...(product.masterVariant.images ? product.masterVariant.images : []),\n ...product.variants.flatMap((variant) => variant.images),\n ])\n ),\n variants: [product.masterVariant, ...product.variants].map(\n normalizeProductVariant\n ),\n options: withoutNils([\n ...(product.masterVariant.attributes\n ? product.masterVariant.attributes\n : []),\n ...product.variants.flatMap((variant) => variant.attributes),\n ])\n .reduce(\n (groupedAttributes, attribute) => {\n const groupedAttribute = groupedAttributes.find(\n (gAttr) => gAttr.name === attribute.name\n )\n if (groupedAttribute) {\n groupedAttribute.value.push(stringify(attribute.value.key))\n } else {\n groupedAttributes.push({\n name: attribute.name,\n value: [stringify(attribute.value.key)],\n })\n }\n return groupedAttributes\n },\n [] as {\n name: string\n value: string[]\n }[]\n )\n .map(normalizeProductOption),\n})\n\nconst normalizeLineItem = (\n lineItem: CommercetoolsLineItem,\n locale: string,\n): LineItem => ({\n id: lineItem.id,\n variantId: `${lineItem.variant.id}`,\n productId: lineItem.productId,\n name: getLocalizedString(lineItem.name, locale) ?? \"\",\n path: '',\n quantity: lineItem.quantity,\n discounts: [],\n variant: normalizeProductVariant(lineItem.variant),\n options:\n lineItem.variant.attributes?.map((attribute) => ({\n id: attribute.name,\n name: attribute.name,\n value: attribute.value.key,\n })) ?? [],\n})\n\nexport const normalizeCart = (\n cart: CommercetoolsCart,\n locale: string,\n): Cart => ({\n id: cart.id,\n customerId: cart.customerId,\n email: cart.customerEmail,\n createdAt: cart.createdAt,\n currency: {\n code: currencyCode,\n },\n taxesIncluded: cart.taxMode !== 'Disabled',\n lineItems: cart.lineItems.map((item) => normalizeLineItem(item, locale)),\n lineItemsSubtotalPrice: 0,\n subtotalPrice: money(cart.totalPrice).value,\n totalPrice: money(cart.totalPrice).value,\n discounts: [],\n})\n\nexport const normalizeCategory = (\n category: CommercetoolsCategory,\n locale: string,\n): Category => ({\n id: category.id,\n name: getLocalizedString(category.name, locale) ?? \"\",\n slug: getLocalizedString(category.slug, locale) ?? \"\",\n path: `/${getLocalizedString(category.slug, locale)}`,\n})\n\nexport const normalizeCustomer = (customer: Customer) => ({\n firstName: customer.firstName,\n lastName: customer.lastName,\n email: customer.email,\n})\n\nexport const normalizeWishlist = (wishlist: ShoppingList) => ({\n items:\n wishlist.lineItems?.map((item) => ({\n id: item.id,\n product_id: item.productId,\n variant_id: item.variantId!,\n })) ?? [],\n})\n","import { useMemo } from 'react'\nimport { useCart as useCommerceCart, UseCart } from '@plasmicpkgs/commerce'\nimport { SWRHook } from '@plasmicpkgs/commerce'\nimport { getActiveCart, normalizeCart } from '../utils'\nimport { GetCartHook } from '../types/cart'\n\nexport default useCommerceCart as UseCart<typeof handler>\n\nexport const handler: SWRHook<GetCartHook> = {\n fetchOptions: {\n query: \"cart\",\n method: \"get\",\n },\n async fetcher({ input, options, fetch, provider }) {\n const activeCart = await getActiveCart(fetch);\n return activeCart ? normalizeCart(activeCart, provider!.locale) : 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","import { Cart, CartUpdate, ClientResponse } from \"@commercetools/platform-sdk\";\nimport type { MutationHook } from \"@plasmicpkgs/commerce\";\nimport { useAddItem, UseAddItem } from \"@plasmicpkgs/commerce\";\nimport { useCallback } from \"react\";\nimport type { AddItemHook } from \"../types/cart\";\nimport {\n getActiveCart,\n normalizeCart,\n removeCartCookie,\n setCartId,\n} from \"../utils\";\nimport useCart from \"./use-cart\";\n\nexport default useAddItem as UseAddItem<typeof handler>;\n\nexport const handler: MutationHook<AddItemHook> = {\n fetchOptions: {\n query: \"cart\",\n method: \"post\",\n },\n async fetcher({ input: item, options, fetch, provider }) {\n const activeCart = await getActiveCart(fetch);\n if (\n (item.quantity &&\n (!Number.isInteger(item.quantity) || item.quantity! < 1)) ||\n !activeCart\n ) {\n return undefined;\n }\n const updatedCart = await fetch<ClientResponse<Cart>, CartUpdate>({\n query: \"carts\",\n method: \"post\",\n variables: {\n id: activeCart.id,\n },\n body: {\n version: activeCart.version,\n actions: [\n {\n action: \"addLineItem\",\n variantId: +item.variantId,\n productId: item.productId,\n quantity: item.quantity ?? 1,\n },\n ],\n },\n });\n if (updatedCart.body) {\n setCartId(updatedCart.body.id);\n } else {\n removeCartCookie();\n }\n return updatedCart.body\n ? normalizeCart(updatedCart.body, provider!.locale)\n : undefined;\n },\n useHook:\n ({ fetch }) =>\n () => {\n const { mutate } = useCart();\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","import {\n Cart as CommerceToolsCart,\n CartUpdate,\n ClientResponse,\n} from \"@commercetools/platform-sdk\";\nimport type {\n HookFetcherContext,\n MutationHook,\n MutationHookContext,\n} from \"@plasmicpkgs/commerce\";\nimport {\n UseRemoveItem,\n useRemoveItem,\n ValidationError,\n} from \"@plasmicpkgs/commerce\";\nimport { useCallback } from \"react\";\nimport type { Cart, LineItem, RemoveItemHook } from \"../types/cart\";\nimport {\n getActiveCart,\n normalizeCart,\n removeCartCookie,\n setCartId,\n} from \"../utils\";\nimport useCart from \"./use-cart\";\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: MutationHook<RemoveItemHook> = {\n fetchOptions: {\n query: \"cart\",\n method: \"post\",\n },\n async fetcher({\n input: { itemId },\n options,\n fetch,\n provider,\n }: HookFetcherContext<RemoveItemHook>) {\n const activeCart = await getActiveCart(fetch);\n if (!itemId || !activeCart) {\n return undefined;\n }\n const updatedCart = await fetch<\n ClientResponse<CommerceToolsCart>,\n CartUpdate\n >({\n query: \"carts\",\n method: \"post\",\n variables: {\n id: activeCart.id,\n },\n body: {\n version: activeCart.version,\n actions: [\n {\n action: \"removeLineItem\",\n lineItemId: itemId,\n },\n ],\n },\n });\n if (updatedCart.body) {\n setCartId(updatedCart.body.id);\n } else {\n removeCartCookie();\n }\n return normalizeCart(updatedCart.body, provider!.locale);\n },\n useHook:\n ({ fetch }: MutationHookContext<RemoveItemHook>) =>\n <T extends LineItem | undefined = undefined>(ctx: { item?: T } = {}) => {\n const { item } = ctx;\n const { mutate } = useCart();\n const removeItem: RemoveItemFn<LineItem> = async (input) => {\n const itemId = input?.id ?? item?.id;\n\n if (!itemId) {\n throw new ValidationError({\n message: \"Invalid input used for this operation\",\n });\n }\n\n const data = await fetch({ input: { itemId } });\n await mutate(data, false);\n return data;\n };\n\n return useCallback(removeItem as RemoveItemFn<T>, [fetch, mutate]);\n },\n};\n","import { Cart, CartUpdate, ClientResponse } from \"@commercetools/platform-sdk\";\nimport type { MutationHook, MutationHookContext } from \"@plasmicpkgs/commerce\";\nimport {\n useUpdateItem,\n UseUpdateItem,\n ValidationError,\n} from \"@plasmicpkgs/commerce\";\nimport debounce from \"debounce\";\nimport { useCallback } from \"react\";\nimport type { LineItem, UpdateItemHook } from \"../types/cart\";\nimport {\n getActiveCart,\n normalizeCart,\n removeCartCookie,\n setCartId,\n} from \"../utils\";\nimport useCart from \"./use-cart\";\nimport { handler as removeItemHandler } from \"./use-remove-item\";\n\nexport type UpdateItemActionInput<T = any> = T extends LineItem\n ? Partial<UpdateItemHook[\"actionInput\"]>\n : UpdateItemHook[\"actionInput\"];\n\nexport default useUpdateItem as UseUpdateItem<typeof handler>;\n\nexport const handler: MutationHook<UpdateItemHook> = {\n fetchOptions: {\n query: \"cart\",\n method: \"post\",\n },\n async fetcher({ input: { item, itemId }, options, fetch, provider }) {\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 provider,\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\n const activeCart = await getActiveCart(fetch);\n if (\n (item.quantity &&\n (!Number.isInteger(item.quantity) || item.quantity! < 1)) ||\n !activeCart\n ) {\n return undefined;\n }\n const updatedCart = await fetch<ClientResponse<Cart>, CartUpdate>({\n query: \"carts\",\n method: \"post\",\n variables: {\n id: activeCart.id,\n },\n body: {\n version: activeCart.version,\n actions: [\n {\n action: \"changeLineItemQuantity\",\n lineItemId: itemId,\n quantity: item.quantity ?? 1,\n },\n ],\n },\n });\n if (updatedCart.body) {\n setCartId(updatedCart.body.id);\n } else {\n removeCartCookie();\n }\n return updatedCart.body\n ? normalizeCart(updatedCart.body, provider!.locale)\n : undefined;\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 } = useCart() as any;\n\n return useCallback(\n debounce(async (input: UpdateItemActionInput<T>) => {\n const itemId = input.id ?? item?.id;\n if (!itemId || input.quantity == null) {\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","import {\n AuthMiddlewareOptions,\n ClientBuilder,\n HttpMiddlewareOptions,\n } from '@commercetools/sdk-client-v2'\nimport { CommercetoolsCredentials } from './provider'\n\nconst initCommercetoolsSDKClient = (creds: CommercetoolsCredentials) => {\n const scopes = [`manage_project:${creds.projectKey}`]\n \n // Configure authMiddlewareOptions\n const authMiddlewareOptions: AuthMiddlewareOptions = {\n host: `https://auth.${creds.region}.commercetools.com`,\n projectKey: creds.clientSecret,\n credentials: {\n clientId: creds.clientId,\n clientSecret: creds.clientSecret,\n },\n scopes,\n fetch,\n }\n \n // Configure httpMiddlewareOptions\n const httpMiddlewareOptions: HttpMiddlewareOptions = {\n host: `https://api.${creds.region}.commercetools.com`,\n fetch,\n }\n \n // Export the ClientBuilder\n return new ClientBuilder()\n .withProjectKey(creds.projectKey)\n .withClientCredentialsFlow(authMiddlewareOptions)\n .withHttpMiddleware(httpMiddlewareOptions)\n .build()\n}\n \n export default initCommercetoolsSDKClient","import { Fetcher } from '@plasmicpkgs/commerce'\nimport { CommercetoolsCredentials } from './provider'\nimport { createApiBuilderFromCtpClient } from '@commercetools/platform-sdk'\nimport initCommercetoolsSDKClient from './client'\n\nexport const getFetcher: \n (creds: CommercetoolsCredentials) => Fetcher =\n (creds) => {\n const client = initCommercetoolsSDKClient(creds);\n const apiRoot = createApiBuilderFromCtpClient(client).withProjectKey({\n projectKey: creds.projectKey!,\n })\n return async ({\n method, variables, query, body\n }) => {\n let queryBuilder: any = apiRoot;\n if (query) {\n queryBuilder = queryBuilder[query]();\n } \n if (variables?.id) {\n queryBuilder = queryBuilder.withId({ ID: variables.id });\n }\n if (variables?.search) {\n queryBuilder = queryBuilder.search();\n }\n return await queryBuilder[method!]({\n body,\n queryArgs: {\n expand: variables?.expand,\n limit: variables?.limit,\n ...(variables?.sort ? { sort: variables.sort } : {}),\n ...(variables?.search ? variables.search : {}),\n ...(variables?.filters ? { filter: variables.filters } : {}),\n ...(variables?.where ? { where: variables.where } : {})\n },\n })\n .execute()\n }\n}\n","import { SWRHook } from '@plasmicpkgs/commerce'\nimport { useProduct, UseProduct } from '@plasmicpkgs/commerce'\nimport {\n Product,\n ProductProjection,\n ClientResponse,\n} from '@commercetools/platform-sdk'\nimport { normalizeProduct } from '../utils'\nimport type { GetProductHook } from '@plasmicpkgs/commerce'\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: \"productProjections\",\n method: \"get\"\n },\n async fetcher({ input, options, fetch, provider }) {\n const { id } = input\n if (!id) {\n return null\n }\n\n const product = await fetch<ClientResponse<ProductProjection>>({\n ...options,\n variables: {\n id\n },\n });\n return product.body \n ? normalizeProduct(product.body, provider!.locale)\n : null\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 ClientResponse,\n ProductProjectionPagedQueryResponse,\n} from \"@commercetools/platform-sdk\";\nimport { useSearch } from \"@plasmicpkgs/commerce\";\nimport { getSortVariables, normalizeProduct } from \"../utils\";\n\nimport type {\n SearchProductsHook,\n SWRHook,\n UseSearch,\n} from \"@plasmicpkgs/commerce\";\n\nexport type SearchProductsInput = {\n search?: string;\n categoryId?: number;\n brandId?: number;\n sort?: string;\n locale?: string;\n count?: number;\n};\n\nconst useSearchTyped: UseSearch<typeof handler> = useSearch;\nexport default useSearchTyped;\n\nexport const handler: SWRHook<SearchProductsHook> = {\n fetchOptions: {\n method: \"get\",\n query: \"productProjections\",\n },\n async fetcher({ input, options, fetch, provider }) {\n const { search, categoryId, sort, count } = input;\n const response = await fetch<\n ClientResponse<ProductProjectionPagedQueryResponse>\n >({\n ...options,\n variables: {\n expand: [\"masterData.current\"],\n sort: getSortVariables(sort),\n limit: count,\n ...(search\n ? // eslint-disable-next-line\n { search: { [`text.${provider?.locale!}`]: search } }\n : {}),\n ...(categoryId\n ? { filters: `categories.id: subtree(\"${categoryId}\")` }\n : {}),\n },\n });\n return {\n products: response.body.results.map((product) =>\n normalizeProduct(product, provider!.locale)\n ),\n found: response.body.count > 0,\n };\n },\n useHook:\n ({ useData }) =>\n (input = {}) => {\n return useData({\n input: [\n [\"search\", input.search],\n [\"categoryId\", input.categoryId],\n [\"brandId\", input.brandId],\n [\"sort\", input.sort],\n [\"locale\", input.locale],\n [\"count\", input.count],\n ],\n swrOptions: {\n revalidateOnFocus: false,\n ...input.swrOptions,\n },\n });\n },\n};\n","import { SWRHook } from '@plasmicpkgs/commerce'\nimport { UseBrands, useBrands } from '@plasmicpkgs/commerce'\nimport { useMemo } from \"react\";\nimport { GetBrandsHook } from \"../types/site\"\n\nexport default useBrands as UseBrands<typeof handler>\n\nexport const handler: SWRHook<GetBrandsHook> = {\n fetchOptions: {\n query: \"\"\n },\n async fetcher({ input, options, fetch }) {\n return 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?.length ?? 0) <= 0\n },\n enumerable: true,\n },\n }),\n [response]\n )\n },\n}\n","import { SWRHook, UseCategories, useCategories } from \"@plasmicpkgs/commerce\";\nimport { useMemo } from \"react\";\nimport { GetCategoriesHook } from \"../types/site\";\nimport {\n ClientResponse,\n Category,\n CategoryPagedQueryResponse,\n} from '@commercetools/platform-sdk'\nimport { normalizeCategory } from \"../utils\";\n\nexport default useCategories as UseCategories<typeof handler>;\n\nexport const handler: SWRHook<GetCategoriesHook> = {\n fetchOptions: {\n query: \"categories\",\n method: \"get\",\n },\n async fetcher({ input, options, fetch, provider }) {\n const { categoryId } = input;\n if (!categoryId) {\n const categories = await fetch<ClientResponse<CategoryPagedQueryResponse>>({\n ...options\n })\n return categories.body ? categories.body.results.map((category) => normalizeCategory(category, provider!.locale)) : [];\n } else {\n const category = await fetch<ClientResponse<Category>>({\n ...options,\n variables: {\n ...(categoryId ? { id: categoryId } : { })\n }\n })\n return category.body ? [normalizeCategory(category.body, provider!.locale)] : [];\n }\n },\n useHook: ({ useData }) => (input) => {\n const response = useData({\n input: [[\"categoryId\", input?.categoryId]],\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 { Fetcher } from \"@plasmicpkgs/commerce\";\nimport { handler as useAddItem } from \"./cart/use-add-item\";\nimport { handler as useCart } from \"./cart/use-cart\";\nimport { handler as useRemoveItem } from \"./cart/use-remove-item\";\nimport { handler as useUpdateItem } from \"./cart/use-update-item\";\nimport { COMMERCETOOLS_CART_COOKIE } from \"./const\";\nimport { getFetcher } from \"./fetcher\";\nimport { handler as useProduct } from \"./product/use-product\";\nimport { handler as useSearch } from \"./product/use-search\";\nimport { handler as useBrands } from \"./site/use-brands\";\nimport { handler as useCategories } from \"./site/use-categories\";\n\nexport interface CommercetoolsCredentials {\n projectKey: string;\n clientId: string;\n clientSecret: string;\n region: string;\n}\n\nexport const getCommercetoolsProvider = (\n creds: CommercetoolsCredentials,\n locale: string\n) => ({\n locale,\n cartCookie: COMMERCETOOLS_CART_COOKIE,\n cart: { useCart, useAddItem, useRemoveItem, useUpdateItem },\n fetcher: getFetcher(creds),\n products: { useSearch, useProduct },\n site: { useCategories, useBrands },\n});\n\nexport type CommercetoolsProvider = {\n locale: string;\n cartCookie: string;\n fetcher: Fetcher;\n cart: {\n useCart: typeof useCart;\n useAddItem: typeof useAddItem;\n };\n products: {\n useSearch: typeof useSearch;\n useProduct: typeof useProduct;\n };\n site: {\n useCategories: typeof useCategories;\n useBrands: typeof useBrands;\n };\n};\n","import {\n getCommerceProvider as getCoreCommerceProvider,\n useCommerce as useCoreCommerce,\n} from '@plasmicpkgs/commerce'\nimport { getCommercetoolsProvider, CommercetoolsProvider, CommercetoolsCredentials } from './provider'\n\nexport type { CommercetoolsProvider }\n\nexport const useCommerce = () => useCoreCommerce<CommercetoolsProvider>()\n\nexport const getCommerceProvider = (creds: CommercetoolsCredentials, locale: string) => \n getCoreCommerceProvider(getCommercetoolsProvider(creds, locale))\n\n","import { ClientResponse, Project } from \"@commercetools/platform-sdk\";\nimport { GlobalContextMeta } from \"@plasmicapp/host\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport { usePlasmicQueryData } from \"@plasmicapp/query\";\nimport {\n CartActionsProvider,\n globalActionsRegistrations,\n} from \"@plasmicpkgs/commerce\";\nimport React from \"react\";\nimport { getCommerceProvider } from \"./commercetools\";\nimport { getFetcher } from \"./fetcher\";\nimport { CommercetoolsCredentials } from \"./provider\";\nimport { Registerable } from \"./registerable\";\n\ninterface CommerceProviderProps extends CommercetoolsCredentials {\n children?: React.ReactNode;\n}\n\nconst globalContextName = \"plasmic-commerce-commercetools-provider\";\n\nexport const commerceProviderMeta: GlobalContextMeta<CommerceProviderProps> = {\n name: globalContextName,\n displayName: \"Commercetools Provider\",\n props: {\n projectKey: {\n type: \"string\",\n defaultValue: \"plasmic-demo\",\n },\n clientId: {\n type: \"string\",\n defaultValue: \"B4hmK61xvz5LvdSDtsFmcflM\",\n },\n clientSecret: {\n type: \"string\",\n defaultValue: \"KhzjcjSu1Oul4aomSmOsLZOCZKbvfHqx\",\n },\n region: {\n type: \"choice\",\n options: [\n \"us-central1.gcp\",\n \"us-east-2.aws\",\n \"europe-west1.gcp\",\n \"eu-central-1.aws\",\n \"australia-southeast1.gcp\",\n ],\n defaultValue: \"us-central1.gcp\",\n },\n },\n ...{ globalActions: globalActionsRegistrations },\n importPath: \"@plasmicpkgs/commercetools\",\n importName: \"CommerceProviderComponent\",\n};\n\nexport function CommerceProviderComponent(props: CommerceProviderProps) {\n const { children, projectKey, clientId, clientSecret, region } = props;\n\n const creds = React.useMemo(\n () => ({ projectKey, clientId, clientSecret, region }),\n [projectKey, clientId, clientSecret, region]\n );\n\n const {\n data: locale,\n error,\n isLoading,\n } = usePlasmicQueryData(JSON.stringify({ creds }) + \"locale\", async () => {\n const fetcher = getFetcher(creds);\n const project: ClientResponse<Project> = await fetcher({ method: \"get\" });\n return project.body ? project.body.languages[0] : undefined;\n });\n\n const CommerceProvider = React.useMemo(\n () => getCommerceProvider(creds, locale ?? \"\"),\n [creds, locale]\n );\n\n if (isLoading) {\n return null;\n } else if (error || !locale) {\n throw new Error(error ? error.message : \"Project language not found\");\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 \"./commercetools\";\n\nexport function registerAll(loader?: Registerable) {\n registerCommerceProvider(loader);\n}\n"],"names":["getSortVariables","sort","isCategory","output","undefined","COMMERCETOOLS_COOKIE_EXPIRE","COMMERCETOOLS_CART_COOKIE","options","expires","sameSite","secure","getCookies","name","cookie","Cookies","get","JSON","parse","setCookies","value","set","stringify","removeCookies","remove","getCartId","setCartId","id","removeCartCookie","createCart","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","fetch","draft","cart","wrap","_callee$","_context","prev","next","currency","country","query","method","body","sent","abrupt","stop","_x","apply","arguments","getActiveCart","cartId","activeCart","variables","getLocalizedString","localizedString","locale","Object","values","withoutNils","xs","filter","x","dedup","concat","Set","currencyCode","money","price","centAmount","normalizeProductOption","option","__typename","displayName","Array","isArray","map","val","match","test","label","hexColors","normalizeProductImages","images","image","_extends","url","alt","width","dimensions","w","height","h","normalizeProductVariant","variant","_variant$prices$find$","_variant$prices","prices","find","_variant$prices2","sku","_variant$sku","_variant$attributes$m","_variant$attributes","attributes","attribute","key","requiresShipping","listPrice","normalizeProduct","product","_getLocalizedString","_getLocalizedString2","_product$masterVarian","_product$masterVarian2","_product$masterVarian3","slug","path","description","masterVariant","variants","flatMap","reduce","groupedAttributes","groupedAttribute","gAttr","push","normalizeLineItem","lineItem","_getLocalizedString3","_lineItem$variant$att","_lineItem$variant$att2","variantId","productId","quantity","discounts","normalizeCart","customerId","email","customerEmail","createdAt","code","taxesIncluded","taxMode","lineItems","item","lineItemsSubtotalPrice","subtotalPrice","totalPrice","normalizeCategory","category","_getLocalizedString4","_getLocalizedString5","handler","fetchOptions","fetcher","input","provider","useHook","_ref2","useData","response","swrOptions","revalidateOnFocus","useMemo","create","isEmpty","_response$data$lineIt","_response$data","data","length","enumerable","Number","isInteger","version","actions","action","_item$quantity","updatedCart","_useCart","useCart","mutate","useCallback","_addItem","_callee2","_callee2$","_context2","addItem","itemId","lineItemId","ctx","_ctx","removeItem","_ref3","_input$id","ValidationError","message","_ref$input","removeItemHandler","debounce","_ctx$wait","wait","initCommercetoolsSDKClient","creds","scopes","projectKey","authMiddlewareOptions","host","region","clientSecret","credentials","clientId","httpMiddlewareOptions","ClientBuilder","withProjectKey","withClientCredentialsFlow","withHttpMiddleware","build","getFetcher","client","apiRoot","createApiBuilderFromCtpClient","queryBuilder","withId","ID","search","queryArgs","expand","limit","filters","where","execute","categoryId","count","_search","products","results","found","brandId","_response$data$length","categories","getCommercetoolsProvider","cartCookie","useAddItem","useRemoveItem","useUpdateItem","useSearch","useProduct","site","useCategories","useBrands","useCommerce","useCoreCommerce","getCommerceProvider","getCoreCommerceProvider","globalContextName","commerceProviderMeta","props","type","defaultValue","globalActions","globalActionsRegistrations","importPath","importName","CommerceProviderComponent","children","React","_usePlasmicQueryData","usePlasmicQueryData","project","languages","error","isLoading","CommerceProvider","Error","CartActionsProvider","registerCommerceProvider","loader","customCommerceProviderMeta","doRegisterComponent","registerGlobalContext","registerAll"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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A,MAAM,GAAI,EAAE,CAAC;KAC9C,CAACmJ,KAAK,EAAEnJ,MAAM,CAAC,CAChB;EAED,IAAIwN,SAAS,EAAE;IACb,OAAO,IAAI;GACZ,MAAM,IAAID,KAAK,IAAI,CAACvN,MAAM,EAAE;IAC3B,MAAM,IAAI0N,KAAK,CAACH,KAAK,GAAGA,KAAK,CAAC3E,OAAO,GAAG,4BAA4B,CAAC;;EAGvE,OACEsE,6BAACO,gBAAgB,QACfP,6BAACS,4BAAmB;IAACpB,iBAAiB,EAAEA;KACrCU,QAAQ,CACW,CACL;AAEvB;AAEA,SAAgBW,wBAAwBA,CACtCC,MAAqB,EACrBC,0BAAqE;EAErE,IAAMC,mBAAmB,GAAiC,SAApDA,mBAAmBA;IAAA,OACvBF,MAAM,GACFA,MAAM,CAACG,qBAAqB,CAAAxO,KAAA,CAA5BqO,MAAM,EAAApO,SAA8B,CAAC,GACrCuO,qBAAqB,CAAAxO,KAAA,SAAAC,SAAQ,CAAC;;EACpCsO,mBAAmB,CACjBf,yBAAyB,EACzBc,0BAA0B,WAA1BA,0BAA0B,GAAItB,oBAAoB,CACnD;AACH;;SCjGgByB,WAAWA,CAACJ,MAAqB;EAC/CD,wBAAwB,CAACC,MAAM,CAAC;AAClC;;;;;;;;;"}
@@ -403,7 +403,7 @@ var removeCartCookie = function removeCartCookie() {
403
403
  };
404
404
 
405
405
  var createCart = /*#__PURE__*/function () {
406
- var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(fetch) {
406
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(fetch) {
407
407
  var draft, cart;
408
408
  return _regeneratorRuntime().wrap(function _callee$(_context) {
409
409
  while (1) switch (_context.prev = _context.next) {
@@ -438,7 +438,7 @@ var createCart = /*#__PURE__*/function () {
438
438
  }();
439
439
 
440
440
  var getActiveCart = /*#__PURE__*/function () {
441
- var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(fetch) {
441
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(fetch) {
442
442
  var cartId, activeCart;
443
443
  return _regeneratorRuntime().wrap(function _callee$(_context) {
444
444
  while (1) switch (_context.prev = _context.next) {
@@ -648,7 +648,7 @@ var handler = {
648
648
  method: "get"
649
649
  },
650
650
  fetcher: function fetcher(_ref) {
651
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
651
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
652
652
  var fetch, provider, activeCart;
653
653
  return _regeneratorRuntime().wrap(function _callee$(_context) {
654
654
  while (1) switch (_context.prev = _context.next) {
@@ -695,7 +695,7 @@ var handler$1 = {
695
695
  method: "post"
696
696
  },
697
697
  fetcher: function fetcher(_ref) {
698
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
698
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
699
699
  var _item$quantity;
700
700
  var item, fetch, provider, activeCart, updatedCart;
701
701
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -749,8 +749,8 @@ var handler$1 = {
749
749
  return function () {
750
750
  var _useCart = useCart(),
751
751
  mutate = _useCart.mutate;
752
- return useCallback( /*#__PURE__*/function () {
753
- var _addItem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
752
+ return useCallback(/*#__PURE__*/function () {
753
+ var _addItem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
754
754
  var data;
755
755
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
756
756
  while (1) switch (_context2.prev = _context2.next) {
@@ -786,7 +786,7 @@ var handler$2 = {
786
786
  method: "post"
787
787
  },
788
788
  fetcher: function fetcher(_ref) {
789
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
789
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
790
790
  var itemId, fetch, provider, activeCart, updatedCart;
791
791
  return _regeneratorRuntime().wrap(function _callee$(_context) {
792
792
  while (1) switch (_context.prev = _context.next) {
@@ -843,7 +843,7 @@ var handler$2 = {
843
843
  var _useCart = useCart(),
844
844
  mutate = _useCart.mutate;
845
845
  var removeItem = /*#__PURE__*/function () {
846
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
846
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
847
847
  var _input$id;
848
848
  var itemId, data;
849
849
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -891,7 +891,7 @@ var handler$3 = {
891
891
  method: "post"
892
892
  },
893
893
  fetcher: function fetcher(_ref) {
894
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
894
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
895
895
  var _item$quantity;
896
896
  var _ref$input, item, itemId, fetch, provider, activeCart, updatedCart;
897
897
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -978,8 +978,8 @@ var handler$3 = {
978
978
  item = _ctx.item;
979
979
  var _useCart = useCart(),
980
980
  mutate = _useCart.mutate;
981
- return useCallback(debounce( /*#__PURE__*/function () {
982
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
981
+ return 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) {
@@ -1051,7 +1051,7 @@ var getFetcher = function getFetcher(creds) {
1051
1051
  projectKey: creds.projectKey
1052
1052
  });
1053
1053
  return /*#__PURE__*/function () {
1054
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
1054
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
1055
1055
  var method, variables, query, body, queryBuilder;
1056
1056
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1057
1057
  while (1) switch (_context.prev = _context.next) {
@@ -1103,7 +1103,7 @@ var handler$4 = {
1103
1103
  method: "get"
1104
1104
  },
1105
1105
  fetcher: function fetcher(_ref) {
1106
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1106
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1107
1107
  var input, options, fetch, provider, id, product;
1108
1108
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1109
1109
  while (1) switch (_context.prev = _context.next) {
@@ -1154,7 +1154,7 @@ var handler$5 = {
1154
1154
  query: "productProjections"
1155
1155
  },
1156
1156
  fetcher: function fetcher(_ref) {
1157
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1157
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1158
1158
  var _search;
1159
1159
  var input, options, fetch, provider, search, categoryId, sort, count, response;
1160
1160
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -1212,7 +1212,7 @@ var handler$6 = {
1212
1212
  query: ""
1213
1213
  },
1214
1214
  fetcher: function fetcher(_ref) {
1215
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1215
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1216
1216
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1217
1217
  while (1) switch (_context.prev = _context.next) {
1218
1218
  case 0:
@@ -1253,7 +1253,7 @@ var handler$7 = {
1253
1253
  method: "get"
1254
1254
  },
1255
1255
  fetcher: function fetcher(_ref) {
1256
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1256
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1257
1257
  var input, options, fetch, provider, categoryId, categories, category;
1258
1258
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1259
1259
  while (1) switch (_context.prev = _context.next) {
@@ -1386,7 +1386,7 @@ function CommerceProviderComponent(props) {
1386
1386
  }, [projectKey, clientId, clientSecret, region]);
1387
1387
  var _usePlasmicQueryData = usePlasmicQueryData(JSON.stringify({
1388
1388
  creds: creds
1389
- }) + "locale", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1389
+ }) + "locale", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1390
1390
  var fetcher, project;
1391
1391
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1392
1392
  while (1) switch (_context.prev = _context.next) {
@@ -1 +1 @@
1
- {"version":3,"file":"commerce-commercetools.esm.js","sources":["../src/utils/get-sort-variables.ts","../src/const.ts","../src/utils/cookies.ts","../src/utils/cart-cookie.ts","../src/utils/cart-create.ts","../src/utils/cart-active.ts","../src/utils/localized-string.ts","../src/utils/common.ts","../src/utils/normalize.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/client.ts","../src/fetcher.ts","../src/product/use-product.tsx","../src/product/use-search.tsx","../src/site/use-brands.tsx","../src/site/use-categories.tsx","../src/provider.ts","../src/commercetools.tsx","../src/registerCommerceProvider.tsx","../src/index.tsx"],"sourcesContent":["const getSortVariables = (sort?: string, isCategory: boolean = false) => {\n let output = undefined\n switch (sort) {\n case 'price-asc':\n output = 'price asc'\n break\n case 'price-desc':\n output = 'price desc'\n break\n case 'trending-desc': // default option\n output = undefined\n break\n case 'latest-desc':\n output = 'createdAt desc'\n break\n }\n return output\n}\n\nexport default getSortVariables\n","export const COMMERCETOOLS_COOKIE_EXPIRE = 30\n\nexport const COMMERCETOOLS_CART_COOKIE = 'commercetools_cart'\n\nexport const COMMERCETOOLS_CUSTOMER_COOKIE = 'commercetools_customer'\n\nexport const COMMERCETOOLS_WISHLIST_COOKIE = 'commercetools_wishlist'\n","import Cookies, { CookieAttributes } from 'js-cookie';\nimport { COMMERCETOOLS_COOKIE_EXPIRE } from '../const'\n\nconst options: CookieAttributes = {\n expires: COMMERCETOOLS_COOKIE_EXPIRE,\n sameSite: \"none\",\n secure: true\n}\n\nexport const getCookies = <T>(name: string) => {\n const cookie = Cookies.get(name);\n return cookie ? (JSON.parse(cookie) as T) : undefined\n}\n\nexport const setCookies = (name: string, value: any) => Cookies.set(name, JSON.stringify(value), options);\n\nexport const removeCookies = (name: string) => Cookies.remove(name);\n","import { COMMERCETOOLS_CART_COOKIE } from '../const'\nimport { getCookies, setCookies, removeCookies } from './cookies'\n\nexport const getCartId = () =>\n getCookies<string>(COMMERCETOOLS_CART_COOKIE)\n\nexport const setCartId = (id: string) =>\n setCookies(COMMERCETOOLS_CART_COOKIE, id)\n\nexport const removeCartCookie = () =>\n removeCookies(COMMERCETOOLS_CART_COOKIE)\n","import { Cart, CartDraft } from '@commercetools/platform-sdk'\nimport { ClientResponse } from '@commercetools/sdk-client-v2'\nimport { FetcherOptions } from '@plasmicpkgs/commerce'\nimport { removeCartCookie, setCartId } from './cart-cookie'\n\nconst createCart = async (\n fetch: <T = any, B = Body>(options: FetcherOptions<B>) => Promise<T>\n) => {\n const draft: CartDraft = {\n currency: 'USD',\n country: 'US',\n }\n\n const cart = await fetch<ClientResponse<Cart>, CartDraft>({\n query: 'carts',\n method: 'post',\n body: draft,\n })\n\n if (!cart.body) {\n removeCartCookie()\n } else {\n setCartId(cart.body.id)\n }\n return cart.body\n}\n\nexport default createCart\n","import { Cart, ClientResponse } from '@commercetools/platform-sdk'\nimport { FetcherOptions } from '@plasmicpkgs/commerce'\nimport { getCartId, removeCartCookie, setCartId } from './cart-cookie'\nimport createCart from './cart-create'\n\nconst getActiveCart = async (\n fetch: <T = any, B = Body>(options: FetcherOptions<B>) => Promise<T>\n) => {\n const cartId = getCartId()\n let activeCart\n if (cartId) {\n activeCart = (\n await fetch<ClientResponse<Cart>>({\n query: 'carts',\n method: 'get',\n variables: {\n id: cartId,\n },\n })\n ).body\n } else {\n activeCart = await createCart(fetch)\n }\n\n if (!activeCart) {\n removeCartCookie()\n } else {\n setCartId(activeCart.id)\n }\n return activeCart\n}\n\nexport default getActiveCart\n","const getLocalizedString = (\n localizedString: Record<string, string> | undefined,\n locale: string | undefined\n) =>\n !localizedString || !locale\n ? undefined\n : locale in localizedString\n ? localizedString[locale]\n : Object.values(localizedString)[0]\n\nexport default getLocalizedString\n","export const withoutNils = <T>(xs: Array<T | undefined | null>): T[] =>\n xs.filter((x): x is T => x != null)\n\nexport const dedup = <T>(xs: Array<T>): T[] => [...new Set(xs)]\n","import { Category } from '../types/site'\nimport {\n ProductProjection,\n Image,\n ProductVariant,\n Category as CommercetoolsCategory,\n Cart as CommercetoolsCart,\n LineItem as CommercetoolsLineItem,\n TypedMoney,\n Customer,\n ShoppingList,\n ProductData,\n} from '@commercetools/platform-sdk'\nimport { dedup, withoutNils } from './common'\nimport getLocalizedString from './localized-string'\nimport { Cart, LineItem } from '../types/cart'\nimport { Product, ProductOption } from '../types/product'\n\nconst currencyCode = 'USD'\n\nconst stringify = (value: any) =>\n typeof value === 'string' ? value : JSON.stringify(value)\n\nconst money = (price: TypedMoney | undefined) => {\n return price\n ? {\n value: price.centAmount / 100,\n currencyCode: price.currencyCode,\n }\n : {\n value: -1.0, // error\n currencyCode,\n }\n}\n\nconst normalizeProductOption = (option: {\n name: string\n value: string | string[]\n}): ProductOption => ({\n __typename: 'MultipleChoiceOption',\n id: option.name,\n displayName: option.name,\n values: dedup(\n Array.isArray(option.value) ? option.value : [option.value]\n ).map((val) => {\n if (\n option.name.match(/colou?r/gi) &&\n /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/i.test(val)\n ) {\n return {\n label: stringify(val),\n hexColors: [val],\n }\n } else {\n return {\n label: stringify(val),\n }\n }\n }),\n})\n\nconst normalizeProductImages = (images: Image[]) =>\n images.map((image) => ({\n url: image.url,\n ...(image.label ? { alt: image.label } : {}),\n width: image.dimensions.w,\n height: image.dimensions.h,\n }))\n\nconst normalizeProductVariant = (variant: ProductVariant) => {\n const price = money(\n variant.prices?.find((price) => price.value.currencyCode === currencyCode)\n ?.value ?? variant.prices?.[0]?.value\n ).value\n\n return {\n id: `${variant.id}`,\n name: `${variant.id}`,\n sku: variant.sku ?? '',\n price,\n options:\n variant.attributes?.map((attribute) =>\n normalizeProductOption({\n name: attribute.name,\n value: attribute.value.key,\n })\n ) ?? [],\n requiresShipping: false,\n listPrice: price,\n }\n}\n\nexport const normalizeProduct = (\n product: ProductProjection | (ProductData & { id: string }),\n locale: string,\n): Product => ({\n id: product.id,\n name: getLocalizedString(product.name, locale) ?? \"\",\n slug: getLocalizedString(product.slug, locale),\n path: `/${getLocalizedString(product.slug, locale)}`,\n description: getLocalizedString(product.description, locale) ?? '',\n price: money(\n product.masterVariant.prices?.find(\n (price) => price.value.currencyCode === currencyCode\n )?.value ?? product.masterVariant.prices?.[0]?.value\n ),\n images: normalizeProductImages(\n withoutNils([\n ...(product.masterVariant.images ? product.masterVariant.images : []),\n ...product.variants.flatMap((variant) => variant.images),\n ])\n ),\n variants: [product.masterVariant, ...product.variants].map(\n normalizeProductVariant\n ),\n options: withoutNils([\n ...(product.masterVariant.attributes\n ? product.masterVariant.attributes\n : []),\n ...product.variants.flatMap((variant) => variant.attributes),\n ])\n .reduce(\n (groupedAttributes, attribute) => {\n const groupedAttribute = groupedAttributes.find(\n (gAttr) => gAttr.name === attribute.name\n )\n if (groupedAttribute) {\n groupedAttribute.value.push(stringify(attribute.value.key))\n } else {\n groupedAttributes.push({\n name: attribute.name,\n value: [stringify(attribute.value.key)],\n })\n }\n return groupedAttributes\n },\n [] as {\n name: string\n value: string[]\n }[]\n )\n .map(normalizeProductOption),\n})\n\nconst normalizeLineItem = (\n lineItem: CommercetoolsLineItem,\n locale: string,\n): LineItem => ({\n id: lineItem.id,\n variantId: `${lineItem.variant.id}`,\n productId: lineItem.productId,\n name: getLocalizedString(lineItem.name, locale) ?? \"\",\n path: '',\n quantity: lineItem.quantity,\n discounts: [],\n variant: normalizeProductVariant(lineItem.variant),\n options:\n lineItem.variant.attributes?.map((attribute) => ({\n id: attribute.name,\n name: attribute.name,\n value: attribute.value.key,\n })) ?? [],\n})\n\nexport const normalizeCart = (\n cart: CommercetoolsCart,\n locale: string,\n): Cart => ({\n id: cart.id,\n customerId: cart.customerId,\n email: cart.customerEmail,\n createdAt: cart.createdAt,\n currency: {\n code: currencyCode,\n },\n taxesIncluded: cart.taxMode !== 'Disabled',\n lineItems: cart.lineItems.map((item) => normalizeLineItem(item, locale)),\n lineItemsSubtotalPrice: 0,\n subtotalPrice: money(cart.totalPrice).value,\n totalPrice: money(cart.totalPrice).value,\n discounts: [],\n})\n\nexport const normalizeCategory = (\n category: CommercetoolsCategory,\n locale: string,\n): Category => ({\n id: category.id,\n name: getLocalizedString(category.name, locale) ?? \"\",\n slug: getLocalizedString(category.slug, locale) ?? \"\",\n path: `/${getLocalizedString(category.slug, locale)}`,\n})\n\nexport const normalizeCustomer = (customer: Customer) => ({\n firstName: customer.firstName,\n lastName: customer.lastName,\n email: customer.email,\n})\n\nexport const normalizeWishlist = (wishlist: ShoppingList) => ({\n items:\n wishlist.lineItems?.map((item) => ({\n id: item.id,\n product_id: item.productId,\n variant_id: item.variantId!,\n })) ?? [],\n})\n","import { useMemo } from 'react'\nimport { useCart as useCommerceCart, UseCart } from '@plasmicpkgs/commerce'\nimport { SWRHook } from '@plasmicpkgs/commerce'\nimport { getActiveCart, normalizeCart } from '../utils'\nimport { GetCartHook } from '../types/cart'\n\nexport default useCommerceCart as UseCart<typeof handler>\n\nexport const handler: SWRHook<GetCartHook> = {\n fetchOptions: {\n query: \"cart\",\n method: \"get\",\n },\n async fetcher({ input, options, fetch, provider }) {\n const activeCart = await getActiveCart(fetch);\n return activeCart ? normalizeCart(activeCart, provider!.locale) : 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","import { Cart, CartUpdate, ClientResponse } from \"@commercetools/platform-sdk\";\nimport type { MutationHook } from \"@plasmicpkgs/commerce\";\nimport { useAddItem, UseAddItem } from \"@plasmicpkgs/commerce\";\nimport { useCallback } from \"react\";\nimport type { AddItemHook } from \"../types/cart\";\nimport {\n getActiveCart,\n normalizeCart,\n removeCartCookie,\n setCartId,\n} from \"../utils\";\nimport useCart from \"./use-cart\";\n\nexport default useAddItem as UseAddItem<typeof handler>;\n\nexport const handler: MutationHook<AddItemHook> = {\n fetchOptions: {\n query: \"cart\",\n method: \"post\",\n },\n async fetcher({ input: item, options, fetch, provider }) {\n const activeCart = await getActiveCart(fetch);\n if (\n (item.quantity &&\n (!Number.isInteger(item.quantity) || item.quantity! < 1)) ||\n !activeCart\n ) {\n return undefined;\n }\n const updatedCart = await fetch<ClientResponse<Cart>, CartUpdate>({\n query: \"carts\",\n method: \"post\",\n variables: {\n id: activeCart.id,\n },\n body: {\n version: activeCart.version,\n actions: [\n {\n action: \"addLineItem\",\n variantId: +item.variantId,\n productId: item.productId,\n quantity: item.quantity ?? 1,\n },\n ],\n },\n });\n if (updatedCart.body) {\n setCartId(updatedCart.body.id);\n } else {\n removeCartCookie();\n }\n return updatedCart.body\n ? normalizeCart(updatedCart.body, provider!.locale)\n : undefined;\n },\n useHook:\n ({ fetch }) =>\n () => {\n const { mutate } = useCart();\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","import {\n Cart as CommerceToolsCart,\n CartUpdate,\n ClientResponse,\n} from \"@commercetools/platform-sdk\";\nimport type {\n HookFetcherContext,\n MutationHook,\n MutationHookContext,\n} from \"@plasmicpkgs/commerce\";\nimport {\n UseRemoveItem,\n useRemoveItem,\n ValidationError,\n} from \"@plasmicpkgs/commerce\";\nimport { useCallback } from \"react\";\nimport type { Cart, LineItem, RemoveItemHook } from \"../types/cart\";\nimport {\n getActiveCart,\n normalizeCart,\n removeCartCookie,\n setCartId,\n} from \"../utils\";\nimport useCart from \"./use-cart\";\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: MutationHook<RemoveItemHook> = {\n fetchOptions: {\n query: \"cart\",\n method: \"post\",\n },\n async fetcher({\n input: { itemId },\n options,\n fetch,\n provider,\n }: HookFetcherContext<RemoveItemHook>) {\n const activeCart = await getActiveCart(fetch);\n if (!itemId || !activeCart) {\n return undefined;\n }\n const updatedCart = await fetch<\n ClientResponse<CommerceToolsCart>,\n CartUpdate\n >({\n query: \"carts\",\n method: \"post\",\n variables: {\n id: activeCart.id,\n },\n body: {\n version: activeCart.version,\n actions: [\n {\n action: \"removeLineItem\",\n lineItemId: itemId,\n },\n ],\n },\n });\n if (updatedCart.body) {\n setCartId(updatedCart.body.id);\n } else {\n removeCartCookie();\n }\n return normalizeCart(updatedCart.body, provider!.locale);\n },\n useHook:\n ({ fetch }: MutationHookContext<RemoveItemHook>) =>\n <T extends LineItem | undefined = undefined>(ctx: { item?: T } = {}) => {\n const { item } = ctx;\n const { mutate } = useCart();\n const removeItem: RemoveItemFn<LineItem> = async (input) => {\n const itemId = input?.id ?? item?.id;\n\n if (!itemId) {\n throw new ValidationError({\n message: \"Invalid input used for this operation\",\n });\n }\n\n const data = await fetch({ input: { itemId } });\n await mutate(data, false);\n return data;\n };\n\n return useCallback(removeItem as RemoveItemFn<T>, [fetch, mutate]);\n },\n};\n","import { Cart, CartUpdate, ClientResponse } from \"@commercetools/platform-sdk\";\nimport type { MutationHook, MutationHookContext } from \"@plasmicpkgs/commerce\";\nimport {\n useUpdateItem,\n UseUpdateItem,\n ValidationError,\n} from \"@plasmicpkgs/commerce\";\nimport debounce from \"debounce\";\nimport { useCallback } from \"react\";\nimport type { LineItem, UpdateItemHook } from \"../types/cart\";\nimport {\n getActiveCart,\n normalizeCart,\n removeCartCookie,\n setCartId,\n} from \"../utils\";\nimport useCart from \"./use-cart\";\nimport { handler as removeItemHandler } from \"./use-remove-item\";\n\nexport type UpdateItemActionInput<T = any> = T extends LineItem\n ? Partial<UpdateItemHook[\"actionInput\"]>\n : UpdateItemHook[\"actionInput\"];\n\nexport default useUpdateItem as UseUpdateItem<typeof handler>;\n\nexport const handler: MutationHook<UpdateItemHook> = {\n fetchOptions: {\n query: \"cart\",\n method: \"post\",\n },\n async fetcher({ input: { item, itemId }, options, fetch, provider }) {\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 provider,\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\n const activeCart = await getActiveCart(fetch);\n if (\n (item.quantity &&\n (!Number.isInteger(item.quantity) || item.quantity! < 1)) ||\n !activeCart\n ) {\n return undefined;\n }\n const updatedCart = await fetch<ClientResponse<Cart>, CartUpdate>({\n query: \"carts\",\n method: \"post\",\n variables: {\n id: activeCart.id,\n },\n body: {\n version: activeCart.version,\n actions: [\n {\n action: \"changeLineItemQuantity\",\n lineItemId: itemId,\n quantity: item.quantity ?? 1,\n },\n ],\n },\n });\n if (updatedCart.body) {\n setCartId(updatedCart.body.id);\n } else {\n removeCartCookie();\n }\n return updatedCart.body\n ? normalizeCart(updatedCart.body, provider!.locale)\n : undefined;\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 } = useCart() as any;\n\n return useCallback(\n debounce(async (input: UpdateItemActionInput<T>) => {\n const itemId = input.id ?? item?.id;\n if (!itemId || input.quantity == null) {\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","import {\n AuthMiddlewareOptions,\n ClientBuilder,\n HttpMiddlewareOptions,\n } from '@commercetools/sdk-client-v2'\nimport { CommercetoolsCredentials } from './provider'\n\nconst initCommercetoolsSDKClient = (creds: CommercetoolsCredentials) => {\n const scopes = [`manage_project:${creds.projectKey}`]\n \n // Configure authMiddlewareOptions\n const authMiddlewareOptions: AuthMiddlewareOptions = {\n host: `https://auth.${creds.region}.commercetools.com`,\n projectKey: creds.clientSecret,\n credentials: {\n clientId: creds.clientId,\n clientSecret: creds.clientSecret,\n },\n scopes,\n fetch,\n }\n \n // Configure httpMiddlewareOptions\n const httpMiddlewareOptions: HttpMiddlewareOptions = {\n host: `https://api.${creds.region}.commercetools.com`,\n fetch,\n }\n \n // Export the ClientBuilder\n return new ClientBuilder()\n .withProjectKey(creds.projectKey)\n .withClientCredentialsFlow(authMiddlewareOptions)\n .withHttpMiddleware(httpMiddlewareOptions)\n .build()\n}\n \n export default initCommercetoolsSDKClient","import { Fetcher } from '@plasmicpkgs/commerce'\nimport { CommercetoolsCredentials } from './provider'\nimport { createApiBuilderFromCtpClient } from '@commercetools/platform-sdk'\nimport initCommercetoolsSDKClient from './client'\n\nexport const getFetcher: \n (creds: CommercetoolsCredentials) => Fetcher =\n (creds) => {\n const client = initCommercetoolsSDKClient(creds);\n const apiRoot = createApiBuilderFromCtpClient(client).withProjectKey({\n projectKey: creds.projectKey!,\n })\n return async ({\n method, variables, query, body\n }) => {\n let queryBuilder: any = apiRoot;\n if (query) {\n queryBuilder = queryBuilder[query]();\n } \n if (variables?.id) {\n queryBuilder = queryBuilder.withId({ ID: variables.id });\n }\n if (variables?.search) {\n queryBuilder = queryBuilder.search();\n }\n return await queryBuilder[method!]({\n body,\n queryArgs: {\n expand: variables?.expand,\n limit: variables?.limit,\n ...(variables?.sort ? { sort: variables.sort } : {}),\n ...(variables?.search ? variables.search : {}),\n ...(variables?.filters ? { filter: variables.filters } : {}),\n ...(variables?.where ? { where: variables.where } : {})\n },\n })\n .execute()\n }\n}\n","import { SWRHook } from '@plasmicpkgs/commerce'\nimport { useProduct, UseProduct } from '@plasmicpkgs/commerce'\nimport {\n Product,\n ProductProjection,\n ClientResponse,\n} from '@commercetools/platform-sdk'\nimport { normalizeProduct } from '../utils'\nimport type { GetProductHook } from '@plasmicpkgs/commerce'\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: \"productProjections\",\n method: \"get\"\n },\n async fetcher({ input, options, fetch, provider }) {\n const { id } = input\n if (!id) {\n return null\n }\n\n const product = await fetch<ClientResponse<ProductProjection>>({\n ...options,\n variables: {\n id\n },\n });\n return product.body \n ? normalizeProduct(product.body, provider!.locale)\n : null\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 ClientResponse,\n ProductProjectionPagedQueryResponse,\n} from \"@commercetools/platform-sdk\";\nimport { useSearch } from \"@plasmicpkgs/commerce\";\nimport { getSortVariables, normalizeProduct } from \"../utils\";\n\nimport type {\n SearchProductsHook,\n SWRHook,\n UseSearch,\n} from \"@plasmicpkgs/commerce\";\n\nexport type SearchProductsInput = {\n search?: string;\n categoryId?: number;\n brandId?: number;\n sort?: string;\n locale?: string;\n count?: number;\n};\n\nconst useSearchTyped: UseSearch<typeof handler> = useSearch;\nexport default useSearchTyped;\n\nexport const handler: SWRHook<SearchProductsHook> = {\n fetchOptions: {\n method: \"get\",\n query: \"productProjections\",\n },\n async fetcher({ input, options, fetch, provider }) {\n const { search, categoryId, sort, count } = input;\n const response = await fetch<\n ClientResponse<ProductProjectionPagedQueryResponse>\n >({\n ...options,\n variables: {\n expand: [\"masterData.current\"],\n sort: getSortVariables(sort),\n limit: count,\n ...(search\n ? // eslint-disable-next-line\n { search: { [`text.${provider?.locale!}`]: search } }\n : {}),\n ...(categoryId\n ? { filters: `categories.id: subtree(\"${categoryId}\")` }\n : {}),\n },\n });\n return {\n products: response.body.results.map((product) =>\n normalizeProduct(product, provider!.locale)\n ),\n found: response.body.count > 0,\n };\n },\n useHook:\n ({ useData }) =>\n (input = {}) => {\n return useData({\n input: [\n [\"search\", input.search],\n [\"categoryId\", input.categoryId],\n [\"brandId\", input.brandId],\n [\"sort\", input.sort],\n [\"locale\", input.locale],\n [\"count\", input.count],\n ],\n swrOptions: {\n revalidateOnFocus: false,\n ...input.swrOptions,\n },\n });\n },\n};\n","import { SWRHook } from '@plasmicpkgs/commerce'\nimport { UseBrands, useBrands } from '@plasmicpkgs/commerce'\nimport { useMemo } from \"react\";\nimport { GetBrandsHook } from \"../types/site\"\n\nexport default useBrands as UseBrands<typeof handler>\n\nexport const handler: SWRHook<GetBrandsHook> = {\n fetchOptions: {\n query: \"\"\n },\n async fetcher({ input, options, fetch }) {\n return 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?.length ?? 0) <= 0\n },\n enumerable: true,\n },\n }),\n [response]\n )\n },\n}\n","import { SWRHook, UseCategories, useCategories } from \"@plasmicpkgs/commerce\";\nimport { useMemo } from \"react\";\nimport { GetCategoriesHook } from \"../types/site\";\nimport {\n ClientResponse,\n Category,\n CategoryPagedQueryResponse,\n} from '@commercetools/platform-sdk'\nimport { normalizeCategory } from \"../utils\";\n\nexport default useCategories as UseCategories<typeof handler>;\n\nexport const handler: SWRHook<GetCategoriesHook> = {\n fetchOptions: {\n query: \"categories\",\n method: \"get\",\n },\n async fetcher({ input, options, fetch, provider }) {\n const { categoryId } = input;\n if (!categoryId) {\n const categories = await fetch<ClientResponse<CategoryPagedQueryResponse>>({\n ...options\n })\n return categories.body ? categories.body.results.map((category) => normalizeCategory(category, provider!.locale)) : [];\n } else {\n const category = await fetch<ClientResponse<Category>>({\n ...options,\n variables: {\n ...(categoryId ? { id: categoryId } : { })\n }\n })\n return category.body ? [normalizeCategory(category.body, provider!.locale)] : [];\n }\n },\n useHook: ({ useData }) => (input) => {\n const response = useData({\n input: [[\"categoryId\", input?.categoryId]],\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 { Fetcher } from \"@plasmicpkgs/commerce\";\nimport { handler as useAddItem } from \"./cart/use-add-item\";\nimport { handler as useCart } from \"./cart/use-cart\";\nimport { handler as useRemoveItem } from \"./cart/use-remove-item\";\nimport { handler as useUpdateItem } from \"./cart/use-update-item\";\nimport { COMMERCETOOLS_CART_COOKIE } from \"./const\";\nimport { getFetcher } from \"./fetcher\";\nimport { handler as useProduct } from \"./product/use-product\";\nimport { handler as useSearch } from \"./product/use-search\";\nimport { handler as useBrands } from \"./site/use-brands\";\nimport { handler as useCategories } from \"./site/use-categories\";\n\nexport interface CommercetoolsCredentials {\n projectKey: string;\n clientId: string;\n clientSecret: string;\n region: string;\n}\n\nexport const getCommercetoolsProvider = (\n creds: CommercetoolsCredentials,\n locale: string\n) => ({\n locale,\n cartCookie: COMMERCETOOLS_CART_COOKIE,\n cart: { useCart, useAddItem, useRemoveItem, useUpdateItem },\n fetcher: getFetcher(creds),\n products: { useSearch, useProduct },\n site: { useCategories, useBrands },\n});\n\nexport type CommercetoolsProvider = {\n locale: string;\n cartCookie: string;\n fetcher: Fetcher;\n cart: {\n useCart: typeof useCart;\n useAddItem: typeof useAddItem;\n };\n products: {\n useSearch: typeof useSearch;\n useProduct: typeof useProduct;\n };\n site: {\n useCategories: typeof useCategories;\n useBrands: typeof useBrands;\n };\n};\n","import {\n getCommerceProvider as getCoreCommerceProvider,\n useCommerce as useCoreCommerce,\n} from '@plasmicpkgs/commerce'\nimport { getCommercetoolsProvider, CommercetoolsProvider, CommercetoolsCredentials } from './provider'\n\nexport type { CommercetoolsProvider }\n\nexport const useCommerce = () => useCoreCommerce<CommercetoolsProvider>()\n\nexport const getCommerceProvider = (creds: CommercetoolsCredentials, locale: string) => \n getCoreCommerceProvider(getCommercetoolsProvider(creds, locale))\n\n","import { ClientResponse, Project } from \"@commercetools/platform-sdk\";\nimport { GlobalContextMeta } from \"@plasmicapp/host\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport { usePlasmicQueryData } from \"@plasmicapp/query\";\nimport {\n CartActionsProvider,\n globalActionsRegistrations,\n} from \"@plasmicpkgs/commerce\";\nimport React from \"react\";\nimport { getCommerceProvider } from \"./commercetools\";\nimport { getFetcher } from \"./fetcher\";\nimport { CommercetoolsCredentials } from \"./provider\";\nimport { Registerable } from \"./registerable\";\n\ninterface CommerceProviderProps extends CommercetoolsCredentials {\n children?: React.ReactNode;\n}\n\nconst globalContextName = \"plasmic-commerce-commercetools-provider\";\n\nexport const commerceProviderMeta: GlobalContextMeta<CommerceProviderProps> = {\n name: globalContextName,\n displayName: \"Commercetools Provider\",\n props: {\n projectKey: {\n type: \"string\",\n defaultValue: \"plasmic-demo\",\n },\n clientId: {\n type: \"string\",\n defaultValue: \"B4hmK61xvz5LvdSDtsFmcflM\",\n },\n clientSecret: {\n type: \"string\",\n defaultValue: \"KhzjcjSu1Oul4aomSmOsLZOCZKbvfHqx\",\n },\n region: {\n type: \"choice\",\n options: [\n \"us-central1.gcp\",\n \"us-east-2.aws\",\n \"europe-west1.gcp\",\n \"eu-central-1.aws\",\n \"australia-southeast1.gcp\",\n ],\n defaultValue: \"us-central1.gcp\",\n },\n },\n ...{ globalActions: globalActionsRegistrations },\n importPath: \"@plasmicpkgs/commercetools\",\n importName: \"CommerceProviderComponent\",\n};\n\nexport function CommerceProviderComponent(props: CommerceProviderProps) {\n const { children, projectKey, clientId, clientSecret, region } = props;\n\n const creds = React.useMemo(\n () => ({ projectKey, clientId, clientSecret, region }),\n [projectKey, clientId, clientSecret, region]\n );\n\n const {\n data: locale,\n error,\n isLoading,\n } = usePlasmicQueryData(JSON.stringify({ creds }) + \"locale\", async () => {\n const fetcher = getFetcher(creds);\n const project: ClientResponse<Project> = await fetcher({ method: \"get\" });\n return project.body ? project.body.languages[0] : undefined;\n });\n\n const CommerceProvider = React.useMemo(\n () => getCommerceProvider(creds, locale ?? \"\"),\n [creds, locale]\n );\n\n if (isLoading) {\n return null;\n } else if (error || !locale) {\n throw new Error(error ? error.message : \"Project language not found\");\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 \"./commercetools\";\n\nexport function registerAll(loader?: Registerable) {\n registerCommerceProvider(loader);\n}\n"],"names":["getSortVariables","sort","isCategory","output","undefined","COMMERCETOOLS_COOKIE_EXPIRE","COMMERCETOOLS_CART_COOKIE","options","expires","sameSite","secure","getCookies","name","cookie","Cookies","get","JSON","parse","setCookies","value","set","stringify","removeCookies","remove","getCartId","setCartId","id","removeCartCookie","createCart","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","fetch","draft","cart","wrap","_callee$","_context","prev","next","currency","country","query","method","body","sent","abrupt","stop","_x","apply","arguments","getActiveCart","cartId","activeCart","variables","getLocalizedString","localizedString","locale","Object","values","withoutNils","xs","filter","x","dedup","concat","Set","currencyCode","money","price","centAmount","normalizeProductOption","option","__typename","displayName","Array","isArray","map","val","match","test","label","hexColors","normalizeProductImages","images","image","_extends","url","alt","width","dimensions","w","height","h","normalizeProductVariant","variant","_variant$prices$find$","_variant$prices","prices","find","_variant$prices2","sku","_variant$sku","_variant$attributes$m","_variant$attributes","attributes","attribute","key","requiresShipping","listPrice","normalizeProduct","product","_getLocalizedString","_getLocalizedString2","_product$masterVarian","_product$masterVarian2","_product$masterVarian3","slug","path","description","masterVariant","variants","flatMap","reduce","groupedAttributes","groupedAttribute","gAttr","push","normalizeLineItem","lineItem","_getLocalizedString3","_lineItem$variant$att","_lineItem$variant$att2","variantId","productId","quantity","discounts","normalizeCart","customerId","email","customerEmail","createdAt","code","taxesIncluded","taxMode","lineItems","item","lineItemsSubtotalPrice","subtotalPrice","totalPrice","normalizeCategory","category","_getLocalizedString4","_getLocalizedString5","handler","fetchOptions","fetcher","input","provider","useHook","_ref2","useData","response","swrOptions","revalidateOnFocus","useMemo","create","isEmpty","_response$data$lineIt","_response$data","data","length","enumerable","Number","isInteger","version","actions","action","_item$quantity","updatedCart","_useCart","useCart","mutate","useCallback","_addItem","_callee2","_callee2$","_context2","addItem","itemId","lineItemId","ctx","_ctx","removeItem","_ref3","_input$id","ValidationError","message","_ref$input","removeItemHandler","debounce","_ctx$wait","wait","initCommercetoolsSDKClient","creds","scopes","projectKey","authMiddlewareOptions","host","region","clientSecret","credentials","clientId","httpMiddlewareOptions","ClientBuilder","withProjectKey","withClientCredentialsFlow","withHttpMiddleware","build","getFetcher","client","apiRoot","createApiBuilderFromCtpClient","queryBuilder","withId","ID","search","queryArgs","expand","limit","filters","where","execute","categoryId","count","_search","products","results","found","brandId","_response$data$length","categories","getCommercetoolsProvider","cartCookie","useAddItem","useRemoveItem","useUpdateItem","useSearch","useProduct","site","useCategories","useBrands","useCommerce","useCoreCommerce","getCommerceProvider","getCoreCommerceProvider","globalContextName","commerceProviderMeta","props","type","defaultValue","globalActions","globalActionsRegistrations","importPath","importName","CommerceProviderComponent","children","React","_usePlasmicQueryData","usePlasmicQueryData","project","languages","error","isLoading","CommerceProvider","Error","CartActionsProvider","registerCommerceProvider","loader","customCommerceProviderMeta","doRegisterComponent","registerGlobalContext","registerAll"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,IAAa,EAAEC;EACvC,IAAIC,MAAM,GAAGC,SAAS;EACtB,QAAQH,IAAI;IACV,KAAK,WAAW;MACdE,MAAM,GAAG,WAAW;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qE;EAErE,IAAMC,mBAAmB,GAAiC,SAApDA,mBAAmBA;IAAA,OACvBF,MAAM,GACFA,MAAM,CAACG,qBAAqB,CAAAxO,KAAA,CAA5BqO,MAAM,EAAApO,SAA8B,CAAC,GACrCuO,qBAAqB,CAAAxO,KAAA,SAAAC,SAAQ,CAAC;;EACpCsO,mBAAmB,CACjBf,yBAAyB,EACzBc,0BAA0B,WAA1BA,0BAA0B,GAAItB,oBAAoB,CACnD;AACH;;SCjGgByB,WAAWA,CAACJ,MAAqB;EAC/CD,wBAAwB,CAACC,MAAM,CAAC;AAClC;;;;"}
1
+ {"version":3,"file":"commerce-commercetools.esm.js","sources":["../src/utils/get-sort-variables.ts","../src/const.ts","../src/utils/cookies.ts","../src/utils/cart-cookie.ts","../src/utils/cart-create.ts","../src/utils/cart-active.ts","../src/utils/localized-string.ts","../src/utils/common.ts","../src/utils/normalize.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/client.ts","../src/fetcher.ts","../src/product/use-product.tsx","../src/product/use-search.tsx","../src/site/use-brands.tsx","../src/site/use-categories.tsx","../src/provider.ts","../src/commercetools.tsx","../src/registerCommerceProvider.tsx","../src/index.tsx"],"sourcesContent":["const getSortVariables = (sort?: string, isCategory: boolean = false) => {\n let output = undefined\n switch (sort) {\n case 'price-asc':\n output = 'price asc'\n break\n case 'price-desc':\n output = 'price desc'\n break\n case 'trending-desc': // default option\n output = undefined\n break\n case 'latest-desc':\n output = 'createdAt desc'\n break\n }\n return output\n}\n\nexport default getSortVariables\n","export const COMMERCETOOLS_COOKIE_EXPIRE = 30\n\nexport const COMMERCETOOLS_CART_COOKIE = 'commercetools_cart'\n\nexport const COMMERCETOOLS_CUSTOMER_COOKIE = 'commercetools_customer'\n\nexport const COMMERCETOOLS_WISHLIST_COOKIE = 'commercetools_wishlist'\n","import Cookies, { CookieAttributes } from 'js-cookie';\nimport { COMMERCETOOLS_COOKIE_EXPIRE } from '../const'\n\nconst options: CookieAttributes = {\n expires: COMMERCETOOLS_COOKIE_EXPIRE,\n sameSite: \"none\",\n secure: true\n}\n\nexport const getCookies = <T>(name: string) => {\n const cookie = Cookies.get(name);\n return cookie ? (JSON.parse(cookie) as T) : undefined\n}\n\nexport const setCookies = (name: string, value: any) => Cookies.set(name, JSON.stringify(value), options);\n\nexport const removeCookies = (name: string) => Cookies.remove(name);\n","import { COMMERCETOOLS_CART_COOKIE } from '../const'\nimport { getCookies, setCookies, removeCookies } from './cookies'\n\nexport const getCartId = () =>\n getCookies<string>(COMMERCETOOLS_CART_COOKIE)\n\nexport const setCartId = (id: string) =>\n setCookies(COMMERCETOOLS_CART_COOKIE, id)\n\nexport const removeCartCookie = () =>\n removeCookies(COMMERCETOOLS_CART_COOKIE)\n","import { Cart, CartDraft } from '@commercetools/platform-sdk'\nimport { ClientResponse } from '@commercetools/sdk-client-v2'\nimport { FetcherOptions } from '@plasmicpkgs/commerce'\nimport { removeCartCookie, setCartId } from './cart-cookie'\n\nconst createCart = async (\n fetch: <T = any, B = Body>(options: FetcherOptions<B>) => Promise<T>\n) => {\n const draft: CartDraft = {\n currency: 'USD',\n country: 'US',\n }\n\n const cart = await fetch<ClientResponse<Cart>, CartDraft>({\n query: 'carts',\n method: 'post',\n body: draft,\n })\n\n if (!cart.body) {\n removeCartCookie()\n } else {\n setCartId(cart.body.id)\n }\n return cart.body\n}\n\nexport default createCart\n","import { Cart, ClientResponse } from '@commercetools/platform-sdk'\nimport { FetcherOptions } from '@plasmicpkgs/commerce'\nimport { getCartId, removeCartCookie, setCartId } from './cart-cookie'\nimport createCart from './cart-create'\n\nconst getActiveCart = async (\n fetch: <T = any, B = Body>(options: FetcherOptions<B>) => Promise<T>\n) => {\n const cartId = getCartId()\n let activeCart\n if (cartId) {\n activeCart = (\n await fetch<ClientResponse<Cart>>({\n query: 'carts',\n method: 'get',\n variables: {\n id: cartId,\n },\n })\n ).body\n } else {\n activeCart = await createCart(fetch)\n }\n\n if (!activeCart) {\n removeCartCookie()\n } else {\n setCartId(activeCart.id)\n }\n return activeCart\n}\n\nexport default getActiveCart\n","const getLocalizedString = (\n localizedString: Record<string, string> | undefined,\n locale: string | undefined\n) =>\n !localizedString || !locale\n ? undefined\n : locale in localizedString\n ? localizedString[locale]\n : Object.values(localizedString)[0]\n\nexport default getLocalizedString\n","export const withoutNils = <T>(xs: Array<T | undefined | null>): T[] =>\n xs.filter((x): x is T => x != null)\n\nexport const dedup = <T>(xs: Array<T>): T[] => [...new Set(xs)]\n","import { Category } from '../types/site'\nimport {\n ProductProjection,\n Image,\n ProductVariant,\n Category as CommercetoolsCategory,\n Cart as CommercetoolsCart,\n LineItem as CommercetoolsLineItem,\n TypedMoney,\n Customer,\n ShoppingList,\n ProductData,\n} from '@commercetools/platform-sdk'\nimport { dedup, withoutNils } from './common'\nimport getLocalizedString from './localized-string'\nimport { Cart, LineItem } from '../types/cart'\nimport { Product, ProductOption } from '../types/product'\n\nconst currencyCode = 'USD'\n\nconst stringify = (value: any) =>\n typeof value === 'string' ? value : JSON.stringify(value)\n\nconst money = (price: TypedMoney | undefined) => {\n return price\n ? {\n value: price.centAmount / 100,\n currencyCode: price.currencyCode,\n }\n : {\n value: -1.0, // error\n currencyCode,\n }\n}\n\nconst normalizeProductOption = (option: {\n name: string\n value: string | string[]\n}): ProductOption => ({\n __typename: 'MultipleChoiceOption',\n id: option.name,\n displayName: option.name,\n values: dedup(\n Array.isArray(option.value) ? option.value : [option.value]\n ).map((val) => {\n if (\n option.name.match(/colou?r/gi) &&\n /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/i.test(val)\n ) {\n return {\n label: stringify(val),\n hexColors: [val],\n }\n } else {\n return {\n label: stringify(val),\n }\n }\n }),\n})\n\nconst normalizeProductImages = (images: Image[]) =>\n images.map((image) => ({\n url: image.url,\n ...(image.label ? { alt: image.label } : {}),\n width: image.dimensions.w,\n height: image.dimensions.h,\n }))\n\nconst normalizeProductVariant = (variant: ProductVariant) => {\n const price = money(\n variant.prices?.find((price) => price.value.currencyCode === currencyCode)\n ?.value ?? variant.prices?.[0]?.value\n ).value\n\n return {\n id: `${variant.id}`,\n name: `${variant.id}`,\n sku: variant.sku ?? '',\n price,\n options:\n variant.attributes?.map((attribute) =>\n normalizeProductOption({\n name: attribute.name,\n value: attribute.value.key,\n })\n ) ?? [],\n requiresShipping: false,\n listPrice: price,\n }\n}\n\nexport const normalizeProduct = (\n product: ProductProjection | (ProductData & { id: string }),\n locale: string,\n): Product => ({\n id: product.id,\n name: getLocalizedString(product.name, locale) ?? \"\",\n slug: getLocalizedString(product.slug, locale),\n path: `/${getLocalizedString(product.slug, locale)}`,\n description: getLocalizedString(product.description, locale) ?? '',\n price: money(\n product.masterVariant.prices?.find(\n (price) => price.value.currencyCode === currencyCode\n )?.value ?? product.masterVariant.prices?.[0]?.value\n ),\n images: normalizeProductImages(\n withoutNils([\n ...(product.masterVariant.images ? product.masterVariant.images : []),\n ...product.variants.flatMap((variant) => variant.images),\n ])\n ),\n variants: [product.masterVariant, ...product.variants].map(\n normalizeProductVariant\n ),\n options: withoutNils([\n ...(product.masterVariant.attributes\n ? product.masterVariant.attributes\n : []),\n ...product.variants.flatMap((variant) => variant.attributes),\n ])\n .reduce(\n (groupedAttributes, attribute) => {\n const groupedAttribute = groupedAttributes.find(\n (gAttr) => gAttr.name === attribute.name\n )\n if (groupedAttribute) {\n groupedAttribute.value.push(stringify(attribute.value.key))\n } else {\n groupedAttributes.push({\n name: attribute.name,\n value: [stringify(attribute.value.key)],\n })\n }\n return groupedAttributes\n },\n [] as {\n name: string\n value: string[]\n }[]\n )\n .map(normalizeProductOption),\n})\n\nconst normalizeLineItem = (\n lineItem: CommercetoolsLineItem,\n locale: string,\n): LineItem => ({\n id: lineItem.id,\n variantId: `${lineItem.variant.id}`,\n productId: lineItem.productId,\n name: getLocalizedString(lineItem.name, locale) ?? \"\",\n path: '',\n quantity: lineItem.quantity,\n discounts: [],\n variant: normalizeProductVariant(lineItem.variant),\n options:\n lineItem.variant.attributes?.map((attribute) => ({\n id: attribute.name,\n name: attribute.name,\n value: attribute.value.key,\n })) ?? [],\n})\n\nexport const normalizeCart = (\n cart: CommercetoolsCart,\n locale: string,\n): Cart => ({\n id: cart.id,\n customerId: cart.customerId,\n email: cart.customerEmail,\n createdAt: cart.createdAt,\n currency: {\n code: currencyCode,\n },\n taxesIncluded: cart.taxMode !== 'Disabled',\n lineItems: cart.lineItems.map((item) => normalizeLineItem(item, locale)),\n lineItemsSubtotalPrice: 0,\n subtotalPrice: money(cart.totalPrice).value,\n totalPrice: money(cart.totalPrice).value,\n discounts: [],\n})\n\nexport const normalizeCategory = (\n category: CommercetoolsCategory,\n locale: string,\n): Category => ({\n id: category.id,\n name: getLocalizedString(category.name, locale) ?? \"\",\n slug: getLocalizedString(category.slug, locale) ?? \"\",\n path: `/${getLocalizedString(category.slug, locale)}`,\n})\n\nexport const normalizeCustomer = (customer: Customer) => ({\n firstName: customer.firstName,\n lastName: customer.lastName,\n email: customer.email,\n})\n\nexport const normalizeWishlist = (wishlist: ShoppingList) => ({\n items:\n wishlist.lineItems?.map((item) => ({\n id: item.id,\n product_id: item.productId,\n variant_id: item.variantId!,\n })) ?? [],\n})\n","import { useMemo } from 'react'\nimport { useCart as useCommerceCart, UseCart } from '@plasmicpkgs/commerce'\nimport { SWRHook } from '@plasmicpkgs/commerce'\nimport { getActiveCart, normalizeCart } from '../utils'\nimport { GetCartHook } from '../types/cart'\n\nexport default useCommerceCart as UseCart<typeof handler>\n\nexport const handler: SWRHook<GetCartHook> = {\n fetchOptions: {\n query: \"cart\",\n method: \"get\",\n },\n async fetcher({ input, options, fetch, provider }) {\n const activeCart = await getActiveCart(fetch);\n return activeCart ? normalizeCart(activeCart, provider!.locale) : 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","import { Cart, CartUpdate, ClientResponse } from \"@commercetools/platform-sdk\";\nimport type { MutationHook } from \"@plasmicpkgs/commerce\";\nimport { useAddItem, UseAddItem } from \"@plasmicpkgs/commerce\";\nimport { useCallback } from \"react\";\nimport type { AddItemHook } from \"../types/cart\";\nimport {\n getActiveCart,\n normalizeCart,\n removeCartCookie,\n setCartId,\n} from \"../utils\";\nimport useCart from \"./use-cart\";\n\nexport default useAddItem as UseAddItem<typeof handler>;\n\nexport const handler: MutationHook<AddItemHook> = {\n fetchOptions: {\n query: \"cart\",\n method: \"post\",\n },\n async fetcher({ input: item, options, fetch, provider }) {\n const activeCart = await getActiveCart(fetch);\n if (\n (item.quantity &&\n (!Number.isInteger(item.quantity) || item.quantity! < 1)) ||\n !activeCart\n ) {\n return undefined;\n }\n const updatedCart = await fetch<ClientResponse<Cart>, CartUpdate>({\n query: \"carts\",\n method: \"post\",\n variables: {\n id: activeCart.id,\n },\n body: {\n version: activeCart.version,\n actions: [\n {\n action: \"addLineItem\",\n variantId: +item.variantId,\n productId: item.productId,\n quantity: item.quantity ?? 1,\n },\n ],\n },\n });\n if (updatedCart.body) {\n setCartId(updatedCart.body.id);\n } else {\n removeCartCookie();\n }\n return updatedCart.body\n ? normalizeCart(updatedCart.body, provider!.locale)\n : undefined;\n },\n useHook:\n ({ fetch }) =>\n () => {\n const { mutate } = useCart();\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","import {\n Cart as CommerceToolsCart,\n CartUpdate,\n ClientResponse,\n} from \"@commercetools/platform-sdk\";\nimport type {\n HookFetcherContext,\n MutationHook,\n MutationHookContext,\n} from \"@plasmicpkgs/commerce\";\nimport {\n UseRemoveItem,\n useRemoveItem,\n ValidationError,\n} from \"@plasmicpkgs/commerce\";\nimport { useCallback } from \"react\";\nimport type { Cart, LineItem, RemoveItemHook } from \"../types/cart\";\nimport {\n getActiveCart,\n normalizeCart,\n removeCartCookie,\n setCartId,\n} from \"../utils\";\nimport useCart from \"./use-cart\";\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: MutationHook<RemoveItemHook> = {\n fetchOptions: {\n query: \"cart\",\n method: \"post\",\n },\n async fetcher({\n input: { itemId },\n options,\n fetch,\n provider,\n }: HookFetcherContext<RemoveItemHook>) {\n const activeCart = await getActiveCart(fetch);\n if (!itemId || !activeCart) {\n return undefined;\n }\n const updatedCart = await fetch<\n ClientResponse<CommerceToolsCart>,\n CartUpdate\n >({\n query: \"carts\",\n method: \"post\",\n variables: {\n id: activeCart.id,\n },\n body: {\n version: activeCart.version,\n actions: [\n {\n action: \"removeLineItem\",\n lineItemId: itemId,\n },\n ],\n },\n });\n if (updatedCart.body) {\n setCartId(updatedCart.body.id);\n } else {\n removeCartCookie();\n }\n return normalizeCart(updatedCart.body, provider!.locale);\n },\n useHook:\n ({ fetch }: MutationHookContext<RemoveItemHook>) =>\n <T extends LineItem | undefined = undefined>(ctx: { item?: T } = {}) => {\n const { item } = ctx;\n const { mutate } = useCart();\n const removeItem: RemoveItemFn<LineItem> = async (input) => {\n const itemId = input?.id ?? item?.id;\n\n if (!itemId) {\n throw new ValidationError({\n message: \"Invalid input used for this operation\",\n });\n }\n\n const data = await fetch({ input: { itemId } });\n await mutate(data, false);\n return data;\n };\n\n return useCallback(removeItem as RemoveItemFn<T>, [fetch, mutate]);\n },\n};\n","import { Cart, CartUpdate, ClientResponse } from \"@commercetools/platform-sdk\";\nimport type { MutationHook, MutationHookContext } from \"@plasmicpkgs/commerce\";\nimport {\n useUpdateItem,\n UseUpdateItem,\n ValidationError,\n} from \"@plasmicpkgs/commerce\";\nimport debounce from \"debounce\";\nimport { useCallback } from \"react\";\nimport type { LineItem, UpdateItemHook } from \"../types/cart\";\nimport {\n getActiveCart,\n normalizeCart,\n removeCartCookie,\n setCartId,\n} from \"../utils\";\nimport useCart from \"./use-cart\";\nimport { handler as removeItemHandler } from \"./use-remove-item\";\n\nexport type UpdateItemActionInput<T = any> = T extends LineItem\n ? Partial<UpdateItemHook[\"actionInput\"]>\n : UpdateItemHook[\"actionInput\"];\n\nexport default useUpdateItem as UseUpdateItem<typeof handler>;\n\nexport const handler: MutationHook<UpdateItemHook> = {\n fetchOptions: {\n query: \"cart\",\n method: \"post\",\n },\n async fetcher({ input: { item, itemId }, options, fetch, provider }) {\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 provider,\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\n const activeCart = await getActiveCart(fetch);\n if (\n (item.quantity &&\n (!Number.isInteger(item.quantity) || item.quantity! < 1)) ||\n !activeCart\n ) {\n return undefined;\n }\n const updatedCart = await fetch<ClientResponse<Cart>, CartUpdate>({\n query: \"carts\",\n method: \"post\",\n variables: {\n id: activeCart.id,\n },\n body: {\n version: activeCart.version,\n actions: [\n {\n action: \"changeLineItemQuantity\",\n lineItemId: itemId,\n quantity: item.quantity ?? 1,\n },\n ],\n },\n });\n if (updatedCart.body) {\n setCartId(updatedCart.body.id);\n } else {\n removeCartCookie();\n }\n return updatedCart.body\n ? normalizeCart(updatedCart.body, provider!.locale)\n : undefined;\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 } = useCart() as any;\n\n return useCallback(\n debounce(async (input: UpdateItemActionInput<T>) => {\n const itemId = input.id ?? item?.id;\n if (!itemId || input.quantity == null) {\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","import {\n AuthMiddlewareOptions,\n ClientBuilder,\n HttpMiddlewareOptions,\n } from '@commercetools/sdk-client-v2'\nimport { CommercetoolsCredentials } from './provider'\n\nconst initCommercetoolsSDKClient = (creds: CommercetoolsCredentials) => {\n const scopes = [`manage_project:${creds.projectKey}`]\n \n // Configure authMiddlewareOptions\n const authMiddlewareOptions: AuthMiddlewareOptions = {\n host: `https://auth.${creds.region}.commercetools.com`,\n projectKey: creds.clientSecret,\n credentials: {\n clientId: creds.clientId,\n clientSecret: creds.clientSecret,\n },\n scopes,\n fetch,\n }\n \n // Configure httpMiddlewareOptions\n const httpMiddlewareOptions: HttpMiddlewareOptions = {\n host: `https://api.${creds.region}.commercetools.com`,\n fetch,\n }\n \n // Export the ClientBuilder\n return new ClientBuilder()\n .withProjectKey(creds.projectKey)\n .withClientCredentialsFlow(authMiddlewareOptions)\n .withHttpMiddleware(httpMiddlewareOptions)\n .build()\n}\n \n export default initCommercetoolsSDKClient","import { Fetcher } from '@plasmicpkgs/commerce'\nimport { CommercetoolsCredentials } from './provider'\nimport { createApiBuilderFromCtpClient } from '@commercetools/platform-sdk'\nimport initCommercetoolsSDKClient from './client'\n\nexport const getFetcher: \n (creds: CommercetoolsCredentials) => Fetcher =\n (creds) => {\n const client = initCommercetoolsSDKClient(creds);\n const apiRoot = createApiBuilderFromCtpClient(client).withProjectKey({\n projectKey: creds.projectKey!,\n })\n return async ({\n method, variables, query, body\n }) => {\n let queryBuilder: any = apiRoot;\n if (query) {\n queryBuilder = queryBuilder[query]();\n } \n if (variables?.id) {\n queryBuilder = queryBuilder.withId({ ID: variables.id });\n }\n if (variables?.search) {\n queryBuilder = queryBuilder.search();\n }\n return await queryBuilder[method!]({\n body,\n queryArgs: {\n expand: variables?.expand,\n limit: variables?.limit,\n ...(variables?.sort ? { sort: variables.sort } : {}),\n ...(variables?.search ? variables.search : {}),\n ...(variables?.filters ? { filter: variables.filters } : {}),\n ...(variables?.where ? { where: variables.where } : {})\n },\n })\n .execute()\n }\n}\n","import { SWRHook } from '@plasmicpkgs/commerce'\nimport { useProduct, UseProduct } from '@plasmicpkgs/commerce'\nimport {\n Product,\n ProductProjection,\n ClientResponse,\n} from '@commercetools/platform-sdk'\nimport { normalizeProduct } from '../utils'\nimport type { GetProductHook } from '@plasmicpkgs/commerce'\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: \"productProjections\",\n method: \"get\"\n },\n async fetcher({ input, options, fetch, provider }) {\n const { id } = input\n if (!id) {\n return null\n }\n\n const product = await fetch<ClientResponse<ProductProjection>>({\n ...options,\n variables: {\n id\n },\n });\n return product.body \n ? normalizeProduct(product.body, provider!.locale)\n : null\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 ClientResponse,\n ProductProjectionPagedQueryResponse,\n} from \"@commercetools/platform-sdk\";\nimport { useSearch } from \"@plasmicpkgs/commerce\";\nimport { getSortVariables, normalizeProduct } from \"../utils\";\n\nimport type {\n SearchProductsHook,\n SWRHook,\n UseSearch,\n} from \"@plasmicpkgs/commerce\";\n\nexport type SearchProductsInput = {\n search?: string;\n categoryId?: number;\n brandId?: number;\n sort?: string;\n locale?: string;\n count?: number;\n};\n\nconst useSearchTyped: UseSearch<typeof handler> = useSearch;\nexport default useSearchTyped;\n\nexport const handler: SWRHook<SearchProductsHook> = {\n fetchOptions: {\n method: \"get\",\n query: \"productProjections\",\n },\n async fetcher({ input, options, fetch, provider }) {\n const { search, categoryId, sort, count } = input;\n const response = await fetch<\n ClientResponse<ProductProjectionPagedQueryResponse>\n >({\n ...options,\n variables: {\n expand: [\"masterData.current\"],\n sort: getSortVariables(sort),\n limit: count,\n ...(search\n ? // eslint-disable-next-line\n { search: { [`text.${provider?.locale!}`]: search } }\n : {}),\n ...(categoryId\n ? { filters: `categories.id: subtree(\"${categoryId}\")` }\n : {}),\n },\n });\n return {\n products: response.body.results.map((product) =>\n normalizeProduct(product, provider!.locale)\n ),\n found: response.body.count > 0,\n };\n },\n useHook:\n ({ useData }) =>\n (input = {}) => {\n return useData({\n input: [\n [\"search\", input.search],\n [\"categoryId\", input.categoryId],\n [\"brandId\", input.brandId],\n [\"sort\", input.sort],\n [\"locale\", input.locale],\n [\"count\", input.count],\n ],\n swrOptions: {\n revalidateOnFocus: false,\n ...input.swrOptions,\n },\n });\n },\n};\n","import { SWRHook } from '@plasmicpkgs/commerce'\nimport { UseBrands, useBrands } from '@plasmicpkgs/commerce'\nimport { useMemo } from \"react\";\nimport { GetBrandsHook } from \"../types/site\"\n\nexport default useBrands as UseBrands<typeof handler>\n\nexport const handler: SWRHook<GetBrandsHook> = {\n fetchOptions: {\n query: \"\"\n },\n async fetcher({ input, options, fetch }) {\n return 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?.length ?? 0) <= 0\n },\n enumerable: true,\n },\n }),\n [response]\n )\n },\n}\n","import { SWRHook, UseCategories, useCategories } from \"@plasmicpkgs/commerce\";\nimport { useMemo } from \"react\";\nimport { GetCategoriesHook } from \"../types/site\";\nimport {\n ClientResponse,\n Category,\n CategoryPagedQueryResponse,\n} from '@commercetools/platform-sdk'\nimport { normalizeCategory } from \"../utils\";\n\nexport default useCategories as UseCategories<typeof handler>;\n\nexport const handler: SWRHook<GetCategoriesHook> = {\n fetchOptions: {\n query: \"categories\",\n method: \"get\",\n },\n async fetcher({ input, options, fetch, provider }) {\n const { categoryId } = input;\n if (!categoryId) {\n const categories = await fetch<ClientResponse<CategoryPagedQueryResponse>>({\n ...options\n })\n return categories.body ? categories.body.results.map((category) => normalizeCategory(category, provider!.locale)) : [];\n } else {\n const category = await fetch<ClientResponse<Category>>({\n ...options,\n variables: {\n ...(categoryId ? { id: categoryId } : { })\n }\n })\n return category.body ? [normalizeCategory(category.body, provider!.locale)] : [];\n }\n },\n useHook: ({ useData }) => (input) => {\n const response = useData({\n input: [[\"categoryId\", input?.categoryId]],\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 { Fetcher } from \"@plasmicpkgs/commerce\";\nimport { handler as useAddItem } from \"./cart/use-add-item\";\nimport { handler as useCart } from \"./cart/use-cart\";\nimport { handler as useRemoveItem } from \"./cart/use-remove-item\";\nimport { handler as useUpdateItem } from \"./cart/use-update-item\";\nimport { COMMERCETOOLS_CART_COOKIE } from \"./const\";\nimport { getFetcher } from \"./fetcher\";\nimport { handler as useProduct } from \"./product/use-product\";\nimport { handler as useSearch } from \"./product/use-search\";\nimport { handler as useBrands } from \"./site/use-brands\";\nimport { handler as useCategories } from \"./site/use-categories\";\n\nexport interface CommercetoolsCredentials {\n projectKey: string;\n clientId: string;\n clientSecret: string;\n region: string;\n}\n\nexport const getCommercetoolsProvider = (\n creds: CommercetoolsCredentials,\n locale: string\n) => ({\n locale,\n cartCookie: COMMERCETOOLS_CART_COOKIE,\n cart: { useCart, useAddItem, useRemoveItem, useUpdateItem },\n fetcher: getFetcher(creds),\n products: { useSearch, useProduct },\n site: { useCategories, useBrands },\n});\n\nexport type CommercetoolsProvider = {\n locale: string;\n cartCookie: string;\n fetcher: Fetcher;\n cart: {\n useCart: typeof useCart;\n useAddItem: typeof useAddItem;\n };\n products: {\n useSearch: typeof useSearch;\n useProduct: typeof useProduct;\n };\n site: {\n useCategories: typeof useCategories;\n useBrands: typeof useBrands;\n };\n};\n","import {\n getCommerceProvider as getCoreCommerceProvider,\n useCommerce as useCoreCommerce,\n} from '@plasmicpkgs/commerce'\nimport { getCommercetoolsProvider, CommercetoolsProvider, CommercetoolsCredentials } from './provider'\n\nexport type { CommercetoolsProvider }\n\nexport const useCommerce = () => useCoreCommerce<CommercetoolsProvider>()\n\nexport const getCommerceProvider = (creds: CommercetoolsCredentials, locale: string) => \n getCoreCommerceProvider(getCommercetoolsProvider(creds, locale))\n\n","import { ClientResponse, Project } from \"@commercetools/platform-sdk\";\nimport { GlobalContextMeta } from \"@plasmicapp/host\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport { usePlasmicQueryData } from \"@plasmicapp/query\";\nimport {\n CartActionsProvider,\n globalActionsRegistrations,\n} from \"@plasmicpkgs/commerce\";\nimport React from \"react\";\nimport { getCommerceProvider } from \"./commercetools\";\nimport { getFetcher } from \"./fetcher\";\nimport { CommercetoolsCredentials } from \"./provider\";\nimport { Registerable } from \"./registerable\";\n\ninterface CommerceProviderProps extends CommercetoolsCredentials {\n children?: React.ReactNode;\n}\n\nconst globalContextName = \"plasmic-commerce-commercetools-provider\";\n\nexport const commerceProviderMeta: GlobalContextMeta<CommerceProviderProps> = {\n name: globalContextName,\n displayName: \"Commercetools Provider\",\n props: {\n projectKey: {\n type: \"string\",\n defaultValue: \"plasmic-demo\",\n },\n clientId: {\n type: \"string\",\n defaultValue: \"B4hmK61xvz5LvdSDtsFmcflM\",\n },\n clientSecret: {\n type: \"string\",\n defaultValue: \"KhzjcjSu1Oul4aomSmOsLZOCZKbvfHqx\",\n },\n region: {\n type: \"choice\",\n options: [\n \"us-central1.gcp\",\n \"us-east-2.aws\",\n \"europe-west1.gcp\",\n \"eu-central-1.aws\",\n \"australia-southeast1.gcp\",\n ],\n defaultValue: \"us-central1.gcp\",\n },\n },\n ...{ globalActions: globalActionsRegistrations },\n importPath: \"@plasmicpkgs/commercetools\",\n importName: \"CommerceProviderComponent\",\n};\n\nexport function CommerceProviderComponent(props: CommerceProviderProps) {\n const { children, projectKey, clientId, clientSecret, region } = props;\n\n const creds = React.useMemo(\n () => ({ projectKey, clientId, clientSecret, region }),\n [projectKey, clientId, clientSecret, region]\n );\n\n const {\n data: locale,\n error,\n isLoading,\n } = usePlasmicQueryData(JSON.stringify({ creds }) + \"locale\", async () => {\n const fetcher = getFetcher(creds);\n const project: ClientResponse<Project> = await fetcher({ method: \"get\" });\n return project.body ? project.body.languages[0] : undefined;\n });\n\n const CommerceProvider = React.useMemo(\n () => getCommerceProvider(creds, locale ?? \"\"),\n [creds, locale]\n );\n\n if (isLoading) {\n return null;\n } else if (error || !locale) {\n throw new Error(error ? error.message : \"Project language not found\");\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 \"./commercetools\";\n\nexport function registerAll(loader?: Registerable) {\n registerCommerceProvider(loader);\n}\n"],"names":["getSortVariables","sort","isCategory","output","undefined","COMMERCETOOLS_COOKIE_EXPIRE","COMMERCETOOLS_CART_COOKIE","options","expires","sameSite","secure","getCookies","name","cookie","Cookies","get","JSON","parse","setCookies","value","set","stringify","removeCookies","remove","getCartId","setCartId","id","removeCartCookie","createCart","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","fetch","draft","cart","wrap","_callee$","_context","prev","next","currency","country","query","method","body","sent","abrupt","stop","_x","apply","arguments","getActiveCart","cartId","activeCart","variables","getLocalizedString","localizedString","locale","Object","values","withoutNils","xs","filter","x","dedup","concat","Set","currencyCode","money","price","centAmount","normalizeProductOption","option","__typename","displayName","Array","isArray","map","val","match","test","label","hexColors","normalizeProductImages","images","image","_extends","url","alt","width","dimensions","w","height","h","normalizeProductVariant","variant","_variant$prices$find$","_variant$prices","prices","find","_variant$prices2","sku","_variant$sku","_variant$attributes$m","_variant$attributes","attributes","attribute","key","requiresShipping","listPrice","normalizeProduct","product","_getLocalizedString","_getLocalizedString2","_product$masterVarian","_product$masterVarian2","_product$masterVarian3","slug","path","description","masterVariant","variants","flatMap","reduce","groupedAttributes","groupedAttribute","gAttr","push","normalizeLineItem","lineItem","_getLocalizedString3","_lineItem$variant$att","_lineItem$variant$att2","variantId","productId","quantity","discounts","normalizeCart","customerId","email","customerEmail","createdAt","code","taxesIncluded","taxMode","lineItems","item","lineItemsSubtotalPrice","subtotalPrice","totalPrice","normalizeCategory","category","_getLocalizedString4","_getLocalizedString5","handler","fetchOptions","fetcher","input","provider","useHook","_ref2","useData","response","swrOptions","revalidateOnFocus","useMemo","create","isEmpty","_response$data$lineIt","_response$data","data","length","enumerable","Number","isInteger","version","actions","action","_item$quantity","updatedCart","_useCart","useCart","mutate","useCallback","_addItem","_callee2","_callee2$","_context2","addItem","itemId","lineItemId","ctx","_ctx","removeItem","_ref3","_input$id","ValidationError","message","_ref$input","removeItemHandler","debounce","_ctx$wait","wait","initCommercetoolsSDKClient","creds","scopes","projectKey","authMiddlewareOptions","host","region","clientSecret","credentials","clientId","httpMiddlewareOptions","ClientBuilder","withProjectKey","withClientCredentialsFlow","withHttpMiddleware","build","getFetcher","client","apiRoot","createApiBuilderFromCtpClient","queryBuilder","withId","ID","search","queryArgs","expand","limit","filters","where","execute","categoryId","count","_search","products","results","found","brandId","_response$data$length","categories","getCommercetoolsProvider","cartCookie","useAddItem","useRemoveItem","useUpdateItem","useSearch","useProduct","site","useCategories","useBrands","useCommerce","useCoreCommerce","getCommerceProvider","getCoreCommerceProvider","globalContextName","commerceProviderMeta","props","type","defaultValue","globalActions","globalActionsRegistrations","importPath","importName","CommerceProviderComponent","children","React","_usePlasmicQueryData","usePlasmicQueryData","project","languages","error","isLoading","CommerceProvider","Error","CartActionsProvider","registerCommerceProvider","loader","customCommerceProviderMeta","doRegisterComponent","registerGlobalContext","registerAll"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,IAAa,EAAEC;EACvC,IAAIC,MAAM,GAAGC,SAAS;EACtB,QAAQH,IAAI;IACV,KAAK,WAAW;MACdE,MAAM,GAAG,WAAW;MACpB;IACF,KAAK,YAAY;MACfA,MAAM,GAAG,YAAY;MACrB;IACF,KAAK,eAAe;;MAClBA,MAAM,GAAGC,SAAS;MAClB;IACF,KAAK,aAAa;MAChBD,MAAM,GAAG,gBAAgB;MACzB;;EAEJ,OAAOA,MAAM;AACf,CAAC;;ACjBM,IAAME,2BAA2B,GAAG,EAAE;AAE7C,AAAO,I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c,0BAA0B,WAA1BA,0BAA0B,GAAItB,oBAAoB,CACnD;AACH;;SCjGgByB,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-commercetools",
3
- "version": "0.0.155",
3
+ "version": "0.0.157",
4
4
  "description": "Plasmic registration calls for commercetools 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.208",
21
+ "@plasmicapp/host": "1.0.210",
22
22
  "@plasmicapp/query": "0.1.79",
23
23
  "@size-limit/preset-small-lib": "^4.11.0",
24
24
  "@types/debounce": "^1.2.4",
@@ -38,7 +38,7 @@
38
38
  "@commercetools/platform-sdk": "^2.8.0",
39
39
  "@commercetools/sdk-client-v2": "^2.2.2",
40
40
  "@commercetools/ts-sdk-apm": "^1.0.2",
41
- "@plasmicpkgs/commerce": "0.0.206",
41
+ "@plasmicpkgs/commerce": "0.0.208",
42
42
  "@types/react": "^18.0.27",
43
43
  "debounce": "^2.0.0",
44
44
  "js-cookie": "^3.0.5",
@@ -47,5 +47,5 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "gitHead": "879304149b902b453a47fe674997fcad01ae4af8"
50
+ "gitHead": "7f923856013e0efa4eb893fa16c2f48bd4edc9c3"
51
51
  }