@feedmepos/mf-connect 0.1.8-prod → 0.1.10-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 (94) hide show
  1. package/dist/{Analytic-C5DiiAlc.js → Analytic-CpSbitWV.js} +24 -22
  2. package/dist/{App-B3pHa-zu.js → App-BPT8XzjX.js} +56 -51
  3. package/dist/{Broadcast-BbKiYeZC.js → Broadcast-CJHpiQeN.js} +8 -8
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CusmGpDT.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DUPqWdIm.js} +7 -8
  5. package/dist/Card-Bvn36zqZ.js +895 -0
  6. package/dist/{Collections-DvZEXknp.js → Collections-Bq6OxsJC.js} +24 -29
  7. package/dist/{Credit-CqjSUWeG.js → Credit-Dno_g7dW.js} +8 -8
  8. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +108 -0
  9. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bzd-9d8d.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-cGbwORhw.js} +649 -1284
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-C73wNCE4.js → EffectSheet.vue_vue_type_style_index_0_lang-Ho7zwlbb.js} +20 -20
  11. package/dist/{Experience-BmCrc4-K.js → Experience-BC1qSIGO.js} +8 -8
  12. package/dist/{Game-CU4AHASb.js → Game-C_CKGMBW.js} +8 -8
  13. package/dist/Index-BXFaWTfw.js +255 -0
  14. package/dist/{Marketing-PJO3M5Xy.js → Marketing-Ni0WAie5.js} +5 -5
  15. package/dist/{Member-DChbb26Z.js → Member-djnisrK1.js} +4 -4
  16. package/dist/{MemberList-Ckvxgme7.js → MemberList-CclU-3B7.js} +194 -191
  17. package/dist/{MemberTransactions-KNlKr1DE.js → MemberTransactions-DVVsv3Ux.js} +1 -1
  18. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CDX1qdOw.js → MessageInput.vue_vue_type_script_setup_true_lang-khyDg1m4.js} +2 -2
  19. package/dist/Mission-Z5somdo_.js +273 -0
  20. package/dist/Overview-BvMVz3lQ.js +1074 -0
  21. package/dist/{Point-B-Ot-ZXU.js → Point-DdPukiTg.js} +8 -8
  22. package/dist/{Promotion-CKEfuwo0.js → Promotion-DCqdIwjG.js} +9 -9
  23. package/dist/Record-CvMxXm1B.js +337 -0
  24. package/dist/Reward-CiJHGXfQ.js +441 -0
  25. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-CrGCBRmH.js +150 -0
  26. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-tnT6i0Jq.js +1638 -0
  27. package/dist/{Segment-B8JKn5_y.js → Segment-CQb3j-o0.js} +22 -21
  28. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-B7YqIU5D.js +181 -0
  29. package/dist/{Setting-BcWDJ-63.js → Setting-91cK3ssU.js} +31 -31
  30. package/dist/Store-B-uldUKt.js +1744 -0
  31. package/dist/{StoreRewards-DyfFecSH.js → StoreRewards-dDNeFlA9.js} +15 -14
  32. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BVb1X0aq.js +1132 -0
  33. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-CHrZ7pit.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-Ds0WxGxr.js} +1 -1
  34. package/dist/{Tier-iKOv9e2Y.js → Tier-_jMaLj3u.js} +185 -185
  35. package/dist/{Title-BRWnLlHd.js → Title-By7o67aT.js} +20 -20
  36. package/dist/{Transaction-BMnxATxc.js → Transaction-BLpEgeI2.js} +2 -2
  37. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Bf_nO9zH.js +130 -0
  38. package/dist/{Voucher-B_IwtXLW.js → Voucher-CG5tfibn.js} +11 -11
  39. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DpQUoXyQ.js +419 -0
  40. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-YwGR2En3.js +56 -0
  41. package/dist/{app-Bs8TZeMP.js → app-DDmTqTb7.js} +1 -1
  42. package/dist/{app-CLPpu6jA.js → app-vCqTQIeC.js} +430 -276
  43. package/dist/app.js +1 -1
  44. package/dist/{business-Dg5T3krT.js → business-Cz78KGF2.js} +1 -1
  45. package/dist/{campaign-BMLeXfnZ.js → campaign-BBd4o7F_.js} +2 -2
  46. package/dist/campaign.enum-CIhi0b-m.js +20 -0
  47. package/dist/campaign.fn-5silF1DK.js +758 -0
  48. package/dist/collectible.enum-cMIQ6ogq.js +19 -0
  49. package/dist/{collection.fn-D4QJRMAS.js → collection.fn-BGc7Qeli.js} +2 -2
  50. package/dist/dto-i04OPJfW.js +2018 -0
  51. package/dist/{effect-BT6zDeUe.js → effect-D8UzkYRg.js} +1 -1
  52. package/dist/{email-addresses-DeUE8GFC.js → email-addresses-u05o35hN.js} +1 -1
  53. package/dist/{export-DWzBynN8.js → export-BEXuPYEd.js} +3 -3
  54. package/dist/{helper-Cs4YpYv9.js → helper-RptRJGv6.js} +1 -1
  55. package/dist/{index-aFNPEkUz.js → index-B8s-gucK.js} +13 -1
  56. package/dist/{index-B3GqF_vh.js → index-BjHZUhiH.js} +1 -1
  57. package/dist/{index-BUXB-qmB.js → index-Bpu2DYUc.js} +1348 -1342
  58. package/dist/{index-n-_5f43h.js → index-C6-rCMhD.js} +3 -3
  59. package/dist/{index-CjF0scjl.js → index-Cq_ZIbRm.js} +174 -168
  60. package/dist/{index-CiwzD983.js → index-DFAnoAe9.js} +1 -1
  61. package/dist/index-DbyJ6Nyn.js +54 -0
  62. package/dist/{index-BXs-tqST.js → index-Dt6K2eG8.js} +1 -1
  63. package/dist/{index-xCMvgFRa.js → index-DwzoqCt8.js} +989 -783
  64. package/dist/index-UfL5qRzR.js +1049 -0
  65. package/dist/index-g8EbRVnr.js +32 -0
  66. package/dist/{index-DfhJOhMY.js → index-hEE_ntHd.js} +1 -1
  67. package/dist/index-vh86FiIQ.js +10 -0
  68. package/dist/{index.esm2017-cme_1dHU.js → index.esm2017-BSzW_yaL.js} +1 -1
  69. package/dist/{loading-zw44FQ6v.js → loading-DjEdwdnj.js} +156 -153
  70. package/dist/{membership-Bg77E5Sx.js → membership-BL9Xs8lD.js} +52 -44
  71. package/dist/{money-BepQPzrc.js → money-D7lq0cx-.js} +1 -1
  72. package/dist/{number-BJ4XIfGj.js → number-BiDabTkI.js} +1 -1
  73. package/dist/objectid-CXf0jb1W.js +145 -0
  74. package/dist/reward-Cr8rbe5R.js +36 -0
  75. package/dist/{rule-builder-C1Jwhs7N.js → rule-builder-DPKFZ5UX.js} +1 -1
  76. package/dist/{rule-oDZ1Kic9.js → rule-vkYJij4h.js} +4 -3
  77. package/dist/{template-CSeRj8B2.js → template-Bep5Y5ch.js} +4 -4
  78. package/dist/trigger-fWhQ3bqv.js +144 -0
  79. package/dist/{usePagination-DUaGlE2s.js → usePagination-DSF5b4hM.js} +1 -1
  80. package/dist/user-9UiaP0xs.js +54 -0
  81. package/dist/{vue-i18n-4eZqYBzI.js → vue-i18n-BhiDOB1j.js} +112 -112
  82. package/dist/zod-Bg2FbC-D.js +90 -0
  83. package/package.json +2 -2
  84. package/dist/Card--Q4OMSRz.js +0 -824
  85. package/dist/Mission-B215NI_F.js +0 -261
  86. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-C03bKqvg.js +0 -1804
  87. package/dist/Store-ada-EZLR.js +0 -1530
  88. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Ra4nMKvT.js +0 -890
  89. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-vsgeD3mK.js +0 -141
  90. package/dist/dto-CQy53qRe.js +0 -2770
  91. package/dist/index-CvJ_6M8U.js +0 -298
  92. package/dist/index-QAuJWbpX.js +0 -756
  93. package/dist/index-sGtk4oiO.js +0 -207
  94. package/dist/user-Bm4KttFq.js +0 -37
