@feedmepos/mf-connect 0.1.98-beta.8 → 0.1.98-beta.81

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 (170) hide show
  1. package/dist/{App-DsB2o1oB.js → App-CKdnfhUE.js} +853 -683
  2. package/dist/{AuditLogs-BcfgiYnJ.js → AuditLogs-vN-szmrB.js} +16 -13
  3. package/dist/{Bin-DMr7K8Kj.js → Bin-FIyWozvZ.js} +8 -8
  4. package/dist/Broadcast-CV_euppF.js +306 -0
  5. package/dist/CampaignAnalytic-Dlovlsh3.js +1830 -0
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CwGoEBsW.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Fd_0aPzZ.js} +8 -5
  7. package/dist/Card-ZgfOZ7sV.js +1086 -0
  8. package/dist/{Collections-B0uGC2FE.js → Collections-DZmHKbZn.js} +14 -13
  9. package/dist/Credit-DGsbEvMw.js +286 -0
  10. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-Cj89MnB0.js +53 -0
  11. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-C77dXZo-.js +4432 -0
  12. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-DJLxGk7W.js → EffectSheet.vue_vue_type_style_index_0_lang-CcIiEV2Z.js} +36 -36
  13. package/dist/Experience-DlJycdKe.js +288 -0
  14. package/dist/{FileSaver.min-BlA0oZEC.js → FileSaver.min-DVGF0TBc.js} +1 -1
  15. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-3bH-tZAm.js +138 -0
  16. package/dist/Game-q2X_SSup.js +356 -0
  17. package/dist/GiftCardSetup-BLDm3RfC.js +736 -0
  18. package/dist/GoalPickerPanel.vue_vue_type_script_setup_true_lang-CBC5AGR-.js +424 -0
  19. package/dist/Goals-CD8vdUPQ.js +247 -0
  20. package/dist/{Grab-DmmwrGzk.js → Grab-KDYktOCn.js} +33 -32
  21. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-DNtLW0yQ.js → ImageInput.vue_vue_type_script_setup_true_lang-DUi1YY1x.js} +1 -1
  22. package/dist/{Index-m7l4insz.js → Index-BT4esMkG.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-BRCrx3DA.js} +1 -1
  24. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-Dsg2sWjF.js → LottieAnimation.vue_vue_type_script_setup_true_lang-D3G4alTX.js} +1 -1
  25. package/dist/LoyaltyDashboard-CzmwuzTw.js +2911 -0
  26. package/dist/MainLayout-CVYfxfuS.js +143 -0
  27. package/dist/{Marketing-C9pSIdBU.js → Marketing-sDWWcaL5.js} +7 -6
  28. package/dist/{MarketingMaterialEdit-BEF2T9LR.js → MarketingMaterialEdit-DHmI38Lo.js} +15 -14
  29. package/dist/Member-sdcMiTmr.js +654 -0
  30. package/dist/MemberDetailSheet.vue_vue_type_script_setup_true_lang-DqchRq6h.js +1281 -0
  31. package/dist/MemberImportHistory-Df_5SiGn.js +187 -0
  32. package/dist/MemberList-BGoClGZE.js +334 -0
  33. package/dist/{MemberTransactions-CAut1TQb.js → MemberTransactions-qR38yGk5.js} +1 -1
  34. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-1AuHixPC.js → MessageInput.vue_vue_type_script_setup_true_lang-D4yY57Vo.js} +5928 -5644
  35. package/dist/MetricInfoTooltip.vue_vue_type_script_setup_true_lang-Co9oeOFx.js +40 -0
  36. package/dist/Mission-DSyqYeI6.js +363 -0
  37. package/dist/{Overview-DOJj4XvO.js → Overview-BDM8Lxfv.js} +23 -20
  38. package/dist/Overview-sLhLv5Oa.js +1316 -0
  39. package/dist/Point-DO5Z5sOL.js +297 -0
  40. package/dist/Promotion-BXm1Dxlv.js +426 -0
  41. package/dist/{Queue-55G2gtP5.js → Queue-C4kEj_Bp.js} +16 -13
  42. package/dist/{Record-DNPI02c6.js → Record-iKUy-nn3.js} +9 -9
  43. package/dist/Review-D-3-BRON.js +45 -0
  44. package/dist/ReviewFacebookCallback-SLzE3D7c.js +238 -0
  45. package/dist/ReviewGoogleCallback-DntrtfGB.js +213 -0
  46. package/dist/{Reward-CnP8R2pS.js → Reward-CNQS6F2m.js} +28 -28
  47. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-BN71h9IK.js → RewardGroup.vue_vue_type_script_setup_true_lang-D0ZNJilO.js} +26 -23
  48. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-CtB9Ls5-.js → RuleGroup.vue_vue_type_script_setup_true_lang-BgvaMOAJ.js} +198 -186
  49. package/dist/{Segment-CxiQnnyj.js → Segment-Bi58A7cw.js} +278 -276
  50. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-B1vj5f7T.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-CxC6ZLZT.js} +45 -42
  51. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-cWx0G3nM.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-CToVAWKO.js} +4 -4
  52. package/dist/Setting-CixcOp_l.js +574 -0
  53. package/dist/{SettingAdvertisements-Vt7w1WN3.js → SettingAdvertisements-DkPNDfxz.js} +12 -12
  54. package/dist/Settings-bD_DkKI0.js +230 -0
  55. package/dist/Store-BvnsumDX.js +2615 -0
  56. package/dist/{StoreRewards-DILeipMG.js → StoreRewards-CKPnV_j3.js} +15 -15
  57. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-k46T2rql.js +1319 -0
  58. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-C7lVeybl.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-IknvTIMG.js} +2 -2
  59. package/dist/{Tier-BAZ1xuKL.js → Tier-CiKGy-Do.js} +2576 -757
  60. package/dist/{Title-CcNAt47f.js → Title-CNFamvkQ.js} +41 -37
  61. package/dist/Transaction-C8SnyFML.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-DQrTH7cz.js} +26 -26
  63. package/dist/Voucher-9Q-GHuvD.js +837 -0
  64. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-CTQDxc5l.js → VoucherEditor.vue_vue_type_script_setup_true_lang-B-6mF0RH.js} +118 -124
  65. package/dist/WhatsappAccount-DRKJVs0I.js +325 -0
  66. package/dist/WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-DGOPGiGH.js +96 -0
  67. package/dist/WhatsappBot-muUmTIyY.js +441 -0
  68. package/dist/WhatsappBotSettings-DUjKwiv6.js +136 -0
  69. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DuRKA4cj.js → ZodTextField.vue_vue_type_script_setup_true_lang-7tSuZ_C3.js} +2 -2
  70. package/dist/{app-Z-UKRG5V.js → app-CQnX8TXq.js} +50951 -42514
  71. package/dist/app.js +1 -1
  72. package/dist/base.export-CwCY41wr.js +75 -0
  73. package/dist/browser-BSAOEeIM.js +1478 -0
  74. package/dist/{business-C7EF6cKC.js → business-DGYo03yh.js} +5 -5
  75. package/dist/campaign-BFhMhQWk.js +400 -0
  76. package/dist/campaign-BmVMseCM.js +100 -0
  77. package/dist/{campaign.enum-BNN2gLFY.js → campaign.enum-Dx-Zo68Q.js} +1 -1
  78. package/dist/campaign.fn-DHdhR9C8.js +776 -0
  79. package/dist/{collectible.enum-DO9HdJGH.js → collectible.enum-Liy2wH3s.js} +1 -1
  80. package/dist/collection.fn-CYrQd8Th.js +26 -0
  81. package/dist/currency-B7wFZjCM.js +7 -0
  82. package/dist/{duplicateCampaign-2ODeDw3a.js → duplicateCampaign-C62eVSKZ.js} +11 -11
  83. package/dist/{effect-BcB8IlTI.js → effect-XVC0SyM1.js} +1 -1
  84. package/dist/{email-addresses-BcTeU4Sh.js → email-addresses-DUWzbknH.js} +209 -201
  85. package/dist/google-C3S8u0mT.js +4 -0
  86. package/dist/{helper-BSgrCJRv.js → helper-Bw_KFook.js} +1 -1
  87. package/dist/index-B88wz0DA.js +53 -0
  88. package/dist/{index-iMPtFp54.js → index-BHPcqvxB.js} +10 -9
  89. package/dist/{index-HXiYGO4_.js → index-BL01AAGF.js} +6343 -7693
  90. package/dist/index-BpcakDLo.js +32438 -0
  91. package/dist/{index-VlFWaBrg.js → index-Bu0rl1Jm.js} +1 -1
  92. package/dist/{index-BpI-BI4H.js → index-C0WVYJgp.js} +4 -4
  93. package/dist/index-C5a9ZaAM.js +151 -0
  94. package/dist/{index-CsoBDon4.js → index-CRX2b_-n.js} +1590 -1523
  95. package/dist/{index-CIBPhxlC.js → index-CSaO5mCs.js} +105 -123
  96. package/dist/{index-hlyg-wxV.js → index-CX2tKi6X.js} +1 -1
  97. package/dist/index-C_H8jFYf.js +2743 -0
  98. package/dist/{index-BoYEqLif.js → index-CmJ4UtbH.js} +1517 -263
  99. package/dist/index-CoaZuwwm.js +172 -0
  100. package/dist/{index-Bf6jNZit.js → index-CsZ7_Qzf.js} +24 -9
  101. package/dist/index-D5D85re4.js +902 -0
  102. package/dist/index-D89ye2yV.js +74 -0
  103. package/dist/index-DHRVhERM.js +14550 -0
  104. package/dist/index-DKabvlsg.js +69 -0
  105. package/dist/{index-CoHWpylO.js → index-DlFjUct2.js} +2140 -2557
  106. package/dist/index-XCHxkJPE.js +137 -0
  107. package/dist/index-o2Ga_qaX.js +39 -0
  108. package/dist/index-z0K48rtR.js +54 -0
  109. package/dist/{index.esm2017-CM7OnEyP.js → index.esm2017-cOXL--fX.js} +164 -164
  110. package/dist/{loading-CSXr0Yqz.js → loading-BlfJuA-h.js} +1 -1
  111. package/dist/{lodash-Bh7XKI-R.js → lodash-CFkpI5Sp.js} +1 -1
  112. package/dist/member-import-B4ihDPgR.js +188 -0
  113. package/dist/membership-CyNEU3ld.js +274 -0
  114. package/dist/{money-BZIST_m9.js → money-B0QV3AtE.js} +1 -1
  115. package/dist/{number-DXLR2w95.js → number-DJ7EhoTu.js} +1 -1
  116. package/dist/objectid-DZ8o9_J4.js +145 -0
  117. package/dist/onboarding-BhMbuIRK.js +131 -0
  118. package/dist/onboardingSetup-BZMYTun6.js +17 -0
  119. package/dist/{plugins-4FlbwoES.js → plugins-C7hEP98r.js} +13 -12
  120. package/dist/remy-Qz_pNsUS.js +13 -0
  121. package/dist/{reward-DUbl79bZ.js → reward-D4975Y4s.js} +1 -1
  122. package/dist/{rule-BQUoZ4l_.js → rule-BfSrqM9Z.js} +337 -275
  123. package/dist/style.css +1 -1
  124. package/dist/{template-BoiSG7G7.js → template-CTCYJKDu.js} +6 -6
  125. package/dist/timezone-hBjTK85u.js +20 -0
  126. package/dist/transaction.fn-1iGyAGZA.js +71 -0
  127. package/dist/{trigger-D5g5m6tT.js → trigger-CdJikvw9.js} +17 -17
  128. package/dist/useMarketingMaterialActions-R1rDbIr8.js +96 -0
  129. package/dist/{usePagination-DHePBBoR.js → usePagination-CqSRHo9z.js} +1 -1
  130. package/dist/{user-C_ToSo-g.js → user-C8i4TfQt.js} +1 -1
  131. package/dist/vue-i18n-CiJ_kNkt.js +2365 -0
  132. package/dist/{xlsx-h4G1C-xj.js → xlsx-DGiPalb9.js} +440 -440
  133. package/dist/{zod-CgigfJar.js → zod-CKl6yP5K.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/campaign.fn-Bd34dVnx.js +0 -776
  162. package/dist/export-CjB7qxZ9.js +0 -97
  163. package/dist/index-BIAjmMga.js +0 -85
  164. package/dist/index-Bm0QPucw.js +0 -67
  165. package/dist/index-Bv4MBLQ5.js +0 -52
  166. package/dist/index-hbyCVNa7.js +0 -30289
  167. package/dist/membership-CfredTm3.js +0 -255
  168. package/dist/objectid-Dg4ZodlT.js +0 -145
  169. package/dist/useMarketingMaterialActions-B-Jlw2Z9.js +0 -107
  170. package/dist/vue-i18n-BcYh6_51.js +0 -2365
@@ -0,0 +1,2911 @@
1
+ import { defineComponent as Z, resolveComponent as M, openBlock as c, createBlock as N, withCtx as U, createElementVNode as a, toDisplayString as r, unref as o, createElementBlock as d, Fragment as k, renderList as W, normalizeClass as T, createVNode as f, withKeys as Ge, withModifiers as Je, createCommentVNode as z, createTextVNode as ge, normalizeStyle as Pt, mergeModels as Bt, useModel as Tt, ref as S, computed as $, watch as Ye, onBeforeUnmount as Nt, isRef as lt, nextTick as xt, reactive as Ut, onMounted as zt } from "vue";
2
+ import { m as De } from "./index-CSaO5mCs.js";
3
+ import { g as K, S as Vt, b as jt, c as Kt } from "./index-BpcakDLo.js";
4
+ import { c as qt } from "./index-C5a9ZaAM.js";
5
+ import { u as Q } from "./vue-i18n-CiJ_kNkt.js";
6
+ import { _ as xe } from "./MetricInfoTooltip.vue_vue_type_script_setup_true_lang-Co9oeOFx.js";
7
+ import { h as Yt } from "./moment-D7p2TMB-.js";
8
+ import { m as Ht } from "./index-XCHxkJPE.js";
9
+ import { _ as wt } from "./FilterChip.vue_vue_type_script_setup_true_lang-3bH-tZAm.js";
10
+ import { _ as it } from "./DateRangeChip.vue_vue_type_script_setup_true_lang-Cj89MnB0.js";
11
+ import { _ as Wt } from "./MemberDetailSheet.vue_vue_type_script_setup_true_lang-DqchRq6h.js";
12
+ import { c as Gt, n as ht } from "./plugins-C7hEP98r.js";
13
+ import { t as Jt } from "./money-B0QV3AtE.js";
14
+ import { u as Zt } from "./loading-BlfJuA-h.js";
15
+ import { u as Qt } from "./business-DGYo03yh.js";
16
+ import { C as vt } from "./timezone-hBjTK85u.js";
17
+ import { useCoreStore as Xt } from "@feedmepos/mf-common";
18
+ import { _ as ea, a as ta } from "./GoalPickerPanel.vue_vue_type_script_setup_true_lang-CBC5AGR-.js";
19
+ import { u as aa, a as oa } from "./onboarding-BhMbuIRK.js";
20
+ const sa = { class: "flex items-center mb-16" }, ra = { class: "flex-1 fm-typo-en-body-md-600" }, na = {
21
+ key: 0,
22
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary py-12"
23
+ }, la = {
24
+ key: 1,
25
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary py-12"
26
+ }, ia = {
27
+ key: 2,
28
+ class: "flex flex-col"
29
+ }, ca = { class: "flex-1 min-w-0" }, da = { class: "fm-typo-en-body-sm-600 whitespace-nowrap overflow-hidden text-ellipsis" }, ma = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary mt-4" }, ua = { class: "text-right flex-shrink-0" }, ya = { class: "fm-typo-en-body-lg-600" }, pa = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary mt-4" }, ba = {
30
+ key: 3,
31
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary py-12"
32
+ }, fa = /* @__PURE__ */ Z({
33
+ __name: "CampaignActivityList",
34
+ props: {
35
+ campaigns: {},
36
+ loading: { type: Boolean },
37
+ error: { type: Boolean }
38
+ },
39
+ setup(e) {
40
+ const { t: s } = Q();
41
+ return (t, n) => {
42
+ const i = M("FmCard");
43
+ return c(), N(i, {
44
+ variant: "outlined",
45
+ class: "p-24"
46
+ }, {
47
+ default: U(() => [
48
+ a("div", sa, [
49
+ a("div", ra, r(o(s)("connect.loyalty.dashboard.campaigns.title")), 1)
50
+ ]),
51
+ e.loading ? (c(), d("div", na, r(o(s)("connect.loyalty.dashboard.campaigns.loading")), 1)) : e.error ? (c(), d("div", la, r(o(s)("connect.loyalty.dashboard.campaigns.error")), 1)) : e.campaigns.length ? (c(), d("div", ia, [
52
+ (c(!0), d(k, null, W(e.campaigns, (y) => (c(), d("div", {
53
+ key: y.id,
54
+ class: "flex items-start gap-8 py-12 border-b border-fm-color-neutral-gray-100 last:border-b-0"
55
+ }, [
56
+ a("div", {
57
+ class: T(["w-[7px] h-[7px] mt-4 rounded-full bg-current flex-shrink-0", y.statusClass])
58
+ }, null, 2),
59
+ a("div", ca, [
60
+ a("div", da, r(y.name), 1),
61
+ a("div", ma, r(y.type), 1)
62
+ ]),
63
+ a("div", ua, [
64
+ a("div", ya, r(y.metric), 1),
65
+ a("div", pa, r(y.metricLabel), 1)
66
+ ])
67
+ ]))), 128))
68
+ ])) : (c(), d("div", ba, r(o(s)("connect.loyalty.dashboard.campaigns.empty")), 1))
69
+ ]),
70
+ _: 1
71
+ });
72
+ };
73
+ }
74
+ }), ha = { class: "flex items-center gap-8" }, va = { class: "w-[30px] h-[30px] bg-fm-color-primary-oats flex items-center justify-center flex-shrink-0 fm-corner-radius-md" }, ga = { class: "fm-typo-en-body-md-600" }, _a = ["aria-label"], xa = {
75
+ key: 1,
76
+ class: "flex min-h-[144px] items-center justify-center text-center fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
77
+ }, wa = { class: "bg-fm-color-primary-oats px-16 py-12 fm-corner-radius-md" }, Ra = { class: "fm-typo-en-body-md-600 mb-4" }, Sa = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ma = { class: "flex flex-col gap-8" }, $a = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-tertiary uppercase tracking-wide" }, Ca = { class: "flex flex-col gap-8" }, Fa = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Da = {
78
+ key: 3,
79
+ class: "bg-fm-color-neutral-gray-100 fm-corner-radius-md px-16 py-12 fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
80
+ }, Aa = /* @__PURE__ */ Z({
81
+ __name: "InsightPanel",
82
+ props: {
83
+ insight: {},
84
+ loading: { type: Boolean },
85
+ error: { type: Boolean }
86
+ },
87
+ setup(e) {
88
+ const s = e, { t } = Q();
89
+ return (n, i) => {
90
+ const y = M("FmIcon"), p = M("FmCircularProgress"), u = M("FmCard");
91
+ return c(), N(u, {
92
+ variant: "outlined",
93
+ class: "p-24 flex flex-col gap-12"
94
+ }, {
95
+ default: U(() => [
96
+ a("div", ha, [
97
+ a("div", va, [
98
+ f(y, {
99
+ name: "info",
100
+ outline: "",
101
+ size: "sm",
102
+ class: "!text-fm-color-primary"
103
+ })
104
+ ]),
105
+ a("div", ga, r(o(t)("connect.loyalty.dashboard.insight.title")), 1)
106
+ ]),
107
+ s.loading ? (c(), d("div", {
108
+ key: 0,
109
+ class: "flex min-h-[144px] items-center justify-center",
110
+ role: "status",
111
+ "aria-label": o(t)("connect.loyalty.dashboard.accessibility.loading")
112
+ }, [
113
+ f(p, { size: "lg" })
114
+ ], 8, _a)) : s.error ? (c(), d("div", xa, r(o(t)("connect.loyalty.dashboard.states.insightUnavailable")), 1)) : s.insight ? (c(), d(k, { key: 2 }, [
115
+ a("div", wa, [
116
+ a("div", Ra, r(s.insight.title), 1),
117
+ a("div", Sa, r(s.insight.body), 1)
118
+ ]),
119
+ a("div", Ma, [
120
+ a("div", $a, r(o(t)("connect.loyalty.dashboard.insight.supportingSignal")), 1),
121
+ a("ul", Ca, [
122
+ (c(!0), d(k, null, W(s.insight.signals, (x) => (c(), d("li", {
123
+ key: x.text,
124
+ class: "flex items-start gap-8"
125
+ }, [
126
+ i[0] || (i[0] = a("span", { class: "w-[5px] h-[5px] mt-[6px] rounded-full bg-fm-color-neutral-gray-200 flex-shrink-0" }, null, -1)),
127
+ a("span", Fa, r(x.text), 1)
128
+ ]))), 128))
129
+ ])
130
+ ])
131
+ ], 64)) : (c(), d("div", Da, r(o(t)("connect.loyalty.dashboard.insight.empty")), 1))
132
+ ]),
133
+ _: 1
134
+ });
135
+ };
136
+ }
137
+ }), ka = { class: "grid grid-cols-6 xs:grid-cols-2 sm:grid-cols-3 md:grid-cols-3 gap-12" }, Ia = { class: "flex items-center gap-8" }, La = { class: "w-[30px] h-[30px] rounded-8 bg-[#FFF6EE] flex items-center justify-center flex-shrink-0" }, Oa = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-secondary flex-1 min-w-0" }, Ea = { class: "flex min-h-[72px] flex-col" }, Pa = ["aria-label"], Ba = {
138
+ key: 1,
139
+ class: "flex flex-1 items-center justify-center text-center fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
140
+ }, Ta = { class: "fm-typo-en-title-sm-800 text-fm-color-typo-primary whitespace-nowrap overflow-hidden text-ellipsis" }, Na = {
141
+ key: 1,
142
+ class: "flex items-center gap-4 flex-wrap"
143
+ }, Ua = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" }, za = {
144
+ key: 2,
145
+ class: "flex items-center justify-between gap-8 mt-auto fm-typo-en-body-sm-600"
146
+ }, Va = /* @__PURE__ */ Z({
147
+ __name: "KpiStrip",
148
+ props: {
149
+ kpis: {}
150
+ },
151
+ emits: ["select"],
152
+ setup(e, { emit: s }) {
153
+ const t = e, n = s, { t: i } = Q();
154
+ function y(u) {
155
+ u.interactive && n("select", u);
156
+ }
157
+ function p(u) {
158
+ const x = u.loading ? i("connect.loyalty.dashboard.accessibility.loading") : u.error ? i("connect.loyalty.dashboard.states.unavailable") : u.value;
159
+ return `${u.label}: ${x}`;
160
+ }
161
+ return (u, x) => {
162
+ const w = M("FmIcon"), R = M("FmCircularProgress"), g = M("FmCard");
163
+ return c(), d("section", ka, [
164
+ (c(!0), d(k, null, W(t.kpis, (h) => (c(), N(g, {
165
+ key: h.label,
166
+ variant: "outlined",
167
+ class: T([
168
+ "flex h-full flex-col gap-8 p-16 min-w-0 overflow-hidden",
169
+ h.interactive ? "cursor-pointer hover:bg-fm-color-neutral-gray-100" : ""
170
+ ]),
171
+ role: h.interactive ? "button" : void 0,
172
+ tabindex: h.interactive ? 0 : void 0,
173
+ "aria-label": h.interactive ? p(h) : void 0,
174
+ onClick: (V) => y(h),
175
+ onKeydown: [
176
+ Ge(Je((V) => y(h), ["prevent"]), ["enter"]),
177
+ Ge(Je((V) => y(h), ["prevent"]), ["space"])
178
+ ]
179
+ }, {
180
+ default: U(() => [
181
+ a("div", Ia, [
182
+ a("div", La, [
183
+ f(w, {
184
+ name: h.icon,
185
+ outline: "",
186
+ size: "sm",
187
+ class: "!text-fm-color-primary"
188
+ }, null, 8, ["name"])
189
+ ]),
190
+ a("span", Oa, r(h.label), 1),
191
+ f(xe, {
192
+ description: h.description
193
+ }, null, 8, ["description"])
194
+ ]),
195
+ a("div", Ea, [
196
+ h.loading ? (c(), d("div", {
197
+ key: 0,
198
+ class: "flex flex-1 items-center justify-center",
199
+ role: "status",
200
+ "aria-label": o(i)("connect.loyalty.dashboard.accessibility.loading")
201
+ }, [
202
+ f(R, { size: "lg" })
203
+ ], 8, Pa)) : h.error ? (c(), d("div", Ba, r(o(i)("connect.loyalty.dashboard.states.unavailable")), 1)) : (c(), d(k, { key: 2 }, [
204
+ a("div", Ta, r(h.value), 1),
205
+ h.sub && !h.actionLabel ? (c(), d("div", {
206
+ key: 0,
207
+ class: T(["fm-typo-en-body-sm-600 -mt-4", h.subClass ?? "text-fm-color-typo-success"])
208
+ }, r(h.sub), 3)) : z("", !0),
209
+ h.delta ? (c(), d("div", Na, [
210
+ h.delta !== "0%" && h.delta !== "0pp" ? (c(), N(w, {
211
+ key: 0,
212
+ name: h.trendUp ? "trending_up" : "trending_down",
213
+ size: "xs",
214
+ class: T(h.deltaClass)
215
+ }, null, 8, ["name", "class"])) : z("", !0),
216
+ a("span", {
217
+ class: T(["fm-typo-en-body-sm-600", h.deltaClass])
218
+ }, r(h.delta), 3),
219
+ a("span", Ua, r(o(i)("connect.loyalty.dashboard.kpis.previous")), 1)
220
+ ])) : h.actionLabel ? (c(), d("div", za, [
221
+ a("span", {
222
+ class: T(h.subClass ?? "text-fm-color-typo-success")
223
+ }, r(h.sub), 3),
224
+ a("span", {
225
+ class: T([
226
+ "flex items-center gap-4",
227
+ h.interactive ? "text-fm-color-primary" : "text-fm-color-typo-disabled"
228
+ ])
229
+ }, [
230
+ ge(r(h.actionLabel) + " ", 1),
231
+ f(w, {
232
+ name: "arrow_forward",
233
+ size: "xs"
234
+ })
235
+ ], 2)
236
+ ])) : z("", !0)
237
+ ], 64))
238
+ ])
239
+ ]),
240
+ _: 2
241
+ }, 1032, ["class", "role", "tabindex", "aria-label", "onClick", "onKeydown"]))), 128))
242
+ ]);
243
+ };
244
+ }
245
+ }), ja = { class: "flex items-center mb-16" }, Ka = { class: "flex-1 fm-typo-en-body-md-600" }, qa = ["aria-label"], Ya = {
246
+ key: 1,
247
+ class: "flex min-h-[220px] items-center justify-center text-center fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
248
+ }, Ha = {
249
+ key: 2,
250
+ class: "flex flex-col gap-4"
251
+ }, Wa = ["onClick"], Ga = { class: "fm-typo-en-body-sm-600" }, Ja = { class: "fm-typo-en-body-md-600 min-w-[38px] text-right" }, Za = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary min-w-[34px] text-right" }, Qa = {
252
+ key: 3,
253
+ class: "mt-14 pt-12 border-t border-fm-color-neutral-gray-100 fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
254
+ }, Xa = /* @__PURE__ */ Z({
255
+ __name: "LifecycleSegments",
256
+ props: {
257
+ segments: {},
258
+ summary: {},
259
+ interactive: { type: Boolean, default: !0 },
260
+ loading: { type: Boolean },
261
+ error: { type: Boolean }
262
+ },
263
+ emits: ["select"],
264
+ setup(e, { emit: s }) {
265
+ const t = e, n = s, { t: i } = Q();
266
+ return (y, p) => {
267
+ const u = M("FmCircularProgress"), x = M("FmProgressBar"), w = M("FmCard");
268
+ return c(), N(w, {
269
+ variant: "outlined",
270
+ class: "p-24"
271
+ }, {
272
+ default: U(() => [
273
+ a("div", ja, [
274
+ a("div", Ka, r(o(i)("connect.loyalty.dashboard.lifecycle.title")), 1)
275
+ ]),
276
+ t.loading ? (c(), d("div", {
277
+ key: 0,
278
+ class: "flex min-h-[220px] items-center justify-center",
279
+ role: "status",
280
+ "aria-label": o(i)("connect.loyalty.dashboard.accessibility.loading")
281
+ }, [
282
+ f(u, { size: "lg" })
283
+ ], 8, qa)) : t.error ? (c(), d("div", Ya, r(o(i)("connect.loyalty.dashboard.states.lifecycleUnavailable")), 1)) : (c(), d("div", Ha, [
284
+ (c(!0), d(k, null, W(t.segments, (R) => (c(), d("div", {
285
+ key: R.id,
286
+ class: T([
287
+ "flex items-center gap-9 px-6 py-3 -mx-6 rounded-8",
288
+ t.interactive ? "cursor-pointer hover:bg-fm-color-neutral-gray-100/50" : "cursor-default"
289
+ ]),
290
+ onClick: (g) => t.interactive && n("select", R.id)
291
+ }, [
292
+ a("div", {
293
+ class: T(["flex w-[90px] flex-shrink-0 items-center gap-3", R.labelClass])
294
+ }, [
295
+ a("span", Ga, r(R.label), 1),
296
+ f(xe, {
297
+ description: R.description
298
+ }, null, 8, ["description"])
299
+ ], 2),
300
+ f(x, {
301
+ class: "flex-1",
302
+ value: R.barPct,
303
+ color: R.barColor,
304
+ size: "lg"
305
+ }, null, 8, ["value", "color"]),
306
+ a("span", Ja, r(R.countStr), 1),
307
+ a("span", Za, r(R.pctStr), 1)
308
+ ], 10, Wa))), 128))
309
+ ])),
310
+ !t.loading && !t.error ? (c(), d("div", Qa, r(t.summary), 1)) : z("", !0)
311
+ ]),
312
+ _: 1
313
+ });
314
+ };
315
+ }
316
+ }), eo = { class: "flex items-start gap-8 mb-12" }, to = { class: "flex-1" }, ao = { class: "fm-typo-en-body-md-600" }, oo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary mt-4" }, so = ["aria-label"], ro = {
317
+ key: 1,
318
+ class: "flex min-h-[280px] items-center justify-center text-center fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
319
+ }, no = { key: 2 }, lo = {
320
+ key: 0,
321
+ class: "flex items-start pl-[152px] xs:pl-0 xs:justify-center"
322
+ }, io = { class: "flex flex-col items-start" }, co = { class: "flex items-center gap-8" }, mo = {
323
+ key: 0,
324
+ class: "fm-typo-en-body-sm-600 text-fm-color-typo-warning bg-fm-color-system-warning-100 px-8 py-[2px] rounded-xxxl whitespace-nowrap"
325
+ }, uo = ["onClick"], yo = { class: "min-w-0" }, po = { class: "flex items-center gap-3 fm-typo-en-body-sm-600" }, bo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mt-4" }, fo = { class: "min-w-0 text-right" }, ho = { class: "fm-typo-en-body-lg-600" }, vo = {
326
+ key: 0,
327
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary"
328
+ }, go = { class: "mt-12 pt-12 border-t border-fm-color-neutral-gray-100" }, _o = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary text-right" }, xo = /* @__PURE__ */ Z({
329
+ __name: "MemberFunnel",
330
+ props: {
331
+ stages: {},
332
+ footnote: {},
333
+ interactive: { type: Boolean, default: !0 },
334
+ loading: { type: Boolean },
335
+ error: { type: Boolean }
336
+ },
337
+ emits: ["select"],
338
+ setup(e, { emit: s }) {
339
+ const t = e, n = s, { t: i } = Q();
340
+ function y(p) {
341
+ t.interactive && n("select", p);
342
+ }
343
+ return (p, u) => {
344
+ const x = M("FmCircularProgress"), w = M("FmProgressBar"), R = M("FmCard");
345
+ return c(), N(R, {
346
+ variant: "outlined",
347
+ class: "p-24"
348
+ }, {
349
+ default: U(() => [
350
+ a("div", eo, [
351
+ a("div", to, [
352
+ a("div", ao, r(o(i)("connect.loyalty.dashboard.funnel.title")), 1),
353
+ a("div", oo, r(o(i)(
354
+ t.interactive ? "connect.loyalty.dashboard.funnel.interactiveHint" : "connect.loyalty.dashboard.funnel.staticHint"
355
+ )), 1)
356
+ ])
357
+ ]),
358
+ t.loading ? (c(), d("div", {
359
+ key: 0,
360
+ class: "flex min-h-[280px] items-center justify-center",
361
+ role: "status",
362
+ "aria-label": o(i)("connect.loyalty.dashboard.accessibility.loading")
363
+ }, [
364
+ f(x, { size: "lg" })
365
+ ], 8, so)) : t.error ? (c(), d("div", ro, r(o(i)("connect.loyalty.dashboard.states.funnelUnavailable")), 1)) : (c(), d("div", no, [
366
+ (c(!0), d(k, null, W(t.stages, (g, h) => (c(), d("div", {
367
+ key: g.id
368
+ }, [
369
+ g.hasDropLine ? (c(), d("div", lo, [
370
+ a("div", io, [
371
+ u[0] || (u[0] = a("div", { class: "w-[1px] h-[4px] bg-fm-color-neutral-gray-100 ml-[9px]" }, null, -1)),
372
+ a("div", co, [
373
+ a("span", {
374
+ class: T(["fm-typo-en-body-sm-600 px-8 py-[2px] rounded-xxxl whitespace-nowrap", g.dropClass])
375
+ }, r(g.conversionStr), 3),
376
+ g.isBiggestDrop ? (c(), d("span", mo, r(o(i)("connect.loyalty.dashboard.funnel.biggestDrop")), 1)) : z("", !0)
377
+ ]),
378
+ u[1] || (u[1] = a("div", { class: "w-[1px] h-[4px] bg-fm-color-neutral-gray-100 ml-[9px]" }, null, -1))
379
+ ])
380
+ ])) : z("", !0),
381
+ a("div", {
382
+ class: T([
383
+ "grid grid-cols-[140px_minmax(0,1fr)_72px] xs:grid-cols-[minmax(0,1fr)_auto] items-center gap-x-12 gap-y-8 py-4 px-8 -mx-8 rounded-md",
384
+ t.interactive ? "cursor-pointer hover:bg-fm-color-neutral-gray-100/50" : ""
385
+ ]),
386
+ onClick: (V) => y(g.id)
387
+ }, [
388
+ a("div", yo, [
389
+ a("div", po, [
390
+ a("span", null, r(g.label), 1),
391
+ f(xe, {
392
+ description: g.description
393
+ }, null, 8, ["description"])
394
+ ]),
395
+ a("div", bo, r(g.desc), 1)
396
+ ]),
397
+ f(w, {
398
+ class: "min-w-0 xs:col-span-2 xs:row-start-2",
399
+ value: g.barWidthPct,
400
+ color: g.barColor,
401
+ size: "lg"
402
+ }, null, 8, ["value", "color"]),
403
+ a("div", fo, [
404
+ a("div", ho, r(g.countStr), 1),
405
+ g.hasConvRate ? (c(), d("div", vo, r(g.convRateLabel), 1)) : z("", !0)
406
+ ])
407
+ ], 10, uo)
408
+ ]))), 128)),
409
+ a("div", go, [
410
+ a("div", _o, r(t.footnote), 1)
411
+ ])
412
+ ]))
413
+ ]),
414
+ _: 1
415
+ });
416
+ };
417
+ }
418
+ }), wo = { class: "flex items-center gap-3 fm-typo-en-body-md-600 mb-4" }, Ro = ["aria-label"], So = {
419
+ key: 1,
420
+ class: "flex min-h-[220px] items-center justify-center text-center fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
421
+ }, Mo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary mb-16" }, $o = { class: "grid grid-cols-2 xs:grid-cols-1 gap-16" }, Co = { class: "flex items-center gap-8 mb-8" }, Fo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Do = { class: "fm-typo-en-title-sm-800" }, Ao = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary mt-4" }, ko = { class: "flex items-center gap-8 mb-8" }, Io = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Lo = { class: "fm-typo-en-title-sm-800" }, Oo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary mt-4" }, Eo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary mt-8" }, Po = { class: "mt-16 pt-12 border-t border-fm-color-neutral-gray-100 fm-typo-en-body-sm-400" }, Bo = /* @__PURE__ */ Z({
422
+ __name: "MemberSpendComparison",
423
+ props: {
424
+ spend: {},
425
+ loading: { type: Boolean },
426
+ error: { type: Boolean }
427
+ },
428
+ setup(e) {
429
+ const s = e, { t } = Q();
430
+ return (n, i) => {
431
+ const y = M("FmCircularProgress"), p = M("FmProgressBar"), u = M("FmCard");
432
+ return c(), N(u, {
433
+ variant: "outlined",
434
+ class: "p-24"
435
+ }, {
436
+ default: U(() => [
437
+ a("div", wo, [
438
+ a("span", null, r(o(t)("connect.loyalty.dashboard.spend.title")), 1),
439
+ f(xe, {
440
+ description: s.spend.description
441
+ }, null, 8, ["description"])
442
+ ]),
443
+ s.loading ? (c(), d("div", {
444
+ key: 0,
445
+ class: "flex min-h-[220px] items-center justify-center",
446
+ role: "status",
447
+ "aria-label": o(t)("connect.loyalty.dashboard.accessibility.loading")
448
+ }, [
449
+ f(y, { size: "lg" })
450
+ ], 8, Ro)) : s.error ? (c(), d("div", So, r(o(t)("connect.loyalty.dashboard.states.spendUnavailable")), 1)) : (c(), d(k, { key: 2 }, [
451
+ a("div", Mo, r(s.spend.description), 1),
452
+ a("div", $o, [
453
+ a("div", null, [
454
+ a("div", Co, [
455
+ i[0] || (i[0] = a("div", { class: "w-8 h-8 rounded-sm bg-fm-color-primary" }, null, -1)),
456
+ a("span", Fo, r(o(t)("connect.loyalty.dashboard.spend.memberSales")), 1)
457
+ ]),
458
+ a("div", Do, r(s.spend.memberSalesFmt), 1),
459
+ a("div", Ao, r(o(t)("connect.loyalty.dashboard.spend.averageOrder", {
460
+ value: s.spend.avgMemberSaleFmt
461
+ })), 1)
462
+ ]),
463
+ a("div", null, [
464
+ a("div", ko, [
465
+ i[1] || (i[1] = a("div", { class: "w-8 h-8 rounded-sm bg-fm-color-neutral-gray-200" }, null, -1)),
466
+ a("span", Io, r(o(t)("connect.loyalty.dashboard.spend.nonMemberSales")), 1)
467
+ ]),
468
+ a("div", Lo, r(s.spend.nonMemberSalesFmt), 1),
469
+ a("div", Oo, r(o(t)("connect.loyalty.dashboard.spend.averageOrder", {
470
+ value: s.spend.avgNonMemberSaleFmt
471
+ })), 1)
472
+ ])
473
+ ]),
474
+ f(p, {
475
+ class: "mt-16",
476
+ value: s.spend.memberSharePct,
477
+ color: "primary",
478
+ size: "md"
479
+ }, null, 8, ["value"]),
480
+ a("div", Eo, r(o(t)("connect.loyalty.dashboard.spend.share", {
481
+ value: s.spend.memberSharePct
482
+ })), 1),
483
+ a("div", Po, r(s.spend.summary), 1)
484
+ ], 64))
485
+ ]),
486
+ _: 1
487
+ });
488
+ };
489
+ }
490
+ }), To = { class: "flex items-center mb-16" }, No = { class: "flex-1 fm-typo-en-body-md-600" }, Uo = ["aria-label"], zo = {
491
+ key: 1,
492
+ class: "flex min-h-[220px] items-center justify-center text-center fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
493
+ }, Vo = { class: "grid grid-cols-3 gap-10 mb-16" }, jo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mb-4 flex items-center gap-3" }, Ko = { class: "fm-typo-en-title-sm-800" }, qo = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-tertiary uppercase tracking-wide mb-10" }, Yo = { class: "flex flex-col gap-9" }, Ho = { class: "flex-1 fm-typo-en-body-sm-400 whitespace-nowrap overflow-hidden text-ellipsis" }, Wo = { class: "flex flex-shrink-0 items-center gap-3 fm-typo-en-body-sm-600 text-fm-color-typo-secondary" }, Go = { class: "w-[48px] h-4 bg-fm-color-neutral-gray-100 rounded-2 overflow-hidden flex-shrink-0" }, Jo = {
494
+ key: 3,
495
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
496
+ }, Zo = /* @__PURE__ */ Z({
497
+ __name: "RewardPerformance",
498
+ props: {
499
+ kpis: {},
500
+ topRewards: {},
501
+ hasData: { type: Boolean },
502
+ loading: { type: Boolean },
503
+ error: { type: Boolean }
504
+ },
505
+ setup(e) {
506
+ const { t: s } = Q();
507
+ return (t, n) => {
508
+ const i = M("FmCircularProgress"), y = M("FmCard");
509
+ return c(), N(y, {
510
+ variant: "outlined",
511
+ class: "p-24"
512
+ }, {
513
+ default: U(() => [
514
+ a("div", To, [
515
+ a("div", No, r(o(s)("connect.loyalty.dashboard.rewards.title")), 1)
516
+ ]),
517
+ e.loading ? (c(), d("div", {
518
+ key: 0,
519
+ class: "flex min-h-[220px] items-center justify-center",
520
+ role: "status",
521
+ "aria-label": o(s)("connect.loyalty.dashboard.accessibility.loading")
522
+ }, [
523
+ f(i, { size: "lg" })
524
+ ], 8, Uo)) : e.error ? (c(), d("div", zo, r(o(s)("connect.loyalty.dashboard.states.rewardUsageUnavailable")), 1)) : e.hasData ? (c(), d(k, { key: 2 }, [
525
+ a("div", Vo, [
526
+ (c(!0), d(k, null, W(e.kpis, (p) => (c(), d("div", {
527
+ key: p.label,
528
+ class: "bg-[#FAFAFA] rounded-10 p-12"
529
+ }, [
530
+ a("div", jo, [
531
+ a("span", null, r(p.label), 1),
532
+ f(xe, {
533
+ description: p.description
534
+ }, null, 8, ["description"])
535
+ ]),
536
+ a("div", Ko, r(p.value), 1),
537
+ p.delta ? (c(), d("div", {
538
+ key: 0,
539
+ class: T(["fm-typo-en-body-sm-600 mt-3", p.deltaClass])
540
+ }, r(p.delta), 3)) : z("", !0)
541
+ ]))), 128))
542
+ ]),
543
+ a("div", qo, r(o(s)("connect.loyalty.dashboard.rewards.topUsed")), 1),
544
+ a("div", Yo, [
545
+ (c(!0), d(k, null, W(e.topRewards, (p) => (c(), d("div", {
546
+ key: p.name,
547
+ class: "flex items-center gap-9"
548
+ }, [
549
+ n[0] || (n[0] = a("div", { class: "w-[7px] h-[7px] rounded-2 bg-fm-color-primary flex-shrink-0" }, null, -1)),
550
+ a("span", Ho, r(p.name), 1),
551
+ a("span", Wo, [
552
+ ge(r(p.count) + " ", 1),
553
+ f(xe, {
554
+ description: p.description
555
+ }, null, 8, ["description"])
556
+ ]),
557
+ a("div", Go, [
558
+ a("div", {
559
+ class: "h-full bg-fm-color-primary rounded-2",
560
+ style: Pt({ width: p.barPct + "%" })
561
+ }, null, 4)
562
+ ])
563
+ ]))), 128))
564
+ ])
565
+ ], 64)) : (c(), d("div", Jo, r(o(s)("connect.loyalty.dashboard.rewards.noData")), 1))
566
+ ]),
567
+ _: 1
568
+ });
569
+ };
570
+ }
571
+ }), q = () => {
572
+ const e = Vt.getBusinessId();
573
+ if (!e) throw new Error("Invalid business ID");
574
+ return jt(`businesses/${e}/loyalty-dashboard`, {
575
+ noIdRequired: !0
576
+ });
577
+ }, H = {
578
+ async readTotalMembers(e) {
579
+ return K(
580
+ await q().post(
581
+ "metrics/total-members",
582
+ e
583
+ )
584
+ );
585
+ },
586
+ async readActiveMembers(e) {
587
+ return K(
588
+ await q().post(
589
+ "metrics/active-members",
590
+ e
591
+ )
592
+ );
593
+ },
594
+ async readMemberSales(e) {
595
+ return K(
596
+ await q().post(
597
+ "metrics/member-sales",
598
+ e
599
+ )
600
+ );
601
+ },
602
+ async readMemberSpendComparison(e) {
603
+ return K(
604
+ await q().post(
605
+ "metrics/member-spend-comparison",
606
+ e
607
+ )
608
+ );
609
+ },
610
+ async readMemberSalesTrend(e) {
611
+ return K(
612
+ await q().post(
613
+ "metrics/member-sales-trend",
614
+ e
615
+ )
616
+ );
617
+ },
618
+ async readRepeatRate(e) {
619
+ return K(
620
+ await q().post(
621
+ "metrics/repeat-rate",
622
+ e
623
+ )
624
+ );
625
+ },
626
+ async readVoucherRedemptionRate(e) {
627
+ return K(
628
+ await q().post(
629
+ "metrics/voucher-redemption-rate",
630
+ e
631
+ )
632
+ );
633
+ },
634
+ async readMemberFunnel(e) {
635
+ return K(
636
+ await q().post(
637
+ "metrics/member-funnel",
638
+ e
639
+ )
640
+ );
641
+ },
642
+ async readMemberLifecycle(e) {
643
+ return K(
644
+ await q().post(
645
+ "metrics/member-lifecycle",
646
+ e
647
+ )
648
+ );
649
+ },
650
+ async readRewardUsageHealth(e) {
651
+ return K(
652
+ await q().post(
653
+ "metrics/reward-usage-health",
654
+ e
655
+ )
656
+ );
657
+ },
658
+ async readSameDayBillAnomalies(e) {
659
+ return K(
660
+ await q().post(
661
+ "metrics/same-day-bill-anomalies",
662
+ e
663
+ )
664
+ );
665
+ },
666
+ async readRewardEarningOutliers(e) {
667
+ return K(
668
+ await q().post(
669
+ "metrics/reward-earning-outliers",
670
+ e
671
+ )
672
+ );
673
+ },
674
+ async readRewardMaximizers(e) {
675
+ return K(
676
+ await q().post(
677
+ "metrics/reward-maximizers",
678
+ e
679
+ )
680
+ );
681
+ },
682
+ async readRewardAbuseSummary(e) {
683
+ return K(
684
+ await q().post(
685
+ "reward-abuse/summary",
686
+ e
687
+ )
688
+ );
689
+ },
690
+ async readRewardAbuseFindings(e) {
691
+ return K(
692
+ await q().post(
693
+ "reward-abuse/findings",
694
+ e
695
+ )
696
+ );
697
+ }
698
+ };
699
+ function v(e, s, t, n) {
700
+ return e ? n === void 0 ? e(s) : e(s, n) : t;
701
+ }
702
+ const Y = {
703
+ totalMembers: "Distinct members recorded through the end of the selected period; the start date does not reduce this total.",
704
+ activeMembers: "Distinct members with a completed member purchase or voucher redemption during the selected period.",
705
+ memberSales: "Sum of nettTotal from member-linked bills included in the selected period.",
706
+ repeatRate: "Members with at least two completed purchases divided by purchasing members, all within the selected period.",
707
+ voucherRedemptionRate: "Repeat members who redeemed a voucher divided by repeat members.",
708
+ purchasingMembers: "Distinct members with at least one completed member bill in the selected period.",
709
+ repeatMembers: "Distinct members with at least two completed purchases within the selected period.",
710
+ funnelRewardRedeemers: "Repeat members with counted reward activity in the selected period.",
711
+ newlyJoined: "Members whose join date falls within the selected period.",
712
+ frequent: "Existing members with repeated completed member bills in the selected period.",
713
+ infrequent: "Existing members with limited completed member bills in the selected period.",
714
+ atRisk: "Existing members with no selected-period purchase but a recent completed purchase.",
715
+ dormant: "Existing members with no selected-period purchase and no recent completed purchase.",
716
+ memberSalesTrend: "Daily member nett sales for the selected period compared with the selected comparison period.",
717
+ rewardRedeemers: "Distinct members who used a counted VOUCHER, CREDIT, or POINT reward during the selected period; anonymous usage is excluded from the member count.",
718
+ redemptionRate: "Reward redeemers divided by active members, where active members are members with purchase or reward activity during the selected period.",
719
+ averageRewardUses: "Counted reward-use transactions divided by distinct reward redeemers.",
720
+ flaggedForReview: "Unique members found across available anomaly signals; findings require verification.",
721
+ memberSpendComparison: "Shows the value members bring — use it to make the case for growing membership"
722
+ }, ne = {
723
+ SAME_DAY_BILL_ANOMALY: "same-day-bill-anomaly",
724
+ REWARD_EARNING_OUTLIER: "reward-earning-outlier"
725
+ }, He = [
726
+ ne.SAME_DAY_BILL_ANOMALY,
727
+ ne.REWARD_EARNING_OUTLIER
728
+ ], Qo = {
729
+ [ne.SAME_DAY_BILL_ANOMALY]: "Same-day bill anomaly",
730
+ [ne.REWARD_EARNING_OUTLIER]: "Reward earning outlier"
731
+ }, Xo = {
732
+ [ne.SAME_DAY_BILL_ANOMALY]: "Members attached to at least three distinct completed, positive-value bills in one business day.",
733
+ [ne.REWARD_EARNING_OUTLIER]: "Daily reward earning is above the merchant-relative threshold for its reward type."
734
+ }, es = {
735
+ [ne.SAME_DAY_BILL_ANOMALY]: "Threshold: 3 completed bills in one business day.",
736
+ [ne.REWARD_EARNING_OUTLIER]: "Threshold: the greater of the prior-90-day P99 or median + 5 MAD, per reward type."
737
+ }, ts = {
738
+ VOUCHER: "Voucher",
739
+ CREDIT: "Credit",
740
+ COIN: "Point/spendable points",
741
+ POINT: "Experience"
742
+ }, ct = {
743
+ [ne.SAME_DAY_BILL_ANOMALY]: "sameDayBillAnomaly",
744
+ [ne.REWARD_EARNING_OUTLIER]: "rewardEarningOutlier"
745
+ }, as = {
746
+ VOUCHER: "voucher",
747
+ CREDIT: "credit",
748
+ COIN: "coin",
749
+ POINT: "point"
750
+ };
751
+ function os(e) {
752
+ return {
753
+ dateRange: e.dateRange,
754
+ businessRestaurantIds: [...e.businessRestaurantIds],
755
+ selectedRestaurantIds: [...e.selectedRestaurantIds],
756
+ timezone: e.timezone
757
+ };
758
+ }
759
+ function ss(e, s) {
760
+ return {
761
+ ...e,
762
+ dateRange: s
763
+ };
764
+ }
765
+ function We(e, s) {
766
+ return v(
767
+ s,
768
+ `connect.loyalty.dashboard.review.signals.${ct[e]}.label`,
769
+ Qo[e]
770
+ );
771
+ }
772
+ function gt(e, s) {
773
+ return v(
774
+ s,
775
+ `connect.loyalty.dashboard.review.rewardTypes.${as[e]}`,
776
+ ts[e]
777
+ );
778
+ }
779
+ const rs = 15 * 60 * 1e3;
780
+ function ns(e, s = /* @__PURE__ */ new Date(), t = rs) {
781
+ const n = Date.parse(e), i = new Date(s).getTime();
782
+ return Number.isFinite(n) && Number.isFinite(i) && i - n > t;
783
+ }
784
+ function ls(e, s = {}, t) {
785
+ const n = s.loading === !0, i = s.error === !0, y = e ? ns(e.updatedAt, s.now) : !1, p = ((e == null ? void 0 : e.bySignal) ?? []).filter(
786
+ (h) => He.includes(h.signal)
787
+ ), u = p.length !== ((e == null ? void 0 : e.bySignal.length) ?? 0), x = !e || e.status === "unavailable" || u, w = (e == null ? void 0 : e.status) === "available" && e.flaggedMembers === 0 && e.totalFindings === 0, R = n ? "loading" : x ? "unavailable" : y ? "stale" : e.status === "partial" ? "partial" : w ? "empty" : "available", g = {
788
+ loading: v(
789
+ t,
790
+ "connect.loyalty.dashboard.review.statusMessages.loading",
791
+ "Loading report data..."
792
+ ),
793
+ available: v(
794
+ t,
795
+ "connect.loyalty.dashboard.review.statusMessages.available",
796
+ "These are unusual activity findings from report data and require verification."
797
+ ),
798
+ partial: v(
799
+ t,
800
+ "connect.loyalty.dashboard.review.statusMessages.partial",
801
+ "Some report signals are unavailable. Available findings remain reviewable."
802
+ ),
803
+ unavailable: v(
804
+ t,
805
+ i ? "connect.loyalty.dashboard.review.statusMessages.error" : "connect.loyalty.dashboard.review.statusMessages.unavailable",
806
+ i ? "The report could not be loaded for this period." : "Report data is unavailable for this period."
807
+ ),
808
+ empty: v(
809
+ t,
810
+ "connect.loyalty.dashboard.review.statusMessages.empty",
811
+ "No unusual activity detected for the selected period."
812
+ ),
813
+ stale: v(
814
+ t,
815
+ "connect.loyalty.dashboard.review.statusMessages.stale",
816
+ "The report data may be stale. Verify findings against source records."
817
+ )
818
+ };
819
+ return {
820
+ status: R,
821
+ availability: u ? "unavailable" : (e == null ? void 0 : e.status) ?? "unavailable",
822
+ flaggedMembers: u ? null : (e == null ? void 0 : e.flaggedMembers) ?? null,
823
+ totalFindings: u ? null : (e == null ? void 0 : e.totalFindings) ?? null,
824
+ updatedAt: (e == null ? void 0 : e.updatedAt) ?? null,
825
+ stale: y,
826
+ error: i,
827
+ message: g[R],
828
+ bySignal: p.map((h) => ({
829
+ ...h,
830
+ label: We(h.signal, t),
831
+ description: v(
832
+ t,
833
+ `connect.loyalty.dashboard.review.signals.${ct[h.signal]}.description`,
834
+ Xo[h.signal]
835
+ ),
836
+ threshold: v(
837
+ t,
838
+ `connect.loyalty.dashboard.review.signals.${ct[h.signal]}.threshold`,
839
+ es[h.signal]
840
+ )
841
+ }))
842
+ };
843
+ }
844
+ function is(e, s, t = /* @__PURE__ */ new Date()) {
845
+ const n = De.tz(t, s).endOf("day"), i = n.clone().startOf("day");
846
+ return i.startOf("month"), [i.toISOString(), n.toISOString()];
847
+ }
848
+ function cs(e, s) {
849
+ return e.length ? e : s;
850
+ }
851
+ function ds(e) {
852
+ return {
853
+ dateRange: e.dateRange,
854
+ compareDateRange: e.compareDateRange,
855
+ restaurantIds: cs(
856
+ e.selectedLocationIds,
857
+ e.locationIds
858
+ ),
859
+ timezone: e.timezone
860
+ };
861
+ }
862
+ const ms = [
863
+ "same-period-last-week",
864
+ "same-period-last-month",
865
+ "preceding-period",
866
+ "same-period-last-year",
867
+ "custom"
868
+ ], us = "same-period-last-month";
869
+ function _t(e, s) {
870
+ return {
871
+ start: De.tz(e[0], s).startOf("day"),
872
+ end: De.tz(e[1], s).endOf("day")
873
+ };
874
+ }
875
+ function rt(e, s) {
876
+ return [e.toISOString(), s.toISOString()];
877
+ }
878
+ function ys(e, s, t, n) {
879
+ const i = _t(e, t);
880
+ if (s === "custom" && (n != null && n[0]) && n[1]) {
881
+ const w = _t(n, t);
882
+ return rt(w.start, w.end);
883
+ }
884
+ const y = s === "same-period-last-week" ? "week" : s === "same-period-last-month" ? "month" : s === "same-period-last-year" ? "year" : null;
885
+ if (y) {
886
+ const w = i.end.diff(i.start, y) + 1;
887
+ return rt(
888
+ i.start.clone().subtract(w, y),
889
+ i.end.clone().subtract(w, y)
890
+ );
891
+ }
892
+ const p = i.end.clone().startOf("day").diff(i.start.clone().startOf("day"), "days") + 1, u = i.start.clone().subtract(1, "day").endOf("day"), x = u.clone().subtract(p - 1, "days").startOf("day");
893
+ return rt(x, u);
894
+ }
895
+ const qe = (e) => ({
896
+ total: 0,
897
+ totalNew: 0,
898
+ totalPrev: 0,
899
+ active: 0,
900
+ activePrev: 0,
901
+ purchasing: 0,
902
+ purchasingPrev: 0,
903
+ repeat: 0,
904
+ repeatPrev: 0,
905
+ redeemers: 0,
906
+ redeemersPrev: 0,
907
+ memberSales: 0,
908
+ memberSalesPrev: 0,
909
+ series: Array(e).fill(0),
910
+ prev: Array(e).fill(0)
911
+ });
912
+ qe(20), qe(7), qe(30), qe(12);
913
+ const dt = (e, s) => s ? Math.round(e / s * 1e3) / 10 : 0, ps = (e, s) => s ? Math.round((e - s) / s * 1e3) / 10 : 0, Ae = (e) => e >= 1e3 ? (e / 1e3).toFixed(1).replace(/\.0$/, "") + "k" : String(e), _e = (e, s) => Jt(e).set({ currency: s }).toFormat(!0), bs = [
914
+ "neutral-black",
915
+ "primary",
916
+ "#FF9C52",
917
+ "#FFB577",
918
+ "#FFD0A3"
919
+ ], mt = {
920
+ text: "text-fm-color-typo-success",
921
+ bg: "bg-fm-color-system-success-100"
922
+ }, Rt = {
923
+ text: "text-fm-color-typo-error",
924
+ bg: "bg-fm-color-system-error-100"
925
+ }, ut = {
926
+ text: "text-fm-color-typo-warning",
927
+ bg: "bg-fm-color-system-warning-100"
928
+ };
929
+ function fs(e) {
930
+ return e === 0 ? "text-fm-color-typo-secondary" : e > 0 ? mt.text : Rt.text;
931
+ }
932
+ function hs(e, s) {
933
+ const t = [
934
+ {
935
+ id: "total",
936
+ label: "Total members",
937
+ count: e.totalMembers,
938
+ desc: "All members through period end",
939
+ description: Y.totalMembers,
940
+ i18nKey: "total",
941
+ denom: null
942
+ },
943
+ {
944
+ id: "active",
945
+ label: "Active members",
946
+ count: e.activeMembers,
947
+ desc: "Purchase or reward activity",
948
+ description: Y.activeMembers,
949
+ i18nKey: "active",
950
+ denom: e.totalMembers
951
+ },
952
+ {
953
+ id: "purchasing",
954
+ label: "Purchase members",
955
+ count: e.purchasingMembers,
956
+ desc: "At least 1 completed order",
957
+ description: Y.purchasingMembers,
958
+ i18nKey: "purchasing",
959
+ denom: e.activeMembers
960
+ },
961
+ {
962
+ id: "repeat",
963
+ label: "Repeat members",
964
+ count: e.repeatMembers,
965
+ desc: "At least 2 completed purchases",
966
+ description: Y.repeatMembers,
967
+ i18nKey: "repeat",
968
+ denom: e.purchasingMembers
969
+ },
970
+ {
971
+ id: "redeemers",
972
+ label: "Reward redeemers",
973
+ count: e.rewardRedeemers,
974
+ desc: "Repeat member used reward",
975
+ description: Y.funnelRewardRedeemers,
976
+ i18nKey: "redeemers",
977
+ denom: e.repeatMembers
978
+ }
979
+ ], n = t.map(
980
+ (u, x) => x === 0 || !u.denom ? null : dt(u.count, u.denom)
981
+ );
982
+ let i = null, y = 100;
983
+ return e.totalMembers > 0 && n.forEach((u, x) => {
984
+ x > 0 && u !== null && u < y && (y = u, i = x);
985
+ }), {
986
+ funnelStages: t.map((u, x) => {
987
+ const w = n[x], R = x === i, g = `connect.loyalty.dashboard.funnel.stages.${u.i18nKey}`;
988
+ return {
989
+ id: u.id,
990
+ label: v(s, `${g}.label`, u.label),
991
+ desc: v(s, `${g}.short`, u.desc),
992
+ description: v(
993
+ s,
994
+ `${g}.description`,
995
+ u.description
996
+ ),
997
+ countStr: Ae(u.count),
998
+ conversionStr: w != null ? v(
999
+ s,
1000
+ "connect.loyalty.dashboard.funnel.conversion",
1001
+ `${w}% convert`,
1002
+ { rate: w }
1003
+ ) : "",
1004
+ convRateLabel: w != null ? v(
1005
+ s,
1006
+ "connect.loyalty.dashboard.funnel.ofPrevious",
1007
+ `${w}% of prev`,
1008
+ { rate: w }
1009
+ ) : "",
1010
+ hasConvRate: x > 0,
1011
+ hasDropLine: x > 0,
1012
+ isBiggestDrop: R,
1013
+ barColor: bs[x] ?? "#FFD0A3",
1014
+ barWidthPct: e.totalMembers > 0 && u.count > 0 ? Math.max(dt(u.count, e.totalMembers), 1) : 0,
1015
+ dropClass: R ? `${ut.text} bg-[#FFF0E2]` : "text-fm-color-typo-secondary bg-fm-color-neutral-gray-100"
1016
+ };
1017
+ }),
1018
+ funnelFootnote: v(
1019
+ s,
1020
+ "connect.loyalty.dashboard.funnel.footnote",
1021
+ `${e.totalMembers.toLocaleString()} total members`,
1022
+ e.totalMembers
1023
+ ),
1024
+ convRates: n,
1025
+ biggestDropIdx: i
1026
+ };
1027
+ }
1028
+ function vs(e, s) {
1029
+ const { funnelStages: t, funnelFootnote: n } = hs(
1030
+ e,
1031
+ s
1032
+ );
1033
+ return { funnelStages: t, funnelFootnote: n };
1034
+ }
1035
+ const gs = 10;
1036
+ function _s(e, s) {
1037
+ const t = [
1038
+ {
1039
+ i18nKey: "reactivation",
1040
+ source: e.totalMembers,
1041
+ target: e.activeMembers,
1042
+ title: "Many members are not active",
1043
+ body: "Members who joined may benefit from a reactivation campaign.",
1044
+ action: {
1045
+ label: "Create reactivation campaign",
1046
+ path: "/campaign/promotion"
1047
+ }
1048
+ },
1049
+ {
1050
+ i18nKey: "purchase",
1051
+ source: e.activeMembers,
1052
+ target: e.purchasingMembers,
1053
+ title: "Active members are not purchasing",
1054
+ body: "Active members may benefit from a review of purchase incentives.",
1055
+ action: {
1056
+ label: "Review purchase incentives",
1057
+ path: "/campaign/promotion"
1058
+ }
1059
+ },
1060
+ {
1061
+ i18nKey: "retention",
1062
+ source: e.purchasingMembers,
1063
+ target: e.repeatMembers,
1064
+ title: "Members are not returning after a purchase",
1065
+ body: "Members who purchase once may benefit from a retention campaign.",
1066
+ action: {
1067
+ label: "Create retention campaign",
1068
+ path: "/campaign/promotion"
1069
+ }
1070
+ },
1071
+ {
1072
+ i18nKey: "reward",
1073
+ source: e.repeatMembers,
1074
+ target: e.rewardRedeemers,
1075
+ title: "Repeat members are not using rewards",
1076
+ body: "Repeat members may benefit from a review of reward setup.",
1077
+ action: {
1078
+ label: "Review reward setup",
1079
+ path: "/reward"
1080
+ }
1081
+ }
1082
+ ];
1083
+ let n = null;
1084
+ for (const p of t)
1085
+ p.source < gs || p.target >= p.source || (!n || p.target / p.source < n.target / n.source) && (n = p);
1086
+ if (!n) return null;
1087
+ const i = Math.round(n.target / n.source * 1e3) / 10, y = `connect.loyalty.dashboard.insight.candidates.${n.i18nKey}`;
1088
+ return {
1089
+ title: v(s, `${y}.title`, n.title),
1090
+ body: `${v(
1091
+ s,
1092
+ "connect.loyalty.dashboard.insight.progress",
1093
+ `${i}% of this stage progressed in the selected period.`,
1094
+ { rate: i }
1095
+ )} ${v(s, `${y}.body`, n.body)}`,
1096
+ action: {
1097
+ ...n.action,
1098
+ label: v(
1099
+ s,
1100
+ `${y}.action`,
1101
+ n.action.label
1102
+ )
1103
+ },
1104
+ signals: [
1105
+ {
1106
+ text: v(
1107
+ s,
1108
+ "connect.loyalty.dashboard.insight.signal",
1109
+ `${n.target.toLocaleString()} of ${n.source.toLocaleString()} members progressed`,
1110
+ {
1111
+ target: n.target.toLocaleString(),
1112
+ source: n.source.toLocaleString()
1113
+ }
1114
+ )
1115
+ }
1116
+ ]
1117
+ };
1118
+ }
1119
+ const xs = {
1120
+ VOUCHER: "Voucher",
1121
+ PROMOTION: "Promotion",
1122
+ POINT: "Experience",
1123
+ CREDIT: "Credit",
1124
+ BROADCAST: "Broadcast",
1125
+ COIN: "Point",
1126
+ REWARD_POOL: "Reward pool",
1127
+ GAME: "Game",
1128
+ MISSION: "Mission"
1129
+ }, ws = {
1130
+ active: { label: "Active", class: mt.text },
1131
+ expired: { label: "Ended", class: "text-fm-color-typo-tertiary" },
1132
+ upcoming: { label: "Upcoming", class: ut.text }
1133
+ };
1134
+ function Rs(e) {
1135
+ return e.type !== "MEMBERSHIP";
1136
+ }
1137
+ function Ss(e, s) {
1138
+ var t;
1139
+ return !s.length || !((t = e.targetLocation) != null && t.length) ? !0 : e.targetLocation.some(
1140
+ (n) => s.includes(n.toString())
1141
+ );
1142
+ }
1143
+ function nt(e) {
1144
+ var s;
1145
+ if (((s = e.timeframeOptions) == null ? void 0 : s.type) === "timeframe") {
1146
+ const t = De();
1147
+ return t.isBetween(
1148
+ e.timeframeOptions.start ?? t.clone().subtract(1, "d"),
1149
+ e.timeframeOptions.end ?? t.clone().add(1, "d")
1150
+ ) ? "active" : t.isAfter(e.timeframeOptions.end) ? "expired" : "upcoming";
1151
+ }
1152
+ return "active";
1153
+ }
1154
+ function Ms(e, s, t) {
1155
+ return e.filter(Rs).filter(
1156
+ (n) => n.type !== "BROADCAST" || !n.linkedCampaign
1157
+ ).filter(
1158
+ (n) => Ss(n, s)
1159
+ ).sort((n, i) => {
1160
+ const y = nt(n);
1161
+ return +(nt(i) === "active") - +(y === "active");
1162
+ }).slice(0, 4).map((n) => {
1163
+ const i = nt(n), y = ws[i], p = n.type === "BROADCAST", u = v(
1164
+ t,
1165
+ `connect.loyalty.dashboard.campaigns.types.${n.type}`,
1166
+ xs[n.type] ?? n.type
1167
+ ), x = v(
1168
+ t,
1169
+ `connect.loyalty.dashboard.campaigns.status.${i}`,
1170
+ y.label
1171
+ );
1172
+ return {
1173
+ id: n._id.toString(),
1174
+ name: n.name,
1175
+ type: u,
1176
+ status: x,
1177
+ metric: p ? String(n.currentReceive ?? 0) : x,
1178
+ metricLabel: v(
1179
+ t,
1180
+ p ? "connect.loyalty.dashboard.campaigns.messagesSent" : "connect.loyalty.dashboard.campaigns.statusLabel",
1181
+ p ? "Messages sent" : "Status"
1182
+ ),
1183
+ statusClass: y.class
1184
+ };
1185
+ });
1186
+ }
1187
+ function $s(e, s, t) {
1188
+ return {
1189
+ categories: e.categories,
1190
+ prevCategories: e.prevCategories,
1191
+ comparisonCategories: e.categories.map(
1192
+ (n, i) => [n, e.prevCategories[i]].filter(Boolean).map((y) => De(y).format("DD/MM/YYYY")).join(
1193
+ v(
1194
+ t,
1195
+ "connect.loyalty.dashboard.salesTrend.comparisonSeparator",
1196
+ " vs "
1197
+ )
1198
+ )
1199
+ ),
1200
+ series: e.series,
1201
+ prevSeries: e.prevSeries,
1202
+ description: v(
1203
+ t,
1204
+ "connect.loyalty.dashboard.salesTrend.description",
1205
+ Y.memberSalesTrend
1206
+ ),
1207
+ totalFmt: _e(e.memberSales, s),
1208
+ deltaStr: `${e.deltaPct > 0 ? "+" : ""}${e.deltaPct}%`,
1209
+ deltaClass: fs(e.deltaPct)
1210
+ };
1211
+ }
1212
+ function Cs(e, s, t, n, i) {
1213
+ if (!e.memberOrders && !e.nonMemberOrders)
1214
+ return v(
1215
+ i,
1216
+ "connect.loyalty.dashboard.spend.summary.noOrders",
1217
+ "No completed orders were recorded in this period."
1218
+ );
1219
+ if (t === 0 && s > 0)
1220
+ return v(
1221
+ i,
1222
+ "connect.loyalty.dashboard.spend.summary.memberAll",
1223
+ "Members account for all tracked spend in this period."
1224
+ );
1225
+ if (s === 0 && t > 0)
1226
+ return v(
1227
+ i,
1228
+ "connect.loyalty.dashboard.spend.summary.nonMemberAll",
1229
+ "Non-members account for all tracked spend in this period."
1230
+ );
1231
+ if (n > 0)
1232
+ return v(
1233
+ i,
1234
+ "connect.loyalty.dashboard.spend.summary.memberHigher",
1235
+ `Members spend ${n}% more per order than non-members. Converting more walk-ins to members is a direct lever on sales.`,
1236
+ { gap: n }
1237
+ );
1238
+ if (n < 0) {
1239
+ const y = Math.abs(n);
1240
+ return v(
1241
+ i,
1242
+ "connect.loyalty.dashboard.spend.summary.nonMemberHigher",
1243
+ `Non-members spend ${y}% more per order than members. Converting more walk-ins to members can increase member-linked sales.`,
1244
+ { gap: y }
1245
+ );
1246
+ }
1247
+ return v(
1248
+ i,
1249
+ "connect.loyalty.dashboard.spend.summary.equal",
1250
+ "Members and non-members have the same average order value in this period."
1251
+ );
1252
+ }
1253
+ function Fs(e, s, t) {
1254
+ const n = e.memberOrders ? e.memberSales / e.memberOrders : 0, i = e.nonMemberOrders ? e.nonMemberSales / e.nonMemberOrders : 0, y = e.memberSales + e.nonMemberSales, p = ps(n, i);
1255
+ return {
1256
+ description: v(
1257
+ t,
1258
+ "connect.loyalty.dashboard.spend.description",
1259
+ Y.memberSpendComparison
1260
+ ),
1261
+ memberSalesFmt: _e(e.memberSales, s),
1262
+ nonMemberSalesFmt: _e(e.nonMemberSales, s),
1263
+ avgMemberSaleFmt: _e(n, s),
1264
+ avgNonMemberSaleFmt: _e(i, s),
1265
+ memberSharePct: dt(e.memberSales, y),
1266
+ avgGapPct: p,
1267
+ summary: Cs(
1268
+ e,
1269
+ n,
1270
+ i,
1271
+ p,
1272
+ t
1273
+ )
1274
+ };
1275
+ }
1276
+ function Ds(e, s) {
1277
+ const t = e.criteria, n = {
1278
+ newlyJoined: v(
1279
+ s,
1280
+ "connect.loyalty.dashboard.lifecycle.descriptions.newlyJoined",
1281
+ Y.newlyJoined
1282
+ ),
1283
+ frequent: t ? v(
1284
+ s,
1285
+ "connect.loyalty.dashboard.lifecycle.descriptions.frequentWithCriteria",
1286
+ `Existing members with at least ${t.frequentMinBills} completed member bills in the selected period.`,
1287
+ { count: t.frequentMinBills }
1288
+ ) : v(
1289
+ s,
1290
+ "connect.loyalty.dashboard.lifecycle.descriptions.frequent",
1291
+ Y.frequent
1292
+ ),
1293
+ infrequent: t ? v(
1294
+ s,
1295
+ "connect.loyalty.dashboard.lifecycle.descriptions.infrequentWithCriteria",
1296
+ `Existing members with 1 to ${t.frequentMinBills - 1} completed member bills in the selected period.`,
1297
+ { count: t.frequentMinBills - 1 }
1298
+ ) : v(
1299
+ s,
1300
+ "connect.loyalty.dashboard.lifecycle.descriptions.infrequent",
1301
+ Y.infrequent
1302
+ ),
1303
+ atRisk: t ? v(
1304
+ s,
1305
+ "connect.loyalty.dashboard.lifecycle.descriptions.atRiskWithCriteria",
1306
+ `Existing members with no selected-period purchase but a completed purchase in the prior ${t.atRiskLookbackDays} calendar days.`,
1307
+ { count: t.atRiskLookbackDays }
1308
+ ) : v(
1309
+ s,
1310
+ "connect.loyalty.dashboard.lifecycle.descriptions.atRisk",
1311
+ Y.atRisk
1312
+ ),
1313
+ dormant: t ? v(
1314
+ s,
1315
+ "connect.loyalty.dashboard.lifecycle.descriptions.dormantWithCriteria",
1316
+ `Existing members with no selected-period purchase and no completed purchase in the prior ${t.atRiskLookbackDays} calendar days.`,
1317
+ { count: t.atRiskLookbackDays }
1318
+ ) : v(
1319
+ s,
1320
+ "connect.loyalty.dashboard.lifecycle.descriptions.dormant",
1321
+ Y.dormant
1322
+ )
1323
+ }, i = [
1324
+ {
1325
+ id: "new",
1326
+ label: "Newly joined",
1327
+ count: e.newlyJoined,
1328
+ description: n.newlyJoined,
1329
+ i18nKey: "new",
1330
+ labelClass: mt.text,
1331
+ barColor: "typo-success"
1332
+ },
1333
+ {
1334
+ id: "frequent",
1335
+ label: "Frequent",
1336
+ count: e.frequent,
1337
+ description: n.frequent,
1338
+ i18nKey: "frequent",
1339
+ labelClass: "text-fm-color-primary",
1340
+ barColor: "primary"
1341
+ },
1342
+ {
1343
+ id: "infrequent",
1344
+ label: "Infrequent",
1345
+ count: e.infrequent,
1346
+ description: n.infrequent,
1347
+ i18nKey: "infrequent",
1348
+ labelClass: "text-fm-color-typo-secondary",
1349
+ barColor: "neutral-gray-300"
1350
+ },
1351
+ {
1352
+ id: "at-risk",
1353
+ label: "At-risk",
1354
+ count: e.atRisk,
1355
+ description: n.atRisk,
1356
+ i18nKey: "atRisk",
1357
+ labelClass: ut.text,
1358
+ barColor: "#FFC746"
1359
+ },
1360
+ {
1361
+ id: "dormant",
1362
+ label: "Dormant",
1363
+ count: e.dormant,
1364
+ description: n.dormant,
1365
+ i18nKey: "dormant",
1366
+ labelClass: Rt.text,
1367
+ barColor: "#FFCFCC"
1368
+ }
1369
+ ], y = Math.max(...i.map((u) => u.count), 1);
1370
+ return {
1371
+ lifecycleSegs: i.map((u) => ({
1372
+ ...u,
1373
+ label: v(
1374
+ s,
1375
+ `connect.loyalty.dashboard.lifecycle.labels.${u.i18nKey}`,
1376
+ u.label
1377
+ ),
1378
+ barPct: Math.round(u.count / y * 100),
1379
+ pctStr: `${e.totalMembers ? Math.round(u.count / e.totalMembers * 100) : 0}%`,
1380
+ countStr: Ae(u.count)
1381
+ })),
1382
+ lifecycleSummary: v(
1383
+ s,
1384
+ "connect.loyalty.dashboard.lifecycle.summary",
1385
+ `${Ae(e.atRisk + e.dormant)} members are at-risk or dormant`,
1386
+ e.atRisk + e.dormant
1387
+ )
1388
+ };
1389
+ }
1390
+ function As(e, s) {
1391
+ return Ds(e, s);
1392
+ }
1393
+ function ks(e, s, t) {
1394
+ return e.displayUnit === "uses" ? v(
1395
+ t,
1396
+ "connect.loyalty.dashboard.rewards.uses",
1397
+ `${Ae(e.displayValue)} ${e.displayValue === 1 ? "use" : "uses"}`,
1398
+ e.displayValue
1399
+ ) : e.type === "COIN" ? v(
1400
+ t,
1401
+ "connect.loyalty.dashboard.rewards.points",
1402
+ `${Ae(e.displayValue)} pts`,
1403
+ e.displayValue
1404
+ ) : _e(e.displayValue, s);
1405
+ }
1406
+ function Is(e, s) {
1407
+ if (e.displayUnit === "uses")
1408
+ return v(
1409
+ s,
1410
+ "connect.loyalty.dashboard.rewards.topReward.voucherUsesDescription",
1411
+ "Counted voucher-use transactions for this reward during the selected period."
1412
+ );
1413
+ const t = e.type === "COIN" ? "point" : e.type.toLowerCase();
1414
+ return v(
1415
+ s,
1416
+ "connect.loyalty.dashboard.rewards.topReward.amountDescription",
1417
+ `Total ${t} amount used for this reward during the selected period.`,
1418
+ {
1419
+ type: v(
1420
+ s,
1421
+ `connect.loyalty.dashboard.rewards.types.${e.type}`,
1422
+ t
1423
+ )
1424
+ }
1425
+ );
1426
+ }
1427
+ function Ls(e, s, t) {
1428
+ const n = Math.max(
1429
+ ...e.topRewards.map((i) => i.usageCount),
1430
+ 1
1431
+ );
1432
+ return {
1433
+ rewardKpis: [
1434
+ {
1435
+ label: v(
1436
+ t,
1437
+ "connect.loyalty.dashboard.rewards.kpis.rewardRedeemers",
1438
+ "Reward redeemers"
1439
+ ),
1440
+ value: Ae(e.rewardRedeemers),
1441
+ description: v(
1442
+ t,
1443
+ "connect.loyalty.dashboard.rewards.descriptions.rewardRedeemers",
1444
+ Y.rewardRedeemers
1445
+ )
1446
+ },
1447
+ {
1448
+ label: v(
1449
+ t,
1450
+ "connect.loyalty.dashboard.rewards.kpis.redemptionRate",
1451
+ "Redemption rate"
1452
+ ),
1453
+ value: `${e.redemptionRatePct}%`,
1454
+ description: v(
1455
+ t,
1456
+ "connect.loyalty.dashboard.rewards.descriptions.redemptionRate",
1457
+ Y.redemptionRate
1458
+ )
1459
+ },
1460
+ {
1461
+ label: v(
1462
+ t,
1463
+ "connect.loyalty.dashboard.rewards.kpis.averageUses",
1464
+ "Avg reward uses"
1465
+ ),
1466
+ value: `${e.averageRewardUsesPerRedeemer}x`,
1467
+ description: v(
1468
+ t,
1469
+ "connect.loyalty.dashboard.rewards.descriptions.averageUses",
1470
+ Y.averageRewardUses
1471
+ )
1472
+ }
1473
+ ],
1474
+ topRewards: e.topRewards.map((i) => ({
1475
+ name: i.name,
1476
+ count: ks(i, s, t),
1477
+ description: Is(i, t),
1478
+ barPct: i.usageCount ? Math.round(i.usageCount / n * 100) : 0
1479
+ }))
1480
+ };
1481
+ }
1482
+ const Os = { class: "flex flex-col gap-16 min-h-full" }, Es = { class: "flex flex-col gap-12 pb-16 border-b border-fm-color-neutral-gray-100" }, Ps = { class: "flex items-center justify-between gap-8" }, Bs = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, Ts = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary mt-2" }, Ns = {
1483
+ key: 0,
1484
+ class: "flex items-center justify-center min-h-[72px]"
1485
+ }, Us = { class: "grid grid-cols-2 gap-8" }, zs = { class: "border border-fm-color-neutral-gray-100 rounded-sm p-12" }, Vs = { class: "fm-typo-en-title-lg-800 text-fm-color-typo-primary" }, js = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mt-4" }, Ks = { class: "border border-fm-color-neutral-gray-100 rounded-sm p-12" }, qs = { class: "fm-typo-en-title-lg-800 text-fm-color-typo-primary" }, Ys = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mt-4" }, Hs = {
1486
+ key: 0,
1487
+ class: "flex flex-col gap-8"
1488
+ }, Ws = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary" }, Gs = { class: "flex items-center justify-between gap-8" }, Js = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary" }, Zs = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Qs = { class: "flex items-start justify-between gap-12 fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" }, Xs = { class: "whitespace-nowrap" }, er = {
1489
+ key: 0,
1490
+ class: "mt-4 pl-12 border-l-2 border-fm-color-neutral-gray-100 flex flex-col gap-4"
1491
+ }, tr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" }, ar = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, or = {
1492
+ key: 0,
1493
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-error p-12 rounded-sm border border-fm-color-system-error-200 bg-fm-color-system-error-100"
1494
+ }, sr = { class: "grid grid-cols-2 md:grid-cols-4 gap-8 items-end" }, rr = { class: "flex items-center justify-between gap-12 flex-wrap" }, nr = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary" }, lr = {
1495
+ key: 0,
1496
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1497
+ }, ir = { class: "flex items-center gap-8" }, cr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, dr = {
1498
+ key: 1,
1499
+ class: "flex items-center justify-center min-h-[180px]"
1500
+ }, mr = {
1501
+ key: 2,
1502
+ class: "flex flex-col items-center justify-center gap-8 min-h-[180px] text-center"
1503
+ }, ur = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, yr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, pr = {
1504
+ key: 3,
1505
+ class: "flex flex-col items-center justify-center gap-8 min-h-[180px] text-center"
1506
+ }, br = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, fr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, hr = {
1507
+ key: 4,
1508
+ class: "flex flex-col gap-8"
1509
+ }, vr = { class: "flex items-stretch gap-8 p-12" }, gr = ["aria-expanded", "onClick", "onKeydown"], _r = { class: "flex-1 min-w-0" }, xr = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary truncate" }, wr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary truncate" }, Rr = { class: "hidden md:flex flex-col justify-center min-w-[150px]" }, Sr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" }, Mr = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary" }, $r = { class: "hidden lg:flex flex-wrap items-center gap-4 max-w-[260px]" }, Cr = {
1510
+ key: 0,
1511
+ class: "border-t border-fm-color-neutral-gray-100 bg-fm-color-neutral-gray-100 p-16"
1512
+ }, Fr = { class: "grid grid-cols-1 md:grid-cols-2 gap-16 mb-16" }, Dr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" }, Ar = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary" }, kr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" }, Ir = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary" }, Lr = { class: "flex flex-col gap-8" }, Or = { class: "flex items-start justify-between gap-12" }, Er = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary" }, Pr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary whitespace-nowrap" }, Br = { class: "grid grid-cols-1 md:grid-cols-2 gap-x-16 gap-y-8 mt-8" }, Tr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Nr = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary" }, Ur = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, zr = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary" }, Vr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, jr = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary" }, Kr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, qr = {
1513
+ key: 0,
1514
+ class: "mt-4 flex max-w-full flex-wrap gap-4"
1515
+ }, Yr = {
1516
+ key: 1,
1517
+ class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary"
1518
+ }, Hr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary md:col-span-2" }, Wr = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary break-words" }, Gr = {
1519
+ key: 5,
1520
+ class: "flex items-center justify-between gap-12 pt-8 border-t border-fm-color-neutral-gray-100"
1521
+ }, Jr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Zr = { class: "flex items-center gap-4" }, Qr = /* @__PURE__ */ Z({
1522
+ __name: "RewardAbuseFindingsSheet",
1523
+ props: /* @__PURE__ */ Bt({
1524
+ payload: {},
1525
+ summary: {},
1526
+ outlierMetric: {},
1527
+ locations: {}
1528
+ }, {
1529
+ modelValue: { type: Boolean, default: !1 },
1530
+ modelModifiers: {}
1531
+ }),
1532
+ emits: ["update:modelValue"],
1533
+ setup(e) {
1534
+ const s = e, { t, locale: n } = Q(), i = (m, C) => typeof C == "number" ? t(m, C) : C === void 0 ? t(m) : t(m, C), y = Tt(e, "modelValue"), p = S(He[0]), u = S([]), x = S(""), w = S({
1535
+ startDate: void 0,
1536
+ endDate: void 0
1537
+ }), R = S(10), g = S(0), h = S("latestOccurredOn"), V = S([]), oe = S(0), I = S(0), X = S(!1), ke = S(!1), be = S(!1), A = S({}), ee = S(null), le = S(null);
1538
+ let G = 0, te = "", se;
1539
+ const Ue = $(
1540
+ () => He.map((m) => ({
1541
+ label: We(m, i),
1542
+ value: m
1543
+ }))
1544
+ ), ze = $(() => [
1545
+ {
1546
+ label: t("connect.loyalty.dashboard.review.sortItems.latestFlagged"),
1547
+ value: "latestOccurredOn"
1548
+ },
1549
+ {
1550
+ label: t("connect.loyalty.dashboard.review.sortItems.highestObserved"),
1551
+ value: "observedValue"
1552
+ }
1553
+ ]), ie = [
1554
+ { label: "10", value: 10 },
1555
+ { label: "20", value: 20 },
1556
+ { label: "50", value: 50 }
1557
+ ], re = $(
1558
+ () => I.value ? Math.ceil(I.value / R.value) : 0
1559
+ ), Ie = $(() => g.value + 1), Le = $(
1560
+ () => Object.fromEntries(
1561
+ s.locations.map((m) => [m.value, m.label])
1562
+ )
1563
+ ), Oe = $(
1564
+ () => `${w.value.startDate}-${w.value.endDate}`
1565
+ ), we = $(
1566
+ () => ({
1567
+ loading: t("connect.loyalty.dashboard.review.statuses.loading"),
1568
+ available: t("connect.loyalty.dashboard.review.statuses.available"),
1569
+ partial: t("connect.loyalty.dashboard.review.statuses.partial"),
1570
+ unavailable: t("connect.loyalty.dashboard.review.statuses.unavailable"),
1571
+ empty: t("connect.loyalty.dashboard.review.statuses.empty"),
1572
+ stale: t("connect.loyalty.dashboard.review.statuses.stale")
1573
+ })
1574
+ );
1575
+ function Ee(m) {
1576
+ return m === "available" || m === "empty" ? "text-fm-color-typo-success bg-fm-color-system-success-100" : m === "partial" || m === "stale" ? "text-fm-color-typo-warning bg-fm-color-system-warning-100" : "text-fm-color-typo-error bg-fm-color-system-error-100";
1577
+ }
1578
+ function Pe(m) {
1579
+ return t(m === "available" ? "connect.loyalty.dashboard.review.signalStatuses.available" : m === "insufficient-baseline" ? "connect.loyalty.dashboard.review.signalStatuses.insufficientBaseline" : "connect.loyalty.dashboard.review.signalStatuses.unavailable");
1580
+ }
1581
+ function Be(m) {
1582
+ return m === "available" ? "text-fm-color-typo-success" : m === "insufficient-baseline" ? "text-fm-color-typo-warning" : "text-fm-color-typo-error";
1583
+ }
1584
+ function L(m) {
1585
+ return m === null ? "--" : m.toLocaleString();
1586
+ }
1587
+ function Re(m) {
1588
+ return m === null ? "--" : m.toLocaleString();
1589
+ }
1590
+ function ce(m) {
1591
+ var P;
1592
+ const C = Yt(m);
1593
+ return C.isValid() ? new Intl.DateTimeFormat(n.value, {
1594
+ day: "numeric",
1595
+ month: "short",
1596
+ year: "numeric",
1597
+ hour: "numeric",
1598
+ minute: "2-digit",
1599
+ timeZone: (P = s.payload) == null ? void 0 : P.timezone
1600
+ }).format(C.toDate()) : "--";
1601
+ }
1602
+ function fe(m) {
1603
+ return m.length ? m.join(", ") : "--";
1604
+ }
1605
+ function he(m) {
1606
+ return Gt(m, {
1607
+ successMessage: t("connect.loyalty.dashboard.review.copyBillIdSuccess")
1608
+ });
1609
+ }
1610
+ function ve(m) {
1611
+ return m.member.name || t("connect.loyalty.dashboard.review.memberFallback");
1612
+ }
1613
+ function Se(m) {
1614
+ return m ? t("connect.loyalty.dashboard.review.updated", {
1615
+ date: ce(m)
1616
+ }) : t("connect.loyalty.dashboard.review.timestampUnavailable");
1617
+ }
1618
+ function Me(m) {
1619
+ return m.status !== "available" ? t("connect.loyalty.dashboard.review.outlier.insufficientBaseline") : t("connect.loyalty.dashboard.review.outlier.available", {
1620
+ threshold: Re(m.threshold),
1621
+ members: m.baselineMembers.toLocaleString()
1622
+ });
1623
+ }
1624
+ function Ze(m) {
1625
+ return Le.value[m] ?? m;
1626
+ }
1627
+ function ue(m) {
1628
+ var C, P, j;
1629
+ return m.member.id ?? `anonymous-${m.latestOccurredOn}-${(C = m.findings[0]) == null ? void 0 : C.billIds.join(
1630
+ "-"
1631
+ )}-${(P = m.findings[0]) == null ? void 0 : P.referenceIds.join("-")}-${(j = m.findings[0]) == null ? void 0 : j.observedValue}`;
1632
+ }
1633
+ function $e(m) {
1634
+ const C = ue(m);
1635
+ A.value[C] = !A.value[C];
1636
+ }
1637
+ function Qe(m) {
1638
+ m.startDate && m.endDate && (w.value = m);
1639
+ }
1640
+ function Ve() {
1641
+ var C, P;
1642
+ const m = s.payload;
1643
+ m && (p.value = ((C = s.summary.bySignal.find(
1644
+ (j) => j.status === "available" && (j.findings ?? 0) > 0
1645
+ )) == null ? void 0 : C.signal) ?? ((P = s.summary.bySignal.find((j) => j.status === "available")) == null ? void 0 : P.signal) ?? He[0], u.value = [...m.selectedRestaurantIds], w.value = {
1646
+ startDate: m.dateRange[0],
1647
+ endDate: m.dateRange[1]
1648
+ }, x.value = "", R.value = 10, g.value = 0, h.value = "latestOccurredOn", A.value = {}, be.value = !1);
1649
+ }
1650
+ function Te() {
1651
+ return !w.value.startDate || !w.value.endDate ? null : [w.value.startDate, w.value.endDate];
1652
+ }
1653
+ async function de(m = !1) {
1654
+ if (!y.value || !s.payload) return;
1655
+ const C = Te();
1656
+ if (!C) return;
1657
+ const j = {
1658
+ ...ss(
1659
+ s.payload,
1660
+ C
1661
+ ),
1662
+ selectedRestaurantIds: [...u.value],
1663
+ signal: p.value,
1664
+ search: x.value.trim(),
1665
+ page: g.value + 1,
1666
+ pageSize: R.value,
1667
+ sortBy: h.value,
1668
+ sortDirection: "desc"
1669
+ }, ye = JSON.stringify(j);
1670
+ if (!m && ye === te) return;
1671
+ te = ye;
1672
+ const me = ++G;
1673
+ X.value = !0, ke.value = !1;
1674
+ try {
1675
+ const J = await H.readRewardAbuseFindings(j);
1676
+ if (me !== G) return;
1677
+ V.value = J.members, oe.value = J.totalMembers, I.value = J.totalRows, A.value = {};
1678
+ } catch {
1679
+ if (me !== G) return;
1680
+ ke.value = !0, V.value = [], oe.value = 0, I.value = 0;
1681
+ } finally {
1682
+ me === G && (X.value = !1);
1683
+ }
1684
+ }
1685
+ function Xe() {
1686
+ y.value && (g.value = 0, se && clearTimeout(se), se = setTimeout(() => {
1687
+ de();
1688
+ }, 250));
1689
+ }
1690
+ function je() {
1691
+ g.value < re.value - 1 && (g.value += 1, de());
1692
+ }
1693
+ function et() {
1694
+ g.value > 0 && (g.value -= 1, de());
1695
+ }
1696
+ function tt(m) {
1697
+ R.value = m, g.value = 0, de();
1698
+ }
1699
+ async function at(m) {
1700
+ var C;
1701
+ if (m.member.id) {
1702
+ be.value = !1;
1703
+ try {
1704
+ const P = await Ht.readById(m.member.id);
1705
+ ee.value = P, await xt(), (C = le.value) == null || C.showSheet();
1706
+ } catch {
1707
+ be.value = !0;
1708
+ }
1709
+ }
1710
+ }
1711
+ return Ye(y, (m) => {
1712
+ if (!m) {
1713
+ ee.value = null, be.value = !1;
1714
+ return;
1715
+ }
1716
+ te = "", Ve(), de(!0);
1717
+ }), Ye(
1718
+ [p, u, x, w, h],
1719
+ Xe,
1720
+ { deep: !0 }
1721
+ ), Ye(
1722
+ () => s.payload,
1723
+ () => {
1724
+ y.value && (te = "", Ve(), de(!0));
1725
+ },
1726
+ { deep: !0 }
1727
+ ), Nt(() => {
1728
+ se && clearTimeout(se);
1729
+ }), (m, C) => {
1730
+ const P = M("FmCircularProgress"), j = M("FmSearch"), ye = M("FmSelect"), me = M("FmIcon"), J = M("FmButton"), Ke = M("FmAvatar"), ot = M("FmChip"), Ne = M("FmTooltip"), st = M("FmSideSheet");
1731
+ return c(), N(st, {
1732
+ modelValue: y.value,
1733
+ "onUpdate:modelValue": C[5] || (C[5] = (_) => y.value = _),
1734
+ header: o(t)("connect.loyalty.dashboard.review.sheetTitle"),
1735
+ "dismiss-away": "",
1736
+ "max-width": 1100
1737
+ }, {
1738
+ default: U(() => [
1739
+ a("div", Os, [
1740
+ a("section", Es, [
1741
+ a("div", Ps, [
1742
+ a("div", null, [
1743
+ a("div", Bs, r(o(t)("connect.loyalty.dashboard.review.summaryTitle")), 1),
1744
+ a("div", Ts, r(o(t)("connect.loyalty.dashboard.review.summaryDescription")), 1)
1745
+ ]),
1746
+ a("span", {
1747
+ class: T(["fm-typo-en-body-sm-600 px-8 py-4 rounded-sm whitespace-nowrap", Ee(e.summary.status)])
1748
+ }, r(o(we)[e.summary.status]), 3)
1749
+ ]),
1750
+ e.summary.status === "loading" ? (c(), d("div", Ns, [
1751
+ f(P, { size: "lg" })
1752
+ ])) : (c(), d(k, { key: 1 }, [
1753
+ a("div", Us, [
1754
+ a("div", zs, [
1755
+ a("div", Vs, r(L(e.summary.flaggedMembers)), 1),
1756
+ a("div", js, r(o(t)("connect.loyalty.dashboard.review.uniqueMembers")), 1)
1757
+ ]),
1758
+ a("div", Ks, [
1759
+ a("div", qs, r(L(e.summary.totalFindings)), 1),
1760
+ a("div", Ys, r(o(t)("connect.loyalty.dashboard.review.totalFindings")), 1)
1761
+ ])
1762
+ ]),
1763
+ a("div", {
1764
+ class: T([
1765
+ "fm-typo-en-body-sm-400 p-12 rounded-sm border",
1766
+ e.summary.status === "available" || e.summary.status === "empty" ? "text-fm-color-typo-secondary border-fm-color-neutral-gray-100 bg-fm-color-neutral-gray-100" : e.summary.status === "partial" || e.summary.status === "stale" ? "text-fm-color-typo-warning border-fm-color-system-warning-200 bg-fm-color-system-warning-100" : "text-fm-color-typo-error border-fm-color-system-error-200 bg-fm-color-system-error-100"
1767
+ ])
1768
+ }, r(e.summary.message), 3),
1769
+ e.summary.bySignal.length ? (c(), d("div", Hs, [
1770
+ a("div", Ws, r(o(t)("connect.loyalty.dashboard.review.signalSummary")), 1),
1771
+ (c(!0), d(k, null, W(e.summary.bySignal, (_) => {
1772
+ var D;
1773
+ return c(), d("div", {
1774
+ key: _.signal,
1775
+ class: "flex flex-col gap-4 py-8 border-b border-fm-color-neutral-gray-100 last:border-b-0"
1776
+ }, [
1777
+ a("div", Gs, [
1778
+ a("div", Js, r(_.label), 1),
1779
+ a("div", {
1780
+ class: T(["fm-typo-en-body-sm-600", Be(_.status)])
1781
+ }, r(Pe(_.status)), 3)
1782
+ ]),
1783
+ a("div", Zs, r(_.description), 1),
1784
+ a("div", Qs, [
1785
+ a("span", null, r(_.threshold), 1),
1786
+ a("span", Xs, r(o(t)("connect.loyalty.dashboard.review.signalCounts", {
1787
+ members: L(_.flaggedMembers),
1788
+ findings: L(_.findings)
1789
+ })), 1)
1790
+ ]),
1791
+ _.signal === "reward-earning-outlier" && ((D = e.outlierMetric) != null && D.byType.length) ? (c(), d("div", er, [
1792
+ (c(!0), d(k, null, W(e.outlierMetric.byType, (B) => (c(), d("div", {
1793
+ key: B.type,
1794
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary"
1795
+ }, r(o(gt)(B.type, i)) + ": " + r(Me(B)), 1))), 128))
1796
+ ])) : z("", !0)
1797
+ ]);
1798
+ }), 128))
1799
+ ])) : z("", !0),
1800
+ a("div", tr, r(Se(e.summary.updatedAt)), 1)
1801
+ ], 64))
1802
+ ]),
1803
+ a("div", ar, r(o(t)("connect.loyalty.dashboard.review.intro")), 1),
1804
+ o(be) ? (c(), d("div", or, r(o(t)("connect.loyalty.dashboard.review.detailError")), 1)) : z("", !0),
1805
+ a("div", sr, [
1806
+ f(j, {
1807
+ modelValue: o(x),
1808
+ "onUpdate:modelValue": C[0] || (C[0] = (_) => lt(x) ? x.value = _ : null),
1809
+ placeholder: o(t)("connect.loyalty.dashboard.review.searchMemberId"),
1810
+ class: "col-span-2 md:col-span-1"
1811
+ }, null, 8, ["modelValue", "placeholder"]),
1812
+ f(ye, {
1813
+ modelValue: o(p),
1814
+ "onUpdate:modelValue": C[1] || (C[1] = (_) => lt(p) ? p.value = _ : null),
1815
+ items: o(Ue),
1816
+ label: o(t)("connect.loyalty.dashboard.review.signal"),
1817
+ class: "col-span-1"
1818
+ }, null, 8, ["modelValue", "items", "label"]),
1819
+ f(wt, {
1820
+ label: `${o(t)("connect.loyalty.dashboard.filters.location")}: `,
1821
+ "all-label": o(t)("connect.loyalty.dashboard.filters.all"),
1822
+ "selected-label": o(t)("connect.loyalty.dashboard.filters.selected"),
1823
+ "search-placeholder": o(t)("connect.loyalty.dashboard.filters.searchLocations"),
1824
+ icon: "storefront",
1825
+ "right-icon": "keyboard_arrow_down",
1826
+ "model-value": o(u),
1827
+ items: e.locations,
1828
+ "show-item-label": !0,
1829
+ class: "col-span-1",
1830
+ "onUpdate:modelValue": C[2] || (C[2] = (_) => u.value = _)
1831
+ }, null, 8, ["label", "all-label", "selected-label", "search-placeholder", "model-value", "items"]),
1832
+ (c(), N(it, {
1833
+ key: o(Oe),
1834
+ "model-value": o(w),
1835
+ "onUpdate:modelValue": Qe
1836
+ }, null, 8, ["model-value"]))
1837
+ ]),
1838
+ a("div", rr, [
1839
+ a("div", nr, [
1840
+ ge(r(o(t)("connect.loyalty.dashboard.review.members", o(oe))) + " ", 1),
1841
+ o(I) !== o(oe) ? (c(), d("span", lr, r(o(t)("connect.loyalty.dashboard.review.evidenceRows", o(I))), 1)) : z("", !0)
1842
+ ]),
1843
+ a("div", ir, [
1844
+ a("span", cr, r(o(t)("connect.loyalty.dashboard.review.sort")), 1),
1845
+ f(ye, {
1846
+ "model-value": o(h),
1847
+ items: o(ze),
1848
+ searchable: !1,
1849
+ "onUpdate:modelValue": C[3] || (C[3] = (_) => h.value = _)
1850
+ }, null, 8, ["model-value", "items"]),
1851
+ f(ye, {
1852
+ "model-value": o(R),
1853
+ items: ie,
1854
+ searchable: !1,
1855
+ "onUpdate:modelValue": tt
1856
+ }, null, 8, ["model-value"])
1857
+ ])
1858
+ ]),
1859
+ o(X) ? (c(), d("div", dr, [
1860
+ f(P, { size: "lg" })
1861
+ ])) : o(ke) ? (c(), d("div", mr, [
1862
+ f(me, {
1863
+ name: "error_outline",
1864
+ outline: "",
1865
+ size: "lg",
1866
+ class: "text-fm-color-typo-error"
1867
+ }),
1868
+ a("div", ur, r(o(t)("connect.loyalty.dashboard.review.findingsUnavailable")), 1),
1869
+ a("div", yr, r(o(t)("connect.loyalty.dashboard.review.findingsUnavailableDescription")), 1),
1870
+ f(J, {
1871
+ label: o(t)("connect.loyalty.dashboard.review.retry"),
1872
+ icon: "refresh",
1873
+ variant: "tertiary",
1874
+ onClick: C[4] || (C[4] = (_) => de(!0))
1875
+ }, null, 8, ["label"])
1876
+ ])) : o(V).length ? (c(), d("div", hr, [
1877
+ (c(!0), d(k, null, W(o(V), (_) => (c(), d("div", {
1878
+ key: ue(_),
1879
+ class: "border border-fm-color-neutral-gray-100 rounded-sm overflow-hidden"
1880
+ }, [
1881
+ a("div", vr, [
1882
+ a("button", {
1883
+ type: "button",
1884
+ class: "flex items-center gap-12 flex-1 min-w-0 text-left",
1885
+ "aria-expanded": o(A)[ue(_)] === !0,
1886
+ onClick: (D) => $e(_),
1887
+ onKeydown: [
1888
+ Ge(Je((D) => $e(_), ["prevent"]), ["enter"]),
1889
+ Ge(Je((D) => $e(_), ["prevent"]), ["space"])
1890
+ ]
1891
+ }, [
1892
+ f(me, {
1893
+ name: o(A)[ue(_)] ? "expand_less" : "expand_more",
1894
+ outline: "",
1895
+ size: "md",
1896
+ class: "text-fm-color-typo-tertiary"
1897
+ }, null, 8, ["name"]),
1898
+ f(Ke, {
1899
+ name: ve(_),
1900
+ size: "md"
1901
+ }, null, 8, ["name"]),
1902
+ a("div", _r, [
1903
+ a("div", xr, r(ve(_)), 1),
1904
+ a("div", wr, r(_.member.phoneNumber || _.member.cardNo || _.member.id || o(t)("connect.loyalty.dashboard.review.anonymousEvidence")), 1)
1905
+ ])
1906
+ ], 40, gr),
1907
+ a("div", Rr, [
1908
+ a("div", Sr, r(o(t)("connect.loyalty.dashboard.review.latestFlagged")), 1),
1909
+ a("div", Mr, r(ce(_.latestOccurredOn)), 1)
1910
+ ]),
1911
+ a("div", $r, [
1912
+ (c(!0), d(k, null, W(_.signals, (D) => (c(), d("span", {
1913
+ key: D,
1914
+ class: "fm-typo-en-body-sm-400 px-8 py-4 rounded-sm bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary"
1915
+ }, r(o(We)(D, i)), 1))), 128))
1916
+ ]),
1917
+ f(J, {
1918
+ label: o(t)("connect.loyalty.dashboard.review.viewMember"),
1919
+ icon: "person",
1920
+ variant: "tertiary",
1921
+ disabled: !_.member.id,
1922
+ onClick: (D) => at(_)
1923
+ }, null, 8, ["label", "disabled", "onClick"])
1924
+ ]),
1925
+ o(A)[ue(_)] ? (c(), d("div", Cr, [
1926
+ a("div", Fr, [
1927
+ a("div", null, [
1928
+ a("div", Dr, r(o(t)("connect.loyalty.dashboard.review.latestFlagged")), 1),
1929
+ a("div", Ar, r(ce(_.latestOccurredOn)), 1)
1930
+ ]),
1931
+ a("div", null, [
1932
+ a("div", kr, r(o(t)("connect.loyalty.dashboard.review.locations")), 1),
1933
+ a("div", Ir, r(_.locationIds.length ? _.locationIds.map(Ze).join(", ") : "--"), 1)
1934
+ ])
1935
+ ]),
1936
+ a("div", Lr, [
1937
+ (c(!0), d(k, null, W(_.findings, (D) => (c(), d("div", {
1938
+ key: `${D.signal}-${D.occurredOn}-${D.billIds.join("-")}-${D.referenceIds.join(
1939
+ "-"
1940
+ )}`,
1941
+ class: "border border-fm-color-neutral-gray-200 rounded-sm bg-fm-color-neutral-white p-12"
1942
+ }, [
1943
+ a("div", Or, [
1944
+ a("div", Er, r(o(We)(D.signal, i)), 1),
1945
+ a("div", Pr, r(ce(D.occurredOn)), 1)
1946
+ ]),
1947
+ a("div", Br, [
1948
+ a("div", Tr, [
1949
+ ge(r(o(t)("connect.loyalty.dashboard.review.observedValue")) + ": ", 1),
1950
+ a("span", Nr, r(D.observedValue.toLocaleString()), 1)
1951
+ ]),
1952
+ a("div", Ur, [
1953
+ ge(r(o(t)("connect.loyalty.dashboard.review.threshold")) + ": ", 1),
1954
+ a("span", zr, r(D.thresholdValue === null ? "--" : D.thresholdValue.toLocaleString()), 1)
1955
+ ]),
1956
+ a("div", Vr, [
1957
+ ge(r(o(t)("connect.loyalty.dashboard.review.rewardType")) + ": ", 1),
1958
+ a("span", jr, r(D.rewardType ? o(gt)(
1959
+ D.rewardType,
1960
+ i
1961
+ ) : "--"), 1)
1962
+ ]),
1963
+ a("div", Kr, [
1964
+ a("div", null, r(o(t)("connect.loyalty.dashboard.review.billIds")) + ": ", 1),
1965
+ D.billIds.length ? (c(), d("div", qr, [
1966
+ (c(!0), d(k, null, W(D.billIds, (B) => (c(), N(Ne, {
1967
+ key: B,
1968
+ content: o(t)("connect.loyalty.dashboard.review.copyBillId"),
1969
+ placement: "top"
1970
+ }, {
1971
+ default: U(() => [
1972
+ f(ot, {
1973
+ label: B,
1974
+ "aria-label": o(t)(
1975
+ "connect.loyalty.dashboard.review.copyBillIdAria",
1976
+ {
1977
+ id: B
1978
+ }
1979
+ ),
1980
+ "right-icon": "content_copy",
1981
+ variant: "plain",
1982
+ compact: "",
1983
+ class: "max-w-full cursor-pointer",
1984
+ onClick: (ae) => he(B)
1985
+ }, null, 8, ["label", "aria-label", "onClick"])
1986
+ ]),
1987
+ _: 2
1988
+ }, 1032, ["content"]))), 128))
1989
+ ])) : (c(), d("span", Yr, " -- "))
1990
+ ]),
1991
+ a("div", Hr, [
1992
+ ge(r(o(t)("connect.loyalty.dashboard.review.referenceIds")) + ": ", 1),
1993
+ a("span", Wr, r(fe(D.referenceIds)), 1)
1994
+ ])
1995
+ ])
1996
+ ]))), 128))
1997
+ ])
1998
+ ])) : z("", !0)
1999
+ ]))), 128))
2000
+ ])) : (c(), d("div", pr, [
2001
+ f(me, {
2002
+ name: "fact_check",
2003
+ outline: "",
2004
+ size: "lg",
2005
+ class: "text-fm-color-typo-tertiary"
2006
+ }),
2007
+ a("div", br, r(o(t)("connect.loyalty.dashboard.review.noFindings")), 1),
2008
+ a("div", fr, r(o(t)("connect.loyalty.dashboard.review.noFindingsDescription")), 1)
2009
+ ])),
2010
+ o(re) > 1 ? (c(), d("div", Gr, [
2011
+ a("div", Jr, r(o(t)("connect.loyalty.dashboard.review.page", {
2012
+ current: o(Ie),
2013
+ total: o(re)
2014
+ })), 1),
2015
+ a("div", Zr, [
2016
+ f(Ne, {
2017
+ content: o(t)("connect.loyalty.dashboard.accessibility.previousPage")
2018
+ }, {
2019
+ default: U(() => [
2020
+ f(J, {
2021
+ icon: "chevron_left",
2022
+ variant: "tertiary",
2023
+ disabled: o(g) === 0 || o(X),
2024
+ onClick: et
2025
+ }, null, 8, ["disabled"])
2026
+ ]),
2027
+ _: 1
2028
+ }, 8, ["content"]),
2029
+ f(Ne, {
2030
+ content: o(t)("connect.loyalty.dashboard.accessibility.nextPage")
2031
+ }, {
2032
+ default: U(() => [
2033
+ f(J, {
2034
+ icon: "chevron_right",
2035
+ variant: "tertiary",
2036
+ disabled: o(g) >= o(re) - 1 || o(X),
2037
+ onClick: je
2038
+ }, null, 8, ["disabled"])
2039
+ ]),
2040
+ _: 1
2041
+ }, 8, ["content"])
2042
+ ])
2043
+ ])) : z("", !0)
2044
+ ]),
2045
+ o(ee) ? (c(), N(Wt, {
2046
+ key: 0,
2047
+ ref_key: "detailSheetRef",
2048
+ ref: le,
2049
+ member: o(ee)
2050
+ }, null, 8, ["member"])) : z("", !0)
2051
+ ]),
2052
+ _: 1
2053
+ }, 8, ["modelValue", "header"]);
2054
+ };
2055
+ }
2056
+ }), Xr = { class: "flex items-start gap-12" }, en = { class: "flex-1 min-w-0" }, tn = { class: "flex items-center gap-8" }, an = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, on = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary mt-4" }, sn = ["aria-label"], rn = {
2057
+ key: 1,
2058
+ class: "flex min-h-[220px] items-center justify-center text-center fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
2059
+ }, nn = {
2060
+ key: 2,
2061
+ class: "mt-24"
2062
+ }, ln = { class: "grid grid-cols-2 gap-16" }, cn = { class: "border border-fm-color-neutral-gray-100 rounded-sm p-16" }, dn = { class: "fm-typo-en-title-lg-800 text-fm-color-typo-primary" }, mn = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mt-4" }, un = { class: "border border-fm-color-neutral-gray-100 rounded-sm p-16" }, yn = { class: "fm-typo-en-title-lg-800 text-fm-color-typo-primary" }, pn = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mt-4" }, bn = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary mt-16" }, fn = /* @__PURE__ */ Z({
2063
+ __name: "RewardAbuseMaximizers",
2064
+ props: {
2065
+ metric: {},
2066
+ loading: { type: Boolean },
2067
+ error: { type: Boolean }
2068
+ },
2069
+ setup(e) {
2070
+ const s = e, { t } = Q(), n = $(() => s.loading ? "loading" : s.error || !s.metric ? "unavailable" : s.metric.status === "insufficient-baseline" ? "insufficientBaseline" : s.metric.maximizerMembers === 0 ? "noMembers" : "available"), i = $(
2071
+ () => t(`connect.loyalty.dashboard.maximizers.status.${n.value}`)
2072
+ ), y = $(() => n.value === "unavailable" ? t("connect.loyalty.dashboard.maximizers.error") : n.value === "insufficientBaseline" ? t(
2073
+ "connect.loyalty.dashboard.maximizers.insufficientBaselineMessage"
2074
+ ) : n.value === "noMembers" ? t("connect.loyalty.dashboard.maximizers.noMembersMessage") : t("connect.loyalty.dashboard.maximizers.availableMessage")), p = $(() => n.value === "available" || n.value === "noMembers" ? "text-fm-color-typo-success bg-fm-color-system-success-100" : n.value === "insufficientBaseline" ? "text-fm-color-typo-warning bg-fm-color-system-warning-100" : "text-fm-color-typo-error bg-fm-color-system-error-100"), u = $(() => s.metric ? s.metric.maximizerMembers.toLocaleString() : ""), x = $(() => !s.metric || s.metric.thresholdPct === null ? t("connect.loyalty.dashboard.states.unavailable") : `${s.metric.thresholdPct}%`);
2075
+ return (w, R) => {
2076
+ const g = M("FmIcon"), h = M("FmTooltip"), V = M("FmCircularProgress"), oe = M("FmCard");
2077
+ return c(), N(oe, {
2078
+ variant: "outlined",
2079
+ class: "p-24 h-full"
2080
+ }, {
2081
+ default: U(() => [
2082
+ a("div", Xr, [
2083
+ a("div", en, [
2084
+ a("div", tn, [
2085
+ a("div", an, r(o(t)("connect.loyalty.dashboard.maximizers.title")), 1),
2086
+ f(h, {
2087
+ content: o(t)("connect.loyalty.dashboard.maximizers.tooltip")
2088
+ }, {
2089
+ default: U(() => [
2090
+ f(g, {
2091
+ name: "info",
2092
+ outline: "",
2093
+ size: "sm",
2094
+ class: "text-fm-color-typo-tertiary"
2095
+ })
2096
+ ]),
2097
+ _: 1
2098
+ }, 8, ["content"])
2099
+ ]),
2100
+ a("div", on, r(o(t)("connect.loyalty.dashboard.maximizers.subtitle")), 1)
2101
+ ]),
2102
+ a("span", {
2103
+ class: T(["fm-typo-en-body-sm-600 px-8 py-4 rounded-sm whitespace-nowrap", o(p)])
2104
+ }, r(o(i)), 3)
2105
+ ]),
2106
+ e.loading ? (c(), d("div", {
2107
+ key: 0,
2108
+ class: "flex min-h-[220px] items-center justify-center",
2109
+ role: "status",
2110
+ "aria-label": o(t)("connect.loyalty.dashboard.accessibility.loading")
2111
+ }, [
2112
+ f(V, { size: "lg" })
2113
+ ], 8, sn)) : o(n) === "unavailable" ? (c(), d("div", rn, r(o(y)), 1)) : (c(), d("div", nn, [
2114
+ a("div", ln, [
2115
+ a("div", cn, [
2116
+ a("div", dn, r(o(u)), 1),
2117
+ a("div", mn, r(o(t)("connect.loyalty.dashboard.maximizers.membersInCohort")), 1)
2118
+ ]),
2119
+ a("div", un, [
2120
+ a("div", yn, r(o(x)), 1),
2121
+ a("div", pn, r(o(t)("connect.loyalty.dashboard.maximizers.baselineRatio")), 1)
2122
+ ])
2123
+ ]),
2124
+ a("div", {
2125
+ class: T([
2126
+ "fm-typo-en-body-sm-400 mt-16 p-12 rounded-sm border",
2127
+ o(n) === "available" || o(n) === "noMembers" ? "text-fm-color-typo-secondary border-fm-color-neutral-gray-100 bg-fm-color-neutral-gray-100" : o(n) === "insufficientBaseline" ? "text-fm-color-typo-warning border-fm-color-system-warning-200 bg-fm-color-system-warning-100" : "text-fm-color-typo-error border-fm-color-system-error-200 bg-fm-color-system-error-100"
2128
+ ])
2129
+ }, r(o(y)), 3),
2130
+ a("div", bn, r(o(t)("connect.loyalty.dashboard.maximizers.experienceNote")), 1)
2131
+ ]))
2132
+ ]),
2133
+ _: 1
2134
+ });
2135
+ };
2136
+ }
2137
+ }), hn = { class: "mb-6 flex items-center gap-3 fm-typo-en-body-md-600" }, vn = ["aria-label"], gn = {
2138
+ key: 1,
2139
+ class: "flex min-h-[180px] items-center justify-center text-center fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
2140
+ }, _n = { class: "flex items-baseline gap-10 mb-14 flex-wrap" }, xn = { class: "fm-typo-en-title-lg-800" }, wn = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" }, Rn = { class: "flex items-center gap-14 mt-10" }, Sn = { class: "flex items-center gap-5" }, Mn = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, $n = { class: "flex items-center gap-5" }, Cn = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Fn = /* @__PURE__ */ Z({
2141
+ __name: "SalesTrendChart",
2142
+ props: {
2143
+ sales: {},
2144
+ loading: { type: Boolean },
2145
+ error: { type: Boolean }
2146
+ },
2147
+ setup(e) {
2148
+ const s = e, { t } = Q(), n = $(() => [
2149
+ {
2150
+ label: t("connect.loyalty.dashboard.salesTrend.thisPeriod"),
2151
+ data: s.sales.series,
2152
+ color: "#FF7823",
2153
+ fill: !0
2154
+ },
2155
+ {
2156
+ label: t("connect.loyalty.dashboard.salesTrend.previousPeriod"),
2157
+ data: s.sales.prevSeries,
2158
+ color: "#B2B3B6",
2159
+ dash: !0
2160
+ }
2161
+ ]), i = { display: !1 };
2162
+ return (y, p) => {
2163
+ const u = M("FmCircularProgress"), x = M("FmLineChart"), w = M("FmCard");
2164
+ return c(), N(w, {
2165
+ variant: "outlined",
2166
+ class: "p-24"
2167
+ }, {
2168
+ default: U(() => [
2169
+ a("div", hn, [
2170
+ a("span", null, r(o(t)("connect.loyalty.dashboard.salesTrend.title")), 1),
2171
+ f(xe, {
2172
+ description: s.sales.description
2173
+ }, null, 8, ["description"])
2174
+ ]),
2175
+ s.loading ? (c(), d("div", {
2176
+ key: 0,
2177
+ class: "flex min-h-[180px] items-center justify-center",
2178
+ role: "status",
2179
+ "aria-label": o(t)("connect.loyalty.dashboard.accessibility.loading")
2180
+ }, [
2181
+ f(u, { size: "lg" })
2182
+ ], 8, vn)) : s.error ? (c(), d("div", gn, r(o(t)("connect.loyalty.dashboard.states.salesTrendUnavailable")), 1)) : (c(), d(k, { key: 2 }, [
2183
+ a("div", _n, [
2184
+ a("span", xn, r(s.sales.totalFmt), 1),
2185
+ a("span", {
2186
+ class: T(["fm-typo-en-body-sm-600 px-9 py-3 rounded-full whitespace-nowrap", s.sales.deltaClass])
2187
+ }, r(s.sales.deltaStr), 3),
2188
+ a("span", wn, r(o(t)("connect.loyalty.dashboard.salesTrend.vsPreviousPeriod")), 1)
2189
+ ]),
2190
+ f(x, {
2191
+ datasets: o(n),
2192
+ "x-axis": { categories: s.sales.comparisonCategories },
2193
+ "x-cfg": i,
2194
+ "y-cfg": i,
2195
+ legend: { display: !1 },
2196
+ height: "80px"
2197
+ }, null, 8, ["datasets", "x-axis"]),
2198
+ a("div", Rn, [
2199
+ a("div", Sn, [
2200
+ p[0] || (p[0] = a("div", { class: "w-14 h-2 bg-fm-color-primary rounded-1" }, null, -1)),
2201
+ a("span", Mn, r(o(t)("connect.loyalty.dashboard.salesTrend.thisPeriod")), 1)
2202
+ ]),
2203
+ a("div", $n, [
2204
+ p[1] || (p[1] = a("div", { class: "w-14 border-t-[1.5px] border-dashed border-fm-color-neutral-gray-200" }, null, -1)),
2205
+ a("span", Cn, r(o(t)("connect.loyalty.dashboard.salesTrend.previousPeriod")), 1)
2206
+ ])
2207
+ ])
2208
+ ], 64))
2209
+ ]),
2210
+ _: 1
2211
+ });
2212
+ };
2213
+ }
2214
+ }), Dn = /* @__PURE__ */ Z({
2215
+ __name: "ComparisonMethodChip",
2216
+ props: {
2217
+ modelValue: {}
2218
+ },
2219
+ emits: ["update:model-value"],
2220
+ setup(e, { emit: s }) {
2221
+ const t = e, n = s, { t: i } = Q(), y = S(!1), p = {
2222
+ "same-period-last-week": "samePeriodLastWeek",
2223
+ "same-period-last-month": "samePeriodLastMonth",
2224
+ "preceding-period": "precedingPeriod",
2225
+ "same-period-last-year": "samePeriodLastYear",
2226
+ custom: "custom"
2227
+ }, u = $(
2228
+ () => ms.map((R) => ({
2229
+ value: R,
2230
+ label: i(
2231
+ `connect.loyalty.dashboard.filters.comparisonModes.${p[R]}`
2232
+ ),
2233
+ sublabel: R === "same-period-last-week" || R === "same-period-last-month" ? i(
2234
+ `connect.loyalty.dashboard.filters.comparisonModeDescriptions.${p[R]}`
2235
+ ) : void 0
2236
+ }))
2237
+ ), x = $(
2238
+ () => {
2239
+ var R;
2240
+ return (R = u.value.find((g) => g.value === t.modelValue)) == null ? void 0 : R.label;
2241
+ }
2242
+ );
2243
+ function w(R) {
2244
+ n("update:model-value", R), y.value = !1;
2245
+ }
2246
+ return (R, g) => {
2247
+ const h = M("FmChip"), V = M("FmMenuItem"), oe = M("FmMenu");
2248
+ return c(), N(oe, {
2249
+ placement: "bottom-end",
2250
+ "model-value": y.value,
2251
+ onMenuChanged: g[0] || (g[0] = (I) => y.value = I)
2252
+ }, {
2253
+ "menu-button": U(() => [
2254
+ f(h, {
2255
+ label: `${o(i)(
2256
+ "connect.loyalty.dashboard.filters.comparisonMethod"
2257
+ )}: ${x.value}`,
2258
+ icon: "compare_arrows",
2259
+ "right-icon": y.value ? "keyboard_arrow_up" : "keyboard_arrow_down",
2260
+ class: "text-fm-color-neutral-gray-400 cursor-pointer"
2261
+ }, null, 8, ["label", "right-icon"])
2262
+ ]),
2263
+ default: U(() => [
2264
+ (c(!0), d(k, null, W(u.value, (I) => (c(), N(V, {
2265
+ key: I.value,
2266
+ label: I.label,
2267
+ sublabel: I.sublabel,
2268
+ "model-value": I.value === t.modelValue,
2269
+ onClick: (X) => w(I.value)
2270
+ }, null, 8, ["label", "sublabel", "model-value", "onClick"]))), 128))
2271
+ ]),
2272
+ _: 1
2273
+ }, 8, ["model-value"]);
2274
+ };
2275
+ }
2276
+ }), An = { class: "flex items-center gap-8" }, kn = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2" }, In = { class: "px-24 flex flex-col gap-16 pb-24" }, Ln = { key: 1 }, On = { class: "flex items-center justify-between gap-8 flex-wrap" }, En = { class: "flex items-center gap-8 flex-wrap" }, Pn = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-tertiary" }, Bn = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary -mt-8 text-right" }, Tn = { class: "grid grid-cols-[3fr_2fr] xs:grid-cols-1 gap-16 items-start" }, Nn = { class: "grid grid-cols-2 xs:grid-cols-1 gap-16 items-start" }, Un = { class: "flex flex-col gap-16" }, zn = { class: "flex flex-col gap-16" }, ll = /* @__PURE__ */ Z({
2277
+ __name: "LoyaltyDashboard",
2278
+ setup(e) {
2279
+ const { t: s, locale: t } = Q(), n = aa(), i = $(
2280
+ () => n.catalog && n.state ? oa(n.catalog, n.state) : null
2281
+ ), y = $(() => i.value === "goals" ? "goals" : "generic"), p = $(
2282
+ () => {
2283
+ var l;
2284
+ return i.value === "picker" || i.value === "generic" && ((l = n.state) == null ? void 0 : l.generic) === "active" || !!i.value && n.doneCount(y.value) < n.ids(y.value).length;
2285
+ }
2286
+ ), u = $(() => {
2287
+ var l;
2288
+ return !!((l = n.state) != null && l.analyticDismissed);
2289
+ }), x = $(() => p.value && u.value);
2290
+ async function w() {
2291
+ try {
2292
+ await n.patch({ analyticDismissed: !0 });
2293
+ } catch {
2294
+ ht.error(s("connect.onboarding.save_error"), 3e3);
2295
+ }
2296
+ }
2297
+ async function R() {
2298
+ try {
2299
+ await n.patch({ analyticDismissed: !1 });
2300
+ } catch {
2301
+ ht.error(s("connect.onboarding.save_error"), 3e3);
2302
+ }
2303
+ }
2304
+ const g = (l, b) => typeof b == "number" ? s(l, b) : b === void 0 ? s(l) : s(l, b), h = Qt(), V = Xt(), { global: oe } = Zt, I = $(
2305
+ () => vt[V.currentCountry.value || "MY"] ?? vt.MY
2306
+ ), X = $(
2307
+ () => Kt.Country.getCountry(V.currentCountry.value || "MY").currency.code
2308
+ ), [ke, be] = is(
2309
+ "this-month",
2310
+ I.value
2311
+ ), A = S({
2312
+ startDate: ke,
2313
+ endDate: be
2314
+ }), ee = S(
2315
+ us
2316
+ ), le = S({
2317
+ startDate: void 0,
2318
+ endDate: void 0
2319
+ }), G = $({
2320
+ get: () => {
2321
+ if (!A.value.startDate || !A.value.endDate)
2322
+ return { ...le.value };
2323
+ const l = le.value.startDate && le.value.endDate ? [
2324
+ le.value.startDate,
2325
+ le.value.endDate
2326
+ ] : void 0;
2327
+ return Ze(
2328
+ ys(
2329
+ [A.value.startDate, A.value.endDate],
2330
+ ee.value,
2331
+ I.value,
2332
+ l
2333
+ )
2334
+ );
2335
+ },
2336
+ set: (l) => {
2337
+ ee.value === "custom" && (le.value = { ...l });
2338
+ }
2339
+ }), te = S({ location: [] }), se = S(h.locations.length > 0), Ue = S(!1), ze = S(0), ie = S({}), re = S(null), Ie = S(null), Le = S(null), Oe = S(
2340
+ null
2341
+ ), we = S(null), Ee = S([]), Pe = S(!1), Be = S(!1), L = Ut({
2342
+ totalMembers: { loading: !1, error: !1 },
2343
+ activeMembers: { loading: !1, error: !1 },
2344
+ memberSales: { loading: !1, error: !1 },
2345
+ repeatRate: { loading: !1, error: !1 },
2346
+ voucherRedemptionRate: { loading: !1, error: !1 },
2347
+ memberFunnel: { loading: !1, error: !1 },
2348
+ memberLifecycle: { loading: !1, error: !1 },
2349
+ memberSalesTrend: { loading: !1, error: !1 },
2350
+ memberSpendComparison: { loading: !1, error: !1 },
2351
+ rewardUsageHealth: { loading: !1, error: !1 }
2352
+ }), Re = S({
2353
+ outlier: { loading: !1, error: !1 },
2354
+ maximizers: { loading: !1, error: !1 }
2355
+ }), ce = S(null), fe = S(!1), he = S(!1), ve = S(null), Se = S(null), Me = S(!1);
2356
+ function Ze([l, b]) {
2357
+ return { startDate: l, endDate: b };
2358
+ }
2359
+ const ue = $(
2360
+ () => vs(
2361
+ re.value ?? {
2362
+ totalMembers: 0,
2363
+ activeMembers: 0,
2364
+ purchasingMembers: 0,
2365
+ repeatMembers: 0,
2366
+ rewardRedeemers: 0
2367
+ },
2368
+ g
2369
+ )
2370
+ ), $e = $(
2371
+ () => As(
2372
+ Ie.value ?? {
2373
+ totalMembers: 0,
2374
+ newlyJoined: 0,
2375
+ frequent: 0,
2376
+ infrequent: 0,
2377
+ atRisk: 0,
2378
+ dormant: 0
2379
+ },
2380
+ g
2381
+ )
2382
+ ), Qe = $(
2383
+ () => $s(
2384
+ Le.value ?? {
2385
+ categories: [""],
2386
+ prevCategories: [""],
2387
+ series: [0],
2388
+ prevSeries: [0],
2389
+ memberSales: 0,
2390
+ deltaPct: 0
2391
+ },
2392
+ X.value,
2393
+ g
2394
+ )
2395
+ ), Ve = $(
2396
+ () => re.value ? _s(re.value, g) : null
2397
+ ), Te = $(
2398
+ () => we.value ? Ls(
2399
+ we.value,
2400
+ X.value,
2401
+ g
2402
+ ) : null
2403
+ ), de = $(
2404
+ () => Fs(
2405
+ Oe.value ?? {
2406
+ memberSales: 0,
2407
+ memberOrders: 0,
2408
+ nonMemberSales: 0,
2409
+ nonMemberOrders: 0
2410
+ },
2411
+ X.value,
2412
+ g
2413
+ )
2414
+ ), Xe = $(
2415
+ () => Ms(
2416
+ Ee.value,
2417
+ te.value.location,
2418
+ g
2419
+ )
2420
+ ), je = $(
2421
+ () => ls(
2422
+ ce.value,
2423
+ {
2424
+ loading: fe.value,
2425
+ error: he.value
2426
+ },
2427
+ g
2428
+ )
2429
+ );
2430
+ function et(l) {
2431
+ const b = l.status === "loading" ? "loading" : l.status === "unavailable" ? "unavailable" : l.status === "empty" ? "empty" : l.status === "partial" ? "partial" : l.status === "stale" ? "stale" : "available";
2432
+ return s(`connect.loyalty.dashboard.review.kpiStatuses.${b}`);
2433
+ }
2434
+ function tt(l) {
2435
+ return l.status === "empty" ? "text-fm-color-typo-success" : l.status === "available" || l.status === "partial" || l.status === "stale" ? "text-fm-color-typo-warning" : "text-fm-color-typo-tertiary";
2436
+ }
2437
+ const at = $(() => {
2438
+ const l = ie.value, b = je.value, F = b.flaggedMembers !== null && b.flaggedMembers > 0 && ["available", "partial", "stale"].includes(b.status), O = (E, pe, Fe, Lt, ft, Ot, Et) => ({
2439
+ label: s(pe),
2440
+ value: ft === void 0 ? "" : Ot(ft),
2441
+ description: s(Fe),
2442
+ icon: Lt,
2443
+ delta: Et,
2444
+ sub: null,
2445
+ deltaClass: "text-fm-color-typo-secondary",
2446
+ trendUp: !0,
2447
+ loading: L[E].loading,
2448
+ error: L[E].error
2449
+ });
2450
+ return [
2451
+ O(
2452
+ "totalMembers",
2453
+ "connect.loyalty.dashboard.kpis.totalMembers.label",
2454
+ "connect.loyalty.dashboard.kpis.totalMembers.description",
2455
+ "group",
2456
+ l.totalMembers,
2457
+ J,
2458
+ "0%"
2459
+ ),
2460
+ O(
2461
+ "activeMembers",
2462
+ "connect.loyalty.dashboard.kpis.activeMembers.label",
2463
+ "connect.loyalty.dashboard.kpis.activeMembers.description",
2464
+ "bolt",
2465
+ l.activeMembers,
2466
+ J,
2467
+ "0%"
2468
+ ),
2469
+ O(
2470
+ "memberSales",
2471
+ "connect.loyalty.dashboard.kpis.memberSales.label",
2472
+ "connect.loyalty.dashboard.kpis.memberSales.description",
2473
+ "payments",
2474
+ l.memberSales,
2475
+ (E) => _e(E, X.value),
2476
+ "0%"
2477
+ ),
2478
+ O(
2479
+ "repeatRate",
2480
+ "connect.loyalty.dashboard.kpis.repeatRate.label",
2481
+ "connect.loyalty.dashboard.kpis.repeatRate.description",
2482
+ "repeat",
2483
+ l.repeatRatePct,
2484
+ Ke,
2485
+ "0pp"
2486
+ ),
2487
+ O(
2488
+ "voucherRedemptionRate",
2489
+ "connect.loyalty.dashboard.kpis.voucherRedemptionRate.label",
2490
+ "connect.loyalty.dashboard.kpis.voucherRedemptionRate.description",
2491
+ "redeem",
2492
+ l.voucherRedemptionRatePct,
2493
+ Ke,
2494
+ "0pp"
2495
+ ),
2496
+ {
2497
+ label: s("connect.loyalty.dashboard.kpis.flaggedForReview.label"),
2498
+ value: b.flaggedMembers === null ? "" : J(b.flaggedMembers),
2499
+ description: s(
2500
+ "connect.loyalty.dashboard.kpis.flaggedForReview.description"
2501
+ ),
2502
+ icon: "fact_check",
2503
+ delta: "",
2504
+ sub: et(b),
2505
+ subClass: tt(b),
2506
+ interactive: F,
2507
+ actionLabel: s("connect.loyalty.dashboard.review.action"),
2508
+ deltaClass: "text-fm-color-typo-secondary",
2509
+ trendUp: !0,
2510
+ loading: fe.value,
2511
+ error: he.value || b.status === "unavailable"
2512
+ }
2513
+ ].map((E) => ({ ...E, sub: E.sub ?? null }));
2514
+ }), m = $(
2515
+ () => h.locations.map((l) => l._id.toString())
2516
+ ), C = $(
2517
+ () => h.locations.map((l) => ({
2518
+ label: `${l.code ? `${l.code} - ` : ""}${l.name}`,
2519
+ value: l._id.toString()
2520
+ }))
2521
+ ), P = $(
2522
+ () => !A.value.startDate || !A.value.endDate || !se.value ? null : os({
2523
+ dateRange: [A.value.startDate, A.value.endDate],
2524
+ businessRestaurantIds: m.value,
2525
+ selectedRestaurantIds: te.value.location,
2526
+ timezone: I.value
2527
+ })
2528
+ );
2529
+ function j(l) {
2530
+ if (!l.startDate || !l.endDate) return "";
2531
+ const b = (F, O) => new Intl.DateTimeFormat(t.value, {
2532
+ day: "numeric",
2533
+ month: "short",
2534
+ year: O ? "numeric" : void 0,
2535
+ timeZone: I.value
2536
+ }).format(De.tz(F, I.value).toDate());
2537
+ return `${b(l.startDate, !1)} – ${b(l.endDate, !0)}`;
2538
+ }
2539
+ const ye = $(() => j(A.value)), me = $(
2540
+ () => j(G.value)
2541
+ );
2542
+ function J(l) {
2543
+ return l >= 1e3 ? `${(l / 1e3).toFixed(1).replace(/\.0$/, "")}k` : String(l);
2544
+ }
2545
+ function Ke(l) {
2546
+ return `${Math.round(l * 10) / 10}%`;
2547
+ }
2548
+ function ot(l) {
2549
+ A.value = l;
2550
+ }
2551
+ function Ne(l) {
2552
+ ee.value = l;
2553
+ }
2554
+ function st(l) {
2555
+ G.value = l;
2556
+ }
2557
+ function _(l) {
2558
+ if (l && typeof l == "object" && "value" in l && Number.isFinite(Number(l.value)))
2559
+ return Number(l.value);
2560
+ }
2561
+ function D() {
2562
+ return !A.value.startDate || !A.value.endDate || !G.value.startDate || !G.value.endDate || !se.value ? null : ds({
2563
+ dateRange: [A.value.startDate, A.value.endDate],
2564
+ compareDateRange: [
2565
+ G.value.startDate,
2566
+ G.value.endDate
2567
+ ],
2568
+ selectedLocationIds: te.value.location,
2569
+ locationIds: m.value,
2570
+ timezone: I.value
2571
+ });
2572
+ }
2573
+ function B(l) {
2574
+ return l === ze.value;
2575
+ }
2576
+ function ae(l, b, F, O, Ce) {
2577
+ const E = L[l];
2578
+ E.loading = !0, E.error = !1, Promise.resolve().then(() => b(F)).then((pe) => {
2579
+ B(O) && Ce(pe);
2580
+ }).catch(() => {
2581
+ B(O) && (E.error = !0);
2582
+ }).finally(() => {
2583
+ B(O) && (E.loading = !1);
2584
+ });
2585
+ }
2586
+ function St(l, b) {
2587
+ ae(
2588
+ "totalMembers",
2589
+ H.readTotalMembers,
2590
+ l,
2591
+ b,
2592
+ (F) => {
2593
+ const O = _(F);
2594
+ if (O === void 0)
2595
+ throw new Error("Invalid total member metric");
2596
+ ie.value.totalMembers = O;
2597
+ }
2598
+ ), ae(
2599
+ "activeMembers",
2600
+ H.readActiveMembers,
2601
+ l,
2602
+ b,
2603
+ (F) => {
2604
+ ie.value.activeMembers = F.activeMembers;
2605
+ }
2606
+ ), ae(
2607
+ "memberSales",
2608
+ H.readMemberSales,
2609
+ l,
2610
+ b,
2611
+ (F) => {
2612
+ ie.value.memberSales = F.memberSales;
2613
+ }
2614
+ ), ae(
2615
+ "repeatRate",
2616
+ H.readRepeatRate,
2617
+ l,
2618
+ b,
2619
+ (F) => {
2620
+ ie.value.repeatRatePct = F.repeatRatePct;
2621
+ }
2622
+ ), ae(
2623
+ "voucherRedemptionRate",
2624
+ H.readVoucherRedemptionRate,
2625
+ l,
2626
+ b,
2627
+ (F) => {
2628
+ ie.value.voucherRedemptionRatePct = F.voucherRedemptionRatePct;
2629
+ }
2630
+ );
2631
+ }
2632
+ function Mt(l, b) {
2633
+ ae(
2634
+ "memberFunnel",
2635
+ H.readMemberFunnel,
2636
+ l,
2637
+ b,
2638
+ (F) => {
2639
+ re.value = F;
2640
+ }
2641
+ );
2642
+ }
2643
+ function $t(l, b) {
2644
+ ae(
2645
+ "memberLifecycle",
2646
+ H.readMemberLifecycle,
2647
+ l,
2648
+ b,
2649
+ (F) => {
2650
+ Ie.value = F;
2651
+ }
2652
+ );
2653
+ }
2654
+ function Ct(l, b) {
2655
+ ae(
2656
+ "memberSalesTrend",
2657
+ H.readMemberSalesTrend,
2658
+ l,
2659
+ b,
2660
+ (F) => {
2661
+ Le.value = F;
2662
+ }
2663
+ );
2664
+ }
2665
+ function Ft(l, b) {
2666
+ ae(
2667
+ "memberSpendComparison",
2668
+ H.readMemberSpendComparison,
2669
+ l,
2670
+ b,
2671
+ (F) => {
2672
+ Oe.value = F;
2673
+ }
2674
+ );
2675
+ }
2676
+ function Dt(l, b) {
2677
+ ae(
2678
+ "rewardUsageHealth",
2679
+ H.readRewardUsageHealth,
2680
+ l,
2681
+ b,
2682
+ (F) => {
2683
+ we.value = F;
2684
+ }
2685
+ );
2686
+ }
2687
+ function yt() {
2688
+ ce.value = null, fe.value = !1, he.value = !1, ve.value = null, Se.value = null, Object.values(Re.value).forEach((l) => {
2689
+ l.loading = !1, l.error = !1;
2690
+ });
2691
+ }
2692
+ function pt(l, b, F, O, Ce) {
2693
+ const E = Re.value[l];
2694
+ E.loading = !0, E.error = !1, b(F).then((pe) => {
2695
+ B(O) && Ce(pe);
2696
+ }).catch(() => {
2697
+ B(O) && (E.error = !0);
2698
+ }).finally(() => {
2699
+ B(O) && (E.loading = !1);
2700
+ });
2701
+ }
2702
+ function At(l, b) {
2703
+ ce.value = null, fe.value = !0, he.value = !1, ve.value = null, Se.value = null, pt(
2704
+ "outlier",
2705
+ H.readRewardEarningOutliers,
2706
+ l,
2707
+ b,
2708
+ (F) => {
2709
+ ve.value = F;
2710
+ }
2711
+ ), pt(
2712
+ "maximizers",
2713
+ H.readRewardMaximizers,
2714
+ l,
2715
+ b,
2716
+ (F) => {
2717
+ Se.value = F;
2718
+ }
2719
+ ), H.readRewardAbuseSummary(l).then((F) => {
2720
+ B(b) && (ce.value = F);
2721
+ }).catch(() => {
2722
+ B(b) && (he.value = !0);
2723
+ }).finally(() => {
2724
+ B(b) && (fe.value = !1);
2725
+ });
2726
+ }
2727
+ async function kt() {
2728
+ Pe.value = !0, Be.value = !1;
2729
+ try {
2730
+ const { resources: l } = await qt.readAll({
2731
+ limit: 1e3,
2732
+ skip: 0,
2733
+ sortBy: "_id",
2734
+ descending: !0
2735
+ });
2736
+ Ee.value = l;
2737
+ } catch (l) {
2738
+ throw Be.value = !0, l;
2739
+ } finally {
2740
+ Pe.value = !1;
2741
+ }
2742
+ }
2743
+ function It() {
2744
+ ie.value = {}, re.value = null, Ie.value = null, Le.value = null, Oe.value = null, we.value = null, Object.values(L).forEach((l) => {
2745
+ l.loading = !1, l.error = !1;
2746
+ });
2747
+ }
2748
+ function bt() {
2749
+ const l = ++ze.value;
2750
+ It();
2751
+ const b = D();
2752
+ if (!b) {
2753
+ yt();
2754
+ return;
2755
+ }
2756
+ P.value ? At(P.value, l) : yt(), St(b, l), Mt(b, l), $t(b, l), Ct(b, l), Ft(b, l), Dt(b, l);
2757
+ }
2758
+ return Ye(
2759
+ [A, G, ee, () => te.value.location],
2760
+ () => {
2761
+ Ue.value && bt();
2762
+ }
2763
+ ), zt(async () => {
2764
+ n.read(t.value), await oe(async () => {
2765
+ se.value || await h.readLocations(), se.value = !0;
2766
+ }), await xt(), Ue.value = !0, bt(), kt().catch(() => {
2767
+ Ee.value = [];
2768
+ });
2769
+ }), (l, b) => {
2770
+ var E, pe;
2771
+ const F = M("FmPill"), O = M("FmPageHead"), Ce = M("FmButton");
2772
+ return c(), d(k, null, [
2773
+ f(O, {
2774
+ title: o(s)("connect.loyalty.dashboard.title")
2775
+ }, {
2776
+ title: U(() => [
2777
+ a("div", An, [
2778
+ a("span", kn, r(o(s)("connect.loyalty.dashboard.title")), 1),
2779
+ f(F, { variant: "beta" })
2780
+ ])
2781
+ ]),
2782
+ _: 1
2783
+ }, 8, ["title"]),
2784
+ a("div", In, [
2785
+ o(p) && !o(u) ? (c(), d(k, { key: 0 }, [
2786
+ o(i) === "picker" ? (c(), N(ea, {
2787
+ key: 0,
2788
+ updating: !1,
2789
+ dismissible: "",
2790
+ onDismiss: w
2791
+ })) : (c(), N(ta, {
2792
+ key: 1,
2793
+ mode: o(y),
2794
+ placement: "analytic"
2795
+ }, null, 8, ["mode"]))
2796
+ ], 64)) : o(x) ? (c(), d("div", Ln, [
2797
+ f(Ce, {
2798
+ variant: "secondary",
2799
+ "prepend-icon": "checklist",
2800
+ label: o(s)("connect.onboarding.show_list"),
2801
+ onClick: R
2802
+ }, null, 8, ["label"])
2803
+ ])) : z("", !0),
2804
+ a("div", On, [
2805
+ f(wt, {
2806
+ label: `${o(s)("connect.loyalty.dashboard.filters.location")}: `,
2807
+ "all-label": o(s)("connect.loyalty.dashboard.filters.all"),
2808
+ "selected-label": o(s)("connect.loyalty.dashboard.filters.selected"),
2809
+ "search-placeholder": o(s)("connect.loyalty.dashboard.filters.searchLocations"),
2810
+ "right-icon": "keyboard_arrow_down",
2811
+ modelValue: o(te).location,
2812
+ "onUpdate:modelValue": b[0] || (b[0] = (Fe) => o(te).location = Fe),
2813
+ icon: "storefront",
2814
+ "show-item-label": !0,
2815
+ items: o(h).locationOptions
2816
+ }, null, 8, ["label", "all-label", "selected-label", "search-placeholder", "modelValue", "items"]),
2817
+ a("div", En, [
2818
+ f(it, {
2819
+ "model-value": o(A),
2820
+ "onUpdate:modelValue": ot
2821
+ }, null, 8, ["model-value"]),
2822
+ a("span", Pn, r(o(s)("connect.loyalty.dashboard.filters.comparisonSeparator")), 1),
2823
+ f(Dn, {
2824
+ "model-value": o(ee),
2825
+ "onUpdate:modelValue": Ne
2826
+ }, null, 8, ["model-value"]),
2827
+ f(it, {
2828
+ "model-value": o(G),
2829
+ readonly: o(ee) !== "custom",
2830
+ "onUpdate:modelValue": st
2831
+ }, null, 8, ["model-value", "readonly"])
2832
+ ])
2833
+ ]),
2834
+ a("div", Bn, r(o(s)("connect.loyalty.dashboard.filters.rangeSummary", {
2835
+ current: o(ye),
2836
+ comparison: o(me)
2837
+ })), 1),
2838
+ f(Va, {
2839
+ kpis: o(at),
2840
+ onSelect: b[1] || (b[1] = (Fe) => Me.value = !0)
2841
+ }, null, 8, ["kpis"]),
2842
+ a("section", Tn, [
2843
+ f(xo, {
2844
+ stages: o(ue).funnelStages,
2845
+ footnote: o(ue).funnelFootnote,
2846
+ interactive: !1,
2847
+ loading: o(L).memberFunnel.loading,
2848
+ error: o(L).memberFunnel.error
2849
+ }, null, 8, ["stages", "footnote", "loading", "error"]),
2850
+ f(Aa, {
2851
+ insight: o(Ve),
2852
+ loading: o(L).memberFunnel.loading,
2853
+ error: o(L).memberFunnel.error
2854
+ }, null, 8, ["insight", "loading", "error"])
2855
+ ]),
2856
+ a("section", Nn, [
2857
+ a("div", Un, [
2858
+ f(Xa, {
2859
+ segments: o($e).lifecycleSegs,
2860
+ summary: o($e).lifecycleSummary,
2861
+ interactive: !1,
2862
+ loading: o(L).memberLifecycle.loading,
2863
+ error: o(L).memberLifecycle.error
2864
+ }, null, 8, ["segments", "summary", "loading", "error"]),
2865
+ f(Bo, {
2866
+ spend: o(de),
2867
+ loading: o(L).memberSpendComparison.loading,
2868
+ error: o(L).memberSpendComparison.error
2869
+ }, null, 8, ["spend", "loading", "error"]),
2870
+ f(fn, {
2871
+ metric: o(Se),
2872
+ loading: o(Re).maximizers.loading,
2873
+ error: o(Re).maximizers.error
2874
+ }, null, 8, ["metric", "loading", "error"])
2875
+ ]),
2876
+ a("div", zn, [
2877
+ f(Fn, {
2878
+ sales: o(Qe),
2879
+ loading: o(L).memberSalesTrend.loading,
2880
+ error: o(L).memberSalesTrend.error
2881
+ }, null, 8, ["sales", "loading", "error"]),
2882
+ f(Zo, {
2883
+ kpis: ((E = o(Te)) == null ? void 0 : E.rewardKpis) ?? [],
2884
+ "top-rewards": ((pe = o(Te)) == null ? void 0 : pe.topRewards) ?? [],
2885
+ "has-data": !!o(Te),
2886
+ loading: o(L).rewardUsageHealth.loading,
2887
+ error: o(L).rewardUsageHealth.error
2888
+ }, null, 8, ["kpis", "top-rewards", "has-data", "loading", "error"]),
2889
+ f(fa, {
2890
+ campaigns: o(Xe),
2891
+ loading: o(Pe),
2892
+ error: o(Be)
2893
+ }, null, 8, ["campaigns", "loading", "error"])
2894
+ ])
2895
+ ]),
2896
+ f(Qr, {
2897
+ modelValue: o(Me),
2898
+ "onUpdate:modelValue": b[2] || (b[2] = (Fe) => lt(Me) ? Me.value = Fe : null),
2899
+ summary: o(je),
2900
+ "outlier-metric": o(ve),
2901
+ payload: o(P),
2902
+ locations: o(C)
2903
+ }, null, 8, ["modelValue", "summary", "outlier-metric", "payload", "locations"])
2904
+ ])
2905
+ ], 64);
2906
+ };
2907
+ }
2908
+ });
2909
+ export {
2910
+ ll as default
2911
+ };