@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.js CHANGED
@@ -182,6 +182,8 @@ var AvailabilityService = class {
182
182
  };
183
183
 
184
184
  // src/models/product.ts
185
+ var ACTIVITY_PRODUCT_TYPE = "ACTIVITY";
186
+ var RENTAL_PRODUCT_TYPE = "RENTAL";
185
187
  var ADD_ON_PRODUCT_TYPE = "ADD-ON";
186
188
 
187
189
  // src/internal/bookings/booking-converter.ts
@@ -2703,6 +2705,21 @@ var ProductService = class {
2703
2705
  ]);
2704
2706
  return [...fromActivities(activities), ...fromItemOptionNodes(itemOptionNodes)];
2705
2707
  }
2708
+ /** Returns products with type {@link ACTIVITY_PRODUCT_TYPE}. */
2709
+ async getAllActivities() {
2710
+ const activities = await this.fetchActivities();
2711
+ return fromActivities(activities).filter((p) => p.type === ACTIVITY_PRODUCT_TYPE);
2712
+ }
2713
+ /** Returns products with type {@link RENTAL_PRODUCT_TYPE}. */
2714
+ async getAllRentals() {
2715
+ const activities = await this.fetchActivities();
2716
+ return fromActivities(activities).filter((p) => p.type === RENTAL_PRODUCT_TYPE);
2717
+ }
2718
+ /** Returns only add-on products. */
2719
+ async getAllAddons() {
2720
+ const nodes = await this.fetchAllItemOptionNodes();
2721
+ return fromItemOptionNodes(nodes);
2722
+ }
2706
2723
  async fetchActivities() {
2707
2724
  const body = await this.client.request(
2708
2725
  SALES_ENDPOINT,
@@ -3099,6 +3116,161 @@ var PeekAccessService = class {
3099
3116
  }
3100
3117
  return this.reviewService;
3101
3118
  }
3119
+ // ─── Product short-forms ─────────────────────────────────────────────────
3120
+ /** All products (activities + add-ons). Delegates to {@link ProductService.getAllProducts}. */
3121
+ getAllProducts() {
3122
+ return this.getProductService().getAllProducts();
3123
+ }
3124
+ /** All activity products (excludes add-ons). Delegates to {@link ProductService.getAllActivities}. */
3125
+ getAllActivities() {
3126
+ return this.getProductService().getAllActivities();
3127
+ }
3128
+ /** All rental products. Delegates to {@link ProductService.getAllRentals}. */
3129
+ getAllRentals() {
3130
+ return this.getProductService().getAllRentals();
3131
+ }
3132
+ /** All add-on products. Delegates to {@link ProductService.getAllAddons}. */
3133
+ getAllAddons() {
3134
+ return this.getProductService().getAllAddons();
3135
+ }
3136
+ // ─── Account-user short-forms ─────────────────────────────────────────────
3137
+ /** All active account users. Delegates to {@link AccountUserService.getAll}. */
3138
+ getAllAccountUsers() {
3139
+ return this.getAccountUserService().getAll();
3140
+ }
3141
+ /** Account user by id, or null. Delegates to {@link AccountUserService.getById}. */
3142
+ getAccountUserById(userId) {
3143
+ return this.getAccountUserService().getById(userId);
3144
+ }
3145
+ // ─── Resource-pool short-forms ────────────────────────────────────────────
3146
+ /** All resource pools. Delegates to {@link ResourcePoolService.getAll}. */
3147
+ getAllResourcePools(mode) {
3148
+ return this.getResourcePoolService().getAll(mode);
3149
+ }
3150
+ // ─── Timeslot short-forms ─────────────────────────────────────────────────
3151
+ /** Timeslots for an activity on a given date. Delegates to {@link TimeslotService.getForDay}. */
3152
+ getTimeslotsForDay(productId, date, filter) {
3153
+ return this.getTimeslotService().getForDay(productId, date, filter);
3154
+ }
3155
+ /** Single timeslot by id. Delegates to {@link TimeslotService.getById}. */
3156
+ getTimeslotById(timeslotId) {
3157
+ return this.getTimeslotService().getById(timeslotId);
3158
+ }
3159
+ /** Set timeslot status. Delegates to {@link TimeslotService.setAvailability}. */
3160
+ setTimeslotAvailability(timeslotId, status) {
3161
+ return this.getTimeslotService().setAvailability(timeslotId, status);
3162
+ }
3163
+ /** Set timeslot manifest notes. Delegates to {@link TimeslotService.setNotes}. */
3164
+ setTimeslotNotes(timeslotId, manifestNotes) {
3165
+ return this.getTimeslotService().setNotes(timeslotId, manifestNotes);
3166
+ }
3167
+ /** Assign or unassign guides on timeslots. Delegates to {@link TimeslotService.assignGuide}. */
3168
+ assignTimeslotGuide(assignment) {
3169
+ return this.getTimeslotService().assignGuide(assignment);
3170
+ }
3171
+ // ─── Reseller short-forms ─────────────────────────────────────────────────
3172
+ /** All reseller channels. Delegates to {@link ResellerService.getAllChannels}. */
3173
+ getAllChannels(agentsPerChannel) {
3174
+ return this.getResellerService().getAllChannels(agentsPerChannel);
3175
+ }
3176
+ // ─── Promo-code short-forms ───────────────────────────────────────────────
3177
+ /** All promo codes. Delegates to {@link PromoCodeService.getAll}. */
3178
+ getAllPromoCodes() {
3179
+ return this.getPromoCodeService().getAll();
3180
+ }
3181
+ /** Create a promo code. Delegates to {@link PromoCodeService.create}. */
3182
+ createPromoCode(input) {
3183
+ return this.getPromoCodeService().create(input);
3184
+ }
3185
+ // ─── Daily-note short-forms ───────────────────────────────────────────────
3186
+ /** Today's daily note. Delegates to {@link DailyNoteService.getToday}. */
3187
+ getDailyNoteToday() {
3188
+ return this.getDailyNoteService().getToday();
3189
+ }
3190
+ /** Update today's daily note. Delegates to {@link DailyNoteService.update}. */
3191
+ updateDailyNote(note) {
3192
+ return this.getDailyNoteService().update(note);
3193
+ }
3194
+ // ─── Availability short-forms ─────────────────────────────────────────────
3195
+ /** Availability times for an activity. Delegates to {@link AvailabilityService.getAvailabilityTimes}. */
3196
+ getAvailabilityTimes(query) {
3197
+ return this.getAvailabilityService().getAvailabilityTimes(query);
3198
+ }
3199
+ // ─── Membership short-forms ───────────────────────────────────────────────
3200
+ /** All memberships. Delegates to {@link MembershipService.getAll}. */
3201
+ getAllMemberships() {
3202
+ return this.getMembershipService().getAll();
3203
+ }
3204
+ /** Purchase a membership. Delegates to {@link MembershipService.purchase}. */
3205
+ purchaseMembership(input) {
3206
+ return this.getMembershipService().purchase(input);
3207
+ }
3208
+ // ─── Booking short-forms ──────────────────────────────────────────────────
3209
+ /** Booking by id. Delegates to {@link BookingService.getById}. */
3210
+ getBookingById(bookingId, options) {
3211
+ return this.getBookingService().getById(bookingId, options);
3212
+ }
3213
+ /** Bookings by time range. Delegates to {@link BookingService.searchByTimeRange}. */
3214
+ searchBookingsByTimeRange(input) {
3215
+ return this.getBookingService().searchByTimeRange(input);
3216
+ }
3217
+ /** Bookings on a timeslot. Delegates to {@link BookingService.searchByTimeslot}. */
3218
+ searchBookingsByTimeslot(timeslotId, options) {
3219
+ return this.getBookingService().searchByTimeslot(timeslotId, options);
3220
+ }
3221
+ /** Guests on a booking. Delegates to {@link BookingService.getGuests}. */
3222
+ getBookingGuests(bookingId) {
3223
+ return this.getBookingService().getGuests(bookingId);
3224
+ }
3225
+ /** Payments on file for a booking. Delegates to {@link BookingService.getPaymentsOnFile}. */
3226
+ getBookingPaymentsOnFile(bookingId) {
3227
+ return this.getBookingService().getPaymentsOnFile(bookingId);
3228
+ }
3229
+ /** Append or overwrite operator notes. Delegates to {@link BookingService.appendNote}. */
3230
+ appendBookingNote(bookingId, note, mode) {
3231
+ return this.getBookingService().appendNote(bookingId, note, mode);
3232
+ }
3233
+ /** Set booking check-in status. Delegates to {@link BookingService.setCheckinStatus}. */
3234
+ setBookingCheckinStatus(bookingId, checkedIn) {
3235
+ return this.getBookingService().setCheckinStatus(bookingId, checkedIn);
3236
+ }
3237
+ /** Cancel a booking. Delegates to {@link BookingService.cancel}. */
3238
+ cancelBooking(bookingId, notes) {
3239
+ return this.getBookingService().cancel(bookingId, notes);
3240
+ }
3241
+ /** Charge a booking. Delegates to {@link BookingService.makePayment}. */
3242
+ makeBookingPayment(input) {
3243
+ return this.getBookingService().makePayment(input);
3244
+ }
3245
+ /** Refund a booking payment. Delegates to {@link BookingService.refund}. */
3246
+ refundBooking(input) {
3247
+ return this.getBookingService().refund(input);
3248
+ }
3249
+ /** Create an invoice link. Delegates to {@link BookingService.createInvoiceLink}. */
3250
+ createBookingInvoiceLink(bookingId) {
3251
+ return this.getBookingService().createInvoiceLink(bookingId);
3252
+ }
3253
+ /** List add-ons on a booking. Delegates to {@link BookingService.listAddons}. */
3254
+ listBookingAddons(bookingId) {
3255
+ return this.getBookingService().listAddons(bookingId);
3256
+ }
3257
+ /** Add an add-on to a booking. Delegates to {@link BookingService.addAddon}. */
3258
+ addBookingAddon(bookingId, input) {
3259
+ return this.getBookingService().addAddon(bookingId, input);
3260
+ }
3261
+ /** Remove an add-on from a booking. Delegates to {@link BookingService.removeAddon}. */
3262
+ removeBookingAddon(bookingId, input) {
3263
+ return this.getBookingService().removeAddon(bookingId, input);
3264
+ }
3265
+ /** Create a booking. Delegates to {@link BookingService.create}. */
3266
+ createBooking(input) {
3267
+ return this.getBookingService().create(input);
3268
+ }
3269
+ // ─── Review short-forms ───────────────────────────────────────────────────
3270
+ /** Reviews for an activity. Delegates to {@link ReviewService.getReviews}. */
3271
+ getReviews(productId, reviewCount, reviewOffset) {
3272
+ return this.getReviewService().getReviews(productId, reviewCount, reviewOffset);
3273
+ }
3102
3274
  };
