@peektravel/app-utilities 0.2.2 → 0.2.4

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.d.ts CHANGED
@@ -51,112 +51,6 @@ declare class GraphQLClient {
51
51
  private buildHeaders;
52
52
  }
53
53
 
54
- /**
55
- * The clean data model for a Peek Pro account user (staff member / guide).
56
- */
57
- /**
58
- * An account user on a Peek Pro account.
59
- *
60
- * Only **active** users are returned by the account-user service — inactive
61
- * users are filtered out — so there is no status field on this model.
62
- */
63
- interface AccountUser {
64
- /** Unique identifier of the account user. */
65
- id: string;
66
- /** Full name. */
67
- name: string;
68
- /** Email address. */
69
- email: string;
70
- /** Phone number. */
71
- phone: string;
72
- /** The activities this user is assigned to. */
73
- assignedActivities: AssignedActivity[];
74
- }
75
- /** An activity an {@link AccountUser} is assigned to. */
76
- interface AssignedActivity {
77
- /** Activity (product) id. */
78
- id: string;
79
- /** Activity name. */
80
- name: string;
81
- }
82
-
83
- /** Tuning options for an {@link AccountUserService}. */
84
- interface AccountUserServiceOptions {
85
- /** Page size for cursor pagination. Default: 50. */
86
- pageSize?: number;
87
- }
88
- declare class AccountUserService {
89
- private readonly client;
90
- private readonly pageSize;
91
- constructor(client: GraphQLClient, options?: AccountUserServiceOptions);
92
- /**
93
- * Returns all active account users, walking the cursor pagination to the end.
94
- * Inactive users are omitted.
95
- */
96
- getAll(): Promise<AccountUser[]>;
97
- /**
98
- * Returns a single active account user by id, or `null` when no active user
99
- * matches.
100
- */
101
- getById(userId: string): Promise<AccountUser | null>;
102
- }
103
-
104
- /**
105
- * The clean data model for Peek Pro activity availability times.
106
- */
107
- /** A single bookable availability time slot for an activity. */
108
- interface AvailabilityTime {
109
- /** Unique identifier. */
110
- id: string;
111
- /** Time label. */
112
- time: string;
113
- /** Slot start. */
114
- from: string;
115
- /** Slot end. */
116
- end: string;
117
- /** Slot duration. */
118
- duration: Duration;
119
- /** Availability status. */
120
- status: string;
121
- /** Per-resource-option availability. */
122
- availability: Availability[];
123
- }
124
- /** Duration of an {@link AvailabilityTime} slot. */
125
- interface Duration {
126
- name: string;
127
- length: {
128
- amount: number;
129
- unit: string;
130
- };
131
- }
132
- /** Availability for a specific resource option within a slot. */
133
- interface Availability {
134
- qty: number;
135
- taken: number;
136
- resourceOptionId: string;
137
- }
138
- /** A requested resource-option quantity used when querying availability. */
139
- interface ResourceOptionQuantity {
140
- resourceOptionId: string;
141
- quantity: number;
142
- }
143
- /** Query parameters for fetching availability times. */
144
- interface AvailabilityTimesQuery {
145
- /** Activity (product) id. */
146
- activityId: string;
147
- /** Date (YYYY-MM-DD). */
148
- date: string;
149
- /** The resource options and quantities to check availability for. */
150
- resourceOptionQuantities: ResourceOptionQuantity[];
151
- }
152
-
153
- declare class AvailabilityService {
154
- private readonly client;
155
- constructor(client: GraphQLClient);
156
- /** Returns the availability times for an activity/date and requested quantities. */
157
- getAvailabilityTimes(query: AvailabilityTimesQuery): Promise<AvailabilityTime[]>;
158
- }
159
-
160
54
  /**
161
55
  * The clean, transport-agnostic data model for a Peek Pro product.
162
56
  *
@@ -215,6 +109,10 @@ interface ProductTicket {
215
109
  /** Human-readable name of the ticket / option. */
216
110
  name: string;
217
111
  }
112
+ /** {@link Product.type} for standard bookable activities. */
113
+ declare const ACTIVITY_PRODUCT_TYPE = "ACTIVITY";
114
+ /** {@link Product.type} for rental products. */
115
+ declare const RENTAL_PRODUCT_TYPE = "RENTAL";
218
116
  /**
219
117
  * The {@link Product.type} value assigned to add-on products.
220
118
  *
@@ -247,6 +145,12 @@ declare class ProductService {
247
145
  * ```
248
146
  */
249
147
  getAllProducts(): Promise<Product[]>;
148
+ /** Returns products with type {@link ACTIVITY_PRODUCT_TYPE}. */
149
+ getAllActivities(): Promise<Product[]>;
150
+ /** Returns products with type {@link RENTAL_PRODUCT_TYPE}. */
151
+ getAllRentals(): Promise<Product[]>;
152
+ /** Returns only add-on products. */
153
+ getAllAddons(): Promise<Product[]>;
250
154
  private fetchActivities;
251
155
  private fetchAllItemOptionNodes;
252
156
  }
@@ -756,24 +660,6 @@ declare class BookingService {
756
660
  private fetchPaginated;
757
661
  }
758
662
 
