@feedmepos/mf-connect 0.1.0-beta.2 → 0.1.0-beta.21

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 (97) hide show
  1. package/dist/Analytic-CZ8gfj2V.js +424 -0
  2. package/dist/{App-D8a5eW51.js → App-Da9h7lhI.js} +397 -384
  3. package/dist/{Broadcast-C8jgMe6g.js → Broadcast-m6ehTw7F.js} +32 -32
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-pG8WvV4I.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BTKA2Ygl.js} +8 -8
  5. package/dist/Card-DqZveZ44.js +685 -0
  6. package/dist/{Collections-lMrdPUuM.js → Collections-XIY6SLgQ.js} +4 -4
  7. package/dist/{Credit-CJfU5tP4.js → Credit-B6Yg3_al.js} +14 -14
  8. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +108 -0
  9. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-D1gub9ZP.js +2198 -0
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CzEtOmp0.js → EffectSheet.vue_vue_type_style_index_0_lang-tRUwA8zh.js} +8 -8
  11. package/dist/{Experience-Bp2ki8gU.js → Experience-CsoneWLZ.js} +8 -8
  12. package/dist/{Game-BpTf6ebE.js → Game-B029f9yE.js} +15 -15
  13. package/dist/Index-B2LvLfrR.js +226 -0
  14. package/dist/Marketing-DUTyDRXu.js +20070 -0
  15. package/dist/{Member-BSWyy32a.js → Member-CATybMaC.js} +4 -4
  16. package/dist/MemberList-DxvQ7DnC.js +1045 -0
  17. package/dist/{MemberTransactions-BzHiXCnp.js → MemberTransactions-fEZyBY9P.js} +1 -1
  18. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-e-zWg08J.js → MessageInput.vue_vue_type_script_setup_true_lang-BCCEsJZj.js} +2 -2
  19. package/dist/{Mission-8IGT3T2C.js → Mission-Cl3O0ULj.js} +16 -16
  20. package/dist/Overview-BVI2xGvT.js +1014 -0
  21. package/dist/{Point-CbbJ6ohd.js → Point-DSVn47pK.js} +23 -23
  22. package/dist/{Promotion-BYXCJa_S.js → Promotion-C4HyMpPg.js} +53 -47
  23. package/dist/Record-BSKXwUu2.js +187 -0
  24. package/dist/Reward-Cus20Wq5.js +399 -0
  25. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-Dm6Vgx8-.js +151 -0
  26. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CqMCdTsv.js +1597 -0
  27. package/dist/Segment-DAHJ2FYV.js +567 -0
  28. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-DpkIgpqy.js +181 -0
  29. package/dist/{Setting-CLpvvZTv.js → Setting-D7dKlTiZ.js} +8 -8
  30. package/dist/Store-DQdWn1Dw.js +1745 -0
  31. package/dist/{StoreRewards-CUM2irXK.js → StoreRewards-Cut9mJGn.js} +12 -12
  32. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BQscw_Di.js +957 -0
  33. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DEb4OBcX.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BVzz2Zkl.js} +1 -1
  34. package/dist/{Tier-DZTDxWBo.js → Tier-DGpNybHO.js} +15 -15
  35. package/dist/{Title-C2Dr5ceK.js → Title-D5y8GEwE.js} +15 -15
  36. package/dist/{Transaction-BL4mS29d.js → Transaction-CCnZouEv.js} +2 -2
  37. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Cr9DV7hr.js +130 -0
  38. package/dist/{Voucher-Cx0r2-df.js → Voucher-BJ6RC4SS.js} +31 -31
  39. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-6751WdaT.js +419 -0
  40. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DWuAODUF.js → ZodTextField.vue_vue_type_script_setup_true_lang-aq-9V3Gc.js} +1 -1
  41. package/dist/{app-wE5HTF_Y.js → app-D3chCumI.js} +1279 -1282
  42. package/dist/{app-B_xuZ5HB.js → app-PfWyqx7U.js} +1 -1
  43. package/dist/app.js +1 -1
  44. package/dist/{business-DSv8zM8C.js → business-trsrJyHK.js} +1 -1
  45. package/dist/{campaign-7y5qquHZ.js → campaign-B1rgdv77.js} +2 -2
  46. package/dist/collectible.enum-ZoD0ya1M.js +19 -0
  47. package/dist/{collection.fn-BxVZQAx0.js → collection.fn-CnQjdokW.js} +2 -2
  48. package/dist/{dto-Ew1QwLci.js → dto-DuJumvC2.js} +12 -20
  49. package/dist/{effect-BzPh8fRI.js → effect-CFYktLyZ.js} +9 -9
  50. package/dist/email-addresses-BocLAqLt.js +705 -0
  51. package/dist/{export-C9tDplkA.js → export-BDxbvd3c.js} +3 -3
  52. package/dist/{helper-Sz7oQ0F4.js → helper-Bx6u7f_W.js} +1 -1
  53. package/dist/{index-DH_1nOJ_.js → index-7QsBQpBM.js} +39 -35
  54. package/dist/{index-z0IfdrZk.js → index-AcoIUTDS.js} +203 -195
  55. package/dist/{index-C3_4GUiI.js → index-BAUe6Mqp.js} +7 -1
  56. package/dist/{index-C0lpADCo.js → index-C20tnKDo.js} +1 -1
  57. package/dist/{index-C-SOz7jt.js → index-CDgSJNKm.js} +1 -1
  58. package/dist/{index-DBMaUGYI.js → index-CTnZ9dt0.js} +30 -26
  59. package/dist/index-CUMB0mpB.js +28997 -0
  60. package/dist/index-CsF6BSZU.js +1067 -0
  61. package/dist/index-CsaQJMAR.js +66 -0
  62. package/dist/{index-tv4t0Pnh.js → index-DwXHEi0X.js} +1 -1
  63. package/dist/{index-_3qBsogG.js → index-ZXWgygOr.js} +1500 -1479
  64. package/dist/index-_v_LQTuR.js +53 -0
  65. package/dist/index-kLMiwwB-.js +38 -0
  66. package/dist/{index-gIRszcHf.js → index-pRpTA8Kd.js} +1 -1
  67. package/dist/{index.esm2017-BnKJDxUo.js → index.esm2017-DuOZ7nuk.js} +33 -33
  68. package/dist/{loading-Ds-yFYhc.js → loading-BTEwnG5-.js} +591 -597
  69. package/dist/{membership-DaiVw9qF.js → membership-DkH7qw6W.js} +51 -43
  70. package/dist/money-BfCdj0Ts.js +15 -0
  71. package/dist/number-BKHcstZb.js +12 -0
  72. package/dist/objectid-CumRza_j.js +145 -0
  73. package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
  74. package/dist/reward-DpR3xoxT.js +36 -0
  75. package/dist/{rule-Cd2M6Ri2.js → rule-Hb9_sJvP.js} +180 -177
  76. package/dist/{rule-builder-B6og27Q1.js → rule-builder-BhwlX4fv.js} +1 -1
  77. package/dist/style.css +1 -1
  78. package/dist/{template-DouRWBpv.js → template-PkDFDppy.js} +5 -5
  79. package/dist/trigger-vLHrldAH.js +114 -0
  80. package/dist/{vue-i18n-BTlOChXs.js → vue-i18n-ComnFt3O.js} +2 -2
  81. package/dist/{xlsx-SahfXQ70.js → xlsx-CsUJ1mq4.js} +1 -1
  82. package/package.json +8 -7
  83. package/dist/Analytic-DSD9TsKr.js +0 -622
  84. package/dist/Card-C1K7ULPo.js +0 -825
  85. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BYoaa_-x.js +0 -2809
  86. package/dist/Marketing-BiKE2gxA.js +0 -316
  87. package/dist/MemberList-CHlGREyR.js +0 -1733
  88. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Bruh-umZ.js +0 -1753
  89. package/dist/Segment-DXDNM0yd.js +0 -437
  90. package/dist/Store-C6-P6bwc.js +0 -1511
  91. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-JaRdmqif.js +0 -890
  92. package/dist/index-BQm0C3Jm.js +0 -298
  93. package/dist/index-CuvNtC_M.js +0 -61
  94. package/dist/index-D-2nFLsg.js +0 -762
  95. package/dist/index-Dy4pmQpt.js +0 -29193
  96. package/dist/money-BHtBdZoz.js +0 -15
  97. package/dist/number-CZhcB8ef.js +0 -12
