@dropins/storefront-wishlist 1.0.1 → 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.
@@ -1,5 +1,6 @@
1
- import { FunctionComponent } from 'preact';
2
1
  import { HTMLAttributes } from 'preact/compat';
2
+ import { FunctionComponent, JSX } from 'preact';
3
+ import { ImageNodeRenderProps } from '../../../@adobe-commerce/elsie/src/components';
3
4
  import { Item, Product } from '../../data/models';
4
5
 
5
6
  export interface ProductItemProps extends HTMLAttributes<HTMLDivElement> {
@@ -7,12 +8,10 @@ export interface ProductItemProps extends HTMLAttributes<HTMLDivElement> {
7
8
  item?: Item;
8
9
  onCartActionButtonClick?: () => boolean;
9
10
  onTrashButtonClick?: () => boolean;
10
- fixedProductTaxesEnabled: boolean;
11
- fixedProductTaxesApply: boolean;
12
- fixedProductTaxesEnabledDisplayInProductLists?: string;
13
- fixedProductTaxesEnabledDisplayInSalesModules?: string;
14
- fixedProductTaxesEnabledDisplayInProductView?: string;
15
11
  routeProdDetailPage: (product: Product) => string;
12
+ imageNode?: (props: {
13
+ defaultImageProps: ImageNodeRenderProps;
14
+ }) => JSX.Element;
16
15
  }
17
16
  export declare const ProductItem: FunctionComponent<ProductItemProps>;
18
17
  //# sourceMappingURL=ProductItem.d.ts.map
@@ -19,5 +19,4 @@ export * from './Wishlist';
19
19
  export * from './ProductItem';
20
20
  export * from './ImageCarousel';
21
21
  export * from './Login';
22
- export * from './TaxDetails';
23
22
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,7 @@
1
1
  import { HTMLAttributes } from 'preact/compat';
2
- import { Container } from '../../../@adobe-commerce/elsie/src/lib';
3
- import { Product } from '../../data/models';
2
+ import { Container, SlotProps } from '../../../@adobe-commerce/elsie/src/lib';
3
+ import { Item, Product } from '../../data/models';
4
+ import { ImageProps } from '../../../@adobe-commerce/elsie/src/components';
4
5
 
5
6
  export interface WishlistProps extends HTMLAttributes<HTMLDivElement> {
6
7
  routeEmptyWishlistCTA?: () => string;
@@ -10,6 +11,14 @@ export interface WishlistProps extends HTMLAttributes<HTMLDivElement> {
10
11
  quantity: number;
11
12
  }[]) => Promise<any>;
12
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>;
16
+ slots?: {
17
+ image?: SlotProps<{
18
+ defaultImageProps: ImageProps;
19
+ item: Item;
20
+ }>;
21
+ };
13
22
  }
14
23
  export declare const Wishlist: Container<WishlistProps>;
