@dropins/storefront-wishlist 0.1.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/LICENSE.md +127 -0
- package/api/addProductsToWishlist/addProductsToWishlist.d.ts +15 -0
- package/api/addProductsToWishlist/graphql/addProductsToWishlistMutation.d.ts +18 -0
- package/api/addProductsToWishlist/index.d.ts +18 -0
- package/api/fetch-graphql/fetch-graphql.d.ts +24 -0
- package/api/fetch-graphql/index.d.ts +18 -0
- package/api/fragments.d.ts +5 -0
- package/api/getProductBySku/getProductBySku.d.ts +4 -0
- package/api/getProductBySku/graphql/getProductBySku.graphql.d.ts +18 -0
- package/api/getProductBySku/graphql/index.d.ts +18 -0
- package/api/getProductBySku/index.d.ts +18 -0
- package/api/getStoreConfig/getStoreConfig.d.ts +4 -0
- package/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +18 -0
- package/api/getStoreConfig/index.d.ts +18 -0
- package/api/getWishlistById/getWishlistById.d.ts +4 -0
- package/api/getWishlistById/graphql/getWishlistById.graphql.d.ts +18 -0
- package/api/getWishlistById/graphql/index.d.ts +18 -0
- package/api/getWishlistById/index.d.ts +18 -0
- package/api/getWishlists/getWishlists.d.ts +4 -0
- package/api/getWishlists/graphql/getWishlists.graphql.d.ts +18 -0
- package/api/getWishlists/graphql/index.d.ts +18 -0
- package/api/getWishlists/index.d.ts +18 -0
- package/api/graphql/CustomizableOptionsFragment.graphql.d.ts +18 -0
- package/api/graphql/PriceRangeFragment.graphql.d.ts +18 -0
- package/api/graphql/ProductFragment.graphql.d.ts +18 -0
- package/api/graphql/WishlistFragment.graphql.d.ts +18 -0
- package/api/graphql/WishlistItemFragment.graphql.d.ts +18 -0
- package/api/graphql/WishlistPaginationArguments.graphql.d.ts +18 -0
- package/api/graphql/WishlistPaginationVariables.graphql.d.ts +18 -0
- package/api/index.d.ts +29 -0
- package/api/initialize/index.d.ts +2 -0
- package/api/initialize/initialize.d.ts +11 -0
- package/api/initializeWishlist/index.d.ts +18 -0
- package/api/initializeWishlist/initializeWishlist.d.ts +6 -0
- package/api/localStorage/index.d.ts +2 -0
- package/api/removeProductsFromWishlist/graphql/removeProductsFromWishlistMutation.d.ts +18 -0
- package/api/removeProductsFromWishlist/index.d.ts +18 -0
- package/api/removeProductsFromWishlist/removeProductsFromWishlist.d.ts +9 -0
- package/api/resetWishlist/index.d.ts +18 -0
- package/api/resetWishlist/resetWishlist.d.ts +4 -0
- package/api/updateProductsInWishlist/graphql/updateProductsInWishlistMutation.d.ts +18 -0
- package/api/updateProductsInWishlist/index.d.ts +18 -0
- package/api/updateProductsInWishlist/updateProductsInWishlist.d.ts +13 -0
- package/api.d.ts +1 -0
- package/api.js +23 -0
- package/chunks/Add.js +3 -0
- package/chunks/AddressBook.js +3 -0
- package/chunks/Bulk.js +3 -0
- package/chunks/Burger.js +3 -0
- package/chunks/Card.js +3 -0
- package/chunks/Check.js +3 -0
- package/chunks/CheckWithCircle.js +3 -0
- package/chunks/ChevronRight.js +3 -0
- package/chunks/ChevronUp.js +3 -0
- package/chunks/Close.js +3 -0
- package/chunks/Coupon.js +3 -0
- package/chunks/Date.js +3 -0
- package/chunks/Delivery.js +3 -0
- package/chunks/EmptyBox.js +3 -0
- package/chunks/Eye.js +3 -0
- package/chunks/EyeClose.js +3 -0
- package/chunks/Gift.js +3 -0
- package/chunks/GiftCard.js +3 -0
- package/chunks/HeartFilled.js +3 -0
- package/chunks/InfoFilled.js +3 -0
- package/chunks/Locker.js +3 -0
- package/chunks/Minus.js +3 -0
- package/chunks/Order.js +3 -0
- package/chunks/OrderError.js +3 -0
- package/chunks/OrderSuccess.js +3 -0
- package/chunks/PaymentError.js +3 -0
- package/chunks/Placeholder.js +3 -0
- package/chunks/PlaceholderFilled.js +3 -0
- package/chunks/Search.js +3 -0
- package/chunks/SearchFilled.js +3 -0
- package/chunks/Sort.js +3 -0
- package/chunks/Star.js +3 -0
- package/chunks/User.js +3 -0
- package/chunks/View.js +3 -0
- package/chunks/Wallet.js +3 -0
- package/chunks/Warning.js +3 -0
- package/chunks/WarningFilled.js +3 -0
- package/chunks/WarningWithCircle.js +3 -0
- package/chunks/WishlistItem.js +3 -0
- package/chunks/getWishlistById.js +31 -0
- package/chunks/initializeWishlist.js +110 -0
- package/chunks/removeProductsFromWishlist.js +166 -0
- package/components/EmptyWishlist/EmptyWishlist.d.ts +8 -0
- package/components/EmptyWishlist/index.d.ts +19 -0
- package/components/ImageCarousel/ImageCarousel.d.ts +13 -0
- package/components/ImageCarousel/index.d.ts +19 -0
- package/components/Login/Login.d.ts +4 -0
- package/components/Login/index.d.ts +18 -0
- package/components/ProductItem/ProductItem.d.ts +16 -0
- package/components/ProductItem/index.d.ts +19 -0
- package/components/Wishlist/Wishlist.d.ts +17 -0
- package/components/Wishlist/index.d.ts +19 -0
- package/components/index.d.ts +22 -0
- package/containers/Wishlist/Wishlist.d.ts +12 -0
- package/containers/Wishlist/index.d.ts +19 -0
- package/containers/Wishlist.d.ts +3 -0
- package/containers/Wishlist.js +3 -0
- package/containers/WishlistItem/WishlistItem.d.ts +13 -0
- package/containers/WishlistItem/index.d.ts +19 -0
- package/containers/WishlistItem.d.ts +3 -0
- package/containers/WishlistItem.js +3 -0
- package/containers/WishlistToggle/WishlistToggle.d.ts +9 -0
- package/containers/WishlistToggle/index.d.ts +19 -0
- package/containers/WishlistToggle.d.ts +3 -0
- package/containers/WishlistToggle.js +3 -0
- package/containers/index.d.ts +20 -0
- package/data/models/index.d.ts +20 -0
- package/data/models/product.d.ts +60 -0
- package/data/models/selected-customizable-option.d.ts +30 -0
- package/data/models/store-config.d.ts +27 -0
- package/data/models/wishlist.d.ts +20 -0
- package/data/transforms/__fixtures__/productData.d.ts +6 -0
- package/data/transforms/__fixtures__/wishlistData.d.ts +5 -0
- package/data/transforms/index.d.ts +20 -0
- package/data/transforms/transform-product.d.ts +4 -0
- package/data/transforms/transform-store-config.d.ts +4 -0
- package/data/transforms/transform-wishlist.d.ts +4 -0
- package/i18n/en_US.json.d.ts +38 -0
- package/lib/cookies.d.ts +18 -0
- package/lib/fetch-error.d.ts +21 -0
- package/lib/persisted-data.d.ts +5 -0
- package/lib/state.d.ts +14 -0
- package/package.json +1 -0
- package/render/Provider.d.ts +8 -0
- package/render/index.d.ts +2 -0
- package/render/render.d.ts +4 -0
- package/render.d.ts +1 -0
- package/render.js +5 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{Initializer as E}from"@dropins/tools/lib.js";import{events as r}from"@dropins/tools/event-bus.js";import{s as i,i as g,f as c,h as _,m as y,j as T,W as x,g as h,t as S}from"./removeProductsFromWishlist.js";const P=new E({init:async t=>{const s={isGuestWishlistEnabled:!1,...t};P.config.setConfig(s),w().catch(console.error)},listeners:()=>[r.on("authenticated",t=>{i.authenticated&&!t&&r.emit("wishlist/reset",void 0),t&&!i.authenticated&&(i.authenticated=t,w().catch(console.error))},{eager:!0}),r.on("wishlist/data",t=>{g(t)}),r.on("wishlist/reset",()=>{R().catch(console.error),r.emit("wishlist/data",null)})]}),$=P.config;function C(t){if(!t)return null;const s=e=>{switch(e){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:t.storeConfig.magento_wishlist_general_is_enabled,wishlistMultipleListIsEnabled:t.storeConfig.enable_multiple_wishlists,wishlistMaxNumber:t.storeConfig.maximum_number_of_wishlists,fixedProductTaxesEnabled:t.storeConfig.fixed_product_taxes_enable,fixedProductTaxesApply:t.storeConfig.fixed_product_taxes_apply_tax_to_fpt,fixedProductTaxesEnabledDisplayInProductLists:s(t.storeConfig.fixed_product_taxes_display_prices_in_product_lists),fixedProductTaxesEnabledDisplayInSalesModules:s(t.storeConfig.fixed_product_taxes_display_prices_in_sales_modules),fixedProductTaxesEnabledDisplayInProductView:s(t.storeConfig.fixed_product_taxes_display_prices_on_product_view_page)}}const b=`
|
|
4
|
+
query STORE_CONFIG_QUERY {
|
|
5
|
+
storeConfig {
|
|
6
|
+
magento_wishlist_general_is_enabled
|
|
7
|
+
enable_multiple_wishlists
|
|
8
|
+
maximum_number_of_wishlists
|
|
9
|
+
fixed_product_taxes_enable
|
|
10
|
+
fixed_product_taxes_apply_tax_to_fpt
|
|
11
|
+
fixed_product_taxes_display_prices_in_product_lists
|
|
12
|
+
fixed_product_taxes_display_prices_in_sales_modules
|
|
13
|
+
fixed_product_taxes_display_prices_on_product_view_page
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`,D=async()=>c(b,{method:"GET",cache:"force-cache"}).then(({errors:t,data:s})=>t?_(t):C(s)),W=`
|
|
17
|
+
query GET_PRODUCT_BY_SKU($sku: String!) {
|
|
18
|
+
products(filter: { sku: { eq: $sku } }) {
|
|
19
|
+
items {
|
|
20
|
+
sku
|
|
21
|
+
name
|
|
22
|
+
thumbnail {
|
|
23
|
+
label
|
|
24
|
+
url
|
|
25
|
+
}
|
|
26
|
+
price_range {
|
|
27
|
+
minimum_price {
|
|
28
|
+
regular_price {
|
|
29
|
+
currency
|
|
30
|
+
value
|
|
31
|
+
}
|
|
32
|
+
final_price {
|
|
33
|
+
currency
|
|
34
|
+
value
|
|
35
|
+
}
|
|
36
|
+
discount {
|
|
37
|
+
amount_off
|
|
38
|
+
percent_off
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
stock_status
|
|
43
|
+
... on SimpleProduct {
|
|
44
|
+
stock_status
|
|
45
|
+
options {
|
|
46
|
+
uid
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
... on ConfigurableProduct {
|
|
50
|
+
configurable_options {
|
|
51
|
+
uid
|
|
52
|
+
attribute_uid
|
|
53
|
+
attribute_code
|
|
54
|
+
values {
|
|
55
|
+
uid
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
variants {
|
|
59
|
+
product {
|
|
60
|
+
sku
|
|
61
|
+
stock_status
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
... on BundleProduct {
|
|
66
|
+
items {
|
|
67
|
+
uid
|
|
68
|
+
title
|
|
69
|
+
options {
|
|
70
|
+
uid
|
|
71
|
+
label
|
|
72
|
+
quantity
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
`,N=async t=>{if(!t)throw Error("Product SKU is not set");return c(W,{variables:{sku:t}}).then(({errors:s,data:e})=>{var o;return s?_(s):(o=e==null?void 0:e.products)!=null&&o.items?y(e.products.items[0]):null})},G=`
|
|
80
|
+
query GET_WISHLISTS_QUERY(${T}) {
|
|
81
|
+
customer {
|
|
82
|
+
wishlists {
|
|
83
|
+
...WISHLIST_FRAGMENT
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
${x}
|
|
89
|
+
`,U=async()=>i.authenticated?c(G).then(({errors:t,data:s})=>{var e;return t?_(t):(e=s==null?void 0:s.customer)!=null&&e.wishlists?s.customer.wishlists.map(o=>S(o)):null}):h(),L=`
|
|
90
|
+
mutation ADD_PRODUCTS_TO_WISHLIST_MUTATION(
|
|
91
|
+
$wishlistId: ID!,
|
|
92
|
+
$wishlistItems: [WishlistItemInput!]!,
|
|
93
|
+
${T}
|
|
94
|
+
) {
|
|
95
|
+
addProductsToWishlist(
|
|
96
|
+
wishlistId: $wishlistId
|
|
97
|
+
wishlistItems: $wishlistItems
|
|
98
|
+
) {
|
|
99
|
+
wishlist {
|
|
100
|
+
...WISHLIST_FRAGMENT
|
|
101
|
+
}
|
|
102
|
+
user_errors {
|
|
103
|
+
code
|
|
104
|
+
message
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
${x}
|
|
110
|
+
`,M=async t=>{var p,m;if(!i.authenticated){const l=h();for(const u of t){const d=await N(u.sku);if(!((p=l.items)==null?void 0:p.some(n=>n.product.sku===u.sku))){let n={id:l.id,items:l.items};n.items=[...n.items,{product:d}],g(n),r.emit("wishlist/data",n),r.emit("wishlist/update",{action:"add",item:n.items[n.items.length-1]})}}return null}if(!i.wishlistId)throw Error("Wishlist ID is not set");const s={wishlistId:i.wishlistId,wishlistItems:t.map(({sku:l,parentSku:u,quantity:d,optionsUIDs:I,enteredOptions:n})=>({sku:l,parent_sku:u,quantity:d,selected_options:I,entered_options:n}))},{errors:e,data:o}=await c(L,{variables:s}),f=[...((m=o==null?void 0:o.addProductsToWishlist)==null?void 0:m.user_errors)??[],...e??[]];if(f.length>0)return _(f);const a=S(o.addProductsToWishlist.wishlist);return i.currentPage=1,r.emit("wishlist/data",a),r.emit("wishlist/update",{action:"add",item:a.items[a.items.length-1]}),a},R=()=>(i.wishlistId=null,i.authenticated=!1,Promise.resolve(null)),w=async()=>{if(i.initializing)return null;i.initializing=!0,i.config||(i.config=await D());const t=i.authenticated?await O():await k();return r.emit("wishlist/initialized",t),r.emit("wishlist/data",t),i.initializing=!1,t};async function O(){const t=await U(),s=t?t[0]:null;return s?(i.wishlistId=s.id,s):null}async function k(){try{return await h()}catch(t){throw console.error(t),t}}export{M as a,N as b,$ as c,U as d,w as e,O as f,D as g,k as h,P as i,R as r};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{events as E}from"@dropins/tools/event-bus.js";import{FetchGraphQL as P}from"@dropins/tools/fetch-graphql.js";function R(e){const t=document.cookie.split(";");for(const r of t)if(r.trim().startsWith(`${e}=`))return r.trim().substring(e.length+1);return null}const A={wishlistId:null,authenticated:!1,currentPage:1,pageSize:4},c=new Proxy(A,{set(e,t,r){if(e[t]=r,t==="wishlistId"){if(r===c.wishlistId)return!0;if(r===null)return document.cookie="DROPIN__WISHLIST__WISHLIST-ID=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/",!0;const i=new Date;i.setDate(i.getDate()+30),document.cookie=`DROPIN__WISHLIST__WISHLIST-ID=${r}; expires=${i.toUTCString()}; path=/`}return Reflect.set(e,t,r)},get(e,t){return t==="wishlistId"?R("DROPIN__WISHLIST__WISHLIST-ID"):e[t]}}),I="DROPIN__WISHLIST__WISHLIST__DATA";function N(e){if(e)try{localStorage.setItem(I,JSON.stringify(e))}catch(t){O(t)?console.error("LocalStorage quota exceeded:",t):console.error("Error saving wishlist:",t)}else localStorage.removeItem(I)}const O=e=>e instanceof DOMException&&e.name==="QuotaExceededError";function W(){try{const e=localStorage.getItem(I);return e?JSON.parse(e):{id:"",items:[]}}catch(e){return console.error("Error retrieving wishlist:",e),{id:"",items:[]}}}const{setEndpoint:J,setFetchGraphQlHeader:Z,removeFetchGraphQlHeader:K,setFetchGraphQlHeaders:Y,fetchGraphQl:M,getConfig:X}=new P().getMethods();function v(e){var t;return e?{name:e.name,sku:e.sku,uid:e.uid,image:w(e),stockStatus:e.stock_status,canonicalUrl:e.canonical_url,urlKey:e.url_key,categories:(t=e.categories)==null?void 0:t.map(r=>r.name),prices:F(e),productAttributes:y(e)}:null}function w(e){var t,r;return{src:(t=e.thumbnail)==null?void 0:t.url,alt:(r=e.thumbnail)==null?void 0:r.label}}function F(e){var t,r,i,s,n,a,u,o,l,_,m,p,d,f,g,h,S,T;return{regularPrice:{currency:(i=(r=(t=e.price_range)==null?void 0:t.minimum_price)==null?void 0:r.regular_price)==null?void 0:i.currency,value:(a=(n=(s=e.price_range)==null?void 0:s.minimum_price)==null?void 0:n.regular_price)==null?void 0:a.value},finalPrice:{currency:(l=(o=(u=e.price_range)==null?void 0:u.minimum_price)==null?void 0:o.final_price)==null?void 0:l.currency,value:(p=(m=(_=e.price_range)==null?void 0:_.minimum_price)==null?void 0:m.final_price)==null?void 0:p.value},discount:{amountOff:(g=(f=(d=e.price_range)==null?void 0:d.minimum_price)==null?void 0:f.discount)==null?void 0:g.amount_off,percentOff:(T=(S=(h=e.price_range)==null?void 0:h.minimum_price)==null?void 0:S.discount)==null?void 0:T.percent_off},fixedProductTaxes:G(e)}}function y(e){var t,r;return(r=(t=e.custom_attributesV2)==null?void 0:t.items)==null?void 0:r.map(i=>{const s=i.code.split("_").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ");return{...i,code:s}})}function G(e){var t,r,i;return(i=(r=(t=e.price_range)==null?void 0:t.minimum_price)==null?void 0:r.fixed_product_taxes)==null?void 0:i.map(s=>({money:{value:s.amount.value,currency:s.amount.currency},label:s.label}))}function L(e){return e?{id:e.id,updated_at:e.updated_at,sharing_code:e.sharing_code,items_count:e.items_count,total_pages:e.items_v2.page_info.total_pages,items:b(e)}:null}function b(e){var t,r;return(r=(t=e==null?void 0:e.items_v2)==null?void 0:t.items)!=null&&r.length?e.items_v2.items.map(i=>({id:i.id,quantity:i.quantity,description:i.description,added_at:i.added_at,product:v(i.product)})):[]}const D=e=>{const t=e.map(r=>r.message).join(" ");throw Error(t)},H=`
|
|
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
|
+
`,x=`
|
|
49
|
+
fragment PRODUCT_FRAGMENT on ProductInterface {
|
|
50
|
+
name
|
|
51
|
+
sku
|
|
52
|
+
uid
|
|
53
|
+
thumbnail {
|
|
54
|
+
url
|
|
55
|
+
label
|
|
56
|
+
}
|
|
57
|
+
url_key
|
|
58
|
+
categories {
|
|
59
|
+
url_path
|
|
60
|
+
url_key
|
|
61
|
+
name
|
|
62
|
+
}
|
|
63
|
+
stock_status
|
|
64
|
+
canonical_url
|
|
65
|
+
custom_attributesV2(filters: {is_visible_on_front: true}){
|
|
66
|
+
items {
|
|
67
|
+
code
|
|
68
|
+
...on AttributeValue {
|
|
69
|
+
value
|
|
70
|
+
}
|
|
71
|
+
...on AttributeSelectedOptions {
|
|
72
|
+
selected_options {
|
|
73
|
+
value
|
|
74
|
+
label
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
price_range {
|
|
80
|
+
...PRICE_RANGE_FRAGMENT
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
${H}
|
|
85
|
+
`,$=`
|
|
86
|
+
fragment CUSTOMIZABLE_OPTIONS_FRAGMENT on SelectedCustomizableOption {
|
|
87
|
+
type
|
|
88
|
+
customizable_option_uid
|
|
89
|
+
label
|
|
90
|
+
is_required
|
|
91
|
+
values {
|
|
92
|
+
label
|
|
93
|
+
value
|
|
94
|
+
price{
|
|
95
|
+
type
|
|
96
|
+
units
|
|
97
|
+
value
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
`,C=`
|
|
102
|
+
fragment WISHLIST_ITEM_FRAGMENT on WishlistItemInterface {
|
|
103
|
+
__typename
|
|
104
|
+
id
|
|
105
|
+
quantity
|
|
106
|
+
description
|
|
107
|
+
added_at
|
|
108
|
+
product {
|
|
109
|
+
...PRODUCT_FRAGMENT
|
|
110
|
+
}
|
|
111
|
+
customizable_options {
|
|
112
|
+
...CUSTOMIZABLE_OPTIONS_FRAGMENT
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
${x}
|
|
117
|
+
${$}
|
|
118
|
+
`,{pageSize:U,currentPage:k}=c,z=`
|
|
119
|
+
$pageSize: Int! = ${U},
|
|
120
|
+
$currentPage: Int! = ${k},
|
|
121
|
+
`,Q=`
|
|
122
|
+
pageSize: $pageSize,
|
|
123
|
+
currentPage: $currentPage,
|
|
124
|
+
`,V=`
|
|
125
|
+
fragment WISHLIST_FRAGMENT on Wishlist {
|
|
126
|
+
id
|
|
127
|
+
updated_at
|
|
128
|
+
sharing_code
|
|
129
|
+
items_count
|
|
130
|
+
items_v2(
|
|
131
|
+
${Q}
|
|
132
|
+
) {
|
|
133
|
+
items {
|
|
134
|
+
...WISHLIST_ITEM_FRAGMENT
|
|
135
|
+
}
|
|
136
|
+
page_info {
|
|
137
|
+
page_size
|
|
138
|
+
current_page
|
|
139
|
+
total_pages
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
${C}
|
|
145
|
+
`,q=`
|
|
146
|
+
mutation REMOVE_PRODUCTS_FROM_WISHLIST_MUTATION(
|
|
147
|
+
$wishlistId: ID!,
|
|
148
|
+
$wishlistItemsIds: [ID!]!,
|
|
149
|
+
${z}
|
|
150
|
+
) {
|
|
151
|
+
removeProductsFromWishlist(
|
|
152
|
+
wishlistId: $wishlistId
|
|
153
|
+
wishlistItemsIds: $wishlistItemsIds
|
|
154
|
+
) {
|
|
155
|
+
wishlist {
|
|
156
|
+
...WISHLIST_FRAGMENT
|
|
157
|
+
}
|
|
158
|
+
user_errors {
|
|
159
|
+
code
|
|
160
|
+
message
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
${V}
|
|
166
|
+
`,ee=async e=>{var a,u;if(!c.authenticated){const o=W(),l={...o,items:(a=o.items)==null?void 0:a.filter(_=>!e.map(m=>m.product.sku).includes(_.product.sku))};return N(l),E.emit("wishlist/data",l),null}if(!c.wishlistId)throw Error("Wishlist ID is not set");const t=e.map(o=>o.id),{errors:r,data:i}=await M(q,{variables:{wishlistId:c.wishlistId,wishlistItemsIds:t}}),s=[...((u=i==null?void 0:i.removeProductsFromWishlist)==null?void 0:u.user_errors)??[],...r??[]];if(s.length>0)return D(s);const n=L(i.removeProductsFromWishlist.wishlist);return c.currentPage=1,E.emit("wishlist/data",n),n};export{V as W,J as a,Z as b,K as c,Y as d,X as e,M as f,W as g,D as h,N as i,z as j,Q as k,C as l,v as m,ee as r,c as s,L as t};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
|
|
4
|
+
export interface EmptyWishlistProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
ctaLinkURL?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const EmptyWishlist: FunctionComponent<EmptyWishlistProps>;
|
|
8
|
+
//# sourceMappingURL=EmptyWishlist.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
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 './EmptyWishlist';
|
|
18
|
+
export { EmptyWishlist as default } from './EmptyWishlist';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
|
|
4
|
+
export interface ImageCarouselProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
className: string;
|
|
6
|
+
children: any;
|
|
7
|
+
images: {
|
|
8
|
+
src: string;
|
|
9
|
+
alt: string | undefined;
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
export declare const ImageCarousel: FunctionComponent<ImageCarouselProps>;
|
|
13
|
+
//# sourceMappingURL=ImageCarousel.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
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 { ImageCarousel } from './ImageCarousel';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './Login';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
import { Product } from '../../data/models';
|
|
4
|
+
|
|
5
|
+
export interface ProductItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
item?: Product;
|
|
7
|
+
onCartActionButtonClick?: () => boolean;
|
|
8
|
+
onTrashButtonClick?: () => boolean;
|
|
9
|
+
fixedProductTaxesEnabled: boolean;
|
|
10
|
+
fixedProductTaxesApply: boolean;
|
|
11
|
+
fixedProductTaxesEnabledDisplayInProductLists?: string;
|
|
12
|
+
fixedProductTaxesEnabledDisplayInSalesModules?: string;
|
|
13
|
+
fixedProductTaxesEnabledDisplayInProductView?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const ProductItem: FunctionComponent<ProductItemProps>;
|
|
16
|
+
//# sourceMappingURL=ProductItem.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
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 { ProductItem } from './ProductItem';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
|
@@ -0,0 +1,19 @@
|
|
|
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 './Wishlist';
|
|
18
|
+
export { Wishlist as default } from './Wishlist';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
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 './EmptyWishlist';
|
|
18
|
+
export * from './Wishlist';
|
|
19
|
+
export * from './ProductItem';
|
|
20
|
+
export * from './ImageCarousel';
|
|
21
|
+
export * from './Login';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
2
|
+
import { Container } from '../../../@adobe-commerce/elsie/src/lib';
|
|
3
|
+
|
|
4
|
+
export interface WishlistProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
routeEmptyWishlistCTA?: () => string;
|
|
6
|
+
moveProdToCart: (products: {
|
|
7
|
+
sku: string;
|
|
8
|
+
quantity: number;
|
|
9
|
+
}[]) => Promise<any>;
|
|
10
|
+
}
|
|
11
|
+
export declare const Wishlist: Container<WishlistProps>;
|
|
12
|
+
//# sourceMappingURL=Wishlist.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
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 './Wishlist';
|
|
18
|
+
export { Wishlist as default } from './Wishlist';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as n,jsxs as I,Fragment as B}from"@dropins/tools/preact-jsx-runtime.js";import*as W from"@dropins/tools/preact-compat.js";import{Suspense as H,lazy as t,useState as T,useCallback as x,useEffect as $,useMemo as O,Fragment as C}from"@dropins/tools/preact-compat.js";import{classes as L,isNumber as F,VComponent as M}from"@dropins/tools/lib.js";import{IllustratedMessage as z,Button as j,Icon as N,InLineAlert as U}from"@dropins/tools/components.js";import{S as q,a as G,W as J}from"../chunks/WishlistItem.js";import{s as w}from"../chunks/removeProductsFromWishlist.js";import{events as V}from"@dropins/tools/event-bus.js";import{g as K}from"../chunks/getWishlistById.js";import{useText as P,Text as k}from"@dropins/tools/i18n.js";import{a as Q,S as X}from"../chunks/HeartFilled.js";import{useCallback as R,useMemo as Y}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/fetch-graphql.js";const b=o=>W.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o},W.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),Z=Object.freeze(Object.defineProperty({__proto__:null,default:b},Symbol.toStringTag,{value:"Module"})),tt=({className:o,children:i,ctaLinkURL:s,...c})=>{const u=P({emptyWishlist:"Wishlist.EmptyWishlist.heading",message:"Wishlist.EmptyWishlist.message",cta:"Wishlist.EmptyWishlist.cta"});return n("div",{...c,className:L(["wishlist-empty-wishlist",o]),children:n(z,{className:L(["wishlist-empty-wishlist__wrapper",o]),"data-testid":"wishlist-empty-wishlist",heading:u.emptyWishlist,icon:n(N,{className:"wishlist-empty-wishlist__icon",source:Q}),message:n("p",{children:u.message}),action:s?n(j,{"data-testid":"wishlist-empty-wishlist-button",size:"medium",variant:"primary",type:"submit",href:s,children:u.cta},"routeHome"):void 0})})},et=function(){const i=typeof document<"u"&&document.createElement("link").relList;return i&&i.supports&&i.supports("modulepreload")?"modulepreload":"preload"}(),it=function(o){return"/"+o},D={},e=function(i,s,c){let u=Promise.resolve();if(s&&s.length>0){document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),l=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));u=Promise.allSettled(s.map(h=>{if(h=it(h),h in D)return;D[h]=!0;const v=h.endsWith(".css"),f=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${f}`))return;const r=document.createElement("link");if(r.rel=v?"stylesheet":et,v||(r.as="script"),r.crossOrigin="",r.href=h,l&&r.setAttribute("nonce",l),document.head.appendChild(r),v)return new Promise((a,p)=>{r.addEventListener("load",a),r.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${h}`)))})}))}function m(d){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=d,window.dispatchEvent(l),!l.defaultPrevented)throw d}return u.then(d=>{for(const l of d||[])l.status==="rejected"&&m(l.reason);return i().catch(m)})},rt=o=>o.reduce((s,c)=>{if(!c)return s;if(typeof c=="string"&&(s+=` ${c}`),Array.isArray(c)){const[u,m]=c;u&&m&&(s+=` ${u}`)}return s},"").trim(),st={Add:t(()=>e(()=>import("../chunks/Add.js"),[])),Bulk:t(()=>e(()=>import("../chunks/Bulk.js"),[])),Burger:t(()=>e(()=>import("../chunks/Burger.js"),[])),Cart:t(()=>e(()=>import("../chunks/WishlistItem.js").then(o=>o.C),[])),Check:t(()=>e(()=>import("../chunks/Check.js"),[])),ChevronDown:t(()=>e(()=>Promise.resolve().then(()=>Z),void 0)),ChevronUp:t(()=>e(()=>import("../chunks/ChevronUp.js"),[])),ChevronRight:t(()=>e(()=>import("../chunks/ChevronRight.js"),[])),Close:t(()=>e(()=>import("../chunks/Close.js"),[])),Heart:t(()=>e(()=>import("../chunks/HeartFilled.js").then(o=>o.H),[])),Minus:t(()=>e(()=>import("../chunks/Minus.js"),[])),Placeholder:t(()=>e(()=>import("../chunks/Placeholder.js"),[])),PlaceholderFilled:t(()=>e(()=>import("../chunks/PlaceholderFilled.js"),[])),Search:t(()=>e(()=>import("../chunks/Search.js"),[])),SearchFilled:t(()=>e(()=>import("../chunks/SearchFilled.js"),[])),Sort:t(()=>e(()=>import("../chunks/Sort.js"),[])),Star:t(()=>e(()=>import("../chunks/Star.js"),[])),View:t(()=>e(()=>import("../chunks/View.js"),[])),User:t(()=>e(()=>import("../chunks/User.js"),[])),Warning:t(()=>e(()=>import("../chunks/Warning.js"),[])),Locker:t(()=>e(()=>import("../chunks/Locker.js"),[])),Wallet:t(()=>e(()=>import("../chunks/Wallet.js"),[])),Card:t(()=>e(()=>import("../chunks/Card.js"),[])),Order:t(()=>e(()=>import("../chunks/Order.js"),[])),Delivery:t(()=>e(()=>import("../chunks/Delivery.js"),[])),OrderError:t(()=>e(()=>import("../chunks/OrderError.js"),[])),OrderSuccess:t(()=>e(()=>import("../chunks/OrderSuccess.js"),[])),PaymentError:t(()=>e(()=>import("../chunks/PaymentError.js"),[])),CheckWithCircle:t(()=>e(()=>import("../chunks/CheckWithCircle.js"),[])),WarningWithCircle:t(()=>e(()=>import("../chunks/WarningWithCircle.js"),[])),WarningFilled:t(()=>e(()=>import("../chunks/WarningFilled.js"),[])),InfoFilled:t(()=>e(()=>import("../chunks/InfoFilled.js"),[])),HeartFilled:t(()=>e(()=>import("../chunks/HeartFilled.js").then(o=>o.b),[])),Trash:t(()=>e(()=>import("../chunks/WishlistItem.js").then(o=>o.T),[])),Eye:t(()=>e(()=>import("../chunks/Eye.js"),[])),EyeClose:t(()=>e(()=>import("../chunks/EyeClose.js"),[])),Date:t(()=>e(()=>import("../chunks/Date.js"),[])),AddressBook:t(()=>e(()=>import("../chunks/AddressBook.js"),[])),EmptyBox:t(()=>e(()=>import("../chunks/EmptyBox.js"),[])),Coupon:t(()=>e(()=>import("../chunks/Coupon.js"),[])),Gift:t(()=>e(()=>import("../chunks/Gift.js"),[])),GiftCard:t(()=>e(()=>import("../chunks/GiftCard.js"),[]))};function S({source:o,size:i="24",stroke:s="2",viewBox:c="0 0 24 24",className:u,...m}){const d=typeof o=="string"?st[o]:null,l={className:rt(["dropin-icon",`dropin-icon--shape-stroke-${s}`,u]),width:i,height:i,viewBox:c};return n(H,{fallback:n("svg",{...m,...l}),children:d?n(d,{...m,...l}):n(o,{...m,...l})})}const ot=({totalPages:o=10,currentPage:i=1,onChange:s,className:c,...u})=>{const m=P({backwardButton:"Dropin.Pagination.backwardButton.ariaLabel",forwardButton:"Dropin.Pagination.forwardButton.ariaLabel"}),d=R(()=>{const r=Math.min(i+1,o);s==null||s(r)},[i,s,o]),l=R(()=>{const r=Math.max(i-1,1);s==null||s(r)},[i,s]),h=R(r=>{F(r)&&(s==null||s(r))},[s]),v=R((r,a)=>{let p=[];const _=(E,A)=>{for(let g=E;g<=A;g++)p.push({page:g,isActive:g===r,label:g})};return a<=5?_(1,a):r<=2?(_(1,2),p.push({page:"ellipsis",isActive:!1,label:"..."}),_(a-1,a)):r>=a-3?_(a-4,a):(_(r-1,r),p.push({page:"ellipsis",isActive:!1,label:"..."}),_(a-1,a)),p},[]),f=Y(()=>v(i,o),[v,i,o]);return I("div",{...u,className:L(["dropin-pagination",c]),children:[n("button",{type:"button","data-testid":"prev-button","aria-label":m.backwardButton,disabled:i===1,onClick:l,className:L(["dropin-pagination-arrow","dropin-pagination-arrow--backward"]),children:n(S,{size:"24",source:b})}),n("ul",{className:"dropin-pagination_list",children:f.map((r,a)=>n("li",{"data-testid":`dropin-pagination_list-item--${r.page}`,className:L(["dropin-pagination_list-item",`dropin-pagination_list-item--${r.page}`,["dropin-pagination_list-item--active",r.isActive]]),children:n("button",{type:"button","data-testid":`set-page-button-${r.page}`,onClick:()=>h(r.page),children:r.label})},`${r.page}_${a}`))}),n("button",{type:"button","data-testid":"next-button","aria-label":m.forwardButton,disabled:i===o,onClick:d,className:L(["dropin-pagination-arrow","dropin-pagination-arrow--forward"]),children:n(S,{size:"24",source:b})})]})},At=({routeEmptyWishlistCTA:o,moveProdToCart:i,...s})=>{const[c,u]=T(null),[m,d]=T(w.authenticated),l=P({addHeading:"Wishlist.Alert.addProduct.heading",addMessage:"Wishlist.Alert.addProduct.message",removeHeading:"Wishlist.Alert.removeProduct.heading",removeMessage:"Wishlist.Alert.removeProduct.message",moveHeading:"Wishlist.Alert.moveToCart.heading",moveMessage:"Wishlist.Alert.moveToCart.message",viewWishlist:"Wishlist.Alert.viewWishlist"}),h=a=>d(a),[v,f]=T(null),r=x(a=>{const{action:p,item:_}=a,E=l[`${p}Heading`],A=l[`${p}Message`],g={add:X,remove:G,move:q};f(n(U,{"data-testid":"wishlist-alert",heading:E,description:A.replace("{product}",_.product.name),type:"success",icon:n(N,{source:g[p],size:"16"}),actionButtonPosition:"top",additionalActions:[{label:l.viewWishlist,onClick:()=>{}}]}))},[l]);return $(()=>{const a=V.on("authenticated",h),p=V.on("wishlist/update",E=>r(E)),_=V.on("wishlist/data",E=>{u(E)});return()=>{a==null||a.off(),_==null||_.off(),p==null||p.off()}},[r]),n(nt,{...s,wishlistData:c,wishlistAlert:v,routeEmptyWishlistCTA:o,moveProdToCart:i,isLoggedIn:m})},nt=({className:o,wishlistData:i,wishlistAlert:s,isLoggedIn:c,moveProdToCart:u,routeEmptyWishlistCTA:m,...d})=>{const[l,h]=T(s),v=P({wishlistHeading:"Wishlist.Wishlist.heading"}),f=O(()=>{var _;return((_=i==null?void 0:i.items)==null?void 0:_.length)>0?i.items.map(E=>{var A;return n(J,{initialData:E,moveProdToCart:u},(A=E.product)==null?void 0:A.sku)}):null},[i,u]);$(()=>{if(s){h(s);const _=setTimeout(()=>{h(null)},5e3);return()=>clearTimeout(_)}},[s]);const r=O(()=>l?n(M,{node:l,className:"wishlist-wishlist__alert"}):null,[l]),a=O(()=>{var E;if(!f)return null;const _=c?i==null?void 0:i.items_count:i.items.length;return n("div",{className:"wishlist-wishlist__heading","data-testid":"wishlist-heading-wrapper",children:n("div",{className:"wishlist-wishlist__heading-text","data-testid":"default-wishlist-heading",children:(E=v.wishlistHeading)==null?void 0:E.split(" {count}").map((A,g)=>{var y;return I(C,{children:[A,g===0&&n("span",{className:"wishlist-wishlist__heading-count","data-testid":"wishlist-heading-count",children:`${_} products`})]},((y=i==null?void 0:i.id)==null?void 0:y.toString())+g)})})})},[v,f,i]),p=O(()=>!f||!c||i.total_pages===1?null:n(ot,{currentPage:w.currentPage||1,onChange:_=>{K(w.wishlistId,_,w.pageSize||10).then(()=>{w.currentPage=_}).catch(E=>{console.error("Failed to fetch wishlist data:",E)})},totalPages:i.total_pages}),[f,c,i]);return I("div",{...d,className:L(["wishlist-wishlist",o]),children:[r,f?I(B,{children:[a,p,n("div",{className:"wishlist-wishlist__content",children:f})]}):n("div",{className:L(["wishlist-wishlist__content","wishlist-wishlist__content--empty"]),children:I("div",{children:[n(tt,{"data-testid":"empty-wishlist",ctaLinkURL:m==null?void 0:m()}),!c&&n(lt,{})]})})]})},lt=()=>I("div",{className:"wishlist-login__sign-in",children:[n("a",{"data-testid":"log-in-link",className:"wishlist-login__link",href:"/#",target:"_blank",rel:"noreferrer",children:n(k,{id:"Wishlist.Login.logIn"})}),n(k,{id:"Wishlist.Login.sync"})]});export{At as Wishlist,At as default};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
2
|
+
import { Container } from '../../../@adobe-commerce/elsie/src/lib';
|
|
3
|
+
import { Item } from '../../data/models';
|
|
4
|
+
|
|
5
|
+
export interface WishlistItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
initialData?: Item | null;
|
|
7
|
+
moveProdToCart: (products: {
|
|
8
|
+
sku: string;
|
|
9
|
+
quantity: number;
|
|
10
|
+
}[]) => Promise<any>;
|
|
11
|
+
}
|
|
12
|
+
export declare const WishlistItem: Container<WishlistItemProps, Item | null>;
|
|
13
|
+
//# sourceMappingURL=WishlistItem.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
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 './WishlistItem';
|
|
18
|
+
export { WishlistItem as default } from './WishlistItem';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{W as f,W as l}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"@dropins/tools/i18n.js";export{f as WishlistItem,l as default};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
2
|
+
import { Container } from '../../../@adobe-commerce/elsie/src/lib';
|
|
3
|
+
import { Product } from '../../data/models';
|
|
4
|
+
|
|
5
|
+
export interface WishlistToggleProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
product: Product;
|
|
7
|
+
}
|
|
8
|
+
export declare const WishlistToggle: Container<WishlistToggleProps>;
|
|
9
|
+
//# sourceMappingURL=WishlistToggle.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
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 './WishlistToggle';
|
|
18
|
+
export { WishlistToggle as default } from './WishlistToggle';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{useState as o,useEffect as w}from"@dropins/tools/preact-compat.js";import{Button as v,Icon as d}from"@dropins/tools/components.js";import{events as a}from"@dropins/tools/event-bus.js";import{s as y,g as S,r as C}from"../chunks/removeProductsFromWishlist.js";import{c as P,a as x}from"../chunks/initializeWishlist.js";import{S as A,a as D}from"../chunks/HeartFilled.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const G=({product:i})=>{const[m,u]=o(y.authenticated),[n,e]=o(!1),[h,l]=o(null),{isGuestWishlistEnabled:f}=P.getConfig();w(()=>{const p=t=>u(t),k=t=>{t.action==="add"&&t.item.product.sku===i.sku&&(l(t.item),e(!0))},W=()=>{var c;const t=S(),r=(c=t==null?void 0:t.items)==null?void 0:c.find(I=>I.product.sku===i.sku);l(r||null),e(!!r)};a.on("authenticated",p),a.on("wishlist/update",k),a.on("wishlist/data",W)},[i.sku]);const g=async()=>{n?(await C([h]),e(!1)):await x([{sku:i.sku,quantity:1}])};return!m&&!f?null:s(v,{"data-testid":"wishlist-toggle",size:"medium",variant:"tertiary",icon:n?s("span",{"data-testid":"icon-filled",children:s(d,{source:A})}):s("span",{"data-testid":"icon-empty",children:s(d,{source:D})}),onClick:g})};export{G as WishlistToggle,G as default};
|
|
@@ -0,0 +1,20 @@
|
|
|
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 './WishlistItem';
|
|
18
|
+
export * from './Wishlist';
|
|
19
|
+
export * from './WishlistToggle';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|