arky-sdk 0.3.84 → 0.3.86
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/index.cjs +198 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -2
- package/dist/index.d.ts +18 -2
- package/dist/index.js +198 -2
- package/dist/index.js.map +1 -1
- package/dist/promo-CZi1KfyM.d.cts +271 -0
- package/dist/promo-gWLL0twu.d.ts +271 -0
- package/dist/utils.cjs +193 -0
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +179 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/dist/svg-3F_m7296.d.cts +0 -133
- package/dist/svg-4hIdMU6f.d.ts +0 -133
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { Price, Payment } from './types.cjs';
|
|
2
|
+
|
|
3
|
+
interface ServiceDuration {
|
|
4
|
+
duration: number;
|
|
5
|
+
isPause?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface WorkingHours {
|
|
8
|
+
from: number;
|
|
9
|
+
to: number;
|
|
10
|
+
}
|
|
11
|
+
interface WorkingDay {
|
|
12
|
+
day: string;
|
|
13
|
+
workingHours: WorkingHours[];
|
|
14
|
+
}
|
|
15
|
+
interface SpecificDate {
|
|
16
|
+
date: number;
|
|
17
|
+
workingHours: WorkingHours[];
|
|
18
|
+
}
|
|
19
|
+
interface OutcastDate {
|
|
20
|
+
month: number;
|
|
21
|
+
day: number;
|
|
22
|
+
workingHours: WorkingHours[];
|
|
23
|
+
}
|
|
24
|
+
interface WorkingTime {
|
|
25
|
+
workingDays?: WorkingDay[];
|
|
26
|
+
specificDates?: SpecificDate[];
|
|
27
|
+
outcastDates?: OutcastDate[];
|
|
28
|
+
}
|
|
29
|
+
interface TimelinePoint {
|
|
30
|
+
timestamp: number;
|
|
31
|
+
concurrent: number;
|
|
32
|
+
}
|
|
33
|
+
interface ProviderWithTimeline {
|
|
34
|
+
id: string;
|
|
35
|
+
workingTime?: WorkingTime;
|
|
36
|
+
timeline: TimelinePoint[];
|
|
37
|
+
concurrentLimit: number;
|
|
38
|
+
}
|
|
39
|
+
interface AvailableSlot {
|
|
40
|
+
from: number;
|
|
41
|
+
to: number;
|
|
42
|
+
providerId: string;
|
|
43
|
+
}
|
|
44
|
+
interface ComputeSlotsOptions {
|
|
45
|
+
providers: ProviderWithTimeline[];
|
|
46
|
+
date: Date;
|
|
47
|
+
durations: ServiceDuration[];
|
|
48
|
+
timezone: string;
|
|
49
|
+
slotInterval?: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Calculate total duration from an array of service durations
|
|
53
|
+
*/
|
|
54
|
+
declare function getTotalDuration(durations: ServiceDuration[]): number;
|
|
55
|
+
/**
|
|
56
|
+
* Check if a time slot is blocked by existing reservations
|
|
57
|
+
*/
|
|
58
|
+
declare function isBlocked(from: number, to: number, timeline: TimelinePoint[], limit: number): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Get working hours for a specific date, considering:
|
|
61
|
+
* 1. Specific dates (exact date overrides)
|
|
62
|
+
* 2. Outcast dates (recurring monthly overrides)
|
|
63
|
+
* 3. Working days (regular weekly schedule)
|
|
64
|
+
*/
|
|
65
|
+
declare function getWorkingHoursForDate(wt: WorkingTime | undefined, date: Date, tz: string): WorkingHours[];
|
|
66
|
+
/**
|
|
67
|
+
* Compute all available slots for a given date
|
|
68
|
+
*/
|
|
69
|
+
declare function computeSlotsForDate(opts: ComputeSlotsOptions): AvailableSlot[];
|
|
70
|
+
/**
|
|
71
|
+
* Check if a date has any available slots
|
|
72
|
+
*/
|
|
73
|
+
declare function hasAvailableSlots(opts: ComputeSlotsOptions): boolean;
|
|
74
|
+
interface CalendarDay {
|
|
75
|
+
date: Date;
|
|
76
|
+
iso: string;
|
|
77
|
+
available: boolean;
|
|
78
|
+
isSelected: boolean;
|
|
79
|
+
isInRange: boolean;
|
|
80
|
+
isToday: boolean;
|
|
81
|
+
blank: boolean;
|
|
82
|
+
}
|
|
83
|
+
interface BuildCalendarOptions {
|
|
84
|
+
currentMonth: Date;
|
|
85
|
+
selectedDate: string | null;
|
|
86
|
+
startDate: string | null;
|
|
87
|
+
endDate: string | null;
|
|
88
|
+
providers: ProviderWithTimeline[];
|
|
89
|
+
selectedProvider: ProviderWithTimeline | null;
|
|
90
|
+
durations: ServiceDuration[];
|
|
91
|
+
timezone: string;
|
|
92
|
+
isMultiDay: boolean;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Build a calendar grid for a month with availability info
|
|
96
|
+
*/
|
|
97
|
+
declare function buildCalendar(opts: BuildCalendarOptions): CalendarDay[];
|
|
98
|
+
/**
|
|
99
|
+
* Get month and year display string
|
|
100
|
+
*/
|
|
101
|
+
declare function getMonthYear(date: Date): string;
|
|
102
|
+
|
|
103
|
+
interface Block {
|
|
104
|
+
id: string;
|
|
105
|
+
key: string;
|
|
106
|
+
type: string;
|
|
107
|
+
properties: any;
|
|
108
|
+
value: any;
|
|
109
|
+
}
|
|
110
|
+
interface Collection {
|
|
111
|
+
id: string;
|
|
112
|
+
blocks: Block[];
|
|
113
|
+
}
|
|
114
|
+
interface CollectionEntry {
|
|
115
|
+
id: string;
|
|
116
|
+
collection_id: string;
|
|
117
|
+
blocks: Block[];
|
|
118
|
+
}
|
|
119
|
+
declare function getBlockLabel(block: any, locale?: string): string;
|
|
120
|
+
declare function formatBlockValue(block: any): string;
|
|
121
|
+
declare function prepareBlocksForSubmission(formData: any): any[];
|
|
122
|
+
declare function extractBlockValues(blocks: any[]): Record<string, any>;
|
|
123
|
+
declare function getBlockTextValue(block: any, locale?: string): string;
|
|
124
|
+
declare const getBlockValue: (entry: any, blockKey: string) => any;
|
|
125
|
+
declare const getBlockValues: (entry: any, blockKey: string) => any;
|
|
126
|
+
declare const getBlockObjectValues: (entry: any, blockKey: string, locale?: string) => any;
|
|
127
|
+
declare const getBlockFromArray: (entry: any, blockKey: string, locale?: string) => any;
|
|
128
|
+
declare const getImageUrl: (imageBlock: any, isBlock?: boolean) => any;
|
|
129
|
+
declare const translateMap: (labels: any, lang: string, fallback?: string) => any;
|
|
130
|
+
|
|
131
|
+
declare function convertToMajor(minorAmount: number): number;
|
|
132
|
+
declare function convertToMinor(majorAmount: number): number;
|
|
133
|
+
declare function getCurrencyFromMarket(marketId: string): string;
|
|
134
|
+
declare function formatCurrencyAmount(amount: number, currency: string, options?: {
|
|
135
|
+
showSymbols?: boolean;
|
|
136
|
+
decimalPlaces?: number;
|
|
137
|
+
customSymbol?: string;
|
|
138
|
+
}): string;
|
|
139
|
+
declare function formatMinor(amountMinor: number, currency: string, options?: {
|
|
140
|
+
showSymbols?: boolean;
|
|
141
|
+
decimalPlaces?: number;
|
|
142
|
+
customSymbol?: string;
|
|
143
|
+
}): string;
|
|
144
|
+
declare function formatPayment(payment: Payment, options?: {
|
|
145
|
+
showSymbols?: boolean;
|
|
146
|
+
decimalPlaces?: number;
|
|
147
|
+
showBreakdown?: boolean;
|
|
148
|
+
}): string;
|
|
149
|
+
declare function getMarketPrice(prices: Price[], marketId: string, businessMarkets?: any[], options?: {
|
|
150
|
+
showSymbols?: boolean;
|
|
151
|
+
decimalPlaces?: number;
|
|
152
|
+
showCompareAt?: boolean;
|
|
153
|
+
fallbackMarket?: string;
|
|
154
|
+
}): string;
|
|
155
|
+
declare function getPriceAmount(prices: Price[], marketId: string, fallbackMarket?: string): number;
|
|
156
|
+
declare function createPaymentForCheckout(subtotalMinor: number, marketId: string, currency: string, paymentMethod: any, options?: {
|
|
157
|
+
discount?: number;
|
|
158
|
+
taxAmount?: number;
|
|
159
|
+
taxRateBps?: number;
|
|
160
|
+
promoCode?: {
|
|
161
|
+
id: string;
|
|
162
|
+
code: string;
|
|
163
|
+
type: string;
|
|
164
|
+
value: number;
|
|
165
|
+
};
|
|
166
|
+
}): Payment;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Maps currency codes to their display symbols
|
|
170
|
+
*/
|
|
171
|
+
declare function getCurrencySymbol(currency: string): string;
|
|
172
|
+
|
|
173
|
+
interface ValidationResult {
|
|
174
|
+
isValid: boolean;
|
|
175
|
+
error?: string;
|
|
176
|
+
}
|
|
177
|
+
declare function validatePhoneNumber(phone: string): ValidationResult;
|
|
178
|
+
declare function validateEmail(email: string): ValidationResult;
|
|
179
|
+
declare function validateVerificationCode(code: string): ValidationResult;
|
|
180
|
+
declare function validateRequired(value: any, fieldName?: string): ValidationResult;
|
|
181
|
+
|
|
182
|
+
declare const tzGroups: {
|
|
183
|
+
label: string;
|
|
184
|
+
zones: {
|
|
185
|
+
label: string;
|
|
186
|
+
value: string;
|
|
187
|
+
}[];
|
|
188
|
+
}[];
|
|
189
|
+
declare function findTimeZone(groups: typeof tzGroups): string;
|
|
190
|
+
|
|
191
|
+
declare const locales: readonly ["en", "sr-latn"];
|
|
192
|
+
/**
|
|
193
|
+
* * returns "slugified" text.
|
|
194
|
+
* @param text: string - text to slugify
|
|
195
|
+
*/
|
|
196
|
+
declare function slugify(text: string): string;
|
|
197
|
+
/**
|
|
198
|
+
* * returns "humanized" text. runs slugify() and then replaces - with space and upper case first letter of every word, and lower case the rest
|
|
199
|
+
* @param text: string - text to humanize
|
|
200
|
+
*/
|
|
201
|
+
declare function humanize(text: string): string;
|
|
202
|
+
/**
|
|
203
|
+
* * returns "categorified" text. runs slugify() and then replaces - with space and upper cases everything
|
|
204
|
+
* @param text: string - text to categorify
|
|
205
|
+
* @returns string - categorified text
|
|
206
|
+
*/
|
|
207
|
+
declare function categorify(text: string): string;
|
|
208
|
+
/**
|
|
209
|
+
* * returns a nicely formatted string of the date passed
|
|
210
|
+
* @param date: string | number | Date - date to format
|
|
211
|
+
* @param locale: string - locale to format the date in
|
|
212
|
+
* @returns string - formatted date
|
|
213
|
+
*/
|
|
214
|
+
declare function formatDate(date: string | number | Date, locale: (typeof locales)[number]): string;
|
|
215
|
+
|
|
216
|
+
declare function fetchSvgContent(mediaObject: any): Promise<string | null>;
|
|
217
|
+
/**
|
|
218
|
+
* Server-side helper for Astro components to fetch SVG content during SSR
|
|
219
|
+
*
|
|
220
|
+
* @param mediaObject The media object from the CMS
|
|
221
|
+
* @returns The SVG content as a string, or empty string on failure
|
|
222
|
+
*/
|
|
223
|
+
declare function getSvgContentForAstro(mediaObject: any): Promise<string>;
|
|
224
|
+
/**
|
|
225
|
+
* Client-side helper to fetch and inject SVG content into DOM elements
|
|
226
|
+
*
|
|
227
|
+
* @param mediaObject The media object from the CMS
|
|
228
|
+
* @param targetElement The DOM element to inject the SVG into
|
|
229
|
+
* @param className Optional CSS class to add to the SVG
|
|
230
|
+
*/
|
|
231
|
+
declare function injectSvgIntoElement(mediaObject: any, targetElement: HTMLElement, className?: string): Promise<void>;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Format a Unix timestamp to a localized time string
|
|
235
|
+
*/
|
|
236
|
+
declare function formatTime(ts: number, tz: string): string;
|
|
237
|
+
/**
|
|
238
|
+
* Format a slot time range (from-to) as a string
|
|
239
|
+
*/
|
|
240
|
+
declare function formatSlotTime(from: number, to: number, tz: string): string;
|
|
241
|
+
/**
|
|
242
|
+
* Get the timezone offset in minutes for a given date and timezone
|
|
243
|
+
*/
|
|
244
|
+
declare function getTzOffset(date: Date, tz: string): number;
|
|
245
|
+
/**
|
|
246
|
+
* Convert local time components to a UTC Unix timestamp
|
|
247
|
+
*/
|
|
248
|
+
declare function toUtcTimestamp(year: number, month: number, day: number, mins: number, tz: string): number;
|
|
249
|
+
/**
|
|
250
|
+
* Format a date for display (e.g., "Mon, Jan 15")
|
|
251
|
+
*/
|
|
252
|
+
declare function formatDateDisplay(dateStr: string | null, tz?: string): string;
|
|
253
|
+
/**
|
|
254
|
+
* Get ISO date string (YYYY-MM-DD) for a date in a specific timezone
|
|
255
|
+
*/
|
|
256
|
+
declare function getIsoDate(date: Date, tz: string): string;
|
|
257
|
+
/**
|
|
258
|
+
* Parse ISO date string components
|
|
259
|
+
*/
|
|
260
|
+
declare function parseIsoDate(isoDate: string): {
|
|
261
|
+
year: number;
|
|
262
|
+
month: number;
|
|
263
|
+
day: number;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Map quote error codes to user-friendly messages
|
|
268
|
+
*/
|
|
269
|
+
declare function mapQuoteError(code?: string, fallback?: string): string;
|
|
270
|
+
|
|
271
|
+
export { getBlockFromArray as $, parseIsoDate as A, computeSlotsForDate as B, hasAvailableSlots as C, buildCalendar as D, getMonthYear as E, getTotalDuration as F, isBlocked as G, getWorkingHoursForDate as H, mapQuoteError as I, type WorkingDay as J, type SpecificDate as K, type WorkingTime as L, type AvailableSlot as M, type ComputeSlotsOptions as N, type OutcastDate as O, type ProviderWithTimeline as P, type CalendarDay as Q, type BuildCalendarOptions as R, type ServiceDuration as S, type TimelinePoint as T, type Block as U, type Collection as V, type WorkingHours as W, type CollectionEntry as X, getBlockValue as Y, getBlockValues as Z, getBlockObjectValues as _, getBlockTextValue as a, getImageUrl as a0, translateMap as a1, convertToMajor as a2, convertToMinor as a3, getCurrencyFromMarket as a4, formatCurrencyAmount as a5, tzGroups as a6, type ValidationResult as a7, validateEmail as a8, validateVerificationCode as a9, validateRequired as aa, getMarketPrice as b, getPriceAmount as c, formatPayment as d, extractBlockValues as e, formatBlockValue as f, getBlockLabel as g, formatMinor as h, createPaymentForCheckout as i, getCurrencySymbol as j, findTimeZone as k, humanize as l, categorify as m, formatDate as n, getSvgContentForAstro as o, prepareBlocksForSubmission as p, fetchSvgContent as q, injectSvgIntoElement as r, slugify as s, formatTime as t, formatSlotTime as u, validatePhoneNumber as v, getTzOffset as w, toUtcTimestamp as x, formatDateDisplay as y, getIsoDate as z };
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { Price, Payment } from './types.js';
|
|
2
|
+
|
|
3
|
+
interface ServiceDuration {
|
|
4
|
+
duration: number;
|
|
5
|
+
isPause?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface WorkingHours {
|
|
8
|
+
from: number;
|
|
9
|
+
to: number;
|
|
10
|
+
}
|
|
11
|
+
interface WorkingDay {
|
|
12
|
+
day: string;
|
|
13
|
+
workingHours: WorkingHours[];
|
|
14
|
+
}
|
|
15
|
+
interface SpecificDate {
|
|
16
|
+
date: number;
|
|
17
|
+
workingHours: WorkingHours[];
|
|
18
|
+
}
|
|
19
|
+
interface OutcastDate {
|
|
20
|
+
month: number;
|
|
21
|
+
day: number;
|
|
22
|
+
workingHours: WorkingHours[];
|
|
23
|
+
}
|
|
24
|
+
interface WorkingTime {
|
|
25
|
+
workingDays?: WorkingDay[];
|
|
26
|
+
specificDates?: SpecificDate[];
|
|
27
|
+
outcastDates?: OutcastDate[];
|
|
28
|
+
}
|
|
29
|
+
interface TimelinePoint {
|
|
30
|
+
timestamp: number;
|
|
31
|
+
concurrent: number;
|
|
32
|
+
}
|
|
33
|
+
interface ProviderWithTimeline {
|
|
34
|
+
id: string;
|
|
35
|
+
workingTime?: WorkingTime;
|
|
36
|
+
timeline: TimelinePoint[];
|
|
37
|
+
concurrentLimit: number;
|
|
38
|
+
}
|
|
39
|
+
interface AvailableSlot {
|
|
40
|
+
from: number;
|
|
41
|
+
to: number;
|
|
42
|
+
providerId: string;
|
|
43
|
+
}
|
|
44
|
+
interface ComputeSlotsOptions {
|
|
45
|
+
providers: ProviderWithTimeline[];
|
|
46
|
+
date: Date;
|
|
47
|
+
durations: ServiceDuration[];
|
|
48
|
+
timezone: string;
|
|
49
|
+
slotInterval?: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Calculate total duration from an array of service durations
|
|
53
|
+
*/
|
|
54
|
+
declare function getTotalDuration(durations: ServiceDuration[]): number;
|
|
55
|
+
/**
|
|
56
|
+
* Check if a time slot is blocked by existing reservations
|
|
57
|
+
*/
|
|
58
|
+
declare function isBlocked(from: number, to: number, timeline: TimelinePoint[], limit: number): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Get working hours for a specific date, considering:
|
|
61
|
+
* 1. Specific dates (exact date overrides)
|
|
62
|
+
* 2. Outcast dates (recurring monthly overrides)
|
|
63
|
+
* 3. Working days (regular weekly schedule)
|
|
64
|
+
*/
|
|
65
|
+
declare function getWorkingHoursForDate(wt: WorkingTime | undefined, date: Date, tz: string): WorkingHours[];
|
|
66
|
+
/**
|
|
67
|
+
* Compute all available slots for a given date
|
|
68
|
+
*/
|
|
69
|
+
declare function computeSlotsForDate(opts: ComputeSlotsOptions): AvailableSlot[];
|
|
70
|
+
/**
|
|
71
|
+
* Check if a date has any available slots
|
|
72
|
+
*/
|
|
73
|
+
declare function hasAvailableSlots(opts: ComputeSlotsOptions): boolean;
|
|
74
|
+
interface CalendarDay {
|
|
75
|
+
date: Date;
|
|
76
|
+
iso: string;
|
|
77
|
+
available: boolean;
|
|
78
|
+
isSelected: boolean;
|
|
79
|
+
isInRange: boolean;
|
|
80
|
+
isToday: boolean;
|
|
81
|
+
blank: boolean;
|
|
82
|
+
}
|
|
83
|
+
interface BuildCalendarOptions {
|
|
84
|
+
currentMonth: Date;
|
|
85
|
+
selectedDate: string | null;
|
|
86
|
+
startDate: string | null;
|
|
87
|
+
endDate: string | null;
|
|
88
|
+
providers: ProviderWithTimeline[];
|
|
89
|
+
selectedProvider: ProviderWithTimeline | null;
|
|
90
|
+
durations: ServiceDuration[];
|
|
91
|
+
timezone: string;
|
|
92
|
+
isMultiDay: boolean;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Build a calendar grid for a month with availability info
|
|
96
|
+
*/
|
|
97
|
+
declare function buildCalendar(opts: BuildCalendarOptions): CalendarDay[];
|
|
98
|
+
/**
|
|
99
|
+
* Get month and year display string
|
|
100
|
+
*/
|
|
101
|
+
declare function getMonthYear(date: Date): string;
|
|
102
|
+
|
|
103
|
+
interface Block {
|
|
104
|
+
id: string;
|
|
105
|
+
key: string;
|
|
106
|
+
type: string;
|
|
107
|
+
properties: any;
|
|
108
|
+
value: any;
|
|
109
|
+
}
|
|
110
|
+
interface Collection {
|
|
111
|
+
id: string;
|
|
112
|
+
blocks: Block[];
|
|
113
|
+
}
|
|
114
|
+
interface CollectionEntry {
|
|
115
|
+
id: string;
|
|
116
|
+
collection_id: string;
|
|
117
|
+
blocks: Block[];
|
|
118
|
+
}
|
|
119
|
+
declare function getBlockLabel(block: any, locale?: string): string;
|
|
120
|
+
declare function formatBlockValue(block: any): string;
|
|
121
|
+
declare function prepareBlocksForSubmission(formData: any): any[];
|
|
122
|
+
declare function extractBlockValues(blocks: any[]): Record<string, any>;
|
|
123
|
+
declare function getBlockTextValue(block: any, locale?: string): string;
|
|
124
|
+
declare const getBlockValue: (entry: any, blockKey: string) => any;
|
|
125
|
+
declare const getBlockValues: (entry: any, blockKey: string) => any;
|
|
126
|
+
declare const getBlockObjectValues: (entry: any, blockKey: string, locale?: string) => any;
|
|
127
|
+
declare const getBlockFromArray: (entry: any, blockKey: string, locale?: string) => any;
|
|
128
|
+
declare const getImageUrl: (imageBlock: any, isBlock?: boolean) => any;
|
|
129
|
+
declare const translateMap: (labels: any, lang: string, fallback?: string) => any;
|
|
130
|
+
|
|
131
|
+
declare function convertToMajor(minorAmount: number): number;
|
|
132
|
+
declare function convertToMinor(majorAmount: number): number;
|
|
133
|
+
declare function getCurrencyFromMarket(marketId: string): string;
|
|
134
|
+
declare function formatCurrencyAmount(amount: number, currency: string, options?: {
|
|
135
|
+
showSymbols?: boolean;
|
|
136
|
+
decimalPlaces?: number;
|
|
137
|
+
customSymbol?: string;
|
|
138
|
+
}): string;
|
|
139
|
+
declare function formatMinor(amountMinor: number, currency: string, options?: {
|
|
140
|
+
showSymbols?: boolean;
|
|
141
|
+
decimalPlaces?: number;
|
|
142
|
+
customSymbol?: string;
|
|
143
|
+
}): string;
|
|
144
|
+
declare function formatPayment(payment: Payment, options?: {
|
|
145
|
+
showSymbols?: boolean;
|
|
146
|
+
decimalPlaces?: number;
|
|
147
|
+
showBreakdown?: boolean;
|
|
148
|
+
}): string;
|
|
149
|
+
declare function getMarketPrice(prices: Price[], marketId: string, businessMarkets?: any[], options?: {
|
|
150
|
+
showSymbols?: boolean;
|
|
151
|
+
decimalPlaces?: number;
|
|
152
|
+
showCompareAt?: boolean;
|
|
153
|
+
fallbackMarket?: string;
|
|
154
|
+
}): string;
|
|
155
|
+
declare function getPriceAmount(prices: Price[], marketId: string, fallbackMarket?: string): number;
|
|
156
|
+
declare function createPaymentForCheckout(subtotalMinor: number, marketId: string, currency: string, paymentMethod: any, options?: {
|
|
157
|
+
discount?: number;
|
|
158
|
+
taxAmount?: number;
|
|
159
|
+
taxRateBps?: number;
|
|
160
|
+
promoCode?: {
|
|
161
|
+
id: string;
|
|
162
|
+
code: string;
|
|
163
|
+
type: string;
|
|
164
|
+
value: number;
|
|
165
|
+
};
|
|
166
|
+
}): Payment;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Maps currency codes to their display symbols
|
|
170
|
+
*/
|
|
171
|
+
declare function getCurrencySymbol(currency: string): string;
|
|
172
|
+
|
|
173
|
+
interface ValidationResult {
|
|
174
|
+
isValid: boolean;
|
|
175
|
+
error?: string;
|
|
176
|
+
}
|
|
177
|
+
declare function validatePhoneNumber(phone: string): ValidationResult;
|
|
178
|
+
declare function validateEmail(email: string): ValidationResult;
|
|
179
|
+
declare function validateVerificationCode(code: string): ValidationResult;
|
|
180
|
+
declare function validateRequired(value: any, fieldName?: string): ValidationResult;
|
|
181
|
+
|
|
182
|
+
declare const tzGroups: {
|
|
183
|
+
label: string;
|
|
184
|
+
zones: {
|
|
185
|
+
label: string;
|
|
186
|
+
value: string;
|
|
187
|
+
}[];
|
|
188
|
+
}[];
|
|
189
|
+
declare function findTimeZone(groups: typeof tzGroups): string;
|
|
190
|
+
|
|
191
|
+
declare const locales: readonly ["en", "sr-latn"];
|
|
192
|
+
/**
|
|
193
|
+
* * returns "slugified" text.
|
|
194
|
+
* @param text: string - text to slugify
|
|
195
|
+
*/
|
|
196
|
+
declare function slugify(text: string): string;
|
|
197
|
+
/**
|
|
198
|
+
* * returns "humanized" text. runs slugify() and then replaces - with space and upper case first letter of every word, and lower case the rest
|
|
199
|
+
* @param text: string - text to humanize
|
|
200
|
+
*/
|
|
201
|
+
declare function humanize(text: string): string;
|
|
202
|
+
/**
|
|
203
|
+
* * returns "categorified" text. runs slugify() and then replaces - with space and upper cases everything
|
|
204
|
+
* @param text: string - text to categorify
|
|
205
|
+
* @returns string - categorified text
|
|
206
|
+
*/
|
|
207
|
+
declare function categorify(text: string): string;
|
|
208
|
+
/**
|
|
209
|
+
* * returns a nicely formatted string of the date passed
|
|
210
|
+
* @param date: string | number | Date - date to format
|
|
211
|
+
* @param locale: string - locale to format the date in
|
|
212
|
+
* @returns string - formatted date
|
|
213
|
+
*/
|
|
214
|
+
declare function formatDate(date: string | number | Date, locale: (typeof locales)[number]): string;
|
|
215
|
+
|
|
216
|
+
declare function fetchSvgContent(mediaObject: any): Promise<string | null>;
|
|
217
|
+
/**
|
|
218
|
+
* Server-side helper for Astro components to fetch SVG content during SSR
|
|
219
|
+
*
|
|
220
|
+
* @param mediaObject The media object from the CMS
|
|
221
|
+
* @returns The SVG content as a string, or empty string on failure
|
|
222
|
+
*/
|
|
223
|
+
declare function getSvgContentForAstro(mediaObject: any): Promise<string>;
|
|
224
|
+
/**
|
|
225
|
+
* Client-side helper to fetch and inject SVG content into DOM elements
|
|
226
|
+
*
|
|
227
|
+
* @param mediaObject The media object from the CMS
|
|
228
|
+
* @param targetElement The DOM element to inject the SVG into
|
|
229
|
+
* @param className Optional CSS class to add to the SVG
|
|
230
|
+
*/
|
|
231
|
+
declare function injectSvgIntoElement(mediaObject: any, targetElement: HTMLElement, className?: string): Promise<void>;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Format a Unix timestamp to a localized time string
|
|
235
|
+
*/
|
|
236
|
+
declare function formatTime(ts: number, tz: string): string;
|
|
237
|
+
/**
|
|
238
|
+
* Format a slot time range (from-to) as a string
|
|
239
|
+
*/
|
|
240
|
+
declare function formatSlotTime(from: number, to: number, tz: string): string;
|
|
241
|
+
/**
|
|
242
|
+
* Get the timezone offset in minutes for a given date and timezone
|
|
243
|
+
*/
|
|
244
|
+
declare function getTzOffset(date: Date, tz: string): number;
|
|
245
|
+
/**
|
|
246
|
+
* Convert local time components to a UTC Unix timestamp
|
|
247
|
+
*/
|
|
248
|
+
declare function toUtcTimestamp(year: number, month: number, day: number, mins: number, tz: string): number;
|
|
249
|
+
/**
|
|
250
|
+
* Format a date for display (e.g., "Mon, Jan 15")
|
|
251
|
+
*/
|
|
252
|
+
declare function formatDateDisplay(dateStr: string | null, tz?: string): string;
|
|
253
|
+
/**
|
|
254
|
+
* Get ISO date string (YYYY-MM-DD) for a date in a specific timezone
|
|
255
|
+
*/
|
|
256
|
+
declare function getIsoDate(date: Date, tz: string): string;
|
|
257
|
+
/**
|
|
258
|
+
* Parse ISO date string components
|
|
259
|
+
*/
|
|
260
|
+
declare function parseIsoDate(isoDate: string): {
|
|
261
|
+
year: number;
|
|
262
|
+
month: number;
|
|
263
|
+
day: number;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Map quote error codes to user-friendly messages
|
|
268
|
+
*/
|
|
269
|
+
declare function mapQuoteError(code?: string, fallback?: string): string;
|
|
270
|
+
|
|
271
|
+
export { getBlockFromArray as $, parseIsoDate as A, computeSlotsForDate as B, hasAvailableSlots as C, buildCalendar as D, getMonthYear as E, getTotalDuration as F, isBlocked as G, getWorkingHoursForDate as H, mapQuoteError as I, type WorkingDay as J, type SpecificDate as K, type WorkingTime as L, type AvailableSlot as M, type ComputeSlotsOptions as N, type OutcastDate as O, type ProviderWithTimeline as P, type CalendarDay as Q, type BuildCalendarOptions as R, type ServiceDuration as S, type TimelinePoint as T, type Block as U, type Collection as V, type WorkingHours as W, type CollectionEntry as X, getBlockValue as Y, getBlockValues as Z, getBlockObjectValues as _, getBlockTextValue as a, getImageUrl as a0, translateMap as a1, convertToMajor as a2, convertToMinor as a3, getCurrencyFromMarket as a4, formatCurrencyAmount as a5, tzGroups as a6, type ValidationResult as a7, validateEmail as a8, validateVerificationCode as a9, validateRequired as aa, getMarketPrice as b, getPriceAmount as c, formatPayment as d, extractBlockValues as e, formatBlockValue as f, getBlockLabel as g, formatMinor as h, createPaymentForCheckout as i, getCurrencySymbol as j, findTimeZone as k, humanize as l, categorify as m, formatDate as n, getSvgContentForAstro as o, prepareBlocksForSubmission as p, fetchSvgContent as q, injectSvgIntoElement as r, slugify as s, formatTime as t, formatSlotTime as u, validatePhoneNumber as v, getTzOffset as w, toUtcTimestamp as x, formatDateDisplay as y, getIsoDate as z };
|