@feedmepos/mf-connect 0.1.98-beta.40 → 0.1.98-beta.41

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 (151) hide show
  1. package/dist/App-C6JJ9uQ8.js +4785 -0
  2. package/dist/AuditLogs-CAlgtDgx.js +2014 -0
  3. package/dist/Bin-D8jwhwER.js +166 -0
  4. package/dist/Broadcast-CP8DRfkT.js +269 -0
  5. package/dist/CampaignAnalytic-MVjYBFvu.js +1826 -0
  6. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DeLURz87.js +122 -0
  7. package/dist/Card-QribXJwZ.js +911 -0
  8. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +97 -0
  9. package/dist/Collections-X9xbt43V.js +541 -0
  10. package/dist/Credit-QmbsW1eb.js +286 -0
  11. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
  12. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +58 -0
  13. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-ClNieHSo.js +3382 -0
  14. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CrGHTNhg.js +351 -0
  15. package/dist/Experience-CPGMg847.js +285 -0
  16. package/dist/FileSaver.min-CK67LsPG.js +74 -0
  17. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
  18. package/dist/FmTableSelection.vue_vue_type_script_setup_true_lang-DzcUc0_w.js +52 -0
  19. package/dist/Game-BrkiEFCS.js +356 -0
  20. package/dist/GiftCardSetup-DXNBHF1A.js +542 -0
  21. package/dist/Grab-BgtDzK1B.js +301 -0
  22. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-Dzv2AkKN.js +145 -0
  23. package/dist/Index-KJgzalOd.js +259 -0
  24. package/dist/JsonViewer-v8_C7l5N.js +87 -0
  25. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-C6SBLJGQ.js +48 -0
  26. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-Dj74lJ7b.js +18737 -0
  27. package/dist/LoyaltyDashboard-B2JpbC01.js +1345 -0
  28. package/dist/MainLayout-DlfTKHQ-.js +143 -0
  29. package/dist/Marketing-Crx_JQpi.js +236 -0
  30. package/dist/MarketingMaterialEdit-BfsdcMXJ.js +1036 -0
  31. package/dist/Member-C50Nrsko.js +281 -0
  32. package/dist/MemberList-C9uUKw1o.js +1603 -0
  33. package/dist/MemberOverview-wL_ailso.js +58 -0
  34. package/dist/MemberTransactions-DZ7zPOHX.js +45 -0
  35. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-Du_ZGsbX.js +60957 -0
  36. package/dist/MetricInfoTooltip.vue_vue_type_script_setup_true_lang-Bg_0YlwG.js +38 -0
  37. package/dist/Mission-D_km8zi6.js +360 -0
  38. package/dist/Overview-BBieK6qQ.js +1080 -0
  39. package/dist/Overview-B_kmLOcc.js +1316 -0
  40. package/dist/Point-D0q9N7f9.js +288 -0
  41. package/dist/Promotion-DoFTy-NK.js +423 -0
  42. package/dist/Queue-Dh5sDRHW.js +261 -0
  43. package/dist/Record-0owEBKqN.js +342 -0
  44. package/dist/Review-DV2fnpOH.js +45 -0
  45. package/dist/ReviewFacebookCallback-D8mnAPzR.js +238 -0
  46. package/dist/ReviewGoogleCallback-CLzt_ox2.js +213 -0
  47. package/dist/Reward-Co20Xrss.js +442 -0
  48. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-0qU49c47.js +150 -0
  49. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-qdvaXPhJ.js +1913 -0
  50. package/dist/Segment-7dQKeHWK.js +1017 -0
  51. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BUVrUifO.js +181 -0
  52. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-DDsV9TD9.js +189 -0
  53. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-DqPZpddc.js +226 -0
  54. package/dist/Setting-Bvahxs-y.js +2047 -0
  55. package/dist/SettingAdvertisements-fbXLRwfb.js +264 -0
  56. package/dist/Settings-C_HWDFN8.js +179 -0
  57. package/dist/Store-8yBKDR1b.js +2413 -0
  58. package/dist/StoreRewards-DKaJvoJs.js +540 -0
  59. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-D23XzJD7.js +1075 -0
  60. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-JaFhCK_L.js +7007 -0
  61. package/dist/Tier-CD-CjXC3.js +972 -0
  62. package/dist/Title-C_lcgye8.js +569 -0
  63. package/dist/Transaction-BvUYm-rT.js +39 -0
  64. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-C3Yacz7K.js +130 -0
  65. package/dist/Voucher-CYaG0GLU.js +444 -0
  66. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DF2JqzRe.js +421 -0
  67. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-B4UPqSNc.js +56 -0
  68. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  69. package/dist/app-CE5hQ4Uq.js +60740 -0
  70. package/dist/app-wDQR6dpb.js +39 -0
  71. package/dist/app.js +7 -0
  72. package/dist/business-CE_4siXc.js +82 -0
  73. package/dist/campaign-BP6rvSpg.js +255 -0
  74. package/dist/campaign-CXQtKpeb.js +100 -0
  75. package/dist/campaign-CpzFl8Vr.js +4 -0
  76. package/dist/campaign.enum-Dx-Zo68Q.js +26 -0
  77. package/dist/campaign.fn-DKnBpE1N.js +776 -0
  78. package/dist/collectible.enum-Liy2wH3s.js +19 -0
  79. package/dist/collection.fn-Cg16QZSp.js +26 -0
  80. package/dist/duplicateCampaign-DbtVAGsT.js +51 -0
  81. package/dist/effect-CLI8NI4O.js +89 -0
  82. package/dist/email-addresses-DlLiZ1io.js +705 -0
  83. package/dist/export-6Hr34dBU.js +97 -0
  84. package/dist/feedme.ico +0 -0
  85. package/dist/google-C3S8u0mT.js +4 -0
  86. package/dist/helper-vkjFqj70.js +86 -0
  87. package/dist/index-BIyKgw4m.js +72 -0
  88. package/dist/index-BLQJ-rv3.js +31 -0
  89. package/dist/index-BbTIqReL.js +67 -0
  90. package/dist/index-BuMfQxMf.js +897 -0
  91. package/dist/index-C8cXXcLk.js +45 -0
  92. package/dist/index-CSVhIZSY.js +8919 -0
  93. package/dist/index-CVHacTbc.js +151 -0
  94. package/dist/index-C_H8jFYf.js +2743 -0
  95. package/dist/index-CmNsGhDf.js +2706 -0
  96. package/dist/index-CnTeeRyJ.js +53 -0
  97. package/dist/index-CuvNtC_M.js +61 -0
  98. package/dist/index-CzbNobLv.js +1139 -0
  99. package/dist/index-D06n1h1b.js +146 -0
  100. package/dist/index-D4SDAfbP.js +27550 -0
  101. package/dist/index-DVnYQ3Hs.js +85 -0
  102. package/dist/index-DcjnS5Sv.js +28900 -0
  103. package/dist/index-Dx9h0FNH.js +3 -0
  104. package/dist/index-YgP4ihQL.js +32 -0
  105. package/dist/index-kedErkLZ.js +2963 -0
  106. package/dist/index-lnQT4P3d.js +55 -0
  107. package/dist/index-vh86FiIQ.js +10 -0
  108. package/dist/index.esm2017-Jhv2lkrq.js +3069 -0
  109. package/dist/loading-NY-FPxVY.js +72 -0
  110. package/dist/lodash-BC_P6kLg.js +3678 -0
  111. package/dist/membership-BWaK-9FY.js +255 -0
  112. package/dist/moment-D7p2TMB-.js +2583 -0
  113. package/dist/money-COoh4GXK.js +15 -0
  114. package/dist/number-BX5OEXgq.js +12 -0
  115. package/dist/object-BYyQ0PZp.js +18 -0
  116. package/dist/objectId-dwaoBfJX.js +7 -0
  117. package/dist/objectid-1SUSRtmY.js +145 -0
  118. package/dist/plugins-ur-FAoye.js +1788 -0
  119. package/dist/remy-Qz_pNsUS.js +13 -0
  120. package/dist/reward-DSsylZ22.js +36 -0
  121. package/dist/rule-BM9GUd1C.js +1969 -0
  122. package/dist/rule-builder-gC9LH2AC.js +126 -0
  123. package/dist/string-Gcy5IM_H.js +32 -0
  124. package/dist/style.css +4 -0
  125. package/dist/template-CUV3AMFI.js +188 -0
  126. package/dist/tier-BJDhpH6X.js +4 -0
  127. package/dist/tiers/tier=1.png +0 -0
  128. package/dist/tiers/tier=2.png +0 -0
  129. package/dist/tiers/tier=3.png +0 -0
  130. package/dist/tiers/tier=4.png +0 -0
  131. package/dist/timezone-BFZhekOU.js +20 -0
  132. package/dist/titles/type=diamond.png +0 -0
  133. package/dist/titles/type=drinks.png +0 -0
  134. package/dist/titles/type=food.png +0 -0
  135. package/dist/titles/type=heart.png +0 -0
  136. package/dist/titles/type=medal.png +0 -0
  137. package/dist/titles/type=spend.png +0 -0
  138. package/dist/titles/type=thank-you.png +0 -0
  139. package/dist/titles/type=thumbs-up.png +0 -0
  140. package/dist/titles/type=years.png +0 -0
  141. package/dist/transaction.fn-C5MlkEIC.js +64 -0
  142. package/dist/trigger-CbjiuoSo.js +213 -0
  143. package/dist/tslib.es6-BCqqvLQ_.js +44 -0
  144. package/dist/type_drinks-D6jnpvwV.js +4 -0
  145. package/dist/useMarketingMaterialActions-BLisTieA.js +96 -0
  146. package/dist/usePagination-Caah4sJr.js +220 -0
  147. package/dist/user-BZC4P_jL.js +55 -0
  148. package/dist/vue-i18n-BYz7XAr_.js +2365 -0
  149. package/dist/xlsx-Bn7BqUFA.js +15491 -0
  150. package/dist/zod-DHH42rXG.js +91 -0
  151. package/package.json +1 -1
