@feedmepos/mf-connect 0.1.98-beta.8 → 0.1.98-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 (167) hide show
  1. package/dist/{App-DsB2o1oB.js → App-DievprEi.js} +853 -683
  2. package/dist/{AuditLogs-BcfgiYnJ.js → AuditLogs-DrdqOhZL.js} +16 -13
  3. package/dist/{Bin-DMr7K8Kj.js → Bin-Ci2k3z77.js} +8 -8
  4. package/dist/Broadcast-CpDMAG1o.js +306 -0
  5. package/dist/CampaignAnalytic-uRyGaLaN.js +1830 -0
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CwGoEBsW.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DtGe2Og1.js} +8 -5
  7. package/dist/Card-tb98Kyr-.js +1086 -0
  8. package/dist/{Collections-B0uGC2FE.js → Collections-P1S5WjnJ.js} +14 -13
  9. package/dist/Credit-DwK7JYf-.js +286 -0
  10. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-Cyk0iIsd.js +53 -0
  11. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-8r29jKh9.js +4432 -0
  12. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-DJLxGk7W.js → EffectSheet.vue_vue_type_style_index_0_lang-BML_-v8I.js} +36 -36
  13. package/dist/Experience-BejtRlOj.js +288 -0
  14. package/dist/{FileSaver.min-BlA0oZEC.js → FileSaver.min-C-hmBaHm.js} +1 -1
  15. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-3bH-tZAm.js +138 -0
  16. package/dist/Game-n8qL896g.js +356 -0
  17. package/dist/GiftCardSetup-Bgsfcu7N.js +736 -0
  18. package/dist/GoalPickerPanel.vue_vue_type_script_setup_true_lang-CzL68PPP.js +424 -0
  19. package/dist/Goals-BB8LJlq3.js +247 -0
  20. package/dist/{Grab-DmmwrGzk.js → Grab-COq3Ujst.js} +33 -32
  21. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-DNtLW0yQ.js → ImageInput.vue_vue_type_script_setup_true_lang-BmLclEyi.js} +1 -1
  22. package/dist/{Index-m7l4insz.js → Index-BdkIinaE.js} +10 -10
  23. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-B9sJ-M20.js → LocationPicker.vue_vue_type_script_setup_true_lang-DsWv3DVb.js} +1 -1
  24. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-Dsg2sWjF.js → LottieAnimation.vue_vue_type_script_setup_true_lang-DvOzGF8c.js} +1 -1
  25. package/dist/LoyaltyDashboard-D4Jtpw0n.js +2911 -0
  26. package/dist/MainLayout-Ca-Xm3eZ.js +143 -0
  27. package/dist/{Marketing-C9pSIdBU.js → Marketing-Cpe4s7NZ.js} +7 -6
  28. package/dist/{MarketingMaterialEdit-BEF2T9LR.js → MarketingMaterialEdit-nTeS9VVx.js} +15 -14
  29. package/dist/Member-DgGZ4Cdg.js +654 -0
  30. package/dist/MemberDetailSheet.vue_vue_type_script_setup_true_lang-_O3B-FIA.js +1281 -0
  31. package/dist/MemberImportHistory-rdlbDVWU.js +187 -0
  32. package/dist/MemberList-BC4aRJTt.js +334 -0
  33. package/dist/{MemberTransactions-CAut1TQb.js → MemberTransactions-BFfdTttp.js} +1 -1
  34. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-1AuHixPC.js → MessageInput.vue_vue_type_script_setup_true_lang-DXajAQy9.js} +5928 -5644
  35. package/dist/MetricInfoTooltip.vue_vue_type_script_setup_true_lang-8xVDzdO3.js +40 -0
  36. package/dist/Mission-BWCNKTjU.js +363 -0
  37. package/dist/Overview--Q7vzhNK.js +1316 -0
  38. package/dist/{Overview-DOJj4XvO.js → Overview-i02Wnyjn.js} +23 -20
  39. package/dist/Point-CiWxqny5.js +297 -0
  40. package/dist/Promotion-B0G9qfBm.js +426 -0
  41. package/dist/{Queue-55G2gtP5.js → Queue-YfwgYmzH.js} +16 -13
  42. package/dist/{Record-DNPI02c6.js → Record-CCuwrPKW.js} +9 -9
  43. package/dist/Review-ymsfdh7Q.js +45 -0
  44. package/dist/ReviewFacebookCallback-DyDExWvP.js +238 -0
  45. package/dist/ReviewGoogleCallback-DNyg3n2S.js +213 -0
  46. package/dist/{Reward-CnP8R2pS.js → Reward-BKIb0ezH.js} +28 -28
  47. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-BN71h9IK.js → RewardGroup.vue_vue_type_script_setup_true_lang-DPaaNgpr.js} +26 -23
  48. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-CtB9Ls5-.js → RuleGroup.vue_vue_type_script_setup_true_lang-BLFLybFn.js} +198 -186
  49. package/dist/{Segment-CxiQnnyj.js → Segment-D5_pp7fh.js} +278 -276
  50. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-B1vj5f7T.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-BLLjIA-D.js} +45 -42
  51. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-cWx0G3nM.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-BRIcZwnU.js} +4 -4
  52. package/dist/Setting-CD78gIMU.js +574 -0
  53. package/dist/{SettingAdvertisements-Vt7w1WN3.js → SettingAdvertisements-C2AIT4s4.js} +12 -12
  54. package/dist/Settings-DI_tryQV.js +230 -0
  55. package/dist/Store-BV2JTRNZ.js +2615 -0
  56. package/dist/{StoreRewards-DILeipMG.js → StoreRewards-Bk55YXyO.js} +15 -15
  57. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BZZ1fqwg.js +1331 -0
  58. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-C7lVeybl.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BrEzWVrH.js} +2 -2
  59. package/dist/{Tier-BAZ1xuKL.js → Tier-CO2K30Ew.js} +2576 -757
  60. package/dist/{Title-CcNAt47f.js → Title-qProQh3T.js} +41 -37
  61. package/dist/Transaction-qL5L-fE_.js +45 -0
  62. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-hUjQVZ_U.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-Co1BPScS.js} +26 -26
  63. package/dist/Voucher-VFD1LY9Y.js +837 -0
  64. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-CTQDxc5l.js → VoucherEditor.vue_vue_type_script_setup_true_lang-9QyTl7iq.js} +118 -124
  65. package/dist/WhatsappAccount-CxSGqm7H.js +325 -0
  66. package/dist/WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-D8L6izf0.js +96 -0
  67. package/dist/WhatsappBot-C4Oz7Xwv.js +441 -0
  68. package/dist/WhatsappBotSettings-CKqaWzwE.js +136 -0
  69. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DuRKA4cj.js → ZodTextField.vue_vue_type_script_setup_true_lang-Bcsi94dw.js} +2 -2
  70. package/dist/{app-Z-UKRG5V.js → app-BEYzXWZO.js} +50954 -42517
  71. package/dist/app.js +1 -1
  72. package/dist/base.export-S_82Elmg.js +75 -0
  73. package/dist/browser-BSAOEeIM.js +1478 -0
  74. package/dist/{business-C7EF6cKC.js → business-DH7djUl8.js} +5 -5
  75. package/dist/campaign-DlHDgoFX.js +100 -0
  76. package/dist/campaign-k_WHxsOR.js +400 -0
  77. package/dist/{campaign.enum-BNN2gLFY.js → campaign.enum-Dx-Zo68Q.js} +1 -1
  78. package/dist/{campaign.fn-Bd34dVnx.js → campaign.fn-B-4JRzft.js} +67 -67
  79. package/dist/{collectible.enum-DO9HdJGH.js → collectible.enum-Liy2wH3s.js} +1 -1
  80. package/dist/collection.fn-zQwWDzZT.js +26 -0
  81. package/dist/currency-CQVHXBFe.js +7 -0
  82. package/dist/{duplicateCampaign-2ODeDw3a.js → duplicateCampaign-YTXMbJTj.js} +11 -11
  83. package/dist/{effect-BcB8IlTI.js → effect-CQkVLHWi.js} +1 -1
  84. package/dist/{email-addresses-BcTeU4Sh.js → email-addresses-BIoVbPGC.js} +209 -201
  85. package/dist/google-C3S8u0mT.js +4 -0
  86. package/dist/{helper-BSgrCJRv.js → helper-BCkTvF4m.js} +1 -1
  87. package/dist/{index-CoHWpylO.js → index-B-bQnb0_.js} +2115 -2557
  88. package/dist/index-BAJOC43K.js +14550 -0
  89. package/dist/{index-HXiYGO4_.js → index-BFIHEBnX.js} +6343 -7693
  90. package/dist/{index-VlFWaBrg.js → index-BJIQe3QJ.js} +1 -1
  91. package/dist/{index-BpI-BI4H.js → index-BJkRTH5T.js} +4 -4
  92. package/dist/index-BOJogkKQ.js +172 -0
  93. package/dist/{index-BoYEqLif.js → index-BRPajAkE.js} +1517 -263
  94. package/dist/{index-CsoBDon4.js → index-BTkxgos0.js} +1590 -1523
  95. package/dist/index-BUP4aHq8.js +32438 -0
  96. package/dist/index-BYvnqARr.js +902 -0
  97. package/dist/{index-hlyg-wxV.js → index-Bonq819P.js} +1 -1
  98. package/dist/{index-CIBPhxlC.js → index-C6mOI2Pp.js} +105 -123
  99. package/dist/{index-Bf6jNZit.js → index-CDIe15AY.js} +24 -9
  100. package/dist/index-CTrcdIkt.js +137 -0
  101. package/dist/index-C_H8jFYf.js +2743 -0
  102. package/dist/index-CpnchVe1.js +74 -0
  103. package/dist/index-D5AR7A5e.js +151 -0
  104. package/dist/index-D7-Q86HI.js +54 -0
  105. package/dist/index-DdOj8Hew.js +53 -0
  106. package/dist/{index-iMPtFp54.js → index-Dvqguh2B.js} +10 -9
  107. package/dist/{index-Bm0QPucw.js → index-hAKRfE-4.js} +14 -14
  108. package/dist/index-o2Ga_qaX.js +39 -0
  109. package/dist/{index.esm2017-CM7OnEyP.js → index.esm2017-D0fhMMPG.js} +128 -128
  110. package/dist/{loading-CSXr0Yqz.js → loading-C686AMVG.js} +1 -1
  111. package/dist/{lodash-Bh7XKI-R.js → lodash-CANlWUWW.js} +1 -1
  112. package/dist/member-import-UzJ6ByIS.js +188 -0
  113. package/dist/membership-DCVzFaFy.js +274 -0
  114. package/dist/{money-BZIST_m9.js → money-DuazwoX7.js} +1 -1
  115. package/dist/{number-DXLR2w95.js → number-B2HFiV0g.js} +1 -1
  116. package/dist/objectid-Bq-oVMdP.js +145 -0
  117. package/dist/onboarding-BxvNxz-9.js +131 -0
  118. package/dist/onboardingSetup-CcvKmyx8.js +17 -0
  119. package/dist/{plugins-4FlbwoES.js → plugins-C39O5j42.js} +13 -12
  120. package/dist/remy-Qz_pNsUS.js +13 -0
  121. package/dist/{reward-DUbl79bZ.js → reward-HYt-2nxt.js} +1 -1
  122. package/dist/{rule-BQUoZ4l_.js → rule-3xNIYM7z.js} +337 -275
  123. package/dist/style.css +1 -1
  124. package/dist/{template-BoiSG7G7.js → template-D37Z_b0m.js} +6 -6
  125. package/dist/timezone-JwnQgpaU.js +20 -0
  126. package/dist/transaction.fn-C5vswLI_.js +71 -0
  127. package/dist/{trigger-D5g5m6tT.js → trigger-Bc6s2cvq.js} +17 -17
  128. package/dist/useMarketingMaterialActions-DMGyAXcy.js +96 -0
  129. package/dist/{usePagination-DHePBBoR.js → usePagination-DLOOwiiY.js} +1 -1
  130. package/dist/{user-C_ToSo-g.js → user-CTIGugVF.js} +1 -1
  131. package/dist/{vue-i18n-BcYh6_51.js → vue-i18n-Dpic36zz.js} +287 -287
  132. package/dist/{xlsx-h4G1C-xj.js → xlsx-CT9_1SFr.js} +786 -786
  133. package/dist/{zod-CgigfJar.js → zod-CGVrMcDl.js} +1 -1
  134. package/package.json +10 -6
  135. package/dist/Broadcast-C9akM-TB.js +0 -266
  136. package/dist/Card-DRkIYs0M.js +0 -910
  137. package/dist/Credit-V5YA_hGx.js +0 -260
  138. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +0 -58
  139. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-CYQMXARx.js +0 -3377
  140. package/dist/Experience-WTWy5yY6.js +0 -259
  141. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
  142. package/dist/Game-BwOfTCW5.js +0 -330
  143. package/dist/LoyaltyDashboard-CJdhYiea.js +0 -1082
  144. package/dist/MainLayout-Du5kZOtA.js +0 -41
  145. package/dist/Member-DUV_vbPI.js +0 -280
  146. package/dist/MemberList-Ye4nOk-i.js +0 -1601
  147. package/dist/Mission-BBmCGpt8.js +0 -334
  148. package/dist/Point-Bzg6hi6o.js +0 -262
  149. package/dist/Promotion-BMXIp_ef.js +0 -397
  150. package/dist/Review-CYNPPxYU.js +0 -1141
  151. package/dist/ReviewFacebookCallback-0SUkKAaC.js +0 -243
  152. package/dist/ReviewGoogleCallback-BZEzx68n.js +0 -208
  153. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-C4vohf6c.js +0 -181
  154. package/dist/Setting-jHAjccod.js +0 -2047
  155. package/dist/Store-Cu-hKmVa.js +0 -1996
  156. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CGz6CTWA.js +0 -1130
  157. package/dist/Transaction-D7DO3dKQ.js +0 -39
  158. package/dist/Voucher-Cq-n1CaC.js +0 -421
  159. package/dist/campaign--MjoY1Mn.js +0 -219
  160. package/dist/campaign-DHBuP4UA.js +0 -277
  161. package/dist/export-CjB7qxZ9.js +0 -97
  162. package/dist/index-BIAjmMga.js +0 -85
  163. package/dist/index-Bv4MBLQ5.js +0 -52
  164. package/dist/index-hbyCVNa7.js +0 -30289
  165. package/dist/membership-CfredTm3.js +0 -255
  166. package/dist/objectid-Dg4ZodlT.js +0 -145
  167. package/dist/useMarketingMaterialActions-B-Jlw2Z9.js +0 -107
