@dropins/storefront-cart 1.5.0-beta1 → 1.5.0-beta3

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,21 +1,30 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{s as a,f as T,h as m}from"./resetCart.js";import{C as u,t as C}from"./refreshCart.js";import{events as s}from"@dropins/tools/event-bus.js";import{b as O}from"./acdl.js";import{CART_FRAGMENT as N}from"../fragments.js";const A=`
4
- mutation SET_GIFT_OPTIONS_ON_CART_MUTATION($cartId: String!, $giftMessage: GiftMessageInput, $giftWrappingId: ID, $giftReceiptIncluded: Boolean!, $printedCardIncluded: Boolean!, ${u}) {
5
- setGiftOptionsOnCart(
6
- input: {
7
- cart_id: $cartId
8
- gift_message: $giftMessage
9
- gift_wrapping_id: $giftWrappingId
10
- gift_receipt_included: $giftReceiptIncluded
11
- printed_card_included: $printedCardIncluded
12
- }
3
+ import{s as a,f as l,h as m}from"./resetCart.js";import{t as T}from"./refreshCart.js";import{events as s}from"@dropins/tools/event-bus.js";import{b as C}from"./acdl.js";import{CART_FRAGMENT as O}from"../fragments.js";const $=`
4
+ mutation SET_GIFT_OPTIONS_ON_CART_MUTATION(
5
+ $cartId: String!,
6
+ $giftMessage: GiftMessageInput,
7
+ $giftWrappingId: ID,
8
+ $giftReceiptIncluded: Boolean!,
9
+ $printedCardIncluded: Boolean!,
10
+ $pageSize: Int! = 100,
11
+ $currentPage: Int! = 1,
12
+ $itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC}
13
13
  ) {
14
- cart {
15
- ...CART_FRAGMENT
16
- }
17
- }
14
+ setGiftOptionsOnCart(
15
+ input: {
16
+ cart_id: $cartId
17
+ gift_message: $giftMessage
18
+ gift_wrapping_id: $giftWrappingId
19
+ gift_receipt_included: $giftReceiptIncluded
20
+ printed_card_included: $printedCardIncluded
21
+ }
22
+ ) {
23
+ cart {
24
+ ...CART_FRAGMENT
25
+ }
26
+ }
18
27
  }
19
- ${N}
20
- `,E=async d=>{const e=a.cartId;if(!e)throw Error("Cart ID is not set");const{recipientName:o,senderName:p,message:c,giftReceiptIncluded:f,printedCardIncluded:g,giftWrappingId:I,isGiftWrappingSelected:_}=d;return T(A,{variables:{cartId:e,giftMessage:{from:p,to:o,message:c},giftWrappingId:_?I:null,giftReceiptIncluded:f,printedCardIncluded:g}}).then(({errors:l,data:r})=>{var n;const i=[...((n=r==null?void 0:r.addProductsToCart)==null?void 0:n.user_errors)??[],...l??[]];if(i.length>0)return m(i);const t=C(r.setGiftOptionsOnCart.cart);return s.emit("cart/updated",t),s.emit("cart/data",t),t&&O(t,[],a.locale??"en-US"),t})};export{E as s};
28
+ ${O}
29
+ `,R=async d=>{const r=a.cartId;if(!r)throw Error("Cart ID is not set");const{recipientName:o,senderName:p,message:c,giftReceiptIncluded:f,printedCardIncluded:g,giftWrappingId:I,isGiftWrappingSelected:u}=d;return l($,{variables:{cartId:r,giftMessage:{from:p,to:o,message:c},giftWrappingId:u?I:null,giftReceiptIncluded:f,printedCardIncluded:g}}).then(({errors:_,data:e})=>{var n;const i=[...((n=e==null?void 0:e.addProductsToCart)==null?void 0:n.user_errors)??[],..._??[]];if(i.length>0)return m(i);const t=T(e.setGiftOptionsOnCart.cart);return s.emit("cart/updated",t),s.emit("cart/data",t),t&&C(t,[],a.locale??"en-US"),t})};export{R as s};
21
30
  //# sourceMappingURL=setGiftOptionsOnCart.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"setGiftOptionsOnCart.js","sources":["/@dropins/storefront-cart/src/api/setGiftOptionsOnCart/graphql/UpdateGiftOptionsMutation.ts","/@dropins/storefront-cart/src/api/setGiftOptionsOnCart/setGiftOptionsOnCart.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CART_FRAGMENT } from '@/cart/api/graphql/CartFragment';\nimport { CART_ITEMS_PAGINATION_ARGUMENTS } from '@/cart/api/graphql/arguments';\n\nexport const SET_GIFT_OPTIONS_ON_CART_MUTATION = `\n mutation SET_GIFT_OPTIONS_ON_CART_MUTATION($cartId: String!, $giftMessage: GiftMessageInput, $giftWrappingId: ID, $giftReceiptIncluded: Boolean!, $printedCardIncluded: Boolean!, ${CART_ITEMS_PAGINATION_ARGUMENTS}) {\n setGiftOptionsOnCart(\n input: {\n cart_id: $cartId\n gift_message: $giftMessage\n gift_wrapping_id: $giftWrappingId\n gift_receipt_included: $giftReceiptIncluded\n printed_card_included: $printedCardIncluded\n }\n ) {\n cart {\n ...CART_FRAGMENT\n }\n }\n}\n${CART_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { state } from '@/cart/lib/state';\nimport { fetchGraphQl } from '@/cart/api';\nimport { handleFetchError } from '@/cart/lib/fetch-error';\nimport { CartModel } from '@/cart/data/models';\nimport { transformCart } from '@/cart/data/transforms';\nimport { events } from '@adobe-commerce/event-bus';\nimport { SET_GIFT_OPTIONS_ON_CART_MUTATION } from './graphql/UpdateGiftOptionsMutation';\nimport { publishCartUpdateEvents } from '@/cart/lib/acdl';\nimport { GiftFormDataType } from '@/cart/types';\n\nexport const setGiftOptionsOnCart = async (\n giftForm: GiftFormDataType\n): Promise<CartModel | null> => {\n const cartId = state.cartId;\n\n if (!cartId) {\n throw Error('Cart ID is not set');\n }\n\n const {\n recipientName,\n senderName,\n message,\n giftReceiptIncluded,\n printedCardIncluded,\n giftWrappingId,\n isGiftWrappingSelected,\n } = giftForm;\n\n return fetchGraphQl(SET_GIFT_OPTIONS_ON_CART_MUTATION, {\n variables: {\n cartId,\n giftMessage: {\n from: senderName,\n to: recipientName,\n message,\n },\n giftWrappingId: isGiftWrappingSelected ? giftWrappingId : null,\n giftReceiptIncluded,\n printedCardIncluded,\n },\n }).then(({ errors, data }) => {\n // handle errors\n const _errors = [\n ...(data?.addProductsToCart?.user_errors ?? []),\n ...(errors ?? []),\n ];\n\n if (_errors.length > 0) return handleFetchError(_errors);\n\n const payload = transformCart(data.setGiftOptionsOnCart.cart);\n\n // emit events\n events.emit('cart/updated', payload);\n events.emit('cart/data', payload);\n\n if (payload) {\n publishCartUpdateEvents(payload, [], state.locale ?? 'en-US');\n }\n\n return payload;\n });\n};\n"],"names":["SET_GIFT_OPTIONS_ON_CART_MUTATION","CART_ITEMS_PAGINATION_ARGUMENTS","CART_FRAGMENT","setGiftOptionsOnCart","giftForm","cartId","state","recipientName","senderName","message","giftReceiptIncluded","printedCardIncluded","giftWrappingId","isGiftWrappingSelected","fetchGraphQl","errors","data","_errors","_a","handleFetchError","payload","transformCart","events","publishCartUpdateEvents"],"mappings":"gOAoBO,MAAMA,EAAoC;AAAA,sLACqIC,CAA+B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAenNC,CAAa;AAAA,ECTFC,EAAuB,MAClCC,GAC8B,CAC9B,MAAMC,EAASC,EAAM,OAErB,GAAI,CAACD,EACH,MAAM,MAAM,oBAAoB,EAG5B,KAAA,CACJ,cAAAE,EACA,WAAAC,EACA,QAAAC,EACA,oBAAAC,EACA,oBAAAC,EACA,eAAAC,EACA,uBAAAC,CAAA,EACET,EAEJ,OAAOU,EAAad,EAAmC,CACrD,UAAW,CACT,OAAAK,EACA,YAAa,CACX,KAAMG,EACN,GAAID,EACJ,QAAAE,CACF,EACA,eAAgBI,EAAyBD,EAAiB,KAC1D,oBAAAF,EACA,oBAAAC,CAAA,CAEH,CAAA,EAAE,KAAK,CAAC,CAAE,OAAAI,EAAQ,KAAAC,KAAW,OAE5B,MAAMC,EAAU,CACd,KAAIC,EAAAF,GAAA,YAAAA,EAAM,oBAAN,YAAAE,EAAyB,cAAe,CAAC,EAC7C,GAAIH,GAAU,CAAA,CAChB,EAEA,GAAIE,EAAQ,OAAS,EAAG,OAAOE,EAAiBF,CAAO,EAEvD,MAAMG,EAAUC,EAAcL,EAAK,qBAAqB,IAAI,EAGrD,OAAAM,EAAA,KAAK,eAAgBF,CAAO,EAC5BE,EAAA,KAAK,YAAaF,CAAO,EAE5BA,GACFG,EAAwBH,EAAS,CAAA,EAAId,EAAM,QAAU,OAAO,EAGvDc,CAAA,CACR,CACH"}
