@mx-cartographer/experiences 9.7.75 → 9.7.77
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 +10 -0
- package/dist/insights-v2/actionBlocks/SurveyModalActionBlock.es.js +28 -20
- package/dist/insights-v2/actionBlocks/SurveyModalActionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +11 -11
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js +3 -3
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +75 -68
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.d.ts +4 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js +2 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/components/BaseLayout.es.js +40 -40
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/components/CtaStatus.d.ts +2 -2
- package/dist/insights-v2/components/CtaStatus.es.js +23 -14
- package/dist/insights-v2/components/CtaStatus.es.js.map +1 -1
- package/dist/insights-v2/components/FeedbackDialog.d.ts +3 -1
- package/dist/insights-v2/components/FeedbackDialog.es.js +28 -28
- package/dist/insights-v2/components/FeedbackDialog.es.js.map +1 -1
- package/dist/insights-v2/components/FeedbackModal.d.ts +3 -1
- package/dist/insights-v2/components/FeedbackModal.es.js +17 -16
- package/dist/insights-v2/components/FeedbackModal.es.js.map +1 -1
- package/dist/insights-v2/components/InsightTransactionRow.d.ts +3 -1
- package/dist/insights-v2/components/InsightTransactionRow.es.js +36 -19
- package/dist/insights-v2/components/InsightTransactionRow.es.js.map +1 -1
- package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.d.ts +4 -0
- package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.es.js +11 -0
- package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.es.js.map +1 -0
- package/dist/insights-v2/components/SurveyModal.d.ts +5 -1
- package/dist/insights-v2/components/SurveyModal.es.js +46 -38
- package/dist/insights-v2/components/SurveyModal.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/ctaConfig.es.js +19 -11
- package/dist/insights-v2/ctaActions/ctaConfig.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/index.d.ts +1 -1
- package/dist/insights-v2/ctaActions/runCtaAction.d.ts +5 -1
- package/dist/insights-v2/ctaActions/runCtaAction.es.js +4 -4
- package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/subscriptionAnswer.d.ts +4 -2
- package/dist/insights-v2/ctaActions/subscriptionAnswer.es.js +136 -0
- package/dist/insights-v2/ctaActions/subscriptionAnswer.es.js.map +1 -0
- package/dist/insights-v2/ctaActions/types.d.ts +12 -0
- package/dist/insights-v2/ctaActions/useCtaAction.d.ts +4 -1
- package/dist/insights-v2/ctaActions/useCtaAction.es.js +33 -33
- package/dist/insights-v2/ctaActions/useCtaAction.es.js.map +1 -1
- package/dist/networth/NetWorthWidget.d.ts +2 -0
- package/dist/networth/NetWorthWidget.es.js +62 -58
- package/dist/networth/NetWorthWidget.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { useEffect as
|
|
4
|
-
import { Fragment as
|
|
5
|
-
var
|
|
6
|
-
const [t, o] =
|
|
7
|
-
|
|
1
|
+
import T from "./shared/StatusSnackbar.es.js";
|
|
2
|
+
import A from "./FeedbackDialog.es.js";
|
|
3
|
+
import { useEffect as S, useRef as l, useState as C } from "react";
|
|
4
|
+
import { Fragment as F, jsx as b, jsxs as M } from "react/jsx-runtime";
|
|
5
|
+
var B = ({ copy: e, isOpen: a, onBack: m, onClose: c, onSubmit: d, onTextInputFocus: h, showSuccessMessage: v = !0, showDetailField: x = !0 }) => {
|
|
6
|
+
const [t, o] = C("survey"), n = l(!1), s = l(null);
|
|
7
|
+
S(() => {
|
|
8
8
|
a && (o("survey"), n.current = !1, s.current = null);
|
|
9
9
|
}, [a]);
|
|
10
10
|
const f = async (r, i) => {
|
|
@@ -17,11 +17,11 @@ var y = ({ copy: e, isOpen: a, onBack: m, onClose: c, onSubmit: d, onTextInputFo
|
|
|
17
17
|
} catch {
|
|
18
18
|
o("error");
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, g = () => {
|
|
21
21
|
s.current && f(s.current.option, s.current.detail);
|
|
22
|
-
}, u = l(!1),
|
|
22
|
+
}, u = l(!1), k = m ? () => {
|
|
23
23
|
u.current = !0, m();
|
|
24
|
-
} : void 0,
|
|
24
|
+
} : void 0, L = (r) => {
|
|
25
25
|
if (!n.current) {
|
|
26
26
|
if (u.current) {
|
|
27
27
|
u.current = !1;
|
|
@@ -30,13 +30,13 @@ var y = ({ copy: e, isOpen: a, onBack: m, onClose: c, onSubmit: d, onTextInputFo
|
|
|
30
30
|
c(r);
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
return /* @__PURE__ */ F
|
|
33
|
+
return /* @__PURE__ */ M(F, { children: [/* @__PURE__ */ b(A, {
|
|
34
34
|
characterLimitLabel: e.characterLimitLabel,
|
|
35
35
|
closeAriaLabel: e.closeAriaLabel,
|
|
36
36
|
description: e.description,
|
|
37
37
|
isOpen: a && t === "survey" && !n.current,
|
|
38
|
-
onBackClick:
|
|
39
|
-
onClose:
|
|
38
|
+
onBackClick: k,
|
|
39
|
+
onClose: L,
|
|
40
40
|
onSubmit: (r, i) => {
|
|
41
41
|
f(r, i);
|
|
42
42
|
},
|
|
@@ -44,19 +44,20 @@ var y = ({ copy: e, isOpen: a, onBack: m, onClose: c, onSubmit: d, onTextInputFo
|
|
|
44
44
|
options: e.options,
|
|
45
45
|
primaryText: e.submitText,
|
|
46
46
|
secondaryText: e.cancelText,
|
|
47
|
+
showDetailField: x,
|
|
47
48
|
title: e.title
|
|
48
|
-
}), /* @__PURE__ */ b(
|
|
49
|
+
}), /* @__PURE__ */ b(T, {
|
|
49
50
|
actionText: t === "error" ? e.tryAgainText : void 0,
|
|
50
51
|
closeAriaLabel: e.toastCloseAriaLabel,
|
|
51
52
|
message: t === "error" ? e.errorMessage : e.successMessage,
|
|
52
|
-
onActionClick:
|
|
53
|
+
onActionClick: g,
|
|
53
54
|
onClose: () => c(),
|
|
54
55
|
open: a && t !== "survey",
|
|
55
56
|
severity: t === "error" ? "error" : "success"
|
|
56
57
|
})] });
|
|
57
58
|
};
|
|
58
59
|
export {
|
|
59
|
-
|
|
60
|
+
B as default
|
|
60
61
|
};
|
|
61
62
|
|
|
62
63
|
//# sourceMappingURL=FeedbackModal.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedbackModal.es.js","names":[],"sources":["../../../src/insights-v2/components/FeedbackModal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\n\nimport StatusSnackbar from './shared/StatusSnackbar'\n\nimport FeedbackDialog, { type FeedbackDialogCloseReason } from './FeedbackDialog'\n\n/** Localized strings the modal renders — resolved by the caller (see FeedbackModalActionBlock). */\nexport interface FeedbackModalContent {\n /** Dialog title, e.g. \"Can you tell us why?\". */\n title: string\n /** Optional paragraph under the title, e.g. \"We'd love to hear why…\". */\n description?: string\n /** Survey reasons; the last option reveals the free-text detail field. */\n options: string[]\n /** Primary (Submit) button label. */\n submitText: string\n /** Secondary (No thanks) button label. */\n cancelText: string\n /** ARIA label for the dialog close button. */\n closeAriaLabel: string\n /** Helper text under the detail field, e.g. \"250 character limit\". */\n characterLimitLabel?: string\n /** Success snackbar message, e.g. \"Your feedback has been submitted.\". */\n successMessage: string\n /** Error snackbar message, e.g. \"Your feedback could not be submitted.\". */\n errorMessage: string\n /** Error snackbar action label, e.g. \"Try Again\". */\n tryAgainText: string\n /** ARIA label for the snackbar close button. */\n toastCloseAriaLabel: string\n}\n\ninterface FeedbackModalProps {\n isOpen: boolean\n copy: FeedbackModalContent\n /**\n * Fired when the survey is submitted. May return a promise: a rejection\n * switches to the error snackbar (Figma `1941:167637`), whose Try Again\n * action re-submits the same selection. Sync/resolved submissions show the\n * success snackbar.\n */\n onSubmit: (option: string, detail?: string) => void | Promise<void>\n /**\n * Fired when the whole flow ends: the dialog is dismissed without submitting\n * (reason set), or either snackbar is closed / auto-hides (no reason).\n */\n onClose: (reason?: FeedbackDialogCloseReason) => void\n /**\n * When provided, the secondary button acts as \"Back\" — it fires this instead\n * of ending the flow via `onClose` (e.g. SurveyModal returning to its survey\n * step). When absent, the secondary (\"No thanks\") ends the flow as before.\n */\n onBack?: () => void\n /** First focus of the free-text box (analytics). */\n onTextInputFocus?: () => void\n /** Default true. When false a successful submit calls `onClose` (the host confirms); errors still show. */\n showSuccessMessage?: boolean\n}\n\ntype Phase = 'survey' | 'success' | 'error'\n\n/**\n * The CTA feedback drilldown (Figma `1941:192803`): a \"Can you tell us why?\"\n * survey dialog followed by a success snackbar (Figma `1941:167636`) — or an\n * error snackbar with a Try Again action (Figma `1941:167637`) when the\n * submission fails.\n *\n * Purely presentational — copy arrives resolved via `FeedbackModalContent`;\n * the `feedback_modal_block` action block wires it to the copy store, the beat\n * actions, and the action-drawer session.\n */\nconst FeedbackModal = ({\n copy,\n isOpen,\n onBack,\n onClose,\n onSubmit,\n onTextInputFocus,\n showSuccessMessage = true,\n}: FeedbackModalProps) => {\n const [phase, setPhase] = useState<Phase>('survey')\n // Ref, not state: the shared Dialog fires `onClose()` synchronously right\n // after `onPrimaryAction()`, before the state update lands. Without the ref\n // that close would end the whole flow and the snackbar could never show.\n const hasSubmitted = useRef(false)\n // Kept for the error snackbar's Try Again, which re-submits the selection.\n const lastSubmission = useRef<{ option: string; detail?: string } | null>(null)\n\n // A new flow session starts from the survey, not a stale snackbar.\n useEffect(() => {\n if (isOpen) {\n setPhase('survey')\n hasSubmitted.current = false\n lastSubmission.current = null\n }\n }, [isOpen])\n\n const submit = async (option: string, detail?: string) => {\n hasSubmitted.current = true\n lastSubmission.current = { option, detail }\n try {\n await onSubmit(option, detail)\n if (showSuccessMessage) setPhase('success')\n else onClose()\n } catch {\n setPhase('error')\n }\n }\n\n const retry = () => {\n if (lastSubmission.current) {\n void submit(lastSubmission.current.option, lastSubmission.current.detail)\n }\n }\n\n // Ref for the same reason as hasSubmitted: the back-click's trailing Dialog\n // close fires synchronously, before any state lands.\n const backTaken = useRef(false)\n\n const handleBack = onBack\n ? () => {\n backTaken.current = true\n onBack()\n }\n : undefined\n\n // Only user-initiated closes (X / backdrop / escape / No thanks) end the\n // flow — the post-submit close hands over to the snackbar, and a back-click's\n // trailing close belongs to the caller's back navigation.\n const handleDialogClose = (reason?: FeedbackDialogCloseReason) => {\n if (hasSubmitted.current) return\n if (backTaken.current) {\n backTaken.current = false\n return\n }\n onClose(reason)\n }\n\n return (\n <>\n <FeedbackDialog\n characterLimitLabel={copy.characterLimitLabel}\n closeAriaLabel={copy.closeAriaLabel}\n description={copy.description}\n isOpen={isOpen && phase === 'survey' && !hasSubmitted.current}\n onBackClick={handleBack}\n onClose={handleDialogClose}\n onSubmit={(option, detail) => void submit(option, detail)}\n onTextInputFocus={onTextInputFocus}\n options={copy.options}\n primaryText={copy.submitText}\n secondaryText={copy.cancelText}\n title={copy.title}\n />\n <StatusSnackbar\n actionText={phase === 'error' ? copy.tryAgainText : undefined}\n closeAriaLabel={copy.toastCloseAriaLabel}\n message={phase === 'error' ? copy.errorMessage : copy.successMessage}\n onActionClick={retry}\n onClose={() => onClose()}\n open={isOpen && phase !== 'survey'}\n severity={phase === 'error' ? 'error' : 'success'}\n />\n </>\n )\n}\n\nexport default FeedbackModal\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"FeedbackModal.es.js","names":[],"sources":["../../../src/insights-v2/components/FeedbackModal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\n\nimport StatusSnackbar from './shared/StatusSnackbar'\n\nimport FeedbackDialog, { type FeedbackDialogCloseReason } from './FeedbackDialog'\n\n/** Localized strings the modal renders — resolved by the caller (see FeedbackModalActionBlock). */\nexport interface FeedbackModalContent {\n /** Dialog title, e.g. \"Can you tell us why?\". */\n title: string\n /** Optional paragraph under the title, e.g. \"We'd love to hear why…\". */\n description?: string\n /** Survey reasons; the last option reveals the free-text detail field. */\n options: string[]\n /** Primary (Submit) button label. */\n submitText: string\n /** Secondary (No thanks) button label. */\n cancelText: string\n /** ARIA label for the dialog close button. */\n closeAriaLabel: string\n /** Helper text under the detail field, e.g. \"250 character limit\". */\n characterLimitLabel?: string\n /** Success snackbar message, e.g. \"Your feedback has been submitted.\". */\n successMessage: string\n /** Error snackbar message, e.g. \"Your feedback could not be submitted.\". */\n errorMessage: string\n /** Error snackbar action label, e.g. \"Try Again\". */\n tryAgainText: string\n /** ARIA label for the snackbar close button. */\n toastCloseAriaLabel: string\n}\n\ninterface FeedbackModalProps {\n isOpen: boolean\n copy: FeedbackModalContent\n /**\n * Fired when the survey is submitted. May return a promise: a rejection\n * switches to the error snackbar (Figma `1941:167637`), whose Try Again\n * action re-submits the same selection. Sync/resolved submissions show the\n * success snackbar.\n */\n onSubmit: (option: string, detail?: string) => void | Promise<void>\n /**\n * Fired when the whole flow ends: the dialog is dismissed without submitting\n * (reason set), or either snackbar is closed / auto-hides (no reason).\n */\n onClose: (reason?: FeedbackDialogCloseReason) => void\n /**\n * When provided, the secondary button acts as \"Back\" — it fires this instead\n * of ending the flow via `onClose` (e.g. SurveyModal returning to its survey\n * step). When absent, the secondary (\"No thanks\") ends the flow as before.\n */\n onBack?: () => void\n /** First focus of the free-text box (analytics). */\n onTextInputFocus?: () => void\n /** Default true. When false a successful submit calls `onClose` (the host confirms); errors still show. */\n showSuccessMessage?: boolean\n /** Default true. When false the last option is a plain choice, with no free-text field. */\n showDetailField?: boolean\n}\n\ntype Phase = 'survey' | 'success' | 'error'\n\n/**\n * The CTA feedback drilldown (Figma `1941:192803`): a \"Can you tell us why?\"\n * survey dialog followed by a success snackbar (Figma `1941:167636`) — or an\n * error snackbar with a Try Again action (Figma `1941:167637`) when the\n * submission fails.\n *\n * Purely presentational — copy arrives resolved via `FeedbackModalContent`;\n * the `feedback_modal_block` action block wires it to the copy store, the beat\n * actions, and the action-drawer session.\n */\nconst FeedbackModal = ({\n copy,\n isOpen,\n onBack,\n onClose,\n onSubmit,\n onTextInputFocus,\n showSuccessMessage = true,\n showDetailField = true,\n}: FeedbackModalProps) => {\n const [phase, setPhase] = useState<Phase>('survey')\n // Ref, not state: the shared Dialog fires `onClose()` synchronously right\n // after `onPrimaryAction()`, before the state update lands. Without the ref\n // that close would end the whole flow and the snackbar could never show.\n const hasSubmitted = useRef(false)\n // Kept for the error snackbar's Try Again, which re-submits the selection.\n const lastSubmission = useRef<{ option: string; detail?: string } | null>(null)\n\n // A new flow session starts from the survey, not a stale snackbar.\n useEffect(() => {\n if (isOpen) {\n setPhase('survey')\n hasSubmitted.current = false\n lastSubmission.current = null\n }\n }, [isOpen])\n\n const submit = async (option: string, detail?: string) => {\n hasSubmitted.current = true\n lastSubmission.current = { option, detail }\n try {\n await onSubmit(option, detail)\n if (showSuccessMessage) setPhase('success')\n else onClose()\n } catch {\n setPhase('error')\n }\n }\n\n const retry = () => {\n if (lastSubmission.current) {\n void submit(lastSubmission.current.option, lastSubmission.current.detail)\n }\n }\n\n // Ref for the same reason as hasSubmitted: the back-click's trailing Dialog\n // close fires synchronously, before any state lands.\n const backTaken = useRef(false)\n\n const handleBack = onBack\n ? () => {\n backTaken.current = true\n onBack()\n }\n : undefined\n\n // Only user-initiated closes (X / backdrop / escape / No thanks) end the\n // flow — the post-submit close hands over to the snackbar, and a back-click's\n // trailing close belongs to the caller's back navigation.\n const handleDialogClose = (reason?: FeedbackDialogCloseReason) => {\n if (hasSubmitted.current) return\n if (backTaken.current) {\n backTaken.current = false\n return\n }\n onClose(reason)\n }\n\n return (\n <>\n <FeedbackDialog\n characterLimitLabel={copy.characterLimitLabel}\n closeAriaLabel={copy.closeAriaLabel}\n description={copy.description}\n isOpen={isOpen && phase === 'survey' && !hasSubmitted.current}\n onBackClick={handleBack}\n onClose={handleDialogClose}\n onSubmit={(option, detail) => void submit(option, detail)}\n onTextInputFocus={onTextInputFocus}\n options={copy.options}\n primaryText={copy.submitText}\n secondaryText={copy.cancelText}\n showDetailField={showDetailField}\n title={copy.title}\n />\n <StatusSnackbar\n actionText={phase === 'error' ? copy.tryAgainText : undefined}\n closeAriaLabel={copy.toastCloseAriaLabel}\n message={phase === 'error' ? copy.errorMessage : copy.successMessage}\n onActionClick={retry}\n onClose={() => onClose()}\n open={isOpen && phase !== 'survey'}\n severity={phase === 'error' ? 'error' : 'success'}\n />\n </>\n )\n}\n\nexport default FeedbackModal\n"],"mappings":";;;;AAyEA,IAAM,IAAA,CAAiB,EACrB,MAAA,GACA,QAAA,GACA,QAAA,GACA,SAAA,GACA,UAAA,GACA,kBAAA,GACA,oBAAA,IAAqB,IACrB,iBAAA,IAAkB,GAAA,MACM;AACxB,QAAM,CAAC,GAAO,CAAA,IAAY,EAAgB,QAAQ,GAI5C,IAAe,EAAO,EAAK,GAE3B,IAAiB,EAAmD,IAAI;AAG9E,EAAA,EAAA,MAAgB;AACd,IAAI,MACF,EAAS,QAAQ,GACjB,EAAa,UAAU,IACvB,EAAe,UAAU;AAAA,EAE7B,GAAG,CAAC,CAAM,CAAC;AAEX,QAAM,IAAS,OAAO,GAAgB,MAAoB;AACxD,IAAA,EAAa,UAAU,IACvB,EAAe,UAAU;AAAA,MAAE,QAAA;AAAA,MAAQ,QAAA;AAAA,IAAO;AAC1C,QAAI;AACF,YAAM,EAAS,GAAQ,CAAM,GACzB,IAAoB,EAAS,SAAS,IACrC,EAAQ;AAAA,IACf,QAAQ;AACN,MAAA,EAAS,OAAO;AAAA,IAClB;AAAA,EACF,GAEM,IAAA,MAAc;AAClB,IAAI,EAAe,WACjB,EAAY,EAAe,QAAQ,QAAQ,EAAe,QAAQ,MAAM;AAAA,EAE5E,GAIM,IAAY,EAAO,EAAK,GAExB,IAAa,IAAA,MACT;AACJ,IAAA,EAAU,UAAU,IACpB,EAAO;AAAA,EACT,IACA,QAKE,IAAA,CAAqB,MAAuC;AAChE,QAAI,CAAA,EAAa,SACjB;AAAA,UAAI,EAAU,SAAS;AACrB,QAAA,EAAU,UAAU;AACpB;AAAA,MACF;AACA,MAAA,EAAQ,CAAM;AAAA;AAAA,EAChB;AAEA,SACE,gBAAA,EAAA,GAAA,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IACE,qBAAqB,EAAK;AAAA,IAC1B,gBAAgB,EAAK;AAAA,IACrB,aAAa,EAAK;AAAA,IAClB,QAAQ,KAAU,MAAU,YAAY,CAAC,EAAa;AAAA,IACtD,aAAa;AAAA,IACb,SAAS;AAAA,IACT,UAAA,CAAW,GAAQ,MAAA;AAAW,MAAK,EAAO,GAAQ,CAAM;AAAA;AAAA,IACtC,kBAAA;AAAA,IAClB,SAAS,EAAK;AAAA,IACd,aAAa,EAAK;AAAA,IAClB,eAAe,EAAK;AAAA,IACH,iBAAA;AAAA,IACjB,OAAO,EAAK;AAAA,EACb,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,IACE,YAAY,MAAU,UAAU,EAAK,eAAe;AAAA,IACpD,gBAAgB,EAAK;AAAA,IACrB,SAAS,MAAU,UAAU,EAAK,eAAe,EAAK;AAAA,IACtD,eAAe;AAAA,IACf,SAAA,MAAe,EAAQ;AAAA,IACvB,MAAM,KAAU,MAAU;AAAA,IAC1B,UAAU,MAAU,UAAU,UAAU;AAAA,EACzC,CAAA,CACD,EAAA,CAAA;AAEN"}
|
|
@@ -11,6 +11,8 @@ export interface InsightTransactionRowProps {
|
|
|
11
11
|
amount: ReactNode;
|
|
12
12
|
/** Theme token for the amount text (e.g. 'success.main' for credits). */
|
|
13
13
|
amountColor?: string;
|
|
14
|
+
/** Caption under the amount (e.g. a frequency). */
|
|
15
|
+
amountCaption?: ReactNode;
|
|
14
16
|
sx?: SxProps;
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
@@ -19,5 +21,5 @@ export interface InsightTransactionRowProps {
|
|
|
19
21
|
* `InsightTransactionRow` to avoid colliding with the transactions widget's
|
|
20
22
|
* public `TransactionRow` export.
|
|
21
23
|
*/
|
|
22
|
-
declare const InsightTransactionRow: ({ amount, amountColor, leading, subtitle, title, sx, }: InsightTransactionRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare const InsightTransactionRow: ({ amount, amountCaption, amountColor, leading, subtitle, title, sx, }: InsightTransactionRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
25
|
export default InsightTransactionRow;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import t from "@mui/material/Stack";
|
|
2
|
-
import { Text as
|
|
3
|
-
import { jsx as r, jsxs as
|
|
2
|
+
import { Text as e } from "@mxenabled/mxui";
|
|
3
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
4
|
import m from "@mui/material/Box";
|
|
5
|
-
var
|
|
5
|
+
var g = ({ amount: o, amountCaption: n, amountColor: l = "text.primary", leading: a, subtitle: c, title: x, sx: s }) => /* @__PURE__ */ i(t, {
|
|
6
6
|
sx: {
|
|
7
7
|
alignItems: "flex-start",
|
|
8
8
|
flexDirection: "row",
|
|
@@ -10,9 +10,9 @@ var f = ({ amount: o, amountColor: a = "text.primary", leading: n, subtitle: l,
|
|
|
10
10
|
px: 16,
|
|
11
11
|
py: 14,
|
|
12
12
|
width: "100%",
|
|
13
|
-
...
|
|
13
|
+
...s
|
|
14
14
|
},
|
|
15
|
-
children: [/* @__PURE__ */
|
|
15
|
+
children: [/* @__PURE__ */ i(t, {
|
|
16
16
|
sx: {
|
|
17
17
|
alignItems: "center",
|
|
18
18
|
flexDirection: "row",
|
|
@@ -20,37 +20,54 @@ var f = ({ amount: o, amountColor: a = "text.primary", leading: n, subtitle: l,
|
|
|
20
20
|
gap: 12,
|
|
21
21
|
minWidth: 0
|
|
22
22
|
},
|
|
23
|
-
children: [
|
|
23
|
+
children: [a && /* @__PURE__ */ r(m, {
|
|
24
24
|
sx: { flexShrink: 0 },
|
|
25
|
-
children:
|
|
26
|
-
}), /* @__PURE__ */
|
|
25
|
+
children: a
|
|
26
|
+
}), /* @__PURE__ */ i(t, {
|
|
27
27
|
sx: { minWidth: 0 },
|
|
28
|
-
children: [/* @__PURE__ */ r(
|
|
28
|
+
children: [/* @__PURE__ */ r(e, {
|
|
29
29
|
bold: !0,
|
|
30
30
|
truncate: !0,
|
|
31
31
|
variant: "body1",
|
|
32
32
|
children: x
|
|
33
|
-
}), /* @__PURE__ */ r(
|
|
33
|
+
}), /* @__PURE__ */ r(e, {
|
|
34
34
|
color: "text.primary",
|
|
35
35
|
truncate: !0,
|
|
36
36
|
variant: "caption",
|
|
37
|
-
children:
|
|
37
|
+
children: c
|
|
38
38
|
})]
|
|
39
39
|
})]
|
|
40
|
-
}), /* @__PURE__ */
|
|
41
|
-
bold: !0,
|
|
42
|
-
color: a,
|
|
40
|
+
}), /* @__PURE__ */ i(t, {
|
|
43
41
|
sx: {
|
|
42
|
+
alignItems: "flex-end",
|
|
44
43
|
flexShrink: 0,
|
|
45
|
-
|
|
46
|
-
letterSpacing: "-0.15px"
|
|
44
|
+
gap: 4
|
|
47
45
|
},
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
children: [/* @__PURE__ */ r(e, {
|
|
47
|
+
bold: !0,
|
|
48
|
+
color: l,
|
|
49
|
+
sx: {
|
|
50
|
+
fontVariantNumeric: "lining-nums tabular-nums",
|
|
51
|
+
letterSpacing: "-0.15px"
|
|
52
|
+
},
|
|
53
|
+
variant: "body1",
|
|
54
|
+
children: o
|
|
55
|
+
}), n && /* @__PURE__ */ r(e, {
|
|
56
|
+
color: "text.secondary",
|
|
57
|
+
sx: {
|
|
58
|
+
fontSize: 9,
|
|
59
|
+
fontWeight: 700,
|
|
60
|
+
letterSpacing: "0.03em",
|
|
61
|
+
lineHeight: "12px",
|
|
62
|
+
textTransform: "uppercase"
|
|
63
|
+
},
|
|
64
|
+
variant: "caption",
|
|
65
|
+
children: n
|
|
66
|
+
})]
|
|
50
67
|
})]
|
|
51
68
|
});
|
|
52
69
|
export {
|
|
53
|
-
|
|
70
|
+
g as default
|
|
54
71
|
};
|
|
55
72
|
|
|
56
73
|
//# sourceMappingURL=InsightTransactionRow.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InsightTransactionRow.es.js","names":[],"sources":["../../../src/insights-v2/components/InsightTransactionRow.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\nexport interface InsightTransactionRowProps {\n /** Leading visual: merchant/institution logo, category icon, or date badge. */\n leading?: ReactNode\n /** Primary line (e.g. merchant, payee, transaction name). */\n title: ReactNode\n /** Secondary line beneath the title (e.g. category). */\n subtitle: ReactNode\n /** Trailing amount, pre-formatted by the caller. */\n amount: ReactNode\n /** Theme token for the amount text (e.g. 'success.main' for credits). */\n amountColor?: string\n sx?: SxProps\n}\n\n/**\n * A single transaction/list row for the insights-v2 transaction-list family:\n * leading visual + title/subtitle on the left, amount on the right. Named\n * `InsightTransactionRow` to avoid colliding with the transactions widget's\n * public `TransactionRow` export.\n */\nconst InsightTransactionRow = ({\n amount,\n amountColor = 'text.primary',\n leading,\n subtitle,\n title,\n sx,\n}: InsightTransactionRowProps) => (\n <Stack\n sx={{\n // The amount shares the title's top line while the subtitle sits below, so\n // the row is top-aligned and the inner left group is centered.\n alignItems: 'flex-start',\n flexDirection: 'row',\n gap: 16,\n px: 16,\n py: 14,\n width: '100%',\n ...sx,\n }}\n >\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', flexGrow: 1, gap: 12, minWidth: 0 }}>\n {leading && <Box sx={{ flexShrink: 0 }}>{leading}</Box>}\n <Stack sx={{ minWidth: 0 }}>\n <Text bold={true} truncate={true} variant=\"body1\">\n {title}\n </Text>\n <Text color=\"text.primary\" truncate={true} variant=\"caption\">\n {subtitle}\n </Text>\n </Stack>\n </Stack>\n {/* Figma `typography/body1 (bold tabular)`: tabular figures so amounts align column-wise. */}\n <Text\n
|
|
1
|
+
{"version":3,"file":"InsightTransactionRow.es.js","names":[],"sources":["../../../src/insights-v2/components/InsightTransactionRow.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\nexport interface InsightTransactionRowProps {\n /** Leading visual: merchant/institution logo, category icon, or date badge. */\n leading?: ReactNode\n /** Primary line (e.g. merchant, payee, transaction name). */\n title: ReactNode\n /** Secondary line beneath the title (e.g. category). */\n subtitle: ReactNode\n /** Trailing amount, pre-formatted by the caller. */\n amount: ReactNode\n /** Theme token for the amount text (e.g. 'success.main' for credits). */\n amountColor?: string\n /** Caption under the amount (e.g. a frequency). */\n amountCaption?: ReactNode\n sx?: SxProps\n}\n\n/**\n * A single transaction/list row for the insights-v2 transaction-list family:\n * leading visual + title/subtitle on the left, amount on the right. Named\n * `InsightTransactionRow` to avoid colliding with the transactions widget's\n * public `TransactionRow` export.\n */\nconst InsightTransactionRow = ({\n amount,\n amountCaption,\n amountColor = 'text.primary',\n leading,\n subtitle,\n title,\n sx,\n}: InsightTransactionRowProps) => (\n <Stack\n sx={{\n // The amount shares the title's top line while the subtitle sits below, so\n // the row is top-aligned and the inner left group is centered.\n alignItems: 'flex-start',\n flexDirection: 'row',\n gap: 16,\n px: 16,\n py: 14,\n width: '100%',\n ...sx,\n }}\n >\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', flexGrow: 1, gap: 12, minWidth: 0 }}>\n {leading && <Box sx={{ flexShrink: 0 }}>{leading}</Box>}\n <Stack sx={{ minWidth: 0 }}>\n <Text bold={true} truncate={true} variant=\"body1\">\n {title}\n </Text>\n <Text color=\"text.primary\" truncate={true} variant=\"caption\">\n {subtitle}\n </Text>\n </Stack>\n </Stack>\n {/* Figma `typography/body1 (bold tabular)`: tabular figures so amounts align column-wise. */}\n <Stack sx={{ alignItems: 'flex-end', flexShrink: 0, gap: 4 }}>\n <Text\n bold={true}\n color={amountColor}\n sx={{\n fontVariantNumeric: 'lining-nums tabular-nums',\n letterSpacing: '-0.15px',\n }}\n variant=\"body1\"\n >\n {amount}\n </Text>\n {amountCaption && (\n <Text\n color=\"text.secondary\"\n sx={{\n fontSize: 9,\n fontWeight: 700,\n letterSpacing: '0.03em',\n lineHeight: '12px',\n textTransform: 'uppercase',\n }}\n variant=\"caption\"\n >\n {amountCaption}\n </Text>\n )}\n </Stack>\n </Stack>\n)\n\nexport default InsightTransactionRow\n"],"mappings":";;;;AA8BA,IAAM,IAAA,CAAyB,EAC7B,QAAA,GACA,eAAA,GACA,aAAA,IAAc,gBACd,SAAA,GACA,UAAA,GACA,OAAA,GACA,IAAA,EAAA,MAEA,gBAAA,EAAC,GAAD;AAAA,EACE,IAAI;AAAA,IAGF,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,GAAG;AAAA,EACL;AAAA,EAXF,UAAA,CAaE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,YAAY;AAAA,MAAU,eAAe;AAAA,MAAO,UAAU;AAAA,MAAG,KAAK;AAAA,MAAI,UAAU;AAAA,IAAE;AAAA,IAA3F,UAAA,CACG,KAAW,gBAAA,EAAC,GAAD;AAAA,MAAK,IAAI,EAAE,YAAY,EAAE;AAAA,MAAI,UAAA;AAAA,IAAa,CAAA,GACtD,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI,EAAE,UAAU,EAAE;AAAA,MAAzB,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,QAAM,MAAM;AAAA,QAAM,UAAU;AAAA,QAAM,SAAQ;AAAA,QACvC,UAAA;AAAA,MACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,QAAM,OAAM;AAAA,QAAe,UAAU;AAAA,QAAM,SAAQ;AAAA,QAChD,UAAA;AAAA,MACG,CAAA,CACD;AAAA,IACF,CAAA,CAAA;AAAA,EAEP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,YAAY;AAAA,MAAY,YAAY;AAAA,MAAG,KAAK;AAAA,IAAE;AAAA,IAA3D,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,IAAI;AAAA,QACF,oBAAoB;AAAA,QACpB,eAAe;AAAA,MACjB;AAAA,MACA,SAAQ;AAAA,MAEP,UAAA;AAAA,IACG,CAAA,GACL,KACC,gBAAA,EAAC,GAAD;AAAA,MACE,OAAM;AAAA,MACN,IAAI;AAAA,QACF,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,eAAe;AAAA,QACf,YAAY;AAAA,QACZ,eAAe;AAAA,MACjB;AAAA,MACA,SAAQ;AAAA,MAEP,UAAA;AAAA,IACG,CAAA,CAEH;AAAA,EACF,CAAA,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RepeatingTransaction } from '../../../core/types/RepeatingTransaction';
|
|
2
|
+
import { RecurringCopy } from '../../../core/types/localization/RecurringCopy';
|
|
3
|
+
/** Frequency word from `recurrence_type` (e.g. "Yearly"); unknown or unmapped → undefined. */
|
|
4
|
+
export declare const subscriptionFrequency: (copy: RecurringCopy | undefined, repeating: RepeatingTransaction | undefined) => string | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RECURRENCE_COPY as n } from "../../../common/constants/ScheduledPayment.es.js";
|
|
2
|
+
var p = (r, t) => {
|
|
3
|
+
const e = t?.recurrence_type, o = e ? n.find(({ id: i }) => i === e)?.copy : void 0;
|
|
4
|
+
if (!(!r || !o))
|
|
5
|
+
return r[o] || void 0;
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
p as subscriptionFrequency
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=subscriptionFrequency.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptionFrequency.es.js","names":[],"sources":["../../../../src/insights-v2/components/SubscriptionStatus/subscriptionFrequency.ts"],"sourcesContent":["import { RECURRENCE_COPY } from '../../../common/constants'\nimport type { RepeatingTransaction } from '../../../core/types/RepeatingTransaction'\nimport type { RecurringCopy } from '../../../core/types/localization/RecurringCopy'\n\n/** Frequency word from `recurrence_type` (e.g. \"Yearly\"); unknown or unmapped → undefined. */\nexport const subscriptionFrequency = (\n copy: RecurringCopy | undefined,\n repeating: RepeatingTransaction | undefined,\n): string | undefined => {\n const type: number | undefined = repeating?.recurrence_type\n // Same numbers as `Frequency`; 0 (unknown) has no word.\n const key = type ? RECURRENCE_COPY.find(({ id }) => id === type)?.copy : undefined\n\n if (!copy || !key) return undefined\n\n return copy[key as keyof RecurringCopy] || undefined\n}\n"],"mappings":";AAKA,IAAa,IAAA,CACX,GACA,MACuB;AACvB,QAAM,IAA2B,GAAW,iBAEtC,IAAM,IAAO,EAAgB,KAAA,CAAM,EAAE,IAAA,EAAA,MAAS,MAAO,CAAI,GAAG,OAAO;AAEzE,MAAI,GAAC,KAAQ,CAAC;AAEd,WAAO,EAAK,CAAA,KAA+B;AAC7C"}
|
|
@@ -47,6 +47,10 @@ interface SurveyModalProps {
|
|
|
47
47
|
onSubmit: (option: string, detail?: string) => void | Promise<void>;
|
|
48
48
|
/** Fired when the whole flow ends (dialogs dismissed or a snackbar closed). */
|
|
49
49
|
onClose: () => void;
|
|
50
|
+
/** Fired when the negative row opens the reasons dialog (analytics). */
|
|
51
|
+
onReasonsOpen?: () => void;
|
|
52
|
+
/** Default true. When false the last reason is a plain choice, with no free-text field. */
|
|
53
|
+
showDetailField?: boolean;
|
|
50
54
|
}
|
|
51
55
|
/**
|
|
52
56
|
* The confirmation survey drilldown (Figma `1941:212640`, Upcoming
|
|
@@ -61,5 +65,5 @@ interface SurveyModalProps {
|
|
|
61
65
|
* `survey_modal_block` action block wires it to the copy store, the beat
|
|
62
66
|
* actions, and the action-drawer session.
|
|
63
67
|
*/
|
|
64
|
-
declare const SurveyModal: ({ copy, isOpen, onClose, onSubmit }: SurveyModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
68
|
+
declare const SurveyModal: ({ copy, isOpen, onClose, onReasonsOpen, onSubmit, showDetailField, }: SurveyModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
65
69
|
export default SurveyModal;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { useEffect as
|
|
1
|
+
import k from "../../common/components/dialog/Dialog.es.js";
|
|
2
|
+
import M from "./shared/StatusSnackbar.es.js";
|
|
3
|
+
import p from "./FeedbackModal.es.js";
|
|
4
|
+
import { useEffect as S, useRef as h, useState as y } from "react";
|
|
5
5
|
import m from "@mui/material/Stack";
|
|
6
|
-
import { Text as
|
|
7
|
-
import { Icon as
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
var
|
|
6
|
+
import { Text as b } from "@mxenabled/mxui";
|
|
7
|
+
import { Icon as g } from "@mxenabled/mx-icons";
|
|
8
|
+
import { Fragment as w, jsx as t, jsxs as l } from "react/jsx-runtime";
|
|
9
|
+
import B from "@mui/material/Divider";
|
|
10
|
+
import I from "@mui/material/ButtonBase";
|
|
11
|
+
var _ = {
|
|
12
12
|
positive: {
|
|
13
13
|
color: "success.main",
|
|
14
14
|
name: "check_circle"
|
|
@@ -17,9 +17,9 @@ var w = {
|
|
|
17
17
|
color: "error.main",
|
|
18
18
|
name: "cancel"
|
|
19
19
|
}
|
|
20
|
-
},
|
|
21
|
-
const [s, o] =
|
|
22
|
-
|
|
20
|
+
}, P = ({ copy: e, isOpen: a, onClose: c, onReasonsOpen: v, onSubmit: f, showDetailField: A = !0 }) => {
|
|
21
|
+
const [s, o] = y("survey"), u = h(!1), n = h(null);
|
|
22
|
+
S(() => {
|
|
23
23
|
a && (o("survey"), u.current = !1, n.current = null);
|
|
24
24
|
}, [a]);
|
|
25
25
|
const x = async (r, i) => {
|
|
@@ -32,24 +32,24 @@ var w = {
|
|
|
32
32
|
} catch {
|
|
33
33
|
o("error");
|
|
34
34
|
}
|
|
35
|
-
},
|
|
35
|
+
}, T = () => {
|
|
36
36
|
n.current && x(n.current.option, n.current.detail);
|
|
37
|
-
},
|
|
38
|
-
r.tone === "positive" ? x(r.label) : o("reasons");
|
|
39
|
-
},
|
|
37
|
+
}, C = (r) => {
|
|
38
|
+
r.tone === "positive" ? x(r.label) : (v?.(), o("reasons"));
|
|
39
|
+
}, L = () => {
|
|
40
40
|
u.current || c();
|
|
41
41
|
};
|
|
42
|
-
return /* @__PURE__ */ l(
|
|
43
|
-
/* @__PURE__ */ t(
|
|
42
|
+
return /* @__PURE__ */ l(w, { children: [
|
|
43
|
+
/* @__PURE__ */ t(k, {
|
|
44
44
|
copy: {
|
|
45
45
|
title: e.title,
|
|
46
46
|
close_aria: e.closeAriaLabel
|
|
47
47
|
},
|
|
48
48
|
isOpen: a && s === "survey",
|
|
49
|
-
onClose:
|
|
49
|
+
onClose: L,
|
|
50
50
|
showActions: !1,
|
|
51
51
|
sx: {
|
|
52
|
-
"& .MuiDialogContent-root": {
|
|
52
|
+
"& .MuiDialogContent-root": { p: 0 },
|
|
53
53
|
"& .MuiButton-outlined": {
|
|
54
54
|
border: "none",
|
|
55
55
|
"&:hover": {
|
|
@@ -58,51 +58,58 @@ var w = {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
|
-
children: /* @__PURE__ */ t(m, { children: e.options.map((r) => {
|
|
62
|
-
const
|
|
63
|
-
return /* @__PURE__ */ l(m, { children: [/* @__PURE__ */ t(
|
|
64
|
-
onClick: () =>
|
|
61
|
+
children: /* @__PURE__ */ t(m, { children: e.options.map((r, i) => {
|
|
62
|
+
const d = _[r.tone];
|
|
63
|
+
return /* @__PURE__ */ l(m, { children: [i > 0 && /* @__PURE__ */ t(B, {}), /* @__PURE__ */ l(I, {
|
|
64
|
+
onClick: () => C(r),
|
|
65
65
|
sx: {
|
|
66
66
|
alignItems: "center",
|
|
67
67
|
display: "flex",
|
|
68
68
|
gap: 12,
|
|
69
69
|
justifyContent: "flex-start",
|
|
70
|
-
px:
|
|
70
|
+
px: 24,
|
|
71
71
|
py: 14,
|
|
72
72
|
textAlign: "left",
|
|
73
73
|
width: "100%"
|
|
74
74
|
},
|
|
75
75
|
children: [
|
|
76
|
-
/* @__PURE__ */ t(
|
|
77
|
-
|
|
76
|
+
/* @__PURE__ */ t(g, {
|
|
77
|
+
fill: !0,
|
|
78
|
+
name: d.name,
|
|
78
79
|
size: 24,
|
|
79
|
-
sx: {
|
|
80
|
+
sx: {
|
|
81
|
+
color: d.color,
|
|
82
|
+
mx: 4
|
|
83
|
+
}
|
|
80
84
|
}),
|
|
81
85
|
/* @__PURE__ */ l(m, {
|
|
82
86
|
sx: {
|
|
83
87
|
flex: 1,
|
|
84
88
|
minWidth: 0
|
|
85
89
|
},
|
|
86
|
-
children: [/* @__PURE__ */ t(
|
|
90
|
+
children: [/* @__PURE__ */ t(b, {
|
|
87
91
|
color: "text.primary",
|
|
88
92
|
variant: "caption",
|
|
89
93
|
children: r.overline
|
|
90
|
-
}), /* @__PURE__ */ t(
|
|
94
|
+
}), /* @__PURE__ */ t(b, {
|
|
91
95
|
sx: { fontWeight: 600 },
|
|
92
96
|
variant: "body1",
|
|
93
97
|
children: r.label
|
|
94
98
|
})]
|
|
95
99
|
}),
|
|
96
|
-
/* @__PURE__ */ t(
|
|
100
|
+
/* @__PURE__ */ t(g, {
|
|
97
101
|
name: "chevron_right",
|
|
98
102
|
size: 20,
|
|
99
|
-
sx: {
|
|
103
|
+
sx: {
|
|
104
|
+
color: "text.primary",
|
|
105
|
+
ml: 4
|
|
106
|
+
}
|
|
100
107
|
})
|
|
101
108
|
]
|
|
102
109
|
})] }, r.label);
|
|
103
110
|
}) })
|
|
104
111
|
}),
|
|
105
|
-
/* @__PURE__ */ t(
|
|
112
|
+
/* @__PURE__ */ t(p, {
|
|
106
113
|
copy: {
|
|
107
114
|
title: e.reasonsTitle,
|
|
108
115
|
options: e.reasonOptions,
|
|
@@ -118,13 +125,14 @@ var w = {
|
|
|
118
125
|
isOpen: a && s === "reasons",
|
|
119
126
|
onBack: () => o("survey"),
|
|
120
127
|
onClose: () => c(),
|
|
121
|
-
onSubmit: f
|
|
128
|
+
onSubmit: f,
|
|
129
|
+
showDetailField: A
|
|
122
130
|
}),
|
|
123
|
-
/* @__PURE__ */ t(
|
|
131
|
+
/* @__PURE__ */ t(M, {
|
|
124
132
|
actionText: s === "error" ? e.tryAgainText : void 0,
|
|
125
133
|
closeAriaLabel: e.toastCloseAriaLabel,
|
|
126
134
|
message: s === "error" ? e.errorMessage : e.successMessage,
|
|
127
|
-
onActionClick:
|
|
135
|
+
onActionClick: T,
|
|
128
136
|
onClose: () => c(),
|
|
129
137
|
open: a && (s === "success" || s === "error"),
|
|
130
138
|
severity: s === "error" ? "error" : "success"
|
|
@@ -132,7 +140,7 @@ var w = {
|
|
|
132
140
|
] });
|
|
133
141
|
};
|
|
134
142
|
export {
|
|
135
|
-
|
|
143
|
+
P as default
|
|
136
144
|
};
|
|
137
145
|
|
|
138
146
|
//# sourceMappingURL=SurveyModal.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SurveyModal.es.js","names":[],"sources":["../../../src/insights-v2/components/SurveyModal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\n\nimport ButtonBase from '@mui/material/ButtonBase'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { Dialog } from '../../common'\n\nimport FeedbackModal from './FeedbackModal'\nimport StatusSnackbar from './shared/StatusSnackbar'\n\n/** One survey row (Figma `<UtilityRow>`). Rows act immediately on click. */\nexport interface SurveyModalOption {\n /** Overline above the row label, e.g. \"Yes,\" / \"No,\". */\n overline: string\n /** Row label, e.g. \"This looks correct.\" */\n label: string\n /**\n * Row behavior + glyph: `positive` (green check_circle) submits the label\n * right away; `negative` (red cancel) opens the reasons dialog.\n */\n tone: 'positive' | 'negative'\n}\n\n/** Localized strings the modal renders — resolved by the caller (see SurveyModalActionBlock). */\nexport interface SurveyModalContent {\n /** Survey dialog title, e.g. \"Does this look right?\". */\n title: string\n options: SurveyModalOption[]\n /** Reasons dialog primary (Submit) button label. */\n submitText: string\n /** ARIA label for the dialog close buttons. */\n closeAriaLabel: string\n /** Reasons dialog title (negative path), e.g. \"This looks wrong\". */\n reasonsTitle: string\n /** Reasons dialog options; the last one reveals the detail text field. */\n reasonOptions: string[]\n /** Reasons dialog secondary (Back) label. */\n backText: string\n /** Helper text under the reasons detail field. */\n characterLimitLabel?: string\n /** Success snackbar message (Figma 1941:212643). */\n successMessage: string\n /** Error snackbar message (Figma 1941:212644). */\n errorMessage: string\n /** Error snackbar retry label, e.g. \"Try Again\". */\n tryAgainText: string\n /** ARIA label for the snackbar close button. */\n toastCloseAriaLabel: string\n}\n\ninterface SurveyModalProps {\n isOpen: boolean\n copy: SurveyModalContent\n /**\n * Fired when an answer is submitted — the positive row's label, or a\n * reasons-dialog selection (with optional detail). May return a promise: a\n * rejection switches to the error snackbar, whose Try Again re-submits.\n */\n onSubmit: (option: string, detail?: string) => void | Promise<void>\n /** Fired when the whole flow ends (dialogs dismissed or a snackbar closed). */\n onClose: () => void\n}\n\ntype Phase = 'survey' | 'reasons' | 'success' | 'error'\n\nconst TONE_ICON: Record<SurveyModalOption['tone'], { color: string; name: string }> = {\n positive: { color: 'success.main', name: 'check_circle' },\n negative: { color: 'error.main', name: 'cancel' },\n}\n\n/**\n * The confirmation survey drilldown (Figma `1941:212640`, Upcoming\n * Subscriptions \"Does this look right?\"):\n *\n * - the POSITIVE row submits immediately and shows the success snackbar\n * (`1941:212643`) — or the error snackbar with Try Again (`1941:212644`);\n * - the NEGATIVE row opens the reasons dialog (`1941:212642`, a FeedbackDialog:\n * radios + Back/Submit), whose submission feeds the same snackbars.\n *\n * Purely presentational — copy arrives resolved via `SurveyModalContent`; the\n * `survey_modal_block` action block wires it to the copy store, the beat\n * actions, and the action-drawer session.\n */\nconst SurveyModal = ({ copy, isOpen, onClose, onSubmit }: SurveyModalProps) => {\n const [phase, setPhase] = useState<Phase>('survey')\n // Guards the survey Dialog's trailing `onClose` after a row acted — the row\n // click hands over to the snackbar / reasons dialog, not a flow end.\n const actionTaken = useRef(false)\n // Kept for the error snackbar's Try Again, which re-submits the selection.\n const lastSubmission = useRef<{ option: string; detail?: string } | null>(null)\n\n // A fresh session starts from the survey.\n useEffect(() => {\n if (isOpen) {\n setPhase('survey')\n actionTaken.current = false\n lastSubmission.current = null\n }\n }, [isOpen])\n\n const submit = async (option: string, detail?: string) => {\n actionTaken.current = true\n lastSubmission.current = { option, detail }\n try {\n await onSubmit(option, detail)\n setPhase('success')\n } catch {\n setPhase('error')\n }\n }\n\n const retry = () => {\n if (lastSubmission.current) {\n void submit(lastSubmission.current.option, lastSubmission.current.detail)\n }\n }\n\n const handleRowClick = (option: SurveyModalOption) => {\n if (option.tone === 'positive') {\n void submit(option.label)\n } else {\n setPhase('reasons')\n }\n }\n\n const handleSurveyClose = () => {\n if (actionTaken.current) return\n onClose()\n }\n\n return (\n <>\n <Dialog\n copy={{ title: copy.title, close_aria: copy.closeAriaLabel }}\n isOpen={isOpen && phase === 'survey'}\n onClose={handleSurveyClose}\n // Figma 1941:212640: the DialogActions row is hidden — the utility\n // rows are the only actions; the flow closes via X or a row.\n showActions={false}\n sx={{\n '& .MuiDialogContent-root': { py: 0 },\n '& .MuiButton-outlined': {\n border: 'none',\n '&:hover': { bgcolor: 'transparent', border: 'none' },\n },\n }}\n >\n <Stack>\n {copy.options.map((option) => {\n const icon = TONE_ICON[option.tone]\n\n return (\n <Stack key={option.label}>\n <Divider />\n <ButtonBase\n onClick={() => handleRowClick(option)}\n sx={{\n alignItems: 'center',\n display: 'flex',\n gap: 12,\n justifyContent: 'flex-start',\n px: 4,\n py: 14,\n textAlign: 'left',\n width: '100%',\n }}\n >\n <Icon name={icon.name} size={24} sx={{ color: icon.color }} />\n <Stack sx={{ flex: 1, minWidth: 0 }}>\n <Text color=\"text.primary\" variant=\"caption\">\n {option.overline}\n </Text>\n <Text sx={{ fontWeight: 600 }} variant=\"body1\">\n {option.label}\n </Text>\n </Stack>\n <Icon name=\"chevron_right\" size={20} sx={{ color: 'text.primary' }} />\n </ButtonBase>\n </Stack>\n )\n })}\n </Stack>\n </Dialog>\n\n {/* Negative path: the whole FeedbackModal — reasons dialog + its own\n success/error snackbars with Try Again. Back returns to the survey;\n its onClose fires only when the sub-flow truly ends. */}\n <FeedbackModal\n copy={{\n title: copy.reasonsTitle,\n options: copy.reasonOptions,\n submitText: copy.submitText,\n cancelText: copy.backText,\n closeAriaLabel: copy.closeAriaLabel,\n characterLimitLabel: copy.characterLimitLabel,\n successMessage: copy.successMessage,\n errorMessage: copy.errorMessage,\n tryAgainText: copy.tryAgainText,\n toastCloseAriaLabel: copy.toastCloseAriaLabel,\n }}\n isOpen={isOpen && phase === 'reasons'}\n onBack={() => setPhase('survey')}\n onClose={() => onClose()}\n onSubmit={onSubmit}\n />\n\n <StatusSnackbar\n actionText={phase === 'error' ? copy.tryAgainText : undefined}\n closeAriaLabel={copy.toastCloseAriaLabel}\n message={phase === 'error' ? copy.errorMessage : copy.successMessage}\n onActionClick={retry}\n onClose={() => onClose()}\n open={isOpen && (phase === 'success' || phase === 'error')}\n severity={phase === 'error' ? 'error' : 'success'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A,cAAI,IAAI,EAAE,OAAO,eAAe;AAAA,YAAI,CAAA;AAAA,UAC3D;AAAA,QACP,CAAA,CAAA,EAAA,GA1BK,EAAO,KA0BZ;AAAA,MAEX,CAAC,EACI,CAAA;AAAA,IACD,CAAA;AAAA,IAKR,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM;AAAA,QACJ,OAAO,EAAK;AAAA,QACZ,SAAS,EAAK;AAAA,QACd,YAAY,EAAK;AAAA,QACjB,YAAY,EAAK;AAAA,QACjB,gBAAgB,EAAK;AAAA,QACrB,qBAAqB,EAAK;AAAA,QAC1B,gBAAgB,EAAK;AAAA,QACrB,cAAc,EAAK;AAAA,QACnB,cAAc,EAAK;AAAA,QACnB,qBAAqB,EAAK;AAAA,MAC5B;AAAA,MACA,QAAQ,KAAU,MAAU;AAAA,MAC5B,QAAA,MAAc,EAAS,QAAQ;AAAA,MAC/B,SAAA,MAAe,EAAQ;AAAA,MACb,UAAA;AAAA,IACX,CAAA;AAAA,IAED,gBAAA,EAAC,GAAD;AAAA,MACE,YAAY,MAAU,UAAU,EAAK,eAAe;AAAA,MACpD,gBAAgB,EAAK;AAAA,MACrB,SAAS,MAAU,UAAU,EAAK,eAAe,EAAK;AAAA,MACtD,eAAe;AAAA,MACf,SAAA,MAAe,EAAQ;AAAA,MACvB,MAAM,MAAW,MAAU,aAAa,MAAU;AAAA,MAClD,UAAU,MAAU,UAAU,UAAU;AAAA,IACzC,CAAA;AAAA,EACD,EAAA,CAAA;AAEN"}
|
|
1
|
+
{"version":3,"file":"SurveyModal.es.js","names":[],"sources":["../../../src/insights-v2/components/SurveyModal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\n\nimport ButtonBase from '@mui/material/ButtonBase'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { Dialog } from '../../common'\n\nimport FeedbackModal from './FeedbackModal'\nimport StatusSnackbar from './shared/StatusSnackbar'\n\n/** One survey row (Figma `<UtilityRow>`). Rows act immediately on click. */\nexport interface SurveyModalOption {\n /** Overline above the row label, e.g. \"Yes,\" / \"No,\". */\n overline: string\n /** Row label, e.g. \"This looks correct.\" */\n label: string\n /**\n * Row behavior + glyph: `positive` (green check_circle) submits the label\n * right away; `negative` (red cancel) opens the reasons dialog.\n */\n tone: 'positive' | 'negative'\n}\n\n/** Localized strings the modal renders — resolved by the caller (see SurveyModalActionBlock). */\nexport interface SurveyModalContent {\n /** Survey dialog title, e.g. \"Does this look right?\". */\n title: string\n options: SurveyModalOption[]\n /** Reasons dialog primary (Submit) button label. */\n submitText: string\n /** ARIA label for the dialog close buttons. */\n closeAriaLabel: string\n /** Reasons dialog title (negative path), e.g. \"This looks wrong\". */\n reasonsTitle: string\n /** Reasons dialog options; the last one reveals the detail text field. */\n reasonOptions: string[]\n /** Reasons dialog secondary (Back) label. */\n backText: string\n /** Helper text under the reasons detail field. */\n characterLimitLabel?: string\n /** Success snackbar message (Figma 1941:212643). */\n successMessage: string\n /** Error snackbar message (Figma 1941:212644). */\n errorMessage: string\n /** Error snackbar retry label, e.g. \"Try Again\". */\n tryAgainText: string\n /** ARIA label for the snackbar close button. */\n toastCloseAriaLabel: string\n}\n\ninterface SurveyModalProps {\n isOpen: boolean\n copy: SurveyModalContent\n /**\n * Fired when an answer is submitted — the positive row's label, or a\n * reasons-dialog selection (with optional detail). May return a promise: a\n * rejection switches to the error snackbar, whose Try Again re-submits.\n */\n onSubmit: (option: string, detail?: string) => void | Promise<void>\n /** Fired when the whole flow ends (dialogs dismissed or a snackbar closed). */\n onClose: () => void\n /** Fired when the negative row opens the reasons dialog (analytics). */\n onReasonsOpen?: () => void\n /** Default true. When false the last reason is a plain choice, with no free-text field. */\n showDetailField?: boolean\n}\n\ntype Phase = 'survey' | 'reasons' | 'success' | 'error'\n\nconst TONE_ICON: Record<SurveyModalOption['tone'], { color: string; name: string }> = {\n positive: { color: 'success.main', name: 'check_circle' },\n negative: { color: 'error.main', name: 'cancel' },\n}\n\n/**\n * The confirmation survey drilldown (Figma `1941:212640`, Upcoming\n * Subscriptions \"Does this look right?\"):\n *\n * - the POSITIVE row submits immediately and shows the success snackbar\n * (`1941:212643`) — or the error snackbar with Try Again (`1941:212644`);\n * - the NEGATIVE row opens the reasons dialog (`1941:212642`, a FeedbackDialog:\n * radios + Back/Submit), whose submission feeds the same snackbars.\n *\n * Purely presentational — copy arrives resolved via `SurveyModalContent`; the\n * `survey_modal_block` action block wires it to the copy store, the beat\n * actions, and the action-drawer session.\n */\nconst SurveyModal = ({\n copy,\n isOpen,\n onClose,\n onReasonsOpen,\n onSubmit,\n showDetailField = true,\n}: SurveyModalProps) => {\n const [phase, setPhase] = useState<Phase>('survey')\n // Guards the survey Dialog's trailing `onClose` after a row acted — the row\n // click hands over to the snackbar / reasons dialog, not a flow end.\n const actionTaken = useRef(false)\n // Kept for the error snackbar's Try Again, which re-submits the selection.\n const lastSubmission = useRef<{ option: string; detail?: string } | null>(null)\n\n // A fresh session starts from the survey.\n useEffect(() => {\n if (isOpen) {\n setPhase('survey')\n actionTaken.current = false\n lastSubmission.current = null\n }\n }, [isOpen])\n\n const submit = async (option: string, detail?: string) => {\n actionTaken.current = true\n lastSubmission.current = { option, detail }\n try {\n await onSubmit(option, detail)\n setPhase('success')\n } catch {\n setPhase('error')\n }\n }\n\n const retry = () => {\n if (lastSubmission.current) {\n void submit(lastSubmission.current.option, lastSubmission.current.detail)\n }\n }\n\n const handleRowClick = (option: SurveyModalOption) => {\n if (option.tone === 'positive') {\n void submit(option.label)\n } else {\n onReasonsOpen?.()\n setPhase('reasons')\n }\n }\n\n const handleSurveyClose = () => {\n if (actionTaken.current) return\n onClose()\n }\n\n return (\n <>\n <Dialog\n copy={{ title: copy.title, close_aria: copy.closeAriaLabel }}\n isOpen={isOpen && phase === 'survey'}\n onClose={handleSurveyClose}\n // Figma 1941:212640: the DialogActions row is hidden — the utility\n // rows are the only actions; the flow closes via X or a row.\n showActions={false}\n sx={{\n '& .MuiDialogContent-root': { p: 0 },\n '& .MuiButton-outlined': {\n border: 'none',\n '&:hover': { bgcolor: 'transparent', border: 'none' },\n },\n }}\n >\n <Stack>\n {copy.options.map((option, index) => {\n const icon = TONE_ICON[option.tone]\n\n return (\n <Stack key={option.label}>\n {index > 0 && <Divider />}\n <ButtonBase\n onClick={() => handleRowClick(option)}\n sx={{\n alignItems: 'center',\n display: 'flex',\n gap: 12,\n justifyContent: 'flex-start',\n px: 24,\n py: 14,\n textAlign: 'left',\n width: '100%',\n }}\n >\n <Icon fill={true} name={icon.name} size={24} sx={{ color: icon.color, mx: 4 }} />\n <Stack sx={{ flex: 1, minWidth: 0 }}>\n <Text color=\"text.primary\" variant=\"caption\">\n {option.overline}\n </Text>\n <Text sx={{ fontWeight: 600 }} variant=\"body1\">\n {option.label}\n </Text>\n </Stack>\n <Icon name=\"chevron_right\" size={20} sx={{ color: 'text.primary', ml: 4 }} />\n </ButtonBase>\n </Stack>\n )\n })}\n </Stack>\n </Dialog>\n\n {/* Negative path: the whole FeedbackModal — reasons dialog + its own\n success/error snackbars with Try Again. Back returns to the survey;\n its onClose fires only when the sub-flow truly ends. */}\n <FeedbackModal\n copy={{\n title: copy.reasonsTitle,\n options: copy.reasonOptions,\n submitText: copy.submitText,\n cancelText: copy.backText,\n closeAriaLabel: copy.closeAriaLabel,\n characterLimitLabel: copy.characterLimitLabel,\n successMessage: copy.successMessage,\n errorMessage: copy.errorMessage,\n tryAgainText: copy.tryAgainText,\n toastCloseAriaLabel: copy.toastCloseAriaLabel,\n }}\n isOpen={isOpen && phase === 'reasons'}\n onBack={() => setPhase('survey')}\n onClose={() => onClose()}\n onSubmit={onSubmit}\n showDetailField={showDetailField}\n />\n\n <StatusSnackbar\n actionText={phase === 'error' ? copy.tryAgainText : undefined}\n closeAriaLabel={copy.toastCloseAriaLabel}\n message={phase === 'error' ? copy.errorMessage : copy.successMessage}\n onActionClick={retry}\n onClose={() => onClose()}\n open={isOpen && (phase === 'success' || phase === 'error')}\n severity={phase === 'error' ? 'error' : 'success'}\n />\n </>\n )\n}\n\nexport default SurveyModal\n"],"mappings":";;;;;;;;;;AAyEA,IAAM,IAAgF;AAAA,EACpF,UAAU;AAAA,IAAE,OAAO;AAAA,IAAgB,MAAM;AAAA,EAAe;AAAA,EACxD,UAAU;AAAA,IAAE,OAAO;AAAA,IAAc,MAAM;AAAA,EAAS;AAClD,GAeM,IAAA,CAAe,EACnB,MAAA,GACA,QAAA,GACA,SAAA,GACA,eAAA,GACA,UAAA,GACA,iBAAA,IAAkB,GAAA,MACI;AACtB,QAAM,CAAC,GAAO,CAAA,IAAY,EAAgB,QAAQ,GAG5C,IAAc,EAAO,EAAK,GAE1B,IAAiB,EAAmD,IAAI;AAG9E,EAAA,EAAA,MAAgB;AACd,IAAI,MACF,EAAS,QAAQ,GACjB,EAAY,UAAU,IACtB,EAAe,UAAU;AAAA,EAE7B,GAAG,CAAC,CAAM,CAAC;AAEX,QAAM,IAAS,OAAO,GAAgB,MAAoB;AACxD,IAAA,EAAY,UAAU,IACtB,EAAe,UAAU;AAAA,MAAE,QAAA;AAAA,MAAQ,QAAA;AAAA,IAAO;AAC1C,QAAI;AACF,YAAM,EAAS,GAAQ,CAAM,GAC7B,EAAS,SAAS;AAAA,IACpB,QAAQ;AACN,MAAA,EAAS,OAAO;AAAA,IAClB;AAAA,EACF,GAEM,IAAA,MAAc;AAClB,IAAI,EAAe,WACjB,EAAY,EAAe,QAAQ,QAAQ,EAAe,QAAQ,MAAM;AAAA,EAE5E,GAEM,IAAA,CAAkB,MAA8B;AACpD,IAAI,EAAO,SAAS,aAClB,EAAY,EAAO,KAAK,KAExB,IAAgB,GAChB,EAAS,SAAS;AAAA,EAEtB,GAEM,IAAA,MAA0B;AAC9B,IAAI,EAAY,WAChB,EAAQ;AAAA,EACV;AAEA,SACE,gBAAA,EAAA,GAAA,EAAA,UAAA;AAAA,IACE,gBAAA,EAAC,GAAD;AAAA,MAC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TIONS as
|
|
3
|
-
|
|
1
|
+
import { ANALYTICS_EVENTS_CONFIG as o } from "../analytics/analyticsEventsConfig.es.js";
|
|
2
|
+
import { HOST_ACTIONS as n } from "./hostActions.es.js";
|
|
3
|
+
import { subscriptionEntryStep as a, subscriptionSurvey as c } from "./subscriptionAnswer.es.js";
|
|
4
|
+
var r = ({ beat: e, stores: i }) => {
|
|
4
5
|
const s = i.insightsV2Store.beatContext[e.guid]?.selected_account_guid;
|
|
5
6
|
if (typeof s == "string")
|
|
6
7
|
return i.accountStore.visibleSavingsAccounts.some((t) => t.guid === s && !t.is_closed && !t.is_deleted) ? s : void 0;
|
|
7
|
-
},
|
|
8
|
+
}, m = {
|
|
8
9
|
dismiss_beat: {
|
|
9
10
|
run: "delegateToHost",
|
|
10
|
-
params: { hostAction:
|
|
11
|
+
params: { hostAction: n.dismissBeat }
|
|
11
12
|
},
|
|
12
13
|
select_savings_account: {
|
|
13
14
|
run: "updateUserInsightProfile",
|
|
14
|
-
params: (e) => ({ fields: { emergency_savings_account_guid:
|
|
15
|
-
disabledWhen: (e) => !
|
|
15
|
+
params: (e) => ({ fields: { emergency_savings_account_guid: r(e) } }),
|
|
16
|
+
disabledWhen: (e) => !r(e),
|
|
16
17
|
onSuccess: ["refreshBeat"],
|
|
17
|
-
analytics:
|
|
18
|
+
analytics: o.EMERGENCY_SAVINGS_ACCT_SAVED
|
|
18
19
|
},
|
|
19
|
-
open_savings_account: { analytics:
|
|
20
|
+
open_savings_account: { analytics: o.EMERGENCY_SAVINGS_ACCT_CREATED },
|
|
20
21
|
atomic_flow: {
|
|
21
22
|
run: "delegateToHost",
|
|
22
|
-
params: { hostAction:
|
|
23
|
+
params: { hostAction: n.atomicTransact }
|
|
24
|
+
},
|
|
25
|
+
confirm_subscription_detected: {
|
|
26
|
+
...a({ statusLabels: {
|
|
27
|
+
positive: "confirmed",
|
|
28
|
+
negative: "incorrect"
|
|
29
|
+
} }),
|
|
30
|
+
surveyAnswer: c
|
|
23
31
|
}
|
|
24
32
|
};
|
|
25
33
|
export {
|
|
26
|
-
|
|
34
|
+
m as ctaActions
|
|
27
35
|
};
|
|
28
36
|
|
|
29
37
|
//# sourceMappingURL=ctaConfig.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ctaConfig.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaConfig.ts"],"sourcesContent":["import { ANALYTICS_EVENTS_CONFIG } from '../analytics/analyticsEventsConfig'\nimport { HOST_ACTIONS } from './hostActions'\nimport type { CtaStateContext, CtaStep } from './types'\n\n/**\n * The account the svg_image_block picker wrote into this beat's context, and only while it is\n * still one the user can save into (visible, open, not deleted) — a pick that went stale between\n * pick and Save never reaches the API.\n */\nconst pickedSavingsAccountGuid = ({ beat, stores }: Pick<CtaStateContext, 'beat' | 'stores'>) => {\n const picked = stores.insightsV2Store.beatContext[beat.guid]?.selected_account_guid\n\n if (typeof picked !== 'string') return undefined\n\n const usable = stores.accountStore.visibleSavingsAccounts.some(\n (account) => account.guid === picked && !account.is_closed && !account.is_deleted,\n )\n\n return usable ? picked : undefined\n}\n\n/**\n * Steps keyed by the backend-named `cta.action_key` (ditto `*_cta_action`, via tupac). No key or\n * an unknown key = default: open the CTA's block drawer, if any. Its post message, when one\n * resolves (`cta.metadata` / `ctaPostMessages`), is sent either way. A new key is registered in\n * ditto and here in the same change; most CTAs need none. See README.md.\n */\nexport const ctaActions: Record<string, CtaStep> = {\n /** ConnectDiscoveredAccounts \"I don't have any\": dismiss through the host, then stop. */\n dismiss_beat: {\n run: 'delegateToHost',\n params: { hostAction: HOST_ACTIONS.dismissBeat },\n },\n\n /**\n * Designate Emergency Savings Account \"Save\": designates the account picked in the\n * svg_image_block picker (kept in the per-beat context), then refreshes the beat. The beat is\n * sampled, so the refresh re-reads its sample, which the backend rebuilds as the saved card\n * (change_account: \"Account Saved!\", no CTA). Disabled until a pick is made.\n */\n select_savings_account: {\n run: 'updateUserInsightProfile',\n params: (ctx) => ({\n fields: { emergency_savings_account_guid: pickedSavingsAccountGuid(ctx) },\n }),\n disabledWhen: (ctx) => !pickedSavingsAccountGuid(ctx),\n onSuccess: ['refreshBeat'],\n analytics: ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_SAVED,\n },\n\n /**\n * Designate Emergency Savings Account \"Open a Savings Account\": no handler. The op_1 post\n * message comes from `ctaPostMessages`; this step adds the Created event.\n */\n open_savings_account: {\n analytics: ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_CREATED,\n },\n\n /**\n * SetUpDirectDeposit `not_set_up`: hand the press to the host, which owns the Atomic SDK and its\n * lifecycle. No drawer, no `refreshBeat`, and no interim post message is registered for the\n * template (a backend-supplied `cta.metadata` would still post).\n */\n atomic_flow: {\n run: 'delegateToHost',\n params: { hostAction: HOST_ACTIONS.atomicTransact },\n },\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ctaConfig.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaConfig.ts"],"sourcesContent":["import { ANALYTICS_EVENTS_CONFIG } from '../analytics/analyticsEventsConfig'\nimport { HOST_ACTIONS } from './hostActions'\nimport { subscriptionEntryStep, subscriptionSurvey } from './subscriptionAnswer'\nimport type { CtaStateContext, CtaStep } from './types'\n\n/**\n * The account the svg_image_block picker wrote into this beat's context, and only while it is\n * still one the user can save into (visible, open, not deleted) — a pick that went stale between\n * pick and Save never reaches the API.\n */\nconst pickedSavingsAccountGuid = ({ beat, stores }: Pick<CtaStateContext, 'beat' | 'stores'>) => {\n const picked = stores.insightsV2Store.beatContext[beat.guid]?.selected_account_guid\n\n if (typeof picked !== 'string') return undefined\n\n const usable = stores.accountStore.visibleSavingsAccounts.some(\n (account) => account.guid === picked && !account.is_closed && !account.is_deleted,\n )\n\n return usable ? picked : undefined\n}\n\n/**\n * Steps keyed by the backend-named `cta.action_key` (ditto `*_cta_action`, via tupac). No key or\n * an unknown key = default: open the CTA's block drawer, if any. Its post message, when one\n * resolves (`cta.metadata` / `ctaPostMessages`), is sent either way. A new key is registered in\n * ditto and here in the same change; most CTAs need none. See README.md.\n */\nexport const ctaActions: Record<string, CtaStep> = {\n /** ConnectDiscoveredAccounts \"I don't have any\": dismiss through the host, then stop. */\n dismiss_beat: {\n run: 'delegateToHost',\n params: { hostAction: HOST_ACTIONS.dismissBeat },\n },\n\n /**\n * Designate Emergency Savings Account \"Save\": designates the account picked in the\n * svg_image_block picker (kept in the per-beat context), then refreshes the beat. The beat is\n * sampled, so the refresh re-reads its sample, which the backend rebuilds as the saved card\n * (change_account: \"Account Saved!\", no CTA). Disabled until a pick is made.\n */\n select_savings_account: {\n run: 'updateUserInsightProfile',\n params: (ctx) => ({\n fields: { emergency_savings_account_guid: pickedSavingsAccountGuid(ctx) },\n }),\n disabledWhen: (ctx) => !pickedSavingsAccountGuid(ctx),\n onSuccess: ['refreshBeat'],\n analytics: ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_SAVED,\n },\n\n /**\n * Designate Emergency Savings Account \"Open a Savings Account\": no handler. The op_1 post\n * message comes from `ctaPostMessages`; this step adds the Created event.\n */\n open_savings_account: {\n analytics: ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_CREATED,\n },\n\n /**\n * SetUpDirectDeposit `not_set_up`: hand the press to the host, which owns the Atomic SDK and its\n * lifecycle. No drawer, no `refreshBeat`, and no interim post message is registered for the\n * template (a backend-supplied `cta.metadata` would still post).\n */\n atomic_flow: {\n run: 'delegateToHost',\n params: { hostAction: HOST_ACTIONS.atomicTransact },\n },\n\n /**\n * SubscriptionDetected \"Does this look right?\": the shared subscription status CTA (every answer\n * counts, as pulse), answered through the survey.\n */\n confirm_subscription_detected: {\n ...subscriptionEntryStep({ statusLabels: { positive: 'confirmed', negative: 'incorrect' } }),\n surveyAnswer: subscriptionSurvey,\n },\n}\n"],"mappings":";;;AAUA,IAAM,IAAA,CAA4B,EAAE,MAAA,GAAM,QAAA,EAAA,MAAuD;AAC/F,QAAM,IAAS,EAAO,gBAAgB,YAAY,EAAK,IAAA,GAAO;AAE9D,MAAI,OAAO,KAAW;AAMtB,WAJe,EAAO,aAAa,uBAAuB,KAAA,CACvD,MAAY,EAAQ,SAAS,KAAU,CAAC,EAAQ,aAAa,CAAC,EAAQ,UAGlE,IAAS,IAAS;AAC3B,GAQa,IAAsC;AAAA,EAEjD,cAAc;AAAA,IACZ,KAAK;AAAA,IACL,QAAQ,EAAE,YAAY,EAAa,YAAY;AAAA,EACjD;AAAA,EAQA,wBAAwB;AAAA,IACtB,KAAK;AAAA,IACL,QAAA,CAAS,OAAS,EAChB,QAAQ,EAAE,gCAAgC,EAAyB,CAAG,EAAE,EAC1E;AAAA,IACA,cAAA,CAAe,MAAQ,CAAC,EAAyB,CAAG;AAAA,IACpD,WAAW,CAAC,aAAa;AAAA,IACzB,WAAW,EAAwB;AAAA,EACrC;AAAA,EAMA,sBAAsB,EACpB,WAAW,EAAwB,+BACrC;AAAA,EAOA,aAAa;AAAA,IACX,KAAK;AAAA,IACL,QAAQ,EAAE,YAAY,EAAa,eAAe;AAAA,EACpD;AAAA,EAMA,+BAA+B;AAAA,IAC7B,GAAG,EAAsB,EAAE,cAAc;AAAA,MAAE,UAAU;AAAA,MAAa,UAAU;AAAA,IAAY,EAAE,CAAC;AAAA,IAC3F,cAAc;AAAA,EAChB;AACF"}
|
|
@@ -4,4 +4,4 @@ export { ctaPostMessages, resolveCtaMetadata, type CtaPostMessageResolver } from
|
|
|
4
4
|
export { HOST_ACTIONS, type HostActionName } from './hostActions';
|
|
5
5
|
export { beatContextOf, reportCtaClick, resolveCtaState, resolveStep, runCtaAction, runCtaHandler, sendCtaAnalytics, } from './runCtaAction';
|
|
6
6
|
export { useBeatCtaActions, useCtaHandler, type BeatCtaActions } from './useCtaAction';
|
|
7
|
-
export type { CtaContext, CtaEffect, CtaHandler, CtaHandlerContext, CtaParams, CtaPresentation, CtaSlot, CtaState, CtaStateContext, CtaStep, RunHandlerOptions, } from './types';
|
|
7
|
+
export type { CtaContext, CtaEffect, CtaHandler, CtaHandlerContext, CtaParams, CtaPresentation, CtaSurveyAnswer, CtaSlot, CtaState, CtaStateContext, CtaStep, RunHandlerOptions, } from './types';
|
|
@@ -4,7 +4,11 @@ import { CtaContext, CtaHandlerContext, CtaState, CtaStateContext, CtaStep, RunH
|
|
|
4
4
|
/** The beat's own context (input a block collected for it), `{}` until something is written. */
|
|
5
5
|
export declare const beatContextOf: ({ beat, stores }: Pick<CtaStateContext, "beat" | "stores">) => Record<string, unknown>;
|
|
6
6
|
/** The step named by the CTA's `action_key`, or the empty default (no key / unknown key). */
|
|
7
|
-
export declare const resolveStep: ({ cta }:
|
|
7
|
+
export declare const resolveStep: ({ cta }: {
|
|
8
|
+
cta: {
|
|
9
|
+
action_key?: string | null;
|
|
10
|
+
};
|
|
11
|
+
}) => CtaStep;
|
|
8
12
|
/** Pending always disables, as may the step's `disabledWhen`; its `presenter` may replace the button. */
|
|
9
13
|
export declare const resolveCtaState: (ctx: CtaStateContext) => CtaState;
|
|
10
14
|
type AnalyticsCtx = Pick<CtaContext, 'beat' | 'stores' | 'hostActions'>;
|