@mx-cartographer/experiences 9.7.69 → 9.7.71-alpha-ram-usp-2
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 +16 -0
- package/dist/core/stores/GlobalCopyStore.d.ts +6 -0
- package/dist/core/stores/GlobalCopyStore.es.js +14 -8
- package/dist/core/stores/GlobalCopyStore.es.js.map +1 -1
- package/dist/core/stores/GoalStore.d.ts +1 -1
- package/dist/core/stores/GoalStore.es.js +1 -1
- package/dist/core/stores/GoalStore.es.js.map +1 -1
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +24 -0
- package/dist/goals/GoalsMiniWidget.d.ts +7 -0
- package/dist/goals/{GoalsMicroWidget.es.js → GoalsMiniWidget.es.js} +14 -14
- package/dist/goals/GoalsMiniWidget.es.js.map +1 -0
- package/dist/goals/components/{micro/GoalMicroStatusCard.d.ts → mini/GoalMiniStatusCard.d.ts} +1 -1
- package/dist/goals/components/{micro/GoalMicroStatusCard.es.js → mini/GoalMiniStatusCard.es.js} +2 -2
- package/dist/goals/components/mini/GoalMiniStatusCard.es.js.map +1 -0
- package/dist/goals/components/{micro/GoalsMicroEmptyState.d.ts → mini/GoalsMiniEmptyState.d.ts} +1 -1
- package/dist/goals/components/{micro/GoalsMicroEmptyState.es.js → mini/GoalsMiniEmptyState.es.js} +2 -2
- package/dist/goals/components/mini/GoalsMiniEmptyState.es.js.map +1 -0
- package/dist/goals/index.d.ts +1 -1
- package/dist/goals/index.es.js +4 -4
- package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.d.ts +6 -0
- package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js +168 -0
- package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +11 -11
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js +3 -3
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +92 -59
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.d.ts +9 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js +9 -5
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js +5 -5
- package/dist/insights-v2/components/AccountHeroCard.es.js +7 -5
- package/dist/insights-v2/components/AccountHeroCard.es.js.map +1 -1
- package/dist/insights-v2/components/BaseLayout.es.js +157 -138
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/components/CtaStatus.d.ts +14 -1
- package/dist/insights-v2/components/CtaStatus.es.js +76 -38
- package/dist/insights-v2/components/CtaStatus.es.js.map +1 -1
- package/dist/insights-v2/components/InsightTransactionRow.d.ts +3 -1
- package/dist/insights-v2/components/InsightTransactionRow.es.js +36 -20
- package/dist/insights-v2/components/InsightTransactionRow.es.js.map +1 -1
- package/dist/insights-v2/components/StatusPill.es.js +12 -11
- package/dist/insights-v2/components/StatusPill.es.js.map +1 -1
- package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.d.ts +4 -0
- package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.es.js +10 -0
- package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.es.js.map +1 -0
- package/dist/insights-v2/components/TransactionListCard.d.ts +5 -1
- package/dist/insights-v2/components/TransactionListCard.es.js +69 -49
- package/dist/insights-v2/components/TransactionListCard.es.js.map +1 -1
- package/dist/insights-v2/components/shared/StatusSnackbar.d.ts +10 -1
- package/dist/insights-v2/components/shared/StatusSnackbar.es.js +27 -11
- package/dist/insights-v2/components/shared/StatusSnackbar.es.js.map +1 -1
- package/dist/insights-v2/components/shared/elevation.d.ts +16 -0
- package/dist/insights-v2/components/shared/elevation.es.js +15 -0
- package/dist/insights-v2/components/shared/elevation.es.js.map +1 -0
- package/dist/insights-v2/ctaActions/ctaConfig.es.js +23 -9
- package/dist/insights-v2/ctaActions/ctaConfig.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/runCtaAction.d.ts +7 -0
- package/dist/insights-v2/ctaActions/runCtaAction.es.js +73 -62
- package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/subscriptionAnswer.d.ts +10 -1
- package/dist/insights-v2/ctaActions/subscriptionAnswer.es.js +115 -0
- package/dist/insights-v2/ctaActions/subscriptionAnswer.es.js.map +1 -0
- package/dist/insights-v2/ctaActions/types.d.ts +5 -2
- package/dist/insights-v2/ctaActions/useCtaAction.d.ts +6 -0
- package/dist/insights-v2/ctaActions/useCtaAction.es.js +32 -27
- package/dist/insights-v2/ctaActions/useCtaAction.es.js.map +1 -1
- package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js +1 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
- package/dist/insights-v2/mappings/blocks.es.js +74 -68
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/dist/microinsights/MicroCardTemplate.es.js +21 -17
- package/dist/microinsights/MicroCardTemplate.es.js.map +1 -1
- package/dist/microinsights/cards/InsightCard.es.js +91 -86
- package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
- package/dist/microinsights/cards/MicroCtaStatus.d.ts +18 -0
- package/dist/microinsights/cards/MicroCtaStatus.es.js +44 -0
- package/dist/microinsights/cards/MicroCtaStatus.es.js.map +1 -0
- package/dist/microinsights/stores/CopyStore.d.ts +4 -1
- package/dist/microinsights/stores/CopyStore.es.js +13 -10
- package/dist/microinsights/stores/CopyStore.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/goals/GoalsMicroWidget.d.ts +0 -7
- package/dist/goals/GoalsMicroWidget.es.js.map +0 -1
- package/dist/goals/components/micro/GoalMicroStatusCard.es.js.map +0 -1
- package/dist/goals/components/micro/GoalsMicroEmptyState.es.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [9.7.72] - 11-02-2026
|
|
2
|
+
|
|
3
|
+
- **ADDED** - Unexpected Subscription Payment on the shared subscription status CTA (WEC-2126): `confirm_subscription_status` registers `subscriptionEntryStep({ statusLabels: { positive: 'subscribed', negative: 'not_subscribed' } })`, so the card follows the live repeating transaction as pulse did (none / `USER_RESPONSE_UNKNOWN` → Confirm Status, `CONFIRMED` → "Subscribed | Undo", any other answer → "Not subscribed | Undo"). New `subscription_status_modal_block`, a centred modal every widget's "Confirm Status" opens: the row from the opening CTA's `drilldown_data` with the live frequency, "I'm Subscribed" / "I'm Not Subscribed", then the three reasons; it saves through `answerSubscription`, reports the "No" press, and shows a success snackbar or an error one with Try Again. Words from the new optional `insights_feed.subscription_status_modal` copy (`SubscriptionStatusModalCopy`); a missing word renders nothing
|
|
4
|
+
- **ADDED** - `transaction_block` / `warning_wash` follows the beat's live repeating transaction (`followsSubscription`): the frequency word under the amount (`InsightTransactionRow` `amountCaption`), a status badge over the row (`TransactionListCard` `badge`: `data.icon` flag, `data.reviewed_icon` tick once subscribed) and the answered wash. It only reads the store
|
|
5
|
+
- **ADDED** - The micro card resolves its `in_description_cta` through the CTA layer (`MicroCtaStatusGate`): answered, it shows the opening block's `answeredTitle` (USP: "Unexpected Charge Reviewed"), `data.reviewed_icon` and the presenter's "Undo", and a tap goes to the host instead of re-opening the block; with missing data it shows no action
|
|
6
|
+
- **CHANGED** - Subscription Status dialogs: fixed `xs` width, white paper, 4px radius, full-bleed wash; reasons as 44px rows with inset dividers. `CtaStatus` neutral tone is the white alert (paper fill, 50% black border). The `warning_wash` badge is a 32px palette disc with a `contrastText` glyph; `TransactionListCard` gains `elevated`
|
|
7
|
+
- **CHANGED** - `useBeatCtaActions` prepares the CTA the card has: the primary one, else the in-description one, so a step's data also loads on mini (which has no primary CTA)
|
|
8
|
+
|
|
9
|
+
## [9.7.71] - 10-30-2026
|
|
10
|
+
|
|
11
|
+
- **FIXED** - The Direct Deposit account name wraps instead of truncating, status pill labels are regular weight, and the mini card call-to-action is a text link, matching Figma (WEC-2182, WEC-2183)
|
|
12
|
+
|
|
13
|
+
## [9.7.70] - 10-30-2026
|
|
14
|
+
|
|
15
|
+
- **CHANGED** - goals mini widget naming to match its design (MEW-4114)
|
|
16
|
+
|
|
1
17
|
## [9.7.69] - 10-30-2026
|
|
2
18
|
|
|
3
19
|
- **FIXED** - The embedded insight card's call-to-action label now matches Figma's size and weight (WEC-2157)
|
|
@@ -10,5 +10,11 @@ export declare class GlobalCopyStore {
|
|
|
10
10
|
constructor(globalStore: GlobalStore);
|
|
11
11
|
loadCopy: () => Promise<void>;
|
|
12
12
|
getCopy: (namespace: string, translationKey?: string) => Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Merges an already-loaded section into `copy` (no request), for a host that did not load the
|
|
15
|
+
* copy, e.g. the micro widget handing over the insights_feed it loaded with its own copy. A
|
|
16
|
+
* section the store already has is kept.
|
|
17
|
+
*/
|
|
18
|
+
setSection: <K extends keyof GlobalCopy>(key: K, section: GlobalCopy[K] | undefined) => void;
|
|
13
19
|
private captureError;
|
|
14
20
|
}
|
|
@@ -1,36 +1,42 @@
|
|
|
1
|
-
import { GlobalCopyApi as
|
|
2
|
-
import { makeAutoObservable as a, runInAction as
|
|
3
|
-
var
|
|
1
|
+
import { GlobalCopyApi as i } from "../api/GlobalCopyApi.es.js";
|
|
2
|
+
import { makeAutoObservable as a, runInAction as r } from "mobx";
|
|
3
|
+
var c = class {
|
|
4
4
|
globalStore;
|
|
5
|
-
api = new
|
|
5
|
+
api = new i("/", "");
|
|
6
6
|
copy = {};
|
|
7
7
|
featureNamespace = "experiences";
|
|
8
8
|
isInitialized = !1;
|
|
9
9
|
constructor(t) {
|
|
10
|
-
this.globalStore = t, this.api = new
|
|
10
|
+
this.globalStore = t, this.api = new i(t.endpoint, t.sessionToken, t.onError), a(this);
|
|
11
11
|
}
|
|
12
12
|
loadCopy = async () => {
|
|
13
|
-
await this.getCopy(this.featureNamespace),
|
|
13
|
+
await this.getCopy(this.featureNamespace), r(() => {
|
|
14
14
|
this.isInitialized = !0;
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
getCopy = async (t, o = "") => {
|
|
18
18
|
try {
|
|
19
19
|
const e = await this.api.getGlobalCopy(t, o);
|
|
20
|
-
|
|
20
|
+
r(() => {
|
|
21
21
|
this.copy = e[t];
|
|
22
22
|
});
|
|
23
23
|
} catch (e) {
|
|
24
24
|
this.captureError("getCopy", e);
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
+
setSection = (t, o) => {
|
|
28
|
+
!o || this.copy?.[t] || (this.copy = {
|
|
29
|
+
...this.copy,
|
|
30
|
+
[t]: o
|
|
31
|
+
});
|
|
32
|
+
};
|
|
27
33
|
captureError = (t, o) => this.globalStore.captureException(o, {
|
|
28
34
|
store: "GlobalCopyStore",
|
|
29
35
|
action: t
|
|
30
36
|
});
|
|
31
37
|
};
|
|
32
38
|
export {
|
|
33
|
-
|
|
39
|
+
c as GlobalCopyStore
|
|
34
40
|
};
|
|
35
41
|
|
|
36
42
|
//# sourceMappingURL=GlobalCopyStore.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalCopyStore.es.js","names":[],"sources":["../../../src/core/stores/GlobalCopyStore.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { GlobalCopyApi } from '../api'\nimport { GlobalCopy } from '../types'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class GlobalCopyStore {\n globalStore: GlobalStore\n api: GlobalCopyApi = new GlobalCopyApi('/', '')\n\n copy: GlobalCopy = {} as GlobalCopy\n featureNamespace = 'experiences'\n\n isInitialized = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new GlobalCopyApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n )\n\n makeAutoObservable(this)\n }\n\n loadCopy = async () => {\n await this.getCopy(this.featureNamespace)\n\n runInAction(() => {\n this.isInitialized = true\n })\n }\n\n getCopy = async (namespace: string, translationKey: string = '') => {\n try {\n const newCopy = await this.api.getGlobalCopy(namespace, translationKey)\n\n runInAction(() => {\n this.copy = newCopy[namespace]\n })\n } catch (error) {\n this.captureError('getCopy', error)\n }\n }\n\n private captureError = (action: string, error: unknown) =>\n this.globalStore.captureException(error, { store: 'GlobalCopyStore', action })\n}\n"],"mappings":";;AAOA,IAAa,IAAb,MAA6B;AAAA,EAC3B;AAAA,EACA,MAAqB,IAAI,EAAc,KAAK,EAAE;AAAA,EAE9C,OAAmB,CAAC;AAAA,EACpB,mBAAmB;AAAA,EAEnB,gBAAgB;AAAA,EAEhB,YAAY,GAA0B;AACpC,SAAK,cAAc,GACnB,KAAK,MAAM,IAAI,EACb,EAAY,UACZ,EAAY,cACZ,EAAY,OACd,GAEA,EAAmB,IAAI;AAAA,EACzB;AAAA,EAEA,WAAW,YAAY;AACrB,UAAM,KAAK,QAAQ,KAAK,gBAAgB,GAExC,EAAA,MAAkB;AAChB,WAAK,gBAAgB;AAAA,IACvB,CAAC;AAAA,EACH;AAAA,EAEA,UAAU,OAAO,GAAmB,IAAyB,OAAO;AAClE,QAAI;AACF,YAAM,IAAU,MAAM,KAAK,IAAI,cAAc,GAAW,CAAc;AAEtE,MAAA,EAAA,MAAkB;AAChB,aAAK,OAAO,EAAQ,CAAA;AAAA,MACtB,CAAC;AAAA,IACH,SAAS,GAAO;AACd,WAAK,aAAa,WAAW,CAAK;AAAA,IACpC;AAAA,EACF;AAAA,EAEA,eAAA,CAAwB,GAAgB,MACtC,KAAK,YAAY,iBAAiB,GAAO;AAAA,IAAE,OAAO;AAAA,IAAmB,QAAA;AAAA,EAAO,CAAC;AACjF"}
|
|
1
|
+
{"version":3,"file":"GlobalCopyStore.es.js","names":[],"sources":["../../../src/core/stores/GlobalCopyStore.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { GlobalCopyApi } from '../api'\nimport { GlobalCopy } from '../types'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class GlobalCopyStore {\n globalStore: GlobalStore\n api: GlobalCopyApi = new GlobalCopyApi('/', '')\n\n copy: GlobalCopy = {} as GlobalCopy\n featureNamespace = 'experiences'\n\n isInitialized = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new GlobalCopyApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n )\n\n makeAutoObservable(this)\n }\n\n loadCopy = async () => {\n await this.getCopy(this.featureNamespace)\n\n runInAction(() => {\n this.isInitialized = true\n })\n }\n\n getCopy = async (namespace: string, translationKey: string = '') => {\n try {\n const newCopy = await this.api.getGlobalCopy(namespace, translationKey)\n\n runInAction(() => {\n this.copy = newCopy[namespace]\n })\n } catch (error) {\n this.captureError('getCopy', error)\n }\n }\n\n /**\n * Merges an already-loaded section into `copy` (no request), for a host that did not load the\n * copy, e.g. the micro widget handing over the insights_feed it loaded with its own copy. A\n * section the store already has is kept.\n */\n setSection = <K extends keyof GlobalCopy>(key: K, section: GlobalCopy[K] | undefined) => {\n if (!section || this.copy?.[key]) return\n\n this.copy = { ...this.copy, [key]: section }\n }\n\n private captureError = (action: string, error: unknown) =>\n this.globalStore.captureException(error, { store: 'GlobalCopyStore', action })\n}\n"],"mappings":";;AAOA,IAAa,IAAb,MAA6B;AAAA,EAC3B;AAAA,EACA,MAAqB,IAAI,EAAc,KAAK,EAAE;AAAA,EAE9C,OAAmB,CAAC;AAAA,EACpB,mBAAmB;AAAA,EAEnB,gBAAgB;AAAA,EAEhB,YAAY,GAA0B;AACpC,SAAK,cAAc,GACnB,KAAK,MAAM,IAAI,EACb,EAAY,UACZ,EAAY,cACZ,EAAY,OACd,GAEA,EAAmB,IAAI;AAAA,EACzB;AAAA,EAEA,WAAW,YAAY;AACrB,UAAM,KAAK,QAAQ,KAAK,gBAAgB,GAExC,EAAA,MAAkB;AAChB,WAAK,gBAAgB;AAAA,IACvB,CAAC;AAAA,EACH;AAAA,EAEA,UAAU,OAAO,GAAmB,IAAyB,OAAO;AAClE,QAAI;AACF,YAAM,IAAU,MAAM,KAAK,IAAI,cAAc,GAAW,CAAc;AAEtE,MAAA,EAAA,MAAkB;AAChB,aAAK,OAAO,EAAQ,CAAA;AAAA,MACtB,CAAC;AAAA,IACH,SAAS,GAAO;AACd,WAAK,aAAa,WAAW,CAAK;AAAA,IACpC;AAAA,EACF;AAAA,EAOA,aAAA,CAA0C,GAAQ,MAAuC;AACvF,IAAI,CAAC,KAAW,KAAK,OAAO,CAAA,MAE5B,KAAK,OAAO;AAAA,MAAE,GAAG,KAAK;AAAA,MAAO,CAAA,CAAA,GAAM;AAAA,IAAQ;AAAA,EAC7C;AAAA,EAEA,eAAA,CAAwB,GAAgB,MACtC,KAAK,YAAY,iBAAiB,GAAO;AAAA,IAAE,OAAO;AAAA,IAAmB,QAAA;AAAA,EAAO,CAAC;AACjF"}
|
|
@@ -21,7 +21,7 @@ export declare class GoalStore {
|
|
|
21
21
|
get debtGoals(): Goal[];
|
|
22
22
|
get retirmentGoals(): Goal[];
|
|
23
23
|
get savingGoals(): Goal[];
|
|
24
|
-
get
|
|
24
|
+
get ongoingGoalsForMiniWidget(): Goal[];
|
|
25
25
|
get isAllGoalDataLoaded(): boolean;
|
|
26
26
|
setGoals: (goals: Goal[]) => void;
|
|
27
27
|
setRetirementGoals: (goals: Goal[]) => void;
|
|
@@ -43,7 +43,7 @@ var y = class {
|
|
|
43
43
|
get savingGoals() {
|
|
44
44
|
return this.orderedGoals.filter((t) => t.track_type === a.SAVINGS_TRACK);
|
|
45
45
|
}
|
|
46
|
-
get
|
|
46
|
+
get ongoingGoalsForMiniWidget() {
|
|
47
47
|
const t = this.allGoals.filter((o) => !o.is_complete && o.track_type !== a.EMERGENCY_FUND_TRACK && o.track_type !== null), e = [
|
|
48
48
|
a.SAVINGS_TRACK,
|
|
49
49
|
a.DEBT_TRACK,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoalStore.es.js","names":[],"sources":["../../../src/core/stores/GoalStore.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { GoalApi } from '../api'\nimport { upsertByGuid } from '../utils/upsertByGuid'\n\nimport {\n type Goal,\n type MonthlyCashFlowProfile,\n type RetirementGoalAccount,\n TrackType,\n} from '../types'\nimport { getProjectedRetirementDate } from '../utils/GoalsUtil'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class GoalStore {\n globalStore: GlobalStore\n api = new GoalApi('/', '')\n\n goals: Goal[] = []\n goalsLoaded: boolean = false\n retirementGoals: Goal[] = []\n retirementGoalsLoaded: boolean = false\n retirementGoalAccounts: RetirementGoalAccount[] = []\n retirementGoalAccountsLoaded: boolean = false\n monthlyCashFlowProfile: MonthlyCashFlowProfile | undefined = undefined\n monthlyCashFlowProfileLoaded: boolean = false\n\n newRetirementGoalAccounts: RetirementGoalAccount[] = []\n\n alert: string = ''\n selectedGoal: Goal | undefined = undefined\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new GoalApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n\n makeAutoObservable(this)\n }\n\n get allGoals(): Goal[] {\n if (!this.isAllGoalDataLoaded) return []\n\n const goalsCopy = this.globalStore.copyStore.copy.goals\n const userBirthday = this.globalStore.userStore.user.birthday\n return [\n ...this.goals,\n ...this.retirementGoals.map((goal: Goal) => ({\n ...goal,\n amount: goal.target_amount,\n name: goalsCopy.retirement,\n track_type: TrackType.RETIREMENT_TRACK,\n projected_to_complete_at:\n goal.retirement_age && userBirthday\n ? getProjectedRetirementDate(goal.retirement_age, userBirthday)\n : undefined,\n })),\n ] as Goal[]\n }\n\n get orderedGoals(): Goal[] {\n return this.allGoals.slice().sort((a, b) => a.position - b.position)\n }\n\n get debtGoals() {\n return this.orderedGoals.filter((goal) => goal.track_type === TrackType.DEBT_TRACK)\n }\n\n get retirmentGoals() {\n return this.orderedGoals.filter((goal) => goal.track_type === TrackType.RETIREMENT_TRACK)\n }\n\n get savingGoals() {\n return this.orderedGoals.filter((goal) => goal.track_type === TrackType.SAVINGS_TRACK)\n }\n\n get ongoingGoalsForMicroWidget() {\n const ongoingGoals = this.allGoals.filter(\n (goal) =>\n !goal.is_complete &&\n goal.track_type !== TrackType.EMERGENCY_FUND_TRACK &&\n goal.track_type !== null,\n )\n const priorityOrder = [\n TrackType.SAVINGS_TRACK,\n TrackType.DEBT_TRACK,\n TrackType.RETIREMENT_TRACK,\n ]\n return ongoingGoals\n .sort((a, b) => {\n const aIndex = a.track_type ? priorityOrder.indexOf(a.track_type) : -1\n const bIndex = b.track_type ? priorityOrder.indexOf(b.track_type) : -1\n return aIndex - bIndex\n })\n .slice(0, 3)\n }\n\n get isAllGoalDataLoaded() {\n return (\n this.goalsLoaded &&\n this.retirementGoalsLoaded &&\n this.retirementGoalAccountsLoaded &&\n this.monthlyCashFlowProfileLoaded\n )\n }\n\n setGoals = (goals: Goal[]) => {\n this.goals = goals\n this.goalsLoaded = true\n }\n\n setRetirementGoals = (goals: Goal[]) => {\n this.retirementGoals = goals\n this.retirementGoalsLoaded = true\n }\n\n setRetirementGoalAccounts = (accounts: RetirementGoalAccount[]) => {\n this.retirementGoalAccounts = accounts\n this.retirementGoalAccountsLoaded = true\n }\n\n setMonthlyCashFlowProfile = (profile: MonthlyCashFlowProfile) => {\n this.monthlyCashFlowProfile = profile\n this.monthlyCashFlowProfileLoaded = true\n }\n\n loadGoalData = async () => {\n await Promise.all([\n this.loadGoals(),\n this.loadRetirementGoals(),\n this.loadRetirementGoalAccounts(),\n this.loadMonthlyCashFlowProfile(),\n ])\n }\n\n loadGoals = async () => {\n try {\n const goals = await this.api.getGoals()\n this.setGoals(goals)\n } catch (error) {\n this.captureError('loadGoals', error)\n }\n }\n\n loadRetirementGoals = async () => {\n try {\n const retirementGoals = await this.api.getRetirementGoals()\n this.setRetirementGoals(retirementGoals)\n } catch (error) {\n this.captureError('loadRetirementGoals', error)\n }\n }\n\n loadRetirementGoalAccounts = async () => {\n try {\n const retirementGoalAccounts = await this.api.getRetirementGoalAccounts()\n this.setRetirementGoalAccounts(retirementGoalAccounts)\n } catch (error) {\n this.captureError('loadRetirementGoalAccounts', error)\n }\n }\n\n loadMonthlyCashFlowProfile = async () => {\n try {\n const monthlyCashFlowProfile = await this.api.getMonthlyCashFlowProfile()\n this.setMonthlyCashFlowProfile(monthlyCashFlowProfile)\n } catch (error) {\n this.captureError('loadMonthlyCashFlowProfile', error)\n }\n }\n\n addGoal = async (goal: Goal) => {\n try {\n const newGoal = await this.api.addGoal(goal)\n this.setGoals(upsertByGuid(this.goals, newGoal))\n } catch (error) {\n this.captureError('addGoal', error)\n }\n }\n\n addRetirementGoal = async (goal: Goal) => {\n try {\n const newGoal: Goal = await this.api.addRetirementGoal(goal)\n const newAccounts = [] as RetirementGoalAccount[]\n for (const account of this.newRetirementGoalAccounts) {\n const newAccount = await this.api.addRetirementGoalAccount({\n ...account,\n retirement_goal_guid: newGoal.guid,\n })\n newAccounts.push(newAccount)\n }\n this.setNewRetirementGoalAccounts([])\n\n runInAction(() => {\n this.setRetirementGoals(upsertByGuid(this.retirementGoals, newGoal))\n this.setRetirementGoalAccounts(\n newAccounts.reduce((acc, a) => upsertByGuid(acc, a), this.retirementGoalAccounts),\n )\n })\n } catch (error) {\n this.captureError('addRetirementGoal', error)\n }\n }\n\n addRetirementGoalAccount = async (account: RetirementGoalAccount) => {\n try {\n const newAccount = await this.api.addRetirementGoalAccount(account)\n\n runInAction(() => {\n this.retirementGoalAccounts = upsertByGuid(this.retirementGoalAccounts, newAccount)\n })\n } catch (error) {\n this.captureError('addRetirementGoalAccount', error)\n }\n }\n\n deleteGoal = async (guid: string) => {\n try {\n await this.api.removeGoal(guid)\n\n const index = this.goals.findIndex((g) => g.guid === guid)\n if (index >= 0) {\n this.goals.splice(index, 1)\n }\n } catch (error) {\n this.captureError('deleteGoal', error)\n }\n }\n\n deleteRetirementGoal = async (goal: Goal) => {\n try {\n const accounts = this.retirementGoalAccounts.filter(\n (g) => g.retirement_goal_guid === goal.guid,\n )\n for (const account of accounts) {\n await this.deleteRetirementGoalAccount(account.guid)\n }\n await this.api.removeRetirementGoal(goal.guid)\n\n const index = this.retirementGoals.findIndex((g) => g.guid === goal.guid)\n if (index >= 0) {\n this.retirementGoals.splice(index, 1)\n }\n } catch (error) {\n this.captureError('deleteRetirementGoal', error)\n }\n }\n\n deleteRetirementGoalAccount = async (guid: string) => {\n try {\n await this.api.removeRetirementGoalAccount(guid)\n\n const index = this.retirementGoalAccounts.findIndex((rga) => rga.guid === guid)\n if (index >= 0) {\n this.retirementGoalAccounts.splice(index, 1)\n }\n } catch (error) {\n this.captureError('deleteRetirementGoalAccount', error)\n }\n }\n\n reorderGoals = async (goals: Goal[]) => {\n try {\n const reordered = (await this.api.reorderGoals(goals)) as Goal[]\n\n runInAction(() => {\n for (const goal of reordered) {\n const index = this.goals.findIndex((g) => g.guid === goal.guid)\n if (index >= 0) {\n this.goals[index].position = goal.position\n }\n }\n })\n } catch (error) {\n this.captureError('reorderGoals', error)\n }\n }\n\n setAlert = (alert: string) => (this.alert = alert)\n\n setNewRetirementGoalAccounts = (accounts: RetirementGoalAccount[]) => {\n this.newRetirementGoalAccounts = accounts\n }\n\n setSelectedGoal = (goal: Goal | undefined) => (this.selectedGoal = goal)\n\n updateGoal = async (goal: Goal) => {\n try {\n const updatedGoal = await this.api.updateGoal(goal)\n\n runInAction(() => {\n const index = this.goals.findIndex((g) => g.guid === goal.guid)\n if (index >= 0) {\n this.goals[index] = updatedGoal\n }\n if (this.selectedGoal?.guid === goal.guid) {\n this.setSelectedGoal(updatedGoal)\n }\n })\n } catch (error) {\n this.captureError('updateGoal', error)\n }\n }\n\n updateRetirementGoal = async (goal: Goal) => {\n try {\n const updatedRetirementGoal = await this.api.updateRetirementGoal({\n ...goal,\n target_amount: goal.amount,\n })\n\n runInAction(() => {\n const index = this.retirementGoals.findIndex((g) => g.guid === goal.guid)\n if (index >= 0) {\n this.retirementGoals[index] = updatedRetirementGoal\n }\n\n if (this.selectedGoal?.guid === goal.guid) {\n this.setSelectedGoal(this.allGoals.find((g) => g.guid === goal.guid))\n }\n })\n } catch (error) {\n this.captureError('updateRetirementGoal', error)\n }\n }\n\n updateMonthlyCashFlowProfile = async (profile: MonthlyCashFlowProfile) => {\n try {\n const updatedProfile = await this.api.updateMonthlyCashFlowProfile(profile)\n this.setMonthlyCashFlowProfile(updatedProfile)\n } catch (error) {\n this.captureError('updateMonthlyCashFlowProfile', error)\n }\n }\n\n private captureError = (action: string, error: unknown) =>\n this.globalStore.captureException(error, { store: 'GoalStore', action })\n}\n"],"mappings":";;;;;AAeA,IAAa,IAAb,MAAuB;AAAA,EACrB;AAAA,EACA,MAAM,IAAI,EAAQ,KAAK,EAAE;AAAA,EAEzB,QAAgB,CAAC;AAAA,EACjB,cAAuB;AAAA,EACvB,kBAA0B,CAAC;AAAA,EAC3B,wBAAiC;AAAA,EACjC,yBAAkD,CAAC;AAAA,EACnD,+BAAwC;AAAA,EACxC,yBAA6D;AAAA,EAC7D,+BAAwC;AAAA,EAExC,4BAAqD,CAAC;AAAA,EAEtD,QAAgB;AAAA,EAChB,eAAiC;AAAA,EAEjC,YAAY,GAA0B;AACpC,SAAK,cAAc,GACnB,KAAK,MAAM,IAAI,EAAQ,EAAY,UAAU,EAAY,cAAc,EAAY,OAAO,GAE1F,EAAmB,IAAI;AAAA,EACzB;AAAA,EAEA,IAAI,WAAmB;AACrB,QAAI,CAAC,KAAK,oBAAqB,QAAO,CAAC;AAEvC,UAAM,IAAY,KAAK,YAAY,UAAU,KAAK,OAC5C,IAAe,KAAK,YAAY,UAAU,KAAK;AACrD,WAAO,CACL,GAAG,KAAK,OACR,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B,MACtC,KAAK,YAAY,iBAAiB,GAAO;AAAA,IAAE,OAAO;AAAA,IAAa,QAAA;AAAA,EAAO,CAAC;AAC3E"}
|
|
1
|
+
{"version":3,"file":"GoalStore.es.js","names":[],"sources":["../../../src/core/stores/GoalStore.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { GoalApi } from '../api'\nimport { upsertByGuid } from '../utils/upsertByGuid'\n\nimport {\n type Goal,\n type MonthlyCashFlowProfile,\n type RetirementGoalAccount,\n TrackType,\n} from '../types'\nimport { getProjectedRetirementDate } from '../utils/GoalsUtil'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class GoalStore {\n globalStore: GlobalStore\n api = new GoalApi('/', '')\n\n goals: Goal[] = []\n goalsLoaded: boolean = false\n retirementGoals: Goal[] = []\n retirementGoalsLoaded: boolean = false\n retirementGoalAccounts: RetirementGoalAccount[] = []\n retirementGoalAccountsLoaded: boolean = false\n monthlyCashFlowProfile: MonthlyCashFlowProfile | undefined = undefined\n monthlyCashFlowProfileLoaded: boolean = false\n\n newRetirementGoalAccounts: RetirementGoalAccount[] = []\n\n alert: string = ''\n selectedGoal: Goal | undefined = undefined\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new GoalApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n\n makeAutoObservable(this)\n }\n\n get allGoals(): Goal[] {\n if (!this.isAllGoalDataLoaded) return []\n\n const goalsCopy = this.globalStore.copyStore.copy.goals\n const userBirthday = this.globalStore.userStore.user.birthday\n return [\n ...this.goals,\n ...this.retirementGoals.map((goal: Goal) => ({\n ...goal,\n amount: goal.target_amount,\n name: goalsCopy.retirement,\n track_type: TrackType.RETIREMENT_TRACK,\n projected_to_complete_at:\n goal.retirement_age && userBirthday\n ? getProjectedRetirementDate(goal.retirement_age, userBirthday)\n : undefined,\n })),\n ] as Goal[]\n }\n\n get orderedGoals(): Goal[] {\n return this.allGoals.slice().sort((a, b) => a.position - b.position)\n }\n\n get debtGoals() {\n return this.orderedGoals.filter((goal) => goal.track_type === TrackType.DEBT_TRACK)\n }\n\n get retirmentGoals() {\n return this.orderedGoals.filter((goal) => goal.track_type === TrackType.RETIREMENT_TRACK)\n }\n\n get savingGoals() {\n return this.orderedGoals.filter((goal) => goal.track_type === TrackType.SAVINGS_TRACK)\n }\n\n get ongoingGoalsForMiniWidget() {\n const ongoingGoals = this.allGoals.filter(\n (goal) =>\n !goal.is_complete &&\n goal.track_type !== TrackType.EMERGENCY_FUND_TRACK &&\n goal.track_type !== null,\n )\n const priorityOrder = [\n TrackType.SAVINGS_TRACK,\n TrackType.DEBT_TRACK,\n TrackType.RETIREMENT_TRACK,\n ]\n return ongoingGoals\n .sort((a, b) => {\n const aIndex = a.track_type ? priorityOrder.indexOf(a.track_type) : -1\n const bIndex = b.track_type ? priorityOrder.indexOf(b.track_type) : -1\n return aIndex - bIndex\n })\n .slice(0, 3)\n }\n\n get isAllGoalDataLoaded() {\n return (\n this.goalsLoaded &&\n this.retirementGoalsLoaded &&\n this.retirementGoalAccountsLoaded &&\n this.monthlyCashFlowProfileLoaded\n )\n }\n\n setGoals = (goals: Goal[]) => {\n this.goals = goals\n this.goalsLoaded = true\n }\n\n setRetirementGoals = (goals: Goal[]) => {\n this.retirementGoals = goals\n this.retirementGoalsLoaded = true\n }\n\n setRetirementGoalAccounts = (accounts: RetirementGoalAccount[]) => {\n this.retirementGoalAccounts = accounts\n this.retirementGoalAccountsLoaded = true\n }\n\n setMonthlyCashFlowProfile = (profile: MonthlyCashFlowProfile) => {\n this.monthlyCashFlowProfile = profile\n this.monthlyCashFlowProfileLoaded = true\n }\n\n loadGoalData = async () => {\n await Promise.all([\n this.loadGoals(),\n this.loadRetirementGoals(),\n this.loadRetirementGoalAccounts(),\n this.loadMonthlyCashFlowProfile(),\n ])\n }\n\n loadGoals = async () => {\n try {\n const goals = await this.api.getGoals()\n this.setGoals(goals)\n } catch (error) {\n this.captureError('loadGoals', error)\n }\n }\n\n loadRetirementGoals = async () => {\n try {\n const retirementGoals = await this.api.getRetirementGoals()\n this.setRetirementGoals(retirementGoals)\n } catch (error) {\n this.captureError('loadRetirementGoals', error)\n }\n }\n\n loadRetirementGoalAccounts = async () => {\n try {\n const retirementGoalAccounts = await this.api.getRetirementGoalAccounts()\n this.setRetirementGoalAccounts(retirementGoalAccounts)\n } catch (error) {\n this.captureError('loadRetirementGoalAccounts', error)\n }\n }\n\n loadMonthlyCashFlowProfile = async () => {\n try {\n const monthlyCashFlowProfile = await this.api.getMonthlyCashFlowProfile()\n this.setMonthlyCashFlowProfile(monthlyCashFlowProfile)\n } catch (error) {\n this.captureError('loadMonthlyCashFlowProfile', error)\n }\n }\n\n addGoal = async (goal: Goal) => {\n try {\n const newGoal = await this.api.addGoal(goal)\n this.setGoals(upsertByGuid(this.goals, newGoal))\n } catch (error) {\n this.captureError('addGoal', error)\n }\n }\n\n addRetirementGoal = async (goal: Goal) => {\n try {\n const newGoal: Goal = await this.api.addRetirementGoal(goal)\n const newAccounts = [] as RetirementGoalAccount[]\n for (const account of this.newRetirementGoalAccounts) {\n const newAccount = await this.api.addRetirementGoalAccount({\n ...account,\n retirement_goal_guid: newGoal.guid,\n })\n newAccounts.push(newAccount)\n }\n this.setNewRetirementGoalAccounts([])\n\n runInAction(() => {\n this.setRetirementGoals(upsertByGuid(this.retirementGoals, newGoal))\n this.setRetirementGoalAccounts(\n newAccounts.reduce((acc, a) => upsertByGuid(acc, a), this.retirementGoalAccounts),\n )\n })\n } catch (error) {\n this.captureError('addRetirementGoal', error)\n }\n }\n\n addRetirementGoalAccount = async (account: RetirementGoalAccount) => {\n try {\n const newAccount = await this.api.addRetirementGoalAccount(account)\n\n runInAction(() => {\n this.retirementGoalAccounts = upsertByGuid(this.retirementGoalAccounts, newAccount)\n })\n } catch (error) {\n this.captureError('addRetirementGoalAccount', error)\n }\n }\n\n deleteGoal = async (guid: string) => {\n try {\n await this.api.removeGoal(guid)\n\n const index = this.goals.findIndex((g) => g.guid === guid)\n if (index >= 0) {\n this.goals.splice(index, 1)\n }\n } catch (error) {\n this.captureError('deleteGoal', error)\n }\n }\n\n deleteRetirementGoal = async (goal: Goal) => {\n try {\n const accounts = this.retirementGoalAccounts.filter(\n (g) => g.retirement_goal_guid === goal.guid,\n )\n for (const account of accounts) {\n await this.deleteRetirementGoalAccount(account.guid)\n }\n await this.api.removeRetirementGoal(goal.guid)\n\n const index = this.retirementGoals.findIndex((g) => g.guid === goal.guid)\n if (index >= 0) {\n this.retirementGoals.splice(index, 1)\n }\n } catch (error) {\n this.captureError('deleteRetirementGoal', error)\n }\n }\n\n deleteRetirementGoalAccount = async (guid: string) => {\n try {\n await this.api.removeRetirementGoalAccount(guid)\n\n const index = this.retirementGoalAccounts.findIndex((rga) => rga.guid === guid)\n if (index >= 0) {\n this.retirementGoalAccounts.splice(index, 1)\n }\n } catch (error) {\n this.captureError('deleteRetirementGoalAccount', error)\n }\n }\n\n reorderGoals = async (goals: Goal[]) => {\n try {\n const reordered = (await this.api.reorderGoals(goals)) as Goal[]\n\n runInAction(() => {\n for (const goal of reordered) {\n const index = this.goals.findIndex((g) => g.guid === goal.guid)\n if (index >= 0) {\n this.goals[index].position = goal.position\n }\n }\n })\n } catch (error) {\n this.captureError('reorderGoals', error)\n }\n }\n\n setAlert = (alert: string) => (this.alert = alert)\n\n setNewRetirementGoalAccounts = (accounts: RetirementGoalAccount[]) => {\n this.newRetirementGoalAccounts = accounts\n }\n\n setSelectedGoal = (goal: Goal | undefined) => (this.selectedGoal = goal)\n\n updateGoal = async (goal: Goal) => {\n try {\n const updatedGoal = await this.api.updateGoal(goal)\n\n runInAction(() => {\n const index = this.goals.findIndex((g) => g.guid === goal.guid)\n if (index >= 0) {\n this.goals[index] = updatedGoal\n }\n if (this.selectedGoal?.guid === goal.guid) {\n this.setSelectedGoal(updatedGoal)\n }\n })\n } catch (error) {\n this.captureError('updateGoal', error)\n }\n }\n\n updateRetirementGoal = async (goal: Goal) => {\n try {\n const updatedRetirementGoal = await this.api.updateRetirementGoal({\n ...goal,\n target_amount: goal.amount,\n })\n\n runInAction(() => {\n const index = this.retirementGoals.findIndex((g) => g.guid === goal.guid)\n if (index >= 0) {\n this.retirementGoals[index] = updatedRetirementGoal\n }\n\n if (this.selectedGoal?.guid === goal.guid) {\n this.setSelectedGoal(this.allGoals.find((g) => g.guid === goal.guid))\n }\n })\n } catch (error) {\n this.captureError('updateRetirementGoal', error)\n }\n }\n\n updateMonthlyCashFlowProfile = async (profile: MonthlyCashFlowProfile) => {\n try {\n const updatedProfile = await this.api.updateMonthlyCashFlowProfile(profile)\n this.setMonthlyCashFlowProfile(updatedProfile)\n } catch (error) {\n this.captureError('updateMonthlyCashFlowProfile', error)\n }\n }\n\n private captureError = (action: string, error: unknown) =>\n this.globalStore.captureException(error, { store: 'GoalStore', action })\n}\n"],"mappings":";;;;;AAeA,IAAa,IAAb,MAAuB;AAAA,EACrB;AAAA,EACA,MAAM,IAAI,EAAQ,KAAK,EAAE;AAAA,EAEzB,QAAgB,CAAC;AAAA,EACjB,cAAuB;AAAA,EACvB,kBAA0B,CAAC;AAAA,EAC3B,wBAAiC;AAAA,EACjC,yBAAkD,CAAC;AAAA,EACnD,+BAAwC;AAAA,EACxC,yBAA6D;AAAA,EAC7D,+BAAwC;AAAA,EAExC,4BAAqD,CAAC;AAAA,EAEtD,QAAgB;AAAA,EAChB,eAAiC;AAAA,EAEjC,YAAY,GAA0B;AACpC,SAAK,cAAc,GACnB,KAAK,MAAM,IAAI,EAAQ,EAAY,UAAU,EAAY,cAAc,EAAY,OAAO,GAE1F,EAAmB,IAAI;AAAA,EACzB;AAAA,EAEA,IAAI,WAAmB;AACrB,QAAI,CAAC,KAAK,oBAAqB,QAAO,CAAC;AAEvC,UAAM,IAAY,KAAK,YAAY,UAAU,KAAK,OAC5C,IAAe,KAAK,YAAY,UAAU,KAAK;AACrD,WAAO,CACL,GAAG,KAAK,OACR,GAAG,KAAK,gBAAgB,IAAA,CAAK,OAAgB;AA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AAE,OAAO;AAAA,IAAa,QAAA;AAAA,EAAO,CAAC;AAC3E"}
|
|
@@ -194,6 +194,28 @@ export interface SurveyModalCopy {
|
|
|
194
194
|
/** ARIA label for the snackbar close button. */
|
|
195
195
|
toast_close_aria: string;
|
|
196
196
|
}
|
|
197
|
+
/** Subscription Status modal words. */
|
|
198
|
+
export interface SubscriptionStatusModalCopy {
|
|
199
|
+
/** Dialog title. */
|
|
200
|
+
title: string;
|
|
201
|
+
/** Positive answer. */
|
|
202
|
+
subscribed_answer: string;
|
|
203
|
+
/** Negative answer; opens the reasons. */
|
|
204
|
+
not_subscribed_answer: string;
|
|
205
|
+
/** Reasons. */
|
|
206
|
+
never_subscribed: string;
|
|
207
|
+
cancelled: string;
|
|
208
|
+
one_time_purchase: string;
|
|
209
|
+
/** Micro title once answered. */
|
|
210
|
+
reviewed_title: string;
|
|
211
|
+
/** Snackbar words. */
|
|
212
|
+
success_message: string;
|
|
213
|
+
error_message: string;
|
|
214
|
+
try_again: string;
|
|
215
|
+
/** Close labels. */
|
|
216
|
+
close_aria: string;
|
|
217
|
+
toast_close_aria: string;
|
|
218
|
+
}
|
|
197
219
|
/** Connection-details education drilldown (`connection_detail_block`). */
|
|
198
220
|
export interface ConnectionDetailsCopy {
|
|
199
221
|
aria_label_thumbs_down: string;
|
|
@@ -423,6 +445,8 @@ export interface InsightsFeedCopy {
|
|
|
423
445
|
connection_details?: ConnectionDetailsCopy;
|
|
424
446
|
/** Optional: every caller already null-guards (`copyStore.insights_feed?.survey_modal`). */
|
|
425
447
|
survey_modal?: SurveyModalCopy;
|
|
448
|
+
/** Subscription Status modal words. */
|
|
449
|
+
subscription_status_modal?: SubscriptionStatusModalCopy;
|
|
426
450
|
feedback_bar: FeedbackBarCopy;
|
|
427
451
|
dismiss: DismissInsightCopy;
|
|
428
452
|
/** Optional until the localized-content service ships the namespace. */
|
|
@@ -3,27 +3,27 @@ import { useWidgetLoadTimer as E } from "../common/hooks/useWidgetLoadTimer.es.j
|
|
|
3
3
|
import { ANALYTICS_EVENTS as l } from "../common/constants/Analytics.es.js";
|
|
4
4
|
import T from "../common/components/MicroWidgetContainer.es.js";
|
|
5
5
|
import h from "../common/components/Loader.es.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
6
|
+
import { GoalMiniStatusCard as D } from "./components/mini/GoalMiniStatusCard.es.js";
|
|
7
|
+
import { GoalsMiniEmptyState as b } from "./components/mini/GoalsMiniEmptyState.es.js";
|
|
8
|
+
import a from "react";
|
|
9
9
|
import { observer as v } from "mobx-react-lite";
|
|
10
10
|
import y from "@mui/material/Stack";
|
|
11
11
|
import { jsx as t, jsxs as I } from "react/jsx-runtime";
|
|
12
12
|
import M from "@mui/material/Divider";
|
|
13
13
|
var U = v(({ onCTAClick: m }) => {
|
|
14
|
-
const { isAccountDataLoaded: d, loadAccountData: f, visibleAccounts: u } = S(), { onEvent:
|
|
14
|
+
const { isAccountDataLoaded: d, loadAccountData: f, visibleAccounts: u } = S(), { onEvent: n } = _(), { goals: o } = A(), { isInitialized: r } = L(), { ongoingGoalsForMiniWidget: e, isAllGoalDataLoaded: i, loadGoalData: p } = C();
|
|
15
15
|
E({
|
|
16
16
|
widgetName: "GoalsMicroWidget",
|
|
17
17
|
isLoaded: i
|
|
18
|
-
}),
|
|
18
|
+
}), a.useEffect(() => {
|
|
19
19
|
d || f().finally();
|
|
20
|
-
}, []),
|
|
21
|
-
|
|
22
|
-
}, [
|
|
23
|
-
const s =
|
|
24
|
-
|
|
20
|
+
}, []), a.useEffect(() => {
|
|
21
|
+
r && (p().finally(), n(l.GOALS_LOAD_WIDGET, { state: u?.length ? "default" : "zeroState" }));
|
|
22
|
+
}, [r]);
|
|
23
|
+
const s = a.useMemo(() => i && e.length === 0, [e, i]), g = () => {
|
|
24
|
+
n(s ? l.GOALS_CLICK_GET_STARTED : l.GOALS_CLICK_VIEW_DETAILS), m();
|
|
25
25
|
};
|
|
26
|
-
return !
|
|
26
|
+
return !r || !i ? /* @__PURE__ */ t(h, {}) : /* @__PURE__ */ t(T, {
|
|
27
27
|
className: "mx-goals-microwidget",
|
|
28
28
|
ctaLabel: s ? o.get_started : o.view_details,
|
|
29
29
|
onCTAClick: g,
|
|
@@ -33,12 +33,12 @@ var U = v(({ onCTAClick: m }) => {
|
|
|
33
33
|
subText: o.micro_zero_state_description
|
|
34
34
|
}) : /* @__PURE__ */ t(y, {
|
|
35
35
|
sx: { justifyContent: "space-between" },
|
|
36
|
-
children: e.map((
|
|
36
|
+
children: e.map((c, G) => /* @__PURE__ */ I(a.Fragment, { children: [/* @__PURE__ */ t(D, { goal: c }), G !== e.length - 1 && /* @__PURE__ */ t(M, {})] }, c.guid))
|
|
37
37
|
})
|
|
38
38
|
});
|
|
39
39
|
});
|
|
40
40
|
export {
|
|
41
|
-
U as
|
|
41
|
+
U as GoalsMiniWidget
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
//# sourceMappingURL=
|
|
44
|
+
//# sourceMappingURL=GoalsMiniWidget.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GoalsMiniWidget.es.js","names":[],"sources":["../../src/goals/GoalsMiniWidget.tsx"],"sourcesContent":["import React from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport Stack from '@mui/material/Stack'\nimport Divider from '@mui/material/Divider'\n\nimport {\n ANALYTICS_EVENTS,\n Loader,\n MicroWidgetContainer,\n useAccountStore,\n useEvent,\n useGlobalCopyStore,\n useGlobalUiStore,\n useGoalStore,\n useWidgetLoadTimer,\n} from '../common'\n\nimport { GoalMiniStatusCard } from './components/mini/GoalMiniStatusCard'\nimport { GoalsMiniEmptyState } from './components/mini/GoalsMiniEmptyState'\n\ninterface GoalsMiniWidgetProps {\n onCTAClick: () => void\n}\n\nexport const GoalsMiniWidget = observer(({ onCTAClick }: GoalsMiniWidgetProps) => {\n const { isAccountDataLoaded, loadAccountData, visibleAccounts: accounts } = useAccountStore()\n const { onEvent } = useEvent()\n const { goals: copy } = useGlobalCopyStore()\n const { isInitialized } = useGlobalUiStore()\n const { ongoingGoalsForMiniWidget: goals, isAllGoalDataLoaded, loadGoalData } = useGoalStore()\n\n useWidgetLoadTimer({\n // Hosts report WidgetLoad events by this name, so renaming it splits the goals load-time history.\n widgetName: 'GoalsMicroWidget',\n isLoaded: isAllGoalDataLoaded,\n })\n\n React.useEffect(() => {\n if (!isAccountDataLoaded) {\n loadAccountData().finally()\n }\n }, [])\n\n React.useEffect(() => {\n if (isInitialized) {\n loadGoalData().finally()\n onEvent(ANALYTICS_EVENTS.GOALS_LOAD_WIDGET, {\n state: !accounts?.length ? 'zeroState' : 'default',\n })\n }\n }, [isInitialized])\n\n const isEmptyGoalsState = React.useMemo(\n () => isAllGoalDataLoaded && goals.length === 0,\n [goals, isAllGoalDataLoaded],\n )\n\n const handleCTAClick = () => {\n onEvent(\n isEmptyGoalsState\n ? ANALYTICS_EVENTS.GOALS_CLICK_GET_STARTED\n : ANALYTICS_EVENTS.GOALS_CLICK_VIEW_DETAILS,\n )\n onCTAClick()\n }\n\n if (!isInitialized || !isAllGoalDataLoaded) {\n return <Loader />\n }\n\n return (\n <MicroWidgetContainer\n className=\"mx-goals-microwidget\"\n ctaLabel={!isEmptyGoalsState ? copy.view_details : copy.get_started}\n onCTAClick={handleCTAClick}\n title={copy.title}\n >\n {!isEmptyGoalsState ? (\n <Stack sx={{ justifyContent: 'space-between' }}>\n {goals.map((goal, index) => (\n <React.Fragment key={goal.guid}>\n <GoalMiniStatusCard goal={goal} />\n {index !== goals.length - 1 && <Divider />}\n </React.Fragment>\n ))}\n </Stack>\n ) : (\n <GoalsMiniEmptyState\n header={copy.create_goals_header}\n subText={copy.micro_zero_state_description}\n />\n )}\n </MicroWidgetContainer>\n )\n})\n"],"mappings":";;;;;;;;;;;;AA0BA,IAAa,IAAkB,EAAA,CAAU,EAAE,YAAA,EAAA,MAAuC;AAChF,QAAM,EAAE,qBAAA,GAAqB,iBAAA,GAAiB,iBAAiB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C,MAAU,EAAM,SAAS,KAAK,gBAAA,EAAC,GAAD,CAAU,CAAA,CAC3B,EAAA,GAHK,EAAK,IAGV,CACjB;AAAA,IACI,CAAA;AAAA,EAOW,CAAA;AAE1B,CAAC"}
|
package/dist/goals/components/{micro/GoalMicroStatusCard.d.ts → mini/GoalMiniStatusCard.d.ts}
RENAMED
|
@@ -2,7 +2,7 @@ import { Goal } from '../../../core';
|
|
|
2
2
|
interface GoalStatusCardProps {
|
|
3
3
|
goal: Goal;
|
|
4
4
|
}
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const GoalMiniStatusCard: (({ goal }: GoalStatusCardProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
6
6
|
displayName: string;
|
|
7
7
|
};
|
|
8
8
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GoalMiniStatusCard.es.js","names":[],"sources":["../../../../src/goals/components/mini/GoalMiniStatusCard.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Avatar from '@mui/material/Avatar'\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { NoteStack, Payments, Person } from '@mxenabled/mx-icons'\n\nimport { H2, P, Text } from '@mxenabled/mxui'\n\nimport { SingleSegmentDonut, useGlobalCopyStore } from '../../../common'\nimport { type Goal, TrackType } from '../../../core'\n\nimport { getGoalStatusData } from '../../../core/utils/GoalsUtil'\n\ninterface GoalStatusCardProps {\n goal: Goal\n}\n\nexport const GoalMiniStatusCard = observer(({ goal }: GoalStatusCardProps) => {\n const { goals: copy } = useGlobalCopyStore()\n\n const theme = useTheme()\n\n const {\n backgroundColor: bgcolor,\n color,\n percentage,\n projectedText,\n } = getGoalStatusData(copy, goal)\n\n const percentNumber = Math.round(percentage * 100)\n\n let avatarIcon = <Payments />\n if (goal.track_type === TrackType.DEBT_TRACK) {\n avatarIcon = <NoteStack />\n } else if (goal.track_type === TrackType.RETIREMENT_TRACK) {\n avatarIcon = <Person />\n }\n\n return (\n <Stack alignItems=\"center\" direction=\"row\" spacing={12} sx={{ py: 12 }}>\n <Avatar sx={{ bgcolor, color, height: 32, width: 32 }} variant=\"rounded\">\n {avatarIcon}\n </Avatar>\n <Box sx={{ width: '100%' }}>\n <H2 fontSize={15} fontWeight={600} variant=\"body1\">\n {goal.name}\n </H2>\n {goal.projected_to_complete_at && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {projectedText}\n </Text>\n )}\n </Box>\n <SingleSegmentDonut\n backgroundStrokeColor={theme.palette.neutral.light}\n color={theme.palette.primary.main}\n percent={percentNumber}\n size={40}\n strokeWidth={3}\n >\n <P fontWeight={700} variant=\"caption\">\n {`${percentNumber}%`}\n </P>\n </SingleSegmentDonut>\n </Stack>\n )\n})\n"],"mappings":";;;;;;;;;;;;AAoBA,IAAa,IAAqB,EAAA,CAAU,EAAE,MAAA,EAAA,MAAgC;AAC5E,QAAM,EAAE,OAAO,EAAA,IAAS,EAAmB,GAErC,IAAQ,EAAS,GAEjB,EACJ,iBAAiB,GACjB,OAAA,GACA,YAAA,GACA,eAAA,EAAA,IACE,EAAkB,GAAM,CAAI,GAE1B,IAAgB,KAAK,MAAM,IAAa,GAAG;AAEjD,MAAI,IAAa,gBAAA,EAAC,GAAD,CAAW,CAAA;AAC5B,SAAI,EAAK,eAAe,EAAU,aAChC,IAAa,gBAAA,EAAC,GAAD,CAAY,CAAA,IAChB,EAAK,eAAe,EAAU,qBACvC,IAAa,gBAAA,EAAC,GAAD,CAAS,CAAA,IAItB,gBAAA,EAAC,GAAD;AAAA,IAAO,YAAW;AAAA,IAAS,WAAU;AAAA,IAAM,SAAS;AAAA,IAAI,IAAI,EAAE,IAAI,GAAG;AAAA,IAArE,UAAA;AAAA,MACE,gBAAA,EAAC,GAAD;AAAA,QAAQ,IAAI;AAAA,UAAE,SAAA;AAAA,UAAS,OAAA;AAAA,UAAO,QAAQ;AAAA,UAAI,OAAO;AAAA,QAAG;AAAA,QAAG,SAAQ;AAAA,QAC5D,UAAA;AAAA,MACK,CAAA;AAAA,MACR,gBAAA,EAAC,GAAD;AAAA,QAAK,IAAI,EAAE,OAAO,OAAO;AAAA,QAAzB,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,UAAI,UAAU;AAAA,UAAI,YAAY;AAAA,UAAK,SAAQ;AAAA,UACxC,UAAA,EAAK;AAAA,QACJ,CAAA,GACH,EAAK,4BACJ,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAiB,SAAQ;AAAA,UAClC,UAAA;AAAA,QACG,CAAA,CAEL;AAAA;MACL,gBAAA,EAAC,GAAD;AAAA,QACE,uBAAuB,EAAM,QAAQ,QAAQ;AAAA,QAC7C,OAAO,EAAM,QAAQ,QAAQ;AAAA,QAC7B,SAAS;AAAA,QACT,MAAM;AAAA,QACN,aAAa;AAAA,QAEb,UAAA,gBAAA,EAAC,GAAD;AAAA,UAAG,YAAY;AAAA,UAAK,SAAQ;AAAA,UACzB,UAAA,GAAG,CAAA;AAAA,QACH,CAAA;AAAA,MACe,CAAA;AAAA,IACf;AAAA;AAEX,CAAC"}
|
package/dist/goals/components/{micro/GoalsMicroEmptyState.d.ts → mini/GoalsMiniEmptyState.d.ts}
RENAMED
|
@@ -4,5 +4,5 @@ interface EmptyWidgetProps {
|
|
|
4
4
|
subText: string;
|
|
5
5
|
sx?: SxProps;
|
|
6
6
|
}
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const GoalsMiniEmptyState: ({ header, subText, sx }: EmptyWidgetProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export {};
|
package/dist/goals/components/{micro/GoalsMicroEmptyState.es.js → mini/GoalsMiniEmptyState.es.js}
RENAMED
|
@@ -29,7 +29,7 @@ var p = ({ header: e, subText: r, sx: i }) => /* @__PURE__ */ a(o, {
|
|
|
29
29
|
]
|
|
30
30
|
});
|
|
31
31
|
export {
|
|
32
|
-
p as
|
|
32
|
+
p as GoalsMiniEmptyState
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
//# sourceMappingURL=
|
|
35
|
+
//# sourceMappingURL=GoalsMiniEmptyState.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GoalsMiniEmptyState.es.js","names":[],"sources":["../../../../src/goals/components/mini/GoalsMiniEmptyState.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\nimport { type SxProps } from '@mui/material/styles'\n\nimport { Trophy } from '@mxenabled/mx-icons'\nimport { H2, P } from '@mxenabled/mxui'\n\ninterface EmptyWidgetProps {\n header: string\n subText: string\n sx?: SxProps\n}\n\nexport const GoalsMiniEmptyState = ({ header, subText, sx }: EmptyWidgetProps) => (\n <Stack\n sx={{\n alignItems: 'center',\n alignSelf: 'center',\n px: 24,\n ...sx,\n }}\n >\n <Trophy size={32} />\n <H2 fontSize={15} fontWeight={600}>\n {header}\n </H2>\n <P\n color=\"text.secondary\"\n sx={{ fontWeight: 400, maxWidth: { sm: 424 }, textAlign: 'center' }}\n variant=\"subtitle2\"\n >\n {subText}\n </P>\n </Stack>\n)\n"],"mappings":";;;;AAYA,IAAa,IAAA,CAAuB,EAAE,QAAA,GAAQ,SAAA,GAAS,IAAA,EAAA,MACrD,gBAAA,EAAC,GAAD;AAAA,EACE,IAAI;AAAA,IACF,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,IAAI;AAAA,IACJ,GAAG;AAAA,EACL;AAAA,EANF,UAAA;AAAA,IAQE,gBAAA,EAAC,GAAD,EAAQ,MAAM,GAAK,CAAA;AAAA,IACnB,gBAAA,EAAC,GAAD;AAAA,MAAI,UAAU;AAAA,MAAI,YAAY;AAAA,MAC3B,UAAA;AAAA,IACC,CAAA;AAAA,IACJ,gBAAA,EAAC,GAAD;AAAA,MACE,OAAM;AAAA,MACN,IAAI;AAAA,QAAE,YAAY;AAAA,QAAK,UAAU,EAAE,IAAI,IAAI;AAAA,QAAG,WAAW;AAAA,MAAS;AAAA,MAClE,SAAQ;AAAA,MAEP,UAAA;AAAA,IACA,CAAA;AAAA,EACE"}
|
package/dist/goals/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { GoalsWidget } from './GoalsWidget';
|
|
2
|
-
export {
|
|
2
|
+
export { GoalsMiniWidget } from './GoalsMiniWidget';
|
package/dist/goals/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { GoalsWidget as
|
|
2
|
-
import {
|
|
1
|
+
import { GoalsWidget as i } from "./GoalsWidget.es.js";
|
|
2
|
+
import { GoalsMiniWidget as t } from "./GoalsMiniWidget.es.js";
|
|
3
3
|
export {
|
|
4
|
-
t as
|
|
5
|
-
|
|
4
|
+
t as GoalsMiniWidget,
|
|
5
|
+
i as GoalsWidget
|
|
6
6
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ActionBlockProps } from '../mappings/blocks';
|
|
2
|
+
/** Unexpected Subscription Payment's Subscription Status modal. */
|
|
3
|
+
export declare const SubscriptionStatusModalBlock: (({ beat, }: ActionBlockProps) => import("react/jsx-runtime").JSX.Element | null) & {
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export default SubscriptionStatusModalBlock;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { useGlobalCopyStore as G, useGlobalStore as P, useInsightsV2Store as W } from "../../common/context/hooks.es.js";
|
|
2
|
+
import { slot as a } from "../../core/types/Insights.es.js";
|
|
3
|
+
import { formatCurrency as F } from "../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import A from "../../common/components/dialog/Dialog.es.js";
|
|
5
|
+
import { useBeatActions as j } from "../beatActions.es.js";
|
|
6
|
+
import { USER_RESPONSE as c, answerSubscription as H, repeatingTransactionOf as U, reportSubscriptionMarkedIncorrect as V } from "../ctaActions/subscriptionAnswer.es.js";
|
|
7
|
+
import z from "../components/LogoFromGuid.es.js";
|
|
8
|
+
import "../components/celebrationGradients.es.js";
|
|
9
|
+
import { ELEVATION_SHADOW as X } from "../components/shared/elevation.es.js";
|
|
10
|
+
import $ from "../components/TransactionListCard.es.js";
|
|
11
|
+
import { subscriptionFrequency as q } from "../components/SubscriptionStatus/subscriptionFrequency.es.js";
|
|
12
|
+
import Z from "../components/shared/StatusSnackbar.es.js";
|
|
13
|
+
import { getDynamicCtaBasedOnTriggers as J } from "./util.es.js";
|
|
14
|
+
import { useRef as K, useState as x } from "react";
|
|
15
|
+
import { observer as Q } from "mobx-react-lite";
|
|
16
|
+
import C from "@mui/material/Stack";
|
|
17
|
+
import { Text as Y } from "@mxenabled/mxui";
|
|
18
|
+
import { Icon as oo } from "@mxenabled/mx-icons";
|
|
19
|
+
import { Fragment as ro, jsx as r, jsxs as _ } from "react/jsx-runtime";
|
|
20
|
+
import to from "@mui/material/Divider";
|
|
21
|
+
import eo from "@mui/material/ButtonBase";
|
|
22
|
+
var so = 32, D = {
|
|
23
|
+
backgroundColor: "background.paper",
|
|
24
|
+
borderRadius: 1,
|
|
25
|
+
boxShadow: X[16]
|
|
26
|
+
}, E = {
|
|
27
|
+
"& .MuiDialog-paper": D,
|
|
28
|
+
"& .MuiDialogContent-root": { p: 0 },
|
|
29
|
+
"& .MuiDialogActions-root .MuiButton-root": {
|
|
30
|
+
px: 16,
|
|
31
|
+
py: 12
|
|
32
|
+
}
|
|
33
|
+
}, Io = Q(function({ beat: g }) {
|
|
34
|
+
const O = P(), { insights_feed: w, recurring: I } = G(), { actionDrawer: R, closeActionDrawer: N } = W(), T = j(), [b, l] = x("answers"), [e, u] = x(null), s = K(!1), o = w?.subscription_status_modal, i = g.insights_payload;
|
|
35
|
+
if (!i || !o || !Object.values(o).every((t) => typeof t == "string" && t.trim())) return null;
|
|
36
|
+
const m = {
|
|
37
|
+
beat: g,
|
|
38
|
+
stores: O,
|
|
39
|
+
hostActions: T
|
|
40
|
+
}, n = J(R, i.primary_cta, i.secondary_cta, i.in_description_cta)?.drilldown_data ?? {}, y = a(n, "logo"), p = a(n, "primary_text"), S = a(n, "amount"), d = async (t) => {
|
|
41
|
+
l("saving");
|
|
42
|
+
try {
|
|
43
|
+
await H(m, t), u({ severity: "success" });
|
|
44
|
+
} catch {
|
|
45
|
+
u({
|
|
46
|
+
severity: "error",
|
|
47
|
+
retry: t
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
l("done");
|
|
51
|
+
}, f = () => {
|
|
52
|
+
u(null), N();
|
|
53
|
+
}, k = () => {
|
|
54
|
+
s.current = !0, V(m), l("reasons");
|
|
55
|
+
}, B = () => {
|
|
56
|
+
s.current = !0, d(c.CONFIRMED);
|
|
57
|
+
}, M = () => {
|
|
58
|
+
if (s.current) {
|
|
59
|
+
s.current = !1;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
f();
|
|
63
|
+
}, h = [
|
|
64
|
+
{
|
|
65
|
+
label: o.never_subscribed,
|
|
66
|
+
userResponse: c.NEVER_SUBSCRIBED
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
label: o.cancelled,
|
|
70
|
+
userResponse: c.CANCELLED
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
label: o.one_time_purchase,
|
|
74
|
+
userResponse: c.ONE_TIME_PURCHASE
|
|
75
|
+
}
|
|
76
|
+
];
|
|
77
|
+
return /* @__PURE__ */ _(ro, { children: [
|
|
78
|
+
/* @__PURE__ */ r(A, {
|
|
79
|
+
copy: {
|
|
80
|
+
title: o.title,
|
|
81
|
+
close_aria: o.close_aria
|
|
82
|
+
},
|
|
83
|
+
fullWidth: !0,
|
|
84
|
+
isOpen: b === "answers",
|
|
85
|
+
onClose: M,
|
|
86
|
+
onPrimaryAction: B,
|
|
87
|
+
onSecondaryAction: k,
|
|
88
|
+
primaryText: o.subscribed_answer,
|
|
89
|
+
secondaryText: o.not_subscribed_answer,
|
|
90
|
+
sx: E,
|
|
91
|
+
children: typeof p == "string" && p && /* @__PURE__ */ r($, {
|
|
92
|
+
background: "linear-gradient(201deg, rgba(255, 170, 0, 0.25) 1.86%, rgba(255, 68, 0, 0.25) 101.54%)",
|
|
93
|
+
elevated: !0,
|
|
94
|
+
rows: [{
|
|
95
|
+
amount: typeof S == "number" ? F(S, "0,0.00") : "",
|
|
96
|
+
amountCaption: q(I, U(m)),
|
|
97
|
+
leading: y ? /* @__PURE__ */ r(z, {
|
|
98
|
+
logo: y,
|
|
99
|
+
size: so
|
|
100
|
+
}) : void 0,
|
|
101
|
+
subtitle: a(n, "secondary_text") ?? "",
|
|
102
|
+
title: p
|
|
103
|
+
}]
|
|
104
|
+
})
|
|
105
|
+
}),
|
|
106
|
+
/* @__PURE__ */ r(A, {
|
|
107
|
+
copy: {
|
|
108
|
+
title: o.title,
|
|
109
|
+
close_aria: o.close_aria
|
|
110
|
+
},
|
|
111
|
+
fullWidth: !0,
|
|
112
|
+
isOpen: b === "reasons",
|
|
113
|
+
onClose: f,
|
|
114
|
+
showActions: !1,
|
|
115
|
+
sx: {
|
|
116
|
+
...E,
|
|
117
|
+
"& .MuiDialog-paper": {
|
|
118
|
+
...D,
|
|
119
|
+
pb: 16
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
children: /* @__PURE__ */ r(C, { children: h.map(({ label: t, userResponse: v }, L) => /* @__PURE__ */ _(C, { children: [/* @__PURE__ */ _(eo, {
|
|
123
|
+
onClick: () => {
|
|
124
|
+
d(v);
|
|
125
|
+
},
|
|
126
|
+
sx: {
|
|
127
|
+
gap: 12,
|
|
128
|
+
justifyContent: "space-between",
|
|
129
|
+
minHeight: 44,
|
|
130
|
+
px: 24,
|
|
131
|
+
py: 8,
|
|
132
|
+
textAlign: "left",
|
|
133
|
+
width: "100%"
|
|
134
|
+
},
|
|
135
|
+
children: [/* @__PURE__ */ r(Y, {
|
|
136
|
+
variant: "body1",
|
|
137
|
+
children: t
|
|
138
|
+
}), /* @__PURE__ */ r(oo, {
|
|
139
|
+
"aria-hidden": !0,
|
|
140
|
+
name: "chevron_right",
|
|
141
|
+
size: 24,
|
|
142
|
+
sx: { color: "action.active" }
|
|
143
|
+
})]
|
|
144
|
+
}), L < h.length - 1 && /* @__PURE__ */ r(to, { sx: {
|
|
145
|
+
ml: 24,
|
|
146
|
+
mt: "-1px"
|
|
147
|
+
} })] }, v)) })
|
|
148
|
+
}),
|
|
149
|
+
e && /* @__PURE__ */ r(Z, {
|
|
150
|
+
actionText: e.retry ? o.try_again : void 0,
|
|
151
|
+
closeAriaLabel: o.toast_close_aria,
|
|
152
|
+
message: e.severity === "success" ? o.success_message : o.error_message,
|
|
153
|
+
onActionClick: e.retry ? () => {
|
|
154
|
+
d(e.retry);
|
|
155
|
+
} : void 0,
|
|
156
|
+
onClose: f,
|
|
157
|
+
open: !0,
|
|
158
|
+
severity: e.severity,
|
|
159
|
+
variant: "strong"
|
|
160
|
+
})
|
|
161
|
+
] });
|
|
162
|
+
});
|
|
163
|
+
export {
|
|
164
|
+
Io as SubscriptionStatusModalBlock,
|
|
165
|
+
Io as default
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
//# sourceMappingURL=SubscriptionStatusModalBlock.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubscriptionStatusModalBlock.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/SubscriptionStatusModalBlock.tsx"],"sourcesContent":["import { useRef, useState } from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport ButtonBase from '@mui/material/ButtonBase'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { Dialog, useGlobalCopyStore, useGlobalStore, useInsightsV2Store } from '../../common'\nimport { slot } from '../../core'\nimport type { LogoRef } from '../../core'\nimport { formatCurrency } from '../../core/utils/NumberFormatting'\nimport { useBeatActions } from '../beatActions'\nimport { WARNING_WASH_GRADIENT } from '../components/celebrationGradients'\nimport LogoFromGuid from '../components/LogoFromGuid'\nimport { ELEVATION_SHADOW } from '../components/shared/elevation'\nimport StatusSnackbar from '../components/shared/StatusSnackbar'\nimport { subscriptionFrequency } from '../components/SubscriptionStatus/subscriptionFrequency'\nimport TransactionListCard from '../components/TransactionListCard'\nimport {\n answerSubscription,\n repeatingTransactionOf,\n reportSubscriptionMarkedIncorrect,\n USER_RESPONSE,\n} from '../ctaActions/subscriptionAnswer'\nimport type { ActionBlockProps } from '../mappings/blocks'\nimport { getDynamicCtaBasedOnTriggers } from './util'\n\nconst ROW_LOGO_SIZE = 32\n\n// Figma Dialog: white paper, 4px radius, elevation/16; full-bleed content; 12/16 action buttons.\nconst DIALOG_PAPER_SX = {\n backgroundColor: 'background.paper',\n borderRadius: 1,\n boxShadow: ELEVATION_SHADOW[16],\n}\nconst SUBSCRIPTION_DIALOG_SX = {\n '& .MuiDialog-paper': DIALOG_PAPER_SX,\n '& .MuiDialogContent-root': { p: 0 },\n '& .MuiDialogActions-root .MuiButton-root': { px: 16, py: 12 },\n}\n\ntype Phase = 'answers' | 'reasons' | 'saving' | 'done'\ninterface Notice {\n severity: 'success' | 'error'\n retry?: string\n}\n\n/** Unexpected Subscription Payment's Subscription Status modal. */\nexport const SubscriptionStatusModalBlock = observer(function SubscriptionStatusModalBlock({\n beat,\n}: ActionBlockProps) {\n const stores = useGlobalStore()\n const { insights_feed, recurring } = useGlobalCopyStore()\n const { actionDrawer, closeActionDrawer } = useInsightsV2Store()\n const beatActions = useBeatActions()\n const [phase, setPhase] = useState<Phase>('answers')\n const [notice, setNotice] = useState<Notice | null>(null)\n // The Dialog calls onClose after its actions; keep the flow open.\n const actionTaken = useRef(false)\n\n const copy = insights_feed?.subscription_status_modal\n const payload = beat.insights_payload\n\n if (\n !payload ||\n !copy ||\n !Object.values(copy).every((word) => typeof word === 'string' && word.trim())\n ) {\n return null\n }\n\n const ctx = { beat, stores, hostActions: beatActions }\n const cta = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n payload.primary_cta,\n payload.secondary_cta,\n payload.in_description_cta,\n )\n const row = cta?.drilldown_data ?? {}\n const logo = slot<LogoRef>(row, 'logo')\n const title = slot<string>(row, 'primary_text')\n const amount = slot<number>(row, 'amount')\n\n const save = async (userResponse: string) => {\n setPhase('saving')\n try {\n await answerSubscription(ctx, userResponse)\n setNotice({ severity: 'success' })\n } catch {\n setNotice({ severity: 'error', retry: userResponse })\n }\n setPhase('done')\n }\n\n const finish = () => {\n setNotice(null)\n closeActionDrawer()\n }\n\n const chooseNotSubscribed = () => {\n actionTaken.current = true\n reportSubscriptionMarkedIncorrect(ctx)\n setPhase('reasons')\n }\n\n const chooseSubscribed = () => {\n actionTaken.current = true\n void save(USER_RESPONSE.CONFIRMED)\n }\n\n const closeAnswers = () => {\n if (actionTaken.current) {\n actionTaken.current = false\n return\n }\n finish()\n }\n\n const reasons = [\n { label: copy.never_subscribed, userResponse: USER_RESPONSE.NEVER_SUBSCRIBED },\n { label: copy.cancelled, userResponse: USER_RESPONSE.CANCELLED },\n { label: copy.one_time_purchase, userResponse: USER_RESPONSE.ONE_TIME_PURCHASE },\n ]\n\n return (\n <>\n <Dialog\n copy={{ title: copy.title, close_aria: copy.close_aria }}\n // Fixed xs width.\n fullWidth={true}\n isOpen={phase === 'answers'}\n onClose={closeAnswers}\n onPrimaryAction={chooseSubscribed}\n onSecondaryAction={chooseNotSubscribed}\n primaryText={copy.subscribed_answer}\n secondaryText={copy.not_subscribed_answer}\n // Full-bleed wash between title and actions.\n sx={SUBSCRIPTION_DIALOG_SX}\n >\n {typeof title === 'string' && title && (\n <TransactionListCard\n background={WARNING_WASH_GRADIENT}\n elevated={true}\n rows={[\n {\n amount: typeof amount === 'number' ? formatCurrency(amount, '0,0.00') : '',\n amountCaption: subscriptionFrequency(recurring, repeatingTransactionOf(ctx)),\n leading: logo ? <LogoFromGuid logo={logo} size={ROW_LOGO_SIZE} /> : undefined,\n subtitle: slot<string>(row, 'secondary_text') ?? '',\n title,\n },\n ]}\n />\n )}\n </Dialog>\n\n <Dialog\n copy={{ title: copy.title, close_aria: copy.close_aria }}\n fullWidth={true}\n isOpen={phase === 'reasons'}\n onClose={finish}\n showActions={false}\n // Space under the list.\n sx={{ ...SUBSCRIPTION_DIALOG_SX, '& .MuiDialog-paper': { ...DIALOG_PAPER_SX, pb: 16 } }}\n >\n <Stack>\n {reasons.map(({ label, userResponse }, index) => (\n <Stack key={userResponse}>\n <ButtonBase\n onClick={() => void save(userResponse)}\n sx={{\n gap: 12,\n justifyContent: 'space-between',\n minHeight: 44,\n px: 24,\n py: 8,\n textAlign: 'left',\n width: '100%',\n }}\n >\n <Text variant=\"body1\">{label}</Text>\n <Icon\n aria-hidden={true}\n name=\"chevron_right\"\n size={24}\n sx={{ color: 'action.active' }}\n />\n </ButtonBase>\n {/* Between rows only, drawn over the row edge (as Figma) so rows stay 44px apart. */}\n {index < reasons.length - 1 && <Divider sx={{ ml: 24, mt: '-1px' }} />}\n </Stack>\n ))}\n </Stack>\n </Dialog>\n\n {notice && (\n <StatusSnackbar\n actionText={notice.retry ? copy.try_again : undefined}\n closeAriaLabel={copy.toast_close_aria}\n message={notice.severity === 'success' ? copy.success_message : copy.error_message}\n onActionClick={notice.retry ? () => void save(notice.retry as string) : undefined}\n onClose={finish}\n open={true}\n severity={notice.severity}\n variant=\"strong\"\n />\n )}\n </>\n )\n})\n\nexport default SubscriptionStatusModalBlock\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8BA,IAAM,KAAgB,IAGhB,IAAkB;AAAA,EACtB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,WAAW,EAAiB,EAAA;AAC9B,GACM,IAAyB;AAAA,EAC7B,sBAAsB;AAAA,EACtB,4BAA4B,EAAE,GAAG,EAAE;AAAA,EACnC,4CAA4C;AAAA,IAAE,IAAI;AAAA,IAAI,IAAI;AAAA,EAAG;AAC/D,GASa,KAA+B,EAAS,SAAsC,EACzF,MAAA,EAAA,GACmB;AACnB,QAAM,IAAS,EAAe,GACxB,EAAE,eAAA,GAAe,WAAA,EAAA,IAAc,EAAm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