@betterstore/react 0.5.23 → 0.5.24

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.
@@ -68,37 +68,37 @@ export declare const customerSchema: z.ZodObject<{
68
68
  }>;
69
69
  export declare const shipmentsFormSchema: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
70
70
  rateId: z.ZodString;
71
- provider: z.ZodString;
71
+ providerId: z.ZodOptional<z.ZodString>;
72
72
  priceInCents: z.ZodNumber;
73
- name: z.ZodString;
74
73
  pickupPointId: z.ZodOptional<z.ZodString>;
75
74
  pickupPointDisplayName: z.ZodOptional<z.ZodString>;
75
+ displayName: z.ZodString;
76
76
  }, "strip", z.ZodTypeAny, {
77
77
  priceInCents: number;
78
+ displayName: string;
78
79
  rateId: string;
79
- provider: string;
80
- name: string;
80
+ providerId?: string | undefined;
81
81
  pickupPointId?: string | undefined;
82
82
  pickupPointDisplayName?: string | undefined;
83
83
  }, {
84
84
  priceInCents: number;
85
+ displayName: string;
85
86
  rateId: string;
86
- provider: string;
87
- name: string;
87
+ providerId?: string | undefined;
88
88
  pickupPointId?: string | undefined;
89
89
  pickupPointDisplayName?: string | undefined;
90
90
  }>>, Record<string, {
91
91
  priceInCents: number;
92
+ displayName: string;
92
93
  rateId: string;
93
- provider: string;
94
- name: string;
94
+ providerId?: string | undefined;
95
95
  pickupPointId?: string | undefined;
96
96
  pickupPointDisplayName?: string | undefined;
97
97
  }>, Record<string, {
98
98
  priceInCents: number;
99
+ displayName: string;
99
100
  rateId: string;
100
- provider: string;
101
- name: string;
101
+ providerId?: string | undefined;
102
102
  pickupPointId?: string | undefined;
103
103
  pickupPointDisplayName?: string | undefined;
104
104
  }>>;
@@ -172,37 +172,37 @@ export declare const checkoutSchema: z.ZodObject<{
172
172
  }>;
173
173
  shipping: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
174
174
  rateId: z.ZodString;
175
- provider: z.ZodString;
175
+ providerId: z.ZodOptional<z.ZodString>;
176
176
  priceInCents: z.ZodNumber;
177
- name: z.ZodString;
178
177
  pickupPointId: z.ZodOptional<z.ZodString>;
179
178
  pickupPointDisplayName: z.ZodOptional<z.ZodString>;
179
+ displayName: z.ZodString;
180
180
  }, "strip", z.ZodTypeAny, {
181
181
  priceInCents: number;
182
+ displayName: string;
182
183
  rateId: string;
183
- provider: string;
184
- name: string;
184
+ providerId?: string | undefined;
185
185
  pickupPointId?: string | undefined;
186
186
  pickupPointDisplayName?: string | undefined;
187
187
  }, {
188
188
  priceInCents: number;
189
+ displayName: string;
189
190
  rateId: string;
190
- provider: string;
191
- name: string;
191
+ providerId?: string | undefined;
192
192
  pickupPointId?: string | undefined;
193
193
  pickupPointDisplayName?: string | undefined;
194
194
  }>>, Record<string, {
195
195
  priceInCents: number;
196
+ displayName: string;
196
197
  rateId: string;
197
- provider: string;
198
- name: string;
198
+ providerId?: string | undefined;
199
199
  pickupPointId?: string | undefined;
200
200
  pickupPointDisplayName?: string | undefined;
201
201
  }>, Record<string, {
202
202
  priceInCents: number;
203
+ displayName: string;
203
204
  rateId: string;
204
- provider: string;
205
- name: string;
205
+ providerId?: string | undefined;
206
206
  pickupPointId?: string | undefined;
207
207
  pickupPointDisplayName?: string | undefined;
208
208
  }>>;
@@ -227,9 +227,9 @@ export declare const checkoutSchema: z.ZodObject<{
227
227
  };
228
228
  shipping: Record<string, {
229
229
  priceInCents: number;
230
+ displayName: string;
230
231
  rateId: string;
231
- provider: string;
232
- name: string;
232
+ providerId?: string | undefined;
233
233
  pickupPointId?: string | undefined;
234
234
  pickupPointDisplayName?: string | undefined;
235
235
  }>;
@@ -254,9 +254,9 @@ export declare const checkoutSchema: z.ZodObject<{
254
254
  };
