@dropins/storefront-wishlist 0.2.0-alpha2 → 0.2.1-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/removeProductsFromWishlist/removeProductsFromWishlist.d.ts +2 -7
- package/chunks/initializeWishlist.js +5 -5
- package/chunks/removeProductsFromWishlist.js +2 -2
- package/components/Login/Login.d.ts +4 -1
- package/containers/Wishlist.js +1 -1
- package/containers/WishlistItem/WishlistItem.d.ts +2 -2
- package/package.json +1 -1
- package/render/index.d.ts +16 -0
- package/render.js +1 -1
- package/components/Wishlist/Wishlist.d.ts +0 -17
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import { Wishlist } from '../../data/models/wishlist';
|
|
1
|
+
import { Item, Wishlist } from '../../data/models/wishlist';
|
|
2
2
|
|
|
3
|
-
export declare const removeProductsFromWishlist: (items: Array<
|
|
4
|
-
id: string;
|
|
5
|
-
product: {
|
|
6
|
-
sku: string;
|
|
7
|
-
};
|
|
8
|
-
}>) => Promise<Wishlist | null>;
|
|
3
|
+
export declare const removeProductsFromWishlist: (items: Array<Item>) => Promise<Wishlist | null>;
|
|
9
4
|
//# sourceMappingURL=removeProductsFromWishlist.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{Initializer as R}from"@dropins/tools/lib.js";import{events as
|
|
3
|
+
import{Initializer as R}from"@dropins/tools/lib.js";import{events as u}from"@dropins/tools/event-bus.js";import{s as r,i as A,f as g,h as T,g as E}from"./removeProductsFromWishlist.js";const S=new R({init:async e=>{const t={isGuestWishlistEnabled:!1,...e};S.config.setConfig(t),P().catch(console.error)},listeners:()=>[u.on("authenticated",e=>{r.authenticated&&!e&&u.emit("wishlist/reset",void 0),e&&!r.authenticated&&(r.authenticated=e,P().catch(console.error))},{eager:!0}),u.on("wishlist/data",e=>{A(e)}),u.on("wishlist/reset",()=>{K().catch(console.error),u.emit("wishlist/data",null)})]}),ee=S.config;function G(e){if(!e)return null;const t=i=>{switch(i){case 1:return"INCLUDING_FPT_AND_DESCRIPTION";case 2:return"EXCLUDING_FPT_INCLUDING_DESCRIPTION_FINAL_PRICE";case 3:return"EXCLUDING_FPT";default:return"INCLUDING_FPT_ONLY"}};return{wishlistIsEnabled:e.storeConfig.magento_wishlist_general_is_enabled,wishlistMultipleListIsEnabled:e.storeConfig.enable_multiple_wishlists,wishlistMaxNumber:e.storeConfig.maximum_number_of_wishlists,fixedProductTaxesEnabled:e.storeConfig.fixed_product_taxes_enable,fixedProductTaxesApply:e.storeConfig.fixed_product_taxes_apply_tax_to_fpt,fixedProductTaxesEnabledDisplayInProductLists:t(e.storeConfig.fixed_product_taxes_display_prices_in_product_lists),fixedProductTaxesEnabledDisplayInSalesModules:t(e.storeConfig.fixed_product_taxes_display_prices_in_sales_modules),fixedProductTaxesEnabledDisplayInProductView:t(e.storeConfig.fixed_product_taxes_display_prices_on_product_view_page)}}function b(e){var t;return e?{name:e.name,sku:e.sku,uid:e.uid,image:v(e),stockStatus:e.stock_status,canonicalUrl:e.canonical_url,urlKey:e.url_key,categories:(t=e.categories)==null?void 0:t.map(i=>i.name),prices:O(e),productAttributes:W(e)}:null}function v(e){var t,i;return{src:(t=e.thumbnail)==null?void 0:t.url,alt:(i=e.thumbnail)==null?void 0:i.label}}function O(e){var t,i,s,n,c,a,_,o,l,d,m,f,p,h,I,y,x,w;return{regularPrice:{currency:(s=(i=(t=e.price_range)==null?void 0:t.minimum_price)==null?void 0:i.regular_price)==null?void 0:s.currency,value:(a=(c=(n=e.price_range)==null?void 0:n.minimum_price)==null?void 0:c.regular_price)==null?void 0:a.value},finalPrice:{currency:(l=(o=(_=e.price_range)==null?void 0:_.minimum_price)==null?void 0:o.final_price)==null?void 0:l.currency,value:(f=(m=(d=e.price_range)==null?void 0:d.minimum_price)==null?void 0:m.final_price)==null?void 0:f.value},discount:{amountOff:(I=(h=(p=e.price_range)==null?void 0:p.minimum_price)==null?void 0:h.discount)==null?void 0:I.amount_off,percentOff:(w=(x=(y=e.price_range)==null?void 0:y.minimum_price)==null?void 0:x.discount)==null?void 0:w.percent_off},fixedProductTaxes:D(e)}}function W(e){var t,i;return(i=(t=e.custom_attributesV2)==null?void 0:t.items)==null?void 0:i.map(s=>{const n=s.code.split("_").map(c=>c.charAt(0).toUpperCase()+c.slice(1)).join(" ");return{...s,code:n}})}function D(e){var t,i,s;return(s=(i=(t=e.price_range)==null?void 0:t.minimum_price)==null?void 0:i.fixed_product_taxes)==null?void 0:s.map(n=>({money:{value:n.amount.value,currency:n.amount.currency},label:n.label}))}function C(e){return e?{id:e.id,updated_at:e.updated_at,sharing_code:e.sharing_code,items_count:e.items_count,items:M(e)}:null}function M(e){var t,i;return(i=(t=e==null?void 0:e.items_v2)==null?void 0:t.items)!=null&&i.length?e.items_v2.items.map(s=>({id:s.id,quantity:s.quantity,description:s.description,added_at:s.added_at,product:b(s.product)})):[]}const F=`
|
|
4
4
|
query STORE_CONFIG_QUERY {
|
|
5
5
|
storeConfig {
|
|
6
6
|
magento_wishlist_general_is_enabled
|
|
@@ -13,7 +13,7 @@ query STORE_CONFIG_QUERY {
|
|
|
13
13
|
fixed_product_taxes_display_prices_on_product_view_page
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
`,U=async()=>
|
|
16
|
+
`,U=async()=>g(F,{method:"GET",cache:"force-cache"}).then(({errors:e,data:t})=>e?T(e):G(t)),k=`
|
|
17
17
|
query GET_PRODUCT_BY_SKU($sku: String!) {
|
|
18
18
|
products(filter: { sku: { eq: $sku } }) {
|
|
19
19
|
items {
|
|
@@ -76,7 +76,7 @@ query STORE_CONFIG_QUERY {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
`,L=async e=>{if(!e)throw Error("Product SKU is not set");return
|
|
79
|
+
`,L=async e=>{if(!e)throw Error("Product SKU is not set");return g(k,{variables:{sku:e}}).then(({errors:t,data:i})=>{var s;return t?T(t):(s=i==null?void 0:i.products)!=null&&s.items?b(i.products.items[0]):null})},$=`
|
|
80
80
|
fragment PRICE_RANGE_FRAGMENT on PriceRange {
|
|
81
81
|
minimum_price {
|
|
82
82
|
regular_price {
|
|
@@ -215,7 +215,7 @@ ${q}
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
${N}
|
|
218
|
-
`,Y=async()=>r.authenticated?
|
|
218
|
+
`,Y=async()=>r.authenticated?g(B).then(({errors:e,data:t})=>{var i;return e?T(e):(i=t==null?void 0:t.customer)!=null&&i.wishlists?t.customer.wishlists.map(s=>C(s)):null}):E(),Q=`
|
|
219
219
|
mutation ADD_PRODUCTS_TO_WISHLIST_MUTATION(
|
|
220
220
|
$wishlistId: ID!,
|
|
221
221
|
$wishlistItems: [WishlistItemInput!]!,
|
|
@@ -234,4 +234,4 @@ ${q}
|
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
${N}
|
|
237
|
-
`,te=async e=>{var s,
|
|
237
|
+
`,te=async e=>{var s,n,c;const t=E();let i={id:(t==null?void 0:t.id)??"",items:(t==null?void 0:t.items)??[],updated_at:"",sharing_code:"",items_count:0};if(!e)return null;for(const a of e){if((s=t.items)==null?void 0:s.some(l=>l.product.sku===a.sku))continue;const o=await L(a.sku);o&&(i.items=[...i.items,{product:o}])}if(i.items_count=(n=i.items)==null?void 0:n.length,u.emit("wishlist/data",i),r.authenticated){if(!r.wishlistId)throw u.emit("wishlist/data",t),Error("Wishlist ID is not set");const a={wishlistId:r.wishlistId,wishlistItems:e.map(({sku:m,parentSku:f,quantity:p,optionsUIDs:h,enteredOptions:I})=>({sku:m,parent_sku:f,quantity:p,selected_options:h,entered_options:I}))},{errors:_,data:o}=await g(Q,{variables:a}),l=[...((c=o==null?void 0:o.addProductsToWishlist)==null?void 0:c.user_errors)??[],..._??[]];if(l.length>0)return u.emit("wishlist/data",t),T(l);const d=C(o.addProductsToWishlist.wishlist);u.emit("wishlist/data",d)}return null},K=()=>(r.wishlistId=null,r.authenticated=!1,Promise.resolve(null)),P=async()=>{if(r.initializing)return null;r.initializing=!0,r.config||(r.config=await U());const e=r.authenticated?await V():await Z();return u.emit("wishlist/initialized",e),u.emit("wishlist/data",e),r.initializing=!1,e};async function V(){const e=await Y(),t=e?e[0]:null;return t?(r.wishlistId=t.id,t):null}async function Z(){try{return await E()}catch(e){throw console.error(e),e}}export{q as W,te as a,N as b,ee as c,L as d,Y as e,P as f,U as g,V as h,S as i,Z as j,K as r,C as t};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{events as
|
|
3
|
+
import{events as d}from"@dropins/tools/event-bus.js";import{FetchGraphQL as m}from"@dropins/tools/fetch-graphql.js";function S(s){const t=document.cookie.split(";");for(const e of t)if(e.trim().startsWith(`${s}=`))return e.trim().substring(s.length+1);return null}const g={wishlistId:null,authenticated:!1},i=new Proxy(g,{set(s,t,e){if(s[t]=e,t==="wishlistId"){if(e===i.wishlistId)return!0;if(e===null)return document.cookie="DROPIN__WISHLIST__WISHLIST-ID=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/",!0;const r=new Date;r.setDate(r.getDate()+30),document.cookie=`DROPIN__WISHLIST__WISHLIST-ID=${e}; expires=${r.toUTCString()}; path=/`}return Reflect.set(s,t,e)},get(s,t){return t==="wishlistId"?S("DROPIN__WISHLIST__WISHLIST-ID"):s[t]}}),n="DROPIN__WISHLIST__WISHLIST__DATA";function E(s){const t=i.authenticated?sessionStorage:localStorage;if(s)try{t.setItem(n,JSON.stringify(s))}catch(e){_(e)?console.error("Storage quota exceeded:",e):console.error("Error saving wishlist:",e)}else t.removeItem(n)}const _=s=>s instanceof DOMException&&s.name==="QuotaExceededError";function f(){const s=i.authenticated?sessionStorage:localStorage;try{const t=s.getItem(n);return t?JSON.parse(t):{id:"",items:[]}}catch(t){return console.error("Error retrieving wishlist:",t),{id:"",items:[]}}}function O(s){var r;const t=i.authenticated?sessionStorage:localStorage,e=t.getItem(n)?JSON.parse(t.getItem(n)):{items:[]};return(r=e==null?void 0:e.items)==null?void 0:r.find(a=>{var o;return((o=a.product)==null?void 0:o.sku)===s})}const{setEndpoint:H,setFetchGraphQlHeader:L,removeFetchGraphQlHeader:P,setFetchGraphQlHeaders:F,fetchGraphQl:p,getConfig:R}=new m().getMethods(),w=s=>{const t=s.map(e=>e.message).join(" ");throw Error(t)},T=`
|
|
4
4
|
mutation REMOVE_PRODUCTS_FROM_WISHLIST_MUTATION(
|
|
5
5
|
$wishlistId: ID!,
|
|
6
6
|
$wishlistItemsIds: [ID!]!,
|
|
@@ -15,4 +15,4 @@ import{events as h}from"@dropins/tools/event-bus.js";import{FetchGraphQL as u}fr
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
`,$=async s=>{var r,a,o;const t=f(),e={...t,items:(r=t.items)==null?void 0:r.filter(c=>!s.map(I=>I.product.sku).includes(c.product.sku))};if(e.items_count=(a=e.items)==null?void 0:a.length,d.emit("wishlist/data",e),i.authenticated){if(!i.wishlistId)throw Error("Wishlist ID is not set");const c=s.map(u=>u.id),{errors:I,data:l}=await p(T,{variables:{wishlistId:i.wishlistId,wishlistItemsIds:c}}),h=[...((o=l==null?void 0:l.removeProductsFromWishlist)==null?void 0:o.user_errors)??[],...I??[]];return h.length>0?(d.emit("wishlist/data",t),w(h)):null}return null};export{H as a,L as b,P as c,F as d,R as e,p as f,f as g,w as h,E as i,O as j,$ as r,i as s};
|
package/containers/Wishlist.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as s,jsxs as
|
|
3
|
+
import{jsx as s,jsxs as u,Fragment as H}from"@dropins/tools/preact-jsx-runtime.js";import{useState as _,useCallback as L,useEffect as k,useMemo as N,Fragment as S}from"@dropins/tools/preact-compat.js";import{classes as w,VComponent as F}from"@dropins/tools/lib.js";import{IllustratedMessage as $,Button as j,Icon as M}from"@dropins/tools/components.js";import{W as z}from"../chunks/WishlistItem.js";import{events as v}from"@dropins/tools/event-bus.js";import{s as B}from"../chunks/removeProductsFromWishlist.js";import{useText as x,Text as b}from"@dropins/tools/i18n.js";import{W as V}from"../chunks/WishlistAlert.js";import{S as q}from"../chunks/Heart.js";import"../chunks/Trash.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/HeartFilled.js";const A=({className:l,children:i,ctaLinkURL:e,...d})=>{const r=x({emptyWishlist:"Wishlist.EmptyWishlist.heading",message:"Wishlist.EmptyWishlist.message",cta:"Wishlist.EmptyWishlist.cta"});return s("div",{...d,className:w(["wishlist-empty-wishlist",l]),children:s($,{className:w(["wishlist-empty-wishlist__wrapper",l]),"data-testid":"wishlist-empty-wishlist",heading:r.emptyWishlist,icon:s(M,{className:"wishlist-empty-wishlist__icon",source:q}),message:s("p",{children:r.message}),action:e?s(j,{"data-testid":"wishlist-empty-wishlist-button",size:"medium",variant:"primary",type:"submit",href:e,children:r.cta},"routeHome"):void 0})})},ss=({routeEmptyWishlistCTA:l,routeToWishlist:i,moveProdToCart:e,...d})=>{const[r,h]=_(null),[W,y]=_(B.authenticated),m=n=>y(n),[g,f]=_(null),c=L(n=>{const{action:a,item:t}=n;f(s(V,{action:a,item:t}))},[i]);return k(()=>{const n=v.on("authenticated",m),a=v.on("wishlist/alert",o=>c(o)),t=v.on("wishlist/data",o=>{h(o)});return()=>{n==null||n.off(),t==null||t.off(),a==null||a.off()}},[c]),s(G,{...d,wishlistData:r,wishlistAlert:g,routeEmptyWishlistCTA:l,moveProdToCart:e,isLoggedIn:W})},G=({className:l,wishlistData:i,wishlistAlert:e,isLoggedIn:d,moveProdToCart:r,routeEmptyWishlistCTA:h,onLoginClick:W,...y})=>{const[m,g]=_(e),f=x({wishlistHeading:"Wishlist.Wishlist.heading"}),c=N(()=>{var t;return((t=i==null?void 0:i.items)==null?void 0:t.length)>0?i.items.map(o=>{var p;return s(z,{initialData:o,moveProdToCart:r},(p=o.product)==null?void 0:p.sku)}):null},[i,r]);k(()=>{if(e){g(e);const t=setTimeout(()=>{g(null)},5e3);return()=>clearTimeout(t)}},[e]);const n=N(()=>m?s(F,{node:m,className:"wishlist-wishlist__alert"}):null,[m]),a=N(()=>{var t;return c?s("div",{className:"wishlist-wishlist__heading","data-testid":"wishlist-heading-wrapper",children:s("div",{className:"wishlist-wishlist__heading-text","data-testid":"default-wishlist-heading",children:(t=f.wishlistHeading)==null?void 0:t.split(" {count}").map((o,p)=>{var I;return u(S,{children:[o,p===0&&s("span",{className:"wishlist-wishlist__heading-count","data-testid":"wishlist-heading-count",children:`${i==null?void 0:i.items_count} products`})]},((I=i==null?void 0:i.id)==null?void 0:I.toString())+p)})})}):null},[f,c,i]);return u("div",{...y,className:w(["wishlist-wishlist",l]),children:[n,c?u(H,{children:[a,s("div",{className:"wishlist-wishlist__content",children:c})]}):s("div",{className:w(["wishlist-wishlist__content","wishlist-wishlist__content--empty"]),children:u("div",{children:[s(A,{"data-testid":"empty-wishlist",ctaLinkURL:h==null?void 0:h()}),!d&&s(J,{onLoginClick:W})]})})]})},J=({onLoginClick:l})=>u("div",{className:"wishlist-login__sign-in",children:[s("a",{"data-testid":"log-in-link",className:"wishlist-login__link",href:"",rel:"noreferrer",onClick:l,role:"button",children:s(b,{id:"Wishlist.Login.logIn"})}),s(b,{id:"Wishlist.Login.sync"})]});export{ss as Wishlist,ss as default};
|
|
@@ -3,11 +3,11 @@ import { Container } from '../../../@adobe-commerce/elsie/src/lib';
|
|
|
3
3
|
import { Item } from '../../data/models';
|
|
4
4
|
|
|
5
5
|
export interface WishlistItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
initialData
|
|
6
|
+
initialData: Item | null;
|
|
7
7
|
moveProdToCart: (products: {
|
|
8
8
|
sku: string;
|
|
9
9
|
quantity: number;
|
|
10
10
|
}[]) => Promise<any>;
|
|
11
11
|
}
|
|
12
|
-
export declare const WishlistItem: Container<WishlistItemProps
|
|
12
|
+
export declare const WishlistItem: Container<WishlistItemProps>;
|
|
13
13
|
//# sourceMappingURL=WishlistItem.d.ts.map
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@dropins/storefront-wishlist", "version": "0.2.
|
|
1
|
+
{"name": "@dropins/storefront-wishlist", "version": "0.2.1-alpha", "@dropins/tools": "~1.0.0", "license": "SEE LICENSE IN LICENSE.md"}
|
package/render/index.d.ts
CHANGED
|
@@ -1,2 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
1
17
|
export * from './render';
|
|
2
18
|
//# sourceMappingURL=index.d.ts.map
|
package/render.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
(function(r,i){try{if(typeof document<"u"){const t=document.createElement("style"),
|
|
3
|
+
(function(r,i){try{if(typeof document<"u"){const t=document.createElement("style"),n=i.styleId;for(const e in i.attributes)t.setAttribute(e,i.attributes[e]);t.setAttribute("data-dropin",n),t.appendChild(document.createTextNode(r));const a=document.querySelector('style[data-dropin="sdk"]');if(a)a.after(t);else{const e=document.querySelector('link[rel="stylesheet"], style');e?e.before(t):document.head.append(t)}}}catch(t){console.error("dropin-styles (injectCodeFunction)",t)}})(".wishlist-empty-wishlist{container-type:inline-size;container-name:wishlist}.wishlist-empty-wishlist__wrapper .dropin-card--secondary{display:grid;grid-auto-rows:min-content;justify-content:center;text-align:center;border:unset}.wishlist-empty-wishlist .dropin-illustrated-message__heading{font:var(--type-headline-1-font)}.wishlist-empty-wishlist .dropin-illustrated-message__message{font:var(--type-body-1-default-font)}@container wishlist (width < 737px){.wishlist-empty-wishlist__wrapper .dropin-card{border:unset;border-style:hidden}}.wishlist-wishlist{container-type:inline-size;container-name:wishlist-grid;max-width:inherit}.wishlist-wishlist__content{display:grid;gap:var(--spacing-medium);margin:auto;padding:var(--spacing-medium) 0}.wishlist-wishlist__heading{color:var(--color-neutral-800);display:grid;font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);padding:var(--spacing-small) 0;row-gap:var(--spacing-xsmall)}.wishlist-wishlist__heading-count{color:#6d6d6d;margin-left:var(--spacing-xxsmall);letter-spacing:normal;font:var(--type-details-caption-2-font)}.wishlist-wishlist__content.wishlist-wishlist__content--empty{border:var(--shape-border-width-2) solid var(--color-neutral-400);border-radius:var(--shape-border-radius-2);grid-template-columns:repeat(1,1fr);padding:var(--spacing-xxbig);margin:var(--spacing-xxbig) auto}@media only screen and (max-width: 480px){.wishlist-wishlist__content{grid-template-columns:repeat(1,1fr)}}@media only screen and (min-width: 480px) and (max-width: 600px){.wishlist-wishlist__content{grid-template-columns:repeat(2,1fr)}}@media only screen and (min-width: 600px){.wishlist-wishlist__content{grid-template-columns:repeat(2,1fr)}}@media only screen and (min-width: 768px){.wishlist-wishlist__content{grid-template-columns:repeat(3,1fr)}}.wishlist-product-item{background-color:var(--color-neutral-50);margin-bottom:var(--spacing-small)}.wishlist-product-item__content{display:flex;flex-direction:column;gap:var(--spacing-small)}.wishlist-product-item__content .wishlist-product-item-image{background:var(--color-neutral-200);height:100%;padding:0;width:100%}.wishlist-product-item__content .wishlist-product-item__title{color:var(--color-neutral-800);font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin:0;position:relative}.wishlist-product-item-name{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:85%}a.wishlist-product-item-name:active,a.wishlist-product-item-name:hover,a.wishlist-product-item-name{color:var(--color-neutral-800);cursor:pointer;font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing)}.wishlist-product-item__content .wishlist-product-item-button__remove{position:absolute;right:0;top:-10px}.wishlist-product-item__content .wishlist-product-item-price{display:inline;font:var(--type-body-2-default-font)}.strikeout{text-decoration:line-through}.wishlist-product-item__content .wishlist-product-item-discounted-price{display:inline;margin-left:var(--spacing-xsmall);color:var(--color-alert-800)}.wishlist-product-item-move-to-cart{display:grid;grid-area:product-add-to-cart;justify-content:end}.wishlist-product-item-tax{color:var(--color-neutral-500)}.wishlist-product-item-tax span{margin-right:var(--spacing-xsmall)}.image-carousel{display:flex;flex-direction:column;gap:var(--spacing-medium);padding:var(--spacing-medium)}.image-carousel .image-carousel-image{object-fit:contain;padding:var(--spacing-xxsmall) 0;width:100%}.image-switcher-area{margin-top:var(--spacing-small);text-align:center;width:100%}.image-switcher-area .image-switcher{cursor:pointer;border-radius:50%;display:inline-flex;height:var(--spacing-xsmall);margin:0 var(--spacing-xxsmall);width:var(--spacing-xsmall)}.image-switcher-area .image-switcher-active{background-color:var(--color-neutral-900);border:var(--shape-border-width-1) solid var(--color-brand-700)}.image-switcher-area .image-switcher-inactive{background-color:var(--color-neutral-600);border:var(--shape-border-width-1) solid var(--color-neutral-600)}@media only screen and (max-width: 480px){.image-carousel{gap:var(--spacing-xxsmall)}.image-carousel .image-carousel-image{height:250px}}@media only screen and (min-width: 480px) and (max-width: 600px){.image-carousel{gap:var(--spacing-xsmall)}.image-carousel .image-carousel-image{height:300px}}@media only screen and (min-width: 600px){.image-carousel{gap:var(--spacing-xsmall)}.image-carousel .image-carousel-image{height:300px}}@media only screen and (min-width: 768px){.image-carousel{gap:var(--spacing-small)}.image-carousel .image-carousel-image{height:350px}}@media only screen and (min-width: 1024px){.image-carousel{gap:var(--spacing-medium)}.image-carousel .image-carousel-image{height:400px}}.wishlist-login__sign-in{grid-column-start:2;color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:var(--spacing-xxsmall);text-align:center}a.wishlist-login__link{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin-left:var(--spacing-xxsmall);text-decoration:underline;text-decoration-thickness:auto;text-underline-offset:auto;color:var(--color-neutral-800)}a.wishlist-login__link:hover{color:var(--color-neutral-800);text-decoration:underline;text-decoration-thickness:auto;text-underline-offset:auto}",{styleId:"Wishlist"});
|
|
4
4
|
import{jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{Render as n}from"@dropins/tools/lib.js";import{useState as d,useEffect as a}from"@dropins/tools/preact-hooks.js";import{UIProvider as c}from"@dropins/tools/components.js";import{events as m}from"@dropins/tools/event-bus.js";const h={EmptyWishlist:{heading:"Your wishlist is empty",message:"Add items by clicking on the heart icon.",cta:"Start shopping"},Wishlist:{heading:"Wishlist {count}"},Alert:{addProduct:{heading:"Added to wishlist",message:"{product} has been added to your wishlist"},removeProduct:{heading:"Removed from wishlist",message:"{product} has been removed from your wishlist"},moveToCart:{heading:"Moved to cart",message:"{product} has been moved to your cart"},viewWishlist:"View wishlist"},Login:{sync:" to sync your saved items across all your devices.",logIn:"Log in"}},u={CartActionButton:"Move To Cart",TrashActionButton:"Remove this product from wishlist"},l={Wishlist:h,ProductItem:u},g={default:l},f=({children:o})=>{const[s,i]=d("en_US");return a(()=>{const t=m.on("locale",r=>{i(r)},{eager:!0});return()=>{t==null||t.off()}},[]),e(c,{lang:s,langDefinitions:g,children:o})},W=new n(e(f,{}));export{W as render};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent, VNode } from 'preact';
|
|
2
|
-
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
-
import { Wishlist as WishlistModel } from '../../data/models';
|
|
4
|
-
|
|
5
|
-
export interface WishlistProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
className?: string;
|
|
7
|
-
wishlistData: WishlistModel;
|
|
8
|
-
wishlistAlert: VNode | null;
|
|
9
|
-
isLoggedIn: boolean;
|
|
10
|
-
moveProdToCart: (products: {
|
|
11
|
-
sku: string;
|
|
12
|
-
quantity: number;
|
|
13
|
-
}[]) => Promise<any>;
|
|
14
|
-
routeEmptyWishlistCTA?: () => string;
|
|
15
|
-
}
|
|
16
|
-
export declare const Wishlist: FunctionComponent<WishlistProps>;
|
|
17
|
-
//# sourceMappingURL=Wishlist.d.ts.map
|