@loczer/storefront-sdk 0.226.0 → 0.228.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/chunks/pkg/booking-engine/dist/{schemas-DGn2a1my.js → schemas-DW5gdDYz.js} +4 -3
- package/dist/chunks/pkg/booking-engine/dist/utils/opening-hours-period-TCyLhzZw.js +82 -0
- package/dist/components/ContractSaleDocument/DocumentAcceptanceSection.d.ts.map +1 -1
- package/dist/components/ContractSaleDocument/DocumentAcceptanceSection.js +21 -4
- package/dist/components/ContractSaleDocument/InvoiceDetails.d.ts.map +1 -1
- package/dist/components/ContractSaleDocument/InvoiceDetails.js +83 -28
- package/dist/components/ContractSaleDocument/SignatureModal.d.ts.map +1 -1
- package/dist/components/ContractSaleDocument/SignatureModal.js +59 -101
- package/dist/components/Footer/businessHoursStatus.d.ts.map +1 -1
- package/dist/components/Footer/businessHoursStatus.js +21 -36
- package/dist/components/Footer/businessHoursUtils.d.ts.map +1 -1
- package/dist/components/Footer/businessHoursUtils.js +2 -1
- package/dist/components/SignatureInput/index.js +74 -0
- package/dist/components/SignatureInput.d.ts +12 -0
- package/dist/components/SignatureInput.d.ts.map +1 -0
- package/dist/i18n/en.d.ts +7 -0
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +7 -0
- package/dist/i18n/fr.d.ts +7 -0
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +7 -0
- package/dist/index.d.ts +163 -0
- package/dist/index.js +76 -74
- package/dist/lib/booking-period.d.ts.map +1 -1
- package/dist/lib/booking-period.js +120 -138
- package/dist/lib/booking.js +1 -1
- package/dist/lib/checkoutSubmit.js +1 -1
- package/dist/lib/contractSaleDocument.d.ts +42 -0
- package/dist/lib/contractSaleDocument.d.ts.map +1 -1
- package/dist/lib/contractSaleDocument.js +41 -30
- package/dist/lib/contractSaleDocumentApi.d.ts +63 -0
- package/dist/lib/contractSaleDocumentApi.d.ts.map +1 -1
- package/dist/pages/ContractSaleDocumentPage.d.ts +21 -0
- package/dist/pages/ContractSaleDocumentPage.d.ts.map +1 -1
- package/dist/storefront.css +1 -1
- package/dist/storefrontSchemas.js +1 -1
- package/package.json +1 -1
|
@@ -9,7 +9,8 @@ import { DEFAULT_CANCELLATION_POLICY as V, DEFAULT_PAYMENT_POLICIES as H, cancel
|
|
|
9
9
|
import { fulfillmentModeSchema as K, publicBookingEngineConfigurationSchema as q, publicCheckoutConfigurationSchema as J, publicCheckoutDynamicOptionsSchema as Y } from "./schemas/public-booking-engine-configuration-CEM9mexX.js";
|
|
10
10
|
import { DEFAULT_BOOKING_DELIVERY_OPTION as X, bookingCustomerInputSchema as Z, bookingDeliveryOptionSchema as Q, bookingScheduleInputSchema as $, cartItemInputSchema as ee, createBookingInputBaseSchema as te, createBookingInputSchema as ne, resolveBookingDeliveryOption as re, validateBookingDeliveryAddress as ie } from "./schemas/cart-inputs-epi7FXIk.js";
|
|
11
11
|
import { bookingInsuranceConsentSourceSchema as ae, bookingInsuranceItemSnapshotSchema as oe, bookingInsuranceSnapshotSchema as se, buildBookingInsuranceSnapshot as ce, calculateInsuranceCalendarDays as le, insuranceProviderSchema as ue } from "./schemas/insurance-DXc34Bzy.js";
|
|
12
|
+
import { resolveOpeningHoursForDate as de, resolveOpeningHoursPeriodForDate as fe } from "./utils/opening-hours-period-TCyLhzZw.js";
|
|
12
13
|
import "./schemas/base-product-Bde9lJQD.js";
|
|
13
|
-
import { assetIdSchema as
|
|
14
|
-
import { baseBookingItemSchema as
|
|
15
|
-
export { X as DEFAULT_BOOKING_DELIVERY_OPTION, V as DEFAULT_CANCELLATION_POLICY, H as DEFAULT_PAYMENT_POLICIES, m as DEFAULT_PRODUCT_KIND, h as PRODUCT_VARIANT_CODE_IDENTIFIER_KIND, g as PRODUCT_VARIANT_CODE_MAX_LENGTH, _ as accessoryProductSchema,
|
|
14
|
+
import { assetIdSchema as pe, baseAssetSchema as me, baseAssetStatusSchema as he } from "./schemas/base-asset-BhIOL2rP.js";
|
|
15
|
+
import { baseBookingItemSchema as ge, baseBookingSchema as _e, baseBookingStateSchema as ve } from "./schemas/base-booking-C9kJFMIu.js";
|
|
16
|
+
export { X as DEFAULT_BOOKING_DELIVERY_OPTION, V as DEFAULT_CANCELLATION_POLICY, H as DEFAULT_PAYMENT_POLICIES, m as DEFAULT_PRODUCT_KIND, h as PRODUCT_VARIANT_CODE_IDENTIFIER_KIND, g as PRODUCT_VARIANT_CODE_MAX_LENGTH, _ as accessoryProductSchema, pe as assetIdSchema, me as baseAssetSchema, he as baseAssetStatusSchema, ge as baseBookingItemSchema, _e as baseBookingSchema, ve as baseBookingStateSchema, v as bikeProductSchema, Z as bookingCustomerInputSchema, Q as bookingDeliveryOptionSchema, ae as bookingInsuranceConsentSourceSchema, oe as bookingInsuranceItemSnapshotSchema, se as bookingInsuranceSnapshotSchema, $ as bookingScheduleInputSchema, ce as buildBookingInsuranceSnapshot, le as calculateInsuranceCalendarDays, U as cancellationPolicySchema, W as cancellationPolicyTierSchema, ee as cartItemInputSchema, te as createBookingInputBaseSchema, ne as createBookingInputSchema, e as createLocalizedStringEntry, a as currencyCodeSchema, o as currencyMinorUnitDigits, y as eBikeProductSchema, K as fulfillmentModeSchema, t as getLocalizedStringValue, ue as insuranceProviderSchema, b as isProductVariantCodeIdentifierKind, M as isoDateSchema, n as localizedStringArraySchema, r as localizedStringEntrySchema, i as localizedStringSchema, s as majorToMinor, c as minorToMajor, l as moneyMinorSchema, G as paymentPoliciesSchema, d as priceSchema, f as priceUnitSchema, p as productIdSchema, x as productInsuranceSchema, S as productKindSchema, C as productSchema, w as productStorefrontDisplayModeSchema, T as productVariantAttributeSchema, E as productVariantCodeSchema, D as productVariantIdentifierSchema, O as productVariantSchema, q as publicBookingEngineConfigurationSchema, J as publicCheckoutConfigurationSchema, Y as publicCheckoutDynamicOptionsSchema, re as resolveBookingDeliveryOption, de as resolveOpeningHoursForDate, fe as resolveOpeningHoursPeriodForDate, k as richTextJsonDocSchema, A as richTextSchema, j as richTextVersionSchema, N as shopConfigurationSchema, P as shopExtraTimeSlotRuleSchema, F as shopOpeningDayIndexSchema, I as shopOpeningDaySchema, L as shopOpeningHoursOverrideSchema, R as shopOpeningHoursPeriodSchema, z as shopOpeningSlotSchema, u as signedMoneyMinorSchema, B as timeOfDaySchema, ie as validateBookingDeliveryAddress };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
//#region ../booking-engine/dist/utils/opening-hours-period.js
|
|
2
|
+
var e = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
3
|
+
function t(e) {
|
|
4
|
+
return e % 4 == 0 && (e % 100 != 0 || e % 400 == 0);
|
|
5
|
+
}
|
|
6
|
+
function n(e, n) {
|
|
7
|
+
return n === 2 ? t(e) ? 29 : 28 : n === 4 || n === 6 || n === 9 || n === 11 ? 30 : 31;
|
|
8
|
+
}
|
|
9
|
+
function r(t) {
|
|
10
|
+
let r = e.exec(t);
|
|
11
|
+
if (!r) return null;
|
|
12
|
+
let i = Number(r[1]), a = Number(r[2]), o = Number(r[3]);
|
|
13
|
+
return a < 1 || a > 12 || o < 1 || o > n(i, a) ? null : {
|
|
14
|
+
year: i,
|
|
15
|
+
month: a,
|
|
16
|
+
day: o,
|
|
17
|
+
key: i * 1e4 + a * 100 + o
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function i(e, t) {
|
|
21
|
+
let r = e.year + t;
|
|
22
|
+
return r < 0 || r > 9999 || e.day > n(r, e.month) ? null : {
|
|
23
|
+
year: r,
|
|
24
|
+
month: e.month,
|
|
25
|
+
day: e.day,
|
|
26
|
+
key: r * 1e4 + e.month * 100 + e.day
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function a(e, t, n) {
|
|
30
|
+
return e.key >= t.key && e.key <= n.key;
|
|
31
|
+
}
|
|
32
|
+
function o(e) {
|
|
33
|
+
return (new Date(Date.UTC(e.year, e.month - 1, e.day)).getUTCDay() + 6) % 7;
|
|
34
|
+
}
|
|
35
|
+
function s(e) {
|
|
36
|
+
return (e % 7 + 7) % 7;
|
|
37
|
+
}
|
|
38
|
+
function c(e, t) {
|
|
39
|
+
let n = r(t);
|
|
40
|
+
if (!n) return;
|
|
41
|
+
let o, s = -1, c = -1;
|
|
42
|
+
for (let t of e) {
|
|
43
|
+
let e = r(t.startDate), l = r(t.endDate);
|
|
44
|
+
if (!e || !l) continue;
|
|
45
|
+
let u = e.key <= l.key ? e : l, d = e.key <= l.key ? l : e;
|
|
46
|
+
if (a(n, u, d)) return t;
|
|
47
|
+
d.key >= n.key || [.../* @__PURE__ */ new Set([n.year - u.year, n.year - d.year])].some((e) => {
|
|
48
|
+
if (e <= 0) return !1;
|
|
49
|
+
let t = i(u, e), r = i(d, e);
|
|
50
|
+
return !!(t && r && a(n, t, r));
|
|
51
|
+
}) && (d.key > s || d.key === s && u.key > c) && (o = t, s = d.key, c = u.key);
|
|
52
|
+
}
|
|
53
|
+
return o;
|
|
54
|
+
}
|
|
55
|
+
function l(e, t, n) {
|
|
56
|
+
let i = r(n);
|
|
57
|
+
if (!i) return {
|
|
58
|
+
period: void 0,
|
|
59
|
+
override: void 0,
|
|
60
|
+
weekday: null,
|
|
61
|
+
openingSlots: void 0
|
|
62
|
+
};
|
|
63
|
+
let a = c(e, n), l = t?.find((e) => r(e.date)?.key === i.key), u = o(i);
|
|
64
|
+
return l ? {
|
|
65
|
+
period: a,
|
|
66
|
+
override: l,
|
|
67
|
+
weekday: u,
|
|
68
|
+
openingSlots: l.openingSlots
|
|
69
|
+
} : a ? {
|
|
70
|
+
period: a,
|
|
71
|
+
override: void 0,
|
|
72
|
+
weekday: u,
|
|
73
|
+
openingSlots: a.openingHours.find((e) => s(e.day) === u)?.openingSlots ?? []
|
|
74
|
+
} : {
|
|
75
|
+
period: void 0,
|
|
76
|
+
override: void 0,
|
|
77
|
+
weekday: u,
|
|
78
|
+
openingSlots: void 0
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { l as resolveOpeningHoursForDate, c as resolveOpeningHoursPeriodForDate };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentAcceptanceSection.d.ts","sourceRoot":"","sources":["../../../src/components/ContractSaleDocument/DocumentAcceptanceSection.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oBAAoB,EACpB,4BAA4B,EAC7B,MAAM,gCAAgC,CAAA;AAIvC,KAAK,8BAA8B,GAAG;IACpC,YAAY,EAAE,oBAAoB,CAAA;IAClC,gBAAgB,EAAE,4BAA4B,CAAA;IAC9C,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,KAAK,MAAM,CAAA;IACpD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,wBAAgB,yBAAyB,CAAC,EACxC,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,OAAe,GAChB,EAAE,8BAA8B,
|
|
1
|
+
{"version":3,"file":"DocumentAcceptanceSection.d.ts","sourceRoot":"","sources":["../../../src/components/ContractSaleDocument/DocumentAcceptanceSection.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oBAAoB,EACpB,4BAA4B,EAC7B,MAAM,gCAAgC,CAAA;AAIvC,KAAK,8BAA8B,GAAG;IACpC,YAAY,EAAE,oBAAoB,CAAA;IAClC,gBAAgB,EAAE,4BAA4B,CAAA;IAC9C,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,KAAK,MAAM,CAAA;IACpD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,wBAAgB,yBAAyB,CAAC,EACxC,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,OAAe,GAChB,EAAE,8BAA8B,kDA2IhC"}
|
|
@@ -4,11 +4,11 @@ import { useTranslation as i } from "react-i18next";
|
|
|
4
4
|
import { cn as a } from "@rpcbase/ui";
|
|
5
5
|
//#region src/components/ContractSaleDocument/DocumentAcceptanceSection.tsx
|
|
6
6
|
function o({ saleDocument: o, documentLanguage: s, formatDate: c, className: l, compact: u = !1 }) {
|
|
7
|
-
let { t: d } = i(), f = (t, n = {}) => e(d, s, t, n), p = o.acceptance?.mode === "signature" ? o.acceptance : null, m = o.acceptance?.mode === "acceptance" ? o.acceptance : null, h = o.acceptanceLevel === "signature" || p !== null;
|
|
7
|
+
let { t: d } = i(), f = (t, n = {}) => e(d, s, t, n), p = o.acceptance?.mode === "signature" ? o.acceptance : null, m = o.acceptance?.mode === "acceptance" ? o.acceptance : null, h = p ? o.issuerSignature : null, g = o.acceptanceLevel === "signature" || p !== null;
|
|
8
8
|
return o.acceptanceLevel === "none" && !o.acceptance ? null : /* @__PURE__ */ n("section", {
|
|
9
9
|
className: a("mt-auto border-t border-border", u ? "pt-3" : "pt-8", l),
|
|
10
10
|
"data-testid": "contract-sale-document-acceptance-section",
|
|
11
|
-
children:
|
|
11
|
+
children: g ? /* @__PURE__ */ r(t, { children: [/* @__PURE__ */ n("p", {
|
|
12
12
|
className: a("text-center text-sm text-muted-foreground", u ? "mb-4" : "mb-12"),
|
|
13
13
|
children: /* @__PURE__ */ n("span", { children: f("docs_contract_sale_signature_acknowledgement") })
|
|
14
14
|
}), p ? /* @__PURE__ */ r("div", {
|
|
@@ -22,9 +22,26 @@ function o({ saleDocument: o, documentLanguage: s, formatDate: c, className: l,
|
|
|
22
22
|
}),
|
|
23
23
|
/* @__PURE__ */ n("p", {
|
|
24
24
|
className: "mb-2 mt-2 text-sm text-muted-foreground",
|
|
25
|
-
children: /* @__PURE__ */ r("span", { children: [
|
|
25
|
+
children: /* @__PURE__ */ r("span", { children: [
|
|
26
|
+
f("docs_contract_sale_signature_date_label"),
|
|
27
|
+
": ",
|
|
28
|
+
h ? c(o.date) : "___________________"
|
|
29
|
+
] })
|
|
26
30
|
}),
|
|
27
|
-
/* @__PURE__ */ n("div", {
|
|
31
|
+
/* @__PURE__ */ n("div", {
|
|
32
|
+
className: a("flex items-center justify-center rounded-lg bg-muted/40 p-2", u ? "h-20" : "h-24"),
|
|
33
|
+
children: h ? /* @__PURE__ */ n("img", {
|
|
34
|
+
src: h,
|
|
35
|
+
alt: f("docs_contract_sale_signature_issuer_label"),
|
|
36
|
+
className: "max-h-full max-w-full",
|
|
37
|
+
"data-testid": "contract-sale-document-issuer-signature"
|
|
38
|
+
}) : null
|
|
39
|
+
}),
|
|
40
|
+
h ? /* @__PURE__ */ n("p", {
|
|
41
|
+
className: a("text-sm text-foreground", u ? "mt-1" : "mt-2"),
|
|
42
|
+
"data-testid": "contract-sale-document-issuer-legal-representative",
|
|
43
|
+
children: /* @__PURE__ */ n("span", { children: f("docs_contract_sale_signature_issuer_representative_label") })
|
|
44
|
+
}) : null
|
|
28
45
|
]
|
|
29
46
|
}), /* @__PURE__ */ r("div", {
|
|
30
47
|
className: "w-full text-left md:w-2/5",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InvoiceDetails.d.ts","sourceRoot":"","sources":["../../../src/components/ContractSaleDocument/InvoiceDetails.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oBAAoB,EACpB,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,gCAAgC,CAAA;AAKvC,KAAK,mBAAmB,GAAG;IACzB,YAAY,EAAE,oBAAoB,CAAA;IAClC,KAAK,EAAE,4BAA4B,EAAE,CAAA;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,KAAK,MAAM,CAAA;IACpD,gBAAgB,EAAE,4BAA4B,CAAA;IAC9C,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AA0CD,wBAAgB,cAAc,CAAC,EAC7B,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,GAAG,EACH,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,eAAsB,EACtB,iBAAwB,EACxB,gBAAuB,EACvB,qBAA4B,EAC5B,iBAAiB,EACjB,OAAe,GAChB,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"InvoiceDetails.d.ts","sourceRoot":"","sources":["../../../src/components/ContractSaleDocument/InvoiceDetails.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oBAAoB,EACpB,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,gCAAgC,CAAA;AAKvC,KAAK,mBAAmB,GAAG;IACzB,YAAY,EAAE,oBAAoB,CAAA;IAClC,KAAK,EAAE,4BAA4B,EAAE,CAAA;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,KAAK,MAAM,CAAA;IACpD,gBAAgB,EAAE,4BAA4B,CAAA;IAC9C,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AA0CD,wBAAgB,cAAc,CAAC,EAC7B,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,GAAG,EACH,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,eAAsB,EACtB,iBAAwB,EACxB,gBAAuB,EACvB,qBAA4B,EAC5B,iBAAiB,EACjB,OAAe,GAChB,EAAE,mBAAmB,2CA8UrB"}
|
|
@@ -45,7 +45,38 @@ function u({ saleDocument: u, items: d, subtotal: f, tax: p, total: m, formatDat
|
|
|
45
45
|
children: n.slice(a + 3)
|
|
46
46
|
})]
|
|
47
47
|
});
|
|
48
|
-
}, D = !v && !y && !b, O =
|
|
48
|
+
}, D = !v && !y && !b, O = u.issuer.legalIdentity, k = O?.legalName?.trim() || u.issuer.name, A = k === u.issuer.name ? "" : u.issuer.name, j = s(O?.registeredAddress || u.issuer.address), M = O ? [
|
|
49
|
+
O.legalForm ? {
|
|
50
|
+
key: "legal-form",
|
|
51
|
+
label: T("docs_contract_sale_legal_form_label"),
|
|
52
|
+
value: O.legalForm
|
|
53
|
+
} : null,
|
|
54
|
+
O.shareCapital ? {
|
|
55
|
+
key: "share-capital",
|
|
56
|
+
label: T("docs_contract_sale_legal_share_capital_label"),
|
|
57
|
+
value: O.shareCapital
|
|
58
|
+
} : null,
|
|
59
|
+
O.companyRegistrationNumber ? {
|
|
60
|
+
key: "company-registration",
|
|
61
|
+
label: T("docs_contract_sale_legal_company_registration_label"),
|
|
62
|
+
value: O.companyRegistrationNumber
|
|
63
|
+
} : null,
|
|
64
|
+
O.establishmentRegistrationNumber ? {
|
|
65
|
+
key: "establishment-registration",
|
|
66
|
+
label: T("docs_contract_sale_legal_establishment_registration_label"),
|
|
67
|
+
value: O.establishmentRegistrationNumber
|
|
68
|
+
} : null,
|
|
69
|
+
O.vatNumber ? {
|
|
70
|
+
key: "vat-number",
|
|
71
|
+
label: T("docs_contract_sale_legal_vat_number_label"),
|
|
72
|
+
value: O.vatNumber
|
|
73
|
+
} : null,
|
|
74
|
+
O.tradeRegister ? {
|
|
75
|
+
key: "trade-register",
|
|
76
|
+
label: T("docs_contract_sale_legal_trade_register_label"),
|
|
77
|
+
value: O.tradeRegister
|
|
78
|
+
} : null
|
|
79
|
+
].filter((e) => e !== null) : [], N = s(u.recipient.address), P = u.recipient.email?.trim() ?? "", F = u.kind === "credit_note", I = w(F ? "docs_contract_sale_credit_note_title" : u.kind === "quote" ? "docs_contract_sale_quote_title" : "docs_contract_sale_invoice_title"), L = w(F ? "docs_contract_sale_credit_note_date_label" : u.kind === "quote" ? "docs_contract_sale_quote_date_label" : "docs_contract_sale_invoice_date_label"), R = w(F ? "docs_contract_sale_credit_note_recipient_label" : "docs_contract_sale_invoice_recipient_label"), z = F ? -1 : 1;
|
|
49
80
|
return /* @__PURE__ */ i("main", {
|
|
50
81
|
className: "flex flex-grow flex-col px-4 md:px-8",
|
|
51
82
|
children: [
|
|
@@ -55,7 +86,7 @@ function u({ saleDocument: u, items: d, subtotal: f, tax: p, total: m, formatDat
|
|
|
55
86
|
className: o("grid md:grid-cols-2", S ? "gap-3 md:gap-4" : "gap-6 md:gap-8"),
|
|
56
87
|
children: [/* @__PURE__ */ i("div", { children: [/* @__PURE__ */ i("h1", {
|
|
57
88
|
className: o("flex flex-wrap items-baseline gap-x-2 gap-y-1 font-semibold text-foreground", S ? "text-lg" : "text-xl"),
|
|
58
|
-
children: [/* @__PURE__ */ r("span", { children:
|
|
89
|
+
children: [/* @__PURE__ */ r("span", { children: I }), /* @__PURE__ */ i("span", {
|
|
59
90
|
className: "font-normal text-muted-foreground",
|
|
60
91
|
children: ["#", u.saleDocumentNumber]
|
|
61
92
|
})]
|
|
@@ -74,7 +105,7 @@ function u({ saleDocument: u, items: d, subtotal: f, tax: p, total: m, formatDat
|
|
|
74
105
|
className: "mb-2",
|
|
75
106
|
children: [/* @__PURE__ */ r("p", {
|
|
76
107
|
className: "font-semibold text-foreground",
|
|
77
|
-
children:
|
|
108
|
+
children: L
|
|
78
109
|
}), /* @__PURE__ */ r("p", {
|
|
79
110
|
className: "text-muted-foreground",
|
|
80
111
|
children: h(u.date)
|
|
@@ -89,33 +120,57 @@ function u({ saleDocument: u, items: d, subtotal: f, tax: p, total: m, formatDat
|
|
|
89
120
|
})]
|
|
90
121
|
}), /* @__PURE__ */ i("div", {
|
|
91
122
|
className: o("grid md:grid-cols-2", S ? "gap-3 md:gap-4" : "gap-6 md:gap-8"),
|
|
92
|
-
children: [
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
className: "text-muted-foreground whitespace-pre-line",
|
|
97
|
-
children: O
|
|
98
|
-
}) : null] }), /* @__PURE__ */ i("div", {
|
|
99
|
-
className: o("md:text-right", S && "text-sm leading-5"),
|
|
100
|
-
children: [
|
|
101
|
-
/* @__PURE__ */ r("h3", {
|
|
102
|
-
className: "mb-2 font-semibold text-foreground",
|
|
103
|
-
children: P
|
|
104
|
-
}),
|
|
105
|
-
/* @__PURE__ */ r("p", {
|
|
106
|
-
className: "font-bold text-foreground",
|
|
107
|
-
children: u.recipient.name
|
|
108
|
-
}),
|
|
109
|
-
k ? /* @__PURE__ */ r("p", {
|
|
110
|
-
className: "text-muted-foreground whitespace-pre-line",
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ i("div", { children: [
|
|
125
|
+
/* @__PURE__ */ r("h2", {
|
|
126
|
+
className: o("font-semibold text-primary", S ? "text-lg" : "text-xl"),
|
|
111
127
|
children: k
|
|
112
|
-
})
|
|
128
|
+
}),
|
|
113
129
|
A ? /* @__PURE__ */ r("p", {
|
|
114
|
-
className: "text-muted-foreground",
|
|
130
|
+
className: "text-xs text-muted-foreground",
|
|
115
131
|
children: A
|
|
132
|
+
}) : null,
|
|
133
|
+
j ? /* @__PURE__ */ r("p", {
|
|
134
|
+
className: "text-muted-foreground whitespace-pre-line",
|
|
135
|
+
children: j
|
|
116
136
|
}) : null
|
|
117
|
-
]
|
|
118
|
-
|
|
137
|
+
] }),
|
|
138
|
+
/* @__PURE__ */ i("div", {
|
|
139
|
+
className: o("md:text-right", S && "text-sm leading-5"),
|
|
140
|
+
children: [
|
|
141
|
+
/* @__PURE__ */ r("h3", {
|
|
142
|
+
className: "mb-2 font-semibold text-foreground",
|
|
143
|
+
children: R
|
|
144
|
+
}),
|
|
145
|
+
/* @__PURE__ */ r("p", {
|
|
146
|
+
className: "font-bold text-foreground",
|
|
147
|
+
children: u.recipient.name
|
|
148
|
+
}),
|
|
149
|
+
N ? /* @__PURE__ */ r("p", {
|
|
150
|
+
className: "text-muted-foreground whitespace-pre-line",
|
|
151
|
+
children: N
|
|
152
|
+
}) : null,
|
|
153
|
+
P ? /* @__PURE__ */ r("p", {
|
|
154
|
+
className: "text-muted-foreground",
|
|
155
|
+
children: P
|
|
156
|
+
}) : null
|
|
157
|
+
]
|
|
158
|
+
}),
|
|
159
|
+
M.length > 0 ? /* @__PURE__ */ r("dl", {
|
|
160
|
+
className: "-mt-2.5 flex flex-wrap gap-x-2 gap-y-0.5 text-[11px] leading-4 text-muted-foreground md:col-span-2",
|
|
161
|
+
"data-testid": "contract-sale-document-issuer-legal-identity",
|
|
162
|
+
children: M.map((e) => /* @__PURE__ */ i("div", {
|
|
163
|
+
className: "inline-flex min-w-0 gap-1",
|
|
164
|
+
children: [/* @__PURE__ */ r("dt", {
|
|
165
|
+
className: "font-medium text-foreground",
|
|
166
|
+
children: /* @__PURE__ */ i("span", { children: [e.label, ":"] })
|
|
167
|
+
}), /* @__PURE__ */ r("dd", {
|
|
168
|
+
className: "break-words",
|
|
169
|
+
children: /* @__PURE__ */ r("span", { children: e.value })
|
|
170
|
+
})]
|
|
171
|
+
}, e.key))
|
|
172
|
+
}) : null
|
|
173
|
+
]
|
|
119
174
|
})]
|
|
120
175
|
}),
|
|
121
176
|
_ && u.rental ? /* @__PURE__ */ r("section", {
|
|
@@ -202,11 +257,11 @@ function u({ saleDocument: u, items: d, subtotal: f, tax: p, total: m, formatDat
|
|
|
202
257
|
}),
|
|
203
258
|
/* @__PURE__ */ r("div", {
|
|
204
259
|
className: "w-3/12 text-right md:w-1/6",
|
|
205
|
-
children: /* @__PURE__ */ r("span", { children: c(e.unitPrice / t *
|
|
260
|
+
children: /* @__PURE__ */ r("span", { children: c(e.unitPrice / t * z, u.currency, g.customer) })
|
|
206
261
|
}),
|
|
207
262
|
/* @__PURE__ */ r("div", {
|
|
208
263
|
className: "w-1/6 text-right",
|
|
209
|
-
children: /* @__PURE__ */ r("span", { children: c(e.quantity * e.unitPrice / t *
|
|
264
|
+
children: /* @__PURE__ */ r("span", { children: c(e.quantity * e.unitPrice / t * z, u.currency, g.customer) })
|
|
210
265
|
})
|
|
211
266
|
]
|
|
212
267
|
}, e.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignatureModal.d.ts","sourceRoot":"","sources":["../../../src/components/ContractSaleDocument/SignatureModal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SignatureModal.d.ts","sourceRoot":"","sources":["../../../src/components/ContractSaleDocument/SignatureModal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAA;AAOnF,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,MAAM,EAAE,CAAC,SAAS,EAAE,6BAA6B,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;CAC3E,CAAA;AAED,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,mBAAmB,2CAmG9E"}
|
|
@@ -1,142 +1,100 @@
|
|
|
1
1
|
import { Button as e } from "../../ui/button.js";
|
|
2
2
|
import { Label as t } from "../../ui/label.js";
|
|
3
3
|
import { Input as n } from "../../ui/input.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
4
|
+
import { SignatureInput as r } from "../SignatureInput/index.js";
|
|
5
|
+
import { useState as i } from "react";
|
|
6
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
import { useTranslation as s } from "react-i18next";
|
|
8
8
|
//#region src/components/ContractSaleDocument/SignatureModal.tsx
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
let e = _.current?.getCanvas();
|
|
14
|
-
if (!e || typeof PointerEvent > "u") return;
|
|
15
|
-
let t = (t) => {
|
|
16
|
-
t.isPrimary && e.setPointerCapture(t.pointerId);
|
|
17
|
-
}, n = (t) => {
|
|
18
|
-
e.hasPointerCapture(t.pointerId) && e.releasePointerCapture(t.pointerId);
|
|
19
|
-
};
|
|
20
|
-
return e.addEventListener("pointerdown", t), e.addEventListener("pointerup", n), e.addEventListener("pointercancel", n), () => {
|
|
21
|
-
e.removeEventListener("pointerdown", t), e.removeEventListener("pointerup", n), e.removeEventListener("pointercancel", n);
|
|
22
|
-
};
|
|
23
|
-
}, []);
|
|
24
|
-
let E = () => {
|
|
25
|
-
_.current?.clear(), C(!1);
|
|
26
|
-
}, D = async () => {
|
|
27
|
-
if (_.current?.isEmpty()) {
|
|
28
|
-
window.alert(g("docs_contract_sale_signature_validation_signature"));
|
|
9
|
+
function c({ isOpen: c, onClose: l, onSave: u }) {
|
|
10
|
+
let { t: d } = s(), [f, p] = i(""), [m, h] = i(""), [g, _] = i(null), [v, y] = i(!1), b = async () => {
|
|
11
|
+
if (!g) {
|
|
12
|
+
window.alert(d("docs_contract_sale_signature_validation_signature"));
|
|
29
13
|
return;
|
|
30
14
|
}
|
|
31
|
-
if (!
|
|
32
|
-
window.alert(
|
|
15
|
+
if (!f || !m) {
|
|
16
|
+
window.alert(d("docs_contract_sale_signature_validation_identity"));
|
|
33
17
|
return;
|
|
34
18
|
}
|
|
35
|
-
|
|
36
|
-
T(!0);
|
|
19
|
+
y(!0);
|
|
37
20
|
try {
|
|
38
|
-
await
|
|
21
|
+
await u({
|
|
39
22
|
mode: "signature",
|
|
40
|
-
name:
|
|
41
|
-
phone:
|
|
42
|
-
signature:
|
|
23
|
+
name: f,
|
|
24
|
+
phone: m,
|
|
25
|
+
signature: g,
|
|
43
26
|
date: /* @__PURE__ */ new Date()
|
|
44
|
-
}),
|
|
27
|
+
}), l();
|
|
45
28
|
} catch (e) {
|
|
46
29
|
console.error("Failed to save contract document signature", e);
|
|
47
|
-
let t = e instanceof Error && e.message.trim().length > 0 ? e.message :
|
|
30
|
+
let t = e instanceof Error && e.message.trim().length > 0 ? e.message : d("docs_contract_sale_signature_submit_error");
|
|
48
31
|
window.alert(t);
|
|
49
32
|
} finally {
|
|
50
|
-
|
|
33
|
+
y(!1);
|
|
51
34
|
}
|
|
52
35
|
};
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
className: `fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4 transition-opacity ${
|
|
55
|
-
"aria-hidden": !
|
|
56
|
-
children: /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ a("div", {
|
|
37
|
+
className: `fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4 transition-opacity ${c ? "pointer-events-auto opacity-100 visible" : "pointer-events-none opacity-0 invisible"}`,
|
|
38
|
+
"aria-hidden": !c,
|
|
39
|
+
children: /* @__PURE__ */ o("div", {
|
|
57
40
|
className: "w-full max-w-lg rounded-xl border border-border bg-card p-6 shadow-xl",
|
|
58
41
|
children: [
|
|
59
|
-
/* @__PURE__ */
|
|
42
|
+
/* @__PURE__ */ a("h2", {
|
|
60
43
|
className: "mb-4 text-2xl font-bold text-card-foreground",
|
|
61
|
-
children:
|
|
44
|
+
children: d("docs_contract_sale_signature_modal_title")
|
|
62
45
|
}),
|
|
63
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ o("div", {
|
|
64
47
|
className: "space-y-4",
|
|
65
48
|
children: [
|
|
66
|
-
/* @__PURE__ */
|
|
49
|
+
/* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a(t, {
|
|
67
50
|
htmlFor: "signature-name",
|
|
68
51
|
className: "text-card-foreground",
|
|
69
|
-
children:
|
|
70
|
-
}), /* @__PURE__ */
|
|
52
|
+
children: d("docs_contract_sale_signature_name_label")
|
|
53
|
+
}), /* @__PURE__ */ a(n, {
|
|
71
54
|
type: "text",
|
|
72
55
|
id: "signature-name",
|
|
73
|
-
value:
|
|
74
|
-
onChange: (e) =>
|
|
56
|
+
value: f,
|
|
57
|
+
onChange: (e) => p(e.target.value),
|
|
75
58
|
className: "mt-1",
|
|
76
|
-
disabled:
|
|
59
|
+
disabled: v
|
|
77
60
|
})] }),
|
|
78
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a(t, {
|
|
79
62
|
htmlFor: "signature-phone",
|
|
80
63
|
className: "text-card-foreground",
|
|
81
|
-
children:
|
|
82
|
-
}), /* @__PURE__ */
|
|
64
|
+
children: d("docs_contract_sale_signature_phone_label")
|
|
65
|
+
}), /* @__PURE__ */ a(n, {
|
|
83
66
|
type: "tel",
|
|
84
67
|
id: "signature-phone",
|
|
85
|
-
value:
|
|
86
|
-
onChange: (e) =>
|
|
68
|
+
value: m,
|
|
69
|
+
onChange: (e) => h(e.target.value),
|
|
87
70
|
className: "mt-1",
|
|
88
|
-
disabled:
|
|
71
|
+
disabled: v
|
|
89
72
|
})] }),
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
penColor: "black",
|
|
103
|
-
canvasProps: { className: "absolute inset-0 h-full w-full" },
|
|
104
|
-
onEnd: () => {
|
|
105
|
-
C(!(_.current?.isEmpty() ?? !0));
|
|
106
|
-
}
|
|
107
|
-
}), /* @__PURE__ */ o("div", {
|
|
108
|
-
className: "pointer-events-none absolute rounded-sm border border-dashed border-primary/35",
|
|
109
|
-
style: {
|
|
110
|
-
top: u,
|
|
111
|
-
bottom: u,
|
|
112
|
-
left: d,
|
|
113
|
-
right: d
|
|
114
|
-
}
|
|
115
|
-
})]
|
|
116
|
-
})
|
|
117
|
-
}),
|
|
118
|
-
/* @__PURE__ */ o(e, {
|
|
119
|
-
onClick: E,
|
|
120
|
-
variant: "link",
|
|
121
|
-
size: "sm",
|
|
122
|
-
className: "mt-1 h-auto p-0",
|
|
123
|
-
disabled: w,
|
|
124
|
-
children: g("docs_contract_sale_signature_clear")
|
|
125
|
-
})
|
|
126
|
-
] })
|
|
73
|
+
/* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a(t, {
|
|
74
|
+
htmlFor: "signature-canvas",
|
|
75
|
+
className: "mb-1 text-card-foreground",
|
|
76
|
+
children: /* @__PURE__ */ a("span", { children: d("docs_contract_sale_signature_canvas_label") })
|
|
77
|
+
}), /* @__PURE__ */ a(r, {
|
|
78
|
+
value: g,
|
|
79
|
+
onChange: _,
|
|
80
|
+
clearLabel: d("docs_contract_sale_signature_clear"),
|
|
81
|
+
ariaLabel: d("docs_contract_sale_signature_canvas_label"),
|
|
82
|
+
id: "signature-canvas",
|
|
83
|
+
disabled: v
|
|
84
|
+
})] })
|
|
127
85
|
]
|
|
128
86
|
}),
|
|
129
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ o("div", {
|
|
130
88
|
className: "mt-6 flex justify-end gap-4",
|
|
131
|
-
children: [/* @__PURE__ */
|
|
132
|
-
onClick:
|
|
89
|
+
children: [/* @__PURE__ */ a(e, {
|
|
90
|
+
onClick: l,
|
|
133
91
|
variant: "secondary",
|
|
134
|
-
disabled:
|
|
135
|
-
children:
|
|
136
|
-
}), /* @__PURE__ */
|
|
137
|
-
onClick: () => void
|
|
138
|
-
disabled: !
|
|
139
|
-
children:
|
|
92
|
+
disabled: v,
|
|
93
|
+
children: d("docs_contract_sale_modal_cancel")
|
|
94
|
+
}), /* @__PURE__ */ a(e, {
|
|
95
|
+
onClick: () => void b(),
|
|
96
|
+
disabled: !f || !m || !g || v,
|
|
97
|
+
children: d(v ? "docs_contract_sale_signature_modal_saving" : "docs_contract_sale_signature_modal_submit")
|
|
140
98
|
})]
|
|
141
99
|
})
|
|
142
100
|
]
|
|
@@ -144,4 +102,4 @@ function p({ isOpen: p, onClose: m, onSave: h }) {
|
|
|
144
102
|
});
|
|
145
103
|
}
|
|
146
104
|
//#endregion
|
|
147
|
-
export {
|
|
105
|
+
export { c as SignatureModal };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"businessHoursStatus.d.ts","sourceRoot":"","sources":["../../../src/components/Footer/businessHoursStatus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"businessHoursStatus.d.ts","sourceRoot":"","sources":["../../../src/components/Footer/businessHoursStatus.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAC1B,MAAM,0BAA0B,CAAA;AAKjC,KAAK,0BAA0B,GAAG;IAChC,YAAY,EAAE,iBAAiB,CAAA;IAC/B,qBAAqB,EAAE,oBAAoB,EAAE,CAAA;IAC7C,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,IAAI,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAC3B;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IACA,IAAI,EAAE,QAAQ,CAAA;IACd,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,aAAa,EAAE,MAAM,CAAA;QACrB,IAAI,EAAE,MAAM,CAAA;KACb,GAAG,IAAI,CAAA;CACT,GACC;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAA;AAwDvB,eAAO,MAAM,sBAAsB,GAAI,mEAKpC,0BAA0B,KAAG,mBAgD/B,CAAA;AAED,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,KAAG,MAexE,CAAA;AAED,eAAO,MAAM,0BAA0B,GAAI,YAAY,MAAM,EAAE,UAAU,MAAM,KAAG,MAejF,CAAA;AAED,eAAO,MAAM,uBAAuB,GAAI,YAAY,MAAM,EAAE,UAAU,MAAM,KAAG,MAiB9E,CAAA"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveOpeningHoursForDate as e } from "../../chunks/pkg/booking-engine/dist/utils/opening-hours-period-TCyLhzZw.js";
|
|
2
|
+
import "../../chunks/pkg/booking-engine/dist/schemas-DW5gdDYz.js";
|
|
3
|
+
import { businessDateStringToDate as t, calendarDateToBusinessDateString as n, instantToBusinessDateTimeParts as r, normalizeBusinessDateString as i, parseTimeToMinutes as a } from "../../lib/booking-period.js";
|
|
2
4
|
//#region src/components/Footer/businessHoursStatus.ts
|
|
3
|
-
var o = 370, s = (
|
|
4
|
-
let i = e
|
|
5
|
-
if (!Number.isNaN(i.getTime())) return i.setDate(i.getDate() + r),
|
|
5
|
+
var o = 370, s = (e, r) => {
|
|
6
|
+
let i = t(e);
|
|
7
|
+
if (!Number.isNaN(i.getTime())) return i.setDate(i.getDate() + r), n(i);
|
|
6
8
|
}, c = (e) => Array.isArray(e) ? e.map((e) => {
|
|
7
9
|
let t = a(e.start), n = a(e.end);
|
|
8
10
|
return t == null || n == null || t >= 1440 || n > 1440 || n <= t ? null : {
|
|
@@ -10,23 +12,7 @@ var o = 370, s = (n, r) => {
|
|
|
10
12
|
endMinutes: n,
|
|
11
13
|
startTime: e.start
|
|
12
14
|
};
|
|
13
|
-
}).filter((e) => e != null).sort((e, t) => e.startMinutes - t.startMinutes) : [], l = (e) => {
|
|
14
|
-
let t = /* @__PURE__ */ new Map();
|
|
15
|
-
return e.forEach((e) => {
|
|
16
|
-
let n = i(e.date);
|
|
17
|
-
n && t.set(n, e);
|
|
18
|
-
}), t;
|
|
19
|
-
}, u = (e, t, r) => {
|
|
20
|
-
let a = r.get(e);
|
|
21
|
-
if (a) return c(a.openingSlots);
|
|
22
|
-
let o = t.find((t) => {
|
|
23
|
-
let n = i(t.startDate), r = i(t.endDate);
|
|
24
|
-
return !n || !r ? !1 : e >= (n < r ? n : r) && e <= (n < r ? r : n);
|
|
25
|
-
});
|
|
26
|
-
if (!o) return [];
|
|
27
|
-
let s = n(e);
|
|
28
|
-
return c(o.openingHours.find((e) => e.day === s)?.openingSlots);
|
|
29
|
-
}, d = ({ openingHours: e, openingHoursOverrides: t, timeZone: n, referenceDate: i = /* @__PURE__ */ new Date() }) => {
|
|
15
|
+
}).filter((e) => e != null).sort((e, t) => e.startMinutes - t.startMinutes) : [], l = (t, n, r) => c(e(n, r, t).openingSlots), u = ({ openingHours: e, openingHoursOverrides: t, timeZone: n, referenceDate: i = /* @__PURE__ */ new Date() }) => {
|
|
30
16
|
if (e.length === 0 && t.length === 0) return { kind: "unknown" };
|
|
31
17
|
let a;
|
|
32
18
|
try {
|
|
@@ -35,19 +21,18 @@ var o = 370, s = (n, r) => {
|
|
|
35
21
|
return { kind: "unknown" };
|
|
36
22
|
}
|
|
37
23
|
if (!a) return { kind: "unknown" };
|
|
38
|
-
let
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (i) return {
|
|
24
|
+
for (let n = 0; n <= o; n += 1) {
|
|
25
|
+
let r = s(a.dateString, n);
|
|
26
|
+
if (!r) return { kind: "unknown" };
|
|
27
|
+
let i = l(r, e, t);
|
|
28
|
+
if (n === 0 && i.some((e) => a.minutesFromMidnight >= e.startMinutes && a.minutesFromMidnight < e.endMinutes)) return { kind: "open" };
|
|
29
|
+
let o = i.find((e) => n > 0 || e.startMinutes > a.minutesFromMidnight);
|
|
30
|
+
if (o) return {
|
|
46
31
|
kind: "closed",
|
|
47
32
|
nextOpening: {
|
|
48
|
-
date:
|
|
49
|
-
daysFromToday:
|
|
50
|
-
time:
|
|
33
|
+
date: r,
|
|
34
|
+
daysFromToday: n,
|
|
35
|
+
time: o.startTime
|
|
51
36
|
}
|
|
52
37
|
};
|
|
53
38
|
}
|
|
@@ -55,7 +40,7 @@ var o = 370, s = (n, r) => {
|
|
|
55
40
|
kind: "closed",
|
|
56
41
|
nextOpening: null
|
|
57
42
|
};
|
|
58
|
-
},
|
|
43
|
+
}, d = (e, t) => {
|
|
59
44
|
let n = a(e);
|
|
60
45
|
if (n == null || n >= 1440) return e;
|
|
61
46
|
let r = new Date(Date.UTC(2024, 0, 1, Math.floor(n / 60), n % 60));
|
|
@@ -68,7 +53,7 @@ var o = 370, s = (n, r) => {
|
|
|
68
53
|
} catch {
|
|
69
54
|
return e;
|
|
70
55
|
}
|
|
71
|
-
},
|
|
56
|
+
}, f = (e, t) => {
|
|
72
57
|
let n = i(e);
|
|
73
58
|
if (!n) return e;
|
|
74
59
|
let [r, a, o] = n.split("-").map(Number), s = new Date(Date.UTC(r, a - 1, o));
|
|
@@ -80,7 +65,7 @@ var o = 370, s = (n, r) => {
|
|
|
80
65
|
} catch {
|
|
81
66
|
return e;
|
|
82
67
|
}
|
|
83
|
-
},
|
|
68
|
+
}, p = (e, t) => {
|
|
84
69
|
let n = i(e);
|
|
85
70
|
if (!n) return e;
|
|
86
71
|
let [r, a, o] = n.split("-").map(Number), s = new Date(Date.UTC(r, a - 1, o));
|
|
@@ -96,4 +81,4 @@ var o = 370, s = (n, r) => {
|
|
|
96
81
|
}
|
|
97
82
|
};
|
|
98
83
|
//#endregion
|
|
99
|
-
export {
|
|
84
|
+
export { p as formatBusinessHoursDate, d as formatBusinessHoursTime, f as formatBusinessHoursWeekday, u as getBusinessHoursStatus };
|