@peektravel/app-utilities 0.8.2 → 0.9.1
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 +6 -3
- package/dist/index.cjs +127 -77
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +104 -101
- package/dist/index.d.ts +104 -101
- package/dist/index.js +127 -77
- package/dist/index.js.map +1 -1
- package/docs/webhooks.md +11 -8
- package/llms.txt +19 -11
- package/package.json +1 -2
- package/docs/ui.md +0 -1175
package/README.md
CHANGED
|
@@ -317,9 +317,12 @@ event data**; the fields it shares with the token (`installId` / `accountId` /
|
|
|
317
317
|
the body omits them. The token authenticates the whole delivery, so the body is
|
|
318
318
|
trusted within a verified request. This webhook is the only source of
|
|
319
319
|
`accountId`, `timezone`, and `apiUrl` in the package, since no GraphQL read
|
|
320
|
-
returns them — **persist them per install**. `apiUrl` is the install's
|
|
321
|
-
|
|
322
|
-
|
|
320
|
+
returns them — **persist them per install**. `apiUrl` is the install's **base API
|
|
321
|
+
URL**: pass it straight through (don't reconstruct it from `appId`) as the access
|
|
322
|
+
service's `apiUrl` — each service class appends its own backoffice slug (e.g.
|
|
323
|
+
`peek_backoffice_api-v1`) when it makes a call, stripping the slug back off if the
|
|
324
|
+
URL you pass already carries it and throwing if it carries a different platform's
|
|
325
|
+
slug — or hand the whole install to
|
|
323
326
|
`createAccessServiceForInstall(install, { jwtSecret, issuer })`, which picks the
|
|
324
327
|
service by `platform` and wires the endpoint for you. Every event is a **full
|
|
325
328
|
snapshot** — an `update_installed` carries the same fields as the original
|
package/dist/index.cjs
CHANGED
|
@@ -23,9 +23,29 @@ function _interopNamespace(e) {
|
|
|
23
23
|
|
|
24
24
|
var jwt__namespace = /*#__PURE__*/_interopNamespace(jwt);
|
|
25
25
|
|
|
26
|
+
// src/internal/api-endpoints.ts
|
|
27
|
+
var ApiEndpoints = class {
|
|
28
|
+
constructor(paths) {
|
|
29
|
+
this.paths = paths;
|
|
30
|
+
}
|
|
31
|
+
paths;
|
|
32
|
+
/** The relative path (slug) for `endpoint`, appended to the base API URL. */
|
|
33
|
+
pathFor(endpoint) {
|
|
34
|
+
return this.paths[endpoint];
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
function joinUrl(...parts) {
|
|
38
|
+
return parts.filter((part) => part.length > 0).join("/");
|
|
39
|
+
}
|
|
40
|
+
|
|
26
41
|
// src/internal/peek/gateway-endpoints.ts
|
|
27
42
|
var SALES_ENDPOINT = "sales";
|
|
28
43
|
var V2_EXTENDABLE_SLUG = "peek_backoffice_api-v1";
|
|
44
|
+
function peekApiEndpoints(useRegistrySlug) {
|
|
45
|
+
return new ApiEndpoints({
|
|
46
|
+
[SALES_ENDPOINT]: useRegistrySlug ? V2_EXTENDABLE_SLUG : SALES_ENDPOINT
|
|
47
|
+
});
|
|
48
|
+
}
|
|
29
49
|
|
|
30
50
|
// src/internal/peek/account-users/account-user-converter.ts
|
|
31
51
|
var ACTIVE_STATUS = "ACTIVE";
|
|
@@ -2099,6 +2119,21 @@ function requireNonEmpty(value, name, serviceName) {
|
|
|
2099
2119
|
throw new Error(`${serviceName}: "${name}" is required`);
|
|
2100
2120
|
}
|
|
2101
2121
|
}
|
|
2122
|
+
var EXTENDABLE_SLUG_RE = /^([a-z0-9]+)[-_]backoffice[-_]api[-_]v1$/i;
|
|
2123
|
+
function resolveBaseApiUrl(apiUrl, platformSlug, serviceName) {
|
|
2124
|
+
const trimmed = apiUrl.replace(/\/+$/, "");
|
|
2125
|
+
const lastSegment = trimmed.slice(trimmed.lastIndexOf("/") + 1);
|
|
2126
|
+
const found = EXTENDABLE_SLUG_RE.exec(lastSegment);
|
|
2127
|
+
if (!found) return trimmed;
|
|
2128
|
+
const foundPlatform = found[1].toLowerCase();
|
|
2129
|
+
const expectedPlatform = EXTENDABLE_SLUG_RE.exec(platformSlug)[1].toLowerCase();
|
|
2130
|
+
if (foundPlatform !== expectedPlatform) {
|
|
2131
|
+
throw new Error(
|
|
2132
|
+
`${serviceName}: "apiUrl" carries a "${foundPlatform}" backoffice slug but this service targets "${expectedPlatform}" \u2014 pass the install's ${expectedPlatform} app endpoint`
|
|
2133
|
+
);
|
|
2134
|
+
}
|
|
2135
|
+
return trimmed.slice(0, trimmed.lastIndexOf("/"));
|
|
2136
|
+
}
|
|
2102
2137
|
function createTokenManager(config) {
|
|
2103
2138
|
return new TokenManager({
|
|
2104
2139
|
secret: config.jwtSecret,
|
|
@@ -2146,6 +2181,12 @@ async function requestWithRetry(http, url, init, label, onResponse) {
|
|
|
2146
2181
|
throw new RateLimitError();
|
|
2147
2182
|
}
|
|
2148
2183
|
|
|
2184
|
+
// src/internal/sdk-headers.ts
|
|
2185
|
+
var SDK_HEADER_NAME = "x-peek-sdk";
|
|
2186
|
+
var SDK_PLATFORM = "js";
|
|
2187
|
+
var SDK_VERSION = "0.9.1";
|
|
2188
|
+
var SDK_HEADER_VALUE = `${SDK_PLATFORM}-${SDK_VERSION}`;
|
|
2189
|
+
|
|
2149
2190
|
// src/internal/peek/graphql-client.ts
|
|
2150
2191
|
var isObject = (value) => typeof value === "object" && value !== null;
|
|
2151
2192
|
var GraphQLClient = class {
|
|
@@ -2191,15 +2232,14 @@ var GraphQLClient = class {
|
|
|
2191
2232
|
);
|
|
2192
2233
|
}
|
|
2193
2234
|
endpoint(endpointName) {
|
|
2194
|
-
const {
|
|
2195
|
-
|
|
2196
|
-
const prefix = endpointPathPrefix ? `${endpointPathPrefix}/` : "";
|
|
2197
|
-
return `${baseUrl}/${appId}/${prefix}${endpointName}`;
|
|
2235
|
+
const { baseApiUrl, endpoints } = this.options;
|
|
2236
|
+
return joinUrl(baseApiUrl, endpoints.pathFor(endpointName));
|
|
2198
2237
|
}
|
|
2199
2238
|
buildHeaders() {
|
|
2200
2239
|
const headers = {
|
|
2201
2240
|
"X-Peek-Auth": `Bearer ${this.options.getToken()}`,
|
|
2202
|
-
"Content-Type": "application/json"
|
|
2241
|
+
"Content-Type": "application/json",
|
|
2242
|
+
[SDK_HEADER_NAME]: SDK_HEADER_VALUE
|
|
2203
2243
|
};
|
|
2204
2244
|
if (this.options.gatewayKey) {
|
|
2205
2245
|
headers["pk-api-key"] = this.options.gatewayKey;
|
|
@@ -3816,17 +3856,17 @@ var PeekAccessService = class {
|
|
|
3816
3856
|
this.jwtSecret = config.jwtSecret;
|
|
3817
3857
|
const logger = config.logger ?? noopLogger;
|
|
3818
3858
|
const tokens = createTokenManager(config);
|
|
3859
|
+
const useRegistrySlug = hasApiUrl || isV2;
|
|
3819
3860
|
const defaultBaseUrl = isV2 ? DEFAULT_V2_BASE_URL : DEFAULT_BASE_URL;
|
|
3861
|
+
const baseApiUrl = hasApiUrl ? resolveBaseApiUrl(config.apiUrl, V2_EXTENDABLE_SLUG, "PeekAccessService") : `${config.baseUrl ?? defaultBaseUrl}/${config.appId}`;
|
|
3820
3862
|
this.client = new GraphQLClient({
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
appId: hasApiUrl ? void 0 : config.appId,
|
|
3863
|
+
baseApiUrl,
|
|
3864
|
+
endpoints: peekApiEndpoints(useRegistrySlug),
|
|
3824
3865
|
gatewayKey: config.gatewayKey,
|
|
3825
3866
|
getToken: () => tokens.getToken(),
|
|
3826
3867
|
retryDelaysMs: config.retryDelaysMs ?? DEFAULT_RETRY_DELAYS_MS,
|
|
3827
3868
|
logger,
|
|
3828
|
-
fetchFn: config.fetch ?? globalThis.fetch
|
|
3829
|
-
endpointPathPrefix: !hasApiUrl && isV2 ? V2_EXTENDABLE_SLUG : void 0
|
|
3869
|
+
fetchFn: config.fetch ?? globalThis.fetch
|
|
3830
3870
|
});
|
|
3831
3871
|
this.productServiceOptions = {
|
|
3832
3872
|
itemOptionsPageSize: config.itemOptionsPageSize
|
|
@@ -3997,182 +4037,182 @@ var PeekAccessService = class {
|
|
|
3997
4037
|
return this.reviewService;
|
|
3998
4038
|
}
|
|
3999
4039
|
// ─── Product short-forms ─────────────────────────────────────────────────
|
|
4000
|
-
/** All products (activities + add-ons).
|
|
4040
|
+
/** All products (activities + add-ons). @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ProductService.getAllProducts}. */
|
|
4001
4041
|
getAllProducts() {
|
|
4002
4042
|
return this.getProductService().getAllProducts();
|
|
4003
4043
|
}
|
|
4004
|
-
/** All activity products (excludes add-ons).
|
|
4044
|
+
/** All activity products (excludes add-ons). @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ProductService.getAllActivities}. */
|
|
4005
4045
|
getAllActivities() {
|
|
4006
4046
|
return this.getProductService().getAllActivities();
|
|
4007
4047
|
}
|
|
4008
|
-
/** All rental products.
|
|
4048
|
+
/** All rental products. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ProductService.getAllRentals}. */
|
|
4009
4049
|
getAllRentals() {
|
|
4010
4050
|
return this.getProductService().getAllRentals();
|
|
4011
4051
|
}
|
|
4012
|
-
/** All add-on products.
|
|
4052
|
+
/** All add-on products. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ProductService.getAllAddons}. */
|
|
4013
4053
|
getAllAddons() {
|
|
4014
4054
|
return this.getProductService().getAllAddons();
|
|
4015
4055
|
}
|
|
4016
|
-
/** An activity's custom questions.
|
|
4056
|
+
/** An activity's custom questions. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ProductService.getCustomQuestions}. */
|
|
4017
4057
|
getCustomQuestions(productId) {
|
|
4018
4058
|
return this.getProductService().getCustomQuestions(productId);
|
|
4019
4059
|
}
|
|
4020
4060
|
// ─── Account-user short-forms ─────────────────────────────────────────────
|
|
4021
|
-
/** All active account users.
|
|
4061
|
+
/** All active account users. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link AccountUserService.getAll}. */
|
|
4022
4062
|
getAllAccountUsers() {
|
|
4023
4063
|
return this.getAccountUserService().getAll();
|
|
4024
4064
|
}
|
|
4025
|
-
/** Account user by id, or null.
|
|
4065
|
+
/** Account user by id, or null. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link AccountUserService.getById}. */
|
|
4026
4066
|
getAccountUserById(userId) {
|
|
4027
4067
|
return this.getAccountUserService().getById(userId);
|
|
4028
4068
|
}
|
|
4029
4069
|
// ─── Resource-pool short-forms ────────────────────────────────────────────
|
|
4030
|
-
/** All resource pools.
|
|
4070
|
+
/** All resource pools. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ResourcePoolService.getAll}. */
|
|
4031
4071
|
getAllResourcePools(mode) {
|
|
4032
4072
|
return this.getResourcePoolService().getAll(mode);
|
|
4033
4073
|
}
|
|
4034
4074
|
// ─── Timeslot short-forms ─────────────────────────────────────────────────
|
|
4035
|
-
/** Timeslots for an activity on a given date.
|
|
4075
|
+
/** Timeslots for an activity on a given date. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link TimeslotService.getForDay}. */
|
|
4036
4076
|
getTimeslotsForDay(productId, date, filter) {
|
|
4037
4077
|
return this.getTimeslotService().getForDay(productId, date, filter);
|
|
4038
4078
|
}
|
|
4039
|
-
/** Single timeslot by id.
|
|
4079
|
+
/** Single timeslot by id. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link TimeslotService.getById}. */
|
|
4040
4080
|
getTimeslotById(timeslotId) {
|
|
4041
4081
|
return this.getTimeslotService().getById(timeslotId);
|
|
4042
4082
|
}
|
|
4043
|
-
/** Set timeslot status.
|
|
4083
|
+
/** Set timeslot status. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link TimeslotService.setAvailability}. */
|
|
4044
4084
|
setTimeslotAvailability(timeslotId, status) {
|
|
4045
4085
|
return this.getTimeslotService().setAvailability(timeslotId, status);
|
|
4046
4086
|
}
|
|
4047
|
-
/** Set timeslot manifest notes.
|
|
4087
|
+
/** Set timeslot manifest notes. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link TimeslotService.setNotes}. */
|
|
4048
4088
|
setTimeslotNotes(timeslotId, manifestNotes) {
|
|
4049
4089
|
return this.getTimeslotService().setNotes(timeslotId, manifestNotes);
|
|
4050
4090
|
}
|
|
4051
|
-
/** Assign or unassign guides on timeslots.
|
|
4091
|
+
/** Assign or unassign guides on timeslots. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link TimeslotService.assignGuide}. */
|
|
4052
4092
|
assignTimeslotGuide(assignment) {
|
|
4053
4093
|
return this.getTimeslotService().assignGuide(assignment);
|
|
4054
4094
|
}
|
|
4055
4095
|
// ─── Reseller short-forms ─────────────────────────────────────────────────
|
|
4056
|
-
/** All reseller channels.
|
|
4096
|
+
/** All reseller channels. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ResellerService.getAllChannels}. */
|
|
4057
4097
|
getAllChannels(agentsPerChannel) {
|
|
4058
4098
|
return this.getResellerService().getAllChannels(agentsPerChannel);
|
|
4059
4099
|
}
|
|
4060
4100
|
// ─── Promo-code short-forms ───────────────────────────────────────────────
|
|
4061
|
-
/** All promo codes.
|
|
4101
|
+
/** All promo codes. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PromoCodeService.getAll}. */
|
|
4062
4102
|
getAllPromoCodes() {
|
|
4063
4103
|
return this.getPromoCodeService().getAll();
|
|
4064
4104
|
}
|
|
4065
|
-
/** Create a promo code.
|
|
4105
|
+
/** Create a promo code. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PromoCodeService.create}. */
|
|
4066
4106
|
createPromoCode(input) {
|
|
4067
4107
|
return this.getPromoCodeService().create(input);
|
|
4068
4108
|
}
|
|
4069
4109
|
// ─── Pricing short-forms ──────────────────────────────────────────────────
|
|
4070
|
-
/** Create a pricing engine.
|
|
4110
|
+
/** Create a pricing engine. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PricingService.createEngine}. */
|
|
4071
4111
|
createPricingEngine(input) {
|
|
4072
4112
|
return this.getPricingService().createEngine(input);
|
|
4073
4113
|
}
|
|
4074
|
-
/** Update a pricing engine.
|
|
4114
|
+
/** Update a pricing engine. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PricingService.updateEngine}. */
|
|
4075
4115
|
updatePricingEngine(input) {
|
|
4076
4116
|
return this.getPricingService().updateEngine(input);
|
|
4077
4117
|
}
|
|
4078
|
-
/** Delete a pricing engine (idempotent).
|
|
4118
|
+
/** Delete a pricing engine (idempotent). @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PricingService.deleteEngine}. */
|
|
4079
4119
|
deletePricingEngine(engineId) {
|
|
4080
4120
|
return this.getPricingService().deleteEngine(engineId);
|
|
4081
4121
|
}
|
|
4082
|
-
/** Upsert pricing overrides.
|
|
4122
|
+
/** Upsert pricing overrides. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PricingService.upsertOverrides}. */
|
|
4083
4123
|
upsertPricingOverrides(input) {
|
|
4084
4124
|
return this.getPricingService().upsertOverrides(input);
|
|
4085
4125
|
}
|
|
4086
|
-
/** Clear pricing overrides for a set of activities.
|
|
4126
|
+
/** Clear pricing overrides for a set of activities. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link PricingService.clearOverrides}. */
|
|
4087
4127
|
clearPricingOverrides(input) {
|
|
4088
4128
|
return this.getPricingService().clearOverrides(input);
|
|
4089
4129
|
}
|
|
4090
4130
|
// ─── Daily-note short-forms ───────────────────────────────────────────────
|
|
4091
|
-
/** Today's daily note.
|
|
4131
|
+
/** Today's daily note. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link DailyNoteService.getToday}. */
|
|
4092
4132
|
getDailyNoteToday() {
|
|
4093
4133
|
return this.getDailyNoteService().getToday();
|
|
4094
4134
|
}
|
|
4095
|
-
/** Update today's daily note.
|
|
4135
|
+
/** Update today's daily note. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link DailyNoteService.update}. */
|
|
4096
4136
|
updateDailyNote(note) {
|
|
4097
4137
|
return this.getDailyNoteService().update(note);
|
|
4098
4138
|
}
|
|
4099
4139
|
// ─── Availability short-forms ─────────────────────────────────────────────
|
|
4100
|
-
/** Availability times for an activity.
|
|
4140
|
+
/** Availability times for an activity. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link AvailabilityService.getAvailabilityTimes}. */
|
|
4101
4141
|
getAvailabilityTimes(query) {
|
|
4102
4142
|
return this.getAvailabilityService().getAvailabilityTimes(query);
|
|
4103
4143
|
}
|
|
4104
4144
|
// ─── Membership short-forms ───────────────────────────────────────────────
|
|
4105
|
-
/** All memberships.
|
|
4145
|
+
/** All memberships. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link MembershipService.getAll}. */
|
|
4106
4146
|
getAllMemberships() {
|
|
4107
4147
|
return this.getMembershipService().getAll();
|
|
4108
4148
|
}
|
|
4109
|
-
/** Purchase a membership.
|
|
4149
|
+
/** Purchase a membership. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link MembershipService.purchase}. */
|
|
4110
4150
|
purchaseMembership(input) {
|
|
4111
4151
|
return this.getMembershipService().purchase(input);
|
|
4112
4152
|
}
|
|
4113
4153
|
// ─── Booking short-forms ──────────────────────────────────────────────────
|
|
4114
|
-
/** Booking by id.
|
|
4154
|
+
/** Booking by id. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.getById}. */
|
|
4115
4155
|
getBookingById(bookingId, options) {
|
|
4116
4156
|
return this.getBookingService().getById(bookingId, options);
|
|
4117
4157
|
}
|
|
4118
|
-
/** Bookings by time range.
|
|
4158
|
+
/** Bookings by time range. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.searchByTimeRange}. */
|
|
4119
4159
|
searchBookingsByTimeRange(input) {
|
|
4120
4160
|
return this.getBookingService().searchByTimeRange(input);
|
|
4121
4161
|
}
|
|
4122
|
-
/** Bookings on a timeslot.
|
|
4162
|
+
/** Bookings on a timeslot. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.searchByTimeslot}. */
|
|
4123
4163
|
searchBookingsByTimeslot(timeslotId, options) {
|
|
4124
4164
|
return this.getBookingService().searchByTimeslot(timeslotId, options);
|
|
4125
4165
|
}
|
|
4126
|
-
/** Guests on a booking.
|
|
4166
|
+
/** Guests on a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.getGuests}. */
|
|
4127
4167
|
getBookingGuests(bookingId) {
|
|
4128
4168
|
return this.getBookingService().getGuests(bookingId);
|
|
4129
4169
|
}
|
|
4130
|
-
/** Payments on file for a booking.
|
|
4170
|
+
/** Payments on file for a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.getPaymentsOnFile}. */
|
|
4131
4171
|
getBookingPaymentsOnFile(bookingId) {
|
|
4132
4172
|
return this.getBookingService().getPaymentsOnFile(bookingId);
|
|
4133
4173
|
}
|
|
4134
|
-
/** Append or overwrite operator notes.
|
|
4174
|
+
/** Append or overwrite operator notes. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.appendNote}. */
|
|
4135
4175
|
appendBookingNote(bookingId, note, mode) {
|
|
4136
4176
|
return this.getBookingService().appendNote(bookingId, note, mode);
|
|
4137
4177
|
}
|
|
4138
|
-
/** Set booking check-in status.
|
|
4178
|
+
/** Set booking check-in status. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.setCheckinStatus}. */
|
|
4139
4179
|
setBookingCheckinStatus(bookingId, checkedIn) {
|
|
4140
4180
|
return this.getBookingService().setCheckinStatus(bookingId, checkedIn);
|
|
4141
4181
|
}
|
|
4142
|
-
/** Cancel a booking.
|
|
4182
|
+
/** Cancel a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.cancel}. */
|
|
4143
4183
|
cancelBooking(bookingId, notes) {
|
|
4144
4184
|
return this.getBookingService().cancel(bookingId, notes);
|
|
4145
4185
|
}
|
|
4146
|
-
/** Charge a booking.
|
|
4186
|
+
/** Charge a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.makePayment}. */
|
|
4147
4187
|
makeBookingPayment(input) {
|
|
4148
4188
|
return this.getBookingService().makePayment(input);
|
|
4149
4189
|
}
|
|
4150
|
-
/** Refund a booking payment.
|
|
4190
|
+
/** Refund a booking payment. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.refund}. */
|
|
4151
4191
|
refundBooking(input) {
|
|
4152
4192
|
return this.getBookingService().refund(input);
|
|
4153
4193
|
}
|
|
4154
|
-
/** Create an invoice link.
|
|
4194
|
+
/** Create an invoice link. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.createInvoiceLink}. */
|
|
4155
4195
|
createBookingInvoiceLink(bookingId) {
|
|
4156
4196
|
return this.getBookingService().createInvoiceLink(bookingId);
|
|
4157
4197
|
}
|
|
4158
|
-
/** List add-ons on a booking.
|
|
4198
|
+
/** List add-ons on a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.listAddons}. */
|
|
4159
4199
|
listBookingAddons(bookingId) {
|
|
4160
4200
|
return this.getBookingService().listAddons(bookingId);
|
|
4161
4201
|
}
|
|
4162
|
-
/** Add an add-on to a booking.
|
|
4202
|
+
/** Add an add-on to a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.addAddon}. */
|
|
4163
4203
|
addBookingAddon(bookingId, input) {
|
|
4164
4204
|
return this.getBookingService().addAddon(bookingId, input);
|
|
4165
4205
|
}
|
|
4166
|
-
/** Remove an add-on from a booking.
|
|
4206
|
+
/** Remove an add-on from a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.removeAddon}. */
|
|
4167
4207
|
removeBookingAddon(bookingId, input) {
|
|
4168
4208
|
return this.getBookingService().removeAddon(bookingId, input);
|
|
4169
4209
|
}
|
|
4170
|
-
/** Create a booking.
|
|
4210
|
+
/** Create a booking. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link BookingService.create}. */
|
|
4171
4211
|
createBooking(input) {
|
|
4172
4212
|
return this.getBookingService().create(input);
|
|
4173
4213
|
}
|
|
4174
4214
|
// ─── Review short-forms ───────────────────────────────────────────────────
|
|
4175
|
-
/** Reviews for an activity.
|
|
4215
|
+
/** Reviews for an activity. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ReviewService.getReviews}. */
|
|
4176
4216
|
getReviews(productId, reviewCount, reviewOffset) {
|
|
4177
4217
|
return this.getReviewService().getReviews(productId, reviewCount, reviewOffset);
|
|
4178
4218
|
}
|
|
@@ -4180,7 +4220,11 @@ var PeekAccessService = class {
|
|
|
4180
4220
|
|
|
4181
4221
|
// src/internal/cng/endpoints.ts
|
|
4182
4222
|
var CNG_EXTENDABLE_SLUG = "cng_backoffice_api-v1";
|
|
4223
|
+
var CNG_PRODUCTS_ENDPOINT = "products";
|
|
4183
4224
|
var PRODUCTS_PATH = "api/v2/app-registry/products?active=1";
|
|
4225
|
+
var CNG_API_ENDPOINTS = new ApiEndpoints({
|
|
4226
|
+
[CNG_PRODUCTS_ENDPOINT]: CNG_EXTENDABLE_SLUG
|
|
4227
|
+
});
|
|
4184
4228
|
|
|
4185
4229
|
// src/models/cng/product.ts
|
|
4186
4230
|
var ACTIVITY_PRODUCT_TYPE2 = "ACTIVITY";
|
|
@@ -4214,7 +4258,10 @@ var CngProductService = class {
|
|
|
4214
4258
|
* ```
|
|
4215
4259
|
*/
|
|
4216
4260
|
async getAllActivities() {
|
|
4217
|
-
const body = await this.client.get(
|
|
4261
|
+
const body = await this.client.get(
|
|
4262
|
+
CNG_PRODUCTS_ENDPOINT,
|
|
4263
|
+
PRODUCTS_PATH
|
|
4264
|
+
);
|
|
4218
4265
|
return fromProductNodes(body?.data ?? []);
|
|
4219
4266
|
}
|
|
4220
4267
|
};
|
|
@@ -4236,9 +4283,9 @@ var RestClient = class {
|
|
|
4236
4283
|
* @throws {CngPermissionError} on HTTP 403 (app missing a permission)
|
|
4237
4284
|
* @throws {CngApiError} on any other non-2xx response
|
|
4238
4285
|
*/
|
|
4239
|
-
async get(path) {
|
|
4286
|
+
async get(endpoint, path) {
|
|
4240
4287
|
const { logger } = this.options;
|
|
4241
|
-
const url = this.endpoint(path);
|
|
4288
|
+
const url = this.endpoint(endpoint, path);
|
|
4242
4289
|
logger.info("Making CNG request", { url, path });
|
|
4243
4290
|
return requestWithRetry(
|
|
4244
4291
|
this.options,
|
|
@@ -4260,15 +4307,15 @@ var RestClient = class {
|
|
|
4260
4307
|
}
|
|
4261
4308
|
);
|
|
4262
4309
|
}
|
|
4263
|
-
endpoint(path) {
|
|
4264
|
-
const {
|
|
4265
|
-
|
|
4266
|
-
return `${baseUrl}/${appId}/${extendableSlug}/${path}`;
|
|
4310
|
+
endpoint(endpoint, path) {
|
|
4311
|
+
const { baseApiUrl, endpoints } = this.options;
|
|
4312
|
+
return joinUrl(baseApiUrl, endpoints.pathFor(endpoint), path);
|
|
4267
4313
|
}
|
|
4268
4314
|
buildHeaders() {
|
|
4269
4315
|
return {
|
|
4270
4316
|
"X-Peek-Auth": `Bearer ${this.options.getToken()}`,
|
|
4271
|
-
"Content-Type": "application/json"
|
|
4317
|
+
"Content-Type": "application/json",
|
|
4318
|
+
[SDK_HEADER_NAME]: SDK_HEADER_VALUE
|
|
4272
4319
|
};
|
|
4273
4320
|
}
|
|
4274
4321
|
};
|
|
@@ -4292,11 +4339,10 @@ var CngAccessService = class {
|
|
|
4292
4339
|
if (!hasApiUrl) requireNonEmpty(config.appId ?? "", "appId", "CngAccessService");
|
|
4293
4340
|
const logger = config.logger ?? noopLogger;
|
|
4294
4341
|
const tokens = createTokenManager(config);
|
|
4342
|
+
const baseApiUrl = hasApiUrl ? resolveBaseApiUrl(config.apiUrl, CNG_EXTENDABLE_SLUG, "CngAccessService") : `${config.baseUrl ?? DEFAULT_BASE_URL2}/${config.appId}`;
|
|
4295
4343
|
this.client = new RestClient({
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
appId: hasApiUrl ? void 0 : config.appId,
|
|
4299
|
-
extendableSlug: CNG_EXTENDABLE_SLUG,
|
|
4344
|
+
baseApiUrl,
|
|
4345
|
+
endpoints: CNG_API_ENDPOINTS,
|
|
4300
4346
|
getToken: () => tokens.getToken(),
|
|
4301
4347
|
retryDelaysMs: config.retryDelaysMs ?? DEFAULT_RETRY_DELAYS_MS,
|
|
4302
4348
|
logger,
|
|
@@ -4313,7 +4359,7 @@ var CngAccessService = class {
|
|
|
4313
4359
|
}
|
|
4314
4360
|
return this.productService;
|
|
4315
4361
|
}
|
|
4316
|
-
/** All activities.
|
|
4362
|
+
/** All activities. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link CngProductService.getAllActivities}. */
|
|
4317
4363
|
getAllActivities() {
|
|
4318
4364
|
return this.getProductService().getAllActivities();
|
|
4319
4365
|
}
|
|
@@ -4321,7 +4367,11 @@ var CngAccessService = class {
|
|
|
4321
4367
|
|
|
4322
4368
|
// src/internal/acme/endpoints.ts
|
|
4323
4369
|
var ACME_EXTENDABLE_SLUG = "acme_backoffice_api-v1";
|
|
4370
|
+
var ACME_TEMPLATES_ENDPOINT = "templates";
|
|
4324
4371
|
var TEMPLATES_PATH = "v2/b2b/event/templates/names?pageSize=-1&page=1";
|
|
4372
|
+
var ACME_API_ENDPOINTS = new ApiEndpoints({
|
|
4373
|
+
[ACME_TEMPLATES_ENDPOINT]: ACME_EXTENDABLE_SLUG
|
|
4374
|
+
});
|
|
4325
4375
|
|
|
4326
4376
|
// src/models/acme/product.ts
|
|
4327
4377
|
var ACME_ACTIVITY_TYPE = "standard";
|
|
@@ -4359,6 +4409,7 @@ var AcmeProductService = class {
|
|
|
4359
4409
|
*/
|
|
4360
4410
|
async getAllActivities() {
|
|
4361
4411
|
const body = await this.client.get(
|
|
4412
|
+
ACME_TEMPLATES_ENDPOINT,
|
|
4362
4413
|
TEMPLATES_PATH
|
|
4363
4414
|
);
|
|
4364
4415
|
const nodes = Array.isArray(body) ? body : body?.list ?? [];
|
|
@@ -4381,9 +4432,9 @@ var RestClient2 = class {
|
|
|
4381
4432
|
* @throws {RateLimitError} on HTTP 429 after retries are exhausted
|
|
4382
4433
|
* @throws {AcmeApiError} on any other non-2xx response
|
|
4383
4434
|
*/
|
|
4384
|
-
async get(path) {
|
|
4435
|
+
async get(endpoint, path) {
|
|
4385
4436
|
const { logger } = this.options;
|
|
4386
|
-
const url = this.endpoint(path);
|
|
4437
|
+
const url = this.endpoint(endpoint, path);
|
|
4387
4438
|
logger.info("Making ACME request", { url, path });
|
|
4388
4439
|
return requestWithRetry(
|
|
4389
4440
|
this.options,
|
|
@@ -4400,15 +4451,15 @@ var RestClient2 = class {
|
|
|
4400
4451
|
}
|
|
4401
4452
|
);
|
|
4402
4453
|
}
|
|
4403
|
-
endpoint(path) {
|
|
4404
|
-
const {
|
|
4405
|
-
|
|
4406
|
-
return `${baseUrl}/${appId}/${extendableSlug}/${path}`;
|
|
4454
|
+
endpoint(endpoint, path) {
|
|
4455
|
+
const { baseApiUrl, endpoints } = this.options;
|
|
4456
|
+
return joinUrl(baseApiUrl, endpoints.pathFor(endpoint), path);
|
|
4407
4457
|
}
|
|
4408
4458
|
buildHeaders() {
|
|
4409
4459
|
return {
|
|
4410
4460
|
"X-Peek-Auth": `Bearer ${this.options.getToken()}`,
|
|
4411
|
-
"Content-Type": "application/json"
|
|
4461
|
+
"Content-Type": "application/json",
|
|
4462
|
+
[SDK_HEADER_NAME]: SDK_HEADER_VALUE
|
|
4412
4463
|
};
|
|
4413
4464
|
}
|
|
4414
4465
|
};
|
|
@@ -4426,11 +4477,10 @@ var AcmeAccessService = class {
|
|
|
4426
4477
|
if (!hasApiUrl) requireNonEmpty(config.appId ?? "", "appId", "AcmeAccessService");
|
|
4427
4478
|
const logger = config.logger ?? noopLogger;
|
|
4428
4479
|
const tokens = createTokenManager(config);
|
|
4480
|
+
const baseApiUrl = hasApiUrl ? resolveBaseApiUrl(config.apiUrl, ACME_EXTENDABLE_SLUG, "AcmeAccessService") : `${config.baseUrl ?? DEFAULT_BASE_URL3}/${config.appId}`;
|
|
4429
4481
|
this.client = new RestClient2({
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
appId: hasApiUrl ? void 0 : config.appId,
|
|
4433
|
-
extendableSlug: ACME_EXTENDABLE_SLUG,
|
|
4482
|
+
baseApiUrl,
|
|
4483
|
+
endpoints: ACME_API_ENDPOINTS,
|
|
4434
4484
|
getToken: () => tokens.getToken(),
|
|
4435
4485
|
retryDelaysMs: config.retryDelaysMs ?? DEFAULT_RETRY_DELAYS_MS,
|
|
4436
4486
|
logger,
|
|
@@ -4447,7 +4497,7 @@ var AcmeAccessService = class {
|
|
|
4447
4497
|
}
|
|
4448
4498
|
return this.productService;
|
|
4449
4499
|
}
|
|
4450
|
-
/** All activities.
|
|
4500
|
+
/** All activities. @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link AcmeProductService.getAllActivities}. */
|
|
4451
4501
|
getAllActivities() {
|
|
4452
4502
|
return this.getProductService().getAllActivities();
|
|
4453
4503
|
}
|