@dropins/storefront-cart 0.7.0-alpha007 → 0.7.0-alpha010
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/graphql/CartFragment.d.ts +2 -0
- package/api/initialize/initialize.d.ts +1 -5
- package/api.js +6 -7
- package/chunks/CartFragment.js +242 -0
- package/chunks/CartSummaryList.js +1 -1
- package/chunks/getEstimatedTotals.js +5 -5
- package/chunks/getStoreConfig.js +15 -35
- package/chunks/updateProductsFromCart.js +5 -6
- package/containers/Cart.js +1 -1
- package/containers/CartSummaryList/CartSummaryList.d.ts +1 -0
- package/containers/CartSummaryList.js +1 -1
- package/containers/MiniCart.js +1 -1
- package/containers/OrderSummary.js +1 -1
- package/package.json +1 -1
- package/render.js +1 -1
- package/api/fragments.d.ts +0 -3
- package/api/graphql/CartItemFragment.d.ts +0 -2
- package/api/graphql/CustomerAccountFragment.d.ts +0 -2
- package/api/graphql/CustomizableOptionsFragment.d.ts +0 -2
- package/api/graphql/PriceRangeFragment.d.ts +0 -2
- package/api/graphql/arguments.d.ts +0 -2
- package/fragments.d.ts +0 -1
- package/fragments.js +0 -239
|
@@ -15,4 +15,6 @@
|
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
17
|
export declare const CART_FRAGMENT: string;
|
|
18
|
+
export declare const CART_ITEMS_PAGINATION_ARGUMENTS = "\n $pageSize: Int! = 100,\n $currentPage: Int! = 1,\n $itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC}\n";
|
|
19
|
+
export declare const CUSTOMER_ACCOUNT_FRAGMENT = "\ncustomer {\n addresses {\n default_shipping\n country_id\n postcode\n region {\n region\n region_code\n region_id\n }\n }\n}";
|
|
18
20
|
//# sourceMappingURL=CartFragment.d.ts.map
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { Initializer
|
|
1
|
+
import { Initializer } from '@dropins/tools/types/elsie/src/lib';
|
|
2
2
|
import { Lang } from '@dropins/tools/types/elsie/src/i18n';
|
|
3
|
-
import { CartModel } from '../../data/models';
|
|
4
3
|
|
|
5
4
|
type ConfigProps = {
|
|
6
5
|
disableGuestCart?: boolean;
|
|
7
6
|
langDefinitions?: Lang;
|
|
8
|
-
models?: {
|
|
9
|
-
CartModel?: Model<CartModel>;
|
|
10
|
-
};
|
|
11
7
|
};
|
|
12
8
|
export declare const initialize: Initializer<ConfigProps>;
|
|
13
9
|
export declare const config: import('@dropins/tools/types/elsie/src/lib').Config<ConfigProps>;
|
package/api.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{s,f as p,h as T}from"./chunks/resetCart.js";import{g as $,r as v,d as Q,a as H,b as k,c as z}from"./chunks/resetCart.js";import{C as
|
|
1
|
+
import{s,f as p,h as T}from"./chunks/resetCart.js";import{g as $,r as v,d as Q,a as H,b as k,c as z}from"./chunks/resetCart.js";import{C as g,a as l,t as f}from"./chunks/CartFragment.js";import{events as m}from"@dropins/tools/event-bus.js";import{c as h,p as I}from"./chunks/acdl.js";import{c as _,g as E,a as A}from"./chunks/getStoreConfig.js";import{b as j,e as q,i as B,d as J}from"./chunks/getStoreConfig.js";import{u as L}from"./chunks/updateProductsFromCart.js";import{g as W,b as X,a as Z}from"./chunks/getEstimateShipping.js";import{g as at}from"./chunks/getEstimatedTotals.js";import{g as et}from"./chunks/persisted-data.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const R=`
|
|
2
2
|
mutation ADD_PRODUCTS_TO_CART_MUTATION(
|
|
3
3
|
$cartId: String!,
|
|
4
4
|
$cartItems: [CartItemInput!]!,
|
|
5
|
-
${
|
|
5
|
+
${g}
|
|
6
6
|
) {
|
|
7
7
|
addProductsToCart(
|
|
8
8
|
cartId: $cartId
|
|
9
9
|
cartItems: $cartItems
|
|
10
10
|
) {
|
|
11
11
|
cart {
|
|
12
|
-
...
|
|
12
|
+
...CartFragment
|
|
13
13
|
}
|
|
14
14
|
user_errors {
|
|
15
15
|
code
|
|
@@ -17,10 +17,9 @@ import{s,f as p,h as T}from"./chunks/resetCart.js";import{g as $,r as v,d as Q,a
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
`,b=async r=>{let o=!1;const c=s.cartId||await G().then(e=>(o=!0,e));return p(R,{variables:{cartId:c,cartItems:r.map(({sku:e,parentSku:a,quantity:n,optionsUIDs:t,enteredOptions:i})=>({sku:e,parent_sku:a,quantity:n,selected_options:t,entered_options:i}))}}).then(({errors:e,data:a})=>{var i;const n=[...((i=a==null?void 0:a.addProductsToCart)==null?void 0:i.user_errors)??[],...e??[]];if(n.length>0)return T(n);const t=f(a.addProductsToCart.cart);if(d.emit("cart/updated",t),d.emit("cart/data",t),t){const m=t.items.filter(C=>r.some(({sku:u})=>u===C.sku));o?A(t,m,s.locale??"en-US"):E(t,m,s.locale??"en-US")}return t})},P=`
|
|
20
|
+
${l}
|
|
21
|
+
`,b=async a=>{let o=!1;const n=s.cartId||await O().then(e=>(o=!0,e));return p(R,{variables:{cartId:n,cartItems:a.map(({sku:e,parentSku:r,quantity:c,optionsUIDs:t,enteredOptions:i})=>({sku:e,parent_sku:r,quantity:c,selected_options:t,entered_options:i}))}}).then(({errors:e,data:r})=>{var i;const c=[...((i=r==null?void 0:r.addProductsToCart)==null?void 0:i.user_errors)??[],...e??[]];if(c.length>0)return T(c);const t=f(r.addProductsToCart.cart);if(m.emit("cart/updated",t),m.emit("cart/data",t),t){const d=t.items.filter(C=>a.some(({sku:u})=>u===C.sku));o?h(t,d,s.locale??"en-US"):I(t,d,s.locale??"en-US")}return t})},P=`
|
|
23
22
|
mutation CREATE_EMPTY_CART_MUTATION {
|
|
24
23
|
createEmptyCart
|
|
25
24
|
}
|
|
26
|
-
`,
|
|
25
|
+
`,O=async()=>{const{disableGuestCart:a}=_.getConfig();if(a)throw new Error("Guest cart is disabled");return await p(P).then(({data:o})=>{const n=o.createEmptyCart;return s.cartId=n,n})},F=async()=>{const a=s.authenticated?await E():await A();return m.emit("cart/updated",a),m.emit("cart/data",a),a};export{b as addProductsToCart,_ as config,O as createEmptyCart,p as fetchGraphQl,j as getCartData,et as getCartDataFromCache,$ as getConfig,W as getCountries,E as getCustomerCartPayload,X as getEstimateShipping,at as getEstimatedTotals,A as getGuestCartPayload,Z as getRegions,q as getStoreConfig,B as initialize,J as initializeCart,F as refreshCart,v as removeFetchGraphQlHeader,Q as resetCart,H as setEndpoint,k as setFetchGraphQlHeader,z as setFetchGraphQlHeaders,L as updateProductsFromCart};
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import{s}from"./resetCart.js";function D(r){var n,u,e,l,c,t,a;return r?{id:r.id,totalQuantity:G(r),errors:w(r==null?void 0:r.itemsV2),items:T(r==null?void 0:r.itemsV2),miniCartMaxItems:T(r==null?void 0:r.itemsV2).slice(0,((n=s.config)==null?void 0:n.miniCartMaxItemsDisplay)??10),total:{includingTax:{value:r.prices.grand_total.value,currency:r.prices.grand_total.currency},excludingTax:{value:r.prices.grand_total_excluding_tax.value,currency:r.prices.grand_total_excluding_tax.currency}},subtotal:{excludingTax:{value:(u=r.prices.subtotal_excluding_tax)==null?void 0:u.value,currency:(e=r.prices.subtotal_excluding_tax)==null?void 0:e.currency},includingTax:{value:(l=r.prices.subtotal_including_tax)==null?void 0:l.value,currency:(c=r.prices.subtotal_including_tax)==null?void 0:c.currency},includingDiscountOnly:{value:(t=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:t.value,currency:(a=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:a.currency}},appliedTaxes:O(r.prices.applied_taxes),totalTax:S(r.prices.applied_taxes,r.prices.grand_total.currency),appliedDiscounts:O(r.prices.discounts),isVirtual:r.is_virtual,addresses:{shipping:r.shipping_addresses&&$(r)},isGuestCart:!s.authenticated,hasOutOfStockItems:M(r),hasFullyOutOfStockItems:F(r)}:null}function S(r,n){return r!=null&&r.length?r.reduce((u,e)=>({value:u.value+e.amount.value,currency:e.amount.currency}),{value:0,currency:n}):{value:0,currency:n}}function T(r){var u;if(!((u=r==null?void 0:r.items)!=null&&u.length))return[];const n=s.config;return r.items.map(e=>{var l,c,t,a,_,o,i,y,m,f,b,d,v,C,x,h,I;return{itemType:e.__typename,uid:e.uid,url:{urlKey:e.product.url_key,categories:e.product.categories.map(p=>p.url_key)},quantity:e.quantity,sku:e.product.sku,name:e.product.name,image:{src:n!=null&&n.useConfigurableParentThumbnail?e.product.thumbnail.url:((c=(l=e.configured_variant)==null?void 0:l.thumbnail)==null?void 0:c.url)||e.product.thumbnail.url,alt:n!=null&&n.useConfigurableParentThumbnail?e.product.thumbnail.label:((a=(t=e.configured_variant)==null?void 0:t.thumbnail)==null?void 0:a.label)||e.product.thumbnail.label},price:{value:e.prices.price.value,currency:e.prices.price.currency},taxedPrice:{value:e.prices.price_including_tax.value,currency:e.prices.price_including_tax.currency},rowTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},rowTotalIncludingTax:{value:e.prices.row_total_including_tax.value,currency:e.prices.row_total_including_tax.currency},links:N(e.links),total:e.__typename==="SimpleCartItem"&&e.customizable_options.length!==0||e.__typename==="BundleCartItem"?{value:e.prices.row_total.value,currency:e.prices.row_total.currency}:{value:(_=e.prices.original_row_total)==null?void 0:_.value,currency:(o=e.prices.original_row_total)==null?void 0:o.currency},discount:{value:e.prices.total_item_discount.value,currency:e.prices.total_item_discount.currency,label:(i=e.prices.discounts)==null?void 0:i.map(p=>p.label)},regularPrice:e.__typename==="ConfigurableCartItem"?{value:(m=(y=e.configured_variant)==null?void 0:y.price_range)==null?void 0:m.maximum_price.regular_price.value,currency:(b=(f=e.configured_variant)==null?void 0:f.price_range)==null?void 0:b.maximum_price.regular_price.currency}:e.__typename==="GiftCardCartItem"||e.__typename==="SimpleCartItem"&&e.customizable_options.length!==0||e.__typename==="BundleCartItem"?{value:e.prices.price.value,currency:e.prices.price.currency}:{value:(d=e.product.price_range)==null?void 0:d.maximum_price.regular_price.value,currency:(v=e.product.price_range)==null?void 0:v.maximum_price.regular_price.currency},discounted:e.__typename==="BundleCartItem"||e.__typename==="SimpleCartItem"&&e.customizable_options.length!==0?!1:e.__typename==="ConfigurableCartItem"?((x=(C=e.configured_variant)==null?void 0:C.price_range)==null?void 0:x.maximum_price.discount.amount_off)>0:((h=e.product.price_range)==null?void 0:h.maximum_price.discount.amount_off)>0,bundleOptions:e.__typename==="BundleCartItem"?E(e.bundle_options):null,selectedOptions:A(e.configurable_options),customizableOptions:z(e.customizable_options),sender:e.__typename==="GiftCardCartItem"?e.sender_name:null,senderEmail:e.__typename==="GiftCardCartItem"?e.sender_email:null,recipient:e.__typename==="GiftCardCartItem"?e.recipient_name:null,recipientEmail:e.__typename==="GiftCardCartItem"?e.recipient_email:null,message:e.__typename==="GiftCardCartItem"?e.message:null,discountedTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},onlyXLeftInStock:e.__typename==="ConfigurableCartItem"?(I=e.configured_variant)==null?void 0:I.only_x_left_in_stock:e.product.only_x_left_in_stock,lowInventory:e.is_available&&e.product.only_x_left_in_stock!==null,insufficientQuantity:(e.__typename==="ConfigurableCartItem"?e.configured_variant:e.product).stock_status==="IN_STOCK"&&!e.is_available,outOfStock:e.product.stock_status==="OUT_OF_STOCK",stockLevel:P(e)}})}function w(r){var u;const n=(u=r==null?void 0:r.items)==null?void 0:u.reduce((e,l)=>{var c;return(c=l.errors)==null||c.forEach(t=>{e.push({uid:l.uid,text:t.message})}),e},[]);return n!=null&&n.length?n:null}function O(r){return r!=null&&r.length?r.map(n=>({amount:{value:n.amount.value,currency:n.amount.currency},label:n.label})):[]}function E(r){const n=r==null?void 0:r.map(e=>({uid:e.uid,label:e.label,value:e.values.map(l=>l.label).join(", ")})),u={};return n==null||n.forEach(e=>{u[e.label]=e.value}),Object.keys(u).length>0?u:null}function A(r){const n=r==null?void 0:r.map(e=>({uid:e.configurable_product_option_uid,label:e.option_label,value:e.value_label})),u={};return n==null||n.forEach(e=>{u[e.label]=e.value}),Object.keys(u).length>0?u:null}function z(r){const n=r==null?void 0:r.map(e=>({uid:e.customizable_option_uid,label:e.label,type:e.type,values:e.values.map(l=>({uid:l.customizable_option_value_uid,label:l.label,value:l.value}))})),u={};return n==null||n.forEach(e=>{var l;switch(e.type){case"field":case"area":case"date_time":u[e.label]=e.values[0].value;break;case"radio":case"drop_down":u[e.label]=e.values[0].label;break;case"multiple":case"checkbox":u[e.label]=e.values.reduce((o,i)=>o?`${o}, ${i.label}`:i.label,"");break;case"file":const c=new DOMParser,t=e.values[0].value,_=((l=c.parseFromString(t,"text/html").querySelector("a"))==null?void 0:l.textContent)||"";u[e.label]=_;break}}),u}function G(r){var n,u;return((n=s.config)==null?void 0:n.cartSummaryDisplayTotal)===0?r.itemsV2.items.length:((u=s.config)==null?void 0:u.cartSummaryDisplayTotal)===1?r.total_quantity:r.itemsV2.items.length}function N(r){return(r==null?void 0:r.length)>0?{count:r.length,result:r.map(n=>n.title).join(", ")}:null}function $(r){var n,u,e,l;return(n=r.shipping_addresses)!=null&&n.length?(u=r.shipping_addresses)==null?void 0:u.map(c=>({countryCode:c.country.code,zipCode:c.postcode,regionCode:c.region.code})):(e=r.addresses)!=null&&e.length?(l=r.addresses)==null?void 0:l.filter(c=>c.default_shipping).map(c=>{var t;return c.default_shipping&&{countryCode:c.country_id,zipCode:c.postcode,regionCode:(t=c.region)==null?void 0:t.region_code}}):null}function M(r){var n,u;return(u=(n=r==null?void 0:r.itemsV2)==null?void 0:n.items)==null?void 0:u.some(e=>{var l;return((l=e==null?void 0:e.product)==null?void 0:l.stock_status)==="OUT_OF_STOCK"||e.product.stock_status==="IN_STOCK"&&!e.is_available})}function P(r){if(!r.not_available_message)return null;const n=r.not_available_message.match(/-?\d+/);return n?parseInt(n[0]):"noNumber"}function F(r){var n,u;return(u=(n=r==null?void 0:r.itemsV2)==null?void 0:n.items)==null?void 0:u.some(e=>{var l;return((l=e==null?void 0:e.product)==null?void 0:l.stock_status)==="OUT_OF_STOCK"})}const g=`
|
|
2
|
+
customizable_options {
|
|
3
|
+
type
|
|
4
|
+
customizable_option_uid
|
|
5
|
+
label
|
|
6
|
+
is_required
|
|
7
|
+
values {
|
|
8
|
+
label
|
|
9
|
+
value
|
|
10
|
+
price{
|
|
11
|
+
type
|
|
12
|
+
units
|
|
13
|
+
value
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`,k=`
|
|
18
|
+
price_range {
|
|
19
|
+
minimum_price {
|
|
20
|
+
regular_price {
|
|
21
|
+
value
|
|
22
|
+
currency
|
|
23
|
+
}
|
|
24
|
+
final_price {
|
|
25
|
+
value
|
|
26
|
+
currency
|
|
27
|
+
}
|
|
28
|
+
discount {
|
|
29
|
+
percent_off
|
|
30
|
+
amount_off
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
maximum_price {
|
|
34
|
+
regular_price {
|
|
35
|
+
value
|
|
36
|
+
currency
|
|
37
|
+
}
|
|
38
|
+
final_price {
|
|
39
|
+
value
|
|
40
|
+
currency
|
|
41
|
+
}
|
|
42
|
+
discount {
|
|
43
|
+
percent_off
|
|
44
|
+
amount_off
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`,V=`
|
|
49
|
+
fragment CartFragment on Cart {
|
|
50
|
+
id
|
|
51
|
+
total_quantity
|
|
52
|
+
is_virtual
|
|
53
|
+
prices {
|
|
54
|
+
subtotal_with_discount_excluding_tax {
|
|
55
|
+
currency
|
|
56
|
+
value
|
|
57
|
+
}
|
|
58
|
+
subtotal_including_tax {
|
|
59
|
+
currency
|
|
60
|
+
value
|
|
61
|
+
}
|
|
62
|
+
subtotal_excluding_tax {
|
|
63
|
+
currency
|
|
64
|
+
value
|
|
65
|
+
}
|
|
66
|
+
grand_total {
|
|
67
|
+
currency
|
|
68
|
+
value
|
|
69
|
+
}
|
|
70
|
+
grand_total_excluding_tax {
|
|
71
|
+
currency
|
|
72
|
+
value
|
|
73
|
+
}
|
|
74
|
+
applied_taxes {
|
|
75
|
+
label,
|
|
76
|
+
amount {
|
|
77
|
+
value
|
|
78
|
+
currency
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
discounts {
|
|
82
|
+
amount {
|
|
83
|
+
value
|
|
84
|
+
currency
|
|
85
|
+
}
|
|
86
|
+
label
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
itemsV2 (
|
|
90
|
+
pageSize:$pageSize,
|
|
91
|
+
currentPage:$currentPage,
|
|
92
|
+
sort: $itemsSortInput
|
|
93
|
+
) {
|
|
94
|
+
items {
|
|
95
|
+
__typename
|
|
96
|
+
uid
|
|
97
|
+
quantity
|
|
98
|
+
is_available
|
|
99
|
+
not_available_message
|
|
100
|
+
errors {
|
|
101
|
+
code
|
|
102
|
+
message
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
prices {
|
|
106
|
+
price {
|
|
107
|
+
value
|
|
108
|
+
currency
|
|
109
|
+
}
|
|
110
|
+
discounts {
|
|
111
|
+
amount {
|
|
112
|
+
value
|
|
113
|
+
currency
|
|
114
|
+
}
|
|
115
|
+
label
|
|
116
|
+
}
|
|
117
|
+
total_item_discount {
|
|
118
|
+
value
|
|
119
|
+
currency
|
|
120
|
+
}
|
|
121
|
+
row_total {
|
|
122
|
+
value
|
|
123
|
+
currency
|
|
124
|
+
}
|
|
125
|
+
row_total_including_tax {
|
|
126
|
+
value
|
|
127
|
+
currency
|
|
128
|
+
}
|
|
129
|
+
price_including_tax {
|
|
130
|
+
value
|
|
131
|
+
currency
|
|
132
|
+
}
|
|
133
|
+
fixed_product_taxes {
|
|
134
|
+
amount {
|
|
135
|
+
value
|
|
136
|
+
currency
|
|
137
|
+
}
|
|
138
|
+
label
|
|
139
|
+
}
|
|
140
|
+
original_row_total{
|
|
141
|
+
value
|
|
142
|
+
currency
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
product {
|
|
147
|
+
name
|
|
148
|
+
sku
|
|
149
|
+
thumbnail {
|
|
150
|
+
url
|
|
151
|
+
label
|
|
152
|
+
}
|
|
153
|
+
url_key
|
|
154
|
+
url_suffix
|
|
155
|
+
categories {
|
|
156
|
+
url_path
|
|
157
|
+
url_key
|
|
158
|
+
}
|
|
159
|
+
only_x_left_in_stock
|
|
160
|
+
stock_status
|
|
161
|
+
${k}
|
|
162
|
+
}
|
|
163
|
+
...on SimpleCartItem {
|
|
164
|
+
${g}
|
|
165
|
+
}
|
|
166
|
+
... on ConfigurableCartItem {
|
|
167
|
+
configurable_options {
|
|
168
|
+
configurable_product_option_uid
|
|
169
|
+
option_label
|
|
170
|
+
value_label
|
|
171
|
+
}
|
|
172
|
+
configured_variant {
|
|
173
|
+
uid
|
|
174
|
+
sku
|
|
175
|
+
only_x_left_in_stock
|
|
176
|
+
stock_status
|
|
177
|
+
thumbnail {
|
|
178
|
+
label
|
|
179
|
+
url
|
|
180
|
+
}
|
|
181
|
+
${k}
|
|
182
|
+
}
|
|
183
|
+
${g}
|
|
184
|
+
}
|
|
185
|
+
... on DownloadableCartItem {
|
|
186
|
+
links {
|
|
187
|
+
sort_order
|
|
188
|
+
title
|
|
189
|
+
}
|
|
190
|
+
${g}
|
|
191
|
+
}
|
|
192
|
+
... on BundleCartItem {
|
|
193
|
+
bundle_options {
|
|
194
|
+
uid
|
|
195
|
+
label
|
|
196
|
+
values {
|
|
197
|
+
uid
|
|
198
|
+
label
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
... on GiftCardCartItem {
|
|
203
|
+
message
|
|
204
|
+
recipient_email
|
|
205
|
+
recipient_name
|
|
206
|
+
sender_email
|
|
207
|
+
sender_name
|
|
208
|
+
amount{
|
|
209
|
+
currency
|
|
210
|
+
value
|
|
211
|
+
}
|
|
212
|
+
is_available
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
shipping_addresses {
|
|
217
|
+
country {
|
|
218
|
+
code
|
|
219
|
+
}
|
|
220
|
+
region {
|
|
221
|
+
code
|
|
222
|
+
}
|
|
223
|
+
postcode
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
`,q=`
|
|
227
|
+
$pageSize: Int! = 100,
|
|
228
|
+
$currentPage: Int! = 1,
|
|
229
|
+
$itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC}
|
|
230
|
+
`,B=`
|
|
231
|
+
customer {
|
|
232
|
+
addresses {
|
|
233
|
+
default_shipping
|
|
234
|
+
country_id
|
|
235
|
+
postcode
|
|
236
|
+
region {
|
|
237
|
+
region
|
|
238
|
+
region_code
|
|
239
|
+
region_id
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}`;export{q as C,V as a,B as b,D as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r,jsxs as k,Fragment as j}from"@dropins/tools/preact-jsx-runtime.js";import*as s from"@dropins/tools/preact-compat.js";import{useState as _,useEffect as F}from"@dropins/tools/preact-compat.js";import{classes as O,VComponent as V,Slot as T}from"@dropins/tools/lib.js";/* empty css */import{E as kt}from"./EmptyCart.js";import{Divider as mt,Skeleton as vt,SkeletonRow as Lt,InLineAlert as Ct,Icon as X,CartList as D,CartItem as wt,Price as x,Image as It}from"@dropins/tools/components.js";import{g as Et}from"./persisted-data.js";import{events as St}from"@dropins/tools/event-bus.js";import{s as _t}from"./resetCart.js";import{u as J}from"./updateProductsFromCart.js";import{useText as Ot}from"@dropins/tools/i18n.js";const K=d=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},s.createElement("g",{clipPath:"url(#clip0_4797_15331)"},s.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"}),s.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.24023 4.64001L14.9902 8.06001V11.42",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),s.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"}),s.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"}),s.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"}),s.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"})),s.createElement("defs",null,s.createElement("clipPath",{id:"clip0_4797_15331"},s.createElement("rect",{width:22,height:18.86,fill:"white",transform:"translate(1 2.54999)"})))),xt=d=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},s.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"}),s.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"})),Nt=({className:d,children:Z,heading:g,emptyCart:m,products:p,outOfStockMessage:h,loading:N=!0,...f})=>r("div",{...f,className:O(["cart-cart-summary-list",d]),children:N?r(Pt,{}):k(j,{children:[(g||h)&&k("div",{"data-testid":"cart-summary-list-heading-wrapper",className:O(["cart-cart-summary-list__heading",["cart-cart-summary-list__heading--full-width",!p]]),children:[g&&k(j,{children:[r(V,{node:g,className:"cart-cart-summary-list__heading-text"}),r(mt,{variant:"primary",className:O(["cart-cart-summary-list__heading-divider"])})]}),h&&r(V,{node:h,className:"cart-cart-summary-list__out-of-stock-message"})]}),r("div",{className:O(["cart-cart-summary-list__content",["cart-cart-summary-list__content--empty",!p]]),children:p||r(V,{node:m,className:"cart-cart-summary-list__empty-cart"})})]})}),Pt=()=>r(vt,{"data-testid":"cart-summary-list-skeleton",className:"cart-cart-summary-list__skeleton",rowGap:"medium",children:r(Lt,{variant:"row",size:"xlarge",fullWidth:!0,lines:3,multilineGap:"small"})}),Qt=({initialData:d=null,hideHeading:Z,routeProduct:g,routeEmptyCartCTA:m,onItemUpdate:p,onItemRemove:h,maxItems:N,slots:f,attributesToHide:o=[],enableRemoveItem:P,enableUpdateItemQuantity:$,onItemsErrorsChange:Q,...Y})=>{var q;const[R,H]=_(!d),[a,b]=_(d),[v,tt]=_(new Set),[I,et]=_(new Map),c=(q=_t.config)==null?void 0:q.shoppingCartDisplaySetting,i=Ot({file:"Cart.CartItem.file",files:"Cart.CartItem.files",heading:"Cart.Cart.heading",message:"Cart.CartItem.message",recipient:"Cart.CartItem.recipient",regularPrice:"Cart.CartItem.regularPrice",discountedPrice:"Cart.CartItem.discountedPrice",sender:"Cart.CartItem.sender",lowInventory:"Cart.CartItem.lowInventory",insufficientQuantity:"Cart.CartItem.insufficientQuantity",insufficientQuantityGeneral:"Cart.CartItem.insufficientQuantityGeneral",outOfStockHeading:"Cart.OutOfStockMessage.heading",outOfStockDescription:"Cart.OutOfStockMessage.message",outOfStockAlert:"Cart.OutOfStockMessage.alert",removeAction:"Cart.OutOfStockMessage.action",notAvailableMessage:"Cart.CartItem.notAvailableMessage"}),G=(t,e)=>{tt(n=>(e?n.add(t):n.delete(t),new Set(n)))},z=(t,e)=>{et(n=>(e?n.set(t,e):n.delete(t),new Map(n)))},A=(t,e)=>{G(t.uid,!0),z(t.uid),P&&e===0?J([{uid:t.uid,quantity:e}]).then(()=>{h==null||h({item:t})}).finally(()=>{G(t.uid,!1)}).catch(n=>{console.warn(n)}):$&&J([{uid:t.uid,quantity:e}]).then(()=>{p==null||p({item:t})}).finally(()=>{G(t.uid,!1)}).catch(n=>{console.warn(n),z(t.uid,n.message)})};F(()=>{const t=St.on("cart/data",e=>{b(e),H(!1)},{eager:!0});return()=>{t==null||t.off()}},[]),F(()=>{Q&&Q(I)},[I,Q]);const nt=(t,e)=>{if(o.includes("image"))return;const n=r(It,{"data-testid":"cart-list-item-image",loading:e<4?"eager":"lazy",src:t.image.src,alt:t.image.alt,width:"300",height:"300",params:{width:300}});return g?r("a",{href:g(t),children:n}):n},rt=t=>{if(!o.includes("name"))return r("span",{"data-testid":"cart-list-item-title",children:g?r("a",{href:g(t),children:t.name}):t.name})},at=t=>{if(!o.includes("configurations"))return{...t.bundleOptions,...t.selectedOptions,...t.customizableOptions,...t.recipient?{[i.recipient]:t.recipient}:null,...t.recipientEmail&&t.recipient?{[i.recipient]:`${t.recipient} (${t.recipientEmail})`}:null,...t.sender?{[i.sender]:t.sender}:null,...t.senderEmail&&t.sender?{[i.sender]:`${t.sender} (${t.senderEmail})`}:{},...t.message?{[i.message]:t.message}:null,...t.links&&t.links.count?t.links.count>1?{[i.files.replace("{count}",t.links.count.toString())]:t.links.result}:{[i.file.replace("{count}",t.links.count.toString())]:t.links.result}:null}},it=t=>{var e,n,u,l;return(c==null?void 0:c.price)==="INCLUDING_TAX"?t.discounted?{amount:t.regularPrice.value,currency:t.regularPrice.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(e=t.taxedPrice)==null?void 0:e.value,currency:(n=t.taxedPrice)==null?void 0:n.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(u=t.regularPrice)==null?void 0:u.value,currency:(l=t.regularPrice)==null?void 0:l.currency,style:{font:"inherit"},"data-testid":"regular-item-price"}},ct=t=>(c==null?void 0:c.price)==="INCLUDING_EXCLUDING_TAX"?r(x,{amount:t.rowTotal.value,currency:t.rowTotal.currency,"data-testid":"excluding-tax-total","aria-label":i.regularPrice}):void 0,ot=t=>{var u,l,y,S,L,C,w,M,W,B;const e={"aria-label":i.regularPrice},n=t.discounted?{}:null;return["INCLUDING_TAX","INCLUDING_EXCLUDING_TAX"].includes(c==null?void 0:c.price)?(e.amount=(u=t.rowTotalIncludingTax)==null?void 0:u.value,e.currency=(l=t.rowTotalIncludingTax)==null?void 0:l.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="including-tax-item-total",n&&(e.amount=(y=t.total)==null?void 0:y.value,e.currency=(S=t.total)==null?void 0:S.currency,n.amount=(L=t.rowTotalIncludingTax)==null?void 0:L.value,n.currency=(C=t.rowTotalIncludingTax)==null?void 0:C.currency,n.sale=!0,n["aria-label"]=i.discountedPrice,n["data-testid"]="discount-total")):(e.amount=(w=t.total)==null?void 0:w.value,e.currency=(M=t.total)==null?void 0:M.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="regular-item-total",n&&(n.amount=(W=t.discountedTotal)==null?void 0:W.value,n.currency=(B=t.discountedTotal)==null?void 0:B.currency,n.sale=!0,n["aria-label"]=i.regularPrice,n["data-testid"]="discount-total")),{totalProps:e,discountProps:n}},st=t=>{var L,C,w;if(o.includes("warning"))return;const e=I.get(t.uid),n=(L=I.get(t.uid))==null?void 0:L.includes("The requested qty is not available"),u=v.has(t.uid),l=t.insufficientQuantity&&t.stockLevel?t.stockLevel==="noNumber"?i.insufficientQuantityGeneral:i.insufficientQuantity.replace("{inventory}",(C=t.stockLevel)==null?void 0:C.toString()).replace("{count}",t.quantity.toString()):"",y=t.lowInventory&&t.onlyXLeftInStock&&i.lowInventory.replace("{count}",(w=t.onlyXLeftInStock)==null?void 0:w.toString()),S=!t.outOfStock&&e&&n?i.notAvailableMessage:e;return!u&&(e||t.insufficientQuantity||t.lowInventory)?k("span",{"data-testid":"item-warning",children:[r(X,{source:xt,size:"16"}),S||l||y]}):void 0},lt=t=>o!=null&&o.includes("alert")?void 0:!v.has(t.uid)&&t.outOfStock?k("span",{"data-testid":"item-alert",children:[r(X,{source:K,size:"16"}),i.outOfStockAlert]}):void 0,ut=t=>{if(!o.includes("sku"))return r("span",{"data-testid":"cart-list-item-sku",children:t.sku})},U=t=>a!=null&&a.totalQuantity?a.items.filter(t).map((e,n)=>{const{totalProps:u,discountProps:l}=ot(e);return r(wt,{updating:v==null?void 0:v.has(e.uid),"data-testid":`cart-list-item-entry-${e.uid}`,image:nt(e,n),title:rt(e),sku:ut(e),price:o.includes("price")?void 0:r(x,{...it(e)}),quantity:o.includes("quantity")?void 0:e.quantity,total:k(j,{children:[o.includes("total")?void 0:r(x,{...u}),o.includes("totalDiscount")?void 0:l&&r(x,{...l})]}),configurations:at(e),totalExcludingTax:o.includes("totalExcludingTax")?void 0:ct(e),taxIncluded:(c==null?void 0:c.price)==="INCLUDING_TAX",taxExcluded:!o.includes("totalExcludingTax")&&(c==null?void 0:c.price)==="INCLUDING_EXCLUDING_TAX",warning:st(e),alert:lt(e),onQuantity:$?y=>{A(e,y)}:void 0,onRemove:P?()=>A(e,0):void 0},e.uid)}):null,dt=r(T,{name:"EmptyCart",slot:f==null?void 0:f.EmptyCart,context:{},children:r(kt,{"data-testid":"empty-cart",ctaLinkURL:m==null?void 0:m()})}),gt=r(T,{name:"Heading",slot:f==null?void 0:f.Heading,context:{count:a==null?void 0:a.totalQuantity},children:r("div",{"data-testid":"default-cart-heading",children:i.heading.replace("({count})",a!=null&&a.totalQuantity?`(${a==null?void 0:a.totalQuantity.toString()})`:"")})}),ft=()=>{const t=a==null?void 0:a.items.filter(e=>e.outOfStock);t==null||t.forEach(e=>{A(e,0)})},pt=U(t=>t.outOfStock||t.insufficientQuantity||!1),ht=a!=null&&a.hasOutOfStockItems?r(Ct,{"data-testid":"cart-out-of-stock-message",icon:r(X,{source:K,size:"16"}),itemList:r(D,{"data-testid":"out-of-stock-cart-items",children:pt}),type:"warning",heading:i.outOfStockHeading,description:i.outOfStockDescription,variant:"primary",actionButtonPosition:"bottom",additionalActions:a!=null&&a.hasFullyOutOfStockItems&&P?[{label:i.removeAction,onClick:ft}]:void 0}):void 0,E=U(t=>!t.outOfStock&&!t.insufficientQuantity),yt=a!=null&&a.totalQuantity?r(D,{"data-testid":"cart-list",children:E==null?void 0:E.slice(0,N??E.length)}):null;return r(Nt,{...Y,heading:Z?void 0:gt,loading:R,emptyCart:dt,products:yt,outOfStockMessage:ht})};Qt.getInitialData=async function(){return Et()};export{Qt as C};
|
|
1
|
+
import{jsx as r,jsxs as k,Fragment as Z}from"@dropins/tools/preact-jsx-runtime.js";import*as s from"@dropins/tools/preact-compat.js";import{useState as _,useEffect as T}from"@dropins/tools/preact-compat.js";import{classes as x,VComponent as V,Slot as X}from"@dropins/tools/lib.js";/* empty css */import{E as mt}from"./EmptyCart.js";import{Divider as vt,Skeleton as Lt,SkeletonRow as Ct,InLineAlert as wt,Icon as j,CartList as D,CartItem as It,Price as O,Image as Et}from"@dropins/tools/components.js";import{g as St}from"./persisted-data.js";import{events as _t}from"@dropins/tools/event-bus.js";import{s as xt}from"./resetCart.js";import{u as J}from"./updateProductsFromCart.js";import{useText as Ot}from"@dropins/tools/i18n.js";const K=g=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...g},s.createElement("g",{clipPath:"url(#clip0_4797_15331)"},s.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"}),s.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.24023 4.64001L14.9902 8.06001V11.42",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),s.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"}),s.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"}),s.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"}),s.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"})),s.createElement("defs",null,s.createElement("clipPath",{id:"clip0_4797_15331"},s.createElement("rect",{width:22,height:18.86,fill:"white",transform:"translate(1 2.54999)"})))),Nt=g=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...g},s.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"}),s.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"})),Pt=({className:g,children:$,heading:f,emptyCart:m,products:p,outOfStockMessage:h,loading:N=!0,...l})=>r("div",{...l,className:x(["cart-cart-summary-list",g]),children:N?r(Qt,{}):k(Z,{children:[(f||h)&&k("div",{"data-testid":"cart-summary-list-heading-wrapper",className:x(["cart-cart-summary-list__heading",["cart-cart-summary-list__heading--full-width",!p]]),children:[f&&k(Z,{children:[r(V,{node:f,className:"cart-cart-summary-list__heading-text"}),r(vt,{variant:"primary",className:x(["cart-cart-summary-list__heading-divider"])})]}),h&&r(V,{node:h,className:"cart-cart-summary-list__out-of-stock-message"})]}),r("div",{className:x(["cart-cart-summary-list__content",["cart-cart-summary-list__content--empty",!p]]),children:p||r(V,{node:m,className:"cart-cart-summary-list__empty-cart"})})]})}),Qt=()=>r(Lt,{"data-testid":"cart-summary-list-skeleton",className:"cart-cart-summary-list__skeleton",rowGap:"medium",children:r(Ct,{variant:"row",size:"xlarge",fullWidth:!0,lines:3,multilineGap:"small"})}),Gt=({initialData:g=null,hideHeading:$,routeProduct:f,routeEmptyCartCTA:m,onItemUpdate:p,onItemRemove:h,maxItems:N,slots:l,attributesToHide:o=[],enableRemoveItem:P,enableUpdateItemQuantity:z,onItemsErrorsChange:Q,...Y})=>{var q;const[R,H]=_(!g),[a,b]=_(g),[v,tt]=_(new Set),[I,et]=_(new Map),c=(q=xt.config)==null?void 0:q.shoppingCartDisplaySetting,i=Ot({file:"Cart.CartItem.file",files:"Cart.CartItem.files",heading:"Cart.Cart.heading",message:"Cart.CartItem.message",recipient:"Cart.CartItem.recipient",regularPrice:"Cart.CartItem.regularPrice",discountedPrice:"Cart.CartItem.discountedPrice",sender:"Cart.CartItem.sender",lowInventory:"Cart.CartItem.lowInventory",insufficientQuantity:"Cart.CartItem.insufficientQuantity",insufficientQuantityGeneral:"Cart.CartItem.insufficientQuantityGeneral",outOfStockHeading:"Cart.OutOfStockMessage.heading",outOfStockDescription:"Cart.OutOfStockMessage.message",outOfStockAlert:"Cart.OutOfStockMessage.alert",removeAction:"Cart.OutOfStockMessage.action",notAvailableMessage:"Cart.CartItem.notAvailableMessage"}),G=(t,e)=>{tt(n=>(e?n.add(t):n.delete(t),new Set(n)))},F=(t,e)=>{et(n=>(e?n.set(t,e):n.delete(t),new Map(n)))},A=(t,e)=>{G(t.uid,!0),F(t.uid),P&&e===0?J([{uid:t.uid,quantity:e}]).then(()=>{h==null||h({item:t})}).finally(()=>{G(t.uid,!1)}).catch(n=>{console.warn(n)}):z&&J([{uid:t.uid,quantity:e}]).then(()=>{p==null||p({item:t})}).finally(()=>{G(t.uid,!1)}).catch(n=>{console.warn(n),F(t.uid,n.message)})};T(()=>{const t=_t.on("cart/data",e=>{b(e),H(!1)},{eager:!0});return()=>{t==null||t.off()}},[]),T(()=>{Q&&Q(I)},[I,Q]);const nt=(t,e)=>{if(o.includes("image"))return;const n=r(Et,{"data-testid":"cart-list-item-image",loading:e<4?"eager":"lazy",src:t.image.src,alt:t.image.alt,width:"300",height:"300",params:{width:300}});return f?r("a",{href:f(t),children:n}):n},rt=t=>{if(!o.includes("name"))return r("span",{"data-testid":"cart-list-item-title",children:f?r("a",{href:f(t),children:t.name}):t.name})},at=t=>{if(!o.includes("configurations"))return{...t.bundleOptions,...t.selectedOptions,...t.customizableOptions,...t.recipient?{[i.recipient]:t.recipient}:null,...t.recipientEmail&&t.recipient?{[i.recipient]:`${t.recipient} (${t.recipientEmail})`}:null,...t.sender?{[i.sender]:t.sender}:null,...t.senderEmail&&t.sender?{[i.sender]:`${t.sender} (${t.senderEmail})`}:{},...t.message?{[i.message]:t.message}:null,...t.links&&t.links.count?t.links.count>1?{[i.files.replace("{count}",t.links.count.toString())]:t.links.result}:{[i.file.replace("{count}",t.links.count.toString())]:t.links.result}:null}},it=t=>{var e,n,d,u;return(c==null?void 0:c.price)==="INCLUDING_TAX"?t.discounted?{amount:t.regularPrice.value,currency:t.regularPrice.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(e=t.taxedPrice)==null?void 0:e.value,currency:(n=t.taxedPrice)==null?void 0:n.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(d=t.regularPrice)==null?void 0:d.value,currency:(u=t.regularPrice)==null?void 0:u.currency,style:{font:"inherit"},"data-testid":"regular-item-price"}},ct=t=>(c==null?void 0:c.price)==="INCLUDING_EXCLUDING_TAX"?r(O,{amount:t.rowTotal.value,currency:t.rowTotal.currency,"data-testid":"excluding-tax-total","aria-label":i.regularPrice}):void 0,ot=t=>{var d,u,y,S,L,C,w,M,W,B;const e={"aria-label":i.regularPrice},n=t.discounted?{}:null;return["INCLUDING_TAX","INCLUDING_EXCLUDING_TAX"].includes(c==null?void 0:c.price)?(e.amount=(d=t.rowTotalIncludingTax)==null?void 0:d.value,e.currency=(u=t.rowTotalIncludingTax)==null?void 0:u.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="including-tax-item-total",n&&(e.amount=(y=t.total)==null?void 0:y.value,e.currency=(S=t.total)==null?void 0:S.currency,n.amount=(L=t.rowTotalIncludingTax)==null?void 0:L.value,n.currency=(C=t.rowTotalIncludingTax)==null?void 0:C.currency,n.sale=!0,n["aria-label"]=i.discountedPrice,n["data-testid"]="discount-total")):(e.amount=(w=t.total)==null?void 0:w.value,e.currency=(M=t.total)==null?void 0:M.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="regular-item-total",n&&(n.amount=(W=t.discountedTotal)==null?void 0:W.value,n.currency=(B=t.discountedTotal)==null?void 0:B.currency,n.sale=!0,n["aria-label"]=i.regularPrice,n["data-testid"]="discount-total")),{totalProps:e,discountProps:n}},st=t=>{var L,C,w;if(o.includes("warning"))return;const e=I.get(t.uid),n=(L=I.get(t.uid))==null?void 0:L.includes("The requested qty is not available"),d=v.has(t.uid),u=t.insufficientQuantity&&t.stockLevel?t.stockLevel==="noNumber"?i.insufficientQuantityGeneral:i.insufficientQuantity.replace("{inventory}",(C=t.stockLevel)==null?void 0:C.toString()).replace("{count}",t.quantity.toString()):"",y=t.lowInventory&&t.onlyXLeftInStock&&i.lowInventory.replace("{count}",(w=t.onlyXLeftInStock)==null?void 0:w.toString()),S=!t.outOfStock&&e&&n?i.notAvailableMessage:e;return!d&&(e||t.insufficientQuantity||t.lowInventory)?k("span",{"data-testid":"item-warning",children:[r(j,{source:Nt,size:"16"}),S||u||y]}):void 0},lt=t=>o!=null&&o.includes("alert")?void 0:!v.has(t.uid)&&t.outOfStock?k("span",{"data-testid":"item-alert",children:[r(j,{source:K,size:"16"}),i.outOfStockAlert]}):void 0,ut=t=>{if(!o.includes("sku"))return r("span",{"data-testid":"cart-list-item-sku",children:t.sku})},dt=t=>r(X,{name:"Footer",slot:l==null?void 0:l.Footer,context:{item:t}}),U=t=>a!=null&&a.totalQuantity?a.items.filter(t).map((e,n)=>{const{totalProps:d,discountProps:u}=ot(e);return r(It,{updating:v==null?void 0:v.has(e.uid),"data-testid":`cart-list-item-entry-${e.uid}`,image:nt(e,n),title:rt(e),sku:ut(e),price:o.includes("price")?void 0:r(O,{...it(e)}),quantity:o.includes("quantity")?void 0:e.quantity,total:k(Z,{children:[o.includes("total")?void 0:r(O,{...d}),o.includes("totalDiscount")?void 0:u&&r(O,{...u})]}),configurations:at(e),totalExcludingTax:o.includes("totalExcludingTax")?void 0:ct(e),taxIncluded:(c==null?void 0:c.price)==="INCLUDING_TAX",taxExcluded:!o.includes("totalExcludingTax")&&(c==null?void 0:c.price)==="INCLUDING_EXCLUDING_TAX",warning:st(e),alert:lt(e),onQuantity:z?y=>{A(e,y)}:void 0,onRemove:P?()=>A(e,0):void 0,footer:dt(e)},e.uid)}):null,gt=r(X,{name:"EmptyCart",slot:l==null?void 0:l.EmptyCart,context:{},children:r(mt,{"data-testid":"empty-cart",ctaLinkURL:m==null?void 0:m()})}),ft=r(X,{name:"Heading",slot:l==null?void 0:l.Heading,context:{count:a==null?void 0:a.totalQuantity},children:r("div",{"data-testid":"default-cart-heading",children:i.heading.replace("({count})",a!=null&&a.totalQuantity?`(${a==null?void 0:a.totalQuantity.toString()})`:"")})}),pt=()=>{const t=a==null?void 0:a.items.filter(e=>e.outOfStock);t==null||t.forEach(e=>{A(e,0)})},ht=U(t=>t.outOfStock||t.insufficientQuantity||!1),yt=a!=null&&a.hasOutOfStockItems?r(wt,{"data-testid":"cart-out-of-stock-message",icon:r(j,{source:K,size:"16"}),itemList:r(D,{"data-testid":"out-of-stock-cart-items",children:ht}),type:"warning",heading:i.outOfStockHeading,description:i.outOfStockDescription,variant:"primary",actionButtonPosition:"bottom",additionalActions:a!=null&&a.hasFullyOutOfStockItems&&P?[{label:i.removeAction,onClick:pt}]:void 0}):void 0,E=U(t=>!t.outOfStock&&!t.insufficientQuantity),kt=a!=null&&a.totalQuantity?r(D,{"data-testid":"cart-list",children:E==null?void 0:E.slice(0,N??E.length)}):null;return r(Pt,{...Y,heading:$?void 0:ft,loading:R,emptyCart:gt,products:kt,outOfStockMessage:yt})};Gt.getInitialData=async function(){return St()};export{Gt as C};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import{s as
|
|
1
|
+
import{s as _,f as m,h as T}from"./resetCart.js";import{C as E,a as I,t as u}from"./CartFragment.js";import"@dropins/tools/event-bus.js";const A=`
|
|
2
2
|
mutation GET_ESTIMATED_TOTALS_MUTATION(
|
|
3
3
|
$cartId: String!
|
|
4
4
|
$address: EstimateAddressInput!,
|
|
5
5
|
$shipping_method: ShippingMethodInput,
|
|
6
|
-
${
|
|
6
|
+
${E}
|
|
7
|
+
|
|
7
8
|
) {
|
|
8
9
|
estimateTotals(
|
|
9
10
|
input: {
|
|
@@ -13,10 +14,9 @@ import{s as h,f as T,h as m}from"./resetCart.js";import{C as A,t as E}from"./get
|
|
|
13
14
|
}
|
|
14
15
|
) {
|
|
15
16
|
cart {
|
|
16
|
-
...
|
|
17
|
+
...CartFragment
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
|
-
|
|
21
21
|
${I}
|
|
22
|
-
`,
|
|
22
|
+
`,M=async r=>{var e,a;const o=_.cartId;if(!o)throw new Error("No cart ID found");if(!r)throw new Error("No address parameter found");const{countryCode:i,postcode:n,region:t}=r,c=(e=r.shipping_method)==null?void 0:e.carrier_code,p=(a=r.shipping_method)==null?void 0:a.method_code;return m(A,{variables:{cartId:o,address:{country_code:i||"US",postcode:n,region:(t==null?void 0:t.id)!==void 0?{region_id:t.id}:{region:(t==null?void 0:t.region)??""}},shipping_method:{carrier_code:c||"",method_code:p||""}}}).then(({errors:d,data:h})=>{if(d)return T(d);const s=h.estimateTotals;return s?u(s.cart):null})};export{M as g};
|
package/chunks/getStoreConfig.js
CHANGED
|
@@ -1,63 +1,43 @@
|
|
|
1
|
-
import{events as
|
|
2
|
-
$pageSize: Int! = 100,
|
|
3
|
-
$currentPage: Int! = 1,
|
|
4
|
-
$itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC}
|
|
5
|
-
`,H=`
|
|
6
|
-
fragment CUSTOMER_FRAGMENT on Customer {
|
|
7
|
-
addresses {
|
|
8
|
-
default_shipping
|
|
9
|
-
country_id
|
|
10
|
-
postcode
|
|
11
|
-
region {
|
|
12
|
-
region
|
|
13
|
-
region_code
|
|
14
|
-
region_id
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}`,W=`
|
|
1
|
+
import{events as e}from"@dropins/tools/event-bus.js";import{s as a,d as y,f as s,h as o}from"./resetCart.js";import{C as u,a as l,b as f,t as p}from"./CartFragment.js";import{Initializer as m}from"@dropins/tools/lib.js";import{a as C}from"./persisted-data.js";const d=new m({init:async t=>{const r={disableGuestCart:!1,...t};d.config.setConfig(r),c().catch(console.error)},listeners:()=>[e.on("authenticated",t=>{a.authenticated&&!t?e.emit("cart/reset",void 0):t&&!a.authenticated&&(a.authenticated=t,c().catch(console.error))},{eager:!0}),e.on("locale",async t=>{t!==a.locale&&(a.locale=t,c().catch(console.error))}),e.on("cart/reset",()=>{y().catch(console.error),e.emit("cart/data",null)}),e.on("cart/data",t=>{C(t)})]}),h=d.config;function T(t){if(!t)return null;const r=i=>{switch(i){case 1:return"EXCLUDING_TAX";case 2:return"INCLUDING_TAX";case 3:return"INCLUDING_EXCLUDING_TAX";default:return"EXCLUDING_TAX"}};return{displayMiniCart:t.minicart_display,miniCartMaxItemsDisplay:t.minicart_max_items,cartExpiresInDays:t.cart_expires_in_days,cartSummaryDisplayTotal:t.cart_summary_display_quantity,defaultCountry:t.default_country,categoryFixedProductTaxDisplaySetting:t.category_fixed_product_tax_display_setting,productFixedProductTaxDisplaySetting:t.product_fixed_product_tax_display_setting,salesFixedProductTaxDisplaySetting:t.sales_fixed_product_tax_display_setting,shoppingCartDisplaySetting:{zeroTax:t.shopping_cart_display_zero_tax,subtotal:r(t.shopping_cart_display_subtotal),price:r(t.shopping_cart_display_price),shipping:r(t.shopping_cart_display_shipping),fullSummary:t.shopping_cart_display_full_summary,grandTotal:t.shopping_cart_display_grand_total,taxGiftWrapping:t.shopping_cart_display_tax_gift_wrapping},useConfigurableParentThumbnail:t.configurable_thumbnail_source==="parent"}}const x=`
|
|
18
2
|
query GUEST_CART_QUERY(
|
|
19
3
|
$cartId: String!,
|
|
20
|
-
${
|
|
4
|
+
${u}
|
|
21
5
|
) {
|
|
22
6
|
|
|
23
7
|
cart(cart_id: $cartId){
|
|
24
|
-
...
|
|
8
|
+
...CartFragment
|
|
25
9
|
}
|
|
26
10
|
}
|
|
27
11
|
|
|
28
|
-
${
|
|
29
|
-
`,
|
|
12
|
+
${l}
|
|
13
|
+
`,I=`
|
|
30
14
|
query CUSTOMER_CART_QUERY(
|
|
31
|
-
${
|
|
15
|
+
${u}
|
|
32
16
|
) {
|
|
33
|
-
|
|
34
|
-
customer {
|
|
35
|
-
...CUSTOMER_FRAGMENT
|
|
36
|
-
}
|
|
17
|
+
${f}
|
|
37
18
|
|
|
38
19
|
cart: customerCart {
|
|
39
|
-
...
|
|
20
|
+
...CartFragment
|
|
40
21
|
}
|
|
41
22
|
}
|
|
42
23
|
|
|
43
|
-
${
|
|
44
|
-
|
|
45
|
-
`,m=async()=>{const e=i.authenticated,t=i.cartId;if(e)return y(J,{method:"POST"}).then(({errors:n,data:r})=>{if(n)return d(n);const c={...r.cart,...r.customer};return R(c)});if(!t)throw new Error("No cart ID found");return y(W,{method:"POST",cache:"no-cache",variables:{cartId:t}}).then(({errors:n,data:r})=>n?d(n):R(r.cart))},Z=`
|
|
24
|
+
${l}
|
|
25
|
+
`,_=async()=>{const t=a.authenticated,r=a.cartId;if(t)return s(I,{method:"POST"}).then(({errors:i,data:n})=>{if(i)return o(i);const g={...n.cart,...n.customer};return p(g)});if(!r)throw new Error("No cart ID found");return s(x,{method:"POST",cache:"no-cache",variables:{cartId:r}}).then(({errors:i,data:n})=>i?o(i):p(n.cart))},E=`
|
|
46
26
|
mutation MERGE_CARTS_MUTATION(
|
|
47
27
|
$guestCartId: String!,
|
|
48
28
|
$customerCartId: String!,
|
|
49
|
-
${
|
|
29
|
+
${u}
|
|
50
30
|
) {
|
|
51
31
|
mergeCarts(
|
|
52
32
|
source_cart_id: $guestCartId,
|
|
53
33
|
destination_cart_id: $customerCartId
|
|
54
34
|
) {
|
|
55
|
-
...
|
|
35
|
+
...CartFragment
|
|
56
36
|
}
|
|
57
37
|
}
|
|
58
38
|
|
|
59
|
-
${
|
|
60
|
-
`,
|
|
39
|
+
${l}
|
|
40
|
+
`,c=async()=>{if(a.initializing)return null;a.initializing=!0,a.config||(a.config=await A());const t=a.authenticated?await S():await R();return e.emit("cart/initialized",t),e.emit("cart/data",t),a.initializing=!1,t};async function S(){const t=a.cartId,r=await _();return r?(a.cartId=r.id,!t||r.id===t?r:await s(E,{variables:{guestCartId:t,customerCartId:r.id}}).then(()=>_()).then(i=>{const n={oldCartItems:r.items,newCart:i};return e.emit("cart/merged",n),i}).catch(()=>(console.error("Could not merge carts"),r))):null}async function R(){if(h.getConfig().disableGuestCart===!0||!a.cartId)return null;try{return await _()}catch(t){return console.error(t),null}}const G=`
|
|
61
41
|
query STORE_CONFIG_QUERY {
|
|
62
42
|
storeConfig {
|
|
63
43
|
minicart_display
|
|
@@ -78,4 +58,4 @@ query STORE_CONFIG_QUERY {
|
|
|
78
58
|
configurable_thumbnail_source
|
|
79
59
|
}
|
|
80
60
|
}
|
|
81
|
-
`,
|
|
61
|
+
`,A=async()=>s(G,{method:"GET",cache:"force-cache"}).then(({errors:t,data:r})=>t?o(t):T(r.storeConfig));export{R as a,_ as b,h as c,c as d,A as e,S as g,d as i};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{s as m,f as i,h as p}from"./resetCart.js";import{C as
|
|
1
|
+
import{s as m,f as i,h as p}from"./resetCart.js";import{C as _,a as I,t as T}from"./CartFragment.js";import{events as n}from"@dropins/tools/event-bus.js";import{p as u}from"./acdl.js";const C=`
|
|
2
2
|
mutation UPDATE_PRODUCTS_FROM_CART_MUTATION(
|
|
3
3
|
$cartId: String!,
|
|
4
4
|
$cartItems: [CartItemUpdateInput!]!,
|
|
5
|
-
${
|
|
5
|
+
${_}
|
|
6
6
|
) {
|
|
7
7
|
updateCartItems(
|
|
8
8
|
input: {
|
|
@@ -11,11 +11,10 @@ import{s as m,f as i,h as p}from"./resetCart.js";import{C as T,t as _}from"./get
|
|
|
11
11
|
}
|
|
12
12
|
) {
|
|
13
13
|
cart {
|
|
14
|
-
...
|
|
14
|
+
...CartFragment
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
`,h=async e=>{const s=m.cartId;if(!s)throw Error("Cart ID is not set");return i(C,{variables:{cartId:s,cartItems:e.map(({uid:a,quantity:t})=>({cart_item_uid:a,quantity:t}))}}).then(({errors:a,data:t})=>{var c;const o=[...((c=t==null?void 0:t.addProductsToCart)==null?void 0:c.user_errors)??[],...a??[]];if(o.length>0)return p(o);const r=_(t.updateCartItems.cart);return n.emit("cart/updated",r),n.emit("cart/data",r),r&&I(r,e,m.locale??"en-US"),r})};export{h as u};
|
|
19
|
+
${I}
|
|
20
|
+
`,U=async e=>{const s=m.cartId;if(!s)throw Error("Cart ID is not set");return i(C,{variables:{cartId:s,cartItems:e.map(({uid:a,quantity:t})=>({cart_item_uid:a,quantity:t}))}}).then(({errors:a,data:t})=>{var c;const o=[...((c=t==null?void 0:t.addProductsToCart)==null?void 0:c.user_errors)??[],...a??[]];if(o.length>0)return p(o);const r=T(t.updateCartItems.cart);return n.emit("cart/updated",r),n.emit("cart/data",r),r&&u(r,e,m.locale??"en-US"),r})};export{U as u};
|
package/containers/Cart.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as
|
|
1
|
+
import{C as k,C as n}from"../chunks/MiniCart.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/acdl.js";import"../chunks/updateProductsFromCart.js";import"../chunks/CartFragment.js";import"../chunks/CartSummaryGrid.js";import"../chunks/EmptyCart.js";import"../chunks/CartSummaryList.js";import"../chunks/OrderSummary.js";import"../chunks/getEstimatedTotals.js";export{k as Cart,n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as
|
|
1
|
+
import{C as L,C as S}from"../chunks/CartSummaryList.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";/* empty css */import"../chunks/EmptyCart.js";import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/updateProductsFromCart.js";import"../chunks/CartFragment.js";import"../chunks/acdl.js";export{L as CartSummaryList,S as default};
|
package/containers/MiniCart.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{M as
|
|
1
|
+
import{M as h,M as j}from"../chunks/MiniCart.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/acdl.js";import"../chunks/updateProductsFromCart.js";import"../chunks/CartFragment.js";import"../chunks/CartSummaryGrid.js";import"../chunks/EmptyCart.js";import"../chunks/CartSummaryList.js";import"../chunks/OrderSummary.js";import"../chunks/getEstimatedTotals.js";export{h as MiniCart,j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{O as
|
|
1
|
+
import{O as y,O as S}from"../chunks/OrderSummary.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"../chunks/persisted-data.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getEstimatedTotals.js";import"../chunks/CartFragment.js";import"../chunks/acdl.js";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/i18n.js";export{y as OrderSummary,S as default};
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@dropins/storefront-cart", "version": "0.7.0-
|
|
1
|
+
{"name": "@dropins/storefront-cart", "version": "0.7.0-alpha010", "@dropins/tools": "0.31.0-alpha005"}
|
package/render.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(function(i,r){try{if(typeof document<"u"){const a=document.createElement("style"),n=r.styleId;for(const t in r.attributes)a.setAttribute(t,r.attributes[t]);a.setAttribute("data-dropin",n),a.appendChild(document.createTextNode(i));const e=document.querySelector('style[data-dropin="sdk"]');if(e)e.after(a);else{const t=document.querySelector('link[rel="stylesheet"], style');t?t.before(a):document.head.append(a)}}}catch(a){console.error("dropin-styles (injectCodeFunction)",a)}})(".cart-cart{container-type:inline-size;container-name:cart}.cart-cart__wrapper{display:grid;grid-template-rows:auto 1fr}.cart-cart__heading{display:grid;row-gap:var(--spacing-small);padding:var(--spacing-medium);padding-bottom:0;font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.cart-cart__heading-divider{width:100%;margin:0}.cart-cart__content{display:grid;grid-template-columns:1fr;padding:0 var(--spacing-medium) var(--spacing-medium)}.cart-cart__empty-cart{justify-self:center;align-self:center;width:100%;max-width:800px}.dropin-price-summary__shipping--zip,.dropin-price-summary__shipping--state{background-color:var(--color-neutral-50)}@container cart (width >= 1024px){.cart-cart__wrapper{grid-template-columns:repeat(var(--grid-3-columns),1fr);grid-column-gap:var(--grid-3-gutters);margin:0 var(--grid-3-margins)}.cart-cart__heading{padding:var(--spacing-small) 0 0 0}.cart-cart__content{padding:var(--spacing-medium) 0}.cart-cart__content .cart-cart-summary-list__heading{padding:0}.cart-cart__heading,.cart-cart__content{grid-column:1 / span 8}.cart-cart__order-summary{grid-row:1 / span 3;grid-column:9 / span 4;height:min-content}.cart-cart__heading--full-width,.cart-cart__content--empty,.cart-cart__content--full-width{grid-column:1 / span 12}}.cart-empty-cart{container-type:inline-size;container-name:cart}.cart-empty-cart__wrapper .dropin-card--secondary{display:grid;grid-auto-rows:min-content;justify-content:center;text-align:center}@container cart (width < 737px){.cart-empty-cart__wrapper .dropin-card{border:unset;border-style:hidden}}.cart-estimate-shipping{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xsmall);align-items:flex-end;color:var(--color-neutral-800)}.cart-estimate-shipping__label,.cart-estimate-shipping__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.cart-estimate-shipping__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.cart-estimate-shipping__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.cart-estimate-shipping__price{text-align:right}a.cart-estimate-shippingLink{text-decoration:underline}.cart-estimate-shipping__label--bold,.cart-estimate-shipping__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.cart-estimate-shipping__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);grid-column:span 2;color:var(--color-neutral-700)}.cart-estimate-shipping--zip,.cart-estimate-shipping--state{background-color:var(--color-neutral-50)}.cart-estimate-shipping--edit{display:grid;grid-column:1 / span 2;gap:var(--spacing-small);padding-top:var(--spacing-small)}a.cart-estimate-shipping__link{text-decoration:underline}.cart-estimate-shipping--hide{display:none!important}.cart-estimate-shipping--edit button{width:var(--spacing-huge);justify-self:end}.cart-estimate-shipping--loading{opacity:.4;pointer-events:none}.cart-mini-cart{display:flex;flex-direction:column;height:100%;padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium);box-sizing:border-box}.cart-mini-cart__empty-cart{width:100%;max-width:800px;height:100%;display:flex;flex-direction:column;justify-content:center;align-self:center}.cart-mini-cart__heading{display:grid;row-gap:var(--spacing-xsmall);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing)}.cart-mini-cart__heading-divider{width:100%;margin:var(--spacing-xxsmall) 0 0 0}.cart-mini-cart__products{flex:1;overflow-y:auto;max-height:100%;padding-bottom:var(--spacing-medium)}.cart-mini-cart__products .cart-cart-summary-list__heading{padding:0}.cart-mini-cart__products .dropin-cart-item__configurations li{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.cart-mini-cart__footer{display:grid;grid-auto-flow:row;gap:var(--spacing-small);padding-top:var(--spacing-small);row-gap:var(--spacing-xsmall)}.cart-mini-cart__footer__estimated-total{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing);display:grid;grid-template:max-content / 1fr auto;gap:var(--spacing-xsmall)}.cart-mini-cart__footer__estimated-total-excluding-taxes{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);display:grid;grid-template:max-content / 1fr auto;gap:var(--spacing-xsmall);color:var(--color-neutral-700)}.cart-mini-cart__footer__ctas{display:grid;grid-auto-flow:row;gap:var(--spacing-xsmall);padding-top:var(--spacing-small)}.cart-cart-summary-grid{container-type:inline-size;container-name:cart-summary-grid;max-width:inherit}.cart-cart-summary-grid__content{display:grid;flex-wrap:wrap;gap:var(--spacing-small);grid-template-columns:repeat(6,1fr);margin:auto}.cart-cart-summary-grid__item-container{aspect-ratio:auto 3/4;display:inline-block}.cart-cart-summary-grid__item-container img{height:auto;max-width:100%}.cart-cart-summary-grid__item-container a:focus{display:block}.cart-cart-summary-grid__content--empty{grid-template-columns:repeat(1,1fr)}.cart-cart-summary-grid__empty-cart{align-self:center;justify-self:center;max-width:800px;width:100%}@container cart-summary-grid (width < 360px){.cart-cart-summary-grid__content{grid-template-columns:repeat(4,1fr);gap:var(--spacing-xsmall)}.cart-cart-summary-grid__content--empty{grid-template-columns:repeat(1,1fr)}}.cart-cart-summary-list{container-type:inline-size;container-name:cart-summary-list}.cart-cart-summary-list__heading{display:grid;row-gap:var(--spacing-xsmall);padding:var(--spacing-medium) 0 0 0;font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.cart-cart-summary-list__heading--full-width{width:100%}.cart-cart-summary-list__heading-divider{width:100%;margin:var(--spacing-xxsmall) 0 var(--spacing-medium) 0}.cart-cart-summary-list__content{display:grid;grid-template-columns:1fr;padding:0}.cart-cart-summary-list__out-of-stock-message{margin:calc(-1 * var(--spacing-xsmall)) 0 var(--spacing-medium) 0}.cart-cart-summary-list__empty-cart{justify-self:center;align-self:center;width:100%;max-width:800px}@container cart-summary-list (width >= 768px){.cart-cart-summary-list__out-of-stock-message{margin:calc(-1 * var(--spacing-small)) 0 var(--spacing-xxbig) 0}}@container cart-summary-list (width >= 1024px){.cart-cart-summary-list__content,.cart-cart-summary-list__heading{grid-column:1 / span 8}.cart-cart-summary-list__heading--full-width,.cart-cart-summary-list__content--empty{grid-column:1 / span 12}.cart-cart-summary-list__content{padding:0}}.cart-order-summary{display:grid;position:relative;grid-auto-flow:row;padding:var(--spacing-medium)}.cart-order-summary__primary{background-color:var(--color-neutral-200)}.cart-order-summary__secondary{background-color:var(--color-neutral-50)}.cart-order-summary__content{display:grid;gap:var(--spacing-xsmall);margin-top:var(--spacing-small)}.cart-order-summary__heading{display:grid;font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);color:var(--color-neutral-800);gap:var(--spacing-small)}.cart-order-summary__label,.cart-order-summary__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.cart-order-summary__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.cart-order-summary__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.cart-order-summary__price{text-align:right}.cart-order-summary__taxes .dropin-divider:last-child{margin-bottom:0}.cart-order-summary__total{margin-top:var(--spacing-medium)}.cart-order-summary__label--bold,.cart-order-summary__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.cart-order-summary__divider-primary,.cart-order-summary__divider-secondary{width:100%;margin:0}.cart-order-summary__divider-secondary{margin:0}.cart-order-summary__taxEntry.cart-order-summary__entry{margin-top:0}.cart-order-summary__entry,.cart-order-summary__taxEntry{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xxsmall);align-items:center;color:var(--color-neutral-800)}.cart-order-summary__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);grid-column:span 2;color:var(--color-neutral-700)}.cart-order-summary__primaryAction{margin-top:var(--spacing-small);grid-template-columns:1fr}.cart-order-summary__shipping--edit{display:grid;grid-column:1 / span 2;gap:var(--spacing-small);padding-top:var(--spacing-small);padding-left:var(--spacing-small)}a.cart-order-summary__shippingLink{text-decoration:underline}.cart-order-summary__shipping--hide{display:none!important}.cart-order-summary__shipping--edit button{width:var(--spacing-huge);justify-self:end}.cart-order-summary__shipping--zip,.cart-order-summary__shipping--state{background-color:var(--color-neutral-50)}.cart-order-summary__taxes .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.cart-order-summary--loading{opacity:.4;pointer-events:none}.cart-order-summary__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}",{styleId:"Cart"});
|
|
2
|
-
import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as c,Render as d}from"@dropins/tools/lib.js";import{useState as u,useEffect as p}from"@dropins/tools/preact-hooks.js";import{UIProvider as m}from"@dropins/tools/components.js";import{events as g}from"@dropins/tools/event-bus.js";import"./chunks/resetCart.js";import{c as h}from"./chunks/getStoreConfig.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/persisted-data.js";import"./
|
|
2
|
+
import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as c,Render as d}from"@dropins/tools/lib.js";import{useState as u,useEffect as p}from"@dropins/tools/preact-hooks.js";import{UIProvider as m}from"@dropins/tools/components.js";import{events as g}from"@dropins/tools/event-bus.js";import"./chunks/resetCart.js";import{c as h}from"./chunks/getStoreConfig.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/persisted-data.js";import"./chunks/CartFragment.js";const f={Cart:{heading:"Shopping Cart ({count})"},MiniCart:{heading:"Shopping Cart ({count})",subtotal:"Subtotal",subtotalExcludingTaxes:"Subtotal excluding taxes",cartLink:"View Cart",checkoutLink:"Checkout"},EmptyCart:{heading:"Your cart is empty",cta:"Start shopping"},PriceSummary:{taxToBeDetermined:"TBD",checkout:"Checkout",orderSummary:"Order Summary",subTotal:{label:"Subtotal",withTaxes:"Including taxes",withoutTaxes:"excluding taxes"},shipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},taxes:{total:"Tax Total",totalOnly:"Tax",breakdown:"Taxes",showBreakdown:"Show Tax Breakdown",hideBreakdown:"Hide Tax Breakdown",estimated:"Estimated Tax"},total:{estimated:"Estimated Total",label:"Total",withoutTax:"Total excluding taxes"},estimatedShippingForm:{country:{placeholder:"Country"},state:{placeholder:"State"},zip:{placeholder:"Zip Code"},apply:{label:"Apply"}},freeShipping:"Free"},CartItem:{discountedPrice:"Discounted Price",download:"file",message:"Note",recipient:"To",regularPrice:"Regular Price",sender:"From",file:"{count} file",files:"{count} files",lowInventory:"Only {count} left!",insufficientQuantity:"Only {inventory} of {count} in stock",insufficientQuantityGeneral:"Not enough items for sale",notAvailableMessage:"Requested qty. not available"},EstimateShipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},OutOfStockMessage:{heading:"Your cart contains items with limited stock",message:"Please adjust quantities to continue",alert:"Out of stock",action:"Remove all out of stock items from cart"}},x={Cart:f},S={default:x},y=({children:o})=>{var i;const[t,s]=u(),r=(i=h.getConfig())==null?void 0:i.langDefinitions;p(()=>{const e=g.on("locale",a=>{a!==t&&s(a)},{eager:!0});return()=>{e==null||e.off()}},[t]);const l=c(S,r??{});return n(m,{lang:t,langDefinitions:l,children:o})},v=new d(n(y,{}));export{v as render};
|
package/api/fragments.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const CUSTOMIZABLE_OPTIONS_FRAGMENT = "\n fragment CUSTOMIZABLE_OPTIONS_FRAGMENT on SelectedCustomizableOption {\n type\n customizable_option_uid\n label\n is_required\n values {\n label\n value\n price{\n type\n units\n value\n }\n }\n }\n";
|
|
2
|
-
//# sourceMappingURL=CustomizableOptionsFragment.d.ts.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const PRICE_RANGE_FRAGMENT = "\n fragment PRICE_RANGE_FRAGMENT on PriceRange {\n minimum_price {\n regular_price {\n value\n currency\n }\n final_price {\n value\n currency\n }\n discount {\n percent_off\n amount_off\n }\n }\n maximum_price {\n regular_price {\n value\n currency\n }\n final_price {\n value\n currency\n }\n discount {\n percent_off\n amount_off\n }\n }\n }\n";
|
|
2
|
-
//# sourceMappingURL=PriceRangeFragment.d.ts.map
|
package/fragments.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './api/fragments'
|
package/fragments.js
DELETED
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
const e=`
|
|
2
|
-
fragment PRICE_RANGE_FRAGMENT on PriceRange {
|
|
3
|
-
minimum_price {
|
|
4
|
-
regular_price {
|
|
5
|
-
value
|
|
6
|
-
currency
|
|
7
|
-
}
|
|
8
|
-
final_price {
|
|
9
|
-
value
|
|
10
|
-
currency
|
|
11
|
-
}
|
|
12
|
-
discount {
|
|
13
|
-
percent_off
|
|
14
|
-
amount_off
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
maximum_price {
|
|
18
|
-
regular_price {
|
|
19
|
-
value
|
|
20
|
-
currency
|
|
21
|
-
}
|
|
22
|
-
final_price {
|
|
23
|
-
value
|
|
24
|
-
currency
|
|
25
|
-
}
|
|
26
|
-
discount {
|
|
27
|
-
percent_off
|
|
28
|
-
amount_off
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
`,a=`
|
|
33
|
-
fragment CUSTOMIZABLE_OPTIONS_FRAGMENT on SelectedCustomizableOption {
|
|
34
|
-
type
|
|
35
|
-
customizable_option_uid
|
|
36
|
-
label
|
|
37
|
-
is_required
|
|
38
|
-
values {
|
|
39
|
-
label
|
|
40
|
-
value
|
|
41
|
-
price{
|
|
42
|
-
type
|
|
43
|
-
units
|
|
44
|
-
value
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
`,t=`
|
|
49
|
-
fragment CART_ITEM_FRAGMENT on CartItemInterface {
|
|
50
|
-
__typename
|
|
51
|
-
uid
|
|
52
|
-
quantity
|
|
53
|
-
is_available
|
|
54
|
-
not_available_message
|
|
55
|
-
errors {
|
|
56
|
-
code
|
|
57
|
-
message
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
prices {
|
|
61
|
-
price {
|
|
62
|
-
value
|
|
63
|
-
currency
|
|
64
|
-
}
|
|
65
|
-
total_item_discount {
|
|
66
|
-
value
|
|
67
|
-
currency
|
|
68
|
-
}
|
|
69
|
-
row_total {
|
|
70
|
-
value
|
|
71
|
-
currency
|
|
72
|
-
}
|
|
73
|
-
row_total_including_tax {
|
|
74
|
-
value
|
|
75
|
-
currency
|
|
76
|
-
}
|
|
77
|
-
price_including_tax {
|
|
78
|
-
value
|
|
79
|
-
currency
|
|
80
|
-
}
|
|
81
|
-
fixed_product_taxes {
|
|
82
|
-
amount {
|
|
83
|
-
value
|
|
84
|
-
currency
|
|
85
|
-
}
|
|
86
|
-
label
|
|
87
|
-
}
|
|
88
|
-
original_row_total{
|
|
89
|
-
value
|
|
90
|
-
currency
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
product {
|
|
95
|
-
name
|
|
96
|
-
sku
|
|
97
|
-
thumbnail {
|
|
98
|
-
url
|
|
99
|
-
label
|
|
100
|
-
}
|
|
101
|
-
url_key
|
|
102
|
-
url_suffix
|
|
103
|
-
categories {
|
|
104
|
-
url_path
|
|
105
|
-
url_key
|
|
106
|
-
}
|
|
107
|
-
only_x_left_in_stock
|
|
108
|
-
stock_status
|
|
109
|
-
|
|
110
|
-
price_range {
|
|
111
|
-
...PRICE_RANGE_FRAGMENT
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
...on SimpleCartItem {
|
|
115
|
-
customizable_options {
|
|
116
|
-
...CUSTOMIZABLE_OPTIONS_FRAGMENT
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
... on ConfigurableCartItem {
|
|
120
|
-
configurable_options {
|
|
121
|
-
configurable_product_option_uid
|
|
122
|
-
option_label
|
|
123
|
-
value_label
|
|
124
|
-
}
|
|
125
|
-
configured_variant {
|
|
126
|
-
uid
|
|
127
|
-
sku
|
|
128
|
-
only_x_left_in_stock
|
|
129
|
-
stock_status
|
|
130
|
-
thumbnail {
|
|
131
|
-
label
|
|
132
|
-
url
|
|
133
|
-
}
|
|
134
|
-
price_range {
|
|
135
|
-
...PRICE_RANGE_FRAGMENT
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
customizable_options {
|
|
139
|
-
...CUSTOMIZABLE_OPTIONS_FRAGMENT
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
... on DownloadableCartItem {
|
|
143
|
-
links {
|
|
144
|
-
sort_order
|
|
145
|
-
title
|
|
146
|
-
}
|
|
147
|
-
customizable_options {
|
|
148
|
-
...CUSTOMIZABLE_OPTIONS_FRAGMENT
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
... on BundleCartItem {
|
|
152
|
-
bundle_options {
|
|
153
|
-
uid
|
|
154
|
-
label
|
|
155
|
-
values {
|
|
156
|
-
uid
|
|
157
|
-
label
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
... on GiftCardCartItem {
|
|
162
|
-
message
|
|
163
|
-
recipient_email
|
|
164
|
-
recipient_name
|
|
165
|
-
sender_email
|
|
166
|
-
sender_name
|
|
167
|
-
amount{
|
|
168
|
-
currency
|
|
169
|
-
value
|
|
170
|
-
}
|
|
171
|
-
is_available
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
${e}
|
|
176
|
-
${a}
|
|
177
|
-
`,r=`
|
|
178
|
-
fragment CART_FRAGMENT on Cart {
|
|
179
|
-
id
|
|
180
|
-
total_quantity
|
|
181
|
-
is_virtual
|
|
182
|
-
prices {
|
|
183
|
-
subtotal_with_discount_excluding_tax {
|
|
184
|
-
currency
|
|
185
|
-
value
|
|
186
|
-
}
|
|
187
|
-
subtotal_including_tax {
|
|
188
|
-
currency
|
|
189
|
-
value
|
|
190
|
-
}
|
|
191
|
-
subtotal_excluding_tax {
|
|
192
|
-
currency
|
|
193
|
-
value
|
|
194
|
-
}
|
|
195
|
-
grand_total {
|
|
196
|
-
currency
|
|
197
|
-
value
|
|
198
|
-
}
|
|
199
|
-
grand_total_excluding_tax {
|
|
200
|
-
currency
|
|
201
|
-
value
|
|
202
|
-
}
|
|
203
|
-
applied_taxes {
|
|
204
|
-
label
|
|
205
|
-
amount {
|
|
206
|
-
value
|
|
207
|
-
currency
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
discounts {
|
|
211
|
-
amount {
|
|
212
|
-
value
|
|
213
|
-
currency
|
|
214
|
-
}
|
|
215
|
-
label
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
itemsV2 (
|
|
219
|
-
pageSize:$pageSize,
|
|
220
|
-
currentPage:$currentPage,
|
|
221
|
-
sort: $itemsSortInput
|
|
222
|
-
) {
|
|
223
|
-
items {
|
|
224
|
-
...CART_ITEM_FRAGMENT
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
shipping_addresses {
|
|
228
|
-
country {
|
|
229
|
-
code
|
|
230
|
-
}
|
|
231
|
-
region {
|
|
232
|
-
code
|
|
233
|
-
}
|
|
234
|
-
postcode
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
${t}
|
|
239
|
-
`;export{r as CART_FRAGMENT,t as CART_ITEM_FRAGMENT};
|