@myrjfa/state 2.2.0 → 2.3.2

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.
Files changed (117) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +20 -3
  3. package/dist/index.d.ts +8 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +8 -0
  6. package/dist/lib/actions/actions.d.ts +13 -13
  7. package/dist/lib/actions/actions.d.ts.map +1 -1
  8. package/dist/lib/actions/actions.js +5 -4
  9. package/dist/lib/actions/auth.d.ts +116 -7
  10. package/dist/lib/actions/auth.d.ts.map +1 -1
  11. package/dist/lib/actions/auth.js +59 -10
  12. package/dist/lib/actions/chat.d.ts +261 -24
  13. package/dist/lib/actions/chat.d.ts.map +1 -1
  14. package/dist/lib/actions/chat.js +525 -41
  15. package/dist/lib/actions/fetcher.d.ts.map +1 -1
  16. package/dist/lib/actions/fetcher.js +26 -9
  17. package/dist/lib/actions/serverActions.d.ts +1 -0
  18. package/dist/lib/actions/serverActions.d.ts.map +1 -1
  19. package/dist/lib/actions/serverActions.js +15 -0
  20. package/dist/lib/actions/socket.d.ts.map +1 -1
  21. package/dist/lib/actions/socket.js +5 -1
  22. package/dist/lib/actions.d.ts +26 -26
  23. package/dist/lib/actions.d.ts.map +1 -1
  24. package/dist/lib/actions.js +17 -12
  25. package/dist/lib/adminDashboardActions.d.ts +15 -3
  26. package/dist/lib/adminDashboardActions.d.ts.map +1 -1
  27. package/dist/lib/adminDashboardActions.js +16 -7
  28. package/dist/lib/authSessionManager.d.ts.map +1 -1
  29. package/dist/lib/authSessionManager.js +77 -12
  30. package/dist/lib/authSessionPolicy.d.ts +44 -0
  31. package/dist/lib/authSessionPolicy.d.ts.map +1 -0
  32. package/dist/lib/authSessionPolicy.js +61 -0
  33. package/dist/lib/authorizationActions.d.ts +77 -0
  34. package/dist/lib/authorizationActions.d.ts.map +1 -0
  35. package/dist/lib/authorizationActions.js +61 -0
  36. package/dist/lib/context/ChatContext.d.ts +25 -6
  37. package/dist/lib/context/ChatContext.d.ts.map +1 -1
  38. package/dist/lib/context/ChatContext.js +356 -245
  39. package/dist/lib/discountActions.d.ts +43 -0
  40. package/dist/lib/discountActions.d.ts.map +1 -0
  41. package/dist/lib/discountActions.js +69 -0
  42. package/dist/lib/loyaltyActions.d.ts +32 -0
  43. package/dist/lib/loyaltyActions.d.ts.map +1 -0
  44. package/dist/lib/loyaltyActions.js +92 -0
  45. package/dist/lib/models/adventure.d.ts +0 -2
  46. package/dist/lib/models/adventure.d.ts.map +1 -1
  47. package/dist/lib/models/authorization.d.ts +108 -0
  48. package/dist/lib/models/authorization.d.ts.map +1 -0
  49. package/dist/lib/models/authorization.js +266 -0
  50. package/dist/lib/models/blog.d.ts +6 -6
  51. package/dist/lib/models/booking.d.ts +7 -2
  52. package/dist/lib/models/booking.d.ts.map +1 -1
  53. package/dist/lib/models/chat.d.ts +418 -32
  54. package/dist/lib/models/chat.d.ts.map +1 -1
  55. package/dist/lib/models/chat.js +5 -1
  56. package/dist/lib/models/discount.d.ts +589 -138
  57. package/dist/lib/models/discount.d.ts.map +1 -1
  58. package/dist/lib/models/discount.js +118 -96
  59. package/dist/lib/models/guide.d.ts +0 -2
  60. package/dist/lib/models/guide.d.ts.map +1 -1
  61. package/dist/lib/models/loyalty.d.ts +88 -0
  62. package/dist/lib/models/loyalty.d.ts.map +1 -0
  63. package/dist/lib/models/loyalty.js +1 -0
  64. package/dist/lib/models/notifications.d.ts +6 -6
  65. package/dist/lib/models/opportunities/freelance.d.ts +66 -20
  66. package/dist/lib/models/opportunities/freelance.d.ts.map +1 -1
  67. package/dist/lib/models/opportunities/internship.d.ts +66 -20
  68. package/dist/lib/models/opportunities/internship.d.ts.map +1 -1
  69. package/dist/lib/models/opportunities/job.d.ts +66 -20
  70. package/dist/lib/models/opportunities/job.d.ts.map +1 -1
  71. package/dist/lib/models/opportunities/opportunity.d.ts +66 -20
  72. package/dist/lib/models/opportunities/opportunity.d.ts.map +1 -1
  73. package/dist/lib/models/opportunities/opportunity.js +2 -0
  74. package/dist/lib/models/opportunities/volunteerJob.d.ts +66 -20
  75. package/dist/lib/models/opportunities/volunteerJob.d.ts.map +1 -1
  76. package/dist/lib/models/package.d.ts +77 -216
  77. package/dist/lib/models/package.d.ts.map +1 -1
  78. package/dist/lib/models/package.js +0 -2
  79. package/dist/lib/models/portfolio.d.ts +2 -2
  80. package/dist/lib/models/pricing.d.ts +12 -12
  81. package/dist/lib/models/props.d.ts +1 -1
  82. package/dist/lib/models/props.d.ts.map +1 -1
  83. package/dist/lib/models/rental.d.ts +0 -2
  84. package/dist/lib/models/rental.d.ts.map +1 -1
  85. package/dist/lib/models/review.d.ts +2 -2
  86. package/dist/lib/models/stay.d.ts +17 -17
  87. package/dist/lib/models/store.d.ts +71 -0
  88. package/dist/lib/models/store.d.ts.map +1 -0
  89. package/dist/lib/models/store.js +1 -0
  90. package/dist/lib/models/tile.d.ts +0 -2
  91. package/dist/lib/models/tile.d.ts.map +1 -1
  92. package/dist/lib/models/travelPackage.d.ts +211 -310
  93. package/dist/lib/models/travelPackage.d.ts.map +1 -1
  94. package/dist/lib/models/travelPackage.js +0 -2
  95. package/dist/lib/models/user.d.ts +32 -8
  96. package/dist/lib/models/user.d.ts.map +1 -1
  97. package/dist/lib/models/user.js +10 -1
  98. package/dist/lib/opportunityFormPage.d.ts +1 -0
  99. package/dist/lib/opportunityFormPage.d.ts.map +1 -1
  100. package/dist/lib/opportunityFormPage.js +1 -0
  101. package/dist/lib/rentalActions.js +0 -1
  102. package/dist/lib/rentalDummyData.d.ts.map +1 -1
  103. package/dist/lib/rentalDummyData.js +0 -35
  104. package/dist/lib/rentalFormPage.d.ts +0 -2
  105. package/dist/lib/rentalFormPage.d.ts.map +1 -1
  106. package/dist/lib/rentalFormPage.js +0 -3
  107. package/dist/lib/storeActions.d.ts +25 -0
  108. package/dist/lib/storeActions.d.ts.map +1 -0
  109. package/dist/lib/storeActions.js +46 -0
  110. package/dist/lib/storeDummyData.d.ts +2 -26
  111. package/dist/lib/storeDummyData.d.ts.map +1 -1
  112. package/dist/lib/userAtom.d.ts +178 -42
  113. package/dist/lib/userAtom.d.ts.map +1 -1
  114. package/dist/lib/userAtom.js +80 -52
  115. package/dist/lib/utils.d.ts.map +1 -1
  116. package/dist/lib/utils.js +1 -1
  117. package/package.json +4 -2
