@wise/dynamic-flow-client 3.28.9 → 3.29.0

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.
@@ -38,7 +38,7 @@
38
38
  "dynamicFlows.ExternalConfirmation.open": "在新标签页中打开",
39
39
  "dynamicFlows.ExternalConfirmation.title": "请确认",
40
40
  "dynamicFlows.FileUploadSchema.maxFileSizeError": "抱歉,该文件太大。请上传一个更小的文件。",
41
- "dynamicFlows.FileUploadSchema.wrongFileTypeError": "Sorry, that file format is not supported. Please upload a different file.",
41
+ "dynamicFlows.FileUploadSchema.wrongFileTypeError": "抱歉,不支持该文件格式。请上传其他文件。",
42
42
  "dynamicFlows.Help.ariaLabel": "点击此处获取更多信息。",
43
43
  "dynamicFlows.MultiSelect.summary": "{first} 和其他 {count} 个",
44
44
  "dynamicFlows.MultipleFileUploadSchema.maxFileSizeError": "抱歉,该文件太大。请上传一个更小的文件。",
package/build/main.js CHANGED
@@ -144,10 +144,10 @@ var init_clsx = __esm({
144
144
  }
145
145
  });
146
146
 
147
- // ../../node_modules/.pnpm/@wise+art@2.17.0_@transferwise+neptune-css@14.20.1_@types+react@18.3.16_react-dom@18.3.1_reac_4hsljgguo7de2wpoipdhgf4kzi/node_modules/@wise/art/dist/index-213daaa3.esm.js
147
+ // ../../node_modules/.pnpm/@wise+art@2.19.0_@transferwise+neptune-css@14.20.1_@types+react@18.3.18_react-dom@18.3.1_reac_mzw7cg6j4wc7ddwlhxck7linn4/node_modules/@wise/art/dist/index-8Fxev6OI.esm.js
148
148
  var import_react2, import_jsx_runtime11, unknownFlagName, Flag, Sizes, ImageSizes, imageSizes, Assets, RenderMode;
