@feedmepos/mf-connect 0.1.98-beta.7 → 0.1.98-beta.71

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