@feedmepos/mf-connect 0.1.38-beta.8 → 0.1.38-beta.80

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 (159) hide show
  1. package/dist/{Analytic-CJap-Cat.js → Analytic-LOK5TzX0.js} +31 -32
  2. package/dist/{App-CLTtX1QT.js → App-Bk5Z5u5_.js} +617 -607
  3. package/dist/AuditLogs-Rezf9EeA.js +1991 -0
  4. package/dist/{Bin-C2xMLxoE.js → Bin-B8yzS5bD.js} +10 -10
  5. package/dist/Broadcast-CZ0QCvua.js +266 -0
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BCkD7Xfn.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-iJQS2Ck9.js} +6 -6
  7. package/dist/{Card-BPrCNLQy.js → Card-BQOv5yB9.js} +145 -140
  8. package/dist/Collections-qenPlCd2.js +540 -0
  9. package/dist/Credit-BJLskbVu.js +260 -0
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
  11. package/dist/DateInput.vue_vue_type_script_setup_true_lang-BN4Q5Y3l.js +54 -0
  12. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js → DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js} +1 -1
  13. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DKWCWOU_.js +3120 -0
  14. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-Dw1qQfnG.js +351 -0
  15. package/dist/Experience-BjfEiGT8.js +259 -0
  16. package/dist/{FileSaver.min-NlMItPOc.js → FileSaver.min-C013Tr1o.js} +1 -1
  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-Gw_tFjen.js +330 -0
  20. package/dist/Grab-Bdv7SaB9.js +300 -0
  21. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js → ImageInput.vue_vue_type_script_setup_true_lang-Ba4L39GL.js} +49 -48
  22. package/dist/{Index-DMdNgISh.js → Index-C67U3YDJ.js} +54 -54
  23. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-pQ8sF5KW.js +48 -0
  24. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js → LottieAnimation.vue_vue_type_script_setup_true_lang-o-eN3J4i.js} +1 -1
  25. package/dist/{MainLayout-B1aJoR95.js → MainLayout-DPjqCyJ5.js} +1 -1
  26. package/dist/Marketing-DtEooXof.js +166 -0
  27. package/dist/MarketingMaterialEdit-Balw055Y.js +1065 -0
  28. package/dist/{Member-CnSXGQi_.js → Member-QA7TQnyw.js} +38 -37
  29. package/dist/{MemberList-DcpEKV1D.js → MemberList-CSJQFYlh.js} +486 -491
  30. package/dist/{MemberTransactions-DeuuEcO5.js → MemberTransactions-D-46vda_.js} +1 -1
  31. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DLAEPNsq.js → MessageInput.vue_vue_type_script_setup_true_lang-6a7_lw74.js} +13443 -10607
  32. package/dist/Mission-DJVxFbX5.js +334 -0
  33. package/dist/{Overview-elpi-jpI.js → Overview-Btkh3oiI.js} +24 -25
  34. package/dist/Point-CVdF9GtN.js +262 -0
  35. package/dist/Promotion-BtmlvUd3.js +396 -0
  36. package/dist/{Queue-GvBhNEFe.js → Queue-BfiCMsLC.js} +23 -24
  37. package/dist/{Record-CbSxgo8i.js → Record-B07QGPli.js} +10 -10
  38. package/dist/Review-BeZ90jW9.js +621 -0
  39. package/dist/ReviewFacebookCallback-CwAcKaib.js +243 -0
  40. package/dist/ReviewGoogleCallback-CVK6Yc5E.js +213 -0
  41. package/dist/{Reward-QCGlrq89.js → Reward-CyXqNpAa.js} +16 -16
  42. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-DSRvoo9z.js → RewardGroup.vue_vue_type_script_setup_true_lang-BICsdgSh.js} +13 -14
  43. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-BgKGNK7y.js +1912 -0
  44. package/dist/{Segment-5PndnEUa.js → Segment-B9g57O7g.js} +273 -274
  45. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-DXR7bpzY.js → SelectItems.vue_vue_type_script_setup_true_lang-BwDOXE87.js} +23 -23
  46. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-DmITlNtt.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-DXDcJLYF.js} +12 -12
  47. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-CROBk6cD.js +226 -0
  48. package/dist/Setting-BHteqZv6.js +2039 -0
  49. package/dist/SettingAdvertisements-CubrbuSL.js +264 -0
  50. package/dist/Store-u6LYUnmp.js +1996 -0
  51. package/dist/StoreRewards-D9h0YnEx.js +535 -0
  52. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-vrYqDGOa.js +1129 -0
  53. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-WgNstmNx.js +7007 -0
  54. package/dist/{Tier-BKKxG29r.js → Tier-CBdi4sPT.js} +561 -480
  55. package/dist/{Title-CReZgw8V.js → Title-BegmN7hs.js} +151 -149
  56. package/dist/{Transaction-HWCmSVaJ.js → Transaction-C6XMd9_r.js} +2 -2
  57. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-D00AchXo.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-BBf4BP4m.js} +7 -7
  58. package/dist/Voucher-D6hSas_z.js +421 -0
  59. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-ZOlAZ_q5.js +421 -0
  60. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DXF39yC1.js → ZodTextField.vue_vue_type_script_setup_true_lang-Bs8TNiCY.js} +2 -2
  61. package/dist/app-Duwed9mD.js +59309 -0
  62. package/dist/app.js +1 -1
  63. package/dist/{business-Bc-EMd2p.js → business-6oZ8Rgui.js} +11 -8
  64. package/dist/campaign-CzenWLhs.js +219 -0
  65. package/dist/campaign-PYce7g0o.js +253 -0
  66. package/dist/campaign.enum-KHniCp5a.js +26 -0
  67. package/dist/campaign.fn-dOSgHJcU.js +776 -0
  68. package/dist/{collectible.enum-C4dM8khp.js → collectible.enum-BZA1DKIB.js} +1 -1
  69. package/dist/{collection.fn-AjDNdFe1.js → collection.fn-CyfrdKBf.js} +2 -2
  70. package/dist/dto-DYmM2ud_.js +222 -0
  71. package/dist/duplicateCampaign-BXaDK8Q6.js +51 -0
  72. package/dist/effect-DBI_JHbP.js +89 -0
  73. package/dist/{email-addresses-B0SzUCQM.js → email-addresses-BNs-WN79.js} +2 -2
  74. package/dist/{export-Bgz6WcNZ.js → export-DTCCKE2m.js} +4 -4
  75. package/dist/{helper-B1vFwohM.js → helper-CeYr7Anh.js} +22 -7
  76. package/dist/index-38u-cCwD.js +3431 -0
  77. package/dist/{index-Cm2sBagk.js → index-BdjY7GRO.js} +1 -1
  78. package/dist/index-CGMiuxyf.js +85 -0
  79. package/dist/index-CQZbm9P5.js +8912 -0
  80. package/dist/index-Cal60fAm.js +48 -0
  81. package/dist/{index-DT2viYsL.js → index-CnRLkzpg.js} +617 -191
  82. package/dist/index-CuvNtC_M.js +61 -0
  83. package/dist/{index-CSQY21Zb.js → index-D-kPBF9C.js} +3 -3
  84. package/dist/{index-DVQnrex_.js → index-DcFYm1fy.js} +3 -3
  85. package/dist/index-DjONNxbl.js +30289 -0
  86. package/dist/{index-26SopNpv.js → index-ItaoypTr.js} +1 -1
  87. package/dist/index-_jxXI4_v.js +28899 -0
  88. package/dist/{index-DwT9RLst.js → index-nXfjG8UQ.js} +23 -12
  89. package/dist/{index-BIRmS75g.js → index-pHQfP2e7.js} +1 -1
  90. package/dist/{index.esm2017-BAIN70_n.js → index.esm2017-CokFPnqn.js} +185 -185
  91. package/dist/{loading-C6Ouh0mG.js → loading-fZQi5zP8.js} +1 -1
  92. package/dist/{lodash-B5I3zXaY.js → lodash-R-DIRmbj.js} +1 -1
  93. package/dist/{membership-DU0BwIj8.js → membership-CApN5ZJ1.js} +3 -3
  94. package/dist/{moment-BWErdI6_.js → moment-D7p2TMB-.js} +6 -1
  95. package/dist/{money-Bg7GuE5s.js → money-C6I6vVy2.js} +1 -1
  96. package/dist/{number-Ddmqo5D_.js → number-Dq4d381U.js} +1 -1
  97. package/dist/objectid-Kv5GREBk.js +145 -0
  98. package/dist/{campaign-BeF8kTyg.js → plugins-9_UvAdJ2.js} +784 -777
  99. package/dist/remy-NLAa-9Qg.js +46 -0
  100. package/dist/{reward-CN4gvn4c.js → reward-DXHGeGYY.js} +1 -1
  101. package/dist/{rule-CpiqqR0c.js → rule-B_XgRDr-.js} +505 -487
  102. package/dist/rule-builder-BMXyzu8k.js +102 -0
  103. package/dist/style.css +11 -2
  104. package/dist/template-CnyTUzQU.js +188 -0
  105. package/dist/timezone-Izs3ibB-.js +1156 -0
  106. package/dist/trigger-Dda3NmaE.js +213 -0
  107. package/dist/usePagination-Byxk4XVn.js +220 -0
  108. package/dist/user-BZxO8qdh.js +55 -0
  109. package/dist/{vue-i18n-DVmD9I_o.js → vue-i18n-DDbkmbSf.js} +433 -433
  110. package/dist/{xlsx-qJHsnW7k.js → xlsx-D8yNl8dN.js} +1 -1
  111. package/dist/{zod-Bg2FbC-D.js → zod-Xp7TePRP.js} +32 -31
  112. package/package.json +14 -6
  113. package/dist/AuditLogs-DW4rwNOn.js +0 -1887
  114. package/dist/Broadcast-Dhc0j16O.js +0 -227
  115. package/dist/Collections-CsUJEmqz.js +0 -465
  116. package/dist/Credit-Mqa-0XJd.js +0 -222
  117. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +0 -108
  118. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DWWLxIq-.js +0 -2185
  119. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-BiQGZeDc.js +0 -347
  120. package/dist/Experience-BD5C3old.js +0 -223
  121. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-d8rh38tD.js +0 -114
  122. package/dist/Game-D4xsi8Ym.js +0 -278
  123. package/dist/Marketing-axcQYl8k.js +0 -20073
  124. package/dist/Mission-BHZiL-GH.js +0 -296
  125. package/dist/Point-gKvdggAl.js +0 -226
  126. package/dist/Promotion-7x2F_sFX.js +0 -289
  127. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-AuN9NgcG.js +0 -1751
  128. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-DTlv8ZAn.js +0 -147
  129. package/dist/Setting-Cab47wfH.js +0 -1936
  130. package/dist/Store-BFL3T9B5.js +0 -1842
  131. package/dist/StoreRewards-C43dCJtM.js +0 -423
  132. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-aAj5-nzZ.js +0 -1029
  133. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-K3OPSYrF.js +0 -139
  134. package/dist/Voucher-BhUAcPZg.js +0 -384
  135. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-C0YNez2L.js +0 -419
  136. package/dist/_commonjsHelpers-BkfeUUK-.js +0 -28
  137. package/dist/app-BGaUIdCr.js +0 -7086
  138. package/dist/app-DccKBdW_.js +0 -33357
  139. package/dist/campaign-DbJZEU7P.js +0 -96
  140. package/dist/campaign.enum-PBKYGUQY.js +0 -20
  141. package/dist/campaign.fn-Cq-4LfQj.js +0 -758
  142. package/dist/dto-8NvMMYAb.js +0 -214
  143. package/dist/effect-DZhcEQ5g.js +0 -78
  144. package/dist/index-CQQedv0M.js +0 -32260
  145. package/dist/index-CTgQRqQR.js +0 -30038
  146. package/dist/index-CsaQJMAR.js +0 -66
  147. package/dist/index-DGaywhpY.js +0 -76
  148. package/dist/index-DOfLDlI8.js +0 -8861
  149. package/dist/index-DVpAocyR.js +0 -3120
  150. package/dist/index-DlJGd8RC.js +0 -121
  151. package/dist/index-Dm65CTdy.js +0 -38
  152. package/dist/objectid-MCaJXAgq.js +0 -145
  153. package/dist/plugins-C-CRzeyC.js +0 -208
  154. package/dist/remy-vue-client-Cpppk9h-.js +0 -1693
  155. package/dist/rule-builder-DmkJng-x.js +0 -89
  156. package/dist/template-DTZgnkl5.js +0 -190
  157. package/dist/trigger-CPjJ73Rc.js +0 -144
  158. package/dist/usePagination-BeF5K3M7.js +0 -223
  159. package/dist/user-8VIt8A1x.js +0 -54
