@betterstore/react 0.7.1 → 0.7.3

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.
Files changed (123) hide show
  1. package/dist/components/checkout-embed/appearance.d.ts +1 -2
  2. package/dist/components/checkout-embed/checkout-form-loading.d.ts +0 -1
  3. package/dist/components/checkout-embed/checkout-form.d.ts +6 -6
  4. package/dist/components/checkout-embed/checkout-schema.d.ts +41 -34
  5. package/dist/components/checkout-embed/color-utils.d.ts +0 -1
  6. package/dist/components/checkout-embed/index.d.ts +4 -5
  7. package/dist/components/checkout-embed/steps/customer/address-utils.d.ts +1 -2
  8. package/dist/components/checkout-embed/steps/customer/form.d.ts +15 -10
  9. package/dist/components/checkout-embed/steps/payment/form.d.ts +29 -20
  10. package/dist/components/checkout-embed/steps/payment/icons.d.ts +0 -1
  11. package/dist/components/checkout-embed/steps/shipping/form.d.ts +29 -17
  12. package/dist/components/checkout-embed/steps/shipping/providers/zasilkovna.d.ts +1 -2
  13. package/dist/components/checkout-embed/steps/shipping/shipping-option-wrapper.d.ts +2 -3
  14. package/dist/components/checkout-embed/steps/summary/discount-code.d.ts +0 -1
  15. package/dist/components/checkout-embed/steps/summary/index.d.ts +1 -2
  16. package/dist/components/checkout-embed/steps/summary/loading.d.ts +0 -1
  17. package/dist/components/checkout-embed/useFormStore.d.ts +4 -5
  18. package/dist/components/{compounds/form → form}/address-input/country-data.d.ts +1 -1
  19. package/dist/components/form/address-input/index.d.ts +11 -0
  20. package/dist/components/{compounds/form → form}/address-input/province-data.d.ts +0 -1
  21. package/dist/components/form/compobox-controller/index.d.ts +17 -0
  22. package/dist/components/form/country-input/index.d.ts +10 -0
  23. package/dist/components/{compounds/form → form}/floating-label.d.ts +0 -1
  24. package/dist/components/{compounds/form → form}/form-messages.d.ts +0 -1
  25. package/dist/components/form/input-controller.d.ts +10 -0
  26. package/dist/components/form/phone-input/component.d.ts +8 -0
  27. package/dist/components/form/phone-input/index.d.ts +12 -0
  28. package/dist/components/form/phone-input/schema.d.ts +3 -0
  29. package/dist/components/{compounds/form → form}/submit-button.d.ts +1 -2
  30. package/dist/components/index.d.ts +3 -4
  31. package/dist/components/payment-element/checkout-form.d.ts +1 -2
  32. package/dist/components/payment-element/index.d.ts +3 -4
  33. package/dist/components/payment-element/useCheckout.d.ts +1 -2
  34. package/dist/components/ui/button.d.ts +3 -4
  35. package/dist/components/ui/checkbox.d.ts +1 -2
  36. package/dist/components/ui/command.d.ts +6 -5
  37. package/dist/components/ui/dialog.d.ts +3 -2
  38. package/dist/components/ui/dropdown-menu.d.ts +2 -3
  39. package/dist/components/ui/form.d.ts +6 -7
  40. package/dist/components/ui/input.d.ts +0 -1
  41. package/dist/components/ui/label.d.ts +1 -2
  42. package/dist/components/ui/popover.d.ts +2 -3
  43. package/dist/components/ui/radio-group.d.ts +1 -2
  44. package/dist/components/ui/scroll-area.d.ts +5 -0
  45. package/dist/components/ui/skeleton.d.ts +0 -2
  46. package/dist/components/ui/sonner.d.ts +1 -2
  47. package/dist/dev/dev.d.ts +0 -2
  48. package/dist/dev/generate-test-checkout.d.ts +1 -0
  49. package/dist/hooks/index.d.ts +1 -0
  50. package/dist/{components/cart/useCart.d.ts → hooks/use-cart.d.ts} +19 -2
  51. package/dist/i18n/index.d.ts +2 -4
  52. package/dist/index.cjs.js +67 -38483
  53. package/dist/index.d.ts +3 -3
  54. package/dist/index.es.js +31500 -0
  55. package/dist/lib/error-message-utils.d.ts +1 -2
  56. package/dist/lib/utils.d.ts +1 -2
  57. package/dist/stores/checkout-form-store.d.ts +24 -0
  58. package/dist/stores/index.d.ts +2 -0
  59. package/dist/stores/payment-checkout-store.d.ts +9 -0
  60. package/dist/types/checkout.d.ts +1 -0
  61. package/dist/types/index.d.ts +2 -0
  62. package/dist/types/locale.d.ts +2 -0
  63. package/dist/types.d.ts +1 -2
  64. package/dist/utils/address.d.ts +2 -0
  65. package/dist/utils/checkout.d.ts +4 -0
  66. package/dist/utils/error-message.d.ts +4 -0
  67. package/dist/utils/index.d.ts +4 -0
  68. package/dist/utils/payment.d.ts +7 -0
  69. package/package.json +25 -27
  70. package/dist/components/cart/useCart.d.ts.map +0 -1
  71. package/dist/components/checkout-embed/appearance.d.ts.map +0 -1
  72. package/dist/components/checkout-embed/checkout-form-loading.d.ts.map +0 -1
  73. package/dist/components/checkout-embed/checkout-form.d.ts.map +0 -1
  74. package/dist/components/checkout-embed/checkout-schema.d.ts.map +0 -1
  75. package/dist/components/checkout-embed/color-utils.d.ts.map +0 -1
  76. package/dist/components/checkout-embed/index.d.ts.map +0 -1
  77. package/dist/components/checkout-embed/steps/customer/address-utils.d.ts.map +0 -1
  78. package/dist/components/checkout-embed/steps/customer/form.d.ts.map +0 -1
  79. package/dist/components/checkout-embed/steps/payment/form.d.ts.map +0 -1
  80. package/dist/components/checkout-embed/steps/payment/icons.d.ts.map +0 -1
  81. package/dist/components/checkout-embed/steps/shipping/form.d.ts.map +0 -1
  82. package/dist/components/checkout-embed/steps/shipping/providers/zasilkovna.d.ts.map +0 -1
  83. package/dist/components/checkout-embed/steps/shipping/shipping-option-wrapper.d.ts.map +0 -1
  84. package/dist/components/checkout-embed/steps/summary/discount-code.d.ts.map +0 -1
  85. package/dist/components/checkout-embed/steps/summary/index.d.ts.map +0 -1
  86. package/dist/components/checkout-embed/steps/summary/loading.d.ts.map +0 -1
  87. package/dist/components/checkout-embed/useFormStore.d.ts.map +0 -1
  88. package/dist/components/compounds/form/address-input/country-data.d.ts.map +0 -1
  89. package/dist/components/compounds/form/address-input/index.d.ts +0 -12
  90. package/dist/components/compounds/form/address-input/index.d.ts.map +0 -1
  91. package/dist/components/compounds/form/address-input/province-data.d.ts.map +0 -1
  92. package/dist/components/compounds/form/compobox-group/index.d.ts +0 -18
  93. package/dist/components/compounds/form/compobox-group/index.d.ts.map +0 -1
  94. package/dist/components/compounds/form/country-input/index.d.ts +0 -11
  95. package/dist/components/compounds/form/country-input/index.d.ts.map +0 -1
  96. package/dist/components/compounds/form/floating-label.d.ts.map +0 -1
  97. package/dist/components/compounds/form/form-messages.d.ts.map +0 -1
  98. package/dist/components/compounds/form/input-group.d.ts +0 -11
  99. package/dist/components/compounds/form/input-group.d.ts.map +0 -1
  100. package/dist/components/compounds/form/submit-button.d.ts.map +0 -1
  101. package/dist/components/index.d.ts.map +0 -1
  102. package/dist/components/payment-element/checkout-form.d.ts.map +0 -1
  103. package/dist/components/payment-element/index.d.ts.map +0 -1
  104. package/dist/components/payment-element/useCheckout.d.ts.map +0 -1
  105. package/dist/components/ui/button.d.ts.map +0 -1
  106. package/dist/components/ui/checkbox.d.ts.map +0 -1
  107. package/dist/components/ui/command.d.ts.map +0 -1
  108. package/dist/components/ui/dialog.d.ts.map +0 -1
  109. package/dist/components/ui/dropdown-menu.d.ts.map +0 -1
  110. package/dist/components/ui/form.d.ts.map +0 -1
  111. package/dist/components/ui/input.d.ts.map +0 -1
  112. package/dist/components/ui/label.d.ts.map +0 -1
  113. package/dist/components/ui/popover.d.ts.map +0 -1
  114. package/dist/components/ui/radio-group.d.ts.map +0 -1
  115. package/dist/components/ui/skeleton.d.ts.map +0 -1
  116. package/dist/components/ui/sonner.d.ts.map +0 -1
  117. package/dist/dev/dev.d.ts.map +0 -1
  118. package/dist/i18n/index.d.ts.map +0 -1
  119. package/dist/index.d.ts.map +0 -1
  120. package/dist/index.mjs +0 -38461
  121. package/dist/lib/error-message-utils.d.ts.map +0 -1
  122. package/dist/lib/utils.d.ts.map +0 -1
  123. package/dist/types.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- import { Appearance as StripeAppearance, StripeElementsOptions } from "@stripe/stripe-js";
