@peektravel/app-utilities 0.2.3 → 0.2.5
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 +174 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +402 -320
- package/dist/index.d.ts +402 -320
- package/dist/index.js +173 -1
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +103 -6
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +21 -0
- package/dist/ui/index.d.ts +21 -0
- package/dist/ui/index.js +103 -6
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -204,6 +204,8 @@ var AvailabilityService = class {
|
|
|
204
204
|
};
|
|
205
205
|
|
|
206
206
|
// src/models/product.ts
|
|
207
|
+
var ACTIVITY_PRODUCT_TYPE = "ACTIVITY";
|
|
208
|
+
var RENTAL_PRODUCT_TYPE = "RENTAL";
|
|
207
209
|
var ADD_ON_PRODUCT_TYPE = "ADD-ON";
|
|
208
210
|
|
|
209
211
|
// src/internal/bookings/booking-converter.ts
|
|
@@ -2725,6 +2727,21 @@ var ProductService = class {
|
|
|
2725
2727
|
]);
|
|
2726
2728
|
return [...fromActivities(activities), ...fromItemOptionNodes(itemOptionNodes)];
|
|
2727
2729
|
}
|
|
2730
|
+
/** Returns products with type {@link ACTIVITY_PRODUCT_TYPE}. */
|
|
2731
|
+
async getAllActivities() {
|
|
2732
|
+
const activities = await this.fetchActivities();
|
|
2733
|
+
return fromActivities(activities).filter((p) => p.type === ACTIVITY_PRODUCT_TYPE);
|
|
2734
|
+
}
|
|
2735
|
+
/** Returns products with type {@link RENTAL_PRODUCT_TYPE}. */
|
|
2736
|
+
async getAllRentals() {
|
|
2737
|
+
const activities = await this.fetchActivities();
|
|
2738
|
+
return fromActivities(activities).filter((p) => p.type === RENTAL_PRODUCT_TYPE);
|
|
2739
|
+
}
|
|
2740
|
+
/** Returns only add-on products. */
|
|
2741
|
+
async getAllAddons() {
|
|
2742
|
+
const nodes = await this.fetchAllItemOptionNodes();
|
|
2743
|
+
return fromItemOptionNodes(nodes);
|
|
2744
|
+
}
|
|
2728
2745
|
async fetchActivities() {
|
|
2729
2746
|
const body = await this.client.request(
|
|
2730
2747
|
SALES_ENDPOINT,
|
|
@@ -3121,6 +3138,161 @@ var PeekAccessService = class {
|
|
|
3121
3138
|
}
|
|
3122
3139
|
return this.reviewService;
|
|
3123
3140
|
}
|
|
3141
|
+
// ─── Product short-forms ─────────────────────────────────────────────────
|
|
3142
|
+
/** All products (activities + add-ons). Delegates to {@link ProductService.getAllProducts}. */
|
|
3143
|
+
getAllProducts() {
|
|
3144
|
+
return this.getProductService().getAllProducts();
|
|
3145
|
+
}
|
|
3146
|
+
/** All activity products (excludes add-ons). Delegates to {@link ProductService.getAllActivities}. */
|
|
3147
|
+
getAllActivities() {
|
|
3148
|
+
return this.getProductService().getAllActivities();
|
|
3149
|
+
}
|
|
3150
|
+
/** All rental products. Delegates to {@link ProductService.getAllRentals}. */
|
|
3151
|
+
getAllRentals() {
|
|
3152
|
+
return this.getProductService().getAllRentals();
|
|
3153
|
+
}
|
|
3154
|
+
/** All add-on products. Delegates to {@link ProductService.getAllAddons}. */
|
|
3155
|
+
getAllAddons() {
|
|
3156
|
+
return this.getProductService().getAllAddons();
|
|
3157
|
+
}
|
|
3158
|
+
// ─── Account-user short-forms ─────────────────────────────────────────────
|
|
3159
|
+
/** All active account users. Delegates to {@link AccountUserService.getAll}. */
|
|
3160
|
+
getAllAccountUsers() {
|
|
3161
|
+
return this.getAccountUserService().getAll();
|
|
3162
|
+
}
|
|
3163
|
+
/** Account user by id, or null. Delegates to {@link AccountUserService.getById}. */
|
|
3164
|
+
getAccountUserById(userId) {
|
|
3165
|
+
return this.getAccountUserService().getById(userId);
|
|
3166
|
+
}
|
|
3167
|
+
// ─── Resource-pool short-forms ────────────────────────────────────────────
|
|
3168
|
+
/** All resource pools. Delegates to {@link ResourcePoolService.getAll}. */
|
|
3169
|
+
getAllResourcePools(mode) {
|
|
3170
|
+
return this.getResourcePoolService().getAll(mode);
|
|
3171
|
+
}
|
|
3172
|
+
// ─── Timeslot short-forms ─────────────────────────────────────────────────
|
|
3173
|
+
/** Timeslots for an activity on a given date. Delegates to {@link TimeslotService.getForDay}. */
|
|
3174
|
+
getTimeslotsForDay(productId, date, filter) {
|
|
3175
|
+
return this.getTimeslotService().getForDay(productId, date, filter);
|
|
3176
|
+
}
|
|
3177
|
+
/** Single timeslot by id. Delegates to {@link TimeslotService.getById}. */
|
|
3178
|
+
getTimeslotById(timeslotId) {
|
|
3179
|
+
return this.getTimeslotService().getById(timeslotId);
|
|
3180
|
+
}
|
|
3181
|
+
/** Set timeslot status. Delegates to {@link TimeslotService.setAvailability}. */
|
|
3182
|
+
setTimeslotAvailability(timeslotId, status) {
|
|
3183
|
+
return this.getTimeslotService().setAvailability(timeslotId, status);
|
|
3184
|
+
}
|
|
3185
|
+
/** Set timeslot manifest notes. Delegates to {@link TimeslotService.setNotes}. */
|
|
3186
|
+
setTimeslotNotes(timeslotId, manifestNotes) {
|
|
3187
|
+
return this.getTimeslotService().setNotes(timeslotId, manifestNotes);
|
|
3188
|
+
}
|
|
3189
|
+
/** Assign or unassign guides on timeslots. Delegates to {@link TimeslotService.assignGuide}. */
|
|
3190
|
+
assignTimeslotGuide(assignment) {
|
|
3191
|
+
return this.getTimeslotService().assignGuide(assignment);
|
|
3192
|
+
}
|
|
3193
|
+
// ─── Reseller short-forms ─────────────────────────────────────────────────
|
|
3194
|
+
/** All reseller channels. Delegates to {@link ResellerService.getAllChannels}. */
|
|
3195
|
+
getAllChannels(agentsPerChannel) {
|
|
3196
|
+
return this.getResellerService().getAllChannels(agentsPerChannel);
|
|
3197
|
+
}
|
|
3198
|
+
// ─── Promo-code short-forms ───────────────────────────────────────────────
|
|
3199
|
+
/** All promo codes. Delegates to {@link PromoCodeService.getAll}. */
|
|
3200
|
+
getAllPromoCodes() {
|
|
3201
|
+
return this.getPromoCodeService().getAll();
|
|
3202
|
+
}
|
|
3203
|
+
/** Create a promo code. Delegates to {@link PromoCodeService.create}. */
|
|
3204
|
+
createPromoCode(input) {
|
|
3205
|
+
return this.getPromoCodeService().create(input);
|
|
3206
|
+
}
|
|
3207
|
+
// ─── Daily-note short-forms ───────────────────────────────────────────────
|
|
3208
|
+
/** Today's daily note. Delegates to {@link DailyNoteService.getToday}. */
|
|
3209
|
+
getDailyNoteToday() {
|
|
3210
|
+
return this.getDailyNoteService().getToday();
|
|
3211
|
+
}
|
|
3212
|
+
/** Update today's daily note. Delegates to {@link DailyNoteService.update}. */
|
|
3213
|
+
updateDailyNote(note) {
|
|
3214
|
+
return this.getDailyNoteService().update(note);
|
|
3215
|
+
}
|
|
3216
|
+
// ─── Availability short-forms ─────────────────────────────────────────────
|
|
3217
|
+
/** Availability times for an activity. Delegates to {@link AvailabilityService.getAvailabilityTimes}. */
|
|
3218
|
+
getAvailabilityTimes(query) {
|
|
3219
|
+
return this.getAvailabilityService().getAvailabilityTimes(query);
|
|
3220
|
+
}
|
|
3221
|
+
// ─── Membership short-forms ───────────────────────────────────────────────
|
|
3222
|
+
/** All memberships. Delegates to {@link MembershipService.getAll}. */
|
|
3223
|
+
getAllMemberships() {
|
|
3224
|
+
return this.getMembershipService().getAll();
|
|
3225
|
+
}
|
|
3226
|
+
/** Purchase a membership. Delegates to {@link MembershipService.purchase}. */
|
|
3227
|
+
purchaseMembership(input) {
|
|
3228
|
+
return this.getMembershipService().purchase(input);
|
|
3229
|
+
}
|
|
3230
|
+
// ─── Booking short-forms ──────────────────────────────────────────────────
|
|
3231
|
+
/** Booking by id. Delegates to {@link BookingService.getById}. */
|
|
3232
|
+
getBookingById(bookingId, options) {
|
|
3233
|
+
return this.getBookingService().getById(bookingId, options);
|
|
3234
|
+
}
|
|
3235
|
+
/** Bookings by time range. Delegates to {@link BookingService.searchByTimeRange}. */
|
|
3236
|
+
searchBookingsByTimeRange(input) {
|
|
3237
|
+
return this.getBookingService().searchByTimeRange(input);
|
|
3238
|
+
}
|
|
3239
|
+
/** Bookings on a timeslot. Delegates to {@link BookingService.searchByTimeslot}. */
|
|
3240
|
+
searchBookingsByTimeslot(timeslotId, options) {
|
|
3241
|
+
return this.getBookingService().searchByTimeslot(timeslotId, options);
|
|
3242
|
+
}
|
|
3243
|
+
/** Guests on a booking. Delegates to {@link BookingService.getGuests}. */
|
|
3244
|
+
getBookingGuests(bookingId) {
|
|
3245
|
+
return this.getBookingService().getGuests(bookingId);
|
|
3246
|
+
}
|
|
3247
|
+
/** Payments on file for a booking. Delegates to {@link BookingService.getPaymentsOnFile}. */
|
|
3248
|
+
getBookingPaymentsOnFile(bookingId) {
|
|
3249
|
+
return this.getBookingService().getPaymentsOnFile(bookingId);
|
|
3250
|
+
}
|
|
3251
|
+
/** Append or overwrite operator notes. Delegates to {@link BookingService.appendNote}. */
|
|
3252
|
+
appendBookingNote(bookingId, note, mode) {
|
|
3253
|
+
return this.getBookingService().appendNote(bookingId, note, mode);
|
|
3254
|
+
}
|
|
3255
|
+
/** Set booking check-in status. Delegates to {@link BookingService.setCheckinStatus}. */
|
|
3256
|
+
setBookingCheckinStatus(bookingId, checkedIn) {
|
|
3257
|
+
return this.getBookingService().setCheckinStatus(bookingId, checkedIn);
|
|
3258
|
+
}
|
|
3259
|
+
/** Cancel a booking. Delegates to {@link BookingService.cancel}. */
|
|
3260
|
+
cancelBooking(bookingId, notes) {
|
|
3261
|
+
return this.getBookingService().cancel(bookingId, notes);
|
|
3262
|
+
}
|
|
3263
|
+
/** Charge a booking. Delegates to {@link BookingService.makePayment}. */
|
|
3264
|
+
makeBookingPayment(input) {
|
|
3265
|
+
return this.getBookingService().makePayment(input);
|
|
3266
|
+
}
|
|
3267
|
+
/** Refund a booking payment. Delegates to {@link BookingService.refund}. */
|
|
3268
|
+
refundBooking(input) {
|
|
3269
|
+
return this.getBookingService().refund(input);
|
|
3270
|
+
}
|
|
3271
|
+
/** Create an invoice link. Delegates to {@link BookingService.createInvoiceLink}. */
|
|
3272
|
+
createBookingInvoiceLink(bookingId) {
|
|
3273
|
+
return this.getBookingService().createInvoiceLink(bookingId);
|
|
3274
|
+
}
|
|
3275
|
+
/** List add-ons on a booking. Delegates to {@link BookingService.listAddons}. */
|
|
3276
|
+
listBookingAddons(bookingId) {
|
|
3277
|
+
return this.getBookingService().listAddons(bookingId);
|
|
3278
|
+
}
|
|
3279
|
+
/** Add an add-on to a booking. Delegates to {@link BookingService.addAddon}. */
|
|
3280
|
+
addBookingAddon(bookingId, input) {
|
|
3281
|
+
return this.getBookingService().addAddon(bookingId, input);
|
|
3282
|
+
}
|
|
3283
|
+
/** Remove an add-on from a booking. Delegates to {@link BookingService.removeAddon}. */
|
|
3284
|
+
removeBookingAddon(bookingId, input) {
|
|
3285
|
+
return this.getBookingService().removeAddon(bookingId, input);
|
|
3286
|
+
}
|
|
3287
|
+
/** Create a booking. Delegates to {@link BookingService.create}. */
|
|
3288
|
+
createBooking(input) {
|
|
3289
|
+
return this.getBookingService().create(input);
|
|
3290
|
+
}
|
|
3291
|
+
// ─── Review short-forms ───────────────────────────────────────────────────
|
|
3292
|
+
/** Reviews for an activity. Delegates to {@link ReviewService.getReviews}. */
|
|
3293
|
+
getReviews(productId, reviewCount, reviewOffset) {
|
|
3294
|
+
return this.getReviewService().getReviews(productId, reviewCount, reviewOffset);
|
|
3295
|
+
}
|
|
3124
3296
|
};
|
|
3125
3297
|
function requireNonEmpty(value, name) {
|
|
3126
3298
|
if (!value) {
|
|
@@ -3213,6 +3385,7 @@ function extractWaiverNode(payload) {
|
|
|
3213
3385
|
return record;
|
|
3214
3386
|
}
|
|
3215
3387
|
|
|
3388
|
+
exports.ACTIVITY_PRODUCT_TYPE = ACTIVITY_PRODUCT_TYPE;
|
|
3216
3389
|
exports.ADD_ON_PRODUCT_TYPE = ADD_ON_PRODUCT_TYPE;
|
|
3217
3390
|
exports.AccountUserService = AccountUserService;
|
|
3218
3391
|
exports.AdminAccountRequiredError = AdminAccountRequiredError;
|
|
@@ -3224,6 +3397,7 @@ exports.PeekAccessService = PeekAccessService;
|
|
|
3224
3397
|
exports.PeekGraphQLError = PeekGraphQLError;
|
|
3225
3398
|
exports.ProductService = ProductService;
|
|
3226
3399
|
exports.PromoCodeService = PromoCodeService;
|
|
3400
|
+
exports.RENTAL_PRODUCT_TYPE = RENTAL_PRODUCT_TYPE;
|
|
3227
3401
|
exports.RateLimitError = RateLimitError;
|
|
3228
3402
|
exports.ResellerService = ResellerService;
|
|
3229
3403
|
exports.ResourcePoolService = ResourcePoolService;
|