@shipengine/elements 0.35.0 → 0.36.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.
Files changed (3) hide show
  1. package/index.cjs +151 -147
  2. package/index.js +151 -147
  3. package/package.json +1 -1
package/index.cjs CHANGED
@@ -5433,6 +5433,87 @@ const useBlackboxDetection = ({
5433
5433
  }, [onSuccess, onError]);
5434
5434
  };
5435
5435
 
5436
+ var call$6 = functionCall;
5437
+ var hasOwn$2 = hasOwnProperty_1;
5438
+ var isPrototypeOf$2 = objectIsPrototypeOf;
5439
+ var regExpFlags = regexpFlags$1;
5440
+
5441
+ var RegExpPrototype$1 = RegExp.prototype;
5442
+
5443
+ var regexpGetFlags = function (R) {
5444
+ var flags = R.flags;
5445
+ return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn$2(R, 'flags') && isPrototypeOf$2(RegExpPrototype$1, R)
5446
+ ? call$6(regExpFlags, R) : flags;
5447
+ };
5448
+
5449
+ var $$9 = _export;
5450
+ var call$5 = functionCall;
5451
+ var uncurryThis$4 = functionUncurryThis;
5452
+ var requireObjectCoercible$1 = requireObjectCoercible$9;
5453
+ var isCallable$5 = isCallable$o;
5454
+ var isNullOrUndefined$2 = isNullOrUndefined$7;
5455
+ var isRegExp = isRegexp;
5456
+ var toString$4 = toString$c;
5457
+ var getMethod$1 = getMethod$6;
5458
+ var getRegExpFlags$1 = regexpGetFlags;
5459
+ var getSubstitution = getSubstitution$2;
5460
+ var wellKnownSymbol$4 = wellKnownSymbol$k;
5461
+
5462
+ var REPLACE = wellKnownSymbol$4('replace');
5463
+ var $TypeError$4 = TypeError;
5464
+ var indexOf = uncurryThis$4(''.indexOf);
5465
+ uncurryThis$4(''.replace);
5466
+ var stringSlice$1 = uncurryThis$4(''.slice);
5467
+ var max = Math.max;
5468
+
5469
+ var stringIndexOf = function (string, searchValue, fromIndex) {
5470
+ if (fromIndex > string.length) return -1;
5471
+ if (searchValue === '') return fromIndex;
5472
+ return indexOf(string, searchValue, fromIndex);
5473
+ };
5474
+
5475
+ // `String.prototype.replaceAll` method
5476
+ // https://tc39.es/ecma262/#sec-string.prototype.replaceall
5477
+ $$9({ target: 'String', proto: true }, {
5478
+ replaceAll: function replaceAll(searchValue, replaceValue) {
5479
+ var O = requireObjectCoercible$1(this);
5480
+ var IS_REG_EXP, flags, replacer, string, searchString, functionalReplace, searchLength, advanceBy, replacement;
5481
+ var position = 0;
5482
+ var endOfLastMatch = 0;
5483
+ var result = '';
5484
+ if (!isNullOrUndefined$2(searchValue)) {
5485
+ IS_REG_EXP = isRegExp(searchValue);
5486
+ if (IS_REG_EXP) {
5487
+ flags = toString$4(requireObjectCoercible$1(getRegExpFlags$1(searchValue)));
5488
+ if (!~indexOf(flags, 'g')) throw $TypeError$4('`.replaceAll` does not allow non-global regexes');
5489
+ }
5490
+ replacer = getMethod$1(searchValue, REPLACE);
5491
+ if (replacer) {
5492
+ return call$5(replacer, searchValue, O, replaceValue);
5493
+ }
5494
+ }
5495
+ string = toString$4(O);
5496
+ searchString = toString$4(searchValue);
5497
+ functionalReplace = isCallable$5(replaceValue);
5498
+ if (!functionalReplace) replaceValue = toString$4(replaceValue);
5499
+ searchLength = searchString.length;
5500
+ advanceBy = max(1, searchLength);
5501
+ position = stringIndexOf(string, searchString, 0);
5502
+ while (position !== -1) {
5503
+ replacement = functionalReplace
5504
+ ? toString$4(replaceValue(searchString, position, string))
5505
+ : getSubstitution(searchString, string, position, [], undefined, replaceValue);
5506
+ result += stringSlice$1(string, endOfLastMatch, position) + replacement;
5507
+ endOfLastMatch = position + searchLength;
5508
+ position = stringIndexOf(string, searchString, position + advanceBy);
5509
+ }
5510
+ if (endOfLastMatch < string.length) {
5511
+ result += stringSlice$1(string, endOfLastMatch);
5512
+ }
5513
+ return result;
5514
+ }
5515
+ });
5516
+
5436
5517
  /**
5437
5518
  * @internal
5438
5519
  *
@@ -5452,10 +5533,13 @@ const useScrubErrors = ({
5452
5533
  } = reactI18next.useTranslation();
5453
5534
  return React.useMemo(() => errors === null || errors === void 0 ? void 0 : errors.map(e => {
5454
5535
  return t(jsBase64.encode(e.message), {
5455
- defaultValue: !predicate || predicate(e) ? t(scrubber(e)) : e.message
5536
+ defaultValue: !predicate || predicate(e) ? t(scrubber(e)) : networkErrorPrettyPrinter(e)
5456
5537
  });
5457
5538
  }), [errors, predicate, scrubber, t]);
5458
5539
  };
5540
+ const networkErrorPrettyPrinter = e => {
5541
+ return e.message.replaceAll(/Invalid rate\. Invalid rate\./g, "Invalid rate.");
5542
+ };
5459
5543
 
5460
5544
  const useListConnectedCarriers = () => {
5461
5545
  const {
@@ -5689,10 +5773,10 @@ const Label$1 = ({
5689
5773
 
5690
5774
  var getBuiltIn$2 = getBuiltIn$8;
5691
5775
  var definePropertyModule = objectDefineProperty;
5692
- var wellKnownSymbol$4 = wellKnownSymbol$k;
5776
+ var wellKnownSymbol$3 = wellKnownSymbol$k;
5693
5777
  var DESCRIPTORS$1 = descriptors;
5694
5778
 
5695
- var SPECIES$2 = wellKnownSymbol$4('species');
5779
+ var SPECIES$2 = wellKnownSymbol$3('species');
5696
5780
 
5697
5781
  var setSpecies$1 = function (CONSTRUCTOR_NAME) {
5698
5782
  var Constructor = getBuiltIn$2(CONSTRUCTOR_NAME);
@@ -5706,49 +5790,49 @@ var setSpecies$1 = function (CONSTRUCTOR_NAME) {
5706
5790
  }
5707
5791
  };
5708
5792
 
5709
- var isPrototypeOf$2 = objectIsPrototypeOf;
5793
+ var isPrototypeOf$1 = objectIsPrototypeOf;
5710
5794
 
5711
- var $TypeError$4 = TypeError;
5795
+ var $TypeError$3 = TypeError;
5712
5796
 
5713
5797
  var anInstance$1 = function (it, Prototype) {
5714
- if (isPrototypeOf$2(Prototype, it)) return it;
5715
- throw $TypeError$4('Incorrect invocation');
5798
+ if (isPrototypeOf$1(Prototype, it)) return it;
5799
+ throw $TypeError$3('Incorrect invocation');
5716
5800
  };
5717
5801
 
5718
5802
  var isConstructor = isConstructor$2;
5719
5803
  var tryToString = tryToString$5;
5720
5804
 
5721
- var $TypeError$3 = TypeError;
5805
+ var $TypeError$2 = TypeError;
5722
5806
 
5723
5807
  // `Assert: IsConstructor(argument) is true`
5724
5808
  var aConstructor$1 = function (argument) {
5725
5809
  if (isConstructor(argument)) return argument;
5726
- throw $TypeError$3(tryToString(argument) + ' is not a constructor');
5810
+ throw $TypeError$2(tryToString(argument) + ' is not a constructor');
5727
5811
  };
5728
5812
 
5729
5813
  var anObject$3 = anObject$f;
5730
5814
  var aConstructor = aConstructor$1;
5731
- var isNullOrUndefined$2 = isNullOrUndefined$7;
5732
- var wellKnownSymbol$3 = wellKnownSymbol$k;
5815
+ var isNullOrUndefined$1 = isNullOrUndefined$7;
5816
+ var wellKnownSymbol$2 = wellKnownSymbol$k;
5733
5817
 
5734
- var SPECIES$1 = wellKnownSymbol$3('species');
5818
+ var SPECIES$1 = wellKnownSymbol$2('species');
5735
5819
 
5736
5820
  // `SpeciesConstructor` abstract operation
5737
5821
  // https://tc39.es/ecma262/#sec-speciesconstructor
5738
5822
  var speciesConstructor$1 = function (O, defaultConstructor) {
5739
5823
  var C = anObject$3(O).constructor;
5740
5824
  var S;
5741
- return C === undefined || isNullOrUndefined$2(S = anObject$3(C)[SPECIES$1]) ? defaultConstructor : aConstructor(S);
5825
+ return C === undefined || isNullOrUndefined$1(S = anObject$3(C)[SPECIES$1]) ? defaultConstructor : aConstructor(S);
5742
5826
  };
5743
5827
 
5744
- var uncurryThis$4 = functionUncurryThis;
5828
+ var uncurryThis$3 = functionUncurryThis;
5745
5829
 
5746
- var arraySlice$1 = uncurryThis$4([].slice);
5830
+ var arraySlice$1 = uncurryThis$3([].slice);
5747
5831
 
5748
- var $TypeError$2 = TypeError;
5832
+ var $TypeError$1 = TypeError;
5749
5833
 
5750
5834
  var validateArgumentsLength$1 = function (passed, required) {
5751
- if (passed < required) throw $TypeError$2('Not enough arguments');
5835
+ if (passed < required) throw $TypeError$1('Not enough arguments');
5752
5836
  return passed;
5753
5837
  };
5754
5838
 
@@ -5759,8 +5843,8 @@ var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$2);
5759
5843
  var global$a = global$p;
5760
5844
  var apply = functionApply;
5761
5845
  var bind$2 = functionBindContext;
5762
- var isCallable$5 = isCallable$o;
5763
- var hasOwn$2 = hasOwnProperty_1;
5846
+ var isCallable$4 = isCallable$o;
5847
+ var hasOwn$1 = hasOwnProperty_1;
5764
5848
  var fails$3 = fails$q;
5765
5849
  var html = html$2;
5766
5850
  var arraySlice = arraySlice$1;
@@ -5787,7 +5871,7 @@ try {
5787
5871
  } catch (error) { /* empty */ }
