@dropins/storefront-wishlist 0.2.1-alpha → 0.2.3-alpha

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.
@@ -14,5 +14,5 @@
14
14
  * is strictly forbidden unless prior written permission is obtained
15
15
  * from Adobe.
16
16
  *******************************************************************/
17
- export declare const GET_PRODUCT_BY_SKU = "\n query GET_PRODUCT_BY_SKU($sku: String!) {\n products(filter: { sku: { eq: $sku } }) {\n items {\n sku\n name\n thumbnail {\n label\n url\n }\n price_range {\n minimum_price {\n regular_price {\n currency\n value\n }\n final_price {\n currency\n value\n }\n discount {\n amount_off\n percent_off\n }\n }\n }\n stock_status\n ... on SimpleProduct {\n stock_status\n options {\n uid\n }\n }\n ... on ConfigurableProduct {\n configurable_options {\n uid\n attribute_uid\n attribute_code\n values {\n uid\n }\n }\n variants {\n product {\n sku\n stock_status\n }\n }\n }\n ... on BundleProduct {\n items {\n uid\n title\n options {\n uid\n label\n quantity\n }\n }\n }\n }\n }\n }\n";
17
+ export declare const GET_PRODUCT_BY_SKU: string;
18
18
  //# sourceMappingURL=getProductBySku.graphql.d.ts.map
package/api/index.d.ts CHANGED
@@ -26,4 +26,5 @@ export * from './removeProductsFromWishlist';
26
26
  export * from './updateProductsInWishlist';
27
27
  export * from './resetWishlist';
28
28
  export * from './initializeWishlist';
29
+ export * from './mergeWishlists';
29
30
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,18 @@
1
+ /********************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * __________________
4
+ *
5
+ * Copyright 2025 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+ *******************************************************************/
1
17
  export * from './initialize';
2
18
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,18 @@
1
+ /********************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * __________________
4
+ *
5
+ * Copyright 2025 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+ *******************************************************************/
17
+ export * from './mergeWishlists';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { Wishlist } from '../../data/models';
2
+
3
+ export declare const mergeWishlists: (wishlist: Wishlist) => Promise<Wishlist | null>;
4
+ //# sourceMappingURL=mergeWishlists.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 u}from"./chunks/initializeWishlist.js";import{a as G,c as H,h as F,j as v,d as U,g as A,e as L,i as M,f as N,r as R}from"./chunks/initializeWishlist.js";import{s as l,g as c,f as n,h as I}from"./chunks/removeProductsFromWishlist.js";import{e as y,j as O,c as Q,r as b,a as B,b as C,d as Y,i as x}from"./chunks/removeProductsFromWishlist.js";import{events as d}from"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import"@dropins/tools/fetch-graphql.js";const m=`
3
+ import{W as _,t as h,b as c}from"./chunks/mergeWishlists.js";import{a as G,c as H,h as F,j as v,d as L,g as U,e as A,i as M,f as N,m as R,r as $}from"./chunks/mergeWishlists.js";import{s as l,g as u,f as n,h as I}from"./chunks/removeProductsFromWishlist.js";import{k as O,e as Q,l as b,c as B,r as C,a as Y,b as x,d as z,j}from"./chunks/removeProductsFromWishlist.js";import{events as m}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 u}from"./chunks/initializeWishlist.js";import{a as G,c
25
25
  }
26
26
 
27
27
  ${_}
28
- `,w=async(r,o,e)=>{if(!l.authenticated)return c();if(!r)throw Error("Wishlist ID is not set");return n(m,{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 d.emit("wishlist/data",i),i})},p=`
28
+ `,w=async(r,o,e)=>{if(!l.authenticated)return u();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 m.emit("wishlist/data",i),i})},W=`
29
29
  mutation UPDATE_PRODUCTS_IN_WISHLIST_MUTATION(
30
30
  $wishlistId: ID!,
31
31
  $wishlistItems: [WishlistItemUpdateInput!]!,
@@ -44,5 +44,5 @@ ${_}
44
44
  }
45
45
  }
46
46
 