759
- /**
760
- * The clean data model for a Peek Pro daily (dashboard) note.
761
- */
762
- /** The daily note shown on the Peek Pro dashboard. */
763
- interface DailyNote {
764
- /** The note text. */
765
- note: string;
766
- }
767
-
768
- declare class DailyNoteService {
769
- private readonly client;
770
- constructor(client: GraphQLClient);
771
- /** Returns today's daily note, or null when none is set. */
772
- getToday(): Promise<DailyNote | null>;
773
- /** Upserts the daily note and returns the saved note, or null. */
774
- update(note: string): Promise<DailyNote | null>;
775
- }
776
-
777
663
  /**
778
664
  * The clean data model for Peek Pro memberships.
779
665
  */
@@ -830,96 +716,342 @@ interface PurchasedMembership {
830
716
  balanceFormatted: string;
831
717
  }
832
718
 
833
- declare class MembershipService {
834
- private readonly client;
835
- constructor(client: GraphQLClient);
836
- /** Returns all membership variants, flattened into {@link Membership} records. */
837
- getAll(): Promise<Membership[]>;
838
- /**
839
- * Purchases a membership via the two-step quote → order flow. Throws on
840
- * invalid input or when Peek returns errors.
841
- */
842
- purchase(input: MembershipPurchaseInput): Promise<PurchasedMembership>;
843
- }
844
-
845
719
  /**
846
- * The clean data model for Peek Pro reseller channels and their agents.
720
+ * The clean data model for Peek Pro activity availability times.
847
721
  */