@@ -0,0 +1,399 @@
1
+ import { defineComponent as N, ref as C, computed as K, resolveComponent as p, openBlock as y, createBlock as V, unref as t, isRef as q, withCtx as h, createElementVNode as c, createVNode as i, createCommentVNode as U, createElementBlock as I, Fragment as H, h as x, onMounted as W, toDisplayString as $ } from "vue";
2
+ import { _ as z } from "./campaign-CpzFl8Vr.js";
3
+ import { useDialog as G, components as Y } from "@feedmepos/ui-library";
4
+ import { f as B, u as X, p as Q } from "./loading-BTEwnG5-.js";
5
+ import { u as J, C as ee } from "./membership-DkH7qw6W.js";
6
+ import { u as te } from "./vue-i18n-ComnFt3O.js";
7
+ import { c as oe } from "./object-qECH92oz.js";
8
+ import { Z as O } from "./zod-Bg2FbC-D.js";
9
+ import "./index-ZXWgygOr.js";
10
+ import { a as ae } from "./index-_v_LQTuR.js";
11
+ import { useCoreStore as ne } from "@feedmepos/mf-common";
12
+ import { _ as le, a as ie } from "./VoucherEditor.vue_vue_type_script_setup_true_lang-6751WdaT.js";
13
+ import { _ as re } from "./EffectSheet.vue_vue_type_style_index_0_lang-tRUwA8zh.js";
14
+ import { J as j } from "./JsonViewer-v8_C7l5N.js";
15
+ import { _ as se } from "./ZodTextField.vue_vue_type_script_setup_true_lang-aq-9V3Gc.js";
16
+ import { i as de } from "./helper-Bx6u7f_W.js";
17
+ import { u as me, r as D } from "./reward-DpR3xoxT.js";
18
+ import { useRouter as ce } from "vue-router";
19
+ const pe = { class: "flex gap-8 items-center justify-start" }, ue = /* @__PURE__ */ N({
20
+ __name: "EditRewardSheet",
21
+ props: {},
22
+ emits: ["update"],
23
+ setup(Z, { expose: n, emit: k }) {
24
+ const u = J(), { minor: g } = X, f = C(!1), a = C({}), w = C(), v = ae, m = K(() => {
25
+ const o = v.safeParse(a.value);
26
+ return o.success ? [] : o.error.errors;
27
+ });
28
+ function b(o, e) {
29
+ o && (a.value = e), f.value = o;
30
+ }
31
+ const T = k;
32
+ async function R() {
33
+ const o = v.safeParse(a.value);
34
+ !o.success || !o.data || (await g(
35
+ async () => {
36
+ var e;
37
+ o.data.option.type === "VOUCHER" && w.value && (o.data.option.collectibleConfig.image = await B.update(
38
+ ((e = o.data.option.collectibleConfig) == null ? void 0 : e.image) || B.collectibleImagePath(void 0, w.value),
39
+ w.value
40
+ ));
41
+ },
42
+ {
43
+ message: "Uploading reward image",
44
+ successMessage: "Reward image updated"
45
+ }
46
+ ), T("update", o.data));
47
+ }
48
+ function E(o) {
49
+ o === "VOUCHER" ? a.value.option = {
50
+ collectible: null,
51
+ type: "VOUCHER",
52
+ collectibleConfig: de("VOUCHER", {
53
+ business: ne().currentBusiness.value._id
54
+ }),
55
+ earningOption: {
56
+ amount: 1,
57
+ type: "FIXED"
58
+ },
59
+ validityOption: {
60
+ validForDay: 30
61
+ }
62
+ } : a.value.option = {
63
+ collectible: u.loyaltyRewards.raw[0]._id,
64
+ collecitbleType: u.loyaltyRewards.raw[0].type,
65
+ type: "LOYALTY",
66
+ earningOption: {
67
+ amount: 1,
68
+ type: "FIXED"
69
+ },
70
+ validityOption: {
71
+ validForDay: 30
72
+ }
73
+ };
74
+ }
75
+ function F(o) {
76
+ a.value.option.collectible = o;
77
+ }
78
+ const L = C();
79
+ return n({
80
+ showSheet: b
81
+ }), (o, e) => {
82
+ const d = p("FmSelect"), A = p("FmForm"), S = p("FmButton"), P = p("FmSideSheet");
83
+ return y(), V(P, {
84
+ "max-width": 560,
85
+ modelValue: t(f),
86
+ "onUpdate:modelValue": [
87
+ e[8] || (e[8] = (s) => q(f) ? f.value = s : null),
88
+ e[9] || (e[9] = (s) => f.value = s)
89
+ ],
90
+ header: "Edit reward"
91
+ }, {
92
+ "side-sheet-footer": h(() => [
93
+ c("div", pe, [
94
+ i(S, {
95
+ variant: "primary",
96
+ type: "button",
97
+ label: "Confirm",
98
+ disabled: t(m).length > 0,
99
+ onClick: e[6] || (e[6] = (s) => R())
100
+ }, null, 8, ["disabled"]),
101
+ i(S, {
102
+ variant: "secondary",
103
+ type: "button",
104
+ label: "Cancel",
105
+ onClick: e[7] || (e[7] = (s) => f.value = !1)
106
+ })
107
+ ])
108
+ ]),
109
+ default: h(() => [
110
+ i(j, { json: t(a) }, null, 8, ["json"]),
111
+ i(A, {
112
+ class: "flex flex-col gap-y-24",
113
+ ref_key: "formRef",
114
+ ref: L,
115
+ onValidationSuccess: e[5] || (e[5] = (s) => R())
116
+ }, {
117
+ default: h(() => {
118
+ var s, r, M;
119
+ return [
120
+ i(se, {
121
+ modelValue: t(a).name,
122
+ "onUpdate:modelValue": e[0] || (e[0] = (l) => t(a).name = l),
123
+ label: "Reward Name",
124
+ schema: t(O).typeAtPath(t(v), "name", [])
125
+ }, null, 8, ["modelValue", "schema"]),
126
+ i(d, {
127
+ label: "Reward Type",
128
+ items: [
129
+ { label: "Voucher", value: "VOUCHER" },
130
+ { label: "Loyalty", value: "LOYALTY" }
131
+ ],
132
+ "model-value": t(a).option.type,
133
+ "onUpdate:modelValue": E
134
+ }, null, 8, ["model-value"]),
135
+ t(a).option.type == "LOYALTY" ? (y(), V(d, {
136
+ key: 0,
137
+ label: "Loyalty type",
138
+ items: t(u).loyaltyRewards.items,
139
+ "model-value": t(a).option.collectible,
140
+ "onUpdate:modelValue": F
141
+ }, null, 8, ["items", "model-value"])) : U("", !0),
142
+ t(a).option.type === "LOYALTY" ? (y(), I(H, { key: 1 }, [
143
+ e[10] || (e[10] = c("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
144
+ ((s = t(u).loyaltyRewards.items.find(
145
+ (l) => {
146
+ var _;
147
+ return l.value === ((_ = t(a)) == null ? void 0 : _.option.collectible);
148
+ }
149
+ )) == null ? void 0 : s.raw.type) !== "TITLE" ? (y(), V(le, {
150
+ key: 0,
151
+ class: "mt-[-8px]",
152
+ rules: [
153
+ t(O).ruleAtPath(t(v), "option.earningOption", [
154
+ t(a).option.type
155
+ ])
156
+ ],
157
+ "helper-state": t(O).helperState(t(m), "option.earningOption"),
158
+ "error-text": t(O).helperText(t(m), "option.earningOption"),
159
+ "fixed-type": !0,
160
+ "model-value": t(a).option.earningOption,
161
+ "onUpdate:modelValue": e[1] || (e[1] = (l) => t(a).option.earningOption = l)
162
+ }, null, 8, ["rules", "helper-state", "error-text", "model-value"])) : U("", !0),
163
+ i(re, {
164
+ class: "!gap-24",
165
+ "for-credit": t(a).option.type === "LOYALTY" && ((r = t(u).loyaltyRewards.items.find(
166
+ (l) => {
167
+ var _;
168
+ return l.value === ((_ = t(a).option) == null ? void 0 : _.collectible);
169
+ }
170
+ )) == null ? void 0 : r.raw.type) === "CREDIT",
171
+ rules: [
172
+ t(O).ruleAtPath(t(v), "option.validityOption", [
173
+ t(a).option.type
174
+ ])
175
+ ],
176
+ "model-value": t(a).option.validityOption,
177
+ "onUpdate:modelValue": e[2] || (e[2] = (l) => t(a).option.validityOption = l)
178
+ }, null, 8, ["for-credit", "rules", "model-value"])
179
+ ], 64)) : U("", !0),
180
+ t(a).option.type === "VOUCHER" ? (y(), V(ie, {
181
+ key: 2,
182
+ "reward-image": t(w),
183
+ "model-value": ((M = t(a)) == null ? void 0 : M.option.collectibleConfig) ?? void 0,
184
+ "onUpdate:modelValue": e[3] || (e[3] = (l) => t(a).option.collectibleConfig = l),
185
+ "onUpdate:rewardImage": e[4] || (e[4] = (l) => w.value = l)
186
+ }, null, 8, ["reward-image", "model-value"])) : U("", !0),
187
+ i(j, { json: t(m) }, null, 8, ["json"])
188
+ ];
189
+ }),
190
+ _: 1
191
+ }, 512)
192
+ ]),
193
+ _: 1
194
+ }, 8, ["modelValue"]);
195
+ };
196
+ }
197
+ }), fe = { class: "px-24 flex flex-col gap-y-16" }, ye = { class: "flex items-center justify-between w-full" }, we = { class: "flex flex-col gap-16 text-center" }, ve = { class: "fm-typo-en-title-sm-800" }, ge = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, De = /* @__PURE__ */ N({
198
+ __name: "Reward",
199
+ setup(Z) {
200
+ const { t: n } = te(), k = {
201
+ label: n("connect.storeRewards.create"),
202
+ value: "create",
203
+ isPrimary: !0,
204
+ prependIcon: "add"
205
+ }, u = J(), g = me(), { global: f, minor: a } = X, w = ce(), v = G(), m = C({
206
+ searchKey: "",
207
+ columnFilters: []
208
+ }), b = K(() => g.rewards), T = [
209
+ {
210
+ header: n("connect.storeRewards.table.name"),
211
+ accessorFn: (o) => o.name
212
+ },
213
+ {
214
+ header: n("connect.storeRewards.table.type"),
215
+ cell(o) {
216
+ return o.row.original.collectibleConfig ? ee[o.row.original.collectibleConfig.type].chip() : "N/A";
217
+ }
218
+ },
219
+ {
220
+ header: n("connect.storeRewards.table.actions"),
221
+ cell(o) {
222
+ return x("div", { class: "flex items-center justify-end gap-4" }, [
223
+ x(
224
+ Y.FmMenu,
225
+ {
226
+ placement: "bottom-end",
227
+ onClick: (e) => {
228
+ e.stopPropagation();
229
+ }
230
+ },
231
+ {
232
+ "menu-button": () => x(Y.FmButton, {
233
+ icon: "more_vert",
234
+ iconColor: "neutral-gray-400",
235
+ variant: "tertiary"
236
+ }),
237
+ default: () => [
238
+ // h(components.FmMenuItem, {
239
+ // label: 'View collections',
240
+ // onClick: async (event: Event) => {
241
+ // event.stopPropagation();
242
+ // onViewCollection(props.row.original._id as string);
243
+ // },
244
+ // }),
245
+ x(
246
+ Y.FmMenuItem,
247
+ {
248
+ onClick: async (e) => {
249
+ e.stopPropagation(), E(o.row.original);
250
+ }
251
+ },
252
+ {
253
+ label: x(
254
+ "div",
255
+ {
256
+ class: "text-fm-color-typo-error fm-typo-en-body-md-400"
257
+ },
258
+ "Delete"
259
+ )
260
+ }
261
+ )
262
+ ]
263
+ }
264
+ )
265
+ ]);
266
+ }
267
+ }
268
+ ], R = C();
269
+ async function E(o) {
270
+ await Q.remove(
271
+ n("connect.storeRewards.delete.confirm"),
272
+ n("connect.storeRewards.delete.title")
273
+ ) && await a(
274
+ async () => {
275
+ await D.deleteReward(o._id), await g.readRewards();
276
+ },
277
+ {
278
+ message: n("connect.storeRewards.delete.message"),
279
+ successMessage: n("connect.storeRewards.delete.success")
280
+ }
281
+ );
282
+ }
283
+ async function F(o) {
284
+ var e;
285
+ o || (o = {
286
+ name: "",
287
+ option: {
288
+ type: "LOYALTY",
289
+ collectible: u.loyaltyRewards.items[0].value,
290
+ validityOption: {
291
+ validForDay: 7
292
+ },
293
+ earningOption: {
294
+ type: "FIXED",
295
+ amount: 1
296
+ }
297
+ }
298
+ }), (e = R.value) == null || e.showSheet(!0, oe(o));
299
+ }
300
+ async function L(o) {
301
+ let e = !1;
302
+ o._id && o.option.type === "VOUCHER" && await new Promise((d) => {
303
+ v.open({
304
+ title: "Confirmation",
305
+ message: "This will change all future vouchers? Would you like to update previous claimed vouchers expiry date and discount?",
306
+ primaryActions: { text: "Update all", close: !0 },
307
+ secondaryActions: { text: "Update future only", close: !0 }
308
+ }).onPrimary(async () => {
309
+ e = !0, d();
310
+ }).onSecondary(async () => {
311
+ d();
312
+ });
313
+ }), await a(
314
+ async () => {
315
+ var d;
316
+ o.collectibleConfig = void 0, o._id ? await D.updateReward(o._id, {
317
+ ...o,
318
+ updateCollection: e
319
+ }) : await D.createReward(o), await g.readRewards(), (d = R.value) == null || d.showSheet(!1);
320
+ },
321
+ {
322
+ message: "Updating reward",
323
+ successMessage: "Reward updated successfully"
324
+ }
325
+ );
326
+ }
327
+ return W(async () => {
328
+ await f(async () => {
329
+ await u.readRewards(), await g.readRewards();
330
+ });
331
+ }), (o, e) => {
332
+ const d = p("FmPageHead"), A = p("FmSearch"), S = p("FmTable"), P = p("FmButton"), s = p("FmCard");
333
+ return y(), I(H, null, [
334
+ i(d, {
335
+ title: t(n)("connect.reward.title"),
336
+ actions: [k],
337
+ "back-button": !0,
338
+ "onClick:action": e[0] || (e[0] = () => F()),
339
+ "onClick:back": e[1] || (e[1] = () => {
340
+ var r;
341
+ return (r = t(w)) == null ? void 0 : r.back();
342
+ })
343
+ }, null, 8, ["title", "actions"]),
344
+ c("div", fe, [
345
+ t(b) && t(b).length > 0 ? (y(), I(H, { key: 0 }, [
346
+ c("div", ye, [
347
+ e[6] || (e[6] = c("div", { class: "flex gap-8" }, null, -1)),
348
+ i(A, {
349
+ modelValue: t(m).searchKey,
350
+ "onUpdate:modelValue": e[2] || (e[2] = (r) => t(m).searchKey = r),
351
+ class: "",
352
+ placeholder: "search",
353
+ collapsible: ""
354
+ }, null, 8, ["modelValue"])
355
+ ]),
356
+ i(S, {
357
+ "row-data": t(b),
358
+ "column-defs": T,
359
+ "search-value": t(m).searchKey,
360
+ "column-filter": t(m).columnFilters,
361
+ onRowClick: e[3] || (e[3] = (r) => F(r.original)),
362
+ "hide-footer": t(b).length < 10
363
+ }, null, 8, ["row-data", "search-value", "column-filter", "hide-footer"])
364
+ ], 64)) : (y(), V(s, {
365
+ key: 1,
366
+ variant: "outlined",
367
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
368
+ }, {
369
+ default: h(() => [
370
+ e[7] || (e[7] = c("img", {
371
+ src: z,
372
+ class: "aspect-square w-[150px]"
373
+ }, null, -1)),
374
+ c("div", we, [
375
+ c("div", ve, $(t(n)("connect.storeRewards.empty.title")), 1),
376
+ c("div", ge, $(t(n)("connect.storeRewards.empty.description")), 1)
377
+ ]),
378
+ i(P, {
379
+ variant: "primary",
380
+ label: t(n)("connect.storeRewards.empty.action"),
381
+ onClick: e[4] || (e[4] = (r) => F()),
382
+ icon: "add"
383
+ }, null, 8, ["label"])
384
+ ]),
385
+ _: 1
386
+ })),
387
+ i(ue, {
388
+ ref_key: "rewardSheetRef",
389
+ ref: R,
390
+ onUpdate: e[5] || (e[5] = (r) => L(r))
391
+ }, null, 512)
392
+ ])
393
+ ], 64);
394
+ };
395
+ }
396
+ });
397
+ export {
398
+ De as default
399
+ };
@@ -0,0 +1,151 @@
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-BTEwnG5-.js";
3
+ import { J as P } from "./JsonViewer-v8_C7l5N.js";
4
+ import { _ as D } from "./ZodTextField.vue_vue_type_script_setup_true_lang-aq-9V3Gc.js";
5
+ import { _ as I } from "./UserRuleGroup.vue_vue_type_script_setup_true_lang-Cr9DV7hr.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-kLMiwwB-.js";
10
+ import "./index-CTnZ9dt0.js";
11
+ import "./index-ZXWgygOr.js";
12
+ import "./index-CsF6BSZU.js";
13
+ import "./index-7QsBQpBM.js";
14
+ import { c as E } from "./index-AcoIUTDS.js";
15
+ import "./index-C20tnKDo.js";
16
+ import "./index-_v_LQTuR.js";
17
+ import { u as J } from "./vue-i18n-ComnFt3O.js";
18
+ import { c as C } from "./object-qECH92oz.js";
19
+ import { useDialog as Z } from "@feedmepos/ui-library";
20
+ const A = N("mf-connect-referral", () => {
21
+ const h = p();
22
+ return {
23
+ readReferralProgram: async () => {
24
+ const c = await k.read();
25
+ h.value = c;
26
+ },
27
+ referralProgram: h
28
+ };
29
+ }), 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({
30
+ __name: "EditReferralTierSheet",
31
+ emits: ["update"],
32
+ setup(h, { expose: _, emit: c }) {
33
+ const { t: n } = J(), m = c, s = p(!1), a = p({}), i = p(-1), w = A(), o = E.superRefine((r, t) => {
34
+ r.name.length >= 50 && t.addIssue({
35
+ code: "custom",
36
+ message: "Name must be less than 50 characters"
37
+ });
38
+ }), l = x(() => {
39
+ const r = o.safeParse(a.value);
40
+ return r.success ? [] : r.error.errors;
41
+ });
42
+ function R() {
43
+ const r = o.safeParse(a.value);
44
+ r.success && m("update", i.value, r.data);
45
+ }
46
+ function d(r, t) {
47
+ var f;
48
+ s.value = r, r && typeof t == "number" && t >= 0 ? (i.value = t, a.value = C(
49
+ (f = w.referralProgram) == null ? void 0 : f.reward[t]
50
+ )) : (i.value = -1, a.value = {
51
+ id: (/* @__PURE__ */ new Date()).toISOString(),
52
+ name: "",
53
+ rewards: [],
54
+ rule: void 0
55
+ });
56
+ }
57
+ function g(r) {
58
+ a.value.rule = r;
59
+ }
60
+ return _({
61
+ showSheet: d,
62
+ data: a
63
+ }), (r, t) => {
64
+ const f = y("FmButton"), F = y("FmSideSheet");
65
+ return U(), G(F, {
66
+ "max-width": 1e3,
67
+ modelValue: e(s),
68
+ "onUpdate:modelValue": t[2] || (t[2] = (S) => $(s) ? s.value = S : null),
69
+ header: `${e(i) == -1 ? e(n)("connect.referral.editReferralTierSheet.create") : e(n)("connect.referral.editReferralTierSheet.edit")}`
70
+ }, {
71
+ "side-sheet-footer": b(() => [
72
+ v("div", O, [
73
+ u(f, {
74
+ label: e(n)("connect.editTierSheet.submit"),
75
+ onClick: R,
76
+ disabled: e(l).length > 0 || e(V)().isLoading,
77
+ loading: e(V)().isLoading
78
+ }, null, 8, ["label", "disabled", "loading"]),
79
+ u(f, {
80
+ label: e(n)("connect.editTierSheet.cancel"),
81
+ onClick: t[1] || (t[1] = (S) => d(!1)),
82
+ variant: "tertiary"
83
+ }, null, 8, ["label"])
84
+ ])
85
+ ]),
86
+ default: b(() => [
87
+ u(P, { json: e(a) }, null, 8, ["json"]),
88
+ u(P, { json: e(l) }, null, 8, ["json"]),
89
+ v("div", H, [
90
+ u(D, {
91
+ modelValue: e(a).name,
92
+ "onUpdate:modelValue": t[0] || (t[0] = (S) => e(a).name = S),
93
+ label: e(n)("connect.referral.editReferralTierSheet.name"),
94
+ schema: e(L).typeAtPath(e(o), "name")
95
+ }, null, 8, ["modelValue", "label", "schema"]),
96
+ v("div", M, j(e(n)("connect.referral.editReferralTierSheet.target_audience")), 1),
97
+ u(I, {
98
+ "model-value": e(a).rule,
99
+ "onUpdate:modelValue": g
100
+ }, null, 8, ["model-value"])
101
+ ])
102
+ ]),
103
+ _: 1
104
+ }, 8, ["modelValue", "header"]);
105
+ };
106
+ }
107
+ }), fe = /* @__PURE__ */ T({
108
+ __name: "RewardGroup",
109
+ setup(h, { expose: _ }) {
110
+ const { minor: c } = B, n = Z(), m = A(), s = x(() => {
111
+ var o;
112
+ return ((o = m.referralProgram) == null ? void 0 : o.reward) ?? [];
113
+ }), a = p(null);
114
+ function i(o) {
115
+ var l;
116
+ (l = a.value) == null || l.showSheet(!0, o);
117
+ }
118
+ _({
119
+ onManageRewardGroup: i
120
+ });
121
+ async function w(o, l) {
122
+ var r;
123
+ const R = o == -1 ? s.value.length : o, d = C(m.referralProgram);
124
+ d.reward[R] = l;
125
+ let g = !1;
126
+ await new Promise((t) => {
127
+ n.open({
128
+ title: "Confirmation",
129
+ message: "This will change all referral settings? Would you like to update previous referral record?",
130
+ primaryActions: { text: "Update all", close: !0 },
131
+ secondaryActions: { text: "Update future only", close: !0 }
132
+ }).onPrimary(async () => {
133
+ g = !0, t();
134
+ }).onSecondary(async () => {
135
+ t();
136
+ });
137
+ }), await c(async () => {
138
+ await k.update({ ...d, updateReferralRecord: g }), await m.readReferralProgram();
139
+ }), (r = a.value) == null || r.showSheet(!1);
140
+ }
141
+ return (o, l) => (U(), G(W, {
142
+ ref_key: "editReferralTierSheetRef",
143
+ ref: a,
144
+ onUpdate: w
145
+ }, null, 512));
146
+ }
147
+ });
148
+ export {
149
+ fe as _,
150
+ A as u
151
+ };