@dropins/storefront-wishlist 1.0.2-beta1 → 2.0.0-alpha1
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/getStoreConfig/graphql/StoreConfigQuery.d.ts +1 -1
- package/api.js +3 -3
- package/chunks/WishlistItem.js +1 -1
- package/chunks/getProductBySku.js +13 -0
- package/chunks/mergeWishlists.js +20 -197
- package/chunks/removeProductsFromWishlist.js +173 -2
- package/components/ProductItem/ProductItem.d.ts +1 -6
- package/components/index.d.ts +0 -1
- package/containers/Wishlist/Wishlist.d.ts +2 -0
- package/containers/Wishlist.js +2 -2
- package/containers/WishlistItem/WishlistItem.d.ts +3 -1
- package/containers/WishlistItem.js +1 -1
- package/containers/WishlistToggle.js +1 -1
- package/data/models/product.d.ts +59 -42
- package/data/models/store-config.d.ts +0 -5
- package/data/models/wishlist.d.ts +6 -8
- package/data/transforms/__fixtures__/productData.d.ts +218 -3
- package/data/transforms/__fixtures__/wishlistData.d.ts +2 -4
- package/data/transforms/transform-product.d.ts +2 -2
- package/lib/persisted-data.d.ts +1 -4
- package/package.json +1 -1
- package/render.js +1 -1
- package/components/ImageCarousel/ImageCarousel.d.ts +0 -17
- package/components/TaxDetails/TaxDetails.d.ts +0 -9
- package/components/TaxDetails/index.d.ts +0 -19
|
@@ -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 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
|
|
17
|
+
export declare 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";
|
|
18
18
|
//# sourceMappingURL=StoreConfigQuery.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,
|
|
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 u,f as n,h as I}from"./chunks/removeProductsFromWishlist.js";import{k as y,e as O,l as Q,c as b,r as x,a as B,b as C,d as Y,j as z}from"./chunks/removeProductsFromWishlist.js";import{g as j}from"./chunks/getProductBySku.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 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 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})},
|
|
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})},p=`
|
|
29
29
|
mutation UPDATE_PRODUCTS_IN_WISHLIST_MUTATION(
|
|
30
30
|
$wishlistId: ID!,
|
|
31
31
|
$wishlistItems: [WishlistItemUpdateInput!]!,
|
|
@@ -45,4 +45,4 @@ ${_}
|
|
|
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(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,y as clearPersistedLocalStorage,H as config,n as fetchGraphQl,O as getConfig,F as getDefaultWishlist,v as getGuestWishlist,u as getPersistedWishlistData,j as getProductBySku,L as getStoreConfig,w as getWishlistById,Q as getWishlistItemFromStorage,U as getWishlists,A as initialize,M as initializeWishlist,N as mergeWishlists,b as removeFetchGraphQlHeader,x as removeProductsFromWishlist,R as resetWishlist,B as setEndpoint,C as setFetchGraphQlHeader,Y as setFetchGraphQlHeaders,z as setPersistedWishlistData,E as updateProductsInWishlist};
|
package/chunks/WishlistItem.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as
|
|
3
|
+
import{jsx as s,jsxs as w,Fragment as x}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 B,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";import{g as Bt}from"./getProductBySku.js";const xt=({className:r,item:t,onCartActionButtonClick:c,onTrashButtonClick:a,routeProdDetailPage:p,imageNode:y,...o})=>{var _,k,z,g,S,P,q;const u=It({cartActionBtn:"ProductItem.CartActionButton",trashActionBtn:"ProductItem.TrashActionButton",customizeActionBtn:"ProductItem.CustomizeActionButton"}),n=((z=(k=(_=t.product)==null?void 0:_.prices)==null?void 0:k.final)==null?void 0:z.amount)<((P=(S=(g=t.product)==null?void 0:g.prices)==null?void 0:S.regular)==null?void 0:P.amount),m=()=>{var e;return s("a",{className:"wishlist-product-item-image","data-testid":"wishlist-product-item-image",href:p(t.product),children:s(Ot,{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(x,{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(x,{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(B,{"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(B,{"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(B,{"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:(q=t.product)==null?void 0:q.name}),l(),d()]}),ht(),N()]})})},Ot=({className:r,children:t,images:c,imageNode:a,...p})=>{const[y,o]=pt(0);return w(x,{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))})]})},Ct=({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):await Bt(r==null?void 0:r.product.sku),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{Ct as W};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{P as p,f,h as g}from"./removeProductsFromWishlist.js";function d(e,t=[]){var r,i;return e?{name:e.name,sku:e.sku,isBundle:!1,addToCartAllowed:!0,inStock:e.stock_status==="IN_STOCK",shortDescription:(r=e.short_description)==null?void 0:r.html,metaDescription:e.meta_description,metaKeyword:e.meta_keyword,metaTitle:e.meta_title,description:(i=e.description)==null?void 0:i.html,images:P(e,t),prices:h(e),attributes:v(e),options:y(e),optionUIDs:void 0,url:e.canonical_url,urlKey:e.url_key,externalId:void 0,externalParentId:void 0,variantSku:void 0,productType:b(e.__typename)}:null}function b(e){switch(e){case"SimpleProduct":case"VirtualProduct":case"DownloadableProduct":return"simple";default:return"complex"}}function y(e){var t;return e.__typename==="ConfigurableProduct"?e.configurable_options?(t=e.configurable_options)==null?void 0:t.map(r=>{var i;return{id:r.attribute_code,type:"text",label:r.uid,required:!0,multiple:!1,items:(i=r.values)==null?void 0:i.map(n=>({id:n.uid,label:n.label,inStock:!0,value:n.uid,selected:!1}))}}):[]:[]}function P(e,t=[]){var i;let r=e.thumbnail;if(e.__typename==="ConfigurableProduct"&&e.variants&&(t==null?void 0:t.length)>0){const n=t.map(o=>o.uid);let u=e.variants.find(o=>{var s;const l=((s=o.attributes)==null?void 0:s.map(c=>c.uid))||[];return n.every(c=>l.includes(c))});u||(u=e.variants.find(o=>{var l;return(l=o.attributes)==null?void 0:l.some(s=>t.some(c=>c.uid===s.uid))})),(i=u==null?void 0:u.product)!=null&&i.image&&(r=u.product.image)}return[{url:r==null?void 0:r.url,label:r==null?void 0:r.label}]}function h(e){var t,r,i,n,u,o,l,s,c,m,a,_;return{regular:{currency:((i=(r=(t=e.price_range)==null?void 0:t.minimum_price)==null?void 0:r.regular_price)==null?void 0:i.currency)??"USD",amount:((o=(u=(n=e.price_range)==null?void 0:n.minimum_price)==null?void 0:u.regular_price)==null?void 0:o.value)??0},final:{currency:((c=(s=(l=e.price_range)==null?void 0:l.minimum_price)==null?void 0:s.final_price)==null?void 0:c.currency)??"USD",amount:((_=(a=(m=e.price_range)==null?void 0:m.minimum_price)==null?void 0:a.final_price)==null?void 0:_.value)??0},visible:!0}}function v(e){var t,r;return(r=(t=e.custom_attributesV2)==null?void 0:t.items)==null?void 0:r.map(i=>{const n=i.code.split("_").map(u=>u.charAt(0).toUpperCase()+u.slice(1)).join(" ");return{...i,code:n}})}const T=`
|
|
4
|
+
query GET_PRODUCT_BY_SKU($sku: String!) {
|
|
5
|
+
products(filter: { sku: { eq: $sku } }) {
|
|
6
|
+
items {
|
|
7
|
+
...PRODUCT_FRAGMENT
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
${p}
|
|
13
|
+
`,S=async(e,t)=>{if(!e)throw Error("Product SKU is not set");return f(T,{variables:{sku:e}}).then(({errors:r,data:i})=>{var n;return r?g(r):(n=i==null?void 0:i.products)!=null&&n.items?d(i.products.items[0],t??[]):null})};export{S as g};
|
package/chunks/mergeWishlists.js
CHANGED
|
@@ -1,191 +1,14 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{Initializer as
|
|
3
|
+
import{Initializer as y}from"@dropins/tools/lib.js";import{events as r}from"@dropins/tools/event-bus.js";import{j as R,s as e,f as I,h as f,P as A,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=>{R(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&&j(s)}},{eager:!0}),r.on("wishlist/reset",()=>{Q().catch(console.error),r.emit("wishlist/data",null)})]}),X=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:D(t,s??[])}:null}function D(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=L(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 L(t){return t.product.__typename==="ConfigurableProduct"?t.configurable_options?t.configurable_options.map(s=>({uid:s.configurable_product_option_value_uid})):[]:[]}const C=`
|
|
4
4
|
query STORE_CONFIG_QUERY {
|
|
5
5
|
storeConfig {
|
|
6
6
|
magento_wishlist_general_is_enabled
|
|
7
7
|
enable_multiple_wishlists
|
|
8
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
9
|
}
|
|
15
10
|
}
|
|
16
|
-
`,
|
|
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
|
-
`,z=`
|
|
62
|
-
... on SimpleProduct {
|
|
63
|
-
options {
|
|
64
|
-
uid
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
`,Y=`
|
|
68
|
-
... on ConfigurableProduct {
|
|
69
|
-
configurable_options {
|
|
70
|
-
uid
|
|
71
|
-
attribute_uid
|
|
72
|
-
attribute_code
|
|
73
|
-
values {
|
|
74
|
-
uid
|
|
75
|
-
label
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
variants {
|
|
79
|
-
attributes {
|
|
80
|
-
code
|
|
81
|
-
uid
|
|
82
|
-
label
|
|
83
|
-
}
|
|
84
|
-
product {
|
|
85
|
-
sku
|
|
86
|
-
stock_status
|
|
87
|
-
image {
|
|
88
|
-
label
|
|
89
|
-
url
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
`,Q=`
|
|
95
|
-
... on DownloadableProduct {
|
|
96
|
-
image {
|
|
97
|
-
label
|
|
98
|
-
url
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
`,K=`
|
|
102
|
-
... on GiftCardProduct {
|
|
103
|
-
giftcard_type
|
|
104
|
-
giftcard_amounts {
|
|
105
|
-
uid
|
|
106
|
-
website_id
|
|
107
|
-
value
|
|
108
|
-
attribute_id
|
|
109
|
-
website_value
|
|
110
|
-
}
|
|
111
|
-
gift_card_options {
|
|
112
|
-
title
|
|
113
|
-
required
|
|
114
|
-
uid
|
|
115
|
-
... on CustomizableFieldOption {
|
|
116
|
-
value: value {
|
|
117
|
-
uid
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
`,j=`
|
|
123
|
-
... on BundleProduct {
|
|
124
|
-
items {
|
|
125
|
-
uid
|
|
126
|
-
required
|
|
127
|
-
title
|
|
128
|
-
options {
|
|
129
|
-
uid
|
|
130
|
-
label
|
|
131
|
-
quantity
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
`,x=`
|
|
136
|
-
fragment PRODUCT_FRAGMENT on ProductInterface {
|
|
137
|
-
__typename
|
|
138
|
-
uid
|
|
139
|
-
sku
|
|
140
|
-
name
|
|
141
|
-
thumbnail {
|
|
142
|
-
url
|
|
143
|
-
label
|
|
144
|
-
}
|
|
145
|
-
url_key
|
|
146
|
-
categories {
|
|
147
|
-
url_path
|
|
148
|
-
url_key
|
|
149
|
-
name
|
|
150
|
-
}
|
|
151
|
-
stock_status
|
|
152
|
-
canonical_url
|
|
153
|
-
custom_attributesV2(filters: {is_visible_on_front: true}){
|
|
154
|
-
items {
|
|
155
|
-
code
|
|
156
|
-
...on AttributeValue {
|
|
157
|
-
value
|
|
158
|
-
}
|
|
159
|
-
...on AttributeSelectedOptions {
|
|
160
|
-
selected_options {
|
|
161
|
-
value
|
|
162
|
-
label
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
price_range {
|
|
168
|
-
...PRICE_RANGE_FRAGMENT
|
|
169
|
-
}
|
|
170
|
-
${z}
|
|
171
|
-
${Y}
|
|
172
|
-
${Q}
|
|
173
|
-
${K}
|
|
174
|
-
${j}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
${B}
|
|
178
|
-
`,V=`
|
|
179
|
-
query GET_PRODUCT_BY_SKU($sku: String!) {
|
|
180
|
-
products(filter: { sku: { eq: $sku } }) {
|
|
181
|
-
items {
|
|
182
|
-
...PRODUCT_FRAGMENT
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
${x}
|
|
188
|
-
`,Z=async(e,t)=>{if(!e)throw Error("Product SKU is not set");return T(V,{variables:{sku:e}}).then(({errors:i,data:s})=>{var n;return i?b(i):(n=s==null?void 0:s.products)!=null&&n.items?w(s.products.items[0],t??[]):null})},X=`
|
|
11
|
+
`,U=async()=>I(C,{method:"GET",cache:"force-cache"}).then(({errors:t,data:s})=>t?f(t):N(s)),F=`
|
|
189
12
|
fragment CUSTOMIZABLE_OPTIONS_FRAGMENT on SelectedCustomizableOption {
|
|
190
13
|
type
|
|
191
14
|
customizable_option_uid
|
|
@@ -201,7 +24,7 @@ ${x}
|
|
|
201
24
|
}
|
|
202
25
|
}
|
|
203
26
|
}
|
|
204
|
-
`,
|
|
27
|
+
`,v=`
|
|
205
28
|
... on ConfigurableWishlistItem {
|
|
206
29
|
configurable_options {
|
|
207
30
|
option_label
|
|
@@ -213,7 +36,7 @@ ${x}
|
|
|
213
36
|
canonical_url
|
|
214
37
|
}
|
|
215
38
|
}
|
|
216
|
-
`,
|
|
39
|
+
`,P=`
|
|
217
40
|
... on DownloadableWishlistItem {
|
|
218
41
|
added_at
|
|
219
42
|
description
|
|
@@ -225,7 +48,7 @@ ${x}
|
|
|
225
48
|
}
|
|
226
49
|
quantity
|
|
227
50
|
}
|
|
228
|
-
`,
|
|
51
|
+
`,H=`
|
|
229
52
|
... on GiftCardWishlistItem {
|
|
230
53
|
added_at
|
|
231
54
|
description
|
|
@@ -245,7 +68,7 @@ ${x}
|
|
|
245
68
|
sender_name
|
|
246
69
|
}
|
|
247
70
|
}
|
|
248
|
-
`,
|
|
71
|
+
`,k=`
|
|
249
72
|
... on BundleWishlistItem {
|
|
250
73
|
bundle_options {
|
|
251
74
|
label
|
|
@@ -258,7 +81,7 @@ ${x}
|
|
|
258
81
|
}
|
|
259
82
|
}
|
|
260
83
|
}
|
|
261
|
-
|
|
84
|
+
`,$=`
|
|
262
85
|
fragment WISHLIST_ITEM_FRAGMENT on WishlistItemInterface {
|
|
263
86
|
__typename
|
|
264
87
|
id
|
|
@@ -268,18 +91,18 @@ fragment WISHLIST_ITEM_FRAGMENT on WishlistItemInterface {
|
|
|
268
91
|
product {
|
|
269
92
|
...PRODUCT_FRAGMENT
|
|
270
93
|
}
|
|
271
|
-
${
|
|
272
|
-
${
|
|
273
|
-
${
|
|
274
|
-
${
|
|
94
|
+
${v}
|
|
95
|
+
${P}
|
|
96
|
+
${H}
|
|
97
|
+
${k}
|
|
275
98
|
customizable_options {
|
|
276
99
|
...CUSTOMIZABLE_OPTIONS_FRAGMENT
|
|
277
100
|
}
|
|
278
101
|
}
|
|
279
102
|
|
|
280
|
-
${
|
|
281
|
-
${
|
|
282
|
-
`,
|
|
103
|
+
${A}
|
|
104
|
+
${F}
|
|
105
|
+
`,S=`
|
|
283
106
|
fragment WISHLIST_FRAGMENT on Wishlist {
|
|
284
107
|
id
|
|
285
108
|
updated_at
|
|
@@ -292,8 +115,8 @@ fragment WISHLIST_FRAGMENT on Wishlist {
|
|
|
292
115
|
}
|
|
293
116
|
}
|
|
294
117
|
|
|
295
|
-
${
|
|
296
|
-
`,
|
|
118
|
+
${$}
|
|
119
|
+
`,q=`
|
|
297
120
|
query GET_WISHLISTS_QUERY {
|
|
298
121
|
customer {
|
|
299
122
|
wishlists {
|
|
@@ -302,8 +125,8 @@ ${se}
|
|
|
302
125
|
}
|
|
303
126
|
}
|
|
304
127
|
|
|
305
|
-
${
|
|
306
|
-
`,
|
|
128
|
+
${S}
|
|
129
|
+
`,z=async()=>e.authenticated?I(q).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(),x=`
|
|
307
130
|
mutation ADD_PRODUCTS_TO_WISHLIST_MUTATION(
|
|
308
131
|
$wishlistId: ID!,
|
|
309
132
|
$wishlistItems: [WishlistItemInput!]!,
|
|
@@ -321,5 +144,5 @@ ${se}
|
|
|
321
144
|
}
|
|
322
145
|
}
|
|
323
146
|
}
|
|
324
|
-
${
|
|
325
|
-
`,
|
|
147
|
+
${S}
|
|
148
|
+
`,B=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:M,enteredOptions:b})=>({sku:W,quantity:O,selected_options:M,entered_options:b}))},{errors:u,data:c}=await I(x,{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},Q=()=>(e.wishlistId=null,e.authenticated=!1,Promise.resolve(null)),p=async()=>{if(e.initializing)return null;e.initializing=!0,e.config||(e.config=await U());const t=e.authenticated?await Y():await Z();return r.emit("wishlist/initialized",t),r.emit("wishlist/data",t),e.initializing=!1,t};async function Y(){const t=await z(),s=t?t[0]:null;return s?(e.wishlistId=s.id,s):null}async function Z(){try{return await h()}catch(t){throw console.error(t),t}}const j=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 B(i);return G(),a};export{$ as W,B as a,S as b,X as c,z as d,p as e,Y as f,U as g,Z as h,g as i,j as m,Q as r,w as t};
|
|
@@ -1,6 +1,177 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{events as
|
|
3
|
+
import{events as _}from"@dropins/tools/event-bus.js";import{FetchGraphQL as h}from"@dropins/tools/fetch-graphql.js";function f(e){const s=document.cookie.split(";");for(const t of s)if(t.trim().startsWith(`${e}=`))return t.trim().substring(e.length+1);return null}const p={wishlistId:null,authenticated:!1,isLoading:!0},n=new Proxy(p,{set(e,s,t){if(e[s]=t,s==="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(e,s,t)},get(e,s){return s==="wishlistId"?f("DROPIN__WISHLIST__WISHLIST-ID"):e[s]}});function m(e,s){var o;if(e.product.sku!==s.sku)return!1;const t=((o=e.selectedOptions)==null?void 0:o.map(i=>i.uid).filter(i=>!!i).sort())||[],r=(s.optionUIDs||[]).filter(i=>!!i).sort();return JSON.stringify(t)===JSON.stringify(r)}const c="DROPIN__WISHLIST__WISHLIST__DATA";function W(e){const s=n.authenticated?sessionStorage:localStorage;if(e)try{s.setItem(c,JSON.stringify(e))}catch(t){g(t)?console.error("Storage quota exceeded:",t):console.error("Error saving wishlist:",t)}else s.removeItem(c)}const g=e=>e instanceof DOMException&&e.name==="QuotaExceededError";function S(e=!1){const s=n.authenticated&&!e?sessionStorage:localStorage;try{const t=s.getItem(c);return t?JSON.parse(t):{id:"",items:[]}}catch(t){return console.error("Error retrieving wishlist:",t),{id:"",items:[]}}}function v(){localStorage.removeItem(c)}function C(e,s=[]){var o;const t=n.authenticated?sessionStorage:localStorage,r=t.getItem(c)?JSON.parse(t.getItem(c)):{items:[]};return(o=r==null?void 0:r.items)==null?void 0:o.find(i=>m(i,{sku:e,optionUIDs:s}))}const{setEndpoint:G,setFetchGraphQlHeader:M,removeFetchGraphQlHeader:L,setFetchGraphQlHeaders:U,fetchGraphQl:T,getConfig:y}=new h().getMethods(),R=e=>{const s=e.map(t=>t.message).join(" ");throw Error(s)},E=`
|
|
4
|
+
fragment PRICE_RANGE_FRAGMENT on PriceRange {
|
|
5
|
+
minimum_price {
|
|
6
|
+
regular_price {
|
|
7
|
+
value
|
|
8
|
+
currency
|
|
9
|
+
}
|
|
10
|
+
final_price {
|
|
11
|
+
value
|
|
12
|
+
currency
|
|
13
|
+
}
|
|
14
|
+
discount {
|
|
15
|
+
percent_off
|
|
16
|
+
amount_off
|
|
17
|
+
}
|
|
18
|
+
fixed_product_taxes {
|
|
19
|
+
amount {
|
|
20
|
+
currency
|
|
21
|
+
value
|
|
22
|
+
}
|
|
23
|
+
label
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
maximum_price {
|
|
27
|
+
regular_price {
|
|
28
|
+
value
|
|
29
|
+
currency
|
|
30
|
+
}
|
|
31
|
+
final_price {
|
|
32
|
+
value
|
|
33
|
+
currency
|
|
34
|
+
}
|
|
35
|
+
discount {
|
|
36
|
+
percent_off
|
|
37
|
+
amount_off
|
|
38
|
+
}
|
|
39
|
+
fixed_product_taxes {
|
|
40
|
+
amount {
|
|
41
|
+
currency
|
|
42
|
+
value
|
|
43
|
+
}
|
|
44
|
+
label
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`,D=`
|
|
49
|
+
... on SimpleProduct {
|
|
50
|
+
options {
|
|
51
|
+
uid
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`,O=`
|
|
55
|
+
... on ConfigurableProduct {
|
|
56
|
+
configurable_options {
|
|
57
|
+
uid
|
|
58
|
+
attribute_uid
|
|
59
|
+
attribute_code
|
|
60
|
+
values {
|
|
61
|
+
uid
|
|
62
|
+
label
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
variants {
|
|
66
|
+
attributes {
|
|
67
|
+
code
|
|
68
|
+
uid
|
|
69
|
+
label
|
|
70
|
+
}
|
|
71
|
+
product {
|
|
72
|
+
sku
|
|
73
|
+
stock_status
|
|
74
|
+
image {
|
|
75
|
+
label
|
|
76
|
+
url
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
`,P=`
|
|
82
|
+
... on DownloadableProduct {
|
|
83
|
+
image {
|
|
84
|
+
label
|
|
85
|
+
url
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
`,w=`
|
|
89
|
+
... on GiftCardProduct {
|
|
90
|
+
giftcard_type
|
|
91
|
+
giftcard_amounts {
|
|
92
|
+
uid
|
|
93
|
+
website_id
|
|
94
|
+
value
|
|
95
|
+
attribute_id
|
|
96
|
+
website_value
|
|
97
|
+
}
|
|
98
|
+
gift_card_options {
|
|
99
|
+
title
|
|
100
|
+
required
|
|
101
|
+
uid
|
|
102
|
+
... on CustomizableFieldOption {
|
|
103
|
+
value: value {
|
|
104
|
+
uid
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
`,b=`
|
|
110
|
+
... on BundleProduct {
|
|
111
|
+
items {
|
|
112
|
+
uid
|
|
113
|
+
required
|
|
114
|
+
title
|
|
115
|
+
options {
|
|
116
|
+
uid
|
|
117
|
+
label
|
|
118
|
+
quantity
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
`,$=`
|
|
123
|
+
fragment PRODUCT_FRAGMENT on ProductInterface {
|
|
124
|
+
__typename
|
|
125
|
+
uid
|
|
126
|
+
sku
|
|
127
|
+
name
|
|
128
|
+
description {
|
|
129
|
+
html
|
|
130
|
+
}
|
|
131
|
+
meta_description
|
|
132
|
+
meta_keyword
|
|
133
|
+
meta_title
|
|
134
|
+
short_description {
|
|
135
|
+
html
|
|
136
|
+
}
|
|
137
|
+
thumbnail {
|
|
138
|
+
url
|
|
139
|
+
label
|
|
140
|
+
}
|
|
141
|
+
url_key
|
|
142
|
+
categories {
|
|
143
|
+
url_path
|
|
144
|
+
url_key
|
|
145
|
+
name
|
|
146
|
+
}
|
|
147
|
+
stock_status
|
|
148
|
+
canonical_url
|
|
149
|
+
custom_attributesV2(filters: {is_visible_on_front: true}){
|
|
150
|
+
items {
|
|
151
|
+
code
|
|
152
|
+
...on AttributeValue {
|
|
153
|
+
value
|
|
154
|
+
}
|
|
155
|
+
...on AttributeSelectedOptions {
|
|
156
|
+
selected_options {
|
|
157
|
+
value
|
|
158
|
+
label
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
price_range {
|
|
164
|
+
...PRICE_RANGE_FRAGMENT
|
|
165
|
+
}
|
|
166
|
+
${D}
|
|
167
|
+
${O}
|
|
168
|
+
${P}
|
|
169
|
+
${w}
|
|
170
|
+
${b}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
${E}
|
|
174
|
+
`,N=`
|
|
4
175
|
mutation REMOVE_PRODUCTS_FROM_WISHLIST_MUTATION(
|
|
5
176
|
$wishlistId: ID!,
|
|
6
177
|
$wishlistItemsIds: [ID!]!,
|
|
@@ -15,4 +186,4 @@ import{events as d}from"@dropins/tools/event-bus.js";import{FetchGraphQL as S}fr
|
|
|
15
186
|
}
|
|
16
187
|
}
|
|
17
188
|
}
|
|
18
|
-
|
|
189
|
+
`,k=async e=>{var r,o,i;const s=S(),t={...s,items:(r=s.items)==null?void 0:r.filter(d=>!e.some(u=>{var a;return m(d,{sku:u.product.sku,optionUIDs:(a=u.selectedOptions)==null?void 0:a.map(l=>l.uid)})}))};if(n.authenticated){if(!n.wishlistId)throw Error("Wishlist ID is not set");const d=e.map(I=>I.id),{errors:u,data:a}=await T(N,{variables:{wishlistId:n.wishlistId,wishlistItemsIds:d}}),l=[...((o=a==null?void 0:a.removeProductsFromWishlist)==null?void 0:o.user_errors)??[],...u??[]];if(l.length>0)return _.emit("wishlist/data",s),R(l)}return t.items_count=(i=t.items)==null?void 0:i.length,_.emit("wishlist/data",t),null};export{$ as P,G as a,M as b,L as c,U as d,y as e,T as f,S as g,R as h,m as i,W as j,v as k,C as l,k as r,n as s};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FunctionComponent, JSX } from 'preact';
|
|
2
1
|
import { HTMLAttributes } from 'preact/compat';
|
|
2
|
+
import { FunctionComponent, JSX } from 'preact';
|
|
3
3
|
import { ImageNodeRenderProps } from '../../../@adobe-commerce/elsie/src/components';
|
|
4
4
|
import { Item, Product } from '../../data/models';
|
|
5
5
|
|
|
@@ -8,11 +8,6 @@ export interface ProductItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
8
8
|
item?: Item;
|
|
9
9
|
onCartActionButtonClick?: () => boolean;
|
|
10
10
|
onTrashButtonClick?: () => boolean;
|
|
11
|
-
fixedProductTaxesEnabled: boolean;
|
|
12
|
-
fixedProductTaxesApply: boolean;
|
|
13
|
-
fixedProductTaxesEnabledDisplayInProductLists?: string;
|
|
14
|
-
fixedProductTaxesEnabledDisplayInSalesModules?: string;
|
|
15
|
-
fixedProductTaxesEnabledDisplayInProductView?: string;
|
|
16
11
|
routeProdDetailPage: (product: Product) => string;
|
|
17
12
|
imageNode?: (props: {
|
|
18
13
|
defaultImageProps: ImageNodeRenderProps;
|
package/components/index.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export interface WishlistProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
11
11
|
quantity: number;
|
|
12
12
|
}[]) => Promise<any>;
|
|
13
13
|
routeProdDetailPage: (product: Product) => string;
|
|
14
|
+
getProductData?: (sku: string) => Promise<Product | null>;
|
|
15
|
+
getRefinedProduct?: (sku: string, optionUIDs: string[], anchorOptions?: string[], raw?: boolean) => Promise<Product | null>;
|
|
14
16
|
slots?: {
|
|
15
17
|
image?: SlotProps<{
|
|
16
18
|
defaultImageProps: ImageProps;
|
package/containers/Wishlist.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as i,jsxs as
|
|
3
|
+
import{jsx as i,jsxs as d,Fragment as F}from"@dropins/tools/preact-jsx-runtime.js";import{useState as f,useCallback as z,useEffect as B,useMemo as E,Fragment as A}from"@dropins/tools/preact-compat.js";import{classes as L,Slot as V,VComponent as Y}from"@dropins/tools/lib.js";import{IllustratedMessage as q,Button as G,Icon as J,SkeletonRow as K,Skeleton as O}from"@dropins/tools/components.js";import{W as Q}from"../chunks/WishlistItem.js";import{events as H}from"@dropins/tools/event-bus.js";import{s as $}from"../chunks/removeProductsFromWishlist.js";import{useText as R,Text as j}from"@dropins/tools/i18n.js";import{W as U}from"../chunks/WishlistAlert.js";import{S as X}from"../chunks/Heart.js";import"../chunks/Trash.js";import"../chunks/getProductBySku.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/HeartFilled.js";const Z=({className:l,children:t,ctaLinkURL:e,...m})=>{const r=R({emptyWishlist:"Wishlist.EmptyWishlist.heading",message:"Wishlist.EmptyWishlist.message",cta:"Wishlist.EmptyWishlist.cta"});return i("div",{...m,className:L(["wishlist-empty-wishlist",l]),children:i(q,{className:L(["wishlist-empty-wishlist__wrapper",l]),"data-testid":"wishlist-empty-wishlist",heading:r.emptyWishlist,icon:i(J,{className:"wishlist-empty-wishlist__icon",source:X}),message:i("p",{children:r.message}),action:e?i(G,{"data-testid":"wishlist-empty-wishlist-button",size:"medium",variant:"primary",type:"submit",href:e,children:r.cta},"routeHome"):void 0})})},b=()=>i(K,{children:`
|
|
4
4
|
<svg
|
|
5
5
|
width="100%"
|
|
6
6
|
height="100%"
|
|
@@ -14,4 +14,4 @@ import{jsx as i,jsxs as a,Fragment as b}from"@dropins/tools/preact-jsx-runtime.j
|
|
|
14
14
|
<rect x="6" y="556" width="132" height="22" rx="4" fill="#E8E8E8" />
|
|
15
15
|
<rect x="6" y="592" width="280" height="48" rx="24" fill="#D9D9D9" />
|
|
16
16
|
</svg>
|
|
17
|
-
`}),
|
|
17
|
+
`}),C=()=>d(O,{"data-testid":"wishlist-loader",children:[i(b,{}),i(b,{}),i(b,{})]}),gi=({routeEmptyWishlistCTA:l,routeToWishlist:t,moveProdToCart:e,routeProdDetailPage:m,getProductData:r,getRefinedProduct:_,slots:W,...I})=>{const[g,S]=f(null),[x,a]=f($.authenticated),[k,p]=f($.isLoading),y=n=>a(n),[w,c]=f(null),v=z(n=>{const{action:h,item:o}=n;c(i(U,{action:h,item:o,routeToWishlist:t}))},[t]);return B(()=>{const n=H.on("authenticated",y),h=H.on("wishlist/alert",s=>v(s)),o=H.on("wishlist/data",s=>{S(s),p(!1)},{eager:!0});return()=>{n==null||n.off(),o==null||o.off(),h==null||h.off()}},[v]),i(T,{...I,wishlistData:g,wishlistAlert:w,routeEmptyWishlistCTA:l,moveProdToCart:e,getProductData:r,getRefinedProduct:_,isLoggedIn:x,isLoading:k,routeProdDetailPage:m,slots:W})},T=({className:l,wishlistData:t,wishlistAlert:e,isLoggedIn:m,isLoading:r,moveProdToCart:_,getProductData:W,getRefinedProduct:I,routeEmptyWishlistCTA:g,onLoginClick:S,routeProdDetailPage:x,slots:a,...k})=>{const[p,y]=f(e),w=R({wishlistHeading:"Wishlist.Wishlist.heading",wishlistLoadingHeading:"Wishlist.Wishlist.loading"}),c=E(()=>{var s;return((s=t==null?void 0:t.items)==null?void 0:s.length)>0?t.items.map(u=>i(Q,{item:u,getProductData:W,getRefinedProduct:I,moveProdToCart:_,routeProdDetailPage:x,imageNode:a!=null&&a.image?({defaultImageProps:N})=>i(V,{name:"image",slot:a.image,context:{defaultImageProps:N,item:u}}):void 0},u.id)):null},[t,_,W,x]);B(()=>{if(e){y(e);const s=setTimeout(()=>{y(null)},5e3);return()=>clearTimeout(s)}},[e]);const v=E(()=>p?i(Y,{node:p,className:"wishlist-wishlist__alert"}):null,[p]),n=()=>d(F,{children:[i("div",{className:"wishlist-wishlist__heading","data-testid":"wishlist-heading-wrapper",children:i("h1",{className:"wishlist-wishlist__heading-text","data-testid":"loader-wishlist-heading",children:w.wishlistLoadingHeading})}),i(C,{})]}),h=()=>c?d(F,{children:[o,i("div",{className:"wishlist-wishlist__content",children:c})]}):i("div",{className:L(["wishlist-wishlist__content","wishlist-wishlist__content--empty"]),children:d("div",{children:[i(Z,{"data-testid":"empty-wishlist",ctaLinkURL:g==null?void 0:g()}),!m&&i(P,{onLoginClick:S})]})}),o=E(()=>{var s;return c?i("div",{className:"wishlist-wishlist__heading","data-testid":"wishlist-heading-wrapper",children:i("h1",{className:"wishlist-wishlist__heading-text","data-testid":"default-wishlist-heading",children:(s=w.wishlistHeading)==null?void 0:s.split(" {count}").map((u,N)=>{var M;return d(A,{children:[u,N===0&&i("span",{className:"wishlist-wishlist__heading-count","data-testid":"wishlist-heading-count",children:`${t==null?void 0:t.items_count} products`})]},((M=t==null?void 0:t.id)==null?void 0:M.toString())+N)})})}):null},[w,c,t]);return d("div",{...k,className:L(["wishlist-wishlist",l]),children:[v,r?n():h()]})},P=({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(j,{id:"Wishlist.Login.logIn"})}),i(j,{id:"Wishlist.Login.sync"})]});export{gi as Wishlist,gi as default};
|
|
@@ -5,7 +5,9 @@ import { ImageNodeRenderProps } from '../../../@adobe-commerce/elsie/src/compone
|
|
|
5
5
|
import { JSX } from 'preact';
|
|
6
6
|
|
|
7
7
|
export interface WishlistItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
-
|
|
8
|
+
item: Item;
|
|
9
|
+
getProductData?: (sku: string) => Promise<Product | null>;
|
|
10
|
+
getRefinedProduct?: (sku: string, optionUIDs: string[], anchorOptions?: string[], raw?: boolean) => Promise<Product | null>;
|
|
9
11
|
moveProdToCart: (products: {
|
|
10
12
|
sku: string;
|
|
11
13
|
quantity: number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{W as
|
|
3
|
+
import{W as d,W as h}from"../chunks/WishlistItem.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"../chunks/removeProductsFromWishlist.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/Trash.js";import"@dropins/tools/i18n.js";import"../chunks/getProductBySku.js";export{d as WishlistItem,h as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as
|
|
3
|
+
import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{useState as h,useCallback as E,useEffect as v}from"@dropins/tools/preact-compat.js";import{Button as F,Icon as I}from"@dropins/tools/components.js";import{events as a}from"@dropins/tools/event-bus.js";import{s as P,g as j,i as x,r as A}from"../chunks/removeProductsFromWishlist.js";import{c as M,a as R}from"../chunks/mergeWishlists.js";import{S as q}from"../chunks/HeartFilled.js";import{S as H}from"../chunks/Heart.js";import{useText as N}from"@dropins/tools/i18n.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const $=({product:i,iconWishlisted:W,iconToWishlist:g,size:d,variant:D,disabled:u,labelToWishlist:U,labelWishlisted:k,onClick:w,removeProdFromCart:f})=>{const[O,b]=h(P.authenticated),[n,o]=h(!1),[L,S]=h(null),{isGuestWishlistEnabled:T}=M.getConfig(),c=N({addToWishlist:"Wishlist.Wishlist.ariaLabelAddToWishlist",removeFromWishlist:"Wishlist.Wishlist.ariaLabelRemoveFromWishlist"}),l=E(()=>{var t;const e=j(),s=(t=e==null?void 0:e.items)==null?void 0:t.find(m=>x(m,{sku:i.topLevelSku??i.sku,optionUIDs:i.optionUIDs??(i.selectedOptionsUIDs?Object.values(i.selectedOptionsUIDs):void 0)}));S(s??null),o(!!s)},[i.topLevelSku,i.sku,i.optionUIDs,i.selectedOptionsUIDs]);v(()=>{l()},[l]),v(()=>{const e=m=>b(m),s=a.on("authenticated",e),t=a.on("wishlist/data",l);return()=>{s==null||s.off(),t==null||t.off()}},[l]);const y=async()=>{var e;if(n){try{await A([L])}catch{return a.emit("wishlist/alert",{action:"removeError",item:{product:i}}),null}o(!1),a.emit("wishlist/alert",{action:"remove",item:{product:i}})}else{try{await R([{sku:i.topLevelSku??i.sku,quantity:1,optionsUIDs:i.optionUIDs??(i.selectedOptionsUIDs?Object.values(i.selectedOptionsUIDs):void 0),enteredOptions:(e=i.options)!=null&&e.items?i.options.items.filter(s=>s.selected).map(s=>({uid:s.uid,value:s.value})):void 0}])}catch{return a.emit("wishlist/alert",{action:"addError",item:{product:i}}),null}o(!0),a.emit("wishlist/alert",{action:"add",item:{product:i}}),f&&await f([{uid:i.uid,quantity:0}])}};if(!O&&!T)return null;const C=n?c.removeFromWishlist.replace("{PRODUCT_NAME}",i==null?void 0:i.name):c.addToWishlist.replace("{PRODUCT_NAME}",i==null?void 0:i.name);return r(F,{active:n,"aria-label":C,"data-testid":"wishlist-toggle",size:d??"medium",variant:D??"tertiary",disabled:u,icon:r(I,{source:g??H}),activeIcon:r(I,{source:W??q}),onClick:w??y,children:U,activeChildren:k})};export{$ as WishlistToggle,$ as default};
|
package/data/models/product.d.ts
CHANGED
|
@@ -14,60 +14,77 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
+
/**
|
|
18
|
+
* Product data model is based on PDP. For further details see:
|
|
19
|
+
*
|
|
20
|
+
* https://github.com/adobe-commerce/storefront-pdp/blob/develop/src/data/models/product-model.ts
|
|
21
|
+
* https://github.com/adobe-commerce/storefront-pdp/blob/develop/src/data/models/acdl-models.ts
|
|
22
|
+
*/
|
|
17
23
|
export interface Product {
|
|
18
|
-
type: string;
|
|
19
24
|
name: string;
|
|
20
25
|
sku: string;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
isBundle: boolean;
|
|
27
|
+
addToCartAllowed: boolean;
|
|
28
|
+
inStock: boolean | null;
|
|
29
|
+
shortDescription?: string;
|
|
30
|
+
metaDescription?: string;
|
|
31
|
+
metaKeyword?: string;
|
|
32
|
+
metaTitle?: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
images?: Image[];
|
|
35
|
+
prices: Prices;
|
|
36
|
+
attributes?: Attribute[];
|
|
37
|
+
options?: Option[];
|
|
38
|
+
optionUIDs?: string[];
|
|
39
|
+
url?: string;
|
|
40
|
+
urlKey?: string;
|
|
41
|
+
externalId?: string;
|
|
42
|
+
externalParentId?: string;
|
|
43
|
+
variantSku?: string;
|
|
44
|
+
productType?: ProductType | undefined;
|
|
31
45
|
}
|
|
32
|
-
export interface
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
percentOff: number;
|
|
38
|
-
};
|
|
39
|
-
fixedProductTaxes: FixedProductTaxesProps[];
|
|
46
|
+
export interface Image {
|
|
47
|
+
url: string;
|
|
48
|
+
label: string;
|
|
49
|
+
width?: number;
|
|
50
|
+
height?: number;
|
|
40
51
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
currency
|
|
52
|
+
interface Price {
|
|
53
|
+
amount?: number;
|
|
54
|
+
currency?: string;
|
|
55
|
+
maximumAmount?: number;
|
|
56
|
+
minimumAmount?: number;
|
|
57
|
+
variant?: 'default' | 'strikethrough';
|
|
44
58
|
}
|
|
45
|
-
interface
|
|
46
|
-
|
|
47
|
-
|
|
59
|
+
export interface Prices {
|
|
60
|
+
regular: Price;
|
|
61
|
+
final: Price;
|
|
62
|
+
visible: boolean;
|
|
48
63
|
}
|
|
49
|
-
interface
|
|
50
|
-
|
|
51
|
-
|
|
64
|
+
export interface Option {
|
|
65
|
+
id: string;
|
|
66
|
+
type: 'text' | 'image' | 'color' | 'dropdown';
|
|
67
|
+
typename: 'ProductViewOptionValueProduct' | 'ProductViewOptionValueSwatch' | 'ProductViewOptionValueConfiguration';
|
|
68
|
+
label: string;
|
|
69
|
+
required: boolean;
|
|
70
|
+
multiple: boolean;
|
|
71
|
+
items: OptionValue[];
|
|
52
72
|
}
|
|
53
|
-
interface
|
|
54
|
-
|
|
73
|
+
interface OptionValue {
|
|
74
|
+
id: string;
|
|
55
75
|
label: string;
|
|
76
|
+
inStock: boolean;
|
|
77
|
+
value: string;
|
|
78
|
+
selected: boolean;
|
|
79
|
+
product?: any;
|
|
56
80
|
}
|
|
57
81
|
interface Attribute {
|
|
58
|
-
|
|
59
|
-
value
|
|
60
|
-
selected_options?: AttributeOption[];
|
|
82
|
+
label: string;
|
|
83
|
+
value: string;
|
|
61
84
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
attributeUid?: string;
|
|
66
|
-
required: boolean;
|
|
67
|
-
values: [{
|
|
68
|
-
uid: string;
|
|
69
|
-
label: string;
|
|
70
|
-
}];
|
|
85
|
+
export declare enum ProductType {
|
|
86
|
+
ComplexProduct = "complex",
|
|
87
|
+
SimpleProduct = "simple"
|
|
71
88
|
}
|
|
72
89
|
export {};
|
|
73
90
|
//# sourceMappingURL=product.d.ts.map
|
|
@@ -18,10 +18,5 @@ export interface StoreConfigModel {
|
|
|
18
18
|
wishlistIsEnabled: boolean;
|
|
19
19
|
wishlistMaxNumber: number;
|
|
20
20
|
wishlistMultipleListIsEnabled: boolean;
|
|
21
|
-
fixedProductTaxesEnabled: boolean;
|
|
22
|
-
fixedProductTaxesApply: boolean;
|
|
23
|
-
fixedProductTaxesEnabledDisplayInProductLists: string;
|
|
24
|
-
fixedProductTaxesEnabledDisplayInSalesModules: string;
|
|
25
|
-
fixedProductTaxesEnabledDisplayInProductView: string;
|
|
26
21
|
}
|
|
27
22
|
//# sourceMappingURL=store-config.d.ts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SelectedCustomizableOption } from './selected-customizable-option';
|
|
2
|
-
import { Product } from './product';
|
|
3
2
|
|
|
4
3
|
export interface Wishlist {
|
|
5
4
|
id: string;
|
|
@@ -13,17 +12,16 @@ export interface Item {
|
|
|
13
12
|
quantity: number;
|
|
14
13
|
description: string;
|
|
15
14
|
added_at: string;
|
|
16
|
-
selectedOptions:
|
|
15
|
+
selectedOptions: {
|
|
16
|
+
uid: string;
|
|
17
|
+
}[];
|
|
17
18
|
enteredOptions?: {
|
|
18
19
|
uid: string;
|
|
19
20
|
value: string;
|
|
20
21
|
}[];
|
|
21
|
-
product:
|
|
22
|
+
product: {
|
|
23
|
+
sku: string;
|
|
24
|
+
};
|
|
22
25
|
customizableOptions: SelectedCustomizableOption[];
|
|
23
26
|
}
|
|
24
|
-
export interface ConfigurableOption {
|
|
25
|
-
uid: string;
|
|
26
|
-
label: string;
|
|
27
|
-
value: string;
|
|
28
|
-
}
|
|
29
27
|
//# sourceMappingURL=wishlist.d.ts.map
|
|
@@ -1,7 +1,222 @@
|
|
|
1
1
|
import { Product } from '../../models/product';
|
|
2
2
|
|
|
3
|
-
declare const
|
|
4
|
-
declare const productOutOfStock: Product;
|
|
3
|
+
declare const simpleProduct: Product;
|
|
5
4
|
declare const configurableProduct: Product;
|
|
6
|
-
|
|
5
|
+
declare const configuredProduct: Product;
|
|
6
|
+
declare const simpleProductDataCS: {
|
|
7
|
+
name: string;
|
|
8
|
+
sku: string;
|
|
9
|
+
isBundle: boolean;
|
|
10
|
+
addToCartAllowed: boolean;
|
|
11
|
+
inStock: boolean;
|
|
12
|
+
shortDescription: string;
|
|
13
|
+
metaDescription: string;
|
|
14
|
+
metaKeyword: string;
|
|
15
|
+
metaTitle: string;
|
|
16
|
+
description: string;
|
|
17
|
+
images: {
|
|
18
|
+
url: string;
|
|
19
|
+
label: string;
|
|
20
|
+
roles: string[];
|
|
21
|
+
}[];
|
|
22
|
+
prices: {
|
|
23
|
+
regular: {
|
|
24
|
+
amount: number;
|
|
25
|
+
currency: string;
|
|
26
|
+
variant: string;
|
|
27
|
+
};
|
|
28
|
+
final: {
|
|
29
|
+
amount: number;
|
|
30
|
+
currency: string;
|
|
31
|
+
variant: string;
|
|
32
|
+
};
|
|
33
|
+
visible: boolean;
|
|
34
|
+
};
|
|
35
|
+
attributes: {
|
|
36
|
+
id: string;
|
|
37
|
+
label: string;
|
|
38
|
+
value: string;
|
|
39
|
+
}[];
|
|
40
|
+
url: string;
|
|
41
|
+
urlKey: string;
|
|
42
|
+
externalId: string;
|
|
43
|
+
productType: string;
|
|
44
|
+
};
|
|
45
|
+
declare const configurableProductDataCS: {
|
|
46
|
+
name: string;
|
|
47
|
+
sku: string;
|
|
48
|
+
isBundle: boolean;
|
|
49
|
+
addToCartAllowed: boolean;
|
|
50
|
+
inStock: boolean;
|
|
51
|
+
shortDescription: string;
|
|
52
|
+
metaDescription: string;
|
|
53
|
+
metaKeyword: string;
|
|
54
|
+
metaTitle: string;
|
|
55
|
+
description: string;
|
|
56
|
+
images: {
|
|
57
|
+
url: string;
|
|
58
|
+
label: string;
|
|
59
|
+
roles: string[];
|
|
60
|
+
}[];
|
|
61
|
+
prices: {
|
|
62
|
+
final: {
|
|
63
|
+
minimumAmount: number;
|
|
64
|
+
maximumAmount: number;
|
|
65
|
+
currency: string;
|
|
66
|
+
};
|
|
67
|
+
visible: boolean;
|
|
68
|
+
};
|
|
69
|
+
attributes: {
|
|
70
|
+
id: string;
|
|
71
|
+
label: string;
|
|
72
|
+
value: string;
|
|
73
|
+
}[];
|
|
74
|
+
options: {
|
|
75
|
+
id: string;
|
|
76
|
+
type: string;
|
|
77
|
+
typename: string;
|
|
78
|
+
label: string;
|
|
79
|
+
required: boolean;
|
|
80
|
+
multiple: null;
|
|
81
|
+
items: {
|
|
82
|
+
id: string;
|
|
83
|
+
inStock: boolean;
|
|
84
|
+
label: string;
|
|
85
|
+
selected: boolean;
|
|
86
|
+
value: string;
|
|
87
|
+
}[];
|
|
88
|
+
}[];
|
|
89
|
+
url: string;
|
|
90
|
+
urlKey: string;
|
|
91
|
+
externalId: string;
|
|
92
|
+
productType: string;
|
|
93
|
+
};
|
|
94
|
+
declare const configuredProductDataCS: {
|
|
95
|
+
name: string;
|
|
96
|
+
sku: string;
|
|
97
|
+
isBundle: boolean;
|
|
98
|
+
addToCartAllowed: boolean;
|
|
99
|
+
inStock: boolean;
|
|
100
|
+
shortDescription: string;
|
|
101
|
+
metaDescription: string;
|
|
102
|
+
metaKeyword: string;
|
|
103
|
+
metaTitle: string;
|
|
104
|
+
description: string;
|
|
105
|
+
images: {
|
|
106
|
+
url: string;
|
|
107
|
+
label: string;
|
|
108
|
+
roles: string[];
|
|
109
|
+
}[];
|
|
110
|
+
prices: {
|
|
111
|
+
regular: {
|
|
112
|
+
amount: number;
|
|
113
|
+
currency: string;
|
|
114
|
+
variant: string;
|
|
115
|
+
};
|
|
116
|
+
final: {
|
|
117
|
+
amount: number;
|
|
118
|
+
currency: string;
|
|
119
|
+
variant: string;
|
|
120
|
+
};
|
|
121
|
+
visible: boolean;
|
|
122
|
+
};
|
|
123
|
+
attributes: {
|
|
124
|
+
id: string;
|
|
125
|
+
label: string;
|
|
126
|
+
value: string;
|
|
127
|
+
}[];
|
|
128
|
+
options: {
|
|
129
|
+
id: string;
|
|
130
|
+
type: string;
|
|
131
|
+
typename: string;
|
|
132
|
+
label: string;
|
|
133
|
+
required: boolean;
|
|
134
|
+
multiple: null;
|
|
135
|
+
items: {
|
|
136
|
+
id: string;
|
|
137
|
+
inStock: boolean;
|
|
138
|
+
label: string;
|
|
139
|
+
selected: boolean;
|
|
140
|
+
value: string;
|
|
141
|
+
}[];
|
|
142
|
+
}[];
|
|
143
|
+
optionUIDs: string[];
|
|
144
|
+
url: string;
|
|
145
|
+
urlKey: string;
|
|
146
|
+
externalId: string;
|
|
147
|
+
variantSku: string;
|
|
148
|
+
productType: string;
|
|
149
|
+
};
|
|
150
|
+
declare const simpleProductDataAC: {
|
|
151
|
+
__typename: string;
|
|
152
|
+
uid: string;
|
|
153
|
+
sku: string;
|
|
154
|
+
name: string;
|
|
155
|
+
description: {
|
|
156
|
+
html: string;
|
|
157
|
+
};
|
|
158
|
+
meta_description: null;
|
|
159
|
+
meta_keyword: null;
|
|
160
|
+
meta_title: null;
|
|
161
|
+
short_description: {
|
|
162
|
+
html: string;
|
|
163
|
+
};
|
|
164
|
+
thumbnail: {
|
|
165
|
+
url: string;
|
|
166
|
+
label: string;
|
|
167
|
+
};
|
|
168
|
+
url_key: string;
|
|
169
|
+
categories: {
|
|
170
|
+
url_path: string;
|
|
171
|
+
url_key: string;
|
|
172
|
+
name: string;
|
|
173
|
+
}[];
|
|
174
|
+
stock_status: string;
|
|
175
|
+
canonical_url: null;
|
|
176
|
+
custom_attributesV2: {
|
|
177
|
+
items: {
|
|
178
|
+
code: string;
|
|
179
|
+
selected_options: {
|
|
180
|
+
value: string;
|
|
181
|
+
label: string;
|
|
182
|
+
}[];
|
|
183
|
+
}[];
|
|
184
|
+
};
|
|
185
|
+
price_range: {
|
|
186
|
+
minimum_price: {
|
|
187
|
+
regular_price: {
|
|
188
|
+
value: number;
|
|
189
|
+
currency: string;
|
|
190
|
+
};
|
|
191
|
+
final_price: {
|
|
192
|
+
value: number;
|
|
193
|
+
currency: string;
|
|
194
|
+
};
|
|
195
|
+
discount: {
|
|
196
|
+
percent_off: number;
|
|
197
|
+
amount_off: number;
|
|
198
|
+
};
|
|
199
|
+
fixed_product_taxes: never[];
|
|
200
|
+
};
|
|
201
|
+
maximum_price: {
|
|
202
|
+
regular_price: {
|
|
203
|
+
value: number;
|
|
204
|
+
currency: string;
|
|
205
|
+
};
|
|
206
|
+
final_price: {
|
|
207
|
+
value: number;
|
|
208
|
+
currency: string;
|
|
209
|
+
};
|
|
210
|
+
discount: {
|
|
211
|
+
percent_off: number;
|
|
212
|
+
amount_off: number;
|
|
213
|
+
};
|
|
214
|
+
fixed_product_taxes: never[];
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
options: null;
|
|
218
|
+
};
|
|
219
|
+
declare const configurableProductDataAC: Product;
|
|
220
|
+
declare const configuredProductDataAC: {};
|
|
221
|
+
export { simpleProduct, configurableProduct, configuredProduct, simpleProductDataAC, simpleProductDataCS, configurableProductDataAC, configurableProductDataCS, configuredProductDataCS, configuredProductDataAC, };
|
|
7
222
|
//# sourceMappingURL=productData.d.ts.map
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Wishlist } from '../../models/wishlist';
|
|
2
2
|
|
|
3
3
|
export declare const wishlist: Wishlist;
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const wishlistWithProductWithoutDiscount: Wishlist;
|
|
7
|
-
export declare const wishlistWithProductWithoutTaxes: Wishlist;
|
|
4
|
+
export declare const wishlistWithConfigurableProduct: Wishlist;
|
|
5
|
+
export declare const wishlistWithConfiguredProduct: Wishlist;
|
|
8
6
|
//# sourceMappingURL=wishlistData.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Product,
|
|
1
|
+
import { Product, Option } from '../models';
|
|
2
2
|
|
|
3
|
-
export declare function transformProduct(data: any, selectedOptions?:
|
|
3
|
+
export declare function transformProduct(data: any, selectedOptions?: Option[]): Product | null;
|
|
4
4
|
//# sourceMappingURL=transform-product.d.ts.map
|
package/lib/persisted-data.d.ts
CHANGED
|
@@ -3,8 +3,5 @@ import { Wishlist } from '../data/models';
|
|
|
3
3
|
export declare function setPersistedWishlistData(data: Wishlist | null): void;
|
|
4
4
|
export declare function getPersistedWishlistData(guest?: boolean): Wishlist | {};
|
|
5
5
|
export declare function clearPersistedLocalStorage(): void;
|
|
6
|
-
export declare function getWishlistItemFromStorage(productSku: string, optionUIDs?: string[]
|
|
7
|
-
uid: string;
|
|
8
|
-
value: string;
|
|
9
|
-
}[]): any;
|
|
6
|
+
export declare function getWishlistItemFromStorage(productSku: string, optionUIDs?: string[]): any;
|
|
10
7
|
//# sourceMappingURL=persisted-data.d.ts.map
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@dropins/storefront-wishlist", "version": "
|
|
1
|
+
{"name": "@dropins/storefront-wishlist", "version": "2.0.0-alpha1", "@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,e){try{if(typeof document<"u"){const t=document.createElement("style"),n=e.styleId;for(const i in e.attributes)t.setAttribute(i,e.attributes[i]);t.setAttribute("data-dropin",n),t.appendChild(document.createTextNode(r));const a=document.querySelector('style[data-dropin="sdk"]');if(a)a.after(t);else{const i=document.querySelector('link[rel="stylesheet"], style');i?i.before(t):document.head.append(t)}}}catch(t){console.error("dropin-styles (injectCodeFunction)",t)}})(".wishlist-empty-wishlist{container-type:inline-size;container-name:wishlist}.wishlist-empty-wishlist__wrapper .dropin-card--secondary{display:grid;grid-auto-rows:min-content;justify-content:center;text-align:center;border:unset}.wishlist-empty-wishlist .dropin-illustrated-message__heading{font:var(--type-headline-1-font)}.wishlist-empty-wishlist .dropin-illustrated-message__message{font:var(--type-body-1-default-font)}@container wishlist (width < 737px){.wishlist-empty-wishlist__wrapper .dropin-card{border:unset;border-style:hidden}}.wishlist-wishlist{container-type:inline-size;container-name:wishlist-grid;max-width:inherit}.wishlist-wishlist__content{display:grid;gap:var(--spacing-medium);margin:auto;padding:var(--spacing-medium) 0}.wishlist-wishlist__heading{color:var(--color-neutral-800);display:grid;font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);padding:var(--spacing-small) 0;row-gap:var(--spacing-xsmall)}.wishlist-wishlist__heading-text{font-size:inherit;font-weight:inherit;margin:0;line-height:inherit}.wishlist-wishlist__heading-count{color:#6d6d6d;margin-left:var(--spacing-xxsmall);letter-spacing:normal;font:var(--type-details-caption-2-font)}.wishlist-wishlist__content.wishlist-wishlist__content--empty{border:var(--shape-border-width-2) solid var(--color-neutral-400);border-radius:var(--shape-border-radius-2);grid-template-columns:repeat(1,1fr);padding:var(--spacing-xxbig);margin:var(--spacing-xxbig) auto}@media only screen and (max-width: 480px){.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-options{font:var(--type-body-2-default-font)}.wishlist-product-item__content .wishlist-product-item-option__attribute{text-transform:capitalize}.wishlist-product-item__content .wishlist-product-item-option__label{font:var(--type-body-2-strong-font)}.wishlist-product-item__content .wishlist-product-item-price{display:inline;font:var(--type-body-2-default-font)}.
|
|
3
|
+
(function(r,e){try{if(typeof document<"u"){const t=document.createElement("style"),n=e.styleId;for(const i in e.attributes)t.setAttribute(i,e.attributes[i]);t.setAttribute("data-dropin",n),t.appendChild(document.createTextNode(r));const a=document.querySelector('style[data-dropin="sdk"]');if(a)a.after(t);else{const i=document.querySelector('link[rel="stylesheet"], style');i?i.before(t):document.head.append(t)}}}catch(t){console.error("dropin-styles (injectCodeFunction)",t)}})(".wishlist-empty-wishlist{container-type:inline-size;container-name:wishlist}.wishlist-empty-wishlist__wrapper .dropin-card--secondary{display:grid;grid-auto-rows:min-content;justify-content:center;text-align:center;border:unset}.wishlist-empty-wishlist .dropin-illustrated-message__heading{font:var(--type-headline-1-font)}.wishlist-empty-wishlist .dropin-illustrated-message__message{font:var(--type-body-1-default-font)}@container wishlist (width < 737px){.wishlist-empty-wishlist__wrapper .dropin-card{border:unset;border-style:hidden}}.wishlist-wishlist{container-type:inline-size;container-name:wishlist-grid;max-width:inherit}.wishlist-wishlist__content{display:grid;gap:var(--spacing-medium);margin:auto;padding:var(--spacing-medium) 0}.wishlist-wishlist__heading{color:var(--color-neutral-800);display:grid;font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);padding:var(--spacing-small) 0;row-gap:var(--spacing-xsmall)}.wishlist-wishlist__heading-text{font-size:inherit;font-weight:inherit;margin:0;line-height:inherit}.wishlist-wishlist__heading-count{color:#6d6d6d;margin-left:var(--spacing-xxsmall);letter-spacing:normal;font:var(--type-details-caption-2-font)}.wishlist-wishlist__content.wishlist-wishlist__content--empty{border:var(--shape-border-width-2) solid var(--color-neutral-400);border-radius:var(--shape-border-radius-2);grid-template-columns:repeat(1,1fr);padding:var(--spacing-xxbig);margin:var(--spacing-xxbig) auto}@media only screen and (max-width: 480px){.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;position:relative;width:100%}.wishlist-product-item__content .wishlist-product-item__title{color:var(--color-neutral-800);font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin:0;position:relative}.wishlist-product-item-name{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:85%}a.wishlist-product-item-name:active,a.wishlist-product-item-name:hover,a.wishlist-product-item-name{color:var(--color-neutral-800);cursor:pointer;font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing)}.wishlist-product-item__content .wishlist-product-item-button__remove{position:absolute;right:0;top:-10px}.wishlist-product-item__content .wishlist-product-item-options{font:var(--type-body-2-default-font)}.wishlist-product-item__content .wishlist-product-item-option__attribute{text-transform:capitalize}.wishlist-product-item__content .wishlist-product-item-option__label{font:var(--type-body-2-strong-font)}.wishlist-product-item__content .wishlist-product-item-price{display:inline;font:var(--type-body-2-default-font)}.strikethrough{text-decoration:line-through}.wishlist-product-item__content .wishlist-product-item-discounted-price{display:inline;margin-left:var(--spacing-xsmall);color:var(--color-alert-800)}.wishlist-product-item-move-to-cart{display:grid;grid-area:product-add-to-cart;justify-content:end}.wishlist-product-item-tax{color:var(--color-neutral-500)}.wishlist-product-item-tax span{margin-right:var(--spacing-xsmall)}.image-carousel{display:flex;flex-direction:column;gap:var(--spacing-medium);padding:var(--spacing-medium)}.image-carousel .image-carousel-image{object-fit:contain;padding:var(--spacing-xxsmall) 0;width:100%}.image-switcher-area{bottom:var(--spacing-xxsmall);left:0;margin-top:var(--spacing-small);position:absolute;text-align:center;width:100%}.image-switcher-area .image-switcher{cursor:pointer;border-radius:50%;display:inline-flex;height:var(--spacing-xsmall);margin:0 var(--spacing-xxsmall);width:var(--spacing-xsmall)}.image-switcher-area .image-switcher-active{background-color:var(--color-neutral-900);border:var(--shape-border-width-1) solid var(--color-brand-700)}.image-switcher-area .image-switcher-inactive{background-color:var(--color-neutral-600);border:var(--shape-border-width-1) solid var(--color-neutral-600)}@media only screen and (max-width: 480px){.image-carousel{gap:var(--spacing-xxsmall)}.image-carousel .image-carousel-image{height:250px}}@media only screen and (min-width: 480px) and (max-width: 600px){.image-carousel{gap:var(--spacing-xsmall)}.image-carousel .image-carousel-image{height:300px}}@media only screen and (min-width: 600px){.image-carousel{gap:var(--spacing-xsmall)}.image-carousel .image-carousel-image{height:300px}}@media only screen and (min-width: 768px){.image-carousel{gap:var(--spacing-small)}.image-carousel .image-carousel-image{height:350px}}@media only screen and (min-width: 1024px){.image-carousel{gap:var(--spacing-medium)}.image-carousel .image-carousel-image{height:400px}}.wishlist-login__sign-in{grid-column-start:2;color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:var(--spacing-xxsmall);text-align:center}a.wishlist-login__link{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin-left:var(--spacing-xxsmall);text-decoration:underline;text-decoration-thickness:auto;text-underline-offset:auto;color:var(--color-neutral-800)}a.wishlist-login__link:hover{color:var(--color-neutral-800);text-decoration:underline;text-decoration-thickness:auto;text-underline-offset:auto}",{styleId:"Wishlist"});
|
|
4
4
|
import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{Render as d}from"@dropins/tools/lib.js";import{useState as a,useEffect as n}from"@dropins/tools/preact-hooks.js";import{UIProvider as m}from"@dropins/tools/components.js";import{events as h}from"@dropins/tools/event-bus.js";const c={EmptyWishlist:{heading:"Your wishlist is empty",message:"Add items by clicking on the heart icon.",cta:"Start shopping"},Wishlist:{heading:"Wishlist {count}",loading:"Loading...",ariaLabelAddToWishlist:"add {PRODUCT_NAME} to wishlist",ariaLabelRemoveFromWishlist:"remove {PRODUCT_NAME} from wishlist"},Alert:{addProduct:{heading:"Added to wishlist",message:"{product} has been added to your wishlist"},removeProduct:{heading:"Removed from wishlist",message:"{product} has been removed from your wishlist"},moveToCart:{heading:"Moved to cart",message:"{product} has been moved to your cart"},addError:{heading:"Error",message:"Failed to add product to wishlist"},removeError:{heading:"Error",message:"Failed to remove {product} from wishlist"},viewWishlist:"View wishlist"},Login:{sync:" to sync your saved items across all your devices.",logIn:"Log in"}},l={CartActionButton:"Move To Cart",TrashActionButton:"Remove this product from wishlist",CustomizeActionButton:"Customize"},u={Wishlist:c,ProductItem:l},g={default:u},v=({children:e})=>{const[s,i]=a("en_US");return n(()=>{const o=h.on("locale",r=>{i(r)},{eager:!0});return()=>{o==null||o.off()}},[]),t(m,{lang:s,langDefinitions:g,children:e})},P=new d(t(v,{}));export{P as render};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent, JSX } from 'preact';
|
|
2
|
-
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
-
import { ImageNodeRenderProps } from '../../../@adobe-commerce/elsie/src/components';
|
|
4
|
-
|
|
5
|
-
export interface ImageCarouselProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
className?: string;
|
|
7
|
-
children?: any;
|
|
8
|
-
images: {
|
|
9
|
-
src: string;
|
|
10
|
-
alt: string | undefined;
|
|
11
|
-
}[];
|
|
12
|
-
imageNode?: (props: {
|
|
13
|
-
defaultImageProps: ImageNodeRenderProps;
|
|
14
|
-
}) => JSX.Element;
|
|
15
|
-
}
|
|
16
|
-
export declare const ImageCarousel: FunctionComponent<ImageCarouselProps>;
|
|
17
|
-
//# sourceMappingURL=ImageCarousel.d.ts.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent } from 'preact';
|
|
2
|
-
import { PriceDetails } from '../../data/models';
|
|
3
|
-
|
|
4
|
-
export interface TaxDetailsProps {
|
|
5
|
-
taxes: PriceDetails['fixedProductTaxes'];
|
|
6
|
-
displayMode: string;
|
|
7
|
-
}
|
|
8
|
-
export declare const TaxDetails: FunctionComponent<TaxDetailsProps>;
|
|
9
|
-
//# sourceMappingURL=TaxDetails.d.ts.map
|
|
@@ -1,19 +0,0 @@
|
|
|
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 '.';
|
|
18
|
-
export { TaxDetails } from './TaxDetails';
|
|
19
|
-
//# sourceMappingURL=index.d.ts.map
|