1
+ {"version":3,"file":"setGiftOptionsOnCart.js","sources":["/@dropins/storefront-cart/src/api/setGiftOptionsOnCart/graphql/UpdateGiftOptionsMutation.ts","/@dropins/storefront-cart/src/api/setGiftOptionsOnCart/setGiftOptionsOnCart.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CART_FRAGMENT } from '@/cart/api/graphql/CartFragment';\n\nexport const SET_GIFT_OPTIONS_ON_CART_MUTATION = `\n mutation SET_GIFT_OPTIONS_ON_CART_MUTATION(\n $cartId: String!, \n $giftMessage: GiftMessageInput, \n $giftWrappingId: ID, \n $giftReceiptIncluded: Boolean!, \n $printedCardIncluded: Boolean!, \n $pageSize: Int! = 100,\n $currentPage: Int! = 1,\n $itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC}\n ) {\n setGiftOptionsOnCart(\n input: {\n cart_id: $cartId\n gift_message: $giftMessage\n gift_wrapping_id: $giftWrappingId\n gift_receipt_included: $giftReceiptIncluded\n printed_card_included: $printedCardIncluded\n }\n ) {\n cart {\n ...CART_FRAGMENT\n }\n }\n}\n${CART_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { state } from '@/cart/lib/state';\nimport { fetchGraphQl } from '@/cart/api';\nimport { handleFetchError } from '@/cart/lib/fetch-error';\nimport { CartModel } from '@/cart/data/models';\nimport { transformCart } from '@/cart/data/transforms';\nimport { events } from '@adobe-commerce/event-bus';\nimport { SET_GIFT_OPTIONS_ON_CART_MUTATION } from './graphql/UpdateGiftOptionsMutation';\nimport { publishCartUpdateEvents } from '@/cart/lib/acdl';\nimport { GiftFormDataType } from '@/cart/types';\n\nexport const setGiftOptionsOnCart = async (\n giftForm: GiftFormDataType\n): Promise<CartModel | null> => {\n const cartId = state.cartId;\n\n if (!cartId) {\n throw Error('Cart ID is not set');\n }\n\n const {\n recipientName,\n senderName,\n message,\n giftReceiptIncluded,\n printedCardIncluded,\n giftWrappingId,\n isGiftWrappingSelected,\n } = giftForm;\n\n return fetchGraphQl(SET_GIFT_OPTIONS_ON_CART_MUTATION, {\n variables: {\n cartId,\n giftMessage: {\n from: senderName,\n to: recipientName,\n message,\n },\n giftWrappingId: isGiftWrappingSelected ? giftWrappingId : null,\n giftReceiptIncluded,\n printedCardIncluded,\n },\n }).then(({ errors, data }) => {\n // handle errors\n const _errors = [\n ...(data?.addProductsToCart?.user_errors ?? []),\n ...(errors ?? []),\n ];\n\n if (_errors.length > 0) return handleFetchError(_errors);\n\n const payload = transformCart(data.setGiftOptionsOnCart.cart);\n\n // emit events\n events.emit('cart/updated', payload);\n events.emit('cart/data', payload);\n\n if (payload) {\n publishCartUpdateEvents(payload, [], state.locale ?? 'en-US');\n }\n\n return payload;\n });\n};\n"],"names":["SET_GIFT_OPTIONS_ON_CART_MUTATION","CART_FRAGMENT","setGiftOptionsOnCart","giftForm","cartId","state","recipientName","senderName","message","giftReceiptIncluded","printedCardIncluded","giftWrappingId","isGiftWrappingSelected","fetchGraphQl","errors","data","_errors","_a","handleFetchError","payload","transformCart","events","publishCartUpdateEvents"],"mappings":"yNAmBO,MAAMA,EAAoC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAyB/CC,CAAa;AAAA,ECjBFC,EAAuB,MAClCC,GAC8B,CAC9B,MAAMC,EAASC,EAAM,OAErB,GAAI,CAACD,EACH,MAAM,MAAM,oBAAoB,EAG5B,KAAA,CACJ,cAAAE,EACA,WAAAC,EACA,QAAAC,EACA,oBAAAC,EACA,oBAAAC,EACA,eAAAC,EACA,uBAAAC,CAAA,EACET,EAEJ,OAAOU,EAAab,EAAmC,CACrD,UAAW,CACT,OAAAI,EACA,YAAa,CACX,KAAMG,EACN,GAAID,EACJ,QAAAE,CACF,EACA,eAAgBI,EAAyBD,EAAiB,KAC1D,oBAAAF,EACA,oBAAAC,CAAA,CAEH,CAAA,EAAE,KAAK,CAAC,CAAE,OAAAI,EAAQ,KAAAC,KAAW,OAE5B,MAAMC,EAAU,CACd,KAAIC,EAAAF,GAAA,YAAAA,EAAM,oBAAN,YAAAE,EAAyB,cAAe,CAAC,EAC7C,GAAIH,GAAU,CAAA,CAChB,EAEA,GAAIE,EAAQ,OAAS,EAAG,OAAOE,EAAiBF,CAAO,EAEvD,MAAMG,EAAUC,EAAcL,EAAK,qBAAqB,IAAI,EAGrD,OAAAM,EAAA,KAAK,eAAgBF,CAAO,EAC5BE,EAAA,KAAK,YAAaF,CAAO,EAE5BA,GACFG,EAAwBH,EAAS,CAAA,EAAId,EAAM,QAAU,OAAO,EAGvDc,CAAA,CACR,CACH"}
@@ -1,10 +1,12 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{s as h,f as _,h as A}from"./resetCart.js";import{C as E,t as U}from"./refreshCart.js";import{events as T}from"@dropins/tools/event-bus.js";import{g as R}from"./persisted-data.js";import{CART_FRAGMENT as P}from"../fragments.js";import{b as O}from"./acdl.js";const g=`
3
+ import{s as C,f as _,h as E}from"./resetCart.js";import{t as A}from"./refreshCart.js";import{events as T}from"@dropins/tools/event-bus.js";import{g}from"./persisted-data.js";import{CART_FRAGMENT as D}from"../fragments.js";import{b as U}from"./acdl.js";const S=`
4
4
  mutation ADD_PRODUCTS_TO_CART_MUTATION(
5
5
  $cartId: String!,
6
6
  $cartItems: [CartItemInput!]!,
7
- ${E}
7
+ $pageSize: Int! = 100,
8
+ $currentPage: Int! = 1,
9
+ $itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC}
8
10
  ) {
9
11
  addProductsToCart(
10
12
  cartId: $cartId
@@ -20,12 +22,14 @@ import{s as h,f as _,h as A}from"./resetCart.js";import{C as E,t as U}from"./ref
20
22
  }
21
23
  }
22
24
 