47
- ${u}
48
- `,E=async r=>{const o=l.wishlistId;if(!o)throw Error("Wishlist ID is not set");return n(p,{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,H as config,n as fetchGraphQl,y as getConfig,F as getDefaultWishlist,v as getGuestWishlist,c as getPersistedWishlistData,U as getProductBySku,A as getStoreConfig,w as getWishlistById,O as getWishlistItemFromStorage,L as getWishlists,M as initialize,N as initializeWishlist,Q as removeFetchGraphQlHeader,b as removeProductsFromWishlist,R as resetWishlist,B as setEndpoint,C as setFetchGraphQlHeader,Y as setFetchGraphQlHeaders,x as setPersistedWishlistData,E as updateProductsInWishlist};
47
+ ${c}
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,u as getPersistedWishlistData,L as getProductBySku,U as getStoreConfig,w as getWishlistById,b as getWishlistItemFromStorage,A as getWishlists,M as initialize,N as initializeWishlist,R as mergeWishlists,B as removeFetchGraphQlHeader,C as removeProductsFromWishlist,$ as resetWishlist,Y as setEndpoint,x as setFetchGraphQlHeader,z as setFetchGraphQlHeaders,j as setPersistedWishlistData,E as updateProductsInWishlist};
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as s,Fragment as g,jsxs as f}from"@dropins/tools/preact-jsx-runtime.js";import{classes as n}from"@dropins/tools/lib.js";import{Price as w,Button as T,Icon as _,Image as E}from"@dropins/tools/components.js";import{useState as S}from"@dropins/tools/preact-compat.js";import{s as p,r as A}from"./removeProductsFromWishlist.js";import{events as b}from"@dropins/tools/event-bus.js";import{a as C,S as F}from"./Trash.js";import{useText as O}from"@dropins/tools/i18n.js";const k=({taxes:c,displayMode:r})=>s(g,{children:c.map((e,o)=>f("div",{"data-testid":`wishlist-product-item-tax-${o}`,className:"wishlist-product-item-tax",children:[s("span",{className:"wishlist-product-item-tax-label",children:e.label}),s(w,{className:"wishlist-product-item-tax-price",amount:e.money.value,currency:e.money.currency}),s("span",{className:"wishlist-product-item-tax-display-mode",children:r==="INCLUDING_FPT_AND_DESCRIPTION"?"incl.":"excl."})]},o))}),L=({className:c,item:r,onCartActionButtonClick:e,onTrashButtonClick:o,fixedProductTaxesEnabled:l,fixedProductTaxesEnabledDisplayInProductLists:a,...d})=>{var i,h,P,m,x,v,N,I,y;const t=O({cartActionBtn:"ProductItem.CartActionButton",trashActionBtn:"ProductItem.TrashActionButton"}),u=((h=(i=r==null?void 0:r.prices)==null?void 0:i.discount)==null?void 0:h.amountOff)!==0||((m=(P=r==null?void 0:r.prices)==null?void 0:P.discount)==null?void 0:m.percentOff)!==0;return s("div",{...d,className:n(["wishlist-product-item",c]),children:f("div",{className:"wishlist-product-item__content",children:[s("a",{className:"wishlist-product-item-image","data-testid":"wishlist-product-item-image",href:r==null?void 0:r.urlKey,children:s(G,{images:r!=null&&r.image?[r.image]:[]})}),f("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:r==null?void 0:r.urlKey,children:r==null?void 0:r.name}),s(T,{"data-testid":"wishlist-product-item-remove-button",className:"wishlist-product-item-button__remove",variant:"tertiary",onClick:()=>o==null?void 0:o(),icon:s(_,{source:C,size:"24",stroke:"2",viewBox:"0 0 24 24","aria-label":t.trashActionBtn})}),s(w,{className:n(["wishlist-product-item-price",u?"strikeout":""]),"data-testid":"wishlist-product-item-price",amount:(x=r==null?void 0:r.prices)==null?void 0:x.regularPrice.value,currency:(v=r==null?void 0:r.prices)==null?void 0:v.regularPrice.currency}),u&&s(w,{className:"wishlist-product-item-discounted-price","data-testid":"wishlist-product-item-discounted-price",amount:(N=r==null?void 0:r.prices)==null?void 0:N.finalPrice.value,currency:(I=r==null?void 0:r.prices)==null?void 0:I.finalPrice.currency}),l&&(a==="INCLUDING_FPT_AND_DESCRIPTION"||a==="EXCLUDING_FPT_INCLUDING_DESCRIPTION_FINAL_PRICE")&&((y=r==null?void 0:r.prices)==null?void 0:y.fixedProductTaxes)&&s(k,{taxes:r.prices.fixedProductTaxes,displayMode:a})]}),s(T,{"data-testid":"wishlist-product-item-move-to-cart-button",size:"medium",type:"submit",icon:s(_,{source:F}),disabled:(r==null?void 0:r.stockStatus)!=="IN_STOCK","aria-label":t.cartActionBtn,onClick:()=>e==null?void 0:e(),children:t.cartActionBtn})]})})},G=({className:c,children:r,images:e,...o})=>{const[l,a]=S(0);return f(g,{children:[s("div",{...o,className:n(["image-carousel",c]),children:s("div",{className:n(["overflow-hidden relative max-w-[200px]",c]),children:e==null?void 0:e.map((d,t)=>t===l&&s(E,{className:"image-carousel-image",alt:d.alt,src:d.src}))})}),(e==null?void 0:e.length)>1&&s("div",{className:n(["absolute","image-switcher-area"]),children:e==null?void 0:e.map((d,t)=>s("span",{className:n(["image-switcher",l===t?"image-switcher-active":"image-switcher-inactive"]),onClick:u=>{a(t),u.stopPropagation()}},t))})]})},z=({initialData:c=null,moveProdToCart:r})=>{var l,a,d,t,u;if(!(c!=null&&c.product))return null;const e=async(i=!0)=>{try{return await A([c]),console.log(`Product ${c.product.sku} removed from wishlist!`),i&&b.emit("wishlist/alert",{action:"remove",item:c}),!0}catch(h){return console.error(`Product ${c.product.sku} could not be removed from wishlist`,h),!1}},o=async()=>{try{return await r([{sku:c.product.sku,quantity:1}]),console.log(`Product ${c.product.sku} successfully moved to cart 🛒!`),b.emit("wishlist/alert",{action:"move",item:c}),await e(!1)}catch(i){return console.error("Cart creation/update failed: ",i),!1}};return s(L,{item:c.product,onCartActionButtonClick:o,onTrashButtonClick:e,fixedProductTaxesEnabled:((l=p.config)==null?void 0:l.fixedProductTaxesEnabled)??!1,fixedProductTaxesApply:((a=p.config)==null?void 0:a.fixedProductTaxesApply)??!1,fixedProductTaxesEnabledDisplayInProductLists:(d=p.config)==null?void 0:d.fixedProductTaxesEnabledDisplayInProductLists,fixedProductTaxesEnabledDisplayInProductView:(t=p.config)==null?void 0:t.fixedProductTaxesEnabledDisplayInProductView,fixedProductTaxesEnabledDisplayInSalesModules:(u=p.config)==null?void 0:u.fixedProductTaxesEnabledDisplayInSalesModules})};export{z as W};
3
+ import{jsx as t,Fragment as R,jsxs as f}from"@dropins/tools/preact-jsx-runtime.js";import{classes as n}from"@dropins/tools/lib.js";import{Price as w,Button as L,Icon as U,Image as W}from"@dropins/tools/components.js";import{useState as $}from"@dropins/tools/preact-compat.js";import{s as h,r as B}from"./removeProductsFromWishlist.js";import{events as G}from"@dropins/tools/event-bus.js";import{a as M,S as j}from"./Trash.js";import{useText as z}from"@dropins/tools/i18n.js";const V=({taxes:e,displayMode:s})=>t(R,{children:e.map((r,c)=>f("div",{"data-testid":`wishlist-product-item-tax-${c}`,className:"wishlist-product-item-tax",children:[t("span",{className:"wishlist-product-item-tax-label",children:r.label}),t(w,{className:"wishlist-product-item-tax-price",amount:r.money.value,currency:r.money.currency}),t("span",{className:"wishlist-product-item-tax-display-mode",children:s==="INCLUDING_FPT_AND_DESCRIPTION"?"incl.":"excl."})]},c))}),q=({className:e,item:s,onCartActionButtonClick:r,onTrashButtonClick:c,fixedProductTaxesEnabled:p,fixedProductTaxesEnabledDisplayInProductLists:u,routeProdDetailPage:d,...o})=>{var l,i,v,x,P,I,N,y,T,_,b,g,S,E,C,A,O,F,k;const a=z({cartActionBtn:"ProductItem.CartActionButton",trashActionBtn:"ProductItem.TrashActionButton"}),m=((v=(i=(l=s.product)==null?void 0:l.prices)==null?void 0:i.discount)==null?void 0:v.amountOff)!==0||((I=(P=(x=s.product)==null?void 0:x.prices)==null?void 0:P.discount)==null?void 0:I.percentOff)!==0;return t("div",{...o,className:n(["wishlist-product-item",e]),children:f("div",{className:"wishlist-product-item__content",children:[t("a",{className:"wishlist-product-item-image","data-testid":"wishlist-product-item-image",href:d(s.product),children:t(K,{images:(N=s.product)!=null&&N.image?[s.product.image]:[]})}),f("div",{className:"wishlist-product-item__title","data-testid":"wishlist-product-item-header",children:[t("a",{className:"wishlist-product-item-name","data-testid":"wishlist-product-item-name",href:d(s.product),children:(y=s.product)==null?void 0:y.name}),t(L,{"data-testid":"wishlist-product-item-remove-button",className:"wishlist-product-item-button__remove",variant:"tertiary",onClick:()=>c==null?void 0:c(),icon:t(U,{source:M,size:"24",stroke:"2",viewBox:"0 0 24 24","aria-label":a.trashActionBtn})}),t(w,{className:n(["wishlist-product-item-price",m?"strikeout":""]),"data-testid":"wishlist-product-item-price",amount:(_=(T=s.product)==null?void 0:T.prices)==null?void 0:_.regularPrice.value,currency:(g=(b=s.product)==null?void 0:b.prices)==null?void 0:g.regularPrice.currency}),m&&t(w,{className:"wishlist-product-item-discounted-price","data-testid":"wishlist-product-item-discounted-price",amount:(E=(S=s.product)==null?void 0:S.prices)==null?void 0:E.finalPrice.value,currency:(A=(C=s.product)==null?void 0:C.prices)==null?void 0:A.finalPrice.currency}),p&&(u==="INCLUDING_FPT_AND_DESCRIPTION"||u==="EXCLUDING_FPT_INCLUDING_DESCRIPTION_FINAL_PRICE")&&((F=(O=s.product)==null?void 0:O.prices)==null?void 0:F.fixedProductTaxes)&&t(V,{taxes:s.product.prices.fixedProductTaxes,displayMode:u})]}),t(L,{"data-testid":"wishlist-product-item-move-to-cart-button",size:"medium",type:"submit",icon:t(U,{source:j}),disabled:((k=s.product)==null?void 0:k.stockStatus)!=="IN_STOCK","aria-label":a.cartActionBtn,onClick:()=>r==null?void 0:r(),children:a.cartActionBtn})]})})},K=({className:e,children:s,images:r,...c})=>{const[p,u]=$(0);return f(R,{children:[t("div",{...c,className:n(["image-carousel",e]),children:t("div",{className:n(["overflow-hidden relative max-w-[200px]",e]),children:r==null?void 0:r.map((d,o)=>o===p&&t(W,{className:"image-carousel-image",alt:d.alt,src:d.src}))})}),(r==null?void 0:r.length)>1&&t("div",{className:n(["absolute","image-switcher-area"]),children:r==null?void 0:r.map((d,o)=>t("span",{className:n(["image-switcher",p===o?"image-switcher-active":"image-switcher-inactive"]),onClick:a=>{u(o),a.stopPropagation()}},o))})]})},te=({initialData:e=null,moveProdToCart:s,routeProdDetailPage:r})=>{var u,d,o,a,m;if(!(e!=null&&e.product))return null;const c=async(l=!0)=>{try{return await B([e]),console.log(`Product ${e.product.sku} removed from wishlist!`),l&&G.emit("wishlist/alert",{action:"remove",item:e}),!0}catch(i){return console.error(`Product ${e.product.sku} could not be removed from wishlist`,i),!1}};return t(q,{item:e,onCartActionButtonClick:async()=>{var l;try{return await s([{sku:e.product.sku,quantity:1,optionsUIDs:(l=e.selectedOptions)==null?void 0:l.map(i=>i.uid),enteredOptions:e.enteredOptions}]),console.log(`Product ${e.product.sku} successfully moved to cart 🛒`),G.emit("wishlist/alert",{action:"move",item:e}),await c(!1)}catch(i){return console.error("Could not move product to cart: ",i),i.toString().includes("You need to choose options for your item.")&&(sessionStorage.setItem("incompleteProduct",e.product.sku),window.location.replace(r(e.product))),!1}},onTrashButtonClick:c,fixedProductTaxesEnabled:((u=h.config)==null?void 0:u.fixedProductTaxesEnabled)??!1,fixedProductTaxesApply:((d=h.config)==null?void 0:d.fixedProductTaxesApply)??!1,fixedProductTaxesEnabledDisplayInProductLists:(o=h.config)==null?void 0:o.fixedProductTaxesEnabledDisplayInProductLists,fixedProductTaxesEnabledDisplayInProductView:(a=h.config)==null?void 0:a.fixedProductTaxesEnabledDisplayInProductView,fixedProductTaxesEnabledDisplayInSalesModules:(m=h.config)==null?void 0:m.fixedProductTaxesEnabledDisplayInSalesModules,routeProdDetailPage:r})};export{te as W};
@@ -0,0 +1,315 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{Initializer as D}from"@dropins/tools/lib.js";import{events as c}from"@dropins/tools/event-bus.js";import{s as o,j as O,f as E,h as b,g as y,i as R,k as G}from"./removeProductsFromWishlist.js";const N=new D({init:async e=>{const t={isGuestWishlistEnabled:!1,...e};N.config.setConfig(t),P().catch(console.error)},listeners:()=>[c.on("authenticated",async e=>{if(o.authenticated&&!e&&c.emit("wishlist/reset",void 0),e&&!o.authenticated){o.authenticated=e;const t=await P().catch(console.error);t&&le(t)}},{eager:!0}),c.on("wishlist/data",e=>{O(e)}),c.on("wishlist/reset",()=>{oe().catch(console.error),c.emit("wishlist/data",null)})]}),pe=N.config;function v(e){if(!e)return null;const t=i=>{switch(i){case 1:return"INCLUDING_FPT_AND_DESCRIPTION";case 2:return"EXCLUDING_FPT_INCLUDING_DESCRIPTION_FINAL_PRICE";case 3:return"EXCLUDING_FPT";default:return"INCLUDING_FPT_ONLY"}};return{wishlistIsEnabled:e.storeConfig.magento_wishlist_general_is_enabled,wishlistMultipleListIsEnabled:e.storeConfig.enable_multiple_wishlists,wishlistMaxNumber:e.storeConfig.maximum_number_of_wishlists,fixedProductTaxesEnabled:e.storeConfig.fixed_product_taxes_enable,fixedProductTaxesApply:e.storeConfig.fixed_product_taxes_apply_tax_to_fpt,fixedProductTaxesEnabledDisplayInProductLists:t(e.storeConfig.fixed_product_taxes_display_prices_in_product_lists),fixedProductTaxesEnabledDisplayInSalesModules:t(e.storeConfig.fixed_product_taxes_display_prices_in_sales_modules),fixedProductTaxesEnabledDisplayInProductView:t(e.storeConfig.fixed_product_taxes_display_prices_on_product_view_page)}}function w(e){var t,i;return e?{type:e.__typename,name:e.name,sku:e.sku,uid:e.uid,image:M(e),stockStatus:e.stock_status,canonicalUrl:e.canonical_url,urlKey:e.url_key,categories:(t=e.categories)==null?void 0:t.map(s=>s.name),prices:U(e),productAttributes:W(e),options:e.gift_card_options?(i=e.gift_card_options)==null?void 0:i.map(s=>({uid:s.uid,required:s.required,title:s.title})):[]}:null}function M(e){var t,i;return{src:(t=e.thumbnail)==null?void 0:t.url,alt:(i=e.thumbnail)==null?void 0:i.label}}function U(e){var t,i,s,n,r,a,p,u,l,_,d,m,f,I,h,T,g,S;return{regularPrice:{currency:((s=(i=(t=e.price_range)==null?void 0:t.minimum_price)==null?void 0:i.regular_price)==null?void 0:s.currency)??"USD",value:((a=(r=(n=e.price_range)==null?void 0:n.minimum_price)==null?void 0:r.regular_price)==null?void 0:a.value)??0},finalPrice:{currency:((l=(u=(p=e.price_range)==null?void 0:p.minimum_price)==null?void 0:u.final_price)==null?void 0:l.currency)??"USD",value:((m=(d=(_=e.price_range)==null?void 0:_.minimum_price)==null?void 0:d.final_price)==null?void 0:m.value)??0},discount:{amountOff:((h=(I=(f=e.price_range)==null?void 0:f.minimum_price)==null?void 0:I.discount)==null?void 0:h.amount_off)??0,percentOff:((S=(g=(T=e.price_range)==null?void 0:T.minimum_price)==null?void 0:g.discount)==null?void 0:S.percent_off)??0},fixedProductTaxes:F(e)}}function W(e){var t,i;return(i=(t=e.custom_attributesV2)==null?void 0:t.items)==null?void 0:i.map(s=>{const n=s.code.split("_").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ");return{...s,code:n}})}function F(e){var t,i,s,n,r;return(i=(t=e.price_range)==null?void 0:t.minimum_price)!=null&&i.fixed_product_taxes?(r=(n=(s=e.price_range)==null?void 0:s.minimum_price)==null?void 0:n.fixed_product_taxes)==null?void 0:r.map(a=>({money:{value:a.amount.value,currency:a.amount.currency},label:a.label})):[]}function x(e,t){return e?{id:e.id,updated_at:e.updated_at,sharing_code:e.sharing_code,items_count:e.items_count,items:L(e,t??[])}:null}function L(e,t){var i,s;return(s=(i=e==null?void 0:e.items_v2)==null?void 0:i.items)!=null&&s.length?e.items_v2.items.map(n=>({id:n.id,quantity:n.quantity,description:n.description,added_at:n.added_at,enteredOptions:t,selectedOptions:n.configurable_options?n.configurable_options.map(r=>({value:r.value_label,label:r.option_label,uid:r.configurable_product_option_value_uid})):[],product:w(n.product)})):[]}const k=`
4
+ query STORE_CONFIG_QUERY {
5
+ storeConfig {
6
+ magento_wishlist_general_is_enabled
7
+ enable_multiple_wishlists
8
+ maximum_number_of_wishlists
9
+ fixed_product_taxes_enable
10
+ fixed_product_taxes_apply_tax_to_fpt
11
+ fixed_product_taxes_display_prices_in_product_lists
12
+ fixed_product_taxes_display_prices_in_sales_modules
13
+ fixed_product_taxes_display_prices_on_product_view_page
14
+ }
15
+ }
16
+ `,$=async()=>E(k,{method:"GET",cache:"force-cache"}).then(({errors:e,data:t})=>e?b(e):v(t)),q=`
17
+ fragment PRICE_RANGE_FRAGMENT on PriceRange {
18
+ minimum_price {
19
+ regular_price {
20
+ value
21
+ currency
22
+ }
23
+ final_price {
24
+ value
25
+ currency
26
+ }
27
+ discount {
28
+ percent_off
29
+ amount_off
30
+ }
31
+ fixed_product_taxes {
32
+ amount {
33
+ currency
34
+ value
35
+ }
36
+ label
37
+ }
38
+ }
39
+ maximum_price {
40
+ regular_price {
41
+ value
42
+ currency
43
+ }
44
+ final_price {
45
+ value
46
+ currency
47
+ }
48
+ discount {
49
+ percent_off
50
+ amount_off
51
+ }
52
+ fixed_product_taxes {
53
+ amount {
54
+ currency
55
+ value
56
+ }
57
+ label
58
+ }
59
+ }
60
+ }
61
+ `,C=`
62
+ fragment PRODUCT_FRAGMENT on ProductInterface {
63
+ __typename
64
+ uid
65
+ sku
66
+ name
67
+ thumbnail {
68
+ url
69
+ label
70
+ }
71
+ url_key
72
+ categories {
73
+ url_path
74
+ url_key
75
+ name
76
+ }
77
+ stock_status
78
+ canonical_url
79
+ custom_attributesV2(filters: {is_visible_on_front: true}){
80
+ items {
81
+ code
82
+ ...on AttributeValue {
83
+ value
84
+ }
85
+ ...on AttributeSelectedOptions {
86
+ selected_options {
87
+ value
88
+ label
89
+ }
90
+ }
91
+ }
92
+ }
93
+ price_range {
94
+ ...PRICE_RANGE_FRAGMENT
95
+ }
96
+ }
97
+
98
+ ${q}
99
+ `,H=`
100
+ ... on SimpleProduct {
101
+ options {
102
+ uid
103
+ }
104
+ }
105
+ `,B=`
106
+ ... on ConfigurableProduct {
107
+ configurable_options {
108
+ uid
109
+ attribute_uid
110
+ attribute_code
111
+ values {
112
+ uid
113
+ }
114
+ }
115
+ variants {
116
+ product {
117
+ sku
118
+ stock_status
119
+ }
120
+ }
121
+ }
122
+ `,z=`
123
+ ... on DownloadableProduct {
124
+ image {
125
+ label
126
+ url
127
+ }
128
+ }
129
+ `,Y=`
130
+ ... on GiftCardProduct {
131
+ giftcard_type
132
+ giftcard_amounts {
133
+ uid
134
+ website_id
135
+ value
136
+ attribute_id
137
+ website_value
138
+ }
139
+ gift_card_options {
140
+ title
141
+ required
142
+ uid
143
+ ... on CustomizableFieldOption {
144
+ value: value {
145
+ uid
146
+ }
147
+ }
148
+ }
149
+ }
150
+ `,Q=`
151
+ ... on BundleProduct {
152
+ items {
153
+ uid
154
+ required
155
+ title
156
+ options {
157
+ uid
158
+ label
159
+ quantity
160
+ }
161
+ }
162
+ }
163
+ `,K=`
164
+ query GET_PRODUCT_BY_SKU($sku: String!) {
165
+ products(filter: { sku: { eq: $sku } }) {
166
+ items {
167
+ ...PRODUCT_FRAGMENT
168
+ ${H}
169
+ ${B}
170
+ ${z}
171
+ ${Y}
172
+ ${Q}
173
+ }
174
+ }
175
+ }
176
+
177
+ ${C}
178
+ `,V=async e=>{if(!e)throw Error("Product SKU is not set");return E(K,{variables:{sku:e}}).then(({errors:t,data:i})=>{var s;return t?b(t):(s=i==null?void 0:i.products)!=null&&s.items?w(i.products.items[0]):null})},j=`
179
+ fragment CUSTOMIZABLE_OPTIONS_FRAGMENT on SelectedCustomizableOption {
180
+ type
181
+ customizable_option_uid
182
+ label
183
+ is_required
184
+ values {
185
+ label
186
+ value
187
+ price{
188
+ type
189
+ units
190
+ value
191
+ }
192
+ }
193
+ }
194
+ `,Z=`
195
+ ... on ConfigurableWishlistItem {
196
+ configurable_options {
197
+ option_label
198
+ value_label
199
+ configurable_product_option_value_uid
200
+ configurable_product_option_uid
201
+ }
202
+ configured_variant {
203
+ canonical_url
204
+ }
205
+ }
206
+ `,X=`
207
+ ... on DownloadableWishlistItem {
208
+ added_at
209
+ description
210
+ links_v2 {
211
+ sample_url
212
+ sort_order
213
+ title
214
+ uid
215
+ }
216
+ quantity
217
+ }
218
+ `,J=`
219
+ ... on GiftCardWishlistItem {
220
+ added_at
221
+ description
222
+ gift_card_options {
223
+ amount {
224
+ value
225
+ currency
226
+ }
227
+ custom_giftcard_amount {
228
+ value
229
+ currency
230
+ }
231
+ message
232
+ recipient_email
233
+ recipient_name
234
+ sender_email
235
+ sender_name
236
+ }
237
+ }
238
+ `,ee=`
239
+ ... on BundleWishlistItem {
240
+ bundle_options {
241
+ label
242
+ type
243
+ uid
244
+ values {
245
+ uid
246
+ label
247
+ quantity
248
+ }
249
+ }
250
+ }
251
+ `,te=`
252
+ fragment WISHLIST_ITEM_FRAGMENT on WishlistItemInterface {
253
+ __typename
254
+ id
255
+ quantity
256
+ description
257
+ added_at
258
+ product {
259
+ ...PRODUCT_FRAGMENT
260
+ }
261
+ ${Z}
262
+ ${X}
263
+ ${J}
264
+ ${ee}
265
+ customizable_options {
266
+ ...CUSTOMIZABLE_OPTIONS_FRAGMENT
267
+ }
268
+ }
269
+
270
+ ${C}
271
+ ${j}
272
+ `,A=`
273
+ fragment WISHLIST_FRAGMENT on Wishlist {
274
+ id
275
+ updated_at
276
+ sharing_code
277
+ items_count
278
+ items_v2 {
279
+ items {
280
+ ...WISHLIST_ITEM_FRAGMENT
281
+ }
282
+ }
283
+ }
284
+
285
+ ${te}
286
+ `,ie=`
287
+ query GET_WISHLISTS_QUERY {
288
+ customer {
289
+ wishlists {
290
+ ...WISHLIST_FRAGMENT
291
+ }
292
+ }
293
+ }
294
+
295
+ ${A}
296
+ `,se=async()=>o.authenticated?E(ie).then(({errors:e,data:t})=>{var i;return e?b(e):(i=t==null?void 0:t.customer)!=null&&i.wishlists?t.customer.wishlists.map(s=>x(s)):null}):y(),ne=`
297
+ mutation ADD_PRODUCTS_TO_WISHLIST_MUTATION(
298
+ $wishlistId: ID!,
299
+ $wishlistItems: [WishlistItemInput!]!,
300
+ ) {
301
+ addProductsToWishlist(
302
+ wishlistId: $wishlistId
303
+ wishlistItems: $wishlistItems
304
+ ) {
305
+ wishlist {
306
+ ...WISHLIST_FRAGMENT
307
+ }
308
+ user_errors {
309
+ code
310
+ message
311
+ }
312
+ }
313
+ }
314
+ ${A}
315
+ `,re=async e=>{var s,n,r,a,p;if(!e)return null;const t=y();let i={id:(t==null?void 0:t.id)??"",updated_at:"",sharing_code:"",items_count:0,items:(t==null?void 0:t.items)??[]};for(const u of e){if((s=t.items)==null?void 0:s.some(d=>R(d,{sku:u.sku,optionUIDs:u.optionsUIDs})))continue;const _=await V(u.sku);_&&(i.items=[...i.items,{quantity:u.quantity,selectedOptions:u.optionsUIDs?(n=u.optionsUIDs)==null?void 0:n.map(d=>({uid:d})):[],enteredOptions:[],product:_}])}if(i.items_count=(r=i.items)==null?void 0:r.length,c.emit("wishlist/data",i),o.authenticated){if(!o.wishlistId)throw c.emit("wishlist/data",t),Error("Wishlist ID is not set");const u={wishlistId:o.wishlistId,wishlistItems:e.map(({sku:f,parentSku:I,quantity:h,optionsUIDs:T,enteredOptions:g})=>({sku:f,parent_sku:I,quantity:h,selected_options:T,entered_options:g}))},{errors:l,data:_}=await E(ne,{variables:u}),d=[...((a=_==null?void 0:_.addProductsToWishlist)==null?void 0:a.user_errors)??[],...l??[]];if(d.length>0)return c.emit("wishlist/data",t),b(d);const m=x(_.addProductsToWishlist.wishlist,((p=e[0])==null?void 0:p.enteredOptions)??[]);c.emit("wishlist/data",m)}return null},oe=()=>(o.wishlistId=null,o.authenticated=!1,Promise.resolve(null)),P=async()=>{if(o.initializing)return null;o.initializing=!0,o.config||(o.config=await $());const e=o.authenticated?await ue():await ae();return c.emit("wishlist/initialized",e),c.emit("wishlist/data",e),o.initializing=!1,e};async function ue(){const e=await se(),t=e?e[0]:null;return t?(o.wishlistId=t.id,t):null}async function ae(){try{return await y()}catch(e){throw console.error(e),e}}const le=async e=>{var n;if(!e)return null;const t=y(!0),i=[];if((n=t==null?void 0:t.items)==null||n.forEach(r=>{var u;const a=((u=r.selectedOptions)==null?void 0:u.map(l=>l.uid))||[];if(!e.items.some(l=>R(l,{sku:r.product.sku,optionUIDs:a}))){const l={sku:r.product.sku,quantity:1,optionsUIDs:a,enteredOptions:r.enteredOptions||void 0};i.push(l)}}),i.length===0)return null;const s=await re(i);return G(),s};export{te as W,re as a,A as b,pe as c,V as d,se as e,P as f,$ as g,ue as h,N as i,ae as j,le as m,oe as r,x as t};
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{events as d}from"@dropins/tools/event-bus.js";import{FetchGraphQL as m}from"@dropins/tools/fetch-graphql.js";function S(s){const t=document.cookie.split(";");for(const e of t)if(e.trim().startsWith(`${s}=`))return e.trim().substring(s.length+1);return null}const g={wishlistId:null,authenticated:!1},i=new Proxy(g,{set(s,t,e){if(s[t]=e,t==="wishlistId"){if(e===i.wishlistId)return!0;if(e===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=${e}; expires=${r.toUTCString()}; path=/`}return Reflect.set(s,t,e)},get(s,t){return t==="wishlistId"?S("DROPIN__WISHLIST__WISHLIST-ID"):s[t]}}),n="DROPIN__WISHLIST__WISHLIST__DATA";function E(s){const t=i.authenticated?sessionStorage:localStorage;if(s)try{t.setItem(n,JSON.stringify(s))}catch(e){_(e)?console.error("Storage quota exceeded:",e):console.error("Error saving wishlist:",e)}else t.removeItem(n)}const _=s=>s instanceof DOMException&&s.name==="QuotaExceededError";function f(){const s=i.authenticated?sessionStorage:localStorage;try{const t=s.getItem(n);return t?JSON.parse(t):{id:"",items:[]}}catch(t){return console.error("Error retrieving wishlist:",t),{id:"",items:[]}}}function O(s){var r;const t=i.authenticated?sessionStorage:localStorage,e=t.getItem(n)?JSON.parse(t.getItem(n)):{items:[]};return(r=e==null?void 0:e.items)==null?void 0:r.find(a=>{var o;return((o=a.product)==null?void 0:o.sku)===s})}const{setEndpoint:H,setFetchGraphQlHeader:L,removeFetchGraphQlHeader:P,setFetchGraphQlHeaders:F,fetchGraphQl:p,getConfig:R}=new m().getMethods(),w=s=>{const t=s.map(e=>e.message).join(" ");throw Error(t)},T=`
3
+ import{events as u}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 d(s,e){var i;if(s.product.sku!==e.sku)return!1;const t=((i=s.selectedOptions)==null?void 0:i.map(o=>o.uid).sort())||[],r=(e.optionUIDs||[]).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){p(t)?console.error("Storage quota exceeded:",t):console.error("Error saving wishlist:",t)}else e.removeItem(c)}const p=s=>s instanceof DOMException&&s.name==="QuotaExceededError";function _(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=[],t=[]){var o;const r=n.authenticated?sessionStorage:localStorage,i=r.getItem(c)?JSON.parse(r.getItem(c)):{items:[]};return(o=i==null?void 0:i.items)==null?void 0:o.find(l=>d(l,{sku:s,optionUIDs:e}))}const{setEndpoint:P,setFetchGraphQlHeader:F,removeFetchGraphQlHeader:R,setFetchGraphQlHeaders:M,fetchGraphQl:w,getConfig:N}=new S().getMethods(),O=s=>{const e=s.map(t=>t.message).join(" ");throw Error(e)},D=`
4
4
  mutation REMOVE_PRODUCTS_FROM_WISHLIST_MUTATION(
5
5
  $wishlistId: ID!,
6
6
  $wishlistItemsIds: [ID!]!,
@@ -15,4 +15,4 @@ import{events as d}from"@dropins/tools/event-bus.js";import{FetchGraphQL as m}fr
15
15
  }