@@ -0,0 +1,1049 @@
1
+ import { z as e, F as n, e as E, m as l, g as se, d as F } from "./loading-DjEdwdnj.js";
2
+ import { F as x } from "./campaign.enum-CIhi0b-m.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-Bpu2DYUc.js";
4
+ import { i as D, g as N, h as ce } from "./index-DwzoqCt8.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()
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(),
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
+ }), qe = {
430
+ collectionName: "StoreTransactions",
431
+ transform: {
432
+ _id: "oid",
433
+ business: "oid",
434
+ location: "oid",
435
+ member: "oid",
436
+ transactions: "oid"
437
+ },
438
+ lookups: {
439
+ member: {
440
+ fromCollection: "UsersV2",
441
+ as: "pf_member"
442
+ }
443
+ }
444
+ }, k = e.object({
445
+ _id: n,
446
+ source: j,
447
+ // can be memberStorePurchase
448
+ ref: e.string(),
449
+ business: n,
450
+ company: U,
451
+ location: n.optional(),
452
+ member: n,
453
+ // createdAt: z.coerce.date(),
454
+ bundle: G,
455
+ transactions: e.array(n),
456
+ // array of transaction id (voucher, credit, title)
457
+ status: e.enum([
458
+ "PENDING_PAYMENT",
459
+ "PENDING_TRANSACTION",
460
+ "COMPLETED",
461
+ "REFUNDED"
462
+ ]),
463
+ refund: Je.nullish(),
464
+ paymentType: H.nullish(),
465
+ paymentRef: e.string().nullish(),
466
+ webhookUrl: e.string().optional(),
467
+ webhookSent: e.boolean().optional(),
468
+ pf_transactions: e.array(e.any()).optional(),
469
+ pf_member: e.any().optional(),
470
+ pf_location: e.any().optional(),
471
+ pf_ref: e.any().optional()
472
+ }).describe(l.describe(qe));
473
+ e.object({
474
+ bundle: n,
475
+ member: e.string(),
476
+ ref: e.string(),
477
+ paymentType: H.nullish(),
478
+ withCoin: e.boolean().optional(),
479
+ card: e.string().optional(),
480
+ location: n.optional(),
481
+ source: j,
482
+ webhookUrl: e.string().optional()
483
+ });
484
+ e.object({
485
+ categories: e.array(z)
486
+ });
487
+ e.object({
488
+ id: n,
489
+ reason: e.string(),
490
+ location: n.optional()
491
+ });
492
+ e.object({
493
+ _id: n,
494
+ business: n,
495
+ user: n,
496
+ bundleId: e.string(),
497
+ transaction: e.array(n),
498
+ subscriptionId: e.string(),
499
+ expiredAt: e.coerce.date()
500
+ }).describe(
501
+ l.describe({
502
+ collectionName: "StoreSubscriptions",
503
+ transform: {
504
+ _id: "oid",
505
+ business: "oid",
506
+ user: "oid",
507
+ transaction: "oid",
508
+ expiredAt: "date"
509
+ }
510
+ })
511
+ );
512
+ e.object({
513
+ member: e.string(),
514
+ subscriptionId: e.string()
515
+ });
516
+ const Ze = {
517
+ collectionName: "Cards",
518
+ transform: {
519
+ _id: "oid",
520
+ business: "oid",
521
+ member: "oid",
522
+ redeemedAt: "date"
523
+ },
524
+ lookups: {
525
+ business: {
526
+ as: "business",
527
+ fromCollection: "Business"
528
+ },
529
+ member: {
530
+ as: "pf_member",
531
+ fromCollection: "UsersV2"
532
+ }
533
+ }
534
+ };
535
+ e.object({
536
+ _id: n,
537
+ business: n,
538
+ serialNumber: e.string(),
539
+ setCardOnBind: e.boolean().nullish(),
540
+ redeemedAt: e.date().nullish(),
541
+ member: n.nullish(),
542
+ design: e.string().nullish(),
543
+ bundle: e.string().nullish(),
544
+ subscriptionBundle: e.string().nullish(),
545
+ pf_member: e.lazy(() => D).nullish(),
546
+ pf_transaction: e.lazy(() => k).nullish()
547
+ }).describe(l.describe(Ze));
548
+ const Xe = e.object({
549
+ length: e.coerce.number().optional(),
550
+ charset: e.string(),
551
+ prefix: e.string().optional(),
552
+ suffix: e.string().optional(),
553
+ pattern: e.string().optional()
554
+ });
555
+ e.object({
556
+ quantity: e.number(),
557
+ code: e.string(),
558
+ codeConfig: Xe,
559
+ setCardOnBind: e.boolean().optional(),
560
+ design: e.string().nullish(),
561
+ bundle: e.string().optional(),
562
+ subscriptionBundle: e.string().optional()
563
+ });
564
+ const $e = e.enum(["SMS", "WHATSAPP"]), y = e.object({
565
+ channel: $e,
566
+ variables: e.array(e.string()),
567
+ content: e.string(),
568
+ language: e.string(),
569
+ imageUrl: e.string().optional()
570
+ }).superRefine((t, i) => {
571
+ t.content.length == 0 && i.addIssue({
572
+ code: e.ZodIssueCode.custom,
573
+ message: "Content is required"
574
+ });
575
+ const r = /{{(.*?)}}/g, g = [...t.content.matchAll(r)].map((b) => b[1]), _ = t.variables, C = g.filter((b) => _.indexOf(b) < 0);
576
+ C.length && i.addIssue({
577
+ code: e.ZodIssueCode.custom,
578
+ message: "Invalid variable(s): " + C.join(", ")
579
+ });
580
+ });
581
+ function yn(t, i) {
582
+ return t.replace(/{{(.*?)}}/g, (r, g) => {
583
+ const C = g.trim().split(".").reduce((b, ie) => (b != null ? b[ie] : null) ?? null, i);
584
+ return C !== null ? C : r;
585
+ });
586
+ }
587
+ 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({
588
+ type: e.literal(T.enum.NO_REWARD),
589
+ collectible: e.null(),
590
+ weight: M
591
+ }), V = e.object({
592
+ type: e.literal(T.enum.VOUCHER),
593
+ collectible: n,
594
+ collectibleConfig: e.lazy(() => L._def.right.options[0]),
595
+ earningOption: e.lazy(() => m)
596
+ }), I = e.object({
597
+ type: e.literal(T.enum.LOYALTY),
598
+ collectible: n,
599
+ earningOption: e.lazy(() => m),
600
+ validityOption: e.lazy(() => ae)
601
+ }), W = V.extend({
602
+ weight: M
603
+ }), K = I.extend({
604
+ weight: e.number().min(0, "Weight need to be at least 0")
605
+ }), hn = I.extend({
606
+ validityOption: S,
607
+ weight: M
608
+ }), Qe = e.discriminatedUnion("type", [
609
+ W,
610
+ K,
611
+ v
612
+ ]), O = e.discriminatedUnion("type", [
613
+ W.extend({
614
+ collectible: n.nullish(),
615
+ business: n.nullish()
616
+ }),
617
+ K.extend({
618
+ collectible: n.nullish(),
619
+ business: n.nullish()
620
+ }),
621
+ v
622
+ ]), Y = V.extend({
623
+ threshold: P
624
+ }), J = I.extend({
625
+ threshold: P
626
+ }), Cn = I.extend({
627
+ validityOption: S,
628
+ threshold: P
629
+ }), q = e.discriminatedUnion("type", [
630
+ Y,
631
+ J
632
+ ]), en = e.discriminatedUnion("type", [
633
+ Y.extend({
634
+ collectible: n.nullish(),
635
+ business: n.nullish()
636
+ }),
637
+ J.extend({
638
+ collectible: n.nullish(),
639
+ collectibleConfig: L.nullish(),
640
+ business: n.nullish()
641
+ })
642
+ ]), nn = {
643
+ collectionName: "Locations",
644
+ transform: {
645
+ _id: "oid",
646
+ business: "oid"
647
+ }
648
+ }, Z = e.object({
649
+ _id: n,
650
+ business: n,
651
+ name: e.string(),
652
+ code: e.string().nullish(),
653
+ otp: e.string().nullish(),
654
+ otpExpiredAt: e.coerce.date().nullish(),
655
+ apiToken: e.string().nullish()
656
+ }).describe(l.describe(nn));
657
+ e.object({
658
+ _id: n,
659
+ name: e.string(),
660
+ location: n,
661
+ os: e.string(),
662
+ apiToken: e.string().nullish()
663
+ }).describe(l.describe({
664
+ collectionName: "LocationDevices",
665
+ transform: {
666
+ _id: "oid",
667
+ location: "oid"
668
+ }
669
+ }));
670
+ const tn = e.enum(["PROGRESSIVE", "STAMP"]), on = e.object({
671
+ type: tn,
672
+ end: e.number().int().min(0, "Threshold need to be at least 1"),
673
+ rewards: e.array(e.lazy(() => q)).nullish()
674
+ }).superRefine((t, i) => {
675
+ t.type == "STAMP" && t.end > 40 && (i.addIssue({
676
+ code: "custom",
677
+ path: [],
678
+ message: "Stamp mission can have at most 40 threshold"
679
+ }), i.addIssue({
680
+ code: "custom",
681
+ path: ["end"],
682
+ message: "Stamp mission can have at most 40 threshold"
683
+ }));
684
+ }), sn = {
685
+ collectionName: "Groups",
686
+ transform: {
687
+ _id: "oid",
688
+ business: "oid"
689
+ },
690
+ lookups: {
691
+ business: {
692
+ fromCollection: "Businesses",
693
+ as: "pf_business"
694
+ },
695
+ pf_campaigns: {
696
+ fromCollection: "Campaigns",
697
+ as: "pf_campaigns",
698
+ localField: "_id",
699
+ foreignField: "group"
700
+ }
701
+ }
702
+ }, fn = e.object({
703
+ _id: n,
704
+ name: e.string().min(1).max(300),
705
+ business: n,
706
+ pf_campaigns: e.array(e.any()).optional()
707
+ }).describe(l.describe(sn)), an = e.object({
708
+ type: e.literal(x.enum.MEMBERSHIP),
709
+ business: n,
710
+ name: e.string().min(1).max(50),
711
+ image: e.string().nullish(),
712
+ url: e.string().nullish(),
713
+ tiers: e.array(e.lazy(() => A)),
714
+ titles: e.array(n),
715
+ tierCycleEnable: e.boolean().optional(),
716
+ tierCycle: e.lazy(() => f).nullish(),
717
+ welcomeMessage: y.optional(),
718
+ advertisements: e.array(e.string()).optional(),
719
+ cardEnable: e.boolean().optional(),
720
+ design: e.array(
721
+ e.object({
722
+ _id: n,
723
+ image: e.string()
724
+ })
725
+ ).optional(),
726
+ targetLocation: e.array(n).nullish(),
727
+ brand: e.string().nullish(),
728
+ freeCreditAsDiscount: e.boolean().optional(),
729
+ pf_title: e.array(e.lazy(() => p)).optional(),
730
+ pf_targetLocation: e.array(e.lazy(() => Z)).optional(),
731
+ // new structure
732
+ group: e.string().nullish(),
733
+ templateId: n.nullish()
734
+ }), o = x.exclude(["MEMBERSHIP"]), c = e.object({
735
+ _id: n.nullish(),
736
+ type: o,
737
+ // common information
738
+ business: n,
739
+ name: e.string().min(1).max(50),
740
+ image: e.string().nullish(),
741
+ description: e.string().max(500).nullish(),
742
+ timeframeOptions: re.superRefine((t, i) => {
743
+ t.start && t.end && t.end < t.start && i.addIssue({
744
+ code: "custom",
745
+ path: [],
746
+ params: {
747
+ i18n: { key: "timeframe.end_before_start" }
748
+ }
749
+ });
750
+ }).nullish(),
751
+ targetLocation: e.array(n).nullish(),
752
+ event: Fe,
753
+ config: le.nullish(),
754
+ currentReceive: e.coerce.number().optional(),
755
+ // new group structure
756
+ group: n.nullish(),
757
+ templateId: n.nullish(),
758
+ pf_targetLocation: e.array(e.lazy(() => Z)).optional()
759
+ }), d = {
760
+ [o.enum.VOUCHER]: [
761
+ "BILL_COMPLETED",
762
+ "FEEDBACK",
763
+ "MEMBERSHIP_JOINED",
764
+ "TIER_UPGRADED",
765
+ "SCHEDULE",
766
+ "SIMPLE_CLAIM"
767
+ ],
768
+ [o.enum.PROMOTION]: ["MAKING_ORDER"],
769
+ [o.enum.POINT]: [
770
+ "BILL_COMPLETED",
771
+ "FEEDBACK",
772
+ "MEMBERSHIP_JOINED",
773
+ "TIER_UPGRADED",
774
+ "SCHEDULE"
775
+ ],
776
+ [o.enum.CREDIT]: [
777
+ "BILL_COMPLETED",
778
+ "FEEDBACK",
779
+ "MEMBERSHIP_JOINED",
780
+ "TIER_UPGRADED",
781
+ "SCHEDULE"
782
+ ],
783
+ [o.enum.BROADCAST]: [
784
+ "SCHEDULE",
785
+ "ISSUE_REWARD",
786
+ "FEEDBACK"
787
+ ],
788
+ [o.enum.COIN]: [
789
+ "BILL_COMPLETED",
790
+ "FEEDBACK",
791
+ "MEMBERSHIP_JOINED",
792
+ "TIER_UPGRADED",
793
+ "SCHEDULE"
794
+ ],
795
+ [o.enum.REWARD_POOL]: ["GAME_COMPLETED"],
796
+ [o.enum.GAME]: [
797
+ "BILL_COMPLETED",
798
+ "FEEDBACK",
799
+ "MEMBERSHIP_JOINED",
800
+ "TIER_UPGRADED",
801
+ "SCHEDULE",
802
+ "SIMPLE_CLAIM"
803
+ ],
804
+ [o.enum.MISSION]: [
805
+ "BILL_COMPLETED",
806
+ "FEEDBACK",
807
+ "SCHEDULE"
808
+ ]
809
+ }, X = c.extend({
810
+ type: e.literal(o.enum.VOUCHER),
811
+ // event
812
+ code: e.string().min(0).max(15).optional(),
813
+ event: a.merge(
814
+ e.object({
815
+ type: e.enum(d[o.enum.VOUCHER])
816
+ })
817
+ ),
818
+ earningOption: m.default({
819
+ amount: 1,
820
+ type: "FIXED"
821
+ }),
822
+ collectible: n,
823
+ hideInApp: e.boolean().optional(),
824
+ notify: e.boolean().optional(),
825
+ notifyMessage: e.lazy(() => y).optional(),
826
+ notifyCampaign: n.nullish(),
827
+ pf_collectible: e.lazy(() => p).optional(),
828
+ pf_notifyCampaign: e.lazy(() => h).optional()
829
+ }), rn = e.object({
830
+ gameType: e.string()
831
+ }), $ = c.extend({
832
+ type: e.literal(o.enum.PROMOTION),
833
+ // event
834
+ event: a.merge(
835
+ e.object({
836
+ type: e.enum(d[o.enum.PROMOTION])
837
+ })
838
+ ),
839
+ effect: e.custom().superRefine((t, i) => {
840
+ t || i.addIssue({
841
+ code: "custom",
842
+ path: [],
843
+ params: {
844
+ i18n: { key: "zodCustom.campaign.effect_required" }
845
+ }
846
+ });
847
+ }),
848
+ gameConfig: rn.nullish()
849
+ }), Q = c.extend({
850
+ type: e.literal(o.enum.POINT),
851
+ // event
852
+ event: a.merge(
853
+ e.object({
854
+ type: e.enum(d[o.enum.POINT])
855
+ })
856
+ ),
857
+ earningOption: m,
858
+ collectible: n,
859
+ notify: e.boolean().optional(),
860
+ notifyMessage: e.lazy(() => y).optional(),
861
+ notifyCampaign: n.nullish(),
862
+ pf_collectible: e.lazy(() => p).optional(),
863
+ pf_notifyCampaign: e.lazy(() => h).optional()
864
+ }), ee = c.extend({
865
+ type: e.literal(o.enum.CREDIT),
866
+ // event
867
+ event: a.merge(
868
+ e.object({
869
+ type: e.enum(d[o.enum.CREDIT])
870
+ })
871
+ ),
872
+ earningOption: m,
873
+ collectible: n,
874
+ notify: e.boolean().optional(),
875
+ notifyMessage: e.lazy(() => y).optional(),
876
+ notifyCampaign: n.nullish(),
877
+ pf_collectible: e.lazy(() => p).optional(),
878
+ pf_notifyCampaign: e.lazy(() => h).optional()
879
+ }), h = c.extend({
880
+ type: e.literal(o.enum.BROADCAST),
881
+ // event
882
+ event: a.merge(
883
+ e.object({
884
+ type: e.enum(d[o.enum.BROADCAST])
885
+ })
886
+ ),
887
+ message: y,
888
+ linkedCampaign: n.nullish()
889
+ }), ne = c.extend({
890
+ type: e.literal(o.enum.COIN),
891
+ // event
892
+ event: a.merge(
893
+ e.object({
894
+ type: e.enum(d[o.enum.COIN])
895
+ })
896
+ ),
897
+ earningOption: m,
898
+ collectible: n,
899
+ notify: e.boolean().optional(),
900
+ notifyMessage: e.lazy(() => y).optional(),
901
+ notifyCampaign: n.nullish(),
902
+ pf_collectible: e.lazy(() => p).optional(),
903
+ pf_notifyCampaign: e.lazy(() => h).optional()
904
+ }), R = c.extend({
905
+ type: e.literal(o.enum.REWARD_POOL),
906
+ // event
907
+ event: a.merge(
908
+ e.object({
909
+ type: e.enum(d[o.enum.REWARD_POOL])
910
+ })
911
+ ),
912
+ rewards: e.array(e.lazy(() => Qe)).min(1, "Requires at least 1 reward")
913
+ }), te = c.extend({
914
+ type: e.literal(o.enum.GAME),
915
+ // event
916
+ event: a.merge(
917
+ e.object({
918
+ type: e.enum(d[o.enum.GAME])
919
+ })
920
+ ),
921
+ earningOption: m,
922
+ collectible: n,
923
+ game: e.lazy(() => R).optional(),
924
+ pf_collectible: e.lazy(() => p).optional(),
925
+ rewardPool: n.optional()
926
+ }), oe = c.extend({
927
+ type: e.literal(o.enum.MISSION),
928
+ event: a.merge(
929
+ e.object({
930
+ type: e.enum(d[o.enum.MISSION])
931
+ })
932
+ ),
933
+ earningOption: m,
934
+ collectible: n,
935
+ pf_collectible: e.lazy(() => p).optional(),
936
+ mission: e.lazy(() => on),
937
+ rewards: e.array(e.lazy(() => q)).min(1, "Requires at least 1 reward")
938
+ }), ln = {
939
+ collectionName: "Campaigns",
940
+ transform: {
941
+ _id: "oid",
942
+ business: "oid",
943
+ collectible: "oid",
944
+ templateId: "oid",
945
+ group: "oid",
946
+ notifyCampaign: "oid",
947
+ linkedCampaign: "oid",
948
+ rewardPool: "oid"
949
+ },
950
+ lookups: {
951
+ business: {
952
+ fromCollection: "Businesses",
953
+ as: "pf_business"
954
+ },
955
+ targetLocation: {
956
+ fromCollection: "Locations",
957
+ as: "pf_targetLocation"
958
+ },
959
+ collectible: {
960
+ fromCollection: "CollectibleConfigs",
961
+ as: "pf_collectible"
962
+ },
963
+ titles: {
964
+ fromCollection: "CollectibleConfigs",
965
+ as: "pf_title"
966
+ },
967
+ templateId: {
968
+ fromCollection: "Templates",
969
+ as: "template"
970
+ },
971
+ notifyCampaign: {
972
+ fromCollection: "Campaigns",
973
+ as: "pf_notifyCampaign"
974
+ },
975
+ rewardPool: {
976
+ fromCollection: "Campaigns",
977
+ as: "game"
978
+ }
979
+ }
980
+ }, _n = e.object({ _id: n }).and(
981
+ e.discriminatedUnion("type", [
982
+ an,
983
+ X,
984
+ $,
985
+ Q,
986
+ ee,
987
+ h,
988
+ ne,
989
+ R,
990
+ te,
991
+ oe
992
+ ])
993
+ ).describe(l.describe(ln)), Rn = e.discriminatedUnion("type", [
994
+ X.extend({
995
+ business: n.nullish()
996
+ }),
997
+ $.extend({
998
+ business: n.nullish()
999
+ }),
1000
+ Q.extend({
1001
+ business: n.nullish()
1002
+ }),
1003
+ ee.extend({
1004
+ business: n.nullish()
1005
+ }),
1006
+ h.extend({
1007
+ business: n.nullish()
1008
+ }),
1009
+ ne.extend({
1010
+ business: n.nullish()
1011
+ }),
1012
+ R.extend({
1013
+ rewards: e.array(e.lazy(() => O)).min(1, "Requires at least 1 reward")
1014
+ }),
1015
+ te.extend({
1016
+ business: n.nullish(),
1017
+ game: R.extend({
1018
+ business: n.nullish(),
1019
+ rewards: e.array(e.lazy(() => O)).min(1, "Requires at least 1 reward")
1020
+ })
1021
+ }),
1022
+ oe.extend({
1023
+ business: n.nullish(),
1024
+ rewards: e.array(e.lazy(() => en)).min(1, "Requires at least 1 reward")
1025
+ })
1026
+ ]);
1027
+ export {
1028
+ d as C,
1029
+ En as F,
1030
+ o as a,
1031
+ hn as b,
1032
+ O as c,
1033
+ tn as d,
1034
+ Cn as e,
1035
+ en as f,
1036
+ on as g,
1037
+ fn as h,
1038
+ Rn as i,
1039
+ _n as j,
1040
+ bn as k,
1041
+ s as l,
1042
+ Ke as m,
1043
+ U as n,
1044
+ we as o,
1045
+ G as p,
1046
+ j as q,
1047
+ Fe as r,
1048
+ yn as s
1049
+ };