23
- ${P}
24
- `,S=`
25
+ ${D}
26
+ `,O=`
25
27
  mutation UPDATE_PRODUCTS_FROM_CART_MUTATION(
26
28
  $cartId: String!,
27
29
  $cartItems: [CartItemUpdateInput!]!,
28
- ${E}
30
+ $pageSize: Int! = 100,
31
+ $currentPage: Int! = 1,
32
+ $itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC}
29
33
  ) {
30
34
  updateCartItems(
31
35
  input: {
@@ -40,6 +44,6 @@ import{s as h,f as _,h as A}from"./resetCart.js";import{C as E,t as U}from"./ref
40
44
  }
41
45
  }
42
46
 
43
- ${P}
44
- `,D=(p,c)=>{const i=[];return p.filter(t=>t.errors&&c.some(n=>n===t.uid)).forEach(t=>{var n;(n=t.errors)==null||n.forEach(e=>{i.push({message:e.message,path:[t.uid],extensions:{category:e.code}})})}),i},$=(p,c)=>{const i=[],t=[],n=[];return p.forEach(e=>{const s=c.find(r=>r.uid===e.uid);if(s)if(e.optionsUIDs){const r=Object.values((s==null?void 0:s.selectedOptionsUIDs)??{}),{sku:o,topLevelSku:m}=s,{optionsUIDs:u,enteredOptions:a,quantity:d,customFields:l}=e;i.push({sku:o,parentSku:m,quantity:d,optionsUIDs:u,enteredOptions:a,customFields:l}),e.optionsUIDs.some(f=>!r.includes(f))&&t.push(e.uid)}else if(e.customFields){const{sku:r,topLevelSku:o}=s,{optionsUIDs:m,enteredOptions:u,quantity:a,customFields:d}=e;i.push({sku:r,parentSku:o,quantity:a,optionsUIDs:m,enteredOptions:u,customFields:d}),t.push(e.uid)}else n.push({uid:e.uid,quantity:e.quantity,giftOptions:e.giftOptions,customFields:e.customFields});else throw Error(`Invalid Cart Item UID: No matching cart entry found for ${e.uid}`)}),{itemsToAdd:i,itemsToRemove:t,itemsToUpdate:n}},F=0,w=async p=>{const c=h.cartId,i=R();if(!c)return Promise.reject(new Error("Cart ID is not set"));if(!i)return Promise.reject(new Error("Cart is not set"));const{itemsToAdd:t,itemsToRemove:n,itemsToUpdate:e}=$(p,i.items);let s=[];return t.length>0&&s.push(_(g,{variables:{cartId:c,cartItems:t.map(({parentSku:r,quantity:o,optionsUIDs:m,enteredOptions:u,customFields:a})=>({sku:r,quantity:o,selected_options:m,entered_options:u,...a||{}}))}}).then(({errors:r,data:o})=>{var a,d,l,f;const m=D(((d=(a=o==null?void 0:o.addProductsToCart)==null?void 0:a.cart)==null?void 0:d.itemsV2.items)||[],p.map(I=>I.uid)),u=[...((l=o==null?void 0:o.addProductsToCart)==null?void 0:l.user_errors)??[],...r??[],...m];return u.length>0?A(u):n.length>0?C(c,n.map(I=>({uid:I,quantity:F}))).catch(I=>Promise.reject(new Error(`Failed to update products in cart: ${I}`))):Promise.resolve(U((f=o==null?void 0:o.addProductsToCart)==null?void 0:f.cart))}).then(r=>(T.emit("cart/updated",r),T.emit("cart/data",r),O(r,p,h.locale??"en-US"),Promise.resolve(r))).catch(r=>Promise.reject(new Error(`Failed to add products to cart: ${r}`)))),e.length>0&&s.push(C(c,e).catch(r=>Promise.reject(new Error(r)))),Promise.all(s).then(r=>r[r.length-1])},C=async(p,c)=>_(S,{variables:{cartId:p,cartItems:c.map(({uid:i,quantity:t,giftOptions:n})=>({cart_item_uid:i,quantity:t,...n}))}}).then(({errors:i,data:t})=>{var r,o,m;const n=D(((o=(r=t==null?void 0:t.updateCartItems)==null?void 0:r.cart)==null?void 0:o.itemsV2.items)||[],c.map(u=>u.uid)),e=[...((m=t==null?void 0:t.updateCartItems)==null?void 0:m.user_errors)??[],...i??[],...n],s=(t==null?void 0:t.updateCartItems)&&U(t.updateCartItems.cart);if(s&&T.emit("cart/data",s),e.length>0)return A(e);if(T.emit("cart/updated",s),s){const u=s.items.filter(a=>c.some(d=>d.uid===a.uid));T.emit("cart/product/updated",u)}return s&&O(s,c,h.locale??"en-US"),s});export{g as A,w as u};
47
+ ${D}
48
+ `,P=(m,c)=>{const u=[];return m.filter(t=>t.errors&&c.some(n=>n===t.uid)).forEach(t=>{var n;(n=t.errors)==null||n.forEach(e=>{u.push({message:e.message,path:[t.uid],extensions:{category:e.code}})})}),u},R=(m,c)=>{const u=[],t=[],n=[];return m.forEach(e=>{const s=c.find(r=>r.uid===e.uid);if(s)if(e.optionsUIDs){const r=Object.values((s==null?void 0:s.selectedOptionsUIDs)??{}),{sku:o,topLevelSku:p}=s,{optionsUIDs:i,enteredOptions:a,quantity:d,customFields:l}=e;u.push({sku:o,parentSku:p,quantity:d,optionsUIDs:i,enteredOptions:a,customFields:l}),e.optionsUIDs.some(f=>!r.includes(f))&&t.push(e.uid)}else if(e.customFields){const{sku:r,topLevelSku:o}=s,{optionsUIDs:p,enteredOptions:i,quantity:a,customFields:d}=e;u.push({sku:r,parentSku:o,quantity:a,optionsUIDs:p,enteredOptions:i,customFields:d}),t.push(e.uid)}else n.push({uid:e.uid,quantity:e.quantity,giftOptions:e.giftOptions,customFields:e.customFields});else throw Error(`Invalid Cart Item UID: No matching cart entry found for ${e.uid}`)}),{itemsToAdd:u,itemsToRemove:t,itemsToUpdate:n}},$=0,j=async m=>{const c=C.cartId,u=g();if(!c)return Promise.reject(new Error("Cart ID is not set"));if(!u)return Promise.reject(new Error("Cart is not set"));const{itemsToAdd:t,itemsToRemove:n,itemsToUpdate:e}=R(m,u.items);let s=[];return t.length>0&&s.push(_(S,{variables:{cartId:c,cartItems:t.map(({parentSku:r,quantity:o,optionsUIDs:p,enteredOptions:i,customFields:a})=>({sku:r,quantity:o,selected_options:p,entered_options:i,...a||{}}))}}).then(({errors:r,data:o})=>{var a,d,l,f;const p=P(((d=(a=o==null?void 0:o.addProductsToCart)==null?void 0:a.cart)==null?void 0:d.itemsV2.items)||[],m.map(I=>I.uid)),i=[...((l=o==null?void 0:o.addProductsToCart)==null?void 0:l.user_errors)??[],...r??[],...p];return i.length>0?E(i):n.length>0?h(c,n.map(I=>({uid:I,quantity:$}))).catch(I=>Promise.reject(new Error(`Failed to update products in cart: ${I}`))):Promise.resolve(A((f=o==null?void 0:o.addProductsToCart)==null?void 0:f.cart))}).then(r=>(T.emit("cart/updated",r),T.emit("cart/data",r),U(r,m,C.locale??"en-US"),Promise.resolve(r))).catch(r=>Promise.reject(new Error(`Failed to add products to cart: ${r}`)))),e.length>0&&s.push(h(c,e).catch(r=>Promise.reject(new Error(r)))),Promise.all(s).then(r=>r[r.length-1])},h=async(m,c)=>_(O,{variables:{cartId:m,cartItems:c.map(({uid:u,quantity:t,giftOptions:n})=>({cart_item_uid:u,quantity:t,...n}))}}).then(({errors:u,data:t})=>{var r,o,p;const n=P(((o=(r=t==null?void 0:t.updateCartItems)==null?void 0:r.cart)==null?void 0:o.itemsV2.items)||[],c.map(i=>i.uid)),e=[...((p=t==null?void 0:t.updateCartItems)==null?void 0:p.user_errors)??[],...u??[],...n],s=(t==null?void 0:t.updateCartItems)&&A(t.updateCartItems.cart);if(s&&T.emit("cart/data",s),e.length>0)return E(e);if(T.emit("cart/updated",s),s){const i=s.items.filter(a=>c.some(d=>d.uid===a.uid));T.emit("cart/product/updated",i)}return s&&U(s,c,C.locale??"en-US"),s});export{S as A,j as u};
45
49
  //# sourceMappingURL=updateProductsFromCart.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"updateProductsFromCart.js","sources":["/@dropins/storefront-cart/src/api/addProductsToCart/graphql/AddProductsToCartMutation.ts","/@dropins/storefront-cart/src/api/updateProductsFromCart/graphql/UpdateProductsMutation.ts","/@dropins/storefront-cart/src/api/updateProductsFromCart/updateProductsFromCart.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CART_ITEMS_PAGINATION_ARGUMENTS } from '@/cart/api/graphql/arguments';\nimport { CART_FRAGMENT } from '@/cart/api/graphql/CartFragment';\n\nexport const ADD_PRODUCTS_TO_CART_MUTATION = `\n mutation ADD_PRODUCTS_TO_CART_MUTATION(\n $cartId: String!, \n $cartItems: [CartItemInput!]!,\n ${CART_ITEMS_PAGINATION_ARGUMENTS}\n ) {\n addProductsToCart(\n cartId: $cartId\n cartItems: $cartItems\n ) {\n cart {\n ...CART_FRAGMENT\n }\n user_errors {\n code\n message\n }\n }\n }\n \n ${CART_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CART_ITEMS_PAGINATION_ARGUMENTS } from '@/cart/api/graphql/arguments';\nimport { CART_FRAGMENT } from '@/cart/api/graphql/CartFragment';\n\nexport const UPDATE_PRODUCTS_FROM_CART_MUTATION = `\n mutation UPDATE_PRODUCTS_FROM_CART_MUTATION(\n $cartId: String!, \n $cartItems: [CartItemUpdateInput!]!,\n ${CART_ITEMS_PAGINATION_ARGUMENTS}\n ) {\n updateCartItems(\n input: {\n cart_id: $cartId\n cart_items: $cartItems\n }\n ) {\n cart {\n ...CART_FRAGMENT\n }\n\n }\n }\n\n ${CART_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { state } from '@/cart/lib/state';\nimport { fetchGraphQl } from '@/cart/api';\nimport { handleFetchError } from '@/cart/lib/fetch-error';\nimport { CartModel } from '@/cart/data/models';\nimport { transformCart } from '@/cart/data/transforms';\nimport { events } from '@adobe-commerce/event-bus';\nimport { publishCartUpdateEvents } from '@/cart/lib/acdl';\nimport { getPersistedCartData } from '@/cart/lib/persisted-data';\nimport { ADD_PRODUCTS_TO_CART_MUTATION } from '../addProductsToCart/graphql/AddProductsToCartMutation';\nimport { UPDATE_PRODUCTS_FROM_CART_MUTATION } from './graphql/UpdateProductsMutation';\n\ntype UpdateProductsFromCart = Array<{\n uid: string;\n quantity: number;\n sku?: string;\n parentSku?: string;\n optionsUIDs?: string[];\n enteredOptions?: { uid: string; value: string }[];\n giftOptions?: {\n gift_wrapping_id?: string | null;\n gift_message: {\n to: string;\n from: string;\n message: string;\n };\n };\n customFields?: Record<string, any>;\n}>;\n\ntype ItemError = {\n message: string;\n path?: string[];\n extensions?: {\n category: string;\n };\n};\n\n/**\n * Collects individual item errors from cart items response\n * @param cartItems - The cart items from the response\n * @param updatedItemUIDs - Array of UIDs of items that were updated\n * @returns Array of ItemError objects\n */\nconst collectCartItemErrors = (\n cartItems: Array<{\n uid: string;\n errors?: Array<{ message: string; code: string }>;\n }>,\n updatedItemUIDs: string[]\n): ItemError[] => {\n const itemErrors: ItemError[] = [];\n\n cartItems\n .filter(\n (item) => item.errors && updatedItemUIDs.some((uid) => uid === item.uid)\n )\n .forEach((item) => {\n item.errors?.forEach((error) => {\n itemErrors.push({\n message: error.message,\n path: [item.uid],\n extensions: {\n category: error.code,\n },\n });\n });\n });\n\n return itemErrors;\n};\n\n/**\n * Creates the arrays of cart items to be sent to the graphql mutations\n *\n * @param items\n * @param currentCartItems\n * @returns {\n * itemsToAdd: Array<{\n * sku: string;\n * parentSku: string;\n * quantity: number;\n * optionsUIDs: string[];\n * enteredOptions: { uid: string; value: string }[];\n * customFields: Record<string, any>;\n * }>\n * itemsToRemove: Array<string>\n * itemsToUpdate: Array<{\n * uid: string;\n * quantity: number;\n * customFields: Record<string, any>;\n * }>\n * }\n */\nconst getCartItems = (\n items: UpdateProductsFromCart,\n currentCartItems: Array<CartModel['items'][number] & { customFields?: Record<string, any> }>\n) => {\n const itemsToAdd: Array<{\n sku?: string;\n parentSku?: string;\n quantity: number;\n optionsUIDs?: string[];\n enteredOptions?: { uid: string; value: string }[];\n customFields?: Record<string, any>;\n }> = [];\n // Items to remove from the cart will be items that have optionUIDs and\n // their optionUIDs are not the same as their matching entry in the current cart item identified by the uid\n const itemsToRemove: Array<string> = [];\n const itemsToUpdate: Array<{\n uid: string;\n quantity: number;\n giftOptions?: {\n gift_wrapping_id?: string | null;\n gift_message: {\n to: string;\n from: string;\n message: string;\n };\n };\n customFields?: Record<string, any>;\n }> = [];\n\n items.forEach((item) => {\n // Check if the item exists in the cart\n const currentItem = currentCartItems.find(\n (cartItem) => cartItem.uid === item.uid\n );\n\n if (currentItem) {\n if (item.optionsUIDs) {\n const currentItemOptions = Object.values(\n currentItem?.selectedOptionsUIDs ?? {}\n );\n\n const { sku, topLevelSku: parentSku } = currentItem;\n const { optionsUIDs, enteredOptions, quantity, customFields } = item;\n\n itemsToAdd.push({\n sku,\n parentSku,\n quantity,\n optionsUIDs,\n enteredOptions,\n customFields,\n });\n\n // If the item has optionUIDs and they are not the exact same as the current item, remove the item\n if (\n item.optionsUIDs.some(\n (optionUID) => !currentItemOptions.includes(optionUID)\n )\n ) {\n itemsToRemove.push(item.uid);\n }\n }\n else if (item.customFields) {\n const { sku, topLevelSku: parentSku } = currentItem;\n const { optionsUIDs, enteredOptions, quantity, customFields } = item;\n\n itemsToAdd.push({\n sku,\n parentSku,\n quantity,\n optionsUIDs,\n enteredOptions,\n customFields,\n });\n itemsToRemove.push(item.uid);\n }\n else {\n itemsToUpdate.push({\n uid: item.uid,\n quantity: item.quantity,\n giftOptions: item.giftOptions,\n customFields: item.customFields,\n });\n }\n } else {\n throw Error(\n `Invalid Cart Item UID: No matching cart entry found for ${item.uid}`\n );\n }\n });\n\n return {\n itemsToAdd,\n itemsToRemove,\n itemsToUpdate,\n };\n};\n\nconst DELETE_ITEM_QUANTITY = 0;\n\nexport const updateProductsFromCart = async (\n items: UpdateProductsFromCart\n): Promise<CartModel | null> => {\n const cartId = state.cartId;\n const cart = getPersistedCartData();\n\n if (!cartId) {\n return Promise.reject(new Error('Cart ID is not set'));\n }\n\n if (!cart) {\n return Promise.reject(new Error('Cart is not set'));\n }\n\n const { itemsToAdd, itemsToRemove, itemsToUpdate } = getCartItems(\n items,\n cart.items\n );\n\n // Array of promises to be resolved\n let results: Array<Promise<CartModel | null>> = [];\n\n // If there are items with options and matching cart items, add the products to the cart and remove the old one.\n // Note: The SKU must be the incoming parent sku and not the current cart item sku.\n if (itemsToAdd.length > 0) {\n results.push(\n fetchGraphQl(ADD_PRODUCTS_TO_CART_MUTATION, {\n variables: {\n cartId,\n cartItems: itemsToAdd.map(\n ({\n parentSku: sku,\n quantity,\n optionsUIDs: selected_options,\n enteredOptions: entered_options,\n customFields,\n }) => ({\n sku,\n quantity,\n selected_options,\n entered_options,\n ...(customFields ? customFields : {}),\n })\n ),\n },\n })\n .then(({ errors, data }) => {\n // Collect individual item errors from the response\n const updatedItemsErrors = collectCartItemErrors(\n data?.addProductsToCart?.cart?.itemsV2.items || [],\n items.map((item) => item.uid)\n );\n\n // handle errors\n const _errors = [\n ...(data?.addProductsToCart?.user_errors ?? []),\n ...(errors ?? []),\n ...updatedItemsErrors,\n ];\n\n if (_errors.length > 0) return handleFetchError(_errors);\n\n if (itemsToRemove.length > 0) {\n // remove the old item\n return updateProductQuantities(\n cartId,\n itemsToRemove.map((uid) => ({\n uid,\n quantity: DELETE_ITEM_QUANTITY, //Delete Item\n }))\n ).catch((error) => {\n return Promise.reject(\n new Error(`Failed to update products in cart: ${error}`)\n );\n });\n }\n return Promise.resolve(transformCart(data?.addProductsToCart?.cart));\n })\n .then((payload) => {\n // emit events\n events.emit('cart/updated', payload);\n events.emit('cart/data', payload);\n\n // Publish cart update events\n publishCartUpdateEvents(payload!, items, state.locale ?? 'en-US');\n\n return Promise.resolve(payload);\n })\n .catch((error) => {\n return Promise.reject(\n new Error(`Failed to add products to cart: ${error}`)\n );\n })\n );\n }\n\n if (itemsToUpdate.length > 0) {\n results.push(\n updateProductQuantities(cartId, itemsToUpdate).catch((error) => {\n return Promise.reject(new Error(error));\n })\n );\n }\n\n // Return the last promise in the results array\n return Promise.all(results).then((results) => results[results.length - 1]);\n};\n\nconst updateProductQuantities = async (\n cartId: string,\n items: UpdateProductsFromCart\n): Promise<CartModel | null> => {\n return fetchGraphQl(UPDATE_PRODUCTS_FROM_CART_MUTATION, {\n variables: {\n cartId,\n cartItems: items.map(({ uid, quantity, giftOptions }) => ({\n cart_item_uid: uid,\n quantity,\n ...giftOptions,\n })),\n },\n }).then(({ errors, data }) => {\n // Collect individual item errors from the response using the new function\n const updatedItemsErrors = collectCartItemErrors(\n data?.updateCartItems?.cart?.itemsV2.items || [],\n items.map((item) => item.uid)\n );\n\n // handle errors\n const _errors = [\n ...(data?.updateCartItems?.user_errors ?? []),\n ...(errors ?? []),\n ...updatedItemsErrors,\n ];\n\n // transform cart\n const payload =\n data?.updateCartItems && transformCart(data.updateCartItems.cart);\n\n // Emit data event\n if (payload) {\n events.emit('cart/data', payload);\n }\n\n if (_errors.length > 0) return handleFetchError(_errors);\n\n // No errors, emit updated event\n events.emit('cart/updated', payload);\n\n // emit product updated events\n if (payload) {\n const updatedItems = payload.items.filter(\n (item: CartModel['items'][number]) =>\n items.some((updateItem) => updateItem.uid === item.uid)\n );\n\n events.emit('cart/product/updated', updatedItems);\n }\n\n // data collection\n if (payload) {\n // Publish cart update events\n publishCartUpdateEvents(payload, items, state.locale ?? 'en-US');\n }\n\n return payload;\n });\n};\n"],"names":["ADD_PRODUCTS_TO_CART_MUTATION","CART_ITEMS_PAGINATION_ARGUMENTS","CART_FRAGMENT","UPDATE_PRODUCTS_FROM_CART_MUTATION","collectCartItemErrors","cartItems","updatedItemUIDs","itemErrors","item","uid","_a","error","getCartItems","items","currentCartItems","itemsToAdd","itemsToRemove","itemsToUpdate","currentItem","cartItem","currentItemOptions","sku","parentSku","optionsUIDs","enteredOptions","quantity","customFields","optionUID","DELETE_ITEM_QUANTITY","updateProductsFromCart","cartId","state","cart","getPersistedCartData","results","fetchGraphQl","selected_options","entered_options","errors","data","updatedItemsErrors","_b","_errors","_c","handleFetchError","updateProductQuantities","transformCart","_d","payload","events","publishCartUpdateEvents","giftOptions","updatedItems","updateItem"],"mappings":"wQAoBO,MAAMA,EAAgC;AAAA;AAAA;AAAA;AAAA,QAIrCC,CAA+B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAgBnCC,CAAa;AAAA,ECpBJC,EAAqC;AAAA;AAAA;AAAA;AAAA,QAI1CF,CAA+B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAenCC,CAAa;AAAA,ECqBXE,EAAwB,CAC5BC,EAIAC,IACgB,CAChB,MAAMC,EAA0B,CAAC,EAG9B,OAAAF,EAAA,OACEG,GAASA,EAAK,QAAUF,EAAgB,KAAMG,GAAQA,IAAQD,EAAK,GAAG,CAAA,EAExE,QAASA,GAAS,QACZE,EAAAF,EAAA,SAAA,MAAAE,EAAQ,QAASC,GAAU,CAC9BJ,EAAW,KAAK,CACd,QAASI,EAAM,QACf,KAAM,CAACH,EAAK,GAAG,EACf,WAAY,CACV,SAAUG,EAAM,IAAA,CAClB,CACD,CAAA,EACF,CACF,EAEIJ,CACT,EAwBMK,EAAe,CACnBC,EACAC,IACG,CACH,MAAMC,EAOD,CAAC,EAGAC,EAA+B,CAAC,EAChCC,EAYD,CAAC,EAEA,OAAAJ,EAAA,QAASL,GAAS,CAEtB,MAAMU,EAAcJ,EAAiB,KAClCK,GAAaA,EAAS,MAAQX,EAAK,GACtC,EAEA,GAAIU,EACF,GAAIV,EAAK,YAAa,CACpB,MAAMY,EAAqB,OAAO,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,EAAM,QAAU,OAAO,EAG1DiB,CAAA,CACR"}
1
+ {"version":3,"file":"updateProductsFromCart.js","sources":["/@dropins/storefront-cart/src/api/addProductsToCart/graphql/AddProductsToCartMutation.ts","/@dropins/storefront-cart/src/api/updateProductsFromCart/graphql/UpdateProductsMutation.ts","/@dropins/storefront-cart/src/api/updateProductsFromCart/updateProductsFromCart.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CART_FRAGMENT } from '@/cart/api/graphql/CartFragment';\n\nexport const ADD_PRODUCTS_TO_CART_MUTATION = `\n mutation ADD_PRODUCTS_TO_CART_MUTATION(\n $cartId: String!, \n $cartItems: [CartItemInput!]!,\n $pageSize: Int! = 100,\n $currentPage: Int! = 1,\n $itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC}\n ) {\n addProductsToCart(\n cartId: $cartId\n cartItems: $cartItems\n ) {\n cart {\n ...CART_FRAGMENT\n }\n user_errors {\n code\n message\n }\n }\n }\n \n ${CART_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CART_FRAGMENT } from '@/cart/api/graphql/CartFragment';\n\nexport const UPDATE_PRODUCTS_FROM_CART_MUTATION = `\n mutation UPDATE_PRODUCTS_FROM_CART_MUTATION(\n $cartId: String!, \n $cartItems: [CartItemUpdateInput!]!,\n $pageSize: Int! = 100,\n $currentPage: Int! = 1,\n $itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC}\n ) {\n updateCartItems(\n input: {\n cart_id: $cartId\n cart_items: $cartItems\n }\n ) {\n cart {\n ...CART_FRAGMENT\n }\n\n }\n }\n\n ${CART_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { state } from '@/cart/lib/state';\nimport { fetchGraphQl } from '@/cart/api';\nimport { handleFetchError } from '@/cart/lib/fetch-error';\nimport { CartModel } from '@/cart/data/models';\nimport { transformCart } from '@/cart/data/transforms';\nimport { events } from '@adobe-commerce/event-bus';\nimport { publishCartUpdateEvents } from '@/cart/lib/acdl';\nimport { getPersistedCartData } from '@/cart/lib/persisted-data';\nimport { ADD_PRODUCTS_TO_CART_MUTATION } from '../addProductsToCart/graphql/AddProductsToCartMutation';\nimport { UPDATE_PRODUCTS_FROM_CART_MUTATION } from './graphql/UpdateProductsMutation';\n\ntype UpdateProductsFromCart = Array<{\n uid: string;\n quantity: number;\n sku?: string;\n parentSku?: string;\n optionsUIDs?: string[];\n enteredOptions?: { uid: string; value: string }[];\n giftOptions?: {\n gift_wrapping_id?: string | null;\n gift_message: {\n to: string;\n from: string;\n message: string;\n };\n };\n customFields?: Record<string, any>;\n}>;\n\ntype ItemError = {\n message: string;\n path?: string[];\n extensions?: {\n category: string;\n };\n};\n\n/**\n * Collects individual item errors from cart items response\n * @param cartItems - The cart items from the response\n * @param updatedItemUIDs - Array of UIDs of items that were updated\n * @returns Array of ItemError objects\n */\nconst collectCartItemErrors = (\n cartItems: Array<{\n uid: string;\n errors?: Array<{ message: string; code: string }>;\n }>,\n updatedItemUIDs: string[]\n): ItemError[] => {\n const itemErrors: ItemError[] = [];\n\n cartItems\n .filter(\n (item) => item.errors && updatedItemUIDs.some((uid) => uid === item.uid)\n )\n .forEach((item) => {\n item.errors?.forEach((error) => {\n itemErrors.push({\n message: error.message,\n path: [item.uid],\n extensions: {\n category: error.code,\n },\n });\n });\n });\n\n return itemErrors;\n};\n\n/**\n * Creates the arrays of cart items to be sent to the graphql mutations\n *\n * @param items\n * @param currentCartItems\n * @returns {\n * itemsToAdd: Array<{\n * sku: string;\n * parentSku: string;\n * quantity: number;\n * optionsUIDs: string[];\n * enteredOptions: { uid: string; value: string }[];\n * customFields: Record<string, any>;\n * }>\n * itemsToRemove: Array<string>\n * itemsToUpdate: Array<{\n * uid: string;\n * quantity: number;\n * customFields: Record<string, any>;\n * }>\n * }\n */\nconst getCartItems = (\n items: UpdateProductsFromCart,\n currentCartItems: Array<CartModel['items'][number] & { customFields?: Record<string, any> }>\n) => {\n const itemsToAdd: Array<{\n sku?: string;\n parentSku?: string;\n quantity: number;\n optionsUIDs?: string[];\n enteredOptions?: { uid: string; value: string }[];\n customFields?: Record<string, any>;\n }> = [];\n // Items to remove from the cart will be items that have optionUIDs and\n // their optionUIDs are not the same as their matching entry in the current cart item identified by the uid\n const itemsToRemove: Array<string> = [];\n const itemsToUpdate: Array<{\n uid: string;\n quantity: number;\n giftOptions?: {\n gift_wrapping_id?: string | null;\n gift_message: {\n to: string;\n from: string;\n message: string;\n };\n };\n customFields?: Record<string, any>;\n }> = [];\n\n items.forEach((item) => {\n // Check if the item exists in the cart\n const currentItem = currentCartItems.find(\n (cartItem) => cartItem.uid === item.uid\n );\n\n if (currentItem) {\n if (item.optionsUIDs) {\n const currentItemOptions = Object.values(\n currentItem?.selectedOptionsUIDs ?? {}\n );\n\n const { sku, topLevelSku: parentSku } = currentItem;\n const { optionsUIDs, enteredOptions, quantity, customFields } = item;\n\n itemsToAdd.push({\n sku,\n parentSku,\n quantity,\n optionsUIDs,\n enteredOptions,\n customFields,\n });\n\n // If the item has optionUIDs and they are not the exact same as the current item, remove the item\n if (\n item.optionsUIDs.some(\n (optionUID) => !currentItemOptions.includes(optionUID)\n )\n ) {\n itemsToRemove.push(item.uid);\n }\n }\n else if (item.customFields) {\n const { sku, topLevelSku: parentSku } = currentItem;\n const { optionsUIDs, enteredOptions, quantity, customFields } = item;\n\n itemsToAdd.push({\n sku,\n parentSku,\n quantity,\n optionsUIDs,\n enteredOptions,\n customFields,\n });\n itemsToRemove.push(item.uid);\n }\n else {\n itemsToUpdate.push({\n uid: item.uid,\n quantity: item.quantity,\n giftOptions: item.giftOptions,\n customFields: item.customFields,\n });\n }\n } else {\n throw Error(\n `Invalid Cart Item UID: No matching cart entry found for ${item.uid}`\n );\n }\n });\n\n return {\n itemsToAdd,\n itemsToRemove,\n itemsToUpdate,\n };\n};\n\nconst DELETE_ITEM_QUANTITY = 0;\n\nexport const updateProductsFromCart = async (\n items: UpdateProductsFromCart\n): Promise<CartModel | null> => {\n const cartId = state.cartId;\n const cart = getPersistedCartData();\n\n if (!cartId) {\n return Promise.reject(new Error('Cart ID is not set'));\n }\n\n if (!cart) {\n return Promise.reject(new Error('Cart is not set'));\n }\n\n const { itemsToAdd, itemsToRemove, itemsToUpdate } = getCartItems(\n items,\n cart.items\n );\n\n // Array of promises to be resolved\n let results: Array<Promise<CartModel | null>> = [];\n\n // If there are items with options and matching cart items, add the products to the cart and remove the old one.\n // Note: The SKU must be the incoming parent sku and not the current cart item sku.\n if (itemsToAdd.length > 0) {\n results.push(\n fetchGraphQl(ADD_PRODUCTS_TO_CART_MUTATION, {\n variables: {\n cartId,\n cartItems: itemsToAdd.map(\n ({\n parentSku: sku,\n quantity,\n optionsUIDs: selected_options,\n enteredOptions: entered_options,\n customFields,\n }) => ({\n sku,\n quantity,\n selected_options,\n entered_options,\n ...(customFields ? customFields : {}),\n })\n ),\n },\n })\n .then(({ errors, data }) => {\n // Collect individual item errors from the response\n const updatedItemsErrors = collectCartItemErrors(\n data?.addProductsToCart?.cart?.itemsV2.items || [],\n items.map((item) => item.uid)\n );\n\n // handle errors\n const _errors = [\n ...(data?.addProductsToCart?.user_errors ?? []),\n ...(errors ?? []),\n ...updatedItemsErrors,\n ];\n\n if (_errors.length > 0) return handleFetchError(_errors);\n\n if (itemsToRemove.length > 0) {\n // remove the old item\n return updateProductQuantities(\n cartId,\n itemsToRemove.map((uid) => ({\n uid,\n quantity: DELETE_ITEM_QUANTITY, //Delete Item\n }))\n ).catch((error) => {\n return Promise.reject(\n new Error(`Failed to update products in cart: ${error}`)\n );\n });\n }\n return Promise.resolve(transformCart(data?.addProductsToCart?.cart));\n })\n .then((payload) => {\n // emit events\n events.emit('cart/updated', payload);\n events.emit('cart/data', payload);\n\n // Publish cart update events\n publishCartUpdateEvents(payload!, items, state.locale ?? 'en-US');\n\n return Promise.resolve(payload);\n })\n .catch((error) => {\n return Promise.reject(\n new Error(`Failed to add products to cart: ${error}`)\n );\n })\n );\n }\n\n if (itemsToUpdate.length > 0) {\n results.push(\n updateProductQuantities(cartId, itemsToUpdate).catch((error) => {\n return Promise.reject(new Error(error));\n })\n );\n }\n\n // Return the last promise in the results array\n return Promise.all(results).then((results) => results[results.length - 1]);\n};\n\nconst updateProductQuantities = async (\n cartId: string,\n items: UpdateProductsFromCart\n): Promise<CartModel | null> => {\n return fetchGraphQl(UPDATE_PRODUCTS_FROM_CART_MUTATION, {\n variables: {\n cartId,\n cartItems: items.map(({ uid, quantity, giftOptions }) => ({\n cart_item_uid: uid,\n quantity,\n ...giftOptions,\n })),\n },\n }).then(({ errors, data }) => {\n // Collect individual item errors from the response using the new function\n const updatedItemsErrors = collectCartItemErrors(\n data?.updateCartItems?.cart?.itemsV2.items || [],\n items.map((item) => item.uid)\n );\n\n // handle errors\n const _errors = [\n ...(data?.updateCartItems?.user_errors ?? []),\n ...(errors ?? []),\n ...updatedItemsErrors,\n ];\n\n // transform cart\n const payload =\n data?.updateCartItems && transformCart(data.updateCartItems.cart);\n\n // Emit data event\n if (payload) {\n events.emit('cart/data', payload);\n }\n\n if (_errors.length > 0) return handleFetchError(_errors);\n\n // No errors, emit updated event\n events.emit('cart/updated', payload);\n\n // emit product updated events\n if (payload) {\n const updatedItems = payload.items.filter(\n (item: CartModel['items'][number]) =>\n items.some((updateItem) => updateItem.uid === item.uid)\n );\n\n events.emit('cart/product/updated', updatedItems);\n }\n\n // data collection\n if (payload) {\n // Publish cart update events\n publishCartUpdateEvents(payload, items, state.locale ?? 'en-US');\n }\n\n return payload;\n });\n};\n"],"names":["ADD_PRODUCTS_TO_CART_MUTATION","CART_FRAGMENT","UPDATE_PRODUCTS_FROM_CART_MUTATION","collectCartItemErrors","cartItems","updatedItemUIDs","itemErrors","item","uid","_a","error","getCartItems","items","currentCartItems","itemsToAdd","itemsToRemove","itemsToUpdate","currentItem","cartItem","currentItemOptions","sku","parentSku","optionsUIDs","enteredOptions","quantity","customFields","optionUID","DELETE_ITEM_QUANTITY","updateProductsFromCart","cartId","state","cart","getPersistedCartData","results","fetchGraphQl","selected_options","entered_options","errors","data","updatedItemsErrors","_b","_errors","_c","handleFetchError","updateProductQuantities","transformCart","_d","payload","events","publishCartUpdateEvents","giftOptions","updatedItems","updateItem"],"mappings":"4PAmBO,MAAMA,EAAgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAsBzCC,CAAa;AAAA,ECtBJC,EAAqC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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A,EAAM,kBAAN,YAAA7B,EAAuB,OAAvB,YAAA+B,EAA6B,QAAQ,QAAS,CAAC,EAC/C5B,EAAM,IAAKL,GAASA,EAAK,GAAG,CAC9B,EAGMkC,EAAU,CACd,KAAIC,EAAAJ,GAAA,YAAAA,EAAM,kBAAN,YAAAI,EAAuB,cAAe,CAAC,EAC3C,GAAIL,GAAU,CAAC,EACf,GAAGE,CACL,EAGMQ,GACJT,GAAA,YAAAA,EAAM,kBAAmBO,EAAcP,EAAK,gBAAgB,IAAI,EAOlE,GAJIS,GACKC,EAAA,KAAK,YAAaD,CAAO,EAG9BN,EAAQ,OAAS,EAAG,OAAOE,EAAiBF,CAAO,EAMvD,GAHOO,EAAA,KAAK,eAAgBD,CAAO,EAG/BA,EAAS,CACL,MAAAI,EAAeJ,EAAQ,MAAM,OAChCxC,GACCK,EAAM,KAAMwC,GAAeA,EAAW,MAAQ7C,EAAK,GAAG,CAC1D,EAEOyC,EAAA,KAAK,uBAAwBG,CAAY,CAAA,CAIlD,OAAIJ,GAEFE,EAAwBF,EAASnC,EAAOkB,EAAM,QAAU,OAAO,EAG1DiB,CAAA,CACR"}
@@ -36,6 +36,40 @@ export interface CartSummaryListProps extends HTMLAttributes<HTMLDivElement> {
36
36
  onUndo: () => void;
37
37
  onDismiss: () => void;
38
38
  }>;
39
+ ItemTitle?: SlotProps<{
40
+ item: CartModel['items'][number];
41
+ }>;
42
+ ItemPrice?: SlotProps<{
43
+ item: CartModel['items'][number];
44
+ }>;
45
+ ItemQuantity?: SlotProps<{
46
+ item: CartModel['items'][number];
47
+ enableUpdateItemQuantity: boolean;
48
+ handleItemQuantityUpdate: (item: CartModel['items'][number], quantity: number) => void;
49
+ itemsLoading: Set<string>;
50
+ handleItemsError: (uid: string, message?: string) => void;
51
+ handleItemsLoading: (uid: string, state: boolean) => void;
52
+ onItemUpdate?: ({ item }: {
53
+ item: CartModel['items'][number];
54
+ }) => void;
55
+ }>;
56
+ ItemTotal?: SlotProps<{
57
+ item: CartModel['items'][number];
58
+ }>;
59
+ ItemSku?: SlotProps<{
60
+ item: CartModel['items'][number];
61
+ }>;
62
+ ItemRemoveAction?: SlotProps<{
63
+ item: CartModel['items'][number];
64
+ enableRemoveItem: boolean;
65
+ handleItemQuantityUpdate: (item: CartModel['items'][number], quantity: number) => void;
66
+ handleItemsError: (uid: string, message?: string) => void;
67
+ handleItemsLoading: (uid: string, state: boolean) => void;
68
+ onItemUpdate?: ({ item }: {
69
+ item: CartModel['items'][number];
70
+ }) => void;
71
+ itemsLoading: Set<string>;
72
+ }>;
39
73
  };