15
24
  //# sourceMappingURL=Wishlist.d.ts.map
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as i,jsxs as d,Fragment as H}from"@dropins/tools/preact-jsx-runtime.js";import{useState as u,useCallback as j,useEffect as F,useMemo as k,Fragment as B}from"@dropins/tools/preact-compat.js";import{classes as v,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:v(["wishlist-empty-wishlist",l]),children:i(z,{className:v(["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:`
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 d,Fragment as H}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
- `}),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]=u(null),[N,_]=u(b.authenticated),[L,g]=u(b.isLoading),W=n=>_(n),[p,a]=u(null),x=j(n=>{const{action:o,item:h}=n;a(i(J,{action:o,item:h,routeToWishlist:s}))},[s]);return F(()=>{const n=I.on("authenticated",W),o=I.on("wishlist/alert",t=>x(t)),h=I.on("wishlist/data",t=>{m(t),g(!1)},{eager:!0});return()=>{n==null||n.off(),h==null||h.off(),o==null||o.off()}},[x]),i(U,{...r,wishlistData:f,wishlistAlert:p,routeEmptyWishlistCTA:l,moveProdToCart:e,isLoggedIn:N,isLoading:L,routeProdDetailPage:c})},U=({className:l,wishlistData:s,wishlistAlert:e,isLoggedIn:c,isLoading:r,moveProdToCart:f,routeEmptyWishlistCTA:m,onLoginClick:N,routeProdDetailPage:_,...L})=>{const[g,W]=u(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(y=>{var w;return i(G,{initialData:y,moveProdToCart:f,routeProdDetailPage:_},(w=y.product)==null?void 0:w.sku)}):null},[s,f,_]);F(()=>{if(e){W(e);const t=setTimeout(()=>{W(null)},5e3);return()=>clearTimeout(t)}},[e]);const x=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:v(["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:N})]})}),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((y,w)=>{var E;return d(B,{children:[y,w===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())+w)})})}):null},[p,a,s]);return d("div",{...L,className:v(["wishlist-wishlist",l]),children:[x,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};
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};
@@ -2,8 +2,8 @@ import { FunctionComponent } from 'preact';
2
2
  import { HTMLAttributes } from 'preact/compat';
3
3
 
4
4
  export interface WishlistAlertProps extends HTMLAttributes<HTMLDivElement> {
5
- action: 'add' | 'remove' | 'move';
6
- item: {
5
+ action: 'add' | 'remove' | 'move' | 'addError' | 'removeError';
6
+ item?: {
7
7
  product: {
8
8
  name: string;
9
9
  };
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{W as e,W as l}from"../chunks/WishlistAlert.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/Trash.js";import"@dropins/tools/preact-compat.js";import"../chunks/HeartFilled.js";import"@dropins/tools/i18n.js";export{e as WishlistAlert,l as default};
3
+ import{W as e,W as l}from"../chunks/WishlistAlert.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-compat.js";import"../chunks/Trash.js";import"../chunks/HeartFilled.js";import"@dropins/tools/i18n.js";export{e as WishlistAlert,l as default};
@@ -1,9 +1,13 @@
1
1
  import { HTMLAttributes } from 'preact/compat';
2
2
  import { Container } from '../../../@adobe-commerce/elsie/src/lib';
3
3
  import { Item, Product } from '../../data/models';
4
+ import { ImageNodeRenderProps } from '../../../@adobe-commerce/elsie/src/components';
5
+ import { JSX } from 'preact';
4
6
 
5
7
  export interface WishlistItemProps extends HTMLAttributes<HTMLDivElement> {
6
- initialData: Item | null;
8
+ item: Item;
9
+ getProductData?: (sku: string) => Promise<Product | null>;
10
+ getRefinedProduct?: (sku: string, optionUIDs: string[], anchorOptions?: string[], raw?: boolean) => Promise<Product | null>;
7
11
  moveProdToCart: (products: {
8
12
  sku: string;
9
13
  quantity: number;
@@ -11,6 +15,9 @@ export interface WishlistItemProps extends HTMLAttributes<HTMLDivElement> {
11
15
  enteredOptions?: [];
12
16
  }[]) => Promise<any>;
13
17
  routeProdDetailPage: (product: Product) => string;
18
+ imageNode?: (props: {
19
+ defaultImageProps: ImageNodeRenderProps;
20
+ }) => JSX.Element;
14
21
  }
15
22
  export declare const WishlistItem: Container<WishlistItemProps>;
16
23
  //# sourceMappingURL=WishlistItem.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{W as l,W as d}from"../chunks/WishlistItem.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-compat.js";import"../chunks/removeProductsFromWishlist.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/Trash.js";import"@dropins/tools/i18n.js";export{l as WishlistItem,d as default};
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 m}from"@dropins/tools/preact-jsx-runtime.js";import{useState as c,useCallback as y,useEffect as u}from"@dropins/tools/preact-compat.js";import{Button as C,Icon as d}from"@dropins/tools/components.js";import{events as a}from"@dropins/tools/event-bus.js";import{s as j,g as q,i as x,r as E}from"../chunks/removeProductsFromWishlist.js";import{c as H,a as P}from"../chunks/mergeWishlists.js";import{S as T}from"../chunks/HeartFilled.js";import{S as z}from"../chunks/Heart.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const V=({product:s,iconWishlisted:I,iconToWishlist:v,size:g,variant:k,disabled:D,labelToWishlist:U,labelWishlisted:p,onClick:w,removeProdFromCart:r})=>{const[O,S]=c(j.authenticated),[f,n]=c(!1),[h,W]=c(null),{isGuestWishlistEnabled:L}=H.getConfig(),o=y(()=>{var i;const e=q(),t=(i=e==null?void 0:e.items)==null?void 0:i.find(l=>x(l,{sku:s.topLevelSku??s.sku,optionUIDs:s.optionUIDs??(s.selectedOptionsUIDs?Object.values(s.selectedOptionsUIDs):void 0)}));W(t??null),n(!!t)},[s.topLevelSku,s.sku,s.optionUIDs,s.selectedOptionsUIDs]);u(()=>{o()},[o]),u(()=>{const e=l=>S(l),t=a.on("authenticated",e),i=a.on("wishlist/data",o);return()=>{t==null||t.off(),i==null||i.off()}},[o]);const b=async()=>{var e;f?(await E([h]),n(!1),a.emit("wishlist/alert",{action:"remove",item:h})):(await P([{sku:s.topLevelSku??s.sku,quantity:1,optionsUIDs:s.optionUIDs??(s.selectedOptionsUIDs?Object.values(s.selectedOptionsUIDs):void 0),enteredOptions:(e=s.options)!=null&&e.items?s.options.items.filter(t=>t.selected).map(t=>({uid:t.uid,value:t.value})):void 0}]),n(!0),a.emit("wishlist/alert",{action:"add",item:{product:s}}),r&&await r([{uid:s.uid,quantity:0}]))};return!O&&!L?null:m(C,{active:f,"data-testid":"wishlist-toggle",size:g??"medium",variant:k??"tertiary",disabled:D,icon:m(d,{source:v??z}),activeIcon:m(d,{source:I??T}),onClick:w??b,children:U,activeChildren:p})};export{V as WishlistToggle,V as default};
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};
@@ -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
- topLevelSku?: string;
22
- uid: string;
23
- image: Image;
24
- stockStatus?: string;
25
- canonicalUrl?: string;
26
- urlKey: string;
27
- categories: string[];
28
- prices: PriceDetails;
29
- productAttributes?: Attribute[];
30
- options: Option[];
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 PriceDetails {
33
- regularPrice: MoneyProps;
34
- finalPrice: MoneyProps;
35
- discount?: {
36
- amountOff: number;
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
- export interface MoneyProps {
42
- value: number;
43
- currency: string;
52
+ interface Price {
53
+ amount?: number;
54
+ currency?: string;
55
+ maximumAmount?: number;
56
+ minimumAmount?: number;
57
+ variant?: 'default' | 'strikethrough';
44
58
  }
45
- interface FixedProductTaxesProps {
46
- money: MoneyProps;
47
- label: string;
59
+ export interface Prices {
60
+ regular: Price;
61
+ final: Price;
62
+ visible: boolean;
48
63
  }
49
- interface Image {
50
- alt: string;
51
- src: string;
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 AttributeOption {
54
- value: string;
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
- code: string;
59
- value?: string;
60
- selected_options?: AttributeOption[];
82
+ label: string;
83
+ value: string;
61
84
  }
62
- interface Option {
63
- uid: string;
64
- attributeCode?: string;
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: ConfigurableOption[];
15
+ selectedOptions: {
16
+ uid: string;
17
+ }[];
17
18
  enteredOptions?: {
18
19
  uid: string;
19
20
  value: string;
20
21
  }[];
21
- product: 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 product: Product;
4
- declare const productOutOfStock: Product;
3
+ declare const simpleProduct: Product;
5
4
  declare const configurableProduct: Product;
6
- export { product, productOutOfStock, configurableProduct };
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 wishlistWithProductWithOptions: Wishlist;
5
- export declare const wishlistWithProductOutOfStock: Wishlist;
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, ConfigurableOption } from '../models';
1
+ import { Product, Option } from '../models';
2
2
 
3
- export declare function transformProduct(data: any, selectedOptions?: ConfigurableOption[]): Product | null;
3
+ export declare function transformProduct(data: any, selectedOptions?: Option[]): Product | null;
4
4
  //# sourceMappingURL=transform-product.d.ts.map
@@ -7,7 +7,9 @@ declare const _default: {
7
7
  },
8
8
  "Wishlist": {
9
9
  "heading": "Wishlist {count}",
10
- "loading": "Loading..."
10
+ "loading": "Loading...",
11
+ "ariaLabelAddToWishlist": "add {PRODUCT_NAME} to wishlist",
12
+ "ariaLabelRemoveFromWishlist": "remove {PRODUCT_NAME} from wishlist"
11
13
  },
12
14
  "Alert": {
13
15
  "addProduct": {
@@ -22,6 +24,14 @@ declare const _default: {
22
24
  "heading": "Moved to cart",
23
25
  "message": "{product} has been moved to your cart"
24
26
  },
27
+ "addError": {
28
+ "heading": "Error",
29
+ "message": "Failed to add product to wishlist"
30
+ },
31
+ "removeError": {
32
+ "heading": "Error",
33
+ "message": "Failed to remove {product} from wishlist"
34
+ },
25
35
  "viewWishlist": "View wishlist"
26
36
  },
27
37
  "Login": {
@@ -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[], enteredOptions?: {
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.0.1", "@dropins/tools": "~1.0.0", "license": "SEE LICENSE IN LICENSE.md"}
1
+ {"name": "@dropins/storefront-wishlist", "version": "2.0.0-alpha1", "@dropins/tools": "~1.0.0", "license": "SEE LICENSE IN LICENSE.md"}