@mx-cartographer/experiences 9.7.28 → 9.7.29
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 +9 -0
- package/dist/core/api/UserApi.es.js +8 -8
- package/dist/core/api/UserApi.es.js.map +1 -1
- package/dist/core/stores/GlobalStore.d.ts +4 -2
- package/dist/core/stores/GlobalStore.es.js +34 -34
- package/dist/core/stores/GlobalStore.es.js.map +1 -1
- package/dist/insights-v2/analytics/analyticsEventsConfig.d.ts +12 -0
- package/dist/insights-v2/analytics/analyticsEventsConfig.es.js +12 -0
- package/dist/insights-v2/analytics/analyticsEventsConfig.es.js.map +1 -1
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.d.ts +15 -0
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.es.js +30 -0
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.es.js.map +1 -0
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.d.ts +1 -1
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js +32 -11
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.d.ts +10 -7
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.es.js +17 -10
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/components/CtaStatus.d.ts +19 -0
- package/dist/insights-v2/components/CtaStatus.es.js +67 -0
- package/dist/insights-v2/components/CtaStatus.es.js.map +1 -0
- package/dist/insights-v2/ctaActions/ctaConfig.es.js +21 -6
- package/dist/insights-v2/ctaActions/ctaConfig.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/ctaPostMessages.es.js +7 -7
- package/dist/insights-v2/ctaActions/ctaPostMessages.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/types.d.ts +1 -1
- package/dist/insights-v2/index.es.js +30 -30
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [9.7.29] - 10-22-2026
|
|
2
|
+
|
|
3
|
+
- **ADDED** - Designate Emergency Savings Account on Insights 2.0. `ctaConfig` gains the two backend-named actions: `select_savings_account` ("Save") designates the account picked in the card through `updateUserInsightProfile`, stays disabled until a pick is made, refreshes the beat and fires `EMERGENCY_SAVINGS_ACCT_SAVED`; `open_savings_account` ("Open a Savings Account") fires `EMERGENCY_SAVINGS_ACCT_CREATED` while `ctaPostMessages.DesignateEmergencySavingsAccount` sends `beat/cta` op_1 — now keyed on the CTA's `action_key` (`open_savings_account`) instead of re-deriving pulse's data rule (no designation, no savings accounts), so it holds on every widget. The analytics catalogue gains `EMERGENCY_SAVINGS_ACCT_SELECTED` / `_SAVED` / `_CREATED` with pulse's strings (WEC-1859)
|
|
4
|
+
- **ADDED** - `CtaStatus`, a shared component for an "after the press" status bar (label, tone, filled icon, optional inline action such as Undo; `role="status"`, only the inline action is a button). Designate Emergency Savings Account's saved state draws its "Account Saved!" (`instance_slot.data.saved_label`) with it in the card body, under the illustration, per the updated Figma Saved state (WEC-1859)
|
|
5
|
+
- **ADDED** - `svg_image_block` layout variants `savings_account_picker` (the emergency-savings illustration with the account picker: options from `accountStore.savingsAccounts`, labels and pre-selection from `instance_slot.data`, the pick written to the beat context with the Selected event and no API call) and `savings_account_saved` (the illustration with the slot's `saved_label` as a `CtaStatus` under it, no picker; full card only, nothing when the label is missing) — the card the sampled beat refreshes into after Save, whose empty `primary_cta.label` renders no button (WEC-1859)
|
|
6
|
+
- **CHANGED** - `svg_image_block`'s emergency-savings variant is keyed `savings`, the name ditto sends (was `Savings`, which never matched). An unknown variant now renders nothing instead of throwing (WEC-1859)
|
|
7
|
+
- **FIXED** - `UserApi.updateUserInsightProfile` sends the profile fields flat, as pulse does. firefly's `PUT user_insight_profile` reads each field at the top level of the body and drops nils, so the `{ user_insight_profile: ... }` body it sent reached firefly empty and the upsert saved nothing: Designate Emergency Savings Account's "Save" and the safety-net save in `AmountInputModalBlock` silently kept the old profile. The MSW handler takes the flat body too (WEC-1859)
|
|
8
|
+
- **ADDED** - `GlobalStore.loadData` accepts `userInsightProfile` and seeds `UserStore.setUserInsightProfile`, so the host (pulse) hands in the profile it loads; experiences never fetches it. `select_savings_account` PUTs this seeded profile (WEC-1859)
|
|
9
|
+
|
|
1
10
|
## [9.7.28] - 10-21-2026
|
|
2
11
|
|
|
3
12
|
- **ADDED** - `goals_block` component block (`status` variant) for the Monthly Emergency Fund Review beat. Renders the new `GoalProgressCard` (progress line with an optional status pill, progress bar and icon-tile fact rows) from `instance_slot.data`, with row copy from the new `insights_feed.goals_block` namespace. Mock payloads, fixtures, stories and tests (WEC-1302)
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ApiEndpoints as s } from "../constants/ApiEndpoints.es.js";
|
|
2
2
|
import { Fetch as r } from "../utils/Fetch.es.js";
|
|
3
|
-
var
|
|
3
|
+
var i = class {
|
|
4
4
|
fetchInstance;
|
|
5
|
-
constructor(
|
|
6
|
-
this.fetchInstance = new r(
|
|
5
|
+
constructor(t, e, n) {
|
|
6
|
+
this.fetchInstance = new r(t, e, void 0, n);
|
|
7
7
|
}
|
|
8
|
-
getUserFeatures = async () => this.fetchInstance.get(s.USER_FEATURES).then((
|
|
9
|
-
updateUser = async (
|
|
10
|
-
updateUserProfile = async (
|
|
11
|
-
updateUserInsightProfile = async (
|
|
8
|
+
getUserFeatures = async () => this.fetchInstance.get(s.USER_FEATURES).then((t) => t.user_features);
|
|
9
|
+
updateUser = async (t) => this.fetchInstance.put(s.USER, t).then((e) => e.user);
|
|
10
|
+
updateUserProfile = async (t) => this.fetchInstance.put(`${s.USER_PROFILES}/${t.guid}`, t).then((e) => e.user_profile);
|
|
11
|
+
updateUserInsightProfile = async (t) => this.fetchInstance.put(s.USER_INSIGHT_PROFILE, t).then((e) => e.user_insight_profile);
|
|
12
12
|
};
|
|
13
13
|
export {
|
|
14
|
-
|
|
14
|
+
i as UserApi
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
//# sourceMappingURL=UserApi.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserApi.es.js","names":[],"sources":["../../../src/core/api/UserApi.ts"],"sourcesContent":["import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport type { GlobalErrorHandler, User, UserInsightProfile, UserProfile } from '..'\n\nexport class UserApi {\n fetchInstance: Fetch\n\n constructor(endpoint: string, token: string, onError?: GlobalErrorHandler) {\n this.fetchInstance = new Fetch(endpoint, token, undefined, onError)\n }\n\n getUserFeatures = async () => {\n return this.fetchInstance.get(ApiEndpoints.USER_FEATURES).then((data) => data.user_features)\n }\n\n updateUser = async (user: User) => {\n return this.fetchInstance.put(ApiEndpoints.USER, user).then((data) => data.user)\n }\n\n updateUserProfile = async (userProfile: UserProfile) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.USER_PROFILES}/${userProfile.guid}`, userProfile)\n .then((data) => data.user_profile)\n }\n\n // The endpoint is singular per user, so no guid in the path (mirrors pulse FireflyAPI).\n updateUserInsightProfile = async (\n profile: Partial<UserInsightProfile>,\n ): Promise<UserInsightProfile> => {\n return this.fetchInstance\n
|
|
1
|
+
{"version":3,"file":"UserApi.es.js","names":[],"sources":["../../../src/core/api/UserApi.ts"],"sourcesContent":["import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport type { GlobalErrorHandler, User, UserInsightProfile, UserProfile } from '..'\n\nexport class UserApi {\n fetchInstance: Fetch\n\n constructor(endpoint: string, token: string, onError?: GlobalErrorHandler) {\n this.fetchInstance = new Fetch(endpoint, token, undefined, onError)\n }\n\n getUserFeatures = async () => {\n return this.fetchInstance.get(ApiEndpoints.USER_FEATURES).then((data) => data.user_features)\n }\n\n updateUser = async (user: User) => {\n return this.fetchInstance.put(ApiEndpoints.USER, user).then((data) => data.user)\n }\n\n updateUserProfile = async (userProfile: UserProfile) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.USER_PROFILES}/${userProfile.guid}`, userProfile)\n .then((data) => data.user_profile)\n }\n\n // The endpoint is singular per user, so no guid in the path (mirrors pulse FireflyAPI).\n updateUserInsightProfile = async (\n profile: Partial<UserInsightProfile>,\n ): Promise<UserInsightProfile> => {\n return (\n this.fetchInstance\n // Flat, as pulse sends it: firefly reads each field at the top level of the body and drops\n // nils, so a wrapped body would reach it empty and the upsert would write nothing.\n .put(ApiEndpoints.USER_INSIGHT_PROFILE, profile)\n .then((data) => data.user_insight_profile)\n )\n }\n}\n"],"mappings":";;AAIA,IAAa,IAAb,MAAqB;AAAA,EACnB;AAAA,EAEA,YAAY,GAAkB,GAAe,GAA8B;AACzE,SAAK,gBAAgB,IAAI,EAAM,GAAU,GAAO,QAAW,CAAO;AAAA,EACpE;AAAA,EAEA,kBAAkB,YACT,KAAK,cAAc,IAAI,EAAa,aAAa,EAAE,KAAA,CAAM,MAAS,EAAK,aAAa;AAAA,EAG7F,aAAa,OAAO,MACX,KAAK,cAAc,IAAI,EAAa,MAAM,CAAI,EAAE,KAAA,CAAM,MAAS,EAAK,IAAI;AAAA,EAGjF,oBAAoB,OAAO,MAClB,KAAK,cACT,IAAI,GAAG,EAAa,aAAA,IAAiB,EAAY,IAAA,IAAQ,CAAW,EACpE,KAAA,CAAM,MAAS,EAAK,YAAY;AAAA,EAIrC,2BAA2B,OACzB,MAGE,KAAK,cAGF,IAAI,EAAa,sBAAsB,CAAO,EAC9C,KAAA,CAAM,MAAS,EAAK,oBAAoB;AAGjD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AccountStore, AgreementStore, AnalyticsStore, AppDataStore, BeatStore, BudgetsStore, CashflowStore, CategoryStore, ConnectStore, DebtsStore, FinstrongStore, GlobalCopyStore, GlobalUiStore, GoalStore, HelpStore, HoldingStore, InsightsV2Store, MerchantStore, NetWorthStore, NotificationStore, RecurringTransactionsStore, SettingsStore, TransactionStore, TrendsStore, UserStore } from '../stores';
|
|
2
|
-
import { Account, Category, Institution, Member, AppConfig, AppData, Beat, GlobalCaptureException, GlobalErrorHandler, MerchantBudget, Tag, Tagging, Transaction, TransactionRule, UserFeature } from '../types';
|
|
2
|
+
import { Account, Category, Institution, Member, AppConfig, AppData, Beat, GlobalCaptureException, GlobalErrorHandler, MerchantBudget, Tag, Tagging, Transaction, TransactionRule, UserFeature, UserInsightProfile } from '../types';
|
|
3
3
|
interface LoadDataProps {
|
|
4
4
|
accounts?: Account[];
|
|
5
5
|
appData?: AppData;
|
|
@@ -13,6 +13,8 @@ interface LoadDataProps {
|
|
|
13
13
|
transactionRules?: TransactionRule[];
|
|
14
14
|
transactions?: Transaction[];
|
|
15
15
|
userFeatures?: UserFeature[];
|
|
16
|
+
/** Loaded by the host (pulse); experiences never fetches it. Read and PUT by insight CTAs. */
|
|
17
|
+
userInsightProfile?: UserInsightProfile;
|
|
16
18
|
}
|
|
17
19
|
type OnStoreUpdate = (update: ObservedUpdate) => void;
|
|
18
20
|
export type ObservedUpdate = {
|
|
@@ -61,6 +63,6 @@ export declare class GlobalStore {
|
|
|
61
63
|
captureException: (error: unknown, context?: Record<string, string>) => void;
|
|
62
64
|
emitUpdate: (change: ObservedUpdate) => void;
|
|
63
65
|
loadConfigData: () => Promise<void>;
|
|
64
|
-
loadData: ({ accounts, appData, associatedBeats, categories, institutions, transactionRules, transactions, userFeatures, merchantBudgets, }?: LoadDataProps) => Promise<void>;
|
|
66
|
+
loadData: ({ accounts, appData, associatedBeats, categories, institutions, transactionRules, transactions, userFeatures, merchantBudgets, userInsightProfile, }?: LoadDataProps) => Promise<void>;
|
|
65
67
|
}
|
|
66
68
|
export {};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { AccountStore as
|
|
2
|
-
import { AgreementStore as
|
|
3
|
-
import { AppDataStore as
|
|
4
|
-
import { AnalyticsStore as
|
|
5
|
-
import { BeatStore as
|
|
6
|
-
import { BudgetsStore as
|
|
7
|
-
import { CashflowStore as
|
|
8
|
-
import { CategoryStore as
|
|
9
|
-
import { ConnectStore as
|
|
10
|
-
import { DebtsStore as
|
|
11
|
-
import { FinstrongStore as
|
|
12
|
-
import { DefaultAppConfig as
|
|
13
|
-
import { GlobalUiStore as
|
|
14
|
-
import { GlobalCopyStore as
|
|
15
|
-
import { GoalStore as
|
|
16
|
-
import { HelpStore as
|
|
17
|
-
import { HoldingStore as
|
|
18
|
-
import { InsightsV2Store as
|
|
19
|
-
import { MerchantStore as
|
|
20
|
-
import { NetWorthStore as
|
|
21
|
-
import { NotificationStore as
|
|
22
|
-
import { RecurringTransactionsStore as
|
|
23
|
-
import { SettingsStore as
|
|
24
|
-
import { TransactionStore as
|
|
25
|
-
import { TrendsStore as
|
|
26
|
-
import { UserStore as
|
|
27
|
-
import { autorun as
|
|
28
|
-
var
|
|
29
|
-
appConfig =
|
|
1
|
+
import { AccountStore as m } from "./AccountStore.es.js";
|
|
2
|
+
import { AgreementStore as c } from "./AgreementStore.es.js";
|
|
3
|
+
import { AppDataStore as f } from "./AppDataStore.es.js";
|
|
4
|
+
import { AnalyticsStore as l } from "./AnalyticsStore.es.js";
|
|
5
|
+
import { BeatStore as g } from "./BeatStore.es.js";
|
|
6
|
+
import { BudgetsStore as w } from "./BudgetsStore.es.js";
|
|
7
|
+
import { CashflowStore as d } from "./CashflowStore.es.js";
|
|
8
|
+
import { CategoryStore as u } from "./CategoryStore.es.js";
|
|
9
|
+
import { ConnectStore as b } from "./ConnectStore.es.js";
|
|
10
|
+
import { DebtsStore as y } from "./DebtsStore.es.js";
|
|
11
|
+
import { FinstrongStore as C } from "./FinstrongStore.es.js";
|
|
12
|
+
import { DefaultAppConfig as p } from "../constants/DefaultConfig.es.js";
|
|
13
|
+
import { GlobalUiStore as U } from "./GlobalUiStore.es.js";
|
|
14
|
+
import { GlobalCopyStore as A } from "./GlobalCopyStore.es.js";
|
|
15
|
+
import { GoalStore as D } from "./GoalStore.es.js";
|
|
16
|
+
import { HelpStore as T } from "./HelpStore.es.js";
|
|
17
|
+
import { HoldingStore as E } from "./HoldingStore.es.js";
|
|
18
|
+
import { InsightsV2Store as x } from "./InsightsV2Store.es.js";
|
|
19
|
+
import { MerchantStore as k } from "./MerchantStore.es.js";
|
|
20
|
+
import { NetWorthStore as G } from "./NetWorthStore.es.js";
|
|
21
|
+
import { NotificationStore as I } from "./NotificationStore.es.js";
|
|
22
|
+
import { RecurringTransactionsStore as M } from "./RecurringTransactionsStore.es.js";
|
|
23
|
+
import { SettingsStore as V } from "./SettingsStore.es.js";
|
|
24
|
+
import { TransactionStore as W } from "./TransactionStore.es.js";
|
|
25
|
+
import { TrendsStore as v } from "./TrendsStore.es.js";
|
|
26
|
+
import { UserStore as z } from "./UserStore.es.js";
|
|
27
|
+
import { autorun as B, makeAutoObservable as H } from "mobx";
|
|
28
|
+
var mt = class {
|
|
29
|
+
appConfig = p;
|
|
30
30
|
endpoint = "/";
|
|
31
31
|
sessionToken = "";
|
|
32
32
|
onCaptureException;
|
|
@@ -57,8 +57,8 @@ var pt = class {
|
|
|
57
57
|
userStore;
|
|
58
58
|
globalUiStore;
|
|
59
59
|
insightsV2Store;
|
|
60
|
-
constructor(t =
|
|
61
|
-
this.appConfig = t, this.endpoint = o, this.sessionToken = t.options.session_token ?? "", this.onCaptureException = i, this.onError = e, this.onStoreUpdate = r, this.accountStore = new
|
|
60
|
+
constructor(t = p, o = "/", e, r, i) {
|
|
61
|
+
this.appConfig = t, this.endpoint = o, this.sessionToken = t.options.session_token ?? "", this.onCaptureException = i, this.onError = e, this.onStoreUpdate = r, this.accountStore = new m(this), this.agreementStore = new c(this), this.appDataStore = new f(this), this.analyticsStore = new l(this), this.beatStore = new g(this), this.budgetsStore = new w(this), this.cashflowStore = new d(this), this.categoryStore = new u(this), this.connectStore = new b(this), this.copyStore = new A(this), this.debtsStore = new y(this), this.finstrongStore = new C(this), this.goalStore = new D(this), this.helpStore = new T(this), this.holdingStore = new E(this), this.merchantStore = new k(this), this.netWorthStore = new G(this), this.notificationStore = new I(this), this.recurringTransactionsStore = new M(this), this.settingsStore = new V(this), this.transactionStore = new W(this), this.trendsStore = new v(this), this.userStore = new z(this), this.globalUiStore = new U(this), this.insightsV2Store = new x(this), H(this), B(() => {
|
|
62
62
|
const { transactions: s } = this.transactionStore;
|
|
63
63
|
this.emitUpdate({ transactions: s });
|
|
64
64
|
});
|
|
@@ -84,12 +84,12 @@ var pt = class {
|
|
|
84
84
|
this.userStore.loadUserFeatures()
|
|
85
85
|
]);
|
|
86
86
|
};
|
|
87
|
-
loadData = async ({ accounts: t, appData: o, associatedBeats: e, categories: r, institutions: i, transactionRules: s, transactions: a, userFeatures: n, merchantBudgets: S } = {}) => {
|
|
88
|
-
(!o || !n) && await this.loadConfigData(), o && this.appDataStore.setAppData(o), n && this.userStore.setUserFeatures(n), t && (await this.accountStore.loadMembers(), i && this.accountStore.setInstitutions(i), this.accountStore.setAccounts(t)), e && this.transactionStore.setAssociatedBeats(e), r && this.categoryStore.setCategories(r), a && this.transactionStore.setTransactions(a), s && this.transactionStore.setTransactionRules(s), S && this.budgetsStore.setMerchantBudgets(S);
|
|
87
|
+
loadData = async ({ accounts: t, appData: o, associatedBeats: e, categories: r, institutions: i, transactionRules: s, transactions: a, userFeatures: n, merchantBudgets: S, userInsightProfile: h } = {}) => {
|
|
88
|
+
(!o || !n) && await this.loadConfigData(), o && this.appDataStore.setAppData(o), n && this.userStore.setUserFeatures(n), t && (await this.accountStore.loadMembers(), i && this.accountStore.setInstitutions(i), this.accountStore.setAccounts(t)), e && this.transactionStore.setAssociatedBeats(e), r && this.categoryStore.setCategories(r), a && this.transactionStore.setTransactions(a), s && this.transactionStore.setTransactionRules(s), S && this.budgetsStore.setMerchantBudgets(S), h && this.userStore.setUserInsightProfile(h);
|
|
89
89
|
};
|
|
90
90
|
};
|
|
91
91
|
export {
|
|
92
|
-
|
|
92
|
+
mt as GlobalStore
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
//# sourceMappingURL=GlobalStore.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalStore.es.js","names":[],"sources":["../../../src/core/stores/GlobalStore.ts"],"sourcesContent":["import { autorun, makeAutoObservable } from 'mobx'\n\nimport { DefaultAppConfig } from '../constants/DefaultConfig'\n\nimport {\n AccountStore,\n AgreementStore,\n AnalyticsStore,\n AppDataStore,\n BeatStore,\n BudgetsStore,\n CashflowStore,\n CategoryStore,\n ConnectStore,\n DebtsStore,\n FinstrongStore,\n GlobalCopyStore,\n GlobalUiStore,\n GoalStore,\n HelpStore,\n HoldingStore,\n InsightsV2Store,\n MerchantStore,\n NetWorthStore,\n NotificationStore,\n RecurringTransactionsStore,\n SettingsStore,\n TransactionStore,\n TrendsStore,\n UserStore,\n} from '../stores'\n\nimport type {\n Account,\n Category,\n Institution,\n Member,\n AppConfig,\n AppData,\n Beat,\n GlobalCaptureException,\n GlobalErrorHandler,\n MerchantBudget,\n Tag,\n Tagging,\n Transaction,\n TransactionRule,\n UserFeature,\n} from '../types'\n\ninterface LoadDataProps {\n accounts?: Account[]\n appData?: AppData\n associatedBeats?: Beat[]\n categories?: Category[]\n institutions?: Institution[]\n members?: Member[]\n merchantBudgets?: MerchantBudget[]\n taggings?: Tagging[]\n tags?: Tag[]\n transactionRules?: TransactionRule[]\n transactions?: Transaction[]\n userFeatures?: UserFeature[]\n}\n\ntype OnStoreUpdate = (update: ObservedUpdate) => void\nexport type ObservedUpdate = {\n transactions?: Transaction[]\n /**\n * Guid of a beat whose data went stale because of an action taken inside experiences\n * (e.g. an insight CTA that mutated data). Hosts refetch that beat's sampled data.\n * Emitted only from explicit actions, never from the transactions autorun.\n */\n staleBeatGuid?: string\n}\nexport class GlobalStore {\n // Global properties\n appConfig: AppConfig = DefaultAppConfig\n endpoint: string = '/'\n sessionToken: string = ''\n onCaptureException?: GlobalCaptureException\n onError?: GlobalErrorHandler\n onStoreUpdate?: OnStoreUpdate\n\n // Data Stores\n accountStore: AccountStore\n agreementStore: AgreementStore\n appDataStore: AppDataStore\n analyticsStore: AnalyticsStore\n beatStore: BeatStore\n budgetsStore: BudgetsStore\n cashflowStore: CashflowStore\n categoryStore: CategoryStore\n connectStore: ConnectStore\n copyStore: GlobalCopyStore\n debtsStore: DebtsStore\n finstrongStore: FinstrongStore\n goalStore: GoalStore\n helpStore: HelpStore\n holdingStore: HoldingStore\n merchantStore: MerchantStore\n netWorthStore: NetWorthStore\n notificationStore: NotificationStore\n recurringTransactionsStore: RecurringTransactionsStore\n settingsStore: SettingsStore\n transactionStore: TransactionStore\n trendsStore: TrendsStore\n userStore: UserStore\n\n // UI Stores\n globalUiStore: GlobalUiStore\n insightsV2Store: InsightsV2Store\n\n constructor(\n appConfig: AppConfig = DefaultAppConfig,\n endpoint: string = '/',\n onError?: GlobalErrorHandler,\n onStoreUpdate?: OnStoreUpdate,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.appConfig = appConfig\n this.endpoint = endpoint\n this.sessionToken = appConfig.options.session_token ?? ''\n this.onCaptureException = onCaptureException\n this.onError = onError\n this.onStoreUpdate = onStoreUpdate\n\n this.accountStore = new AccountStore(this)\n this.agreementStore = new AgreementStore(this)\n this.appDataStore = new AppDataStore(this)\n this.analyticsStore = new AnalyticsStore(this)\n this.beatStore = new BeatStore(this)\n this.budgetsStore = new BudgetsStore(this)\n this.cashflowStore = new CashflowStore(this)\n this.categoryStore = new CategoryStore(this)\n this.connectStore = new ConnectStore(this)\n this.copyStore = new GlobalCopyStore(this)\n this.debtsStore = new DebtsStore(this)\n this.finstrongStore = new FinstrongStore(this)\n this.goalStore = new GoalStore(this)\n this.helpStore = new HelpStore(this)\n this.holdingStore = new HoldingStore(this)\n this.merchantStore = new MerchantStore(this)\n this.netWorthStore = new NetWorthStore(this)\n this.notificationStore = new NotificationStore(this)\n this.recurringTransactionsStore = new RecurringTransactionsStore(this)\n this.settingsStore = new SettingsStore(this)\n this.transactionStore = new TransactionStore(this)\n this.trendsStore = new TrendsStore(this)\n this.userStore = new UserStore(this)\n\n this.globalUiStore = new GlobalUiStore(this)\n this.insightsV2Store = new InsightsV2Store(this)\n\n makeAutoObservable(this)\n\n // detects a change based on an observed value\n autorun(() => {\n // destructure or assign new variables to observe changes to them\n // in this case we are observing changes to `transactions`\n const { transactions } = this.transactionStore\n this.emitUpdate({\n transactions,\n })\n })\n }\n\n get isInitialized() {\n return this.globalUiStore.isInitialized\n }\n\n captureException = (error: unknown, context?: Record<string, string>) => {\n if (this.onCaptureException) {\n this.onCaptureException(error, context)\n return\n }\n console.error('Unreported error:', error, context)\n }\n\n // emits change triggered in the autorun\n emitUpdate = (change: ObservedUpdate) => {\n this.onStoreUpdate?.(change)\n }\n\n loadConfigData = async () => {\n await Promise.all([\n // Load copy, config and user data\n this.copyStore.loadCopy(),\n this.appDataStore.loadAppData(),\n this.accountStore.refreshMembers(),\n this.userStore.loadUserFeatures(),\n ])\n }\n\n loadData = async ({\n accounts,\n appData,\n associatedBeats,\n categories,\n institutions,\n transactionRules,\n transactions,\n userFeatures,\n merchantBudgets,\n }: LoadDataProps = {}) => {\n if (!appData || !userFeatures) {\n await this.loadConfigData()\n }\n\n // Keep for backwards compatibility for Insights\n if (appData) {\n this.appDataStore.setAppData(appData)\n }\n\n if (userFeatures) {\n this.userStore.setUserFeatures(userFeatures)\n }\n\n if (accounts) {\n await this.accountStore.loadMembers()\n if (institutions) {\n this.accountStore.setInstitutions(institutions)\n }\n this.accountStore.setAccounts(accounts)\n }\n\n if (associatedBeats) {\n this.transactionStore.setAssociatedBeats(associatedBeats)\n }\n\n if (categories) {\n this.categoryStore.setCategories(categories)\n }\n\n if (transactions) {\n this.transactionStore.setTransactions(transactions)\n }\n\n if (transactionRules) {\n this.transactionStore.setTransactionRules(transactionRules)\n }\n\n if (merchantBudgets) {\n this.budgetsStore.setMerchantBudgets(merchantBudgets)\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"GlobalStore.es.js","names":[],"sources":["../../../src/core/stores/GlobalStore.ts"],"sourcesContent":["import { autorun, makeAutoObservable } from 'mobx'\n\nimport { DefaultAppConfig } from '../constants/DefaultConfig'\n\nimport {\n AccountStore,\n AgreementStore,\n AnalyticsStore,\n AppDataStore,\n BeatStore,\n BudgetsStore,\n CashflowStore,\n CategoryStore,\n ConnectStore,\n DebtsStore,\n FinstrongStore,\n GlobalCopyStore,\n GlobalUiStore,\n GoalStore,\n HelpStore,\n HoldingStore,\n InsightsV2Store,\n MerchantStore,\n NetWorthStore,\n NotificationStore,\n RecurringTransactionsStore,\n SettingsStore,\n TransactionStore,\n TrendsStore,\n UserStore,\n} from '../stores'\n\nimport type {\n Account,\n Category,\n Institution,\n Member,\n AppConfig,\n AppData,\n Beat,\n GlobalCaptureException,\n GlobalErrorHandler,\n MerchantBudget,\n Tag,\n Tagging,\n Transaction,\n TransactionRule,\n UserFeature,\n UserInsightProfile,\n} from '../types'\n\ninterface LoadDataProps {\n accounts?: Account[]\n appData?: AppData\n associatedBeats?: Beat[]\n categories?: Category[]\n institutions?: Institution[]\n members?: Member[]\n merchantBudgets?: MerchantBudget[]\n taggings?: Tagging[]\n tags?: Tag[]\n transactionRules?: TransactionRule[]\n transactions?: Transaction[]\n userFeatures?: UserFeature[]\n /** Loaded by the host (pulse); experiences never fetches it. Read and PUT by insight CTAs. */\n userInsightProfile?: UserInsightProfile\n}\n\ntype OnStoreUpdate = (update: ObservedUpdate) => void\nexport type ObservedUpdate = {\n transactions?: Transaction[]\n /**\n * Guid of a beat whose data went stale because of an action taken inside experiences\n * (e.g. an insight CTA that mutated data). Hosts refetch that beat's sampled data.\n * Emitted only from explicit actions, never from the transactions autorun.\n */\n staleBeatGuid?: string\n}\nexport class GlobalStore {\n // Global properties\n appConfig: AppConfig = DefaultAppConfig\n endpoint: string = '/'\n sessionToken: string = ''\n onCaptureException?: GlobalCaptureException\n onError?: GlobalErrorHandler\n onStoreUpdate?: OnStoreUpdate\n\n // Data Stores\n accountStore: AccountStore\n agreementStore: AgreementStore\n appDataStore: AppDataStore\n analyticsStore: AnalyticsStore\n beatStore: BeatStore\n budgetsStore: BudgetsStore\n cashflowStore: CashflowStore\n categoryStore: CategoryStore\n connectStore: ConnectStore\n copyStore: GlobalCopyStore\n debtsStore: DebtsStore\n finstrongStore: FinstrongStore\n goalStore: GoalStore\n helpStore: HelpStore\n holdingStore: HoldingStore\n merchantStore: MerchantStore\n netWorthStore: NetWorthStore\n notificationStore: NotificationStore\n recurringTransactionsStore: RecurringTransactionsStore\n settingsStore: SettingsStore\n transactionStore: TransactionStore\n trendsStore: TrendsStore\n userStore: UserStore\n\n // UI Stores\n globalUiStore: GlobalUiStore\n insightsV2Store: InsightsV2Store\n\n constructor(\n appConfig: AppConfig = DefaultAppConfig,\n endpoint: string = '/',\n onError?: GlobalErrorHandler,\n onStoreUpdate?: OnStoreUpdate,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.appConfig = appConfig\n this.endpoint = endpoint\n this.sessionToken = appConfig.options.session_token ?? ''\n this.onCaptureException = onCaptureException\n this.onError = onError\n this.onStoreUpdate = onStoreUpdate\n\n this.accountStore = new AccountStore(this)\n this.agreementStore = new AgreementStore(this)\n this.appDataStore = new AppDataStore(this)\n this.analyticsStore = new AnalyticsStore(this)\n this.beatStore = new BeatStore(this)\n this.budgetsStore = new BudgetsStore(this)\n this.cashflowStore = new CashflowStore(this)\n this.categoryStore = new CategoryStore(this)\n this.connectStore = new ConnectStore(this)\n this.copyStore = new GlobalCopyStore(this)\n this.debtsStore = new DebtsStore(this)\n this.finstrongStore = new FinstrongStore(this)\n this.goalStore = new GoalStore(this)\n this.helpStore = new HelpStore(this)\n this.holdingStore = new HoldingStore(this)\n this.merchantStore = new MerchantStore(this)\n this.netWorthStore = new NetWorthStore(this)\n this.notificationStore = new NotificationStore(this)\n this.recurringTransactionsStore = new RecurringTransactionsStore(this)\n this.settingsStore = new SettingsStore(this)\n this.transactionStore = new TransactionStore(this)\n this.trendsStore = new TrendsStore(this)\n this.userStore = new UserStore(this)\n\n this.globalUiStore = new GlobalUiStore(this)\n this.insightsV2Store = new InsightsV2Store(this)\n\n makeAutoObservable(this)\n\n // detects a change based on an observed value\n autorun(() => {\n // destructure or assign new variables to observe changes to them\n // in this case we are observing changes to `transactions`\n const { transactions } = this.transactionStore\n this.emitUpdate({\n transactions,\n })\n })\n }\n\n get isInitialized() {\n return this.globalUiStore.isInitialized\n }\n\n captureException = (error: unknown, context?: Record<string, string>) => {\n if (this.onCaptureException) {\n this.onCaptureException(error, context)\n return\n }\n console.error('Unreported error:', error, context)\n }\n\n // emits change triggered in the autorun\n emitUpdate = (change: ObservedUpdate) => {\n this.onStoreUpdate?.(change)\n }\n\n loadConfigData = async () => {\n await Promise.all([\n // Load copy, config and user data\n this.copyStore.loadCopy(),\n this.appDataStore.loadAppData(),\n this.accountStore.refreshMembers(),\n this.userStore.loadUserFeatures(),\n ])\n }\n\n loadData = async ({\n accounts,\n appData,\n associatedBeats,\n categories,\n institutions,\n transactionRules,\n transactions,\n userFeatures,\n merchantBudgets,\n userInsightProfile,\n }: LoadDataProps = {}) => {\n if (!appData || !userFeatures) {\n await this.loadConfigData()\n }\n\n // Keep for backwards compatibility for Insights\n if (appData) {\n this.appDataStore.setAppData(appData)\n }\n\n if (userFeatures) {\n this.userStore.setUserFeatures(userFeatures)\n }\n\n if (accounts) {\n await this.accountStore.loadMembers()\n if (institutions) {\n this.accountStore.setInstitutions(institutions)\n }\n this.accountStore.setAccounts(accounts)\n }\n\n if (associatedBeats) {\n this.transactionStore.setAssociatedBeats(associatedBeats)\n }\n\n if (categories) {\n this.categoryStore.setCategories(categories)\n }\n\n if (transactions) {\n this.transactionStore.setTransactions(transactions)\n }\n\n if (transactionRules) {\n this.transactionStore.setTransactionRules(transactionRules)\n }\n\n if (merchantBudgets) {\n this.budgetsStore.setMerchantBudgets(merchantBudgets)\n }\n\n if (userInsightProfile) {\n this.userStore.setUserInsightProfile(userInsightProfile)\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,IAAa,KAAb,MAAyB;AAAA,EAEvB,YAAuB;AAAA,EACvB,WAAmB;AAAA,EACnB,eAAuB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EAEA,YACE,IAAuB,GACvB,IAAmB,KACnB,GACA,GACA,GACA;AACA,SAAK,YAAY,GACjB,KAAK,WAAW,GAChB,KAAK,eAAe,EAAU,QAAQ,iBAAiB,IACvD,KAAK,qBAAqB,GAC1B,KAAK,UAAU,GACf,KAAK,gBAAgB,GAErB,KAAK,eAAe,IAAI,EAAa,IAAI,GACzC,KAAK,iBAAiB,IAAI,EAAe,IAAI,GAC7C,KAAK,eAAe,IAAI,EAAa,IAAI,GACzC,KAAK,iBAAiB,IAAI,EAAe,IAAI,GAC7C,KAAK,YAAY,IAAI,EAAU,IAAI,GACnC,KAAK,eAAe,IAAI,EAAa,IAAI,GACzC,KAAK,gBAAgB,IAAI,EAAc,IAAI,GAC3C,KAAK,gBAAgB,IAAI,EAAc,IAAI,GAC3C,KAAK,eAAe,IAAI,EAAa,IAAI,GACzC,KAAK,YAAY,IAAI,EAAgB,IAAI,GACzC,KAAK,aAAa,IAAI,EAAW,IAAI,GACrC,KAAK,iBAAiB,IAAI,EAAe,IAAI,GAC7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,cAAA,GACA,kBAAA,GACA,cAAA,GACA,cAAA,GACA,iBAAA,GACA,oBAAA,EAAA,IACiB,CAAC,MAAM;AACxB,KAAI,CAAC,KAAW,CAAC,MACf,MAAM,KAAK,eAAe,GAIxB,KACF,KAAK,aAAa,WAAW,CAAO,GAGlC,KACF,KAAK,UAAU,gBAAgB,CAAY,GAGzC,MACF,MAAM,KAAK,aAAa,YAAY,GAChC,KACF,KAAK,aAAa,gBAAgB,CAAY,GAEhD,KAAK,aAAa,YAAY,CAAQ,IAGpC,KACF,KAAK,iBAAiB,mBAAmB,CAAe,GAGtD,KACF,KAAK,cAAc,cAAc,CAAU,GAGzC,KACF,KAAK,iBAAiB,gBAAgB,CAAY,GAGhD,KACF,KAAK,iBAAiB,oBAAoB,CAAgB,GAGxD,KACF,KAAK,aAAa,mBAAmB,CAAe,GAGlD,KACF,KAAK,UAAU,sBAAsB,CAAkB;AAAA,EAE3D;AACF"}
|
|
@@ -54,6 +54,18 @@ export declare const ANALYTICS_EVENTS_CONFIG: {
|
|
|
54
54
|
readonly category: "Safety Net";
|
|
55
55
|
readonly action: (beat: Beat) => string;
|
|
56
56
|
};
|
|
57
|
+
readonly EMERGENCY_SAVINGS_ACCT_SELECTED: {
|
|
58
|
+
readonly category: "Emergency Savings";
|
|
59
|
+
readonly action: "Designate Emergency Savings Account Selected";
|
|
60
|
+
};
|
|
61
|
+
readonly EMERGENCY_SAVINGS_ACCT_SAVED: {
|
|
62
|
+
readonly category: "Emergency Savings";
|
|
63
|
+
readonly action: "Designate Emergency Savings Account Saved";
|
|
64
|
+
};
|
|
65
|
+
readonly EMERGENCY_SAVINGS_ACCT_CREATED: {
|
|
66
|
+
readonly category: "Emergency Savings";
|
|
67
|
+
readonly action: "Designate Emergency Savings Account - Savings Account Created";
|
|
68
|
+
};
|
|
57
69
|
readonly OPENED_CONNECT_DRAWER: {
|
|
58
70
|
readonly postHog: {
|
|
59
71
|
readonly eventName: "opened_connect_drawer";
|
|
@@ -43,6 +43,18 @@ var t = (e) => e?.replace(/([A-Z]+)/g, " $1")?.replace(/^ /, "") ?? "", a = {
|
|
|
43
43
|
category: "Safety Net",
|
|
44
44
|
action: (e) => `${t(e.template)} = Edit Safety Net - Cancel`
|
|
45
45
|
},
|
|
46
|
+
EMERGENCY_SAVINGS_ACCT_SELECTED: {
|
|
47
|
+
category: "Emergency Savings",
|
|
48
|
+
action: "Designate Emergency Savings Account Selected"
|
|
49
|
+
},
|
|
50
|
+
EMERGENCY_SAVINGS_ACCT_SAVED: {
|
|
51
|
+
category: "Emergency Savings",
|
|
52
|
+
action: "Designate Emergency Savings Account Saved"
|
|
53
|
+
},
|
|
54
|
+
EMERGENCY_SAVINGS_ACCT_CREATED: {
|
|
55
|
+
category: "Emergency Savings",
|
|
56
|
+
action: "Designate Emergency Savings Account - Savings Account Created"
|
|
57
|
+
},
|
|
46
58
|
OPENED_CONNECT_DRAWER: { postHog: {
|
|
47
59
|
eventName: "opened_connect_drawer",
|
|
48
60
|
properties: (e) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyticsEventsConfig.es.js","names":[],"sources":["../../../src/insights-v2/analytics/analyticsEventsConfig.ts"],"sourcesContent":["import type { Beat } from '../../core'\n\n// PascalCase template to label, ported from Pulse.\nexport const sentenceCaseTemplate = (template?: string | null): string =>\n template?.replace(/([A-Z]+)/g, ' $1')?.replace(/^ /, '') ?? ''\n\n// Fixed or beat-computed value.\ntype Resolvable = string | ((beat: Beat) => string)\n\n// Source of truth for insights-v2 analytics events. Mirrors Pulse's strings.\n// Entry has a Firefly half (action/category) and/or a postHog half.\nexport interface AnalyticsEventConfigEntry {\n category?: Resolvable\n action?: Resolvable\n postHog?: {\n eventName: string\n properties?: (beat: Beat) => Record<string, unknown>\n }\n}\n\nexport const ANALYTICS_EVENTS_CONFIG = {\n // Primary/secondary CTA click, fired via sendCtaAnalytics.\n PRIMARY_ACTION_SELECTED: {\n category: 'Beat Interaction',\n action: 'Primary Action Selected',\n },\n SECONDARY_ACTION_SELECTED: {\n category: 'Beat Interaction',\n action: 'Secondary Action Selected',\n },\n // Fires once, gated on !beat.cta_clicked_at.\n FIRST_TIME_PRIMARY_ACTION_SELECTED: {\n category: 'Beat Interaction',\n action: 'First Time Primary Action Selected',\n },\n\n // Bar click on the card's inline chart.\n CHART_BAR_CLICKED: {\n category: 'Beat Chart',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Bar Clicked`,\n },\n // Bar click inside the drill-down drawer.\n DRAWER_CHART_BAR_CLICKED: {\n category: 'Drawer Chart',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Bar Clicked`,\n },\n // Month/tab change inside the drill-down drawer.\n TAB_SELECTED: {\n category: 'Drawer Chart',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Month Tab Selected`,\n },\n\n // LowAccountBalance threshold dialog.\n EDIT_INSIGHT_THRESHOLD_SAVE: {\n category: 'User Configurable Settings',\n action: 'Edit Insight Threshold Save',\n },\n EDIT_INSIGHT_THRESHOLD_CANCELED: {\n category: 'User Configurable Settings',\n action: 'Edit Insight Threshold Canceled',\n },\n EDIT_INSIGHT_THRESHOLD_INPUT_SELECTED: {\n category: 'User Configurable Settings',\n action: 'Edit Insight Threshold Input Selected',\n },\n\n // SavingsOpportunityV2 safety-net dialog.\n EDIT_SAFETY_NET_SAVE: {\n category: 'Safety Net',\n action: 'Edit Safety Net',\n },\n // Ported verbatim from Pulse (uses '=' not '-').\n EDIT_SAFETY_NET_CANCEL: {\n category: 'Safety Net',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} = Edit Safety Net - Cancel`,\n },\n\n // Connect drawer opened. PostHog-only.\n OPENED_CONNECT_DRAWER: {\n postHog: {\n eventName: 'opened_connect_drawer',\n properties: (beat) => ({ beat_guid: beat.guid, template: beat.template }),\n },\n },\n} as const satisfies Record<string, AnalyticsEventConfigEntry>\n"],"mappings":"AAGA,IAAa,IAAA,CAAwB,MACnC,GAAU,QAAQ,aAAa,KAAK,GAAG,QAAQ,MAAM,EAAE,KAAK,IAgBjD,IAA0B;AAAA,EAErC,yBAAyB;AAAA,IACvB,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,2BAA2B;AAAA,IACzB,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAEA,oCAAoC;AAAA,IAClC,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAGA,mBAAmB;AAAA,IACjB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAEA,0BAA0B;AAAA,IACxB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAEA,cAAc;AAAA,IACZ,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAGA,6BAA6B;AAAA,IAC3B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,iCAAiC;AAAA,IAC/B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,uCAAuC;AAAA,IACrC,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAGA,sBAAsB;AAAA,IACpB,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAEA,wBAAwB;AAAA,IACtB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAGA,uBAAuB,EACrB,SAAS;AAAA,IACP,WAAW;AAAA,IACX,YAAA,CAAa,OAAU;AAAA,MAAE,WAAW,EAAK;AAAA,MAAM,UAAU,EAAK;AAAA,IAAS;AAAA,EACzE,EACF;AACF"}
|
|
1
|
+
{"version":3,"file":"analyticsEventsConfig.es.js","names":[],"sources":["../../../src/insights-v2/analytics/analyticsEventsConfig.ts"],"sourcesContent":["import type { Beat } from '../../core'\n\n// PascalCase template to label, ported from Pulse.\nexport const sentenceCaseTemplate = (template?: string | null): string =>\n template?.replace(/([A-Z]+)/g, ' $1')?.replace(/^ /, '') ?? ''\n\n// Fixed or beat-computed value.\ntype Resolvable = string | ((beat: Beat) => string)\n\n// Source of truth for insights-v2 analytics events. Mirrors Pulse's strings.\n// Entry has a Firefly half (action/category) and/or a postHog half.\nexport interface AnalyticsEventConfigEntry {\n category?: Resolvable\n action?: Resolvable\n postHog?: {\n eventName: string\n properties?: (beat: Beat) => Record<string, unknown>\n }\n}\n\nexport const ANALYTICS_EVENTS_CONFIG = {\n // Primary/secondary CTA click, fired via sendCtaAnalytics.\n PRIMARY_ACTION_SELECTED: {\n category: 'Beat Interaction',\n action: 'Primary Action Selected',\n },\n SECONDARY_ACTION_SELECTED: {\n category: 'Beat Interaction',\n action: 'Secondary Action Selected',\n },\n // Fires once, gated on !beat.cta_clicked_at.\n FIRST_TIME_PRIMARY_ACTION_SELECTED: {\n category: 'Beat Interaction',\n action: 'First Time Primary Action Selected',\n },\n\n // Bar click on the card's inline chart.\n CHART_BAR_CLICKED: {\n category: 'Beat Chart',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Bar Clicked`,\n },\n // Bar click inside the drill-down drawer.\n DRAWER_CHART_BAR_CLICKED: {\n category: 'Drawer Chart',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Bar Clicked`,\n },\n // Month/tab change inside the drill-down drawer.\n TAB_SELECTED: {\n category: 'Drawer Chart',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Month Tab Selected`,\n },\n\n // LowAccountBalance threshold dialog.\n EDIT_INSIGHT_THRESHOLD_SAVE: {\n category: 'User Configurable Settings',\n action: 'Edit Insight Threshold Save',\n },\n EDIT_INSIGHT_THRESHOLD_CANCELED: {\n category: 'User Configurable Settings',\n action: 'Edit Insight Threshold Canceled',\n },\n EDIT_INSIGHT_THRESHOLD_INPUT_SELECTED: {\n category: 'User Configurable Settings',\n action: 'Edit Insight Threshold Input Selected',\n },\n\n // SavingsOpportunityV2 safety-net dialog.\n EDIT_SAFETY_NET_SAVE: {\n category: 'Safety Net',\n action: 'Edit Safety Net',\n },\n // Ported verbatim from Pulse (uses '=' not '-').\n EDIT_SAFETY_NET_CANCEL: {\n category: 'Safety Net',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} = Edit Safety Net - Cancel`,\n },\n\n // Designate Emergency Savings Account (picker pick, Save, Open a Savings Account). Pulse's strings.\n EMERGENCY_SAVINGS_ACCT_SELECTED: {\n category: 'Emergency Savings',\n action: 'Designate Emergency Savings Account Selected',\n },\n EMERGENCY_SAVINGS_ACCT_SAVED: {\n category: 'Emergency Savings',\n action: 'Designate Emergency Savings Account Saved',\n },\n EMERGENCY_SAVINGS_ACCT_CREATED: {\n category: 'Emergency Savings',\n action: 'Designate Emergency Savings Account - Savings Account Created',\n },\n\n // Connect drawer opened. PostHog-only.\n OPENED_CONNECT_DRAWER: {\n postHog: {\n eventName: 'opened_connect_drawer',\n properties: (beat) => ({ beat_guid: beat.guid, template: beat.template }),\n },\n },\n} as const satisfies Record<string, AnalyticsEventConfigEntry>\n"],"mappings":"AAGA,IAAa,IAAA,CAAwB,MACnC,GAAU,QAAQ,aAAa,KAAK,GAAG,QAAQ,MAAM,EAAE,KAAK,IAgBjD,IAA0B;AAAA,EAErC,yBAAyB;AAAA,IACvB,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,2BAA2B;AAAA,IACzB,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAEA,oCAAoC;AAAA,IAClC,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAGA,mBAAmB;AAAA,IACjB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAEA,0BAA0B;AAAA,IACxB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAEA,cAAc;AAAA,IACZ,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAGA,6BAA6B;AAAA,IAC3B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,iCAAiC;AAAA,IAC/B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,uCAAuC;AAAA,IACrC,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAGA,sBAAsB;AAAA,IACpB,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAEA,wBAAwB;AAAA,IACtB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAGA,iCAAiC;AAAA,IAC/B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,8BAA8B;AAAA,IAC5B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,gCAAgC;AAAA,IAC9B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAGA,uBAAuB,EACrB,SAAS;AAAA,IACP,WAAW;AAAA,IACX,YAAA,CAAa,OAAU;AAAA,MAAE,WAAW,EAAK;AAAA,MAAM,UAAU,EAAK;AAAA,IAAS;AAAA,EACzE,EACF;AACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface EmergencySavingsAccountPickerProps {
|
|
2
|
+
beatGuid?: string;
|
|
3
|
+
/** The beat's `instance_slot.data` for the `savings_account_picker` variant. */
|
|
4
|
+
data?: Record<string, unknown>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Designate Emergency Savings Account picker (svg_image_block / savings_account_picker). Lists
|
|
8
|
+
* the user's savings accounts from the account store; the words come from the slot. A pick is
|
|
9
|
+
* only written to the beat's context — the card's "Save" CTA (`select_savings_account`) reads it
|
|
10
|
+
* and makes the API call.
|
|
11
|
+
*/
|
|
12
|
+
export declare const EmergencySavingsAccountPicker: (({ beatGuid, data }: EmergencySavingsAccountPickerProps) => import("react/jsx-runtime").JSX.Element | null) & {
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useAccountStore as p, useInsightsV2Store as u } from "../../../../common/context/hooks.es.js";
|
|
2
|
+
import { ANALYTICS_EVENTS_CONFIG as _ } from "../../../analytics/analyticsEventsConfig.es.js";
|
|
3
|
+
import { useAnalyticsEvent as v } from "../../../analytics/useAnalyticsEvent.es.js";
|
|
4
|
+
import d from "../../../components/DesignateEmergencySavingsCard.es.js";
|
|
5
|
+
import { observer as E } from "mobx-react-lite";
|
|
6
|
+
import { jsx as S } from "react/jsx-runtime";
|
|
7
|
+
var o = (t) => typeof t == "string" ? t : void 0, b = E(({ beatGuid: t, data: n = {} }) => {
|
|
8
|
+
const i = p(), r = u(), l = v();
|
|
9
|
+
if (!t) return null;
|
|
10
|
+
const a = o(r.beatContext[t]?.selected_account_guid), s = i.visibleSavingsAccounts.filter((e) => !e.is_closed && !e.is_deleted).map(({ guid: e, name: m }) => ({
|
|
11
|
+
value: e,
|
|
12
|
+
label: m ?? ""
|
|
13
|
+
})), c = a ?? o(n.emergency_savings_account_guid), g = s.some((e) => e.value === c) ? c ?? "" : "";
|
|
14
|
+
return /* @__PURE__ */ S(d, {
|
|
15
|
+
graphic: null,
|
|
16
|
+
onChange: (e) => {
|
|
17
|
+
r.setBeatContext(t, { selected_account_guid: e }), l(_.EMERGENCY_SAVINGS_ACCT_SELECTED);
|
|
18
|
+
},
|
|
19
|
+
options: s,
|
|
20
|
+
placeholder: o(n.picker_placeholder),
|
|
21
|
+
selectLabel: o(n.picker_label),
|
|
22
|
+
sx: { width: "100%" },
|
|
23
|
+
value: g
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
export {
|
|
27
|
+
b as EmergencySavingsAccountPicker
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=EmergencySavingsAccountPicker.es.js.map
|
package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.es.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmergencySavingsAccountPicker.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport { useAccountStore, useInsightsV2Store } from '../../../../common'\nimport DesignateEmergencySavingsCard from '../../../components/DesignateEmergencySavingsCard'\nimport { ANALYTICS_EVENTS_CONFIG } from '../../../analytics/analyticsEventsConfig'\nimport { useAnalyticsEvent } from '../../../analytics'\n\ninterface EmergencySavingsAccountPickerProps {\n beatGuid?: string\n /** The beat's `instance_slot.data` for the `savings_account_picker` variant. */\n data?: Record<string, unknown>\n}\n\nconst text = (value: unknown) => (typeof value === 'string' ? value : undefined)\n\n/**\n * Designate Emergency Savings Account picker (svg_image_block / savings_account_picker). Lists\n * the user's savings accounts from the account store; the words come from the slot. A pick is\n * only written to the beat's context — the card's \"Save\" CTA (`select_savings_account`) reads it\n * and makes the API call.\n */\nexport const EmergencySavingsAccountPicker = observer(\n ({ beatGuid, data = {} }: EmergencySavingsAccountPickerProps) => {\n const accountStore = useAccountStore()\n const insightsV2Store = useInsightsV2Store()\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n if (!beatGuid) return null\n\n const picked = text(insightsV2Store.beatContext[beatGuid]?.selected_account_guid)\n // Only an account the user can still save into: visible, open and not deleted.\n const options = accountStore.visibleSavingsAccounts\n .filter((account) => !account.is_closed && !account.is_deleted)\n .map(({ guid, name }) => ({ value: guid, label: name ?? '' }))\n\n // The pick, else the designation the slot carries — only when it is among the options, so an\n // account the filter dropped (hidden, closed, deleted) shows the placeholder, not a blank value.\n const candidate = picked ?? text(data.emergency_savings_account_guid)\n const value = options.some((option) => option.value === candidate) ? (candidate ?? '') : ''\n\n const onChange = (guid: string) => {\n insightsV2Store.setBeatContext(beatGuid, { selected_account_guid: guid })\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_SELECTED)\n }\n\n return (\n <DesignateEmergencySavingsCard\n graphic={null}\n onChange={onChange}\n options={options}\n placeholder={text(data.picker_placeholder)}\n selectLabel={text(data.picker_label)}\n sx={{ width: '100%' }}\n value={value}\n />\n )\n },\n)\n"],"mappings":";;;;;;AAaA,IAAM,IAAA,CAAQ,MAAoB,OAAO,KAAU,WAAW,IAAQ,QAQzD,IAAgC,EAAA,CAC1C,EAAE,UAAA,GAAU,MAAA,IAAO,CAAC,EAAA,MAA4C;AAC/D,QAAM,IAAe,EAAgB,GAC/B,IAAkB,EAAmB,GACrC,IAAqB,EAAkB;AAE7C,MAAI,CAAC,EAAU,QAAO;AAEtB,QAAM,IAAS,EAAK,EAAgB,YAAY,CAAA,GAAW,qBAAqB,GAE1E,IAAU,EAAa,uBAC1B,OAAA,CAAQ,MAAY,CAAC,EAAQ,aAAa,CAAC,EAAQ,UAAU,EAC7D,IAAA,CAAK,EAAE,MAAA,GAAM,MAAA,EAAA,OAAY;AAAA,IAAE,OAAO;AAAA,IAAM,OAAO,KAAQ;AAAA,EAAG,EAAE,GAIzD,IAAY,KAAU,EAAK,EAAK,8BAA8B,GAC9D,IAAQ,EAAQ,KAAA,CAAM,MAAW,EAAO,UAAU,CAAS,IAAK,KAAa,KAAM;AAOzF,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,SAAS;AAAA,IACC,UARR,CAAY,MAAiB;AACjC,MAAA,EAAgB,eAAe,GAAU,EAAE,uBAAuB,EAAK,CAAC,GACxE,EAAmB,EAAwB,+BAA+B;AAAA,IAC5E;AAAA,IAMa,SAAA;AAAA,IACT,aAAa,EAAK,EAAK,kBAAkB;AAAA,IACzC,aAAa,EAAK,EAAK,YAAY;AAAA,IACnC,IAAI,EAAE,OAAO,OAAO;AAAA,IACb,OAAA;AAAA,EACR,CAAA;AAEL,CACF"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { BlockProps } from '../../types';
|
|
2
2
|
import { SVGImageBlockData } from '../../../../core/types/InsightsInstanceSlotData';
|
|
3
|
-
export declare const SVGImageBlock: ({ payload: { instance_slot, instance_slot_data, widget_type }, }: BlockProps<SVGImageBlockData>) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const SVGImageBlock: ({ payload: { instance_slot, instance_slot_data, widget_type }, beatGuid, }: BlockProps<SVGImageBlockData>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,20 +1,41 @@
|
|
|
1
|
-
import { ThemedSVGImage as
|
|
2
|
-
import {
|
|
1
|
+
import { ThemedSVGImage as f } from "../../../components/chartblocks/ThemedSVGImage.es.js";
|
|
2
|
+
import { resolveVariantConfig as p } from "../../resolveVariantConfig.es.js";
|
|
3
|
+
import { getLayoutConfig as d } from "./layout.es.js";
|
|
4
|
+
import { CtaStatus as v } from "../../../components/CtaStatus.es.js";
|
|
5
|
+
import { EmergencySavingsAccountPicker as h } from "./EmergencySavingsAccountPicker.es.js";
|
|
3
6
|
import s from "@mui/material/Stack";
|
|
4
|
-
import { jsx as
|
|
5
|
-
var
|
|
6
|
-
const
|
|
7
|
-
return /* @__PURE__ */
|
|
7
|
+
import { jsx as o, jsxs as u } from "react/jsx-runtime";
|
|
8
|
+
var V = ({ payload: { instance_slot: m, instance_slot_data: n, widget_type: t }, beatGuid: c }) => {
|
|
9
|
+
const l = t === "mini", a = t === "full", { variant: g, data: e } = m, i = p(d(n?.isCIBC), g, "savings", "SVGImageBlock"), r = typeof e?.saved_label == "string" ? e.saved_label.trim() : "";
|
|
10
|
+
return /* @__PURE__ */ u(s, {
|
|
8
11
|
alignItems: "center",
|
|
9
12
|
sx: { width: "100%" },
|
|
10
|
-
children:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ o(f, {
|
|
15
|
+
image: i.image,
|
|
16
|
+
isMini: l
|
|
17
|
+
}),
|
|
18
|
+
i.showPicker && a && /* @__PURE__ */ o(h, {
|
|
19
|
+
beatGuid: c,
|
|
20
|
+
data: e
|
|
21
|
+
}),
|
|
22
|
+
i.showSavedLabel && a && r && /* @__PURE__ */ o(s, {
|
|
23
|
+
sx: {
|
|
24
|
+
pt: 24,
|
|
25
|
+
px: 16,
|
|
26
|
+
width: "100%"
|
|
27
|
+
},
|
|
28
|
+
children: /* @__PURE__ */ o(v, {
|
|
29
|
+
icon: "check_circle",
|
|
30
|
+
label: r,
|
|
31
|
+
tone: "success"
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
]
|
|
14
35
|
});
|
|
15
36
|
};
|
|
16
37
|
export {
|
|
17
|
-
|
|
38
|
+
V as SVGImageBlock
|
|
18
39
|
};
|
|
19
40
|
|
|
20
41
|
//# sourceMappingURL=SVGImageBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SVGImageBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.tsx"],"sourcesContent":["import { BlockProps } from '../../types'\nimport
|
|
1
|
+
{"version":3,"file":"SVGImageBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { BlockProps } from '../../types'\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { getLayoutConfig } from './layout'\n\nimport type { SVGImageBlockData } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport { ThemedSVGImage } from '../../../components/chartblocks/ThemedSVGImage'\nimport { CtaStatus } from '../../../components/CtaStatus'\nimport { EmergencySavingsAccountPicker } from './EmergencySavingsAccountPicker'\n\nexport const SVGImageBlock = ({\n payload: { instance_slot, instance_slot_data, widget_type },\n beatGuid,\n}: BlockProps<SVGImageBlockData>) => {\n const isMini = widget_type === 'mini'\n const isFull = widget_type === 'full'\n const { variant, data } = instance_slot\n // An unknown variant (drift with ditto) warns and draws the plain illustration.\n const layoutConfig = resolveVariantConfig(\n getLayoutConfig(instance_slot_data?.isCIBC),\n variant,\n 'savings',\n 'SVGImageBlock',\n )\n\n const savedLabel = typeof data?.saved_label === 'string' ? data.saved_label.trim() : ''\n\n return (\n <Stack alignItems=\"center\" sx={{ width: '100%' }}>\n <ThemedSVGImage image={layoutConfig.image} isMini={isMini} />\n {layoutConfig.showPicker && isFull && (\n <EmergencySavingsAccountPicker beatGuid={beatGuid} data={data} />\n )}\n {layoutConfig.showSavedLabel &&\n isFull &&\n savedLabel && (\n // Figma 1943:219096: the saved status sits in the card body, under the illustration.\n <Stack sx={{ pt: 24, px: 16, width: '100%' }}>\n <CtaStatus icon=\"check_circle\" label={savedLabel} tone=\"success\" />\n </Stack>\n )}\n </Stack>\n )\n}\n"],"mappings":";;;;;;;AAYA,IAAa,IAAA,CAAiB,EAC5B,SAAS,EAAE,eAAA,GAAe,oBAAA,GAAoB,aAAA,EAAA,GAC9C,UAAA,EAAA,MACmC;AACnC,QAAM,IAAS,MAAgB,QACzB,IAAS,MAAgB,QACzB,EAAE,SAAA,GAAS,MAAA,EAAA,IAAS,GAEpB,IAAe,EACnB,EAAgB,GAAoB,MAAM,GAC1C,GACA,WACA,eACF,GAEM,IAAa,OAAO,GAAM,eAAgB,WAAW,EAAK,YAAY,KAAK,IAAI;AAErF,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,YAAW;AAAA,IAAS,IAAI,EAAE,OAAO,OAAO;AAAA,IAA/C,UAAA;AAAA,MACE,gBAAA,EAAC,GAAD;AAAA,QAAgB,OAAO,EAAa;AAAA,QAAe,QAAA;AAAA,MAAS,CAAA;AAAA,MAC3D,EAAa,cAAc,KAC1B,gBAAA,EAAC,GAAD;AAAA,QAAyC,UAAA;AAAA,QAAgB,MAAA;AAAA,MAAO,CAAA;AAAA,MAEjE,EAAa,kBACZ,KACA,KAEE,gBAAA,EAAC,GAAD;AAAA,QAAO,IAAI;AAAA,UAAE,IAAI;AAAA,UAAI,IAAI;AAAA,UAAI,OAAO;AAAA,QAAO;AAAA,QACzC,UAAA,gBAAA,EAAC,GAAD;AAAA,UAAW,MAAK;AAAA,UAAe,OAAO;AAAA,UAAY,MAAK;AAAA,QAAW,CAAA;AAAA,MAC7D,CAAA;AAAA,IAEN;AAAA;AAEX"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
export
|
|
2
|
-
image:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
1
|
+
export interface SVGImageLayoutConfig {
|
|
2
|
+
image: React.FC<React.SVGProps<SVGSVGElement>>;
|
|
3
|
+
/** Draw the savings-account picker under the image (full card only). */
|
|
4
|
+
showPicker?: boolean;
|
|
5
|
+
/** Draw the slot's `saved_label` as a status under the image (full card only). */
|
|
6
|
+
showSavedLabel?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export type SVGImageVariant = 'Holiday' | 'Reminder' | 'savings' | 'savings_account_picker' | 'savings_account_saved';
|
|
9
|
+
/** Variant table for resolveVariantConfig; `isCibc` picks the CIBC art where a variant has one. */
|
|
10
|
+
export declare const getLayoutConfig: (isCibc?: boolean) => Record<SVGImageVariant, SVGImageLayoutConfig>;
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import { ReactComponent as
|
|
2
|
-
import { ReactComponent as
|
|
3
|
-
import { ReactComponent as
|
|
4
|
-
import { ReactComponent as
|
|
1
|
+
import { ReactComponent as o } from "./images/UpcomingTaxDeadlineAlert.es.js";
|
|
2
|
+
import { ReactComponent as r } from "./images/UpcomingTaxDeadlineAlertCIBC.es.js";
|
|
3
|
+
import { ReactComponent as t } from "./images/FederalBankHoliday.es.js";
|
|
4
|
+
import { ReactComponent as m } from "./images/FederalBankHolidayCibc.es.js";
|
|
5
5
|
import { ReactComponent as n } from "./images/DesignateEmergencySavingsAccount.es.js";
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
var a = (e = {}) => ({
|
|
7
|
+
image: n,
|
|
8
|
+
showPicker: !1,
|
|
9
|
+
showSavedLabel: !1,
|
|
10
|
+
...e
|
|
11
|
+
}), R = (e = !1) => ({
|
|
12
|
+
Holiday: { image: e ? m : t },
|
|
13
|
+
Reminder: { image: e ? r : o },
|
|
14
|
+
savings: a(),
|
|
15
|
+
savings_account_picker: a({ showPicker: !0 }),
|
|
16
|
+
savings_account_saved: a({ showSavedLabel: !0 })
|
|
17
|
+
});
|
|
11
18
|
export {
|
|
12
|
-
|
|
19
|
+
R as getLayoutConfig
|
|
13
20
|
};
|
|
14
21
|
|
|
15
22
|
//# sourceMappingURL=layout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.ts"],"sourcesContent":["// SVGs to be moved to S3 and imported from there.\nimport { ReactComponent as UpcomingTaxDeadline } from './images/UpcomingTaxDeadlineAlert.svg'\nimport { ReactComponent as UpcomingTaxDeadlineCIBC } from './images/UpcomingTaxDeadlineAlertCIBC.svg'\n\nimport { ReactComponent as FederalBankHoliday } from './images/FederalBankHoliday.svg'\nimport { ReactComponent as FederalBankHolidayCIBC } from './images/FederalBankHolidayCibc.svg'\n\nimport { ReactComponent as DesignateEmergencySavingsAccount } from './images/DesignateEmergencySavingsAccount.svg'\n\nexport
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.ts"],"sourcesContent":["// SVGs to be moved to S3 and imported from there.\nimport { ReactComponent as UpcomingTaxDeadline } from './images/UpcomingTaxDeadlineAlert.svg'\nimport { ReactComponent as UpcomingTaxDeadlineCIBC } from './images/UpcomingTaxDeadlineAlertCIBC.svg'\n\nimport { ReactComponent as FederalBankHoliday } from './images/FederalBankHoliday.svg'\nimport { ReactComponent as FederalBankHolidayCIBC } from './images/FederalBankHolidayCibc.svg'\n\nimport { ReactComponent as DesignateEmergencySavingsAccount } from './images/DesignateEmergencySavingsAccount.svg'\n\nexport interface SVGImageLayoutConfig {\n image: React.FC<React.SVGProps<SVGSVGElement>>\n /** Draw the savings-account picker under the image (full card only). */\n showPicker?: boolean\n /** Draw the slot's `saved_label` as a status under the image (full card only). */\n showSavedLabel?: boolean\n}\n\n// Designate Emergency Savings Account (ditto layout variants): the illustration alone (open_account),\n// with the account picker (choose_account), or with the \"Account Saved!\" status in the card body\n// (change_account, the card the beat refreshes into after Save; Figma 1943:219096).\nconst emergencySavings = (overrides: Partial<SVGImageLayoutConfig> = {}): SVGImageLayoutConfig => ({\n image: DesignateEmergencySavingsAccount,\n showPicker: false,\n showSavedLabel: false,\n ...overrides,\n})\n\nexport type SVGImageVariant =\n | 'Holiday'\n | 'Reminder'\n | 'savings'\n | 'savings_account_picker'\n | 'savings_account_saved'\n\n/** Variant table for resolveVariantConfig; `isCibc` picks the CIBC art where a variant has one. */\nexport const getLayoutConfig = (\n isCibc: boolean = false,\n): Record<SVGImageVariant, SVGImageLayoutConfig> => ({\n Holiday: {\n image: isCibc ? FederalBankHolidayCIBC : FederalBankHoliday,\n },\n Reminder: {\n image: isCibc ? UpcomingTaxDeadlineCIBC : UpcomingTaxDeadline,\n },\n savings: emergencySavings(),\n savings_account_picker: emergencySavings({ showPicker: true }),\n savings_account_saved: emergencySavings({ showSavedLabel: true }),\n})\n"],"mappings":";;;;;AAoBA,IAAM,IAAA,CAAoB,IAA2C,CAAC,OAA6B;AAAA,EACjG,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,GAAG;AACL,IAUa,IAAA,CACX,IAAkB,QACiC;AAAA,EACnD,SAAS,EACP,OAAO,IAAS,IAAyB,EAC3C;AAAA,EACA,UAAU,EACR,OAAO,IAAS,IAA0B,EAC5C;AAAA,EACA,SAAS,EAAiB;AAAA,EAC1B,wBAAwB,EAAiB,EAAE,YAAY,GAAK,CAAC;AAAA,EAC7D,uBAAuB,EAAiB,EAAE,gBAAgB,GAAK,CAAC;AAClE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type CtaStatusTone = 'success' | 'neutral' | 'error';
|
|
2
|
+
export interface CtaStatusProps {
|
|
3
|
+
/** The words, from the backend (copy or a slot) so they stay localized and customizable. */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Background, border, icon and text colours. */
|
|
6
|
+
tone: CtaStatusTone;
|
|
7
|
+
/** mx-icons name, drawn filled and hidden from assistive technology. */
|
|
8
|
+
icon?: string;
|
|
9
|
+
/** An inline button inside the status (e.g. Subscription Detected's "Undo"). */
|
|
10
|
+
action?: {
|
|
11
|
+
label: string;
|
|
12
|
+
onPress: () => void;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A CTA slot's status: what the slot shows once its action is done, instead of a button. Not a
|
|
17
|
+
* control itself (`role="status"`); only the optional inline `action` is pressable.
|
|
18
|
+
*/
|
|
19
|
+
export declare const CtaStatus: ({ label, tone, icon, action }: CtaStatusProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import i from "@mui/material/Stack";
|
|
2
|
+
import { Text as n } from "@mxenabled/mxui";
|
|
3
|
+
import c from "@mui/material/Button";
|
|
4
|
+
import { Icon as m } from "@mxenabled/mx-icons";
|
|
5
|
+
import { jsx as t, jsxs as s } from "react/jsx-runtime";
|
|
6
|
+
var d = {
|
|
7
|
+
success: {
|
|
8
|
+
main: "success.main",
|
|
9
|
+
fill: "success.lighter",
|
|
10
|
+
text: "success.dark"
|
|
11
|
+
},
|
|
12
|
+
neutral: {
|
|
13
|
+
main: "text.secondary",
|
|
14
|
+
fill: "background.default",
|
|
15
|
+
text: "text.primary"
|
|
16
|
+
},
|
|
17
|
+
error: {
|
|
18
|
+
main: "error.main",
|
|
19
|
+
fill: "error.lighter",
|
|
20
|
+
text: "error.dark"
|
|
21
|
+
}
|
|
22
|
+
}, g = ({ label: l, tone: a, icon: o, action: e }) => {
|
|
23
|
+
const r = d[a];
|
|
24
|
+
return /* @__PURE__ */ s(i, {
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
direction: "row",
|
|
27
|
+
gap: 8,
|
|
28
|
+
justifyContent: e ? "space-between" : "center",
|
|
29
|
+
sx: {
|
|
30
|
+
bgcolor: r.fill,
|
|
31
|
+
border: "1px solid",
|
|
32
|
+
borderColor: r.main,
|
|
33
|
+
borderRadius: 1,
|
|
34
|
+
minHeight: 44,
|
|
35
|
+
px: 16,
|
|
36
|
+
py: 8
|
|
37
|
+
},
|
|
38
|
+
children: [/* @__PURE__ */ s(i, {
|
|
39
|
+
alignItems: "center",
|
|
40
|
+
direction: "row",
|
|
41
|
+
gap: 8,
|
|
42
|
+
role: "status",
|
|
43
|
+
children: [o && /* @__PURE__ */ t(m, {
|
|
44
|
+
"aria-hidden": !0,
|
|
45
|
+
fill: !0,
|
|
46
|
+
name: o,
|
|
47
|
+
size: 24,
|
|
48
|
+
sx: { color: r.main }
|
|
49
|
+
}), /* @__PURE__ */ t(n, {
|
|
50
|
+
bold: !0,
|
|
51
|
+
sx: { color: r.text },
|
|
52
|
+
variant: "body1",
|
|
53
|
+
children: l
|
|
54
|
+
})]
|
|
55
|
+
}), e && /* @__PURE__ */ t(c, {
|
|
56
|
+
onClick: e.onPress,
|
|
57
|
+
size: "small",
|
|
58
|
+
sx: { color: r.text },
|
|
59
|
+
children: e.label
|
|
60
|
+
})]
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
g as CtaStatus
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=CtaStatus.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CtaStatus.es.js","names":[],"sources":["../../../src/insights-v2/components/CtaStatus.tsx"],"sourcesContent":["import Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nexport type CtaStatusTone = 'success' | 'neutral' | 'error'\n\nexport interface CtaStatusProps {\n /** The words, from the backend (copy or a slot) so they stay localized and customizable. */\n label: string\n /** Background, border, icon and text colours. */\n tone: CtaStatusTone\n /** mx-icons name, drawn filled and hidden from assistive technology. */\n icon?: string\n /** An inline button inside the status (e.g. Subscription Detected's \"Undo\"). */\n action?: { label: string; onPress: () => void }\n}\n\n// Figma: the \"after the press\" bar drawn in a CTA's place (Designate's \"Account Saved!\",\n// Subscription Detected's \"Confirmed / Undo\"). Button-sized, outlined, tinted fill.\nconst TONE_COLORS: Record<CtaStatusTone, { main: string; fill: string; text: string }> = {\n success: { main: 'success.main', fill: 'success.lighter', text: 'success.dark' },\n neutral: { main: 'text.secondary', fill: 'background.default', text: 'text.primary' },\n error: { main: 'error.main', fill: 'error.lighter', text: 'error.dark' },\n}\n\n/**\n * A CTA slot's status: what the slot shows once its action is done, instead of a button. Not a\n * control itself (`role=\"status\"`); only the optional inline `action` is pressable.\n */\nexport const CtaStatus = ({ label, tone, icon, action }: CtaStatusProps) => {\n const colors = TONE_COLORS[tone]\n\n return (\n <Stack\n alignItems=\"center\"\n direction=\"row\"\n gap={8}\n justifyContent={action ? 'space-between' : 'center'}\n sx={{\n bgcolor: colors.fill,\n border: '1px solid',\n borderColor: colors.main,\n borderRadius: 1,\n minHeight: 44,\n px: 16,\n py: 8,\n }}\n >\n <Stack alignItems=\"center\" direction=\"row\" gap={8} role=\"status\">\n {icon && (\n <Icon aria-hidden={true} fill={true} name={icon} size={24} sx={{ color: colors.main }} />\n )}\n <Text bold={true} sx={{ color: colors.text }} variant=\"body1\">\n {label}\n </Text>\n </Stack>\n {action && (\n <Button onClick={action.onPress} size=\"small\" sx={{ color: colors.text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Q,SAAS,EAAO;AAAA,MAAS,MAAK;AAAA,MAAQ,IAAI,EAAE,OAAO,EAAO,KAAK;AAAA,MACpE,UAAA,EAAO;AAAA,IACF,CAAA,CAEL;AAAA;AAEX"}
|
|
@@ -1,10 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ANALYTICS_EVENTS_CONFIG as n } from "../analytics/analyticsEventsConfig.es.js";
|
|
2
|
+
import { HOST_ACTIONS as o } from "./hostActions.es.js";
|
|
3
|
+
var a = ({ beat: e, stores: t }) => {
|
|
4
|
+
const s = t.insightsV2Store.beatContext[e.guid]?.selected_account_guid;
|
|
5
|
+
if (typeof s == "string")
|
|
6
|
+
return t.accountStore.visibleSavingsAccounts.some((i) => i.guid === s && !i.is_closed && !i.is_deleted) ? s : void 0;
|
|
7
|
+
}, _ = {
|
|
8
|
+
dismiss_beat: {
|
|
9
|
+
run: "delegateToHost",
|
|
10
|
+
params: { hostAction: o.dismissBeat }
|
|
11
|
+
},
|
|
12
|
+
select_savings_account: {
|
|
13
|
+
run: "updateUserInsightProfile",
|
|
14
|
+
params: (e) => ({ fields: { emergency_savings_account_guid: a(e) } }),
|
|
15
|
+
disabledWhen: (e) => !a(e),
|
|
16
|
+
onSuccess: ["refreshBeat"],
|
|
17
|
+
analytics: n.EMERGENCY_SAVINGS_ACCT_SAVED
|
|
18
|
+
},
|
|
19
|
+
open_savings_account: { analytics: n.EMERGENCY_SAVINGS_ACCT_CREATED }
|
|
20
|
+
};
|
|
6
21
|
export {
|
|
7
|
-
|
|
22
|
+
_ as ctaActions
|
|
8
23
|
};
|
|
9
24
|
|
|
10
25
|
//# sourceMappingURL=ctaConfig.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ctaConfig.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaConfig.ts"],"sourcesContent":["import { HOST_ACTIONS } from './hostActions'\nimport type { CtaStep } from './types'\n\n/**\n * Steps keyed by the backend-named `cta.action_key` (ditto `*_cta_action`, via tupac). No key or\n * an unknown key = default: open the CTA's block drawer, if any. Its post message, when one\n * resolves (`cta.metadata` / `ctaPostMessages`), is sent either way. A new key is registered in\n * ditto and here in the same change; most CTAs need none. See README.md.\n */\nexport const ctaActions: Record<string, CtaStep> = {\n /** ConnectDiscoveredAccounts \"I don't have any\": dismiss through the host, then stop. */\n dismiss_beat: {\n run: 'delegateToHost',\n params: { hostAction: HOST_ACTIONS.dismissBeat },\n },\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ctaConfig.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaConfig.ts"],"sourcesContent":["import { ANALYTICS_EVENTS_CONFIG } from '../analytics/analyticsEventsConfig'\nimport { HOST_ACTIONS } from './hostActions'\nimport type { CtaStateContext, CtaStep } from './types'\n\n/**\n * The account the svg_image_block picker wrote into this beat's context, and only while it is\n * still one the user can save into (visible, open, not deleted) — a pick that went stale between\n * pick and Save never reaches the API.\n */\nconst pickedSavingsAccountGuid = ({ beat, stores }: Pick<CtaStateContext, 'beat' | 'stores'>) => {\n const picked = stores.insightsV2Store.beatContext[beat.guid]?.selected_account_guid\n\n if (typeof picked !== 'string') return undefined\n\n const usable = stores.accountStore.visibleSavingsAccounts.some(\n (account) => account.guid === picked && !account.is_closed && !account.is_deleted,\n )\n\n return usable ? picked : undefined\n}\n\n/**\n * Steps keyed by the backend-named `cta.action_key` (ditto `*_cta_action`, via tupac). No key or\n * an unknown key = default: open the CTA's block drawer, if any. Its post message, when one\n * resolves (`cta.metadata` / `ctaPostMessages`), is sent either way. A new key is registered in\n * ditto and here in the same change; most CTAs need none. See README.md.\n */\nexport const ctaActions: Record<string, CtaStep> = {\n /** ConnectDiscoveredAccounts \"I don't have any\": dismiss through the host, then stop. */\n dismiss_beat: {\n run: 'delegateToHost',\n params: { hostAction: HOST_ACTIONS.dismissBeat },\n },\n\n /**\n * Designate Emergency Savings Account \"Save\": designates the account picked in the\n * svg_image_block picker (kept in the per-beat context), then refreshes the beat. The beat is\n * sampled, so the refresh re-reads its sample, which the backend rebuilds as the saved card\n * (change_account: \"Account Saved!\", no CTA). Disabled until a pick is made.\n */\n select_savings_account: {\n run: 'updateUserInsightProfile',\n params: (ctx) => ({\n fields: { emergency_savings_account_guid: pickedSavingsAccountGuid(ctx) },\n }),\n disabledWhen: (ctx) => !pickedSavingsAccountGuid(ctx),\n onSuccess: ['refreshBeat'],\n analytics: ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_SAVED,\n },\n\n /**\n * Designate Emergency Savings Account \"Open a Savings Account\": no handler. The op_1 post\n * message comes from `ctaPostMessages`; this step adds the Created event.\n */\n open_savings_account: {\n analytics: ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_CREATED,\n },\n}\n"],"mappings":";;AASA,IAAM,IAAA,CAA4B,EAAE,MAAA,GAAM,QAAA,EAAA,MAAuD;AAC/F,QAAM,IAAS,EAAO,gBAAgB,YAAY,EAAK,IAAA,GAAO;AAE9D,MAAI,OAAO,KAAW;AAMtB,WAJe,EAAO,aAAa,uBAAuB,KAAA,CACvD,MAAY,EAAQ,SAAS,KAAU,CAAC,EAAQ,aAAa,CAAC,EAAQ,UAGlE,IAAS,IAAS;AAC3B,GAQa,IAAsC;AAAA,EAEjD,cAAc;AAAA,IACZ,KAAK;AAAA,IACL,QAAQ,EAAE,YAAY,EAAa,YAAY;AAAA,EACjD;AAAA,EAQA,wBAAwB;AAAA,IACtB,KAAK;AAAA,IACL,QAAA,CAAS,OAAS,EAChB,QAAQ,EAAE,gCAAgC,EAAyB,CAAG,EAAE,EAC1E;AAAA,IACA,cAAA,CAAe,MAAQ,CAAC,EAAyB,CAAG;AAAA,IACpD,WAAW,CAAC,aAAa;AAAA,IACzB,WAAW,EAAwB;AAAA,EACrC;AAAA,EAMA,sBAAsB,EACpB,WAAW,EAAwB,+BACrC;AACF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AccountType as
|
|
1
|
+
import { AccountType as u } from "../../core/types/Account.es.js";
|
|
2
2
|
import { BEAT_OPERATION_1 as n, BEAT_OPERATION_2 as l } from "../../common/utils/PostMessage.es.js";
|
|
3
3
|
var c = (a) => !a.is_hidden && !a.is_deleted && !a.is_closed, e = ({ beat: a, stores: t }) => a.primary_account ?? t.accountStore.accounts.find((o) => o.guid === a.primary_account_guid), d = ({ beat: a, stores: t }) => {
|
|
4
4
|
const o = new Set(a.account_guids);
|
|
5
5
|
return t.accountStore.accounts.filter((r) => o.has(r.guid) && c(r));
|
|
6
|
-
}, _ = ({ stores: a }) => a.accountStore.accounts.filter((t) => t.account_type ===
|
|
6
|
+
}, _ = ({ stores: a }) => a.accountStore.accounts.filter((t) => t.account_type === u.SAVINGS && c(t)), i = { primary: () => ({ action: n }) }, p = {
|
|
7
7
|
SaveAnExtra100Dollars: i,
|
|
8
8
|
SaveAnExtra100DollarsV2: i,
|
|
9
9
|
PaydayCashLeftOverStatus: { primary: () => ({ action: n }) },
|
|
@@ -16,7 +16,7 @@ var c = (a) => !a.is_hidden && !a.is_deleted && !a.is_closed, e = ({ beat: a, st
|
|
|
16
16
|
} : null;
|
|
17
17
|
} },
|
|
18
18
|
MonthlyObligationsStatus: { primary: ({ beat: a }) => (a.payload?.total_remaining ?? 0) < 0 ? { action: n } : null },
|
|
19
|
-
DesignateEmergencySavingsAccount: { primary: ({
|
|
19
|
+
DesignateEmergencySavingsAccount: { primary: ({ cta: a }) => a.action_key === "open_savings_account" ? { action: n } : null },
|
|
20
20
|
ReplenishSavings: { primary: (a) => ({
|
|
21
21
|
action: n,
|
|
22
22
|
payload: {
|
|
@@ -38,17 +38,17 @@ var c = (a) => !a.is_hidden && !a.is_deleted && !a.is_closed, e = ({ beat: a, st
|
|
|
38
38
|
action: n,
|
|
39
39
|
payload: {
|
|
40
40
|
...r,
|
|
41
|
-
destination_account_ids: o.map((
|
|
41
|
+
destination_account_ids: o.map((s) => s.external_guid)
|
|
42
42
|
}
|
|
43
43
|
} : {
|
|
44
44
|
action: l,
|
|
45
45
|
payload: r
|
|
46
46
|
};
|
|
47
47
|
} }
|
|
48
|
-
},
|
|
48
|
+
}, g = (a) => a.cta.metadata ?? p[a.beat.template]?.[a.slot]?.(a) ?? null;
|
|
49
49
|
export {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
p as ctaPostMessages,
|
|
51
|
+
g as resolveCtaMetadata
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
//# sourceMappingURL=ctaPostMessages.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ctaPostMessages.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaPostMessages.ts"],"sourcesContent":["import { BEAT_OPERATION_1, BEAT_OPERATION_2 } from '../../common/utils/PostMessage'\nimport { AccountType, type Account, type CtaPostMessageMetadata } from '../../core'\nimport type { CtaSlot, CtaStateContext } from './types'\n\n/**\n * Interim per-template post messages, carried over from the pulse beats, for CTAs the backend\n * does not yet describe with `cta.metadata`. Each resolver returns the same shape the backend\n * will send, or `null` for \"no message\" (the default then only opens the drawer for a block).\n * Backend `metadata` always wins, so entries become dead the moment tupac ships the key for\n * their template.\n *\n * Remove once every template here has `metadata` from the backend: delete this file, its test\n * and README section, and the `resolveCtaMetadata` call in `runCtaAction.ts`.\n */\nexport type CtaPostMessageResolver = (ctx: CtaStateContext) => CtaPostMessageMetadata | null\n\ntype BeatContext = Pick<CtaStateContext, 'beat' | 'stores'>\n\nconst isUsable = (account: Account) =>\n !account.is_hidden && !account.is_deleted && !account.is_closed\n\n/** The beat's primary account: from the beat when the host attached it, else the account store. */\nconst primaryAccountOf = ({ beat, stores }: BeatContext): Account | undefined =>\n beat.primary_account ??\n stores.accountStore.accounts.find((account) => account.guid === beat.primary_account_guid)\n\n/** The accounts the beat points at (`account_guids`), as loaded in the account store. */\nconst beatAccountsOf = ({ beat, stores }: BeatContext): Account[] => {\n const guids = new Set<string>(beat.account_guids)\n\n return stores.accountStore.accounts.filter(\n (account) => guids.has(account.guid) && isUsable(account),\n )\n}\n\nconst savingsAccountsOf = ({ stores }: BeatContext): Account[] =>\n stores.accountStore.accounts.filter(\n (account) => account.account_type === AccountType.SAVINGS && isUsable(account),\n )\n\n/** \"Make Transfer\": the base `beat/cta` op_1, nothing beat-specific. */\nconst saveAnExtra100Dollars: Partial<Record<CtaSlot, CtaPostMessageResolver>> = {\n primary: () => ({ action: BEAT_OPERATION_1 }),\n}\n\nexport const ctaPostMessages: Record<string, Partial<Record<CtaSlot, CtaPostMessageResolver>>> = {\n SaveAnExtra100Dollars: saveAnExtra100Dollars,\n /** The Insights 2.0 template: the same \"Make a Transfer\" op_1 as V1. */\n SaveAnExtra100DollarsV2: saveAnExtra100Dollars,\n\n /** \"Transfer to Savings\" / \"Transfer Funds\": the base `beat/cta` op_1 on both variants. */\n PaydayCashLeftOverStatus: {\n primary: () => ({ action: BEAT_OPERATION_1 }),\n },\n\n /**\n * \"Make a Transfer\" / \"View Emergency Savings\": both deep-link into online banking through the\n * base `beat/cta` op_1 (the label differs by variant, the action does not, as in V1). The\n * secondary \"View Transaction\" opens the transaction-details drilldown, not a post message.\n */\n EmergencyFundWithdrawal: {\n primary: () => ({ action: BEAT_OPERATION_1 }),\n },\n\n /** \"Transfer\": op_1 with the primary account's external id. No primary account → default. */\n LowAccountBalance: {\n primary: (ctx) => {\n const account = primaryAccountOf(ctx)\n\n return account\n ? { action: BEAT_OPERATION_1, payload: { account_guid: account.external_guid } }\n : null\n },\n },\n\n /** Posts only while off track (negative remaining); on track the CTA opens the drawer. */\n MonthlyObligationsStatus: {\n primary: ({ beat }) =>\n (beat.payload?.total_remaining ?? 0) < 0 ? { action: BEAT_OPERATION_1 } : null,\n },\n\n /**\n * \"Open
|
|
1
|
+
{"version":3,"file":"ctaPostMessages.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaPostMessages.ts"],"sourcesContent":["import { BEAT_OPERATION_1, BEAT_OPERATION_2 } from '../../common/utils/PostMessage'\nimport { AccountType, type Account, type CtaPostMessageMetadata } from '../../core'\nimport type { CtaSlot, CtaStateContext } from './types'\n\n/**\n * Interim per-template post messages, carried over from the pulse beats, for CTAs the backend\n * does not yet describe with `cta.metadata`. Each resolver returns the same shape the backend\n * will send, or `null` for \"no message\" (the default then only opens the drawer for a block).\n * Backend `metadata` always wins, so entries become dead the moment tupac ships the key for\n * their template.\n *\n * Remove once every template here has `metadata` from the backend: delete this file, its test\n * and README section, and the `resolveCtaMetadata` call in `runCtaAction.ts`.\n */\nexport type CtaPostMessageResolver = (ctx: CtaStateContext) => CtaPostMessageMetadata | null\n\ntype BeatContext = Pick<CtaStateContext, 'beat' | 'stores'>\n\nconst isUsable = (account: Account) =>\n !account.is_hidden && !account.is_deleted && !account.is_closed\n\n/** The beat's primary account: from the beat when the host attached it, else the account store. */\nconst primaryAccountOf = ({ beat, stores }: BeatContext): Account | undefined =>\n beat.primary_account ??\n stores.accountStore.accounts.find((account) => account.guid === beat.primary_account_guid)\n\n/** The accounts the beat points at (`account_guids`), as loaded in the account store. */\nconst beatAccountsOf = ({ beat, stores }: BeatContext): Account[] => {\n const guids = new Set<string>(beat.account_guids)\n\n return stores.accountStore.accounts.filter(\n (account) => guids.has(account.guid) && isUsable(account),\n )\n}\n\nconst savingsAccountsOf = ({ stores }: BeatContext): Account[] =>\n stores.accountStore.accounts.filter(\n (account) => account.account_type === AccountType.SAVINGS && isUsable(account),\n )\n\n/** \"Make Transfer\": the base `beat/cta` op_1, nothing beat-specific. */\nconst saveAnExtra100Dollars: Partial<Record<CtaSlot, CtaPostMessageResolver>> = {\n primary: () => ({ action: BEAT_OPERATION_1 }),\n}\n\nexport const ctaPostMessages: Record<string, Partial<Record<CtaSlot, CtaPostMessageResolver>>> = {\n SaveAnExtra100Dollars: saveAnExtra100Dollars,\n /** The Insights 2.0 template: the same \"Make a Transfer\" op_1 as V1. */\n SaveAnExtra100DollarsV2: saveAnExtra100Dollars,\n\n /** \"Transfer to Savings\" / \"Transfer Funds\": the base `beat/cta` op_1 on both variants. */\n PaydayCashLeftOverStatus: {\n primary: () => ({ action: BEAT_OPERATION_1 }),\n },\n\n /**\n * \"Make a Transfer\" / \"View Emergency Savings\": both deep-link into online banking through the\n * base `beat/cta` op_1 (the label differs by variant, the action does not, as in V1). The\n * secondary \"View Transaction\" opens the transaction-details drilldown, not a post message.\n */\n EmergencyFundWithdrawal: {\n primary: () => ({ action: BEAT_OPERATION_1 }),\n },\n\n /** \"Transfer\": op_1 with the primary account's external id. No primary account → default. */\n LowAccountBalance: {\n primary: (ctx) => {\n const account = primaryAccountOf(ctx)\n\n return account\n ? { action: BEAT_OPERATION_1, payload: { account_guid: account.external_guid } }\n : null\n },\n },\n\n /** Posts only while off track (negative remaining); on track the CTA opens the drawer. */\n MonthlyObligationsStatus: {\n primary: ({ beat }) =>\n (beat.payload?.total_remaining ?? 0) < 0 ? { action: BEAT_OPERATION_1 } : null,\n },\n\n /**\n * \"Open a Savings Account\": op_1 for the open_savings_account press only. The backend names that\n * key on the open_account state (no designation and no savings account — pulse's legacy branch),\n * so the frontend repeats no data rule and it holds on every widget. \"Save\"\n * (select_savings_account) saves the pick through ctaConfig instead; the saved state has no press.\n */\n DesignateEmergencySavingsAccount: {\n primary: ({ cta }) =>\n cta.action_key === 'open_savings_account' ? { action: BEAT_OPERATION_1 } : null,\n },\n\n /** op_1 with the withdrawn total and the beat's accounts (external ids). */\n ReplenishSavings: {\n primary: (ctx) => ({\n action: BEAT_OPERATION_1,\n payload: {\n total_amount_withdrawn: ctx.beat.payload?.total_amount,\n accounts: beatAccountsOf(ctx).map((account) => ({\n account_guid: account.external_guid,\n account_name: ctx.beat.payload?.account_name?.default,\n })),\n },\n }),\n },\n\n /** op_1 = transfer into the user's savings accounts; op_2 = open one when there are none. */\n SavingsOpportunityV2: {\n primary: (ctx) => {\n const source = primaryAccountOf(ctx)\n\n if (!source) return null\n\n const savings = savingsAccountsOf(ctx)\n const payload = {\n amount: ctx.beat.payload?.suggested_savings_amount,\n source_account_id: source.external_guid,\n }\n\n return savings.length\n ? {\n action: BEAT_OPERATION_1,\n payload: {\n ...payload,\n destination_account_ids: savings.map((account) => account.external_guid),\n },\n }\n : { action: BEAT_OPERATION_2, payload }\n },\n },\n}\n\n/** Backend `cta.metadata` first, else this template's interim resolver for the slot, else null. */\nexport const resolveCtaMetadata = (ctx: CtaStateContext): CtaPostMessageMetadata | null =>\n ctx.cta.metadata ?? ctaPostMessages[ctx.beat.template]?.[ctx.slot]?.(ctx) ?? null\n"],"mappings":";;AAkBA,IAAM,IAAA,CAAY,MAChB,CAAC,EAAQ,aAAa,CAAC,EAAQ,cAAc,CAAC,EAAQ,WAGlD,IAAA,CAAoB,EAAE,MAAA,GAAM,QAAA,EAAA,MAChC,EAAK,mBACL,EAAO,aAAa,SAAS,KAAA,CAAM,MAAY,EAAQ,SAAS,EAAK,oBAAoB,GAGrF,IAAA,CAAkB,EAAE,MAAA,GAAM,QAAA,EAAA,MAAqC;AACnE,QAAM,IAAQ,IAAI,IAAY,EAAK,aAAa;AAEhD,SAAO,EAAO,aAAa,SAAS,OAAA,CACjC,MAAY,EAAM,IAAI,EAAQ,IAAI,KAAK,EAAS,CAAO,CAC1D;AACF,GAEM,IAAA,CAAqB,EAAE,QAAA,EAAA,MAC3B,EAAO,aAAa,SAAS,OAAA,CAC1B,MAAY,EAAQ,iBAAiB,EAAY,WAAW,EAAS,CAAO,CAC/E,GAGI,IAA0E,EAC9E,SAAA,OAAgB,EAAE,QAAQ,EAAiB,GAC7C,GAEa,IAAoF;AAAA,EAC/F,uBAAuB;AAAA,EAEvB,yBAAyB;AAAA,EAGzB,0BAA0B,EACxB,SAAA,OAAgB,EAAE,QAAQ,EAAiB,GAC7C;AAAA,EAOA,yBAAyB,EACvB,SAAA,OAAgB,EAAE,QAAQ,EAAiB,GAC7C;AAAA,EAGA,mBAAmB,EACjB,SAAA,CAAU,MAAQ;AAChB,UAAM,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G,KAAK"}
|
|
@@ -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 }: Pick<CtaStateContext, 'cta'>): CtaStep =>\n (cta.action_key && ctaActions[cta.action_key]) || DEFAULT_STEP\n\n/** Pending always disables; the step's `disabledWhen` may add to that. */\nexport const resolveCtaState = (ctx: CtaStateContext): CtaState => {\n const step = resolveStep(ctx)\n const pending = ctx.stores.insightsV2Store.ctaStatus[ctx.beat.guid] === 'pending'\n\n return { disabled: pending || (step.disabledWhen?.(ctx) ?? false) }\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 // For future ctaConfig entries; none define `analytics` yet.\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;AAG5B,SAAO,EAAE,UAFO,EAAI,OAAO,gBAAgB,UAAU,EAAI,KAAK,IAAA,MAAU,cAEzC,EAAK,eAAe,CAAG,KAAK,IAAO;AACpE,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,EA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AACV,UAAM,EAAsB,GAAS,GAAa,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} 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 }: Pick<CtaStateContext, 'cta'>): CtaStep =>\n (cta.action_key && ctaActions[cta.action_key]) || DEFAULT_STEP\n\n/** Pending always disables; the step's `disabledWhen` may add to that. */\nexport const resolveCtaState = (ctx: CtaStateContext): CtaState => {\n const step = resolveStep(ctx)\n const pending = ctx.stores.insightsV2Store.ctaStatus[ctx.beat.guid] === 'pending'\n\n return { disabled: pending || (step.disabledWhen?.(ctx) ?? false) }\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;AAG5B,SAAO,EAAE,UAFO,EAAI,OAAO,gBAAgB,UAAU,EAAI,KAAK,IAAA,MAAU,cAEzC,EAAK,eAAe,CAAG,KAAK,IAAO;AACpE,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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B;AAAA,IAAE,GAAG;AAAA,IAAK,KAAK;AAAA,IAAY,MAAM;AAAA,EAAU;AAEvE,SAAO,EACL,GACA,YAAY;AACV,UAAM,EAAsB,GAAS,GAAa,CAAS,GAGvD,KAAW,EAAiB,GAAS,CAAS;AAAA,EACpD,GACA,EAAE,SAAS,EAAY,CACzB;AACF"}
|
|
@@ -31,7 +31,7 @@ export interface CtaStep {
|
|
|
31
31
|
params?: CtaParams | ((ctx: CtaStateContext) => CtaParams);
|
|
32
32
|
/** Effects executed after `run` resolves successfully. */
|
|
33
33
|
onSuccess?: CtaEffect[];
|
|
34
|
-
/** Fired after `run` succeeds
|
|
34
|
+
/** Fired after `run` succeeds, or on the press when the step has no `run` (e.g. select_savings_account's Saved, open_savings_account's Created). */
|
|
35
35
|
analytics?: AnalyticsEventConfigEntry;
|
|
36
36
|
/**
|
|
37
37
|
* After `run`: `default` = drawer if the CTA has a block, else nothing; `drawer` forces the
|
|
@@ -39,21 +39,21 @@ import yo from "./components/SubscriptionHeroCard.es.js";
|
|
|
39
39
|
import Oo from "./blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js";
|
|
40
40
|
import Vo from "./components/WithdrawalCard.es.js";
|
|
41
41
|
import Mo from "./blocks/ComponentBlocks/WithdrawalBlock/WithdrawalBlock.es.js";
|
|
42
|
-
import
|
|
43
|
-
import xo from "./
|
|
44
|
-
import Uo from "./components/
|
|
45
|
-
import jo from "./components/
|
|
46
|
-
import zo from "./components/
|
|
47
|
-
import Ko from "./components/
|
|
48
|
-
import Xo from "./components/
|
|
49
|
-
import
|
|
50
|
-
import or from "./components/
|
|
51
|
-
import
|
|
52
|
-
import {
|
|
53
|
-
import pr from "./components/
|
|
54
|
-
import fr from "./components/
|
|
55
|
-
import cr from "./components/
|
|
56
|
-
import sr from "./components/
|
|
42
|
+
import _o from "./components/DesignateEmergencySavingsCard.es.js";
|
|
43
|
+
import { SVGImageBlock as xo } from "./blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js";
|
|
44
|
+
import Uo from "./components/shared/StatusSnackbar.es.js";
|
|
45
|
+
import jo from "./components/FeedbackDialog.es.js";
|
|
46
|
+
import zo from "./components/FeedbackModal.es.js";
|
|
47
|
+
import Ko from "./components/ConnectionDetailDrillDown.es.js";
|
|
48
|
+
import Xo from "./components/SurveyModal.es.js";
|
|
49
|
+
import Zo from "./components/InsightErrorCard.es.js";
|
|
50
|
+
import { ErrorCard as or } from "./components/ErrorCard.es.js";
|
|
51
|
+
import tr from "./components/BadgedTile.es.js";
|
|
52
|
+
import { OverflowMenu as ir } from "./components/OverflowMenu.es.js";
|
|
53
|
+
import { InsightOptionsMenu as pr } from "./components/InsightOptionsMenu.es.js";
|
|
54
|
+
import fr from "./components/StatusBadge.es.js";
|
|
55
|
+
import cr from "./components/CompactInsightCard.es.js";
|
|
56
|
+
import sr from "./components/AmountBreakdownCard.es.js";
|
|
57
57
|
import { FeedbackBar as Br } from "./components/FeedbackBar.es.js";
|
|
58
58
|
import { DismissInsightDialog as gr } from "./components/DismissInsightDialog.es.js";
|
|
59
59
|
import { HiddenConfirmationCard as kr } from "./components/HiddenConfirmationCard.es.js";
|
|
@@ -68,19 +68,19 @@ export {
|
|
|
68
68
|
N as AccountBlock,
|
|
69
69
|
H as AccountHeroCard,
|
|
70
70
|
q as AccountSwitchBlock,
|
|
71
|
-
|
|
71
|
+
sr as AmountBreakdownCard,
|
|
72
72
|
Ro as AmountPill,
|
|
73
73
|
e as BAR_ARIA_LABEL,
|
|
74
74
|
f as BAR_CHART_VARIANTS,
|
|
75
|
-
|
|
75
|
+
tr as BadgedTile,
|
|
76
76
|
k as BarchartBlock,
|
|
77
77
|
Lr as BaseLayout,
|
|
78
78
|
J as BudgetBlock,
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
cr as CompactInsightCard,
|
|
80
|
+
Ko as ConnectionDetailDrillDown,
|
|
81
81
|
Q as DebtPayoffCard,
|
|
82
82
|
ro as DebtsBlock,
|
|
83
|
-
|
|
83
|
+
_o as DesignateEmergencySavingsCard,
|
|
84
84
|
F as DetailedAccountBlock,
|
|
85
85
|
F as DirectDepositBlock,
|
|
86
86
|
P as DirectDepositCard,
|
|
@@ -88,16 +88,16 @@ export {
|
|
|
88
88
|
L as DonutChartBlock,
|
|
89
89
|
S as DoubleBarChartBlock,
|
|
90
90
|
I as DoubleProgressBarBlock,
|
|
91
|
-
|
|
91
|
+
or as ErrorCard,
|
|
92
92
|
Br as FeedbackBar,
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
jo as FeedbackDialog,
|
|
94
|
+
zo as FeedbackModal,
|
|
95
95
|
mo as GoalProgressCard,
|
|
96
96
|
ao as GoalsBlock,
|
|
97
97
|
d as HOST_ACTIONS,
|
|
98
98
|
kr as HiddenConfirmationCard,
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
Zo as InsightErrorCard,
|
|
100
|
+
pr as InsightOptionsMenu,
|
|
101
101
|
Y as InsightTransactionRow,
|
|
102
102
|
Sr as LoadingCard,
|
|
103
103
|
Rr as LogoClusterCard,
|
|
@@ -106,21 +106,21 @@ export {
|
|
|
106
106
|
yr as MerchantHighlightCard,
|
|
107
107
|
eo as NoSpendDaysBlock,
|
|
108
108
|
hr as ObsolesceBanner,
|
|
109
|
-
|
|
109
|
+
ir as OverflowMenu,
|
|
110
110
|
Or as P2PLogoStack,
|
|
111
111
|
lo as RepeatingTransactionBlock,
|
|
112
|
-
|
|
112
|
+
xo as SVGImageBlock,
|
|
113
113
|
Bo as SaveAnExtraCard,
|
|
114
114
|
go as SaveExtraBlock,
|
|
115
115
|
So as SavingsOpportunityBlock,
|
|
116
116
|
ko as SavingsOpportunityCard,
|
|
117
|
-
|
|
117
|
+
fr as StatusBadge,
|
|
118
118
|
ho as StatusMessageCard,
|
|
119
119
|
r as StatusPill,
|
|
120
|
-
|
|
120
|
+
Uo as StatusSnackbar,
|
|
121
121
|
h as StepChartBlock,
|
|
122
122
|
yo as SubscriptionHeroCard,
|
|
123
|
-
|
|
123
|
+
Xo as SurveyModal,
|
|
124
124
|
Io as TransactionBlock,
|
|
125
125
|
$ as TransactionListCard,
|
|
126
126
|
W as TransferLogoCard,
|