@feedmepos/mf-connect 0.1.2-prod → 0.1.4-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 (87) hide show
  1. package/dist/Analytic-07T9poLx.js +423 -0
  2. package/dist/{App-CRTD0U-N.js → App-C6MukSCT.js} +276 -275
  3. package/dist/Broadcast-CzsgeZNO.js +223 -0
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-C5zUv0Zx.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BirunpzI.js} +8 -8
  5. package/dist/Card-DQnyWZZf.js +824 -0
  6. package/dist/{Collections-BgbWoLWI.js → Collections-BV7CSqRw.js} +4 -4
  7. package/dist/Credit-CxsbYGLZ.js +220 -0
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-C137bE1q.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BKSZYxvb.js} +918 -901
  9. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-DpsrI-Z3.js +345 -0
  10. package/dist/Experience-eMUbhq7h.js +221 -0
  11. package/dist/Game-CxAG2ViS.js +255 -0
  12. package/dist/Marketing-CozMj2Y5.js +316 -0
  13. package/dist/Member-DM1dj3F5.js +69 -0
  14. package/dist/{MemberList-ISy05wGZ.js → MemberList-DNjK9BbG.js} +14 -14
  15. package/dist/{MemberTransactions-CXvhJngX.js → MemberTransactions-CsjN3LZA.js} +1 -1
  16. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-Ca1LO__F.js → MessageInput.vue_vue_type_script_setup_true_lang-DVQE9v2R.js} +2 -2
  17. package/dist/Mission-BugvTPPH.js +261 -0
  18. package/dist/Point-D8BjGtqT.js +222 -0
  19. package/dist/Promotion-mc9KBzoJ.js +253 -0
  20. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-D1eQ3i5D.js → RuleGroup.vue_vue_type_script_setup_true_lang-B2H3D_kZ.js} +15 -15
  21. package/dist/Segment-DZRFA-Pb.js +565 -0
  22. package/dist/Setting-DxNhR44e.js +1871 -0
  23. package/dist/Store-CdkJWpjV.js +1530 -0
  24. package/dist/StoreRewards-Cdturia8.js +400 -0
  25. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-nhS5Dhhk.js → StoreTransactions.vue_vue_type_script_setup_true_lang-D7GcOiUM.js} +10 -10
  26. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DWlpmE56.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-nuCOrrLE.js} +1 -1
  27. package/dist/{Tier-DLrOmrnK.js → Tier-I_MMd39Y.js} +470 -445
  28. package/dist/{Title-MHQuel7h.js → Title-DK5gmUvo.js} +298 -282
  29. package/dist/Transaction-BXpTIMS_.js +39 -0
  30. package/dist/Voucher-BQ5h2G0I.js +490 -0
  31. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-eAP99wyg.js +141 -0
  32. package/dist/app-CL2Wxzv5.js +5639 -0
  33. package/dist/{app-BjOpRVdv.js → app-DTAyCT-G.js} +1 -1
  34. package/dist/app.js +4 -3
  35. package/dist/{business-DveMDDHY.js → business-B9OUlaFZ.js} +1 -1
  36. package/dist/{campaign-CMb05XLt.js → campaign-CNbUA51l.js} +2 -2
  37. package/dist/{collection.fn-BjaBPYMU.js → collection.fn-D_i45T4Q.js} +2 -2
  38. package/dist/dto-B4208_es.js +2770 -0
  39. package/dist/{effect-CxAdSlyD.js → effect-Ye_yr8et.js} +1 -1
  40. package/dist/{email-addresses-Dtr5OALQ.js → email-addresses-Gm7Dyaxy.js} +1 -1
  41. package/dist/{export-DuBekrcg.js → export-Buee5oUV.js} +3 -3
  42. package/dist/{helper-DL6hnmtJ.js → helper-BBlHhMFc.js} +1 -1
  43. package/dist/{index-raYm7Ew2.js → index-BxJgFvym.js} +2 -2
  44. package/dist/{index-gcsOy_cD.js → index-ByaM-yoc.js} +91 -86
  45. package/dist/{index-DISwCnfH.js → index-C0QHb5SL.js} +2 -2
  46. package/dist/{index-Cibwzgac.js → index-C363BG5A.js} +3 -3
  47. package/dist/{index-BZAlqAaJ.js → index-CLL3no-v.js} +1 -1
  48. package/dist/{index-CAQpU5Rv.js → index-ChSVaFk3.js} +1 -1
  49. package/dist/{index-BSIUoSG3.js → index-Co9n8I_5.js} +3 -3
  50. package/dist/index-CoGNKU8v.js +3 -0
  51. package/dist/{index-Dx4pkNRc.js → index-DHGcUMVN.js} +1 -1
  52. package/dist/{index-CgPlJqkX.js → index-DWWtZSrm.js} +1 -1
  53. package/dist/{index-CGHNWhkM.js → index-DdVZgYE4.js} +258 -256
  54. package/dist/{index-BBBytzpn.js → index-Dx3HwWcb.js} +1 -1
  55. package/dist/{index.esm2017-Bs9CWbrs.js → index.esm2017-Dd02dg_O.js} +38 -38
  56. package/dist/{loading-Dj5bx8fg.js → loading-Or1ZDzDS.js} +11 -11
  57. package/dist/{membership-B2avlZoN.js → membership-B8h5ku-v.js} +3 -3
  58. package/dist/{money-CNSWtAf-.js → money-CmsKAJBT.js} +1 -1
  59. package/dist/{number-BA58pjU6.js → number-iEhp7Uai.js} +1 -1
  60. package/dist/{rule-BWazFYuZ.js → rule-BORkgSMK.js} +3 -3
  61. package/dist/{rule-builder-RIloDQBn.js → rule-builder-DEfkSr68.js} +1 -1
  62. package/dist/{template-u01r84LY.js → template-C_Y7bhlI.js} +4 -4
  63. package/dist/{usePagination--B6Wt7C1.js → usePagination-Ci8-uZvb.js} +1 -1
  64. package/dist/vue-i18n-BXzrZRP6.js +2365 -0
  65. package/package.json +7 -4
  66. package/dist/Analytic-AqWU_lJy.js +0 -620
  67. package/dist/Broadcast-utWSrzP9.js +0 -216
  68. package/dist/Card-x6qnEaIt.js +0 -823
  69. package/dist/Credit-CojzmUnh.js +0 -214
  70. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-8l3Dt_Lo.js +0 -344
  71. package/dist/Experience-CPjovKWF.js +0 -211
  72. package/dist/Game-DWcjPfZP.js +0 -250
  73. package/dist/Marketing-CwoI0pFF.js +0 -309
  74. package/dist/Member-oRcVGr20.js +0 -92
  75. package/dist/Mission-Y8s5MQIC.js +0 -248
  76. package/dist/Point-0Fw3qLIW.js +0 -220
  77. package/dist/Promotion-vqM23NPX.js +0 -244
  78. package/dist/Segment-lgzMRCyd.js +0 -564
  79. package/dist/Setting-CFGB53S0.js +0 -1870
  80. package/dist/Store-fJlew3HJ.js +0 -1533
  81. package/dist/StoreRewards-DWq34E4p.js +0 -429
  82. package/dist/Transaction-CYqMFEzc.js +0 -36
  83. package/dist/Voucher-B0QCX_nG.js +0 -485
  84. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js +0 -140
  85. package/dist/app-SOHUUM08.js +0 -2974
  86. package/dist/dto-CY7JrHkZ.js +0 -1145
  87. package/dist/index-BMxu_XL-.js +0 -11
