@feedmepos/mf-connect 0.1.0-beta.8 → 0.1.0-prod

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dist/Analytic-D1vIDmhJ.js +620 -0
  2. package/dist/{App-SRz4257n.js → App-DHrfWG8l.js} +249 -250
  3. package/dist/Broadcast-B2rxZAZi.js +216 -0
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CZXSxA9u.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D2a9rcXK.js} +20 -20
  5. package/dist/Card-Dr6pTTM0.js +824 -0
  6. package/dist/Collections-0tbg0MFt.js +441 -0
  7. package/dist/Credit-KbB_7Jq-.js +214 -0
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-Cuklmxur.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-we7ADwFk.js} +999 -1018
  9. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-VBNyvZCJ.js +344 -0
  10. package/dist/Experience-C_Q9Iml8.js +211 -0
  11. package/dist/Game-BwODw7M6.js +250 -0
  12. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-ByhTB9Ie.js +144 -0
  13. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js → MainLayout-DpZC6o3R.js} +53 -19
  14. package/dist/Marketing-QOKTAS_T.js +309 -0
  15. package/dist/Member-d7RIGRm1.js +92 -0
  16. package/dist/MemberList-CK9629ew.js +1737 -0
  17. package/dist/MemberOverview-C2n9oJZh.js +58 -0
  18. package/dist/{MemberTransactions-BwT3zE2a.js → MemberTransactions-D-pnlXiP.js} +1 -1
  19. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-3VS7JnK6.js +203 -0
  20. package/dist/Mission-BAKDm4VZ.js +248 -0
  21. package/dist/Point-Puu0jKz0.js +220 -0
  22. package/dist/Promotion-DRIaUvJi.js +244 -0
  23. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-BkFm7tXq.js → RuleGroup.vue_vue_type_script_setup_true_lang-DTdfYGya.js} +557 -557
  24. package/dist/Segment-DpBxGuuu.js +435 -0
  25. package/dist/Setting-DLB2ywCp.js +1870 -0
  26. package/dist/Store-8DO6ITWc.js +1513 -0
  27. package/dist/StoreRewards-DZfqUeYR.js +429 -0
  28. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-BqpsMcl1.js → StoreTransactions.vue_vue_type_script_setup_true_lang-RTfozD01.js} +10 -10
  29. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DrzmjYmU.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BGI78ycg.js} +1 -1
  30. package/dist/{Tier-CJ9-d8Zg.js → Tier-BnQRujpX.js} +453 -481
  31. package/dist/{Title-DZCpvg4q.js → Title-BPf1tUFx.js} +295 -314
  32. package/dist/Transaction-ese0oNrz.js +36 -0
  33. package/dist/Voucher--gtOZQx1.js +485 -0
  34. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js +140 -0
  35. package/dist/app-Bt59niI-.js +2974 -0
  36. package/dist/{app-Cg2pTZJK.js → app-DHE61XdR.js} +1 -1
  37. package/dist/app.js +3 -5
  38. package/dist/{business-Cw_qGw8y.js → business-BSo7EPan.js} +1 -1
  39. package/dist/{campaign-winsqufa.js → campaign-CsOje3Ap.js} +3 -5
  40. package/dist/{collection.fn-CI5Llblg.js → collection.fn-BYQfFJOr.js} +2 -2
  41. package/dist/dto-CfEXSCq6.js +1145 -0
  42. package/dist/{effect-CdkrIYgX.js → effect-Bn_ofYS3.js} +9 -9
  43. package/dist/{export-DGxfief1.js → export-CMR243CF.js} +3 -3
  44. package/dist/{helper-B8RqcTNu.js → helper-BqOQRtvW.js} +1 -1
  45. package/dist/index-BLDYTxnc.js +28058 -0
  46. package/dist/{index-Cw_aXFH6.js → index-BWnFs-Cb.js} +281 -299
  47. package/dist/{index-wzdbEEcZ.js → index-BaBNmzUb.js} +1 -1
  48. package/dist/{index-CjVmULNd.js → index-Boo5np6l.js} +1 -1
  49. package/dist/{index-HZC9LLAX.js → index-CC1GV8OW.js} +1 -1
  50. package/dist/{index-OzicErwL.js → index-CHO4_zsT.js} +1 -1
  51. package/dist/{index-DAEmawcj.js → index-DEZsrQ2f.js} +3 -3
  52. package/dist/{index-9w43_U1v.js → index-D_f2lmK2.js} +1 -1
  53. package/dist/{index-BaozRfWB.js → index-Da142OER.js} +66 -78
  54. package/dist/index-DbP04yeg.js +11 -0
  55. package/dist/{index-A34xEz20.js → index-DtPe-TEm.js} +3 -3
  56. package/dist/{index-BLACZ3-L.js → index-FvlaxwGB.js} +20 -20
  57. package/dist/{index.esm2017-CppSMh_U.js → index.esm2017-ePm--Atp.js} +55 -55
  58. package/dist/{loading-DuEFUCwF.js → loading-KNmEMBUB.js} +460 -469
  59. package/dist/{membership-nsMtWeTC.js → membership-DKoVIS1a.js} +3 -3
  60. package/dist/money-CkD3zl5C.js +15 -0
  61. package/dist/number-BDsGpOXm.js +12 -0
  62. package/dist/{rule-CPIMqt1h.js → rule-CzamI50_.js} +2 -2
  63. package/dist/{rule-builder-CSs5XRKP.js → rule-builder-DHf6wfaQ.js} +1 -1
  64. package/dist/style.css +1 -1
  65. package/dist/{template-CJZoYavu.js → template-CFAIPoD7.js} +63 -63
  66. package/dist/{usePagination-BeF5K3M7.js → usePagination-JoYaROkV.js} +85 -85
  67. package/dist/{xlsx-BZlnYinX.js → xlsx-BDJMaozs.js} +517 -517
  68. package/package.json +4 -7
  69. package/dist/Analytic-5QztrYSp.js +0 -622
  70. package/dist/Broadcast-DmkrJGp2.js +0 -223
  71. package/dist/Card-BsjFTVsH.js +0 -825
  72. package/dist/Collections-7wqZHOax.js +0 -453
  73. package/dist/Credit-CcNrq9qk.js +0 -220
  74. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-BIZDiLns.js +0 -345
  75. package/dist/Experience-DNsQLzDH.js +0 -221
  76. package/dist/Game-DlzDerT7.js +0 -255
  77. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js +0 -144
  78. package/dist/MainLayout-B1aJoR95.js +0 -41
  79. package/dist/Marketing-BqhpaG4o.js +0 -316
  80. package/dist/Member-AFgZcdtz.js +0 -69
  81. package/dist/MemberList-BKgrLz2C.js +0 -1733
  82. package/dist/MemberOverview-wL_ailso.js +0 -58
  83. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-GCEQCVOt.js +0 -432
  84. package/dist/Mission-BTAia7AS.js +0 -261
  85. package/dist/Point-Ck8EG_3k.js +0 -222
  86. package/dist/Promotion-0v3kvsK3.js +0 -247
  87. package/dist/Segment-BenLupqV.js +0 -437
  88. package/dist/Setting-0fpREqpJ.js +0 -1901
  89. package/dist/Store-BDGwe4ar.js +0 -1511
  90. package/dist/StoreRewards-TDZt9H1V.js +0 -401
  91. package/dist/Transaction-DpnTxlbf.js +0 -39
  92. package/dist/Voucher-DsP_rh8I.js +0 -490
  93. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-SukfoJpU.js +0 -56
  94. package/dist/app-DzAexOqx.js +0 -5639
  95. package/dist/dto-ozu1smC3.js +0 -2770
  96. package/dist/index-CZgQVRsm.js +0 -3
  97. package/dist/index-Oxr-mU6h.js +0 -29193
  98. package/dist/money-BGZPFtUc.js +0 -15
  99. package/dist/number-4J0xvXP9.js +0 -12
  100. package/dist/vue-i18n-CCyiVzOE.js +0 -2365
  101. package/dist/zod-Bg2FbC-D.js +0 -90
