@mx-cartographer/experiences 9.4.63 → 9.4.65

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/common/constants/Analytics.d.ts +2 -1
  3. package/dist/common/constants/Analytics.es.js +2 -1
  4. package/dist/common/constants/Analytics.es.js.map +1 -1
  5. package/dist/core/constants/Help.d.ts +5 -10
  6. package/dist/core/constants/Help.es.js +26 -11
  7. package/dist/core/constants/Help.es.js.map +1 -1
  8. package/dist/core/stores/InsightsV2Store.d.ts +19 -0
  9. package/dist/core/stores/InsightsV2Store.es.js +31 -14
  10. package/dist/core/stores/InsightsV2Store.es.js.map +1 -1
  11. package/dist/core/types/Help.d.ts +10 -1
  12. package/dist/core/types/Insights.d.ts +10 -0
  13. package/dist/core/types/localization/HelpCopy.d.ts +40 -2
  14. package/dist/core/utils/HelpUtil.es.js +19 -16
  15. package/dist/core/utils/HelpUtil.es.js.map +1 -1
  16. package/dist/help/components/Help.es.js +50 -39
  17. package/dist/help/components/Help.es.js.map +1 -1
  18. package/dist/help/components/HelpContent.es.js +41 -20
  19. package/dist/help/components/HelpContent.es.js.map +1 -1
  20. package/dist/help/components/HelpList.d.ts +2 -1
  21. package/dist/help/components/HelpList.es.js +167 -124
  22. package/dist/help/components/HelpList.es.js.map +1 -1
  23. package/dist/help/components/SupportPrompt.d.ts +10 -0
  24. package/dist/help/components/SupportPrompt.es.js +37 -0
  25. package/dist/help/components/SupportPrompt.es.js.map +1 -0
  26. package/dist/help/components/content/section/LoginIssues.d.ts +4 -0
  27. package/dist/help/components/content/section/LoginIssues.es.js +69 -0
  28. package/dist/help/components/content/section/LoginIssues.es.js.map +1 -0
  29. package/dist/help/components/content/section/index.d.ts +1 -0
  30. package/dist/help/components/content/section/index.es.js +16 -14
  31. package/dist/help/components/content/section/index.es.js.map +1 -1
  32. package/dist/help/components/requestsupport/HelpByCategoryList.d.ts +6 -1
  33. package/dist/help/components/requestsupport/HelpByCategoryList.es.js +108 -42
  34. package/dist/help/components/requestsupport/HelpByCategoryList.es.js.map +1 -1
  35. package/dist/help/components/requestsupport/RequestSupport.d.ts +3 -1
  36. package/dist/help/components/requestsupport/RequestSupport.es.js +154 -138
  37. package/dist/help/components/requestsupport/RequestSupport.es.js.map +1 -1
  38. package/dist/insights-v2/beatActions.d.ts +11 -0
  39. package/dist/insights-v2/beatActions.es.js.map +1 -1
  40. package/dist/insights-v2/components/BaseLayout.es.js +84 -80
  41. package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
  42. package/dist/insights-v2/ctaActions/ctaConfig.d.ts +7 -0
  43. package/dist/insights-v2/ctaActions/ctaConfig.es.js +10 -0
  44. package/dist/insights-v2/ctaActions/ctaConfig.es.js.map +1 -0
  45. package/dist/insights-v2/ctaActions/ctaHandlers.d.ts +44 -0
  46. package/dist/insights-v2/ctaActions/ctaHandlers.es.js +107 -0
  47. package/dist/insights-v2/ctaActions/ctaHandlers.es.js.map +1 -0
  48. package/dist/insights-v2/ctaActions/hostActions.d.ts +17 -0
  49. package/dist/insights-v2/ctaActions/hostActions.es.js +16 -0
  50. package/dist/insights-v2/ctaActions/hostActions.es.js.map +1 -0
  51. package/dist/insights-v2/ctaActions/index.d.ts +6 -0
  52. package/dist/insights-v2/ctaActions/runCtaAction.d.ts +12 -0
  53. package/dist/insights-v2/ctaActions/runCtaAction.es.js +79 -0
  54. package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -0
  55. package/dist/insights-v2/ctaActions/types.d.ts +57 -0
  56. package/dist/insights-v2/ctaActions/useCtaAction.d.ts +19 -0
  57. package/dist/insights-v2/ctaActions/useCtaAction.es.js +44 -0
  58. package/dist/insights-v2/ctaActions/useCtaAction.es.js.map +1 -0
  59. package/dist/insights-v2/index.d.ts +3 -1
  60. package/dist/insights-v2/index.es.js +53 -48
  61. package/package.json +1 -1
  62. package/dist/help/components/requestsupport/RequestSupportFooter.d.ts +0 -8
  63. package/dist/help/components/requestsupport/RequestSupportFooter.es.js +0 -46
  64. package/dist/help/components/requestsupport/RequestSupportFooter.es.js.map +0 -1