16
16
  }
17
17
  }
18
- `,$=async s=>{var r,a,o;const t=f(),e={...t,items:(r=t.items)==null?void 0:r.filter(c=>!s.map(I=>I.product.sku).includes(c.product.sku))};if(e.items_count=(a=e.items)==null?void 0:a.length,d.emit("wishlist/data",e),i.authenticated){if(!i.wishlistId)throw Error("Wishlist ID is not set");const c=s.map(u=>u.id),{errors:I,data:l}=await p(T,{variables:{wishlistId:i.wishlistId,wishlistItemsIds:c}}),h=[...((o=l==null?void 0:l.removeProductsFromWishlist)==null?void 0:o.user_errors)??[],...I??[]];return h.length>0?(d.emit("wishlist/data",t),w(h)):null}return null};export{H as a,L as b,P as c,F as d,R as e,p as f,f as g,w as h,E as i,O as j,$ as r,i as s};
18
+ `,$=async s=>{var r,i,o;const e=_(),t={...e,items:(r=e.items)==null?void 0:r.filter(l=>!s.some(I=>{var a;return d(l,{sku:I.product.sku,optionUIDs:(a=I.selectedOptions)==null?void 0:a.map(h=>h.uid)})}))};if(t.items_count=(i=t.items)==null?void 0:i.length,u.emit("wishlist/data",t),n.authenticated){if(!n.wishlistId)throw Error("Wishlist ID is not set");const l=s.map(m=>m.id),{errors:I,data:a}=await w(D,{variables:{wishlistId:n.wishlistId,wishlistItemsIds:l}}),h=[...((o=a==null?void 0:a.removeProductsFromWishlist)==null?void 0:o.user_errors)??[],...I??[]];return h.length>0?(u.emit("wishlist/data",e),O(h)):null}return null};export{P as a,F as b,R as c,M as d,N as e,w as f,_ as g,O as h,d as i,E as j,H as k,L as l,$ as r,n as s};
@@ -1,10 +1,10 @@
1
1
  import { FunctionComponent } from 'preact';
