@peektravel/app-utilities 0.9.4 → 0.9.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 +130 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -1
- package/dist/index.d.ts +38 -1
- package/dist/index.js +130 -59
- package/dist/index.js.map +1 -1
- package/llms.txt +6 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1932,6 +1932,37 @@ declare class AvailabilityService {
|
|
|
1932
1932
|
getAvailabilityTimes(query: AvailabilityTimesQuery): Promise<AvailabilityTime[]>;
|
|
1933
1933
|
}
|
|
1934
1934
|
|
|
1935
|
+
/**
|
|
1936
|
+
* Reads custom questions defined on the account.
|
|
1937
|
+
*
|
|
1938
|
+
* Obtain an instance via {@link PeekAccessService.getCustomQuestionService}.
|
|
1939
|
+
*/
|
|
1940
|
+
declare class CustomQuestionService {
|
|
1941
|
+
private readonly client;
|
|
1942
|
+
constructor(client: GraphQLClient);
|
|
1943
|
+
/**
|
|
1944
|
+
* Returns every custom question defined on the account, across all
|
|
1945
|
+
* activities. Choice-style questions (`SELECT_ONE`, `LOCATION`, …) carry their
|
|
1946
|
+
* selectable {@link CustomQuestion.options}; free-text/checkbox questions
|
|
1947
|
+
* return an empty option list.
|
|
1948
|
+
*
|
|
1949
|
+
* These are account-wide question **definitions**, not customer answers — no
|
|
1950
|
+
* PII is involved, so the result is unaffected by `fullCustomerAccess`. Unlike
|
|
1951
|
+
* {@link ProductService.getCustomQuestions}, the catalog carries no
|
|
1952
|
+
* per-activity configuration, so {@link CustomQuestion.order} is `0` and
|
|
1953
|
+
* {@link CustomQuestion.isRequired} is `false` on every entry.
|
|
1954
|
+
*
|
|
1955
|
+
* @returns Every custom question on the account, or an empty list when none
|
|
1956
|
+
* are defined.
|
|
1957
|
+
*
|
|
1958
|
+
* @example
|
|
1959
|
+
* ```ts
|
|
1960
|
+
* const questions = await peek.getCustomQuestionService().getAll();
|
|
1961
|
+
* ```
|
|
1962
|
+
*/
|
|
1963
|
+
getAll(): Promise<CustomQuestion[]>;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1935
1966
|
/**
|
|
1936
1967
|
* The clean data model for a Peek Pro daily (dashboard) note.
|
|
1937
1968
|
*/
|
|
@@ -2435,6 +2466,7 @@ declare class PeekAccessService {
|
|
|
2435
2466
|
private membershipService?;
|
|
2436
2467
|
private readonly bookingServices;
|
|
2437
2468
|
private reviewService?;
|
|
2469
|
+
private customQuestionService?;
|
|
2438
2470
|
constructor(config: PeekAccessServiceConfig);
|
|
2439
2471
|
/**
|
|
2440
2472
|
* Verifies a Peek auth token issued by the app registry and returns the
|
|
@@ -2527,6 +2559,11 @@ declare class PeekAccessService {
|
|
|
2527
2559
|
* authenticated transport. The instance is created lazily and reused.
|
|
2528
2560
|
*/
|
|
2529
2561
|
getReviewService(): ReviewService;
|
|
2562
|
+
/**
|
|
2563
|
+
* Returns the {@link CustomQuestionService} for this install, bound to the
|
|
2564
|
+
* shared authenticated transport. The instance is created lazily and reused.
|
|
2565
|
+
*/
|
|
2566
|
+
getCustomQuestionService(): CustomQuestionService;
|
|
2530
2567
|
/** All products (activities + add-ons). @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ProductService.getAllProducts}. */
|
|
2531
2568
|
getAllProducts(): Promise<Product[]>;
|
|
2532
2569
|
/** 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}. */
|
|
@@ -3325,4 +3362,4 @@ declare class AcmeApiError extends Error {
|
|
|
3325
3362
|
constructor(statusCode: number, body: unknown, message?: string);
|
|
3326
3363
|
}
|
|
3327
3364
|
|
|
3328
|
-
export { ACTIVITY_PRODUCT_TYPE, ADD_ON_PRODUCT_TYPE, type AccessOptions, type AccountUser, AccountUserService, type AccountUserServiceOptions, AcmeAccessService, type AcmeAccessServiceConfig, type AcmeActivity, type AcmeActivityTicket, AcmeApiError, AcmeProductService, type Activity, type ActivityOverrides, type ActivityTicket, type AddAddonInput, AdminAccountRequiredError, type Agent, type AssignGuideResult, type AssignedActivity, type AssignedResource, type Availability, AvailabilityService, type AvailabilityTime, type AvailabilityTimesQuery, type Booking, type BookingAddon, type BookingAddonMoney, type BookingAddonOption, type BookingAddons, type BookingAddonsMutationResult, type BookingPaymentsOnFile, type BookingReadOptions, type BookingSearchBy, BookingService, type BookingServiceOptions, type BookingTimeRangeSearch, type CancelBookingResult, type Channel, type ClearOverridesInput, CngAccessService, type CngAccessServiceConfig, CngApiError, CngPermissionError, CngProductService, type CreateBookingGuest, type CreateBookingInput, type CreateBookingTicket, type CreateEngineInput, type CreatePromoCodeInput, type CreatedBooking, type CreatedPricingEngine, type CreatedPromoCode, type CustomQuestion, type CustomQuestionAnswer, type CustomQuestionAnswerInput, type CustomQuestionOption, type DailyNote, DailyNoteService, type Duration, type Guest, type GuestMetadata, type Guide, type GuideAssignment, INSTALL_STATUSES, type InstallAccessConfig, type InstallAccessService, type InstallAccessTarget, type InstallStatus, type InstallWebhook, type InstallWebhookAccount, type InstallWebhookClaims, type InvoiceLinkResult, type Logger, type MakePaymentInput, type MakePaymentResult, type Membership, type MembershipPurchaseInput, MembershipService, type MetaData, type MetaDataBarcodeType, type MetaDataDurationUnit, type MetaDataValue, type MetaDataVolumeUnit, type MetaDataWeightUnit, type NoteMode, type Payment, type PaymentSource, PeekAccessService, type PeekAccessServiceConfig, type PeekAuthTokenClaims, type PeekAuthTokenUser, PeekGraphQLError, PeekHttpError, type PeekPlatform, PiiAccessDisabledError, type Price, type PricingActivityContext, type PricingEngine, type PricingMoney, type PricingNamedRef, type PricingOverride, type PricingOverrideFilter, PricingService, type Product, type ProductMeetingLocation, type ProductReviewSummary, ProductService, type ProductServiceOptions, type ProductTicket, type PromoCode, type PromoCodeFixedAmount, PromoCodeService, type PromoCodeServiceOptions, type PurchasedMembership, RENTAL_PRODUCT_TYPE, RateLimitError, type RefundInput, type RefundResult, ResellerService, type ResolvedOverride, type ResolvedPricingOverride, type ResolvedResourceOption, type Resource, type ResourceOptionOverride, type ResourceOptionQuantity, type ResourcePool, type ResourcePoolAccountUser, type ResourcePoolAssignment, type ResourcePoolMode, ResourcePoolService, type Review, ReviewService, type SetMetaDataAttachmentInput, type SetMetaDataGuestInput, type SetMetaDataResult, type Ticket, type Timeslot, type TimeslotFilter, TimeslotService, type UpdateEngineInput, type UpdateTimeslotResult, type UpsertOverridesInput, type UpsertOverridesResult, type Waiver, createAccessServiceForInstall, noopLogger, parseBookingWebhook, parseInstallWebhook, parseWaiverWebhook, verifyInstallWebhook };
|
|
3365
|
+
export { ACTIVITY_PRODUCT_TYPE, ADD_ON_PRODUCT_TYPE, type AccessOptions, type AccountUser, AccountUserService, type AccountUserServiceOptions, AcmeAccessService, type AcmeAccessServiceConfig, type AcmeActivity, type AcmeActivityTicket, AcmeApiError, AcmeProductService, type Activity, type ActivityOverrides, type ActivityTicket, type AddAddonInput, AdminAccountRequiredError, type Agent, type AssignGuideResult, type AssignedActivity, type AssignedResource, type Availability, AvailabilityService, type AvailabilityTime, type AvailabilityTimesQuery, type Booking, type BookingAddon, type BookingAddonMoney, type BookingAddonOption, type BookingAddons, type BookingAddonsMutationResult, type BookingPaymentsOnFile, type BookingReadOptions, type BookingSearchBy, BookingService, type BookingServiceOptions, type BookingTimeRangeSearch, type CancelBookingResult, type Channel, type ClearOverridesInput, CngAccessService, type CngAccessServiceConfig, CngApiError, CngPermissionError, CngProductService, type CreateBookingGuest, type CreateBookingInput, type CreateBookingTicket, type CreateEngineInput, type CreatePromoCodeInput, type CreatedBooking, type CreatedPricingEngine, type CreatedPromoCode, type CustomQuestion, type CustomQuestionAnswer, type CustomQuestionAnswerInput, type CustomQuestionOption, CustomQuestionService, type DailyNote, DailyNoteService, type Duration, type Guest, type GuestMetadata, type Guide, type GuideAssignment, INSTALL_STATUSES, type InstallAccessConfig, type InstallAccessService, type InstallAccessTarget, type InstallStatus, type InstallWebhook, type InstallWebhookAccount, type InstallWebhookClaims, type InvoiceLinkResult, type Logger, type MakePaymentInput, type MakePaymentResult, type Membership, type MembershipPurchaseInput, MembershipService, type MetaData, type MetaDataBarcodeType, type MetaDataDurationUnit, type MetaDataValue, type MetaDataVolumeUnit, type MetaDataWeightUnit, type NoteMode, type Payment, type PaymentSource, PeekAccessService, type PeekAccessServiceConfig, type PeekAuthTokenClaims, type PeekAuthTokenUser, PeekGraphQLError, PeekHttpError, type PeekPlatform, PiiAccessDisabledError, type Price, type PricingActivityContext, type PricingEngine, type PricingMoney, type PricingNamedRef, type PricingOverride, type PricingOverrideFilter, PricingService, type Product, type ProductMeetingLocation, type ProductReviewSummary, ProductService, type ProductServiceOptions, type ProductTicket, type PromoCode, type PromoCodeFixedAmount, PromoCodeService, type PromoCodeServiceOptions, type PurchasedMembership, RENTAL_PRODUCT_TYPE, RateLimitError, type RefundInput, type RefundResult, ResellerService, type ResolvedOverride, type ResolvedPricingOverride, type ResolvedResourceOption, type Resource, type ResourceOptionOverride, type ResourceOptionQuantity, type ResourcePool, type ResourcePoolAccountUser, type ResourcePoolAssignment, type ResourcePoolMode, ResourcePoolService, type Review, ReviewService, type SetMetaDataAttachmentInput, type SetMetaDataGuestInput, type SetMetaDataResult, type Ticket, type Timeslot, type TimeslotFilter, TimeslotService, type UpdateEngineInput, type UpdateTimeslotResult, type UpsertOverridesInput, type UpsertOverridesResult, type Waiver, createAccessServiceForInstall, noopLogger, parseBookingWebhook, parseInstallWebhook, parseWaiverWebhook, verifyInstallWebhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -1932,6 +1932,37 @@ declare class AvailabilityService {
|
|
|
1932
1932
|
getAvailabilityTimes(query: AvailabilityTimesQuery): Promise<AvailabilityTime[]>;
|
|
1933
1933
|
}
|
|
1934
1934
|
|
|
1935
|
+
/**
|
|
1936
|
+
* Reads custom questions defined on the account.
|
|
1937
|
+
*
|
|
1938
|
+
* Obtain an instance via {@link PeekAccessService.getCustomQuestionService}.
|
|
1939
|
+
*/
|
|
1940
|
+
declare class CustomQuestionService {
|
|
1941
|
+
private readonly client;
|
|
1942
|
+
constructor(client: GraphQLClient);
|
|
1943
|
+
/**
|
|
1944
|
+
* Returns every custom question defined on the account, across all
|
|
1945
|
+
* activities. Choice-style questions (`SELECT_ONE`, `LOCATION`, …) carry their
|
|
1946
|
+
* selectable {@link CustomQuestion.options}; free-text/checkbox questions
|
|
1947
|
+
* return an empty option list.
|
|
1948
|
+
*
|
|
1949
|
+
* These are account-wide question **definitions**, not customer answers — no
|
|
1950
|
+
* PII is involved, so the result is unaffected by `fullCustomerAccess`. Unlike
|
|
1951
|
+
* {@link ProductService.getCustomQuestions}, the catalog carries no
|
|
1952
|
+
* per-activity configuration, so {@link CustomQuestion.order} is `0` and
|
|
1953
|
+
* {@link CustomQuestion.isRequired} is `false` on every entry.
|
|
1954
|
+
*
|
|
1955
|
+
* @returns Every custom question on the account, or an empty list when none
|
|
1956
|
+
* are defined.
|
|
1957
|
+
*
|
|
1958
|
+
* @example
|
|
1959
|
+
* ```ts
|
|
1960
|
+
* const questions = await peek.getCustomQuestionService().getAll();
|
|
1961
|
+
* ```
|
|
1962
|
+
*/
|
|
1963
|
+
getAll(): Promise<CustomQuestion[]>;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1935
1966
|
/**
|
|
1936
1967
|
* The clean data model for a Peek Pro daily (dashboard) note.
|
|
1937
1968
|
*/
|
|
@@ -2435,6 +2466,7 @@ declare class PeekAccessService {
|
|
|
2435
2466
|
private membershipService?;
|
|
2436
2467
|
private readonly bookingServices;
|
|
2437
2468
|
private reviewService?;
|
|
2469
|
+
private customQuestionService?;
|
|
2438
2470
|
constructor(config: PeekAccessServiceConfig);
|
|
2439
2471
|
/**
|
|
2440
2472
|
* Verifies a Peek auth token issued by the app registry and returns the
|
|
@@ -2527,6 +2559,11 @@ declare class PeekAccessService {
|
|
|
2527
2559
|
* authenticated transport. The instance is created lazily and reused.
|
|
2528
2560
|
*/
|
|
2529
2561
|
getReviewService(): ReviewService;
|
|
2562
|
+
/**
|
|
2563
|
+
* Returns the {@link CustomQuestionService} for this install, bound to the
|
|
2564
|
+
* shared authenticated transport. The instance is created lazily and reused.
|
|
2565
|
+
*/
|
|
2566
|
+
getCustomQuestionService(): CustomQuestionService;
|
|
2530
2567
|
/** All products (activities + add-ons). @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ProductService.getAllProducts}. */
|
|
2531
2568
|
getAllProducts(): Promise<Product[]>;
|
|
2532
2569
|
/** 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}. */
|
|
@@ -3325,4 +3362,4 @@ declare class AcmeApiError extends Error {
|
|
|
3325
3362
|
constructor(statusCode: number, body: unknown, message?: string);
|
|
3326
3363
|
}
|
|
3327
3364
|
|
|
3328
|
-
export { ACTIVITY_PRODUCT_TYPE, ADD_ON_PRODUCT_TYPE, type AccessOptions, type AccountUser, AccountUserService, type AccountUserServiceOptions, AcmeAccessService, type AcmeAccessServiceConfig, type AcmeActivity, type AcmeActivityTicket, AcmeApiError, AcmeProductService, type Activity, type ActivityOverrides, type ActivityTicket, type AddAddonInput, AdminAccountRequiredError, type Agent, type AssignGuideResult, type AssignedActivity, type AssignedResource, type Availability, AvailabilityService, type AvailabilityTime, type AvailabilityTimesQuery, type Booking, type BookingAddon, type BookingAddonMoney, type BookingAddonOption, type BookingAddons, type BookingAddonsMutationResult, type BookingPaymentsOnFile, type BookingReadOptions, type BookingSearchBy, BookingService, type BookingServiceOptions, type BookingTimeRangeSearch, type CancelBookingResult, type Channel, type ClearOverridesInput, CngAccessService, type CngAccessServiceConfig, CngApiError, CngPermissionError, CngProductService, type CreateBookingGuest, type CreateBookingInput, type CreateBookingTicket, type CreateEngineInput, type CreatePromoCodeInput, type CreatedBooking, type CreatedPricingEngine, type CreatedPromoCode, type CustomQuestion, type CustomQuestionAnswer, type CustomQuestionAnswerInput, type CustomQuestionOption, type DailyNote, DailyNoteService, type Duration, type Guest, type GuestMetadata, type Guide, type GuideAssignment, INSTALL_STATUSES, type InstallAccessConfig, type InstallAccessService, type InstallAccessTarget, type InstallStatus, type InstallWebhook, type InstallWebhookAccount, type InstallWebhookClaims, type InvoiceLinkResult, type Logger, type MakePaymentInput, type MakePaymentResult, type Membership, type MembershipPurchaseInput, MembershipService, type MetaData, type MetaDataBarcodeType, type MetaDataDurationUnit, type MetaDataValue, type MetaDataVolumeUnit, type MetaDataWeightUnit, type NoteMode, type Payment, type PaymentSource, PeekAccessService, type PeekAccessServiceConfig, type PeekAuthTokenClaims, type PeekAuthTokenUser, PeekGraphQLError, PeekHttpError, type PeekPlatform, PiiAccessDisabledError, type Price, type PricingActivityContext, type PricingEngine, type PricingMoney, type PricingNamedRef, type PricingOverride, type PricingOverrideFilter, PricingService, type Product, type ProductMeetingLocation, type ProductReviewSummary, ProductService, type ProductServiceOptions, type ProductTicket, type PromoCode, type PromoCodeFixedAmount, PromoCodeService, type PromoCodeServiceOptions, type PurchasedMembership, RENTAL_PRODUCT_TYPE, RateLimitError, type RefundInput, type RefundResult, ResellerService, type ResolvedOverride, type ResolvedPricingOverride, type ResolvedResourceOption, type Resource, type ResourceOptionOverride, type ResourceOptionQuantity, type ResourcePool, type ResourcePoolAccountUser, type ResourcePoolAssignment, type ResourcePoolMode, ResourcePoolService, type Review, ReviewService, type SetMetaDataAttachmentInput, type SetMetaDataGuestInput, type SetMetaDataResult, type Ticket, type Timeslot, type TimeslotFilter, TimeslotService, type UpdateEngineInput, type UpdateTimeslotResult, type UpsertOverridesInput, type UpsertOverridesResult, type Waiver, createAccessServiceForInstall, noopLogger, parseBookingWebhook, parseInstallWebhook, parseWaiverWebhook, verifyInstallWebhook };
|
|
3365
|
+
export { ACTIVITY_PRODUCT_TYPE, ADD_ON_PRODUCT_TYPE, type AccessOptions, type AccountUser, AccountUserService, type AccountUserServiceOptions, AcmeAccessService, type AcmeAccessServiceConfig, type AcmeActivity, type AcmeActivityTicket, AcmeApiError, AcmeProductService, type Activity, type ActivityOverrides, type ActivityTicket, type AddAddonInput, AdminAccountRequiredError, type Agent, type AssignGuideResult, type AssignedActivity, type AssignedResource, type Availability, AvailabilityService, type AvailabilityTime, type AvailabilityTimesQuery, type Booking, type BookingAddon, type BookingAddonMoney, type BookingAddonOption, type BookingAddons, type BookingAddonsMutationResult, type BookingPaymentsOnFile, type BookingReadOptions, type BookingSearchBy, BookingService, type BookingServiceOptions, type BookingTimeRangeSearch, type CancelBookingResult, type Channel, type ClearOverridesInput, CngAccessService, type CngAccessServiceConfig, CngApiError, CngPermissionError, CngProductService, type CreateBookingGuest, type CreateBookingInput, type CreateBookingTicket, type CreateEngineInput, type CreatePromoCodeInput, type CreatedBooking, type CreatedPricingEngine, type CreatedPromoCode, type CustomQuestion, type CustomQuestionAnswer, type CustomQuestionAnswerInput, type CustomQuestionOption, CustomQuestionService, type DailyNote, DailyNoteService, type Duration, type Guest, type GuestMetadata, type Guide, type GuideAssignment, INSTALL_STATUSES, type InstallAccessConfig, type InstallAccessService, type InstallAccessTarget, type InstallStatus, type InstallWebhook, type InstallWebhookAccount, type InstallWebhookClaims, type InvoiceLinkResult, type Logger, type MakePaymentInput, type MakePaymentResult, type Membership, type MembershipPurchaseInput, MembershipService, type MetaData, type MetaDataBarcodeType, type MetaDataDurationUnit, type MetaDataValue, type MetaDataVolumeUnit, type MetaDataWeightUnit, type NoteMode, type Payment, type PaymentSource, PeekAccessService, type PeekAccessServiceConfig, type PeekAuthTokenClaims, type PeekAuthTokenUser, PeekGraphQLError, PeekHttpError, type PeekPlatform, PiiAccessDisabledError, type Price, type PricingActivityContext, type PricingEngine, type PricingMoney, type PricingNamedRef, type PricingOverride, type PricingOverrideFilter, PricingService, type Product, type ProductMeetingLocation, type ProductReviewSummary, ProductService, type ProductServiceOptions, type ProductTicket, type PromoCode, type PromoCodeFixedAmount, PromoCodeService, type PromoCodeServiceOptions, type PurchasedMembership, RENTAL_PRODUCT_TYPE, RateLimitError, type RefundInput, type RefundResult, ResellerService, type ResolvedOverride, type ResolvedPricingOverride, type ResolvedResourceOption, type Resource, type ResourceOptionOverride, type ResourceOptionQuantity, type ResourcePool, type ResourcePoolAccountUser, type ResourcePoolAssignment, type ResourcePoolMode, ResourcePoolService, type Review, ReviewService, type SetMetaDataAttachmentInput, type SetMetaDataGuestInput, type SetMetaDataResult, type Ticket, type Timeslot, type TimeslotFilter, TimeslotService, type UpdateEngineInput, type UpdateTimeslotResult, type UpsertOverridesInput, type UpsertOverridesResult, type Waiver, createAccessServiceForInstall, noopLogger, parseBookingWebhook, parseInstallWebhook, parseWaiverWebhook, verifyInstallWebhook };
|
package/dist/index.js
CHANGED
|
@@ -2474,6 +2474,123 @@ function buildCancellation(items, addonOptionId, quantity) {
|
|
|
2474
2474
|
return { bookingQuotes, canceledCount };
|
|
2475
2475
|
}
|
|
2476
2476
|
|
|
2477
|
+
// src/internal/peek/custom-questions/custom-question-converter.ts
|
|
2478
|
+
function fromQuestionConfigurations(configs) {
|
|
2479
|
+
return configs.map(
|
|
2480
|
+
(config) => fromQuestionNode(config.question, config.order, config.isRequired)
|
|
2481
|
+
);
|
|
2482
|
+
}
|
|
2483
|
+
function fromQuestionNodes(questions) {
|
|
2484
|
+
return questions.map((question) => fromQuestionNode(question));
|
|
2485
|
+
}
|
|
2486
|
+
function fromQuestionNode(question, order, isRequired) {
|
|
2487
|
+
return {
|
|
2488
|
+
id: question.id,
|
|
2489
|
+
order: order ?? 0,
|
|
2490
|
+
isRequired: isRequired ?? false,
|
|
2491
|
+
questionText: question.text,
|
|
2492
|
+
hintText: question.hint ?? null,
|
|
2493
|
+
questionType: question.questionType,
|
|
2494
|
+
internalLabel: question.internalLabel ?? null,
|
|
2495
|
+
perGuest: question.perGuest ?? false,
|
|
2496
|
+
defaultValue: question.answerDefaultValue ?? null,
|
|
2497
|
+
options: (question.options ?? []).map(fromQuestionOption)
|
|
2498
|
+
};
|
|
2499
|
+
}
|
|
2500
|
+
function fromQuestionOption(option) {
|
|
2501
|
+
return {
|
|
2502
|
+
id: option.id,
|
|
2503
|
+
order: option.order,
|
|
2504
|
+
value: option.text
|
|
2505
|
+
};
|
|
2506
|
+
}
|
|
2507
|
+
|
|
2508
|
+
// src/internal/peek/custom-questions/custom-question-queries.ts
|
|
2509
|
+
var ALL_CUSTOM_QUESTIONS_QUERY = `
|
|
2510
|
+
query Sales {
|
|
2511
|
+
questions {
|
|
2512
|
+
id
|
|
2513
|
+
questionType
|
|
2514
|
+
text
|
|
2515
|
+
answerDefaultValue
|
|
2516
|
+
hint
|
|
2517
|
+
internalLabel
|
|
2518
|
+
perGuest
|
|
2519
|
+
... on ChoiceQuestion {
|
|
2520
|
+
options {
|
|
2521
|
+
id
|
|
2522
|
+
text
|
|
2523
|
+
order
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
`;
|
|
2529
|
+
var CUSTOM_QUESTIONS_QUERY = `
|
|
2530
|
+
query Sales($id: ID!) {
|
|
2531
|
+
activity(id: $id) {
|
|
2532
|
+
id
|
|
2533
|
+
name
|
|
2534
|
+
questionActivityConfigurations {
|
|
2535
|
+
isRequired
|
|
2536
|
+
order
|
|
2537
|
+
question {
|
|
2538
|
+
id
|
|
2539
|
+
questionType
|
|
2540
|
+
text
|
|
2541
|
+
answerDefaultValue
|
|
2542
|
+
hint
|
|
2543
|
+
internalLabel
|
|
2544
|
+
perGuest
|
|
2545
|
+
... on ChoiceQuestion {
|
|
2546
|
+
options {
|
|
2547
|
+
id
|
|
2548
|
+
text
|
|
2549
|
+
order
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2556
|
+
`;
|
|
2557
|
+
|
|
2558
|
+
// src/internal/peek/custom-questions/custom-question-service.ts
|
|
2559
|
+
var CustomQuestionService = class {
|
|
2560
|
+
constructor(client) {
|
|
2561
|
+
this.client = client;
|
|
2562
|
+
}
|
|
2563
|
+
client;
|
|
2564
|
+
/**
|
|
2565
|
+
* Returns every custom question defined on the account, across all
|
|
2566
|
+
* activities. Choice-style questions (`SELECT_ONE`, `LOCATION`, …) carry their
|
|
2567
|
+
* selectable {@link CustomQuestion.options}; free-text/checkbox questions
|
|
2568
|
+
* return an empty option list.
|
|
2569
|
+
*
|
|
2570
|
+
* These are account-wide question **definitions**, not customer answers — no
|
|
2571
|
+
* PII is involved, so the result is unaffected by `fullCustomerAccess`. Unlike
|
|
2572
|
+
* {@link ProductService.getCustomQuestions}, the catalog carries no
|
|
2573
|
+
* per-activity configuration, so {@link CustomQuestion.order} is `0` and
|
|
2574
|
+
* {@link CustomQuestion.isRequired} is `false` on every entry.
|
|
2575
|
+
*
|
|
2576
|
+
* @returns Every custom question on the account, or an empty list when none
|
|
2577
|
+
* are defined.
|
|
2578
|
+
*
|
|
2579
|
+
* @example
|
|
2580
|
+
* ```ts
|
|
2581
|
+
* const questions = await peek.getCustomQuestionService().getAll();
|
|
2582
|
+
* ```
|
|
2583
|
+
*/
|
|
2584
|
+
async getAll() {
|
|
2585
|
+
const body = await this.client.request(
|
|
2586
|
+
SALES_ENDPOINT,
|
|
2587
|
+
ALL_CUSTOM_QUESTIONS_QUERY,
|
|
2588
|
+
{}
|
|
2589
|
+
);
|
|
2590
|
+
return fromQuestionNodes(body.data?.questions ?? []);
|
|
2591
|
+
}
|
|
2592
|
+
};
|
|
2593
|
+
|
|
2477
2594
|
// src/internal/peek/daily-notes/daily-note-converter.ts
|
|
2478
2595
|
function toDailyNote(response) {
|
|
2479
2596
|
const union = response?.dailyNote;
|
|
@@ -2652,7 +2769,7 @@ async function requestWithRetry(http, url, init, label, onResponse) {
|
|
|
2652
2769
|
// src/internal/sdk-headers.ts
|
|
2653
2770
|
var SDK_HEADER_NAME = "x-peek-sdk";
|
|
2654
2771
|
var SDK_PLATFORM = "js";
|
|
2655
|
-
var SDK_VERSION = "0.9.
|
|
2772
|
+
var SDK_VERSION = "0.9.5";
|
|
2656
2773
|
var SDK_HEADER_VALUE = `${SDK_PLATFORM}-${SDK_VERSION}`;
|
|
2657
2774
|
|
|
2658
2775
|
// src/internal/peek/graphql-client.ts
|
|
@@ -3678,33 +3795,6 @@ function fromItemOptionNodes(nodes) {
|
|
|
3678
3795
|
return Array.from(grouped.values());
|
|
3679
3796
|
}
|
|
3680
3797
|
|
|
3681
|
-
// src/internal/peek/products/custom-question-converter.ts
|
|
3682
|
-
function fromQuestionConfigurations(configs) {
|
|
3683
|
-
return configs.map(fromQuestionConfiguration);
|
|
3684
|
-
}
|
|
3685
|
-
function fromQuestionConfiguration(config) {
|
|
3686
|
-
const question = config.question;
|
|
3687
|
-
return {
|
|
3688
|
-
id: question.id,
|
|
3689
|
-
order: config.order ?? 0,
|
|
3690
|
-
isRequired: config.isRequired ?? false,
|
|
3691
|
-
questionText: question.text,
|
|
3692
|
-
hintText: question.hint ?? null,
|
|
3693
|
-
questionType: question.questionType,
|
|
3694
|
-
internalLabel: question.internalLabel ?? null,
|
|
3695
|
-
perGuest: question.perGuest ?? false,
|
|
3696
|
-
defaultValue: question.answerDefaultValue ?? null,
|
|
3697
|
-
options: (question.options ?? []).map(fromQuestionOption)
|
|
3698
|
-
};
|
|
3699
|
-
}
|
|
3700
|
-
function fromQuestionOption(option) {
|
|
3701
|
-
return {
|
|
3702
|
-
id: option.id,
|
|
3703
|
-
order: option.order,
|
|
3704
|
-
value: option.text
|
|
3705
|
-
};
|
|
3706
|
-
}
|
|
3707
|
-
|
|
3708
3798
|
// src/internal/peek/products/product-queries.ts
|
|
3709
3799
|
var PRODUCTS_QUERY = `
|
|
3710
3800
|
query Sales {
|
|
@@ -3763,36 +3853,6 @@ var ITEM_OPTIONS_QUERY = `
|
|
|
3763
3853
|
}
|
|
3764
3854
|
`;
|
|
3765
3855
|
|
|
3766
|
-
// src/internal/peek/products/custom-question-queries.ts
|
|
3767
|
-
var CUSTOM_QUESTIONS_QUERY = `
|
|
3768
|
-
query Sales($id: ID!) {
|
|
3769
|
-
activity(id: $id) {
|
|
3770
|
-
id
|
|
3771
|
-
name
|
|
3772
|
-
questionActivityConfigurations {
|
|
3773
|
-
isRequired
|
|
3774
|
-
order
|
|
3775
|
-
question {
|
|
3776
|
-
id
|
|
3777
|
-
questionType
|
|
3778
|
-
text
|
|
3779
|
-
answerDefaultValue
|
|
3780
|
-
hint
|
|
3781
|
-
internalLabel
|
|
3782
|
-
perGuest
|
|
3783
|
-
... on ChoiceQuestion {
|
|
3784
|
-
options {
|
|
3785
|
-
id
|
|
3786
|
-
text
|
|
3787
|
-
order
|
|
3788
|
-
}
|
|
3789
|
-
}
|
|
3790
|
-
}
|
|
3791
|
-
}
|
|
3792
|
-
}
|
|
3793
|
-
}
|
|
3794
|
-
`;
|
|
3795
|
-
|
|
3796
3856
|
// src/internal/peek/products/product-service.ts
|
|
3797
3857
|
var ERROR_PRODUCT_ID_REQUIRED2 = "A non-empty product id is required.";
|
|
3798
3858
|
var DEFAULT_ITEM_OPTIONS_PAGE_SIZE = 50;
|
|
@@ -4371,6 +4431,7 @@ var PeekAccessService = class {
|
|
|
4371
4431
|
membershipService;
|
|
4372
4432
|
bookingServices = /* @__PURE__ */ new Map();
|
|
4373
4433
|
reviewService;
|
|
4434
|
+
customQuestionService;
|
|
4374
4435
|
constructor(config) {
|
|
4375
4436
|
const hasApiUrl = !!config.apiUrl;
|
|
4376
4437
|
const isV2 = config.mode === "v2";
|
|
@@ -4571,6 +4632,16 @@ var PeekAccessService = class {
|
|
|
4571
4632
|
}
|
|
4572
4633
|
return this.reviewService;
|
|
4573
4634
|
}
|
|
4635
|
+
/**
|
|
4636
|
+
* Returns the {@link CustomQuestionService} for this install, bound to the
|
|
4637
|
+
* shared authenticated transport. The instance is created lazily and reused.
|
|
4638
|
+
*/
|
|
4639
|
+
getCustomQuestionService() {
|
|
4640
|
+
if (!this.customQuestionService) {
|
|
4641
|
+
this.customQuestionService = new CustomQuestionService(this.client);
|
|
4642
|
+
}
|
|
4643
|
+
return this.customQuestionService;
|
|
4644
|
+
}
|
|
4574
4645
|
// ─── Product short-forms ─────────────────────────────────────────────────
|
|
4575
4646
|
/** All products (activities + add-ons). @deprecated The access service exposes only its resource-service accessors; call the service directly instead. See {@link ProductService.getAllProducts}. */
|
|
4576
4647
|
getAllProducts() {
|
|
@@ -5207,6 +5278,6 @@ function verifyInstallWebhook(token, secret) {
|
|
|
5207
5278
|
};
|
|
5208
5279
|
}
|
|
5209
5280
|
|
|
5210
|
-
export { ACTIVITY_PRODUCT_TYPE, ADD_ON_PRODUCT_TYPE, AccountUserService, AcmeAccessService, AcmeApiError, AcmeProductService, AdminAccountRequiredError, AvailabilityService, BookingService, CngAccessService, CngApiError, CngPermissionError, CngProductService, DailyNoteService, INSTALL_STATUSES, MembershipService, PeekAccessService, PeekGraphQLError, PeekHttpError, PiiAccessDisabledError, PricingService, ProductService, PromoCodeService, RENTAL_PRODUCT_TYPE, RateLimitError, ResellerService, ResourcePoolService, ReviewService, TimeslotService, createAccessServiceForInstall, noopLogger, parseBookingWebhook, parseInstallWebhook, parseWaiverWebhook, verifyInstallWebhook };
|
|
5281
|
+
export { ACTIVITY_PRODUCT_TYPE, ADD_ON_PRODUCT_TYPE, AccountUserService, AcmeAccessService, AcmeApiError, AcmeProductService, AdminAccountRequiredError, AvailabilityService, BookingService, CngAccessService, CngApiError, CngPermissionError, CngProductService, CustomQuestionService, DailyNoteService, INSTALL_STATUSES, MembershipService, PeekAccessService, PeekGraphQLError, PeekHttpError, PiiAccessDisabledError, PricingService, ProductService, PromoCodeService, RENTAL_PRODUCT_TYPE, RateLimitError, ResellerService, ResourcePoolService, ReviewService, TimeslotService, createAccessServiceForInstall, noopLogger, parseBookingWebhook, parseInstallWebhook, parseWaiverWebhook, verifyInstallWebhook };
|
|
5211
5282
|
//# sourceMappingURL=index.js.map
|
|
5212
5283
|
//# sourceMappingURL=index.js.map
|