1
+ import { Appearance as StripeAppearance, StripeElementsOptions } from '@stripe/stripe-js';
2
2
  export type Themes = "dark" | "light";
3
3
  export type Fonts = StripeElementsOptions["fonts"];
4
4
  export type AppearanceConfig = {
@@ -27,4 +27,3 @@ export type AppearanceConfig = {
27
27
  };
28
28
  };
29
29
  export declare const convertCheckoutAppearanceToStripeAppearance: (appearance?: AppearanceConfig, fonts?: Fonts) => StripeAppearance;
30
- //# sourceMappingURL=appearance.d.ts.map
@@ -1,2 +1 @@
1
1
  export default function CheckoutFormLoading(): import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=checkout-form-loading.d.ts.map
@@ -1,13 +1,14 @@
1
- import { createBetterStoreClient, GetCheckoutResponse } from "@betterstore/sdk";
2
- import { StripeElementLocale } from "@stripe/stripe-js";
3
- import { AppearanceConfig, Fonts } from "./appearance";
1
+ import { createBetterStoreClient, GetCheckoutResponse } from '@betterstore/sdk';
2
+ import { StripeElementLocale } from '@stripe/stripe-js';
3
+ import { AppearanceConfig, Fonts } from './appearance';
4
4
  interface CheckoutFormProps {
5
5
  storeClient: ReturnType<typeof createBetterStoreClient>;
6
6
  checkoutId: string;
7
7
  onSuccess: () => void;
8
8
  onError: () => void;
9
9
  cancelUrl: string;
10
- clientSecret: string;
10
+ checkoutSecret: string;
11
+ customerData?: GetCheckoutResponse["customerData"];
11
12
  customer?: GetCheckoutResponse["customer"];
12
13
  currency: string;
13
14
  checkoutAppearance?: AppearanceConfig;
@@ -24,6 +25,5 @@ interface CheckoutFormProps {
24
25
  currentAlpha3CountryCode?: string;
25
26
  shipments: GetCheckoutResponse["shipments"];
26
27
  }
27
- export default function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl, clientSecret, customer, currency, checkoutAppearance, fonts, locale, setShippingCost, exchangeRate, paymentSecret, publicKey, paymentComponentKey, clientProxy, latitude, longitude, currentAlpha3CountryCode, shipments, }: CheckoutFormProps): import("react/jsx-runtime").JSX.Element;
28
+ export default function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl, checkoutSecret, customer, customerData, currency, checkoutAppearance, fonts, locale, setShippingCost, exchangeRate, paymentSecret, publicKey, paymentComponentKey, clientProxy, latitude, longitude, currentAlpha3CountryCode, shipments, }: CheckoutFormProps): import("react/jsx-runtime").JSX.Element;
28
29
  export {};
