@wise/dynamic-flow-client 3.28.9 → 3.29.1

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");
@@ -11275,6 +11275,7 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
11275
11275
  draft.persistedState.lastSubmitted = null;
11276
11276
  draft.persistedState.submission = Promise.resolve(null);
11277
11277
  draft.errors = [];
11278
+ draft.value = null;
11278
11279
  });
11279
11280
  throw error;
11280
11281
  });
@@ -13138,6 +13139,83 @@ var mapStepToComponent = (_a) => {
13138
13139
  return stepComponent;
13139
13140
  };
13140
13141
 
13142
+ // src/revamp/flow/getResponseType.ts
13143
+ var responseTypes = ["step", "action", "exit"];
13144
+ var getResponseType = async (response) => {
13145
+ assertResponseIsValid(response);
13146
+ const headerResponseType = getResponseTypeFromHeader(response);
13147
+ if (headerResponseType) {
13148
+ return headerResponseType;
13149
+ }
13150
+ const jsonBody = await parseResponseBodyAsJsonElement(response.clone());
13151
+ if (isObject(jsonBody) && jsonBody.action) {
13152
+ return "action";
13153
+ }
13154
+ return "step";
13155
+ };
13156
+ var getResponseTypeFromHeader = (response) => {
13157
+ var _a, _b;
13158
+ if ((_a = response.headers) == null ? void 0 : _a.has("X-Df-Response-Type")) {
13159
+ const type = response.headers.get("X-Df-Response-Type");
13160
+ assertDFResponseType(type);
13161
+ return type;
13162
+ }
13163
+ if ((_b = response.headers) == null ? void 0 : _b.has("X-Df-Exit")) {
13164
+ return "exit";
13165
+ }
13166
+ return void 0;
13167
+ };
13168
+ function assertDFResponseType(type) {
13169
+ if (!responseTypes.includes(type)) {
13170
+ throw new Error(
13171
+ "Unsupported X-Df-Response-Type. Allowed values are 'step', 'action', 'exit', 'error'."
13172
+ );
13173
+ }
13174
+ }
13175
+
13176
+ // src/revamp/flow/executePoll.ts
13177
+ var executePoll = async (props) => {
13178
+ const { errorAction, signal, url, httpClient, trackEvent } = props;
13179
+ try {
13180
+ const response = await httpClient(url != null ? url : "", {
13181
+ method: "GET",
13182
+ signal
13183
+ });
13184
+ if (!response.ok) {
13185
+ trackEvent("Polling Failed", { url, statusCode: response.status, variant: "revamp" });
13186
+ return { type: "action", action: errorAction };
13187
+ }
13188
+ const responseType = getResponseTypeFromHeader(response);
13189
+ const body = await parseResponseBodyAsJsonElement(response);
13190
+ try {
13191
+ switch (responseType) {
13192
+ case "step": {
13193
+ const etag = response.headers.get("etag") || null;
13194
+ assertStepResponseBody(body);
13195
+ return { type: "replace-step", step: body, etag };
13196
+ }
13197
+ case "exit": {
13198
+ return { type: "complete", result: body };
13199
+ }
13200
+ case "action": {
13201
+ assertActionResponseBody(body);
13202
+ return { type: "action", action: body.action };
13203
+ }
13204
+ default: {
13205
+ if (isActionResponseBody(body)) {
13206
+ return { type: "action", action: body.action };
13207
+ }
13208
+ return { type: "continue" };
13209
+ }
13210
+ }
13211
+ } catch (error) {
13212
+ return { type: "action", action: errorAction };
13213
+ }
13214
+ } catch (error) {
13215
+ return { type: "continue" };
13216
+ }
13217
+ };
13218
+
13141
13219
  // src/revamp/flow/executeRefresh.ts
