@feedmepos/mf-connect 0.1.14-prod → 0.1.15-prod

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 (88) hide show
  1. package/dist/{Analytic-MRp7gtO3.js → Analytic-C7qqDS5D.js} +18 -17
  2. package/dist/{App-BU3B2A-F.js → App-DKZYz5r2.js} +68 -64
  3. package/dist/Bin-U7U1Vaju.js +165 -0
  4. package/dist/{Broadcast-DmciJlSU.js → Broadcast-BzChnp4V.js} +8 -8
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DJPOgBXj.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BELIbS3v.js} +6 -7
  6. package/dist/{Card-Dq2cAgTi.js → Card-DAfZz7q5.js} +78 -79
  7. package/dist/{Collections-B4x4VH1a.js → Collections-joGRHyag.js} +5 -5
  8. package/dist/{Credit-CVdT1KBU.js → Credit-N1qDB4XC.js} +8 -8
  9. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-BmjXu-U7.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-J95iaF7a.js} +27 -27
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-A_uosv-g.js → EffectSheet.vue_vue_type_style_index_0_lang-DwzQSmst.js} +8 -8
  11. package/dist/{Experience-CEeXWbue.js → Experience-D5GrDbft.js} +8 -8
  12. package/dist/{Game-mx5c5ZhV.js → Game-DI7BDPO_.js} +8 -8
  13. package/dist/{Index-DQ1qadwz.js → Index-CbuAJ2dE.js} +9 -9
  14. package/dist/{Marketing-CciBZijv.js → Marketing-BSqMfy70.js} +5 -5
  15. package/dist/{Member-C51SlKxj.js → Member-CGd5wNHJ.js} +4 -4
  16. package/dist/MemberList-DnS8KHYF.js +1596 -0
  17. package/dist/MemberTransactions-GAAX3aSV.js +45 -0
  18. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DZu24zwy.js → MessageInput.vue_vue_type_script_setup_true_lang-Bc2wcibo.js} +5 -5
  19. package/dist/{Mission-LpCnpKYD.js → Mission-BVM_1IJ8.js} +8 -8
  20. package/dist/{Overview-DxvOqUao.js → Overview-D2IYZCPn.js} +62 -63
  21. package/dist/{Point-BmI7y6h6.js → Point-B684quZM.js} +8 -8
  22. package/dist/{Promotion-MHaOqrwu.js → Promotion-DJOoRnxt.js} +9 -9
  23. package/dist/{Record-75BxMATe.js → Record-Bk74XVUj.js} +6 -6
  24. package/dist/{Reward-8VfyFuEt.js → Reward-BM0AGGL6.js} +35 -35
  25. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-D12_r-9X.js → RewardGroup.vue_vue_type_script_setup_true_lang-CuA2D52B.js} +12 -13
  26. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-BIdBxvN7.js → RuleGroup.vue_vue_type_script_setup_true_lang-Cxv3cZ1v.js} +14 -15
  27. package/dist/{Segment-I9FUibZy.js → Segment-DqOsH95n.js} +13 -13
  28. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-BGeR0-AG.js → SelectItems.vue_vue_type_script_setup_true_lang-ypjkVZkZ.js} +2 -2
  29. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-Qo0aOTI9.js +147 -0
  30. package/dist/{Setting-B8V2I0EZ.js → Setting-D6cRTVUl.js} +31 -31
  31. package/dist/{Store-CQkGNSSm.js → Store-DqtUurcv.js} +55 -56
  32. package/dist/{StoreRewards-DOtjveqw.js → StoreRewards-DPFMA3p9.js} +12 -12
  33. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-Cf9IsQXS.js → StoreTransactions.vue_vue_type_script_setup_true_lang-CYqo5att.js} +321 -354
  34. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DPmeW62s.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-DxEV-6_4.js} +1 -1
  35. package/dist/{Tier-DAj_5abZ.js → Tier-CFd-HaGX.js} +20 -21
  36. package/dist/{Title-DryO4wcO.js → Title-CBktBb5l.js} +20 -21
  37. package/dist/{Transaction-DpibVFU-.js → Transaction-Bb8UU_lj.js} +2 -2
  38. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-DoiPRPPo.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-DBiUmz3C.js} +6 -6
  39. package/dist/Voucher-Bukem4U7.js +353 -0
  40. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-DRnVggfC.js → VoucherEditor.vue_vue_type_script_setup_true_lang-CTbqVMCn.js} +10 -10
  41. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BzBcsSYS.js → ZodTextField.vue_vue_type_script_setup_true_lang-D8zMv7ks.js} +1 -1
  42. package/dist/{app-BoQTcBOD.js → app-BL2xIPMp.js} +102 -66
  43. package/dist/{app-BzPle2EI.js → app-CO6FVdHg.js} +1 -1
  44. package/dist/app.js +1 -1
  45. package/dist/{business-H9a63ymR.js → business-BMTDDe8v.js} +1 -1
  46. package/dist/{dto-BBLfD0Lh.js → campaign-C5TEfnWg.js} +610 -819
  47. package/dist/{campaign-CR-16mwD.js → campaign-CzpECNqa.js} +2 -2
  48. package/dist/{campaign.enum-DcaetYuk.js → campaign.enum-CVF3KbJ2.js} +1 -1
  49. package/dist/{campaign.fn-BqGZqM77.js → campaign.fn-WT1gfEwK.js} +110 -110
  50. package/dist/{collectible.enum-YKtiwQbt.js → collectible.enum-BW7-BEa-.js} +3 -3
  51. package/dist/{collection.fn-CI8lSAsC.js → collection.fn-BRsC9uPP.js} +2 -2
  52. package/dist/dto-B1tWHAjt.js +214 -0
  53. package/dist/{effect-36H79d0n.js → effect-4Ov4Jl68.js} +1 -1
  54. package/dist/{email-addresses-drrACeqJ.js → email-addresses-L25192f3.js} +1 -1
  55. package/dist/{export-BgnO3lJs.js → export-UEJjaL0g.js} +5 -5
  56. package/dist/{helper-CcV9DZXq.js → helper-BNBSbgdl.js} +1 -1
  57. package/dist/{index-mgoYj6L9.js → index-BWY2o9U9.js} +1 -1
  58. package/dist/index-BnWjqXOJ.js +115 -0
  59. package/dist/{index-DydNNBhY.js → index-BxwVs3Ot.js} +29 -4
  60. package/dist/index-Cg64BkVG.js +44 -0
  61. package/dist/{index-CibFRBGu.js → index-ChKwu49G.js} +6 -6
  62. package/dist/{index-ZycLk3NR.js → index-CtY-c-yc.js} +1 -1
  63. package/dist/{index-BPbhXWRp.js → index-D4iYmdD4.js} +12 -13
  64. package/dist/{index-BEDXujqZ.js → index-D8Qn3ZjQ.js} +1 -1
  65. package/dist/{index-Cidu1YZP.js → index-DpCBCiH_.js} +5 -5
  66. package/dist/{index-DLAAi9ur.js → index-DxjXJh5H.js} +3 -3
  67. package/dist/{index-BRTpdfj3.js → index-fdv6AHmk.js} +2057 -1010
  68. package/dist/{index-CB1CnEOn.js → index-jf1CG6wc.js} +1 -1
  69. package/dist/{index.esm2017-QS_XhcBp.js → index.esm2017-D-3LEGru.js} +1 -1
  70. package/dist/{loading-LktVwV5k.js → loading-CUp8ZsA0.js} +4 -4
  71. package/dist/{membership-7ETvXph3.js → membership-DwbiFGd7.js} +6 -6
  72. package/dist/{money-BYszknw8.js → money-BLrbHrdQ.js} +1 -1
  73. package/dist/{number-Dmd4vT4F.js → number--bZt83Nn.js} +1 -1
  74. package/dist/{objectid-BQtSeCVi.js → objectid-CCGQh_Y_.js} +4 -4
  75. package/dist/{reward-DJGOX-D1.js → reward-D99cFWcD.js} +1 -1
  76. package/dist/{rule-D7jM4gdg.js → rule-UpH1Y1i5.js} +3 -3
  77. package/dist/{rule-builder-FO9UeYUJ.js → rule-builder-ujLy6UTt.js} +1 -1
  78. package/dist/{template-C4Ddrpk1.js → template-FiuUP37O.js} +4 -4
  79. package/dist/{trigger-w7Q4qOMB.js → trigger-BZYtwSky.js} +13 -13
  80. package/dist/{usePagination-PH1OvyZM.js → usePagination-DDW-s6D3.js} +1 -1
  81. package/dist/{user-DRPXRVy2.js → user-BA3Sw5dU.js} +1 -1
  82. package/dist/{vue-i18n-B49HKiTU.js → vue-i18n-C5t_xZZj.js} +2 -2
  83. package/package.json +1 -1
  84. package/dist/MemberList-D1x731cU.js +0 -1043
  85. package/dist/MemberTransactions-BpoTQHFQ.js +0 -38
  86. package/dist/Voucher-CSc0_dGX.js +0 -491
  87. package/dist/index-6RqtavHk.js +0 -1051
  88. package/dist/index-B5ii6hOh.js +0 -99
