@techzunction/sdk 0.6.6 → 0.7.0

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.cts CHANGED
@@ -25,28 +25,29 @@ interface AuthTokens {
25
25
  accessToken: string;
26
26
  refreshToken: string;
27
27
  }
28
+ /** EndUser as returned by all auth flows (register, login, verifyOtp, completeSignup, socialLogin) */
28
29
  interface EndUser {
29
30
  id: string;
30
31
  name: string | null;
31
32
  email: string | null;
32
33
  phone: string | null;
33
34
  orgId: string;
34
- }
35
- interface EndUserProfile {
36
- id: string;
37
- name: string | null;
38
- email: string | null;
39
- phone: string | null;
40
- avatarUrl: string | null;
41
35
  isPhoneVerified: boolean;
42
36
  isEmailVerified: boolean;
37
+ onboardingStep: number;
38
+ avatarUrl: string | null;
43
39
  referralCode: string | null;
40
+ }
41
+ /** EndUser profile as returned by GET /storefront/auth/profile (includes createdAt) */
42
+ interface EndUserProfile extends EndUser {
44
43
  createdAt: string;
45
44
  }
46
45
  interface AuthResponse {
47
46
  accessToken: string;
48
47
  refreshToken: string;
49
48
  user: EndUser;
49
+ /** Only present on login — the org's configured primary login identifier */
50
+ primaryLoginId?: string;
50
51
  }
51
52
  /** Backend AuthUserDto — roles is string[] (role IDs) */