@@ -1,172 +1,188 @@
1
- import { useEvent as k, useGlobalUiStore as w, useHelpStore as D, useUserStore as U } from "../../../common/context/hooks.es.js";
2
- import H from "../../../common/components/drawer/Drawer.es.js";
3
- import { ANALYTICS_EVENTS as g } from "../../../common/constants/Analytics.es.js";
4
- import { HELP_BY_CATEGORY_LIST as M, POPULAR_TOPICS_LIST as W } from "../../../core/constants/Help.es.js";
5
- import $ from "../../../common/components/Loader.es.js";
6
- import { RequestSupportHeader as y } from "./RequestSupportHeader.es.js";
7
- import { ContactSupport as A } from "./ContactSupport.es.js";
8
- import { HelpByCategoryList as j } from "./HelpByCategoryList.es.js";
9
- import F from "./MissingInstitution.es.js";
10
- import { PopularTopicsList as G } from "./PopularTopicsList.es.js";
11
- import { PopularTopicsDrawer as Y } from "./PopularTopicsDrawer.es.js";
12
- import { RequestSupportFooter as K } from "./RequestSupportFooter.es.js";
13
- import { RequestSupportInstitution as z } from "./RequestSupportInstitution.es.js";
14
- import Q from "./SupportSuccessMessage.es.js";
15
- import a from "react";
16
- import { observer as V } from "mobx-react-lite";
17
- import J from "@mui/material/Stack";
18
- import { Text as T } from "@mxenabled/mxui";
19
- import { jsx as i, jsxs as L } from "react/jsx-runtime";
20
- import X from "@mui/material/Box";
21
- var Ot = V(({ copy: e, isOpen: P, onClose: h }) => {
22
- const { onEvent: m } = k(), { alert: c, createSupportTicket: C, isLoading: _, setAlert: u } = D(), { isInitialized: b } = w(), { user: r } = U(), [n, l] = a.useState(""), [x, p] = a.useState(!1), [d, S] = a.useState(!1), [o, I] = a.useState({
1
+ import { useEvent as j, useGlobalUiStore as F, useHelpStore as G, useUserStore as Y } from "../../../common/context/hooks.es.js";
2
+ import K from "../../../common/components/drawer/Drawer.es.js";
3
+ import { ANALYTICS_EVENTS as R } from "../../../common/constants/Analytics.es.js";
4
+ import { HELP_BY_CATEGORY_LIST as z, POPULAR_TOPICS_LIST as V } from "../../../core/constants/Help.es.js";
5
+ import J from "../../../common/components/Loader.es.js";
6
+ import { RequestSupportHeader as Q } from "./RequestSupportHeader.es.js";
7
+ import { ContactSupport as X } from "./ContactSupport.es.js";
8
+ import { HelpByCategoryList as Z } from "./HelpByCategoryList.es.js";
9
+ import tt from "./MissingInstitution.es.js";
10
+ import { PopularTopicsList as et } from "./PopularTopicsList.es.js";
11
+ import { PopularTopicsDrawer as it } from "./PopularTopicsDrawer.es.js";
12
+ import { RequestSupportInstitution as ot } from "./RequestSupportInstitution.es.js";
13
+ import st from "./SupportSuccessMessage.es.js";
14
+ import n from "react";
15
+ import { observer as nt } from "mobx-react-lite";
16
+ import rt from "@mui/material/Stack";
17
+ import { Text as M } from "@mxenabled/mxui";
18
+ import { jsx as o, jsxs as O } from "react/jsx-runtime";
19
+ var Pt = nt(({ caseTopic: a, copy: e, isOpen: d, onTopicSelect: N, onClose: f }) => {
20
+ const { onEvent: h } = j(), { alert: g, createSupportTicket: L, isLoading: _, setAlert: m } = G(), { isInitialized: T } = F(), { user: r } = Y(), [l, u] = n.useState(""), [q, c] = n.useState(""), [w, p] = n.useState(!1), [D, S] = n.useState(!1), [s, b] = n.useState({
23
21
  isOpen: !1,
24
22
  topic: "",
25
23
  type: void 0
26
- }), R = M.map((t) => ({
27
- ...t,
28
- title: e.help_by_category_list[t.guid].label,
29
- topics: t.topics.map(({ type: s }, B) => ({
30
- type: s,
31
- label: e.help_by_category_list[t.guid].topics[B]
32
- }))
33
- })), E = Object.keys(e.popular_topics_list).map((t, s) => ({
24
+ }), E = z.flatMap((t) => {
25
+ const i = e.help_by_category_list?.[t.guid];
26
+ if (!i?.label) return [];
27
+ const H = "description" in i ? Object.values(i.topics ?? {}).map((I) => ({
28
+ label: I,
29
+ type: void 0
30
+ })) : t.topics.flatMap(({ type: I, topicKey: U }, A) => {
31
+ const x = (i.topics ?? {})[A];
32
+ return x === void 0 ? [] : [{
33
+ type: I,
34
+ topicKey: U,
35
+ label: x
36
+ }];
37
+ });
38
+ return [{
39
+ ...t,
40
+ description: "description" in i ? i.description : void 0,
41
+ title: i.label,
42
+ topics: H
43
+ }];
44
+ }), k = Object.keys(e.popular_topics_list).map((t, i) => ({
34
45
  name: e.popular_topics_list[t],
35
- type: W[s].type
36
- })), f = () => {
37
- l(""), I({
46
+ type: V[i].type
47
+ })), C = () => {
48
+ u(""), b({
38
49
  isOpen: !1,
39
50
  topic: "",
40
51
  type: void 0
41
52
  });
42
- }, v = (t) => {
43
- r.email && C({
53
+ }, y = (t) => {
54
+ c(t), p(!0);
55
+ }, P = a || q || s.topic || e.contact_support, B = (t) => {
56
+ r.email && L({
44
57
  email: r.email,
45
- message: n ? `Institution: ${n}, ${t}` : t,
46
- title: o.topic || "Contact Support"
58
+ message: l ? `Institution: ${l}, ${t}` : t,
59
+ title: P
47
60
  });
48
- }, O = (t, s) => {
49
- s === "other" ? S(!0) : I({
61
+ }, v = (t, i) => {
62
+ i === "other" ? S(!0) : b({
50
63
  isOpen: !0,
51
64
  topic: t,
52
- type: s
65
+ type: i
53
66
  });
54
- }, N = () => {
55
- u(""), p(!1), S(!1), f();
56
- }, q = (t) => {
67
+ }, W = () => {
68
+ m(""), c(""), p(!1), S(!1), C();
69
+ }, $ = (t) => {
57
70
  if (!r.email) {
58
- u(e.request_support_email_not_exists_message, "error");
71
+ m(e.request_support_email_not_exists_message, "error");
59
72
  return;
60
73
  }
61
- m(g.HELP_CLICK_SUPPORT_FOR_MISSING_INSTITUTION, {
74
+ h(R.HELP_CLICK_SUPPORT_FOR_MISSING_INSTITUTION, {
62
75
  supportTopic: "missingInstitution",
63
76
  institutionName: t.institutionName,
64
77
  institutionWebsite: t.institutionWebsite,
65
78
  institutionLoginPage: t.institutionLoginPage
66
- }), C({
79
+ }), L({
67
80
  email: r.email,
68
81
  message: `Institution Website: ${t.institutionWebsite}${t.institutionLoginPage ? ` Institution Login Page: ${t.institutionLoginPage}` : ""} `,
69
82
  title: `Institution Request: ${t.institutionName}`
70
83
  });
71
84
  };
72
- return /* @__PURE__ */ i(H, {
73
- isOpen: P,
74
- onClose: h,
75
- title: e.request_support,
76
- children: !b || _ ? /* @__PURE__ */ i($, {}) : /* @__PURE__ */ L(a.Fragment, { children: [
77
- /* @__PURE__ */ L(J, { children: [
78
- /* @__PURE__ */ i(y, {
79
- subtitle: e.request_support_short_content,
80
- title: e.request_support_title
81
- }),
82
- /* @__PURE__ */ i(T, {
83
- color: "text.primary",
84
- fontWeight: "bold",
85
- gutterBottom: !0,
86
- sx: { ml: 24 },
87
- variant: "caption",
88
- children: e.popular_topics
85
+ return /* @__PURE__ */ O(n.Fragment, { children: [
86
+ !a && /* @__PURE__ */ o(K, {
87
+ isOpen: d,
88
+ onClose: () => {
89
+ c(""), u(""), p(!1), f();
90
+ },
91
+ title: e.request_support,
92
+ children: !T || _ ? /* @__PURE__ */ o(J, {}) : /* @__PURE__ */ O(n.Fragment, { children: [
93
+ /* @__PURE__ */ O(rt, { children: [
94
+ /* @__PURE__ */ o(Q, {
95
+ subtitle: e.request_support_short_content,
96
+ title: e.request_support_title
97
+ }),
98
+ /* @__PURE__ */ o(M, {
99
+ color: "text.primary",
100
+ fontWeight: "bold",
101
+ gutterBottom: !0,
102
+ sx: { ml: 24 },
103
+ variant: "caption",
104
+ children: e.popular_topics
105
+ }),
106
+ /* @__PURE__ */ o(et, {
107
+ list: k,
108
+ onClick: (t, i) => {
109
+ h(R.HELP_CLICK_SUPPORT_TOPIC, { supportTopic: t }), v(t, i);
110
+ },
111
+ sx: { fontWeight: 400 }
112
+ }),
113
+ /* @__PURE__ */ o(M, {
114
+ color: "text.primary",
115
+ fontWeight: "bold",
116
+ gutterBottom: !0,
117
+ sx: {
118
+ mt: 24,
119
+ ml: 24
120
+ },
121
+ variant: "caption",
122
+ children: e.help_by_category
123
+ }),
124
+ /* @__PURE__ */ o(Z, {
125
+ copy: e,
126
+ helpByCategory: E,
127
+ onClick: v,
128
+ onOpenCase: y,
129
+ onTopicSelect: N
130
+ })
131
+ ] }),
132
+ /* @__PURE__ */ o(tt, {
133
+ copy: e,
134
+ isOpen: D,
135
+ onClose: () => S(!1),
136
+ onSave: $
89
137
  }),
90
- /* @__PURE__ */ i(G, {
91
- list: E,
92
- onClick: (t, s) => {
93
- m(g.HELP_CLICK_SUPPORT_TOPIC, { supportTopic: t }), O(t, s);
138
+ /* @__PURE__ */ o(it, {
139
+ copy: e,
140
+ isOpen: s.isOpen,
141
+ onClick: (t) => {
142
+ u(t), s.type === "internal" && p(!0);
94
143
  },
95
- sx: { fontWeight: 400 }
96
- }),
97
- /* @__PURE__ */ i(T, {
98
- color: "text.primary",
99
- fontWeight: "bold",
100
- gutterBottom: !0,
101
- sx: { m: "24px 0px 0px 24px" },
102
- variant: "caption",
103
- children: e.help_by_category
144
+ onClose: C,
145
+ topic: s.topic
104
146
  }),
105
- /* @__PURE__ */ i(j, {
106
- helpByCategory: R,
107
- onClick: O
108
- }),
109
- /* @__PURE__ */ i(X, {
110
- sx: { p: 24 },
111
- children: /* @__PURE__ */ i(K, {
112
- copy: e,
113
- onButtonClick: () => {
114
- m(g.HELP_OPEN_SUPPORT_REQUEST, {}), p(!0);
115
- }
116
- })
147
+ /* @__PURE__ */ o(ot, {
148
+ copy: e,
149
+ institution: l,
150
+ isOpen: !!l && s.type === "external",
151
+ onClose: () => u(""),
152
+ popularTopicsDrawerOnClose: C,
153
+ title: s.topic
117
154
  })
118
- ] }),
119
- /* @__PURE__ */ i(A, {
120
- alert: c,
121
- copy: e,
122
- email: r.email,
123
- institution: n,
124
- isLoading: _,
125
- isOpen: x,
126
- onClose: () => {
127
- p(!1), l("");
128
- },
129
- onSubmit: v,
130
- setAlert: u,
131
- topic: o.topic || e.contact_support
132
- }),
133
- /* @__PURE__ */ i(F, {
134
- copy: e,
135
- isOpen: d,
136
- onClose: () => S(!1),
137
- onSave: q
138
- }),
139
- /* @__PURE__ */ i(Y, {
140
- copy: e,
141
- isOpen: o.isOpen,
142
- onClick: (t) => {
143
- l(t), o.type === "internal" && p(!0);
144
- },
145
- onClose: f,
146
- topic: o.topic
147
- }),
148
- /* @__PURE__ */ i(Q, {
149
- copy: e,
150
- email: r.email,
151
- isOpen: !!c.message && c.severity === "success" && !_,
152
- onBack: () => {
153
- u(""), o.type === "internal" && p(!1);
154
- },
155
- onClose: N
156
- }),
157
- /* @__PURE__ */ i(z, {
158
- copy: e,
159
- institution: n,
160
- isOpen: !!n && o.type === "external",
161
- onClose: () => l(""),
162
- popularTopicsDrawerOnClose: f,
163
- title: o.topic
164
- })
165
- ] })
166
- });
155
+ ] })
156
+ }),
157
+ /* @__PURE__ */ o(X, {
158
+ alert: g,
159
+ copy: e,
160
+ email: r.email,
161
+ institution: l,
162
+ isLoading: _,
163
+ isOpen: (!!a || w) && d && T,
164
+ onClose: () => {
165
+ c(""), u(""), p(!1), a && f();
166
+ },
167
+ onSubmit: B,
168
+ setAlert: m,
169
+ topic: P
170
+ }),
171
+ /* @__PURE__ */ o(st, {
172
+ copy: e,
173
+ email: r.email,
174
+ isOpen: !!g.message && g.severity === "success" && !_,
175
+ onBack: () => {
176
+ m(""), s.type === "internal" && p(!1);
177
+ },
178
+ onClose: () => {
179
+ W(), a && f();
180
+ }
181
+ })
182
+ ] });
167
183
  });
168
184
  export {
169
- Ot as RequestSupport
185
+ Pt as RequestSupport
170
186
  };
171
187
 
172
188
  //# sourceMappingURL=RequestSupport.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RequestSupport.es.js","names":[],"sources":["../../../../src/help/components/requestsupport/RequestSupport.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport {\n Drawer,\n Loader,\n useGlobalUiStore,\n useHelpStore,\n useUserStore,\n ANALYTICS_EVENTS,\n useEvent,\n} from '../../../common'\nimport {\n type HelpByCategoryList as IHelpByCategoryList,\n type HelpType,\n type InstitutionData,\n HelpCopy,\n} from '../../../core'\n\nimport { HELP_BY_CATEGORY_LIST, POPULAR_TOPICS_LIST } from '../../../core/constants/Help'\nimport { ContactSupport } from './ContactSupport'\nimport { HelpByCategoryList } from './HelpByCategoryList'\nimport MissingInstitution from './MissingInstitution'\nimport { PopularTopicsDrawer } from './PopularTopicsDrawer'\nimport { ListItem, PopularTopicsList } from './PopularTopicsList'\nimport { RequestSupportFooter } from './RequestSupportFooter'\nimport { RequestSupportHeader } from './RequestSupportHeader'\nimport { RequestSupportInstitution } from './RequestSupportInstitution'\nimport SupportSuccessMessage from './SupportSuccessMessage'\n\ninterface RequestSupportProps {\n copy: HelpCopy\n isOpen: boolean\n onClose: () => void\n}\n\ninterface TopicProps {\n isOpen: boolean\n topic: string\n type: HelpType\n}\n\nexport const RequestSupport: React.FC<RequestSupportProps> = observer(\n ({ copy, isOpen, onClose }) => {\n const { onEvent } = useEvent()\n const { alert, createSupportTicket, isLoading, setAlert } = useHelpStore()\n const { isInitialized } = useGlobalUiStore()\n const { user } = useUserStore()\n\n const [institution, setInstitution] = React.useState('')\n const [isContactSupportDrawerOpen, setIsContactSupportDrawerOpen] = React.useState(false)\n const [isMissingInstitutionsOpen, setIsMissingInstitutionsOpen] = React.useState(false)\n const [topicsListDrawer, setTopicsListDrawer] = React.useState<TopicProps>({\n isOpen: false,\n topic: '',\n type: undefined,\n })\n\n const helpByCategoryList = HELP_BY_CATEGORY_LIST.map((el) => ({\n ...el,\n title: copy.help_by_category_list[el.guid as keyof IHelpByCategoryList].label,\n topics: el.topics.map(({ type }, index) => ({\n type: type as HelpType,\n label: copy.help_by_category_list[el.guid as keyof IHelpByCategoryList].topics[index],\n })),\n }))\n\n const popularTopics = Object.keys(copy.popular_topics_list).map((list, i) => ({\n name: copy.popular_topics_list[list],\n type: POPULAR_TOPICS_LIST[i].type as ListItem['type'],\n }))\n\n const handleCloseDrawer = () => {\n setInstitution('')\n setTopicsListDrawer({ isOpen: false, topic: '', type: undefined })\n }\n\n const handleContactSupportSubmit = (message: string) => {\n if (!user.email) return\n\n createSupportTicket({\n email: user.email,\n message: institution ? `Institution: ${institution}, ${message}` : message,\n title: topicsListDrawer.topic || 'Contact Support',\n })\n }\n\n const handleSupportNavigation = (topic: string, type: HelpType) => {\n if (type === 'other') setIsMissingInstitutionsOpen(true)\n else setTopicsListDrawer({ isOpen: true, topic, type })\n }\n\n const handleSupportSuccessMessage = () => {\n setAlert('')\n setIsContactSupportDrawerOpen(false)\n setIsMissingInstitutionsOpen(false)\n handleCloseDrawer()\n }\n\n const handleMissingInstitution = (data: InstitutionData) => {\n if (!user.email) {\n setAlert(copy.request_support_email_not_exists_message, 'error')\n return\n }\n\n onEvent(ANALYTICS_EVENTS.HELP_CLICK_SUPPORT_FOR_MISSING_INSTITUTION, {\n supportTopic: 'missingInstitution',\n institutionName: data.institutionName,\n institutionWebsite: data.institutionWebsite,\n institutionLoginPage: data.institutionLoginPage,\n })\n\n createSupportTicket({\n email: user.email,\n message: `Institution Website: ${data.institutionWebsite}${data.institutionLoginPage ? ` Institution Login Page: ${data.institutionLoginPage}` : ''} `,\n title: `Institution Request: ${data.institutionName}`,\n })\n }\n\n return (\n <Drawer isOpen={isOpen} onClose={onClose} title={copy.request_support}>\n {!isInitialized || isLoading ? (\n <Loader />\n ) : (\n <React.Fragment>\n <Stack>\n <RequestSupportHeader\n subtitle={copy.request_support_short_content}\n title={copy.request_support_title}\n />\n <Text\n color=\"text.primary\"\n fontWeight=\"bold\"\n gutterBottom={true}\n sx={{ ml: 24 }}\n variant=\"caption\"\n >\n {copy.popular_topics}\n </Text>\n <PopularTopicsList\n list={popularTopics}\n onClick={(title, type) => {\n onEvent(ANALYTICS_EVENTS.HELP_CLICK_SUPPORT_TOPIC, { supportTopic: title })\n\n handleSupportNavigation(title, type)\n }}\n sx={{ fontWeight: 400 }}\n />\n <Text\n color=\"text.primary\"\n fontWeight=\"bold\"\n gutterBottom={true}\n sx={{ m: '24px 0px 0px 24px' }}\n variant=\"caption\"\n >\n {copy.help_by_category}\n </Text>\n <HelpByCategoryList\n helpByCategory={helpByCategoryList}\n onClick={handleSupportNavigation}\n />\n <Box sx={{ p: 24 }}>\n <RequestSupportFooter\n copy={copy}\n onButtonClick={() => {\n onEvent(ANALYTICS_EVENTS.HELP_OPEN_SUPPORT_REQUEST, {})\n\n setIsContactSupportDrawerOpen(true)\n }}\n />\n </Box>\n </Stack>\n <ContactSupport\n alert={alert}\n copy={copy}\n email={user.email}\n institution={institution}\n isLoading={isLoading}\n isOpen={isContactSupportDrawerOpen}\n onClose={() => {\n setIsContactSupportDrawerOpen(false)\n setInstitution('')\n }}\n onSubmit={handleContactSupportSubmit}\n setAlert={setAlert}\n topic={topicsListDrawer.topic || copy.contact_support}\n />\n <MissingInstitution\n copy={copy}\n isOpen={isMissingInstitutionsOpen}\n onClose={() => setIsMissingInstitutionsOpen(false)}\n onSave={handleMissingInstitution}\n />\n <PopularTopicsDrawer\n copy={copy}\n isOpen={topicsListDrawer.isOpen}\n onClick={(title) => {\n setInstitution(title)\n if (topicsListDrawer.type === 'internal') setIsContactSupportDrawerOpen(true)\n }}\n onClose={handleCloseDrawer}\n topic={topicsListDrawer.topic}\n />\n <SupportSuccessMessage\n copy={copy}\n email={user.email!}\n isOpen={!!alert.message && alert.severity === 'success' && !isLoading}\n onBack={() => {\n setAlert('')\n if (topicsListDrawer.type === 'internal') setIsContactSupportDrawerOpen(false)\n }}\n onClose={handleSupportSuccessMessage}\n />\n <RequestSupportInstitution\n copy={copy}\n institution={institution}\n isOpen={!!institution && topicsListDrawer.type === 'external'}\n onClose={() => setInstitution('')}\n popularTopicsDrawerOnClose={handleCloseDrawer}\n title={topicsListDrawer.topic}\n />\n </React.Fragment>\n )}\n </Drawer>\n )\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA+CA,IAAa,KAAgD,EAAA,CAC1D,EAAE,MAAA,GAAM,QAAA,GAAQ,SAAA,EAAA,MAAc;AAC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K;AAAA,QACjD,QAAQ;AAAA,MACT,CAAA;AAAA,MACD,gBAAA,EAAC,GAAD;AAAA,QACQ,MAAA;AAAA,QACN,QAAQ,EAAiB;AAAA,QACzB,SAAA,CAAU,MAAU;AAClB,UAAA,EAAe,CAAK,GAChB,EAAiB,SAAS,cAAY,EAA8B,EAAI;AAAA,QAC9E;AAAA,QACA,SAAS;AAAA,QACT,OAAO,EAAiB;AAAA,MACzB,CAAA;AAAA,MACD,gBAAA,EAAC,GAAD;AAAA,QACQ,MAAA;AAAA,QACN,OAAO,EAAK;AAAA,QACZ,QAAQ,CAAC,CAAC,EAAM,WAAW,EAAM,aAAa,aAAa,CAAC;AAAA,QAC5D,QAAA,MAAc;AACZ,UAAA,EAAS,EAAE,GACP,EAAiB,SAAS,cAAY,EAA8B,EAAK;AAAA,QAC/E;AAAA,QACA,SAAS;AAAA,MACV,CAAA;AAAA,MACD,gBAAA,EAAC,GAAD;AAAA,QACQ,MAAA;AAAA,QACO,aAAA;AAAA,QACb,QAAQ,CAAC,CAAC,KAAe,EAAiB,SAAS;AAAA,QACnD,SAAA,MAAe,EAAe,EAAE;AAAA,QAChC,4BAA4B;AAAA,QAC5B,OAAO,EAAiB;AAAA,MACzB,CAAA;AAAA,IACa,EAAA,CAAA;AAAA,EAEZ,CAAA;AAEZ,CACF"}
1
+ {"version":3,"file":"RequestSupport.es.js","names":[],"sources":["../../../../src/help/components/requestsupport/RequestSupport.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport {\n Drawer,\n Loader,\n useGlobalUiStore,\n useHelpStore,\n useUserStore,\n ANALYTICS_EVENTS,\n useEvent,\n} from '../../../common'\nimport type { HelpType, InstitutionData, HelpCopy, SelectedTopic } from '../../../core'\n\nimport { HELP_BY_CATEGORY_LIST, POPULAR_TOPICS_LIST } from '../../../core/constants/Help'\nimport { ContactSupport } from './ContactSupport'\nimport { HelpByCategoryList } from './HelpByCategoryList'\nimport MissingInstitution from './MissingInstitution'\nimport { PopularTopicsDrawer } from './PopularTopicsDrawer'\nimport { ListItem, PopularTopicsList } from './PopularTopicsList'\nimport { RequestSupportHeader } from './RequestSupportHeader'\nimport { RequestSupportInstitution } from './RequestSupportInstitution'\nimport SupportSuccessMessage from './SupportSuccessMessage'\n\ninterface RequestSupportProps {\n caseTopic?: string\n copy: HelpCopy\n isOpen: boolean\n onTopicSelect: (topic: SelectedTopic) => void\n onClose: () => void\n}\n\ninterface TopicProps {\n isOpen: boolean\n topic: string\n type: HelpType\n}\n\nexport const RequestSupport: React.FC<RequestSupportProps> = observer(\n ({ caseTopic, copy, isOpen, onTopicSelect, onClose }) => {\n const { onEvent } = useEvent()\n const { alert, createSupportTicket, isLoading, setAlert } = useHelpStore()\n const { isInitialized } = useGlobalUiStore()\n const { user } = useUserStore()\n\n const [institution, setInstitution] = React.useState('')\n const [openCaseTopic, setOpenCaseTopic] = React.useState('')\n const [isContactSupportDrawerOpen, setIsContactSupportDrawerOpen] = React.useState(false)\n const [isMissingInstitutionsOpen, setIsMissingInstitutionsOpen] = React.useState(false)\n const [topicsListDrawer, setTopicsListDrawer] = React.useState<TopicProps>({\n isOpen: false,\n topic: '',\n type: undefined,\n })\n\n const helpByCategoryList = HELP_BY_CATEGORY_LIST.flatMap((el) => {\n const category = copy.help_by_category_list?.[el.guid]\n if (!category?.label) return []\n\n // The informational card (Contact Your Bank) has no clickable rows: its\n // bullets come straight from copy. Every other card maps the definition\n // entries (which carry type and/or topicKey) onto the copy labels, so a\n // definition whose copy is missing is skipped rather than rendered\n // nameless, and a topicKey travels to the article routing.\n const informational = 'description' in category\n const topics = informational\n ? Object.values(category.topics ?? {}).map((label) => ({ label, type: undefined }))\n : el.topics.flatMap(({ type, topicKey }, index) => {\n const label = (category.topics ?? {})[index]\n return label === undefined ? [] : [{ type, topicKey, label }]\n })\n\n return [\n {\n ...el,\n description: 'description' in category ? category.description : undefined,\n title: category.label,\n topics,\n },\n ]\n })\n\n const popularTopics = Object.keys(copy.popular_topics_list).map((list, i) => ({\n name: copy.popular_topics_list[list],\n type: POPULAR_TOPICS_LIST[i].type as ListItem['type'],\n }))\n\n const handleCloseDrawer = () => {\n setInstitution('')\n setTopicsListDrawer({ isOpen: false, topic: '', type: undefined })\n }\n\n const handleOpenCase = (topic: string) => {\n setOpenCaseTopic(topic)\n setIsContactSupportDrawerOpen(true)\n }\n\n // One expression feeds both the form heading and the filed ticket, so what the\n // user sees and what is submitted cannot disagree.\n const caseTitle = caseTopic || openCaseTopic || topicsListDrawer.topic || copy.contact_support\n\n const handleContactSupportSubmit = (message: string) => {\n if (!user.email) return\n\n createSupportTicket({\n email: user.email,\n message: institution ? `Institution: ${institution}, ${message}` : message,\n title: caseTitle,\n })\n }\n\n const handleSupportNavigation = (topic: string, type: HelpType) => {\n if (type === 'other') setIsMissingInstitutionsOpen(true)\n else setTopicsListDrawer({ isOpen: true, topic, type })\n }\n\n const handleSupportSuccessMessage = () => {\n setAlert('')\n setOpenCaseTopic('')\n setIsContactSupportDrawerOpen(false)\n setIsMissingInstitutionsOpen(false)\n handleCloseDrawer()\n }\n\n const handleMissingInstitution = (data: InstitutionData) => {\n if (!user.email) {\n setAlert(copy.request_support_email_not_exists_message, 'error')\n return\n }\n\n onEvent(ANALYTICS_EVENTS.HELP_CLICK_SUPPORT_FOR_MISSING_INSTITUTION, {\n supportTopic: 'missingInstitution',\n institutionName: data.institutionName,\n institutionWebsite: data.institutionWebsite,\n institutionLoginPage: data.institutionLoginPage,\n })\n\n createSupportTicket({\n email: user.email,\n message: `Institution Website: ${data.institutionWebsite}${data.institutionLoginPage ? ` Institution Login Page: ${data.institutionLoginPage}` : ''} `,\n title: `Institution Request: ${data.institutionName}`,\n })\n }\n\n return (\n <React.Fragment>\n {!caseTopic && (\n <Drawer\n isOpen={isOpen}\n onClose={() => {\n setOpenCaseTopic('')\n setInstitution('')\n setIsContactSupportDrawerOpen(false)\n onClose()\n }}\n title={copy.request_support}\n >\n {!isInitialized || isLoading ? (\n <Loader />\n ) : (\n <React.Fragment>\n <Stack>\n <RequestSupportHeader\n subtitle={copy.request_support_short_content}\n title={copy.request_support_title}\n />\n <Text\n color=\"text.primary\"\n fontWeight=\"bold\"\n gutterBottom={true}\n sx={{ ml: 24 }}\n variant=\"caption\"\n >\n {copy.popular_topics}\n </Text>\n <PopularTopicsList\n list={popularTopics}\n onClick={(title, type) => {\n onEvent(ANALYTICS_EVENTS.HELP_CLICK_SUPPORT_TOPIC, { supportTopic: title })\n\n handleSupportNavigation(title, type)\n }}\n sx={{ fontWeight: 400 }}\n />\n <Text\n color=\"text.primary\"\n fontWeight=\"bold\"\n gutterBottom={true}\n sx={{ mt: 24, ml: 24 }}\n variant=\"caption\"\n >\n {copy.help_by_category}\n </Text>\n <HelpByCategoryList\n copy={copy}\n helpByCategory={helpByCategoryList}\n onClick={handleSupportNavigation}\n onOpenCase={handleOpenCase}\n onTopicSelect={onTopicSelect}\n />\n </Stack>\n <MissingInstitution\n copy={copy}\n isOpen={isMissingInstitutionsOpen}\n onClose={() => setIsMissingInstitutionsOpen(false)}\n onSave={handleMissingInstitution}\n />\n <PopularTopicsDrawer\n copy={copy}\n isOpen={topicsListDrawer.isOpen}\n onClick={(title) => {\n setInstitution(title)\n if (topicsListDrawer.type === 'internal') setIsContactSupportDrawerOpen(true)\n }}\n onClose={handleCloseDrawer}\n topic={topicsListDrawer.topic}\n />\n <RequestSupportInstitution\n copy={copy}\n institution={institution}\n isOpen={!!institution && topicsListDrawer.type === 'external'}\n onClose={() => setInstitution('')}\n popularTopicsDrawerOnClose={handleCloseDrawer}\n title={topicsListDrawer.topic}\n />\n </React.Fragment>\n )}\n </Drawer>\n )}\n <ContactSupport\n alert={alert}\n copy={copy}\n email={user.email}\n institution={institution}\n isLoading={isLoading}\n isOpen={(!!caseTopic || isContactSupportDrawerOpen) && isOpen && isInitialized}\n onClose={() => {\n setOpenCaseTopic('')\n setInstitution('')\n setIsContactSupportDrawerOpen(false)\n if (caseTopic) onClose()\n }}\n onSubmit={handleContactSupportSubmit}\n setAlert={setAlert}\n topic={caseTitle}\n />\n <SupportSuccessMessage\n copy={copy}\n email={user.email!}\n isOpen={!!alert.message && alert.severity === 'success' && !isLoading}\n onBack={() => {\n setAlert('')\n if (topicsListDrawer.type === 'internal') setIsContactSupportDrawerOpen(false)\n }}\n onClose={() => {\n handleSupportSuccessMessage()\n if (caseTopic) onClose()\n }}\n />\n </React.Fragment>\n )\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0CA,IAAa,KAAgD,GAAA,CAC1D,EAAE,WAAA,GAAW,MAAA,GAAM,QAAA,GAAQ,eAAA,GAAe,SAAA,EAAA,MAAc;AACvD,QAAM,EAAE,SAAA,EAAA,IAAY,EAAS,GACvB,EAAE,OAAA,GAAO,qBAAA,GAAqB,WAAA,GAAW,UAAA,EAAA,IAAa,EAAa,GACnE,EAAE,eAAA,EAAA,IAAkB,EAAiB,GACrC,EAAE,MAAA,EAAA,IAAS,EAAa,GAExB,CAAC,GAAa,CAAA,IAAkB,EAAM,SAAS,EAAE,GACjD,CAAC,GAAe,CAAA,IAAoB,EAAM,SAAS,EAAE,GACrD,CAAC,GAA4B,CAAA,IAAiC,EAAM,SAAS,EAAK,GAClF,CAAC,GAA2B,CAAA,IAAgC,EAAM,SAAS,EAAK,GAChF,CAAC,GAAkB,CAAA,IAAuB,EAAM,SAAqB;AAAA,IACzE,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,MAAM;AAAA,EACR,CAAC,GAEK,IAAqB,EAAsB,QAAA,CAAS,MAAO;AAC/D,UAAM,IAAW,EAAK,wBAAwB,EAAG,IAAA;AACjD,QAAI,CAAC,GAAU,MAAO,QAAO,CAAC;AAQ9B,UAAM,IADgB,iBAAiB,IAEnC,OAAO,OAAO,EAAS,UAAU,CAAC,CAAC,EAAE,IAAA,CAAK,OAAW;AAAA,MAAE,OAAA;AAAA,MAAO,MAAM;AAAA,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,IAEV,gBAAA,EAAC,GAAD;AAAA,MACS,OAAA;AAAA,MACD,MAAA;AAAA,MACN,OAAO,EAAK;AAAA,MACC,aAAA;AAAA,MACF,WAAA;AAAA,MACX,SAAS,CAAC,CAAC,KAAa,MAA+B,KAAU;AAAA,MACjE,SAAA,MAAe;AACb,QAAA,EAAiB,EAAE,GACnB,EAAe,EAAE,GACjB,EAA8B,EAAK,GAC/B,KAAW,EAAQ;AAAA,MACzB;AAAA,MACA,UAAU;AAAA,MACA,UAAA;AAAA,MACV,OAAO;AAAA,IACR,CAAA;AAAA,IACD,gBAAA,EAAC,IAAD;AAAA,MACQ,MAAA;AAAA,MACN,OAAO,EAAK;AAAA,MACZ,QAAQ,CAAC,CAAC,EAAM,WAAW,EAAM,aAAa,aAAa,CAAC;AAAA,MAC5D,QAAA,MAAc;AACZ,QAAA,EAAS,EAAE,GACP,EAAiB,SAAS,cAAY,EAA8B,EAAK;AAAA,MAC/E;AAAA,MACA,SAAA,MAAe;AACb,QAAA,EAA4B,GACxB,KAAW,EAAQ;AAAA,MACzB;AAAA,IACD,CAAA;AAAA,EACa,EAAA,CAAA;AAEpB,CACF"}
@@ -21,6 +21,16 @@ export interface DismissParams {
21
21
  beatGuid: string;
22
22
  type: DismissType;
23
23
  }
24
+ /**
25
+ * A CTA side effect the host must perform because experiences cannot (beat-owned endpoints,
26
+ * spending plan items, third-party SDKs). `name` is agreed between the ctaActions table and
27
+ * the host; see insights-v2/ctaActions/README.md for the list.
28
+ */
29
+ export interface CtaActionParams {
30
+ beatGuid: string;
31
+ name: string;
32
+ params?: Record<string, unknown>;
33
+ }
24
34
  /** Host callbacks for a beat card. */
25
35
  export interface BeatActions {
26
36
  onMenuAction?: MenuActionHandlers;
@@ -40,6 +50,7 @@ export interface BeatActions {
40
50
  * renders disabled (see `isContactSupportCtaDisabled`).
41
51
  */
42
52
  onContactSupport?: () => void;
53
+ onCtaAction?: (params: CtaActionParams) => Promise<void> | void;
43
54
  }
44
55
  export declare const BeatActionsProvider: ({ value, children, }: {
45
56
  value: BeatActions;
@@ -1 +1 @@
1
- {"version":3,"file":"beatActions.es.js","names":[],"sources":["../../src/insights-v2/beatActions.tsx"],"sourcesContent":["import { createContext, useContext, type ReactNode } from 'react'\n\nimport type { DismissType } from './components/DismissInsightDialog'\nimport type { FeedbackDialogCloseReason } from './components/FeedbackDialog'\n\nexport type InsightMenuAction = 'helpful' | 'not_helpful' | 'hide'\nexport type InsightRating = 'helpful' | 'not_helpful'\n\nexport interface MenuActionHandlers {\n onAction: (action: InsightMenuAction) => void\n onOpen?: () => void\n disabled?: boolean\n}\n\nexport interface UpdateParams {\n beatGuid: string\n}\n\nexport interface FeedbackParams {\n beatGuid: string\n source: InsightRating | 'hide'\n option: string\n detail?: string\n}\n\nexport interface DismissParams {\n beatGuid: string\n type: DismissType\n}\n\n/** Host callbacks for a beat card. */\nexport interface BeatActions {\n onMenuAction?: MenuActionHandlers\n onUpdate?: (params: UpdateParams) => void\n onSubmitFeedback?: (params: FeedbackParams) => void\n onDismissInsight?: (params: DismissParams) => void\n onUndoDismiss?: (params: { beatGuid: string }) => void\n onFeedbackDialogClose?: (reason: FeedbackDialogCloseReason) => void\n onFeedbackDialogBack?: () => void\n onFeedbackTextFocus?: () => void\n /**\n * Opens the host's contact-support flow for a `contact_support_block` CTA. insights-v2 cannot\n * import the help module (hosts that don't ship it stub the import), so the host supplies it:\n * the experiences Help widget wires `RequestSupport`; pulse wires its own. When absent, the CTA\n * renders disabled (see `isContactSupportCtaDisabled`).\n */\n onContactSupport?: () => void\n}\n\nconst BeatActionsContext = createContext<BeatActions>({})\n\nexport const BeatActionsProvider = ({\n value,\n children,\n}: {\n value: BeatActions\n children: ReactNode\n}) => <BeatActionsContext.Provider value={value}>{children}</BeatActionsContext.Provider>\n\nexport const useBeatActions = () => useContext(BeatActionsContext)\n"],"mappings":";;AAiDA,IAAM,IAAqB,EAA2B,CAAC,CAAC,GAE3C,IAAA,CAAuB,EAClC,OAAA,GACA,UAAA,EAAA,MAII,gBAAA,EAAC,EAAmB,UAApB;AAAA,EAAoC,OAAA;AAAA,EAAQ,UAAA;AAAsC,CAAA,GAE3E,IAAA,MAAuB,EAAW,CAAkB"}
1
+ {"version":3,"file":"beatActions.es.js","names":[],"sources":["../../src/insights-v2/beatActions.tsx"],"sourcesContent":["import { createContext, useContext, type ReactNode } from 'react'\n\nimport type { DismissType } from './components/DismissInsightDialog'\nimport type { FeedbackDialogCloseReason } from './components/FeedbackDialog'\n\nexport type InsightMenuAction = 'helpful' | 'not_helpful' | 'hide'\nexport type InsightRating = 'helpful' | 'not_helpful'\n\nexport interface MenuActionHandlers {\n onAction: (action: InsightMenuAction) => void\n onOpen?: () => void\n disabled?: boolean\n}\n\nexport interface UpdateParams {\n beatGuid: string\n}\n\nexport interface FeedbackParams {\n beatGuid: string\n source: InsightRating | 'hide'\n option: string\n detail?: string\n}\n\nexport interface DismissParams {\n beatGuid: string\n type: DismissType\n}\n\n/**\n * A CTA side effect the host must perform because experiences cannot (beat-owned endpoints,\n * spending plan items, third-party SDKs). `name` is agreed between the ctaActions table and\n * the host; see insights-v2/ctaActions/README.md for the list.\n */\nexport interface CtaActionParams {\n beatGuid: string\n name: string\n params?: Record<string, unknown>\n}\n\n/** Host callbacks for a beat card. */\nexport interface BeatActions {\n onMenuAction?: MenuActionHandlers\n onUpdate?: (params: UpdateParams) => void\n onSubmitFeedback?: (params: FeedbackParams) => void\n onDismissInsight?: (params: DismissParams) => void\n onUndoDismiss?: (params: { beatGuid: string }) => void\n onFeedbackDialogClose?: (reason: FeedbackDialogCloseReason) => void\n onFeedbackDialogBack?: () => void\n onFeedbackTextFocus?: () => void\n /**\n * Opens the host's contact-support flow for a `contact_support_block` CTA. insights-v2 cannot\n * import the help module (hosts that don't ship it stub the import), so the host supplies it:\n * the experiences Help widget wires `RequestSupport`; pulse wires its own. When absent, the CTA\n * renders disabled (see `isContactSupportCtaDisabled`).\n */\n onContactSupport?: () => void\n onCtaAction?: (params: CtaActionParams) => Promise<void> | void\n}\n\nconst BeatActionsContext = createContext<BeatActions>({})\n\nexport const BeatActionsProvider = ({\n value,\n children,\n}: {\n value: BeatActions\n children: ReactNode\n}) => <BeatActionsContext.Provider value={value}>{children}</BeatActionsContext.Provider>\n\nexport const useBeatActions = () => useContext(BeatActionsContext)\n"],"mappings":";;AA6DA,IAAM,IAAqB,EAA2B,CAAC,CAAC,GAE3C,IAAA,CAAuB,EAClC,OAAA,GACA,UAAA,EAAA,MAII,gBAAA,EAAC,EAAmB,UAApB;AAAA,EAAoC,OAAA;AAAA,EAAQ,UAAA;AAAsC,CAAA,GAE3E,IAAA,MAAuB,EAAW,CAAkB"}