29
- //# sourceMappingURL=checkout-form.d.ts.map
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod';
2
2
  export declare const customerSchema: z.ZodObject<{
3
3
  email: z.ZodString;
4
4
  firstName: z.ZodString;
@@ -34,8 +34,9 @@ export declare const customerSchema: z.ZodObject<{
34
34
  provinceCode?: string | null | undefined;
35
35
  company?: string | null | undefined;
36
36
  }>;
37
- phone: z.ZodString;
38
- isEmailSubscribed: z.ZodOptional<z.ZodBoolean>;
37
+ phone: z.ZodEffects<z.ZodString, string, string>;
38
+ isSubscribedEmail: z.ZodOptional<z.ZodBoolean>;
39
+ isSubscribedSMS: z.ZodOptional<z.ZodBoolean>;
39
40
  }, "strip", z.ZodTypeAny, {
40
41
  email: string;
41
42
  firstName: string;
@@ -52,7 +53,8 @@ export declare const customerSchema: z.ZodObject<{
52
53
  company?: string | null | undefined;
53
54
  };
54
55
  phone: string;
55
- isEmailSubscribed?: boolean | undefined;
56
+ isSubscribedEmail?: boolean | undefined;
57
+ isSubscribedSMS?: boolean | undefined;
56
58
  }, {
57
59
  email: string;
58
60
  firstName: string;
@@ -69,41 +71,42 @@ export declare const customerSchema: z.ZodObject<{
69
71
  company?: string | null | undefined;
70
72
  };
71
73
  phone: string;
72
- isEmailSubscribed?: boolean | undefined;
74
+ isSubscribedEmail?: boolean | undefined;
75
+ isSubscribedSMS?: boolean | undefined;
73
76
  }>;
74
77
  export declare const shipmentsFormSchema: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
75
78
  rateId: z.ZodString;
76
- providerId: z.ZodOptional<z.ZodString>;
79
+ carrierId: z.ZodOptional<z.ZodString>;
77
80
  priceInCents: z.ZodNumber;
78
81
  pickupPointId: z.ZodOptional<z.ZodString>;
79
82
  pickupPointDisplayName: z.ZodOptional<z.ZodString>;
80
83
  displayName: z.ZodString;
