@feedmepos/mf-connect 0.1.0-beta.9 → 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-DQUbRsdA.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-D-BFllvG.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-C_ZKNWzb.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-zSxSnUkK.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-CTKKhH-r.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-2Jqj_rKv.js → StoreTransactions.vue_vue_type_script_setup_true_lang-RTfozD01.js} +10 -10
  29. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-BkdSj0cX.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BGI78ycg.js} +1 -1
  30. package/dist/{Tier-Cpl0FV8L.js → Tier-BnQRujpX.js} +453 -481
  31. package/dist/{Title-CbMDd1Et.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-VxaUCtgl.js → app-DHE61XdR.js} +1 -1
  37. package/dist/app.js +3 -5
  38. package/dist/{business-DR7jpnLz.js → business-BSo7EPan.js} +1 -1
  39. package/dist/{campaign-MqcTb329.js → campaign-CsOje3Ap.js} +3 -5
  40. package/dist/{collection.fn-CvEoe61K.js → collection.fn-BYQfFJOr.js} +2 -2
  41. package/dist/dto-CfEXSCq6.js +1145 -0
  42. package/dist/{effect-BjjQeiQg.js → effect-Bn_ofYS3.js} +9 -9
  43. package/dist/{export-B8cvWh5n.js → export-CMR243CF.js} +3 -3
  44. package/dist/{helper-DfgVNY7B.js → helper-BqOQRtvW.js} +1 -1
  45. package/dist/index-BLDYTxnc.js +28058 -0
  46. package/dist/{index-C2JNcGc-.js → index-BWnFs-Cb.js} +281 -299
  47. package/dist/{index-B5NufbUt.js → index-BaBNmzUb.js} +1 -1
  48. package/dist/{index-CWR3qYjb.js → index-Boo5np6l.js} +1 -1
  49. package/dist/{index-BsfWRB8R.js → index-CC1GV8OW.js} +1 -1
  50. package/dist/{index-0UYoh1-7.js → index-CHO4_zsT.js} +1 -1
  51. package/dist/{index-2P9w5u3m.js → index-DEZsrQ2f.js} +3 -3
  52. package/dist/{index-C7zMfUgy.js → index-D_f2lmK2.js} +1 -1
  53. package/dist/{index-Dap5R3vr.js → index-Da142OER.js} +66 -78
  54. package/dist/index-DbP04yeg.js +11 -0
  55. package/dist/{index-DBy30v8N.js → index-DtPe-TEm.js} +3 -3
  56. package/dist/{index-CJ8Uh2Ja.js → index-FvlaxwGB.js} +3 -3
  57. package/dist/{index.esm2017-D1X3PgpO.js → index.esm2017-ePm--Atp.js} +55 -55
  58. package/dist/{loading-CJ3nOovJ.js → loading-KNmEMBUB.js} +460 -469
  59. package/dist/{membership-B1cmSRyk.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-ChWyR-0j.js → rule-CzamI50_.js} +2 -2
  63. package/dist/{rule-builder-CSmOONdb.js → rule-builder-DHf6wfaQ.js} +1 -1
  64. package/dist/style.css +1 -1
  65. package/dist/{template-Cug7aRK0.js → template-CFAIPoD7.js} +63 -63
  66. package/dist/{usePagination-BeF5K3M7.js → usePagination-JoYaROkV.js} +85 -85
  67. package/dist/{xlsx-CfgPFFvp.js → xlsx-BDJMaozs.js} +517 -517
  68. package/package.json +4 -7
  69. package/dist/Analytic-CMXUjK_F.js +0 -622
  70. package/dist/Broadcast-DowFtHv6.js +0 -223
  71. package/dist/Card-C7rhL0pV.js +0 -825
  72. package/dist/Collections-B-1wlk3r.js +0 -453
  73. package/dist/Credit-DDjozmoF.js +0 -220
  74. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-pwMuIgs5.js +0 -345
  75. package/dist/Experience-BbE-c1Op.js +0 -221
  76. package/dist/Game-DQdRpaN-.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-Dgmxzg4h.js +0 -316
  80. package/dist/Member-w23oRVwN.js +0 -69
  81. package/dist/MemberList-BLIdjznQ.js +0 -1735
  82. package/dist/MemberOverview-wL_ailso.js +0 -58
  83. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-Dy_lMdZA.js +0 -432
  84. package/dist/Mission-Cjt0E083.js +0 -261
  85. package/dist/Point-CQJL3Ewu.js +0 -222
  86. package/dist/Promotion-BYViH3bu.js +0 -247
  87. package/dist/Segment-B9Jj1ak0.js +0 -437
  88. package/dist/Setting-DXWbgRxs.js +0 -1901
  89. package/dist/Store-Dswk2e_z.js +0 -1511
  90. package/dist/StoreRewards-CNUhG_Ue.js +0 -401
  91. package/dist/Transaction-BB-kk-84.js +0 -39
  92. package/dist/Voucher-b1_Jlm6X.js +0 -490
  93. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-pG-SrXp9.js +0 -56
  94. package/dist/app-DCHKJoql.js +0 -5639
  95. package/dist/dto-jcK3TGB7.js +0 -2770
  96. package/dist/index-Cv7pLAYq.js +0 -3
  97. package/dist/index-LrSSauN2.js +0 -29193
  98. package/dist/money-BEATdGS6.js +0 -15
  99. package/dist/number-CeAYAKCp.js +0 -12
  100. package/dist/vue-i18n-BRhKDHdF.js +0 -2365
  101. package/dist/zod-Bg2FbC-D.js +0 -90
