@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
@@ -1,309 +0,0 @@
1
- import { openBlock as c, createElementBlock as u, defineComponent as D, ref as M, onMounted as z, computed as $, resolveComponent as l, Fragment as C, createVNode as r, unref as m, createElementVNode as o, withCtx as x, renderList as Y, createBlock as A, toDisplayString as B, createCommentVNode as H, h as G } from "vue";
2
- import { _ as J } from "./campaign-CpzFl8Vr.js";
3
- import { components as j } from "@feedmepos/ui-library";
4
- import { u as q, p as X } from "./loading-Dj5bx8fg.js";
5
- import { defineStore as Q } from "pinia";
6
- import { F } from "./index-BZAlqAaJ.js";
7
- import { useCoreStore as W } from "@feedmepos/mf-common";
8
- import { g as y, S as Z, b as ee } from "./index-BSIUoSG3.js";
9
- import { _ as te } from "./_plugin-vue_export-helper-CHgC5LLL.js";
10
- import { u as ae } from "./campaign-CMb05XLt.js";
11
- import { h as ne } from "./moment-BWErdI6_.js";
12
- var oe = { 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" };
13
- const h = () => {
14
- const n = Z.getBusinessId();
15
- if (!n) throw new Error("Invalid business ID");
16
- return ee(`businesses/${n}/marketing-materials/`, {
17
- url: oe.backendUrl,
18
- noIdRequired: !0
19
- });
20
- }, N = {
21
- async read() {
22
- return y(await h().get(""));
23
- },
24
- async createMarketing(n) {
25
- return y(await h().post("", n));
26
- },
27
- // add id
28
- async updateMarketing(n, s) {
29
- return y(
30
- await h().put(n, s)
31
- );
32
- },
33
- async deleteMarketing(n) {
34
- return y(await h().delete(n));
35
- }
36
- }, S = Q("mf-connect-marketing", {
37
- state: () => {
38
- var n, s;
39
- return {
40
- marketing: [],
41
- defaultMarketing: {
42
- _id: void 0,
43
- business: ((s = (n = W().currentBusiness) == null ? void 0 : n.value) == null ? void 0 : s._id) ?? "",
44
- name: "",
45
- campaign: null,
46
- keywords: "",
47
- image: "",
48
- headline: {
49
- content: "",
50
- key: void 0
51
- },
52
- assets: [
53
- {
54
- platform: F.enum.FACEBOOK,
55
- contents: [
56
- {
57
- type: "POST",
58
- size: {
59
- width: 1920,
60
- height: 1080
61
- },
62
- images: []
63
- },
64
- {
65
- type: "STORY",
66
- size: {
67
- width: 1080,
68
- height: 1920
69
- },
70
- images: []
71
- }
72
- ]
73
- },
74
- {
75
- platform: F.enum.INSTAGRAM,
76
- contents: [
77
- {
78
- type: "POST",
79
- size: {
80
- width: 1080,
81
- height: 1080
82
- },
83
- images: []
84
- },
85
- {
86
- type: "STORY",
87
- size: {
88
- width: 1080,
89
- height: 1920
90
- },
91
- images: []
92
- },
93
- {
94
- type: "REEL",
95
- size: {
96
- width: 1080,
97
- height: 1920
98
- },
99
- images: []
100
- }
101
- ]
102
- },
103
- {
104
- platform: F.enum.BRAND_APP,
105
- contents: [
106
- {
107
- type: "IMAGE",
108
- size: {
109
- width: 1080,
110
- height: 1920
111
- },
112
- images: []
113
- }
114
- ]
115
- }
116
- ],
117
- captions: [{ language: "en", content: "" }]
118
- }
119
- };
120
- },
121
- actions: {
122
- async readMarketingMaterial() {
123
- const n = await N.read();
124
- this.marketing = n;
125
- }
126
- },
127
- getters: {
128
- state(n) {
129
- return n;
130
- }
131
- }
132
- }), re = {};
133
- function se(n, s) {
134
- return c(), u("div");
135
- }
136
- const ie = /* @__PURE__ */ te(re, [["render", se]]), le = { class: "px-24 flex flex-col gap-y-16" }, ce = { class: "flex items-center justify-between w-full" }, me = { class: "space-y-8" }, de = { class: "fm-typo-en-body-lg-600" }, ue = { class: "fm-typo-en-body-lg-600" }, pe = { key: 0 }, ge = /* @__PURE__ */ o("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-md-600" }, " No results found ", -1), fe = [
137
- ge
138
- ], ye = /* @__PURE__ */ o("img", {
139
- src: J,
140
- class: "w-[150px]"
141
- }, null, -1), he = /* @__PURE__ */ o("p", { class: "fm-typo-en-title-sm-800" }, "Create marketing material", -1), _e = /* @__PURE__ */ o("p", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary w-4/6 text-center" }, " Boost your marketing efforts effortlessly with our AI-powered tools. Generate stunning images and captivating captions for your desired platform. ", -1), Ve = /* @__PURE__ */ D({
142
- __name: "Marketing",
143
- setup(n) {
144
- const s = {
145
- label: "Create marketing material",
146
- value: "create",
147
- isPrimary: !0,
148
- prependIcon: "add"
149
- }, p = M(!1), _ = S(), k = ae(), { global: P, minor: T } = q;
150
- z(async () => {
151
- await P(async () => {
152
- await k.read(), await _.readMarketingMaterial();
153
- });
154
- });
155
- const d = $(() => _.marketing.filter(
156
- (t) => t.name.includes(i.value.searchKey.toLowerCase())
157
- )), g = M(
158
- S().defaultMarketing
159
- ), L = [
160
- {
161
- header: "Name",
162
- accessorFn: (t) => t.name
163
- },
164
- {
165
- header: "Campaign",
166
- accessorFn: (t) => {
167
- var e;
168
- return t.campaign === null || t.campaign === void 0 ? "-" : (e = k.campaigns.all.find(
169
- (v) => v._id === t.campaign
170
- )) == null ? void 0 : e.name;
171
- }
172
- },
173
- {
174
- header: "Created date",
175
- accessorFn: (t) => {
176
- const e = new Date(parseInt(t._id.toString().substring(0, 8), 16) * 1e3);
177
- return ne(e).format("DD MMM YYYY");
178
- }
179
- },
180
- {
181
- header: "Actions",
182
- cell(t) {
183
- return G(j.FmButton, {
184
- variant: "tertiary",
185
- icon: "delete",
186
- iconColor: "neutral-gray-400",
187
- onClick: (e) => {
188
- e.stopPropagation(), I(t.row.original);
189
- }
190
- });
191
- }
192
- }
193
- ];
194
- async function I(t) {
195
- await X.remove(`Are you sure you want to remove ${t.name}?`) && await T(
196
- async () => {
197
- await N.deleteMarketing(t._id), await _.readMarketingMaterial();
198
- },
199
- {
200
- message: `Removing ${t.name}`,
201
- successMessage: `Removed ${t.name} successfully`
202
- }
203
- );
204
- }
205
- async function f(t) {
206
- t ? g.value = JSON.parse(JSON.stringify(t)) : g.value = JSON.parse(JSON.stringify(S().defaultMarketing)), p.value = !0;
207
- }
208
- const i = M({
209
- searchKey: ""
210
- });
211
- return (t, e) => {
212
- const v = l("FmPageHead"), O = l("FmSearch"), R = l("FmTable"), V = l("FmButton"), U = l("FmListItem"), E = l("FmList"), K = l("FmCard");
213
- return c(), u(C, null, [
214
- r(v, {
215
- title: "Marketing material",
216
- class: "xs:hidden",
217
- actions: m(d).length > 0 ? [s] : [],
218
- "onClick:action": e[0] || (e[0] = () => f())
219
- }, null, 8, ["actions"]),
220
- o("div", le, [
221
- r(O, {
222
- modelValue: i.value.searchKey,
223
- "onUpdate:modelValue": e[1] || (e[1] = (a) => i.value.searchKey = a),
224
- class: "hidden xs:block border-b-2 border-fm-color-neutral-gray-100",
225
- placeholder: "search",
226
- collapsible: ""
227
- }, null, 8, ["modelValue"]),
228
- r(ie, {
229
- modelValue: g.value,
230
- "onUpdate:modelValue": e[2] || (e[2] = (a) => g.value = a),
231
- "is-open": p.value,
232
- "onUpdate:isOpen": e[3] || (e[3] = (a) => p.value = a)
233
- }, null, 8, ["modelValue", "is-open"]),
234
- m(d).length > 0 ? (c(), u(C, { key: 0 }, [
235
- o("div", ce, [
236
- r(O, {
237
- modelValue: i.value.searchKey,
238
- "onUpdate:modelValue": e[4] || (e[4] = (a) => i.value.searchKey = a),
239
- class: "xs:hidden",
240
- placeholder: "search",
241
- collapsible: ""
242
- }, null, 8, ["modelValue"])
243
- ]),
244
- r(R, {
245
- class: "xs:hidden",
246
- "row-data": m(d),
247
- "column-defs": L,
248
- "search-value": i.value.searchKey,
249
- "column-filter": [],
250
- onRowClick: e[5] || (e[5] = (a) => f(a.original)),
251
- "hide-footer": !0
252
- }, null, 8, ["row-data", "search-value"]),
253
- r(E, { class: "hidden xs:flex flex-col mx-[-24px]" }, {
254
- default: x(() => [
255
- (c(!0), u(C, null, Y(m(d).filter(
256
- (a) => a.name.toLowerCase().includes(i.value.searchKey.toLowerCase())
257
- ), (a) => (c(), A(U, {
258
- key: a._id.toString(),
259
- onClick: (w) => f(a),
260
- class: "py-12 px-16 flex items-center justify-between border-b border-fm-color-neutral-gray-100"
261
- }, {
262
- default: x(() => {
263
- var w;
264
- return [
265
- o("div", me, [
266
- o("div", de, B(a.name), 1),
267
- o("div", ue, B(a.campaign === null || a.campaign === void 0 ? "-" : (w = m(k).campaigns.all.find(
268
- (b) => b._id === a.campaign
269
- )) == null ? void 0 : w.name), 1)
270
- ]),
271
- r(V, {
272
- icon: "delete",
273
- "icon-color": "neutral-gray-400",
274
- variant: "tertiary",
275
- onClick: (b) => (b.stopPropagation(), I(a))
276
- }, null, 8, ["onClick"])
277
- ];
278
- }),
279
- _: 2
280
- }, 1032, ["onClick"]))), 128))
281
- ]),
282
- _: 1
283
- }),
284
- m(d).length == 0 ? (c(), u("div", pe, fe)) : H("", !0)
285
- ], 64)) : (c(), A(K, {
286
- key: 1,
287
- variant: "outlined",
288
- class: "w-full justify-center items-center flex flex-col p-[24px] gap-[24px]"
289
- }, {
290
- default: x(() => [
291
- ye,
292
- he,
293
- _e,
294
- r(V, {
295
- label: "Add material",
296
- "prepend-icon": "add",
297
- onClick: e[6] || (e[6] = (a) => f())
298
- })
299
- ]),
300
- _: 1
301
- }))
302
- ])
303
- ], 64);
304
- };
305
- }
306
- });
307
- export {
308
- Ve as default
309
- };
@@ -1,92 +0,0 @@
1
- import { defineComponent as R, computed as f, ref as p, watch as T, resolveComponent as m, openBlock as d, createElementBlock as k, Fragment as B, createVNode as _, unref as n, createElementVNode as E, createBlock as M, createCommentVNode as A } from "vue";
2
- import "./index-BMxu_XL-.js";
3
- import { useRouter as L } from "vue-router";
4
- import { m as N } from "./index-BBBytzpn.js";
5
- import { R as s } from "./app-SOHUUM08.js";
6
- const Y = { class: "px-24 flex flex-col gap-y-16 pb-24" }, y = /* @__PURE__ */ R({
7
- __name: "Member",
8
- setup(h) {
9
- const e = L(), o = [
10
- // {
11
- // label: 'Overview',
12
- // value: ROUTE_NAME['$connect-LOYALTY_MEMBER_OVERVIEW'],
13
- // actions: [
14
- // // {
15
- // // label: 'Add member',
16
- // // value: 'add_member',
17
- // // isPrimary: true,
18
- // // prependIcon: 'add',
19
- // // },
20
- // ],
21
- // },
22
- {
23
- label: "Member list",
24
- value: s["$connect-LOYALTY_MEMBER_LIST"],
25
- actions: [
26
- // {
27
- // label: 'Import member',
28
- // value: 'import_member',
29
- // isPrimary: false,
30
- // },
31
- // {
32
- // label: 'Add member',
33
- // value: 'add_member',
34
- // isPrimary: true,
35
- // prependIcon: 'add',
36
- // },
37
- ]
38
- }
39
- ], r = f(() => {
40
- var a, c, i;
41
- return e.currentRoute.value.name != s["$connect-LOYALTY_MEMBER_TRANSACTIONS"] ? {
42
- title: u.value.label,
43
- actions: u.value.actions,
44
- description: void 0
45
- } : (u.value = o[1], {
46
- backButton: !0,
47
- title: "Member's transactions",
48
- actions: [],
49
- description: `${(a = l.value) == null ? void 0 : a.name} (${(c = l.value) == null ? void 0 : c._id}) (${(i = l.value) == null ? void 0 : i.phoneNumber})`,
50
- onBackButton: async () => {
51
- await e.push({ name: s["$connect-LOYALTY_MEMBER_LIST"] });
52
- }
53
- });
54
- }), u = p(
55
- o.find((t) => t.value === e.currentRoute.value.name) ?? o[0]
56
- ), l = p();
57
- async function b(t) {
58
- await e.push({ name: t });
59
- }
60
- return T(
61
- () => e.currentRoute.value.name,
62
- async (t) => {
63
- u.value = o.find((c) => c.value === t) ?? o[0];
64
- const a = e.currentRoute.value.params.id;
65
- a && (l.value = await N.readById(a)), await e.push({ name: t });
66
- }
67
- ), (t, a) => {
68
- const c = m("FmPageHead"), i = m("FmTabs"), v = m("RouterView");
69
- return d(), k(B, null, [
70
- _(c, {
71
- actions: n(r).actions,
72
- title: n(r).title,
73
- description: n(r).description,
74
- "back-button": n(r).backButton,
75
- "onClick:back": n(r).onBackButton
76
- }, null, 8, ["actions", "title", "description", "back-button", "onClick:back"]),
77
- E("div", Y, [
78
- n(e).currentRoute.value.name != n(s)["$connect-LOYALTY_MEMBER_TRANSACTIONS"] ? (d(), M(i, {
79
- key: 0,
80
- "model-value": n(u).value,
81
- items: o,
82
- "onUpdate:modelValue": b
83
- }, null, 8, ["model-value"])) : A("", !0),
84
- _(v)
85
- ])
86
- ], 64);
87
- };
88
- }
89
- });
90
- export {
91
- y as default
92
- };
@@ -1,248 +0,0 @@
1
- import { defineComponent as j, ref as I, computed as A, onMounted as D, resolveComponent as r, openBlock as c, createElementBlock as _, Fragment as h, createVNode as i, unref as a, createElementVNode as s, withCtx as w, renderList as E, createBlock as x, resolveDynamicComponent as H, toDisplayString as y, h as m } from "vue";
2
- import { _ as q } from "./campaign-CpzFl8Vr.js";
3
- import { useDialog as z, components as C } from "@feedmepos/ui-library";
4
- import { u as G, a as J, p as Q } from "./loading-Dj5bx8fg.js";
5
- import { u as W } from "./business-DveMDDHY.js";
6
- import { u as X } from "./campaign-CMb05XLt.js";
7
- import { g as M, b as V } from "./dto-CY7JrHkZ.js";
8
- import { _ as Y } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
9
- import { _ as Z } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-C137bE1q.js";
10
- import { u as ee } from "./template-u01r84LY.js";
11
- import { s as oe } from "./index-CuvNtC_M.js";
12
- import { c as g } from "./index-CgPlJqkX.js";
13
- const te = { class: "px-24 flex flex-col gap-y-16" }, ae = { class: "flex items-center justify-between w-full" }, se = { class: "flex gap-8 overflow-x-auto" }, ne = { 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" }, ce = { 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" }, ue = /* @__PURE__ */ s("img", {
14
- src: q,
15
- class: "aspect-square w-[150px]"
16
- }, null, -1), pe = /* @__PURE__ */ s("div", { class: "flex flex-col gap-16 text-center" }, [
17
- /* @__PURE__ */ s("div", { class: "fm-typo-en-title-sm-800" }, "Create your mission program"),
18
- /* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " The mission feature adds a fun element to shopping, encouraging customers to engage more. ")
19
- ], -1), Ie = /* @__PURE__ */ j({
20
- __name: "Mission",
21
- setup(fe) {
22
- const L = {
23
- label: "Create campaign",
24
- value: "create",
25
- isPrimary: !0,
26
- prependIcon: "add"
27
- }, B = ee("MISSION", z()), $ = W(), l = X(), { global: K, minor: b } = G, n = I({
28
- searchKey: "",
29
- location: null
30
- }), d = A(
31
- () => l.campaigns.mission.filter(
32
- (e) => !n.value.location || !e.targetLocation || e.targetLocation.includes(n.value.location)
33
- )
34
- ), R = [
35
- {
36
- header: "Program title",
37
- accessorKey: "name",
38
- // accessorFn: (v) => v.name,
39
- cell(e) {
40
- return m("div", { class: "flex items-center justify-between gap-4" }, [
41
- m("div", { class: "flex items-center" }, [
42
- m(
43
- C.FmTooltip,
44
- {
45
- content: e.row.original._id,
46
- onClick: (o) => {
47
- o.stopPropagation(), J(e.row.original._id);
48
- }
49
- },
50
- [
51
- m(C.FmIcon, {
52
- name: "info",
53
- outline: !0,
54
- size: "sm"
55
- })
56
- ]
57
- )
58
- ]),
59
- m("div", { class: "flex-1" }, e.row.original.name)
60
- ]);
61
- }
62
- },
63
- {
64
- header: "Mission type",
65
- accessorFn: (e) => oe(e.mission.type)
66
- //v.effect,
67
- },
68
- {
69
- header: "Status",
70
- cell(e) {
71
- return M(e.row.original);
72
- }
73
- },
74
- {
75
- header: "Summary",
76
- accessorFn: (e) => V(e)
77
- //v.effect,
78
- },
79
- {
80
- header: "Missions received",
81
- accessorFn: (e) => {
82
- var o;
83
- return ((o = e == null ? void 0 : e.pf_collectible) == null ? void 0 : o.currentReceive) ?? 0;
84
- }
85
- },
86
- {
87
- header: "Actions",
88
- cell(e) {
89
- return m(C.FmButton, {
90
- variant: "tertiary",
91
- icon: "delete",
92
- iconColor: "neutral-gray-400",
93
- onClick: (o) => {
94
- o.stopPropagation(), S(e.row.original);
95
- }
96
- });
97
- }
98
- }
99
- ], v = I();
100
- async function S(e) {
101
- await Q.remove(`Are you sure you want to remove ${e.name}?`) && await b(
102
- async () => {
103
- await g.delete(e._id), await l.read("MISSION");
104
- },
105
- {
106
- message: `Removing ${e.name}`,
107
- successMessage: `Removed ${e.name} successfully`
108
- }
109
- );
110
- }
111
- async function f(e) {
112
- e ? await o() : B.open(async (u) => {
113
- await o(u);
114
- });
115
- async function o(u) {
116
- var p;
117
- (p = v.value) == null || p.showSheet(
118
- !0,
119
- "MISSION",
120
- e ? await g.readById(e._id) : void 0,
121
- u
122
- );
123
- }
124
- }
125
- async function N(e) {
126
- await b(
127
- async () => {
128
- e.campaign._id ? await g.update(e.campaign._id, e) : await g.create(e), await l.read("MISSION");
129
- },
130
- {
131
- message: `${e.campaign._id ? "Updating" : "Creating"} Mission program`,
132
- successMessage: `Mission program ${e.campaign._id ? "updated" : "created"} successfully`
133
- }
134
- );
135
- }
136
- return D(async () => {
137
- await K(async () => {
138
- await l.read("MISSION"), console.log(d);
139
- });
140
- }), (e, o) => {
141
- const u = r("FmPageHead"), p = r("FmSearch"), P = r("FmTable"), F = r("FmButton"), T = r("FmListItem"), O = r("FmList"), U = r("FmCard");
142
- return c(), _(h, null, [
143
- i(u, {
144
- title: "Mission",
145
- actions: a(d).length > 0 ? [L] : [],
146
- "onClick:action": o[0] || (o[0] = () => f())
147
- }, null, 8, ["actions"]),
148
- s("div", te, [
149
- i(p, {
150
- modelValue: a(n).searchKey,
151
- "onUpdate:modelValue": o[1] || (o[1] = (t) => a(n).searchKey = t),
152
- class: "hidden xs:block border-b-2 border-fm-color-neutral-gray-100",
153
- placeholder: "search",
154
- collapsible: ""
155
- }, null, 8, ["modelValue"]),
156
- a(l).campaigns.mission && a(l).campaigns.mission.length > 0 ? (c(), _(h, { key: 0 }, [
157
- s("div", ae, [
158
- s("div", se, [
159
- i(Y, {
160
- modelValue: a(n).location,
161
- "onUpdate:modelValue": o[2] || (o[2] = (t) => a(n).location = t),
162
- label: "Location: ",
163
- "show-item-label": !0,
164
- icon: "storefront",
165
- placement: "bottom-start",
166
- items: a($).locationItems
167
- }, null, 8, ["modelValue", "items"])
168
- ]),
169
- i(p, {
170
- modelValue: a(n).searchKey,
171
- "onUpdate:modelValue": o[3] || (o[3] = (t) => a(n).searchKey = t),
172
- class: "xs:hidden",
173
- placeholder: "search",
174
- collapsible: ""
175
- }, null, 8, ["modelValue"])
176
- ]),
177
- i(P, {
178
- class: "xs:hidden",
179
- "row-data": a(d),
180
- "column-defs": R,
181
- "search-value": a(n).searchKey,
182
- "column-filter": [],
183
- onRowClick: o[4] || (o[4] = (t) => f(t.original)),
184
- "hide-footer": a(d).length < 10
185
- }, null, 8, ["row-data", "search-value", "hide-footer"]),
186
- i(O, { class: "hidden xs:flex flex-col mx-[-24px]" }, {
187
- default: w(() => [
188
- (c(!0), _(h, null, E(a(d).filter(
189
- (t) => t.name.toLowerCase().includes(a(n).searchKey.toLowerCase())
190
- ), (t) => (c(), x(T, {
191
- key: t._id.toString(),
192
- onClick: (k) => f(t),
193
- class: "py-12 px-16 flex items-center justify-between border-b border-fm-color-neutral-gray-100"
194
- }, {
195
- default: w(() => [
196
- s("div", ne, [
197
- s("div", ie, [
198
- (c(), x(H(a(M)(t)))),
199
- s("div", re, y(t.currentReceive ?? 0) + " used ", 1)
200
- ]),
201
- s("div", le, [
202
- s("div", ce, y(t.name), 1),
203
- s("div", me, y(a(V)(t)), 1)
204
- ]),
205
- s("div", de, " Token received: " + y(t.currentReceive ?? 0), 1)
206
- ]),
207
- i(F, {
208
- icon: "delete",
209
- "icon-color": "neutral-gray-400",
210
- variant: "tertiary",
211
- onClick: (k) => (k.stopPropagation(), S(t))
212
- }, null, 8, ["onClick"])
213
- ]),
214
- _: 2
215
- }, 1032, ["onClick"]))), 128))
216
- ]),
217
- _: 1
218
- })
219
- ], 64)) : (c(), x(U, {
220
- key: 1,
221
- variant: "outlined",
222
- class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
223
- }, {
224
- default: w(() => [
225
- ue,
226
- pe,
227
- i(F, {
228
- variant: "primary",
229
- label: "Create Mission program",
230
- icon: "add",
231
- onClick: o[5] || (o[5] = (t) => f())
232
- })
233
- ]),
234
- _: 1
235
- })),
236
- i(Z, {
237
- ref_key: "sheetRef",
238
- ref: v,
239
- "onSubmit:modelValue": N
240
- }, null, 512)
241
- ])
242
- ], 64);
243
- };
244
- }
245
- });
246
- export {
247
- Ie as default
248
- };