@@ -1,7 +1,7 @@
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-HXiYGO4_.js";
4
+ import { d as I, g as r, A as b, S, b as D } from "./index-BUP4aHq8.js";
5
5
  const $ = {
6
6
  async readSettings(e) {
7
7
  try {
@@ -37,11 +37,11 @@ const $ = {
37
37
  }
38
38
  }, h = w("mf-connect-business", () => {
39
39
  const e = i("v2"), t = i(!1), a = i([]), c = i([]);
40
- async function v() {
40
+ async function d() {
41
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 d() {
44
+ async function v() {
45
45
  return a.value = await l.read(), a.value;
46
46
  }
47
47
  async function p() {
@@ -67,8 +67,8 @@ const $ = {
67
67
  locations: a,
68
68
  locationDevices: c,
69
69
  // actions
70
- readPremium: v,
71
- readLocations: d,
70
+ readPremium: d,
71
+ readLocations: v,
72
72
  readLocationDevices: p,
73
73
  locationById: m,
74
74
  // getters
@@ -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-D5AR7A5e.js";
4
+ import { g as i, S as g, b as h } from "./index-BUP4aHq8.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,400 @@
1
+ import { h as u } from "./moment-D7p2TMB-.js";
2
+ import "./index-BYvnqARr.js";
3
+ import { e as l } from "./effect-CQkVLHWi.js";
4
+ import { components as d } from "@feedmepos/ui-library";
5
+ import { a as E } from "./index-BRPajAkE.js";
6
+ import { c as N } from "./rule-3xNIYM7z.js";
7
+ import { u as I } from "./business-DH7djUl8.js";
8
+ import { C as m } from "./campaign.fn-B-4JRzft.js";
9
+ import { g as y, t as h } from "./index-BAJOC43K.js";
10
+ import { c as C } from "./string-Gcy5IM_H.js";
11
+ import { i as f } from "./plugins-C39O5j42.js";
12
+ import { h as p } from "vue";
13
+ import { F as s } from "./campaign.enum-Dx-Zo68Q.js";
14
+ const R = [
15
+ "APP_INBOX",
16
+ "PUSH",
17
+ "SMS",
18
+ "EMAIL",
19
+ "WHATSAPP"
20
+ ], S = [...R];
21
+ function j(t) {
22
+ return S.includes(t);
23
+ }
24
+ function O(t, e) {
25
+ return t === "APP_INBOX" ? {
26
+ title: "",
27
+ previewText: "",
28
+ content: "",
29
+ buttons: [],
30
+ variables: e
31
+ } : t === "PUSH" ? {
32
+ title: "",
33
+ body: "",
34
+ destination: "NONE",
35
+ variables: e
36
+ } : {
37
+ channel: t,
38
+ content: "",
39
+ language: "en",
40
+ variables: e
41
+ };
42
+ }
43
+ function V(t, e, n = []) {
44
+ return t.channels.includes(e) ? t : {
45
+ ...t,
46
+ channels: [...t.channels, e],
47
+ content: {
48
+ ...t.content,
49
+ [e]: t.content[e] ?? O(e, n)
50
+ }
51
+ };
52
+ }
53
+ function X(t, e) {
54
+ const n = { ...t.content };
55
+ return delete n[e], {
56
+ ...t,
57
+ channels: t.channels.filter((o) => o !== e),
58
+ content: n
59
+ };
60
+ }
61
+ function z(t, e, n) {
62
+ return {
63
+ ...t,
64
+ content: { ...t.content, [e]: n }
65
+ };
66
+ }
67
+ function W(t, e, n) {
68
+ const o = t.channels.indexOf(e), a = o + n;
69
+ if (o < 0 || a < 0 || a >= t.channels.length) return t;
70
+ const r = [...t.channels];
71
+ return [r[o], r[a]] = [r[a], r[o]], { ...t, channels: r };
72
+ }
73
+ function J(t, e, n = []) {
74
+ const [o, ...a] = t.channels;
75
+ if (o === e) return t;
76
+ const r = {
77
+ ...t.content,
78
+ [e]: t.content[e] ?? O(e, n)
79
+ };
80
+ return o && delete r[o], {
81
+ ...t,
82
+ channels: [e, ...a.filter((b) => b !== e)],
83
+ content: r
84
+ };
85
+ }
86
+ function K(t, e) {
87
+ if (!e) return !1;
88
+ const n = t.content[e];
89
+ return n ? ["title", "previewText", "content", "body"].some(
90
+ (o) => typeof n[o] == "string" && !!n[o].trim()
91
+ ) : !1;
92
+ }
93
+ function q(t, e) {
94
+ return { ...t, mode: e };
95
+ }
96
+ function Q(t, e) {
97
+ const n = t.content[e];
98
+ if (!n) return !1;
99
+ if (e === "APP_INBOX") {
100
+ const o = n, a = (o.buttons ?? []).every(
101
+ (r) => r.label.trim().length > 0 && y.safeParse(r.url ?? "").success
102
+ );
103
+ return o.title.trim().length > 0 && o.previewText.trim().length > 0 && a;
104
+ }
105
+ if (e === "PUSH") {
106
+ const o = n, a = o.title.trim().length > 0 && o.body.trim().length > 0, r = o.destination !== "EXTERNAL" || y.safeParse(o.url ?? "").success;
107
+ return a && r;
108
+ }
109
+ return n.content.trim().length > 0;
110
+ }
111
+ function A(t, e) {
112
+ return t.channels.map(e).join(t.mode === "fallback" ? " → " : " + ");
113
+ }
114
+ function Z(t) {
115
+ var e, n;
116
+ if (!(!t || t.delivery)) {
117
+ if ((n = (e = t.message) == null ? void 0 : e.content) != null && n.trim()) {
118
+ t.delivery = h(t);
119
+ return;
120
+ }
121
+ delete t.message, t.delivery = { mode: "fallback", channels: [], content: {} };
122
+ }
123
+ }
124
+ const c = f.global.t;
125
+ function D() {
126
+ const t = f.global.locale;
127
+ return typeof t == "string" ? t : t.value;
128
+ }
129
+ function g(t) {
130
+ return new Intl.DateTimeFormat(D(), {
131
+ day: "2-digit",
132
+ month: "short",
133
+ year: "numeric"
134
+ }).format(new Date(t));
135
+ }
136
+ function i(t) {
137
+ return p(
138
+ "div",
139
+ {
140
+ class: `${t.chipClass} gap-4 h-[22px] inline-flex items-center justify-center min-w-min px-8 rounded-md`
141
+ },
142
+ [
143
+ p(d.FmIcon, { size: "sm", name: t.icon, outline: !0 }),
144
+ p("span", { class: "fm-typo-en-body-md-600" }, t.name)
145
+ ]
146
+ );
147
+ }
148
+ const tt = {
149
+ [s.enum.CREDIT]: {
150
+ chipClass: "!text-fm-color-secondary-plum !bg-[#f2ebfe]",
151
+ icon: "local_activity",
152
+ get name() {
153
+ return c("connect.campaign.common.typeName.CREDIT");
154
+ },
155
+ chip() {
156
+ return i(this);
157
+ }
158
+ },
159
+ [s.enum.PROMOTION]: {
160
+ chipClass: "!text-fm-color-secondary-citrus !bg-fm-color-system-warning-100",
161
+ icon: "loyalty",
162
+ get name() {
163
+ return c("connect.campaign.common.typeName.PROMOTION");
164
+ },
165
+ chip() {
166
+ return i(this);
167
+ }
168
+ },
169
+ [s.enum.VOUCHER]: {
170
+ chipClass: "!text-fm-color-secondary-halite !bg-[#fff0f6]",
171
+ icon: "sell",
172
+ get name() {
173
+ return c("connect.campaign.common.typeName.VOUCHER");
174
+ },
175
+ chip() {
176
+ return i(this);
177
+ }
178
+ },
179
+ [s.enum.POINT]: {
180
+ chipClass: "!text-fm-color-secondary-cocoa !bg-[#fff9e6]",
181
+ icon: "award_star",
182
+ get name() {
183
+ return c("connect.campaign.common.typeName.POINT");
184
+ },
185
+ chip() {
186
+ return i(this);
187
+ }
188
+ },
189
+ [s.enum.BROADCAST]: {
190
+ chipClass: "!text-fm-color-typo-info !bg-fm-color-system-info-100",
191
+ icon: "campaign",
192
+ get name() {
193
+ return c("connect.campaign.common.typeName.BROADCAST");
194
+ },
195
+ chip() {
196
+ return i(this);
197
+ }
198
+ },
199
+ [s.enum.GAME]: {
200
+ chipClass: "!text-fm-color-secondary-mint !bg-fm-color-system-success-100",
201
+ icon: "database",
202
+ get name() {
203
+ return c("connect.campaign.common.typeName.GAME");
204
+ },
205
+ chip() {
206
+ return i(this);
207
+ }
208
+ },
209
+ [s.enum.REWARD_POOL]: {
210
+ chipClass: "!text-fm-color-secondary-tuna !bg-[#e3f4f9]",
211
+ icon: "editor_choice",
212
+ get name() {
213
+ return c("connect.campaign.common.typeName.REWARD_POOL");
214
+ },
215
+ chip() {
216
+ return i(this);
217
+ }
218
+ },
219
+ [s.enum.COIN]: {
220
+ chipClass: "!text-fm-color-system-success-400 !bg-fm-color-system-success-100",
221
+ icon: "monetization_on",
222
+ get name() {
223
+ return c("connect.campaign.common.typeName.COIN");
224
+ },
225
+ chip() {
226
+ return i(this);
227
+ }
228
+ },
229
+ [s.enum.MEMBERSHIP]: {
230
+ chipClass: "",
231
+ icon: "",
232
+ get name() {
233
+ return c("connect.campaign.common.typeName.MEMBERSHIP");
234
+ },
235
+ chip() {
236
+ return i(this);
237
+ }
238
+ },
239
+ [s.enum.MISSION]: {
240
+ chipClass: "!text-fm-color-secondary-tuna !bg-[#e3f4f9]",
241
+ icon: "editor_choice",
242
+ get name() {
243
+ return c("connect.campaign.common.typeName.MISSION");
244
+ },
245
+ chip() {
246
+ return i(this);
247
+ }
248
+ },
249
+ [s.enum.GRAB]: {
250
+ chipClass: "!text-fm-color-secondary-tuna !bg-[#e3f4f9]",
251
+ icon: "editor_choice",
252
+ name: "Grab",
253
+ chip() {
254
+ return i(this);
255
+ }
256
+ }
257
+ };
258
+ function et(t) {
259
+ const e = _(t), n = {
260
+ active: "text-fm-color-typo-success bg-fm-color-system-success-100",
261
+ upcoming: "text-fm-color-typo-info bg-fm-color-system-info-100",
262
+ expired: "text-fm-color-typo-error bg-fm-color-system-error-100"
263
+ };
264
+ return t.type == "VOUCHER" ? p(d.FmChip, {
265
+ class: n[e],
266
+ label: C.title(c(`connect.campaign.common.status.${e}`)),
267
+ compact: !0
268
+ }) : p(d.FmChip, {
269
+ class: n[e],
270
+ label: C.title(c(`connect.campaign.common.status.${e}`)),
271
+ compact: !0
272
+ });
273
+ }
274
+ function nt(t) {
275
+ const e = t.timeframeOptions;
276
+ if (!e || !e.start && !e.end)
277
+ return c("connect.campaign.common.always_active");
278
+ if (!e.start && e.end)
279
+ return c("connect.campaign.common.valid_until", {
280
+ date: g(e.end)
281
+ });
282
+ const n = g(e.start), o = e.end ? g(e.end) : c("connect.campaign.common.unlimited");
283
+ return `${n} -> ${o}`;
284
+ }
285
+ function P(t) {
286
+ if (!t || !t.start && !t.end)
287
+ return "connect.campaign.common.always";
288
+ const e = t.start ? u(t.start).format("DD MMM YYYY") : "From campaign creation", n = t.end ? u(t.end).format("DD MMM YYYY") : "Never ends";
289
+ return `${e} - ${n}`;
290
+ }
291
+ function ot(t) {
292
+ const { campaign: e } = t;
293
+ return {
294
+ "connect.campaign.common.campaign_name": e.name,
295
+ "connect.campaign.common.campaign_period": P(
296
+ e.timeframeOptions
297
+ ),
298
+ get "connect.campaign.common.next_schedule_at"() {
299
+ if ((e == null ? void 0 : e.event.type) != "SCHEDULE" || !e.event.rule || !E(e.event.rule))
300
+ return;
301
+ const n = N(
302
+ e.event.rule.rules.g_schedule
303
+ );
304
+ return n ? u(n).format("ddd, DD MMM YYYY, hh:mmA") : void 0;
305
+ },
306
+ get "connect.campaign.common.discount_type"() {
307
+ if (e.type == "PROMOTION") return l(e.effect);
308
+ if ("configs" in t && t.configs.type == "VOUCHER")
309
+ return l(t.configs.extras.effect);
310
+ },
311
+ get "connect.campaign.broadcast.summary.delivery"() {
312
+ if (e.type != "BROADCAST") return;
313
+ const n = h(e);
314
+ if (!(n.channels.length < 2))
315
+ return `connect.campaign.broadcast.mode.${n.mode}.label`;
316
+ },
317
+ get "connect.campaign.broadcast.summary.channels"() {
318
+ var n;
319
+ if (e.type == "BROADCAST")
320
+ return ((n = T(e)) == null ? void 0 : n.route) ?? "connect.campaign.broadcast.noChannelsSelected";
321
+ },
322
+ get "connect.campaign.common.available_at"() {
323
+ return e.targetLocation ? e.targetLocation.length > 0 ? e.targetLocation.map(
324
+ (n) => I().locationItems.find((o) => o.value == n).label
325
+ ).join(",") : "connect.campaign.common.no_location" : "connect.campaign.common.all_locations";
326
+ }
327
+ };
328
+ }
329
+ function _(t) {
330
+ return t.timeframeOptions && t.timeframeOptions.type == "timeframe" ? u().isBetween(
331
+ t.timeframeOptions.start ?? u().subtract(1, "d"),
332
+ t.timeframeOptions.end ?? u().add(1, "d")
333
+ ) ? "active" : u().isAfter(t.timeframeOptions.end) ? "expired" : "upcoming" : "active";
334
+ }
335
+ function T(t) {
336
+ const e = h(t);
337
+ if (!e.channels.length) return null;
338
+ const o = A(e, (a) => f.global.t(`connect.campaign.broadcast.channel.${a}`));
339
+ return {
340
+ strategy: e.channels.length > 1 ? f.global.t(
341
+ `connect.campaign.broadcast.strategy.${e.mode}`
342
+ ) : null,
343
+ route: o
344
+ };
345
+ }
346
+ function at(t) {
347
+ var e, n;
348
+ switch (t.event.type) {
349
+ case "BILL_COMPLETED":
350
+ const o = `Spend to get ${m.formattedType(t.type)}`;
351
+ switch (t.type) {
352
+ case "POINT":
353
+ case "CREDIT":
354
+ case "COIN":
355
+ return t.earningOption.type == "FIXED" ? `Spend to get ${t.earningOption.amount} ${m.formattedType(t.type)}` : `Every ${t.earningOption.every} amount spent get ${t.earningOption.amount} ${m.formattedType(t.type)}`;
356
+ case "VOUCHER":
357
+ const a = (n = (e = t == null ? void 0 : t.pf_collectible) == null ? void 0 : e.extras) == null ? void 0 : n.effect;
358
+ return a ? `${o} - ${l(a)}` : o;
359
+ default:
360
+ return o;
361
+ }
362
+ case "FEEDBACK":
363
+ return `Give feedback to receive ${m.formattedType(t.type)}`;
364
+ case "SCHEDULE":
365
+ return `Receive ${m.formattedType(t.type)} on scheduled time`;
366
+ case "SIMPLE_CLAIM":
367
+ return "Simple claim voucher";
368
+ case "TIER_UPGRADED":
369
+ return `Receive ${m.formattedType(t.type)} when member tier upgraded`;
370
+ case "MEMBERSHIP_JOINED":
371
+ return `Receive ${m.formattedType(t.type)} when member joined`;
372
+ case "MAKING_ORDER":
373
+ return t.type !== "PROMOTION" ? void 0 : l(t.effect);
374
+ default:
375
+ throw new Error(
376
+ `Not implemented ${JSON.stringify({ cause: t.event.type })}`
377
+ );
378
+ }
379
+ }
380
+ export {
381
+ tt as C,
382
+ _ as a,
383
+ et as b,
384
+ at as c,
385
+ T as d,
386
+ R as e,
387
+ Q as f,
388
+ nt as g,
389
+ q as h,
390
+ j as i,
391
+ V as j,
392
+ K as k,
393
+ J as l,
394
+ W as m,
395
+ z as n,
396
+ ot as o,
397
+ Z as p,
398
+ X as r,
399
+ P as s
400
+ };
@@ -1,4 +1,4 @@
1
- import { z as E } from "./index-hbyCVNa7.js";
1
+ import { z as E } from "./index-C_H8jFYf.js";
2
2
  const M = E.enum([
3
3
  "VOUCHER",
4
4
  "PROMOTION",