149
- var init_index_213daaa3_esm = __esm({
150
- "../../node_modules/.pnpm/@wise+art@2.17.0_@transferwise+neptune-css@14.20.1_@types+react@18.3.16_react-dom@18.3.1_reac_4hsljgguo7de2wpoipdhgf4kzi/node_modules/@wise/art/dist/index-213daaa3.esm.js"() {
149
+ var init_index_8Fxev6OI_esm = __esm({
150
+ "../../node_modules/.pnpm/@wise+art@2.19.0_@transferwise+neptune-css@14.20.1_@types+react@18.3.18_react-dom@18.3.1_reac_mzw7cg6j4wc7ddwlhxck7linn4/node_modules/@wise/art/dist/index-8Fxev6OI.esm.js"() {
151
151
  "use strict";
152
152
  init_clsx();
153
153
  import_react2 = require("react");
@@ -193,76 +193,76 @@ var init_index_213daaa3_esm = __esm({
193
193
  [Sizes.LARGE]: 500
194
194
  };
195
195
  (function(Assets2) {
196
- Assets2["BELL"] = "bell";
197
- Assets2["BRIEFCASE"] = "briefcase";
198
- Assets2["BUSINESS_CARD"] = "business-card";
199
- Assets2["CALENDAR"] = "calendar";
200
- Assets2["CHECK_MARK"] = "check-mark";
201
- Assets2["CLOSED_WINDOW"] = "closed-window";
202
- Assets2["COIN_PILE_DOWN"] = "coin-pile-down";
203
- Assets2["COIN_PILE_UP"] = "coin-pile-up";
204
- Assets2["CONFETTI"] = "confetti";
205
- Assets2["CONSTRUCTION_FENCE"] = "construction-fence";
206
- Assets2["CONVERT"] = "convert";
207
- Assets2["COOKIE"] = "cookie";
208
- Assets2["DIGITAL_CARD_2"] = "digital-card-2";
209
- Assets2["DIGITAL_CARD"] = "digital-card";
210
- Assets2["DOCUMENTS"] = "documents";
211
- Assets2["DOOR"] = "door";
212
- Assets2["ECO_CARD"] = "eco-card";
213
- Assets2["ELECTRIC_PLUG"] = "electric-plug";
214
- Assets2["EMAIL_SUCCESS"] = "email-success";
215
- Assets2["EMAIL"] = "email";
216
- Assets2["EXCLAMATION_MARK"] = "exclamation-mark";
217
- Assets2["FLAG"] = "flag";
218
- Assets2["FLOWER"] = "flower";
219
- Assets2["GEAR"] = "gear";
220
- Assets2["GLOBE"] = "globe";
221
- Assets2["GRAPH"] = "graph";
222
- Assets2["HEART_2"] = "heart-2";
223
- Assets2["HEART_3"] = "heart-3";
224
- Assets2["HEART_4"] = "heart-4";
225
- Assets2["HEART_5"] = "heart-5";
226
- Assets2["HEART"] = "heart";
227
- Assets2["HOUSE"] = "house";
228
- Assets2["ID_CARD"] = "id-card";
229
- Assets2["INFINITE"] = "infinite";
230
- Assets2["INTEREST"] = "interest";
231
- Assets2["INVITE_LETTER"] = "invite-letter";
232
- Assets2["JARS"] = "jars";
233
- Assets2["KEY"] = "key";
234
- Assets2["LIGHT_BULB"] = "light-bulb";
235
- Assets2["LOCK_PLATFORM"] = "lock-platform";
236
- Assets2["LOCK"] = "lock";
237
- Assets2["MAGNIFYING_GLASS"] = "magnifying-glass";
238
- Assets2["MAP"] = "map";
196
+ Assets2["WALLET"] = "wallet";
197
+ Assets2["TWO_INVITE_LETTERS_OPENED"] = "two-invite-letters-opened";
198
+ Assets2["TOOL"] = "tool";
199
+ Assets2["TARGET_PLATFORM"] = "target-platform";
200
+ Assets2["STOPWATCH_PLATFORM"] = "stopwatch-platform";
201
+ Assets2["SPEECH_BUBBLE"] = "speech-bubble";
202
+ Assets2["SKIP_AUTHENTICATION"] = "skip-authentication";
203
+ Assets2["SHOPPING_BAG"] = "shopping-bag";
204
+ Assets2["SATELLITE_PLATFORM"] = "satellite-platform";
205
+ Assets2["SAND_TIMER"] = "sand-timer";
206
+ Assets2["REMINDER_LETTER"] = "reminder-letter";
207
+ Assets2["RECEIVE"] = "receive";
208
+ Assets2["QUESTION_MARK"] = "question-mark";
209
+ Assets2["PUZZLE_PIECES"] = "puzzle-pieces";
210
+ Assets2["PLANE_2"] = "plane-2";
211
+ Assets2["PLANE"] = "plane";
212
+ Assets2["PIE_CHART"] = "pie-chart";
213
+ Assets2["PHONES"] = "phones";
214
+ Assets2["PERSONAL_CARD"] = "personal-card";
215
+ Assets2["PERCENTAGE"] = "percentage";
216
+ Assets2["PALM_TREE"] = "palm-tree";
217
+ Assets2["ONE_INVITE_LETTER_OPENED"] = "one-invite-letter-opened";
218
+ Assets2["MULTI_CURRENCY"] = "multi-currency";
219
+ Assets2["MEGAPHONE"] = "megaphone";
239
220
  Assets2["MARBLE_CARD_BUSINESS"] = "marble-card-business";
240
221
  Assets2["MARBLE_CARD"] = "marble-card";
241
222
  Assets2["MARBLE"] = "marble";
242
- Assets2["MEGAPHONE"] = "megaphone";
243
- Assets2["MULTI_CURRENCY"] = "multi-currency";
244
- Assets2["ONE_INVITE_LETTER_OPENED"] = "one-invite-letter-opened";
245
- Assets2["PALM_TREE"] = "palm-tree";
246
- Assets2["PERCENTAGE"] = "percentage";
247
- Assets2["PERSONAL_CARD"] = "personal-card";
248
- Assets2["PHONES"] = "phones";
249
- Assets2["PIE_CHART"] = "pie-chart";
250
- Assets2["PLANE_2"] = "plane-2";
251
- Assets2["PLANE"] = "plane";
252
- Assets2["PUZZLE_PIECES"] = "puzzle-pieces";
253
- Assets2["QUESTION_MARK"] = "question-mark";
254
- Assets2["RECEIVE"] = "receive";
255
- Assets2["REMINDER_LETTER"] = "reminder-letter";
256
- Assets2["SAND_TIMER"] = "sand-timer";
257
- Assets2["SATELLITE_PLATFORM"] = "satellite-platform";
258
- Assets2["SHOPPING_BAG"] = "shopping-bag";
259
- Assets2["SKIP_AUTHENTICATION"] = "skip-authentication";
260
- Assets2["SPEECH_BUBBLE"] = "speech-bubble";
261
- Assets2["STOPWATCH_PLATFORM"] = "stopwatch-platform";
262
- Assets2["TARGET_PLATFORM"] = "target-platform";
263
- Assets2["TOOL"] = "tool";
264
- Assets2["TWO_INVITE_LETTERS_OPENED"] = "two-invite-letters-opened";
265
- Assets2["WALLET"] = "wallet";
223
+ Assets2["MAP"] = "map";
224
+ Assets2["MAGNIFYING_GLASS"] = "magnifying-glass";
225
+ Assets2["LOCK_PLATFORM"] = "lock-platform";
226
+ Assets2["LOCK"] = "lock";
227
+ Assets2["LIGHT_BULB"] = "light-bulb";
228
+ Assets2["KEY"] = "key";
229
+ Assets2["JARS"] = "jars";
230
+ Assets2["INVITE_LETTER"] = "invite-letter";
231
+ Assets2["INTEREST"] = "interest";
232
+ Assets2["INFINITE"] = "infinite";
233
+ Assets2["ID_CARD"] = "id-card";
234
+ Assets2["HOUSE"] = "house";
235
+ Assets2["HEART_5"] = "heart-5";
236
+ Assets2["HEART_4"] = "heart-4";
237
+ Assets2["HEART_3"] = "heart-3";
238
+ Assets2["HEART_2"] = "heart-2";
239
+ Assets2["HEART"] = "heart";
240
+ Assets2["GRAPH"] = "graph";
241
+ Assets2["GLOBE"] = "globe";
242
+ Assets2["GEAR"] = "gear";
243
+ Assets2["FLOWER"] = "flower";
244
+ Assets2["FLAG"] = "flag";
245
+ Assets2["EXCLAMATION_MARK"] = "exclamation-mark";
246
+ Assets2["EMAIL_SUCCESS"] = "email-success";
247
+ Assets2["EMAIL"] = "email";
248
+ Assets2["ELECTRIC_PLUG"] = "electric-plug";
249
+ Assets2["ECO_CARD"] = "eco-card";
250
+ Assets2["DOOR"] = "door";
251
+ Assets2["DOCUMENTS"] = "documents";
252
+ Assets2["DIGITAL_CARD_2"] = "digital-card-2";
253
+ Assets2["DIGITAL_CARD"] = "digital-card";
254
+ Assets2["COOKIE"] = "cookie";
255
+ Assets2["CONVERT"] = "convert";
256
+ Assets2["CONSTRUCTION_FENCE"] = "construction-fence";
257
+ Assets2["CONFETTI"] = "confetti";
258
+ Assets2["COIN_PILE_UP"] = "coin-pile-up";
259
+ Assets2["COIN_PILE_DOWN"] = "coin-pile-down";
260
+ Assets2["CLOSED_WINDOW"] = "closed-window";
261
+ Assets2["CHECK_MARK"] = "check-mark";
262
+ Assets2["CALENDAR"] = "calendar";
263
+ Assets2["BUSINESS_CARD"] = "business-card";
264
+ Assets2["BRIEFCASE"] = "briefcase";
265
+ Assets2["BELL"] = "bell";
266
266
  })(Assets || (Assets = {}));
267
267
  (function(RenderMode2) {
268
268
  RenderMode2[RenderMode2["INIT"] = 0] = "INIT";
@@ -1260,7 +1260,7 @@ var zh_CN_default = {
1260
1260
  "dynamicFlows.ExternalConfirmation.open": "\u5728\u65B0\u6807\u7B7E\u9875\u4E2D\u6253\u5F00",
1261
1261
  "dynamicFlows.ExternalConfirmation.title": "\u8BF7\u786E\u8BA4",
1262
1262
  "dynamicFlows.FileUploadSchema.maxFileSizeError": "\u62B1\u6B49\uFF0C\u8BE5\u6587\u4EF6\u592A\u5927\u3002\u8BF7\u4E0A\u4F20\u4E00\u4E2A\u66F4\u5C0F\u7684\u6587\u4EF6\u3002",
1263
- "dynamicFlows.FileUploadSchema.wrongFileTypeError": "Sorry, that file format is not supported. Please upload a different file.",
1263
+ "dynamicFlows.FileUploadSchema.wrongFileTypeError": "\u62B1\u6B49\uFF0C\u4E0D\u652F\u6301\u8BE5\u6587\u4EF6\u683C\u5F0F\u3002\u8BF7\u4E0A\u4F20\u5176\u4ED6\u6587\u4EF6\u3002",
1264
1264
  "dynamicFlows.Help.ariaLabel": "\u70B9\u51FB\u6B64\u5904\u83B7\u53D6\u66F4\u591A\u4FE1\u606F\u3002",
1265
1265
  "dynamicFlows.MultiSelect.summary": "{first} \u548C\u5176\u4ED6 {count} \u4E2A",
1266
1266
  "dynamicFlows.MultipleFileUploadSchema.maxFileSizeError": "\u62B1\u6B49\uFF0C\u8BE5\u6587\u4EF6\u592A\u5927\u3002\u8BF7\u4E0A\u4F20\u4E00\u4E2A\u66F4\u5C0F\u7684\u6587\u4EF6\u3002",
@@ -1778,8 +1778,8 @@ var DateInputRenderer_default = DateInputRenderer;
1778
1778
  // ../renderers/src/DecisionRenderer.tsx
1779
1779
  var import_components8 = require("@transferwise/components");
1780
1780
 
1781
- // ../../node_modules/.pnpm/@wise+art@2.17.0_@transferwise+neptune-css@14.20.1_@types+react@18.3.16_react-dom@18.3.1_reac_4hsljgguo7de2wpoipdhgf4kzi/node_modules/@wise/art/dist/index.esm.js
1782
- init_index_213daaa3_esm();
1781
+ // ../../node_modules/.pnpm/@wise+art@2.19.0_@transferwise+neptune-css@14.20.1_@types+react@18.3.18_react-dom@18.3.1_reac_mzw7cg6j4wc7ddwlhxck7linn4/node_modules/@wise/art/dist/index.esm.js
1782
+ init_index_8Fxev6OI_esm();
1783
1783
  init_clsx();
1784
1784
  var import_react3 = require("react");
1785
1785
  var import_jsx_runtime12 = require("react/jsx-runtime");
@@ -13138,6 +13138,83 @@ var mapStepToComponent = (_a) => {
13138
13138
  return stepComponent;
13139
13139
  };
13140
13140
 
13141
+ // src/revamp/flow/getResponseType.ts
13142
+ var responseTypes = ["step", "action", "exit"];
13143
+ var getResponseType = async (response) => {
13144
+ assertResponseIsValid(response);
13145
+ const headerResponseType = getResponseTypeFromHeader(response);
13146
+ if (headerResponseType) {
13147
+ return headerResponseType;
13148
+ }
13149
+ const jsonBody = await parseResponseBodyAsJsonElement(response.clone());
13150
+ if (isObject(jsonBody) && jsonBody.action) {
13151
+ return "action";
13152
+ }
13153
+ return "step";
13154
+ };
13155
+ var getResponseTypeFromHeader = (response) => {
13156
+ var _a, _b;
13157
+ if ((_a = response.headers) == null ? void 0 : _a.has("X-Df-Response-Type")) {
13158
+ const type = response.headers.get("X-Df-Response-Type");
13159
+ assertDFResponseType(type);
13160
+ return type;
13161
+ }
13162
+ if ((_b = response.headers) == null ? void 0 : _b.has("X-Df-Exit")) {
13163
+ return "exit";
13164
+ }
13165
+ return void 0;
13166
+ };
13167
+ function assertDFResponseType(type) {
13168
+ if (!responseTypes.includes(type)) {
13169
+ throw new Error(
13170
+ "Unsupported X-Df-Response-Type. Allowed values are 'step', 'action', 'exit', 'error'."
13171
+ );
13172
+ }
13173
+ }
13174
+
13175
+ // src/revamp/flow/executePoll.ts
13176
+ var executePoll = async (props) => {
13177
+ const { errorAction, signal, url, httpClient, trackEvent } = props;
13178
+ try {
13179
+ const response = await httpClient(url != null ? url : "", {
13180
+ method: "GET",
13181
+ signal
13182
+ });
13183
+ if (!response.ok) {
13184
+ trackEvent("Polling Failed", { url, statusCode: response.status, variant: "revamp" });
13185
+ return { type: "action", action: errorAction };
13186
+ }
13187
+ const responseType = getResponseTypeFromHeader(response);
13188
+ const body = await parseResponseBodyAsJsonElement(response);
13189
+ try {
13190
+ switch (responseType) {
13191
+ case "step": {
13192
+ const etag = response.headers.get("etag") || null;
13193
+ assertStepResponseBody(body);
13194
+ return { type: "replace-step", step: body, etag };
13195
+ }
13196
+ case "exit": {
13197
+ return { type: "complete", result: body };
13198
+ }
13199
+ case "action": {
13200
+ assertActionResponseBody(body);
13201
+ return { type: "action", action: body.action };
13202
+ }
13203
+ default: {
13204
+ if (isActionResponseBody(body)) {
13205
+ return { type: "action", action: body.action };
13206
+ }
13207
+ return { type: "continue" };
13208
+ }
13209
+ }
13210
+ } catch (error) {
13211
+ return { type: "action", action: errorAction };
13212
+ }
13213
+ } catch (error) {
13214
+ return { type: "continue" };
13215
+ }
13216
+ };
13217
+
13141
13218
  // src/revamp/flow/executeRefresh.ts
13142
13219
  var executeRefresh = async (props) => {
13143
13220
  const { abortSignal, url, model, schemaId, etag, httpClient, trackEvent } = props;
@@ -13158,8 +13235,11 @@ var executeRefresh = async (props) => {
13158
13235
  if (!response.ok) {
13159
13236
  const responseBody = await parseResponseBodyAsJsonElement(response).catch(() => ({}));
13160
13237
  const body2 = isErrorResponseBody(responseBody) ? responseBody : {};
13161
- trackEvent("Refresh Failed", __spreadValues({ schema: schemaId }, body2.analytics));
13162
- return { type: "error", body: body2 };
13238
+ trackEvent("Refresh Failed", __spreadProps(__spreadValues({}, body2.analytics), {
13239
+ schema: schemaId,
13240
+ statusCode: response.status
13241
+ }));
13242
+ return { type: "error", body: body2, statusCode: response.status };
13163
13243
  }
13164
13244
  const newEtag = response.headers.get("etag") || null;
13165
13245
  const body = await parseResponseBodyAsJsonElement(response);
@@ -13176,40 +13256,6 @@ var executeRefresh = async (props) => {
13176
13256
  }
13177
13257
  };
13178
13258
 
13179
- // src/revamp/flow/getResponseType.ts
13180
- var responseTypes = ["step", "action", "exit"];
13181
- var getResponseType = async (response) => {
13182
- assertResponseIsValid(response);
13183
- const headerResponseType = getResponseTypeFromHeader(response);
13184
- if (headerResponseType) {
13185
- return headerResponseType;
13186
- }
13187
- const jsonBody = await parseResponseBodyAsJsonElement(response.clone());
13188
- if (isObject(jsonBody) && jsonBody.action) {
13189
- return "action";
13190
- }
13191
- return "step";
13192
- };
13193
- var getResponseTypeFromHeader = (response) => {
13194
- var _a, _b;
13195
- if ((_a = response.headers) == null ? void 0 : _a.has("X-Df-Response-Type")) {
13196
- const type = response.headers.get("X-Df-Response-Type");
13197
- assertDFResponseType(type);
13198
- return type;
13199
- }
13200
- if ((_b = response.headers) == null ? void 0 : _b.has("X-Df-Exit")) {
13201
- return "exit";
13202
- }
13203
- return void 0;
13204
- };
13205
- function assertDFResponseType(type) {
13206
- if (!responseTypes.includes(type)) {
13207
- throw new Error(
13208
- "Unsupported X-Df-Response-Type. Allowed values are 'step', 'action', 'exit', 'error'."
13209
- );
13210
- }
13211
- }
13212
-
13213
13259
  // src/revamp/flow/executeSubmission.ts
13214
13260
  var executeSubmission = async (props) => {
13215
13261
  const { httpClient, trackEvent } = props;
@@ -13278,12 +13324,12 @@ var executeSubmission = async (props) => {
13278
13324
  if (isErrorResponseBody(body)) {
13279
13325
  const refreshUrl = body.refreshUrl || body.refreshFormUrl;
13280
13326
  const { error, validation, analytics } = body;
13281
- trackEvent("Action Failed", __spreadValues({ actionId }, analytics));
13327
+ trackEvent("Action Failed", __spreadProps(__spreadValues({}, analytics), { actionId, statusCode: response.status }));
13282
13328
  const errors = { error, validation };
13283
- return refreshUrl ? { type: "refresh", body: { refreshUrl, errors } } : { type: "error", body: { errors, analytics } };
13329
+ return refreshUrl ? { type: "refresh", body: { refreshUrl, errors } } : { type: "error", body: { errors, analytics }, statusCode: response.status };
13284
13330
  }
13285
- trackEvent("Action Failed", { actionId });
13286
- return { type: "error", body: {} };
13331
+ trackEvent("Action Failed", { actionId, statusCode: response.status });
13332
+ return { type: "error", body: {}, statusCode: response.status };
13287
13333
  };
13288
13334
  return triggerAction(props.action, props.model, props.isInitial);
13289
13335
  };
@@ -13525,48 +13571,6 @@ function useStableCallback(handler) {
13525
13571
  return (0, import_react16.useCallback)((...args) => ref.current ? ref.current(...args) : null, []);
13526
13572
  }
13527
13573
 
13528
- // src/revamp/flow/executePoll.ts
13529
- var executePoll = async (props) => {
13530
- const { errorAction, signal, url, httpClient } = props;
13531
- try {
13532
- const response = await httpClient(url != null ? url : "", {
13533
- method: "GET",
13534
- signal
13535
- });
13536
- if (!response.ok) {
13537
- return { type: "action", action: errorAction };
13538
- }
13539
- const responseType = getResponseTypeFromHeader(response);
13540
- const body = await parseResponseBodyAsJsonElement(response);
13541
- try {
13542
- switch (responseType) {
13543
- case "step": {
13544
- const etag = response.headers.get("etag") || null;
13545
- assertStepResponseBody(body);
13546
- return { type: "replace-step", step: body, etag };
13547
- }
13548
- case "exit": {
13549
- return { type: "complete", result: body };
13550
- }
13551
- case "action": {
13552
- assertActionResponseBody(body);
13553
- return { type: "action", action: body.action };
13554
- }
13555
- default: {
13556
- if (isActionResponseBody(body)) {
13557
- return { type: "action", action: body.action };
13558
- }
13559
- return { type: "continue" };
13560
- }
13561
- }
13562
- } catch (error) {
13563
- return { type: "action", action: errorAction };
13564
- }
13565
- } catch (error) {
13566
- return { type: "continue" };
13567
- }
13568
- };
13569
-
13570
13574
  // src/revamp/useDynamicFlowCore.tsx
13571
13575
  function useDynamicFlowCore(props) {
13572
13576
  const _a = props, { flowId, initialAction, initialStep, displayStepTitle = true } = _a, rest = __objRest(_a, ["flowId", "initialAction", "initialStep", "displayStepTitle"]);
@@ -13683,9 +13687,9 @@ function useDynamicFlowCore(props) {
13683
13687
  []
13684
13688
  );
13685
13689
  const closeWithError = (0, import_react17.useCallback)(
13686
- (error, analytics) => {
13690
+ (error, analytics, statusCode) => {
13687
13691
  trackCoreEvent("Failed", __spreadValues({}, analytics));
13688
- onError(error);
13692
+ onError(error, statusCode);
13689
13693
  },
13690
13694
  // eslint-disable-next-line react-hooks/exhaustive-deps
13691
13695
  []
@@ -13720,7 +13724,7 @@ function useDynamicFlowCore(props) {
13720
13724
  if (stepRef.current) {
13721
13725
  initialiseWithStep(__spreadProps(__spreadValues({}, stepRef.current), { errors, model }), etagRef.current);
13722
13726
  } else {
13723
- closeWithError(new Error("Initial request failed"), {});
13727
+ closeWithError(new Error("Initial request failed"), {}, command.statusCode);
13724
13728
  }
13725
13729
  break;
13726
13730
  }
@@ -13757,7 +13761,11 @@ function useDynamicFlowCore(props) {
13757
13761
  }
13758
13762
  break;
13759
13763
  case "error": {
13760
- closeWithError(new Error("Failed to refresh"), command.body.analytics);
13764
+ closeWithError(
13765
+ new Error("Failed to refresh"),
13766
+ command.body.analytics,
13767
+ command.statusCode
13768
+ );
13761
13769
  break;
13762
13770
  }
13763
13771
  case "noop":
@@ -13777,7 +13785,8 @@ function useDynamicFlowCore(props) {
13777
13785
  httpClient,
13778
13786
  url,
13779
13787
  errorAction,
13780
- signal
13788
+ signal,
13789
+ trackEvent: trackCoreEvent
13781
13790
  });
13782
13791
  switch (command.type) {
13783
13792
  case "replace-step":
@@ -19470,12 +19479,18 @@ var import_react56 = require("react");
19470
19479
  function useStepPolling(polling, onAction) {
19471
19480
  var _a, _b;
19472
19481
  const httpClient = useHttpClient();
19482
+ const onEvent = useEventDispatcher();
19473
19483
  const asyncFn = (0, import_react56.useMemo)(() => {
19474
19484
  if (polling) {
19475
19485
  return () => httpClient(polling.url).then((response) => {
19476
19486
  if (response.ok) {
19477
- return response.json().then((pollingResponse) => pollingResponse).catch((error) => null);
19487
+ return response.json().then((pollingResponse) => pollingResponse).catch(() => null);
19478
19488
  }
19489
+ onEvent("Dynamic Flow - Polling Failed", {
19490
+ url: polling.url,
19491
+ statusCode: response.status,
19492
+ variant: "legacy"
19493
+ });
19479
19494
  throw new Error("failed");
19480
19495
  }).catch((error) => {
19481
19496
  throw new Error(error.message === "failed" ? "failed" : "network failed");
@@ -20798,13 +20813,13 @@ var DynamicFlowComponent = ({
20798
20813
  }
20799
20814
  setLoadingState("idle");
20800
20815
  };
20801
- const completeWithError = (error, message, fetchType, responseStatus) => {
20816
+ const completeWithError = (error, message, fetchType, statusCode) => {
20802
20817
  logCritical("Error fetching", message);
20803
20818
  if (fetchType === "refresh") {
20804
20819
  dispatchEvent("Dynamic Flow - Step Refreshed", { status: "failure" });
20805
20820
  }
20806
20821
  dispatchEvent("Dynamic Flow - Flow Finished", { status: "failure" });
20807
- onError(error, responseStatus);
20822
+ onError(error, statusCode);
20808
20823
  setLoadingState("idle");
20809
20824
  };
20810
20825
  const onModelChange = (onModelChangeProps) => {