@mx-cartographer/experiences 9.7.6 → 9.7.8
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/types/Insights.d.ts +1 -0
- package/dist/core/types/Insights.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +101 -92
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/HeaderComponent.es.js +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/HeaderComponent.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/IconComponent.es.js +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/IconComponent.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.d.ts +6 -0
- package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js +37 -0
- package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/index.d.ts +3 -0
- package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/weekStrip.d.ts +25 -0
- package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/weekStrip.es.js +35 -0
- package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/weekStrip.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js +4 -4
- package/dist/insights-v2/blocks/ComponentBlocks/index.d.ts +1 -1
- package/dist/insights-v2/components/UpcomingBillCard.d.ts +1 -10
- package/dist/insights-v2/components/UpcomingBillCard.es.js.map +1 -1
- package/dist/insights-v2/index.es.js +26 -25
- package/dist/insights-v2/mappings/blocks.es.js +30 -29
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingBillBlock/UpcomingBillBlock.d.ts +0 -53
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingBillBlock/UpcomingBillBlock.es.js +0 -79
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingBillBlock/UpcomingBillBlock.es.js.map +0 -1
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingBillBlock/index.d.ts +0 -1
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingBillBlock/layout.d.ts +0 -13
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingBillBlock/layout.es.js +0 -6
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingBillBlock/layout.es.js.map +0 -1
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { formatCurrency as u } from "../../../../core/utils/NumberFormatting.es.js";
|
|
2
|
-
import d from "../../../components/LogoFromGuid.es.js";
|
|
3
|
-
import g from "../../../components/UpcomingBillCard.es.js";
|
|
4
|
-
import { createVariantBlock as D } from "../../createVariantBlock.es.js";
|
|
5
|
-
import { upcomingBillVariant as p } from "./layout.es.js";
|
|
6
|
-
import f from "@mui/material/Stack";
|
|
7
|
-
import { jsx as l } from "react/jsx-runtime";
|
|
8
|
-
var s = [
|
|
9
|
-
"Sun",
|
|
10
|
-
"Mon",
|
|
11
|
-
"Tue",
|
|
12
|
-
"Wed",
|
|
13
|
-
"Thu",
|
|
14
|
-
"Fri",
|
|
15
|
-
"Sat"
|
|
16
|
-
], h = (t) => {
|
|
17
|
-
const a = /^(\d{4})-(\d{2})-(\d{2})$/.exec(t);
|
|
18
|
-
if (a) {
|
|
19
|
-
const [, o, n, r] = a, i = new Date(Number(o), Number(n) - 1, Number(r));
|
|
20
|
-
return Number.isNaN(i.getTime()) ? null : i;
|
|
21
|
-
}
|
|
22
|
-
const e = new Date(t);
|
|
23
|
-
return Number.isNaN(e.getTime()) ? null : e;
|
|
24
|
-
}, v = (t) => {
|
|
25
|
-
const a = t.getDay(), e = new Date(t);
|
|
26
|
-
return e.setDate(t.getDate() - a), s.map((o, n) => {
|
|
27
|
-
const r = new Date(e);
|
|
28
|
-
r.setDate(e.getDate() + n);
|
|
29
|
-
const i = {
|
|
30
|
-
label: o,
|
|
31
|
-
date: String(r.getDate())
|
|
32
|
-
};
|
|
33
|
-
return n === a && (i.highlighted = !0), i;
|
|
34
|
-
});
|
|
35
|
-
}, y = () => {
|
|
36
|
-
const t = /* @__PURE__ */ new Date(), a = t.getDay(), e = new Date(t);
|
|
37
|
-
return e.setDate(t.getDate() - a), s.map((o, n) => {
|
|
38
|
-
const r = new Date(e);
|
|
39
|
-
return r.setDate(e.getDate() + n), {
|
|
40
|
-
label: o,
|
|
41
|
-
date: String(r.getDate())
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
}, m = ({ payload: t }) => {
|
|
45
|
-
const { instance_slot: a } = t, { amount: e, due_date: o, merchant_guid: n, merchant_name: r } = a, i = o ? h(o) : null, c = i ? v(i) : y();
|
|
46
|
-
return /* @__PURE__ */ l(f, {
|
|
47
|
-
sx: { px: 16 },
|
|
48
|
-
children: /* @__PURE__ */ l(g, {
|
|
49
|
-
amount: u(e ?? 0, "0,0.00"),
|
|
50
|
-
days: c,
|
|
51
|
-
logo: n ? /* @__PURE__ */ l(d, {
|
|
52
|
-
logo: {
|
|
53
|
-
alt: r ?? "",
|
|
54
|
-
guid: n
|
|
55
|
-
},
|
|
56
|
-
size: 24
|
|
57
|
-
}) : null,
|
|
58
|
-
merchantName: r ?? ""
|
|
59
|
-
})
|
|
60
|
-
});
|
|
61
|
-
}, P = ({ payload: t, beatGuid: a }) => {
|
|
62
|
-
const e = t.instance_slot.variant ?? void 0;
|
|
63
|
-
return /* @__PURE__ */ l(B, {
|
|
64
|
-
beatGuid: a,
|
|
65
|
-
payload: t,
|
|
66
|
-
variant: e
|
|
67
|
-
});
|
|
68
|
-
}, B = D({
|
|
69
|
-
variants: { [p.ProjectedBillPayment]: m },
|
|
70
|
-
fallback: m,
|
|
71
|
-
name: "UpcomingBillBlock"
|
|
72
|
-
});
|
|
73
|
-
export {
|
|
74
|
-
v as buildWeekStrip,
|
|
75
|
-
P as default,
|
|
76
|
-
h as parseDueDate
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
//# sourceMappingURL=UpcomingBillBlock.es.js.map
|
package/dist/insights-v2/blocks/ComponentBlocks/UpcomingBillBlock/UpcomingBillBlock.es.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UpcomingBillBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/UpcomingBillBlock/UpcomingBillBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport type { InsightsPayload } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport UpcomingBillCard, { type UpcomingBillDay } from '../../../components/UpcomingBillCard'\nimport { createVariantBlock } from '../../createVariantBlock'\n\nimport { upcomingBillVariant } from './layout'\n\ninterface UpcomingBillBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nconst DAY_LABELS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] as const\ntype SevenDays = [\n UpcomingBillDay,\n UpcomingBillDay,\n UpcomingBillDay,\n UpcomingBillDay,\n UpcomingBillDay,\n UpcomingBillDay,\n UpcomingBillDay,\n]\n\n/**\n * Parse an ISO `YYYY-MM-DD` into a local-time Date, dodging the UTC-midnight parse\n * that `new Date('2025-10-30')` performs (which drifts a day in negative offsets).\n * Any other string shape (full ISO datetime) falls through to the native parser.\n *\n * Returns `null` for anything that doesn't resolve to a valid Date — including a\n * `YYYY-MM-DD`-shaped string whose year/month/day segments produce `Invalid Date`\n * (e.g. `'2026-13-40'`) and arbitrary strings the native parser rejects. Callers\n * must handle `null` so a bad backend value cannot propagate `NaN` into the UI\n * via `getDay()` and render `NaN` day numbers.\n */\nexport const parseDueDate = (iso: string): Date | null => {\n const dateOnly = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(iso)\n if (dateOnly) {\n const [, y, m, d] = dateOnly\n const parsed = new Date(Number(y), Number(m) - 1, Number(d))\n return Number.isNaN(parsed.getTime()) ? null : parsed\n }\n const parsed = new Date(iso)\n return Number.isNaN(parsed.getTime()) ? null : parsed\n}\n\n/**\n * Build the Sun→Sat week around a due date with the due day marked `highlighted`.\n * Column index is the local day-of-week (0=Sun..6=Sat) so the strip always lines up\n * under the weekday labels regardless of which weekday the bill lands on.\n */\nexport const buildWeekStrip = (dueDate: Date): SevenDays => {\n const dow = dueDate.getDay()\n const sunday = new Date(dueDate)\n sunday.setDate(dueDate.getDate() - dow)\n\n const days = DAY_LABELS.map((label, idx): UpcomingBillDay => {\n const cell = new Date(sunday)\n cell.setDate(sunday.getDate() + idx)\n const day: UpcomingBillDay = { label, date: String(cell.getDate()) }\n if (idx === dow) day.highlighted = true\n return day\n })\n\n return days as unknown as SevenDays\n}\n\n/**\n * Build the current Sun→Sat week with NO cell highlighted. Used as the degraded\n * strip when `due_date` is missing or unparseable — the card still renders\n * (merchant row with name + amount) but the strip has no \"due day\" callout.\n */\nconst buildUnhighlightedCurrentWeek = (): SevenDays => {\n const base = new Date()\n const dow = base.getDay()\n const sunday = new Date(base)\n sunday.setDate(base.getDate() - dow)\n\n const days = DAY_LABELS.map((label, idx): UpcomingBillDay => {\n const cell = new Date(sunday)\n cell.setDate(sunday.getDate() + idx)\n return { label, date: String(cell.getDate()) }\n })\n\n return days as unknown as SevenDays\n}\n\nconst ProjectedBillPaymentVariant = ({ payload }: UpcomingBillBlockProps) => {\n const { instance_slot } = payload\n const { amount, due_date, merchant_guid, merchant_name } = instance_slot\n\n // Both missing and malformed `due_date` degrade to the same \"no highlighted cell\" case —\n // we never want to silently show today's week as if it were due today. UpcomingBillCard\n // requires a 7-tuple, so we still render a neutral current-week strip so the merchant row\n // (name + amount) stays visible. Returning null would hide the whole insight for just a\n // bad date, which costs the user more information than it saves.\n const parsed = due_date ? parseDueDate(due_date) : null\n const days = parsed ? buildWeekStrip(parsed) : buildUnhighlightedCurrentWeek()\n\n return (\n <Stack sx={{ px: 16 }}>\n <UpcomingBillCard\n amount={formatCurrency(amount ?? 0, '0,0.00')}\n days={days}\n logo={\n merchant_guid ? (\n <LogoFromGuid logo={{ alt: merchant_name ?? '', guid: merchant_guid }} size={24} />\n ) : null\n }\n merchantName={merchant_name ?? ''}\n />\n </Stack>\n )\n}\n\n/**\n * Upcoming Bill component block (Figma: \"Full | Upcoming Bill\"). Reads `due_date`,\n * `amount` and merchant facts off `instance_slot` (V2 flat shape — no\n * `instance_slot_data`), derives the Sun→Sat week around the due date, and renders\n * the shared `UpcomingBillCard`.\n *\n * Wrapped in `createVariantBlock` from day one so an added design branch is a new\n * registry entry, not a rewrite of dispatch logic. Today only\n * `projected_bill_payment` is defined; an unknown variant degrades to it.\n *\n * Degraded-date rendering: if `due_date` is missing or doesn't parse to a valid\n * Date (e.g. `'2026-13-40'`, `''`, an unparseable arbitrary string), the card\n * still renders — merchant row + amount — but with a neutral current-week strip\n * (no highlighted cell). `UpcomingBillCard` requires a 7-tuple `days` prop so we\n * cannot omit the strip without modifying the shared component; the \"no highlighted\n * cell\" fallback keeps the useful info visible without pretending today is the\n * due day.\n */\nconst UpcomingBillBlock = ({ payload, beatGuid }: UpcomingBillBlockProps) => {\n const variant = payload.instance_slot.variant ?? undefined\n return <Variants beatGuid={beatGuid} payload={payload} variant={variant} />\n}\n\nconst Variants = createVariantBlock<UpcomingBillBlockProps>({\n variants: {\n [upcomingBillVariant.Pro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
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Design branches of the Upcoming Bill component block.
|
|
3
|
-
*
|
|
4
|
-
* - `ProjectedBillPayment` — the only variant today (Figma: "Full | Upcoming Bill"):
|
|
5
|
-
* week strip + merchant row + amount.
|
|
6
|
-
*
|
|
7
|
-
* Scaffolded through `createVariantBlock` so adding a future design branch is a new
|
|
8
|
-
* registry entry rather than editing dispatch logic.
|
|
9
|
-
*/
|
|
10
|
-
export declare const upcomingBillVariant: {
|
|
11
|
-
readonly ProjectedBillPayment: "projected_bill_payment";
|
|
12
|
-
};
|
|
13
|
-
export type UpcomingBillVariant = (typeof upcomingBillVariant)[keyof typeof upcomingBillVariant];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/UpcomingBillBlock/layout.ts"],"sourcesContent":["/**\n * Design branches of the Upcoming Bill component block.\n *\n * - `ProjectedBillPayment` — the only variant today (Figma: \"Full | Upcoming Bill\"):\n * week strip + merchant row + amount.\n *\n * Scaffolded through `createVariantBlock` so adding a future design branch is a new\n * registry entry rather than editing dispatch logic.\n */\nexport const upcomingBillVariant = {\n ProjectedBillPayment: 'projected_bill_payment',\n} as const\n\nexport type UpcomingBillVariant = (typeof upcomingBillVariant)[keyof typeof upcomingBillVariant]\n"],"mappings":"AASA,IAAa,IAAsB,EACjC,sBAAsB,yBACxB"}
|