@dropins/storefront-wishlist 3.0.0-beta3 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Copyright 2025 Adobe
1
+ /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
3
  import{W as c,t as h,b as m}from"./chunks/mergeWishlists.js";import{a as G,c as H,f as F,h as v,g as L,d as U,i as A,e as M,m as N,r as R}from"./chunks/mergeWishlists.js";import{s as l,g as u,f as a,h as I}from"./chunks/removeProductsFromWishlist.js";import{k as O,e as Q,l as y,c as b,r as C,a as Y,b as x,d as B,j as z}from"./chunks/removeProductsFromWishlist.js";import{events as _}from"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import"@dropins/tools/fetch-graphql.js";const d=`
4
4
  query GET_WISHLIST_BY_ID_QUERY(
package/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sources":["/@dropins/storefront-wishlist/src/api/getWishlistById/graphql/getWishlistById.graphql.ts","/@dropins/storefront-wishlist/src/api/getWishlistById/getWishlistById.ts","/@dropins/storefront-wishlist/src/api/updateProductsInWishlist/graphql/updateProductsInWishlistMutation.ts","/@dropins/storefront-wishlist/src/api/updateProductsInWishlist/updateProductsInWishlist.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { WISHLIST_ITEM_FRAGMENT } from '@/wishlist/api/fragments';\n\nexport const GET_WISHLIST_BY_ID_QUERY = `\n query GET_WISHLIST_BY_ID_QUERY(\n $wishlistId: ID!,\n ) {\n customer {\n wishlist_v2(id: $wishlistId) {\n id\n updated_at\n sharing_code\n items_count\n items_v2 {\n items {\n ...WISHLIST_ITEM_FRAGMENT\n }\n }\n }\n }\n }\n\n${WISHLIST_ITEM_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GET_WISHLIST_BY_ID_QUERY } from '@/wishlist/api/getWishlistById/graphql/getWishlistById.graphql';\nimport { Wishlist } from '@/wishlist/data/models';\nimport { transformWishlist } from '@/wishlist/data/transforms';\nimport { state } from '@/wishlist/lib/state';\nimport { fetchGraphQl, getPersistedWishlistData } from '@/wishlist/api';\nimport { handleFetchError } from '@/wishlist/lib/fetch-error';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getWishlistById = async (\n wishlistId: string\n): Promise<void | Wishlist | null> => {\n // When the user is not authenticated, we just have a single wishlist\n // There is no necessity to check any IDs\n if (!state.authenticated) {\n return getPersistedWishlistData();\n }\n\n if (!wishlistId) {\n throw Error('Wishlist ID is not set');\n }\n\n // @ts-ignore\n return fetchGraphQl(GET_WISHLIST_BY_ID_QUERY, {\n variables: {\n wishlistId,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.customer?.wishlist_v2) {\n return null;\n }\n\n const payload = transformWishlist(data.customer.wishlist_v2);\n events.emit('wishlist/data', payload);\n return payload;\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { WISHLIST_FRAGMENT } from '@/wishlist/api/graphql/WishlistFragment.graphql';\n\nexport const UPDATE_PRODUCTS_IN_WISHLIST_MUTATION = `\n mutation UPDATE_PRODUCTS_IN_WISHLIST_MUTATION(\n $wishlistId: ID!, \n $wishlistItems: [WishlistItemUpdateInput!]!,\n ) {\n updateProductsInWishlist(\n wishlistId: $wishlistId\n wishlistItems: $wishlistItems\n ) {\n wishlist {\n ...WISHLIST_FRAGMENT\n }\n user_errors {\n code\n message\n }\n }\n }\n \n ${WISHLIST_FRAGMENT} \n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/wishlist/api';\nimport { state } from '@/wishlist/lib/state';\nimport { handleFetchError } from '@/wishlist//lib/fetch-error';\n\nimport { UPDATE_PRODUCTS_IN_WISHLIST_MUTATION } from './graphql/updateProductsInWishlistMutation';\nimport { Wishlist } from '@/wishlist/data/models/wishlist';\nimport { transformWishlist } from '@/wishlist/data/transforms';\n\nexport const updateProductsInWishlist = async (\n items: {\n wishlistItemId: string;\n quantity: number;\n description: string;\n selectedOptions?: string[];\n enteredOptions?: { uid: string; value: string }[];\n }[]\n): Promise<Wishlist | null> => {\n const wishlistId = state.wishlistId;\n\n if (!wishlistId) {\n throw Error('Wishlist ID is not set');\n }\n\n return fetchGraphQl(UPDATE_PRODUCTS_IN_WISHLIST_MUTATION, {\n variables: {\n wishlistId,\n wishlistItems: items.map(\n ({\n wishlistItemId,\n quantity,\n description,\n selectedOptions: selected_options,\n enteredOptions: entered_options,\n }) => ({\n wishlistItemId,\n quantity,\n description,\n selected_options,\n entered_options,\n })\n ),\n },\n }).then(({ errors, data }) => {\n // handle errors\n const _errors = [\n ...(data?.updateProductsInWishlist?.user_errors ?? []),\n ...(errors ?? []),\n ];\n\n if (_errors.length > 0) return handleFetchError(_errors);\n\n return transformWishlist(data.updateProductsInWishlist.wishlist);\n });\n};\n"],"names":["GET_WISHLIST_BY_ID_QUERY","WISHLIST_ITEM_FRAGMENT","getWishlistById","wishlistId","state","getPersistedWishlistData","fetchGraphQl","errors","data","handleFetchError","_a","payload","transformWishlist","events","UPDATE_PRODUCTS_IN_WISHLIST_MUTATION","WISHLIST_FRAGMENT","updateProductsInWishlist","items","wishlistItemId","quantity","description","selected_options","entered_options","_errors"],"mappings":"yeAmBO,MAAMA,EAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBtCC,CAAsB;AAAA,ECbXC,EAAkB,MAC7BC,GACoC,CAGhC,GAAA,CAACC,EAAM,cACT,OAAOC,EAAyB,EAGlC,GAAI,CAACF,EACH,MAAM,MAAM,wBAAwB,EAItC,OAAOG,EAAaN,EAA0B,CAC5C,UAAW,CACT,WAAAG,CAAA,CAEH,CAAA,EAAE,KAAK,CAAC,CAAE,OAAAI,EAAQ,KAAAC,KAAW,OACxB,GAAAD,EAAe,OAAAE,EAAiBF,CAAM,EAEtC,GAAA,GAACG,EAAAF,GAAA,YAAAA,EAAM,WAAN,MAAAE,EAAgB,aACZ,OAAA,KAGT,MAAMC,EAAUC,EAAkBJ,EAAK,SAAS,WAAW,EACpD,OAAAK,EAAA,KAAK,gBAAiBF,CAAO,EAC7BA,CAAA,CACR,CACH,ECnCaG,EAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAmB/CC,CAAiB;AAAA,ECbTC,EAA2B,MACtCC,GAO6B,CAC7B,MAAMd,EAAaC,EAAM,WAEzB,GAAI,CAACD,EACH,MAAM,MAAM,wBAAwB,EAGtC,OAAOG,EAAaQ,EAAsC,CACxD,UAAW,CACT,WAAAX,EACA,cAAec,EAAM,IACnB,CAAC,CACC,eAAAC,EACA,SAAAC,EACA,YAAAC,EACA,gBAAiBC,EACjB,eAAgBC,CAAA,KACX,CACL,eAAAJ,EACA,SAAAC,EACA,YAAAC,EACA,iBAAAC,EACA,gBAAAC,CACF,EAAA,CACF,CAEH,CAAA,EAAE,KAAK,CAAC,CAAE,OAAAf,EAAQ,KAAAC,KAAW,OAE5B,MAAMe,EAAU,CACd,KAAIb,EAAAF,GAAA,YAAAA,EAAM,2BAAN,YAAAE,EAAgC,cAAe,CAAC,EACpD,GAAIH,GAAU,CAAA,CAChB,EAEA,OAAIgB,EAAQ,OAAS,EAAUd,EAAiBc,CAAO,EAEhDX,EAAkBJ,EAAK,yBAAyB,QAAQ,CAAA,CAChE,CACH"}
1
+ {"version":3,"file":"api.js","sources":["/@dropins/storefront-wishlist/src/api/getWishlistById/graphql/getWishlistById.graphql.ts","/@dropins/storefront-wishlist/src/api/getWishlistById/getWishlistById.ts","/@dropins/storefront-wishlist/src/api/updateProductsInWishlist/graphql/updateProductsInWishlistMutation.ts","/@dropins/storefront-wishlist/src/api/updateProductsInWishlist/updateProductsInWishlist.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { WISHLIST_ITEM_FRAGMENT } from '@/wishlist/api/fragments';\n\nexport const GET_WISHLIST_BY_ID_QUERY = `\n query GET_WISHLIST_BY_ID_QUERY(\n $wishlistId: ID!,\n ) {\n customer {\n wishlist_v2(id: $wishlistId) {\n id\n updated_at\n sharing_code\n items_count\n items_v2 {\n items {\n ...WISHLIST_ITEM_FRAGMENT\n }\n }\n }\n }\n }\n\n${WISHLIST_ITEM_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GET_WISHLIST_BY_ID_QUERY } from '@/wishlist/api/getWishlistById/graphql/getWishlistById.graphql';\nimport { Wishlist } from '@/wishlist/data/models';\nimport { transformWishlist } from '@/wishlist/data/transforms';\nimport { state } from '@/wishlist/lib/state';\nimport { fetchGraphQl, getPersistedWishlistData } from '@/wishlist/api';\nimport { handleFetchError } from '@/wishlist/lib/fetch-error';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getWishlistById = async (\n wishlistId: string\n): Promise<void | Wishlist | null> => {\n // When the user is not authenticated, we just have a single wishlist\n // There is no necessity to check any IDs\n if (!state.authenticated) {\n return getPersistedWishlistData();\n }\n\n if (!wishlistId) {\n throw Error('Wishlist ID is not set');\n }\n\n // @ts-ignore\n return fetchGraphQl(GET_WISHLIST_BY_ID_QUERY, {\n variables: {\n wishlistId,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.customer?.wishlist_v2) {\n return null;\n }\n\n const payload = transformWishlist(data.customer.wishlist_v2);\n events.emit('wishlist/data', payload);\n return payload;\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { WISHLIST_FRAGMENT } from '@/wishlist/api/graphql/WishlistFragment.graphql';\n\nexport const UPDATE_PRODUCTS_IN_WISHLIST_MUTATION = `\n mutation UPDATE_PRODUCTS_IN_WISHLIST_MUTATION(\n $wishlistId: ID!, \n $wishlistItems: [WishlistItemUpdateInput!]!,\n ) {\n updateProductsInWishlist(\n wishlistId: $wishlistId\n wishlistItems: $wishlistItems\n ) {\n wishlist {\n ...WISHLIST_FRAGMENT\n }\n user_errors {\n code\n message\n }\n }\n }\n \n ${WISHLIST_FRAGMENT} \n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/wishlist/api';\nimport { state } from '@/wishlist/lib/state';\nimport { handleFetchError } from '@/wishlist//lib/fetch-error';\n\nimport { UPDATE_PRODUCTS_IN_WISHLIST_MUTATION } from './graphql/updateProductsInWishlistMutation';\nimport { Wishlist } from '@/wishlist/data/models/wishlist';\nimport { transformWishlist } from '@/wishlist/data/transforms';\n\nexport const updateProductsInWishlist = async (\n items: {\n wishlistItemId: string;\n quantity: number;\n description: string;\n selectedOptions?: string[];\n enteredOptions?: { uid: string; value: string }[];\n }[]\n): Promise<Wishlist | null> => {\n const wishlistId = state.wishlistId;\n\n if (!wishlistId) {\n throw Error('Wishlist ID is not set');\n }\n\n return fetchGraphQl(UPDATE_PRODUCTS_IN_WISHLIST_MUTATION, {\n variables: {\n wishlistId,\n wishlistItems: items.map(\n ({\n wishlistItemId,\n quantity,\n description,\n selectedOptions: selected_options,\n enteredOptions: entered_options,\n }) => ({\n wishlistItemId,\n quantity,\n description,\n selected_options,\n entered_options,\n })\n ),\n },\n }).then(({ errors, data }) => {\n // handle errors\n const _errors = [\n ...(data?.updateProductsInWishlist?.user_errors ?? []),\n ...(errors ?? []),\n ];\n\n if (_errors.length > 0) return handleFetchError(_errors);\n\n return transformWishlist(data.updateProductsInWishlist.wishlist);\n });\n};\n"],"names":["GET_WISHLIST_BY_ID_QUERY","WISHLIST_ITEM_FRAGMENT","getWishlistById","wishlistId","state","getPersistedWishlistData","fetchGraphQl","errors","data","handleFetchError","_a","payload","transformWishlist","events","UPDATE_PRODUCTS_IN_WISHLIST_MUTATION","WISHLIST_FRAGMENT","updateProductsInWishlist","items","wishlistItemId","quantity","description","selected_options","entered_options","_errors"],"mappings":"yeAmBO,MAAMA,EAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBtCC,CAAsB;AAAA,ECbXC,EAAkB,MAC7BC,GACoC,CAGpC,GAAI,CAACC,EAAM,cACT,OAAOC,EAAA,EAGT,GAAI,CAACF,EACH,MAAM,MAAM,wBAAwB,EAItC,OAAOG,EAAaN,EAA0B,CAC5C,UAAW,CACT,WAAAG,CAAA,CACF,CACD,EAAE,KAAK,CAAC,CAAE,OAAAI,EAAQ,KAAAC,KAAW,OAC5B,GAAID,EAAQ,OAAOE,EAAiBF,CAAM,EAE1C,GAAI,GAACG,EAAAF,GAAA,YAAAA,EAAM,WAAN,MAAAE,EAAgB,aACnB,OAAO,KAGT,MAAMC,EAAUC,EAAkBJ,EAAK,SAAS,WAAW,EAC3D,OAAAK,EAAO,KAAK,gBAAiBF,CAAO,EAC7BA,CACT,CAAC,CACH,ECnCaG,EAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAmB/CC,CAAiB;AAAA,ECbTC,EAA2B,MACtCC,GAO6B,CAC7B,MAAMd,EAAaC,EAAM,WAEzB,GAAI,CAACD,EACH,MAAM,MAAM,wBAAwB,EAGtC,OAAOG,EAAaQ,EAAsC,CACxD,UAAW,CACT,WAAAX,EACA,cAAec,EAAM,IACnB,CAAC,CACC,eAAAC,EACA,SAAAC,EACA,YAAAC,EACA,gBAAiBC,EACjB,eAAgBC,CAAA,KACX,CACL,eAAAJ,EACA,SAAAC,EACA,YAAAC,EACA,iBAAAC,EACA,gBAAAC,CAAA,EACF,CACF,CACF,CACD,EAAE,KAAK,CAAC,CAAE,OAAAf,EAAQ,KAAAC,KAAW,OAE5B,MAAMe,EAAU,CACd,KAAIb,EAAAF,GAAA,YAAAA,EAAM,2BAAN,YAAAE,EAAgC,cAAe,CAAA,EACnD,GAAIH,GAAU,CAAA,CAAC,EAGjB,OAAIgB,EAAQ,OAAS,EAAUd,EAAiBc,CAAO,EAEhDX,EAAkBJ,EAAK,yBAAyB,QAAQ,CACjE,CAAC,CACH"}
package/chunks/Heart.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Copyright 2025 Adobe
1
+ /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
3
  import*as t from"@dropins/tools/preact-compat.js";const o=e=>t.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.734 5.4175C17.8557 3.5275 14.7987 3.5275 12.9105 5.4175L11.9814 6.3475L11.0523 5.4175C9.15407 3.5475 6.09699 3.5775 4.22878 5.4875C2.39054 7.3675 2.39054 10.3675 4.22878 12.2475L5.15789 13.1775L11.9814 20.0075L18.8048 13.1775L19.734 12.2475C21.6221 10.3675 21.6221 7.3075 19.734 5.4175Z",stroke:"currentColor",strokeWidth:1}));export{o as S};
4
4
  //# sourceMappingURL=Heart.js.map
@@ -1,4 +1,4 @@
1
- /*! Copyright 2025 Adobe
1
+ /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
3
  import*as e from"@dropins/tools/preact-compat.js";const r=t=>e.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12,20.75h0c-.2,0-.39-.08-.53-.22L3.71,12.77c-2.12-2.16-2.12-5.66,0-7.82,1.04-1.06,2.44-1.66,3.93-1.67h.06c1.47,0,2.85,.57,3.9,1.6l.4,.4,.4-.4c1.05-1.05,2.45-1.63,3.94-1.63h0c1.49,0,2.89,.58,3.94,1.63,.02,.02,.03,.03,.05,.05,1.02,1.05,1.59,2.43,1.59,3.9s-.58,2.89-1.63,3.94l-7.76,7.76c-.14,.14-.33,.22-.53,.22Z",stroke:"currentColor"}));export{r as S};
4
4
  //# sourceMappingURL=HeartFilled.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HeartFilled.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/HeartFilled.svg"],"sourcesContent":["import * as React from \"react\";\nconst SvgHeartFilled = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"currentColor\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M12,20.75h0c-.2,0-.39-.08-.53-.22L3.71,12.77c-2.12-2.16-2.12-5.66,0-7.82,1.04-1.06,2.44-1.66,3.93-1.67h.06c1.47,0,2.85,.57,3.9,1.6l.4,.4,.4-.4c1.05-1.05,2.45-1.63,3.94-1.63h0c1.49,0,2.89,.58,3.94,1.63,.02,.02,.03,.03,.05,.05,1.02,1.05,1.59,2.43,1.59,3.9s-.58,2.89-1.63,3.94l-7.76,7.76c-.14,.14-.33,.22-.53,.22Z\", stroke: \"currentColor\" }));\nexport default SvgHeartFilled;\n"],"names":["SvgHeartFilled","props","React"],"mappings":"kDACK,MAACA,EAAkBC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,eAAgB,MAAO,6BAA8B,GAAGD,CAAO,EAAkBC,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,yTAA0T,OAAQ,cAAc,CAAE,CAAC","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"HeartFilled.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/HeartFilled.svg"],"sourcesContent":["import * as React from \"react\";\nconst SvgHeartFilled = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"currentColor\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M12,20.75h0c-.2,0-.39-.08-.53-.22L3.71,12.77c-2.12-2.16-2.12-5.66,0-7.82,1.04-1.06,2.44-1.66,3.93-1.67h.06c1.47,0,2.85,.57,3.9,1.6l.4,.4,.4-.4c1.05-1.05,2.45-1.63,3.94-1.63h0c1.49,0,2.89,.58,3.94,1.63,.02,.02,.03,.03,.05,.05,1.02,1.05,1.59,2.43,1.59,3.9s-.58,2.89-1.63,3.94l-7.76,7.76c-.14,.14-.33,.22-.53,.22Z\", stroke: \"currentColor\" }));\nexport default SvgHeartFilled;\n"],"names":["SvgHeartFilled","props","React"],"mappings":"kDACK,MAACA,EAAkBC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,eAAgB,MAAO,6BAA8B,GAAGD,CAAK,EAAoBC,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,yTAA0T,OAAQ,cAAc,CAAE,CAAC","x_google_ignoreList":[0]}
package/chunks/Trash.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Copyright 2025 Adobe
1
+ /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
3
  import*as e from"@dropins/tools/preact-compat.js";const r=t=>e.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},e.createElement("g",{clipPath:"url(#clip0_102_196)"},e.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3601 18.16H6.5601L4.8801 3H2.3501M19.6701 19.59C19.6701 20.3687 19.0388 21 18.2601 21C17.4814 21 16.8501 20.3687 16.8501 19.59C16.8501 18.8113 17.4814 18.18 18.2601 18.18C19.0388 18.18 19.6701 18.8113 19.6701 19.59ZM7.42986 19.59C7.42986 20.3687 6.79858 21 6.01986 21C5.24114 21 4.60986 20.3687 4.60986 19.59C4.60986 18.8113 5.24114 18.18 6.01986 18.18C6.79858 18.18 7.42986 18.8113 7.42986 19.59Z",stroke:"currentColor",strokeLinejoin:"round"}),e.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M5.25 6.37L20.89 8.06L20.14 14.8H6.19",stroke:"currentColor",strokeLinejoin:"round"})),e.createElement("defs",null,e.createElement("clipPath",{id:"clip0_102_196"},e.createElement("rect",{vectorEffect:"non-scaling-stroke",width:19.29,height:19.5,fill:"white",transform:"translate(2.3501 2.25)"})))),o=t=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},e.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M1 5H23",stroke:"currentColor",strokeWidth:1,strokeMiterlimit:10}),e.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.3674 22H6.63446C5.67952 22 4.88992 21.2688 4.8379 20.3338L4 5H20L19.1621 20.3338C19.1119 21.2688 18.3223 22 17.3655 22H17.3674Z",stroke:"currentColor",strokeWidth:1,strokeMiterlimit:10}),e.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.87189 2H14.1281C14.6085 2 15 2.39766 15 2.88889V5H9V2.88889C9 2.39912 9.39006 2 9.87189 2Z",stroke:"currentColor",strokeWidth:1,strokeMiterlimit:10}),e.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M8.87402 8.58057L9.39348 17.682",stroke:"currentColor",strokeWidth:1,strokeMiterlimit:10}),e.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M14.6673 8.58057L14.146 17.682",stroke:"currentColor",strokeWidth:1,strokeMiterlimit:10}));export{r as S,o as a};
4
4
  //# sourceMappingURL=Trash.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Trash.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Cart.svg","../../node_modules/@adobe-commerce/elsie/src/icons/Trash.svg"],"sourcesContent":["import * as React from \"react\";\nconst SvgCart = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { clipPath: \"url(#clip0_102_196)\" }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M18.3601 18.16H6.5601L4.8801 3H2.3501M19.6701 19.59C19.6701 20.3687 19.0388 21 18.2601 21C17.4814 21 16.8501 20.3687 16.8501 19.59C16.8501 18.8113 17.4814 18.18 18.2601 18.18C19.0388 18.18 19.6701 18.8113 19.6701 19.59ZM7.42986 19.59C7.42986 20.3687 6.79858 21 6.01986 21C5.24114 21 4.60986 20.3687 4.60986 19.59C4.60986 18.8113 5.24114 18.18 6.01986 18.18C6.79858 18.18 7.42986 18.8113 7.42986 19.59Z\", stroke: \"currentColor\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M5.25 6.37L20.89 8.06L20.14 14.8H6.19\", stroke: \"currentColor\", strokeLinejoin: \"round\" })), /* @__PURE__ */ React.createElement(\"defs\", null, /* @__PURE__ */ React.createElement(\"clipPath\", { id: \"clip0_102_196\" }, /* @__PURE__ */ React.createElement(\"rect\", { vectorEffect: \"non-scaling-stroke\", width: 19.29, height: 19.5, fill: \"white\", transform: \"translate(2.3501 2.25)\" }))));\nexport default SvgCart;\n","import * as React from \"react\";\nconst SvgTrash = (props) => /* @__PURE__ */ React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M1 5H23\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M17.3674 22H6.63446C5.67952 22 4.88992 21.2688 4.8379 20.3338L4 5H20L19.1621 20.3338C19.1119 21.2688 18.3223 22 17.3655 22H17.3674Z\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M9.87189 2H14.1281C14.6085 2 15 2.39766 15 2.88889V5H9V2.88889C9 2.39912 9.39006 2 9.87189 2Z\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M8.87402 8.58057L9.39348 17.682\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M14.6673 8.58057L14.146 17.682\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }));\nexport default SvgTrash;\n"],"names":["SvgCart","props","React","SvgTrash"],"mappings":"kDACK,MAACA,EAAWC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAO,EAAkBC,EAAM,cAAc,IAAK,CAAE,SAAU,qBAAqB,EAAoBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,oZAAqZ,OAAQ,eAAgB,eAAgB,OAAO,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,wCAAyC,OAAQ,eAAgB,eAAgB,OAAS,CAAA,CAAC,EAAmBA,EAAM,cAAc,OAAQ,KAAsBA,EAAM,cAAc,WAAY,CAAE,GAAI,eAAe,EAAoBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,MAAO,MAAO,OAAQ,KAAM,KAAM,QAAS,UAAW,wBAA0B,CAAA,CAAC,CAAC,CAAC,ECA7uCC,EAAYF,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,6BAA8B,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,GAAGD,GAAyBC,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,UAAW,OAAQ,eAAgB,YAAa,EAAG,iBAAkB,EAAE,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,sIAAuI,OAAQ,eAAgB,YAAa,EAAG,iBAAkB,GAAI,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,gGAAiG,OAAQ,eAAgB,YAAa,EAAG,iBAAkB,GAAI,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,kCAAmC,OAAQ,eAAgB,YAAa,EAAG,iBAAkB,GAAI,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,iCAAkC,OAAQ,eAAgB,YAAa,EAAG,iBAAkB,GAAI,CAAC","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"Trash.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Cart.svg","../../node_modules/@adobe-commerce/elsie/src/icons/Trash.svg"],"sourcesContent":["import * as React from \"react\";\nconst SvgCart = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { clipPath: \"url(#clip0_102_196)\" }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M18.3601 18.16H6.5601L4.8801 3H2.3501M19.6701 19.59C19.6701 20.3687 19.0388 21 18.2601 21C17.4814 21 16.8501 20.3687 16.8501 19.59C16.8501 18.8113 17.4814 18.18 18.2601 18.18C19.0388 18.18 19.6701 18.8113 19.6701 19.59ZM7.42986 19.59C7.42986 20.3687 6.79858 21 6.01986 21C5.24114 21 4.60986 20.3687 4.60986 19.59C4.60986 18.8113 5.24114 18.18 6.01986 18.18C6.79858 18.18 7.42986 18.8113 7.42986 19.59Z\", stroke: \"currentColor\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M5.25 6.37L20.89 8.06L20.14 14.8H6.19\", stroke: \"currentColor\", strokeLinejoin: \"round\" })), /* @__PURE__ */ React.createElement(\"defs\", null, /* @__PURE__ */ React.createElement(\"clipPath\", { id: \"clip0_102_196\" }, /* @__PURE__ */ React.createElement(\"rect\", { vectorEffect: \"non-scaling-stroke\", width: 19.29, height: 19.5, fill: \"white\", transform: \"translate(2.3501 2.25)\" }))));\nexport default SvgCart;\n","import * as React from \"react\";\nconst SvgTrash = (props) => /* @__PURE__ */ React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M1 5H23\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M17.3674 22H6.63446C5.67952 22 4.88992 21.2688 4.8379 20.3338L4 5H20L19.1621 20.3338C19.1119 21.2688 18.3223 22 17.3655 22H17.3674Z\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M9.87189 2H14.1281C14.6085 2 15 2.39766 15 2.88889V5H9V2.88889C9 2.39912 9.39006 2 9.87189 2Z\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M8.87402 8.58057L9.39348 17.682\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M14.6673 8.58057L14.146 17.682\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }));\nexport default SvgTrash;\n"],"names":["SvgCart","props","React","SvgTrash"],"mappings":"kDACK,MAACA,EAAWC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAK,EAAoBC,EAAM,cAAc,IAAK,CAAE,SAAU,qBAAqB,EAAoBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,oZAAqZ,OAAQ,eAAgB,eAAgB,OAAO,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,wCAAyC,OAAQ,eAAgB,eAAgB,OAAO,CAAE,CAAC,EAAmBA,EAAM,cAAc,OAAQ,KAAsBA,EAAM,cAAc,WAAY,CAAE,GAAI,eAAe,EAAoBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,MAAO,MAAO,OAAQ,KAAM,KAAM,QAAS,UAAW,wBAAwB,CAAE,CAAC,CAAC,CAAC,ECA7uCC,EAAYF,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,6BAA8B,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,GAAGD,GAAyBC,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,UAAW,OAAQ,eAAgB,YAAa,EAAG,iBAAkB,EAAE,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,sIAAuI,OAAQ,eAAgB,YAAa,EAAG,iBAAkB,GAAI,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,gGAAiG,OAAQ,eAAgB,YAAa,EAAG,iBAAkB,GAAI,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,kCAAmC,OAAQ,eAAgB,YAAa,EAAG,iBAAkB,GAAI,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,iCAAkC,OAAQ,eAAgB,YAAa,EAAG,iBAAkB,GAAI,CAAC","x_google_ignoreList":[0,1]}