40
74
  enableRemoveItem?: boolean;
41
75
  enableUpdateItemQuantity?: boolean;
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{C as h,C as j}from"../chunks/CartSummaryList.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"../chunks/EmptyCart2.js";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/i18n.js";import"@dropins/tools/preact-hooks.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/createGuestCart.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/updateProductsFromCart.js";import"../chunks/acdl.js";import"../chunks/WarningWithCircle.js";import"../chunks/ChevronDown.js";export{h as CartSummaryList,j as default};
3
+ import{C as h,C as j}from"../chunks/CartSummaryList.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"../chunks/EmptyCart2.js";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/i18n.js";import"@dropins/tools/preact-hooks.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/createGuestCart.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/updateProductsFromCart.js";import"../chunks/acdl.js";import"../chunks/Trash.js";import"../chunks/ChevronDown.js";export{h as CartSummaryList,j as default};
4
4
  //# sourceMappingURL=CartSummaryList.js.map
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{C as H,e as v,a as x,f as y,b as A,d as I,c as R,C as S,g as T}from"../chunks/CartSummaryTable2.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/i18n.js";import"@dropins/tools/event-bus.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/persisted-data.js";import"../chunks/updateProductsFromCart.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/acdl.js";import"../chunks/createGuestCart.js";import"../chunks/EmptyCart.js";import"../chunks/EmptyCart2.js";import"../chunks/WarningWithCircle.js";import"../chunks/Close.js";export{H as CartSummaryTable,v as createDismissCallback,x as createDismissHandler,y as createUndoBanner,A as createUndoBannerActions,I as createUndoCallback,R as createUndoHandler,S as default,T as getIsUndoBeingRemoved};
3
+ import{C as H,e as v,a as x,f as y,b as A,d as I,c as R,C as S,g as T}from"../chunks/CartSummaryTable2.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/i18n.js";import"@dropins/tools/event-bus.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/persisted-data.js";import"../chunks/updateProductsFromCart.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/acdl.js";import"../chunks/createGuestCart.js";import"../chunks/EmptyCart.js";import"../chunks/EmptyCart2.js";import"../chunks/Trash.js";import"../chunks/Close.js";export{H as CartSummaryTable,v as createDismissCallback,x as createDismissHandler,y as createUndoBanner,A as createUndoBannerActions,I as createUndoCallback,R as createUndoHandler,S as default,T as getIsUndoBeingRemoved};
4
4
  //# sourceMappingURL=CartSummaryTable.js.map