255
255
  shipping: Record<string, {
256
256
  priceInCents: number;
257
+ displayName: string;
257
258
  rateId: string;
258
- provider: string;
259
- name: string;
259
+ providerId?: string | undefined;
260
260
  pickupPointId?: string | undefined;
261
261
  pickupPointDisplayName?: string | undefined;
262
262
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"checkout-schema.d.ts","sourceRoot":"","sources":["../../../src/components/checkout-embed/checkout-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBzB,CAAC;AAYH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAK5B,CAAC;AAGL,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIzB,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
1
+ {"version":3,"file":"checkout-schema.d.ts","sourceRoot":"","sources":["../../../src/components/checkout-embed/checkout-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBzB,CAAC;AAaH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAK5B,CAAC;AAGL,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIzB,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../../src/components/checkout-embed/steps/payment/form.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIxD,OAAO,EACL,gBAAgB,EAEhB,KAAK,EACN,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,UAAU,gBAAgB;IACxB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,aAAa,EACb,SAAS,EACT,OAAO,EACP,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,SAAS,EACT,mBAAmB,GACpB,EAAE,gBAAgB,2CAmGlB"}
1
+ {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../../src/components/checkout-embed/steps/payment/form.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIxD,OAAO,EACL,gBAAgB,EAEhB,KAAK,EACN,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,UAAU,gBAAgB;IACxB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,aAAa,EACb,SAAS,EACT,OAAO,EACP,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,SAAS,EACT,mBAAmB,GACpB,EAAE,gBAAgB,2CAoGlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../../src/components/checkout-embed/steps/shipping/form.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAMjE,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,UAAU,kBAAkB;IAC1B,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,QAAQ,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC5C,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IACtC,QAAQ,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IAChC,SAAS,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;CACzC;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,aAAa,EACb,WAAW,EACX,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,WAAW,EACX,WAAW,EACX,QAAQ,EACR,SAAS,GACV,EAAE,kBAAkB,2CA0FpB"}
1
+ {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../../src/components/checkout-embed/steps/shipping/form.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAMjE,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,UAAU,kBAAkB;IAC1B,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,QAAQ,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC5C,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IACtC,QAAQ,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IAChC,SAAS,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;CACzC;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,aAAa,EACb,WAAW,EACX,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,WAAW,EACX,WAAW,EACX,QAAQ,EACR,SAAS,GACV,EAAE,kBAAkB,2CA2FpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"shipping-option-wrapper.d.ts","sourceRoot":"","sources":["../../../../../src/components/checkout-embed/steps/shipping/shipping-option-wrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,IAAI,EACJ,QAAQ,EACR,qBAAqB,EACrB,MAAM,EACN,WAAW,GACZ,EAAE;IACD,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,qBAAqB,CAAC,EAAE,CACtB,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,MAAM,KACpB,IAAI,CAAC;IACV,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,2CAeA"}
1
+ {"version":3,"file":"shipping-option-wrapper.d.ts","sourceRoot":"","sources":["../../../../../src/components/checkout-embed/steps/shipping/shipping-option-wrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,IAAI,EACJ,QAAQ,EACR,qBAAqB,EACrB,MAAM,EACN,WAAW,GACZ,EAAE;IACD,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,qBAAqB,CAAC,EAAE,CACtB,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,MAAM,KACpB,IAAI,CAAC;IACV,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,2CAkBA"}
package/dist/index.cjs.js CHANGED
@@ -3341,6 +3341,9 @@ const CheckoutEmbed$2 = {
3341
3341
  other: "Váš balíček bude doručen kurýrem.",
3342
3342
  zasilkovna: "Vaše objednávka bude doručena na výdejní místo.",
3343
3343
  shippedTo: "Místo doručení:"
3344
+ },
3345
+ shipment: {
3346
+ title: "Zásilka č."
3344
3347
  }
3345
3348
  }
3346
3349
  };
@@ -3413,9 +3416,21 @@ const CheckoutEmbed$1 = {
3413
3416
  day: "day",
3414
3417
  days: "days",
3415
3418
  description: {
3416
- other: "Your package will be delivered by a courier.",
3417
- zasilkovna: "Your package will be delivered to a pickup point.",
3418
3419
  shippedTo: "Shipped to:"
3420
+ },
3421
+ Shipment: {
3422
+ title: "Shipment No. ",
3423
+ perIdTitles: {
3424
+ "zasilkovna-z_box": "Zásilkovna, Z-Box",
3425
+ "prebuilt-pickup-in-store": "Pickup in store",
3426
+ "prebuilt-local-delivery": "Local delivery"
3427
+ },
3428
+ perIdDescriptions: {
3429
+ fallback: "Your package will be delivered by a courier.",
3430
+ "zasilkovna-z_box": "Your package will be delivered to a pickup point.",
3431
+ "prebuilt-pickup-in-store": "Pickup in store",
3432
+ "prebuilt-local-delivery": "Local delivery"
3433
+ }
3419
3434
  }
3420
3435
  },
3421
3436
  Payment: {
@@ -17258,7 +17273,7 @@ ZodTuple.create;
17258
17273
  const recordType = ZodRecord.create;
17259
17274
  ZodEnum.create;
17260
17275
  ZodPromise.create;
17261
- ZodOptional.create;
17276
+ const optionalType = ZodOptional.create;
17262
17277
  ZodNullable.create;
17263
17278
 
17264
17279
  const phoneRegex = new RegExp(/^([+]?[\s0-9]+)?(\d{3}|[(]?[0-9]+[)])?([-]?[\s]?[0-9])+$/);
@@ -17283,11 +17298,11 @@ const customerSchema = objectType({
17283
17298
  // Shipping method schema
17284
17299
  const shippingMethodSchema = objectType({
17285
17300
  rateId: stringType().min(1, "required_error"),
17286
- provider: stringType().min(1, "required_error"),
17301
+ providerId: optionalType(stringType()),
17287
17302
  priceInCents: numberType().min(1, "required_error"),
17288
- name: stringType().min(1, "required_error"),
17289
17303
  pickupPointId: stringType().optional(),
17290
- pickupPointDisplayName: stringType().optional(),
17304
+ pickupPointDisplayName: stringType().optional(), // Only for display purposes
17305
+ displayName: stringType(), // Only for display purposes
17291
17306
  });
17292
17307
  const shipmentsFormSchema = recordType(stringType(), shippingMethodSchema)
17293
17308
  .refine((data) => Object.keys(data).length > 0, {
@@ -40230,12 +40245,12 @@ function requireReactStripe_umd () {
40230
40245
 
40231
40246
  stripe._registerWrapper({
40232
40247
  name: 'react-stripe-js',
40233
- version: "3.9.1"
40248
+ version: "3.9.2"
40234
40249
  });
40235
40250
 
40236
40251
  stripe.registerAppInfo({
40237
40252
  name: 'react-stripe-js',
40238
- version: "3.9.1",
40253
+ version: "3.9.2",
40239
40254
  url: 'https://stripe.com/docs/stripe-js/react'
40240
40255
  });
40241
40256
  };
@@ -41402,7 +41417,7 @@ var PaymentElement$1 = React.memo(PaymentElement);
41402
41417
  function PaymentForm({ paymentSecret, onSuccess, onError, onBack, onDoubleBack, contactEmail, shippingFormData, address, checkoutAppearance, fonts, locale, publicKey, paymentComponentKey, }) {
41403
41418
  const [isSubmitting, setIsSubmitting] = React.useState(false);
41404
41419
  const { t } = useTranslation();
41405
- return (jsxRuntime.jsxs("div", { className: "space-y-6", children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("h2", { className: "mb-2", children: t("CheckoutEmbed.Payment.title") }), jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: t("CheckoutEmbed.Payment.description") })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxRuntime.jsxs("p", { children: [jsxRuntime.jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.contact") }), " ", jsxRuntime.jsx("span", { className: "text-muted-foreground", children: contactEmail })] }), jsxRuntime.jsx(Button, { variant: "link", size: "link", onClick: onDoubleBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxRuntime.jsxs("p", { children: [jsxRuntime.jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.address") }), " ", jsxRuntime.jsx("span", { className: "text-muted-foreground", children: address })] }), jsxRuntime.jsx(Button, { variant: "link", size: "link", onClick: onDoubleBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxRuntime.jsxs("div", { className: "flex gap-1", children: [jsxRuntime.jsx("p", { className: "font-medium", children: t("CheckoutEmbed.Shipping.shipping") }), " ", jsxRuntime.jsx("div", { className: "text-muted-foreground flex flex-col gap-1", children: Object.entries(shippingFormData).map(([id, shipmentFormData]) => (jsxRuntime.jsxs("p", { children: [shipmentFormData.name, " \u00B7 ", shipmentFormData.priceInCents] }, id))) })] }), jsxRuntime.jsx(Button, { variant: "link", size: "link", onClick: onBack, children: t("CheckoutEmbed.Shipping.change") })] })] }), jsxRuntime.jsx("div", { className: "mt-8", children: paymentSecret && (jsxRuntime.jsx(PaymentElement$1, { fonts: fonts, checkoutAppearance: convertCheckoutAppearanceToStripeAppearance(checkoutAppearance, fonts), locale: locale, paymentSecret: paymentSecret, onSuccess: onSuccess, onError: onError, setSubmitting: setIsSubmitting, publicKey: publicKey, children: jsxRuntime.jsx("div", { className: "fixed bottom-0 left-0 right-0 z-50 mt-8 px-4 sm:static sm:px-0", children: jsxRuntime.jsxs("div", { className: "bg-background flex flex-col-reverse items-center justify-between gap-2 pb-4 sm:flex-row sm:bg-transparent sm:pb-0", children: [jsxRuntime.jsxs(Button, { className: "w-full sm:w-fit", type: "button", variant: "ghost", onClick: onBack, children: [jsxRuntime.jsx(ChevronLeft, {}), t("CheckoutEmbed.Payment.back")] }), jsxRuntime.jsx(SubmitButton, { className: "w-full max-sm:h-[52px] sm:w-fit", isValid: true, isSubmitting: isSubmitting, children: t("CheckoutEmbed.Payment.button") })] }) }) }, paymentComponentKey)) })] }));
41420
+ return (jsxRuntime.jsxs("div", { className: "space-y-6", children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("h2", { className: "mb-2", children: t("CheckoutEmbed.Payment.title") }), jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: t("CheckoutEmbed.Payment.description") })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxRuntime.jsxs("p", { children: [jsxRuntime.jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.contact") }), " ", jsxRuntime.jsx("span", { className: "text-muted-foreground", children: contactEmail })] }), jsxRuntime.jsx(Button, { variant: "link", size: "link", onClick: onDoubleBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxRuntime.jsxs("p", { children: [jsxRuntime.jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.address") }), " ", jsxRuntime.jsx("span", { className: "text-muted-foreground", children: address })] }), jsxRuntime.jsx(Button, { variant: "link", size: "link", onClick: onDoubleBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxRuntime.jsxs("div", { className: "flex gap-1", children: [jsxRuntime.jsx("p", { className: "font-medium", children: t("CheckoutEmbed.Shipping.shipping") }), " ", jsxRuntime.jsx("div", { className: "text-muted-foreground flex flex-col gap-1", children: Object.entries(shippingFormData).map(([id, shipmentFormData]) => (jsxRuntime.jsxs("p", { children: [shipmentFormData.displayName, " \u00B7", " ", shipmentFormData.priceInCents] }, id))) })] }), jsxRuntime.jsx(Button, { variant: "link", size: "link", onClick: onBack, children: t("CheckoutEmbed.Shipping.change") })] })] }), jsxRuntime.jsx("div", { className: "mt-8", children: paymentSecret && (jsxRuntime.jsx(PaymentElement$1, { fonts: fonts, checkoutAppearance: convertCheckoutAppearanceToStripeAppearance(checkoutAppearance, fonts), locale: locale, paymentSecret: paymentSecret, onSuccess: onSuccess, onError: onError, setSubmitting: setIsSubmitting, publicKey: publicKey, children: jsxRuntime.jsx("div", { className: "fixed bottom-0 left-0 right-0 z-50 mt-8 px-4 sm:static sm:px-0", children: jsxRuntime.jsxs("div", { className: "bg-background flex flex-col-reverse items-center justify-between gap-2 pb-4 sm:flex-row sm:bg-transparent sm:pb-0", children: [jsxRuntime.jsxs(Button, { className: "w-full sm:w-fit", type: "button", variant: "ghost", onClick: onBack, children: [jsxRuntime.jsx(ChevronLeft, {}), t("CheckoutEmbed.Payment.back")] }), jsxRuntime.jsx(SubmitButton, { className: "w-full max-sm:h-[52px] sm:w-fit", isValid: true, isSubmitting: isSubmitting, children: t("CheckoutEmbed.Payment.button") })] }) }) }, paymentComponentKey)) })] }));
41406
41421
  }
