@feedmepos/mf-connect 0.1.0-beta.34 → 0.1.0-beta.36

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 (84) hide show
  1. package/dist/{Analytic-DYfm1eg5.js → Analytic-BQQMo8gn.js} +18 -17
  2. package/dist/{App-DV85I2xq.js → App-XbDR-3id.js} +6 -6
  3. package/dist/{Broadcast-CNpwvxRx.js → Broadcast-BV0fALHZ.js} +8 -8
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Bv8Ki3vl.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Cmq6EQxz.js} +6 -7
  5. package/dist/{Card-Bk4hfK9U.js → Card-ni0g9f0W.js} +16 -17
  6. package/dist/{Collections-CrND62Vz.js → Collections-CzqFRaQq.js} +4 -4
  7. package/dist/{Credit-ICo98p8n.js → Credit-BhaiYIIH.js} +8 -8
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-LFtf2JM3.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-ByIKDwhp.js} +27 -27
  9. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CdVIbAT3.js → EffectSheet.vue_vue_type_style_index_0_lang-CCPGbV9-.js} +6 -6
  10. package/dist/{Experience-BqMJUymq.js → Experience-l24HNuYa.js} +8 -8
  11. package/dist/{Game-DvjisU7I.js → Game-CYR3nNcT.js} +8 -8
  12. package/dist/{Index-Vbv5hpsB.js → Index-BYC9ThLe.js} +9 -9
  13. package/dist/{Marketing-CU6GUm2L.js → Marketing-C_oZtbqT.js} +5 -5
  14. package/dist/{Member-Dcyb6og-.js → Member-DxAoZFfz.js} +4 -4
  15. package/dist/MemberList-CyHaxFqq.js +1538 -0
  16. package/dist/MemberTransactions-Ce1N88OQ.js +45 -0
  17. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-B_q37PEs.js → MessageInput.vue_vue_type_script_setup_true_lang-CwF3Vok8.js} +2 -2
  18. package/dist/{Mission-_Vi8gaKQ.js → Mission-DdgpqYWl.js} +8 -8
  19. package/dist/{Overview-8ZkvZh2U.js → Overview-DVcotUZ5.js} +412 -396
  20. package/dist/{Point-BqmJ8ak3.js → Point-B56BrM7H.js} +8 -8
  21. package/dist/{Promotion-CDOtfUpE.js → Promotion-4yL1H9g5.js} +9 -9
  22. package/dist/{Record-NUadzYL2.js → Record-DZ2SbNCg.js} +5 -5
  23. package/dist/{Reward-CgRFzQHO.js → Reward-DX5V3RGG.js} +34 -34
  24. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-Cg5cJLSS.js → RewardGroup.vue_vue_type_script_setup_true_lang-D9UFAixa.js} +12 -13
  25. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-Bac_RiwJ.js → RuleGroup.vue_vue_type_script_setup_true_lang-4tF-6JVC.js} +14 -15
  26. package/dist/{Segment-bHLt_9xi.js → Segment-DKpM-dlV.js} +68 -68
  27. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-DWulr5sA.js → SelectItems.vue_vue_type_script_setup_true_lang-4Co06qsp.js} +2 -2
  28. package/dist/{Setting-AQjJ0LBm.js → Setting-CbV6piRR.js} +8 -8
  29. package/dist/{Store-DzGhYzS9.js → Store-BIMMzBEA.js} +19 -20
  30. package/dist/{StoreRewards-BN33UZrN.js → StoreRewards-Tr8TXAWt.js} +12 -12
  31. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-CF7R6Mbf.js → StoreTransactions.vue_vue_type_script_setup_true_lang-wPxHMj1_.js} +330 -363
  32. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-C3wxmJBS.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-CaRE8E-o.js} +1 -1
  33. package/dist/{Tier-BaIm0-nO.js → Tier-BN3HKQpg.js} +20 -21
  34. package/dist/{Title-CGU2TRSf.js → Title-DhDuDHSD.js} +20 -21
  35. package/dist/{Transaction-DA2CK2a4.js → Transaction-Tz3ewMZm.js} +2 -2
  36. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-DSVVsk_u.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-w5Cq6L8_.js} +6 -6
  37. package/dist/{Voucher-Bzh_fJpa.js → Voucher-CdEDGQkq.js} +11 -11
  38. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-Bflyp1V0.js → VoucherEditor.vue_vue_type_script_setup_true_lang-CajIUE-r.js} +10 -10
  39. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-Wh_Pc7qk.js → ZodTextField.vue_vue_type_script_setup_true_lang-CFCVdVWx.js} +1 -1
  40. package/dist/{app-CBijF7l9.js → app-Cx8AYCg_.js} +1 -1
  41. package/dist/{app-Ceasya0M.js → app-oW33KZ3o.js} +212 -186
  42. package/dist/app.js +1 -1
  43. package/dist/{business-BJ-cyfj6.js → business-DjK1cD6M.js} +1 -1
  44. package/dist/{dto-BnknKYcg.js → campaign-D4CDaSod.js} +610 -818
  45. package/dist/{campaign-B5Cvxv_n.js → campaign-DBISpYyM.js} +2 -2
  46. package/dist/{campaign.enum-CwvY4pwh.js → campaign.enum-BB6zKvqL.js} +1 -1
  47. package/dist/{campaign.fn-CWcwUEiZ.js → campaign.fn-BBuN-vxE.js} +2 -2
  48. package/dist/{collectible.enum-COdcR96r.js → collectible.enum-BkzPmWP5.js} +1 -1
  49. package/dist/{collection.fn-BTQbGCVW.js → collection.fn--9IoH5C8.js} +2 -2
  50. package/dist/dto-Cf4bZ2Ha.js +214 -0
  51. package/dist/{effect-DqWwcDoL.js → effect-BpSxSe0d.js} +1 -1
  52. package/dist/{email-addresses-DPPlvfPT.js → email-addresses-wHQnOKcN.js} +1 -1
  53. package/dist/{export-FXBFFRdK.js → export-pg40fbOp.js} +3 -3
  54. package/dist/{helper-C776lUH-.js → helper-vuZmD3vd.js} +1 -1
  55. package/dist/{index-BG5txN30.js → index-BbhmmxBp.js} +2057 -1010
  56. package/dist/{index-D62SBn2q.js → index-BjcUav4X.js} +3 -3
  57. package/dist/{index-CRlD2sul.js → index-Bl60bODV.js} +3 -3
  58. package/dist/{index-BjAdYoh3.js → index-CCRD2tgv.js} +12 -13
  59. package/dist/{index-Cgaj4reE.js → index-D6knHtFJ.js} +1 -1
  60. package/dist/{index-CxU9mwRl.js → index-D8CIHJ0z.js} +1 -1
  61. package/dist/{index-CpD4ezv2.js → index-DInxnKvr.js} +22 -4
  62. package/dist/index-K7WU4vc1.js +44 -0
  63. package/dist/{index-C1aWGTdZ.js → index-UNh4BJAd.js} +1 -1
  64. package/dist/{index-DeMgVwv8.js → index-VjvyNKmR.js} +6 -6
  65. package/dist/{index-CZaQ-veW.js → index-t-NFK-AQ.js} +1 -1
  66. package/dist/{index-I27oHD1a.js → index-tWez6zPm.js} +1 -1
  67. package/dist/{index.esm2017-Cf8UXsST.js → index.esm2017-Djt10vTu.js} +1 -1
  68. package/dist/{loading-DCSdIZqP.js → loading-CVE2HNjb.js} +4 -4
  69. package/dist/{membership-KiKcnWxt.js → membership-BLkSVFx9.js} +3 -3
  70. package/dist/{money-B_LMR19r.js → money-DqUkifCn.js} +1 -1
  71. package/dist/{number-Bk18T5Xb.js → number-BPlOwScu.js} +1 -1
  72. package/dist/{objectid-CZ5qnZ1J.js → objectid-J3u1WeUz.js} +8 -8
  73. package/dist/{reward-ozVC4wTW.js → reward-B9WzNBWQ.js} +1 -1
  74. package/dist/{rule-CWT8hI3A.js → rule-FtBYuezP.js} +3 -3
  75. package/dist/{rule-builder-DTEvWEjJ.js → rule-builder-caiYx8mw.js} +1 -1
  76. package/dist/{template-9N1FRXDZ.js → template-C1Iii37r.js} +4 -4
  77. package/dist/{trigger-C2-zYC46.js → trigger-DEH6eTbm.js} +6 -6
  78. package/dist/{user-DBxVxr4P.js → user-DqSmwkKW.js} +1 -1
  79. package/dist/{vue-i18n-BK0qKZu-.js → vue-i18n-4lC91qO3.js} +296 -296
  80. package/dist/{xlsx-CmKV4f40.js → xlsx-DNspY5sG.js} +1 -1
  81. package/package.json +1 -1
  82. package/dist/MemberList-CBO6SVE-.js +0 -1044
  83. package/dist/MemberTransactions-BuPoUtjA.js +0 -38
  84. package/dist/index-Dw1WniG7.js +0 -1050
