@clickaroo/checkout-ui 0.1.2-beta → 0.1.4-beta
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/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/storybook/storybook-static/assets/APIs.en-Bf5J1Ifk.js +372 -0
- package/dist/storybook/storybook-static/assets/APIs.en-CVdvOQs6.js +372 -0
- package/dist/storybook/storybook-static/assets/APIs.en-DSVQkUt3.js +372 -0
- package/dist/storybook/storybook-static/assets/APIs.en-m6cq4XTv.js +372 -0
- package/dist/storybook/storybook-static/assets/CheckoutPage-B959BwZO.js +3 -0
- package/dist/storybook/storybook-static/assets/CheckoutPage-BsnzMxJk.js +3 -0
- package/dist/storybook/storybook-static/assets/CheckoutPage-CrHN6Fcv.js +3 -0
- package/dist/storybook/storybook-static/assets/CheckoutPage-DYMMhAMX.js +3 -0
- package/dist/storybook/storybook-static/assets/CheckoutPage.en-BeknEgWZ.js +147 -0
- package/dist/storybook/storybook-static/assets/CheckoutPage.en-C5I1UUQc.js +147 -0
- package/dist/storybook/storybook-static/assets/CheckoutPage.en-DiHMI_iH.js +147 -0
- package/dist/storybook/storybook-static/assets/CheckoutPage.en-wyirg_zl.js +147 -0
- package/dist/storybook/storybook-static/assets/CheckoutPage.stories-BFpky7Cv.js +44 -0
- package/dist/storybook/storybook-static/assets/CheckoutPage.stories-DAo0u2QI.js +44 -0
- package/dist/storybook/storybook-static/assets/CheckoutPage.stories-DLD3oWo_.js +44 -0
- package/dist/storybook/storybook-static/assets/CheckoutPage.stories-DeC6lyzr.js +44 -0
- package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-1Ar-cfOi.js +1 -0
- package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-B_hoSOu5.js +1 -0
- package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-Bly_OAJP.js +1 -0
- package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-DI94E3AI.js +1 -0
- package/dist/storybook/storybook-static/assets/CustomCheckout.en-2QJPlCmg.js +211 -0
- package/dist/storybook/storybook-static/assets/CustomCheckout.en-Bg4oz9hS.js +211 -0
- package/dist/storybook/storybook-static/assets/CustomCheckout.en-CckpRGsp.js +211 -0
- package/dist/storybook/storybook-static/assets/CustomCheckout.en-D80ZpldF.js +211 -0
- package/dist/storybook/storybook-static/assets/CustomCheckout.stories-CKQKzMq0.js +6 -0
- package/dist/storybook/storybook-static/assets/CustomCheckout.stories-Cmt6r_Qb.js +6 -0
- package/dist/storybook/storybook-static/assets/CustomCheckout.stories-F2GZKkIG.js +6 -0
- package/dist/storybook/storybook-static/assets/CustomCheckout.stories-V2NHLbZo.js +6 -0
- package/dist/storybook/storybook-static/assets/CustomerInfo-CTx1dFS3.js +1 -0
- package/dist/storybook/storybook-static/assets/CustomerInfo-CdeZHMcz.js +1 -0
- package/dist/storybook/storybook-static/assets/CustomerInfo-Cp0u57C5.js +1 -0
- package/dist/storybook/storybook-static/assets/CustomerInfo-D3WHpN32.js +1 -0
- package/dist/storybook/storybook-static/assets/CustomerInfo.stories-BeF8Yh1A.js +9 -0
- package/dist/storybook/storybook-static/assets/CustomerInfo.stories-CYx1hKNg.js +9 -0
- package/dist/storybook/storybook-static/assets/CustomerInfo.stories-DB2C3zqQ.js +9 -0
- package/dist/storybook/storybook-static/assets/CustomerInfo.stories-DJEbX7ej.js +9 -0
- package/dist/storybook/storybook-static/assets/DeliveryAddress-CD42v0od.js +2 -0
- package/dist/storybook/storybook-static/assets/DeliveryAddress-Lfanl1PO.js +2 -0
- package/dist/storybook/storybook-static/assets/DeliveryAddress-X81XGbKD.js +2 -0
- package/dist/storybook/storybook-static/assets/DeliveryAddress-zAvEPauR.js +2 -0
- package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-B-CLgnl5.js +9 -0
- package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-BvAXTiNm.js +9 -0
- package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-CTyS3zFt.js +9 -0
- package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-DHyw5QNl.js +9 -0
- package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-4VFo0TRH.js +2 -0
- package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-BKek9MhZ.js +2 -0
- package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-Bb5akATV.js +2 -0
- package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-sE6BxCwu.js +2 -0
- package/dist/storybook/storybook-static/assets/Guide.en-BJ4qiYIc.js +107 -0
- package/dist/storybook/storybook-static/assets/Guide.en-CiR7CrYZ.js +107 -0
- package/dist/storybook/storybook-static/assets/Guide.en-DPJzC5RR.js +107 -0
- package/dist/storybook/storybook-static/assets/Guide.en-VxmWTbu0.js +107 -0
- package/dist/storybook/storybook-static/assets/PaymentMethods-BNEEARzu.js +2 -0
- package/dist/storybook/storybook-static/assets/PaymentMethods-BnPZRrAs.js +2 -0
- package/dist/storybook/storybook-static/assets/PaymentMethods-DOuQM2jZ.js +2 -0
- package/dist/storybook/storybook-static/assets/PaymentMethods-e9HqQtxN.js +2 -0
- package/dist/storybook/storybook-static/assets/PaymentMethods.stories-Bc4jYrum.js +9 -0
- package/dist/storybook/storybook-static/assets/PaymentMethods.stories-CELadurr.js +9 -0
- package/dist/storybook/storybook-static/assets/PaymentMethods.stories-ChiL9TJn.js +9 -0
- package/dist/storybook/storybook-static/assets/PaymentMethods.stories-pOuLDPwE.js +9 -0
- package/dist/storybook/storybook-static/assets/QuickStart.en-B2goyY4Q.js +136 -0
- package/dist/storybook/storybook-static/assets/QuickStart.en-Ct2dMZNT.js +136 -0
- package/dist/storybook/storybook-static/assets/QuickStart.en-D6K1vnx2.js +136 -0
- package/dist/storybook/storybook-static/assets/QuickStart.en-DEcB3LF7.js +136 -0
- package/dist/storybook/storybook-static/assets/ValidateInput-C6pnsZFe.js +2 -0
- package/dist/storybook/storybook-static/assets/ValidateInput-Cl2O4HCX.js +2 -0
- package/dist/storybook/storybook-static/assets/ValidateInput-DcnOO9py.js +2 -0
- package/dist/storybook/storybook-static/assets/ValidateInput-sZgX3GCF.js +2 -0
- package/dist/storybook/storybook-static/assets/entry-preview-Bnn64O7J.js +2 -0
- package/dist/storybook/storybook-static/assets/entry-preview-Dbi49YCK.js +2 -0
- package/dist/storybook/storybook-static/assets/entry-preview-DxIUzVUA.js +2 -0
- package/dist/storybook/storybook-static/assets/entry-preview-hHv11-z5.js +2 -0
- package/dist/storybook/storybook-static/assets/iframe-Ce3kgeV4.js +211 -0
- package/dist/storybook/storybook-static/assets/iframe-Ckasx_Sg.js +211 -0
- package/dist/storybook/storybook-static/assets/iframe-DsSsblW_.js +211 -0
- package/dist/storybook/storybook-static/assets/iframe-PThBYPHV.js +211 -0
- package/dist/storybook/storybook-static/assets/index-CZFGp9Su.js +575 -0
- package/dist/storybook/storybook-static/assets/index-CkNSuRJg.js +575 -0
- package/dist/storybook/storybook-static/assets/index-Cyd9I05m.js +575 -0
- package/dist/storybook/storybook-static/assets/index-LRKEu_dQ.js +575 -0
- package/dist/storybook/storybook-static/assets/preview-884UjfA3.js +2 -0
- package/dist/storybook/storybook-static/assets/preview-D2t1J3cT.js +2 -0
- package/dist/storybook/storybook-static/assets/preview-DNROAajq.js +2 -0
- package/dist/storybook/storybook-static/assets/preview-EmPtksy2.js +2 -0
- package/dist/storybook/storybook-static/assets/useCheckoutContext-B8tsk5b5.js +27 -0
- package/dist/storybook/storybook-static/assets/useCheckoutContext-C6u4Rp5U.js +27 -0
- package/dist/storybook/storybook-static/assets/useCheckoutContext-Cyg-MLQs.js +27 -0
- package/dist/storybook/storybook-static/assets/useCheckoutContext-DuJ1Ep0-.js +27 -0
- package/dist/storybook/storybook-static/iframe.html +1 -1
- package/dist/storybook/storybook-static/project.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import{j as e}from"./jsx-runtime-DiklIkkE.js";import{useMDXComponents as s}from"./index-ChEI-nsM.js";import{M as r,C as i}from"./index-CZFGp9Su.js";import{C as d,D as c}from"./CustomCheckout.stories-F2GZKkIG.js";import"./index-DRjF_FHU.js";import"./iframe-PThBYPHV.js";import"./index-B7ki2Uzk.js";import"./index-D-Mha1DF.js";import"./index-DrFu-skq.js";import"./useCheckoutContext-DuJ1Ep0-.js";/* empty css */import"./CheckoutPage-CrHN6Fcv.js";import"./CustomerInfo-D3WHpN32.js";import"./ValidateInput-DcnOO9py.js";import"./DeliveryAddress-Lfanl1PO.js";import"./PaymentMethods-e9HqQtxN.js";function o(t){const n={a:"a",code:"code",h1:"h1",h3:"h3",h4:"h4",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...s(),...t.components};return e.jsxs(e.Fragment,{children:[e.jsx(r,{of:d,title:"Components/CustomCheckout",name:"CustomCheckout (English)"}),`
|
|
2
|
+
`,e.jsx(n.h1,{id:"customcheckout",children:"CustomCheckout"}),`
|
|
3
|
+
`,e.jsxs(n.p,{children:["While the ",e.jsx(n.code,{children:"CheckoutPage"})," component provides a complete, ready-to-use checkout solution, you may need more control over the layout, styling, or user experience. This guide explains how to build a completely custom checkout flow by using the library's hooks and context, while still leveraging the core functionality."]}),`
|
|
4
|
+
`,e.jsxs(n.p,{children:["The example above demonstrates a fully customized checkout page with custom styling, where we use the library's ",e.jsx(n.code,{children:"PaymentMethods"})," component (which is required) and build custom components for customer information, delivery address, and the submit button."]}),`
|
|
5
|
+
`,e.jsx(i,{of:c}),`
|
|
6
|
+
`,e.jsx(n.h3,{id:"overview",children:"Overview"}),`
|
|
7
|
+
`,e.jsx(n.p,{children:"When building a custom checkout flow, you'll need to:"}),`
|
|
8
|
+
`,e.jsxs(n.ol,{children:[`
|
|
9
|
+
`,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Wrap your components"})," in ",e.jsx(n.code,{children:"CheckoutProvider"})," to access the checkout context"]}),`
|
|
10
|
+
`,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Use hooks"})," (",e.jsx(n.code,{children:"useCheckoutContext"}),", ",e.jsx(n.code,{children:"useOrderSubmission"}),") to access and update form data"]}),`
|
|
11
|
+
`,e.jsxs(n.li,{children:[e.jsxs(n.strong,{children:["Use the ",e.jsx(n.code,{children:"PaymentMethods"})," component"]})," from the library (required - cannot be customized)"]}),`
|
|
12
|
+
`,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Update form data"})," through ",e.jsx(n.code,{children:"updateCustomerInfo"})," and ",e.jsx(n.code,{children:"updateDeliveryAddress"})," methods"]}),`
|
|
13
|
+
`,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Submit orders"})," using the ",e.jsx(n.code,{children:"useOrderSubmission"})," hook"]}),`
|
|
14
|
+
`]}),`
|
|
15
|
+
`,e.jsx(n.h3,{id:"understanding-form-data-structure",children:"Understanding Form Data Structure"}),`
|
|
16
|
+
`,e.jsxs(n.p,{children:["When customizing components, you need to ensure all required fields are updated correctly. The library uses two main data structures: ",e.jsx(n.code,{children:"CustomerInfo"})," and ",e.jsx(n.code,{children:"DeliveryAddress"}),". Understanding these structures is crucial for building custom components that work seamlessly with the checkout flow."]}),`
|
|
17
|
+
`,e.jsx(n.h4,{id:"customerinfo-fields",children:"CustomerInfo Fields"}),`
|
|
18
|
+
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`interface CustomerInfo {
|
|
19
|
+
firstName: string; // First name (required)
|
|
20
|
+
lastName: string; // Last name (required)
|
|
21
|
+
email: string; // Email (required, must be valid email format)
|
|
22
|
+
phone: string; // Phone (required, E.164 format)
|
|
23
|
+
}
|
|
24
|
+
`})}),`
|
|
25
|
+
`,e.jsx(n.h4,{id:"deliveryaddress-fields",children:"DeliveryAddress Fields"}),`
|
|
26
|
+
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`interface DeliveryAddress {
|
|
27
|
+
country: string; // Country (required)
|
|
28
|
+
address: string; // Street address (required)
|
|
29
|
+
address2?: string; // Address line 2 (optional)
|
|
30
|
+
city: string; // City (required)
|
|
31
|
+
state: string; // State/Province (required)
|
|
32
|
+
zipCode: string; // Postal code (required)
|
|
33
|
+
}
|
|
34
|
+
`})}),`
|
|
35
|
+
`,e.jsxs(n.p,{children:[e.jsx(n.strong,{children:"Important:"})," When customizing components, you must update all required fields through ",e.jsx(n.code,{children:"updateCustomerInfo"})," and ",e.jsx(n.code,{children:"updateDeliveryAddress"}),"."]}),`
|
|
36
|
+
`,e.jsx(n.h3,{id:"using-checkoutprovider",children:"Using CheckoutProvider"}),`
|
|
37
|
+
`,e.jsxs(n.p,{children:["The ",e.jsx(n.code,{children:"CheckoutProvider"})," is the foundation of any custom checkout flow. It provides the context and state management needed for all checkout-related functionality. All your custom components must be wrapped within ",e.jsx(n.code,{children:"CheckoutProvider"}),"."]}),`
|
|
38
|
+
`,e.jsxs(n.p,{children:["The ",e.jsx(n.code,{children:"CheckoutProvider"})," props are identical to ",e.jsx(n.code,{children:"CheckoutPage"}),", supporting the following:"]}),`
|
|
39
|
+
`,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Required Props:"})}),`
|
|
40
|
+
`,e.jsxs(n.ul,{children:[`
|
|
41
|
+
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"cart: CartItem[]"})," - Array of cart items. Each item must include ",e.jsx(n.code,{children:"sku"})," and ",e.jsx(n.code,{children:"offerPricePoint"}),". ",e.jsx(n.strong,{children:"Note:"})," Even for a single product, pass it as an array with one item."]}),`
|
|
42
|
+
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"children: ReactNode"})," - Child components to be wrapped"]}),`
|
|
43
|
+
`]}),`
|
|
44
|
+
`,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Optional Props:"})}),`
|
|
45
|
+
`,e.jsxs(n.ul,{children:[`
|
|
46
|
+
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onCheckoutInit?: () => void"})," - Callback function triggered when checkout initializes (immediately after component mount)"]}),`
|
|
47
|
+
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"googleApiKey?: string"})," - Google Places API Key for enabling address autocomplete functionality"]}),`
|
|
48
|
+
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onPaymentInfoComplete?: (products: CheckoutCartItem[], totalAmount: number) => void"})," - Callback triggered when payment information is complete"]}),`
|
|
49
|
+
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onOrderSubmit?: (products: CheckoutCartItem[], totalAmount: number) => void"})," - Callback triggered when order is submitted"]}),`
|
|
50
|
+
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onOrderSuccess?: (orderCode: string, tradeCode?: string) => void"})," - Callback triggered when order succeeds"]}),`
|
|
51
|
+
`]}),`
|
|
52
|
+
`,e.jsxs(n.p,{children:["For detailed parameter descriptions, see ",e.jsx(n.a,{href:"./?path=/docs/documentation-usage-guide-checkoutpage--docs",children:"CheckoutPage Documentation"}),"."]}),`
|
|
53
|
+
`,e.jsx(n.h3,{id:"building-custom-components",children:"Building Custom Components"}),`
|
|
54
|
+
`,e.jsx(n.p,{children:"Now let's see how to build custom components step by step. Each component uses hooks to access and update the checkout state."}),`
|
|
55
|
+
`,e.jsx(n.h4,{id:"custom-customer-info-component",children:"Custom Customer Info Component"}),`
|
|
56
|
+
`,e.jsxs(n.p,{children:["Use the ",e.jsx(n.code,{children:"useCheckoutContext"})," hook to access ",e.jsx(n.code,{children:"customerInfo"})," and ",e.jsx(n.code,{children:"updateCustomerInfo"}),":"]}),`
|
|
57
|
+
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import { useCheckoutContext } from '@clickaroo/checkout-ui';
|
|
58
|
+
|
|
59
|
+
function CustomCustomerInfo() {
|
|
60
|
+
const { customerInfo, updateCustomerInfo } = useCheckoutContext();
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div>
|
|
64
|
+
<input
|
|
65
|
+
value={customerInfo.firstName}
|
|
66
|
+
onChange={(e) => updateCustomerInfo({ firstName: e.target.value })}
|
|
67
|
+
placeholder="First Name"
|
|
68
|
+
/>
|
|
69
|
+
<input
|
|
70
|
+
value={customerInfo.lastName}
|
|
71
|
+
onChange={(e) => updateCustomerInfo({ lastName: e.target.value })}
|
|
72
|
+
placeholder="Last Name"
|
|
73
|
+
/>
|
|
74
|
+
<input
|
|
75
|
+
type="email"
|
|
76
|
+
value={customerInfo.email}
|
|
77
|
+
onChange={(e) => updateCustomerInfo({ email: e.target.value })}
|
|
78
|
+
placeholder="Email"
|
|
79
|
+
/>
|
|
80
|
+
<input
|
|
81
|
+
type="tel"
|
|
82
|
+
value={customerInfo.phone}
|
|
83
|
+
onChange={(e) => updateCustomerInfo({ phone: e.target.value })}
|
|
84
|
+
placeholder="Phone"
|
|
85
|
+
/>
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
`})}),`
|
|
90
|
+
`,e.jsx(n.h4,{id:"custom-delivery-address-component",children:"Custom Delivery Address Component"}),`
|
|
91
|
+
`,e.jsxs(n.p,{children:["Similarly, use ",e.jsx(n.code,{children:"updateDeliveryAddress"})," to update address information:"]}),`
|
|
92
|
+
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import { useCheckoutContext } from '@clickaroo/checkout-ui';
|
|
93
|
+
|
|
94
|
+
function CustomDeliveryAddress() {
|
|
95
|
+
const { deliveryAddress, updateDeliveryAddress } = useCheckoutContext();
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<div>
|
|
99
|
+
<input
|
|
100
|
+
value={deliveryAddress.country || ''}
|
|
101
|
+
onChange={(e) => updateDeliveryAddress({ country: e.target.value })}
|
|
102
|
+
placeholder="Country"
|
|
103
|
+
/>
|
|
104
|
+
<input
|
|
105
|
+
value={deliveryAddress.address || ''}
|
|
106
|
+
onChange={(e) => updateDeliveryAddress({ address: e.target.value })}
|
|
107
|
+
placeholder="Street Address"
|
|
108
|
+
/>
|
|
109
|
+
<input
|
|
110
|
+
value={deliveryAddress.city || ''}
|
|
111
|
+
onChange={(e) => updateDeliveryAddress({ city: e.target.value })}
|
|
112
|
+
placeholder="City"
|
|
113
|
+
/>
|
|
114
|
+
<input
|
|
115
|
+
value={deliveryAddress.state || ''}
|
|
116
|
+
onChange={(e) => updateDeliveryAddress({ state: e.target.value })}
|
|
117
|
+
placeholder="State/Province"
|
|
118
|
+
/>
|
|
119
|
+
<input
|
|
120
|
+
value={deliveryAddress.zipCode || ''}
|
|
121
|
+
onChange={(e) => updateDeliveryAddress({ zipCode: e.target.value })}
|
|
122
|
+
placeholder="ZIP Code"
|
|
123
|
+
/>
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
`})}),`
|
|
128
|
+
`,e.jsx(n.h4,{id:"custom-submit-button-component",children:"Custom Submit Button Component"}),`
|
|
129
|
+
`,e.jsxs(n.p,{children:["Use ",e.jsx(n.code,{children:"useOrderSubmission"})," hook to handle order submission and ",e.jsx(n.code,{children:"isFormValid()"})," to check form validity:"]}),`
|
|
130
|
+
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import { useCheckoutContext, useOrderSubmission } from '@clickaroo/checkout-ui';
|
|
131
|
+
|
|
132
|
+
function CustomSubmitButton() {
|
|
133
|
+
const { isFormValid } = useCheckoutContext();
|
|
134
|
+
const { isSubmitting, submitOrder } = useOrderSubmission();
|
|
135
|
+
|
|
136
|
+
const handleSubmit = async () => {
|
|
137
|
+
// Always check form validity before submitting
|
|
138
|
+
if (!isFormValid()) {
|
|
139
|
+
alert('Please complete all required fields');
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const result = await submitOrder();
|
|
144
|
+
|
|
145
|
+
if (result.success) {
|
|
146
|
+
console.log('Order successful', result.orderCode);
|
|
147
|
+
// Handle success (e.g., redirect to success page)
|
|
148
|
+
} else {
|
|
149
|
+
console.error('Order failed', result.message);
|
|
150
|
+
// Handle error (e.g., show error message)
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
<button
|
|
156
|
+
onClick={handleSubmit}
|
|
157
|
+
disabled={!isFormValid() || isSubmitting}
|
|
158
|
+
>
|
|
159
|
+
{isSubmitting ? 'Processing...' : 'Complete Order'}
|
|
160
|
+
</button>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
`})}),`
|
|
164
|
+
`,e.jsx(n.h3,{id:"complete-example",children:"Complete Example"}),`
|
|
165
|
+
`,e.jsx(n.p,{children:"Here's a complete example putting it all together:"}),`
|
|
166
|
+
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import {
|
|
167
|
+
CheckoutProvider,
|
|
168
|
+
PaymentMethods,
|
|
169
|
+
useCheckoutContext,
|
|
170
|
+
useOrderSubmission
|
|
171
|
+
} from '@clickaroo/checkout-ui';
|
|
172
|
+
|
|
173
|
+
// ... (include the custom components above)
|
|
174
|
+
|
|
175
|
+
function CustomCheckoutPage() {
|
|
176
|
+
const cart = [
|
|
177
|
+
{
|
|
178
|
+
sku: "TEST001",
|
|
179
|
+
offerPricePoint: "OPP-XXX",
|
|
180
|
+
title: "Product 1",
|
|
181
|
+
price: 99.99,
|
|
182
|
+
},
|
|
183
|
+
];
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<CheckoutProvider
|
|
187
|
+
cart={cart}
|
|
188
|
+
googleApiKey="YOUR_GOOGLE_API_KEY"
|
|
189
|
+
onCheckoutInit={() => {
|
|
190
|
+
console.log('Checkout initialized');
|
|
191
|
+
}}
|
|
192
|
+
onPaymentInfoComplete={(products, totalAmount) => {
|
|
193
|
+
console.log('Payment info complete', products, totalAmount);
|
|
194
|
+
}}
|
|
195
|
+
onOrderSubmit={(products, totalAmount) => {
|
|
196
|
+
console.log('Order submitted', products, totalAmount);
|
|
197
|
+
}}
|
|
198
|
+
onOrderSuccess={(orderCode, tradeCode) => {
|
|
199
|
+
console.log('Order successful', orderCode, tradeCode);
|
|
200
|
+
}}
|
|
201
|
+
>
|
|
202
|
+
<CustomCustomerInfo />
|
|
203
|
+
<CustomDeliveryAddress />
|
|
204
|
+
{/* PaymentMethods is required - cannot be customized */}
|
|
205
|
+
<PaymentMethods />
|
|
206
|
+
<CustomSubmitButton />
|
|
207
|
+
</CheckoutProvider>
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
`})}),`
|
|
211
|
+
`,e.jsxs(n.p,{children:[e.jsx(n.strong,{children:"Key Point:"})," All components must be wrapped in ",e.jsx(n.code,{children:"CheckoutProvider"})]})]})}function A(t={}){const{wrapper:n}={...s(),...t.components};return n?e.jsx(n,{...t,children:e.jsx(o,{...t})}):o(t)}export{A as default};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{j as o}from"./jsx-runtime-DiklIkkE.js";import{C as x,S as h,u as m,a as y,c as C,D as v}from"./useCheckoutContext-B8tsk5b5.js";/* empty css */import{u as S}from"./CheckoutPage-BsnzMxJk.js";import"./CustomerInfo-CTx1dFS3.js";import"./DeliveryAddress-X81XGbKD.js";import{P as j}from"./PaymentMethods-BNEEARzu.js";import{R as w}from"./index-DRjF_FHU.js";C(v);function z(){const{customerInfo:a,updateCustomerInfo:i}=m(),[e,s]=w.useState({}),t=(r,b)=>{const c=y.safeParse({...a,[r]:b});if(c.success)s(d=>{const l={...d};return delete l[r],l});else{const d=c.error.issues.find(l=>l.path.includes(r));s(d?l=>({...l,[r]:d.message}):l=>{const u={...l};return delete u[r],u})}};return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#9333ea"},children:"✨ Custom Customer Form ✨"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #faf5ff, #fdf2f8)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #e9d5ff",overflow:"hidden"},children:o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 First Name"}),o.jsx("input",{type:"text",value:a.firstName,onChange:r=>{i({firstName:r.target.value}),t("firstName",r.target.value)},onBlur:r=>{t("firstName",r.target.value),r.target.style.borderColor=e.firstName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.firstName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.firstName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter first name"}),e.firstName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.firstName})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 Last Name"}),o.jsx("input",{type:"text",value:a.lastName,onChange:r=>{i({lastName:r.target.value}),t("lastName",r.target.value)},onBlur:r=>{t("lastName",r.target.value),r.target.style.borderColor=e.lastName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.lastName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.lastName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter last name"}),e.lastName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.lastName})]})]}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📧 Email"}),o.jsx("input",{type:"email",value:a.email,onChange:r=>{i({email:r.target.value}),t("email",r.target.value)},onBlur:r=>{t("email",r.target.value),r.target.style.borderColor=e.email?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.email?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.email?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"your@email.com"}),e.email&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.email})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📱 Phone"}),o.jsx("input",{type:"tel",value:a.phone,onChange:r=>{i({phone:r.target.value}),t("phone",r.target.value)},onBlur:r=>{t("phone",r.target.value),r.target.style.borderColor=e.phone?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.phone?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.phone?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"+1 234 567 8900"}),e.phone&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.phone})]})]})]})})]})}function k(){const{deliveryAddress:a,updateDeliveryAddress:i}=m();return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#2563eb"},children:"📍 Custom Delivery Address"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #eff6ff, #ecfeff)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #bfdbfe",overflow:"hidden"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🌍 Country"}),o.jsx("input",{type:"text",value:a.country,onChange:e=>i({country:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter country"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🏠 Street Address"}),o.jsx("input",{type:"text",value:a.address,onChange:e=>i({address:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter street address"})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🏙️ City"}),o.jsx("input",{type:"text",value:a.city,onChange:e=>i({city:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter city"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🗺️ State/Province"}),o.jsx("input",{type:"text",value:a.state,onChange:e=>i({state:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter state"})]})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"📮 Zip Code"}),o.jsx("input",{type:"text",value:a.zipCode,onChange:e=>i({zipCode:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter zip code"})]})]})})]})}function N(){const{isFormValid:a}=m(),{isSubmitting:i,submitOrder:e}=S(),s=async()=>{if(!a()){alert("Please complete all required fields");return}const r=await e();r.success?alert(`Order successful! Order Code: ${r.orderCode}`):alert(r.message)},t=a()&&!i;return o.jsxs("div",{style:{marginTop:"1.5rem"},children:[o.jsx("button",{onClick:s,disabled:!t,style:{width:"100%",padding:"1rem 1.5rem",borderRadius:"0.75rem",fontWeight:"bold",fontSize:"1.125rem",background:t?"linear-gradient(to right, #9333ea, #db2777)":"#9ca3af",color:t?"white":"#374151",cursor:t?"pointer":"not-allowed",border:"none",boxShadow:t?"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)":"none",transition:"all 0.3s",transform:"scale(1)"},onMouseEnter:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #7e22ce, #be185d)",r.currentTarget.style.transform="scale(1.05)")},onMouseLeave:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #9333ea, #db2777)",r.currentTarget.style.transform="scale(1)")},onMouseDown:r=>{t&&(r.currentTarget.style.transform="scale(0.95)")},onMouseUp:r=>{t&&(r.currentTarget.style.transform="scale(1.05)")},children:i?o.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"},children:[o.jsxs("svg",{style:{animation:"spin 1s linear infinite",height:"1.25rem",width:"1.25rem"},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{style:{opacity:.25},cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{style:{opacity:.75},fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Processing..."]}):"🎉 Complete Order"}),o.jsx("style",{children:`
|
|
2
|
+
@keyframes spin {
|
|
3
|
+
from { transform: rotate(0deg); }
|
|
4
|
+
to { transform: rotate(360deg); }
|
|
5
|
+
}
|
|
6
|
+
`})]})}function E(){const a=[{sku:"TEST001",offerPricePoint:h.SINGLE,title:"Product Title",price:99.99}];return o.jsx(x,{cart:a,children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.5rem",maxWidth:"42rem",margin:"0 auto",padding:"1rem",width:"100%",boxSizing:"border-box"},children:[o.jsx(z,{}),o.jsx(k,{}),o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#059669"},children:"💳 Payment Methods"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #ecfdf5, #d1fae5)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #86efac",overflow:"hidden"},children:o.jsx(j,{showText:!1})})]}),o.jsx(N,{})]})})}const R={component:E,title:"Components/CustomCheckout",parameters:{layout:"padded",docs:{description:{component:"Example of mixing library components with custom components. Demonstrates how to combine library components like CustomerInfo, DeliveryAddress, and PaymentMethods with custom components for a fully customized checkout experience."}}}},n={};var g,p,f;n.parameters={...n.parameters,docs:{...(g=n.parameters)==null?void 0:g.docs,source:{originalSource:"{}",...(f=(p=n.parameters)==null?void 0:p.docs)==null?void 0:f.source}}};const T=["Default"],M=Object.freeze(Object.defineProperty({__proto__:null,Default:n,__namedExportsOrder:T,default:R},Symbol.toStringTag,{value:"Module"}));export{M as C,n as D};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{j as o}from"./jsx-runtime-DiklIkkE.js";import{C as x,S as h,u as m,a as y,c as C,D as v}from"./useCheckoutContext-Cyg-MLQs.js";/* empty css */import{u as S}from"./CheckoutPage-B959BwZO.js";import"./CustomerInfo-CdeZHMcz.js";import"./DeliveryAddress-zAvEPauR.js";import{P as j}from"./PaymentMethods-DOuQM2jZ.js";import{R as w}from"./index-DRjF_FHU.js";C(v);function z(){const{customerInfo:a,updateCustomerInfo:i}=m(),[e,s]=w.useState({}),t=(r,b)=>{const c=y.safeParse({...a,[r]:b});if(c.success)s(d=>{const l={...d};return delete l[r],l});else{const d=c.error.issues.find(l=>l.path.includes(r));s(d?l=>({...l,[r]:d.message}):l=>{const u={...l};return delete u[r],u})}};return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#9333ea"},children:"✨ Custom Customer Form ✨"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #faf5ff, #fdf2f8)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #e9d5ff",overflow:"hidden"},children:o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 First Name"}),o.jsx("input",{type:"text",value:a.firstName,onChange:r=>{i({firstName:r.target.value}),t("firstName",r.target.value)},onBlur:r=>{t("firstName",r.target.value),r.target.style.borderColor=e.firstName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.firstName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.firstName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter first name"}),e.firstName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.firstName})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 Last Name"}),o.jsx("input",{type:"text",value:a.lastName,onChange:r=>{i({lastName:r.target.value}),t("lastName",r.target.value)},onBlur:r=>{t("lastName",r.target.value),r.target.style.borderColor=e.lastName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.lastName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.lastName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter last name"}),e.lastName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.lastName})]})]}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📧 Email"}),o.jsx("input",{type:"email",value:a.email,onChange:r=>{i({email:r.target.value}),t("email",r.target.value)},onBlur:r=>{t("email",r.target.value),r.target.style.borderColor=e.email?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.email?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.email?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"your@email.com"}),e.email&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.email})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📱 Phone"}),o.jsx("input",{type:"tel",value:a.phone,onChange:r=>{i({phone:r.target.value}),t("phone",r.target.value)},onBlur:r=>{t("phone",r.target.value),r.target.style.borderColor=e.phone?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.phone?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.phone?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"+1 234 567 8900"}),e.phone&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.phone})]})]})]})})]})}function k(){const{deliveryAddress:a,updateDeliveryAddress:i}=m();return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#2563eb"},children:"📍 Custom Delivery Address"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #eff6ff, #ecfeff)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #bfdbfe",overflow:"hidden"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🌍 Country"}),o.jsx("input",{type:"text",value:a.country,onChange:e=>i({country:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter country"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🏠 Street Address"}),o.jsx("input",{type:"text",value:a.address,onChange:e=>i({address:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter street address"})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🏙️ City"}),o.jsx("input",{type:"text",value:a.city,onChange:e=>i({city:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter city"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🗺️ State/Province"}),o.jsx("input",{type:"text",value:a.state,onChange:e=>i({state:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter state"})]})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"📮 Zip Code"}),o.jsx("input",{type:"text",value:a.zipCode,onChange:e=>i({zipCode:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter zip code"})]})]})})]})}function N(){const{isFormValid:a}=m(),{isSubmitting:i,submitOrder:e}=S(),s=async()=>{if(!a()){alert("Please complete all required fields");return}const r=await e();r.success?alert(`Order successful! Order Code: ${r.orderCode}`):alert(r.message)},t=a()&&!i;return o.jsxs("div",{style:{marginTop:"1.5rem"},children:[o.jsx("button",{onClick:s,disabled:!t,style:{width:"100%",padding:"1rem 1.5rem",borderRadius:"0.75rem",fontWeight:"bold",fontSize:"1.125rem",background:t?"linear-gradient(to right, #9333ea, #db2777)":"#9ca3af",color:t?"white":"#374151",cursor:t?"pointer":"not-allowed",border:"none",boxShadow:t?"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)":"none",transition:"all 0.3s",transform:"scale(1)"},onMouseEnter:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #7e22ce, #be185d)",r.currentTarget.style.transform="scale(1.05)")},onMouseLeave:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #9333ea, #db2777)",r.currentTarget.style.transform="scale(1)")},onMouseDown:r=>{t&&(r.currentTarget.style.transform="scale(0.95)")},onMouseUp:r=>{t&&(r.currentTarget.style.transform="scale(1.05)")},children:i?o.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"},children:[o.jsxs("svg",{style:{animation:"spin 1s linear infinite",height:"1.25rem",width:"1.25rem"},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{style:{opacity:.25},cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{style:{opacity:.75},fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Processing..."]}):"🎉 Complete Order"}),o.jsx("style",{children:`
|
|
2
|
+
@keyframes spin {
|
|
3
|
+
from { transform: rotate(0deg); }
|
|
4
|
+
to { transform: rotate(360deg); }
|
|
5
|
+
}
|
|
6
|
+
`})]})}function E(){const a=[{sku:"TEST001",offerPricePoint:h.SINGLE,title:"Product Title",price:99.99}];return o.jsx(x,{cart:a,children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.5rem",maxWidth:"42rem",margin:"0 auto",padding:"1rem",width:"100%",boxSizing:"border-box"},children:[o.jsx(z,{}),o.jsx(k,{}),o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#059669"},children:"💳 Payment Methods"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #ecfdf5, #d1fae5)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #86efac",overflow:"hidden"},children:o.jsx(j,{showText:!1})})]}),o.jsx(N,{})]})})}const R={component:E,title:"Components/CustomCheckout",parameters:{layout:"padded",docs:{description:{component:"Example of mixing library components with custom components. Demonstrates how to combine library components like CustomerInfo, DeliveryAddress, and PaymentMethods with custom components for a fully customized checkout experience."}}}},n={};var g,p,f;n.parameters={...n.parameters,docs:{...(g=n.parameters)==null?void 0:g.docs,source:{originalSource:"{}",...(f=(p=n.parameters)==null?void 0:p.docs)==null?void 0:f.source}}};const T=["Default"],M=Object.freeze(Object.defineProperty({__proto__:null,Default:n,__namedExportsOrder:T,default:R},Symbol.toStringTag,{value:"Module"}));export{M as C,n as D};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{j as o}from"./jsx-runtime-DiklIkkE.js";import{C as x,S as h,u as m,a as y,c as C,D as v}from"./useCheckoutContext-DuJ1Ep0-.js";/* empty css */import{u as S}from"./CheckoutPage-CrHN6Fcv.js";import"./CustomerInfo-D3WHpN32.js";import"./DeliveryAddress-Lfanl1PO.js";import{P as j}from"./PaymentMethods-e9HqQtxN.js";import{R as w}from"./index-DRjF_FHU.js";C(v);function z(){const{customerInfo:a,updateCustomerInfo:i}=m(),[e,s]=w.useState({}),t=(r,b)=>{const c=y.safeParse({...a,[r]:b});if(c.success)s(d=>{const l={...d};return delete l[r],l});else{const d=c.error.issues.find(l=>l.path.includes(r));s(d?l=>({...l,[r]:d.message}):l=>{const u={...l};return delete u[r],u})}};return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#9333ea"},children:"✨ Custom Customer Form ✨"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #faf5ff, #fdf2f8)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #e9d5ff",overflow:"hidden"},children:o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 First Name"}),o.jsx("input",{type:"text",value:a.firstName,onChange:r=>{i({firstName:r.target.value}),t("firstName",r.target.value)},onBlur:r=>{t("firstName",r.target.value),r.target.style.borderColor=e.firstName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.firstName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.firstName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter first name"}),e.firstName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.firstName})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 Last Name"}),o.jsx("input",{type:"text",value:a.lastName,onChange:r=>{i({lastName:r.target.value}),t("lastName",r.target.value)},onBlur:r=>{t("lastName",r.target.value),r.target.style.borderColor=e.lastName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.lastName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.lastName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter last name"}),e.lastName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.lastName})]})]}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📧 Email"}),o.jsx("input",{type:"email",value:a.email,onChange:r=>{i({email:r.target.value}),t("email",r.target.value)},onBlur:r=>{t("email",r.target.value),r.target.style.borderColor=e.email?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.email?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.email?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"your@email.com"}),e.email&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.email})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📱 Phone"}),o.jsx("input",{type:"tel",value:a.phone,onChange:r=>{i({phone:r.target.value}),t("phone",r.target.value)},onBlur:r=>{t("phone",r.target.value),r.target.style.borderColor=e.phone?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.phone?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.phone?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"+1 234 567 8900"}),e.phone&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.phone})]})]})]})})]})}function k(){const{deliveryAddress:a,updateDeliveryAddress:i}=m();return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#2563eb"},children:"📍 Custom Delivery Address"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #eff6ff, #ecfeff)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #bfdbfe",overflow:"hidden"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🌍 Country"}),o.jsx("input",{type:"text",value:a.country,onChange:e=>i({country:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter country"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🏠 Street Address"}),o.jsx("input",{type:"text",value:a.address,onChange:e=>i({address:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter street address"})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🏙️ City"}),o.jsx("input",{type:"text",value:a.city,onChange:e=>i({city:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter city"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🗺️ State/Province"}),o.jsx("input",{type:"text",value:a.state,onChange:e=>i({state:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter state"})]})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"📮 Zip Code"}),o.jsx("input",{type:"text",value:a.zipCode,onChange:e=>i({zipCode:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter zip code"})]})]})})]})}function N(){const{isFormValid:a}=m(),{isSubmitting:i,submitOrder:e}=S(),s=async()=>{if(!a()){alert("Please complete all required fields");return}const r=await e();r.success?alert(`Order successful! Order Code: ${r.orderCode}`):alert(r.message)},t=a()&&!i;return o.jsxs("div",{style:{marginTop:"1.5rem"},children:[o.jsx("button",{onClick:s,disabled:!t,style:{width:"100%",padding:"1rem 1.5rem",borderRadius:"0.75rem",fontWeight:"bold",fontSize:"1.125rem",background:t?"linear-gradient(to right, #9333ea, #db2777)":"#9ca3af",color:t?"white":"#374151",cursor:t?"pointer":"not-allowed",border:"none",boxShadow:t?"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)":"none",transition:"all 0.3s",transform:"scale(1)"},onMouseEnter:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #7e22ce, #be185d)",r.currentTarget.style.transform="scale(1.05)")},onMouseLeave:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #9333ea, #db2777)",r.currentTarget.style.transform="scale(1)")},onMouseDown:r=>{t&&(r.currentTarget.style.transform="scale(0.95)")},onMouseUp:r=>{t&&(r.currentTarget.style.transform="scale(1.05)")},children:i?o.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"},children:[o.jsxs("svg",{style:{animation:"spin 1s linear infinite",height:"1.25rem",width:"1.25rem"},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{style:{opacity:.25},cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{style:{opacity:.75},fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Processing..."]}):"🎉 Complete Order"}),o.jsx("style",{children:`
|
|
2
|
+
@keyframes spin {
|
|
3
|
+
from { transform: rotate(0deg); }
|
|
4
|
+
to { transform: rotate(360deg); }
|
|
5
|
+
}
|
|
6
|
+
`})]})}function E(){const a=[{sku:"TEST001",offerPricePoint:h.SINGLE,title:"Product Title",price:99.99}];return o.jsx(x,{cart:a,children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.5rem",maxWidth:"42rem",margin:"0 auto",padding:"1rem",width:"100%",boxSizing:"border-box"},children:[o.jsx(z,{}),o.jsx(k,{}),o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#059669"},children:"💳 Payment Methods"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #ecfdf5, #d1fae5)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #86efac",overflow:"hidden"},children:o.jsx(j,{showText:!1})})]}),o.jsx(N,{})]})})}const R={component:E,title:"Components/CustomCheckout",parameters:{layout:"padded",docs:{description:{component:"Example of mixing library components with custom components. Demonstrates how to combine library components like CustomerInfo, DeliveryAddress, and PaymentMethods with custom components for a fully customized checkout experience."}}}},n={};var g,p,f;n.parameters={...n.parameters,docs:{...(g=n.parameters)==null?void 0:g.docs,source:{originalSource:"{}",...(f=(p=n.parameters)==null?void 0:p.docs)==null?void 0:f.source}}};const T=["Default"],M=Object.freeze(Object.defineProperty({__proto__:null,Default:n,__namedExportsOrder:T,default:R},Symbol.toStringTag,{value:"Module"}));export{M as C,n as D};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{j as o}from"./jsx-runtime-DiklIkkE.js";import{C as x,S as h,u as m,a as y,c as C,D as v}from"./useCheckoutContext-C6u4Rp5U.js";/* empty css */import{u as S}from"./CheckoutPage-DYMMhAMX.js";import"./CustomerInfo-Cp0u57C5.js";import"./DeliveryAddress-CD42v0od.js";import{P as j}from"./PaymentMethods-BnPZRrAs.js";import{R as w}from"./index-DRjF_FHU.js";C(v);function z(){const{customerInfo:a,updateCustomerInfo:i}=m(),[e,s]=w.useState({}),t=(r,b)=>{const c=y.safeParse({...a,[r]:b});if(c.success)s(d=>{const l={...d};return delete l[r],l});else{const d=c.error.issues.find(l=>l.path.includes(r));s(d?l=>({...l,[r]:d.message}):l=>{const u={...l};return delete u[r],u})}};return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#9333ea"},children:"✨ Custom Customer Form ✨"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #faf5ff, #fdf2f8)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #e9d5ff",overflow:"hidden"},children:o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 First Name"}),o.jsx("input",{type:"text",value:a.firstName,onChange:r=>{i({firstName:r.target.value}),t("firstName",r.target.value)},onBlur:r=>{t("firstName",r.target.value),r.target.style.borderColor=e.firstName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.firstName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.firstName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter first name"}),e.firstName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.firstName})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 Last Name"}),o.jsx("input",{type:"text",value:a.lastName,onChange:r=>{i({lastName:r.target.value}),t("lastName",r.target.value)},onBlur:r=>{t("lastName",r.target.value),r.target.style.borderColor=e.lastName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.lastName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.lastName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter last name"}),e.lastName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.lastName})]})]}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📧 Email"}),o.jsx("input",{type:"email",value:a.email,onChange:r=>{i({email:r.target.value}),t("email",r.target.value)},onBlur:r=>{t("email",r.target.value),r.target.style.borderColor=e.email?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.email?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.email?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"your@email.com"}),e.email&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.email})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📱 Phone"}),o.jsx("input",{type:"tel",value:a.phone,onChange:r=>{i({phone:r.target.value}),t("phone",r.target.value)},onBlur:r=>{t("phone",r.target.value),r.target.style.borderColor=e.phone?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.phone?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.phone?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"+1 234 567 8900"}),e.phone&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.phone})]})]})]})})]})}function k(){const{deliveryAddress:a,updateDeliveryAddress:i}=m();return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#2563eb"},children:"📍 Custom Delivery Address"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #eff6ff, #ecfeff)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #bfdbfe",overflow:"hidden"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🌍 Country"}),o.jsx("input",{type:"text",value:a.country,onChange:e=>i({country:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter country"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🏠 Street Address"}),o.jsx("input",{type:"text",value:a.address,onChange:e=>i({address:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter street address"})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🏙️ City"}),o.jsx("input",{type:"text",value:a.city,onChange:e=>i({city:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter city"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🗺️ State/Province"}),o.jsx("input",{type:"text",value:a.state,onChange:e=>i({state:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter state"})]})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"📮 Zip Code"}),o.jsx("input",{type:"text",value:a.zipCode,onChange:e=>i({zipCode:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter zip code"})]})]})})]})}function N(){const{isFormValid:a}=m(),{isSubmitting:i,submitOrder:e}=S(),s=async()=>{if(!a()){alert("Please complete all required fields");return}const r=await e();r.success?alert(`Order successful! Order Code: ${r.orderCode}`):alert(r.message)},t=a()&&!i;return o.jsxs("div",{style:{marginTop:"1.5rem"},children:[o.jsx("button",{onClick:s,disabled:!t,style:{width:"100%",padding:"1rem 1.5rem",borderRadius:"0.75rem",fontWeight:"bold",fontSize:"1.125rem",background:t?"linear-gradient(to right, #9333ea, #db2777)":"#9ca3af",color:t?"white":"#374151",cursor:t?"pointer":"not-allowed",border:"none",boxShadow:t?"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)":"none",transition:"all 0.3s",transform:"scale(1)"},onMouseEnter:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #7e22ce, #be185d)",r.currentTarget.style.transform="scale(1.05)")},onMouseLeave:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #9333ea, #db2777)",r.currentTarget.style.transform="scale(1)")},onMouseDown:r=>{t&&(r.currentTarget.style.transform="scale(0.95)")},onMouseUp:r=>{t&&(r.currentTarget.style.transform="scale(1.05)")},children:i?o.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"},children:[o.jsxs("svg",{style:{animation:"spin 1s linear infinite",height:"1.25rem",width:"1.25rem"},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{style:{opacity:.25},cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{style:{opacity:.75},fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Processing..."]}):"🎉 Complete Order"}),o.jsx("style",{children:`
|
|
2
|
+
@keyframes spin {
|
|
3
|
+
from { transform: rotate(0deg); }
|
|
4
|
+
to { transform: rotate(360deg); }
|
|
5
|
+
}
|
|
6
|
+
`})]})}function E(){const a=[{sku:"TEST001",offerPricePoint:h.SINGLE,title:"Product Title",price:99.99}];return o.jsx(x,{cart:a,children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.5rem",maxWidth:"42rem",margin:"0 auto",padding:"1rem",width:"100%",boxSizing:"border-box"},children:[o.jsx(z,{}),o.jsx(k,{}),o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#059669"},children:"💳 Payment Methods"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #ecfdf5, #d1fae5)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #86efac",overflow:"hidden"},children:o.jsx(j,{showText:!1})})]}),o.jsx(N,{})]})})}const R={component:E,title:"Components/CustomCheckout",parameters:{layout:"padded",docs:{description:{component:"Example of mixing library components with custom components. Demonstrates how to combine library components like CustomerInfo, DeliveryAddress, and PaymentMethods with custom components for a fully customized checkout experience."}}}},n={};var g,p,f;n.parameters={...n.parameters,docs:{...(g=n.parameters)==null?void 0:g.docs,source:{originalSource:"{}",...(f=(p=n.parameters)==null?void 0:p.docs)==null?void 0:f.source}}};const T=["Default"],M=Object.freeze(Object.defineProperty({__proto__:null,Default:n,__namedExportsOrder:T,default:R},Symbol.toStringTag,{value:"Module"}));export{M as C,n as D};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t}from"./jsx-runtime-DiklIkkE.js";import{F as u}from"./ValidateInput-Cl2O4HCX.js";import{f as p,z as L,v as z,h as k,b as j,a as w}from"./useCheckoutContext-B8tsk5b5.js";import{r as i}from"./index-DRjF_FHU.js";const S="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='1280'%20height='640'%20viewBox='0%200%2010080%205040'%3e%3cdefs%3e%3cclipPath%20id='c1'%3e%3cpath%20d='M0,0H6V3H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='c2'%3e%3cpath%20d='M0,0V1.5H6V3H6zM6,0H3V3H0V3z'/%3e%3c/clipPath%3e%3cpath%20id='Star7'%20d='M0,-360%2069.421398,-144.155019%20281.459334,-224.456329%20155.988466,-35.603349%20350.974048,80.107536%20125.093037,99.758368%20156.198146,324.348792%200,160%20-156.198146,324.348792%20-125.093037,99.758368%20-350.974048,80.107536%20-155.988466,-35.603349%20-281.459334,-224.456329%20-69.421398,-144.155019z'/%3e%3cpath%20id='Star5'%20d='M0,-210%2054.859957,-75.508253%20199.721868,-64.893569%2088.765275,28.841586%20123.434903,169.893569%200,93.333333%20-123.434903,169.893569%20-88.765275,28.841586%20-199.721868,-64.893569%20-54.859957,-75.508253z'/%3e%3c/defs%3e%3cg%20transform='scale(840)'%3e%3crect%20width='12'%20height='6'%20fill='%23012169'/%3e%3cpath%20d='M0,0%206,3M6,0%200,3'%20stroke='%23fff'%20stroke-width='0.6'%20clip-path='url(%23c1)'/%3e%3cpath%20d='M0,0%206,3M6,0%200,3'%20stroke='%23e4002b'%20stroke-width='0.4'%20clip-path='url(%23c2)'/%3e%3cpath%20d='M3,0V3M0,1.5H6'%20stroke='%23fff'/%3e%3cpath%20d='M3,0V3M0,1.5H6'%20stroke='%23e4002b'%20stroke-width='0.6'/%3e%3c/g%3e%3cg%20fill='%23fff'%3e%3cuse%20id='Comwlth'%20xlink:href='%23Star7'%20transform='translate(2520,%203780)%20scale(2.1)'/%3e%3cuse%20id='αCrucis'%20xlink:href='%23Star7'%20x='7560'%20y='4200'/%3e%3cuse%20id='βCrucis'%20xlink:href='%23Star7'%20x='6300'%20y='2205'/%3e%3cuse%20id='γCrucis'%20xlink:href='%23Star7'%20x='7560'%20y='840'/%3e%3cuse%20id='δCrucis'%20xlink:href='%23Star7'%20x='8680'%20y='1869'/%3e%3cuse%20id='εCrucis'%20xlink:href='%23Star5'%20x='8064'%20y='2730'/%3e%3c/g%3e%3c/svg%3e",_="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='1200'%20height='600'%20viewBox='0%200%209600%204800'%3e%3ctitle%3eFlag%20of%20Canada%20(Pantone%20colours)%3c/title%3e%3cpath%20fill='%23d52b1e'%20d='m0%200h2400l99%2099h4602l99-99h2400v4800h-2400l-99-99h-4602l-99%2099H0z'/%3e%3cpath%20fill='%23fff'%20d='m2400%200h4800v4800h-4800zm2490%204430-45-863a95%2095%200%200%201%20111-98l859%20151-116-320a65%2065%200%200%201%2020-73l941-762-212-99a65%2065%200%200%201-34-79l186-572-542%20115a65%2065%200%200%201-73-38l-105-247-423%20454a65%2065%200%200%201-111-57l204-1052-327%20189a65%2065%200%200%201-91-27l-332-652-332%20652a65%2065%200%200%201-91%2027l-327-189%20204%201052a65%2065%200%200%201-111%2057l-423-454-105%20247a65%2065%200%200%201-73%2038l-542-115%20186%20572a65%2065%200%200%201-34%2079l-212%2099%20941%20762a65%2065%200%200%201%2020%2073l-116%20320%20859-151a95%2095%200%200%201%20111%2098l-45%20863z'/%3e%3c/svg%3e",H="data:image/svg+xml,%3c?xml%20version='1.0'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2060%2030'%20width='1200'%20height='600'%3e%3cclipPath%20id='s'%3e%3cpath%20d='M0,0%20v30%20h60%20v-30%20z'/%3e%3c/clipPath%3e%3cclipPath%20id='t'%3e%3cpath%20d='M30,15%20h30%20v15%20z%20v15%20h-30%20z%20h-30%20v-15%20z%20v-15%20h30%20z'/%3e%3c/clipPath%3e%3cg%20clip-path='url(%23s)'%3e%3cpath%20d='M0,0%20v30%20h60%20v-30%20z'%20fill='%23012169'/%3e%3cpath%20d='M0,0%20L60,30%20M60,0%20L0,30'%20stroke='%23fff'%20stroke-width='6'/%3e%3cpath%20d='M0,0%20L60,30%20M60,0%20L0,30'%20clip-path='url(%23t)'%20stroke='%23C8102E'%20stroke-width='4'/%3e%3cpath%20d='M30,0%20v30%20M0,15%20h60'%20stroke='%23fff'%20stroke-width='10'/%3e%3cpath%20d='M30,0%20v30%20M0,15%20h60'%20stroke='%23C8102E'%20stroke-width='6'/%3e%3c/g%3e%3c/svg%3e",E="data:image/svg+xml,%3c?xml%20version='1.0'?%3e%3csvg%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20height='600'%20width='1200'%3e%3cdefs%3e%3cclipPath%20id='Canton'%3e%3cpath%20d='M%200,0%20L%20600,0%20L%20600,300%20L%200,300%20z'/%3e%3c/clipPath%3e%3cclipPath%20id='Diagonals'%3e%3cpath%20d='M%200,0%20L%20300,150%20L%200,150%20z%20M%20300,0%20L%20600,0%20L%20300,150%20z%20M%20300,150%20L%20600,150%20L%20600,300%20z%20M%20300,150%20L%20300,300%20L%200,300%20z'/%3e%3c/clipPath%3e%3cg%20id='Pentagram'%3e%3cg%20id='Arm'%20transform='translate(0,-0.324925)'%3e%3cpath%20d='M%200,0%20L%200,0.5%20L%201,0%20z'/%3e%3cpath%20d='M%200,0%20L%200,-0.5%20L%201,0%20z'%20transform='rotate(-36,1,0)'/%3e%3c/g%3e%3cuse%20xlink:href='%23Arm'%20transform='scale(-1,1)'/%3e%3cuse%20xlink:href='%23Arm'%20transform='rotate(72,0,0)'/%3e%3cuse%20xlink:href='%23Arm'%20transform='rotate(-72,0,0)'/%3e%3cuse%20xlink:href='%23Arm'%20transform='rotate(-72,0,0)%20scale(-1,1)'/%3e%3c/g%3e%3c/defs%3e%3crect%20fill='%23012169'%20x='0'%20y='0'%20width='1200'%20height='600'/%3e%3cg%20id='Flag_of_the_United_Kingdom'%3e%3cpath%20id='Saint_Andrews_Cross'%20stroke='%23FFF'%20d='M%200,0%20L%20600,300%20M%200,300%20L%20600,0'%20stroke-width='60'%20clip-path='url(%23Canton)'/%3e%3cpath%20id='Saint_Patricks_Cross'%20stroke='%23C8102E'%20d='M%200,0%20L%20600,300%20M%200,300%20L%20600,0'%20stroke-width='40'%20clip-path='url(%23Diagonals)'/%3e%3cg%20id='Saint_Georges_Cross'%3e%3cpath%20stroke='%23FFF'%20d='M%20300,0%20L%20300,300%20M%200,150%20L%20600,150'%20stroke-width='100'%20clip-path='url(%23Canton)'/%3e%3cpath%20stroke='%23C8102E'%20d='M%20300,0%20L%20300,300%20M%200,150%20L%20600,150'%20stroke-width='60'%20clip-path='url(%23Canton)'/%3e%3c/g%3e%3c/g%3e%3cg%20id='Southern_Cross'%3e%3cg%20id='Gamma_Crucis'%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23FFF'%20transform='translate(900,120)%20scale(45.4)'/%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23C8102E'%20transform='translate(900,120)%20scale(30)'/%3e%3c/g%3e%3cg%20transform='rotate(82,900,240)'%3e%3cg%20id='Delta_Crucis'%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23FFF'%20transform='translate(900,120)%20rotate(-82)%20scale(40.4)'/%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23C8102E'%20transform='translate(900,120)%20rotate(-82)%20scale(25)'/%3e%3c/g%3e%3cg%20id='Beta_Crucis'%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23FFF'%20transform='translate(900,380)%20rotate(-82)%20scale(45.4)'/%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23C8102E'%20transform='translate(900,380)%20rotate(-82)%20scale(30)'/%3e%3c/g%3e%3c/g%3e%3cg%20id='Alpha_Crucis'%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23FFF'%20transform='translate(900,480)%20scale(50.4)'/%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23C8102E'%20transform='translate(900,480)%20scale(35)'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",U="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='1235'%20height='650'%20viewBox='0%200%207410%203900'%3e%3cpath%20d='M0,0h7410v3900H0'%20fill='%23b31942'/%3e%3cpath%20d='M0,450H7410m0,600H0m0,600H7410m0,600H0m0,600H7410m0,600H0'%20stroke='%23FFF'%20stroke-width='300'/%3e%3cpath%20d='M0,0h2964v2100H0'%20fill='%230a3161'/%3e%3cg%20fill='%23FFF'%3e%3cg%20id='s18'%3e%3cg%20id='s9'%3e%3cg%20id='s5'%3e%3cg%20id='s4'%3e%3cpath%20id='s'%20d='M247,90%20317.534230,307.082039%20132.873218,172.917961H361.126782L176.465770,307.082039z'/%3e%3cuse%20xlink:href='%23s'%20y='420'/%3e%3cuse%20xlink:href='%23s'%20y='840'/%3e%3cuse%20xlink:href='%23s'%20y='1260'/%3e%3c/g%3e%3cuse%20xlink:href='%23s'%20y='1680'/%3e%3c/g%3e%3cuse%20xlink:href='%23s4'%20x='247'%20y='210'/%3e%3c/g%3e%3cuse%20xlink:href='%23s9'%20x='494'/%3e%3c/g%3e%3cuse%20xlink:href='%23s18'%20x='988'/%3e%3cuse%20xlink:href='%23s9'%20x='1976'/%3e%3cuse%20xlink:href='%23s5'%20x='2470'/%3e%3c/g%3e%3c/svg%3e",h=[{code:"US",flag:U,dialCode:"+1",name:"United States"},{code:"CA",flag:_,dialCode:"+1",name:"Canada"},{code:"AU",flag:S,dialCode:"+61",name:"Australia"},{code:"NZ",flag:E,dialCode:"+64",name:"New Zealand"},{code:"GB",flag:H,dialCode:"+44",name:"United Kingdom"}],M=({value:s,onChange:c,label:n="Phone Number",placeholder:g="Phone Number",error:x})=>{const[d,m]=i.useState(!1),[a,C]=i.useState(()=>{if(s)for(const e of h){const r=p(e.code.toUpperCase());if(s.startsWith(r))return e.code}return"US"}),l=i.useMemo(()=>p(a.toUpperCase()),[a]);i.useEffect(()=>{if(s)for(const e of h){const r=p(e.code.toUpperCase());if(s.startsWith(r)){a!==e.code&&C(e.code);return}}},[s,a]);const v=i.useMemo(()=>h.find(e=>e.code===a)||h[0],[a]),o=i.useMemo(()=>s.startsWith(l)?s.replace(l,""):s,[s,l]),P=i.useMemo(()=>L.string().trim().min(1,"Phone number is required").refine(e=>{const r=l+e.replace(/[^\d]+/g,"");return z(r,a.toUpperCase())},{message:`Invalid phone number for ${v.name}`}),[l,a]),F=e=>{C(e);const r=p(e.toUpperCase());if(o){const f=o.replace(/[^\d]+/g,""),y=k(f,e.toUpperCase());c(y||r+f)}else c(r)},N=e=>{const r=e.replace(/[^\d]+/g,""),f=k(r,a.toUpperCase());c(f||l+r)},b=t.jsxs("div",{className:"relative flex items-center justify-center border-r border-[#e6e6e6] h-full",style:{minWidth:"70px"},children:[t.jsx("select",{value:a,onChange:e=>F(e.target.value),className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer z-30",style:{fontSize:0},children:h.map(e=>t.jsx("option",{value:e.code,children:e.code},e.code))}),t.jsx("div",{className:"flex items-center justify-center z-20 pointer-events-none",children:t.jsx("img",{src:v.flag,alt:v.name,className:"w-6 h-4 object-cover rounded-sm mr-3"})}),t.jsx("div",{className:"absolute right-2 top-0 bottom-0 flex items-center pointer-events-none z-20",children:t.jsx("svg",{className:"w-3 h-3 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]});return t.jsx("div",{className:"w-full",children:t.jsx(u,{type:"tel",label:n,placeholder:g,value:o,onChange:e=>N(e.target.value),onFocus:()=>{m(!0)},onBlur:()=>{m(!1)},inputClass:`w-full ${d||o?"!pl-[110px]":"!pl-[80px]"}`,autoComplete:"shipping tel",schema:P,error:x,prefix:t.jsxs("div",{className:"flex items-center h-full",children:[b,(d||o)&&t.jsx("span",{className:"ml-2 text-base font-family-inherit",children:l})]})})})};M.__docgenInfo={description:"",methods:[],displayName:"PhoneInput",props:{value:{required:!0,tsType:{name:"string"},description:""},onChange:{required:!0,tsType:{name:"signature",type:"function",raw:"(value: string) => void",signature:{arguments:[{type:{name:"string"},name:"value"}],return:{name:"void"}}},description:""},label:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:'"Phone Number"',computed:!1}},placeholder:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:'"Phone Number"',computed:!1}},error:{required:!1,tsType:{name:"string"},description:""}}};const I=({showTitle:s=!0})=>{const{customerInfo:c,updateCustomerInfo:n}=j(),{firstName:g,lastName:x,email:d,phone:m}=c;return t.jsxs("div",{className:"clickaroo-checkout-ui w-full",children:[s&&t.jsx("div",{className:"text-lg md:text-2xl mb-5 font-medium",children:"Customer Information"}),t.jsxs("div",{className:"border border-solid border-[#e6e6e6] shadow rounded-md p-4 bg-white",children:[t.jsxs("div",{className:"flex flex-col md:flex-row gap-3 mb-2",children:[t.jsx(u,{label:"First Name",placeholder:"First Name",value:g,onChange:a=>n({firstName:a.target.value}),inputClass:"flex-1",autoComplete:"shipping given-name",schema:w.shape.firstName}),t.jsx(u,{label:"Last Name",placeholder:"Last Name",value:x,onChange:a=>n({lastName:a.target.value}),inputClass:"flex-1",autoComplete:"shipping family-name",schema:w.shape.lastName})]}),t.jsx("div",{className:"mb-2",children:t.jsx(u,{label:"Email",placeholder:"Email",value:d,onChange:a=>n({email:a.target.value}),inputClass:"w-full",autoComplete:"shipping email",schema:w.shape.email})}),t.jsx(M,{value:m,onChange:a=>n({phone:a})})]})]})};I.__docgenInfo={description:"",methods:[],displayName:"CustomInfo",props:{showTitle:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}}}};export{I as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t}from"./jsx-runtime-DiklIkkE.js";import{F as u}from"./ValidateInput-C6pnsZFe.js";import{f as p,z as L,v as z,h as k,b as j,a as w}from"./useCheckoutContext-Cyg-MLQs.js";import{r as i}from"./index-DRjF_FHU.js";const S="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='1280'%20height='640'%20viewBox='0%200%2010080%205040'%3e%3cdefs%3e%3cclipPath%20id='c1'%3e%3cpath%20d='M0,0H6V3H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='c2'%3e%3cpath%20d='M0,0V1.5H6V3H6zM6,0H3V3H0V3z'/%3e%3c/clipPath%3e%3cpath%20id='Star7'%20d='M0,-360%2069.421398,-144.155019%20281.459334,-224.456329%20155.988466,-35.603349%20350.974048,80.107536%20125.093037,99.758368%20156.198146,324.348792%200,160%20-156.198146,324.348792%20-125.093037,99.758368%20-350.974048,80.107536%20-155.988466,-35.603349%20-281.459334,-224.456329%20-69.421398,-144.155019z'/%3e%3cpath%20id='Star5'%20d='M0,-210%2054.859957,-75.508253%20199.721868,-64.893569%2088.765275,28.841586%20123.434903,169.893569%200,93.333333%20-123.434903,169.893569%20-88.765275,28.841586%20-199.721868,-64.893569%20-54.859957,-75.508253z'/%3e%3c/defs%3e%3cg%20transform='scale(840)'%3e%3crect%20width='12'%20height='6'%20fill='%23012169'/%3e%3cpath%20d='M0,0%206,3M6,0%200,3'%20stroke='%23fff'%20stroke-width='0.6'%20clip-path='url(%23c1)'/%3e%3cpath%20d='M0,0%206,3M6,0%200,3'%20stroke='%23e4002b'%20stroke-width='0.4'%20clip-path='url(%23c2)'/%3e%3cpath%20d='M3,0V3M0,1.5H6'%20stroke='%23fff'/%3e%3cpath%20d='M3,0V3M0,1.5H6'%20stroke='%23e4002b'%20stroke-width='0.6'/%3e%3c/g%3e%3cg%20fill='%23fff'%3e%3cuse%20id='Comwlth'%20xlink:href='%23Star7'%20transform='translate(2520,%203780)%20scale(2.1)'/%3e%3cuse%20id='αCrucis'%20xlink:href='%23Star7'%20x='7560'%20y='4200'/%3e%3cuse%20id='βCrucis'%20xlink:href='%23Star7'%20x='6300'%20y='2205'/%3e%3cuse%20id='γCrucis'%20xlink:href='%23Star7'%20x='7560'%20y='840'/%3e%3cuse%20id='δCrucis'%20xlink:href='%23Star7'%20x='8680'%20y='1869'/%3e%3cuse%20id='εCrucis'%20xlink:href='%23Star5'%20x='8064'%20y='2730'/%3e%3c/g%3e%3c/svg%3e",_="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='1200'%20height='600'%20viewBox='0%200%209600%204800'%3e%3ctitle%3eFlag%20of%20Canada%20(Pantone%20colours)%3c/title%3e%3cpath%20fill='%23d52b1e'%20d='m0%200h2400l99%2099h4602l99-99h2400v4800h-2400l-99-99h-4602l-99%2099H0z'/%3e%3cpath%20fill='%23fff'%20d='m2400%200h4800v4800h-4800zm2490%204430-45-863a95%2095%200%200%201%20111-98l859%20151-116-320a65%2065%200%200%201%2020-73l941-762-212-99a65%2065%200%200%201-34-79l186-572-542%20115a65%2065%200%200%201-73-38l-105-247-423%20454a65%2065%200%200%201-111-57l204-1052-327%20189a65%2065%200%200%201-91-27l-332-652-332%20652a65%2065%200%200%201-91%2027l-327-189%20204%201052a65%2065%200%200%201-111%2057l-423-454-105%20247a65%2065%200%200%201-73%2038l-542-115%20186%20572a65%2065%200%200%201-34%2079l-212%2099%20941%20762a65%2065%200%200%201%2020%2073l-116%20320%20859-151a95%2095%200%200%201%20111%2098l-45%20863z'/%3e%3c/svg%3e",H="data:image/svg+xml,%3c?xml%20version='1.0'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2060%2030'%20width='1200'%20height='600'%3e%3cclipPath%20id='s'%3e%3cpath%20d='M0,0%20v30%20h60%20v-30%20z'/%3e%3c/clipPath%3e%3cclipPath%20id='t'%3e%3cpath%20d='M30,15%20h30%20v15%20z%20v15%20h-30%20z%20h-30%20v-15%20z%20v-15%20h30%20z'/%3e%3c/clipPath%3e%3cg%20clip-path='url(%23s)'%3e%3cpath%20d='M0,0%20v30%20h60%20v-30%20z'%20fill='%23012169'/%3e%3cpath%20d='M0,0%20L60,30%20M60,0%20L0,30'%20stroke='%23fff'%20stroke-width='6'/%3e%3cpath%20d='M0,0%20L60,30%20M60,0%20L0,30'%20clip-path='url(%23t)'%20stroke='%23C8102E'%20stroke-width='4'/%3e%3cpath%20d='M30,0%20v30%20M0,15%20h60'%20stroke='%23fff'%20stroke-width='10'/%3e%3cpath%20d='M30,0%20v30%20M0,15%20h60'%20stroke='%23C8102E'%20stroke-width='6'/%3e%3c/g%3e%3c/svg%3e",E="data:image/svg+xml,%3c?xml%20version='1.0'?%3e%3csvg%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20height='600'%20width='1200'%3e%3cdefs%3e%3cclipPath%20id='Canton'%3e%3cpath%20d='M%200,0%20L%20600,0%20L%20600,300%20L%200,300%20z'/%3e%3c/clipPath%3e%3cclipPath%20id='Diagonals'%3e%3cpath%20d='M%200,0%20L%20300,150%20L%200,150%20z%20M%20300,0%20L%20600,0%20L%20300,150%20z%20M%20300,150%20L%20600,150%20L%20600,300%20z%20M%20300,150%20L%20300,300%20L%200,300%20z'/%3e%3c/clipPath%3e%3cg%20id='Pentagram'%3e%3cg%20id='Arm'%20transform='translate(0,-0.324925)'%3e%3cpath%20d='M%200,0%20L%200,0.5%20L%201,0%20z'/%3e%3cpath%20d='M%200,0%20L%200,-0.5%20L%201,0%20z'%20transform='rotate(-36,1,0)'/%3e%3c/g%3e%3cuse%20xlink:href='%23Arm'%20transform='scale(-1,1)'/%3e%3cuse%20xlink:href='%23Arm'%20transform='rotate(72,0,0)'/%3e%3cuse%20xlink:href='%23Arm'%20transform='rotate(-72,0,0)'/%3e%3cuse%20xlink:href='%23Arm'%20transform='rotate(-72,0,0)%20scale(-1,1)'/%3e%3c/g%3e%3c/defs%3e%3crect%20fill='%23012169'%20x='0'%20y='0'%20width='1200'%20height='600'/%3e%3cg%20id='Flag_of_the_United_Kingdom'%3e%3cpath%20id='Saint_Andrews_Cross'%20stroke='%23FFF'%20d='M%200,0%20L%20600,300%20M%200,300%20L%20600,0'%20stroke-width='60'%20clip-path='url(%23Canton)'/%3e%3cpath%20id='Saint_Patricks_Cross'%20stroke='%23C8102E'%20d='M%200,0%20L%20600,300%20M%200,300%20L%20600,0'%20stroke-width='40'%20clip-path='url(%23Diagonals)'/%3e%3cg%20id='Saint_Georges_Cross'%3e%3cpath%20stroke='%23FFF'%20d='M%20300,0%20L%20300,300%20M%200,150%20L%20600,150'%20stroke-width='100'%20clip-path='url(%23Canton)'/%3e%3cpath%20stroke='%23C8102E'%20d='M%20300,0%20L%20300,300%20M%200,150%20L%20600,150'%20stroke-width='60'%20clip-path='url(%23Canton)'/%3e%3c/g%3e%3c/g%3e%3cg%20id='Southern_Cross'%3e%3cg%20id='Gamma_Crucis'%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23FFF'%20transform='translate(900,120)%20scale(45.4)'/%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23C8102E'%20transform='translate(900,120)%20scale(30)'/%3e%3c/g%3e%3cg%20transform='rotate(82,900,240)'%3e%3cg%20id='Delta_Crucis'%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23FFF'%20transform='translate(900,120)%20rotate(-82)%20scale(40.4)'/%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23C8102E'%20transform='translate(900,120)%20rotate(-82)%20scale(25)'/%3e%3c/g%3e%3cg%20id='Beta_Crucis'%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23FFF'%20transform='translate(900,380)%20rotate(-82)%20scale(45.4)'/%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23C8102E'%20transform='translate(900,380)%20rotate(-82)%20scale(30)'/%3e%3c/g%3e%3c/g%3e%3cg%20id='Alpha_Crucis'%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23FFF'%20transform='translate(900,480)%20scale(50.4)'/%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23C8102E'%20transform='translate(900,480)%20scale(35)'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",U="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='1235'%20height='650'%20viewBox='0%200%207410%203900'%3e%3cpath%20d='M0,0h7410v3900H0'%20fill='%23b31942'/%3e%3cpath%20d='M0,450H7410m0,600H0m0,600H7410m0,600H0m0,600H7410m0,600H0'%20stroke='%23FFF'%20stroke-width='300'/%3e%3cpath%20d='M0,0h2964v2100H0'%20fill='%230a3161'/%3e%3cg%20fill='%23FFF'%3e%3cg%20id='s18'%3e%3cg%20id='s9'%3e%3cg%20id='s5'%3e%3cg%20id='s4'%3e%3cpath%20id='s'%20d='M247,90%20317.534230,307.082039%20132.873218,172.917961H361.126782L176.465770,307.082039z'/%3e%3cuse%20xlink:href='%23s'%20y='420'/%3e%3cuse%20xlink:href='%23s'%20y='840'/%3e%3cuse%20xlink:href='%23s'%20y='1260'/%3e%3c/g%3e%3cuse%20xlink:href='%23s'%20y='1680'/%3e%3c/g%3e%3cuse%20xlink:href='%23s4'%20x='247'%20y='210'/%3e%3c/g%3e%3cuse%20xlink:href='%23s9'%20x='494'/%3e%3c/g%3e%3cuse%20xlink:href='%23s18'%20x='988'/%3e%3cuse%20xlink:href='%23s9'%20x='1976'/%3e%3cuse%20xlink:href='%23s5'%20x='2470'/%3e%3c/g%3e%3c/svg%3e",h=[{code:"US",flag:U,dialCode:"+1",name:"United States"},{code:"CA",flag:_,dialCode:"+1",name:"Canada"},{code:"AU",flag:S,dialCode:"+61",name:"Australia"},{code:"NZ",flag:E,dialCode:"+64",name:"New Zealand"},{code:"GB",flag:H,dialCode:"+44",name:"United Kingdom"}],M=({value:s,onChange:c,label:n="Phone Number",placeholder:g="Phone Number",error:x})=>{const[d,m]=i.useState(!1),[a,C]=i.useState(()=>{if(s)for(const e of h){const r=p(e.code.toUpperCase());if(s.startsWith(r))return e.code}return"US"}),l=i.useMemo(()=>p(a.toUpperCase()),[a]);i.useEffect(()=>{if(s)for(const e of h){const r=p(e.code.toUpperCase());if(s.startsWith(r)){a!==e.code&&C(e.code);return}}},[s,a]);const v=i.useMemo(()=>h.find(e=>e.code===a)||h[0],[a]),o=i.useMemo(()=>s.startsWith(l)?s.replace(l,""):s,[s,l]),P=i.useMemo(()=>L.string().trim().min(1,"Phone number is required").refine(e=>{const r=l+e.replace(/[^\d]+/g,"");return z(r,a.toUpperCase())},{message:`Invalid phone number for ${v.name}`}),[l,a]),F=e=>{C(e);const r=p(e.toUpperCase());if(o){const f=o.replace(/[^\d]+/g,""),y=k(f,e.toUpperCase());c(y||r+f)}else c(r)},N=e=>{const r=e.replace(/[^\d]+/g,""),f=k(r,a.toUpperCase());c(f||l+r)},b=t.jsxs("div",{className:"relative flex items-center justify-center border-r border-[#e6e6e6] h-full",style:{minWidth:"70px"},children:[t.jsx("select",{value:a,onChange:e=>F(e.target.value),className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer z-30",style:{fontSize:0},children:h.map(e=>t.jsx("option",{value:e.code,children:e.code},e.code))}),t.jsx("div",{className:"flex items-center justify-center z-20 pointer-events-none",children:t.jsx("img",{src:v.flag,alt:v.name,className:"w-6 h-4 object-cover rounded-sm mr-3"})}),t.jsx("div",{className:"absolute right-2 top-0 bottom-0 flex items-center pointer-events-none z-20",children:t.jsx("svg",{className:"w-3 h-3 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]});return t.jsx("div",{className:"w-full",children:t.jsx(u,{type:"tel",label:n,placeholder:g,value:o,onChange:e=>N(e.target.value),onFocus:()=>{m(!0)},onBlur:()=>{m(!1)},inputClass:`w-full ${d||o?"!pl-[110px]":"!pl-[80px]"}`,autoComplete:"shipping tel",schema:P,error:x,prefix:t.jsxs("div",{className:"flex items-center h-full",children:[b,(d||o)&&t.jsx("span",{className:"ml-2 text-base font-family-inherit",children:l})]})})})};M.__docgenInfo={description:"",methods:[],displayName:"PhoneInput",props:{value:{required:!0,tsType:{name:"string"},description:""},onChange:{required:!0,tsType:{name:"signature",type:"function",raw:"(value: string) => void",signature:{arguments:[{type:{name:"string"},name:"value"}],return:{name:"void"}}},description:""},label:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:'"Phone Number"',computed:!1}},placeholder:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:'"Phone Number"',computed:!1}},error:{required:!1,tsType:{name:"string"},description:""}}};const I=({showTitle:s=!0})=>{const{customerInfo:c,updateCustomerInfo:n}=j(),{firstName:g,lastName:x,email:d,phone:m}=c;return t.jsxs("div",{className:"clickaroo-checkout-ui w-full",children:[s&&t.jsx("div",{className:"text-lg md:text-2xl mb-5 font-medium",children:"Customer Information"}),t.jsxs("div",{className:"border border-solid border-[#e6e6e6] shadow rounded-md p-4 bg-white",children:[t.jsxs("div",{className:"flex flex-col md:flex-row gap-3 mb-2",children:[t.jsx(u,{label:"First Name",placeholder:"First Name",value:g,onChange:a=>n({firstName:a.target.value}),inputClass:"flex-1",autoComplete:"shipping given-name",schema:w.shape.firstName}),t.jsx(u,{label:"Last Name",placeholder:"Last Name",value:x,onChange:a=>n({lastName:a.target.value}),inputClass:"flex-1",autoComplete:"shipping family-name",schema:w.shape.lastName})]}),t.jsx("div",{className:"mb-2",children:t.jsx(u,{label:"Email",placeholder:"Email",value:d,onChange:a=>n({email:a.target.value}),inputClass:"w-full",autoComplete:"shipping email",schema:w.shape.email})}),t.jsx(M,{value:m,onChange:a=>n({phone:a})})]})]})};I.__docgenInfo={description:"",methods:[],displayName:"CustomInfo",props:{showTitle:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}}}};export{I as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t}from"./jsx-runtime-DiklIkkE.js";import{F as u}from"./ValidateInput-sZgX3GCF.js";import{f as p,z as L,v as z,h as k,b as j,a as w}from"./useCheckoutContext-C6u4Rp5U.js";import{r as i}from"./index-DRjF_FHU.js";const S="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='1280'%20height='640'%20viewBox='0%200%2010080%205040'%3e%3cdefs%3e%3cclipPath%20id='c1'%3e%3cpath%20d='M0,0H6V3H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='c2'%3e%3cpath%20d='M0,0V1.5H6V3H6zM6,0H3V3H0V3z'/%3e%3c/clipPath%3e%3cpath%20id='Star7'%20d='M0,-360%2069.421398,-144.155019%20281.459334,-224.456329%20155.988466,-35.603349%20350.974048,80.107536%20125.093037,99.758368%20156.198146,324.348792%200,160%20-156.198146,324.348792%20-125.093037,99.758368%20-350.974048,80.107536%20-155.988466,-35.603349%20-281.459334,-224.456329%20-69.421398,-144.155019z'/%3e%3cpath%20id='Star5'%20d='M0,-210%2054.859957,-75.508253%20199.721868,-64.893569%2088.765275,28.841586%20123.434903,169.893569%200,93.333333%20-123.434903,169.893569%20-88.765275,28.841586%20-199.721868,-64.893569%20-54.859957,-75.508253z'/%3e%3c/defs%3e%3cg%20transform='scale(840)'%3e%3crect%20width='12'%20height='6'%20fill='%23012169'/%3e%3cpath%20d='M0,0%206,3M6,0%200,3'%20stroke='%23fff'%20stroke-width='0.6'%20clip-path='url(%23c1)'/%3e%3cpath%20d='M0,0%206,3M6,0%200,3'%20stroke='%23e4002b'%20stroke-width='0.4'%20clip-path='url(%23c2)'/%3e%3cpath%20d='M3,0V3M0,1.5H6'%20stroke='%23fff'/%3e%3cpath%20d='M3,0V3M0,1.5H6'%20stroke='%23e4002b'%20stroke-width='0.6'/%3e%3c/g%3e%3cg%20fill='%23fff'%3e%3cuse%20id='Comwlth'%20xlink:href='%23Star7'%20transform='translate(2520,%203780)%20scale(2.1)'/%3e%3cuse%20id='αCrucis'%20xlink:href='%23Star7'%20x='7560'%20y='4200'/%3e%3cuse%20id='βCrucis'%20xlink:href='%23Star7'%20x='6300'%20y='2205'/%3e%3cuse%20id='γCrucis'%20xlink:href='%23Star7'%20x='7560'%20y='840'/%3e%3cuse%20id='δCrucis'%20xlink:href='%23Star7'%20x='8680'%20y='1869'/%3e%3cuse%20id='εCrucis'%20xlink:href='%23Star5'%20x='8064'%20y='2730'/%3e%3c/g%3e%3c/svg%3e",_="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='1200'%20height='600'%20viewBox='0%200%209600%204800'%3e%3ctitle%3eFlag%20of%20Canada%20(Pantone%20colours)%3c/title%3e%3cpath%20fill='%23d52b1e'%20d='m0%200h2400l99%2099h4602l99-99h2400v4800h-2400l-99-99h-4602l-99%2099H0z'/%3e%3cpath%20fill='%23fff'%20d='m2400%200h4800v4800h-4800zm2490%204430-45-863a95%2095%200%200%201%20111-98l859%20151-116-320a65%2065%200%200%201%2020-73l941-762-212-99a65%2065%200%200%201-34-79l186-572-542%20115a65%2065%200%200%201-73-38l-105-247-423%20454a65%2065%200%200%201-111-57l204-1052-327%20189a65%2065%200%200%201-91-27l-332-652-332%20652a65%2065%200%200%201-91%2027l-327-189%20204%201052a65%2065%200%200%201-111%2057l-423-454-105%20247a65%2065%200%200%201-73%2038l-542-115%20186%20572a65%2065%200%200%201-34%2079l-212%2099%20941%20762a65%2065%200%200%201%2020%2073l-116%20320%20859-151a95%2095%200%200%201%20111%2098l-45%20863z'/%3e%3c/svg%3e",H="data:image/svg+xml,%3c?xml%20version='1.0'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2060%2030'%20width='1200'%20height='600'%3e%3cclipPath%20id='s'%3e%3cpath%20d='M0,0%20v30%20h60%20v-30%20z'/%3e%3c/clipPath%3e%3cclipPath%20id='t'%3e%3cpath%20d='M30,15%20h30%20v15%20z%20v15%20h-30%20z%20h-30%20v-15%20z%20v-15%20h30%20z'/%3e%3c/clipPath%3e%3cg%20clip-path='url(%23s)'%3e%3cpath%20d='M0,0%20v30%20h60%20v-30%20z'%20fill='%23012169'/%3e%3cpath%20d='M0,0%20L60,30%20M60,0%20L0,30'%20stroke='%23fff'%20stroke-width='6'/%3e%3cpath%20d='M0,0%20L60,30%20M60,0%20L0,30'%20clip-path='url(%23t)'%20stroke='%23C8102E'%20stroke-width='4'/%3e%3cpath%20d='M30,0%20v30%20M0,15%20h60'%20stroke='%23fff'%20stroke-width='10'/%3e%3cpath%20d='M30,0%20v30%20M0,15%20h60'%20stroke='%23C8102E'%20stroke-width='6'/%3e%3c/g%3e%3c/svg%3e",E="data:image/svg+xml,%3c?xml%20version='1.0'?%3e%3csvg%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20height='600'%20width='1200'%3e%3cdefs%3e%3cclipPath%20id='Canton'%3e%3cpath%20d='M%200,0%20L%20600,0%20L%20600,300%20L%200,300%20z'/%3e%3c/clipPath%3e%3cclipPath%20id='Diagonals'%3e%3cpath%20d='M%200,0%20L%20300,150%20L%200,150%20z%20M%20300,0%20L%20600,0%20L%20300,150%20z%20M%20300,150%20L%20600,150%20L%20600,300%20z%20M%20300,150%20L%20300,300%20L%200,300%20z'/%3e%3c/clipPath%3e%3cg%20id='Pentagram'%3e%3cg%20id='Arm'%20transform='translate(0,-0.324925)'%3e%3cpath%20d='M%200,0%20L%200,0.5%20L%201,0%20z'/%3e%3cpath%20d='M%200,0%20L%200,-0.5%20L%201,0%20z'%20transform='rotate(-36,1,0)'/%3e%3c/g%3e%3cuse%20xlink:href='%23Arm'%20transform='scale(-1,1)'/%3e%3cuse%20xlink:href='%23Arm'%20transform='rotate(72,0,0)'/%3e%3cuse%20xlink:href='%23Arm'%20transform='rotate(-72,0,0)'/%3e%3cuse%20xlink:href='%23Arm'%20transform='rotate(-72,0,0)%20scale(-1,1)'/%3e%3c/g%3e%3c/defs%3e%3crect%20fill='%23012169'%20x='0'%20y='0'%20width='1200'%20height='600'/%3e%3cg%20id='Flag_of_the_United_Kingdom'%3e%3cpath%20id='Saint_Andrews_Cross'%20stroke='%23FFF'%20d='M%200,0%20L%20600,300%20M%200,300%20L%20600,0'%20stroke-width='60'%20clip-path='url(%23Canton)'/%3e%3cpath%20id='Saint_Patricks_Cross'%20stroke='%23C8102E'%20d='M%200,0%20L%20600,300%20M%200,300%20L%20600,0'%20stroke-width='40'%20clip-path='url(%23Diagonals)'/%3e%3cg%20id='Saint_Georges_Cross'%3e%3cpath%20stroke='%23FFF'%20d='M%20300,0%20L%20300,300%20M%200,150%20L%20600,150'%20stroke-width='100'%20clip-path='url(%23Canton)'/%3e%3cpath%20stroke='%23C8102E'%20d='M%20300,0%20L%20300,300%20M%200,150%20L%20600,150'%20stroke-width='60'%20clip-path='url(%23Canton)'/%3e%3c/g%3e%3c/g%3e%3cg%20id='Southern_Cross'%3e%3cg%20id='Gamma_Crucis'%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23FFF'%20transform='translate(900,120)%20scale(45.4)'/%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23C8102E'%20transform='translate(900,120)%20scale(30)'/%3e%3c/g%3e%3cg%20transform='rotate(82,900,240)'%3e%3cg%20id='Delta_Crucis'%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23FFF'%20transform='translate(900,120)%20rotate(-82)%20scale(40.4)'/%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23C8102E'%20transform='translate(900,120)%20rotate(-82)%20scale(25)'/%3e%3c/g%3e%3cg%20id='Beta_Crucis'%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23FFF'%20transform='translate(900,380)%20rotate(-82)%20scale(45.4)'/%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23C8102E'%20transform='translate(900,380)%20rotate(-82)%20scale(30)'/%3e%3c/g%3e%3c/g%3e%3cg%20id='Alpha_Crucis'%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23FFF'%20transform='translate(900,480)%20scale(50.4)'/%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23C8102E'%20transform='translate(900,480)%20scale(35)'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",U="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='1235'%20height='650'%20viewBox='0%200%207410%203900'%3e%3cpath%20d='M0,0h7410v3900H0'%20fill='%23b31942'/%3e%3cpath%20d='M0,450H7410m0,600H0m0,600H7410m0,600H0m0,600H7410m0,600H0'%20stroke='%23FFF'%20stroke-width='300'/%3e%3cpath%20d='M0,0h2964v2100H0'%20fill='%230a3161'/%3e%3cg%20fill='%23FFF'%3e%3cg%20id='s18'%3e%3cg%20id='s9'%3e%3cg%20id='s5'%3e%3cg%20id='s4'%3e%3cpath%20id='s'%20d='M247,90%20317.534230,307.082039%20132.873218,172.917961H361.126782L176.465770,307.082039z'/%3e%3cuse%20xlink:href='%23s'%20y='420'/%3e%3cuse%20xlink:href='%23s'%20y='840'/%3e%3cuse%20xlink:href='%23s'%20y='1260'/%3e%3c/g%3e%3cuse%20xlink:href='%23s'%20y='1680'/%3e%3c/g%3e%3cuse%20xlink:href='%23s4'%20x='247'%20y='210'/%3e%3c/g%3e%3cuse%20xlink:href='%23s9'%20x='494'/%3e%3c/g%3e%3cuse%20xlink:href='%23s18'%20x='988'/%3e%3cuse%20xlink:href='%23s9'%20x='1976'/%3e%3cuse%20xlink:href='%23s5'%20x='2470'/%3e%3c/g%3e%3c/svg%3e",h=[{code:"US",flag:U,dialCode:"+1",name:"United States"},{code:"CA",flag:_,dialCode:"+1",name:"Canada"},{code:"AU",flag:S,dialCode:"+61",name:"Australia"},{code:"NZ",flag:E,dialCode:"+64",name:"New Zealand"},{code:"GB",flag:H,dialCode:"+44",name:"United Kingdom"}],M=({value:s,onChange:c,label:n="Phone Number",placeholder:g="Phone Number",error:x})=>{const[d,m]=i.useState(!1),[a,C]=i.useState(()=>{if(s)for(const e of h){const r=p(e.code.toUpperCase());if(s.startsWith(r))return e.code}return"US"}),l=i.useMemo(()=>p(a.toUpperCase()),[a]);i.useEffect(()=>{if(s)for(const e of h){const r=p(e.code.toUpperCase());if(s.startsWith(r)){a!==e.code&&C(e.code);return}}},[s,a]);const v=i.useMemo(()=>h.find(e=>e.code===a)||h[0],[a]),o=i.useMemo(()=>s.startsWith(l)?s.replace(l,""):s,[s,l]),P=i.useMemo(()=>L.string().trim().min(1,"Phone number is required").refine(e=>{const r=l+e.replace(/[^\d]+/g,"");return z(r,a.toUpperCase())},{message:`Invalid phone number for ${v.name}`}),[l,a]),F=e=>{C(e);const r=p(e.toUpperCase());if(o){const f=o.replace(/[^\d]+/g,""),y=k(f,e.toUpperCase());c(y||r+f)}else c(r)},N=e=>{const r=e.replace(/[^\d]+/g,""),f=k(r,a.toUpperCase());c(f||l+r)},b=t.jsxs("div",{className:"relative flex items-center justify-center border-r border-[#e6e6e6] h-full",style:{minWidth:"70px"},children:[t.jsx("select",{value:a,onChange:e=>F(e.target.value),className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer z-30",style:{fontSize:0},children:h.map(e=>t.jsx("option",{value:e.code,children:e.code},e.code))}),t.jsx("div",{className:"flex items-center justify-center z-20 pointer-events-none",children:t.jsx("img",{src:v.flag,alt:v.name,className:"w-6 h-4 object-cover rounded-sm mr-3"})}),t.jsx("div",{className:"absolute right-2 top-0 bottom-0 flex items-center pointer-events-none z-20",children:t.jsx("svg",{className:"w-3 h-3 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]});return t.jsx("div",{className:"w-full",children:t.jsx(u,{type:"tel",label:n,placeholder:g,value:o,onChange:e=>N(e.target.value),onFocus:()=>{m(!0)},onBlur:()=>{m(!1)},inputClass:`w-full ${d||o?"!pl-[110px]":"!pl-[80px]"}`,autoComplete:"shipping tel",schema:P,error:x,prefix:t.jsxs("div",{className:"flex items-center h-full",children:[b,(d||o)&&t.jsx("span",{className:"ml-2 text-base font-family-inherit",children:l})]})})})};M.__docgenInfo={description:"",methods:[],displayName:"PhoneInput",props:{value:{required:!0,tsType:{name:"string"},description:""},onChange:{required:!0,tsType:{name:"signature",type:"function",raw:"(value: string) => void",signature:{arguments:[{type:{name:"string"},name:"value"}],return:{name:"void"}}},description:""},label:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:'"Phone Number"',computed:!1}},placeholder:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:'"Phone Number"',computed:!1}},error:{required:!1,tsType:{name:"string"},description:""}}};const I=({showTitle:s=!0})=>{const{customerInfo:c,updateCustomerInfo:n}=j(),{firstName:g,lastName:x,email:d,phone:m}=c;return t.jsxs("div",{className:"clickaroo-checkout-ui w-full",children:[s&&t.jsx("div",{className:"text-lg md:text-2xl mb-5 font-medium",children:"Customer Information"}),t.jsxs("div",{className:"border border-solid border-[#e6e6e6] shadow rounded-md p-4 bg-white",children:[t.jsxs("div",{className:"flex flex-col md:flex-row gap-3 mb-2",children:[t.jsx(u,{label:"First Name",placeholder:"First Name",value:g,onChange:a=>n({firstName:a.target.value}),inputClass:"flex-1",autoComplete:"shipping given-name",schema:w.shape.firstName}),t.jsx(u,{label:"Last Name",placeholder:"Last Name",value:x,onChange:a=>n({lastName:a.target.value}),inputClass:"flex-1",autoComplete:"shipping family-name",schema:w.shape.lastName})]}),t.jsx("div",{className:"mb-2",children:t.jsx(u,{label:"Email",placeholder:"Email",value:d,onChange:a=>n({email:a.target.value}),inputClass:"w-full",autoComplete:"shipping email",schema:w.shape.email})}),t.jsx(M,{value:m,onChange:a=>n({phone:a})})]})]})};I.__docgenInfo={description:"",methods:[],displayName:"CustomInfo",props:{showTitle:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}}}};export{I as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t}from"./jsx-runtime-DiklIkkE.js";import{F as u}from"./ValidateInput-DcnOO9py.js";import{f as p,z as L,v as z,h as k,b as j,a as w}from"./useCheckoutContext-DuJ1Ep0-.js";import{r as i}from"./index-DRjF_FHU.js";const S="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='1280'%20height='640'%20viewBox='0%200%2010080%205040'%3e%3cdefs%3e%3cclipPath%20id='c1'%3e%3cpath%20d='M0,0H6V3H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='c2'%3e%3cpath%20d='M0,0V1.5H6V3H6zM6,0H3V3H0V3z'/%3e%3c/clipPath%3e%3cpath%20id='Star7'%20d='M0,-360%2069.421398,-144.155019%20281.459334,-224.456329%20155.988466,-35.603349%20350.974048,80.107536%20125.093037,99.758368%20156.198146,324.348792%200,160%20-156.198146,324.348792%20-125.093037,99.758368%20-350.974048,80.107536%20-155.988466,-35.603349%20-281.459334,-224.456329%20-69.421398,-144.155019z'/%3e%3cpath%20id='Star5'%20d='M0,-210%2054.859957,-75.508253%20199.721868,-64.893569%2088.765275,28.841586%20123.434903,169.893569%200,93.333333%20-123.434903,169.893569%20-88.765275,28.841586%20-199.721868,-64.893569%20-54.859957,-75.508253z'/%3e%3c/defs%3e%3cg%20transform='scale(840)'%3e%3crect%20width='12'%20height='6'%20fill='%23012169'/%3e%3cpath%20d='M0,0%206,3M6,0%200,3'%20stroke='%23fff'%20stroke-width='0.6'%20clip-path='url(%23c1)'/%3e%3cpath%20d='M0,0%206,3M6,0%200,3'%20stroke='%23e4002b'%20stroke-width='0.4'%20clip-path='url(%23c2)'/%3e%3cpath%20d='M3,0V3M0,1.5H6'%20stroke='%23fff'/%3e%3cpath%20d='M3,0V3M0,1.5H6'%20stroke='%23e4002b'%20stroke-width='0.6'/%3e%3c/g%3e%3cg%20fill='%23fff'%3e%3cuse%20id='Comwlth'%20xlink:href='%23Star7'%20transform='translate(2520,%203780)%20scale(2.1)'/%3e%3cuse%20id='αCrucis'%20xlink:href='%23Star7'%20x='7560'%20y='4200'/%3e%3cuse%20id='βCrucis'%20xlink:href='%23Star7'%20x='6300'%20y='2205'/%3e%3cuse%20id='γCrucis'%20xlink:href='%23Star7'%20x='7560'%20y='840'/%3e%3cuse%20id='δCrucis'%20xlink:href='%23Star7'%20x='8680'%20y='1869'/%3e%3cuse%20id='εCrucis'%20xlink:href='%23Star5'%20x='8064'%20y='2730'/%3e%3c/g%3e%3c/svg%3e",_="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='1200'%20height='600'%20viewBox='0%200%209600%204800'%3e%3ctitle%3eFlag%20of%20Canada%20(Pantone%20colours)%3c/title%3e%3cpath%20fill='%23d52b1e'%20d='m0%200h2400l99%2099h4602l99-99h2400v4800h-2400l-99-99h-4602l-99%2099H0z'/%3e%3cpath%20fill='%23fff'%20d='m2400%200h4800v4800h-4800zm2490%204430-45-863a95%2095%200%200%201%20111-98l859%20151-116-320a65%2065%200%200%201%2020-73l941-762-212-99a65%2065%200%200%201-34-79l186-572-542%20115a65%2065%200%200%201-73-38l-105-247-423%20454a65%2065%200%200%201-111-57l204-1052-327%20189a65%2065%200%200%201-91-27l-332-652-332%20652a65%2065%200%200%201-91%2027l-327-189%20204%201052a65%2065%200%200%201-111%2057l-423-454-105%20247a65%2065%200%200%201-73%2038l-542-115%20186%20572a65%2065%200%200%201-34%2079l-212%2099%20941%20762a65%2065%200%200%201%2020%2073l-116%20320%20859-151a95%2095%200%200%201%20111%2098l-45%20863z'/%3e%3c/svg%3e",H="data:image/svg+xml,%3c?xml%20version='1.0'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2060%2030'%20width='1200'%20height='600'%3e%3cclipPath%20id='s'%3e%3cpath%20d='M0,0%20v30%20h60%20v-30%20z'/%3e%3c/clipPath%3e%3cclipPath%20id='t'%3e%3cpath%20d='M30,15%20h30%20v15%20z%20v15%20h-30%20z%20h-30%20v-15%20z%20v-15%20h30%20z'/%3e%3c/clipPath%3e%3cg%20clip-path='url(%23s)'%3e%3cpath%20d='M0,0%20v30%20h60%20v-30%20z'%20fill='%23012169'/%3e%3cpath%20d='M0,0%20L60,30%20M60,0%20L0,30'%20stroke='%23fff'%20stroke-width='6'/%3e%3cpath%20d='M0,0%20L60,30%20M60,0%20L0,30'%20clip-path='url(%23t)'%20stroke='%23C8102E'%20stroke-width='4'/%3e%3cpath%20d='M30,0%20v30%20M0,15%20h60'%20stroke='%23fff'%20stroke-width='10'/%3e%3cpath%20d='M30,0%20v30%20M0,15%20h60'%20stroke='%23C8102E'%20stroke-width='6'/%3e%3c/g%3e%3c/svg%3e",E="data:image/svg+xml,%3c?xml%20version='1.0'?%3e%3csvg%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20height='600'%20width='1200'%3e%3cdefs%3e%3cclipPath%20id='Canton'%3e%3cpath%20d='M%200,0%20L%20600,0%20L%20600,300%20L%200,300%20z'/%3e%3c/clipPath%3e%3cclipPath%20id='Diagonals'%3e%3cpath%20d='M%200,0%20L%20300,150%20L%200,150%20z%20M%20300,0%20L%20600,0%20L%20300,150%20z%20M%20300,150%20L%20600,150%20L%20600,300%20z%20M%20300,150%20L%20300,300%20L%200,300%20z'/%3e%3c/clipPath%3e%3cg%20id='Pentagram'%3e%3cg%20id='Arm'%20transform='translate(0,-0.324925)'%3e%3cpath%20d='M%200,0%20L%200,0.5%20L%201,0%20z'/%3e%3cpath%20d='M%200,0%20L%200,-0.5%20L%201,0%20z'%20transform='rotate(-36,1,0)'/%3e%3c/g%3e%3cuse%20xlink:href='%23Arm'%20transform='scale(-1,1)'/%3e%3cuse%20xlink:href='%23Arm'%20transform='rotate(72,0,0)'/%3e%3cuse%20xlink:href='%23Arm'%20transform='rotate(-72,0,0)'/%3e%3cuse%20xlink:href='%23Arm'%20transform='rotate(-72,0,0)%20scale(-1,1)'/%3e%3c/g%3e%3c/defs%3e%3crect%20fill='%23012169'%20x='0'%20y='0'%20width='1200'%20height='600'/%3e%3cg%20id='Flag_of_the_United_Kingdom'%3e%3cpath%20id='Saint_Andrews_Cross'%20stroke='%23FFF'%20d='M%200,0%20L%20600,300%20M%200,300%20L%20600,0'%20stroke-width='60'%20clip-path='url(%23Canton)'/%3e%3cpath%20id='Saint_Patricks_Cross'%20stroke='%23C8102E'%20d='M%200,0%20L%20600,300%20M%200,300%20L%20600,0'%20stroke-width='40'%20clip-path='url(%23Diagonals)'/%3e%3cg%20id='Saint_Georges_Cross'%3e%3cpath%20stroke='%23FFF'%20d='M%20300,0%20L%20300,300%20M%200,150%20L%20600,150'%20stroke-width='100'%20clip-path='url(%23Canton)'/%3e%3cpath%20stroke='%23C8102E'%20d='M%20300,0%20L%20300,300%20M%200,150%20L%20600,150'%20stroke-width='60'%20clip-path='url(%23Canton)'/%3e%3c/g%3e%3c/g%3e%3cg%20id='Southern_Cross'%3e%3cg%20id='Gamma_Crucis'%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23FFF'%20transform='translate(900,120)%20scale(45.4)'/%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23C8102E'%20transform='translate(900,120)%20scale(30)'/%3e%3c/g%3e%3cg%20transform='rotate(82,900,240)'%3e%3cg%20id='Delta_Crucis'%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23FFF'%20transform='translate(900,120)%20rotate(-82)%20scale(40.4)'/%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23C8102E'%20transform='translate(900,120)%20rotate(-82)%20scale(25)'/%3e%3c/g%3e%3cg%20id='Beta_Crucis'%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23FFF'%20transform='translate(900,380)%20rotate(-82)%20scale(45.4)'/%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23C8102E'%20transform='translate(900,380)%20rotate(-82)%20scale(30)'/%3e%3c/g%3e%3c/g%3e%3cg%20id='Alpha_Crucis'%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23FFF'%20transform='translate(900,480)%20scale(50.4)'/%3e%3cuse%20xlink:href='%23Pentagram'%20fill='%23C8102E'%20transform='translate(900,480)%20scale(35)'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",U="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='1235'%20height='650'%20viewBox='0%200%207410%203900'%3e%3cpath%20d='M0,0h7410v3900H0'%20fill='%23b31942'/%3e%3cpath%20d='M0,450H7410m0,600H0m0,600H7410m0,600H0m0,600H7410m0,600H0'%20stroke='%23FFF'%20stroke-width='300'/%3e%3cpath%20d='M0,0h2964v2100H0'%20fill='%230a3161'/%3e%3cg%20fill='%23FFF'%3e%3cg%20id='s18'%3e%3cg%20id='s9'%3e%3cg%20id='s5'%3e%3cg%20id='s4'%3e%3cpath%20id='s'%20d='M247,90%20317.534230,307.082039%20132.873218,172.917961H361.126782L176.465770,307.082039z'/%3e%3cuse%20xlink:href='%23s'%20y='420'/%3e%3cuse%20xlink:href='%23s'%20y='840'/%3e%3cuse%20xlink:href='%23s'%20y='1260'/%3e%3c/g%3e%3cuse%20xlink:href='%23s'%20y='1680'/%3e%3c/g%3e%3cuse%20xlink:href='%23s4'%20x='247'%20y='210'/%3e%3c/g%3e%3cuse%20xlink:href='%23s9'%20x='494'/%3e%3c/g%3e%3cuse%20xlink:href='%23s18'%20x='988'/%3e%3cuse%20xlink:href='%23s9'%20x='1976'/%3e%3cuse%20xlink:href='%23s5'%20x='2470'/%3e%3c/g%3e%3c/svg%3e",h=[{code:"US",flag:U,dialCode:"+1",name:"United States"},{code:"CA",flag:_,dialCode:"+1",name:"Canada"},{code:"AU",flag:S,dialCode:"+61",name:"Australia"},{code:"NZ",flag:E,dialCode:"+64",name:"New Zealand"},{code:"GB",flag:H,dialCode:"+44",name:"United Kingdom"}],M=({value:s,onChange:c,label:n="Phone Number",placeholder:g="Phone Number",error:x})=>{const[d,m]=i.useState(!1),[a,C]=i.useState(()=>{if(s)for(const e of h){const r=p(e.code.toUpperCase());if(s.startsWith(r))return e.code}return"US"}),l=i.useMemo(()=>p(a.toUpperCase()),[a]);i.useEffect(()=>{if(s)for(const e of h){const r=p(e.code.toUpperCase());if(s.startsWith(r)){a!==e.code&&C(e.code);return}}},[s,a]);const v=i.useMemo(()=>h.find(e=>e.code===a)||h[0],[a]),o=i.useMemo(()=>s.startsWith(l)?s.replace(l,""):s,[s,l]),P=i.useMemo(()=>L.string().trim().min(1,"Phone number is required").refine(e=>{const r=l+e.replace(/[^\d]+/g,"");return z(r,a.toUpperCase())},{message:`Invalid phone number for ${v.name}`}),[l,a]),F=e=>{C(e);const r=p(e.toUpperCase());if(o){const f=o.replace(/[^\d]+/g,""),y=k(f,e.toUpperCase());c(y||r+f)}else c(r)},N=e=>{const r=e.replace(/[^\d]+/g,""),f=k(r,a.toUpperCase());c(f||l+r)},b=t.jsxs("div",{className:"relative flex items-center justify-center border-r border-[#e6e6e6] h-full",style:{minWidth:"70px"},children:[t.jsx("select",{value:a,onChange:e=>F(e.target.value),className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer z-30",style:{fontSize:0},children:h.map(e=>t.jsx("option",{value:e.code,children:e.code},e.code))}),t.jsx("div",{className:"flex items-center justify-center z-20 pointer-events-none",children:t.jsx("img",{src:v.flag,alt:v.name,className:"w-6 h-4 object-cover rounded-sm mr-3"})}),t.jsx("div",{className:"absolute right-2 top-0 bottom-0 flex items-center pointer-events-none z-20",children:t.jsx("svg",{className:"w-3 h-3 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]});return t.jsx("div",{className:"w-full",children:t.jsx(u,{type:"tel",label:n,placeholder:g,value:o,onChange:e=>N(e.target.value),onFocus:()=>{m(!0)},onBlur:()=>{m(!1)},inputClass:`w-full ${d||o?"!pl-[110px]":"!pl-[80px]"}`,autoComplete:"shipping tel",schema:P,error:x,prefix:t.jsxs("div",{className:"flex items-center h-full",children:[b,(d||o)&&t.jsx("span",{className:"ml-2 text-base font-family-inherit",children:l})]})})})};M.__docgenInfo={description:"",methods:[],displayName:"PhoneInput",props:{value:{required:!0,tsType:{name:"string"},description:""},onChange:{required:!0,tsType:{name:"signature",type:"function",raw:"(value: string) => void",signature:{arguments:[{type:{name:"string"},name:"value"}],return:{name:"void"}}},description:""},label:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:'"Phone Number"',computed:!1}},placeholder:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:'"Phone Number"',computed:!1}},error:{required:!1,tsType:{name:"string"},description:""}}};const I=({showTitle:s=!0})=>{const{customerInfo:c,updateCustomerInfo:n}=j(),{firstName:g,lastName:x,email:d,phone:m}=c;return t.jsxs("div",{className:"clickaroo-checkout-ui w-full",children:[s&&t.jsx("div",{className:"text-lg md:text-2xl mb-5 font-medium",children:"Customer Information"}),t.jsxs("div",{className:"border border-solid border-[#e6e6e6] shadow rounded-md p-4 bg-white",children:[t.jsxs("div",{className:"flex flex-col md:flex-row gap-3 mb-2",children:[t.jsx(u,{label:"First Name",placeholder:"First Name",value:g,onChange:a=>n({firstName:a.target.value}),inputClass:"flex-1",autoComplete:"shipping given-name",schema:w.shape.firstName}),t.jsx(u,{label:"Last Name",placeholder:"Last Name",value:x,onChange:a=>n({lastName:a.target.value}),inputClass:"flex-1",autoComplete:"shipping family-name",schema:w.shape.lastName})]}),t.jsx("div",{className:"mb-2",children:t.jsx(u,{label:"Email",placeholder:"Email",value:d,onChange:a=>n({email:a.target.value}),inputClass:"w-full",autoComplete:"shipping email",schema:w.shape.email})}),t.jsx(M,{value:m,onChange:a=>n({phone:a})})]})]})};I.__docgenInfo={description:"",methods:[],displayName:"CustomInfo",props:{showTitle:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}}}};export{I as C};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{j as o}from"./jsx-runtime-DiklIkkE.js";import{C as l}from"./CustomerInfo-CTx1dFS3.js";import{C as u,S as p,c as d,D as f}from"./useCheckoutContext-B8tsk5b5.js";import"./index-DRjF_FHU.js";import"./ValidateInput-Cl2O4HCX.js";d(f);const h=[{sku:"TEST001",offerPricePoint:p.SINGLE}],E={component:l,title:"Components/CustomerInfo",parameters:{docs:{description:{component:"Customer information form component for collecting customer details (first name, last name, email, phone). Requires CheckoutProvider wrapper."}}},decorators:[c=>o.jsx(u,{cart:h,children:o.jsx(c,{})})],argTypes:{showTitle:{description:'Whether to display the title "Customer Information"',control:"boolean",table:{type:{summary:"boolean"},defaultValue:{summary:"true"}}}}},e={args:{showTitle:!0}},r={args:{showTitle:!1}};var t,s,a;e.parameters={...e.parameters,docs:{...(t=e.parameters)==null?void 0:t.docs,source:{originalSource:`{
|
|
2
|
+
args: {
|
|
3
|
+
showTitle: true
|
|
4
|
+
}
|
|
5
|
+
}`,...(a=(s=e.parameters)==null?void 0:s.docs)==null?void 0:a.source}}};var n,i,m;r.parameters={...r.parameters,docs:{...(n=r.parameters)==null?void 0:n.docs,source:{originalSource:`{
|
|
6
|
+
args: {
|
|
7
|
+
showTitle: false
|
|
8
|
+
}
|
|
9
|
+
}`,...(m=(i=r.parameters)==null?void 0:i.docs)==null?void 0:m.source}}};const S=["Default","WithoutTitle"];export{e as Default,r as WithoutTitle,S as __namedExportsOrder,E as default};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{j as o}from"./jsx-runtime-DiklIkkE.js";import{C as l}from"./CustomerInfo-Cp0u57C5.js";import{C as u,S as p,c as d,D as f}from"./useCheckoutContext-C6u4Rp5U.js";import"./index-DRjF_FHU.js";import"./ValidateInput-sZgX3GCF.js";d(f);const h=[{sku:"TEST001",offerPricePoint:p.SINGLE}],E={component:l,title:"Components/CustomerInfo",parameters:{docs:{description:{component:"Customer information form component for collecting customer details (first name, last name, email, phone). Requires CheckoutProvider wrapper."}}},decorators:[c=>o.jsx(u,{cart:h,children:o.jsx(c,{})})],argTypes:{showTitle:{description:'Whether to display the title "Customer Information"',control:"boolean",table:{type:{summary:"boolean"},defaultValue:{summary:"true"}}}}},e={args:{showTitle:!0}},r={args:{showTitle:!1}};var t,s,a;e.parameters={...e.parameters,docs:{...(t=e.parameters)==null?void 0:t.docs,source:{originalSource:`{
|
|
2
|
+
args: {
|
|
3
|
+
showTitle: true
|
|
4
|
+
}
|
|
5
|
+
}`,...(a=(s=e.parameters)==null?void 0:s.docs)==null?void 0:a.source}}};var n,i,m;r.parameters={...r.parameters,docs:{...(n=r.parameters)==null?void 0:n.docs,source:{originalSource:`{
|
|
6
|
+
args: {
|
|
7
|
+
showTitle: false
|
|
8
|
+
}
|
|
9
|
+
}`,...(m=(i=r.parameters)==null?void 0:i.docs)==null?void 0:m.source}}};const S=["Default","WithoutTitle"];export{e as Default,r as WithoutTitle,S as __namedExportsOrder,E as default};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{j as o}from"./jsx-runtime-DiklIkkE.js";import{C as l}from"./CustomerInfo-D3WHpN32.js";import{C as u,S as p,c as d,D as f}from"./useCheckoutContext-DuJ1Ep0-.js";import"./index-DRjF_FHU.js";import"./ValidateInput-DcnOO9py.js";d(f);const h=[{sku:"TEST001",offerPricePoint:p.SINGLE}],E={component:l,title:"Components/CustomerInfo",parameters:{docs:{description:{component:"Customer information form component for collecting customer details (first name, last name, email, phone). Requires CheckoutProvider wrapper."}}},decorators:[c=>o.jsx(u,{cart:h,children:o.jsx(c,{})})],argTypes:{showTitle:{description:'Whether to display the title "Customer Information"',control:"boolean",table:{type:{summary:"boolean"},defaultValue:{summary:"true"}}}}},e={args:{showTitle:!0}},r={args:{showTitle:!1}};var t,s,a;e.parameters={...e.parameters,docs:{...(t=e.parameters)==null?void 0:t.docs,source:{originalSource:`{
|
|
2
|
+
args: {
|
|
3
|
+
showTitle: true
|
|
4
|
+
}
|
|
5
|
+
}`,...(a=(s=e.parameters)==null?void 0:s.docs)==null?void 0:a.source}}};var n,i,m;r.parameters={...r.parameters,docs:{...(n=r.parameters)==null?void 0:n.docs,source:{originalSource:`{
|
|
6
|
+
args: {
|
|
7
|
+
showTitle: false
|
|
8
|
+
}
|
|
9
|
+
}`,...(m=(i=r.parameters)==null?void 0:i.docs)==null?void 0:m.source}}};const S=["Default","WithoutTitle"];export{e as Default,r as WithoutTitle,S as __namedExportsOrder,E as default};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{j as o}from"./jsx-runtime-DiklIkkE.js";import{C as l}from"./CustomerInfo-CdeZHMcz.js";import{C as u,S as p,c as d,D as f}from"./useCheckoutContext-Cyg-MLQs.js";import"./index-DRjF_FHU.js";import"./ValidateInput-C6pnsZFe.js";d(f);const h=[{sku:"TEST001",offerPricePoint:p.SINGLE}],E={component:l,title:"Components/CustomerInfo",parameters:{docs:{description:{component:"Customer information form component for collecting customer details (first name, last name, email, phone). Requires CheckoutProvider wrapper."}}},decorators:[c=>o.jsx(u,{cart:h,children:o.jsx(c,{})})],argTypes:{showTitle:{description:'Whether to display the title "Customer Information"',control:"boolean",table:{type:{summary:"boolean"},defaultValue:{summary:"true"}}}}},e={args:{showTitle:!0}},r={args:{showTitle:!1}};var t,s,a;e.parameters={...e.parameters,docs:{...(t=e.parameters)==null?void 0:t.docs,source:{originalSource:`{
|
|
2
|
+
args: {
|
|
3
|
+
showTitle: true
|
|
4
|
+
}
|
|
5
|
+
}`,...(a=(s=e.parameters)==null?void 0:s.docs)==null?void 0:a.source}}};var n,i,m;r.parameters={...r.parameters,docs:{...(n=r.parameters)==null?void 0:n.docs,source:{originalSource:`{
|
|
6
|
+
args: {
|
|
7
|
+
showTitle: false
|
|
8
|
+
}
|
|
9
|
+
}`,...(m=(i=r.parameters)==null?void 0:i.docs)==null?void 0:m.source}}};const S=["Default","WithoutTitle"];export{e as Default,r as WithoutTitle,S as __namedExportsOrder,E as default};
|