41407
41422
 
41408
41423
  function Skeleton(_a) {
@@ -41452,7 +41467,8 @@ function ZasilkovnaShippingOption({ children, onPickupPointSelected, locale, cou
41452
41467
  }
41453
41468
 
41454
41469
  function ShippingOptionWrapper({ rate, children, onPickupPointSelected, locale, countryCode, }) {
41455
- if (rate.provider === "zasilkovna") {
41470
+ const isAutoRate = rate.type === "CUSTOM_SHIPPING_VENDOR" || rate.type === "PLATFORM_CARRIER";
41471
+ if (isAutoRate && rate.providerId === "zasilkovna") {
41456
41472
  return (jsxRuntime.jsx(ZasilkovnaShippingOption, { onPickupPointSelected: onPickupPointSelected, locale: locale, countryCode: countryCode, apiKey: rate.clientSecret, children: children }));
41457
41473
  }
41458
41474
  return jsxRuntime.jsx(jsxRuntime.Fragment, { children: children });
@@ -41476,42 +41492,49 @@ function ShipmentsForm({ shippingRates, initialData, onSubmit, onBack, contactEm
41476
41492
  ])),
41477
41493
  });
41478
41494
  const isButtonEnabled = Object.values(form.getValues()).every((value) => { var _a; return ((_a = value.rateId) === null || _a === void 0 ? void 0 : _a.length) > 0; });
41479
- return (jsxRuntime.jsxs("div", { className: "space-y-6", children: [jsxRuntime.jsx("h2", { children: t("CheckoutEmbed.Shipping.title") }), jsxRuntime.jsxs("div", { className: "space-y-2 pb-2", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxRuntime.jsxs("p", { children: [jsxRuntime.jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.contact") }), " ", jsxRuntime.jsx("span", { className: "text-muted-foreground", children: contactEmail })] }), jsxRuntime.jsx(Button, { variant: "link", size: "link", onClick: onBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxRuntime.jsxs("p", { children: [jsxRuntime.jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.address") }), " ", jsxRuntime.jsx("span", { className: "text-muted-foreground", children: shippingAddress })] }), jsxRuntime.jsx(Button, { variant: "link", size: "link", onClick: onBack, children: t("CheckoutEmbed.Shipping.change") })] })] }), jsxRuntime.jsx(Form, Object.assign({}, form, { children: jsxRuntime.jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "space-y-4", children: [shipments.map((shipment) => (jsxRuntime.jsx(SingleShipmentSection, { shipment: shipment, shippingRates: shippingRates, form: form, setFormData: setFormData, formData: formData, currency: currency, exchangeRate: exchangeRate, locale: locale, countryCode: countryCode, multipleShipments: shipments.length > 1 }, shipment.id))), jsxRuntime.jsx(FormMessage, { children: (_a = form.formState.errors.root) === null || _a === void 0 ? void 0 : _a.message }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between pt-4", children: [jsxRuntime.jsxs(Button, { type: "button", variant: "ghost", onClick: onBack, children: [jsxRuntime.jsx(ChevronLeft, {}), t("CheckoutEmbed.Shipping.back")] }), jsxRuntime.jsx(SubmitButton, { isSubmitting: form.formState.isSubmitting, isValid: isButtonEnabled, children: t("CheckoutEmbed.Shipping.button") })] })] }) }))] }));
41495
+ return (jsxRuntime.jsxs("div", { className: "space-y-6", children: [jsxRuntime.jsx("h2", { children: t("CheckoutEmbed.Shipping.title") }), jsxRuntime.jsxs("div", { className: "space-y-2 pb-2", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxRuntime.jsxs("p", { children: [jsxRuntime.jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.contact") }), " ", jsxRuntime.jsx("span", { className: "text-muted-foreground", children: contactEmail })] }), jsxRuntime.jsx(Button, { variant: "link", size: "link", onClick: onBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxRuntime.jsxs("p", { children: [jsxRuntime.jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.address") }), " ", jsxRuntime.jsx("span", { className: "text-muted-foreground", children: shippingAddress })] }), jsxRuntime.jsx(Button, { variant: "link", size: "link", onClick: onBack, children: t("CheckoutEmbed.Shipping.change") })] })] }), jsxRuntime.jsx(Form, Object.assign({}, form, { children: jsxRuntime.jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "space-y-4", children: [shipments.map((shipment, index) => (jsxRuntime.jsx(SingleShipmentSection, { shipment: shipment, shippingRates: shippingRates, form: form, setFormData: setFormData, formData: formData, currency: currency, exchangeRate: exchangeRate, locale: locale, countryCode: countryCode, multipleShipments: shipments.length > 1, index: index }, shipment.id))), jsxRuntime.jsx(FormMessage, { children: (_a = form.formState.errors.root) === null || _a === void 0 ? void 0 : _a.message }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between pt-4", children: [jsxRuntime.jsxs(Button, { type: "button", variant: "ghost", onClick: onBack, children: [jsxRuntime.jsx(ChevronLeft, {}), t("CheckoutEmbed.Shipping.back")] }), jsxRuntime.jsx(SubmitButton, { isSubmitting: form.formState.isSubmitting, isValid: isButtonEnabled, children: t("CheckoutEmbed.Shipping.button") })] })] }) }))] }));
41480
41496
  }
41481
- const SingleShipmentSection = ({ shippingRates, form, currency, exchangeRate, locale, countryCode, setFormData, formData, multipleShipments, shipment, }) => {
41482
- var _a;
41497
+ const SingleShipmentSection = ({ shippingRates, form, currency, exchangeRate, locale, countryCode, setFormData, formData, multipleShipments, shipment, index, }) => {
41483
41498
  const { t } = useTranslation();
41484
41499
  const shipmentId = shipment.id;
41485
41500
  const currentRateId = form.watch(`${shipmentId}.rateId`);
41486
41501
  // TODO: construct the headline
41487
- return (jsxRuntime.jsxs("div", { children: [multipleShipments && (jsxRuntime.jsx("h3", { className: "text-lg font-medium", children: (_a = shipment.shipmentData) === null || _a === void 0 ? void 0 : _a.name })), shippingRates.length === 0 &&
41502
+ return (jsxRuntime.jsxs("div", { children: [multipleShipments && (jsxRuntime.jsxs("h3", { className: "text-lg font-medium", children: [t("CheckoutEmbed.Shipping.Shipment.title"), index + 1] })), shippingRates.length === 0 &&
41488
41503
  Array.from({ length: 3 }).map((_, index) => (jsxRuntime.jsx(ShippingRateLoading, {}, index))), shippingRates.map((rate) => {
41504
+ var _a, _b;
41489
41505
  const pickupPointDisplayName = form.watch(`${shipmentId}.pickupPointDisplayName`);
41490
- const rateId = rate.provider + rate.name;
41491
41506
  const intPrice = Math.ceil(Number(rate.priceInCents));
41492
41507
  const displayPrice = storeHelpers.formatPrice(intPrice, currency, exchangeRate);
41493
- const description = rate.provider === "zasilkovna"
41494
- ? t("CheckoutEmbed.Shipping.description.zasilkovna")
41495
- : t("CheckoutEmbed.Shipping.description.other");
41508
+ const isFixedRate = rate.type === "FIXED";
41509
+ const isAutoRate = rate.type === "CUSTOM_SHIPPING_VENDOR" ||
41510
+ rate.type === "PLATFORM_CARRIER";
41511
+ const isZasilkovna = isAutoRate && rate.providerId === "zasilkovna";
41512
+ const name = isFixedRate
41513
+ ? rate.name
41514
+ : ((_a = t(`CheckoutEmbed.Shipping.Shipment.perIdTitles.${rate.id}`)) !== null && _a !== void 0 ? _a : rate.id);
41515
+ const fallbackDescription = t(`CheckoutEmbed.Shipping.Shipment.perIdDescriptions.fallback`);
41516
+ const description = (_b = (isFixedRate
41517
+ ? rate.description
41518
+ : t(`CheckoutEmbed.Shipping.Shipment.perIdDescriptions.${rate.id}`))) !== null && _b !== void 0 ? _b : fallbackDescription;
41496
41519
  return (jsxRuntime.jsx(ShippingOptionWrapper, { rate: rate, onPickupPointSelected: (pickupPointId, pickupPointName) => {
41497
41520
  const newData = {
41498
- rateId,
41499
- provider: rate.provider,
41521
+ rateId: rate.id,
41522
+ providerId: isAutoRate ? rate.providerId : undefined,
41500
41523
  priceInCents: intPrice,
41501
- name: rate.name,
41502
- pickupPointId: rate.provider === "zasilkovna" ? pickupPointId : "",
41503
- pickupPointDisplayName: rate.provider === "zasilkovna" ? pickupPointName : "",
41524
+ displayName: name,
41525
+ pickupPointId: isZasilkovna ? pickupPointId : "",
41526
+ pickupPointDisplayName: isZasilkovna ? pickupPointName : "",
41504
41527
  };
41505
41528
  form.setValue(`${shipmentId}.rateId`, newData.rateId);
41506
- form.setValue(`${shipmentId}.provider`, newData.provider);
41507
- form.setValue(`${shipmentId}.name`, newData.name);
41529
+ form.setValue(`${shipmentId}.providerId`, newData.providerId);
41530
+ form.setValue(`${shipmentId}.displayName`, newData.displayName);
41508
41531
  form.setValue(`${shipmentId}.priceInCents`, newData.priceInCents);
41509
41532
  form.setValue(`${shipmentId}.pickupPointId`, newData.pickupPointId);
41510
41533
  form.setValue(`${shipmentId}.pickupPointDisplayName`, newData.pickupPointDisplayName);
41511
41534
  setFormData(Object.assign(Object.assign({}, formData), { shipping: Object.assign(Object.assign({}, formData.shipping), { [shipmentId]: newData }) }));
41512
41535
  }, locale: locale, countryCode: countryCode, children: jsxRuntime.jsxs("div", { className: clsx("bg-background cursor-pointer rounded-md border p-4", {
41513
- "bg-muted border-primary": currentRateId === rateId,
41514
- }), children: [jsxRuntime.jsxs("div", { className: "flex w-full items-center justify-between", children: [jsxRuntime.jsx("p", { children: rate.name }), jsxRuntime.jsx("p", { children: displayPrice })] }), jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: description }), pickupPointDisplayName && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("hr", { className: "my-2" }), jsxRuntime.jsxs("p", { className: "text-muted-foreground text-sm", children: [t("CheckoutEmbed.Shipping.description.shippedTo"), " ", jsxRuntime.jsx("span", { className: "text-foreground", children: pickupPointDisplayName })] })] }))] }) }, rateId));
41536
+ "bg-muted border-primary": currentRateId === rate.id,
41537
+ }), children: [jsxRuntime.jsxs("div", { className: "flex w-full items-center justify-between", children: [jsxRuntime.jsx("p", { children: name }), jsxRuntime.jsx("p", { children: displayPrice })] }), jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: description }), pickupPointDisplayName && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("hr", { className: "my-2" }), jsxRuntime.jsxs("p", { className: "text-muted-foreground text-sm", children: [t("CheckoutEmbed.Shipping.description.shippedTo"), " ", jsxRuntime.jsx("span", { className: "text-foreground", children: pickupPointDisplayName })] })] }))] }) }, rate.id));
41515
41538
  })] }));
