@mx-cartographer/experiences 9.6.12 → 9.6.14
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 +21 -0
- package/dist/common/components/CurrencyDialog.d.ts +6 -1
- package/dist/common/components/CurrencyDialog.es.js +24 -23
- package/dist/common/components/CurrencyDialog.es.js.map +1 -1
- package/dist/core/types/Insights.d.ts +7 -1
- package/dist/core/types/Insights.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js +3 -3
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +66 -61
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/ConnectWidgetActionBlock.es.js +17 -11
- package/dist/insights-v2/actionBlocks/ConnectWidgetActionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/layout.d.ts +27 -0
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/layout.es.js +14 -0
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/layout.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.es.js +5 -5
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/util.d.ts +6 -2
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/util.es.js +7 -4
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/util.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +63 -57
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/util.d.ts +4 -3
- package/dist/insights-v2/actionBlocks/util.es.js.map +1 -1
- package/dist/insights-v2/analytics/analyticsEventsConfig.d.ts +67 -0
- package/dist/insights-v2/analytics/analyticsEventsConfig.es.js +59 -0
- package/dist/insights-v2/analytics/analyticsEventsConfig.es.js.map +1 -0
- package/dist/insights-v2/analytics/index.d.ts +3 -0
- package/dist/insights-v2/analytics/resolveAnalyticsEvent.d.ts +5 -0
- package/dist/insights-v2/analytics/resolveAnalyticsEvent.es.js +19 -0
- package/dist/insights-v2/analytics/resolveAnalyticsEvent.es.js.map +1 -0
- package/dist/insights-v2/analytics/useAnalyticsEvent.d.ts +3 -0
- package/dist/insights-v2/analytics/useAnalyticsEvent.es.js +20 -0
- package/dist/insights-v2/analytics/useAnalyticsEvent.es.js.map +1 -0
- package/dist/insights-v2/beatActions.d.ts +18 -13
- package/dist/insights-v2/beatActions.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js +24 -22
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js.map +1 -1
- package/dist/insights-v2/components/BaseLayout.es.js +89 -79
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/components/CompactInsightCard.es.js +34 -24
- package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
- package/dist/insights-v2/components/LogoFromGuid.d.ts +2 -2
- package/dist/insights-v2/components/LogoFromGuid.es.js +44 -32
- package/dist/insights-v2/components/LogoFromGuid.es.js.map +1 -1
- package/dist/insights-v2/components/SubHeader.es.js +3 -2
- package/dist/insights-v2/components/SubHeader.es.js.map +1 -1
- package/dist/insights-v2/components/chartblocks/EmptyBarChart.es.js +4 -4
- package/dist/insights-v2/components/shared/EntityLogo.es.js +31 -21
- package/dist/insights-v2/components/shared/EntityLogo.es.js.map +1 -1
- package/dist/insights-v2/components/shared/images/FeeDetected.es.js +243 -0
- package/dist/insights-v2/components/shared/images/FeeDetected.es.js.map +1 -0
- package/dist/insights-v2/ctaActions/ctaHandlers.d.ts +1 -6
- package/dist/insights-v2/ctaActions/ctaHandlers.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/index.d.ts +1 -1
- package/dist/insights-v2/ctaActions/runCtaAction.d.ts +20 -5
- package/dist/insights-v2/ctaActions/runCtaAction.es.js +63 -41
- package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/types.d.ts +6 -5
- package/dist/insights-v2/index.es.js +84 -84
- package/dist/insights-v2/mappings/blocks.es.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { forwardRef as i } from "react";
|
|
2
|
+
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
3
|
+
var d = (t, o) => /* @__PURE__ */ r("svg", {
|
|
4
|
+
width: 69.63,
|
|
5
|
+
height: 62.06,
|
|
6
|
+
viewBox: "318.76 47.75 69.63 62.06",
|
|
7
|
+
fill: "none",
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9
|
+
ref: o,
|
|
10
|
+
...t,
|
|
11
|
+
children: [/* @__PURE__ */ r("g", {
|
|
12
|
+
id: "Embedded Content | Fee Detected",
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ e("path", {
|
|
15
|
+
id: "Vector_2",
|
|
16
|
+
opacity: 0.25,
|
|
17
|
+
d: "M384.927 73.4087C387.943 78.5874 386.227 90.986 380.36 97.0299C375.97 101.553 361.637 108.577 353.787 107.744C336.824 105.944 348.044 85.3643 338.64 77.4848C330.851 70.958 318.747 60.8728 334.365 53.5202C344.569 48.7165 352.895 53.2886 365.162 61.8884C373.054 67.4211 378.295 62.022 384.927 73.4087Z",
|
|
18
|
+
className: "brand300",
|
|
19
|
+
fill: "#2C64EF"
|
|
20
|
+
}),
|
|
21
|
+
/* @__PURE__ */ r("g", {
|
|
22
|
+
id: "paper",
|
|
23
|
+
clipPath: "url(#fee_light_clip0)",
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ r("g", {
|
|
26
|
+
id: "Vector_3",
|
|
27
|
+
children: [/* @__PURE__ */ e("path", {
|
|
28
|
+
d: "M367.852 51.9608V79.9019V95.3431L366.139 93.8725L364.426 95.3431L362.705 93.8725L360.992 95.3431L359.279 93.8725L357.558 95.3431L355.845 93.8725L354.124 95.3431L352.411 93.8725L350.698 95.3431L348.977 93.8725L347.264 95.3431L345.551 93.8725L343.83 95.3431L342.117 93.8725L340.396 95.3431L338.676 93.8725L336.97 95.3431V52.6961C336.97 51.916 337.28 51.1679 337.831 50.6163C338.383 50.0648 339.131 49.7549 339.911 49.7549H370.058H370.793",
|
|
29
|
+
fill: "white"
|
|
30
|
+
}), /* @__PURE__ */ e("path", {
|
|
31
|
+
d: "M370.058 49.7549H339.911C339.131 49.7549 338.383 50.0648 337.831 50.6163C337.28 51.1679 336.97 51.916 336.97 52.6961V95.3431L338.676 93.8725L340.396 95.3431L342.117 93.8725L343.83 95.3431L345.551 93.8725L347.264 95.3431L348.977 93.8725L350.698 95.3431L352.411 93.8725L354.124 95.3431L355.845 93.8725L357.558 95.3431L359.279 93.8725L360.992 95.3431L362.705 93.8725L364.426 95.3431L366.139 93.8725L367.852 95.3431V79.9019V51.9608C367.852 51.3757 368.084 50.8147 368.498 50.401C368.912 49.9873 369.473 49.7549 370.058 49.7549ZM370.058 49.7549H370.793",
|
|
32
|
+
className: "brand300",
|
|
33
|
+
stroke: "#2C64EF",
|
|
34
|
+
strokeWidth: 1.5,
|
|
35
|
+
strokeLinecap: "round",
|
|
36
|
+
strokeLinejoin: "round"
|
|
37
|
+
})]
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ e("path", {
|
|
40
|
+
id: "Vector_4",
|
|
41
|
+
d: "M341.374 89.4609H363.433",
|
|
42
|
+
className: "brand300",
|
|
43
|
+
stroke: "#2C64EF",
|
|
44
|
+
strokeWidth: 1.5,
|
|
45
|
+
strokeLinecap: "round",
|
|
46
|
+
strokeLinejoin: "round"
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ e("path", {
|
|
49
|
+
id: "Vector_5",
|
|
50
|
+
d: "M340.639 86.5195H363.433",
|
|
51
|
+
className: "brand300",
|
|
52
|
+
stroke: "#2C64EF",
|
|
53
|
+
strokeWidth: 1.5,
|
|
54
|
+
strokeLinecap: "round",
|
|
55
|
+
strokeLinejoin: "round"
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ e("path", {
|
|
58
|
+
id: "Vector_6",
|
|
59
|
+
d: "M336.963 54.167H357.551",
|
|
60
|
+
className: "brand300",
|
|
61
|
+
stroke: "#2C64EF",
|
|
62
|
+
strokeWidth: 1.5,
|
|
63
|
+
strokeLinecap: "round",
|
|
64
|
+
strokeLinejoin: "round"
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ e("path", {
|
|
67
|
+
id: "Vector_7",
|
|
68
|
+
d: "M367.853 51.9608C367.853 51.3757 368.085 50.8147 368.499 50.401C368.912 49.9873 369.473 49.7549 370.058 49.7549C370.643 49.7549 371.205 49.9873 371.618 50.401C372.032 50.8147 372.264 51.3757 372.264 51.9608",
|
|
69
|
+
className: "brand300",
|
|
70
|
+
stroke: "#2C64EF",
|
|
71
|
+
strokeWidth: 1.5,
|
|
72
|
+
strokeLinecap: "round",
|
|
73
|
+
strokeLinejoin: "round"
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ e("path", {
|
|
76
|
+
id: "Vector_8",
|
|
77
|
+
d: "M376.675 77.6963C376.675 78.2813 376.443 78.8424 376.029 79.2561C375.616 79.6698 375.055 79.9022 374.47 79.9022C373.885 79.9022 373.323 79.6698 372.91 79.2561C372.496 78.8424 372.264 78.2813 372.264 77.6963",
|
|
78
|
+
className: "brand300",
|
|
79
|
+
stroke: "#2C64EF",
|
|
80
|
+
strokeWidth: 1.5,
|
|
81
|
+
strokeLinecap: "round",
|
|
82
|
+
strokeLinejoin: "round"
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ e("path", {
|
|
85
|
+
id: "Vector_9",
|
|
86
|
+
d: "M376.668 77.6963V65.9316",
|
|
87
|
+
className: "brand300",
|
|
88
|
+
stroke: "#2C64EF",
|
|
89
|
+
strokeWidth: 1.5,
|
|
90
|
+
strokeLinecap: "round",
|
|
91
|
+
strokeLinejoin: "round"
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ e("path", {
|
|
94
|
+
id: "Vector_10",
|
|
95
|
+
d: "M376.669 65.9316H372.257",
|
|
96
|
+
className: "brand300",
|
|
97
|
+
stroke: "#2C64EF",
|
|
98
|
+
strokeWidth: 1.5,
|
|
99
|
+
strokeLinecap: "round",
|
|
100
|
+
strokeLinejoin: "round"
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ e("path", {
|
|
103
|
+
id: "Vector_11",
|
|
104
|
+
d: "M374.462 79.9023H367.845",
|
|
105
|
+
className: "brand300",
|
|
106
|
+
stroke: "#2C64EF",
|
|
107
|
+
strokeWidth: 1.5,
|
|
108
|
+
strokeLinecap: "round",
|
|
109
|
+
strokeLinejoin: "round"
|
|
110
|
+
}),
|
|
111
|
+
/* @__PURE__ */ e("path", {
|
|
112
|
+
id: "Vector_12",
|
|
113
|
+
d: "M367.853 51.9608C367.853 51.3757 368.085 50.8147 368.499 50.401C368.912 49.9873 369.473 49.7549 370.058 49.7549C370.643 49.7549 371.205 49.9873 371.618 50.401C372.032 50.8147 372.264 51.3757 372.264 51.9608V65.9314V77.6961C372.264 78.2811 372.497 78.8422 372.91 79.2558C373.324 79.6695 373.878 79.9019 374.463 79.9019H367.853V51.9608Z",
|
|
114
|
+
className: "brand300",
|
|
115
|
+
fill: "#2C64EF",
|
|
116
|
+
stroke: "#2C64EF",
|
|
117
|
+
strokeWidth: 1.5,
|
|
118
|
+
strokeLinecap: "round",
|
|
119
|
+
strokeLinejoin: "round"
|
|
120
|
+
}),
|
|
121
|
+
/* @__PURE__ */ e("path", {
|
|
122
|
+
id: "Vector_13",
|
|
123
|
+
d: "M372.264 65.9316V77.6963C372.264 78.2814 372.496 78.8424 372.91 79.2561C373.323 79.6698 373.877 79.9022 374.462 79.9022C375.047 79.9022 375.616 79.6698 376.029 79.2561C376.443 78.8424 376.668 78.2814 376.668 77.6963V65.9316H372.264Z",
|
|
124
|
+
fill: "white",
|
|
125
|
+
className: "brand300",
|
|
126
|
+
stroke: "#2C64EF",
|
|
127
|
+
strokeWidth: 1.5,
|
|
128
|
+
strokeLinecap: "round",
|
|
129
|
+
strokeLinejoin: "round"
|
|
130
|
+
})
|
|
131
|
+
]
|
|
132
|
+
}),
|
|
133
|
+
/* @__PURE__ */ r("g", {
|
|
134
|
+
id: "search",
|
|
135
|
+
clipPath: "url(#fee_light_clip1)",
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ e("path", {
|
|
138
|
+
id: "Vector_14",
|
|
139
|
+
fillRule: "evenodd",
|
|
140
|
+
clipRule: "evenodd",
|
|
141
|
+
d: "M328.426 93.2653L338.117 83.5742L341.381 86.838L331.69 96.5291L328.426 93.2653Z",
|
|
142
|
+
fill: "white",
|
|
143
|
+
className: "brand300",
|
|
144
|
+
stroke: "#2C64EF",
|
|
145
|
+
strokeWidth: 1.5,
|
|
146
|
+
strokeLinecap: "round",
|
|
147
|
+
strokeLinejoin: "round"
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ e("path", {
|
|
150
|
+
id: "Vector_15",
|
|
151
|
+
d: "M351.611 90.2777C342.258 90.2777 334.676 82.6957 334.676 73.3429C334.676 63.9901 342.258 56.4082 351.611 56.4082C360.964 56.4082 368.546 63.9901 368.546 73.3429C368.546 82.6957 360.964 90.2777 351.611 90.2777Z",
|
|
152
|
+
fill: "white",
|
|
153
|
+
className: "brand300",
|
|
154
|
+
stroke: "#2C64EF",
|
|
155
|
+
strokeWidth: 1.5,
|
|
156
|
+
strokeLinecap: "round",
|
|
157
|
+
strokeLinejoin: "round"
|
|
158
|
+
}),
|
|
159
|
+
/* @__PURE__ */ e("path", {
|
|
160
|
+
id: "Vector_16",
|
|
161
|
+
d: "M351.611 87.1987C343.959 87.1987 337.755 80.9953 337.755 73.343C337.755 65.6907 343.959 59.4873 351.611 59.4873C359.263 59.4873 365.467 65.6907 365.467 73.343C365.467 80.9953 359.263 87.1987 351.611 87.1987Z",
|
|
162
|
+
className: "brand300",
|
|
163
|
+
fill: "#2C64EF",
|
|
164
|
+
fillOpacity: 0.1,
|
|
165
|
+
stroke: "#2C64EF",
|
|
166
|
+
strokeWidth: 1.5,
|
|
167
|
+
strokeLinecap: "round",
|
|
168
|
+
strokeLinejoin: "round"
|
|
169
|
+
}),
|
|
170
|
+
/* @__PURE__ */ r("g", {
|
|
171
|
+
id: "$",
|
|
172
|
+
children: [/* @__PURE__ */ e("path", {
|
|
173
|
+
id: "Vector_17",
|
|
174
|
+
d: "M355.807 69.0546C355.56 68.4667 355.147 67.9631 354.62 67.6045C354.092 67.246 353.472 67.0478 352.834 67.034C352.361 67.034 351.887 67.034 351.419 67.034C350.675 66.9659 349.925 67.0541 349.217 67.2928C348.633 67.5589 348.137 67.9874 347.79 68.5272C347.442 69.0671 347.257 69.6954 347.257 70.3374V70.3374C347.254 71.0279 347.467 71.702 347.867 72.2649C348.267 72.8278 348.834 73.2512 349.487 73.4757C350.198 73.6463 350.932 73.7021 351.661 73.6408C352.362 73.5843 353.067 73.6307 353.754 73.7785C354.426 73.9901 355.014 74.4116 355.43 74.9812C355.846 75.5509 356.069 76.2388 356.066 76.9442C356.065 77.5882 355.878 78.2181 355.527 78.7582C355.176 79.2984 354.677 79.7257 354.089 79.9888C353.382 80.2284 352.631 80.3165 351.887 80.2476C351.414 80.2476 350.94 80.2476 350.472 80.2476C349.834 80.2338 349.214 80.0357 348.687 79.6771C348.159 79.3185 347.747 78.8149 347.499 78.227",
|
|
175
|
+
className: "brand300",
|
|
176
|
+
stroke: "#2C64EF",
|
|
177
|
+
strokeWidth: 1.5,
|
|
178
|
+
strokeLinecap: "round",
|
|
179
|
+
strokeLinejoin: "round"
|
|
180
|
+
}), /* @__PURE__ */ e("path", {
|
|
181
|
+
id: "Vector_18",
|
|
182
|
+
d: "M351.656 65.9336V81.3494",
|
|
183
|
+
className: "brand300",
|
|
184
|
+
stroke: "#2C64EF",
|
|
185
|
+
strokeWidth: 1.5,
|
|
186
|
+
strokeLinecap: "round",
|
|
187
|
+
strokeLinejoin: "round"
|
|
188
|
+
})]
|
|
189
|
+
}),
|
|
190
|
+
/* @__PURE__ */ e("path", {
|
|
191
|
+
id: "Vector_19",
|
|
192
|
+
d: "M352.712 62.6191C350.912 62.4276 349.094 62.6923 347.424 63.3889",
|
|
193
|
+
className: "brand300",
|
|
194
|
+
stroke: "#2C64EF",
|
|
195
|
+
strokeWidth: 1.5,
|
|
196
|
+
strokeLinecap: "round",
|
|
197
|
+
strokeLinejoin: "round"
|
|
198
|
+
}),
|
|
199
|
+
/* @__PURE__ */ e("path", {
|
|
200
|
+
id: "Vector_20",
|
|
201
|
+
d: "M355.798 63.4123C355.59 63.3277 355.382 63.243 355.159 63.166",
|
|
202
|
+
className: "brand300",
|
|
203
|
+
stroke: "#2C64EF",
|
|
204
|
+
strokeWidth: 1.5,
|
|
205
|
+
strokeLinecap: "round",
|
|
206
|
+
strokeLinejoin: "round"
|
|
207
|
+
}),
|
|
208
|
+
/* @__PURE__ */ e("path", {
|
|
209
|
+
id: "Vector_21",
|
|
210
|
+
d: "M328.426 93.2646L331.689 96.5284L324.761 103.456C324.55 103.683 324.295 103.865 324.012 103.992C323.729 104.118 323.423 104.186 323.113 104.191C322.803 104.197 322.495 104.14 322.207 104.023C321.92 103.907 321.658 103.734 321.439 103.515C321.22 103.296 321.047 103.035 320.931 102.747C320.815 102.46 320.758 102.152 320.763 101.841C320.768 101.531 320.836 101.226 320.963 100.942C321.089 100.659 321.271 100.404 321.498 100.193L328.426 93.2646Z",
|
|
211
|
+
className: "brand300",
|
|
212
|
+
fill: "#2C64EF",
|
|
213
|
+
stroke: "#2C64EF",
|
|
214
|
+
strokeWidth: 1.5,
|
|
215
|
+
strokeLinecap: "round",
|
|
216
|
+
strokeLinejoin: "round"
|
|
217
|
+
})
|
|
218
|
+
]
|
|
219
|
+
})
|
|
220
|
+
]
|
|
221
|
+
}), /* @__PURE__ */ r("defs", { children: [/* @__PURE__ */ e("clipPath", {
|
|
222
|
+
id: "fee_light_clip0",
|
|
223
|
+
children: /* @__PURE__ */ e("rect", {
|
|
224
|
+
width: 41.1765,
|
|
225
|
+
height: 47.0588,
|
|
226
|
+
fill: "white",
|
|
227
|
+
transform: "translate(336.228 49.0205)"
|
|
228
|
+
})
|
|
229
|
+
}), /* @__PURE__ */ e("clipPath", {
|
|
230
|
+
id: "fee_light_clip1",
|
|
231
|
+
children: /* @__PURE__ */ e("rect", {
|
|
232
|
+
width: 49.2647,
|
|
233
|
+
height: 49.2647,
|
|
234
|
+
fill: "white",
|
|
235
|
+
transform: "matrix(-1 0 0 1 369.315 55.6387)"
|
|
236
|
+
})
|
|
237
|
+
})] })]
|
|
238
|
+
}), a = i(d);
|
|
239
|
+
export {
|
|
240
|
+
a as ReactComponent
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
//# sourceMappingURL=FeeDetected.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeeDetected.es.js","names":[],"sources":["../../../../../src/insights-v2/components/shared/images/FeeDetected.svg"],"sourcesContent":["import * as React from \"react\";\nimport { forwardRef } from \"react\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst SvgFeeDetected = (props, ref) => /* @__PURE__ */ _jsxs(\"svg\", {\n\twidth: 69.63,\n\theight: 62.06,\n\tviewBox: \"318.76 47.75 69.63 62.06\",\n\tfill: \"none\",\n\txmlns: \"http://www.w3.org/2000/svg\",\n\tref,\n\t...props,\n\tchildren: [/* @__PURE__ */ _jsxs(\"g\", {\n\t\tid: \"Embedded Content | Fee Detected\",\n\t\tchildren: [\n\t\t\t/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\tid: \"Vector_2\",\n\t\t\t\topacity: .25,\n\t\t\t\td: \"M384.927 73.4087C387.943 78.5874 386.227 90.986 380.36 97.0299C375.97 101.553 361.637 108.577 353.787 107.744C336.824 105.944 348.044 85.3643 338.64 77.4848C330.851 70.958 318.747 60.8728 334.365 53.5202C344.569 48.7165 352.895 53.2886 365.162 61.8884C373.054 67.4211 378.295 62.022 384.927 73.4087Z\",\n\t\t\t\tclassName: \"brand300\",\n\t\t\t\tfill: \"#2C64EF\"\n\t\t\t}),\n\t\t\t/* @__PURE__ */ _jsxs(\"g\", {\n\t\t\t\tid: \"paper\",\n\t\t\t\tclipPath: \"url(#fee_light_clip0)\",\n\t\t\t\tchildren: [\n\t\t\t\t\t/* @__PURE__ */ _jsxs(\"g\", {\n\t\t\t\t\t\tid: \"Vector_3\",\n\t\t\t\t\t\tchildren: [/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\t\td: \"M367.852 51.9608V79.9019V95.3431L366.139 93.8725L364.426 95.3431L362.705 93.8725L360.992 95.3431L359.279 93.8725L357.558 95.3431L355.845 93.8725L354.124 95.3431L352.411 93.8725L350.698 95.3431L348.977 93.8725L347.264 95.3431L345.551 93.8725L343.83 95.3431L342.117 93.8725L340.396 95.3431L338.676 93.8725L336.97 95.3431V52.6961C336.97 51.916 337.28 51.1679 337.831 50.6163C338.383 50.0648 339.131 49.7549 339.911 49.7549H370.058H370.793\",\n\t\t\t\t\t\t\tfill: \"white\"\n\t\t\t\t\t\t}), /* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\t\td: \"M370.058 49.7549H339.911C339.131 49.7549 338.383 50.0648 337.831 50.6163C337.28 51.1679 336.97 51.916 336.97 52.6961V95.3431L338.676 93.8725L340.396 95.3431L342.117 93.8725L343.83 95.3431L345.551 93.8725L347.264 95.3431L348.977 93.8725L350.698 95.3431L352.411 93.8725L354.124 95.3431L355.845 93.8725L357.558 95.3431L359.279 93.8725L360.992 95.3431L362.705 93.8725L364.426 95.3431L366.139 93.8725L367.852 95.3431V79.9019V51.9608C367.852 51.3757 368.084 50.8147 368.498 50.401C368.912 49.9873 369.473 49.7549 370.058 49.7549ZM370.058 49.7549H370.793\",\n\t\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t\t})]\n\t\t\t\t\t}),\n\t\t\t\t\t/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\tid: \"Vector_4\",\n\t\t\t\t\t\td: \"M341.374 89.4609H363.433\",\n\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t}),\n\t\t\t\t\t/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\tid: \"Vector_5\",\n\t\t\t\t\t\td: \"M340.639 86.5195H363.433\",\n\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t}),\n\t\t\t\t\t/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\tid: \"Vector_6\",\n\t\t\t\t\t\td: \"M336.963 54.167H357.551\",\n\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t}),\n\t\t\t\t\t/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\tid: \"Vector_7\",\n\t\t\t\t\t\td: \"M367.853 51.9608C367.853 51.3757 368.085 50.8147 368.499 50.401C368.912 49.9873 369.473 49.7549 370.058 49.7549C370.643 49.7549 371.205 49.9873 371.618 50.401C372.032 50.8147 372.264 51.3757 372.264 51.9608\",\n\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t}),\n\t\t\t\t\t/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\tid: \"Vector_8\",\n\t\t\t\t\t\td: \"M376.675 77.6963C376.675 78.2813 376.443 78.8424 376.029 79.2561C375.616 79.6698 375.055 79.9022 374.47 79.9022C373.885 79.9022 373.323 79.6698 372.91 79.2561C372.496 78.8424 372.264 78.2813 372.264 77.6963\",\n\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t}),\n\t\t\t\t\t/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\tid: \"Vector_9\",\n\t\t\t\t\t\td: \"M376.668 77.6963V65.9316\",\n\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t}),\n\t\t\t\t\t/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\tid: \"Vector_10\",\n\t\t\t\t\t\td: \"M376.669 65.9316H372.257\",\n\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t}),\n\t\t\t\t\t/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\tid: \"Vector_11\",\n\t\t\t\t\t\td: \"M374.462 79.9023H367.845\",\n\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t}),\n\t\t\t\t\t/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\tid: \"Vector_12\",\n\t\t\t\t\t\td: \"M367.853 51.9608C367.853 51.3757 368.085 50.8147 368.499 50.401C368.912 49.9873 369.473 49.7549 370.058 49.7549C370.643 49.7549 371.205 49.9873 371.618 50.401C372.032 50.8147 372.264 51.3757 372.264 51.9608V65.9314V77.6961C372.264 78.2811 372.497 78.8422 372.91 79.2558C373.324 79.6695 373.878 79.9019 374.463 79.9019H367.853V51.9608Z\",\n\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\tfill: \"#2C64EF\",\n\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t}),\n\t\t\t\t\t/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\tid: \"Vector_13\",\n\t\t\t\t\t\td: \"M372.264 65.9316V77.6963C372.264 78.2814 372.496 78.8424 372.91 79.2561C373.323 79.6698 373.877 79.9022 374.462 79.9022C375.047 79.9022 375.616 79.6698 376.029 79.2561C376.443 78.8424 376.668 78.2814 376.668 77.6963V65.9316H372.264Z\",\n\t\t\t\t\t\tfill: \"white\",\n\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t})\n\t\t\t\t]\n\t\t\t}),\n\t\t\t/* @__PURE__ */ _jsxs(\"g\", {\n\t\t\t\tid: \"search\",\n\t\t\t\tclipPath: \"url(#fee_light_clip1)\",\n\t\t\t\tchildren: [\n\t\t\t\t\t/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\tid: \"Vector_14\",\n\t\t\t\t\t\tfillRule: \"evenodd\",\n\t\t\t\t\t\tclipRule: \"evenodd\",\n\t\t\t\t\t\td: \"M328.426 93.2653L338.117 83.5742L341.381 86.838L331.69 96.5291L328.426 93.2653Z\",\n\t\t\t\t\t\tfill: \"white\",\n\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t}),\n\t\t\t\t\t/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\tid: \"Vector_15\",\n\t\t\t\t\t\td: \"M351.611 90.2777C342.258 90.2777 334.676 82.6957 334.676 73.3429C334.676 63.9901 342.258 56.4082 351.611 56.4082C360.964 56.4082 368.546 63.9901 368.546 73.3429C368.546 82.6957 360.964 90.2777 351.611 90.2777Z\",\n\t\t\t\t\t\tfill: \"white\",\n\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t}),\n\t\t\t\t\t/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\tid: \"Vector_16\",\n\t\t\t\t\t\td: \"M351.611 87.1987C343.959 87.1987 337.755 80.9953 337.755 73.343C337.755 65.6907 343.959 59.4873 351.611 59.4873C359.263 59.4873 365.467 65.6907 365.467 73.343C365.467 80.9953 359.263 87.1987 351.611 87.1987Z\",\n\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\tfill: \"#2C64EF\",\n\t\t\t\t\t\tfillOpacity: .1,\n\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t}),\n\t\t\t\t\t/* @__PURE__ */ _jsxs(\"g\", {\n\t\t\t\t\t\tid: \"$\",\n\t\t\t\t\t\tchildren: [/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\t\tid: \"Vector_17\",\n\t\t\t\t\t\t\td: \"M355.807 69.0546C355.56 68.4667 355.147 67.9631 354.62 67.6045C354.092 67.246 353.472 67.0478 352.834 67.034C352.361 67.034 351.887 67.034 351.419 67.034C350.675 66.9659 349.925 67.0541 349.217 67.2928C348.633 67.5589 348.137 67.9874 347.79 68.5272C347.442 69.0671 347.257 69.6954 347.257 70.3374V70.3374C347.254 71.0279 347.467 71.702 347.867 72.2649C348.267 72.8278 348.834 73.2512 349.487 73.4757C350.198 73.6463 350.932 73.7021 351.661 73.6408C352.362 73.5843 353.067 73.6307 353.754 73.7785C354.426 73.9901 355.014 74.4116 355.43 74.9812C355.846 75.5509 356.069 76.2388 356.066 76.9442C356.065 77.5882 355.878 78.2181 355.527 78.7582C355.176 79.2984 354.677 79.7257 354.089 79.9888C353.382 80.2284 352.631 80.3165 351.887 80.2476C351.414 80.2476 350.94 80.2476 350.472 80.2476C349.834 80.2338 349.214 80.0357 348.687 79.6771C348.159 79.3185 347.747 78.8149 347.499 78.227\",\n\t\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t\t}), /* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\t\tid: \"Vector_18\",\n\t\t\t\t\t\t\td: \"M351.656 65.9336V81.3494\",\n\t\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t\t})]\n\t\t\t\t\t}),\n\t\t\t\t\t/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\tid: \"Vector_19\",\n\t\t\t\t\t\td: \"M352.712 62.6191C350.912 62.4276 349.094 62.6923 347.424 63.3889\",\n\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t}),\n\t\t\t\t\t/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\tid: \"Vector_20\",\n\t\t\t\t\t\td: \"M355.798 63.4123C355.59 63.3277 355.382 63.243 355.159 63.166\",\n\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t}),\n\t\t\t\t\t/* @__PURE__ */ _jsx(\"path\", {\n\t\t\t\t\t\tid: \"Vector_21\",\n\t\t\t\t\t\td: \"M328.426 93.2646L331.689 96.5284L324.761 103.456C324.55 103.683 324.295 103.865 324.012 103.992C323.729 104.118 323.423 104.186 323.113 104.191C322.803 104.197 322.495 104.14 322.207 104.023C321.92 103.907 321.658 103.734 321.439 103.515C321.22 103.296 321.047 103.035 320.931 102.747C320.815 102.46 320.758 102.152 320.763 101.841C320.768 101.531 320.836 101.226 320.963 100.942C321.089 100.659 321.271 100.404 321.498 100.193L328.426 93.2646Z\",\n\t\t\t\t\t\tclassName: \"brand300\",\n\t\t\t\t\t\tfill: \"#2C64EF\",\n\t\t\t\t\t\tstroke: \"#2C64EF\",\n\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t\t\t})\n\t\t\t\t]\n\t\t\t})\n\t\t]\n\t}), /* @__PURE__ */ _jsxs(\"defs\", { children: [/* @__PURE__ */ _jsx(\"clipPath\", {\n\t\tid: \"fee_light_clip0\",\n\t\tchildren: /* @__PURE__ */ _jsx(\"rect\", {\n\t\t\twidth: 41.1765,\n\t\t\theight: 47.0588,\n\t\t\tfill: \"white\",\n\t\t\ttransform: \"translate(336.228 49.0205)\"\n\t\t})\n\t}), /* @__PURE__ */ _jsx(\"clipPath\", {\n\t\tid: \"fee_light_clip1\",\n\t\tchildren: /* @__PURE__ */ _jsx(\"rect\", {\n\t\t\twidth: 49.2647,\n\t\t\theight: 49.2647,\n\t\t\tfill: \"white\",\n\t\t\ttransform: \"matrix(-1 0 0 1 369.315 55.6387)\"\n\t\t})\n\t})] })]\n});\nconst ForwardRef = forwardRef(SvgFeeDetected);\nexport { ForwardRef as ReactComponent };\n"],"mappings":";;AAGA,IAAM,IAAA,CAAkB,GAAO,MAAwB,gBAAA,EAAM,OAAO;AAAA,EACnE,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,OAAO;AAAA,EACP,KAAA;AAAA,EACA,GAAG;AAAA,EACH,UAAU,CAAiB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B;AAAA,UACjB,CAAC;AAAA,UACe,gBAAA,EAAK,QAAQ;AAAA,YAC5B,IAAI;AAAA,YACJ,GAAG;AAAA,YACH,WAAW;AAAA,YACX,QAAQ;AAAA,YACR,aAAa;AAAA,YACb,eAAe;AAAA,YACf,gBAAgB;AAAA,UACjB,CAAC;AAAA,UACe,gBAAA,EAAK,QAAQ;AAAA,YAC5B,IAAI;AAAA,YACJ,GAAG;AAAA,YACH,WAAW;AAAA,YACX,MAAM;AAAA,YACN,QAAQ;AAAA,YACR,aAAa;AAAA,YACb,eAAe;AAAA,YACf,gBAAgB;AAAA,UACjB,CAAC;AAAA,QACF;AAAA,MACD,CAAC;AAAA,IACF;AAAA,EACD,CAAC,GAAmB,gBAAA,EAAM,QAAQ,EAAE,UAAU,CAAiB,gBAAA,EAAK,YAAY;AAAA,IAC/E,IAAI;AAAA,IACJ,UAA0B,gBAAA,EAAK,QAAQ;AAAA,MACtC,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,WAAW;AAAA,IACZ,CAAC;AAAA,EACF,CAAC,GAAmB,gBAAA,EAAK,YAAY;AAAA,IACpC,IAAI;AAAA,IACJ,UAA0B,gBAAA,EAAK,QAAQ;AAAA,MACtC,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,WAAW;AAAA,IACZ,CAAC;AAAA,EACF,CAAC,CAAC,EAAE,CAAC,CAAC;AACP,CAAC,GACK,IAAa,EAAW,CAAc"}
|
|
@@ -33,12 +33,7 @@ export declare const ctaHandlers: {
|
|
|
33
33
|
updateTransactionField: (ctx: CtaContext) => Promise<void>;
|
|
34
34
|
/** `POST`/`PUT transaction_rules` so `params.categoryGuid` applies to future matches. */
|
|
35
35
|
applyTransactionRule: (ctx: CtaContext) => Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* Hands a host-owned effect to the embedding app through `beatActions.onCtaAction`.
|
|
38
|
-
* `params.hostAction` names the effect; remaining params are forwarded untouched.
|
|
39
|
-
* Host action names are documented in README.md.
|
|
40
|
-
*/
|
|
41
36
|
delegateToHost: (ctx: CtaContext) => Promise<void>;
|
|
42
37
|
};
|
|
43
|
-
/** A registered handler name.
|
|
38
|
+
/** A registered handler name. */
|
|
44
39
|
export type CtaHandlerName = keyof typeof ctaHandlers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ctaHandlers.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaHandlers.ts"],"sourcesContent":["import type { Account, Budget, MerchantBudget, Transaction, UserInsightProfile } from '../../core'\nimport type { CtaContext, CtaHandler } from './types'\n\n/**\n * Side effects a step can `run`. Call stores (never APIs directly), throw on failure (stores\n * resolve a success flag; translate `false` into a throw), read inputs from `ctx.params` (control\n * values at the top level, the write set under `fields`) and the beat. Beat endpoints and spending plan items are host-owned: use `delegateToHost`.\n */\n\nconst param = <T>(ctx: CtaContext, key: string): T | undefined => ctx.params[key] as T | undefined\n\nconst requireParam = <T>(ctx: CtaContext, key: string): T => {\n const value = param<T>(ctx, key)\n\n if (value === undefined || value === null || value === '') {\n throw new Error(`CTA handler requires params.${key}`)\n }\n\n return value\n}\n\n/**\n * The write set a step put under `params.fields`. A value that is still `undefined` (a pick not\n * made yet) throws here: serialised it would just vanish and the PUT would \"succeed\".\n */\nconst requireFields = (ctx: CtaContext): Record<string, unknown> => {\n const fields = param<Record<string, unknown>>(ctx, 'fields')\n\n if (!fields || Object.keys(fields).length === 0) {\n throw new Error('CTA handler requires params.fields')\n }\n\n const missing = Object.keys(fields).filter((field) => fields[field] === undefined)\n\n if (missing.length > 0) {\n throw new Error(`CTA handler could not resolve field(s): ${missing.join(', ')}`)\n }\n\n return fields\n}\n\nconst findOrThrow = <T>(items: T[], predicate: (item: T) => boolean, what: string): T => {\n const found = items.find(predicate)\n\n if (!found) throw new Error(`${what} not found in store`)\n\n return found\n}\n\nexport const ctaHandlers = {\n /** `PUT user_insight_profile` (designate emergency savings, thresholds, safety net). */\n updateUserInsightProfile: async (ctx) => {\n await ctx.stores.userStore.updateUserInsightProfile(\n requireFields(ctx) as Partial<UserInsightProfile>,\n )\n },\n\n /** `PUT offers/:guid` flagging a marketing offer as clicked. */\n markOfferClicked: async ({ beat, stores }) => {\n await stores.beatStore.updateOffer({ ...beat, has_been_clicked: true } as typeof beat)\n },\n\n /**\n * `PUT repeating_transactions/:guid` writing `user_response`. Resolves the repeating\n * transaction from `params.repeatingTransactionGuid`, else the beat's primary transaction.\n */\n updateRepeatingTransactionResponse: async (ctx) => {\n const { beat, stores } = ctx\n const userResponse = requireParam<string>(ctx, 'userResponse')\n const guid =\n param<string>(ctx, 'repeatingTransactionGuid') ??\n beat.primary_transaction?.repeating_transaction_guid\n\n if (!guid) throw new Error('No repeating transaction guid for beat')\n\n const repeating = findOrThrow(\n stores.recurringTransactionsStore.repeatingTransactions,\n (rt) => rt.guid === guid,\n `Repeating transaction ${guid}`,\n )\n const ok = await stores.recurringTransactionsStore.updateRepeatingTransaction({\n ...repeating,\n user_response: userResponse,\n })\n\n if (!ok) throw new Error('Failed to update repeating transaction')\n },\n\n /** `PUT accounts/:guid` merging `params.fields`; `params.accountGuid` picks the account, else the beat's primary. */\n updateAccountField: async (ctx) => {\n const { beat, stores } = ctx\n const guid = param<string>(ctx, 'accountGuid') ?? beat.primary_account_guid\n\n if (!guid) throw new Error('No account guid for beat')\n\n const account = findOrThrow(\n stores.accountStore.accounts,\n (a) => a.guid === guid,\n `Account ${guid}`,\n )\n\n const ok = await stores.accountStore.updateAccount({\n ...account,\n ...requireFields(ctx),\n } as Account)\n\n if (!ok) throw new Error('Failed to update account')\n },\n\n /** `PUT notification_profiles/:guid` setting `threshold` on the named profile. */\n updateNotificationProfileThreshold: async (ctx) => {\n const profileGuid = requireParam<string>(ctx, 'profileGuid')\n const threshold = requireParam<number>(ctx, 'threshold')\n const profile = findOrThrow(\n ctx.stores.settingsStore.notificationProfiles,\n (p) => p.guid === profileGuid,\n `Notification profile ${profileGuid}`,\n )\n\n const ok = await ctx.stores.settingsStore.updateNotificationProfile({ ...profile, threshold })\n\n if (!ok) throw new Error('Failed to update notification profile')\n },\n\n /** `POST budgets` for `params.categoryGuid` with `params.amount` (+ optional parentGuid). */\n createBudget: async (ctx) => {\n const categoryGuid = requireParam<string>(ctx, 'categoryGuid')\n const amount = requireParam<number>(ctx, 'amount')\n const category = findOrThrow(\n ctx.stores.categoryStore.categories,\n (c) => c.guid === categoryGuid,\n `Category ${categoryGuid}`,\n )\n\n const ok = await ctx.stores.budgetsStore.addBudget(\n category,\n amount,\n param<string | null>(ctx, 'parentGuid') ?? null,\n )\n\n if (!ok) throw new Error('Failed to create budget')\n },\n\n /** `PUT budgets/:guid` setting `amount`. */\n updateBudget: async (ctx) => {\n const budgetGuid = requireParam<string>(ctx, 'budgetGuid')\n const amount = requireParam<number>(ctx, 'amount')\n const budget = findOrThrow(\n ctx.stores.budgetsStore.budgets,\n (b) => b.guid === budgetGuid,\n `Budget ${budgetGuid}`,\n )\n const ok = await ctx.stores.budgetsStore.updateBudget({ ...budget, amount } as Budget)\n\n if (!ok) throw new Error('Failed to update budget')\n },\n\n /** `DELETE budgets/:guid`. */\n deleteBudget: async (ctx) => {\n const ok = await ctx.stores.budgetsStore.deleteBudget(requireParam<string>(ctx, 'budgetGuid'))\n\n if (!ok) throw new Error('Failed to delete budget')\n },\n\n /** `POST merchant_budgets`. */\n createMerchantBudget: async (ctx) => {\n const result = await ctx.stores.budgetsStore.addMerchantBudget(\n requireParam<string>(ctx, 'merchantGuid'),\n requireParam<number>(ctx, 'amount'),\n )\n\n if (!result?.isSuccess) throw new Error('Failed to create merchant budget')\n },\n\n /** `PUT merchant_budgets/:guid` setting `amount`. */\n updateMerchantBudget: async (ctx) => {\n const guid = requireParam<string>(ctx, 'merchantBudgetGuid')\n const amount = requireParam<number>(ctx, 'amount')\n const merchantBudget = findOrThrow(\n ctx.stores.budgetsStore.merchantBudgets,\n (mb) => mb.guid === guid,\n `Merchant budget ${guid}`,\n )\n const result = await ctx.stores.budgetsStore.updateMerchantBudget({\n ...merchantBudget,\n amount,\n } as MerchantBudget)\n\n if (!result?.isSuccess) throw new Error('Failed to update merchant budget')\n },\n\n /** `DELETE merchant_budgets/:guid`. */\n deleteMerchantBudget: async (ctx) => {\n const result = await ctx.stores.budgetsStore.deleteMerchantBudget(\n requireParam<string>(ctx, 'merchantBudgetGuid'),\n )\n\n if (!result?.isSuccess) throw new Error('Failed to delete merchant budget')\n },\n\n /**\n * `PUT transactions/:guid` merging `params.fields` (category_guid, date, memo,\n * description, is_hidden...). Resolves the transaction from `params.transactionGuid`,\n * else the beat's primary transaction guid.\n */\n updateTransactionField: async (ctx) => {\n const { beat, stores } = ctx\n const guid = param<string>(ctx, 'transactionGuid') ?? beat.primary_transaction_guid\n\n if (!guid) throw new Error('No transaction guid for beat')\n\n const transaction = findOrThrow(\n stores.transactionStore.transactions,\n (t) => t.guid === guid,\n `Transaction ${guid}`,\n )\n\n const ok = await stores.transactionStore.updateTransaction({\n ...transaction,\n ...requireFields(ctx),\n } as Transaction)\n\n if (!ok) throw new Error('Failed to update transaction')\n },\n\n /** `POST`/`PUT transaction_rules` so `params.categoryGuid` applies to future matches. */\n applyTransactionRule: async (ctx) => {\n const { beat, stores } = ctx\n const categoryGuid = requireParam<string>(ctx, 'categoryGuid')\n const guid = param<string>(ctx, 'transactionGuid') ?? beat.primary_transaction_guid\n\n if (!guid) throw new Error('No transaction guid for beat')\n\n const transaction = findOrThrow(\n stores.transactionStore.transactions,\n (t) => t.guid === guid,\n `Transaction ${guid}`,\n )\n\n const ok = await stores.transactionStore.addOrUpdateTransactionRule(categoryGuid, transaction)\n\n if (!ok) throw new Error('Failed to save transaction rule')\n },\n\n /**\n * Hands a host-owned effect to the embedding app through `beatActions.onCtaAction`.\n * `params.hostAction` names the effect; remaining params are forwarded untouched.\n * Host action names are documented in README.md.\n */\n delegateToHost: async (ctx) => {\n const { hostAction, ...rest } = ctx.params\n const name = typeof hostAction === 'string' ? hostAction : ''\n\n if (!name) throw new Error('delegateToHost requires params.hostAction')\n if (!ctx.hostActions.onCtaAction) {\n throw new Error(`Host does not implement onCtaAction (needed for \"${name}\")`)\n }\n\n await ctx.hostActions.onCtaAction({ beatGuid: ctx.beat.guid, name, params: rest })\n },\n} satisfies Record<string, CtaHandler>\n\n/** A registered handler name. `CtaStep.run` and `useCtaHandler` accept only these, so a typo fails typecheck. */\nexport type CtaHandlerName = keyof typeof ctaHandlers\n"],"mappings":"AASA,IAAM,IAAA,CAAY,GAAiB,MAA+B,EAAI,OAAO,CAAA,GAEvE,IAAA,CAAmB,GAAiB,MAAmB;AAC3D,QAAM,IAAQ,EAAS,GAAK,CAAG;AAE/B,MAA2B,KAAU,QAAQ,MAAU,GACrD,OAAM,IAAI,MAAM,+BAA+B,CAAA,EAAK;AAGtD,SAAO;AACT,GAMM,IAAA,CAAiB,MAA6C;AAClE,QAAM,IAAS,EAA+B,GAAK,QAAQ;AAE3D,MAAI,CAAC,KAAU,OAAO,KAAK,CAAM,EAAE,WAAW,EAC5C,OAAM,IAAI,MAAM,oCAAoC;AAGtD,QAAM,IAAU,OAAO,KAAK,CAAM,EAAE,OAAA,CAAQ,MAAU,EAAO,CAAA,MAAW,MAAS;AAEjF,MAAI,EAAQ,SAAS,EACnB,OAAM,IAAI,MAAM,2CAA2C,EAAQ,KAAK,IAAI,CAAA,EAAG;AAGjF,SAAO;AACT,GAEM,IAAA,CAAkB,GAAY,GAAiC,MAAoB;AACvF,QAAM,IAAQ,EAAM,KAAK,CAAS;AAElC,MAAI,CAAC,EAAO,OAAM,IAAI,MAAM,GAAG,CAAA,qBAAyB;AAExD,SAAO;AACT,GAEa,IAAc;AAAA,EAEzB,0BAA0B,OAAO,MAAQ;AACvC,UAAM,EAAI,OAAO,UAAU,yBACzB,EAAc,CAAG,CACnB;AAAA,EACF;AAAA,EAGA,kBAAkB,OAAO,EAAE,MAAA,GAAM,QAAA,EAAA,MAAa;AAC5C,UAAM,EAAO,UAAU,YAAY;AAAA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UAAM,EAAE,YAAA,GAAY,GAAG,EAAA,IAAS,EAAI,QAC9B,IAAO,OAAO,KAAe,WAAW,IAAa;AAE3D,QAAI,CAAC,EAAM,OAAM,IAAI,MAAM,2CAA2C;AACtE,QAAI,CAAC,EAAI,YAAY,YACnB,OAAM,IAAI,MAAM,oDAAoD,CAAA,IAAQ;AAG9E,UAAM,EAAI,YAAY,YAAY;AAAA,MAAE,UAAU,EAAI,KAAK;AAAA,MAAM,MAAA;AAAA,MAAM,QAAQ;AAAA,IAAK,CAAC;AAAA,EACnF;AACF"}
|
|
1
|
+
{"version":3,"file":"ctaHandlers.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaHandlers.ts"],"sourcesContent":["import type { Account, Budget, MerchantBudget, Transaction, UserInsightProfile } from '../../core'\nimport type { CtaContext, CtaHandler } from './types'\n\n// Step side effects: call stores, throw on failure, read ctx.params.\n// Host-owned effects (beat endpoints, spending plan) use delegateToHost.\n\nconst param = <T>(ctx: CtaContext, key: string): T | undefined => ctx.params[key] as T | undefined\n\nconst requireParam = <T>(ctx: CtaContext, key: string): T => {\n const value = param<T>(ctx, key)\n\n if (value === undefined || value === null || value === '') {\n throw new Error(`CTA handler requires params.${key}`)\n }\n\n return value\n}\n\n// The write set under params.fields; throws if a pick is missing.\nconst requireFields = (ctx: CtaContext): Record<string, unknown> => {\n const fields = param<Record<string, unknown>>(ctx, 'fields')\n\n if (!fields || Object.keys(fields).length === 0) {\n throw new Error('CTA handler requires params.fields')\n }\n\n const missing = Object.keys(fields).filter((field) => fields[field] === undefined)\n\n if (missing.length > 0) {\n throw new Error(`CTA handler could not resolve field(s): ${missing.join(', ')}`)\n }\n\n return fields\n}\n\nconst findOrThrow = <T>(items: T[], predicate: (item: T) => boolean, what: string): T => {\n const found = items.find(predicate)\n\n if (!found) throw new Error(`${what} not found in store`)\n\n return found\n}\n\nexport const ctaHandlers = {\n /** `PUT user_insight_profile` (designate emergency savings, thresholds, safety net). */\n updateUserInsightProfile: async (ctx) => {\n await ctx.stores.userStore.updateUserInsightProfile(\n requireFields(ctx) as Partial<UserInsightProfile>,\n )\n },\n\n /** `PUT offers/:guid` flagging a marketing offer as clicked. */\n markOfferClicked: async ({ beat, stores }) => {\n await stores.beatStore.updateOffer({ ...beat, has_been_clicked: true } as typeof beat)\n },\n\n /**\n * `PUT repeating_transactions/:guid` writing `user_response`. Resolves the repeating\n * transaction from `params.repeatingTransactionGuid`, else the beat's primary transaction.\n */\n updateRepeatingTransactionResponse: async (ctx) => {\n const { beat, stores } = ctx\n const userResponse = requireParam<string>(ctx, 'userResponse')\n const guid =\n param<string>(ctx, 'repeatingTransactionGuid') ??\n beat.primary_transaction?.repeating_transaction_guid\n\n if (!guid) throw new Error('No repeating transaction guid for beat')\n\n const repeating = findOrThrow(\n stores.recurringTransactionsStore.repeatingTransactions,\n (rt) => rt.guid === guid,\n `Repeating transaction ${guid}`,\n )\n const ok = await stores.recurringTransactionsStore.updateRepeatingTransaction({\n ...repeating,\n user_response: userResponse,\n })\n\n if (!ok) throw new Error('Failed to update repeating transaction')\n },\n\n /** `PUT accounts/:guid` merging `params.fields`; `params.accountGuid` picks the account, else the beat's primary. */\n updateAccountField: async (ctx) => {\n const { beat, stores } = ctx\n const guid = param<string>(ctx, 'accountGuid') ?? beat.primary_account_guid\n\n if (!guid) throw new Error('No account guid for beat')\n\n const account = findOrThrow(\n stores.accountStore.accounts,\n (a) => a.guid === guid,\n `Account ${guid}`,\n )\n\n const ok = await stores.accountStore.updateAccount({\n ...account,\n ...requireFields(ctx),\n } as Account)\n\n if (!ok) throw new Error('Failed to update account')\n },\n\n /** `PUT notification_profiles/:guid` setting `threshold` on the named profile. */\n updateNotificationProfileThreshold: async (ctx) => {\n const profileGuid = requireParam<string>(ctx, 'profileGuid')\n const threshold = requireParam<number>(ctx, 'threshold')\n const profile = findOrThrow(\n ctx.stores.settingsStore.notificationProfiles,\n (p) => p.guid === profileGuid,\n `Notification profile ${profileGuid}`,\n )\n\n const ok = await ctx.stores.settingsStore.updateNotificationProfile({ ...profile, threshold })\n\n if (!ok) throw new Error('Failed to update notification profile')\n },\n\n /** `POST budgets` for `params.categoryGuid` with `params.amount` (+ optional parentGuid). */\n createBudget: async (ctx) => {\n const categoryGuid = requireParam<string>(ctx, 'categoryGuid')\n const amount = requireParam<number>(ctx, 'amount')\n const category = findOrThrow(\n ctx.stores.categoryStore.categories,\n (c) => c.guid === categoryGuid,\n `Category ${categoryGuid}`,\n )\n\n const ok = await ctx.stores.budgetsStore.addBudget(\n category,\n amount,\n param<string | null>(ctx, 'parentGuid') ?? null,\n )\n\n if (!ok) throw new Error('Failed to create budget')\n },\n\n /** `PUT budgets/:guid` setting `amount`. */\n updateBudget: async (ctx) => {\n const budgetGuid = requireParam<string>(ctx, 'budgetGuid')\n const amount = requireParam<number>(ctx, 'amount')\n const budget = findOrThrow(\n ctx.stores.budgetsStore.budgets,\n (b) => b.guid === budgetGuid,\n `Budget ${budgetGuid}`,\n )\n const ok = await ctx.stores.budgetsStore.updateBudget({ ...budget, amount } as Budget)\n\n if (!ok) throw new Error('Failed to update budget')\n },\n\n /** `DELETE budgets/:guid`. */\n deleteBudget: async (ctx) => {\n const ok = await ctx.stores.budgetsStore.deleteBudget(requireParam<string>(ctx, 'budgetGuid'))\n\n if (!ok) throw new Error('Failed to delete budget')\n },\n\n /** `POST merchant_budgets`. */\n createMerchantBudget: async (ctx) => {\n const result = await ctx.stores.budgetsStore.addMerchantBudget(\n requireParam<string>(ctx, 'merchantGuid'),\n requireParam<number>(ctx, 'amount'),\n )\n\n if (!result?.isSuccess) throw new Error('Failed to create merchant budget')\n },\n\n /** `PUT merchant_budgets/:guid` setting `amount`. */\n updateMerchantBudget: async (ctx) => {\n const guid = requireParam<string>(ctx, 'merchantBudgetGuid')\n const amount = requireParam<number>(ctx, 'amount')\n const merchantBudget = findOrThrow(\n ctx.stores.budgetsStore.merchantBudgets,\n (mb) => mb.guid === guid,\n `Merchant budget ${guid}`,\n )\n const result = await ctx.stores.budgetsStore.updateMerchantBudget({\n ...merchantBudget,\n amount,\n } as MerchantBudget)\n\n if (!result?.isSuccess) throw new Error('Failed to update merchant budget')\n },\n\n /** `DELETE merchant_budgets/:guid`. */\n deleteMerchantBudget: async (ctx) => {\n const result = await ctx.stores.budgetsStore.deleteMerchantBudget(\n requireParam<string>(ctx, 'merchantBudgetGuid'),\n )\n\n if (!result?.isSuccess) throw new Error('Failed to delete merchant budget')\n },\n\n /**\n * `PUT transactions/:guid` merging `params.fields` (category_guid, date, memo,\n * description, is_hidden...). Resolves the transaction from `params.transactionGuid`,\n * else the beat's primary transaction guid.\n */\n updateTransactionField: async (ctx) => {\n const { beat, stores } = ctx\n const guid = param<string>(ctx, 'transactionGuid') ?? beat.primary_transaction_guid\n\n if (!guid) throw new Error('No transaction guid for beat')\n\n const transaction = findOrThrow(\n stores.transactionStore.transactions,\n (t) => t.guid === guid,\n `Transaction ${guid}`,\n )\n\n const ok = await stores.transactionStore.updateTransaction({\n ...transaction,\n ...requireFields(ctx),\n } as Transaction)\n\n if (!ok) throw new Error('Failed to update transaction')\n },\n\n /** `POST`/`PUT transaction_rules` so `params.categoryGuid` applies to future matches. */\n applyTransactionRule: async (ctx) => {\n const { beat, stores } = ctx\n const categoryGuid = requireParam<string>(ctx, 'categoryGuid')\n const guid = param<string>(ctx, 'transactionGuid') ?? beat.primary_transaction_guid\n\n if (!guid) throw new Error('No transaction guid for beat')\n\n const transaction = findOrThrow(\n stores.transactionStore.transactions,\n (t) => t.guid === guid,\n `Transaction ${guid}`,\n )\n\n const ok = await stores.transactionStore.addOrUpdateTransactionRule(categoryGuid, transaction)\n\n if (!ok) throw new Error('Failed to save transaction rule')\n },\n\n // Hands a host-owned effect to the app via beatActions.onCtaAction.\n delegateToHost: async (ctx) => {\n const { hostAction, ...rest } = ctx.params\n const name = typeof hostAction === 'string' ? hostAction : ''\n\n if (!name) throw new Error('delegateToHost requires params.hostAction')\n if (!ctx.hostActions.onCtaAction) {\n throw new Error(`Host does not implement onCtaAction (needed for \"${name}\")`)\n }\n\n await ctx.hostActions.onCtaAction({ beatGuid: ctx.beat.guid, name, params: rest })\n },\n} satisfies Record<string, CtaHandler>\n\n/** A registered handler name. */\nexport type CtaHandlerName = keyof typeof ctaHandlers\n"],"mappings":"AAMA,IAAM,IAAA,CAAY,GAAiB,MAA+B,EAAI,OAAO,CAAA,GAEvE,IAAA,CAAmB,GAAiB,MAAmB;AAC3D,QAAM,IAAQ,EAAS,GAAK,CAAG;AAE/B,MAA2B,KAAU,QAAQ,MAAU,GACrD,OAAM,IAAI,MAAM,+BAA+B,CAAA,EAAK;AAGtD,SAAO;AACT,GAGM,IAAA,CAAiB,MAA6C;AAClE,QAAM,IAAS,EAA+B,GAAK,QAAQ;AAE3D,MAAI,CAAC,KAAU,OAAO,KAAK,CAAM,EAAE,WAAW,EAC5C,OAAM,IAAI,MAAM,oCAAoC;AAGtD,QAAM,IAAU,OAAO,KAAK,CAAM,EAAE,OAAA,CAAQ,MAAU,EAAO,CAAA,MAAW,MAAS;AAEjF,MAAI,EAAQ,SAAS,EACnB,OAAM,IAAI,MAAM,2CAA2C,EAAQ,KAAK,IAAI,CAAA,EAAG;AAGjF,SAAO;AACT,GAEM,IAAA,CAAkB,GAAY,GAAiC,MAAoB;AACvF,QAAM,IAAQ,EAAM,KAAK,CAAS;AAElC,MAAI,CAAC,EAAO,OAAM,IAAI,MAAM,GAAG,CAAA,qBAAyB;AAExD,SAAO;AACT,GAEa,IAAc;AAAA,EAEzB,0BAA0B,OAAO,MAAQ;AACvC,UAAM,EAAI,OAAO,UAAU,yBACzB,EAAc,CAAG,CACnB;AAAA,EACF;AAAA,EAGA,kBAAkB,OAAO,EAAE,MAAA,GAAM,QAAA,EAAA,MAAa;AAC5C,UAAM,EAAO,UAAU,YAAY;AAAA,MAAE,GAAG;AAAA,MAAM,kBAAkB;AAAA,IAAK,CAAgB;AAAA,EACvF;AAAA,EAMA,oCAAoC,OAAO,MAAQ;AACjD,UAAM,EAAE,M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AAI,MAAM,2CAA2C;AACtE,QAAI,CAAC,EAAI,YAAY,YACnB,OAAM,IAAI,MAAM,oDAAoD,CAAA,IAAQ;AAG9E,UAAM,EAAI,YAAY,YAAY;AAAA,MAAE,UAAU,EAAI,KAAK;AAAA,MAAM,MAAA;AAAA,MAAM,QAAQ;AAAA,IAAK,CAAC;AAAA,EACnF;AACF"}
|
|
@@ -2,6 +2,6 @@ export { ctaActions } from './ctaConfig';
|
|
|
2
2
|
export { ctaHandlers, type CtaHandlerName } from './ctaHandlers';
|
|
3
3
|
export { ctaPostMessages, resolveCtaMetadata, type CtaPostMessageResolver } from './ctaPostMessages';
|
|
4
4
|
export { HOST_ACTIONS, type HostActionName } from './hostActions';
|
|
5
|
-
export { beatContextOf, resolveCtaState, resolveStep, runCtaAction, runCtaHandler, } from './runCtaAction';
|
|
5
|
+
export { beatContextOf, reportCtaClick, resolveCtaState, resolveStep, runCtaAction, runCtaHandler, sendCtaAnalytics, } from './runCtaAction';
|
|
6
6
|
export { useBeatCtaActions, useCtaHandler, type BeatCtaActions } from './useCtaAction';
|
|
7
7
|
export type { CtaContext, CtaEffect, CtaHandler, CtaHandlerContext, CtaParams, CtaSlot, CtaState, CtaStateContext, CtaStep, RunHandlerOptions, } from './types';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AnalyticsEventConfigEntry } from '../analytics/analyticsEventsConfig';
|
|
1
2
|
import { CtaHandlerName } from './ctaHandlers';
|
|
2
3
|
import { CtaContext, CtaHandlerContext, CtaState, CtaStateContext, CtaStep, RunHandlerOptions } from './types';
|
|
3
4
|
/** The beat's own context (input a block collected for it), `{}` until something is written. */
|
|
@@ -6,11 +7,25 @@ export declare const beatContextOf: ({ beat, stores }: Pick<CtaStateContext, "be
|
|
|
6
7
|
export declare const resolveStep: ({ cta }: Pick<CtaStateContext, "cta">) => CtaStep;
|
|
7
8
|
/** Pending always disables; the step's `disabledWhen` may add to that. */
|
|
8
9
|
export declare const resolveCtaState: (ctx: CtaStateContext) => CtaState;
|
|
10
|
+
type AnalyticsCtx = Pick<CtaContext, 'beat' | 'stores' | 'hostActions'>;
|
|
9
11
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
12
|
+
* The one way to fire a catalogued analytics event. Takes the catalogue entry itself (e.g.
|
|
13
|
+
* `ANALYTICS_EVENTS_CONFIG.PRIMARY_ACTION_SELECTED`), not a lookup key — the call site already
|
|
14
|
+
* has the entry via property access, so there is no key to look up or mistype. Resolves the
|
|
15
|
+
* payload and hands it to the host directly. Never throws: a failed fire is captured, it
|
|
16
|
+
* cannot fail or disable anything.
|
|
13
17
|
*/
|
|
18
|
+
export declare const sendCtaAnalytics: (ctx: AnalyticsCtx, event: AnalyticsEventConfigEntry) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Trigger 1 + the first-click bookkeeping together: every CTA press's generic analytics
|
|
21
|
+
* (`Primary/Secondary Action Selected`), plus `FIRST_TIME_PRIMARY_ACTION_SELECTED` /
|
|
22
|
+
* `cta_clicked_at` on the first primary press. The one call site for "a CTA got pressed",
|
|
23
|
+
* used by the runner and by the contact-support bypass in `BaseLayout`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const reportCtaClick: (ctx: AnalyticsCtx & Pick<CtaContext, "slot">, { skipCtaClicked }?: {
|
|
26
|
+
skipCtaClicked?: boolean;
|
|
27
|
+
}) => void;
|
|
14
28
|
export declare const runCtaAction: (ctx: CtaContext) => Promise<void>;
|
|
15
|
-
/** Runs a handler directly (drawer Save buttons)
|
|
16
|
-
export declare const runCtaHandler: (ctx: CtaHandlerContext, handlerName: CtaHandlerName, { onSuccess }?: RunHandlerOptions) => Promise<boolean>;
|
|
29
|
+
/** Runs a handler directly (drawer Save buttons). True on success. */
|
|
30
|
+
export declare const runCtaHandler: (ctx: CtaHandlerContext, handlerName: CtaHandlerName, { onSuccess, analytics }?: RunHandlerOptions) => Promise<boolean>;
|
|
31
|
+
export {};
|
|
@@ -1,40 +1,58 @@
|
|
|
1
|
-
import { sendBeatCta as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { sendBeatCta as m } from "../../common/utils/PostMessage.es.js";
|
|
2
|
+
import { ANALYTICS_EVENTS_CONFIG as n } from "../analytics/analyticsEventsConfig.es.js";
|
|
3
|
+
import { resolveAnalyticsEvent as f } from "../analytics/resolveAnalyticsEvent.es.js";
|
|
4
|
+
import { HOST_ACTIONS as v } from "./hostActions.es.js";
|
|
5
|
+
import { ctaActions as _ } from "./ctaConfig.es.js";
|
|
6
|
+
import { ctaHandlers as A } from "./ctaHandlers.es.js";
|
|
7
|
+
import { resolveCtaMetadata as E } from "./ctaPostMessages.es.js";
|
|
8
|
+
import { hasDrawerBlock as S } from "../mappings/hasDrawerBlock.es.js";
|
|
9
|
+
var y = {}, c = ({ cta: t }) => t.action_key && _[t.action_key] || y, B = (t) => {
|
|
10
|
+
const a = c(t);
|
|
9
11
|
return { disabled: t.stores.insightsV2Store.ctaStatus[t.beat.guid] === "pending" || (a.disabledWhen?.(t) ?? !1) };
|
|
10
|
-
},
|
|
12
|
+
}, l = ({ beat: t, slot: a, stores: r }) => {
|
|
11
13
|
r.insightsV2Store.openCtaDrawer(t.guid, a === "primary" ? "primaryCta" : "secondaryCta");
|
|
12
14
|
}, h = ({ beat: t, stores: a }, r) => {
|
|
13
|
-
const { is_mobile_webview: e, clientConfig: s } = a.appDataStore.appConfig, { event: i, action:
|
|
14
|
-
|
|
15
|
+
const { is_mobile_webview: e, clientConfig: s } = a.appDataStore.appConfig, { event: i, action: u, payload: C } = r;
|
|
16
|
+
m(t, {
|
|
15
17
|
event: i ?? void 0,
|
|
16
|
-
op:
|
|
17
|
-
extras:
|
|
18
|
+
op: u ?? void 0,
|
|
19
|
+
extras: C ?? void 0,
|
|
18
20
|
isMobileWebview: e,
|
|
19
21
|
webviewScheme: s?.master?.ui_message_webview_url_scheme,
|
|
20
22
|
userGuid: t.insights_payload?.user_guid ?? t.user_guid
|
|
21
23
|
});
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
},
|
|
24
|
+
}, g = (t) => {
|
|
25
|
+
S(t.cta.block) && l(t);
|
|
26
|
+
}, w = (t, { beat: a, stores: r }) => {
|
|
25
27
|
t === "refreshBeat" && r.emitUpdate({ staleBeatGuid: a.guid });
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
}, o = (t, a) => {
|
|
29
|
+
try {
|
|
30
|
+
t.hostActions.onAnalyticsEvent?.(f(a, t.beat));
|
|
31
|
+
} catch (r) {
|
|
32
|
+
t.stores.captureException(r, {
|
|
33
|
+
store: "ctaActions",
|
|
34
|
+
template: t.beat.template,
|
|
35
|
+
handler: "sendCtaAnalytics"
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}, k = (t) => {
|
|
39
|
+
const { beat: a, slot: r, hostActions: e, stores: s } = t;
|
|
40
|
+
r !== "primary" || a.cta_clicked_at || (o(t, n.FIRST_TIME_PRIMARY_ACTION_SELECTED), Promise.resolve().then(() => e.onCtaAction?.({
|
|
41
|
+
beatGuid: a.guid,
|
|
42
|
+
name: v.markCtaClicked
|
|
43
|
+
})).catch((i) => s.captureException(i, {
|
|
44
|
+
store: "ctaActions",
|
|
45
|
+
template: a.template,
|
|
46
|
+
handler: "markCtaClicked"
|
|
47
|
+
})));
|
|
48
|
+
}, T = (t, { skipCtaClicked: a = !1 } = {}) => {
|
|
49
|
+
o(t, t.slot === "primary" ? n.PRIMARY_ACTION_SELECTED : n.SECONDARY_ACTION_SELECTED), a || k(t);
|
|
50
|
+
}, p = async (t, a, r) => {
|
|
51
|
+
const e = A[a];
|
|
34
52
|
if (!e) throw new Error(`Unknown CTA handler "${a}"`);
|
|
35
53
|
await e(t);
|
|
36
|
-
for (const s of r)
|
|
37
|
-
},
|
|
54
|
+
for (const s of r) w(s, t);
|
|
55
|
+
}, d = async ({ beat: t, stores: a }, r, e = {}) => {
|
|
38
56
|
const { insightsV2Store: s } = a;
|
|
39
57
|
s.setCtaStatus(t.guid, "pending");
|
|
40
58
|
try {
|
|
@@ -46,37 +64,41 @@ var w = {}, o = ({ cta: t }) => t.action_key && m[t.action_key] || w, H = (t) =>
|
|
|
46
64
|
...e
|
|
47
65
|
}), !1;
|
|
48
66
|
}
|
|
49
|
-
},
|
|
50
|
-
const a =
|
|
67
|
+
}, F = async (t) => {
|
|
68
|
+
const a = c(t), r = typeof a.params == "function" ? a.params(t) : a.params, e = {
|
|
51
69
|
...t,
|
|
52
70
|
params: {
|
|
53
71
|
...r,
|
|
54
72
|
...t.params
|
|
55
73
|
}
|
|
56
74
|
};
|
|
57
|
-
a.skipCtaClicked
|
|
58
|
-
a.run && await
|
|
59
|
-
const s =
|
|
75
|
+
T(e, { skipCtaClicked: a.skipCtaClicked }), await d(e, async () => {
|
|
76
|
+
a.run && await p(e, a.run, a.onSuccess ?? []), a.analytics && o(e, a.analytics);
|
|
77
|
+
const s = E(e);
|
|
60
78
|
s && h(e, s);
|
|
61
79
|
const i = a.next ?? (a.run ? "none" : "default");
|
|
62
|
-
i === "default" ?
|
|
80
|
+
i === "default" ? g(e) : i === "drawer" && l(e);
|
|
63
81
|
});
|
|
64
|
-
},
|
|
82
|
+
}, b = {
|
|
65
83
|
label: "",
|
|
66
84
|
block: ""
|
|
67
|
-
},
|
|
68
|
-
const
|
|
85
|
+
}, G = (t, a, { onSuccess: r = [], analytics: e } = {}) => {
|
|
86
|
+
const s = {
|
|
69
87
|
...t,
|
|
70
|
-
cta:
|
|
88
|
+
cta: b,
|
|
71
89
|
slot: "primary"
|
|
72
90
|
};
|
|
73
|
-
return
|
|
91
|
+
return d(s, async () => {
|
|
92
|
+
await p(s, a, r), e && o(s, e);
|
|
93
|
+
}, { handler: a });
|
|
74
94
|
};
|
|
75
95
|
export {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
96
|
+
T as reportCtaClick,
|
|
97
|
+
B as resolveCtaState,
|
|
98
|
+
c as resolveStep,
|
|
99
|
+
F as runCtaAction,
|
|
100
|
+
G as runCtaHandler,
|
|
101
|
+
o as sendCtaAnalytics
|
|
80
102
|
};
|
|
81
103
|
|
|
82
104
|
//# sourceMappingURL=runCtaAction.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runCtaAction.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/runCtaAction.ts"],"sourcesContent":["import { sendBeatCta } from '../../common/utils/PostMessage'\nimport { hasDrawerBlock } from '../mappings/hasDrawerBlock'\nimport { ctaActions } from './ctaConfig'\nimport { resolveCtaMetadata } from './ctaPostMessages'\nimport { ctaHandlers, type CtaHandlerName } from './ctaHandlers'\nimport { HOST_ACTIONS } from './hostActions'\nimport type { CtaPostMessageMetadata } from '../../core'\nimport type {\n CtaContext,\n CtaEffect,\n CtaHandler,\n CtaHandlerContext,\n CtaState,\n CtaStateContext,\n CtaStep,\n RunHandlerOptions,\n} from './types'\n\nconst DEFAULT_STEP: CtaStep = {}\n\n// ─── Resolution ─────────────────────────────────────────────────────────────\n\n/** The beat's own context (input a block collected for it), `{}` until something is written. */\nexport const beatContextOf = ({ beat, stores }: Pick<CtaStateContext, 'beat' | 'stores'>) =>\n stores.insightsV2Store.beatContext[beat.guid] ?? {}\n\n/** The step named by the CTA's `action_key`, or the empty default (no key / unknown key). */\nexport const resolveStep = ({ cta }: Pick<CtaStateContext, 'cta'>): CtaStep =>\n (cta.action_key && ctaActions[cta.action_key]) || DEFAULT_STEP\n\n/** Pending always disables; the step's `disabledWhen` may add to that. */\nexport const resolveCtaState = (ctx: CtaStateContext): CtaState => {\n const step = resolveStep(ctx)\n const pending = ctx.stores.insightsV2Store.ctaStatus[ctx.beat.guid] === 'pending'\n\n return { disabled: pending || (step.disabledWhen?.(ctx) ?? false) }\n}\n\n// ─── Targets and effects ────────────────────────────────────────────────────\n\n/** Opens the beat's drawer for whichever slot triggered the current step. */\nconst openDrawerForSlot = ({\n beat,\n slot,\n stores,\n}: Pick<CtaContext, 'beat' | 'slot' | 'stores'>) => {\n stores.insightsV2Store.openCtaDrawer(\n beat.guid,\n slot === 'primary' ? 'primaryCta' : 'secondaryCta',\n )\n}\n\n/**\n * Posts this CTA's resolved message (event, op and beat-specific payload, from the backend's\n * `cta.metadata` or the template's `ctaPostMessages` entry) to the host.\n */\nconst postCtaMessage = ({ beat, stores }: CtaContext, metadata: CtaPostMessageMetadata) => {\n const { is_mobile_webview, clientConfig } = stores.appDataStore.appConfig\n const { event, action, payload } = metadata\n\n sendBeatCta(beat, {\n event: event ?? undefined,\n op: action ?? undefined,\n extras: payload ?? undefined,\n isMobileWebview: is_mobile_webview,\n webviewScheme: clientConfig?.master?.ui_message_webview_url_scheme,\n userGuid: beat.insights_payload?.user_guid ?? beat.user_guid,\n })\n}\n\n/**\n * Default target: open the drawer for a real block, otherwise nothing. A post message is never\n * implied by a missing block; it is sent only when one resolves (see runCtaAction).\n */\nconst runDefaultTarget = (ctx: CtaContext) => {\n if (hasDrawerBlock(ctx.cta.block)) openDrawerForSlot(ctx)\n}\n\nconst runEffect = (effect: CtaEffect, { beat, stores }: CtaContext) => {\n switch (effect) {\n case 'refreshBeat':\n stores.emitUpdate({ staleBeatGuid: beat.guid })\n break\n }\n}\n\n/**\n * First primary click records `cta_clicked_at` through the host. Fire-and-forget: whatever the\n * host does (reject, throw, return nothing) must never fail the user's action.\n */\nconst markCtaClicked = ({ beat, slot, hostActions }: CtaContext) => {\n if (slot !== 'primary' || beat.cta_clicked_at) return\n\n // Wrapping the call in `.then` turns a synchronous throw into a rejection, and the `.catch`\n // swallows both: a failed cta_clicked_at write is not the user's action.\n Promise.resolve()\n .then(() =>\n hostActions.onCtaAction?.({ beatGuid: beat.guid, name: HOST_ACTIONS.markCtaClicked }),\n )\n .catch(() => {})\n}\n\n// ─── Shared bookkeeping ─────────────────────────────────────────────────────\n\n/** Runs a named handler, then its `onSuccess` effects. Shared by card CTAs and drawer saves. */\nconst runHandlerWithEffects = async (\n ctx: CtaContext,\n handlerName: CtaHandlerName,\n onSuccess: CtaEffect[],\n): Promise<void> => {\n // Names are typed, but the map is still indexed defensively: config can come from anywhere.\n const handler = (ctaHandlers as Record<string, CtaHandler>)[handlerName]\n\n if (!handler) throw new Error(`Unknown CTA handler \"${handlerName}\"`)\n\n await handler(ctx)\n\n for (const effect of onSuccess) runEffect(effect, ctx)\n}\n\n/** Per-beat status around `work`: `pending` -> `done` | `error` (+ captureException). */\nconst withCtaStatus = async (\n { beat, stores }: Pick<CtaContext, 'beat' | 'stores'>,\n work: () => Promise<void>,\n captureContext: Record<string, string> = {},\n): Promise<boolean> => {\n const { insightsV2Store } = stores\n\n insightsV2Store.setCtaStatus(beat.guid, 'pending')\n\n try {\n await work()\n insightsV2Store.setCtaStatus(beat.guid, 'done')\n\n return true\n } catch (error) {\n insightsV2Store.setCtaStatus(beat.guid, 'error')\n stores.captureException(error, {\n store: 'ctaActions',\n template: beat.template,\n ...captureContext,\n })\n\n return false\n }\n}\n\n// ─── Entry points ───────────────────────────────────────────────────────────\n\n/**\n * Runs the CTA's step: `run` handler, `onSuccess` effects, the CTA's post message if one resolves\n * (backend `cta.metadata` or the template's `ctaPostMessages` entry; skipped when the handler\n * throws), then the `next` target. No resolved message = no post.\n */\nexport const runCtaAction = async (ctx: CtaContext): Promise<void> => {\n const step = resolveStep(ctx)\n const stepParams = typeof step.params === 'function' ? step.params(ctx) : step.params\n const stepCtx: CtaContext = { ...ctx, params: { ...stepParams, ...ctx.params } }\n\n if (!step.skipCtaClicked) markCtaClicked(stepCtx)\n\n await withCtaStatus(stepCtx, async () => {\n if (step.run) await runHandlerWithEffects(stepCtx, step.run, step.onSuccess ?? [])\n\n const metadata = resolveCtaMetadata(stepCtx)\n\n if (metadata) postCtaMessage(stepCtx, metadata)\n\n const target = step.next ?? (step.run ? 'none' : 'default')\n\n if (target === 'default') runDefaultTarget(stepCtx)\n else if (target === 'drawer') openDrawerForSlot(stepCtx)\n })\n}\n\n/** Placeholder CTA for handlers run from inside a drawer, where no card slot is involved. */\nconst DIRECT_CTA = { label: '', block: '' }\n\n/** Runs a handler directly (drawer Save buttons): same bookkeeping as a card CTA. True on success. */\nexport const runCtaHandler = (\n ctx: CtaHandlerContext,\n handlerName: CtaHandlerName,\n { onSuccess = [] }: RunHandlerOptions = {},\n): Promise<boolean> => {\n const fullCtx: CtaContext = { ...ctx, cta: DIRECT_CTA, slot: 'primary' }\n\n return withCtaStatus(fullCtx, () => runHandlerWithEffects(fullCtx, handlerName, onSuccess), {\n handler: handlerName,\n })\n}\n"],"mappings":";;;;;;AAkBA,IAAM,IAAwB,CAAC,GASlB,IAAA,CAAe,EAAE,KAAA,EAAA,MAC3B,EAAI,cAAc,EAAW,EAAI,UAAA,KAAgB,GAGvC,IAAA,CAAmB,MAAmC;AACjE,QAAM,IAAO,EAAY,CAAG;AAG5B,SAAO,EAAE,UAFO,EAAI,OAAO,gBAAgB,UAAU,EAAI,KAAK,IAAA,MAAU,cAEzC,EAAK,eAAe,CAAG,KAAK,IAAO;AACpE,GAKM,IAAA,CAAqB,EACzB,MAAA,GACA,MAAA,GACA,QAAA,EAAA,MACkD;AAClD,EAAA,EAAO,gBAAgB,cACrB,EAAK,MACL,MAAS,YAAY,eAAe,cACtC;AACF,GAMM,IAAA,CAAkB,EAAE,MAAA,GAAM,QAAA,EAAA,GAAsB,MAAqC;AACzF,QAAM,EAAE,mBAAA,GAAmB,cAAA,EAAA,IAAiB,EAAO,aAAa,WAC1D,EAAE,OAAA,GAAO,QAAA,GAAQ,SAAA,EAAA,IAAY;AAEnC,EAAA,EAAY,GAAM;AAAA,IAChB,OAAO,KAAS;AAAA,IAChB,IAAI,KAAU;AAAA,IACd,QAAQ,KAAW;AAAA,IACnB,iBAAiB;AAAA,IACjB,eAAe,GAAc,QAAQ;AAAA,IACrC,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CAAG,GACtB,IAAa,OAAO,EAAK,UAAW,aAAa,EAAK,OAAO,CAAG,IAAI,EAAK,QACzE,IAAsB;AAAA,IAAE,GAAG;AAAA,IAAK,QAAQ;AAAA,MAAE,GAAG;AAAA,MAAY,GAAG,EAAI;AAAA,IAAO;AAAA,EAAE;AAE/E,EAAK,EAAK,kBAAgB,EAAe,CAAO,GAEhD,MAAM,EAAc,GAAS,YAAY;AACvC,IAAI,EAAK,OAAK,MAAM,EAAsB,GAAS,EAAK,KAAK,EAAK,aAAa,CAAC,CAAC;AAEjF,UAAM,IAAW,EAAmB,CAAO;AAE3C,IAAI,KAAU,EAAe,GAAS,CAAQ;AAE9C,UAAM,IAAS,EAAK,SAAS,EAAK,MAAM,SAAS;AAEjD,IAAI,MAAW,YAAW,EAAiB,CAAO,IACzC,MAAW,YAAU,EAAkB,CAAO;AAAA,EACzD,CAAC;AACH,GAGM,IAAa;AAAA,EAAE,OAAO;AAAA,EAAI,OAAO;AAAG,GAG7B,IAAA,CACX,GACA,GACA,EAAE,WAAA,IAAY,CAAC,EAAA,IAAyB,CAAC,MACpB;AACrB,QAAM,IAAsB;AAAA,IAAE,GAAG;AAAA,IAAK,KAAK;AAAA,IAAY,MAAM;AAAA,EAAU;AAEvE,SAAO,EAAc,GAAA,MAAe,EAAsB,GAAS,GAAa,CAAS,GAAG,EAC1F,SAAS,EACX,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"runCtaAction.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/runCtaAction.ts"],"sourcesContent":["import { sendBeatCta } from '../../common/utils/PostMessage'\nimport {\n ANALYTICS_EVENTS_CONFIG,\n type AnalyticsEventConfigEntry,\n} from '../analytics/analyticsEventsConfig'\nimport { resolveAnalyticsEvent } from '../analytics/resolveAnalyticsEvent'\nimport { hasDrawerBlock } from '../mappings/hasDrawerBlock'\nimport { ctaActions } from './ctaConfig'\nimport { resolveCtaMetadata } from './ctaPostMessages'\nimport { ctaHandlers, type CtaHandlerName } from './ctaHandlers'\nimport { HOST_ACTIONS } from './hostActions'\nimport type { CtaPostMessageMetadata } from '../../core'\nimport type {\n CtaContext,\n CtaEffect,\n CtaHandler,\n CtaHandlerContext,\n CtaState,\n CtaStateContext,\n CtaStep,\n RunHandlerOptions,\n} from './types'\n\nconst DEFAULT_STEP: CtaStep = {}\n\n// ─── Resolution ─────────────────────────────────────────────────────────────\n\n/** The beat's own context (input a block collected for it), `{}` until something is written. */\nexport const beatContextOf = ({ beat, stores }: Pick<CtaStateContext, 'beat' | 'stores'>) =>\n stores.insightsV2Store.beatContext[beat.guid] ?? {}\n\n/** The step named by the CTA's `action_key`, or the empty default (no key / unknown key). */\nexport const resolveStep = ({ cta }: Pick<CtaStateContext, 'cta'>): CtaStep =>\n (cta.action_key && ctaActions[cta.action_key]) || DEFAULT_STEP\n\n/** Pending always disables; the step's `disabledWhen` may add to that. */\nexport const resolveCtaState = (ctx: CtaStateContext): CtaState => {\n const step = resolveStep(ctx)\n const pending = ctx.stores.insightsV2Store.ctaStatus[ctx.beat.guid] === 'pending'\n\n return { disabled: pending || (step.disabledWhen?.(ctx) ?? false) }\n}\n\n// ─── Targets and effects ────────────────────────────────────────────────────\n\n/** Opens the beat's drawer for whichever slot triggered the current step. */\nconst openDrawerForSlot = ({\n beat,\n slot,\n stores,\n}: Pick<CtaContext, 'beat' | 'slot' | 'stores'>) => {\n stores.insightsV2Store.openCtaDrawer(\n beat.guid,\n slot === 'primary' ? 'primaryCta' : 'secondaryCta',\n )\n}\n\n/**\n * Posts this CTA's resolved message (event, op and beat-specific payload, from the backend's\n * `cta.metadata` or the template's `ctaPostMessages` entry) to the host.\n */\nconst postCtaMessage = ({ beat, stores }: CtaContext, metadata: CtaPostMessageMetadata) => {\n const { is_mobile_webview, clientConfig } = stores.appDataStore.appConfig\n const { event, action, payload } = metadata\n\n sendBeatCta(beat, {\n event: event ?? undefined,\n op: action ?? undefined,\n extras: payload ?? undefined,\n isMobileWebview: is_mobile_webview,\n webviewScheme: clientConfig?.master?.ui_message_webview_url_scheme,\n userGuid: beat.insights_payload?.user_guid ?? beat.user_guid,\n })\n}\n\n/**\n * Default target: open the drawer for a real block, otherwise nothing. A post message is never\n * implied by a missing block; it is sent only when one resolves (see runCtaAction).\n */\nconst runDefaultTarget = (ctx: CtaContext) => {\n if (hasDrawerBlock(ctx.cta.block)) openDrawerForSlot(ctx)\n}\n\nconst runEffect = (effect: CtaEffect, { beat, stores }: CtaContext) => {\n switch (effect) {\n case 'refreshBeat':\n stores.emitUpdate({ staleBeatGuid: beat.guid })\n break\n }\n}\n\ntype AnalyticsCtx = Pick<CtaContext, 'beat' | 'stores' | 'hostActions'>\n\n/**\n * The one way to fire a catalogued analytics event. Takes the catalogue entry itself (e.g.\n * `ANALYTICS_EVENTS_CONFIG.PRIMARY_ACTION_SELECTED`), not a lookup key — the call site already\n * has the entry via property access, so there is no key to look up or mistype. Resolves the\n * payload and hands it to the host directly. Never throws: a failed fire is captured, it\n * cannot fail or disable anything.\n */\nexport const sendCtaAnalytics = (ctx: AnalyticsCtx, event: AnalyticsEventConfigEntry): void => {\n try {\n ctx.hostActions.onAnalyticsEvent?.(resolveAnalyticsEvent(event, ctx.beat))\n } catch (error) {\n ctx.stores.captureException(error, {\n store: 'ctaActions',\n template: ctx.beat.template,\n handler: 'sendCtaAnalytics',\n })\n }\n}\n\n// First primary click: fires FIRST_TIME_PRIMARY_ACTION_SELECTED and records cta_clicked_at.\nconst markCtaClicked = (ctx: AnalyticsCtx & Pick<CtaContext, 'slot'>): void => {\n const { beat, slot, hostActions, stores } = ctx\n\n if (slot !== 'primary' || beat.cta_clicked_at) return\n\n sendCtaAnalytics(ctx, ANALYTICS_EVENTS_CONFIG.FIRST_TIME_PRIMARY_ACTION_SELECTED)\n\n // Fire-and-forget; a failed write must not fail the user's action, but still report it.\n Promise.resolve()\n .then(() =>\n hostActions.onCtaAction?.({ beatGuid: beat.guid, name: HOST_ACTIONS.markCtaClicked }),\n )\n .catch((error) =>\n stores.captureException(error, {\n store: 'ctaActions',\n template: beat.template,\n handler: 'markCtaClicked',\n }),\n )\n}\n\n/**\n * Trigger 1 + the first-click bookkeeping together: every CTA press's generic analytics\n * (`Primary/Secondary Action Selected`), plus `FIRST_TIME_PRIMARY_ACTION_SELECTED` /\n * `cta_clicked_at` on the first primary press. The one call site for \"a CTA got pressed\",\n * used by the runner and by the contact-support bypass in `BaseLayout`.\n */\nexport const reportCtaClick = (\n ctx: AnalyticsCtx & Pick<CtaContext, 'slot'>,\n { skipCtaClicked = false }: { skipCtaClicked?: boolean } = {},\n): void => {\n sendCtaAnalytics(\n ctx,\n ctx.slot === 'primary'\n ? ANALYTICS_EVENTS_CONFIG.PRIMARY_ACTION_SELECTED\n : ANALYTICS_EVENTS_CONFIG.SECONDARY_ACTION_SELECTED,\n )\n\n if (!skipCtaClicked) markCtaClicked(ctx)\n}\n\n// ─── Shared bookkeeping ─────────────────────────────────────────────────────\n\n/** Runs a named handler, then its `onSuccess` effects. Shared by card CTAs and drawer saves. */\nconst runHandlerWithEffects = async (\n ctx: CtaContext,\n handlerName: CtaHandlerName,\n onSuccess: CtaEffect[],\n): Promise<void> => {\n // Names are typed, but the map is still indexed defensively: config can come from anywhere.\n const handler = (ctaHandlers as Record<string, CtaHandler>)[handlerName]\n\n if (!handler) throw new Error(`Unknown CTA handler \"${handlerName}\"`)\n\n await handler(ctx)\n\n for (const effect of onSuccess) runEffect(effect, ctx)\n}\n\n/** Per-beat status around `work`: `pending` -> `done` | `error` (+ captureException). */\nconst withCtaStatus = async (\n { beat, stores }: Pick<CtaContext, 'beat' | 'stores'>,\n work: () => Promise<void>,\n captureContext: Record<string, string> = {},\n): Promise<boolean> => {\n const { insightsV2Store } = stores\n\n insightsV2Store.setCtaStatus(beat.guid, 'pending')\n\n try {\n await work()\n insightsV2Store.setCtaStatus(beat.guid, 'done')\n\n return true\n } catch (error) {\n insightsV2Store.setCtaStatus(beat.guid, 'error')\n stores.captureException(error, {\n store: 'ctaActions',\n template: beat.template,\n ...captureContext,\n })\n\n return false\n }\n}\n\n// ─── Entry points ───────────────────────────────────────────────────────────\n\n// Runs the CTA's step: handler, onSuccess effects, post message, then the next target.\nexport const runCtaAction = async (ctx: CtaContext): Promise<void> => {\n const step = resolveStep(ctx)\n const stepParams = typeof step.params === 'function' ? step.params(ctx) : step.params\n const stepCtx: CtaContext = { ...ctx, params: { ...stepParams, ...ctx.params } }\n\n reportCtaClick(stepCtx, { skipCtaClicked: step.skipCtaClicked })\n\n await withCtaStatus(stepCtx, async () => {\n if (step.run) await runHandlerWithEffects(stepCtx, step.run, step.onSuccess ?? [])\n\n // For future ctaConfig entries; none define `analytics` yet.\n if (step.analytics) sendCtaAnalytics(stepCtx, step.analytics)\n\n const metadata = resolveCtaMetadata(stepCtx)\n\n if (metadata) postCtaMessage(stepCtx, metadata)\n\n const target = step.next ?? (step.run ? 'none' : 'default')\n\n if (target === 'default') runDefaultTarget(stepCtx)\n else if (target === 'drawer') openDrawerForSlot(stepCtx)\n })\n}\n\n/** Placeholder CTA for handlers run from inside a drawer, where no card slot is involved. */\nconst DIRECT_CTA = { label: '', block: '' }\n\n/** Runs a handler directly (drawer Save buttons). True on success. */\nexport const runCtaHandler = (\n ctx: CtaHandlerContext,\n handlerName: CtaHandlerName,\n { onSuccess = [], analytics }: RunHandlerOptions = {},\n): Promise<boolean> => {\n const fullCtx: CtaContext = { ...ctx, cta: DIRECT_CTA, slot: 'primary' }\n\n return withCtaStatus(\n fullCtx,\n async () => {\n await runHandlerWithEffects(fullCtx, handlerName, onSuccess)\n\n // Success-time analytics for drawer Saves.\n if (analytics) sendCtaAnalytics(fullCtx, analytics)\n },\n { handler: handlerName },\n )\n}\n"],"mappings":";;;;;;;;AAuBA,IAAM,IAAwB,CAAC,GASlB,IAAA,CAAe,EAAE,KAAA,EAAA,MAC3B,EAAI,cAAc,EAAW,EAAI,UAAA,KAAgB,GAGvC,IAAA,CAAmB,MAAmC;AACjE,QAAM,IAAO,EAAY,CAAG;AAG5B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