@mx-cartographer/experiences 9.7.69 → 9.7.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- 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/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/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 +59 -52
- package/dist/insights-v2/components/BaseLayout.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/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,11 @@
|
|
|
1
|
+
## [9.7.71] - 10-30-2026
|
|
2
|
+
|
|
3
|
+
- **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)
|
|
4
|
+
|
|
5
|
+
## [9.7.70] - 10-30-2026
|
|
6
|
+
|
|
7
|
+
- **CHANGED** - goals mini widget naming to match its design (MEW-4114)
|
|
8
|
+
|
|
1
9
|
## [9.7.69] - 10-30-2026
|
|
2
10
|
|
|
3
11
|
- **FIXED** - The embedded insight card's call-to-action label now matches Figma's size and weight (WEC-2157)
|
|
@@ -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,GAAG,KAAK,gBAAgB,IAAA,CAAK,OAAgB;AAAA,MAC3C,GAAG;AAAA,MACH,QAAQ,EAAK;AAAA,MACb,MAAM,EAAU;AAAA,MAChB,YAAY,EAAU;AAAA,MACtB,0BACE,EAAK,kBAAkB,IACnB,EAA2B,EAAK,gBAAgB,CAAY,IAC5D;AAAA,IACR,EAAE,CACJ;AAAA,EACF;AAAA,EAEA,IAAI,eAAuB;AACzB,WAAO,KAAK,SAAS,MAAM,EAAE,KAAA,CAAM,GAAG,MAAM,EAAE,WAAW,EAAE,QAAQ;AAAA,EACrE;AAA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AS,EAAK,QACnC,KAAK,gBAAgB,CAAW;AAAA,MAEpC,CAAC;AAAA,IACH,SAAS,GAAO;AACd,WAAK,aAAa,cAAc,CAAK;AAAA,IACvC;AAAA,EACF;AAAA,EAEA,uBAAuB,OAAO,MAAe;AAC3C,QAAI;AACF,YAAM,IAAwB,MAAM,KAAK,IAAI,qBAAqB;AAAA,QAChE,GAAG;AAAA,QACH,eAAe,EAAK;AAAA,MACtB,CAAC;AAED,MAAA,EAAA,MAAkB;AAChB,cAAM,IAAQ,KAAK,gBAAgB,UAAA,CAAW,MAAM,EAAE,SAAS,EAAK,IAAI;AACxE,QAAI,KAAS,MACX,KAAK,gBAAgB,CAAA,IAAS,IAG5B,KAAK,cAAc,SAAS,EAAK,QACnC,KAAK,gBAAgB,KAAK,SAAS,KAAA,CAAM,MAAM,EAAE,SAAS,EAAK,IAAI,CAAC;AAAA,MAExE,CAAC;AAAA,IACH,SAAS,GAAO;AACd,WAAK,aAAa,wBAAwB,CAAK;AAAA,IACjD;AAAA,EACF;AAAA,EAEA,+BAA+B,OAAO,MAAoC;AACxE,QAAI;AACF,YAAM,IAAiB,MAAM,KAAK,IAAI,6BAA6B,CAAO;AAC1E,WAAK,0BAA0B,CAAc;AAAA,IAC/C,SAAS,GAAO;AACd,WAAK,aAAa,gCAAgC,CAAK;AAAA,IACzD;AAAA,EACF;AAAA,EAEA,eAAA,CAAwB,GAAgB,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;AAAA,MAC3C,GAAG;AAAA,MACH,QAAQ,EAAK;AAAA,MACb,MAAM,EAAU;AAAA,MAChB,YAAY,EAAU;AAAA,MACtB,0BACE,EAAK,kBAAkB,IACnB,EAA2B,EAAK,gBAAgB,CAAY,IAC5D;AAAA,IACR,EAAE,CACJ;AAAA,EACF;AAAA,EAEA,IAAI,eAAuB;AACzB,WAAO,KAAK,SAAS,MAAM,EAAE,KAAA,CAAM,GAAG,MAAM,EAAE,WAAW,EAAE,QAAQ;AAAA,EACrE;AAAA,EAEA,IAAI,YAAY;AACd,WAAO,KAAK,aAAa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MAEpC,CAAC;AAAA,IACH,SAAS,GAAO;AACd,WAAK,aAAa,cAAc,CAAK;AAAA,IACvC;AAAA,EACF;AAAA,EAEA,uBAAuB,OAAO,MAAe;AAC3C,QAAI;AACF,YAAM,IAAwB,MAAM,KAAK,IAAI,qBAAqB;AAAA,QAChE,GAAG;AAAA,QACH,eAAe,EAAK;AAAA,MACtB,CAAC;AAED,MAAA,EAAA,MAAkB;AAChB,cAAM,IAAQ,KAAK,gBAAgB,UAAA,CAAW,MAAM,EAAE,SAAS,EAAK,IAAI;AACxE,QAAI,KAAS,MACX,KAAK,gBAAgB,CAAA,IAAS,IAG5B,KAAK,cAAc,SAAS,EAAK,QACnC,KAAK,gBAAgB,KAAK,SAAS,KAAA,CAAM,MAAM,EAAE,SAAS,EAAK,IAAI,CAAC;AAAA,MAExE,CAAC;AAAA,IACH,SAAS,GAAO;AACd,WAAK,aAAa,wBAAwB,CAAK;AAAA,IACjD;AAAA,EACF;AAAA,EAEA,+BAA+B,OAAO,MAAoC;AACxE,QAAI;AACF,YAAM,IAAiB,MAAM,KAAK,IAAI,6BAA6B,CAAO;AAC1E,WAAK,0BAA0B,CAAc;AAAA,IAC/C,SAAS,GAAO;AACd,WAAK,aAAa,gCAAgC,CAAK;AAAA,IACzD;AAAA,EACF;AAAA,EAEA,eAAA,CAAwB,GAAgB,MACtC,KAAK,YAAY,iBAAiB,GAAO;AAAA,IAAE,OAAO;AAAA,IAAa,QAAA;AAAA,EAAO,CAAC;AAC3E"}
|
|
@@ -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,EAAA,IAAa,EAAgB,GACtF,EAAE,SAAA,EAAA,IAAY,EAAS,GACvB,EAAE,OAAO,EAAA,IAAS,EAAmB,GACrC,EAAE,eAAA,EAAA,IAAkB,EAAiB,GACrC,EAAE,2BAA2B,GAAO,qBAAA,GAAqB,cAAA,EAAA,IAAiB,EAAa;AAE7F,EAAA,EAAmB;AAAA,IAEj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+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
|
};
|
|
@@ -3,7 +3,7 @@ import r from "@mui/material/Stack";
|
|
|
3
3
|
import { Text as d } from "@mxenabled/mxui";
|
|
4
4
|
import { jsx as t, jsxs as e } from "react/jsx-runtime";
|
|
5
5
|
import i from "@mui/material/Box";
|
|
6
|
-
var v = ({ backdrop: n, backgroundImage: o, bgcolor: s = "primary.lighter", logo: p, name:
|
|
6
|
+
var v = ({ backdrop: n, backgroundImage: o, bgcolor: s = "primary.lighter", logo: p, name: x, nameVariant: c = "body2", status: a, subtitle: l, sx: h }) => /* @__PURE__ */ e(i, {
|
|
7
7
|
sx: {
|
|
8
8
|
alignItems: "center",
|
|
9
9
|
bgcolor: s,
|
|
@@ -62,10 +62,12 @@ var v = ({ backdrop: n, backgroundImage: o, bgcolor: s = "primary.lighter", logo
|
|
|
62
62
|
width: "100%"
|
|
63
63
|
},
|
|
64
64
|
children: [/* @__PURE__ */ t(d, {
|
|
65
|
-
sx: {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
sx: {
|
|
66
|
+
fontWeight: 600,
|
|
67
|
+
textAlign: "center"
|
|
68
|
+
},
|
|
69
|
+
variant: c,
|
|
70
|
+
children: x
|
|
69
71
|
}), l && /* @__PURE__ */ t(d, {
|
|
70
72
|
color: "text.secondary",
|
|
71
73
|
truncate: !0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountHeroCard.es.js","names":[],"sources":["../../../src/insights-v2/components/AccountHeroCard.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { getLogoElevation } from './logoShadow'\n\n// Figma: the logo overhangs the white card's top edge by 25px and the slot pads\n// 16px above that overhang (so `pt = overhang + 16`).\nconst LOGO_OVERHANG = 25\n\ninterface AccountHeroCardProps {\n /** Central account/institution logo, rendered overhanging the card's top edge. */\n logo: ReactNode\n /** Primary line, e.g. \"Epic Bank Checking, *1234\". */\n name: ReactNode\n /** Optional secondary line beneath the name, e.g. \"Checking Account\". */\n subtitle?: ReactNode\n /**\n * Name typography. Figma: Set Up/Switch Direct Deposit use body2 metrics\n * (13px / lh 16, default); Missing Interest Rate uses body1 (15px / lh 20).\n * Both render at weight 600.\n */\n nameVariant?: 'body1' | 'body2'\n /** Status element beneath the text (e.g. a `<StatusPill>`). */\n status?: ReactNode\n /** Decorative backdrop behind the card (e.g. a `<Confetti>` burst). */\n backdrop?: ReactNode\n /** Slot surface color token. Default `primary.lighter` (Figma's tinted slot,\n * theme-aware: light-blue in light mode, navy in dark). */\n bgcolor?: string\n /**\n * Optional decorative wash layered over `bgcolor` (e.g. a celebration\n * gradient). Figma's gradient is ~20% opacity over a white base, so this is a\n * `backgroundImage` on top of `bgcolor`, not a replacement — pass\n * `bgcolor=\"background.paper\"` with it for the complete state.\n */\n backgroundImage?: string\n sx?: SxProps\n}\n\n/**\n * A centered account hero: an overhanging institution logo above a white card\n * with a name, optional subtitle, and a status slot, over a tinted (or\n * gradient + confetti) slot.\n *\n * Figma: Set Up Direct Deposit (default + complete) and Switch Direct Deposit\n * (complete) Content. Scope is the Content section only.\n */\nconst AccountHeroCard = ({\n backdrop,\n backgroundImage,\n bgcolor = 'primary.lighter',\n logo,\n name,\n nameVariant = 'body2',\n status,\n subtitle,\n sx,\n}: AccountHeroCardProps) => (\n <Box\n sx={{\n alignItems: 'center',\n bgcolor,\n ...(backgroundImage && { backgroundImage }),\n display: 'flex',\n flexDirection: 'column',\n pb: 16,\n position: 'relative',\n pt: LOGO_OVERHANG + 16,\n px: 16,\n width: '100%',\n ...sx,\n }}\n >\n {backdrop && (\n <Box aria-hidden={true} sx={{ inset: 0, position: 'absolute', zIndex: 0 }}>\n {backdrop}\n </Box>\n )}\n <Stack\n sx={{\n alignItems: 'center',\n // Theme-aware card surface (white in light, dark surface in dark) — not\n // `common.white`, which stays white and breaks dark mode.\n bgcolor: 'background.paper',\n borderRadius: '8px',\n // Figma: soft card drop-shadow (0 2px 8px rgba(0,0,0,0.12)).\n boxShadow: getLogoElevation,\n gap: 16,\n pb: 16,\n position: 'relative',\n pt: 36,\n px: 16,\n width: '100%',\n zIndex: 1,\n }}\n >\n <Box\n sx={{\n display: 'flex',\n left: '50%',\n position: 'absolute',\n top: -LOGO_OVERHANG,\n transform: 'translateX(-50%)',\n }}\n >\n {logo}\n </Box>\n <Stack sx={{ alignItems: 'center', gap: 12, minWidth: 0, width: '100%' }}>\n <Stack sx={{ alignItems: 'center', minWidth: 0, width: '100%' }}>\n {/* Figma name style: body2 (13/16) or body1 (15/20) metrics at weight\n 600. MXUI `bold` renders 700, so set fontWeight explicitly. */}\n <Text sx={{ fontWeight: 600 }}
|
|
1
|
+
{"version":3,"file":"AccountHeroCard.es.js","names":[],"sources":["../../../src/insights-v2/components/AccountHeroCard.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { getLogoElevation } from './logoShadow'\n\n// Figma: the logo overhangs the white card's top edge by 25px and the slot pads\n// 16px above that overhang (so `pt = overhang + 16`).\nconst LOGO_OVERHANG = 25\n\ninterface AccountHeroCardProps {\n /** Central account/institution logo, rendered overhanging the card's top edge. */\n logo: ReactNode\n /** Primary line, e.g. \"Epic Bank Checking, *1234\". */\n name: ReactNode\n /** Optional secondary line beneath the name, e.g. \"Checking Account\". */\n subtitle?: ReactNode\n /**\n * Name typography. Figma: Set Up/Switch Direct Deposit use body2 metrics\n * (13px / lh 16, default); Missing Interest Rate uses body1 (15px / lh 20).\n * Both render at weight 600.\n */\n nameVariant?: 'body1' | 'body2'\n /** Status element beneath the text (e.g. a `<StatusPill>`). */\n status?: ReactNode\n /** Decorative backdrop behind the card (e.g. a `<Confetti>` burst). */\n backdrop?: ReactNode\n /** Slot surface color token. Default `primary.lighter` (Figma's tinted slot,\n * theme-aware: light-blue in light mode, navy in dark). */\n bgcolor?: string\n /**\n * Optional decorative wash layered over `bgcolor` (e.g. a celebration\n * gradient). Figma's gradient is ~20% opacity over a white base, so this is a\n * `backgroundImage` on top of `bgcolor`, not a replacement — pass\n * `bgcolor=\"background.paper\"` with it for the complete state.\n */\n backgroundImage?: string\n sx?: SxProps\n}\n\n/**\n * A centered account hero: an overhanging institution logo above a white card\n * with a name, optional subtitle, and a status slot, over a tinted (or\n * gradient + confetti) slot.\n *\n * Figma: Set Up Direct Deposit (default + complete) and Switch Direct Deposit\n * (complete) Content. Scope is the Content section only.\n */\nconst AccountHeroCard = ({\n backdrop,\n backgroundImage,\n bgcolor = 'primary.lighter',\n logo,\n name,\n nameVariant = 'body2',\n status,\n subtitle,\n sx,\n}: AccountHeroCardProps) => (\n <Box\n sx={{\n alignItems: 'center',\n bgcolor,\n ...(backgroundImage && { backgroundImage }),\n display: 'flex',\n flexDirection: 'column',\n pb: 16,\n position: 'relative',\n pt: LOGO_OVERHANG + 16,\n px: 16,\n width: '100%',\n ...sx,\n }}\n >\n {backdrop && (\n <Box aria-hidden={true} sx={{ inset: 0, position: 'absolute', zIndex: 0 }}>\n {backdrop}\n </Box>\n )}\n <Stack\n sx={{\n alignItems: 'center',\n // Theme-aware card surface (white in light, dark surface in dark) — not\n // `common.white`, which stays white and breaks dark mode.\n bgcolor: 'background.paper',\n borderRadius: '8px',\n // Figma: soft card drop-shadow (0 2px 8px rgba(0,0,0,0.12)).\n boxShadow: getLogoElevation,\n gap: 16,\n pb: 16,\n position: 'relative',\n pt: 36,\n px: 16,\n width: '100%',\n zIndex: 1,\n }}\n >\n <Box\n sx={{\n display: 'flex',\n left: '50%',\n position: 'absolute',\n top: -LOGO_OVERHANG,\n transform: 'translateX(-50%)',\n }}\n >\n {logo}\n </Box>\n <Stack sx={{ alignItems: 'center', gap: 12, minWidth: 0, width: '100%' }}>\n <Stack sx={{ alignItems: 'center', minWidth: 0, width: '100%' }}>\n {/* Figma name style: body2 (13/16) or body1 (15/20) metrics at weight\n 600. MXUI `bold` renders 700, so set fontWeight explicitly. A long name\n wraps, centred, across the card's width. */}\n <Text sx={{ fontWeight: 600, textAlign: 'center' }} variant={nameVariant}>\n {name}\n </Text>\n {subtitle && (\n <Text color=\"text.secondary\" truncate={true} variant=\"caption\">\n {subtitle}\n </Text>\n )}\n </Stack>\n {/* Center the status regardless of its own alignment (StatusPill\n defaults to `alignSelf: flex-start` for left-aligned contexts). */}\n {status && (\n <Box sx={{ display: 'flex', justifyContent: 'center', width: '100%' }}>{status}</Box>\n )}\n </Stack>\n </Stack>\n </Box>\n)\n\nexport default AccountHeroCard\n"],"mappings":";;;;;AAoDA,IAAM,IAAA,CAAmB,EACvB,UAAA,GACA,iBAAA,GACA,SAAA,IAAU,mBACV,MAAA,GACA,MAAA,GACA,aAAA,IAAc,SACd,QAAA,GACA,UAAA,GACA,IAAA,EAAA,MAEA,gBAAA,EAAC,GAAD;AAAA,EACE,IAAI;AAAA,IACF,YAAY;AAAA,IACZ,SAAA;AAAA,IACA,GAAI,KAAmB,EAAE,iBAAA,EAAgB;AAAA,IACzC,SAAS;AAAA,IACT,eAAe;AAAA,IACf,IAAI;AAAA,IACJ,UAAU;AAAA,IACV,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,GAAG;AAAA,EACL;AAAA,EAbF,UAAA,CAeG,KACC,gBAAA,EAAC,GAAD;AAAA,IAAK,eAAa;AAAA,IAAM,IAAI;AAAA,MAAE,OAAO;AAAA,MAAG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EjF;AAAA,IACF,CAAA,CAAA;AAAA,EACJ,CAAA,CAAA"}
|
|
@@ -3,9 +3,9 @@ import { sendClientConfiguredCta as J } from "../../common/utils/PostMessage.es.
|
|
|
3
3
|
import { BeatActionsProvider as Q } from "../beatActions.es.js";
|
|
4
4
|
import { isContactSupportCtaDisabled as Z } from "../actionBlocks/ContactSupportActionBlock.es.js";
|
|
5
5
|
import { reportCtaClick as oo } from "../ctaActions/runCtaAction.es.js";
|
|
6
|
-
import { useBeatCtaActions as
|
|
6
|
+
import { useBeatCtaActions as to } from "../ctaActions/useCtaAction.es.js";
|
|
7
7
|
import { actionBlocksKey as io } from "../mappings/actionBlocksKey.es.js";
|
|
8
|
-
import { logoFromRef as
|
|
8
|
+
import { logoFromRef as eo } from "./shared/EntityLogo.es.js";
|
|
9
9
|
import { CtaStatus as ro } from "./CtaStatus.es.js";
|
|
10
10
|
import no from "./FeedbackDialog.es.js";
|
|
11
11
|
import { ErrorCard as so } from "./ErrorCard.es.js";
|
|
@@ -16,16 +16,16 @@ import mo from "./Header.es.js";
|
|
|
16
16
|
import { FeedbackBar as po } from "./FeedbackBar.es.js";
|
|
17
17
|
import { DismissInsightDialog as uo } from "./DismissInsightDialog.es.js";
|
|
18
18
|
import { HiddenConfirmationCard as fo } from "./HiddenConfirmationCard.es.js";
|
|
19
|
-
import { LoadingCard as
|
|
20
|
-
import { ObsolesceBanner as
|
|
19
|
+
import { LoadingCard as Co } from "./LoadingCard.es.js";
|
|
20
|
+
import { ObsolesceBanner as bo } from "./ObsolesceBanner.es.js";
|
|
21
21
|
import { useBeatFeedbackFlow as ho } from "../hooks/useBeatFeedbackFlow.es.js";
|
|
22
22
|
import { useMemo as go } from "react";
|
|
23
23
|
import { observer as yo } from "mobx-react-lite";
|
|
24
24
|
import x from "@mui/material/Stack";
|
|
25
25
|
import { P as _o } from "@mxenabled/mxui";
|
|
26
26
|
import p from "@mui/material/Button";
|
|
27
|
-
import { ChevronRight as
|
|
28
|
-
import { Fragment as ko, jsx as
|
|
27
|
+
import { ChevronRight as T } from "@mxenabled/mx-icons";
|
|
28
|
+
import { Fragment as ko, jsx as t, jsxs as u } from "react/jsx-runtime";
|
|
29
29
|
import xo from "@mui/material/Box";
|
|
30
30
|
import vo from "@mui/material/Card";
|
|
31
31
|
var So = {}, wo = {
|
|
@@ -41,27 +41,34 @@ var So = {}, wo = {
|
|
|
41
41
|
alignItems: "center",
|
|
42
42
|
alignSelf: "flex-start",
|
|
43
43
|
display: "flex",
|
|
44
|
+
fontSize: 13,
|
|
44
45
|
fontWeight: 600,
|
|
45
|
-
height:
|
|
46
|
-
|
|
46
|
+
height: "auto",
|
|
47
|
+
justifyContent: "flex-start",
|
|
48
|
+
lineHeight: "16px",
|
|
49
|
+
minHeight: 24,
|
|
50
|
+
minWidth: 0,
|
|
51
|
+
px: 0,
|
|
52
|
+
py: 4,
|
|
53
|
+
textAlign: "left",
|
|
47
54
|
textTransform: "none"
|
|
48
|
-
},
|
|
55
|
+
}, Ao = {
|
|
49
56
|
color: "text.secondary",
|
|
50
57
|
fontSize: 13,
|
|
51
58
|
fontWeight: 600,
|
|
52
59
|
lineHeight: "16px",
|
|
53
60
|
"&.Mui-disabled": { color: "text.disabled" }
|
|
54
|
-
},
|
|
55
|
-
const F = Y(), R = q(), { config: E } = K(), o = ho(i, l), v = $(), { runCta:
|
|
61
|
+
}, rt = yo(({ beat: i, beatActions: l = So, obsolete: b, isLoading: O = !1, isError: I = !1 }) => {
|
|
62
|
+
const F = Y(), R = q(), { config: E } = K(), o = ho(i, l), v = $(), { runCta: H, primary: h, secondary: S } = to(i, l, i.insights_payload?.primary_cta, i.insights_payload?.secondary_cta), f = i.insights_payload?.widget_type === "mini", M = go(() => ({
|
|
56
63
|
...o.wrappedActions,
|
|
57
64
|
beat: i
|
|
58
65
|
}), [o.wrappedActions, i]);
|
|
59
|
-
if (I) return /* @__PURE__ */
|
|
60
|
-
const
|
|
61
|
-
if (!
|
|
62
|
-
const { instance_slot:
|
|
63
|
-
logo:
|
|
64
|
-
text:
|
|
66
|
+
if (I) return /* @__PURE__ */ t(so, {});
|
|
67
|
+
const e = i.insights_payload;
|
|
68
|
+
if (!e || o.cardState === "dismissed") return null;
|
|
69
|
+
const { instance_slot: N, primary_cta: n, secondary_cta: s, sub_title: W, title: P, guid: w, dismissed_at: z } = e, { block: G } = N, V = W ?? (e.subtitle ? {
|
|
70
|
+
logo: eo(e.logo),
|
|
71
|
+
text: e.subtitle
|
|
65
72
|
} : void 0), c = (a) => Z(a, E, l.onContactSupport), D = async (a, m) => {
|
|
66
73
|
if (!c(m.block)) {
|
|
67
74
|
if (m.block === io.CONTACT_SUPPORT_ACTION_BLOCK) {
|
|
@@ -73,27 +80,27 @@ var So = {}, wo = {
|
|
|
73
80
|
}), l.onContactSupport?.();
|
|
74
81
|
return;
|
|
75
82
|
}
|
|
76
|
-
await
|
|
83
|
+
await H(a, m);
|
|
77
84
|
}
|
|
78
|
-
},
|
|
85
|
+
}, A = ao[G], d = e.in_description_cta, g = !f && d?.label && d.block ? d : void 0, y = n?.label || (g ? void 0 : d?.label) || void 0, C = !f && !!n?.label, B = i.in_description_cta || i.html_in_description_cta, j = () => {
|
|
79
86
|
const { is_mobile_webview: a, clientConfig: m } = v.appDataStore.appConfig;
|
|
80
87
|
J(i.template, {
|
|
81
88
|
isMobileWebview: a,
|
|
82
89
|
webviewScheme: m?.master?.ui_message_webview_url_scheme,
|
|
83
|
-
userGuid:
|
|
90
|
+
userGuid: e.user_guid ?? i.user_guid
|
|
84
91
|
});
|
|
85
|
-
}, r =
|
|
86
|
-
return /* @__PURE__ */
|
|
87
|
-
value:
|
|
92
|
+
}, r = C ? h.presentation : void 0, U = r?.kind === "hidden" && !!r.hideAll, L = !f && !!s?.label && !U, X = !!y && r?.kind !== "hidden" || L, _ = F.insights_feed?.general, k = b?.state === "not_refreshable" && !z && !!_;
|
|
93
|
+
return /* @__PURE__ */ t(Q, {
|
|
94
|
+
value: M,
|
|
88
95
|
children: /* @__PURE__ */ u(x, {
|
|
89
96
|
sx: { mb: 16 },
|
|
90
97
|
children: [
|
|
91
|
-
o.cardState === "confirming" ? /* @__PURE__ */
|
|
98
|
+
o.cardState === "confirming" ? /* @__PURE__ */ t(fo, {
|
|
92
99
|
onClose: o.collapseConfirmation,
|
|
93
100
|
onLeaveFeedback: o.openHideSurvey,
|
|
94
101
|
onUndo: o.undoDismiss
|
|
95
|
-
}) : /* @__PURE__ */ u(ko, { children: [
|
|
96
|
-
...
|
|
102
|
+
}) : /* @__PURE__ */ u(ko, { children: [b && _ && /* @__PURE__ */ t(bo, {
|
|
103
|
+
...b,
|
|
97
104
|
copy: _
|
|
98
105
|
}), /* @__PURE__ */ u(vo, {
|
|
99
106
|
inert: k,
|
|
@@ -103,15 +110,15 @@ var So = {}, wo = {
|
|
|
103
110
|
pointerEvents: "none"
|
|
104
111
|
} },
|
|
105
112
|
children: [
|
|
106
|
-
k && /* @__PURE__ */
|
|
107
|
-
/* @__PURE__ */
|
|
113
|
+
k && /* @__PURE__ */ t(xo, { sx: wo }),
|
|
114
|
+
/* @__PURE__ */ t(mo, {
|
|
108
115
|
isMini: f,
|
|
109
|
-
subtitle:
|
|
110
|
-
title:
|
|
116
|
+
subtitle: V,
|
|
117
|
+
title: P ?? ""
|
|
111
118
|
}),
|
|
112
|
-
O ? /* @__PURE__ */
|
|
119
|
+
O ? /* @__PURE__ */ t(Co, {}) : A && /* @__PURE__ */ t(A, {
|
|
113
120
|
beatGuid: w,
|
|
114
|
-
payload:
|
|
121
|
+
payload: e
|
|
115
122
|
}),
|
|
116
123
|
/* @__PURE__ */ u(x, {
|
|
117
124
|
sx: {
|
|
@@ -121,13 +128,13 @@ var So = {}, wo = {
|
|
|
121
128
|
px: 16
|
|
122
129
|
},
|
|
123
130
|
children: [
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
dangerouslySetInnerHTML: { __html:
|
|
131
|
+
/* @__PURE__ */ t(_o, {
|
|
132
|
+
dangerouslySetInnerHTML: { __html: e.description.html_text },
|
|
126
133
|
sx: { fontWeight: "fontWeightRegular" },
|
|
127
134
|
variant: "subtitle2"
|
|
128
135
|
}),
|
|
129
|
-
g && /* @__PURE__ */
|
|
130
|
-
endIcon: /* @__PURE__ */
|
|
136
|
+
g && /* @__PURE__ */ t(p, {
|
|
137
|
+
endIcon: /* @__PURE__ */ t(T, {}),
|
|
131
138
|
onClick: () => R.openActionDrawer({
|
|
132
139
|
guid: w,
|
|
133
140
|
trigger: "inDescriptionCta"
|
|
@@ -139,37 +146,37 @@ var So = {}, wo = {
|
|
|
139
146
|
},
|
|
140
147
|
children: g.label
|
|
141
148
|
}),
|
|
142
|
-
!d?.label &&
|
|
143
|
-
endIcon: /* @__PURE__ */
|
|
144
|
-
onClick:
|
|
149
|
+
!d?.label && B && /* @__PURE__ */ t(p, {
|
|
150
|
+
endIcon: /* @__PURE__ */ t(T, {}),
|
|
151
|
+
onClick: j,
|
|
145
152
|
sx: {
|
|
146
153
|
height: 24,
|
|
147
154
|
p: 4,
|
|
148
155
|
width: "max-content"
|
|
149
156
|
},
|
|
150
|
-
children:
|
|
157
|
+
children: B
|
|
151
158
|
})
|
|
152
159
|
]
|
|
153
160
|
}),
|
|
154
|
-
|
|
161
|
+
X && /* @__PURE__ */ u(x, {
|
|
155
162
|
sx: {
|
|
156
163
|
gap: 8,
|
|
157
164
|
pb: 16,
|
|
158
165
|
px: 16
|
|
159
166
|
},
|
|
160
167
|
children: [
|
|
161
|
-
y && !
|
|
168
|
+
y && !C && /* @__PURE__ */ t(p, {
|
|
162
169
|
sx: Do,
|
|
163
170
|
variant: "text",
|
|
164
171
|
children: y
|
|
165
172
|
}),
|
|
166
|
-
|
|
173
|
+
C && n && r?.kind === "status" && /* @__PURE__ */ t(ro, {
|
|
167
174
|
action: r.action,
|
|
168
175
|
icon: r.icon,
|
|
169
176
|
label: r.label,
|
|
170
177
|
tone: r.tone
|
|
171
178
|
}),
|
|
172
|
-
|
|
179
|
+
C && n && !r && /* @__PURE__ */ t(p, {
|
|
173
180
|
"aria-disabled": c(n.block) || h.disabled,
|
|
174
181
|
disabled: h.disabled,
|
|
175
182
|
onClick: () => D("primary", n),
|
|
@@ -177,32 +184,32 @@ var So = {}, wo = {
|
|
|
177
184
|
variant: "outlined",
|
|
178
185
|
children: n.label
|
|
179
186
|
}),
|
|
180
|
-
|
|
187
|
+
L && s && /* @__PURE__ */ t(p, {
|
|
181
188
|
"aria-disabled": c(s.block) || S.disabled,
|
|
182
189
|
color: "inherit",
|
|
183
190
|
disabled: S.disabled,
|
|
184
191
|
onClick: () => D("secondary", s),
|
|
185
192
|
sx: {
|
|
186
|
-
...
|
|
193
|
+
...Ao,
|
|
187
194
|
...c(s.block) && { color: "text.disabled" }
|
|
188
195
|
},
|
|
189
196
|
children: s.label
|
|
190
197
|
})
|
|
191
198
|
]
|
|
192
199
|
}),
|
|
193
|
-
/* @__PURE__ */
|
|
200
|
+
/* @__PURE__ */ t(po, {
|
|
194
201
|
onTellUsMore: o.openRatingSurvey,
|
|
195
202
|
show: o.isFeedbackBarShown
|
|
196
203
|
})
|
|
197
204
|
]
|
|
198
205
|
})] }),
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
-
/* @__PURE__ */
|
|
206
|
+
/* @__PURE__ */ t(lo, { beat: i }),
|
|
207
|
+
/* @__PURE__ */ t(uo, {
|
|
201
208
|
isOpen: o.isDismissOpen,
|
|
202
209
|
onClose: o.closeDismissDialog,
|
|
203
210
|
onDismiss: o.confirmDismiss
|
|
204
211
|
}),
|
|
205
|
-
o.isSurveyOpen && /* @__PURE__ */
|
|
212
|
+
o.isSurveyOpen && /* @__PURE__ */ t(no, {
|
|
206
213
|
characterLimitLabel: o.survey.characterLimitLabel,
|
|
207
214
|
closeAriaLabel: o.survey.closeAriaLabel,
|
|
208
215
|
isOpen: !0,
|
|
@@ -215,13 +222,13 @@ var So = {}, wo = {
|
|
|
215
222
|
secondaryText: o.survey.backText,
|
|
216
223
|
title: o.survey.title
|
|
217
224
|
}),
|
|
218
|
-
o.cardState === "visible" &&
|
|
225
|
+
o.cardState === "visible" && e.footer && /* @__PURE__ */ t(co, { footer: e.footer })
|
|
219
226
|
]
|
|
220
227
|
})
|
|
221
228
|
});
|
|
222
229
|
});
|
|
223
230
|
export {
|
|
224
|
-
|
|
231
|
+
rt as default
|
|
225
232
|
};
|
|
226
233
|
|
|
227
234
|
//# sourceMappingURL=BaseLayout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseLayout.es.js","names":[],"sources":["../../../src/insights-v2/components/BaseLayout.tsx"],"sourcesContent":["import { useMemo } from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport Stack from '@mui/material/Stack'\n\nimport { ChevronRight } from '@mxenabled/mx-icons'\nimport { P } from '@mxenabled/mxui'\n\nimport { blocks } from '../mappings/blocks'\nimport { actionBlocksKey } from '../mappings/actionBlocksKey'\nimport { isContactSupportCtaDisabled } from '../actionBlocks/ContactSupportActionBlock'\nimport { logoFromRef } from './shared/EntityLogo'\n\nimport Footer from './Footer'\nimport Header from './Header'\nimport FeedbackBar from './FeedbackBar'\nimport FeedbackDialog from './FeedbackDialog'\nimport DismissInsightDialog from './DismissInsightDialog'\nimport HiddenConfirmationCard from './HiddenConfirmationCard'\nimport ErrorCard from './ErrorCard'\nimport LoadingCard from './LoadingCard'\nimport { ObsolesceBanner, type ObsolesceBannerState } from './ObsolesceBanner'\nimport { useAppConfig, useGlobalCopyStore, useGlobalStore, useInsightsV2Store } from '../../common'\nimport { sendClientConfiguredCta } from '../../common/utils/PostMessage'\nimport type { Beat, PrimaryCTA, SecondaryCTA } from '../../core'\nimport { BeatActionsProvider, type BeatActions } from '../beatActions'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { reportCtaClick, useBeatCtaActions } from '../ctaActions'\nimport { CtaStatus } from './CtaStatus'\nimport { useBeatFeedbackFlow } from '../hooks/useBeatFeedbackFlow'\n\nexport interface ObsoleteState {\n state: ObsolesceBannerState\n onRefresh: () => void\n onDismiss: () => void\n}\n\ninterface BaseLayoutProps {\n beat: Beat\n beatActions?: BeatActions\n obsolete?: ObsoleteState\n /** Swap only the block slot for a LoadingCard (e.g. while a sampled beat loads). */\n isLoading?: boolean\n /** Replace the entire card with an ErrorCard (e.g. when the sample fails to load). */\n isError?: boolean\n}\n\nconst NO_BEAT_ACTIONS: BeatActions = {}\n\nconst OBSOLETE_OVERLAY_SX = {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n backgroundColor: 'background.default',\n opacity: 0.7,\n // Above every block's own z-index (hero card 1, AccountBlock 2), or that section shows through.\n zIndex: 3,\n} as const\n\n// Mini CTA label styled like a Button.\nconst MINI_CTA_SX = {\n alignItems: 'center',\n alignSelf: 'flex-start',\n display: 'flex',\n fontWeight: 600,\n height: 44,\n px: 2,\n textTransform: 'none',\n} as const\n\n// Full card's secondary CTA (e.g. Fee Detected's Contact Support): a quiet text button, 13/16\n// semibold in text.secondary. `color=\"inherit\"` keeps hover, ripple and focus off the primary palette.\n// An unavailable CTA (contact_support_block with no host handler) is dimmed at the call site, as the\n// primary CTA is, because it is only aria-disabled and so never matches `.Mui-disabled`.\nconst SECONDARY_CTA_SX = {\n color: 'text.secondary',\n fontSize: 13,\n fontWeight: 600,\n lineHeight: '16px',\n '&.Mui-disabled': { color: 'text.disabled' },\n} as const\n\nconst BaseLayout = observer(\n ({\n beat,\n beatActions = NO_BEAT_ACTIONS,\n obsolete,\n isLoading = false,\n isError = false,\n }: BaseLayoutProps) => {\n const copy = useGlobalCopyStore()\n const insightsV2Store = useInsightsV2Store()\n const { config } = useAppConfig()\n const flow = useBeatFeedbackFlow(beat, beatActions)\n\n const stores = useGlobalStore()\n const {\n runCta: handleCtaClick,\n primary: primaryCtaState,\n secondary: secondaryCtaState,\n } = useBeatCtaActions(\n beat,\n beatActions,\n beat.insights_payload?.primary_cta,\n beat.insights_payload?.secondary_cta,\n )\n\n // Guard: payload may not be loaded yet (isLoading/isError states).\n const isMini = beat.insights_payload?.widget_type === 'mini'\n\n // Memoized: an inline object here would change identity every render, making every\n // useAnalyticsEvent() consumer's callback (and its effect deps) unstable too.\n const beatActionsValue = useMemo(\n () => ({ ...flow.wrappedActions, beat }),\n [flow.wrappedActions, beat],\n )\n\n // Error replaces the entire card; loading only swaps the block slot (below).\n if (isError) return <ErrorCard />\n\n const insights_payload = beat.insights_payload\n\n if (!insights_payload) return null\n if (flow.cardState === 'dismissed') return null\n\n const { instance_slot, primary_cta, secondary_cta, sub_title, title, guid, dismissed_at } =\n insights_payload\n const { block } = instance_slot\n\n // Rebuild V1 subtitle shape; sub_title wins if present.\n const subtitle =\n sub_title ??\n (insights_payload.subtitle\n ? {\n logo: logoFromRef(insights_payload.logo),\n text: insights_payload.subtitle,\n }\n : undefined)\n\n // CTAs run via ctaActions; contact_support_block bypasses it.\n const isCtaDisabled = (ctaBlock: string | null | undefined) =>\n isContactSupportCtaDisabled(ctaBlock, config, beatActions.onContactSupport)\n\n const onCtaClick = async (slot: 'primary' | 'secondary', cta: PrimaryCTA | SecondaryCTA) => {\n if (isCtaDisabled(cta.block)) return\n\n if (cta.block === actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK) {\n // Bypasses the runner, but still reports the press like any other CTA: the generic\n // press event, and (on a first primary press) FIRST_TIME_PRIMARY_ACTION_SELECTED +\n // cta_clicked_at.\n reportCtaClick({ beat, stores, hostActions: beatActions, slot })\n beatActions.onContactSupport?.()\n return\n }\n\n await handleCtaClick(slot, cta)\n }\n\n const Block = blocks[block as keyof typeof blocks]\n\n const inDescriptionCta = insights_payload.in_description_cta\n // Full card: the envelope's link opens the drawer its block names. A link with no block (mini's\n // \"Make a Transfer\") is the card's action, drawn as the mini label below, never a dead link.\n const envelopeLink =\n !isMini && inDescriptionCta?.label && inDescriptionCta.block ? inDescriptionCta : undefined\n // The card's action label: the primary CTA's, else a block-less envelope link's (ditto ≥ 1.4.3\n // sends mini's action as in_description_cta). `||`, not `??`: the copy may send the primary label\n // as \"\" rather than omit it, and an empty string must fall through. It is a button only on a full\n // card with a primary CTA; otherwise a label, so a tap reaches the host's card handler.\n const ctaLabel =\n primary_cta?.label || (envelopeLink ? undefined : inDescriptionCta?.label) || undefined\n const isCtaButton = !isMini && !!primary_cta?.label\n const clientConfiguredLabel = beat.in_description_cta || beat.html_in_description_cta\n const onClientConfiguredLinkClick = () => {\n const { is_mobile_webview, clientConfig } = stores.appDataStore.appConfig\n\n sendClientConfiguredCta(beat.template, {\n isMobileWebview: is_mobile_webview,\n webviewScheme: clientConfig?.master?.ui_message_webview_url_scheme,\n userGuid: insights_payload.user_guid ?? beat.user_guid,\n })\n }\n // The primary step's presenter may draw a status or nothing instead of the button (full card only).\n const primaryPresentation = isCtaButton ? primaryCtaState.presentation : undefined\n const hidesAllCtas = primaryPresentation?.kind === 'hidden' && !!primaryPresentation.hideAll\n const showSecondaryCta = !isMini && !!secondary_cta?.label && !hidesAllCtas\n const showCtaRow = (!!ctaLabel && primaryPresentation?.kind !== 'hidden') || showSecondaryCta\n const obsoleteCopy = copy.insights_feed?.general\n const isObsoleteDimmed =\n obsolete?.state === 'not_refreshable' && !dismissed_at && !!obsoleteCopy\n\n return (\n <BeatActionsProvider value={beatActionsValue}>\n <Stack sx={{ mb: 16 }}>\n {flow.cardState === 'confirming' ? (\n <HiddenConfirmationCard\n onClose={flow.collapseConfirmation}\n onLeaveFeedback={flow.openHideSurvey}\n onUndo={flow.undoDismiss}\n />\n ) : (\n <>\n {obsolete && obsoleteCopy && <ObsolesceBanner {...obsolete} copy={obsoleteCopy} />}\n <Card\n inert={isObsoleteDimmed}\n sx={{\n ...(isObsoleteDimmed && {\n position: 'relative',\n zIndex: 2,\n pointerEvents: 'none',\n }),\n }}\n >\n {isObsoleteDimmed && <Box sx={OBSOLETE_OVERLAY_SX} />}\n <Header isMini={isMini} subtitle={subtitle} title={title ?? ''} />\n {isLoading ? (\n <LoadingCard />\n ) : (\n Block && <Block beatGuid={guid} payload={insights_payload} />\n )}\n\n <Stack sx={{ gap: 6, pb: 16, pt: 12, px: 16 }}>\n <P\n dangerouslySetInnerHTML={{\n __html: insights_payload.description.html_text,\n }}\n sx={{ fontWeight: 'fontWeightRegular' }}\n variant=\"subtitle2\"\n />\n {/* V2: the envelope's link opens the action block it names. */}\n {envelopeLink && (\n <Button\n endIcon={<ChevronRight />}\n onClick={() =>\n insightsV2Store.openActionDrawer({ guid, trigger: 'inDescriptionCta' })\n }\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {envelopeLink.label}\n </Button>\n )}\n {/* Custom-copy link when the envelope sends none; legacy mini shows it too, so no mini guard. */}\n {!inDescriptionCta?.label && clientConfiguredLabel && (\n <Button\n endIcon={<ChevronRight />}\n onClick={onClientConfiguredLinkClick}\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {clientConfiguredLabel}\n </Button>\n )}\n </Stack>\n\n {showCtaRow && (\n <Stack sx={{ gap: 8, pb: 16, px: 16 }}>\n {ctaLabel &&\n !isCtaButton && (\n // The card's action when it has no primary CTA button (mini always; a full card whose\n // only link names no block). What the tap does is the host's decision (Pulse posts\n // `carousel/cta`, the same redirect a V1 mini card sends), never the action drawer the\n // full card's CTA opens. It is a real (blue, focusable) button for that tap, but has no\n // handler of its own and does not stop the click, so it reaches the host's card handler\n // exactly as a tap on the card does.\n <Button sx={MINI_CTA_SX} variant=\"text\">\n {ctaLabel}\n </Button>\n )}\n {isCtaButton && primary_cta && primaryPresentation?.kind === 'status' && (\n <CtaStatus\n action={primaryPresentation.action}\n icon={primaryPresentation.icon}\n label={primaryPresentation.label}\n tone={primaryPresentation.tone}\n />\n )}\n {isCtaButton && primary_cta && !primaryPresentation && (\n <Button\n aria-disabled={isCtaDisabled(primary_cta.block) || primaryCtaState.disabled}\n disabled={primaryCtaState.disabled}\n onClick={() => onCtaClick('primary', primary_cta)}\n sx={{\n ...(isCtaDisabled(primary_cta.block) && { color: 'text.disabled' }),\n }}\n variant=\"outlined\"\n >\n {primary_cta.label}\n </Button>\n )}\n {/* Mini has room for one CTA. */}\n {showSecondaryCta && secondary_cta && (\n <Button\n aria-disabled={\n isCtaDisabled(secondary_cta.block) || secondaryCtaState.disabled\n }\n color=\"inherit\"\n disabled={secondaryCtaState.disabled}\n onClick={() => onCtaClick('secondary', secondary_cta)}\n sx={{\n ...SECONDARY_CTA_SX,\n ...(isCtaDisabled(secondary_cta.block) && { color: 'text.disabled' }),\n }}\n >\n {secondary_cta.label}\n </Button>\n )}\n </Stack>\n )}\n\n <FeedbackBar onTellUsMore={flow.openRatingSurvey} show={flow.isFeedbackBarShown} />\n </Card>\n </>\n )}\n\n <ActionBlockLayer beat={beat} />\n\n <DismissInsightDialog\n isOpen={flow.isDismissOpen}\n onClose={flow.closeDismissDialog}\n onDismiss={flow.confirmDismiss}\n />\n\n {flow.isSurveyOpen && (\n <FeedbackDialog\n characterLimitLabel={flow.survey.characterLimitLabel}\n closeAriaLabel={flow.survey.closeAriaLabel}\n isOpen={true}\n onBackClick={flow.feedbackDialogCallbacks.onBackClick}\n onClose={flow.closeSurvey}\n onSubmit={flow.submitSurvey}\n onTextInputFocus={flow.feedbackDialogCallbacks.onTextInputFocus}\n options={flow.survey.options}\n primaryText={flow.survey.submitText}\n secondaryText={flow.survey.backText}\n title={flow.survey.title}\n />\n )}\n\n {flow.cardState === 'visible' && insights_payload.footer && (\n <Footer footer={insights_payload.footer} />\n )}\n </Stack>\n </BeatActionsProvider>\n )\n },\n)\n\nexport default BaseLayout\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAM,KAA+B,CAAC,GAEhC,KAAsB;AAAA,EAC1B,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,SAAS;AAAA,EAET,QAAQ;AACV,GAGM,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,KAAK,EAAkB;AAAA,kBAE1D,OAAM;AAAA,kBACN,UAAU,EAAkB;AAAA,kBAC5B,SAAA,MAAe,EAAW,aAAa,CAAa;AAAA,kBACpD,IAAI;AAAA,oBACF,GAAG;AAAA,oBACH,GAAI,EAAc,EAAc,KAAK,KAAK,EAAE,OAAO,gBAAgB;AAAA,kBACrE;AAAA,kBAEC,UAAA,EAAc;AAAA,gBACT,CAAA;AAAA,cAEL;AAAA;YAGT,gBAAA,EAAC,IAAD;AAAA,cAAa,cAAc,EAAK;AAAA,cAAkB,MAAM,EAAK;AAAA,YAAqB,CAAA;AAAA,UAC9E;AAAA,QACN,CAAA,CAAA,EAAA,CAAA;AAAA,QAGJ,gBAAA,EAAC,IAAD,EAAwB,MAAA,EAAO,CAAA;AAAA,QAE/B,gBAAA,EAAC,IAAD;AAAA,UACE,QAAQ,EAAK;AAAA,UACb,SAAS,EAAK;AAAA,UACd,WAAW,EAAK;AAAA,QACjB,CAAA;AAAA,QAEA,EAAK,gBACJ,gBAAA,EAAC,IAAD;AAAA,UACE,qBAAqB,EAAK,OAAO;AAAA,UACjC,gBAAgB,EAAK,OAAO;AAAA,UAC5B,QAAQ;AAAA,UACR,aAAa,EAAK,wBAAwB;AAAA,UAC1C,SAAS,EAAK;AAAA,UACd,UAAU,EAAK;AAAA,UACf,kBAAkB,EAAK,wBAAwB;AAAA,UAC/C,SAAS,EAAK,OAAO;AAAA,UACrB,aAAa,EAAK,OAAO;AAAA,UACzB,eAAe,EAAK,OAAO;AAAA,UAC3B,OAAO,EAAK,OAAO;AAAA,QACpB,CAAA;AAAA,QAGF,EAAK,cAAc,aAAa,EAAiB,UAChD,gBAAA,EAAC,IAAD,EAAQ,QAAQ,EAAiB,OAAS,CAAA;AAAA,MAEvC;AAAA;EACY,CAAA;AAEzB,CACF"}
|
|
1
|
+
{"version":3,"file":"BaseLayout.es.js","names":[],"sources":["../../../src/insights-v2/components/BaseLayout.tsx"],"sourcesContent":["import { useMemo } from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport Stack from '@mui/material/Stack'\n\nimport { ChevronRight } from '@mxenabled/mx-icons'\nimport { P } from '@mxenabled/mxui'\n\nimport { blocks } from '../mappings/blocks'\nimport { actionBlocksKey } from '../mappings/actionBlocksKey'\nimport { isContactSupportCtaDisabled } from '../actionBlocks/ContactSupportActionBlock'\nimport { logoFromRef } from './shared/EntityLogo'\n\nimport Footer from './Footer'\nimport Header from './Header'\nimport FeedbackBar from './FeedbackBar'\nimport FeedbackDialog from './FeedbackDialog'\nimport DismissInsightDialog from './DismissInsightDialog'\nimport HiddenConfirmationCard from './HiddenConfirmationCard'\nimport ErrorCard from './ErrorCard'\nimport LoadingCard from './LoadingCard'\nimport { ObsolesceBanner, type ObsolesceBannerState } from './ObsolesceBanner'\nimport { useAppConfig, useGlobalCopyStore, useGlobalStore, useInsightsV2Store } from '../../common'\nimport { sendClientConfiguredCta } from '../../common/utils/PostMessage'\nimport type { Beat, PrimaryCTA, SecondaryCTA } from '../../core'\nimport { BeatActionsProvider, type BeatActions } from '../beatActions'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { reportCtaClick, useBeatCtaActions } from '../ctaActions'\nimport { CtaStatus } from './CtaStatus'\nimport { useBeatFeedbackFlow } from '../hooks/useBeatFeedbackFlow'\n\nexport interface ObsoleteState {\n state: ObsolesceBannerState\n onRefresh: () => void\n onDismiss: () => void\n}\n\ninterface BaseLayoutProps {\n beat: Beat\n beatActions?: BeatActions\n obsolete?: ObsoleteState\n /** Swap only the block slot for a LoadingCard (e.g. while a sampled beat loads). */\n isLoading?: boolean\n /** Replace the entire card with an ErrorCard (e.g. when the sample fails to load). */\n isError?: boolean\n}\n\nconst NO_BEAT_ACTIONS: BeatActions = {}\n\nconst OBSOLETE_OVERLAY_SX = {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n backgroundColor: 'background.default',\n opacity: 0.7,\n // Above every block's own z-index (hero card 1, AccountBlock 2), or that section shows through.\n zIndex: 3,\n} as const\n\n// Mini CTA label as Figma's 24px text link, which fits Pulse's 312px mini slide: 13/16 semibold, 16px\n// line plus 4px above and below, its text starting at the card's 16px inset. A minimum height, not the\n// theme's fixed 44px Button height, so a long or translated label wraps instead of overflowing; MUI's\n// 64px minimum width and centring are undone for the same inset.\nconst MINI_CTA_SX = {\n alignItems: 'center',\n alignSelf: 'flex-start',\n display: 'flex',\n fontSize: 13,\n fontWeight: 600,\n height: 'auto',\n justifyContent: 'flex-start',\n lineHeight: '16px',\n minHeight: 24,\n minWidth: 0,\n px: 0,\n py: 4,\n textAlign: 'left',\n textTransform: 'none',\n} as const\n\n// Full card's secondary CTA (e.g. Fee Detected's Contact Support): a quiet text button, 13/16\n// semibold in text.secondary. `color=\"inherit\"` keeps hover, ripple and focus off the primary palette.\n// An unavailable CTA (contact_support_block with no host handler) is dimmed at the call site, as the\n// primary CTA is, because it is only aria-disabled and so never matches `.Mui-disabled`.\nconst SECONDARY_CTA_SX = {\n color: 'text.secondary',\n fontSize: 13,\n fontWeight: 600,\n lineHeight: '16px',\n '&.Mui-disabled': { color: 'text.disabled' },\n} as const\n\nconst BaseLayout = observer(\n ({\n beat,\n beatActions = NO_BEAT_ACTIONS,\n obsolete,\n isLoading = false,\n isError = false,\n }: BaseLayoutProps) => {\n const copy = useGlobalCopyStore()\n const insightsV2Store = useInsightsV2Store()\n const { config } = useAppConfig()\n const flow = useBeatFeedbackFlow(beat, beatActions)\n\n const stores = useGlobalStore()\n const {\n runCta: handleCtaClick,\n primary: primaryCtaState,\n secondary: secondaryCtaState,\n } = useBeatCtaActions(\n beat,\n beatActions,\n beat.insights_payload?.primary_cta,\n beat.insights_payload?.secondary_cta,\n )\n\n // Guard: payload may not be loaded yet (isLoading/isError states).\n const isMini = beat.insights_payload?.widget_type === 'mini'\n\n // Memoized: an inline object here would change identity every render, making every\n // useAnalyticsEvent() consumer's callback (and its effect deps) unstable too.\n const beatActionsValue = useMemo(\n () => ({ ...flow.wrappedActions, beat }),\n [flow.wrappedActions, beat],\n )\n\n // Error replaces the entire card; loading only swaps the block slot (below).\n if (isError) return <ErrorCard />\n\n const insights_payload = beat.insights_payload\n\n if (!insights_payload) return null\n if (flow.cardState === 'dismissed') return null\n\n const { instance_slot, primary_cta, secondary_cta, sub_title, title, guid, dismissed_at } =\n insights_payload\n const { block } = instance_slot\n\n // Rebuild V1 subtitle shape; sub_title wins if present.\n const subtitle =\n sub_title ??\n (insights_payload.subtitle\n ? {\n logo: logoFromRef(insights_payload.logo),\n text: insights_payload.subtitle,\n }\n : undefined)\n\n // CTAs run via ctaActions; contact_support_block bypasses it.\n const isCtaDisabled = (ctaBlock: string | null | undefined) =>\n isContactSupportCtaDisabled(ctaBlock, config, beatActions.onContactSupport)\n\n const onCtaClick = async (slot: 'primary' | 'secondary', cta: PrimaryCTA | SecondaryCTA) => {\n if (isCtaDisabled(cta.block)) return\n\n if (cta.block === actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK) {\n // Bypasses the runner, but still reports the press like any other CTA: the generic\n // press event, and (on a first primary press) FIRST_TIME_PRIMARY_ACTION_SELECTED +\n // cta_clicked_at.\n reportCtaClick({ beat, stores, hostActions: beatActions, slot })\n beatActions.onContactSupport?.()\n return\n }\n\n await handleCtaClick(slot, cta)\n }\n\n const Block = blocks[block as keyof typeof blocks]\n\n const inDescriptionCta = insights_payload.in_description_cta\n // Full card: the envelope's link opens the drawer its block names. A link with no block (mini's\n // \"Make a Transfer\") is the card's action, drawn as the mini label below, never a dead link.\n const envelopeLink =\n !isMini && inDescriptionCta?.label && inDescriptionCta.block ? inDescriptionCta : undefined\n // The card's action label: the primary CTA's, else a block-less envelope link's (ditto ≥ 1.4.3\n // sends mini's action as in_description_cta). `||`, not `??`: the copy may send the primary label\n // as \"\" rather than omit it, and an empty string must fall through. It is a button only on a full\n // card with a primary CTA; otherwise a label, so a tap reaches the host's card handler.\n const ctaLabel =\n primary_cta?.label || (envelopeLink ? undefined : inDescriptionCta?.label) || undefined\n const isCtaButton = !isMini && !!primary_cta?.label\n const clientConfiguredLabel = beat.in_description_cta || beat.html_in_description_cta\n const onClientConfiguredLinkClick = () => {\n const { is_mobile_webview, clientConfig } = stores.appDataStore.appConfig\n\n sendClientConfiguredCta(beat.template, {\n isMobileWebview: is_mobile_webview,\n webviewScheme: clientConfig?.master?.ui_message_webview_url_scheme,\n userGuid: insights_payload.user_guid ?? beat.user_guid,\n })\n }\n // The primary step's presenter may draw a status or nothing instead of the button (full card only).\n const primaryPresentation = isCtaButton ? primaryCtaState.presentation : undefined\n const hidesAllCtas = primaryPresentation?.kind === 'hidden' && !!primaryPresentation.hideAll\n const showSecondaryCta = !isMini && !!secondary_cta?.label && !hidesAllCtas\n const showCtaRow = (!!ctaLabel && primaryPresentation?.kind !== 'hidden') || showSecondaryCta\n const obsoleteCopy = copy.insights_feed?.general\n const isObsoleteDimmed =\n obsolete?.state === 'not_refreshable' && !dismissed_at && !!obsoleteCopy\n\n return (\n <BeatActionsProvider value={beatActionsValue}>\n <Stack sx={{ mb: 16 }}>\n {flow.cardState === 'confirming' ? (\n <HiddenConfirmationCard\n onClose={flow.collapseConfirmation}\n onLeaveFeedback={flow.openHideSurvey}\n onUndo={flow.undoDismiss}\n />\n ) : (\n <>\n {obsolete && obsoleteCopy && <ObsolesceBanner {...obsolete} copy={obsoleteCopy} />}\n <Card\n inert={isObsoleteDimmed}\n sx={{\n ...(isObsoleteDimmed && {\n position: 'relative',\n zIndex: 2,\n pointerEvents: 'none',\n }),\n }}\n >\n {isObsoleteDimmed && <Box sx={OBSOLETE_OVERLAY_SX} />}\n <Header isMini={isMini} subtitle={subtitle} title={title ?? ''} />\n {isLoading ? (\n <LoadingCard />\n ) : (\n Block && <Block beatGuid={guid} payload={insights_payload} />\n )}\n\n <Stack sx={{ gap: 6, pb: 16, pt: 12, px: 16 }}>\n <P\n dangerouslySetInnerHTML={{\n __html: insights_payload.description.html_text,\n }}\n sx={{ fontWeight: 'fontWeightRegular' }}\n variant=\"subtitle2\"\n />\n {/* V2: the envelope's link opens the action block it names. */}\n {envelopeLink && (\n <Button\n endIcon={<ChevronRight />}\n onClick={() =>\n insightsV2Store.openActionDrawer({ guid, trigger: 'inDescriptionCta' })\n }\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {envelopeLink.label}\n </Button>\n )}\n {/* Custom-copy link when the envelope sends none; legacy mini shows it too, so no mini guard. */}\n {!inDescriptionCta?.label && clientConfiguredLabel && (\n <Button\n endIcon={<ChevronRight />}\n onClick={onClientConfiguredLinkClick}\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {clientConfiguredLabel}\n </Button>\n )}\n </Stack>\n\n {showCtaRow && (\n <Stack sx={{ gap: 8, pb: 16, px: 16 }}>\n {ctaLabel &&\n !isCtaButton && (\n // The card's action when it has no primary CTA button (mini always; a full card whose\n // only link names no block). What the tap does is the host's decision (Pulse posts\n // `carousel/cta`, the same redirect a V1 mini card sends), never the action drawer the\n // full card's CTA opens. It is a real (blue, focusable) button for that tap, but has no\n // handler of its own and does not stop the click, so it reaches the host's card handler\n // exactly as a tap on the card does.\n <Button sx={MINI_CTA_SX} variant=\"text\">\n {ctaLabel}\n </Button>\n )}\n {isCtaButton && primary_cta && primaryPresentation?.kind === 'status' && (\n <CtaStatus\n action={primaryPresentation.action}\n icon={primaryPresentation.icon}\n label={primaryPresentation.label}\n tone={primaryPresentation.tone}\n />\n )}\n {isCtaButton && primary_cta && !primaryPresentation && (\n <Button\n aria-disabled={isCtaDisabled(primary_cta.block) || primaryCtaState.disabled}\n disabled={primaryCtaState.disabled}\n onClick={() => onCtaClick('primary', primary_cta)}\n sx={{\n ...(isCtaDisabled(primary_cta.block) && { color: 'text.disabled' }),\n }}\n variant=\"outlined\"\n >\n {primary_cta.label}\n </Button>\n )}\n {/* Mini has room for one CTA. */}\n {showSecondaryCta && secondary_cta && (\n <Button\n aria-disabled={\n isCtaDisabled(secondary_cta.block) || secondaryCtaState.disabled\n }\n color=\"inherit\"\n disabled={secondaryCtaState.disabled}\n onClick={() => onCtaClick('secondary', secondary_cta)}\n sx={{\n ...SECONDARY_CTA_SX,\n ...(isCtaDisabled(secondary_cta.block) && { color: 'text.disabled' }),\n }}\n >\n {secondary_cta.label}\n </Button>\n )}\n </Stack>\n )}\n\n <FeedbackBar onTellUsMore={flow.openRatingSurvey} show={flow.isFeedbackBarShown} />\n </Card>\n </>\n )}\n\n <ActionBlockLayer beat={beat} />\n\n <DismissInsightDialog\n isOpen={flow.isDismissOpen}\n onClose={flow.closeDismissDialog}\n onDismiss={flow.confirmDismiss}\n />\n\n {flow.isSurveyOpen && (\n <FeedbackDialog\n characterLimitLabel={flow.survey.characterLimitLabel}\n closeAriaLabel={flow.survey.closeAriaLabel}\n isOpen={true}\n onBackClick={flow.feedbackDialogCallbacks.onBackClick}\n onClose={flow.closeSurvey}\n onSubmit={flow.submitSurvey}\n onTextInputFocus={flow.feedbackDialogCallbacks.onTextInputFocus}\n options={flow.survey.options}\n primaryText={flow.survey.submitText}\n secondaryText={flow.survey.backText}\n title={flow.survey.title}\n />\n )}\n\n {flow.cardState === 'visible' && insights_payload.footer && (\n <Footer footer={insights_payload.footer} />\n )}\n </Stack>\n </BeatActionsProvider>\n )\n },\n)\n\nexport default BaseLayout\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAM,KAA+B,CAAC,GAEhC,KAAsB;AAAA,EAC1B,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,SAAS;AAAA,EAET,QAAQ;AACV,GAMM,KAAc;AAAA,EAClB,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,SAAS;AAAA,EACT,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,YAA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from "@mxenabled/mxui";
|
|
4
|
-
import { jsx as x, jsxs as
|
|
5
|
-
var
|
|
4
|
+
import { jsx as x, jsxs as g } from "react/jsx-runtime";
|
|
5
|
+
var c = ({ bgcolor: e = o.bgcolor, borderColor: i = o.borderColor, icon: a, label: l, labelColor: n = o.textColor, labelVariant: s = "subtitle2", onClick: r, sx: d, "data-testid": f }) => /* @__PURE__ */ g(u, {
|
|
6
6
|
"data-testid": f,
|
|
7
|
-
onClick:
|
|
8
|
-
onKeyDown:
|
|
9
|
-
|
|
7
|
+
onClick: r,
|
|
8
|
+
onKeyDown: r ? (t) => {
|
|
9
|
+
t.target === t.currentTarget && (t.key !== "Enter" && t.key !== " " || (t.preventDefault(), t.stopPropagation(), r?.(t)));
|
|
10
10
|
} : void 0,
|
|
11
|
-
role:
|
|
11
|
+
role: r ? "button" : void 0,
|
|
12
12
|
sx: {
|
|
13
13
|
alignItems: "center",
|
|
14
14
|
alignSelf: "flex-start",
|
|
@@ -21,22 +21,23 @@ var h = ({ bgcolor: e = o.bgcolor, borderColor: i = o.borderColor, icon: a, labe
|
|
|
21
21
|
minHeight: 24,
|
|
22
22
|
px: 16,
|
|
23
23
|
py: 2,
|
|
24
|
-
...
|
|
24
|
+
...r && { "&:focus-visible": {
|
|
25
25
|
outline: "2px solid",
|
|
26
26
|
outlineColor: "info.main",
|
|
27
27
|
outlineOffset: 2
|
|
28
28
|
} },
|
|
29
|
-
...
|
|
29
|
+
...d
|
|
30
30
|
},
|
|
31
|
-
tabIndex:
|
|
31
|
+
tabIndex: r ? 0 : void 0,
|
|
32
32
|
children: [a, /* @__PURE__ */ x(p, {
|
|
33
|
-
color:
|
|
33
|
+
color: n,
|
|
34
|
+
sx: { fontWeight: "fontWeightRegular" },
|
|
34
35
|
variant: s,
|
|
35
36
|
children: l
|
|
36
37
|
})]
|
|
37
38
|
});
|
|
38
39
|
export {
|
|
39
|
-
|
|
40
|
+
c as default
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
//# sourceMappingURL=StatusPill.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusPill.es.js","names":[],"sources":["../../../src/insights-v2/components/StatusPill.tsx"],"sourcesContent":["import type { KeyboardEvent, ReactNode, SyntheticEvent } from 'react'\n\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { STATUS_SUCCESS_TOKENS } from './statusTokens'\n\ninterface StatusPillProps {\n /** Pill label. */\n label: ReactNode\n /** Optional leading icon (e.g. a check-circle). */\n icon?: ReactNode\n /** Pill background color token. */\n bgcolor?: string\n /** Pill border color token. */\n borderColor?: string\n /** Label color token. */\n labelColor?: string\n /** Label typography. Default `subtitle2`; the transaction-row pill uses `caption`. */\n labelVariant?: 'subtitle2' | 'caption'\n /**\n * Makes the pill tappable (the transaction-row pill posts the beat to the host). The pill then\n * exposes `role=\"button\"`, is focusable, and also fires on Enter and Space, so the handler gets a\n * mouse or a keyboard event.\n */\n onClick?: (event: SyntheticEvent<HTMLDivElement>) => void\n 'data-testid'?: string\n sx?: SxProps\n}\n\n/**\n * A small rounded status pill: optional icon + label on a tinted, bordered\n * surface.\n *\n * Figma: the \"Categorized\" pill in Peer-to-Peer Categorization (`success.100`\n * bg, `success.main` border, radius 999, 24px tall, check icon + `success.darker`\n * `typography/subtitle2` label — regular weight, NOT bold). Reusable for any\n * inline status.\n */\nconst StatusPill = ({\n bgcolor = STATUS_SUCCESS_TOKENS.bgcolor,\n borderColor = STATUS_SUCCESS_TOKENS.borderColor,\n icon,\n label,\n labelColor = STATUS_SUCCESS_TOKENS.textColor,\n labelVariant = 'subtitle2',\n onClick,\n sx,\n 'data-testid': testId,\n}: StatusPillProps) => {\n // Only when the pill itself has focus: a key pressed inside it would be a child's own. Stopping\n // the event keeps a clickable row around the pill from also acting on the same keystroke.\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.target !== event.currentTarget) return\n if (event.key !== 'Enter' && event.key !== ' ') return\n\n event.preventDefault()\n event.stopPropagation()\n onClick?.(event)\n }\n\n return (\n <Stack\n data-testid={testId}\n onClick={onClick}\n onKeyDown={onClick ? handleKeyDown : undefined}\n role={onClick ? 'button' : undefined}\n sx={{\n alignItems: 'center',\n alignSelf: 'flex-start',\n bgcolor,\n border: '1px solid',\n borderColor,\n borderRadius: 999,\n flexDirection: 'row',\n gap: 6,\n minHeight: 24,\n px: 16,\n py: 2,\n // The same focus ring the theme's MuiButton draws.\n ...(onClick && {\n '&:focus-visible': { outline: '2px solid', outlineColor: 'info.main', outlineOffset: 2 },\n }),\n ...sx,\n }}\n tabIndex={onClick ? 0 : undefined}\n >\n {icon}\n <Text color={labelColor} variant={labelVariant}>\n {label}\n </Text>\n </Stack>\n )\n}\n\nexport default StatusPill\n"],"mappings":";;;;AAyCA,IAAM,IAAA,CAAc,EAClB,SAAA,IAAU,EAAsB,SAChC,aAAA,IAAc,EAAsB,aACpC,MAAA,GACA,OAAA,GACA,YAAA,IAAa,EAAsB,WACnC,cAAA,IAAe,aACf,SAAA,GACA,IAAA,GACA,eAAe,EAAA,MAcb,gBAAA,EAAC,GAAD;AAAA,EACE,eAAa;AAAA,EACJ,SAAA;AAAA,EACT,WAAW,IAbT,CAAiB,MAAyC;AAC9D,IAAI,EAAM,WAAW,EAAM,kBACvB,EAAM,QAAQ,WAAW,EAAM,QAAQ,QAE3C,EAAM,eAAe,GACrB,EAAM,gBAAgB,GACtB,IAAU,CAAK;AAAA,EACjB,IAMyC;AAAA,EACrC,MAAM,IAAU,WAAW;AAAA,EAC3B,IAAI;AAAA,IACF,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,SAAA;AAAA,IACA,QAAQ;AAAA,IACR,aAAA;AAAA,IACA,cAAc;AAAA,IACd,eAAe;AAAA,IACf,KAAK;AAAA,IACL,WAAW;AAAA,IACX,IAAI;AAAA,IACJ,IAAI;AAAA,IAEJ,GAAI,KAAW,EACb,mBAAmB;AAAA,MAAE,SAAS;AAAA,MAAa,cAAc;AAAA,MAAa,eAAe;AAAA,IAAE,EACzF;AAAA,IACA,GAAG;AAAA,EACL;AAAA,EACA,UAAU,IAAU,IAAI;AAAA,EAvB1B,UAAA,CAyBG,
|
|
1
|
+
{"version":3,"file":"StatusPill.es.js","names":[],"sources":["../../../src/insights-v2/components/StatusPill.tsx"],"sourcesContent":["import type { KeyboardEvent, ReactNode, SyntheticEvent } from 'react'\n\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { STATUS_SUCCESS_TOKENS } from './statusTokens'\n\ninterface StatusPillProps {\n /** Pill label. */\n label: ReactNode\n /** Optional leading icon (e.g. a check-circle). */\n icon?: ReactNode\n /** Pill background color token. */\n bgcolor?: string\n /** Pill border color token. */\n borderColor?: string\n /** Label color token. */\n labelColor?: string\n /** Label typography. Default `subtitle2`; the transaction-row pill uses `caption`. */\n labelVariant?: 'subtitle2' | 'caption'\n /**\n * Makes the pill tappable (the transaction-row pill posts the beat to the host). The pill then\n * exposes `role=\"button\"`, is focusable, and also fires on Enter and Space, so the handler gets a\n * mouse or a keyboard event.\n */\n onClick?: (event: SyntheticEvent<HTMLDivElement>) => void\n 'data-testid'?: string\n sx?: SxProps\n}\n\n/**\n * A small rounded status pill: optional icon + label on a tinted, bordered\n * surface.\n *\n * Figma: the \"Categorized\" pill in Peer-to-Peer Categorization (`success.100`\n * bg, `success.main` border, radius 999, 24px tall, check icon + `success.darker`\n * `typography/subtitle2` label — regular weight, NOT bold). Reusable for any\n * inline status.\n */\nconst StatusPill = ({\n bgcolor = STATUS_SUCCESS_TOKENS.bgcolor,\n borderColor = STATUS_SUCCESS_TOKENS.borderColor,\n icon,\n label,\n labelColor = STATUS_SUCCESS_TOKENS.textColor,\n labelVariant = 'subtitle2',\n onClick,\n sx,\n 'data-testid': testId,\n}: StatusPillProps) => {\n // Only when the pill itself has focus: a key pressed inside it would be a child's own. Stopping\n // the event keeps a clickable row around the pill from also acting on the same keystroke.\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.target !== event.currentTarget) return\n if (event.key !== 'Enter' && event.key !== ' ') return\n\n event.preventDefault()\n event.stopPropagation()\n onClick?.(event)\n }\n\n return (\n <Stack\n data-testid={testId}\n onClick={onClick}\n onKeyDown={onClick ? handleKeyDown : undefined}\n role={onClick ? 'button' : undefined}\n sx={{\n alignItems: 'center',\n alignSelf: 'flex-start',\n bgcolor,\n border: '1px solid',\n borderColor,\n borderRadius: 999,\n flexDirection: 'row',\n gap: 6,\n minHeight: 24,\n px: 16,\n py: 2,\n // The same focus ring the theme's MuiButton draws.\n ...(onClick && {\n '&:focus-visible': { outline: '2px solid', outlineColor: 'info.main', outlineOffset: 2 },\n }),\n ...sx,\n }}\n tabIndex={onClick ? 0 : undefined}\n >\n {icon}\n {/* Figma: regular weight. MXUI `subtitle2` sets none, so the host page's 500 would show. */}\n <Text color={labelColor} sx={{ fontWeight: 'fontWeightRegular' }} variant={labelVariant}>\n {label}\n </Text>\n </Stack>\n )\n}\n\nexport default StatusPill\n"],"mappings":";;;;AAyCA,IAAM,IAAA,CAAc,EAClB,SAAA,IAAU,EAAsB,SAChC,aAAA,IAAc,EAAsB,aACpC,MAAA,GACA,OAAA,GACA,YAAA,IAAa,EAAsB,WACnC,cAAA,IAAe,aACf,SAAA,GACA,IAAA,GACA,eAAe,EAAA,MAcb,gBAAA,EAAC,GAAD;AAAA,EACE,eAAa;AAAA,EACJ,SAAA;AAAA,EACT,WAAW,IAbT,CAAiB,MAAyC;AAC9D,IAAI,EAAM,WAAW,EAAM,kBACvB,EAAM,QAAQ,WAAW,EAAM,QAAQ,QAE3C,EAAM,eAAe,GACrB,EAAM,gBAAgB,GACtB,IAAU,CAAK;AAAA,EACjB,IAMyC;AAAA,EACrC,MAAM,IAAU,WAAW;AAAA,EAC3B,IAAI;AAAA,IACF,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,SAAA;AAAA,IACA,QAAQ;AAAA,IACR,aAAA;AAAA,IACA,cAAc;AAAA,IACd,eAAe;AAAA,IACf,KAAK;AAAA,IACL,WAAW;AAAA,IACX,IAAI;AAAA,IACJ,IAAI;AAAA,IAEJ,GAAI,KAAW,EACb,mBAAmB;AAAA,MAAE,SAAS;AAAA,MAAa,cAAc;AAAA,MAAa,eAAe;AAAA,IAAE,EACzF;AAAA,IACA,GAAG;AAAA,EACL;AAAA,EACA,UAAU,IAAU,IAAI;AAAA,EAvB1B,UAAA,CAyBG,GAED,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAO;AAAA,IAAY,IAAI,EAAE,YAAY,oBAAoB;AAAA,IAAG,SAAS;AAAA,IACxE,UAAA;AAAA,EACG,CAAA,CACD"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GoalsMicroWidget.es.js","names":[],"sources":["../../src/goals/GoalsMicroWidget.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 { GoalMicroStatusCard } from './components/micro/GoalMicroStatusCard'\nimport { GoalsMicroEmptyState } from './components/micro/GoalsMicroEmptyState'\n\ninterface GoalsMicroWidgetProps {\n onCTAClick: () => void\n}\n\nexport const GoalsMicroWidget = observer(({ onCTAClick }: GoalsMicroWidgetProps) => {\n const { isAccountDataLoaded, loadAccountData, visibleAccounts: accounts } = useAccountStore()\n const { onEvent } = useEvent()\n const { goals: copy } = useGlobalCopyStore()\n const { isInitialized } = useGlobalUiStore()\n const { ongoingGoalsForMicroWidget: goals, isAllGoalDataLoaded, loadGoalData } = useGoalStore()\n\n useWidgetLoadTimer({\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 <GoalMicroStatusCard goal={goal} />\n {index !== goals.length - 1 && <Divider />}\n </React.Fragment>\n ))}\n </Stack>\n ) : (\n <GoalsMicroEmptyState\n header={copy.create_goals_header}\n subText={copy.micro_zero_state_description}\n />\n )}\n </MicroWidgetContainer>\n )\n})\n"],"mappings":";;;;;;;;;;;;AA0BA,IAAa,IAAmB,EAAA,CAAU,EAAE,YAAA,EAAA,MAAwC;AAClF,QAAM,EAAE,qBAAA,GAAqB,iBAAA,GAAiB,iBAAiB,EAAA,IAAa,EAAgB,GACtF,EAAE,SAAA,EAAA,IAAY,EAAS,GACvB,EAAE,OAAO,EAAA,IAAS,EAAmB,GACrC,EAAE,eAAA,EAAA,IAAkB,EAAiB,GACrC,EAAE,4BAA4B,GAAO,qBAAA,GAAqB,cAAA,EAAA,IAA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file":"GoalMicroStatusCard.es.js","names":[],"sources":["../../../../src/goals/components/micro/GoalMicroStatusCard.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 GoalMicroStatusCard = 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":";;;;;;;;;;;;A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AAA,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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GoalsMicroEmptyState.es.js","names":[],"sources":["../../../../src/goals/components/micro/GoalsMicroEmptyState.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 GoalsMicroEmptyState = ({ 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,CAAwB,EAAE,QAAA,GAAQ,SAAA,GAAS,IAAA,EAAA,MACtD,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"}
|