@feedmepos/mf-connect 0.1.38-beta.74 → 0.1.38-beta.76

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 (140) hide show
  1. package/dist/Analytic-BrBxRQue.js +761 -0
  2. package/dist/App-CE_19YJc.js +4642 -0
  3. package/dist/AuditLogs-CQtMmVIp.js +1991 -0
  4. package/dist/Bin-D9CHhiUb.js +166 -0
  5. package/dist/Broadcast-Dg6eBL_f.js +267 -0
  6. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CSv0R9XX.js +121 -0
  7. package/dist/Card-BTkf67i1.js +910 -0
  8. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +97 -0
  9. package/dist/Collections-Czq4nsdu.js +541 -0
  10. package/dist/Credit-B3nX8aJA.js +261 -0
  11. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
  12. package/dist/DateInput.vue_vue_type_script_setup_true_lang-BN4Q5Y3l.js +54 -0
  13. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +58 -0
  14. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-D2gTuN97.js +3120 -0
  15. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-5U6cSZGZ.js +351 -0
  16. package/dist/Experience-B9Vn3NTH.js +260 -0
  17. package/dist/FileSaver.min-CJaOkSQt.js +74 -0
  18. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
  19. package/dist/Game-DTx_EsM3.js +331 -0
  20. package/dist/GenerateMaterial-C3J9_YHw.js +589 -0
  21. package/dist/Grab-B29W7rka.js +301 -0
  22. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-DyegKNzM.js +145 -0
  23. package/dist/Index-Fk8EP5dG.js +259 -0
  24. package/dist/JsonViewer-v8_C7l5N.js +87 -0
  25. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-D2XPGgTM.js +48 -0
  26. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-K8qUYrPk.js +18737 -0
  27. package/dist/MainLayout-BFmqJkE_.js +41 -0
  28. package/dist/Marketing-BRHQHAWD.js +145 -0
  29. package/dist/MarketingMaterialEdit-7s3WEDyJ.js +746 -0
  30. package/dist/Member-DwPJNAo9.js +280 -0
  31. package/dist/MemberList-mS1W0qHY.js +1601 -0
  32. package/dist/MemberOverview-wL_ailso.js +58 -0
  33. package/dist/MemberTransactions-BV3xvFYS.js +45 -0
  34. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-DzKqVp2O.js +60799 -0
  35. package/dist/Mission-QmoURSu4.js +335 -0
  36. package/dist/Overview-CaTMLlq-.js +1078 -0
  37. package/dist/Point-CjG77Sma.js +263 -0
  38. package/dist/Promotion-C5I-1qPN.js +397 -0
  39. package/dist/Queue-BaIBCCaX.js +259 -0
  40. package/dist/Record-DqpGwZIU.js +341 -0
  41. package/dist/Review-Bq-edSOO.js +621 -0
  42. package/dist/ReviewFacebookCallback-yaC4rLki.js +243 -0
  43. package/dist/ReviewGoogleCallback-uxrrCQdu.js +213 -0
  44. package/dist/Reward-DGP65n5t.js +442 -0
  45. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-bNMoMZOy.js +149 -0
  46. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Dgrc6vXF.js +1912 -0
  47. package/dist/Segment-CNz0sR3c.js +881 -0
  48. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-DLZEzpve.js +181 -0
  49. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-CLdIeyef.js +188 -0
  50. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-ocCdtbbe.js +147 -0
  51. package/dist/Setting-BKDSGYBR.js +2000 -0
  52. package/dist/SettingAdvertisements-B2GMFfN9.js +264 -0
  53. package/dist/Store-C6uLl_Ue.js +1996 -0
  54. package/dist/StoreRewards-D4728UDf.js +535 -0
  55. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CG09fJTP.js +1129 -0
  56. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-B0_bMK5u.js +7005 -0
  57. package/dist/Tier-BNzTa1_w.js +970 -0
  58. package/dist/Title-DY5knovF.js +568 -0
  59. package/dist/Transaction-Ct4yAJ9n.js +39 -0
  60. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-CHnxi3XZ.js +130 -0
  61. package/dist/Voucher-DFTMRPT0.js +422 -0
  62. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DZU7XVlZ.js +421 -0
  63. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-BndLHmHB.js +56 -0
  64. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  65. package/dist/app-6lG4w5PT.js +59396 -0
  66. package/dist/app-wDQR6dpb.js +39 -0
  67. package/dist/app.js +7 -0
  68. package/dist/business-CrfQ56D0.js +82 -0
  69. package/dist/campaign-B9fR7RwT.js +100 -0
  70. package/dist/campaign-B_iIaTKz.js +253 -0
  71. package/dist/campaign-CpzFl8Vr.js +4 -0
  72. package/dist/campaign.enum-BAHf0dSv.js +26 -0
  73. package/dist/campaign.fn-DDEgBzH2.js +776 -0
  74. package/dist/collectible.enum-9os2zr5a.js +19 -0
  75. package/dist/collection.fn-7qP_m2MW.js +26 -0
  76. package/dist/dto-C2hLQKuu.js +222 -0
  77. package/dist/duplicateCampaign-C6RXfeWE.js +51 -0
  78. package/dist/effect-DGVfWyIc.js +89 -0
  79. package/dist/email-addresses-BHa_qQBd.js +705 -0
  80. package/dist/export-CRPfo4hq.js +97 -0
  81. package/dist/feedme.ico +0 -0
  82. package/dist/helper-0_zrz4kj.js +86 -0
  83. package/dist/index-4Vl1VXum.js +2639 -0
  84. package/dist/index-4bX0ewBJ.js +31 -0
  85. package/dist/index-Bj0TV_D5.js +36 -0
  86. package/dist/index-BpdSswT6.js +48 -0
  87. package/dist/index-By2wenzb.js +32 -0
  88. package/dist/index-C8L2jQ_6.js +28897 -0
  89. package/dist/index-CO5kQMIK.js +85 -0
  90. package/dist/index-CW_ub4cF.js +8912 -0
  91. package/dist/index-Cp8wkBus.js +124 -0
  92. package/dist/index-CuvNtC_M.js +61 -0
  93. package/dist/index-D6Te1BQZ.js +54 -0
  94. package/dist/index-DbJGJ2fB.js +146 -0
  95. package/dist/index-DeaGdUSH.js +30289 -0
  96. package/dist/index-Dp1J9Fxa.js +3 -0
  97. package/dist/index-QUvYZydO.js +67 -0
  98. package/dist/index-lwxV5iX0.js +3431 -0
  99. package/dist/index-vh86FiIQ.js +10 -0
  100. package/dist/index.esm2017-ofRmIpjY.js +3069 -0
  101. package/dist/loading-8_73fcXo.js +71 -0
  102. package/dist/lodash-Bz_vrY3P.js +3678 -0
  103. package/dist/membership-CpB39vNW.js +235 -0
  104. package/dist/moment-D7p2TMB-.js +2583 -0
  105. package/dist/money-DALHjzjF.js +15 -0
  106. package/dist/number-D_GJahxw.js +12 -0
  107. package/dist/object-qECH92oz.js +26 -0
  108. package/dist/objectId-dwaoBfJX.js +7 -0
  109. package/dist/objectid-BZSH63yc.js +145 -0
  110. package/dist/plugins-A4jDcmfS.js +1817 -0
  111. package/dist/remy-D_Deb3ue.js +13 -0
  112. package/dist/reward-BqFB2Yn2.js +36 -0
  113. package/dist/rule-DNylZfIG.js +1969 -0
  114. package/dist/rule-builder-2iT04EOj.js +102 -0
  115. package/dist/style.css +13 -0
  116. package/dist/template-D7rpG7FN.js +188 -0
  117. package/dist/tier-BJDhpH6X.js +4 -0
  118. package/dist/tiers/tier=1.png +0 -0
  119. package/dist/tiers/tier=2.png +0 -0
  120. package/dist/tiers/tier=3.png +0 -0
  121. package/dist/tiers/tier=4.png +0 -0
  122. package/dist/timezone-BW17tvi2.js +1154 -0
  123. package/dist/titles/type=diamond.png +0 -0
  124. package/dist/titles/type=drinks.png +0 -0
  125. package/dist/titles/type=food.png +0 -0
  126. package/dist/titles/type=heart.png +0 -0
  127. package/dist/titles/type=medal.png +0 -0
  128. package/dist/titles/type=spend.png +0 -0
  129. package/dist/titles/type=thank-you.png +0 -0
  130. package/dist/titles/type=thumbs-up.png +0 -0
  131. package/dist/titles/type=years.png +0 -0
  132. package/dist/trigger-CbVrS2i6.js +213 -0
  133. package/dist/tslib.es6-BCqqvLQ_.js +44 -0
  134. package/dist/type_drinks-D6jnpvwV.js +4 -0
  135. package/dist/usePagination-dXSoqxfG.js +266 -0
  136. package/dist/user-Ck-m3cB3.js +55 -0
  137. package/dist/vue-i18n-BvqmcBWZ.js +2365 -0
  138. package/dist/xlsx-CkqDfUNs.js +15491 -0
  139. package/dist/zod-B0YxCfoE.js +91 -0
  140. 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 { d as e, i as o, r as p } from "./app-6lG4w5PT.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-C8L2jQ_6.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,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-Cp8wkBus.js";
