@shipengine/elements 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1166 -1090
- package/index.js +1165 -1094
- package/package.json +1 -1
- package/src/components/templates/shipment-form/shipment-schema.d.ts +380 -153
- package/src/elements/purchase-label/purchase-label.d.ts +38 -49
- package/src/utilities/date.d.ts +46 -5
- package/src/utilities/i18nDateUtils.d.ts +0 -16
package/index.cjs
CHANGED
|
@@ -8,6 +8,8 @@ var reactHookForm = require('react-hook-form');
|
|
|
8
8
|
var reactI18next = require('react-i18next');
|
|
9
9
|
var alchemy = require('@shipengine/alchemy');
|
|
10
10
|
var giger = require('@shipengine/giger');
|
|
11
|
+
var dateFns = require('date-fns');
|
|
12
|
+
var Locales = require('date-fns/locale');
|
|
11
13
|
var axios = require('axios');
|
|
12
14
|
var _$3 = require('lodash');
|
|
13
15
|
var humps = require('humps');
|
|
@@ -16,8 +18,6 @@ var zod = require('zod');
|
|
|
16
18
|
var react = require('@emotion/react');
|
|
17
19
|
var RDP = require('react-datepicker');
|
|
18
20
|
var gigerTheme = require('@shipengine/giger-theme');
|
|
19
|
-
var dateFns = require('date-fns');
|
|
20
|
-
var Locales = require('date-fns/locale');
|
|
21
21
|
var css = require('@emotion/css');
|
|
22
22
|
var reactDom = require('react-dom');
|
|
23
23
|
var jsBase64 = require('js-base64');
|
|
@@ -48,11 +48,11 @@ function _interopNamespace(e) {
|
|
|
48
48
|
|
|
49
49
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
50
50
|
var alchemy__default = /*#__PURE__*/_interopDefaultLegacy(alchemy);
|
|
51
|
+
var Locales__namespace = /*#__PURE__*/_interopNamespace(Locales);
|
|
51
52
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
52
53
|
var ___default = /*#__PURE__*/_interopDefaultLegacy(_$3);
|
|
53
54
|
var humps__default = /*#__PURE__*/_interopDefaultLegacy(humps);
|
|
54
55
|
var RDP__namespace = /*#__PURE__*/_interopNamespace(RDP);
|
|
55
|
-
var Locales__namespace = /*#__PURE__*/_interopNamespace(Locales);
|
|
56
56
|
var copy__default = /*#__PURE__*/_interopDefaultLegacy(copy);
|
|
57
57
|
var cardValidator__default = /*#__PURE__*/_interopDefaultLegacy(cardValidator);
|
|
58
58
|
|
|
@@ -1800,604 +1800,121 @@ const createDictionary = (items, getEntry) => {
|
|
|
1800
1800
|
return (_a = items === null || items === void 0 ? void 0 : items.reduce((results, item) => Object.assign(Object.assign({}, results), getEntry(item, results)), {})) !== null && _a !== void 0 ? _a : {};
|
|
1801
1801
|
};
|
|
1802
1802
|
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
* @internal
|
|
1829
|
-
*
|
|
1830
|
-
* # Date Utils - getDaysInMonth
|
|
1831
|
-
*
|
|
1832
|
-
* @category Utilities
|
|
1833
|
-
*/
|
|
1834
|
-
const daysAfter = (days, date = new Date()) => {
|
|
1835
|
-
date = new Date(date);
|
|
1836
|
-
date.setDate(date.getDate() + days);
|
|
1837
|
-
return date;
|
|
1838
|
-
};
|
|
1839
|
-
/**
|
|
1840
|
-
* @internal
|
|
1841
|
-
*
|
|
1842
|
-
* # Date Utils - getDaysInMonth
|
|
1843
|
-
*
|
|
1844
|
-
* @category Utilities
|
|
1845
|
-
*/
|
|
1846
|
-
const nextDayCutoff = (cutoff, date = new Date()) => date.getHours() >= cutoff ? daysAfter(1, new Date(date)) : new Date(date);
|
|
1847
|
-
/**
|
|
1848
|
-
* @internal
|
|
1849
|
-
*
|
|
1850
|
-
* # Date Utils - getDaysInMonth
|
|
1851
|
-
*
|
|
1852
|
-
* @category Utilities
|
|
1853
|
-
*/
|
|
1854
|
-
const mostRecent = (...dates) => new Date(Math.max(...dates.map(Number)));
|
|
1855
|
-
/**
|
|
1856
|
-
* @internal
|
|
1857
|
-
*
|
|
1858
|
-
* # Date Utils - getDaysInMonth
|
|
1859
|
-
*
|
|
1860
|
-
* @category Utilities
|
|
1861
|
-
*/
|
|
1862
|
-
const omitTime = shipDate => {
|
|
1863
|
-
const date = shipDate ? new Date(shipDate) : new Date();
|
|
1864
|
-
return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
|
|
1865
|
-
};
|
|
1866
|
-
/**
|
|
1867
|
-
* @internal
|
|
1868
|
-
*
|
|
1869
|
-
* # Date Utils - getExpirationYears
|
|
1870
|
-
*
|
|
1871
|
-
* @category Utilities
|
|
1872
|
-
*/
|
|
1873
|
-
const getExpirationYears = yearsValid => {
|
|
1874
|
-
const currentYear = new Date().getFullYear();
|
|
1875
|
-
const years = [];
|
|
1876
|
-
for (let i = 0; i < yearsValid; i++) {
|
|
1877
|
-
years.push(`${currentYear + i}`);
|
|
1878
|
-
}
|
|
1879
|
-
return years;
|
|
1803
|
+
var wellKnownSymbol$d = wellKnownSymbol$k;
|
|
1804
|
+
|
|
1805
|
+
var TO_STRING_TAG$1 = wellKnownSymbol$d('toStringTag');
|
|
1806
|
+
var test$1 = {};
|
|
1807
|
+
|
|
1808
|
+
test$1[TO_STRING_TAG$1] = 'z';
|
|
1809
|
+
|
|
1810
|
+
var toStringTagSupport = String(test$1) === '[object z]';
|
|
1811
|
+
|
|
1812
|
+
var TO_STRING_TAG_SUPPORT = toStringTagSupport;
|
|
1813
|
+
var isCallable$9 = isCallable$o;
|
|
1814
|
+
var classofRaw$1 = classofRaw$2;
|
|
1815
|
+
var wellKnownSymbol$c = wellKnownSymbol$k;
|
|
1816
|
+
|
|
1817
|
+
var TO_STRING_TAG = wellKnownSymbol$c('toStringTag');
|
|
1818
|
+
var $Object = Object;
|
|
1819
|
+
|
|
1820
|
+
// ES3 wrong here
|
|
1821
|
+
var CORRECT_ARGUMENTS = classofRaw$1(function () { return arguments; }()) == 'Arguments';
|
|
1822
|
+
|
|
1823
|
+
// fallback for IE11 Script Access Denied error
|
|
1824
|
+
var tryGet = function (it, key) {
|
|
1825
|
+
try {
|
|
1826
|
+
return it[key];
|
|
1827
|
+
} catch (error) { /* empty */ }
|
|
1880
1828
|
};
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1829
|
+
|
|
1830
|
+
// getting tag from ES6+ `Object.prototype.toString`
|
|
1831
|
+
var classof$6 = TO_STRING_TAG_SUPPORT ? classofRaw$1 : function (it) {
|
|
1832
|
+
var O, tag, result;
|
|
1833
|
+
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
1834
|
+
// @@toStringTag case
|
|
1835
|
+
: typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
|
|
1836
|
+
// builtinTag case
|
|
1837
|
+
: CORRECT_ARGUMENTS ? classofRaw$1(O)
|
|
1838
|
+
// ES3 arguments fallback
|
|
1839
|
+
: (result = classofRaw$1(O)) == 'Object' && isCallable$9(O.callee) ? 'Arguments' : result;
|
|
1891
1840
|
};
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
if (shipDate) return new Date(shipDate) >= new Date();
|
|
1901
|
-
return false;
|
|
1841
|
+
|
|
1842
|
+
var classof$5 = classof$6;
|
|
1843
|
+
|
|
1844
|
+
var $String$1 = String;
|
|
1845
|
+
|
|
1846
|
+
var toString$c = function (argument) {
|
|
1847
|
+
if (classof$5(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
|
|
1848
|
+
return $String$1(argument);
|
|
1902
1849
|
};
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1850
|
+
|
|
1851
|
+
var anObject$9 = anObject$f;
|
|
1852
|
+
|
|
1853
|
+
// `RegExp.prototype.flags` getter implementation
|
|
1854
|
+
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
|
|
1855
|
+
var regexpFlags$1 = function () {
|
|
1856
|
+
var that = anObject$9(this);
|
|
1857
|
+
var result = '';
|
|
1858
|
+
if (that.hasIndices) result += 'd';
|
|
1859
|
+
if (that.global) result += 'g';
|
|
1860
|
+
if (that.ignoreCase) result += 'i';
|
|
1861
|
+
if (that.multiline) result += 'm';
|
|
1862
|
+
if (that.dotAll) result += 's';
|
|
1863
|
+
if (that.unicode) result += 'u';
|
|
1864
|
+
if (that.unicodeSets) result += 'v';
|
|
1865
|
+
if (that.sticky) result += 'y';
|
|
1866
|
+
return result;
|
|
1920
1867
|
};
|
|
1921
1868
|
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1869
|
+
var fails$d = fails$q;
|
|
1870
|
+
var global$d = global$p;
|
|
1871
|
+
|
|
1872
|
+
// babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
|
|
1873
|
+
var $RegExp$2 = global$d.RegExp;
|
|
1874
|
+
|
|
1875
|
+
var UNSUPPORTED_Y$1 = fails$d(function () {
|
|
1876
|
+
var re = $RegExp$2('a', 'y');
|
|
1877
|
+
re.lastIndex = 2;
|
|
1878
|
+
return re.exec('abcd') != null;
|
|
1879
|
+
});
|
|
1880
|
+
|
|
1881
|
+
// UC Browser bug
|
|
1882
|
+
// https://github.com/zloirock/core-js/issues/1008
|
|
1883
|
+
var MISSED_STICKY = UNSUPPORTED_Y$1 || fails$d(function () {
|
|
1884
|
+
return !$RegExp$2('a', 'y').sticky;
|
|
1885
|
+
});
|
|
1886
|
+
|
|
1887
|
+
var BROKEN_CARET = UNSUPPORTED_Y$1 || fails$d(function () {
|
|
1888
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=773687
|
|
1889
|
+
var re = $RegExp$2('^r', 'gy');
|
|
1890
|
+
re.lastIndex = 2;
|
|
1891
|
+
return re.exec('str') != null;
|
|
1892
|
+
});
|
|
1893
|
+
|
|
1894
|
+
var regexpStickyHelpers = {
|
|
1895
|
+
BROKEN_CARET: BROKEN_CARET,
|
|
1896
|
+
MISSED_STICKY: MISSED_STICKY,
|
|
1897
|
+
UNSUPPORTED_Y: UNSUPPORTED_Y$1
|
|
1942
1898
|
};
|
|
1943
|
-
/**
|
|
1944
|
-
* @internal
|
|
1945
|
-
*
|
|
1946
|
-
* - Joins a list of error-like object's messages and throws them as a single error.
|
|
1947
|
-
*
|
|
1948
|
-
* @category Utilities
|
|
1949
|
-
*/
|
|
1950
|
-
function throwJoinedMessages(errors) {
|
|
1951
|
-
throw new Error(errors.map(e => e.message).join(", "));
|
|
1952
|
-
}
|
|
1953
|
-
/**
|
|
1954
|
-
* @internal
|
|
1955
|
-
*
|
|
1956
|
-
* - If any CodedErrors exist, throw them all as a single error, otherwise assert errors is null.
|
|
1957
|
-
*
|
|
1958
|
-
* @category Utilities
|
|
1959
|
-
*/
|
|
1960
|
-
function throwAny(errors) {
|
|
1961
|
-
if (errors) throwJoinedMessages(errors);
|
|
1962
|
-
}
|
|
1963
1899
|
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
*
|
|
1967
|
-
* - The `featureFlags` namespace contains all the feature flags available throughout the
|
|
1968
|
-
* application. All features are scoped by name to the component they are intended for.
|
|
1969
|
-
*
|
|
1970
|
-
* @example
|
|
1971
|
-
* ```tsx
|
|
1972
|
-
* export const featureFlags = {
|
|
1973
|
-
* ConfigureSalesOrderShipment: {
|
|
1974
|
-
* compatibleCountryCodes: ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"],
|
|
1975
|
-
* rateForm: {
|
|
1976
|
-
* enableFunding: false,
|
|
1977
|
-
* enableGlobalPostFiltering: false,
|
|
1978
|
-
* labelLayout: false,
|
|
1979
|
-
* nicknameRate: true,
|
|
1980
|
-
* saveRate: true,
|
|
1981
|
-
* },
|
|
1982
|
-
* shipmentForm: {
|
|
1983
|
-
* browseRates: true,
|
|
1984
|
-
* includeShipsuranceInsurance: true,
|
|
1985
|
-
* includeThirdPartyInsurance: true,
|
|
1986
|
-
* selectService: true,
|
|
1987
|
-
* shippingPresets: false,
|
|
1988
|
-
* },
|
|
1989
|
-
* },
|
|
1990
|
-
* Global: {
|
|
1991
|
-
* carriers: {
|
|
1992
|
-
* enabledCarriers: ["stamps_com", "ups", "dhl_express_walleted"],
|
|
1993
|
-
* },
|
|
1994
|
-
* presentation: {
|
|
1995
|
-
* poweredByShipEngine: false,
|
|
1996
|
-
* },
|
|
1997
|
-
* },
|
|
1998
|
-
* ViewShipment: {
|
|
1999
|
-
* shipment: {
|
|
2000
|
-
* schedulePickup: true,
|
|
2001
|
-
* },
|
|
2002
|
-
* },
|
|
2003
|
-
* } as const;
|
|
2004
|
-
* ```
|
|
2005
|
-
*/
|
|
2006
|
-
const featureFlags = {
|
|
2007
|
-
/**
|
|
2008
|
-
* `ConfigureSalesOrderShipment` all scoped feature flags for the shipment configuration
|
|
2009
|
-
* section of the `<PurchaseLabel />` element.
|
|
2010
|
-
*/
|
|
2011
|
-
ConfigureSalesOrderShipment: {
|
|
2012
|
-
/**
|
|
2013
|
-
* `compatibleCountryCodes` is a list of all supported `countries` available in ShipEngine
|
|
2014
|
-
* Elements.
|
|
2015
|
-
*/
|
|
2016
|
-
compatibleCountryCodes: ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"],
|
|
2017
|
-
/**
|
|
2018
|
-
* `configureShipment` is a group of flags related to the useConfigureShipment functionality
|
|
2019
|
-
*/
|
|
2020
|
-
configureShipment: {
|
|
2021
|
-
/**
|
|
2022
|
-
* `enableErrorWhenShipmentCancelled` when enabled will modify the default behavior of creating a new shipment for a salesorder to throwing an error
|
|
2023
|
-
*/
|
|
2024
|
-
enableErrorWhenShipmentCancelled: false
|
|
2025
|
-
},
|
|
2026
|
-
/**
|
|
2027
|
-
* @internal
|
|
2028
|
-
*
|
|
2029
|
-
* `partnerMessages` enables the partner consuming elements to specify override messages in specific cases.
|
|
2030
|
-
*/
|
|
2031
|
-
partnerMessages: {
|
|
2032
|
-
incompleteLabelPurchaseRequirements: undefined
|
|
2033
|
-
},
|
|
2034
|
-
/**
|
|
2035
|
-
* `rateForm` all scoped feature flags for the `rate form` section of the `<PurchaseLabel />`
|
|
2036
|
-
* element.
|
|
2037
|
-
*/
|
|
2038
|
-
rateForm: {
|
|
2039
|
-
/**
|
|
2040
|
-
* `enableFunding` enables the `funding` section of the rate form.
|
|
2041
|
-
*/
|
|
2042
|
-
enableFunding: false,
|
|
2043
|
-
/**
|
|
2044
|
-
* `enableGlobalPostFiltering` enables the `global post filtering` on all rates fetched
|
|
2045
|
-
* in the rates form.
|
|
2046
|
-
*/
|
|
2047
|
-
enableGlobalPostFiltering: false,
|
|
2048
|
-
/**
|
|
2049
|
-
* `labelLayout` enables the `label layout` section of the `<PurchaseLabel /> element.
|
|
2050
|
-
*/
|
|
2051
|
-
labelLayout: false,
|
|
2052
|
-
/**
|
|
2053
|
-
* `nicknameRate` enables showing the `carrier nickname` when rates are fetched.
|
|
2054
|
-
*/
|
|
2055
|
-
nicknameRate: true,
|
|
2056
|
-
/**
|
|
2057
|
-
* `requireDhlTermsAcknowledgement` enables the `DHL terms acknowledgement` when rates are fetched.
|
|
2058
|
-
*/
|
|
2059
|
-
requireDhlTermsAcknowledgement: false,
|
|
2060
|
-
/**
|
|
2061
|
-
* `saveRate` enables the `save rate` button in the rate form. This allows users to save a
|
|
2062
|
-
* `rateId` for a shipment to be purchased later.
|
|
2063
|
-
*/
|
|
2064
|
-
saveRate: true
|
|
2065
|
-
},
|
|
2066
|
-
/**
|
|
2067
|
-
* `shipmentForm` all scoped feature flags for the `shipment form` section of the
|
|
2068
|
-
* `<PurchaseLabel />` element.
|
|
2069
|
-
*/
|
|
2070
|
-
shipmentForm: {
|
|
2071
|
-
/**
|
|
2072
|
-
* `browseRates` enables the `browse rates` button in the shipment form. This allows users
|
|
2073
|
-
* to browse rates for a shipment with varying shipment configurations. This is useful for
|
|
2074
|
-
* rate shopping.
|
|
2075
|
-
*/
|
|
2076
|
-
browseRates: true,
|
|
2077
|
-
/**
|
|
2078
|
-
* `includeShipsuranceInsurance` enables the `shipsurance insurance` feature, allowing users
|
|
2079
|
-
* to select Shipsurance when insuring their shipment.
|
|
2080
|
-
*/
|
|
2081
|
-
includeShipsuranceInsurance: true,
|
|
2082
|
-
/**
|
|
2083
|
-
* `includeThirdPartyInsurance` enables the `third party insurance` feature, allowing users
|
|
2084
|
-
* to opt for third party insurance when insuring their shipment.
|
|
2085
|
-
*/
|
|
2086
|
-
includeThirdPartyInsurance: true,
|
|
2087
|
-
/**
|
|
2088
|
-
* `selectService` enables the `select service` feature, allowing users to select a service
|
|
2089
|
-
* when rate shopping across multiple carrier providers.
|
|
2090
|
-
*/
|
|
2091
|
-
selectService: true,
|
|
2092
|
-
/**
|
|
2093
|
-
* `shippingPresets` enables the `shipping presets` feature, allowing users to pass in a set
|
|
2094
|
-
* of shipping presets they wish to use within the shipment form of the `<PurchaseLabel />`
|
|
2095
|
-
* element.
|
|
2096
|
-
*/
|
|
2097
|
-
shippingPresets: false
|
|
2098
|
-
}
|
|
2099
|
-
},
|
|
2100
|
-
/**
|
|
2101
|
-
* `Global` all feature flags that are intended for use anywhere in ShipEngine Elements.
|
|
2102
|
-
*/
|
|
2103
|
-
Global: {
|
|
2104
|
-
/**
|
|
2105
|
-
* All global `carrier` related feature flags.
|
|
2106
|
-
*/
|
|
2107
|
-
carriers: {
|
|
2108
|
-
/**
|
|
2109
|
-
* `enabledCarriers` is a list of all `carriers` that are enabled for use in ShipEngine
|
|
2110
|
-
* Elements.
|
|
2111
|
-
*/
|
|
2112
|
-
enabledCarriers: ["stamps_com", "ups_walleted", "dhl_express_walleted", "ups", "hermes", "yodel_walleted"]
|
|
2113
|
-
},
|
|
2114
|
-
/**
|
|
2115
|
-
* All global `presentation` related feature flags.
|
|
2116
|
-
*/
|
|
2117
|
-
presentation: {
|
|
2118
|
-
/**
|
|
2119
|
-
* `poweredByShipEngine` enables the `powered by ShipEngine` logo in the footer various
|
|
2120
|
-
* elements.
|
|
2121
|
-
*/
|
|
2122
|
-
poweredByShipEngine: false
|
|
2123
|
-
}
|
|
2124
|
-
},
|
|
2125
|
-
/**
|
|
2126
|
-
* `ViewShipment` all scoped feature flags for the `<ViewShipment />` element.
|
|
2127
|
-
*/
|
|
2128
|
-
ViewShipment: {
|
|
2129
|
-
/**
|
|
2130
|
-
* `shipment` all shipment related features available in the `<ViewShipment />` element.
|
|
2131
|
-
*/
|
|
2132
|
-
shipment: {
|
|
2133
|
-
/**
|
|
2134
|
-
* `schedulePickup` enables the `schedule pickup` button in the `<ViewShipment />` element,
|
|
2135
|
-
* allowing users to schedule pick-ups for their shipments.
|
|
2136
|
-
*/
|
|
2137
|
-
schedulePickup: true
|
|
2138
|
-
}
|
|
2139
|
-
}
|
|
2140
|
-
};
|
|
2141
|
-
/**
|
|
2142
|
-
* @internal
|
|
2143
|
-
*
|
|
2144
|
-
* # Feature Flags - featureFlagComponentNameLookup
|
|
2145
|
-
*/
|
|
2146
|
-
const featureFlagComponentNameLookup = componentName => {
|
|
2147
|
-
var _a;
|
|
2148
|
-
const lookup = {
|
|
2149
|
-
PurchaseLabel: "ConfigureSalesOrderShipment"
|
|
2150
|
-
};
|
|
2151
|
-
return (_a = lookup[componentName]) !== null && _a !== void 0 ? _a : "";
|
|
2152
|
-
};
|
|
2153
|
-
/**
|
|
2154
|
-
* @internal
|
|
2155
|
-
*
|
|
2156
|
-
* # Feature Flags - getFeatures
|
|
2157
|
-
*/
|
|
2158
|
-
const getFeatures = (...element) => {
|
|
2159
|
-
return element.map(feat => {
|
|
2160
|
-
var _a;
|
|
2161
|
-
return (_a = _$3.get(featureFlags, feat)) !== null && _a !== void 0 ? _a : {};
|
|
2162
|
-
}).reduce((acc, feat) => Object.assign(acc, feat), {});
|
|
2163
|
-
};
|
|
2164
|
-
/**
|
|
2165
|
-
* # Feature Flags - useFeatures
|
|
2166
|
-
*
|
|
2167
|
-
* - The `useFeatures` hook is used to retrieve the feature flags for a given component.
|
|
2168
|
-
*
|
|
2169
|
-
* @example
|
|
2170
|
-
* ```tsx
|
|
2171
|
-
* const features = useFeatures("Global");
|
|
2172
|
-
* ```
|
|
2173
|
-
*
|
|
2174
|
-
* <br />
|
|
2175
|
-
*
|
|
2176
|
-
* @see {@link featureFlags | All available `Feature Flags`}
|
|
2177
|
-
*/
|
|
2178
|
-
const useFeatures = (...element) => {
|
|
2179
|
-
return getFeatures(...element);
|
|
2180
|
-
};
|
|
2181
|
-
|
|
2182
|
-
/**
|
|
2183
|
-
* @internal
|
|
2184
|
-
*
|
|
2185
|
-
* # Form Logger
|
|
2186
|
-
*
|
|
2187
|
-
* @description
|
|
2188
|
-
* This will log the values that are submitted to the validation resolver
|
|
2189
|
-
* (only REGISTERED form fields) and the results of that validation.
|
|
2190
|
-
*
|
|
2191
|
-
* @usage Wrap the submission:
|
|
2192
|
-
* `<form onSubmit={formLogger.capture(handleSubmit)}>`
|
|
2193
|
-
*
|
|
2194
|
-
* @category Utilities
|
|
2195
|
-
*/
|
|
2196
|
-
const formLogger = {
|
|
2197
|
-
capture(handleSubmit) {
|
|
2198
|
-
return e => {
|
|
2199
|
-
// Prevent parent form submission in nested forms. This shouldn't be necessary, but React's
|
|
2200
|
-
// event bubbling doesn't handle the formId target properly when passed through a portal.
|
|
2201
|
-
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
2202
|
-
this.isSubmitting = true;
|
|
2203
|
-
void handleSubmit(e);
|
|
2204
|
-
this.isSubmitting = false;
|
|
2205
|
-
};
|
|
2206
|
-
},
|
|
2207
|
-
isSubmitting: false,
|
|
2208
|
-
log: (values, getValidationResult) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2209
|
-
alchemy.logger.info({
|
|
2210
|
-
obj: values
|
|
2211
|
-
}, "Validating registered form fields:");
|
|
2212
|
-
const validationResult = yield getValidationResult();
|
|
2213
|
-
if (Object.keys(validationResult.errors).length) alchemy.logger.error({
|
|
2214
|
-
obj: validationResult.errors
|
|
2215
|
-
}, "Validation failed. Errors object:");else alchemy.logger.info({
|
|
2216
|
-
obj: validationResult.values
|
|
2217
|
-
}, "Validation passed. Final payload after defaults & transforms:");
|
|
2218
|
-
return validationResult;
|
|
2219
|
-
})
|
|
2220
|
-
};
|
|
1900
|
+
var fails$c = fails$q;
|
|
1901
|
+
var global$c = global$p;
|
|
2221
1902
|
|
|
2222
|
-
|
|
1903
|
+
// babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
|
|
1904
|
+
var $RegExp$1 = global$c.RegExp;
|
|
2223
1905
|
|
|
2224
|
-
var
|
|
2225
|
-
var
|
|
1906
|
+
var regexpUnsupportedDotAll = fails$c(function () {
|
|
1907
|
+
var re = $RegExp$1('.', 's');
|
|
1908
|
+
return !(re.dotAll && re.exec('\n') && re.flags === 's');
|
|
1909
|
+
});
|
|
2226
1910
|
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
var toStringTagSupport = String(test$1) === '[object z]';
|
|
2230
|
-
|
|
2231
|
-
var TO_STRING_TAG_SUPPORT = toStringTagSupport;
|
|
2232
|
-
var isCallable$9 = isCallable$o;
|
|
2233
|
-
var classofRaw$1 = classofRaw$2;
|
|
2234
|
-
var wellKnownSymbol$c = wellKnownSymbol$k;
|
|
2235
|
-
|
|
2236
|
-
var TO_STRING_TAG = wellKnownSymbol$c('toStringTag');
|
|
2237
|
-
var $Object = Object;
|
|
2238
|
-
|
|
2239
|
-
// ES3 wrong here
|
|
2240
|
-
var CORRECT_ARGUMENTS = classofRaw$1(function () { return arguments; }()) == 'Arguments';
|
|
2241
|
-
|
|
2242
|
-
// fallback for IE11 Script Access Denied error
|
|
2243
|
-
var tryGet = function (it, key) {
|
|
2244
|
-
try {
|
|
2245
|
-
return it[key];
|
|
2246
|
-
} catch (error) { /* empty */ }
|
|
2247
|
-
};
|
|
2248
|
-
|
|
2249
|
-
// getting tag from ES6+ `Object.prototype.toString`
|
|
2250
|
-
var classof$6 = TO_STRING_TAG_SUPPORT ? classofRaw$1 : function (it) {
|
|
2251
|
-
var O, tag, result;
|
|
2252
|
-
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
2253
|
-
// @@toStringTag case
|
|
2254
|
-
: typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
|
|
2255
|
-
// builtinTag case
|
|
2256
|
-
: CORRECT_ARGUMENTS ? classofRaw$1(O)
|
|
2257
|
-
// ES3 arguments fallback
|
|
2258
|
-
: (result = classofRaw$1(O)) == 'Object' && isCallable$9(O.callee) ? 'Arguments' : result;
|
|
2259
|
-
};
|
|
2260
|
-
|
|
2261
|
-
var classof$5 = classof$6;
|
|
2262
|
-
|
|
2263
|
-
var $String$1 = String;
|
|
2264
|
-
|
|
2265
|
-
var toString$c = function (argument) {
|
|
2266
|
-
if (classof$5(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
|
|
2267
|
-
return $String$1(argument);
|
|
2268
|
-
};
|
|
2269
|
-
|
|
2270
|
-
// a string of all valid unicode whitespaces
|
|
2271
|
-
var whitespaces$4 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
|
|
2272
|
-
'\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
|
2273
|
-
|
|
2274
|
-
var uncurryThis$h = functionUncurryThis;
|
|
2275
|
-
var requireObjectCoercible$6 = requireObjectCoercible$9;
|
|
2276
|
-
var toString$b = toString$c;
|
|
2277
|
-
var whitespaces$3 = whitespaces$4;
|
|
2278
|
-
|
|
2279
|
-
var replace$3 = uncurryThis$h(''.replace);
|
|
2280
|
-
var whitespace = '[' + whitespaces$3 + ']';
|
|
2281
|
-
var ltrim = RegExp('^' + whitespace + whitespace + '*');
|
|
2282
|
-
var rtrim = RegExp(whitespace + whitespace + '*$');
|
|
2283
|
-
|
|
2284
|
-
// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
|
|
2285
|
-
var createMethod$1 = function (TYPE) {
|
|
2286
|
-
return function ($this) {
|
|
2287
|
-
var string = toString$b(requireObjectCoercible$6($this));
|
|
2288
|
-
if (TYPE & 1) string = replace$3(string, ltrim, '');
|
|
2289
|
-
if (TYPE & 2) string = replace$3(string, rtrim, '');
|
|
2290
|
-
return string;
|
|
2291
|
-
};
|
|
2292
|
-
};
|
|
2293
|
-
|
|
2294
|
-
var stringTrim = {
|
|
2295
|
-
// `String.prototype.{ trimLeft, trimStart }` methods
|
|
2296
|
-
// https://tc39.es/ecma262/#sec-string.prototype.trimstart
|
|
2297
|
-
start: createMethod$1(1),
|
|
2298
|
-
// `String.prototype.{ trimRight, trimEnd }` methods
|
|
2299
|
-
// https://tc39.es/ecma262/#sec-string.prototype.trimend
|
|
2300
|
-
end: createMethod$1(2),
|
|
2301
|
-
// `String.prototype.trim` method
|
|
2302
|
-
// https://tc39.es/ecma262/#sec-string.prototype.trim
|
|
2303
|
-
trim: createMethod$1(3)
|
|
2304
|
-
};
|
|
2305
|
-
|
|
2306
|
-
var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
|
|
2307
|
-
var fails$d = fails$q;
|
|
2308
|
-
var whitespaces$2 = whitespaces$4;
|
|
2309
|
-
|
|
2310
|
-
var non = '\u200B\u0085\u180E';
|
|
2311
|
-
|
|
2312
|
-
// check that a method works with the correct list
|
|
2313
|
-
// of whitespaces and has a correct name
|
|
2314
|
-
var stringTrimForced = function (METHOD_NAME) {
|
|
2315
|
-
return fails$d(function () {
|
|
2316
|
-
return !!whitespaces$2[METHOD_NAME]()
|
|
2317
|
-
|| non[METHOD_NAME]() !== non
|
|
2318
|
-
|| (PROPER_FUNCTION_NAME$1 && whitespaces$2[METHOD_NAME].name !== METHOD_NAME);
|
|
2319
|
-
});
|
|
2320
|
-
};
|
|
2321
|
-
|
|
2322
|
-
var $$h = _export;
|
|
2323
|
-
var $trim = stringTrim.trim;
|
|
2324
|
-
var forcedStringTrimMethod = stringTrimForced;
|
|
2325
|
-
|
|
2326
|
-
// `String.prototype.trim` method
|
|
2327
|
-
// https://tc39.es/ecma262/#sec-string.prototype.trim
|
|
2328
|
-
$$h({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
|
|
2329
|
-
trim: function trim() {
|
|
2330
|
-
return $trim(this);
|
|
2331
|
-
}
|
|
2332
|
-
});
|
|
2333
|
-
|
|
2334
|
-
var anObject$9 = anObject$f;
|
|
2335
|
-
|
|
2336
|
-
// `RegExp.prototype.flags` getter implementation
|
|
2337
|
-
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
|
|
2338
|
-
var regexpFlags$1 = function () {
|
|
2339
|
-
var that = anObject$9(this);
|
|
2340
|
-
var result = '';
|
|
2341
|
-
if (that.hasIndices) result += 'd';
|
|
2342
|
-
if (that.global) result += 'g';
|
|
2343
|
-
if (that.ignoreCase) result += 'i';
|
|
2344
|
-
if (that.multiline) result += 'm';
|
|
2345
|
-
if (that.dotAll) result += 's';
|
|
2346
|
-
if (that.unicode) result += 'u';
|
|
2347
|
-
if (that.unicodeSets) result += 'v';
|
|
2348
|
-
if (that.sticky) result += 'y';
|
|
2349
|
-
return result;
|
|
2350
|
-
};
|
|
2351
|
-
|
|
2352
|
-
var fails$c = fails$q;
|
|
2353
|
-
var global$d = global$p;
|
|
2354
|
-
|
|
2355
|
-
// babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
|
|
2356
|
-
var $RegExp$2 = global$d.RegExp;
|
|
2357
|
-
|
|
2358
|
-
var UNSUPPORTED_Y$1 = fails$c(function () {
|
|
2359
|
-
var re = $RegExp$2('a', 'y');
|
|
2360
|
-
re.lastIndex = 2;
|
|
2361
|
-
return re.exec('abcd') != null;
|
|
2362
|
-
});
|
|
2363
|
-
|
|
2364
|
-
// UC Browser bug
|
|
2365
|
-
// https://github.com/zloirock/core-js/issues/1008
|
|
2366
|
-
var MISSED_STICKY = UNSUPPORTED_Y$1 || fails$c(function () {
|
|
2367
|
-
return !$RegExp$2('a', 'y').sticky;
|
|
2368
|
-
});
|
|
2369
|
-
|
|
2370
|
-
var BROKEN_CARET = UNSUPPORTED_Y$1 || fails$c(function () {
|
|
2371
|
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=773687
|
|
2372
|
-
var re = $RegExp$2('^r', 'gy');
|
|
2373
|
-
re.lastIndex = 2;
|
|
2374
|
-
return re.exec('str') != null;
|
|
2375
|
-
});
|
|
2376
|
-
|
|
2377
|
-
var regexpStickyHelpers = {
|
|
2378
|
-
BROKEN_CARET: BROKEN_CARET,
|
|
2379
|
-
MISSED_STICKY: MISSED_STICKY,
|
|
2380
|
-
UNSUPPORTED_Y: UNSUPPORTED_Y$1
|
|
2381
|
-
};
|
|
2382
|
-
|
|
2383
|
-
var fails$b = fails$q;
|
|
2384
|
-
var global$c = global$p;
|
|
2385
|
-
|
|
2386
|
-
// babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
|
|
2387
|
-
var $RegExp$1 = global$c.RegExp;
|
|
2388
|
-
|
|
2389
|
-
var regexpUnsupportedDotAll = fails$b(function () {
|
|
2390
|
-
var re = $RegExp$1('.', 's');
|
|
2391
|
-
return !(re.dotAll && re.exec('\n') && re.flags === 's');
|
|
2392
|
-
});
|
|
2393
|
-
|
|
2394
|
-
var fails$a = fails$q;
|
|
2395
|
-
var global$b = global$p;
|
|
1911
|
+
var fails$b = fails$q;
|
|
1912
|
+
var global$b = global$p;
|
|
2396
1913
|
|
|
2397
1914
|
// babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
|
|
2398
1915
|
var $RegExp = global$b.RegExp;
|
|
2399
1916
|
|
|
2400
|
-
var regexpUnsupportedNcg = fails$
|
|
1917
|
+
var regexpUnsupportedNcg = fails$b(function () {
|
|
2401
1918
|
var re = $RegExp('(?<a>b)', 'g');
|
|
2402
1919
|
return re.exec('b').groups.a !== 'b' ||
|
|
2403
1920
|
'b'.replace(re, '$<a>c') !== 'bc';
|
|
@@ -2406,8 +1923,8 @@ var regexpUnsupportedNcg = fails$a(function () {
|
|
|
2406
1923
|
/* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
|
|
2407
1924
|
/* eslint-disable regexp/no-useless-quantifier -- testing */
|
|
2408
1925
|
var call$d = functionCall;
|
|
2409
|
-
var uncurryThis$
|
|
2410
|
-
var toString$
|
|
1926
|
+
var uncurryThis$h = functionUncurryThis;
|
|
1927
|
+
var toString$b = toString$c;
|
|
2411
1928
|
var regexpFlags = regexpFlags$1;
|
|
2412
1929
|
var stickyHelpers = regexpStickyHelpers;
|
|
2413
1930
|
var shared = shared$4.exports;
|
|
@@ -2419,10 +1936,10 @@ var UNSUPPORTED_NCG = regexpUnsupportedNcg;
|
|
|
2419
1936
|
var nativeReplace = shared('native-string-replace', String.prototype.replace);
|
|
2420
1937
|
var nativeExec = RegExp.prototype.exec;
|
|
2421
1938
|
var patchedExec = nativeExec;
|
|
2422
|
-
var charAt$4 = uncurryThis$
|
|
2423
|
-
var indexOf$1 = uncurryThis$
|
|
2424
|
-
var replace$
|
|
2425
|
-
var stringSlice$6 = uncurryThis$
|
|
1939
|
+
var charAt$4 = uncurryThis$h(''.charAt);
|
|
1940
|
+
var indexOf$1 = uncurryThis$h(''.indexOf);
|
|
1941
|
+
var replace$3 = uncurryThis$h(''.replace);
|
|
1942
|
+
var stringSlice$6 = uncurryThis$h(''.slice);
|
|
2426
1943
|
|
|
2427
1944
|
var UPDATES_LAST_INDEX_WRONG = (function () {
|
|
2428
1945
|
var re1 = /a/;
|
|
@@ -2443,7 +1960,7 @@ if (PATCH) {
|
|
|
2443
1960
|
patchedExec = function exec(string) {
|
|
2444
1961
|
var re = this;
|
|
2445
1962
|
var state = getInternalState(re);
|
|
2446
|
-
var str = toString$
|
|
1963
|
+
var str = toString$b(string);
|
|
2447
1964
|
var raw = state.raw;
|
|
2448
1965
|
var result, reCopy, lastIndex, match, i, object, group;
|
|
2449
1966
|
|
|
@@ -2462,7 +1979,7 @@ if (PATCH) {
|
|
|
2462
1979
|
var strCopy = str;
|
|
2463
1980
|
|
|
2464
1981
|
if (sticky) {
|
|
2465
|
-
flags = replace$
|
|
1982
|
+
flags = replace$3(flags, 'y', '');
|
|
2466
1983
|
if (indexOf$1(flags, 'g') === -1) {
|
|
2467
1984
|
flags += 'g';
|
|
2468
1985
|
}
|
|
@@ -2520,12 +2037,12 @@ if (PATCH) {
|
|
|
2520
2037
|
|
|
2521
2038
|
var regexpExec$2 = patchedExec;
|
|
2522
2039
|
|
|
2523
|
-
var $$
|
|
2040
|
+
var $$h = _export;
|
|
2524
2041
|
var exec$2 = regexpExec$2;
|
|
2525
2042
|
|
|
2526
2043
|
// `RegExp.prototype.exec` method
|
|
2527
2044
|
// https://tc39.es/ecma262/#sec-regexp.prototype.exec
|
|
2528
|
-
$$
|
|
2045
|
+
$$h({ target: 'RegExp', proto: true, forced: /./.exec !== exec$2 }, {
|
|
2529
2046
|
exec: exec$2
|
|
2530
2047
|
});
|
|
2531
2048
|
|
|
@@ -2541,21 +2058,21 @@ var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$
|
|
|
2541
2058
|
});
|
|
2542
2059
|
|
|
2543
2060
|
var classofRaw = classofRaw$2;
|
|
2544
|
-
var uncurryThis$
|
|
2061
|
+
var uncurryThis$g = functionUncurryThis;
|
|
2545
2062
|
|
|
2546
2063
|
var functionUncurryThisClause = function (fn) {
|
|
2547
2064
|
// Nashorn bug:
|
|
2548
2065
|
// https://github.com/zloirock/core-js/issues/1128
|
|
2549
2066
|
// https://github.com/zloirock/core-js/issues/1130
|
|
2550
|
-
if (classofRaw(fn) === 'Function') return uncurryThis$
|
|
2067
|
+
if (classofRaw(fn) === 'Function') return uncurryThis$g(fn);
|
|
2551
2068
|
};
|
|
2552
2069
|
|
|
2553
2070
|
// TODO: Remove from `core-js@4` since it's moved to entry points
|
|
2554
2071
|
|
|
2555
|
-
var uncurryThis$
|
|
2072
|
+
var uncurryThis$f = functionUncurryThisClause;
|
|
2556
2073
|
var defineBuiltIn$3 = defineBuiltIn$7;
|
|
2557
2074
|
var regexpExec$1 = regexpExec$2;
|
|
2558
|
-
var fails$
|
|
2075
|
+
var fails$a = fails$q;
|
|
2559
2076
|
var wellKnownSymbol$b = wellKnownSymbol$k;
|
|
2560
2077
|
var createNonEnumerableProperty = createNonEnumerableProperty$5;
|
|
2561
2078
|
|
|
@@ -2565,14 +2082,14 @@ var RegExpPrototype$2 = RegExp.prototype;
|
|
|
2565
2082
|
var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
|
|
2566
2083
|
var SYMBOL = wellKnownSymbol$b(KEY);
|
|
2567
2084
|
|
|
2568
|
-
var DELEGATES_TO_SYMBOL = !fails$
|
|
2085
|
+
var DELEGATES_TO_SYMBOL = !fails$a(function () {
|
|
2569
2086
|
// String methods call symbol-named RegEp methods
|
|
2570
2087
|
var O = {};
|
|
2571
2088
|
O[SYMBOL] = function () { return 7; };
|
|
2572
2089
|
return ''[KEY](O) != 7;
|
|
2573
2090
|
});
|
|
2574
2091
|
|
|
2575
|
-
var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails$
|
|
2092
|
+
var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails$a(function () {
|
|
2576
2093
|
// Symbol-named RegExp methods call .exec
|
|
2577
2094
|
var execCalled = false;
|
|
2578
2095
|
var re = /a/;
|
|
@@ -2589,288 +2106,933 @@ var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
|
|
|
2589
2106
|
re.flags = '';
|
|
2590
2107
|
re[SYMBOL] = /./[SYMBOL];
|
|
2591
2108
|
}
|
|
2592
|
-
|
|
2593
|
-
re.exec = function () { execCalled = true; return null; };
|
|
2594
|
-
|
|
2595
|
-
re[SYMBOL]('');
|
|
2596
|
-
return !execCalled;
|
|
2597
|
-
});
|
|
2598
|
-
|
|
2599
|
-
if (
|
|
2600
|
-
!DELEGATES_TO_SYMBOL ||
|
|
2601
|
-
!DELEGATES_TO_EXEC ||
|
|
2602
|
-
FORCED
|
|
2603
|
-
) {
|
|
2604
|
-
var uncurriedNativeRegExpMethod = uncurryThis$
|
|
2605
|
-
var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
|
2606
|
-
var uncurriedNativeMethod = uncurryThis$
|
|
2607
|
-
var $exec = regexp.exec;
|
|
2608
|
-
if ($exec === regexpExec$1 || $exec === RegExpPrototype$2.exec) {
|
|
2609
|
-
if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
|
|
2610
|
-
// The native String method already delegates to @@method (this
|
|
2611
|
-
// polyfilled function), leasing to infinite recursion.
|
|
2612
|
-
// We avoid it by directly calling the native @@method method.
|
|
2613
|
-
return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
|
|
2614
|
-
}
|
|
2615
|
-
return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
|
|
2616
|
-
}
|
|
2617
|
-
return { done: false };
|
|
2618
|
-
});
|
|
2619
|
-
|
|
2620
|
-
defineBuiltIn$3(String.prototype, KEY, methods[0]);
|
|
2621
|
-
defineBuiltIn$3(RegExpPrototype$2, SYMBOL, methods[1]);
|
|
2109
|
+
|
|
2110
|
+
re.exec = function () { execCalled = true; return null; };
|
|
2111
|
+
|
|
2112
|
+
re[SYMBOL]('');
|
|
2113
|
+
return !execCalled;
|
|
2114
|
+
});
|
|
2115
|
+
|
|
2116
|
+
if (
|
|
2117
|
+
!DELEGATES_TO_SYMBOL ||
|
|
2118
|
+
!DELEGATES_TO_EXEC ||
|
|
2119
|
+
FORCED
|
|
2120
|
+
) {
|
|
2121
|
+
var uncurriedNativeRegExpMethod = uncurryThis$f(/./[SYMBOL]);
|
|
2122
|
+
var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
|
2123
|
+
var uncurriedNativeMethod = uncurryThis$f(nativeMethod);
|
|
2124
|
+
var $exec = regexp.exec;
|
|
2125
|
+
if ($exec === regexpExec$1 || $exec === RegExpPrototype$2.exec) {
|
|
2126
|
+
if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
|
|
2127
|
+
// The native String method already delegates to @@method (this
|
|
2128
|
+
// polyfilled function), leasing to infinite recursion.
|
|
2129
|
+
// We avoid it by directly calling the native @@method method.
|
|
2130
|
+
return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
|
|
2131
|
+
}
|
|
2132
|
+
return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
|
|
2133
|
+
}
|
|
2134
|
+
return { done: false };
|
|
2135
|
+
});
|
|
2136
|
+
|
|
2137
|
+
defineBuiltIn$3(String.prototype, KEY, methods[0]);
|
|
2138
|
+
defineBuiltIn$3(RegExpPrototype$2, SYMBOL, methods[1]);
|
|
2139
|
+
}
|
|
2140
|
+
|
|
2141
|
+
if (SHAM) createNonEnumerableProperty(RegExpPrototype$2[SYMBOL], 'sham', true);
|
|
2142
|
+
};
|
|
2143
|
+
|
|
2144
|
+
var uncurryThis$e = functionUncurryThis;
|
|
2145
|
+
var toIntegerOrInfinity$3 = toIntegerOrInfinity$6;
|
|
2146
|
+
var toString$a = toString$c;
|
|
2147
|
+
var requireObjectCoercible$6 = requireObjectCoercible$9;
|
|
2148
|
+
|
|
2149
|
+
var charAt$3 = uncurryThis$e(''.charAt);
|
|
2150
|
+
var charCodeAt = uncurryThis$e(''.charCodeAt);
|
|
2151
|
+
var stringSlice$5 = uncurryThis$e(''.slice);
|
|
2152
|
+
|
|
2153
|
+
var createMethod$1 = function (CONVERT_TO_STRING) {
|
|
2154
|
+
return function ($this, pos) {
|
|
2155
|
+
var S = toString$a(requireObjectCoercible$6($this));
|
|
2156
|
+
var position = toIntegerOrInfinity$3(pos);
|
|
2157
|
+
var size = S.length;
|
|
2158
|
+
var first, second;
|
|
2159
|
+
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
|
2160
|
+
first = charCodeAt(S, position);
|
|
2161
|
+
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
|
2162
|
+
|| (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
|
|
2163
|
+
? CONVERT_TO_STRING
|
|
2164
|
+
? charAt$3(S, position)
|
|
2165
|
+
: first
|
|
2166
|
+
: CONVERT_TO_STRING
|
|
2167
|
+
? stringSlice$5(S, position, position + 2)
|
|
2168
|
+
: (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
|
2169
|
+
};
|
|
2170
|
+
};
|
|
2171
|
+
|
|
2172
|
+
var stringMultibyte = {
|
|
2173
|
+
// `String.prototype.codePointAt` method
|
|
2174
|
+
// https://tc39.es/ecma262/#sec-string.prototype.codepointat
|
|
2175
|
+
codeAt: createMethod$1(false),
|
|
2176
|
+
// `String.prototype.at` method
|
|
2177
|
+
// https://github.com/mathiasbynens/String.prototype.at
|
|
2178
|
+
charAt: createMethod$1(true)
|
|
2179
|
+
};
|
|
2180
|
+
|
|
2181
|
+
var charAt$2 = stringMultibyte.charAt;
|
|
2182
|
+
|
|
2183
|
+
// `AdvanceStringIndex` abstract operation
|
|
2184
|
+
// https://tc39.es/ecma262/#sec-advancestringindex
|
|
2185
|
+
var advanceStringIndex$2 = function (S, index, unicode) {
|
|
2186
|
+
return index + (unicode ? charAt$2(S, index).length : 1);
|
|
2187
|
+
};
|
|
2188
|
+
|
|
2189
|
+
var uncurryThis$d = functionUncurryThis;
|
|
2190
|
+
var toObject$2 = toObject$7;
|
|
2191
|
+
|
|
2192
|
+
var floor$2 = Math.floor;
|
|
2193
|
+
var charAt$1 = uncurryThis$d(''.charAt);
|
|
2194
|
+
var replace$2 = uncurryThis$d(''.replace);
|
|
2195
|
+
var stringSlice$4 = uncurryThis$d(''.slice);
|
|
2196
|
+
var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
|
|
2197
|
+
var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
|
|
2198
|
+
|
|
2199
|
+
// `GetSubstitution` abstract operation
|
|
2200
|
+
// https://tc39.es/ecma262/#sec-getsubstitution
|
|
2201
|
+
var getSubstitution$2 = function (matched, str, position, captures, namedCaptures, replacement) {
|
|
2202
|
+
var tailPos = position + matched.length;
|
|
2203
|
+
var m = captures.length;
|
|
2204
|
+
var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
|
|
2205
|
+
if (namedCaptures !== undefined) {
|
|
2206
|
+
namedCaptures = toObject$2(namedCaptures);
|
|
2207
|
+
symbols = SUBSTITUTION_SYMBOLS;
|
|
2208
|
+
}
|
|
2209
|
+
return replace$2(replacement, symbols, function (match, ch) {
|
|
2210
|
+
var capture;
|
|
2211
|
+
switch (charAt$1(ch, 0)) {
|
|
2212
|
+
case '$': return '$';
|
|
2213
|
+
case '&': return matched;
|
|
2214
|
+
case '`': return stringSlice$4(str, 0, position);
|
|
2215
|
+
case "'": return stringSlice$4(str, tailPos);
|
|
2216
|
+
case '<':
|
|
2217
|
+
capture = namedCaptures[stringSlice$4(ch, 1, -1)];
|
|
2218
|
+
break;
|
|
2219
|
+
default: // \d\d?
|
|
2220
|
+
var n = +ch;
|
|
2221
|
+
if (n === 0) return match;
|
|
2222
|
+
if (n > m) {
|
|
2223
|
+
var f = floor$2(n / 10);
|
|
2224
|
+
if (f === 0) return match;
|
|
2225
|
+
if (f <= m) return captures[f - 1] === undefined ? charAt$1(ch, 1) : captures[f - 1] + charAt$1(ch, 1);
|
|
2226
|
+
return match;
|
|
2227
|
+
}
|
|
2228
|
+
capture = captures[n - 1];
|
|
2229
|
+
}
|
|
2230
|
+
return capture === undefined ? '' : capture;
|
|
2231
|
+
});
|
|
2232
|
+
};
|
|
2233
|
+
|
|
2234
|
+
var call$b = functionCall;
|
|
2235
|
+
var anObject$8 = anObject$f;
|
|
2236
|
+
var isCallable$8 = isCallable$o;
|
|
2237
|
+
var classof$4 = classofRaw$2;
|
|
2238
|
+
var regexpExec = regexpExec$2;
|
|
2239
|
+
|
|
2240
|
+
var $TypeError$a = TypeError;
|
|
2241
|
+
|
|
2242
|
+
// `RegExpExec` abstract operation
|
|
2243
|
+
// https://tc39.es/ecma262/#sec-regexpexec
|
|
2244
|
+
var regexpExecAbstract = function (R, S) {
|
|
2245
|
+
var exec = R.exec;
|
|
2246
|
+
if (isCallable$8(exec)) {
|
|
2247
|
+
var result = call$b(exec, R, S);
|
|
2248
|
+
if (result !== null) anObject$8(result);
|
|
2249
|
+
return result;
|
|
2250
|
+
}
|
|
2251
|
+
if (classof$4(R) === 'RegExp') return call$b(regexpExec, R, S);
|
|
2252
|
+
throw $TypeError$a('RegExp#exec called on incompatible receiver');
|
|
2253
|
+
};
|
|
2254
|
+
|
|
2255
|
+
var apply$1 = functionApply;
|
|
2256
|
+
var call$a = functionCall;
|
|
2257
|
+
var uncurryThis$c = functionUncurryThis;
|
|
2258
|
+
var fixRegExpWellKnownSymbolLogic$1 = fixRegexpWellKnownSymbolLogic;
|
|
2259
|
+
var fails$9 = fails$q;
|
|
2260
|
+
var anObject$7 = anObject$f;
|
|
2261
|
+
var isCallable$7 = isCallable$o;
|
|
2262
|
+
var isNullOrUndefined$4 = isNullOrUndefined$7;
|
|
2263
|
+
var toIntegerOrInfinity$2 = toIntegerOrInfinity$6;
|
|
2264
|
+
var toLength$1 = toLength$3;
|
|
2265
|
+
var toString$9 = toString$c;
|
|
2266
|
+
var requireObjectCoercible$5 = requireObjectCoercible$9;
|
|
2267
|
+
var advanceStringIndex$1 = advanceStringIndex$2;
|
|
2268
|
+
var getMethod$4 = getMethod$6;
|
|
2269
|
+
var getSubstitution$1 = getSubstitution$2;
|
|
2270
|
+
var regExpExec$1 = regexpExecAbstract;
|
|
2271
|
+
var wellKnownSymbol$a = wellKnownSymbol$k;
|
|
2272
|
+
|
|
2273
|
+
var REPLACE$1 = wellKnownSymbol$a('replace');
|
|
2274
|
+
var max$2 = Math.max;
|
|
2275
|
+
var min = Math.min;
|
|
2276
|
+
var concat = uncurryThis$c([].concat);
|
|
2277
|
+
var push$1 = uncurryThis$c([].push);
|
|
2278
|
+
var stringIndexOf$2 = uncurryThis$c(''.indexOf);
|
|
2279
|
+
var stringSlice$3 = uncurryThis$c(''.slice);
|
|
2280
|
+
|
|
2281
|
+
var maybeToString = function (it) {
|
|
2282
|
+
return it === undefined ? it : String(it);
|
|
2283
|
+
};
|
|
2284
|
+
|
|
2285
|
+
// IE <= 11 replaces $0 with the whole match, as if it was $&
|
|
2286
|
+
// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
|
|
2287
|
+
var REPLACE_KEEPS_$0 = (function () {
|
|
2288
|
+
// eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
|
|
2289
|
+
return 'a'.replace(/./, '$0') === '$0';
|
|
2290
|
+
})();
|
|
2291
|
+
|
|
2292
|
+
// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
|
|
2293
|
+
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
|
|
2294
|
+
if (/./[REPLACE$1]) {
|
|
2295
|
+
return /./[REPLACE$1]('a', '$0') === '';
|
|
2296
|
+
}
|
|
2297
|
+
return false;
|
|
2298
|
+
})();
|
|
2299
|
+
|
|
2300
|
+
var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$9(function () {
|
|
2301
|
+
var re = /./;
|
|
2302
|
+
re.exec = function () {
|
|
2303
|
+
var result = [];
|
|
2304
|
+
result.groups = { a: '7' };
|
|
2305
|
+
return result;
|
|
2306
|
+
};
|
|
2307
|
+
// eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
|
|
2308
|
+
return ''.replace(re, '$<a>') !== '7';
|
|
2309
|
+
});
|
|
2310
|
+
|
|
2311
|
+
// @@replace logic
|
|
2312
|
+
fixRegExpWellKnownSymbolLogic$1('replace', function (_, nativeReplace, maybeCallNative) {
|
|
2313
|
+
var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
|
|
2314
|
+
|
|
2315
|
+
return [
|
|
2316
|
+
// `String.prototype.replace` method
|
|
2317
|
+
// https://tc39.es/ecma262/#sec-string.prototype.replace
|
|
2318
|
+
function replace(searchValue, replaceValue) {
|
|
2319
|
+
var O = requireObjectCoercible$5(this);
|
|
2320
|
+
var replacer = isNullOrUndefined$4(searchValue) ? undefined : getMethod$4(searchValue, REPLACE$1);
|
|
2321
|
+
return replacer
|
|
2322
|
+
? call$a(replacer, searchValue, O, replaceValue)
|
|
2323
|
+
: call$a(nativeReplace, toString$9(O), searchValue, replaceValue);
|
|
2324
|
+
},
|
|
2325
|
+
// `RegExp.prototype[@@replace]` method
|
|
2326
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
|
|
2327
|
+
function (string, replaceValue) {
|
|
2328
|
+
var rx = anObject$7(this);
|
|
2329
|
+
var S = toString$9(string);
|
|
2330
|
+
|
|
2331
|
+
if (
|
|
2332
|
+
typeof replaceValue == 'string' &&
|
|
2333
|
+
stringIndexOf$2(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
|
|
2334
|
+
stringIndexOf$2(replaceValue, '$<') === -1
|
|
2335
|
+
) {
|
|
2336
|
+
var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
|
|
2337
|
+
if (res.done) return res.value;
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
var functionalReplace = isCallable$7(replaceValue);
|
|
2341
|
+
if (!functionalReplace) replaceValue = toString$9(replaceValue);
|
|
2342
|
+
|
|
2343
|
+
var global = rx.global;
|
|
2344
|
+
if (global) {
|
|
2345
|
+
var fullUnicode = rx.unicode;
|
|
2346
|
+
rx.lastIndex = 0;
|
|
2347
|
+
}
|
|
2348
|
+
var results = [];
|
|
2349
|
+
while (true) {
|
|
2350
|
+
var result = regExpExec$1(rx, S);
|
|
2351
|
+
if (result === null) break;
|
|
2352
|
+
|
|
2353
|
+
push$1(results, result);
|
|
2354
|
+
if (!global) break;
|
|
2355
|
+
|
|
2356
|
+
var matchStr = toString$9(result[0]);
|
|
2357
|
+
if (matchStr === '') rx.lastIndex = advanceStringIndex$1(S, toLength$1(rx.lastIndex), fullUnicode);
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
var accumulatedResult = '';
|
|
2361
|
+
var nextSourcePosition = 0;
|
|
2362
|
+
for (var i = 0; i < results.length; i++) {
|
|
2363
|
+
result = results[i];
|
|
2364
|
+
|
|
2365
|
+
var matched = toString$9(result[0]);
|
|
2366
|
+
var position = max$2(min(toIntegerOrInfinity$2(result.index), S.length), 0);
|
|
2367
|
+
var captures = [];
|
|
2368
|
+
// NOTE: This is equivalent to
|
|
2369
|
+
// captures = result.slice(1).map(maybeToString)
|
|
2370
|
+
// but for some reason `nativeSlice.call(result, 1, result.length)` (called in
|
|
2371
|
+
// the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
|
|
2372
|
+
// causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
|
|
2373
|
+
for (var j = 1; j < result.length; j++) push$1(captures, maybeToString(result[j]));
|
|
2374
|
+
var namedCaptures = result.groups;
|
|
2375
|
+
if (functionalReplace) {
|
|
2376
|
+
var replacerArgs = concat([matched], captures, position, S);
|
|
2377
|
+
if (namedCaptures !== undefined) push$1(replacerArgs, namedCaptures);
|
|
2378
|
+
var replacement = toString$9(apply$1(replaceValue, undefined, replacerArgs));
|
|
2379
|
+
} else {
|
|
2380
|
+
replacement = getSubstitution$1(matched, S, position, captures, namedCaptures, replaceValue);
|
|
2381
|
+
}
|
|
2382
|
+
if (position >= nextSourcePosition) {
|
|
2383
|
+
accumulatedResult += stringSlice$3(S, nextSourcePosition, position) + replacement;
|
|
2384
|
+
nextSourcePosition = position + matched.length;
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
return accumulatedResult + stringSlice$3(S, nextSourcePosition);
|
|
2388
|
+
}
|
|
2389
|
+
];
|
|
2390
|
+
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
|
|
2391
|
+
|
|
2392
|
+
var isObject$3 = isObject$a;
|
|
2393
|
+
var classof$3 = classofRaw$2;
|
|
2394
|
+
var wellKnownSymbol$9 = wellKnownSymbol$k;
|
|
2395
|
+
|
|
2396
|
+
var MATCH$1 = wellKnownSymbol$9('match');
|
|
2397
|
+
|
|
2398
|
+
// `IsRegExp` abstract operation
|
|
2399
|
+
// https://tc39.es/ecma262/#sec-isregexp
|
|
2400
|
+
var isRegexp = function (it) {
|
|
2401
|
+
var isRegExp;
|
|
2402
|
+
return isObject$3(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$3(it) == 'RegExp');
|
|
2403
|
+
};
|
|
2404
|
+
|
|
2405
|
+
var call$9 = functionCall;
|
|
2406
|
+
var hasOwn$2 = hasOwnProperty_1;
|
|
2407
|
+
var isPrototypeOf$3 = objectIsPrototypeOf;
|
|
2408
|
+
var regExpFlags = regexpFlags$1;
|
|
2409
|
+
|
|
2410
|
+
var RegExpPrototype$1 = RegExp.prototype;
|
|
2411
|
+
|
|
2412
|
+
var regexpGetFlags = function (R) {
|
|
2413
|
+
var flags = R.flags;
|
|
2414
|
+
return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn$2(R, 'flags') && isPrototypeOf$3(RegExpPrototype$1, R)
|
|
2415
|
+
? call$9(regExpFlags, R) : flags;
|
|
2416
|
+
};
|
|
2417
|
+
|
|
2418
|
+
var $$g = _export;
|
|
2419
|
+
var call$8 = functionCall;
|
|
2420
|
+
var uncurryThis$b = functionUncurryThis;
|
|
2421
|
+
var requireObjectCoercible$4 = requireObjectCoercible$9;
|
|
2422
|
+
var isCallable$6 = isCallable$o;
|
|
2423
|
+
var isNullOrUndefined$3 = isNullOrUndefined$7;
|
|
2424
|
+
var isRegExp$1 = isRegexp;
|
|
2425
|
+
var toString$8 = toString$c;
|
|
2426
|
+
var getMethod$3 = getMethod$6;
|
|
2427
|
+
var getRegExpFlags$1 = regexpGetFlags;
|
|
2428
|
+
var getSubstitution = getSubstitution$2;
|
|
2429
|
+
var wellKnownSymbol$8 = wellKnownSymbol$k;
|
|
2430
|
+
|
|
2431
|
+
var REPLACE = wellKnownSymbol$8('replace');
|
|
2432
|
+
var $TypeError$9 = TypeError;
|
|
2433
|
+
var indexOf = uncurryThis$b(''.indexOf);
|
|
2434
|
+
uncurryThis$b(''.replace);
|
|
2435
|
+
var stringSlice$2 = uncurryThis$b(''.slice);
|
|
2436
|
+
var max$1 = Math.max;
|
|
2437
|
+
|
|
2438
|
+
var stringIndexOf$1 = function (string, searchValue, fromIndex) {
|
|
2439
|
+
if (fromIndex > string.length) return -1;
|
|
2440
|
+
if (searchValue === '') return fromIndex;
|
|
2441
|
+
return indexOf(string, searchValue, fromIndex);
|
|
2442
|
+
};
|
|
2443
|
+
|
|
2444
|
+
// `String.prototype.replaceAll` method
|
|
2445
|
+
// https://tc39.es/ecma262/#sec-string.prototype.replaceall
|
|
2446
|
+
$$g({ target: 'String', proto: true }, {
|
|
2447
|
+
replaceAll: function replaceAll(searchValue, replaceValue) {
|
|
2448
|
+
var O = requireObjectCoercible$4(this);
|
|
2449
|
+
var IS_REG_EXP, flags, replacer, string, searchString, functionalReplace, searchLength, advanceBy, replacement;
|
|
2450
|
+
var position = 0;
|
|
2451
|
+
var endOfLastMatch = 0;
|
|
2452
|
+
var result = '';
|
|
2453
|
+
if (!isNullOrUndefined$3(searchValue)) {
|
|
2454
|
+
IS_REG_EXP = isRegExp$1(searchValue);
|
|
2455
|
+
if (IS_REG_EXP) {
|
|
2456
|
+
flags = toString$8(requireObjectCoercible$4(getRegExpFlags$1(searchValue)));
|
|
2457
|
+
if (!~indexOf(flags, 'g')) throw $TypeError$9('`.replaceAll` does not allow non-global regexes');
|
|
2458
|
+
}
|
|
2459
|
+
replacer = getMethod$3(searchValue, REPLACE);
|
|
2460
|
+
if (replacer) {
|
|
2461
|
+
return call$8(replacer, searchValue, O, replaceValue);
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
string = toString$8(O);
|
|
2465
|
+
searchString = toString$8(searchValue);
|
|
2466
|
+
functionalReplace = isCallable$6(replaceValue);
|
|
2467
|
+
if (!functionalReplace) replaceValue = toString$8(replaceValue);
|
|
2468
|
+
searchLength = searchString.length;
|
|
2469
|
+
advanceBy = max$1(1, searchLength);
|
|
2470
|
+
position = stringIndexOf$1(string, searchString, 0);
|
|
2471
|
+
while (position !== -1) {
|
|
2472
|
+
replacement = functionalReplace
|
|
2473
|
+
? toString$8(replaceValue(searchString, position, string))
|
|
2474
|
+
: getSubstitution(searchString, string, position, [], undefined, replaceValue);
|
|
2475
|
+
result += stringSlice$2(string, endOfLastMatch, position) + replacement;
|
|
2476
|
+
endOfLastMatch = position + searchLength;
|
|
2477
|
+
position = stringIndexOf$1(string, searchString, position + advanceBy);
|
|
2478
|
+
}
|
|
2479
|
+
if (endOfLastMatch < string.length) {
|
|
2480
|
+
result += stringSlice$2(string, endOfLastMatch);
|
|
2481
|
+
}
|
|
2482
|
+
return result;
|
|
2483
|
+
}
|
|
2484
|
+
});
|
|
2485
|
+
|
|
2486
|
+
/**
|
|
2487
|
+
* @internal
|
|
2488
|
+
*
|
|
2489
|
+
* # Date Utils - Formats a date to the current locale
|
|
2490
|
+
*
|
|
2491
|
+
* @category Utilities
|
|
2492
|
+
*/
|
|
2493
|
+
const formatDate = (date, locale = "en-US") => new Date(date).toLocaleDateString(locale, {
|
|
2494
|
+
day: "numeric",
|
|
2495
|
+
month: "long",
|
|
2496
|
+
year: "numeric"
|
|
2497
|
+
});
|
|
2498
|
+
/**
|
|
2499
|
+
* @internal
|
|
2500
|
+
* Get the locale data for a given locale string.
|
|
2501
|
+
* @param locale string i.e. "en-US"
|
|
2502
|
+
* @returns locale data
|
|
2503
|
+
*/
|
|
2504
|
+
const findDateLocale = (locale = "en-US") => {
|
|
2505
|
+
const loadableLocale = locale.replaceAll("-", "");
|
|
2506
|
+
const rootLocale = locale.split("-")[0];
|
|
2507
|
+
const targetLocale = loadableLocale in Locales__namespace ? loadableLocale : rootLocale;
|
|
2508
|
+
return Locales__namespace[targetLocale];
|
|
2509
|
+
};
|
|
2510
|
+
/**
|
|
2511
|
+
* @internal
|
|
2512
|
+
* Given a date and a locale, format the date to the locale's date format.
|
|
2513
|
+
* @param date
|
|
2514
|
+
* @param locale string i.e. "en-US"
|
|
2515
|
+
* @param dateFormat string. See https://date-fns.org/v3.3.1/docs/format
|
|
2516
|
+
* @returns formatted date string
|
|
2517
|
+
*/
|
|
2518
|
+
const formatByDateAndLocale = (date, locale = "en-US", dateFormat) => {
|
|
2519
|
+
const localeData = findDateLocale(locale);
|
|
2520
|
+
const localeDateFormat = getlocaleDateStringFormat(locale);
|
|
2521
|
+
return dateFns.format(date, dateFormat !== null && dateFormat !== void 0 ? dateFormat : localeDateFormat, {
|
|
2522
|
+
locale: localeData
|
|
2523
|
+
});
|
|
2524
|
+
};
|
|
2525
|
+
/**
|
|
2526
|
+
* @internal
|
|
2527
|
+
* Parse a string in the CURRENT locale into a Date object.
|
|
2528
|
+
* @param date string
|
|
2529
|
+
* @param locale
|
|
2530
|
+
* @returns date
|
|
2531
|
+
*/
|
|
2532
|
+
const parseLocaleDate = (date, locale = "en-US", dateFormat = "P") => {
|
|
2533
|
+
const localeData = findDateLocale(locale);
|
|
2534
|
+
return dateFns.parse(date, dateFormat, new Date(), {
|
|
2535
|
+
locale: localeData
|
|
2536
|
+
});
|
|
2537
|
+
};
|
|
2538
|
+
/**
|
|
2539
|
+
* @internal
|
|
2540
|
+
*
|
|
2541
|
+
* # Date Utils - formatDateDDMMYY
|
|
2542
|
+
*
|
|
2543
|
+
* @category Utilities
|
|
2544
|
+
*/
|
|
2545
|
+
const formatDateDDMMYY = (date, locale = "en-US") => new Date(date).toLocaleDateString(locale, {
|
|
2546
|
+
day: "2-digit",
|
|
2547
|
+
month: "2-digit",
|
|
2548
|
+
year: "2-digit"
|
|
2549
|
+
});
|
|
2550
|
+
/**
|
|
2551
|
+
* @internal
|
|
2552
|
+
*
|
|
2553
|
+
* # Date Utils - formatDateDDMMYYYY
|
|
2554
|
+
*
|
|
2555
|
+
* @category Utilities
|
|
2556
|
+
*/
|
|
2557
|
+
const formatDateDDMMYYYY = (date, locale = "en-US") => new Date(date).toLocaleDateString(locale, {
|
|
2558
|
+
day: "2-digit",
|
|
2559
|
+
month: "2-digit",
|
|
2560
|
+
year: "numeric"
|
|
2561
|
+
});
|
|
2562
|
+
/**
|
|
2563
|
+
* @internal
|
|
2564
|
+
*
|
|
2565
|
+
* Get the date format in the current locale i.e., "MM/DD/YYYY"
|
|
2566
|
+
*
|
|
2567
|
+
* @category Utilities
|
|
2568
|
+
* @returns Date format as string
|
|
2569
|
+
*/
|
|
2570
|
+
const getlocaleDateStringFormat = (locale = "en-US") => {
|
|
2571
|
+
var _a;
|
|
2572
|
+
const localeData = findDateLocale(locale);
|
|
2573
|
+
const dateFormatString = (_a = localeData.formatLong) === null || _a === void 0 ? void 0 : _a.date({
|
|
2574
|
+
width: "short"
|
|
2575
|
+
});
|
|
2576
|
+
return dateFormatString;
|
|
2577
|
+
};
|
|
2578
|
+
/**
|
|
2579
|
+
* @internal
|
|
2580
|
+
*
|
|
2581
|
+
* # Date Utils - Get the date a number of days after a given date
|
|
2582
|
+
*
|
|
2583
|
+
* @category Utilities
|
|
2584
|
+
*/
|
|
2585
|
+
const daysAfter = (days, date = new Date()) => {
|
|
2586
|
+
date = new Date(date);
|
|
2587
|
+
date.setDate(date.getDate() + days);
|
|
2588
|
+
return date;
|
|
2589
|
+
};
|
|
2590
|
+
/**
|
|
2591
|
+
* @internal
|
|
2592
|
+
*
|
|
2593
|
+
* # Date Utils - Get a cutoff date for a given date or the current date
|
|
2594
|
+
*
|
|
2595
|
+
* @category Utilities
|
|
2596
|
+
*/
|
|
2597
|
+
const nextDayCutoff = (cutoff, date = new Date()) => date.getHours() >= cutoff ? daysAfter(1, new Date(date)) : new Date(date);
|
|
2598
|
+
/**
|
|
2599
|
+
* @internal
|
|
2600
|
+
*
|
|
2601
|
+
* # Date Utils - get the most recent date from a list of dates
|
|
2602
|
+
*
|
|
2603
|
+
* @category Utilities
|
|
2604
|
+
*/
|
|
2605
|
+
const mostRecent = (...dates) => new Date(Math.max(...dates.map(Number)));
|
|
2606
|
+
/**
|
|
2607
|
+
* @internal
|
|
2608
|
+
*
|
|
2609
|
+
* # Date Utils - Given a date, return a new date with the time set to 00:00:00
|
|
2610
|
+
*
|
|
2611
|
+
* @category Utilities
|
|
2612
|
+
*/
|
|
2613
|
+
const omitTime = shipDate => {
|
|
2614
|
+
const date = shipDate ? new Date(shipDate) : new Date();
|
|
2615
|
+
return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
|
|
2616
|
+
};
|
|
2617
|
+
/**
|
|
2618
|
+
* @internal
|
|
2619
|
+
*
|
|
2620
|
+
* # Date Utils - getExpirationYears
|
|
2621
|
+
*
|
|
2622
|
+
* @category Utilities
|
|
2623
|
+
*/
|
|
2624
|
+
const getExpirationYears = yearsValid => {
|
|
2625
|
+
const currentYear = new Date().getFullYear();
|
|
2626
|
+
const years = [];
|
|
2627
|
+
for (let i = 0; i < yearsValid; i++) {
|
|
2628
|
+
years.push(`${currentYear + i}`);
|
|
2629
|
+
}
|
|
2630
|
+
return years;
|
|
2631
|
+
};
|
|
2632
|
+
/**
|
|
2633
|
+
* @internal
|
|
2634
|
+
*
|
|
2635
|
+
* # Date Utilities - sortByCreationDate
|
|
2636
|
+
*
|
|
2637
|
+
* @category Utilities
|
|
2638
|
+
*/
|
|
2639
|
+
const sortByCreationDate = (a, b, order = "desc") => {
|
|
2640
|
+
const [x, y] = order === "asc" ? [a, b] : [b, a];
|
|
2641
|
+
return new Date(x.createdAt).getTime() - new Date(y.createdAt).getTime();
|
|
2642
|
+
};
|
|
2643
|
+
/**
|
|
2644
|
+
* @internal
|
|
2645
|
+
*
|
|
2646
|
+
* # Date Utilities - isNowOrInTheFuture
|
|
2647
|
+
*
|
|
2648
|
+
* @category Utilities
|
|
2649
|
+
*/
|
|
2650
|
+
const isNowOrInTheFuture = shipDate => {
|
|
2651
|
+
if (shipDate) return new Date(shipDate) >= new Date();
|
|
2652
|
+
return false;
|
|
2653
|
+
};
|
|
2654
|
+
/**
|
|
2655
|
+
* @internal
|
|
2656
|
+
*
|
|
2657
|
+
* # Date Utilities - getRelativeDates
|
|
2658
|
+
*
|
|
2659
|
+
* @category Utilities
|
|
2660
|
+
*/
|
|
2661
|
+
const getRelativeDates = from => {
|
|
2662
|
+
const origin = from !== null && from !== void 0 ? from : new Date();
|
|
2663
|
+
return {
|
|
2664
|
+
firstDayOfMonth: new Date(origin.getFullYear(), origin.getMonth(), 1),
|
|
2665
|
+
lastDayOfTheMonth: new Date(origin.getFullYear(), origin.getMonth() + 1, 0),
|
|
2666
|
+
origin,
|
|
2667
|
+
previousMonthFirstDay: new Date(origin.getFullYear(), origin.getMonth() - 1, 1),
|
|
2668
|
+
previousMonthLastDay: new Date(origin.getFullYear(), origin.getMonth() - 1 + 1, 0),
|
|
2669
|
+
thirtyDaysAgo: new Date(new Date().setDate(origin.getDate() - 30))
|
|
2670
|
+
};
|
|
2671
|
+
};
|
|
2672
|
+
|
|
2673
|
+
/**
|
|
2674
|
+
* @internal
|
|
2675
|
+
*
|
|
2676
|
+
* # Create Coded Errors Utlity Function
|
|
2677
|
+
*
|
|
2678
|
+
* - This function extracts errors from our `Axios Responses`.
|
|
2679
|
+
*
|
|
2680
|
+
* @category Utilities
|
|
2681
|
+
*/
|
|
2682
|
+
const createCodedErrors = err => {
|
|
2683
|
+
var _a;
|
|
2684
|
+
if (axios__default["default"].isAxiosError(err)) {
|
|
2685
|
+
return (_a = err.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
2686
|
+
}
|
|
2687
|
+
return [{
|
|
2688
|
+
errorCode: "unknown",
|
|
2689
|
+
errorSource: "elements",
|
|
2690
|
+
errorType: "unknown",
|
|
2691
|
+
message: err.message
|
|
2692
|
+
}];
|
|
2693
|
+
};
|
|
2694
|
+
/**
|
|
2695
|
+
* @internal
|
|
2696
|
+
*
|
|
2697
|
+
* - Joins a list of error-like object's messages and throws them as a single error.
|
|
2698
|
+
*
|
|
2699
|
+
* @category Utilities
|
|
2700
|
+
*/
|
|
2701
|
+
function throwJoinedMessages(errors) {
|
|
2702
|
+
throw new Error(errors.map(e => e.message).join(", "));
|
|
2703
|
+
}
|
|
2704
|
+
/**
|
|
2705
|
+
* @internal
|
|
2706
|
+
*
|
|
2707
|
+
* - If any CodedErrors exist, throw them all as a single error, otherwise assert errors is null.
|
|
2708
|
+
*
|
|
2709
|
+
* @category Utilities
|
|
2710
|
+
*/
|
|
2711
|
+
function throwAny(errors) {
|
|
2712
|
+
if (errors) throwJoinedMessages(errors);
|
|
2713
|
+
}
|
|
2714
|
+
|
|
2715
|
+
/**
|
|
2716
|
+
* @namespace featureFlags
|
|
2717
|
+
*
|
|
2718
|
+
* - The `featureFlags` namespace contains all the feature flags available throughout the
|
|
2719
|
+
* application. All features are scoped by name to the component they are intended for.
|
|
2720
|
+
*
|
|
2721
|
+
* @example
|
|
2722
|
+
* ```tsx
|
|
2723
|
+
* export const featureFlags = {
|
|
2724
|
+
* ConfigureSalesOrderShipment: {
|
|
2725
|
+
* compatibleCountryCodes: ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"],
|
|
2726
|
+
* rateForm: {
|
|
2727
|
+
* enableFunding: false,
|
|
2728
|
+
* enableGlobalPostFiltering: false,
|
|
2729
|
+
* labelLayout: false,
|
|
2730
|
+
* nicknameRate: true,
|
|
2731
|
+
* saveRate: true,
|
|
2732
|
+
* },
|
|
2733
|
+
* shipmentForm: {
|
|
2734
|
+
* browseRates: true,
|
|
2735
|
+
* includeShipsuranceInsurance: true,
|
|
2736
|
+
* includeThirdPartyInsurance: true,
|
|
2737
|
+
* selectService: true,
|
|
2738
|
+
* shippingPresets: false,
|
|
2739
|
+
* },
|
|
2740
|
+
* },
|
|
2741
|
+
* Global: {
|
|
2742
|
+
* carriers: {
|
|
2743
|
+
* enabledCarriers: ["stamps_com", "ups", "dhl_express_walleted"],
|
|
2744
|
+
* },
|
|
2745
|
+
* presentation: {
|
|
2746
|
+
* poweredByShipEngine: false,
|
|
2747
|
+
* },
|
|
2748
|
+
* },
|
|
2749
|
+
* ViewShipment: {
|
|
2750
|
+
* shipment: {
|
|
2751
|
+
* schedulePickup: true,
|
|
2752
|
+
* },
|
|
2753
|
+
* },
|
|
2754
|
+
* } as const;
|
|
2755
|
+
* ```
|
|
2756
|
+
*/
|
|
2757
|
+
const featureFlags = {
|
|
2758
|
+
/**
|
|
2759
|
+
* `ConfigureSalesOrderShipment` all scoped feature flags for the shipment configuration
|
|
2760
|
+
* section of the `<PurchaseLabel />` element.
|
|
2761
|
+
*/
|
|
2762
|
+
ConfigureSalesOrderShipment: {
|
|
2763
|
+
/**
|
|
2764
|
+
* `compatibleCountryCodes` is a list of all supported `countries` available in ShipEngine
|
|
2765
|
+
* Elements.
|
|
2766
|
+
*/
|
|
2767
|
+
compatibleCountryCodes: ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"],
|
|
2768
|
+
/**
|
|
2769
|
+
* `configureShipment` is a group of flags related to the useConfigureShipment functionality
|
|
2770
|
+
*/
|
|
2771
|
+
configureShipment: {
|
|
2772
|
+
/**
|
|
2773
|
+
* `enableErrorWhenShipmentCancelled` when enabled will modify the default behavior of creating a new shipment for a salesorder to throwing an error
|
|
2774
|
+
*/
|
|
2775
|
+
enableErrorWhenShipmentCancelled: false
|
|
2776
|
+
},
|
|
2777
|
+
/**
|
|
2778
|
+
* @internal
|
|
2779
|
+
*
|
|
2780
|
+
* `partnerMessages` enables the partner consuming elements to specify override messages in specific cases.
|
|
2781
|
+
*/
|
|
2782
|
+
partnerMessages: {
|
|
2783
|
+
incompleteLabelPurchaseRequirements: undefined
|
|
2784
|
+
},
|
|
2785
|
+
/**
|
|
2786
|
+
* `rateForm` all scoped feature flags for the `rate form` section of the `<PurchaseLabel />`
|
|
2787
|
+
* element.
|
|
2788
|
+
*/
|
|
2789
|
+
rateForm: {
|
|
2790
|
+
/**
|
|
2791
|
+
* `enableFunding` enables the `funding` section of the rate form.
|
|
2792
|
+
*/
|
|
2793
|
+
enableFunding: false,
|
|
2794
|
+
/**
|
|
2795
|
+
* `enableGlobalPostFiltering` enables the `global post filtering` on all rates fetched
|
|
2796
|
+
* in the rates form.
|
|
2797
|
+
*/
|
|
2798
|
+
enableGlobalPostFiltering: false,
|
|
2799
|
+
/**
|
|
2800
|
+
* `labelLayout` enables the `label layout` section of the `<PurchaseLabel /> element.
|
|
2801
|
+
*/
|
|
2802
|
+
labelLayout: false,
|
|
2803
|
+
/**
|
|
2804
|
+
* `nicknameRate` enables showing the `carrier nickname` when rates are fetched.
|
|
2805
|
+
*/
|
|
2806
|
+
nicknameRate: true,
|
|
2807
|
+
/**
|
|
2808
|
+
* `requireDhlTermsAcknowledgement` enables the `DHL terms acknowledgement` when rates are fetched.
|
|
2809
|
+
*/
|
|
2810
|
+
requireDhlTermsAcknowledgement: false,
|
|
2811
|
+
/**
|
|
2812
|
+
* `saveRate` enables the `save rate` button in the rate form. This allows users to save a
|
|
2813
|
+
* `rateId` for a shipment to be purchased later.
|
|
2814
|
+
*/
|
|
2815
|
+
saveRate: true
|
|
2816
|
+
},
|
|
2817
|
+
/**
|
|
2818
|
+
* `shipmentForm` all scoped feature flags for the `shipment form` section of the
|
|
2819
|
+
* `<PurchaseLabel />` element.
|
|
2820
|
+
*/
|
|
2821
|
+
shipmentForm: {
|
|
2822
|
+
/**
|
|
2823
|
+
* `browseRates` enables the `browse rates` button in the shipment form. This allows users
|
|
2824
|
+
* to browse rates for a shipment with varying shipment configurations. This is useful for
|
|
2825
|
+
* rate shopping.
|
|
2826
|
+
*/
|
|
2827
|
+
browseRates: true,
|
|
2828
|
+
/**
|
|
2829
|
+
* `includeShipsuranceInsurance` enables the `shipsurance insurance` feature, allowing users
|
|
2830
|
+
* to select Shipsurance when insuring their shipment.
|
|
2831
|
+
*/
|
|
2832
|
+
includeShipsuranceInsurance: true,
|
|
2833
|
+
/**
|
|
2834
|
+
* `includeThirdPartyInsurance` enables the `third party insurance` feature, allowing users
|
|
2835
|
+
* to opt for third party insurance when insuring their shipment.
|
|
2836
|
+
*/
|
|
2837
|
+
includeThirdPartyInsurance: true,
|
|
2838
|
+
/**
|
|
2839
|
+
* `selectService` enables the `select service` feature, allowing users to select a service
|
|
2840
|
+
* when rate shopping across multiple carrier providers.
|
|
2841
|
+
*/
|
|
2842
|
+
selectService: true,
|
|
2843
|
+
/**
|
|
2844
|
+
* `shippingPresets` enables the `shipping presets` feature, allowing users to pass in a set
|
|
2845
|
+
* of shipping presets they wish to use within the shipment form of the `<PurchaseLabel />`
|
|
2846
|
+
* element.
|
|
2847
|
+
*/
|
|
2848
|
+
shippingPresets: false
|
|
2849
|
+
}
|
|
2850
|
+
},
|
|
2851
|
+
/**
|
|
2852
|
+
* `Global` all feature flags that are intended for use anywhere in ShipEngine Elements.
|
|
2853
|
+
*/
|
|
2854
|
+
Global: {
|
|
2855
|
+
/**
|
|
2856
|
+
* All global `carrier` related feature flags.
|
|
2857
|
+
*/
|
|
2858
|
+
carriers: {
|
|
2859
|
+
/**
|
|
2860
|
+
* `enabledCarriers` is a list of all `carriers` that are enabled for use in ShipEngine
|
|
2861
|
+
* Elements.
|
|
2862
|
+
*/
|
|
2863
|
+
enabledCarriers: ["stamps_com", "ups_walleted", "dhl_express_walleted", "ups", "hermes", "yodel_walleted"]
|
|
2864
|
+
},
|
|
2865
|
+
/**
|
|
2866
|
+
* All global `presentation` related feature flags.
|
|
2867
|
+
*/
|
|
2868
|
+
presentation: {
|
|
2869
|
+
/**
|
|
2870
|
+
* `poweredByShipEngine` enables the `powered by ShipEngine` logo in the footer various
|
|
2871
|
+
* elements.
|
|
2872
|
+
*/
|
|
2873
|
+
poweredByShipEngine: false
|
|
2874
|
+
}
|
|
2875
|
+
},
|
|
2876
|
+
/**
|
|
2877
|
+
* `ViewShipment` all scoped feature flags for the `<ViewShipment />` element.
|
|
2878
|
+
*/
|
|
2879
|
+
ViewShipment: {
|
|
2880
|
+
/**
|
|
2881
|
+
* `shipment` all shipment related features available in the `<ViewShipment />` element.
|
|
2882
|
+
*/
|
|
2883
|
+
shipment: {
|
|
2884
|
+
/**
|
|
2885
|
+
* `schedulePickup` enables the `schedule pickup` button in the `<ViewShipment />` element,
|
|
2886
|
+
* allowing users to schedule pick-ups for their shipments.
|
|
2887
|
+
*/
|
|
2888
|
+
schedulePickup: true
|
|
2889
|
+
}
|
|
2622
2890
|
}
|
|
2623
|
-
|
|
2624
|
-
if (SHAM) createNonEnumerableProperty(RegExpPrototype$2[SYMBOL], 'sham', true);
|
|
2625
2891
|
};
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
var
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
var createMethod = function (CONVERT_TO_STRING) {
|
|
2637
|
-
return function ($this, pos) {
|
|
2638
|
-
var S = toString$9(requireObjectCoercible$5($this));
|
|
2639
|
-
var position = toIntegerOrInfinity$3(pos);
|
|
2640
|
-
var size = S.length;
|
|
2641
|
-
var first, second;
|
|
2642
|
-
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
|
2643
|
-
first = charCodeAt(S, position);
|
|
2644
|
-
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
|
2645
|
-
|| (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
|
|
2646
|
-
? CONVERT_TO_STRING
|
|
2647
|
-
? charAt$3(S, position)
|
|
2648
|
-
: first
|
|
2649
|
-
: CONVERT_TO_STRING
|
|
2650
|
-
? stringSlice$5(S, position, position + 2)
|
|
2651
|
-
: (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
|
2892
|
+
/**
|
|
2893
|
+
* @internal
|
|
2894
|
+
*
|
|
2895
|
+
* # Feature Flags - featureFlagComponentNameLookup
|
|
2896
|
+
*/
|
|
2897
|
+
const featureFlagComponentNameLookup = componentName => {
|
|
2898
|
+
var _a;
|
|
2899
|
+
const lookup = {
|
|
2900
|
+
PurchaseLabel: "ConfigureSalesOrderShipment"
|
|
2652
2901
|
};
|
|
2902
|
+
return (_a = lookup[componentName]) !== null && _a !== void 0 ? _a : "";
|
|
2653
2903
|
};
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
};
|
|
2663
|
-
|
|
2664
|
-
var charAt$2 = stringMultibyte.charAt;
|
|
2665
|
-
|
|
2666
|
-
// `AdvanceStringIndex` abstract operation
|
|
2667
|
-
// https://tc39.es/ecma262/#sec-advancestringindex
|
|
2668
|
-
var advanceStringIndex$2 = function (S, index, unicode) {
|
|
2669
|
-
return index + (unicode ? charAt$2(S, index).length : 1);
|
|
2670
|
-
};
|
|
2671
|
-
|
|
2672
|
-
var uncurryThis$c = functionUncurryThis;
|
|
2673
|
-
var toObject$2 = toObject$7;
|
|
2674
|
-
|
|
2675
|
-
var floor$2 = Math.floor;
|
|
2676
|
-
var charAt$1 = uncurryThis$c(''.charAt);
|
|
2677
|
-
var replace$1 = uncurryThis$c(''.replace);
|
|
2678
|
-
var stringSlice$4 = uncurryThis$c(''.slice);
|
|
2679
|
-
var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
|
|
2680
|
-
var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
|
|
2681
|
-
|
|
2682
|
-
// `GetSubstitution` abstract operation
|
|
2683
|
-
// https://tc39.es/ecma262/#sec-getsubstitution
|
|
2684
|
-
var getSubstitution$2 = function (matched, str, position, captures, namedCaptures, replacement) {
|
|
2685
|
-
var tailPos = position + matched.length;
|
|
2686
|
-
var m = captures.length;
|
|
2687
|
-
var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
|
|
2688
|
-
if (namedCaptures !== undefined) {
|
|
2689
|
-
namedCaptures = toObject$2(namedCaptures);
|
|
2690
|
-
symbols = SUBSTITUTION_SYMBOLS;
|
|
2691
|
-
}
|
|
2692
|
-
return replace$1(replacement, symbols, function (match, ch) {
|
|
2693
|
-
var capture;
|
|
2694
|
-
switch (charAt$1(ch, 0)) {
|
|
2695
|
-
case '$': return '$';
|
|
2696
|
-
case '&': return matched;
|
|
2697
|
-
case '`': return stringSlice$4(str, 0, position);
|
|
2698
|
-
case "'": return stringSlice$4(str, tailPos);
|
|
2699
|
-
case '<':
|
|
2700
|
-
capture = namedCaptures[stringSlice$4(ch, 1, -1)];
|
|
2701
|
-
break;
|
|
2702
|
-
default: // \d\d?
|
|
2703
|
-
var n = +ch;
|
|
2704
|
-
if (n === 0) return match;
|
|
2705
|
-
if (n > m) {
|
|
2706
|
-
var f = floor$2(n / 10);
|
|
2707
|
-
if (f === 0) return match;
|
|
2708
|
-
if (f <= m) return captures[f - 1] === undefined ? charAt$1(ch, 1) : captures[f - 1] + charAt$1(ch, 1);
|
|
2709
|
-
return match;
|
|
2710
|
-
}
|
|
2711
|
-
capture = captures[n - 1];
|
|
2712
|
-
}
|
|
2713
|
-
return capture === undefined ? '' : capture;
|
|
2714
|
-
});
|
|
2904
|
+
/**
|
|
2905
|
+
* @internal
|
|
2906
|
+
*
|
|
2907
|
+
* # Feature Flags - getFeatures
|
|
2908
|
+
*/
|
|
2909
|
+
const getFeatures = (...element) => {
|
|
2910
|
+
return element.map(feat => {
|
|
2911
|
+
var _a;
|
|
2912
|
+
return (_a = _$3.get(featureFlags, feat)) !== null && _a !== void 0 ? _a : {};
|
|
2913
|
+
}).reduce((acc, feat) => Object.assign(acc, feat), {});
|
|
2715
2914
|
};
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
return result;
|
|
2733
|
-
}
|
|
2734
|
-
if (classof$4(R) === 'RegExp') return call$b(regexpExec, R, S);
|
|
2735
|
-
throw $TypeError$a('RegExp#exec called on incompatible receiver');
|
|
2915
|
+
/**
|
|
2916
|
+
* # Feature Flags - useFeatures
|
|
2917
|
+
*
|
|
2918
|
+
* - The `useFeatures` hook is used to retrieve the feature flags for a given component.
|
|
2919
|
+
*
|
|
2920
|
+
* @example
|
|
2921
|
+
* ```tsx
|
|
2922
|
+
* const features = useFeatures("Global");
|
|
2923
|
+
* ```
|
|
2924
|
+
*
|
|
2925
|
+
* <br />
|
|
2926
|
+
*
|
|
2927
|
+
* @see {@link featureFlags | All available `Feature Flags`}
|
|
2928
|
+
*/
|
|
2929
|
+
const useFeatures = (...element) => {
|
|
2930
|
+
return getFeatures(...element);
|
|
2736
2931
|
};
|
|
2737
2932
|
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2933
|
+
/**
|
|
2934
|
+
* @internal
|
|
2935
|
+
*
|
|
2936
|
+
* # Form Logger
|
|
2937
|
+
*
|
|
2938
|
+
* @description
|
|
2939
|
+
* This will log the values that are submitted to the validation resolver
|
|
2940
|
+
* (only REGISTERED form fields) and the results of that validation.
|
|
2941
|
+
*
|
|
2942
|
+
* @usage Wrap the submission:
|
|
2943
|
+
* `<form onSubmit={formLogger.capture(handleSubmit)}>`
|
|
2944
|
+
*
|
|
2945
|
+
* @category Utilities
|
|
2946
|
+
*/
|
|
2947
|
+
const formLogger = {
|
|
2948
|
+
capture(handleSubmit) {
|
|
2949
|
+
return e => {
|
|
2950
|
+
// Prevent parent form submission in nested forms. This shouldn't be necessary, but React's
|
|
2951
|
+
// event bubbling doesn't handle the formId target properly when passed through a portal.
|
|
2952
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
2953
|
+
this.isSubmitting = true;
|
|
2954
|
+
void handleSubmit(e);
|
|
2955
|
+
this.isSubmitting = false;
|
|
2956
|
+
};
|
|
2957
|
+
},
|
|
2958
|
+
isSubmitting: false,
|
|
2959
|
+
log: (values, getValidationResult) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2960
|
+
alchemy.logger.info({
|
|
2961
|
+
obj: values
|
|
2962
|
+
}, "Validating registered form fields:");
|
|
2963
|
+
const validationResult = yield getValidationResult();
|
|
2964
|
+
if (Object.keys(validationResult.errors).length) alchemy.logger.error({
|
|
2965
|
+
obj: validationResult.errors
|
|
2966
|
+
}, "Validation failed. Errors object:");else alchemy.logger.info({
|
|
2967
|
+
obj: validationResult.values
|
|
2968
|
+
}, "Validation passed. Final payload after defaults & transforms:");
|
|
2969
|
+
return validationResult;
|
|
2970
|
+
})
|
|
2766
2971
|
};
|
|
2767
2972
|
|
|
2768
|
-
//
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
// eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
|
|
2772
|
-
return 'a'.replace(/./, '$0') === '$0';
|
|
2773
|
-
})();
|
|
2774
|
-
|
|
2775
|
-
// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
|
|
2776
|
-
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
|
|
2777
|
-
if (/./[REPLACE$1]) {
|
|
2778
|
-
return /./[REPLACE$1]('a', '$0') === '';
|
|
2779
|
-
}
|
|
2780
|
-
return false;
|
|
2781
|
-
})();
|
|
2782
|
-
|
|
2783
|
-
var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$8(function () {
|
|
2784
|
-
var re = /./;
|
|
2785
|
-
re.exec = function () {
|
|
2786
|
-
var result = [];
|
|
2787
|
-
result.groups = { a: '7' };
|
|
2788
|
-
return result;
|
|
2789
|
-
};
|
|
2790
|
-
// eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
|
|
2791
|
-
return ''.replace(re, '$<a>') !== '7';
|
|
2792
|
-
});
|
|
2973
|
+
// a string of all valid unicode whitespaces
|
|
2974
|
+
var whitespaces$4 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
|
|
2975
|
+
'\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
|
2793
2976
|
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2977
|
+
var uncurryThis$a = functionUncurryThis;
|
|
2978
|
+
var requireObjectCoercible$3 = requireObjectCoercible$9;
|
|
2979
|
+
var toString$7 = toString$c;
|
|
2980
|
+
var whitespaces$3 = whitespaces$4;
|
|
2797
2981
|
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
var O = requireObjectCoercible$4(this);
|
|
2803
|
-
var replacer = isNullOrUndefined$4(searchValue) ? undefined : getMethod$4(searchValue, REPLACE$1);
|
|
2804
|
-
return replacer
|
|
2805
|
-
? call$a(replacer, searchValue, O, replaceValue)
|
|
2806
|
-
: call$a(nativeReplace, toString$8(O), searchValue, replaceValue);
|
|
2807
|
-
},
|
|
2808
|
-
// `RegExp.prototype[@@replace]` method
|
|
2809
|
-
// https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
|
|
2810
|
-
function (string, replaceValue) {
|
|
2811
|
-
var rx = anObject$7(this);
|
|
2812
|
-
var S = toString$8(string);
|
|
2982
|
+
var replace$1 = uncurryThis$a(''.replace);
|
|
2983
|
+
var whitespace = '[' + whitespaces$3 + ']';
|
|
2984
|
+
var ltrim = RegExp('^' + whitespace + whitespace + '*');
|
|
2985
|
+
var rtrim = RegExp(whitespace + whitespace + '*$');
|
|
2813
2986
|
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2987
|
+
// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
|
|
2988
|
+
var createMethod = function (TYPE) {
|
|
2989
|
+
return function ($this) {
|
|
2990
|
+
var string = toString$7(requireObjectCoercible$3($this));
|
|
2991
|
+
if (TYPE & 1) string = replace$1(string, ltrim, '');
|
|
2992
|
+
if (TYPE & 2) string = replace$1(string, rtrim, '');
|
|
2993
|
+
return string;
|
|
2994
|
+
};
|
|
2995
|
+
};
|
|
2822
2996
|
|
|
2823
|
-
|
|
2824
|
-
|
|
2997
|
+
var stringTrim = {
|
|
2998
|
+
// `String.prototype.{ trimLeft, trimStart }` methods
|
|
2999
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trimstart
|
|
3000
|
+
start: createMethod(1),
|
|
3001
|
+
// `String.prototype.{ trimRight, trimEnd }` methods
|
|
3002
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trimend
|
|
3003
|
+
end: createMethod(2),
|
|
3004
|
+
// `String.prototype.trim` method
|
|
3005
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trim
|
|
3006
|
+
trim: createMethod(3)
|
|
3007
|
+
};
|
|
2825
3008
|
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
rx.lastIndex = 0;
|
|
2830
|
-
}
|
|
2831
|
-
var results = [];
|
|
2832
|
-
while (true) {
|
|
2833
|
-
var result = regExpExec$1(rx, S);
|
|
2834
|
-
if (result === null) break;
|
|
3009
|
+
var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
|
|
3010
|
+
var fails$8 = fails$q;
|
|
3011
|
+
var whitespaces$2 = whitespaces$4;
|
|
2835
3012
|
|
|
2836
|
-
|
|
2837
|
-
if (!global) break;
|
|
3013
|
+
var non = '\u200B\u0085\u180E';
|
|
2838
3014
|
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
3015
|
+
// check that a method works with the correct list
|
|
3016
|
+
// of whitespaces and has a correct name
|
|
3017
|
+
var stringTrimForced = function (METHOD_NAME) {
|
|
3018
|
+
return fails$8(function () {
|
|
3019
|
+
return !!whitespaces$2[METHOD_NAME]()
|
|
3020
|
+
|| non[METHOD_NAME]() !== non
|
|
3021
|
+
|| (PROPER_FUNCTION_NAME$1 && whitespaces$2[METHOD_NAME].name !== METHOD_NAME);
|
|
3022
|
+
});
|
|
3023
|
+
};
|
|
2842
3024
|
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
result = results[i];
|
|
3025
|
+
var $$f = _export;
|
|
3026
|
+
var $trim = stringTrim.trim;
|
|
3027
|
+
var forcedStringTrimMethod = stringTrimForced;
|
|
2847
3028
|
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
// causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
|
|
2856
|
-
for (var j = 1; j < result.length; j++) push$1(captures, maybeToString(result[j]));
|
|
2857
|
-
var namedCaptures = result.groups;
|
|
2858
|
-
if (functionalReplace) {
|
|
2859
|
-
var replacerArgs = concat([matched], captures, position, S);
|
|
2860
|
-
if (namedCaptures !== undefined) push$1(replacerArgs, namedCaptures);
|
|
2861
|
-
var replacement = toString$8(apply$1(replaceValue, undefined, replacerArgs));
|
|
2862
|
-
} else {
|
|
2863
|
-
replacement = getSubstitution$1(matched, S, position, captures, namedCaptures, replaceValue);
|
|
2864
|
-
}
|
|
2865
|
-
if (position >= nextSourcePosition) {
|
|
2866
|
-
accumulatedResult += stringSlice$3(S, nextSourcePosition, position) + replacement;
|
|
2867
|
-
nextSourcePosition = position + matched.length;
|
|
2868
|
-
}
|
|
2869
|
-
}
|
|
2870
|
-
return accumulatedResult + stringSlice$3(S, nextSourcePosition);
|
|
2871
|
-
}
|
|
2872
|
-
];
|
|
2873
|
-
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
|
|
3029
|
+
// `String.prototype.trim` method
|
|
3030
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trim
|
|
3031
|
+
$$f({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
|
|
3032
|
+
trim: function trim() {
|
|
3033
|
+
return $trim(this);
|
|
3034
|
+
}
|
|
3035
|
+
});
|
|
2874
3036
|
|
|
2875
3037
|
/**
|
|
2876
3038
|
* @internal
|
|
@@ -3013,7 +3175,7 @@ const overrideCarrierCodes$1 = (carrier, overrides) => {
|
|
|
3013
3175
|
return overrides[carrier] || carrier;
|
|
3014
3176
|
};
|
|
3015
3177
|
|
|
3016
|
-
var $$
|
|
3178
|
+
var $$e = _export;
|
|
3017
3179
|
var $includes = arrayIncludes.includes;
|
|
3018
3180
|
var fails$7 = fails$q;
|
|
3019
3181
|
var addToUnscopables$1 = addToUnscopables$3;
|
|
@@ -3025,7 +3187,7 @@ var BROKEN_ON_SPARSE = fails$7(function () {
|
|
|
3025
3187
|
|
|
3026
3188
|
// `Array.prototype.includes` method
|
|
3027
3189
|
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
3028
|
-
$$
|
|
3190
|
+
$$e({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
|
|
3029
3191
|
includes: function includes(el /* , fromIndex = 0 */) {
|
|
3030
3192
|
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
3031
3193
|
}
|
|
@@ -3491,10 +3653,10 @@ const getSalesOrderItemsFromSalesOrderOrShipment = ({
|
|
|
3491
3653
|
|
|
3492
3654
|
var tryToString$3 = tryToString$5;
|
|
3493
3655
|
|
|
3494
|
-
var $TypeError$
|
|
3656
|
+
var $TypeError$8 = TypeError;
|
|
3495
3657
|
|
|
3496
3658
|
var deletePropertyOrThrow$1 = function (O, P) {
|
|
3497
|
-
if (!delete O[P]) throw $TypeError$
|
|
3659
|
+
if (!delete O[P]) throw $TypeError$8('Cannot delete property ' + tryToString$3(P) + ' of ' + tryToString$3(O));
|
|
3498
3660
|
};
|
|
3499
3661
|
|
|
3500
3662
|
var toPropertyKey = toPropertyKey$3;
|
|
@@ -3512,13 +3674,13 @@ var lengthOfArrayLike$4 = lengthOfArrayLike$7;
|
|
|
3512
3674
|
var createProperty$1 = createProperty$2;
|
|
3513
3675
|
|
|
3514
3676
|
var $Array$1 = Array;
|
|
3515
|
-
var max
|
|
3677
|
+
var max = Math.max;
|
|
3516
3678
|
|
|
3517
3679
|
var arraySliceSimple = function (O, start, end) {
|
|
3518
3680
|
var length = lengthOfArrayLike$4(O);
|
|
3519
3681
|
var k = toAbsoluteIndex(start, length);
|
|
3520
3682
|
var fin = toAbsoluteIndex(end === undefined ? length : end, length);
|
|
3521
|
-
var result = $Array$1(max
|
|
3683
|
+
var result = $Array$1(max(fin - k, 0));
|
|
3522
3684
|
for (var n = 0; k < fin; k++, n++) createProperty$1(result, n, O[k]);
|
|
3523
3685
|
result.length = n;
|
|
3524
3686
|
return result;
|
|
@@ -3585,13 +3747,13 @@ var webkit = userAgent$3.match(/AppleWebKit\/(\d+)\./);
|
|
|
3585
3747
|
|
|
3586
3748
|
var engineWebkitVersion = !!webkit && +webkit[1];
|
|
3587
3749
|
|
|
3588
|
-
var $$
|
|
3589
|
-
var uncurryThis$
|
|
3750
|
+
var $$d = _export;
|
|
3751
|
+
var uncurryThis$9 = functionUncurryThis;
|
|
3590
3752
|
var aCallable$7 = aCallable$a;
|
|
3591
3753
|
var toObject$1 = toObject$7;
|
|
3592
3754
|
var lengthOfArrayLike$3 = lengthOfArrayLike$7;
|
|
3593
3755
|
var deletePropertyOrThrow = deletePropertyOrThrow$1;
|
|
3594
|
-
var toString$
|
|
3756
|
+
var toString$6 = toString$c;
|
|
3595
3757
|
var fails$6 = fails$q;
|
|
3596
3758
|
var internalSort = arraySort;
|
|
3597
3759
|
var arrayMethodIsStrict = arrayMethodIsStrict$2;
|
|
@@ -3601,8 +3763,8 @@ var V8 = engineV8Version;
|
|
|
3601
3763
|
var WEBKIT = engineWebkitVersion;
|
|
3602
3764
|
|
|
3603
3765
|
var test = [];
|
|
3604
|
-
var nativeSort = uncurryThis$
|
|
3605
|
-
var push = uncurryThis$
|
|
3766
|
+
var nativeSort = uncurryThis$9(test.sort);
|
|
3767
|
+
var push = uncurryThis$9(test.push);
|
|
3606
3768
|
|
|
3607
3769
|
// IE8-
|
|
3608
3770
|
var FAILS_ON_UNDEFINED = fails$6(function () {
|
|
@@ -3657,13 +3819,13 @@ var getSortCompare = function (comparefn) {
|
|
|
3657
3819
|
if (y === undefined) return -1;
|
|
3658
3820
|
if (x === undefined) return 1;
|
|
3659
3821
|
if (comparefn !== undefined) return +comparefn(x, y) || 0;
|
|
3660
|
-
return toString$
|
|
3822
|
+
return toString$6(x) > toString$6(y) ? 1 : -1;
|
|
3661
3823
|
};
|
|
3662
3824
|
};
|
|
3663
3825
|
|
|
3664
3826
|
// `Array.prototype.sort` method
|
|
3665
3827
|
// https://tc39.es/ecma262/#sec-array.prototype.sort
|
|
3666
|
-
$$
|
|
3828
|
+
$$d({ target: 'Array', proto: true, forced: FORCED$3 }, {
|
|
3667
3829
|
sort: function sort(comparefn) {
|
|
3668
3830
|
if (comparefn !== undefined) aCallable$7(comparefn);
|
|
3669
3831
|
|
|
@@ -3740,22 +3902,22 @@ const getShipmentByStatus = (status, shipments) => shipments === null || shipmen
|
|
|
3740
3902
|
shipmentStatus
|
|
3741
3903
|
}) => shipmentStatus === status).sort(sortByCreationDate)[0];
|
|
3742
3904
|
|
|
3743
|
-
var uncurryThis$
|
|
3905
|
+
var uncurryThis$8 = functionUncurryThis;
|
|
3744
3906
|
|
|
3745
3907
|
// `thisNumberValue` abstract operation
|
|
3746
3908
|
// https://tc39.es/ecma262/#sec-thisnumbervalue
|
|
3747
|
-
var thisNumberValue$1 = uncurryThis$
|
|
3909
|
+
var thisNumberValue$1 = uncurryThis$8(1.0.valueOf);
|
|
3748
3910
|
|
|
3749
3911
|
var toIntegerOrInfinity$1 = toIntegerOrInfinity$6;
|
|
3750
|
-
var toString$
|
|
3751
|
-
var requireObjectCoercible$
|
|
3912
|
+
var toString$5 = toString$c;
|
|
3913
|
+
var requireObjectCoercible$2 = requireObjectCoercible$9;
|
|
3752
3914
|
|
|
3753
3915
|
var $RangeError$1 = RangeError;
|
|
3754
3916
|
|
|
3755
3917
|
// `String.prototype.repeat` method implementation
|
|
3756
3918
|
// https://tc39.es/ecma262/#sec-string.prototype.repeat
|
|
3757
3919
|
var stringRepeat = function repeat(count) {
|
|
3758
|
-
var str = toString$
|
|
3920
|
+
var str = toString$5(requireObjectCoercible$2(this));
|
|
3759
3921
|
var result = '';
|
|
3760
3922
|
var n = toIntegerOrInfinity$1(count);
|
|
3761
3923
|
if (n < 0 || n == Infinity) throw $RangeError$1('Wrong number of repetitions');
|
|
@@ -3763,8 +3925,8 @@ var stringRepeat = function repeat(count) {
|
|
|
3763
3925
|
return result;
|
|
3764
3926
|
};
|
|
3765
3927
|
|
|
3766
|
-
var $$
|
|
3767
|
-
var uncurryThis$
|
|
3928
|
+
var $$c = _export;
|
|
3929
|
+
var uncurryThis$7 = functionUncurryThis;
|
|
3768
3930
|
var toIntegerOrInfinity = toIntegerOrInfinity$6;
|
|
3769
3931
|
var thisNumberValue = thisNumberValue$1;
|
|
3770
3932
|
var $repeat = stringRepeat;
|
|
@@ -3773,9 +3935,9 @@ var fails$5 = fails$q;
|
|
|
3773
3935
|
var $RangeError = RangeError;
|
|
3774
3936
|
var $String = String;
|
|
3775
3937
|
var floor = Math.floor;
|
|
3776
|
-
var repeat = uncurryThis$
|
|
3777
|
-
var stringSlice$
|
|
3778
|
-
var nativeToFixed = uncurryThis$
|
|
3938
|
+
var repeat = uncurryThis$7($repeat);
|
|
3939
|
+
var stringSlice$1 = uncurryThis$7(''.slice);
|
|
3940
|
+
var nativeToFixed = uncurryThis$7(1.0.toFixed);
|
|
3779
3941
|
|
|
3780
3942
|
var pow = function (x, n, acc) {
|
|
3781
3943
|
return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
|
|
@@ -3837,7 +3999,7 @@ var FORCED$2 = fails$5(function () {
|
|
|
3837
3999
|
|
|
3838
4000
|
// `Number.prototype.toFixed` method
|
|
3839
4001
|
// https://tc39.es/ecma262/#sec-number.prototype.tofixed
|
|
3840
|
-
$$
|
|
4002
|
+
$$c({ target: 'Number', proto: true, forced: FORCED$2 }, {
|
|
3841
4003
|
toFixed: function toFixed(fractionDigits) {
|
|
3842
4004
|
var number = thisNumberValue(this);
|
|
3843
4005
|
var fractDigits = toIntegerOrInfinity(fractionDigits);
|
|
@@ -3887,7 +4049,7 @@ $$d({ target: 'Number', proto: true, forced: FORCED$2 }, {
|
|
|
3887
4049
|
k = result.length;
|
|
3888
4050
|
result = sign + (k <= fractDigits
|
|
3889
4051
|
? '0.' + repeat('0', fractDigits - k) + result
|
|
3890
|
-
: stringSlice$
|
|
4052
|
+
: stringSlice$1(result, 0, k - fractDigits) + '.' + stringSlice$1(result, k - fractDigits));
|
|
3891
4053
|
} else {
|
|
3892
4054
|
result = sign + result;
|
|
3893
4055
|
} return result;
|
|
@@ -4025,32 +4187,19 @@ function formatFractionalWeight(weight, unit) {
|
|
|
4025
4187
|
};
|
|
4026
4188
|
}
|
|
4027
4189
|
|
|
4028
|
-
var
|
|
4029
|
-
var classof$3 = classofRaw$2;
|
|
4030
|
-
var wellKnownSymbol$9 = wellKnownSymbol$k;
|
|
4031
|
-
|
|
4032
|
-
var MATCH$1 = wellKnownSymbol$9('match');
|
|
4033
|
-
|
|
4034
|
-
// `IsRegExp` abstract operation
|
|
4035
|
-
// https://tc39.es/ecma262/#sec-isregexp
|
|
4036
|
-
var isRegexp = function (it) {
|
|
4037
|
-
var isRegExp;
|
|
4038
|
-
return isObject$3(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$3(it) == 'RegExp');
|
|
4039
|
-
};
|
|
4040
|
-
|
|
4041
|
-
var isRegExp$1 = isRegexp;
|
|
4190
|
+
var isRegExp = isRegexp;
|
|
4042
4191
|
|
|
4043
|
-
var $TypeError$
|
|
4192
|
+
var $TypeError$7 = TypeError;
|
|
4044
4193
|
|
|
4045
4194
|
var notARegexp = function (it) {
|
|
4046
|
-
if (isRegExp
|
|
4047
|
-
throw $TypeError$
|
|
4195
|
+
if (isRegExp(it)) {
|
|
4196
|
+
throw $TypeError$7("The method doesn't accept regular expressions");
|
|
4048
4197
|
} return it;
|
|
4049
4198
|
};
|
|
4050
4199
|
|
|
4051
|
-
var wellKnownSymbol$
|
|
4200
|
+
var wellKnownSymbol$7 = wellKnownSymbol$k;
|
|
4052
4201
|
|
|
4053
|
-
var MATCH = wellKnownSymbol$
|
|
4202
|
+
var MATCH = wellKnownSymbol$7('match');
|
|
4054
4203
|
|
|
4055
4204
|
var correctIsRegexpLogic = function (METHOD_NAME) {
|
|
4056
4205
|
var regexp = /./;
|
|
@@ -4064,22 +4213,22 @@ var correctIsRegexpLogic = function (METHOD_NAME) {
|
|
|
4064
4213
|
} return false;
|
|
4065
4214
|
};
|
|
4066
4215
|
|
|
4067
|
-
var $$
|
|
4068
|
-
var uncurryThis$
|
|
4216
|
+
var $$b = _export;
|
|
4217
|
+
var uncurryThis$6 = functionUncurryThis;
|
|
4069
4218
|
var notARegExp = notARegexp;
|
|
4070
|
-
var requireObjectCoercible$
|
|
4071
|
-
var toString$
|
|
4219
|
+
var requireObjectCoercible$1 = requireObjectCoercible$9;
|
|
4220
|
+
var toString$4 = toString$c;
|
|
4072
4221
|
var correctIsRegExpLogic = correctIsRegexpLogic;
|
|
4073
4222
|
|
|
4074
|
-
var stringIndexOf
|
|
4223
|
+
var stringIndexOf = uncurryThis$6(''.indexOf);
|
|
4075
4224
|
|
|
4076
4225
|
// `String.prototype.includes` method
|
|
4077
4226
|
// https://tc39.es/ecma262/#sec-string.prototype.includes
|
|
4078
|
-
$$
|
|
4227
|
+
$$b({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
|
|
4079
4228
|
includes: function includes(searchString /* , position = 0 */) {
|
|
4080
|
-
return !!~stringIndexOf
|
|
4081
|
-
toString$
|
|
4082
|
-
toString$
|
|
4229
|
+
return !!~stringIndexOf(
|
|
4230
|
+
toString$4(requireObjectCoercible$1(this)),
|
|
4231
|
+
toString$4(notARegExp(searchString)),
|
|
4083
4232
|
arguments.length > 1 ? arguments[1] : undefined
|
|
4084
4233
|
);
|
|
4085
4234
|
}
|
|
@@ -4497,135 +4646,6 @@ const CreditCardInput = fieldProps => jsxRuntime.jsx(CreditCardInputController,
|
|
|
4497
4646
|
}
|
|
4498
4647
|
}));
|
|
4499
4648
|
|
|
4500
|
-
var call$9 = functionCall;
|
|
4501
|
-
var hasOwn$2 = hasOwnProperty_1;
|
|
4502
|
-
var isPrototypeOf$3 = objectIsPrototypeOf;
|
|
4503
|
-
var regExpFlags = regexpFlags$1;
|
|
4504
|
-
|
|
4505
|
-
var RegExpPrototype$1 = RegExp.prototype;
|
|
4506
|
-
|
|
4507
|
-
var regexpGetFlags = function (R) {
|
|
4508
|
-
var flags = R.flags;
|
|
4509
|
-
return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn$2(R, 'flags') && isPrototypeOf$3(RegExpPrototype$1, R)
|
|
4510
|
-
? call$9(regExpFlags, R) : flags;
|
|
4511
|
-
};
|
|
4512
|
-
|
|
4513
|
-
var $$b = _export;
|
|
4514
|
-
var call$8 = functionCall;
|
|
4515
|
-
var uncurryThis$6 = functionUncurryThis;
|
|
4516
|
-
var requireObjectCoercible$1 = requireObjectCoercible$9;
|
|
4517
|
-
var isCallable$6 = isCallable$o;
|
|
4518
|
-
var isNullOrUndefined$3 = isNullOrUndefined$7;
|
|
4519
|
-
var isRegExp = isRegexp;
|
|
4520
|
-
var toString$4 = toString$c;
|
|
4521
|
-
var getMethod$3 = getMethod$6;
|
|
4522
|
-
var getRegExpFlags$1 = regexpGetFlags;
|
|
4523
|
-
var getSubstitution = getSubstitution$2;
|
|
4524
|
-
var wellKnownSymbol$7 = wellKnownSymbol$k;
|
|
4525
|
-
|
|
4526
|
-
var REPLACE = wellKnownSymbol$7('replace');
|
|
4527
|
-
var $TypeError$7 = TypeError;
|
|
4528
|
-
var indexOf = uncurryThis$6(''.indexOf);
|
|
4529
|
-
uncurryThis$6(''.replace);
|
|
4530
|
-
var stringSlice$1 = uncurryThis$6(''.slice);
|
|
4531
|
-
var max = Math.max;
|
|
4532
|
-
|
|
4533
|
-
var stringIndexOf = function (string, searchValue, fromIndex) {
|
|
4534
|
-
if (fromIndex > string.length) return -1;
|
|
4535
|
-
if (searchValue === '') return fromIndex;
|
|
4536
|
-
return indexOf(string, searchValue, fromIndex);
|
|
4537
|
-
};
|
|
4538
|
-
|
|
4539
|
-
// `String.prototype.replaceAll` method
|
|
4540
|
-
// https://tc39.es/ecma262/#sec-string.prototype.replaceall
|
|
4541
|
-
$$b({ target: 'String', proto: true }, {
|
|
4542
|
-
replaceAll: function replaceAll(searchValue, replaceValue) {
|
|
4543
|
-
var O = requireObjectCoercible$1(this);
|
|
4544
|
-
var IS_REG_EXP, flags, replacer, string, searchString, functionalReplace, searchLength, advanceBy, replacement;
|
|
4545
|
-
var position = 0;
|
|
4546
|
-
var endOfLastMatch = 0;
|
|
4547
|
-
var result = '';
|
|
4548
|
-
if (!isNullOrUndefined$3(searchValue)) {
|
|
4549
|
-
IS_REG_EXP = isRegExp(searchValue);
|
|
4550
|
-
if (IS_REG_EXP) {
|
|
4551
|
-
flags = toString$4(requireObjectCoercible$1(getRegExpFlags$1(searchValue)));
|
|
4552
|
-
if (!~indexOf(flags, 'g')) throw $TypeError$7('`.replaceAll` does not allow non-global regexes');
|
|
4553
|
-
}
|
|
4554
|
-
replacer = getMethod$3(searchValue, REPLACE);
|
|
4555
|
-
if (replacer) {
|
|
4556
|
-
return call$8(replacer, searchValue, O, replaceValue);
|
|
4557
|
-
}
|
|
4558
|
-
}
|
|
4559
|
-
string = toString$4(O);
|
|
4560
|
-
searchString = toString$4(searchValue);
|
|
4561
|
-
functionalReplace = isCallable$6(replaceValue);
|
|
4562
|
-
if (!functionalReplace) replaceValue = toString$4(replaceValue);
|
|
4563
|
-
searchLength = searchString.length;
|
|
4564
|
-
advanceBy = max(1, searchLength);
|
|
4565
|
-
position = stringIndexOf(string, searchString, 0);
|
|
4566
|
-
while (position !== -1) {
|
|
4567
|
-
replacement = functionalReplace
|
|
4568
|
-
? toString$4(replaceValue(searchString, position, string))
|
|
4569
|
-
: getSubstitution(searchString, string, position, [], undefined, replaceValue);
|
|
4570
|
-
result += stringSlice$1(string, endOfLastMatch, position) + replacement;
|
|
4571
|
-
endOfLastMatch = position + searchLength;
|
|
4572
|
-
position = stringIndexOf(string, searchString, position + advanceBy);
|
|
4573
|
-
}
|
|
4574
|
-
if (endOfLastMatch < string.length) {
|
|
4575
|
-
result += stringSlice$1(string, endOfLastMatch);
|
|
4576
|
-
}
|
|
4577
|
-
return result;
|
|
4578
|
-
}
|
|
4579
|
-
});
|
|
4580
|
-
|
|
4581
|
-
// TODO: Quick Fix for White Label; The navigator object cannot be accessed from within SSR,
|
|
4582
|
-
// so this provides default value until this feature can be refactored to support SSR.
|
|
4583
|
-
let _LOCALE = "en-US";
|
|
4584
|
-
try {
|
|
4585
|
-
_LOCALE = navigator.language;
|
|
4586
|
-
} catch (_a) {}
|
|
4587
|
-
const loadableLocale = _LOCALE.replaceAll("-", "");
|
|
4588
|
-
const loadableBackupLocale = _LOCALE.split("-")[0];
|
|
4589
|
-
let intlLocale = undefined;
|
|
4590
|
-
if (loadableLocale in Locales__namespace || loadableBackupLocale) {
|
|
4591
|
-
const targetLocale = loadableLocale in Locales__namespace ? loadableLocale : loadableBackupLocale;
|
|
4592
|
-
const l = Locales__namespace[targetLocale];
|
|
4593
|
-
RDP.registerLocale(_LOCALE, l);
|
|
4594
|
-
intlLocale = l;
|
|
4595
|
-
RDP.setDefaultLocale(_LOCALE);
|
|
4596
|
-
} else {
|
|
4597
|
-
// Really should never happen but this SHOULD revert to un-localized
|
|
4598
|
-
console.log(`User's navigator.language locale ${_LOCALE} could not be loaded because it was not found in date-fns.
|
|
4599
|
-
Backup attempt to load ${loadableBackupLocale} failed as well.
|
|
4600
|
-
Reverting to en-US.`);
|
|
4601
|
-
_LOCALE = "en-US";
|
|
4602
|
-
}
|
|
4603
|
-
const usaLocale = Locales__namespace["enUS"];
|
|
4604
|
-
const LOCALE = _LOCALE;
|
|
4605
|
-
/**
|
|
4606
|
-
* Parse a string in the CURRENT locale into a Date object.
|
|
4607
|
-
* current locale is determined by navigator.language for now
|
|
4608
|
-
* @param dateString
|
|
4609
|
-
*/
|
|
4610
|
-
const parseLocaleDate = dateString => dateString ? dateFns.parse(dateString, "P", new Date(), intlLocale ? {
|
|
4611
|
-
locale: intlLocale
|
|
4612
|
-
} : undefined) : null;
|
|
4613
|
-
const parseUSADate = dateString => dateString ? dateFns.parse(dateString, "P", new Date(), {
|
|
4614
|
-
locale: usaLocale
|
|
4615
|
-
}) : null;
|
|
4616
|
-
/**
|
|
4617
|
-
*
|
|
4618
|
-
* Format a date into a string in the CURRENT locale.
|
|
4619
|
-
* current locale is determined by navigator.language for now
|
|
4620
|
-
* @param date
|
|
4621
|
-
*/
|
|
4622
|
-
const formatLocaleDate = date => date ? dateFns.format(date, "P", {
|
|
4623
|
-
locale: intlLocale
|
|
4624
|
-
}) : null;
|
|
4625
|
-
const formatUSADate = date => date ? dateFns.format(date, "P", {
|
|
4626
|
-
locale: usaLocale
|
|
4627
|
-
}) : null;
|
|
4628
|
-
|
|
4629
4649
|
function _EMOTION_STRINGIFIED_CSS_ERROR__$4() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
4630
4650
|
const getPopperStyles = theme => /*#__PURE__*/css.css("padding-top:10px;z-index:10;.react-datepicker{background-color:", theme.palette.white, ";border-radius:0.25rem;box-shadow:", theme.getElevation("above").boxShadow, ";display:inline-block;font-size:1rem;position:relative;&__month-container{float:left;}&__header{border-top-left-radius:", theme.borderRadius.M, ";border-top-right-radius:", theme.borderRadius.M, ";padding:", theme.spacing(2), "px 0 ", theme.spacing(1), "px 0;position:relative;text-align:center;}&__current-month{color:", theme.palette.black, ";font-size:1rem;font-weight:600;line-height:1.25rem;margin-bottom:", theme.spacing(2), "px;}&__navigation{align-items:center;background:none;border:none;cursor:pointer;display:flex;height:32px;justify-content:center;overflow:hidden;position:absolute;text-align:center;text-indent:-999em;top:0.688rem;width:32px;z-index:1;&--previous{left:1rem;}&--next{right:1rem;}&:hover *::before{border-color:", theme.palette.gray.light, ";}&-icon{position:relative;top:-0.125rem;width:0;&::before{border-color:", theme.palette.gray.main, ";border-style:solid;border-width:2.5px 2.5px 0 0;content:\"\";display:block;height:6px;position:absolute;top:6px;width:6px;}&--previous{right:0rem;&::before{right:-0.438rem;transform:rotate(225deg);}}&--next{left:0rem;&::before{left:-0.438rem;transform:rotate(45deg);}}}} &__month{padding:0 1rem 1rem 1rem;text-align:center;}&__week{white-space:nowrap;} &__day{color:", theme.palette.black, ";cursor:pointer;display:inline-block;font-size:1rem;line-height:2rem;margin:0.25rem;text-align:center;width:2rem;&:hover[aria-selected=\"false\"]:not(&--disabled){background-color:", theme.palette.gray.ultraLight, ";border-radius:0.25rem;}&-name{color:", theme.palette.gray.main, ";display:inline-block;font-size:0.75rem;font-weight:600;line-height:1rem;margin:0 0.25rem;text-align:center;width:2rem;}&-names{white-space:nowrap;}&--disabled{color:", theme.palette.gray.main, ";cursor:default;&:hover{background-color:transparent;}}&--today[aria-selected=\"false\"]{position:relative;&::before{border-bottom:0.125rem solid ", theme.palette.primary.main, ";content:\"\";display:block;inset:0;position:absolute;}}&--highlighted{background-color:#3dcc4a;border-radius:0.25rem;color:#fff;&:hover{background-color:", theme.palette.secondary.main, ";}&-custom-1{color:magenta;}&-custom-2{color:green;}}&--selected,&--in-selecting-range,&--in-range{background-color:", theme.palette.primary.main, ";border-radius:0.25rem;color:#fff;&[aria-selected=\"true\"]{cursor:default;}&[aria-selected=\"false\"]:hover{background-color:", theme.palette.primary.dark, ";}}&--in-selecting-range:not(&--in-range){background-color:rgba(33, 107, 165, 0.5);}&--keyboard-selected{border-radius:0.25rem;outline:0.125rem solid ", theme.palette.primary.main, ";} &--selected:not(&--keyboard-selected):focus-visible{outline:0.125rem solid ", theme.palette.primary.main, ";}} &__input-container{display:inline-block;position:relative;width:100%;}}" + (process.env.NODE_ENV === "production" ? "" : ";label:getPopperStyles;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRhdGUtcGlja2VyLnN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDOEMiLCJmaWxlIjoiZGF0ZS1waWNrZXIuc3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL2Nzc1wiO1xyXG5leHBvcnQgY29uc3QgZ2V0UG9wcGVyU3R5bGVzID0gKHRoZW1lKSA9PiBjc3MgYFxuICBwYWRkaW5nLXRvcDogMTBweDtcbiAgei1pbmRleDogMTA7XG4gIC5yZWFjdC1kYXRlcGlja2VyIHtcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiAke3RoZW1lLnBhbGV0dGUud2hpdGV9O1xuICAgIGJvcmRlci1yYWRpdXM6IDAuMjVyZW07XG4gICAgYm94LXNoYWRvdzogJHt0aGVtZS5nZXRFbGV2YXRpb24oXCJhYm92ZVwiKS5ib3hTaGFkb3d9O1xuICAgIGRpc3BsYXk6IGlubGluZS1ibG9jaztcbiAgICBmb250LXNpemU6IDFyZW07XG4gICAgcG9zaXRpb246IHJlbGF0aXZlO1xuICAgICZfX21vbnRoLWNvbnRhaW5lciB7XG4gICAgICBmbG9hdDogbGVmdDtcbiAgICB9XG4gICAgJl9faGVhZGVyIHtcbiAgICAgIGJvcmRlci10b3AtbGVmdC1yYWRpdXM6ICR7dGhlbWUuYm9yZGVyUmFkaXVzLk19O1xuICAgICAgYm9yZGVyLXRvcC1yaWdodC1yYWRpdXM6ICR7dGhlbWUuYm9yZGVyUmFkaXVzLk19O1xuICAgICAgcGFkZGluZzogJHt0aGVtZS5zcGFjaW5nKDIpfXB4IDAgJHt0aGVtZS5zcGFjaW5nKDEpfXB4IDA7XG4gICAgICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gICAgICB0ZXh0LWFsaWduOiBjZW50ZXI7XG4gICAgfVxuICAgICZfX2N1cnJlbnQtbW9udGgge1xuICAgICAgY29sb3I6ICR7dGhlbWUucGFsZXR0ZS5ibGFja307XG4gICAgICBmb250LXNpemU6IDFyZW07XG4gICAgICBmb250LXdlaWdodDogNjAwO1xuICAgICAgbGluZS1oZWlnaHQ6IDEuMjVyZW07XG4gICAgICBtYXJnaW4tYm90dG9tOiAke3RoZW1lLnNwYWNpbmcoMil9cHg7XG4gICAgfVxuICAgICZfX25hdmlnYXRpb24ge1xuICAgICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAgICAgIGJhY2tncm91bmQ6IG5vbmU7XG4gICAgICBib3JkZXI6IG5vbmU7XG4gICAgICBjdXJzb3I6IHBvaW50ZXI7XG4gICAgICBkaXNwbGF5OiBmbGV4O1xuICAgICAgaGVpZ2h0OiAzMnB4O1xuICAgICAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gICAgICBvdmVyZmxvdzogaGlkZGVuO1xuICAgICAgcG9zaXRpb246IGFic29sdXRlO1xuICAgICAgdGV4dC1hbGlnbjogY2VudGVyO1xuICAgICAgdGV4dC1pbmRlbnQ6IC05OTllbTtcbiAgICAgIHRvcDogMC42ODhyZW07XG4gICAgICB3aWR0aDogMzJweDtcbiAgICAgIHotaW5kZXg6IDE7XG4gICAgICAmLS1wcmV2aW91cyB7XG4gICAgICAgIGxlZnQ6IDFyZW07XG4gICAgICB9XG4gICAgICAmLS1uZXh0IHtcbiAgICAgICAgcmlnaHQ6IDFyZW07XG4gICAgICB9XG4gICAgICAmOmhvdmVyICo6OmJlZm9yZSB7XG4gICAgICAgIGJvcmRlci1jb2xvcjogJHt0aGVtZS5wYWxldHRlLmdyYXkubGlnaHR9O1xuICAgICAgfVxuICAgICAgJi1pY29uIHtcbiAgICAgICAgcG9zaXRpb246IHJlbGF0aXZlO1xuICAgICAgICB0b3A6IC0wLjEyNXJlbTtcbiAgICAgICAgd2lkdGg6IDA7XG4gICAgICAgICY6OmJlZm9yZSB7XG4gICAgICAgICAgYm9yZGVyLWNvbG9yOiAke3RoZW1lLnBhbGV0dGUuZ3JheS5tYWlufTtcbiAgICAgICAgICBib3JkZXItc3R5bGU6IHNvbGlkO1xuICAgICAgICAgIGJvcmRlci13aWR0aDogMi41cHggMi41cHggMCAwO1xuICAgICAgICAgIGNvbnRlbnQ6IFwiXCI7XG4gICAgICAgICAgZGlzcGxheTogYmxvY2s7XG4gICAgICAgICAgaGVpZ2h0OiA2cHg7XG4gICAgICAgICAgcG9zaXRpb246IGFic29sdXRlO1xuICAgICAgICAgIHRvcDogNnB4O1xuICAgICAgICAgIHdpZHRoOiA2cHg7XG4gICAgICAgIH1cbiAgICAgICAgJi0tcHJldmlvdXMge1xuICAgICAgICAgIHJpZ2h0OiAwcmVtO1xuICAgICAgICAgICY6OmJlZm9yZSB7XG4gICAgICAgICAgICByaWdodDogLTAuNDM4cmVtO1xuICAgICAgICAgICAgdHJhbnNmb3JtOiByb3RhdGUoMjI1ZGVnKTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgJi0tbmV4dCB7XG4gICAgICAgICAgbGVmdDogMHJlbTtcbiAgICAgICAgICAmOjpiZWZvcmUge1xuICAgICAgICAgICAgbGVmdDogLTAuNDM4cmVtO1xuICAgICAgICAgICAgdHJhbnNmb3JtOiByb3RhdGUoNDVkZWcpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cbiAgICAkeyAvKiAjZW5kcmVnaW9uICovXCJcIn1cbiAgICAmX19tb250aCB7XG4gICAgICBwYWRkaW5nOiAwIDFyZW0gMXJlbSAxcmVtO1xuICAgICAgdGV4dC1hbGlnbjogY2VudGVyO1xuICAgIH1cbiAgICAmX193ZWVrIHtcbiAgICAgIHdoaXRlLXNwYWNlOiBub3dyYXA7XG4gICAgfVxuICAgICR7IC8qICNyZWdpb24gWyByZ2JhKDEyMCw1MCwxNTAsMC4xKSBdIERheXMgKi9cIlwifVxuICAgICZfX2RheSB7XG4gICAgICBjb2xvcjogJHt0aGVtZS5wYWxldHRlLmJsYWNrfTtcbiAgICAgIGN1cnNvcjogcG9pbnRlcjtcbiAgICAgIGRpc3BsYXk6IGlubGluZS1ibG9jaztcbiAgICAgIGZvbnQtc2l6ZTogMXJlbTtcbiAgICAgIGxpbmUtaGVpZ2h0OiAycmVtO1xuICAgICAgbWFyZ2luOiAwLjI1cmVtO1xuICAgICAgdGV4dC1hbGlnbjogY2VudGVyO1xuICAgICAgd2lkdGg6IDJyZW07XG4gICAgICAmOmhvdmVyW2FyaWEtc2VsZWN0ZWQ9XCJmYWxzZVwiXTpub3QoJi0tZGlzYWJsZWQpIHtcbiAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogJHt0aGVtZS5wYWxldHRlLmdyYXkudWx0cmFMaWdodH07XG4gICAgICAgIGJvcmRlci1yYWRpdXM6IDAuMjVyZW07XG4gICAgICB9XG4gICAgICAmLW5hbWUge1xuICAgICAgICBjb2xvcjogJHt0aGVtZS5wYWxldHRlLmdyYXkubWFpbn07XG4gICAgICAgIGRpc3BsYXk6IGlubGluZS1ibG9jaztcbiAgICAgICAgZm9udC1zaXplOiAwLjc1cmVtO1xuICAgICAgICBmb250LXdlaWdodDogNjAwO1xuICAgICAgICBsaW5lLWhlaWdodDogMXJlbTtcbiAgICAgICAgbWFyZ2luOiAwIDAuMjVyZW07XG4gICAgICAgIHRleHQtYWxpZ246IGNlbnRlcjtcbiAgICAgICAgd2lkdGg6IDJyZW07XG4gICAgICB9XG4gICAgICAmLW5hbWVzIHtcbiAgICAgICAgd2hpdGUtc3BhY2U6IG5vd3JhcDtcbiAgICAgIH1cbiAgICAgICYtLWRpc2FibGVkIHtcbiAgICAgICAgY29sb3I6ICR7dGhlbWUucGFsZXR0ZS5ncmF5Lm1haW59O1xuICAgICAgICBjdXJzb3I6IGRlZmF1bHQ7XG4gICAgICAgICY6aG92ZXIge1xuICAgICAgICAgIGJhY2tncm91bmQtY29sb3I6IHRyYW5zcGFyZW50O1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICAmLS10b2RheVthcmlhLXNlbGVjdGVkPVwiZmFsc2VcIl0ge1xuICAgICAgICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gICAgICAgICY6OmJlZm9yZSB7XG4gICAgICAgICAgYm9yZGVyLWJvdHRvbTogMC4xMjVyZW0gc29saWQgJHt0aGVtZS5wYWxldHRlLnByaW1hcnkubWFpbn07XG4gICAgICAgICAgY29udGVudDogXCJcIjtcbiAgICAgICAgICBkaXNwbGF5OiBibG9jaztcbiAgICAgICAgICBpbnNldDogMDtcbiAgICAgICAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgICYtLWhpZ2hsaWdodGVkIHtcbiAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogIzNkY2M0YTtcbiAgICAgICAgYm9yZGVyLXJhZGl1czogMC4yNXJlbTtcbiAgICAgICAgY29sb3I6ICNmZmY7XG4gICAgICAgICY6aG92ZXIge1xuICAgICAgICAgIGJhY2tncm91bmQtY29sb3I6ICR7dGhlbWUucGFsZXR0ZS5zZWNvbmRhcnkubWFpbn07XG4gICAgICAgIH1cbiAgICAgICAgJi1jdXN0b20tMSB7XG4gICAgICAgICAgY29sb3I6IG1hZ2VudGE7XG4gICAgICAgIH1cbiAgICAgICAgJi1jdXN0b20tMiB7XG4gICAgICAgICAgY29sb3I6IGdyZWVuO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICAmLS1zZWxlY3RlZCxcbiAgICAgICYtLWluLXNlbGVjdGluZy1yYW5nZSxcbiAgICAgICYtLWluLXJhbmdlIHtcbiAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogJHt0aGVtZS5wYWxldHRlLnByaW1hcnkubWFpbn07XG4gICAgICAgIGJvcmRlci1yYWRpdXM6IDAuMjVyZW07XG4gICAgICAgIGNvbG9yOiAjZmZmO1xuICAgICAgICAmW2FyaWEtc2VsZWN0ZWQ9XCJ0cnVlXCJdIHtcbiAgICAgICAgICBjdXJzb3I6IGRlZmF1bHQ7XG4gICAgICAgIH1cbiAgICAgICAgJlthcmlhLXNlbGVjdGVkPVwiZmFsc2VcIl06aG92ZXIge1xuICAgICAgICAgIGJhY2tncm91bmQtY29sb3I6ICR7dGhlbWUucGFsZXR0ZS5wcmltYXJ5LmRhcmt9O1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICAmLS1pbi1zZWxlY3RpbmctcmFuZ2U6bm90KCYtLWluLXJhbmdlKSB7XG4gICAgICAgIGJhY2tncm91bmQtY29sb3I6IHJnYmEoMzMsIDEwNywgMTY1LCAwLjUpO1xuICAgICAgfVxuICAgICAgJi0ta2V5Ym9hcmQtc2VsZWN0ZWQge1xuICAgICAgICBib3JkZXItcmFkaXVzOiAwLjI1cmVtO1xuICAgICAgICBvdXRsaW5lOiAwLjEyNXJlbSBzb2xpZCAke3RoZW1lLnBhbGV0dGUucHJpbWFyeS5tYWlufTtcbiAgICAgIH1cbiAgICAgICR7XHJcbi8qIFJEUCBkb2Vzbid0IGF0dGFjaCB0aGUgLS1rZXlib2FyZC1zZWxlY3RlZCBjbGFzcyBpZiB5b3UgYXJyb3ctbmF2aWdhdGUgdG8gdGhlIGN1cnJlbnRseVxyXG4gICAgIHNlbGVjdGVkIGRhdGUsIHdoaWNoIHdvdWxkIHJlc3VsdCBpbiBhIGRlZmF1bHQgYnJvd3NlciBmb2N1cy1yaW5nICovIFwiXCJ9XG4gICAgICAmLS1zZWxlY3RlZDpub3QoJi0ta2V5Ym9hcmQtc2VsZWN0ZWQpOmZvY3VzLXZpc2libGUge1xuICAgICAgICBvdXRsaW5lOiAwLjEyNXJlbSBzb2xpZCAke3RoZW1lLnBhbGV0dGUucHJpbWFyeS5tYWlufTtcbiAgICAgIH1cbiAgICB9XG4gICAgJHsgLyogI2VuZHJlZ2lvbiAqL1wiXCJ9XG4gICAgJl9faW5wdXQtY29udGFpbmVyIHtcbiAgICAgIGRpc3BsYXk6IGlubGluZS1ibG9jaztcbiAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTtcbiAgICAgIHdpZHRoOiAxMDAlO1xuICAgIH1cbiAgfVxuYDtcclxuZXhwb3J0IGNvbnN0IGdldFdyYXBwZXJTdHlsZXMgPSAodGhlbWUpID0+IGNzcyBgXG4gIGJvcmRlcjogMDtcbiAgZGlzcGxheTogaW5saW5lLWJsb2NrO1xuICBwYWRkaW5nOiAwO1xuICB3aWR0aDogMTAwJTtcbiAgei1pbmRleDogMjAwO1xuYDtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9ZGF0ZS1waWNrZXIuc3R5bGVzLmpzLm1hcCJdfQ== */");
|
|
4631
4651
|
const getWrapperStyles = theme => /*#__PURE__*/css.css(process.env.NODE_ENV === "production" ? {
|
|
@@ -4642,28 +4662,30 @@ const DatePickerController = createFieldController();
|
|
|
4642
4662
|
// Look, react-datepicker and webpack really don't get along.
|
|
4643
4663
|
const ReactDatePicker = RDP__namespace.default.default || RDP__namespace.default || RDP__namespace;
|
|
4644
4664
|
const DatePicker = fieldProps => {
|
|
4645
|
-
const
|
|
4665
|
+
const {
|
|
4666
|
+
locale: alchemyLocale
|
|
4667
|
+
} = alchemy.useAlchemy();
|
|
4668
|
+
const rdpLocaleData = findDateLocale(alchemyLocale);
|
|
4669
|
+
const dateFormat = getlocaleDateStringFormat(alchemyLocale);
|
|
4646
4670
|
const theme = react.useTheme();
|
|
4647
4671
|
const datePickerRef = React.useRef(null);
|
|
4648
4672
|
return jsxRuntime.jsx(DatePickerController, Object.assign({}, fieldProps, {
|
|
4649
4673
|
children: _a => {
|
|
4650
4674
|
var _datePickerProps = __rest(_a, ["ref"]);
|
|
4651
|
-
// Lens the form's usa date string into a locale date string
|
|
4652
|
-
// for the now localized date picker
|
|
4653
4675
|
const onChange = date => {
|
|
4654
4676
|
var _a;
|
|
4655
|
-
|
|
4677
|
+
const formattedDate = formatByDateAndLocale(date, alchemyLocale, dateFormat);
|
|
4678
|
+
(_a = _datePickerProps.onChange) === null || _a === void 0 ? void 0 : _a.call(_datePickerProps, formattedDate);
|
|
4656
4679
|
};
|
|
4657
|
-
const value = formatLocaleDate(parseUSADate(_datePickerProps.value));
|
|
4658
4680
|
const datePickerProps = Object.assign(Object.assign({}, _datePickerProps), {
|
|
4659
4681
|
onChange,
|
|
4660
|
-
value
|
|
4682
|
+
value: _datePickerProps.value
|
|
4661
4683
|
});
|
|
4662
4684
|
return jsxRuntime.jsx("div", Object.assign({
|
|
4663
4685
|
css: getOverrideStyles(theme)
|
|
4664
4686
|
}, {
|
|
4665
4687
|
children: jsxRuntime.jsx(ReactDatePicker, Object.assign({
|
|
4666
|
-
locale:
|
|
4688
|
+
locale: rdpLocaleData
|
|
4667
4689
|
}, datePickerProps, {
|
|
4668
4690
|
customInput: /*#__PURE__*/React.createElement( /*#__PURE__*/React.forwardRef(function InputWrapper(_a, forwardedRef) {
|
|
4669
4691
|
var _b;
|
|
@@ -4698,24 +4720,24 @@ const DatePicker = fieldProps => {
|
|
|
4698
4720
|
return (_a = datePickerRef.current) === null || _a === void 0 ? void 0 : _a.setOpen(!datePickerRef.current.isCalendarOpen());
|
|
4699
4721
|
}
|
|
4700
4722
|
}),
|
|
4701
|
-
value: isFocused || value !==
|
|
4723
|
+
value: isFocused || value !== new Date().toLocaleDateString(alchemyLocale, {
|
|
4724
|
+
day: "2-digit",
|
|
4725
|
+
month: "2-digit",
|
|
4726
|
+
year: "numeric"
|
|
4727
|
+
}) ? value : datePickerProps.placeholderText
|
|
4702
4728
|
}));
|
|
4703
4729
|
})),
|
|
4704
4730
|
"data-testid": fieldProps.name ? humps.camelize(fieldProps.name) : "date",
|
|
4731
|
+
dateFormat: dateFormat,
|
|
4705
4732
|
onCalendarOpen: () => {
|
|
4706
4733
|
var _a;
|
|
4707
4734
|
return (_a = datePickerRef.current) === null || _a === void 0 ? void 0 : _a.setFocus();
|
|
4708
4735
|
},
|
|
4709
|
-
onChange: (date, event) => {
|
|
4710
|
-
var _a;
|
|
4711
|
-
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
4712
|
-
(_a = datePickerProps.onChange) === null || _a === void 0 ? void 0 : _a.call(datePickerProps, date ? formatLocaleDate(date) : null);
|
|
4713
|
-
},
|
|
4714
4736
|
popperClassName: getPopperStyles(theme),
|
|
4715
4737
|
popperPlacement: "bottom-end",
|
|
4716
4738
|
preventOpenOnFocus: true,
|
|
4717
4739
|
ref: datePickerRef,
|
|
4718
|
-
selected: parseLocaleDate(datePickerProps.value),
|
|
4740
|
+
selected: parseLocaleDate(datePickerProps.value, alchemyLocale),
|
|
4719
4741
|
showPopperArrow: false,
|
|
4720
4742
|
wrapperClassName: getWrapperStyles()
|
|
4721
4743
|
}))
|
|
@@ -5622,6 +5644,9 @@ const RateCard = ({
|
|
|
5622
5644
|
const {
|
|
5623
5645
|
t
|
|
5624
5646
|
} = reactI18next.useTranslation(["common", "purchase-label", "void-label"]);
|
|
5647
|
+
const {
|
|
5648
|
+
locale: defaultLocale
|
|
5649
|
+
} = alchemy.useAlchemy();
|
|
5625
5650
|
// determines if there is any action that needs to happen upon clicking an unselected Rate
|
|
5626
5651
|
const onClickAvailable = !!onClick && !_selected && rateId;
|
|
5627
5652
|
const onRateCardClick = () => onClickAvailable && onClick(rateId);
|
|
@@ -5689,7 +5714,7 @@ const RateCard = ({
|
|
|
5689
5714
|
}, {
|
|
5690
5715
|
children: carrierNickname
|
|
5691
5716
|
})), voidedAt && jsxRuntime.jsx(giger.Typography, {
|
|
5692
|
-
children: `${t("void-label:voidedOn")} ${formatDateDDMMYY(voidedAt)}`
|
|
5717
|
+
children: `${t("void-label:voidedOn")} ${formatDateDDMMYY(voidedAt, defaultLocale)}`
|
|
5693
5718
|
}), deliveryDays && jsxRuntime.jsx(giger.Typography, {
|
|
5694
5719
|
children: getDeliveryDaysLabel(deliveryDays)
|
|
5695
5720
|
}), children]
|
|
@@ -8475,6 +8500,9 @@ const DateRangeCombo = ({
|
|
|
8475
8500
|
const {
|
|
8476
8501
|
t
|
|
8477
8502
|
} = reactI18next.useTranslation();
|
|
8503
|
+
const {
|
|
8504
|
+
locale: defaultLocale
|
|
8505
|
+
} = alchemy.useAlchemy();
|
|
8478
8506
|
const handleChangeSelected = nextOption => {
|
|
8479
8507
|
void (onChange === null || onChange === void 0 ? void 0 : onChange(nextOption, customRange));
|
|
8480
8508
|
};
|
|
@@ -8492,10 +8520,10 @@ const DateRangeCombo = ({
|
|
|
8492
8520
|
children: [jsxRuntime.jsx(Spacer, {
|
|
8493
8521
|
multiplier: 2
|
|
8494
8522
|
}), jsxRuntime.jsx(giger.DatePicker, {
|
|
8495
|
-
dateFormat:
|
|
8523
|
+
dateFormat: getlocaleDateStringFormat(defaultLocale),
|
|
8496
8524
|
isClearable: true,
|
|
8497
8525
|
label: t("wallet-history:actions.chooseDate"),
|
|
8498
|
-
locale:
|
|
8526
|
+
locale: defaultLocale,
|
|
8499
8527
|
maxDate: new Date(),
|
|
8500
8528
|
onClickConfirm: dates => {
|
|
8501
8529
|
if (Array.isArray(dates) && dates.length === 2 && dates[1] !== null) handleConfirmCustomRange(dates);
|
|
@@ -9119,9 +9147,12 @@ const CellFormattedDate = ({
|
|
|
9119
9147
|
date,
|
|
9120
9148
|
short
|
|
9121
9149
|
}) => {
|
|
9150
|
+
const {
|
|
9151
|
+
locale: defaultLocale
|
|
9152
|
+
} = alchemy.useAlchemy();
|
|
9122
9153
|
return jsxRuntime.jsx("div", {
|
|
9123
9154
|
children: jsxRuntime.jsx("div", {
|
|
9124
|
-
children: short ? formatDateDDMMYY(date) : formatDate(date)
|
|
9155
|
+
children: short ? formatDateDDMMYY(date, defaultLocale) : formatDate(date, defaultLocale)
|
|
9125
9156
|
})
|
|
9126
9157
|
});
|
|
9127
9158
|
};
|
|
@@ -15125,7 +15156,6 @@ const ProductsDisplay = ({
|
|
|
15125
15156
|
|
|
15126
15157
|
extendZod();
|
|
15127
15158
|
const getShipmentSchema = ({
|
|
15128
|
-
allowInternationalShipFrom,
|
|
15129
15159
|
dimensionsUnit,
|
|
15130
15160
|
isContentDescriptionRequired: _isContentDescriptionRequired = false,
|
|
15131
15161
|
isCustomsRequired: _isCustomsRequired = false,
|
|
@@ -15160,14 +15190,21 @@ const getShipmentSchema = ({
|
|
|
15160
15190
|
insuredValue: moneySchema.extend({
|
|
15161
15191
|
amount: zod.z.number().positive()
|
|
15162
15192
|
}).optional(),
|
|
15163
|
-
products: zod.z.object({
|
|
15193
|
+
products: _isCustomsRequired ? zod.z.object({
|
|
15194
|
+
countryOfOrigin: zod.z.string().nullishDefault(undefined),
|
|
15195
|
+
description: zod.z.string().nullishDefault(undefined),
|
|
15196
|
+
harmonizedTariffCode: zod.z.string().nullishDefault(undefined),
|
|
15197
|
+
productId: zod.z.string().nullishDefault(undefined),
|
|
15198
|
+
quantity: zod.z.number().int(),
|
|
15199
|
+
value: moneySchema
|
|
15200
|
+
}).array().min(1) : zod.z.object({
|
|
15164
15201
|
countryOfOrigin: zod.z.string().nullishDefault(undefined),
|
|
15165
15202
|
description: zod.z.string().nullishDefault(undefined),
|
|
15166
15203
|
harmonizedTariffCode: zod.z.string().nullishDefault(undefined),
|
|
15167
15204
|
productId: zod.z.string().nullishDefault(undefined),
|
|
15168
15205
|
quantity: zod.z.number().int(),
|
|
15169
15206
|
value: moneySchema
|
|
15170
|
-
}).array().
|
|
15207
|
+
}).array().nullish(),
|
|
15171
15208
|
type: zod.z.object({
|
|
15172
15209
|
carrierId: zod.z.string().nullish(),
|
|
15173
15210
|
code: zod.z.string().nullish()
|
|
@@ -15189,10 +15226,7 @@ const getShipmentSchema = ({
|
|
|
15189
15226
|
}).nullish(),
|
|
15190
15227
|
shipDate: zod.z.string(),
|
|
15191
15228
|
shipmentId: zod.z.string().nullishDefault(undefined),
|
|
15192
|
-
warehouseId: zod.z.string().refine(warehouseId => !!warehouseId, "purchase-label:schemaErrors.shipFromAddressRequired")
|
|
15193
|
-
var _a;
|
|
15194
|
-
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";
|
|
15195
|
-
}, "purchase-label:schemaErrors.shipFromUnitedStatesOnly")
|
|
15229
|
+
warehouseId: zod.z.string().refine(warehouseId => !!warehouseId, "purchase-label:schemaErrors.shipFromAddressRequired")
|
|
15196
15230
|
});
|
|
15197
15231
|
const browseRatesSchema = baseSchema.extend({
|
|
15198
15232
|
__mode: zod.z.literal("browse_rates")
|
|
@@ -15236,7 +15270,7 @@ const getShipmentSchema = ({
|
|
|
15236
15270
|
carrierId: (_b = schema.carrierId) !== null && _b !== void 0 ? _b : undefined,
|
|
15237
15271
|
// Clear customs if not required
|
|
15238
15272
|
customs: _isCustomsRequired ? schema.customs : undefined,
|
|
15239
|
-
packages: [Object.assign(Object.assign(Object.assign({}, pkg), !_requireMeasurements && !((_c = pkg.weight) === null || _c === void 0 ? void 0 : _c.value) && {
|
|
15273
|
+
packages: [Object.assign(Object.assign(Object.assign(Object.assign({}, pkg), !_requireMeasurements && !((_c = pkg.weight) === null || _c === void 0 ? void 0 : _c.value) && {
|
|
15240
15274
|
weight: {
|
|
15241
15275
|
unit: "ounce",
|
|
15242
15276
|
value: 16
|
|
@@ -15249,6 +15283,9 @@ const getShipmentSchema = ({
|
|
|
15249
15283
|
} : {
|
|
15250
15284
|
// set the value for packageId if it doesn't have a carrier (custom package)
|
|
15251
15285
|
packageId: code
|
|
15286
|
+
}), {
|
|
15287
|
+
// Clear products if customs not required
|
|
15288
|
+
products: _isCustomsRequired ? schema.packages[0].products : []
|
|
15252
15289
|
})],
|
|
15253
15290
|
serviceCode: (_d = service === null || service === void 0 ? void 0 : service.serviceCode) !== null && _d !== void 0 ? _d : undefined
|
|
15254
15291
|
});
|
|
@@ -15295,6 +15332,9 @@ const ShipmentForm = ({
|
|
|
15295
15332
|
const {
|
|
15296
15333
|
t
|
|
15297
15334
|
} = reactI18next.useTranslation(["purchase-label"]);
|
|
15335
|
+
const {
|
|
15336
|
+
locale: defaultLocale
|
|
15337
|
+
} = alchemy.useAlchemy();
|
|
15298
15338
|
const [requireMeasurements, setRequireMeasurements] = React.useState(true);
|
|
15299
15339
|
const [insuranceEnabled, setInsuranceEnabled] = React.useState(false);
|
|
15300
15340
|
const {
|
|
@@ -15319,7 +15359,7 @@ const ShipmentForm = ({
|
|
|
15319
15359
|
const form = reactHookForm.useForm({
|
|
15320
15360
|
defaultValues: {
|
|
15321
15361
|
__mode: features.browseRates ? "browse_rates" : "select_service",
|
|
15322
|
-
shipDate:
|
|
15362
|
+
shipDate: formatByDateAndLocale(minimumShipDate || new Date(), defaultLocale)
|
|
15323
15363
|
},
|
|
15324
15364
|
resolver: validationResolver(shipmentSchema)
|
|
15325
15365
|
});
|
|
@@ -15451,11 +15491,11 @@ const ShipmentForm = ({
|
|
|
15451
15491
|
carrierId: updatedShipment.carrierId,
|
|
15452
15492
|
serviceCode: updatedShipment.serviceCode
|
|
15453
15493
|
} : undefined,
|
|
15454
|
-
shipDate:
|
|
15494
|
+
shipDate: formatByDateAndLocale(mostRecent(omitTime(updatedShipment.shipDate), minimumShipDate), defaultLocale),
|
|
15455
15495
|
shipmentId: updatedShipment.shipmentId,
|
|
15456
15496
|
warehouseId: updatedShipment.warehouseId
|
|
15457
15497
|
}));
|
|
15458
|
-
}, [findCustomPackage, form, isCustomsRequired, isContentDescriptionRequired]);
|
|
15498
|
+
}, [findCustomPackage, form, isCustomsRequired, isContentDescriptionRequired, defaultLocale]);
|
|
15459
15499
|
// Allow us to imperatively trigger hydrateShipment from parent component
|
|
15460
15500
|
hydrateRef.current = hydrateShipment;
|
|
15461
15501
|
// Hydrate only the products portion of the shipment form
|
|
@@ -15474,10 +15514,23 @@ const ShipmentForm = ({
|
|
|
15474
15514
|
try {
|
|
15475
15515
|
const _m = values,
|
|
15476
15516
|
{
|
|
15477
|
-
__mode: discard
|
|
15517
|
+
__mode: discard,
|
|
15518
|
+
shipDate: payloadShipDate
|
|
15478
15519
|
} = _m,
|
|
15479
|
-
payload = __rest(_m, ["__mode"]);
|
|
15480
|
-
|
|
15520
|
+
payload = __rest(_m, ["__mode", "shipDate"]);
|
|
15521
|
+
let shipDate = payloadShipDate;
|
|
15522
|
+
if (defaultLocale !== "en-US") {
|
|
15523
|
+
// formate shipDate to en-US format before updating the shipment
|
|
15524
|
+
const date = parseLocaleDate(shipDate, defaultLocale);
|
|
15525
|
+
shipDate = formatByDateAndLocale(date, "en-US", "MM/dd/yyyy");
|
|
15526
|
+
}
|
|
15527
|
+
const updatedShipment = yield onSubmit(
|
|
15528
|
+
// using mergeWith to get a deep merge and also respect undefined values
|
|
15529
|
+
___default["default"].mergeWith(shipment, payload, (objValue, srcValue, key, obj) => {
|
|
15530
|
+
if (objValue !== srcValue && typeof srcValue === "undefined") {
|
|
15531
|
+
obj[key] = srcValue;
|
|
15532
|
+
}
|
|
15533
|
+
}));
|
|
15481
15534
|
// Defer shipment hydration to the task queue so that the submission promise resolves first, otherwise the
|
|
15482
15535
|
// submission count will increment after hydration resets the form, keeping it in revalidate mode
|
|
15483
15536
|
if (updatedShipment) setTimeout(() => hydrateShipment(updatedShipment), 0);
|
|
@@ -15618,7 +15671,6 @@ const ShipmentForm = ({
|
|
|
15618
15671
|
});
|
|
15619
15672
|
if (!shipment) throw new Error("errorMessages.unableToLoad.shipment");
|
|
15620
15673
|
const addressPreferenceIsEmpty = !addressLoading && isEmptyAddress(addressPreference === null || addressPreference === void 0 ? void 0 : addressPreference.selection); // undefined means it's still loading
|
|
15621
|
-
console.log(addressLoading || isEditShipFormToOpen || addressPreferenceIsEmpty);
|
|
15622
15674
|
return jsxRuntime.jsxs("form", Object.assign({
|
|
15623
15675
|
id: "shipment-form",
|
|
15624
15676
|
onSubmit: formLogger.capture(handleSubmit)
|
|
@@ -15684,7 +15736,7 @@ const ShipmentForm = ({
|
|
|
15684
15736
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
15685
15737
|
variant: "body2"
|
|
15686
15738
|
}, {
|
|
15687
|
-
children: formatDate(salesOrder.orderDate)
|
|
15739
|
+
children: formatDate(salesOrder.orderDate, defaultLocale)
|
|
15688
15740
|
})), jsxRuntime.jsx(Spacer, {})]
|
|
15689
15741
|
})), ((_d = salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.paymentDetails) === null || _d === void 0 ? void 0 : _d.grandTotal) && jsxRuntime.jsxs(FieldLabel, Object.assign({
|
|
15690
15742
|
label: t("purchase-label:fields.orderValue")
|
|
@@ -17036,20 +17088,23 @@ const usePendingShipment = ({
|
|
|
17036
17088
|
const customsFromSalesOrder = getCustomsFromSalesOrder(salesOrder, defaultWarehouse);
|
|
17037
17089
|
try {
|
|
17038
17090
|
setIsCreatingShipment(true);
|
|
17091
|
+
const isCustomsRequired = getIsCustomsRequiredForSalesOrder(salesOrder, defaultWarehouse);
|
|
17039
17092
|
const shipment = yield createShipment(Object.assign(Object.assign({
|
|
17040
17093
|
salesOrderId: salesOrder.salesOrderId,
|
|
17041
17094
|
warehouseId: defaultWarehouse.warehouseId
|
|
17042
|
-
},
|
|
17095
|
+
}, isCustomsRequired && {
|
|
17043
17096
|
customs: customsFromSalesOrder.customs
|
|
17044
17097
|
}), {
|
|
17045
|
-
packages: [{
|
|
17046
|
-
packageCode: "package"
|
|
17047
|
-
|
|
17098
|
+
packages: [Object.assign(Object.assign({
|
|
17099
|
+
packageCode: "package"
|
|
17100
|
+
}, isCustomsRequired && {
|
|
17101
|
+
products: customsFromSalesOrder.products
|
|
17102
|
+
}), {
|
|
17048
17103
|
weight: {
|
|
17049
17104
|
unit: "pound",
|
|
17050
17105
|
value: 0
|
|
17051
17106
|
}
|
|
17052
|
-
}]
|
|
17107
|
+
})]
|
|
17053
17108
|
}));
|
|
17054
17109
|
if (shipment) {
|
|
17055
17110
|
yield reloadShipments();
|
|
@@ -18257,6 +18312,19 @@ const Component$4 = _a => {
|
|
|
18257
18312
|
const {
|
|
18258
18313
|
data: fundingSource
|
|
18259
18314
|
} = alchemy.useListFundingSources();
|
|
18315
|
+
const {
|
|
18316
|
+
locale: alchemyLocale
|
|
18317
|
+
} = alchemy.useAlchemy();
|
|
18318
|
+
const defaultLocale = alchemyLocale !== null && alchemyLocale !== void 0 ? alchemyLocale : "en-US";
|
|
18319
|
+
const locale = findDateLocale(alchemyLocale);
|
|
18320
|
+
/**
|
|
18321
|
+
* Registers the alchemy locale for React Date Picker for use in the
|
|
18322
|
+
* Date Picker component. React Date Picker uses date-fns internationalization
|
|
18323
|
+
* to localize its display components. By default, the date picker will use the
|
|
18324
|
+
* locale globally set, which is English.
|
|
18325
|
+
*/
|
|
18326
|
+
RDP.registerLocale(defaultLocale, locale);
|
|
18327
|
+
RDP.setDefaultLocale(defaultLocale);
|
|
18260
18328
|
const currency = getCurrencyFromString((_b = fundingSource === null || fundingSource === void 0 ? void 0 : fundingSource[0]) === null || _b === void 0 ? void 0 : _b.currencyCode);
|
|
18261
18329
|
const incompleteRequirementsKeys = React.useMemo(() => {
|
|
18262
18330
|
const isMissingWarehouse = (warehouses === null || warehouses === void 0 ? void 0 : warehouses.length) === 0;
|
|
@@ -18498,6 +18566,9 @@ const Shipment = ({
|
|
|
18498
18566
|
const {
|
|
18499
18567
|
t
|
|
18500
18568
|
} = reactI18next.useTranslation(["common", "view-shipment"]);
|
|
18569
|
+
const {
|
|
18570
|
+
locale: defaultLocale
|
|
18571
|
+
} = alchemy.useAlchemy();
|
|
18501
18572
|
const [showItems, setShowItems] = React.useState(false);
|
|
18502
18573
|
const {
|
|
18503
18574
|
confirmation: deliveryConfirmation,
|
|
@@ -18530,7 +18601,7 @@ const Shipment = ({
|
|
|
18530
18601
|
"data-testid": "shipDate",
|
|
18531
18602
|
label: t("view-shipment:fields.shipDate")
|
|
18532
18603
|
}, {
|
|
18533
|
-
children: [formatDate(omitTime(shipment.shipDate).toISOString()), jsxRuntime.jsx(Spacer, {})]
|
|
18604
|
+
children: [formatDate(omitTime(shipment.shipDate).toISOString(), defaultLocale), jsxRuntime.jsx(Spacer, {})]
|
|
18534
18605
|
})), jsxRuntime.jsxs(FieldLabel, Object.assign({
|
|
18535
18606
|
"data-testid": "shipFrom",
|
|
18536
18607
|
label: t("view-shipment:fields.warehouse")
|
|
@@ -18547,7 +18618,7 @@ const Shipment = ({
|
|
|
18547
18618
|
"data-testid": "orderDate",
|
|
18548
18619
|
label: t("view-shipment:fields.orderDate")
|
|
18549
18620
|
}, {
|
|
18550
|
-
children: [salesOrder ? formatDate(salesOrder.orderDate) : t("loading.salesOrder"), jsxRuntime.jsx(Spacer, {})]
|
|
18621
|
+
children: [salesOrder ? formatDate(salesOrder.orderDate, defaultLocale) : t("loading.salesOrder"), jsxRuntime.jsx(Spacer, {})]
|
|
18551
18622
|
})), hasSalesOrder && jsxRuntime.jsxs(FieldLabel, Object.assign({
|
|
18552
18623
|
"data-testid": "orderValue",
|
|
18553
18624
|
label: t("view-shipment:fields.orderValue")
|
|
@@ -20764,10 +20835,13 @@ exports.euCountryCodes = euCountryCodes;
|
|
|
20764
20835
|
exports.extendZod = extendZod;
|
|
20765
20836
|
exports.featureFlagComponentNameLookup = featureFlagComponentNameLookup;
|
|
20766
20837
|
exports.featureFlags = featureFlags;
|
|
20838
|
+
exports.findDateLocale = findDateLocale;
|
|
20767
20839
|
exports.formLogger = formLogger;
|
|
20840
|
+
exports.formatByDateAndLocale = formatByDateAndLocale;
|
|
20768
20841
|
exports.formatCreditCardNumber = formatCreditCardNumber;
|
|
20769
20842
|
exports.formatDate = formatDate;
|
|
20770
20843
|
exports.formatDateDDMMYY = formatDateDDMMYY;
|
|
20844
|
+
exports.formatDateDDMMYYYY = formatDateDDMMYYYY;
|
|
20771
20845
|
exports.formatDimensions = formatDimensions;
|
|
20772
20846
|
exports.formatExpiration = formatExpiration;
|
|
20773
20847
|
exports.formatFractionalWeight = formatFractionalWeight;
|
|
@@ -20790,6 +20864,7 @@ exports.getRequestedServices = getRequestedServices;
|
|
|
20790
20864
|
exports.getSalesOrderItemsFromSalesOrderOrShipment = getSalesOrderItemsFromSalesOrderOrShipment;
|
|
20791
20865
|
exports.getShipmentByStatus = getShipmentByStatus;
|
|
20792
20866
|
exports.getTotalRateAmount = getTotalRateAmount;
|
|
20867
|
+
exports.getlocaleDateStringFormat = getlocaleDateStringFormat;
|
|
20793
20868
|
exports.isDecimalWeight = isDecimalWeight;
|
|
20794
20869
|
exports.isDomesticAddress = isDomesticAddress;
|
|
20795
20870
|
exports.isEmptyAddress = isEmptyAddress;
|
|
@@ -20809,6 +20884,7 @@ exports.mostRecent = mostRecent;
|
|
|
20809
20884
|
exports.nextDayCutoff = nextDayCutoff;
|
|
20810
20885
|
exports.omitTime = omitTime;
|
|
20811
20886
|
exports.overrideCarrierCodes = overrideCarrierCodes$1;
|
|
20887
|
+
exports.parseLocaleDate = parseLocaleDate;
|
|
20812
20888
|
exports.pascalize = pascalize;
|
|
20813
20889
|
exports.phoneSchema = phoneSchema;
|
|
20814
20890
|
exports.phoneSchemaUnvalidated = phoneSchemaUnvalidated;
|