2
2
  import { HTMLAttributes } from 'preact/compat';
3
- import { Product } from '../../data/models';
3
+ import { Item, Product } from '../../data/models';
4
4
 
5
5
  export interface ProductItemProps extends HTMLAttributes<HTMLDivElement> {
6
6
  className?: string;
7
- item?: Product;
7
+ item?: Item;
8
8
  onCartActionButtonClick?: () => boolean;
9
9
  onTrashButtonClick?: () => boolean;
10
10
  fixedProductTaxesEnabled: boolean;
@@ -12,6 +12,7 @@ export interface ProductItemProps extends HTMLAttributes<HTMLDivElement> {
12
12
  fixedProductTaxesEnabledDisplayInProductLists?: string;
13
13
  fixedProductTaxesEnabledDisplayInSalesModules?: string;
14
14
  fixedProductTaxesEnabledDisplayInProductView?: string;
15
+ routeProdDetailPage: (product: Product) => string;
15
16
  }
16
17
  export declare const ProductItem: FunctionComponent<ProductItemProps>;
17
18
  //# sourceMappingURL=ProductItem.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { FunctionComponent } from 'preact';
2
+
3
+ export declare const WishlistItemSkeleton: FunctionComponent;
4
+ //# sourceMappingURL=WishlistItemSkeleton.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { FunctionComponent } from 'preact';
2
+
3
+ export declare const WishlistSkeleton: FunctionComponent;
4
+ //# sourceMappingURL=WishlistSkeleton.d.ts.map
@@ -15,5 +15,7 @@
15
15
  * from Adobe.
16
16
  *******************************************************************/
17
17
  export * from './Wishlist';
18
+ export * from './WishlistSkeleton';
19
+ export * from './WishlistItemSkeleton';
18
20
  export { Wishlist as default } from './Wishlist';
19
21
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import { HTMLAttributes } from 'preact/compat';
2
2
  import { Container } from '../../../@adobe-commerce/elsie/src/lib';
3
+ import { Product } from '../../data/models';
3
4
 
4
5
  export interface WishlistProps extends HTMLAttributes<HTMLDivElement> {
5
6
  routeEmptyWishlistCTA?: () => string;
@@ -8,6 +9,7 @@ export interface WishlistProps extends HTMLAttributes<HTMLDivElement> {
8
9
  sku: string;
9
10
  quantity: number;
10
11
  }[]) => Promise<any>;
12
+ routeProdDetailPage: (product: Product) => string;
11
13
  }