@@ -1,4 +1,4 @@
1
- /*! Copyright 2025 Adobe
1
+ /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
3
  import{jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import{InLineAlert as m,Icon as g}from"@dropins/tools/components.js";import*as r from"@dropins/tools/preact-compat.js";import{S as h,a as v}from"./Trash.js";import{S as p}from"./HeartFilled.js";import{useText as E}from"@dropins/tools/i18n.js";const n=e=>r.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_841_1324)"},r.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),r.createElement("defs",null,r.createElement("clipPath",{id:"clip0_841_1324"},r.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)",strokeWidth:1})))),k=({action:e,item:i,routeToWishlist:t})=>{const s=E({addHeading:"Wishlist.Alert.addProduct.heading",addMessage:"Wishlist.Alert.addProduct.message",removeHeading:"Wishlist.Alert.removeProduct.heading",removeMessage:"Wishlist.Alert.removeProduct.message",moveHeading:"Wishlist.Alert.moveToCart.heading",moveMessage:"Wishlist.Alert.moveToCart.message",viewWishlist:"Wishlist.Alert.viewWishlist",addErrorHeading:"Wishlist.Alert.addError.heading",addErrorMessage:"Wishlist.Alert.addError.message",removeErrorHeading:"Wishlist.Alert.removeError.heading",removeErrorMessage:"Wishlist.Alert.removeError.message"});if(!e)return null;const l=s[`${e}Heading`],o=s[`${e}Message`],d={add:p,remove:v,move:h,addError:n,removeError:n},c=t?location.href.includes(t):!1;return a(m,{"data-testid":"wishlist-alert",heading:l,description:i?o.replace("{product}",i.product.name):o,type:e==="addError"||e==="removeError"?"warning":"success",icon:a(g,{source:d[e],size:"16"}),actionButtonPosition:"top",additionalActions:!c&&t?[{label:s.viewWishlist,onClick:()=>{location.href=t}}]:void 0})};export{k as W};
4
4
  //# sourceMappingURL=WishlistAlert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WishlistAlert.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Warning.svg","/@dropins/storefront-wishlist/src/containers/WishlistAlert/WishlistAlert.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgWarning = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Warning_Base\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { clipPath: \"url(#clip0_841_1324)\" }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z\", stroke: \"currentColor\", strokeWidth: 1, strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z\", stroke: \"currentColor\", strokeWidth: 1, strokeLinecap: \"round\", strokeLinejoin: \"round\" })), /* @__PURE__ */ React.createElement(\"defs\", null, /* @__PURE__ */ React.createElement(\"clipPath\", { id: \"clip0_841_1324\" }, /* @__PURE__ */ React.createElement(\"rect\", { width: 24, height: 21, fill: \"white\", transform: \"translate(0 1.5)\", strokeWidth: 1 }))));\nexport default SvgWarning;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { Icon, InLineAlert } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Cart, HeartFilled, Trash, Warning } from '@adobe-commerce/elsie/icons';\n\nexport interface WishlistAlertProps extends HTMLAttributes<HTMLDivElement> {\n action: 'add' | 'remove' | 'move' | 'addError' | 'removeError';\n item?: { product: { name: string } };\n routeToWishlist?: string;\n}\n\nexport const WishlistAlert: FunctionComponent<WishlistAlertProps> = ({\n action,\n item,\n routeToWishlist,\n}) => {\n const dictionary = useText({\n addHeading: 'Wishlist.Alert.addProduct.heading',\n addMessage: 'Wishlist.Alert.addProduct.message',\n removeHeading: 'Wishlist.Alert.removeProduct.heading',\n removeMessage: 'Wishlist.Alert.removeProduct.message',\n moveHeading: 'Wishlist.Alert.moveToCart.heading',\n moveMessage: 'Wishlist.Alert.moveToCart.message',\n viewWishlist: 'Wishlist.Alert.viewWishlist',\n addErrorHeading: 'Wishlist.Alert.addError.heading',\n addErrorMessage: 'Wishlist.Alert.addError.message',\n removeErrorHeading: 'Wishlist.Alert.removeError.heading',\n removeErrorMessage: 'Wishlist.Alert.removeError.message',\n });\n\n if (!action) {\n return null;\n }\n\n const heading = dictionary[`${action}Heading`];\n const message = dictionary[`${action}Message`];\n const iconMap = {\n add: HeartFilled,\n remove: Trash,\n move: Cart,\n addError: Warning,\n removeError: Warning,\n };\n\n const isWishlistPage = routeToWishlist\n ? location.href.includes(routeToWishlist)\n : false;\n\n return (\n <InLineAlert\n data-testid=\"wishlist-alert\"\n heading={heading}\n description={\n item ? message.replace('{product}', item.product.name) : message\n }\n type={\n action === 'addError' || action === 'removeError'\n ? 'warning'\n : 'success'\n }\n icon={<Icon source={iconMap[action]} size=\"16\" />}\n actionButtonPosition=\"top\"\n additionalActions={\n !isWishlistPage && routeToWishlist\n ? [\n {\n label: dictionary.viewWishlist,\n onClick: () => {\n location.href = routeToWishlist;\n },\n },\n ]\n : undefined\n }\n />\n );\n};\n"],"names":["SvgWarning","props","React","WishlistAlert","action","item","routeToWishlist","dictionary","useText","heading","message","iconMap","HeartFilled","Trash","Cart","Warning","isWishlistPage","jsx","InLineAlert","Icon"],"mappings":"8SACA,MAAMA,EAAcC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,oBAAqB,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,GAAyBC,EAAM,cAAc,IAAK,CAAE,SAAU,sBAAsB,EAAoBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,6DAA8D,OAAQ,eAAgB,YAAa,EAAG,cAAe,QAAS,eAAgB,OAAS,CAAA,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,qIAAsI,OAAQ,eAAgB,YAAa,EAAG,cAAe,QAAS,eAAgB,OAAO,CAAE,CAAC,EAAmBA,EAAM,cAAc,OAAQ,KAAsBA,EAAM,cAAc,WAAY,CAAE,GAAI,gBAAgB,EAAoBA,EAAM,cAAc,OAAQ,CAAE,MAAO,GAAI,OAAQ,GAAI,KAAM,QAAS,UAAW,mBAAoB,YAAa,EAAG,CAAC,CAAC,CAAC,EC4B3jCC,EAAuD,CAAC,CACnE,OAAAC,EACA,KAAAC,EACA,gBAAAC,CACF,IAAM,CACJ,MAAMC,EAAaC,EAAQ,CACzB,WAAY,oCACZ,WAAY,oCACZ,cAAe,uCACf,cAAe,uCACf,YAAa,oCACb,YAAa,oCACb,aAAc,8BACd,gBAAiB,kCACjB,gBAAiB,kCACjB,mBAAoB,qCACpB,mBAAoB,oCAAA,CACrB,EAED,GAAI,CAACJ,EACI,OAAA,KAGT,MAAMK,EAAUF,EAAW,GAAGH,CAAM,SAAS,EACvCM,EAAUH,EAAW,GAAGH,CAAM,SAAS,EACvCO,EAAU,CACd,IAAKC,EACL,OAAQC,EACR,KAAMC,EACN,SAAUC,EACV,YAAaA,CACf,EAEMC,EAAiBV,EACnB,SAAS,KAAK,SAASA,CAAe,EACtC,GAGF,OAAAW,EAACC,EAAA,CACC,cAAY,iBACZ,QAAAT,EACA,YACEJ,EAAOK,EAAQ,QAAQ,YAAaL,EAAK,QAAQ,IAAI,EAAIK,EAE3D,KACEN,IAAW,YAAcA,IAAW,cAChC,UACA,UAEN,OAAOe,EAAK,CAAA,OAAQR,EAAQP,CAAM,EAAG,KAAK,KAAK,EAC/C,qBAAqB,MACrB,kBACE,CAACY,GAAkBV,EACf,CACE,CACE,MAAOC,EAAW,aAClB,QAAS,IAAM,CACb,SAAS,KAAOD,CAAA,CAClB,CACF,EAEF,MAAA,CAER,CAEJ","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"WishlistAlert.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Warning.svg","/@dropins/storefront-wishlist/src/containers/WishlistAlert/WishlistAlert.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgWarning = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Warning_Base\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { clipPath: \"url(#clip0_841_1324)\" }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z\", stroke: \"currentColor\", strokeWidth: 1, strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z\", stroke: \"currentColor\", strokeWidth: 1, strokeLinecap: \"round\", strokeLinejoin: \"round\" })), /* @__PURE__ */ React.createElement(\"defs\", null, /* @__PURE__ */ React.createElement(\"clipPath\", { id: \"clip0_841_1324\" }, /* @__PURE__ */ React.createElement(\"rect\", { width: 24, height: 21, fill: \"white\", transform: \"translate(0 1.5)\", strokeWidth: 1 }))));\nexport default SvgWarning;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { Icon, InLineAlert } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Cart, HeartFilled, Trash, Warning } from '@adobe-commerce/elsie/icons';\n\nexport interface WishlistAlertProps extends HTMLAttributes<HTMLDivElement> {\n action: 'add' | 'remove' | 'move' | 'addError' | 'removeError';\n item?: { product: { name: string } };\n routeToWishlist?: string;\n}\n\nexport const WishlistAlert: FunctionComponent<WishlistAlertProps> = ({\n action,\n item,\n routeToWishlist,\n}) => {\n const dictionary = useText({\n addHeading: 'Wishlist.Alert.addProduct.heading',\n addMessage: 'Wishlist.Alert.addProduct.message',\n removeHeading: 'Wishlist.Alert.removeProduct.heading',\n removeMessage: 'Wishlist.Alert.removeProduct.message',\n moveHeading: 'Wishlist.Alert.moveToCart.heading',\n moveMessage: 'Wishlist.Alert.moveToCart.message',\n viewWishlist: 'Wishlist.Alert.viewWishlist',\n addErrorHeading: 'Wishlist.Alert.addError.heading',\n addErrorMessage: 'Wishlist.Alert.addError.message',\n removeErrorHeading: 'Wishlist.Alert.removeError.heading',\n removeErrorMessage: 'Wishlist.Alert.removeError.message',\n });\n\n if (!action) {\n return null;\n }\n\n const heading = dictionary[`${action}Heading`];\n const message = dictionary[`${action}Message`];\n const iconMap = {\n add: HeartFilled,\n remove: Trash,\n move: Cart,\n addError: Warning,\n removeError: Warning,\n };\n\n const isWishlistPage = routeToWishlist\n ? location.href.includes(routeToWishlist)\n : false;\n\n return (\n <InLineAlert\n data-testid=\"wishlist-alert\"\n heading={heading}\n description={\n item ? message.replace('{product}', item.product.name) : message\n }\n type={\n action === 'addError' || action === 'removeError'\n ? 'warning'\n : 'success'\n }\n icon={<Icon source={iconMap[action]} size=\"16\" />}\n actionButtonPosition=\"top\"\n additionalActions={\n !isWishlistPage && routeToWishlist\n ? [\n {\n label: dictionary.viewWishlist,\n onClick: () => {\n location.href = routeToWishlist;\n },\n },\n ]\n : undefined\n }\n />\n );\n};\n"],"names":["SvgWarning","props","React","WishlistAlert","action","item","routeToWishlist","dictionary","useText","heading","message","iconMap","HeartFilled","Trash","Cart","Warning","isWishlistPage","jsx","InLineAlert","Icon"],"mappings":"8SACA,MAAMA,EAAcC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,oBAAqB,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,GAAyBC,EAAM,cAAc,IAAK,CAAE,SAAU,sBAAsB,EAAoBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,6DAA8D,OAAQ,eAAgB,YAAa,EAAG,cAAe,QAAS,eAAgB,OAAO,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,qIAAsI,OAAQ,eAAgB,YAAa,EAAG,cAAe,QAAS,eAAgB,OAAO,CAAE,CAAC,EAAmBA,EAAM,cAAc,OAAQ,KAAsBA,EAAM,cAAc,WAAY,CAAE,GAAI,gBAAgB,EAAoBA,EAAM,cAAc,OAAQ,CAAE,MAAO,GAAI,OAAQ,GAAI,KAAM,QAAS,UAAW,mBAAoB,YAAa,EAAG,CAAC,CAAC,CAAC,EC4B3jCC,EAAuD,CAAC,CACnE,OAAAC,EACA,KAAAC,EACA,gBAAAC,CACF,IAAM,CACJ,MAAMC,EAAaC,EAAQ,CACzB,WAAY,oCACZ,WAAY,oCACZ,cAAe,uCACf,cAAe,uCACf,YAAa,oCACb,YAAa,oCACb,aAAc,8BACd,gBAAiB,kCACjB,gBAAiB,kCACjB,mBAAoB,qCACpB,mBAAoB,oCAAA,CACrB,EAED,GAAI,CAACJ,EACH,OAAO,KAGT,MAAMK,EAAUF,EAAW,GAAGH,CAAM,SAAS,EACvCM,EAAUH,EAAW,GAAGH,CAAM,SAAS,EACvCO,EAAU,CACd,IAAKC,EACL,OAAQC,EACR,KAAMC,EACN,SAAUC,EACV,YAAaA,CAAA,EAGTC,EAAiBV,EACnB,SAAS,KAAK,SAASA,CAAe,EACtC,GAEJ,OACEW,EAACC,EAAA,CACC,cAAY,iBACZ,QAAAT,EACA,YACEJ,EAAOK,EAAQ,QAAQ,YAAaL,EAAK,QAAQ,IAAI,EAAIK,EAE3D,KACEN,IAAW,YAAcA,IAAW,cAChC,UACA,UAEN,OAAOe,EAAA,CAAK,OAAQR,EAAQP,CAAM,EAAG,KAAK,KAAK,EAC/C,qBAAqB,MACrB,kBACE,CAACY,GAAkBV,EACf,CACE,CACE,MAAOC,EAAW,aAClB,QAAS,IAAM,CACb,SAAS,KAAOD,CAClB,CAAA,CACF,EAEF,MAAA,CAAA,CAIZ","x_google_ignoreList":[0]}
