@mx-cartographer/experiences 9.7.77 → 9.7.79

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 (57) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/core/stores/GlobalCopyStore.d.ts +6 -0
  3. package/dist/core/stores/GlobalCopyStore.es.js +14 -8
  4. package/dist/core/stores/GlobalCopyStore.es.js.map +1 -1
  5. package/dist/core/types/localization/InsightsFeedCopy.d.ts +24 -0
  6. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.es.js +1 -1
  7. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.es.js.map +1 -1
  8. package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.d.ts +6 -0
  9. package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js +161 -0
  10. package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js.map +1 -0
  11. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/IconComponent.es.js +20 -20
  12. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/IconComponent.es.js.map +1 -1
  13. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.d.ts +2 -2
  14. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js +1 -1
  15. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js.map +1 -1
  16. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +89 -60
  17. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
  18. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.d.ts +7 -1
  19. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js +11 -6
  20. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js.map +1 -1
  21. package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js +5 -5
  22. package/dist/insights-v2/components/BaseLayout.es.js +106 -105
  23. package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
  24. package/dist/insights-v2/components/CtaStatus.d.ts +5 -1
  25. package/dist/insights-v2/components/CtaStatus.es.js +25 -22
  26. package/dist/insights-v2/components/CtaStatus.es.js.map +1 -1
  27. package/dist/insights-v2/components/SaveAnExtraCard.es.js +5 -4
  28. package/dist/insights-v2/components/SaveAnExtraCard.es.js.map +1 -1
  29. package/dist/insights-v2/components/StatusMessageCard.d.ts +8 -3
  30. package/dist/insights-v2/components/StatusMessageCard.es.js +16 -15
  31. package/dist/insights-v2/components/StatusMessageCard.es.js.map +1 -1
  32. package/dist/insights-v2/components/TransactionListCard.d.ts +5 -1
  33. package/dist/insights-v2/components/TransactionListCard.es.js +61 -45
  34. package/dist/insights-v2/components/TransactionListCard.es.js.map +1 -1
  35. package/dist/insights-v2/ctaActions/ctaConfig.es.js +35 -14
  36. package/dist/insights-v2/ctaActions/ctaConfig.es.js.map +1 -1
  37. package/dist/insights-v2/ctaActions/subscriptionAnswer.d.ts +9 -1
  38. package/dist/insights-v2/ctaActions/subscriptionAnswer.es.js +62 -57
  39. package/dist/insights-v2/ctaActions/subscriptionAnswer.es.js.map +1 -1
  40. package/dist/insights-v2/ctaActions/types.d.ts +10 -2
  41. package/dist/insights-v2/ctaActions/useCtaAction.d.ts +5 -2
  42. package/dist/insights-v2/ctaActions/useCtaAction.es.js +45 -37
  43. package/dist/insights-v2/ctaActions/useCtaAction.es.js.map +1 -1
  44. package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
  45. package/dist/insights-v2/mappings/actionBlocksKey.es.js +1 -0
  46. package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
  47. package/dist/insights-v2/mappings/blocks.es.js +82 -76
  48. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  49. package/dist/microinsights/cards/InsightCard.es.js +92 -83
  50. package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
  51. package/dist/microinsights/cards/MicroCtaStatus.d.ts +18 -0
  52. package/dist/microinsights/cards/MicroCtaStatus.es.js +50 -0
  53. package/dist/microinsights/cards/MicroCtaStatus.es.js.map +1 -0
  54. package/dist/microinsights/stores/CopyStore.d.ts +10 -1
  55. package/dist/microinsights/stores/CopyStore.es.js +20 -11
  56. package/dist/microinsights/stores/CopyStore.es.js.map +1 -1
  57. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { ANALYTICS_EVENTS_CONFIG as i } from "../analytics/analyticsEventsConfig.es.js";
