@feedmepos/mf-connect 0.1.0-beta.35 → 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-BMdB7x5F.js → Analytic-BQQMo8gn.js} +18 -17
  2. package/dist/{App-AakWqQHx.js → App-XbDR-3id.js} +6 -6
  3. package/dist/{Broadcast-Bf5GOV7p.js → Broadcast-BV0fALHZ.js} +8 -8
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BBTBapxi.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Cmq6EQxz.js} +6 -7
  5. package/dist/{Card-DmxekNts.js → Card-ni0g9f0W.js} +16 -17
  6. package/dist/{Collections-CL7hOycU.js → Collections-CzqFRaQq.js} +4 -4
  7. package/dist/{Credit-0eGxacBN.js → Credit-BhaiYIIH.js} +8 -8
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-BLWeJ73S.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-ByIKDwhp.js} +27 -27
  9. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-q7qJ9Ec5.js → EffectSheet.vue_vue_type_style_index_0_lang-CCPGbV9-.js} +6 -6
  10. package/dist/{Experience-NjmDx3_p.js → Experience-l24HNuYa.js} +8 -8
  11. package/dist/{Game-q19qmf8t.js → Game-CYR3nNcT.js} +8 -8
  12. package/dist/{Index-BmzHphDm.js → Index-BYC9ThLe.js} +9 -9
  13. package/dist/{Marketing-BgL2CqkH.js → Marketing-C_oZtbqT.js} +5 -5
  14. package/dist/{Member-DXO7yer0.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-DFiCQcTe.js → MessageInput.vue_vue_type_script_setup_true_lang-CwF3Vok8.js} +2 -2
  18. package/dist/{Mission-DOdkoytR.js → Mission-DdgpqYWl.js} +8 -8
  19. package/dist/{Overview-Bizp0BGu.js → Overview-DVcotUZ5.js} +18 -19
  20. package/dist/{Point-Bvyg1zuh.js → Point-B56BrM7H.js} +8 -8
  21. package/dist/{Promotion-B75LcnHm.js → Promotion-4yL1H9g5.js} +9 -9
  22. package/dist/{Record-BjAbPbiI.js → Record-DZ2SbNCg.js} +5 -5
  23. package/dist/{Reward-l1gt8pwu.js → Reward-DX5V3RGG.js} +14 -14
  24. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-C76emk8A.js → RewardGroup.vue_vue_type_script_setup_true_lang-D9UFAixa.js} +12 -13
  25. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-B4ak1Gem.js → RuleGroup.vue_vue_type_script_setup_true_lang-4tF-6JVC.js} +14 -15
  26. package/dist/{Segment-DJSkWWH8.js → Segment-DKpM-dlV.js} +68 -68
  27. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-ByqgSxPo.js → SelectItems.vue_vue_type_script_setup_true_lang-4Co06qsp.js} +2 -2
  28. package/dist/{Setting-DTV24iE5.js → Setting-CbV6piRR.js} +8 -8
  29. package/dist/{Store-C1obQwdr.js → Store-BIMMzBEA.js} +19 -20
  30. package/dist/{StoreRewards-apMVv0Ca.js → StoreRewards-Tr8TXAWt.js} +12 -12
  31. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-DBzA_4gb.js → StoreTransactions.vue_vue_type_script_setup_true_lang-wPxHMj1_.js} +330 -363
  32. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-PxZ5Au5X.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-CaRE8E-o.js} +1 -1
  33. package/dist/{Tier-DSvMUZJG.js → Tier-BN3HKQpg.js} +20 -21
  34. package/dist/{Title-CWoqOkd2.js → Title-DhDuDHSD.js} +20 -21
  35. package/dist/{Transaction-CaCsXoB5.js → Transaction-Tz3ewMZm.js} +2 -2
  36. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-DaT8PyWl.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-w5Cq6L8_.js} +6 -6
  37. package/dist/{Voucher-BBtDXr9q.js → Voucher-CdEDGQkq.js} +11 -11
  38. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BCSO2-oB.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-BTm3pDid.js → ZodTextField.vue_vue_type_script_setup_true_lang-CFCVdVWx.js} +1 -1
  40. package/dist/{app-D8kcy7_R.js → app-Cx8AYCg_.js} +1 -1
  41. package/dist/{app-B8JBXu5M.js → app-oW33KZ3o.js} +28 -28
  42. package/dist/app.js +1 -1
  43. package/dist/{business-DN4-BTel.js → business-DjK1cD6M.js} +1 -1
  44. package/dist/{dto-D94IgAXy.js → campaign-D4CDaSod.js} +610 -818
  45. package/dist/{campaign-Cf6jJz3e.js → campaign-DBISpYyM.js} +2 -2
  46. package/dist/{campaign.enum-DVOwgVTa.js → campaign.enum-BB6zKvqL.js} +1 -1
  47. package/dist/{campaign.fn-D8apF_YE.js → campaign.fn-BBuN-vxE.js} +30 -30
  48. package/dist/{collectible.enum-DPsEC03C.js → collectible.enum-BkzPmWP5.js} +1 -1
  49. package/dist/{collection.fn-CzeGWVx2.js → collection.fn--9IoH5C8.js} +2 -2
  50. package/dist/dto-Cf4bZ2Ha.js +214 -0
  51. package/dist/{effect-CDg44P_g.js → effect-BpSxSe0d.js} +1 -1
  52. package/dist/{email-addresses-CDozpvzz.js → email-addresses-wHQnOKcN.js} +1 -1
  53. package/dist/{export-DQLXrn4F.js → export-pg40fbOp.js} +3 -3
  54. package/dist/{helper-DJMf--V-.js → helper-vuZmD3vd.js} +1 -1
  55. package/dist/{index-Df84_Ww3.js → index-BbhmmxBp.js} +2057 -1010
  56. package/dist/{index-DrvefOT4.js → index-BjcUav4X.js} +3 -3
  57. package/dist/{index-BbPavTej.js → index-Bl60bODV.js} +3 -3
  58. package/dist/{index-BgXfVzZF.js → index-CCRD2tgv.js} +12 -13
  59. package/dist/{index-B0n_PU3b.js → index-D6knHtFJ.js} +1 -1
  60. package/dist/{index-BnbkejyF.js → index-D8CIHJ0z.js} +1 -1
  61. package/dist/{index-V6yWwXYr.js → index-DInxnKvr.js} +22 -4
  62. package/dist/index-K7WU4vc1.js +44 -0
  63. package/dist/{index-BUZR5Bkw.js → index-UNh4BJAd.js} +1 -1
  64. package/dist/{index-DvE5xL4s.js → index-VjvyNKmR.js} +6 -6
  65. package/dist/{index-CVV5I3bh.js → index-t-NFK-AQ.js} +1 -1
  66. package/dist/{index-BmblCnlD.js → index-tWez6zPm.js} +1 -1
  67. package/dist/{index.esm2017-C90-ettH.js → index.esm2017-Djt10vTu.js} +1 -1
  68. package/dist/{loading-B56wz_ef.js → loading-CVE2HNjb.js} +4 -4
  69. package/dist/{membership-CF1jgR11.js → membership-BLkSVFx9.js} +3 -3
  70. package/dist/{money-BEEp2WdU.js → money-DqUkifCn.js} +1 -1
  71. package/dist/{number-u7HbwLPt.js → number-BPlOwScu.js} +1 -1
  72. package/dist/{objectid-S3_nH1F7.js → objectid-J3u1WeUz.js} +7 -7
  73. package/dist/{reward-BUY77BiP.js → reward-B9WzNBWQ.js} +1 -1
  74. package/dist/{rule-BdAPBN8_.js → rule-FtBYuezP.js} +3 -3
  75. package/dist/{rule-builder-z51VUtHk.js → rule-builder-caiYx8mw.js} +1 -1
  76. package/dist/{template-B_J4Q9D6.js → template-C1Iii37r.js} +4 -4
  77. package/dist/{trigger-CGrv0M0q.js → trigger-DEH6eTbm.js} +6 -6
  78. package/dist/{user-D02jOhtd.js → user-DqSmwkKW.js} +1 -1
  79. package/dist/{vue-i18n-rCSjqg2P.js → vue-i18n-4lC91qO3.js} +294 -294
  80. package/dist/{xlsx-CL102mzm.js → xlsx-DNspY5sG.js} +1 -1
  81. package/package.json +1 -1
  82. package/dist/MemberList-WGMopz-y.js +0 -1044
  83. package/dist/MemberTransactions-DmQgrLdy.js +0 -38
  84. package/dist/index-DFbITElv.js +0 -1052