@@ -1,4 +1,4 @@
1
- /*! Copyright 2025 Adobe
1
+ /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
3
  import{jsx as s,jsxs as w,Fragment as B}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as ut,useState as pt,useEffect as vt,useCallback as at}from"@dropins/tools/preact-compat.js";import{classes as v}from"@dropins/tools/lib.js";import{Button as x,Icon as lt,Price as I,Image as yt}from"@dropins/tools/components.js";import{events as dt}from"@dropins/tools/event-bus.js";import{r as bt}from"./removeProductsFromWishlist.js";import{a as Nt,S as At}from"./Trash.js";import{useText as It}from"@dropins/tools/i18n.js";const xt=({className:r,item:t,onCartActionButtonClick:c,onTrashButtonClick:a,routeProdDetailPage:p,imageNode:y,...o})=>{var _,z,k,g,S,q,P;const u=It({cartActionBtn:"ProductItem.CartActionButton",trashActionBtn:"ProductItem.TrashActionButton",customizeActionBtn:"ProductItem.CustomizeActionButton"}),n=((k=(z=(_=t.product)==null?void 0:_.prices)==null?void 0:z.final)==null?void 0:k.amount)<((q=(S=(g=t.product)==null?void 0:g.prices)==null?void 0:S.regular)==null?void 0:q.amount),m=()=>{var e;return s("a",{className:"wishlist-product-item-image","data-testid":"wishlist-product-item-image",href:p(t.product),children:s(Bt,{images:((e=t.product)==null?void 0:e.images)??[],imageNode:y})})},l=()=>{var e,i,h,A,F,W,C,M,T,$,j,E,U,V,Y,G,H,J,K,L,Q,R,X,Z,D,tt,rt,et,st,ct,ot,it,nt;return((h=(i=(e=t.product)==null?void 0:e.prices)==null?void 0:i.final)==null?void 0:h.amount)===void 0&&((W=(F=(A=t.product)==null?void 0:A.prices)==null?void 0:F.final)==null?void 0:W.maximumAmount)!==void 0&&((T=(M=(C=t.product)==null?void 0:C.prices)==null?void 0:M.final)==null?void 0:T.maximumAmount)>0?w(B,{children:[s(I,{className:"wishlist-product-item-price","data-testid":"wishlist-product-item-price",amount:(E=(j=($=t.product)==null?void 0:$.prices)==null?void 0:j.final)==null?void 0:E.minimumAmount,currency:(Y=(V=(U=t.product)==null?void 0:U.prices)==null?void 0:V.final)==null?void 0:Y.currency}),"-",s(I,{className:"wishlist-product-item-price","data-testid":"wishlist-product-item-price",amount:(J=(H=(G=t.product)==null?void 0:G.prices)==null?void 0:H.final)==null?void 0:J.maximumAmount,currency:(Q=(L=(K=t.product)==null?void 0:K.prices)==null?void 0:L.final)==null?void 0:Q.currency})]}):w(B,{children:[s(I,{className:v(["wishlist-product-item-price",n?"strikethrough":""]),"data-testid":"wishlist-product-item-price",amount:(Z=(X=(R=t.product)==null?void 0:R.prices)==null?void 0:X.regular)==null?void 0:Z.amount,currency:(rt=(tt=(D=t.product)==null?void 0:D.prices)==null?void 0:tt.regular)==null?void 0:rt.currency}),n&&s(I,{className:"wishlist-product-item-discounted-price","data-testid":"wishlist-product-item-discounted-price",amount:(ct=(st=(et=t.product)==null?void 0:et.prices)==null?void 0:st.final)==null?void 0:ct.amount,currency:(nt=(it=(ot=t.product)==null?void 0:ot.prices)==null?void 0:it.final)==null?void 0:nt.currency})]})},d=()=>s(x,{"data-testid":"wishlist-product-item-remove-button",className:"wishlist-product-item-button__remove",variant:"tertiary",onClick:()=>a==null?void 0:a(),icon:s(lt,{source:Nt,size:"24",stroke:"2",viewBox:"0 0 24 24","aria-label":u.trashActionBtn})}),N=()=>f()?ft():wt(),f=()=>{var e;return((e=t.product)==null?void 0:e.productType)==="complex"?mt():!0},b=ut(()=>{var e;return((e=t.selectedOptions)==null?void 0:e.map(i=>i.uid))||[]},[t.selectedOptions]),O=ut(()=>{const e=t.product.options||[],i=e.filter(h=>h.required);return i.length===0?e:i},[t.product.options]),mt=()=>O.every(e=>{var i;return(i=e.items)==null?void 0:i.some(h=>b.includes(h.id))}),ht=()=>b.length===0?null:s("div",{className:"wishlist-product-item-options",children:O.map(e=>{var h;const i=(h=e.items)==null?void 0:h.find(A=>b.includes(A.id));return i?w("div",{className:"wishlist-product-item-option",children:[w("span",{className:"wishlist-product-item-option__attribute",children:[e.label,":"]})," ",s("span",{className:"wishlist-product-item-option__label",children:i.label})]},e.type):null})}),ft=()=>{var e;return s(x,{"data-testid":"wishlist-product-item-move-to-cart-button",size:"medium",type:"submit",icon:s(lt,{source:At}),disabled:!((e=t.product)!=null&&e.inStock),"aria-label":u.cartActionBtn,onClick:()=>c==null?void 0:c(),children:u.cartActionBtn})},wt=()=>s(x,{"data-testid":"wishlist-product-item-customize-button",size:"medium",type:"submit","aria-label":u.customizeActionBtn,href:p(t.product),children:u.customizeActionBtn});return s("div",{...o,className:v(["wishlist-product-item",r]),children:w("div",{className:"wishlist-product-item__content",children:[m(),w("div",{className:"wishlist-product-item__title","data-testid":"wishlist-product-item-header",children:[s("a",{className:"wishlist-product-item-name","data-testid":"wishlist-product-item-name",href:p(t.product),children:(P=t.product)==null?void 0:P.name}),d(),l()]}),ht(),N()]})})},Bt=({className:r,children:t,images:c,imageNode:a,...p})=>{const[y,o]=pt(0);return w(B,{children:[s("div",{...p,className:v(["image-carousel",r]),children:s("div",{className:v(["overflow-hidden relative max-w-[200px]",r]),children:c==null?void 0:c.map((u,n)=>{const m={className:v(["image-carousel-image",r]),src:u.url,alt:u.label};return n!==y?null:typeof a=="function"?a({defaultImageProps:m}):a||s(yt,{...m})})})}),(c==null?void 0:c.length)>1&&s("div",{className:v(["absolute","image-switcher-area"]),children:c==null?void 0:c.map((u,n)=>s("span",{className:v(["image-switcher",y===n?"image-switcher-active":"image-switcher-inactive"]),onClick:m=>{o(n),m.preventDefault(),m.stopPropagation()}},n))})]})},Ft=({item:r,getProductData:t,getRefinedProduct:c,moveProdToCart:a,routeProdDetailPage:p,imageNode:y})=>{const[o,u]=pt(null);vt(()=>{let l=!1;async function d(){var N;try{let f;c&&((N=r==null?void 0:r.selectedOptions)==null?void 0:N.length)>0?f=await c(r.product.sku,r.selectedOptions.map(b=>b.uid)):f=t?await t(r==null?void 0:r.product.sku):r==null?void 0:r.product,l||u(f)}catch(f){l||console.error("Failed to fetch product data:",f)}}return d(),()=>{l=!0}},[r,t,c]);const n=at(async(l=!0)=>{try{return await bt([r]),console.log(`Product ${o==null?void 0:o.sku} removed from wishlist!`),l&&dt.emit("wishlist/alert",{action:"remove",item:{...r,product:o}}),!0}catch(d){return console.error(`Product ${o.sku} could not be removed from wishlist`,d),!1}},[r,o]),m=at(async()=>{var l;try{return await a([{sku:o.sku,quantity:1,optionsUIDs:(l=r.selectedOptions)==null?void 0:l.map(d=>d.uid),enteredOptions:r.enteredOptions}]),console.log(`Product ${o.sku} successfully moved to cart 🛒`),dt.emit("wishlist/alert",{action:"move",item:{...r,product:o}}),await n(!1)}catch(d){return console.error("Could not move product to cart: ",d),d.toString().includes("You need to choose options for your item.")&&window.location.replace(p(o)),!1}},[o,r,a,p,n]);return!o||!r?null:s(xt,{item:{...r,product:o},onCartActionButtonClick:m,onTrashButtonClick:n,routeProdDetailPage:p,imageNode:y})};export{Ft as W};
4
4
  //# sourceMappingURL=WishlistItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WishlistItem.js","sources":["/@dropins/storefront-wishlist/src/components/ProductItem/ProductItem.tsx","/@dropins/storefront-wishlist/src/components/ImageCarousel/ImageCarousel.tsx","/@dropins/storefront-wishlist/src/containers/WishlistItem/WishlistItem.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { HTMLAttributes, useMemo } from 'preact/compat';\nimport { FunctionComponent, JSX } from 'preact';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport {\n Button,\n Icon,\n ImageNodeRenderProps,\n Price,\n} from '@adobe-commerce/elsie/components';\nimport { ImageCarousel } from '@/wishlist/components';\nimport { Item, Product } from '@/wishlist/data/models';\nimport { Cart, Trash } from '@adobe-commerce/elsie/icons';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nimport '@/wishlist/components/ProductItem/ProductItem.css';\n\nexport interface ProductItemProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n item?: Item;\n onCartActionButtonClick?: () => boolean;\n onTrashButtonClick?: () => boolean;\n routeProdDetailPage: (product: Product) => string;\n imageNode?: (props: {\n defaultImageProps: ImageNodeRenderProps;\n }) => JSX.Element;\n}\n\nexport const ProductItem: FunctionComponent<ProductItemProps> = ({\n className,\n item,\n onCartActionButtonClick,\n onTrashButtonClick,\n routeProdDetailPage,\n imageNode,\n ...props\n}) => {\n const labels = useText({\n cartActionBtn: 'ProductItem.CartActionButton',\n trashActionBtn: 'ProductItem.TrashActionButton',\n customizeActionBtn: 'ProductItem.CustomizeActionButton',\n });\n\n const discounted =\n item.product?.prices?.final?.amount < item.product?.prices?.regular?.amount;\n\n const renderImage = () => {\n return (\n <a\n className=\"wishlist-product-item-image\"\n data-testid=\"wishlist-product-item-image\"\n href={routeProdDetailPage(item.product)}\n >\n <ImageCarousel\n images={item.product?.images ?? []}\n imageNode={imageNode}\n />\n </a>\n );\n };\n\n const renderPrices = () => {\n if (\n item.product?.prices?.final?.amount === undefined &&\n item.product?.prices?.final?.maximumAmount !== undefined &&\n item.product?.prices?.final?.maximumAmount > 0\n ) {\n return (\n <>\n <Price\n className=\"wishlist-product-item-price\"\n data-testid=\"wishlist-product-item-price\"\n amount={item.product?.prices?.final?.minimumAmount}\n currency={item.product?.prices?.final?.currency}\n />\n -\n <Price\n className=\"wishlist-product-item-price\"\n data-testid=\"wishlist-product-item-price\"\n amount={item.product?.prices?.final?.maximumAmount}\n currency={item.product?.prices?.final?.currency}\n />\n </>\n );\n }\n return (\n <>\n <Price\n className={classes([\n 'wishlist-product-item-price',\n discounted ? 'strikethrough' : '',\n ])}\n data-testid=\"wishlist-product-item-price\"\n amount={item.product?.prices?.regular?.amount}\n currency={item.product?.prices?.regular?.currency}\n />\n\n {discounted && (\n <Price\n className=\"wishlist-product-item-discounted-price\"\n data-testid=\"wishlist-product-item-discounted-price\"\n amount={item.product?.prices?.final?.amount}\n currency={item.product?.prices?.final?.currency}\n />\n )}\n </>\n );\n };\n\n const renderTrashButton = () => {\n return (\n <Button\n data-testid=\"wishlist-product-item-remove-button\"\n className=\"wishlist-product-item-button__remove\"\n variant=\"tertiary\"\n onClick={() => onTrashButtonClick?.()}\n icon={\n <Icon\n source={Trash}\n size=\"24\"\n stroke=\"2\"\n viewBox=\"0 0 24 24\"\n aria-label={labels.trashActionBtn}\n />\n }\n />\n );\n };\n\n const renderMainActionButton = () => {\n return isProductReady()\n ? renderMoveToCartButton()\n : renderCustomizeButton();\n };\n\n const isProductReady = () => {\n if (item.product?.productType === 'complex') {\n return areAllRequiredOptionsIncluded();\n }\n return true;\n };\n\n const selectedOptions = useMemo(\n () => item.selectedOptions?.map((opt: any) => opt.uid) || [],\n [item.selectedOptions]\n );\n\n const requiredOptions = useMemo(() => {\n const options = item.product.options || [];\n const required = options.filter((option: any) => option.required);\n return required.length === 0 ? options : required;\n }, [item.product.options]);\n\n const areAllRequiredOptionsIncluded = (): boolean => {\n return requiredOptions.every((option: any) =>\n option.items?.some((item: any) => selectedOptions.includes(item.id))\n );\n };\n\n const renderOptions = () => {\n if (selectedOptions.length === 0) return null;\n\n return (\n <div className=\"wishlist-product-item-options\">\n {requiredOptions.map((option: any) => {\n const selectedValue = option.items?.find((item: any) =>\n selectedOptions.includes(item.id)\n );\n return selectedValue ? (\n <div key={option.type} className=\"wishlist-product-item-option\">\n <span className=\"wishlist-product-item-option__attribute\">\n {option.label}:\n </span>\n &nbsp;\n <span className=\"wishlist-product-item-option__label\">\n {selectedValue.label}\n </span>\n </div>\n ) : null;\n })}\n </div>\n );\n };\n\n const renderMoveToCartButton = () => {\n return (\n <Button\n data-testid=\"wishlist-product-item-move-to-cart-button\"\n size=\"medium\"\n type=\"submit\"\n icon={<Icon source={Cart} />}\n disabled={!item.product?.inStock}\n aria-label={labels.cartActionBtn}\n onClick={() => onCartActionButtonClick?.()}\n >\n {labels.cartActionBtn}\n </Button>\n );\n };\n\n const renderCustomizeButton = () => {\n return (\n <Button\n data-testid=\"wishlist-product-item-customize-button\"\n size=\"medium\"\n type=\"submit\"\n aria-label={labels.customizeActionBtn}\n href={routeProdDetailPage(item.product)}\n >\n {labels.customizeActionBtn}\n </Button>\n );\n };\n\n return (\n <div {...props} className={classes(['wishlist-product-item', className])}>\n <div className=\"wishlist-product-item__content\">\n {renderImage()}\n <div\n className=\"wishlist-product-item__title\"\n data-testid=\"wishlist-product-item-header\"\n >\n <a\n className=\"wishlist-product-item-name\"\n data-testid=\"wishlist-product-item-name\"\n href={routeProdDetailPage(item.product)}\n >\n {item.product?.name}\n </a>\n\n {renderTrashButton()}\n {renderPrices()}\n </div>\n {renderOptions()}\n {renderMainActionButton()}\n </div>\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent, JSX } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { Image, ImageNodeRenderProps } from '@adobe-commerce/elsie/components';\nimport { useState } from 'react';\n\nimport '@/wishlist/components/ImageCarousel/ImageCarousel.css';\n\nexport interface ImageCarouselProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n children?: any;\n images: Image[];\n imageNode?: (props: {\n defaultImageProps: ImageNodeRenderProps;\n }) => JSX.Element;\n}\n\nexport const ImageCarousel: FunctionComponent<ImageCarouselProps> = ({\n className,\n children,\n images,\n imageNode,\n ...props\n}) => {\n const [carouselIndex, setCarouselIndex] = useState(0);\n\n return (\n <>\n <div {...props} className={classes(['image-carousel', className])}>\n <div\n className={classes([\n 'overflow-hidden relative max-w-[200px]',\n className,\n ])}\n >\n {images?.map(\n (image: ImageCarouselProps['images'][0], index: number) => {\n const defaultProps = {\n className: classes(['image-carousel-image', className]),\n src: image.url,\n alt: image.label,\n } as const;\n\n if (index !== carouselIndex) {\n return null;\n }\n\n return typeof imageNode === 'function'\n ? imageNode({\n defaultImageProps: defaultProps,\n })\n : imageNode || <Image {...defaultProps} />;\n }\n )}\n </div>\n </div>\n {images?.length > 1 && (\n <div className={classes(['absolute', 'image-switcher-area'])}>\n {images?.map(\n (_image: ImageCarouselProps['images'][0], index: number) => {\n return (\n <span\n className={classes([\n 'image-switcher',\n carouselIndex === index\n ? 'image-switcher-active'\n : 'image-switcher-inactive',\n ])}\n key={index}\n onClick={(event: MouseEvent | TouchEvent) => {\n setCarouselIndex(index);\n event.preventDefault(); // prevent navigate on click since ImageCarousel is wrapped in a link\n event.stopPropagation();\n }}\n />\n );\n }\n )}\n </div>\n )}\n </>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n HTMLAttributes,\n useEffect,\n useState,\n useCallback,\n} from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { ProductItem } from '@/wishlist/components';\nimport { Item, Product } from '@/wishlist/data/models';\nimport { removeProductsFromWishlist } from '@/wishlist/api';\nimport { events } from '@adobe-commerce/event-bus';\nimport { ImageNodeRenderProps } from '@adobe-commerce/elsie/components';\nimport { JSX } from 'preact';\n\nexport interface WishlistItemProps extends HTMLAttributes<HTMLDivElement> {\n item: Item;\n getProductData?: (sku: string) => Promise<Product | null>;\n getRefinedProduct?: (\n sku: string,\n optionUIDs: string[],\n anchorOptions?: string[],\n raw?: boolean\n ) => Promise<Product | null>;\n moveProdToCart: (\n products: {\n sku: string;\n quantity: number;\n optionsUIDs?: [];\n enteredOptions?: [];\n }[]\n ) => Promise<any>;\n routeProdDetailPage: (product: Product) => string;\n imageNode?: (props: {\n defaultImageProps: ImageNodeRenderProps;\n }) => JSX.Element;\n}\n\nexport const WishlistItem: Container<WishlistItemProps> = ({\n item,\n getProductData,\n getRefinedProduct,\n moveProdToCart,\n routeProdDetailPage,\n imageNode,\n}: WishlistItemProps) => {\n const [productData, setProductData] = useState<Product | null>(null);\n\n useEffect(() => {\n let cancelled = false;\n\n async function fetchProductData() {\n try {\n let data: Product | null;\n if (getRefinedProduct && item?.selectedOptions?.length > 0) {\n data = await getRefinedProduct(\n item.product.sku,\n item.selectedOptions.map((option: { uid: any }) => option.uid)\n );\n } else {\n data = getProductData\n ? await getProductData(item?.product.sku)\n : item?.product;\n }\n if (!cancelled) setProductData(data);\n } catch (err) {\n if (!cancelled) {\n console.error('Failed to fetch product data:', err);\n }\n }\n }\n\n fetchProductData();\n\n return () => {\n cancelled = true;\n };\n }, [item, getProductData, getRefinedProduct]);\n\n /**\n * Removes product from wishlist\n */\n const removeProductFromWishlist = useCallback(\n async (showAlert: boolean = true): Promise<boolean> => {\n try {\n await removeProductsFromWishlist([item]);\n console.log(`Product ${productData?.sku} removed from wishlist!`);\n if (showAlert) {\n events.emit('wishlist/alert', {\n action: 'remove',\n item: { ...item, product: productData },\n });\n }\n return true;\n } catch (error) {\n console.error(\n `Product ${productData.sku} could not be removed from wishlist`,\n error\n );\n return false;\n }\n },\n [item, productData]\n );\n\n /**\n * Moves product to cart\n */\n const moveProductToCart = useCallback(async (): Promise<boolean> => {\n try {\n await moveProdToCart([\n {\n sku: productData.sku,\n quantity: 1,\n optionsUIDs: item.selectedOptions?.map(\n (option: { uid: any }) => option.uid\n ),\n enteredOptions: item.enteredOptions,\n },\n ]);\n console.log(`Product ${productData.sku} successfully moved to cart 🛒`);\n events.emit('wishlist/alert', {\n action: 'move',\n item: { ...item, product: productData },\n });\n return await removeProductFromWishlist(false);\n } catch (error) {\n console.error('Could not move product to cart: ', error);\n if (\n error.toString().includes('You need to choose options for your item.')\n ) {\n window.location.replace(routeProdDetailPage(productData));\n }\n return false;\n }\n }, [\n productData,\n item,\n moveProdToCart,\n routeProdDetailPage,\n removeProductFromWishlist,\n ]);\n\n if (!productData || !item) return null;\n\n return (\n <ProductItem\n item={{ ...item, product: productData }}\n onCartActionButtonClick={moveProductToCart}\n onTrashButtonClick={removeProductFromWishlist}\n routeProdDetailPage={routeProdDetailPage}\n imageNode={imageNode}\n />\n );\n};\n"],"names":["ProductItem","className","item","onCartActionButtonClick","onTrashButtonClick","routeProdDetailPage","imageNode","props","labels","useText","discounted","_c","_b","_a","_f","_e","_d","renderImage","jsx","ImageCarousel","renderPrices","_i","_h","_g","jsxs","Fragment","Price","_l","_k","_j","_o","_n","_m","_r","_q","_p","_u","_t","_s","classes","_x","_w","_v","_A","_z","_y","_D","_C","_B","_G","_F","_E","renderTrashButton","Button","Icon","Trash","renderMainActionButton","isProductReady","renderMoveToCartButton","renderCustomizeButton","areAllRequiredOptionsIncluded","selectedOptions","useMemo","opt","requiredOptions","options","required","option","renderOptions","selectedValue","Cart","children","images","carouselIndex","setCarouselIndex","useState","image","index","defaultProps","Image","_image","event","WishlistItem","getProductData","getRefinedProduct","moveProdToCart","productData","setProductData","useEffect","cancelled","fetchProductData","data","err","removeProductFromWishlist","useCallback","showAlert","removeProductsFromWishlist","events","error","moveProductToCart"],"mappings":"4gBA4CO,MAAMA,GAAmD,CAAC,CAC/D,UAAAC,EACA,KAAAC,EACA,wBAAAC,EACA,mBAAAC,EACA,oBAAAC,EACA,UAAAC,EACA,GAAGC,CACL,IAAM,mBACJ,MAAMC,EAASC,GAAQ,CACrB,cAAe,+BACf,eAAgB,gCAChB,mBAAoB,mCAAA,CACrB,EAEKC,IACJC,GAAAC,GAAAC,EAAAX,EAAK,UAAL,YAAAW,EAAc,SAAd,YAAAD,EAAsB,QAAtB,YAAAD,EAA6B,UAASG,GAAAC,GAAAC,EAAAd,EAAK,UAAL,YAAAc,EAAc,SAAd,YAAAD,EAAsB,UAAtB,YAAAD,EAA+B,QAEjEG,EAAc,IAAM,OAEtB,OAAAC,EAAC,IAAA,CACC,UAAU,8BACV,cAAY,8BACZ,KAAMb,EAAoBH,EAAK,OAAO,E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,EAAAX,EAAK,kBAAL,YAAAW,EAAsB,IAChCsD,GAAyBA,EAAO,KAEnC,eAAgBjE,EAAK,cAAA,CACvB,CACD,EACD,QAAQ,IAAI,WAAWoF,EAAY,GAAG,gCAAgC,EACtEW,GAAO,KAAK,iBAAkB,CAC5B,OAAQ,OACR,KAAM,CAAE,GAAG/F,EAAM,QAASoF,CAAY,CAAA,CACvC,EACM,MAAMO,EAA0B,EAAK,QACrCK,EAAO,CACN,eAAA,MAAM,mCAAoCA,CAAK,EAErDA,EAAM,SAAA,EAAW,SAAS,2CAA2C,GAErE,OAAO,SAAS,QAAQ7F,EAAoBiF,CAAW,CAAC,EAEnD,EAAA,CACT,EACC,CACDA,EACApF,EACAmF,EACAhF,EACAwF,CAAA,CACD,EAED,MAAI,CAACP,GAAe,CAACpF,EAAa,KAGhCgB,EAAClB,GAAA,CACC,KAAM,CAAE,GAAGE,EAAM,QAASoF,CAAY,EACtC,wBAAyBa,EACzB,mBAAoBN,EACpB,oBAAAxF,EACA,UAAAC,CAAA,CACF,CAEJ"}
