@voyantjs/storefront-react 0.49.0 → 0.50.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/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/use-admin-storefront-settings.d.ts +248 -0
- package/dist/hooks/use-admin-storefront-settings.d.ts.map +1 -0
- package/dist/hooks/use-admin-storefront-settings.js +29 -0
- package/dist/hooks/use-storefront-departure-price-preview-mutation.d.ts +209 -0
- package/dist/hooks/use-storefront-departure-price-preview-mutation.d.ts.map +1 -1
- package/dist/hooks/use-storefront-offer-apply-mutation.d.ts +2 -2
- package/dist/hooks/use-storefront-offer-redeem-mutation.d.ts +2 -2
- package/dist/hooks/use-storefront-product-extensions.d.ts +2 -2
- package/dist/hooks/use-storefront-settings.d.ts +27 -2
- package/dist/hooks/use-storefront-settings.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/operations.d.ts +403 -9
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +8 -1
- package/dist/operations.test.d.ts +2 -0
- package/dist/operations.test.d.ts.map +1 -0
- package/dist/operations.test.js +75 -0
- package/dist/query-keys.d.ts +1 -0
- package/dist/query-keys.d.ts.map +1 -1
- package/dist/query-keys.js +1 -0
- package/dist/query-options.d.ts +452 -16
- package/dist/query-options.d.ts.map +1 -1
- package/dist/query-options.js +7 -1
- package/dist/schemas.d.ts +310 -4
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +2 -2
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { defaultFetcher, fetchWithValidation, VoyantApiError, withQueryParams, } from "./client.js";
|
|
2
2
|
export * from "./hooks/index.js";
|
|
3
|
-
export { applyStorefrontOffer, getStorefrontDeparture, getStorefrontDepartureItinerary, getStorefrontOfferBySlug, getStorefrontSettings, listStorefrontProductDepartures, listStorefrontProductExtensions, listStorefrontProductOffers, previewStorefrontDeparturePrice, redeemStorefrontOffer, } from "./operations.js";
|
|
3
|
+
export { applyStorefrontOffer, getAdminStorefrontSettings, getStorefrontDeparture, getStorefrontDepartureItinerary, getStorefrontOfferBySlug, getStorefrontSettings, listStorefrontProductDepartures, listStorefrontProductExtensions, listStorefrontProductOffers, previewStorefrontDeparturePrice, redeemStorefrontOffer, updateAdminStorefrontSettings, } from "./operations.js";
|
|
4
4
|
export { useVoyantStorefrontContext, VoyantStorefrontProvider, } from "./provider.js";
|
|
5
5
|
export { storefrontQueryKeys } from "./query-keys.js";
|
|
6
|
-
export { getStorefrontDepartureItineraryQueryOptions, getStorefrontDepartureQueryOptions, getStorefrontOfferQueryOptions, getStorefrontProductDeparturesQueryOptions, getStorefrontProductExtensionsQueryOptions, getStorefrontProductOffersQueryOptions, getStorefrontSettingsQueryOptions, } from "./query-options.js";
|
|
6
|
+
export { getAdminStorefrontSettingsQueryOptions, getStorefrontDepartureItineraryQueryOptions, getStorefrontDepartureQueryOptions, getStorefrontOfferQueryOptions, getStorefrontProductDeparturesQueryOptions, getStorefrontProductExtensionsQueryOptions, getStorefrontProductOffersQueryOptions, getStorefrontSettingsQueryOptions, } from "./query-options.js";
|
|
7
7
|
export * from "./schemas.js";
|
package/dist/operations.d.ts
CHANGED
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
import { type FetchWithValidationOptions } from "./client.js";
|
|
2
|
-
import { type StorefrontDepartureListQuery, type StorefrontDeparturePricePreviewInput, type StorefrontOfferApplyInput, type StorefrontOfferRedeemInput, type StorefrontProductExtensionsQuery, type StorefrontPromotionalOfferListQuery } from "./schemas.js";
|
|
2
|
+
import { type StorefrontDepartureListQuery, type StorefrontDeparturePricePreviewInput, type StorefrontOfferApplyInput, type StorefrontOfferRedeemInput, type StorefrontProductExtensionsQuery, type StorefrontPromotionalOfferListQuery, type StorefrontSettingsPatchInput } from "./schemas.js";
|
|
3
3
|
export declare function getStorefrontSettings(client: FetchWithValidationOptions): Promise<{
|
|
4
4
|
data: {
|
|
5
5
|
branding: {
|
|
6
6
|
logoUrl: string | null;
|
|
7
|
+
faviconUrl: string | null;
|
|
8
|
+
brandMarkUrl: string | null;
|
|
9
|
+
primaryColor: string | null;
|
|
10
|
+
accentColor: string | null;
|
|
7
11
|
supportedLanguages: string[];
|
|
8
12
|
};
|
|
9
13
|
support: {
|
|
10
14
|
email: string | null;
|
|
11
15
|
phone: string | null;
|
|
16
|
+
links: {
|
|
17
|
+
label: string;
|
|
18
|
+
url: string;
|
|
19
|
+
}[];
|
|
12
20
|
};
|
|
13
21
|
legal: {
|
|
14
22
|
termsUrl: string | null;
|
|
15
23
|
privacyUrl: string | null;
|
|
24
|
+
cancellationUrl: string | null;
|
|
16
25
|
defaultContractTemplateId: string | null;
|
|
17
26
|
};
|
|
27
|
+
localization: {
|
|
28
|
+
defaultLocale: string | null;
|
|
29
|
+
currencyDisplay: "symbol" | "name" | "code";
|
|
30
|
+
};
|
|
18
31
|
forms: {
|
|
19
32
|
billing: {
|
|
20
33
|
fields: {
|
|
@@ -48,13 +61,191 @@ export declare function getStorefrontSettings(client: FetchWithValidationOptions
|
|
|
48
61
|
};
|
|
49
62
|
};
|
|
50
63
|
payment: {
|
|
51
|
-
defaultMethod: "voucher" | "bank_transfer" | "
|
|
64
|
+
defaultMethod: "voucher" | "bank_transfer" | "cash" | "invoice" | "card" | null;
|
|
52
65
|
methods: {
|
|
53
|
-
code: "voucher" | "bank_transfer" | "
|
|
66
|
+
code: "voucher" | "bank_transfer" | "cash" | "invoice" | "card";
|
|
54
67
|
label: string;
|
|
55
68
|
description: string | null;
|
|
56
69
|
enabled: boolean;
|
|
57
70
|
}[];
|
|
71
|
+
defaultSchedule: {
|
|
72
|
+
depositPercent: number | null;
|
|
73
|
+
balanceDueDaysBeforeDeparture: number | null;
|
|
74
|
+
} | null;
|
|
75
|
+
bankTransfer: {
|
|
76
|
+
accountHolder: string | null;
|
|
77
|
+
bankName: string | null;
|
|
78
|
+
iban: string | null;
|
|
79
|
+
bic: string | null;
|
|
80
|
+
paymentReference: string | null;
|
|
81
|
+
instructions: string | null;
|
|
82
|
+
} | null;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
}>;
|
|
86
|
+
export declare function getAdminStorefrontSettings(client: FetchWithValidationOptions): Promise<{
|
|
87
|
+
data: {
|
|
88
|
+
branding: {
|
|
89
|
+
logoUrl: string | null;
|
|
90
|
+
faviconUrl: string | null;
|
|
91
|
+
brandMarkUrl: string | null;
|
|
92
|
+
primaryColor: string | null;
|
|
93
|
+
accentColor: string | null;
|
|
94
|
+
supportedLanguages: string[];
|
|
95
|
+
};
|
|
96
|
+
support: {
|
|
97
|
+
email: string | null;
|
|
98
|
+
phone: string | null;
|
|
99
|
+
links: {
|
|
100
|
+
label: string;
|
|
101
|
+
url: string;
|
|
102
|
+
}[];
|
|
103
|
+
};
|
|
104
|
+
legal: {
|
|
105
|
+
termsUrl: string | null;
|
|
106
|
+
privacyUrl: string | null;
|
|
107
|
+
cancellationUrl: string | null;
|
|
108
|
+
defaultContractTemplateId: string | null;
|
|
109
|
+
};
|
|
110
|
+
localization: {
|
|
111
|
+
defaultLocale: string | null;
|
|
112
|
+
currencyDisplay: "symbol" | "name" | "code";
|
|
113
|
+
};
|
|
114
|
+
forms: {
|
|
115
|
+
billing: {
|
|
116
|
+
fields: {
|
|
117
|
+
key: string;
|
|
118
|
+
label: string;
|
|
119
|
+
type: "text" | "date" | "select" | "email" | "country" | "tel" | "textarea" | "checkbox";
|
|
120
|
+
required: boolean;
|
|
121
|
+
placeholder: string | null;
|
|
122
|
+
description: string | null;
|
|
123
|
+
autocomplete: string | null;
|
|
124
|
+
options: {
|
|
125
|
+
value: string;
|
|
126
|
+
label: string;
|
|
127
|
+
}[];
|
|
128
|
+
}[];
|
|
129
|
+
};
|
|
130
|
+
travelers: {
|
|
131
|
+
fields: {
|
|
132
|
+
key: string;
|
|
133
|
+
label: string;
|
|
134
|
+
type: "text" | "date" | "select" | "email" | "country" | "tel" | "textarea" | "checkbox";
|
|
135
|
+
required: boolean;
|
|
136
|
+
placeholder: string | null;
|
|
137
|
+
description: string | null;
|
|
138
|
+
autocomplete: string | null;
|
|
139
|
+
options: {
|
|
140
|
+
value: string;
|
|
141
|
+
label: string;
|
|
142
|
+
}[];
|
|
143
|
+
}[];
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
payment: {
|
|
147
|
+
defaultMethod: "voucher" | "bank_transfer" | "cash" | "invoice" | "card" | null;
|
|
148
|
+
methods: {
|
|
149
|
+
code: "voucher" | "bank_transfer" | "cash" | "invoice" | "card";
|
|
150
|
+
label: string;
|
|
151
|
+
description: string | null;
|
|
152
|
+
enabled: boolean;
|
|
153
|
+
}[];
|
|
154
|
+
defaultSchedule: {
|
|
155
|
+
depositPercent: number | null;
|
|
156
|
+
balanceDueDaysBeforeDeparture: number | null;
|
|
157
|
+
} | null;
|
|
158
|
+
bankTransfer: {
|
|
159
|
+
accountHolder: string | null;
|
|
160
|
+
bankName: string | null;
|
|
161
|
+
iban: string | null;
|
|
162
|
+
bic: string | null;
|
|
163
|
+
paymentReference: string | null;
|
|
164
|
+
instructions: string | null;
|
|
165
|
+
} | null;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
}>;
|
|
169
|
+
export declare function updateAdminStorefrontSettings(client: FetchWithValidationOptions, input: StorefrontSettingsPatchInput): Promise<{
|
|
170
|
+
data: {
|
|
171
|
+
branding: {
|
|
172
|
+
logoUrl: string | null;
|
|
173
|
+
faviconUrl: string | null;
|
|
174
|
+
brandMarkUrl: string | null;
|
|
175
|
+
primaryColor: string | null;
|
|
176
|
+
accentColor: string | null;
|
|
177
|
+
supportedLanguages: string[];
|
|
178
|
+
};
|
|
179
|
+
support: {
|
|
180
|
+
email: string | null;
|
|
181
|
+
phone: string | null;
|
|
182
|
+
links: {
|
|
183
|
+
label: string;
|
|
184
|
+
url: string;
|
|
185
|
+
}[];
|
|
186
|
+
};
|
|
187
|
+
legal: {
|
|
188
|
+
termsUrl: string | null;
|
|
189
|
+
privacyUrl: string | null;
|
|
190
|
+
cancellationUrl: string | null;
|
|
191
|
+
defaultContractTemplateId: string | null;
|
|
192
|
+
};
|
|
193
|
+
localization: {
|
|
194
|
+
defaultLocale: string | null;
|
|
195
|
+
currencyDisplay: "symbol" | "name" | "code";
|
|
196
|
+
};
|
|
197
|
+
forms: {
|
|
198
|
+
billing: {
|
|
199
|
+
fields: {
|
|
200
|
+
key: string;
|
|
201
|
+
label: string;
|
|
202
|
+
type: "text" | "date" | "select" | "email" | "country" | "tel" | "textarea" | "checkbox";
|
|
203
|
+
required: boolean;
|
|
204
|
+
placeholder: string | null;
|
|
205
|
+
description: string | null;
|
|
206
|
+
autocomplete: string | null;
|
|
207
|
+
options: {
|
|
208
|
+
value: string;
|
|
209
|
+
label: string;
|
|
210
|
+
}[];
|
|
211
|
+
}[];
|
|
212
|
+
};
|
|
213
|
+
travelers: {
|
|
214
|
+
fields: {
|
|
215
|
+
key: string;
|
|
216
|
+
label: string;
|
|
217
|
+
type: "text" | "date" | "select" | "email" | "country" | "tel" | "textarea" | "checkbox";
|
|
218
|
+
required: boolean;
|
|
219
|
+
placeholder: string | null;
|
|
220
|
+
description: string | null;
|
|
221
|
+
autocomplete: string | null;
|
|
222
|
+
options: {
|
|
223
|
+
value: string;
|
|
224
|
+
label: string;
|
|
225
|
+
}[];
|
|
226
|
+
}[];
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
payment: {
|
|
230
|
+
defaultMethod: "voucher" | "bank_transfer" | "cash" | "invoice" | "card" | null;
|
|
231
|
+
methods: {
|
|
232
|
+
code: "voucher" | "bank_transfer" | "cash" | "invoice" | "card";
|
|
233
|
+
label: string;
|
|
234
|
+
description: string | null;
|
|
235
|
+
enabled: boolean;
|
|
236
|
+
}[];
|
|
237
|
+
defaultSchedule: {
|
|
238
|
+
depositPercent: number | null;
|
|
239
|
+
balanceDueDaysBeforeDeparture: number | null;
|
|
240
|
+
} | null;
|
|
241
|
+
bankTransfer: {
|
|
242
|
+
accountHolder: string | null;
|
|
243
|
+
bankName: string | null;
|
|
244
|
+
iban: string | null;
|
|
245
|
+
bic: string | null;
|
|
246
|
+
paymentReference: string | null;
|
|
247
|
+
instructions: string | null;
|
|
248
|
+
} | null;
|
|
58
249
|
};
|
|
59
250
|
};
|
|
60
251
|
}>;
|
|
@@ -171,6 +362,209 @@ export declare function previewStorefrontDeparturePrice(client: FetchWithValidat
|
|
|
171
362
|
quantity: number;
|
|
172
363
|
unitPrice: number;
|
|
173
364
|
}[];
|
|
365
|
+
allocation: {
|
|
366
|
+
slot: {
|
|
367
|
+
id: string;
|
|
368
|
+
productId: string;
|
|
369
|
+
optionId: string | null;
|
|
370
|
+
dateLocal: string | null;
|
|
371
|
+
startAt: string | null;
|
|
372
|
+
endAt: string | null;
|
|
373
|
+
timezone: string;
|
|
374
|
+
status: "cancelled" | "open" | "closed" | "sold_out" | "on_request";
|
|
375
|
+
availabilityState: "cancelled" | "closed" | "sold_out" | "past_cutoff" | "too_early" | "on_request" | "unavailable" | "available";
|
|
376
|
+
capacity: number | null;
|
|
377
|
+
remaining: number | null;
|
|
378
|
+
pastCutoff: boolean;
|
|
379
|
+
tooEarly: boolean;
|
|
380
|
+
};
|
|
381
|
+
pax: {
|
|
382
|
+
adults: number;
|
|
383
|
+
children: number;
|
|
384
|
+
infants: number;
|
|
385
|
+
total: number;
|
|
386
|
+
};
|
|
387
|
+
requestedUnits: {
|
|
388
|
+
unitId: string | null;
|
|
389
|
+
requestRef: string | null;
|
|
390
|
+
name: string;
|
|
391
|
+
unitType: string | null;
|
|
392
|
+
quantity: number;
|
|
393
|
+
pricingMode: string | null;
|
|
394
|
+
unitPrice: number;
|
|
395
|
+
total: number;
|
|
396
|
+
currencyCode: string;
|
|
397
|
+
tierId: string | null;
|
|
398
|
+
}[];
|
|
399
|
+
rooms: {
|
|
400
|
+
unitId: string;
|
|
401
|
+
name: string;
|
|
402
|
+
occupancy: number;
|
|
403
|
+
quantity: number;
|
|
404
|
+
pax: number;
|
|
405
|
+
pricingMode: string | null;
|
|
406
|
+
unitPrice: number;
|
|
407
|
+
total: number;
|
|
408
|
+
currencyCode: string;
|
|
409
|
+
tierId: string | null;
|
|
410
|
+
}[];
|
|
411
|
+
};
|
|
412
|
+
units: {
|
|
413
|
+
unitId: string | null;
|
|
414
|
+
requestRef: string | null;
|
|
415
|
+
name: string;
|
|
416
|
+
unitType: string | null;
|
|
417
|
+
quantity: number;
|
|
418
|
+
pricingMode: string | null;
|
|
419
|
+
unitPrice: number;
|
|
420
|
+
total: number;
|
|
421
|
+
currencyCode: string;
|
|
422
|
+
tierId: string | null;
|
|
423
|
+
}[];
|
|
424
|
+
rooms: {
|
|
425
|
+
unitId: string;
|
|
426
|
+
name: string;
|
|
427
|
+
occupancy: number;
|
|
428
|
+
quantity: number;
|
|
429
|
+
pax: number;
|
|
430
|
+
pricingMode: string | null;
|
|
431
|
+
unitPrice: number;
|
|
432
|
+
total: number;
|
|
433
|
+
currencyCode: string;
|
|
434
|
+
tierId: string | null;
|
|
435
|
+
}[];
|
|
436
|
+
extras: {
|
|
437
|
+
extraId: string;
|
|
438
|
+
name: string;
|
|
439
|
+
required: boolean;
|
|
440
|
+
selectable: boolean;
|
|
441
|
+
selected: boolean;
|
|
442
|
+
pricingMode: "per_booking" | "free" | "included" | "on_request" | "per_person" | "quantity_based";
|
|
443
|
+
quantity: number;
|
|
444
|
+
unitPrice: number;
|
|
445
|
+
total: number;
|
|
446
|
+
currencyCode: string;
|
|
447
|
+
}[];
|
|
448
|
+
offers: {
|
|
449
|
+
available: {
|
|
450
|
+
offer: {
|
|
451
|
+
id: string;
|
|
452
|
+
name: string;
|
|
453
|
+
slug: string | null;
|
|
454
|
+
description: string | null;
|
|
455
|
+
discountType: "percentage" | "fixed_amount";
|
|
456
|
+
discountValue: string;
|
|
457
|
+
currency: string | null;
|
|
458
|
+
applicableProductIds: string[];
|
|
459
|
+
applicableDepartureIds: string[];
|
|
460
|
+
validFrom: string | null;
|
|
461
|
+
validTo: string | null;
|
|
462
|
+
minTravelers: number | null;
|
|
463
|
+
imageMobileUrl: string | null;
|
|
464
|
+
imageDesktopUrl: string | null;
|
|
465
|
+
stackable: boolean;
|
|
466
|
+
createdAt: string;
|
|
467
|
+
updatedAt: string;
|
|
468
|
+
};
|
|
469
|
+
status: "applied" | "not_applicable" | "conflict";
|
|
470
|
+
reason: "currency" | "conflict" | "min_pax" | "no_discount" | null;
|
|
471
|
+
selected: boolean;
|
|
472
|
+
discountAppliedCents: number;
|
|
473
|
+
discountedPriceCents: number;
|
|
474
|
+
}[];
|
|
475
|
+
requested: {
|
|
476
|
+
kind: "slug" | "code";
|
|
477
|
+
value: string;
|
|
478
|
+
result: {
|
|
479
|
+
status: "applied" | "not_applicable" | "conflict" | "invalid";
|
|
480
|
+
reason: "scope" | "currency" | "booking_mismatch" | "conflict" | "min_pax" | "no_discount" | "offer_not_found" | "offer_expired" | "offer_not_yet_valid" | "code_not_found" | "code_required" | "code_expired" | "code_not_yet_valid" | "session_mismatch" | null;
|
|
481
|
+
offer: {
|
|
482
|
+
id: string;
|
|
483
|
+
name: string;
|
|
484
|
+
slug: string | null;
|
|
485
|
+
description: string | null;
|
|
486
|
+
discountType: "percentage" | "fixed_amount";
|
|
487
|
+
discountValue: string;
|
|
488
|
+
currency: string | null;
|
|
489
|
+
applicableProductIds: string[];
|
|
490
|
+
applicableDepartureIds: string[];
|
|
491
|
+
validFrom: string | null;
|
|
492
|
+
validTo: string | null;
|
|
493
|
+
minTravelers: number | null;
|
|
494
|
+
imageMobileUrl: string | null;
|
|
495
|
+
imageDesktopUrl: string | null;
|
|
496
|
+
stackable: boolean;
|
|
497
|
+
createdAt: string;
|
|
498
|
+
updatedAt: string;
|
|
499
|
+
} | null;
|
|
500
|
+
target: {
|
|
501
|
+
bookingId: string | null;
|
|
502
|
+
sessionId: string | null;
|
|
503
|
+
productId: string;
|
|
504
|
+
departureId: string | null;
|
|
505
|
+
};
|
|
506
|
+
pricing: {
|
|
507
|
+
basePriceCents: number;
|
|
508
|
+
currency: string;
|
|
509
|
+
discountAppliedCents: number;
|
|
510
|
+
discountedPriceCents: number;
|
|
511
|
+
};
|
|
512
|
+
appliedOffers: {
|
|
513
|
+
offerId: string;
|
|
514
|
+
offerName: string;
|
|
515
|
+
discountAppliedCents: number;
|
|
516
|
+
discountedPriceCents: number;
|
|
517
|
+
currency: string;
|
|
518
|
+
discountKind: "percentage" | "fixed_amount";
|
|
519
|
+
discountPercent: number | null;
|
|
520
|
+
discountAmountCents: number | null;
|
|
521
|
+
appliedCode: string | null;
|
|
522
|
+
stackable: boolean;
|
|
523
|
+
}[];
|
|
524
|
+
conflict: {
|
|
525
|
+
policy: "best_discount_wins" | "stackable_compose";
|
|
526
|
+
autoAppliedOfferIds: string[];
|
|
527
|
+
manualOfferId: string | null;
|
|
528
|
+
selectedOfferIds: string[];
|
|
529
|
+
message: string;
|
|
530
|
+
} | null;
|
|
531
|
+
} | null;
|
|
532
|
+
}[];
|
|
533
|
+
applied: {
|
|
534
|
+
offerId: string;
|
|
535
|
+
offerName: string;
|
|
536
|
+
discountAppliedCents: number;
|
|
537
|
+
discountedPriceCents: number;
|
|
538
|
+
currency: string;
|
|
539
|
+
discountKind: "percentage" | "fixed_amount";
|
|
540
|
+
discountPercent: number | null;
|
|
541
|
+
discountAmountCents: number | null;
|
|
542
|
+
appliedCode: string | null;
|
|
543
|
+
stackable: boolean;
|
|
544
|
+
}[];
|
|
545
|
+
conflict: {
|
|
546
|
+
policy: "best_discount_wins" | "stackable_compose";
|
|
547
|
+
autoAppliedOfferIds: string[];
|
|
548
|
+
manualOfferId: string | null;
|
|
549
|
+
selectedOfferIds: string[];
|
|
550
|
+
message: string;
|
|
551
|
+
} | null;
|
|
552
|
+
discountTotal: number;
|
|
553
|
+
discountTotalCents: number;
|
|
554
|
+
totalAfterDiscount: number;
|
|
555
|
+
currencyCode: string;
|
|
556
|
+
};
|
|
557
|
+
totals: {
|
|
558
|
+
currencyCode: string;
|
|
559
|
+
base: number;
|
|
560
|
+
extras: number;
|
|
561
|
+
subtotal: number;
|
|
562
|
+
discount: number;
|
|
563
|
+
tax: number;
|
|
564
|
+
total: number;
|
|
565
|
+
perPerson: number;
|
|
566
|
+
perBooking: number;
|
|
567
|
+
};
|
|
174
568
|
};
|
|
175
569
|
}>;
|
|
176
570
|
export declare function listStorefrontProductExtensions(client: FetchWithValidationOptions, productId: string, query?: StorefrontProductExtensionsQuery): Promise<{
|
|
@@ -185,7 +579,7 @@ export declare function listStorefrontProductExtensions(client: FetchWithValidat
|
|
|
185
579
|
thumb: string | null;
|
|
186
580
|
pricePerPerson: number | null;
|
|
187
581
|
currencyCode: string;
|
|
188
|
-
pricingMode: "
|
|
582
|
+
pricingMode: "per_booking" | "free" | "included" | "on_request" | "per_person" | "quantity_based";
|
|
189
583
|
defaultQuantity: number | null;
|
|
190
584
|
minQuantity: number | null;
|
|
191
585
|
maxQuantity: number | null;
|
|
@@ -201,7 +595,7 @@ export declare function listStorefrontProductExtensions(client: FetchWithValidat
|
|
|
201
595
|
thumb: string | null;
|
|
202
596
|
pricePerPerson: number | null;
|
|
203
597
|
currencyCode: string;
|
|
204
|
-
pricingMode: "
|
|
598
|
+
pricingMode: "per_booking" | "free" | "included" | "on_request" | "per_person" | "quantity_based";
|
|
205
599
|
defaultQuantity: number | null;
|
|
206
600
|
minQuantity: number | null;
|
|
207
601
|
maxQuantity: number | null;
|
|
@@ -278,8 +672,8 @@ export declare function getStorefrontOfferBySlug(client: FetchWithValidationOpti
|
|
|
278
672
|
}>;
|
|
279
673
|
export declare function applyStorefrontOffer(client: FetchWithValidationOptions, slug: string, input: StorefrontOfferApplyInput): Promise<{
|
|
280
674
|
data: {
|
|
281
|
-
status: "
|
|
282
|
-
reason: "scope" | "currency" | "
|
|
675
|
+
status: "applied" | "not_applicable" | "conflict" | "invalid";
|
|
676
|
+
reason: "scope" | "currency" | "booking_mismatch" | "conflict" | "min_pax" | "no_discount" | "offer_not_found" | "offer_expired" | "offer_not_yet_valid" | "code_not_found" | "code_required" | "code_expired" | "code_not_yet_valid" | "session_mismatch" | null;
|
|
283
677
|
offer: {
|
|
284
678
|
id: string;
|
|
285
679
|
name: string;
|
|
@@ -334,8 +728,8 @@ export declare function applyStorefrontOffer(client: FetchWithValidationOptions,
|
|
|
334
728
|
}>;
|
|
335
729
|
export declare function redeemStorefrontOffer(client: FetchWithValidationOptions, input: StorefrontOfferRedeemInput): Promise<{
|
|
336
730
|
data: {
|
|
337
|
-
status: "
|
|
338
|
-
reason: "scope" | "currency" | "
|
|
731
|
+
status: "applied" | "not_applicable" | "conflict" | "invalid";
|
|
732
|
+
reason: "scope" | "currency" | "booking_mismatch" | "conflict" | "min_pax" | "no_discount" | "offer_not_found" | "offer_expired" | "offer_not_yet_valid" | "code_not_found" | "code_required" | "code_expired" | "code_not_yet_valid" | "session_mismatch" | null;
|
|
339
733
|
offer: {
|
|
340
734
|
id: string;
|
|
341
735
|
name: string;
|
package/dist/operations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,0BAA0B,EAAwC,MAAM,aAAa,CAAA;AACnG,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,oCAAoC,EACzC,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACrC,KAAK,mCAAmC,
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,0BAA0B,EAAwC,MAAM,aAAa,CAAA;AACnG,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,oCAAoC,EACzC,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACrC,KAAK,mCAAmC,EACxC,KAAK,4BAA4B,EAclC,MAAM,cAAc,CAAA;AAErB,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAEvE;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAM5E;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,0BAA0B,EAClC,KAAK,EAAE,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUpC;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,0BAA0B,EAAE,WAAW,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAM7F;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,0BAA0B,EAClC,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAOrC;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,0BAA0B,EAClC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAU5C;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,0BAA0B,EAClC,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAOzC;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,0BAA0B,EAClC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM;;;;;;;;;;;;;;;;;;GAOpB;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,0BAA0B,EAClC,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,mCAAmC;;;;;;;;;;;;;;;;;;;;GAO5C;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,0BAA0B,EAClC,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,IAAI,CAAC,mCAAmC,EAAE,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;GAO5D;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,0BAA0B,EAClC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUjC;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,0BAA0B,EAClC,KAAK,EAAE,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAalC"}
|
package/dist/operations.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { fetchWithValidation, withQueryParams } from "./client.js";
|
|
3
|
-
import { storefrontDepartureItineraryResponseSchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewResponseSchema, storefrontDepartureResponseSchema, storefrontOfferApplyInputSchema, storefrontOfferMutationResponseSchema, storefrontOfferRedeemInputSchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListResponseSchema, storefrontPromotionalOfferResponseSchema, storefrontSettingsResponseSchema, } from "./schemas.js";
|
|
3
|
+
import { storefrontDepartureItineraryResponseSchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewResponseSchema, storefrontDepartureResponseSchema, storefrontOfferApplyInputSchema, storefrontOfferMutationResponseSchema, storefrontOfferRedeemInputSchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListResponseSchema, storefrontPromotionalOfferResponseSchema, storefrontSettingsPatchSchema, storefrontSettingsResponseSchema, } from "./schemas.js";
|
|
4
4
|
export function getStorefrontSettings(client) {
|
|
5
5
|
return fetchWithValidation("/v1/public/settings", storefrontSettingsResponseSchema, client);
|
|
6
6
|
}
|
|
7
|
+
export function getAdminStorefrontSettings(client) {
|
|
8
|
+
return fetchWithValidation("/v1/admin/storefront/settings", storefrontSettingsResponseSchema, client);
|
|
9
|
+
}
|
|
10
|
+
export function updateAdminStorefrontSettings(client, input) {
|
|
11
|
+
const parsed = storefrontSettingsPatchSchema.parse(input);
|
|
12
|
+
return fetchWithValidation("/v1/admin/storefront/settings", storefrontSettingsResponseSchema, client, { method: "PATCH", body: JSON.stringify(parsed) });
|
|
13
|
+
}
|
|
7
14
|
export function getStorefrontDeparture(client, departureId) {
|
|
8
15
|
return fetchWithValidation(`/v1/public/departures/${departureId}`, storefrontDepartureResponseSchema, client);
|
|
9
16
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.test.d.ts","sourceRoot":"","sources":["../src/operations.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { getAdminStorefrontSettings, updateAdminStorefrontSettings } from "./operations.js";
|
|
3
|
+
const storefrontSettingsResponse = {
|
|
4
|
+
data: {
|
|
5
|
+
branding: {
|
|
6
|
+
logoUrl: null,
|
|
7
|
+
faviconUrl: null,
|
|
8
|
+
brandMarkUrl: null,
|
|
9
|
+
primaryColor: null,
|
|
10
|
+
accentColor: null,
|
|
11
|
+
supportedLanguages: [],
|
|
12
|
+
},
|
|
13
|
+
support: {
|
|
14
|
+
email: null,
|
|
15
|
+
phone: null,
|
|
16
|
+
links: [],
|
|
17
|
+
},
|
|
18
|
+
legal: {
|
|
19
|
+
termsUrl: null,
|
|
20
|
+
privacyUrl: null,
|
|
21
|
+
cancellationUrl: null,
|
|
22
|
+
defaultContractTemplateId: null,
|
|
23
|
+
},
|
|
24
|
+
localization: {
|
|
25
|
+
defaultLocale: null,
|
|
26
|
+
currencyDisplay: "code",
|
|
27
|
+
},
|
|
28
|
+
forms: {
|
|
29
|
+
billing: { fields: [] },
|
|
30
|
+
travelers: { fields: [] },
|
|
31
|
+
},
|
|
32
|
+
payment: {
|
|
33
|
+
defaultMethod: null,
|
|
34
|
+
methods: [],
|
|
35
|
+
defaultSchedule: null,
|
|
36
|
+
bankTransfer: null,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
describe("admin storefront settings operations", () => {
|
|
41
|
+
it("reads admin storefront settings from the admin endpoint", async () => {
|
|
42
|
+
const fetcher = vi
|
|
43
|
+
.fn()
|
|
44
|
+
.mockResolvedValueOnce(Response.json(storefrontSettingsResponse));
|
|
45
|
+
await expect(getAdminStorefrontSettings({ baseUrl: "https://operator.example/api", fetcher })).resolves.toEqual(storefrontSettingsResponse);
|
|
46
|
+
expect(fetcher).toHaveBeenCalledWith("https://operator.example/api/v1/admin/storefront/settings", { headers: expect.any(Headers) });
|
|
47
|
+
});
|
|
48
|
+
it("validates and sends settings updates as PATCH requests", async () => {
|
|
49
|
+
const fetcher = vi
|
|
50
|
+
.fn()
|
|
51
|
+
.mockResolvedValueOnce(Response.json(storefrontSettingsResponse));
|
|
52
|
+
await updateAdminStorefrontSettings({ baseUrl: "https://operator.example/api", fetcher }, {
|
|
53
|
+
support: {
|
|
54
|
+
email: "support@example.com",
|
|
55
|
+
links: [{ label: "Help", url: "https://example.com/help" }],
|
|
56
|
+
},
|
|
57
|
+
payment: {
|
|
58
|
+
defaultMethod: "card",
|
|
59
|
+
methods: [{ code: "card" }],
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
const [, init] = fetcher.mock.calls[0] ?? [];
|
|
63
|
+
expect(init?.method).toBe("PATCH");
|
|
64
|
+
expect(init?.body).toBe(JSON.stringify({
|
|
65
|
+
support: {
|
|
66
|
+
email: "support@example.com",
|
|
67
|
+
links: [{ label: "Help", url: "https://example.com/help" }],
|
|
68
|
+
},
|
|
69
|
+
payment: {
|
|
70
|
+
defaultMethod: "card",
|
|
71
|
+
methods: [{ code: "card", enabled: true }],
|
|
72
|
+
},
|
|
73
|
+
}));
|
|
74
|
+
});
|
|
75
|
+
});
|
package/dist/query-keys.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type StorefrontExtensionsFilters = StorefrontProductExtensionsQuery;
|
|
|
5
5
|
export declare const storefrontQueryKeys: {
|
|
6
6
|
readonly all: readonly ["voyant", "storefront"];
|
|
7
7
|
readonly settings: () => readonly ["voyant", "storefront", "settings"];
|
|
8
|
+
readonly adminSettings: () => readonly ["voyant", "storefront", "admin", "settings"];
|
|
8
9
|
readonly departures: () => readonly ["voyant", "storefront", "departures"];
|
|
9
10
|
readonly departure: (departureId: string) => readonly ["voyant", "storefront", "departures", "detail", string];
|
|
10
11
|
readonly productDepartures: (productId: string, filters: StorefrontDepartureFilters) => readonly ["voyant", "storefront", "departures", "product-list", string, {
|
package/dist/query-keys.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-keys.d.ts","sourceRoot":"","sources":["../src/query-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,gCAAgC,EAChC,mCAAmC,EACpC,MAAM,cAAc,CAAA;AAErB,MAAM,MAAM,0BAA0B,GAAG,4BAA4B,CAAA;AAErE,MAAM,MAAM,sBAAsB,GAAG,mCAAmC,CAAA;AAExE,MAAM,MAAM,2BAA2B,GAAG,gCAAgC,CAAA;AAE1E,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"query-keys.d.ts","sourceRoot":"","sources":["../src/query-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,gCAAgC,EAChC,mCAAmC,EACpC,MAAM,cAAc,CAAA;AAErB,MAAM,MAAM,0BAA0B,GAAG,4BAA4B,CAAA;AAErE,MAAM,MAAM,sBAAsB,GAAG,mCAAmC,CAAA;AAExE,MAAM,MAAM,2BAA2B,GAAG,gCAAgC,CAAA;AAE1E,eAAO,MAAM,mBAAmB;;;;;sCAML,MAAM;4CAEA,MAAM,WAAW,0BAA0B;;;;;;;;6CAE1C,MAAM,eAAe,MAAM;kDAEtB,MAAM;;4CAIZ,MAAM,WAAW,2BAA2B;;;;wCAIhD,MAAM,WAAW,sBAAsB;;;;2BAEpD,MAAM,WAAW,MAAM;CAE7B,CAAA"}
|
package/dist/query-keys.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const storefrontQueryKeys = {
|
|
2
2
|
all: ["voyant", "storefront"],
|
|
3
3
|
settings: () => [...storefrontQueryKeys.all, "settings"],
|
|
4
|
+
adminSettings: () => [...storefrontQueryKeys.all, "admin", "settings"],
|
|
4
5
|
departures: () => [...storefrontQueryKeys.all, "departures"],
|
|
5
6
|
departure: (departureId) => [...storefrontQueryKeys.departures(), "detail", departureId],
|
|
6
7
|
productDepartures: (productId, filters) => [...storefrontQueryKeys.departures(), "product-list", productId, filters],
|