3103
3275
  function requireNonEmpty(value, name) {
3104
3276
  if (!value) {
@@ -3191,6 +3363,6 @@ function extractWaiverNode(payload) {
3191
3363
  return record;
3192
3364
  }
3193
3365
 
3194
- export { ADD_ON_PRODUCT_TYPE, AccountUserService, AdminAccountRequiredError, AvailabilityService, BookingService, DailyNoteService, MembershipService, PeekAccessService, PeekGraphQLError, ProductService, PromoCodeService, RateLimitError, ResellerService, ResourcePoolService, ReviewService, TimeslotService, noopLogger, parseBookingWebhook, parseWaiverWebhook };
3366
+ export { ACTIVITY_PRODUCT_TYPE, ADD_ON_PRODUCT_TYPE, AccountUserService, AdminAccountRequiredError, AvailabilityService, BookingService, DailyNoteService, MembershipService, PeekAccessService, PeekGraphQLError, ProductService, PromoCodeService, RENTAL_PRODUCT_TYPE, RateLimitError, ResellerService, ResourcePoolService, ReviewService, TimeslotService, noopLogger, parseBookingWebhook, parseWaiverWebhook };
3195
3367
  //# sourceMappingURL=index.js.map
3196
3368
  //# sourceMappingURL=index.js.map