@@ -1,1052 +0,0 @@
1
- import { z as e, F as n, e as E, m as l, g as ie, d as I } from "./loading-B56wz_ef.js";
2
- import { F as P } from "./campaign.enum-DVOwgVTa.js";
3
- import { c as f, F as x, e as m, g as se, f as ae, i as p, j as re, k as le } from "./index-DvE5xL4s.js";
4
- import { i as F, g as L, h as ce } from "./index-Df84_Ww3.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
- }), Oe = u.extend({
167
- type: e.literal(s.enum.MEMBERSHIP_JOINED),
168
- context: e.object({
169
- user: F
170
- })
171
- }), Pe = u.extend({
172
- type: e.literal(s.enum.TIER_UPGRADED),
173
- context: e.object({
174
- transaction: L
175
- })
176
- }), xe = u.extend({
177
- type: e.literal(s.enum.ISSUE_REWARD),
178
- context: e.object({
179
- transaction: L,
180
- collection: ce
181
- })
182
- });
183
- u.extend({
184
- type: e.literal(s.enum.REFERRAL_ADDED),
185
- context: e.object({
186
- user: F
187
- })
188
- });
189
- e.discriminatedUnion("type", [
190
- De,
191
- Ae,
192
- Me,
193
- Oe,
194
- Pe,
195
- xe,
196
- Te
197
- ]);
198
- const Le = 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
- }), Se = e.enum(["MULTIPLIER", "FIXED"]);
207
- e.object({
208
- type: Se
209
- });
210
- const Ne = e.object({
211
- _id: n.optional(),
212
- rule: f,
213
- tierExpression: e.string().nullish(),
214
- expExpression: e.string().nullish()
215
- }), D = e.object({
216
- _id: n,
217
- name: e.string().min(1),
218
- image: e.string().nullish(),
219
- option: Le,
220
- cycleOptions: e.array(e.lazy(() => Ne)).nullish(),
221
- member_count: e.number().optional()
222
- });
223
- D.partial({
224
- _id: !0
225
- });
226
- const En = D.partial({
227
- _id: !0
228
- }), je = e.object({
229
- icon: e.string(),
230
- label: e.string(),
231
- value: e.string()
232
- }), Be = 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(je).optional(),
249
- transactionId: e.string().optional()
250
- });
251
- e.object({
252
- trx: e.lazy(() => z),
253
- onlineTrx: Be.optional(),
254
- url: e.string().optional()
255
- });
256
- const S = e.enum(["POS", "APP", "ADMIN"]), N = e.enum(["topupCount"]), Ue = 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
- }), j = e.object({
264
- name: e.string(),
265
- regNo: e.string(),
266
- address: Ue,
267
- phoneNo: e.string(),
268
- sstRegNo: e.string().optional()
269
- }), B = e.object({
270
- systemCode: e.string(),
271
- inclusive: e.boolean()
272
- }), we = e.object({
273
- id: n,
274
- dayToExpire: e.number()
275
- }), Ge = 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
- }), ze = e.object({
283
- systemCode: e.string(),
284
- taxCode: e.string()
285
- }), He = e.object({
286
- name: e.string(),
287
- systemCode: e.string(),
288
- taxCode: e.string(),
289
- rate: ie,
290
- total: E
291
- });
292
- e.object({
293
- canPurchase: e.boolean(),
294
- reason: e.string()
295
- });
296
- e.object({
297
- type: N
298
- });
299
- e.object({
300
- type: N,
301
- min: e.number().nullish(),
302
- max: e.number().nullish()
303
- });
304
- const ke = 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 && I.Dinero.fromFdoDinero(r.price).toUnit() < 0.1 && i.addIssue({
313
- code: "custom",
314
- path: ["price"],
315
- message: "Price must be at least RM10"
316
- });
317
- }, U = 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(we),
329
- credit: Ge,
330
- taxes: e.array(ze),
331
- taxTotals: e.array(He),
332
- priceWithTaxes: E.nullish(),
333
- vouchers: e.array(n),
334
- _inclusiveTaxes: e.array(B).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: ke.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 > I.Dinero.fromFdoDinero(t.price).toUnit() && i.addIssue({
380
- code: "custom",
381
- message: `Normal credit cannot be more than price. Max: ${I.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), w = e.object({
395
- name: e.string(),
396
- bundles: e.array(U)
397
- });
398
- e.object({
399
- _id: e.string(),
400
- name: e.string(),
401
- expiredAt: e.string()
402
- });
403
- const Ve = e.object({
404
- apiKey: e.string(),
405
- webhookSecret: e.string()
406
- }), We = e.object({
407
- company: j.nullish(),
408
- inclusiveTaxes: e.array(B).nullish(),
409
- stripe: Ve.nullable().optional()
410
- }), Ke = {
411
- collectionName: "Stores",
412
- transform: {
413
- _id: "oid",
414
- business: "oid"
415
- }
416
- };
417
- We.extend({
418
- _id: n,
419
- business: n,
420
- categories: e.array(w)
421
- }).describe(l.describe(Ke));
422
- const Ye = e.object({
423
- refundedAt: e.coerce.date(),
424
- reason: e.string(),
425
- transactions: e.array(n)
426
- }), G = e.object({
427
- type: e.enum(["ONLINE", "OFFLINE", "COIN", "STRIPE", "CARD", "FEEDVIBE", "ADMIN"]),
428
- extra: e.string().nullish()
429
- }), Je = {
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
- }, z = e.object({
445
- _id: n,
446
- source: S,
447
- // can be memberStorePurchase
448
- ref: e.string(),
449
- business: n,
450
- company: j,
451
- location: n.optional(),
452
- member: n,
453
- // createdAt: z.coerce.date(),
454
- bundle: U,
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: Ye.nullish(),
464
- paymentType: G.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(Je));
473
- e.object({
474
- bundle: n,
475
- member: e.string(),
476
- ref: e.string(),
477
- paymentType: G.nullish(),
478
- withCoin: e.boolean().optional(),
479
- card: e.string().optional(),
480
- location: n.optional(),
481
- source: S,
482
- webhookUrl: e.string().optional()
483
- });
484
- e.object({
485
- categories: e.array(w)
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 qe = {
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(() => F).nullish(),
546
- pf_transaction: e.lazy(() => z).nullish()
547
- }).describe(l.describe(qe));
548
- const Ze = 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: Ze,
559
- setCardOnBind: e.boolean().optional(),
560
- design: e.string().nullish(),
561
- bundle: e.string().optional(),
562
- subscriptionBundle: e.string().optional()
563
- });
564
- const Xe = e.enum(["SMS", "EMAIL"]), y = e.object({
565
- channel: Xe,
566
- variables: e.array(e.string()),
567
- title: e.string().nullish(),
568
- design: e.any(),
569
- content: e.string(),
570
- language: e.string(),
571
- imageUrl: e.string().nullish()
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, oe) => (b != null ? b[oe] : null) ?? null, i);
586
- return C !== null ? C : r;
587
- });
588
- }
589
- const A = 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({
590
- type: e.literal(A.enum.NO_REWARD),
591
- collectible: e.null(),
592
- weight: T
593
- }), v = e.object({
594
- type: e.literal(A.enum.VOUCHER),
595
- collectible: n,
596
- collectibleConfig: e.lazy(() => x._def.right.options[0]),
597
- earningOption: e.lazy(() => m)
598
- }), M = e.object({
599
- type: e.literal(A.enum.LOYALTY),
600
- collectible: n,
601
- earningOption: e.lazy(() => m),
602
- validityOption: e.lazy(() => se)
603
- }), V = v.extend({
604
- weight: T
605
- }), W = M.extend({
606
- weight: e.number().min(0, "Weight need to be at least 0")
607
- }), hn = M.extend({
608
- validityOption: ae,
609
- weight: T
610
- }), $e = e.discriminatedUnion("type", [
611
- V,
612
- W,
613
- k
614
- ]), O = e.discriminatedUnion("type", [
615
- V.extend({
616
- collectible: n.nullish(),
617
- business: n.nullish()
618
- }),
619
- W.extend({
620
- collectible: n.nullish(),
621
- business: n.nullish()
622
- }),
623
- k
624
- ]), K = v.extend({
625
- threshold: H
626
- }), Y = M.extend({
627
- threshold: H
628
- }), J = e.discriminatedUnion("type", [
629
- K,
630
- Y
631
- ]), Qe = e.discriminatedUnion("type", [
632
- K.extend({
633
- collectible: n.nullish(),
634
- business: n.nullish()
635
- }),
636
- Y.extend({
637
- collectible: n.nullish(),
638
- collectibleConfig: x.nullish(),
639
- business: n.nullish()
640
- })
641
- ]), en = {
642
- collectionName: "Locations",
643
- transform: {
644
- _id: "oid",
645
- business: "oid"
646
- }
647
- }, q = e.object({
648
- _id: n,
649
- business: n,
650
- name: e.string(),
651
- code: e.string().nullish(),
652
- otp: e.string().nullish(),
653
- otpExpiredAt: e.coerce.date().nullish(),
654
- apiToken: e.string().nullish()
655
- }).describe(l.describe(en));
656
- e.object({
657
- _id: n,
658
- name: e.string(),
659
- location: n,
660
- os: e.string(),
661
- apiToken: e.string().nullish()
662
- }).describe(l.describe({
663
- collectionName: "LocationDevices",
664
- transform: {
665
- _id: "oid",
666
- location: "oid"
667
- }
668
- }));
669
- const nn = e.enum(["PROGRESSIVE", "STAMP"]), tn = e.object({
670
- type: nn,
671
- end: e.number().int().min(0, "Threshold need to be at least 1"),
672
- rewards: e.array(e.lazy(() => J)).nullish()
673
- }).superRefine((t, i) => {
674
- t.type == "STAMP" && t.end > 40 && (i.addIssue({
675
- code: "custom",
676
- path: [],
677
- message: "Stamp mission can have at most 40 threshold"
678
- }), i.addIssue({
679
- code: "custom",
680
- path: ["end"],
681
- message: "Stamp mission can have at most 40 threshold"
682
- }));
683
- }), on = {
684
- collectionName: "Groups",
685
- transform: {
686
- _id: "oid",
687
- business: "oid"
688
- },
689
- lookups: {
690
- business: {
691
- fromCollection: "Businesses",
692
- as: "pf_business"
693
- },
694
- pf_campaigns: {
695
- fromCollection: "Campaigns",
696
- as: "pf_campaigns",
697
- localField: "_id",
698
- foreignField: "group"
699
- }
700
- }
701
- }, Cn = e.object({
702
- _id: n,
703
- name: e.string().min(1).max(300),
704
- business: n,
705
- pf_campaigns: e.array(e.any()).optional()
706
- }).describe(l.describe(on)), sn = e.object({
707
- from: e.string().email().nullish(),
708
- name: e.string().min(1).max(50).nullish()
709
- }), an = e.object({
710
- type: e.literal(P.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(() => D)),
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
- email: sn.nullish(),
731
- freeCreditAsDiscount: e.boolean().optional(),
732
- pf_title: e.array(e.lazy(() => p)).optional(),
733
- pf_targetLocation: e.array(e.lazy(() => q)).optional(),
734
- // new structure
735
- group: e.string().nullish(),
736
- templateId: n.nullish()
737
- }), o = P.exclude(["MEMBERSHIP"]), c = e.object({
738
- _id: n.nullish(),
739
- type: o,
740
- // common information
741
- business: n,
742
- name: e.string().min(1).max(50),
743
- image: e.string().nullish(),
744
- description: e.string().max(500).nullish(),
745
- timeframeOptions: re.superRefine((t, i) => {
746
- t.start && t.end && t.end < t.start && i.addIssue({
747
- code: "custom",
748
- path: [],
749
- params: {
750
- i18n: { key: "timeframe.end_before_start" }
751
- }
752
- });
753
- }).nullish(),
754
- targetLocation: e.array(n).nullish(),
755
- event: Fe,
756
- config: le.nullish(),
757
- currentReceive: e.coerce.number().optional(),
758
- // new group structure
759
- group: n.nullish(),
760
- templateId: n.nullish(),
761
- pf_targetLocation: e.array(e.lazy(() => q)).optional()
762
- }), d = {
763
- [o.enum.VOUCHER]: [
764
- "BILL_COMPLETED",
765
- "FEEDBACK",
766
- "MEMBERSHIP_JOINED",
767
- "TIER_UPGRADED",
768
- "SCHEDULE",
769
- "SIMPLE_CLAIM"
770
- ],
771
- [o.enum.PROMOTION]: ["MAKING_ORDER"],
772
- [o.enum.POINT]: [
773
- "BILL_COMPLETED",
774
- "FEEDBACK",
775
- "MEMBERSHIP_JOINED",
776
- "TIER_UPGRADED",
777
- "SCHEDULE"
778
- ],
779
- [o.enum.CREDIT]: [
780
- "BILL_COMPLETED",
781
- "FEEDBACK",
782
- "MEMBERSHIP_JOINED",
783
- "TIER_UPGRADED",
784
- "SCHEDULE"
785
- ],
786
- [o.enum.BROADCAST]: [
787
- "SCHEDULE",
788
- "ISSUE_REWARD",
789
- "FEEDBACK"
790
- ],
791
- [o.enum.COIN]: [
792
- "BILL_COMPLETED",
793
- "FEEDBACK",
794
- "MEMBERSHIP_JOINED",
795
- "TIER_UPGRADED",
796
- "SCHEDULE"
797
- ],
798
- [o.enum.REWARD_POOL]: ["GAME_COMPLETED"],
799
- [o.enum.GAME]: [
800
- "BILL_COMPLETED",
801
- "FEEDBACK",
802
- "MEMBERSHIP_JOINED",
803
- "TIER_UPGRADED",
804
- "SCHEDULE",
805
- "SIMPLE_CLAIM"
806
- ],
807
- [o.enum.MISSION]: [
808
- "BILL_COMPLETED",
809
- "FEEDBACK",
810
- "SCHEDULE"
811
- ]
812
- }, Z = c.extend({
813
- type: e.literal(o.enum.VOUCHER),
814
- // event
815
- code: e.string().min(0).max(15).optional(),
816
- event: a.merge(
817
- e.object({
818
- type: e.enum(d[o.enum.VOUCHER])
819
- })
820
- ),
821
- earningOption: m.default({
822
- amount: 1,
823
- type: "FIXED"
824
- }),
825
- collectible: n,
826
- hideInApp: e.boolean().optional(),
827
- notify: e.boolean().optional(),
828
- notifyMessage: e.lazy(() => y).optional(),
829
- notifyCampaign: n.nullish(),
830
- pf_collectible: e.lazy(() => p).optional(),
831
- pf_notifyCampaign: e.lazy(() => h).optional()
832
- }), rn = e.object({
833
- gameType: e.string()
834
- }), X = c.extend({
835
- type: e.literal(o.enum.PROMOTION),
836
- // event
837
- event: a.merge(
838
- e.object({
839
- type: e.enum(d[o.enum.PROMOTION])
840
- })
841
- ),
842
- effect: e.custom().superRefine((t, i) => {
843
- t || i.addIssue({
844
- code: "custom",
845
- path: [],
846
- params: {
847
- i18n: { key: "zodCustom.campaign.effect_required" }
848
- }
849
- });
850
- }),
851
- gameConfig: rn.nullish()
852
- }), $ = c.extend({
853
- type: e.literal(o.enum.POINT),
854
- // event
855
- event: a.merge(
856
- e.object({
857
- type: e.enum(d[o.enum.POINT])
858
- })
859
- ),
860
- earningOption: m,
861
- collectible: n,
862
- notify: e.boolean().optional(),
863
- notifyMessage: e.lazy(() => y).optional(),
864
- notifyCampaign: n.nullish(),
865
- pf_collectible: e.lazy(() => p).optional(),
866
- pf_notifyCampaign: e.lazy(() => h).optional()
867
- }), Q = c.extend({
868
- type: e.literal(o.enum.CREDIT),
869
- // event
870
- event: a.merge(
871
- e.object({
872
- type: e.enum(d[o.enum.CREDIT])
873
- })
874
- ),
875
- earningOption: m,
876
- collectible: n,
877
- notify: e.boolean().optional(),
878
- notifyMessage: e.lazy(() => y).optional(),
879
- notifyCampaign: n.nullish(),
880
- pf_collectible: e.lazy(() => p).optional(),
881
- pf_notifyCampaign: e.lazy(() => h).optional()
882
- }), h = c.extend({
883
- type: e.literal(o.enum.BROADCAST),
884
- // event
885
- event: a.merge(
886
- e.object({
887
- type: e.enum(d[o.enum.BROADCAST])
888
- })
889
- ),
890
- message: y,
891
- linkedCampaign: n.nullish()
892
- }), ee = c.extend({
893
- type: e.literal(o.enum.COIN),
894
- // event
895
- event: a.merge(
896
- e.object({
897
- type: e.enum(d[o.enum.COIN])
898
- })
899
- ),
900
- earningOption: m,
901
- collectible: n,
902
- notify: e.boolean().optional(),
903
- notifyMessage: e.lazy(() => y).optional(),
904
- notifyCampaign: n.nullish(),
905
- pf_collectible: e.lazy(() => p).optional(),
906
- pf_notifyCampaign: e.lazy(() => h).optional()
907
- }), R = c.extend({
908
- type: e.literal(o.enum.REWARD_POOL),
909
- // event
910
- event: a.merge(
911
- e.object({
912
- type: e.enum(d[o.enum.REWARD_POOL])
913
- })
914
- ),
915
- rewards: e.array(e.lazy(() => $e)).min(1, "Requires at least 1 reward")
916
- }), ne = c.extend({
917
- type: e.literal(o.enum.GAME),
918
- // event
919
- event: a.merge(
920
- e.object({
921
- type: e.enum(d[o.enum.GAME])
922
- })
923
- ),
924
- earningOption: m,
925
- collectible: n,
926
- game: e.lazy(() => R).optional(),
927
- pf_collectible: e.lazy(() => p).optional(),
928
- rewardPool: n.optional()
929
- }), te = c.extend({
930
- type: e.literal(o.enum.MISSION),
931
- event: a.merge(
932
- e.object({
933
- type: e.enum(d[o.enum.MISSION])
934
- })
935
- ),
936
- earningOption: m,
937
- collectible: n,
938
- pf_collectible: e.lazy(() => p).optional(),
939
- mission: e.lazy(() => tn),
940
- rewards: e.array(e.lazy(() => J)).min(1, "Requires at least 1 reward")
941
- }), ln = {
942
- collectionName: "Campaigns",
943
- transform: {
944
- _id: "oid",
945
- business: "oid",
946
- collectible: "oid",
947
- templateId: "oid",
948
- group: "oid",
949
- notifyCampaign: "oid",
950
- linkedCampaign: "oid",
951
- rewardPool: "oid"
952
- },
953
- lookups: {
954
- business: {
955
- fromCollection: "Businesses",
956
- as: "pf_business"
957
- },
958
- targetLocation: {
959
- fromCollection: "Locations",
960
- as: "pf_targetLocation"
961
- },
962
- collectible: {
963
- fromCollection: "CollectibleConfigs",
964
- as: "pf_collectible"
965
- },
966
- titles: {
967
- fromCollection: "CollectibleConfigs",
968
- as: "pf_title"
969
- },
970
- templateId: {
971
- fromCollection: "Templates",
972
- as: "template"
973
- },
974
- notifyCampaign: {
975
- fromCollection: "Campaigns",
976
- as: "pf_notifyCampaign"
977
- },
978
- rewardPool: {
979
- fromCollection: "Campaigns",
980
- as: "game"
981
- }
982
- }
983
- }, fn = e.object({ _id: n }).and(
984
- e.discriminatedUnion("type", [
985
- an,
986
- Z,
987
- X,
988
- $,
989
- Q,
990
- h,
991
- ee,
992
- R,
993
- ne,
994
- te
995
- ])
996
- ).describe(l.describe(ln)), _n = e.discriminatedUnion("type", [
997
- Z.extend({
998
- business: n.nullish()
999
- }),
1000
- X.extend({
1001
- business: n.nullish()
1002
- }),
1003
- $.extend({
1004
- business: n.nullish()
1005
- }),
1006
- Q.extend({
1007
- business: n.nullish()
1008
- }),
1009
- h.extend({
1010
- business: n.nullish()
1011
- }),
1012
- ee.extend({
1013
- business: n.nullish()
1014
- }),
1015
- R.extend({
1016
- rewards: e.array(e.lazy(() => O)).min(1, "Requires at least 1 reward")
1017
- }),
1018
- ne.extend({
1019
- business: n.nullish(),
1020
- game: R.extend({
1021
- business: n.nullish(),
1022
- rewards: e.array(e.lazy(() => O)).min(1, "Requires at least 1 reward")
1023
- })
1024
- }),
1025
- te.extend({
1026
- business: n.nullish(),
1027
- rewards: e.array(e.lazy(() => Qe)).min(1, "Requires at least 1 reward")
1028
- })
1029
- ]);
1030
- export {
1031
- d as C,
1032
- En as F,
1033
- o as a,
1034
- hn as b,
1035
- O as c,
1036
- nn as d,
1037
- Qe as e,
1038
- tn as f,
1039
- Cn as g,
1040
- _n as h,
1041
- fn as i,
1042
- bn as j,
1043
- s as k,
1044
- We as l,
1045
- j as m,
1046
- Ue as n,
1047
- U as o,
1048
- S as p,
1049
- Fe as q,
1050
- an as r,
1051
- yn as s
1052
- };