81
84
  }, "strip", z.ZodTypeAny, {
82
85
  priceInCents: number;
83
- displayName: string;
84
86
  rateId: string;
85
- providerId?: string | undefined;
87
+ displayName: string;
88
+ carrierId?: string | undefined;
86
89
  pickupPointId?: string | undefined;
87
90
  pickupPointDisplayName?: string | undefined;
88
91
  }, {
89
92
  priceInCents: number;
90
- displayName: string;
91
93
  rateId: string;
92
- providerId?: string | undefined;
94
+ displayName: string;
95
+ carrierId?: string | undefined;
93
96
  pickupPointId?: string | undefined;
94
97
  pickupPointDisplayName?: string | undefined;
95
98
  }>>, Record<string, {
96
99
  priceInCents: number;
97
- displayName: string;
98
100
  rateId: string;
99
- providerId?: string | undefined;
101
+ displayName: string;
102
+ carrierId?: string | undefined;
100
103
  pickupPointId?: string | undefined;
101
104
  pickupPointDisplayName?: string | undefined;
102
105
  }>, Record<string, {
103
106
  priceInCents: number;
104
- displayName: string;
105
107
  rateId: string;
106
- providerId?: string | undefined;
108
+ displayName: string;
109
+ carrierId?: string | undefined;
107
110
  pickupPointId?: string | undefined;
108
111
  pickupPointDisplayName?: string | undefined;
109
112
  }>>;
@@ -143,8 +146,9 @@ export declare const checkoutSchema: z.ZodObject<{
143
146
  provinceCode?: string | null | undefined;
144
147
  company?: string | null | undefined;
145
148
  }>;
146
- phone: z.ZodString;
147
- isEmailSubscribed: z.ZodOptional<z.ZodBoolean>;
149
+ phone: z.ZodEffects<z.ZodString, string, string>;
150
+ isSubscribedEmail: z.ZodOptional<z.ZodBoolean>;
151
+ isSubscribedSMS: z.ZodOptional<z.ZodBoolean>;
148
152
  }, "strip", z.ZodTypeAny, {
149
153
  email: string;
150
154
  firstName: string;
@@ -161,7 +165,8 @@ export declare const checkoutSchema: z.ZodObject<{
161
165
  company?: string | null | undefined;
162
166
  };
163
167
  phone: string;
164
- isEmailSubscribed?: boolean | undefined;
168
+ isSubscribedEmail?: boolean | undefined;
169
+ isSubscribedSMS?: boolean | undefined;
165
170
  }, {
166
171
  email: string;
167
172
  firstName: string;
@@ -178,41 +183,42 @@ export declare const checkoutSchema: z.ZodObject<{
178
183
  company?: string | null | undefined;
179
184
  };
180
185
  phone: string;
181
- isEmailSubscribed?: boolean | undefined;
186
+ isSubscribedEmail?: boolean | undefined;
187
+ isSubscribedSMS?: boolean | undefined;
182
188
  }>;
183
189
  shipping: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
184
190
  rateId: z.ZodString;
185
- providerId: z.ZodOptional<z.ZodString>;
191
+ carrierId: z.ZodOptional<z.ZodString>;
186
192
  priceInCents: z.ZodNumber;
187
193
  pickupPointId: z.ZodOptional<z.ZodString>;
188
194
  pickupPointDisplayName: z.ZodOptional<z.ZodString>;
189
195
  displayName: z.ZodString;
190
196
  }, "strip", z.ZodTypeAny, {
191
197
  priceInCents: number;
192
- displayName: string;
193
198
  rateId: string;
194
- providerId?: string | undefined;
199
+ displayName: string;
200
+ carrierId?: string | undefined;
195
201
  pickupPointId?: string | undefined;
196
202
  pickupPointDisplayName?: string | undefined;
197
203
  }, {
198
204
  priceInCents: number;
199
- displayName: string;
200
205
  rateId: string;
201
- providerId?: string | undefined;
206
+ displayName: string;
207
+ carrierId?: string | undefined;
202
208
  pickupPointId?: string | undefined;
203
209
  pickupPointDisplayName?: string | undefined;
204
210
  }>>, Record<string, {
205
211
  priceInCents: number;
206
- displayName: string;
207
212
  rateId: string;
208
- providerId?: string | undefined;
213
+ displayName: string;
214
+ carrierId?: string | undefined;
209
215
  pickupPointId?: string | undefined;
210
216
  pickupPointDisplayName?: string | undefined;
211
217
  }>, Record<string, {
212
218
  priceInCents: number;
213
- displayName: string;
214
219
  rateId: string;
215
- providerId?: string | undefined;
220
+ displayName: string;
221
+ carrierId?: string | undefined;
216
222
  pickupPointId?: string | undefined;
217
223
  pickupPointDisplayName?: string | undefined;
218
224
  }>>;
@@ -234,13 +240,14 @@ export declare const checkoutSchema: z.ZodObject<{
234
240
  company?: string | null | undefined;
235
241
  };
236
242
  phone: string;
237
- isEmailSubscribed?: boolean | undefined;
243
+ isSubscribedEmail?: boolean | undefined;
244
+ isSubscribedSMS?: boolean | undefined;
238
245
  };
239
246
  shipping: Record<string, {
240
247
  priceInCents: number;
241
- displayName: string;
242
248
  rateId: string;
243
- providerId?: string | undefined;
249
+ displayName: string;
250
+ carrierId?: string | undefined;
244
251
  pickupPointId?: string | undefined;
245
252
  pickupPointDisplayName?: string | undefined;
246
253
  }>;
