@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,39 @@
1
+ import { defineComponent as d, ref as f, resolveComponent as s, openBlock as t, createElementBlock as v, Fragment as b, createVNode as r, unref as o, createElementVNode as k, createBlock as l, KeepAlive as x, resolveDynamicComponent as m, createCommentVNode as F } from "vue";
2
+ import { _ as g, a as y } from "./StoreTransactions.vue_vue_type_script_setup_true_lang-D7GcOiUM.js";
3
+ import { u as C } from "./vue-i18n-BXzrZRP6.js";
4
+ const T = { class: "px-24 flex flex-col gap-y-32 pb-24" }, P = /* @__PURE__ */ d({
5
+ __name: "Transaction",
6
+ setup(V) {
7
+ const { t: n } = C(), a = [
8
+ {
9
+ label: n("connect.transaction.tabs.collection"),
10
+ value: "collection"
11
+ },
12
+ {
13
+ label: n("connect.transaction.tabs.store"),
14
+ value: "store"
15
+ }
16
+ ], e = f(a[0]);
17
+ return (B, c) => {
18
+ const i = s("FmPageHead"), u = s("FmTabs");
19
+ return t(), v(b, null, [
20
+ r(i, {
21
+ title: o(n)("connect.transaction.title")
22
+ }, null, 8, ["title"]),
23
+ k("div", T, [
24
+ r(u, {
25
+ "model-value": o(e).value,
26
+ items: a,
27
+ "onUpdate:modelValue": c[0] || (c[0] = (p) => e.value = a.find((_) => _.value === p))
28
+ }, null, 8, ["model-value"]),
29
+ (t(), l(x, null, [
30
+ o(e).value == "collection" ? (t(), l(m(g), { key: 0 })) : o(e).value == "store" ? (t(), l(m(y), { key: 1 })) : F("", !0)
31
+ ], 1024))
32
+ ])
33
+ ], 64);
34
+ };
35
+ }
36
+ });
37
+ export {
38
+ P as default
39
+ };
@@ -0,0 +1,490 @@
1
+ import { defineComponent as X, ref as _, watch as N, onMounted as J, resolveComponent as h, openBlock as y, createBlock as k, unref as t, isRef as j, withCtx as M, createElementVNode as l, createVNode as r, toDisplayString as F, computed as oe, h as b, createElementBlock as $, Fragment as T, renderList as te, resolveDynamicComponent as ae, createCommentVNode as K } from "vue";
2
+ import { _ as ne } from "./campaign-CpzFl8Vr.js";
3
+ import { useDialog as se, components as V } from "@feedmepos/ui-library";
4
+ import { u as W, p as z, a as le } from "./loading-Or1ZDzDS.js";
5
+ import { useCoreStore as ce } from "@feedmepos/mf-common";
6
+ import { u as ie } from "./business-B9OUlaFZ.js";
7
+ import { u as re } from "./campaign-CNbUA51l.js";
8
+ import { g as D, a as q } from "./dto-B4208_es.js";
9
+ import "./index-CoGNKU8v.js";
10
+ import { u as ue } from "./template-C_Y7bhlI.js";
11
+ import { _ as me } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-BKSZYxvb.js";
12
+ import { _ as de } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
13
+ import { J as pe } from "./JsonViewer-v8_C7l5N.js";
14
+ import { u as fe } from "./app-wDQR6dpb.js";
15
+ import { l as he } from "./lodash-B5I3zXaY.js";
16
+ import { m as ge } from "./index-Dx3HwWcb.js";
17
+ import { c as L } from "./index-DWWtZSrm.js";
18
+ import { u as ve } from "./vue-i18n-BXzrZRP6.js";
19
+ import { useRouter as ye } from "vue-router";
20
+ import { R as G } from "./app-CL2Wxzv5.js";
21
+ const _e = { class: "space-y-16" }, Ce = { class: "fm-typo-en-body-md-600" }, be = { class: "flex items-center justify-end" }, we = { class: "flex items-center gap-8" }, Se = /* @__PURE__ */ X({
22
+ __name: "SendVoucherSheet",
23
+ emits: ["success"],
24
+ setup(Q, { expose: a, emit: A }) {
25
+ const { minor: R } = W, P = _(""), g = _({}), C = A, v = _(!1), u = _([]);
26
+ function U(c) {
27
+ v.value = !0, P.value = c.campaignId, u.value = [];
28
+ }
29
+ function m() {
30
+ v.value = !1;
31
+ }
32
+ const S = [
33
+ {
34
+ header: "Name",
35
+ accessorFn: (c) => c.name || "No Profile"
36
+ },
37
+ {
38
+ header: "Phone",
39
+ accessorFn: (c) => c.phoneNumber || "-"
40
+ }
41
+ ], i = _({
42
+ searchValue: "",
43
+ pageSize: 10,
44
+ pageCount: 0,
45
+ pageIndex: 0,
46
+ totalRows: 0,
47
+ isLoading: !1
48
+ }), f = _([]), w = async (c) => {
49
+ i.value.isLoading = !0, f.value = [];
50
+ const e = await ge.read({
51
+ limit: c.pageSize,
52
+ skip: c.pageIndex,
53
+ sortBy: "_id",
54
+ search: i.value.searchValue,
55
+ descending: !1
56
+ });
57
+ f.value = e.resources, i.value.totalRows = e.meta.totalResources ?? 0, i.value.pageCount = e.meta.totalPages ?? 0, i.value.isLoading = !1, g.value = {}, u.value.forEach((o) => {
58
+ const s = f.value.findIndex((d) => d._id == o);
59
+ s > -1 && (console.log(s, "fetch member index"), g.value[s] = !0);
60
+ });
61
+ };
62
+ function E() {
63
+ f.value.length > 0 && (u.value = u.value.filter(
64
+ (c) => !f.value.some((e) => e._id === c) || // Keep if not in current page
65
+ Object.entries(g.value).some(
66
+ ([e, o]) => o && f.value[e]._id === c
67
+ // Keep if selected in current page
68
+ )
69
+ ));
70
+ for (const [c, e] of Object.entries(g.value))
71
+ if (e) {
72
+ const o = f.value[c]._id;
73
+ u.value.includes(o) || u.value.push(o);
74
+ }
75
+ }
76
+ async function x(c) {
77
+ u.value.length < 1 || await R(
78
+ async () => {
79
+ await L.sendCollection(P.value, {
80
+ memberId: u.value
81
+ }), await C("success"), m();
82
+ },
83
+ {
84
+ message: "Sending claim(s)",
85
+ successMessage: "Claim(s) created"
86
+ }
87
+ );
88
+ }
89
+ return N(g, E, { deep: !0 }), N(
90
+ () => i.value.searchValue,
91
+ he.debounce(async () => {
92
+ await w({ pageSize: 10, pageIndex: 0 });
93
+ }, 500)
94
+ ), a({
95
+ showSheet: U,
96
+ hideSheet: m
97
+ }), J(async () => {
98
+ await w(i.value);
99
+ }), (c, e) => {
100
+ const o = h("FmSearch"), s = h("FmTable"), d = h("FmButton"), B = h("FmSideSheet");
101
+ return y(), k(B, {
102
+ "max-width": 560,
103
+ "dismiss-away": !0,
104
+ header: "Send voucher to",
105
+ modelValue: t(v),
106
+ "onUpdate:modelValue": [
107
+ e[3] || (e[3] = (p) => j(v) ? v.value = p : null),
108
+ e[4] || (e[4] = (p) => v.value = p)
109
+ ]
110
+ }, {
111
+ "side-sheet-footer": M(() => [
112
+ l("div", we, [
113
+ r(d, {
114
+ label: "Send",
115
+ loading: t(fe)().isLoading,
116
+ onClick: x
117
+ }, null, 8, ["loading"]),
118
+ r(d, {
119
+ label: "Cancel",
120
+ type: "button",
121
+ variant: "tertiary",
122
+ onClick: e[2] || (e[2] = (p) => v.value = !1)
123
+ })
124
+ ])
125
+ ]),
126
+ default: M(() => [
127
+ r(pe, { json: t(u) }, null, 8, ["json"]),
128
+ l("div", _e, [
129
+ l("div", Ce, F(t(u).length) + " members selected ", 1),
130
+ l("div", be, [
131
+ r(o, {
132
+ class: "mt-4",
133
+ modelValue: t(i).searchValue,
134
+ "onUpdate:modelValue": e[0] || (e[0] = (p) => t(i).searchValue = p),
135
+ placeholder: "Search Member",
136
+ collapsible: ""
137
+ }, null, 8, ["modelValue"])
138
+ ]),
139
+ r(s, {
140
+ modelValue: t(g),
141
+ "onUpdate:modelValue": e[1] || (e[1] = (p) => j(g) ? g.value = p : null),
142
+ selection: "multiple",
143
+ loading: t(i).isLoading,
144
+ "row-data": t(f),
145
+ "column-defs": S,
146
+ "page-size": t(i).pageSize,
147
+ "page-count": t(i).pageCount,
148
+ "hide-footer": t(i).totalRows <= t(i).pageSize,
149
+ "fetch-fn": w
150
+ }, null, 8, ["modelValue", "loading", "row-data", "page-size", "page-count", "hide-footer"])
151
+ ])
152
+ ]),
153
+ _: 1
154
+ }, 8, ["modelValue"]);
155
+ };
156
+ }
157
+ });
158
+ var xe = { authUrl: "https://portal-v2.feedmeapi.com/", slackWebhookUrl: "https://hooks.slack.com/services/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", appUrl: "member.feedme.cc", crmUrl: "crm.feedme.cc", paymentPortalUrl: "https://portal.feedme.cc/payment/payout-account", marketingV1Portal: "https://marketing-v1.feedme.cc" };
159
+ const Ve = { class: "px-24 flex flex-col gap-y-16" }, ke = { class: "flex items-center justify-between w-full" }, Fe = { class: "flex gap-8 overflow-x-auto" }, Ie = { class: "space-y-8" }, Le = { class: "flex w-full gap-4 items-center" }, Me = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Re = { class: "space-y-4" }, Pe = { class: "fm-typo-en-body-lg-600" }, Ue = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ee = { class: "flex gap-8 items-center" }, Ae = /* @__PURE__ */ l("img", {
160
+ src: ne,
161
+ class: "aspect-square w-[150px]"
162
+ }, null, -1), Be = { class: "flex flex-col gap-16 text-center" }, Oe = { class: "fm-typo-en-title-sm-800" }, $e = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, so = /* @__PURE__ */ X({
163
+ __name: "Voucher",
164
+ setup(Q) {
165
+ const { t: a } = ve(), A = {
166
+ label: a("connect.voucher.createCampaign"),
167
+ value: "create",
168
+ isPrimary: !0,
169
+ prependIcon: "add"
170
+ }, R = se(), P = ue("VOUCHER", R), g = ie(), C = re(), { global: v, minor: u } = W, U = ye(), m = _({
171
+ searchKey: "",
172
+ location: null
173
+ }), S = oe(
174
+ () => C.campaigns.voucher.filter(
175
+ (e) => !m.value.location || !e.targetLocation || e.targetLocation.includes(m.value.location)
176
+ )
177
+ ), i = [
178
+ {
179
+ header: a("connect.voucher.voucherTitle"),
180
+ accessorFn: (e) => e.name
181
+ },
182
+ {
183
+ header: a("connect.voucher.status"),
184
+ cell(e) {
185
+ return D(e.row.original);
186
+ }
187
+ },
188
+ {
189
+ header: a("connect.voucher.summary"),
190
+ accessorFn: (e) => q(e)
191
+ },
192
+ {
193
+ header: a("connect.voucher.quota"),
194
+ accessorFn: (e) => {
195
+ var o;
196
+ return ((o = e.pf_collectible) == null ? void 0 : o.options.maxReceive) ?? "Unlimited";
197
+ }
198
+ },
199
+ {
200
+ header: a("connect.voucher.claimed"),
201
+ accessorFn: (e) => {
202
+ var o;
203
+ return ((o = e == null ? void 0 : e.pf_collectible) == null ? void 0 : o.currentReceive) ?? 0;
204
+ }
205
+ },
206
+ {
207
+ header: a("connect.voucher.actions"),
208
+ cell(e) {
209
+ return b("div", { class: "flex items-center justify-end" }, [
210
+ b(V.FmButton, {
211
+ icon: "visibility",
212
+ variant: "tertiary",
213
+ iconColor: "neutral-gray-400",
214
+ onClick: async (o) => {
215
+ o.stopPropagation(), await U.push({
216
+ name: G["$connect-CAMPAIGN_VOUCHER_COLLECTIONS"],
217
+ params: { id: e.row.original._id }
218
+ });
219
+ }
220
+ }),
221
+ b(
222
+ V.FmMenu,
223
+ {
224
+ placement: "bottom-end",
225
+ onClick: (o) => {
226
+ o.stopPropagation();
227
+ }
228
+ },
229
+ {
230
+ "menu-button": () => b(V.FmButton, {
231
+ icon: "more_vert",
232
+ iconColor: "neutral-gray-400",
233
+ variant: "tertiary"
234
+ }),
235
+ default: () => {
236
+ const o = [
237
+ b(
238
+ V.FmMenuItem,
239
+ {
240
+ onClick: async (s) => {
241
+ s.stopPropagation(), E(e.row.original);
242
+ }
243
+ },
244
+ {
245
+ label: b(
246
+ "div",
247
+ {
248
+ class: "text-fm-color-typo-error fm-typo-en-body-md-400"
249
+ },
250
+ a("connect.voucher.remove")
251
+ )
252
+ }
253
+ )
254
+ ];
255
+ return e.row.original.event.type === "SIMPLE_CLAIM" && (o.unshift(
256
+ b(V.FmMenuItem, {
257
+ label: a("connect.voucher.send"),
258
+ onClick: async (s) => {
259
+ var d;
260
+ s.stopPropagation(), (d = w.value) == null || d.showSheet({
261
+ campaignId: e.row.original._id
262
+ });
263
+ }
264
+ })
265
+ ), o.unshift(
266
+ b(V.FmMenuItem, {
267
+ label: a("connect.voucher.share"),
268
+ onClick: async (s) => {
269
+ if (s.stopPropagation(), e.row.original.event.type !== "SIMPLE_CLAIM")
270
+ return await z.confirm(
271
+ "Cannot share a voucher that is not a simple claim.",
272
+ "Share Voucher",
273
+ "OK"
274
+ );
275
+ await le(
276
+ `https://${ce().currentBusiness.value._id}.${xe.appUrl}/vouchers/${e.row.original._id}`,
277
+ {
278
+ successMessage: "Voucher link copied to clipboard"
279
+ }
280
+ );
281
+ }
282
+ })
283
+ )), o;
284
+ }
285
+ }
286
+ )
287
+ ]);
288
+ }
289
+ }
290
+ ], f = _(), w = _();
291
+ async function E(e) {
292
+ await z.remove(a("voucher.confirmRemove", { name: e.name })) && await u(
293
+ async () => {
294
+ await L.delete(e._id), await C.read("VOUCHER");
295
+ },
296
+ {
297
+ message: a("voucher.removing", { name: e.name }),
298
+ successMessage: a("voucher.removedSuccessfully", { name: e.name })
299
+ }
300
+ );
301
+ }
302
+ async function x(e) {
303
+ e ? await o() : P.open(async (s) => {
304
+ await o(s);
305
+ });
306
+ async function o(s) {
307
+ var d;
308
+ (d = f.value) == null || d.showSheet(
309
+ !0,
310
+ "VOUCHER",
311
+ e ? await L.readById(e._id) : void 0,
312
+ s
313
+ );
314
+ }
315
+ }
316
+ async function c(e) {
317
+ e.campaign._id && await new Promise((o) => {
318
+ R.open({
319
+ title: "Confirmation",
320
+ message: "This will change all future vouchers? Would you like to update previous claimed vouchers expiry date and discount?",
321
+ primaryActions: { text: "Update all", close: !0 },
322
+ secondaryActions: { text: "Update future only", close: !0 }
323
+ }).onPrimary(async () => {
324
+ var s;
325
+ e.updateCollections = !0, (s = window.top) == null || s.postMessage("updateAllVoucher", "*"), o();
326
+ }).onSecondary(async () => {
327
+ o();
328
+ });
329
+ }), await u(
330
+ async () => {
331
+ e.campaign._id ? await L.update(e.campaign._id, e) : await L.create(e), await C.read("VOUCHER");
332
+ },
333
+ {
334
+ message: a(
335
+ e.campaign._id ? "connect.voucher.updating" : "connect.voucher.creating"
336
+ ),
337
+ successMessage: a(
338
+ e.campaign._id ? "connect.voucher.updatedSuccessfully" : "connect.voucher.createdSuccessfully"
339
+ )
340
+ }
341
+ );
342
+ }
343
+ return J(async () => {
344
+ await v(async () => {
345
+ await C.read("VOUCHER");
346
+ });
347
+ }), (e, o) => {
348
+ const s = h("FmPageHead"), d = h("FmSearch"), B = h("FmTable"), p = h("FmButton"), Z = h("FmListItem"), Y = h("FmList"), ee = h("FmCard");
349
+ return y(), $(T, null, [
350
+ r(s, {
351
+ title: t(a)("connect.voucher.title"),
352
+ actions: t(S).length > 0 ? [A] : [],
353
+ "onClick:action": o[0] || (o[0] = () => x())
354
+ }, null, 8, ["title", "actions"]),
355
+ l("div", Ve, [
356
+ r(d, {
357
+ modelValue: t(m).searchKey,
358
+ "onUpdate:modelValue": o[1] || (o[1] = (n) => t(m).searchKey = n),
359
+ class: "hidden xs:block border-b-2 border-fm-color-neutral-gray-100",
360
+ placeholder: t(a)("connect.voucher.search"),
361
+ collapsible: ""
362
+ }, null, 8, ["modelValue", "placeholder"]),
363
+ t(C).campaigns.voucher && t(C).campaigns.voucher.length > 0 ? (y(), $(T, { key: 0 }, [
364
+ l("div", ke, [
365
+ l("div", Fe, [
366
+ r(de, {
367
+ modelValue: t(m).location,
368
+ "onUpdate:modelValue": o[2] || (o[2] = (n) => t(m).location = n),
369
+ label: t(a)("connect.voucher.location"),
370
+ "show-item-label": !0,
371
+ icon: "storefront",
372
+ placement: "bottom-start",
373
+ items: t(g).locationItems
374
+ }, null, 8, ["modelValue", "label", "items"])
375
+ ]),
376
+ r(d, {
377
+ modelValue: t(m).searchKey,
378
+ "onUpdate:modelValue": o[3] || (o[3] = (n) => t(m).searchKey = n),
379
+ class: "xs:hidden",
380
+ placeholder: t(a)("connect.voucher.search"),
381
+ collapsible: ""
382
+ }, null, 8, ["modelValue", "placeholder"])
383
+ ]),
384
+ r(B, {
385
+ class: "xs:hidden",
386
+ "row-data": t(S),
387
+ "column-defs": i,
388
+ "search-value": t(m).searchKey,
389
+ "column-filter": [],
390
+ onRowClick: o[4] || (o[4] = (n) => x(n.original)),
391
+ "hide-footer": t(S).length < 10
392
+ }, null, 8, ["row-data", "search-value", "hide-footer"]),
393
+ r(Y, { class: "hidden xs:flex flex-col mx-[-24px]" }, {
394
+ default: M(() => [
395
+ (y(!0), $(T, null, te(t(S).filter(
396
+ (n) => n.name.toLowerCase().includes(t(m).searchKey.toLowerCase())
397
+ ), (n) => (y(), k(Z, {
398
+ key: n._id.toString(),
399
+ onClick: (O) => x(n),
400
+ class: "py-12 px-16 flex items-center justify-between border-b border-fm-color-neutral-gray-100"
401
+ }, {
402
+ default: M(() => {
403
+ var O;
404
+ return [
405
+ l("div", Ie, [
406
+ l("div", Le, [
407
+ (y(), k(ae(t(D)(n)))),
408
+ l("div", Me, F(((O = n.pf_collectible) == null ? void 0 : O.currentReceive) ?? 0) + " claimed ", 1)
409
+ ]),
410
+ l("div", Re, [
411
+ l("div", Pe, F(n.name), 1),
412
+ l("div", Ue, F(t(q)(n)), 1)
413
+ ])
414
+ ]),
415
+ l("div", Ee, [
416
+ n.event.type === "SIMPLE_CLAIM" ? (y(), k(p, {
417
+ key: 0,
418
+ icon: "visibility",
419
+ "icon-color": "neutral-gray-400",
420
+ variant: "tertiary",
421
+ onClick: async (I) => {
422
+ I.stopPropagation(), await t(U).push({
423
+ name: t(G)["$connect-CAMPAIGN_VOUCHER_COLLECTIONS"],
424
+ params: { id: n._id }
425
+ });
426
+ }
427
+ }, null, 8, ["onClick"])) : K("", !0),
428
+ n.event.type === "SIMPLE_CLAIM" ? (y(), k(p, {
429
+ key: 1,
430
+ icon: "send",
431
+ "icon-color": "neutral-gray-400",
432
+ variant: "tertiary",
433
+ onClick: (I) => {
434
+ var H;
435
+ I.stopPropagation(), (H = t(w)) == null || H.showSheet({
436
+ campaignId: n._id
437
+ });
438
+ }
439
+ }, null, 8, ["onClick"])) : K("", !0),
440
+ r(p, {
441
+ icon: "delete",
442
+ "icon-color": "neutral-gray-400",
443
+ variant: "tertiary",
444
+ onClick: (I) => (I.stopPropagation(), E(n))
445
+ }, null, 8, ["onClick"])
446
+ ])
447
+ ];
448
+ }),
449
+ _: 2
450
+ }, 1032, ["onClick"]))), 128))
451
+ ]),
452
+ _: 1
453
+ })
454
+ ], 64)) : (y(), k(ee, {
455
+ key: 1,
456
+ variant: "outlined",
457
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
458
+ }, {
459
+ default: M(() => [
460
+ Ae,
461
+ l("div", Be, [
462
+ l("div", Oe, F(t(a)("connect.voucher.createVoucherCampaign")), 1),
463
+ l("div", $e, F(t(a)("connect.voucher.description")), 1)
464
+ ]),
465
+ r(p, {
466
+ variant: "primary",
467
+ label: t(a)("connect.voucher.createVoucherCampaign"),
468
+ icon: "add",
469
+ onClick: o[5] || (o[5] = (n) => x())
470
+ }, null, 8, ["label"])
471
+ ]),
472
+ _: 1
473
+ })),
474
+ r(me, {
475
+ ref_key: "sheetRef",
476
+ ref: f,
477
+ "onSubmit:modelValue": c
478
+ }, null, 512),
479
+ r(Se, {
480
+ ref_key: "sendVoucherSheetRef",
481
+ ref: w
482
+ }, null, 512)
483
+ ])
484
+ ], 64);
485
+ };
486
+ }
487
+ });
488
+ export {
489
+ so as default
490
+ };
@@ -0,0 +1,141 @@
1
+ import { h as s, defineComponent as v, useAttrs as N, resolveComponent as O, openBlock as c, createBlock as x, mergeProps as _, unref as a, createSlots as k, withCtx as T, createElementVNode as f, toDisplayString as m, renderSlot as I, createElementBlock as R, createCommentVNode as U } from "vue";
2
+ import { u as E } from "./vue-i18n-BXzrZRP6.js";
3
+ function Z(e, t) {
4
+ return e.path.join(".") === t;
5
+ }
6
+ function S(e, t) {
7
+ return e.some((n) => t == "" || Z(n, t)) ? "error" : "none";
8
+ }
9
+ function z(e, t) {
10
+ return e.filter((n) => t == "" || Z(n, t)).map((n) => n.message).join(",") || void 0;
11
+ }
12
+ const d = {
13
+ ZodIntersection: (e) => e._def.typeName == "ZodIntersection",
14
+ ZodNullable: (e) => e._def.typeName == "ZodNullable",
15
+ ZodOptional: (e) => e._def.typeName == "ZodOptional",
16
+ ZodEffects: (e) => e._def.typeName == "ZodEffects",
17
+ ZodDiscriminatedUnion: (e) => e._def.typeName == "ZodDiscriminatedUnion",
18
+ ZodUnion: (e) => e._def.typeName == "ZodUnion",
19
+ ZodLazy: (e) => e._def.typeName == "ZodLazy",
20
+ ZodRecord: (e) => e._def.typeName == "ZodRecord",
21
+ ZodObject: (e) => e._def.typeName == "ZodObject"
22
+ };
23
+ function b(e) {
24
+ return !(d.ZodNullable(e) || d.ZodOptional(e));
25
+ }
26
+ function i(e, t = []) {
27
+ function n(r) {
28
+ const o = [r._def.left, r._def.right];
29
+ return d.ZodObject(o[0]) && d.ZodObject(o[1]) ? Object.keys(o[0].shape).length > Object.keys(o[1].shape).length ? o[0] : o[1] : o.find((l) => d.ZodDiscriminatedUnion(l)) || o.find((l) => d.ZodObject(l)) || o[1];
30
+ }
31
+ if ((d.ZodNullable(e) || d.ZodOptional(e)) && (e = i(e.unwrap(), t)), d.ZodEffects(e) && (e = i(e.sourceType(), t)), d.ZodDiscriminatedUnion(e)) {
32
+ const r = Object.fromEntries(e.optionsMap.entries());
33
+ if (t.length) {
34
+ const o = t.shift(), l = r[o];
35
+ return i(l, t);
36
+ }
37
+ return console.log(
38
+ "discriminatedUnion found but no KEY supplied, keys:",
39
+ Object.keys(r)
40
+ ), e;
41
+ }
42
+ return d.ZodLazy(e) && (e = i(e._def.getter(), t)), d.ZodIntersection(e) && (e = i(n(e), t)), e;
43
+ }
44
+ function g(e, t, n = []) {
45
+ return t === "" ? i(e, n) : t.split(".").reduce((r, o) => {
46
+ const l = i(r, n);
47
+ return d.ZodObject(l) ? l.shape[o] : r;
48
+ }, e);
49
+ }
50
+ function h(e, t) {
51
+ return (n) => {
52
+ const r = e.safeParse(n);
53
+ return r.success ? !0 : (console.log(r.error.errors), r.error.errors.filter((o) => !t || o.path.join(".") === t).map((o) => o.message).join(", "));
54
+ };
55
+ }
56
+ function L(e, t, n = []) {
57
+ return h(g(e, t, n));
58
+ }
59
+ function P(e, t) {
60
+ if (!t) return;
61
+ const n = b(e) ? "hidden" : "";
62
+ return s(
63
+ "div",
64
+ { class: "flex items-center gap-x-4 fm-typo-en-body-lg-400" },
65
+ [
66
+ s("div", t),
67
+ s(
68
+ "div",
69
+ {
70
+ class: `text-fm-color-typo-secondary ${n}`
71
+ },
72
+ "(optional)"
73
+ )
74
+ ]
75
+ );
76
+ }
77
+ const p = {
78
+ helperState: S,
79
+ helperText: z,
80
+ typeAtPath: g,
81
+ toRule: h,
82
+ ruleAtPath: L,
83
+ isRequired: b,
84
+ toInputLabel: P,
85
+ unwrap: i
86
+ }, V = { class: "fm-typo-en-body-lg-400 flex gap-4 text-fm-color-typo-primary items-center" }, A = {
87
+ key: 0,
88
+ class: "text-fm-color-typo-tertiary"
89
+ }, q = /* @__PURE__ */ v({
90
+ __name: "ZodTextField",
91
+ props: {
92
+ label: {
93
+ type: String,
94
+ required: !1
95
+ },
96
+ schema: {
97
+ type: Object,
98
+ required: !0
99
+ },
100
+ modelValue: {
101
+ type: String
102
+ },
103
+ disabled: {
104
+ type: Boolean,
105
+ default: !1
106
+ }
107
+ },
108
+ emits: ["update:model-value", "focus-changed"],
109
+ setup(e, { emit: t }) {
110
+ const { t: n } = E(), r = t, o = N();
111
+ return (l, u) => {
112
+ const y = O("FmTextField");
113
+ return c(), x(y, _({
114
+ "model-value": e.modelValue,
115
+ "onUpdate:modelValue": u[0] || (u[0] = (j) => r("update:model-value", j)),
116
+ disabled: e.disabled
117
+ }, a(o), {
118
+ rules: [a(p).toRule(e.schema)]
119
+ }), k({ _: 2 }, [
120
+ e.label ? {
121
+ name: "label",
122
+ fn: T(() => [
123
+ f("div", V, [
124
+ f("div", null, m(e.label), 1),
125
+ I(l.$slots, "append-label", {}, () => [
126
+ a(p).isRequired(e.schema) ? U("", !0) : (c(), R("div", A, m(a(n)("connect.common.optional")), 1))
127
+ ])
128
+ ])
129
+ ]),
130
+ key: "0"
131
+ } : void 0
132
+ ]), 1040, ["model-value", "disabled", "rules"]);
133
+ };
134
+ }
135
+ });
136
+ export {
137
+ p as Z,
138
+ q as _,
139
+ z as a,
140
+ S as g
141
+ };