@@ -1,1050 +0,0 @@
1
- import { z as e, F as n, e as E, m as l, g as ie, d as I } from "./loading-DCSdIZqP.js";
2
- import { F as O } from "./campaign.enum-CwvY4pwh.js";
3
- import { c as f, F as P, e as m, g as se, f as ae, i as p, j as re, k as le } from "./index-DeMgVwv8.js";
4
- import { i as x, g as S, h as ce } from "./index-BG5txN30.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
- }), Te = u.extend({
149
- type: e.literal(s.enum.SCHEDULE),
150
- context: e.object({
151
- triggeredAt: e.coerce.date()
152
- })
153
- }), Ae = 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
- }), Oe = u.extend({
167
- type: e.literal(s.enum.MEMBERSHIP_JOINED),
168
- context: e.object({
169
- user: x
170
- })
171
- }), Pe = u.extend({
172
- type: e.literal(s.enum.TIER_UPGRADED),
173
- context: e.object({
174
- transaction: S
175
- })
176
- }), xe = u.extend({
177
- type: e.literal(s.enum.ISSUE_REWARD),
178
- context: e.object({
179
- transaction: S,
180
- collection: ce
181
- })
182
- });
183
- u.extend({
184
- type: e.literal(s.enum.ISSUE_REWARD),
185
- context: e.object({})
186
- });
187
- e.discriminatedUnion("type", [
188
- De,
189
- Te,
190
- Me,
191
- Oe,
192
- Pe,
193
- xe,
194
- Ae
195
- ]);
196
- const Se = e.object({
197
- from: e.coerce.number(),
198
- to: e.coerce.number().optional()
199
- }).superRefine((t, i) => {
200
- t.from && t.to && t.from > t.to && i.addIssue({
201
- code: "custom",
202
- message: "Max experience must be more than min experience"
203
- });
204
- }), Le = e.enum(["MULTIPLIER", "FIXED"]);
205
- e.object({
206
- type: Le
207
- });
208
- const Ne = e.object({
209
- _id: n.optional(),
210
- rule: f,
211
- tierExpression: e.string().nullish(),
212
- expExpression: e.string().nullish()
213
- }), F = e.object({
214
- _id: n,
215
- name: e.string().min(1),
216
- image: e.string().nullish(),
217
- option: Se,
218
- cycleOptions: e.array(e.lazy(() => Ne)).nullish(),
219
- member_count: e.number().optional()
220
- });
221
- F.partial({
222
- _id: !0
223
- });
224
- const En = F.partial({
225
- _id: !0
226
- }), je = e.object({
227
- icon: e.string(),
228
- label: e.string(),
229
- value: e.string()
230
- }), Be = e.object({
231
- gatewayKey: e.enum([
232
- "REVENUE_MONSTER",
233
- "FEEDME",
234
- "FEEDME_MEMBER_CREDIT",
235
- "RAZER_MERCHANT_SERVICE"
236
- ]),
237
- checkoutUrl: e.string().optional(),
238
- checkoutId: e.string().optional(),
239
- callbackUrl: e.string().optional(),
240
- vcode: e.string().optional(),
241
- merchantId: e.string().optional(),
242
- amount: e.string().optional(),
243
- currency: e.string().optional(),
244
- returnUrl: e.string().optional(),
245
- notifyUrl: e.string().optional(),
246
- channels: e.array(je).optional(),
247
- transactionId: e.string().optional()
248
- });
249
- e.object({
250
- trx: e.lazy(() => z),
251
- onlineTrx: Be.optional(),
252
- url: e.string().optional()
253
- });
254
- const L = e.enum(["POS", "APP", "ADMIN"]), N = e.enum(["topupCount"]), Ue = e.object({
255
- line1: e.string(),
256
- line2: e.string().optional(),
257
- state: e.string(),
258
- city: e.string(),
259
- postcode: e.string(),
260
- country: e.string()
261
- }), j = e.object({
262
- name: e.string(),
263
- regNo: e.string(),
264
- address: Ue,
265
- phoneNo: e.string(),
266
- sstRegNo: e.string().optional()
267
- }), B = e.object({
268
- systemCode: e.string(),
269
- inclusive: e.boolean()
270
- }), we = e.object({
271
- id: n,
272
- dayToExpire: e.number()
273
- }), Ge = e.object({
274
- normal: e.coerce.number(),
275
- free: e.object({
276
- day: e.coerce.number(),
277
- amount: e.coerce.number(),
278
- remark: e.string().nullish()
279
- }).nullish()
280
- }), ze = e.object({
281
- systemCode: e.string(),
282
- taxCode: e.string()
283
- }), He = e.object({
284
- name: e.string(),
285
- systemCode: e.string(),
286
- taxCode: e.string(),
287
- rate: ie,
288
- total: E
289
- });
290
- e.object({
291
- canPurchase: e.boolean(),
292
- reason: e.string()
293
- });
294
- e.object({
295
- type: N
296
- });
297
- e.object({
298
- type: N,
299
- min: e.number().nullish(),
300
- max: e.number().nullish()
301
- });
302
- const ke = e.object({
303
- options: e.object({
304
- maxReceive: e.number().min(0).nullish(),
305
- maxPerUser: e.number().min(0).nullish()
306
- }),
307
- rule: f.nullish()
308
- }), ve = (t, i) => {
309
- const r = t;
310
- r.isFeedvibe && I.Dinero.fromFdoDinero(r.price).toUnit() < 0.1 && i.addIssue({
311
- code: "custom",
312
- path: ["price"],
313
- message: "Price must be at least RM10"
314
- });
315
- }, U = e.object({
316
- _id: e.string(),
317
- isFeedvibe: e.boolean().nullish(),
318
- // conditions: z.array(FdoTopupCountCondition),
319
- image: e.string().nullish(),
320
- rule: f.nullish(),
321
- name: e.string(),
322
- price: E,
323
- originalPrice: E.nullish(),
324
- // new field to indicate coinPrice
325
- coinPrice: e.number().nullish(),
326
- titles: e.array(we),
327
- credit: Ge,
328
- taxes: e.array(ze),
329
- taxTotals: e.array(He),
330
- priceWithTaxes: E.nullish(),
331
- vouchers: e.array(n),
332
- _inclusiveTaxes: e.array(B).nullish(),
333
- _taxSystem: e.array(e.string()).nullish(),
334
- stripePriceId: e.string().nullish(),
335
- subscriptionValidity: e.number().min(1, "Must be at least 1 day").max(365, "Maximum is 365").nullish(),
336
- redeemWithCode: e.boolean().nullish(),
337
- internal: e.boolean().optional(),
338
- hideInPos: e.boolean().optional(),
339
- config: ke.optional(),
340
- pf_titles: e.array(e.any()).optional(),
341
- pf_vouchers: e.array(e.any()).optional(),
342
- pf_credit: e.number().optional()
343
- }).superRefine((t, i) => {
344
- var r, g;
345
- t.stripePriceId && !t.subscriptionValidity && i.addIssue({
346
- code: "custom",
347
- message: "Validity is required when stripePriceId is provided",
348
- path: ["subscriptionValidity"]
349
- }), t.originalPrice && t.originalPrice.amount && t.originalPrice.amount < t.price.amount && i.addIssue({
350
- code: "custom",
351
- message: "Original price must be greater than price",
352
- path: ["originalPrice"]
353
- }), t.price.amount < 0 && i.addIssue({
354
- code: "custom",
355
- path: ["price"],
356
- message: "Price cannot be less than 0"
357
- }), t.coinPrice && t.coinPrice < 0 && i.addIssue({
358
- code: "custom",
359
- path: ["coinPrice"],
360
- message: "Point price cannot be less than 0"
361
- }), t.credit.normal < 0 && i.addIssue({
362
- code: "custom",
363
- path: ["credit", "normal"],
364
- message: "Normal credit cannot be less than 0"
365
- }), t.credit.free && (t.credit.free.amount < 0 && i.addIssue({
366
- code: "custom",
367
- path: ["credit", "free", "amount"],
368
- message: "Free credit cannot be less than 0"
369
- }), t.credit.free.amount && t.credit.free.day < 0 && i.addIssue({
370
- code: "custom",
371
- path: ["credit", "free", "day"],
372
- message: "Expiry must be at least 0 (expire same day)"
373
- })), t.credit.normal && t.coinPrice && i.addIssue({
374
- code: "custom",
375
- message: "Bundle redeem with point cannot set normal credit.",
376
- path: ["credit", "normal"]
377
- }), t.credit.normal > I.Dinero.fromFdoDinero(t.price).toUnit() && i.addIssue({
378
- code: "custom",
379
- message: `Normal credit cannot be more than price. Max: ${I.Dinero.fromFdoDinero(
380
- t.price
381
- ).toUnit()}`,
382
- path: ["credit", "normal"]
383
- }), t.titles.length > 0 && t.titles.some((_) => _.dayToExpire < 0) && i.addIssue({
384
- code: "custom",
385
- path: ["titles"],
386
- message: "Title expiry must be at least 0 day (expire same day)"
387
- }), (((g = (r = t.config) == null ? void 0 : r.options) == null ? void 0 : g.maxPerUser) || 0) < 0 && i.addIssue({
388
- code: "custom",
389
- path: ["config.options.maxPerUser"],
390
- message: "Max purchase per user cannot be negative"
391
- });
392
- }).superRefine(ve), w = e.object({
393
- name: e.string(),
394
- bundles: e.array(U)
395
- });
396
- e.object({
397
- _id: e.string(),
398
- name: e.string(),
399
- expiredAt: e.string()
400
- });
401
- const Ve = e.object({
402
- apiKey: e.string(),
403
- webhookSecret: e.string()
404
- }), We = e.object({
405
- company: j.nullish(),
406
- inclusiveTaxes: e.array(B).nullish(),
407
- stripe: Ve.nullable().optional()
408
- }), Ke = {
409
- collectionName: "Stores",
410
- transform: {
411
- _id: "oid",
412
- business: "oid"
413
- }
414
- };
415
- We.extend({
416
- _id: n,
417
- business: n,
418
- categories: e.array(w)
419
- }).describe(l.describe(Ke));
420
- const Ye = e.object({
421
- refundedAt: e.coerce.date(),
422
- reason: e.string(),
423
- transactions: e.array(n)
424
- }), G = e.object({
425
- type: e.enum(["ONLINE", "OFFLINE", "COIN", "STRIPE", "CARD", "FEEDVIBE", "ADMIN"]),
426
- extra: e.string().nullish()
427
- }), Je = {
428
- collectionName: "StoreTransactions",
429
- transform: {
430
- _id: "oid",
431
- business: "oid",
432
- location: "oid",
433
- member: "oid",
434
- transactions: "oid"
435
- },
436
- lookups: {
437
- member: {
438
- fromCollection: "UsersV2",
439
- as: "pf_member"
440
- }
441
- }
442
- }, z = e.object({
443
- _id: n,
444
- source: L,
445
- // can be memberStorePurchase
446
- ref: e.string(),
447
- business: n,
448
- company: j,
449
- location: n.optional(),
450
- member: n,
451
- // createdAt: z.coerce.date(),
452
- bundle: U,
453
- transactions: e.array(n),
454
- // array of transaction id (voucher, credit, title)
455
- status: e.enum([
456
- "PENDING_PAYMENT",
457
- "PENDING_TRANSACTION",
458
- "COMPLETED",
459
- "REFUNDED"
460
- ]),
461
- refund: Ye.nullish(),
462
- paymentType: G.nullish(),
463
- paymentRef: e.string().nullish(),
464
- webhookUrl: e.string().optional(),
465
- webhookSent: e.boolean().optional(),
466
- pf_transactions: e.array(e.any()).optional(),
467
- pf_member: e.any().optional(),
468
- pf_location: e.any().optional(),
469
- pf_ref: e.any().optional()
470
- }).describe(l.describe(Je));
471
- e.object({
472
- bundle: n,
473
- member: e.string(),
474
- ref: e.string(),
475
- paymentType: G.nullish(),
476
- withCoin: e.boolean().optional(),
477
- card: e.string().optional(),
478
- location: n.optional(),
479
- source: L,
480
- webhookUrl: e.string().optional()
481
- });
482
- e.object({
483
- categories: e.array(w)
484
- });
485
- e.object({
486
- id: n,
487
- reason: e.string(),
488
- location: n.optional()
489
- });
490
- e.object({
491
- _id: n,
492
- business: n,
493
- user: n,
494
- bundleId: e.string(),
495
- transaction: e.array(n),
496
- subscriptionId: e.string(),
497
- expiredAt: e.coerce.date()
498
- }).describe(
499
- l.describe({
500
- collectionName: "StoreSubscriptions",
501
- transform: {
502
- _id: "oid",
503
- business: "oid",
504
- user: "oid",
505
- transaction: "oid",
506
- expiredAt: "date"
507
- }
508
- })
509
- );
510
- e.object({
511
- member: e.string(),
512
- subscriptionId: e.string()
513
- });
514
- const qe = {
515
- collectionName: "Cards",
516
- transform: {
517
- _id: "oid",
518
- business: "oid",
519
- member: "oid",
520
- redeemedAt: "date"
521
- },
522
- lookups: {
523
- business: {
524
- as: "business",
525
- fromCollection: "Business"
526
- },
527
- member: {
528
- as: "pf_member",
529
- fromCollection: "UsersV2"
530
- }
531
- }
532
- };
533
- e.object({
534
- _id: n,
535
- business: n,
536
- serialNumber: e.string(),
537
- setCardOnBind: e.boolean().nullish(),
538
- redeemedAt: e.date().nullish(),
539
- member: n.nullish(),
540
- design: e.string().nullish(),
541
- bundle: e.string().nullish(),
542
- subscriptionBundle: e.string().nullish(),
543
- pf_member: e.lazy(() => x).nullish(),
544
- pf_transaction: e.lazy(() => z).nullish()
545
- }).describe(l.describe(qe));
546
- const Ze = e.object({
547
- length: e.coerce.number().optional(),
548
- charset: e.string(),
549
- prefix: e.string().optional(),
550
- suffix: e.string().optional(),
551
- pattern: e.string().optional()
552
- });
553
- e.object({
554
- quantity: e.number(),
555
- code: e.string(),
556
- codeConfig: Ze,
557
- setCardOnBind: e.boolean().optional(),
558
- design: e.string().nullish(),
559
- bundle: e.string().optional(),
560
- subscriptionBundle: e.string().optional()
561
- });
562
- const Xe = e.enum(["SMS", "EMAIL"]), y = e.object({
563
- channel: Xe,
564
- variables: e.array(e.string()),
565
- title: e.string().nullish(),
566
- design: e.any(),
567
- content: e.string(),
568
- language: e.string(),
569
- imageUrl: e.string().nullish()
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, oe) => (b != null ? b[oe] : null) ?? null, i);
584
- return C !== null ? C : r;
585
- });
586
- }
587
- const D = e.enum(["NO_REWARD", "VOUCHER", "LOYALTY"]), T = e.number().min(0, "Weight need to be at least 0"), H = e.number().int("Must be integer").min(0, "Threshold need to be at least 0"), k = e.object({
588
- type: e.literal(D.enum.NO_REWARD),
589
- collectible: e.null(),
590
- weight: T
591
- }), v = e.object({
592
- type: e.literal(D.enum.VOUCHER),
593
- collectible: n,
594
- collectibleConfig: e.lazy(() => P._def.right.options[0]),
595
- earningOption: e.lazy(() => m)
596
- }), A = e.object({
597
- type: e.literal(D.enum.LOYALTY),
598
- collectible: n,
599
- earningOption: e.lazy(() => m),
600
- validityOption: e.lazy(() => se)
601
- }), V = v.extend({
602
- weight: T
603
- }), W = A.extend({
604
- weight: e.number().min(0, "Weight need to be at least 0")
605
- }), hn = A.extend({
606
- validityOption: ae,
607
- weight: T
608
- }), $e = e.discriminatedUnion("type", [
609
- V,
610
- W,
611
- k
612
- ]), M = e.discriminatedUnion("type", [
613
- V.extend({
614
- collectible: n.nullish(),
615
- business: n.nullish()
616
- }),
617
- W.extend({
618
- collectible: n.nullish(),
619
- business: n.nullish()
620
- }),
621
- k
622
- ]), K = v.extend({
623
- threshold: H
624
- }), Y = A.extend({
625
- threshold: H
626
- }), J = e.discriminatedUnion("type", [
627
- K,
628
- Y
629
- ]), Qe = e.discriminatedUnion("type", [
630
- K.extend({
631
- collectible: n.nullish(),
632
- business: n.nullish()
633
- }),
634
- Y.extend({
635
- collectible: n.nullish(),
636
- collectibleConfig: P.nullish(),
637
- business: n.nullish()
638
- })
639
- ]), en = {
640
- collectionName: "Locations",
641
- transform: {
642
- _id: "oid",
643
- business: "oid"
644
- }
645
- }, q = e.object({
646
- _id: n,
647
- business: n,
648
- name: e.string(),
649
- code: e.string().nullish(),
650
- otp: e.string().nullish(),
651
- otpExpiredAt: e.coerce.date().nullish(),
652
- apiToken: e.string().nullish()
653
- }).describe(l.describe(en));
654
- e.object({
655
- _id: n,
656
- name: e.string(),
657
- location: n,
658
- os: e.string(),
659
- apiToken: e.string().nullish()
660
- }).describe(l.describe({
661
- collectionName: "LocationDevices",
662
- transform: {
663
- _id: "oid",
664
- location: "oid"
665
- }
666
- }));
667
- const nn = e.enum(["PROGRESSIVE", "STAMP"]), tn = e.object({
668
- type: nn,
669
- end: e.number().int().min(0, "Threshold need to be at least 1"),
670
- rewards: e.array(e.lazy(() => J)).nullish()
671
- }).superRefine((t, i) => {
672
- t.type == "STAMP" && t.end > 40 && (i.addIssue({
673
- code: "custom",
674
- path: [],
675
- message: "Stamp mission can have at most 40 threshold"
676
- }), i.addIssue({
677
- code: "custom",
678
- path: ["end"],
679
- message: "Stamp mission can have at most 40 threshold"
680
- }));
681
- }), on = {
682
- collectionName: "Groups",
683
- transform: {
684
- _id: "oid",
685
- business: "oid"
686
- },
687
- lookups: {
688
- business: {
689
- fromCollection: "Businesses",
690
- as: "pf_business"
691
- },
692
- pf_campaigns: {
693
- fromCollection: "Campaigns",
694
- as: "pf_campaigns",
695
- localField: "_id",
696
- foreignField: "group"
697
- }
698
- }
699
- }, Cn = e.object({
700
- _id: n,
701
- name: e.string().min(1).max(300),
702
- business: n,
703
- pf_campaigns: e.array(e.any()).optional()
704
- }).describe(l.describe(on)), sn = e.object({
705
- from: e.string().email().nullish(),
706
- name: e.string().min(1).max(50).nullish()
707
- }), an = e.object({
708
- type: e.literal(O.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(() => F)),
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
- email: sn.nullish(),
729
- freeCreditAsDiscount: e.boolean().optional(),
730
- pf_title: e.array(e.lazy(() => p)).optional(),
731
- pf_targetLocation: e.array(e.lazy(() => q)).optional(),
732
- // new structure
733
- group: e.string().nullish(),
734
- templateId: n.nullish()
735
- }), o = O.exclude(["MEMBERSHIP"]), c = e.object({
736
- _id: n.nullish(),
737
- type: o,
738
- // common information
739
- business: n,
740
- name: e.string().min(1).max(50),
741
- image: e.string().nullish(),
742
- description: e.string().max(500).nullish(),
743
- timeframeOptions: re.superRefine((t, i) => {
744
- t.start && t.end && t.end < t.start && i.addIssue({
745
- code: "custom",
746
- path: [],
747
- params: {
748
- i18n: { key: "timeframe.end_before_start" }
749
- }
750
- });
751
- }).nullish(),
752
- targetLocation: e.array(n).nullish(),
753
- event: Fe,
754
- config: le.nullish(),
755
- currentReceive: e.coerce.number().optional(),
756
- // new group structure
757
- group: n.nullish(),
758
- templateId: n.nullish(),
759
- pf_targetLocation: e.array(e.lazy(() => q)).optional()
760
- }), d = {
761
- [o.enum.VOUCHER]: [
762
- "BILL_COMPLETED",
763
- "FEEDBACK",
764
- "MEMBERSHIP_JOINED",
765
- "TIER_UPGRADED",
766
- "SCHEDULE",
767
- "SIMPLE_CLAIM"
768
- ],
769
- [o.enum.PROMOTION]: ["MAKING_ORDER"],
770
- [o.enum.POINT]: [
771
- "BILL_COMPLETED",
772
- "FEEDBACK",
773
- "MEMBERSHIP_JOINED",
774
- "TIER_UPGRADED",
775
- "SCHEDULE"
776
- ],
777
- [o.enum.CREDIT]: [
778
- "BILL_COMPLETED",
779
- "FEEDBACK",
780
- "MEMBERSHIP_JOINED",
781
- "TIER_UPGRADED",
782
- "SCHEDULE"
783
- ],
784
- [o.enum.BROADCAST]: [
785
- "SCHEDULE",
786
- "ISSUE_REWARD",
787
- "FEEDBACK"
788
- ],
789
- [o.enum.COIN]: [
790
- "BILL_COMPLETED",
791
- "FEEDBACK",
792
- "MEMBERSHIP_JOINED",
793
- "TIER_UPGRADED",
794
- "SCHEDULE"
795
- ],
796
- [o.enum.REWARD_POOL]: ["GAME_COMPLETED"],
797
- [o.enum.GAME]: [
798
- "BILL_COMPLETED",
799
- "FEEDBACK",
800
- "MEMBERSHIP_JOINED",
801
- "TIER_UPGRADED",
802
- "SCHEDULE",
803
- "SIMPLE_CLAIM"
804
- ],
805
- [o.enum.MISSION]: [
806
- "BILL_COMPLETED",
807
- "FEEDBACK",
808
- "SCHEDULE"
809
- ]
810
- }, Z = c.extend({
811
- type: e.literal(o.enum.VOUCHER),
812
- // event
813
- code: e.string().min(0).max(15).optional(),
814
- event: a.merge(
815
- e.object({
816
- type: e.enum(d[o.enum.VOUCHER])
817
- })
818
- ),
819
- earningOption: m.default({
820
- amount: 1,
821
- type: "FIXED"
822
- }),
823
- collectible: n,
824
- hideInApp: e.boolean().optional(),
825
- notify: e.boolean().optional(),
826
- notifyMessage: e.lazy(() => y).optional(),
827
- notifyCampaign: n.nullish(),
828
- pf_collectible: e.lazy(() => p).optional(),
829
- pf_notifyCampaign: e.lazy(() => h).optional()
830
- }), rn = e.object({
831
- gameType: e.string()
832
- }), X = c.extend({
833
- type: e.literal(o.enum.PROMOTION),
834
- // event
835
- event: a.merge(
836
- e.object({
837
- type: e.enum(d[o.enum.PROMOTION])
838
- })
839
- ),
840
- effect: e.custom().superRefine((t, i) => {
841
- t || i.addIssue({
842
- code: "custom",
843
- path: [],
844
- params: {
845
- i18n: { key: "zodCustom.campaign.effect_required" }
846
- }
847
- });
848
- }),
849
- gameConfig: rn.nullish()
850
- }), $ = c.extend({
851
- type: e.literal(o.enum.POINT),
852
- // event
853
- event: a.merge(
854
- e.object({
855
- type: e.enum(d[o.enum.POINT])
856
- })
857
- ),
858
- earningOption: m,
859
- collectible: n,
860
- notify: e.boolean().optional(),
861
- notifyMessage: e.lazy(() => y).optional(),
862
- notifyCampaign: n.nullish(),
863
- pf_collectible: e.lazy(() => p).optional(),
864
- pf_notifyCampaign: e.lazy(() => h).optional()
865
- }), Q = c.extend({
866
- type: e.literal(o.enum.CREDIT),
867
- // event
868
- event: a.merge(
869
- e.object({
870
- type: e.enum(d[o.enum.CREDIT])
871
- })
872
- ),
873
- earningOption: m,
874
- collectible: n,
875
- notify: e.boolean().optional(),
876
- notifyMessage: e.lazy(() => y).optional(),
877
- notifyCampaign: n.nullish(),
878
- pf_collectible: e.lazy(() => p).optional(),
879
- pf_notifyCampaign: e.lazy(() => h).optional()
880
- }), h = c.extend({
881
- type: e.literal(o.enum.BROADCAST),
882
- // event
883
- event: a.merge(
884
- e.object({
885
- type: e.enum(d[o.enum.BROADCAST])
886
- })
887
- ),
888
- message: y,
889
- linkedCampaign: n.nullish()
890
- }), ee = c.extend({
891
- type: e.literal(o.enum.COIN),
892
- // event
893
- event: a.merge(
894
- e.object({
895
- type: e.enum(d[o.enum.COIN])
896
- })
897
- ),
898
- earningOption: m,
899
- collectible: n,
900
- notify: e.boolean().optional(),
901
- notifyMessage: e.lazy(() => y).optional(),
902
- notifyCampaign: n.nullish(),
903
- pf_collectible: e.lazy(() => p).optional(),
904
- pf_notifyCampaign: e.lazy(() => h).optional()
905
- }), R = c.extend({
906
- type: e.literal(o.enum.REWARD_POOL),
907
- // event
908
- event: a.merge(
909
- e.object({
910
- type: e.enum(d[o.enum.REWARD_POOL])
911
- })
912
- ),
913
- rewards: e.array(e.lazy(() => $e)).min(1, "Requires at least 1 reward")
914
- }), ne = c.extend({
915
- type: e.literal(o.enum.GAME),
916
- // event
917
- event: a.merge(
918
- e.object({
919
- type: e.enum(d[o.enum.GAME])
920
- })
921
- ),
922
- earningOption: m,
923
- collectible: n,
924
- game: e.lazy(() => R).optional(),
925
- pf_collectible: e.lazy(() => p).optional(),
926
- rewardPool: n.optional()
927
- }), te = c.extend({
928
- type: e.literal(o.enum.MISSION),
929
- event: a.merge(
930
- e.object({
931
- type: e.enum(d[o.enum.MISSION])
932
- })
933
- ),
934
- earningOption: m,
935
- collectible: n,
936
- pf_collectible: e.lazy(() => p).optional(),
937
- mission: e.lazy(() => tn),
938
- rewards: e.array(e.lazy(() => J)).min(1, "Requires at least 1 reward")
939
- }), ln = {
940
- collectionName: "Campaigns",
941
- transform: {
942
- _id: "oid",
943
- business: "oid",
944
- collectible: "oid",
945
- templateId: "oid",
946
- group: "oid",
947
- notifyCampaign: "oid",
948
- linkedCampaign: "oid",
949
- rewardPool: "oid"
950
- },
951
- lookups: {
952
- business: {
953
- fromCollection: "Businesses",
954
- as: "pf_business"
955
- },
956
- targetLocation: {
957
- fromCollection: "Locations",
958
- as: "pf_targetLocation"
959
- },
960
- collectible: {
961
- fromCollection: "CollectibleConfigs",
962
- as: "pf_collectible"
963
- },
964
- titles: {
965
- fromCollection: "CollectibleConfigs",
966
- as: "pf_title"
967
- },
968
- templateId: {
969
- fromCollection: "Templates",
970
- as: "template"
971
- },
972
- notifyCampaign: {
973
- fromCollection: "Campaigns",
974
- as: "pf_notifyCampaign"
975
- },
976
- rewardPool: {
977
- fromCollection: "Campaigns",
978
- as: "game"
979
- }
980
- }
981
- }, fn = e.object({ _id: n }).and(
982
- e.discriminatedUnion("type", [
983
- an,
984
- Z,
985
- X,
986
- $,
987
- Q,
988
- h,
989
- ee,
990
- R,
991
- ne,
992
- te
993
- ])
994
- ).describe(l.describe(ln)), _n = e.discriminatedUnion("type", [
995
- Z.extend({
996
- business: n.nullish()
997
- }),
998
- X.extend({
999
- business: n.nullish()
1000
- }),
1001
- $.extend({
1002
- business: n.nullish()
1003
- }),
1004
- Q.extend({
1005
- business: n.nullish()
1006
- }),
1007
- h.extend({
1008
- business: n.nullish()
1009
- }),
1010
- ee.extend({
1011
- business: n.nullish()
1012
- }),
1013
- R.extend({
1014
- rewards: e.array(e.lazy(() => M)).min(1, "Requires at least 1 reward")
1015
- }),
1016
- ne.extend({
1017
- business: n.nullish(),
1018
- game: R.extend({
1019
- business: n.nullish(),
1020
- rewards: e.array(e.lazy(() => M)).min(1, "Requires at least 1 reward")
1021
- })
1022
- }),
1023
- te.extend({
1024
- business: n.nullish(),
1025
- rewards: e.array(e.lazy(() => Qe)).min(1, "Requires at least 1 reward")
1026
- })
1027
- ]);
1028
- export {
1029
- d as C,
1030
- En as F,
1031
- o as a,
1032
- hn as b,
1033
- M as c,
1034
- nn as d,
1035
- Qe as e,
1036
- tn as f,
1037
- Cn as g,
1038
- _n as h,
1039
- fn as i,
1040
- bn as j,
1041
- s as k,
1042
- We as l,
1043
- j as m,
1044
- Ue as n,
1045
- U as o,
1046
- L as p,
1047
- Fe as q,
1048
- an as r,
1049
- yn as s
1050
- };