@foxscheduling/shared 0.1.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/README.md +56 -0
- package/dist/cjs/constants/emailUnsubscribeReasons.cjs +13 -0
- package/dist/cjs/constants/emailUnsubscribeReasons.d.ts +4 -0
- package/dist/cjs/constants/emailUnsubscribeReasons.d.ts.map +1 -0
- package/dist/cjs/index.cjs +24 -0
- package/dist/cjs/index.d.ts +9 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/types/db.availability.cjs +12 -0
- package/dist/cjs/types/db.availability.d.ts +33 -0
- package/dist/cjs/types/db.availability.d.ts.map +1 -0
- package/dist/cjs/types/db.booking.cjs +2 -0
- package/dist/cjs/types/db.booking.d.ts +101 -0
- package/dist/cjs/types/db.booking.d.ts.map +1 -0
- package/dist/cjs/types/db.cjs +2 -0
- package/dist/cjs/types/db.customers.cjs +2 -0
- package/dist/cjs/types/db.customers.d.ts +14 -0
- package/dist/cjs/types/db.customers.d.ts.map +1 -0
- package/dist/cjs/types/db.d.ts +11 -0
- package/dist/cjs/types/db.d.ts.map +1 -0
- package/dist/cjs/types/db.directory.cjs +2 -0
- package/dist/cjs/types/db.directory.d.ts +38 -0
- package/dist/cjs/types/db.directory.d.ts.map +1 -0
- package/dist/cjs/types/db.emailFlow.cjs +2 -0
- package/dist/cjs/types/db.emailFlow.d.ts +29 -0
- package/dist/cjs/types/db.emailFlow.d.ts.map +1 -0
- package/dist/cjs/types/db.mcpUserContext.cjs +2 -0
- package/dist/cjs/types/db.mcpUserContext.d.ts +29 -0
- package/dist/cjs/types/db.mcpUserContext.d.ts.map +1 -0
- package/dist/cjs/types/db.notification.cjs +2 -0
- package/dist/cjs/types/db.notification.d.ts +27 -0
- package/dist/cjs/types/db.notification.d.ts.map +1 -0
- package/dist/cjs/types/db.oauth.cjs +2 -0
- package/dist/cjs/types/db.oauth.d.ts +55 -0
- package/dist/cjs/types/db.oauth.d.ts.map +1 -0
- package/dist/cjs/types/db.partnerApiKey.cjs +2 -0
- package/dist/cjs/types/db.partnerApiKey.d.ts +15 -0
- package/dist/cjs/types/db.partnerApiKey.d.ts.map +1 -0
- package/dist/cjs/types/db.paymentPending.cjs +2 -0
- package/dist/cjs/types/db.paymentPending.d.ts +16 -0
- package/dist/cjs/types/db.paymentPending.d.ts.map +1 -0
- package/dist/cjs/types/db.service.cjs +15 -0
- package/dist/cjs/types/db.service.d.ts +145 -0
- package/dist/cjs/types/db.service.d.ts.map +1 -0
- package/dist/cjs/types/db.tax.cjs +2 -0
- package/dist/cjs/types/db.tax.d.ts.map +1 -0
- package/dist/cjs/types/db.tenant.cjs +2 -0
- package/dist/cjs/types/db.tenant.d.ts +118 -0
- package/dist/cjs/types/db.tenant.d.ts.map +1 -0
- package/dist/cjs/types/db.tenantGroupedStat.cjs +2 -0
- package/dist/cjs/types/db.tenantGroupedStat.d.ts +13 -0
- package/dist/cjs/types/db.tenantGroupedStat.d.ts.map +1 -0
- package/dist/cjs/types/db.user.cjs +7 -0
- package/dist/cjs/types/db.user.d.ts +81 -0
- package/dist/cjs/types/db.user.d.ts.map +1 -0
- package/dist/cjs/types/db.userConfirmation.cjs +2 -0
- package/dist/cjs/types/db.userConfirmation.d.ts +17 -0
- package/dist/cjs/types/db.userConfirmation.d.ts.map +1 -0
- package/dist/cjs/types/db.userLoginSession.cjs +2 -0
- package/dist/cjs/types/db.userLoginSession.d.ts +28 -0
- package/dist/cjs/types/db.userLoginSession.d.ts.map +1 -0
- package/dist/cjs/types/db.webhook.cjs +10 -0
- package/dist/cjs/types/db.webhook.d.ts +16 -0
- package/dist/cjs/types/db.webhook.d.ts.map +1 -0
- package/dist/cjs/types/discover.cjs +2 -0
- package/dist/cjs/types/discover.d.ts +45 -0
- package/dist/cjs/types/discover.d.ts.map +1 -0
- package/dist/cjs/types/errorCodes.cjs +150 -0
- package/dist/cjs/types/errorCodes.d.ts +147 -0
- package/dist/cjs/types/errorCodes.d.ts.map +1 -0
- package/dist/cjs/types/index.cjs +44 -0
- package/dist/cjs/types/index.d.ts +84 -0
- package/dist/cjs/types/index.d.ts.map +1 -0
- package/dist/cjs/types/oauthScopes.cjs +33 -0
- package/dist/cjs/types/oauthScopes.d.ts +7 -0
- package/dist/cjs/types/oauthScopes.d.ts.map +1 -0
- package/dist/cjs/types/partnerDto.cjs +2 -0
- package/dist/cjs/types/partnerDto.d.ts +69 -0
- package/dist/cjs/types/partnerDto.d.ts.map +1 -0
- package/dist/cjs/types/pricing.cjs +2 -0
- package/dist/cjs/types/pricing.d.ts +31 -0
- package/dist/cjs/types/pricing.d.ts.map +1 -0
- package/dist/cjs/types/requestResponse.cjs +2 -0
- package/dist/cjs/types/requestResponse.d.ts +93 -0
- package/dist/cjs/types/requestResponse.d.ts.map +1 -0
- package/dist/cjs/types/subscription.cjs +2 -0
- package/dist/cjs/types/subscription.d.ts +50 -0
- package/dist/cjs/types/subscription.d.ts.map +1 -0
- package/dist/cjs/utils/bookingEmbed.cjs +178 -0
- package/dist/cjs/utils/bookingEmbed.d.ts +61 -0
- package/dist/cjs/utils/bookingEmbed.d.ts.map +1 -0
- package/dist/cjs/utils/bookingPageIcons.cjs +218 -0
- package/dist/cjs/utils/bookingPageIcons.d.ts +160 -0
- package/dist/cjs/utils/bookingPageIcons.d.ts.map +1 -0
- package/dist/cjs/utils/bookingProviders.cjs +27 -0
- package/dist/cjs/utils/bookingProviders.d.ts +25 -0
- package/dist/cjs/utils/bookingProviders.d.ts.map +1 -0
- package/dist/cjs/utils/currencies.cjs +148 -0
- package/dist/cjs/utils/currencies.d.ts +6 -0
- package/dist/cjs/utils/currencies.d.ts.map +1 -0
- package/dist/cjs/utils/dateTime.cjs +192 -0
- package/dist/cjs/utils/dateTime.d.ts +57 -0
- package/dist/cjs/utils/dateTime.d.ts.map +1 -0
- package/dist/cjs/utils/embedFrameLoader.cjs +76 -0
- package/dist/cjs/utils/embedFrameLoader.d.ts +15 -0
- package/dist/cjs/utils/embedFrameLoader.d.ts.map +1 -0
- package/dist/cjs/utils/extensionToContentType.cjs +24 -0
- package/dist/cjs/utils/extensionToContentType.d.ts +21 -0
- package/dist/cjs/utils/extensionToContentType.d.ts.map +1 -0
- package/dist/cjs/utils/generateUsername.cjs +7 -0
- package/dist/cjs/utils/generateUsername.d.ts.map +1 -0
- package/dist/cjs/utils/index.cjs +65 -0
- package/dist/cjs/utils/index.d.ts +26 -0
- package/dist/cjs/utils/index.d.ts.map +1 -0
- package/dist/cjs/utils/random.cjs +13 -0
- package/dist/cjs/utils/random.d.ts +3 -0
- package/dist/cjs/utils/random.d.ts.map +1 -0
- package/dist/cjs/utils/serviceReminderLabels.cjs +22 -0
- package/dist/cjs/utils/serviceReminderLabels.d.ts +5 -0
- package/dist/cjs/utils/serviceReminderLabels.d.ts.map +1 -0
- package/dist/cjs/utils/tenantSlug.cjs +299 -0
- package/dist/cjs/utils/tenantSlug.d.ts +7 -0
- package/dist/cjs/utils/tenantSlug.d.ts.map +1 -0
- package/dist/cjs/utils/textSlug.cjs +14 -0
- package/dist/cjs/utils/textSlug.d.ts +3 -0
- package/dist/cjs/utils/textSlug.d.ts.map +1 -0
- package/dist/cjs/utils/timezone.cjs +96 -0
- package/dist/cjs/utils/timezone.d.ts +2 -0
- package/dist/cjs/utils/timezone.d.ts.map +1 -0
- package/dist/cjs/utils/ucfirst.cjs +9 -0
- package/dist/cjs/utils/ucfirst.d.ts +2 -0
- package/dist/cjs/utils/ucfirst.d.ts.map +1 -0
- package/dist/constants/emailUnsubscribeReasons.d.ts +4 -0
- package/dist/constants/emailUnsubscribeReasons.d.ts.map +1 -0
- package/dist/constants/emailUnsubscribeReasons.js +10 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/types/db.availability.d.ts +33 -0
- package/dist/types/db.availability.d.ts.map +1 -0
- package/dist/types/db.availability.js +9 -0
- package/dist/types/db.booking.d.ts +101 -0
- package/dist/types/db.booking.d.ts.map +1 -0
- package/dist/types/db.booking.js +1 -0
- package/dist/types/db.customers.d.ts +14 -0
- package/dist/types/db.customers.d.ts.map +1 -0
- package/dist/types/db.customers.js +1 -0
- package/dist/types/db.d.ts +11 -0
- package/dist/types/db.d.ts.map +1 -0
- package/dist/types/db.directory.d.ts +38 -0
- package/dist/types/db.directory.d.ts.map +1 -0
- package/dist/types/db.directory.js +1 -0
- package/dist/types/db.emailFlow.d.ts +29 -0
- package/dist/types/db.emailFlow.d.ts.map +1 -0
- package/dist/types/db.emailFlow.js +1 -0
- package/dist/types/db.js +1 -0
- package/dist/types/db.mcpUserContext.d.ts +29 -0
- package/dist/types/db.mcpUserContext.d.ts.map +1 -0
- package/dist/types/db.mcpUserContext.js +1 -0
- package/dist/types/db.notification.d.ts +27 -0
- package/dist/types/db.notification.d.ts.map +1 -0
- package/dist/types/db.notification.js +1 -0
- package/dist/types/db.oauth.d.ts +55 -0
- package/dist/types/db.oauth.d.ts.map +1 -0
- package/dist/types/db.oauth.js +1 -0
- package/dist/types/db.partnerApiKey.d.ts +15 -0
- package/dist/types/db.partnerApiKey.d.ts.map +1 -0
- package/dist/types/db.partnerApiKey.js +1 -0
- package/dist/types/db.paymentPending.d.ts +16 -0
- package/dist/types/db.paymentPending.d.ts.map +1 -0
- package/dist/types/db.paymentPending.js +1 -0
- package/dist/types/db.service.d.ts +145 -0
- package/dist/types/db.service.d.ts.map +1 -0
- package/dist/types/db.service.js +12 -0
- package/dist/types/db.tax.d.ts.map +1 -0
- package/dist/types/db.tenant.d.ts +118 -0
- package/dist/types/db.tenant.d.ts.map +1 -0
- package/dist/types/db.tenant.js +1 -0
- package/dist/types/db.tenantGroupedStat.d.ts +13 -0
- package/dist/types/db.tenantGroupedStat.d.ts.map +1 -0
- package/dist/types/db.tenantGroupedStat.js +1 -0
- package/dist/types/db.user.d.ts +81 -0
- package/dist/types/db.user.d.ts.map +1 -0
- package/dist/types/db.user.js +4 -0
- package/dist/types/db.userConfirmation.d.ts +17 -0
- package/dist/types/db.userConfirmation.d.ts.map +1 -0
- package/dist/types/db.userConfirmation.js +1 -0
- package/dist/types/db.userLoginSession.d.ts +28 -0
- package/dist/types/db.userLoginSession.d.ts.map +1 -0
- package/dist/types/db.userLoginSession.js +1 -0
- package/dist/types/db.webhook.d.ts +16 -0
- package/dist/types/db.webhook.d.ts.map +1 -0
- package/dist/types/db.webhook.js +7 -0
- package/dist/types/discover.d.ts +45 -0
- package/dist/types/discover.d.ts.map +1 -0
- package/dist/types/discover.js +1 -0
- package/dist/types/errorCodes.d.ts +147 -0
- package/dist/types/errorCodes.d.ts.map +1 -0
- package/dist/types/errorCodes.js +147 -0
- package/dist/types/index.d.ts +84 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +28 -0
- package/dist/types/oauthScopes.d.ts +7 -0
- package/dist/types/oauthScopes.d.ts.map +1 -0
- package/dist/types/oauthScopes.js +28 -0
- package/dist/types/partnerDto.d.ts +69 -0
- package/dist/types/partnerDto.d.ts.map +1 -0
- package/dist/types/partnerDto.js +1 -0
- package/dist/types/pricing.d.ts +31 -0
- package/dist/types/pricing.d.ts.map +1 -0
- package/dist/types/pricing.js +1 -0
- package/dist/types/requestResponse.d.ts +93 -0
- package/dist/types/requestResponse.d.ts.map +1 -0
- package/dist/types/requestResponse.js +1 -0
- package/dist/types/subscription.d.ts +50 -0
- package/dist/types/subscription.d.ts.map +1 -0
- package/dist/types/subscription.js +1 -0
- package/dist/utils/bookingEmbed.d.ts +61 -0
- package/dist/utils/bookingEmbed.d.ts.map +1 -0
- package/dist/utils/bookingEmbed.js +161 -0
- package/dist/utils/bookingPageIcons.d.ts +160 -0
- package/dist/utils/bookingPageIcons.d.ts.map +1 -0
- package/dist/utils/bookingPageIcons.js +214 -0
- package/dist/utils/bookingProviders.d.ts +25 -0
- package/dist/utils/bookingProviders.d.ts.map +1 -0
- package/dist/utils/bookingProviders.js +23 -0
- package/dist/utils/currencies.d.ts +6 -0
- package/dist/utils/currencies.d.ts.map +1 -0
- package/dist/utils/currencies.js +145 -0
- package/dist/utils/dateTime.d.ts +57 -0
- package/dist/utils/dateTime.d.ts.map +1 -0
- package/dist/utils/dateTime.js +150 -0
- package/dist/utils/embedFrameLoader.d.ts +15 -0
- package/dist/utils/embedFrameLoader.d.ts.map +1 -0
- package/dist/utils/embedFrameLoader.js +70 -0
- package/dist/utils/extensionToContentType.d.ts +21 -0
- package/dist/utils/extensionToContentType.d.ts.map +1 -0
- package/dist/utils/extensionToContentType.js +20 -0
- package/dist/utils/generateUsername.d.ts.map +1 -0
- package/dist/utils/index.d.ts +26 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +45 -0
- package/dist/utils/random.d.ts +3 -0
- package/dist/utils/random.d.ts.map +1 -0
- package/dist/utils/random.js +8 -0
- package/dist/utils/serviceReminderLabels.d.ts +5 -0
- package/dist/utils/serviceReminderLabels.d.ts.map +1 -0
- package/dist/utils/serviceReminderLabels.js +18 -0
- package/dist/utils/tenantSlug.d.ts +7 -0
- package/dist/utils/tenantSlug.d.ts.map +1 -0
- package/dist/utils/tenantSlug.js +293 -0
- package/dist/utils/textSlug.d.ts +3 -0
- package/dist/utils/textSlug.d.ts.map +1 -0
- package/dist/utils/textSlug.js +10 -0
- package/dist/utils/timezone.d.ts +2 -0
- package/dist/utils/timezone.d.ts.map +1 -0
- package/dist/utils/timezone.js +93 -0
- package/dist/utils/ucfirst.d.ts +2 -0
- package/dist/utils/ucfirst.d.ts.map +1 -0
- package/dist/utils/ucfirst.js +5 -0
- package/package.json +46 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
export declare const BOOKING_PAGE_ICONS: {
|
|
2
|
+
clock: string;
|
|
3
|
+
"dollar-sign": string;
|
|
4
|
+
"arrow-right": string;
|
|
5
|
+
tag: string;
|
|
6
|
+
scissors: string;
|
|
7
|
+
sparkles: string;
|
|
8
|
+
heart: string;
|
|
9
|
+
star: string;
|
|
10
|
+
palette: string;
|
|
11
|
+
camera: string;
|
|
12
|
+
music: string;
|
|
13
|
+
briefcase: string;
|
|
14
|
+
dumbbell: string;
|
|
15
|
+
car: string;
|
|
16
|
+
home: string;
|
|
17
|
+
utensils: string;
|
|
18
|
+
coffee: string;
|
|
19
|
+
package: string;
|
|
20
|
+
"map-pin": string;
|
|
21
|
+
calendar: string;
|
|
22
|
+
phone: string;
|
|
23
|
+
mail: string;
|
|
24
|
+
video: string;
|
|
25
|
+
stethoscope: string;
|
|
26
|
+
"book-open": string;
|
|
27
|
+
wrench: string;
|
|
28
|
+
gift: string;
|
|
29
|
+
};
|
|
30
|
+
export declare function getServiceIconSvg(iconId?: keyof typeof BOOKING_PAGE_ICONS | null): string;
|
|
31
|
+
export declare const PRESET_ACCENTS: readonly [{
|
|
32
|
+
readonly value: "emerald";
|
|
33
|
+
readonly label: "Emerald";
|
|
34
|
+
readonly class: "from-emerald-500 to-teal-600";
|
|
35
|
+
readonly hoverBorder: "hover:border-emerald-500/50";
|
|
36
|
+
readonly hoverText: "group-hover:text-emerald-500";
|
|
37
|
+
readonly active: "border-emerald-500 bg-emerald-500/10 text-emerald-500";
|
|
38
|
+
readonly proseLink: "[&_a]:text-emerald-500 [&_a:hover]:text-emerald-600";
|
|
39
|
+
readonly link: "text-emerald-500 hover:text-emerald-600";
|
|
40
|
+
}, {
|
|
41
|
+
readonly value: "violet";
|
|
42
|
+
readonly label: "Violet";
|
|
43
|
+
readonly class: "from-violet-500 to-purple-600";
|
|
44
|
+
readonly hoverBorder: "hover:border-violet-500/50";
|
|
45
|
+
readonly hoverText: "group-hover:text-violet-500";
|
|
46
|
+
readonly active: "border-violet-500 bg-violet-500/10 text-violet-500";
|
|
47
|
+
readonly proseLink: "[&_a]:text-violet-500 [&_a:hover]:text-violet-600";
|
|
48
|
+
readonly link: "text-violet-500 hover:text-violet-600";
|
|
49
|
+
}, {
|
|
50
|
+
readonly value: "blue";
|
|
51
|
+
readonly label: "Blue";
|
|
52
|
+
readonly class: "from-blue-500 to-indigo-600";
|
|
53
|
+
readonly hoverBorder: "hover:border-blue-500/50";
|
|
54
|
+
readonly hoverText: "group-hover:text-blue-500";
|
|
55
|
+
readonly active: "border-blue-500 bg-blue-500/10 text-blue-500";
|
|
56
|
+
readonly proseLink: "[&_a]:text-blue-500 [&_a:hover]:text-blue-600";
|
|
57
|
+
readonly link: "text-blue-500 hover:text-blue-600";
|
|
58
|
+
}, {
|
|
59
|
+
readonly value: "cyan";
|
|
60
|
+
readonly label: "Cyan";
|
|
61
|
+
readonly class: "from-cyan-500 to-teal-600";
|
|
62
|
+
readonly hoverBorder: "hover:border-cyan-500/50";
|
|
63
|
+
readonly hoverText: "group-hover:text-cyan-500";
|
|
64
|
+
readonly active: "border-cyan-500 bg-cyan-500/10 text-cyan-500";
|
|
65
|
+
readonly proseLink: "[&_a]:text-cyan-500 [&_a:hover]:text-cyan-600";
|
|
66
|
+
readonly link: "text-cyan-500 hover:text-cyan-600";
|
|
67
|
+
}, {
|
|
68
|
+
readonly value: "sky";
|
|
69
|
+
readonly label: "Sky";
|
|
70
|
+
readonly class: "from-sky-500 to-blue-600";
|
|
71
|
+
readonly hoverBorder: "hover:border-sky-500/50";
|
|
72
|
+
readonly hoverText: "group-hover:text-sky-500";
|
|
73
|
+
readonly active: "border-sky-500 bg-sky-500/10 text-sky-500";
|
|
74
|
+
readonly proseLink: "[&_a]:text-sky-500 [&_a:hover]:text-sky-600";
|
|
75
|
+
readonly link: "text-sky-500 hover:text-sky-600";
|
|
76
|
+
}, {
|
|
77
|
+
readonly value: "indigo";
|
|
78
|
+
readonly label: "Indigo";
|
|
79
|
+
readonly class: "from-indigo-500 to-violet-600";
|
|
80
|
+
readonly hoverBorder: "hover:border-indigo-500/50";
|
|
81
|
+
readonly hoverText: "group-hover:text-indigo-500";
|
|
82
|
+
readonly active: "border-indigo-500 bg-indigo-500/10 text-indigo-500";
|
|
83
|
+
readonly proseLink: "[&_a]:text-indigo-500 [&_a:hover]:text-indigo-600";
|
|
84
|
+
readonly link: "text-indigo-500 hover:text-indigo-600";
|
|
85
|
+
}, {
|
|
86
|
+
readonly value: "fuchsia";
|
|
87
|
+
readonly label: "Fuchsia";
|
|
88
|
+
readonly class: "from-fuchsia-500 to-pink-600";
|
|
89
|
+
readonly hoverBorder: "hover:border-fuchsia-500/50";
|
|
90
|
+
readonly hoverText: "group-hover:text-fuchsia-500";
|
|
91
|
+
readonly active: "border-fuchsia-500 bg-fuchsia-500/10 text-fuchsia-500";
|
|
92
|
+
readonly proseLink: "[&_a]:text-fuchsia-500 [&_a:hover]:text-fuchsia-600";
|
|
93
|
+
readonly link: "text-fuchsia-500 hover:text-fuchsia-600";
|
|
94
|
+
}, {
|
|
95
|
+
readonly value: "rose";
|
|
96
|
+
readonly label: "Rose";
|
|
97
|
+
readonly class: "from-rose-500 to-pink-600";
|
|
98
|
+
readonly hoverBorder: "hover:border-rose-500/50";
|
|
99
|
+
readonly hoverText: "group-hover:text-rose-500";
|
|
100
|
+
readonly active: "border-rose-500 bg-rose-500/10 text-rose-500";
|
|
101
|
+
readonly proseLink: "[&_a]:text-rose-500 [&_a:hover]:text-rose-600";
|
|
102
|
+
readonly link: "text-rose-500 hover:text-rose-600";
|
|
103
|
+
}, {
|
|
104
|
+
readonly value: "amber";
|
|
105
|
+
readonly label: "Amber";
|
|
106
|
+
readonly class: "from-amber-500 to-orange-600";
|
|
107
|
+
readonly hoverBorder: "hover:border-amber-500/50";
|
|
108
|
+
readonly hoverText: "group-hover:text-amber-500";
|
|
109
|
+
readonly active: "border-amber-500 bg-amber-500/10 text-amber-500";
|
|
110
|
+
readonly proseLink: "[&_a]:text-amber-500 [&_a:hover]:text-amber-600";
|
|
111
|
+
readonly link: "text-amber-500 hover:text-amber-600";
|
|
112
|
+
}, {
|
|
113
|
+
readonly value: "orange";
|
|
114
|
+
readonly label: "Orange";
|
|
115
|
+
readonly class: "from-orange-500 to-amber-600";
|
|
116
|
+
readonly hoverBorder: "hover:border-orange-500/50";
|
|
117
|
+
readonly hoverText: "group-hover:text-orange-500";
|
|
118
|
+
readonly active: "border-orange-500 bg-orange-500/10 text-orange-500";
|
|
119
|
+
readonly proseLink: "[&_a]:text-orange-500 [&_a:hover]:text-orange-600";
|
|
120
|
+
readonly link: "text-orange-500 hover:text-orange-600";
|
|
121
|
+
}, {
|
|
122
|
+
readonly value: "red";
|
|
123
|
+
readonly label: "Red";
|
|
124
|
+
readonly class: "from-red-500 to-rose-600";
|
|
125
|
+
readonly hoverBorder: "hover:border-red-500/50";
|
|
126
|
+
readonly hoverText: "group-hover:text-red-500";
|
|
127
|
+
readonly active: "border-red-500 bg-red-500/10 text-red-500";
|
|
128
|
+
readonly proseLink: "[&_a]:text-red-500 [&_a:hover]:text-red-600";
|
|
129
|
+
readonly link: "text-red-500 hover:text-red-600";
|
|
130
|
+
}, {
|
|
131
|
+
readonly value: "lime";
|
|
132
|
+
readonly label: "Lime";
|
|
133
|
+
readonly class: "from-lime-500 to-green-600";
|
|
134
|
+
readonly hoverBorder: "hover:border-lime-500/50";
|
|
135
|
+
readonly hoverText: "group-hover:text-lime-500";
|
|
136
|
+
readonly active: "border-lime-500 bg-lime-500/10 text-lime-500";
|
|
137
|
+
readonly proseLink: "[&_a]:text-lime-500 [&_a:hover]:text-lime-600";
|
|
138
|
+
readonly link: "text-lime-500 hover:text-lime-600";
|
|
139
|
+
}, {
|
|
140
|
+
readonly value: "slate";
|
|
141
|
+
readonly label: "Slate";
|
|
142
|
+
readonly class: "from-slate-500 to-slate-700";
|
|
143
|
+
readonly hoverBorder: "hover:border-slate-500/50";
|
|
144
|
+
readonly hoverText: "group-hover:text-slate-500";
|
|
145
|
+
readonly active: "border-slate-500 bg-slate-500/10 text-slate-500";
|
|
146
|
+
readonly proseLink: "[&_a]:text-slate-500 [&_a:hover]:text-slate-600";
|
|
147
|
+
readonly link: "text-slate-500 hover:text-slate-600";
|
|
148
|
+
}];
|
|
149
|
+
export type AccentValue = (typeof PRESET_ACCENTS)[number]["value"] | "custom";
|
|
150
|
+
export declare const ACCENT_PRESETS: Record<string, {
|
|
151
|
+
class: string;
|
|
152
|
+
link: string;
|
|
153
|
+
border: string;
|
|
154
|
+
hoverBg: string;
|
|
155
|
+
}>;
|
|
156
|
+
/** Hex gradients for accent swatches - Tailwind v4 may not include from-/to- utilities */
|
|
157
|
+
export declare const ACCENT_GRADIENT_STYLES: Record<string, string>;
|
|
158
|
+
/** Primary hex for each preset - used for grid layout CSS variables */
|
|
159
|
+
export declare const ACCENT_HEX: Record<string, string>;
|
|
160
|
+
//# sourceMappingURL=bookingPageIcons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookingPageIcons.d.ts","sourceRoot":"","sources":["../../../src/utils/bookingPageIcons.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4B9B,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,OAAO,kBAAkB,GAAG,IAAI,GAAG,MAAM,CAGzF;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmIjB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC;AAE9E,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAc3G,CAAC;AAEF,0FAA0F;AAC1F,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAczD,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAc7C,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeBookingProviderIds = normalizeBookingProviderIds;
|
|
4
|
+
exports.bookingProviderDisplayFields = bookingProviderDisplayFields;
|
|
5
|
+
/** Effective staff IDs assigned to the booking (deduped, non-empty strings). */
|
|
6
|
+
function normalizeBookingProviderIds(booking) {
|
|
7
|
+
const raw = booking.providerIds?.filter((id) => typeof id === "string" && id.length > 0) ?? [];
|
|
8
|
+
if (raw.length)
|
|
9
|
+
return [...new Set(raw)];
|
|
10
|
+
const legacy = booking.providerId?.trim();
|
|
11
|
+
return legacy ? [legacy] : [];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Parallel display arrays aligned with `orderedProviderIds` (same order as
|
|
15
|
+
* {@link normalizeBookingProviderIds} when that array is passed through).
|
|
16
|
+
*/
|
|
17
|
+
function bookingProviderDisplayFields(orderedProviderIds, userById) {
|
|
18
|
+
const providerNames = orderedProviderIds.map((pid) => {
|
|
19
|
+
const u = userById.get(pid);
|
|
20
|
+
if (!u)
|
|
21
|
+
return pid;
|
|
22
|
+
const name = `${u.cognitoRecord?.firstName ?? ""} ${u.cognitoRecord?.lastName ?? ""}`.trim();
|
|
23
|
+
return name || u.email || pid;
|
|
24
|
+
});
|
|
25
|
+
const providerPictureUrls = orderedProviderIds.map((pid) => userById.get(pid)?.cognitoRecord?.picture?.trim() || undefined);
|
|
26
|
+
return { providerNames, providerPictureUrls };
|
|
27
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Booking } from "../types/db.booking.js";
|
|
2
|
+
/** Booking row may still carry legacy `providerId` (singular) from older records. */
|
|
3
|
+
export type BookingWithLegacyProviders = Pick<Booking, "providerIds"> & {
|
|
4
|
+
providerId?: string;
|
|
5
|
+
};
|
|
6
|
+
/** Effective staff IDs assigned to the booking (deduped, non-empty strings). */
|
|
7
|
+
export declare function normalizeBookingProviderIds(booking: BookingWithLegacyProviders): string[];
|
|
8
|
+
/** Minimal user shape for building booking provider labels in list APIs. */
|
|
9
|
+
export type UserProfileForProviderDisplay = {
|
|
10
|
+
email?: string;
|
|
11
|
+
cognitoRecord?: {
|
|
12
|
+
firstName?: string;
|
|
13
|
+
lastName?: string;
|
|
14
|
+
picture?: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Parallel display arrays aligned with `orderedProviderIds` (same order as
|
|
19
|
+
* {@link normalizeBookingProviderIds} when that array is passed through).
|
|
20
|
+
*/
|
|
21
|
+
export declare function bookingProviderDisplayFields(orderedProviderIds: string[], userById: Map<string, UserProfileForProviderDisplay | undefined>): {
|
|
22
|
+
providerNames: string[];
|
|
23
|
+
providerPictureUrls: (string | undefined)[];
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=bookingProviders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookingProviders.d.ts","sourceRoot":"","sources":["../../../src/utils/bookingProviders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,qFAAqF;AACrF,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,GAAG;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,gFAAgF;AAChF,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,0BAA0B,GAClC,MAAM,EAAE,CAQV;AAED,4EAA4E;AAC5E,MAAM,MAAM,6BAA6B,GAAG;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,kBAAkB,EAAE,MAAM,EAAE,EAC5B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,6BAA6B,GAAG,SAAS,CAAC,GAC/D;IACD,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,mBAAmB,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;CAC7C,CAYA"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.currencies = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Currencies supported by Stripe for payments.
|
|
6
|
+
* @see https://stripe.com/docs/currencies
|
|
7
|
+
*/
|
|
8
|
+
exports.currencies = [
|
|
9
|
+
"AED",
|
|
10
|
+
"AFN",
|
|
11
|
+
"ALL",
|
|
12
|
+
"AMD",
|
|
13
|
+
"ANG",
|
|
14
|
+
"AOA",
|
|
15
|
+
"ARS",
|
|
16
|
+
"AUD",
|
|
17
|
+
"AWG",
|
|
18
|
+
"AZN",
|
|
19
|
+
"BAM",
|
|
20
|
+
"BBD",
|
|
21
|
+
"BDT",
|
|
22
|
+
"BGN",
|
|
23
|
+
"BIF",
|
|
24
|
+
"BMD",
|
|
25
|
+
"BND",
|
|
26
|
+
"BOB",
|
|
27
|
+
"BRL",
|
|
28
|
+
"BSD",
|
|
29
|
+
"BWP",
|
|
30
|
+
"BZD",
|
|
31
|
+
"CAD",
|
|
32
|
+
"CDF",
|
|
33
|
+
"CHF",
|
|
34
|
+
"CLP",
|
|
35
|
+
"CNY",
|
|
36
|
+
"COP",
|
|
37
|
+
"CRC",
|
|
38
|
+
"CVE",
|
|
39
|
+
"CZK",
|
|
40
|
+
"DJF",
|
|
41
|
+
"DKK",
|
|
42
|
+
"DOP",
|
|
43
|
+
"DZD",
|
|
44
|
+
"EEK",
|
|
45
|
+
"EGP",
|
|
46
|
+
"ETB",
|
|
47
|
+
"EUR",
|
|
48
|
+
"FJD",
|
|
49
|
+
"FKP",
|
|
50
|
+
"GBP",
|
|
51
|
+
"GEL",
|
|
52
|
+
"GIP",
|
|
53
|
+
"GMD",
|
|
54
|
+
"GNF",
|
|
55
|
+
"GTQ",
|
|
56
|
+
"GYD",
|
|
57
|
+
"HKD",
|
|
58
|
+
"HNL",
|
|
59
|
+
"HRK",
|
|
60
|
+
"HTG",
|
|
61
|
+
"HUF",
|
|
62
|
+
"IDR",
|
|
63
|
+
"ILS",
|
|
64
|
+
"INR",
|
|
65
|
+
"ISK",
|
|
66
|
+
"JMD",
|
|
67
|
+
"JPY",
|
|
68
|
+
"KES",
|
|
69
|
+
"KGS",
|
|
70
|
+
"KHR",
|
|
71
|
+
"KMF",
|
|
72
|
+
"KRW",
|
|
73
|
+
"KYD",
|
|
74
|
+
"KZT",
|
|
75
|
+
"LAK",
|
|
76
|
+
"LBP",
|
|
77
|
+
"LKR",
|
|
78
|
+
"LRD",
|
|
79
|
+
"LSL",
|
|
80
|
+
"LTL",
|
|
81
|
+
"LVL",
|
|
82
|
+
"MAD",
|
|
83
|
+
"MDL",
|
|
84
|
+
"MGA",
|
|
85
|
+
"MKD",
|
|
86
|
+
"MNT",
|
|
87
|
+
"MOP",
|
|
88
|
+
"MRO",
|
|
89
|
+
"MUR",
|
|
90
|
+
"MVR",
|
|
91
|
+
"MWK",
|
|
92
|
+
"MXN",
|
|
93
|
+
"MYR",
|
|
94
|
+
"MZN",
|
|
95
|
+
"NAD",
|
|
96
|
+
"NGN",
|
|
97
|
+
"NIO",
|
|
98
|
+
"NOK",
|
|
99
|
+
"NPR",
|
|
100
|
+
"NZD",
|
|
101
|
+
"PAB",
|
|
102
|
+
"PEN",
|
|
103
|
+
"PGK",
|
|
104
|
+
"PHP",
|
|
105
|
+
"PKR",
|
|
106
|
+
"PLN",
|
|
107
|
+
"PYG",
|
|
108
|
+
"QAR",
|
|
109
|
+
"RON",
|
|
110
|
+
"RSD",
|
|
111
|
+
"RUB",
|
|
112
|
+
"RWF",
|
|
113
|
+
"SAR",
|
|
114
|
+
"SBD",
|
|
115
|
+
"SCR",
|
|
116
|
+
"SEK",
|
|
117
|
+
"SGD",
|
|
118
|
+
"SHP",
|
|
119
|
+
"SLL",
|
|
120
|
+
"SOS",
|
|
121
|
+
"SRD",
|
|
122
|
+
"STD",
|
|
123
|
+
"SVC",
|
|
124
|
+
"SZL",
|
|
125
|
+
"THB",
|
|
126
|
+
"TJS",
|
|
127
|
+
"TOP",
|
|
128
|
+
"TRY",
|
|
129
|
+
"TTD",
|
|
130
|
+
"TWD",
|
|
131
|
+
"TZS",
|
|
132
|
+
"UAH",
|
|
133
|
+
"UGX",
|
|
134
|
+
"USD",
|
|
135
|
+
"UYU",
|
|
136
|
+
"UZS",
|
|
137
|
+
"VEF",
|
|
138
|
+
"VND",
|
|
139
|
+
"VUV",
|
|
140
|
+
"WST",
|
|
141
|
+
"XAF",
|
|
142
|
+
"XCD",
|
|
143
|
+
"XOF",
|
|
144
|
+
"XPF",
|
|
145
|
+
"YER",
|
|
146
|
+
"ZAR",
|
|
147
|
+
"ZMW",
|
|
148
|
+
];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Currencies supported by Stripe for payments.
|
|
3
|
+
* @see https://stripe.com/docs/currencies
|
|
4
|
+
*/
|
|
5
|
+
export declare const currencies: readonly ["AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BIF", "BMD", "BND", "BOB", "BRL", "BSD", "BWP", "BZD", "CAD", "CDF", "CHF", "CLP", "CNY", "COP", "CRC", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EEK", "EGP", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "INR", "ISK", "JMD", "JPY", "KES", "KGS", "KHR", "KMF", "KRW", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LVL", "MAD", "MDL", "MGA", "MKD", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SEK", "SGD", "SHP", "SLL", "SOS", "SRD", "STD", "SVC", "SZL", "THB", "TJS", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "UYU", "UZS", "VEF", "VND", "VUV", "WST", "XAF", "XCD", "XOF", "XPF", "YER", "ZAR", "ZMW"];
|
|
6
|
+
//# sourceMappingURL=currencies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currencies.d.ts","sourceRoot":"","sources":["../../../src/utils/currencies.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,UAAU,w9BA4Ib,CAAC"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getCurrentWeekDatesSundayToSaturday = exports.validateDate = exports.validYearMonth = exports.dayOfWeek = exports.howManyDaysInMonth = exports.to24h = exports.to12h = exports.isValidDateTime = exports.addToDate = exports.getDayjsFunc = exports.getDayjsFuncUTC = exports.getDayjs = exports.getHoursInArray = exports.getDaysInArray = exports.timeExpired = exports.dateIsBetween = exports.getLastXMonths = exports.getLastXDays = exports.convertLocaleToUTC = exports.convertTimeToLocale = exports.formatDate = exports.currentFullDate = exports.getUTCTimestamp = exports.yesterday = exports.today = exports.lastMonth = exports.beginningOfLastMonth = exports.endOfThisMonth = exports.beginningOfThisMonth = exports.endOfNextWeek = exports.beginningOfNextWeek = exports.endOfLastWeek = exports.beginningOfLastWeek = exports.endOfThisWeek = exports.beginningOfThisWeek = exports.thisMonth = exports.thisYear = exports.defaultDateFormat = exports.dateFormat = void 0;
|
|
7
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
|
+
const utc_js_1 = __importDefault(require("dayjs/plugin/utc.js"));
|
|
9
|
+
const timezone_js_1 = __importDefault(require("dayjs/plugin/timezone.js"));
|
|
10
|
+
const customParseFormat_js_1 = __importDefault(require("dayjs/plugin/customParseFormat.js"));
|
|
11
|
+
const advancedFormat_js_1 = __importDefault(require("dayjs/plugin/advancedFormat.js"));
|
|
12
|
+
const isBetween_js_1 = __importDefault(require("dayjs/plugin/isBetween.js"));
|
|
13
|
+
const isSameOrAfter_js_1 = __importDefault(require("dayjs/plugin/isSameOrAfter.js"));
|
|
14
|
+
const isSameOrBefore_js_1 = __importDefault(require("dayjs/plugin/isSameOrBefore.js"));
|
|
15
|
+
dayjs_1.default.extend(utc_js_1.default);
|
|
16
|
+
dayjs_1.default.extend(timezone_js_1.default);
|
|
17
|
+
dayjs_1.default.extend(customParseFormat_js_1.default);
|
|
18
|
+
dayjs_1.default.extend(advancedFormat_js_1.default);
|
|
19
|
+
dayjs_1.default.extend(isBetween_js_1.default);
|
|
20
|
+
dayjs_1.default.extend(isSameOrAfter_js_1.default);
|
|
21
|
+
dayjs_1.default.extend(isSameOrBefore_js_1.default);
|
|
22
|
+
exports.dateFormat = "YYYY-MM-DD";
|
|
23
|
+
exports.defaultDateFormat = "YYYY-MM-DD HH:mm:ss";
|
|
24
|
+
const thisYear = () => (0, dayjs_1.default)().utc().format("YYYY");
|
|
25
|
+
exports.thisYear = thisYear;
|
|
26
|
+
const thisMonth = (timezone = "UTC") => (0, dayjs_1.default)().tz(timezone).format("YYYY-MM");
|
|
27
|
+
exports.thisMonth = thisMonth;
|
|
28
|
+
const beginningOfThisWeek = (timezone = "UTC") => (0, dayjs_1.default)().tz(timezone).startOf("week").format("YYYY-MM-DD");
|
|
29
|
+
exports.beginningOfThisWeek = beginningOfThisWeek;
|
|
30
|
+
const endOfThisWeek = (timezone = "UTC") => (0, dayjs_1.default)().tz(timezone).endOf("week").format("YYYY-MM-DD");
|
|
31
|
+
exports.endOfThisWeek = endOfThisWeek;
|
|
32
|
+
const beginningOfLastWeek = (timezone = "UTC") => (0, dayjs_1.default)().tz(timezone).subtract(1, "week").startOf("week").format("YYYY-MM-DD");
|
|
33
|
+
exports.beginningOfLastWeek = beginningOfLastWeek;
|
|
34
|
+
const endOfLastWeek = (timezone = "UTC") => (0, dayjs_1.default)().tz(timezone).subtract(1, "week").endOf("week").format("YYYY-MM-DD");
|
|
35
|
+
exports.endOfLastWeek = endOfLastWeek;
|
|
36
|
+
const beginningOfNextWeek = (timezone = "UTC") => (0, dayjs_1.default)().tz(timezone).add(1, "week").startOf("week").format("YYYY-MM-DD");
|
|
37
|
+
exports.beginningOfNextWeek = beginningOfNextWeek;
|
|
38
|
+
const endOfNextWeek = (timezone = "UTC") => (0, dayjs_1.default)().tz(timezone).add(1, "week").endOf("week").format("YYYY-MM-DD");
|
|
39
|
+
exports.endOfNextWeek = endOfNextWeek;
|
|
40
|
+
const beginningOfThisMonth = (timezone = "UTC") => (0, dayjs_1.default)().tz(timezone).startOf("month").format("YYYY-MM-DD");
|
|
41
|
+
exports.beginningOfThisMonth = beginningOfThisMonth;
|
|
42
|
+
const endOfThisMonth = (timezone = "UTC") => (0, dayjs_1.default)().tz(timezone).endOf("month").format("YYYY-MM-DD");
|
|
43
|
+
exports.endOfThisMonth = endOfThisMonth;
|
|
44
|
+
const beginningOfLastMonth = (timezone = "UTC") => (0, dayjs_1.default)().tz(timezone).subtract(1, "month").startOf("month").format("YYYY-MM-DD");
|
|
45
|
+
exports.beginningOfLastMonth = beginningOfLastMonth;
|
|
46
|
+
const lastMonth = () => (0, dayjs_1.default)().subtract(1, "month").endOf("month").utc().format("YYYY-MM");
|
|
47
|
+
exports.lastMonth = lastMonth;
|
|
48
|
+
const today = (timezone = "UTC") => (0, dayjs_1.default)().tz(timezone).format(exports.dateFormat);
|
|
49
|
+
exports.today = today;
|
|
50
|
+
const yesterday = () => (0, dayjs_1.default)().subtract(1, "day").utc().format(exports.dateFormat);
|
|
51
|
+
exports.yesterday = yesterday;
|
|
52
|
+
const getUTCTimestamp = () => (0, dayjs_1.default)().utc().valueOf();
|
|
53
|
+
exports.getUTCTimestamp = getUTCTimestamp;
|
|
54
|
+
/**
|
|
55
|
+
* @returns current date time in utc
|
|
56
|
+
*/
|
|
57
|
+
const currentFullDate = () => (0, dayjs_1.default)().utc().format(exports.defaultDateFormat);
|
|
58
|
+
exports.currentFullDate = currentFullDate;
|
|
59
|
+
const formatDate = (date, format = "Do MMM., YYYY") => (0, dayjs_1.default)(date).format(format);
|
|
60
|
+
exports.formatDate = formatDate;
|
|
61
|
+
/**
|
|
62
|
+
* converts UTC datetime to user's locale
|
|
63
|
+
*/
|
|
64
|
+
const convertTimeToLocale = (date, timezoneName, format = exports.defaultDateFormat) => {
|
|
65
|
+
const d = dayjs_1.default.utc(date);
|
|
66
|
+
return d.tz(timezoneName).format(format);
|
|
67
|
+
};
|
|
68
|
+
exports.convertTimeToLocale = convertTimeToLocale;
|
|
69
|
+
const convertLocaleToUTC = (date, timezoneName, format = exports.defaultDateFormat) => {
|
|
70
|
+
return dayjs_1.default.tz(date, format, timezoneName).utc().format(format);
|
|
71
|
+
};
|
|
72
|
+
exports.convertLocaleToUTC = convertLocaleToUTC;
|
|
73
|
+
const getLastXDays = (numDays, startFrom) => {
|
|
74
|
+
const formattedDates = [];
|
|
75
|
+
for (let i = 0; i < numDays; i++) {
|
|
76
|
+
formattedDates.push((0, dayjs_1.default)(startFrom).subtract(i, "day").format("YYYY-MM-DD"));
|
|
77
|
+
}
|
|
78
|
+
return formattedDates.reverse();
|
|
79
|
+
};
|
|
80
|
+
exports.getLastXDays = getLastXDays;
|
|
81
|
+
const getLastXMonths = (months, startFrom) => {
|
|
82
|
+
const formattedDates = [];
|
|
83
|
+
for (let i = 0; i < months; i++) {
|
|
84
|
+
formattedDates.push((0, dayjs_1.default)(startFrom).subtract(i, "month").format("YYYY-MM"));
|
|
85
|
+
}
|
|
86
|
+
return formattedDates.reverse();
|
|
87
|
+
};
|
|
88
|
+
exports.getLastXMonths = getLastXMonths;
|
|
89
|
+
const dateIsBetween = (from, to, granularity = "day", now) => {
|
|
90
|
+
const check = now ?? (0, dayjs_1.default)().utc();
|
|
91
|
+
const exp = dayjs_1.default.utc(to);
|
|
92
|
+
const start = dayjs_1.default.utc(from);
|
|
93
|
+
return check.isBetween(start, exp, granularity, "[]");
|
|
94
|
+
};
|
|
95
|
+
exports.dateIsBetween = dateIsBetween;
|
|
96
|
+
const timeExpired = (date, now, inclusive = false) => {
|
|
97
|
+
const check = now ?? (0, dayjs_1.default)().utc();
|
|
98
|
+
const exp = dayjs_1.default.utc(date);
|
|
99
|
+
return inclusive ? check.isSameOrAfter(exp) : check.isAfter(exp);
|
|
100
|
+
};
|
|
101
|
+
exports.timeExpired = timeExpired;
|
|
102
|
+
const getDaysInArray = (startDate, endDate, format = exports.dateFormat) => {
|
|
103
|
+
const end = dayjs_1.default.utc((0, dayjs_1.default)(endDate).format(format));
|
|
104
|
+
const start = dayjs_1.default.utc((0, dayjs_1.default)(startDate).format(format));
|
|
105
|
+
const days = [];
|
|
106
|
+
let current = start;
|
|
107
|
+
while (current.isSameOrBefore(end)) {
|
|
108
|
+
days.push(current.format(format));
|
|
109
|
+
current = current.add(1, "day");
|
|
110
|
+
}
|
|
111
|
+
return days;
|
|
112
|
+
};
|
|
113
|
+
exports.getDaysInArray = getDaysInArray;
|
|
114
|
+
const getHoursInArray = (startDate, endDate) => {
|
|
115
|
+
const end = dayjs_1.default.utc(endDate);
|
|
116
|
+
const start = dayjs_1.default.utc(startDate);
|
|
117
|
+
const days = [];
|
|
118
|
+
let current = start;
|
|
119
|
+
while (current.isSameOrBefore(end)) {
|
|
120
|
+
days.push(current.format("YYYY-MM-DD HH:00:00"));
|
|
121
|
+
current = current.add(1, "hour");
|
|
122
|
+
}
|
|
123
|
+
return days;
|
|
124
|
+
};
|
|
125
|
+
exports.getHoursInArray = getHoursInArray;
|
|
126
|
+
exports.getDayjs = dayjs_1.default;
|
|
127
|
+
const getDayjsFuncUTC = (inp) => dayjs_1.default.utc(inp);
|
|
128
|
+
exports.getDayjsFuncUTC = getDayjsFuncUTC;
|
|
129
|
+
const getDayjsFunc = (inp) => (0, dayjs_1.default)(inp);
|
|
130
|
+
exports.getDayjsFunc = getDayjsFunc;
|
|
131
|
+
const addToDate = (creationDate, total, unit = "minute", format = exports.defaultDateFormat) => (0, dayjs_1.default)(creationDate).add(total, unit).format(format);
|
|
132
|
+
exports.addToDate = addToDate;
|
|
133
|
+
const isValidDateTime = (value) => (0, dayjs_1.default)(value).isValid();
|
|
134
|
+
exports.isValidDateTime = isValidDateTime;
|
|
135
|
+
/** Convert 24h "HH:mm" to 12h { hour: 1-12, period: "AM"|"PM" } */
|
|
136
|
+
const to12h = (time24) => {
|
|
137
|
+
const [h] = time24.split(":").map(Number);
|
|
138
|
+
const hour24 = h ?? 0;
|
|
139
|
+
if (hour24 === 0)
|
|
140
|
+
return { hour: 12, period: "AM" };
|
|
141
|
+
if (hour24 === 12)
|
|
142
|
+
return { hour: 12, period: "PM" };
|
|
143
|
+
if (hour24 < 12)
|
|
144
|
+
return { hour: hour24, period: "AM" };
|
|
145
|
+
return { hour: hour24 - 12, period: "PM" };
|
|
146
|
+
};
|
|
147
|
+
exports.to12h = to12h;
|
|
148
|
+
/** Convert 12h to 24h "HH:mm" */
|
|
149
|
+
const to24h = (hour, period) => {
|
|
150
|
+
let h = hour;
|
|
151
|
+
if (period === "AM") {
|
|
152
|
+
h = hour === 12 ? 0 : hour;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
h = hour === 12 ? 12 : hour + 12;
|
|
156
|
+
}
|
|
157
|
+
return `${String(h).padStart(2, "0")}:00`;
|
|
158
|
+
};
|
|
159
|
+
exports.to24h = to24h;
|
|
160
|
+
const howManyDaysInMonth = (year, month) => {
|
|
161
|
+
return (0, dayjs_1.default)().month(month - 1).year(year).daysInMonth();
|
|
162
|
+
};
|
|
163
|
+
exports.howManyDaysInMonth = howManyDaysInMonth;
|
|
164
|
+
const dayOfWeek = (date) => {
|
|
165
|
+
return (0, dayjs_1.default)(date).day();
|
|
166
|
+
};
|
|
167
|
+
exports.dayOfWeek = dayOfWeek;
|
|
168
|
+
const validYearMonth = (yearMonth) => {
|
|
169
|
+
if (!yearMonth || !yearMonth.match(/^\d{4}-\d{2}$/))
|
|
170
|
+
return false;
|
|
171
|
+
const [year, month] = yearMonth.split("-").map(Number);
|
|
172
|
+
return year >= 1000 && year <= 9999 && month >= 1 && month <= 12;
|
|
173
|
+
};
|
|
174
|
+
exports.validYearMonth = validYearMonth;
|
|
175
|
+
const validateDate = (date) => {
|
|
176
|
+
return (0, dayjs_1.default)(date).isValid();
|
|
177
|
+
};
|
|
178
|
+
exports.validateDate = validateDate;
|
|
179
|
+
/**
|
|
180
|
+
* Returns an array of 7 dates (Sunday → Saturday for the current week)
|
|
181
|
+
* formatted as YYYY-MM-DD using the tenant's timezone (fallback to UTC).
|
|
182
|
+
*/
|
|
183
|
+
const getCurrentWeekDatesSundayToSaturday = (timezone = "UTC") => {
|
|
184
|
+
// Start from "now" in the tenant's timezone, then take the week starting Sunday in that tz.
|
|
185
|
+
const startOfWeek = (0, dayjs_1.default)().tz(timezone).startOf("week"); // Sunday-start week
|
|
186
|
+
const days = [];
|
|
187
|
+
for (let i = 0; i < 7; i++) {
|
|
188
|
+
days.push(startOfWeek.add(i, "day").tz(timezone).format(exports.dateFormat));
|
|
189
|
+
}
|
|
190
|
+
return days;
|
|
191
|
+
};
|
|
192
|
+
exports.getCurrentWeekDatesSundayToSaturday = getCurrentWeekDatesSundayToSaturday;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
export declare const dateFormat = "YYYY-MM-DD";
|
|
3
|
+
export declare const defaultDateFormat = "YYYY-MM-DD HH:mm:ss";
|
|
4
|
+
export declare const thisYear: () => string;
|
|
5
|
+
export declare const thisMonth: (timezone?: string) => string;
|
|
6
|
+
export declare const beginningOfThisWeek: (timezone?: string) => string;
|
|
7
|
+
export declare const endOfThisWeek: (timezone?: string) => string;
|
|
8
|
+
export declare const beginningOfLastWeek: (timezone?: string) => string;
|
|
9
|
+
export declare const endOfLastWeek: (timezone?: string) => string;
|
|
10
|
+
export declare const beginningOfNextWeek: (timezone?: string) => string;
|
|
11
|
+
export declare const endOfNextWeek: (timezone?: string) => string;
|
|
12
|
+
export declare const beginningOfThisMonth: (timezone?: string) => string;
|
|
13
|
+
export declare const endOfThisMonth: (timezone?: string) => string;
|
|
14
|
+
export declare const beginningOfLastMonth: (timezone?: string) => string;
|
|
15
|
+
export declare const lastMonth: () => string;
|
|
16
|
+
export declare const today: (timezone?: string) => string;
|
|
17
|
+
export declare const yesterday: () => string;
|
|
18
|
+
export declare const getUTCTimestamp: () => number;
|
|
19
|
+
/**
|
|
20
|
+
* @returns current date time in utc
|
|
21
|
+
*/
|
|
22
|
+
export declare const currentFullDate: () => string;
|
|
23
|
+
export declare const formatDate: (date: string, format?: string) => string;
|
|
24
|
+
/**
|
|
25
|
+
* converts UTC datetime to user's locale
|
|
26
|
+
*/
|
|
27
|
+
export declare const convertTimeToLocale: (date: string, timezoneName: string, format?: string) => string;
|
|
28
|
+
export declare const convertLocaleToUTC: (date: string, timezoneName: string, format?: string) => string;
|
|
29
|
+
export declare const getLastXDays: (numDays: number, startFrom?: string) => string[];
|
|
30
|
+
export declare const getLastXMonths: (months: number, startFrom?: string) => string[];
|
|
31
|
+
export type DayjsUnit = "year" | "month" | "week" | "day" | "hour" | "minute";
|
|
32
|
+
export declare const dateIsBetween: (from: string, to: string, granularity?: DayjsUnit, now?: dayjs.Dayjs) => boolean;
|
|
33
|
+
export declare const timeExpired: (date: string, now?: dayjs.Dayjs, inclusive?: boolean) => boolean;
|
|
34
|
+
export declare const getDaysInArray: (startDate: string, endDate: string, format?: string) => string[];
|
|
35
|
+
export declare const getHoursInArray: (startDate: string, endDate: string) => string[];
|
|
36
|
+
export declare const getDayjs: typeof dayjs;
|
|
37
|
+
export declare const getDayjsFuncUTC: (inp?: string | Date | dayjs.Dayjs) => dayjs.Dayjs;
|
|
38
|
+
export declare const getDayjsFunc: (inp?: string | Date | dayjs.Dayjs) => dayjs.Dayjs;
|
|
39
|
+
export declare const addToDate: (creationDate: string, total: number, unit?: dayjs.ManipulateType, format?: string) => string;
|
|
40
|
+
export declare const isValidDateTime: (value: string) => boolean;
|
|
41
|
+
/** Convert 24h "HH:mm" to 12h { hour: 1-12, period: "AM"|"PM" } */
|
|
42
|
+
export declare const to12h: (time24: string) => {
|
|
43
|
+
hour: number;
|
|
44
|
+
period: "AM" | "PM";
|
|
45
|
+
};
|
|
46
|
+
/** Convert 12h to 24h "HH:mm" */
|
|
47
|
+
export declare const to24h: (hour: number, period: "AM" | "PM") => string;
|
|
48
|
+
export declare const howManyDaysInMonth: (year: number, month: number) => number;
|
|
49
|
+
export declare const dayOfWeek: (date: string) => number;
|
|
50
|
+
export declare const validYearMonth: (yearMonth: string) => boolean;
|
|
51
|
+
export declare const validateDate: (date: string) => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Returns an array of 7 dates (Sunday → Saturday for the current week)
|
|
54
|
+
* formatted as YYYY-MM-DD using the tenant's timezone (fallback to UTC).
|
|
55
|
+
*/
|
|
56
|
+
export declare const getCurrentWeekDatesSundayToSaturday: (timezone?: string) => string[];
|
|
57
|
+
//# sourceMappingURL=dateTime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateTime.d.ts","sourceRoot":"","sources":["../../../src/utils/dateTime.ts"],"names":[],"mappings":"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"}
|