52
53
  interface StaffUser {
@@ -70,11 +71,55 @@ interface PaginationParams {
70
71
  }
71
72
  interface PaginatedResponse<T> {
72
73
  data: T[];
73
- total: number;
74
- page: number;
75
- limit: number;
76
- totalPages: number;
74
+ pagination: {
75
+ page: number;
76
+ limit: number;
77
+ total: number;
78
+ totalPages: number;
79
+ hasNextPage: boolean;
80
+ hasPrevPage: boolean;
81
+ };
82
+ }
83
+ interface ApiResponseEnvelope<T> {
84
+ success: true;
85
+ data: T;
86
+ message: string | null;
87
+ meta: {
88
+ timestamp: string;
89
+ requestId: string;
90
+ } | null;
77
91
  }
92
+ interface ApiPaginatedEnvelope<T> {
93
+ success: true;
94
+ data: T[];
95
+ pagination: {
96
+ page: number;
97
+ limit: number;
98
+ total: number;
99
+ totalPages: number;
100
+ hasNextPage: boolean;
101
+ hasPrevPage: boolean;
102
+ };
103
+ message: string | null;
104
+ meta: {
105
+ timestamp: string;
106
+ requestId: string;
107
+ } | null;
108
+ }
109
+ interface ApiErrorEnvelope {
110
+ success: false;
111
+ error: {
112
+ code: string;
113
+ message: string;
114
+ details: unknown | null;
115
+ };
116
+ meta: {
117
+ timestamp: string;
118
+ requestId: string;
119
+ } | null;
120
+ }
121
+ type ApiResult<T> = ApiResponseEnvelope<T> | ApiErrorEnvelope;
122
+ type ApiPaginatedResult<T> = ApiPaginatedEnvelope<T> | ApiErrorEnvelope;
78
123
  interface CatalogCategory {
79
124
  id: string;
80
125
  name: string;
@@ -154,21 +199,51 @@ type PaymentMethod = 'online' | 'cod' | 'wallet';
154
199
  type OrderStatus = 'pending' | 'confirmed' | 'preparing' | 'ready' | 'out_for_delivery' | 'delivered' | 'picked_up' | 'completed' | 'cancelled' | 'refunded';
155
200
  interface OrderItem {
156
201
  id: string;
157
- catalogItemId: string;
158
- name: string;
202
+ itemId: string;
203
+ itemName: string;
204
+ variantType: string;
205
+ sizeVariationId: string | null;
206
+ sizeVariationName: string | null;
159
207
  quantity: number;
160
208
  unitPrice: number;
161
209
  totalPrice: number;
210
+ taxAmount: number;
211
+ metadata: Record<string, unknown> | null;
212
+ options: {
213
+ id: string;
214
+ optionId: string;
215
+ optionName: string;
216
+ quantity: number;
217
+ unitPrice: number;
218
+ }[];
162
219
  }
163
220
  interface Order {
164
221
  id: string;
165
222
  orderNumber: string;
166
- status: OrderStatus;
167
- orderType: OrderType;
223
+ endUserId: string;
224
+ addressId: string | null;
225
+ locationId: string | null;
226
+ variantType: string;
227
+ status: string;
228
+ orderType: string;
229
+ paymentMethod: string | null;
230
+ customerName: string;
231
+ customerPhone: string;
232
+ customerEmail: string | null;
168
233
  subtotal: number;
234
+ taxAmount: number;
235
+ discountAmount: number;
169
236
  deliveryFee: number;
170
- discount: number;
171
- total: number;
237
+ packingCharges: number;
238
+ serviceCharge: number;
239
+ totalAmount: number;
240
+ couponCode: string | null;
241
+ loyaltyEarned: number;
242
+ loyaltyRedeemed: number;
243
+ tokenNumber: number | null;
244
+ specialInstructions: string | null;
245
+ scheduledAt: string | null;
246
+ channel: string;
172
247
  items: OrderItem[];
173
248
  createdAt: string;
174
249
  updatedAt: string;
@@ -261,8 +336,12 @@ interface LoyaltyRedemption {
261
336
  }
262
337
  interface CouponValidation {
263
338
  valid: boolean;
339
+ code: string;
340
+ name: string;
264
341
  discountType: string;
265
342
  discountValue: number;
343
+ maxDiscount: number | null;
344
+ calculatedDiscount: number;
266
345
  message: string;
267
346
  }
268
347
  interface Promotion {
@@ -342,16 +421,26 @@ interface ContentPost {
342
421
  id: string;
343
422
  title: string;
344
423
  slug: string;
424
+ h1: string | null;
345
425
  body: string;
346
426
  excerpt: string | null;
347
427
  imageUrl: string | null;
428
+ featuredImage: string | null;
429
+ ogImage: string | null;
348
430
  category: string | null;
349
431
  tags: string[];
350
432
  status: string;
433
+ author: string | null;
351
434
  authorId: string | null;
435
+ metaDescription: string | null;
436
+ keywords: string[];
437
+ canonical: string | null;
438
+ datePublished: string | null;
439
+ dateModified: string | null;
352
440
  metadata: Record<string, unknown> | null;
353
441
  publishedAt: string | null;
354
442
  createdAt: string;
443
+ updatedAt: string;
355
444
  }
356
445
  interface Address {
357
446
  id: string;
@@ -4134,4 +4223,4 @@ declare function createTZ(options?: TZInitOptions): {
4134
4223
  }>;
4135
4224
  };
4136
4225
 
4137
- export { type AddCartItemDto, type AddSegmentMembersDto, type Address, type AdjustLoyaltyPointsDto, type AdminAbandonedCart, type AdminAbandonedCartsQuery, type AdminAffiliate, type AdminBlogPost, type AdminBroadcast, type AdminCancelBookingDto, type AdminCoupon, type AdminCustomer, type AdminCustomerDetail, type AdminDashboardData, type AdminDashboardQuery, type AdminDashboardStats, type AdminDeliveryAgent, type AdminDeliveryZone, type AdminFinanceQuery, type AdminFulfillResult, type AdminGiftCard, type AdminGiftCardTransaction, type AdminHelpArticle, type AdminInstitution, type AdminInvoice, type AdminListOrdersQuery, type AdminLocation, type AdminLocationDetail, type AdminLoyaltyAccount, type AdminLoyaltyData, type AdminMealSubscription, type AdminMenuItem, type AdminOrder, type AdminOrderDetail, type AdminOrganization, type AdminPayout, type AdminPopupSettings, type AdminPromotion, type AdminRedemption, type AdminReservation, type AdminReservationSlot, type AdminReservationTable, type AdminReview, type AdminScheduledOrder, type AdminScheduledOrdersQuery, type AdminSetting, type AdminSettlement, type AdminStudentDiscount, type AdminStudentPass, type AdminStudentPassDetail, type AdminStudentPassStats, type AdminSyncLog, type AdminTaxSummary, type AdminTicket, type AdminTicketDetail, type AdminTicketMessage, type AdminWaitlistEntry, type AdminWaitlistGroup, type ApiError, type ApiKey, type ApplyStudentPassDto, type AssignPropertyUnitsDto, type AssignStaffRolesDto, type AuditLog, type AuthResponse, type AuthScope, type AuthTokens, type BulkReviewStudentPassesDto, type BulkUpdateSettingsDto, type BulkUpsertEndUsersDto, type CalculateDeliveryDto, type CancelPropertyBookingDto, type Cart, type CartItemOption, type CartLineItem, type CatalogCategory, type CatalogItem, type CatalogItemVariant, type CatalogOption, type CatalogOptionGroup, type ChangeEndUserPasswordDto, type CheckPropertyAvailabilityQuery, type CheckReservationAvailabilityQuery, type CompleteSignupDto, type ConnectedSource, type ContactMessage, type ContentPost, type CouponValidation, type CreateAddressDto, type CreateApiKeyDto, type CreateBroadcastDto, type CreateCatalogCategoryDto, type CreateCatalogOptionDto, type CreateCatalogOptionGroupDto, type CreateCatalogVariantDto, type CreateDeliveryAgentDto, type CreateDeliveryZoneDto, type CreateHelpArticleDto, type CreateIngredientDto, type CreateInstitutionDto, type CreateMealPlanDto, type CreateOrderDto, type CreatePaymentOrderDto, type CreatePropertyAmenityDto, type CreatePropertyBookingDto, type CreatePropertyPaymentOrderDto, type CreatePurchaseOrderDto, type CreateReservationDto, type CreateReservationSlotDto, type CreateReservationTableDto, type CreateReviewDto, type CreateRoleDto, type CreateStudentDiscountDto, type CreateSuperAdminDto, type CreateSupplierDto, type CreateSupportTicketDto, type CreateWasteLogDto, type CreateWatchRoomDto, type DeliveryCalculation, type DeliveryTracking, type DiscountPreview, type EarningsSummary, type EndUser, type EndUserProfile, type EndUserRequestResetDto, type EndUserResetPasswordDto, type EndUserSendOtpDto, type EndUserTagsDto, type EndUserVerifyOtpDto, type FulfillRewardDto, type GetCatalogItemsQuery, type GiftCard, type GoogleDriveCallbackDto, type GoogleDriveConnectUrl, type HelpArticle, type HostEarning, type Ingredient, type Institution, type InviteStaffUserDto, type JoinWatchRoomDto, type ListCatalogItemsQuery, type ListContentQuery, type ListEarningsQuery, type ListEndUsersQuery, type ListMoviesQuery, type ListOrdersQuery, type ListOrganizationsQuery, type ListReviewsQuery, type ListStaffUsersQuery, type ListStudentPassesQuery, type ListSuperAdminsQuery, type ListWatchRoomsQuery, type LocationHours, type LoginEndUserDto, type LoyaltyAccount, type LoyaltyRedemption, type LoyaltyReward, type LoyaltyTransaction, type MealPlan, type MealSubscription, type Movie, type MovieDetail, type Notification, type Order, type OrderItem, type OrderStatus, type OrderType, type PaginatedQuery, type PaginatedResponse, type PaginationParams, type PaymentMethod, type PaymentOrder, type PaymentVerification, type PlatformPlan, type PreviewStudentDiscountDto, type PreviewTemplateDto, type Promotion, type PropertyAvailability, type PropertyBooking, type PropertyPriceResolution, type PropertyType, type PurchaseGiftCardDto, type PurchaseOrder, type PurchaseOrderItem, type QueryMealSubscriptionsParams, type QueryPurchaseOrdersParams, type RawResponse, type RedeemGiftCardDto, type RedeemLoyaltyRewardDto, type ReferralInfo, type ReferralValidation, type RegisterEndUserDto, type ReorderDto, type ReplySupportTicketDto, type ReportOrderIssueDto, type RequestMagicLinkDto, type Reservation, type ReservationSlot, type ResolvePropertyPriceDto, type Review, type ReviewStudentPassDto, type Role, type ScheduleCampaignDto, ScopedClient, type SearchQuery, type SearchStatusQuery, type SetLocationHoursDto, type SetPropertyTypeAmenitiesDto, type SetSettingDto, type StaffAuthResponse, type StaffChangePasswordDto, type StaffLoginDto, type StaffRegisterDto, type StaffRequestPasswordResetDto, type StaffResetPasswordDto, type StaffSendOtpDto, type StaffUser, type StaffVerifyOtpDto, type StartSignupDto, type StartWatchSessionDto, type StatusQuery, type StockAlert, type StoreLocation, type StorefrontConfig, type StudentDiscount, type StudentPassStatus, type SubmitContactDto, type SubscribeBillingPlanDto, type SubscribeMealPlanDto, type SubscribeNewsletterDto, type SuperAdminLoginDto, type SuperAdminStats, type SuperAdmin as SuperAdminUser, type Supplier, type SupportReply, type SupportTicket, type SwitchWatchRoomModeDto, TZ, TZClient, type TZConfig, type TZInitOptions, TZPaginatedQuery, TZQuery, type TmdbMovie, type TmdbMovieDetail, type TokenStore, type TopUpWalletDto, type UpdateAddressDto, type UpdateApiKeyDto, type UpdateCartItemDto, type UpdateCatalogCategoryDto, type UpdateCatalogOptionDto, type UpdateCatalogOptionGroupDto, type UpdateCatalogVariantDto, type UpdateDeliveryAgentDto, type UpdateDeliveryZoneDto, type UpdateEndUserProfileDto, type UpdateHelpArticleDto, type UpdateHousekeepingDto, type UpdateIngredientDto, type UpdateInstitutionDto, type UpdateMealPlanDto, type UpdateMovieProgressDto, type UpdateOrderStatusDto, type UpdateOrgDto, type UpdatePopupSettingsDto, type UpdatePurchaseOrderDto, type UpdateReservationSlotDto, type UpdateReservationStatusDto, type UpdateReservationTableDto, type UpdateReviewStatusDto, type UpdateRoleDto, type UpdateStaffUserDto, type UpdateStudentDiscountDto, type UpdateSupplierDto, type UpdateSupportTicketDto, type UploadResult, type ValidateCouponDto, type ValidateReferralDto, type VerifyMagicLinkQuery, type VerifyPaymentDto, type VerifySignupOtpDto, type WalletBalance, type WalletPack, type WalletTransaction, type WasteLog, type WatchRoom, type WatchRoomJoinResponse, type WatchRoomMessage, type WatchRoomPlaybackState, type WatchRoomPrivacy, type WatchRoomStatus, type WatchRoomVibe, type WatchRoomViewer, type WatchRoomViewerMode, type WatchSessionHistoryItem, type WatchSessionResponse, type WatchSessionStatus, type WatchSessionStatusType, type WatchSessionSummary, createTZ };
4226
+ export { type AddCartItemDto, type AddSegmentMembersDto, type Address, type AdjustLoyaltyPointsDto, type AdminAbandonedCart, type AdminAbandonedCartsQuery, type AdminAffiliate, type AdminBlogPost, type AdminBroadcast, type AdminCancelBookingDto, type AdminCoupon, type AdminCustomer, type AdminCustomerDetail, type AdminDashboardData, type AdminDashboardQuery, type AdminDashboardStats, type AdminDeliveryAgent, type AdminDeliveryZone, type AdminFinanceQuery, type AdminFulfillResult, type AdminGiftCard, type AdminGiftCardTransaction, type AdminHelpArticle, type AdminInstitution, type AdminInvoice, type AdminListOrdersQuery, type AdminLocation, type AdminLocationDetail, type AdminLoyaltyAccount, type AdminLoyaltyData, type AdminMealSubscription, type AdminMenuItem, type AdminOrder, type AdminOrderDetail, type AdminOrganization, type AdminPayout, type AdminPopupSettings, type AdminPromotion, type AdminRedemption, type AdminReservation, type AdminReservationSlot, type AdminReservationTable, type AdminReview, type AdminScheduledOrder, type AdminScheduledOrdersQuery, type AdminSetting, type AdminSettlement, type AdminStudentDiscount, type AdminStudentPass, type AdminStudentPassDetail, type AdminStudentPassStats, type AdminSyncLog, type AdminTaxSummary, type AdminTicket, type AdminTicketDetail, type AdminTicketMessage, type AdminWaitlistEntry, type AdminWaitlistGroup, type ApiError, type ApiErrorEnvelope, type ApiKey, type ApiPaginatedEnvelope, type ApiPaginatedResult, type ApiResponseEnvelope, type ApiResult, type ApplyStudentPassDto, type AssignPropertyUnitsDto, type AssignStaffRolesDto, type AuditLog, type AuthResponse, type AuthScope, type AuthTokens, type BulkReviewStudentPassesDto, type BulkUpdateSettingsDto, type BulkUpsertEndUsersDto, type CalculateDeliveryDto, type CancelPropertyBookingDto, type Cart, type CartItemOption, type CartLineItem, type CatalogCategory, type CatalogItem, type CatalogItemVariant, type CatalogOption, type CatalogOptionGroup, type ChangeEndUserPasswordDto, type CheckPropertyAvailabilityQuery, type CheckReservationAvailabilityQuery, type CompleteSignupDto, type ConnectedSource, type ContactMessage, type ContentPost, type CouponValidation, type CreateAddressDto, type CreateApiKeyDto, type CreateBroadcastDto, type CreateCatalogCategoryDto, type CreateCatalogOptionDto, type CreateCatalogOptionGroupDto, type CreateCatalogVariantDto, type CreateDeliveryAgentDto, type CreateDeliveryZoneDto, type CreateHelpArticleDto, type CreateIngredientDto, type CreateInstitutionDto, type CreateMealPlanDto, type CreateOrderDto, type CreatePaymentOrderDto, type CreatePropertyAmenityDto, type CreatePropertyBookingDto, type CreatePropertyPaymentOrderDto, type CreatePurchaseOrderDto, type CreateReservationDto, type CreateReservationSlotDto, type CreateReservationTableDto, type CreateReviewDto, type CreateRoleDto, type CreateStudentDiscountDto, type CreateSuperAdminDto, type CreateSupplierDto, type CreateSupportTicketDto, type CreateWasteLogDto, type CreateWatchRoomDto, type DeliveryCalculation, type DeliveryTracking, type DiscountPreview, type EarningsSummary, type EndUser, type EndUserProfile, type EndUserRequestResetDto, type EndUserResetPasswordDto, type EndUserSendOtpDto, type EndUserTagsDto, type EndUserVerifyOtpDto, type FulfillRewardDto, type GetCatalogItemsQuery, type GiftCard, type GoogleDriveCallbackDto, type GoogleDriveConnectUrl, type HelpArticle, type HostEarning, type Ingredient, type Institution, type InviteStaffUserDto, type JoinWatchRoomDto, type ListCatalogItemsQuery, type ListContentQuery, type ListEarningsQuery, type ListEndUsersQuery, type ListMoviesQuery, type ListOrdersQuery, type ListOrganizationsQuery, type ListReviewsQuery, type ListStaffUsersQuery, type ListStudentPassesQuery, type ListSuperAdminsQuery, type ListWatchRoomsQuery, type LocationHours, type LoginEndUserDto, type LoyaltyAccount, type LoyaltyRedemption, type LoyaltyReward, type LoyaltyTransaction, type MealPlan, type MealSubscription, type Movie, type MovieDetail, type Notification, type Order, type OrderItem, type OrderStatus, type OrderType, type PaginatedQuery, type PaginatedResponse, type PaginationParams, type PaymentMethod, type PaymentOrder, type PaymentVerification, type PlatformPlan, type PreviewStudentDiscountDto, type PreviewTemplateDto, type Promotion, type PropertyAvailability, type PropertyBooking, type PropertyPriceResolution, type PropertyType, type PurchaseGiftCardDto, type PurchaseOrder, type PurchaseOrderItem, type QueryMealSubscriptionsParams, type QueryPurchaseOrdersParams, type RawResponse, type RedeemGiftCardDto, type RedeemLoyaltyRewardDto, type ReferralInfo, type ReferralValidation, type RegisterEndUserDto, type ReorderDto, type ReplySupportTicketDto, type ReportOrderIssueDto, type RequestMagicLinkDto, type Reservation, type ReservationSlot, type ResolvePropertyPriceDto, type Review, type ReviewStudentPassDto, type Role, type ScheduleCampaignDto, ScopedClient, type SearchQuery, type SearchStatusQuery, type SetLocationHoursDto, type SetPropertyTypeAmenitiesDto, type SetSettingDto, type StaffAuthResponse, type StaffChangePasswordDto, type StaffLoginDto, type StaffRegisterDto, type StaffRequestPasswordResetDto, type StaffResetPasswordDto, type StaffSendOtpDto, type StaffUser, type StaffVerifyOtpDto, type StartSignupDto, type StartWatchSessionDto, type StatusQuery, type StockAlert, type StoreLocation, type StorefrontConfig, type StudentDiscount, type StudentPassStatus, type SubmitContactDto, type SubscribeBillingPlanDto, type SubscribeMealPlanDto, type SubscribeNewsletterDto, type SuperAdminLoginDto, type SuperAdminStats, type SuperAdmin as SuperAdminUser, type Supplier, type SupportReply, type SupportTicket, type SwitchWatchRoomModeDto, TZ, TZClient, type TZConfig, type TZInitOptions, TZPaginatedQuery, TZQuery, type TmdbMovie, type TmdbMovieDetail, type TokenStore, type TopUpWalletDto, type UpdateAddressDto, type UpdateApiKeyDto, type UpdateCartItemDto, type UpdateCatalogCategoryDto, type UpdateCatalogOptionDto, type UpdateCatalogOptionGroupDto, type UpdateCatalogVariantDto, type UpdateDeliveryAgentDto, type UpdateDeliveryZoneDto, type UpdateEndUserProfileDto, type UpdateHelpArticleDto, type UpdateHousekeepingDto, type UpdateIngredientDto, type UpdateInstitutionDto, type UpdateMealPlanDto, type UpdateMovieProgressDto, type UpdateOrderStatusDto, type UpdateOrgDto, type UpdatePopupSettingsDto, type UpdatePurchaseOrderDto, type UpdateReservationSlotDto, type UpdateReservationStatusDto, type UpdateReservationTableDto, type UpdateReviewStatusDto, type UpdateRoleDto, type UpdateStaffUserDto, type UpdateStudentDiscountDto, type UpdateSupplierDto, type UpdateSupportTicketDto, type UploadResult, type ValidateCouponDto, type ValidateReferralDto, type VerifyMagicLinkQuery, type VerifyPaymentDto, type VerifySignupOtpDto, type WalletBalance, type WalletPack, type WalletTransaction, type WasteLog, type WatchRoom, type WatchRoomJoinResponse, type WatchRoomMessage, type WatchRoomPlaybackState, type WatchRoomPrivacy, type WatchRoomStatus, type WatchRoomVibe, type WatchRoomViewer, type WatchRoomViewerMode, type WatchSessionHistoryItem, type WatchSessionResponse, type WatchSessionStatus, type WatchSessionStatusType, type WatchSessionSummary, createTZ };
package/dist/index.d.ts CHANGED
@@ -25,28 +25,29 @@ interface AuthTokens {
25
25
  accessToken: string;
26
26
  refreshToken: string;
27
27
  }
28
+ /** EndUser as returned by all auth flows (register, login, verifyOtp, completeSignup, socialLogin) */
28
29
  interface EndUser {
29
30
  id: string;
30
31
  name: string | null;
31
32
  email: string | null;
32
33
  phone: string | null;
33
34
  orgId: string;
34
- }
35
- interface EndUserProfile {
36
- id: string;
37
- name: string | null;
38
- email: string | null;
39
- phone: string | null;
40
- avatarUrl: string | null;
41
35
  isPhoneVerified: boolean;
42
36
  isEmailVerified: boolean;
37
+ onboardingStep: number;
38
+ avatarUrl: string | null;
43
39
  referralCode: string | null;
40
+ }
41
+ /** EndUser profile as returned by GET /storefront/auth/profile (includes createdAt) */
42
+ interface EndUserProfile extends EndUser {
44
43
  createdAt: string;
45
44
  }
46
45
  interface AuthResponse {
47
46
  accessToken: string;
48
47
  refreshToken: string;
49
48
  user: EndUser;
49
+ /** Only present on login — the org's configured primary login identifier */
50
+ primaryLoginId?: string;
50
51
  }
51
52
  /** Backend AuthUserDto — roles is string[] (role IDs) */
52
53
  interface StaffUser {
@@ -70,11 +71,55 @@ interface PaginationParams {
70
71
  }
71
72
  interface PaginatedResponse<T> {
72
73
  data: T[];
73
- total: number;
74
- page: number;
75
- limit: number;
76
- totalPages: number;
74
+ pagination: {
75
+ page: number;
76
+ limit: number;
77
+ total: number;
78
+ totalPages: number;
79
+ hasNextPage: boolean;
80
+ hasPrevPage: boolean;
81
+ };
82
+ }
83
+ interface ApiResponseEnvelope<T> {
84
+ success: true;
85
+ data: T;
86
+ message: string | null;
87
+ meta: {
88
+ timestamp: string;
89
+ requestId: string;
90
+ } | null;
77
91
  }
92
+ interface ApiPaginatedEnvelope<T> {
93
+ success: true;
94
+ data: T[];
95
+ pagination: {
96
+ page: number;
97
+ limit: number;
98
+ total: number;
99
+ totalPages: number;
100
+ hasNextPage: boolean;
101
+ hasPrevPage: boolean;
102
+ };
103
+ message: string | null;
104
+ meta: {
105
+ timestamp: string;
106
+ requestId: string;
107
+ } | null;
108
+ }
109
+ interface ApiErrorEnvelope {
110
+ success: false;
111
+ error: {
112
+ code: string;
113
+ message: string;
114
+ details: unknown | null;
115
+ };
116
+ meta: {
117
+ timestamp: string;
118
+ requestId: string;
119
+ } | null;
120
+ }
121
+ type ApiResult<T> = ApiResponseEnvelope<T> | ApiErrorEnvelope;
122
+ type ApiPaginatedResult<T> = ApiPaginatedEnvelope<T> | ApiErrorEnvelope;
78
123
  interface CatalogCategory {
79
124
  id: string;
80
125
  name: string;
@@ -154,21 +199,51 @@ type PaymentMethod = 'online' | 'cod' | 'wallet';
154
199
  type OrderStatus = 'pending' | 'confirmed' | 'preparing' | 'ready' | 'out_for_delivery' | 'delivered' | 'picked_up' | 'completed' | 'cancelled' | 'refunded';
155
200
  interface OrderItem {
156
201
  id: string;
157
- catalogItemId: string;
158
- name: string;
202
+ itemId: string;
203
+ itemName: string;
204
+ variantType: string;
205
+ sizeVariationId: string | null;
206
+ sizeVariationName: string | null;
159
207
  quantity: number;
160
208
  unitPrice: number;
161
209
  totalPrice: number;
210
+ taxAmount: number;
211
+ metadata: Record<string, unknown> | null;
212
+ options: {
213
+ id: string;
214
+ optionId: string;
215
+ optionName: string;
216
+ quantity: number;
217
+ unitPrice: number;
218
+ }[];
162
219
  }
163
220
  interface Order {
164
221
  id: string;
165
222
  orderNumber: string;
166
- status: OrderStatus;
167
- orderType: OrderType;
223
+ endUserId: string;
224
+ addressId: string | null;
225
+ locationId: string | null;
226
+ variantType: string;
227
+ status: string;
228
+ orderType: string;
229
+ paymentMethod: string | null;
230
+ customerName: string;
231
+ customerPhone: string;
232
+ customerEmail: string | null;
168
233
  subtotal: number;
234
+ taxAmount: number;
235
+ discountAmount: number;
169
236
  deliveryFee: number;
170
- discount: number;
171
- total: number;
237
+ packingCharges: number;
238
+ serviceCharge: number;
239
+ totalAmount: number;
240
+ couponCode: string | null;
241
+ loyaltyEarned: number;
242
+ loyaltyRedeemed: number;
243
+ tokenNumber: number | null;
244
+ specialInstructions: string | null;
245
+ scheduledAt: string | null;
246
+ channel: string;
172
247
  items: OrderItem[];
173
248
  createdAt: string;
174
249
  updatedAt: string;
@@ -261,8 +336,12 @@ interface LoyaltyRedemption {
261
336
  }
262
337
  interface CouponValidation {
263
338
  valid: boolean;
339
+ code: string;
340
+ name: string;
264
341
  discountType: string;
265
342
  discountValue: number;
343
+ maxDiscount: number | null;
344
+ calculatedDiscount: number;
266
345
  message: string;
267
346
  }
268
347
  interface Promotion {
@@ -342,16 +421,26 @@ interface ContentPost {
342
421
  id: string;
343
422
  title: string;
344
423
  slug: string;
424
+ h1: string | null;
345
425
  body: string;
346
426
  excerpt: string | null;
347
427
  imageUrl: string | null;
428
+ featuredImage: string | null;
429
+ ogImage: string | null;
348
430
  category: string | null;
349
431
  tags: string[];
350
432
  status: string;
433
+ author: string | null;
351
434
  authorId: string | null;
435
+ metaDescription: string | null;
436
+ keywords: string[];
437
+ canonical: string | null;
438
+ datePublished: string | null;
439
+ dateModified: string | null;
352
440
  metadata: Record<string, unknown> | null;
353
441
  publishedAt: string | null;
354
442
  createdAt: string;
443
+ updatedAt: string;
355
444
  }
356
445
  interface Address {
357
446
  id: string;
@@ -4134,4 +4223,4 @@ declare function createTZ(options?: TZInitOptions): {
4134
4223
  }>;
4135
4224
  };
4136
4225
 
4137
- export { type AddCartItemDto, type AddSegmentMembersDto, type Address, type AdjustLoyaltyPointsDto, type AdminAbandonedCart, type AdminAbandonedCartsQuery, type AdminAffiliate, type AdminBlogPost, type AdminBroadcast, type AdminCancelBookingDto, type AdminCoupon, type AdminCustomer, type AdminCustomerDetail, type AdminDashboardData, type AdminDashboardQuery, type AdminDashboardStats, type AdminDeliveryAgent, type AdminDeliveryZone, type AdminFinanceQuery, type AdminFulfillResult, type AdminGiftCard, type AdminGiftCardTransaction, type AdminHelpArticle, type AdminInstitution, type AdminInvoice, type AdminListOrdersQuery, type AdminLocation, type AdminLocationDetail, type AdminLoyaltyAccount, type AdminLoyaltyData, type AdminMealSubscription, type AdminMenuItem, type AdminOrder, type AdminOrderDetail, type AdminOrganization, type AdminPayout, type AdminPopupSettings, type AdminPromotion, type AdminRedemption, type AdminReservation, type AdminReservationSlot, type AdminReservationTable, type AdminReview, type AdminScheduledOrder, type AdminScheduledOrdersQuery, type AdminSetting, type AdminSettlement, type AdminStudentDiscount, type AdminStudentPass, type AdminStudentPassDetail, type AdminStudentPassStats, type AdminSyncLog, type AdminTaxSummary, type AdminTicket, type AdminTicketDetail, type AdminTicketMessage, type AdminWaitlistEntry, type AdminWaitlistGroup, type ApiError, type ApiKey, type ApplyStudentPassDto, type AssignPropertyUnitsDto, type AssignStaffRolesDto, type AuditLog, type AuthResponse, type AuthScope, type AuthTokens, type BulkReviewStudentPassesDto, type BulkUpdateSettingsDto, type BulkUpsertEndUsersDto, type CalculateDeliveryDto, type CancelPropertyBookingDto, type Cart, type CartItemOption, type CartLineItem, type CatalogCategory, type CatalogItem, type CatalogItemVariant, type CatalogOption, type CatalogOptionGroup, type ChangeEndUserPasswordDto, type CheckPropertyAvailabilityQuery, type CheckReservationAvailabilityQuery, type CompleteSignupDto, type ConnectedSource, type ContactMessage, type ContentPost, type CouponValidation, type CreateAddressDto, type CreateApiKeyDto, type CreateBroadcastDto, type CreateCatalogCategoryDto, type CreateCatalogOptionDto, type CreateCatalogOptionGroupDto, type CreateCatalogVariantDto, type CreateDeliveryAgentDto, type CreateDeliveryZoneDto, type CreateHelpArticleDto, type CreateIngredientDto, type CreateInstitutionDto, type CreateMealPlanDto, type CreateOrderDto, type CreatePaymentOrderDto, type CreatePropertyAmenityDto, type CreatePropertyBookingDto, type CreatePropertyPaymentOrderDto, type CreatePurchaseOrderDto, type CreateReservationDto, type CreateReservationSlotDto, type CreateReservationTableDto, type CreateReviewDto, type CreateRoleDto, type CreateStudentDiscountDto, type CreateSuperAdminDto, type CreateSupplierDto, type CreateSupportTicketDto, type CreateWasteLogDto, type CreateWatchRoomDto, type DeliveryCalculation, type DeliveryTracking, type DiscountPreview, type EarningsSummary, type EndUser, type EndUserProfile, type EndUserRequestResetDto, type EndUserResetPasswordDto, type EndUserSendOtpDto, type EndUserTagsDto, type EndUserVerifyOtpDto, type FulfillRewardDto, type GetCatalogItemsQuery, type GiftCard, type GoogleDriveCallbackDto, type GoogleDriveConnectUrl, type HelpArticle, type HostEarning, type Ingredient, type Institution, type InviteStaffUserDto, type JoinWatchRoomDto, type ListCatalogItemsQuery, type ListContentQuery, type ListEarningsQuery, type ListEndUsersQuery, type ListMoviesQuery, type ListOrdersQuery, type ListOrganizationsQuery, type ListReviewsQuery, type ListStaffUsersQuery, type ListStudentPassesQuery, type ListSuperAdminsQuery, type ListWatchRoomsQuery, type LocationHours, type LoginEndUserDto, type LoyaltyAccount, type LoyaltyRedemption, type LoyaltyReward, type LoyaltyTransaction, type MealPlan, type MealSubscription, type Movie, type MovieDetail, type Notification, type Order, type OrderItem, type OrderStatus, type OrderType, type PaginatedQuery, type PaginatedResponse, type PaginationParams, type PaymentMethod, type PaymentOrder, type PaymentVerification, type PlatformPlan, type PreviewStudentDiscountDto, type PreviewTemplateDto, type Promotion, type PropertyAvailability, type PropertyBooking, type PropertyPriceResolution, type PropertyType, type PurchaseGiftCardDto, type PurchaseOrder, type PurchaseOrderItem, type QueryMealSubscriptionsParams, type QueryPurchaseOrdersParams, type RawResponse, type RedeemGiftCardDto, type RedeemLoyaltyRewardDto, type ReferralInfo, type ReferralValidation, type RegisterEndUserDto, type ReorderDto, type ReplySupportTicketDto, type ReportOrderIssueDto, type RequestMagicLinkDto, type Reservation, type ReservationSlot, type ResolvePropertyPriceDto, type Review, type ReviewStudentPassDto, type Role, type ScheduleCampaignDto, ScopedClient, type SearchQuery, type SearchStatusQuery, type SetLocationHoursDto, type SetPropertyTypeAmenitiesDto, type SetSettingDto, type StaffAuthResponse, type StaffChangePasswordDto, type StaffLoginDto, type StaffRegisterDto, type StaffRequestPasswordResetDto, type StaffResetPasswordDto, type StaffSendOtpDto, type StaffUser, type StaffVerifyOtpDto, type StartSignupDto, type StartWatchSessionDto, type StatusQuery, type StockAlert, type StoreLocation, type StorefrontConfig, type StudentDiscount, type StudentPassStatus, type SubmitContactDto, type SubscribeBillingPlanDto, type SubscribeMealPlanDto, type SubscribeNewsletterDto, type SuperAdminLoginDto, type SuperAdminStats, type SuperAdmin as SuperAdminUser, type Supplier, type SupportReply, type SupportTicket, type SwitchWatchRoomModeDto, TZ, TZClient, type TZConfig, type TZInitOptions, TZPaginatedQuery, TZQuery, type TmdbMovie, type TmdbMovieDetail, type TokenStore, type TopUpWalletDto, type UpdateAddressDto, type UpdateApiKeyDto, type UpdateCartItemDto, type UpdateCatalogCategoryDto, type UpdateCatalogOptionDto, type UpdateCatalogOptionGroupDto, type UpdateCatalogVariantDto, type UpdateDeliveryAgentDto, type UpdateDeliveryZoneDto, type UpdateEndUserProfileDto, type UpdateHelpArticleDto, type UpdateHousekeepingDto, type UpdateIngredientDto, type UpdateInstitutionDto, type UpdateMealPlanDto, type UpdateMovieProgressDto, type UpdateOrderStatusDto, type UpdateOrgDto, type UpdatePopupSettingsDto, type UpdatePurchaseOrderDto, type UpdateReservationSlotDto, type UpdateReservationStatusDto, type UpdateReservationTableDto, type UpdateReviewStatusDto, type UpdateRoleDto, type UpdateStaffUserDto, type UpdateStudentDiscountDto, type UpdateSupplierDto, type UpdateSupportTicketDto, type UploadResult, type ValidateCouponDto, type ValidateReferralDto, type VerifyMagicLinkQuery, type VerifyPaymentDto, type VerifySignupOtpDto, type WalletBalance, type WalletPack, type WalletTransaction, type WasteLog, type WatchRoom, type WatchRoomJoinResponse, type WatchRoomMessage, type WatchRoomPlaybackState, type WatchRoomPrivacy, type WatchRoomStatus, type WatchRoomVibe, type WatchRoomViewer, type WatchRoomViewerMode, type WatchSessionHistoryItem, type WatchSessionResponse, type WatchSessionStatus, type WatchSessionStatusType, type WatchSessionSummary, createTZ };
4226
+ export { type AddCartItemDto, type AddSegmentMembersDto, type Address, type AdjustLoyaltyPointsDto, type AdminAbandonedCart, type AdminAbandonedCartsQuery, type AdminAffiliate, type AdminBlogPost, type AdminBroadcast, type AdminCancelBookingDto, type AdminCoupon, type AdminCustomer, type AdminCustomerDetail, type AdminDashboardData, type AdminDashboardQuery, type AdminDashboardStats, type AdminDeliveryAgent, type AdminDeliveryZone, type AdminFinanceQuery, type AdminFulfillResult, type AdminGiftCard, type AdminGiftCardTransaction, type AdminHelpArticle, type AdminInstitution, type AdminInvoice, type AdminListOrdersQuery, type AdminLocation, type AdminLocationDetail, type AdminLoyaltyAccount, type AdminLoyaltyData, type AdminMealSubscription, type AdminMenuItem, type AdminOrder, type AdminOrderDetail, type AdminOrganization, type AdminPayout, type AdminPopupSettings, type AdminPromotion, type AdminRedemption, type AdminReservation, type AdminReservationSlot, type AdminReservationTable, type AdminReview, type AdminScheduledOrder, type AdminScheduledOrdersQuery, type AdminSetting, type AdminSettlement, type AdminStudentDiscount, type AdminStudentPass, type AdminStudentPassDetail, type AdminStudentPassStats, type AdminSyncLog, type AdminTaxSummary, type AdminTicket, type AdminTicketDetail, type AdminTicketMessage, type AdminWaitlistEntry, type AdminWaitlistGroup, type ApiError, type ApiErrorEnvelope, type ApiKey, type ApiPaginatedEnvelope, type ApiPaginatedResult, type ApiResponseEnvelope, type ApiResult, type ApplyStudentPassDto, type AssignPropertyUnitsDto, type AssignStaffRolesDto, type AuditLog, type AuthResponse, type AuthScope, type AuthTokens, type BulkReviewStudentPassesDto, type BulkUpdateSettingsDto, type BulkUpsertEndUsersDto, type CalculateDeliveryDto, type CancelPropertyBookingDto, type Cart, type CartItemOption, type CartLineItem, type CatalogCategory, type CatalogItem, type CatalogItemVariant, type CatalogOption, type CatalogOptionGroup, type ChangeEndUserPasswordDto, type CheckPropertyAvailabilityQuery, type CheckReservationAvailabilityQuery, type CompleteSignupDto, type ConnectedSource, type ContactMessage, type ContentPost, type CouponValidation, type CreateAddressDto, type CreateApiKeyDto, type CreateBroadcastDto, type CreateCatalogCategoryDto, type CreateCatalogOptionDto, type CreateCatalogOptionGroupDto, type CreateCatalogVariantDto, type CreateDeliveryAgentDto, type CreateDeliveryZoneDto, type CreateHelpArticleDto, type CreateIngredientDto, type CreateInstitutionDto, type CreateMealPlanDto, type CreateOrderDto, type CreatePaymentOrderDto, type CreatePropertyAmenityDto, type CreatePropertyBookingDto, type CreatePropertyPaymentOrderDto, type CreatePurchaseOrderDto, type CreateReservationDto, type CreateReservationSlotDto, type CreateReservationTableDto, type CreateReviewDto, type CreateRoleDto, type CreateStudentDiscountDto, type CreateSuperAdminDto, type CreateSupplierDto, type CreateSupportTicketDto, type CreateWasteLogDto, type CreateWatchRoomDto, type DeliveryCalculation, type DeliveryTracking, type DiscountPreview, type EarningsSummary, type EndUser, type EndUserProfile, type EndUserRequestResetDto, type EndUserResetPasswordDto, type EndUserSendOtpDto, type EndUserTagsDto, type EndUserVerifyOtpDto, type FulfillRewardDto, type GetCatalogItemsQuery, type GiftCard, type GoogleDriveCallbackDto, type GoogleDriveConnectUrl, type HelpArticle, type HostEarning, type Ingredient, type Institution, type InviteStaffUserDto, type JoinWatchRoomDto, type ListCatalogItemsQuery, type ListContentQuery, type ListEarningsQuery, type ListEndUsersQuery, type ListMoviesQuery, type ListOrdersQuery, type ListOrganizationsQuery, type ListReviewsQuery, type ListStaffUsersQuery, type ListStudentPassesQuery, type ListSuperAdminsQuery, type ListWatchRoomsQuery, type LocationHours, type LoginEndUserDto, type LoyaltyAccount, type LoyaltyRedemption, type LoyaltyReward, type LoyaltyTransaction, type MealPlan, type MealSubscription, type Movie, type MovieDetail, type Notification, type Order, type OrderItem, type OrderStatus, type OrderType, type PaginatedQuery, type PaginatedResponse, type PaginationParams, type PaymentMethod, type PaymentOrder, type PaymentVerification, type PlatformPlan, type PreviewStudentDiscountDto, type PreviewTemplateDto, type Promotion, type PropertyAvailability, type PropertyBooking, type PropertyPriceResolution, type PropertyType, type PurchaseGiftCardDto, type PurchaseOrder, type PurchaseOrderItem, type QueryMealSubscriptionsParams, type QueryPurchaseOrdersParams, type RawResponse, type RedeemGiftCardDto, type RedeemLoyaltyRewardDto, type ReferralInfo, type ReferralValidation, type RegisterEndUserDto, type ReorderDto, type ReplySupportTicketDto, type ReportOrderIssueDto, type RequestMagicLinkDto, type Reservation, type ReservationSlot, type ResolvePropertyPriceDto, type Review, type ReviewStudentPassDto, type Role, type ScheduleCampaignDto, ScopedClient, type SearchQuery, type SearchStatusQuery, type SetLocationHoursDto, type SetPropertyTypeAmenitiesDto, type SetSettingDto, type StaffAuthResponse, type StaffChangePasswordDto, type StaffLoginDto, type StaffRegisterDto, type StaffRequestPasswordResetDto, type StaffResetPasswordDto, type StaffSendOtpDto, type StaffUser, type StaffVerifyOtpDto, type StartSignupDto, type StartWatchSessionDto, type StatusQuery, type StockAlert, type StoreLocation, type StorefrontConfig, type StudentDiscount, type StudentPassStatus, type SubmitContactDto, type SubscribeBillingPlanDto, type SubscribeMealPlanDto, type SubscribeNewsletterDto, type SuperAdminLoginDto, type SuperAdminStats, type SuperAdmin as SuperAdminUser, type Supplier, type SupportReply, type SupportTicket, type SwitchWatchRoomModeDto, TZ, TZClient, type TZConfig, type TZInitOptions, TZPaginatedQuery, TZQuery, type TmdbMovie, type TmdbMovieDetail, type TokenStore, type TopUpWalletDto, type UpdateAddressDto, type UpdateApiKeyDto, type UpdateCartItemDto, type UpdateCatalogCategoryDto, type UpdateCatalogOptionDto, type UpdateCatalogOptionGroupDto, type UpdateCatalogVariantDto, type UpdateDeliveryAgentDto, type UpdateDeliveryZoneDto, type UpdateEndUserProfileDto, type UpdateHelpArticleDto, type UpdateHousekeepingDto, type UpdateIngredientDto, type UpdateInstitutionDto, type UpdateMealPlanDto, type UpdateMovieProgressDto, type UpdateOrderStatusDto, type UpdateOrgDto, type UpdatePopupSettingsDto, type UpdatePurchaseOrderDto, type UpdateReservationSlotDto, type UpdateReservationStatusDto, type UpdateReservationTableDto, type UpdateReviewStatusDto, type UpdateRoleDto, type UpdateStaffUserDto, type UpdateStudentDiscountDto, type UpdateSupplierDto, type UpdateSupportTicketDto, type UploadResult, type ValidateCouponDto, type ValidateReferralDto, type VerifyMagicLinkQuery, type VerifyPaymentDto, type VerifySignupOtpDto, type WalletBalance, type WalletPack, type WalletTransaction, type WasteLog, type WatchRoom, type WatchRoomJoinResponse, type WatchRoomMessage, type WatchRoomPlaybackState, type WatchRoomPrivacy, type WatchRoomStatus, type WatchRoomVibe, type WatchRoomViewer, type WatchRoomViewerMode, type WatchSessionHistoryItem, type WatchSessionResponse, type WatchSessionStatus, type WatchSessionStatusType, type WatchSessionSummary, createTZ };
package/dist/index.js CHANGED
@@ -68,7 +68,7 @@ var TZPaginatedQuery = class extends TZQuery {
68
68
  /** Check if there's a next page (must await first) */
69
69
  async hasNext() {
70
70
  const result = await this.data();
71
- return this._page < result.totalPages;
71
+ return result.pagination.hasNextPage;
72
72
  }
73
73
  /** Check if there's a previous page */
74
74
  hasPrev() {
@@ -370,12 +370,18 @@ var ScopedClient = class {
370
370
  const merged = { ...params, page: p, limit: l };
371
371
  const qs = toQs(merged);
372
372
  const fp = this.fullPath(`${path}${qs}`);
373
- return new TZPaginatedQuery(
374
- (signal) => this.root.rawRequest("GET", fp, { scope, signal, sendOrgKey: this.sendOrgKey }),
375
- p,
376
- l,
377
- factory
378
- );
373
+ const executor = async (signal) => {
374
+ const rawRes = await this.root.rawRequest("GET", fp, { scope, signal, sendOrgKey: this.sendOrgKey });
375
+ const envelope = rawRes.raw;
376
+ const pagination = envelope.pagination ?? { page: p, limit: l, total: 0, totalPages: 0, hasNextPage: false, hasPrevPage: false };
377
+ return {
378
+ data: { data: rawRes.data, pagination },
379
+ raw: rawRes.raw,
380
+ status: rawRes.status,
381
+ headers: rawRes.headers
382
+ };
383
+ };
384
+ return new TZPaginatedQuery(executor, p, l, factory);
379
385
  };
380
386
  return factory(page, limit);
381
387
  }