12
14
  export declare const Wishlist: Container<WishlistProps>;
13
15
  //# sourceMappingURL=Wishlist.d.ts.map
@@ -1,3 +1,17 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as s,jsxs as u,Fragment as H}from"@dropins/tools/preact-jsx-runtime.js";import{useState as _,useCallback as L,useEffect as k,useMemo as N,Fragment as S}from"@dropins/tools/preact-compat.js";import{classes as w,VComponent as F}from"@dropins/tools/lib.js";import{IllustratedMessage as $,Button as j,Icon as M}from"@dropins/tools/components.js";import{W as z}from"../chunks/WishlistItem.js";import{events as v}from"@dropins/tools/event-bus.js";import{s as B}from"../chunks/removeProductsFromWishlist.js";import{useText as x,Text as b}from"@dropins/tools/i18n.js";import{W as V}from"../chunks/WishlistAlert.js";import{S as q}from"../chunks/Heart.js";import"../chunks/Trash.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/HeartFilled.js";const A=({className:l,children:i,ctaLinkURL:e,...d})=>{const r=x({emptyWishlist:"Wishlist.EmptyWishlist.heading",message:"Wishlist.EmptyWishlist.message",cta:"Wishlist.EmptyWishlist.cta"});return s("div",{...d,className:w(["wishlist-empty-wishlist",l]),children:s($,{className:w(["wishlist-empty-wishlist__wrapper",l]),"data-testid":"wishlist-empty-wishlist",heading:r.emptyWishlist,icon:s(M,{className:"wishlist-empty-wishlist__icon",source:q}),message:s("p",{children:r.message}),action:e?s(j,{"data-testid":"wishlist-empty-wishlist-button",size:"medium",variant:"primary",type:"submit",href:e,children:r.cta},"routeHome"):void 0})})},ss=({routeEmptyWishlistCTA:l,routeToWishlist:i,moveProdToCart:e,...d})=>{const[r,h]=_(null),[W,y]=_(B.authenticated),m=n=>y(n),[g,f]=_(null),c=L(n=>{const{action:a,item:t}=n;f(s(V,{action:a,item:t}))},[i]);return k(()=>{const n=v.on("authenticated",m),a=v.on("wishlist/alert",o=>c(o)),t=v.on("wishlist/data",o=>{h(o)});return()=>{n==null||n.off(),t==null||t.off(),a==null||a.off()}},[c]),s(G,{...d,wishlistData:r,wishlistAlert:g,routeEmptyWishlistCTA:l,moveProdToCart:e,isLoggedIn:W})},G=({className:l,wishlistData:i,wishlistAlert:e,isLoggedIn:d,moveProdToCart:r,routeEmptyWishlistCTA:h,onLoginClick:W,...y})=>{const[m,g]=_(e),f=x({wishlistHeading:"Wishlist.Wishlist.heading"}),c=N(()=>{var t;return((t=i==null?void 0:i.items)==null?void 0:t.length)>0?i.items.map(o=>{var p;return s(z,{initialData:o,moveProdToCart:r},(p=o.product)==null?void 0:p.sku)}):null},[i,r]);k(()=>{if(e){g(e);const t=setTimeout(()=>{g(null)},5e3);return()=>clearTimeout(t)}},[e]);const n=N(()=>m?s(F,{node:m,className:"wishlist-wishlist__alert"}):null,[m]),a=N(()=>{var t;return c?s("div",{className:"wishlist-wishlist__heading","data-testid":"wishlist-heading-wrapper",children:s("div",{className:"wishlist-wishlist__heading-text","data-testid":"default-wishlist-heading",children:(t=f.wishlistHeading)==null?void 0:t.split(" {count}").map((o,p)=>{var I;return u(S,{children:[o,p===0&&s("span",{className:"wishlist-wishlist__heading-count","data-testid":"wishlist-heading-count",children:`${i==null?void 0:i.items_count} products`})]},((I=i==null?void 0:i.id)==null?void 0:I.toString())+p)})})}):null},[f,c,i]);return u("div",{...y,className:w(["wishlist-wishlist",l]),children:[n,c?u(H,{children:[a,s("div",{className:"wishlist-wishlist__content",children:c})]}):s("div",{className:w(["wishlist-wishlist__content","wishlist-wishlist__content--empty"]),children:u("div",{children:[s(A,{"data-testid":"empty-wishlist",ctaLinkURL:h==null?void 0:h()}),!d&&s(J,{onLoginClick:W})]})})]})},J=({onLoginClick:l})=>u("div",{className:"wishlist-login__sign-in",children:[s("a",{"data-testid":"log-in-link",className:"wishlist-login__link",href:"",rel:"noreferrer",onClick:l,role:"button",children:s(b,{id:"Wishlist.Login.logIn"})}),s(b,{id:"Wishlist.Login.sync"})]});export{ss as Wishlist,ss as default};
3
+ import{jsx as i,jsxs as d,Fragment as H}from"@dropins/tools/preact-jsx-runtime.js";import{useState as w,useCallback as j,useEffect as F,useMemo as k,Fragment as B}from"@dropins/tools/preact-compat.js";import{classes as y,VComponent as R}from"@dropins/tools/lib.js";import{IllustratedMessage as z,Button as A,Icon as V,SkeletonRow as Y,Skeleton as q}from"@dropins/tools/components.js";import{W as G}from"../chunks/WishlistItem.js";import{events as I}from"@dropins/tools/event-bus.js";import{s as b}from"../chunks/removeProductsFromWishlist.js";import{useText as $,Text as M}from"@dropins/tools/i18n.js";import{W as J}from"../chunks/WishlistAlert.js";import{S as K}from"../chunks/Heart.js";import"../chunks/Trash.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/HeartFilled.js";const O=({className:l,children:s,ctaLinkURL:e,...c})=>{const r=$({emptyWishlist:"Wishlist.EmptyWishlist.heading",message:"Wishlist.EmptyWishlist.message",cta:"Wishlist.EmptyWishlist.cta"});return i("div",{...c,className:y(["wishlist-empty-wishlist",l]),children:i(z,{className:y(["wishlist-empty-wishlist__wrapper",l]),"data-testid":"wishlist-empty-wishlist",heading:r.emptyWishlist,icon:i(V,{className:"wishlist-empty-wishlist__icon",source:K}),message:i("p",{children:r.message}),action:e?i(A,{"data-testid":"wishlist-empty-wishlist-button",size:"medium",variant:"primary",type:"submit",href:e,children:r.cta},"routeHome"):void 0})})},S=()=>i(Y,{children:`
4
+ <svg
5
+ width="100%"
6
+ height="100%"
7
+ viewBox="0 0 288 658"
8
+ fill="none"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ preserveAspectRatio="xMinYMin meet"
11
+ >
12
+ <rect x="6" y="24" width="282px" height="480" rx="8" fill="#E8E8E8" />
13
+ <rect x="6" y="522" width="280" height="22" rx="4" fill="#E8E8E8" />
14
+ <rect x="6" y="556" width="132" height="22" rx="4" fill="#E8E8E8" />
15
+ <rect x="6" y="592" width="280" height="48" rx="24" fill="#D9D9D9" />
16
+ </svg>
17
+ `}),Q=()=>d(q,{"data-testid":"wishlist-loader",children:[i(S,{}),i(S,{}),i(S,{})]}),hi=({routeEmptyWishlistCTA:l,routeToWishlist:s,moveProdToCart:e,routeProdDetailPage:c,...r})=>{const[f,m]=w(null),[v,N]=w(b.authenticated),[L,g]=w(b.isLoading),_=n=>N(n),[p,a]=w(null),W=j(n=>{const{action:o,item:h}=n;a(i(J,{action:o,item:h}))},[s]);return F(()=>{const n=I.on("authenticated",_),o=I.on("wishlist/alert",t=>W(t)),h=I.on("wishlist/data",t=>{m(t),g(!1)});return()=>{n==null||n.off(),h==null||h.off(),o==null||o.off()}},[W]),i(U,{...r,wishlistData:f,wishlistAlert:p,routeEmptyWishlistCTA:l,moveProdToCart:e,isLoggedIn:v,isLoading:L,routeProdDetailPage:c})},U=({className:l,wishlistData:s,wishlistAlert:e,isLoggedIn:c,isLoading:r,moveProdToCart:f,routeEmptyWishlistCTA:m,onLoginClick:v,routeProdDetailPage:N,...L})=>{const[g,_]=w(e),p=$({wishlistHeading:"Wishlist.Wishlist.heading",wishlistLoadingHeading:"Wishlist.Wishlist.loading"}),a=k(()=>{var t;return((t=s==null?void 0:s.items)==null?void 0:t.length)>0?s.items.map(x=>{var u;return i(G,{initialData:x,moveProdToCart:f,routeProdDetailPage:N},(u=x.product)==null?void 0:u.sku)}):null},[s,f]);F(()=>{if(e){_(e);const t=setTimeout(()=>{_(null)},5e3);return()=>clearTimeout(t)}},[e]);const W=k(()=>g?i(R,{node:g,className:"wishlist-wishlist__alert"}):null,[g]),n=()=>d(H,{children:[i("div",{className:"wishlist-wishlist__heading","data-testid":"wishlist-heading-wrapper",children:i("div",{className:"wishlist-wishlist__heading-text","data-testid":"loader-wishlist-heading",children:p.wishlistLoadingHeading})}),i(Q,{})]}),o=()=>a?d(H,{children:[h,i("div",{className:"wishlist-wishlist__content",children:a})]}):i("div",{className:y(["wishlist-wishlist__content","wishlist-wishlist__content--empty"]),children:d("div",{children:[i(O,{"data-testid":"empty-wishlist",ctaLinkURL:m==null?void 0:m()}),!c&&i(X,{onLoginClick:v})]})}),h=k(()=>{var t;return a?i("div",{className:"wishlist-wishlist__heading","data-testid":"wishlist-heading-wrapper",children:i("div",{className:"wishlist-wishlist__heading-text","data-testid":"default-wishlist-heading",children:(t=p.wishlistHeading)==null?void 0:t.split(" {count}").map((x,u)=>{var E;return d(B,{children:[x,u===0&&i("span",{className:"wishlist-wishlist__heading-count","data-testid":"wishlist-heading-count",children:`${s==null?void 0:s.items_count} products`})]},((E=s==null?void 0:s.id)==null?void 0:E.toString())+u)})})}):null},[p,a,s]);return d("div",{...L,className:y(["wishlist-wishlist",l]),children:[W,r?n():o()]})},X=({onLoginClick:l})=>d("div",{className:"wishlist-login__sign-in",children:[i("a",{"data-testid":"log-in-link",className:"wishlist-login__link",href:"",rel:"noreferrer",onClick:l,role:"button",children:i(M,{id:"Wishlist.Login.logIn"})}),i(M,{id:"Wishlist.Login.sync"})]});export{hi as Wishlist,hi as default};
@@ -1,13 +1,16 @@
1
1
  import { HTMLAttributes } from 'preact/compat';