@@ -0,0 +1,345 @@
1
+ import { defineComponent as P, ref as R, onMounted as Q, computed as H, resolveComponent as y, openBlock as i, createElementBlock as x, renderSlot as W, toDisplayString as S, createCommentVNode as v, createBlock as f, unref as e, isRef as q, createVNode as b, normalizeClass as G, watch as X, withCtx as F, resolveDynamicComponent as D, Fragment as _, createElementVNode as A, createTextVNode as ee } from "vue";
2
+ import { z as te } from "./app-CL2Wxzv5.js";
3
+ import { Z as u } from "./ZodTextField.vue_vue_type_script_setup_true_lang-eAP99wyg.js";
4
+ import { g as le, h as oe } from "./index-ChSVaFk3.js";
5
+ import { u as Z } from "./vue-i18n-BXzrZRP6.js";
6
+ import { s as O } from "./effect-Ye_yr8et.js";
7
+ import { p as ae } from "./loading-Or1ZDzDS.js";
8
+ import { I as ne } from "./app-DTAyCT-G.js";
9
+ const ie = { class: "flex flex-col gap-8" }, se = {
10
+ key: 0,
11
+ class: "fm-typo-en-body-lg-600"
12
+ }, de = { key: 1 }, me = {
13
+ key: 2,
14
+ class: "space-y-16"
15
+ }, re = /* @__PURE__ */ P({
16
+ __name: "ValidityInput",
17
+ props: {
18
+ label: {
19
+ type: String
20
+ },
21
+ disabled: {
22
+ type: Boolean,
23
+ default: !1
24
+ },
25
+ type: {
26
+ type: String,
27
+ default: void 0
28
+ },
29
+ modelValue: {
30
+ type: Object,
31
+ required: !0
32
+ },
33
+ forCredit: {
34
+ type: Boolean,
35
+ default: !1
36
+ },
37
+ helperText: {
38
+ type: String
39
+ }
40
+ },
41
+ emits: ["update:model-value"],
42
+ setup(t, { emit: w }) {
43
+ var B, C;
44
+ const { t: d } = Z(), l = t, g = w, o = [
45
+ { label: d("connect.template.validity_option.date_range"), value: "range" },
46
+ { label: d("connect.template.validity_option.custom"), value: "custom" }
47
+ ], s = R(!1);
48
+ Q(() => {
49
+ s.value = l.modelValue && Object.entries(l.modelValue).filter(
50
+ ([c, r]) => c != "followFirstReceive" && r != null
51
+ ).length > 0;
52
+ });
53
+ const a = R(
54
+ l.type ? o.find((c) => c.value === l.type) : (B = l.modelValue) != null && B.validBefore || (C = l.modelValue) != null && C.validAfter ? o[0] : o[1]
55
+ ), h = H(
56
+ () => l.forCredit ? le : oe
57
+ ), m = H(() => {
58
+ const c = h.value.safeParse(l.modelValue);
59
+ return c.success ? [] : c.error.errors;
60
+ });
61
+ function n(c) {
62
+ g("update:model-value", c);
63
+ }
64
+ function U(c) {
65
+ var r, k;
66
+ if (c.value == "range")
67
+ return n({
68
+ followFirstReceive: (r = l.modelValue) == null ? void 0 : r.followFirstReceive,
69
+ validAfter: void 0,
70
+ validBefore: void 0
71
+ });
72
+ if (c.value == "custom")
73
+ return s.value = !1, n({
74
+ validForDay: (k = l.modelValue) == null ? void 0 : k.validForDay
75
+ });
76
+ }
77
+ return (c, r) => {
78
+ var T, $, j, E, M, N, L, z;
79
+ const k = y("FmButtonGroup"), Y = y("FmSimpleDateRangePicker"), J = y("FmSwitch"), K = y("FmStepperField"), I = y("FmHelperText");
80
+ return i(), x("div", ie, [
81
+ W(c.$slots, "label", {}, () => [
82
+ t.label ? (i(), x("div", se, S(t.label), 1)) : v("", !0)
83
+ ]),
84
+ t.type ? v("", !0) : (i(), f(k, {
85
+ key: 0,
86
+ modelValue: e(a),
87
+ "onUpdate:modelValue": [
88
+ r[0] || (r[0] = (p) => q(a) ? a.value = p : null),
89
+ r[1] || (r[1] = (p) => U(p))
90
+ ],
91
+ items: o
92
+ }, null, 8, ["modelValue"])),
93
+ e(a).value === "range" ? (i(), x("div", de, [
94
+ b(Y, {
95
+ "model-value": {
96
+ startDate: (T = t.modelValue) != null && T.validAfter ? new Date(($ = t.modelValue) == null ? void 0 : $.validAfter).toISOString() : null,
97
+ endDate: (j = t.modelValue) != null && j.validAfter ? new Date(((E = t.modelValue) == null ? void 0 : E.validBefore) || "").toISOString() : null
98
+ },
99
+ "onUpdate:modelValue": r[2] || (r[2] = (p) => {
100
+ var V;
101
+ n({
102
+ followFirstReceive: (V = l.modelValue) == null ? void 0 : V.followFirstReceive,
103
+ validAfter: new Date(p.startDate).toISOString(),
104
+ validBefore: new Date(p.endDate).toISOString()
105
+ });
106
+ })
107
+ }, null, 8, ["model-value"])
108
+ ])) : e(a).value === "custom" ? (i(), x("div", me, [
109
+ b(J, {
110
+ "model-value": e(s),
111
+ label: e(d)("connect.template.validity_option.expire"),
112
+ "label-placement": "right",
113
+ "onUpdate:modelValue": r[3] || (r[3] = (p) => {
114
+ var V;
115
+ s.value = p, n({
116
+ validForDay: p ? 1 : void 0,
117
+ followFirstReceive: (V = l.modelValue) == null ? void 0 : V.followFirstReceive
118
+ });
119
+ })
120
+ }, null, 8, ["model-value", "label"]),
121
+ e(s) ? (i(), f(K, {
122
+ key: 0,
123
+ label: e(d)("connect.template.validity_option.after_day"),
124
+ class: G([{
125
+ "opacity-50 pointer-events-none": !e(s)
126
+ }, "mt-[-4px]"]),
127
+ "max-fraction-digits": 0,
128
+ disabled: !e(s),
129
+ "show-steppers": !1,
130
+ max: 99999,
131
+ "append-text": e(d)("connect.template.validity_option.days"),
132
+ "model-value": ((M = l.modelValue) == null ? void 0 : M.validForDay) ?? null,
133
+ "onUpdate:modelValue": r[4] || (r[4] = (p) => {
134
+ var V;
135
+ return n({
136
+ validForDay: p == null ? void 0 : parseInt(p.toString()),
137
+ followFirstReceive: (V = l.modelValue) == null ? void 0 : V.followFirstReceive
138
+ });
139
+ })
140
+ }, null, 8, ["label", "class", "disabled", "append-text", "model-value"])) : v("", !0)
141
+ ])) : v("", !0),
142
+ ((N = l.modelValue) == null ? void 0 : N.followFirstReceive) === !0 && e(s) ? (i(), f(I, {
143
+ key: 3,
144
+ text: e(d)("connect.template.validity_option.expire_follow_first_receive")
145
+ }, null, 8, ["text"])) : v("", !0),
146
+ b(I, {
147
+ text: t.helperText || (((L = l.modelValue) == null ? void 0 : L.validForDay) === 0 ? e(d)("connect.template.validity_option.expires_on_same_day") : e(u).helperText(e(m), "")),
148
+ state: t.helperText ? "error" : ((z = l.modelValue) == null ? void 0 : z.validForDay) === 0 ? "warning" : e(u).helperState(e(m), "")
149
+ }, null, 8, ["text", "state"])
150
+ ]);
151
+ };
152
+ }
153
+ }), ue = { class: "space-y-8" }, Ae = /* @__PURE__ */ P({
154
+ __name: "CollectibleOptionInput",
155
+ props: {
156
+ modelValue: {
157
+ type: Object
158
+ },
159
+ noCampaign: {
160
+ type: Boolean
161
+ },
162
+ schema: {
163
+ type: Object,
164
+ default: () => te.any()
165
+ },
166
+ isMission: {
167
+ type: Boolean,
168
+ default: !1
169
+ }
170
+ },
171
+ emits: ["update:model-value"],
172
+ setup(t, { emit: w }) {
173
+ const { t: d } = Z(), l = t, g = w, o = R(l.modelValue ?? {});
174
+ return X(o, () => g("update:model-value", o.value)), (s, a) => {
175
+ const h = y("FmSwitch"), m = y("FmStepperField");
176
+ return i(), x("div", ue, [
177
+ t.isMission ? v("", !0) : (i(), f(h, {
178
+ key: 0,
179
+ label: e(d)("connect.template.enable_transfer"),
180
+ "label-placement": "right",
181
+ modelValue: e(o).enableTransfer,
182
+ "onUpdate:modelValue": a[0] || (a[0] = (n) => e(o).enableTransfer = n)
183
+ }, null, 8, ["label", "modelValue"])),
184
+ t.noCampaign ? v("", !0) : (i(), x("div", {
185
+ key: 1,
186
+ class: G(["grid gap-16", t.isMission ? "" : "grid-cols-2"])
187
+ }, [
188
+ b(m, {
189
+ modelValue: e(o).maxPerUser,
190
+ "onUpdate:modelValue": a[1] || (a[1] = (n) => e(o).maxPerUser = n),
191
+ "show-steppers": !1,
192
+ rules: [e(u).ruleAtPath(t.schema, "maxPerUser")]
193
+ }, {
194
+ label: F(() => [
195
+ (i(), f(D(
196
+ e(u).toInputLabel(
197
+ e(u).typeAtPath(t.schema, "maxPerUser"),
198
+ e(d)("connect.template.max_per_user")
199
+ )
200
+ )))
201
+ ]),
202
+ _: 1
203
+ }, 8, ["modelValue", "rules"]),
204
+ t.isMission ? v("", !0) : (i(), f(m, {
205
+ key: 0,
206
+ modelValue: e(o).maxReceive,
207
+ "onUpdate:modelValue": a[2] || (a[2] = (n) => e(o).maxReceive = n),
208
+ "show-steppers": !1,
209
+ rules: [e(u).ruleAtPath(t.schema, "maxReceive")]
210
+ }, {
211
+ label: F(() => [
212
+ (i(), f(D(
213
+ e(u).toInputLabel(
214
+ e(u).typeAtPath(t.schema, "maxReceive"),
215
+ e(d)("connect.template.max_distribute")
216
+ )
217
+ )))
218
+ ]),
219
+ _: 1
220
+ }, 8, ["modelValue", "rules"]))
221
+ ], 2)),
222
+ t.isMission ? v("", !0) : (i(), x(_, { key: 2 }, [
223
+ b(m, {
224
+ modelValue: e(o).maxUse,
225
+ "onUpdate:modelValue": a[3] || (a[3] = (n) => e(o).maxUse = n),
226
+ "append-text": "use(s)",
227
+ "show-steppers": !1,
228
+ rules: [e(u).ruleAtPath(t.schema, "maxUse")]
229
+ }, {
230
+ label: F(() => [
231
+ (i(), f(D(
232
+ e(u).toInputLabel(
233
+ e(u).typeAtPath(t.schema, "maxUse"),
234
+ e(d)("connect.template.usage_count")
235
+ )
236
+ )))
237
+ ]),
238
+ _: 1
239
+ }, 8, ["modelValue", "rules"]),
240
+ e(o).maxUse && e(o).maxUse > 1 ? (i(), f(m, {
241
+ key: 0,
242
+ modelValue: e(o).cooldown,
243
+ "onUpdate:modelValue": a[4] || (a[4] = (n) => e(o).cooldown = n),
244
+ "append-text": "minute(s)",
245
+ "show-steppers": !1,
246
+ rules: [e(u).ruleAtPath(t.schema, "cooldown")]
247
+ }, {
248
+ label: F(() => [
249
+ (i(), f(D(
250
+ e(u).toInputLabel(
251
+ e(u).typeAtPath(t.schema, "cooldown"),
252
+ e(d)("connect.template.cooldown")
253
+ )
254
+ )))
255
+ ]),
256
+ _: 1
257
+ }, 8, ["modelValue", "rules"])) : v("", !0),
258
+ b(re, {
259
+ modelValue: e(o).validityOption,
260
+ "onUpdate:modelValue": a[5] || (a[5] = (n) => e(o).validityOption = n),
261
+ label: e(d)("connect.template.validity_option.title")
262
+ }, null, 8, ["modelValue", "label"])
263
+ ], 64))
264
+ ]);
265
+ };
266
+ }
267
+ }), ce = { class: "space-y-8" }, pe = /* @__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), fe = {
268
+ key: 1,
269
+ class: "border-1 rounded-md flex gap-16 items-center justify-between px-16 py-12"
270
+ }, ve = { class: "fm-typo-en-body-lg-400" }, ye = { class: "text-fm-color-typo-secondary" }, Ue = /* @__PURE__ */ P({
271
+ __name: "EffectSheet",
272
+ props: {
273
+ modelValue: { type: Object },
274
+ canSetAutoApply: {
275
+ type: Boolean
276
+ }
277
+ },
278
+ emits: ["update:model-value"],
279
+ setup(t, { emit: w }) {
280
+ const d = w, l = R(!1);
281
+ async function g(o) {
282
+ o.stopPropagation(), await ae.remove("Are you sure you want to remove this effect?") && d("update:model-value", null);
283
+ }
284
+ return (o, s) => {
285
+ const a = y("FmButton"), h = y("FmSideSheet");
286
+ return i(), f(h, {
287
+ "max-width": 550,
288
+ header: "Apply discount",
289
+ modelValue: e(l),
290
+ "onUpdate:modelValue": [
291
+ s[2] || (s[2] = (m) => q(l) ? l.value = m : null),
292
+ s[3] || (s[3] = (m) => l.value = m)
293
+ ]
294
+ }, {
295
+ "side-sheet-button": F(() => {
296
+ var m, n, U;
297
+ return [
298
+ A("div", ce, [
299
+ pe,
300
+ t.modelValue ? (i(), x("div", fe, [
301
+ A("div", ve, [
302
+ A("div", null, S((m = e(O)(t.modelValue)) == null ? void 0 : m.type), 1),
303
+ A("div", ye, S((n = e(O)(t.modelValue)) == null ? void 0 : n.adjustment) + " with " + S((U = e(O)(t.modelValue)) == null ? void 0 : U.requirements), 1)
304
+ ]),
305
+ b(a, {
306
+ icon: "delete",
307
+ "icon-color": "neutral-gray-400",
308
+ variant: "tertiary",
309
+ onClick: g
310
+ })
311
+ ])) : (i(), f(a, {
312
+ key: 0,
313
+ label: "Apply discount",
314
+ icon: "add",
315
+ "icon-color": "primary",
316
+ variant: "secondary",
317
+ class: "border-fm-color-primary text-fm-color-primary"
318
+ }))
319
+ ])
320
+ ];
321
+ }),
322
+ "side-sheet-footer": F(() => [
323
+ ee(S(void 0))
324
+ ]),
325
+ default: F(() => [
326
+ b(e(ne), {
327
+ class: "fm-effect-sheet",
328
+ title: "",
329
+ "can-set-auto-apply": t.canSetAutoApply,
330
+ "disable-effects": t.canSetAutoApply ? ["PAYMENT"] : void 0,
331
+ "initial-value": t.modelValue,
332
+ onOnConfirm: s[0] || (s[0] = (m) => (d("update:model-value", m), l.value = !1)),
333
+ onOnCancel: s[1] || (s[1] = (m) => l.value = !1)
334
+ }, null, 8, ["can-set-auto-apply", "disable-effects", "initial-value"])
335
+ ]),
336
+ _: 1
337
+ }, 8, ["modelValue"]);
338
+ };
339
+ }
340
+ });
341
+ export {
342
+ Ue as _,
343
+ Ae as a,
344
+ re as b
345
+ };
@@ -0,0 +1,221 @@
1
+ import { defineComponent as D, ref as S, computed as E, onMounted as U, resolveComponent as i, openBlock as m, createElementBlock as _, Fragment as x, createVNode as c, unref as t, createElementVNode as n, withCtx as h, renderList as j, createBlock as w, resolveDynamicComponent as M, toDisplayString as d, h as H } from "vue";
2
+ import { _ as q } from "./campaign-CpzFl8Vr.js";
3
+ import { useDialog as z, components as G } from "@feedmepos/ui-library";
4
+ import { u as J, p as Q } from "./loading-Or1ZDzDS.js";
5
+ import { u as W } from "./business-B9OUlaFZ.js";
6
+ import { u as X } from "./campaign-CNbUA51l.js";
7
+ import { g as L, a as V } from "./dto-B4208_es.js";
8
+ import { u as Y } from "./vue-i18n-BXzrZRP6.js";
9
+ import { _ as Z } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
10
+ import { _ as ee } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-BKSZYxvb.js";
11
+ import { u as te } from "./template-C_Y7bhlI.js";
12
+ import { c as g } from "./index-DWWtZSrm.js";
13
+ const oe = { class: "px-24 flex flex-col gap-y-16" }, ae = { class: "flex items-center justify-between w-full" }, ne = { class: "flex gap-8 overflow-x-auto" }, se = { class: "space-y-8" }, re = { class: "flex w-full gap-4 items-center" }, ce = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ie = { class: "space-y-4" }, le = { class: "fm-typo-en-body-lg-600" }, me = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, de = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, pe = /* @__PURE__ */ n("img", {
14
+ src: q,
15
+ class: "aspect-square w-[150px]"
16
+ }, null, -1), ue = { class: "flex flex-col gap-16 text-center" }, fe = { class: "fm-typo-en-title-sm-800" }, ye = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ie = /* @__PURE__ */ D({
17
+ __name: "Experience",
18
+ setup(ge) {
19
+ const { t: s } = Y(), I = {
20
+ label: s("connect.program.common.actions.create", {
21
+ type: s("connect.program.experience.title").toLowerCase()
22
+ }),
23
+ value: "create",
24
+ isPrimary: !0,
25
+ prependIcon: "add"
26
+ }, P = te("POINT", z()), B = W(), l = X(), { global: T, minor: v } = J, r = S({
27
+ searchKey: "",
28
+ location: null
29
+ }), f = E(
30
+ () => l.campaigns.experience.filter(
31
+ (e) => !r.value.location || !e.targetLocation || e.targetLocation.includes(r.value.location)
32
+ )
33
+ ), K = [
34
+ {
35
+ header: "Program title",
36
+ accessorFn: (e) => e.name
37
+ },
38
+ {
39
+ header: "Status",
40
+ cell(e) {
41
+ return L(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 H(G.FmButton, {
53
+ variant: "tertiary",
54
+ icon: "delete",
55
+ iconColor: "neutral-gray-400",
56
+ onClick: (a) => {
57
+ a.stopPropagation(), C(e.row.original);
58
+ }
59
+ });
60
+ }
61
+ }
62
+ ], b = S();
63
+ async function C(e) {
64
+ await Q.remove(`Are you sure you want to remove ${e.name}?`) && await v(
65
+ async () => {
66
+ await g.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 y(e) {
75
+ e ? await a() : P.open(async (p) => {
76
+ await a(p);
77
+ });
78
+ async function a(p) {
79
+ var u;
80
+ (u = b.value) == null || u.showSheet(
81
+ !0,
82
+ "POINT",
83
+ e ? await g.readById(e._id) : void 0,
84
+ p
85
+ );
86
+ }
87
+ }
88
+ async function N(e) {
89
+ await v(
90
+ async () => {
91
+ e.campaign._id ? await g.update(e.campaign._id, e) : await g.create(e), await l.read("POINT");
92
+ },
93
+ {
94
+ message: s("connect.program.common.update.updating", {
95
+ type: s("connect.program.experience.title")
96
+ }),
97
+ successMessage: s("connect.program.common.update.success", {
98
+ type: s("connect.program.experience.title"),
99
+ action: e.campaign._id ? "updated" : "created"
100
+ })
101
+ }
102
+ );
103
+ }
104
+ return U(async () => {
105
+ await T(async () => {
106
+ await l.read("POINT");
107
+ });
108
+ }), (e, a) => {
109
+ const p = i("FmPageHead"), u = i("FmSearch"), R = i("FmTable"), F = i("FmButton"), $ = i("FmListItem"), O = i("FmList"), A = i("FmCard");
110
+ return m(), _(x, null, [
111
+ c(p, {
112
+ title: t(s)("connect.program.experience.title"),
113
+ actions: t(f).length > 0 ? [I] : [],
114
+ "onClick:action": a[0] || (a[0] = () => y())
115
+ }, null, 8, ["title", "actions"]),
116
+ n("div", oe, [
117
+ c(u, {
118
+ modelValue: t(r).searchKey,
119
+ "onUpdate:modelValue": a[1] || (a[1] = (o) => t(r).searchKey = o),
120
+ class: "hidden xs:block border-b-2 border-fm-color-neutral-gray-100",
121
+ placeholder: t(s)("connect.program.common.search"),
122
+ collapsible: ""
123
+ }, null, 8, ["modelValue", "placeholder"]),
124
+ t(l).campaigns.experience && t(l).campaigns.experience.length > 0 ? (m(), _(x, { key: 0 }, [
125
+ n("div", ae, [
126
+ n("div", ne, [
127
+ c(Z, {
128
+ modelValue: t(r).location,
129
+ "onUpdate:modelValue": a[2] || (a[2] = (o) => t(r).location = o),
130
+ label: "Location: ",
131
+ "show-item-label": !0,
132
+ icon: "storefront",
133
+ placement: "bottom-start",
134
+ items: t(B).locationItems
135
+ }, null, 8, ["modelValue", "items"])
136
+ ]),
137
+ c(u, {
138
+ modelValue: t(r).searchKey,
139
+ "onUpdate:modelValue": a[3] || (a[3] = (o) => t(r).searchKey = o),
140
+ class: "xs:hidden",
141
+ placeholder: "search",
142
+ collapsible: ""
143
+ }, null, 8, ["modelValue"])
144
+ ]),
145
+ c(R, {
146
+ class: "xs:hidden",
147
+ "row-data": t(f),
148
+ "column-defs": K,
149
+ "search-value": t(r).searchKey,
150
+ "column-filter": [],
151
+ onRowClick: a[4] || (a[4] = (o) => y(o.original)),
152
+ "hide-footer": t(f).length < 10
153
+ }, null, 8, ["row-data", "search-value", "hide-footer"]),
154
+ c(O, { class: "hidden xs:flex flex-col mx-[-24px]" }, {
155
+ default: h(() => [
156
+ (m(!0), _(x, null, j(t(f).filter(
157
+ (o) => o.name.toLowerCase().includes(t(r).searchKey.toLowerCase())
158
+ ), (o) => (m(), w($, {
159
+ key: o._id.toString(),
160
+ onClick: (k) => y(o),
161
+ class: "py-12 px-16 flex items-center justify-between border-b border-fm-color-neutral-gray-100"
162
+ }, {
163
+ default: h(() => [
164
+ n("div", se, [
165
+ n("div", re, [
166
+ (m(), w(M(t(L)(o)))),
167
+ n("div", ce, d(o.currentReceive ?? 0) + " used ", 1)
168
+ ]),
169
+ n("div", ie, [
170
+ n("div", le, d(o.name), 1),
171
+ n("div", me, d(t(V)(o)), 1)
172
+ ]),
173
+ n("div", de, d(t(s)("program.experience.received", {
174
+ count: o.currentReceive ?? 0
175
+ })), 1)
176
+ ]),
177
+ c(F, {
178
+ icon: "delete",
179
+ "icon-color": "neutral-gray-400",
180
+ variant: "tertiary",
181
+ onClick: (k) => (k.stopPropagation(), C(o))
182
+ }, null, 8, ["onClick"])
183
+ ]),
184
+ _: 2
185
+ }, 1032, ["onClick"]))), 128))
186
+ ]),
187
+ _: 1
188
+ })
189
+ ], 64)) : (m(), w(A, {
190
+ key: 1,
191
+ variant: "outlined",
192
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
193
+ }, {
194
+ default: h(() => [
195
+ pe,
196
+ n("div", ue, [
197
+ n("div", fe, d(t(s)("connect.program.experience.empty_state.title")), 1),
198
+ n("div", ye, d(t(s)("connect.program.experience.empty_state.description")), 1)
199
+ ]),
200
+ c(F, {
201
+ variant: "primary",
202
+ label: "Create experience program",
203
+ icon: "add",
204
+ onClick: a[5] || (a[5] = (o) => y())
205
+ })
206
+ ]),
207
+ _: 1
208
+ })),
209
+ c(ee, {
210
+ ref_key: "sheetRef",
211
+ ref: b,
212
+ "onSubmit:modelValue": N
213
+ }, null, 512)
214
+ ])
215
+ ], 64);
216
+ };
217
+ }
218
+ });
219
+ export {
220
+ Ie as default
221
+ };