41516
41539
  };
41517
41540
  function ShippingRateLoading() {
@@ -41671,10 +41694,10 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
41671
41694
  const shipments = Object.entries(data).map(([id, shipmentFormData]) => ({
41672
41695
  id: id,
41673
41696
  shipmentData: {
41674
- provider: shipmentFormData.provider,
41675
- pickupPointId: shipmentFormData.pickupPointId,
41676
- name: shipmentFormData.name,
41697
+ rateId: shipmentFormData.rateId,
41698
+ providerId: shipmentFormData.providerId,
41677
41699
  priceInCents: shipmentFormData.priceInCents,
41700
+ pickupPointId: shipmentFormData.pickupPointId,
41678
41701
  },
41679
41702
  }));
41680
41703
  yield storeClient.updateCheckout(clientSecret, checkoutId, {
@@ -41882,7 +41905,7 @@ function CheckoutEmbedComponent({ checkoutId, config }) {
41882
41905
  const [totalShipping, setTotalShipping] = React.useState(null);
41883
41906
  React.useEffect(() => {
41884
41907
  if (checkout) {
41885
- const areAllShipmentsFilled = checkout.shipments.every((shipment) => { var _a; return (_a = shipment.shipmentData) === null || _a === void 0 ? void 0 : _a.provider; });
41908
+ const areAllShipmentsFilled = checkout.shipments.every((shipment) => { var _a; return (_a = shipment.shipmentData) === null || _a === void 0 ? void 0 : _a.rateId; });
41886
41909
  if (areAllShipmentsFilled) {
41887
41910
  setTotalShipping(checkout.shipments.reduce((acc, shipment) => {
41888
41911
  var _a, _b;
package/dist/index.mjs CHANGED
@@ -3321,6 +3321,9 @@ const CheckoutEmbed$2 = {
3321
3321
  other: "Váš balíček bude doručen kurýrem.",
3322
3322
  zasilkovna: "Vaše objednávka bude doručena na výdejní místo.",
3323
3323
  shippedTo: "Místo doručení:"
3324
+ },
3325
+ shipment: {
3326
+ title: "Zásilka č."
3324
3327
  }
3325
3328
  }
3326
3329
  };
@@ -3393,9 +3396,21 @@ const CheckoutEmbed$1 = {
3393
3396
  day: "day",
3394
3397
  days: "days",
3395
3398
  description: {
3396
- other: "Your package will be delivered by a courier.",
3397
- zasilkovna: "Your package will be delivered to a pickup point.",
3398
3399
  shippedTo: "Shipped to:"
3400
+ },
3401
+ Shipment: {
3402
+ title: "Shipment No. ",
3403
+ perIdTitles: {
3404
+ "zasilkovna-z_box": "Zásilkovna, Z-Box",
3405
+ "prebuilt-pickup-in-store": "Pickup in store",
3406
+ "prebuilt-local-delivery": "Local delivery"
3407
+ },
3408
+ perIdDescriptions: {
3409
+ fallback: "Your package will be delivered by a courier.",
3410
+ "zasilkovna-z_box": "Your package will be delivered to a pickup point.",
3411
+ "prebuilt-pickup-in-store": "Pickup in store",
3412
+ "prebuilt-local-delivery": "Local delivery"
3413
+ }
3399
3414
  }
3400
3415
  },
3401
3416
  Payment: {
@@ -17238,7 +17253,7 @@ ZodTuple.create;
17238
17253
  const recordType = ZodRecord.create;
17239
17254
  ZodEnum.create;
17240
17255
  ZodPromise.create;
17241
- ZodOptional.create;
17256
+ const optionalType = ZodOptional.create;
17242
17257
  ZodNullable.create;
17243
17258
 
17244
17259
  const phoneRegex = new RegExp(/^([+]?[\s0-9]+)?(\d{3}|[(]?[0-9]+[)])?([-]?[\s]?[0-9])+$/);
@@ -17263,11 +17278,11 @@ const customerSchema = objectType({
17263
17278
  // Shipping method schema
17264
17279
  const shippingMethodSchema = objectType({
17265
17280
  rateId: stringType().min(1, "required_error"),
17266
- provider: stringType().min(1, "required_error"),
17281
+ providerId: optionalType(stringType()),
17267
17282
  priceInCents: numberType().min(1, "required_error"),
17268
- name: stringType().min(1, "required_error"),
17269
17283
  pickupPointId: stringType().optional(),
17270
- pickupPointDisplayName: stringType().optional(),
17284
+ pickupPointDisplayName: stringType().optional(), // Only for display purposes
17285
+ displayName: stringType(), // Only for display purposes
17271
17286
  });
17272
17287
  const shipmentsFormSchema = recordType(stringType(), shippingMethodSchema)
17273
17288
  .refine((data) => Object.keys(data).length > 0, {
@@ -40210,12 +40225,12 @@ function requireReactStripe_umd () {
40210
40225
 
40211
40226
  stripe._registerWrapper({
40212
40227
  name: 'react-stripe-js',
40213
- version: "3.9.1"
40228
+ version: "3.9.2"
40214
40229
  });
40215
40230
 
40216
40231
  stripe.registerAppInfo({
40217
40232
  name: 'react-stripe-js',
40218
- version: "3.9.1",
40233
+ version: "3.9.2",
40219
40234
  url: 'https://stripe.com/docs/stripe-js/react'
40220
40235
  });
40221
40236
  };
@@ -41382,7 +41397,7 @@ var PaymentElement$1 = memo(PaymentElement);
41382
41397
  function PaymentForm({ paymentSecret, onSuccess, onError, onBack, onDoubleBack, contactEmail, shippingFormData, address, checkoutAppearance, fonts, locale, publicKey, paymentComponentKey, }) {
41383
41398
  const [isSubmitting, setIsSubmitting] = useState(false);
41384
41399
  const { t } = useTranslation();
41385
- return (jsxs("div", { className: "space-y-6", children: [jsxs("div", { children: [jsx("h2", { className: "mb-2", children: t("CheckoutEmbed.Payment.title") }), jsx("p", { className: "text-muted-foreground text-sm", children: t("CheckoutEmbed.Payment.description") })] }), jsxs("div", { className: "space-y-2", children: [jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxs("p", { children: [jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.contact") }), " ", jsx("span", { className: "text-muted-foreground", children: contactEmail })] }), jsx(Button, { variant: "link", size: "link", onClick: onDoubleBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxs("p", { children: [jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.address") }), " ", jsx("span", { className: "text-muted-foreground", children: address })] }), jsx(Button, { variant: "link", size: "link", onClick: onDoubleBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxs("div", { className: "flex gap-1", children: [jsx("p", { className: "font-medium", children: t("CheckoutEmbed.Shipping.shipping") }), " ", jsx("div", { className: "text-muted-foreground flex flex-col gap-1", children: Object.entries(shippingFormData).map(([id, shipmentFormData]) => (jsxs("p", { children: [shipmentFormData.name, " \u00B7 ", shipmentFormData.priceInCents] }, id))) })] }), jsx(Button, { variant: "link", size: "link", onClick: onBack, children: t("CheckoutEmbed.Shipping.change") })] })] }), jsx("div", { className: "mt-8", children: paymentSecret && (jsx(PaymentElement$1, { fonts: fonts, checkoutAppearance: convertCheckoutAppearanceToStripeAppearance(checkoutAppearance, fonts), locale: locale, paymentSecret: paymentSecret, onSuccess: onSuccess, onError: onError, setSubmitting: setIsSubmitting, publicKey: publicKey, children: jsx("div", { className: "fixed bottom-0 left-0 right-0 z-50 mt-8 px-4 sm:static sm:px-0", children: jsxs("div", { className: "bg-background flex flex-col-reverse items-center justify-between gap-2 pb-4 sm:flex-row sm:bg-transparent sm:pb-0", children: [jsxs(Button, { className: "w-full sm:w-fit", type: "button", variant: "ghost", onClick: onBack, children: [jsx(ChevronLeft, {}), t("CheckoutEmbed.Payment.back")] }), jsx(SubmitButton, { className: "w-full max-sm:h-[52px] sm:w-fit", isValid: true, isSubmitting: isSubmitting, children: t("CheckoutEmbed.Payment.button") })] }) }) }, paymentComponentKey)) })] }));
41400
+ return (jsxs("div", { className: "space-y-6", children: [jsxs("div", { children: [jsx("h2", { className: "mb-2", children: t("CheckoutEmbed.Payment.title") }), jsx("p", { className: "text-muted-foreground text-sm", children: t("CheckoutEmbed.Payment.description") })] }), jsxs("div", { className: "space-y-2", children: [jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxs("p", { children: [jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.contact") }), " ", jsx("span", { className: "text-muted-foreground", children: contactEmail })] }), jsx(Button, { variant: "link", size: "link", onClick: onDoubleBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxs("p", { children: [jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.address") }), " ", jsx("span", { className: "text-muted-foreground", children: address })] }), jsx(Button, { variant: "link", size: "link", onClick: onDoubleBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxs("div", { className: "flex gap-1", children: [jsx("p", { className: "font-medium", children: t("CheckoutEmbed.Shipping.shipping") }), " ", jsx("div", { className: "text-muted-foreground flex flex-col gap-1", children: Object.entries(shippingFormData).map(([id, shipmentFormData]) => (jsxs("p", { children: [shipmentFormData.displayName, " \u00B7", " ", shipmentFormData.priceInCents] }, id))) })] }), jsx(Button, { variant: "link", size: "link", onClick: onBack, children: t("CheckoutEmbed.Shipping.change") })] })] }), jsx("div", { className: "mt-8", children: paymentSecret && (jsx(PaymentElement$1, { fonts: fonts, checkoutAppearance: convertCheckoutAppearanceToStripeAppearance(checkoutAppearance, fonts), locale: locale, paymentSecret: paymentSecret, onSuccess: onSuccess, onError: onError, setSubmitting: setIsSubmitting, publicKey: publicKey, children: jsx("div", { className: "fixed bottom-0 left-0 right-0 z-50 mt-8 px-4 sm:static sm:px-0", children: jsxs("div", { className: "bg-background flex flex-col-reverse items-center justify-between gap-2 pb-4 sm:flex-row sm:bg-transparent sm:pb-0", children: [jsxs(Button, { className: "w-full sm:w-fit", type: "button", variant: "ghost", onClick: onBack, children: [jsx(ChevronLeft, {}), t("CheckoutEmbed.Payment.back")] }), jsx(SubmitButton, { className: "w-full max-sm:h-[52px] sm:w-fit", isValid: true, isSubmitting: isSubmitting, children: t("CheckoutEmbed.Payment.button") })] }) }) }, paymentComponentKey)) })] }));
41386
41401
  }
41387
41402
 
41388
41403
  function Skeleton(_a) {
@@ -41432,7 +41447,8 @@ function ZasilkovnaShippingOption({ children, onPickupPointSelected, locale, cou
41432
41447
  }
41433
41448
 
41434
41449
  function ShippingOptionWrapper({ rate, children, onPickupPointSelected, locale, countryCode, }) {
41435
- if (rate.provider === "zasilkovna") {
41450
+ const isAutoRate = rate.type === "CUSTOM_SHIPPING_VENDOR" || rate.type === "PLATFORM_CARRIER";
41451
+ if (isAutoRate && rate.providerId === "zasilkovna") {
41436
41452
  return (jsx(ZasilkovnaShippingOption, { onPickupPointSelected: onPickupPointSelected, locale: locale, countryCode: countryCode, apiKey: rate.clientSecret, children: children }));
41437
41453
  }
41438
41454
  return jsx(Fragment, { children: children });
@@ -41456,42 +41472,49 @@ function ShipmentsForm({ shippingRates, initialData, onSubmit, onBack, contactEm
41456
41472
  ])),
41457
41473
  });
41458
41474
  const isButtonEnabled = Object.values(form.getValues()).every((value) => { var _a; return ((_a = value.rateId) === null || _a === void 0 ? void 0 : _a.length) > 0; });
41459
- return (jsxs("div", { className: "space-y-6", children: [jsx("h2", { children: t("CheckoutEmbed.Shipping.title") }), jsxs("div", { className: "space-y-2 pb-2", children: [jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxs("p", { children: [jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.contact") }), " ", jsx("span", { className: "text-muted-foreground", children: contactEmail })] }), jsx(Button, { variant: "link", size: "link", onClick: onBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxs("p", { children: [jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.address") }), " ", jsx("span", { className: "text-muted-foreground", children: shippingAddress })] }), jsx(Button, { variant: "link", size: "link", onClick: onBack, children: t("CheckoutEmbed.Shipping.change") })] })] }), jsx(Form, Object.assign({}, form, { children: jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "space-y-4", children: [shipments.map((shipment) => (jsx(SingleShipmentSection, { shipment: shipment, shippingRates: shippingRates, form: form, setFormData: setFormData, formData: formData, currency: currency, exchangeRate: exchangeRate, locale: locale, countryCode: countryCode, multipleShipments: shipments.length > 1 }, shipment.id))), jsx(FormMessage, { children: (_a = form.formState.errors.root) === null || _a === void 0 ? void 0 : _a.message }), jsxs("div", { className: "flex items-center justify-between pt-4", children: [jsxs(Button, { type: "button", variant: "ghost", onClick: onBack, children: [jsx(ChevronLeft, {}), t("CheckoutEmbed.Shipping.back")] }), jsx(SubmitButton, { isSubmitting: form.formState.isSubmitting, isValid: isButtonEnabled, children: t("CheckoutEmbed.Shipping.button") })] })] }) }))] }));
41475
+ return (jsxs("div", { className: "space-y-6", children: [jsx("h2", { children: t("CheckoutEmbed.Shipping.title") }), jsxs("div", { className: "space-y-2 pb-2", children: [jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxs("p", { children: [jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.contact") }), " ", jsx("span", { className: "text-muted-foreground", children: contactEmail })] }), jsx(Button, { variant: "link", size: "link", onClick: onBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxs("p", { children: [jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.address") }), " ", jsx("span", { className: "text-muted-foreground", children: shippingAddress })] }), jsx(Button, { variant: "link", size: "link", onClick: onBack, children: t("CheckoutEmbed.Shipping.change") })] })] }), jsx(Form, Object.assign({}, form, { children: jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "space-y-4", children: [shipments.map((shipment, index) => (jsx(SingleShipmentSection, { shipment: shipment, shippingRates: shippingRates, form: form, setFormData: setFormData, formData: formData, currency: currency, exchangeRate: exchangeRate, locale: locale, countryCode: countryCode, multipleShipments: shipments.length > 1, index: index }, shipment.id))), jsx(FormMessage, { children: (_a = form.formState.errors.root) === null || _a === void 0 ? void 0 : _a.message }), jsxs("div", { className: "flex items-center justify-between pt-4", children: [jsxs(Button, { type: "button", variant: "ghost", onClick: onBack, children: [jsx(ChevronLeft, {}), t("CheckoutEmbed.Shipping.back")] }), jsx(SubmitButton, { isSubmitting: form.formState.isSubmitting, isValid: isButtonEnabled, children: t("CheckoutEmbed.Shipping.button") })] })] }) }))] }));
41460
41476
  }
