@feedmepos/mf-connect 0.1.0-beta.7 → 0.1.0-beta.70

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 (123) hide show
  1. package/dist/Analytic-DEQUEGlq.js +427 -0
  2. package/dist/{App-DalxIjTu.js → App-CcoU2SAx.js} +445 -420
  3. package/dist/AuditLogs-CiB6u06w.js +1886 -0
  4. package/dist/Bin-C2_1m5RT.js +166 -0
  5. package/dist/{Broadcast-uMAvsC--.js → Broadcast-TotIXDuJ.js} +56 -54
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-JxbENan8.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CixQu3Pr.js} +6 -8
  7. package/dist/Card-Ce-_xMgS.js +896 -0
  8. package/dist/Collections-DKva6Doi.js +459 -0
  9. package/dist/{Credit-QlnatflM.js → Credit-BVUxIJ6C.js} +36 -34
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +108 -0
  11. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js +58 -0
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BKEumoan.js +2181 -0
  13. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BE07lc4M.js → EffectSheet.vue_vue_type_style_index_0_lang-ah4bz-qR.js} +49 -49
  14. package/dist/{Experience-Czy41ifp.js → Experience-DV3384o0.js} +32 -30
  15. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-BrPLkFX8.js +118 -0
  16. package/dist/Game-DY83ti52.js +278 -0
  17. package/dist/Index-DEIaZ-2H.js +259 -0
  18. package/dist/Marketing-C2RwIlrg.js +20071 -0
  19. package/dist/Member-D4fc-wzd.js +333 -0
  20. package/dist/MemberList-DSMI6t_D.js +1598 -0
  21. package/dist/MemberTransactions-wXUlbbRq.js +45 -0
  22. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CtM73bcN.js → MessageInput.vue_vue_type_script_setup_true_lang-DYS0klKm.js} +135 -120
  23. package/dist/Mission-P_KLDEpg.js +296 -0
  24. package/dist/Overview-8vc0f1D7.js +1078 -0
  25. package/dist/{Point-By6ogYy_.js → Point-B4Y0Pq60.js} +55 -53
  26. package/dist/{Promotion-DKcBr-RI.js → Promotion-C1CbesgZ.js} +65 -57
  27. package/dist/Queue-BlPA7PNH.js +244 -0
  28. package/dist/Record-Cl1qXSSk.js +340 -0
  29. package/dist/Reward-jy6-W1Eh.js +442 -0
  30. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-d5JNNNHf.js +150 -0
  31. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DYul_Nu8.js +1640 -0
  32. package/dist/Segment-B36Nrvxs.js +568 -0
  33. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-jN0xUFNR.js +181 -0
  34. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-BLFTNooB.js +186 -0
  35. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-H_Sehhgf.js +147 -0
  36. package/dist/Setting-AgQf2X4W.js +1931 -0
  37. package/dist/Store-D3Mm0pan.js +1841 -0
  38. package/dist/StoreRewards-L0VLWz8l.js +423 -0
  39. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Zl_cXXSD.js +1028 -0
  40. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-nEdCD6la.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-b4mfueTj.js} +1 -1
  41. package/dist/{Tier-DvAs0-yx.js → Tier-DQq-375x.js} +327 -318
  42. package/dist/{Title-B_Trr39o.js → Title-OJxuBvaa.js} +224 -209
  43. package/dist/{Transaction-DCJw-b3H.js → Transaction-vgsYRfD7.js} +2 -2
  44. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Cwi0mvC3.js +130 -0
  45. package/dist/Voucher-BFwLaoxe.js +354 -0
  46. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DNUBaNtJ.js +419 -0
  47. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DXkhu8e9.js → ZodTextField.vue_vue_type_script_setup_true_lang-ms40eptZ.js} +1 -1
  48. package/dist/app-BQFTJ_hE.js +33357 -0
  49. package/dist/app-D7C3Fxfi.js +7077 -0
  50. package/dist/app.js +1 -1
  51. package/dist/{business-BC4-i1cU.js → business-vzpvmTdG.js} +1 -1
  52. package/dist/{campaign--0_yMbMV.js → campaign-BkxTDfsK.js} +2 -2
  53. package/dist/campaign-UQ8kMVeC.js +1810 -0
  54. package/dist/campaign.enum-BdT-e9h9.js +20 -0
  55. package/dist/campaign.fn-lc4ZhFCU.js +758 -0
  56. package/dist/collectible.enum-C8kd17Tz.js +19 -0
  57. package/dist/{collection.fn-3TwPe7aF.js → collection.fn-BIw1Y_tv.js} +2 -2
  58. package/dist/dto-CwzAhB8x.js +214 -0
  59. package/dist/{effect-BeR0LK61.js → effect-CJcvLlKG.js} +33 -16
  60. package/dist/email-addresses-BCJTQPT0.js +705 -0
  61. package/dist/{export-xeLLhqvh.js → export-URRwle1z.js} +5 -5
  62. package/dist/{helper-B5iqfKh8.js → helper-DccnE6zn.js} +1 -1
  63. package/dist/index-BiIZ7X6d.js +29556 -0
  64. package/dist/{index-CyKZ-SsN.js → index-BsRJ4kVb.js} +1 -1
  65. package/dist/{index-CU_d8jjU.js → index-C3lpXz_P.js} +1 -1
  66. package/dist/{index-Ct_wR519.js → index-CFA3EqId.js} +24 -21
  67. package/dist/{index-DP-dGMJC.js → index-CPRN3irj.js} +2230 -871
  68. package/dist/index-CaxFS90M.js +56 -0
  69. package/dist/index-CsaQJMAR.js +66 -0
  70. package/dist/index-D4MX9e5q.js +115 -0
  71. package/dist/index-DrE9VkxR.js +32 -0
  72. package/dist/index-EOPRlB9V.js +54 -0
  73. package/dist/{index-CAn5heDe.js → index-FcxOGFKj.js} +48 -4
  74. package/dist/{index-Bh-uaaBG.js → index-OScGm4mF.js} +1506 -1480
  75. package/dist/{index-BOdtpNkP.js → index-ghSGvG-m.js} +266 -173
  76. package/dist/index-vh86FiIQ.js +10 -0
  77. package/dist/{index.esm2017-5jeDA5Zo.js → index.esm2017-CE1CQHrP.js} +121 -121
  78. package/dist/loading-B8zghYbj.js +71 -0
  79. package/dist/{membership-D0nqqWNZ.js → membership-DoJMF2T6.js} +54 -46
  80. package/dist/money-CTR0rXZw.js +15 -0
  81. package/dist/number-Bhgz9eFP.js +12 -0
  82. package/dist/objectid-DdVJrRBw.js +145 -0
  83. package/dist/{loading-C-JDVajU.js → plugins-B5mQ7CHT.js} +3871 -3943
  84. package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
  85. package/dist/reward-DicsEEHe.js +36 -0
  86. package/dist/{rule-builder-BXt29Es4.js → rule-builder-BWb4JTrd.js} +1 -1
  87. package/dist/{rule-Dn_GgBCe.js → rule-s8siRar1.js} +185 -178
  88. package/dist/style.css +1 -1
  89. package/dist/{template-D2Oi3dxP.js → template-Qb5ozfLa.js} +5 -5
  90. package/dist/trigger-Bsb3Kj35.js +144 -0
  91. package/dist/user-DJ8aHRaM.js +54 -0
  92. package/dist/{vue-i18n-Dud8fvmw.js → vue-i18n-BG2U7GtN.js} +282 -282
  93. package/dist/{xlsx-CCRCidY2.js → xlsx-2QxyDFwt.js} +1 -1
  94. package/package.json +11 -7
  95. package/dist/Analytic-BMpS6jWb.js +0 -622
  96. package/dist/Card-DV8-g69L.js +0 -825
  97. package/dist/Collections-DRafEHT1.js +0 -453
  98. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-TDoMehSB.js +0 -2813
  99. package/dist/Game-CD3zSitz.js +0 -255
  100. package/dist/Marketing-NNes8z6Q.js +0 -316
  101. package/dist/Member-CTqBgYuV.js +0 -69
  102. package/dist/MemberList-B99tS5ce.js +0 -1733
  103. package/dist/MemberTransactions-D1YCXPOg.js +0 -38
  104. package/dist/Mission-XbBVKBiE.js +0 -261
  105. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-D1ESqEFO.js +0 -1753
  106. package/dist/Segment-B8cszL-F.js +0 -437
  107. package/dist/Setting-aZYABlMW.js +0 -1901
  108. package/dist/Store-Bx2tyJwe.js +0 -1511
  109. package/dist/StoreRewards-DTp9G6gw.js +0 -401
  110. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-B2W7ly5Z.js +0 -890
  111. package/dist/Voucher-jqv3ji90.js +0 -490
  112. package/dist/app-WlcUVbFb.js +0 -5764
  113. package/dist/app-_w0hjM7u.js +0 -53428
  114. package/dist/dto-Ns2dLn1B.js +0 -2770
  115. package/dist/index-BWb9vRCi.js +0 -29193
  116. package/dist/index-CpU9aqyW.js +0 -206
  117. package/dist/index-CqO_ZvtD.js +0 -99
  118. package/dist/index-CuvNtC_M.js +0 -61
  119. package/dist/index-DsNsA2uX.js +0 -298
  120. package/dist/index-WAMr3npT.js +0 -762
  121. package/dist/money-hdbrblud.js +0 -15
  122. package/dist/number-CRWGOZaW.js +0 -12
  123. package/dist/user-Bm4KttFq.js +0 -37