848
- /** A reseller channel on a Peek Pro account. */
849
- interface Channel {
722
+ /** A single bookable availability time slot for an activity. */
723
+ interface AvailabilityTime {
850
724
  /** Unique identifier. */
851
725
  id: string;
852
- /** Channel name. */
853
- name: string;
854
- /** Free-text notes, or null. */
855
- notes: string | null;
856
- /** Pricing model reported by Peek. */
857
- pricingModel: string;
858
- /** Channel state (e.g. active/inactive). */
859
- state: string;
860
- /** Channel type. */
861
- type: string;
862
- /** Agents belonging to this channel. */
863
- agents: Agent[];
726
+ /** Time label. */
727
+ time: string;
728
+ /** Slot start. */
729
+ from: string;
730
+ /** Slot end. */
731
+ end: string;
732
+ /** Slot duration. */
733
+ duration: Duration;
734
+ /** Availability status. */
735
+ status: string;
736
+ /** Per-resource-option availability. */
737
+ availability: Availability[];
864
738
  }
865
- /** An agent (contact) belonging to a {@link Channel}. */
866
- interface Agent {
867
- /** Email address, or null. */
868
- email: string | null;
869
- /** Agent name. */
739
+ /** Duration of an {@link AvailabilityTime} slot. */
740
+ interface Duration {
870
741
  name: string;
871
- /** Internal notes, or null. */
872
- internalNotes: string | null;
873
- /** Phone number, or null. */
874
- phone: string | null;
742
+ length: {
743
+ amount: number;
744
+ unit: string;
745
+ };
875
746
  }
876
-
877
- declare class ResellerService {
878
- private readonly client;
879
- constructor(client: GraphQLClient);
880
- /**
881
- * Returns all reseller channels, each with up to `agentsPerChannel` agents
882
- * (default 10).
883
- */
884
- getAllChannels(agentsPerChannel?: number): Promise<Channel[]>;
747
+ /** Availability for a specific resource option within a slot. */
748
+ interface Availability {
749
+ qty: number;
750
+ taken: number;
751
+ resourceOptionId: string;
752
+ }
753
+ /** A requested resource-option quantity used when querying availability. */
754
+ interface ResourceOptionQuantity {
755
+ resourceOptionId: string;
756
+ quantity: number;
757
+ }
758
+ /** Query parameters for fetching availability times. */
759
+ interface AvailabilityTimesQuery {
760
+ /** Activity (product) id. */
761
+ activityId: string;
762
+ /** Date (YYYY-MM-DD). */
763
+ date: string;
764
+ /** The resource options and quantities to check availability for. */
765
+ resourceOptionQuantities: ResourceOptionQuantity[];
885
766
  }
886
767
 
887
768
  /**
888
- * The clean data model for a Peek Pro resource pool (e.g. guides, equipment).
769
+ * The clean data model for Peek Pro promo codes.
889
770
  */
890
- /** Filter mode for which resource pools to return. */
891
- type ResourcePoolMode = "ACTIVITY" | "ALL";
892
- /** A resource pool on a Peek Pro account. */
893
- interface ResourcePool {
771
+ /** A promo code on a Peek Pro account. */
772
+ interface PromoCode {
894
773
  /** Unique identifier. */
895
774
  id: string;
896
775
  /** Display name. */
897
776
  name: string;
898
- /** Image URL, or null. */
899
- imageUrl: string | null;
900
- /** Allocation mode reported by Peek. */
901
- mode: string;
902
- /** Display color as a hex string, or null. */
903
- colorHex: string | null;
904
- /** Configured quantity, or null when not set. */
905
- quantity: number | null;
906
- /** Category (e.g. `"guide"`). */
907
- category: string;
908
- /** Capacity, or null when not set. */
909
- capacity: number | null;
910
- /** How the resource is tracked, or null. */
911
- resourceTrackingMode: string | null;
912
- /** The account user backing this pool (e.g. for guides), or null. */
913
- accountUser: ResourcePoolAccountUser | null;
777
+ /** Percentage discount (0–100), or null for a fixed-amount code. */
778
+ percentAmount: number | null;
779
+ /** Whether the discount applies per ticket. */
780
+ perTicketDiscount: boolean;
781
+ /** The code guests redeem. */
782
+ redemptionCode: string;
783
+ /** Fixed-amount discount, or null for a percentage code. */
784
+ fixedAmount: PromoCodeFixedAmount | null;
914
785
  }
915
- /** Minimal account-user reference attached to a {@link ResourcePool}. */
916
- interface ResourcePoolAccountUser {
917
- id: string;
918
- name: string;
786
+ /** A fixed monetary discount on a {@link PromoCode}. */
787
+ interface PromoCodeFixedAmount {
788
+ /** Amount in the currency's minor/major unit as reported by Peek. */
789
+ amount: number;
790
+ /** ISO currency code. */
791
+ currency: string;
792
+ /** Human-formatted amount (e.g. `"$10.00"`). */
793
+ formatted: string;
919
794
  }
920
-
921
- declare class ResourcePoolService {
922
- private readonly client;
795
+ /** Input for creating a promo code. */
796
+ interface CreatePromoCodeInput {
797
+ /** Display name. */
798
+ name: string;
799
+ /** The redemption code. */
800
+ code: string;
801
+ /** Discount amount as a string (percentage or fixed value). */
802
+ amount: string;
803
+ /** Whether `amount` is a percentage or a fixed monetary value. */
804
+ discountType: "percent" | "fixed";
805
+ /** Optional cap on total redemptions. */
806
+ maxRedemptions?: number;
807
+ /** ISO currency code for fixed discounts. Defaults to `"USD"`. */
808
+ currency?: string;
809
+ }
810
+ /** The result of creating a promo code (the mutation returns id + name). */
811
+ interface CreatedPromoCode {
812
+ id: string;
813
+ name: string;
814
+ }
815
+
816
+ /**
817
+ * The clean data model for Peek Pro timeslots and timeslot operations.
818
+ */
819
+ /** A bookable timeslot for an activity. */
820
+ interface Timeslot {
821
+ /** Unique identifier. */
822
+ id: string;
823
+ /** The activity (product) id this timeslot belongs to. */
824
+ productId: string;
825
+ /** Total capacity of the timeslot. */
826
+ totalCapacity: number;
827
+ /** Remaining available capacity. */
828
+ availableCapacity: number;
829
+ /** Maximum party size per booking. */
830
+ maxPartySize: number;
831
+ /** Number of bookings on the timeslot. */
832
+ bookingCount: number;
833
+ /** Number of checked-in guests. */
834
+ checkedInCount: number;
835
+ /** Status reported by Peek (e.g. open/closed). */
836
+ status: string;
837
+ /** Manifest notes, or null. */
838
+ notes: string | null;
839
+ /** Duration in minutes. */
840
+ durationMin: number;
841
+ /** Date (YYYY-MM-DD). */
842
+ date: string;
843
+ /** Start time, or null. */
844
+ startTime: string | null;
845
+ /** Resources (e.g. guides, equipment) allocated to this timeslot. */
846
+ assignedResources: AssignedResource[];
847
+ }
848
+ /** A resource allocated to a {@link Timeslot}. */
849
+ interface AssignedResource {
850
+ /** Resource pool id. */
851
+ id: string;
852
+ /** Resource pool name. */
853
+ name: string;
854
+ /** Resource pool capacity. */
855
+ capacity: number;
856
+ /** Resource pool category (e.g. `"guide"`). */
857
+ category: string;
858
+ /** Allocated quantity. */
859
+ quantity: number;
860
+ /** Backing account user id, or null. */
861
+ accountUserId: string | null;
862
+ }
863
+ /** Booking filter for {@link Timeslot} day queries. */
864
+ type TimeslotFilter = "all" | "withBookings" | "withoutBookings";
865
+ /** Result of a timeslot update (set availability / notes). */
866
+ interface UpdateTimeslotResult {
867
+ manifestNotes: string | null;
868
+ status: string | null;
869
+ }
870
+ /** Input describing a guide (un)assignment across timeslots. */
871
+ interface GuideAssignment {
872
+ /** Timeslots to (un)assign. */
873
+ timeslotIds: string[];
874
+ /** Guides to (un)assign — matched by resource-pool id, account-user id, or name. */
875
+ guideIds: string[];
876
+ /** Whether to assign or unassign. */
877
+ action: "assign" | "unassign";
878
+ }
879
+ /** Result of a guide (un)assignment request. */
880
+ interface AssignGuideResult {
881
+ status: "success" | "error";
882
+ /** The created allocation request id on success, else null. */
883
+ resourceAllocationRequestId: string | null;
884
+ /** Error details on failure, else null. */
885
+ errors: Array<{
886
+ message: string;
887
+ }> | null;
888
+ }
889
+
890
+ /**
891
+ * The clean data model for a Peek Pro resource pool (e.g. guides, equipment).
892
+ */
893
+ /** Filter mode for which resource pools to return. */
894
+ type ResourcePoolMode = "ACTIVITY" | "ALL";
895
+ /** A resource pool on a Peek Pro account. */
896
+ interface ResourcePool {
897
+ /** Unique identifier. */
898
+ id: string;
899
+ /** Display name. */
900
+ name: string;
901
+ /** Image URL, or null. */
902
+ imageUrl: string | null;
903
+ /** Allocation mode reported by Peek. */
904
+ mode: string;
905
+ /** Display color as a hex string, or null. */
906
+ colorHex: string | null;
907
+ /** Configured quantity, or null when not set. */
908
+ quantity: number | null;
909
+ /** Category (e.g. `"guide"`). */
910
+ category: string;
911
+ /** Capacity, or null when not set. */
912
+ capacity: number | null;
913
+ /** How the resource is tracked, or null. */
914
+ resourceTrackingMode: string | null;
915
+ /** The account user backing this pool (e.g. for guides), or null. */
916
+ accountUser: ResourcePoolAccountUser | null;
917
+ }
918
+ /** Minimal account-user reference attached to a {@link ResourcePool}. */
919
+ interface ResourcePoolAccountUser {
920
+ id: string;
921
+ name: string;
922
+ }
923
+
924
+ /**
925
+ * The clean data model for a Peek Pro account user (staff member / guide).
926
+ */
927
+ /**
928
+ * An account user on a Peek Pro account.
929
+ *
930
+ * Only **active** users are returned by the account-user service — inactive
931
+ * users are filtered out — so there is no status field on this model.
932
+ */
933
+ interface AccountUser {
934
+ /** Unique identifier of the account user. */
935
+ id: string;
936
+ /** Full name. */
937
+ name: string;
938
+ /** Email address. */
939
+ email: string;
940
+ /** Phone number. */
941
+ phone: string;
942
+ /** The activities this user is assigned to. */
943
+ assignedActivities: AssignedActivity[];
944
+ }
945
+ /** An activity an {@link AccountUser} is assigned to. */
946
+ interface AssignedActivity {
947
+ /** Activity (product) id. */
948
+ id: string;
949
+ /** Activity name. */
950
+ name: string;
951
+ }
952
+
953
+ /** Tuning options for an {@link AccountUserService}. */
954
+ interface AccountUserServiceOptions {
955
+ /** Page size for cursor pagination. Default: 50. */
956
+ pageSize?: number;
957
+ }
958
+ declare class AccountUserService {
959
+ private readonly client;
960
+ private readonly pageSize;
961
+ constructor(client: GraphQLClient, options?: AccountUserServiceOptions);
962
+ /**
963
+ * Returns all active account users, walking the cursor pagination to the end.
964
+ * Inactive users are omitted.
965
+ */
966
+ getAll(): Promise<AccountUser[]>;
967
+ /**
968
+ * Returns a single active account user by id, or `null` when no active user
969
+ * matches.
970
+ */
971
+ getById(userId: string): Promise<AccountUser | null>;
972
+ }
973
+
974
+ declare class AvailabilityService {
975
+ private readonly client;
976
+ constructor(client: GraphQLClient);
977
+ /** Returns the availability times for an activity/date and requested quantities. */
978
+ getAvailabilityTimes(query: AvailabilityTimesQuery): Promise<AvailabilityTime[]>;
979
+ }
980
+
981
+ /**
982
+ * The clean data model for a Peek Pro daily (dashboard) note.
983
+ */
984
+ /** The daily note shown on the Peek Pro dashboard. */
985
+ interface DailyNote {
986
+ /** The note text. */
987
+ note: string;
988
+ }
989
+
990
+ declare class DailyNoteService {
991
+ private readonly client;
992
+ constructor(client: GraphQLClient);
993
+ /** Returns today's daily note, or null when none is set. */
994
+ getToday(): Promise<DailyNote | null>;
995
+ /** Upserts the daily note and returns the saved note, or null. */
996
+ update(note: string): Promise<DailyNote | null>;
997
+ }
998
+
999
+ declare class MembershipService {
1000
+ private readonly client;
1001
+ constructor(client: GraphQLClient);
1002
+ /** Returns all membership variants, flattened into {@link Membership} records. */
1003
+ getAll(): Promise<Membership[]>;
1004
+ /**
1005
+ * Purchases a membership via the two-step quote → order flow. Throws on
1006
+ * invalid input or when Peek returns errors.
1007
+ */
1008
+ purchase(input: MembershipPurchaseInput): Promise<PurchasedMembership>;
1009
+ }
1010
+
1011
+ /**
1012
+ * The clean data model for Peek Pro reseller channels and their agents.
1013
+ */
1014
+ /** A reseller channel on a Peek Pro account. */
1015
+ interface Channel {
1016
+ /** Unique identifier. */
1017
+ id: string;
1018
+ /** Channel name. */
1019
+ name: string;
1020
+ /** Free-text notes, or null. */
1021
+ notes: string | null;
1022
+ /** Pricing model reported by Peek. */
1023
+ pricingModel: string;
1024
+ /** Channel state (e.g. active/inactive). */
1025
+ state: string;
1026
+ /** Channel type. */
1027
+ type: string;
1028
+ /** Agents belonging to this channel. */
1029
+ agents: Agent[];
1030
+ }
1031
+ /** An agent (contact) belonging to a {@link Channel}. */
1032
+ interface Agent {
1033
+ /** Email address, or null. */
1034
+ email: string | null;
1035
+ /** Agent name. */
1036
+ name: string;
1037
+ /** Internal notes, or null. */
1038
+ internalNotes: string | null;
1039
+ /** Phone number, or null. */
1040
+ phone: string | null;
1041
+ }
1042
+
1043
+ declare class ResellerService {
1044
+ private readonly client;
1045
+ constructor(client: GraphQLClient);
1046
+ /**
1047
+ * Returns all reseller channels, each with up to `agentsPerChannel` agents
1048
+ * (default 10).
1049
+ */
1050
+ getAllChannels(agentsPerChannel?: number): Promise<Channel[]>;
1051
+ }
1052
+
1053
+ declare class ResourcePoolService {
1054
+ private readonly client;
923
1055
  constructor(client: GraphQLClient);
924
1056
  /**
925
1057
  * Returns all resource pools for the given mode filter (defaults to `"ALL"`).
@@ -1001,80 +1133,6 @@ declare class ReviewService {
1001
1133
  private validate;
1002
1134
  }
1003
1135
 
1004
- /**
1005
- * The clean data model for Peek Pro timeslots and timeslot operations.
1006
- */
1007
- /** A bookable timeslot for an activity. */
1008
- interface Timeslot {
1009
- /** Unique identifier. */
1010
- id: string;
1011
- /** The activity (product) id this timeslot belongs to. */
1012
- productId: string;
1013
- /** Total capacity of the timeslot. */
1014
- totalCapacity: number;
1015
- /** Remaining available capacity. */
1016
- availableCapacity: number;
1017
- /** Maximum party size per booking. */
1018
- maxPartySize: number;
1019
- /** Number of bookings on the timeslot. */
1020
- bookingCount: number;
1021
- /** Number of checked-in guests. */
1022
- checkedInCount: number;
1023
- /** Status reported by Peek (e.g. open/closed). */
1024
- status: string;
1025
- /** Manifest notes, or null. */
1026
- notes: string | null;
1027
- /** Duration in minutes. */
1028
- durationMin: number;
1029
- /** Date (YYYY-MM-DD). */
1030
- date: string;
1031
- /** Start time, or null. */
1032
- startTime: string | null;
1033
- /** Resources (e.g. guides, equipment) allocated to this timeslot. */
1034
- assignedResources: AssignedResource[];
1035
- }
1036
- /** A resource allocated to a {@link Timeslot}. */
1037
- interface AssignedResource {
1038
- /** Resource pool id. */
1039
- id: string;
1040
- /** Resource pool name. */
1041
- name: string;
1042
- /** Resource pool capacity. */
1043
- capacity: number;
1044
- /** Resource pool category (e.g. `"guide"`). */
1045
- category: string;
1046
- /** Allocated quantity. */
1047
- quantity: number;
1048
- /** Backing account user id, or null. */
1049
- accountUserId: string | null;
1050
- }
1051
- /** Booking filter for {@link Timeslot} day queries. */
1052
- type TimeslotFilter = "all" | "withBookings" | "withoutBookings";
1053
- /** Result of a timeslot update (set availability / notes). */
1054
- interface UpdateTimeslotResult {
1055
- manifestNotes: string | null;
1056
- status: string | null;
1057
- }
1058
- /** Input describing a guide (un)assignment across timeslots. */
1059
- interface GuideAssignment {
1060
- /** Timeslots to (un)assign. */
1061
- timeslotIds: string[];
1062
- /** Guides to (un)assign — matched by resource-pool id, account-user id, or name. */
1063
- guideIds: string[];
1064
- /** Whether to assign or unassign. */
1065
- action: "assign" | "unassign";
1066
- }
1067
- /** Result of a guide (un)assignment request. */
1068
- interface AssignGuideResult {
1069
- status: "success" | "error";
1070
- /** The created allocation request id on success, else null. */
1071
- resourceAllocationRequestId: string | null;
1072
- /** Error details on failure, else null. */
1073
- errors: Array<{
1074
- message: string;
1075
- }> | null;
1076
- }
1077
-
1078
1136
  /**
1079
1137
  * Timeslot operations against the Peek gateway.
1080
1138
  *
@@ -1118,54 +1176,6 @@ declare class TimeslotService {
1118
1176
  private updateTimeslot;
1119
1177
  }
1120
1178
 
1121
- /**
1122
- * The clean data model for Peek Pro promo codes.
1123
- */
1124
- /** A promo code on a Peek Pro account. */
1125
- interface PromoCode {
1126
- /** Unique identifier. */
1127
- id: string;
1128
- /** Display name. */
1129
- name: string;
1130
- /** Percentage discount (0–100), or null for a fixed-amount code. */
1131
- percentAmount: number | null;
1132
- /** Whether the discount applies per ticket. */
1133
- perTicketDiscount: boolean;
1134
- /** The code guests redeem. */
1135
- redemptionCode: string;
1136
- /** Fixed-amount discount, or null for a percentage code. */
1137
- fixedAmount: PromoCodeFixedAmount | null;
1138
- }
1139
- /** A fixed monetary discount on a {@link PromoCode}. */
1140
- interface PromoCodeFixedAmount {
1141
- /** Amount in the currency's minor/major unit as reported by Peek. */
1142
- amount: number;
1143
- /** ISO currency code. */
1144
- currency: string;
1145
- /** Human-formatted amount (e.g. `"$10.00"`). */
1146
- formatted: string;
1147
- }
1148
- /** Input for creating a promo code. */
1149
- interface CreatePromoCodeInput {
1150
- /** Display name. */
1151
- name: string;
1152
- /** The redemption code. */
1153
- code: string;
1154
- /** Discount amount as a string (percentage or fixed value). */
1155
- amount: string;
1156
- /** Whether `amount` is a percentage or a fixed monetary value. */
1157
- discountType: "percent" | "fixed";
1158
- /** Optional cap on total redemptions. */
1159
- maxRedemptions?: number;
1160
- /** ISO currency code for fixed discounts. Defaults to `"USD"`. */
1161
- currency?: string;
1162
- }
1163
- /** The result of creating a promo code (the mutation returns id + name). */
1164
- interface CreatedPromoCode {
1165
- id: string;
1166
- name: string;
1167
- }
1168
-
1169
1179
  /** Tuning options for a {@link PromoCodeService}. */
1170
1180
  interface PromoCodeServiceOptions {
1171
1181
  /** Page size for cursor pagination. Default: 50. */
@@ -1184,15 +1194,28 @@ declare class PromoCodeService {
1184
1194
  create(input: CreatePromoCodeInput): Promise<CreatedPromoCode>;
1185
1195
  }
1186
1196
 
1187
- /**
1188
- * Authenticated root entry point to the Peek backoffice GraphQL gateway.
1189
- *
1190
- * Configure one instance per install with everything needed to authenticate and
1191
- * reach the gateway. The access service owns the shared, authenticated
1192
- * transport (it mints and caches tokens on demand) and hands out per-resource
1193
- * service objects e.g. {@link PeekAccessService.getProductService} — that
1194
- * carry the resource-specific business logic.
1195
- */
1197
+ /** User context embedded in a Peek auth token. */
1198
+ interface PeekAuthTokenUser {
1199
+ /** User's email address. */
1200
+ email: string;
1201
+ /** User's Peek account ID */
1202
+ id: string;
1203
+ /** Whether the user has admin privileges. */
1204
+ isAdmin: boolean;
1205
+ /** User's locale (e.g. `"en"`). */
1206
+ locale: string;
1207
+ /** User's display name. */
1208
+ name: string;
1209
+ }
1210
+ /** Claims returned by {@link PeekAccessService.verifyPeekAuthToken}. */
1211
+ interface PeekAuthTokenClaims {
1212
+ /** Install ID — the JWT subject (`sub`). Peek-assigned UUID. */
1213
+ installId: string;
1214
+ /** App display version at time of issuance. */
1215
+ displayVersion: string;
1216
+ /** Authenticated user context. */
1217
+ user: PeekAuthTokenUser;
1218
+ }
1196
1219
 
1197
1220
  /** Configuration for a {@link PeekAccessService} instance. */
1198
1221
  interface PeekAccessServiceConfig {
@@ -1258,6 +1281,7 @@ interface PeekAccessServiceConfig {
1258
1281
  declare class PeekAccessService {
1259
1282
  private readonly client;
1260
1283
  private readonly productServiceOptions;
1284
+ private readonly jwtSecret;
1261
1285
  private productService?;
1262
1286
  private accountUserService?;
1263
1287
  private resourcePoolService?;
@@ -1270,6 +1294,25 @@ declare class PeekAccessService {
1270
1294
  private bookingService?;
1271
1295
  private reviewService?;
1272
1296
  constructor(config: PeekAccessServiceConfig);
1297
+ /**
1298
+ * Verifies a Peek auth token issued by the app registry and returns the
1299
+ * decoded claims.
1300
+ *
1301
+ * Validates the HMAC signature (using this service's `jwtSecret`), the token
1302
+ * expiry, the `"app_registry_v2"` issuer, and the `"Joken"` audience. Throws
1303
+ * from the `jsonwebtoken` library on any failure — callers should catch to
1304
+ * distinguish error kinds:
1305
+ *
1306
+ * - `JsonWebTokenError` — signature invalid, wrong issuer/audience, or token
1307
+ * malformed
1308
+ * - `TokenExpiredError` — past `exp`
1309
+ * - `NotBeforeError` — before `nbf`
1310
+ *
1311
+ * @throws {JsonWebTokenError} signature invalid or token malformed
1312
+ * @throws {TokenExpiredError} token has expired
1313
+ * @throws {NotBeforeError} token not yet valid
1314
+ */
1315
+ verifyPeekAuthToken(token: string): PeekAuthTokenClaims;
1273
1316
  /**
1274
1317
  * Returns the {@link ProductService} for this install, bound to the shared
1275
1318
  * authenticated transport. The instance is created lazily and reused.
@@ -1326,6 +1369,78 @@ declare class PeekAccessService {
1326
1369
  * authenticated transport. The instance is created lazily and reused.
1327
1370
  */
1328
1371
  getReviewService(): ReviewService;
1372
+ /** All products (activities + add-ons). Delegates to {@link ProductService.getAllProducts}. */
1373
+ getAllProducts(): Promise<Product[]>;
1374
+ /** All activity products (excludes add-ons). Delegates to {@link ProductService.getAllActivities}. */
1375
+ getAllActivities(): Promise<Product[]>;
1376
+ /** All rental products. Delegates to {@link ProductService.getAllRentals}. */
1377
+ getAllRentals(): Promise<Product[]>;
1378
+ /** All add-on products. Delegates to {@link ProductService.getAllAddons}. */
1379
+ getAllAddons(): Promise<Product[]>;
1380
+ /** All active account users. Delegates to {@link AccountUserService.getAll}. */
1381
+ getAllAccountUsers(): Promise<AccountUser[]>;
1382
+ /** Account user by id, or null. Delegates to {@link AccountUserService.getById}. */
1383
+ getAccountUserById(userId: string): Promise<AccountUser | null>;
1384
+ /** All resource pools. Delegates to {@link ResourcePoolService.getAll}. */
1385
+ getAllResourcePools(mode?: ResourcePoolMode): Promise<ResourcePool[]>;
1386
+ /** Timeslots for an activity on a given date. Delegates to {@link TimeslotService.getForDay}. */
1387
+ getTimeslotsForDay(productId: string, date: string, filter?: TimeslotFilter): Promise<Timeslot[]>;
1388
+ /** Single timeslot by id. Delegates to {@link TimeslotService.getById}. */
1389
+ getTimeslotById(timeslotId: string): Promise<Timeslot | null>;
1390
+ /** Set timeslot status. Delegates to {@link TimeslotService.setAvailability}. */
1391
+ setTimeslotAvailability(timeslotId: string, status: string): Promise<UpdateTimeslotResult>;
1392
+ /** Set timeslot manifest notes. Delegates to {@link TimeslotService.setNotes}. */
1393
+ setTimeslotNotes(timeslotId: string, manifestNotes: string): Promise<UpdateTimeslotResult>;
1394
+ /** Assign or unassign guides on timeslots. Delegates to {@link TimeslotService.assignGuide}. */
1395
+ assignTimeslotGuide(assignment: GuideAssignment): Promise<AssignGuideResult>;
1396
+ /** All reseller channels. Delegates to {@link ResellerService.getAllChannels}. */
1397
+ getAllChannels(agentsPerChannel?: number): Promise<Channel[]>;
1398
+ /** All promo codes. Delegates to {@link PromoCodeService.getAll}. */
1399
+ getAllPromoCodes(): Promise<PromoCode[]>;
1400
+ /** Create a promo code. Delegates to {@link PromoCodeService.create}. */
1401
+ createPromoCode(input: CreatePromoCodeInput): Promise<CreatedPromoCode>;
1402
+ /** Today's daily note. Delegates to {@link DailyNoteService.getToday}. */
1403
+ getDailyNoteToday(): Promise<DailyNote | null>;
1404
+ /** Update today's daily note. Delegates to {@link DailyNoteService.update}. */
1405
+ updateDailyNote(note: string): Promise<DailyNote | null>;
1406
+ /** Availability times for an activity. Delegates to {@link AvailabilityService.getAvailabilityTimes}. */
1407
+ getAvailabilityTimes(query: AvailabilityTimesQuery): Promise<AvailabilityTime[]>;
1408
+ /** All memberships. Delegates to {@link MembershipService.getAll}. */
1409
+ getAllMemberships(): Promise<Membership[]>;
1410
+ /** Purchase a membership. Delegates to {@link MembershipService.purchase}. */
1411
+ purchaseMembership(input: MembershipPurchaseInput): Promise<PurchasedMembership>;
1412
+ /** Booking by id. Delegates to {@link BookingService.getById}. */
1413
+ getBookingById(bookingId: string, options?: BookingReadOptions): Promise<Booking | null>;
1414
+ /** Bookings by time range. Delegates to {@link BookingService.searchByTimeRange}. */
1415
+ searchBookingsByTimeRange(input: BookingTimeRangeSearch): Promise<Booking[]>;
1416
+ /** Bookings on a timeslot. Delegates to {@link BookingService.searchByTimeslot}. */
1417
+ searchBookingsByTimeslot(timeslotId: string, options?: BookingReadOptions): Promise<Booking[]>;
1418
+ /** Guests on a booking. Delegates to {@link BookingService.getGuests}. */
1419
+ getBookingGuests(bookingId: string): Promise<Guest[]>;
1420
+ /** Payments on file for a booking. Delegates to {@link BookingService.getPaymentsOnFile}. */
1421
+ getBookingPaymentsOnFile(bookingId: string): Promise<BookingPaymentsOnFile | null>;
1422
+ /** Append or overwrite operator notes. Delegates to {@link BookingService.appendNote}. */
1423
+ appendBookingNote(bookingId: string, note: string, mode?: NoteMode): Promise<Booking | null>;
1424
+ /** Set booking check-in status. Delegates to {@link BookingService.setCheckinStatus}. */
1425
+ setBookingCheckinStatus(bookingId: string, checkedIn: boolean): Promise<Booking | null>;
1426
+ /** Cancel a booking. Delegates to {@link BookingService.cancel}. */
1427
+ cancelBooking(bookingId: string, notes?: string): Promise<CancelBookingResult>;
1428
+ /** Charge a booking. Delegates to {@link BookingService.makePayment}. */
1429
+ makeBookingPayment(input: MakePaymentInput): Promise<MakePaymentResult>;
1430
+ /** Refund a booking payment. Delegates to {@link BookingService.refund}. */
1431
+ refundBooking(input: RefundInput): Promise<RefundResult>;
1432
+ /** Create an invoice link. Delegates to {@link BookingService.createInvoiceLink}. */
1433
+ createBookingInvoiceLink(bookingId: string): Promise<InvoiceLinkResult>;
1434
+ /** List add-ons on a booking. Delegates to {@link BookingService.listAddons}. */
1435
+ listBookingAddons(bookingId: string): Promise<BookingAddons>;
1436
+ /** Add an add-on to a booking. Delegates to {@link BookingService.addAddon}. */
1437
+ addBookingAddon(bookingId: string, input: AddAddonInput): Promise<BookingAddonsMutationResult>;
1438
+ /** Remove an add-on from a booking. Delegates to {@link BookingService.removeAddon}. */
1439
+ removeBookingAddon(bookingId: string, input: AddAddonInput): Promise<BookingAddonsMutationResult>;
1440
+ /** Create a booking. Delegates to {@link BookingService.create}. */
1441
+ createBooking(input: CreateBookingInput): Promise<CreatedBooking>;
1442
+ /** Reviews for an activity. Delegates to {@link ReviewService.getReviews}. */
1443
+ getReviews(productId: string, reviewCount?: number, reviewOffset?: number): Promise<Review[]>;
1329
1444
  }
1330
1445
 
1331
1446
  /**
@@ -1441,4 +1556,4 @@ declare class PeekGraphQLError extends Error {
1441
1556
  constructor(graphqlErrors: unknown[], message?: string);
1442
1557
  }
1443
1558
 
1444
- export { ADD_ON_PRODUCT_TYPE, type AccountUser, AccountUserService, type AccountUserServiceOptions, 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 CreateBookingGuest, type CreateBookingInput, type CreateBookingTicket, type CreatePromoCodeInput, type CreatedBooking, type CreatedPromoCode, type CustomQuestionAnswer, type DailyNote, DailyNoteService, type Duration, type Guest, type GuestMetadata, type Guide, type GuideAssignment, type InvoiceLinkResult, type Logger, type MakePaymentInput, type MakePaymentResult, type Membership, type MembershipPurchaseInput, MembershipService, type NoteMode, type Payment, type PaymentSource, PeekAccessService, type PeekAccessServiceConfig, PeekGraphQLError, type Price, type Product, ProductService, type ProductServiceOptions, type ProductTicket, type PromoCode, type PromoCodeFixedAmount, PromoCodeService, type PromoCodeServiceOptions, type PurchasedMembership, RateLimitError, type RefundInput, type RefundResult, ResellerService, type Resource, type ResourceOptionQuantity, type ResourcePool, type ResourcePoolAccountUser, type ResourcePoolAssignment, type ResourcePoolMode, ResourcePoolService, type Review, ReviewService, type Ticket, type Timeslot, type TimeslotFilter, TimeslotService, type UpdateTimeslotResult, type Waiver, noopLogger, parseBookingWebhook, parseWaiverWebhook };
1559
+ export { ACTIVITY_PRODUCT_TYPE, ADD_ON_PRODUCT_TYPE, type AccountUser, AccountUserService, type AccountUserServiceOptions, 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 CreateBookingGuest, type CreateBookingInput, type CreateBookingTicket, type CreatePromoCodeInput, type CreatedBooking, type CreatedPromoCode, type CustomQuestionAnswer, type DailyNote, DailyNoteService, type Duration, type Guest, type GuestMetadata, type Guide, type GuideAssignment, type InvoiceLinkResult, type Logger, type MakePaymentInput, type MakePaymentResult, type Membership, type MembershipPurchaseInput, MembershipService, type NoteMode, type Payment, type PaymentSource, PeekAccessService, type PeekAccessServiceConfig, type PeekAuthTokenClaims, type PeekAuthTokenUser, PeekGraphQLError, type Price, type Product, ProductService, type ProductServiceOptions, type ProductTicket, type PromoCode, type PromoCodeFixedAmount, PromoCodeService, type PromoCodeServiceOptions, type PurchasedMembership, RENTAL_PRODUCT_TYPE, RateLimitError, type RefundInput, type RefundResult, ResellerService, type Resource, type ResourceOptionQuantity, type ResourcePool, type ResourcePoolAccountUser, type ResourcePoolAssignment, type ResourcePoolMode, ResourcePoolService, type Review, ReviewService, type Ticket, type Timeslot, type TimeslotFilter, TimeslotService, type UpdateTimeslotResult, type Waiver, noopLogger, parseBookingWebhook, parseWaiverWebhook };