41461
- const SingleShipmentSection = ({ shippingRates, form, currency, exchangeRate, locale, countryCode, setFormData, formData, multipleShipments, shipment, }) => {
41462
- var _a;
41477
+ const SingleShipmentSection = ({ shippingRates, form, currency, exchangeRate, locale, countryCode, setFormData, formData, multipleShipments, shipment, index, }) => {
41463
41478
  const { t } = useTranslation();
41464
41479
  const shipmentId = shipment.id;
41465
41480
  const currentRateId = form.watch(`${shipmentId}.rateId`);
41466
41481
  // TODO: construct the headline
41467
- return (jsxs("div", { children: [multipleShipments && (jsx("h3", { className: "text-lg font-medium", children: (_a = shipment.shipmentData) === null || _a === void 0 ? void 0 : _a.name })), shippingRates.length === 0 &&
41482
+ return (jsxs("div", { children: [multipleShipments && (jsxs("h3", { className: "text-lg font-medium", children: [t("CheckoutEmbed.Shipping.Shipment.title"), index + 1] })), shippingRates.length === 0 &&
41468
41483
  Array.from({ length: 3 }).map((_, index) => (jsx(ShippingRateLoading, {}, index))), shippingRates.map((rate) => {
41484
+ var _a, _b;
41469
41485
  const pickupPointDisplayName = form.watch(`${shipmentId}.pickupPointDisplayName`);
41470
- const rateId = rate.provider + rate.name;
41471
41486
  const intPrice = Math.ceil(Number(rate.priceInCents));
41472
41487
  const displayPrice = storeHelpers.formatPrice(intPrice, currency, exchangeRate);
41473
- const description = rate.provider === "zasilkovna"
41474
- ? t("CheckoutEmbed.Shipping.description.zasilkovna")
41475
- : t("CheckoutEmbed.Shipping.description.other");
41488
+ const isFixedRate = rate.type === "FIXED";
41489
+ const isAutoRate = rate.type === "CUSTOM_SHIPPING_VENDOR" ||
41490
+ rate.type === "PLATFORM_CARRIER";
41491
+ const isZasilkovna = isAutoRate && rate.providerId === "zasilkovna";
41492
+ const name = isFixedRate
41493
+ ? rate.name
41494
+ : ((_a = t(`CheckoutEmbed.Shipping.Shipment.perIdTitles.${rate.id}`)) !== null && _a !== void 0 ? _a : rate.id);
41495
+ const fallbackDescription = t(`CheckoutEmbed.Shipping.Shipment.perIdDescriptions.fallback`);
41496
+ const description = (_b = (isFixedRate
41497
+ ? rate.description
41498
+ : t(`CheckoutEmbed.Shipping.Shipment.perIdDescriptions.${rate.id}`))) !== null && _b !== void 0 ? _b : fallbackDescription;
41476
41499
  return (jsx(ShippingOptionWrapper, { rate: rate, onPickupPointSelected: (pickupPointId, pickupPointName) => {
41477
41500
  const newData = {
41478
- rateId,
41479
- provider: rate.provider,
41501
+ rateId: rate.id,
41502
+ providerId: isAutoRate ? rate.providerId : undefined,
41480
41503
  priceInCents: intPrice,
41481
- name: rate.name,
41482
- pickupPointId: rate.provider === "zasilkovna" ? pickupPointId : "",
41483
- pickupPointDisplayName: rate.provider === "zasilkovna" ? pickupPointName : "",
41504
+ displayName: name,
41505
+ pickupPointId: isZasilkovna ? pickupPointId : "",
41506
+ pickupPointDisplayName: isZasilkovna ? pickupPointName : "",
41484
41507
  };
41485
41508
  form.setValue(`${shipmentId}.rateId`, newData.rateId);
41486
- form.setValue(`${shipmentId}.provider`, newData.provider);
41487
- form.setValue(`${shipmentId}.name`, newData.name);
41509
+ form.setValue(`${shipmentId}.providerId`, newData.providerId);
41510
+ form.setValue(`${shipmentId}.displayName`, newData.displayName);
41488
41511
  form.setValue(`${shipmentId}.priceInCents`, newData.priceInCents);
41489
41512
  form.setValue(`${shipmentId}.pickupPointId`, newData.pickupPointId);
41490
41513
  form.setValue(`${shipmentId}.pickupPointDisplayName`, newData.pickupPointDisplayName);
41491
41514
  setFormData(Object.assign(Object.assign({}, formData), { shipping: Object.assign(Object.assign({}, formData.shipping), { [shipmentId]: newData }) }));
41492
41515
  }, locale: locale, countryCode: countryCode, children: jsxs("div", { className: clsx("bg-background cursor-pointer rounded-md border p-4", {
41493
- "bg-muted border-primary": currentRateId === rateId,
41494
- }), children: [jsxs("div", { className: "flex w-full items-center justify-between", children: [jsx("p", { children: rate.name }), jsx("p", { children: displayPrice })] }), jsx("p", { className: "text-muted-foreground text-sm", children: description }), pickupPointDisplayName && (jsxs(Fragment, { children: [jsx("hr", { className: "my-2" }), jsxs("p", { className: "text-muted-foreground text-sm", children: [t("CheckoutEmbed.Shipping.description.shippedTo"), " ", jsx("span", { className: "text-foreground", children: pickupPointDisplayName })] })] }))] }) }, rateId));
41516
+ "bg-muted border-primary": currentRateId === rate.id,
41517
+ }), children: [jsxs("div", { className: "flex w-full items-center justify-between", children: [jsx("p", { children: name }), jsx("p", { children: displayPrice })] }), jsx("p", { className: "text-muted-foreground text-sm", children: description }), pickupPointDisplayName && (jsxs(Fragment, { children: [jsx("hr", { className: "my-2" }), jsxs("p", { className: "text-muted-foreground text-sm", children: [t("CheckoutEmbed.Shipping.description.shippedTo"), " ", jsx("span", { className: "text-foreground", children: pickupPointDisplayName })] })] }))] }) }, rate.id));
41495
41518
  })] }));
