@0xsquid/ui 2.6.1 → 2.6.2

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/dist/cjs/index.js CHANGED
@@ -69301,9 +69301,8 @@ const TrackTransactionView = React$1.forwardRef((props, ref) => {
69301
69301
  currentStepIndex: rawSteps.length - 1,
69302
69302
  };
69303
69303
  }
69304
- // TODO: Fix this
69305
69304
  // Vercel build throws an error for findLastIndex, probably related to the Node version being used
69306
- // @ts-expect-error
69305
+ // @ts-expect-error - TODO: Fix this
69307
69306
  const lastSuccessfulStepIndex = rawSteps.findLastIndex((s) => s.status === "executed" || s.status === "success");
69308
69307
  if (swapState === SwapState.PROGRESS) {
69309
69308
  onTxStart();
@@ -69340,6 +69339,31 @@ const TrackTransactionView = React$1.forwardRef((props, ref) => {
69340
69339
  currentStepIndex: firstWarningStepIndex,
69341
69340
  };
69342
69341
  }
69342
+ if (swapState === SwapState.PARTIAL_SUCCESS) {
69343
+ // Vercel build throws an error for findLastIndex, probably related to the Node version being used
69344
+ // @ts-expect-error - TODO: Fix this
69345
+ const lastWarningStepIndex = rawSteps.findLastIndex((s) => s.status === "warning");
69346
+ if (lastWarningStepIndex !== -1) {
69347
+ return {
69348
+ currentStepIndex: lastWarningStepIndex,
69349
+ steps: rawSteps,
69350
+ };
69351
+ }
69352
+ const lastSuccessfulStep = rawSteps[lastSuccessfulStepIndex];
69353
+ if (!lastSuccessfulStep) {
69354
+ return {
69355
+ currentStepIndex: 0,
69356
+ steps: rawSteps,
69357
+ };
69358
+ }
69359
+ // If swap state is partial success and there is no warning step
69360
+ // override last successful step with warning status
69361
+ const stepsWithRefunded = rawSteps.with(lastSuccessfulStepIndex, Object.assign(Object.assign({}, lastSuccessfulStep), { status: "warning" }));
69362
+ return {
69363
+ currentStepIndex: lastSuccessfulStepIndex,
69364
+ steps: stepsWithRefunded,
69365
+ };
69366
+ }
69343
69367
  return {
69344
69368
  steps: rawSteps,
69345
69369
  currentStepIndex: 0,
package/dist/esm/index.js CHANGED
@@ -69281,9 +69281,8 @@ const TrackTransactionView = forwardRef((props, ref) => {
69281
69281
  currentStepIndex: rawSteps.length - 1,
69282
69282
  };
69283
69283
  }
69284
- // TODO: Fix this
69285
69284
  // Vercel build throws an error for findLastIndex, probably related to the Node version being used
69286
- // @ts-expect-error
69285
+ // @ts-expect-error - TODO: Fix this
69287
69286
  const lastSuccessfulStepIndex = rawSteps.findLastIndex((s) => s.status === "executed" || s.status === "success");
69288
69287
  if (swapState === SwapState.PROGRESS) {
69289
69288
  onTxStart();
@@ -69320,6 +69319,31 @@ const TrackTransactionView = forwardRef((props, ref) => {
69320
69319
  currentStepIndex: firstWarningStepIndex,
69321
69320
  };
69322
69321
  }
69322
+ if (swapState === SwapState.PARTIAL_SUCCESS) {
69323
+ // Vercel build throws an error for findLastIndex, probably related to the Node version being used
69324
+ // @ts-expect-error - TODO: Fix this
69325
+ const lastWarningStepIndex = rawSteps.findLastIndex((s) => s.status === "warning");
69326
+ if (lastWarningStepIndex !== -1) {
69327
+ return {
69328
+ currentStepIndex: lastWarningStepIndex,
69329
+ steps: rawSteps,
69330
+ };
69331
+ }
69332
+ const lastSuccessfulStep = rawSteps[lastSuccessfulStepIndex];
69333
+ if (!lastSuccessfulStep) {
69334
+ return {
69335
+ currentStepIndex: 0,
69336
+ steps: rawSteps,
69337
+ };
69338
+ }
69339
+ // If swap state is partial success and there is no warning step
69340
+ // override last successful step with warning status
69341
+ const stepsWithRefunded = rawSteps.with(lastSuccessfulStepIndex, Object.assign(Object.assign({}, lastSuccessfulStep), { status: "warning" }));
69342
+ return {
69343
+ currentStepIndex: lastSuccessfulStepIndex,
69344
+ steps: stepsWithRefunded,
69345
+ };
69346
+ }
69323
69347
  return {
69324
69348
  steps: rawSteps,
69325
69349
  currentStepIndex: 0,
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "git+https://github.com/0xsquid/squid-ui.git"
6
6
  },
7
7
  "description": "Squid's UI components",
8
- "version": "2.6.1",
8
+ "version": "2.6.2",
9
9
  "author": "",
10
10
  "license": "MIT",
11
11
  "resolutions": {