@dropins/storefront-checkout 0.1.0-alpha49 → 0.1.0-alpha50
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/errors/errors.d.ts +3 -0
- package/api/estimateShippingMethods/estimateShippingMethods.d.ts +1 -1
- package/api/estimateShippingMethods/graphql/estimateShippingMethods.graphql.d.ts +16 -16
- package/api/getCart/graphql/getCart.graphql.d.ts +16 -16
- package/api/getStoreConfig/graphql/getStoreConfig.graphql.d.ts +16 -16
- package/api/index.d.ts +0 -3
- package/api/initialize/initialize.d.ts +6 -1
- package/api/initializeCheckout/initializeCheckout.d.ts +3 -17
- package/api/setBillingAddress/graphql/setBillingAddress.graphql.d.ts +15 -15
- package/api/setBillingAddress/setBillingAddress.d.ts +2 -11
- package/api/setShippingAddress/graphql/setShippingAddress.graphql.d.ts +15 -15
- package/api/setShippingAddress/setShippingAddress.d.ts +3 -45
- package/api/utils/dispatchApiCall.d.ts +0 -16
- package/api.js +37 -1
- package/chunks/Heading.js +1 -0
- package/chunks/classes.js +1 -0
- package/chunks/fetch-graphql.js +10 -0
- package/chunks/getCart.graphql.js +7 -4
- package/chunks/getCustomer.js +2 -2
- package/chunks/placeOrder2.js +131 -0
- package/chunks/resetCustomer.js +1 -36
- package/chunks/setBillingAddress.js +5 -7
- package/chunks/setGuestEmailOnCart.js +3 -3
- package/chunks/setPaymentMethod.js +2 -2
- package/chunks/setShippingMethods.js +2 -2
- package/chunks/store-config.js +1 -0
- package/chunks/withConditionalRendering.js +1 -1
- package/components/BillToShippingAddress/BillToShippingAddress.d.ts +3 -3
- package/components/LoginForm/Email.d.ts +8 -8
- package/components/LoginForm/LoginForm.d.ts +14 -10
- package/components/LoginForm/SignIn.d.ts +3 -4
- package/components/LoginForm/SignOut.d.ts +3 -3
- package/components/PaymentMethods/PaymentMethods.d.ts +4 -3
- package/components/index.d.ts +0 -2
- package/containers/BillToShippingAddress/BillToShippingAddress.d.ts +18 -6
- package/containers/BillToShippingAddress/index.d.ts +15 -16
- package/containers/BillToShippingAddress.js +1 -1
- package/containers/ErrorBanner/ErrorBanner.d.ts +2 -2
- package/containers/ErrorBanner.js +1 -1
- package/containers/EstimateShipping.js +1 -1
- package/containers/LoginForm/LoginForm.d.ts +2 -3
- package/containers/LoginForm/index.d.ts +15 -16
- package/containers/LoginForm.js +1 -1
- package/containers/MergedCartBanner/MergedCartBanner.d.ts +2 -2
- package/containers/MergedCartBanner.js +1 -1
- package/containers/OutOfStock.js +1 -1
- package/containers/PaymentMethods.js +1 -1
- package/containers/PlaceOrder/PlaceOrder.d.ts +1 -5
- package/containers/PlaceOrder.js +1 -1
- package/containers/ServerError.js +1 -1
- package/containers/ShippingMethods/hooks/useShippingEstimateEventEmitter.d.ts +15 -15
- package/containers/ShippingMethods.js +1 -1
- package/containers/index.d.ts +0 -2
- package/data/models/address.d.ts +11 -15
- package/data/models/api.d.ts +29 -0
- package/data/models/cart.d.ts +9 -5
- package/data/models/customer.d.ts +3 -14
- package/data/models/index.d.ts +19 -17
- package/data/models/region.d.ts +15 -15
- package/data/models/store-config.d.ts +0 -3
- package/data/transforms/index.d.ts +16 -18
- package/data/transforms/transform-address.d.ts +7 -5
- package/hocs/index.d.ts +16 -15
- package/hooks/index.d.ts +16 -16
- package/hooks/useStableList/index.d.ts +2 -0
- package/hooks/useStableList/useStableList.d.ts +2 -0
- package/i18n/en_US.json.d.ts +0 -18
- package/lib/index.d.ts +16 -15
- package/lib/validation.d.ts +5 -0
- package/msw/fixtures/fragments/cart.d.ts +3 -0
- package/msw/fixtures/fragments/index.d.ts +15 -18
- package/msw/fixtures/queries/index.d.ts +0 -3
- package/package.json +1 -1
- package/render.js +4 -4
- package/signals/IsBillToShippingSignal.d.ts +16 -20
- package/signals/index.d.ts +0 -3
- package/utils/index.d.ts +0 -6
- package/utils/refetchEstimatedShippingMethods/refetchEstimatedShippingMethods.d.ts +1 -0
- package/__generated__/types.d.ts +0 -15365
- package/api/fetchAddressFormFields/fetchAddressFormFields.d.ts +0 -18
- package/api/fetchAddressFormFields/fixtures.d.ts +0 -5
- package/api/fetchAddressFormFields/graphql/fetchAddressFormFields.graphql.d.ts +0 -18
- package/api/fetchAddressFormFields/index.d.ts +0 -19
- package/api/getCountries/fixtures.d.ts +0 -6
- package/api/getCountries/getCountries.d.ts +0 -18
- package/api/getCountries/graphql/getCountries.graphql.d.ts +0 -18
- package/api/getCountries/index.d.ts +0 -18
- package/api/getRegions/fixtures.d.ts +0 -5
- package/api/getRegions/getRegions.d.ts +0 -5
- package/api/getRegions/graphql/getRegions.graphql.d.ts +0 -18
- package/api/getRegions/index.d.ts +0 -18
- package/chunks/BillToShippingAddress.js +0 -1
- package/chunks/ShippingMethods.js +0 -1
- package/chunks/fixtures.js +0 -15
- package/chunks/getMultilineValues.js +0 -43
- package/chunks/placeOrder.js +0 -131
- package/chunks/setShippingAddress.js +0 -16
- package/chunks/transform-shipping-methods.js +0 -1
- package/components/AddressForm/AddressForm.d.ts +0 -22
- package/components/AddressForm/constants.d.ts +0 -20
- package/components/AddressForm/index.d.ts +0 -23
- package/components/AddressForm/useAddressBackup.d.ts +0 -8
- package/components/AddressForm/useAddressForm.d.ts +0 -39
- package/components/AddressForm/useCheckoutAddressEventEmitter.d.ts +0 -10
- package/components/AddressForm/usePreselectedFields.d.ts +0 -9
- package/components/AddressForm/utils.d.ts +0 -13
- package/components/FieldsForm/FieldsForm.d.ts +0 -13
- package/components/FieldsForm/FieldsFormSkeleton.d.ts +0 -4
- package/components/FieldsForm/fieldFactory.d.ts +0 -9
- package/components/FieldsForm/fixtures.d.ts +0 -5
- package/components/FieldsForm/index.d.ts +0 -22
- package/components/FieldsForm/validation.d.ts +0 -18
- package/containers/BillToShippingAddress/constants.d.ts +0 -18
- package/containers/BillingForm/BillingForm.d.ts +0 -9
- package/containers/BillingForm/constants.d.ts +0 -18
- package/containers/BillingForm/index.d.ts +0 -20
- package/containers/BillingForm.d.ts +0 -3
- package/containers/BillingForm.js +0 -1
- package/containers/LoginForm/constants.d.ts +0 -18
- package/containers/ShippingForm/ShippingForm.d.ts +0 -12
- package/containers/ShippingForm/constants.d.ts +0 -18
- package/containers/ShippingForm/index.d.ts +0 -20
- package/containers/ShippingForm.d.ts +0 -3
- package/containers/ShippingForm.js +0 -1
- package/data/models/address-form-fields.d.ts +0 -52
- package/data/transforms/transform-address-form-fields.d.ts +0 -66
- package/data/transforms/transform-countries.d.ts +0 -5
- package/data/transforms/transform-regions.d.ts +0 -8
- package/hooks/useValidity/index.d.ts +0 -18
- package/hooks/useValidity/useValidity.d.ts +0 -35
- package/msw/fixtures/fragments/american-regions.d.ts +0 -4
- package/msw/fixtures/fragments/countries.d.ts +0 -4
- package/msw/fixtures/fragments/form-fields.d.ts +0 -4
- package/msw/fixtures/queries/fetch-address-form-fields.d.ts +0 -4
- package/msw/fixtures/queries/get-countries.d.ts +0 -4
- package/msw/fixtures/queries/get-regions.d.ts +0 -4
- package/signals/AddressFormFieldsSignal.d.ts +0 -7
- package/signals/CountryListSignal.d.ts +0 -7
- package/signals/RegionsSignal.d.ts +0 -12
- package/utils/autocompleteFieldCodes/autocompleteFieldCodes.d.ts +0 -34
- package/utils/autocompleteFieldCodes/index.d.ts +0 -18
- package/utils/getMultilineValues/getMultilineValues.d.ts +0 -19
- package/utils/getMultilineValues/index.d.ts +0 -18
- package/utils/parseRegionId/index.d.ts +0 -18
- package/utils/parseRegionId/parseRegionId.d.ts +0 -18
- package/utils/processFormFields/index.d.ts +0 -18
- package/utils/processFormFields/processFormFields.d.ts +0 -21
- package/utils/scrollToElement/index.d.ts +0 -18
- package/utils/scrollToElement/scrollToElement.d.ts +0 -18
- package/utils/validateForms/index.d.ts +0 -18
- package/utils/validateForms/validateForms.d.ts +0 -18
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import{s as T,M as w,j as A,m as k,F as D,U as L}from"./fetch-graphql.js";import{events as f}from"@dropins/tools/event-bus.js";const R=n=>({id:T.cartId,totalQuantity:n.totalQuantity,possibleOnepageCheckout:!0,items:n.items.map(a=>{var t;return{canApplyMsrp:!0,formattedPrice:"",id:a.id,quantity:a.totalQuantity,product:{canonicalUrl:a.product.canonicalUrl||"",mainImageUrl:a.product.image||"",name:a.product.name,productId:0,productType:a.product.productType,sku:a.product.sku},prices:{price:{value:a.price.value,currency:a.price.currency}},configurableOptions:((t=a.selectedOptions)==null?void 0:t.map(i=>({optionLabel:i.label,valueLabel:i.value})))||[]}})}),V=n=>{var i,c,l;const a=n.coupons[0],t=(i=n.payments)==null?void 0:i[0];return{appliedCouponCode:(a==null?void 0:a.code)||"",email:n.email,grandTotal:n.total,orderId:n.number,orderType:"checkout",otherTax:0,salesTax:n.totalTax,shipping:{shippingMethod:((c=n.shipping)==null?void 0:c.code)||"",shippingAmount:((l=n.shipping)==null?void 0:l.amount)||0},subtotalExcludingTax:n.subtotal,subtotalIncludingTax:0,payments:t?[{paymentMethodCode:(t==null?void 0:t.code)||"",paymentMethodName:(t==null?void 0:t.name)||"",total:n.total}]:[]}},q=n=>n||0,Q=n=>{var a;return{canonicalUrl:(n==null?void 0:n.canonical_url)||"",id:(n==null?void 0:n.uid)||"",name:(n==null?void 0:n.name)||"",sku:(n==null?void 0:n.sku)||"",image:((a=n==null?void 0:n.image)==null?void 0:a.url)||"",productType:(n==null?void 0:n.__typename)||""}};function M(n){if(!n||!("selected_options"in n))return;const a={};for(const t of n.selected_options)a[t.label]=t.value;return a}const P=n=>n?n.map(a=>{var t,i,c,l,u,s,e,p,_,o,y,g,h,v;return{type:a==null?void 0:a.__typename,id:a==null?void 0:a.id,discounted:(a==null?void 0:a.product.price_range.maximum_price.regular_price.value)*(a==null?void 0:a.quantity_ordered)!==(a==null?void 0:a.product_sale_price.value)*(a==null?void 0:a.quantity_ordered),total:{value:(a==null?void 0:a.product_sale_price.value)*(a==null?void 0:a.quantity_ordered),currency:a==null?void 0:a.product_sale_price.currency},totalInclTax:{value:(a==null?void 0:a.product_sale_price.value)*(a==null?void 0:a.quantity_ordered),currency:a==null?void 0:a.product_sale_price.currency},price:{value:a==null?void 0:a.product_sale_price.value,currency:a==null?void 0:a.product_sale_price.currency},priceInclTax:{value:a==null?void 0:a.product_sale_price.value,currency:a==null?void 0:a.product_sale_price.currency},totalQuantity:q(a==null?void 0:a.quantity_ordered),regularPrice:{value:(c=(i=(t=a==null?void 0:a.product)==null?void 0:t.price_range)==null?void 0:i.maximum_price)==null?void 0:c.regular_price.value,currency:(s=(u=(l=a==null?void 0:a.product)==null?void 0:l.price_range)==null?void 0:u.maximum_price)==null?void 0:s.regular_price.currency},product:Q(a==null?void 0:a.product),thumbnail:{label:((p=(e=a==null?void 0:a.product)==null?void 0:e.thumbnail)==null?void 0:p.label)||"",url:((o=(_=a==null?void 0:a.product)==null?void 0:_.thumbnail)==null?void 0:o.url)||""},giftCard:(a==null?void 0:a.__typename)==="GiftCardOrderItem"?{senderName:((y=a.gift_card)==null?void 0:y.sender_name)||"",senderEmail:((g=a.gift_card)==null?void 0:g.sender_email)||"",recipientEmail:((h=a.gift_card)==null?void 0:h.recipient_email)||"",recipientName:((v=a.gift_card)==null?void 0:v.recipient_name)||""}:void 0,configurableOptions:M(a)}}):[];function S(n){return n!==null&&n.value!==void 0}const C=n=>n?{city:n.city,company:n.company||"",country:n.country_code||"",firstName:n.firstname,middleName:n.middlename||"",lastName:n.lastname,postCode:n.postcode||"",regionId:n.region_id||"",region:n.region||"",street:n.street.filter(a=>a!==null),telephone:n.telephone||"",customAttributes:n.custom_attributesV2.filter(S).map(a=>({code:a.code,value:a.value}))}:null,U=n=>{var u,s,e,p,_,o,y,g,h,v;const a=(u=n.payment_methods)==null?void 0:u[0],t=(a==null?void 0:a.type)??"",i=(a==null?void 0:a.name)??"",c=P(n.items),l=c.reduce((b,N)=>b+N.totalQuantity,0);return{status:n.status,isVirtual:n.is_virtual,coupons:((s=n==null?void 0:n.applied_coupons)==null?void 0:s.map(b=>({code:(b==null?void 0:b.code)??""})))||[],email:n.email??"",items:c,number:n.number,token:n.token,grandTotal:{value:((e=n.total)==null?void 0:e.grand_total.value)??0,currency:((p=n.total)==null?void 0:p.grand_total.currency)||""},totalQuantity:l,totalTax:{value:((_=n.total)==null?void 0:_.total_tax.value)??0,currency:((o=n.total)==null?void 0:o.total_tax.currency)||""},subtotal:{value:((y=n.total)==null?void 0:y.subtotal.value)??0,currency:((g=n.total)==null?void 0:g.subtotal.currency)||""},shipping:{amount:((h=n.total)==null?void 0:h.total_shipping.value)??0,currency:((v=n.total)==null?void 0:v.total_shipping.currency)||"",code:n.shipping_method??""},payments:[{code:t,name:i}],shippingAddress:C(n.shipping_address),billingAddress:C(n.billing_address)}},G=`
|
|
2
|
+
mutation placeOrder($cartId: String!) {
|
|
3
|
+
placeOrder(input: { cart_id: $cartId }) {
|
|
4
|
+
errors {
|
|
5
|
+
code
|
|
6
|
+
message
|
|
7
|
+
}
|
|
8
|
+
orderV2 {
|
|
9
|
+
number
|
|
10
|
+
status
|
|
11
|
+
token
|
|
12
|
+
is_virtual
|
|
13
|
+
applied_coupons {
|
|
14
|
+
code
|
|
15
|
+
}
|
|
16
|
+
email
|
|
17
|
+
id
|
|
18
|
+
total {
|
|
19
|
+
grand_total {
|
|
20
|
+
currency
|
|
21
|
+
value
|
|
22
|
+
}
|
|
23
|
+
subtotal {
|
|
24
|
+
currency
|
|
25
|
+
value
|
|
26
|
+
}
|
|
27
|
+
total_shipping {
|
|
28
|
+
currency
|
|
29
|
+
value
|
|
30
|
+
}
|
|
31
|
+
total_tax {
|
|
32
|
+
currency
|
|
33
|
+
value
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
shipping_method
|
|
37
|
+
payment_methods {
|
|
38
|
+
name
|
|
39
|
+
type
|
|
40
|
+
}
|
|
41
|
+
billing_address {
|
|
42
|
+
firstname
|
|
43
|
+
middlename
|
|
44
|
+
lastname
|
|
45
|
+
street
|
|
46
|
+
city
|
|
47
|
+
postcode
|
|
48
|
+
telephone
|
|
49
|
+
country_code
|
|
50
|
+
region
|
|
51
|
+
region_id
|
|
52
|
+
company
|
|
53
|
+
custom_attributesV2 {
|
|
54
|
+
code
|
|
55
|
+
... on AttributeValue {
|
|
56
|
+
value
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
shipping_address {
|
|
61
|
+
firstname
|
|
62
|
+
middlename
|
|
63
|
+
lastname
|
|
64
|
+
street
|
|
65
|
+
city
|
|
66
|
+
postcode
|
|
67
|
+
telephone
|
|
68
|
+
country_code
|
|
69
|
+
region
|
|
70
|
+
region_id
|
|
71
|
+
company
|
|
72
|
+
custom_attributesV2 {
|
|
73
|
+
code
|
|
74
|
+
... on AttributeValue {
|
|
75
|
+
value
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
items {
|
|
80
|
+
__typename
|
|
81
|
+
id
|
|
82
|
+
discounts {
|
|
83
|
+
amount {
|
|
84
|
+
value
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
product {
|
|
88
|
+
__typename
|
|
89
|
+
canonical_url
|
|
90
|
+
image {
|
|
91
|
+
url
|
|
92
|
+
}
|
|
93
|
+
thumbnail {
|
|
94
|
+
label
|
|
95
|
+
url
|
|
96
|
+
}
|
|
97
|
+
name
|
|
98
|
+
sku
|
|
99
|
+
uid
|
|
100
|
+
price_range {
|
|
101
|
+
maximum_price {
|
|
102
|
+
regular_price {
|
|
103
|
+
currency
|
|
104
|
+
value
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
selected_options {
|
|
110
|
+
label
|
|
111
|
+
value
|
|
112
|
+
}
|
|
113
|
+
product_sale_price {
|
|
114
|
+
value
|
|
115
|
+
currency
|
|
116
|
+
}
|
|
117
|
+
quantity_ordered
|
|
118
|
+
... on GiftCardOrderItem {
|
|
119
|
+
gift_card {
|
|
120
|
+
recipient_name
|
|
121
|
+
recipient_email
|
|
122
|
+
sender_name
|
|
123
|
+
sender_email
|
|
124
|
+
message
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
`,x={SHOPPING_CART_CONTEXT:"shoppingCartContext",ORDER_CONTEXT:"orderContext"},F={PLACE_ORDER:"place-order"};function E(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function O(n,a){const t=E();t.push({[n]:null}),t.push({[n]:a})}function X(n,a){E().push(i=>{const c=i.getState?i.getState():{};i.push({event:n,eventInfo:{...c,...a}})})}function $(n){const a=R(n),t=V(n);O(x.SHOPPING_CART_CONTEXT,{...a}),O(x.ORDER_CONTEXT,{...t}),X(F.PLACE_ORDER)}function H(n){throw n.every(t=>{var i;return(i=t.extensions)==null?void 0:i.category})?new D(n):new L(n[0].message)}const B=async()=>{const n=T.cartId;if(!n)throw new w;const{data:a,errors:t}=await A(G,{variables:{cartId:n}}).catch(k);t&&H(t);const i=U(a.placeOrder.orderV2);return $(i),f.emit("checkout/order",i),f.emit("cart/reset",void 0),i};export{B as p};
|
package/chunks/resetCustomer.js
CHANGED
|
@@ -1,36 +1 @@
|
|
|
1
|
-
import{events as n}from"@dropins/tools/event-bus.js";import{
|
|
2
|
-
query fetchAddressFormFields {
|
|
3
|
-
attributesForm(formCode: "customer_register_address") {
|
|
4
|
-
items {
|
|
5
|
-
frontend_input
|
|
6
|
-
code
|
|
7
|
-
label
|
|
8
|
-
default_value
|
|
9
|
-
is_required
|
|
10
|
-
options {
|
|
11
|
-
label
|
|
12
|
-
value
|
|
13
|
-
is_default
|
|
14
|
-
}
|
|
15
|
-
... on CustomerAttributeMetadata {
|
|
16
|
-
multiline_count
|
|
17
|
-
sort_order
|
|
18
|
-
validate_rules {
|
|
19
|
-
name
|
|
20
|
-
value
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
errors {
|
|
25
|
-
message
|
|
26
|
-
type
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
`,b=async()=>await l({type:"query",query:y,options:{method:"GET",cache:"no-cache"},path:"attributesForm.items",signalType:"addressFormFields",transformer:v,defaultValueOnFail:[]}),h=`
|
|
31
|
-
query getCountries {
|
|
32
|
-
countries {
|
|
33
|
-
two_letter_abbreviation
|
|
34
|
-
full_name_locale
|
|
35
|
-
}
|
|
36
|
-
}`,C=async()=>await l({type:"query",query:h,options:{method:"GET",cache:"no-cache"},path:"countries",signalType:"countryList",transformer:p,defaultValueOnFail:[]}),F=()=>[n.on("cart/initialized",e=>{const t=(e==null?void 0:e.id)||null;a.cartId=t,t?i():o()},{eager:!0}),n.on("cart/data",e=>{const t=(e==null?void 0:e.id)||null;t!==a.cartId&&(a.cartId=t,t?i():o())},{eager:!0}),n.on("authenticated",e=>{a.authenticated=e,e||I()},{eager:!0})],u=new m({init:async e=>{const t={guestViewCookieExpirationDays:30,...e};u.config.setConfig(t),q()},listeners:F}),V=u.config,q=async()=>Promise.all([d(),C(),b()]),o=()=>{a.cartId=null,c.value={pending:!1,data:null}},I=()=>{a.authenticated=!1,f.value={pending:!1,data:null}};export{q as a,I as b,V as c,b as f,C as g,u as i,o as r};
|
|
1
|
+
import{events as n}from"@dropins/tools/event-bus.js";import{a as l,c as d,d as c}from"./store-config.js";import{s as a,l as u}from"./fetch-graphql.js";import{Initializer as f}from"@dropins/tools/lib.js";import{g as s}from"./getCustomer.js";const g=()=>[n.on("cart/initialized",e=>{const t=(e==null?void 0:e.id)||null;a.cartId=t,t?s():o()},{eager:!0}),n.on("cart/data",e=>{const t=(e==null?void 0:e.id)||null;t!==a.cartId&&(a.cartId=t,t?s():o())},{eager:!0}),n.on("authenticated",e=>{a.authenticated=e,e||C()},{eager:!0})],r=new f({init:async e=>{const t=e||{};r.config.setConfig(t),m(t)},listeners:g}),k=r.config,m=async e=>{var i;const t=(i=e==null?void 0:e.models)==null?void 0:i.StoreConfig;if(!t)return u();l.value={data:t.initialData,pending:!1}},o=()=>{a.cartId=null,d.value={pending:!1,data:null}},C=()=>{a.authenticated=!1,c.value={pending:!1,data:null}};export{m as a,C as b,k as c,r as i,o as r};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import{
|
|
2
|
-
mutation setBillingAddress($
|
|
3
|
-
setBillingAddressOnCart(
|
|
4
|
-
input: { cart_id: $cartId, billing_address: $input }
|
|
5
|
-
) {
|
|
1
|
+
import{s as e,M as l,f as d,d as o}from"./fetch-graphql.js";import{C as p,a as f,b as g}from"./getCart.graphql.js";const c=`
|
|
2
|
+
mutation setBillingAddress($input: SetBillingAddressOnCartInput!) {
|
|
3
|
+
setBillingAddressOnCart(input: $input) {
|
|
6
4
|
cart {
|
|
7
5
|
id
|
|
8
6
|
...CheckoutData
|
|
9
7
|
}
|
|
10
8
|
}
|
|
11
9
|
}
|
|
12
|
-
${
|
|
13
|
-
`,
|
|
10
|
+
${p}
|
|
11
|
+
`,C=async({address:i,customerAddressId:s,sameAsShipping:t=!1,useForShipping:n=!1})=>{const r=e.cartId;if(!r)throw new l;const a={cart_id:r,billing_address:{same_as_shipping:t,use_for_shipping:n}};if(!t&&s&&(a.billing_address.customer_address_id=s),!t&&!s){if(!i)throw new d;a.billing_address.address=f(i)}return await o({type:"mutation",query:c,options:{variables:{input:a}},path:"setBillingAddressOnCart.cart",signalType:"cart",transformer:g})};export{c as a,C as s};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c as r,j as s,m as e,s as l,M as n,d as o}from"./fetch-graphql.js";import"./store-config.js";import"@dropins/tools/event-bus.js";import{C as m,b as c}from"./getCart.graphql.js";const E=a=>!!(a!=null&&a.is_email_available),u=`
|
|
2
2
|
query isEmailAvailable($email: String!) {
|
|
3
3
|
isEmailAvailable(email: $email) {
|
|
4
4
|
is_email_available
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
`,h=a=>{if(!(!a||a.length===0))throw Error(a.map(t=>t.message).join(" "))},
|
|
7
|
+
`,h=a=>{if(!(!a||a.length===0))throw Error(a.map(t=>t.message).join(" "))},C=async a=>{if(!a)throw new r;const{data:t,errors:i}=await s(u,{method:"GET",cache:"no-cache",variables:{email:a}}).catch(e);return i&&h(i),E(t.isEmailAvailable)},p=`
|
|
8
8
|
mutation setGuestEmail($cartId: String!, $email: String!) {
|
|
9
9
|
setGuestEmailOnCart(input: { cart_id: $cartId, email: $email }) {
|
|
10
10
|
cart {
|
|
@@ -14,4 +14,4 @@ import{a as r,g as s,u as e,k as l,M as n,l as o}from"./fixtures.js";import"@dro
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
${m}
|
|
17
|
-
`,
|
|
17
|
+
`,d=async a=>{const t=l.cartId;if(!t)throw new n;return await o({type:"mutation",query:p,options:{variables:{cartId:t,email:a}},path:"setGuestEmailOnCart.cart",signalType:"cart",transformer:c})};export{C as i,d as s};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{s as e,M as r,e as n,d as s}from"./fetch-graphql.js";import{C as o,b as i}from"./getCart.graphql.js";const d=`
|
|
2
2
|
mutation setPaymentMethod($cartId: String!, $paymentMethod: String!) {
|
|
3
3
|
setPaymentMethodOnCart(
|
|
4
4
|
input: { cart_id: $cartId, payment_method: { code: $paymentMethod } }
|
|
@@ -10,4 +10,4 @@ import{k as e,M as r,b as n,l as s}from"./fixtures.js";import{C as o,t as i}from
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
${o}
|
|
13
|
-
`,h=async t=>{const a=e.cartId;if(!a)throw new r;if(!t)throw new n;return await s({type:"mutation",query:
|
|
13
|
+
`,h=async t=>{const a=e.cartId;if(!a)throw new r;if(!t)throw new n;return await s({type:"mutation",query:d,options:{variables:{cartId:a,paymentMethod:t}},path:"setPaymentMethodOnCart.cart",signalType:"cart",transformer:i})};export{h as s};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{s,M as a,d as p}from"./fetch-graphql.js";import{C as r,b as n}from"./getCart.graphql.js";import"./store-config.js";import"@dropins/tools/event-bus.js";const o=`
|
|
2
2
|
mutation setShippingMethods(
|
|
3
3
|
$cartId: String!
|
|
4
4
|
$shippingMethods: [ShippingMethodInput]!
|
|
@@ -13,4 +13,4 @@ import{k as a,M as s,l as p}from"./fixtures.js";import{C as r,t as n}from"./getC
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
${r}
|
|
16
|
-
`,
|
|
16
|
+
`,g=async i=>{const t=s.cartId;if(!t)throw new a;return await p({type:"mutation",query:o,options:{variables:{cartId:t,shippingMethods:i}},path:"setShippingMethodsOnCart.cart",signalType:"cart",transformer:n})};export{g as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{signal as e,effect as n}from"@dropins/tools/signals.js";import{events as s}from"@dropins/tools/event-bus.js";const o=e(!0),i=e({pending:!1,data:void 0});n(()=>{var a;(a=i.value.data)!=null&&a.isVirtual&&(o.value=!1)});n(()=>{i.value.pending||s.emit("checkout/data",i.value.data||null)});const t=e({pending:!1,data:void 0});n(()=>{t.value.pending||t.value.data&&s.emit("checkout/customer",t.value.data)});const g=e({pending:!1,data:void 0}),u=e(void 0),c=e(),v=e({data:void 0,pending:!1});var r=(a=>(a.EXCLUDING_TAX="EXCLUDING_TAX",a.INCLUDING_EXCLUDING_TAX="INCLUDING_AND_EXCLUDING_TAX",a.INCLUDING_TAX="INCLUDING_TAX",a))(r||{});export{r as T,v as a,c as b,i as c,t as d,g as e,o as i,u as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{c as p}from"./store-config.js";import"@dropins/tools/event-bus.js";import"./fetch-graphql.js";function u(i){return i.displayName||i.name||"Component"}const w=i=>{const o=u(i),a=({hideOnEmptyCart:s=!0,hideOnVirtualCart:r=!1,...e})=>{const t=p.value.data,l=t!==void 0&&(t===null||t.isEmpty),m=!!(t!=null&&t.isVirtual),c=s&&l||r&&m,d=`conditional-${o.toLowerCase()}`;return n("div",{className:d,children:!c&&n(i,{...e})})};return a.displayName=`Conditional(${o})`,a};export{w};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FunctionComponent } from 'preact';
|
|
2
|
-
import {
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
3
|
|
|
4
|
-
export interface BillToShippingAddressProps extends Omit<
|
|
5
|
-
|
|
4
|
+
export interface BillToShippingAddressProps extends Omit<HTMLAttributes<HTMLInputElement>, 'loading'> {
|
|
5
|
+
loading?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare const BillToShippingAddress: FunctionComponent<BillToShippingAddressProps>;
|
|
8
8
|
//# sourceMappingURL=BillToShippingAddress.d.ts.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { HTMLAttributes } from 'preact/compat';
|
|
2
1
|
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
3
|
|
|
4
|
-
export interface LoginEmailProps extends HTMLAttributes<
|
|
5
|
-
value
|
|
6
|
-
error
|
|
7
|
-
hint
|
|
8
|
-
onChange: (
|
|
9
|
-
onBlur: (
|
|
10
|
-
onInvalid: (
|
|
4
|
+
export interface LoginEmailProps extends HTMLAttributes<HTMLInputElement> {
|
|
5
|
+
value: string;
|
|
6
|
+
error: string;
|
|
7
|
+
hint: string;
|
|
8
|
+
onChange: (event: Event) => void;
|
|
9
|
+
onBlur: (event: Event) => void;
|
|
10
|
+
onInvalid: (event: Event) => void;
|
|
11
11
|
}
|
|
12
12
|
export declare const Email: FunctionComponent<LoginEmailProps>;
|
|
13
13
|
//# sourceMappingURL=Email.d.ts.map
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import { Customer } from '../../data/models';
|
|
2
1
|
import { FunctionComponent, HTMLAttributes } from 'preact/compat';
|
|
3
2
|
|
|
4
|
-
export interface LoginFormProps extends HTMLAttributes<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
export interface LoginFormProps extends Omit<HTMLAttributes<HTMLFormElement>, 'loading'> {
|
|
4
|
+
customerDetails?: {
|
|
5
|
+
firstName: string;
|
|
6
|
+
lastName: string;
|
|
7
|
+
email: string;
|
|
8
|
+
};
|
|
9
|
+
email: string;
|
|
10
|
+
error: string;
|
|
11
|
+
hint: string;
|
|
12
|
+
loading?: boolean;
|
|
13
|
+
onEmailBlur: (event: Event) => void;
|
|
14
|
+
onEmailChange: (event: Event) => void;
|
|
15
|
+
onEmailInvalid: (event: Event) => void;
|
|
16
|
+
onSignInClick?: (email: string) => void;
|
|
12
17
|
onSignOutClick?: () => void;
|
|
13
|
-
customer?: Customer | null;
|
|
14
18
|
}
|
|
15
19
|
export declare const LoginForm: FunctionComponent<LoginFormProps>;
|
|
16
20
|
//# sourceMappingURL=LoginForm.d.ts.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { FunctionComponent } from 'preact';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
3
|
+
interface SignInProps {
|
|
4
|
+
onClick: (event: Event) => void;
|
|
5
|
+
}
|
|
7
6
|
export declare const SignIn: FunctionComponent<SignInProps>;
|
|
8
7
|
export {};
|
|
9
8
|
//# sourceMappingURL=SignIn.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FunctionComponent } from 'preact';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
3
|
+
interface SignOutProps {
|
|
4
|
+
onClick?: (event: Event) => void;
|
|
5
|
+
}
|
|
6
6
|
export declare const SignOut: FunctionComponent<SignOutProps>;
|
|
7
7
|
export {};
|
|
8
8
|
//# sourceMappingURL=SignOut.d.ts.map
|
|
@@ -2,11 +2,12 @@ import { PaymentMethod } from '../../data/models/payment-method';
|
|
|
2
2
|
import { FunctionComponent, VNode } from 'preact';
|
|
3
3
|
import { HTMLAttributes } from 'preact/compat';
|
|
4
4
|
|
|
5
|
-
export interface PaymentMethodsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
export interface PaymentMethodsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'loading'> {
|
|
6
|
+
initializing?: boolean;
|
|
7
|
+
loading?: boolean;
|
|
8
8
|
onChange?: (value: string) => void;
|
|
9
9
|
options?: PaymentMethod[];
|
|
10
|
+
paymentMethodContent?: VNode;
|
|
10
11
|
selection?: string;
|
|
11
12
|
}
|
|
12
13
|
export declare const PaymentMethods: FunctionComponent<PaymentMethodsProps>;
|
package/components/index.d.ts
CHANGED
|
@@ -14,10 +14,8 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export * from './AddressForm';
|
|
18
17
|
export * from './BillToShippingAddress';
|
|
19
18
|
export * from './EstimateShipping';
|
|
20
|
-
export * from './FieldsForm';
|
|
21
19
|
export * from './Heading';
|
|
22
20
|
export * from './LoginForm';
|
|
23
21
|
export * from './OutOfStock';
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 interface BillToShippingAddressProps {
|
|
18
|
+
onChange?: (checked: boolean) => void;
|
|
7
19
|
}
|
|
8
20
|
export declare const BillToShippingAddress: {
|
|
9
21
|
({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs/withConditionalRendering').ConditionalProps & BillToShippingAddressProps): import("preact/compat").JSX.Element;
|
|
@@ -1,20 +1,19 @@
|
|
|
1
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 * from './constants';
|
|
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
|
+
*******************************************************************/
|
|
18
17
|
export * from './BillToShippingAddress';
|
|
19
18
|
export { BillToShippingAddress as default } from './BillToShippingAddress';
|
|
20
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/event-bus.js";import{i as a,c as g}from"../chunks/store-config.js";import"../chunks/fetch-graphql.js";import{s as k}from"../chunks/setBillingAddress.js";/* empty css */import{Checkbox as S,Skeleton as b,SkeletonRow as f}from"@dropins/tools/components.js";import{c as A}from"../chunks/classes.js";import{useText as B}from"@dropins/tools/i18n.js";import{w as x}from"../chunks/withConditionalRendering.js";import{useState as T,useEffect as v}from"@dropins/tools/preact-compat.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getCart.graphql.js";const _=({className:i,checked:e,loading:r,onChange:n})=>{const s=B({title:"Checkout.BillToShippingAddress.title"});return r?t(w,{}):t("div",{className:"checkout-bill-to-shipping-address",children:t(S,{checked:e,className:A(["checkout-bill-to-shipping-address__checkbox",i]),"data-testid":"bill-to-shipping-checkbox",label:s.title,name:"checkout-bill-to-shipping-address__checkbox",onChange:n})})},w=()=>t(b,{className:"bill-to-shipping-address__skeleton",children:t(f,{variant:"row",size:"small"})}),u=({onChange:i})=>{var h;const[e,r]=T(!0),n=a.value,s=g.value.data,d=!!s,p=!!(s==null?void 0:s.billingAddress),l=(h=s==null?void 0:s.shippingAddresses)==null?void 0:h[0],m=l==null?void 0:l.sameAsBilling;return v(()=>{if(!e||!d)return;r(!1);const o=m??!p;a.value=o,i==null||i(o)},[d,p,m,e,i]),t(_,{checked:n,loading:e,onChange:async o=>{const c=o.target.checked;a.value=c,i==null||i(c),!e&&l&&c&&await k({sameAsShipping:!0}).catch(console.error)},disabled:g.value.pending})};u.displayName="BillToShippingAddressContainer";const L=x(u);export{L as BillToShippingAddress,L as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FunctionComponent } from 'preact/compat';
|
|
2
1
|
import { AlertBannerProps } from '@dropins/tools/types/elsie/src/components';
|
|
2
|
+
import { Container } from '@dropins/tools/types/elsie/src/src/lib/types';
|
|
3
3
|
|
|
4
|
-
export declare const ErrorBanner:
|
|
4
|
+
export declare const ErrorBanner: Container<AlertBannerProps>;
|
|
5
5
|
//# sourceMappingURL=ErrorBanner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{AlertBanner as m,Icon as f}from"@dropins/tools/components.js";import{events as u}from"@dropins/tools/event-bus.js";import*as i from"@dropins/tools/preact-compat.js";import{useState as g,useEffect as p}from"@dropins/tools/preact-compat.js";import{useText as h}from"@dropins/tools/i18n.js";const v=o=>i.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o},i.createElement("path",{vectorEffect:"non-scaling-stroke",fillRule:"evenodd",clipRule:"evenodd",d:"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z",fill:"currentColor"})),B=({initialData:o,...l})=>{const[c,s]=g(!1),t=h({message:"Checkout.ErrorBanner.genericMessage"});p(()=>{const r=u.on("error",e=>{(e==null?void 0:e.source)==="checkout"&&(e==null?void 0:e.type)==="network"&&s(!0)});return()=>{r==null||r.off()}},[]);const a=()=>{s(!1)};return c?n(m,{...l,className:"checkout__banner","data-testid":"error-banner",icon:n(f,{source:v}),message:n("span",{children:t.message}),"aria-label":t.message,onDismiss:a,variant:"warning"}):null};export{B as ErrorBanner,B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as E,Fragment as L,jsx as t}from"@dropins/tools/preact-jsx-runtime.js"
|
|
1
|
+
import{jsxs as E,Fragment as L,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Skeleton as M,SkeletonRow as w,Price as l}from"@dropins/tools/components.js";/* empty css */import{VComponent as A,classes as S}from"@dropins/tools/lib.js";import{Text as c,useText as B}from"@dropins/tools/i18n.js";import{useState as G,useEffect as k}from"@dropins/tools/preact-hooks.js";/* empty css */import{a as P,T as I}from"../chunks/store-config.js";import{events as C}from"@dropins/tools/event-bus.js";import"@dropins/tools/signals.js";const U=({estimated:e=!1,price:o,priceExclTax:r,taxExcluded:s=!1,taxIncluded:n=!1})=>E(L,{children:[t("span",{className:"checkout-estimate-shipping__label",children:e?t(c,{id:"Checkout.EstimateShipping.estimated"}):t(c,{id:"Checkout.EstimateShipping.label"})}),t(A,{node:o,className:"checkout-estimate-shipping__price"}),n&&t("span",{"data-testid":"shipping-tax-included",className:S(["checkout-estimate-shipping__caption"]),children:t(c,{id:"Checkout.EstimateShipping.withTaxes"})}),s&&E("span",{"data-testid":"shipping-tax-included-excluded",className:S(["checkout-estimate-shipping__caption"]),children:[r," ",t(c,{id:"Checkout.EstimateShipping.withoutTaxes"})]})]}),X=()=>t(M,{"data-testid":"estimate-shipping-skeleton",children:t(w,{size:"xsmall"})}),O=()=>{const[e,o]=G(),r=e!==void 0,s=(e==null?void 0:e.amount.value)===0,{data:n,pending:_}=P.value,y=_||n===void 0,d=n==null?void 0:n.shoppingCartDisplaySetting.shipping,D=d===I.INCLUDING_EXCLUDING_TAX,g=d===I.INCLUDING_TAX,x=B({freeShipping:"Checkout.EstimateShipping.freeShipping",taxToBeDetermined:"Checkout.EstimateShipping.taxToBeDetermined"});k(()=>{const i=C.on("shipping/estimate",a=>{const p=a.shippingMethod,{amount:m,amountExclTax:u,amountInclTax:h}=p;o({estimated:!0,amount:m,amountExclTax:u,amountInclTax:h})},{eager:!0});return()=>{i==null||i.off()}},[]),k(()=>{const i=C.on("checkout/data",a=>{var f,T;const p=(T=(f=a==null?void 0:a.shippingAddresses)==null?void 0:f[0])==null?void 0:T.selectedShippingMethod;if(!p)return;const{amount:m,amountExclTax:u,amountInclTax:h}=p;o({estimated:!1,amount:m,amountExclTax:u,amountInclTax:h})},{eager:!0});return()=>{i==null||i.off()}},[]);const N=()=>s?t("span",{"data-testId":"free-shipping",children:x.freeShipping}):g&&(e!=null&&e.amountInclTax)?t(l,{"data-testid":"shipping",amount:e.amountInclTax.value,currency:e.amountInclTax.currency}):t(l,{"data-testid":"shipping",amount:e==null?void 0:e.amount.value,currency:e==null?void 0:e.amount.currency}),v=()=>e!=null&&e.amountExclTax?t(l,{"data-testid":"shipping-excluding-tax",amount:e.amountExclTax.value,currency:e.amountExclTax.currency}):t("span",{children:x.taxToBeDetermined});return t("div",{"data-testid":"estimate-shipping",className:"checkout-estimate-shipping",children:!r||y?t(X,{}):t(U,{estimated:e.estimated,price:N(),taxExcluded:D&&!s,taxIncluded:g&&!s,priceExclTax:v()})})};export{O as EstimateShipping,O as default};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'preact/compat';
|
|
2
2
|
|
|
3
|
-
export interface LoginFormProps extends HTMLAttributes<
|
|
4
|
-
|
|
5
|
-
onSignInClick?: (email: string | null) => void;
|
|
3
|
+
export interface LoginFormProps extends HTMLAttributes<HTMLFormElement> {
|
|
4
|
+
onSignInClick?: (email: string) => void;
|
|
6
5
|
onSignOutClick?: () => void;
|
|
7
6
|
}
|
|
8
7
|
export declare const LoginForm: {
|
|
@@ -1,20 +1,19 @@
|
|
|
1
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 * from './constants';
|
|
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
|
+
*******************************************************************/
|
|
18
17
|
export * from './LoginForm';
|
|
19
18
|
export { LoginForm as default } from './LoginForm';
|
|
20
19
|
//# sourceMappingURL=index.d.ts.map
|
package/containers/LoginForm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e,jsxs as s,Fragment as P}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/event-bus.js";import{c as w,d as R}from"../chunks/store-config.js";import{s as V}from"../chunks/fetch-graphql.js";import{i as j,s as q}from"../chunks/setGuestEmailOnCart.js";import{Field as D,Input as W,Skeleton as G,SkeletonRow as x}from"@dropins/tools/components.js";/* empty css *//* empty css */import{classes as U}from"@dropins/tools/lib.js";import{H as J}from"../chunks/Heading.js";import{useText as b,Text as _}from"@dropins/tools/i18n.js";import{useState as p,useRef as K,useEffect as C}from"@dropins/tools/preact-hooks.js";/* empty css */import{w as O}from"../chunks/withConditionalRendering.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getCart.graphql.js";const Q=({value:t,error:i,hint:g,onChange:h,onBlur:o,onInvalid:u})=>{const m=b({LoginFormLabel:"Checkout.LoginForm.ariaLabel",LoginFormFloatingLabel:"Checkout.LoginForm.floatingLabel",LoginFormPlaceholder:"Checkout.LoginForm.placeholder"});return e(D,{size:"medium",error:i,hint:g,children:e(W,{"aria-label":m.LoginFormLabel,"aria-required":!0,autocomplete:"email",floatingLabel:m.LoginFormFloatingLabel,id:"customer-email",name:"customer-email",onBlur:o,onChange:h,onInvalid:u,placeholder:m.LoginFormPlaceholder,required:!0,type:"email",value:t})})},X=({onClick:t})=>s("div",{className:"checkout-login-form__sign-in",children:[e(_,{id:"Checkout.LoginForm.account"}),e("a",{"data-testid":"sign-in-link",className:"checkout-login-form__link",href:"#",target:"_blank",rel:"noreferrer",onClick:t,children:e(_,{id:"Checkout.LoginForm.signIn"})})]}),Y=({className:t,customerDetails:i,email:g,error:h,hint:o,loading:u=!1,name:m,onEmailBlur:f,onEmailChange:k,onEmailInvalid:E,onSignInClick:a,onSignOutClick:F,...L})=>{const l=b({Title:"Checkout.LoginForm.title"});return u?e(Z,{}):s("div",{className:"checkout-login-form","data-testid":"checkout-login-form",children:[s("div",{className:"checkout-login-form__heading",children:[e(J,{level:2,className:"checkout-login-form__title",children:l.Title}),i?e(S,{onClick:d=>{d.preventDefault(),F==null||F()}}):e(X,{onClick:d=>{d.preventDefault(),a==null||a(g)}})]}),i?s("div",{className:"checkout-login-form__customer-details",children:[e("div",{className:"checkout-login-form__customer-name",children:`${i.firstName} ${i.lastName}`}),e("div",{className:"checkout-login-form__customer-email",children:i.email})]}):e("div",{className:"checkout-login-form__content",children:s("form",{...L,className:U(["dropin-login-form__form",t]),name:m,noValidate:!0,children:[e("button",{type:"submit",disabled:!0,style:"display: none","aria-hidden":"true"}),e(Q,{value:g,error:h,hint:o,onChange:k,onBlur:f,onInvalid:E})]})})]})},Z=()=>s(G,{"data-testid":"login-form-skeleton",children:[e(x,{variant:"heading",fullWidth:!0}),e(x,{size:"medium",fullWidth:!0})]}),S=({onClick:t})=>s("p",{className:"checkout-login-form__sign-out",children:[e(_,{id:"Checkout.LoginForm.switch"}),e("a",{className:"checkout-login-form__link",href:"#",target:"_blank",rel:"noreferrer",onClick:t,children:e(_,{id:"Checkout.LoginForm.signOut"})})]}),ee={EMAIL:/^[a-z0-9,!#$%&'*+/=?^_`{|}~-]+(\.[a-z0-9,!#$%&'*+/=?^_`{|}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i},N=t=>ee.EMAIL.test(t),re=1e3,y=({onSignInClick:t,onSignOutClick:i,initialData:g,...h})=>{const[o,u]=p(""),[m,f]=p(""),[k,E]=p(!0),[a,F]=p(!0),L=K(""),l=w.value.data,d=(l==null?void 0:l.email)||"",v=R.value.data,c=b({LoginFormInvalidEmailError:"Checkout.LoginForm.invalidEmailError",LoginFormMissingEmailError:"Checkout.LoginForm.missingEmailError",LoginFormEmailExistsAlreadyHaveAccount:"Checkout.LoginForm.emailExists.alreadyHaveAccount",LoginFormEmailExistsSignInButton:"Checkout.LoginForm.emailExists.signInButton",LoginFormEmailExistsForFasterCheckout:"Checkout.LoginForm.emailExists.forFasterCheckout"}),A=r=>r.valid?"":r.valueMissing?c.LoginFormMissingEmailError:c.LoginFormInvalidEmailError,B=r=>N(r)?"":r===""?c.LoginFormMissingEmailError:c.LoginFormInvalidEmailError,M=r=>{const n=r.target;u(n.value),f(""),E(!0)},T=r=>{const n=r.target;f(B(n.value))},z=r=>{const n=r.target;f(A(n.validity))};C(()=>{!a||!l||(F(!1),u(l.email||""))},[l,a]),C(()=>{if(a||V.authenticated)return;const r=setTimeout(()=>{!N(o)||o===L.current||(L.current=o,j(o).then(n=>{E(n),d!==o&&q(o).catch(console.error)}).catch(n=>{console.error(n),E(!0)}))},re);return()=>{r&&clearTimeout(r)}},[d,o,a]);const I=k?"":s(P,{children:[c.LoginFormEmailExistsAlreadyHaveAccount," ",e("a",{href:"#",onClick:r=>{r.preventDefault(),t==null||t(o)},children:c.LoginFormEmailExistsSignInButton})," ",c.LoginFormEmailExistsForFasterCheckout]}),$=r=>{t==null||t(N(r)?r:"")},H=v?{firstName:v.firstName,lastName:v.lastName,email:v.email}:void 0;return e(Y,{...h,customerDetails:H,email:o,error:m,hint:I,loading:a,onEmailBlur:T,onEmailChange:M,onEmailInvalid:z,onSignInClick:$,onSignOutClick:i})};y.displayName="LoginFormContainer";const ve=O(y);export{ve as LoginForm,ve as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AlertBannerProps } from '@dropins/tools/types/elsie/src/components';
|
|
2
|
-
import {
|
|
2
|
+
import { Container } from '@dropins/tools/types/elsie/src/lib/types';
|
|
3
3
|
|
|
4
|
-
export declare const MergedCartBanner:
|
|
4
|
+
export declare const MergedCartBanner: Container<AlertBannerProps>;
|
|
5
5
|
//# sourceMappingURL=MergedCartBanner.d.ts.map
|