41496
41519
  };
41497
41520
  function ShippingRateLoading() {
@@ -41651,10 +41674,10 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
41651
41674
  const shipments = Object.entries(data).map(([id, shipmentFormData]) => ({
41652
41675
  id: id,
41653
41676
  shipmentData: {
41654
- provider: shipmentFormData.provider,
41655
- pickupPointId: shipmentFormData.pickupPointId,
41656
- name: shipmentFormData.name,
41677
+ rateId: shipmentFormData.rateId,
41678
+ providerId: shipmentFormData.providerId,
41657
41679
  priceInCents: shipmentFormData.priceInCents,
41680
+ pickupPointId: shipmentFormData.pickupPointId,
41658
41681
  },
41659
41682
  }));
41660
41683
  yield storeClient.updateCheckout(clientSecret, checkoutId, {
@@ -41862,7 +41885,7 @@ function CheckoutEmbedComponent({ checkoutId, config }) {
41862
41885
  const [totalShipping, setTotalShipping] = useState(null);
41863
41886
  useEffect(() => {
41864
41887
  if (checkout) {
41865
- const areAllShipmentsFilled = checkout.shipments.every((shipment) => { var _a; return (_a = shipment.shipmentData) === null || _a === void 0 ? void 0 : _a.provider; });
41888
+ const areAllShipmentsFilled = checkout.shipments.every((shipment) => { var _a; return (_a = shipment.shipmentData) === null || _a === void 0 ? void 0 : _a.rateId; });
41866
41889
  if (areAllShipmentsFilled) {
41867
41890
  setTotalShipping(checkout.shipments.reduce((acc, shipment) => {
41868
41891
  var _a, _b;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/react",
3
- "version": "0.5.23",
3
+ "version": "0.5.24",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -78,7 +78,7 @@
78
78
  "world_countries_lists": "^3.2.0",
79
79
  "zod": "^3.25.30",
80
80
  "zustand": "^5.0.5",
81
- "@betterstore/sdk": "0.5.23"
81
+ "@betterstore/sdk": "0.5.24"
82
82
  },
83
83
  "publishConfig": {
84
84
  "access": "public"