1
+ {"version":3,"file":"WishlistItem.js","sources":["/@dropins/storefront-wishlist/src/components/ProductItem/ProductItem.tsx","/@dropins/storefront-wishlist/src/components/ImageCarousel/ImageCarousel.tsx","/@dropins/storefront-wishlist/src/containers/WishlistItem/WishlistItem.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { HTMLAttributes, useMemo } from 'preact/compat';\nimport { FunctionComponent, JSX } from 'preact';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport {\n Button,\n Icon,\n ImageNodeRenderProps,\n Price,\n} from '@adobe-commerce/elsie/components';\nimport { ImageCarousel } from '@/wishlist/components';\nimport { Item, Product } from '@/wishlist/data/models';\nimport { Cart, Trash } from '@adobe-commerce/elsie/icons';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nimport '@/wishlist/components/ProductItem/ProductItem.css';\n\nexport interface ProductItemProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n item?: Item;\n onCartActionButtonClick?: () => boolean;\n onTrashButtonClick?: () => boolean;\n routeProdDetailPage: (product: Product) => string;\n imageNode?: (props: {\n defaultImageProps: ImageNodeRenderProps;\n }) => JSX.Element;\n}\n\nexport const ProductItem: FunctionComponent<ProductItemProps> = ({\n className,\n item,\n onCartActionButtonClick,\n onTrashButtonClick,\n routeProdDetailPage,\n imageNode,\n ...props\n}) => {\n const labels = useText({\n cartActionBtn: 'ProductItem.CartActionButton',\n trashActionBtn: 'ProductItem.TrashActionButton',\n customizeActionBtn: 'ProductItem.CustomizeActionButton',\n });\n\n const discounted =\n item.product?.prices?.final?.amount < item.product?.prices?.regular?.amount;\n\n const renderImage = () => {\n return (\n <a\n className=\"wishlist-product-item-image\"\n data-testid=\"wishlist-product-item-image\"\n href={routeProdDetailPage(item.product)}\n >\n <ImageCarousel\n images={item.product?.images ?? []}\n imageNode={imageNode}\n />\n </a>\n );\n };\n\n const renderPrices = () => {\n if (\n item.product?.prices?.final?.amount === undefined &&\n item.product?.prices?.final?.maximumAmount !== undefined &&\n item.product?.prices?.final?.maximumAmount > 0\n ) {\n return (\n <>\n <Price\n className=\"wishlist-product-item-price\"\n data-testid=\"wishlist-product-item-price\"\n amount={item.product?.prices?.final?.minimumAmount}\n currency={item.product?.prices?.final?.currency}\n />\n -\n <Price\n className=\"wishlist-product-item-price\"\n data-testid=\"wishlist-product-item-price\"\n amount={item.product?.prices?.final?.maximumAmount}\n currency={item.product?.prices?.final?.currency}\n />\n </>\n );\n }\n return (\n <>\n <Price\n className={classes([\n 'wishlist-product-item-price',\n discounted ? 'strikethrough' : '',\n ])}\n data-testid=\"wishlist-product-item-price\"\n amount={item.product?.prices?.regular?.amount}\n currency={item.product?.prices?.regular?.currency}\n />\n\n {discounted && (\n <Price\n className=\"wishlist-product-item-discounted-price\"\n data-testid=\"wishlist-product-item-discounted-price\"\n amount={item.product?.prices?.final?.amount}\n currency={item.product?.prices?.final?.currency}\n />\n )}\n </>\n );\n };\n\n const renderTrashButton = () => {\n return (\n <Button\n data-testid=\"wishlist-product-item-remove-button\"\n className=\"wishlist-product-item-button__remove\"\n variant=\"tertiary\"\n onClick={() => onTrashButtonClick?.()}\n icon={\n <Icon\n source={Trash}\n size=\"24\"\n stroke=\"2\"\n viewBox=\"0 0 24 24\"\n aria-label={labels.trashActionBtn}\n />\n }\n />\n );\n };\n\n const renderMainActionButton = () => {\n return isProductReady()\n ? renderMoveToCartButton()\n : renderCustomizeButton();\n };\n\n const isProductReady = () => {\n if (item.product?.productType === 'complex') {\n return areAllRequiredOptionsIncluded();\n }\n return true;\n };\n\n const selectedOptions = useMemo(\n () => item.selectedOptions?.map((opt: any) => opt.uid) || [],\n [item.selectedOptions]\n );\n\n const requiredOptions = useMemo(() => {\n const options = item.product.options || [];\n const required = options.filter((option: any) => option.required);\n return required.length === 0 ? options : required;\n }, [item.product.options]);\n\n const areAllRequiredOptionsIncluded = (): boolean => {\n return requiredOptions.every((option: any) =>\n option.items?.some((item: any) => selectedOptions.includes(item.id))\n );\n };\n\n const renderOptions = () => {\n if (selectedOptions.length === 0) return null;\n\n return (\n <div className=\"wishlist-product-item-options\">\n {requiredOptions.map((option: any) => {\n const selectedValue = option.items?.find((item: any) =>\n selectedOptions.includes(item.id)\n );\n return selectedValue ? (\n <div key={option.type} className=\"wishlist-product-item-option\">\n <span className=\"wishlist-product-item-option__attribute\">\n {option.label}:\n </span>\n &nbsp;\n <span className=\"wishlist-product-item-option__label\">\n {selectedValue.label}\n </span>\n </div>\n ) : null;\n })}\n </div>\n );\n };\n\n const renderMoveToCartButton = () => {\n return (\n <Button\n data-testid=\"wishlist-product-item-move-to-cart-button\"\n size=\"medium\"\n type=\"submit\"\n icon={<Icon source={Cart} />}\n disabled={!item.product?.inStock}\n aria-label={labels.cartActionBtn}\n onClick={() => onCartActionButtonClick?.()}\n >\n {labels.cartActionBtn}\n </Button>\n );\n };\n\n const renderCustomizeButton = () => {\n return (\n <Button\n data-testid=\"wishlist-product-item-customize-button\"\n size=\"medium\"\n type=\"submit\"\n aria-label={labels.customizeActionBtn}\n href={routeProdDetailPage(item.product)}\n >\n {labels.customizeActionBtn}\n </Button>\n );\n };\n\n return (\n <div {...props} className={classes(['wishlist-product-item', className])}>\n <div className=\"wishlist-product-item__content\">\n {renderImage()}\n <div\n className=\"wishlist-product-item__title\"\n data-testid=\"wishlist-product-item-header\"\n >\n <a\n className=\"wishlist-product-item-name\"\n data-testid=\"wishlist-product-item-name\"\n href={routeProdDetailPage(item.product)}\n >\n {item.product?.name}\n </a>\n\n {renderTrashButton()}\n {renderPrices()}\n </div>\n {renderOptions()}\n {renderMainActionButton()}\n </div>\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent, JSX } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { Image, ImageNodeRenderProps } from '@adobe-commerce/elsie/components';\nimport { useState } from 'react';\n\nimport '@/wishlist/components/ImageCarousel/ImageCarousel.css';\n\nexport interface ImageCarouselProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n children?: any;\n images: Image[];\n imageNode?: (props: {\n defaultImageProps: ImageNodeRenderProps;\n }) => JSX.Element;\n}\n\nexport const ImageCarousel: FunctionComponent<ImageCarouselProps> = ({\n className,\n children,\n images,\n imageNode,\n ...props\n}) => {\n const [carouselIndex, setCarouselIndex] = useState(0);\n\n return (\n <>\n <div {...props} className={classes(['image-carousel', className])}>\n <div\n className={classes([\n 'overflow-hidden relative max-w-[200px]',\n className,\n ])}\n >\n {images?.map(\n (image: ImageCarouselProps['images'][0], index: number) => {\n const defaultProps = {\n className: classes(['image-carousel-image', className]),\n src: image.url,\n alt: image.label,\n } as const;\n\n if (index !== carouselIndex) {\n return null;\n }\n\n return typeof imageNode === 'function'\n ? imageNode({\n defaultImageProps: defaultProps,\n })\n : imageNode || <Image {...defaultProps} />;\n }\n )}\n </div>\n </div>\n {images?.length > 1 && (\n <div className={classes(['absolute', 'image-switcher-area'])}>\n {images?.map(\n (_image: ImageCarouselProps['images'][0], index: number) => {\n return (\n <span\n className={classes([\n 'image-switcher',\n carouselIndex === index\n ? 'image-switcher-active'\n : 'image-switcher-inactive',\n ])}\n key={index}\n onClick={(event: MouseEvent | TouchEvent) => {\n setCarouselIndex(index);\n event.preventDefault(); // prevent navigate on click since ImageCarousel is wrapped in a link\n event.stopPropagation();\n }}\n />\n );\n }\n )}\n </div>\n )}\n </>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n HTMLAttributes,\n useEffect,\n useState,\n useCallback,\n} from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { ProductItem } from '@/wishlist/components';\nimport { Item, Product } from '@/wishlist/data/models';\nimport { removeProductsFromWishlist } from '@/wishlist/api';\nimport { events } from '@adobe-commerce/event-bus';\nimport { ImageNodeRenderProps } from '@adobe-commerce/elsie/components';\nimport { JSX } from 'preact';\n\nexport interface WishlistItemProps extends HTMLAttributes<HTMLDivElement> {\n item: Item;\n getProductData?: (sku: string) => Promise<Product | null>;\n getRefinedProduct?: (\n sku: string,\n optionUIDs: string[],\n anchorOptions?: string[],\n raw?: boolean\n ) => Promise<Product | null>;\n moveProdToCart: (\n products: {\n sku: string;\n quantity: number;\n optionsUIDs?: [];\n enteredOptions?: [];\n }[]\n ) => Promise<any>;\n routeProdDetailPage: (product: Product) => string;\n imageNode?: (props: {\n defaultImageProps: ImageNodeRenderProps;\n }) => JSX.Element;\n}\n\nexport const WishlistItem: Container<WishlistItemProps> = ({\n item,\n getProductData,\n getRefinedProduct,\n moveProdToCart,\n routeProdDetailPage,\n imageNode,\n}: WishlistItemProps) => {\n const [productData, setProductData] = useState<Product | null>(null);\n\n useEffect(() => {\n let cancelled = false;\n\n async function fetchProductData() {\n try {\n let data: Product | null;\n if (getRefinedProduct && item?.selectedOptions?.length > 0) {\n data = await getRefinedProduct(\n item.product.sku,\n item.selectedOptions.map((option: { uid: any }) => option.uid)\n );\n } else {\n data = getProductData\n ? await getProductData(item?.product.sku)\n : item?.product;\n }\n if (!cancelled) setProductData(data);\n } catch (err) {\n if (!cancelled) {\n console.error('Failed to fetch product data:', err);\n }\n }\n }\n\n fetchProductData();\n\n return () => {\n cancelled = true;\n };\n }, [item, getProductData, getRefinedProduct]);\n\n /**\n * Removes product from wishlist\n */\n const removeProductFromWishlist = useCallback(\n async (showAlert: boolean = true): Promise<boolean> => {\n try {\n await removeProductsFromWishlist([item]);\n console.log(`Product ${productData?.sku} removed from wishlist!`);\n if (showAlert) {\n events.emit('wishlist/alert', {\n action: 'remove',\n item: { ...item, product: productData },\n });\n }\n return true;\n } catch (error) {\n console.error(\n `Product ${productData.sku} could not be removed from wishlist`,\n error\n );\n return false;\n }\n },\n [item, productData]\n );\n\n /**\n * Moves product to cart\n */\n const moveProductToCart = useCallback(async (): Promise<boolean> => {\n try {\n await moveProdToCart([\n {\n sku: productData.sku,\n quantity: 1,\n optionsUIDs: item.selectedOptions?.map(\n (option: { uid: any }) => option.uid\n ),\n enteredOptions: item.enteredOptions,\n },\n ]);\n console.log(`Product ${productData.sku} successfully moved to cart 🛒`);\n events.emit('wishlist/alert', {\n action: 'move',\n item: { ...item, product: productData },\n });\n return await removeProductFromWishlist(false);\n } catch (error) {\n console.error('Could not move product to cart: ', error);\n if (\n error.toString().includes('You need to choose options for your item.')\n ) {\n window.location.replace(routeProdDetailPage(productData));\n }\n return false;\n }\n }, [\n productData,\n item,\n moveProdToCart,\n routeProdDetailPage,\n removeProductFromWishlist,\n ]);\n\n if (!productData || !item) return null;\n\n return (\n <ProductItem\n item={{ ...item, product: productData }}\n onCartActionButtonClick={moveProductToCart}\n onTrashButtonClick={removeProductFromWishlist}\n routeProdDetailPage={routeProdDetailPage}\n imageNode={imageNode}\n />\n );\n};\n"],"names":["ProductItem","className","item","onCartActionButtonClick","onTrashButtonClick","routeProdDetailPage","imageNode","props","labels","useText","discounted","_c","_b","_a","_f","_e","_d","renderImage","jsx","ImageCarousel","renderPrices","_i","_h","_g","jsxs","Fragment","Price","_l","_k","_j","_o","_n","_m","_r","_q","_p","_u","_t","_s","classes","_x","_w","_v","_A","_z","_y","_D","_C","_B","_G","_F","_E","renderTrashButton","Button","Icon","Trash","renderMainActionButton","isProductReady","renderMoveToCartButton","renderCustomizeButton","areAllRequiredOptionsIncluded","selectedOptions","useMemo","opt","requiredOptions","options","required","option","renderOptions","selectedValue","Cart","children","images","carouselIndex","setCarouselIndex","useState","image","index","defaultProps","Image","_image","event","WishlistItem","getProductData","getRefinedProduct","moveProdToCart","productData","setProductData","useEffect","cancelled","fetchProductData","data","err","removeProductFromWishlist","useCallback","showAlert","removeProductsFromWishlist","events","error","moveProductToCart"],"mappings":"4gBA4CO,MAA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2
2
  All Rights Reserved. */
3
3
  import{Initializer as y}from"@dropins/tools/lib.js";import{events as r}from"@dropins/tools/event-bus.js";import{j as A,s as e,f as I,h as p,g as h,i as T,k as G}from"./removeProductsFromWishlist.js";const g=new y({init:async t=>{const s={isGuestWishlistEnabled:!1,...t};g.config.setConfig(s),f().catch(console.error)},listeners:()=>[r.on("wishlist/data",t=>{A(t)},{eager:!0}),r.on("authenticated",async t=>{if(e.authenticated&&!t&&r.emit("wishlist/reset",void 0),t&&!e.authenticated){e.authenticated=t;const s=await f().catch(console.error);s&&Z(s)}},{eager:!0}),r.on("wishlist/reset",()=>{B().catch(console.error),r.emit("wishlist/data",null)})]}),V=g.config;function N(t){return t?{wishlistIsEnabled:t.storeConfig.magento_wishlist_general_is_enabled,wishlistMultipleListIsEnabled:t.storeConfig.enable_multiple_wishlists,wishlistMaxNumber:t.storeConfig.maximum_number_of_wishlists}:null}function w(t,s){return t?{id:t.id,updated_at:t.updated_at,sharing_code:t.sharing_code,items_count:t.items_count,items:L(t,s??[])}:null}function L(t,s){var i,a;return(a=(i=t==null?void 0:t.items_v2)==null?void 0:i.items)!=null&&a.length?t.items_v2.items.map(n=>{const l=R(n);return{id:n.id,quantity:n.quantity,description:n.description,added_at:n.added_at,enteredOptions:s,selectedOptions:l,product:{sku:n.product.sku}}}):[]}function R(t){return t.__typename==="ConfigurableWishlistItem"?t.configurable_options?t.configurable_options.map(s=>({uid:s.configurable_product_option_value_uid})):[]:t.__typename==="BundleWishlistItem"?(t.bundle_options??[]).flatMap(i=>i.values??[]).map(i=>({uid:i.uid})):[]}const D=`
4
4
  query STORE_CONFIG_QUERY {
@@ -1 +1 @@
1
- {"version":3,"file":"mergeWishlists.js","sources":["/@dropins/storefront-wishlist/src/api/initialize/initialize.ts","/@dropins/storefront-wishlist/src/data/transforms/transform-store-config.ts","/@dropins/storefront-wishlist/src/data/transforms/transform-wishlist.ts","/@dropins/storefront-wishlist/src/api/getStoreConfig/graphql/StoreConfigQuery.ts","/@dropins/storefront-wishlist/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-wishlist/src/api/graphql/CustomizableOptionsFragment.graphql.ts","/@dropins/storefront-wishlist/src/api/graphql/WishlistItemFragment.graphql.ts","/@dropins/storefront-wishlist/src/api/graphql/WishlistFragment.graphql.ts","/@dropins/storefront-wishlist/src/api/getWishlists/graphql/getWishlists.graphql.ts","/@dropins/storefront-wishlist/src/api/getWishlists/getWishlists.ts","/@dropins/storefront-wishlist/src/api/addProductsToWishlist/graphql/addProductsToWishlistMutation.ts","/@dropins/storefront-wishlist/src/api/addProductsToWishlist/addProductsToWishlist.ts","/@dropins/storefront-wishlist/src/api/resetWishlist/resetWishlist.ts","/@dropins/storefront-wishlist/src/api/initializeWishlist/initializeWishlist.ts","/@dropins/storefront-wishlist/src/api/mergeWishlists/mergeWishlists.ts"],"sourcesContent":["import { Initializer } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { state } from '@/wishlist/lib/state';\nimport {\n initializeWishlist,\n resetWishlist,\n mergeWishlists,\n} from '@/wishlist/api';\nimport { setPersistedWishlistData } from '@/wishlist/lib/persisted-data';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n isGuestWishlistEnabled?: boolean;\n};\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = { isGuestWishlistEnabled: false, ...config };\n\n initialize.config.setConfig(defaultConfig);\n initializeWishlist().catch(console.error);\n },\n\n listeners: () => [\n events.on(\n 'wishlist/data',\n (payload) => {\n setPersistedWishlistData(payload);\n },\n { eager: true }\n ),\n events.on(\n 'authenticated',\n async (authenticated) => {\n if (state.authenticated && !authenticated) {\n // Reset wishlist if the user is no longer authenticated\n events.emit('wishlist/reset', undefined);\n }\n // Login event occurred\n if (authenticated && !state.authenticated) {\n state.authenticated = authenticated;\n const wishlist = await initializeWishlist().catch(console.error);\n if (wishlist) {\n mergeWishlists(wishlist);\n }\n }\n },\n { eager: true }\n ),\n events.on('wishlist/reset', () => {\n resetWishlist().catch(console.error);\n events.emit('wishlist/data', null);\n }),\n ],\n});\n\nexport const config = initialize.config;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { StoreConfigModel } from '@/wishlist/data/models';\n\nexport function transformStoreConfig(data: any): StoreConfigModel | null {\n if (!data) return null;\n\n return {\n wishlistIsEnabled: data.storeConfig.magento_wishlist_general_is_enabled,\n wishlistMultipleListIsEnabled: data.storeConfig.enable_multiple_wishlists,\n wishlistMaxNumber: data.storeConfig.maximum_number_of_wishlists,\n };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { Wishlist, Item, Option } from '@/wishlist/data/models/wishlist';\n\nexport function transformWishlist(\n data: any,\n enteredOptions?: { uid: string; value: string }[]\n): Wishlist | null {\n if (!data) return null;\n\n return {\n id: data.id,\n updated_at: data.updated_at,\n sharing_code: data.sharing_code,\n items_count: data.items_count,\n items: transformItems(data, enteredOptions ?? []),\n };\n}\n\nfunction transformItems(\n data: any,\n enteredOptions: { uid: string; value: string }[]\n): Item[] {\n if (!data?.items_v2?.items?.length) return [];\n\n return data.items_v2.items.map((item: any) => {\n const selectedOptions = getSelectedOptions(item);\n return {\n id: item.id,\n quantity: item.quantity,\n description: item.description,\n added_at: item.added_at,\n enteredOptions,\n selectedOptions,\n product: { sku: item.product.sku },\n };\n });\n}\n\nfunction getSelectedOptions(item: Item): Option[] {\n if (item.__typename === 'ConfigurableWishlistItem') {\n return item.configurable_options\n ? item.configurable_options.map((option: any) => ({\n uid: option.configurable_product_option_value_uid,\n }))\n : [];\n }\n if (item.__typename === 'BundleWishlistItem') {\n const values = (item.bundle_options ?? []).flatMap(\n (option: any) => option.values ?? []\n );\n return values.map((value: any) => ({ uid: value.uid }));\n }\n return [];\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const STORE_CONFIG_QUERY = `\nquery STORE_CONFIG_QUERY {\n storeConfig {\n magento_wishlist_general_is_enabled\n enable_multiple_wishlists\n maximum_number_of_wishlists\n }\n}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/wishlist/api';\nimport { StoreConfigModel } from '@/wishlist/data/models';\nimport { transformStoreConfig } from '@/wishlist/data/transforms';\nimport { handleFetchError } from '@/wishlist/lib/fetch-error';\n\nimport { STORE_CONFIG_QUERY } from './graphql/StoreConfigQuery';\n\nexport const getStoreConfig = async (): Promise<StoreConfigModel | null> => {\n return fetchGraphQl(STORE_CONFIG_QUERY, {\n method: 'GET',\n cache: 'force-cache',\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n return transformStoreConfig(data);\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const CUSTOMIZABLE_OPTIONS_FRAGMENT = `\n fragment CUSTOMIZABLE_OPTIONS_FRAGMENT on SelectedCustomizableOption {\n type\n customizable_option_uid\n label\n is_required\n values {\n label\n value\n price{\n type\n units\n value\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CUSTOMIZABLE_OPTIONS_FRAGMENT } from './CustomizableOptionsFragment.graphql';\n\nconst CONFIGURABLE_WISHLIST_ITEM_FRAGMENT = `\n ... on ConfigurableWishlistItem {\n configurable_options {\n option_label\n value_label\n configurable_product_option_value_uid\n configurable_product_option_uid\n }\n configured_variant {\n canonical_url\n }\n }\n`;\n\nconst DOWNLOADABLE_WISHLIST_ITEM_FRAGMENT = `\n ... on DownloadableWishlistItem {\n added_at\n description\n links_v2 {\n sample_url\n sort_order\n title\n uid\n }\n quantity\n }\n`;\n\nconst GIFT_CARD_WISHLIST_ITEM_FRAGMENT = `\n ... on GiftCardWishlistItem {\n added_at\n description\n gift_card_options {\n amount {\n value\n currency\n }\n custom_giftcard_amount {\n value\n currency\n }\n message\n recipient_email\n recipient_name\n sender_email\n sender_name\n }\n }\n`;\n\nconst BUNDLE_WISHLIST_ITEM_FRAGMENT = `\n ... on BundleWishlistItem {\n bundle_options {\n label\n type\n uid\n values {\n uid\n label\n quantity\n }\n }\n }\n`;\n\nexport const WISHLIST_ITEM_FRAGMENT = `\nfragment WISHLIST_ITEM_FRAGMENT on WishlistItemInterface {\n __typename\n id\n quantity\n description\n added_at\n product {\n sku\n }\n ${CONFIGURABLE_WISHLIST_ITEM_FRAGMENT}\n ${DOWNLOADABLE_WISHLIST_ITEM_FRAGMENT}\n ${GIFT_CARD_WISHLIST_ITEM_FRAGMENT}\n ${BUNDLE_WISHLIST_ITEM_FRAGMENT}\n customizable_options {\n ...CUSTOMIZABLE_OPTIONS_FRAGMENT\n }\n }\n \n ${CUSTOMIZABLE_OPTIONS_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { WISHLIST_ITEM_FRAGMENT } from '@/wishlist/api/fragments';\n\nexport const WISHLIST_FRAGMENT = `\nfragment WISHLIST_FRAGMENT on Wishlist {\n id\n updated_at\n sharing_code\n items_count\n items_v2 {\n items {\n ...WISHLIST_ITEM_FRAGMENT\n }\n }\n }\n\n${WISHLIST_ITEM_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { WISHLIST_FRAGMENT } from '@/wishlist/api/fragments';\n\nexport const GET_WISHLISTS_QUERY = `\n query GET_WISHLISTS_QUERY {\n customer {\n wishlists {\n ...WISHLIST_FRAGMENT\n }\n }\n }\n\n ${WISHLIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GET_WISHLISTS_QUERY } from '@/wishlist/api/getWishlists/graphql/getWishlists.graphql';\nimport { Wishlist } from '@/wishlist/data/models';\nimport { transformWishlist } from '@/wishlist/data/transforms';\nimport { state } from '@/wishlist/lib/state';\nimport { fetchGraphQl, getPersistedWishlistData } from '@/wishlist/api';\nimport { handleFetchError } from '@/wishlist/lib/fetch-error';\n\nexport const getWishlists = async (): Promise<void | Wishlist[] | null> => {\n // When the user is not authenticated, we just have a single wishlist\n // There is no necessity to check any IDs\n if (!state.authenticated) {\n return getPersistedWishlistData();\n }\n\n return fetchGraphQl(GET_WISHLISTS_QUERY).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.customer?.wishlists) {\n return null;\n }\n\n return data.customer.wishlists.map((wishlist: any) =>\n transformWishlist(wishlist)\n );\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { WISHLIST_FRAGMENT } from '@/wishlist/api/fragments';\n\nexport const ADD_PRODUCTS_TO_WISHLIST_MUTATION = `\n mutation ADD_PRODUCTS_TO_WISHLIST_MUTATION(\n $wishlistId: ID!, \n $wishlistItems: [WishlistItemInput!]!,\n ) {\n addProductsToWishlist(\n wishlistId: $wishlistId\n wishlistItems: $wishlistItems\n ) {\n wishlist {\n ...WISHLIST_FRAGMENT\n }\n user_errors {\n code\n message\n }\n }\n }\n${WISHLIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl, getPersistedWishlistData } from '@/wishlist/api';\nimport { state } from '@/wishlist/lib/state';\nimport { handleFetchError } from '@/wishlist/lib/fetch-error';\nimport { ADD_PRODUCTS_TO_WISHLIST_MUTATION } from './graphql/addProductsToWishlistMutation';\nimport { Wishlist } from '@/wishlist/data/models/wishlist';\nimport { transformWishlist } from '@/wishlist/data/transforms';\nimport { events } from '@adobe-commerce/event-bus';\nimport { isMatchingWishlistItem } from '@/wishlist/lib/wishlist-item-comparator';\n\nexport const addProductsToWishlist = async (\n items: [\n {\n sku: string;\n quantity: number;\n optionsUIDs?: string[]; // should be the options available for the product\n enteredOptions?: { uid: string; value: string }[]; // refer to both selected and entered options\n }\n ]\n): Promise<Wishlist | null> => {\n if (!items) return null;\n\n const wishlist = getPersistedWishlistData();\n let updatedWishlist = {\n id: wishlist?.id ?? '',\n updated_at: '',\n sharing_code: '',\n items_count: 0,\n items: wishlist?.items ?? [],\n };\n\n for (const item of items) {\n const skuExists = updatedWishlist.items?.some((wishlistItem: any) =>\n isMatchingWishlistItem(wishlistItem, {\n sku: item.sku,\n optionUIDs: item.optionsUIDs,\n })\n );\n\n if (skuExists) {\n continue;\n }\n\n const selectedOptions: { uid: string }[] = item.optionsUIDs\n ? item.optionsUIDs?.map((option: any) => ({\n uid: option,\n }))\n : [];\n\n updatedWishlist.items = [\n ...updatedWishlist.items,\n {\n id: crypto.randomUUID(),\n quantity: item.quantity,\n selectedOptions,\n enteredOptions: item.enteredOptions ?? [],\n product: { sku: item.sku },\n },\n ];\n }\n\n updatedWishlist.items_count = updatedWishlist.items?.length;\n events.emit('wishlist/data', updatedWishlist);\n\n if (state.authenticated) {\n if (!state.wishlistId) {\n events.emit('wishlist/data', wishlist);\n throw Error('Wishlist ID is not set');\n }\n\n const variables = {\n wishlistId: state.wishlistId,\n wishlistItems: items.map(\n ({ sku, quantity, optionsUIDs, enteredOptions }) => ({\n sku,\n quantity,\n selected_options: optionsUIDs,\n entered_options: enteredOptions,\n })\n ),\n };\n\n const { errors, data }: { errors: any; data: any } = await fetchGraphQl(\n ADD_PRODUCTS_TO_WISHLIST_MUTATION,\n { variables }\n );\n\n const _errors = [\n ...(data?.addProductsToWishlist?.user_errors ?? []),\n ...(errors ?? []),\n ];\n\n // if saving item to wishlist for logged user failed, we need to restore original wishlist in storage:\n if (_errors.length > 0) {\n events.emit('wishlist/data', wishlist);\n return handleFetchError(_errors);\n }\n\n const updatedWishlist = transformWishlist(\n data.addProductsToWishlist.wishlist,\n items[0]?.enteredOptions ?? []\n );\n events.emit('wishlist/data', updatedWishlist);\n }\n\n return null;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { state } from '@/wishlist/lib/state';\nimport { Wishlist } from '@/wishlist/data/models';\n\nexport const resetWishlist = (): Promise<Wishlist | null> => {\n state.wishlistId = null;\n state.authenticated = false;\n\n return Promise.resolve(null);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\nimport { state } from '@/wishlist/lib/state';\nimport { getStoreConfig, getWishlists } from '@/wishlist/api';\nimport { getPersistedWishlistData } from '@/wishlist/lib/persisted-data';\nimport { Wishlist } from '@/wishlist/data/models';\n\nexport const initializeWishlist = async (): Promise<Wishlist | null> => {\n if (state.initializing) return null;\n\n state.initializing = true;\n\n // set config\n if (!state.config) {\n state.config = await getStoreConfig();\n }\n\n const payload = state.authenticated\n ? await getDefaultWishlist()\n : await getGuestWishlist();\n\n events.emit('wishlist/initialized', payload);\n events.emit('wishlist/data', payload);\n\n state.initializing = false;\n\n return payload;\n};\n\nexport async function getDefaultWishlist() {\n const wishlists = await getWishlists();\n const wishlist = wishlists ? wishlists[0] : null;\n if (!wishlist) return null;\n\n state.wishlistId = wishlist.id;\n\n return wishlist;\n}\n\nexport async function getGuestWishlist() {\n try {\n return await getPersistedWishlistData();\n } catch (error) {\n console.error(error);\n throw error;\n }\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Wishlist, Item } from '@/wishlist/data/models';\nimport { addProductsToWishlist } from '@/wishlist/api';\nimport {\n getPersistedWishlistData,\n clearPersistedLocalStorage,\n} from '@/wishlist/lib/persisted-data';\nimport { isMatchingWishlistItem } from '@/wishlist/lib/wishlist-item-comparator';\n\nexport const mergeWishlists = async (\n wishlist: Wishlist\n): Promise<Wishlist | null> => {\n if (!wishlist) {\n return null;\n }\n\n const guestWishlist: {\n id?: string;\n items?: Item[];\n } = getPersistedWishlistData(true);\n const itemsToMerge: any[] = [];\n\n guestWishlist?.items?.forEach((item: any) => {\n const optionUIDs =\n item.selectedOptions?.map((option: any) => option.uid) || [];\n\n const exists = wishlist.items.some((wishlistItem: any) =>\n isMatchingWishlistItem(wishlistItem, {\n sku: item.product.sku,\n optionUIDs,\n })\n );\n\n if (!exists) {\n const mergeItem = {\n sku: item.product.sku,\n quantity: 1,\n optionsUIDs: optionUIDs,\n enteredOptions: item.enteredOptions || undefined,\n };\n\n itemsToMerge.push(mergeItem);\n }\n });\n\n if (itemsToMerge.length === 0) {\n return null;\n }\n\n const result = await addProductsToWishlist(itemsToMerge);\n clearPersistedLocalStorage();\n return result;\n};\n"],"names":["initialize","Initializer","config","defaultConfig","initializeWishlist","events","payload","setPersistedWishlistData","authenticated","state","wishlist","mergeWishlists","resetWishlist","transformStoreConfig","data","transformWishlist","enteredOptions","transformItems","_b","_a","item","selectedOptions","getSelectedOptions","option","value","STORE_CONFIG_QUERY","getStoreConfig","fetchGraphQl","errors","handleFetchError","CUSTOMIZABLE_OPTIONS_FRAGMENT","CONFIGURABLE_WISHLIST_ITEM_FRAGMENT","DOWNLOADABLE_WISHLIST_ITEM_FRAGMENT","GIFT_CARD_WISHLIST_ITEM_FRAGMENT","BUNDLE_WISHLIST_ITEM_FRAGMENT","WISHLIST_ITEM_FRAGMENT","WISHLIST_FRAGMENT","GET_WISHLISTS_QUERY","getWishlists","getPersistedWishlistData","ADD_PRODUCTS_TO_WISHLIST_MUTATION","addProductsToWishlist","items","updatedWishlist","wishlistItem","isMatchingWishlistItem","_c","variables","sku","quantity","optionsUIDs","_errors","_d","_e","getDefaultWishlist","getGuestWishlist","wishlists","error","guestWishlist","itemsToMerge","optionUIDs","mergeItem","result","clearPersistedLocalStorage"],"mappings":"uMAgBa,MAAAA,EAAa,IAAIC,EAAyB,CACrD,KAAM,MAAOC,GAAW,CACtB,MAAMC,EAAgB,CAAE,uBAAwB,GAAO,GAAGD,CAAO,EAEtDF,EAAA,OAAO,UAAUG,CAAa,EACtBC,IAAE,MAAM,QAAQ,KAAK,CAC1C,EAEA,UAAW,IAAM,CACfC,EAAO,GACL,gBACCC,GAAY,CACXC,EAAyBD,CAAO,CAClC,EACA,CAAE,MAAO,EAAK,CAChB,EACAD,EAAO,GACL,gBACA,MAAOG,GAAkB,CAMnB,GALAC,EAAM,eAAiB,CAACD,GAEnBH,EAAA,KAAK,iBAAkB,MAAS,EAGrCG,GAAiB,CAACC,EAAM,cAAe,CACzCA,EAAM,cAAgBD,EACtB,MAAME,EAAW,MAAMN,EAAA,EAAqB,MAAM,QAAQ,KAAK,EAC3DM,GACFC,EAAeD,CAAQ,CACzB,CAEJ,EACA,CAAE,MAAO,EAAK,CAChB,EACAL,EAAO,GAAG,iBAAkB,IAAM,CAClBO,IAAE,MAAM,QAAQ,KAAK,EA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,CACF,OAAO,MAAMhB,EAAyB,QAC/BkB,EAAO,CACd,cAAQ,MAAMA,CAAK,EACbA,CAAA,CAEV,CCrCa,MAAA9C,EAAiB,MAC5BD,GAC6B,OAC7B,GAAI,CAACA,EACI,OAAA,KAGH,MAAAgD,EAGFnB,EAAyB,EAAI,EAC3BoB,EAAsB,CAAC,EAyBzB,IAvBWxC,EAAAuC,GAAA,YAAAA,EAAA,QAAA,MAAAvC,EAAO,QAASC,GAAc,OACrC,MAAAwC,IACJzC,EAAAC,EAAK,kBAAL,YAAAD,EAAsB,IAAKI,GAAgBA,EAAO,OAAQ,CAAC,EAS7D,GAAI,CAPWb,EAAS,MAAM,KAAMkC,GAClCC,EAAuBD,EAAc,CACnC,IAAKxB,EAAK,QAAQ,IAClB,WAAAwC,CACD,CAAA,CACH,EAEa,CACX,MAAMC,EAAY,CAChB,IAAKzC,EAAK,QAAQ,IAClB,SAAU,EACV,YAAawC,EACb,eAAgBxC,EAAK,gBAAkB,MACzC,EAEAuC,EAAa,KAAKE,CAAS,CAAA,CAC7B,GAGEF,EAAa,SAAW,EACnB,OAAA,KAGH,MAAAG,EAAS,MAAMrB,EAAsBkB,CAAY,EAC5B,OAAAI,EAAA,EACpBD,CACT"}
1
+ {"version":3,"file":"mergeWishlists.js","sources":["/@dropins/storefront-wishlist/src/api/initialize/initialize.ts","/@dropins/storefront-wishlist/src/data/transforms/transform-store-config.ts","/@dropins/storefront-wishlist/src/data/transforms/transform-wishlist.ts","/@dropins/storefront-wishlist/src/api/getStoreConfig/graphql/StoreConfigQuery.ts","/@dropins/storefront-wishlist/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-wishlist/src/api/graphql/CustomizableOptionsFragment.graphql.ts","/@dropins/storefront-wishlist/src/api/graphql/WishlistItemFragment.graphql.ts","/@dropins/storefront-wishlist/src/api/graphql/WishlistFragment.graphql.ts","/@dropins/storefront-wishlist/src/api/getWishlists/graphql/getWishlists.graphql.ts","/@dropins/storefront-wishlist/src/api/getWishlists/getWishlists.ts","/@dropins/storefront-wishlist/src/api/addProductsToWishlist/graphql/addProductsToWishlistMutation.ts","/@dropins/storefront-wishlist/src/api/addProductsToWishlist/addProductsToWishlist.ts","/@dropins/storefront-wishlist/src/api/resetWishlist/resetWishlist.ts","/@dropins/storefront-wishlist/src/api/initializeWishlist/initializeWishlist.ts","/@dropins/storefront-wishlist/src/api/mergeWishlists/mergeWishlists.ts"],"sourcesContent":["import { Initializer } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { state } from '@/wishlist/lib/state';\nimport {\n initializeWishlist,\n resetWishlist,\n mergeWishlists,\n} from '@/wishlist/api';\nimport { setPersistedWishlistData } from '@/wishlist/lib/persisted-data';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n isGuestWishlistEnabled?: boolean;\n};\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = { isGuestWishlistEnabled: false, ...config };\n\n initialize.config.setConfig(defaultConfig);\n initializeWishlist().catch(console.error);\n },\n\n listeners: () => [\n events.on(\n 'wishlist/data',\n (payload) => {\n setPersistedWishlistData(payload);\n },\n { eager: true }\n ),\n events.on(\n 'authenticated',\n async (authenticated) => {\n if (state.authenticated && !authenticated) {\n // Reset wishlist if the user is no longer authenticated\n events.emit('wishlist/reset', undefined);\n }\n // Login event occurred\n if (authenticated && !state.authenticated) {\n state.authenticated = authenticated;\n const wishlist = await initializeWishlist().catch(console.error);\n if (wishlist) {\n mergeWishlists(wishlist);\n }\n }\n },\n { eager: true }\n ),\n events.on('wishlist/reset', () => {\n resetWishlist().catch(console.error);\n events.emit('wishlist/data', null);\n }),\n ],\n});\n\nexport const config = initialize.config;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { StoreConfigModel } from '@/wishlist/data/models';\n\nexport function transformStoreConfig(data: any): StoreConfigModel | null {\n if (!data) return null;\n\n return {\n wishlistIsEnabled: data.storeConfig.magento_wishlist_general_is_enabled,\n wishlistMultipleListIsEnabled: data.storeConfig.enable_multiple_wishlists,\n wishlistMaxNumber: data.storeConfig.maximum_number_of_wishlists,\n };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { Wishlist, Item, Option } from '@/wishlist/data/models/wishlist';\n\nexport function transformWishlist(\n data: any,\n enteredOptions?: { uid: string; value: string }[]\n): Wishlist | null {\n if (!data) return null;\n\n return {\n id: data.id,\n updated_at: data.updated_at,\n sharing_code: data.sharing_code,\n items_count: data.items_count,\n items: transformItems(data, enteredOptions ?? []),\n };\n}\n\nfunction transformItems(\n data: any,\n enteredOptions: { uid: string; value: string }[]\n): Item[] {\n if (!data?.items_v2?.items?.length) return [];\n\n return data.items_v2.items.map((item: any) => {\n const selectedOptions = getSelectedOptions(item);\n return {\n id: item.id,\n quantity: item.quantity,\n description: item.description,\n added_at: item.added_at,\n enteredOptions,\n selectedOptions,\n product: { sku: item.product.sku },\n };\n });\n}\n\nfunction getSelectedOptions(item: Item): Option[] {\n if (item.__typename === 'ConfigurableWishlistItem') {\n return item.configurable_options\n ? item.configurable_options.map((option: any) => ({\n uid: option.configurable_product_option_value_uid,\n }))\n : [];\n }\n if (item.__typename === 'BundleWishlistItem') {\n const values = (item.bundle_options ?? []).flatMap(\n (option: any) => option.values ?? []\n );\n return values.map((value: any) => ({ uid: value.uid }));\n }\n return [];\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const STORE_CONFIG_QUERY = `\nquery STORE_CONFIG_QUERY {\n storeConfig {\n magento_wishlist_general_is_enabled\n enable_multiple_wishlists\n maximum_number_of_wishlists\n }\n}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/wishlist/api';\nimport { StoreConfigModel } from '@/wishlist/data/models';\nimport { transformStoreConfig } from '@/wishlist/data/transforms';\nimport { handleFetchError } from '@/wishlist/lib/fetch-error';\n\nimport { STORE_CONFIG_QUERY } from './graphql/StoreConfigQuery';\n\nexport const getStoreConfig = async (): Promise<StoreConfigModel | null> => {\n return fetchGraphQl(STORE_CONFIG_QUERY, {\n method: 'GET',\n cache: 'force-cache',\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n return transformStoreConfig(data);\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const CUSTOMIZABLE_OPTIONS_FRAGMENT = `\n fragment CUSTOMIZABLE_OPTIONS_FRAGMENT on SelectedCustomizableOption {\n type\n customizable_option_uid\n label\n is_required\n values {\n label\n value\n price{\n type\n units\n value\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CUSTOMIZABLE_OPTIONS_FRAGMENT } from './CustomizableOptionsFragment.graphql';\n\nconst CONFIGURABLE_WISHLIST_ITEM_FRAGMENT = `\n ... on ConfigurableWishlistItem {\n configurable_options {\n option_label\n value_label\n configurable_product_option_value_uid\n configurable_product_option_uid\n }\n configured_variant {\n canonical_url\n }\n }\n`;\n\nconst DOWNLOADABLE_WISHLIST_ITEM_FRAGMENT = `\n ... on DownloadableWishlistItem {\n added_at\n description\n links_v2 {\n sample_url\n sort_order\n title\n uid\n }\n quantity\n }\n`;\n\nconst GIFT_CARD_WISHLIST_ITEM_FRAGMENT = `\n ... on GiftCardWishlistItem {\n added_at\n description\n gift_card_options {\n amount {\n value\n currency\n }\n custom_giftcard_amount {\n value\n currency\n }\n message\n recipient_email\n recipient_name\n sender_email\n sender_name\n }\n }\n`;\n\nconst BUNDLE_WISHLIST_ITEM_FRAGMENT = `\n ... on BundleWishlistItem {\n bundle_options {\n label\n type\n uid\n values {\n uid\n label\n quantity\n }\n }\n }\n`;\n\nexport const WISHLIST_ITEM_FRAGMENT = `\nfragment WISHLIST_ITEM_FRAGMENT on WishlistItemInterface {\n __typename\n id\n quantity\n description\n added_at\n product {\n sku\n }\n ${CONFIGURABLE_WISHLIST_ITEM_FRAGMENT}\n ${DOWNLOADABLE_WISHLIST_ITEM_FRAGMENT}\n ${GIFT_CARD_WISHLIST_ITEM_FRAGMENT}\n ${BUNDLE_WISHLIST_ITEM_FRAGMENT}\n customizable_options {\n ...CUSTOMIZABLE_OPTIONS_FRAGMENT\n }\n }\n \n ${CUSTOMIZABLE_OPTIONS_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { WISHLIST_ITEM_FRAGMENT } from '@/wishlist/api/fragments';\n\nexport const WISHLIST_FRAGMENT = `\nfragment WISHLIST_FRAGMENT on Wishlist {\n id\n updated_at\n sharing_code\n items_count\n items_v2 {\n items {\n ...WISHLIST_ITEM_FRAGMENT\n }\n }\n }\n\n${WISHLIST_ITEM_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { WISHLIST_FRAGMENT } from '@/wishlist/api/fragments';\n\nexport const GET_WISHLISTS_QUERY = `\n query GET_WISHLISTS_QUERY {\n customer {\n wishlists {\n ...WISHLIST_FRAGMENT\n }\n }\n }\n\n ${WISHLIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GET_WISHLISTS_QUERY } from '@/wishlist/api/getWishlists/graphql/getWishlists.graphql';\nimport { Wishlist } from '@/wishlist/data/models';\nimport { transformWishlist } from '@/wishlist/data/transforms';\nimport { state } from '@/wishlist/lib/state';\nimport { fetchGraphQl, getPersistedWishlistData } from '@/wishlist/api';\nimport { handleFetchError } from '@/wishlist/lib/fetch-error';\n\nexport const getWishlists = async (): Promise<void | Wishlist[] | null> => {\n // When the user is not authenticated, we just have a single wishlist\n // There is no necessity to check any IDs\n if (!state.authenticated) {\n return getPersistedWishlistData();\n }\n\n return fetchGraphQl(GET_WISHLISTS_QUERY).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.customer?.wishlists) {\n return null;\n }\n\n return data.customer.wishlists.map((wishlist: any) =>\n transformWishlist(wishlist)\n );\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { WISHLIST_FRAGMENT } from '@/wishlist/api/fragments';\n\nexport const ADD_PRODUCTS_TO_WISHLIST_MUTATION = `\n mutation ADD_PRODUCTS_TO_WISHLIST_MUTATION(\n $wishlistId: ID!, \n $wishlistItems: [WishlistItemInput!]!,\n ) {\n addProductsToWishlist(\n wishlistId: $wishlistId\n wishlistItems: $wishlistItems\n ) {\n wishlist {\n ...WISHLIST_FRAGMENT\n }\n user_errors {\n code\n message\n }\n }\n }\n${WISHLIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl, getPersistedWishlistData } from '@/wishlist/api';\nimport { state } from '@/wishlist/lib/state';\nimport { handleFetchError } from '@/wishlist/lib/fetch-error';\nimport { ADD_PRODUCTS_TO_WISHLIST_MUTATION } from './graphql/addProductsToWishlistMutation';\nimport { Wishlist } from '@/wishlist/data/models/wishlist';\nimport { transformWishlist } from '@/wishlist/data/transforms';\nimport { events } from '@adobe-commerce/event-bus';\nimport { isMatchingWishlistItem } from '@/wishlist/lib/wishlist-item-comparator';\n\nexport const addProductsToWishlist = async (\n items: [\n {\n sku: string;\n quantity: number;\n optionsUIDs?: string[]; // should be the options available for the product\n enteredOptions?: { uid: string; value: string }[]; // refer to both selected and entered options\n }\n ]\n): Promise<Wishlist | null> => {\n if (!items) return null;\n\n const wishlist = getPersistedWishlistData();\n let updatedWishlist = {\n id: wishlist?.id ?? '',\n updated_at: '',\n sharing_code: '',\n items_count: 0,\n items: wishlist?.items ?? [],\n };\n\n for (const item of items) {\n const skuExists = updatedWishlist.items?.some((wishlistItem: any) =>\n isMatchingWishlistItem(wishlistItem, {\n sku: item.sku,\n optionUIDs: item.optionsUIDs,\n })\n );\n\n if (skuExists) {\n continue;\n }\n\n const selectedOptions: { uid: string }[] = item.optionsUIDs\n ? item.optionsUIDs?.map((option: any) => ({\n uid: option,\n }))\n : [];\n\n updatedWishlist.items = [\n ...updatedWishlist.items,\n {\n id: crypto.randomUUID(),\n quantity: item.quantity,\n selectedOptions,\n enteredOptions: item.enteredOptions ?? [],\n product: { sku: item.sku },\n },\n ];\n }\n\n updatedWishlist.items_count = updatedWishlist.items?.length;\n events.emit('wishlist/data', updatedWishlist);\n\n if (state.authenticated) {\n if (!state.wishlistId) {\n events.emit('wishlist/data', wishlist);\n throw Error('Wishlist ID is not set');\n }\n\n const variables = {\n wishlistId: state.wishlistId,\n wishlistItems: items.map(\n ({ sku, quantity, optionsUIDs, enteredOptions }) => ({\n sku,\n quantity,\n selected_options: optionsUIDs,\n entered_options: enteredOptions,\n })\n ),\n };\n\n const { errors, data }: { errors: any; data: any } = await fetchGraphQl(\n ADD_PRODUCTS_TO_WISHLIST_MUTATION,\n { variables }\n );\n\n const _errors = [\n ...(data?.addProductsToWishlist?.user_errors ?? []),\n ...(errors ?? []),\n ];\n\n // if saving item to wishlist for logged user failed, we need to restore original wishlist in storage:\n if (_errors.length > 0) {\n events.emit('wishlist/data', wishlist);\n return handleFetchError(_errors);\n }\n\n const updatedWishlist = transformWishlist(\n data.addProductsToWishlist.wishlist,\n items[0]?.enteredOptions ?? []\n );\n events.emit('wishlist/data', updatedWishlist);\n }\n\n return null;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { state } from '@/wishlist/lib/state';\nimport { Wishlist } from '@/wishlist/data/models';\n\nexport const resetWishlist = (): Promise<Wishlist | null> => {\n state.wishlistId = null;\n state.authenticated = false;\n\n return Promise.resolve(null);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\nimport { state } from '@/wishlist/lib/state';\nimport { getStoreConfig, getWishlists } from '@/wishlist/api';\nimport { getPersistedWishlistData } from '@/wishlist/lib/persisted-data';\nimport { Wishlist } from '@/wishlist/data/models';\n\nexport const initializeWishlist = async (): Promise<Wishlist | null> => {\n if (state.initializing) return null;\n\n state.initializing = true;\n\n // set config\n if (!state.config) {\n state.config = await getStoreConfig();\n }\n\n const payload = state.authenticated\n ? await getDefaultWishlist()\n : await getGuestWishlist();\n\n events.emit('wishlist/initialized', payload);\n events.emit('wishlist/data', payload);\n\n state.initializing = false;\n\n return payload;\n};\n\nexport async function getDefaultWishlist() {\n const wishlists = await getWishlists();\n const wishlist = wishlists ? wishlists[0] : null;\n if (!wishlist) return null;\n\n state.wishlistId = wishlist.id;\n\n return wishlist;\n}\n\nexport async function getGuestWishlist() {\n try {\n return await getPersistedWishlistData();\n } catch (error) {\n console.error(error);\n throw error;\n }\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Wishlist, Item } from '@/wishlist/data/models';\nimport { addProductsToWishlist } from '@/wishlist/api';\nimport {\n getPersistedWishlistData,\n clearPersistedLocalStorage,\n} from '@/wishlist/lib/persisted-data';\nimport { isMatchingWishlistItem } from '@/wishlist/lib/wishlist-item-comparator';\n\nexport const mergeWishlists = async (\n wishlist: Wishlist\n): Promise<Wishlist | null> => {\n if (!wishlist) {\n return null;\n }\n\n const guestWishlist: {\n id?: string;\n items?: Item[];\n } = getPersistedWishlistData(true);\n const itemsToMerge: any[] = [];\n\n guestWishlist?.items?.forEach((item: any) => {\n const optionUIDs =\n item.selectedOptions?.map((option: any) => option.uid) || [];\n\n const exists = wishlist.items.some((wishlistItem: any) =>\n isMatchingWishlistItem(wishlistItem, {\n sku: item.product.sku,\n optionUIDs,\n })\n );\n\n if (!exists) {\n const mergeItem = {\n sku: item.product.sku,\n quantity: 1,\n optionsUIDs: optionUIDs,\n enteredOptions: item.enteredOptions || undefined,\n };\n\n itemsToMerge.push(mergeItem);\n }\n });\n\n if (itemsToMerge.length === 0) {\n return null;\n }\n\n const result = await addProductsToWishlist(itemsToMerge);\n clearPersistedLocalStorage();\n return result;\n};\n"],"names":["initialize","Initializer","config","defaultConfig","initializeWishlist","events","payload","setPersistedWishlistData","authenticated","state","wishlist","mergeWishlists","resetWishlist","transformStoreConfig","data","transformWishlist","enteredOptions","transformItems","_b","_a","item","selectedOptions","getSelectedOptions","option","value","STORE_CONFIG_QUERY","getStoreConfig","fetchGraphQl","errors","handleFetchError","CUSTOMIZABLE_OPTIONS_FRAGMENT","CONFIGURABLE_WISHLIST_ITEM_FRAGMENT","DOWNLOADABLE_WISHLIST_ITEM_FRAGMENT","GIFT_CARD_WISHLIST_ITEM_FRAGMENT","BUNDLE_WISHLIST_ITEM_FRAGMENT","WISHLIST_ITEM_FRAGMENT","WISHLIST_FRAGMENT","GET_WISHLISTS_QUERY","getWishlists","getPersistedWishlistData","ADD_PRODUCTS_TO_WISHLIST_MUTATION","addProductsToWishlist","items","updatedWishlist","wishlistItem","isMatchingWishlistItem","_c","variables","sku","quantity","optionsUIDs","_errors","_d","_e","getDefaultWishlist","getGuestWishlist","wishlists","error","guestWishlist","itemsToMerge","optionUIDs","mergeItem","result","clearPersistedLocalStorage"],"mappings":"uMAgBO,MAAMA,EAAa,IAAIC,EAAyB,CACrD,KAAM,MAAOC,GAAW,CACtB,MAAMC,EAAgB,CAAE,uBAAwB,GAAO,GAAGD,CAAAA,EAE1DF,EAAW,OAAO,UAAUG,CAAa,EACzCC,IAAqB,MAAM,QAAQ,KAAK,CAC1C,EAEA,UAAW,IAAM,CACfC,EAAO,GACL,gBACCC,GAAY,CACXC,EAAyBD,CAAO,CAClC,EACA,CAAE,MAAO,EAAA,CAAK,EAEhBD,EAAO,GACL,gBACA,MAAOG,GAAkB,CAMvB,GALIC,EAAM,eAAiB,CAACD,GAE1BH,EAAO,KAAK,iBAAkB,MAAS,EAGrCG,GAAiB,CAACC,EAAM,cAAe,CACzCA,EAAM,cAAgBD,EACtB,MAAME,EAAW,MAAMN,EAAA,EAAqB,MAAM,QAAQ,KAAK,EAC3DM,GACFC,EAAeD,CAAQ,CAE3B,CACF,EACA,CAAE,MAAO,EAAA,CAAK,EAEhBL,EAAO,GAAG,iBAAkB,IAAM,CAChCO,IAAgB,MAAM,QAAQ,KAAK,EACnCP,EAAO,KAAK,gBAAiB,IAAI,CACnC,CAAC,CAAA,CAEL,CAAC,EAEYH,EAASF,EAAW,OCtC1B,SAASa,EAAqBC,EAAoC,CACvE,OAAKA,EAEE,CACL,kBAAmBA,EAAK,YAAY,oCACpC,8BAA+BA,EAAK,YAAY,0BAChD,kBAAmBA,EAAK,YAAY,2BAAA,EALpB,IAOpB,CCTO,SAASC,EACdD,E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,EAAe,QAAf,MAAAvC,EAAsB,QAASC,GAAc,OAC3C,MAAMwC,IACJzC,EAAAC,EAAK,kBAAL,YAAAD,EAAsB,IAAKI,GAAgBA,EAAO,OAAQ,CAAA,EAS5D,GAAI,CAPWb,EAAS,MAAM,KAAMkC,GAClCC,EAAuBD,EAAc,CACnC,IAAKxB,EAAK,QAAQ,IAClB,WAAAwC,CAAA,CACD,CAAA,EAGU,CACX,MAAMC,EAAY,CAChB,IAAKzC,EAAK,QAAQ,IAClB,SAAU,EACV,YAAawC,EACb,eAAgBxC,EAAK,gBAAkB,MAAA,EAGzCuC,EAAa,KAAKE,CAAS,CAC7B,CACF,GAEIF,EAAa,SAAW,EAC1B,OAAO,KAGT,MAAMG,EAAS,MAAMrB,EAAsBkB,CAAY,EACvD,OAAAI,EAAA,EACOD,CACT"}
@@ -1,4 +1,4 @@
1
- /*! Copyright 2025 Adobe
1
+ /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
3
  import{events as d}from"@dropins/tools/event-bus.js";import{FetchGraphQL as S}from"@dropins/tools/fetch-graphql.js";function g(s){const e=document.cookie.split(";");for(const t of e)if(t.trim().startsWith(`${s}=`))return t.trim().substring(s.length+1);return null}const f={wishlistId:null,authenticated:!1,isLoading:!0},n=new Proxy(f,{set(s,e,t){if(s[e]=t,e==="wishlistId"){if(t===n.wishlistId)return!0;if(t===null)return document.cookie="DROPIN__WISHLIST__WISHLIST-ID=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/",!0;const r=new Date;r.setDate(r.getDate()+30),document.cookie=`DROPIN__WISHLIST__WISHLIST-ID=${t}; expires=${r.toUTCString()}; path=/`}return Reflect.set(s,e,t)},get(s,e){return e==="wishlistId"?g("DROPIN__WISHLIST__WISHLIST-ID"):s[e]}});function u(s,e){var o;if(s.product.sku!==e.sku)return!1;const t=((o=s.selectedOptions)==null?void 0:o.map(i=>i.uid).filter(i=>!!i).sort())||[],r=(e.optionUIDs||[]).filter(i=>!!i).sort();return JSON.stringify(t)===JSON.stringify(r)}const c="DROPIN__WISHLIST__WISHLIST__DATA";function E(s){const e=n.authenticated?sessionStorage:localStorage;if(s)try{e.setItem(c,JSON.stringify(s))}catch(t){_(t)?console.error("Storage quota exceeded:",t):console.error("Error saving wishlist:",t)}else e.removeItem(c)}const _=s=>s instanceof DOMException&&s.name==="QuotaExceededError";function p(s=!1){const e=n.authenticated&&!s?sessionStorage:localStorage;try{const t=e.getItem(c);return t?JSON.parse(t):{id:"",items:[]}}catch(t){return console.error("Error retrieving wishlist:",t),{id:"",items:[]}}}function H(){localStorage.removeItem(c)}function L(s,e=[]){var o;const t=n.authenticated?sessionStorage:localStorage,r=t.getItem(c)?JSON.parse(String(t.getItem(c))):{items:[]};return(o=r==null?void 0:r.items)==null?void 0:o.find(i=>u(i,{sku:s,optionUIDs:e}))}const{setEndpoint:P,setFetchGraphQlHeader:F,removeFetchGraphQlHeader:R,setFetchGraphQlHeaders:M,fetchGraphQl:w,getConfig:N}=new S().getMethods(),D=s=>{const e=s.map(t=>t.message).join(" ");throw Error(e)},O=`
4
4
  mutation REMOVE_PRODUCTS_FROM_WISHLIST_MUTATION(
@@ -1 +1 @@
1
- {"version":3,"file":"removeProductsFromWishlist.js","sources":["/@dropins/storefront-wishlist/src/lib/cookies.ts","/@dropins/storefront-wishlist/src/lib/state.ts","/@dropins/storefront-wishlist/src/lib/wishlist-item-comparator.ts","/@dropins/storefront-wishlist/src/lib/persisted-data.ts","/@dropins/storefront-wishlist/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-wishlist/src/lib/fetch-error.ts","/@dropins/storefront-wishlist/src/api/removeProductsFromWishlist/graphql/removeProductsFromWishlistMutation.ts","/@dropins/storefront-wishlist/src/api/removeProductsFromWishlist/removeProductsFromWishlist.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport function getCookie(cookieName: string) {\n // Split the cookie string into an array of individual cookies\n const cookies = document.cookie.split(';');\n\n // Loop through the cookies to find the one with the specified name\n for (const cookie of cookies) {\n // Check if this cookie starts with the name you're looking for\n if (cookie.trim().startsWith(`${cookieName}=`)) {\n // Extract and return the cookie's value\n return cookie.trim().substring(cookieName.length + 1);\n }\n }\n\n // If the cookie is not found, return null\n return null;\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { StoreConfigModel } from '@/wishlist/data/models/store-config';\nimport { getCookie } from '@/wishlist/lib/cookies';\n\ntype State = {\n wishlistId: string | null;\n initializing?: boolean;\n isLoading?: boolean;\n locale?: string;\n config?: StoreConfigModel | null;\n authenticated: boolean;\n};\n\nconst _state: State = (() => {\n return {\n wishlistId: null,\n authenticated: false,\n isLoading: true,\n };\n})();\n\n// Proxy state to allow reactivity\nexport const state = new Proxy(_state, {\n set(target, key, value) {\n // @ts-ignore\n target[key] = value;\n\n if (key === 'wishlistId') {\n // only update cookie if value has changed\n if (value === state.wishlistId) return true;\n\n if (value === null) {\n // remove cookie\n document.cookie = `DROPIN__WISHLIST__WISHLIST-ID=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/`;\n return true;\n }\n\n // set expiration date\n const expires = new Date();\n expires.setDate(expires.getDate() + 30);\n // set cookie\n document.cookie = `DROPIN__WISHLIST__WISHLIST-ID=${value}; expires=${expires.toUTCString()}; path=/`;\n }\n\n return Reflect.set(target, key, value);\n },\n get(target, key) {\n if (key === 'wishlistId') {\n // get value from cookie\n return getCookie('DROPIN__WISHLIST__WISHLIST-ID');\n }\n\n return target[key as keyof State];\n },\n});\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Item } from '@/wishlist/data/models/wishlist';\n\ninterface ProductLike {\n sku: string;\n optionUIDs?: string[];\n}\n\n/**\n * Helper function to compare wishlist items by their SKU and selected options\n */\nexport function isMatchingWishlistItem(\n wishlistItem: Item,\n product: ProductLike\n): boolean {\n // Compare SKUs first for early return\n if (wishlistItem.product.sku !== product.sku) {\n return false;\n }\n\n // Compare selected options\n const wishlistItemOptions =\n wishlistItem.selectedOptions\n ?.map((option: any) => option.uid)\n .filter((uid: any) => !!uid)\n .sort() || [];\n const productOptionUIDs = (product.optionUIDs || [])\n .filter((uid: any) => !!uid)\n .sort();\n\n // If options match (or both are empty), items are considered matching\n return (\n JSON.stringify(wishlistItemOptions) === JSON.stringify(productOptionUIDs)\n );\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Wishlist } from '@/wishlist/data/models';\nimport { state } from '@/wishlist/lib/state';\nimport { isMatchingWishlistItem } from '@/wishlist/lib/wishlist-item-comparator';\n\nconst WISHLIST_KEY = 'DROPIN__WISHLIST__WISHLIST__DATA';\n\nexport function setPersistedWishlistData(data: Wishlist | null) {\n const $storage = state.authenticated ? sessionStorage : localStorage;\n if (data) {\n try {\n $storage.setItem(WISHLIST_KEY, JSON.stringify(data));\n } catch (error) {\n if (isQuotaExceededError(error)) {\n console.error('Storage quota exceeded:', error);\n } else {\n console.error('Error saving wishlist:', error);\n }\n }\n } else {\n $storage.removeItem(WISHLIST_KEY);\n }\n}\n\nconst isQuotaExceededError = (error: unknown) => {\n //https://mmazzarolo.com/blog/2022-06-25-local-storage-status/\n return error instanceof DOMException && error.name === 'QuotaExceededError';\n};\n\nexport function getPersistedWishlistData(\n guest: boolean = false\n): Wishlist | {} {\n const $storage =\n state.authenticated && !guest ? sessionStorage : localStorage;\n try {\n const wishlist = $storage.getItem(WISHLIST_KEY);\n return wishlist ? JSON.parse(wishlist) : { id: '', items: [] };\n } catch (error) {\n console.error('Error retrieving wishlist:', error);\n return { id: '', items: [] };\n }\n}\n\nexport function clearPersistedLocalStorage() {\n localStorage.removeItem(WISHLIST_KEY);\n}\n\nexport function getWishlistItemFromStorage(\n productSku: string,\n optionUIDs: string[] = []\n) {\n const storage = state.authenticated ? sessionStorage : localStorage;\n const wishlist = storage.getItem(WISHLIST_KEY)\n ? JSON.parse(String(storage.getItem(WISHLIST_KEY)))\n : { id: '', items: [] };\n\n return wishlist?.items?.find((item: any) =>\n isMatchingWishlistItem(item, {\n sku: productSku,\n optionUIDs,\n })\n );\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/** Actions */\nexport const handleFetchError = (errors: Array<{ message: string }>) => {\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REMOVE_PRODUCTS_FROM_WISHLIST_MUTATION = `\n mutation REMOVE_PRODUCTS_FROM_WISHLIST_MUTATION(\n $wishlistId: ID!, \n $wishlistItemsIds: [ID!]!,\n ) {\n removeProductsFromWishlist(\n wishlistId: $wishlistId\n wishlistItemsIds: $wishlistItemsIds\n ) {\n user_errors {\n code\n message\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/wishlist/api';\nimport { state } from '@/wishlist/lib/state';\nimport { handleFetchError } from '@/wishlist/lib/fetch-error';\nimport { REMOVE_PRODUCTS_FROM_WISHLIST_MUTATION } from './graphql/removeProductsFromWishlistMutation';\nimport { Item, Wishlist } from '@/wishlist/data/models/wishlist';\nimport { events } from '@adobe-commerce/event-bus';\nimport { getPersistedWishlistData } from '@/wishlist/lib/persisted-data';\nimport { isMatchingWishlistItem } from '@/wishlist/lib/wishlist-item-comparator';\n\nexport const removeProductsFromWishlist = async (\n items: Array<Item>\n): Promise<Wishlist | null> => {\n const wishlist = getPersistedWishlistData();\n const updatedWishlist = {\n ...wishlist,\n items: wishlist.items?.filter((wishlistItem: any) => {\n return !items.some((item) =>\n isMatchingWishlistItem(wishlistItem, {\n sku: item.product.sku,\n optionUIDs: item.selectedOptions?.map((option: any) => option.uid),\n })\n );\n }),\n };\n\n if (state.authenticated) {\n if (!state.wishlistId) {\n throw Error('Wishlist ID is not set');\n }\n\n const itemIds = items.map((item) => item.id);\n const { errors, data } = await fetchGraphQl(\n REMOVE_PRODUCTS_FROM_WISHLIST_MUTATION,\n {\n variables: { wishlistId: state.wishlistId, wishlistItemsIds: itemIds },\n }\n );\n\n const _errors = [\n ...(data?.removeProductsFromWishlist?.user_errors ?? []),\n ...(errors ?? []),\n ];\n\n // restore wishlist if removing item failed:\n if (_errors.length > 0) {\n events.emit('wishlist/data', wishlist);\n return handleFetchError(_errors);\n }\n }\n\n updatedWishlist.items_count = updatedWishlist.items?.length;\n events.emit('wishlist/data', updatedWishlist);\n\n return null;\n};\n"],"names":["getCookie","cookieName","cookies","cookie","_state","state","target","key","value","expires","isMatchingWishlistItem","wishlistItem","product","wishlistItemOptions","_a","option","uid","productOptionUIDs","WISHLIST_KEY","setPersistedWishlistData","data","$storage","error","isQuotaExceededError","getPersistedWishlistData","guest","wishlist","clearPersistedLocalStorage","getWishlistItemFromStorage","productSku","optionUIDs","storage","item","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","handleFetchError","errors","errorMessage","e","REMOVE_PRODUCTS_FROM_WISHLIST_MUTATION","removeProductsFromWishlist","items","updatedWishlist","itemIds","_errors","_b","events","_c"],"mappings":"oHAiBO,SAASA,EAAUC,EAAoB,CAE5C,MAAMC,EAAU,SAAS,OAAO,MAAM,GAAG,EAGzC,UAAWC,KAAUD,EAEnB,GAAIC,EAAO,OAAO,WAAW,GAAGF,CAAU,GAAG,EAE3C,OAAOE,EAAO,KAAK,EAAE,UAAUF,EAAW,OAAS,CAAC,EAKjD,OAAA,IACT,CCHA,MAAMG,EACG,CACL,WAAY,KACZ,cAAe,GACf,UAAW,EACb,EAIWC,EAAQ,IAAI,MAAMD,EAAQ,CACrC,IAAIE,EAAQC,EAAKC,EAAO,CAItB,GAFAF,EAAOC,CAAG,EAAIC,EAEVD,IAAQ,aAAc,CAEpB,GAAAC,IAAUH,EAAM,WAAmB,MAAA,GAEvC,GAAIG,IAAU,KAEZ,gBAAS,OAAS,gFACX,GAIH,MAAAC,MAAc,KACpBA,EAAQ,QAAQA,EAAQ,QAAQ,EAAI,EAAE,EAEtC,SAAS,OAAS,iCAAiCD,CAAK,aAAaC,EAAQ,YAAa,CAAA,UAAA,CAG5F,OAAO,QAAQ,IAAIH,EAAQC,EAAKC,CAAK,CACvC,EACA,IAAIF,EAAQC,EAAK,CACf,OAAIA,IAAQ,aAEHP,EAAU,+BAA+B,EAG3CM,EAAOC,CAAkB,CAAA,CAEpC,CAAC,EC3Ce,SAAAG,EACdC,EACAC,EACS,OAET,GAAID,EAAa,QA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AAAQ,EAAQ,OAAS,EACZ,OAAAE,EAAA,KAAK,gBAAiBzB,CAAQ,EAC9Bc,EAAiBS,CAAO,CACjC,CAGc,OAAAF,EAAA,aAAcK,EAAAL,EAAgB,QAAhB,YAAAK,EAAuB,OAC9CD,EAAA,KAAK,gBAAiBJ,CAAe,EAErC,IACT"}
1
+ {"version":3,"file":"removeProductsFromWishlist.js","sources":["/@dropins/storefront-wishlist/src/lib/cookies.ts","/@dropins/storefront-wishlist/src/lib/state.ts","/@dropins/storefront-wishlist/src/lib/wishlist-item-comparator.ts","/@dropins/storefront-wishlist/src/lib/persisted-data.ts","/@dropins/storefront-wishlist/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-wishlist/src/lib/fetch-error.ts","/@dropins/storefront-wishlist/src/api/removeProductsFromWishlist/graphql/removeProductsFromWishlistMutation.ts","/@dropins/storefront-wishlist/src/api/removeProductsFromWishlist/removeProductsFromWishlist.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport function getCookie(cookieName: string) {\n // Split the cookie string into an array of individual cookies\n const cookies = document.cookie.split(';');\n\n // Loop through the cookies to find the one with the specified name\n for (const cookie of cookies) {\n // Check if this cookie starts with the name you're looking for\n if (cookie.trim().startsWith(`${cookieName}=`)) {\n // Extract and return the cookie's value\n return cookie.trim().substring(cookieName.length + 1);\n }\n }\n\n // If the cookie is not found, return null\n return null;\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { StoreConfigModel } from '@/wishlist/data/models/store-config';\nimport { getCookie } from '@/wishlist/lib/cookies';\n\ntype State = {\n wishlistId: string | null;\n initializing?: boolean;\n isLoading?: boolean;\n locale?: string;\n config?: StoreConfigModel | null;\n authenticated: boolean;\n};\n\nconst _state: State = (() => {\n return {\n wishlistId: null,\n authenticated: false,\n isLoading: true,\n };\n})();\n\n// Proxy state to allow reactivity\nexport const state = new Proxy(_state, {\n set(target, key, value) {\n // @ts-ignore\n target[key] = value;\n\n if (key === 'wishlistId') {\n // only update cookie if value has changed\n if (value === state.wishlistId) return true;\n\n if (value === null) {\n // remove cookie\n document.cookie = `DROPIN__WISHLIST__WISHLIST-ID=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/`;\n return true;\n }\n\n // set expiration date\n const expires = new Date();\n expires.setDate(expires.getDate() + 30);\n // set cookie\n document.cookie = `DROPIN__WISHLIST__WISHLIST-ID=${value}; expires=${expires.toUTCString()}; path=/`;\n }\n\n return Reflect.set(target, key, value);\n },\n get(target, key) {\n if (key === 'wishlistId') {\n // get value from cookie\n return getCookie('DROPIN__WISHLIST__WISHLIST-ID');\n }\n\n return target[key as keyof State];\n },\n});\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Item } from '@/wishlist/data/models/wishlist';\n\ninterface ProductLike {\n sku: string;\n optionUIDs?: string[];\n}\n\n/**\n * Helper function to compare wishlist items by their SKU and selected options\n */\nexport function isMatchingWishlistItem(\n wishlistItem: Item,\n product: ProductLike\n): boolean {\n // Compare SKUs first for early return\n if (wishlistItem.product.sku !== product.sku) {\n return false;\n }\n\n // Compare selected options\n const wishlistItemOptions =\n wishlistItem.selectedOptions\n ?.map((option: any) => option.uid)\n .filter((uid: any) => !!uid)\n .sort() || [];\n const productOptionUIDs = (product.optionUIDs || [])\n .filter((uid: any) => !!uid)\n .sort();\n\n // If options match (or both are empty), items are considered matching\n return (\n JSON.stringify(wishlistItemOptions) === JSON.stringify(productOptionUIDs)\n );\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Wishlist } from '@/wishlist/data/models';\nimport { state } from '@/wishlist/lib/state';\nimport { isMatchingWishlistItem } from '@/wishlist/lib/wishlist-item-comparator';\n\nconst WISHLIST_KEY = 'DROPIN__WISHLIST__WISHLIST__DATA';\n\nexport function setPersistedWishlistData(data: Wishlist | null) {\n const $storage = state.authenticated ? sessionStorage : localStorage;\n if (data) {\n try {\n $storage.setItem(WISHLIST_KEY, JSON.stringify(data));\n } catch (error) {\n if (isQuotaExceededError(error)) {\n console.error('Storage quota exceeded:', error);\n } else {\n console.error('Error saving wishlist:', error);\n }\n }\n } else {\n $storage.removeItem(WISHLIST_KEY);\n }\n}\n\nconst isQuotaExceededError = (error: unknown) => {\n //https://mmazzarolo.com/blog/2022-06-25-local-storage-status/\n return error instanceof DOMException && error.name === 'QuotaExceededError';\n};\n\nexport function getPersistedWishlistData(\n guest: boolean = false\n): Wishlist | {} {\n const $storage =\n state.authenticated && !guest ? sessionStorage : localStorage;\n try {\n const wishlist = $storage.getItem(WISHLIST_KEY);\n return wishlist ? JSON.parse(wishlist) : { id: '', items: [] };\n } catch (error) {\n console.error('Error retrieving wishlist:', error);\n return { id: '', items: [] };\n }\n}\n\nexport function clearPersistedLocalStorage() {\n localStorage.removeItem(WISHLIST_KEY);\n}\n\nexport function getWishlistItemFromStorage(\n productSku: string,\n optionUIDs: string[] = []\n) {\n const storage = state.authenticated ? sessionStorage : localStorage;\n const wishlist = storage.getItem(WISHLIST_KEY)\n ? JSON.parse(String(storage.getItem(WISHLIST_KEY)))\n : { id: '', items: [] };\n\n return wishlist?.items?.find((item: any) =>\n isMatchingWishlistItem(item, {\n sku: productSku,\n optionUIDs,\n })\n );\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/** Actions */\nexport const handleFetchError = (errors: Array<{ message: string }>) => {\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REMOVE_PRODUCTS_FROM_WISHLIST_MUTATION = `\n mutation REMOVE_PRODUCTS_FROM_WISHLIST_MUTATION(\n $wishlistId: ID!, \n $wishlistItemsIds: [ID!]!,\n ) {\n removeProductsFromWishlist(\n wishlistId: $wishlistId\n wishlistItemsIds: $wishlistItemsIds\n ) {\n user_errors {\n code\n message\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/wishlist/api';\nimport { state } from '@/wishlist/lib/state';\nimport { handleFetchError } from '@/wishlist/lib/fetch-error';\nimport { REMOVE_PRODUCTS_FROM_WISHLIST_MUTATION } from './graphql/removeProductsFromWishlistMutation';\nimport { Item, Wishlist } from '@/wishlist/data/models/wishlist';\nimport { events } from '@adobe-commerce/event-bus';\nimport { getPersistedWishlistData } from '@/wishlist/lib/persisted-data';\nimport { isMatchingWishlistItem } from '@/wishlist/lib/wishlist-item-comparator';\n\nexport const removeProductsFromWishlist = async (\n items: Array<Item>\n): Promise<Wishlist | null> => {\n const wishlist = getPersistedWishlistData();\n const updatedWishlist = {\n ...wishlist,\n items: wishlist.items?.filter((wishlistItem: any) => {\n return !items.some((item) =>\n isMatchingWishlistItem(wishlistItem, {\n sku: item.product.sku,\n optionUIDs: item.selectedOptions?.map((option: any) => option.uid),\n })\n );\n }),\n };\n\n if (state.authenticated) {\n if (!state.wishlistId) {\n throw Error('Wishlist ID is not set');\n }\n\n const itemIds = items.map((item) => item.id);\n const { errors, data } = await fetchGraphQl(\n REMOVE_PRODUCTS_FROM_WISHLIST_MUTATION,\n {\n variables: { wishlistId: state.wishlistId, wishlistItemsIds: itemIds },\n }\n );\n\n const _errors = [\n ...(data?.removeProductsFromWishlist?.user_errors ?? []),\n ...(errors ?? []),\n ];\n\n // restore wishlist if removing item failed:\n if (_errors.length > 0) {\n events.emit('wishlist/data', wishlist);\n return handleFetchError(_errors);\n }\n }\n\n updatedWishlist.items_count = updatedWishlist.items?.length;\n events.emit('wishlist/data', updatedWishlist);\n\n return null;\n};\n"],"names":["getCookie","cookieName","cookies","cookie","_state","state","target","key","value","expires","isMatchingWishlistItem","wishlistItem","product","wishlistItemOptions","_a","option","uid","productOptionUIDs","WISHLIST_KEY","setPersistedWishlistData","data","$storage","error","isQuotaExceededError","getPersistedWishlistData","guest","wishlist","clearPersistedLocalStorage","getWishlistItemFromStorage","productSku","optionUIDs","storage","item","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","handleFetchError","errors","errorMessage","e","REMOVE_PRODUCTS_FROM_WISHLIST_MUTATION","removeProductsFromWishlist","items","updatedWishlist","itemIds","_errors","_b","events","_c"],"mappings":"oHAiBO,SAASA,EAAUC,EAAoB,CAE5C,MAAMC,EAAU,SAAS,OAAO,MAAM,GAAG,EAGzC,UAAWC,KAAUD,EAEnB,GAAIC,EAAO,OAAO,WA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AA6B,MACxCC,GAC6B,WAC7B,MAAMpB,EAAWF,EAAA,EACXuB,EAAkB,CACtB,GAAGrB,EACH,OAAOZ,EAAAY,EAAS,QAAT,YAAAZ,EAAgB,OAAQH,GACtB,CAACmC,EAAM,KAAMd,GAAA,OAClB,OAAAtB,EAAuBC,EAAc,CACnC,IAAKqB,EAAK,QAAQ,IAClB,YAAYlB,EAAAkB,EAAK,kBAAL,YAAAlB,EAAsB,IAAKC,GAAgBA,EAAO,IAAG,CAClE,EAAA,EAEJ,EAGH,GAAIV,EAAM,cAAe,CACvB,GAAI,CAACA,EAAM,WACT,MAAM,MAAM,wBAAwB,EAGtC,MAAM2C,EAAUF,EAAM,IAAKd,GAASA,EAAK,EAAE,EACrC,CAAE,OAAAS,EAAQ,KAAArB,CAAA,EAAS,MAAMiB,EAC7BO,EACA,CACE,UAAW,CAAE,WAAYvC,EAAM,WAAY,iBAAkB2C,CAAA,CAAQ,CACvE,EAGIC,EAAU,CACd,KAAIC,EAAA9B,GAAA,YAAAA,EAAM,6BAAN,YAAA8B,EAAkC,cAAe,CAAA,EACrD,GAAIT,GAAU,CAAA,CAAC,EAIjB,GAAIQ,EAAQ,OAAS,EACnB,OAAAE,EAAO,KAAK,gBAAiBzB,CAAQ,EAC9Bc,EAAiBS,CAAO,CAEnC,CAEA,OAAAF,EAAgB,aAAcK,EAAAL,EAAgB,QAAhB,YAAAK,EAAuB,OACrDD,EAAO,KAAK,gBAAiBJ,CAAe,EAErC,IACT"}
@@ -1,4 +1,4 @@
1
- /*! Copyright 2025 Adobe
1
+ /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
3
  import{jsx as i,jsxs as o,Fragment as F}from"@dropins/tools/preact-jsx-runtime.js";import{useState as f,useCallback as A,useEffect as B,useMemo as E,Fragment as R}from"@dropins/tools/preact-compat.js";import{classes as I,Slot as V,VComponent as Y}from"@dropins/tools/lib.js";import{IllustratedMessage as q,Button as G,Icon as J,SkeletonRow as K,Skeleton as O}from"@dropins/tools/components.js";import{W as Q}from"../chunks/WishlistItem.js";import{events as H}from"@dropins/tools/event-bus.js";import{s as $}from"../chunks/removeProductsFromWishlist.js";import{useText as z,Text as j}from"@dropins/tools/i18n.js";import{W as U}from"../chunks/WishlistAlert.js";import{S as X}from"../chunks/Heart.js";import"../chunks/Trash.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/HeartFilled.js";const Z=({className:r,children:t,ctaLinkURL:e,...m})=>{const h=z({emptyWishlist:"Wishlist.EmptyWishlist.heading",message:"Wishlist.EmptyWishlist.message",cta:"Wishlist.EmptyWishlist.cta"});return i("div",{...m,className:I(["wishlist-empty-wishlist",r]),children:i(q,{className:I(["wishlist-empty-wishlist__wrapper",r]),"data-testid":"wishlist-empty-wishlist",heading:h.emptyWishlist,icon:i(J,{className:"wishlist-empty-wishlist__icon",source:X}),message:i("p",{children:h.message}),action:e?i(G,{"data-testid":"wishlist-empty-wishlist-button",size:"medium",variant:"primary",type:"submit",href:e,children:h.cta},"routeHome"):void 0})})},b=()=>i(K,{children:`
4
4
  <svg
@@ -1 +1 @@
1
- {"version":3,"file":"Wishlist.js","sources":["/@dropins/storefront-wishlist/src/components/EmptyWishlist/EmptyWishlist.tsx","/@dropins/storefront-wishlist/src/components/Wishlist/WishlistItemSkeleton.tsx","/@dropins/storefront-wishlist/src/components/Wishlist/WishlistSkeleton.tsx","/@dropins/storefront-wishlist/src/containers/Wishlist/Wishlist.tsx","/@dropins/storefront-wishlist/src/components/Wishlist/Wishlist.tsx","/@dropins/storefront-wishlist/src/components/Login/Login.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Button, Icon, IllustratedMessage } from '@adobe-commerce/elsie/components';\nimport { Heart } from '@adobe-commerce/elsie/icons';\n\nimport '@/wishlist/components/EmptyWishlist/EmptyWishlist.css';\n\nexport interface EmptyWishlistProps extends HTMLAttributes<HTMLDivElement> {\n ctaLinkURL?: string;\n}\n\nexport const EmptyWishlist: FunctionComponent<EmptyWishlistProps> = ({\n className,\n children,\n ctaLinkURL,\n ...props\n}) => {\n const labels = useText({\n emptyWishlist: 'Wishlist.EmptyWishlist.heading',\n message: 'Wishlist.EmptyWishlist.message',\n cta: 'Wishlist.EmptyWishlist.cta',\n });\n\n return (\n <div {...props} className={classes(['wishlist-empty-wishlist', className])}>\n <IllustratedMessage\n className={classes(['wishlist-empty-wishlist__wrapper', className])}\n data-testid=\"wishlist-empty-wishlist\"\n heading={labels.emptyWishlist}\n icon={<Icon className=\"wishlist-empty-wishlist__icon\" source={Heart} />}\n message={<p>{labels.message}</p>}\n action={\n ctaLinkURL ? (\n <Button\n data-testid=\"wishlist-empty-wishlist-button\"\n size=\"medium\"\n variant=\"primary\"\n key=\"routeHome\"\n type=\"submit\"\n href={ctaLinkURL}\n >\n {labels.cta}\n </Button>\n ) : undefined\n }\n />\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { SkeletonRow } from '@adobe-commerce/elsie/components';\nimport { FunctionComponent } from 'preact';\n\nexport const WishlistItemSkeleton: FunctionComponent = () => {\n return (\n <SkeletonRow>{`\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox=\"0 0 288 658\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n preserveAspectRatio=\"xMinYMin meet\"\n >\n <rect x=\"6\" y=\"24\" width=\"282px\" height=\"480\" rx=\"8\" fill=\"#E8E8E8\" />\n <rect x=\"6\" y=\"522\" width=\"280\" height=\"22\" rx=\"4\" fill=\"#E8E8E8\" />\n <rect x=\"6\" y=\"556\" width=\"132\" height=\"22\" rx=\"4\" fill=\"#E8E8E8\" />\n <rect x=\"6\" y=\"592\" width=\"280\" height=\"48\" rx=\"24\" fill=\"#D9D9D9\" />\n </svg>\n `}</SkeletonRow>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Skeleton } from '@adobe-commerce/elsie/components';\nimport { FunctionComponent } from 'preact';\nimport { WishlistItemSkeleton } from '@/wishlist/components/Wishlist/WishlistItemSkeleton';\n\nexport const WishlistSkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"wishlist-loader\">\n <WishlistItemSkeleton />\n <WishlistItemSkeleton />\n <WishlistItemSkeleton />\n </Skeleton>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n HTMLAttributes,\n useCallback,\n useEffect,\n useState,\n} from 'preact/compat';\nimport { Container, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { Wishlist as WishlistComponent } from '@/wishlist/components';\nimport { events, WishlistActionPayload } from '@adobe-commerce/event-bus';\nimport {\n Item,\n Product,\n Wishlist as WishlistModel,\n} from '@/wishlist/data/models';\nimport { state } from '@/wishlist/lib/state';\nimport { WishlistAlert } from '@/wishlist/containers/WishlistAlert';\nimport { ImageProps } from '@adobe-commerce/elsie/components';\n\nexport interface WishlistProps extends HTMLAttributes<HTMLDivElement> {\n routeEmptyWishlistCTA?: () => string;\n routeToWishlist?: string;\n moveProdToCart: (\n products: { sku: string; quantity: number }[]\n ) => Promise<any>;\n routeProdDetailPage: (product: Product) => string;\n getProductData?: (sku: string) => Promise<Product | null>;\n getRefinedProduct?: (\n sku: string,\n optionUIDs: string[],\n anchorOptions?: string[],\n raw?: boolean\n ) => Promise<Product | null>;\n slots?: {\n image?: SlotProps<{\n defaultImageProps: ImageProps;\n item: Item;\n }>;\n };\n}\n\nexport const Wishlist: Container<WishlistProps> = ({\n routeEmptyWishlistCTA,\n routeToWishlist,\n moveProdToCart,\n routeProdDetailPage,\n getProductData,\n getRefinedProduct,\n slots,\n ...props\n}: WishlistProps) => {\n const [wishlistData, setWishlistData] = useState<WishlistModel | null>(null);\n const [isLoggedIn, setIsLoggedIn] = useState(state.authenticated);\n const [isLoading, setIsLoading] = useState(state.isLoading);\n\n const handleAuthentication = (authenticated: boolean) =>\n setIsLoggedIn(authenticated);\n\n const [wishlistAlert, setWishlistAlert] = useState<Element | null>(null);\n const handleWishlistAlert = useCallback(\n (payload: WishlistActionPayload) => {\n const { action, item } = payload;\n setWishlistAlert(\n <WishlistAlert\n action={action}\n item={item}\n routeToWishlist={routeToWishlist}\n />\n );\n },\n [routeToWishlist]\n );\n\n useEffect(() => {\n const authEvent = events.on('authenticated', handleAuthentication);\n const updateEvent = events.on('wishlist/alert', (payload) =>\n handleWishlistAlert(payload)\n );\n const dataEvent = events.on(\n 'wishlist/data',\n (payload) => {\n setWishlistData(payload as WishlistModel);\n setIsLoading(false);\n },\n { eager: true }\n );\n return () => {\n authEvent?.off();\n dataEvent?.off();\n updateEvent?.off();\n };\n }, [handleWishlistAlert]);\n\n return (\n <WishlistComponent\n {...props}\n wishlistData={wishlistData}\n wishlistAlert={wishlistAlert}\n routeEmptyWishlistCTA={routeEmptyWishlistCTA}\n moveProdToCart={moveProdToCart}\n getProductData={getProductData}\n getRefinedProduct={getRefinedProduct}\n isLoggedIn={isLoggedIn}\n isLoading={isLoading}\n routeProdDetailPage={routeProdDetailPage}\n slots={slots}\n />\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes, useState, useEffect, useMemo } from 'preact/compat';\nimport {\n VComponent,\n classes,\n Slot,\n SlotProps,\n} from '@adobe-commerce/elsie/lib';\nimport { WishlistSkeleton } from '@/wishlist/components/Wishlist/WishlistSkeleton';\nimport '@/wishlist/components/Wishlist/Wishlist.css';\nimport {\n Product,\n Wishlist as WishlistModel,\n Item,\n} from '@/wishlist/data/models';\nimport { WishlistItem, WishlistAlert } from '@/wishlist/containers';\nimport { Fragment } from 'react';\nimport { EmptyWishlist, Login } from '@/wishlist/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { ImageProps } from '@adobe-commerce/elsie/components';\n\nexport interface WishlistProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n wishlistData: WishlistModel;\n wishlistAlert: WishlistAlert | null;\n isLoggedIn: boolean;\n isLoading: boolean;\n moveProdToCart: (\n products: { sku: string; quantity: number }[]\n ) => Promise<any>;\n getProductData?: (sku: string) => Promise<Product | null>;\n getRefinedProduct?: (\n sku: string,\n optionUIDs: string[],\n anchorOptions?: string[],\n raw?: boolean\n ) => Promise<Product | null>;\n routeEmptyWishlistCTA?: () => string;\n onLoginClick?: () => void;\n routeProdDetailPage: (product: Product) => string;\n slots?: {\n image?: SlotProps<{\n defaultImageProps: ImageProps;\n item: Item;\n }>;\n };\n}\n\nexport const Wishlist: FunctionComponent<WishlistProps> = ({\n className,\n wishlistData,\n wishlistAlert,\n isLoggedIn,\n isLoading,\n moveProdToCart,\n getProductData,\n getRefinedProduct,\n routeEmptyWishlistCTA,\n onLoginClick,\n routeProdDetailPage,\n slots,\n ...props\n}) => {\n const [alert, setAlert] = useState<VNode | null>(wishlistAlert);\n\n const dictionary = useText({\n wishlistHeading: 'Wishlist.Wishlist.heading',\n wishlistLoadingHeading: 'Wishlist.Wishlist.loading',\n });\n\n const products = useMemo(() => {\n return wishlistData?.items?.length > 0\n ? wishlistData.items.map((item: Item) => (\n <WishlistItem\n key={item.id}\n item={item}\n getProductData={getProductData}\n getRefinedProduct={getRefinedProduct}\n moveProdToCart={moveProdToCart}\n routeProdDetailPage={routeProdDetailPage}\n imageNode={\n slots?.image\n ? ({ defaultImageProps }) => (\n <Slot\n name=\"image\"\n slot={slots.image}\n context={{\n defaultImageProps,\n item,\n }}\n />\n )\n : undefined\n }\n />\n ))\n : null;\n }, [wishlistData, moveProdToCart, getProductData, getRefinedProduct, routeProdDetailPage, slots?.image]);\n\n useEffect(() => {\n if (wishlistAlert) {\n setAlert(wishlistAlert);\n\n const timer = setTimeout(() => {\n setAlert(null);\n }, 5000);\n\n return () => clearTimeout(timer);\n }\n }, [wishlistAlert]);\n\n const renderAlert = useMemo(\n () =>\n alert ? (\n <VComponent node={alert} className=\"wishlist-wishlist__alert\" />\n ) : null,\n [alert]\n );\n\n const renderLoader = () => {\n return (\n <>\n <div\n className=\"wishlist-wishlist__heading\"\n data-testid=\"wishlist-heading-wrapper\"\n >\n <h1\n className=\"wishlist-wishlist__heading-text\"\n data-testid=\"loader-wishlist-heading\"\n >\n {dictionary.wishlistLoadingHeading}\n </h1>\n </div>\n <WishlistSkeleton />\n </>\n );\n };\n\n const renderWishlist = () => {\n return products ? (\n <>\n {renderHeading}\n <div className=\"wishlist-wishlist__content\">{products}</div>\n </>\n ) : (\n <div\n className={classes([\n 'wishlist-wishlist__content',\n 'wishlist-wishlist__content--empty',\n ])}\n >\n <div>\n <EmptyWishlist\n data-testid=\"empty-wishlist\"\n ctaLinkURL={routeEmptyWishlistCTA?.()}\n />\n {!isLoggedIn && <Login onLoginClick={onLoginClick} />}\n </div>\n </div>\n );\n };\n\n const renderHeading = useMemo(() => {\n if (!products) return null;\n\n return (\n <div\n className=\"wishlist-wishlist__heading\"\n data-testid=\"wishlist-heading-wrapper\"\n >\n <h1\n className=\"wishlist-wishlist__heading-text\"\n data-testid=\"default-wishlist-heading\"\n >\n {dictionary.wishlistHeading\n ?.split(' {count}')\n .map((title: string, index: number) => (\n <Fragment key={wishlistData?.id?.toString() + index}>\n {title}\n {index === 0 && (\n <span\n className=\"wishlist-wishlist__heading-count\"\n data-testid=\"wishlist-heading-count\"\n >\n {`${wishlistData?.items_count} products`}\n </span>\n )}\n </Fragment>\n ))}\n </h1>\n </div>\n );\n }, [dictionary, products, wishlistData]);\n\n return (\n <div {...props} className={classes(['wishlist-wishlist', className])}>\n {renderAlert}\n {isLoading ? renderLoader() : renderWishlist()}\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Text } from '@adobe-commerce/elsie/i18n';\nimport { FunctionComponent } from 'preact';\n\nimport '@/wishlist/components/Login/Login.css';\n\nexport interface LoginProps {\n onLoginClick?: () => void;\n}\n\nexport const Login: FunctionComponent<LoginProps> = ({ onLoginClick }) => {\n return (\n <div className=\"wishlist-login__sign-in\">\n <a\n data-testid=\"log-in-link\"\n className=\"wishlist-login__link\"\n href=\"\"\n rel=\"noreferrer\"\n onClick={onLoginClick}\n role=\"button\"\n >\n <Text id=\"Wishlist.Login.logIn\" />\n </a>\n <Text id=\"Wishlist.Login.sync\" />\n </div>\n );\n};\n"],"names":["EmptyWishlist","className","children","ctaLinkURL","props","labels","useText","jsx","classes","IllustratedMessage","Icon","Heart","Button","WishlistItemSkeleton","SkeletonRow","WishlistSkeleton","jsxs","Skeleton","Wishlist","routeEmptyWishlistCTA","routeToWishlist","moveProdToCart","routeProdDetailPage","getProductData","getRefinedProduct","slots","wishlistData","setWishlistData","useState","isLoggedIn","setIsLoggedIn","state","isLoading","setIsLoading","handleAuthentication","authenticated","wishlistAlert","setWishlistAlert","handleWishlistAlert","useCallback","payload","action","item","WishlistAlert","useEffect","authEvent","events","updateEvent","dataEvent","WishlistComponent","onLoginClick","alert","setAlert","dictionary","products","useMemo","_a","WishlistItem","defaultImageProps","Slot","timer","renderAlert","VComponent","renderLoader","Fragment","renderWishlist","renderHeading","Login","title","index","Text"],"mappings":"8xBA8BO,MAAMA,EAAuD,CAAC,CACnE,UAAAC,EACA,SAAAC,EACA,WAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EAASC,EAAQ,CACrB,cAAe,iCACf,QAAS,iCACT,IAAK,4BAAA,CACN,EAGC,OAAAC,EAAC,MAAK,CAAA,GAAGH,EAAO,UAAWI,EAAQ,CAAC,0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AEZ,SAAAA,EAAC,KAAA,CACC,UAAU,kCACV,cAAY,2BAEX,UAAAiD,EAAAH,EAAW,kBAAX,YAAAG,EACG,MAAM,YACP,IAAI,CAACY,EAAeC,IAClBL,OAAAA,OAAAA,EAAAA,EAAA,CACE,SAAA,CAAAI,EACAC,IAAU,GACT9D,EAAC,OAAA,CACC,UAAU,mCACV,cAAY,yBAEX,SAAA,GAAGmB,GAAA,YAAAA,EAAc,WAAW,WAAA,CAAA,CAC/B,CAAA,IARW8B,EAAA9B,GAAA,YAAAA,EAAc,KAAd,YAAA8B,EAAkB,YAAaa,CAU9C,GACD,CAAA,CACL,CACF,EA3BoB,IA6BrB,EAAA,CAAChB,EAAYC,EAAU5B,CAAY,CAAC,EAGrC,OAAAV,EAAC,MAAK,CAAA,GAAGZ,EAAO,UAAWI,EAAQ,CAAC,oBAAqBP,CAAS,CAAC,EAChE,SAAA,CAAA4D,EACA7B,EAAY+B,EAAa,EAAIE,EAAe,CAAA,EAC/C,CAEJ,EC/LaE,EAAuC,CAAC,CAAE,aAAAjB,KAEnDlC,EAAC,MAAI,CAAA,UAAU,0BACb,SAAA,CAAAT,EAAC,IAAA,CACC,cAAY,cACZ,UAAU,uBACV,KAAK,GACL,IAAI,aACJ,QAAS2C,EACT,KAAK,SAEL,SAAA3C,EAAC+D,EAAK,CAAA,GAAG,sBAAuB,CAAA,CAAA,CAClC,EACA/D,EAAC+D,EAAK,CAAA,GAAG,qBAAsB,CAAA,CAAA,EACjC"}
1
+ {"version":3,"file":"Wishlist.js","sources":["/@dropins/storefront-wishlist/src/components/EmptyWishlist/EmptyWishlist.tsx","/@dropins/storefront-wishlist/src/components/Wishlist/WishlistItemSkeleton.tsx","/@dropins/storefront-wishlist/src/components/Wishlist/WishlistSkeleton.tsx","/@dropins/storefront-wishlist/src/containers/Wishlist/Wishlist.tsx","/@dropins/storefront-wishlist/src/components/Wishlist/Wishlist.tsx","/@dropins/storefront-wishlist/src/components/Login/Login.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Button, Icon, IllustratedMessage } from '@adobe-commerce/elsie/components';\nimport { Heart } from '@adobe-commerce/elsie/icons';\n\nimport '@/wishlist/components/EmptyWishlist/EmptyWishlist.css';\n\nexport interface EmptyWishlistProps extends HTMLAttributes<HTMLDivElement> {\n ctaLinkURL?: string;\n}\n\nexport const EmptyWishlist: FunctionComponent<EmptyWishlistProps> = ({\n className,\n children,\n ctaLinkURL,\n ...props\n}) => {\n const labels = useText({\n emptyWishlist: 'Wishlist.EmptyWishlist.heading',\n message: 'Wishlist.EmptyWishlist.message',\n cta: 'Wishlist.EmptyWishlist.cta',\n });\n\n return (\n <div {...props} className={classes(['wishlist-empty-wishlist', className])}>\n <IllustratedMessage\n className={classes(['wishlist-empty-wishlist__wrapper', className])}\n data-testid=\"wishlist-empty-wishlist\"\n heading={labels.emptyWishlist}\n icon={<Icon className=\"wishlist-empty-wishlist__icon\" source={Heart} />}\n message={<p>{labels.message}</p>}\n action={\n ctaLinkURL ? (\n <Button\n data-testid=\"wishlist-empty-wishlist-button\"\n size=\"medium\"\n variant=\"primary\"\n key=\"routeHome\"\n type=\"submit\"\n href={ctaLinkURL}\n >\n {labels.cta}\n </Button>\n ) : undefined\n }\n />\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { SkeletonRow } from '@adobe-commerce/elsie/components';\nimport { FunctionComponent } from 'preact';\n\nexport const WishlistItemSkeleton: FunctionComponent = () => {\n return (\n <SkeletonRow>{`\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox=\"0 0 288 658\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n preserveAspectRatio=\"xMinYMin meet\"\n >\n <rect x=\"6\" y=\"24\" width=\"282px\" height=\"480\" rx=\"8\" fill=\"#E8E8E8\" />\n <rect x=\"6\" y=\"522\" width=\"280\" height=\"22\" rx=\"4\" fill=\"#E8E8E8\" />\n <rect x=\"6\" y=\"556\" width=\"132\" height=\"22\" rx=\"4\" fill=\"#E8E8E8\" />\n <rect x=\"6\" y=\"592\" width=\"280\" height=\"48\" rx=\"24\" fill=\"#D9D9D9\" />\n </svg>\n `}</SkeletonRow>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Skeleton } from '@adobe-commerce/elsie/components';\nimport { FunctionComponent } from 'preact';\nimport { WishlistItemSkeleton } from '@/wishlist/components/Wishlist/WishlistItemSkeleton';\n\nexport const WishlistSkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"wishlist-loader\">\n <WishlistItemSkeleton />\n <WishlistItemSkeleton />\n <WishlistItemSkeleton />\n </Skeleton>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n HTMLAttributes,\n useCallback,\n useEffect,\n useState,\n} from 'preact/compat';\nimport { Container, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { Wishlist as WishlistComponent } from '@/wishlist/components';\nimport { events, WishlistActionPayload } from '@adobe-commerce/event-bus';\nimport {\n Item,\n Product,\n Wishlist as WishlistModel,\n} from '@/wishlist/data/models';\nimport { state } from '@/wishlist/lib/state';\nimport { WishlistAlert } from '@/wishlist/containers/WishlistAlert';\nimport { ImageProps } from '@adobe-commerce/elsie/components';\n\nexport interface WishlistProps extends HTMLAttributes<HTMLDivElement> {\n routeEmptyWishlistCTA?: () => string;\n routeToWishlist?: string;\n moveProdToCart: (\n products: { sku: string; quantity: number }[]\n ) => Promise<any>;\n routeProdDetailPage: (product: Product) => string;\n getProductData?: (sku: string) => Promise<Product | null>;\n getRefinedProduct?: (\n sku: string,\n optionUIDs: string[],\n anchorOptions?: string[],\n raw?: boolean\n ) => Promise<Product | null>;\n slots?: {\n image?: SlotProps<{\n defaultImageProps: ImageProps;\n item: Item;\n }>;\n };\n}\n\nexport const Wishlist: Container<WishlistProps> = ({\n routeEmptyWishlistCTA,\n routeToWishlist,\n moveProdToCart,\n routeProdDetailPage,\n getProductData,\n getRefinedProduct,\n slots,\n ...props\n}: WishlistProps) => {\n const [wishlistData, setWishlistData] = useState<WishlistModel | null>(null);\n const [isLoggedIn, setIsLoggedIn] = useState(state.authenticated);\n const [isLoading, setIsLoading] = useState(state.isLoading);\n\n const handleAuthentication = (authenticated: boolean) =>\n setIsLoggedIn(authenticated);\n\n const [wishlistAlert, setWishlistAlert] = useState<Element | null>(null);\n const handleWishlistAlert = useCallback(\n (payload: WishlistActionPayload) => {\n const { action, item } = payload;\n setWishlistAlert(\n <WishlistAlert\n action={action}\n item={item}\n routeToWishlist={routeToWishlist}\n />\n );\n },\n [routeToWishlist]\n );\n\n useEffect(() => {\n const authEvent = events.on('authenticated', handleAuthentication);\n const updateEvent = events.on('wishlist/alert', (payload) =>\n handleWishlistAlert(payload)\n );\n const dataEvent = events.on(\n 'wishlist/data',\n (payload) => {\n setWishlistData(payload as WishlistModel);\n setIsLoading(false);\n },\n { eager: true }\n );\n return () => {\n authEvent?.off();\n dataEvent?.off();\n updateEvent?.off();\n };\n }, [handleWishlistAlert]);\n\n return (\n <WishlistComponent\n {...props}\n wishlistData={wishlistData}\n wishlistAlert={wishlistAlert}\n routeEmptyWishlistCTA={routeEmptyWishlistCTA}\n moveProdToCart={moveProdToCart}\n getProductData={getProductData}\n getRefinedProduct={getRefinedProduct}\n isLoggedIn={isLoggedIn}\n isLoading={isLoading}\n routeProdDetailPage={routeProdDetailPage}\n slots={slots}\n />\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes, useState, useEffect, useMemo } from 'preact/compat';\nimport {\n VComponent,\n classes,\n Slot,\n SlotProps,\n} from '@adobe-commerce/elsie/lib';\nimport { WishlistSkeleton } from '@/wishlist/components/Wishlist/WishlistSkeleton';\nimport '@/wishlist/components/Wishlist/Wishlist.css';\nimport {\n Product,\n Wishlist as WishlistModel,\n Item,\n} from '@/wishlist/data/models';\nimport { WishlistItem, WishlistAlert } from '@/wishlist/containers';\nimport { Fragment } from 'react';\nimport { EmptyWishlist, Login } from '@/wishlist/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { ImageProps } from '@adobe-commerce/elsie/components';\n\nexport interface WishlistProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n wishlistData: WishlistModel;\n wishlistAlert: WishlistAlert | null;\n isLoggedIn: boolean;\n isLoading: boolean;\n moveProdToCart: (\n products: { sku: string; quantity: number }[]\n ) => Promise<any>;\n getProductData?: (sku: string) => Promise<Product | null>;\n getRefinedProduct?: (\n sku: string,\n optionUIDs: string[],\n anchorOptions?: string[],\n raw?: boolean\n ) => Promise<Product | null>;\n routeEmptyWishlistCTA?: () => string;\n onLoginClick?: () => void;\n routeProdDetailPage: (product: Product) => string;\n slots?: {\n image?: SlotProps<{\n defaultImageProps: ImageProps;\n item: Item;\n }>;\n };\n}\n\nexport const Wishlist: FunctionComponent<WishlistProps> = ({\n className,\n wishlistData,\n wishlistAlert,\n isLoggedIn,\n isLoading,\n moveProdToCart,\n getProductData,\n getRefinedProduct,\n routeEmptyWishlistCTA,\n onLoginClick,\n routeProdDetailPage,\n slots,\n ...props\n}) => {\n const [alert, setAlert] = useState<VNode | null>(wishlistAlert);\n\n const dictionary = useText({\n wishlistHeading: 'Wishlist.Wishlist.heading',\n wishlistLoadingHeading: 'Wishlist.Wishlist.loading',\n });\n\n const products = useMemo(() => {\n return wishlistData?.items?.length > 0\n ? wishlistData.items.map((item: Item) => (\n <WishlistItem\n key={item.id}\n item={item}\n getProductData={getProductData}\n getRefinedProduct={getRefinedProduct}\n moveProdToCart={moveProdToCart}\n routeProdDetailPage={routeProdDetailPage}\n imageNode={\n slots?.image\n ? ({ defaultImageProps }) => (\n <Slot\n name=\"image\"\n slot={slots.image}\n context={{\n defaultImageProps,\n item,\n }}\n />\n )\n : undefined\n }\n />\n ))\n : null;\n }, [wishlistData, moveProdToCart, getProductData, getRefinedProduct, routeProdDetailPage, slots?.image]);\n\n useEffect(() => {\n if (wishlistAlert) {\n setAlert(wishlistAlert);\n\n const timer = setTimeout(() => {\n setAlert(null);\n }, 5000);\n\n return () => clearTimeout(timer);\n }\n }, [wishlistAlert]);\n\n const renderAlert = useMemo(\n () =>\n alert ? (\n <VComponent node={alert} className=\"wishlist-wishlist__alert\" />\n ) : null,\n [alert]\n );\n\n const renderLoader = () => {\n return (\n <>\n <div\n className=\"wishlist-wishlist__heading\"\n data-testid=\"wishlist-heading-wrapper\"\n >\n <h1\n className=\"wishlist-wishlist__heading-text\"\n data-testid=\"loader-wishlist-heading\"\n >\n {dictionary.wishlistLoadingHeading}\n </h1>\n </div>\n <WishlistSkeleton />\n </>\n );\n };\n\n const renderWishlist = () => {\n return products ? (\n <>\n {renderHeading}\n <div className=\"wishlist-wishlist__content\">{products}</div>\n </>\n ) : (\n <div\n className={classes([\n 'wishlist-wishlist__content',\n 'wishlist-wishlist__content--empty',\n ])}\n >\n <div>\n <EmptyWishlist\n data-testid=\"empty-wishlist\"\n ctaLinkURL={routeEmptyWishlistCTA?.()}\n />\n {!isLoggedIn && <Login onLoginClick={onLoginClick} />}\n </div>\n </div>\n );\n };\n\n const renderHeading = useMemo(() => {\n if (!products) return null;\n\n return (\n <div\n className=\"wishlist-wishlist__heading\"\n data-testid=\"wishlist-heading-wrapper\"\n >\n <h1\n className=\"wishlist-wishlist__heading-text\"\n data-testid=\"default-wishlist-heading\"\n >\n {dictionary.wishlistHeading\n ?.split(' {count}')\n .map((title: string, index: number) => (\n <Fragment key={wishlistData?.id?.toString() + index}>\n {title}\n {index === 0 && (\n <span\n className=\"wishlist-wishlist__heading-count\"\n data-testid=\"wishlist-heading-count\"\n >\n {`${wishlistData?.items_count} products`}\n </span>\n )}\n </Fragment>\n ))}\n </h1>\n </div>\n );\n }, [dictionary, products, wishlistData]);\n\n return (\n <div {...props} className={classes(['wishlist-wishlist', className])}>\n {renderAlert}\n {isLoading ? renderLoader() : renderWishlist()}\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Text } from '@adobe-commerce/elsie/i18n';\nimport { FunctionComponent } from 'preact';\n\nimport '@/wishlist/components/Login/Login.css';\n\nexport interface LoginProps {\n onLoginClick?: () => void;\n}\n\nexport const Login: FunctionComponent<LoginProps> = ({ onLoginClick }) => {\n return (\n <div className=\"wishlist-login__sign-in\">\n <a\n data-testid=\"log-in-link\"\n className=\"wishlist-login__link\"\n href=\"\"\n rel=\"noreferrer\"\n onClick={onLoginClick}\n role=\"button\"\n >\n <Text id=\"Wishlist.Login.logIn\" />\n </a>\n <Text id=\"Wishlist.Login.sync\" />\n </div>\n );\n};\n"],"names":["EmptyWishlist","className","children","ctaLinkURL","props","labels","useText","jsx","classes","IllustratedMessage","Icon","Heart","Button","WishlistItemSkeleton","SkeletonRow","WishlistSkeleton","jsxs","Skeleton","Wishlist","routeEmptyWishlistCTA","routeToWishlist","moveProdToCart","routeProdDetailPage","getProductData","getRefinedProduct","slots","wishlistData","setWishlistData","useState","isLoggedIn","setIsLoggedIn","state","isLoading","setIsLoading","handleAuthentication","authenticated","wishlistAlert","setWishlistAlert","handleWishlistAlert","useCallback","payload","action","item","WishlistAlert","useEffect","authEvent","events","updateEvent","dataEvent","WishlistComponent","onLoginClick","alert","setAlert","dictionary","products","useMemo","_a","WishlistItem","defaultImageProps","Slot","timer","renderAlert","VComponent","renderLoader","Fragment","renderWishlist","renderH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adobe
2
2
  All Rights Reserved. */
3
3
  import{W as e,W as l}from"../chunks/WishlistAlert.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-compat.js";import"../chunks/Trash.js";import"../chunks/HeartFilled.js";import"@dropins/tools/i18n.js";export{e as WishlistAlert,l as default};
4
4
  //# sourceMappingURL=WishlistAlert.js.map
@@ -1,4 +1,4 @@
1
- /*! Copyright 2025 Adobe
1
+ /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
3
  import{W as l,W as d}from"../chunks/WishlistItem.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"../chunks/removeProductsFromWishlist.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/Trash.js";import"@dropins/tools/i18n.js";export{l as WishlistItem,d as default};
4
4
  //# sourceMappingURL=WishlistItem.js.map
@@ -1,4 +1,4 @@
1
- /*! Copyright 2025 Adobe
1
+ /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
3
  import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{useState as h,useCallback as E,useEffect as I}from"@dropins/tools/preact-compat.js";import{Button as j,Icon as c}from"@dropins/tools/components.js";import{events as a}from"@dropins/tools/event-bus.js";import{s as F,g as P,i as x,r as A}from"../chunks/removeProductsFromWishlist.js";import{c as M,a as R}from"../chunks/mergeWishlists.js";import{S as q}from"../chunks/HeartFilled.js";import{S as H}from"../chunks/Heart.js";import{useText as N}from"@dropins/tools/i18n.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const $=({product:s,iconWishlisted:D,iconToWishlist:W,size:d,variant:O,disabled:U,labelToWishlist:g,labelWishlisted:b,onClick:u,removeProdFromCart:v})=>{const[k,w]=h(F.authenticated),[n,o]=h(!1),[L,S]=h(null),{isGuestWishlistEnabled:T}=M.getConfig(),f=N({addToWishlist:"Wishlist.Wishlist.ariaLabelAddToWishlist",removeFromWishlist:"Wishlist.Wishlist.ariaLabelRemoveFromWishlist"}),l=E(()=>{var t;const e=P(),i=(t=e==null?void 0:e.items)==null?void 0:t.find(m=>x(m,{sku:s.topLevelSku??s.sku,optionUIDs:s.optionUIDs??(s.selectedOptionsUIDs?Object.values(s.selectedOptionsUIDs):void 0)??(s.bundleOptionsUIDs?Object.values(s.bundleOptionsUIDs):void 0)}));S(i??null),o(!!i)},[s.topLevelSku,s.sku,s.optionUIDs,s.selectedOptionsUIDs,s.bundleOptionsUIDs]);I(()=>{l()},[l]),I(()=>{const e=m=>w(m),i=a.on("authenticated",e),t=a.on("wishlist/data",l);return()=>{i==null||i.off(),t==null||t.off()}},[l]);const y=async()=>{var e;if(n){try{await A([L])}catch{return a.emit("wishlist/alert",{action:"removeError",item:{product:s}}),null}o(!1),a.emit("wishlist/alert",{action:"remove",item:{product:s}})}else{try{await R([{sku:s.topLevelSku??s.sku,quantity:1,optionsUIDs:s.optionUIDs??(s.selectedOptionsUIDs?Object.values(s.selectedOptionsUIDs):void 0)??(s.bundleOptionsUIDs?Object.values(s.bundleOptionsUIDs):void 0),enteredOptions:(e=s.options)!=null&&e.items?s.options.items.filter(i=>i.selected).map(i=>({uid:i.uid,value:i.value})):void 0}])}catch{return a.emit("wishlist/alert",{action:"addError",item:{product:s}}),null}o(!0),a.emit("wishlist/alert",{action:"add",item:{product:s}}),v&&await v([{uid:s.uid,quantity:0}])}};if(!k&&!T)return null;const C=n?f.removeFromWishlist.replace("{PRODUCT_NAME}",s==null?void 0:s.name):f.addToWishlist.replace("{PRODUCT_NAME}",s==null?void 0:s.name);return r(j,{active:n,"aria-label":C,"data-testid":"wishlist-toggle",size:d??"medium",variant:O??"tertiary",disabled:U,icon:r(c,{source:W??H}),activeIcon:r(c,{source:D??q}),onClick:u??y,children:g,activeChildren:b})};export{$ as WishlistToggle,$ as default};
4
4
  //# sourceMappingURL=WishlistToggle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WishlistToggle.js","sources":["/@dropins/storefront-wishlist/src/containers/WishlistToggle/WishlistToggle.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n useState,\n HTMLAttributes,\n useEffect,\n useCallback,\n} from 'preact/compat';\nimport { Button, Icon } from '@adobe-commerce/elsie/components';\nimport { events } from '@adobe-commerce/event-bus';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { Heart, HeartFilled } from '@adobe-commerce/elsie/icons';\nimport { state } from '@/wishlist/lib/state';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nimport {\n addProductsToWishlist,\n removeProductsFromWishlist,\n config,\n} from '@/wishlist/api';\nimport { Product } from '@/wishlist/data/models';\nimport { getPersistedWishlistData } from '@/wishlist/lib/persisted-data';\nimport { VNode } from 'preact';\nimport { isMatchingWishlistItem } from '@/wishlist/lib/wishlist-item-comparator';\n\nexport interface WishlistToggleProps extends HTMLAttributes<HTMLDivElement> {\n product: Product;\n iconWishlisted?: VNode<HTMLAttributes<SVGSVGElement>>;\n iconToWishlist?: VNode<HTMLAttributes<SVGSVGElement>>;\n size?: 'medium' | 'large';\n variant?: 'primary' | 'secondary' | 'tertiary';\n disabled?: boolean;\n labelToWishlist?: string;\n labelWishlisted?: string;\n onClick?: () => void;\n removeProdFromCart?: (\n product: { uid: string; quantity: number }[]\n ) => Promise<any>;\n}\n\nexport const WishlistToggle: Container<WishlistToggleProps> = ({\n product,\n iconWishlisted,\n iconToWishlist,\n size,\n variant,\n disabled,\n labelToWishlist,\n labelWishlisted,\n onClick,\n removeProdFromCart,\n}: WishlistToggleProps) => {\n const [isLoggedIn, setIsLoggedIn] = useState(state.authenticated);\n const [isWishlisted, setIsWishlisted] = useState(false);\n const [wishlistItem, setWishlistItem] = useState(null);\n const { isGuestWishlistEnabled } = config.getConfig();\n\n const dictionary = useText({\n addToWishlist: 'Wishlist.Wishlist.ariaLabelAddToWishlist',\n removeFromWishlist: 'Wishlist.Wishlist.ariaLabelRemoveFromWishlist',\n });\n\n const handleWishlistData = useCallback(() => {\n const updatedWishlist = getPersistedWishlistData();\n const item = updatedWishlist?.items?.find((item: any) =>\n isMatchingWishlistItem(item, {\n sku: product.topLevelSku ?? product.sku,\n optionUIDs:\n product.optionUIDs ??\n (product.selectedOptionsUIDs\n ? Object.values(product.selectedOptionsUIDs)\n : undefined) ??\n (product.bundleOptionsUIDs\n ? Object.values(product.bundleOptionsUIDs)\n : undefined),\n })\n );\n\n setWishlistItem(item ?? null);\n setIsWishlisted(!!item);\n }, [\n product.topLevelSku,\n product.sku,\n product.optionUIDs,\n product.selectedOptionsUIDs,\n product.bundleOptionsUIDs,\n ]);\n\n useEffect(() => {\n handleWishlistData();\n }, [handleWishlistData]);\n\n useEffect(() => {\n const handleAuthentication = (authenticated: boolean) =>\n setIsLoggedIn(authenticated);\n\n const onAuthenticated = events.on('authenticated', handleAuthentication);\n const onWishlistData = events.on('wishlist/data', handleWishlistData);\n\n return () => {\n onAuthenticated?.off();\n onWishlistData?.off();\n };\n }, [handleWishlistData]);\n\n const handleClick = async () => {\n if (isWishlisted) {\n try {\n await removeProductsFromWishlist([wishlistItem]);\n } catch (error) {\n events.emit('wishlist/alert', {\n action: 'removeError',\n item: { product },\n });\n return null;\n }\n\n setIsWishlisted(false);\n events.emit('wishlist/alert', {\n action: 'remove',\n item: { product },\n });\n } else {\n try {\n await addProductsToWishlist([\n {\n sku: product.topLevelSku ?? product.sku,\n quantity: 1,\n optionsUIDs:\n product.optionUIDs ??\n (product.selectedOptionsUIDs\n ? Object.values(product.selectedOptionsUIDs)\n : undefined) ??\n (product.bundleOptionsUIDs\n ? Object.values(product.bundleOptionsUIDs)\n : undefined),\n enteredOptions: product.options?.items\n ? product.options.items\n .filter((option: any) => option.selected)\n .map((option: any) => ({\n uid: option.uid,\n value: option.value,\n }))\n : undefined,\n },\n ]);\n } catch (error) {\n events.emit('wishlist/alert', {\n action: 'addError',\n item: { product },\n });\n return null;\n }\n\n setIsWishlisted(true);\n events.emit('wishlist/alert', {\n action: 'add',\n item: { product },\n });\n if (removeProdFromCart) {\n await removeProdFromCart([\n {\n uid: product.uid,\n quantity: 0,\n },\n ]);\n }\n }\n };\n\n if (!isLoggedIn && !isGuestWishlistEnabled) {\n return null;\n }\n\n const ariaLabel: string = isWishlisted\n ? dictionary['removeFromWishlist'].replace('{PRODUCT_NAME}', product?.name)\n : dictionary['addToWishlist'].replace('{PRODUCT_NAME}', product?.name);\n\n return (\n <Button\n active={isWishlisted}\n aria-label={ariaLabel}\n data-testid=\"wishlist-toggle\"\n size={size ?? 'medium'}\n variant={variant ?? 'tertiary'}\n disabled={disabled}\n icon={<Icon source={iconToWishlist ?? Heart} />}\n activeIcon={<Icon source={iconWishlisted ?? HeartFilled} />}\n onClick={onClick ?? handleClick}\n children={labelToWishlist}\n activeChildren={labelWishlisted}\n />\n );\n};\n"],"names":["WishlistToggle","product","iconWishlisted","iconToWishlist","size","variant","disabled","labelToWishlist","labelWishlisted","onClick","removeProdFromCart","isLoggedIn","setIsLoggedIn","useState","state","isWishlisted","setIsWishlisted","wishlistItem","setWishlistItem","isGuestWishlistEnabled","config","dictionary","useText","handleWishlistData","useCallback","updatedWishlist","getPersistedWishlistData","item","_a","isMatchingWishlistItem","useEffect","handleAuthentication","authenticated","onAuthenticated","events","onWishlistData","handleClick","removeProductsFromWishlist","addProductsToWishlist","option","ariaLabel","jsx","Button","Icon","Heart","HeartFilled"],"mappings":"8lBAuDO,MAAMA,EAAiD,CAAC,CAC7D,QAAAC,EACA,eAAAC,EACA,eAAAC,EACA,KAAAC,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Z,KAAMpC,GAAQ,SACd,QAASC,GAAW,WACpB,SAAAC,EACA,KAAMmC,EAACE,EAAK,CAAA,OAAQxC,GAAkByC,EAAO,EAC7C,WAAYH,EAACE,EAAK,CAAA,OAAQzC,GAAkB2C,EAAa,EACzD,QAASpC,GAAW2B,EACpB,SAAU7B,EACV,eAAgBC,CAAA,CAClB,CAEJ"}
1
+ {"version":3,"file":"WishlistToggle.js","sources":["/@dropins/storefront-wishlist/src/containers/WishlistToggle/WishlistToggle.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n useState,\n HTMLAttributes,\n useEffect,\n useCallback,\n} from 'preact/compat';\nimport { Button, Icon } from '@adobe-commerce/elsie/components';\nimport { events } from '@adobe-commerce/event-bus';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { Heart, HeartFilled } from '@adobe-commerce/elsie/icons';\nimport { state } from '@/wishlist/lib/state';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nimport {\n addProductsToWishlist,\n removeProductsFromWishlist,\n config,\n} from '@/wishlist/api';\nimport { Product } from '@/wishlist/data/models';\nimport { getPersistedWishlistData } from '@/wishlist/lib/persisted-data';\nimport { VNode } from 'preact';\nimport { isMatchingWishlistItem } from '@/wishlist/lib/wishlist-item-comparator';\n\nexport interface WishlistToggleProps extends HTMLAttributes<HTMLDivElement> {\n product: Product;\n iconWishlisted?: VNode<HTMLAttributes<SVGSVGElement>>;\n iconToWishlist?: VNode<HTMLAttributes<SVGSVGElement>>;\n size?: 'medium' | 'large';\n variant?: 'primary' | 'secondary' | 'tertiary';\n disabled?: boolean;\n labelToWishlist?: string;\n labelWishlisted?: string;\n onClick?: () => void;\n removeProdFromCart?: (\n product: { uid: string; quantity: number }[]\n ) => Promise<any>;\n}\n\nexport const WishlistToggle: Container<WishlistToggleProps> = ({\n product,\n iconWishlisted,\n iconToWishlist,\n size,\n variant,\n disabled,\n labelToWishlist,\n labelWishlisted,\n onClick,\n removeProdFromCart,\n}: WishlistToggleProps) => {\n const [isLoggedIn, setIsLoggedIn] = useState(state.authenticated);\n const [isWishlisted, setIsWishlisted] = useState(false);\n const [wishlistItem, setWishlistItem] = useState(null);\n const { isGuestWishlistEnabled } = config.getConfig();\n\n const dictionary = useText({\n addToWishlist: 'Wishlist.Wishlist.ariaLabelAddToWishlist',\n removeFromWishlist: 'Wishlist.Wishlist.ariaLabelRemoveFromWishlist',\n });\n\n const handleWishlistData = useCallback(() => {\n const updatedWishlist = getPersistedWishlistData();\n const item = updatedWishlist?.items?.find((item: any) =>\n isMatchingWishlistItem(item, {\n sku: product.topLevelSku ?? product.sku,\n optionUIDs:\n product.optionUIDs ??\n (product.selectedOptionsUIDs\n ? Object.values(product.selectedOptionsUIDs)\n : undefined) ??\n (product.bundleOptionsUIDs\n ? Object.values(product.bundleOptionsUIDs)\n : undefined),\n })\n );\n\n setWishlistItem(item ?? null);\n setIsWishlisted(!!item);\n }, [\n product.topLevelSku,\n product.sku,\n product.optionUIDs,\n product.selectedOptionsUIDs,\n product.bundleOptionsUIDs,\n ]);\n\n useEffect(() => {\n handleWishlistData();\n }, [handleWishlistData]);\n\n useEffect(() => {\n const handleAuthentication = (authenticated: boolean) =>\n setIsLoggedIn(authenticated);\n\n const onAuthenticated = events.on('authenticated', handleAuthentication);\n const onWishlistData = events.on('wishlist/data', handleWishlistData);\n\n return () => {\n onAuthenticated?.off();\n onWishlistData?.off();\n };\n }, [handleWishlistData]);\n\n const handleClick = async () => {\n if (isWishlisted) {\n try {\n await removeProductsFromWishlist([wishlistItem]);\n } catch (error) {\n events.emit('wishlist/alert', {\n action: 'removeError',\n item: { product },\n });\n return null;\n }\n\n setIsWishlisted(false);\n events.emit('wishlist/alert', {\n action: 'remove',\n item: { product },\n });\n } else {\n try {\n await addProductsToWishlist([\n {\n sku: product.topLevelSku ?? product.sku,\n quantity: 1,\n optionsUIDs:\n product.optionUIDs ??\n (product.selectedOptionsUIDs\n ? Object.values(product.selectedOptionsUIDs)\n : undefined) ??\n (product.bundleOptionsUIDs\n ? Object.values(product.bundleOptionsUIDs)\n : undefined),\n enteredOptions: product.options?.items\n ? product.options.items\n .filter((option: any) => option.selected)\n .map((option: any) => ({\n uid: option.uid,\n value: option.value,\n }))\n : undefined,\n },\n ]);\n } catch (error) {\n events.emit('wishlist/alert', {\n action: 'addError',\n item: { product },\n });\n return null;\n }\n\n setIsWishlisted(true);\n events.emit('wishlist/alert', {\n action: 'add',\n item: { product },\n });\n if (removeProdFromCart) {\n await removeProdFromCart([\n {\n uid: product.uid,\n quantity: 0,\n },\n ]);\n }\n }\n };\n\n if (!isLoggedIn && !isGuestWishlistEnabled) {\n return null;\n }\n\n const ariaLabel: string = isWishlisted\n ? dictionary['removeFromWishlist'].replace('{PRODUCT_NAME}', product?.name)\n : dictionary['addToWishlist'].replace('{PRODUCT_NAME}', product?.name);\n\n return (\n <Button\n active={isWishlisted}\n aria-label={ariaLabel}\n data-testid=\"wishlist-toggle\"\n size={size ?? 'medium'}\n variant={variant ?? 'tertiary'}\n disabled={disabled}\n icon={<Icon source={iconToWishlist ?? Heart} />}\n activeIcon={<Icon source={iconWishlisted ?? HeartFilled} />}\n onClick={onClick ?? handleClick}\n children={labelToWishlist}\n activeChildren={labelWishlisted}\n />\n );\n};\n"],"names":["WishlistToggle","product","iconWishlisted","iconToWishlist","size","variant","disabled","labelToWishlist","labelWishlisted","onClick","removeProdFromCart","isLoggedIn","setIsLoggedIn","useState","state","isWishlisted","setIsWishlisted","wishlistItem","setWishlistItem","isGuestWishlistEnabled","config","dictionary","useText","handleWishlistData","useCallback","updatedWishlist","getPersistedWishlistData","item","_a","isMatchingWishlistItem","useEffect","handleAuthentication","authenticated","onAuthenticated","events","onWishlistData","handleClick","removeProductsFromWishlist","addProductsToWishlist","option","ariaLabel","jsx","Button","Icon","Heart","HeartFilled"],"mappings":"8lBAuDO,MAAMA,EAAiD,CAAC,CAC7D,QAAAC,EACA,eAAAC,EACA,eAAAC,EACA,KAAAC,EACA,QAAAC,EACA,SAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,QAAAC,EACA,mBAAAC,CACF,IAA2B,CACzB,KAAM,CAACC,EAAYC,CAAa,EAAIC,EAASC,EAAM,aAAa,EAC1D,CAACC,EAAcC,CAAe,EAAIH,EAAS,EAAK,EAChD,CAACI,EAAcC,CAAe,EAAIL,EAAS,IAAI,EAC/C,CAAE,uBAAAM,CAAA,EAA2BC,EAAO,UAAA,EAEpCC,EAAaC,EAAQ,CACzB,cAAe,2CACf,mBAAoB,+CAAA,CACrB,EAEKC,EAAqBC,EAAY,IAAM,OAC3C,MAAMC,EAAkBC,EAAA,EAClBC,GAAOC,EAAAH,GAAA,YAAAA,EAAiB,QAAjB,YAAAG,EAAwB,KAAMD,GACzCE,EAAuBF,EAAM,CAC3B,IAAK1B,EAAQ,aAAeA,EAAQ,IACpC,WACEA,EAAQ,aACPA,EAAQ,oBACL,OAAO,OAAOA,EAAQ,mBAAmB,EACzC,UACHA,EAAQ,kBACL,OAAO,OAAOA,EAAQ,iBAAiB,EACvC,OAAA,CACP,GAGHiB,EAAgBS,GAAQ,IAAI,EAC5BX,EAAgB,CAAC,CAACW,CAAI,CACxB,EAAG,CACD1B,EAAQ,YACRA,EAAQ,IACRA,EAAQ,WACRA,EAAQ,oBACRA,EAAQ,iBAAA,CACT,EAED6B,EAAU,IAAM,CACdP,EAAA,CACF,EAAG,CAACA,CAAkB,CAAC,EAEvBO,EAAU,IAAM,CACd,MAAMC,EAAwBC,GAC5BpB,EAAcoB,CAAa,EAEvBC,EAAkBC,EAAO,GAAG,gBAAiBH,C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,CAACU,GAAc,CAACQ,EAClB,OAAO,KAGT,MAAMqB,EAAoBzB,EACtBM,EAAW,mBAAsB,QAAQ,iBAAkBpB,GAAA,YAAAA,EAAS,IAAI,EACxEoB,EAAW,cAAiB,QAAQ,iBAAkBpB,GAAA,YAAAA,EAAS,IAAI,EAEvE,OACEwC,EAACC,EAAA,CACC,OAAQ3B,EACR,aAAYyB,EACZ,cAAY,kBACZ,KAAMpC,GAAQ,SACd,QAASC,GAAW,WACpB,SAAAC,EACA,KAAMmC,EAACE,EAAA,CAAK,OAAQxC,GAAkByC,EAAO,EAC7C,WAAYH,EAACE,EAAA,CAAK,OAAQzC,GAAkB2C,EAAa,EACzD,QAASpC,GAAW2B,EACpB,SAAU7B,EACV,eAAgBC,CAAA,CAAA,CAGtB"}
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-wishlist", "version": "3.0.0-beta3", "@dropins/tools": "~1.6.0-beta3", "license": "SEE LICENSE IN LICENSE.md"}
1
+ {"name": "@dropins/storefront-wishlist", "version": "3.0.0", "@dropins/tools": "~1.6.0", "license": "SEE LICENSE IN LICENSE.md"}
package/render.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Copyright 2025 Adobe
1
+ /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
3
  (function(r,e){try{if(typeof document<"u"){const t=document.createElement("style"),n=e.styleId;for(const i in e.attributes)t.setAttribute(i,e.attributes[i]);t.setAttribute("data-dropin",n),t.appendChild(document.createTextNode(r));const a=document.querySelector('style[data-dropin="sdk"]');if(a)a.after(t);else{const i=document.querySelector('link[rel="stylesheet"], style');i?i.before(t):document.head.append(t)}}}catch(t){console.error("dropin-styles (injectCodeFunction)",t)}})(".wishlist-empty-wishlist{container-type:inline-size;container-name:wishlist}.wishlist-empty-wishlist__wrapper .dropin-card--secondary{display:grid;grid-auto-rows:min-content;justify-content:center;text-align:center;border:unset}.wishlist-empty-wishlist .dropin-illustrated-message__heading{font:var(--type-headline-1-font)}.wishlist-empty-wishlist .dropin-illustrated-message__message{font:var(--type-body-1-default-font)}@container wishlist (width < 737px){.wishlist-empty-wishlist__wrapper .dropin-card{border:unset;border-style:hidden}}.wishlist-wishlist{container-type:inline-size;container-name:wishlist-grid;max-width:inherit}.wishlist-wishlist__content{display:grid;gap:var(--spacing-medium);margin:auto;padding:var(--spacing-medium) 0}.wishlist-wishlist__heading{color:var(--color-neutral-800);display:grid;font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);padding:var(--spacing-small) 0;row-gap:var(--spacing-xsmall)}.wishlist-wishlist__heading-text{font-size:inherit;font-weight:inherit;margin:0;line-height:inherit}.wishlist-wishlist__heading-count{color:#6d6d6d;margin-left:var(--spacing-xxsmall);letter-spacing:normal;font:var(--type-details-caption-2-font)}.wishlist-wishlist__content.wishlist-wishlist__content--empty{border:var(--shape-border-width-2) solid var(--color-neutral-400);border-radius:var(--shape-border-radius-2);grid-template-columns:repeat(1,1fr);padding:var(--spacing-xxbig);margin:var(--spacing-xxbig) auto}@media only screen and (max-width: 480px){.dropin-skeleton{grid-template-columns:repeat(1,1fr)}.dropin-skeleton-row:nth-child(n+2){display:none}.wishlist-wishlist__content{grid-template-columns:repeat(1,1fr);min-height:320px}}@media only screen and (min-width: 480px) and (max-width: 600px){.dropin-skeleton{grid-template-columns:repeat(2,1fr)}.dropin-skeleton-row:nth-child(n+3){display:none}.wishlist-wishlist__content{grid-template-columns:repeat(2,1fr);min-height:320px}}@media only screen and (min-width: 600px){.dropin-skeleton{grid-template-columns:repeat(2,1fr)}.dropin-skeleton-row:nth-child(n+3){display:none}.wishlist-wishlist__content{grid-template-columns:repeat(2,1fr);min-height:320px}}@media only screen and (min-width: 768px){.dropin-skeleton{grid-template-columns:repeat(3,1fr)}.dropin-skeleton-row:nth-child(n){display:block}.wishlist-wishlist__content{grid-template-columns:repeat(3,1fr);min-height:480px}}.wishlist-product-item{background-color:var(--color-neutral-50);margin-bottom:var(--spacing-small)}.wishlist-product-item__content{display:flex;flex-direction:column;gap:var(--spacing-small)}.wishlist-product-item__content .wishlist-product-item-image{background:var(--color-neutral-200);height:100%;padding:0;position:relative;width:100%}.wishlist-product-item__content .wishlist-product-item__title{color:var(--color-neutral-800);font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin:0;position:relative}.wishlist-product-item-name{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:85%}a.wishlist-product-item-name:active,a.wishlist-product-item-name:hover,a.wishlist-product-item-name{color:var(--color-neutral-800);cursor:pointer;font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing)}.wishlist-product-item__content .wishlist-product-item-button__remove{position:absolute;right:0;top:-10px}.wishlist-product-item__content .wishlist-product-item-options{font:var(--type-body-2-default-font)}.wishlist-product-item__content .wishlist-product-item-option__attribute{text-transform:capitalize}.wishlist-product-item__content .wishlist-product-item-option__label{font:var(--type-body-2-strong-font)}.wishlist-product-item__content .wishlist-product-item-price{display:inline;font:var(--type-body-2-default-font)}.strikethrough{text-decoration:line-through}.wishlist-product-item__content .wishlist-product-item-discounted-price{display:inline;margin-left:var(--spacing-xsmall);color:var(--color-alert-800)}.wishlist-product-item-move-to-cart{display:grid;grid-area:product-add-to-cart;justify-content:end}.wishlist-product-item-tax{color:var(--color-neutral-500)}.wishlist-product-item-tax span{margin-right:var(--spacing-xsmall)}.image-carousel{display:flex;flex-direction:column;gap:var(--spacing-medium);padding:var(--spacing-medium)}.image-carousel .image-carousel-image{object-fit:contain;padding:var(--spacing-xxsmall) 0;width:100%}.image-switcher-area{bottom:var(--spacing-xxsmall);left:0;margin-top:var(--spacing-small);position:absolute;text-align:center;width:100%}.image-switcher-area .image-switcher{cursor:pointer;border-radius:50%;display:inline-flex;height:var(--spacing-xsmall);margin:0 var(--spacing-xxsmall);width:var(--spacing-xsmall)}.image-switcher-area .image-switcher-active{background-color:var(--color-neutral-900);border:var(--shape-border-width-1) solid var(--color-brand-700)}.image-switcher-area .image-switcher-inactive{background-color:var(--color-neutral-600);border:var(--shape-border-width-1) solid var(--color-neutral-600)}@media only screen and (max-width: 480px){.image-carousel{gap:var(--spacing-xxsmall)}.image-carousel .image-carousel-image{height:250px}}@media only screen and (min-width: 480px) and (max-width: 600px){.image-carousel{gap:var(--spacing-xsmall)}.image-carousel .image-carousel-image{height:300px}}@media only screen and (min-width: 600px){.image-carousel{gap:var(--spacing-xsmall)}.image-carousel .image-carousel-image{height:300px}}@media only screen and (min-width: 768px){.image-carousel{gap:var(--spacing-small)}.image-carousel .image-carousel-image{height:350px}}@media only screen and (min-width: 1024px){.image-carousel{gap:var(--spacing-medium)}.image-carousel .image-carousel-image{height:400px}}.wishlist-login__sign-in{grid-column-start:2;color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:var(--spacing-xxsmall);text-align:center}a.wishlist-login__link{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin-left:var(--spacing-xxsmall);text-decoration:underline;text-decoration-thickness:auto;text-underline-offset:auto;color:var(--color-neutral-800)}a.wishlist-login__link:hover{color:var(--color-neutral-800);text-decoration:underline;text-decoration-thickness:auto;text-underline-offset:auto}",{styleId:"Wishlist"});
4
4
  import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{Render as d}from"@dropins/tools/lib.js";import{useState as a,useEffect as n}from"@dropins/tools/preact-hooks.js";import{UIProvider as m}from"@dropins/tools/components.js";import{events as h}from"@dropins/tools/event-bus.js";const c={EmptyWishlist:{heading:"Your wishlist is empty",message:"Add items by clicking on the heart icon.",cta:"Start shopping"},Wishlist:{heading:"Wishlist {count}",loading:"Loading...",ariaLabelAddToWishlist:"add {PRODUCT_NAME} to wishlist",ariaLabelRemoveFromWishlist:"remove {PRODUCT_NAME} from wishlist"},Alert:{addProduct:{heading:"Added to wishlist",message:"{product} has been added to your wishlist"},removeProduct:{heading:"Removed from wishlist",message:"{product} has been removed from your wishlist"},moveToCart:{heading:"Moved to cart",message:"{product} has been moved to your cart"},addError:{heading:"Error",message:"Failed to add product to wishlist"},removeError:{heading:"Error",message:"Failed to remove {product} from wishlist"},viewWishlist:"View wishlist"},Login:{sync:" to sync your saved items across all your devices.",logIn:"Log in"}},l={CartActionButton:"Move To Cart",TrashActionButton:"Remove this product from wishlist",CustomizeActionButton:"Customize"},u={Wishlist:c,ProductItem:l},g={default:u},v=({children:e})=>{const[s,i]=a("en_US");return n(()=>{const o=h.on("locale",r=>{i(r)},{eager:!0});return()=>{o==null||o.off()}},[]),t(m,{lang:s,langDefinitions:g,children:e})},P=new d(t(v,{}));export{P as render};
package/render.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"render.js","sources":["/@dropins/storefront-wishlist/src/render/Provider.tsx","/@dropins/storefront-wishlist/src/render/render.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { useState, useEffect } from 'preact/hooks';\nimport { UIProvider } from '@adobe-commerce/elsie/components';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\n\nimport en_US from '../i18n/en_US.json';\n\n// Langs\nconst langDefinitions = {\n default: en_US,\n};\n\ninterface CartProviderProps {\n children?: any;\n}\n\nexport const Provider: FunctionComponent<CartProviderProps> = ({\n children,\n}) => {\n const [lang, setLang] = useState<Lang>('en_US');\n\n // Events\n useEffect(() => {\n const localeEvent = events.on(\n 'locale',\n (locale: string) => {\n setLang(locale as Lang);\n },\n { eager: true }\n );\n return () => {\n localeEvent?.off();\n };\n }, []);\n\n return (\n <UIProvider lang={lang} langDefinitions={langDefinitions}>\n {children}\n </UIProvider>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Render } from '@adobe-commerce/elsie/lib';\nimport { Provider } from './Provider';\n\nexport const render = new Render(<Provider />);\n"],"names":["langDefinitions","en_US","Provider","children","lang","setLang","useState","useEffect","localeEvent","events","locale","jsx","UIProvider","render","Render"],"mappings":"2xCA0BMA,EAAkB,CACtB,QAASC,CACX,EAMaC,EAAiD,CAAC,CAC7D,SAAAC,CACF,IAAM,CACJ,KAAM,CAACC,EAAMC,CAAO,EAAIC,EAAe,OAAO,EAG9C,OAAAC,EAAU,IAAM,CACd,MAAMC,EAAcC,EAAO,GACzB,SACCC,GAAmB,CAClBL,EAAQK,CAAc,CACxB,EACA,CAAE,MAAO,EAAK,CAChB,EACA,MAAO,IAAM,CACXF,GAAA,MAAAA,EAAa,KACf,CACF,EAAG,EAAE,EAGFG,EAAAC,EAAA,CAAW,KAAAR,EAAY,gBAAAJ,EACrB,SAAAG,CACH,CAAA,CAEJ,ECtCaU,EAAS,IAAIC,EAAOH,EAACT,IAAS,CAAE"}
1
+ {"version":3,"file":"render.js","sources":["/@dropins/storefront-wishlist/src/render/Provider.tsx","/@dropins/storefront-wishlist/src/render/render.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { useState, useEffect } from 'preact/hooks';\nimport { UIProvider } from '@adobe-commerce/elsie/components';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\n\nimport en_US from '../i18n/en_US.json';\n\n// Langs\nconst langDefinitions = {\n default: en_US,\n};\n\ninterface CartProviderProps {\n children?: any;\n}\n\nexport const Provider: FunctionComponent<CartProviderProps> = ({\n children,\n}) => {\n const [lang, setLang] = useState<Lang>('en_US');\n\n // Events\n useEffect(() => {\n const localeEvent = events.on(\n 'locale',\n (locale: string) => {\n setLang(locale as Lang);\n },\n { eager: true }\n );\n return () => {\n localeEvent?.off();\n };\n }, []);\n\n return (\n <UIProvider lang={lang} langDefinitions={langDefinitions}>\n {children}\n </UIProvider>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Render } from '@adobe-commerce/elsie/lib';\nimport { Provider } from './Provider';\n\nexport const render = new Render(<Provider />);\n"],"names":["langDefinitions","en_US","Provider","children","lang","setLang","useState","useEffect","localeEvent","events","locale","jsx","UIProvider","render","Render"],"mappings":"2xCA0BMA,EAAkB,CACtB,QAASC,CACX,EAMaC,EAAiD,CAAC,CAC7D,SAAAC,CACF,IAAM,CACJ,KAAM,CAACC,EAAMC,CAAO,EAAIC,EAAe,OAAO,EAG9C,OAAAC,EAAU,IAAM,CACd,MAAMC,EAAcC,EAAO,GACzB,SACCC,GAAmB,CAClBL,EAAQK,CAAc,CACxB,EACA,CAAE,MAAO,EAAA,CAAK,EAEhB,MAAO,IAAM,CACXF,GAAA,MAAAA,EAAa,KACf,CACF,EAAG,CAAA,CAAE,EAGHG,EAACC,EAAA,CAAW,KAAAR,EAAY,gBAAAJ,EACrB,SAAAG,CAAA,CACH,CAEJ,ECtCaU,EAAS,IAAIC,EAAOH,EAACT,IAAS,CAAE"}