@@ -1,160 +1,611 @@
1
1
  import { z } from "zod";
2
+ export declare const DiscountFeatureTypeSchema: z.ZodEnum<["stay", "rental", "adventure", "event", "package", "guide", "store"]>;
3
+ export declare const DiscountStrategyTypeSchema: z.ZodEnum<["duration", "early_booking", "last_minute", "scheduled", "recurring", "group", "quantity", "coupon", "first_booking", "checkout_recovery", "payment_offer", "partner"]>;
4
+ export declare const DiscountOriginSchema: z.ZodEnum<["host", "staff_suggestion", "staff_campaign"]>;
5
+ export declare const DiscountStatusSchema: z.ZodEnum<["draft", "suggested", "active", "paused", "rejected", "expired", "archived"]>;
6
+ export declare const DiscountStackingGroupSchema: z.ZodEnum<["automatic", "coupon", "payment", "partner", "recovery"]>;
7
+ export declare const DiscountFundingSchema: z.ZodObject<{
8
+ hostPercentagePoints: z.ZodDefault<z.ZodNumber>;
9
+ platformPercentagePoints: z.ZodDefault<z.ZodNumber>;
10
+ partnerPercentagePoints: z.ZodDefault<z.ZodNumber>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ hostPercentagePoints: number;
13
+ platformPercentagePoints: number;
14
+ partnerPercentagePoints: number;
15
+ }, {
16
+ hostPercentagePoints?: number | undefined;
17
+ platformPercentagePoints?: number | undefined;
18
+ partnerPercentagePoints?: number | undefined;
19
+ }>;
20
+ export declare const DiscountConditionsSchema: z.ZodObject<{
21
+ minUnits: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
22
+ maxUnits: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
23
+ minQuantity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
24
+ minParticipants: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
25
+ minSubtotal: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
26
+ bookingLeadMinMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
27
+ bookingLeadMaxMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
28
+ bookingStartsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
29
+ bookingEndsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
+ serviceStartsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
31
+ serviceEndsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
+ recurringDays: z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>;
33
+ recurringStartTime: z.ZodOptional<z.ZodString>;
34
+ recurringEndTime: z.ZodOptional<z.ZodString>;
35
+ timezone: z.ZodDefault<z.ZodString>;
36
+ firstBookingOnly: z.ZodDefault<z.ZodBoolean>;
37
+ checkoutDelayMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
38
+ paymentMethods: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
39
+ cardTypes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
40
+ issuers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
41
+ networks: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
42
+ partnerProgramIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
43
+ }, "strip", z.ZodTypeAny, {
44
+ recurringDays: number[];
45
+ timezone: string;
46
+ firstBookingOnly: boolean;
47
+ paymentMethods: string[];
48
+ cardTypes: string[];
49
+ issuers: string[];
50
+ networks: string[];
51
+ partnerProgramIds: string[];
52
+ minUnits?: number | null | undefined;
53
+ maxUnits?: number | null | undefined;
54
+ minQuantity?: number | null | undefined;
55
+ minParticipants?: number | null | undefined;
56
+ minSubtotal?: number | null | undefined;
57
+ bookingLeadMinMinutes?: number | null | undefined;
58
+ bookingLeadMaxMinutes?: number | null | undefined;
59
+ bookingStartsAt?: string | null | undefined;
60
+ bookingEndsAt?: string | null | undefined;
61
+ serviceStartsAt?: string | null | undefined;
62
+ serviceEndsAt?: string | null | undefined;
63
+ recurringStartTime?: string | undefined;
64
+ recurringEndTime?: string | undefined;
65
+ checkoutDelayMinutes?: number | null | undefined;
66
+ }, {
67
+ minUnits?: number | null | undefined;
68
+ maxUnits?: number | null | undefined;
69
+ minQuantity?: number | null | undefined;
70
+ minParticipants?: number | null | undefined;
71
+ minSubtotal?: number | null | undefined;
72
+ bookingLeadMinMinutes?: number | null | undefined;
73
+ bookingLeadMaxMinutes?: number | null | undefined;
74
+ bookingStartsAt?: string | null | undefined;
75
+ bookingEndsAt?: string | null | undefined;
76
+ serviceStartsAt?: string | null | undefined;
77
+ serviceEndsAt?: string | null | undefined;
78
+ recurringDays?: number[] | undefined;
79
+ recurringStartTime?: string | undefined;
80
+ recurringEndTime?: string | undefined;
81
+ timezone?: string | undefined;
82
+ firstBookingOnly?: boolean | undefined;
83
+ checkoutDelayMinutes?: number | null | undefined;
84
+ paymentMethods?: string[] | undefined;
85
+ cardTypes?: string[] | undefined;
86
+ issuers?: string[] | undefined;
87
+ networks?: string[] | undefined;
88
+ partnerProgramIds?: string[] | undefined;
89
+ }>;
2
90
  export declare const DiscountStrategySchema: z.ZodObject<{
3
- type: z.ZodDefault<z.ZodEnum<["duration", "last-minute", "temporary-promotion", "coupon"]>>;
4
- couponCode: z.ZodOptional<z.ZodString>;
5
- couponScope: z.ZodOptional<z.ZodEnum<["listing", "host", "platform"]>>;
6
- discountAppliesTo: z.ZodOptional<z.ZodEnum<["booking-total", "platform-fees"]>>;
7
- createdBy: z.ZodOptional<z.ZodEnum<["admin", "host"]>>;
8
- maxRedemptions: z.ZodOptional<z.ZodNumber>;
9
- maxRedemptionsPerUser: z.ZodOptional<z.ZodNumber>;
10
- minimumOrderValue: z.ZodOptional<z.ZodNumber>;
11
- durationType: z.ZodDefault<z.ZodEnum<["weekly", "fifteen-days", "monthly", "custom", ""]>>;
12
- minDays: z.ZodDefault<z.ZodNumber>;
13
- discountType: z.ZodDefault<z.ZodEnum<["percentage", "flat"]>>;
14
- discountValue: z.ZodDefault<z.ZodNumber>;
15
- startDate: z.ZodOptional<z.ZodString>;
16
- endDate: z.ZodOptional<z.ZodString>;
91
+ _id: z.ZodOptional<z.ZodString>;
92
+ name: z.ZodString;
17
93
  description: z.ZodDefault<z.ZodString>;
18
- suggestedByPlatform: z.ZodDefault<z.ZodBoolean>;
19
- active: z.ZodDefault<z.ZodBoolean>;
94
+ strategyType: z.ZodEnum<["duration", "early_booking", "last_minute", "scheduled", "recurring", "group", "quantity", "coupon", "first_booking", "checkout_recovery", "payment_offer", "partner"]>;
95
+ origin: z.ZodEnum<["host", "staff_suggestion", "staff_campaign"]>;
96
+ status: z.ZodDefault<z.ZodEnum<["draft", "suggested", "active", "paused", "rejected", "expired", "archived"]>>;
97
+ sourceStrategyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
98
+ hostId: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodObject<{
99
+ _id: z.ZodString;
100
+ }, "strip", z.ZodTypeAny, {
101
+ _id: string;
102
+ }, {
103
+ _id: string;
104
+ }>]>>>;
105
+ targetScope: z.ZodDefault<z.ZodEnum<["platform", "host", "listing", "subtarget"]>>;
106
+ featureTypes: z.ZodDefault<z.ZodArray<z.ZodEnum<["stay", "rental", "adventure", "event", "package", "guide", "store"]>, "many">>;
107
+ targetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
108
+ targetIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
109
+ subTargetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
110
+ pricingStrategyIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
111
+ percentage: z.ZodNumber;
112
+ funding: z.ZodObject<{
113
+ hostPercentagePoints: z.ZodDefault<z.ZodNumber>;
114
+ platformPercentagePoints: z.ZodDefault<z.ZodNumber>;
115
+ partnerPercentagePoints: z.ZodDefault<z.ZodNumber>;
116
+ }, "strip", z.ZodTypeAny, {
117
+ hostPercentagePoints: number;
118
+ platformPercentagePoints: number;
119
+ partnerPercentagePoints: number;
120
+ }, {
121
+ hostPercentagePoints?: number | undefined;
122
+ platformPercentagePoints?: number | undefined;
123
+ partnerPercentagePoints?: number | undefined;
124
+ }>;
125
+ conditions: z.ZodDefault<z.ZodObject<{
126
+ minUnits: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
127
+ maxUnits: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
128
+ minQuantity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
129
+ minParticipants: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
130
+ minSubtotal: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
131
+ bookingLeadMinMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
132
+ bookingLeadMaxMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
133
+ bookingStartsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
134
+ bookingEndsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
135
+ serviceStartsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
136
+ serviceEndsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
137
+ recurringDays: z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>;
138
+ recurringStartTime: z.ZodOptional<z.ZodString>;
139
+ recurringEndTime: z.ZodOptional<z.ZodString>;
140
+ timezone: z.ZodDefault<z.ZodString>;
141
+ firstBookingOnly: z.ZodDefault<z.ZodBoolean>;
142
+ checkoutDelayMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
143
+ paymentMethods: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
144
+ cardTypes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
145
+ issuers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
146
+ networks: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
147
+ partnerProgramIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
148
+ }, "strip", z.ZodTypeAny, {
149
+ recurringDays: number[];
150
+ timezone: string;
151
+ firstBookingOnly: boolean;
152
+ paymentMethods: string[];
153
+ cardTypes: string[];
154
+ issuers: string[];
155
+ networks: string[];
156
+ partnerProgramIds: string[];
157
+ minUnits?: number | null | undefined;
158
+ maxUnits?: number | null | undefined;
159
+ minQuantity?: number | null | undefined;
160
+ minParticipants?: number | null | undefined;
161
+ minSubtotal?: number | null | undefined;
162
+ bookingLeadMinMinutes?: number | null | undefined;
163
+ bookingLeadMaxMinutes?: number | null | undefined;
164
+ bookingStartsAt?: string | null | undefined;
165
+ bookingEndsAt?: string | null | undefined;
166
+ serviceStartsAt?: string | null | undefined;
167
+ serviceEndsAt?: string | null | undefined;
168
+ recurringStartTime?: string | undefined;
169
+ recurringEndTime?: string | undefined;
170
+ checkoutDelayMinutes?: number | null | undefined;
171
+ }, {
172
+ minUnits?: number | null | undefined;
173
+ maxUnits?: number | null | undefined;
174
+ minQuantity?: number | null | undefined;
175
+ minParticipants?: number | null | undefined;
176
+ minSubtotal?: number | null | undefined;
177
+ bookingLeadMinMinutes?: number | null | undefined;
178
+ bookingLeadMaxMinutes?: number | null | undefined;
179
+ bookingStartsAt?: string | null | undefined;
180
+ bookingEndsAt?: string | null | undefined;
181
+ serviceStartsAt?: string | null | undefined;
182
+ serviceEndsAt?: string | null | undefined;
183
+ recurringDays?: number[] | undefined;
184
+ recurringStartTime?: string | undefined;
185
+ recurringEndTime?: string | undefined;
186
+ timezone?: string | undefined;
187
+ firstBookingOnly?: boolean | undefined;
188
+ checkoutDelayMinutes?: number | null | undefined;
189
+ paymentMethods?: string[] | undefined;
190
+ cardTypes?: string[] | undefined;
191
+ issuers?: string[] | undefined;
192
+ networks?: string[] | undefined;
193
+ partnerProgramIds?: string[] | undefined;
194
+ }>>;
195
+ stacking: z.ZodDefault<z.ZodObject<{
196
+ group: z.ZodDefault<z.ZodEnum<["automatic", "coupon", "payment", "partner", "recovery"]>>;
197
+ priority: z.ZodDefault<z.ZodNumber>;
198
+ compatibleGroups: z.ZodDefault<z.ZodArray<z.ZodEnum<["automatic", "coupon", "payment", "partner", "recovery"]>, "many">>;
199
+ }, "strip", z.ZodTypeAny, {
200
+ group: "payment" | "coupon" | "partner" | "automatic" | "recovery";
201
+ priority: number;
202
+ compatibleGroups: ("payment" | "coupon" | "partner" | "automatic" | "recovery")[];
203
+ }, {
204
+ group?: "payment" | "coupon" | "partner" | "automatic" | "recovery" | undefined;
205
+ priority?: number | undefined;
206
+ compatibleGroups?: ("payment" | "coupon" | "partner" | "automatic" | "recovery")[] | undefined;
207
+ }>>;
208
+ usageLimits: z.ZodDefault<z.ZodObject<{
209
+ total: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
210
+ perUser: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
211
+ }, "strip", z.ZodTypeAny, {
212
+ total?: number | null | undefined;
213
+ perUser?: number | null | undefined;
214
+ }, {
215
+ total?: number | null | undefined;
216
+ perUser?: number | null | undefined;
217
+ }>>;
218
+ redemptionCount: z.ZodDefault<z.ZodNumber>;
219
+ couponCode: z.ZodOptional<z.ZodString>;
220
+ couponPreview: z.ZodOptional<z.ZodString>;
221
+ razorpayOfferId: z.ZodOptional<z.ZodString>;
222
+ createdAt: z.ZodOptional<z.ZodString>;
223
+ updatedAt: z.ZodOptional<z.ZodString>;
20
224
  }, "strip", z.ZodTypeAny, {
21
- type: "duration" | "last-minute" | "temporary-promotion" | "coupon";
225
+ status: "draft" | "archived" | "rejected" | "suggested" | "active" | "paused" | "expired";
226
+ name: string;
22
227
  description: string;
23
- durationType: "" | "custom" | "weekly" | "monthly" | "fifteen-days";
24
- minDays: number;
25
- discountType: "flat" | "percentage";
26
- discountValue: number;
27
- suggestedByPlatform: boolean;
28
- active: boolean;
228
+ strategyType: "duration" | "group" | "early_booking" | "last_minute" | "scheduled" | "recurring" | "quantity" | "coupon" | "first_booking" | "checkout_recovery" | "payment_offer" | "partner";
229
+ origin: "host" | "staff_suggestion" | "staff_campaign";
230
+ targetScope: "host" | "platform" | "listing" | "subtarget";
231
+ featureTypes: ("package" | "rental" | "adventure" | "guide" | "stay" | "event" | "store")[];
232
+ targetIds: string[];
233
+ pricingStrategyIds: string[];
234
+ percentage: number;
235
+ funding: {
236
+ hostPercentagePoints: number;
237
+ platformPercentagePoints: number;
238
+ partnerPercentagePoints: number;
239
+ };
240
+ conditions: {
241
+ recurringDays: number[];
242
+ timezone: string;
243
+ firstBookingOnly: boolean;
244
+ paymentMethods: string[];
245
+ cardTypes: string[];
246
+ issuers: string[];
247
+ networks: string[];
248
+ partnerProgramIds: string[];
249
+ minUnits?: number | null | undefined;
250
+ maxUnits?: number | null | undefined;
251
+ minQuantity?: number | null | undefined;
252
+ minParticipants?: number | null | undefined;
253
+ minSubtotal?: number | null | undefined;
254
+ bookingLeadMinMinutes?: number | null | undefined;
255
+ bookingLeadMaxMinutes?: number | null | undefined;
256
+ bookingStartsAt?: string | null | undefined;
257
+ bookingEndsAt?: string | null | undefined;
258
+ serviceStartsAt?: string | null | undefined;
259
+ serviceEndsAt?: string | null | undefined;
260
+ recurringStartTime?: string | undefined;
261
+ recurringEndTime?: string | undefined;
262
+ checkoutDelayMinutes?: number | null | undefined;
263
+ };
264
+ stacking: {
265
+ group: "payment" | "coupon" | "partner" | "automatic" | "recovery";
266
+ priority: number;
267
+ compatibleGroups: ("payment" | "coupon" | "partner" | "automatic" | "recovery")[];
268
+ };
269
+ usageLimits: {
270
+ total?: number | null | undefined;
271
+ perUser?: number | null | undefined;
272
+ };
273
+ redemptionCount: number;
274
+ _id?: string | undefined;
275
+ createdAt?: string | undefined;
276
+ updatedAt?: string | undefined;
277
+ hostId?: string | {
278
+ _id: string;
279
+ } | null | undefined;
280
+ sourceStrategyId?: string | null | undefined;
281
+ targetId?: string | null | undefined;
282
+ subTargetId?: string | null | undefined;
29
283
  couponCode?: string | undefined;
30
- couponScope?: "host" | "listing" | "platform" | undefined;
31
- discountAppliesTo?: "booking-total" | "platform-fees" | undefined;
32
- createdBy?: "host" | "admin" | undefined;
33
- maxRedemptions?: number | undefined;
34
- maxRedemptionsPerUser?: number | undefined;
35
- minimumOrderValue?: number | undefined;
36
- startDate?: string | undefined;
37
- endDate?: string | undefined;
284
+ couponPreview?: string | undefined;
285
+ razorpayOfferId?: string | undefined;
38
286
  }, {
39
- type?: "duration" | "last-minute" | "temporary-promotion" | "coupon" | undefined;
287
+ name: string;
288
+ strategyType: "duration" | "group" | "early_booking" | "last_minute" | "scheduled" | "recurring" | "quantity" | "coupon" | "first_booking" | "checkout_recovery" | "payment_offer" | "partner";
289
+ origin: "host" | "staff_suggestion" | "staff_campaign";
290
+ percentage: number;
291
+ funding: {
292
+ hostPercentagePoints?: number | undefined;
293
+ platformPercentagePoints?: number | undefined;
294
+ partnerPercentagePoints?: number | undefined;
295
+ };
296
+ _id?: string | undefined;
297
+ status?: "draft" | "archived" | "rejected" | "suggested" | "active" | "paused" | "expired" | undefined;
40
298
  description?: string | undefined;
299
+ createdAt?: string | undefined;
300
+ updatedAt?: string | undefined;
301
+ hostId?: string | {
302
+ _id: string;
303
+ } | null | undefined;
304
+ sourceStrategyId?: string | null | undefined;
305
+ targetScope?: "host" | "platform" | "listing" | "subtarget" | undefined;
306
+ featureTypes?: ("package" | "rental" | "adventure" | "guide" | "stay" | "event" | "store")[] | undefined;
307
+ targetId?: string | null | undefined;
308
+ targetIds?: string[] | undefined;
309
+ subTargetId?: string | null | undefined;
310
+ pricingStrategyIds?: string[] | undefined;
311
+ conditions?: {
312
+ minUnits?: number | null | undefined;
313
+ maxUnits?: number | null | undefined;
314
+ minQuantity?: number | null | undefined;
315
+ minParticipants?: number | null | undefined;
316
+ minSubtotal?: number | null | undefined;
317
+ bookingLeadMinMinutes?: number | null | undefined;
318
+ bookingLeadMaxMinutes?: number | null | undefined;
319
+ bookingStartsAt?: string | null | undefined;
320
+ bookingEndsAt?: string | null | undefined;
321
+ serviceStartsAt?: string | null | undefined;
322
+ serviceEndsAt?: string | null | undefined;
323
+ recurringDays?: number[] | undefined;
324
+ recurringStartTime?: string | undefined;
325
+ recurringEndTime?: string | undefined;
326
+ timezone?: string | undefined;
327
+ firstBookingOnly?: boolean | undefined;
328
+ checkoutDelayMinutes?: number | null | undefined;
329
+ paymentMethods?: string[] | undefined;
330
+ cardTypes?: string[] | undefined;
331
+ issuers?: string[] | undefined;
332
+ networks?: string[] | undefined;
333
+ partnerProgramIds?: string[] | undefined;
334
+ } | undefined;
335
+ stacking?: {
336
+ group?: "payment" | "coupon" | "partner" | "automatic" | "recovery" | undefined;
337
+ priority?: number | undefined;
338
+ compatibleGroups?: ("payment" | "coupon" | "partner" | "automatic" | "recovery")[] | undefined;
339
+ } | undefined;
340
+ usageLimits?: {
341
+ total?: number | null | undefined;
342
+ perUser?: number | null | undefined;
343
+ } | undefined;
344
+ redemptionCount?: number | undefined;
345
+ couponCode?: string | undefined;
346
+ couponPreview?: string | undefined;
347
+ razorpayOfferId?: string | undefined;
348
+ }>;
349
+ export declare const DiscountQuoteRequestSchema: z.ZodObject<{
350
+ featureType: z.ZodEnum<["stay", "rental", "adventure", "event", "package", "guide", "store"]>;
351
+ targetId: z.ZodString;
352
+ subTargetId: z.ZodOptional<z.ZodString>;
353
+ pricingStrategyId: z.ZodOptional<z.ZodString>;
354
+ selectedPricingIndex: z.ZodOptional<z.ZodNumber>;
355
+ quantity: z.ZodOptional<z.ZodNumber>;
356
+ participants: z.ZodOptional<z.ZodNumber>;
357
+ startDate: z.ZodOptional<z.ZodString>;
358
+ endDate: z.ZodOptional<z.ZodString>;
359
+ startTime: z.ZodOptional<z.ZodString>;
360
+ pickupTime: z.ZodOptional<z.ZodString>;
361
+ orderType: z.ZodOptional<z.ZodEnum<["purchase", "rental"]>>;
362
+ activityTotal: z.ZodOptional<z.ZodNumber>;
363
+ couponCode: z.ZodOptional<z.ZodString>;
364
+ checkoutStartedAt: z.ZodOptional<z.ZodString>;
365
+ }, "strip", z.ZodTypeAny, {
366
+ featureType: "package" | "rental" | "adventure" | "guide" | "stay" | "event" | "store";
367
+ targetId: string;
368
+ startDate?: string | undefined;
369
+ endDate?: string | undefined;
370
+ quantity?: number | undefined;
371
+ subTargetId?: string | undefined;
41
372
  couponCode?: string | undefined;
42
- couponScope?: "host" | "listing" | "platform" | undefined;
43
- discountAppliesTo?: "booking-total" | "platform-fees" | undefined;
44
- createdBy?: "host" | "admin" | undefined;
45
- maxRedemptions?: number | undefined;
46
- maxRedemptionsPerUser?: number | undefined;
47
- minimumOrderValue?: number | undefined;
48
- durationType?: "" | "custom" | "weekly" | "monthly" | "fifteen-days" | undefined;
49
- minDays?: number | undefined;
50
- discountType?: "flat" | "percentage" | undefined;
51
- discountValue?: number | undefined;
373
+ pricingStrategyId?: string | undefined;
374
+ selectedPricingIndex?: number | undefined;
375
+ participants?: number | undefined;
376
+ startTime?: string | undefined;
377
+ pickupTime?: string | undefined;
378
+ orderType?: "rental" | "purchase" | undefined;
379
+ activityTotal?: number | undefined;
380
+ checkoutStartedAt?: string | undefined;
381
+ }, {
382
+ featureType: "package" | "rental" | "adventure" | "guide" | "stay" | "event" | "store";
383
+ targetId: string;
52
384
  startDate?: string | undefined;
53
385
  endDate?: string | undefined;
54
- suggestedByPlatform?: boolean | undefined;
55
- active?: boolean | undefined;
386
+ quantity?: number | undefined;
387
+ subTargetId?: string | undefined;
388
+ couponCode?: string | undefined;
389
+ pricingStrategyId?: string | undefined;
390
+ selectedPricingIndex?: number | undefined;
391
+ participants?: number | undefined;
392
+ startTime?: string | undefined;
393
+ pickupTime?: string | undefined;
394
+ orderType?: "rental" | "purchase" | undefined;
395
+ activityTotal?: number | undefined;
396
+ checkoutStartedAt?: string | undefined;
56
397
  }>;
