@shipengine/elements 0.17.3 → 0.19.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.
- package/components/fund-and-purchase/fund-and-purchase.d.ts +3 -1
- package/components/history/history-actions/history-actions.d.ts +1 -0
- package/components/history/history-actions/history-actions.styles.d.ts +1 -0
- package/components/history/history-actions/index.d.ts +1 -0
- package/components/history/history-body/history-body.d.ts +6 -0
- package/components/history/history-body/index.d.ts +1 -0
- package/components/history/history-list/history-list.d.ts +12 -0
- package/components/history/history-list/index.d.ts +1 -0
- package/components/history/history-row/history-row.d.ts +6 -0
- package/components/history/history-row/index.d.ts +1 -0
- package/components/history/history.d.ts +11 -0
- package/components/history/index.d.ts +1 -0
- package/components/templates/index.d.ts +3 -0
- package/components/templates/manage-warehouses/manage-warehouse.styles.d.ts +1 -0
- package/components/templates/manage-warehouses/manage-warehouses.d.ts +10 -5
- package/components/templates/onboarding/onboarding.d.ts +8 -1
- package/components/templates/shipment-form/shipment-schema.d.ts +2 -2
- package/components/templates/wallet-history/index.d.ts +1 -0
- package/components/templates/wallet-history/wallet-history.d.ts +6 -0
- package/components/templates/warehouse-form/warehouse-form-schema.d.ts +52 -146
- package/components/templates/warehouse-form/warehouse-form.d.ts +2 -1
- package/components/templates/warehouse-preference-select/index.d.ts +1 -0
- package/components/templates/warehouse-preference-select/warehouse-preference-select.d.ts +24 -0
- package/components/templates/warehouse-preference-wizard/index.d.ts +1 -0
- package/components/templates/warehouse-preference-wizard/warehouse-preference-wizard.d.ts +23 -0
- package/elements/components/index.d.ts +1 -0
- package/elements/components/manage-warehouses/manage-warehouses.d.ts +5 -2
- package/elements/components/wallet-history/index.d.ts +1 -0
- package/elements/components/wallet-history/wallet-history.d.ts +1 -0
- package/elements/index.d.ts +1 -0
- package/elements/manage-warehouses.d.ts +1 -1
- package/elements/wallet-history.d.ts +1 -0
- package/factories/shipengine/index.d.ts +1 -0
- package/factories/shipengine/wallet-history.d.ts +14 -0
- package/factories/shipengine/warehouse.d.ts +2 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/use-warehouse-validation.d.ts +14 -0
- package/index.cjs +1044 -1250
- package/index.d.ts +0 -2
- package/index.js +1042 -1215
- package/locales/en/index.d.ts +15 -0
- package/package.json +3 -3
- package/components/templates/warehouse-form/warehouse-form.styles.d.ts +0 -1
package/index.cjs
CHANGED
|
@@ -25,9 +25,6 @@ var reactQuery = require('react-query');
|
|
|
25
25
|
var stylis = require('stylis');
|
|
26
26
|
var i18n = require('i18next');
|
|
27
27
|
var languageDetector = require('i18next-browser-languagedetector');
|
|
28
|
-
var faker = require('@faker-js/faker');
|
|
29
|
-
var fishery = require('fishery');
|
|
30
|
-
var react$2 = require('@testing-library/react');
|
|
31
28
|
|
|
32
29
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
33
30
|
|
|
@@ -1129,13 +1126,13 @@ var objectAssign = !$assign || fails$i(function () {
|
|
|
1129
1126
|
} return T;
|
|
1130
1127
|
} : $assign;
|
|
1131
1128
|
|
|
1132
|
-
var $$
|
|
1129
|
+
var $$m = _export;
|
|
1133
1130
|
var assign = objectAssign;
|
|
1134
1131
|
|
|
1135
1132
|
// `Object.assign` method
|
|
1136
1133
|
// https://tc39.es/ecma262/#sec-object.assign
|
|
1137
1134
|
// eslint-disable-next-line es/no-object-assign -- required for testing
|
|
1138
|
-
$$
|
|
1135
|
+
$$m({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
|
|
1139
1136
|
assign: assign
|
|
1140
1137
|
});
|
|
1141
1138
|
|
|
@@ -1234,7 +1231,7 @@ var global$f = global$p;
|
|
|
1234
1231
|
|
|
1235
1232
|
var engineIsNode = classof$7(global$f.process) == 'process';
|
|
1236
1233
|
|
|
1237
|
-
var $$
|
|
1234
|
+
var $$l = _export;
|
|
1238
1235
|
var $reduce = arrayReduce.left;
|
|
1239
1236
|
var arrayMethodIsStrict$1 = arrayMethodIsStrict$2;
|
|
1240
1237
|
var CHROME_VERSION = engineV8Version;
|
|
@@ -1247,7 +1244,7 @@ var CHROME_BUG = !IS_NODE$4 && CHROME_VERSION > 79 && CHROME_VERSION < 83;
|
|
|
1247
1244
|
|
|
1248
1245
|
// `Array.prototype.reduce` method
|
|
1249
1246
|
// https://tc39.es/ecma262/#sec-array.prototype.reduce
|
|
1250
|
-
$$
|
|
1247
|
+
$$l({ target: 'Array', proto: true, forced: !STRICT_METHOD$1 || CHROME_BUG }, {
|
|
1251
1248
|
reduce: function reduce(callbackfn /* , initialValue */) {
|
|
1252
1249
|
var length = arguments.length;
|
|
1253
1250
|
return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
|
|
@@ -1542,7 +1539,7 @@ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? functio
|
|
|
1542
1539
|
};
|
|
1543
1540
|
}() : undefined);
|
|
1544
1541
|
|
|
1545
|
-
var $$
|
|
1542
|
+
var $$k = _export;
|
|
1546
1543
|
var call$d = functionCall;
|
|
1547
1544
|
var FunctionName = functionName;
|
|
1548
1545
|
var isCallable$a = isCallable$o;
|
|
@@ -1627,7 +1624,7 @@ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
|
|
|
1627
1624
|
if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
|
|
1628
1625
|
defineBuiltIn$5(IterablePrototype, KEY, methods[KEY]);
|
|
1629
1626
|
}
|
|
1630
|
-
} else $$
|
|
1627
|
+
} else $$k({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
|
|
1631
1628
|
}
|
|
1632
1629
|
|
|
1633
1630
|
// define iterator
|
|
@@ -1995,13 +1992,13 @@ var stringTrimForced = function (METHOD_NAME) {
|
|
|
1995
1992
|
});
|
|
1996
1993
|
};
|
|
1997
1994
|
|
|
1998
|
-
var $$
|
|
1995
|
+
var $$j = _export;
|
|
1999
1996
|
var $trim = stringTrim.trim;
|
|
2000
1997
|
var forcedStringTrimMethod = stringTrimForced;
|
|
2001
1998
|
|
|
2002
1999
|
// `String.prototype.trim` method
|
|
2003
2000
|
// https://tc39.es/ecma262/#sec-string.prototype.trim
|
|
2004
|
-
$$
|
|
2001
|
+
$$j({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
|
|
2005
2002
|
trim: function trim() {
|
|
2006
2003
|
return $trim(this);
|
|
2007
2004
|
}
|
|
@@ -2196,12 +2193,12 @@ if (PATCH) {
|
|
|
2196
2193
|
|
|
2197
2194
|
var regexpExec$2 = patchedExec;
|
|
2198
2195
|
|
|
2199
|
-
var $$
|
|
2196
|
+
var $$i = _export;
|
|
2200
2197
|
var exec$2 = regexpExec$2;
|
|
2201
2198
|
|
|
2202
2199
|
// `RegExp.prototype.exec` method
|
|
2203
2200
|
// https://tc39.es/ecma262/#sec-regexp.prototype.exec
|
|
2204
|
-
$$
|
|
2201
|
+
$$i({ target: 'RegExp', proto: true, forced: /./.exec !== exec$2 }, {
|
|
2205
2202
|
exec: exec$2
|
|
2206
2203
|
});
|
|
2207
2204
|
|
|
@@ -2815,7 +2812,7 @@ const isPoBox = addressLine => PO_BOX_REGEX.test(addressLine);
|
|
|
2815
2812
|
*/
|
|
2816
2813
|
const isPoBoxAddress = address => !!(isPoBox(address.addressLine1) || address.addressLine2 && isPoBox(address.addressLine2));
|
|
2817
2814
|
|
|
2818
|
-
var $$
|
|
2815
|
+
var $$h = _export;
|
|
2819
2816
|
var $includes = arrayIncludes.includes;
|
|
2820
2817
|
var fails$8 = fails$r;
|
|
2821
2818
|
var addToUnscopables$2 = addToUnscopables$4;
|
|
@@ -2827,7 +2824,7 @@ var BROKEN_ON_SPARSE = fails$8(function () {
|
|
|
2827
2824
|
|
|
2828
2825
|
// `Array.prototype.includes` method
|
|
2829
2826
|
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
2830
|
-
$$
|
|
2827
|
+
$$h({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
|
|
2831
2828
|
includes: function includes(el /* , fromIndex = 0 */) {
|
|
2832
2829
|
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
2833
2830
|
}
|
|
@@ -2912,7 +2909,7 @@ var toPropertyKey = toPropertyKey$3;
|
|
|
2912
2909
|
var definePropertyModule$1 = objectDefineProperty;
|
|
2913
2910
|
var createPropertyDescriptor = createPropertyDescriptor$4;
|
|
2914
2911
|
|
|
2915
|
-
var createProperty$
|
|
2912
|
+
var createProperty$2 = function (object, key, value) {
|
|
2916
2913
|
var propertyKey = toPropertyKey(key);
|
|
2917
2914
|
if (propertyKey in object) definePropertyModule$1.f(object, propertyKey, createPropertyDescriptor(0, value));
|
|
2918
2915
|
else object[propertyKey] = value;
|
|
@@ -2920,7 +2917,7 @@ var createProperty$1 = function (object, key, value) {
|
|
|
2920
2917
|
|
|
2921
2918
|
var toAbsoluteIndex = toAbsoluteIndex$2;
|
|
2922
2919
|
var lengthOfArrayLike$5 = lengthOfArrayLike$8;
|
|
2923
|
-
var createProperty = createProperty$
|
|
2920
|
+
var createProperty$1 = createProperty$2;
|
|
2924
2921
|
|
|
2925
2922
|
var $Array$1 = Array;
|
|
2926
2923
|
var max = Math.max;
|
|
@@ -2930,7 +2927,7 @@ var arraySliceSimple = function (O, start, end) {
|
|
|
2930
2927
|
var k = toAbsoluteIndex(start, length);
|
|
2931
2928
|
var fin = toAbsoluteIndex(end === undefined ? length : end, length);
|
|
2932
2929
|
var result = $Array$1(max(fin - k, 0));
|
|
2933
|
-
for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
|
|
2930
|
+
for (var n = 0; k < fin; k++, n++) createProperty$1(result, n, O[k]);
|
|
2934
2931
|
result.length = n;
|
|
2935
2932
|
return result;
|
|
2936
2933
|
};
|
|
@@ -2996,7 +2993,7 @@ var webkit = userAgent$3.match(/AppleWebKit\/(\d+)\./);
|
|
|
2996
2993
|
|
|
2997
2994
|
var engineWebkitVersion = !!webkit && +webkit[1];
|
|
2998
2995
|
|
|
2999
|
-
var $$
|
|
2996
|
+
var $$g = _export;
|
|
3000
2997
|
var uncurryThis$a = functionUncurryThis;
|
|
3001
2998
|
var aCallable$7 = aCallable$a;
|
|
3002
2999
|
var toObject$2 = toObject$8;
|
|
@@ -3074,7 +3071,7 @@ var getSortCompare = function (comparefn) {
|
|
|
3074
3071
|
|
|
3075
3072
|
// `Array.prototype.sort` method
|
|
3076
3073
|
// https://tc39.es/ecma262/#sec-array.prototype.sort
|
|
3077
|
-
$$
|
|
3074
|
+
$$g({ target: 'Array', proto: true, forced: FORCED$3 }, {
|
|
3078
3075
|
sort: function sort(comparefn) {
|
|
3079
3076
|
if (comparefn !== undefined) aCallable$7(comparefn);
|
|
3080
3077
|
|
|
@@ -3189,7 +3186,7 @@ var correctIsRegexpLogic = function (METHOD_NAME) {
|
|
|
3189
3186
|
} return false;
|
|
3190
3187
|
};
|
|
3191
3188
|
|
|
3192
|
-
var $$
|
|
3189
|
+
var $$f = _export;
|
|
3193
3190
|
var uncurryThis$9 = functionUncurryThis;
|
|
3194
3191
|
var notARegExp$1 = notARegexp;
|
|
3195
3192
|
var requireObjectCoercible$3 = requireObjectCoercible$9;
|
|
@@ -3200,7 +3197,7 @@ var stringIndexOf = uncurryThis$9(''.indexOf);
|
|
|
3200
3197
|
|
|
3201
3198
|
// `String.prototype.includes` method
|
|
3202
3199
|
// https://tc39.es/ecma262/#sec-string.prototype.includes
|
|
3203
|
-
$$
|
|
3200
|
+
$$f({ target: 'String', proto: true, forced: !correctIsRegExpLogic$1('includes') }, {
|
|
3204
3201
|
includes: function includes(searchString /* , position = 0 */) {
|
|
3205
3202
|
return !!~stringIndexOf(
|
|
3206
3203
|
toString$6(requireObjectCoercible$3(this)),
|
|
@@ -3807,7 +3804,7 @@ var arraySpeciesCreate$2 = function (originalArray, length) {
|
|
|
3807
3804
|
return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
|
3808
3805
|
};
|
|
3809
3806
|
|
|
3810
|
-
var $$
|
|
3807
|
+
var $$e = _export;
|
|
3811
3808
|
var flattenIntoArray$1 = flattenIntoArray_1;
|
|
3812
3809
|
var aCallable$5 = aCallable$a;
|
|
3813
3810
|
var toObject$1 = toObject$8;
|
|
@@ -3816,7 +3813,7 @@ var arraySpeciesCreate$1 = arraySpeciesCreate$2;
|
|
|
3816
3813
|
|
|
3817
3814
|
// `Array.prototype.flatMap` method
|
|
3818
3815
|
// https://tc39.es/ecma262/#sec-array.prototype.flatmap
|
|
3819
|
-
$$
|
|
3816
|
+
$$e({ target: 'Array', proto: true }, {
|
|
3820
3817
|
flatMap: function flatMap(callbackfn /* , thisArg */) {
|
|
3821
3818
|
var O = toObject$1(this);
|
|
3822
3819
|
var sourceLen = lengthOfArrayLike$2(O);
|
|
@@ -3976,7 +3973,7 @@ var stringRepeat = function repeat(count) {
|
|
|
3976
3973
|
return result;
|
|
3977
3974
|
};
|
|
3978
3975
|
|
|
3979
|
-
var $$
|
|
3976
|
+
var $$d = _export;
|
|
3980
3977
|
var uncurryThis$5 = functionUncurryThis;
|
|
3981
3978
|
var toIntegerOrInfinity$1 = toIntegerOrInfinity$7;
|
|
3982
3979
|
var thisNumberValue = thisNumberValue$1;
|
|
@@ -4050,7 +4047,7 @@ var FORCED$2 = fails$5(function () {
|
|
|
4050
4047
|
|
|
4051
4048
|
// `Number.prototype.toFixed` method
|
|
4052
4049
|
// https://tc39.es/ecma262/#sec-number.prototype.tofixed
|
|
4053
|
-
$$
|
|
4050
|
+
$$d({ target: 'Number', proto: true, forced: FORCED$2 }, {
|
|
4054
4051
|
toFixed: function toFixed(fractionDigits) {
|
|
4055
4052
|
var number = thisNumberValue(this);
|
|
4056
4053
|
var fractDigits = toIntegerOrInfinity$1(fractionDigits);
|
|
@@ -4130,12 +4127,12 @@ var numberParseFloat = FORCED$1 ? function parseFloat(string) {
|
|
|
4130
4127
|
return result === 0 && charAt(trimmedString, 0) == '-' ? -0 : result;
|
|
4131
4128
|
} : $parseFloat$1;
|
|
4132
4129
|
|
|
4133
|
-
var $$
|
|
4130
|
+
var $$c = _export;
|
|
4134
4131
|
var $parseFloat = numberParseFloat;
|
|
4135
4132
|
|
|
4136
4133
|
// `parseFloat` method
|
|
4137
4134
|
// https://tc39.es/ecma262/#sec-parsefloat-string
|
|
4138
|
-
$$
|
|
4135
|
+
$$c({ global: true, forced: parseFloat != $parseFloat }, {
|
|
4139
4136
|
parseFloat: $parseFloat
|
|
4140
4137
|
});
|
|
4141
4138
|
|
|
@@ -4290,12 +4287,12 @@ var numberParseInt = FORCED ? function parseInt(string, radix) {
|
|
|
4290
4287
|
return $parseInt$1(S, (radix >>> 0) || (exec(hex, S) ? 16 : 10));
|
|
4291
4288
|
} : $parseInt$1;
|
|
4292
4289
|
|
|
4293
|
-
var $$
|
|
4290
|
+
var $$b = _export;
|
|
4294
4291
|
var $parseInt = numberParseInt;
|
|
4295
4292
|
|
|
4296
4293
|
// `parseInt` method
|
|
4297
4294
|
// https://tc39.es/ecma262/#sec-parseint-string-radix
|
|
4298
|
-
$$
|
|
4295
|
+
$$b({ global: true, forced: parseInt != $parseInt }, {
|
|
4299
4296
|
parseInt: $parseInt
|
|
4300
4297
|
});
|
|
4301
4298
|
|
|
@@ -22807,6 +22804,240 @@ const useRunOnceOnTrue = conditionalEffect => {
|
|
|
22807
22804
|
*/
|
|
22808
22805
|
const useToggle = (initialValue = false) => React.useReducer((prev, next) => next !== undefined && typeof next !== "object" ? next : !prev, initialValue);
|
|
22809
22806
|
|
|
22807
|
+
var wellKnownSymbol$5 = wellKnownSymbol$j;
|
|
22808
|
+
var Iterators$1 = iterators;
|
|
22809
|
+
|
|
22810
|
+
var ITERATOR$2 = wellKnownSymbol$5('iterator');
|
|
22811
|
+
var ArrayPrototype = Array.prototype;
|
|
22812
|
+
|
|
22813
|
+
// check on default Array iterator
|
|
22814
|
+
var isArrayIteratorMethod$1 = function (it) {
|
|
22815
|
+
return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$2] === it);
|
|
22816
|
+
};
|
|
22817
|
+
|
|
22818
|
+
var classof = classof$6;
|
|
22819
|
+
var getMethod$2 = getMethod$5;
|
|
22820
|
+
var isNullOrUndefined$2 = isNullOrUndefined$6;
|
|
22821
|
+
var Iterators = iterators;
|
|
22822
|
+
var wellKnownSymbol$4 = wellKnownSymbol$j;
|
|
22823
|
+
|
|
22824
|
+
var ITERATOR$1 = wellKnownSymbol$4('iterator');
|
|
22825
|
+
|
|
22826
|
+
var getIteratorMethod$2 = function (it) {
|
|
22827
|
+
if (!isNullOrUndefined$2(it)) return getMethod$2(it, ITERATOR$1)
|
|
22828
|
+
|| getMethod$2(it, '@@iterator')
|
|
22829
|
+
|| Iterators[classof(it)];
|
|
22830
|
+
};
|
|
22831
|
+
|
|
22832
|
+
var call$7 = functionCall;
|
|
22833
|
+
var aCallable$4 = aCallable$a;
|
|
22834
|
+
var anObject$5 = anObject$f;
|
|
22835
|
+
var tryToString$2 = tryToString$5;
|
|
22836
|
+
var getIteratorMethod$1 = getIteratorMethod$2;
|
|
22837
|
+
|
|
22838
|
+
var $TypeError$5 = TypeError;
|
|
22839
|
+
|
|
22840
|
+
var getIterator$1 = function (argument, usingIterator) {
|
|
22841
|
+
var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
|
|
22842
|
+
if (aCallable$4(iteratorMethod)) return anObject$5(call$7(iteratorMethod, argument));
|
|
22843
|
+
throw $TypeError$5(tryToString$2(argument) + ' is not iterable');
|
|
22844
|
+
};
|
|
22845
|
+
|
|
22846
|
+
var call$6 = functionCall;
|
|
22847
|
+
var anObject$4 = anObject$f;
|
|
22848
|
+
var getMethod$1 = getMethod$5;
|
|
22849
|
+
|
|
22850
|
+
var iteratorClose$1 = function (iterator, kind, value) {
|
|
22851
|
+
var innerResult, innerError;
|
|
22852
|
+
anObject$4(iterator);
|
|
22853
|
+
try {
|
|
22854
|
+
innerResult = getMethod$1(iterator, 'return');
|
|
22855
|
+
if (!innerResult) {
|
|
22856
|
+
if (kind === 'throw') throw value;
|
|
22857
|
+
return value;
|
|
22858
|
+
}
|
|
22859
|
+
innerResult = call$6(innerResult, iterator);
|
|
22860
|
+
} catch (error) {
|
|
22861
|
+
innerError = true;
|
|
22862
|
+
innerResult = error;
|
|
22863
|
+
}
|
|
22864
|
+
if (kind === 'throw') throw value;
|
|
22865
|
+
if (innerError) throw innerResult;
|
|
22866
|
+
anObject$4(innerResult);
|
|
22867
|
+
return value;
|
|
22868
|
+
};
|
|
22869
|
+
|
|
22870
|
+
var bind$3 = functionBindContext;
|
|
22871
|
+
var call$5 = functionCall;
|
|
22872
|
+
var anObject$3 = anObject$f;
|
|
22873
|
+
var tryToString$1 = tryToString$5;
|
|
22874
|
+
var isArrayIteratorMethod = isArrayIteratorMethod$1;
|
|
22875
|
+
var lengthOfArrayLike$1 = lengthOfArrayLike$8;
|
|
22876
|
+
var isPrototypeOf$2 = objectIsPrototypeOf;
|
|
22877
|
+
var getIterator = getIterator$1;
|
|
22878
|
+
var getIteratorMethod = getIteratorMethod$2;
|
|
22879
|
+
var iteratorClose = iteratorClose$1;
|
|
22880
|
+
|
|
22881
|
+
var $TypeError$4 = TypeError;
|
|
22882
|
+
|
|
22883
|
+
var Result = function (stopped, result) {
|
|
22884
|
+
this.stopped = stopped;
|
|
22885
|
+
this.result = result;
|
|
22886
|
+
};
|
|
22887
|
+
|
|
22888
|
+
var ResultPrototype = Result.prototype;
|
|
22889
|
+
|
|
22890
|
+
var iterate$3 = function (iterable, unboundFunction, options) {
|
|
22891
|
+
var that = options && options.that;
|
|
22892
|
+
var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
|
22893
|
+
var IS_RECORD = !!(options && options.IS_RECORD);
|
|
22894
|
+
var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
|
22895
|
+
var INTERRUPTED = !!(options && options.INTERRUPTED);
|
|
22896
|
+
var fn = bind$3(unboundFunction, that);
|
|
22897
|
+
var iterator, iterFn, index, length, result, next, step;
|
|
22898
|
+
|
|
22899
|
+
var stop = function (condition) {
|
|
22900
|
+
if (iterator) iteratorClose(iterator, 'normal', condition);
|
|
22901
|
+
return new Result(true, condition);
|
|
22902
|
+
};
|
|
22903
|
+
|
|
22904
|
+
var callFn = function (value) {
|
|
22905
|
+
if (AS_ENTRIES) {
|
|
22906
|
+
anObject$3(value);
|
|
22907
|
+
return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
|
22908
|
+
} return INTERRUPTED ? fn(value, stop) : fn(value);
|
|
22909
|
+
};
|
|
22910
|
+
|
|
22911
|
+
if (IS_RECORD) {
|
|
22912
|
+
iterator = iterable.iterator;
|
|
22913
|
+
} else if (IS_ITERATOR) {
|
|
22914
|
+
iterator = iterable;
|
|
22915
|
+
} else {
|
|
22916
|
+
iterFn = getIteratorMethod(iterable);
|
|
22917
|
+
if (!iterFn) throw $TypeError$4(tryToString$1(iterable) + ' is not iterable');
|
|
22918
|
+
// optimisation for array iterators
|
|
22919
|
+
if (isArrayIteratorMethod(iterFn)) {
|
|
22920
|
+
for (index = 0, length = lengthOfArrayLike$1(iterable); length > index; index++) {
|
|
22921
|
+
result = callFn(iterable[index]);
|
|
22922
|
+
if (result && isPrototypeOf$2(ResultPrototype, result)) return result;
|
|
22923
|
+
} return new Result(false);
|
|
22924
|
+
}
|
|
22925
|
+
iterator = getIterator(iterable, iterFn);
|
|
22926
|
+
}
|
|
22927
|
+
|
|
22928
|
+
next = IS_RECORD ? iterable.next : iterator.next;
|
|
22929
|
+
while (!(step = call$5(next, iterator)).done) {
|
|
22930
|
+
try {
|
|
22931
|
+
result = callFn(step.value);
|
|
22932
|
+
} catch (error) {
|
|
22933
|
+
iteratorClose(iterator, 'throw', error);
|
|
22934
|
+
}
|
|
22935
|
+
if (typeof result == 'object' && result && isPrototypeOf$2(ResultPrototype, result)) return result;
|
|
22936
|
+
} return new Result(false);
|
|
22937
|
+
};
|
|
22938
|
+
|
|
22939
|
+
var $$a = _export;
|
|
22940
|
+
var iterate$2 = iterate$3;
|
|
22941
|
+
var createProperty = createProperty$2;
|
|
22942
|
+
|
|
22943
|
+
// `Object.fromEntries` method
|
|
22944
|
+
// https://github.com/tc39/proposal-object-from-entries
|
|
22945
|
+
$$a({ target: 'Object', stat: true }, {
|
|
22946
|
+
fromEntries: function fromEntries(iterable) {
|
|
22947
|
+
var obj = {};
|
|
22948
|
+
iterate$2(iterable, function (k, v) {
|
|
22949
|
+
createProperty(obj, k, v);
|
|
22950
|
+
}, { AS_ENTRIES: true });
|
|
22951
|
+
return obj;
|
|
22952
|
+
}
|
|
22953
|
+
});
|
|
22954
|
+
|
|
22955
|
+
const useWarehouseValidation = () => {
|
|
22956
|
+
const [warehousePreference, setWarehousePreference] = React.useState();
|
|
22957
|
+
const {
|
|
22958
|
+
error: validateAddressErrors,
|
|
22959
|
+
mutateAsync: validateAddresses
|
|
22960
|
+
} = react.useValidateAddresses();
|
|
22961
|
+
const caseInsensitiveCompare = React.useCallback((matched, original) => {
|
|
22962
|
+
if (matched === undefined || original === undefined) return false;
|
|
22963
|
+
const originalAddress = Object.fromEntries(Object.entries(original).map(([key, value]) => [key, typeof value == "string" ? value.toLowerCase() : value]));
|
|
22964
|
+
const matchedAddress = Object.fromEntries(Object.entries(matched).map(([key, value]) => [key, typeof value == "string" ? value.toLowerCase() : value]));
|
|
22965
|
+
// SE api returns addressLine2 as an empty string if it is not provided
|
|
22966
|
+
if (matchedAddress.addressLine2 === "") {
|
|
22967
|
+
matchedAddress.addressLine2 = null;
|
|
22968
|
+
}
|
|
22969
|
+
if (_$2.isEqual(_$2.omit(matchedAddress, ["postalCode", "addressResidentialIndicator"]), _$2.omit(originalAddress, ["postalCode", "addressResidentialIndicator"]))) return true;else return false;
|
|
22970
|
+
}, []);
|
|
22971
|
+
const postalCodeCompare = React.useCallback((matched, original) => {
|
|
22972
|
+
if (matched === undefined || original === undefined) return false;
|
|
22973
|
+
if (matched === original) return true;
|
|
22974
|
+
return matched.includes(original);
|
|
22975
|
+
}, []);
|
|
22976
|
+
const buildWarehousePreference = React.useCallback(addressValidation => {
|
|
22977
|
+
/**
|
|
22978
|
+
* Address validation matching criteria
|
|
22979
|
+
* 1. Case-insensitive string comparison
|
|
22980
|
+
* 2. Zip Code only added 4 extra digits to the original Zip Code
|
|
22981
|
+
*/
|
|
22982
|
+
var _a;
|
|
22983
|
+
if (addressValidation.status === "error") {
|
|
22984
|
+
return {
|
|
22985
|
+
validation: addressValidation,
|
|
22986
|
+
validationType: "ERROR"
|
|
22987
|
+
};
|
|
22988
|
+
}
|
|
22989
|
+
// Valid if the matched address and input address were EXACTLY the same
|
|
22990
|
+
if (addressValidation.matchedAddress && addressValidation.matchedAddress.name === addressValidation.originalAddress.name && addressValidation.matchedAddress.companyName === addressValidation.originalAddress.companyName && addressValidation.matchedAddress.addressLine1 === addressValidation.originalAddress.addressLine1 && addressValidation.matchedAddress.addressLine2 === addressValidation.originalAddress.addressLine2 && addressValidation.matchedAddress.cityLocality === addressValidation.originalAddress.cityLocality && addressValidation.matchedAddress.stateProvince === addressValidation.originalAddress.stateProvince && addressValidation.matchedAddress.postalCode === addressValidation.originalAddress.postalCode && addressValidation.matchedAddress.countryCode === addressValidation.originalAddress.countryCode) {
|
|
22991
|
+
return {
|
|
22992
|
+
address: addressValidation.originalAddress,
|
|
22993
|
+
validationType: "EXACT"
|
|
22994
|
+
};
|
|
22995
|
+
}
|
|
22996
|
+
// Valid if the matched address passes matching criteria but are not exactly the same address
|
|
22997
|
+
if (addressValidation.matchedAddress && caseInsensitiveCompare(addressValidation.matchedAddress, addressValidation.originalAddress) && postalCodeCompare((_a = addressValidation.matchedAddress) === null || _a === void 0 ? void 0 : _a.postalCode, addressValidation.originalAddress.postalCode)) {
|
|
22998
|
+
return {
|
|
22999
|
+
address: addressValidation.matchedAddress,
|
|
23000
|
+
validationType: "SOFT"
|
|
23001
|
+
};
|
|
23002
|
+
}
|
|
23003
|
+
// If there is a matched address and does not pass the matching criteria
|
|
23004
|
+
if (addressValidation.matchedAddress) {
|
|
23005
|
+
return {
|
|
23006
|
+
validation: addressValidation,
|
|
23007
|
+
validationType: "SUGGESTED"
|
|
23008
|
+
};
|
|
23009
|
+
}
|
|
23010
|
+
// error or address was not valiqated
|
|
23011
|
+
return {
|
|
23012
|
+
validation: addressValidation,
|
|
23013
|
+
validationType: "ERROR"
|
|
23014
|
+
};
|
|
23015
|
+
}, [caseInsensitiveCompare, postalCodeCompare]);
|
|
23016
|
+
const validate = React.useCallback(warehouse => __awaiter(void 0, void 0, void 0, function* () {
|
|
23017
|
+
const warehouseAddresses = [warehouse.originAddress, ...(warehouse.returnAddress ? [warehouse.returnAddress] : [])];
|
|
23018
|
+
const result = yield validateAddresses(warehouseAddresses);
|
|
23019
|
+
const [originAddress, returnAddress] = result;
|
|
23020
|
+
setWarehousePreference({
|
|
23021
|
+
isDefault: warehouse.isDefault,
|
|
23022
|
+
name: warehouse.name,
|
|
23023
|
+
originAddress: buildWarehousePreference(originAddress),
|
|
23024
|
+
returnAddress: returnAddress && buildWarehousePreference(returnAddress)
|
|
23025
|
+
});
|
|
23026
|
+
return {
|
|
23027
|
+
isDefault: warehouse.isDefault,
|
|
23028
|
+
name: warehouse.name,
|
|
23029
|
+
originAddress: buildWarehousePreference(originAddress),
|
|
23030
|
+
returnAddress: returnAddress && buildWarehousePreference(returnAddress)
|
|
23031
|
+
};
|
|
23032
|
+
}), [buildWarehousePreference, validateAddresses]);
|
|
23033
|
+
return {
|
|
23034
|
+
errors: validateAddressErrors,
|
|
23035
|
+
setWarehousePreference,
|
|
23036
|
+
validate,
|
|
23037
|
+
warehousePreference
|
|
23038
|
+
};
|
|
23039
|
+
};
|
|
23040
|
+
|
|
22810
23041
|
const addressParserSchema = zod.z.object({
|
|
22811
23042
|
fullAddress: zod.z.string().min(1)
|
|
22812
23043
|
});
|
|
@@ -22867,7 +23098,7 @@ const AddressParser = ({
|
|
|
22867
23098
|
}));
|
|
22868
23099
|
};
|
|
22869
23100
|
|
|
22870
|
-
const styles$
|
|
23101
|
+
const styles$b = createStyles({
|
|
22871
23102
|
grow: {
|
|
22872
23103
|
flexGrow: 1
|
|
22873
23104
|
},
|
|
@@ -22966,13 +23197,13 @@ const AddressFields = ({
|
|
|
22966
23197
|
},
|
|
22967
23198
|
options: countryCodeOptions
|
|
22968
23199
|
}), jsxRuntime.jsxs("div", Object.assign({
|
|
22969
|
-
css: styles$
|
|
23200
|
+
css: styles$b.stateZipWrapper
|
|
22970
23201
|
}, {
|
|
22971
23202
|
children: [jsxRuntime.jsx("div", Object.assign({
|
|
22972
|
-
css: styles$
|
|
23203
|
+
css: styles$b.stateWrapper
|
|
22973
23204
|
}, {
|
|
22974
23205
|
children: jsxRuntime.jsx("div", Object.assign({
|
|
22975
|
-
css: styles$
|
|
23206
|
+
css: styles$b.grow
|
|
22976
23207
|
}, {
|
|
22977
23208
|
children: watchCountryCode === "US" ?
|
|
22978
23209
|
// Domestic States
|
|
@@ -22996,10 +23227,10 @@ const AddressFields = ({
|
|
|
22996
23227
|
})
|
|
22997
23228
|
}))
|
|
22998
23229
|
})), jsxRuntime.jsx("div", Object.assign({
|
|
22999
|
-
css: styles$
|
|
23230
|
+
css: styles$b.zipWrapper
|
|
23000
23231
|
}, {
|
|
23001
23232
|
children: jsxRuntime.jsx("div", Object.assign({
|
|
23002
|
-
css: styles$
|
|
23233
|
+
css: styles$b.grow
|
|
23003
23234
|
}, {
|
|
23004
23235
|
children: jsxRuntime.jsx(TextInput, {
|
|
23005
23236
|
control: form.control,
|
|
@@ -23036,14 +23267,14 @@ const extendZod = () => {
|
|
|
23036
23267
|
zod.z.ZodObject.prototype.nullishDefault = nullishDefault;
|
|
23037
23268
|
};
|
|
23038
23269
|
|
|
23039
|
-
var call$
|
|
23270
|
+
var call$4 = functionCall;
|
|
23040
23271
|
var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
|
|
23041
|
-
var anObject$
|
|
23042
|
-
var isNullOrUndefined$
|
|
23272
|
+
var anObject$2 = anObject$f;
|
|
23273
|
+
var isNullOrUndefined$1 = isNullOrUndefined$6;
|
|
23043
23274
|
var toLength$1 = toLength$4;
|
|
23044
23275
|
var toString$2 = toString$c;
|
|
23045
23276
|
var requireObjectCoercible$1 = requireObjectCoercible$9;
|
|
23046
|
-
var getMethod
|
|
23277
|
+
var getMethod = getMethod$5;
|
|
23047
23278
|
var advanceStringIndex = advanceStringIndex$2;
|
|
23048
23279
|
var regExpExec = regexpExecAbstract;
|
|
23049
23280
|
|
|
@@ -23054,13 +23285,13 @@ fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNa
|
|
|
23054
23285
|
// https://tc39.es/ecma262/#sec-string.prototype.match
|
|
23055
23286
|
function match(regexp) {
|
|
23056
23287
|
var O = requireObjectCoercible$1(this);
|
|
23057
|
-
var matcher = isNullOrUndefined$
|
|
23058
|
-
return matcher ? call$
|
|
23288
|
+
var matcher = isNullOrUndefined$1(regexp) ? undefined : getMethod(regexp, MATCH);
|
|
23289
|
+
return matcher ? call$4(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString$2(O));
|
|
23059
23290
|
},
|
|
23060
23291
|
// `RegExp.prototype[@@match]` method
|
|
23061
23292
|
// https://tc39.es/ecma262/#sec-regexp.prototype-@@match
|
|
23062
23293
|
function (string) {
|
|
23063
|
-
var rx = anObject$
|
|
23294
|
+
var rx = anObject$2(this);
|
|
23064
23295
|
var S = toString$2(string);
|
|
23065
23296
|
var res = maybeCallNative(nativeMatch, rx, S);
|
|
23066
23297
|
|
|
@@ -23227,7 +23458,7 @@ const AddressForm = ({
|
|
|
23227
23458
|
}));
|
|
23228
23459
|
};
|
|
23229
23460
|
|
|
23230
|
-
const styles$
|
|
23461
|
+
const styles$a = createStyles({
|
|
23231
23462
|
agreement: {
|
|
23232
23463
|
alignItems: "center",
|
|
23233
23464
|
display: "flex",
|
|
@@ -23297,10 +23528,10 @@ const DisplayCarrierTerms = c => {
|
|
|
23297
23528
|
const listCarrierLinks = () => {
|
|
23298
23529
|
return c.carrierTerms.links.map((term, index) => {
|
|
23299
23530
|
return jsxRuntime.jsx("li", Object.assign({
|
|
23300
|
-
css: styles$
|
|
23531
|
+
css: styles$a.listItems
|
|
23301
23532
|
}, {
|
|
23302
23533
|
children: jsxRuntime.jsx(giger.Link, Object.assign({
|
|
23303
|
-
css: styles$
|
|
23534
|
+
css: styles$a.link,
|
|
23304
23535
|
href: term.url,
|
|
23305
23536
|
isExternal: true,
|
|
23306
23537
|
target: "_blank"
|
|
@@ -23316,18 +23547,18 @@ const DisplayCarrierTerms = c => {
|
|
|
23316
23547
|
};
|
|
23317
23548
|
const listCarrierTerms = () => {
|
|
23318
23549
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
23319
|
-
css: styles$
|
|
23550
|
+
css: styles$a.terms
|
|
23320
23551
|
}, {
|
|
23321
23552
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23322
23553
|
variant: "subtitle1"
|
|
23323
23554
|
}, {
|
|
23324
23555
|
children: c.carrierTerms.title
|
|
23325
23556
|
})), jsxRuntime.jsx("div", Object.assign({
|
|
23326
|
-
css: styles$
|
|
23557
|
+
css: styles$a.terms
|
|
23327
23558
|
}, {
|
|
23328
23559
|
children: listCarrierContent()
|
|
23329
23560
|
})), jsxRuntime.jsx("ul", Object.assign({
|
|
23330
|
-
css: styles$
|
|
23561
|
+
css: styles$a.links
|
|
23331
23562
|
}, {
|
|
23332
23563
|
children: listCarrierLinks()
|
|
23333
23564
|
}))]
|
|
@@ -23557,7 +23788,7 @@ const AddressDisplay = ({
|
|
|
23557
23788
|
}));
|
|
23558
23789
|
};
|
|
23559
23790
|
|
|
23560
|
-
const styles$
|
|
23791
|
+
const styles$9 = createStyles({
|
|
23561
23792
|
container: theme => ({
|
|
23562
23793
|
display: "flex",
|
|
23563
23794
|
gap: theme.spacing()
|
|
@@ -23595,13 +23826,13 @@ const Disclosure = ({
|
|
|
23595
23826
|
}, [open]);
|
|
23596
23827
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
23597
23828
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
23598
|
-
css: styles$
|
|
23829
|
+
css: styles$9.container
|
|
23599
23830
|
}, {
|
|
23600
23831
|
children: [jsxRuntime.jsx("div", {
|
|
23601
23832
|
children: label
|
|
23602
23833
|
}), _showToggle && jsxRuntime.jsx("button", Object.assign({
|
|
23603
23834
|
"aria-expanded": isOpen,
|
|
23604
|
-
css: styles$
|
|
23835
|
+
css: styles$9.toggle,
|
|
23605
23836
|
onClick: () => {
|
|
23606
23837
|
setIsOpen(!isOpen);
|
|
23607
23838
|
onToggle(!isOpen);
|
|
@@ -23609,12 +23840,12 @@ const Disclosure = ({
|
|
|
23609
23840
|
type: "button"
|
|
23610
23841
|
}, {
|
|
23611
23842
|
children: jsxRuntime.jsx(giger.Icon, {
|
|
23612
|
-
css: styles$
|
|
23843
|
+
css: styles$9.icon,
|
|
23613
23844
|
name: isOpen ? brands.IconNames.CHEVRON_TOP : brands.IconNames.CHEVRON_BOTTOM
|
|
23614
23845
|
})
|
|
23615
23846
|
}))]
|
|
23616
23847
|
})), isOpen && jsxRuntime.jsx("div", Object.assign({
|
|
23617
|
-
css: styles$
|
|
23848
|
+
css: styles$9.content
|
|
23618
23849
|
}, {
|
|
23619
23850
|
children: typeof children === "function" ? children(() => setIsOpen(!isOpen)) : children
|
|
23620
23851
|
}))]
|
|
@@ -23754,7 +23985,7 @@ const getCarrierRecoverySchema = requiresAddress => zod.z.object({
|
|
|
23754
23985
|
address: requiresAddress ? baseSchema : baseSchema.optional()
|
|
23755
23986
|
});
|
|
23756
23987
|
|
|
23757
|
-
const styles$
|
|
23988
|
+
const styles$8 = createStyles({
|
|
23758
23989
|
grid: theme => ({
|
|
23759
23990
|
margin: theme.spacing(4)
|
|
23760
23991
|
}),
|
|
@@ -23797,7 +24028,7 @@ const CarrierRecoveryForm = ({
|
|
|
23797
24028
|
onSubmit: formLogger.capture(handleSubmit)
|
|
23798
24029
|
}, {
|
|
23799
24030
|
children: jsxRuntime.jsxs(giger.Grid, Object.assign({
|
|
23800
|
-
css: styles$
|
|
24031
|
+
css: styles$8.grid,
|
|
23801
24032
|
noPadding: true
|
|
23802
24033
|
}, {
|
|
23803
24034
|
children: [requiresAddress && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
@@ -23805,14 +24036,14 @@ const CarrierRecoveryForm = ({
|
|
|
23805
24036
|
colSpan: 12
|
|
23806
24037
|
}, {
|
|
23807
24038
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23808
|
-
css: styles$
|
|
24039
|
+
css: styles$8.heading,
|
|
23809
24040
|
variant: "heading4"
|
|
23810
24041
|
}, {
|
|
23811
24042
|
children: t("register-wallet:sections.carriers.title")
|
|
23812
24043
|
}))
|
|
23813
24044
|
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
23814
24045
|
colSpan: 12,
|
|
23815
|
-
css: styles$
|
|
24046
|
+
css: styles$8.subtitle
|
|
23816
24047
|
}, {
|
|
23817
24048
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23818
24049
|
variant: "subtitle1"
|
|
@@ -23898,7 +24129,7 @@ const CarrierTermsForm = ({
|
|
|
23898
24129
|
onSubmit(payload.agreement);
|
|
23899
24130
|
}));
|
|
23900
24131
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
23901
|
-
css: styles$
|
|
24132
|
+
css: styles$a.termsForm,
|
|
23902
24133
|
"data-testid": "carrier-terms-form"
|
|
23903
24134
|
}, {
|
|
23904
24135
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
@@ -23914,7 +24145,7 @@ const CarrierTermsForm = ({
|
|
|
23914
24145
|
})), jsxRuntime.jsx(Spacer, {
|
|
23915
24146
|
multiplier: 1
|
|
23916
24147
|
}), jsxRuntime.jsx("div", Object.assign({
|
|
23917
|
-
css: styles$
|
|
24148
|
+
css: styles$a.carrierLogos
|
|
23918
24149
|
}, {
|
|
23919
24150
|
children: metadatas.map(({
|
|
23920
24151
|
name,
|
|
@@ -23930,7 +24161,7 @@ const CarrierTermsForm = ({
|
|
|
23930
24161
|
onSubmit: formLogger.capture(handleSubmit)
|
|
23931
24162
|
}, {
|
|
23932
24163
|
children: jsxRuntime.jsxs("div", Object.assign({
|
|
23933
|
-
css: styles$
|
|
24164
|
+
css: styles$a.agreement
|
|
23934
24165
|
}, {
|
|
23935
24166
|
children: [jsxRuntime.jsx("div", {
|
|
23936
24167
|
children: jsxRuntime.jsx(CheckboxInput, {
|
|
@@ -23957,12 +24188,12 @@ const CarrierTermsForm = ({
|
|
|
23957
24188
|
name: "agreement"
|
|
23958
24189
|
})
|
|
23959
24190
|
}), showTerms && jsxRuntime.jsxs("div", Object.assign({
|
|
23960
|
-
css: styles$
|
|
24191
|
+
css: styles$a.well
|
|
23961
24192
|
}, {
|
|
23962
24193
|
children: [terms.map((t, idx) => jsxRuntime.jsx(DisplayCarrierTerms, {
|
|
23963
24194
|
carrierTerms: t
|
|
23964
24195
|
}, idx)), jsxRuntime.jsx("div", Object.assign({
|
|
23965
|
-
css: styles$
|
|
24196
|
+
css: styles$a.close
|
|
23966
24197
|
}, {
|
|
23967
24198
|
children: jsxRuntime.jsx(giger.Button, Object.assign({
|
|
23968
24199
|
onClick: () => setShowTerms(false),
|
|
@@ -23995,7 +24226,7 @@ var global$8 = global$p;
|
|
|
23995
24226
|
var uncurryThis$2 = functionUncurryThis;
|
|
23996
24227
|
var hasOwn$1 = hasOwnProperty_1;
|
|
23997
24228
|
var isCallable$5 = isCallable$o;
|
|
23998
|
-
var isPrototypeOf$
|
|
24229
|
+
var isPrototypeOf$1 = objectIsPrototypeOf;
|
|
23999
24230
|
var toString$1 = toString$c;
|
|
24000
24231
|
var defineProperty = objectDefineProperty.f;
|
|
24001
24232
|
var copyConstructorProperties = copyConstructorProperties$2;
|
|
@@ -24011,7 +24242,7 @@ if (DESCRIPTORS$1 && isCallable$5(NativeSymbol) && (!('description' in SymbolPro
|
|
|
24011
24242
|
// wrap Symbol constructor for correct work with undefined description
|
|
24012
24243
|
var SymbolWrapper = function Symbol() {
|
|
24013
24244
|
var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString$1(arguments[0]);
|
|
24014
|
-
var result = isPrototypeOf$
|
|
24245
|
+
var result = isPrototypeOf$1(SymbolPrototype, this)
|
|
24015
24246
|
? new NativeSymbol(description)
|
|
24016
24247
|
// in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
|
|
24017
24248
|
: description === undefined ? NativeSymbol() : NativeSymbol(description);
|
|
@@ -24350,7 +24581,7 @@ const LandingPageForm = ({
|
|
|
24350
24581
|
}));
|
|
24351
24582
|
};
|
|
24352
24583
|
|
|
24353
|
-
const styles$
|
|
24584
|
+
const styles$7 = createStyles({
|
|
24354
24585
|
container: theme => ({
|
|
24355
24586
|
padding: theme.spacing(2)
|
|
24356
24587
|
}),
|
|
@@ -24372,11 +24603,11 @@ const LandingPage = ({
|
|
|
24372
24603
|
t
|
|
24373
24604
|
} = reactI18next.useTranslation();
|
|
24374
24605
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
24375
|
-
css: styles$
|
|
24606
|
+
css: styles$7.container,
|
|
24376
24607
|
"data-testid": "landing-page"
|
|
24377
24608
|
}, {
|
|
24378
24609
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24379
|
-
css: styles$
|
|
24610
|
+
css: styles$7.header
|
|
24380
24611
|
}, {
|
|
24381
24612
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24382
24613
|
variant: "heading4"
|
|
@@ -24394,7 +24625,7 @@ const LandingPage = ({
|
|
|
24394
24625
|
})), jsxRuntime.jsx(LandingPageForm, {
|
|
24395
24626
|
onSubmit: onSubmit
|
|
24396
24627
|
}), jsxRuntime.jsxs("div", Object.assign({
|
|
24397
|
-
css: styles$
|
|
24628
|
+
css: styles$7.header
|
|
24398
24629
|
}, {
|
|
24399
24630
|
children: [jsxRuntime.jsx(Spacer, {
|
|
24400
24631
|
multiplier: 6
|
|
@@ -24405,7 +24636,7 @@ const LandingPage = ({
|
|
|
24405
24636
|
})), jsxRuntime.jsx(Spacer, {
|
|
24406
24637
|
multiplier: 2
|
|
24407
24638
|
}), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24408
|
-
css: styles$
|
|
24639
|
+
css: styles$7.description,
|
|
24409
24640
|
variant: "body1"
|
|
24410
24641
|
}, {
|
|
24411
24642
|
children: t("onboarding:landing.description")
|
|
@@ -24491,6 +24722,7 @@ const getStyles$4 = (isConnected = false) => createStyles({
|
|
|
24491
24722
|
padding: `0 ${theme.spacing(.5)}px`
|
|
24492
24723
|
}, isConnected && {
|
|
24493
24724
|
backgroundColor: theme.palette.success.main,
|
|
24725
|
+
borderRadius: theme.borderRadius.XS,
|
|
24494
24726
|
color: theme.palette.white
|
|
24495
24727
|
}],
|
|
24496
24728
|
container: {
|
|
@@ -24517,7 +24749,7 @@ var _ref$1 = process.env.NODE_ENV === "production" ? {
|
|
|
24517
24749
|
} : {
|
|
24518
24750
|
name: "111ty02-css",
|
|
24519
24751
|
styles: "align-items:center;display:flex;label:css;",
|
|
24520
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
24752
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpc3QtY2FycmllcnMtcm93LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFtQmllIiwiZmlsZSI6Imxpc3QtY2FycmllcnMtcm93LnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IF9fYXdhaXRlciB9IGZyb20gXCJ0c2xpYlwiO1xyXG5pbXBvcnQgeyBqc3ggYXMgX2pzeCwganN4cyBhcyBfanN4cyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdC9qc3gtcnVudGltZVwiO1xyXG5pbXBvcnQgeyBjc3MgfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3RcIjtcclxuaW1wb3J0IHsgdXNlU3RhdGUgfSBmcm9tIFwicmVhY3RcIjtcclxuaW1wb3J0IHsgdXNlVHJhbnNsYXRpb24gfSBmcm9tIFwicmVhY3QtaTE4bmV4dFwiO1xyXG5pbXBvcnQgeyBUeXBvZ3JhcGh5IH0gZnJvbSBcIkBwYWNrbGluay9naWdlclwiO1xyXG5pbXBvcnQgeyBMaW5rQWN0aW9uLCBUZW1wbGF0ZXMgfSBmcm9tIFwiLi4vLi4vLi4vY29tcG9uZW50c1wiO1xyXG5pbXBvcnQgeyBnZXRTdHlsZXMgfSBmcm9tIFwiLi9saXN0LWNhcnJpZXJzLXJvdy5zdHlsZXNcIjtcclxuZXhwb3J0IGNvbnN0IExpc3RDYXJyaWVyc1JvdyA9ICh7IGNvbm5lY3RlZENhcnJpZXI6IHsgY2FycmllciwgaXNDb25uZWN0ZWQgfSwgcmVnaXN0ZXJDYXJyaWVyLCByZWdpc3RlckNhcnJpZXJFcnJvcnMsIH0pID0+IHtcclxuICAgIGNvbnN0IHsgc2hvcnRuYW1lOiBuYW1lLCBsb2dvLCByZXF1aXJlZEZpZWxkcyB9ID0gY2FycmllcjtcclxuICAgIGNvbnN0IHsgdCB9ID0gdXNlVHJhbnNsYXRpb24oW1wibGlzdC1jYXJyaWVyc1wiXSk7XHJcbiAgICBjb25zdCBbc2hvd0Ryb3BEb3duLCBzZXRTaG93RHJvcERvd25dID0gdXNlU3RhdGUoZmFsc2UpO1xyXG4gICAgY29uc3QgW2lzU3VibWl0dGluZywgc2V0SXNTdWJtaXR0aW5nXSA9IHVzZVN0YXRlKGZhbHNlKTtcclxuICAgIGNvbnN0IGhhbmRsZVJlZ2lzdGVyID0gKHZhbHVlcykgPT4gX19hd2FpdGVyKHZvaWQgMCwgdm9pZCAwLCB2b2lkIDAsIGZ1bmN0aW9uKiAoKSB7XHJcbiAgICAgICAgc2V0SXNTdWJtaXR0aW5nKHRydWUpO1xyXG4gICAgICAgIHlpZWxkIHJlZ2lzdGVyQ2Fycmllcih2YWx1ZXMpO1xyXG4gICAgICAgIHNob3dEcm9wRG93biAmJiBzZXRTaG93RHJvcERvd24oZmFsc2UpO1xyXG4gICAgICAgIHNldElzU3VibWl0dGluZyhmYWxzZSk7XHJcbiAgICB9KTtcclxuICAgIHJldHVybiAoX2pzeHMoXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNzczogZ2V0U3R5bGVzKCkuY29udGFpbmVyLCBcImRhdGEtdGVzdGlkXCI6IFwiY2Fycmllci1yb3dcIiB9LCB7IGNoaWxkcmVuOiBbX2pzeHMoXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNzczogZ2V0U3R5bGVzKCkucm93Q29udGFpbmVyIH0sIHsgY2hpbGRyZW46IFtfanN4cyhcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY3NzOiBnZXRTdHlsZXMoKS5sb2dvQ29udGFpbmVyIH0sIHsgY2hpbGRyZW46IFtfanN4KFwiZGl2XCIsIHsgY2hpbGRyZW46IF9qc3goXCJpbWdcIiwgeyBhbHQ6IGAke25hbWV9LWxvZ29gLCBoZWlnaHQ6IDQwLCBzcmM6IGxvZ28sIHdpZHRoOiA0MCB9KSB9KSwgX2pzeChUeXBvZ3JhcGh5LCBPYmplY3QuYXNzaWduKHsgdmFyaWFudDogXCJzdWJ0aXRsZTFcIiB9LCB7IGNoaWxkcmVuOiBuYW1lIH0pKV0gfSkpLCBfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IGNzcyh7IGFsaWduSXRlbXM6IFwiY2VudGVyXCIsIGRpc3BsYXk6IFwiZmxleFwiIH0pIH0sIHsgY2hpbGRyZW46IF9qc3goTGlua0FjdGlvbiwgeyBjc3M6IGdldFN0eWxlcyhpc0Nvbm5lY3RlZCkuY29ubmVjdEJ1dHRvbiwgaXNEaXNhYmxlZDogaXNDb25uZWN0ZWQgfHwgc2hvd0Ryb3BEb3duLCBpc0xvYWRpbmc6IGlzU3VibWl0dGluZywgb25DbGljazogKCkgPT4gX19hd2FpdGVyKHZvaWQgMCwgdm9pZCAwLCB2b2lkIDAsIGZ1bmN0aW9uKiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlcXVpcmVkRmllbGRzID09PSBudWxsIHx8IHJlcXVpcmVkRmllbGRzID09PSB2b2lkIDAgPyB2b2lkIDAgOiByZXF1aXJlZEZpZWxkcy5pbmNsdWRlcyhcImFkZHJlc3NcIikpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFNob3dEcm9wRG93bih0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHlpZWxkIGhhbmRsZVJlZ2lzdGVyKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdGl0bGU6IGlzQ29ubmVjdGVkXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPyB0KFwibGlzdC1jYXJyaWVyczphY3Rpb25zLnN0YXR1cy5jb25uZWN0ZWRcIilcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IHQoXCJsaXN0LWNhcnJpZXJzOmFjdGlvbnMuc3RhdHVzLm5vdENvbm5lY3RlZFwiKSB9KSB9KSldIH0pKSwgc2hvd0Ryb3BEb3duICYmIChfanN4KFRlbXBsYXRlcy5BZGRDYXJyaWVyRm9ybSwgeyBjYXJyaWVyVGVybXM6IGNhcnJpZXIudGVybXMgJiYgY2Fycmllci50ZXJtcywgb25DYW5jZWw6ICgpID0+IHNldFNob3dEcm9wRG93bihmYWxzZSksIG9uU3VibWl0OiAodmFsdWVzKSA9PiBoYW5kbGVSZWdpc3Rlcih2YWx1ZXMpLCByZWdpc3RlckNhcnJpZXJFcnJvcnM6IHJlZ2lzdGVyQ2FycmllckVycm9ycyB9KSldIH0pKSk7XHJcbn07XHJcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPWxpc3QtY2FycmllcnMtcm93LmpzLm1hcCJdfQ== */",
|
|
24521
24753
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$2
|
|
24522
24754
|
};
|
|
24523
24755
|
const ListCarriersRow = ({
|
|
@@ -24569,18 +24801,15 @@ const ListCarriersRow = ({
|
|
|
24569
24801
|
})), jsxRuntime.jsx("div", Object.assign({
|
|
24570
24802
|
css: _ref$1
|
|
24571
24803
|
}, {
|
|
24572
|
-
children: jsxRuntime.jsx(
|
|
24573
|
-
color: giger.ButtonColor.SECONDARY,
|
|
24804
|
+
children: jsxRuntime.jsx(LinkAction, {
|
|
24574
24805
|
css: getStyles$4(isConnected).connectButton,
|
|
24575
|
-
|
|
24806
|
+
isDisabled: isConnected || showDropDown,
|
|
24576
24807
|
isLoading: isSubmitting,
|
|
24577
24808
|
onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
24578
24809
|
if (requiredFields === null || requiredFields === void 0 ? void 0 : requiredFields.includes("address")) setShowDropDown(true);else yield handleRegister();
|
|
24579
24810
|
}),
|
|
24580
|
-
|
|
24581
|
-
}
|
|
24582
|
-
children: isConnected ? t("list-carriers:actions.status.connected") : t("list-carriers:actions.status.notConnected")
|
|
24583
|
-
}))
|
|
24811
|
+
title: isConnected ? t("list-carriers:actions.status.connected") : t("list-carriers:actions.status.notConnected")
|
|
24812
|
+
})
|
|
24584
24813
|
}))]
|
|
24585
24814
|
})), showDropDown && jsxRuntime.jsx(AddCarrierForm, {
|
|
24586
24815
|
carrierTerms: carrier.terms && carrier.terms,
|
|
@@ -24591,7 +24820,7 @@ const ListCarriersRow = ({
|
|
|
24591
24820
|
}));
|
|
24592
24821
|
};
|
|
24593
24822
|
|
|
24594
|
-
const styles$
|
|
24823
|
+
const styles$6 = createStyles({
|
|
24595
24824
|
listContainer: theme => ({
|
|
24596
24825
|
"& > li:not(:last-of-type)": {
|
|
24597
24826
|
borderBottom: `1px solid ${theme.palette.gray.light}`
|
|
@@ -24638,7 +24867,7 @@ const ListCarriers$1 = ({
|
|
|
24638
24867
|
children: t("list-carriers:headers.accountCarriers")
|
|
24639
24868
|
}))
|
|
24640
24869
|
}), jsxRuntime.jsx("ul", Object.assign({
|
|
24641
|
-
css: styles$
|
|
24870
|
+
css: styles$6.listContainer
|
|
24642
24871
|
}, {
|
|
24643
24872
|
children: isLoading ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
24644
24873
|
children: [jsxRuntime.jsx(LoadingSkeletonRow, {}), jsxRuntime.jsx(LoadingSkeletonRow, {}), jsxRuntime.jsx(LoadingSkeletonRow, {})]
|
|
@@ -24659,10 +24888,10 @@ const ListCarriers$1 = ({
|
|
|
24659
24888
|
};
|
|
24660
24889
|
const LoadingSkeletonRow = () => {
|
|
24661
24890
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
24662
|
-
css: styles$
|
|
24891
|
+
css: styles$6.skeletonRow
|
|
24663
24892
|
}, {
|
|
24664
24893
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24665
|
-
css: styles$
|
|
24894
|
+
css: styles$6.skeletonLogoContainer
|
|
24666
24895
|
}, {
|
|
24667
24896
|
children: [jsxRuntime.jsx(giger.Skeleton, {
|
|
24668
24897
|
animation: giger.SkeletonAnimation.WAVE,
|
|
@@ -24686,7 +24915,7 @@ const LoadingSkeletonRow = () => {
|
|
|
24686
24915
|
}));
|
|
24687
24916
|
};
|
|
24688
24917
|
|
|
24689
|
-
const styles$
|
|
24918
|
+
const styles$5 = createStyles({
|
|
24690
24919
|
body: theme => ({
|
|
24691
24920
|
borderTop: `1px solid ${theme.palette.gray.light}`,
|
|
24692
24921
|
color: theme.palette.black,
|
|
@@ -24737,14 +24966,14 @@ const SettingsCard = ({
|
|
|
24737
24966
|
verticallyAligned
|
|
24738
24967
|
}) => {
|
|
24739
24968
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
24740
|
-
css: verticallyAligned ? styles$
|
|
24969
|
+
css: verticallyAligned ? styles$5.verticalContainer : styles$5.container,
|
|
24741
24970
|
"data-testid": "settingsCard"
|
|
24742
24971
|
}, {
|
|
24743
24972
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24744
|
-
css: styles$
|
|
24973
|
+
css: styles$5.header
|
|
24745
24974
|
}, {
|
|
24746
24975
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24747
|
-
css: styles$
|
|
24976
|
+
css: styles$5.title
|
|
24748
24977
|
}, {
|
|
24749
24978
|
children: [typeof title === "string" ? jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24750
24979
|
variant: "subtitle2"
|
|
@@ -24779,7 +25008,7 @@ const SettingsCard = ({
|
|
|
24779
25008
|
}))
|
|
24780
25009
|
}))]
|
|
24781
25010
|
})), children && jsxRuntime.jsx("div", Object.assign({
|
|
24782
|
-
css: styles$
|
|
25011
|
+
css: styles$5.body
|
|
24783
25012
|
}, {
|
|
24784
25013
|
children: jsxRuntime.jsxs("div", {
|
|
24785
25014
|
children: [children, accessoryAction && jsxRuntime.jsx(ButtonGroup, Object.assign({
|
|
@@ -24811,6 +25040,7 @@ const WarehouseDisplay = ({
|
|
|
24811
25040
|
returnAddress
|
|
24812
25041
|
} = warehouse;
|
|
24813
25042
|
return jsxRuntime.jsxs(giger.Grid, Object.assign({
|
|
25043
|
+
"data-testid": "warehouseDisplay",
|
|
24814
25044
|
noPadding: true
|
|
24815
25045
|
}, {
|
|
24816
25046
|
children: [jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
@@ -24855,7 +25085,9 @@ const WarehouseDisplay = ({
|
|
|
24855
25085
|
|
|
24856
25086
|
const postalCodeRegex$1 = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
|
|
24857
25087
|
const warehouseAddressSchema = addressSchema.extend({
|
|
24858
|
-
addressResidentialIndicator: zod.z.preprocess(v => v === "yes" ? true : false, zod.z.boolean().default(false).transform(value => value ? "yes" : "no"))
|
|
25088
|
+
addressResidentialIndicator: zod.z.preprocess(v => v === "yes" ? true : false, zod.z.boolean().default(false).transform(value => value ? "yes" : "no")),
|
|
25089
|
+
companyName: zod.z.string().trim().min(1),
|
|
25090
|
+
phone: zod.z.string().trim().min(1)
|
|
24859
25091
|
}).refine(schema => !schema.phone || min$4.isValidPhoneNumber(schema.phone, schema.countryCode), {
|
|
24860
25092
|
message: "schemaErrors.notAValidPhoneNumber",
|
|
24861
25093
|
path: ["phone"]
|
|
@@ -24887,28 +25119,7 @@ const warehouseSchema = zod.z.discriminatedUnion("returnToAddressIsDifferent", [
|
|
|
24887
25119
|
name: zod.z.string().trim().min(1),
|
|
24888
25120
|
originAddress: warehouseAddressSchema,
|
|
24889
25121
|
returnToAddressIsDifferent: zod.z.literal(false)
|
|
24890
|
-
})])
|
|
24891
|
-
if (schema.returnToAddressIsDifferent) {
|
|
24892
|
-
return schema;
|
|
24893
|
-
}
|
|
24894
|
-
return Object.assign(Object.assign({}, schema), {
|
|
24895
|
-
returnAddress: schema.originAddress
|
|
24896
|
-
});
|
|
24897
|
-
});
|
|
24898
|
-
|
|
24899
|
-
const styles$3 = createStyles({
|
|
24900
|
-
header: {
|
|
24901
|
-
textAlign: "center"
|
|
24902
|
-
},
|
|
24903
|
-
onboardingWell: theme => ({
|
|
24904
|
-
backgroundColor: theme.palette.white,
|
|
24905
|
-
padding: theme.spacing(2)
|
|
24906
|
-
}),
|
|
24907
|
-
well: theme => ({
|
|
24908
|
-
backgroundColor: theme.palette.gray.ultraLight,
|
|
24909
|
-
padding: theme.spacing(2)
|
|
24910
|
-
})
|
|
24911
|
-
});
|
|
25122
|
+
})]);
|
|
24912
25123
|
|
|
24913
25124
|
const WarehouseForm = ({
|
|
24914
25125
|
isOnboarding: _isOnboarding = false,
|
|
@@ -24932,9 +25143,9 @@ const WarehouseForm = ({
|
|
|
24932
25143
|
}),
|
|
24933
25144
|
returnToAddressIsDifferent: !lodash.exports.isEqual(warehouse.originAddress, warehouse.returnAddress)
|
|
24934
25145
|
}) : {
|
|
24935
|
-
isDefault: false,
|
|
25146
|
+
isDefault: _isOnboarding ? true : false,
|
|
24936
25147
|
originAddress: {
|
|
24937
|
-
|
|
25148
|
+
addressResidentialIndicator: false
|
|
24938
25149
|
},
|
|
24939
25150
|
returnToAddressIsDifferent: false
|
|
24940
25151
|
},
|
|
@@ -24943,140 +25154,368 @@ const WarehouseForm = ({
|
|
|
24943
25154
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
24944
25155
|
const _a = values,
|
|
24945
25156
|
payload = __rest(_a, ["returnToAddressIsDifferent"]);
|
|
24946
|
-
|
|
24947
|
-
payload.isDefault = true;
|
|
24948
|
-
yield onSubmit(payload);
|
|
24949
|
-
} else {
|
|
24950
|
-
yield onSubmit(payload);
|
|
24951
|
-
}
|
|
25157
|
+
yield onSubmit(payload);
|
|
24952
25158
|
}));
|
|
24953
|
-
return jsxRuntime.jsxs("
|
|
24954
|
-
|
|
24955
|
-
|
|
25159
|
+
return jsxRuntime.jsxs("form", Object.assign({
|
|
25160
|
+
id: "warehouse-form",
|
|
25161
|
+
onSubmit: formLogger.capture(handleSubmit)
|
|
24956
25162
|
}, {
|
|
24957
|
-
children: [
|
|
24958
|
-
|
|
24959
|
-
|
|
25163
|
+
children: [jsxRuntime.jsx(TextInput, {
|
|
25164
|
+
control: form.control,
|
|
25165
|
+
form: "warehouse-form",
|
|
25166
|
+
label: t("manage-warehouses:locationName"),
|
|
25167
|
+
name: "name",
|
|
25168
|
+
nativeLabel: true
|
|
25169
|
+
}), jsxRuntime.jsx(AddressFields, {
|
|
25170
|
+
form: form,
|
|
25171
|
+
formatFieldName: fieldName => `originAddress.${fieldName}`,
|
|
25172
|
+
optionalFields: ["addressLine2"]
|
|
25173
|
+
}), jsxRuntime.jsx(CheckboxInput, {
|
|
25174
|
+
checkboxLabel: t("manage-warehouses:residentialAddress"),
|
|
25175
|
+
control: form.control,
|
|
25176
|
+
form: "warehouse-form",
|
|
25177
|
+
label: "originAddress.addressResidentialIndicator",
|
|
25178
|
+
name: "originAddress.addressResidentialIndicator"
|
|
25179
|
+
}), !_isOnboarding && jsxRuntime.jsx(CheckboxInput, {
|
|
25180
|
+
checkboxLabel: t("manage-warehouses:isDefault"),
|
|
25181
|
+
control: form.control,
|
|
25182
|
+
form: "warehouse-form",
|
|
25183
|
+
label: "isDefault",
|
|
25184
|
+
name: "isDefault"
|
|
25185
|
+
}), jsxRuntime.jsx(CheckboxInput, {
|
|
25186
|
+
checkboxLabel: t("manage-warehouses:returnToAddressIsDifferent"),
|
|
25187
|
+
control: form.control,
|
|
25188
|
+
"data-testid": "returnToAddressIsDifferent",
|
|
25189
|
+
form: "warehouse-form",
|
|
25190
|
+
label: "returnToAddressIsDifferent",
|
|
25191
|
+
name: "returnToAddressIsDifferent",
|
|
25192
|
+
onClick: e => {
|
|
25193
|
+
if (e.currentTarget.checked) {
|
|
25194
|
+
form.reset(formValues => Object.assign(Object.assign({}, formValues), {
|
|
25195
|
+
returnAddress: Object.assign(Object.assign({}, {}), {
|
|
25196
|
+
addressResidentialIndicator: false,
|
|
25197
|
+
companyName: "",
|
|
25198
|
+
countryCode: "US"
|
|
25199
|
+
}),
|
|
25200
|
+
returnToAddressIsDifferent: true
|
|
25201
|
+
}), {
|
|
25202
|
+
keepErrors: true
|
|
25203
|
+
});
|
|
25204
|
+
}
|
|
25205
|
+
}
|
|
25206
|
+
}), form.watch("returnToAddressIsDifferent") && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
25207
|
+
children: [jsxRuntime.jsx(AddressFields, {
|
|
25208
|
+
form: form,
|
|
25209
|
+
formatFieldName: fieldName => `returnAddress.${fieldName}`,
|
|
25210
|
+
optionalFields: ["addressLine2"]
|
|
25211
|
+
}), jsxRuntime.jsx(CheckboxInput, {
|
|
25212
|
+
checkboxLabel: t("manage-warehouses:residentialAddress"),
|
|
25213
|
+
control: form.control,
|
|
25214
|
+
form: "warehouse-form",
|
|
25215
|
+
label: "returnAddress.addressResidentialIndicator",
|
|
25216
|
+
name: "returnAddress.addressResidentialIndicator"
|
|
25217
|
+
})]
|
|
25218
|
+
}), jsxRuntime.jsxs(ButtonGroup, Object.assign({
|
|
25219
|
+
justify: "center"
|
|
25220
|
+
}, {
|
|
25221
|
+
children: [onDelete && jsxRuntime.jsx(giger.Button, Object.assign({
|
|
25222
|
+
bold: false,
|
|
25223
|
+
onClick: onDelete,
|
|
25224
|
+
type: "button",
|
|
25225
|
+
variant: giger.ButtonVariant.TEXT
|
|
24960
25226
|
}, {
|
|
24961
|
-
children:
|
|
24962
|
-
|
|
24963
|
-
|
|
24964
|
-
children: t("onboarding:warehouse.title")
|
|
24965
|
-
})), jsxRuntime.jsx(Spacer, {
|
|
24966
|
-
multiplier: 2
|
|
24967
|
-
}), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24968
|
-
variant: "subtitle1"
|
|
24969
|
-
}, {
|
|
24970
|
-
children: t("onboarding:warehouse.subtitle")
|
|
24971
|
-
})), jsxRuntime.jsx(Spacer, {
|
|
24972
|
-
multiplier: 1
|
|
24973
|
-
})]
|
|
24974
|
-
})), jsxRuntime.jsxs("div", {
|
|
24975
|
-
children: [jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
24976
|
-
title: t("onboarding:inlineTitle"),
|
|
24977
|
-
type: giger.NotificationType.INFO
|
|
24978
|
-
}, {
|
|
24979
|
-
children: t("onboarding:warehouse.inlineMessage")
|
|
24980
|
-
})), jsxRuntime.jsx(Spacer, {
|
|
24981
|
-
multiplier: 2
|
|
24982
|
-
})]
|
|
24983
|
-
})]
|
|
24984
|
-
}), jsxRuntime.jsxs("form", Object.assign({
|
|
24985
|
-
id: "warehouse-form",
|
|
24986
|
-
onSubmit: formLogger.capture(handleSubmit)
|
|
24987
|
-
}, {
|
|
24988
|
-
children: [jsxRuntime.jsx(TextInput, {
|
|
24989
|
-
control: form.control,
|
|
24990
|
-
form: "warehouse-form",
|
|
24991
|
-
label: t("manage-warehouses:locationName"),
|
|
24992
|
-
name: "name",
|
|
24993
|
-
nativeLabel: true
|
|
24994
|
-
}), jsxRuntime.jsx(AddressFields, {
|
|
24995
|
-
form: form,
|
|
24996
|
-
formatFieldName: fieldName => `originAddress.${fieldName}`,
|
|
24997
|
-
optionalFields: ["addressLine2"]
|
|
24998
|
-
}), jsxRuntime.jsx(CheckboxInput, {
|
|
24999
|
-
checkboxLabel: t("manage-warehouses:residentialAddress"),
|
|
25000
|
-
control: form.control,
|
|
25001
|
-
form: "warehouse-form",
|
|
25002
|
-
label: "originAddress.addressResidentialIndicator",
|
|
25003
|
-
name: "originAddress.addressResidentialIndicator"
|
|
25004
|
-
}), !_isOnboarding && jsxRuntime.jsx(CheckboxInput, {
|
|
25005
|
-
checkboxLabel: t("manage-warehouses:isDefault"),
|
|
25006
|
-
control: form.control,
|
|
25007
|
-
form: "warehouse-form",
|
|
25008
|
-
label: "isDefault",
|
|
25009
|
-
name: "isDefault"
|
|
25010
|
-
}), jsxRuntime.jsx(CheckboxInput, {
|
|
25011
|
-
checkboxLabel: t("manage-warehouses:returnToAddressIsDifferent"),
|
|
25012
|
-
control: form.control,
|
|
25013
|
-
form: "warehouse-form",
|
|
25014
|
-
label: "returnToAddressIsDifferent",
|
|
25015
|
-
name: "returnToAddressIsDifferent",
|
|
25016
|
-
onClick: e => {
|
|
25017
|
-
if (e.currentTarget.checked) {
|
|
25018
|
-
form.reset(formValues => Object.assign(Object.assign({}, formValues), {
|
|
25019
|
-
returnAddress: Object.assign(Object.assign({}, {}), {
|
|
25020
|
-
addressResidentialIndicator: false,
|
|
25021
|
-
countryCode: "US"
|
|
25022
|
-
}),
|
|
25023
|
-
returnToAddressIsDifferent: true
|
|
25024
|
-
}), {
|
|
25025
|
-
keepErrors: true
|
|
25026
|
-
});
|
|
25027
|
-
}
|
|
25028
|
-
}
|
|
25029
|
-
}), form.watch("returnToAddressIsDifferent") && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
25030
|
-
children: [jsxRuntime.jsx(AddressFields, {
|
|
25031
|
-
form: form,
|
|
25032
|
-
formatFieldName: fieldName => `returnAddress.${fieldName}`
|
|
25033
|
-
}), jsxRuntime.jsx(CheckboxInput, {
|
|
25034
|
-
checkboxLabel: t("manage-warehouses:residentialAddress"),
|
|
25035
|
-
control: form.control,
|
|
25036
|
-
form: "warehouse-form",
|
|
25037
|
-
label: "returnAddress.addressResidentialIndicator",
|
|
25038
|
-
name: "returnAddress.addressResidentialIndicator"
|
|
25039
|
-
})]
|
|
25040
|
-
}), jsxRuntime.jsxs(ButtonGroup, Object.assign({
|
|
25041
|
-
justify: "center"
|
|
25227
|
+
children: t("actions.remove")
|
|
25228
|
+
})), jsxRuntime.jsxs(ButtonGroup, Object.assign({
|
|
25229
|
+
justify: _isOnboarding ? "center" : "end"
|
|
25042
25230
|
}, {
|
|
25043
|
-
children: [
|
|
25231
|
+
children: [onCancel && jsxRuntime.jsx(giger.Button, Object.assign({
|
|
25044
25232
|
bold: false,
|
|
25045
|
-
onClick:
|
|
25233
|
+
onClick: onCancel,
|
|
25046
25234
|
type: "button",
|
|
25047
25235
|
variant: giger.ButtonVariant.TEXT
|
|
25048
25236
|
}, {
|
|
25049
|
-
children: t("actions.
|
|
25050
|
-
})), jsxRuntime.
|
|
25051
|
-
|
|
25237
|
+
children: t("actions.cancel")
|
|
25238
|
+
})), jsxRuntime.jsx(SubmitButton, Object.assign({
|
|
25239
|
+
control: form.control,
|
|
25240
|
+
"data-testid": "warehouseFormSubmitButton",
|
|
25241
|
+
form: "warehouse-form",
|
|
25242
|
+
requireDirty: true,
|
|
25243
|
+
variant: _isOnboarding ? giger.ButtonVariant.FILLED : giger.ButtonVariant.OUTLINED
|
|
25052
25244
|
}, {
|
|
25053
|
-
children:
|
|
25054
|
-
|
|
25055
|
-
|
|
25056
|
-
|
|
25057
|
-
|
|
25245
|
+
children: submitButtonTitle
|
|
25246
|
+
}))]
|
|
25247
|
+
}))]
|
|
25248
|
+
}))]
|
|
25249
|
+
}));
|
|
25250
|
+
};
|
|
25251
|
+
|
|
25252
|
+
const WarehousePreferenceSelect = ({
|
|
25253
|
+
onCancel,
|
|
25254
|
+
onSubmit,
|
|
25255
|
+
originAddress,
|
|
25256
|
+
returnAddress
|
|
25257
|
+
}) => {
|
|
25258
|
+
const {
|
|
25259
|
+
t
|
|
25260
|
+
} = reactI18next.useTranslation(["manage-warehouses", "common"]);
|
|
25261
|
+
const determineAddressPreference = address => {
|
|
25262
|
+
if (!address) return undefined;
|
|
25263
|
+
switch (address.validationType) {
|
|
25264
|
+
case "EXACT":
|
|
25265
|
+
case "SOFT":
|
|
25266
|
+
return address.address;
|
|
25267
|
+
case "SUGGESTED":
|
|
25268
|
+
return address.validation.matchedAddress;
|
|
25269
|
+
case "ERROR":
|
|
25270
|
+
return address.validation.originalAddress;
|
|
25271
|
+
default:
|
|
25272
|
+
return undefined;
|
|
25273
|
+
}
|
|
25274
|
+
};
|
|
25275
|
+
const [originAddressPreference, setOriginAddressPreference] = React.useState(determineAddressPreference(originAddress));
|
|
25276
|
+
const [returnAddressPreference, setReturnAddressPreference] = React.useState(determineAddressPreference(returnAddress));
|
|
25277
|
+
const addressPreferenceDisplay = (preference, name, onPreferenceSelect) => {
|
|
25278
|
+
var _a, _b;
|
|
25279
|
+
switch (preference.validationType) {
|
|
25280
|
+
case "EXACT":
|
|
25281
|
+
case "SOFT":
|
|
25282
|
+
return jsxRuntime.jsx(AddressDisplay, {
|
|
25283
|
+
address: preference.address
|
|
25284
|
+
});
|
|
25285
|
+
case "SUGGESTED":
|
|
25286
|
+
return jsxRuntime.jsxs(giger.Next.RadioGroup, Object.assign({
|
|
25287
|
+
name: name,
|
|
25288
|
+
onChange: e => {
|
|
25289
|
+
if (preference.validation.matchedAddress && e.target.value === "suggested") {
|
|
25290
|
+
onPreferenceSelect(preference.validation.matchedAddress);
|
|
25291
|
+
} else {
|
|
25292
|
+
onPreferenceSelect(preference.validation.originalAddress);
|
|
25293
|
+
}
|
|
25294
|
+
}
|
|
25295
|
+
}, {
|
|
25296
|
+
children: [jsxRuntime.jsx(Spacer, {
|
|
25297
|
+
multiplier: 1
|
|
25298
|
+
}), jsxRuntime.jsx(giger.Next.Radio, Object.assign({
|
|
25299
|
+
value: "suggested"
|
|
25058
25300
|
}, {
|
|
25059
|
-
children: t("
|
|
25060
|
-
})), jsxRuntime.jsx(
|
|
25061
|
-
|
|
25062
|
-
|
|
25063
|
-
|
|
25064
|
-
|
|
25301
|
+
children: t("common:address.preference.matchedAddress")
|
|
25302
|
+
})), preference.validation.matchedAddress && jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
25303
|
+
colSpan: 6,
|
|
25304
|
+
colStart: 4,
|
|
25305
|
+
css: theme => ({
|
|
25306
|
+
paddingLeft: theme.spacing(3)
|
|
25307
|
+
})
|
|
25065
25308
|
}, {
|
|
25066
|
-
children:
|
|
25309
|
+
children: jsxRuntime.jsx(AddressDisplay, {
|
|
25310
|
+
address: preference.validation.matchedAddress
|
|
25311
|
+
})
|
|
25312
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
25313
|
+
multiplier: 1
|
|
25314
|
+
}), jsxRuntime.jsx(giger.Next.Radio, Object.assign({
|
|
25315
|
+
value: "original"
|
|
25316
|
+
}, {
|
|
25317
|
+
children: t("common:address.preference.originalAddress")
|
|
25318
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
25319
|
+
multiplier: 1
|
|
25320
|
+
}), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
25321
|
+
colSpan: 6,
|
|
25322
|
+
colStart: 4,
|
|
25323
|
+
css: theme => ({
|
|
25324
|
+
paddingLeft: theme.spacing(3)
|
|
25325
|
+
})
|
|
25326
|
+
}, {
|
|
25327
|
+
children: jsxRuntime.jsx(AddressDisplay, {
|
|
25328
|
+
address: (_a = preference.validation) === null || _a === void 0 ? void 0 : _a.originalAddress
|
|
25329
|
+
})
|
|
25067
25330
|
}))]
|
|
25068
|
-
}))
|
|
25331
|
+
}));
|
|
25332
|
+
case "ERROR":
|
|
25333
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
25334
|
+
children: [jsxRuntime.jsx(Spacer, {
|
|
25335
|
+
multiplier: 1
|
|
25336
|
+
}), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
25337
|
+
colSpan: 8,
|
|
25338
|
+
css: theme => ({
|
|
25339
|
+
paddingLeft: theme.spacing(1)
|
|
25340
|
+
})
|
|
25341
|
+
}, {
|
|
25342
|
+
children: jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
25343
|
+
type: giger.NotificationType.ALERT
|
|
25344
|
+
}, {
|
|
25345
|
+
children: t("address.preference.unableToValidate")
|
|
25346
|
+
}))
|
|
25347
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
25348
|
+
multiplier: 1
|
|
25349
|
+
}), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
25350
|
+
css: theme => ({
|
|
25351
|
+
paddingLeft: theme.spacing(1)
|
|
25352
|
+
})
|
|
25353
|
+
}, {
|
|
25354
|
+
children: jsxRuntime.jsx(AddressDisplay, {
|
|
25355
|
+
address: (_b = preference.validation) === null || _b === void 0 ? void 0 : _b.originalAddress
|
|
25356
|
+
})
|
|
25357
|
+
}))]
|
|
25358
|
+
});
|
|
25359
|
+
default:
|
|
25360
|
+
// This code path should never be reached.
|
|
25361
|
+
return jsxRuntime.jsx("div", {
|
|
25362
|
+
children: "not found"
|
|
25363
|
+
});
|
|
25364
|
+
}
|
|
25365
|
+
};
|
|
25366
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
25367
|
+
children: [jsxRuntime.jsxs(giger.Grid, Object.assign({
|
|
25368
|
+
"data-testid": "warehousePreferenceSelect",
|
|
25369
|
+
noPadding: true
|
|
25370
|
+
}, {
|
|
25371
|
+
children: [jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
25372
|
+
colSpan: 12
|
|
25373
|
+
}, {
|
|
25374
|
+
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
25375
|
+
variant: "subtitle2"
|
|
25376
|
+
}, {
|
|
25377
|
+
children: t("common:address.preference.title")
|
|
25378
|
+
}))
|
|
25379
|
+
})), jsxRuntime.jsxs(giger.GridChild, Object.assign({
|
|
25380
|
+
colSpan: 8
|
|
25381
|
+
}, {
|
|
25382
|
+
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
25383
|
+
css: {
|
|
25384
|
+
textTransform: "capitalize"
|
|
25385
|
+
},
|
|
25386
|
+
variant: "subtitle2"
|
|
25387
|
+
}, {
|
|
25388
|
+
children: t("manage-warehouses:shipFrom")
|
|
25389
|
+
})), originAddress && addressPreferenceDisplay(originAddress, "originAddressPreference", preference => {
|
|
25390
|
+
setOriginAddressPreference(preference);
|
|
25391
|
+
})]
|
|
25392
|
+
})), returnAddress && jsxRuntime.jsxs(giger.GridChild, Object.assign({
|
|
25393
|
+
colSpan: 8
|
|
25394
|
+
}, {
|
|
25395
|
+
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
25396
|
+
css: {
|
|
25397
|
+
textTransform: "capitalize"
|
|
25398
|
+
},
|
|
25399
|
+
variant: "subtitle2"
|
|
25400
|
+
}, {
|
|
25401
|
+
children: t("manage-warehouses:returnTo")
|
|
25402
|
+
})), addressPreferenceDisplay(returnAddress, "returnAddressPreference", preference => {
|
|
25403
|
+
setReturnAddressPreference(preference);
|
|
25404
|
+
})]
|
|
25405
|
+
}))]
|
|
25406
|
+
})), jsxRuntime.jsxs(ButtonGroup, Object.assign({
|
|
25407
|
+
justify: "end"
|
|
25408
|
+
}, {
|
|
25409
|
+
children: [onCancel && jsxRuntime.jsx(giger.Button, Object.assign({
|
|
25410
|
+
bold: false,
|
|
25411
|
+
onClick: onCancel,
|
|
25412
|
+
type: "button",
|
|
25413
|
+
variant: giger.ButtonVariant.TEXT
|
|
25414
|
+
}, {
|
|
25415
|
+
children: t("actions.cancel")
|
|
25416
|
+
})), jsxRuntime.jsx(giger.Button, Object.assign({
|
|
25417
|
+
onClick: () => onSubmit({
|
|
25418
|
+
originAddress: originAddressPreference,
|
|
25419
|
+
returnAddress: returnAddressPreference
|
|
25420
|
+
}),
|
|
25421
|
+
variant: giger.ButtonVariant.OUTLINED
|
|
25422
|
+
}, {
|
|
25423
|
+
children: t("common:address.preference.confirm")
|
|
25069
25424
|
}))]
|
|
25070
25425
|
}))]
|
|
25426
|
+
});
|
|
25427
|
+
};
|
|
25428
|
+
|
|
25429
|
+
const WarehousePreferenceWizard = ({
|
|
25430
|
+
className,
|
|
25431
|
+
formHeader,
|
|
25432
|
+
isOnboarding: _isOnboarding = false,
|
|
25433
|
+
onSubmit,
|
|
25434
|
+
onValidate,
|
|
25435
|
+
onWarehouseDelete,
|
|
25436
|
+
onWarehouseFormCancel,
|
|
25437
|
+
submitButtonTitle,
|
|
25438
|
+
warehouse,
|
|
25439
|
+
warehousePreference
|
|
25440
|
+
}) => {
|
|
25441
|
+
const [currentStep, setCurrentStep] = React.useState(0);
|
|
25442
|
+
const checkForExactOrSoft = warehousePreference => __awaiter(void 0, void 0, void 0, function* () {
|
|
25443
|
+
const {
|
|
25444
|
+
originAddress,
|
|
25445
|
+
returnAddress
|
|
25446
|
+
} = warehousePreference;
|
|
25447
|
+
if ((originAddress.validationType === "EXACT" || originAddress.validationType === "SOFT") && returnAddress && (returnAddress.validationType === "EXACT" || returnAddress.validationType === "SOFT")) {
|
|
25448
|
+
yield onSubmit({
|
|
25449
|
+
isDefault: !!warehousePreference.isDefault,
|
|
25450
|
+
name: warehousePreference.name,
|
|
25451
|
+
originAddress: originAddress.address,
|
|
25452
|
+
returnAddress: returnAddress.address
|
|
25453
|
+
});
|
|
25454
|
+
return;
|
|
25455
|
+
}
|
|
25456
|
+
if ((originAddress.validationType === "EXACT" || originAddress.validationType === "SOFT") && !returnAddress) {
|
|
25457
|
+
yield onSubmit({
|
|
25458
|
+
isDefault: !!warehousePreference.isDefault,
|
|
25459
|
+
name: warehousePreference.name,
|
|
25460
|
+
originAddress: originAddress.address
|
|
25461
|
+
});
|
|
25462
|
+
return;
|
|
25463
|
+
} else return;
|
|
25464
|
+
});
|
|
25465
|
+
return jsxRuntime.jsxs("div", Object.assign({
|
|
25466
|
+
className: className
|
|
25467
|
+
}, {
|
|
25468
|
+
children: [formHeader && formHeader, currentStep === 0 ? jsxRuntime.jsx(WarehouseForm, {
|
|
25469
|
+
isOnboarding: _isOnboarding,
|
|
25470
|
+
onCancel: onWarehouseFormCancel ? () => onWarehouseFormCancel() : undefined,
|
|
25471
|
+
onDelete: onWarehouseDelete ? () => onWarehouseDelete() : undefined,
|
|
25472
|
+
onSubmit: payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
25473
|
+
const result = yield onValidate(payload);
|
|
25474
|
+
yield checkForExactOrSoft(result);
|
|
25475
|
+
setCurrentStep(1);
|
|
25476
|
+
}),
|
|
25477
|
+
submitButtonTitle: submitButtonTitle,
|
|
25478
|
+
warehouse: warehouse
|
|
25479
|
+
}) : warehousePreference && jsxRuntime.jsx(WarehousePreferenceSelect, {
|
|
25480
|
+
onCancel: () => setCurrentStep(0),
|
|
25481
|
+
onSubmit: payload => {
|
|
25482
|
+
onSubmit({
|
|
25483
|
+
isDefault: !!warehousePreference.isDefault,
|
|
25484
|
+
name: warehousePreference.name,
|
|
25485
|
+
originAddress: payload.originAddress,
|
|
25486
|
+
returnAddress: payload.returnAddress
|
|
25487
|
+
});
|
|
25488
|
+
},
|
|
25489
|
+
originAddress: warehousePreference.originAddress,
|
|
25490
|
+
returnAddress: warehousePreference.returnAddress
|
|
25491
|
+
})]
|
|
25071
25492
|
}));
|
|
25072
25493
|
};
|
|
25073
25494
|
|
|
25495
|
+
const styles$4 = createStyles({
|
|
25496
|
+
cardSpacing: theme => ({
|
|
25497
|
+
display: "flex",
|
|
25498
|
+
flexDirection: "column",
|
|
25499
|
+
gap: theme.spacing(2)
|
|
25500
|
+
}),
|
|
25501
|
+
header: {
|
|
25502
|
+
textAlign: "left"
|
|
25503
|
+
},
|
|
25504
|
+
well: theme => ({
|
|
25505
|
+
backgroundColor: theme.palette.gray.ultraLight,
|
|
25506
|
+
padding: theme.spacing(2)
|
|
25507
|
+
})
|
|
25508
|
+
});
|
|
25509
|
+
|
|
25074
25510
|
const ManageWarehouses$1 = ({
|
|
25075
25511
|
errors,
|
|
25076
25512
|
onAdd,
|
|
25077
25513
|
onDelete,
|
|
25078
25514
|
onEdit,
|
|
25079
25515
|
onSetDefault,
|
|
25516
|
+
onValidate,
|
|
25517
|
+
setWarehousePreference,
|
|
25518
|
+
warehousePreference,
|
|
25080
25519
|
warehouses
|
|
25081
25520
|
}) => {
|
|
25082
25521
|
const {
|
|
@@ -25085,13 +25524,28 @@ const ManageWarehouses$1 = ({
|
|
|
25085
25524
|
const [editWarehouseId, setEditWarehouseId] = React.useState();
|
|
25086
25525
|
const [showAddNewWarehouseForm, toggleShowAddNewWarehouseForm] = useToggle(false);
|
|
25087
25526
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
25088
|
-
children: [showAddNewWarehouseForm ? jsxRuntime.jsx(
|
|
25089
|
-
|
|
25527
|
+
children: [showAddNewWarehouseForm ? jsxRuntime.jsx(WarehousePreferenceWizard, {
|
|
25528
|
+
css: styles$4.well,
|
|
25529
|
+
formHeader: jsxRuntime.jsxs("div", Object.assign({
|
|
25530
|
+
css: styles$4.header
|
|
25531
|
+
}, {
|
|
25532
|
+
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
25533
|
+
variant: "subtitle1"
|
|
25534
|
+
}, {
|
|
25535
|
+
children: t("manage-warehouses:addNew")
|
|
25536
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
25537
|
+
multiplier: 1
|
|
25538
|
+
})]
|
|
25539
|
+
})),
|
|
25090
25540
|
onSubmit: payload => {
|
|
25091
25541
|
onAdd(payload);
|
|
25092
25542
|
toggleShowAddNewWarehouseForm(false);
|
|
25543
|
+
setWarehousePreference(undefined);
|
|
25093
25544
|
},
|
|
25094
|
-
|
|
25545
|
+
onValidate: onValidate,
|
|
25546
|
+
onWarehouseFormCancel: () => toggleShowAddNewWarehouseForm(false),
|
|
25547
|
+
submitButtonTitle: t("actions.save"),
|
|
25548
|
+
warehousePreference: warehousePreference
|
|
25095
25549
|
}) : jsxRuntime.jsx(ButtonGroup, Object.assign({
|
|
25096
25550
|
justify: "end"
|
|
25097
25551
|
}, {
|
|
@@ -25110,26 +25564,37 @@ const ManageWarehouses$1 = ({
|
|
|
25110
25564
|
})]
|
|
25111
25565
|
}))
|
|
25112
25566
|
})), jsxRuntime.jsx("div", Object.assign({
|
|
25113
|
-
css:
|
|
25114
|
-
display: "flex",
|
|
25115
|
-
flexDirection: "column",
|
|
25116
|
-
gap: theme.spacing(2)
|
|
25117
|
-
})
|
|
25567
|
+
css: styles$4.cardSpacing
|
|
25118
25568
|
}, {
|
|
25119
25569
|
children: warehouses.sort((a, b) => {
|
|
25120
25570
|
if (b.isDefault) return 1;
|
|
25121
25571
|
return sortByCreationDate(a, b, "desc");
|
|
25122
25572
|
}).map(warehouse => {
|
|
25123
25573
|
if (editWarehouseId && editWarehouseId === warehouse.warehouseId) {
|
|
25124
|
-
return jsxRuntime.jsx(
|
|
25125
|
-
|
|
25126
|
-
|
|
25574
|
+
return jsxRuntime.jsx(WarehousePreferenceWizard, {
|
|
25575
|
+
css: styles$4.well,
|
|
25576
|
+
formHeader: jsxRuntime.jsxs("div", Object.assign({
|
|
25577
|
+
css: styles$4.header
|
|
25578
|
+
}, {
|
|
25579
|
+
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
25580
|
+
variant: "subtitle1"
|
|
25581
|
+
}, {
|
|
25582
|
+
children: t("manage-warehouses:editWarehouse")
|
|
25583
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
25584
|
+
multiplier: 1
|
|
25585
|
+
})]
|
|
25586
|
+
})),
|
|
25127
25587
|
onSubmit: payload => {
|
|
25128
25588
|
onEdit(payload, warehouse.warehouseId);
|
|
25129
25589
|
setEditWarehouseId(undefined);
|
|
25590
|
+
setWarehousePreference(undefined);
|
|
25130
25591
|
},
|
|
25592
|
+
onValidate: onValidate,
|
|
25593
|
+
onWarehouseDelete: warehouse.isDefault ? undefined : () => onDelete(warehouse.warehouseId),
|
|
25594
|
+
onWarehouseFormCancel: () => setEditWarehouseId(undefined),
|
|
25131
25595
|
submitButtonTitle: t("actions.save"),
|
|
25132
|
-
warehouse: warehouse
|
|
25596
|
+
warehouse: warehouse,
|
|
25597
|
+
warehousePreference: warehousePreference
|
|
25133
25598
|
}, warehouse.warehouseId);
|
|
25134
25599
|
} else {
|
|
25135
25600
|
return jsxRuntime.jsx(SettingsCard, Object.assign({
|
|
@@ -25159,10 +25624,10 @@ const ManageWarehouses$1 = ({
|
|
|
25159
25624
|
|
|
25160
25625
|
var getBuiltIn$3 = getBuiltIn$9;
|
|
25161
25626
|
var definePropertyModule = objectDefineProperty;
|
|
25162
|
-
var wellKnownSymbol$
|
|
25627
|
+
var wellKnownSymbol$3 = wellKnownSymbol$j;
|
|
25163
25628
|
var DESCRIPTORS = descriptors;
|
|
25164
25629
|
|
|
25165
|
-
var SPECIES$2 = wellKnownSymbol$
|
|
25630
|
+
var SPECIES$2 = wellKnownSymbol$3('species');
|
|
25166
25631
|
|
|
25167
25632
|
var setSpecies$1 = function (CONSTRUCTOR_NAME) {
|
|
25168
25633
|
var Constructor = getBuiltIn$3(CONSTRUCTOR_NAME);
|
|
@@ -25176,49 +25641,49 @@ var setSpecies$1 = function (CONSTRUCTOR_NAME) {
|
|
|
25176
25641
|
}
|
|
25177
25642
|
};
|
|
25178
25643
|
|
|
25179
|
-
var isPrototypeOf
|
|
25644
|
+
var isPrototypeOf = objectIsPrototypeOf;
|
|
25180
25645
|
|
|
25181
|
-
var $TypeError$
|
|
25646
|
+
var $TypeError$3 = TypeError;
|
|
25182
25647
|
|
|
25183
25648
|
var anInstance$1 = function (it, Prototype) {
|
|
25184
|
-
if (isPrototypeOf
|
|
25185
|
-
throw $TypeError$
|
|
25649
|
+
if (isPrototypeOf(Prototype, it)) return it;
|
|
25650
|
+
throw $TypeError$3('Incorrect invocation');
|
|
25186
25651
|
};
|
|
25187
25652
|
|
|
25188
25653
|
var isConstructor = isConstructor$2;
|
|
25189
|
-
var tryToString
|
|
25654
|
+
var tryToString = tryToString$5;
|
|
25190
25655
|
|
|
25191
|
-
var $TypeError$
|
|
25656
|
+
var $TypeError$2 = TypeError;
|
|
25192
25657
|
|
|
25193
25658
|
// `Assert: IsConstructor(argument) is true`
|
|
25194
25659
|
var aConstructor$1 = function (argument) {
|
|
25195
25660
|
if (isConstructor(argument)) return argument;
|
|
25196
|
-
throw $TypeError$
|
|
25661
|
+
throw $TypeError$2(tryToString(argument) + ' is not a constructor');
|
|
25197
25662
|
};
|
|
25198
25663
|
|
|
25199
|
-
var anObject$
|
|
25664
|
+
var anObject$1 = anObject$f;
|
|
25200
25665
|
var aConstructor = aConstructor$1;
|
|
25201
|
-
var isNullOrUndefined
|
|
25202
|
-
var wellKnownSymbol$
|
|
25666
|
+
var isNullOrUndefined = isNullOrUndefined$6;
|
|
25667
|
+
var wellKnownSymbol$2 = wellKnownSymbol$j;
|
|
25203
25668
|
|
|
25204
|
-
var SPECIES$1 = wellKnownSymbol$
|
|
25669
|
+
var SPECIES$1 = wellKnownSymbol$2('species');
|
|
25205
25670
|
|
|
25206
25671
|
// `SpeciesConstructor` abstract operation
|
|
25207
25672
|
// https://tc39.es/ecma262/#sec-speciesconstructor
|
|
25208
25673
|
var speciesConstructor$2 = function (O, defaultConstructor) {
|
|
25209
|
-
var C = anObject$
|
|
25674
|
+
var C = anObject$1(O).constructor;
|
|
25210
25675
|
var S;
|
|
25211
|
-
return C === undefined || isNullOrUndefined
|
|
25676
|
+
return C === undefined || isNullOrUndefined(S = anObject$1(C)[SPECIES$1]) ? defaultConstructor : aConstructor(S);
|
|
25212
25677
|
};
|
|
25213
25678
|
|
|
25214
25679
|
var uncurryThis$1 = functionUncurryThis;
|
|
25215
25680
|
|
|
25216
25681
|
var arraySlice$1 = uncurryThis$1([].slice);
|
|
25217
25682
|
|
|
25218
|
-
var $TypeError$
|
|
25683
|
+
var $TypeError$1 = TypeError;
|
|
25219
25684
|
|
|
25220
25685
|
var validateArgumentsLength$1 = function (passed, required) {
|
|
25221
|
-
if (passed < required) throw $TypeError$
|
|
25686
|
+
if (passed < required) throw $TypeError$1('Not enough arguments');
|
|
25222
25687
|
return passed;
|
|
25223
25688
|
};
|
|
25224
25689
|
|
|
@@ -25228,7 +25693,7 @@ var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$2);
|
|
|
25228
25693
|
|
|
25229
25694
|
var global$7 = global$p;
|
|
25230
25695
|
var apply = functionApply;
|
|
25231
|
-
var bind$
|
|
25696
|
+
var bind$2 = functionBindContext;
|
|
25232
25697
|
var isCallable$4 = isCallable$o;
|
|
25233
25698
|
var hasOwn = hasOwnProperty_1;
|
|
25234
25699
|
var fails$1 = fails$r;
|
|
@@ -25310,7 +25775,7 @@ if (!set || !clear) {
|
|
|
25310
25775
|
channel = new MessageChannel();
|
|
25311
25776
|
port = channel.port2;
|
|
25312
25777
|
channel.port1.onmessage = listener;
|
|
25313
|
-
defer = bind$
|
|
25778
|
+
defer = bind$2(port.postMessage, port);
|
|
25314
25779
|
// Browsers with postMessage, skip WebWorkers
|
|
25315
25780
|
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
|
|
25316
25781
|
} else if (
|
|
@@ -25353,7 +25818,7 @@ var userAgent = engineUserAgent;
|
|
|
25353
25818
|
var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(userAgent);
|
|
25354
25819
|
|
|
25355
25820
|
var global$5 = global$p;
|
|
25356
|
-
var bind$
|
|
25821
|
+
var bind$1 = functionBindContext;
|
|
25357
25822
|
var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
|
|
25358
25823
|
var macrotask = task$1.set;
|
|
25359
25824
|
var IS_IOS = engineIsIos;
|
|
@@ -25405,7 +25870,7 @@ if (!queueMicrotask) {
|
|
|
25405
25870
|
promise = Promise$1.resolve(undefined);
|
|
25406
25871
|
// workaround of WebKit ~ iOS Safari 10.1 bug
|
|
25407
25872
|
promise.constructor = Promise$1;
|
|
25408
|
-
then = bind$
|
|
25873
|
+
then = bind$1(promise.then, promise);
|
|
25409
25874
|
notify$1 = function () {
|
|
25410
25875
|
then(flush);
|
|
25411
25876
|
};
|
|
@@ -25422,7 +25887,7 @@ if (!queueMicrotask) {
|
|
|
25422
25887
|
// - setTimeout
|
|
25423
25888
|
} else {
|
|
25424
25889
|
// strange IE + webpack dev server bug - use .bind(global)
|
|
25425
|
-
macrotask = bind$
|
|
25890
|
+
macrotask = bind$1(macrotask, global$5);
|
|
25426
25891
|
notify$1 = function () {
|
|
25427
25892
|
macrotask(flush);
|
|
25428
25893
|
};
|
|
@@ -25499,13 +25964,13 @@ var NativePromiseConstructor$4 = promiseNativeConstructor;
|
|
|
25499
25964
|
var isCallable$3 = isCallable$o;
|
|
25500
25965
|
var isForced = isForced_1;
|
|
25501
25966
|
var inspectSource = inspectSource$3;
|
|
25502
|
-
var wellKnownSymbol$
|
|
25967
|
+
var wellKnownSymbol$1 = wellKnownSymbol$j;
|
|
25503
25968
|
var IS_BROWSER = engineIsBrowser;
|
|
25504
25969
|
var IS_DENO = engineIsDeno;
|
|
25505
25970
|
var V8_VERSION = engineV8Version;
|
|
25506
25971
|
|
|
25507
25972
|
NativePromiseConstructor$4 && NativePromiseConstructor$4.prototype;
|
|
25508
|
-
var SPECIES = wellKnownSymbol$
|
|
25973
|
+
var SPECIES = wellKnownSymbol$1('species');
|
|
25509
25974
|
var SUBCLASSING = false;
|
|
25510
25975
|
var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable$3(global$2.PromiseRejectionEvent);
|
|
25511
25976
|
|
|
@@ -25541,19 +26006,19 @@ var promiseConstructorDetection = {
|
|
|
25541
26006
|
|
|
25542
26007
|
var newPromiseCapability$2 = {};
|
|
25543
26008
|
|
|
25544
|
-
var aCallable$
|
|
26009
|
+
var aCallable$3 = aCallable$a;
|
|
25545
26010
|
|
|
25546
|
-
var $TypeError
|
|
26011
|
+
var $TypeError = TypeError;
|
|
25547
26012
|
|
|
25548
26013
|
var PromiseCapability = function (C) {
|
|
25549
26014
|
var resolve, reject;
|
|
25550
26015
|
this.promise = new C(function ($$resolve, $$reject) {
|
|
25551
|
-
if (resolve !== undefined || reject !== undefined) throw $TypeError
|
|
26016
|
+
if (resolve !== undefined || reject !== undefined) throw $TypeError('Bad Promise constructor');
|
|
25552
26017
|
resolve = $$resolve;
|
|
25553
26018
|
reject = $$reject;
|
|
25554
26019
|
});
|
|
25555
|
-
this.resolve = aCallable$
|
|
25556
|
-
this.reject = aCallable$
|
|
26020
|
+
this.resolve = aCallable$3(resolve);
|
|
26021
|
+
this.reject = aCallable$3(reject);
|
|
25557
26022
|
};
|
|
25558
26023
|
|
|
25559
26024
|
// `NewPromiseCapability` abstract operation
|
|
@@ -25565,12 +26030,12 @@ newPromiseCapability$2.f = function (C) {
|
|
|
25565
26030
|
var $$8 = _export;
|
|
25566
26031
|
var IS_NODE = engineIsNode;
|
|
25567
26032
|
var global$1 = global$p;
|
|
25568
|
-
var call$
|
|
26033
|
+
var call$3 = functionCall;
|
|
25569
26034
|
var defineBuiltIn$2 = defineBuiltIn$8;
|
|
25570
26035
|
var setPrototypeOf = objectSetPrototypeOf;
|
|
25571
26036
|
var setToStringTag = setToStringTag$3;
|
|
25572
26037
|
var setSpecies = setSpecies$1;
|
|
25573
|
-
var aCallable$
|
|
26038
|
+
var aCallable$2 = aCallable$a;
|
|
25574
26039
|
var isCallable$2 = isCallable$o;
|
|
25575
26040
|
var isObject$1 = isObject$a;
|
|
25576
26041
|
var anInstance = anInstance$1;
|
|
@@ -25643,7 +26108,7 @@ var callReaction = function (reaction, state) {
|
|
|
25643
26108
|
if (result === reaction.promise) {
|
|
25644
26109
|
reject(TypeError$1('Promise-chain cycle'));
|
|
25645
26110
|
} else if (then = isThenable(result)) {
|
|
25646
|
-
call$
|
|
26111
|
+
call$3(then, result, resolve, reject);
|
|
25647
26112
|
} else resolve(result);
|
|
25648
26113
|
} else reject(value);
|
|
25649
26114
|
} catch (error) {
|
|
@@ -25680,7 +26145,7 @@ var dispatchEvent = function (name, promise, reason) {
|
|
|
25680
26145
|
};
|
|
25681
26146
|
|
|
25682
26147
|
var onUnhandled = function (state) {
|
|
25683
|
-
call$
|
|
26148
|
+
call$3(task, global$1, function () {
|
|
25684
26149
|
var promise = state.facade;
|
|
25685
26150
|
var value = state.value;
|
|
25686
26151
|
var IS_UNHANDLED = isUnhandled(state);
|
|
@@ -25703,7 +26168,7 @@ var isUnhandled = function (state) {
|
|
|
25703
26168
|
};
|
|
25704
26169
|
|
|
25705
26170
|
var onHandleUnhandled = function (state) {
|
|
25706
|
-
call$
|
|
26171
|
+
call$3(task, global$1, function () {
|
|
25707
26172
|
var promise = state.facade;
|
|
25708
26173
|
if (IS_NODE) {
|
|
25709
26174
|
process$1.emit('rejectionHandled', promise);
|
|
@@ -25711,7 +26176,7 @@ var onHandleUnhandled = function (state) {
|
|
|
25711
26176
|
});
|
|
25712
26177
|
};
|
|
25713
26178
|
|
|
25714
|
-
var bind
|
|
26179
|
+
var bind = function (fn, state, unwrap) {
|
|
25715
26180
|
return function (value) {
|
|
25716
26181
|
fn(state, value, unwrap);
|
|
25717
26182
|
};
|
|
@@ -25737,9 +26202,9 @@ var internalResolve = function (state, value, unwrap) {
|
|
|
25737
26202
|
microtask(function () {
|
|
25738
26203
|
var wrapper = { done: false };
|
|
25739
26204
|
try {
|
|
25740
|
-
call$
|
|
25741
|
-
bind
|
|
25742
|
-
bind
|
|
26205
|
+
call$3(then, value,
|
|
26206
|
+
bind(internalResolve, wrapper, state),
|
|
26207
|
+
bind(internalReject, wrapper, state)
|
|
25743
26208
|
);
|
|
25744
26209
|
} catch (error) {
|
|
25745
26210
|
internalReject(wrapper, error, state);
|
|
@@ -25760,11 +26225,11 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
25760
26225
|
// 25.4.3.1 Promise(executor)
|
|
25761
26226
|
PromiseConstructor = function Promise(executor) {
|
|
25762
26227
|
anInstance(this, PromisePrototype);
|
|
25763
|
-
aCallable$
|
|
25764
|
-
call$
|
|
26228
|
+
aCallable$2(executor);
|
|
26229
|
+
call$3(Internal, this);
|
|
25765
26230
|
var state = getInternalPromiseState(this);
|
|
25766
26231
|
try {
|
|
25767
|
-
executor(bind
|
|
26232
|
+
executor(bind(internalResolve, state), bind(internalReject, state));
|
|
25768
26233
|
} catch (error) {
|
|
25769
26234
|
internalReject(state, error);
|
|
25770
26235
|
}
|
|
@@ -25806,8 +26271,8 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
25806
26271
|
var promise = new Internal();
|
|
25807
26272
|
var state = getInternalPromiseState(promise);
|
|
25808
26273
|
this.promise = promise;
|
|
25809
|
-
this.resolve = bind
|
|
25810
|
-
this.reject = bind
|
|
26274
|
+
this.resolve = bind(internalResolve, state);
|
|
26275
|
+
this.reject = bind(internalReject, state);
|
|
25811
26276
|
};
|
|
25812
26277
|
|
|
25813
26278
|
newPromiseCapabilityModule$3.f = newPromiseCapability$1 = function (C) {
|
|
@@ -25824,7 +26289,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
25824
26289
|
defineBuiltIn$2(NativePromisePrototype$2, 'then', function then(onFulfilled, onRejected) {
|
|
25825
26290
|
var that = this;
|
|
25826
26291
|
return new PromiseConstructor(function (resolve, reject) {
|
|
25827
|
-
call$
|
|
26292
|
+
call$3(nativeThen, that, resolve, reject);
|
|
25828
26293
|
}).then(onFulfilled, onRejected);
|
|
25829
26294
|
// https://github.com/zloirock/core-js/issues/640
|
|
25830
26295
|
}, { unsafe: true });
|
|
@@ -25849,138 +26314,6 @@ $$8({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTR
|
|
|
25849
26314
|
setToStringTag(PromiseConstructor, PROMISE, false);
|
|
25850
26315
|
setSpecies(PROMISE);
|
|
25851
26316
|
|
|
25852
|
-
var wellKnownSymbol$2 = wellKnownSymbol$j;
|
|
25853
|
-
var Iterators$1 = iterators;
|
|
25854
|
-
|
|
25855
|
-
var ITERATOR$2 = wellKnownSymbol$2('iterator');
|
|
25856
|
-
var ArrayPrototype = Array.prototype;
|
|
25857
|
-
|
|
25858
|
-
// check on default Array iterator
|
|
25859
|
-
var isArrayIteratorMethod$1 = function (it) {
|
|
25860
|
-
return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$2] === it);
|
|
25861
|
-
};
|
|
25862
|
-
|
|
25863
|
-
var classof = classof$6;
|
|
25864
|
-
var getMethod$1 = getMethod$5;
|
|
25865
|
-
var isNullOrUndefined = isNullOrUndefined$6;
|
|
25866
|
-
var Iterators = iterators;
|
|
25867
|
-
var wellKnownSymbol$1 = wellKnownSymbol$j;
|
|
25868
|
-
|
|
25869
|
-
var ITERATOR$1 = wellKnownSymbol$1('iterator');
|
|
25870
|
-
|
|
25871
|
-
var getIteratorMethod$2 = function (it) {
|
|
25872
|
-
if (!isNullOrUndefined(it)) return getMethod$1(it, ITERATOR$1)
|
|
25873
|
-
|| getMethod$1(it, '@@iterator')
|
|
25874
|
-
|| Iterators[classof(it)];
|
|
25875
|
-
};
|
|
25876
|
-
|
|
25877
|
-
var call$5 = functionCall;
|
|
25878
|
-
var aCallable$2 = aCallable$a;
|
|
25879
|
-
var anObject$3 = anObject$f;
|
|
25880
|
-
var tryToString$1 = tryToString$5;
|
|
25881
|
-
var getIteratorMethod$1 = getIteratorMethod$2;
|
|
25882
|
-
|
|
25883
|
-
var $TypeError$1 = TypeError;
|
|
25884
|
-
|
|
25885
|
-
var getIterator$1 = function (argument, usingIterator) {
|
|
25886
|
-
var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
|
|
25887
|
-
if (aCallable$2(iteratorMethod)) return anObject$3(call$5(iteratorMethod, argument));
|
|
25888
|
-
throw $TypeError$1(tryToString$1(argument) + ' is not iterable');
|
|
25889
|
-
};
|
|
25890
|
-
|
|
25891
|
-
var call$4 = functionCall;
|
|
25892
|
-
var anObject$2 = anObject$f;
|
|
25893
|
-
var getMethod = getMethod$5;
|
|
25894
|
-
|
|
25895
|
-
var iteratorClose$1 = function (iterator, kind, value) {
|
|
25896
|
-
var innerResult, innerError;
|
|
25897
|
-
anObject$2(iterator);
|
|
25898
|
-
try {
|
|
25899
|
-
innerResult = getMethod(iterator, 'return');
|
|
25900
|
-
if (!innerResult) {
|
|
25901
|
-
if (kind === 'throw') throw value;
|
|
25902
|
-
return value;
|
|
25903
|
-
}
|
|
25904
|
-
innerResult = call$4(innerResult, iterator);
|
|
25905
|
-
} catch (error) {
|
|
25906
|
-
innerError = true;
|
|
25907
|
-
innerResult = error;
|
|
25908
|
-
}
|
|
25909
|
-
if (kind === 'throw') throw value;
|
|
25910
|
-
if (innerError) throw innerResult;
|
|
25911
|
-
anObject$2(innerResult);
|
|
25912
|
-
return value;
|
|
25913
|
-
};
|
|
25914
|
-
|
|
25915
|
-
var bind = functionBindContext;
|
|
25916
|
-
var call$3 = functionCall;
|
|
25917
|
-
var anObject$1 = anObject$f;
|
|
25918
|
-
var tryToString = tryToString$5;
|
|
25919
|
-
var isArrayIteratorMethod = isArrayIteratorMethod$1;
|
|
25920
|
-
var lengthOfArrayLike$1 = lengthOfArrayLike$8;
|
|
25921
|
-
var isPrototypeOf = objectIsPrototypeOf;
|
|
25922
|
-
var getIterator = getIterator$1;
|
|
25923
|
-
var getIteratorMethod = getIteratorMethod$2;
|
|
25924
|
-
var iteratorClose = iteratorClose$1;
|
|
25925
|
-
|
|
25926
|
-
var $TypeError = TypeError;
|
|
25927
|
-
|
|
25928
|
-
var Result = function (stopped, result) {
|
|
25929
|
-
this.stopped = stopped;
|
|
25930
|
-
this.result = result;
|
|
25931
|
-
};
|
|
25932
|
-
|
|
25933
|
-
var ResultPrototype = Result.prototype;
|
|
25934
|
-
|
|
25935
|
-
var iterate$2 = function (iterable, unboundFunction, options) {
|
|
25936
|
-
var that = options && options.that;
|
|
25937
|
-
var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
|
25938
|
-
var IS_RECORD = !!(options && options.IS_RECORD);
|
|
25939
|
-
var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
|
25940
|
-
var INTERRUPTED = !!(options && options.INTERRUPTED);
|
|
25941
|
-
var fn = bind(unboundFunction, that);
|
|
25942
|
-
var iterator, iterFn, index, length, result, next, step;
|
|
25943
|
-
|
|
25944
|
-
var stop = function (condition) {
|
|
25945
|
-
if (iterator) iteratorClose(iterator, 'normal', condition);
|
|
25946
|
-
return new Result(true, condition);
|
|
25947
|
-
};
|
|
25948
|
-
|
|
25949
|
-
var callFn = function (value) {
|
|
25950
|
-
if (AS_ENTRIES) {
|
|
25951
|
-
anObject$1(value);
|
|
25952
|
-
return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
|
25953
|
-
} return INTERRUPTED ? fn(value, stop) : fn(value);
|
|
25954
|
-
};
|
|
25955
|
-
|
|
25956
|
-
if (IS_RECORD) {
|
|
25957
|
-
iterator = iterable.iterator;
|
|
25958
|
-
} else if (IS_ITERATOR) {
|
|
25959
|
-
iterator = iterable;
|
|
25960
|
-
} else {
|
|
25961
|
-
iterFn = getIteratorMethod(iterable);
|
|
25962
|
-
if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
|
|
25963
|
-
// optimisation for array iterators
|
|
25964
|
-
if (isArrayIteratorMethod(iterFn)) {
|
|
25965
|
-
for (index = 0, length = lengthOfArrayLike$1(iterable); length > index; index++) {
|
|
25966
|
-
result = callFn(iterable[index]);
|
|
25967
|
-
if (result && isPrototypeOf(ResultPrototype, result)) return result;
|
|
25968
|
-
} return new Result(false);
|
|
25969
|
-
}
|
|
25970
|
-
iterator = getIterator(iterable, iterFn);
|
|
25971
|
-
}
|
|
25972
|
-
|
|
25973
|
-
next = IS_RECORD ? iterable.next : iterator.next;
|
|
25974
|
-
while (!(step = call$3(next, iterator)).done) {
|
|
25975
|
-
try {
|
|
25976
|
-
result = callFn(step.value);
|
|
25977
|
-
} catch (error) {
|
|
25978
|
-
iteratorClose(iterator, 'throw', error);
|
|
25979
|
-
}
|
|
25980
|
-
if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
|
|
25981
|
-
} return new Result(false);
|
|
25982
|
-
};
|
|
25983
|
-
|
|
25984
26317
|
var wellKnownSymbol = wellKnownSymbol$j;
|
|
25985
26318
|
|
|
25986
26319
|
var ITERATOR = wellKnownSymbol('iterator');
|
|
@@ -26033,7 +26366,7 @@ var call$2 = functionCall;
|
|
|
26033
26366
|
var aCallable$1 = aCallable$a;
|
|
26034
26367
|
var newPromiseCapabilityModule$2 = newPromiseCapability$2;
|
|
26035
26368
|
var perform$1 = perform$3;
|
|
26036
|
-
var iterate$1 = iterate$
|
|
26369
|
+
var iterate$1 = iterate$3;
|
|
26037
26370
|
var PROMISE_STATICS_INCORRECT_ITERATION$1 = promiseStaticsIncorrectIteration;
|
|
26038
26371
|
|
|
26039
26372
|
// `Promise.all` method
|
|
@@ -26097,7 +26430,7 @@ var call$1 = functionCall;
|
|
|
26097
26430
|
var aCallable = aCallable$a;
|
|
26098
26431
|
var newPromiseCapabilityModule$1 = newPromiseCapability$2;
|
|
26099
26432
|
var perform = perform$3;
|
|
26100
|
-
var iterate = iterate$
|
|
26433
|
+
var iterate = iterate$3;
|
|
26101
26434
|
var PROMISE_STATICS_INCORRECT_ITERATION = promiseStaticsIncorrectIteration;
|
|
26102
26435
|
|
|
26103
26436
|
// `Promise.race` method
|
|
@@ -26408,7 +26741,7 @@ const EditWalletAddressForm = ({
|
|
|
26408
26741
|
}));
|
|
26409
26742
|
};
|
|
26410
26743
|
|
|
26411
|
-
const styles$
|
|
26744
|
+
const styles$3 = createStyles({
|
|
26412
26745
|
grid: theme => ({
|
|
26413
26746
|
margin: theme.spacing(4)
|
|
26414
26747
|
}),
|
|
@@ -26460,21 +26793,21 @@ const WalletForm = ({
|
|
|
26460
26793
|
onSubmit: formLogger.capture(handleSubmit)
|
|
26461
26794
|
}, {
|
|
26462
26795
|
children: jsxRuntime.jsxs(giger.Grid, Object.assign({
|
|
26463
|
-
css: styles$
|
|
26796
|
+
css: styles$3.grid,
|
|
26464
26797
|
noPadding: true
|
|
26465
26798
|
}, {
|
|
26466
26799
|
children: [jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26467
26800
|
colSpan: 12
|
|
26468
26801
|
}, {
|
|
26469
26802
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
26470
|
-
css: styles$
|
|
26803
|
+
css: styles$3.heading,
|
|
26471
26804
|
variant: "heading4"
|
|
26472
26805
|
}, {
|
|
26473
26806
|
children: t("register-wallet:sections.billing.title")
|
|
26474
26807
|
}))
|
|
26475
26808
|
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26476
26809
|
colSpan: 12,
|
|
26477
|
-
css: styles$
|
|
26810
|
+
css: styles$3.subtitle
|
|
26478
26811
|
}, {
|
|
26479
26812
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
26480
26813
|
variant: "subtitle1"
|
|
@@ -26507,7 +26840,7 @@ const WalletForm = ({
|
|
|
26507
26840
|
colSpan: 12
|
|
26508
26841
|
}, {
|
|
26509
26842
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
26510
|
-
css: styles$
|
|
26843
|
+
css: styles$3.subtitle,
|
|
26511
26844
|
variant: "subtitle1"
|
|
26512
26845
|
}, {
|
|
26513
26846
|
children: t("register-wallet:sections.billing.addressSubTitle")
|
|
@@ -26563,7 +26896,7 @@ const WalletForm = ({
|
|
|
26563
26896
|
}));
|
|
26564
26897
|
};
|
|
26565
26898
|
|
|
26566
|
-
const styles$
|
|
26899
|
+
const styles$2 = createStyles({
|
|
26567
26900
|
step: {
|
|
26568
26901
|
"& > span:last-child": {
|
|
26569
26902
|
position: "static"
|
|
@@ -26581,6 +26914,9 @@ const Onboarding$1 = ({
|
|
|
26581
26914
|
createWarehouse,
|
|
26582
26915
|
onCarrierCreated,
|
|
26583
26916
|
onWarehouseCreated,
|
|
26917
|
+
onValidateWarehouse,
|
|
26918
|
+
warehousePreference,
|
|
26919
|
+
setWarehousePreference,
|
|
26584
26920
|
onCompleteOnboarding,
|
|
26585
26921
|
registerDhlCarrier,
|
|
26586
26922
|
registerDhlCarrierErrors,
|
|
@@ -26588,7 +26924,8 @@ const Onboarding$1 = ({
|
|
|
26588
26924
|
registerStampsCarrierErrors,
|
|
26589
26925
|
registerUpsCarrier,
|
|
26590
26926
|
registerUpsCarrierErrors,
|
|
26591
|
-
warehouses
|
|
26927
|
+
warehouses,
|
|
26928
|
+
validationErrors
|
|
26592
26929
|
}) => {
|
|
26593
26930
|
const {
|
|
26594
26931
|
t
|
|
@@ -26641,6 +26978,7 @@ const Onboarding$1 = ({
|
|
|
26641
26978
|
const handleCreateWarehouse = payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
26642
26979
|
const result = yield createWarehouse(payload);
|
|
26643
26980
|
if (result) yield onWarehouseCreated();
|
|
26981
|
+
setHasValidAddress(true);
|
|
26644
26982
|
});
|
|
26645
26983
|
const handleWalletRegistration = ({
|
|
26646
26984
|
address,
|
|
@@ -26686,14 +27024,34 @@ const Onboarding$1 = ({
|
|
|
26686
27024
|
}
|
|
26687
27025
|
if (agreedToTerms && !warehouses.length && !hasValidAddress) {
|
|
26688
27026
|
// Step 3: Add Ship From (Warehouse) Address
|
|
26689
|
-
return jsxRuntime.jsx(
|
|
27027
|
+
return jsxRuntime.jsx(WarehousePreferenceWizard, {
|
|
27028
|
+
formHeader: jsxRuntime.jsxs("div", Object.assign({
|
|
27029
|
+
css: {
|
|
27030
|
+
textAlign: "center"
|
|
27031
|
+
}
|
|
27032
|
+
}, {
|
|
27033
|
+
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
27034
|
+
variant: "heading4"
|
|
27035
|
+
}, {
|
|
27036
|
+
children: t("onboarding:warehouse.title")
|
|
27037
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
27038
|
+
multiplier: 2
|
|
27039
|
+
}), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
27040
|
+
variant: "subtitle1"
|
|
27041
|
+
}, {
|
|
27042
|
+
children: t("onboarding:warehouse.subtitle")
|
|
27043
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
27044
|
+
multiplier: 1
|
|
27045
|
+
})]
|
|
27046
|
+
})),
|
|
26690
27047
|
isOnboarding: true,
|
|
26691
27048
|
onSubmit: payload => {
|
|
26692
27049
|
handleCreateWarehouse(payload);
|
|
26693
|
-
|
|
26694
|
-
// Step 3.1: TODO: LMNT-815 Validate Address
|
|
27050
|
+
setWarehousePreference(undefined);
|
|
26695
27051
|
},
|
|
26696
|
-
|
|
27052
|
+
onValidate: onValidateWarehouse,
|
|
27053
|
+
submitButtonTitle: t("actions.continue"),
|
|
27054
|
+
warehousePreference: warehousePreference
|
|
26697
27055
|
});
|
|
26698
27056
|
}
|
|
26699
27057
|
// Step 4: Register Stamps Wallet, UPS, DHL
|
|
@@ -26733,22 +27091,22 @@ const Onboarding$1 = ({
|
|
|
26733
27091
|
return jsxRuntime.jsx(Loader, {});
|
|
26734
27092
|
};
|
|
26735
27093
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
26736
|
-
css: styles$
|
|
27094
|
+
css: styles$2.wrapper
|
|
26737
27095
|
}, {
|
|
26738
27096
|
children: [jsxRuntime.jsxs(giger.Stepper, Object.assign({
|
|
26739
27097
|
currentStep: currentStep
|
|
26740
27098
|
}, {
|
|
26741
27099
|
children: [jsxRuntime.jsx(giger.Step, {
|
|
26742
|
-
css: styles$
|
|
27100
|
+
css: styles$2.step,
|
|
26743
27101
|
label: t("onboarding:steps.login")
|
|
26744
27102
|
}), jsxRuntime.jsx(giger.Step, {
|
|
26745
|
-
css: styles$
|
|
27103
|
+
css: styles$2.step,
|
|
26746
27104
|
label: t("onboarding:steps.carriers")
|
|
26747
27105
|
}), jsxRuntime.jsx(giger.Step, {
|
|
26748
|
-
css: styles$
|
|
27106
|
+
css: styles$2.step,
|
|
26749
27107
|
label: t("onboarding:steps.addresses")
|
|
26750
27108
|
}), jsxRuntime.jsx(giger.Step, {
|
|
26751
|
-
css: styles$
|
|
27109
|
+
css: styles$2.step,
|
|
26752
27110
|
label: t("onboarding:steps.payment")
|
|
26753
27111
|
})]
|
|
26754
27112
|
})), renderStep()]
|
|
@@ -26956,16 +27314,20 @@ const AddFundsForm = ({
|
|
|
26956
27314
|
});
|
|
26957
27315
|
const {
|
|
26958
27316
|
isSubmitted,
|
|
27317
|
+
isSubmitting,
|
|
26959
27318
|
isValid
|
|
26960
27319
|
} = form.formState;
|
|
26961
27320
|
const watchAmount = form.watch("funds").amount;
|
|
26962
27321
|
const formId = "add-funds-form";
|
|
26963
|
-
const handleSubmit = formLogger.capture(form.handleSubmit(values => {
|
|
27322
|
+
const handleSubmit = formLogger.capture(form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
26964
27323
|
const payload = values;
|
|
26965
|
-
|
|
26966
|
-
|
|
26967
|
-
|
|
26968
|
-
|
|
27324
|
+
try {
|
|
27325
|
+
yield addFunds.mutateAsync(payload);
|
|
27326
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
27327
|
+
} catch (_a) {
|
|
27328
|
+
// Noop; errors available on RQ object
|
|
27329
|
+
}
|
|
27330
|
+
})));
|
|
26969
27331
|
if (carrier.isLoading) return jsxRuntime.jsx(Loader, {
|
|
26970
27332
|
message: t("loading.carrier")
|
|
26971
27333
|
});
|
|
@@ -27040,6 +27402,7 @@ const AddFundsForm = ({
|
|
|
27040
27402
|
justify: "end"
|
|
27041
27403
|
}, {
|
|
27042
27404
|
children: [onCancel && jsxRuntime.jsx(giger.Button, Object.assign({
|
|
27405
|
+
disabled: isSubmitting,
|
|
27043
27406
|
onClick: onCancel,
|
|
27044
27407
|
variant: giger.ButtonVariant.TEXT
|
|
27045
27408
|
}, {
|
|
@@ -27047,7 +27410,6 @@ const AddFundsForm = ({
|
|
|
27047
27410
|
})), jsxRuntime.jsx(SubmitButton, Object.assign({
|
|
27048
27411
|
control: form.control,
|
|
27049
27412
|
form: formId,
|
|
27050
|
-
isLoading: addFunds.isLoading,
|
|
27051
27413
|
variant: giger.ButtonVariant.OUTLINED
|
|
27052
27414
|
}, {
|
|
27053
27415
|
children: t("manage-funding:actions.addNow")
|
|
@@ -27066,7 +27428,7 @@ const AddFundsForm = ({
|
|
|
27066
27428
|
}), children === null || children === void 0 ? void 0 : children({
|
|
27067
27429
|
isCustomAmount: selectedChip.value === "custom",
|
|
27068
27430
|
isSubmitted,
|
|
27069
|
-
isSubmitting
|
|
27431
|
+
isSubmitting,
|
|
27070
27432
|
isValid,
|
|
27071
27433
|
selectedAmount: watchAmount,
|
|
27072
27434
|
submit: handleSubmit
|
|
@@ -27138,6 +27500,9 @@ const LinkAction = _a => {
|
|
|
27138
27500
|
return jsxRuntime.jsx(giger.Link, Object.assign({}, props, {
|
|
27139
27501
|
bold: true,
|
|
27140
27502
|
css: theme => [{
|
|
27503
|
+
"&&&": {
|
|
27504
|
+
textDecoration: "none"
|
|
27505
|
+
},
|
|
27141
27506
|
alignItems: "center",
|
|
27142
27507
|
display: "flex",
|
|
27143
27508
|
gap: theme.spacing(1)
|
|
@@ -27204,6 +27569,7 @@ const getStyles$1 = isCustomAmount => createStyles({
|
|
|
27204
27569
|
const FundAndPurchase = ({
|
|
27205
27570
|
carrierId,
|
|
27206
27571
|
className,
|
|
27572
|
+
control,
|
|
27207
27573
|
disabled,
|
|
27208
27574
|
isFundingEnabled,
|
|
27209
27575
|
isFundingRequired,
|
|
@@ -27219,11 +27585,11 @@ const FundAndPurchase = ({
|
|
|
27219
27585
|
data: carrier,
|
|
27220
27586
|
isLoading: isLoadingCarrier
|
|
27221
27587
|
} = react.useGetCarrierById(carrierId);
|
|
27222
|
-
const
|
|
27223
|
-
|
|
27224
|
-
|
|
27225
|
-
|
|
27226
|
-
|
|
27588
|
+
const {
|
|
27589
|
+
isSubmitting: isRateFormSubmitting,
|
|
27590
|
+
isValid: isRateFormValid
|
|
27591
|
+
} = reactHookForm.useFormState({
|
|
27592
|
+
control
|
|
27227
27593
|
});
|
|
27228
27594
|
const [isSavingRate, setIsSavingRate] = React.useState(false);
|
|
27229
27595
|
const handleSaveRate = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -27241,7 +27607,7 @@ const FundAndPurchase = ({
|
|
|
27241
27607
|
children: [jsxRuntime.jsx(giger.Button, Object.assign({
|
|
27242
27608
|
bold: false,
|
|
27243
27609
|
css: getStyles$1().saveRateButton,
|
|
27244
|
-
disabled: disabled || !carrierId ||
|
|
27610
|
+
disabled: disabled || !carrierId || addFundsForm.isSubmitting || isRateFormSubmitting,
|
|
27245
27611
|
isLoading: isSavingRate,
|
|
27246
27612
|
onClick: handleSaveRate,
|
|
27247
27613
|
variant: giger.ButtonVariant.OUTLINED
|
|
@@ -27249,8 +27615,8 @@ const FundAndPurchase = ({
|
|
|
27249
27615
|
children: t("purchase-label:actions.saveRate")
|
|
27250
27616
|
})), jsxRuntime.jsx(giger.Button, Object.assign({
|
|
27251
27617
|
"data-testid": "submit-fund-and-purchase",
|
|
27252
|
-
disabled: disabled || !carrierId || isFundingEnabled && isFundingRequired && isAddFundsFormOpen && addFundsForm.isSubmitted && !addFundsForm.isValid,
|
|
27253
|
-
isLoading: addFundsForm.isSubmitting ||
|
|
27618
|
+
disabled: disabled || !carrierId || !isRateFormValid || isFundingEnabled && isFundingRequired && isAddFundsFormOpen && addFundsForm.isSubmitted && !addFundsForm.isValid,
|
|
27619
|
+
isLoading: addFundsForm.isSubmitting || isRateFormSubmitting,
|
|
27254
27620
|
onClick: isAddFundsFormOpen ? addFundsForm.submit : onPurchase
|
|
27255
27621
|
}, {
|
|
27256
27622
|
children: isAddFundsFormOpen ? t("manage-funding:actions.addFundsAndPurchase") : t("purchase-label:actions.purchaseNow")
|
|
@@ -27269,10 +27635,6 @@ const FundAndPurchase = ({
|
|
|
27269
27635
|
});
|
|
27270
27636
|
if (!carrier || !carrierId) throw new Error("errorMessages.unableToLoad.carrier");
|
|
27271
27637
|
const balance = carrier.balance;
|
|
27272
|
-
const handleAddFundsSuccess = () => {
|
|
27273
|
-
setIsAddFundsFormOpen(false);
|
|
27274
|
-
onPurchase();
|
|
27275
|
-
};
|
|
27276
27638
|
// Render: walleted carrier, but funding feature is not enabled;
|
|
27277
27639
|
// show balance, but not the funding form.
|
|
27278
27640
|
if (!isFundingEnabled) return jsxRuntime.jsxs("div", Object.assign({
|
|
@@ -27296,7 +27658,7 @@ const FundAndPurchase = ({
|
|
|
27296
27658
|
carrierId: carrierId
|
|
27297
27659
|
}), jsxRuntime.jsx(LinkAction, {
|
|
27298
27660
|
icon: "add",
|
|
27299
|
-
isDisabled: isAddFundsFormOpen ||
|
|
27661
|
+
isDisabled: isAddFundsFormOpen || isRateFormSubmitting,
|
|
27300
27662
|
onClick: () => setIsAddFundsFormOpen(true),
|
|
27301
27663
|
title: t("manage-funding:actions.addFunds")
|
|
27302
27664
|
})]
|
|
@@ -27314,7 +27676,7 @@ const FundAndPurchase = ({
|
|
|
27314
27676
|
}), isAddFundsFormOpen ? jsxRuntime.jsx(AddFundsForm, Object.assign({
|
|
27315
27677
|
carrierId: carrierId,
|
|
27316
27678
|
minimumAmount: purchaseAmount - balance,
|
|
27317
|
-
onSuccess:
|
|
27679
|
+
onSuccess: onPurchase
|
|
27318
27680
|
}, {
|
|
27319
27681
|
children: addFundsForm => {
|
|
27320
27682
|
var _a, _b;
|
|
@@ -27348,6 +27710,7 @@ const FundAndPurchase = ({
|
|
|
27348
27710
|
justify: "end"
|
|
27349
27711
|
}, {
|
|
27350
27712
|
children: jsxRuntime.jsx(giger.Button, Object.assign({
|
|
27713
|
+
disabled: addFundsForm.isSubmitting || isRateFormSubmitting,
|
|
27351
27714
|
onClick: () => setIsAddFundsFormOpen(false),
|
|
27352
27715
|
variant: giger.ButtonVariant.TEXT
|
|
27353
27716
|
}, {
|
|
@@ -27359,11 +27722,11 @@ const FundAndPurchase = ({
|
|
|
27359
27722
|
}), renderActionButtons(addFundsForm)]
|
|
27360
27723
|
});
|
|
27361
27724
|
}
|
|
27362
|
-
})) : renderActionButtons()]
|
|
27725
|
+
}), purchaseAmount) : renderActionButtons()]
|
|
27363
27726
|
}));
|
|
27364
27727
|
};
|
|
27365
27728
|
|
|
27366
|
-
const styles = createStyles({
|
|
27729
|
+
const styles$1 = createStyles({
|
|
27367
27730
|
fundAndPurchase: theme => ({
|
|
27368
27731
|
borderTop: `1px solid ${theme.palette.gray.ultraLight}`
|
|
27369
27732
|
}),
|
|
@@ -27409,6 +27772,7 @@ const RateForm = ({
|
|
|
27409
27772
|
const {
|
|
27410
27773
|
t
|
|
27411
27774
|
} = reactI18next.useTranslation();
|
|
27775
|
+
const queryClient = reactQuery.useQueryClient();
|
|
27412
27776
|
const rateFormScrollToRef = React.useRef(null);
|
|
27413
27777
|
const [showHiddenRates, setShowHiddenRates] = React.useState(false);
|
|
27414
27778
|
const form = reactHookForm.useForm({
|
|
@@ -27426,7 +27790,18 @@ const RateForm = ({
|
|
|
27426
27790
|
} = form.watch("rate");
|
|
27427
27791
|
const handleSubmit = formLogger.capture(form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
27428
27792
|
const rateId = values;
|
|
27429
|
-
|
|
27793
|
+
try {
|
|
27794
|
+
yield onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(rateId);
|
|
27795
|
+
} finally {
|
|
27796
|
+
// Invalidate carrier queries after the rate form is submitted, regardless of success.
|
|
27797
|
+
// This allows the carrier balance to refresh if the purchase failed but funding succeeded.
|
|
27798
|
+
queryClient.invalidateQueries(["useGetCarrierById", selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.carrierId], {
|
|
27799
|
+
exact: true
|
|
27800
|
+
});
|
|
27801
|
+
queryClient.invalidateQueries(["useListCarriers"], {
|
|
27802
|
+
exact: true
|
|
27803
|
+
});
|
|
27804
|
+
}
|
|
27430
27805
|
})));
|
|
27431
27806
|
const rateOptions = useRateOptions(rates, carriers, shipment, features.enableGlobalPostFiltering
|
|
27432
27807
|
// TODO: LMNT-677: fix RecommendedRate logic
|
|
@@ -27502,7 +27877,7 @@ const RateForm = ({
|
|
|
27502
27877
|
onClick: onSelectRate,
|
|
27503
27878
|
options: showHiddenRates ? rateOptions : filteredRateOptions
|
|
27504
27879
|
}), rateOptions.some(option => option.requiresAcknowledgement) && rateOptions.length > 5 && jsxRuntime.jsx(giger.Link, Object.assign({
|
|
27505
|
-
css: styles.showMoreOrLessRatesButton,
|
|
27880
|
+
css: styles$1.showMoreOrLessRatesButton,
|
|
27506
27881
|
onClick: () => {
|
|
27507
27882
|
var _a;
|
|
27508
27883
|
setShowHiddenRates(!showHiddenRates);
|
|
@@ -27523,7 +27898,7 @@ const RateForm = ({
|
|
|
27523
27898
|
}))
|
|
27524
27899
|
}))]
|
|
27525
27900
|
}) : !isLoading && errors && !!errors.length ? null : jsxRuntime.jsxs("article", Object.assign({
|
|
27526
|
-
css: styles.ratesInterstitial,
|
|
27901
|
+
css: styles$1.ratesInterstitial,
|
|
27527
27902
|
role: "presentation"
|
|
27528
27903
|
}, {
|
|
27529
27904
|
children: [jsxRuntime.jsx(Cube, {
|
|
@@ -27543,7 +27918,8 @@ const RateForm = ({
|
|
|
27543
27918
|
})]
|
|
27544
27919
|
})), jsxRuntime.jsx(FundAndPurchase, {
|
|
27545
27920
|
carrierId: selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.carrierId,
|
|
27546
|
-
|
|
27921
|
+
control: form.control,
|
|
27922
|
+
css: styles$1.fundAndPurchase,
|
|
27547
27923
|
disabled: disabled,
|
|
27548
27924
|
isFundingEnabled: features === null || features === void 0 ? void 0 : features.enableFunding,
|
|
27549
27925
|
isFundingRequired: (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.balance) !== undefined && !!selectedRate.requiresFundedAmount,
|
|
@@ -27978,7 +28354,7 @@ const getShipmentSchema = ({
|
|
|
27978
28354
|
}).nullish(),
|
|
27979
28355
|
shipDate: zod.z.string(),
|
|
27980
28356
|
shipmentId: zod.z.string().nullishDefault(undefined),
|
|
27981
|
-
warehouseId: zod.z.string().refine(warehouseId => {
|
|
28357
|
+
warehouseId: zod.z.string().refine(warehouseId => !!warehouseId, "purchase-label:schemaErrors.shipFromAddressRequired").refine(warehouseId => {
|
|
27982
28358
|
var _a;
|
|
27983
28359
|
return allowInternationalShipFrom || ((_a = warehouses === null || warehouses === void 0 ? void 0 : warehouses.find(w => w.warehouseId === warehouseId)) === null || _a === void 0 ? void 0 : _a.originAddress.countryCode) === "US";
|
|
27984
28360
|
}, "purchase-label:schemaErrors.shipFromUnitedStatesOnly")
|
|
@@ -28251,9 +28627,10 @@ const ShipmentForm = ({
|
|
|
28251
28627
|
// When shipment is first loaded, hydrate the entire form
|
|
28252
28628
|
useRunOnceOnTrue(shipment && (() => hydrateShipment(shipment)));
|
|
28253
28629
|
React.useEffect(() => {
|
|
28254
|
-
var _a, _b;
|
|
28630
|
+
var _a, _b, _c, _d;
|
|
28255
28631
|
if (!shipment && (warehouses === null || warehouses === void 0 ? void 0 : warehouses.length)) {
|
|
28256
|
-
const defaultWarehouse = (_b = (_a = warehouses.find(w => w.warehouseId === warehouseId)) === null || _a === void 0 ? void 0 : _a.warehouseId) !== null && _b !== void 0 ? _b : warehouses[0].warehouseId;
|
|
28632
|
+
const defaultWarehouse = (_d = (_b = (_a = warehouses.find(w => w.warehouseId === warehouseId)) === null || _a === void 0 ? void 0 : _a.warehouseId) !== null && _b !== void 0 ? _b : (_c = warehouses.find(w => w.isDefault)) === null || _c === void 0 ? void 0 : _c.warehouseId) !== null && _d !== void 0 ? _d : warehouses[0].warehouseId;
|
|
28633
|
+
// There will always be a default warehouse, but TS doesn't know that
|
|
28257
28634
|
form.setValue("warehouseId", defaultWarehouse);
|
|
28258
28635
|
}
|
|
28259
28636
|
}, [form, shipment, warehouseId, warehouses]);
|
|
@@ -28980,22 +29357,126 @@ const SuspendShipment = ({
|
|
|
28980
29357
|
isLoading,
|
|
28981
29358
|
shipment
|
|
28982
29359
|
}) => {
|
|
28983
|
-
const {
|
|
28984
|
-
t
|
|
28985
|
-
} = reactI18next.useTranslation(["common", "purchase-label"]);
|
|
28986
|
-
if (isLoading) return jsxRuntime.jsx(Loader, {
|
|
28987
|
-
message: t("loading.shipment")
|
|
29360
|
+
const {
|
|
29361
|
+
t
|
|
29362
|
+
} = reactI18next.useTranslation(["common", "purchase-label"]);
|
|
29363
|
+
if (isLoading) return jsxRuntime.jsx(Loader, {
|
|
29364
|
+
message: t("loading.shipment")
|
|
29365
|
+
});
|
|
29366
|
+
if (errors) throw new Error(errors.map(e => e.message).join(", "));
|
|
29367
|
+
if (!shipment) throw new Error("errorMessages.unableToLoad.shipment");
|
|
29368
|
+
return jsxRuntime.jsx("div", Object.assign({
|
|
29369
|
+
css: {
|
|
29370
|
+
height: "100%",
|
|
29371
|
+
width: "100%"
|
|
29372
|
+
}
|
|
29373
|
+
}, {
|
|
29374
|
+
children: children
|
|
29375
|
+
}));
|
|
29376
|
+
};
|
|
29377
|
+
|
|
29378
|
+
const styles = createStyles({
|
|
29379
|
+
dateRangeInput: theme => ({
|
|
29380
|
+
width: theme.spacing(30)
|
|
29381
|
+
})
|
|
29382
|
+
});
|
|
29383
|
+
|
|
29384
|
+
const HistoryActions = () => {
|
|
29385
|
+
const {
|
|
29386
|
+
t
|
|
29387
|
+
} = reactI18next.useTranslation();
|
|
29388
|
+
const selectOptions = React.useMemo(() => [{
|
|
29389
|
+
label: t("wallet-history:historyOptions.custom"),
|
|
29390
|
+
value: t("wallet-history:historyOptions.custom")
|
|
29391
|
+
}, {
|
|
29392
|
+
label: t("wallet-history:historyOptions.last30days"),
|
|
29393
|
+
value: t("wallet-history:historyOptions.last30days")
|
|
29394
|
+
}, {
|
|
29395
|
+
label: t("wallet-history:historyOptions.thisMonth"),
|
|
29396
|
+
value: t("wallet-history:historyOptions.thisMonth")
|
|
29397
|
+
}, {
|
|
29398
|
+
label: t("wallet-history:historyOptions.lastMonth"),
|
|
29399
|
+
value: t("wallet-history:historyOptions.lastMonth")
|
|
29400
|
+
}], [t]);
|
|
29401
|
+
const [selectValue, setSelectValue] = React.useState();
|
|
29402
|
+
return jsxRuntime.jsxs(Spread, {
|
|
29403
|
+
children: [jsxRuntime.jsx(giger.Select, Object.assign({
|
|
29404
|
+
css: styles.dateRangeInput,
|
|
29405
|
+
label: "Date range",
|
|
29406
|
+
leftContent: jsxRuntime.jsx(giger.Icon, {
|
|
29407
|
+
name: brands.IconNames.FILTER
|
|
29408
|
+
}),
|
|
29409
|
+
name: "date-range-select",
|
|
29410
|
+
onChange: newValue => setSelectValue(newValue),
|
|
29411
|
+
onClear: c => console.log("SELECT ON CLEAR CALLBACK:", c)
|
|
29412
|
+
}, {
|
|
29413
|
+
children: selectOptions.map(item => jsxRuntime.jsx(giger.Option, Object.assign({
|
|
29414
|
+
value: item.value
|
|
29415
|
+
}, {
|
|
29416
|
+
children: item.label
|
|
29417
|
+
}), item.value))
|
|
29418
|
+
})), jsxRuntime.jsx(LinkAction, {
|
|
29419
|
+
onClick: x => console.log("Downloaded a CSV!", x),
|
|
29420
|
+
title: t("wallet-history:actions.downloadCsv")
|
|
29421
|
+
})]
|
|
29422
|
+
});
|
|
29423
|
+
};
|
|
29424
|
+
|
|
29425
|
+
const HistoryRow = ({
|
|
29426
|
+
key,
|
|
29427
|
+
rowItem
|
|
29428
|
+
}) => jsxRuntime.jsx("div", {
|
|
29429
|
+
children: "History Row Component"
|
|
29430
|
+
});
|
|
29431
|
+
|
|
29432
|
+
/**
|
|
29433
|
+
* This component is the list of events that represent the history of a
|
|
29434
|
+
* specific entity. The events are displayed in reverse chronological order.
|
|
29435
|
+
*
|
|
29436
|
+
* @param historyData The history data to display.
|
|
29437
|
+
*/
|
|
29438
|
+
const HistoryList = ({
|
|
29439
|
+
historyData
|
|
29440
|
+
}) => {
|
|
29441
|
+
console.table(historyData);
|
|
29442
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
29443
|
+
children: [1, 2, 3].map((item, idx) => {
|
|
29444
|
+
return jsxRuntime.jsx(HistoryRow, {
|
|
29445
|
+
rowItem: item
|
|
29446
|
+
}, idx);
|
|
29447
|
+
})
|
|
29448
|
+
});
|
|
29449
|
+
};
|
|
29450
|
+
|
|
29451
|
+
const HistoryBody = ({
|
|
29452
|
+
historyData
|
|
29453
|
+
}) => {
|
|
29454
|
+
const [page, setPage] = React.useState(1);
|
|
29455
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
29456
|
+
children: [jsxRuntime.jsx(HistoryActions, {}), jsxRuntime.jsx(HistoryList, {
|
|
29457
|
+
historyData: historyData
|
|
29458
|
+
}), jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
29459
|
+
children: [jsxRuntime.jsxs("p", {
|
|
29460
|
+
children: ["Page ", jsxRuntime.jsx("strong", {
|
|
29461
|
+
children: page
|
|
29462
|
+
}), " selected."]
|
|
29463
|
+
}), jsxRuntime.jsx(giger.Pagination, {
|
|
29464
|
+
boundaryPagesToShow: 7,
|
|
29465
|
+
currentPage: page,
|
|
29466
|
+
onPageChange: selectedPage => setPage(selectedPage),
|
|
29467
|
+
siblingCount: 2,
|
|
29468
|
+
totalPages: 20
|
|
29469
|
+
})]
|
|
29470
|
+
})]
|
|
29471
|
+
});
|
|
29472
|
+
};
|
|
29473
|
+
|
|
29474
|
+
const WalletHistory$1 = ({
|
|
29475
|
+
historyData
|
|
29476
|
+
}) => {
|
|
29477
|
+
return jsxRuntime.jsx(HistoryBody, {
|
|
29478
|
+
historyData: historyData
|
|
28988
29479
|
});
|
|
28989
|
-
if (errors) throw new Error(errors.map(e => e.message).join(", "));
|
|
28990
|
-
if (!shipment) throw new Error("errorMessages.unableToLoad.shipment");
|
|
28991
|
-
return jsxRuntime.jsx("div", Object.assign({
|
|
28992
|
-
css: {
|
|
28993
|
-
height: "100%",
|
|
28994
|
-
width: "100%"
|
|
28995
|
-
}
|
|
28996
|
-
}, {
|
|
28997
|
-
children: children
|
|
28998
|
-
}));
|
|
28999
29480
|
};
|
|
29000
29481
|
|
|
29001
29482
|
const VoidLabel$1 = ({
|
|
@@ -29139,13 +29620,16 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
29139
29620
|
schedulePickupForCarrier: schedulePickupForCarrier,
|
|
29140
29621
|
Shipment: Shipment$1,
|
|
29141
29622
|
SuspendShipment: SuspendShipment,
|
|
29623
|
+
WalletHistory: WalletHistory$1,
|
|
29142
29624
|
WarehouseForm: WarehouseForm,
|
|
29143
29625
|
VoidLabel: VoidLabel$1,
|
|
29144
29626
|
WalletForm: WalletForm,
|
|
29145
|
-
styles: styles$
|
|
29627
|
+
styles: styles$3,
|
|
29146
29628
|
billingAddressSchema: billingAddressSchema,
|
|
29147
29629
|
walletSchema: walletSchema,
|
|
29148
|
-
BillingFields: BillingFields
|
|
29630
|
+
BillingFields: BillingFields,
|
|
29631
|
+
WarehousePreferenceWizard: WarehousePreferenceWizard,
|
|
29632
|
+
WarehousePreferenceSelect: WarehousePreferenceSelect
|
|
29149
29633
|
});
|
|
29150
29634
|
|
|
29151
29635
|
const getStyles = showForm => createStyles({
|
|
@@ -29420,6 +29904,7 @@ const ManageFunding = ({
|
|
|
29420
29904
|
const {
|
|
29421
29905
|
t
|
|
29422
29906
|
} = reactI18next.useTranslation();
|
|
29907
|
+
const queryClient = reactQuery.useQueryClient();
|
|
29423
29908
|
const {
|
|
29424
29909
|
isLoading: isLoadingCarrier
|
|
29425
29910
|
} = react.useGetCarrierById(carrierId);
|
|
@@ -29442,7 +29927,15 @@ const ManageFunding = ({
|
|
|
29442
29927
|
multiplier: 2
|
|
29443
29928
|
}), jsxRuntime.jsx(AddFundsForm, {
|
|
29444
29929
|
carrierId: carrierId,
|
|
29445
|
-
onCancel: () => setIsAddFundsFormOpen(false)
|
|
29930
|
+
onCancel: () => setIsAddFundsFormOpen(false),
|
|
29931
|
+
onSuccess: () => {
|
|
29932
|
+
queryClient.invalidateQueries(["useGetCarrierById", carrierId], {
|
|
29933
|
+
exact: true
|
|
29934
|
+
});
|
|
29935
|
+
queryClient.invalidateQueries(["useListCarriers"], {
|
|
29936
|
+
exact: true
|
|
29937
|
+
});
|
|
29938
|
+
}
|
|
29446
29939
|
})]
|
|
29447
29940
|
}), jsxRuntime.jsx(Spacer, {
|
|
29448
29941
|
multiplier: 2
|
|
@@ -30411,8 +30904,10 @@ var common = {
|
|
|
30411
30904
|
},
|
|
30412
30905
|
paste: "Paste Address",
|
|
30413
30906
|
preference: {
|
|
30907
|
+
confirm: "Confirm",
|
|
30414
30908
|
addressNotValidated: "Address not validated",
|
|
30415
30909
|
modified: "modified",
|
|
30910
|
+
title: "To ensure accurate rate estimation, consider the changes suggested below.",
|
|
30416
30911
|
originalAddress: "Original Address",
|
|
30417
30912
|
matchedAddress: "Suggested Address",
|
|
30418
30913
|
unableToValidate: "We were not able to validate this address. It might result in delays in your delivery.",
|
|
@@ -30673,6 +31168,7 @@ var manageFunding = {
|
|
|
30673
31168
|
var manageWarehouses = {
|
|
30674
31169
|
"manage-warehouses": {
|
|
30675
31170
|
addNew: "Add New Address",
|
|
31171
|
+
editWarehouse: "Edit Address",
|
|
30676
31172
|
contactName: "Contact Name",
|
|
30677
31173
|
"default": "Default",
|
|
30678
31174
|
isDefault: "Set as default Ship From address",
|
|
@@ -30787,6 +31283,7 @@ var purchaseLabel = {
|
|
|
30787
31283
|
},
|
|
30788
31284
|
schemaErrors: {
|
|
30789
31285
|
shipFromUnitedStatesOnly: "Only US addresses are supported in this view",
|
|
31286
|
+
shipFromAddressRequired: "Ship From address is required",
|
|
30790
31287
|
needToAcknowledge: "Need to accept Rate Compliance Agreement"
|
|
30791
31288
|
},
|
|
30792
31289
|
rates: {
|
|
@@ -30913,7 +31410,21 @@ var voidLabel = {
|
|
|
30913
31410
|
}
|
|
30914
31411
|
};
|
|
30915
31412
|
|
|
30916
|
-
var
|
|
31413
|
+
var walletHistory = {
|
|
31414
|
+
"wallet-history": {
|
|
31415
|
+
actions: {
|
|
31416
|
+
downloadCsv: "Download a CSV"
|
|
31417
|
+
},
|
|
31418
|
+
historyOptions: {
|
|
31419
|
+
custom: "Custom",
|
|
31420
|
+
last30days: "Last 30 days",
|
|
31421
|
+
thisMonth: "This month",
|
|
31422
|
+
lastMonth: "Last month"
|
|
31423
|
+
}
|
|
31424
|
+
}
|
|
31425
|
+
};
|
|
31426
|
+
|
|
31427
|
+
var index = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, common$1), listCarriers), manageFunding), manageWarehouses), onboarding$1), purchaseLabel), registerCarrier), registerWallet), viewShipment), voidLabel), walletHistory);
|
|
30917
31428
|
|
|
30918
31429
|
var resources = /*#__PURE__*/Object.freeze({
|
|
30919
31430
|
__proto__: null,
|
|
@@ -31183,9 +31694,11 @@ const ListCarriers = () => {
|
|
|
31183
31694
|
});
|
|
31184
31695
|
};
|
|
31185
31696
|
|
|
31186
|
-
const Element$
|
|
31697
|
+
const Element$6 = registerElement("list-carriers", ListCarriers);
|
|
31187
31698
|
|
|
31188
|
-
const ManageWarehouses = (
|
|
31699
|
+
const ManageWarehouses = ({
|
|
31700
|
+
onWarehouseAddressValidation
|
|
31701
|
+
}) => {
|
|
31189
31702
|
const {
|
|
31190
31703
|
t
|
|
31191
31704
|
} = reactI18next.useTranslation();
|
|
@@ -31207,6 +31720,12 @@ const ManageWarehouses = () => {
|
|
|
31207
31720
|
error: deleteWarehouseErrors,
|
|
31208
31721
|
mutateAsync: deleteWarehouse
|
|
31209
31722
|
} = react.useDeleteWarehouse();
|
|
31723
|
+
const {
|
|
31724
|
+
errors: validateWarehouseErrors,
|
|
31725
|
+
validate: validateWarehouse,
|
|
31726
|
+
warehousePreference,
|
|
31727
|
+
setWarehousePreference
|
|
31728
|
+
} = useWarehouseValidation();
|
|
31210
31729
|
const handleDeleteWarehouse = warehouseId => __awaiter(void 0, void 0, void 0, function* () {
|
|
31211
31730
|
yield deleteWarehouse({
|
|
31212
31731
|
warehouseId
|
|
@@ -31240,18 +31759,21 @@ const ManageWarehouses = () => {
|
|
|
31240
31759
|
if (listWarehouseErrors) throw new Error(listWarehouseErrors.map(e => e.message).join(", "));
|
|
31241
31760
|
throw new Error("errorMessages.unableToLoad.warehouses");
|
|
31242
31761
|
}
|
|
31243
|
-
const errors = [...(updateWarehouseErrors !== null && updateWarehouseErrors !== void 0 ? updateWarehouseErrors : []), ...(createWarehouseErrors !== null && createWarehouseErrors !== void 0 ? createWarehouseErrors : []), ...(deleteWarehouseErrors !== null && deleteWarehouseErrors !== void 0 ? deleteWarehouseErrors : [])];
|
|
31762
|
+
const errors = [...(updateWarehouseErrors !== null && updateWarehouseErrors !== void 0 ? updateWarehouseErrors : []), ...(createWarehouseErrors !== null && createWarehouseErrors !== void 0 ? createWarehouseErrors : []), ...(deleteWarehouseErrors !== null && deleteWarehouseErrors !== void 0 ? deleteWarehouseErrors : []), ...(validateWarehouseErrors !== null && validateWarehouseErrors !== void 0 ? validateWarehouseErrors : [])];
|
|
31244
31763
|
return jsxRuntime.jsx(ManageWarehouses$1, {
|
|
31245
31764
|
errors: errors,
|
|
31246
31765
|
onAdd: handleSubmitAddNewWarehouse,
|
|
31247
31766
|
onDelete: handleDeleteWarehouse,
|
|
31248
31767
|
onEdit: handleSubmitEditWarehouse,
|
|
31249
31768
|
onSetDefault: handleSetDefault,
|
|
31769
|
+
onValidate: validateWarehouse,
|
|
31770
|
+
setWarehousePreference: setWarehousePreference,
|
|
31771
|
+
warehousePreference: warehousePreference,
|
|
31250
31772
|
warehouses: warehouses
|
|
31251
31773
|
});
|
|
31252
31774
|
};
|
|
31253
31775
|
|
|
31254
|
-
const Element$
|
|
31776
|
+
const Element$5 = registerElement("manage-warehouses", ManageWarehouses);
|
|
31255
31777
|
|
|
31256
31778
|
const useAddress = ({
|
|
31257
31779
|
compatibleCountryCodes,
|
|
@@ -31562,18 +32084,16 @@ const useRequestRates = ({
|
|
|
31562
32084
|
if (result) yield onRatesCalculated === null || onRatesCalculated === void 0 ? void 0 : onRatesCalculated(result.rateResponse.rates, shipment);
|
|
31563
32085
|
}), [calculateRates, carriers, customPackageTypes, onRatesCalculated]);
|
|
31564
32086
|
let ratesResponse = ratedShipment === null || ratedShipment === void 0 ? void 0 : ratedShipment.rateResponse;
|
|
31565
|
-
|
|
31566
|
-
ratesResponse
|
|
31567
|
-
|
|
31568
|
-
|
|
31569
|
-
|
|
31570
|
-
|
|
31571
|
-
|
|
31572
|
-
|
|
31573
|
-
|
|
31574
|
-
|
|
31575
|
-
});
|
|
31576
|
-
}
|
|
32087
|
+
ratesResponse = React.useMemo(() => ratesResponse && Object.assign(Object.assign({}, ratesResponse), {
|
|
32088
|
+
rates: ratesResponse.rates.map(rate => {
|
|
32089
|
+
var _a, _b;
|
|
32090
|
+
return Object.assign(Object.assign({}, rate), {
|
|
32091
|
+
warningMessages: [
|
|
32092
|
+
// add additional rateMessages based on combinations of serviceCode and packageType
|
|
32093
|
+
...((_a = rateMessages[`${rate.serviceCode}:${rate.packageType}`]) !== null && _a !== void 0 ? _a : []), ...((_b = rateMessages[rate.serviceCode]) !== null && _b !== void 0 ? _b : []), ...rate.warningMessages]
|
|
32094
|
+
});
|
|
32095
|
+
})
|
|
32096
|
+
}), [ratesResponse]);
|
|
31577
32097
|
return {
|
|
31578
32098
|
ratesCalculating,
|
|
31579
32099
|
ratesErrors,
|
|
@@ -31886,6 +32406,12 @@ const Onboarding = ({
|
|
|
31886
32406
|
const onWarehouseCreated = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
31887
32407
|
yield refetchWarehouses();
|
|
31888
32408
|
}), [refetchWarehouses]);
|
|
32409
|
+
const {
|
|
32410
|
+
errors: validateWarehouseErrors,
|
|
32411
|
+
validate: validateWarehouse,
|
|
32412
|
+
warehousePreference,
|
|
32413
|
+
setWarehousePreference
|
|
32414
|
+
} = useWarehouseValidation();
|
|
31889
32415
|
const onCarrierCreated = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
31890
32416
|
yield refetchCarriers();
|
|
31891
32417
|
}), [refetchCarriers]);
|
|
@@ -31896,6 +32422,7 @@ const Onboarding = ({
|
|
|
31896
32422
|
createWarehouse: createWarehouse,
|
|
31897
32423
|
onCarrierCreated: onCarrierCreated,
|
|
31898
32424
|
onCompleteOnboarding: onCompleteOnboarding,
|
|
32425
|
+
onValidateWarehouse: validateWarehouse,
|
|
31899
32426
|
onWarehouseCreated: onWarehouseCreated,
|
|
31900
32427
|
registerDhlCarrier: registerDhlCarrier,
|
|
31901
32428
|
registerDhlCarrierErrors: registerDhlCarrierErrors,
|
|
@@ -31903,6 +32430,9 @@ const Onboarding = ({
|
|
|
31903
32430
|
registerStampsCarrierErrors: registerStampsCarrierErrors,
|
|
31904
32431
|
registerUpsCarrier: registerUpsCarrier,
|
|
31905
32432
|
registerUpsCarrierErrors: registerUpsCarrierErrors,
|
|
32433
|
+
setWarehousePreference: setWarehousePreference,
|
|
32434
|
+
validationErrors: validateWarehouseErrors,
|
|
32435
|
+
warehousePreference: warehousePreference,
|
|
31906
32436
|
warehouses: warehouses
|
|
31907
32437
|
});
|
|
31908
32438
|
};
|
|
@@ -32028,7 +32558,7 @@ const useImportSalesOrder = ({
|
|
|
32028
32558
|
error: getSalesOrderErrors,
|
|
32029
32559
|
refetch: refetchSalesOrder,
|
|
32030
32560
|
isFetching: isFetchingSalesOrder
|
|
32031
|
-
} = react.useGetSalesOrder(salesOrderId !== null && salesOrderId !== void 0 ? salesOrderId : salesOrders
|
|
32561
|
+
} = react.useGetSalesOrder(salesOrderId !== null && salesOrderId !== void 0 ? salesOrderId : salesOrders && salesOrders[0] ? salesOrders[0].salesOrderId : undefined);
|
|
32032
32562
|
const {
|
|
32033
32563
|
data: orderSources,
|
|
32034
32564
|
error: listOrderSourcesErrors
|
|
@@ -32036,6 +32566,7 @@ const useImportSalesOrder = ({
|
|
|
32036
32566
|
const {
|
|
32037
32567
|
data: refreshedOrderSource,
|
|
32038
32568
|
error: refreshOrderSourceErrors,
|
|
32569
|
+
isLoading: isRefreshingOrderSource,
|
|
32039
32570
|
mutateAsync: refreshOrderSource
|
|
32040
32571
|
} = react.useRefreshOrderSource();
|
|
32041
32572
|
React.useEffect(() => {
|
|
@@ -32055,7 +32586,7 @@ const useImportSalesOrder = ({
|
|
|
32055
32586
|
const errors = [...(listOrderSourcesErrors !== null && listOrderSourcesErrors !== void 0 ? listOrderSourcesErrors : []), ...(listSalesOrdersErrors !== null && listSalesOrdersErrors !== void 0 ? listSalesOrdersErrors : []), ...(getSalesOrderErrors !== null && getSalesOrderErrors !== void 0 ? getSalesOrderErrors : []), ...(refreshOrderSourceErrors !== null && refreshOrderSourceErrors !== void 0 ? refreshOrderSourceErrors : [])];
|
|
32056
32587
|
return {
|
|
32057
32588
|
errors: errors.length > 0 ? errors : undefined,
|
|
32058
|
-
isLoading: !
|
|
32589
|
+
isLoading: isFetchingSalesOrder || isFetchingSalesOrders || isRefreshingOrderSource || !hasRefreshedOrderSource && !salesOrder && (salesOrders === null || salesOrders === void 0 ? void 0 : salesOrders.length) === 0 && errors.length === 0,
|
|
32059
32590
|
salesOrder
|
|
32060
32591
|
};
|
|
32061
32592
|
};
|
|
@@ -32213,6 +32744,13 @@ const Shipment = ({
|
|
|
32213
32744
|
});
|
|
32214
32745
|
};
|
|
32215
32746
|
|
|
32747
|
+
const WalletHistory = () => {
|
|
32748
|
+
const walletHistory = react.useGetWalletTransactionHistory(); // Mock data for now. Real implementation coming in a subsequent PR [LMNT-842] https://auctane.atlassian.net/browse/LMNT-842
|
|
32749
|
+
return jsxRuntime.jsx(WalletHistory$1, {
|
|
32750
|
+
historyData: walletHistory
|
|
32751
|
+
});
|
|
32752
|
+
};
|
|
32753
|
+
|
|
32216
32754
|
const VoidLabel = ({
|
|
32217
32755
|
labelId,
|
|
32218
32756
|
onComplete,
|
|
@@ -32241,727 +32779,16 @@ const VoidLabel = ({
|
|
|
32241
32779
|
});
|
|
32242
32780
|
};
|
|
32243
32781
|
|
|
32244
|
-
const Element$
|
|
32782
|
+
const Element$4 = registerElement("purchase-label", PurchaseLabel);
|
|
32783
|
+
|
|
32784
|
+
const Element$3 = registerElement("onboarding", Onboarding);
|
|
32245
32785
|
|
|
32246
|
-
const Element$2 = registerElement("
|
|
32786
|
+
const Element$2 = registerElement("wallet-history", WalletHistory);
|
|
32247
32787
|
|
|
32248
32788
|
const Element$1 = registerElement("view-shipment", Shipment);
|
|
32249
32789
|
|
|
32250
32790
|
const Element = registerElement("void-label", VoidLabel);
|
|
32251
32791
|
|
|
32252
|
-
/**
|
|
32253
|
-
* @category Factories
|
|
32254
|
-
*/
|
|
32255
|
-
const addressFactory = fishery.Factory.define(({
|
|
32256
|
-
params,
|
|
32257
|
-
transientParams
|
|
32258
|
-
}) => {
|
|
32259
|
-
var _a, _b, _c, _d;
|
|
32260
|
-
const addressLine2 = (_a = params.addressLine2) !== null && _a !== void 0 ? _a : faker.faker.helpers.maybe(faker.faker.address.secondaryAddress, {
|
|
32261
|
-
probability: 0.25
|
|
32262
|
-
});
|
|
32263
|
-
const addressLine3 = (_b = params.addressLine3) !== null && _b !== void 0 ? _b : addressLine2 && faker.faker.helpers.maybe(faker.faker.address.secondaryAddress);
|
|
32264
|
-
let countryCode = (_c = params.countryCode) !== null && _c !== void 0 ? _c : "US";
|
|
32265
|
-
// Random country code could still be US
|
|
32266
|
-
while (transientParams.isInternational && countryCode === "US") {
|
|
32267
|
-
countryCode = faker.faker.address.countryCode();
|
|
32268
|
-
}
|
|
32269
|
-
const stateProvince = (_d = params.stateProvince) !== null && _d !== void 0 ? _d : faker.faker.address.stateAbbr();
|
|
32270
|
-
return {
|
|
32271
|
-
addressLine1: faker.faker.address.streetAddress(),
|
|
32272
|
-
addressLine2,
|
|
32273
|
-
addressLine3,
|
|
32274
|
-
addressResidentialIndicator: faker.faker.helpers.maybe(() => faker.faker.helpers.arrayElement(["yes", "no"])),
|
|
32275
|
-
cityLocality: faker.faker.address.city(),
|
|
32276
|
-
companyName: faker.faker.helpers.maybe(faker.faker.company.name),
|
|
32277
|
-
countryCode,
|
|
32278
|
-
name: faker.faker.name.fullName(),
|
|
32279
|
-
phone: faker.faker.phone.number(),
|
|
32280
|
-
postalCode: faker.faker.address.zipCodeByState(stateProvince),
|
|
32281
|
-
stateProvince
|
|
32282
|
-
};
|
|
32283
|
-
});
|
|
32284
|
-
/**
|
|
32285
|
-
* @category Factories
|
|
32286
|
-
*/
|
|
32287
|
-
const addressValidationFactory = fishery.Factory.define(({
|
|
32288
|
-
associations,
|
|
32289
|
-
params
|
|
32290
|
-
}) => {
|
|
32291
|
-
var _a, _b;
|
|
32292
|
-
const status = params.status || faker.faker.helpers.arrayElement(["unverified", "verified", "warning", "error"]);
|
|
32293
|
-
return {
|
|
32294
|
-
matchedAddress: (_a = associations.matchedAddress) !== null && _a !== void 0 ? _a : faker.faker.helpers.maybe(() => addressFactory.build(), {
|
|
32295
|
-
probability: ["verified", "error"].includes(status) ? 0 : 0.8
|
|
32296
|
-
}),
|
|
32297
|
-
messages: [],
|
|
32298
|
-
originalAddress: (_b = associations.originalAddress) !== null && _b !== void 0 ? _b : addressFactory.build(),
|
|
32299
|
-
status
|
|
32300
|
-
};
|
|
32301
|
-
});
|
|
32302
|
-
/**
|
|
32303
|
-
* Mock the addressValidation object used to hyrdate address valiation feature
|
|
32304
|
-
* on the shipment form.
|
|
32305
|
-
* @category Factory
|
|
32306
|
-
*/
|
|
32307
|
-
const addressPreferenceFactory = fishery.Factory.define(({
|
|
32308
|
-
associations,
|
|
32309
|
-
params
|
|
32310
|
-
}) => {
|
|
32311
|
-
const addressValidation = addressValidationFactory.build({
|
|
32312
|
-
status: params.status
|
|
32313
|
-
}, {
|
|
32314
|
-
associations: {
|
|
32315
|
-
matchedAddress: addressFactory.build()
|
|
32316
|
-
}
|
|
32317
|
-
});
|
|
32318
|
-
if (!addressValidation.matchedAddress) throw new Error("addressPreferenceFactory did not generate a matchedAddress");
|
|
32319
|
-
return Object.assign(Object.assign({}, addressValidation), {
|
|
32320
|
-
alternative: addressValidation.originalAddress,
|
|
32321
|
-
alternativeSource: "originalAddress",
|
|
32322
|
-
isModified: true,
|
|
32323
|
-
selection: addressValidation.matchedAddress,
|
|
32324
|
-
selectionSource: "matchedAddress",
|
|
32325
|
-
toggle: () => addressFactory.build()
|
|
32326
|
-
});
|
|
32327
|
-
});
|
|
32328
|
-
|
|
32329
|
-
const randomShipengineId = (length = 5) => `se-${faker.faker.random.numeric(length)}`;
|
|
32330
|
-
const randomShipengineSlug = wordCount => faker.faker.lorem.slug(wordCount).replace("-", "_");
|
|
32331
|
-
const tristateValue = (ifTrue, ifFalse, ifUndefined, value) => {
|
|
32332
|
-
if (value === undefined) {
|
|
32333
|
-
return ifUndefined;
|
|
32334
|
-
}
|
|
32335
|
-
if (value) {
|
|
32336
|
-
return ifTrue;
|
|
32337
|
-
}
|
|
32338
|
-
return ifFalse;
|
|
32339
|
-
};
|
|
32340
|
-
|
|
32341
|
-
/**
|
|
32342
|
-
* @category Factories
|
|
32343
|
-
*/
|
|
32344
|
-
const packageFactory = fishery.Factory.define(({
|
|
32345
|
-
transientParams
|
|
32346
|
-
}) => ({
|
|
32347
|
-
description: faker.faker.lorem.sentence(),
|
|
32348
|
-
dimensions: (transientParams === null || transientParams === void 0 ? void 0 : transientParams.noDimensions) ? undefined : {
|
|
32349
|
-
height: faker.faker.datatype.number({
|
|
32350
|
-
max: 50,
|
|
32351
|
-
min: 1,
|
|
32352
|
-
precision: 0.1
|
|
32353
|
-
}),
|
|
32354
|
-
length: faker.faker.datatype.number({
|
|
32355
|
-
max: 50,
|
|
32356
|
-
min: 1,
|
|
32357
|
-
precision: 0.1
|
|
32358
|
-
}),
|
|
32359
|
-
unit: faker.faker.helpers.arrayElement(["inch", "centimeter"]),
|
|
32360
|
-
width: faker.faker.datatype.number({
|
|
32361
|
-
max: 50,
|
|
32362
|
-
min: 1,
|
|
32363
|
-
precision: 0.1
|
|
32364
|
-
})
|
|
32365
|
-
},
|
|
32366
|
-
name: faker.faker.random.words(),
|
|
32367
|
-
packageCode: randomShipengineSlug(2),
|
|
32368
|
-
packageId: randomShipengineSlug(3)
|
|
32369
|
-
}));
|
|
32370
|
-
|
|
32371
|
-
/**
|
|
32372
|
-
* @category Factories
|
|
32373
|
-
*/
|
|
32374
|
-
const serviceFactory = fishery.Factory.define(({
|
|
32375
|
-
params,
|
|
32376
|
-
transientParams
|
|
32377
|
-
}) => {
|
|
32378
|
-
var _a, _b, _c, _d;
|
|
32379
|
-
const international = params.international || faker.faker.datatype.boolean();
|
|
32380
|
-
return {
|
|
32381
|
-
carrierCode: (_b = (_a = transientParams.carrier) === null || _a === void 0 ? void 0 : _a.carrierCode) !== null && _b !== void 0 ? _b : randomShipengineSlug(),
|
|
32382
|
-
carrierId: (_d = (_c = transientParams.carrier) === null || _c === void 0 ? void 0 : _c.carrierId) !== null && _d !== void 0 ? _d : randomShipengineId(),
|
|
32383
|
-
domestic: faker.faker.datatype.boolean() || !international,
|
|
32384
|
-
international,
|
|
32385
|
-
isMultiPackageSupported: faker.faker.datatype.boolean(),
|
|
32386
|
-
name: faker.faker.random.words(),
|
|
32387
|
-
serviceCode: randomShipengineSlug()
|
|
32388
|
-
};
|
|
32389
|
-
});
|
|
32390
|
-
|
|
32391
|
-
/**
|
|
32392
|
-
* @category Factories
|
|
32393
|
-
*/
|
|
32394
|
-
const carrierOptionFactory = fishery.Factory.define(() => ({
|
|
32395
|
-
defaultValue: faker.faker.random.word().toLowerCase(),
|
|
32396
|
-
description: faker.faker.random.words(),
|
|
32397
|
-
name: faker.faker.random.word()
|
|
32398
|
-
}));
|
|
32399
|
-
/**
|
|
32400
|
-
* @category Factories
|
|
32401
|
-
*/
|
|
32402
|
-
const carrierFactory = fishery.Factory.define(({
|
|
32403
|
-
associations,
|
|
32404
|
-
params,
|
|
32405
|
-
sequence
|
|
32406
|
-
}) => {
|
|
32407
|
-
const carrierCode = params.carrierCode || randomShipengineSlug();
|
|
32408
|
-
const carrierId = params.carrierId || `se-${10000 + sequence}`;
|
|
32409
|
-
return {
|
|
32410
|
-
accountNumber: faker.faker.random.numeric(9),
|
|
32411
|
-
balance: faker.faker.datatype.number({
|
|
32412
|
-
max: 0,
|
|
32413
|
-
min: 0,
|
|
32414
|
-
precision: 0.01
|
|
32415
|
-
}),
|
|
32416
|
-
carrierCode,
|
|
32417
|
-
carrierId,
|
|
32418
|
-
friendlyName: faker.faker.company.name(),
|
|
32419
|
-
hasMultiPackageSupportingServices: faker.faker.datatype.boolean(),
|
|
32420
|
-
nickname: faker.faker.random.words(3),
|
|
32421
|
-
options: associations.options || [],
|
|
32422
|
-
packages: associations.packages || packageFactory.buildList(faker.faker.datatype.number({
|
|
32423
|
-
max: 10,
|
|
32424
|
-
min: 1
|
|
32425
|
-
}), {}, {
|
|
32426
|
-
transient: {
|
|
32427
|
-
noDimensions: true
|
|
32428
|
-
}
|
|
32429
|
-
}),
|
|
32430
|
-
primary: false,
|
|
32431
|
-
requiresFundedAmount: false,
|
|
32432
|
-
services: associations.services || serviceFactory.buildList(faker.faker.datatype.number({
|
|
32433
|
-
max: 10,
|
|
32434
|
-
min: 1
|
|
32435
|
-
}), {
|
|
32436
|
-
carrierCode,
|
|
32437
|
-
carrierId
|
|
32438
|
-
}),
|
|
32439
|
-
supportsLabelMessages: faker.faker.datatype.boolean()
|
|
32440
|
-
};
|
|
32441
|
-
});
|
|
32442
|
-
|
|
32443
|
-
/**
|
|
32444
|
-
* @category Factories
|
|
32445
|
-
*/
|
|
32446
|
-
const moneyFactory = fishery.Factory.define(({
|
|
32447
|
-
transientParams
|
|
32448
|
-
}) => ({
|
|
32449
|
-
amount: faker.faker.datatype.number({
|
|
32450
|
-
max: 1000,
|
|
32451
|
-
min: 5,
|
|
32452
|
-
precision: 0.01
|
|
32453
|
-
}),
|
|
32454
|
-
currency: (transientParams === null || transientParams === void 0 ? void 0 : transientParams.isInternational) ? faker.faker.helpers.arrayElement(Object.values(api.SE.Currency)) : api.SE.Currency.USD
|
|
32455
|
-
}));
|
|
32456
|
-
|
|
32457
|
-
const randomOrderSourceCode = () => faker.faker.helpers.arrayElement(["3dcart", "abantecart", "acumatica", "acumatica_v2", "alibaba", "amazon", "amazon_au", "amazon_ca", "amazon_de", "amazon_es", "amazon_fr", "amazon_it", "amazon_jp", "amazon_mx", "amazon_uk", "americommerce", "auctane-orders", "back-market", "bandcamp", "big_cartel", "bigcommerce", "bigcommerce_v3", "bigcommerce_v2", "bizelo", "bluepark", "bonanza", "brightpearl", "cdiscount", "celery", "channeladvisor", "channelsale", "choxi", "cin7", "commerceinterface", "corecommerce", "coupang", "cratejoy", "cs-cart", "custom_store", "dear_systems", "dummy-marketplace", "ebay", "ebay_au", "ebay_ca", "ebay_uk", "ebay_fr", "ebay_v2", "ecwid", "ecwid_v1", "edesk", "ekm", "etsy", "facebook", "fnac", "foxycart", "freestyle", "fullscreen_direct", "geekseller", "goodsie", "google", "google_checkout", "gorgias", "groopdealz", "groupon_goods", "handshake", "hatch", "highwire", "homeroots", "houzz", "idealo_de", "inksoft", "jane", "jet", "kaufland", "labelapi", "lemonstand", "lengow", "liftoff", "linnworks", "listingmirror", "magento", "zoey", "magento_go", "memberly", "mercado_libre", "mijoshop", "best_buy_ca", "catch", "darty", "fanatics", "kohls", "kroger", "urbn", "miva_merchant", "morecommerce", "mozu", "neto", "newegg", "newegg_business", "newegg_ca", "notonthehighstreet", "oauth_dummy", "odbc", "onbuy", "opencart", "order_time", "ordersource_api", "oscommerce", "overstock", "oxatis", "paypal", "paypal_v2", "payvment", "penny", "prestashop", "rakuten", "best_buy", "rakuten-fr", "rate_browser", "redditgifts", "reverb", "revolutionparts", "salesforce_commerce_cloud", "salesforce_core", "sap_anywhere", "scout_topshelf", "sears", "securestore", "sellbrite", "selleractive", "shipengine_api", "shipengine_merchant", "shipstation", "shop_premium_outlets", "shopify", "shoppingfeed", "shopware_de", "simplepart", "skuvault", "soldsie", "sophio", "spark_shipping", "spree", "spreesy", "square", "squarespace", "stitch_labs", "storenvy", "stripe", "suredone", "tanga", "tophatter", "trade_me", "tradegecko", "ultracart", "unbranded_ecommerce_store", "unleashed", "vault", "visualsoft", "volo", "volusion", "vtex", "walmart", "walmart_ca", "wayfair", "webflow", "weebly", "wish", "wix", "woocommerce", "woocommerce_v2", "woot", "x-cart", "yahoo", "sec_yumbles", "zen_cart", "zonos"]);
|
|
32458
|
-
/**
|
|
32459
|
-
* @category Factories
|
|
32460
|
-
*/
|
|
32461
|
-
const orderSourceRefreshInfoFactory = fishery.Factory.define(() => {
|
|
32462
|
-
const lastRefreshAttempt = faker.faker.date.recent();
|
|
32463
|
-
return {
|
|
32464
|
-
lastRefreshAttempt: lastRefreshAttempt.toISOString(),
|
|
32465
|
-
refreshDate: faker.faker.date.recent(1, lastRefreshAttempt).toISOString(),
|
|
32466
|
-
status: faker.faker.helpers.arrayElement(["idle", "preparing_update", "updating", "error", "unknown"])
|
|
32467
|
-
};
|
|
32468
|
-
});
|
|
32469
|
-
/**
|
|
32470
|
-
* @category Factories
|
|
32471
|
-
*/
|
|
32472
|
-
const orderSourceFactory = fishery.Factory.define(({
|
|
32473
|
-
associations,
|
|
32474
|
-
params
|
|
32475
|
-
}) => {
|
|
32476
|
-
var _a;
|
|
32477
|
-
return {
|
|
32478
|
-
active: faker.faker.datatype.boolean(),
|
|
32479
|
-
orderSourceCode: randomOrderSourceCode(),
|
|
32480
|
-
orderSourceFriendlyName: faker.faker.company.name(),
|
|
32481
|
-
orderSourceId: faker.faker.datatype.uuid(),
|
|
32482
|
-
orderSourceNickname: faker.faker.random.words(),
|
|
32483
|
-
refreshInfo: (_a = associations.refreshInfo) !== null && _a !== void 0 ? _a : orderSourceRefreshInfoFactory.build(params.refreshInfo)
|
|
32484
|
-
};
|
|
32485
|
-
});
|
|
32486
|
-
|
|
32487
|
-
/**
|
|
32488
|
-
* @category Factories
|
|
32489
|
-
*/
|
|
32490
|
-
const downloadFactory = fishery.Factory.define(() => ({
|
|
32491
|
-
href: faker.faker.internet.url(),
|
|
32492
|
-
pdf: faker.faker.internet.url(),
|
|
32493
|
-
png: faker.faker.internet.url(),
|
|
32494
|
-
zpl: faker.faker.internet.url()
|
|
32495
|
-
}));
|
|
32496
|
-
/**
|
|
32497
|
-
* @category Factories
|
|
32498
|
-
*/
|
|
32499
|
-
const linkedResourceFactory = fishery.Factory.define(() => ({
|
|
32500
|
-
href: faker.faker.internet.url(),
|
|
32501
|
-
type: faker.faker.word.noun()
|
|
32502
|
-
}));
|
|
32503
|
-
|
|
32504
|
-
const randomWeightUnit = () => faker.faker.helpers.arrayElement(["pound", "ounce", "gram", "kilogram"]);
|
|
32505
|
-
/**
|
|
32506
|
-
* @category Factories
|
|
32507
|
-
*/
|
|
32508
|
-
const fractionalWeightFactory = fishery.Factory.define(() => ({
|
|
32509
|
-
fractional: faker.faker.datatype.number({
|
|
32510
|
-
max: 16,
|
|
32511
|
-
min: 0
|
|
32512
|
-
}),
|
|
32513
|
-
whole: faker.faker.datatype.number({
|
|
32514
|
-
max: 20,
|
|
32515
|
-
min: 0
|
|
32516
|
-
})
|
|
32517
|
-
}));
|
|
32518
|
-
/**
|
|
32519
|
-
* @category Factories
|
|
32520
|
-
*/
|
|
32521
|
-
const weightFactory = fishery.Factory.define(() => ({
|
|
32522
|
-
value: faker.faker.datatype.number({
|
|
32523
|
-
max: 20,
|
|
32524
|
-
min: 1,
|
|
32525
|
-
precision: 0.1
|
|
32526
|
-
})
|
|
32527
|
-
}));
|
|
32528
|
-
/**
|
|
32529
|
-
* @category Factories
|
|
32530
|
-
*/
|
|
32531
|
-
const weightWithUnitFactory = fishery.Factory.define(({
|
|
32532
|
-
params
|
|
32533
|
-
}) => {
|
|
32534
|
-
const weight = weightFactory.build(params);
|
|
32535
|
-
return Object.assign(Object.assign({}, weight), {
|
|
32536
|
-
unit: randomWeightUnit()
|
|
32537
|
-
});
|
|
32538
|
-
});
|
|
32539
|
-
|
|
32540
|
-
const randomDeliveryConfirmation = () => faker.faker.helpers.arrayElement(Object.values(api.SE.ConfirmationType));
|
|
32541
|
-
const randomInsuranceProvider = (allowNone = true) => {
|
|
32542
|
-
const availableProviders = Object.values(api.SE.InsuranceProviderType).filter(p => allowNone ? p : p !== "none");
|
|
32543
|
-
return faker.faker.helpers.arrayElement(availableProviders);
|
|
32544
|
-
};
|
|
32545
|
-
/**
|
|
32546
|
-
* @category Factories
|
|
32547
|
-
*/
|
|
32548
|
-
const customsItemFactory = fishery.Factory.define(({
|
|
32549
|
-
associations,
|
|
32550
|
-
params,
|
|
32551
|
-
transientParams
|
|
32552
|
-
}) => ({
|
|
32553
|
-
countryOfOrigin: faker.faker.address.countryCode(),
|
|
32554
|
-
description: faker.faker.commerce.productName(),
|
|
32555
|
-
harmonizedTariffCode: faker.faker.datatype.string(),
|
|
32556
|
-
quantity: faker.faker.datatype.number({
|
|
32557
|
-
max: 10,
|
|
32558
|
-
min: 1
|
|
32559
|
-
}),
|
|
32560
|
-
sku: faker.faker.random.numeric(10),
|
|
32561
|
-
skuDescription: faker.faker.helpers.maybe(faker.faker.lorem.sentence),
|
|
32562
|
-
unitOfMeasure: faker.faker.helpers.maybe(faker.faker.word.noun),
|
|
32563
|
-
value: associations.value || faker.faker.datatype.number({
|
|
32564
|
-
max: 10,
|
|
32565
|
-
min: 1
|
|
32566
|
-
})
|
|
32567
|
-
}));
|
|
32568
|
-
/**
|
|
32569
|
-
* @category Factories
|
|
32570
|
-
*/
|
|
32571
|
-
const shipmentItemFactory = fishery.Factory.define(({
|
|
32572
|
-
params
|
|
32573
|
-
}) => ({
|
|
32574
|
-
asin: faker.faker.helpers.maybe(() => faker.faker.random.alphaNumeric(10)),
|
|
32575
|
-
externalOrderId: faker.faker.random.alphaNumeric(10),
|
|
32576
|
-
externalOrderItemId: faker.faker.random.alphaNumeric(10),
|
|
32577
|
-
name: faker.faker.commerce.productName(),
|
|
32578
|
-
orderSourceCode: randomOrderSourceCode(),
|
|
32579
|
-
quantity: faker.faker.datatype.number({
|
|
32580
|
-
max: 10,
|
|
32581
|
-
min: 1
|
|
32582
|
-
}),
|
|
32583
|
-
salesOrderItemId: params.salesOrderId && faker.faker.random.alphaNumeric(6),
|
|
32584
|
-
sku: faker.faker.random.numeric(10)
|
|
32585
|
-
}));
|
|
32586
|
-
/**
|
|
32587
|
-
* @category Factories
|
|
32588
|
-
*/
|
|
32589
|
-
const shipmentPackageFactory = fishery.Factory.define(({
|
|
32590
|
-
associations,
|
|
32591
|
-
params,
|
|
32592
|
-
transientParams
|
|
32593
|
-
}) => {
|
|
32594
|
-
var _a, _b, _c, _d, _e;
|
|
32595
|
-
const _f = packageFactory.build(params),
|
|
32596
|
-
pkg = __rest(_f, ["name"]);
|
|
32597
|
-
const isInsured = tristateValue(true, false, faker.faker.datatype.boolean(), (_b = (_a = params.insuredValue) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : transientParams.isInsured);
|
|
32598
|
-
return Object.assign(Object.assign({}, pkg), {
|
|
32599
|
-
insuredValue: (_c = associations.insuredValue) !== null && _c !== void 0 ? _c : isInsured ? moneyFactory.build(params.insuredValue) : undefined,
|
|
32600
|
-
labelDownload: (_d = associations.labelDownload) !== null && _d !== void 0 ? _d : transientParams.isShipped ? downloadFactory.build(params.labelDownload) : undefined,
|
|
32601
|
-
labelMessages: associations.labelMessages,
|
|
32602
|
-
trackingNumber: transientParams.isShipped ? faker.faker.random.alphaNumeric(12, {
|
|
32603
|
-
casing: "upper"
|
|
32604
|
-
}) : undefined,
|
|
32605
|
-
weight: (_e = associations.weight) !== null && _e !== void 0 ? _e : weightWithUnitFactory.build(params.weight)
|
|
32606
|
-
});
|
|
32607
|
-
});
|
|
32608
|
-
/**
|
|
32609
|
-
* @category Factories
|
|
32610
|
-
*/
|
|
32611
|
-
const shipmentFactory = fishery.Factory.define(({
|
|
32612
|
-
associations,
|
|
32613
|
-
params,
|
|
32614
|
-
sequence,
|
|
32615
|
-
transientParams
|
|
32616
|
-
}) => {
|
|
32617
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
32618
|
-
const shipTo = (_a = associations.shipTo) !== null && _a !== void 0 ? _a : addressFactory.build(params.shipTo, {
|
|
32619
|
-
transient: {
|
|
32620
|
-
isInternational: transientParams.isInternational
|
|
32621
|
-
}
|
|
32622
|
-
});
|
|
32623
|
-
let insuranceProvider = api.SE.InsuranceProviderType.NONE;
|
|
32624
|
-
if (transientParams.insuredValue || transientParams.isInsured) {
|
|
32625
|
-
insuranceProvider = (_b = params.insuranceProvider) !== null && _b !== void 0 ? _b : randomInsuranceProvider(false);
|
|
32626
|
-
} else if (transientParams.insuredValue === undefined && transientParams.isInsured === undefined) {
|
|
32627
|
-
insuranceProvider = randomInsuranceProvider(true);
|
|
32628
|
-
}
|
|
32629
|
-
const shipDateObj = faker.faker.date.soon(7);
|
|
32630
|
-
shipDateObj.setHours(0, 0, 0, 0);
|
|
32631
|
-
const totalWeight = (_c = associations.totalWeight) !== null && _c !== void 0 ? _c : weightWithUnitFactory.build(params.totalWeight);
|
|
32632
|
-
return {
|
|
32633
|
-
addressValidation: (_d = associations.addressValidation) !== null && _d !== void 0 ? _d : addressValidationFactory.build(params.addressValidation, {
|
|
32634
|
-
associations: {
|
|
32635
|
-
originalAddress: shipTo
|
|
32636
|
-
}
|
|
32637
|
-
}),
|
|
32638
|
-
carrierId: (_f = (_e = transientParams === null || transientParams === void 0 ? void 0 : transientParams.service) === null || _e === void 0 ? void 0 : _e.carrierId) !== null && _f !== void 0 ? _f : randomShipengineId(),
|
|
32639
|
-
confirmation: randomDeliveryConfirmation(),
|
|
32640
|
-
createdAt: faker.faker.date.past().toISOString(),
|
|
32641
|
-
customs: (_g = associations.customs) !== null && _g !== void 0 ? _g : transientParams.isInternational ? {
|
|
32642
|
-
contents: faker.faker.helpers.arrayElement(["documents", "gift", "merchandise", "returned_goods", "sample"]),
|
|
32643
|
-
customsItems: customsItemFactory.buildList(faker.faker.datatype.number({
|
|
32644
|
-
max: 10,
|
|
32645
|
-
min: 1
|
|
32646
|
-
})),
|
|
32647
|
-
nonDelivery: faker.faker.helpers.arrayElement(["return_to_sender", "treat_as_abandoned"])
|
|
32648
|
-
} : undefined,
|
|
32649
|
-
externalOrderId: faker.faker.random.alphaNumeric(10),
|
|
32650
|
-
externalShipmentId: faker.faker.random.alphaNumeric(10),
|
|
32651
|
-
insuranceProvider,
|
|
32652
|
-
items: shipmentItemFactory.buildList(faker.faker.datatype.number({
|
|
32653
|
-
max: 10,
|
|
32654
|
-
min: 1
|
|
32655
|
-
}), transientParams.salesOrder ? {
|
|
32656
|
-
externalOrderId: transientParams.salesOrder.externalOrderId,
|
|
32657
|
-
orderSourceCode: transientParams.salesOrder.orderSource.orderSourceCode,
|
|
32658
|
-
salesOrderId: (_h = transientParams.salesOrder) === null || _h === void 0 ? void 0 : _h.salesOrderId
|
|
32659
|
-
} : {}),
|
|
32660
|
-
modifiedAt: faker.faker.date.recent().toISOString(),
|
|
32661
|
-
orderSourceCode: (_k = (_j = transientParams.salesOrder) === null || _j === void 0 ? void 0 : _j.orderSource.orderSourceCode) !== null && _k !== void 0 ? _k : randomOrderSourceCode(),
|
|
32662
|
-
packages: (_l = associations.packages) !== null && _l !== void 0 ? _l : shipmentPackageFactory.buildList(1, (_m = params.packages) === null || _m === void 0 ? void 0 : _m[0], {
|
|
32663
|
-
associations: {
|
|
32664
|
-
weight: totalWeight
|
|
32665
|
-
},
|
|
32666
|
-
transient: {
|
|
32667
|
-
isInsured: insuranceProvider !== "none",
|
|
32668
|
-
isShipped: transientParams.isShipped
|
|
32669
|
-
}
|
|
32670
|
-
}),
|
|
32671
|
-
returnTo: (_q = (_o = associations.returnTo) !== null && _o !== void 0 ? _o : (_p = transientParams.warehouse) === null || _p === void 0 ? void 0 : _p.returnAddress) !== null && _q !== void 0 ? _q : addressFactory.build(),
|
|
32672
|
-
serviceCode: (_s = (_r = transientParams.service) === null || _r === void 0 ? void 0 : _r.serviceCode) !== null && _s !== void 0 ? _s : randomShipengineSlug(),
|
|
32673
|
-
shipDate: shipDateObj.toISOString(),
|
|
32674
|
-
shipFrom: (_v = (_t = associations.shipFrom) !== null && _t !== void 0 ? _t : (_u = transientParams.warehouse) === null || _u === void 0 ? void 0 : _u.originAddress) !== null && _v !== void 0 ? _v : addressFactory.build(),
|
|
32675
|
-
shipmentId: `se-${30000 + sequence}`,
|
|
32676
|
-
shipmentStatus: transientParams.isShipped ? "label_purchased" : "pending",
|
|
32677
|
-
shipTo,
|
|
32678
|
-
tags: (_w = associations.tags) !== null && _w !== void 0 ? _w : [],
|
|
32679
|
-
totalWeight,
|
|
32680
|
-
warehouseId: (_x = transientParams.warehouse) === null || _x === void 0 ? void 0 : _x.warehouseId
|
|
32681
|
-
};
|
|
32682
|
-
});
|
|
32683
|
-
/**
|
|
32684
|
-
* @category Factories
|
|
32685
|
-
*/
|
|
32686
|
-
const salesOrderShipmentFactory = fishery.Factory.define(({
|
|
32687
|
-
associations,
|
|
32688
|
-
params,
|
|
32689
|
-
transientParams
|
|
32690
|
-
}) => {
|
|
32691
|
-
var _a, _b, _c;
|
|
32692
|
-
const shipment = shipmentFactory.build(params, {
|
|
32693
|
-
associations,
|
|
32694
|
-
transient: transientParams
|
|
32695
|
-
});
|
|
32696
|
-
return Object.assign(Object.assign({}, shipment), {
|
|
32697
|
-
salesOrderIds: (_a = associations.salesOrderIds) !== null && _a !== void 0 ? _a : [(_c = (_b = transientParams.salesOrder) === null || _b === void 0 ? void 0 : _b.salesOrderId) !== null && _c !== void 0 ? _c : faker.faker.datatype.uuid()]
|
|
32698
|
-
});
|
|
32699
|
-
});
|
|
32700
|
-
|
|
32701
|
-
/**
|
|
32702
|
-
* @category Factories
|
|
32703
|
-
*/
|
|
32704
|
-
const labelFactory = fishery.Factory.define(({
|
|
32705
|
-
params,
|
|
32706
|
-
sequence,
|
|
32707
|
-
transientParams
|
|
32708
|
-
}) => {
|
|
32709
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
32710
|
-
const shipTo = Object.assign(Object.assign({}, addressFactory.build((_a = transientParams.shipment) === null || _a === void 0 ? void 0 : _a.shipTo)), {
|
|
32711
|
-
companyName: (_c = (_b = transientParams.shipment) === null || _b === void 0 ? void 0 : _b.shipTo.companyName) !== null && _c !== void 0 ? _c : faker.faker.lorem.word(),
|
|
32712
|
-
relayPointId: faker.faker.random.numeric(10)
|
|
32713
|
-
});
|
|
32714
|
-
const shipFrom = Object.assign(Object.assign({}, addressFactory.build(((_d = transientParams.shipment) === null || _d === void 0 ? void 0 : _d.shipFrom) || undefined)), {
|
|
32715
|
-
companyName: (_f = (_e = transientParams.shipment) === null || _e === void 0 ? void 0 : _e.shipTo.companyName) !== null && _f !== void 0 ? _f : faker.faker.lorem.word(),
|
|
32716
|
-
relayPointId: faker.faker.random.numeric(10)
|
|
32717
|
-
});
|
|
32718
|
-
const shipDateObj = faker.faker.date.soon(7);
|
|
32719
|
-
shipDateObj.setHours(0, 0, 0, 0);
|
|
32720
|
-
return {
|
|
32721
|
-
batchId: faker.faker.random.numeric(10),
|
|
32722
|
-
carrierCode: (_h = (_g = transientParams.carrier) === null || _g === void 0 ? void 0 : _g.carrierCode) !== null && _h !== void 0 ? _h : randomShipengineSlug(),
|
|
32723
|
-
carrierId: (_k = (_j = transientParams.shipment) === null || _j === void 0 ? void 0 : _j.carrierId) !== null && _k !== void 0 ? _k : `se-${10000 + sequence}`,
|
|
32724
|
-
chargeEvent: "on_creation",
|
|
32725
|
-
createdAt: faker.faker.date.past().toISOString(),
|
|
32726
|
-
displayScheme: "label",
|
|
32727
|
-
formDownload: {
|
|
32728
|
-
href: faker.faker.internet.url(),
|
|
32729
|
-
type: ""
|
|
32730
|
-
},
|
|
32731
|
-
insuranceClaim: {
|
|
32732
|
-
href: faker.faker.internet.url(),
|
|
32733
|
-
type: ""
|
|
32734
|
-
},
|
|
32735
|
-
insuranceCost: moneyFactory.build(),
|
|
32736
|
-
isInternational: shipTo.countryCode !== "US",
|
|
32737
|
-
isReturnLabel: false,
|
|
32738
|
-
labelDownload: {
|
|
32739
|
-
href: faker.faker.image.imageUrl(),
|
|
32740
|
-
pdf: faker.faker.image.imageUrl(),
|
|
32741
|
-
png: faker.faker.image.imageUrl(),
|
|
32742
|
-
zpl: faker.faker.image.imageUrl()
|
|
32743
|
-
},
|
|
32744
|
-
labelFormat: "pdf",
|
|
32745
|
-
labelId: `se-${40000 + sequence}`,
|
|
32746
|
-
labelImageId: faker.faker.random.numeric(10),
|
|
32747
|
-
labelLayout: "4x6",
|
|
32748
|
-
modifiedAt: faker.faker.date.recent().toISOString(),
|
|
32749
|
-
packageCode: (_m = (_l = transientParams.shipment) === null || _l === void 0 ? void 0 : _l.packages[0].packageCode) !== null && _m !== void 0 ? _m : randomShipengineSlug(2),
|
|
32750
|
-
packages: (_p = (_o = transientParams.shipment) === null || _o === void 0 ? void 0 : _o.packages) !== null && _p !== void 0 ? _p : shipmentPackageFactory.buildList(1),
|
|
32751
|
-
relayPoints: {
|
|
32752
|
-
shipFrom,
|
|
32753
|
-
shipTo
|
|
32754
|
-
},
|
|
32755
|
-
rmaNumber: faker.faker.random.alpha(10),
|
|
32756
|
-
serviceCode: (_r = (_q = transientParams.shipment) === null || _q === void 0 ? void 0 : _q.serviceCode) !== null && _r !== void 0 ? _r : randomShipengineSlug(),
|
|
32757
|
-
shipDate: (_t = (_s = transientParams.shipment) === null || _s === void 0 ? void 0 : _s.shipDate) !== null && _t !== void 0 ? _t : shipDateObj.toISOString(),
|
|
32758
|
-
shipmentCost: moneyFactory.build(),
|
|
32759
|
-
shipmentId: (_v = (_u = transientParams.shipment) === null || _u === void 0 ? void 0 : _u.shipmentId) !== null && _v !== void 0 ? _v : `se-${30000 + sequence}`,
|
|
32760
|
-
status: (_w = params.status) !== null && _w !== void 0 ? _w : "processing",
|
|
32761
|
-
trackable: !!((_x = transientParams.shipment) === null || _x === void 0 ? void 0 : _x.packages[0].trackingNumber),
|
|
32762
|
-
trackingNumber: (_z = (_y = transientParams.shipment) === null || _y === void 0 ? void 0 : _y.packages[0].trackingNumber) !== null && _z !== void 0 ? _z : faker.faker.random.alpha(10),
|
|
32763
|
-
trackingStatus: "in_transit",
|
|
32764
|
-
voided: ((_0 = transientParams.shipment) === null || _0 === void 0 ? void 0 : _0.shipmentStatus) === "cancelled",
|
|
32765
|
-
voidedAt: (_2 = (_1 = transientParams.shipment) === null || _1 === void 0 ? void 0 : _1.modifiedAt) !== null && _2 !== void 0 ? _2 : faker.faker.date.past().toISOString()
|
|
32766
|
-
};
|
|
32767
|
-
});
|
|
32768
|
-
|
|
32769
|
-
const randomPaymentStatus = () => faker.faker.helpers.arrayElement(["unknown", "paid", "unpaid", "partially_paid"]);
|
|
32770
|
-
const randomFulfillmentStatus = () => faker.faker.helpers.arrayElement(["unknown", "fulfilled", "unfulfilled", "partially_fulfilled", "on_hold"]);
|
|
32771
|
-
/**
|
|
32772
|
-
* @category Factories
|
|
32773
|
-
*/
|
|
32774
|
-
const salesOrderItemFactory = fishery.Factory.define(({
|
|
32775
|
-
associations,
|
|
32776
|
-
params,
|
|
32777
|
-
transientParams
|
|
32778
|
-
}) => {
|
|
32779
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
32780
|
-
const quantity = faker.faker.datatype.number({
|
|
32781
|
-
max: 5,
|
|
32782
|
-
min: 1
|
|
32783
|
-
});
|
|
32784
|
-
let {
|
|
32785
|
-
priceSummary
|
|
32786
|
-
} = associations;
|
|
32787
|
-
if (!priceSummary) {
|
|
32788
|
-
const unitPrice = moneyFactory.build((_a = params.priceSummary) === null || _a === void 0 ? void 0 : _a.unitPrice, {
|
|
32789
|
-
transient: transientParams
|
|
32790
|
-
});
|
|
32791
|
-
const estimatedShipping = ((_b = params.priceSummary) === null || _b === void 0 ? void 0 : _b.estimatedShipping) ? moneyFactory.build(Object.assign({
|
|
32792
|
-
currency: unitPrice.currency
|
|
32793
|
-
}, (_c = params.priceSummary) === null || _c === void 0 ? void 0 : _c.estimatedShipping)) : undefined;
|
|
32794
|
-
const estimatedTax = moneyFactory.build({
|
|
32795
|
-
amount: (_f = (_e = (_d = params.priceSummary) === null || _d === void 0 ? void 0 : _d.estimatedTax) === null || _e === void 0 ? void 0 : _e.amount) !== null && _f !== void 0 ? _f : unitPrice.amount * quantity * 0.1,
|
|
32796
|
-
currency: (_j = (_h = (_g = params.priceSummary) === null || _g === void 0 ? void 0 : _g.estimatedTax) === null || _h === void 0 ? void 0 : _h.currency) !== null && _j !== void 0 ? _j : unitPrice.currency
|
|
32797
|
-
});
|
|
32798
|
-
const total = moneyFactory.build({
|
|
32799
|
-
amount: (_m = (_l = (_k = params.priceSummary) === null || _k === void 0 ? void 0 : _k.total) === null || _l === void 0 ? void 0 : _l.amount) !== null && _m !== void 0 ? _m : unitPrice.amount * quantity + ((_o = estimatedShipping === null || estimatedShipping === void 0 ? void 0 : estimatedShipping.amount) !== null && _o !== void 0 ? _o : 0) + estimatedTax.amount,
|
|
32800
|
-
currency: (_r = (_q = (_p = params.priceSummary) === null || _p === void 0 ? void 0 : _p.total) === null || _q === void 0 ? void 0 : _q.currency) !== null && _r !== void 0 ? _r : unitPrice.currency
|
|
32801
|
-
});
|
|
32802
|
-
priceSummary = {
|
|
32803
|
-
estimatedShipping,
|
|
32804
|
-
estimatedTax,
|
|
32805
|
-
total,
|
|
32806
|
-
unitPrice
|
|
32807
|
-
};
|
|
32808
|
-
}
|
|
32809
|
-
return {
|
|
32810
|
-
isGift: faker.faker.datatype.boolean(),
|
|
32811
|
-
lineItemDetails: (_s = associations.lineItemDetails) !== null && _s !== void 0 ? _s : {
|
|
32812
|
-
asin: (_u = (_t = params.lineItemDetails) === null || _t === void 0 ? void 0 : _t.asin) !== null && _u !== void 0 ? _u : faker.faker.random.alphaNumeric(10),
|
|
32813
|
-
name: (_w = (_v = params.lineItemDetails) === null || _v === void 0 ? void 0 : _v.name) !== null && _w !== void 0 ? _w : faker.faker.commerce.productName(),
|
|
32814
|
-
sku: (_y = (_x = params.lineItemDetails) === null || _x === void 0 ? void 0 : _x.sku) !== null && _y !== void 0 ? _y : faker.faker.random.numeric(10),
|
|
32815
|
-
weight: weightWithUnitFactory.build((_z = params.lineItemDetails) === null || _z === void 0 ? void 0 : _z.weight)
|
|
32816
|
-
},
|
|
32817
|
-
priceSummary,
|
|
32818
|
-
quantity,
|
|
32819
|
-
requestedShippingOptions: (_0 = associations.requestedShippingOptions) !== null && _0 !== void 0 ? _0 : {
|
|
32820
|
-
shipDate: (_1 = faker.faker.helpers.maybe(() => faker.faker.date.soon(7).toISOString())) !== null && _1 !== void 0 ? _1 : null,
|
|
32821
|
-
shippingService: faker.faker.word.adjective()
|
|
32822
|
-
},
|
|
32823
|
-
salesOrderItemId: faker.faker.datatype.uuid(),
|
|
32824
|
-
shipTo: (_2 = associations.shipTo) !== null && _2 !== void 0 ? _2 : addressFactory.build(params.shipTo)
|
|
32825
|
-
};
|
|
32826
|
-
});
|
|
32827
|
-
/**
|
|
32828
|
-
* @category Factories
|
|
32829
|
-
*/
|
|
32830
|
-
const salesOrderFactory = fishery.Factory.define(({
|
|
32831
|
-
associations,
|
|
32832
|
-
params,
|
|
32833
|
-
sequence,
|
|
32834
|
-
transientParams
|
|
32835
|
-
}) => {
|
|
32836
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
32837
|
-
const createdAt = (_a = params.createdAt) !== null && _a !== void 0 ? _a : faker.faker.date.recent(30).toISOString();
|
|
32838
|
-
let {
|
|
32839
|
-
paymentDetails
|
|
32840
|
-
} = associations;
|
|
32841
|
-
if (!paymentDetails) {
|
|
32842
|
-
const subtotal = moneyFactory.build((_b = params.paymentDetails) === null || _b === void 0 ? void 0 : _b.subtotal, {
|
|
32843
|
-
transient: transientParams
|
|
32844
|
-
});
|
|
32845
|
-
const estimatedShipping = moneyFactory.build(Object.assign({
|
|
32846
|
-
currency: subtotal.currency
|
|
32847
|
-
}, (_c = params.paymentDetails) === null || _c === void 0 ? void 0 : _c.estimatedShipping));
|
|
32848
|
-
const estimatedTax = moneyFactory.build({
|
|
32849
|
-
amount: (_f = (_e = (_d = params.paymentDetails) === null || _d === void 0 ? void 0 : _d.estimatedTax) === null || _e === void 0 ? void 0 : _e.amount) !== null && _f !== void 0 ? _f : subtotal.amount * 0.1,
|
|
32850
|
-
currency: (_j = (_h = (_g = params.paymentDetails) === null || _g === void 0 ? void 0 : _g.estimatedTax) === null || _h === void 0 ? void 0 : _h.currency) !== null && _j !== void 0 ? _j : subtotal.currency
|
|
32851
|
-
});
|
|
32852
|
-
const grandTotal = moneyFactory.build({
|
|
32853
|
-
amount: (_m = (_l = (_k = params.paymentDetails) === null || _k === void 0 ? void 0 : _k.grandTotal) === null || _l === void 0 ? void 0 : _l.amount) !== null && _m !== void 0 ? _m : subtotal.amount + estimatedShipping.amount + estimatedTax.amount,
|
|
32854
|
-
currency: (_q = (_p = (_o = params.paymentDetails) === null || _o === void 0 ? void 0 : _o.grandTotal) === null || _p === void 0 ? void 0 : _p.currency) !== null && _q !== void 0 ? _q : subtotal.currency
|
|
32855
|
-
});
|
|
32856
|
-
paymentDetails = {
|
|
32857
|
-
estimatedShipping,
|
|
32858
|
-
estimatedTax,
|
|
32859
|
-
grandTotal,
|
|
32860
|
-
subtotal
|
|
32861
|
-
};
|
|
32862
|
-
}
|
|
32863
|
-
const shipTo = (_r = associations.shipTo) !== null && _r !== void 0 ? _r : addressFactory.build(params.shipTo || {});
|
|
32864
|
-
return {
|
|
32865
|
-
billTo: (_s = associations.billTo) !== null && _s !== void 0 ? _s : {
|
|
32866
|
-
address: addressFactory.build((_t = params.billTo) === null || _t === void 0 ? void 0 : _t.address),
|
|
32867
|
-
email: faker.faker.internet.email()
|
|
32868
|
-
},
|
|
32869
|
-
createdAt,
|
|
32870
|
-
customer: (_u = associations.customer) !== null && _u !== void 0 ? _u : {
|
|
32871
|
-
email: faker.faker.internet.email(),
|
|
32872
|
-
name: faker.faker.name.fullName(),
|
|
32873
|
-
phone: faker.faker.phone.number()
|
|
32874
|
-
},
|
|
32875
|
-
externalOrderId: faker.faker.random.numeric(9),
|
|
32876
|
-
externalOrderNumber: faker.faker.random.numeric(9),
|
|
32877
|
-
modifiedAt: createdAt,
|
|
32878
|
-
// TODO: What is this? Is it supposed to be in the future?
|
|
32879
|
-
orderDate: createdAt,
|
|
32880
|
-
orderSource: (_v = associations.orderSource) !== null && _v !== void 0 ? _v : orderSourceFactory.build(params.orderSource),
|
|
32881
|
-
paymentDetails,
|
|
32882
|
-
salesOrderId: `se-${20000 + sequence}`,
|
|
32883
|
-
salesOrderItems: salesOrderItemFactory.buildList(2, {}, {
|
|
32884
|
-
associations: {
|
|
32885
|
-
shipTo
|
|
32886
|
-
},
|
|
32887
|
-
transient: transientParams
|
|
32888
|
-
}),
|
|
32889
|
-
salesOrderStatus: (_w = associations.salesOrderStatus) !== null && _w !== void 0 ? _w : {
|
|
32890
|
-
fulfillmentStatus: randomFulfillmentStatus(),
|
|
32891
|
-
isCancelled: false,
|
|
32892
|
-
paymentStatus: randomPaymentStatus()
|
|
32893
|
-
},
|
|
32894
|
-
shipTo
|
|
32895
|
-
};
|
|
32896
|
-
});
|
|
32897
|
-
|
|
32898
|
-
/**
|
|
32899
|
-
* @category Factories
|
|
32900
|
-
*/
|
|
32901
|
-
const warehouseFactory = fishery.Factory.define(({
|
|
32902
|
-
associations,
|
|
32903
|
-
params
|
|
32904
|
-
}) => {
|
|
32905
|
-
var _a, _b, _c;
|
|
32906
|
-
return {
|
|
32907
|
-
createdAt: faker.faker.date.past().toISOString(),
|
|
32908
|
-
isDefault: (_a = params.isDefault) !== null && _a !== void 0 ? _a : false,
|
|
32909
|
-
name: faker.faker.company.name(),
|
|
32910
|
-
originAddress: (_b = associations.originAddress) !== null && _b !== void 0 ? _b : addressFactory.build(params.originAddress),
|
|
32911
|
-
returnAddress: (_c = associations.returnAddress) !== null && _c !== void 0 ? _c : addressFactory.build(params.returnAddress),
|
|
32912
|
-
warehouseId: randomShipengineId()
|
|
32913
|
-
};
|
|
32914
|
-
});
|
|
32915
|
-
|
|
32916
|
-
const renderWithProviders = component => {
|
|
32917
|
-
const theme = brands.createTheme(brands.BrandName.FALLBACK);
|
|
32918
|
-
return react$2.render(component, {
|
|
32919
|
-
wrapper: ({
|
|
32920
|
-
children
|
|
32921
|
-
}) => jsxRuntime.jsx(RootPortalProvider, {
|
|
32922
|
-
children: jsxRuntime.jsx(giger.GigerConfigProvider, Object.assign({
|
|
32923
|
-
resolveIcon: name => `<svg>${name}</svg>`
|
|
32924
|
-
}, {
|
|
32925
|
-
children: jsxRuntime.jsx(react$1.ThemeProvider, Object.assign({
|
|
32926
|
-
theme: brands.deserialize(theme)
|
|
32927
|
-
}, {
|
|
32928
|
-
children: children
|
|
32929
|
-
}))
|
|
32930
|
-
}))
|
|
32931
|
-
})
|
|
32932
|
-
});
|
|
32933
|
-
};
|
|
32934
|
-
/**
|
|
32935
|
-
* Wraps the test with all of the usual Shipengine / Giger / i18 / etc providers that a full, registered "Element" would have.
|
|
32936
|
-
* This allows components to simulate usage in an Element via `decorators: [withAllProviders]`
|
|
32937
|
-
**/
|
|
32938
|
-
const renderWithAllProviders = component => {
|
|
32939
|
-
const theme = brands.createTheme(brands.BrandName.FALLBACK);
|
|
32940
|
-
return react$2.render(component, {
|
|
32941
|
-
wrapper: ({
|
|
32942
|
-
children
|
|
32943
|
-
}) => jsxRuntime.jsx(react.ShipEngineProvider, Object.assign({
|
|
32944
|
-
baseURL: "/api",
|
|
32945
|
-
getToken: () => {
|
|
32946
|
-
var _a;
|
|
32947
|
-
return (_a = process.env.STORYBOOK_TOKEN) !== null && _a !== void 0 ? _a : "none";
|
|
32948
|
-
}
|
|
32949
|
-
}, {
|
|
32950
|
-
children: jsxRuntime.jsx(RootPortalProvider, {
|
|
32951
|
-
children: jsxRuntime.jsx(giger.GigerConfigProvider, Object.assign({
|
|
32952
|
-
resolveIcon: name => `<svg>${name}</svg>`
|
|
32953
|
-
}, {
|
|
32954
|
-
children: jsxRuntime.jsx(react$1.ThemeProvider, Object.assign({
|
|
32955
|
-
theme: brands.deserialize(theme)
|
|
32956
|
-
}, {
|
|
32957
|
-
children: children
|
|
32958
|
-
}))
|
|
32959
|
-
}))
|
|
32960
|
-
})
|
|
32961
|
-
}))
|
|
32962
|
-
});
|
|
32963
|
-
};
|
|
32964
|
-
|
|
32965
32792
|
exports.Accordion = Accordion;
|
|
32966
32793
|
exports.AddFundsForm = AddFundsForm;
|
|
32967
32794
|
exports.AutoFundingForm = AutoFundingForm;
|
|
@@ -32981,14 +32808,14 @@ exports.GigerProvider = GigerProvider;
|
|
|
32981
32808
|
exports.InlineLabel = InlineLabel;
|
|
32982
32809
|
exports.ItemsBreakdown = ItemsBreakdown;
|
|
32983
32810
|
exports.LinkAction = LinkAction;
|
|
32984
|
-
exports.ListCarriers = Element$
|
|
32811
|
+
exports.ListCarriers = Element$6;
|
|
32985
32812
|
exports.Loader = Loader;
|
|
32986
32813
|
exports.ManageFunding = ManageFunding;
|
|
32987
|
-
exports.ManageWarehouses = Element$
|
|
32988
|
-
exports.Onboarding = Element$
|
|
32814
|
+
exports.ManageWarehouses = Element$5;
|
|
32815
|
+
exports.Onboarding = Element$3;
|
|
32989
32816
|
exports.PageLayoutProvider = PageLayoutProvider;
|
|
32990
32817
|
exports.Portal = Portal;
|
|
32991
|
-
exports.PurchaseLabel = Element$
|
|
32818
|
+
exports.PurchaseLabel = Element$4;
|
|
32992
32819
|
exports.RootPortalProvider = RootPortalProvider;
|
|
32993
32820
|
exports.Spacer = Spacer;
|
|
32994
32821
|
exports.Spread = Spread;
|
|
@@ -32998,14 +32825,10 @@ exports.UsState = UsState;
|
|
|
32998
32825
|
exports.UsaCity = UsaCity;
|
|
32999
32826
|
exports.ViewShipment = Element$1;
|
|
33000
32827
|
exports.VoidLabel = Element;
|
|
33001
|
-
exports.
|
|
33002
|
-
exports.addressPreferenceFactory = addressPreferenceFactory;
|
|
33003
|
-
exports.addressValidationFactory = addressValidationFactory;
|
|
32828
|
+
exports.WalletHistory = Element$2;
|
|
33004
32829
|
exports.autoFundingSchema = autoFundingSchema;
|
|
33005
32830
|
exports.calculateTotal = calculateTotal;
|
|
33006
32831
|
exports.capitalizeFirstLetter = capitalizeFirstLetter;
|
|
33007
|
-
exports.carrierFactory = carrierFactory;
|
|
33008
|
-
exports.carrierOptionFactory = carrierOptionFactory;
|
|
33009
32832
|
exports.convertDimensions = convertDimensions;
|
|
33010
32833
|
exports.convertWeight = convertWeight;
|
|
33011
32834
|
exports.countries = countries;
|
|
@@ -33014,9 +32837,7 @@ exports.createCodedErrors = createCodedErrors;
|
|
|
33014
32837
|
exports.createDictionary = createDictionary;
|
|
33015
32838
|
exports.createStyles = createStyles;
|
|
33016
32839
|
exports.currencySymbol = currencySymbol;
|
|
33017
|
-
exports.customsItemFactory = customsItemFactory;
|
|
33018
32840
|
exports.daysAfter = daysAfter;
|
|
33019
|
-
exports.downloadFactory = downloadFactory;
|
|
33020
32841
|
exports.errorMap = errorMap;
|
|
33021
32842
|
exports.euCountryCodes = euCountryCodes;
|
|
33022
32843
|
exports.extendZod = extendZod;
|
|
@@ -33026,7 +32847,6 @@ exports.formatDate = formatDate;
|
|
|
33026
32847
|
exports.formatExpiration = formatExpiration;
|
|
33027
32848
|
exports.formatFractionalWeight = formatFractionalWeight;
|
|
33028
32849
|
exports.formatMoney = formatMoney;
|
|
33029
|
-
exports.fractionalWeightFactory = fractionalWeightFactory;
|
|
33030
32850
|
exports.getAddFundsSchema = getAddFundsSchema;
|
|
33031
32851
|
exports.getCustomsFromSalesOrder = getCustomsFromSalesOrder;
|
|
33032
32852
|
exports.getExpirationYears = getExpirationYears;
|
|
@@ -33047,39 +32867,15 @@ exports.isPoBoxAddress = isPoBoxAddress;
|
|
|
33047
32867
|
exports.isString = isString;
|
|
33048
32868
|
exports.isUnitedStatesTerritory = isUnitedStatesTerritory;
|
|
33049
32869
|
exports.isUspsCarrier = isUspsCarrier;
|
|
33050
|
-
exports.labelFactory = labelFactory;
|
|
33051
|
-
exports.linkedResourceFactory = linkedResourceFactory;
|
|
33052
|
-
exports.moneyFactory = moneyFactory;
|
|
33053
32870
|
exports.moneySchema = moneySchema;
|
|
33054
32871
|
exports.mostRecent = mostRecent;
|
|
33055
32872
|
exports.nextDayCutoff = nextDayCutoff;
|
|
33056
32873
|
exports.omitTime = omitTime;
|
|
33057
|
-
exports.orderSourceFactory = orderSourceFactory;
|
|
33058
|
-
exports.orderSourceRefreshInfoFactory = orderSourceRefreshInfoFactory;
|
|
33059
|
-
exports.packageFactory = packageFactory;
|
|
33060
32874
|
exports.phoneSchema = phoneSchema;
|
|
33061
32875
|
exports.phoneSchemaUnvalidated = phoneSchemaUnvalidated;
|
|
33062
32876
|
exports.postalCodeRegex = postalCodeRegex$3;
|
|
33063
|
-
exports.randomDeliveryConfirmation = randomDeliveryConfirmation;
|
|
33064
|
-
exports.randomFulfillmentStatus = randomFulfillmentStatus;
|
|
33065
|
-
exports.randomInsuranceProvider = randomInsuranceProvider;
|
|
33066
|
-
exports.randomOrderSourceCode = randomOrderSourceCode;
|
|
33067
|
-
exports.randomPaymentStatus = randomPaymentStatus;
|
|
33068
|
-
exports.randomShipengineId = randomShipengineId;
|
|
33069
|
-
exports.randomShipengineSlug = randomShipengineSlug;
|
|
33070
|
-
exports.randomWeightUnit = randomWeightUnit;
|
|
33071
32877
|
exports.registerElement = registerElement;
|
|
33072
|
-
exports.renderWithAllProviders = renderWithAllProviders;
|
|
33073
|
-
exports.renderWithProviders = renderWithProviders;
|
|
33074
|
-
exports.salesOrderFactory = salesOrderFactory;
|
|
33075
|
-
exports.salesOrderItemFactory = salesOrderItemFactory;
|
|
33076
|
-
exports.salesOrderShipmentFactory = salesOrderShipmentFactory;
|
|
33077
|
-
exports.serviceFactory = serviceFactory;
|
|
33078
|
-
exports.shipmentFactory = shipmentFactory;
|
|
33079
|
-
exports.shipmentItemFactory = shipmentItemFactory;
|
|
33080
|
-
exports.shipmentPackageFactory = shipmentPackageFactory;
|
|
33081
32878
|
exports.sortByCreationDate = sortByCreationDate;
|
|
33082
|
-
exports.tristateValue = tristateValue;
|
|
33083
32879
|
exports.usCities = usCities;
|
|
33084
32880
|
exports.usStateCodes = usStateCodes;
|
|
33085
32881
|
exports.usStates = usStates;
|
|
@@ -33102,7 +32898,5 @@ exports.useShippingPresetsOptions = useShippingPresetsOptions;
|
|
|
33102
32898
|
exports.useStateCodeOptions = useStateCodeOptions;
|
|
33103
32899
|
exports.useToggle = useToggle;
|
|
33104
32900
|
exports.useWarehouseOptions = useWarehouseOptions;
|
|
32901
|
+
exports.useWarehouseValidation = useWarehouseValidation;
|
|
33105
32902
|
exports.validationResolver = validationResolver;
|
|
33106
|
-
exports.warehouseFactory = warehouseFactory;
|
|
33107
|
-
exports.weightFactory = weightFactory;
|
|
33108
|
-
exports.weightWithUnitFactory = weightWithUnitFactory;
|