@@ -0,0 +1,36 @@
1
+ import { defineComponent as _, ref as d, resolveComponent as c, openBlock as o, createElementBlock as v, Fragment as f, createVNode as s, createElementVNode as b, unref as t, createBlock as a, KeepAlive as k, resolveDynamicComponent as m, createCommentVNode as x } from "vue";
2
+ import { _ as C, a as F } from "./StoreTransactions.vue_vue_type_script_setup_true_lang-RTfozD01.js";
3
+ const T = { class: "px-24 flex flex-col gap-y-32 pb-24" }, N = /* @__PURE__ */ _({
4
+ __name: "Transaction",
5
+ setup(g) {
6
+ const l = [
7
+ {
8
+ label: "Collection",
9
+ value: "collection"
10
+ },
11
+ {
12
+ label: "Store",
13
+ value: "store"
14
+ }
15
+ ], e = d(l[0]);
16
+ return (y, n) => {
17
+ const r = c("FmPageHead"), u = c("FmTabs");
18
+ return o(), v(f, null, [
19
+ s(r, { title: "Transactions" }),
20
+ b("div", T, [
21
+ s(u, {
22
+ "model-value": t(e).value,
23
+ items: l,
24
+ "onUpdate:modelValue": n[0] || (n[0] = (i) => e.value = l.find((p) => p.value === i))
25
+ }, null, 8, ["model-value"]),
26
+ (o(), a(k, null, [
27
+ t(e).value == "collection" ? (o(), a(m(C), { key: 0 })) : t(e).value == "store" ? (o(), a(m(F), { key: 1 })) : x("", !0)
28
+ ], 1024))
29
+ ])
30
+ ], 64);
31
+ };
32
+ }
33
+ });
34
+ export {
35
+ N as default
36
+ };
@@ -0,0 +1,485 @@
1
+ import { defineComponent as X, ref as y, watch as N, onMounted as J, resolveComponent as p, openBlock as g, createBlock as V, unref as t, isRef as j, withCtx as I, createElementVNode as s, createVNode as r, toDisplayString as U, computed as ee, createElementBlock as O, Fragment as T, renderList as ae, resolveDynamicComponent as te, createCommentVNode as K, h as _ } from "vue";
2
+ import { _ as oe } from "./campaign-CpzFl8Vr.js";
3
+ import { useDialog as ne, components as x } from "@feedmepos/ui-library";
4
+ import { u as Q, p as z, a as se } from "./loading-KNmEMBUB.js";
5
+ import { useCoreStore as le } from "@feedmepos/mf-common";
6
+ import { u as ie } from "./business-BSo7EPan.js";
7
+ import { u as re } from "./campaign-CsOje3Ap.js";
8
+ import { g as D, b as q } from "./dto-CfEXSCq6.js";
9
+ import { R as ce } from "./index-DbP04yeg.js";
10
+ import { u as me } from "./template-CFAIPoD7.js";
11
+ import { _ as ue } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-we7ADwFk.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-CHO4_zsT.js";
17
+ import { c as F } from "./index-Boo5np6l.js";
18
+ import { useRouter as ye } from "vue-router";
19
+ import { R as G } from "./app-Bt59niI-.js";
20
+ const _e = { class: "space-y-16" }, ve = { class: "fm-typo-en-body-md-600" }, Ce = { class: "flex items-center justify-end" }, be = { class: "flex items-center gap-8" }, we = /* @__PURE__ */ X({
21
+ __name: "SendVoucherSheet",
22
+ emits: ["success"],
23
+ setup(W, { expose: M, emit: R }) {
24
+ const { minor: P } = Q, L = y(""), i = y({}), E = R, f = y(!1), m = y([]);
25
+ function u(e) {
26
+ f.value = !0, L.value = e.campaignId, m.value = [];
27
+ }
28
+ function v() {
29
+ f.value = !1;
30
+ }
31
+ const $ = [
32
+ {
33
+ header: "Name",
34
+ accessorFn: (e) => e.name || "No Profile"
35
+ },
36
+ {
37
+ header: "Phone",
38
+ accessorFn: (e) => e.phoneNumber || "-"
39
+ }
40
+ ], l = y({
41
+ searchValue: "",
42
+ pageSize: 10,
43
+ pageCount: 0,
44
+ pageIndex: 0,
45
+ totalRows: 0,
46
+ isLoading: !1
47
+ }), d = y([]), C = async (e) => {
48
+ l.value.isLoading = !0, d.value = [];
49
+ const a = await ge.read({
50
+ limit: e.pageSize,
51
+ skip: e.pageIndex,
52
+ sortBy: "_id",
53
+ search: l.value.searchValue,
54
+ descending: !1
55
+ });
56
+ d.value = a.resources, l.value.totalRows = a.meta.totalResources ?? 0, l.value.pageCount = a.meta.totalPages ?? 0, l.value.isLoading = !1, i.value = {}, m.value.forEach((o) => {
57
+ const c = d.value.findIndex((w) => w._id == o);
58
+ c > -1 && (console.log(c, "fetch member index"), i.value[c] = !0);
59
+ });
60
+ };
61
+ function b() {
62
+ d.value.length > 0 && (m.value = m.value.filter(
63
+ (e) => !d.value.some((a) => a._id === e) || // Keep if not in current page
64
+ Object.entries(i.value).some(
65
+ ([a, o]) => o && d.value[a]._id === e
66
+ // Keep if selected in current page
67
+ )
68
+ ));
69
+ for (const [e, a] of Object.entries(i.value))
70
+ if (a) {
71
+ const o = d.value[e]._id;
72
+ m.value.includes(o) || m.value.push(o);
73
+ }
74
+ }
75
+ async function A(e) {
76
+ m.value.length < 1 || await P(
77
+ async () => {
78
+ await F.sendCollection(L.value, {
79
+ memberId: m.value
80
+ }), await E("success"), v();
81
+ },
82
+ {
83
+ message: "Sending claim(s)",
84
+ successMessage: "Claim(s) created"
85
+ }
86
+ );
87
+ }
88
+ return N(i, b, { deep: !0 }), N(
89
+ () => l.value.searchValue,
90
+ he.debounce(async () => {
91
+ await C({ pageSize: 10, pageIndex: 0 });
92
+ }, 500)
93
+ ), M({
94
+ showSheet: u,
95
+ hideSheet: v
96
+ }), J(async () => {
97
+ await C(l.value);
98
+ }), (e, a) => {
99
+ const o = p("FmSearch"), c = p("FmTable"), w = p("FmButton"), S = p("FmSideSheet");
100
+ return g(), V(S, {
101
+ "max-width": 560,
102
+ "dismiss-away": !0,
103
+ header: "Send voucher to",
104
+ modelValue: t(f),
105
+ "onUpdate:modelValue": [
106
+ a[3] || (a[3] = (h) => j(f) ? f.value = h : null),
107
+ a[4] || (a[4] = (h) => f.value = h)
108
+ ]
109
+ }, {
110
+ "side-sheet-footer": I(() => [
111
+ s("div", be, [
112
+ r(w, {
113
+ label: "Send",
114
+ loading: t(fe)().isLoading,
115
+ onClick: A
116
+ }, null, 8, ["loading"]),
117
+ r(w, {
118
+ label: "Cancel",
119
+ type: "button",
120
+ variant: "tertiary",
121
+ onClick: a[2] || (a[2] = (h) => f.value = !1)
122
+ })
123
+ ])
124
+ ]),
125
+ default: I(() => [
126
+ r(pe, { json: t(m) }, null, 8, ["json"]),
127
+ s("div", _e, [
128
+ s("div", ve, U(t(m).length) + " members selected ", 1),
129
+ s("div", Ce, [
130
+ r(o, {
131
+ class: "mt-4",
132
+ modelValue: t(l).searchValue,
133
+ "onUpdate:modelValue": a[0] || (a[0] = (h) => t(l).searchValue = h),
134
+ placeholder: "Search Member",
135
+ collapsible: ""
136
+ }, null, 8, ["modelValue"])
137
+ ]),
138
+ r(c, {
139
+ modelValue: t(i),
140
+ "onUpdate:modelValue": a[1] || (a[1] = (h) => j(i) ? i.value = h : null),
141
+ selection: "multiple",
142
+ loading: t(l).isLoading,
143
+ "row-data": t(d),
144
+ "column-defs": $,
145
+ "page-size": t(l).pageSize,
146
+ "page-count": t(l).pageCount,
147
+ "hide-footer": t(l).totalRows <= t(l).pageSize,
148
+ "fetch-fn": C
149
+ }, null, 8, ["modelValue", "loading", "row-data", "page-size", "page-count", "hide-footer"])
150
+ ])
151
+ ]),
152
+ _: 1
153
+ }, 8, ["modelValue"]);
154
+ };
155
+ }
156
+ });
157
+ var Se = { 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" };
158
+ const xe = { class: "px-24 flex flex-col gap-y-16" }, Ve = { class: "flex items-center justify-between w-full" }, ke = { class: "flex gap-8 overflow-x-auto" }, Fe = { class: "space-y-8" }, Ie = { class: "flex w-full gap-4 items-center" }, Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le = { class: "space-y-4" }, Ue = { class: "fm-typo-en-body-lg-600" }, Me = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Pe = { class: "flex gap-8 items-center" }, Ee = /* @__PURE__ */ s("img", {
159
+ src: oe,
160
+ class: "aspect-square w-[150px]"
161
+ }, null, -1), $e = /* @__PURE__ */ s("div", { class: "flex flex-col gap-16 text-center" }, [
162
+ /* @__PURE__ */ s("div", { class: "fm-typo-en-title-sm-800" }, "Create voucher campaign"),
163
+ /* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " A digital coupon that users can redeem for discounts on future purchases. Users usually need to claim and apply the voucher to benefit from the discount. ")
164
+ ], -1), aa = /* @__PURE__ */ X({
165
+ __name: "Voucher",
166
+ setup(W) {
167
+ const M = {
168
+ label: "Create campaign",
169
+ value: "create",
170
+ isPrimary: !0,
171
+ prependIcon: "add"
172
+ }, R = ne(), P = me("VOUCHER", R), L = ie(), i = re(), { global: E, minor: f } = Q, m = ye(), u = y({
173
+ searchKey: "",
174
+ location: null
175
+ }), v = ee(
176
+ () => i.campaigns.voucher.filter(
177
+ (e) => !u.value.location || !e.targetLocation || e.targetLocation.includes(u.value.location)
178
+ )
179
+ ), $ = [
180
+ {
181
+ header: "Voucher title",
182
+ accessorFn: (e) => e.name
183
+ },
184
+ {
185
+ header: "Status",
186
+ cell(e) {
187
+ return D(e.row.original);
188
+ }
189
+ },
190
+ {
191
+ header: "Summary",
192
+ accessorFn: (e) => q(e)
193
+ },
194
+ {
195
+ header: "Quota",
196
+ accessorFn: (e) => {
197
+ var a;
198
+ return ((a = e.pf_collectible) == null ? void 0 : a.options.maxReceive) ?? "Unlimited";
199
+ }
200
+ },
201
+ {
202
+ header: "Claimed",
203
+ accessorFn: (e) => {
204
+ var a;
205
+ return ((a = e == null ? void 0 : e.pf_collectible) == null ? void 0 : a.currentReceive) ?? 0;
206
+ }
207
+ },
208
+ {
209
+ header: "Actions",
210
+ cell(e) {
211
+ return _("div", { class: "flex items-center justify-end" }, [
212
+ _(x.FmButton, {
213
+ icon: "visibility",
214
+ variant: "tertiary",
215
+ iconColor: "neutral-gray-400",
216
+ onClick: async (a) => {
217
+ a.stopPropagation(), await m.push({
218
+ name: G["$connect-CAMPAIGN_VOUCHER_COLLECTIONS"],
219
+ params: { id: e.row.original._id }
220
+ });
221
+ }
222
+ }),
223
+ _(
224
+ x.FmMenu,
225
+ {
226
+ placement: "bottom-end",
227
+ onClick: (a) => {
228
+ a.stopPropagation();
229
+ }
230
+ },
231
+ {
232
+ "menu-button": () => _(x.FmButton, {
233
+ icon: "more_vert",
234
+ iconColor: "neutral-gray-400",
235
+ variant: "tertiary"
236
+ }),
237
+ default: () => {
238
+ const a = [
239
+ _(
240
+ x.FmMenuItem,
241
+ {
242
+ onClick: async (o) => {
243
+ o.stopPropagation(), C(e.row.original);
244
+ }
245
+ },
246
+ {
247
+ label: _(
248
+ "div",
249
+ {
250
+ class: "text-fm-color-typo-error fm-typo-en-body-md-400"
251
+ },
252
+ "Remove"
253
+ )
254
+ }
255
+ )
256
+ ];
257
+ return e.row.original.event.type === "SIMPLE_CLAIM" && (a.unshift(
258
+ _(x.FmMenuItem, {
259
+ label: "Send",
260
+ onClick: async (o) => {
261
+ var c;
262
+ o.stopPropagation(), (c = d.value) == null || c.showSheet({
263
+ campaignId: e.row.original._id
264
+ });
265
+ }
266
+ })
267
+ ), a.unshift(
268
+ _(x.FmMenuItem, {
269
+ label: "Share",
270
+ onClick: async (o) => {
271
+ if (o.stopPropagation(), e.row.original.event.type !== "SIMPLE_CLAIM")
272
+ return await z.confirm(
273
+ "Cannot share a voucher that is not a simple claim.",
274
+ "Share Voucher",
275
+ "OK"
276
+ );
277
+ await se(
278
+ `https://${le().currentBusiness.value._id}.${Se.appUrl}/vouchers/${e.row.original._id}`,
279
+ {
280
+ successMessage: "Voucher link copied to clipboard"
281
+ }
282
+ );
283
+ }
284
+ })
285
+ )), a;
286
+ }
287
+ }
288
+ )
289
+ ]);
290
+ }
291
+ }
292
+ ], l = y(), d = y();
293
+ async function C(e) {
294
+ await z.remove(`Are you sure you want to remove ${e.name}?`) && await f(
295
+ async () => {
296
+ await F.delete(e._id), await i.read("VOUCHER");
297
+ },
298
+ {
299
+ message: `Removing ${e.name}`,
300
+ successMessage: `Removed ${e.name} successfully`
301
+ }
302
+ );
303
+ }
304
+ async function b(e) {
305
+ e ? await a() : P.open(async (o) => {
306
+ await a(o);
307
+ });
308
+ async function a(o) {
309
+ var c;
310
+ (c = l.value) == null || c.showSheet(
311
+ !0,
312
+ "VOUCHER",
313
+ e ? await F.readById(e._id) : void 0,
314
+ o
315
+ );
316
+ }
317
+ }
318
+ async function A(e) {
319
+ e.campaign._id && await new Promise((a) => {
320
+ R.open({
321
+ title: "Confirmation",
322
+ message: "This will change all future vouchers? Would you like to update previous claimed vouchers expiry date and discount?",
323
+ primaryActions: { text: "Update all", close: !0 },
324
+ secondaryActions: { text: "Update future only", close: !0 }
325
+ }).onPrimary(async () => {
326
+ var o;
327
+ e.updateCollections = !0, (o = window.top) == null || o.postMessage("updateAllVoucher", "*"), a();
328
+ }).onSecondary(async () => {
329
+ a();
330
+ });
331
+ }), await f(
332
+ async () => {
333
+ e.campaign._id ? await F.update(e.campaign._id, e) : await F.create(e), await i.read("VOUCHER");
334
+ },
335
+ {
336
+ message: `${e.campaign._id ? "Updating" : "Creating"} voucher`,
337
+ successMessage: `Voucher ${e.campaign._id ? "updated" : "created"} successfully`
338
+ }
339
+ );
340
+ }
341
+ return J(async () => {
342
+ await E(async () => {
343
+ await i.read("VOUCHER");
344
+ });
345
+ }), (e, a) => {
346
+ const o = p("FmPageHead"), c = p("FmSearch"), w = p("FmTable"), S = p("FmButton"), h = p("FmListItem"), Z = p("FmList"), Y = p("FmCard");
347
+ return g(), O(T, null, [
348
+ r(o, {
349
+ title: "Voucher",
350
+ actions: t(v).length > 0 ? [M] : [],
351
+ "onClick:action": a[0] || (a[0] = () => b())
352
+ }, null, 8, ["actions"]),
353
+ s("div", xe, [
354
+ r(c, {
355
+ modelValue: t(u).searchKey,
356
+ "onUpdate:modelValue": a[1] || (a[1] = (n) => t(u).searchKey = n),
357
+ class: "hidden xs:block border-b-2 border-fm-color-neutral-gray-100",
358
+ placeholder: "search",
359
+ collapsible: ""
360
+ }, null, 8, ["modelValue"]),
361
+ t(i).campaigns.voucher && t(i).campaigns.voucher.length > 0 ? (g(), O(T, { key: 0 }, [
362
+ s("div", Ve, [
363
+ s("div", ke, [
364
+ r(de, {
365
+ modelValue: t(u).location,
366
+ "onUpdate:modelValue": a[2] || (a[2] = (n) => t(u).location = n),
367
+ label: "Location: ",
368
+ "show-item-label": !0,
369
+ icon: "storefront",
370
+ placement: "bottom-start",
371
+ items: t(L).locationItems
372
+ }, null, 8, ["modelValue", "items"])
373
+ ]),
374
+ r(c, {
375
+ modelValue: t(u).searchKey,
376
+ "onUpdate:modelValue": a[3] || (a[3] = (n) => t(u).searchKey = n),
377
+ class: "xs:hidden",
378
+ placeholder: "search",
379
+ collapsible: ""
380
+ }, null, 8, ["modelValue"])
381
+ ]),
382
+ r(w, {
383
+ class: "xs:hidden",
384
+ "row-data": t(v),
385
+ "column-defs": $,
386
+ "search-value": t(u).searchKey,
387
+ "column-filter": [],
388
+ onRowClick: a[4] || (a[4] = (n) => b(n.original)),
389
+ "hide-footer": t(v).length < 10
390
+ }, null, 8, ["row-data", "search-value", "hide-footer"]),
391
+ r(Z, { class: "hidden xs:flex flex-col mx-[-24px]" }, {
392
+ default: I(() => [
393
+ (g(!0), O(T, null, ae(t(v).filter(
394
+ (n) => n.name.toLowerCase().includes(t(u).searchKey.toLowerCase())
395
+ ), (n) => (g(), V(h, {
396
+ key: n._id.toString(),
397
+ onClick: (B) => b(n),
398
+ class: "py-12 px-16 flex items-center justify-between border-b border-fm-color-neutral-gray-100"
399
+ }, {
400
+ default: I(() => {
401
+ var B;
402
+ return [
403
+ s("div", Fe, [
404
+ s("div", Ie, [
405
+ (g(), V(te(t(D)(n)))),
406
+ s("div", Re, U(((B = n.pf_collectible) == null ? void 0 : B.currentReceive) ?? 0) + " claimed ", 1)
407
+ ]),
408
+ s("div", Le, [
409
+ s("div", Ue, U(n.name), 1),
410
+ s("div", Me, U(t(q)(n)), 1)
411
+ ])
412
+ ]),
413
+ s("div", Pe, [
414
+ n.event.type === "SIMPLE_CLAIM" ? (g(), V(S, {
415
+ key: 0,
416
+ icon: "visibility",
417
+ "icon-color": "neutral-gray-400",
418
+ variant: "tertiary",
419
+ onClick: async (k) => {
420
+ k.stopPropagation(), await t(ce).push({
421
+ name: t(G)["$connect-CAMPAIGN_VOUCHER_COLLECTIONS"],
422
+ params: { id: n._id }
423
+ });
424
+ }
425
+ }, null, 8, ["onClick"])) : K("", !0),
426
+ n.event.type === "SIMPLE_CLAIM" ? (g(), V(S, {
427
+ key: 1,
428
+ icon: "send",
429
+ "icon-color": "neutral-gray-400",
430
+ variant: "tertiary",
431
+ onClick: (k) => {
432
+ var H;
433
+ k.stopPropagation(), (H = t(d)) == null || H.showSheet({
434
+ campaignId: n._id
435
+ });
436
+ }
437
+ }, null, 8, ["onClick"])) : K("", !0),
438
+ r(S, {
439
+ icon: "delete",
440
+ "icon-color": "neutral-gray-400",
441
+ variant: "tertiary",
442
+ onClick: (k) => (k.stopPropagation(), C(n))
443
+ }, null, 8, ["onClick"])
444
+ ])
445
+ ];
446
+ }),
447
+ _: 2
448
+ }, 1032, ["onClick"]))), 128))
449
+ ]),
450
+ _: 1
451
+ })
452
+ ], 64)) : (g(), V(Y, {
453
+ key: 1,
454
+ variant: "outlined",
455
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
456
+ }, {
457
+ default: I(() => [
458
+ Ee,
459
+ $e,
460
+ r(S, {
461
+ variant: "primary",
462
+ label: "Create voucher campaign",
463
+ icon: "add",
464
+ onClick: a[5] || (a[5] = (n) => b())
465
+ })
466
+ ]),
467
+ _: 1
468
+ })),
469
+ r(ue, {
470
+ ref_key: "sheetRef",
471
+ ref: l,
472
+ "onSubmit:modelValue": A
473
+ }, null, 512),
474
+ r(we, {
475
+ ref_key: "sendVoucherSheetRef",
476
+ ref: d
477
+ }, null, 512)
478
+ ])
479
+ ], 64);
480
+ };
481
+ }
482
+ });
483
+ export {
484
+ aa as default
485
+ };
@@ -0,0 +1,140 @@
1
+ import { h as a, defineComponent as y, useAttrs as j, resolveComponent as v, openBlock as u, createBlock as N, mergeProps as O, unref as s, createSlots as x, withCtx as _, createElementVNode as c, toDisplayString as k, renderSlot as T, createElementBlock as R, createCommentVNode as U } from "vue";
2
+ function m(e, t) {
3
+ return e.path.join(".") === t;
4
+ }
5
+ function E(e, t) {
6
+ return e.some((n) => t == "" || m(n, t)) ? "error" : "none";
7
+ }
8
+ function I(e, t) {
9
+ return e.filter((n) => t == "" || m(n, t)).map((n) => n.message).join(",") || void 0;
10
+ }
11
+ const r = {
12
+ ZodIntersection: (e) => e._def.typeName == "ZodIntersection",
13
+ ZodNullable: (e) => e._def.typeName == "ZodNullable",
14
+ ZodOptional: (e) => e._def.typeName == "ZodOptional",
15
+ ZodEffects: (e) => e._def.typeName == "ZodEffects",
16
+ ZodDiscriminatedUnion: (e) => e._def.typeName == "ZodDiscriminatedUnion",
17
+ ZodUnion: (e) => e._def.typeName == "ZodUnion",
18
+ ZodLazy: (e) => e._def.typeName == "ZodLazy",
19
+ ZodRecord: (e) => e._def.typeName == "ZodRecord",
20
+ ZodObject: (e) => e._def.typeName == "ZodObject"
21
+ };
22
+ function p(e) {
23
+ return !(r.ZodNullable(e) || r.ZodOptional(e));
24
+ }
25
+ function i(e, t = []) {
26
+ function n(d) {
27
+ const o = [d._def.left, d._def.right];
28
+ return r.ZodObject(o[0]) && r.ZodObject(o[1]) ? Object.keys(o[0].shape).length > Object.keys(o[1].shape).length ? o[0] : o[1] : o.find((l) => r.ZodDiscriminatedUnion(l)) || o.find((l) => r.ZodObject(l)) || o[1];
29
+ }
30
+ if ((r.ZodNullable(e) || r.ZodOptional(e)) && (e = i(e.unwrap(), t)), r.ZodEffects(e) && (e = i(e.sourceType(), t)), r.ZodDiscriminatedUnion(e)) {
31
+ const d = Object.fromEntries(e.optionsMap.entries());
32
+ if (t.length) {
33
+ const o = t.shift(), l = d[o];
34
+ return i(l, t);
35
+ }
36
+ return console.log(
37
+ "discriminatedUnion found but no KEY supplied, keys:",
38
+ Object.keys(d)
39
+ ), e;
40
+ }
41
+ return r.ZodLazy(e) && (e = i(e._def.getter(), t)), r.ZodIntersection(e) && (e = i(n(e), t)), e;
42
+ }
43
+ function Z(e, t, n = []) {
44
+ return t === "" ? i(e, n) : t.split(".").reduce((d, o) => {
45
+ const l = i(d, n);
46
+ return r.ZodObject(l) ? l.shape[o] : d;
47
+ }, e);
48
+ }
49
+ function b(e, t) {
50
+ return (n) => {
51
+ const d = e.safeParse(n);
52
+ return d.success ? !0 : d.error.errors.filter((o) => !t || o.path.join(".") === t).map((o) => o.message).join(", ");
53
+ };
54
+ }
55
+ function S(e, t, n = []) {
56
+ return b(Z(e, t, n));
57
+ }
58
+ function z(e, t) {
59
+ if (!t) return;
60
+ const n = p(e) ? "hidden" : "";
61
+ return a(
62
+ "div",
63
+ { class: "flex items-center gap-x-4 fm-typo-en-body-lg-400" },
64
+ [
65
+ a("div", t),
66
+ a(
67
+ "div",
68
+ {
69
+ class: `text-fm-color-typo-secondary ${n}`
70
+ },
71
+ "(optional)"
72
+ )
73
+ ]
74
+ );
75
+ }
76
+ const f = {
77
+ helperState: E,
78
+ helperText: I,
79
+ typeAtPath: Z,
80
+ toRule: b,
81
+ ruleAtPath: S,
82
+ isRequired: p,
83
+ toInputLabel: z,
84
+ unwrap: i
85
+ }, L = { class: "fm-typo-en-body-lg-400 flex gap-4 text-fm-color-typo-primary items-center" }, P = {
86
+ key: 0,
87
+ class: "text-fm-color-typo-tertiary"
88
+ }, A = /* @__PURE__ */ y({
89
+ __name: "ZodTextField",
90
+ props: {
91
+ label: {
92
+ type: String,
93
+ required: !1
94
+ },
95
+ schema: {
96
+ type: Object,
97
+ required: !0
98
+ },
99
+ modelValue: {
100
+ type: String
101
+ },
102
+ disabled: {
103
+ type: Boolean,
104
+ default: !1
105
+ }
106
+ },
107
+ emits: ["update:model-value", "focus-changed"],
108
+ setup(e, { emit: t }) {
109
+ const n = t, d = j();
110
+ return (o, l) => {
111
+ const g = v("FmTextField");
112
+ return u(), N(g, O({
113
+ "model-value": e.modelValue,
114
+ "onUpdate:modelValue": l[0] || (l[0] = (h) => n("update:model-value", h)),
115
+ disabled: e.disabled
116
+ }, s(d), {
117
+ rules: [s(f).toRule(e.schema)]
118
+ }), x({ _: 2 }, [
119
+ e.label ? {
120
+ name: "label",
121
+ fn: _(() => [
122
+ c("div", L, [
123
+ c("div", null, k(e.label), 1),
124
+ T(o.$slots, "append-label", {}, () => [
125
+ s(f).isRequired(e.schema) ? U("", !0) : (u(), R("div", P, " (optional) "))
126
+ ])
127
+ ])
128
+ ]),
129
+ key: "0"
130
+ } : void 0
131
+ ]), 1040, ["model-value", "disabled", "rules"]);
132
+ };
133
+ }
134
+ });
135
+ export {
136
+ f as Z,
137
+ A as _,
138
+ I as a,
139
+ E as g
140
+ };