2
2
  import { Container } from '../../../@adobe-commerce/elsie/src/lib';
3
- import { Item } from '../../data/models';
3
+ import { Item, Product } from '../../data/models';
4
4
 
5
5
  export interface WishlistItemProps extends HTMLAttributes<HTMLDivElement> {
6
6
  initialData: Item | null;
7
7
  moveProdToCart: (products: {
8
8
  sku: string;
9
9
  quantity: number;
10
+ optionsUIDs?: [];
11
+ enteredOptions?: [];
10
12
  }[]) => Promise<any>;
13
+ routeProdDetailPage: (product: Product) => string;
11
14
  }
12
15
  export declare const WishlistItem: Container<WishlistItemProps>;
13
16
  //# sourceMappingURL=WishlistItem.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as o}from"@dropins/tools/preact-jsx-runtime.js";import{useState as a,useEffect as D}from"@dropins/tools/preact-compat.js";import{Button as E,Icon as c}from"@dropins/tools/components.js";import{events as i}from"@dropins/tools/event-bus.js";import{s as F,g as H,r as L}from"../chunks/removeProductsFromWishlist.js";import{c as T,a as b}from"../chunks/initializeWishlist.js";import{S as j}from"../chunks/HeartFilled.js";import{S as q}from"../chunks/Heart.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const R=({product:s,iconWishlisted:d,iconToWishlist:u,size:h,variant:f,disabled:g,labelToWishlist:v,labelWishlisted:p,onClick:I})=>{const[W,k]=a(F.authenticated),[n,e]=a(!1),[r,w]=a(null),{isGuestWishlistEnabled:S}=T.getConfig();D(()=>{const y=t=>k(t),P=()=>{var m;const t=H(),l=(m=t==null?void 0:t.items)==null?void 0:m.find(x=>x.product.sku===s.sku);w(l??null),e(!!l)};i.on("authenticated",y),i.on("wishlist/data",P)},[s.sku]);const C=async()=>{n?(await L([r]),e(!1),i.emit("wishlist/alert",{action:"remove",item:r})):(await b([{sku:s.sku,quantity:1}]),e(!0),i.emit("wishlist/alert",{action:"add",item:{product:s}}))};return!W&&!S?null:o(E,{active:n,"data-testid":"wishlist-toggle",size:h??"medium",variant:f??"tertiary",disabled:g,icon:o(c,{source:u??q}),activeIcon:o(c,{source:d??j}),onClick:I??C,children:v,activeChildren:p})};export{R as WishlistToggle,R as default};
3
+ import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{useState as l,useEffect as P}from"@dropins/tools/preact-compat.js";import{Button as x,Icon as d}from"@dropins/tools/components.js";import{events as o}from"@dropins/tools/event-bus.js";import{s as E,g as F,i as H,r as L}from"../chunks/removeProductsFromWishlist.js";import{c as T,a as b}from"../chunks/mergeWishlists.js";import{S as j}from"../chunks/HeartFilled.js";import{S as q}from"../chunks/Heart.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const R=({product:t,iconWishlisted:u,iconToWishlist:f,size:g,variant:I,disabled:v,labelToWishlist:p,labelWishlisted:W,onClick:k})=>{const[w,D]=l(E.authenticated),[r,a]=l(!1),[m,S]=l(null),{isGuestWishlistEnabled:U}=T.getConfig();P(()=>{const e=s=>D(s),i=()=>{var h;const s=F(),c=(h=s==null?void 0:s.items)==null?void 0:h.find(y=>H(y,{sku:t.sku,optionUIDs:t.optionUIDs}));S(c??null),a(!!c)};o.on("authenticated",e),o.on("wishlist/data",i)},[t.optionUIDs,t.sku]);const C=async()=>{var e;r?(await L([m]),a(!1),o.emit("wishlist/alert",{action:"remove",item:m})):(await b([{sku:t.sku,quantity:1,optionsUIDs:t.optionUIDs??void 0,enteredOptions:(e=t.options)!=null&&e.items?t.options.items.filter(i=>i.selected).map(i=>({uid:i.uid,value:i.value})):void 0}]),a(!0),o.emit("wishlist/alert",{action:"add",item:{product:t}}))};return!w&&!U?null:n(x,{active:r,"data-testid":"wishlist-toggle",size:g??"medium",variant:I??"tertiary",disabled:v,icon:n(d,{source:f??q}),activeIcon:n(d,{source:u??j}),onClick:k??C,children:p,activeChildren:W})};export{R as WishlistToggle,R as default};
@@ -15,6 +15,7 @@
15
15
  * from Adobe.
16
16
  *******************************************************************/
