@loczer/storefront-sdk 0.184.0 → 0.186.0

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/i18n/en.js CHANGED
@@ -178,7 +178,7 @@ var e = {
178
178
  checkout_payment_due_now_helper_none: "No payment required now.",
179
179
  checkout_payment_provider: "Provider",
180
180
  checkout_payment_loading: "Checking payment options…",
181
- checkout_payment_error: "Unable to check payment options.",
181
+ checkout_payment_error: "Unable to check payment options. Please contact the shop directly.",
182
182
  checkout_payment_enable_hint: "Enter your full name to enable the payment method.",
183
183
  checkout_submit: "Request booking",
184
184
  checkout_success_toast: "Request sent.",
package/dist/i18n/fr.js CHANGED
@@ -178,7 +178,7 @@ var e = {
178
178
  checkout_payment_due_now_helper_none: "Aucun paiement n’est requis maintenant.",
179
179
  checkout_payment_provider: "Prestataire",
180
180
  checkout_payment_loading: "Vérification des options de paiement…",
181
- checkout_payment_error: "Impossible de vérifier les options de paiement.",
181
+ checkout_payment_error: "Impossible de vérifier les options de paiement. Veuillez contacter directement la boutique.",
182
182
  checkout_payment_enable_hint: "Renseignez votre nom complet pour activer le moyen de paiement.",
183
183
  checkout_submit: "Envoyer la demande",
184
184
  checkout_success_toast: "Demande envoyée.",
package/dist/index.d.ts CHANGED
@@ -3032,6 +3032,7 @@ export declare type StorefrontCheckoutSubmitResponsePayload = z.infer<typeof sto
3032
3032
  export declare const storefrontCheckoutSubmitResponseSchema: z.ZodObject<{
3033
3033
  success: z.ZodBoolean;
3034
3034
  message: z.ZodOptional<z.ZodString>;
3035
+ errorCode: z.ZodOptional<z.ZodLiteral<"online_payment_provider_missing">>;
3035
3036
  checkout: z.ZodOptional<z.ZodObject<{
3036
3037
  bookingExternalId: z.ZodString;
3037
3038
  saleId: z.ZodString;
@@ -6,6 +6,9 @@ export declare const paymentDecisionModeSchema: z.ZodEnum<{
6
6
  full: "full";
7
7
  }>;
8
8
  export type PaymentDecisionMode = z.infer<typeof paymentDecisionModeSchema>;
9
+ export declare const MISSING_ONLINE_PAYMENT_PROVIDER_ERROR_CODE = "online_payment_provider_missing";
10
+ export declare const checkoutPaymentErrorCodeSchema: z.ZodLiteral<"online_payment_provider_missing">;
11
+ export type CheckoutPaymentErrorCode = z.infer<typeof checkoutPaymentErrorCodeSchema>;
9
12
  export declare const requestSchema: z.ZodObject<{
10
13
  storeSlug: z.ZodString;
11
14
  schedule: z.ZodObject<{
@@ -21,6 +24,7 @@ export type RequestPayload = z.infer<typeof requestSchema>;
21
24
  export declare const responseSchema: z.ZodObject<{
22
25
  success: z.ZodBoolean;
23
26
  message: z.ZodOptional<z.ZodString>;
27
+ errorCode: z.ZodOptional<z.ZodLiteral<"online_payment_provider_missing">>;
24
28
  decision: z.ZodOptional<z.ZodObject<{
25
29
  shouldCollectOnlinePayment: z.ZodBoolean;
26
30
  paymentMode: z.ZodEnum<{
@@ -1 +1 @@
1
- {"version":3,"file":"checkoutPaymentDecision.d.ts","sourceRoot":"","sources":["../../src/lib/checkoutPaymentDecision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,KAAK,qDAAqD,CAAA;AAEvE,eAAO,MAAM,yBAAyB;;;;EAAsC,CAAA;AAC5E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAE3E,eAAO,MAAM,aAAa;;;;;;;;;;iBAYxB,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAE1D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;iBAuBzB,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA"}
1
+ {"version":3,"file":"checkoutPaymentDecision.d.ts","sourceRoot":"","sources":["../../src/lib/checkoutPaymentDecision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,KAAK,qDAAqD,CAAA;AAEvE,eAAO,MAAM,yBAAyB;;;;EAAsC,CAAA;AAC5E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAC3E,eAAO,MAAM,0CAA0C,oCAAoC,CAAA;AAC3F,eAAO,MAAM,8BAA8B,iDAAwD,CAAA;AACnG,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAA;AAErF,eAAO,MAAM,aAAa;;;;;;;;;;iBAYxB,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAE1D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwBzB,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA"}
@@ -4,7 +4,7 @@ var t = "/api/public/storefront/checkout/payment-decision", n = e.enum([
4
4
  "none",
5
5
  "deposit",
6
6
  "full"
7
- ]), r = e.object({
7
+ ]), r = "online_payment_provider_missing", i = e.literal(r), a = e.object({
8
8
  storeSlug: e.string().trim().min(1).toLowerCase(),
9
9
  schedule: e.object({
10
10
  startDate: e.string().regex(/^\d{4}-\d{2}-\d{2}$/),
@@ -14,9 +14,10 @@ var t = "/api/public/storefront/checkout/payment-decision", n = e.enum([
14
14
  }),
15
15
  estimatedTotalMinor: e.number().int().min(0),
16
16
  nowIso: e.string().datetime({ offset: !0 }).optional()
17
- }), i = e.object({
17
+ }), o = e.object({
18
18
  success: e.boolean(),
19
19
  message: e.string().optional(),
20
+ errorCode: i.optional(),
20
21
  decision: e.object({
21
22
  shouldCollectOnlinePayment: e.boolean(),
22
23
  paymentMode: n,
@@ -37,4 +38,4 @@ var t = "/api/public/storefront/checkout/payment-decision", n = e.enum([
37
38
  }).optional()
38
39
  });
39
40
  //#endregion
40
- export { t as ROUTE, n as paymentDecisionModeSchema, r as requestSchema, i as responseSchema };
41
+ export { r as MISSING_ONLINE_PAYMENT_PROVIDER_ERROR_CODE, t as ROUTE, i as checkoutPaymentErrorCodeSchema, n as paymentDecisionModeSchema, a as requestSchema, o as responseSchema };
@@ -1,4 +1,6 @@
1
1
  import { z } from 'zod';
2
+ import { MISSING_ONLINE_PAYMENT_PROVIDER_ERROR_CODE } from './checkoutPaymentDecision';
3
+ export { MISSING_ONLINE_PAYMENT_PROVIDER_ERROR_CODE };
2
4
  export declare const ROUTE = "/api/public/storefront/checkout/submit";
3
5
  export declare const requestCheckoutItemSchema: z.ZodObject<{
4
6
  kind: any;
@@ -75,6 +77,7 @@ export type RequestPayload = z.infer<typeof requestSchema>;
75
77
  export declare const responseSchema: z.ZodObject<{
76
78
  success: z.ZodBoolean;
77
79
  message: z.ZodOptional<z.ZodString>;
80
+ errorCode: z.ZodOptional<z.ZodLiteral<"online_payment_provider_missing">>;
78
81
  checkout: z.ZodOptional<z.ZodObject<{
79
82
  bookingExternalId: z.ZodString;
80
83
  saleId: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"checkoutSubmit.d.ts","sourceRoot":"","sources":["../../src/lib/checkoutSubmit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,eAAO,MAAM,KAAK,2CAA2C,CAAA;AAE7D,eAAO,MAAM,yBAAyB;;;;;iBAKpC,CAAA;AACF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAI3E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkB5B,CAAA;AAEF,eAAO,MAAM,yBAAyB,GACpC,SAAS;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,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C,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA"}
@@ -2,45 +2,47 @@ import { productKindSchema as e } from "../chunks/booking-engine/dist/models/Pro
2
2
  import { DEFAULT_BOOKING_DELIVERY_OPTION as t, bookingScheduleInputSchema as n } from "../chunks/booking-engine/dist/schemas/cart-inputs-j1yWfJxO.js";
3
3
  import "../chunks/booking-engine/dist/schemas-DftrSnTE.js";
4
4
  import { storefrontFulfillmentModeSchema as r } from "../storefrontSchemas.js";
5
- import { z as i } from "zod";
5
+ import { MISSING_ONLINE_PAYMENT_PROVIDER_ERROR_CODE as i, checkoutPaymentErrorCodeSchema as a } from "./checkoutPaymentDecision.js";
6
+ import { z as o } from "zod";
6
7
  //#region src/lib/checkoutSubmit.ts
7
- var a = "/api/public/storefront/checkout/submit", o = i.object({
8
+ var s = "/api/public/storefront/checkout/submit", c = o.object({
8
9
  kind: e,
9
- productId: i.string().trim().min(1),
10
- productVariantId: i.string().trim().min(1).optional(),
11
- quantity: i.number().int().positive()
12
- }), s = i.object({
13
- storeSlug: i.string().trim().min(1).toLowerCase(),
10
+ productId: o.string().trim().min(1),
11
+ productVariantId: o.string().trim().min(1).optional(),
12
+ quantity: o.number().int().positive()
13
+ }), l = o.object({
14
+ storeSlug: o.string().trim().min(1).toLowerCase(),
14
15
  schedule: n,
15
16
  fulfillment: r.default(t),
16
- startAddress: i.string().trim().max(500).optional(),
17
- endAddress: i.string().trim().max(500).optional(),
18
- couponCode: i.string().trim().max(64).optional().or(i.literal("")),
19
- couponAutoApplied: i.boolean().optional(),
20
- customer: i.object({
21
- fullName: i.string().trim().min(2),
22
- email: i.string().trim().email(),
23
- phone: i.string().trim().min(6),
24
- notes: i.string().trim().max(2e3).optional().or(i.literal(""))
17
+ startAddress: o.string().trim().max(500).optional(),
18
+ endAddress: o.string().trim().max(500).optional(),
19
+ couponCode: o.string().trim().max(64).optional().or(o.literal("")),
20
+ couponAutoApplied: o.boolean().optional(),
21
+ customer: o.object({
22
+ fullName: o.string().trim().min(2),
23
+ email: o.string().trim().email(),
24
+ phone: o.string().trim().min(6),
25
+ notes: o.string().trim().max(2e3).optional().or(o.literal(""))
25
26
  }),
26
- items: i.array(o).min(1),
27
- nowIso: i.string().datetime({ offset: !0 }).optional()
28
- }), c = (e, t) => {
27
+ items: o.array(c).min(1),
28
+ nowIso: o.string().datetime({ offset: !0 }).optional()
29
+ }), u = (e, t) => {
29
30
  e.fulfillment === "delivery" && (e.startAddress?.trim() || t.addIssue({
30
- code: i.ZodIssueCode.custom,
31
+ code: o.ZodIssueCode.custom,
31
32
  message: "Delivery start address is required.",
32
33
  path: ["startAddress"]
33
34
  }));
34
- }, l = s.superRefine(c), u = i.object({
35
- success: i.boolean(),
36
- message: i.string().optional(),
37
- checkout: i.object({
38
- bookingExternalId: i.string().trim().min(1),
39
- saleId: i.string().trim().min(1),
40
- nextPath: i.string().trim().min(1),
41
- successPath: i.string().trim().min(1),
42
- requiresPayment: i.boolean()
35
+ }, d = l.superRefine(u), f = o.object({
36
+ success: o.boolean(),
37
+ message: o.string().optional(),
38
+ errorCode: a.optional(),
39
+ checkout: o.object({
40
+ bookingExternalId: o.string().trim().min(1),
41
+ saleId: o.string().trim().min(1),
42
+ nextPath: o.string().trim().min(1),
43
+ successPath: o.string().trim().min(1),
44
+ requiresPayment: o.boolean()
43
45
  }).optional()
44
46
  });
45
47
  //#endregion
46
- export { a as ROUTE, s as requestBaseSchema, o as requestCheckoutItemSchema, c as requestDeliveryRefinement, l as requestSchema, u as responseSchema };
48
+ export { i as MISSING_ONLINE_PAYMENT_PROVIDER_ERROR_CODE, s as ROUTE, l as requestBaseSchema, c as requestCheckoutItemSchema, u as requestDeliveryRefinement, d as requestSchema, f as responseSchema };
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutPage.d.ts","sourceRoot":"","sources":["../../src/pages/CheckoutPage.tsx"],"names":[],"mappings":"AAuGA,MAAM,CAAC,OAAO,UAAU,YAAY,4CA0lBnC"}
1
+ {"version":3,"file":"CheckoutPage.d.ts","sourceRoot":"","sources":["../../src/pages/CheckoutPage.tsx"],"names":[],"mappings":"AAwGA,MAAM,CAAC,OAAO,UAAU,YAAY,4CAkmBnC"}