2
- import { resolveAnalyticsEvent as l } from "../analytics/resolveAnalyticsEvent.es.js";
3
- import { ctaHandlers as O } from "./ctaHandlers.es.js";
2
+ import { resolveAnalyticsEvent as I } from "../analytics/resolveAnalyticsEvent.es.js";
3
+ import { ctaHandlers as U } from "./ctaHandlers.es.js";
4
4
  var a = {
5
5
  UNKNOWN: "USER_RESPONSE_UNKNOWN",
6
6
  CONFIRMED: "CONFIRMED",
@@ -9,37 +9,37 @@ var a = {
9
9
  WRONG_FREQUENCY: "WRONG_FREQUENCY",
10
10
  ONE_TIME_PURCHASE: "ONE_TIME_PURCHASE",
11
11
  OTHER: "OTHER"
12
- }, S = {
12
+ }, O = {
13
13
  [a.CONFIRMED]: i.SUBSCRIPTION_CONFIRMED,
14
14
  [a.NEVER_SUBSCRIBED]: i.SUBSCRIPTION_NEVER_SUBSCRIBED,
15
15
  [a.CANCELLED]: i.SUBSCRIPTION_CANCELLED,
16
16
  [a.ONE_TIME_PURCHASE]: i.SUBSCRIPTION_ONE_TIME_PURCHASE,
17
17
  [a.WRONG_FREQUENCY]: i.SUBSCRIPTION_WRONG_FREQUENCY
18
- }, C = {
18
+ }, v = {
19
19
  [a.OTHER]: "Other",
20
20
  [a.UNKNOWN]: "Default - Response Unknown"
21
- }, I = [
21
+ }, T = [
22
22
  ["0", a.NEVER_SUBSCRIBED],
23
23
  ["1", a.CANCELLED],
24
24
  ["2", a.ONE_TIME_PURCHASE],
25
25
  ["3", a.WRONG_FREQUENCY]
26
- ], _ = (e, n) => {
26
+ ], l = (e, n) => {
27
27
  const r = e.copyStore.copy.insights_feed?.general?.[n];
28
28
  return typeof r == "string" && r.trim() ? r : void 0;
29
- }, E = ({ beat: e, stores: n }) => {
29
+ }, N = ({ beat: e, stores: n }) => {
30
30
  const r = e.primary_repeating_transaction_guid;
31
31
  return r ? n.recurringTransactionsStore.repeatingTransactions.find((t) => t.guid === r) : void 0;
32
- }, c = ({ beat: e, stores: n, hostActions: r }, t) => {
32
+ }, _ = ({ beat: e, stores: n, hostActions: r }, t) => {
33
33
  try {
34
- r?.onAnalyticsEvent?.(l(t, e));
35
- } catch (s) {
36
- n.captureException(s, {
34
+ r?.onAnalyticsEvent?.(I(t, e));
35
+ } catch (o) {
36
+ n.captureException(o, {
37
37
  store: "ctaActions",
38
38
  template: e.template,
39
39
  handler: "subscriptionAnswer"
40
40
  });
41
41
  }
42
- }, d = async (e, n) => {
42
+ }, C = async (e, n) => {
43
43
  const r = {
44
44
  beat: e.beat,
45
45
  stores: e.stores,
@@ -55,7 +55,7 @@ var a = {
55
55
  }
56
56
  };
57
57
  try {
58
- return await O.updateRepeatingTransactionResponse(r), !0;
58
+ return await U.updateRepeatingTransactionResponse(r), !0;
59
59
  } catch (t) {
60
60
  return e.stores.captureException(t, {
61
61
  store: "ctaActions",
@@ -63,74 +63,79 @@ var a = {
63
63
  handler: "updateRepeatingTransactionResponse"
64
64
  }), !1;
65
65
  }
66
- }, U = async (e, n) => {
67
- const r = S[n];
68
- if (r && c(e, r), !await d(e, n)) throw new Error("Failed to save the subscription answer");
69
- }, v = (e) => c(e, i.SUBSCRIPTION_NOT_SUBSCRIBED), N = /* @__PURE__ */ new Set(), T = async (e) => {
66
+ }, A = async (e, n) => {
67
+ const r = O[n];
68
+ if (r && _(e, r), !await C(e, n)) throw new Error("Failed to save the subscription answer");
69
+ }, g = (e) => _(e, i.SUBSCRIPTION_NOT_SUBSCRIBED), R = /* @__PURE__ */ new Set(), f = async (e) => {
70
70
  const n = e.beat.primary_repeating_transaction_guid;
71
- if (!n || N.has(n)) return !1;
72
- const r = E(e)?.user_response ?? a.UNKNOWN, t = S[r]?.action ?? C[r], s = i.SUBSCRIPTION_UNDO;
73
- c(e, {
74
- ...s,
75
- action: `${s.action} - Previous action: ${t}`
76
- }), N.add(n);
71
+ if (!n || R.has(n)) return !1;
72
+ const r = N(e)?.user_response ?? a.UNKNOWN, t = O[r]?.action ?? v[r], o = i.SUBSCRIPTION_UNDO;
73
+ _(e, {
74
+ ...o,
75
+ action: `${o.action} - Previous action: ${t}`
76
+ }), R.add(n);
77
77
  try {
78
- return await d(e, a.UNKNOWN);
78
+ return await C(e, a.UNKNOWN);
79
79
  } finally {
80
- N.delete(n);
80
+ R.delete(n);
81
81
  }
82
- }, p = /* @__PURE__ */ new WeakSet(), g = (e) => {
83
- !e.beat.primary_repeating_transaction_guid || E(e) || p.has(e.stores) || (p.add(e.stores), e.stores.recurringTransactionsStore.loadRepeatingTransactions().then(() => {
84
- E(e) || p.delete(e.stores);
82
+ }, u = /* @__PURE__ */ new WeakSet(), y = (e) => {
83
+ !e.beat.primary_repeating_transaction_guid || N(e) || u.has(e.stores) || (u.add(e.stores), e.stores.recurringTransactionsStore.loadRepeatingTransactions().then(() => {
84
+ N(e) || u.delete(e.stores);
85
85
  }));
86
- }, y = ({ statusLabels: e, answerCounts: n = () => !0 }) => ({
87
- prepare: g,
88
- presenter: (r) => {
89
- const t = E(r);
90
- if (!r.beat.primary_transaction_guid || !t) return {
86
+ }, m = ({ statusLabels: e, sx: n, negativeSx: r, answeredTitle: t, answerCounts: o = () => !0 }) => ({
87
+ prepare: y,
88
+ presenter: (s) => {
89
+ const p = N(s);
90
+ if (!s.beat.primary_transaction_guid || !p) return {
91
91
  kind: "hidden",
92
92
  hideAll: !0
93
93
  };
94
- const s = t.user_response;
95
- if (!s || s === a.UNKNOWN || !n(r, t)) return;
96
- const o = s === a.CONFIRMED, R = _(r.stores, o ? e.positive : e.negative), u = _(r.stores, "undo");
97
- return !R || !u ? { kind: "hidden" } : {
94
+ const c = p.user_response;
95
+ if (!c || c === a.UNKNOWN || !o(s, p)) return;
96
+ const E = c === a.CONFIRMED, S = l(s.stores, E ? e.positive : e.negative), d = l(s.stores, "undo");
97
+ return !S || !d ? { kind: "hidden" } : {
98
98
  kind: "status",
99
- tone: o ? "success" : "neutral",
100
- icon: o ? "check_circle" : "cancel",
101
- label: R,
99
+ tone: E ? "success" : "neutral",
100
+ icon: E ? "check_circle" : "cancel",
101
+ label: S,
102
+ sx: E || !r ? n : {
103
+ ...n,
104
+ ...r
105
+ },
106
+ title: t?.(s.stores.copyStore.copy) || void 0,
102
107
  action: {
103
- label: u,
104
- onPress: () => T(r)
108
+ label: d,
109
+ onPress: () => f(s)
105
110
  }
106
111
  };
107
112
  }
108
- }), D = (e, n) => {
109
- const r = I.flatMap(([t, s]) => {
110
- const o = n.reason_options?.[t];
111
- return o ? [{
112
- label: o,
113
- userResponse: s
113
+ }), B = (e, n) => {
114
+ const r = T.flatMap(([t, o]) => {
115
+ const s = n.reason_options?.[t];
116
+ return s ? [{
117
+ label: s,
118
+ userResponse: o
114
119
  }] : [];
115
120
  });
116
121
  return {
117
122
  reasonOptions: r.map(({ label: t }) => t),
118
123
  onSubmit: async (t) => {
119
- const s = t === n.yes_label ? a.CONFIRMED : r.find(({ label: o }) => o === t)?.userResponse;
120
- if (!s) throw new Error(`No subscription answer for "${t}"`);
121
- await U(e, s);
124
+ const o = t === n.yes_label ? a.CONFIRMED : r.find(({ label: s }) => s === t)?.userResponse;
125
+ if (!o) throw new Error(`No subscription answer for "${t}"`);
126
+ await A(e, o);
122
127
  },
123
- onReasonsOpen: () => v(e),
128
+ onReasonsOpen: () => g(e),
124
129
  showDetailField: !1
125
130
  };
126
131
  };
127
132
  export {
128
133
  a as USER_RESPONSE,
129
- U as answerSubscription,
130
- E as repeatingTransactionOf,
131
- v as reportSubscriptionMarkedIncorrect,
132
- y as subscriptionEntryStep,
133
- D as subscriptionSurvey
134
+ A as answerSubscription,
135
+ N as repeatingTransactionOf,
136
+ g as reportSubscriptionMarkedIncorrect,
137
+ m as subscriptionEntryStep,
138
+ B as subscriptionSurvey
134
139
  };
135
140
 
136
141
  //# sourceMappingURL=subscriptionAnswer.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subscriptionAnswer.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/subscriptionAnswer.ts"],"sourcesContent":["import type { GlobalStore } from '../../core/stores/GlobalStore'\nimport type {\n InsightsFeedCopy,\n SurveyModalCopy,\n} from '../../core/types/localization/InsightsFeedCopy'\nimport type { RepeatingTransaction } from '../../core/types/RepeatingTransaction'\nimport {\n ANALYTICS_EVENTS_CONFIG,\n type AnalyticsEventConfigEntry,\n} from '../analytics/analyticsEventsConfig'\nimport { resolveAnalyticsEvent } from '../analytics/resolveAnalyticsEvent'\nimport type { BeatActions } from '../beatActions'\nimport { ctaHandlers } from './ctaHandlers'\nimport type {\n CtaContext,\n CtaPresentation,\n CtaStateContext,\n CtaStep,\n CtaSurveyAnswer,\n} from './types'\n\n/**\n * The shared subscription status CTA. The answer lives on the repeating transaction\n * (`user_response`), read at render time; the words are general copy, as pulse's were. Imports\n * nothing from runCtaAction, so ctaConfig can build entries at load time.\n */\n\n/** firefly's `user_response` names (Atlas::Sherlock::RepeatingTransaction::UserResponse). */\nexport const USER_RESPONSE = {\n UNKNOWN: 'USER_RESPONSE_UNKNOWN',\n CONFIRMED: 'CONFIRMED',\n CANCELLED: 'CANCELLED',\n NEVER_SUBSCRIBED: 'NEVER_SUBSCRIBED',\n WRONG_FREQUENCY: 'WRONG_FREQUENCY',\n ONE_TIME_PURCHASE: 'ONE_TIME_PURCHASE',\n OTHER: 'OTHER',\n} as const\n\ntype StateCtx = Pick<CtaStateContext, 'beat' | 'stores'>\ntype WriteCtx = StateCtx & { hostActions?: BeatActions }\n\n/** A key of `insights_feed.general` naming a status word, e.g. `confirmed`. */\ntype GeneralCopyKey = keyof InsightsFeedCopy['general']\n\n// Pulse's Subscription Confirmation event per answer.\nconst ANSWER_EVENTS: Record<string, AnalyticsEventConfigEntry> = {\n [USER_RESPONSE.CONFIRMED]: ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_CONFIRMED,\n [USER_RESPONSE.NEVER_SUBSCRIBED]: ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_NEVER_SUBSCRIBED,\n [USER_RESPONSE.CANCELLED]: ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_CANCELLED,\n [USER_RESPONSE.ONE_TIME_PURCHASE]: ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_ONE_TIME_PURCHASE,\n [USER_RESPONSE.WRONG_FREQUENCY]: ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_WRONG_FREQUENCY,\n}\n\n// Undo's \"Previous action\" for answers with no event of their own (pulse's wording).\nconst UNDO_PREVIOUS_ACTION_FALLBACK: Record<string, string> = {\n [USER_RESPONSE.OTHER]: 'Other',\n [USER_RESPONSE.UNKNOWN]: 'Default - Response Unknown',\n}\n\n// `survey_modal.reason_options` keys in pulse's order; no \"Other\" (no free text).\nconst REASON_ANSWERS: [optionKey: string, userResponse: string][] = [\n ['0', USER_RESPONSE.NEVER_SUBSCRIBED],\n ['1', USER_RESPONSE.CANCELLED],\n ['2', USER_RESPONSE.ONE_TIME_PURCHASE],\n ['3', USER_RESPONSE.WRONG_FREQUENCY],\n]\n\n/** A non-empty `insights_feed.general` word, or undefined. */\nconst generalWord = (stores: GlobalStore, key: GeneralCopyKey): string | undefined => {\n const value = stores.copyStore.copy.insights_feed?.general?.[key]\n\n return typeof value === 'string' && value.trim() ? value : undefined\n}\n\n/** The beat's repeating transaction, or undefined until loaded / when absent. */\nexport const repeatingTransactionOf = ({\n beat,\n stores,\n}: StateCtx): RepeatingTransaction | undefined => {\n const guid = beat.primary_repeating_transaction_guid\n\n return guid\n ? stores.recurringTransactionsStore.repeatingTransactions.find((rt) => rt.guid === guid)\n : undefined\n}\n\nconst reportEvent = ({ beat, stores, hostActions }: WriteCtx, event: AnalyticsEventConfigEntry) => {\n try {\n hostActions?.onAnalyticsEvent?.(resolveAnalyticsEvent(event, beat))\n } catch (error) {\n stores.captureException(error, {\n store: 'ctaActions',\n template: beat.template,\n handler: 'subscriptionAnswer',\n })\n }\n}\n\n/** Writes the beat's `user_response`; true on success, never throws. */\nconst writeUserResponse = async (ctx: WriteCtx, userResponse: string): Promise<boolean> => {\n const handlerCtx: CtaContext = {\n beat: ctx.beat,\n stores: ctx.stores,\n hostActions: ctx.hostActions ?? {},\n cta: { label: '', block: '' },\n slot: 'primary',\n params: { userResponse, repeatingTransactionGuid: ctx.beat.primary_repeating_transaction_guid },\n }\n\n try {\n await ctaHandlers.updateRepeatingTransactionResponse(handlerCtx)\n\n return true\n } catch (error) {\n ctx.stores.captureException(error, {\n store: 'ctaActions',\n template: ctx.beat.template,\n handler: 'updateRepeatingTransactionResponse',\n })\n\n return false\n }\n}\n\n/** Reports the answer (as pulse), then saves it; rejects on failure so a survey can offer Try Again. */\nexport const answerSubscription = async (ctx: WriteCtx, userResponse: string): Promise<void> => {\n const event = ANSWER_EVENTS[userResponse]\n\n if (event) reportEvent(ctx, event)\n if (!(await writeUserResponse(ctx, userResponse))) {\n throw new Error('Failed to save the subscription answer')\n }\n}\n\n/** The \"No\" press, before a reason is picked (pulse's DATA_IS_INCORRECT). */\nexport const reportSubscriptionMarkedIncorrect = (ctx: WriteCtx): void =>\n reportEvent(ctx, ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_NOT_SUBSCRIBED)\n\n// Repeating transactions with an Undo in flight; a second press is ignored.\nconst undoing = new Set<string>()\n\n/** Undo: writes USER_RESPONSE_UNKNOWN, reporting the answer it undoes. */\nconst undoSubscriptionAnswer = async (ctx: WriteCtx): Promise<boolean> => {\n const guid = ctx.beat.primary_repeating_transaction_guid\n\n if (!guid || undoing.has(guid)) return false\n\n const previous = repeatingTransactionOf(ctx)?.user_response ?? USER_RESPONSE.UNKNOWN\n const previousAction = ANSWER_EVENTS[previous]?.action ?? UNDO_PREVIOUS_ACTION_FALLBACK[previous]\n const undo = ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_UNDO\n\n reportEvent(ctx, { ...undo, action: `${undo.action} - Previous action: ${previousAction}` })\n undoing.add(guid)\n\n try {\n return await writeUserResponse(ctx, USER_RESPONSE.UNKNOWN)\n } finally {\n undoing.delete(guid)\n }\n}\n\n// One load per store, shared by every subscription card on the page.\nconst loadedStores = new WeakSet<GlobalStore>()\n\nconst ensureRepeatingTransactions = (ctx: StateCtx): void => {\n if (!ctx.beat.primary_repeating_transaction_guid || repeatingTransactionOf(ctx)) return\n if (loadedStores.has(ctx.stores)) return\n\n loadedStores.add(ctx.stores)\n // The store reports a failure itself; while the record is still missing, the next card retries.\n void ctx.stores.recurringTransactionsStore.loadRepeatingTransactions().then(() => {\n if (!repeatingTransactionOf(ctx)) loadedStores.delete(ctx.stores)\n })\n}\n\nexport interface SubscriptionEntryOptions {\n /** The `insights_feed.general` words for a positive (`CONFIRMED`) and any other answer. */\n statusLabels: { positive: GeneralCopyKey; negative: GeneralCopyKey }\n /** Whether the stored answer applies to this beat (default: every answer counts). */\n answerCounts?: (ctx: CtaStateContext, repeating: RepeatingTransaction) => boolean\n}\n\n/**\n * The step a beat's `action_key` names: the button until answered, then the status with Undo. No\n * repeating transaction or transaction: no CTAs, as pulse. A missing word draws nothing.\n */\nexport const subscriptionEntryStep = ({\n statusLabels,\n answerCounts = () => true,\n}: SubscriptionEntryOptions): CtaStep => ({\n // Every card loads it, mini too, for the row's live frequency (WEC-2147).\n prepare: ensureRepeatingTransactions,\n presenter: (ctx): CtaPresentation | undefined => {\n const repeating = repeatingTransactionOf(ctx)\n\n if (!ctx.beat.primary_transaction_guid || !repeating) return { kind: 'hidden', hideAll: true }\n\n const answer = repeating.user_response\n\n if (!answer || answer === USER_RESPONSE.UNKNOWN || !answerCounts(ctx, repeating)) {\n return undefined\n }\n\n const positive = answer === USER_RESPONSE.CONFIRMED\n const label = generalWord(ctx.stores, positive ? statusLabels.positive : statusLabels.negative)\n const undoLabel = generalWord(ctx.stores, 'undo')\n\n if (!label || !undoLabel) return { kind: 'hidden' }\n\n return {\n kind: 'status',\n tone: positive ? 'success' : 'neutral',\n icon: positive ? 'check_circle' : 'cancel',\n label,\n action: { label: undoLabel, onPress: () => undoSubscriptionAnswer(ctx) },\n }\n },\n})\n\n/** A subscription entry's `surveyAnswer`: Yes writes CONFIRMED, a reason its value. */\nexport const subscriptionSurvey = (ctx: WriteCtx, copy: SurveyModalCopy): CtaSurveyAnswer => {\n const reasons = REASON_ANSWERS.flatMap(([optionKey, userResponse]) => {\n const label = copy.reason_options?.[optionKey]\n\n return label ? [{ label, userResponse }] : []\n })\n\n return {\n reasonOptions: reasons.map(({ label }) => label),\n onSubmit: async (option) => {\n const userResponse =\n option === copy.yes_label\n ? USER_RESPONSE.CONFIRMED\n : reasons.find(({ label }) => label === option)?.userResponse\n\n if (!userResponse) throw new Error(`No subscription answer for \"${option}\"`)\n\n await answerSubscription(ctx, userResponse)\n },\n onReasonsOpen: () => reportSubscriptionMarkedIncorrect(ctx),\n showDetailField: false,\n }\n}\n"],"mappings":";;;AA4BA,IAAa,IAAgB;AAAA,EAC3B,SAAS;AAAA,EACT,WAAW;AAAA,EACX,WAAW;AAAA,EACX,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,OAAO;AACT,GASM,IAA2D;AAAA,EAC9D,CAAA,EAAc,SAAA,GAAY,EAAwB;AAAA,EAClD,CAAA,EAAc,gBAAA,GAAmB,EAAwB;AAAA,EACzD,CAAA,EAAc,SAAA,GAAY,EAAwB;AAAA,EAClD,CAAA,EAAc,iBAAA,GAAoB,EAAwB;AAAA,EAC1D,CAAA,EAAc,eAAA,GAAkB,EAAwB;AAC3D,GAGM,IAAwD;AAAA,EAC3D,CAAA,EAAc,K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,GAAS;AAE3E,YAAM,EAAmB,GAAK,CAAY;AAAA,IAC5C;AAAA,IACA,eAAA,MAAqB,EAAkC,CAAG;AAAA,IAC1D,iBAAiB;AAAA,EACnB;AACF"}
1
+ {"version":3,"file":"subscriptionAnswer.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/subscriptionAnswer.ts"],"sourcesContent":["import type { SxProps, Theme } from '@mui/material/styles'\nimport type { GlobalCopy } from '../../core/types/GlobalCopy'\nimport type { GlobalStore } from '../../core/stores/GlobalStore'\nimport type {\n InsightsFeedCopy,\n SurveyModalCopy,\n} from '../../core/types/localization/InsightsFeedCopy'\nimport type { RepeatingTransaction } from '../../core/types/RepeatingTransaction'\nimport {\n ANALYTICS_EVENTS_CONFIG,\n type AnalyticsEventConfigEntry,\n} from '../analytics/analyticsEventsConfig'\nimport { resolveAnalyticsEvent } from '../analytics/resolveAnalyticsEvent'\nimport type { BeatActions } from '../beatActions'\nimport { ctaHandlers } from './ctaHandlers'\nimport type {\n CtaContext,\n CtaPresentation,\n CtaStateContext,\n CtaStep,\n CtaSurveyAnswer,\n} from './types'\n\n/**\n * The shared subscription status CTA. The answer lives on the repeating transaction\n * (`user_response`), read at render time; the words are general copy, as pulse's were. Imports\n * nothing from runCtaAction, so ctaConfig can build entries at load time.\n */\n\n/** firefly's `user_response` names (Atlas::Sherlock::RepeatingTransaction::UserResponse). */\nexport const USER_RESPONSE = {\n UNKNOWN: 'USER_RESPONSE_UNKNOWN',\n CONFIRMED: 'CONFIRMED',\n CANCELLED: 'CANCELLED',\n NEVER_SUBSCRIBED: 'NEVER_SUBSCRIBED',\n WRONG_FREQUENCY: 'WRONG_FREQUENCY',\n ONE_TIME_PURCHASE: 'ONE_TIME_PURCHASE',\n OTHER: 'OTHER',\n} as const\n\ntype StateCtx = Pick<CtaStateContext, 'beat' | 'stores'>\ntype WriteCtx = StateCtx & { hostActions?: BeatActions }\n\n/** A key of `insights_feed.general` naming a status word, e.g. `confirmed`. */\ntype GeneralCopyKey = keyof InsightsFeedCopy['general']\n\n// Pulse's Subscription Confirmation event per answer.\nconst ANSWER_EVENTS: Record<string, AnalyticsEventConfigEntry> = {\n [USER_RESPONSE.CONFIRMED]: ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_CONFIRMED,\n [USER_RESPONSE.NEVER_SUBSCRIBED]: ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_NEVER_SUBSCRIBED,\n [USER_RESPONSE.CANCELLED]: ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_CANCELLED,\n [USER_RESPONSE.ONE_TIME_PURCHASE]: ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_ONE_TIME_PURCHASE,\n [USER_RESPONSE.WRONG_FREQUENCY]: ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_WRONG_FREQUENCY,\n}\n\n// Undo's \"Previous action\" for answers with no event of their own (pulse's wording).\nconst UNDO_PREVIOUS_ACTION_FALLBACK: Record<string, string> = {\n [USER_RESPONSE.OTHER]: 'Other',\n [USER_RESPONSE.UNKNOWN]: 'Default - Response Unknown',\n}\n\n// `survey_modal.reason_options` keys in pulse's order; no \"Other\" (no free text).\nconst REASON_ANSWERS: [optionKey: string, userResponse: string][] = [\n ['0', USER_RESPONSE.NEVER_SUBSCRIBED],\n ['1', USER_RESPONSE.CANCELLED],\n ['2', USER_RESPONSE.ONE_TIME_PURCHASE],\n ['3', USER_RESPONSE.WRONG_FREQUENCY],\n]\n\n/** A non-empty `insights_feed.general` word, or undefined. */\nconst generalWord = (stores: GlobalStore, key: GeneralCopyKey): string | undefined => {\n const value = stores.copyStore.copy.insights_feed?.general?.[key]\n\n return typeof value === 'string' && value.trim() ? value : undefined\n}\n\n/** The beat's repeating transaction, or undefined until loaded / when absent. */\nexport const repeatingTransactionOf = ({\n beat,\n stores,\n}: StateCtx): RepeatingTransaction | undefined => {\n const guid = beat.primary_repeating_transaction_guid\n\n return guid\n ? stores.recurringTransactionsStore.repeatingTransactions.find((rt) => rt.guid === guid)\n : undefined\n}\n\nconst reportEvent = ({ beat, stores, hostActions }: WriteCtx, event: AnalyticsEventConfigEntry) => {\n try {\n hostActions?.onAnalyticsEvent?.(resolveAnalyticsEvent(event, beat))\n } catch (error) {\n stores.captureException(error, {\n store: 'ctaActions',\n template: beat.template,\n handler: 'subscriptionAnswer',\n })\n }\n}\n\n/** Writes the beat's `user_response`; true on success, never throws. */\nconst writeUserResponse = async (ctx: WriteCtx, userResponse: string): Promise<boolean> => {\n const handlerCtx: CtaContext = {\n beat: ctx.beat,\n stores: ctx.stores,\n hostActions: ctx.hostActions ?? {},\n cta: { label: '', block: '' },\n slot: 'primary',\n params: { userResponse, repeatingTransactionGuid: ctx.beat.primary_repeating_transaction_guid },\n }\n\n try {\n await ctaHandlers.updateRepeatingTransactionResponse(handlerCtx)\n\n return true\n } catch (error) {\n ctx.stores.captureException(error, {\n store: 'ctaActions',\n template: ctx.beat.template,\n handler: 'updateRepeatingTransactionResponse',\n })\n\n return false\n }\n}\n\n/** Reports the answer (as pulse), then saves it; rejects on failure so a survey can offer Try Again. */\nexport const answerSubscription = async (ctx: WriteCtx, userResponse: string): Promise<void> => {\n const event = ANSWER_EVENTS[userResponse]\n\n if (event) reportEvent(ctx, event)\n if (!(await writeUserResponse(ctx, userResponse))) {\n throw new Error('Failed to save the subscription answer')\n }\n}\n\n/** The \"No\" press, before a reason is picked (pulse's DATA_IS_INCORRECT). */\nexport const reportSubscriptionMarkedIncorrect = (ctx: WriteCtx): void =>\n reportEvent(ctx, ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_NOT_SUBSCRIBED)\n\n// Repeating transactions with an Undo in flight; a second press is ignored.\nconst undoing = new Set<string>()\n\n/** Undo: writes USER_RESPONSE_UNKNOWN, reporting the answer it undoes. */\nconst undoSubscriptionAnswer = async (ctx: WriteCtx): Promise<boolean> => {\n const guid = ctx.beat.primary_repeating_transaction_guid\n\n if (!guid || undoing.has(guid)) return false\n\n const previous = repeatingTransactionOf(ctx)?.user_response ?? USER_RESPONSE.UNKNOWN\n const previousAction = ANSWER_EVENTS[previous]?.action ?? UNDO_PREVIOUS_ACTION_FALLBACK[previous]\n const undo = ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_UNDO\n\n reportEvent(ctx, { ...undo, action: `${undo.action} - Previous action: ${previousAction}` })\n undoing.add(guid)\n\n try {\n return await writeUserResponse(ctx, USER_RESPONSE.UNKNOWN)\n } finally {\n undoing.delete(guid)\n }\n}\n\n// One load per store, shared by every subscription card on the page.\nconst loadedStores = new WeakSet<GlobalStore>()\n\nconst ensureRepeatingTransactions = (ctx: StateCtx): void => {\n if (!ctx.beat.primary_repeating_transaction_guid || repeatingTransactionOf(ctx)) return\n if (loadedStores.has(ctx.stores)) return\n\n loadedStores.add(ctx.stores)\n // The store reports a failure itself; while the record is still missing, the next card retries.\n void ctx.stores.recurringTransactionsStore.loadRepeatingTransactions().then(() => {\n if (!repeatingTransactionOf(ctx)) loadedStores.delete(ctx.stores)\n })\n}\n\nexport interface SubscriptionEntryOptions {\n /** The `insights_feed.general` words for a positive (`CONFIRMED`) and any other answer. */\n statusLabels: { positive: GeneralCopyKey; negative: GeneralCopyKey }\n /** Whether the stored answer applies to this beat (default: every answer counts). */\n answerCounts?: (ctx: CtaStateContext, repeating: RepeatingTransaction) => boolean\n /** Status bar overrides for this step (e.g. a taller bar). */\n sx?: SxProps<Theme>\n /** Extra overrides for a negative answer's bar (on top of `sx`), e.g. its own neutral look. */\n negativeSx?: SxProps<Theme>\n /** The card's title once answered, from copy (mini and micro retitle; full keeps its title). */\n answeredTitle?: (copy: GlobalCopy) => string | undefined\n}\n\n/**\n * The step a beat's `action_key` names: the button until answered, then the status with Undo. No\n * repeating transaction or transaction: no CTAs, as pulse. A missing word draws nothing.\n */\nexport const subscriptionEntryStep = ({\n statusLabels,\n sx,\n negativeSx,\n answeredTitle,\n answerCounts = () => true,\n}: SubscriptionEntryOptions): CtaStep => ({\n // Every card loads it, mini too, for the row's live frequency (WEC-2147).\n prepare: ensureRepeatingTransactions,\n presenter: (ctx): CtaPresentation | undefined => {\n const repeating = repeatingTransactionOf(ctx)\n\n if (!ctx.beat.primary_transaction_guid || !repeating) return { kind: 'hidden', hideAll: true }\n\n const answer = repeating.user_response\n\n if (!answer || answer === USER_RESPONSE.UNKNOWN || !answerCounts(ctx, repeating)) {\n return undefined\n }\n\n const positive = answer === USER_RESPONSE.CONFIRMED\n const label = generalWord(ctx.stores, positive ? statusLabels.positive : statusLabels.negative)\n const undoLabel = generalWord(ctx.stores, 'undo')\n\n if (!label || !undoLabel) return { kind: 'hidden' }\n\n return {\n kind: 'status',\n tone: positive ? 'success' : 'neutral',\n icon: positive ? 'check_circle' : 'cancel',\n label,\n sx: positive || !negativeSx ? sx : ({ ...sx, ...negativeSx } as SxProps<Theme>),\n title: answeredTitle?.(ctx.stores.copyStore.copy) || undefined,\n action: { label: undoLabel, onPress: () => undoSubscriptionAnswer(ctx) },\n }\n },\n})\n\n/** A subscription entry's `surveyAnswer`: Yes writes CONFIRMED, a reason its value. */\nexport const subscriptionSurvey = (ctx: WriteCtx, copy: SurveyModalCopy): CtaSurveyAnswer => {\n const reasons = REASON_ANSWERS.flatMap(([optionKey, userResponse]) => {\n const label = copy.reason_options?.[optionKey]\n\n return label ? [{ label, userResponse }] : []\n })\n\n return {\n reasonOptions: reasons.map(({ label }) => label),\n onSubmit: async (option) => {\n const userResponse =\n option === copy.yes_label\n ? USER_RESPONSE.CONFIRMED\n : reasons.find(({ label }) => label === option)?.userResponse\n\n if (!userResponse) throw new Error(`No subscription answer for \"${option}\"`)\n\n await answerSubscription(ctx, userResponse)\n },\n onReasonsOpen: () => reportSubscriptionMarkedIncorrect(ctx),\n showDetailField: false,\n }\n}\n"],"mappings":";;;AA8BA,IAAa,IAAgB;AAAA,EAC3B,SAAS;AAAA,EACT,WAAW;AAAA,EACX,WAAW;AAAA,EACX,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,OAAO;A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EAAe,QAAA,CAAS,CAAC,GAAW,CAAA,MAAkB;AACpE,UAAM,IAAQ,EAAK,iBAAiB,CAAA;AAEpC,WAAO,IAAQ,CAAC;AAAA,MAAE,OAAA;AAAA,MAAO,cAAA;AAAA,IAAa,CAAC,IAAI,CAAC;AAAA,EAC9C,CAAC;AAED,SAAO;AAAA,IACL,eAAe,EAAQ,IAAA,CAAK,EAAE,OAAA,EAAA,MAAY,CAAK;AAAA,IAC/C,UAAU,OAAO,MAAW;AAC1B,YAAM,IACJ,MAAW,EAAK,YACZ,EAAc,YACd,EAAQ,KAAA,CAAM,EAAE,OAAA,EAAA,MAAY,MAAU,CAAM,GAAG;AAErD,UAAI,CAAC,EAAc,OAAM,IAAI,MAAM,+BAA+B,CAAA,GAAS;AAE3E,YAAM,EAAmB,GAAK,CAAY;AAAA,IAC5C;AAAA,IACA,eAAA,MAAqB,EAAkC,CAAG;AAAA,IAC1D,iBAAiB;AAAA,EACnB;AACF"}
@@ -11,12 +11,15 @@ export type CtaParams = Record<string, unknown>;
11
11
  /** Read-only view for state predicates evaluated during render (`hostActions` for a status's analytics). */
12
12
  export type CtaStateContext = Pick<CtaContext, 'beat' | 'cta' | 'slot' | 'stores'> & Partial<Pick<CtaContext, 'hostActions'>>;
13
13
  /** What a presenter draws instead of the button: a status, or nothing (`hideAll` also hides the secondary). */
14
- export type CtaPresentation = {
14
+ export type CtaPresentation = ({
15
15
  kind: 'hidden';
16
16
  hideAll?: boolean;
17
17
  } | ({
18
18
  kind: 'status';
19
- } & CtaStatusProps);
19
+ } & CtaStatusProps)) & {
20
+ /** The card's title while this presentation shows (e.g. "Charge Reviewed"); any kind may set it. */
21
+ title?: string;
22
+ };
20
23
  export interface CtaState {
21
24
  disabled: boolean;
22
25
  /** Set when the step's presenter replaces the button. */
@@ -60,6 +63,11 @@ export interface CtaStep {
60
63
  presenter?: (ctx: CtaStateContext) => CtaPresentation | undefined;
61
64
  /** Loads what `presenter` reads, once per beat on mount. */
62
65
  prepare?: (ctx: Pick<CtaStateContext, 'beat' | 'stores'>) => void;
66
+ /**
67
+ * Mini and micro mirror this step's `presenter` when their card action (`in_description_cta`)
68
+ * names it: the status's action word as the label and its `title`. Default: they keep the link.
69
+ */
70
+ compactStatus?: boolean;
63
71
  /** Its own reasons and save for `survey_modal_block`; default: beat feedback. */
64
72
  surveyAnswer?: (ctx: Pick<CtaContext, 'beat' | 'stores' | 'hostActions'>, copy: SurveyModalCopy) => CtaSurveyAnswer;
65
73
  }
@@ -1,16 +1,19 @@
1
1
  import { Beat, PrimaryCTA, SecondaryCTA } from '../../core';
2
2
  import { BeatActions } from '../beatActions';
3
3
  import { CtaHandlerName } from './ctaHandlers';
4
- import { CtaSlot, CtaState, RunHandlerOptions } from './types';
4
+ import { CtaPresentation, CtaSlot, CtaState, RunHandlerOptions } from './types';
5
5
  export interface BeatCtaActions {
6
6
  runCta: (slot: CtaSlot, cta: PrimaryCTA | SecondaryCTA, params?: Record<string, unknown>) => Promise<void>;
7
7
  primary: CtaState;
8
8
  secondary: CtaState;
9
+ /** The link step's presentation when it mirrors on mini (`compactStatus`); otherwise undefined. */
10
+ linkPresentation?: CtaPresentation;
9
11
  }
10
12
  /**
11
13
  * The card's click runner plus per-slot enabled state. Call from an `observer` so `disabledWhen`
12
14
  * store reads re-render. `beatActions` is a parameter: BaseLayout mounts its provider below this.
13
- * `linkCta`: mini and micro send the card's action as the link, so its step's `prepare` runs too.
15
+ * `linkCta`: mini and micro send the card's action as the link, so its step's `prepare` runs too, and
16
+ * a `compactStatus` step's presentation comes back as `linkPresentation`.
14
17
  */
15
18
  export declare const useBeatCtaActions: (beat: Beat, beatActions?: BeatActions, primaryCta?: PrimaryCTA | SecondaryCTA, secondaryCta?: PrimaryCTA | SecondaryCTA, linkCta?: {
16
19
  action_key?: string | null;
@@ -1,52 +1,60 @@
1
- import { useGlobalStore as i } from "../../common/context/hooks.es.js";
2
- import { resolveCtaState as p, resolveStep as l, runCtaAction as f, runCtaHandler as v } from "./runCtaAction.es.js";
3
- import { useEffect as A } from "react";
4
- var u = {
1
+ import { useGlobalStore as m } from "../../common/context/hooks.es.js";
2
+ import { resolveCtaState as l, resolveStep as u, runCtaAction as y, runCtaHandler as A } from "./runCtaAction.es.js";
3
+ import { useEffect as C } from "react";
4
+ var p = {
5
5
  label: "",
6
6
  block: ""
7
- }, x = (r, o = {}, e = u, a = u, s) => {
8
- const t = i(), c = l({ cta: e }).prepare ?? (s && l({ cta: s }).prepare), n = {
9
- beat: r,
10
- stores: t,
11
- hostActions: o
7
+ }, x = (t, e = {}, s = p, a = p, o) => {
8
+ const r = m(), n = o?.action_key ? u({ cta: o }) : void 0, i = u({ cta: s }).prepare ?? n?.prepare, c = {
9
+ beat: t,
10
+ stores: r,
11
+ hostActions: e
12
12
  };
13
- return A(() => {
14
- c?.({
15
- beat: r,
16
- stores: t
13
+ return C(() => {
14
+ i?.({
15
+ beat: t,
16
+ stores: r
17
17
  });
18
18
  }, [
19
- r.guid,
20
- c,
21
- t
19
+ t.guid,
20
+ i,
21
+ r
22
22
  ]), {
23
- runCta: (m, C, d = {}) => f({
24
- beat: r,
25
- cta: C,
26
- slot: m,
27
- stores: t,
28
- hostActions: o,
29
- params: d
23
+ runCta: (d, v, f = {}) => y({
24
+ beat: t,
25
+ cta: v,
26
+ slot: d,
27
+ stores: r,
28
+ hostActions: e,
29
+ params: f
30
30
  }),
31
- primary: p({
32
- ...n,
33
- cta: e,
31
+ primary: l({
32
+ ...c,
33
+ cta: s,
34
34
  slot: "primary"
35
35
  }),
36
- secondary: p({
37
- ...n,
36
+ secondary: l({
37
+ ...c,
38
38
  cta: a,
39
39
  slot: "secondary"
40
- })
40
+ }),
41
+ linkPresentation: n?.compactStatus ? n.presenter?.({
42
+ ...c,
43
+ cta: {
44
+ ...p,
45
+ ...o
46
+ },
47
+ slot: "primary"
48
+ }) : void 0
41
49
  };
42
- }, E = (r, o = {}) => {
43
- const e = i();
44
- return (a, s = {}, t) => v({
45
- beat: r,
46
- stores: e,
47
- hostActions: o,
48
- params: s
49
- }, a, t);
50
+ }, E = (t, e = {}) => {
51
+ const s = m();
52
+ return (a, o = {}, r) => A({
53
+ beat: t,
54
+ stores: s,
55
+ hostActions: e,
56
+ params: o
57
+ }, a, r);
50
58
  };
51
59
  export {
52
60
  x as useBeatCtaActions,
@@ -1 +1 @@
1
- {"version":3,"file":"useCtaAction.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/useCtaAction.ts"],"sourcesContent":["import { useEffect } from 'react'\n\nimport type { Beat, PrimaryCTA, SecondaryCTA } from '../../core'\nimport { useGlobalStore } from '../../common'\nimport type { BeatActions } from '../beatActions'\nimport type { CtaHandlerName } from './ctaHandlers'\nimport { resolveCtaState, resolveStep, runCtaAction, runCtaHandler } from './runCtaAction'\nimport type { CtaSlot, CtaState, RunHandlerOptions } from './types'\n\nconst EMPTY_CTA: PrimaryCTA = { label: '', block: '' }\n\nexport interface BeatCtaActions {\n runCta: (\n slot: CtaSlot,\n cta: PrimaryCTA | SecondaryCTA,\n params?: Record<string, unknown>,\n ) => Promise<void>\n primary: CtaState\n secondary: CtaState\n}\n\n/**\n * The card's click runner plus per-slot enabled state. Call from an `observer` so `disabledWhen`\n * store reads re-render. `beatActions` is a parameter: BaseLayout mounts its provider below this.\n * `linkCta`: mini and micro send the card's action as the link, so its step's `prepare` runs too.\n */\nexport const useBeatCtaActions = (\n beat: Beat,\n beatActions: BeatActions = {},\n primaryCta: PrimaryCTA | SecondaryCTA = EMPTY_CTA,\n secondaryCta: PrimaryCTA | SecondaryCTA = EMPTY_CTA,\n linkCta?: { action_key?: string | null },\n): BeatCtaActions => {\n const stores = useGlobalStore()\n const prepare =\n resolveStep({ cta: primaryCta }).prepare ?? (linkCta && resolveStep({ cta: linkCta }).prepare)\n const stateCtx = { beat, stores, hostActions: beatActions }\n\n // Once per beat (beat.guid; the beat object can be new each render): load what the step reads.\n useEffect(() => {\n prepare?.({ beat, stores })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [beat.guid, prepare, stores])\n\n return {\n runCta: (slot, cta, params = {}) =>\n runCtaAction({ beat, cta, slot, stores, hostActions: beatActions, params }),\n primary: resolveCtaState({ ...stateCtx, cta: primaryCta, slot: 'primary' }),\n secondary: resolveCtaState({ ...stateCtx, cta: secondaryCta, slot: 'secondary' }),\n }\n}\n\n/**\n * Runs a handler from inside a drawer, e.g. `runHandler('createBudget', { categoryGuid, amount },\n * { onSuccess: ['refreshBeat'] })`. Inside a block, pass `useBeatActions()` as `beatActions`.\n */\nexport const useCtaHandler = (beat: Beat, beatActions: BeatActions = {}) => {\n const stores = useGlobalStore()\n\n return (\n handlerName: CtaHandlerName,\n params: Record<string, unknown> = {},\n options?: RunHandlerOptions,\n ) => runCtaHandler({ beat, stores, hostActions: beatActions, params }, handlerName, options)\n}\n"],"mappings":";;;AASA,IAAM,IAAwB;AAAA,EAAE,OAAO;AAAA,EAAI,OAAO;AAAG,GAiBxC,IAAA,CACX,GACA,IAA2B,CAAC,GAC5B,IAAwC,GACxC,IAA0C,GAC1C,MACmB;AACnB,QAAM,IAAS,EAAe,GACxB,IACJ,EAAY,EAAE,KAAK,EAAW,CAAC,EAAE,YAAY,KAAW,EAAY,EAAE,KAAK,EAAQ,CAAC,EAAE,UAClF,IAAW;AAAA,IAAE,MAAA;AAAA,IAAM,QAAA;AAAA,IAAQ,aAAa;AAAA,EAAY;AAG1D,SAAA,EAAA,MAAgB;AACd,IAAA,IAAU;AAAA,MAAE,MAAA;AAAA,MAAM,QAAA;AAAA,IAAO,CAAC;AAAA,EAE5B,GAAG;AAAA,IAAC,EAAK;AAAA,IAAM;AAAA,IAAS;AAAA,EAAM,CAAC,GAExB;AAAA,IACL,QAAA,CAAS,GAAM,GAAK,IAAS,CAAC,MAC5B,EAAa;AAAA,MAAE,MAAA;AAAA,MAAM,KAAA;AAAA,MAAK,MAAA;AAAA,MAAM,QAAA;AAAA,MAAQ,aAAa;AAAA,MAAa,QAAA;AAAA,IAAO,CAAC;AAAA,IAC5E,SAAS,EAAgB;AAAA,MAAE,GAAG;AAAA,MAAU,KAAK;AAAA,MAAY,MAAM;AAAA,IAAU,CAAC;AAAA,IAC1E,WAAW,EAAgB;AAAA,MAAE,GAAG;AAAA,MAAU,KAAK;AAAA,MAAc,MAAM;AAAA,IAAY,CAAC;AAAA,EAClF;AACF,GAMa,IAAA,CAAiB,GAAY,IAA2B,CAAC,MAAM;AAC1E,QAAM,IAAS,EAAe;AAE9B,SAAA,CACE,GACA,IAAkC,CAAC,GACnC,MACG,EAAc;AAAA,IAAE,MAAA;AAAA,IAAM,QAAA;AAAA,IAAQ,aAAa;AAAA,IAAa,QAAA;AAAA,EAAO,GAAG,GAAa,CAAO;AAC7F"}
1
+ {"version":3,"file":"useCtaAction.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/useCtaAction.ts"],"sourcesContent":["import { useEffect } from 'react'\n\nimport type { Beat, PrimaryCTA, SecondaryCTA } from '../../core'\nimport { useGlobalStore } from '../../common'\nimport type { BeatActions } from '../beatActions'\nimport type { CtaHandlerName } from './ctaHandlers'\nimport { resolveCtaState, resolveStep, runCtaAction, runCtaHandler } from './runCtaAction'\nimport type { CtaPresentation, CtaSlot, CtaState, RunHandlerOptions } from './types'\n\nconst EMPTY_CTA: PrimaryCTA = { label: '', block: '' }\n\nexport interface BeatCtaActions {\n runCta: (\n slot: CtaSlot,\n cta: PrimaryCTA | SecondaryCTA,\n params?: Record<string, unknown>,\n ) => Promise<void>\n primary: CtaState\n secondary: CtaState\n /** The link step's presentation when it mirrors on mini (`compactStatus`); otherwise undefined. */\n linkPresentation?: CtaPresentation\n}\n\n/**\n * The card's click runner plus per-slot enabled state. Call from an `observer` so `disabledWhen`\n * store reads re-render. `beatActions` is a parameter: BaseLayout mounts its provider below this.\n * `linkCta`: mini and micro send the card's action as the link, so its step's `prepare` runs too, and\n * a `compactStatus` step's presentation comes back as `linkPresentation`.\n */\nexport const useBeatCtaActions = (\n beat: Beat,\n beatActions: BeatActions = {},\n primaryCta: PrimaryCTA | SecondaryCTA = EMPTY_CTA,\n secondaryCta: PrimaryCTA | SecondaryCTA = EMPTY_CTA,\n linkCta?: { action_key?: string | null },\n): BeatCtaActions => {\n const stores = useGlobalStore()\n const linkStep = linkCta?.action_key ? resolveStep({ cta: linkCta }) : undefined\n const prepare = resolveStep({ cta: primaryCta }).prepare ?? linkStep?.prepare\n const stateCtx = { beat, stores, hostActions: beatActions }\n\n // Once per beat (beat.guid; the beat object can be new each render): load what the step reads.\n useEffect(() => {\n prepare?.({ beat, stores })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [beat.guid, prepare, stores])\n\n return {\n runCta: (slot, cta, params = {}) =>\n runCtaAction({ beat, cta, slot, stores, hostActions: beatActions, params }),\n primary: resolveCtaState({ ...stateCtx, cta: primaryCta, slot: 'primary' }),\n secondary: resolveCtaState({ ...stateCtx, cta: secondaryCta, slot: 'secondary' }),\n // Display only (mini runs nothing), so the presentation alone: no disabled / pending state.\n linkPresentation: linkStep?.compactStatus\n ? linkStep.presenter?.({ ...stateCtx, cta: { ...EMPTY_CTA, ...linkCta }, slot: 'primary' })\n : undefined,\n }\n}\n\n/**\n * Runs a handler from inside a drawer, e.g. `runHandler('createBudget', { categoryGuid, amount },\n * { onSuccess: ['refreshBeat'] })`. Inside a block, pass `useBeatActions()` as `beatActions`.\n */\nexport const useCtaHandler = (beat: Beat, beatActions: BeatActions = {}) => {\n const stores = useGlobalStore()\n\n return (\n handlerName: CtaHandlerName,\n params: Record<string, unknown> = {},\n options?: RunHandlerOptions,\n ) => runCtaHandler({ beat, stores, hostActions: beatActions, params }, handlerName, options)\n}\n"],"mappings":";;;AASA,IAAM,IAAwB;AAAA,EAAE,OAAO;AAAA,EAAI,OAAO;AAAG,GAoBxC,IAAA,CACX,GACA,IAA2B,CAAC,GAC5B,IAAwC,GACxC,IAA0C,GAC1C,MACmB;AACnB,QAAM,IAAS,EAAe,GACxB,IAAW,GAAS,aAAa,EAAY,EAAE,KAAK,EAAQ,C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_WIDGET_ACTION_BLOCK: string;
10
10
  SURVEY_MODAL_ACTION_BLOCK: string;
11
+ SUBSCRIPTION_STATUS_MODAL_ACTION_BLOCK: string;
11
12
  RECURRING_TRANSACTION_ACTION_BLOCK: string;
12
13
  TRANSACTION_LIST_ACTION_BLOCK: string;
13
14
  REMAINING_CASH_ACTION_BLOCK: string;
@@ -8,6 +8,7 @@ var _ = {
8
8
  CONNECTION_DETAIL_ACTION_BLOCK: "connection_detail_block",
9
9
  CONNECT_WIDGET_ACTION_BLOCK: "connect_widget_block",
10
10
  SURVEY_MODAL_ACTION_BLOCK: "survey_modal_block",
11
+ SUBSCRIPTION_STATUS_MODAL_ACTION_BLOCK: "subscription_status_modal_block",
11
12
  RECURRING_TRANSACTION_ACTION_BLOCK: "recurring_transaction_block",
12
13
  TRANSACTION_LIST_ACTION_BLOCK: "transaction_list_block",
13
14
  REMAINING_CASH_ACTION_BLOCK: "remaining_cash_block",
@@ -1 +1 @@
1
- {"version":3,"file":"actionBlocksKey.es.js","names":[],"sources":["../../../src/insights-v2/mappings/actionBlocksKey.ts"],"sourcesContent":["// Keys for the drawer drilldown registry in `blocks.ts`, extracted into their own module.\n//\n// Why: chart blocks (e.g. BarchartBlock, DoubleBarChartBlock) need\n// `TRANSCATION_HISTORY_ACTION_BLOCK` to tag a chart bar's drilldown context, but they are\n// themselves re-exported through `../blocks` -> `mappings/blocks.ts` imports from that same\n// barrel to build its `blocks` registry. Importing the key straight from `mappings/blocks.ts`\n// closed that loop into a circular import: evaluating `mappings/blocks.ts` pulled in the\n// `blocks` barrel, which (before it got to `ComponentBlocks`/`AccountBlock`) loaded\n// `BarchartBlock`, which imported back into the still-initializing `mappings/blocks.ts` —\n// tripping a \"Cannot access 'AccountBlock' before initialization\" TDZ error in Storybook/Vite.\n//\n// Keeping the keys here (no dependency on `mappings/blocks.ts`) lets chart blocks reference\n// them without re-entering that module.\n//\n// Names follow ditto: its registry ends every CTA block in `_block` and the V2 envelope copies those\n// names verbatim (`transaction_details_block`, `contact_support_block`, `make_transfer_block`).\nexport const actionBlocksKey = {\n PLACEHOLDER_ACTION_BLOCK: 'placeholder_block',\n MAKE_TRANSFER_ACTION_BLOCK: 'make_transfer_block',\n TRANSCATION_HISTORY_ACTION_BLOCK: 'transaction_history_block',\n TRANSACTION_DETAILS_ACTION_BLOCK: 'transaction_details_block',\n CONTACT_SUPPORT_ACTION_BLOCK: 'contact_support_block',\n FEEDBACK_MODAL_ACTION_BLOCK: 'feedback_modal_block',\n CONNECTION_DETAIL_ACTION_BLOCK: 'connection_detail_block',\n CONNECT_WIDGET_ACTION_BLOCK: 'connect_widget_block',\n SURVEY_MODAL_ACTION_BLOCK: 'survey_modal_block',\n RECURRING_TRANSACTION_ACTION_BLOCK: 'recurring_transaction_block',\n TRANSACTION_LIST_ACTION_BLOCK: 'transaction_list_block',\n REMAINING_CASH_ACTION_BLOCK: 'remaining_cash_block',\n AMOUNT_INPUT_MODAL_ACTION_BLOCK: 'amount_input_modal_block',\n SAFETY_NET_ACTION_BLOCK: 'safety_net_block',\n OVERDRAFT_ACTION_BLOCK: 'transparent_overdraft_block',\n CREDIT_UTILIZATION_ACTION_BLOCK: 'credit_utilization_block',\n EMERGENCY_SAVINGS_ACTION_BLOCK: 'emergency_savings_block',\n PAYOFF_CALCULATOR_ACTION_BLOCK: 'payoff_calculator_block',\n BUDGET_DETAILS_ACTION_BLOCK: 'budget_details_block',\n ACCOUNT_DETAILS_ACTION_BLOCK: 'account_details_block',\n ACCOUNT_LIST_ACTION_BLOCK: 'account_list_block',\n}\n"],"mappings":"AAgBA,IAAa,IAAkB;AAAA,EAC7B,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAC5B,kCAAkC;AAAA,EAClC,kCAAkC;AAAA,EAClC,8BAA8B;AAAA,EAC9B,6BAA6B;AAAA,EAC7B,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,2BAA2B;AAAA,EAC3B,oCAAoC;AAAA,EACpC,+BAA+B;AAAA,EAC/B,6BAA6B;AAAA,EAC7B,iCAAiC;AAAA,EACjC,yBAAyB;AAAA,EACzB,wBAAwB;AAAA,EACxB,iCAAiC;AAAA,EACjC,gCAAgC;AAAA,EAChC,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,8BAA8B;AAAA,EAC9B,2BAA2B;AAC7B"}
1
+ {"version":3,"file":"actionBlocksKey.es.js","names":[],"sources":["../../../src/insights-v2/mappings/actionBlocksKey.ts"],"sourcesContent":["// Keys for the drawer drilldown registry in `blocks.ts`, extracted into their own module.\n//\n// Why: chart blocks (e.g. BarchartBlock, DoubleBarChartBlock) need\n// `TRANSCATION_HISTORY_ACTION_BLOCK` to tag a chart bar's drilldown context, but they are\n// themselves re-exported through `../blocks` -> `mappings/blocks.ts` imports from that same\n// barrel to build its `blocks` registry. Importing the key straight from `mappings/blocks.ts`\n// closed that loop into a circular import: evaluating `mappings/blocks.ts` pulled in the\n// `blocks` barrel, which (before it got to `ComponentBlocks`/`AccountBlock`) loaded\n// `BarchartBlock`, which imported back into the still-initializing `mappings/blocks.ts` —\n// tripping a \"Cannot access 'AccountBlock' before initialization\" TDZ error in Storybook/Vite.\n//\n// Keeping the keys here (no dependency on `mappings/blocks.ts`) lets chart blocks reference\n// them without re-entering that module.\n//\n// Names follow ditto: its registry ends every CTA block in `_block` and the V2 envelope copies those\n// names verbatim (`transaction_details_block`, `contact_support_block`, `make_transfer_block`).\nexport const actionBlocksKey = {\n PLACEHOLDER_ACTION_BLOCK: 'placeholder_block',\n MAKE_TRANSFER_ACTION_BLOCK: 'make_transfer_block',\n TRANSCATION_HISTORY_ACTION_BLOCK: 'transaction_history_block',\n TRANSACTION_DETAILS_ACTION_BLOCK: 'transaction_details_block',\n CONTACT_SUPPORT_ACTION_BLOCK: 'contact_support_block',\n FEEDBACK_MODAL_ACTION_BLOCK: 'feedback_modal_block',\n CONNECTION_DETAIL_ACTION_BLOCK: 'connection_detail_block',\n CONNECT_WIDGET_ACTION_BLOCK: 'connect_widget_block',\n SURVEY_MODAL_ACTION_BLOCK: 'survey_modal_block',\n SUBSCRIPTION_STATUS_MODAL_ACTION_BLOCK: 'subscription_status_modal_block',\n RECURRING_TRANSACTION_ACTION_BLOCK: 'recurring_transaction_block',\n TRANSACTION_LIST_ACTION_BLOCK: 'transaction_list_block',\n REMAINING_CASH_ACTION_BLOCK: 'remaining_cash_block',\n AMOUNT_INPUT_MODAL_ACTION_BLOCK: 'amount_input_modal_block',\n SAFETY_NET_ACTION_BLOCK: 'safety_net_block',\n OVERDRAFT_ACTION_BLOCK: 'transparent_overdraft_block',\n CREDIT_UTILIZATION_ACTION_BLOCK: 'credit_utilization_block',\n EMERGENCY_SAVINGS_ACTION_BLOCK: 'emergency_savings_block',\n PAYOFF_CALCULATOR_ACTION_BLOCK: 'payoff_calculator_block',\n BUDGET_DETAILS_ACTION_BLOCK: 'budget_details_block',\n ACCOUNT_DETAILS_ACTION_BLOCK: 'account_details_block',\n ACCOUNT_LIST_ACTION_BLOCK: 'account_list_block',\n}\n"],"mappings":"AAgBA,IAAa,IAAkB;AAAA,EAC7B,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAC5B,kCAAkC;AAAA,EAClC,kCAAkC;AAAA,EAClC,8BAA8B;AAAA,EAC9B,6BAA6B;AAAA,EAC7B,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,2BAA2B;AAAA,EAC3B,wCAAwC;AAAA,EACxC,oCAAoC;AAAA,EACpC,+BAA+B;AAAA,EAC/B,6BAA6B;AAAA,EAC7B,iCAAiC;AAAA,EACjC,yBAAyB;AAAA,EACzB,wBAAwB;AAAA,EACxB,iCAAiC;AAAA,EACjC,gCAAgC;AAAA,EAChC,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,8BAA8B;AAAA,EAC9B,2BAA2B;AAC7B"}