4
+ import { g as i, S as g, b as h } from "./index-C8L2jQ_6.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
+ };
@@ -0,0 +1,253 @@
1
+ import { h as s } from "./moment-D7p2TMB-.js";
2
+ import "./index-lwxV5iX0.js";
3
+ import { e as f } from "./effect-DGVfWyIc.js";
4
+ import { components as l } from "@feedmepos/ui-library";
5
+ import { i as h } from "./rule-builder-2iT04EOj.js";
6
+ import { c as O } from "./rule-DNylZfIG.js";
7
+ import { u as C } from "./business-CrfQ56D0.js";
8
+ import { C as m } from "./campaign.fn-DDEgBzH2.js";
9
+ import { i as d, c as g } from "./plugins-A4jDcmfS.js";
10
+ import { h as p } from "vue";
11
+ import { F as a } from "./campaign.enum-BAHf0dSv.js";
12
+ const o = d.global.t;
13
+ function E() {
14
+ const e = d.global.locale;
15
+ return typeof e == "string" ? e : e.value;
16
+ }
17
+ function u(e) {
18
+ return new Intl.DateTimeFormat(E(), {
19
+ day: "2-digit",
20
+ month: "short",
21
+ year: "numeric"
22
+ }).format(new Date(e));
23
+ }
24
+ function c(e) {
25
+ return p(
26
+ "div",
27
+ {
28
+ class: `${e.chipClass} gap-4 h-[22px] inline-flex items-center justify-center min-w-min px-8 rounded-md`
29
+ },
30
+ [
31
+ p(l.FmIcon, { size: "sm", name: e.icon, outline: !0 }),
32
+ p("span", { class: "fm-typo-en-body-md-600" }, e.name)
33
+ ]
34
+ );
35
+ }
36
+ const A = {
37
+ [a.enum.CREDIT]: {
38
+ chipClass: "!text-fm-color-secondary-plum !bg-[#f2ebfe]",
39
+ icon: "local_activity",
40
+ get name() {
41
+ return o("connect.campaign.common.typeName.CREDIT");
42
+ },
43
+ chip() {
44
+ return c(this);
45
+ }
46
+ },
47
+ [a.enum.PROMOTION]: {
48
+ chipClass: "!text-fm-color-secondary-citrus !bg-fm-color-system-warning-100",
49
+ icon: "loyalty",
50
+ get name() {
51
+ return o("connect.campaign.common.typeName.PROMOTION");
52
+ },
53
+ chip() {
54
+ return c(this);
55
+ }
56
+ },
57
+ [a.enum.VOUCHER]: {
58
+ chipClass: "!text-fm-color-secondary-halite !bg-[#fff0f6]",
59
+ icon: "sell",
60
+ get name() {
61
+ return o("connect.campaign.common.typeName.VOUCHER");
62
+ },
63
+ chip() {
64
+ return c(this);
65
+ }
66
+ },
67
+ [a.enum.POINT]: {
68
+ chipClass: "!text-fm-color-secondary-cocoa !bg-[#fff9e6]",
69
+ icon: "award_star",
70
+ get name() {
71
+ return o("connect.campaign.common.typeName.POINT");
72
+ },
73
+ chip() {
74
+ return c(this);
75
+ }
76
+ },
77
+ [a.enum.BROADCAST]: {
78
+ chipClass: "!text-fm-color-typo-info !bg-fm-color-system-info-100",
79
+ icon: "campaign",
80
+ get name() {
81
+ return o("connect.campaign.common.typeName.BROADCAST");
82
+ },
83
+ chip() {
84
+ return c(this);
85
+ }
86
+ },
87
+ [a.enum.GAME]: {
88
+ chipClass: "!text-fm-color-secondary-mint !bg-fm-color-system-success-100",
89
+ icon: "database",
90
+ get name() {
91
+ return o("connect.campaign.common.typeName.GAME");
92
+ },
93
+ chip() {
94
+ return c(this);
95
+ }
96
+ },
97
+ [a.enum.REWARD_POOL]: {
98
+ chipClass: "!text-fm-color-secondary-tuna !bg-[#e3f4f9]",
99
+ icon: "editor_choice",
100
+ get name() {
101
+ return o("connect.campaign.common.typeName.REWARD_POOL");
102
+ },
103
+ chip() {
104
+ return c(this);
105
+ }
106
+ },
107
+ [a.enum.COIN]: {
108
+ chipClass: "!text-fm-color-system-success-400 !bg-fm-color-system-success-100",
109
+ icon: "monetization_on",
110
+ get name() {
111
+ return o("connect.campaign.common.typeName.COIN");
112
+ },
113
+ chip() {
114
+ return c(this);
115
+ }
116
+ },
117
+ [a.enum.MEMBERSHIP]: {
118
+ chipClass: "",
119
+ icon: "",
120
+ get name() {
121
+ return o("connect.campaign.common.typeName.MEMBERSHIP");
122
+ },
123
+ chip() {
124
+ return c(this);
125
+ }
126
+ },
127
+ [a.enum.MISSION]: {
128
+ chipClass: "!text-fm-color-secondary-tuna !bg-[#e3f4f9]",
129
+ icon: "editor_choice",
130
+ get name() {
131
+ return o("connect.campaign.common.typeName.MISSION");
132
+ },
133
+ chip() {
134
+ return c(this);
135
+ }
136
+ },
137
+ [a.enum.GRAB]: {
138
+ chipClass: "!text-fm-color-secondary-tuna !bg-[#e3f4f9]",
139
+ icon: "editor_choice",
140
+ name: "Grab",
141
+ chip() {
142
+ return c(this);
143
+ }
144
+ }
145
+ };
146
+ function P(e) {
147
+ const t = b(e), r = {
148
+ active: "text-fm-color-typo-success bg-fm-color-system-success-100",
149
+ upcoming: "text-fm-color-typo-info bg-fm-color-system-info-100",
150
+ expired: "text-fm-color-typo-error bg-fm-color-system-error-100"
151
+ };
152
+ return e.type == "VOUCHER" ? p(l.FmChip, {
153
+ class: r[t],
154
+ label: g.title(o(`connect.campaign.common.status.${t}`)),
155
+ compact: !0
156
+ }) : p(l.FmChip, {
157
+ class: r[t],
158
+ label: g.title(o(`connect.campaign.common.status.${t}`)),
159
+ compact: !0
160
+ });
161
+ }
162
+ function L(e) {
163
+ const t = e.timeframeOptions;
164
+ if (!t || !t.start && !t.end)
165
+ return o("connect.campaign.common.always_active");
166
+ if (!t.start && t.end)
167
+ return o("connect.campaign.common.valid_until", {
168
+ date: u(t.end)
169
+ });
170
+ const r = u(t.start), n = t.end ? u(t.end) : o("connect.campaign.common.unlimited");
171
+ return `${r} -> ${n}`;
172
+ }
173
+ function w(e) {
174
+ const { campaign: t } = e;
175
+ function r(n) {
176
+ if (!n || !n.start && !n.end)
177
+ return "connect.campaign.common.always";
178
+ const i = n.start ? u(n.start) : "From campaign creation", y = n.end ? u(n.end) : "Never ends";
179
+ return `${i} - ${y}`;
180
+ }
181
+ return {
182
+ "connect.campaign.common.campaign_name": t.name,
183
+ "connect.campaign.common.campaign_period": r(
184
+ t.timeframeOptions
185
+ ),
186
+ get "connect.campaign.common.next_schedule_at"() {
187
+ if ((t == null ? void 0 : t.event.type) != "SCHEDULE" || !t.event.rule || !h(t.event.rule))
188
+ return;
189
+ const n = O(
190
+ t.event.rule.rules.g_schedule
191
+ );
192
+ return n ? s(n).format("ddd, DD MMM YYYY, hh:mmA") : void 0;
193
+ },
194
+ get "connect.campaign.common.discount_type"() {
195
+ if (t.type == "PROMOTION") return f(t.effect);
196
+ if ("configs" in e && e.configs.type == "VOUCHER")
197
+ return f(e.configs.extras.effect);
198
+ },
199
+ get "connect.campaign.common.available_at"() {
200
+ return t.targetLocation ? t.targetLocation.length > 0 ? t.targetLocation.map(
201
+ (n) => C().locationItems.find((i) => i.value == n).label
202
+ ).join(",") : "connect.campaign.common.no_location" : "connect.campaign.common.all_locations";
203
+ }
204
+ };
205
+ }
206
+ function b(e) {
207
+ return e.timeframeOptions && e.timeframeOptions.type == "timeframe" ? s().isBetween(
208
+ e.timeframeOptions.start ?? s().subtract(1, "d"),
209
+ e.timeframeOptions.end ?? s().add(1, "d")
210
+ ) ? "active" : s().isAfter(e.timeframeOptions.end) ? "expired" : "upcoming" : "active";
211
+ }
212
+ function B(e) {
213
+ var t, r;
214
+ switch (e.event.type) {
215
+ case "BILL_COMPLETED":
216
+ const n = `Spend to get ${m.formattedType(e.type)}`;
217
+ switch (e.type) {
218
+ case "POINT":
219
+ case "CREDIT":
220
+ case "COIN":
221
+ 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)}`;
222
+ case "VOUCHER":
223
+ const i = (r = (t = e == null ? void 0 : e.pf_collectible) == null ? void 0 : t.extras) == null ? void 0 : r.effect;
224
+ return i ? `${n} - ${f(i)}` : n;
225
+ default:
226
+ return n;
227
+ }
228
+ case "FEEDBACK":
229
+ return `Give feedback to receive ${m.formattedType(e.type)}`;
230
+ case "SCHEDULE":
231
+ return `Receive ${m.formattedType(e.type)} on scheduled time`;
232
+ case "SIMPLE_CLAIM":
233
+ return "Simple claim voucher";
234
+ case "TIER_UPGRADED":
235
+ return `Receive ${m.formattedType(e.type)} when member tier upgraded`;
236
+ case "MEMBERSHIP_JOINED":
237
+ return `Receive ${m.formattedType(e.type)} when member joined`;
238
+ case "MAKING_ORDER":
239
+ return e.type !== "PROMOTION" ? void 0 : f(e.effect);
240
+ default:
241
+ throw new Error(
242
+ `Not implemented ${JSON.stringify({ cause: e.event.type })}`
243
+ );
244
+ }
245
+ }
246
+ export {
247
+ A as C,
248
+ b as a,
249
+ P as b,
250
+ B as c,
251
+ w as d,
252
+ L as g
253
+ };