5788
5872
 
5789
5873
  var run = function (id) {
5790
- if (hasOwn$2(queue$1, id)) {
5874
+ if (hasOwn$1(queue$1, id)) {
5791
5875
  var fn = queue$1[id];
5792
5876
  delete queue$1[id];
5793
5877
  fn();
@@ -5813,7 +5897,7 @@ var post = function (id) {
5813
5897
  if (!set || !clear) {
5814
5898
  set = function setImmediate(handler) {
5815
5899
  validateArgumentsLength(arguments.length, 1);
5816
- var fn = isCallable$5(handler) ? handler : Function$1(handler);
5900
+ var fn = isCallable$4(handler) ? handler : Function$1(handler);
5817
5901
  var args = arraySlice(arguments, 1);
5818
5902
  queue$1[++counter] = function () {
5819
5903
  apply(fn, undefined, args);
@@ -5845,7 +5929,7 @@ if (!set || !clear) {
5845
5929
  // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
5846
5930
  } else if (
5847
5931
  global$a.addEventListener &&
5848
- isCallable$5(global$a.postMessage) &&
5932
+ isCallable$4(global$a.postMessage) &&
5849
5933
  !global$a.importScripts &&
5850
5934
  $location && $location.protocol !== 'file:' &&
5851
5935
  !fails$3(post)
@@ -6026,18 +6110,18 @@ var engineIsBrowser = !IS_DENO$1 && !IS_NODE$1
6026
6110
 
6027
6111
  var global$5 = global$p;
6028
6112
  var NativePromiseConstructor$3 = promiseNativeConstructor;
6029
- var isCallable$4 = isCallable$o;
6113
+ var isCallable$3 = isCallable$o;
6030
6114
  var isForced = isForced_1;
6031
6115
  var inspectSource = inspectSource$3;
6032
- var wellKnownSymbol$2 = wellKnownSymbol$k;
6116
+ var wellKnownSymbol$1 = wellKnownSymbol$k;
6033
6117
  var IS_BROWSER = engineIsBrowser;
6034
6118
  var IS_DENO = engineIsDeno;
6035
6119
  var V8_VERSION = engineV8Version;
6036
6120
 
6037
6121
  NativePromiseConstructor$3 && NativePromiseConstructor$3.prototype;
6038
- var SPECIES = wellKnownSymbol$2('species');
6122
+ var SPECIES = wellKnownSymbol$1('species');
6039
6123
  var SUBCLASSING = false;
6040
- var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable$4(global$5.PromiseRejectionEvent);
6124
+ var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable$3(global$5.PromiseRejectionEvent);
6041
6125
 
6042
6126
  var FORCED_PROMISE_CONSTRUCTOR$5 = isForced('Promise', function () {
6043
6127
  var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor$3);
@@ -6073,12 +6157,12 @@ var newPromiseCapability$2 = {};
6073
6157
 
6074
6158
  var aCallable$3 = aCallable$a;
6075
6159
 
6076
- var $TypeError$1 = TypeError;
6160
+ var $TypeError = TypeError;
6077
6161
 
6078
6162
  var PromiseCapability = function (C) {
6079
6163
  var resolve, reject;
6080
6164
  this.promise = new C(function ($$resolve, $$reject) {
6081
- if (resolve !== undefined || reject !== undefined) throw $TypeError$1('Bad Promise constructor');
6165
+ if (resolve !== undefined || reject !== undefined) throw $TypeError('Bad Promise constructor');
6082
6166
  resolve = $$resolve;
6083
6167
  reject = $$reject;
6084
6168
  });
@@ -6092,16 +6176,16 @@ newPromiseCapability$2.f = function (C) {
6092
6176
  return new PromiseCapability(C);
6093
6177
  };
6094
6178
 
6095
- var $$9 = _export;
6179
+ var $$8 = _export;
6096
6180
  var IS_NODE = engineIsNode;
6097
6181
  var global$4 = global$p;
6098
- var call$6 = functionCall;
6182
+ var call$4 = functionCall;
6099
6183
  var defineBuiltIn$2 = defineBuiltIn$7;
6100
6184
  var setPrototypeOf = objectSetPrototypeOf;
6101
6185
  var setToStringTag = setToStringTag$3;
6102
6186
  var setSpecies = setSpecies$1;
6103
6187
  var aCallable$2 = aCallable$a;
6104
- var isCallable$3 = isCallable$o;
6188
+ var isCallable$2 = isCallable$o;
6105
6189
  var isObject$1 = isObject$a;
6106
6190
  var anInstance = anInstance$1;
6107
6191
  var speciesConstructor = speciesConstructor$1;
@@ -6144,7 +6228,7 @@ var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
6144
6228
  // helpers
6145
6229
  var isThenable = function (it) {
6146
6230
  var then;
6147
- return isObject$1(it) && isCallable$3(then = it.then) ? then : false;
6231
+ return isObject$1(it) && isCallable$2(then = it.then) ? then : false;
6148
6232
  };
6149
6233
 
6150
6234
  var callReaction = function (reaction, state) {
@@ -6173,7 +6257,7 @@ var callReaction = function (reaction, state) {
6173
6257
  if (result === reaction.promise) {
6174
6258
  reject(TypeError$1('Promise-chain cycle'));
6175
6259
  } else if (then = isThenable(result)) {
6176
- call$6(then, result, resolve, reject);
6260
+ call$4(then, result, resolve, reject);
6177
6261
  } else resolve(result);
6178
6262
  } else reject(value);
6179
6263
  } catch (error) {
@@ -6210,7 +6294,7 @@ var dispatchEvent = function (name, promise, reason) {
6210
6294
  };
6211
6295
 
6212
6296
  var onUnhandled = function (state) {
6213
- call$6(task, global$4, function () {
6297
+ call$4(task, global$4, function () {
6214
6298
  var promise = state.facade;
6215
6299
  var value = state.value;
6216
6300
  var IS_UNHANDLED = isUnhandled(state);
@@ -6233,7 +6317,7 @@ var isUnhandled = function (state) {
6233
6317
  };
6234
6318
 
6235
6319
  var onHandleUnhandled = function (state) {
6236
- call$6(task, global$4, function () {
6320
+ call$4(task, global$4, function () {
6237
6321
  var promise = state.facade;
6238
6322
  if (IS_NODE) {
6239
6323
  process$1.emit('rejectionHandled', promise);
@@ -6267,7 +6351,7 @@ var internalResolve = function (state, value, unwrap) {
6267
6351
  microtask(function () {
6268
6352
  var wrapper = { done: false };
6269
6353
  try {
6270
- call$6(then, value,
6354
+ call$4(then, value,
6271
6355
  bind(internalResolve, wrapper, state),
6272
6356
  bind(internalReject, wrapper, state)
6273
6357
  );
@@ -6291,7 +6375,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
6291
6375
  PromiseConstructor = function Promise(executor) {
6292
6376
  anInstance(this, PromisePrototype);
6293
6377
  aCallable$2(executor);
6294
- call$6(Internal, this);
6378
+ call$4(Internal, this);
6295
6379
  var state = getInternalPromiseState(this);
6296
6380
  try {
6297
6381
  executor(bind(internalResolve, state), bind(internalReject, state));
@@ -6322,8 +6406,8 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
6322
6406
  var state = getInternalPromiseState(this);
6323
6407
  var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));
6324
6408
  state.parent = true;
6325
- reaction.ok = isCallable$3(onFulfilled) ? onFulfilled : true;
6326
- reaction.fail = isCallable$3(onRejected) && onRejected;
6409
+ reaction.ok = isCallable$2(onFulfilled) ? onFulfilled : true;
6410
+ reaction.fail = isCallable$2(onRejected) && onRejected;
6327
6411
  reaction.domain = IS_NODE ? process$1.domain : undefined;
6328
6412
  if (state.state == PENDING) state.reactions.add(reaction);
6329
6413
  else microtask(function () {
@@ -6346,7 +6430,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
6346
6430
  : newGenericPromiseCapability(C);
6347
6431
  };
6348
6432
 
6349
- if (isCallable$3(NativePromiseConstructor$2) && NativePromisePrototype$1 !== Object.prototype) {
6433
+ if (isCallable$2(NativePromiseConstructor$2) && NativePromisePrototype$1 !== Object.prototype) {
6350
6434
  nativeThen = NativePromisePrototype$1.then;
6351
6435
 
6352
6436
  if (!NATIVE_PROMISE_SUBCLASSING) {
@@ -6354,7 +6438,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
6354
6438
  defineBuiltIn$2(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
6355
6439
  var that = this;
6356
6440
  return new PromiseConstructor(function (resolve, reject) {
6357
- call$6(nativeThen, that, resolve, reject);
6441
+ call$4(nativeThen, that, resolve, reject);
6358
6442
  }).then(onFulfilled, onRejected);
6359
6443
  // https://github.com/zloirock/core-js/issues/640
6360
6444
  }, { unsafe: true });
@@ -6372,16 +6456,16 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
6372
6456
  }
6373
6457
  }
6374
6458
 
6375
- $$9({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
6459
+ $$8({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
6376
6460
  Promise: PromiseConstructor
6377
6461
  });
6378
6462
 
6379
6463
  setToStringTag(PromiseConstructor, PROMISE, false);
6380
6464
  setSpecies(PROMISE);
6381
6465
 
6382
- var wellKnownSymbol$1 = wellKnownSymbol$k;
6466
+ var wellKnownSymbol = wellKnownSymbol$k;
6383
6467
 
6384
- var ITERATOR$2 = wellKnownSymbol$1('iterator');
6468
+ var ITERATOR$2 = wellKnownSymbol('iterator');
6385
6469
  var SAFE_CLOSING = false;
6386
6470
 
6387
6471
  try {
@@ -6426,8 +6510,8 @@ var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCor
6426
6510
  NativePromiseConstructor$1.all(iterable).then(undefined, function () { /* empty */ });
6427
6511
  });
6428
6512
 
6429
- var $$8 = _export;
6430
- var call$5 = functionCall;
6513
+ var $$7 = _export;
6514
+ var call$3 = functionCall;
6431
6515
  var aCallable$1 = aCallable$a;
6432
6516
  var newPromiseCapabilityModule$2 = newPromiseCapability$2;
6433
6517
  var perform$1 = perform$3;
@@ -6436,7 +6520,7 @@ var PROMISE_STATICS_INCORRECT_ITERATION$1 = promiseStaticsIncorrectIteration;
6436
6520
 
6437
6521
  // `Promise.all` method
6438
6522
  // https://tc39.es/ecma262/#sec-promise.all
6439
- $$8({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
6523
+ $$7({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
6440
6524
  all: function all(iterable) {
6441
6525
  var C = this;
6442
6526
  var capability = newPromiseCapabilityModule$2.f(C);
@@ -6451,7 +6535,7 @@ $$8({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
6451
6535
  var index = counter++;
6452
6536
  var alreadyCalled = false;
6453
6537
  remaining++;
6454
- call$5($promiseResolve, C, promise).then(function (value) {
6538
+ call$3($promiseResolve, C, promise).then(function (value) {
6455
6539
  if (alreadyCalled) return;
6456
6540
  alreadyCalled = true;
6457
6541
  values[index] = value;
@@ -6465,33 +6549,33 @@ $$8({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
6465
6549
  }
6466
6550
  });
6467
6551
 
6468
- var $$7 = _export;
6552
+ var $$6 = _export;
6469
6553
  var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
6470
6554
  var NativePromiseConstructor = promiseNativeConstructor;
6471
6555
  var getBuiltIn$1 = getBuiltIn$8;
6472
- var isCallable$2 = isCallable$o;
6556
+ var isCallable$1 = isCallable$o;
6473
6557
  var defineBuiltIn$1 = defineBuiltIn$7;
6474
6558
 
6475
6559
  var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
6476
6560
 
6477
6561
  // `Promise.prototype.catch` method
6478
6562
  // https://tc39.es/ecma262/#sec-promise.prototype.catch
6479
- $$7({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
6563
+ $$6({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
6480
6564
  'catch': function (onRejected) {
6481
6565
  return this.then(undefined, onRejected);
6482
6566
  }
6483
6567
  });
6484
6568
 
6485
6569
  // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
6486
- if (isCallable$2(NativePromiseConstructor)) {
6570
+ if (isCallable$1(NativePromiseConstructor)) {
6487
6571
  var method = getBuiltIn$1('Promise').prototype['catch'];
6488
6572
  if (NativePromisePrototype['catch'] !== method) {
6489
6573
  defineBuiltIn$1(NativePromisePrototype, 'catch', method, { unsafe: true });
6490
6574
  }
6491
6575
  }
6492
6576
 
6493
- var $$6 = _export;
6494
- var call$4 = functionCall;
6577
+ var $$5 = _export;
6578
+ var call$2 = functionCall;
6495
6579
  var aCallable = aCallable$a;
6496
6580
  var newPromiseCapabilityModule$1 = newPromiseCapability$2;
6497
6581
  var perform = perform$3;
@@ -6500,7 +6584,7 @@ var PROMISE_STATICS_INCORRECT_ITERATION = promiseStaticsIncorrectIteration;
6500
6584
 
6501
6585
  // `Promise.race` method
6502
6586
  // https://tc39.es/ecma262/#sec-promise.race
6503
- $$6({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
6587
+ $$5({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
6504
6588
  race: function race(iterable) {
6505
6589
  var C = this;
6506
6590
  var capability = newPromiseCapabilityModule$1.f(C);
@@ -6508,7 +6592,7 @@ $$6({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
6508
6592
  var result = perform(function () {
6509
6593
  var $promiseResolve = aCallable(C.resolve);
6510
6594
  iterate(iterable, function (promise) {
6511
- call$4($promiseResolve, C, promise).then(capability.resolve, reject);
6595
+ call$2($promiseResolve, C, promise).then(capability.resolve, reject);
6512
6596
  });
6513
6597
  });
6514
6598
  if (result.error) reject(result.value);
@@ -6516,17 +6600,17 @@ $$6({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
6516
6600
  }
6517
6601
  });
6518
6602
 
6519
- var $$5 = _export;
6520
- var call$3 = functionCall;
6603
+ var $$4 = _export;
6604
+ var call$1 = functionCall;
6521
6605
  var newPromiseCapabilityModule = newPromiseCapability$2;
6522
6606
  var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
6523
6607
 
6524
6608
  // `Promise.reject` method
6525
6609
  // https://tc39.es/ecma262/#sec-promise.reject
6526
- $$5({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
6610
+ $$4({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
6527
6611
  reject: function reject(r) {
6528
6612
  var capability = newPromiseCapabilityModule.f(this);
6529
- call$3(capability.reject, undefined, r);
6613
+ call$1(capability.reject, undefined, r);
6530
6614
  return capability.promise;
6531
6615
  }
6532
6616
  });
@@ -6544,7 +6628,7 @@ var promiseResolve$1 = function (C, x) {
6544
6628
  return promiseCapability.promise;
6545
6629
  };
6546
6630
 
6547
- var $$4 = _export;
6631
+ var $$3 = _export;
6548
6632
  var getBuiltIn = getBuiltIn$8;
6549
6633
  var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR;
6550
6634
  var promiseResolve = promiseResolve$1;
@@ -6553,7 +6637,7 @@ getBuiltIn('Promise');
6553
6637
 
6554
6638
  // `Promise.resolve` method
6555
6639
  // https://tc39.es/ecma262/#sec-promise.resolve
6556
- $$4({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
6640
+ $$3({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
6557
6641
  resolve: function resolve(x) {
6558
6642
  return promiseResolve(this, x);
6559
6643
  }
@@ -8175,87 +8259,6 @@ const CreditCardInput = fieldProps => jsxRuntime.jsx(CreditCardInputController,
8175
8259
  }
8176
8260
  }));
8177
8261
 
8178
- var call$2 = functionCall;
8179
- var hasOwn$1 = hasOwnProperty_1;
8180
- var isPrototypeOf$1 = objectIsPrototypeOf;
8181
- var regExpFlags = regexpFlags$1;
8182
-
8183
- var RegExpPrototype$1 = RegExp.prototype;
8184
-
8185
- var regexpGetFlags = function (R) {
8186
- var flags = R.flags;
8187
- return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn$1(R, 'flags') && isPrototypeOf$1(RegExpPrototype$1, R)
8188
- ? call$2(regExpFlags, R) : flags;
8189
- };
8190
-
8191
- var $$3 = _export;
8192
- var call$1 = functionCall;
8193
- var uncurryThis$3 = functionUncurryThis;
8194
- var requireObjectCoercible$1 = requireObjectCoercible$9;
8195
- var isCallable$1 = isCallable$o;
8196
- var isNullOrUndefined$1 = isNullOrUndefined$7;
8197
- var isRegExp = isRegexp;
8198
- var toString$4 = toString$c;
8199
- var getMethod$1 = getMethod$6;
8200
- var getRegExpFlags$1 = regexpGetFlags;
8201
- var getSubstitution = getSubstitution$2;
8202
- var wellKnownSymbol = wellKnownSymbol$k;
8203
-
8204
- var REPLACE = wellKnownSymbol('replace');
8205
- var $TypeError = TypeError;
8206
- var indexOf = uncurryThis$3(''.indexOf);
8207
- uncurryThis$3(''.replace);
8208
- var stringSlice$1 = uncurryThis$3(''.slice);
8209
- var max = Math.max;
8210
-
8211
- var stringIndexOf = function (string, searchValue, fromIndex) {
8212
- if (fromIndex > string.length) return -1;
8213
- if (searchValue === '') return fromIndex;
8214
- return indexOf(string, searchValue, fromIndex);
8215
- };
8216
-
8217
- // `String.prototype.replaceAll` method
8218
- // https://tc39.es/ecma262/#sec-string.prototype.replaceall
8219
- $$3({ target: 'String', proto: true }, {
8220
- replaceAll: function replaceAll(searchValue, replaceValue) {
8221
- var O = requireObjectCoercible$1(this);
8222
- var IS_REG_EXP, flags, replacer, string, searchString, functionalReplace, searchLength, advanceBy, replacement;
8223
- var position = 0;
8224
- var endOfLastMatch = 0;
8225
- var result = '';
8226
- if (!isNullOrUndefined$1(searchValue)) {
8227
- IS_REG_EXP = isRegExp(searchValue);
8228
- if (IS_REG_EXP) {
8229
- flags = toString$4(requireObjectCoercible$1(getRegExpFlags$1(searchValue)));
8230
- if (!~indexOf(flags, 'g')) throw $TypeError('`.replaceAll` does not allow non-global regexes');
8231
- }
8232
- replacer = getMethod$1(searchValue, REPLACE);
8233
- if (replacer) {
8234
- return call$1(replacer, searchValue, O, replaceValue);
8235
- }
8236
- }
8237
- string = toString$4(O);
8238
- searchString = toString$4(searchValue);
8239
- functionalReplace = isCallable$1(replaceValue);
8240
- if (!functionalReplace) replaceValue = toString$4(replaceValue);
8241
- searchLength = searchString.length;
8242
- advanceBy = max(1, searchLength);
8243
- position = stringIndexOf(string, searchString, 0);
8244
- while (position !== -1) {
8245
- replacement = functionalReplace
8246
- ? toString$4(replaceValue(searchString, position, string))
8247
- : getSubstitution(searchString, string, position, [], undefined, replaceValue);
8248
- result += stringSlice$1(string, endOfLastMatch, position) + replacement;
8249
- endOfLastMatch = position + searchLength;
8250
- position = stringIndexOf(string, searchString, position + advanceBy);
8251
- }
8252
- if (endOfLastMatch < string.length) {
8253
- result += stringSlice$1(string, endOfLastMatch);
8254
- }
8255
- return result;
8256
- }
8257
- });
8258
-
8259
8262
  // TODO: Quick Fix for White Label; The navigator object cannot be accessed from within SSR,
8260
8263
  // so this provides default value until this feature can be refactored to support SSR.
8261
8264
  let _LOCALE = "en-US";
@@ -17919,16 +17922,17 @@ const useRatesForm = ({
17919
17922
  let errors = [...(ratesErrors !== null && ratesErrors !== void 0 ? ratesErrors : []), ...((_a = ratesResponse === null || ratesResponse === void 0 ? void 0 : ratesResponse.errors) !== null && _a !== void 0 ? _a : [])];
17920
17923
  if (beforeCreateError) errors = [...errors, beforeCreateError];
17921
17924
  // Sometimes no rates are returned and no top-level errors are returned
17922
- // but there are invalid rates with errors. This will expose those to the user
17925
+ // but there are invalid rates with errors. This will filter out duplicate error messages and expose those to the user
17923
17926
  // so the rate list isn't empty after calculating rates.
17924
17927
  if (!errors.length) {
17925
- errors = (_b = ratesResponse === null || ratesResponse === void 0 ? void 0 : ratesResponse.invalidRates.flatMap(r => r.errorMessages.map(m => ({
17928
+ const uniqueMessages = new Set(ratesResponse === null || ratesResponse === void 0 ? void 0 : ratesResponse.invalidRates.flatMap(r => r.errorMessages));
17929
+ errors = (_b = [...uniqueMessages].map(m => ({
17926
17930
  errorCode: "unknown",
17927
17931
  errorSource: "shipengine",
17928
17932
  errorType: "unknown",
17929
17933
  message: m,
17930
17934
  name: "CodedError"
17931
- })))) !== null && _b !== void 0 ? _b : [];
17935
+ }))) !== null && _b !== void 0 ? _b : [];
17932
17936
  }
17933
17937
  const displayableRateErrors = useScrubErrors({
17934
17938
  errors: errors,
@@ -17937,7 +17941,7 @@ const useRatesForm = ({
17937
17941
  });
17938
17942
  const displayableLabelErrors = useScrubErrors({
17939
17943
  errors: labelErrors !== null && labelErrors !== void 0 ? labelErrors : undefined,
17940
- scrubber: React.useCallback(e => e.message.replace(/Exception with code [\w\d]+; module [\d]+, category [\d]+, item [\d]+/g, ""), [])
17944
+ scrubber: React.useCallback(e => e.message.replace(/Exception with code \w+; module \d+, category \d+, item \d+/g, ""), [])
17941
17945
  });
17942
17946
  return {
17943
17947
  carriers,
package/index.js CHANGED
@@ -5401,6 +5401,87 @@ const useBlackboxDetection = ({
5401
5401
  }, [onSuccess, onError]);
5402
5402
  };
5403
5403
 
5404
+ var call$6 = functionCall;
5405
+ var hasOwn$2 = hasOwnProperty_1;
5406
+ var isPrototypeOf$2 = objectIsPrototypeOf;
5407
+ var regExpFlags = regexpFlags$1;
5408
+
5409
+ var RegExpPrototype$1 = RegExp.prototype;
5410
+
5411
+ var regexpGetFlags = function (R) {
5412
+ var flags = R.flags;
5413
+ return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn$2(R, 'flags') && isPrototypeOf$2(RegExpPrototype$1, R)
5414
+ ? call$6(regExpFlags, R) : flags;
5415
+ };
5416
+
5417
+ var $$9 = _export;
5418
+ var call$5 = functionCall;
5419
+ var uncurryThis$4 = functionUncurryThis;
5420
+ var requireObjectCoercible$1 = requireObjectCoercible$9;
5421
+ var isCallable$5 = isCallable$o;
5422
+ var isNullOrUndefined$2 = isNullOrUndefined$7;
5423
+ var isRegExp = isRegexp;
5424
+ var toString$4 = toString$c;
5425
+ var getMethod$1 = getMethod$6;
5426
+ var getRegExpFlags$1 = regexpGetFlags;
5427
+ var getSubstitution = getSubstitution$2;
5428
+ var wellKnownSymbol$4 = wellKnownSymbol$k;
5429
+
5430
+ var REPLACE = wellKnownSymbol$4('replace');
5431
+ var $TypeError$4 = TypeError;
5432
+ var indexOf = uncurryThis$4(''.indexOf);
5433
+ uncurryThis$4(''.replace);
5434
+ var stringSlice$1 = uncurryThis$4(''.slice);
5435
+ var max = Math.max;
5436
+
5437
+ var stringIndexOf = function (string, searchValue, fromIndex) {
5438
+ if (fromIndex > string.length) return -1;
5439
+ if (searchValue === '') return fromIndex;
5440
+ return indexOf(string, searchValue, fromIndex);
5441
+ };
5442
+
5443
+ // `String.prototype.replaceAll` method
5444
+ // https://tc39.es/ecma262/#sec-string.prototype.replaceall
5445
+ $$9({ target: 'String', proto: true }, {
5446
+ replaceAll: function replaceAll(searchValue, replaceValue) {
5447
+ var O = requireObjectCoercible$1(this);
5448
+ var IS_REG_EXP, flags, replacer, string, searchString, functionalReplace, searchLength, advanceBy, replacement;
5449
+ var position = 0;
5450
+ var endOfLastMatch = 0;
5451
+ var result = '';
5452
+ if (!isNullOrUndefined$2(searchValue)) {
5453
+ IS_REG_EXP = isRegExp(searchValue);
5454
+ if (IS_REG_EXP) {
5455
+ flags = toString$4(requireObjectCoercible$1(getRegExpFlags$1(searchValue)));
5456
+ if (!~indexOf(flags, 'g')) throw $TypeError$4('`.replaceAll` does not allow non-global regexes');
5457
+ }
5458
+ replacer = getMethod$1(searchValue, REPLACE);
5459
+ if (replacer) {
5460
+ return call$5(replacer, searchValue, O, replaceValue);
5461
+ }
5462
+ }
5463
+ string = toString$4(O);
5464
+ searchString = toString$4(searchValue);
5465
+ functionalReplace = isCallable$5(replaceValue);
5466
+ if (!functionalReplace) replaceValue = toString$4(replaceValue);
5467
+ searchLength = searchString.length;
5468
+ advanceBy = max(1, searchLength);
5469
+ position = stringIndexOf(string, searchString, 0);
5470
+ while (position !== -1) {
5471
+ replacement = functionalReplace
5472
+ ? toString$4(replaceValue(searchString, position, string))
5473
+ : getSubstitution(searchString, string, position, [], undefined, replaceValue);
5474
+ result += stringSlice$1(string, endOfLastMatch, position) + replacement;
5475
+ endOfLastMatch = position + searchLength;
5476
+ position = stringIndexOf(string, searchString, position + advanceBy);
5477
+ }
5478
+ if (endOfLastMatch < string.length) {
5479
+ result += stringSlice$1(string, endOfLastMatch);
5480
+ }
5481
+ return result;
5482
+ }
5483
+ });
5484
+
5404
5485
  /**
5405
5486
  * @internal
5406
5487
  *
@@ -5420,10 +5501,13 @@ const useScrubErrors = ({
5420
5501
  } = useTranslation();
5421
5502
  return useMemo(() => errors === null || errors === void 0 ? void 0 : errors.map(e => {
5422
5503
  return t(encode(e.message), {
5423
- defaultValue: !predicate || predicate(e) ? t(scrubber(e)) : e.message
5504
+ defaultValue: !predicate || predicate(e) ? t(scrubber(e)) : networkErrorPrettyPrinter(e)
5424
5505
  });
5425
5506
  }), [errors, predicate, scrubber, t]);
5426
5507
  };
5508
+ const networkErrorPrettyPrinter = e => {
5509
+ return e.message.replaceAll(/Invalid rate\. Invalid rate\./g, "Invalid rate.");
5510
+ };
5427
5511
 
5428
5512
  const useListConnectedCarriers = () => {
5429
5513
  const {
@@ -5657,10 +5741,10 @@ const Label$1 = ({
5657
5741
 
5658
5742
  var getBuiltIn$2 = getBuiltIn$8;
5659
5743
  var definePropertyModule = objectDefineProperty;
5660
- var wellKnownSymbol$4 = wellKnownSymbol$k;
5744
+ var wellKnownSymbol$3 = wellKnownSymbol$k;
5661
5745
  var DESCRIPTORS$1 = descriptors;
5662
5746
 
5663
- var SPECIES$2 = wellKnownSymbol$4('species');
5747
+ var SPECIES$2 = wellKnownSymbol$3('species');
5664
5748
 
5665
5749
  var setSpecies$1 = function (CONSTRUCTOR_NAME) {
5666
5750
  var Constructor = getBuiltIn$2(CONSTRUCTOR_NAME);
@@ -5674,49 +5758,49 @@ var setSpecies$1 = function (CONSTRUCTOR_NAME) {
5674
5758
  }
5675
5759
  };
5676
5760
 
5677
- var isPrototypeOf$2 = objectIsPrototypeOf;
5761
+ var isPrototypeOf$1 = objectIsPrototypeOf;
5678
5762
 
5679
- var $TypeError$4 = TypeError;
5763
+ var $TypeError$3 = TypeError;
5680
5764
 
5681
5765
  var anInstance$1 = function (it, Prototype) {
5682
- if (isPrototypeOf$2(Prototype, it)) return it;
5683
- throw $TypeError$4('Incorrect invocation');
5766
+ if (isPrototypeOf$1(Prototype, it)) return it;
5767
+ throw $TypeError$3('Incorrect invocation');
5684
5768
  };
5685
5769
 
5686
5770
  var isConstructor = isConstructor$2;
5687
5771
  var tryToString = tryToString$5;
5688
5772
 
5689
- var $TypeError$3 = TypeError;
5773
+ var $TypeError$2 = TypeError;
5690
5774
 
5691
5775
  // `Assert: IsConstructor(argument) is true`
5692
5776
  var aConstructor$1 = function (argument) {
5693
5777
  if (isConstructor(argument)) return argument;
5694
- throw $TypeError$3(tryToString(argument) + ' is not a constructor');
5778
+ throw $TypeError$2(tryToString(argument) + ' is not a constructor');
5695
5779
  };
5696
5780
 
5697
5781
  var anObject$3 = anObject$f;
5698
5782
  var aConstructor = aConstructor$1;
5699
- var isNullOrUndefined$2 = isNullOrUndefined$7;
5700
- var wellKnownSymbol$3 = wellKnownSymbol$k;
5783
+ var isNullOrUndefined$1 = isNullOrUndefined$7;
5784
+ var wellKnownSymbol$2 = wellKnownSymbol$k;
5701
5785
 
5702
- var SPECIES$1 = wellKnownSymbol$3('species');
5786
+ var SPECIES$1 = wellKnownSymbol$2('species');
5703
5787
 
5704
5788
  // `SpeciesConstructor` abstract operation
5705
5789
  // https://tc39.es/ecma262/#sec-speciesconstructor
5706
5790
  var speciesConstructor$1 = function (O, defaultConstructor) {
5707
5791
  var C = anObject$3(O).constructor;
5708
5792
  var S;
5709
- return C === undefined || isNullOrUndefined$2(S = anObject$3(C)[SPECIES$1]) ? defaultConstructor : aConstructor(S);
5793
+ return C === undefined || isNullOrUndefined$1(S = anObject$3(C)[SPECIES$1]) ? defaultConstructor : aConstructor(S);
5710
5794
  };
5711
5795
 
5712
- var uncurryThis$4 = functionUncurryThis;
5796
+ var uncurryThis$3 = functionUncurryThis;
5713
5797
 
5714
- var arraySlice$1 = uncurryThis$4([].slice);
5798
+ var arraySlice$1 = uncurryThis$3([].slice);
5715
5799
 
5716
- var $TypeError$2 = TypeError;
5800
+ var $TypeError$1 = TypeError;
5717
5801
 
5718
5802
  var validateArgumentsLength$1 = function (passed, required) {
5719
- if (passed < required) throw $TypeError$2('Not enough arguments');
5803
+ if (passed < required) throw $TypeError$1('Not enough arguments');
5720
5804
  return passed;
5721
5805
  };
5722
5806
 
@@ -5727,8 +5811,8 @@ var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$2);
5727
5811
  var global$a = global$p;
5728
5812
  var apply = functionApply;
5729
5813
  var bind$2 = functionBindContext;
5730
- var isCallable$5 = isCallable$o;
5731
- var hasOwn$2 = hasOwnProperty_1;
5814
+ var isCallable$4 = isCallable$o;
5815
+ var hasOwn$1 = hasOwnProperty_1;
5732
5816
  var fails$3 = fails$q;
5733
5817
  var html = html$2;
5734
5818
  var arraySlice = arraySlice$1;
@@ -5755,7 +5839,7 @@ try {
5755
5839
  } catch (error) { /* empty */ }
5756
5840
 
5757
5841
  var run = function (id) {
5758
- if (hasOwn$2(queue$1, id)) {
5842
+ if (hasOwn$1(queue$1, id)) {
5759
5843
  var fn = queue$1[id];
5760
5844
  delete queue$1[id];
5761
5845
  fn();
@@ -5781,7 +5865,7 @@ var post = function (id) {
5781
5865
  if (!set || !clear) {
5782
5866
  set = function setImmediate(handler) {
5783
5867
  validateArgumentsLength(arguments.length, 1);
5784
- var fn = isCallable$5(handler) ? handler : Function$1(handler);
5868
+ var fn = isCallable$4(handler) ? handler : Function$1(handler);
5785
5869
  var args = arraySlice(arguments, 1);
5786
5870
  queue$1[++counter] = function () {
5787
5871
  apply(fn, undefined, args);
@@ -5813,7 +5897,7 @@ if (!set || !clear) {
5813
5897
  // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
5814
5898
  } else if (
5815
5899
  global$a.addEventListener &&
5816
- isCallable$5(global$a.postMessage) &&
5900
+ isCallable$4(global$a.postMessage) &&
5817
5901
  !global$a.importScripts &&
5818
5902
  $location && $location.protocol !== 'file:' &&
5819
5903
  !fails$3(post)
@@ -5994,18 +6078,18 @@ var engineIsBrowser = !IS_DENO$1 && !IS_NODE$1
5994
6078
 
5995
6079
  var global$5 = global$p;
5996
6080
  var NativePromiseConstructor$3 = promiseNativeConstructor;
5997
- var isCallable$4 = isCallable$o;
6081
+ var isCallable$3 = isCallable$o;
5998
6082
  var isForced = isForced_1;
5999
6083
  var inspectSource = inspectSource$3;
6000
- var wellKnownSymbol$2 = wellKnownSymbol$k;
6084
+ var wellKnownSymbol$1 = wellKnownSymbol$k;
6001
6085
  var IS_BROWSER = engineIsBrowser;
6002
6086
  var IS_DENO = engineIsDeno;
6003
6087
  var V8_VERSION = engineV8Version;
6004
6088
 
6005
6089
  NativePromiseConstructor$3 && NativePromiseConstructor$3.prototype;
6006
- var SPECIES = wellKnownSymbol$2('species');
6090
+ var SPECIES = wellKnownSymbol$1('species');
6007
6091
  var SUBCLASSING = false;
6008
- var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable$4(global$5.PromiseRejectionEvent);
6092
+ var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable$3(global$5.PromiseRejectionEvent);
6009
6093
 
6010
6094
  var FORCED_PROMISE_CONSTRUCTOR$5 = isForced('Promise', function () {
6011
6095
  var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor$3);
@@ -6041,12 +6125,12 @@ var newPromiseCapability$2 = {};
6041
6125
 
6042
6126
  var aCallable$3 = aCallable$a;
6043
6127
 
6044
- var $TypeError$1 = TypeError;
6128
+ var $TypeError = TypeError;
6045
6129
 
6046
6130
  var PromiseCapability = function (C) {
6047
6131
  var resolve, reject;
6048
6132
  this.promise = new C(function ($$resolve, $$reject) {
6049
- if (resolve !== undefined || reject !== undefined) throw $TypeError$1('Bad Promise constructor');
6133
+ if (resolve !== undefined || reject !== undefined) throw $TypeError('Bad Promise constructor');
6050
6134
  resolve = $$resolve;
6051
6135
  reject = $$reject;
6052
6136
  });
@@ -6060,16 +6144,16 @@ newPromiseCapability$2.f = function (C) {
6060
6144
  return new PromiseCapability(C);
6061
6145
  };
6062
6146
 
6063
- var $$9 = _export;
6147
+ var $$8 = _export;
6064
6148
  var IS_NODE = engineIsNode;
6065
6149
  var global$4 = global$p;
6066
- var call$6 = functionCall;
6150
+ var call$4 = functionCall;
6067
6151
  var defineBuiltIn$2 = defineBuiltIn$7;
6068
6152
  var setPrototypeOf = objectSetPrototypeOf;
6069
6153
  var setToStringTag = setToStringTag$3;
6070
6154
  var setSpecies = setSpecies$1;
6071
6155
  var aCallable$2 = aCallable$a;
6072
- var isCallable$3 = isCallable$o;
6156
+ var isCallable$2 = isCallable$o;
6073
6157
  var isObject$1 = isObject$a;
6074
6158
  var anInstance = anInstance$1;
6075
6159
  var speciesConstructor = speciesConstructor$1;
@@ -6112,7 +6196,7 @@ var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
6112
6196
  // helpers
6113
6197
  var isThenable = function (it) {
6114
6198
  var then;
6115
- return isObject$1(it) && isCallable$3(then = it.then) ? then : false;
6199
+ return isObject$1(it) && isCallable$2(then = it.then) ? then : false;
6116
6200
  };
6117
6201
 
6118
6202
  var callReaction = function (reaction, state) {
@@ -6141,7 +6225,7 @@ var callReaction = function (reaction, state) {
6141
6225
  if (result === reaction.promise) {
6142
6226
  reject(TypeError$1('Promise-chain cycle'));
6143
6227
  } else if (then = isThenable(result)) {
6144
- call$6(then, result, resolve, reject);
6228
+ call$4(then, result, resolve, reject);
6145
6229
  } else resolve(result);
6146
6230
  } else reject(value);
6147
6231
  } catch (error) {
@@ -6178,7 +6262,7 @@ var dispatchEvent = function (name, promise, reason) {
6178
6262
  };
6179
6263
 
6180
6264
  var onUnhandled = function (state) {
6181
- call$6(task, global$4, function () {
6265
+ call$4(task, global$4, function () {
6182
6266
  var promise = state.facade;
6183
6267
  var value = state.value;
6184
6268
  var IS_UNHANDLED = isUnhandled(state);
@@ -6201,7 +6285,7 @@ var isUnhandled = function (state) {
6201
6285
  };
6202
6286
 
6203
6287
  var onHandleUnhandled = function (state) {
6204
- call$6(task, global$4, function () {
6288
+ call$4(task, global$4, function () {
6205
6289
  var promise = state.facade;
6206
6290
  if (IS_NODE) {
6207
6291
  process$1.emit('rejectionHandled', promise);
@@ -6235,7 +6319,7 @@ var internalResolve = function (state, value, unwrap) {
6235
6319
  microtask(function () {
6236
6320
  var wrapper = { done: false };
6237
6321
  try {
6238
- call$6(then, value,
6322
+ call$4(then, value,
6239
6323
  bind(internalResolve, wrapper, state),
6240
6324
  bind(internalReject, wrapper, state)
6241
6325
  );
@@ -6259,7 +6343,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
6259
6343
  PromiseConstructor = function Promise(executor) {
6260
6344
  anInstance(this, PromisePrototype);
6261
6345
  aCallable$2(executor);
6262
- call$6(Internal, this);
6346
+ call$4(Internal, this);
6263
6347
  var state = getInternalPromiseState(this);
6264
6348
  try {
6265
6349
  executor(bind(internalResolve, state), bind(internalReject, state));
@@ -6290,8 +6374,8 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
6290
6374
  var state = getInternalPromiseState(this);
6291
6375
  var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));
6292
6376
  state.parent = true;
6293
- reaction.ok = isCallable$3(onFulfilled) ? onFulfilled : true;
6294
- reaction.fail = isCallable$3(onRejected) && onRejected;
6377
+ reaction.ok = isCallable$2(onFulfilled) ? onFulfilled : true;
6378
+ reaction.fail = isCallable$2(onRejected) && onRejected;
6295
6379
  reaction.domain = IS_NODE ? process$1.domain : undefined;
6296
6380
  if (state.state == PENDING) state.reactions.add(reaction);
6297
6381
  else microtask(function () {
@@ -6314,7 +6398,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
6314
6398
  : newGenericPromiseCapability(C);
6315
6399
  };
6316
6400
 
6317
- if (isCallable$3(NativePromiseConstructor$2) && NativePromisePrototype$1 !== Object.prototype) {
6401
+ if (isCallable$2(NativePromiseConstructor$2) && NativePromisePrototype$1 !== Object.prototype) {
6318
6402
  nativeThen = NativePromisePrototype$1.then;
6319
6403
 
6320
6404
  if (!NATIVE_PROMISE_SUBCLASSING) {
@@ -6322,7 +6406,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
6322
6406
  defineBuiltIn$2(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
6323
6407
  var that = this;
6324
6408
  return new PromiseConstructor(function (resolve, reject) {
6325
- call$6(nativeThen, that, resolve, reject);
6409
+ call$4(nativeThen, that, resolve, reject);
6326
6410
  }).then(onFulfilled, onRejected);
6327
6411
  // https://github.com/zloirock/core-js/issues/640
6328
6412
  }, { unsafe: true });
@@ -6340,16 +6424,16 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
6340
6424
  }
6341
6425
  }
6342
6426
 
6343
- $$9({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
6427
+ $$8({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
6344
6428
  Promise: PromiseConstructor
6345
6429
  });
6346
6430
 
6347
6431
  setToStringTag(PromiseConstructor, PROMISE, false);
6348
6432
  setSpecies(PROMISE);
6349
6433
 
6350
- var wellKnownSymbol$1 = wellKnownSymbol$k;
6434
+ var wellKnownSymbol = wellKnownSymbol$k;
6351
6435
 
6352
- var ITERATOR$2 = wellKnownSymbol$1('iterator');
6436
+ var ITERATOR$2 = wellKnownSymbol('iterator');
6353
6437
  var SAFE_CLOSING = false;
6354
6438
 
6355
6439
  try {
@@ -6394,8 +6478,8 @@ var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCor
6394
6478
  NativePromiseConstructor$1.all(iterable).then(undefined, function () { /* empty */ });
6395
6479
  });
6396
6480
 
6397
- var $$8 = _export;
6398
- var call$5 = functionCall;
6481
+ var $$7 = _export;
6482
+ var call$3 = functionCall;
6399
6483
  var aCallable$1 = aCallable$a;
6400
6484
  var newPromiseCapabilityModule$2 = newPromiseCapability$2;
6401
6485
  var perform$1 = perform$3;
@@ -6404,7 +6488,7 @@ var PROMISE_STATICS_INCORRECT_ITERATION$1 = promiseStaticsIncorrectIteration;
6404
6488
 
6405
6489
  // `Promise.all` method
6406
6490
  // https://tc39.es/ecma262/#sec-promise.all
6407
- $$8({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
6491
+ $$7({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
6408
6492
  all: function all(iterable) {
6409
6493
  var C = this;
6410
6494
  var capability = newPromiseCapabilityModule$2.f(C);
@@ -6419,7 +6503,7 @@ $$8({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
6419
6503
  var index = counter++;
6420
6504
  var alreadyCalled = false;
6421
6505
  remaining++;
6422
- call$5($promiseResolve, C, promise).then(function (value) {
6506
+ call$3($promiseResolve, C, promise).then(function (value) {
6423
6507
  if (alreadyCalled) return;
6424
6508
  alreadyCalled = true;
6425
6509
  values[index] = value;
@@ -6433,33 +6517,33 @@ $$8({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
6433
6517
  }
6434
6518
  });
6435
6519
 
6436
- var $$7 = _export;
6520
+ var $$6 = _export;
6437
6521
  var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
6438
6522
  var NativePromiseConstructor = promiseNativeConstructor;
6439
6523
  var getBuiltIn$1 = getBuiltIn$8;
6440
- var isCallable$2 = isCallable$o;
6524
+ var isCallable$1 = isCallable$o;
6441
6525
  var defineBuiltIn$1 = defineBuiltIn$7;
6442
6526
 
6443
6527
  var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
6444
6528
 
6445
6529
  // `Promise.prototype.catch` method
6446
6530
  // https://tc39.es/ecma262/#sec-promise.prototype.catch
6447
- $$7({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
6531
+ $$6({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
6448
6532
  'catch': function (onRejected) {
6449
6533
  return this.then(undefined, onRejected);
6450
6534
  }
6451
6535
  });
6452
6536
 
6453
6537
  // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
6454
- if (isCallable$2(NativePromiseConstructor)) {
6538
+ if (isCallable$1(NativePromiseConstructor)) {
6455
6539
  var method = getBuiltIn$1('Promise').prototype['catch'];
6456
6540
  if (NativePromisePrototype['catch'] !== method) {
6457
6541
  defineBuiltIn$1(NativePromisePrototype, 'catch', method, { unsafe: true });
6458
6542
  }
6459
6543
  }
6460
6544
 
6461
- var $$6 = _export;
6462
- var call$4 = functionCall;
6545
+ var $$5 = _export;
6546
+ var call$2 = functionCall;
6463
6547
  var aCallable = aCallable$a;
6464
6548
  var newPromiseCapabilityModule$1 = newPromiseCapability$2;
6465
6549
  var perform = perform$3;
@@ -6468,7 +6552,7 @@ var PROMISE_STATICS_INCORRECT_ITERATION = promiseStaticsIncorrectIteration;
6468
6552
 
6469
6553
  // `Promise.race` method
6470
6554
  // https://tc39.es/ecma262/#sec-promise.race
6471
- $$6({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
6555
+ $$5({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
6472
6556
  race: function race(iterable) {
6473
6557
  var C = this;
6474
6558
  var capability = newPromiseCapabilityModule$1.f(C);
@@ -6476,7 +6560,7 @@ $$6({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
6476
6560
  var result = perform(function () {
6477
6561
  var $promiseResolve = aCallable(C.resolve);
6478
6562
  iterate(iterable, function (promise) {
6479
- call$4($promiseResolve, C, promise).then(capability.resolve, reject);
6563
+ call$2($promiseResolve, C, promise).then(capability.resolve, reject);
6480
6564
  });
6481
6565
  });
6482
6566
  if (result.error) reject(result.value);
@@ -6484,17 +6568,17 @@ $$6({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
6484
6568
  }
6485
6569
  });
6486
6570
 
6487
- var $$5 = _export;
6488
- var call$3 = functionCall;
6571
+ var $$4 = _export;
6572
+ var call$1 = functionCall;
6489
6573
  var newPromiseCapabilityModule = newPromiseCapability$2;
6490
6574
  var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
6491
6575
 
6492
6576
  // `Promise.reject` method
6493
6577
  // https://tc39.es/ecma262/#sec-promise.reject
6494
- $$5({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
6578
+ $$4({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
6495
6579
  reject: function reject(r) {
6496
6580
  var capability = newPromiseCapabilityModule.f(this);
6497
- call$3(capability.reject, undefined, r);
6581
+ call$1(capability.reject, undefined, r);
6498
6582
  return capability.promise;
6499
6583
  }
6500
6584
  });
@@ -6512,7 +6596,7 @@ var promiseResolve$1 = function (C, x) {
6512
6596
  return promiseCapability.promise;
6513
6597
  };
6514
6598
 
6515
- var $$4 = _export;
6599
+ var $$3 = _export;
6516
6600
  var getBuiltIn = getBuiltIn$8;
6517
6601
  var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR;
6518
6602
  var promiseResolve = promiseResolve$1;
@@ -6521,7 +6605,7 @@ getBuiltIn('Promise');
6521
6605
 
6522
6606
  // `Promise.resolve` method
6523
6607
  // https://tc39.es/ecma262/#sec-promise.resolve
6524
- $$4({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
6608
+ $$3({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
6525
6609
  resolve: function resolve(x) {
6526
6610
  return promiseResolve(this, x);
6527
6611
  }
@@ -8143,87 +8227,6 @@ const CreditCardInput = fieldProps => jsx(CreditCardInputController, Object.assi
8143
8227
  }
8144
8228
  }));
8145
8229
 
8146
- var call$2 = functionCall;
8147
- var hasOwn$1 = hasOwnProperty_1;
8148
- var isPrototypeOf$1 = objectIsPrototypeOf;
8149
- var regExpFlags = regexpFlags$1;
8150
-
8151
- var RegExpPrototype$1 = RegExp.prototype;
8152
-
8153
- var regexpGetFlags = function (R) {
8154
- var flags = R.flags;
8155
- return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn$1(R, 'flags') && isPrototypeOf$1(RegExpPrototype$1, R)
8156
- ? call$2(regExpFlags, R) : flags;
8157
- };
8158
-
8159
- var $$3 = _export;
8160
- var call$1 = functionCall;
8161
- var uncurryThis$3 = functionUncurryThis;
8162
- var requireObjectCoercible$1 = requireObjectCoercible$9;
8163
- var isCallable$1 = isCallable$o;
8164
- var isNullOrUndefined$1 = isNullOrUndefined$7;
8165
- var isRegExp = isRegexp;
8166
- var toString$4 = toString$c;
8167
- var getMethod$1 = getMethod$6;
8168
- var getRegExpFlags$1 = regexpGetFlags;
8169
- var getSubstitution = getSubstitution$2;
8170
- var wellKnownSymbol = wellKnownSymbol$k;
8171
-
8172
- var REPLACE = wellKnownSymbol('replace');
8173
- var $TypeError = TypeError;
8174
- var indexOf = uncurryThis$3(''.indexOf);
8175
- uncurryThis$3(''.replace);
8176
- var stringSlice$1 = uncurryThis$3(''.slice);
8177
- var max = Math.max;
8178
-
8179
- var stringIndexOf = function (string, searchValue, fromIndex) {
8180
- if (fromIndex > string.length) return -1;
8181
- if (searchValue === '') return fromIndex;
8182
- return indexOf(string, searchValue, fromIndex);
8183
- };
8184
-
8185
- // `String.prototype.replaceAll` method
8186
- // https://tc39.es/ecma262/#sec-string.prototype.replaceall
8187
- $$3({ target: 'String', proto: true }, {
8188
- replaceAll: function replaceAll(searchValue, replaceValue) {
8189
- var O = requireObjectCoercible$1(this);
8190
- var IS_REG_EXP, flags, replacer, string, searchString, functionalReplace, searchLength, advanceBy, replacement;
8191
- var position = 0;
8192
- var endOfLastMatch = 0;
8193
- var result = '';
8194
- if (!isNullOrUndefined$1(searchValue)) {
8195
- IS_REG_EXP = isRegExp(searchValue);
8196
- if (IS_REG_EXP) {
8197
- flags = toString$4(requireObjectCoercible$1(getRegExpFlags$1(searchValue)));
8198
- if (!~indexOf(flags, 'g')) throw $TypeError('`.replaceAll` does not allow non-global regexes');
8199
- }
8200
- replacer = getMethod$1(searchValue, REPLACE);
8201
- if (replacer) {
8202
- return call$1(replacer, searchValue, O, replaceValue);
8203
- }
8204
- }
8205
- string = toString$4(O);
8206
- searchString = toString$4(searchValue);
8207
- functionalReplace = isCallable$1(replaceValue);
8208
- if (!functionalReplace) replaceValue = toString$4(replaceValue);
8209
- searchLength = searchString.length;
8210
- advanceBy = max(1, searchLength);
8211
- position = stringIndexOf(string, searchString, 0);
8212
- while (position !== -1) {
8213
- replacement = functionalReplace
8214
- ? toString$4(replaceValue(searchString, position, string))
8215
- : getSubstitution(searchString, string, position, [], undefined, replaceValue);
8216
- result += stringSlice$1(string, endOfLastMatch, position) + replacement;
8217
- endOfLastMatch = position + searchLength;
8218
- position = stringIndexOf(string, searchString, position + advanceBy);
8219
- }
8220
- if (endOfLastMatch < string.length) {
8221
- result += stringSlice$1(string, endOfLastMatch);
8222
- }
8223
- return result;
8224
- }
8225
- });
8226
-
8227
8230
  // TODO: Quick Fix for White Label; The navigator object cannot be accessed from within SSR,
8228
8231
  // so this provides default value until this feature can be refactored to support SSR.
8229
8232
  let _LOCALE = "en-US";
@@ -17887,16 +17890,17 @@ const useRatesForm = ({
17887
17890
  let errors = [...(ratesErrors !== null && ratesErrors !== void 0 ? ratesErrors : []), ...((_a = ratesResponse === null || ratesResponse === void 0 ? void 0 : ratesResponse.errors) !== null && _a !== void 0 ? _a : [])];
17888
17891
  if (beforeCreateError) errors = [...errors, beforeCreateError];
17889
17892
  // Sometimes no rates are returned and no top-level errors are returned
17890
- // but there are invalid rates with errors. This will expose those to the user
17893
+ // but there are invalid rates with errors. This will filter out duplicate error messages and expose those to the user
17891
17894
  // so the rate list isn't empty after calculating rates.
17892
17895
  if (!errors.length) {
17893
- errors = (_b = ratesResponse === null || ratesResponse === void 0 ? void 0 : ratesResponse.invalidRates.flatMap(r => r.errorMessages.map(m => ({
17896
+ const uniqueMessages = new Set(ratesResponse === null || ratesResponse === void 0 ? void 0 : ratesResponse.invalidRates.flatMap(r => r.errorMessages));
17897
+ errors = (_b = [...uniqueMessages].map(m => ({
17894
17898
  errorCode: "unknown",
17895
17899
  errorSource: "shipengine",
17896
17900
  errorType: "unknown",
17897
17901
  message: m,
17898
17902
  name: "CodedError"
17899
- })))) !== null && _b !== void 0 ? _b : [];
17903
+ }))) !== null && _b !== void 0 ? _b : [];
17900
17904
  }
17901
17905
  const displayableRateErrors = useScrubErrors({
17902
17906
  errors: errors,
@@ -17905,7 +17909,7 @@ const useRatesForm = ({
17905
17909
  });
17906
17910
  const displayableLabelErrors = useScrubErrors({
17907
17911
  errors: labelErrors !== null && labelErrors !== void 0 ? labelErrors : undefined,
17908
- scrubber: useCallback(e => e.message.replace(/Exception with code [\w\d]+; module [\d]+, category [\d]+, item [\d]+/g, ""), [])
17912
+ scrubber: useCallback(e => e.message.replace(/Exception with code \w+; module \d+, category \d+, item \d+/g, ""), [])
17909
17913
  });
17910
17914
  return {
17911
17915
  carriers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/elements",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "peerDependencies": {
5
5
  "@packlink/giger": "*",
6
6
  "react-i18next": "*",