@dropins/storefront-wishlist 2.0.0-alpha1 → 2.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/index.d.ts +0 -1
- package/api/initialize/initialize.d.ts +3 -3
- package/api.js +4 -3
- package/api.js.map +1 -0
- package/chunks/Heart.js +1 -0
- package/chunks/Heart.js.map +1 -0
- package/chunks/HeartFilled.js +1 -0
- package/chunks/HeartFilled.js.map +1 -0
- package/chunks/Trash.js +1 -0
- package/chunks/Trash.js.map +1 -0
- package/chunks/WishlistAlert.js +1 -0
- package/chunks/WishlistAlert.js.map +1 -0
- package/chunks/WishlistItem.js +2 -1
- package/chunks/WishlistItem.js.map +1 -0
- package/chunks/mergeWishlists.js +15 -15
- package/chunks/mergeWishlists.js.map +1 -0
- package/chunks/removeProductsFromWishlist.js +3 -173
- package/chunks/removeProductsFromWishlist.js.map +1 -0
- package/components/ProductItem/ProductItem.d.ts +1 -1
- package/containers/Wishlist/Wishlist.d.ts +2 -2
- package/containers/Wishlist.js +3 -2
- package/containers/Wishlist.js.map +1 -0
- package/containers/WishlistAlert.js +1 -0
- package/containers/WishlistAlert.js.map +1 -0
- package/containers/WishlistItem/WishlistItem.d.ts +2 -2
- package/containers/WishlistItem.js +2 -1
- package/containers/WishlistItem.js.map +1 -0
- package/containers/WishlistToggle/WishlistToggle.d.ts +1 -1
- package/containers/WishlistToggle.js +1 -0
- package/containers/WishlistToggle.js.map +1 -0
- package/data/transforms/__fixtures__/productData.d.ts +1 -72
- package/data/transforms/index.d.ts +0 -1
- package/package.json +1 -1
- package/render/render.d.ts +1 -1
- package/render.js +1 -0
- package/render.js.map +1 -0
- package/api/getProductBySku/getProductBySku.d.ts +0 -6
- package/api/getProductBySku/graphql/getProductBySku.graphql.d.ts +0 -18
- package/api/getProductBySku/graphql/index.d.ts +0 -18
- package/api/getProductBySku/index.d.ts +0 -18
- package/api/graphql/PriceRangeFragment.graphql.d.ts +0 -18
- package/api/graphql/ProductFragment.graphql.d.ts +0 -18
- package/chunks/getProductBySku.js +0 -13
- package/data/transforms/transform-product.d.ts +0 -4
package/api/index.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ export * from './initialize';
|
|
|
18
18
|
export * from './fetch-graphql';
|
|
19
19
|
export * from './getStoreConfig';
|
|
20
20
|
export * from './localStorage';
|
|
21
|
-
export * from './getProductBySku';
|
|
22
21
|
export * from './getWishlistById';
|
|
23
22
|
export * from './getWishlists';
|
|
24
23
|
export * from './addProductsToWishlist';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Initializer } from '
|
|
2
|
-
import { Lang } from '
|
|
1
|
+
import { Initializer } from '@dropins/tools/types/elsie/src/lib';
|
|
2
|
+
import { Lang } from '@dropins/tools/types/elsie/src/i18n';
|
|
3
3
|
|
|
4
4
|
type ConfigProps = {
|
|
5
5
|
langDefinitions?: Lang;
|
|
6
6
|
isGuestWishlistEnabled?: boolean;
|
|
7
7
|
};
|
|
8
8
|
export declare const initialize: Initializer<ConfigProps>;
|
|
9
|
-
export declare const config: import('
|
|
9
|
+
export declare const config: import('@dropins/tools/types/elsie/src/lib').Config<ConfigProps>;
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=initialize.d.ts.map
|
package/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{W as _,t as h,b as c}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
|
|
3
|
+
import{W as _,t as h,b as c}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 m,f as n,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 z,j as B}from"./chunks/removeProductsFromWishlist.js";import{events as u}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(
|
|
5
5
|
$wishlistId: ID!,
|
|
6
6
|
) {
|
|
@@ -25,7 +25,7 @@ import{W as _,t as h,b as c}from"./chunks/mergeWishlists.js";import{a as G,c as
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
${_}
|
|
28
|
-
`,w=async(r,o,e)=>{if(!l.authenticated)return
|
|
28
|
+
`,w=async(r,o,e)=>{if(!l.authenticated)return m();if(!r)throw Error("Wishlist ID is not set");return n(d,{variables:{wishlistId:r,currentPage:o,pageSize:e}}).then(({errors:s,data:t})=>{var a;if(s)return I(s);if(!((a=t==null?void 0:t.customer)!=null&&a.wishlist_v2))return null;const i=h(t.customer.wishlist_v2);return u.emit("wishlist/data",i),i})},W=`
|
|
29
29
|
mutation UPDATE_PRODUCTS_IN_WISHLIST_MUTATION(
|
|
30
30
|
$wishlistId: ID!,
|
|
31
31
|
$wishlistItems: [WishlistItemUpdateInput!]!,
|
|
@@ -45,4 +45,5 @@ ${_}
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
${c}
|
|
48
|
-
`,E=async r=>{const o=l.wishlistId;if(!o)throw Error("Wishlist ID is not set");return n(
|
|
48
|
+
`,E=async r=>{const o=l.wishlistId;if(!o)throw Error("Wishlist ID is not set");return n(W,{variables:{wishlistId:o,wishlistItems:r.map(({wishlistItemId:e,quantity:s,description:t,selectedOptions:i,enteredOptions:a})=>({wishlistItemId:e,quantity:s,description:t,selected_options:i,entered_options:a}))}}).then(({errors:e,data:s})=>{var i;const t=[...((i=s==null?void 0:s.updateProductsInWishlist)==null?void 0:i.user_errors)??[],...e??[]];return t.length>0?I(t):h(s.updateProductsInWishlist.wishlist)})};export{G as addProductsToWishlist,O as clearPersistedLocalStorage,H as config,n as fetchGraphQl,Q as getConfig,F as getDefaultWishlist,v as getGuestWishlist,m as getPersistedWishlistData,L as getStoreConfig,w as getWishlistById,y as getWishlistItemFromStorage,U as getWishlists,A as initialize,M as initializeWishlist,N as mergeWishlists,b as removeFetchGraphQlHeader,C as removeProductsFromWishlist,R as resetWishlist,Y as setEndpoint,x as setFetchGraphQlHeader,z as setFetchGraphQlHeaders,B as setPersistedWishlistData,E as updateProductsInWishlist};
|
|
49
|
+
//# sourceMappingURL=api.js.map
|
package/api.js.map
ADDED
|
@@ -0,0 +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 page_info {\n page_size\n current_page\n total_pages\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 currentPage: number,\n pageSize: number\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 currentPage,\n pageSize,\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","currentPage","pageSize","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;AAAA;AAAA;AAAA;AAAA;AAAA,EAwBtCC,CAAsB;AAAA,EClBXC,EAAkB,MAC7BC,EACAC,EACAC,IACoC,CAGhC,GAAA,CAACC,EAAM,cACT,OAAOC,EAAyB,EAGlC,GAAI,CAACJ,EACH,MAAM,MAAM,wBAAwB,EAItC,OAAOK,EAAaR,EAA0B,CAC5C,UAAW,CACT,WAAAG,EACA,YAAAC,EACA,SAAAC,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,ECvCaG,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,MAAMhB,EAAaG,EAAM,WAEzB,GAAI,CAACH,EACH,MAAM,MAAM,wBAAwB,EAGtC,OAAOK,EAAaQ,EAAsC,CACxD,UAAW,CACT,WAAAb,EACA,cAAegB,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"}
|
package/chunks/Heart.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import*as e from"@dropins/tools/preact-compat.js";const o=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("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"}));export{o as S};
|
|
4
|
+
//# sourceMappingURL=Heart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Heart.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Heart.svg"],"sourcesContent":["import * as React from \"react\";\nconst SvgHeart = (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(\"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\" }));\nexport default SvgHeart;\n"],"names":["SvgHeart","props","React"],"mappings":"kDACK,MAACA,EAAYC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAO,EAAkBC,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,qSAAsS,OAAQ,cAAc,CAAE,CAAC","x_google_ignoreList":[0]}
|
package/chunks/HeartFilled.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 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
|
+
//# sourceMappingURL=HeartFilled.js.map
|
|
@@ -0,0 +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]}
|
package/chunks/Trash.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 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",{d:"M1 5H23",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:10}),e.createElement("path",{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.5,strokeMiterlimit:10}),e.createElement("path",{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.5,strokeMiterlimit:10}),e.createElement("path",{d:"M8.87402 8.58057L9.39348 17.682",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:10}),e.createElement("path",{d:"M14.6673 8.58057L14.146 17.682",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:10}));export{r as S,o as a};
|
|
4
|
+
//# sourceMappingURL=Trash.js.map
|
|
@@ -0,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\", { d: \"M1 5H23\", stroke: \"currentColor\", strokeWidth: 1.5, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { 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.5, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { 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.5, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { d: \"M8.87402 8.58057L9.39348 17.682\", stroke: \"currentColor\", strokeWidth: 1.5, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { d: \"M14.6673 8.58057L14.146 17.682\", stroke: \"currentColor\", strokeWidth: 1.5, 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,CAAK,EAAoBC,EAAM,cAAc,OAAQ,CAAE,EAAG,UAAW,OAAQ,eAAgB,YAAa,IAAK,iBAAkB,EAAI,CAAA,EAAmBA,EAAM,cAAc,OAAQ,CAAE,EAAG,sIAAuI,OAAQ,eAAgB,YAAa,IAAK,iBAAkB,EAAE,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,EAAG,gGAAiG,OAAQ,eAAgB,YAAa,IAAK,iBAAkB,EAAE,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,EAAG,kCAAmC,OAAQ,eAAgB,YAAa,IAAK,iBAAkB,EAAI,CAAA,EAAmBA,EAAM,cAAc,OAAQ,CAAE,EAAG,iCAAkC,OAAQ,eAAgB,YAAa,IAAK,iBAAkB,GAAI,CAAC","x_google_ignoreList":[0,1]}
|
package/chunks/WishlistAlert.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 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",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",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)"})))),H=({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{H as W};
|
|
4
|
+
//# sourceMappingURL=WishlistAlert.js.map
|
|
@@ -0,0 +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\", 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\", 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)\" }))));\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":"8SAC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,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]}
|
package/chunks/WishlistItem.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as s,jsxs as w,Fragment as
|
|
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 dt,Price as I,Image as yt}from"@dropins/tools/components.js";import{events as lt}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})})},d=()=>{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})]})},l=()=>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(dt,{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.id,":"]})," ",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(dt,{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}),l(),d()]}),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 d=!1;async function l(){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,d||u(f)}catch(f){d||console.error("Failed to fetch product data:",f)}}return l(),()=>{d=!0}},[r,t,c]);const n=at(async(d=!0)=>{try{return await bt([r]),console.log(`Product ${o==null?void 0:o.sku} removed from wishlist!`),d&<.emit("wishlist/alert",{action:"remove",item:{...r,product:o}}),!0}catch(l){return console.error(`Product ${o.sku} could not be removed from wishlist`,l),!1}},[r,o]),m=at(async()=>{var d;try{return await a([{sku:o.sku,quantity:1,optionsUIDs:(d=r.selectedOptions)==null?void 0:d.map(l=>l.uid),enteredOptions:r.enteredOptions}]),console.log(`Product ${o.sku} successfully moved to cart 🛒`),lt.emit("wishlist/alert",{action:"move",item:{...r,product:o}}),await n(!1)}catch(l){return console.error("Could not move product to cart: ",l),l.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
|
+
//# sourceMappingURL=WishlistItem.js.map
|
|
@@ -0,0 +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.id}:\n </span>\n \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,EAEtC,SAAAgB,EAACC,GAAA,CACC,SAAQN,EAAAX,EAAK,UAAL,YAAAW,EAAc,SAAU,CAAC,EACjC,UAAAP,CAAA,CAAA,CACF,CACF,CAEJ,EAEMc,EAAe,IAAM,+EACzB,QACET,GAAAC,GAAAC,EAAAX,EAAK,UAAL,YAAAW,EAAc,SAAd,YAAAD,EAAsB,QAAtB,YAAAD,EAA6B,UAAW,UACxCG,GAAAC,GAAAC,EAAAd,EAAK,UAAL,YAAAc,EAAc,SAAd,YAAAD,EAAsB,QAAtB,YAAAD,EAA6B,iBAAkB,UAC/CO,GAAAC,GAAAC,EAAArB,EAAK,UAAL,YAAAqB,EAAc,SAAd,YAAAD,EAAsB,QAAtB,YAAAD,EAA6B,eAAgB,EAI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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"}
|
package/chunks/mergeWishlists.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{Initializer as y}from"@dropins/tools/lib.js";import{events as r}from"@dropins/tools/event-bus.js";import{j as
|
|
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 f,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),p().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 p().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})):[]:[]}const D=`
|
|
4
4
|
query STORE_CONFIG_QUERY {
|
|
5
5
|
storeConfig {
|
|
6
6
|
magento_wishlist_general_is_enabled
|
|
@@ -8,7 +8,7 @@ query STORE_CONFIG_QUERY {
|
|
|
8
8
|
maximum_number_of_wishlists
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
`,
|
|
11
|
+
`,C=async()=>I(D,{method:"GET",cache:"force-cache"}).then(({errors:t,data:s})=>t?f(t):N(s)),U=`
|
|
12
12
|
fragment CUSTOMIZABLE_OPTIONS_FRAGMENT on SelectedCustomizableOption {
|
|
13
13
|
type
|
|
14
14
|
customizable_option_uid
|
|
@@ -36,7 +36,7 @@ query STORE_CONFIG_QUERY {
|
|
|
36
36
|
canonical_url
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
`,
|
|
39
|
+
`,F=`
|
|
40
40
|
... on DownloadableWishlistItem {
|
|
41
41
|
added_at
|
|
42
42
|
description
|
|
@@ -48,7 +48,7 @@ query STORE_CONFIG_QUERY {
|
|
|
48
48
|
}
|
|
49
49
|
quantity
|
|
50
50
|
}
|
|
51
|
-
`,
|
|
51
|
+
`,k=`
|
|
52
52
|
... on GiftCardWishlistItem {
|
|
53
53
|
added_at
|
|
54
54
|
description
|
|
@@ -68,7 +68,7 @@ query STORE_CONFIG_QUERY {
|
|
|
68
68
|
sender_name
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
`,
|
|
71
|
+
`,H=`
|
|
72
72
|
... on BundleWishlistItem {
|
|
73
73
|
bundle_options {
|
|
74
74
|
label
|
|
@@ -81,7 +81,7 @@ query STORE_CONFIG_QUERY {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
`,P=`
|
|
85
85
|
fragment WISHLIST_ITEM_FRAGMENT on WishlistItemInterface {
|
|
86
86
|
__typename
|
|
87
87
|
id
|
|
@@ -89,19 +89,18 @@ fragment WISHLIST_ITEM_FRAGMENT on WishlistItemInterface {
|
|
|
89
89
|
description
|
|
90
90
|
added_at
|
|
91
91
|
product {
|
|
92
|
-
|
|
92
|
+
sku
|
|
93
93
|
}
|
|
94
94
|
${v}
|
|
95
|
-
${
|
|
96
|
-
${H}
|
|
95
|
+
${F}
|
|
97
96
|
${k}
|
|
97
|
+
${H}
|
|
98
98
|
customizable_options {
|
|
99
99
|
...CUSTOMIZABLE_OPTIONS_FRAGMENT
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
${
|
|
104
|
-
${F}
|
|
103
|
+
${U}
|
|
105
104
|
`,S=`
|
|
106
105
|
fragment WISHLIST_FRAGMENT on Wishlist {
|
|
107
106
|
id
|
|
@@ -115,8 +114,8 @@ fragment WISHLIST_FRAGMENT on Wishlist {
|
|
|
115
114
|
}
|
|
116
115
|
}
|
|
117
116
|
|
|
118
|
-
${
|
|
119
|
-
|
|
117
|
+
${P}
|
|
118
|
+
`,$=`
|
|
120
119
|
query GET_WISHLISTS_QUERY {
|
|
121
120
|
customer {
|
|
122
121
|
wishlists {
|
|
@@ -126,7 +125,7 @@ ${$}
|
|
|
126
125
|
}
|
|
127
126
|
|
|
128
127
|
${S}
|
|
129
|
-
`,
|
|
128
|
+
`,q=async()=>e.authenticated?I($).then(({errors:t,data:s})=>{var i;return t?f(t):(i=s==null?void 0:s.customer)!=null&&i.wishlists?s.customer.wishlists.map(a=>w(a)):null}):h(),z=`
|
|
130
129
|
mutation ADD_PRODUCTS_TO_WISHLIST_MUTATION(
|
|
131
130
|
$wishlistId: ID!,
|
|
132
131
|
$wishlistItems: [WishlistItemInput!]!,
|
|
@@ -145,4 +144,5 @@ ${$}
|
|
|
145
144
|
}
|
|
146
145
|
}
|
|
147
146
|
${S}
|
|
148
|
-
`,
|
|
147
|
+
`,x=async t=>{var a,n,l,d,m;if(!t)return null;const s=h();let i={id:(s==null?void 0:s.id)??"",updated_at:"",sharing_code:"",items_count:0,items:(s==null?void 0:s.items)??[]};for(const o of t){if((a=i.items)==null?void 0:a.some(_=>T(_,{sku:o.sku,optionUIDs:o.optionsUIDs})))continue;const c=o.optionsUIDs?(n=o.optionsUIDs)==null?void 0:n.map(_=>({uid:_})):[];i.items=[...i.items,{id:crypto.randomUUID(),quantity:o.quantity,selectedOptions:c,enteredOptions:o.enteredOptions??[],product:{sku:o.sku}}]}if(i.items_count=(l=i.items)==null?void 0:l.length,r.emit("wishlist/data",i),e.authenticated){if(!e.wishlistId)throw r.emit("wishlist/data",s),Error("Wishlist ID is not set");const o={wishlistId:e.wishlistId,wishlistItems:t.map(({sku:W,quantity:O,optionsUIDs:b,enteredOptions:M})=>({sku:W,quantity:O,selected_options:b,entered_options:M}))},{errors:u,data:c}=await I(z,{variables:o}),_=[...((d=c==null?void 0:c.addProductsToWishlist)==null?void 0:d.user_errors)??[],...u??[]];if(_.length>0)return r.emit("wishlist/data",s),f(_);const E=w(c.addProductsToWishlist.wishlist,((m=t[0])==null?void 0:m.enteredOptions)??[]);r.emit("wishlist/data",E)}return null},B=()=>(e.wishlistId=null,e.authenticated=!1,Promise.resolve(null)),p=async()=>{if(e.initializing)return null;e.initializing=!0,e.config||(e.config=await C());const t=e.authenticated?await Q():await Y();return r.emit("wishlist/initialized",t),r.emit("wishlist/data",t),e.initializing=!1,t};async function Q(){const t=await q(),s=t?t[0]:null;return s?(e.wishlistId=s.id,s):null}async function Y(){try{return await h()}catch(t){throw console.error(t),t}}const Z=async t=>{var n;if(!t)return null;const s=h(!0),i=[];if((n=s==null?void 0:s.items)==null||n.forEach(l=>{var o;const d=((o=l.selectedOptions)==null?void 0:o.map(u=>u.uid))||[];if(!t.items.some(u=>T(u,{sku:l.product.sku,optionUIDs:d}))){const u={sku:l.product.sku,quantity:1,optionsUIDs:d,enteredOptions:l.enteredOptions||void 0};i.push(u)}}),i.length===0)return null;const a=await x(i);return G(),a};export{P as W,x as a,S as b,V as c,q as d,p as e,Q as f,C as g,Y as h,g as i,Z as m,B as r,w as t};
|
|
148
|
+
//# sourceMappingURL=mergeWishlists.js.map
|
|
@@ -0,0 +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 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","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,MAAM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