@@ -0,0 +1,344 @@
1
+ import { defineComponent as O, ref as R, onMounted as J, computed as z, resolveComponent as y, openBlock as s, createElementBlock as x, renderSlot as K, toDisplayString as S, createCommentVNode as f, createBlock as p, unref as e, isRef as H, createVNode as b, normalizeClass as q, watch as Q, withCtx as F, resolveDynamicComponent as k, Fragment as W, createElementVNode as A, createTextVNode as X } from "vue";
2
+ import { z as _ } from "./app-Bt59niI-.js";
3
+ import { Z as d } from "./ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js";
4
+ import { g as ee, h as te } from "./index-D_f2lmK2.js";
5
+ import { s as C } from "./effect-Bn_ofYS3.js";
6
+ import { p as le } from "./loading-KNmEMBUB.js";
7
+ import { I as oe } from "./app-DHE61XdR.js";
8
+ const ae = { class: "flex flex-col gap-8" }, ne = {
9
+ key: 0,
10
+ class: "fm-typo-en-body-lg-600"
11
+ }, se = { key: 1 }, ie = {
12
+ key: 2,
13
+ class: "space-y-16"
14
+ }, de = /* @__PURE__ */ O({
15
+ __name: "ValidityInput",
16
+ props: {
17
+ label: {
18
+ type: String
19
+ },
20
+ disabled: {
21
+ type: Boolean,
22
+ default: !1
23
+ },
24
+ type: {
25
+ type: String,
26
+ default: void 0
27
+ },
28
+ modelValue: {
29
+ type: Object,
30
+ required: !0
31
+ },
32
+ forCredit: {
33
+ type: Boolean,
34
+ default: !1
35
+ },
36
+ helperText: {
37
+ type: String
38
+ }
39
+ },
40
+ emits: ["update:model-value"],
41
+ setup(t, { emit: h }) {
42
+ var g, P;
43
+ const n = t, c = h, a = [
44
+ { label: "Date Range", value: "range" },
45
+ { label: "Custom", value: "custom" }
46
+ ], u = R(!1);
47
+ J(() => {
48
+ u.value = n.modelValue && Object.entries(n.modelValue).filter(
49
+ ([r, i]) => r != "followFirstReceive" && i != null
50
+ ).length > 0;
51
+ });
52
+ const l = R(
53
+ n.type ? a.find((r) => r.value === n.type) : (g = n.modelValue) != null && g.validBefore || (P = n.modelValue) != null && P.validAfter ? a[0] : a[1]
54
+ ), w = z(
55
+ () => n.forCredit ? ee : te
56
+ ), v = z(() => {
57
+ const r = w.value.safeParse(n.modelValue);
58
+ return r.success ? [] : r.error.errors;
59
+ });
60
+ function o(r) {
61
+ c("update:model-value", r);
62
+ }
63
+ function U(r) {
64
+ var i, D;
65
+ if (r.value == "range")
66
+ return o({
67
+ followFirstReceive: (i = n.modelValue) == null ? void 0 : i.followFirstReceive,
68
+ validAfter: void 0,
69
+ validBefore: void 0
70
+ });
71
+ if (r.value == "custom")
72
+ return u.value = !1, o({
73
+ validForDay: (D = n.modelValue) == null ? void 0 : D.validForDay
74
+ });
75
+ }
76
+ return (r, i) => {
77
+ var T, I, E, M, $, j, N, L;
78
+ const D = y("FmButtonGroup"), G = y("FmSimpleDateRangePicker"), Z = y("FmSwitch"), Y = y("FmStepperField"), B = y("FmHelperText");
79
+ return s(), x("div", ae, [
80
+ K(r.$slots, "label", {}, () => [
81
+ t.label ? (s(), x("div", ne, S(t.label), 1)) : f("", !0)
82
+ ]),
83
+ t.type ? f("", !0) : (s(), p(D, {
84
+ key: 0,
85
+ modelValue: e(l),
86
+ "onUpdate:modelValue": [
87
+ i[0] || (i[0] = (m) => H(l) ? l.value = m : null),
88
+ i[1] || (i[1] = (m) => U(m))
89
+ ],
90
+ items: a
91
+ }, null, 8, ["modelValue"])),
92
+ e(l).value === "range" ? (s(), x("div", se, [
93
+ b(G, {
94
+ "model-value": {
95
+ startDate: (T = t.modelValue) != null && T.validAfter ? new Date((I = t.modelValue) == null ? void 0 : I.validAfter).toISOString() : null,
96
+ endDate: (E = t.modelValue) != null && E.validAfter ? new Date(((M = t.modelValue) == null ? void 0 : M.validBefore) || "").toISOString() : null
97
+ },
98
+ "onUpdate:modelValue": i[2] || (i[2] = (m) => {
99
+ var V;
100
+ o({
101
+ followFirstReceive: (V = n.modelValue) == null ? void 0 : V.followFirstReceive,
102
+ validAfter: new Date(m.startDate).toISOString(),
103
+ validBefore: new Date(m.endDate).toISOString()
104
+ });
105
+ })
106
+ }, null, 8, ["model-value"])
107
+ ])) : e(l).value === "custom" ? (s(), x("div", ie, [
108
+ b(Z, {
109
+ "model-value": e(u),
110
+ label: "Expires",
111
+ "label-placement": "right",
112
+ "onUpdate:modelValue": i[3] || (i[3] = (m) => {
113
+ var V;
114
+ u.value = m, o({
115
+ validForDay: m ? 1 : void 0,
116
+ followFirstReceive: (V = n.modelValue) == null ? void 0 : V.followFirstReceive
117
+ });
118
+ })
119
+ }, null, 8, ["model-value"]),
120
+ e(u) ? (s(), p(Y, {
121
+ key: 0,
122
+ label: "After (days)",
123
+ class: q([{
124
+ "opacity-50 pointer-events-none": !e(u)
125
+ }, "mt-[-4px]"]),
126
+ "max-fraction-digits": 0,
127
+ disabled: !e(u),
128
+ "show-steppers": !1,
129
+ max: 99999,
130
+ "append-text": "day(s)",
131
+ "model-value": (($ = n.modelValue) == null ? void 0 : $.validForDay) ?? null,
132
+ "onUpdate:modelValue": i[4] || (i[4] = (m) => {
133
+ var V;
134
+ return o({
135
+ validForDay: m == null ? void 0 : parseInt(m.toString()),
136
+ followFirstReceive: (V = n.modelValue) == null ? void 0 : V.followFirstReceive
137
+ });
138
+ })
139
+ }, null, 8, ["class", "disabled", "model-value"])) : f("", !0)
140
+ ])) : f("", !0),
141
+ ((j = n.modelValue) == null ? void 0 : j.followFirstReceive) === !0 && e(u) ? (s(), p(B, {
142
+ key: 3,
143
+ text: "Expiry follows the first receive"
144
+ })) : f("", !0),
145
+ b(B, {
146
+ text: t.helperText || (((N = n.modelValue) == null ? void 0 : N.validForDay) === 0 ? "Expires on the same day" : e(d).helperText(e(v), "")),
147
+ state: t.helperText ? "error" : ((L = n.modelValue) == null ? void 0 : L.validForDay) === 0 ? "warning" : e(d).helperState(e(v), "")
148
+ }, null, 8, ["text", "state"])
149
+ ]);
150
+ };
151
+ }
152
+ }), re = { class: "space-y-8" }, he = /* @__PURE__ */ O({
153
+ __name: "CollectibleOptionInput",
154
+ props: {
155
+ modelValue: {
156
+ type: Object
157
+ },
158
+ noCampaign: {
159
+ type: Boolean
160
+ },
161
+ schema: {
162
+ type: Object,
163
+ default: () => _.any()
164
+ },
165
+ isMission: {
166
+ type: Boolean,
167
+ default: !1
168
+ }
169
+ },
170
+ emits: ["update:model-value"],
171
+ setup(t, { emit: h }) {
172
+ const n = t, c = h, a = R(n.modelValue ?? {});
173
+ return Q(a, () => c("update:model-value", a.value)), (u, l) => {
174
+ const w = y("FmSwitch"), v = y("FmStepperField");
175
+ return s(), x("div", re, [
176
+ t.isMission ? f("", !0) : (s(), p(w, {
177
+ key: 0,
178
+ label: "Enable Transfer",
179
+ "label-placement": "right",
180
+ modelValue: e(a).enableTransfer,
181
+ "onUpdate:modelValue": l[0] || (l[0] = (o) => e(a).enableTransfer = o)
182
+ }, null, 8, ["modelValue"])),
183
+ t.noCampaign ? f("", !0) : (s(), x("div", {
184
+ key: 1,
185
+ class: q(["grid gap-16", t.isMission ? "" : "grid-cols-2"])
186
+ }, [
187
+ b(v, {
188
+ modelValue: e(a).maxPerUser,
189
+ "onUpdate:modelValue": l[1] || (l[1] = (o) => e(a).maxPerUser = o),
190
+ "show-steppers": !1,
191
+ rules: [e(d).ruleAtPath(t.schema, "maxPerUser")]
192
+ }, {
193
+ label: F(() => [
194
+ (s(), p(k(
195
+ e(d).toInputLabel(
196
+ e(d).typeAtPath(t.schema, "maxPerUser"),
197
+ "Max per user"
198
+ )
199
+ )))
200
+ ]),
201
+ _: 1
202
+ }, 8, ["modelValue", "rules"]),
203
+ t.isMission ? f("", !0) : (s(), p(v, {
204
+ key: 0,
205
+ modelValue: e(a).maxReceive,
206
+ "onUpdate:modelValue": l[2] || (l[2] = (o) => e(a).maxReceive = o),
207
+ "show-steppers": !1,
208
+ rules: [e(d).ruleAtPath(t.schema, "maxReceive")]
209
+ }, {
210
+ label: F(() => [
211
+ (s(), p(k(
212
+ e(d).toInputLabel(
213
+ e(d).typeAtPath(t.schema, "maxReceive"),
214
+ "Max distribute"
215
+ )
216
+ )))
217
+ ]),
218
+ _: 1
219
+ }, 8, ["modelValue", "rules"]))
220
+ ], 2)),
221
+ t.isMission ? f("", !0) : (s(), x(W, { key: 2 }, [
222
+ b(v, {
223
+ modelValue: e(a).maxUse,
224
+ "onUpdate:modelValue": l[3] || (l[3] = (o) => e(a).maxUse = o),
225
+ "append-text": "use(s)",
226
+ "show-steppers": !1,
227
+ rules: [e(d).ruleAtPath(t.schema, "maxUse")]
228
+ }, {
229
+ label: F(() => [
230
+ (s(), p(k(
231
+ e(d).toInputLabel(
232
+ e(d).typeAtPath(t.schema, "maxUse"),
233
+ "Usage count"
234
+ )
235
+ )))
236
+ ]),
237
+ _: 1
238
+ }, 8, ["modelValue", "rules"]),
239
+ e(a).maxUse && e(a).maxUse > 1 ? (s(), p(v, {
240
+ key: 0,
241
+ modelValue: e(a).cooldown,
242
+ "onUpdate:modelValue": l[4] || (l[4] = (o) => e(a).cooldown = o),
243
+ "append-text": "minute(s)",
244
+ "show-steppers": !1,
245
+ rules: [e(d).ruleAtPath(t.schema, "cooldown")]
246
+ }, {
247
+ label: F(() => [
248
+ (s(), p(k(
249
+ e(d).toInputLabel(
250
+ e(d).typeAtPath(t.schema, "cooldown"),
251
+ "Cooldown"
252
+ )
253
+ )))
254
+ ]),
255
+ _: 1
256
+ }, 8, ["modelValue", "rules"])) : f("", !0),
257
+ b(de, {
258
+ modelValue: e(a).validityOption,
259
+ "onUpdate:modelValue": l[5] || (l[5] = (o) => e(a).validityOption = o),
260
+ label: "Validity option"
261
+ }, null, 8, ["modelValue"])
262
+ ], 64))
263
+ ]);
264
+ };
265
+ }
266
+ }), ue = { class: "space-y-8" }, me = /* @__PURE__ */ A("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Configure the discount you want to offer your customer. ", -1), pe = {
267
+ key: 1,
268
+ class: "border-1 rounded-md flex gap-16 items-center justify-between px-16 py-12"
269
+ }, ce = { class: "fm-typo-en-body-lg-400" }, fe = { class: "text-fm-color-typo-secondary" }, ge = /* @__PURE__ */ O({
270
+ __name: "EffectSheet",
271
+ props: {
272
+ modelValue: { type: Object },
273
+ canSetAutoApply: {
274
+ type: Boolean
275
+ }
276
+ },
277
+ emits: ["update:model-value"],
278
+ setup(t, { emit: h }) {
279
+ const n = h, c = R(!1);
280
+ async function a(u) {
281
+ u.stopPropagation(), await le.remove("Are you sure you want to remove this effect?") && n("update:model-value", null);
282
+ }
283
+ return (u, l) => {
284
+ const w = y("FmButton"), v = y("FmSideSheet");
285
+ return s(), p(v, {
286
+ "max-width": 550,
287
+ header: "Apply discount",
288
+ modelValue: e(c),
289
+ "onUpdate:modelValue": [
290
+ l[2] || (l[2] = (o) => H(c) ? c.value = o : null),
291
+ l[3] || (l[3] = (o) => c.value = o)
292
+ ]
293
+ }, {
294
+ "side-sheet-button": F(() => {
295
+ var o, U, g;
296
+ return [
297
+ A("div", ue, [
298
+ me,
299
+ t.modelValue ? (s(), x("div", pe, [
300
+ A("div", ce, [
301
+ A("div", null, S((o = e(C)(t.modelValue)) == null ? void 0 : o.type), 1),
302
+ A("div", fe, S((U = e(C)(t.modelValue)) == null ? void 0 : U.adjustment) + " with " + S((g = e(C)(t.modelValue)) == null ? void 0 : g.requirements), 1)
303
+ ]),
304
+ b(w, {
305
+ icon: "delete",
306
+ "icon-color": "neutral-gray-400",
307
+ variant: "tertiary",
308
+ onClick: a
309
+ })
310
+ ])) : (s(), p(w, {
311
+ key: 0,
312
+ label: "Apply discount",
313
+ icon: "add",
314
+ "icon-color": "primary",
315
+ variant: "secondary",
316
+ class: "border-fm-color-primary text-fm-color-primary"
317
+ }))
318
+ ])
319
+ ];
320
+ }),
321
+ "side-sheet-footer": F(() => [
322
+ X(S(void 0))
323
+ ]),
324
+ default: F(() => [
325
+ b(e(oe), {
326
+ class: "fm-effect-sheet",
327
+ title: "",
328
+ "can-set-auto-apply": t.canSetAutoApply,
329
+ "disable-effects": t.canSetAutoApply ? ["PAYMENT"] : void 0,
330
+ "initial-value": t.modelValue,
331
+ onOnConfirm: l[0] || (l[0] = (o) => (n("update:model-value", o), c.value = !1)),
332
+ onOnCancel: l[1] || (l[1] = (o) => c.value = !1)
333
+ }, null, 8, ["can-set-auto-apply", "disable-effects", "initial-value"])
334
+ ]),
335
+ _: 1
336
+ }, 8, ["modelValue"]);
337
+ };
338
+ }
339
+ });
340
+ export {
341
+ ge as _,
342
+ he as a,
343
+ de as b
344
+ };
@@ -0,0 +1,211 @@
1
+ import { defineComponent as O, ref as k, computed as U, onMounted as A, resolveComponent as i, openBlock as c, createElementBlock as g, Fragment as _, createVNode as r, unref as a, createElementVNode as n, withCtx as h, renderList as D, createBlock as x, resolveDynamicComponent as j, toDisplayString as f, h as M } from "vue";
2
+ import { _ as H } from "./campaign-CpzFl8Vr.js";
3
+ import { useDialog as q, components as z } from "@feedmepos/ui-library";
4
+ import { u as G, p as J } from "./loading-KNmEMBUB.js";
5
+ import { u as Q } from "./business-BSo7EPan.js";
6
+ import { u as W } from "./campaign-CsOje3Ap.js";
7
+ import { g as S, b as V } from "./dto-CfEXSCq6.js";
8
+ import { _ as X } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
9
+ import { _ as Y } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-we7ADwFk.js";
10
+ import { u as Z } from "./template-CFAIPoD7.js";
11
+ import { c as y } from "./index-Boo5np6l.js";
12
+ const ee = { class: "px-24 flex flex-col gap-y-16" }, te = { class: "flex items-center justify-between w-full" }, oe = { class: "flex gap-8 overflow-x-auto" }, ae = { class: "space-y-8" }, ne = { class: "flex w-full gap-4 items-center" }, se = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, re = { class: "space-y-4" }, ie = { class: "fm-typo-en-body-lg-600" }, le = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ce = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, me = /* @__PURE__ */ n("img", {
13
+ src: H,
14
+ class: "aspect-square w-[150px]"
15
+ }, null, -1), de = /* @__PURE__ */ n("div", { class: "flex flex-col gap-16 text-center" }, [
16
+ /* @__PURE__ */ n("div", { class: "fm-typo-en-title-sm-800" }, "Create experience program"),
17
+ /* @__PURE__ */ n("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Experience help customers gain membership tiers. The more they interact and spend, the higher their membership level, unlocking more rewards and benefits. ")
18
+ ], -1), Fe = /* @__PURE__ */ O({
19
+ __name: "Experience",
20
+ setup(pe) {
21
+ const L = {
22
+ label: "Create campaign",
23
+ value: "create",
24
+ isPrimary: !0,
25
+ prependIcon: "add"
26
+ }, P = Z("POINT", q()), I = Q(), l = W(), { global: T, minor: w } = G, s = k({
27
+ searchKey: "",
28
+ location: null
29
+ }), p = U(
30
+ () => l.campaigns.experience.filter(
31
+ (e) => !s.value.location || !e.targetLocation || e.targetLocation.includes(s.value.location)
32
+ )
33
+ ), B = [
34
+ {
35
+ header: "Program title",
36
+ accessorFn: (e) => e.name
37
+ },
38
+ {
39
+ header: "Status",
40
+ cell(e) {
41
+ return S(e.row.original);
42
+ }
43
+ },
44
+ {
45
+ header: "Summary",
46
+ accessorFn: (e) => V(e)
47
+ //v.effect,
48
+ },
49
+ {
50
+ header: "Actions",
51
+ cell(e) {
52
+ return M(z.FmButton, {
53
+ variant: "tertiary",
54
+ icon: "delete",
55
+ iconColor: "neutral-gray-400",
56
+ onClick: (o) => {
57
+ o.stopPropagation(), v(e.row.original);
58
+ }
59
+ });
60
+ }
61
+ }
62
+ ], b = k();
63
+ async function v(e) {
64
+ await J.remove(`Are you sure you want to remove ${e.name}?`) && await w(
65
+ async () => {
66
+ await y.delete(e._id), await l.read("POINT");
67
+ },
68
+ {
69
+ message: `Removing ${e.name}`,
70
+ successMessage: `Removed ${e.name} successfully`
71
+ }
72
+ );
73
+ }
74
+ async function u(e) {
75
+ e ? await o() : P.open(async (m) => {
76
+ await o(m);
77
+ });
78
+ async function o(m) {
79
+ var d;
80
+ (d = b.value) == null || d.showSheet(
81
+ !0,
82
+ "POINT",
83
+ e ? await y.readById(e._id) : void 0,
84
+ m
85
+ );
86
+ }
87
+ }
88
+ async function $(e) {
89
+ await w(
90
+ async () => {
91
+ e.campaign._id ? await y.update(e.campaign._id, e) : await y.create(e), await l.read("POINT");
92
+ },
93
+ {
94
+ message: `${e.campaign._id ? "Updating" : "Creating"} experience program`,
95
+ successMessage: `Experience program ${e.campaign._id ? "updated" : "created"} successfully`
96
+ }
97
+ );
98
+ }
99
+ return A(async () => {
100
+ await T(async () => {
101
+ await l.read("POINT");
102
+ });
103
+ }), (e, o) => {
104
+ const m = i("FmPageHead"), d = i("FmSearch"), E = i("FmTable"), C = i("FmButton"), K = i("FmListItem"), N = i("FmList"), R = i("FmCard");
105
+ return c(), g(_, null, [
106
+ r(m, {
107
+ title: "Experience",
108
+ actions: a(p).length > 0 ? [L] : [],
109
+ "onClick:action": o[0] || (o[0] = () => u())
110
+ }, null, 8, ["actions"]),
111
+ n("div", ee, [
112
+ r(d, {
113
+ modelValue: a(s).searchKey,
114
+ "onUpdate:modelValue": o[1] || (o[1] = (t) => a(s).searchKey = t),
115
+ class: "hidden xs:block border-b-2 border-fm-color-neutral-gray-100",
116
+ placeholder: "search",
117
+ collapsible: ""
118
+ }, null, 8, ["modelValue"]),
119
+ a(l).campaigns.experience && a(l).campaigns.experience.length > 0 ? (c(), g(_, { key: 0 }, [
120
+ n("div", te, [
121
+ n("div", oe, [
122
+ r(X, {
123
+ modelValue: a(s).location,
124
+ "onUpdate:modelValue": o[2] || (o[2] = (t) => a(s).location = t),
125
+ label: "Location: ",
126
+ "show-item-label": !0,
127
+ icon: "storefront",
128
+ placement: "bottom-start",
129
+ items: a(I).locationItems
130
+ }, null, 8, ["modelValue", "items"])
131
+ ]),
132
+ r(d, {
133
+ modelValue: a(s).searchKey,
134
+ "onUpdate:modelValue": o[3] || (o[3] = (t) => a(s).searchKey = t),
135
+ class: "xs:hidden",
136
+ placeholder: "search",
137
+ collapsible: ""
138
+ }, null, 8, ["modelValue"])
139
+ ]),
140
+ r(E, {
141
+ class: "xs:hidden",
142
+ "row-data": a(p),
143
+ "column-defs": B,
144
+ "search-value": a(s).searchKey,
145
+ "column-filter": [],
146
+ onRowClick: o[4] || (o[4] = (t) => u(t.original)),
147
+ "hide-footer": a(p).length < 10
148
+ }, null, 8, ["row-data", "search-value", "hide-footer"]),
149
+ r(N, { class: "hidden xs:flex flex-col mx-[-24px]" }, {
150
+ default: h(() => [
151
+ (c(!0), g(_, null, D(a(p).filter(
152
+ (t) => t.name.toLowerCase().includes(a(s).searchKey.toLowerCase())
153
+ ), (t) => (c(), x(K, {
154
+ key: t._id.toString(),
155
+ onClick: (F) => u(t),
156
+ class: "py-12 px-16 flex items-center justify-between border-b border-fm-color-neutral-gray-100"
157
+ }, {
158
+ default: h(() => [
159
+ n("div", ae, [
160
+ n("div", ne, [
161
+ (c(), x(j(a(S)(t)))),
162
+ n("div", se, f(t.currentReceive ?? 0) + " used ", 1)
163
+ ]),
164
+ n("div", re, [
165
+ n("div", ie, f(t.name), 1),
166
+ n("div", le, f(a(V)(t)), 1)
167
+ ]),
168
+ n("div", ce, " Experience received: " + f(t.currentReceive ?? 0), 1)
169
+ ]),
170
+ r(C, {
171
+ icon: "delete",
172
+ "icon-color": "neutral-gray-400",
173
+ variant: "tertiary",
174
+ onClick: (F) => (F.stopPropagation(), v(t))
175
+ }, null, 8, ["onClick"])
176
+ ]),
177
+ _: 2
178
+ }, 1032, ["onClick"]))), 128))
179
+ ]),
180
+ _: 1
181
+ })
182
+ ], 64)) : (c(), x(R, {
183
+ key: 1,
184
+ variant: "outlined",
185
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
186
+ }, {
187
+ default: h(() => [
188
+ me,
189
+ de,
190
+ r(C, {
191
+ variant: "primary",
192
+ label: "Create experience program",
193
+ icon: "add",
194
+ onClick: o[5] || (o[5] = (t) => u())
195
+ })
196
+ ]),
197
+ _: 1
198
+ })),
199
+ r(Y, {
200
+ ref_key: "sheetRef",
201
+ ref: b,
202
+ "onSubmit:modelValue": $
203
+ }, null, 512)
204
+ ])
205
+ ], 64);
206
+ };
207
+ }
208
+ });
209
+ export {
210
+ Fe as default
211
+ };