17
17
  export interface Product {
18
+ type: string;
18
19
  name: string;
19
20
  sku: string;
20
21
  uid: string;
@@ -25,6 +26,7 @@ export interface Product {
25
26
  categories: string[];
26
27
  prices: PriceDetails;
27
28
  productAttributes?: Attribute[];
29
+ options: Option[];
28
30
  }
29
31
  export interface PriceDetails {
30
32
  regularPrice: MoneyProps;
@@ -35,7 +37,7 @@ export interface PriceDetails {
35
37
  };
36
38
  fixedProductTaxes: FixedProductTaxesProps[];
37
39
  }
38
- interface MoneyProps {
40
+ export interface MoneyProps {
39
41
  value: number;
40
42
  currency: string;
41
43
  }
@@ -56,5 +58,10 @@ interface Attribute {
56
58
  value?: string;
57
59
  selected_options?: AttributeOption[];
58
60
  }
61
+ interface Option {
62
+ uid: string;
63
+ required: boolean;
64
+ title: string;
65
+ }
59
66
  export {};
60
67
  //# sourceMappingURL=product.d.ts.map
@@ -13,7 +13,17 @@ export interface Item {
13
13
  quantity: number;
14
14
  description: string;
15
15
  added_at: string;
16
+ selectedOptions: ConfigurableOption[];
17
+ enteredOptions?: {
18
+ uid: string;
19
+ value: string;
20
+ }[];
16
21
  product: Product;
17
22
  customizableOptions: SelectedCustomizableOption[];
18
23
  }
24
+ export interface ConfigurableOption {
25
+ value: string;
26
+ label: string;
27
+ uid: string;
28
+ }
19
29
  //# sourceMappingURL=wishlist.d.ts.map
@@ -2,5 +2,6 @@ import { Product } from '../../models/product';
2
2
 
3
3
  declare const product: Product;
4
4
  declare const productOutOfStock: Product;
5
- export { product, productOutOfStock };
5
+ declare const configurableProduct: Product;
6
+ export { product, productOutOfStock, configurableProduct };
6
7
  //# sourceMappingURL=productData.d.ts.map
@@ -1,5 +1,8 @@
1
1
  import { Wishlist } from '../../models/wishlist';
2
2
 
3
- declare const wishlist: Wishlist;
4
- export { wishlist };
3
+ export declare const wishlist: Wishlist;
4
+ export declare const wishlistWithProductWithOptions: Wishlist;
5
+ export declare const wishlistWithProductOutOfStock: Wishlist;
6
+ export declare const wishlistWithProductWithoutDiscount: Wishlist;
7
+ export declare const wishlistWithProductWithoutTaxes: Wishlist;
5
8
  //# sourceMappingURL=wishlistData.d.ts.map
@@ -1,4 +1,7 @@
1
1
  import { Wishlist } from '../models/wishlist';
2
2
 
3
- export declare function transformWishlist(data: any): Wishlist | null;
3
+ export declare function transformWishlist(data: any, enteredOptions?: {
4
+ uid: string;
5
+ value: string;
6
+ }[]): Wishlist | null;
4
7
  //# sourceMappingURL=transform-wishlist.d.ts.map
@@ -6,7 +6,8 @@ declare const _default: {
6
6
  "cta": "Start shopping"
7
7
  },
8
8
  "Wishlist": {
9
- "heading": "Wishlist {count}"
9
+ "heading": "Wishlist {count}",
10
+ "loading": "Loading..."
10
11
  },
11
12
  "Alert": {
12
13
  "addProduct": {
@@ -1,6 +1,10 @@
1
1
  import { Wishlist } from '../data/models';
2
2
 
3
3
  export declare function setPersistedWishlistData(data: Wishlist | null): void;
4
- export declare function getPersistedWishlistData(): Wishlist | {};
5
- export declare function getWishlistItemFromStorage(productSku: string): any;
4
+ export declare function getPersistedWishlistData(guest?: boolean): Wishlist | {};
5
+ export declare function clearPersistedLocalStorage(): void;
6
+ export declare function getWishlistItemFromStorage(productSku: string, optionUIDs?: string[], enteredOptions?: {
7
+ uid: string;
8
+ value: string;
9
+ }[]): any;
6
10
  //# sourceMappingURL=persisted-data.d.ts.map
package/lib/state.d.ts CHANGED
@@ -3,6 +3,7 @@ import { StoreConfigModel } from '../data/models/store-config';
3
3
  type State = {
4
4
  wishlistId: string | null;
5
5
  initializing?: boolean;
6
+ isLoading?: boolean;
6
7
  locale?: string;
7
8
  config?: StoreConfigModel | null;
8
9
  authenticated: boolean;
@@ -0,0 +1,12 @@
1
+ import { Item } from '../data/models/wishlist';
2
+
3
+ interface ProductLike {
4
+ sku: string;
5
+ optionUIDs?: string[];
6
+ }
7
+ /**
8
+ * Helper function to compare wishlist items by their SKU and selected options
9
+ */
10
+ export declare function isMatchingWishlistItem(wishlistItem: Item, product: ProductLike): boolean;
11
+ export {};
12
+ //# sourceMappingURL=wishlist-item-comparator.d.ts.map
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-wishlist", "version": "0.2.1-alpha", "@dropins/tools": "~1.0.0", "license": "SEE LICENSE IN LICENSE.md"}
1
+ {"name": "@dropins/storefront-wishlist", "version": "0.2.3-alpha", "@dropins/tools": "~1.0.0", "license": "SEE LICENSE IN LICENSE.md"}
package/render.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- (function(r,i){try{if(typeof document<"u"){const t=document.createElement("style"),n=i.styleId;for(const e in i.attributes)t.setAttribute(e,i.attributes[e]);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 e=document.querySelector('link[rel="stylesheet"], style');e?e.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-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){.wishlist-wishlist__content{grid-template-columns:repeat(1,1fr)}}@media only screen and (min-width: 480px) and (max-width: 600px){.wishlist-wishlist__content{grid-template-columns:repeat(2,1fr)}}@media only screen and (min-width: 600px){.wishlist-wishlist__content{grid-template-columns:repeat(2,1fr)}}@media only screen and (min-width: 768px){.wishlist-wishlist__content{grid-template-columns:repeat(3,1fr)}}.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;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-price{display:inline;font:var(--type-body-2-default-font)}.strikeout{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{margin-top:var(--spacing-small);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
- import{jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{Render as n}from"@dropins/tools/lib.js";import{useState as d,useEffect as a}from"@dropins/tools/preact-hooks.js";import{UIProvider as c}from"@dropins/tools/components.js";import{events as m}from"@dropins/tools/event-bus.js";const h={EmptyWishlist:{heading:"Your wishlist is empty",message:"Add items by clicking on the heart icon.",cta:"Start shopping"},Wishlist:{heading:"Wishlist {count}"},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"},viewWishlist:"View wishlist"},Login:{sync:" to sync your saved items across all your devices.",logIn:"Log in"}},u={CartActionButton:"Move To Cart",TrashActionButton:"Remove this product from wishlist"},l={Wishlist:h,ProductItem:u},g={default:l},f=({children:o})=>{const[s,i]=d("en_US");return a(()=>{const t=m.on("locale",r=>{i(r)},{eager:!0});return()=>{t==null||t.off()}},[]),e(c,{lang:s,langDefinitions:g,children:o})},W=new n(e(f,{}));export{W as render};
3
+ (function(r,i){try{if(typeof document<"u"){const e=document.createElement("style"),n=i.styleId;for(const t in i.attributes)e.setAttribute(t,i.attributes[t]);e.setAttribute("data-dropin",n),e.appendChild(document.createTextNode(r));const a=document.querySelector('style[data-dropin="sdk"]');if(a)a.after(e);else{const t=document.querySelector('link[rel="stylesheet"], style');t?t.before(e):document.head.append(e)}}}catch(e){console.error("dropin-styles (injectCodeFunction)",e)}})(".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-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){.wishlist-wishlist__content,.dropin-skeleton{grid-template-columns:repeat(1,1fr)}.dropin-skeleton-row:nth-child(n+2){display:none}}@media only screen and (min-width: 480px) and (max-width: 600px){.wishlist-wishlist__content,.dropin-skeleton{grid-template-columns:repeat(2,1fr)}.dropin-skeleton-row:nth-child(n+3){display:none}}@media only screen and (min-width: 600px){.wishlist-wishlist__content,.dropin-skeleton{grid-template-columns:repeat(2,1fr)}.dropin-skeleton-row:nth-child(n+3){display:none}}@media only screen and (min-width: 768px){.wishlist-wishlist__content,.dropin-skeleton{grid-template-columns:repeat(3,1fr)}.dropin-skeleton-row:nth-child(n){display:block}}.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;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-price{display:inline;font:var(--type-body-2-default-font)}.strikeout{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{margin-top:var(--spacing-small);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
+ import{jsx as o}from"@dropins/tools/preact-jsx-runtime.js";import{Render as n}from"@dropins/tools/lib.js";import{useState as d,useEffect as a}from"@dropins/tools/preact-hooks.js";import{UIProvider as c}from"@dropins/tools/components.js";import{events as m}from"@dropins/tools/event-bus.js";const h={EmptyWishlist:{heading:"Your wishlist is empty",message:"Add items by clicking on the heart icon.",cta:"Start shopping"},Wishlist:{heading:"Wishlist {count}",loading:"Loading..."},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"},viewWishlist:"View wishlist"},Login:{sync:" to sync your saved items across all your devices.",logIn:"Log in"}},u={CartActionButton:"Move To Cart",TrashActionButton:"Remove this product from wishlist"},l={Wishlist:h,ProductItem:u},g={default:l},f=({children:e})=>{const[s,i]=d("en_US");return a(()=>{const t=m.on("locale",r=>{i(r)},{eager:!0});return()=>{t==null||t.off()}},[]),o(c,{lang:s,langDefinitions:g,children:e})},W=new n(o(f,{}));export{W as render};
@@ -1,237 +0,0 @@
1
- /*! Copyright 2025 Adobe
2
- All Rights Reserved. */
3
- import{Initializer as R}from"@dropins/tools/lib.js";import{events as u}from"@dropins/tools/event-bus.js";import{s as r,i as A,f as g,h as T,g as E}from"./removeProductsFromWishlist.js";const S=new R({init:async e=>{const t={isGuestWishlistEnabled:!1,...e};S.config.setConfig(t),P().catch(console.error)},listeners:()=>[u.on("authenticated",e=>{r.authenticated&&!e&&u.emit("wishlist/reset",void 0),e&&!r.authenticated&&(r.authenticated=e,P().catch(console.error))},{eager:!0}),u.on("wishlist/data",e=>{A(e)}),u.on("wishlist/reset",()=>{K().catch(console.error),u.emit("wishlist/data",null)})]}),ee=S.config;function G(e){if(!e)return null;const t=i=>{switch(i){case 1:return"INCLUDING_FPT_AND_DESCRIPTION";case 2:return"EXCLUDING_FPT_INCLUDING_DESCRIPTION_FINAL_PRICE";case 3:return"EXCLUDING_FPT";default:return"INCLUDING_FPT_ONLY"}};return{wishlistIsEnabled:e.storeConfig.magento_wishlist_general_is_enabled,wishlistMultipleListIsEnabled:e.storeConfig.enable_multiple_wishlists,wishlistMaxNumber:e.storeConfig.maximum_number_of_wishlists,fixedProductTaxesEnabled:e.storeConfig.fixed_product_taxes_enable,fixedProductTaxesApply:e.storeConfig.fixed_product_taxes_apply_tax_to_fpt,fixedProductTaxesEnabledDisplayInProductLists:t(e.storeConfig.fixed_product_taxes_display_prices_in_product_lists),fixedProductTaxesEnabledDisplayInSalesModules:t(e.storeConfig.fixed_product_taxes_display_prices_in_sales_modules),fixedProductTaxesEnabledDisplayInProductView:t(e.storeConfig.fixed_product_taxes_display_prices_on_product_view_page)}}function b(e){var t;return e?{name:e.name,sku:e.sku,uid:e.uid,image:v(e),stockStatus:e.stock_status,canonicalUrl:e.canonical_url,urlKey:e.url_key,categories:(t=e.categories)==null?void 0:t.map(i=>i.name),prices:O(e),productAttributes:W(e)}:null}function v(e){var t,i;return{src:(t=e.thumbnail)==null?void 0:t.url,alt:(i=e.thumbnail)==null?void 0:i.label}}function O(e){var t,i,s,n,c,a,_,o,l,d,m,f,p,h,I,y,x,w;return{regularPrice:{currency:(s=(i=(t=e.price_range)==null?void 0:t.minimum_price)==null?void 0:i.regular_price)==null?void 0:s.currency,value:(a=(c=(n=e.price_range)==null?void 0:n.minimum_price)==null?void 0:c.regular_price)==null?void 0:a.value},finalPrice:{currency:(l=(o=(_=e.price_range)==null?void 0:_.minimum_price)==null?void 0:o.final_price)==null?void 0:l.currency,value:(f=(m=(d=e.price_range)==null?void 0:d.minimum_price)==null?void 0:m.final_price)==null?void 0:f.value},discount:{amountOff:(I=(h=(p=e.price_range)==null?void 0:p.minimum_price)==null?void 0:h.discount)==null?void 0:I.amount_off,percentOff:(w=(x=(y=e.price_range)==null?void 0:y.minimum_price)==null?void 0:x.discount)==null?void 0:w.percent_off},fixedProductTaxes:D(e)}}function W(e){var t,i;return(i=(t=e.custom_attributesV2)==null?void 0:t.items)==null?void 0:i.map(s=>{const n=s.code.split("_").map(c=>c.charAt(0).toUpperCase()+c.slice(1)).join(" ");return{...s,code:n}})}function D(e){var t,i,s;return(s=(i=(t=e.price_range)==null?void 0:t.minimum_price)==null?void 0:i.fixed_product_taxes)==null?void 0:s.map(n=>({money:{value:n.amount.value,currency:n.amount.currency},label:n.label}))}function C(e){return e?{id:e.id,updated_at:e.updated_at,sharing_code:e.sharing_code,items_count:e.items_count,items:M(e)}:null}function M(e){var t,i;return(i=(t=e==null?void 0:e.items_v2)==null?void 0:t.items)!=null&&i.length?e.items_v2.items.map(s=>({id:s.id,quantity:s.quantity,description:s.description,added_at:s.added_at,product:b(s.product)})):[]}const F=`
4
- query STORE_CONFIG_QUERY {
5
- storeConfig {
6
- magento_wishlist_general_is_enabled
7
- enable_multiple_wishlists
8
- maximum_number_of_wishlists
9
- fixed_product_taxes_enable
10
- fixed_product_taxes_apply_tax_to_fpt
11
- fixed_product_taxes_display_prices_in_product_lists
12
- fixed_product_taxes_display_prices_in_sales_modules
13
- fixed_product_taxes_display_prices_on_product_view_page
14
- }
15
- }
16
- `,U=async()=>g(F,{method:"GET",cache:"force-cache"}).then(({errors:e,data:t})=>e?T(e):G(t)),k=`
17
- query GET_PRODUCT_BY_SKU($sku: String!) {
18
- products(filter: { sku: { eq: $sku } }) {
19
- items {
20
- sku
21
- name
22
- thumbnail {
23
- label
24
- url
25
- }
26
- price_range {
27
- minimum_price {
28
- regular_price {
29
- currency
30
- value
31
- }
32
- final_price {
33
- currency
34
- value
35
- }
36
- discount {
37
- amount_off
38
- percent_off
39
- }
40
- }
41
- }
42
- stock_status
43
- ... on SimpleProduct {
44
- stock_status
45
- options {
46
- uid
47
- }
48
- }
49
- ... on ConfigurableProduct {
50
- configurable_options {
51
- uid
52
- attribute_uid
53
- attribute_code
54
- values {
55
- uid
56
- }
57
- }
58
- variants {
59
- product {
60
- sku
61
- stock_status
62
- }
63
- }
64
- }
65
- ... on BundleProduct {
66
- items {
67
- uid
68
- title
69
- options {
70
- uid
71
- label
72
- quantity
73
- }
74
- }
75
- }
76
- }
77
- }
78
- }
79
- `,L=async e=>{if(!e)throw Error("Product SKU is not set");return g(k,{variables:{sku:e}}).then(({errors:t,data:i})=>{var s;return t?T(t):(s=i==null?void 0:i.products)!=null&&s.items?b(i.products.items[0]):null})},$=`
80
- fragment PRICE_RANGE_FRAGMENT on PriceRange {
81
- minimum_price {
82
- regular_price {
83
- value
84
- currency
85
- }
86
- final_price {
87
- value
88
- currency
89
- }
90
- discount {
91
- percent_off
92
- amount_off
93
- }
94
- fixed_product_taxes {
95
- amount {
96
- currency
97
- value
98
- }
99
- label
100
- }
101
- }
102
- maximum_price {
103
- regular_price {
104
- value
105
- currency
106
- }
107
- final_price {
108
- value
109
- currency
110
- }
111
- discount {
112
- percent_off
113
- amount_off
114
- }
115
- fixed_product_taxes {
116
- amount {
117
- currency
118
- value
119
- }
120
- label
121
- }
122
- }
123
- }
124
- `,H=`
125
- fragment PRODUCT_FRAGMENT on ProductInterface {
126
- name
127
- sku
128
- uid
129
- thumbnail {
130
- url
131
- label
132
- }
133
- url_key
134
- categories {
135
- url_path
136
- url_key
137
- name
138
- }
139
- stock_status
140
- canonical_url
141
- custom_attributesV2(filters: {is_visible_on_front: true}){
142
- items {
143
- code
144
- ...on AttributeValue {
145
- value
146
- }
147
- ...on AttributeSelectedOptions {
148
- selected_options {
149
- value
150
- label
151
- }
152
- }
153
- }
154
- }
155
- price_range {
156
- ...PRICE_RANGE_FRAGMENT
157
- }
158
- }
159
-
160
- ${$}
161
- `,z=`
162
- fragment CUSTOMIZABLE_OPTIONS_FRAGMENT on SelectedCustomizableOption {
163
- type
164
- customizable_option_uid
165
- label
166
- is_required
167
- values {
168
- label
169
- value
170
- price{
171
- type
172
- units
173
- value
174
- }
175
- }
176
- }
177
- `,q=`
178
- fragment WISHLIST_ITEM_FRAGMENT on WishlistItemInterface {
179
- __typename
180
- id
181
- quantity
182
- description
183
- added_at
184
- product {
185
- ...PRODUCT_FRAGMENT
186
- }
187
- customizable_options {
188
- ...CUSTOMIZABLE_OPTIONS_FRAGMENT
189
- }
190
- }
191
-
192
- ${H}
193
- ${z}
194
- `,N=`
195
- fragment WISHLIST_FRAGMENT on Wishlist {
196
- id
197
- updated_at
198
- sharing_code
199
- items_count
200
- items_v2 {
201
- items {
202
- ...WISHLIST_ITEM_FRAGMENT
203
- }
204
- }
205
- }
206
-
207
- ${q}
208
- `,B=`
209
- query GET_WISHLISTS_QUERY {
210
- customer {
211
- wishlists {
212
- ...WISHLIST_FRAGMENT
213
- }
214
- }
215
- }
216
-
217
- ${N}
218
- `,Y=async()=>r.authenticated?g(B).then(({errors:e,data:t})=>{var i;return e?T(e):(i=t==null?void 0:t.customer)!=null&&i.wishlists?t.customer.wishlists.map(s=>C(s)):null}):E(),Q=`
219
- mutation ADD_PRODUCTS_TO_WISHLIST_MUTATION(
220
- $wishlistId: ID!,
221
- $wishlistItems: [WishlistItemInput!]!,
222
- ) {
223
- addProductsToWishlist(
224
- wishlistId: $wishlistId
225
- wishlistItems: $wishlistItems
226
- ) {
227
- wishlist {
228
- ...WISHLIST_FRAGMENT
229
- }
230
- user_errors {
231
- code
232
- message
233
- }
234
- }
235
- }
236
- ${N}
237
- `,te=async e=>{var s,n,c;const t=E();let i={id:(t==null?void 0:t.id)??"",items:(t==null?void 0:t.items)??[],updated_at:"",sharing_code:"",items_count:0};if(!e)return null;for(const a of e){if((s=t.items)==null?void 0:s.some(l=>l.product.sku===a.sku))continue;const o=await L(a.sku);o&&(i.items=[...i.items,{product:o}])}if(i.items_count=(n=i.items)==null?void 0:n.length,u.emit("wishlist/data",i),r.authenticated){if(!r.wishlistId)throw u.emit("wishlist/data",t),Error("Wishlist ID is not set");const a={wishlistId:r.wishlistId,wishlistItems:e.map(({sku:m,parentSku:f,quantity:p,optionsUIDs:h,enteredOptions:I})=>({sku:m,parent_sku:f,quantity:p,selected_options:h,entered_options:I}))},{errors:_,data:o}=await g(Q,{variables:a}),l=[...((c=o==null?void 0:o.addProductsToWishlist)==null?void 0:c.user_errors)??[],..._??[]];if(l.length>0)return u.emit("wishlist/data",t),T(l);const d=C(o.addProductsToWishlist.wishlist);u.emit("wishlist/data",d)}return null},K=()=>(r.wishlistId=null,r.authenticated=!1,Promise.resolve(null)),P=async()=>{if(r.initializing)return null;r.initializing=!0,r.config||(r.config=await U());const e=r.authenticated?await V():await Z();return u.emit("wishlist/initialized",e),u.emit("wishlist/data",e),r.initializing=!1,e};async function V(){const e=await Y(),t=e?e[0]:null;return t?(r.wishlistId=t.id,t):null}async function Z(){try{return await E()}catch(e){throw console.error(e),e}}export{q as W,te as a,N as b,ee as c,L as d,Y as e,P as f,U as g,V as h,S as i,Z as j,K as r,C as t};