@@ -262,13 +269,14 @@ export declare const checkoutSchema: z.ZodObject<{
262
269
  company?: string | null | undefined;
263
270
  };
264
271
  phone: string;
265
- isEmailSubscribed?: boolean | undefined;
272
+ isSubscribedEmail?: boolean | undefined;
273
+ isSubscribedSMS?: boolean | undefined;
266
274
  };
267
275
  shipping: Record<string, {
268
276
  priceInCents: number;
269
- displayName: string;
270
277
  rateId: string;
271
- providerId?: string | undefined;
278
+ displayName: string;
279
+ carrierId?: string | undefined;
272
280
  pickupPointId?: string | undefined;
273
281
  pickupPointDisplayName?: string | undefined;
274
282
  }>;
@@ -277,4 +285,3 @@ export declare const checkoutSchema: z.ZodObject<{
277
285
  export type CheckoutFormData = z.infer<typeof checkoutSchema>;
278
286
  export type CustomerFormData = z.infer<typeof customerSchema>;
279
287
  export type ShipmentsFormData = z.infer<typeof shipmentsFormSchema>;
280
- //# sourceMappingURL=checkout-schema.d.ts.map
@@ -1,2 +1 @@
1
1
  export declare const formatColor: (color: string) => string;
2
- //# sourceMappingURL=color-utils.d.ts.map
@@ -1,10 +1,10 @@
1
- import { Locale } from "@/react/i18n";
2
- import React from "react";
3
- import { AppearanceConfig, Fonts } from "./appearance";
1
+ import { Locale } from '../../types';
2
+ import { default as React } from 'react';
3
+ import { AppearanceConfig, Fonts } from './appearance';
4
4
  interface CheckoutEmbedProps {
5
5
  checkoutId: string;
6
6
  config: {
7
- clientSecret: string;
7
+ checkoutSecret: string;
8
8
  cancelUrl: string;
9
9
  successUrl: string;
10
10
  appearance?: AppearanceConfig;
@@ -16,4 +16,3 @@ interface CheckoutEmbedProps {
16
16
  declare function CheckoutEmbedComponent({ checkoutId, config }: CheckoutEmbedProps): import("react/jsx-runtime").JSX.Element;
17
17
  declare const CheckoutEmbed: React.MemoExoticComponent<typeof CheckoutEmbedComponent>;
18
18
  export { CheckoutEmbed };
19
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,2 @@
1
- import { CustomerFormData } from "../../checkout-schema";
1
+ import { CustomerFormData } from '../../checkout-schema';
2
2
  export declare const formatAddress: (address: CustomerFormData["address"]) => string;
3
- //# sourceMappingURL=address-utils.d.ts.map
@@ -1,14 +1,19 @@
1
- import { type CustomerFormData } from "../../checkout-schema";
1
+ import { CustomerFormData } from '../../checkout-schema';
2
2
  interface CustomerFormProps {
3
- initialData?: CustomerFormData;
4
- onSubmit: (data: CustomerFormData) => void;
5
- clientProxy?: string;
6
- clientSecret: string;
7
- latitude?: number;
8
- longitude?: number;
9
- currentAlpha3CountryCode?: string;
3
+ form: {
4
+ initialData?: CustomerFormData;
5
+ onSubmit: (data: CustomerFormData) => void;
6
+ };
7
+ api: {
8
+ checkoutSecret: string;
9
+ clientProxy?: string;
10
+ };
11
+ location?: {
12
+ latitude?: number;
13
+ longitude?: number;
14
+ countryCode?: string;
15
+ };
10
16
  locale?: string;
11
17
  }
12
- export default function CustomerForm({ initialData, onSubmit, clientProxy, clientSecret, latitude, longitude, currentAlpha3CountryCode, locale, }: CustomerFormProps): import("react/jsx-runtime").JSX.Element;
18
+ export default function CustomerForm({ form: formProps, api, location, locale, }: CustomerFormProps): import("react/jsx-runtime").JSX.Element;
13
19
  export {};
14
- //# sourceMappingURL=form.d.ts.map
@@ -1,23 +1,32 @@
1
- import { StripeElementLocale } from "@stripe/stripe-js";
2
- import { AppearanceConfig, Fonts } from "../../appearance";
3
- import { FormStore } from "../../useFormStore";
1
+ import { CheckoutFormStore } from '../../../../stores/checkout-form-store';
2
+ import { StripeElementLocale } from '@stripe/stripe-js';
3
+ import { AppearanceConfig, Fonts } from '../../appearance';
4
4
  interface PaymentFormProps {
5
- paymentSecret: string | null;
6
- onSuccess: () => void;
7
- onError: () => void;
8
- onBack: () => void;
9
- onDoubleBack: () => void;
10
- contactEmail: string;
11
- shippingFormData: NonNullable<FormStore["formData"]["shipping"]>;
12
- address: string;
13
- checkoutAppearance?: AppearanceConfig;
14
- fonts?: Fonts;
15
- locale?: StripeElementLocale;
16
- publicKey: string | null;
17
- paymentComponentKey: number;
18
- currency: string;
19
- exchangeRate: number;
5
+ payment: {
6
+ secret: string | null;
7
+ publicKey: string | null;
8
+ componentKey: number;
9
+ };
10
+ callbacks: {
11
+ onSuccess: () => void;
12
+ onError: () => void;
13
+ onBack: () => void;
14
+ onDoubleBack: () => void;
15
+ };
16
+ customerInfo: {
17
+ email: string;
18
+ address: string;
19
+ shippingData: NonNullable<CheckoutFormStore["formData"]["shipping"]>;
20
+ };
21
+ appearance?: {
22
+ config?: AppearanceConfig;
23
+ fonts?: Fonts;
24
+ locale?: StripeElementLocale;
25
+ };
26
+ currency: {
27
+ code: string;
28
+ exchangeRate: number;
29
+ };
20
30
  }
21
- export default function PaymentForm({ paymentSecret, onSuccess, onError, onBack, onDoubleBack, currency, contactEmail, shippingFormData, address, checkoutAppearance, fonts, locale, publicKey, paymentComponentKey, exchangeRate, }: PaymentFormProps): import("react/jsx-runtime").JSX.Element;
31
+ export default function PaymentForm({ payment, callbacks, customerInfo, appearance, currency, }: PaymentFormProps): import("react/jsx-runtime").JSX.Element;
22
32
  export {};
23
- //# sourceMappingURL=form.d.ts.map
@@ -5,4 +5,3 @@ export declare const Icons: {
5
5
  paypal: (props: IconProps) => import("react/jsx-runtime").JSX.Element;
6
6
  };
7
7
  export {};
8
- //# sourceMappingURL=icons.d.ts.map
@@ -1,22 +1,34 @@
1
- import { GetCheckoutResponse, GetShippingRatesResponse } from "@betterstore/sdk";
2
- import { type ShipmentsFormData } from "../../checkout-schema";
3
- import { FormStore } from "../../useFormStore";
1
+ import { GetCheckoutResponse, GetShippingRatesResponse } from '@betterstore/sdk';
2
+ import { ShipmentsFormData } from '../../checkout-schema';
4
3
  export type ShippingRate = GetShippingRatesResponse["rates"][number];
5
4
  interface ShipmentsFormProps {
6
- shippingRates: GetShippingRatesResponse | undefined;
7
- initialData?: ShipmentsFormData;
8
- onSubmit: (data: ShipmentsFormData) => void;
9
- onBack: () => void;
10
- contactEmail: string;
11
- shippingAddress: string;
12
- currency: string;
13
- exchangeRate: number;
5
+ form: {
6
+ initialData?: ShipmentsFormData;
7
+ onSubmit: (data: ShipmentsFormData) => void;
8
+ onBack: () => void;
9
+ };
10
+ shipping: {
11
+ rates: GetShippingRatesResponse | undefined;
12
+ shipments: GetCheckoutResponse["shipments"];
13
+ };
14
+ customer: {
15
+ email: string;
16
+ address: string;
17
+ countryCode?: string;
18
+ };
19
+ currency: {
20
+ code: string;
21
+ exchangeRate: number;
22
+ };
14
23
  locale?: string;
15
- countryCode?: string;
16
- setFormData: FormStore["setFormData"];
17
- formData: FormStore["formData"];
18
- shipments: GetCheckoutResponse["shipments"];
24
+ onShippingDataChange?: (shipmentId: string, data: {
25
+ rateId: string;
26
+ carrierId?: string;
27
+ priceInCents: number;
28
+ displayName: string;
29
+ pickupPointId: string;
30
+ pickupPointDisplayName: string;
31
+ }) => void;
19
32
  }
20
- export default function ShipmentsShippingMethodForm({ shippingRates, initialData, onSubmit, onBack, contactEmail, shippingAddress, currency, exchangeRate, locale, countryCode, setFormData, formData, shipments, }: ShipmentsFormProps): import("react/jsx-runtime").JSX.Element;
33
+ export default function ShipmentsShippingMethodForm({ form: formProps, shipping, customer, currency, locale, onShippingDataChange, }: ShipmentsFormProps): import("react/jsx-runtime").JSX.Element;
21
34
  export {};
22
- //# sourceMappingURL=form.d.ts.map
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import { default as React } from 'react';
2
2
  declare global {
3
3
  interface Window {
4
4
  Packeta: any;
@@ -11,4 +11,3 @@ export default function ZasilkovnaShippingOption({ children, onPickupPointSelect
11
11
  countryCode?: string;
12
12
  apiKey?: string;
13
13
  }): import("react/jsx-runtime").JSX.Element;
14
- //# sourceMappingURL=zasilkovna.d.ts.map
@@ -1,5 +1,5 @@
1
- import React from "react";
2
- import { ShippingRate } from "./form";
1
+ import { default as React } from 'react';
2
+ import { ShippingRate } from './form';
3
3
  export default function ShippingOptionWrapper({ rate, children, onPickupPointSelected, locale, countryCode, }: {
4
4
  rate: ShippingRate;
5
5
  children: React.ReactNode;
@@ -7,4 +7,3 @@ export default function ShippingOptionWrapper({ rate, children, onPickupPointSel
7
7
  locale?: string;
8
8
  countryCode?: string;
9
9
  }): import("react/jsx-runtime").JSX.Element;
10
- //# sourceMappingURL=shipping-option-wrapper.d.ts.map
@@ -1,4 +1,3 @@
1
1
  export default function DiscountCode({ applyDiscountCode, }: {
2
2
  applyDiscountCode: (code: string) => Promise<void>;
3
3
  }): import("react/jsx-runtime").JSX.Element;
4
- //# sourceMappingURL=discount-code.d.ts.map
@@ -1,4 +1,4 @@
1
- import { GetCheckoutResponse } from "@betterstore/sdk";
1
+ import { GetCheckoutResponse } from '@betterstore/sdk';
2
2
  export default function CheckoutSummary({ appliedDiscounts, lineItems, shipping, tax, currency, onCancel, exchangeRate, applyDiscountCode, removeDiscount, }: {
3
3
  appliedDiscounts: GetCheckoutResponse["appliedDiscounts"];
4
4
  lineItems: GetCheckoutResponse["lineItems"];
@@ -10,4 +10,3 @@ export default function CheckoutSummary({ appliedDiscounts, lineItems, shipping,
10
10
  applyDiscountCode: (code: string) => Promise<void>;
11
11
  removeDiscount: (id: string) => Promise<void>;
12
12
  }): import("react/jsx-runtime").JSX.Element;
13
- //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1 @@
1
1
  export default function CheckoutSummaryLoading(): import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=loading.d.ts.map
@@ -1,4 +1,4 @@
1
- import { CheckoutFormData } from "./checkout-schema";
1
+ import { CheckoutFormData } from './checkout-schema';
2
2
  export type CheckoutStep = "customer" | "shipping" | "payment";
3
3
  export interface FormStore {
4
4
  formData: Partial<CheckoutFormData>;
@@ -8,18 +8,17 @@ export interface FormStore {
8
8
  checkoutId: string;
9
9
  setCheckoutId: (checkoutId: string) => void;
10
10
  }
11
- export declare const useFormStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<FormStore>, "setState" | "persist"> & {
11
+ export declare const useFormStore: import('zustand').UseBoundStore<Omit<import('zustand').StoreApi<FormStore>, "setState" | "persist"> & {
12
12
  setState(partial: FormStore | Partial<FormStore> | ((state: FormStore) => FormStore | Partial<FormStore>), replace?: false | undefined): unknown;
13
13
  setState(state: FormStore | ((state: FormStore) => FormStore), replace: true): unknown;
14
14
  persist: {
15
- setOptions: (options: Partial<import("zustand/middleware").PersistOptions<FormStore, FormStore, unknown>>) => void;
15
+ setOptions: (options: Partial<import('zustand/middleware').PersistOptions<FormStore, FormStore, unknown>>) => void;
16
16
  clearStorage: () => void;
17
17
  rehydrate: () => Promise<void> | void;
18
18
  hasHydrated: () => boolean;
19
19
  onHydrate: (fn: (state: FormStore) => void) => () => void;
20
20
  onFinishHydration: (fn: (state: FormStore) => void) => () => void;
21
- getOptions: () => Partial<import("zustand/middleware").PersistOptions<FormStore, FormStore, unknown>>;
21
+ getOptions: () => Partial<import('zustand/middleware').PersistOptions<FormStore, FormStore, unknown>>;
22
22
  };
23
23
  }>;
24
24
  export declare const resetFormStore: (formData: Partial<CheckoutFormData>) => void;
25
- //# sourceMappingURL=useFormStore.d.ts.map
@@ -5,4 +5,4 @@ export interface Country {
5
5
  }
6
6
  export declare const enCountries: Country[];
7
7
  export declare const getCountriesByLocale: (locale?: string) => Country[];
8
- //# sourceMappingURL=country-data.d.ts.map
8
+ export declare const getAlpha2ByAlpha3: (alpha3: string) => string | undefined;
@@ -0,0 +1,11 @@
1
+ interface AddressInputProps {
2
+ className?: string;
3
+ proxy?: string;
4
+ checkoutSecret: string;
5
+ latitude?: number;
6
+ longitude?: number;
7
+ currentAlpha3CountryCode?: string;
8
+ locale?: string;
9
+ }
10
+ export declare function AddressInput({ className, proxy, checkoutSecret, latitude, longitude, currentAlpha3CountryCode, locale, }: AddressInputProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -152,4 +152,3 @@ export declare const countryProvinces: {
152
152
  }];
153
153
  };
154
154
  export declare const countriesWithProvinces: string[];
155
- //# sourceMappingURL=province-data.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { UseFormReturn } from 'react-hook-form';
2
+ type CompoboxControllerProps = {
3
+ form: UseFormReturn<any>;
4
+ name: string;
5
+ label: string;
6
+ options: {
7
+ value: string;
8
+ label: string;
9
+ }[];
10
+ searchText: string;
11
+ emptyText: string;
12
+ required?: boolean;
13
+ className?: string;
14
+ onSelect?: (value: string) => void;
15
+ };
16
+ export default function CompoboxController({ form, name, label, options, searchText, emptyText, required, className, onSelect, }: CompoboxControllerProps): import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ import { default as CompoboxController } from '../compobox-controller';
3
+ type CountryInputProps = {
4
+ locale?: string;
5
+ prefix?: string;
6
+ label?: string;
7
+ className?: string;
8
+ } & Omit<React.ComponentProps<typeof CompoboxController>, "name" | "options">;
9
+ export default function CountryInput({ form, prefix, label, locale, ...props }: CountryInputProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -6,4 +6,3 @@ declare const FloatingLabel: React.ForwardRefExoticComponent<React.LabelHTMLAttr
6
6
  isFormLabel?: boolean;
7
7
  } & React.RefAttributes<HTMLLabelElement>>;
8
8
  export { FloatingLabel };
9
- //# sourceMappingURL=floating-label.d.ts.map
@@ -5,4 +5,3 @@ interface FormMessagesProps extends React.HTMLAttributes<HTMLDivElement> {
5
5
  }
6
6
  export declare function FormMessages({ messages, type, className, ...props }: FormMessagesProps): import("react/jsx-runtime").JSX.Element | null;
7
7
  export {};
8
- //# sourceMappingURL=form-messages.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { Input } from '../ui/input';
2
+ import { default as React } from 'react';
3
+ type InputControllerProps = {
4
+ name: string;
5
+ label?: string;
6
+ icon?: React.ReactNode;
7
+ showIcon?: boolean;
8
+ } & Omit<React.ComponentProps<typeof Input>, "placeholder">;
9
+ export default function InputController({ name, label, className, icon, showIcon, ...props }: InputControllerProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ import * as RPNInput from "react-phone-number-input";
3
+ type PhoneInputComponentProps = Omit<React.ComponentProps<"input">, "onChange" | "value" | "ref"> & Omit<RPNInput.Props<typeof RPNInput.default>, "onChange"> & {
4
+ onChange?: (value: RPNInput.Value) => void;
5
+ locale?: string;
6
+ };
7
+ declare const PhoneInputComponent: React.ForwardRefExoticComponent<PhoneInputComponentProps>;
8
+ export { PhoneInputComponent };
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ import { PhoneInputComponent } from './component';
3
+ type PhoneInputProps = {
4
+ name: string;
5
+ label?: string;
6
+ className?: string;
7
+ defaultCountry?: string;
8
+ required?: boolean;
9
+ locale?: string;
10
+ } & Omit<React.ComponentProps<typeof PhoneInputComponent>, "name" | "defaultCountry" | "international" | "placeholder">;
11
+ export declare function PhoneInput({ name, label, className, defaultCountry, required, locale, ...props }: PhoneInputProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,3 @@
1
+ import { z } from 'zod';
2
+ export declare const phoneInputSchema: z.ZodEffects<z.ZodString, string, string>;
3
+ export declare const phoneInputOptionalSchema: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodString>>, string | null | undefined, string | null | undefined>;
@@ -1,8 +1,7 @@
1
- import { Button } from "@/react/components/ui/button";
1
+ import { Button } from '../ui/button';
2
2
  type SubmitButtonProps = Parameters<typeof Button>[0] & {
3
3
  isSubmitting: boolean;
4
4
  isValid: boolean;
5
5
  };
6
6
  export default function SubmitButton({ isSubmitting, isValid, className, variant, children, size, ...props }: SubmitButtonProps): import("react/jsx-runtime").JSX.Element;
7
7
  export {};
8
- //# sourceMappingURL=submit-button.d.ts.map
@@ -1,4 +1,3 @@
1
- export * from "./cart/useCart";
2
- export { CheckoutEmbed } from "./checkout-embed";
3
- export { useCheckout } from "./payment-element/useCheckout";
4
- //# sourceMappingURL=index.d.ts.map
1
+ export * from '../hooks/use-cart';
2
+ export { CheckoutEmbed } from './checkout-embed';
3
+ export { usePaymentCheckout } from '../stores/payment-checkout-store';
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import { default as React } from 'react';
2
2
  declare const _default: React.MemoExoticComponent<({ onSuccess, onError, children, setSubmitting, }: {
3
3
  onSuccess?: () => void;
4
4
  onError?: () => void;
@@ -6,4 +6,3 @@ declare const _default: React.MemoExoticComponent<({ onSuccess, onError, childre
6
6
  setSubmitting?: (isSubmitting: boolean) => void;
7
7
  }) => import("react/jsx-runtime").JSX.Element>;
8
8
  export default _default;
9
- //# sourceMappingURL=checkout-form.d.ts.map