@@ -0,0 +1,39 @@
1
+ import { ref as u, computed as a } from "vue";
2
+ import { defineStore as v } from "pinia";
3
+ const b = v("mf-connect-app", () => {
4
+ const e = u([]), l = u(null), t = u(null), i = u(localStorage.getItem("debugMode") === "true"), r = a(
5
+ () => e.value.some((o) => o.isGlobal === !0) || !1
6
+ ), s = a(() => e.value.length > 0);
7
+ function c(o) {
8
+ e.value = [...e.value, ...o];
9
+ }
10
+ function d() {
11
+ e.value = [];
12
+ }
13
+ function f(o) {
14
+ e.value = e.value.filter(
15
+ (n) => !o.includes(n.id)
16
+ );
17
+ }
18
+ function g(o, n) {
19
+ l.value = o, t.value = n;
20
+ }
21
+ return {
22
+ // state
23
+ loadingQueue: e,
24
+ snackbar: l,
25
+ dialog: t,
26
+ debugMode: i,
27
+ // getters
28
+ isGlobalLoading: r,
29
+ isLoading: s,
30
+ // actions
31
+ addLoadingQueues: c,
32
+ clearLoadingQueue: d,
33
+ resolveQueues: f,
34
+ initProvider: g
35
+ };
36
+ });
37
+ export {
38
+ b as u
39
+ };
package/dist/app.js ADDED
@@ -0,0 +1,7 @@
1
+ import "vue";
2
+ import { f as e, i as o, r as p } from "./app-CE5hQ4Uq.js";
3
+ export {
4
+ e as FmApp,
5
+ o as i18nMessages,
6
+ p as routes
7
+ };
@@ -0,0 +1,82 @@
1
+ import { ref as i, computed as u } from "vue";
2
+ import { defineStore as w } from "pinia";
3
+ import { useCoreStore as y } from "@feedmepos/mf-common";
4
+ import { a as I, g as r, A as b, S, b as D } from "./index-DcjnS5Sv.js";
5
+ const $ = {
6
+ async readSettings(e) {
7
+ try {
8
+ return r(await I(`marketing-v2/${e}/setting`).get(""));
9
+ } catch (t) {
10
+ if (console.error(JSON.stringify(t)), t instanceof b)
11
+ return {
12
+ _id: e,
13
+ business: e,
14
+ apiVersion: "v1"
15
+ };
16
+ throw t;
17
+ }
18
+ }
19
+ }, o = () => {
20
+ const e = S.getBusinessId();
21
+ if (!e) throw new Error("Invalid business ID");
22
+ return D(`businesses/${e}/location`, {
23
+ noIdRequired: !0
24
+ });
25
+ }, l = {
26
+ async read() {
27
+ return r(await o().get(""));
28
+ },
29
+ async readDevices() {
30
+ return r(await o().get("devices"));
31
+ },
32
+ async unregisterDevice(e) {
33
+ await r(await o().delete(`devices/${e}`));
34
+ },
35
+ async getOtp(e) {
36
+ return r(await o().post(`${e}/otp`));
37
+ }
38
+ }, h = w("mf-connect-business", () => {
39
+ const e = i("v2"), t = i(!1), a = i([]), c = i([]);
40
+ async function v() {
41
+ const n = y().currentBusiness.value, s = await $.readSettings(n == null ? void 0 : n.id);
42
+ return t.value = s && "business" in s && s.premium == !0 || !1, e.value = (s == null ? void 0 : s.apiVersion) || "v1", t.value;
43
+ }
44
+ async function d() {
45
+ return a.value = await l.read(), a.value;
46
+ }
47
+ async function p() {
48
+ return c.value = await l.readDevices(), c.value;
49
+ }
50
+ function m(n) {
51
+ return a.value.find((s) => s._id === n);
52
+ }
53
+ const f = u(() => [
54
+ { label: "All", value: null },
55
+ ...a.value.map((n) => ({
56
+ label: n.name,
57
+ value: n._id
58
+ }))
59
+ ]), g = u(() => a.value.map((n) => ({
60
+ label: `${n.code ? `${n.code} - ` : ""} ${n.name}`,
61
+ value: n._id
62
+ })));
63
+ return {
64
+ // state
65
+ version: e,
66
+ isPremium: t,
67
+ locations: a,
68
+ locationDevices: c,
69
+ // actions
70
+ readPremium: v,
71
+ readLocations: d,
72
+ readLocationDevices: p,
73
+ locationById: m,
74
+ // getters
75
+ locationItems: f,
76
+ locationOptions: g
77
+ };
78
+ });
79
+ export {
80
+ l,
81
+ h as u
82
+ };
@@ -0,0 +1,255 @@
1
+ import { h as i } from "./moment-D7p2TMB-.js";
2
+ import "./index-BuMfQxMf.js";
3
+ import { e as p } from "./effect-CLI8NI4O.js";
4
+ import { components as f } from "@feedmepos/ui-library";
5
+ import { i as y } from "./rule-builder-gC9LH2AC.js";
6
+ import { c as h } from "./rule-BM9GUd1C.js";
7
+ import { u as O } from "./business-CE_4siXc.js";
8
+ import { C as m } from "./campaign.fn-DKnBpE1N.js";
9
+ import { c as g } from "./string-Gcy5IM_H.js";
10
+ import { i as d } from "./plugins-ur-FAoye.js";
11
+ import { h as s } from "vue";
12
+ import { F as a } from "./campaign.enum-Dx-Zo68Q.js";
13
+ const n = d.global.t;
14
+ function C() {
15
+ const e = d.global.locale;
16
+ return typeof e == "string" ? e : e.value;
17
+ }
18
+ function u(e) {
19
+ return new Intl.DateTimeFormat(C(), {
20
+ day: "2-digit",
21
+ month: "short",
22
+ year: "numeric"
23
+ }).format(new Date(e));
24
+ }
25
+ function c(e) {
26
+ return s(
27
+ "div",
28
+ {
29
+ class: `${e.chipClass} gap-4 h-[22px] inline-flex items-center justify-center min-w-min px-8 rounded-md`
30
+ },
31
+ [
32
+ s(f.FmIcon, { size: "sm", name: e.icon, outline: !0 }),
33
+ s("span", { class: "fm-typo-en-body-md-600" }, e.name)
34
+ ]
35
+ );
36
+ }
37
+ const P = {
38
+ [a.enum.CREDIT]: {
39
+ chipClass: "!text-fm-color-secondary-plum !bg-[#f2ebfe]",
40
+ icon: "local_activity",
41
+ get name() {
42
+ return n("connect.campaign.common.typeName.CREDIT");
43
+ },
44
+ chip() {
45
+ return c(this);
46
+ }
47
+ },
48
+ [a.enum.PROMOTION]: {
49
+ chipClass: "!text-fm-color-secondary-citrus !bg-fm-color-system-warning-100",
50
+ icon: "loyalty",
51
+ get name() {
52
+ return n("connect.campaign.common.typeName.PROMOTION");
53
+ },
54
+ chip() {
55
+ return c(this);
56
+ }
57
+ },
58
+ [a.enum.VOUCHER]: {
59
+ chipClass: "!text-fm-color-secondary-halite !bg-[#fff0f6]",
60
+ icon: "sell",
61
+ get name() {
62
+ return n("connect.campaign.common.typeName.VOUCHER");
63
+ },
64
+ chip() {
65
+ return c(this);
66
+ }
67
+ },
68
+ [a.enum.POINT]: {
69
+ chipClass: "!text-fm-color-secondary-cocoa !bg-[#fff9e6]",
70
+ icon: "award_star",
71
+ get name() {
72
+ return n("connect.campaign.common.typeName.POINT");
73
+ },
74
+ chip() {
75
+ return c(this);
76
+ }
77
+ },
78
+ [a.enum.BROADCAST]: {
79
+ chipClass: "!text-fm-color-typo-info !bg-fm-color-system-info-100",
80
+ icon: "campaign",
81
+ get name() {
82
+ return n("connect.campaign.common.typeName.BROADCAST");
83
+ },
84
+ chip() {
85
+ return c(this);
86
+ }
87
+ },
88
+ [a.enum.GAME]: {
89
+ chipClass: "!text-fm-color-secondary-mint !bg-fm-color-system-success-100",
90
+ icon: "database",
91
+ get name() {
92
+ return n("connect.campaign.common.typeName.GAME");
93
+ },
94
+ chip() {
95
+ return c(this);
96
+ }
97
+ },
98
+ [a.enum.REWARD_POOL]: {
99
+ chipClass: "!text-fm-color-secondary-tuna !bg-[#e3f4f9]",
100
+ icon: "editor_choice",
101
+ get name() {
102
+ return n("connect.campaign.common.typeName.REWARD_POOL");
103
+ },
104
+ chip() {
105
+ return c(this);
106
+ }
107
+ },
108
+ [a.enum.COIN]: {
109
+ chipClass: "!text-fm-color-system-success-400 !bg-fm-color-system-success-100",
110
+ icon: "monetization_on",
111
+ get name() {
112
+ return n("connect.campaign.common.typeName.COIN");
113
+ },
114
+ chip() {
115
+ return c(this);
116
+ }
117
+ },
118
+ [a.enum.MEMBERSHIP]: {
119
+ chipClass: "",
120
+ icon: "",
121
+ get name() {
122
+ return n("connect.campaign.common.typeName.MEMBERSHIP");
123
+ },
124
+ chip() {
125
+ return c(this);
126
+ }
127
+ },
128
+ [a.enum.MISSION]: {
129
+ chipClass: "!text-fm-color-secondary-tuna !bg-[#e3f4f9]",
130
+ icon: "editor_choice",
131
+ get name() {
132
+ return n("connect.campaign.common.typeName.MISSION");
133
+ },
134
+ chip() {
135
+ return c(this);
136
+ }
137
+ },
138
+ [a.enum.GRAB]: {
139
+ chipClass: "!text-fm-color-secondary-tuna !bg-[#e3f4f9]",
140
+ icon: "editor_choice",
141
+ name: "Grab",
142
+ chip() {
143
+ return c(this);
144
+ }
145
+ }
146
+ };
147
+ function L(e) {
148
+ const t = b(e), o = {
149
+ active: "text-fm-color-typo-success bg-fm-color-system-success-100",
150
+ upcoming: "text-fm-color-typo-info bg-fm-color-system-info-100",
151
+ expired: "text-fm-color-typo-error bg-fm-color-system-error-100"
152
+ };
153
+ return e.type == "VOUCHER" ? s(f.FmChip, {
154
+ class: o[t],
155
+ label: g.title(n(`connect.campaign.common.status.${t}`)),
156
+ compact: !0
157
+ }) : s(f.FmChip, {
158
+ class: o[t],
159
+ label: g.title(n(`connect.campaign.common.status.${t}`)),
160
+ compact: !0
161
+ });
162
+ }
163
+ function w(e) {
164
+ const t = e.timeframeOptions;
165
+ if (!t || !t.start && !t.end)
166
+ return n("connect.campaign.common.always_active");
167
+ if (!t.start && t.end)
168
+ return n("connect.campaign.common.valid_until", {
169
+ date: u(t.end)
170
+ });
171
+ const o = u(t.start), r = t.end ? u(t.end) : n("connect.campaign.common.unlimited");
172
+ return `${o} -> ${r}`;
173
+ }
174
+ function E(e) {
175
+ if (!e || !e.start && !e.end)
176
+ return "connect.campaign.common.always";
177
+ const t = e.start ? i(e.start).format("DD MMM YYYY") : "From campaign creation", o = e.end ? i(e.end).format("DD MMM YYYY") : "Never ends";
178
+ return `${t} - ${o}`;
179
+ }
180
+ function Y(e) {
181
+ const { campaign: t } = e;
182
+ return {
183
+ "connect.campaign.common.campaign_name": t.name,
184
+ "connect.campaign.common.campaign_period": E(
185
+ t.timeframeOptions
186
+ ),
187
+ get "connect.campaign.common.next_schedule_at"() {
188
+ if ((t == null ? void 0 : t.event.type) != "SCHEDULE" || !t.event.rule || !y(t.event.rule))
189
+ return;
190
+ const o = h(
191
+ t.event.rule.rules.g_schedule
192
+ );
193
+ return o ? i(o).format("ddd, DD MMM YYYY, hh:mmA") : void 0;
194
+ },
195
+ get "connect.campaign.common.discount_type"() {
196
+ if (t.type == "PROMOTION") return p(t.effect);
197
+ if ("configs" in e && e.configs.type == "VOUCHER")
198
+ return p(e.configs.extras.effect);
199
+ },
200
+ get "connect.campaign.common.available_at"() {
201
+ return t.targetLocation ? t.targetLocation.length > 0 ? t.targetLocation.map(
202
+ (o) => O().locationItems.find((r) => r.value == o).label
203
+ ).join(",") : "connect.campaign.common.no_location" : "connect.campaign.common.all_locations";
204
+ }
205
+ };
206
+ }
207
+ function b(e) {
208
+ return e.timeframeOptions && e.timeframeOptions.type == "timeframe" ? i().isBetween(
209
+ e.timeframeOptions.start ?? i().subtract(1, "d"),
210
+ e.timeframeOptions.end ?? i().add(1, "d")
211
+ ) ? "active" : i().isAfter(e.timeframeOptions.end) ? "expired" : "upcoming" : "active";
212
+ }
213
+ function B(e) {
214
+ var t, o;
215
+ switch (e.event.type) {
216
+ case "BILL_COMPLETED":
217
+ const r = `Spend to get ${m.formattedType(e.type)}`;
218
+ switch (e.type) {
219
+ case "POINT":
220
+ case "CREDIT":
221
+ case "COIN":
222
+ return e.earningOption.type == "FIXED" ? `Spend to get ${e.earningOption.amount} ${m.formattedType(e.type)}` : `Every ${e.earningOption.every} amount spent get ${e.earningOption.amount} ${m.formattedType(e.type)}`;
223
+ case "VOUCHER":
224
+ const l = (o = (t = e == null ? void 0 : e.pf_collectible) == null ? void 0 : t.extras) == null ? void 0 : o.effect;
225
+ return l ? `${r} - ${p(l)}` : r;
226
+ default:
227
+ return r;
228
+ }
229
+ case "FEEDBACK":
230
+ return `Give feedback to receive ${m.formattedType(e.type)}`;
231
+ case "SCHEDULE":
232
+ return `Receive ${m.formattedType(e.type)} on scheduled time`;
233
+ case "SIMPLE_CLAIM":
234
+ return "Simple claim voucher";
235
+ case "TIER_UPGRADED":
236
+ return `Receive ${m.formattedType(e.type)} when member tier upgraded`;
237
+ case "MEMBERSHIP_JOINED":
238
+ return `Receive ${m.formattedType(e.type)} when member joined`;
239
+ case "MAKING_ORDER":
240
+ return e.type !== "PROMOTION" ? void 0 : p(e.effect);
241
+ default:
242
+ throw new Error(
243
+ `Not implemented ${JSON.stringify({ cause: e.event.type })}`
244
+ );
245
+ }
246
+ }
247
+ export {
248
+ P as C,
249
+ b as a,
250
+ L as b,
251
+ B as c,
252
+ Y as d,
253
+ w as g,
254
+ E as s
255
+ };
@@ -0,0 +1,100 @@
1
+ import { defineStore as d } from "pinia";
2
+ import { reactive as b, onMounted as f, ref as s } from "vue";
3
+ import { c } from "./index-D06n1h1b.js";
4
+ import { g as i, S as g, b as h } from "./index-DcjnS5Sv.js";
5
+ const p = () => {
6
+ const e = g.getBusinessId();
7
+ if (!e) throw new Error("Invalid business ID");
8
+ return h(`businesses/${e}/campaigns`, {
9
+ noIdRequired: !0
10
+ });
11
+ }, I = {
12
+ async readAll() {
13
+ return i(await p().get("templates"));
14
+ },
15
+ async readById(e) {
16
+ return i(
17
+ await p().get(`templates/${e}`)
18
+ );
19
+ }
20
+ }, A = d("mf-connect-campaign", () => {
21
+ const e = b({
22
+ promotion: [],
23
+ voucher: [],
24
+ broadcast: [],
25
+ experience: [],
26
+ point: [],
27
+ credit: [],
28
+ token: [],
29
+ mission: [],
30
+ grab: [],
31
+ all: []
32
+ });
33
+ f(() => {
34
+ console.log("🔧 CampaignStore Installed");
35
+ });
36
+ const t = s([]), r = s([]), n = s([]);
37
+ async function u(k) {
38
+ const o = await c.readAll({
39
+ limit: 1e3,
40
+ skip: 0,
41
+ sortBy: "_id",
42
+ descending: !0
43
+ });
44
+ Object.keys(e).forEach((a) => {
45
+ e[a] = [];
46
+ }), e.all = o.resources.filter(
47
+ (a) => a.type !== "MEMBERSHIP"
48
+ );
49
+ for (const a of o.resources)
50
+ switch (a.type) {
51
+ case "PROMOTION":
52
+ e.promotion.push(a);
53
+ break;
54
+ case "VOUCHER":
55
+ e.voucher.push(a), n.value.push(a);
56
+ break;
57
+ case "BROADCAST":
58
+ ["SCHEDULE", "FEEDBACK"].includes(a.event.type) && e.broadcast.push(a);
59
+ break;
60
+ case "POINT":
61
+ e.experience.push(a);
62
+ break;
63
+ case "COIN":
64
+ e.point.push(a);
65
+ break;
66
+ case "CREDIT":
67
+ e.credit.push(a);
68
+ break;
69
+ case "GAME":
70
+ e.token.push(a);
71
+ break;
72
+ case "MISSION":
73
+ e.mission.push(a);
74
+ break;
75
+ case "GRAB":
76
+ e.grab.push(a);
77
+ break;
78
+ }
79
+ }
80
+ async function l() {
81
+ r.value = await c.readGroups();
82
+ }
83
+ async function m() {
84
+ t.value = await I.readAll();
85
+ }
86
+ return {
87
+ // State
88
+ campaigns: e,
89
+ templates: t,
90
+ groups: r,
91
+ voucher: n,
92
+ // Actions
93
+ read: u,
94
+ readGroups: l,
95
+ readTemplates: m
96
+ };
97
+ });
98
+ export {
99
+ A as u
100
+ };