13142
13220
  var executeRefresh = async (props) => {
13143
13221
  const { abortSignal, url, model, schemaId, etag, httpClient, trackEvent } = props;
@@ -13158,8 +13236,11 @@ var executeRefresh = async (props) => {
13158
13236
  if (!response.ok) {
13159
13237
  const responseBody = await parseResponseBodyAsJsonElement(response).catch(() => ({}));
13160
13238
  const body2 = isErrorResponseBody(responseBody) ? responseBody : {};
13161
- trackEvent("Refresh Failed", __spreadValues({ schema: schemaId }, body2.analytics));
13162
- return { type: "error", body: body2 };
13239
+ trackEvent("Refresh Failed", __spreadProps(__spreadValues({}, body2.analytics), {
13240
+ schema: schemaId,
13241
+ statusCode: response.status
13242
+ }));
13243
+ return { type: "error", body: body2, statusCode: response.status };
13163
13244
  }
13164
13245
  const newEtag = response.headers.get("etag") || null;
13165
13246
  const body = await parseResponseBodyAsJsonElement(response);
@@ -13176,40 +13257,6 @@ var executeRefresh = async (props) => {
13176
13257
  }
13177
13258
  };
13178
13259
 
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
13260
  // src/revamp/flow/executeSubmission.ts
13214
13261
  var executeSubmission = async (props) => {
13215
13262
  const { httpClient, trackEvent } = props;
@@ -13278,12 +13325,12 @@ var executeSubmission = async (props) => {
13278
13325
  if (isErrorResponseBody(body)) {
13279
13326
  const refreshUrl = body.refreshUrl || body.refreshFormUrl;
13280
13327
  const { error, validation, analytics } = body;
13281
- trackEvent("Action Failed", __spreadValues({ actionId }, analytics));
13328
+ trackEvent("Action Failed", __spreadProps(__spreadValues({}, analytics), { actionId, statusCode: response.status }));
13282
13329
  const errors = { error, validation };
13283
- return refreshUrl ? { type: "refresh", body: { refreshUrl, errors } } : { type: "error", body: { errors, analytics } };
13330
+ return refreshUrl ? { type: "refresh", body: { refreshUrl, errors } } : { type: "error", body: { errors, analytics }, statusCode: response.status };
13284
13331
  }
13285
- trackEvent("Action Failed", { actionId });
13286
- return { type: "error", body: {} };
13332
+ trackEvent("Action Failed", { actionId, statusCode: response.status });
13333
+ return { type: "error", body: {}, statusCode: response.status };
13287
13334
  };
13288
13335
  return triggerAction(props.action, props.model, props.isInitial);
13289
13336
  };
@@ -13525,48 +13572,6 @@ function useStableCallback(handler) {
13525
13572
  return (0, import_react16.useCallback)((...args) => ref.current ? ref.current(...args) : null, []);
13526
13573
  }
13527
13574
 
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
13575
  // src/revamp/useDynamicFlowCore.tsx
13571
13576
  function useDynamicFlowCore(props) {
13572
13577
  const _a = props, { flowId, initialAction, initialStep, displayStepTitle = true } = _a, rest = __objRest(_a, ["flowId", "initialAction", "initialStep", "displayStepTitle"]);
@@ -13683,9 +13688,9 @@ function useDynamicFlowCore(props) {
13683
13688
  []
13684
13689
  );
13685
13690
  const closeWithError = (0, import_react17.useCallback)(
13686
- (error, analytics) => {
13691
+ (error, analytics, statusCode) => {
13687
13692
  trackCoreEvent("Failed", __spreadValues({}, analytics));
13688
- onError(error);
13693
+ onError(error, statusCode);
13689
13694
  },
13690
13695
  // eslint-disable-next-line react-hooks/exhaustive-deps
13691
13696
  []
@@ -13718,9 +13723,22 @@ function useDynamicFlowCore(props) {
13718
13723
  const genericErrorMessage = getErrorMessageFunctions().genericErrorWithRetry();
13719
13724
  const { errors = { error: genericErrorMessage } } = command.body;
13720
13725
  if (stepRef.current) {
13721
- initialiseWithStep(__spreadProps(__spreadValues({}, stepRef.current), { errors, model }), etagRef.current);
13726
+ initialiseWithStep(
13727
+ __spreadProps(__spreadValues({}, stepRef.current), {
13728
+ // the existing step
13729
+ errors,
13730
+ // but with the new errors
13731
+ model,
13732
+ // and the model that was submitted
13733
+ polling: void 0,
13734
+ // and no polling, to avoid restarting it
13735
+ external: void 0
13736
+ // and no external, to avoid retriggering it
13737
+ }),
13738
+ etagRef.current
13739
+ );
13722
13740
  } else {
13723
- closeWithError(new Error("Initial request failed"), {});
13741
+ closeWithError(new Error("Initial request failed"), {}, command.statusCode);
13724
13742
  }
13725
13743
  break;
13726
13744
  }
@@ -13757,7 +13775,11 @@ function useDynamicFlowCore(props) {
13757
13775
  }
13758
13776
  break;
13759
13777
  case "error": {
13760
- closeWithError(new Error("Failed to refresh"), command.body.analytics);
13778
+ closeWithError(
13779
+ new Error("Failed to refresh"),
13780
+ command.body.analytics,
13781
+ command.statusCode
13782
+ );
13761
13783
  break;
13762
13784
  }
13763
13785
  case "noop":
@@ -13777,7 +13799,8 @@ function useDynamicFlowCore(props) {
13777
13799
  httpClient,
13778
13800
  url,
13779
13801
  errorAction,
13780
- signal
13802
+ signal,
13803
+ trackEvent: trackCoreEvent
13781
13804
  });
13782
13805
  switch (command.type) {
13783
13806
  case "replace-step":
@@ -19470,12 +19493,18 @@ var import_react56 = require("react");
19470
19493
  function useStepPolling(polling, onAction) {
19471
19494
  var _a, _b;
19472
19495
  const httpClient = useHttpClient();
19496
+ const onEvent = useEventDispatcher();
19473
19497
  const asyncFn = (0, import_react56.useMemo)(() => {
19474
19498
  if (polling) {
19475
19499
  return () => httpClient(polling.url).then((response) => {
19476
19500
  if (response.ok) {
19477
- return response.json().then((pollingResponse) => pollingResponse).catch((error) => null);
19501
+ return response.json().then((pollingResponse) => pollingResponse).catch(() => null);
19478
19502
  }
19503
+ onEvent("Dynamic Flow - Polling Failed", {
19504
+ url: polling.url,
19505
+ statusCode: response.status,
19506
+ variant: "legacy"
19507
+ });
19479
19508
  throw new Error("failed");
19480
19509
  }).catch((error) => {
19481
19510
  throw new Error(error.message === "failed" ? "failed" : "network failed");
@@ -20798,13 +20827,13 @@ var DynamicFlowComponent = ({
20798
20827
  }
20799
20828
  setLoadingState("idle");
20800
20829
  };
20801
- const completeWithError = (error, message, fetchType, responseStatus) => {
20830
+ const completeWithError = (error, message, fetchType, statusCode) => {
20802
20831
  logCritical("Error fetching", message);
20803
20832
  if (fetchType === "refresh") {
20804
20833
  dispatchEvent("Dynamic Flow - Step Refreshed", { status: "failure" });
20805
20834
  }
20806
20835
  dispatchEvent("Dynamic Flow - Flow Finished", { status: "failure" });
20807
- onError(error, responseStatus);
20836
+ onError(error, statusCode);
20808
20837
  setLoadingState("idle");
20809
20838
  };
20810
20839
  const onModelChange = (onModelChangeProps) => {