@@ -0,0 +1,442 @@
1
+ import { defineComponent as X, ref as x, computed as H, resolveComponent as w, openBlock as b, createBlock as h, unref as t, isRef as Z, withCtx as A, createElementVNode as f, createVNode as d, createCommentVNode as k, createElementBlock as M, Fragment as Y, h as O, onMounted as q, toDisplayString as B } from "vue";
2
+ import { _ as z } from "./campaign-CpzFl8Vr.js";
3
+ import { useDialog as Q, components as L } from "@feedmepos/ui-library";
4
+ import { u as G } from "./loading-B8zghYbj.js";
5
+ import { u as J, C as ee } from "./membership-DoJMF2T6.js";
6
+ import { f as j, p as te } from "./plugins-B5mQ7CHT.js";
7
+ import { u as oe } from "./vue-i18n-BG2U7GtN.js";
8
+ import { c as ae } from "./object-qECH92oz.js";
9
+ import { Z as _ } from "./zod-Bg2FbC-D.js";
10
+ import "./index-OScGm4mF.js";
11
+ import { F as N } from "./index-EOPRlB9V.js";
12
+ import { useCoreStore as le } from "@feedmepos/mf-common";
13
+ import { _ as ne, a as ie } from "./VoucherEditor.vue_vue_type_script_setup_true_lang-DNUBaNtJ.js";
14
+ import { b as re } from "./EffectSheet.vue_vue_type_style_index_0_lang-ah4bz-qR.js";
15
+ import { J as K } from "./JsonViewer-v8_C7l5N.js";
16
+ import { _ as se } from "./ZodTextField.vue_vue_type_script_setup_true_lang-ms40eptZ.js";
17
+ import { i as de } from "./helper-DccnE6zn.js";
18
+ import { u as pe, r as P } from "./reward-DicsEEHe.js";
19
+ import "./index-BsRJ4kVb.js";
20
+ import { C as ce } from "./campaign.fn-lc4ZhFCU.js";
21
+ import { e as me } from "./effect-CJcvLlKG.js";
22
+ import { useRouter as ue } from "vue-router";
23
+ import { R as ye } from "./app-D7C3Fxfi.js";
24
+ const fe = { class: "flex gap-8 items-center justify-start" }, we = /* @__PURE__ */ X({
25
+ __name: "EditRewardSheet",
26
+ emits: ["update"],
27
+ setup(W, { expose: n, emit: I }) {
28
+ const p = J(), { minor: C } = G, v = x(!1), a = x({}), y = x(), R = H(() => {
29
+ var l;
30
+ return ((l = a.value.option) == null ? void 0 : l.collectibleType) === "CREDIT" ? N.superRefine((e, o) => {
31
+ var i, m, g, r;
32
+ !((m = (i = e.option) == null ? void 0 : i.validityOption) != null && m.validForDay) && !((r = (g = e.option) == null ? void 0 : g.validityOption) != null && r.validBefore) && o.addIssue({
33
+ code: "custom",
34
+ path: [],
35
+ message: "Credit validity must be set"
36
+ });
37
+ }) : N;
38
+ }), u = H(() => {
39
+ const l = R.value.safeParse(a.value);
40
+ return l.success ? [] : l.error.errors;
41
+ });
42
+ function F(l, e) {
43
+ l && (y.value = void 0, a.value = e), v.value = l;
44
+ }
45
+ const D = I;
46
+ async function S() {
47
+ const l = R.value.safeParse(a.value);
48
+ !l.success || !l.data || (await C(
49
+ async () => {
50
+ var e;
51
+ l.data.option.type === "VOUCHER" && y.value && (l.data.option.collectibleConfig.image = await j.update(
52
+ ((e = l.data.option.collectibleConfig) == null ? void 0 : e.image) || j.collectibleImagePath(void 0, y.value),
53
+ y.value
54
+ ));
55
+ },
56
+ {
57
+ message: "Uploading reward image",
58
+ successMessage: "Reward image updated"
59
+ }
60
+ ), D("update", l.data));
61
+ }
62
+ function T(l) {
63
+ l === "VOUCHER" ? a.value.option = {
64
+ collectible: null,
65
+ type: "VOUCHER",
66
+ collectibleConfig: de("VOUCHER", {
67
+ business: le().currentBusiness.value._id
68
+ }),
69
+ earningOption: {
70
+ amount: 1,
71
+ type: "FIXED"
72
+ },
73
+ validityOption: {
74
+ validForDay: 7
75
+ }
76
+ } : a.value.option = {
77
+ collectible: p.loyaltyRewards.raw[0]._id,
78
+ collectibleType: p.loyaltyRewards.raw[0].type,
79
+ type: "LOYALTY",
80
+ earningOption: {
81
+ amount: 1,
82
+ type: "FIXED"
83
+ },
84
+ validityOption: {
85
+ validForDay: 7
86
+ }
87
+ };
88
+ }
89
+ function $(l) {
90
+ a.value.option.collectible = l, a.value.option.collectibleType = p.loyaltyRewards.raw.find(
91
+ (e) => e._id === l
92
+ ).type;
93
+ }
94
+ const V = x();
95
+ return n({
96
+ showSheet: F
97
+ }), (l, e) => {
98
+ const o = w("FmSelect"), i = w("FmForm"), m = w("FmButton"), g = w("FmSideSheet");
99
+ return b(), h(g, {
100
+ "max-width": 560,
101
+ modelValue: t(v),
102
+ "onUpdate:modelValue": [
103
+ e[8] || (e[8] = (r) => Z(v) ? v.value = r : null),
104
+ e[9] || (e[9] = (r) => v.value = r)
105
+ ],
106
+ header: "Edit reward"
107
+ }, {
108
+ "side-sheet-footer": A(() => [
109
+ f("div", fe, [
110
+ d(m, {
111
+ variant: "primary",
112
+ type: "button",
113
+ label: "Confirm",
114
+ disabled: t(u).length > 0,
115
+ onClick: e[6] || (e[6] = (r) => S())
116
+ }, null, 8, ["disabled"]),
117
+ d(m, {
118
+ variant: "secondary",
119
+ type: "button",
120
+ label: "Cancel",
121
+ onClick: e[7] || (e[7] = (r) => v.value = !1)
122
+ })
123
+ ])
124
+ ]),
125
+ default: A(() => [
126
+ d(K, { json: t(a) }, null, 8, ["json"]),
127
+ d(i, {
128
+ class: "flex flex-col gap-y-24",
129
+ ref_key: "formRef",
130
+ ref: V,
131
+ onValidationSuccess: e[5] || (e[5] = (r) => S())
132
+ }, {
133
+ default: A(() => {
134
+ var r, E, c;
135
+ return [
136
+ d(se, {
137
+ modelValue: t(a).name,
138
+ "onUpdate:modelValue": e[0] || (e[0] = (s) => t(a).name = s),
139
+ label: "Reward Name",
140
+ schema: t(_).typeAtPath(t(R), "name", []),
141
+ "error-text": t(_).helperText(t(u), "name")
142
+ }, null, 8, ["modelValue", "schema", "error-text"]),
143
+ d(o, {
144
+ label: "Reward Type",
145
+ disabled: !!t(a)._id,
146
+ items: [
147
+ { label: "Voucher", value: "VOUCHER" },
148
+ { label: "Loyalty", value: "LOYALTY" }
149
+ ],
150
+ "model-value": t(a).option.type,
151
+ "onUpdate:modelValue": T
152
+ }, null, 8, ["disabled", "model-value"]),
153
+ t(a).option.type == "LOYALTY" ? (b(), h(o, {
154
+ key: 0,
155
+ label: "Loyalty type",
156
+ items: t(p).loyaltyRewards.items,
157
+ "model-value": t(a).option.collectible,
158
+ "onUpdate:modelValue": $
159
+ }, null, 8, ["items", "model-value"])) : k("", !0),
160
+ t(a).option.type === "LOYALTY" ? (b(), M(Y, { key: 1 }, [
161
+ e[10] || (e[10] = f("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
162
+ ((r = t(p).loyaltyRewards.items.find(
163
+ (s) => {
164
+ var U;
165
+ return s.value === ((U = t(a)) == null ? void 0 : U.option.collectible);
166
+ }
167
+ )) == null ? void 0 : r.raw.type) !== "TITLE" ? (b(), h(ne, {
168
+ key: 0,
169
+ class: "mt-[-8px]",
170
+ rules: [
171
+ t(_).ruleAtPath(t(R), "option.earningOption", [
172
+ t(a).option.type
173
+ ])
174
+ ],
175
+ "helper-state": t(_).helperState(t(u), "option.earningOption"),
176
+ "error-text": t(_).helperText(t(u), "option.earningOption"),
177
+ "fixed-type": !0,
178
+ "model-value": t(a).option.earningOption,
179
+ "onUpdate:modelValue": e[1] || (e[1] = (s) => t(a).option.earningOption = s)
180
+ }, null, 8, ["rules", "helper-state", "error-text", "model-value"])) : k("", !0),
181
+ d(re, {
182
+ class: "!gap-24",
183
+ "for-credit": t(a).option.type === "LOYALTY" && ((E = t(p).loyaltyRewards.items.find(
184
+ (s) => {
185
+ var U;
186
+ return s.value === ((U = t(a).option) == null ? void 0 : U.collectible);
187
+ }
188
+ )) == null ? void 0 : E.raw.type) === "CREDIT",
189
+ type: t(a).option.type === "VOUCHER" ? "range" : "custom",
190
+ rules: [
191
+ t(_).ruleAtPath(t(R), "option.validityOption", [
192
+ t(a).option.type
193
+ ])
194
+ ],
195
+ "model-value": t(a).option.validityOption,
196
+ "onUpdate:modelValue": e[2] || (e[2] = (s) => t(a).option.validityOption = s)
197
+ }, null, 8, ["for-credit", "type", "rules", "model-value"])
198
+ ], 64)) : k("", !0),
199
+ t(a).option.type === "VOUCHER" ? (b(), h(ie, {
200
+ key: 2,
201
+ "reward-image": t(y),
202
+ "model-value": ((c = t(a)) == null ? void 0 : c.option.collectibleConfig) ?? void 0,
203
+ "onUpdate:modelValue": e[3] || (e[3] = (s) => t(a).option.collectibleConfig = s),
204
+ "onUpdate:rewardImage": e[4] || (e[4] = (s) => y.value = s)
205
+ }, null, 8, ["reward-image", "model-value"])) : k("", !0),
206
+ d(K, { json: t(u) }, null, 8, ["json"])
207
+ ];
208
+ }),
209
+ _: 1
210
+ }, 512)
211
+ ]),
212
+ _: 1
213
+ }, 8, ["modelValue"]);
214
+ };
215
+ }
216
+ }), ve = { class: "px-24 flex flex-col gap-y-16" }, ge = { class: "flex items-center justify-between w-full" }, be = { class: "flex flex-col gap-16 text-center" }, Re = { class: "fm-typo-en-title-sm-800" }, Ce = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ke = /* @__PURE__ */ X({
217
+ __name: "Reward",
218
+ setup(W) {
219
+ const { t: n } = oe(), I = {
220
+ label: n("connect.storeRewards.create"),
221
+ value: "create",
222
+ isPrimary: !0,
223
+ prependIcon: "add"
224
+ }, p = J(), C = pe(), { global: v, minor: a } = G, y = ue(), R = Q(), u = x({
225
+ searchKey: "",
226
+ columnFilters: []
227
+ }), F = H(() => C.rewards);
228
+ function D(e) {
229
+ y.push({
230
+ name: ye["$connect-STORE_REWARD_COLLECTIONS"],
231
+ params: { id: e }
232
+ });
233
+ }
234
+ const S = [
235
+ {
236
+ header: n("connect.storeRewards.table.name"),
237
+ accessorFn: (e) => e.name
238
+ },
239
+ {
240
+ header: n("connect.storeRewards.table.type"),
241
+ cell(e) {
242
+ return e.row.original.collectibleConfig ? ee[e.row.original.collectibleConfig.type].chip() : "N/A";
243
+ }
244
+ },
245
+ {
246
+ header: n("connect.storeRewards.table.summary"),
247
+ accessorFn: (e) => {
248
+ var o, i;
249
+ if (e.option.type === "VOUCHER")
250
+ return me((i = (o = e.option.collectibleConfig) == null ? void 0 : o.extras) == null ? void 0 : i.effect);
251
+ if (e.option.collectibleType == "TITLE") {
252
+ const m = p.sortedTitles.find(
253
+ (g) => g._id == e.option.collectible
254
+ );
255
+ return `Get ${m == null ? void 0 : m.name} valid for ${e.option.validityOption.validForDay} days`;
256
+ }
257
+ return `Get ${e.option.earningOption.amount} ${ce.formattedType(e.option.collectibleType)}`;
258
+ }
259
+ },
260
+ {
261
+ header: n("connect.storeRewards.table.actions"),
262
+ cell(e) {
263
+ return O("div", { class: "flex items-center justify-end gap-4" }, [
264
+ O(
265
+ L.FmMenu,
266
+ {
267
+ placement: "bottom-end",
268
+ onClick: (o) => {
269
+ o.stopPropagation();
270
+ }
271
+ },
272
+ {
273
+ "menu-button": () => O(L.FmButton, {
274
+ icon: "more_vert",
275
+ iconColor: "neutral-gray-400",
276
+ variant: "tertiary"
277
+ }),
278
+ default: () => [
279
+ e.row.original.option.type === "VOUCHER" && O(L.FmMenuItem, {
280
+ label: "View collections",
281
+ onClick: async (o) => {
282
+ o.stopPropagation(), D(
283
+ e.row.original.option.collectible
284
+ );
285
+ }
286
+ }),
287
+ O(
288
+ L.FmMenuItem,
289
+ {
290
+ onClick: async (o) => {
291
+ o.stopPropagation(), $(e.row.original);
292
+ }
293
+ },
294
+ {
295
+ label: O(
296
+ "div",
297
+ {
298
+ class: "text-fm-color-typo-error fm-typo-en-body-md-400"
299
+ },
300
+ "Delete"
301
+ )
302
+ }
303
+ )
304
+ ]
305
+ }
306
+ )
307
+ ]);
308
+ }
309
+ }
310
+ ], T = x();
311
+ async function $(e) {
312
+ await te.remove(
313
+ n("connect.storeRewards.delete.confirm"),
314
+ n("connect.storeRewards.delete.title")
315
+ ) && await a(
316
+ async () => {
317
+ await P.deleteReward(e._id), await C.readRewards();
318
+ },
319
+ {
320
+ message: n("connect.storeRewards.delete.message"),
321
+ successMessage: n("connect.storeRewards.delete.success")
322
+ }
323
+ );
324
+ }
325
+ async function V(e) {
326
+ var o;
327
+ e || (e = {
328
+ name: "",
329
+ option: {
330
+ type: "LOYALTY",
331
+ collectible: p.loyaltyRewards.items[0].value,
332
+ collectibleType: p.loyaltyRewards.items[0].raw.type,
333
+ validityOption: {
334
+ validForDay: 7
335
+ },
336
+ earningOption: {
337
+ type: "FIXED",
338
+ amount: 1
339
+ }
340
+ }
341
+ }), (o = T.value) == null || o.showSheet(!0, ae(e));
342
+ }
343
+ async function l(e) {
344
+ let o = !1;
345
+ e._id && e.option.type === "VOUCHER" && await new Promise((i) => {
346
+ R.open({
347
+ title: "Confirmation",
348
+ message: "This will change all future vouchers? Would you like to update previous claimed vouchers expiry date and discount?",
349
+ primaryActions: { text: "Update all", close: !0 },
350
+ secondaryActions: { text: "Update future only", close: !0 }
351
+ }).onPrimary(async () => {
352
+ o = !0, i();
353
+ }).onSecondary(async () => {
354
+ i();
355
+ });
356
+ }), await a(
357
+ async () => {
358
+ var i;
359
+ e.collectibleConfig = void 0, e._id ? await P.updateReward(e._id, {
360
+ ...e,
361
+ updateCollection: o
362
+ }) : await P.createReward(e), await C.readRewards(), (i = T.value) == null || i.showSheet(!1);
363
+ },
364
+ {
365
+ message: "Updating reward",
366
+ successMessage: "Reward updated successfully"
367
+ }
368
+ );
369
+ }
370
+ return q(async () => {
371
+ await v(async () => {
372
+ await p.readMembership(), await p.readRewards(), await C.readRewards();
373
+ });
374
+ }), (e, o) => {
375
+ const i = w("FmPageHead"), m = w("FmSearch"), g = w("FmTable"), r = w("FmButton"), E = w("FmCard");
376
+ return b(), M(Y, null, [
377
+ d(i, {
378
+ title: t(n)("connect.reward.title"),
379
+ actions: [I],
380
+ "back-button": !0,
381
+ "onClick:action": o[0] || (o[0] = () => V()),
382
+ "onClick:back": o[1] || (o[1] = () => {
383
+ var c;
384
+ return (c = t(y)) == null ? void 0 : c.back();
385
+ })
386
+ }, null, 8, ["title", "actions"]),
387
+ f("div", ve, [
388
+ t(F) && t(F).length > 0 ? (b(), M(Y, { key: 0 }, [
389
+ f("div", ge, [
390
+ o[6] || (o[6] = f("div", { class: "flex gap-8" }, null, -1)),
391
+ d(m, {
392
+ modelValue: t(u).searchKey,
393
+ "onUpdate:modelValue": o[2] || (o[2] = (c) => t(u).searchKey = c),
394
+ class: "",
395
+ placeholder: "search",
396
+ collapsible: ""
397
+ }, null, 8, ["modelValue"])
398
+ ]),
399
+ d(g, {
400
+ "row-data": t(F),
401
+ "column-defs": S,
402
+ "search-value": t(u).searchKey,
403
+ "column-filter": t(u).columnFilters,
404
+ onRowClick: o[3] || (o[3] = (c) => V(c.original)),
405
+ "hide-footer": t(F).length < 10
406
+ }, null, 8, ["row-data", "search-value", "column-filter", "hide-footer"])
407
+ ], 64)) : (b(), h(E, {
408
+ key: 1,
409
+ variant: "outlined",
410
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
411
+ }, {
412
+ default: A(() => [
413
+ o[7] || (o[7] = f("img", {
414
+ src: z,
415
+ class: "aspect-square w-[150px]"
416
+ }, null, -1)),
417
+ f("div", be, [
418
+ f("div", Re, B(t(n)("connect.storeRewards.empty.title")), 1),
419
+ f("div", Ce, B(t(n)("connect.storeRewards.empty.description")), 1)
420
+ ]),
421
+ d(r, {
422
+ variant: "primary",
423
+ label: t(n)("connect.storeRewards.empty.action"),
424
+ onClick: o[4] || (o[4] = (c) => V()),
425
+ icon: "add"
426
+ }, null, 8, ["label"])
427
+ ]),
428
+ _: 1
429
+ })),
430
+ d(we, {
431
+ ref_key: "rewardSheetRef",
432
+ ref: T,
433
+ onUpdate: o[5] || (o[5] = (c) => l(c))
434
+ }, null, 512)
435
+ ])
436
+ ], 64);
437
+ };
438
+ }
439
+ });
440
+ export {
441
+ Ke as default
442
+ };
@@ -0,0 +1,150 @@
1
+ import { ref as p, defineComponent as T, computed as x, resolveComponent as y, openBlock as U, createBlock as G, unref as e, isRef as $, withCtx as b, createElementVNode as v, createVNode as u, toDisplayString as j } from "vue";
2
+ import { u as B } from "./loading-B8zghYbj.js";
3
+ import { J as P } from "./JsonViewer-v8_C7l5N.js";
4
+ import { _ as D } from "./ZodTextField.vue_vue_type_script_setup_true_lang-ms40eptZ.js";
5
+ import { _ as I } from "./UserRuleGroup.vue_vue_type_script_setup_true_lang-Cwi0mvC3.js";
6
+ import { Z as L } from "./zod-Bg2FbC-D.js";
7
+ import { u as V } from "./app-wDQR6dpb.js";
8
+ import { defineStore as N } from "pinia";
9
+ import { r as k } from "./index-DrE9VkxR.js";
10
+ import { c as E } from "./index-ghSGvG-m.js";
11
+ import "./index-CPRN3irj.js";
12
+ import "./index-OScGm4mF.js";
13
+ import "./index-C3lpXz_P.js";
14
+ import "./index-EOPRlB9V.js";
15
+ import "./plugins-B5mQ7CHT.js";
16
+ import { u as J } from "./vue-i18n-BG2U7GtN.js";
17
+ import { c as C } from "./object-qECH92oz.js";
18
+ import { useDialog as Z } from "@feedmepos/ui-library";
19
+ const A = N("mf-connect-referral", () => {
20
+ const h = p();
21
+ return {
22
+ readReferralProgram: async () => {
23
+ const c = await k.read();
24
+ h.value = c;
25
+ },
26
+ referralProgram: h
27
+ };
28
+ }), H = { class: "flex flex-col space-y-16 pr-12" }, M = { class: "fm-typo-en-title-sm-800" }, O = { class: "flex items-center gap-8" }, W = /* @__PURE__ */ T({
29
+ __name: "EditReferralTierSheet",
30
+ emits: ["update"],
31
+ setup(h, { expose: _, emit: c }) {
32
+ const { t: n } = J(), m = c, s = p(!1), a = p({}), i = p(-1), w = A(), o = E.superRefine((r, t) => {
33
+ r.name.length >= 50 && t.addIssue({
34
+ code: "custom",
35
+ message: "Name must be less than 50 characters"
36
+ });
37
+ }), l = x(() => {
38
+ const r = o.safeParse(a.value);
39
+ return r.success ? [] : r.error.errors;
40
+ });
41
+ function R() {
42
+ const r = o.safeParse(a.value);
43
+ r.success && m("update", i.value, r.data);
44
+ }
45
+ function d(r, t) {
46
+ var f;
47
+ s.value = r, r && typeof t == "number" && t >= 0 ? (i.value = t, a.value = C(
48
+ (f = w.referralProgram) == null ? void 0 : f.reward[t]
49
+ )) : (i.value = -1, a.value = {
50
+ id: (/* @__PURE__ */ new Date()).toISOString(),
51
+ name: "",
52
+ rewards: [],
53
+ rule: void 0
54
+ });
55
+ }
56
+ function g(r) {
57
+ a.value.rule = r;
58
+ }
59
+ return _({
60
+ showSheet: d,
61
+ data: a
62
+ }), (r, t) => {
63
+ const f = y("FmButton"), F = y("FmSideSheet");
64
+ return U(), G(F, {
65
+ "max-width": 1e3,
66
+ modelValue: e(s),
67
+ "onUpdate:modelValue": t[2] || (t[2] = (S) => $(s) ? s.value = S : null),
68
+ header: `${e(i) == -1 ? e(n)("connect.referral.editReferralTierSheet.create") : e(n)("connect.referral.editReferralTierSheet.edit")}`
69
+ }, {
70
+ "side-sheet-footer": b(() => [
71
+ v("div", O, [
72
+ u(f, {
73
+ label: e(n)("connect.editTierSheet.submit"),
74
+ onClick: R,
75
+ disabled: e(l).length > 0 || e(V)().isLoading,
76
+ loading: e(V)().isLoading
77
+ }, null, 8, ["label", "disabled", "loading"]),
78
+ u(f, {
79
+ label: e(n)("connect.editTierSheet.cancel"),
80
+ onClick: t[1] || (t[1] = (S) => d(!1)),
81
+ variant: "tertiary"
82
+ }, null, 8, ["label"])
83
+ ])
84
+ ]),
85
+ default: b(() => [
86
+ u(P, { json: e(a) }, null, 8, ["json"]),
87
+ u(P, { json: e(l) }, null, 8, ["json"]),
88
+ v("div", H, [
89
+ u(D, {
90
+ modelValue: e(a).name,
91
+ "onUpdate:modelValue": t[0] || (t[0] = (S) => e(a).name = S),
92
+ label: e(n)("connect.referral.editReferralTierSheet.name"),
93
+ schema: e(L).typeAtPath(e(o), "name")
94
+ }, null, 8, ["modelValue", "label", "schema"]),
95
+ v("div", M, j(e(n)("connect.referral.editReferralTierSheet.target_audience")), 1),
96
+ u(I, {
97
+ "model-value": e(a).rule,
98
+ "onUpdate:modelValue": g
99
+ }, null, 8, ["model-value"])
100
+ ])
101
+ ]),
102
+ _: 1
103
+ }, 8, ["modelValue", "header"]);
104
+ };
105
+ }
106
+ }), de = /* @__PURE__ */ T({
107
+ __name: "RewardGroup",
108
+ setup(h, { expose: _ }) {
109
+ const { minor: c } = B, n = Z(), m = A(), s = x(() => {
110
+ var o;
111
+ return ((o = m.referralProgram) == null ? void 0 : o.reward) ?? [];
112
+ }), a = p(null);
113
+ function i(o) {
114
+ var l;
115
+ (l = a.value) == null || l.showSheet(!0, o);
116
+ }
117
+ _({
118
+ onManageRewardGroup: i
119
+ });
120
+ async function w(o, l) {
121
+ var r;
122
+ const R = o == -1 ? s.value.length : o, d = C(m.referralProgram);
123
+ d.reward[R] = l;
124
+ let g = !1;
125
+ await new Promise((t) => {
126
+ n.open({
127
+ title: "Confirmation",
128
+ message: "This will change all referral settings? Would you like to update previous referral record?",
129
+ primaryActions: { text: "Update all", close: !0 },
130
+ secondaryActions: { text: "Update future only", close: !0 }
131
+ }).onPrimary(async () => {
132
+ g = !0, t();
133
+ }).onSecondary(async () => {
134
+ t();
135
+ });
136
+ }), await c(async () => {
137
+ await k.update({ ...d, updateReferralRecord: g }), await m.readReferralProgram();
138
+ }), (r = a.value) == null || r.showSheet(!1);
139
+ }
140
+ return (o, l) => (U(), G(W, {
141
+ ref_key: "editReferralTierSheetRef",
142
+ ref: a,
143
+ onUpdate: w
144
+ }, null, 512));
145
+ }
146
+ });
147
+ export {
148
+ de as _,
149
+ A as u
150
+ };