package/dist/app.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "vue";
2
- import { F as e, i as o, r as p } from "./app-BGaUIdCr.js";
2
+ import { d as e, i as o, r as p } from "./app-Duwed9mD.js";
3
3
  export {
4
4
  e as FmApp,
5
5
  o as i18nMessages,
@@ -1,8 +1,8 @@
1
1
  import { ref as i, computed as u } from "vue";
2
2
  import { defineStore as w } from "pinia";
3
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-CTgQRqQR.js";
5
- const A = {
4
+ import { a as I, g as r, A as b, S, b as D } from "./index-_jxXI4_v.js";
5
+ const $ = {
6
6
  async readSettings(e) {
7
7
  try {
8
8
  return r(await I(`marketing-v2/${e}/setting`).get(""));
@@ -38,13 +38,13 @@ const A = {
38
38
  }, h = w("mf-connect-business", () => {
39
39
  const e = i("v2"), t = i(!1), a = i([]), c = i([]);
40
40
  async function v() {
41
- const n = y().currentBusiness.value, s = await A.readSettings(n == null ? void 0 : n.id);
41
+ const n = y().currentBusiness.value, s = await $.readSettings(n == null ? void 0 : n.id);
42
42
  return t.value = s && "business" in s && s.premium == !0 || !1, e.value = (s == null ? void 0 : s.apiVersion) || "v1", t.value;
43
43
  }
44
- async function p() {
44
+ async function d() {
45
45
  return a.value = await l.read(), a.value;
46
46
  }
47
- async function d() {
47
+ async function p() {
48
48
  return c.value = await l.readDevices(), c.value;
49
49
  }
50
50
  function m(n) {
@@ -56,7 +56,10 @@ const A = {
56
56
  label: n.name,
57
57
  value: n._id
58
58
  }))
59
- ]), g = u(() => a.value.map((n) => ({ label: n.name, value: n._id })));
59
+ ]), g = u(() => a.value.map((n) => ({
60
+ label: `${n.code ? `${n.code} - ` : ""} ${n.name}`,
61
+ value: n._id
62
+ })));
60
63
  return {
61
64
  // state
62
65
  version: e,
@@ -65,8 +68,8 @@ const A = {
65
68
  locationDevices: c,
66
69
  // actions
67
70
  readPremium: v,
68
- readLocations: p,
69
- readLocationDevices: d,
71
+ readLocations: d,
72
+ readLocationDevices: p,
70
73
  locationById: m,
71
74
  // getters
72
75
  locationItems: f,
@@ -0,0 +1,219 @@
1
+ import { defineStore as w } from "pinia";
2
+ import { reactive as I, onMounted as b, ref as o } from "vue";
3
+ import { g as a, S as l, b as d } from "./index-_jxXI4_v.js";
4
+ const s = () => {
5
+ const e = l.getBusinessId();
6
+ if (!e) throw new Error("Invalid business ID");
7
+ return d(`businesses/${e}/campaigns`, {
8
+ // url: 'http://localhost:3000/portal/',
9
+ });
10
+ }, u = {
11
+ async readAllGrouped(e) {
12
+ const t = a(
13
+ await s().get("grouped", { params: e })
14
+ );
15
+ return {
16
+ meta: t.meta,
17
+ resources: t.resources
18
+ };
19
+ },
20
+ async readAll(e, t) {
21
+ const n = a(
22
+ await s().get("", {
23
+ params: { ...e, ...t }
24
+ })
25
+ );
26
+ return {
27
+ meta: n.meta,
28
+ resources: n.resources
29
+ };
30
+ },
31
+ async readById(e) {
32
+ return a(await s().get(`/${e}`));
33
+ },
34
+ async create(e) {
35
+ return a(await s().post("", e));
36
+ },
37
+ async update(e, t) {
38
+ return a(await s().put(e, t));
39
+ },
40
+ async delete(e) {
41
+ return a(await s().delete(e));
42
+ },
43
+ async readCollectionsByCampaignId(e, t) {
44
+ const n = a(
45
+ await s().get(`/${e}/collections`, {
46
+ params: t
47
+ })
48
+ );
49
+ return {
50
+ meta: n.meta,
51
+ resources: n.resources
52
+ };
53
+ },
54
+ async readTransactions(e) {
55
+ return a(
56
+ await s().get(
57
+ `/${e}/collections/transactions`
58
+ )
59
+ );
60
+ },
61
+ async createCollectionByCampaignId(e, t) {
62
+ return a(
63
+ await s().post(`/${e}/collections`, t)
64
+ );
65
+ },
66
+ async readGroups() {
67
+ return a(await s().get("/groups")) ?? [];
68
+ },
69
+ async readStats(e) {
70
+ return a(
71
+ await s().get("/stats", { params: e })
72
+ );
73
+ },
74
+ async createGroup(e) {
75
+ return a(await s().post("/groups", e));
76
+ },
77
+ async updateGroup(e, t) {
78
+ return a(
79
+ await s().put(`/groups/${e}`, t)
80
+ );
81
+ },
82
+ async deleteGroup(e) {
83
+ return a(await s().delete(`/groups/${e}`));
84
+ },
85
+ async sendCollection(e, t) {
86
+ return a(
87
+ await s().post(
88
+ `/${e}/collections/send`,
89
+ t
90
+ )
91
+ );
92
+ },
93
+ async sendStamp(e, t) {
94
+ return a(
95
+ await s().post(
96
+ `/${e}/collections/send-stamp`,
97
+ t
98
+ )
99
+ );
100
+ },
101
+ async syncAllPromotion() {
102
+ return a(await s().post("/promotion/sync"));
103
+ },
104
+ async readAllDeleted(e, t) {
105
+ const n = a(
106
+ await s().get("/bin", {
107
+ params: { ...e, ...t }
108
+ })
109
+ );
110
+ return {
111
+ meta: n.meta,
112
+ resources: n.resources
113
+ };
114
+ },
115
+ async restore(e) {
116
+ return a(
117
+ await s().post(`/${e}/restore`)
118
+ );
119
+ },
120
+ async getPromotionQueue() {
121
+ return a(await s().get("/promotion/queue"));
122
+ }
123
+ }, p = () => {
124
+ const e = l.getBusinessId();
125
+ if (!e) throw new Error("Invalid business ID");
126
+ return d(`businesses/${e}/campaigns`, {
127
+ noIdRequired: !0
128
+ });
129
+ }, f = {
130
+ async readAll() {
131
+ return a(await p().get("templates"));
132
+ },
133
+ async readById(e) {
134
+ return a(
135
+ await p().get(`templates/${e}`)
136
+ );
137
+ }
138
+ }, E = w("mf-connect-campaign", () => {
139
+ const e = I({
140
+ promotion: [],
141
+ voucher: [],
142
+ broadcast: [],
143
+ experience: [],
144
+ point: [],
145
+ credit: [],
146
+ token: [],
147
+ mission: [],
148
+ grab: [],
149
+ all: []
150
+ });
151
+ b(() => {
152
+ console.log("🔧 CampaignStore Installed");
153
+ });
154
+ const t = o([]), n = o([]), c = o([]);
155
+ async function m(h) {
156
+ const i = await u.readAll({
157
+ limit: 1e3,
158
+ skip: 0,
159
+ sortBy: "_id",
160
+ descending: !0
161
+ });
162
+ Object.keys(e).forEach((r) => {
163
+ e[r] = [];
164
+ }), e.all = i.resources.filter(
165
+ (r) => r.type !== "MEMBERSHIP"
166
+ );
167
+ for (const r of i.resources)
168
+ switch (r.type) {
169
+ case "PROMOTION":
170
+ e.promotion.push(r);
171
+ break;
172
+ case "VOUCHER":
173
+ e.voucher.push(r), c.value.push(r);
174
+ break;
175
+ case "BROADCAST":
176
+ ["SCHEDULE", "FEEDBACK"].includes(r.event.type) && e.broadcast.push(r);
177
+ break;
178
+ case "POINT":
179
+ e.experience.push(r);
180
+ break;
181
+ case "COIN":
182
+ e.point.push(r);
183
+ break;
184
+ case "CREDIT":
185
+ e.credit.push(r);
186
+ break;
187
+ case "GAME":
188
+ e.token.push(r);
189
+ break;
190
+ case "MISSION":
191
+ e.mission.push(r);
192
+ break;
193
+ case "GRAB":
194
+ e.grab.push(r);
195
+ break;
196
+ }
197
+ }
198
+ async function g() {
199
+ n.value = await u.readGroups();
200
+ }
201
+ async function y() {
202
+ t.value = await f.readAll();
203
+ }
204
+ return {
205
+ // State
206
+ campaigns: e,
207
+ templates: t,
208
+ groups: n,
209
+ voucher: c,
210
+ // Actions
211
+ read: m,
212
+ readGroups: g,
213
+ readTemplates: y
214
+ };
215
+ });
216
+ export {
217
+ u as c,
218
+ E as u
219
+ };
@@ -0,0 +1,253 @@
1
+ import { h as s } from "./moment-D7p2TMB-.js";
2
+ import "./index-38u-cCwD.js";
3
+ import { e as f } from "./effect-DBI_JHbP.js";
4
+ import { components as l } from "@feedmepos/ui-library";
5
+ import { i as h } from "./rule-builder-BMXyzu8k.js";
6
+ import { c as O } from "./rule-B_XgRDr-.js";
7
+ import { u as C } from "./business-6oZ8Rgui.js";
8
+ import { C as m } from "./campaign.fn-dOSgHJcU.js";
9
+ import { i as d, c as g } from "./plugins-9_UvAdJ2.js";
10
+ import { h as p } from "vue";
11
+ import { F as a } from "./campaign.enum-KHniCp5a.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
+ };
@@ -0,0 +1,26 @@
1
+ import { z as E } from "./index-DjONNxbl.js";
2
+ const M = E.enum([
3
+ "VOUCHER",
4
+ "PROMOTION",
5
+ "POINT",
6
+ "CREDIT",
7
+ "MEMBERSHIP",
8
+ "BROADCAST",
9
+ "COIN",
10
+ "REWARD_POOL",
11
+ "GAME",
12
+ "MISSION",
13
+ "GRAB"
14
+ ]), O = E.enum([
15
+ "TIME_BASED_PROMOTION",
16
+ "GAME_PROMOTION",
17
+ "PRICE_CHANGE_PROMOTION"
18
+ ]), R = {
19
+ [O.enum.TIME_BASED_PROMOTION]: "7.7.4",
20
+ [O.enum.GAME_PROMOTION]: "7.7.4",
21
+ [O.enum.PRICE_CHANGE_PROMOTION]: "7.12.18"
22
+ };
23
+ export {
24
+ M as F,
25
+ R as f
26
+ };