@@ -1,1051 +0,0 @@
1
- import { z as e, F as n, e as E, m as l, g as se, d as F } from "./loading-LktVwV5k.js";
2
- import { F as x } from "./campaign.enum-DcaetYuk.js";
3
- import { c as f, F as L, e as m, g as ae, f as S, i as p, j as re, k as le } from "./index-CibFRBGu.js";
4
- import { i as D, g as N, h as ce } from "./index-BRTpdfj3.js";
5
- import "vue";
6
- e.object({
7
- location: n,
8
- memberId: n,
9
- nettTotal: E,
10
- remark: e.string().optional()
11
- });
12
- const de = e.enum(["COUNTER", "POS"]);
13
- e.object({
14
- id: e.string(),
15
- userId: e.string(),
16
- name: e.string().nullish(),
17
- birthday: e.string().nullish(),
18
- phoneNumber: e.string().nullish(),
19
- balance: e.number().nullish(),
20
- level: e.number().nullish(),
21
- mostPurchasedItems: e.array(e.string()).nullish()
22
- });
23
- const me = {
24
- collectionName: "Bills"
25
- }, ue = e.object({
26
- _id: e.string(),
27
- items: e.record(e.string(), e.number()).nullish(),
28
- // business: z.string(),
29
- // adjustments: z.record(FdoBillAdjustment),
30
- // refundedFrom: z.string().nullish(),
31
- user: e.string().nullish(),
32
- memberid: e.string().nullish(),
33
- // roundToNearest: z.number().nullish(),
34
- nettTotal: E,
35
- // activeItems: z.array(z.string()),
36
- remark: e.string().nullish(),
37
- createdAt: e.coerce.date(),
38
- completedAt: e.coerce.date(),
39
- location: e.string(),
40
- channel: de.optional()
41
- }).transform((t) => ({
42
- ...t,
43
- createdTime: t.createdAt,
44
- completedTime: t.completedAt,
45
- get amount() {
46
- return t.nettTotal.amount / 10 ** t.nettTotal.precision;
47
- }
48
- })).describe(l.describe(me)), pe = e.object({
49
- _id: e.string(),
50
- rating: e.coerce.number(),
51
- user: e.string(),
52
- restaurant: e.string(),
53
- message: e.string(),
54
- submittedAt: e.coerce.date()
55
- }), s = e.enum([
56
- "SIMPLE_CLAIM",
57
- "LINK_CLAIM",
58
- "BILL_COMPLETED",
59
- "SCHEDULE",
60
- "BIRTHDAY",
61
- "FEEDBACK",
62
- "ENTER_SEGMENT",
63
- "MEMBERSHIP_JOINED",
64
- "TIER_UPGRADED",
65
- "MAKING_ORDER",
66
- "ISSUE_REWARD",
67
- "MEMBER_REWARD",
68
- "GAME_COMPLETED",
69
- "PAGINATE_SCHEDULE",
70
- "REFERRAL_ADDED"
71
- ]), bn = s.extract([
72
- "BILL_COMPLETED",
73
- "FEEDBACK",
74
- "GAME_COMPLETED",
75
- "MAKING_ORDER",
76
- "MEMBERSHIP_JOINED",
77
- "SCHEDULE",
78
- "SIMPLE_CLAIM",
79
- "TIER_UPGRADED",
80
- "ISSUE_REWARD"
81
- ]);
82
- e.enum(["START_OF", "BEFORE"]);
83
- e.enum(["WEEK", "MONTH"]);
84
- const a = e.object({
85
- // type: F_EVENT_TYPE,
86
- rule: f.optional()
87
- }), ge = a.extend({
88
- type: e.literal(s.enum.BILL_COMPLETED)
89
- }), be = a.extend({
90
- type: e.literal(s.enum.FEEDBACK)
91
- }), Ee = a.extend({
92
- type: e.literal(s.enum.SIMPLE_CLAIM)
93
- });
94
- a.extend({
95
- type: e.literal(s.enum.ENTER_SEGMENT),
96
- segment: e.string()
97
- });
98
- const ye = a.extend({
99
- type: e.literal(s.enum.MEMBER_REWARD)
100
- }), he = a.extend({
101
- type: e.literal(s.enum.SCHEDULE)
102
- // option: FdoCronRule,
103
- }), Ce = a.extend({
104
- type: e.literal(s.enum.MEMBERSHIP_JOINED)
105
- }), fe = a.extend({
106
- type: e.literal(s.enum.TIER_UPGRADED)
107
- }), _e = a.extend({
108
- type: e.literal(s.enum.MAKING_ORDER)
109
- }), Re = a.extend({
110
- type: e.literal(s.enum.ISSUE_REWARD)
111
- }), Ie = a.extend({
112
- type: e.literal(s.enum.GAME_COMPLETED)
113
- });
114
- a.extend({
115
- type: e.literal(s.enum.REFERRAL_ADDED)
116
- });
117
- const Fe = e.discriminatedUnion("type", [
118
- Ee,
119
- ge,
120
- he,
121
- be,
122
- Ce,
123
- fe,
124
- _e,
125
- Re,
126
- ye,
127
- Ie
128
- ]);
129
- e.object({
130
- _id: n,
131
- type: s,
132
- ref: e.string(),
133
- context: e.record(e.string(), e.any()).optional()
134
- }).describe(JSON.stringify({ collectionName: "EventLogs" }));
135
- const u = e.object({
136
- type: s,
137
- context: e.any(),
138
- businessIds: e.array(n).optional(),
139
- campaignIds: e.array(n).optional(),
140
- slackWebhookUrl: e.string().optional(),
141
- emittedAt: e.coerce.date().default(/* @__PURE__ */ new Date())
142
- }), De = u.extend({
143
- type: e.literal(s.enum.BILL_COMPLETED),
144
- context: e.object({
145
- bill: ue,
146
- rawBill: e.any()
147
- })
148
- }), Ae = u.extend({
149
- type: e.literal(s.enum.SCHEDULE),
150
- context: e.object({
151
- triggeredAt: e.coerce.date()
152
- })
153
- }), Te = u.extend({
154
- type: e.literal(s.enum.PAGINATE_SCHEDULE),
155
- context: e.object({
156
- triggeredAt: e.coerce.date(),
157
- business: n,
158
- skip: e.coerce.number(),
159
- limit: e.coerce.number()
160
- })
161
- }), Me = u.extend({
162
- type: e.literal(s.enum.FEEDBACK),
163
- context: e.object({
164
- feedback: pe
165
- })
166
- }), Pe = u.extend({
167
- type: e.literal(s.enum.MEMBERSHIP_JOINED),
168
- context: e.object({
169
- user: D
170
- })
171
- }), Oe = u.extend({
172
- type: e.literal(s.enum.TIER_UPGRADED),
173
- context: e.object({
174
- transaction: N
175
- })
176
- }), xe = u.extend({
177
- type: e.literal(s.enum.ISSUE_REWARD),
178
- context: e.object({
179
- transaction: N,
180
- collection: ce
181
- })
182
- }), Le = u.extend({
183
- type: e.literal(s.enum.REFERRAL_ADDED),
184
- context: e.object({
185
- user: D
186
- })
187
- });
188
- e.discriminatedUnion("type", [
189
- De,
190
- Ae,
191
- Me,
192
- Pe,
193
- Oe,
194
- xe,
195
- Te,
196
- Le
197
- ]);
198
- const Se = e.object({
199
- from: e.coerce.number(),
200
- to: e.coerce.number().optional()
201
- }).superRefine((t, i) => {
202
- t.from && t.to && t.from > t.to && i.addIssue({
203
- code: "custom",
204
- message: "Max experience must be more than min experience"
205
- });
206
- }), Ne = e.enum(["MULTIPLIER", "FIXED"]);
207
- e.object({
208
- type: Ne
209
- });
210
- const je = e.object({
211
- _id: n.optional(),
212
- rule: f,
213
- tierExpression: e.string().nullish(),
214
- expExpression: e.string().nullish()
215
- }), A = e.object({
216
- _id: n,
217
- name: e.string().min(1),
218
- image: e.string().nullish(),
219
- option: Se,
220
- cycleOptions: e.array(e.lazy(() => je)).nullish(),
221
- member_count: e.number().optional()
222
- });
223
- A.partial({
224
- _id: !0
225
- });
226
- const En = A.partial({
227
- _id: !0
228
- }), Be = e.object({
229
- icon: e.string(),
230
- label: e.string(),
231
- value: e.string()
232
- }), Ue = e.object({
233
- gatewayKey: e.enum([
234
- "REVENUE_MONSTER",
235
- "FEEDME",
236
- "FEEDME_MEMBER_CREDIT",
237
- "RAZER_MERCHANT_SERVICE"
238
- ]),
239
- checkoutUrl: e.string().optional(),
240
- checkoutId: e.string().optional(),
241
- callbackUrl: e.string().optional(),
242
- vcode: e.string().optional(),
243
- merchantId: e.string().optional(),
244
- amount: e.string().optional(),
245
- currency: e.string().optional(),
246
- returnUrl: e.string().optional(),
247
- notifyUrl: e.string().optional(),
248
- channels: e.array(Be).optional(),
249
- transactionId: e.string().optional()
250
- });
251
- e.object({
252
- trx: e.lazy(() => k),
253
- onlineTrx: Ue.optional(),
254
- url: e.string().optional()
255
- });
256
- const j = e.enum(["POS", "APP", "ADMIN"]), B = e.enum(["topupCount"]), we = e.object({
257
- line1: e.string(),
258
- line2: e.string().optional(),
259
- state: e.string(),
260
- city: e.string(),
261
- postcode: e.string(),
262
- country: e.string()
263
- }), U = e.object({
264
- name: e.string(),
265
- regNo: e.string(),
266
- address: we,
267
- phoneNo: e.string(),
268
- sstRegNo: e.string().optional()
269
- }), w = e.object({
270
- systemCode: e.string(),
271
- inclusive: e.boolean()
272
- }), Ge = e.object({
273
- id: n,
274
- dayToExpire: e.number().max(9999, "Max expiry is 9999 days")
275
- }), ze = e.object({
276
- normal: e.coerce.number(),
277
- free: e.object({
278
- day: e.coerce.number(),
279
- amount: e.coerce.number(),
280
- remark: e.string().nullish()
281
- }).nullish()
282
- }), He = e.object({
283
- systemCode: e.string(),
284
- taxCode: e.string()
285
- }), ke = e.object({
286
- name: e.string(),
287
- systemCode: e.string(),
288
- taxCode: e.string(),
289
- rate: se,
290
- total: E
291
- });
292
- e.object({
293
- canPurchase: e.boolean(),
294
- reason: e.string()
295
- });
296
- e.object({
297
- type: B
298
- });
299
- e.object({
300
- type: B,
301
- min: e.number().nullish(),
302
- max: e.number().nullish()
303
- });
304
- const ve = e.object({
305
- options: e.object({
306
- maxReceive: e.number().min(0).nullish(),
307
- maxPerUser: e.number().min(0).nullish()
308
- }),
309
- rule: f.nullish()
310
- }), Ve = (t, i) => {
311
- const r = t;
312
- r.isFeedvibe && F.Dinero.fromFdoDinero(r.price).toUnit() < 10 && i.addIssue({
313
- code: "custom",
314
- path: ["price"],
315
- message: "Price must be at least RM10"
316
- });
317
- }, G = e.object({
318
- _id: e.string(),
319
- isFeedvibe: e.boolean().nullish(),
320
- // conditions: z.array(FdoTopupCountCondition),
321
- image: e.string().nullish(),
322
- rule: f.nullish(),
323
- name: e.string().min(1, "Name is required"),
324
- price: E,
325
- originalPrice: E.nullish(),
326
- // new field to indicate coinPrice
327
- coinPrice: e.number().nullish(),
328
- titles: e.array(Ge),
329
- credit: ze,
330
- taxes: e.array(He),
331
- taxTotals: e.array(ke),
332
- priceWithTaxes: E.nullish(),
333
- vouchers: e.array(n),
334
- _inclusiveTaxes: e.array(w).nullish(),
335
- _taxSystem: e.array(e.string()).nullish(),
336
- stripePriceId: e.string().nullish(),
337
- subscriptionValidity: e.number().min(1, "Must be at least 1 day").max(365, "Maximum is 365").nullish(),
338
- redeemWithCode: e.boolean().nullish(),
339
- internal: e.boolean().optional(),
340
- hideInPos: e.boolean().optional(),
341
- config: ve.optional(),
342
- pf_titles: e.array(e.any()).optional(),
343
- pf_vouchers: e.array(e.any()).optional(),
344
- pf_credit: e.number().optional()
345
- }).superRefine((t, i) => {
346
- var r, g;
347
- t.stripePriceId && !t.subscriptionValidity && i.addIssue({
348
- code: "custom",
349
- message: "Validity is required when stripePriceId is provided",
350
- path: ["subscriptionValidity"]
351
- }), t.originalPrice && t.originalPrice.amount && t.originalPrice.amount < t.price.amount && i.addIssue({
352
- code: "custom",
353
- message: "Original price must be greater than price",
354
- path: ["originalPrice"]
355
- }), t.price.amount < 0 && i.addIssue({
356
- code: "custom",
357
- path: ["price"],
358
- message: "Price cannot be less than 0"
359
- }), t.coinPrice && t.coinPrice < 0 && i.addIssue({
360
- code: "custom",
361
- path: ["coinPrice"],
362
- message: "Point price cannot be less than 0"
363
- }), t.credit.normal < 0 && i.addIssue({
364
- code: "custom",
365
- path: ["credit", "normal"],
366
- message: "Normal credit cannot be less than 0"
367
- }), t.credit.free && (t.credit.free.amount < 0 && i.addIssue({
368
- code: "custom",
369
- path: ["credit", "free", "amount"],
370
- message: "Free credit cannot be less than 0"
371
- }), t.credit.free.amount && t.credit.free.day < 0 && i.addIssue({
372
- code: "custom",
373
- path: ["credit", "free", "day"],
374
- message: "Expiry must be at least 0 (expire same day)"
375
- })), t.credit.normal && t.coinPrice && i.addIssue({
376
- code: "custom",
377
- message: "Bundle redeem with point cannot set normal credit.",
378
- path: ["credit", "normal"]
379
- }), t.credit.normal > F.Dinero.fromFdoDinero(t.price).toUnit() && i.addIssue({
380
- code: "custom",
381
- message: `Normal credit cannot be more than price. Max: ${F.Dinero.fromFdoDinero(
382
- t.price
383
- ).toUnit()}`,
384
- path: ["credit", "normal"]
385
- }), t.titles.length > 0 && t.titles.some((_) => _.dayToExpire < 0) && i.addIssue({
386
- code: "custom",
387
- path: ["titles"],
388
- message: "Title expiry must be at least 0 day (expire same day)"
389
- }), (((g = (r = t.config) == null ? void 0 : r.options) == null ? void 0 : g.maxPerUser) || 0) < 0 && i.addIssue({
390
- code: "custom",
391
- path: ["config.options.maxPerUser"],
392
- message: "Max purchase per user cannot be negative"
393
- });
394
- }).superRefine(Ve), z = e.object({
395
- name: e.string(),
396
- bundles: e.array(G)
397
- });
398
- e.object({
399
- _id: e.string(),
400
- name: e.string(),
401
- expiredAt: e.string()
402
- });
403
- const We = e.object({
404
- apiKey: e.string(),
405
- webhookSecret: e.string()
406
- }), Ke = e.object({
407
- company: U.nullish(),
408
- inclusiveTaxes: e.array(w).nullish(),
409
- stripe: We.nullable().optional()
410
- }), Ye = {
411
- collectionName: "Stores",
412
- transform: {
413
- _id: "oid",
414
- business: "oid"
415
- }
416
- };
417
- Ke.extend({
418
- _id: n,
419
- business: n,
420
- categories: e.array(z)
421
- }).describe(l.describe(Ye));
422
- const Je = e.object({
423
- refundedAt: e.coerce.date(),
424
- reason: e.string(),
425
- transactions: e.array(n)
426
- }), H = e.object({
427
- type: e.enum(["ONLINE", "OFFLINE", "COIN", "STRIPE", "CARD", "FEEDVIBE", "ADMIN"]),
428
- extra: e.string().nullish(),
429
- gateway: e.string().nullish(),
430
- method: e.string().nullish()
431
- }), qe = {
432
- collectionName: "StoreTransactions",
433
- transform: {
434
- _id: "oid",
435
- business: "oid",
436
- location: "oid",
437
- member: "oid",
438
- transactions: "oid"
439
- },
440
- lookups: {
441
- member: {
442
- fromCollection: "UsersV2",
443
- as: "pf_member"
444
- }
445
- }
446
- }, k = e.object({
447
- _id: n,
448
- source: j,
449
- // can be memberStorePurchase
450
- ref: e.string(),
451
- business: n,
452
- company: U,
453
- location: n.optional(),
454
- member: n,
455
- // createdAt: z.coerce.date(),
456
- bundle: G,
457
- transactions: e.array(n),
458
- // array of transaction id (voucher, credit, title)
459
- status: e.enum([
460
- "PENDING_PAYMENT",
461
- "PENDING_TRANSACTION",
462
- "COMPLETED",
463
- "REFUNDED"
464
- ]),
465
- refund: Je.nullish(),
466
- paymentType: H.nullish(),
467
- paymentRef: e.string().nullish(),
468
- webhookUrl: e.string().optional(),
469
- webhookSent: e.boolean().optional(),
470
- pf_transactions: e.array(e.any()).optional(),
471
- pf_member: e.any().optional(),
472
- pf_location: e.any().optional(),
473
- pf_ref: e.any().optional()
474
- }).describe(l.describe(qe));
475
- e.object({
476
- bundle: n,
477
- member: e.string(),
478
- ref: e.string(),
479
- paymentType: H.nullish(),
480
- withCoin: e.boolean().optional(),
481
- card: e.string().optional(),
482
- location: n.optional(),
483
- source: j,
484
- webhookUrl: e.string().optional()
485
- });
486
- e.object({
487
- categories: e.array(z)
488
- });
489
- e.object({
490
- id: n,
491
- reason: e.string(),
492
- location: n.optional()
493
- });
494
- e.object({
495
- _id: n,
496
- business: n,
497
- user: n,
498
- bundleId: e.string(),
499
- transaction: e.array(n),
500
- subscriptionId: e.string(),
501
- expiredAt: e.coerce.date()
502
- }).describe(
503
- l.describe({
504
- collectionName: "StoreSubscriptions",
505
- transform: {
506
- _id: "oid",
507
- business: "oid",
508
- user: "oid",
509
- transaction: "oid",
510
- expiredAt: "date"
511
- }
512
- })
513
- );
514
- e.object({
515
- member: e.string(),
516
- subscriptionId: e.string()
517
- });
518
- const Ze = {
519
- collectionName: "Cards",
520
- transform: {
521
- _id: "oid",
522
- business: "oid",
523
- member: "oid",
524
- redeemedAt: "date"
525
- },
526
- lookups: {
527
- business: {
528
- as: "business",
529
- fromCollection: "Business"
530
- },
531
- member: {
532
- as: "pf_member",
533
- fromCollection: "UsersV2"
534
- }
535
- }
536
- };
537
- e.object({
538
- _id: n,
539
- business: n,
540
- serialNumber: e.string(),
541
- setCardOnBind: e.boolean().nullish(),
542
- redeemedAt: e.date().nullish(),
543
- member: n.nullish(),
544
- design: e.string().nullish(),
545
- bundle: e.string().nullish(),
546
- subscriptionBundle: e.string().nullish(),
547
- pf_member: e.lazy(() => D).nullish(),
548
- pf_transaction: e.lazy(() => k).nullish()
549
- }).describe(l.describe(Ze));
550
- const Xe = e.object({
551
- length: e.coerce.number().optional(),
552
- charset: e.string(),
553
- prefix: e.string().optional(),
554
- suffix: e.string().optional(),
555
- pattern: e.string().optional()
556
- });
557
- e.object({
558
- quantity: e.number(),
559
- code: e.string(),
560
- codeConfig: Xe,
561
- setCardOnBind: e.boolean().optional(),
562
- design: e.string().nullish(),
563
- bundle: e.string().optional(),
564
- subscriptionBundle: e.string().optional()
565
- });
566
- const $e = e.enum(["SMS", "WHATSAPP"]), y = e.object({
567
- channel: $e,
568
- variables: e.array(e.string()),
569
- content: e.string(),
570
- language: e.string(),
571
- imageUrl: e.string().optional()
572
- }).superRefine((t, i) => {
573
- t.content.length == 0 && i.addIssue({
574
- code: e.ZodIssueCode.custom,
575
- message: "Content is required"
576
- });
577
- const r = /{{(.*?)}}/g, g = [...t.content.matchAll(r)].map((b) => b[1]), _ = t.variables, C = g.filter((b) => _.indexOf(b) < 0);
578
- C.length && i.addIssue({
579
- code: e.ZodIssueCode.custom,
580
- message: "Invalid variable(s): " + C.join(", ")
581
- });
582
- });
583
- function yn(t, i) {
584
- return t.replace(/{{(.*?)}}/g, (r, g) => {
585
- const C = g.trim().split(".").reduce((b, ie) => (b != null ? b[ie] : null) ?? null, i);
586
- return C !== null ? C : r;
587
- });
588
- }
589
- const T = e.enum(["NO_REWARD", "VOUCHER", "LOYALTY"]), M = e.number().min(0, "Weight need to be at least 0"), P = e.number().int("Must be integer").min(0, "Threshold need to be at least 0"), v = e.object({
590
- type: e.literal(T.enum.NO_REWARD),
591
- collectible: e.null(),
592
- weight: M
593
- }), V = e.object({
594
- type: e.literal(T.enum.VOUCHER),
595
- collectible: n,
596
- collectibleConfig: e.lazy(() => L._def.right.options[0]),
597
- earningOption: e.lazy(() => m)
598
- }), I = e.object({
599
- type: e.literal(T.enum.LOYALTY),
600
- collectible: n,
601
- earningOption: e.lazy(() => m),
602
- validityOption: e.lazy(() => ae)
603
- }), W = V.extend({
604
- weight: M
605
- }), K = I.extend({
606
- weight: e.number().min(0, "Weight need to be at least 0")
607
- }), hn = I.extend({
608
- validityOption: S,
609
- weight: M
610
- }), Qe = e.discriminatedUnion("type", [
611
- W,
612
- K,
613
- v
614
- ]), O = e.discriminatedUnion("type", [
615
- W.extend({
616
- collectible: n.nullish(),
617
- business: n.nullish()
618
- }),
619
- K.extend({
620
- collectible: n.nullish(),
621
- business: n.nullish()
622
- }),
623
- v
624
- ]), Y = V.extend({
625
- threshold: P
626
- }), J = I.extend({
627
- threshold: P
628
- }), Cn = I.extend({
629
- validityOption: S,
630
- threshold: P
631
- }), q = e.discriminatedUnion("type", [
632
- Y,
633
- J
634
- ]), en = e.discriminatedUnion("type", [
635
- Y.extend({
636
- collectible: n.nullish(),
637
- business: n.nullish()
638
- }),
639
- J.extend({
640
- collectible: n.nullish(),
641
- collectibleConfig: L.nullish(),
642
- business: n.nullish()
643
- })
644
- ]), nn = {
645
- collectionName: "Locations",
646
- transform: {
647
- _id: "oid",
648
- business: "oid"
649
- }
650
- }, Z = e.object({
651
- _id: n,
652
- business: n,
653
- name: e.string(),
654
- code: e.string().nullish(),
655
- otp: e.string().nullish(),
656
- otpExpiredAt: e.coerce.date().nullish(),
657
- apiToken: e.string().nullish()
658
- }).describe(l.describe(nn));
659
- e.object({
660
- _id: n,
661
- name: e.string(),
662
- location: n,
663
- os: e.string(),
664
- apiToken: e.string().nullish()
665
- }).describe(l.describe({
666
- collectionName: "LocationDevices",
667
- transform: {
668
- _id: "oid",
669
- location: "oid"
670
- }
671
- }));
672
- const tn = e.enum(["PROGRESSIVE", "STAMP"]), on = e.object({
673
- type: tn,
674
- end: e.number().int().min(0, "Threshold need to be at least 1"),
675
- rewards: e.array(e.lazy(() => q)).nullish()
676
- }).superRefine((t, i) => {
677
- t.type == "STAMP" && t.end > 40 && (i.addIssue({
678
- code: "custom",
679
- path: [],
680
- message: "Stamp mission can have at most 40 threshold"
681
- }), i.addIssue({
682
- code: "custom",
683
- path: ["end"],
684
- message: "Stamp mission can have at most 40 threshold"
685
- }));
686
- }), sn = {
687
- collectionName: "Groups",
688
- transform: {
689
- _id: "oid",
690
- business: "oid"
691
- },
692
- lookups: {
693
- business: {
694
- fromCollection: "Businesses",
695
- as: "pf_business"
696
- },
697
- pf_campaigns: {
698
- fromCollection: "Campaigns",
699
- as: "pf_campaigns",
700
- localField: "_id",
701
- foreignField: "group"
702
- }
703
- }
704
- }, fn = e.object({
705
- _id: n,
706
- name: e.string().min(1).max(300),
707
- business: n,
708
- pf_campaigns: e.array(e.any()).optional()
709
- }).describe(l.describe(sn)), an = e.object({
710
- type: e.literal(x.enum.MEMBERSHIP),
711
- business: n,
712
- name: e.string().min(1).max(50),
713
- image: e.string().nullish(),
714
- url: e.string().nullish(),
715
- tiers: e.array(e.lazy(() => A)),
716
- titles: e.array(n),
717
- tierCycleEnable: e.boolean().optional(),
718
- tierCycle: e.lazy(() => f).nullish(),
719
- welcomeMessage: y.optional(),
720
- advertisements: e.array(e.string()).optional(),
721
- cardEnable: e.boolean().optional(),
722
- design: e.array(
723
- e.object({
724
- _id: n,
725
- image: e.string()
726
- })
727
- ).optional(),
728
- targetLocation: e.array(n).nullish(),
729
- brand: e.string().nullish(),
730
- freeCreditAsDiscount: e.boolean().optional(),
731
- pf_title: e.array(e.lazy(() => p)).optional(),
732
- pf_targetLocation: e.array(e.lazy(() => Z)).optional(),
733
- // new structure
734
- group: e.string().nullish(),
735
- templateId: n.nullish()
736
- }), o = x.exclude(["MEMBERSHIP"]), c = e.object({
737
- _id: n.nullish(),
738
- type: o,
739
- // common information
740
- business: n,
741
- name: e.string().min(1).max(50),
742
- image: e.string().nullish(),
743
- description: e.string().max(500).nullish(),
744
- timeframeOptions: re.superRefine((t, i) => {
745
- t.start && t.end && t.end < t.start && i.addIssue({
746
- code: "custom",
747
- path: [],
748
- params: {
749
- i18n: { key: "timeframe.end_before_start" }
750
- }
751
- });
752
- }).nullish(),
753
- targetLocation: e.array(n).nullish(),
754
- event: Fe,
755
- config: le.nullish(),
756
- currentReceive: e.coerce.number().optional(),
757
- // new group structure
758
- group: n.nullish(),
759
- templateId: n.nullish(),
760
- pf_targetLocation: e.array(e.lazy(() => Z)).optional()
761
- }), d = {
762
- [o.enum.VOUCHER]: [
763
- "BILL_COMPLETED",
764
- "FEEDBACK",
765
- "MEMBERSHIP_JOINED",
766
- "TIER_UPGRADED",
767
- "SCHEDULE",
768
- "SIMPLE_CLAIM"
769
- ],
770
- [o.enum.PROMOTION]: ["MAKING_ORDER"],
771
- [o.enum.POINT]: [
772
- "BILL_COMPLETED",
773
- "FEEDBACK",
774
- "MEMBERSHIP_JOINED",
775
- "TIER_UPGRADED",
776
- "SCHEDULE"
777
- ],
778
- [o.enum.CREDIT]: [
779
- "BILL_COMPLETED",
780
- "FEEDBACK",
781
- "MEMBERSHIP_JOINED",
782
- "TIER_UPGRADED",
783
- "SCHEDULE"
784
- ],
785
- [o.enum.BROADCAST]: [
786
- "SCHEDULE",
787
- "ISSUE_REWARD",
788
- "FEEDBACK"
789
- ],
790
- [o.enum.COIN]: [
791
- "BILL_COMPLETED",
792
- "FEEDBACK",
793
- "MEMBERSHIP_JOINED",
794
- "TIER_UPGRADED",
795
- "SCHEDULE"
796
- ],
797
- [o.enum.REWARD_POOL]: ["GAME_COMPLETED"],
798
- [o.enum.GAME]: [
799
- "BILL_COMPLETED",
800
- "FEEDBACK",
801
- "MEMBERSHIP_JOINED",
802
- "TIER_UPGRADED",
803
- "SCHEDULE",
804
- "SIMPLE_CLAIM"
805
- ],
806
- [o.enum.MISSION]: [
807
- "BILL_COMPLETED",
808
- "FEEDBACK",
809
- "SCHEDULE"
810
- ]
811
- }, X = c.extend({
812
- type: e.literal(o.enum.VOUCHER),
813
- // event
814
- code: e.string().min(0).max(15).optional(),
815
- event: a.merge(
816
- e.object({
817
- type: e.enum(d[o.enum.VOUCHER])
818
- })
819
- ),
820
- earningOption: m.default({
821
- amount: 1,
822
- type: "FIXED"
823
- }),
824
- collectible: n,
825
- hideInApp: e.boolean().optional(),
826
- notify: e.boolean().optional(),
827
- notifyMessage: e.lazy(() => y).optional(),
828
- notifyCampaign: n.nullish(),
829
- pf_collectible: e.lazy(() => p).optional(),
830
- pf_notifyCampaign: e.lazy(() => h).optional()
831
- }), rn = e.object({
832
- gameType: e.string()
833
- }), $ = c.extend({
834
- type: e.literal(o.enum.PROMOTION),
835
- // event
836
- event: a.merge(
837
- e.object({
838
- type: e.enum(d[o.enum.PROMOTION])
839
- })
840
- ),
841
- effect: e.custom().superRefine((t, i) => {
842
- t || i.addIssue({
843
- code: "custom",
844
- path: [],
845
- params: {
846
- i18n: { key: "zodCustom.campaign.effect_required" }
847
- }
848
- });
849
- }),
850
- gameConfig: rn.nullish()
851
- }), Q = c.extend({
852
- type: e.literal(o.enum.POINT),
853
- // event
854
- event: a.merge(
855
- e.object({
856
- type: e.enum(d[o.enum.POINT])
857
- })
858
- ),
859
- earningOption: m,
860
- collectible: n,
861
- notify: e.boolean().optional(),
862
- notifyMessage: e.lazy(() => y).optional(),
863
- notifyCampaign: n.nullish(),
864
- pf_collectible: e.lazy(() => p).optional(),
865
- pf_notifyCampaign: e.lazy(() => h).optional()
866
- }), ee = c.extend({
867
- type: e.literal(o.enum.CREDIT),
868
- // event
869
- event: a.merge(
870
- e.object({
871
- type: e.enum(d[o.enum.CREDIT])
872
- })
873
- ),
874
- earningOption: m,
875
- collectible: n,
876
- notify: e.boolean().optional(),
877
- notifyMessage: e.lazy(() => y).optional(),
878
- notifyCampaign: n.nullish(),
879
- pf_collectible: e.lazy(() => p).optional(),
880
- pf_notifyCampaign: e.lazy(() => h).optional()
881
- }), h = c.extend({
882
- type: e.literal(o.enum.BROADCAST),
883
- // event
884
- event: a.merge(
885
- e.object({
886
- type: e.enum(d[o.enum.BROADCAST])
887
- })
888
- ),
889
- message: y,
890
- linkedCampaign: n.nullish()
891
- }), ne = c.extend({
892
- type: e.literal(o.enum.COIN),
893
- // event
894
- event: a.merge(
895
- e.object({
896
- type: e.enum(d[o.enum.COIN])
897
- })
898
- ),
899
- earningOption: m,
900
- collectible: n,
901
- notify: e.boolean().optional(),
902
- notifyMessage: e.lazy(() => y).optional(),
903
- notifyCampaign: n.nullish(),
904
- pf_collectible: e.lazy(() => p).optional(),
905
- pf_notifyCampaign: e.lazy(() => h).optional()
906
- }), R = c.extend({
907
- type: e.literal(o.enum.REWARD_POOL),
908
- // event
909
- event: a.merge(
910
- e.object({
911
- type: e.enum(d[o.enum.REWARD_POOL])
912
- })
913
- ),
914
- rewards: e.array(e.lazy(() => Qe)).min(1, "Requires at least 1 reward")
915
- }), te = c.extend({
916
- type: e.literal(o.enum.GAME),
917
- // event
918
- event: a.merge(
919
- e.object({
920
- type: e.enum(d[o.enum.GAME])
921
- })
922
- ),
923
- earningOption: m,
924
- collectible: n,
925
- game: e.lazy(() => R).optional(),
926
- pf_collectible: e.lazy(() => p).optional(),
927
- rewardPool: n.optional()
928
- }), oe = c.extend({
929
- type: e.literal(o.enum.MISSION),
930
- event: a.merge(
931
- e.object({
932
- type: e.enum(d[o.enum.MISSION])
933
- })
934
- ),
935
- earningOption: m,
936
- collectible: n,
937
- pf_collectible: e.lazy(() => p).optional(),
938
- mission: e.lazy(() => on),
939
- rewards: e.array(e.lazy(() => q)).min(1, "Requires at least 1 reward")
940
- }), ln = {
941
- collectionName: "Campaigns",
942
- transform: {
943
- _id: "oid",
944
- business: "oid",
945
- collectible: "oid",
946
- templateId: "oid",
947
- group: "oid",
948
- notifyCampaign: "oid",
949
- linkedCampaign: "oid",
950
- rewardPool: "oid"
951
- },
952
- lookups: {
953
- business: {
954
- fromCollection: "Businesses",
955
- as: "pf_business"
956
- },
957
- targetLocation: {
958
- fromCollection: "Locations",
959
- as: "pf_targetLocation"
960
- },
961
- collectible: {
962
- fromCollection: "CollectibleConfigs",
963
- as: "pf_collectible"
964
- },
965
- titles: {
966
- fromCollection: "CollectibleConfigs",
967
- as: "pf_title"
968
- },
969
- templateId: {
970
- fromCollection: "Templates",
971
- as: "template"
972
- },
973
- notifyCampaign: {
974
- fromCollection: "Campaigns",
975
- as: "pf_notifyCampaign"
976
- },
977
- rewardPool: {
978
- fromCollection: "Campaigns",
979
- as: "game"
980
- }
981
- }
982
- }, _n = e.object({ _id: n }).and(
983
- e.discriminatedUnion("type", [
984
- an,
985
- X,
986
- $,
987
- Q,
988
- ee,
989
- h,
990
- ne,
991
- R,
992
- te,
993
- oe
994
- ])
995
- ).describe(l.describe(ln)), Rn = e.discriminatedUnion("type", [
996
- X.extend({
997
- business: n.nullish()
998
- }),
999
- $.extend({
1000
- business: n.nullish()
1001
- }),
1002
- Q.extend({
1003
- business: n.nullish()
1004
- }),
1005
- ee.extend({
1006
- business: n.nullish()
1007
- }),
1008
- h.extend({
1009
- business: n.nullish()
1010
- }),
1011
- ne.extend({
1012
- business: n.nullish()
1013
- }),
1014
- R.extend({
1015
- rewards: e.array(e.lazy(() => O)).min(1, "Requires at least 1 reward")
1016
- }),
1017
- te.extend({
1018
- business: n.nullish(),
1019
- game: R.extend({
1020
- business: n.nullish(),
1021
- rewards: e.array(e.lazy(() => O)).min(1, "Requires at least 1 reward")
1022
- })
1023
- }),
1024
- oe.extend({
1025
- business: n.nullish(),
1026
- rewards: e.array(e.lazy(() => en)).min(1, "Requires at least 1 reward")
1027
- })
1028
- ]);
1029
- export {
1030
- d as C,
1031
- En as F,
1032
- o as a,
1033
- hn as b,
1034
- O as c,
1035
- tn as d,
1036
- Cn as e,
1037
- en as f,
1038
- on as g,
1039
- fn as h,
1040
- Rn as i,
1041
- _n as j,
1042
- bn as k,
1043
- s as l,
1044
- Ke as m,
1045
- U as n,
1046
- we as o,
1047
- G as p,
1048
- j as q,
1049
- Fe as r,
1050
- yn as s
1051
- };