@@ -16,6 +16,53 @@ export interface MiniCartProps extends HTMLAttributes<HTMLDivElement> {
16
16
  item: CartModel['items'][number];
17
17
  defaultImageProps: ImageProps;
18
18
  }>;
19
+ Heading?: SlotProps;
20
+ EmptyCart?: SlotProps;
21
+ Footer?: SlotProps;
22
+ ProductAttributes?: SlotProps;
23
+ CartSummaryFooter?: SlotProps;
24
+ CartItem?: SlotProps;
25
+ UndoBanner?: SlotProps<{
26
+ item: CartModel['items'][0];
27
+ loading: boolean;
28
+ error?: string;
29
+ onUndo: () => void;
30
+ onDismiss: () => void;
31
+ }>;
32
+ ItemTitle?: SlotProps<{
33
+ item: CartModel['items'][number];
34
+ }>;
35
+ ItemPrice?: SlotProps<{
36
+ item: CartModel['items'][number];
37
+ }>;
38
+ ItemQuantity?: SlotProps<{
39
+ item: CartModel['items'][number];
40
+ enableUpdateItemQuantity: boolean;
41
+ handleItemQuantityUpdate: (item: CartModel['items'][number], quantity: number) => void;
42
+ itemsLoading: Set<string>;
43
+ handleItemsError: (uid: string, message?: string) => void;
44
+ handleItemsLoading: (uid: string, state: boolean) => void;
45
+ onItemUpdate?: ({ item }: {
46
+ item: CartModel['items'][number];
47
+ }) => void;
48
+ }>;
49
+ ItemTotal?: SlotProps<{
50
+ item: CartModel['items'][number];
51
+ }>;
52
+ ItemSku?: SlotProps<{
53
+ item: CartModel['items'][number];
54
+ }>;
55
+ ItemRemoveAction?: SlotProps<{
56
+ item: CartModel['items'][number];
57
+ enableRemoveItem: boolean;
58
+ handleItemQuantityUpdate: (item: CartModel['items'][number], quantity: number) => void;
59
+ handleItemsError: (uid: string, message?: string) => void;
60
+ handleItemsLoading: (uid: string, state: boolean) => void;
61
+ onItemUpdate?: ({ item }: {
62
+ item: CartModel['items'][number];
63
+ }) => void;
64
+ itemsLoading: Set<string>;
65
+ }>;
19
66
  };
20
67
  hideFooter?: boolean;
