@mx-cartographer/experiences 9.7.87 → 9.7.88
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.
- package/CHANGELOG.md +6 -0
- package/dist/core/stores/InsightsV2Store.d.ts +2 -2
- package/dist/core/stores/InsightsV2Store.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/index.d.ts +2 -2
- package/dist/insights-v2/ctaActions/runCtaAction.d.ts +7 -1
- package/dist/insights-v2/ctaActions/runCtaAction.es.js +110 -68
- package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/subscriptionAnswer.es.js +53 -49
- package/dist/insights-v2/ctaActions/subscriptionAnswer.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/types.d.ts +6 -2
- package/dist/insights-v2/ctaActions/useCtaAction.es.js.map +1 -1
- package/dist/insights-v2/index.d.ts +2 -2
- package/dist/insights-v2/index.es.js +132 -130
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [9.7.88] - 11-03-2026
|
|
2
|
+
|
|
3
|
+
- **ADDED** - Insights 2.0 `runInDescriptionCta({ beat, stores, hostActions })` for a pinned beat's auto-open (the external flow): runs the micro card action's `action_key` step and opens its block per the runner's rules, with no press analytics, first click or post message. A presenter step acts only while unanswered (an answered subscription opens nothing; its card shows the status), and `atomic_flow` runs with no drawer. It never rejects (failures are reported) and leaves a pending press or an open drawer alone. pulse calls it from `useOpenPinnedInsightAction` (WEC-2017)
|
|
4
|
+
- **FIXED** - An `inDescriptionCta` drawer opener can pass the link's `action_key`, so a survey opened that way saves through its step (Subscription Detected's `user_response`) instead of beat feedback (WEC-2017)
|
|
5
|
+
- **CHANGED** - A CTA step's `prepare` may return a promise; the subscription step shares one in-flight repeating-transactions load (WEC-2017)
|
|
6
|
+
|
|
1
7
|
## [9.7.87] - 11-03-2026
|
|
2
8
|
|
|
3
9
|
- **ADDED** - Storybook QA pages showing every supported size and state for 18 more Insights 2.0 insights, from ditto, tupac and mrs_content, with shared fixture helpers in `mock/BlockBeatsData/widgetBeats.ts` (MEW2-3424)
|
|
@@ -27,8 +27,8 @@ export interface ActionDrawerState {
|
|
|
27
27
|
cta?: DrawerCta;
|
|
28
28
|
}
|
|
29
29
|
export declare const CLOSED_ACTION_DRAWER: ActionDrawerState;
|
|
30
|
-
/**
|
|
31
|
-
export type DrawerCta = Pick<InDescriptionCTA, 'block' | 'variant'>;
|
|
30
|
+
/** What an `inDescriptionCta` opener picks: the block, its variant and step (`action_key`). */
|
|
31
|
+
export type DrawerCta = Pick<InDescriptionCTA, 'block' | 'variant' | 'action_key'>;
|
|
32
32
|
type OpenActionDrawerArgs = {
|
|
33
33
|
guid: string;
|
|
34
34
|
context?: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InsightsV2Store.es.js","names":[],"sources":["../../../src/core/stores/InsightsV2Store.ts"],"sourcesContent":["import { makeAutoObservable } from 'mobx'\n\nimport type { InDescriptionCTA } from '../types/Insights'\n\nimport type { GlobalStore } from './GlobalStore'\n\n// `inDescriptionCta`: the link inside a card's description (`insights_payload.in_description_cta`).\nexport type ActionDrawerTrigger = 'primaryCta' | 'secondaryCta' | 'chartBar' | 'inDescriptionCta'\n\nexport interface ActionDrawerState {\n isDrawerOpen: boolean\n trigger: ActionDrawerTrigger\n guid: string\n /**\n * Block-specific drilldown data for the current drawer SESSION, opaque to the\n * store. Each action block defines and reads its own shape (via\n * useActionContext<T>()). Chart drilldowns put `{ chartBarIndex, tabIndex }`\n * here; CTAs carry none.\n *\n * This is an accumulating bag, not a single owner's value: a nested drawer\n * (e.g. TransactionDetailsBlock opened from a row inside TransactionHistory\n * Block) adds its own key via `setActionContext` ON TOP of whatever the outer\n * drawer already put here, so the outer block's own context survives while the\n * nested block is open. It resets to a clean slate only when a NEW drawer\n * session starts (`openActionDrawer`/`openCtaDrawer`, which fully replace the\n * envelope) — not on every `setActionContext` call.\n */\n context: unknown\n /**\n * Block and variant an `inDescriptionCta` drawer runs; without it the beat's own\n * `in_description_cta` is used. Replaced on each open, kept through close like `trigger`.\n */\n cta?: DrawerCta\n}\n\nexport const CLOSED_ACTION_DRAWER: ActionDrawerState = {\n isDrawerOpen: false,\n trigger: 'primaryCta',\n guid: '',\n context: undefined,\n cta: undefined,\n}\n\n/**
|
|
1
|
+
{"version":3,"file":"InsightsV2Store.es.js","names":[],"sources":["../../../src/core/stores/InsightsV2Store.ts"],"sourcesContent":["import { makeAutoObservable } from 'mobx'\n\nimport type { InDescriptionCTA } from '../types/Insights'\n\nimport type { GlobalStore } from './GlobalStore'\n\n// `inDescriptionCta`: the link inside a card's description (`insights_payload.in_description_cta`).\nexport type ActionDrawerTrigger = 'primaryCta' | 'secondaryCta' | 'chartBar' | 'inDescriptionCta'\n\nexport interface ActionDrawerState {\n isDrawerOpen: boolean\n trigger: ActionDrawerTrigger\n guid: string\n /**\n * Block-specific drilldown data for the current drawer SESSION, opaque to the\n * store. Each action block defines and reads its own shape (via\n * useActionContext<T>()). Chart drilldowns put `{ chartBarIndex, tabIndex }`\n * here; CTAs carry none.\n *\n * This is an accumulating bag, not a single owner's value: a nested drawer\n * (e.g. TransactionDetailsBlock opened from a row inside TransactionHistory\n * Block) adds its own key via `setActionContext` ON TOP of whatever the outer\n * drawer already put here, so the outer block's own context survives while the\n * nested block is open. It resets to a clean slate only when a NEW drawer\n * session starts (`openActionDrawer`/`openCtaDrawer`, which fully replace the\n * envelope) — not on every `setActionContext` call.\n */\n context: unknown\n /**\n * Block and variant an `inDescriptionCta` drawer runs; without it the beat's own\n * `in_description_cta` is used. Replaced on each open, kept through close like `trigger`.\n */\n cta?: DrawerCta\n}\n\nexport const CLOSED_ACTION_DRAWER: ActionDrawerState = {\n isDrawerOpen: false,\n trigger: 'primaryCta',\n guid: '',\n context: undefined,\n cta: undefined,\n}\n\n/** What an `inDescriptionCta` opener picks: the block, its variant and step (`action_key`). */\nexport type DrawerCta = Pick<InDescriptionCTA, 'block' | 'variant' | 'action_key'>\n\n// Only the `inDescriptionCta` trigger accepts a `cta`.\ntype OpenActionDrawerArgs = {\n guid: string\n context?: unknown\n} & (\n | { trigger: 'inDescriptionCta'; cta?: DrawerCta }\n | { trigger: Exclude<ActionDrawerTrigger, 'inDescriptionCta'>; cta?: never }\n)\n\n/** Lifecycle of a beat's CTA action (see insights-v2/ctaActions), keyed by beat guid. */\nexport type CtaStatus = 'pending' | 'done' | 'error'\n\n/**\n * UI state shared across the insights-v2 widget tree. Owns the action drawer so\n * cards, charts, and action blocks coordinate through the store instead of prop\n * drilling. The drawer state is a fixed envelope (isDrawerOpen/guid/trigger) plus\n * an opaque `context` bag, so per-block drilldown data never leaks into this shape.\n */\nexport class InsightsV2Store {\n globalStore: GlobalStore\n\n actionDrawer: ActionDrawerState = CLOSED_ACTION_DRAWER\n\n /**\n * CTA action status per beat guid. Keyed by guid (not block) so a block shared by many\n * insights never reflects another card's pending or error state.\n */\n ctaStatus: Record<string, CtaStatus> = {}\n\n /**\n * Per-beat scratch input collected on the card or in its blocks (e.g. the account a user\n * picked before pressing Save), keyed by beat guid. Unlike `actionDrawer.context`, which is\n * replaced whenever any drawer session starts, this survives other cards' drawers opening.\n * CTA steps read it via `disabledWhen` and their `params` callback (`beatContextOf`). Ships\n * ahead of its first block writer (Designate's account picker) on purpose: it is the layer's\n * only way to keep a pick alive across other cards' drawer sessions.\n */\n beatContext: Record<string, Record<string, unknown>> = {}\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n\n makeAutoObservable(this)\n }\n\n setCtaStatus = (guid: string, status: CtaStatus) => {\n this.ctaStatus = { ...this.ctaStatus, [guid]: status }\n }\n\n /** Merges `values` into the beat's scratch input. */\n setBeatContext = (guid: string, values: Record<string, unknown>) => {\n this.beatContext = { ...this.beatContext, [guid]: { ...this.beatContext[guid], ...values } }\n }\n\n /**\n * Merges keys into the current drawer session's context bag — it does NOT\n * replace it. A nested drawer (e.g. a row click inside TransactionHistoryBlock\n * opening TransactionDetailsBlock) calls this to layer its own key (e.g.\n * `transaction_guid`) on top of whatever context the outer drawer already set\n * (e.g. `chartBarIndex`), so the outer block keeps reading its own keys via\n * useActionContext while the nested block is open. The bag only returns to a\n * clean slate when a new drawer session starts via `openActionDrawer`/\n * `openCtaDrawer`, which fully replace the envelope.\n */\n setActionContext = (context: Record<string, unknown>) => {\n this.actionDrawer = {\n ...this.actionDrawer,\n context: {\n ...(this.actionDrawer.context as Record<string, unknown> | undefined),\n ...context,\n },\n }\n }\n\n /**\n * Generic drawer opener — the only opener a new action block needs. Pass the\n * beat guid, the CTA/source that triggered it, and (optionally) a block-specific\n * context object the block reads back via useActionContext. `cta` overrides the CTA an\n * `inDescriptionCta` drawer runs, for this session only.\n */\n openActionDrawer = ({ guid, trigger, context, cta }: OpenActionDrawerArgs) => {\n this.actionDrawer = { isDrawerOpen: true, trigger, guid, context, cta }\n }\n\n /** Convenience opener for CTA drawers (no drilldown context). */\n openCtaDrawer = (guid: string, trigger: 'primaryCta' | 'secondaryCta') => {\n this.openActionDrawer({ guid, trigger })\n }\n\n closeActionDrawer = () => {\n // Preserve `trigger`, `context` and `cta` so the drawer keeps its variant-specific\n // title/content through the slide-out animation (ActionBlockLayer stays\n // mounted while closing). Only flip isDrawerOpen off and clear the beat guid.\n this.actionDrawer = { ...this.actionDrawer, isDrawerOpen: false, guid: '' }\n }\n}\n"],"mappings":";AAmCA,IAAa,IAA0C;AAAA,EACrD,cAAc;AAAA,EACd,SAAS;AAAA,EACT,MAAM;AAAA,EACN,SAAS;AAAA,EACT,KAAK;AACP,GAuBa,IAAb,MAA6B;AAAA,EAC3B;AAAA,EAEA,eAAkC;AAAA,EAMlC,YAAuC,CAAC;AAAA,EAUxC,cAAuD,CAAC;AAAA,EAExD,YAAY,GAA0B;AACpC,SAAK,cAAc,GAEnB,EAAmB,IAAI;AAAA,EACzB;AAAA,EAEA,eAAA,CAAgB,GAAc,MAAsB;AAClD,SAAK,YAAY;AAAA,MAAE,GAAG,KAAK;AAAA,MAAY,CAAA,CAAA,GAAO;AAAA,IAAO;AAAA,EACvD;AAAA,EAGA,iBAAA,CAAkB,GAAc,MAAoC;AAClE,SAAK,cAAc;AAAA,MAAE,GAAG,KAAK;AAAA,MAAc,CAAA,CAAA,GAAO;AAAA,QAAE,GAAG,KAAK,YAAY,CAAA;AAAA,QAAO,GAAG;AAAA,MAAO;AAAA,IAAE;AAAA,EAC7F;AAAA,EAYA,mBAAA,CAAoB,MAAqC;AACvD,SAAK,eAAe;AAAA,MAClB,GAAG,KAAK;AAAA,MACR,SAAS;AAAA,QACP,GAAI,KAAK,aAAa;AAAA,QACtB,GAAG;AAAA,MACL;AAAA,IACF;AAAA,EACF;AAAA,EAQA,mBAAA,CAAoB,EAAE,MAAA,GAAM,SAAA,GAAS,SAAA,GAAS,KAAA,EAAA,MAAgC;AAC5E,SAAK,eAAe;AAAA,MAAE,cAAc;AAAA,MAAM,SAAA;AAAA,MAAS,MAAA;AAAA,MAAM,SAAA;AAAA,MAAS,KAAA;AAAA,IAAI;AAAA,EACxE;AAAA,EAGA,gBAAA,CAAiB,GAAc,MAA2C;AACxE,SAAK,iBAAiB;AAAA,MAAE,MAAA;AAAA,MAAM,SAAA;AAAA,IAAQ,CAAC;AAAA,EACzC;AAAA,EAEA,oBAAA,MAA0B;AAIxB,SAAK,eAAe;AAAA,MAAE,GAAG,KAAK;AAAA,MAAc,cAAc;AAAA,MAAO,MAAM;AAAA,IAAG;AAAA,EAC5E;AACF"}
|
|
@@ -2,6 +2,6 @@ export { ctaActions } from './ctaConfig';
|
|
|
2
2
|
export { ctaHandlers, type CtaHandlerName } from './ctaHandlers';
|
|
3
3
|
export { ctaPostMessages, resolveCtaMetadata, type CtaPostMessageResolver } from './ctaPostMessages';
|
|
4
4
|
export { HOST_ACTIONS, type HostActionName } from './hostActions';
|
|
5
|
-
export { beatContextOf, reportCtaClick, resolveCtaState, resolveStep, runCtaAction, runCtaHandler, sendCtaAnalytics, } from './runCtaAction';
|
|
5
|
+
export { beatContextOf, reportCtaClick, resolveCtaState, resolveStep, runCtaAction, runCtaHandler, runInDescriptionCta, sendCtaAnalytics, } from './runCtaAction';
|
|
6
6
|
export { useBeatCtaActions, useCtaHandler, type BeatCtaActions } from './useCtaAction';
|
|
7
|
-
export type { CtaContext, CtaEffect, CtaHandler, CtaHandlerContext, CtaParams, CtaPresentation, CtaSurveyAnswer, CtaSlot, CtaState, CtaStateContext, CtaStep, RunHandlerOptions, } from './types';
|
|
7
|
+
export type { CtaContext, CtaEffect, CtaHandler, CtaHandlerContext, CtaParams, CtaPresentation, CtaSurveyAnswer, CtaSlot, CtaState, CtaStateContext, CtaStep, RunHandlerOptions, RunInDescriptionCtaArgs, } from './types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnalyticsEventConfigEntry } from '../analytics/analyticsEventsConfig';
|
|
2
2
|
import { CtaHandlerName } from './ctaHandlers';
|
|
3
|
-
import { CtaContext, CtaHandlerContext, CtaState, CtaStateContext, CtaStep, RunHandlerOptions } from './types';
|
|
3
|
+
import { CtaContext, CtaHandlerContext, CtaState, CtaStateContext, CtaStep, RunHandlerOptions, RunInDescriptionCtaArgs } from './types';
|
|
4
4
|
/** The beat's own context (input a block collected for it), `{}` until something is written. */
|
|
5
5
|
export declare const beatContextOf: ({ beat, stores }: Pick<CtaStateContext, "beat" | "stores">) => Record<string, unknown>;
|
|
6
6
|
/** The step named by the CTA's `action_key`, or the empty default (no key / unknown key). */
|
|
@@ -30,6 +30,12 @@ export declare const reportCtaClick: (ctx: AnalyticsCtx & Pick<CtaContext, "slot
|
|
|
30
30
|
skipCtaClicked?: boolean;
|
|
31
31
|
}) => void;
|
|
32
32
|
export declare const runCtaAction: (ctx: CtaContext) => Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* A pinned beat's auto-open: runs the card action's (`in_description_cta`) step and opens its block,
|
|
35
|
+
* with no press analytics or post message. Does nothing while the step shows a status (e.g. an
|
|
36
|
+
* answered subscription), nothing or a disabled button. Never rejects: failures are reported.
|
|
37
|
+
*/
|
|
38
|
+
export declare const runInDescriptionCta: ({ beat, stores, hostActions, }: RunInDescriptionCtaArgs) => Promise<void>;
|
|
33
39
|
/** Runs a handler directly (drawer Save buttons). True on success. */
|
|
34
40
|
export declare const runCtaHandler: (ctx: CtaHandlerContext, handlerName: CtaHandlerName, { onSuccess, analytics }?: RunHandlerOptions) => Promise<boolean>;
|
|
35
41
|
export {};
|
|
@@ -1,106 +1,148 @@
|
|
|
1
|
-
import { sendBeatCta as
|
|
2
|
-
import { ANALYTICS_EVENTS_CONFIG as
|
|
3
|
-
import { resolveAnalyticsEvent as
|
|
4
|
-
import { HOST_ACTIONS as
|
|
5
|
-
import { ctaHandlers as
|
|
6
|
-
import { ctaActions as
|
|
7
|
-
import { resolveCtaMetadata as
|
|
8
|
-
import { hasDrawerBlock as
|
|
9
|
-
var
|
|
10
|
-
const a =
|
|
1
|
+
import { sendBeatCta as y } from "../../common/utils/PostMessage.es.js";
|
|
2
|
+
import { ANALYTICS_EVENTS_CONFIG as p } from "../analytics/analyticsEventsConfig.es.js";
|
|
3
|
+
import { resolveAnalyticsEvent as g } from "../analytics/resolveAnalyticsEvent.es.js";
|
|
4
|
+
import { HOST_ACTIONS as h } from "./hostActions.es.js";
|
|
5
|
+
import { ctaHandlers as w } from "./ctaHandlers.es.js";
|
|
6
|
+
import { ctaActions as S } from "./ctaConfig.es.js";
|
|
7
|
+
import { resolveCtaMetadata as A } from "./ctaPostMessages.es.js";
|
|
8
|
+
import { hasDrawerBlock as k } from "../mappings/hasDrawerBlock.es.js";
|
|
9
|
+
var E = {}, l = ({ cta: t }) => t.action_key && S[t.action_key] || E, D = (t) => {
|
|
10
|
+
const a = l(t), e = t.stores.insightsV2Store.ctaStatus[t.beat.guid] === "pending", r = a.presenter?.(t);
|
|
11
11
|
return {
|
|
12
|
-
disabled:
|
|
13
|
-
...
|
|
12
|
+
disabled: e || (a.disabledWhen?.(t) ?? !1),
|
|
13
|
+
...r && { presentation: r }
|
|
14
14
|
};
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
const { is_mobile_webview:
|
|
19
|
-
|
|
15
|
+
}, T = ({ beat: t, slot: a, stores: e }) => {
|
|
16
|
+
e.insightsV2Store.openCtaDrawer(t.guid, a === "primary" ? "primaryCta" : "secondaryCta");
|
|
17
|
+
}, b = ({ beat: t, stores: a }, e) => {
|
|
18
|
+
const { is_mobile_webview: r, clientConfig: n } = a.appDataStore.appConfig, { event: i, action: s, payload: c } = e;
|
|
19
|
+
y(t, {
|
|
20
20
|
event: i ?? void 0,
|
|
21
|
-
op:
|
|
22
|
-
extras:
|
|
23
|
-
isMobileWebview:
|
|
24
|
-
webviewScheme:
|
|
21
|
+
op: s ?? void 0,
|
|
22
|
+
extras: c ?? void 0,
|
|
23
|
+
isMobileWebview: r,
|
|
24
|
+
webviewScheme: n?.master?.ui_message_webview_url_scheme,
|
|
25
25
|
userGuid: t.insights_payload?.user_guid ?? t.user_guid
|
|
26
26
|
});
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
}, m = (t, a) => {
|
|
28
|
+
const e = t.next ?? (t.run ? "none" : "default");
|
|
29
|
+
return e === "drawer" || e === "default" && k(a.block);
|
|
30
|
+
}, I = (t, { beat: a, stores: e }) => {
|
|
31
|
+
t === "refreshBeat" && e.emitUpdate({ staleBeatGuid: a.guid });
|
|
31
32
|
}, o = (t, a) => {
|
|
32
33
|
try {
|
|
33
|
-
t.hostActions.onAnalyticsEvent?.(
|
|
34
|
-
} catch (
|
|
35
|
-
t.stores.captureException(
|
|
34
|
+
t.hostActions.onAnalyticsEvent?.(g(a, t.beat));
|
|
35
|
+
} catch (e) {
|
|
36
|
+
t.stores.captureException(e, {
|
|
36
37
|
store: "ctaActions",
|
|
37
38
|
template: t.beat.template,
|
|
38
39
|
handler: "sendCtaAnalytics"
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
|
-
},
|
|
42
|
-
const { beat: a, slot:
|
|
43
|
-
|
|
42
|
+
}, O = (t) => {
|
|
43
|
+
const { beat: a, slot: e, hostActions: r, stores: n } = t;
|
|
44
|
+
e !== "primary" || a.cta_clicked_at || (o(t, p.FIRST_TIME_PRIMARY_ACTION_SELECTED), Promise.resolve().then(() => r.onCtaAction?.({
|
|
44
45
|
beatGuid: a.guid,
|
|
45
|
-
name:
|
|
46
|
-
})).catch((i) =>
|
|
46
|
+
name: h.markCtaClicked
|
|
47
|
+
})).catch((i) => n.captureException(i, {
|
|
47
48
|
store: "ctaActions",
|
|
48
49
|
template: a.template,
|
|
49
50
|
handler: "markCtaClicked"
|
|
50
51
|
})));
|
|
51
|
-
},
|
|
52
|
-
o(t, t.slot === "primary" ?
|
|
53
|
-
},
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
56
|
-
await
|
|
57
|
-
for (const
|
|
58
|
-
}, d = async ({ beat: t, stores: a },
|
|
59
|
-
const { insightsV2Store:
|
|
60
|
-
|
|
52
|
+
}, R = (t, { skipCtaClicked: a = !1 } = {}) => {
|
|
53
|
+
o(t, t.slot === "primary" ? p.PRIMARY_ACTION_SELECTED : p.SECONDARY_ACTION_SELECTED), a || O(t);
|
|
54
|
+
}, u = async (t, a, e) => {
|
|
55
|
+
const r = w[a];
|
|
56
|
+
if (!r) throw new Error(`Unknown CTA handler "${a}"`);
|
|
57
|
+
await r(t);
|
|
58
|
+
for (const n of e) I(n, t);
|
|
59
|
+
}, d = async ({ beat: t, stores: a }, e, r = {}) => {
|
|
60
|
+
const { insightsV2Store: n } = a;
|
|
61
|
+
n.setCtaStatus(t.guid, "pending");
|
|
61
62
|
try {
|
|
62
|
-
return await
|
|
63
|
+
return await e(), n.setCtaStatus(t.guid, "done"), !0;
|
|
63
64
|
} catch (i) {
|
|
64
|
-
return
|
|
65
|
+
return n.setCtaStatus(t.guid, "error"), a.captureException(i, {
|
|
65
66
|
store: "ctaActions",
|
|
66
67
|
template: t.template,
|
|
67
|
-
...
|
|
68
|
+
...r
|
|
68
69
|
}), !1;
|
|
69
70
|
}
|
|
70
|
-
},
|
|
71
|
-
const
|
|
72
|
-
|
|
71
|
+
}, C = (t, a) => {
|
|
72
|
+
const e = typeof t.params == "function" ? t.params(a) : t.params;
|
|
73
|
+
return {
|
|
74
|
+
...a,
|
|
73
75
|
params: {
|
|
74
|
-
...
|
|
75
|
-
...
|
|
76
|
+
...e,
|
|
77
|
+
...a.params
|
|
76
78
|
}
|
|
77
79
|
};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
80
|
+
}, Y = async (t) => {
|
|
81
|
+
const a = l(t), e = C(a, t);
|
|
82
|
+
R(e, { skipCtaClicked: a.skipCtaClicked }), await d(e, async () => {
|
|
83
|
+
a.run && await u(e, a.run, a.onSuccess ?? []), a.analytics && o(e, a.analytics);
|
|
84
|
+
const r = A(e);
|
|
85
|
+
r && b(e, r), m(a, e.cta) && T(e);
|
|
84
86
|
});
|
|
85
|
-
},
|
|
87
|
+
}, U = async ({ beat: t, stores: a, hostActions: e = {} }) => {
|
|
88
|
+
const r = t.insights_payload?.in_description_cta;
|
|
89
|
+
if (!r) return;
|
|
90
|
+
const n = {
|
|
91
|
+
...r,
|
|
92
|
+
block: r.block ?? ""
|
|
93
|
+
}, i = l({ cta: n });
|
|
94
|
+
try {
|
|
95
|
+
const s = C(i, {
|
|
96
|
+
beat: t,
|
|
97
|
+
cta: n,
|
|
98
|
+
slot: "primary",
|
|
99
|
+
stores: a,
|
|
100
|
+
hostActions: e,
|
|
101
|
+
params: {}
|
|
102
|
+
});
|
|
103
|
+
await i.prepare?.(s);
|
|
104
|
+
const { disabled: c, presentation: f } = D(s);
|
|
105
|
+
if (c || f) return;
|
|
106
|
+
if (i.run) {
|
|
107
|
+
const { run: v, onSuccess: _ = [] } = i;
|
|
108
|
+
if (!await d(s, () => u(s, v, _))) return;
|
|
109
|
+
}
|
|
110
|
+
m(i, n) && !a.insightsV2Store.actionDrawer.isDrawerOpen && a.insightsV2Store.openActionDrawer({
|
|
111
|
+
guid: t.guid,
|
|
112
|
+
trigger: "inDescriptionCta",
|
|
113
|
+
cta: {
|
|
114
|
+
block: n.block,
|
|
115
|
+
variant: n.variant,
|
|
116
|
+
action_key: n.action_key
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
} catch (s) {
|
|
120
|
+
a.captureException(s, {
|
|
121
|
+
store: "ctaActions",
|
|
122
|
+
template: t.template,
|
|
123
|
+
handler: "runInDescriptionCta"
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}, M = {
|
|
86
127
|
label: "",
|
|
87
128
|
block: ""
|
|
88
|
-
},
|
|
89
|
-
const
|
|
129
|
+
}, W = (t, a, { onSuccess: e = [], analytics: r } = {}) => {
|
|
130
|
+
const n = {
|
|
90
131
|
...t,
|
|
91
|
-
cta:
|
|
132
|
+
cta: M,
|
|
92
133
|
slot: "primary"
|
|
93
134
|
};
|
|
94
|
-
return d(
|
|
95
|
-
await
|
|
135
|
+
return d(n, async () => {
|
|
136
|
+
await u(n, a, e), r && o(n, r);
|
|
96
137
|
}, { handler: a });
|
|
97
138
|
};
|
|
98
139
|
export {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
140
|
+
R as reportCtaClick,
|
|
141
|
+
D as resolveCtaState,
|
|
142
|
+
l as resolveStep,
|
|
143
|
+
Y as runCtaAction,
|
|
144
|
+
W as runCtaHandler,
|
|
145
|
+
U as runInDescriptionCta,
|
|
104
146
|
o as sendCtaAnalytics
|
|
105
147
|
};
|
|
106
148
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runCtaAction.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/runCtaAction.ts"],"sourcesContent":["import { sendBeatCta } from '../../common/utils/PostMessage'\nimport {\n ANALYTICS_EVENTS_CONFIG,\n type AnalyticsEventConfigEntry,\n} from '../analytics/analyticsEventsConfig'\nimport { resolveAnalyticsEvent } from '../analytics/resolveAnalyticsEvent'\nimport { hasDrawerBlock } from '../mappings/hasDrawerBlock'\nimport { ctaActions } from './ctaConfig'\nimport { resolveCtaMetadata } from './ctaPostMessages'\nimport { ctaHandlers, type CtaHandlerName } from './ctaHandlers'\nimport { HOST_ACTIONS } from './hostActions'\nimport type { CtaPostMessageMetadata } from '../../core'\nimport type {\n CtaContext,\n CtaEffect,\n CtaHandler,\n CtaHandlerContext,\n CtaState,\n CtaStateContext,\n CtaStep,\n RunHandlerOptions,\n} from './types'\n\nconst DEFAULT_STEP: CtaStep = {}\n\n// ─── Resolution ─────────────────────────────────────────────────────────────\n\n/** The beat's own context (input a block collected for it), `{}` until something is written. */\nexport const beatContextOf = ({ beat, stores }: Pick<CtaStateContext, 'beat' | 'stores'>) =>\n stores.insightsV2Store.beatContext[beat.guid] ?? {}\n\n/** The step named by the CTA's `action_key`, or the empty default (no key / unknown key). */\nexport const resolveStep = ({ cta }: { cta: { action_key?: string | null } }): CtaStep =>\n (cta.action_key && ctaActions[cta.action_key]) || DEFAULT_STEP\n\n/** Pending always disables, as may the step's `disabledWhen`; its `presenter` may replace the button. */\nexport const resolveCtaState = (ctx: CtaStateContext): CtaState => {\n const step = resolveStep(ctx)\n const pending = ctx.stores.insightsV2Store.ctaStatus[ctx.beat.guid] === 'pending'\n const presentation = step.presenter?.(ctx)\n\n return {\n disabled: pending || (step.disabledWhen?.(ctx) ?? false),\n ...(presentation && { presentation }),\n }\n}\n\n// ─── Targets and effects ────────────────────────────────────────────────────\n\n/** Opens the beat's drawer for whichever slot triggered the current step. */\nconst openDrawerForSlot = ({\n beat,\n slot,\n stores,\n}: Pick<CtaContext, 'beat' | 'slot' | 'stores'>) => {\n stores.insightsV2Store.openCtaDrawer(\n beat.guid,\n slot === 'primary' ? 'primaryCta' : 'secondaryCta',\n )\n}\n\n/**\n * Posts this CTA's resolved message (event, op and beat-specific payload, from the backend's\n * `cta.metadata` or the template's `ctaPostMessages` entry) to the host.\n */\nconst postCtaMessage = ({ beat, stores }: CtaContext, metadata: CtaPostMessageMetadata) => {\n const { is_mobile_webview, clientConfig } = stores.appDataStore.appConfig\n const { event, action, payload } = metadata\n\n sendBeatCta(beat, {\n event: event ?? undefined,\n op: action ?? undefined,\n extras: payload ?? undefined,\n isMobileWebview: is_mobile_webview,\n webviewScheme: clientConfig?.master?.ui_message_webview_url_scheme,\n userGuid: beat.insights_payload?.user_guid ?? beat.user_guid,\n })\n}\n\n/**\n * Default target: open the drawer for a real block, otherwise nothing. A post message is never\n * implied by a missing block; it is sent only when one resolves (see runCtaAction).\n */\nconst runDefaultTarget = (ctx: CtaContext) => {\n if (hasDrawerBlock(ctx.cta.block)) openDrawerForSlot(ctx)\n}\n\nconst runEffect = (effect: CtaEffect, { beat, stores }: CtaContext) => {\n switch (effect) {\n case 'refreshBeat':\n stores.emitUpdate({ staleBeatGuid: beat.guid })\n break\n }\n}\n\ntype AnalyticsCtx = Pick<CtaContext, 'beat' | 'stores' | 'hostActions'>\n\n/**\n * The one way to fire a catalogued analytics event. Takes the catalogue entry itself (e.g.\n * `ANALYTICS_EVENTS_CONFIG.PRIMARY_ACTION_SELECTED`), not a lookup key — the call site already\n * has the entry via property access, so there is no key to look up or mistype. Resolves the\n * payload and hands it to the host directly. Never throws: a failed fire is captured, it\n * cannot fail or disable anything.\n */\nexport const sendCtaAnalytics = (ctx: AnalyticsCtx, event: AnalyticsEventConfigEntry): void => {\n try {\n ctx.hostActions.onAnalyticsEvent?.(resolveAnalyticsEvent(event, ctx.beat))\n } catch (error) {\n ctx.stores.captureException(error, {\n store: 'ctaActions',\n template: ctx.beat.template,\n handler: 'sendCtaAnalytics',\n })\n }\n}\n\n// First primary click: fires FIRST_TIME_PRIMARY_ACTION_SELECTED and records cta_clicked_at.\nconst markCtaClicked = (ctx: AnalyticsCtx & Pick<CtaContext, 'slot'>): void => {\n const { beat, slot, hostActions, stores } = ctx\n\n if (slot !== 'primary' || beat.cta_clicked_at) return\n\n sendCtaAnalytics(ctx, ANALYTICS_EVENTS_CONFIG.FIRST_TIME_PRIMARY_ACTION_SELECTED)\n\n // Fire-and-forget; a failed write must not fail the user's action, but still report it.\n Promise.resolve()\n .then(() =>\n hostActions.onCtaAction?.({ beatGuid: beat.guid, name: HOST_ACTIONS.markCtaClicked }),\n )\n .catch((error) =>\n stores.captureException(error, {\n store: 'ctaActions',\n template: beat.template,\n handler: 'markCtaClicked',\n }),\n )\n}\n\n/**\n * Trigger 1 + the first-click bookkeeping together: every CTA press's generic analytics\n * (`Primary/Secondary Action Selected`), plus `FIRST_TIME_PRIMARY_ACTION_SELECTED` /\n * `cta_clicked_at` on the first primary press. The one call site for \"a CTA got pressed\",\n * used by the runner and by the contact-support bypass in `BaseLayout`.\n */\nexport const reportCtaClick = (\n ctx: AnalyticsCtx & Pick<CtaContext, 'slot'>,\n { skipCtaClicked = false }: { skipCtaClicked?: boolean } = {},\n): void => {\n sendCtaAnalytics(\n ctx,\n ctx.slot === 'primary'\n ? ANALYTICS_EVENTS_CONFIG.PRIMARY_ACTION_SELECTED\n : ANALYTICS_EVENTS_CONFIG.SECONDARY_ACTION_SELECTED,\n )\n\n if (!skipCtaClicked) markCtaClicked(ctx)\n}\n\n// ─── Shared bookkeeping ─────────────────────────────────────────────────────\n\n/** Runs a named handler, then its `onSuccess` effects. Shared by card CTAs and drawer saves. */\nconst runHandlerWithEffects = async (\n ctx: CtaContext,\n handlerName: CtaHandlerName,\n onSuccess: CtaEffect[],\n): Promise<void> => {\n // Names are typed, but the map is still indexed defensively: config can come from anywhere.\n const handler = (ctaHandlers as Record<string, CtaHandler>)[handlerName]\n\n if (!handler) throw new Error(`Unknown CTA handler \"${handlerName}\"`)\n\n await handler(ctx)\n\n for (const effect of onSuccess) runEffect(effect, ctx)\n}\n\n/** Per-beat status around `work`: `pending` -> `done` | `error` (+ captureException). */\nconst withCtaStatus = async (\n { beat, stores }: Pick<CtaContext, 'beat' | 'stores'>,\n work: () => Promise<void>,\n captureContext: Record<string, string> = {},\n): Promise<boolean> => {\n const { insightsV2Store } = stores\n\n insightsV2Store.setCtaStatus(beat.guid, 'pending')\n\n try {\n await work()\n insightsV2Store.setCtaStatus(beat.guid, 'done')\n\n return true\n } catch (error) {\n insightsV2Store.setCtaStatus(beat.guid, 'error')\n stores.captureException(error, {\n store: 'ctaActions',\n template: beat.template,\n ...captureContext,\n })\n\n return false\n }\n}\n\n// ─── Entry points ───────────────────────────────────────────────────────────\n\n// Runs the CTA's step: handler, onSuccess effects, post message, then the next target.\nexport const runCtaAction = async (ctx: CtaContext): Promise<void> => {\n const step = resolveStep(ctx)\n const stepParams = typeof step.params === 'function' ? step.params(ctx) : step.params\n const stepCtx: CtaContext = { ...ctx, params: { ...stepParams, ...ctx.params } }\n\n reportCtaClick(stepCtx, { skipCtaClicked: step.skipCtaClicked })\n\n await withCtaStatus(stepCtx, async () => {\n if (step.run) await runHandlerWithEffects(stepCtx, step.run, step.onSuccess ?? [])\n\n // A step's own event, e.g. select_savings_account (Saved) / open_savings_account (Created).\n if (step.analytics) sendCtaAnalytics(stepCtx, step.analytics)\n\n const metadata = resolveCtaMetadata(stepCtx)\n\n if (metadata) postCtaMessage(stepCtx, metadata)\n\n const target = step.next ?? (step.run ? 'none' : 'default')\n\n if (target === 'default') runDefaultTarget(stepCtx)\n else if (target === 'drawer') openDrawerForSlot(stepCtx)\n })\n}\n\n/** Placeholder CTA for handlers run from inside a drawer, where no card slot is involved. */\nconst DIRECT_CTA = { label: '', block: '' }\n\n/** Runs a handler directly (drawer Save buttons). True on success. */\nexport const runCtaHandler = (\n ctx: CtaHandlerContext,\n handlerName: CtaHandlerName,\n { onSuccess = [], analytics }: RunHandlerOptions = {},\n): Promise<boolean> => {\n const fullCtx: CtaContext = { ...ctx, cta: DIRECT_CTA, slot: 'primary' }\n\n return withCtaStatus(\n fullCtx,\n async () => {\n await runHandlerWithEffects(fullCtx, handlerName, onSuccess)\n\n // Success-time analytics for drawer Saves.\n if (analytics) sendCtaAnalytics(fullCtx, analytics)\n },\n { handler: handlerName },\n )\n}\n"],"mappings":";;;;;;;;AAuBA,IAAM,IAAwB,CAAC,GASlB,IAAA,CAAe,EAAE,KAAA,EAAA,MAC3B,EAAI,cAAc,EAAW,EAAI,UAAA,KAAgB,GAGvC,IAAA,CAAmB,MAAmC;AACjE,QAAM,IAAO,EAAY,CAAG,GACtB,IAAU,EAAI,OAAO,gBAAgB,UAAU,EAAI,KAAK,IAAA,MAAU,WAClE,IAAe,EAAK,YAAY,CAAG;AAEzC,SAAO;AAAA,IACL,UAAU,MAAY,EAAK,eAAe,CAAG,KAAK;AAAA,IAClD,GAAI,KAAgB,EAAE,cAAA,EAAa;AAAA,EACrC;AACF,GAKM,IAAA,CAAqB,EACzB,MAAA,GACA,MAAA,GACA,QAAA,EAAA,MACkD;AAClD,EAAA,EAAO,gBAAgB,cACrB,EAAK,MACL,MAAS,YAAY,eAAe,cACtC;AACF,GAMM,IAAA,CAAkB,EAAE,MAAA,GAAM,QAAA,EAAA,GAAsB,MAAqC;AACzF,QAAM,EAAE,mBAAA,GAAmB,cAAA,EAAA,IAAiB,EAAO,aAAa,WAC1D,EAAE,OAAA,GAAO,QAAA,GAAQ,SAAA,EAAA,IAAY;AAEnC,EAAA,EAAY,GAAM;AAAA,IAChB,OAAO,KAAS;AAAA,IAChB,IAAI,KAAU;AAAA,IACd,QAAQ,KAAW;AAAA,IACnB,iBAAiB;AAAA,IACjB,eAAe,GAAc,QAAQ;AAAA,IACrC,UAAU,EAAK,kBAAkB,aAAa,EAAK;AAAA,EACrD,CAAC;AACH,GAMM,IAAA,CAAoB,MAAoB;AAC5C,EAAI,EAAe,EAAI,IAAI,KAAK,KAAG,EAAkB,CAAG;AAC1D,GAEM,IAAA,CAAa,GAAmB,EAAE,MAAA,GAAM,QAAA,EAAA,MAAyB;AACrE,EAAQ,MACD,iBACH,EAAO,WAAW,EAAE,eAAe,EAAK,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a,CAAS,GAGvD,KAAW,EAAiB,GAAS,CAAS;AAAA,EACpD,GACA,EAAE,SAAS,EAAY,CACzB;AACF"}
|
|
1
|
+
{"version":3,"file":"runCtaAction.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/runCtaAction.ts"],"sourcesContent":["import { sendBeatCta } from '../../common/utils/PostMessage'\nimport {\n ANALYTICS_EVENTS_CONFIG,\n type AnalyticsEventConfigEntry,\n} from '../analytics/analyticsEventsConfig'\nimport { resolveAnalyticsEvent } from '../analytics/resolveAnalyticsEvent'\nimport { hasDrawerBlock } from '../mappings/hasDrawerBlock'\nimport { ctaActions } from './ctaConfig'\nimport { resolveCtaMetadata } from './ctaPostMessages'\nimport { ctaHandlers, type CtaHandlerName } from './ctaHandlers'\nimport { HOST_ACTIONS } from './hostActions'\nimport type { CtaPostMessageMetadata } from '../../core'\nimport type {\n CtaContext,\n CtaEffect,\n CtaHandler,\n CtaHandlerContext,\n CtaState,\n CtaStateContext,\n CtaStep,\n RunHandlerOptions,\n RunInDescriptionCtaArgs,\n} from './types'\n\nconst DEFAULT_STEP: CtaStep = {}\n\n// ─── Resolution ─────────────────────────────────────────────────────────────\n\n/** The beat's own context (input a block collected for it), `{}` until something is written. */\nexport const beatContextOf = ({ beat, stores }: Pick<CtaStateContext, 'beat' | 'stores'>) =>\n stores.insightsV2Store.beatContext[beat.guid] ?? {}\n\n/** The step named by the CTA's `action_key`, or the empty default (no key / unknown key). */\nexport const resolveStep = ({ cta }: { cta: { action_key?: string | null } }): CtaStep =>\n (cta.action_key && ctaActions[cta.action_key]) || DEFAULT_STEP\n\n/** Pending always disables, as may the step's `disabledWhen`; its `presenter` may replace the button. */\nexport const resolveCtaState = (ctx: CtaStateContext): CtaState => {\n const step = resolveStep(ctx)\n const pending = ctx.stores.insightsV2Store.ctaStatus[ctx.beat.guid] === 'pending'\n const presentation = step.presenter?.(ctx)\n\n return {\n disabled: pending || (step.disabledWhen?.(ctx) ?? false),\n ...(presentation && { presentation }),\n }\n}\n\n// ─── Targets and effects ────────────────────────────────────────────────────\n\n/** Opens the beat's drawer for whichever slot triggered the current step. */\nconst openDrawerForSlot = ({\n beat,\n slot,\n stores,\n}: Pick<CtaContext, 'beat' | 'slot' | 'stores'>) => {\n stores.insightsV2Store.openCtaDrawer(\n beat.guid,\n slot === 'primary' ? 'primaryCta' : 'secondaryCta',\n )\n}\n\n/**\n * Posts this CTA's resolved message (event, op and beat-specific payload, from the backend's\n * `cta.metadata` or the template's `ctaPostMessages` entry) to the host.\n */\nconst postCtaMessage = ({ beat, stores }: CtaContext, metadata: CtaPostMessageMetadata) => {\n const { is_mobile_webview, clientConfig } = stores.appDataStore.appConfig\n const { event, action, payload } = metadata\n\n sendBeatCta(beat, {\n event: event ?? undefined,\n op: action ?? undefined,\n extras: payload ?? undefined,\n isMobileWebview: is_mobile_webview,\n webviewScheme: clientConfig?.master?.ui_message_webview_url_scheme,\n userGuid: beat.insights_payload?.user_guid ?? beat.user_guid,\n })\n}\n\n/**\n * Whether the step's target opens the drawer: `drawer` always, `default` only for a real block (a\n * missing block never implies a post message), `none` never. Omitted: `none` with `run`, else `default`.\n */\nconst opensDrawer = (step: CtaStep, cta: { block?: string | null }) => {\n const target = step.next ?? (step.run ? 'none' : 'default')\n\n return target === 'drawer' || (target === 'default' && hasDrawerBlock(cta.block))\n}\n\nconst runEffect = (effect: CtaEffect, { beat, stores }: CtaContext) => {\n switch (effect) {\n case 'refreshBeat':\n stores.emitUpdate({ staleBeatGuid: beat.guid })\n break\n }\n}\n\ntype AnalyticsCtx = Pick<CtaContext, 'beat' | 'stores' | 'hostActions'>\n\n/**\n * The one way to fire a catalogued analytics event. Takes the catalogue entry itself (e.g.\n * `ANALYTICS_EVENTS_CONFIG.PRIMARY_ACTION_SELECTED`), not a lookup key — the call site already\n * has the entry via property access, so there is no key to look up or mistype. Resolves the\n * payload and hands it to the host directly. Never throws: a failed fire is captured, it\n * cannot fail or disable anything.\n */\nexport const sendCtaAnalytics = (ctx: AnalyticsCtx, event: AnalyticsEventConfigEntry): void => {\n try {\n ctx.hostActions.onAnalyticsEvent?.(resolveAnalyticsEvent(event, ctx.beat))\n } catch (error) {\n ctx.stores.captureException(error, {\n store: 'ctaActions',\n template: ctx.beat.template,\n handler: 'sendCtaAnalytics',\n })\n }\n}\n\n// First primary click: fires FIRST_TIME_PRIMARY_ACTION_SELECTED and records cta_clicked_at.\nconst markCtaClicked = (ctx: AnalyticsCtx & Pick<CtaContext, 'slot'>): void => {\n const { beat, slot, hostActions, stores } = ctx\n\n if (slot !== 'primary' || beat.cta_clicked_at) return\n\n sendCtaAnalytics(ctx, ANALYTICS_EVENTS_CONFIG.FIRST_TIME_PRIMARY_ACTION_SELECTED)\n\n // Fire-and-forget; a failed write must not fail the user's action, but still report it.\n Promise.resolve()\n .then(() =>\n hostActions.onCtaAction?.({ beatGuid: beat.guid, name: HOST_ACTIONS.markCtaClicked }),\n )\n .catch((error) =>\n stores.captureException(error, {\n store: 'ctaActions',\n template: beat.template,\n handler: 'markCtaClicked',\n }),\n )\n}\n\n/**\n * Trigger 1 + the first-click bookkeeping together: every CTA press's generic analytics\n * (`Primary/Secondary Action Selected`), plus `FIRST_TIME_PRIMARY_ACTION_SELECTED` /\n * `cta_clicked_at` on the first primary press. The one call site for \"a CTA got pressed\",\n * used by the runner and by the contact-support bypass in `BaseLayout`.\n */\nexport const reportCtaClick = (\n ctx: AnalyticsCtx & Pick<CtaContext, 'slot'>,\n { skipCtaClicked = false }: { skipCtaClicked?: boolean } = {},\n): void => {\n sendCtaAnalytics(\n ctx,\n ctx.slot === 'primary'\n ? ANALYTICS_EVENTS_CONFIG.PRIMARY_ACTION_SELECTED\n : ANALYTICS_EVENTS_CONFIG.SECONDARY_ACTION_SELECTED,\n )\n\n if (!skipCtaClicked) markCtaClicked(ctx)\n}\n\n// ─── Shared bookkeeping ─────────────────────────────────────────────────────\n\n/** Runs a named handler, then its `onSuccess` effects. Shared by card CTAs and drawer saves. */\nconst runHandlerWithEffects = async (\n ctx: CtaContext,\n handlerName: CtaHandlerName,\n onSuccess: CtaEffect[],\n): Promise<void> => {\n // Names are typed, but the map is still indexed defensively: config can come from anywhere.\n const handler = (ctaHandlers as Record<string, CtaHandler>)[handlerName]\n\n if (!handler) throw new Error(`Unknown CTA handler \"${handlerName}\"`)\n\n await handler(ctx)\n\n for (const effect of onSuccess) runEffect(effect, ctx)\n}\n\n/** Per-beat status around `work`: `pending` -> `done` | `error` (+ captureException). */\nconst withCtaStatus = async (\n { beat, stores }: Pick<CtaContext, 'beat' | 'stores'>,\n work: () => Promise<void>,\n captureContext: Record<string, string> = {},\n): Promise<boolean> => {\n const { insightsV2Store } = stores\n\n insightsV2Store.setCtaStatus(beat.guid, 'pending')\n\n try {\n await work()\n insightsV2Store.setCtaStatus(beat.guid, 'done')\n\n return true\n } catch (error) {\n insightsV2Store.setCtaStatus(beat.guid, 'error')\n stores.captureException(error, {\n store: 'ctaActions',\n template: beat.template,\n ...captureContext,\n })\n\n return false\n }\n}\n\n/** The step's params, overridden by the caller's. */\nconst withStepParams = (step: CtaStep, ctx: CtaContext): CtaContext => {\n const stepParams = typeof step.params === 'function' ? step.params(ctx) : step.params\n\n return { ...ctx, params: { ...stepParams, ...ctx.params } }\n}\n\n// ─── Entry points ───────────────────────────────────────────────────────────\n\n// Runs the CTA's step: handler, onSuccess effects, post message, then the next target.\nexport const runCtaAction = async (ctx: CtaContext): Promise<void> => {\n const step = resolveStep(ctx)\n const stepCtx = withStepParams(step, ctx)\n\n reportCtaClick(stepCtx, { skipCtaClicked: step.skipCtaClicked })\n\n await withCtaStatus(stepCtx, async () => {\n if (step.run) await runHandlerWithEffects(stepCtx, step.run, step.onSuccess ?? [])\n\n // A step's own event, e.g. select_savings_account (Saved) / open_savings_account (Created).\n if (step.analytics) sendCtaAnalytics(stepCtx, step.analytics)\n\n const metadata = resolveCtaMetadata(stepCtx)\n\n if (metadata) postCtaMessage(stepCtx, metadata)\n\n if (opensDrawer(step, stepCtx.cta)) openDrawerForSlot(stepCtx)\n })\n}\n\n/**\n * A pinned beat's auto-open: runs the card action's (`in_description_cta`) step and opens its block,\n * with no press analytics or post message. Does nothing while the step shows a status (e.g. an\n * answered subscription), nothing or a disabled button. Never rejects: failures are reported.\n */\nexport const runInDescriptionCta = async ({\n beat,\n stores,\n hostActions = {},\n}: RunInDescriptionCtaArgs): Promise<void> => {\n const link = beat.insights_payload?.in_description_cta\n\n if (!link) return\n\n const cta = { ...link, block: link.block ?? '' }\n const step = resolveStep({ cta })\n\n try {\n const ctx = withStepParams(step, {\n beat,\n cta,\n slot: 'primary',\n stores,\n hostActions,\n params: {},\n })\n\n await step.prepare?.(ctx)\n\n // Read after the load; `disabled` also covers a press made meanwhile (pending).\n const { disabled, presentation } = resolveCtaState(ctx)\n\n if (disabled || presentation) return\n\n if (step.run) {\n const { run, onSuccess = [] } = step\n\n if (!(await withCtaStatus(ctx, () => runHandlerWithEffects(ctx, run, onSuccess)))) return\n }\n\n // Never replaces a drawer the user opened meanwhile.\n if (opensDrawer(step, cta) && !stores.insightsV2Store.actionDrawer.isDrawerOpen) {\n stores.insightsV2Store.openActionDrawer({\n guid: beat.guid,\n trigger: 'inDescriptionCta',\n cta: { block: cta.block, variant: cta.variant, action_key: cta.action_key },\n })\n }\n } catch (error) {\n stores.captureException(error, {\n store: 'ctaActions',\n template: beat.template,\n handler: 'runInDescriptionCta',\n })\n }\n}\n\n/** Placeholder CTA for handlers run from inside a drawer, where no card slot is involved. */\nconst DIRECT_CTA = { label: '', block: '' }\n\n/** Runs a handler directly (drawer Save buttons). True on success. */\nexport const runCtaHandler = (\n ctx: CtaHandlerContext,\n handlerName: CtaHandlerName,\n { onSuccess = [], analytics }: RunHandlerOptions = {},\n): Promise<boolean> => {\n const fullCtx: CtaContext = { ...ctx, cta: DIRECT_CTA, slot: 'primary' }\n\n return withCtaStatus(\n fullCtx,\n async () => {\n await runHandlerWithEffects(fullCtx, handlerName, onSuccess)\n\n // Success-time analytics for drawer Saves.\n if (analytics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
|
|
@@ -23,24 +23,24 @@ var a = {
|
|
|
23
23
|
["1", a.CANCELLED],
|
|
24
24
|
["2", a.ONE_TIME_PURCHASE],
|
|
25
25
|
["3", a.WRONG_FREQUENCY]
|
|
26
|
-
],
|
|
27
|
-
const
|
|
28
|
-
return typeof
|
|
29
|
-
},
|
|
30
|
-
const
|
|
31
|
-
return
|
|
32
|
-
}, _ = ({ beat: e, stores:
|
|
26
|
+
], d = (e, r) => {
|
|
27
|
+
const n = e.copyStore.copy.insights_feed?.general?.[r];
|
|
28
|
+
return typeof n == "string" && n.trim() ? n : void 0;
|
|
29
|
+
}, p = ({ beat: e, stores: r }) => {
|
|
30
|
+
const n = e.primary_repeating_transaction_guid;
|
|
31
|
+
return n ? r.recurringTransactionsStore.repeatingTransactions.find((t) => t.guid === n) : void 0;
|
|
32
|
+
}, _ = ({ beat: e, stores: r, hostActions: n }, t) => {
|
|
33
33
|
try {
|
|
34
|
-
|
|
34
|
+
n?.onAnalyticsEvent?.(I(t, e));
|
|
35
35
|
} catch (o) {
|
|
36
|
-
|
|
36
|
+
r.captureException(o, {
|
|
37
37
|
store: "ctaActions",
|
|
38
38
|
template: e.template,
|
|
39
39
|
handler: "subscriptionAnswer"
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
}, C = async (e,
|
|
43
|
-
const
|
|
42
|
+
}, C = async (e, r) => {
|
|
43
|
+
const n = {
|
|
44
44
|
beat: e.beat,
|
|
45
45
|
stores: e.stores,
|
|
46
46
|
hostActions: e.hostActions ?? {},
|
|
@@ -50,12 +50,12 @@ var a = {
|
|
|
50
50
|
},
|
|
51
51
|
slot: "primary",
|
|
52
52
|
params: {
|
|
53
|
-
userResponse:
|
|
53
|
+
userResponse: r,
|
|
54
54
|
repeatingTransactionGuid: e.beat.primary_repeating_transaction_guid
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
try {
|
|
58
|
-
return await U.updateRepeatingTransactionResponse(
|
|
58
|
+
return await U.updateRepeatingTransactionResponse(n), !0;
|
|
59
59
|
} catch (t) {
|
|
60
60
|
return e.stores.captureException(t, {
|
|
61
61
|
store: "ctaActions",
|
|
@@ -63,79 +63,83 @@ var a = {
|
|
|
63
63
|
handler: "updateRepeatingTransactionResponse"
|
|
64
64
|
}), !1;
|
|
65
65
|
}
|
|
66
|
-
},
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
69
|
-
},
|
|
70
|
-
const
|
|
71
|
-
if (!
|
|
72
|
-
const
|
|
66
|
+
}, g = async (e, r) => {
|
|
67
|
+
const n = O[r];
|
|
68
|
+
if (n && _(e, n), !await C(e, r)) throw new Error("Failed to save the subscription answer");
|
|
69
|
+
}, A = (e) => _(e, i.SUBSCRIPTION_NOT_SUBSCRIBED), u = /* @__PURE__ */ new Set(), f = async (e) => {
|
|
70
|
+
const r = e.beat.primary_repeating_transaction_guid;
|
|
71
|
+
if (!r || u.has(r)) return !1;
|
|
72
|
+
const n = p(e)?.user_response ?? a.UNKNOWN, t = O[n]?.action ?? v[n], o = i.SUBSCRIPTION_UNDO;
|
|
73
73
|
_(e, {
|
|
74
74
|
...o,
|
|
75
75
|
action: `${o.action} - Previous action: ${t}`
|
|
76
|
-
}),
|
|
76
|
+
}), u.add(r);
|
|
77
77
|
try {
|
|
78
78
|
return await C(e, a.UNKNOWN);
|
|
79
79
|
} finally {
|
|
80
|
-
|
|
80
|
+
u.delete(r);
|
|
81
81
|
}
|
|
82
|
-
},
|
|
83
|
-
!e.beat.primary_repeating_transaction_guid ||
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
}, N = /* @__PURE__ */ new WeakMap(), y = (e) => {
|
|
83
|
+
if (!e.beat.primary_repeating_transaction_guid || p(e)) return;
|
|
84
|
+
let r = N.get(e.stores);
|
|
85
|
+
return r || (r = e.stores.recurringTransactionsStore.loadRepeatingTransactions().then(() => {
|
|
86
|
+
p(e) || N.delete(e.stores);
|
|
87
|
+
}, () => {
|
|
88
|
+
N.delete(e.stores);
|
|
89
|
+
}), N.set(e.stores, r)), r;
|
|
90
|
+
}, B = ({ statusLabels: e, sx: r, negativeSx: n, answeredTitle: t, answerCounts: o = () => !0 }) => ({
|
|
87
91
|
prepare: y,
|
|
88
92
|
presenter: (s) => {
|
|
89
|
-
const
|
|
90
|
-
if (!s.beat.primary_transaction_guid || !
|
|
93
|
+
const c = p(s);
|
|
94
|
+
if (!s.beat.primary_transaction_guid || !c) return {
|
|
91
95
|
kind: "hidden",
|
|
92
96
|
hideAll: !0
|
|
93
97
|
};
|
|
94
|
-
const
|
|
95
|
-
if (!
|
|
96
|
-
const E =
|
|
97
|
-
return !S || !
|
|
98
|
+
const R = c.user_response;
|
|
99
|
+
if (!R || R === a.UNKNOWN || !o(s, c)) return;
|
|
100
|
+
const E = R === a.CONFIRMED, S = d(s.stores, E ? e.positive : e.negative), l = d(s.stores, "undo");
|
|
101
|
+
return !S || !l ? { kind: "hidden" } : {
|
|
98
102
|
kind: "status",
|
|
99
103
|
tone: E ? "success" : "neutral",
|
|
100
104
|
icon: E ? "check_circle" : "cancel",
|
|
101
105
|
label: S,
|
|
102
|
-
sx: E || !
|
|
103
|
-
...
|
|
104
|
-
...
|
|
106
|
+
sx: E || !n ? r : {
|
|
107
|
+
...r,
|
|
108
|
+
...n
|
|
105
109
|
},
|
|
106
110
|
title: t?.(s.stores.copyStore.copy) || void 0,
|
|
107
111
|
action: {
|
|
108
|
-
label:
|
|
112
|
+
label: l,
|
|
109
113
|
onPress: () => f(s)
|
|
110
114
|
}
|
|
111
115
|
};
|
|
112
116
|
}
|
|
113
|
-
}),
|
|
114
|
-
const
|
|
115
|
-
const s =
|
|
117
|
+
}), h = (e, r) => {
|
|
118
|
+
const n = T.flatMap(([t, o]) => {
|
|
119
|
+
const s = r.reason_options?.[t];
|
|
116
120
|
return s ? [{
|
|
117
121
|
label: s,
|
|
118
122
|
userResponse: o
|
|
119
123
|
}] : [];
|
|
120
124
|
});
|
|
121
125
|
return {
|
|
122
|
-
reasonOptions:
|
|
126
|
+
reasonOptions: n.map(({ label: t }) => t),
|
|
123
127
|
onSubmit: async (t) => {
|
|
124
|
-
const o = t ===
|
|
128
|
+
const o = t === r.yes_label ? a.CONFIRMED : n.find(({ label: s }) => s === t)?.userResponse;
|
|
125
129
|
if (!o) throw new Error(`No subscription answer for "${t}"`);
|
|
126
|
-
await
|
|
130
|
+
await g(e, o);
|
|
127
131
|
},
|
|
128
|
-
onReasonsOpen: () =>
|
|
132
|
+
onReasonsOpen: () => A(e),
|
|
129
133
|
showDetailField: !1
|
|
130
134
|
};
|
|
131
135
|
};
|
|
132
136
|
export {
|
|
133
137
|
a as USER_RESPONSE,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
g as answerSubscription,
|
|
139
|
+
p as repeatingTransactionOf,
|
|
140
|
+
A as reportSubscriptionMarkedIncorrect,
|
|
141
|
+
B as subscriptionEntryStep,
|
|
142
|
+
h as subscriptionSurvey
|
|
139
143
|
};
|
|
140
144
|
|
|
141
145
|
//# 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 { 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;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,KAAA,GAAQ;AAAA,EACtB,CAAA,EAAc,OAAA,GAAU;AAC3B,GAGM,IAA8D;AAAA,EAClE,CAAC,KAAK,EAAc,gBAAgB;AAAA,EACpC,CAAC,KAAK,EAAc,SAAS;AAAA,EAC7B,CAAC,KAAK,EAAc,iBAAiB;AAAA,EACrC,CAAC,KAAK,EAAc,eAAe;AACrC,GAGM,IAAA,CAAe,GAAqB,MAA4C;AACpF,QAAM,IAAQ,EAAO,UAAU,KAAK,eAAe,UAAU,CAAA;AAE7D,SAAO,OAAO,KAAU,YAAY,EAAM,KAAK,IAAI,IAAQ;A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ights-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 loads = new WeakMap<GlobalStore, Promise<void>>()\n\nconst ensureRepeatingTransactions = (ctx: StateCtx): Promise<void> | undefined => {\n if (!ctx.beat.primary_repeating_transaction_guid || repeatingTransactionOf(ctx)) return\n\n let load = loads.get(ctx.stores)\n\n if (!load) {\n // The store reports a failure itself; while the record is still missing, the next card retries.\n load = ctx.stores.recurringTransactionsStore.loadRepeatingTransactions().then(\n () => {\n if (!repeatingTransactionOf(ctx)) loads.delete(ctx.stores)\n },\n () => {\n loads.delete(ctx.stores)\n },\n )\n loads.set(ctx.stores, load)\n }\n\n return load\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;AACT,GASM,IAA2D;AAAA,EAC9D,CAAA,EAAc,SAAA,GAAY,EAAwB;AAAA,EAClD,CAAA,EAAc,gBAAA,GAAmB,EAAwB;AAAA,EACzD,C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,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"}
|
|
@@ -61,8 +61,8 @@ export interface CtaStep {
|
|
|
61
61
|
disabledWhen?: (ctx: CtaStateContext) => boolean;
|
|
62
62
|
/** Draw a status or nothing instead of the button; undefined = the button. */
|
|
63
63
|
presenter?: (ctx: CtaStateContext) => CtaPresentation | undefined;
|
|
64
|
-
/** Loads what `presenter` reads, once per beat on mount. */
|
|
65
|
-
prepare?: (ctx: Pick<CtaStateContext, 'beat' | 'stores'>) => void;
|
|
64
|
+
/** Loads what `presenter` reads, once per beat on mount (resolving when loaded). */
|
|
65
|
+
prepare?: (ctx: Pick<CtaStateContext, 'beat' | 'stores'>) => Promise<void> | void;
|
|
66
66
|
/**
|
|
67
67
|
* Mini and micro mirror this step's `presenter` when their card action (`in_description_cta`)
|
|
68
68
|
* names it: the status's action word as the label and its `title`. Default: they keep the link.
|
|
@@ -88,5 +88,9 @@ export interface RunHandlerOptions {
|
|
|
88
88
|
/** Catalogue entry (e.g. ANALYTICS_EVENTS_CONFIG.X) fired after the handler resolves (drawer Saves). */
|
|
89
89
|
analytics?: AnalyticsEventConfigEntry;
|
|
90
90
|
}
|
|
91
|
+
/** `runInDescriptionCta`'s input: the beat's micro envelope and the host actions of the pinned beat. */
|
|
92
|
+
export interface RunInDescriptionCtaArgs extends Pick<CtaContext, 'beat' | 'stores'> {
|
|
93
|
+
hostActions?: BeatActions;
|
|
94
|
+
}
|
|
91
95
|
/** A named side effect. Must throw (or reject) on failure so the runner can report it. */
|
|
92
96
|
export type CtaHandler = (ctx: CtaContext) => Promise<void> | void;
|
|
@@ -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 { 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,CAAC,IAAI,QACjE,IAAU,EAAY,EAAE,KAAK,EAAW,CAAC,EAAE,WAAW,GAAU,SAChE,IAAW;AAAA,IAAE,MAAA;AAAA,IAAM,QAAA;AAAA,IAAQ,aAAa;AAAA,EAAY;AAG1D,SAAA,EAAA,MAAgB;AACd,IAAA,
|
|
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 void 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,CAAC,IAAI,QACjE,IAAU,EAAY,EAAE,KAAK,EAAW,CAAC,EAAE,WAAW,GAAU,SAChE,IAAW;AAAA,IAAE,MAAA;AAAA,IAAM,QAAA;AAAA,IAAQ,aAAa;AAAA,EAAY;AAG1D,SAAA,EAAA,MAAgB;AACd,IAAA,IAAe;AAAA,MAAE,MAAA;AAAA,MAAM,QAAA;AAAA,IAAO,CAAC;AAAA,EAEjC,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,IAEhF,kBAAkB,GAAU,gBACxB,EAAS,YAAY;AAAA,MAAE,GAAG;AAAA,MAAU,KAAK;AAAA,QAAE,GAAG;AAAA,QAAW,GAAG;AAAA,MAAQ;AAAA,MAAG,MAAM;AAAA,IAAU,CAAC,IACxF;AAAA,EACN;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"}
|
|
@@ -30,8 +30,8 @@ export { default as FeedbackModal, type FeedbackModalContent } from './component
|
|
|
30
30
|
export { default as SurveyModal, type SurveyModalContent, type SurveyModalOption, } from './components/SurveyModal';
|
|
31
31
|
export { default as StatusSnackbar, type StatusSnackbarProps, } from './components/shared/StatusSnackbar';
|
|
32
32
|
export { ObsolesceBanner, type ObsolesceBannerProps, type ObsolesceBannerState, type ObsolesceBannerCopy, } from './components/ObsolesceBanner';
|
|
33
|
-
export { HOST_ACTIONS, useBeatCtaActions, useCtaHandler } from './ctaActions';
|
|
34
|
-
export type { BeatCtaActions, CtaContext, CtaEffect, CtaHandlerName, CtaParams, CtaStateContext, CtaStep, HostActionName, RunHandlerOptions, } from './ctaActions';
|
|
33
|
+
export { HOST_ACTIONS, runInDescriptionCta, useBeatCtaActions, useCtaHandler } from './ctaActions';
|
|
34
|
+
export type { BeatCtaActions, CtaContext, CtaEffect, CtaHandlerName, CtaParams, CtaStateContext, CtaStep, HostActionName, RunHandlerOptions, RunInDescriptionCtaArgs, } from './ctaActions';
|
|
35
35
|
export { useBeatActions, type BeatActions, type CtaActionParams, type MenuActionHandlers, type UpdateParams, type FeedbackParams, type DismissParams, type InsightMenuAction, type InsightRating, } from './beatActions';
|
|
36
36
|
export { default as LogoTile } from './components/LogoTile';
|
|
37
37
|
export { default as MerchantHighlightCard } from './components/MerchantHighlightCard';
|
|
@@ -3,144 +3,146 @@ import { resolveInsightRender as m } from "./resolveInsightRender.es.js";
|
|
|
3
3
|
import { useBeatActions as a } from "./beatActions.es.js";
|
|
4
4
|
import { BAR_ARIA_LABEL as e, BAR_CHART_VARIANTS as f, barChartVariant as n, buildChartData as c, buildDataSeries as l } from "./blocks/ChartBlocks/BarchartBlock/utils.es.js";
|
|
5
5
|
import { HOST_ACTIONS as d } from "./ctaActions/hostActions.es.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import h from "./blocks/ChartBlocks/
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import R
|
|
13
|
-
import H from "./components/
|
|
14
|
-
import O from "./components/
|
|
15
|
-
import
|
|
16
|
-
import F from "./blocks/ComponentBlocks/DetailedAccountBlock/
|
|
17
|
-
import N from "./blocks/ComponentBlocks/
|
|
18
|
-
import W from "./
|
|
19
|
-
import q from "./
|
|
20
|
-
import
|
|
21
|
-
import Q from "./
|
|
22
|
-
import Y from "./components/
|
|
23
|
-
import $ from "./components/
|
|
24
|
-
import ro from "./
|
|
25
|
-
import mo from "./
|
|
26
|
-
import ao from "./
|
|
27
|
-
import eo from "./
|
|
28
|
-
import no from "./components/
|
|
29
|
-
import lo from "./components/
|
|
30
|
-
import Bo from "./components/
|
|
31
|
-
import go from "./components/
|
|
32
|
-
import ko from "./
|
|
33
|
-
import So from "./blocks/ComponentBlocks/
|
|
34
|
-
import ho from "./
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import Ro from "./
|
|
38
|
-
import yo from "./
|
|
39
|
-
import Mo from "./
|
|
40
|
-
import Po from "./
|
|
41
|
-
import
|
|
42
|
-
import {
|
|
43
|
-
import xo from "./
|
|
44
|
-
import Uo from "./
|
|
45
|
-
import jo from "./
|
|
46
|
-
import zo from "./
|
|
47
|
-
import Ko from "./
|
|
48
|
-
import
|
|
49
|
-
import Zo from "./
|
|
50
|
-
import or from "./components/
|
|
51
|
-
import tr from "./components/
|
|
52
|
-
import ir from "./components/
|
|
53
|
-
import pr from "./components/
|
|
54
|
-
import fr from "./components/
|
|
55
|
-
import
|
|
56
|
-
import sr from "./components/
|
|
57
|
-
import
|
|
58
|
-
import {
|
|
59
|
-
import kr from "./components/
|
|
60
|
-
import Sr from "./components/
|
|
61
|
-
import hr from "./components/
|
|
62
|
-
import
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import Pr from "./components/
|
|
6
|
+
import { runInDescriptionCta as C } from "./ctaActions/runCtaAction.es.js";
|
|
7
|
+
import { useBeatCtaActions as u, useCtaHandler as k } from "./ctaActions/useCtaAction.es.js";
|
|
8
|
+
import { BarchartBlock as S } from "./blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js";
|
|
9
|
+
import { DoubleBarChartBlock as h } from "./blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js";
|
|
10
|
+
import I from "./blocks/ChartBlocks/StepChartBlock/StepChartBlock.es.js";
|
|
11
|
+
import T from "./blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js";
|
|
12
|
+
import R from "./blocks/ChartBlocks/DoubleProgressBarBlock/DoubleProgressBarBlock.es.js";
|
|
13
|
+
import y, { isLogoGuid as H } from "./components/LogoFromGuid.es.js";
|
|
14
|
+
import O from "./components/AccountHeroCard.es.js";
|
|
15
|
+
import V from "./components/DirectDepositCard.es.js";
|
|
16
|
+
import { detailedAccountVariant as G, directDepositVariant as _, isDetailedAccountVariant as F } from "./blocks/ComponentBlocks/DetailedAccountBlock/layout.es.js";
|
|
17
|
+
import N from "./blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js";
|
|
18
|
+
import W from "./blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js";
|
|
19
|
+
import q from "./components/TransferLogoCard.es.js";
|
|
20
|
+
import J from "./blocks/ComponentBlocks/AccountSwitchBlock/AccountSwitchBlock.es.js";
|
|
21
|
+
import { BudgetBlock as Q } from "./blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js";
|
|
22
|
+
import Y from "./components/DebtPayoffCard.es.js";
|
|
23
|
+
import $ from "./components/InsightTransactionRow.es.js";
|
|
24
|
+
import ro from "./components/TransactionListCard.es.js";
|
|
25
|
+
import mo from "./blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js";
|
|
26
|
+
import ao from "./components/GoalProgressCard.es.js";
|
|
27
|
+
import eo from "./blocks/ComponentBlocks/GoalsBlock/GoalsBlock.es.js";
|
|
28
|
+
import no from "./components/LogoTile.es.js";
|
|
29
|
+
import lo from "./components/LogoClusterCard.es.js";
|
|
30
|
+
import Bo from "./components/AmountPill.es.js";
|
|
31
|
+
import go from "./components/MerchantHighlightCard.es.js";
|
|
32
|
+
import ko from "./components/P2PLogoStack.es.js";
|
|
33
|
+
import So from "./blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js";
|
|
34
|
+
import ho from "./blocks/ComponentBlocks/NoSpendDaysBlock/NoSpendDaysBlock.es.js";
|
|
35
|
+
import Io from "./components/UpcomingBillCard.es.js";
|
|
36
|
+
import To from "./blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js";
|
|
37
|
+
import Ro from "./components/SaveAnExtraCard.es.js";
|
|
38
|
+
import yo from "./blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js";
|
|
39
|
+
import Mo from "./components/SavingsOpportunityCard.es.js";
|
|
40
|
+
import Po from "./blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js";
|
|
41
|
+
import Eo from "./components/StatusMessageCard.es.js";
|
|
42
|
+
import { transactionBlockVariant as _o } from "./blocks/ComponentBlocks/TransactionBlock/layout.es.js";
|
|
43
|
+
import { TransactionBlock as xo } from "./blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js";
|
|
44
|
+
import Uo from "./components/SubscriptionHeroCard.es.js";
|
|
45
|
+
import jo from "./blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js";
|
|
46
|
+
import zo from "./components/WithdrawalCard.es.js";
|
|
47
|
+
import Ko from "./blocks/ComponentBlocks/WithdrawalBlock/WithdrawalBlock.es.js";
|
|
48
|
+
import Xo from "./components/DesignateEmergencySavingsCard.es.js";
|
|
49
|
+
import { SVGImageBlock as Zo } from "./blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js";
|
|
50
|
+
import or from "./components/shared/StatusSnackbar.es.js";
|
|
51
|
+
import tr from "./components/FeedbackDialog.es.js";
|
|
52
|
+
import ir from "./components/FeedbackModal.es.js";
|
|
53
|
+
import pr from "./components/ConnectionDetailDrillDown.es.js";
|
|
54
|
+
import fr from "./components/SurveyModal.es.js";
|
|
55
|
+
import cr from "./components/InsightErrorCard.es.js";
|
|
56
|
+
import { ErrorCard as sr } from "./components/ErrorCard.es.js";
|
|
57
|
+
import Br from "./components/BadgedTile.es.js";
|
|
58
|
+
import { OverflowMenu as gr } from "./components/OverflowMenu.es.js";
|
|
59
|
+
import { InsightOptionsMenu as kr } from "./components/InsightOptionsMenu.es.js";
|
|
60
|
+
import Sr from "./components/StatusBadge.es.js";
|
|
61
|
+
import hr from "./components/CompactInsightCard.es.js";
|
|
62
|
+
import Ir from "./components/AmountBreakdownCard.es.js";
|
|
63
|
+
import { FeedbackBar as Tr } from "./components/FeedbackBar.es.js";
|
|
64
|
+
import { DismissInsightDialog as Rr } from "./components/DismissInsightDialog.es.js";
|
|
65
|
+
import { HiddenConfirmationCard as yr } from "./components/HiddenConfirmationCard.es.js";
|
|
66
|
+
import { LoadingCard as Mr } from "./components/LoadingCard.es.js";
|
|
67
|
+
import { ObsolesceBanner as Pr } from "./components/ObsolesceBanner.es.js";
|
|
68
|
+
import Er from "./components/BaseLayout.es.js";
|
|
68
69
|
export {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
W as AccountBlock,
|
|
71
|
+
O as AccountHeroCard,
|
|
72
|
+
J as AccountSwitchBlock,
|
|
73
|
+
Ir as AmountBreakdownCard,
|
|
74
|
+
Bo as AmountPill,
|
|
74
75
|
e as BAR_ARIA_LABEL,
|
|
75
76
|
f as BAR_CHART_VARIANTS,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
77
|
+
Br as BadgedTile,
|
|
78
|
+
S as BarchartBlock,
|
|
79
|
+
Er as BaseLayout,
|
|
80
|
+
Q as BudgetBlock,
|
|
81
|
+
hr as CompactInsightCard,
|
|
82
|
+
pr as ConnectionDetailDrillDown,
|
|
83
|
+
Y as DebtPayoffCard,
|
|
84
|
+
mo as DebtsBlock,
|
|
85
|
+
Xo as DesignateEmergencySavingsCard,
|
|
86
|
+
N as DetailedAccountBlock,
|
|
87
|
+
N as DirectDepositBlock,
|
|
88
|
+
V as DirectDepositCard,
|
|
89
|
+
Rr as DismissInsightDialog,
|
|
90
|
+
T as DonutChartBlock,
|
|
91
|
+
h as DoubleBarChartBlock,
|
|
92
|
+
R as DoubleProgressBarBlock,
|
|
93
|
+
sr as ErrorCard,
|
|
94
|
+
Tr as FeedbackBar,
|
|
95
|
+
tr as FeedbackDialog,
|
|
96
|
+
ir as FeedbackModal,
|
|
97
|
+
ao as GoalProgressCard,
|
|
98
|
+
eo as GoalsBlock,
|
|
98
99
|
d as HOST_ACTIONS,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
100
|
+
yr as HiddenConfirmationCard,
|
|
101
|
+
cr as InsightErrorCard,
|
|
102
|
+
kr as InsightOptionsMenu,
|
|
103
|
+
$ as InsightTransactionRow,
|
|
104
|
+
Mr as LoadingCard,
|
|
105
|
+
lo as LogoClusterCard,
|
|
106
|
+
y as LogoFromGuid,
|
|
107
|
+
no as LogoTile,
|
|
108
|
+
So as MerchantBlock,
|
|
109
|
+
go as MerchantHighlightCard,
|
|
110
|
+
ho as NoSpendDaysBlock,
|
|
111
|
+
Pr as ObsolesceBanner,
|
|
112
|
+
gr as OverflowMenu,
|
|
113
|
+
ko as P2PLogoStack,
|
|
114
|
+
To as RepeatingTransactionBlock,
|
|
115
|
+
Zo as SVGImageBlock,
|
|
116
|
+
Ro as SaveAnExtraCard,
|
|
117
|
+
yo as SaveExtraBlock,
|
|
118
|
+
Po as SavingsOpportunityBlock,
|
|
119
|
+
Mo as SavingsOpportunityCard,
|
|
120
|
+
Sr as StatusBadge,
|
|
121
|
+
Eo as StatusMessageCard,
|
|
121
122
|
r as StatusPill,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
123
|
+
or as StatusSnackbar,
|
|
124
|
+
I as StepChartBlock,
|
|
125
|
+
Uo as SubscriptionHeroCard,
|
|
126
|
+
fr as SurveyModal,
|
|
127
|
+
xo as TransactionBlock,
|
|
128
|
+
ro as TransactionListCard,
|
|
129
|
+
q as TransferLogoCard,
|
|
130
|
+
To as UpcomingBillBlock,
|
|
131
|
+
Io as UpcomingBillCard,
|
|
132
|
+
jo as UpcomingSubscriptionBlock,
|
|
133
|
+
Ko as WithdrawalBlock,
|
|
134
|
+
zo as WithdrawalCard,
|
|
134
135
|
n as barChartVariant,
|
|
135
136
|
c as buildChartData,
|
|
136
137
|
l as buildDataSeries,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
G as detailedAccountVariant,
|
|
139
|
+
_ as directDepositVariant,
|
|
140
|
+
F as isDetailedAccountVariant,
|
|
141
|
+
H as isLogoGuid,
|
|
141
142
|
m as resolveInsightRender,
|
|
142
|
-
|
|
143
|
+
C as runInDescriptionCta,
|
|
144
|
+
_o as transactionBlockVariant,
|
|
143
145
|
a as useBeatActions,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
+
u as useBeatCtaActions,
|
|
147
|
+
k as useCtaHandler
|
|
146
148
|
};
|