57
- export declare const DiscountSchema: z.ZodObject<{
58
- discountStrategies: z.ZodDefault<z.ZodArray<z.ZodObject<{
59
- type: z.ZodDefault<z.ZodEnum<["duration", "last-minute", "temporary-promotion", "coupon"]>>;
60
- couponCode: z.ZodOptional<z.ZodString>;
61
- couponScope: z.ZodOptional<z.ZodEnum<["listing", "host", "platform"]>>;
62
- discountAppliesTo: z.ZodOptional<z.ZodEnum<["booking-total", "platform-fees"]>>;
63
- createdBy: z.ZodOptional<z.ZodEnum<["admin", "host"]>>;
64
- maxRedemptions: z.ZodOptional<z.ZodNumber>;
65
- maxRedemptionsPerUser: z.ZodOptional<z.ZodNumber>;
66
- minimumOrderValue: z.ZodOptional<z.ZodNumber>;
67
- durationType: z.ZodDefault<z.ZodEnum<["weekly", "fifteen-days", "monthly", "custom", ""]>>;
68
- minDays: z.ZodDefault<z.ZodNumber>;
69
- discountType: z.ZodDefault<z.ZodEnum<["percentage", "flat"]>>;
70
- discountValue: z.ZodDefault<z.ZodNumber>;
71
- startDate: z.ZodOptional<z.ZodString>;
72
- endDate: z.ZodOptional<z.ZodString>;
73
- description: z.ZodDefault<z.ZodString>;
74
- suggestedByPlatform: z.ZodDefault<z.ZodBoolean>;
75
- active: z.ZodDefault<z.ZodBoolean>;
398
+ export declare const DiscountQuoteSchema: z.ZodObject<{
399
+ quoteId: z.ZodString;
400
+ currency: z.ZodString;
401
+ combinedPercentage: z.ZodNumber;
402
+ totalDiscount: z.ZodNumber;
403
+ funding: z.ZodObject<{
404
+ host: z.ZodNumber;
405
+ platform: z.ZodNumber;
406
+ partner: z.ZodNumber;
76
407
  }, "strip", z.ZodTypeAny, {
77
- type: "duration" | "last-minute" | "temporary-promotion" | "coupon";
78
- description: string;
79
- durationType: "" | "custom" | "weekly" | "monthly" | "fifteen-days";
80
- minDays: number;
81
- discountType: "flat" | "percentage";
82
- discountValue: number;
83
- suggestedByPlatform: boolean;
84
- active: boolean;
85
- couponCode?: string | undefined;
86
- couponScope?: "host" | "listing" | "platform" | undefined;
87
- discountAppliesTo?: "booking-total" | "platform-fees" | undefined;
88
- createdBy?: "host" | "admin" | undefined;
89
- maxRedemptions?: number | undefined;
90
- maxRedemptionsPerUser?: number | undefined;
91
- minimumOrderValue?: number | undefined;
92
- startDate?: string | undefined;
93
- endDate?: string | undefined;
408
+ host: number;
409
+ partner: number;
410
+ platform: number;
94
411
  }, {
95
- type?: "duration" | "last-minute" | "temporary-promotion" | "coupon" | undefined;
412
+ host: number;
413
+ partner: number;
414
+ platform: number;
415
+ }>;
416
+ totalBeforeDiscount: z.ZodNumber;
417
+ totalAfterDiscount: z.ZodNumber;
418
+ grantId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
419
+ selected: z.ZodArray<z.ZodObject<{
420
+ strategyId: z.ZodString;
421
+ name: z.ZodString;
422
+ description: z.ZodOptional<z.ZodString>;
423
+ strategyType: z.ZodEnum<["duration", "early_booking", "last_minute", "scheduled", "recurring", "group", "quantity", "coupon", "first_booking", "checkout_recovery", "payment_offer", "partner"]>;
424
+ percentage: z.ZodNumber;
425
+ amount: z.ZodNumber;
426
+ funding: z.ZodObject<{
427
+ host: z.ZodNumber;
428
+ platform: z.ZodNumber;
429
+ partner: z.ZodNumber;
430
+ }, "strip", z.ZodTypeAny, {
431
+ host: number;
432
+ partner: number;
433
+ platform: number;
434
+ }, {
435
+ host: number;
436
+ partner: number;
437
+ platform: number;
438
+ }>;
439
+ stackingGroup: z.ZodEnum<["automatic", "coupon", "payment", "partner", "recovery"]>;
440
+ razorpayOfferId: z.ZodOptional<z.ZodString>;
441
+ paymentEligibility: z.ZodOptional<z.ZodObject<{
442
+ paymentMethods: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
443
+ cardTypes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
444
+ issuers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
445
+ networks: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
446
+ }, "strip", z.ZodTypeAny, {
447
+ paymentMethods: string[];
448
+ cardTypes: string[];
449
+ issuers: string[];
450
+ networks: string[];
451
+ }, {
452
+ paymentMethods?: string[] | undefined;
453
+ cardTypes?: string[] | undefined;
454
+ issuers?: string[] | undefined;
455
+ networks?: string[] | undefined;
456
+ }>>;
457
+ }, "strip", z.ZodTypeAny, {
458
+ name: string;
459
+ amount: number;
460
+ strategyType: "duration" | "group" | "early_booking" | "last_minute" | "scheduled" | "recurring" | "quantity" | "coupon" | "first_booking" | "checkout_recovery" | "payment_offer" | "partner";
461
+ percentage: number;
462
+ funding: {
463
+ host: number;
464
+ partner: number;
465
+ platform: number;
466
+ };
467
+ strategyId: string;
468
+ stackingGroup: "payment" | "coupon" | "partner" | "automatic" | "recovery";
96
469
  description?: string | undefined;
97
- couponCode?: string | undefined;
98
- couponScope?: "host" | "listing" | "platform" | undefined;
99
- discountAppliesTo?: "booking-total" | "platform-fees" | undefined;
100
- createdBy?: "host" | "admin" | undefined;
101
- maxRedemptions?: number | undefined;
102
- maxRedemptionsPerUser?: number | undefined;
103
- minimumOrderValue?: number | undefined;
104
- durationType?: "" | "custom" | "weekly" | "monthly" | "fifteen-days" | undefined;
105
- minDays?: number | undefined;
106
- discountType?: "flat" | "percentage" | undefined;
107
- discountValue?: number | undefined;
108
- startDate?: string | undefined;
109
- endDate?: string | undefined;
110
- suggestedByPlatform?: boolean | undefined;
111
- active?: boolean | undefined;
112
- }>, "many">>;
470
+ razorpayOfferId?: string | undefined;
471
+ paymentEligibility?: {
472
+ paymentMethods: string[];
473
+ cardTypes: string[];
474
+ issuers: string[];
475
+ networks: string[];
476
+ } | undefined;
477
+ }, {
478
+ name: string;
479
+ amount: number;
480
+ strategyType: "duration" | "group" | "early_booking" | "last_minute" | "scheduled" | "recurring" | "quantity" | "coupon" | "first_booking" | "checkout_recovery" | "payment_offer" | "partner";
481
+ percentage: number;
482
+ funding: {
483
+ host: number;
484
+ partner: number;
485
+ platform: number;
486
+ };
487
+ strategyId: string;
488
+ stackingGroup: "payment" | "coupon" | "partner" | "automatic" | "recovery";
489
+ description?: string | undefined;
490
+ razorpayOfferId?: string | undefined;
491
+ paymentEligibility?: {
492
+ paymentMethods?: string[] | undefined;
493
+ cardTypes?: string[] | undefined;
494
+ issuers?: string[] | undefined;
495
+ networks?: string[] | undefined;
496
+ } | undefined;
497
+ }>, "many">;
498
+ rejected: z.ZodArray<z.ZodObject<{
499
+ strategyId: z.ZodOptional<z.ZodString>;
500
+ name: z.ZodString;
501
+ reason: z.ZodString;
502
+ }, "strip", z.ZodTypeAny, {
503
+ name: string;
504
+ reason: string;
505
+ strategyId?: string | undefined;
506
+ }, {
507
+ name: string;
508
+ reason: string;
509
+ strategyId?: string | undefined;
510
+ }>, "many">;
511
+ createdAt: z.ZodUnion<[z.ZodString, z.ZodDate]>;
113
512
  }, "strip", z.ZodTypeAny, {
114
- discountStrategies: {
115
- type: "duration" | "last-minute" | "temporary-promotion" | "coupon";
116
- description: string;
117
- durationType: "" | "custom" | "weekly" | "monthly" | "fifteen-days";
118
- minDays: number;
119
- discountType: "flat" | "percentage";
120
- discountValue: number;
121
- suggestedByPlatform: boolean;
122
- active: boolean;
123
- couponCode?: string | undefined;
124
- couponScope?: "host" | "listing" | "platform" | undefined;
125
- discountAppliesTo?: "booking-total" | "platform-fees" | undefined;
126
- createdBy?: "host" | "admin" | undefined;
127
- maxRedemptions?: number | undefined;
128
- maxRedemptionsPerUser?: number | undefined;
129
- minimumOrderValue?: number | undefined;
130
- startDate?: string | undefined;
131
- endDate?: string | undefined;
513
+ createdAt: string | Date;
514
+ currency: string;
515
+ rejected: {
516
+ name: string;
517
+ reason: string;
518
+ strategyId?: string | undefined;
519
+ }[];
520
+ funding: {
521
+ host: number;
522
+ partner: number;
523
+ platform: number;
524
+ };
525
+ quoteId: string;
526
+ combinedPercentage: number;
527
+ totalDiscount: number;
528
+ totalBeforeDiscount: number;
529
+ totalAfterDiscount: number;
530
+ selected: {
531
+ name: string;
532
+ amount: number;
533
+ strategyType: "duration" | "group" | "early_booking" | "last_minute" | "scheduled" | "recurring" | "quantity" | "coupon" | "first_booking" | "checkout_recovery" | "payment_offer" | "partner";
534
+ percentage: number;
535
+ funding: {
536
+ host: number;
537
+ partner: number;
538
+ platform: number;
539
+ };
540
+ strategyId: string;
541
+ stackingGroup: "payment" | "coupon" | "partner" | "automatic" | "recovery";
542
+ description?: string | undefined;
543
+ razorpayOfferId?: string | undefined;
544
+ paymentEligibility?: {
545
+ paymentMethods: string[];
546
+ cardTypes: string[];
547
+ issuers: string[];
548
+ networks: string[];
549
+ } | undefined;
132
550
  }[];
551
+ grantId?: string | null | undefined;
133
552
  }, {
134
- discountStrategies?: {
135
- type?: "duration" | "last-minute" | "temporary-promotion" | "coupon" | undefined;
553
+ createdAt: string | Date;
554
+ currency: string;
555
+ rejected: {
556
+ name: string;
557
+ reason: string;
558
+ strategyId?: string | undefined;
559
+ }[];
560
+ funding: {
561
+ host: number;
562
+ partner: number;
563
+ platform: number;
564
+ };
565
+ quoteId: string;
566
+ combinedPercentage: number;
567
+ totalDiscount: number;
568
+ totalBeforeDiscount: number;
569
+ totalAfterDiscount: number;
570
+ selected: {
571
+ name: string;
572
+ amount: number;
573
+ strategyType: "duration" | "group" | "early_booking" | "last_minute" | "scheduled" | "recurring" | "quantity" | "coupon" | "first_booking" | "checkout_recovery" | "payment_offer" | "partner";
574
+ percentage: number;
575
+ funding: {
576
+ host: number;
577
+ partner: number;
578
+ platform: number;
579
+ };
580
+ strategyId: string;
581
+ stackingGroup: "payment" | "coupon" | "partner" | "automatic" | "recovery";
136
582
  description?: string | undefined;
137
- couponCode?: string | undefined;
138
- couponScope?: "host" | "listing" | "platform" | undefined;
139
- discountAppliesTo?: "booking-total" | "platform-fees" | undefined;
140
- createdBy?: "host" | "admin" | undefined;
141
- maxRedemptions?: number | undefined;
142
- maxRedemptionsPerUser?: number | undefined;
143
- minimumOrderValue?: number | undefined;
144
- durationType?: "" | "custom" | "weekly" | "monthly" | "fifteen-days" | undefined;
145
- minDays?: number | undefined;
146
- discountType?: "flat" | "percentage" | undefined;
147
- discountValue?: number | undefined;
148
- startDate?: string | undefined;
149
- endDate?: string | undefined;
150
- suggestedByPlatform?: boolean | undefined;
151
- active?: boolean | undefined;
152
- }[] | undefined;
583
+ razorpayOfferId?: string | undefined;
584
+ paymentEligibility?: {
585
+ paymentMethods?: string[] | undefined;
586
+ cardTypes?: string[] | undefined;
587
+ issuers?: string[] | undefined;
588
+ networks?: string[] | undefined;
589
+ } | undefined;
590
+ }[];
591
+ grantId?: string | null | undefined;
153
592
  }>;
593
+ export type DiscountFeatureType = z.infer<typeof DiscountFeatureTypeSchema>;
594
+ export type DiscountStrategyType = z.infer<typeof DiscountStrategyTypeSchema>;
595
+ export type DiscountOrigin = z.infer<typeof DiscountOriginSchema>;
596
+ export type DiscountStatus = z.infer<typeof DiscountStatusSchema>;
597
+ export type DiscountFunding = z.infer<typeof DiscountFundingSchema>;
598
+ export type DiscountConditions = z.infer<typeof DiscountConditionsSchema>;
154
599
  export type DiscountStrategy = z.infer<typeof DiscountStrategySchema>;
155
- export type Discount = z.infer<typeof DiscountSchema>;
156
- export declare function createDefaultRentalDiscount(): Discount;
157
- export declare function normalizeDiscount(discount?: Discount | null): Discount;
158
- export declare function calculateDiscountAmount(total: number, strategy?: Partial<DiscountStrategy> | null): number;
159
- export declare function getApplicableDiscountStrategy(discount: Discount | null | undefined, days: number, bookingDate?: Date, couponCode?: string): DiscountStrategy | undefined;
600
+ export type DiscountQuoteRequest = z.infer<typeof DiscountQuoteRequestSchema>;
601
+ export type DiscountQuote = z.infer<typeof DiscountQuoteSchema>;
602
+ export type DiscountGrant = {
603
+ _id: string;
604
+ strategyId: string;
605
+ codePreview: string;
606
+ status: "issued" | "revealed" | "claimed" | "reserved" | "redeemed" | "expired" | "revoked";
607
+ source: "reward" | "scratch_card" | "recovery" | "staff" | "partner";
608
+ expiresAt?: string | null;
609
+ };
610
+ export declare function createEmptyDiscountStrategy(origin?: DiscountOrigin): DiscountStrategy;
160
611
  //# sourceMappingURL=discount.d.ts.map