21
68
  displayAllItems?: boolean;
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as i,jsxs as m,Fragment as j}from"@dropins/tools/preact-jsx-runtime.js";import{useState as w,useEffect as O,useCallback as B}from"@dropins/tools/preact-compat.js";import{classes as h,VComponent as u,Slot as y}from"@dropins/tools/lib.js";import{g as V}from"../chunks/persisted-data.js";import{events as $}from"@dropins/tools/event-bus.js";import{Button as L,Price as N}from"@dropins/tools/components.js";/* empty css */import{useText as D}from"@dropins/tools/i18n.js";import"@dropins/tools/preact-hooks.js";import{s as b}from"../chunks/resetCart.js";import{a as q}from"../chunks/acdl.js";import{u as z}from"../chunks/updateProductsFromCart.js";import"../chunks/CartSummaryGrid.js";import{C as J}from"../chunks/CartSummaryList.js";import"../chunks/OrderSummary.js";import"../chunks/CartSummaryTable2.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/EmptyCart2.js";import"../chunks/createGuestCart.js";import"../chunks/WarningWithCircle.js";import"../chunks/ChevronDown.js";import"../chunks/getEstimatedTotals.js";import"../chunks/OrderSummaryLine.js";import"../chunks/ChevronUp.js";import"../chunks/Coupon.js";import"../chunks/GiftCard.js";import"../chunks/EmptyCart.js";import"../chunks/Close.js";const K=({className:_,products:s,productListFooter:l,subtotal:e,subtotalExcludingTaxes:d,preCheckoutSection:o,ctas:n,...f})=>{const p=D({subtotal:"Cart.MiniCart.subtotal",subtotalExcludingTaxes:"Cart.MiniCart.subtotalExcludingTaxes"});return i("div",{...f,className:h(["cart-mini-cart",_]),children:s&&m(j,{children:[i("div",{className:"cart-mini-cart__products","data-testid":"mini-cart-products-wrapper",children:s}),l&&i("div",{className:h(["cart-mini-cart__productListFooter"]),"data-testid":"mini-cart-product-list-footer",children:i(u,{node:l})}),m("div",{className:"cart-mini-cart__footer","data-testid":"mini-cart-subtotals",children:[e&&m("div",{className:"cart-mini-cart__footer__estimated-total","data-testid":"mini-cart-subtotal",children:[p.subtotal,i(u,{node:e})]}),d&&m("div",{className:"cart-mini-cart__footer__estimated-total-excluding-taxes","data-testid":"mini-cart-subtotal-excluding-taxes",children:[p.subtotalExcludingTaxes,i(u,{node:d,className:h(["dropin-price-summary__price","dropin-price-summary__price--muted"])})]}),o&&i("div",{className:h(["cart-mini-cart__preCheckoutSection"]),"data-testid":"mini-cart-pre-checkout-section",children:i(u,{node:o})}),n&&i(u,{node:n,className:"cart-mini-cart__footer__ctas"})]})]})})},W=({children:_,initialData:s=null,hideFooter:l=!0,slots:e,routeProduct:d,routeCart:o,routeCheckout:n,routeEmptyCartCTA:f,showDiscount:p,showSavings:P,enableItemRemoval:S=!0,enableQuantityUpdate:T=!1,hideHeading:M=!1,undo:Q=!1,...U})=>{var v,k,I;const[t,E]=w(s),a=(v=b.config)==null?void 0:v.shoppingCartDisplaySetting;O(()=>{const r=$.on("cart/data",x=>{E(x)},{eager:!0});return()=>{r==null||r.off()}},[]);const g=D({cartLink:"Cart.MiniCart.cartLink",checkoutLink:"Cart.MiniCart.checkoutLink"}),C=(r,x)=>z([{uid:r,quantity:x}]),F=r=>C(r,0),c=t==null?void 0:t.hasOutOfStockItems,G=B(()=>{t&&!c&&q(t,b.locale)},[t,c]),X=i(y,{name:"ProductList",slot:e==null?void 0:e.ProductList,context:{itemQuantityUpdateHandler:C,itemRemoveHandler:F,totalQuantity:t==null?void 0:t.totalQuantity},children:i(J,{"data-testid":"default-cart-summary-list",routeProduct:d,routeEmptyCartCTA:f,initialData:t,maxItems:(k=b.config)==null?void 0:k.miniCartMaxItemsDisplay,showMaxItems:!!((I=b.config)!=null&&I.miniCartMaxItemsDisplay),hideHeading:M||!(t!=null&&t.totalQuantity),hideFooter:l,enableRemoveItem:S,enableUpdateItemQuantity:T,showDiscount:p,showSavings:P,undo:Q,slots:{Thumbnail:e==null?void 0:e.Thumbnail}})}),A=r=>i(y,{name:"ProductListFooter",slot:e==null?void 0:e.ProductListFooter,context:{data:r}}),H=r=>i(y,{name:"PreCheckoutSection",slot:e==null?void 0:e.PreCheckoutSection,context:{data:r}}),R=()=>(a==null?void 0:a.subtotal)==="INCLUDING_TAX"||(a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?{amount:t==null?void 0:t.subtotal.includingTax.value,currency:t==null?void 0:t.subtotal.includingTax.currency,"data-testid":"subtotal-including-tax",style:{font:"inherit"}}:{amount:t==null?void 0:t.subtotal.excludingTax.value,currency:t==null?void 0:t.subtotal.excludingTax.currency,"data-testid":"subtotal-excluding-tax",style:{font:"inherit"}};return i(K,{...U,productListFooter:A(t),subtotal:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&i(N,{...R()}):void 0,subtotalExcludingTaxes:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&((a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?i(N,{amount:t==null?void 0:t.subtotal.excludingTax.value,currency:t==null?void 0:t.subtotal.excludingTax.currency,"data-testid":"subtotal-including-excluding-tax",style:{font:"inherit"}}):void 0):void 0,preCheckoutSection:H(t),ctas:t!=null&&t.totalQuantity?m("div",{children:[n&&i(L,{"data-testid":"route-checkout-button",variant:"primary",href:c?void 0:n(),disabled:c,"aria-disabled":c,onClick:G,children:g.checkoutLink}),o&&i(L,{"data-testid":"route-cart-button",variant:"tertiary",href:o(),children:g.cartLink})]}):void 0,products:X})};W.getInitialData=async function(){return V()};export{W as MiniCart,W as default};
3
+ import{jsx as e,jsxs as o,Fragment as j}from"@dropins/tools/preact-jsx-runtime.js";import{useState as w,useEffect as O,useCallback as V}from"@dropins/tools/preact-compat.js";import{classes as y,VComponent as u,Slot as x}from"@dropins/tools/lib.js";import{g as $}from"../chunks/persisted-data.js";import{events as q}from"@dropins/tools/event-bus.js";import{Button as N,Price as P}from"@dropins/tools/components.js";/* empty css */import{useText as S}from"@dropins/tools/i18n.js";import"@dropins/tools/preact-hooks.js";import{s as I}from"../chunks/resetCart.js";import{a as z}from"../chunks/acdl.js";import{u as J}from"../chunks/updateProductsFromCart.js";import"../chunks/CartSummaryGrid.js";import{C as K}from"../chunks/CartSummaryList.js";import"../chunks/OrderSummary.js";import"../chunks/CartSummaryTable2.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/EmptyCart2.js";import"../chunks/createGuestCart.js";import"../chunks/Trash.js";import"../chunks/ChevronDown.js";import"../chunks/getEstimatedTotals.js";import"../chunks/OrderSummaryLine.js";import"../chunks/ChevronUp.js";import"../chunks/Coupon.js";import"../chunks/GiftCard.js";import"../chunks/EmptyCart.js";import"../chunks/Close.js";const W=({className:C,products:d,productListFooter:p,subtotal:t,subtotalExcludingTaxes:h,preCheckoutSection:n,ctas:c,...l})=>{const b=S({subtotal:"Cart.MiniCart.subtotal",subtotalExcludingTaxes:"Cart.MiniCart.subtotalExcludingTaxes"});return e("div",{...l,className:y(["cart-mini-cart",C]),children:d&&o(j,{children:[e("div",{className:"cart-mini-cart__products","data-testid":"mini-cart-products-wrapper",children:d}),p&&e("div",{className:y(["cart-mini-cart__productListFooter"]),"data-testid":"mini-cart-product-list-footer",children:e(u,{node:p})}),o("div",{className:"cart-mini-cart__footer","data-testid":"mini-cart-subtotals",children:[t&&o("div",{className:"cart-mini-cart__footer__estimated-total","data-testid":"mini-cart-subtotal",children:[b.subtotal,e(u,{node:t})]}),h&&o("div",{className:"cart-mini-cart__footer__estimated-total-excluding-taxes","data-testid":"mini-cart-subtotal-excluding-taxes",children:[b.subtotalExcludingTaxes,e(u,{node:h,className:y(["dropin-price-summary__price","dropin-price-summary__price--muted"])})]}),n&&e("div",{className:y(["cart-mini-cart__preCheckoutSection"]),"data-testid":"mini-cart-pre-checkout-section",children:e(u,{node:n})}),c&&e(u,{node:c,className:"cart-mini-cart__footer__ctas"})]})]})})},Y=({children:C,initialData:d=null,hideFooter:p=!0,slots:t,routeProduct:h,routeCart:n,routeCheckout:c,routeEmptyCartCTA:l,showDiscount:b,showSavings:T,enableItemRemoval:D=!0,enableQuantityUpdate:Q=!1,hideHeading:F=!1,undo:U=!1,...E})=>{var v,k,L;const[i,M]=w(d),a=(v=I.config)==null?void 0:v.shoppingCartDisplaySetting;O(()=>{const r=q.on("cart/data",f=>{M(f)},{eager:!0});return()=>{r==null||r.off()}},[]);const _=S({cartLink:"Cart.MiniCart.cartLink",checkoutLink:"Cart.MiniCart.checkoutLink"}),g=(r,f)=>J([{uid:r,quantity:f}]),A=r=>g(r,0),m=i==null?void 0:i.hasOutOfStockItems,G=V(()=>{i&&!m&&z(i,I.locale)},[i,m]),H=e(x,{name:"ProductList",slot:t==null?void 0:t.ProductList,context:{itemQuantityUpdateHandler:g,itemRemoveHandler:A,totalQuantity:i==null?void 0:i.totalQuantity},children:e(K,{"data-testid":"default-cart-summary-list",routeProduct:h,routeEmptyCartCTA:l,initialData:i,maxItems:(k=I.config)==null?void 0:k.miniCartMaxItemsDisplay,showMaxItems:!!((L=I.config)!=null&&L.miniCartMaxItemsDisplay),hideHeading:F||!(i!=null&&i.totalQuantity),hideFooter:p,enableRemoveItem:D,enableUpdateItemQuantity:Q,showDiscount:b,showSavings:T,undo:U,slots:{Thumbnail:t==null?void 0:t.Thumbnail,Heading:t==null?void 0:t.Heading,EmptyCart:t==null?void 0:t.EmptyCart,Footer:t==null?void 0:t.Footer,ProductAttributes:t==null?void 0:t.ProductAttributes,CartSummaryFooter:t==null?void 0:t.CartSummaryFooter,CartItem:t==null?void 0:t.CartItem,UndoBanner:t==null?void 0:t.UndoBanner,ItemTitle:t==null?void 0:t.ItemTitle,ItemPrice:t==null?void 0:t.ItemPrice,ItemQuantity:t==null?void 0:t.ItemQuantity,ItemTotal:t==null?void 0:t.ItemTotal,ItemSku:t==null?void 0:t.ItemSku,ItemRemoveAction:t==null?void 0:t.ItemRemoveAction}})}),R=r=>e(x,{name:"ProductListFooter",slot:t==null?void 0:t.ProductListFooter,context:{data:r}}),X=r=>e(x,{name:"PreCheckoutSection",slot:t==null?void 0:t.PreCheckoutSection,context:{data:r}}),B=()=>(a==null?void 0:a.subtotal)==="INCLUDING_TAX"||(a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?{amount:i==null?void 0:i.subtotal.includingTax.value,currency:i==null?void 0:i.subtotal.includingTax.currency,"data-testid":"subtotal-including-tax",style:{font:"inherit"}}:{amount:i==null?void 0:i.subtotal.excludingTax.value,currency:i==null?void 0:i.subtotal.excludingTax.currency,"data-testid":"subtotal-excluding-tax",style:{font:"inherit"}};return e(W,{...E,productListFooter:R(i),subtotal:i!=null&&i.totalQuantity?(i==null?void 0:i.subtotal)&&e(P,{...B()}):void 0,subtotalExcludingTaxes:i!=null&&i.totalQuantity?(i==null?void 0:i.subtotal)&&((a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?e(P,{amount:i==null?void 0:i.subtotal.excludingTax.value,currency:i==null?void 0:i.subtotal.excludingTax.currency,"data-testid":"subtotal-including-excluding-tax",style:{font:"inherit"}}):void 0):void 0,preCheckoutSection:X(i),ctas:i!=null&&i.totalQuantity?o("div",{children:[c&&e(N,{"data-testid":"route-checkout-button",variant:"primary",href:m?void 0:c(),disabled:m,"aria-disabled":m,onClick:G,children:_.checkoutLink}),n&&e(N,{"data-testid":"route-cart-button",variant:"tertiary",href:n(),children:_.cartLink})]}):void 0,products:H})};Y.getInitialData=async function(){return $()};export{Y as MiniCart,Y as default};
4
4
  //# sourceMappingURL=MiniCart.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MiniCart.js","sources":["/@dropins/storefront-cart/src/components/MiniCart/MiniCart.tsx","/@dropins/storefront-cart/src/containers/MiniCart/MiniCart.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { VComponent, classes } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nimport '@/cart/components/MiniCart/MiniCart.css';\n\nexport interface MiniCartProps extends HTMLAttributes<HTMLDivElement> {\n products?: VNode;\n productListFooter?: VNode;\n subtotal?: VNode;\n subtotalExcludingTaxes?: VNode;\n preCheckoutSection?: VNode;\n ctas?: VNode;\n}\n\nexport const MiniCart: FunctionComponent<MiniCartProps> = ({\n className,\n products,\n productListFooter,\n subtotal,\n subtotalExcludingTaxes,\n preCheckoutSection,\n ctas,\n ...props\n}) => {\n const dictionary = useText({\n subtotal: 'Cart.MiniCart.subtotal',\n subtotalExcludingTaxes: 'Cart.MiniCart.subtotalExcludingTaxes',\n });\n\n return (\n <div {...props} className={classes(['cart-mini-cart', className])}>\n {/* Content */}\n {products && (\n <>\n <div\n className=\"cart-mini-cart__products\"\n data-testid=\"mini-cart-products-wrapper\"\n >\n {products}\n </div>\n\n {/* Product List Footer */}\n {productListFooter && (\n <div\n className={classes(['cart-mini-cart__productListFooter'])}\n data-testid=\"mini-cart-product-list-footer\"\n >\n <VComponent node={productListFooter} />\n </div>\n )}\n\n <div\n className=\"cart-mini-cart__footer\"\n data-testid=\"mini-cart-subtotals\"\n >\n {/* Subtotal */}\n {subtotal && (\n <div\n className=\"cart-mini-cart__footer__estimated-total\"\n data-testid=\"mini-cart-subtotal\"\n >\n {dictionary.subtotal}\n <VComponent node={subtotal} />\n </div>\n )}\n {/* Subtotal Excluding Taxes */}\n {subtotalExcludingTaxes && (\n <div\n className=\"cart-mini-cart__footer__estimated-total-excluding-taxes\"\n data-testid=\"mini-cart-subtotal-excluding-taxes\"\n >\n {dictionary.subtotalExcludingTaxes}\n <VComponent\n node={subtotalExcludingTaxes}\n className={classes([\n 'dropin-price-summary__price',\n 'dropin-price-summary__price--muted',\n ])}\n />\n </div>\n )}\n\n {/* Pre-checkout section */}\n {preCheckoutSection && (\n <div\n className={classes(['cart-mini-cart__preCheckoutSection'])}\n data-testid=\"mini-cart-pre-checkout-section\"\n >\n <VComponent node={preCheckoutSection} />\n </div>\n )}\n\n {ctas && (\n <VComponent\n node={ctas}\n className=\"cart-mini-cart__footer__ctas\"\n />\n )}\n </div>\n </>\n )}\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n HTMLAttributes,\n useCallback,\n useEffect,\n useState,\n} from 'preact/compat';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { CartModel } from '@/cart/data/models';\nimport { getPersistedCartData } from '@/cart/lib/persisted-data';\nimport { events } from '@adobe-commerce/event-bus';\nimport { MiniCart as MiniCartComponent } from '@/cart/components';\nimport { CartSummaryList } from '@/cart/containers';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Button, ImageProps, Price } from '@adobe-commerce/elsie/components';\nimport { updateProductsFromCart } from '@/cart/api';\nimport { publishInitiateCheckoutEvent } from '@/cart/lib/acdl';\nimport { state } from '@/cart/lib/state';\n\nexport interface MiniCartProps extends HTMLAttributes<HTMLDivElement> {\n routeProduct?: (item: CartModel['items'][0]) => string;\n routeCart?: () => string;\n routeCheckout?: () => string;\n routeEmptyCartCTA?: () => string;\n slots?: {\n ProductList?: SlotProps;\n ProductListFooter?: SlotProps;\n PreCheckoutSection?: SlotProps;\n Thumbnail?: SlotProps<{ \n item: CartModel['items'][number], \n defaultImageProps: ImageProps \n }>;\n };\n hideFooter?: boolean;\n displayAllItems?: boolean;\n showDiscount?: boolean;\n showSavings?: boolean;\n enableItemRemoval?: boolean;\n enableQuantityUpdate?: boolean;\n hideHeading?: boolean;\n undo?: boolean;\n}\n\nexport const MiniCart: Container<MiniCartProps, CartModel | null> = ({\n children,\n initialData = null,\n hideFooter = true, // Default to true for MiniCart\n slots,\n routeProduct,\n routeCart,\n routeCheckout,\n routeEmptyCartCTA,\n showDiscount,\n showSavings,\n enableItemRemoval = true, // Default to true for MiniCart\n enableQuantityUpdate = false, // Default to false for MiniCart\n hideHeading = false, // Default to false for MiniCart\n undo = false,\n ...props\n}) => {\n const [data, setData] = useState<CartModel | null>(initialData);\n const cartTaxesConfig = state.config?.shoppingCartDisplaySetting;\n\n useEffect(() => {\n const event = events.on(\n 'cart/data',\n (payload) => {\n setData(payload as CartModel);\n },\n { eager: true }\n );\n\n return () => {\n event?.off();\n };\n }, []);\n\n const dictionary = useText({\n cartLink: 'Cart.MiniCart.cartLink',\n checkoutLink: 'Cart.MiniCart.checkoutLink',\n });\n\n const handleItemQuantityUpdate = (uid: string, quantity: number) => {\n return updateProductsFromCart([{ uid, quantity }]);\n };\n\n const handleItemRemove = (uid: string) => handleItemQuantityUpdate(uid, 0);\n\n const checkoutLinkDisabled = data?.hasOutOfStockItems;\n\n const handleInitiateCheckout = useCallback(() => {\n if (data && !checkoutLinkDisabled) {\n publishInitiateCheckoutEvent(data, state.locale);\n }\n }, [data, checkoutLinkDisabled]);\n\n const productList = (\n <Slot\n name=\"ProductList\"\n slot={slots?.ProductList}\n context={{\n itemQuantityUpdateHandler: handleItemQuantityUpdate,\n itemRemoveHandler: handleItemRemove,\n totalQuantity: data?.totalQuantity,\n }}\n >\n <CartSummaryList\n data-testid=\"default-cart-summary-list\"\n routeProduct={routeProduct}\n routeEmptyCartCTA={routeEmptyCartCTA}\n initialData={data}\n maxItems={state.config?.miniCartMaxItemsDisplay}\n showMaxItems={!!state.config?.miniCartMaxItemsDisplay}\n hideHeading={hideHeading || !data?.totalQuantity}\n hideFooter={hideFooter}\n enableRemoveItem={enableItemRemoval}\n enableUpdateItemQuantity={enableQuantityUpdate}\n showDiscount={showDiscount}\n showSavings={showSavings}\n undo={undo}\n slots={{\n Thumbnail: slots?.Thumbnail,\n }}\n />\n </Slot>\n );\n\n const getProductListFooter = (data: CartModel | null) => {\n return (\n <Slot\n name=\"ProductListFooter\"\n slot={slots?.ProductListFooter}\n context={{\n data,\n }}\n />\n );\n };\n\n const getPreCheckoutSection = (data: CartModel | null) => {\n return (\n <Slot\n name=\"PreCheckoutSection\"\n slot={slots?.PreCheckoutSection}\n context={{\n data,\n }}\n />\n );\n };\n\n const getSubtotalPriceProps = () =>\n cartTaxesConfig?.subtotal === 'INCLUDING_TAX' ||\n cartTaxesConfig?.subtotal === 'INCLUDING_EXCLUDING_TAX'\n ? {\n amount: data?.subtotal.includingTax.value,\n currency: data?.subtotal.includingTax.currency,\n 'data-testid': 'subtotal-including-tax',\n style: { font: 'inherit' },\n }\n : {\n amount: data?.subtotal.excludingTax.value,\n currency: data?.subtotal.excludingTax.currency,\n 'data-testid': 'subtotal-excluding-tax',\n style: { font: 'inherit' },\n };\n\n return (\n <MiniCartComponent\n {...props}\n productListFooter={getProductListFooter(data)}\n subtotal={\n !data?.totalQuantity\n ? undefined\n : data?.subtotal && <Price {...getSubtotalPriceProps()} />\n }\n subtotalExcludingTaxes={\n !data?.totalQuantity\n ? undefined\n : data?.subtotal &&\n (cartTaxesConfig?.subtotal === 'INCLUDING_EXCLUDING_TAX' ? (\n <Price\n amount={data?.subtotal.excludingTax.value}\n currency={data?.subtotal.excludingTax.currency}\n data-testid=\"subtotal-including-excluding-tax\"\n style={{ font: 'inherit' }}\n />\n ) : undefined)\n }\n preCheckoutSection={getPreCheckoutSection(data)}\n ctas={\n !data?.totalQuantity ? undefined : (\n <div>\n {routeCheckout && (\n <Button\n data-testid=\"route-checkout-button\"\n variant=\"primary\"\n href={checkoutLinkDisabled ? undefined : routeCheckout()}\n disabled={checkoutLinkDisabled}\n aria-disabled={checkoutLinkDisabled}\n onClick={handleInitiateCheckout}\n >\n {dictionary.checkoutLink}\n </Button>\n )}\n {routeCart && (\n <Button\n data-testid=\"route-cart-button\"\n variant=\"tertiary\"\n href={routeCart()}\n >\n {dictionary.cartLink}\n </Button>\n )}\n </div>\n )\n }\n products={productList}\n />\n );\n};\n\nMiniCart.getInitialData = async function () {\n return getPersistedCartData();\n};\n"],"names":["MiniCart","className","products","productListFooter","subtotal","subtotalExcludingTaxes","preCheckoutSection","ctas","props","dictionary","useText","jsx","classes","jsxs","Fragment","VComponent","children","initialData","hideFooter","slots","routeProduct","routeCart","routeCheckout","routeEmptyCartCTA","showDiscount","showSavings","enableItemRemoval","enableQuantityUpdate","hideHeading","undo","data","setData","useState","cartTaxesConfig","_a","state","useEffect","event","events","payload","handleItemQuantityUpdate","uid","quantity","updateProductsFromCart","handleItemRemove","checkoutLinkDisabled","handleInitiateCheckout","useCallback","publishInitiateCheckoutEvent","productList","Slot","CartSummaryList","_b","_c","getProductListFooter","getPreCheckoutSection","getSubtotalPriceProps","MiniCartComponent","Price","Button","getPersistedCartData"],"mappings":"mxCAiCO,MAAMA,EAA6C,CAAC,CACzD,UAAAC,EACA,SAAAC,EACA,kBAAAC,EACA,SAAAC,EACA,uBAAAC,EACA,mBAAAC,EACA,KAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAaC,EAAQ,CACzB,SAAU,yBACV,uBAAwB,sCAAA,CACzB,EAED,OACGC,EAAA,MAAA,CAAK,GAAGH,EAAO,UAAWI,EAAQ,CAAC,iBAAkBX,CAAS,CAAC,EAE7D,SAAAC,GAEGW,EAAAC,EAAA,CAAA,SAAA,CAAAH,EAAC,MAAA,CACC,UAAU,2BACV,cAAY,6BAEX,SAAAT,CAAA,CACH,EAGCC,GACCQ,EAAC,MAAA,CACC,UAAWC,EAAQ,C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EAjD,EAAS,eAAiB,gBAAkB,CAC1C,OAAO4D,EAAqB,CAC9B"}
1
+ {"version":3,"file":"MiniCart.js","sources":["/@dropins/storefront-cart/src/components/MiniCart/MiniCart.tsx","/@dropins/storefront-cart/src/containers/MiniCart/MiniCart.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { VComponent, classes } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nimport '@/cart/components/MiniCart/MiniCart.css';\n\nexport interface MiniCartProps extends HTMLAttributes<HTMLDivElement> {\n products?: VNode;\n productListFooter?: VNode;\n subtotal?: VNode;\n subtotalExcludingTaxes?: VNode;\n preCheckoutSection?: VNode;\n ctas?: VNode;\n}\n\nexport const MiniCart: FunctionComponent<MiniCartProps> = ({\n className,\n products,\n productListFooter,\n subtotal,\n subtotalExcludingTaxes,\n preCheckoutSection,\n ctas,\n ...props\n}) => {\n const dictionary = useText({\n subtotal: 'Cart.MiniCart.subtotal',\n subtotalExcludingTaxes: 'Cart.MiniCart.subtotalExcludingTaxes',\n });\n\n return (\n <div {...props} className={classes(['cart-mini-cart', className])}>\n {/* Content */}\n {products && (\n <>\n <div\n className=\"cart-mini-cart__products\"\n data-testid=\"mini-cart-products-wrapper\"\n >\n {products}\n </div>\n\n {/* Product List Footer */}\n {productListFooter && (\n <div\n className={classes(['cart-mini-cart__productListFooter'])}\n data-testid=\"mini-cart-product-list-footer\"\n >\n <VComponent node={productListFooter} />\n </div>\n )}\n\n <div\n className=\"cart-mini-cart__footer\"\n data-testid=\"mini-cart-subtotals\"\n >\n {/* Subtotal */}\n {subtotal && (\n <div\n className=\"cart-mini-cart__footer__estimated-total\"\n data-testid=\"mini-cart-subtotal\"\n >\n {dictionary.subtotal}\n <VComponent node={subtotal} />\n </div>\n )}\n {/* Subtotal Excluding Taxes */}\n {subtotalExcludingTaxes && (\n <div\n className=\"cart-mini-cart__footer__estimated-total-excluding-taxes\"\n data-testid=\"mini-cart-subtotal-excluding-taxes\"\n >\n {dictionary.subtotalExcludingTaxes}\n <VComponent\n node={subtotalExcludingTaxes}\n className={classes([\n 'dropin-price-summary__price',\n 'dropin-price-summary__price--muted',\n ])}\n />\n </div>\n )}\n\n {/* Pre-checkout section */}\n {preCheckoutSection && (\n <div\n className={classes(['cart-mini-cart__preCheckoutSection'])}\n data-testid=\"mini-cart-pre-checkout-section\"\n >\n <VComponent node={preCheckoutSection} />\n </div>\n )}\n\n {ctas && (\n <VComponent\n node={ctas}\n className=\"cart-mini-cart__footer__ctas\"\n />\n )}\n </div>\n </>\n )}\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n HTMLAttributes,\n useCallback,\n useEffect,\n useState,\n} from 'preact/compat';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { CartModel } from '@/cart/data/models';\nimport { getPersistedCartData } from '@/cart/lib/persisted-data';\nimport { events } from '@adobe-commerce/event-bus';\nimport { MiniCart as MiniCartComponent } from '@/cart/components';\nimport { CartSummaryList } from '@/cart/containers';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Button, ImageProps, Price } from '@adobe-commerce/elsie/components';\nimport { updateProductsFromCart } from '@/cart/api';\nimport { publishInitiateCheckoutEvent } from '@/cart/lib/acdl';\nimport { state } from '@/cart/lib/state';\n\nexport interface MiniCartProps extends HTMLAttributes<HTMLDivElement> {\n routeProduct?: (item: CartModel['items'][0]) => string;\n routeCart?: () => string;\n routeCheckout?: () => string;\n routeEmptyCartCTA?: () => string;\n slots?: {\n ProductList?: SlotProps;\n ProductListFooter?: SlotProps;\n PreCheckoutSection?: SlotProps;\n Thumbnail?: SlotProps<{\n item: CartModel['items'][number];\n defaultImageProps: ImageProps;\n }>;\n Heading?: SlotProps;\n EmptyCart?: SlotProps;\n Footer?: SlotProps;\n ProductAttributes?: SlotProps;\n CartSummaryFooter?: SlotProps;\n CartItem?: SlotProps; // For backward compatibility\n UndoBanner?: SlotProps<{\n item: CartModel['items'][0];\n loading: boolean;\n error?: string;\n onUndo: () => void;\n onDismiss: () => void;\n }>;\n ItemTitle?: SlotProps<{ item: CartModel['items'][number] }>;\n ItemPrice?: SlotProps<{ item: CartModel['items'][number] }>;\n ItemQuantity?: SlotProps<{\n item: CartModel['items'][number];\n enableUpdateItemQuantity: boolean;\n handleItemQuantityUpdate: (\n item: CartModel['items'][number],\n quantity: number\n ) => void;\n itemsLoading: Set<string>;\n handleItemsError: (uid: string, message?: string) => void;\n handleItemsLoading: (uid: string, state: boolean) => void;\n onItemUpdate?: ({ item }: { item: CartModel['items'][number] }) => void;\n }>;\n ItemTotal?: SlotProps<{ item: CartModel['items'][number] }>;\n ItemSku?: SlotProps<{ item: CartModel['items'][number] }>;\n ItemRemoveAction?: SlotProps<{\n item: CartModel['items'][number];\n enableRemoveItem: boolean;\n handleItemQuantityUpdate: (\n item: CartModel['items'][number],\n quantity: number\n ) => void;\n handleItemsError: (uid: string, message?: string) => void;\n handleItemsLoading: (uid: string, state: boolean) => void;\n onItemUpdate?: ({ item }: { item: CartModel['items'][number] }) => void;\n itemsLoading: Set<string>;\n }>;\n };\n hideFooter?: boolean;\n displayAllItems?: boolean;\n showDiscount?: boolean;\n showSavings?: boolean;\n enableItemRemoval?: boolean;\n enableQuantityUpdate?: boolean;\n hideHeading?: boolean;\n undo?: boolean;\n}\n\nexport const MiniCart: Container<MiniCartProps, CartModel | null> = ({\n children,\n initialData = null,\n hideFooter = true, // Default to true for MiniCart\n slots,\n routeProduct,\n routeCart,\n routeCheckout,\n routeEmptyCartCTA,\n showDiscount,\n showSavings,\n enableItemRemoval = true, // Default to true for MiniCart\n enableQuantityUpdate = false, // Default to false for MiniCart\n hideHeading = false, // Default to false for MiniCart\n undo = false,\n ...props\n}) => {\n const [data, setData] = useState<CartModel | null>(initialData);\n const cartTaxesConfig = state.config?.shoppingCartDisplaySetting;\n\n useEffect(() => {\n const event = events.on(\n 'cart/data',\n (payload) => {\n setData(payload as CartModel);\n },\n { eager: true }\n );\n\n return () => {\n event?.off();\n };\n }, []);\n\n const dictionary = useText({\n cartLink: 'Cart.MiniCart.cartLink',\n checkoutLink: 'Cart.MiniCart.checkoutLink',\n });\n\n const handleItemQuantityUpdate = (uid: string, quantity: number) => {\n return updateProductsFromCart([{ uid, quantity }]);\n };\n\n const handleItemRemove = (uid: string) => handleItemQuantityUpdate(uid, 0);\n\n const checkoutLinkDisabled = data?.hasOutOfStockItems;\n\n const handleInitiateCheckout = useCallback(() => {\n if (data && !checkoutLinkDisabled) {\n publishInitiateCheckoutEvent(data, state.locale);\n }\n }, [data, checkoutLinkDisabled]);\n\n const productList = (\n <Slot\n name=\"ProductList\"\n slot={slots?.ProductList}\n context={{\n itemQuantityUpdateHandler: handleItemQuantityUpdate,\n itemRemoveHandler: handleItemRemove,\n totalQuantity: data?.totalQuantity,\n }}\n >\n <CartSummaryList\n data-testid=\"default-cart-summary-list\"\n routeProduct={routeProduct}\n routeEmptyCartCTA={routeEmptyCartCTA}\n initialData={data}\n maxItems={state.config?.miniCartMaxItemsDisplay}\n showMaxItems={!!state.config?.miniCartMaxItemsDisplay}\n hideHeading={hideHeading || !data?.totalQuantity}\n hideFooter={hideFooter}\n enableRemoveItem={enableItemRemoval}\n enableUpdateItemQuantity={enableQuantityUpdate}\n showDiscount={showDiscount}\n showSavings={showSavings}\n undo={undo}\n slots={{\n Thumbnail: slots?.Thumbnail,\n Heading: slots?.Heading,\n EmptyCart: slots?.EmptyCart,\n Footer: slots?.Footer,\n ProductAttributes: slots?.ProductAttributes,\n CartSummaryFooter: slots?.CartSummaryFooter,\n CartItem: slots?.CartItem, // Keep for backward compatibility\n UndoBanner: slots?.UndoBanner,\n ItemTitle: slots?.ItemTitle,\n ItemPrice: slots?.ItemPrice,\n ItemQuantity: slots?.ItemQuantity,\n ItemTotal: slots?.ItemTotal,\n ItemSku: slots?.ItemSku,\n ItemRemoveAction: slots?.ItemRemoveAction,\n }}\n />\n </Slot>\n );\n\n const getProductListFooter = (data: CartModel | null) => {\n return (\n <Slot\n name=\"ProductListFooter\"\n slot={slots?.ProductListFooter}\n context={{\n data,\n }}\n />\n );\n };\n\n const getPreCheckoutSection = (data: CartModel | null) => {\n return (\n <Slot\n name=\"PreCheckoutSection\"\n slot={slots?.PreCheckoutSection}\n context={{\n data,\n }}\n />\n );\n };\n\n const getSubtotalPriceProps = () =>\n cartTaxesConfig?.subtotal === 'INCLUDING_TAX' ||\n cartTaxesConfig?.subtotal === 'INCLUDING_EXCLUDING_TAX'\n ? {\n amount: data?.subtotal.includingTax.value,\n currency: data?.subtotal.includingTax.currency,\n 'data-testid': 'subtotal-including-tax',\n style: { font: 'inherit' },\n }\n : {\n amount: data?.subtotal.excludingTax.value,\n currency: data?.subtotal.excludingTax.currency,\n 'data-testid': 'subtotal-excluding-tax',\n style: { font: 'inherit' },\n };\n\n return (\n <MiniCartComponent\n {...props}\n productListFooter={getProductListFooter(data)}\n subtotal={\n !data?.totalQuantity\n ? undefined\n : data?.subtotal && <Price {...getSubtotalPriceProps()} />\n }\n subtotalExcludingTaxes={\n !data?.totalQuantity\n ? undefined\n : data?.subtotal &&\n (cartTaxesConfig?.subtotal === 'INCLUDING_EXCLUDING_TAX' ? (\n <Price\n amount={data?.subtotal.excludingTax.value}\n currency={data?.subtotal.excludingTax.currency}\n data-testid=\"subtotal-including-excluding-tax\"\n style={{ font: 'inherit' }}\n />\n ) : undefined)\n }\n preCheckoutSection={getPreCheckoutSection(data)}\n ctas={\n !data?.totalQuantity ? undefined : (\n <div>\n {routeCheckout && (\n <Button\n data-testid=\"route-checkout-button\"\n variant=\"primary\"\n href={checkoutLinkDisabled ? undefined : routeCheckout()}\n disabled={checkoutLinkDisabled}\n aria-disabled={checkoutLinkDisabled}\n onClick={handleInitiateCheckout}\n >\n {dictionary.checkoutLink}\n </Button>\n )}\n {routeCart && (\n <Button\n data-testid=\"route-cart-button\"\n variant=\"tertiary\"\n href={routeCart()}\n >\n {dictionary.cartLink}\n </Button>\n )}\n </div>\n )\n }\n products={productList}\n />\n );\n};\n\nMiniCart.getInitialData = async function () {\n return getPersistedCartData();\n};\n"],"names":["MiniCart","className","products","productListFooter","subtotal","subtotalExcludingTaxes","preCheckoutSection","ctas","props","dictionary","useText","jsx","classes","jsxs","Fragment","VComponent","children","initialData","hideFooter","slots","routeProduct","routeCart","routeCheckout","routeEmptyCartCTA","showDiscount","showSavings","enableItemRemoval","enableQuantityUpdate","hideHeading","undo","data","setData","useState","cartTaxesConfig","_a","state","useEffect","event","events","payload","handleItemQuantityUpdate","uid","quantity","updateProductsFromCart","handleItemRemove","checkoutLinkDisabled","handleInitiateCheckout","useCallback","publishInitiateCheckoutEvent","productList","Slot","CartSummaryList","_b","_c","getProductListFooter","getPreCheckoutSection","getSubtotalPriceProps","MiniCartComponent","Price","Button","getPersistedCartData"],"mappings":"uwCAiCO,MAAMA,EAA6C,CAAC,CACzD,UAAAC,EACA,SAAAC,EACA,kBAAAC,EACA,SAAAC,EACA,uBAAAC,EACA,mBAAAC,EACA,KAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAM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,EAAA+C,EAAA,CAAO,GAAGF,EAAyB,CAAA,CAAA,EADtD,OAGN,uBACG1B,GAAA,MAAAA,EAAM,eAEHA,GAAA,YAAAA,EAAM,aACLG,GAAA,YAAAA,EAAiB,YAAa,0BAC7BtB,EAAC+C,EAAA,CACC,OAAQ5B,GAAA,YAAAA,EAAM,SAAS,aAAa,MACpC,SAAUA,GAAA,YAAAA,EAAM,SAAS,aAAa,SACtC,cAAY,mCACZ,MAAO,CAAE,KAAM,SAAU,CAAA,CAEzB,EAAA,QATJ,OAWN,mBAAoByB,EAAsBzB,CAAI,EAC9C,KACGA,GAAA,MAAAA,EAAM,gBACJ,MACE,CAAA,SAAA,CACCR,GAAAX,EAACgD,EAAA,CACC,cAAY,wBACZ,QAAQ,UACR,KAAMd,EAAuB,OAAYvB,EAAc,EACvD,SAAUuB,EACV,gBAAeA,EACf,QAASC,EAER,SAAWrC,EAAA,YAAA,CACd,EAEDY,GACCV,EAACgD,EAAA,CACC,cAAY,oBACZ,QAAQ,WACR,KAAMtC,EAAU,EAEf,SAAWZ,EAAA,QAAA,CAAA,CACd,EAEJ,EAvBqB,OA0BzB,SAAUwC,CAAA,CACZ,CAEJ,EAEAjD,EAAS,eAAiB,gBAAkB,CAC1C,OAAO4D,EAAqB,CAC9B"}
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-cart", "version": "1.5.0-beta1", "@dropins/tools": "1.4.0-beta1", "license": "SEE LICENSE IN LICENSE.md"}
1
+ {"name": "@dropins/storefront-cart", "version": "1.5.0-beta3", "@dropins/tools": "1.4.0-beta6", "license": "SEE LICENSE IN LICENSE.md"}
@@ -1,18 +0,0 @@
1
- /********************************************************************
2
- * ADOBE CONFIDENTIAL
3
- * __________________
4
- *
5
- * Copyright 2024 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 declare const CART_ITEMS_PAGINATION_ARGUMENTS = "\n $pageSize: Int! = 100,\n $currentPage: Int! = 1,\n $itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC}\n";
18
- //# sourceMappingURL=arguments.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WarningWithCircle.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/OrderError.svg","../../node_modules/@adobe-commerce/elsie/src/icons/WarningWithCircle.svg"],"sourcesContent":["import * as React from \"react\";\nconst SvgOrderError = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { clipPath: \"url(#clip0_4797_15331)\" }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M10.25 20.91L1.5 17.55V6.51996L10.25 9.92996V20.91Z\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M6.24023 4.64001L14.9902 8.06001V11.42\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { className: \"error-icon\", vectorEffect: \"non-scaling-stroke\", d: \"M19 13.31L15.5 19.37H22.5L19 13.31Z\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { className: \"error-icon\", vectorEffect: \"non-scaling-stroke\", d: \"M19.0202 17.11H18.9802L18.9502 15.56H19.0502L19.0202 17.11ZM18.9602 18.29V18.06H19.0502V18.29H18.9602Z\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M19 12.16V6.51996L10.25 9.92996V20.91L14.27 19.37L14.4 19.32\", stroke: \"currentColor\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M1.5 6.51999L10.25 3.04999L19 6.51999L10.25 9.92999L1.5 6.51999Z\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" })), /* @__PURE__ */ React.createElement(\"defs\", null, /* @__PURE__ */ React.createElement(\"clipPath\", { id: \"clip0_4797_15331\" }, /* @__PURE__ */ React.createElement(\"rect\", { width: 22, height: 18.86, fill: \"white\", transform: \"translate(1 2.54999)\" }))));\nexport default SvgOrderError;\n","import * as React from \"react\";\nconst SvgWarningWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z\", stroke: \"currentColor\" }));\nexport default SvgWarningWithCircle;\n"],"names":["SvgOrderError","props","React","SvgWarningWithCircle"],"mappings":"kDACK,MAACA,EAAiBC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAO,EAAkBC,EAAM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