@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.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useEffect,
|
|
3
|
+
import { useEffect, useRef, createElement as createElement$2, forwardRef, useCallback, useReducer, useMemo, useState, memo, createContext, useContext, useLayoutEffect, Fragment as Fragment$1 } from 'react';
|
|
4
4
|
import { useController, get as get$2, set as set$2, useWatch, useFormState, useForm } from 'react-hook-form';
|
|
5
5
|
import { useTranslation, Trans } from 'react-i18next';
|
|
6
|
-
import alchemy, { logger, SE,
|
|
6
|
+
import alchemy, { logger, SE, useAlchemy, useValidateAddresses, useAddFunds, useGetCarrierById, useUpdateAutoFunding, useGetAutoFundingConfiguration, useUpdateFundingSource, useListFundingSources, useListCarriers, useConnectCarrier, useListWarehouses, useUpdateWarehouse, useCreateWarehouse, useDeleteWarehouse, useGetFundingSourceTransactions, useListSalesOrderShipments, useGetAccountSettings, useUpdateAccountSettings, useUpdateSalesOrderShipment, useParseAddress, useListCustomPackageTypes, useCalculateRates, useGetShipmentRates, useListLabels, useCreateLabel, useCreateSalesOrderShipment, CodedError, useListSalesOrders, useGetSalesOrder, useListOrderSources, useRefreshOrderSource, useGetInsuranceAccount, useCreateShipment, useGetShipment, useGetSalesOrderShipment, useGetLabel, useVoidLabel, useCreateFundingSource, useRegisterCarrier, useGetFundingSourceMetadata } from '@shipengine/alchemy';
|
|
7
7
|
import { Typography, FormField, FieldMessageType, Checkbox, Input, Icon, IconSize, Divider, Link, SelectAutocomplete, Select as Select$1, OptionGroup, Option, Button, Switch as Switch$1, Textarea, InlineNotification, NotificationType, Spinner, SpinnerSize, ChipList, Chip, ButtonVariant, ButtonSize, DatePicker as DatePicker$1, Table, TableFooter, TableHeader, TableHeaderRow, TableHeaderCell, TableBody, TableRow, TableBodyCell, TableBaseRow, DropdownOptionList, Pagination, Grid, GridChild, RadioGroup, Radio, ButtonColor, Tag, TagColor, Skeleton, SkeletonAnimation, SkeletonVariant, SkeletonBackgroundColor, Popover, BottomSheet, IconTooltip, Stepper, Step } from '@shipengine/giger';
|
|
8
|
+
import { format, parse } from 'date-fns';
|
|
9
|
+
import * as Locales from 'date-fns/locale';
|
|
8
10
|
import axios from 'axios';
|
|
9
11
|
import _$3, { get as get$1, isEqual, merge as merge$1 } from 'lodash';
|
|
10
12
|
import humps, { camelize } from 'humps';
|
|
@@ -14,8 +16,6 @@ import { useTheme, css as css$1, createElement as createElement$3, keyframes } f
|
|
|
14
16
|
import * as RDP from 'react-datepicker';
|
|
15
17
|
import { registerLocale, setDefaultLocale } from 'react-datepicker';
|
|
16
18
|
import { IconNames } from '@shipengine/giger-theme';
|
|
17
|
-
import { parse, format } from 'date-fns';
|
|
18
|
-
import * as Locales from 'date-fns/locale';
|
|
19
19
|
import { css } from '@emotion/css';
|
|
20
20
|
import { createPortal } from 'react-dom';
|
|
21
21
|
import { encode } from 'js-base64';
|
|
@@ -1768,604 +1768,121 @@ const createDictionary = (items, getEntry) => {
|
|
|
1768
1768
|
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 : {};
|
|
1769
1769
|
};
|
|
1770
1770
|
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
* @internal
|
|
1797
|
-
*
|
|
1798
|
-
* # Date Utils - getDaysInMonth
|
|
1799
|
-
*
|
|
1800
|
-
* @category Utilities
|
|
1801
|
-
*/
|
|
1802
|
-
const daysAfter = (days, date = new Date()) => {
|
|
1803
|
-
date = new Date(date);
|
|
1804
|
-
date.setDate(date.getDate() + days);
|
|
1805
|
-
return date;
|
|
1806
|
-
};
|
|
1807
|
-
/**
|
|
1808
|
-
* @internal
|
|
1809
|
-
*
|
|
1810
|
-
* # Date Utils - getDaysInMonth
|
|
1811
|
-
*
|
|
1812
|
-
* @category Utilities
|
|
1813
|
-
*/
|
|
1814
|
-
const nextDayCutoff = (cutoff, date = new Date()) => date.getHours() >= cutoff ? daysAfter(1, new Date(date)) : new Date(date);
|
|
1815
|
-
/**
|
|
1816
|
-
* @internal
|
|
1817
|
-
*
|
|
1818
|
-
* # Date Utils - getDaysInMonth
|
|
1819
|
-
*
|
|
1820
|
-
* @category Utilities
|
|
1821
|
-
*/
|
|
1822
|
-
const mostRecent = (...dates) => new Date(Math.max(...dates.map(Number)));
|
|
1823
|
-
/**
|
|
1824
|
-
* @internal
|
|
1825
|
-
*
|
|
1826
|
-
* # Date Utils - getDaysInMonth
|
|
1827
|
-
*
|
|
1828
|
-
* @category Utilities
|
|
1829
|
-
*/
|
|
1830
|
-
const omitTime = shipDate => {
|
|
1831
|
-
const date = shipDate ? new Date(shipDate) : new Date();
|
|
1832
|
-
return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
|
|
1833
|
-
};
|
|
1834
|
-
/**
|
|
1835
|
-
* @internal
|
|
1836
|
-
*
|
|
1837
|
-
* # Date Utils - getExpirationYears
|
|
1838
|
-
*
|
|
1839
|
-
* @category Utilities
|
|
1840
|
-
*/
|
|
1841
|
-
const getExpirationYears = yearsValid => {
|
|
1842
|
-
const currentYear = new Date().getFullYear();
|
|
1843
|
-
const years = [];
|
|
1844
|
-
for (let i = 0; i < yearsValid; i++) {
|
|
1845
|
-
years.push(`${currentYear + i}`);
|
|
1846
|
-
}
|
|
1847
|
-
return years;
|
|
1771
|
+
var wellKnownSymbol$d = wellKnownSymbol$k;
|
|
1772
|
+
|
|
1773
|
+
var TO_STRING_TAG$1 = wellKnownSymbol$d('toStringTag');
|
|
1774
|
+
var test$1 = {};
|
|
1775
|
+
|
|
1776
|
+
test$1[TO_STRING_TAG$1] = 'z';
|
|
1777
|
+
|
|
1778
|
+
var toStringTagSupport = String(test$1) === '[object z]';
|
|
1779
|
+
|
|
1780
|
+
var TO_STRING_TAG_SUPPORT = toStringTagSupport;
|
|
1781
|
+
var isCallable$9 = isCallable$o;
|
|
1782
|
+
var classofRaw$1 = classofRaw$2;
|
|
1783
|
+
var wellKnownSymbol$c = wellKnownSymbol$k;
|
|
1784
|
+
|
|
1785
|
+
var TO_STRING_TAG = wellKnownSymbol$c('toStringTag');
|
|
1786
|
+
var $Object = Object;
|
|
1787
|
+
|
|
1788
|
+
// ES3 wrong here
|
|
1789
|
+
var CORRECT_ARGUMENTS = classofRaw$1(function () { return arguments; }()) == 'Arguments';
|
|
1790
|
+
|
|
1791
|
+
// fallback for IE11 Script Access Denied error
|
|
1792
|
+
var tryGet = function (it, key) {
|
|
1793
|
+
try {
|
|
1794
|
+
return it[key];
|
|
1795
|
+
} catch (error) { /* empty */ }
|
|
1848
1796
|
};
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1797
|
+
|
|
1798
|
+
// getting tag from ES6+ `Object.prototype.toString`
|
|
1799
|
+
var classof$6 = TO_STRING_TAG_SUPPORT ? classofRaw$1 : function (it) {
|
|
1800
|
+
var O, tag, result;
|
|
1801
|
+
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
1802
|
+
// @@toStringTag case
|
|
1803
|
+
: typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
|
|
1804
|
+
// builtinTag case
|
|
1805
|
+
: CORRECT_ARGUMENTS ? classofRaw$1(O)
|
|
1806
|
+
// ES3 arguments fallback
|
|
1807
|
+
: (result = classofRaw$1(O)) == 'Object' && isCallable$9(O.callee) ? 'Arguments' : result;
|
|
1859
1808
|
};
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
if (shipDate) return new Date(shipDate) >= new Date();
|
|
1869
|
-
return false;
|
|
1809
|
+
|
|
1810
|
+
var classof$5 = classof$6;
|
|
1811
|
+
|
|
1812
|
+
var $String$1 = String;
|
|
1813
|
+
|
|
1814
|
+
var toString$c = function (argument) {
|
|
1815
|
+
if (classof$5(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
|
|
1816
|
+
return $String$1(argument);
|
|
1870
1817
|
};
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1818
|
+
|
|
1819
|
+
var anObject$9 = anObject$f;
|
|
1820
|
+
|
|
1821
|
+
// `RegExp.prototype.flags` getter implementation
|
|
1822
|
+
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
|
|
1823
|
+
var regexpFlags$1 = function () {
|
|
1824
|
+
var that = anObject$9(this);
|
|
1825
|
+
var result = '';
|
|
1826
|
+
if (that.hasIndices) result += 'd';
|
|
1827
|
+
if (that.global) result += 'g';
|
|
1828
|
+
if (that.ignoreCase) result += 'i';
|
|
1829
|
+
if (that.multiline) result += 'm';
|
|
1830
|
+
if (that.dotAll) result += 's';
|
|
1831
|
+
if (that.unicode) result += 'u';
|
|
1832
|
+
if (that.unicodeSets) result += 'v';
|
|
1833
|
+
if (that.sticky) result += 'y';
|
|
1834
|
+
return result;
|
|
1888
1835
|
};
|
|
1889
1836
|
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1837
|
+
var fails$d = fails$q;
|
|
1838
|
+
var global$d = global$p;
|
|
1839
|
+
|
|
1840
|
+
// babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
|
|
1841
|
+
var $RegExp$2 = global$d.RegExp;
|
|
1842
|
+
|
|
1843
|
+
var UNSUPPORTED_Y$1 = fails$d(function () {
|
|
1844
|
+
var re = $RegExp$2('a', 'y');
|
|
1845
|
+
re.lastIndex = 2;
|
|
1846
|
+
return re.exec('abcd') != null;
|
|
1847
|
+
});
|
|
1848
|
+
|
|
1849
|
+
// UC Browser bug
|
|
1850
|
+
// https://github.com/zloirock/core-js/issues/1008
|
|
1851
|
+
var MISSED_STICKY = UNSUPPORTED_Y$1 || fails$d(function () {
|
|
1852
|
+
return !$RegExp$2('a', 'y').sticky;
|
|
1853
|
+
});
|
|
1854
|
+
|
|
1855
|
+
var BROKEN_CARET = UNSUPPORTED_Y$1 || fails$d(function () {
|
|
1856
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=773687
|
|
1857
|
+
var re = $RegExp$2('^r', 'gy');
|
|
1858
|
+
re.lastIndex = 2;
|
|
1859
|
+
return re.exec('str') != null;
|
|
1860
|
+
});
|
|
1861
|
+
|
|
1862
|
+
var regexpStickyHelpers = {
|
|
1863
|
+
BROKEN_CARET: BROKEN_CARET,
|
|
1864
|
+
MISSED_STICKY: MISSED_STICKY,
|
|
1865
|
+
UNSUPPORTED_Y: UNSUPPORTED_Y$1
|
|
1910
1866
|
};
|
|
1911
|
-
/**
|
|
1912
|
-
* @internal
|
|
1913
|
-
*
|
|
1914
|
-
* - Joins a list of error-like object's messages and throws them as a single error.
|
|
1915
|
-
*
|
|
1916
|
-
* @category Utilities
|
|
1917
|
-
*/
|
|
1918
|
-
function throwJoinedMessages(errors) {
|
|
1919
|
-
throw new Error(errors.map(e => e.message).join(", "));
|
|
1920
|
-
}
|
|
1921
|
-
/**
|
|
1922
|
-
* @internal
|
|
1923
|
-
*
|
|
1924
|
-
* - If any CodedErrors exist, throw them all as a single error, otherwise assert errors is null.
|
|
1925
|
-
*
|
|
1926
|
-
* @category Utilities
|
|
1927
|
-
*/
|
|
1928
|
-
function throwAny(errors) {
|
|
1929
|
-
if (errors) throwJoinedMessages(errors);
|
|
1930
|
-
}
|
|
1931
1867
|
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
*
|
|
1935
|
-
* - The `featureFlags` namespace contains all the feature flags available throughout the
|
|
1936
|
-
* application. All features are scoped by name to the component they are intended for.
|
|
1937
|
-
*
|
|
1938
|
-
* @example
|
|
1939
|
-
* ```tsx
|
|
1940
|
-
* export const featureFlags = {
|
|
1941
|
-
* ConfigureSalesOrderShipment: {
|
|
1942
|
-
* compatibleCountryCodes: ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"],
|
|
1943
|
-
* rateForm: {
|
|
1944
|
-
* enableFunding: false,
|
|
1945
|
-
* enableGlobalPostFiltering: false,
|
|
1946
|
-
* labelLayout: false,
|
|
1947
|
-
* nicknameRate: true,
|
|
1948
|
-
* saveRate: true,
|
|
1949
|
-
* },
|
|
1950
|
-
* shipmentForm: {
|
|
1951
|
-
* browseRates: true,
|
|
1952
|
-
* includeShipsuranceInsurance: true,
|
|
1953
|
-
* includeThirdPartyInsurance: true,
|
|
1954
|
-
* selectService: true,
|
|
1955
|
-
* shippingPresets: false,
|
|
1956
|
-
* },
|
|
1957
|
-
* },
|
|
1958
|
-
* Global: {
|
|
1959
|
-
* carriers: {
|
|
1960
|
-
* enabledCarriers: ["stamps_com", "ups", "dhl_express_walleted"],
|
|
1961
|
-
* },
|
|
1962
|
-
* presentation: {
|
|
1963
|
-
* poweredByShipEngine: false,
|
|
1964
|
-
* },
|
|
1965
|
-
* },
|
|
1966
|
-
* ViewShipment: {
|
|
1967
|
-
* shipment: {
|
|
1968
|
-
* schedulePickup: true,
|
|
1969
|
-
* },
|
|
1970
|
-
* },
|
|
1971
|
-
* } as const;
|
|
1972
|
-
* ```
|
|
1973
|
-
*/
|
|
1974
|
-
const featureFlags = {
|
|
1975
|
-
/**
|
|
1976
|
-
* `ConfigureSalesOrderShipment` all scoped feature flags for the shipment configuration
|
|
1977
|
-
* section of the `<PurchaseLabel />` element.
|
|
1978
|
-
*/
|
|
1979
|
-
ConfigureSalesOrderShipment: {
|
|
1980
|
-
/**
|
|
1981
|
-
* `compatibleCountryCodes` is a list of all supported `countries` available in ShipEngine
|
|
1982
|
-
* Elements.
|
|
1983
|
-
*/
|
|
1984
|
-
compatibleCountryCodes: ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"],
|
|
1985
|
-
/**
|
|
1986
|
-
* `configureShipment` is a group of flags related to the useConfigureShipment functionality
|
|
1987
|
-
*/
|
|
1988
|
-
configureShipment: {
|
|
1989
|
-
/**
|
|
1990
|
-
* `enableErrorWhenShipmentCancelled` when enabled will modify the default behavior of creating a new shipment for a salesorder to throwing an error
|
|
1991
|
-
*/
|
|
1992
|
-
enableErrorWhenShipmentCancelled: false
|
|
1993
|
-
},
|
|
1994
|
-
/**
|
|
1995
|
-
* @internal
|
|
1996
|
-
*
|
|
1997
|
-
* `partnerMessages` enables the partner consuming elements to specify override messages in specific cases.
|
|
1998
|
-
*/
|
|
1999
|
-
partnerMessages: {
|
|
2000
|
-
incompleteLabelPurchaseRequirements: undefined
|
|
2001
|
-
},
|
|
2002
|
-
/**
|
|
2003
|
-
* `rateForm` all scoped feature flags for the `rate form` section of the `<PurchaseLabel />`
|
|
2004
|
-
* element.
|
|
2005
|
-
*/
|
|
2006
|
-
rateForm: {
|
|
2007
|
-
/**
|
|
2008
|
-
* `enableFunding` enables the `funding` section of the rate form.
|
|
2009
|
-
*/
|
|
2010
|
-
enableFunding: false,
|
|
2011
|
-
/**
|
|
2012
|
-
* `enableGlobalPostFiltering` enables the `global post filtering` on all rates fetched
|
|
2013
|
-
* in the rates form.
|
|
2014
|
-
*/
|
|
2015
|
-
enableGlobalPostFiltering: false,
|
|
2016
|
-
/**
|
|
2017
|
-
* `labelLayout` enables the `label layout` section of the `<PurchaseLabel /> element.
|
|
2018
|
-
*/
|
|
2019
|
-
labelLayout: false,
|
|
2020
|
-
/**
|
|
2021
|
-
* `nicknameRate` enables showing the `carrier nickname` when rates are fetched.
|
|
2022
|
-
*/
|
|
2023
|
-
nicknameRate: true,
|
|
2024
|
-
/**
|
|
2025
|
-
* `requireDhlTermsAcknowledgement` enables the `DHL terms acknowledgement` when rates are fetched.
|
|
2026
|
-
*/
|
|
2027
|
-
requireDhlTermsAcknowledgement: false,
|
|
2028
|
-
/**
|
|
2029
|
-
* `saveRate` enables the `save rate` button in the rate form. This allows users to save a
|
|
2030
|
-
* `rateId` for a shipment to be purchased later.
|
|
2031
|
-
*/
|
|
2032
|
-
saveRate: true
|
|
2033
|
-
},
|
|
2034
|
-
/**
|
|
2035
|
-
* `shipmentForm` all scoped feature flags for the `shipment form` section of the
|
|
2036
|
-
* `<PurchaseLabel />` element.
|
|
2037
|
-
*/
|
|
2038
|
-
shipmentForm: {
|
|
2039
|
-
/**
|
|
2040
|
-
* `browseRates` enables the `browse rates` button in the shipment form. This allows users
|
|
2041
|
-
* to browse rates for a shipment with varying shipment configurations. This is useful for
|
|
2042
|
-
* rate shopping.
|
|
2043
|
-
*/
|
|
2044
|
-
browseRates: true,
|
|
2045
|
-
/**
|
|
2046
|
-
* `includeShipsuranceInsurance` enables the `shipsurance insurance` feature, allowing users
|
|
2047
|
-
* to select Shipsurance when insuring their shipment.
|
|
2048
|
-
*/
|
|
2049
|
-
includeShipsuranceInsurance: true,
|
|
2050
|
-
/**
|
|
2051
|
-
* `includeThirdPartyInsurance` enables the `third party insurance` feature, allowing users
|
|
2052
|
-
* to opt for third party insurance when insuring their shipment.
|
|
2053
|
-
*/
|
|
2054
|
-
includeThirdPartyInsurance: true,
|
|
2055
|
-
/**
|
|
2056
|
-
* `selectService` enables the `select service` feature, allowing users to select a service
|
|
2057
|
-
* when rate shopping across multiple carrier providers.
|
|
2058
|
-
*/
|
|
2059
|
-
selectService: true,
|
|
2060
|
-
/**
|
|
2061
|
-
* `shippingPresets` enables the `shipping presets` feature, allowing users to pass in a set
|
|
2062
|
-
* of shipping presets they wish to use within the shipment form of the `<PurchaseLabel />`
|
|
2063
|
-
* element.
|
|
2064
|
-
*/
|
|
2065
|
-
shippingPresets: false
|
|
2066
|
-
}
|
|
2067
|
-
},
|
|
2068
|
-
/**
|
|
2069
|
-
* `Global` all feature flags that are intended for use anywhere in ShipEngine Elements.
|
|
2070
|
-
*/
|
|
2071
|
-
Global: {
|
|
2072
|
-
/**
|
|
2073
|
-
* All global `carrier` related feature flags.
|
|
2074
|
-
*/
|
|
2075
|
-
carriers: {
|
|
2076
|
-
/**
|
|
2077
|
-
* `enabledCarriers` is a list of all `carriers` that are enabled for use in ShipEngine
|
|
2078
|
-
* Elements.
|
|
2079
|
-
*/
|
|
2080
|
-
enabledCarriers: ["stamps_com", "ups_walleted", "dhl_express_walleted", "ups", "hermes", "yodel_walleted"]
|
|
2081
|
-
},
|
|
2082
|
-
/**
|
|
2083
|
-
* All global `presentation` related feature flags.
|
|
2084
|
-
*/
|
|
2085
|
-
presentation: {
|
|
2086
|
-
/**
|
|
2087
|
-
* `poweredByShipEngine` enables the `powered by ShipEngine` logo in the footer various
|
|
2088
|
-
* elements.
|
|
2089
|
-
*/
|
|
2090
|
-
poweredByShipEngine: false
|
|
2091
|
-
}
|
|
2092
|
-
},
|
|
2093
|
-
/**
|
|
2094
|
-
* `ViewShipment` all scoped feature flags for the `<ViewShipment />` element.
|
|
2095
|
-
*/
|
|
2096
|
-
ViewShipment: {
|
|
2097
|
-
/**
|
|
2098
|
-
* `shipment` all shipment related features available in the `<ViewShipment />` element.
|
|
2099
|
-
*/
|
|
2100
|
-
shipment: {
|
|
2101
|
-
/**
|
|
2102
|
-
* `schedulePickup` enables the `schedule pickup` button in the `<ViewShipment />` element,
|
|
2103
|
-
* allowing users to schedule pick-ups for their shipments.
|
|
2104
|
-
*/
|
|
2105
|
-
schedulePickup: true
|
|
2106
|
-
}
|
|
2107
|
-
}
|
|
2108
|
-
};
|
|
2109
|
-
/**
|
|
2110
|
-
* @internal
|
|
2111
|
-
*
|
|
2112
|
-
* # Feature Flags - featureFlagComponentNameLookup
|
|
2113
|
-
*/
|
|
2114
|
-
const featureFlagComponentNameLookup = componentName => {
|
|
2115
|
-
var _a;
|
|
2116
|
-
const lookup = {
|
|
2117
|
-
PurchaseLabel: "ConfigureSalesOrderShipment"
|
|
2118
|
-
};
|
|
2119
|
-
return (_a = lookup[componentName]) !== null && _a !== void 0 ? _a : "";
|
|
2120
|
-
};
|
|
2121
|
-
/**
|
|
2122
|
-
* @internal
|
|
2123
|
-
*
|
|
2124
|
-
* # Feature Flags - getFeatures
|
|
2125
|
-
*/
|
|
2126
|
-
const getFeatures = (...element) => {
|
|
2127
|
-
return element.map(feat => {
|
|
2128
|
-
var _a;
|
|
2129
|
-
return (_a = get$1(featureFlags, feat)) !== null && _a !== void 0 ? _a : {};
|
|
2130
|
-
}).reduce((acc, feat) => Object.assign(acc, feat), {});
|
|
2131
|
-
};
|
|
2132
|
-
/**
|
|
2133
|
-
* # Feature Flags - useFeatures
|
|
2134
|
-
*
|
|
2135
|
-
* - The `useFeatures` hook is used to retrieve the feature flags for a given component.
|
|
2136
|
-
*
|
|
2137
|
-
* @example
|
|
2138
|
-
* ```tsx
|
|
2139
|
-
* const features = useFeatures("Global");
|
|
2140
|
-
* ```
|
|
2141
|
-
*
|
|
2142
|
-
* <br />
|
|
2143
|
-
*
|
|
2144
|
-
* @see {@link featureFlags | All available `Feature Flags`}
|
|
2145
|
-
*/
|
|
2146
|
-
const useFeatures = (...element) => {
|
|
2147
|
-
return getFeatures(...element);
|
|
2148
|
-
};
|
|
2149
|
-
|
|
2150
|
-
/**
|
|
2151
|
-
* @internal
|
|
2152
|
-
*
|
|
2153
|
-
* # Form Logger
|
|
2154
|
-
*
|
|
2155
|
-
* @description
|
|
2156
|
-
* This will log the values that are submitted to the validation resolver
|
|
2157
|
-
* (only REGISTERED form fields) and the results of that validation.
|
|
2158
|
-
*
|
|
2159
|
-
* @usage Wrap the submission:
|
|
2160
|
-
* `<form onSubmit={formLogger.capture(handleSubmit)}>`
|
|
2161
|
-
*
|
|
2162
|
-
* @category Utilities
|
|
2163
|
-
*/
|
|
2164
|
-
const formLogger = {
|
|
2165
|
-
capture(handleSubmit) {
|
|
2166
|
-
return e => {
|
|
2167
|
-
// Prevent parent form submission in nested forms. This shouldn't be necessary, but React's
|
|
2168
|
-
// event bubbling doesn't handle the formId target properly when passed through a portal.
|
|
2169
|
-
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
2170
|
-
this.isSubmitting = true;
|
|
2171
|
-
void handleSubmit(e);
|
|
2172
|
-
this.isSubmitting = false;
|
|
2173
|
-
};
|
|
2174
|
-
},
|
|
2175
|
-
isSubmitting: false,
|
|
2176
|
-
log: (values, getValidationResult) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2177
|
-
logger.info({
|
|
2178
|
-
obj: values
|
|
2179
|
-
}, "Validating registered form fields:");
|
|
2180
|
-
const validationResult = yield getValidationResult();
|
|
2181
|
-
if (Object.keys(validationResult.errors).length) logger.error({
|
|
2182
|
-
obj: validationResult.errors
|
|
2183
|
-
}, "Validation failed. Errors object:");else logger.info({
|
|
2184
|
-
obj: validationResult.values
|
|
2185
|
-
}, "Validation passed. Final payload after defaults & transforms:");
|
|
2186
|
-
return validationResult;
|
|
2187
|
-
})
|
|
2188
|
-
};
|
|
1868
|
+
var fails$c = fails$q;
|
|
1869
|
+
var global$c = global$p;
|
|
2189
1870
|
|
|
2190
|
-
|
|
1871
|
+
// babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
|
|
1872
|
+
var $RegExp$1 = global$c.RegExp;
|
|
2191
1873
|
|
|
2192
|
-
var
|
|
2193
|
-
var
|
|
1874
|
+
var regexpUnsupportedDotAll = fails$c(function () {
|
|
1875
|
+
var re = $RegExp$1('.', 's');
|
|
1876
|
+
return !(re.dotAll && re.exec('\n') && re.flags === 's');
|
|
1877
|
+
});
|
|
2194
1878
|
|
|
2195
|
-
|
|
1879
|
+
var fails$b = fails$q;
|
|
1880
|
+
var global$b = global$p;
|
|
2196
1881
|
|
|
2197
|
-
|
|
1882
|
+
// babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
|
|
1883
|
+
var $RegExp = global$b.RegExp;
|
|
2198
1884
|
|
|
2199
|
-
var
|
|
2200
|
-
var isCallable$9 = isCallable$o;
|
|
2201
|
-
var classofRaw$1 = classofRaw$2;
|
|
2202
|
-
var wellKnownSymbol$c = wellKnownSymbol$k;
|
|
2203
|
-
|
|
2204
|
-
var TO_STRING_TAG = wellKnownSymbol$c('toStringTag');
|
|
2205
|
-
var $Object = Object;
|
|
2206
|
-
|
|
2207
|
-
// ES3 wrong here
|
|
2208
|
-
var CORRECT_ARGUMENTS = classofRaw$1(function () { return arguments; }()) == 'Arguments';
|
|
2209
|
-
|
|
2210
|
-
// fallback for IE11 Script Access Denied error
|
|
2211
|
-
var tryGet = function (it, key) {
|
|
2212
|
-
try {
|
|
2213
|
-
return it[key];
|
|
2214
|
-
} catch (error) { /* empty */ }
|
|
2215
|
-
};
|
|
2216
|
-
|
|
2217
|
-
// getting tag from ES6+ `Object.prototype.toString`
|
|
2218
|
-
var classof$6 = TO_STRING_TAG_SUPPORT ? classofRaw$1 : function (it) {
|
|
2219
|
-
var O, tag, result;
|
|
2220
|
-
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
2221
|
-
// @@toStringTag case
|
|
2222
|
-
: typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
|
|
2223
|
-
// builtinTag case
|
|
2224
|
-
: CORRECT_ARGUMENTS ? classofRaw$1(O)
|
|
2225
|
-
// ES3 arguments fallback
|
|
2226
|
-
: (result = classofRaw$1(O)) == 'Object' && isCallable$9(O.callee) ? 'Arguments' : result;
|
|
2227
|
-
};
|
|
2228
|
-
|
|
2229
|
-
var classof$5 = classof$6;
|
|
2230
|
-
|
|
2231
|
-
var $String$1 = String;
|
|
2232
|
-
|
|
2233
|
-
var toString$c = function (argument) {
|
|
2234
|
-
if (classof$5(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
|
|
2235
|
-
return $String$1(argument);
|
|
2236
|
-
};
|
|
2237
|
-
|
|
2238
|
-
// a string of all valid unicode whitespaces
|
|
2239
|
-
var whitespaces$4 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
|
|
2240
|
-
'\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
|
2241
|
-
|
|
2242
|
-
var uncurryThis$h = functionUncurryThis;
|
|
2243
|
-
var requireObjectCoercible$6 = requireObjectCoercible$9;
|
|
2244
|
-
var toString$b = toString$c;
|
|
2245
|
-
var whitespaces$3 = whitespaces$4;
|
|
2246
|
-
|
|
2247
|
-
var replace$3 = uncurryThis$h(''.replace);
|
|
2248
|
-
var whitespace = '[' + whitespaces$3 + ']';
|
|
2249
|
-
var ltrim = RegExp('^' + whitespace + whitespace + '*');
|
|
2250
|
-
var rtrim = RegExp(whitespace + whitespace + '*$');
|
|
2251
|
-
|
|
2252
|
-
// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
|
|
2253
|
-
var createMethod$1 = function (TYPE) {
|
|
2254
|
-
return function ($this) {
|
|
2255
|
-
var string = toString$b(requireObjectCoercible$6($this));
|
|
2256
|
-
if (TYPE & 1) string = replace$3(string, ltrim, '');
|
|
2257
|
-
if (TYPE & 2) string = replace$3(string, rtrim, '');
|
|
2258
|
-
return string;
|
|
2259
|
-
};
|
|
2260
|
-
};
|
|
2261
|
-
|
|
2262
|
-
var stringTrim = {
|
|
2263
|
-
// `String.prototype.{ trimLeft, trimStart }` methods
|
|
2264
|
-
// https://tc39.es/ecma262/#sec-string.prototype.trimstart
|
|
2265
|
-
start: createMethod$1(1),
|
|
2266
|
-
// `String.prototype.{ trimRight, trimEnd }` methods
|
|
2267
|
-
// https://tc39.es/ecma262/#sec-string.prototype.trimend
|
|
2268
|
-
end: createMethod$1(2),
|
|
2269
|
-
// `String.prototype.trim` method
|
|
2270
|
-
// https://tc39.es/ecma262/#sec-string.prototype.trim
|
|
2271
|
-
trim: createMethod$1(3)
|
|
2272
|
-
};
|
|
2273
|
-
|
|
2274
|
-
var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
|
|
2275
|
-
var fails$d = fails$q;
|
|
2276
|
-
var whitespaces$2 = whitespaces$4;
|
|
2277
|
-
|
|
2278
|
-
var non = '\u200B\u0085\u180E';
|
|
2279
|
-
|
|
2280
|
-
// check that a method works with the correct list
|
|
2281
|
-
// of whitespaces and has a correct name
|
|
2282
|
-
var stringTrimForced = function (METHOD_NAME) {
|
|
2283
|
-
return fails$d(function () {
|
|
2284
|
-
return !!whitespaces$2[METHOD_NAME]()
|
|
2285
|
-
|| non[METHOD_NAME]() !== non
|
|
2286
|
-
|| (PROPER_FUNCTION_NAME$1 && whitespaces$2[METHOD_NAME].name !== METHOD_NAME);
|
|
2287
|
-
});
|
|
2288
|
-
};
|
|
2289
|
-
|
|
2290
|
-
var $$h = _export;
|
|
2291
|
-
var $trim = stringTrim.trim;
|
|
2292
|
-
var forcedStringTrimMethod = stringTrimForced;
|
|
2293
|
-
|
|
2294
|
-
// `String.prototype.trim` method
|
|
2295
|
-
// https://tc39.es/ecma262/#sec-string.prototype.trim
|
|
2296
|
-
$$h({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
|
|
2297
|
-
trim: function trim() {
|
|
2298
|
-
return $trim(this);
|
|
2299
|
-
}
|
|
2300
|
-
});
|
|
2301
|
-
|
|
2302
|
-
var anObject$9 = anObject$f;
|
|
2303
|
-
|
|
2304
|
-
// `RegExp.prototype.flags` getter implementation
|
|
2305
|
-
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
|
|
2306
|
-
var regexpFlags$1 = function () {
|
|
2307
|
-
var that = anObject$9(this);
|
|
2308
|
-
var result = '';
|
|
2309
|
-
if (that.hasIndices) result += 'd';
|
|
2310
|
-
if (that.global) result += 'g';
|
|
2311
|
-
if (that.ignoreCase) result += 'i';
|
|
2312
|
-
if (that.multiline) result += 'm';
|
|
2313
|
-
if (that.dotAll) result += 's';
|
|
2314
|
-
if (that.unicode) result += 'u';
|
|
2315
|
-
if (that.unicodeSets) result += 'v';
|
|
2316
|
-
if (that.sticky) result += 'y';
|
|
2317
|
-
return result;
|
|
2318
|
-
};
|
|
2319
|
-
|
|
2320
|
-
var fails$c = fails$q;
|
|
2321
|
-
var global$d = global$p;
|
|
2322
|
-
|
|
2323
|
-
// babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
|
|
2324
|
-
var $RegExp$2 = global$d.RegExp;
|
|
2325
|
-
|
|
2326
|
-
var UNSUPPORTED_Y$1 = fails$c(function () {
|
|
2327
|
-
var re = $RegExp$2('a', 'y');
|
|
2328
|
-
re.lastIndex = 2;
|
|
2329
|
-
return re.exec('abcd') != null;
|
|
2330
|
-
});
|
|
2331
|
-
|
|
2332
|
-
// UC Browser bug
|
|
2333
|
-
// https://github.com/zloirock/core-js/issues/1008
|
|
2334
|
-
var MISSED_STICKY = UNSUPPORTED_Y$1 || fails$c(function () {
|
|
2335
|
-
return !$RegExp$2('a', 'y').sticky;
|
|
2336
|
-
});
|
|
2337
|
-
|
|
2338
|
-
var BROKEN_CARET = UNSUPPORTED_Y$1 || fails$c(function () {
|
|
2339
|
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=773687
|
|
2340
|
-
var re = $RegExp$2('^r', 'gy');
|
|
2341
|
-
re.lastIndex = 2;
|
|
2342
|
-
return re.exec('str') != null;
|
|
2343
|
-
});
|
|
2344
|
-
|
|
2345
|
-
var regexpStickyHelpers = {
|
|
2346
|
-
BROKEN_CARET: BROKEN_CARET,
|
|
2347
|
-
MISSED_STICKY: MISSED_STICKY,
|
|
2348
|
-
UNSUPPORTED_Y: UNSUPPORTED_Y$1
|
|
2349
|
-
};
|
|
2350
|
-
|
|
2351
|
-
var fails$b = fails$q;
|
|
2352
|
-
var global$c = global$p;
|
|
2353
|
-
|
|
2354
|
-
// babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
|
|
2355
|
-
var $RegExp$1 = global$c.RegExp;
|
|
2356
|
-
|
|
2357
|
-
var regexpUnsupportedDotAll = fails$b(function () {
|
|
2358
|
-
var re = $RegExp$1('.', 's');
|
|
2359
|
-
return !(re.dotAll && re.exec('\n') && re.flags === 's');
|
|
2360
|
-
});
|
|
2361
|
-
|
|
2362
|
-
var fails$a = fails$q;
|
|
2363
|
-
var global$b = global$p;
|
|
2364
|
-
|
|
2365
|
-
// babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
|
|
2366
|
-
var $RegExp = global$b.RegExp;
|
|
2367
|
-
|
|
2368
|
-
var regexpUnsupportedNcg = fails$a(function () {
|
|
1885
|
+
var regexpUnsupportedNcg = fails$b(function () {
|
|
2369
1886
|
var re = $RegExp('(?<a>b)', 'g');
|
|
2370
1887
|
return re.exec('b').groups.a !== 'b' ||
|
|
2371
1888
|
'b'.replace(re, '$<a>c') !== 'bc';
|
|
@@ -2374,8 +1891,8 @@ var regexpUnsupportedNcg = fails$a(function () {
|
|
|
2374
1891
|
/* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
|
|
2375
1892
|
/* eslint-disable regexp/no-useless-quantifier -- testing */
|
|
2376
1893
|
var call$d = functionCall;
|
|
2377
|
-
var uncurryThis$
|
|
2378
|
-
var toString$
|
|
1894
|
+
var uncurryThis$h = functionUncurryThis;
|
|
1895
|
+
var toString$b = toString$c;
|
|
2379
1896
|
var regexpFlags = regexpFlags$1;
|
|
2380
1897
|
var stickyHelpers = regexpStickyHelpers;
|
|
2381
1898
|
var shared = shared$4.exports;
|
|
@@ -2387,10 +1904,10 @@ var UNSUPPORTED_NCG = regexpUnsupportedNcg;
|
|
|
2387
1904
|
var nativeReplace = shared('native-string-replace', String.prototype.replace);
|
|
2388
1905
|
var nativeExec = RegExp.prototype.exec;
|
|
2389
1906
|
var patchedExec = nativeExec;
|
|
2390
|
-
var charAt$4 = uncurryThis$
|
|
2391
|
-
var indexOf$1 = uncurryThis$
|
|
2392
|
-
var replace$
|
|
2393
|
-
var stringSlice$6 = uncurryThis$
|
|
1907
|
+
var charAt$4 = uncurryThis$h(''.charAt);
|
|
1908
|
+
var indexOf$1 = uncurryThis$h(''.indexOf);
|
|
1909
|
+
var replace$3 = uncurryThis$h(''.replace);
|
|
1910
|
+
var stringSlice$6 = uncurryThis$h(''.slice);
|
|
2394
1911
|
|
|
2395
1912
|
var UPDATES_LAST_INDEX_WRONG = (function () {
|
|
2396
1913
|
var re1 = /a/;
|
|
@@ -2411,7 +1928,7 @@ if (PATCH) {
|
|
|
2411
1928
|
patchedExec = function exec(string) {
|
|
2412
1929
|
var re = this;
|
|
2413
1930
|
var state = getInternalState(re);
|
|
2414
|
-
var str = toString$
|
|
1931
|
+
var str = toString$b(string);
|
|
2415
1932
|
var raw = state.raw;
|
|
2416
1933
|
var result, reCopy, lastIndex, match, i, object, group;
|
|
2417
1934
|
|
|
@@ -2430,7 +1947,7 @@ if (PATCH) {
|
|
|
2430
1947
|
var strCopy = str;
|
|
2431
1948
|
|
|
2432
1949
|
if (sticky) {
|
|
2433
|
-
flags = replace$
|
|
1950
|
+
flags = replace$3(flags, 'y', '');
|
|
2434
1951
|
if (indexOf$1(flags, 'g') === -1) {
|
|
2435
1952
|
flags += 'g';
|
|
2436
1953
|
}
|
|
@@ -2488,12 +2005,12 @@ if (PATCH) {
|
|
|
2488
2005
|
|
|
2489
2006
|
var regexpExec$2 = patchedExec;
|
|
2490
2007
|
|
|
2491
|
-
var $$
|
|
2008
|
+
var $$h = _export;
|
|
2492
2009
|
var exec$2 = regexpExec$2;
|
|
2493
2010
|
|
|
2494
2011
|
// `RegExp.prototype.exec` method
|
|
2495
2012
|
// https://tc39.es/ecma262/#sec-regexp.prototype.exec
|
|
2496
|
-
$$
|
|
2013
|
+
$$h({ target: 'RegExp', proto: true, forced: /./.exec !== exec$2 }, {
|
|
2497
2014
|
exec: exec$2
|
|
2498
2015
|
});
|
|
2499
2016
|
|
|
@@ -2509,21 +2026,21 @@ var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$
|
|
|
2509
2026
|
});
|
|
2510
2027
|
|
|
2511
2028
|
var classofRaw = classofRaw$2;
|
|
2512
|
-
var uncurryThis$
|
|
2029
|
+
var uncurryThis$g = functionUncurryThis;
|
|
2513
2030
|
|
|
2514
2031
|
var functionUncurryThisClause = function (fn) {
|
|
2515
2032
|
// Nashorn bug:
|
|
2516
2033
|
// https://github.com/zloirock/core-js/issues/1128
|
|
2517
2034
|
// https://github.com/zloirock/core-js/issues/1130
|
|
2518
|
-
if (classofRaw(fn) === 'Function') return uncurryThis$
|
|
2035
|
+
if (classofRaw(fn) === 'Function') return uncurryThis$g(fn);
|
|
2519
2036
|
};
|
|
2520
2037
|
|
|
2521
2038
|
// TODO: Remove from `core-js@4` since it's moved to entry points
|
|
2522
2039
|
|
|
2523
|
-
var uncurryThis$
|
|
2040
|
+
var uncurryThis$f = functionUncurryThisClause;
|
|
2524
2041
|
var defineBuiltIn$3 = defineBuiltIn$7;
|
|
2525
2042
|
var regexpExec$1 = regexpExec$2;
|
|
2526
|
-
var fails$
|
|
2043
|
+
var fails$a = fails$q;
|
|
2527
2044
|
var wellKnownSymbol$b = wellKnownSymbol$k;
|
|
2528
2045
|
var createNonEnumerableProperty = createNonEnumerableProperty$5;
|
|
2529
2046
|
|
|
@@ -2533,14 +2050,14 @@ var RegExpPrototype$2 = RegExp.prototype;
|
|
|
2533
2050
|
var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
|
|
2534
2051
|
var SYMBOL = wellKnownSymbol$b(KEY);
|
|
2535
2052
|
|
|
2536
|
-
var DELEGATES_TO_SYMBOL = !fails$
|
|
2053
|
+
var DELEGATES_TO_SYMBOL = !fails$a(function () {
|
|
2537
2054
|
// String methods call symbol-named RegEp methods
|
|
2538
2055
|
var O = {};
|
|
2539
2056
|
O[SYMBOL] = function () { return 7; };
|
|
2540
2057
|
return ''[KEY](O) != 7;
|
|
2541
2058
|
});
|
|
2542
2059
|
|
|
2543
|
-
var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails$
|
|
2060
|
+
var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails$a(function () {
|
|
2544
2061
|
// Symbol-named RegExp methods call .exec
|
|
2545
2062
|
var execCalled = false;
|
|
2546
2063
|
var re = /a/;
|
|
@@ -2557,288 +2074,933 @@ var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
|
|
|
2557
2074
|
re.flags = '';
|
|
2558
2075
|
re[SYMBOL] = /./[SYMBOL];
|
|
2559
2076
|
}
|
|
2560
|
-
|
|
2561
|
-
re.exec = function () { execCalled = true; return null; };
|
|
2562
|
-
|
|
2563
|
-
re[SYMBOL]('');
|
|
2564
|
-
return !execCalled;
|
|
2565
|
-
});
|
|
2566
|
-
|
|
2567
|
-
if (
|
|
2568
|
-
!DELEGATES_TO_SYMBOL ||
|
|
2569
|
-
!DELEGATES_TO_EXEC ||
|
|
2570
|
-
FORCED
|
|
2571
|
-
) {
|
|
2572
|
-
var uncurriedNativeRegExpMethod = uncurryThis$
|
|
2573
|
-
var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
|
2574
|
-
var uncurriedNativeMethod = uncurryThis$
|
|
2575
|
-
var $exec = regexp.exec;
|
|
2576
|
-
if ($exec === regexpExec$1 || $exec === RegExpPrototype$2.exec) {
|
|
2577
|
-
if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
|
|
2578
|
-
// The native String method already delegates to @@method (this
|
|
2579
|
-
// polyfilled function), leasing to infinite recursion.
|
|
2580
|
-
// We avoid it by directly calling the native @@method method.
|
|
2581
|
-
return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
|
|
2582
|
-
}
|
|
2583
|
-
return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
|
|
2584
|
-
}
|
|
2585
|
-
return { done: false };
|
|
2586
|
-
});
|
|
2587
|
-
|
|
2588
|
-
defineBuiltIn$3(String.prototype, KEY, methods[0]);
|
|
2589
|
-
defineBuiltIn$3(RegExpPrototype$2, SYMBOL, methods[1]);
|
|
2077
|
+
|
|
2078
|
+
re.exec = function () { execCalled = true; return null; };
|
|
2079
|
+
|
|
2080
|
+
re[SYMBOL]('');
|
|
2081
|
+
return !execCalled;
|
|
2082
|
+
});
|
|
2083
|
+
|
|
2084
|
+
if (
|
|
2085
|
+
!DELEGATES_TO_SYMBOL ||
|
|
2086
|
+
!DELEGATES_TO_EXEC ||
|
|
2087
|
+
FORCED
|
|
2088
|
+
) {
|
|
2089
|
+
var uncurriedNativeRegExpMethod = uncurryThis$f(/./[SYMBOL]);
|
|
2090
|
+
var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
|
2091
|
+
var uncurriedNativeMethod = uncurryThis$f(nativeMethod);
|
|
2092
|
+
var $exec = regexp.exec;
|
|
2093
|
+
if ($exec === regexpExec$1 || $exec === RegExpPrototype$2.exec) {
|
|
2094
|
+
if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
|
|
2095
|
+
// The native String method already delegates to @@method (this
|
|
2096
|
+
// polyfilled function), leasing to infinite recursion.
|
|
2097
|
+
// We avoid it by directly calling the native @@method method.
|
|
2098
|
+
return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
|
|
2099
|
+
}
|
|
2100
|
+
return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
|
|
2101
|
+
}
|
|
2102
|
+
return { done: false };
|
|
2103
|
+
});
|
|
2104
|
+
|
|
2105
|
+
defineBuiltIn$3(String.prototype, KEY, methods[0]);
|
|
2106
|
+
defineBuiltIn$3(RegExpPrototype$2, SYMBOL, methods[1]);
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
if (SHAM) createNonEnumerableProperty(RegExpPrototype$2[SYMBOL], 'sham', true);
|
|
2110
|
+
};
|
|
2111
|
+
|
|
2112
|
+
var uncurryThis$e = functionUncurryThis;
|
|
2113
|
+
var toIntegerOrInfinity$3 = toIntegerOrInfinity$6;
|
|
2114
|
+
var toString$a = toString$c;
|
|
2115
|
+
var requireObjectCoercible$6 = requireObjectCoercible$9;
|
|
2116
|
+
|
|
2117
|
+
var charAt$3 = uncurryThis$e(''.charAt);
|
|
2118
|
+
var charCodeAt = uncurryThis$e(''.charCodeAt);
|
|
2119
|
+
var stringSlice$5 = uncurryThis$e(''.slice);
|
|
2120
|
+
|
|
2121
|
+
var createMethod$1 = function (CONVERT_TO_STRING) {
|
|
2122
|
+
return function ($this, pos) {
|
|
2123
|
+
var S = toString$a(requireObjectCoercible$6($this));
|
|
2124
|
+
var position = toIntegerOrInfinity$3(pos);
|
|
2125
|
+
var size = S.length;
|
|
2126
|
+
var first, second;
|
|
2127
|
+
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
|
2128
|
+
first = charCodeAt(S, position);
|
|
2129
|
+
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
|
2130
|
+
|| (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
|
|
2131
|
+
? CONVERT_TO_STRING
|
|
2132
|
+
? charAt$3(S, position)
|
|
2133
|
+
: first
|
|
2134
|
+
: CONVERT_TO_STRING
|
|
2135
|
+
? stringSlice$5(S, position, position + 2)
|
|
2136
|
+
: (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
|
2137
|
+
};
|
|
2138
|
+
};
|
|
2139
|
+
|
|
2140
|
+
var stringMultibyte = {
|
|
2141
|
+
// `String.prototype.codePointAt` method
|
|
2142
|
+
// https://tc39.es/ecma262/#sec-string.prototype.codepointat
|
|
2143
|
+
codeAt: createMethod$1(false),
|
|
2144
|
+
// `String.prototype.at` method
|
|
2145
|
+
// https://github.com/mathiasbynens/String.prototype.at
|
|
2146
|
+
charAt: createMethod$1(true)
|
|
2147
|
+
};
|
|
2148
|
+
|
|
2149
|
+
var charAt$2 = stringMultibyte.charAt;
|
|
2150
|
+
|
|
2151
|
+
// `AdvanceStringIndex` abstract operation
|
|
2152
|
+
// https://tc39.es/ecma262/#sec-advancestringindex
|
|
2153
|
+
var advanceStringIndex$2 = function (S, index, unicode) {
|
|
2154
|
+
return index + (unicode ? charAt$2(S, index).length : 1);
|
|
2155
|
+
};
|
|
2156
|
+
|
|
2157
|
+
var uncurryThis$d = functionUncurryThis;
|
|
2158
|
+
var toObject$2 = toObject$7;
|
|
2159
|
+
|
|
2160
|
+
var floor$2 = Math.floor;
|
|
2161
|
+
var charAt$1 = uncurryThis$d(''.charAt);
|
|
2162
|
+
var replace$2 = uncurryThis$d(''.replace);
|
|
2163
|
+
var stringSlice$4 = uncurryThis$d(''.slice);
|
|
2164
|
+
var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
|
|
2165
|
+
var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
|
|
2166
|
+
|
|
2167
|
+
// `GetSubstitution` abstract operation
|
|
2168
|
+
// https://tc39.es/ecma262/#sec-getsubstitution
|
|
2169
|
+
var getSubstitution$2 = function (matched, str, position, captures, namedCaptures, replacement) {
|
|
2170
|
+
var tailPos = position + matched.length;
|
|
2171
|
+
var m = captures.length;
|
|
2172
|
+
var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
|
|
2173
|
+
if (namedCaptures !== undefined) {
|
|
2174
|
+
namedCaptures = toObject$2(namedCaptures);
|
|
2175
|
+
symbols = SUBSTITUTION_SYMBOLS;
|
|
2176
|
+
}
|
|
2177
|
+
return replace$2(replacement, symbols, function (match, ch) {
|
|
2178
|
+
var capture;
|
|
2179
|
+
switch (charAt$1(ch, 0)) {
|
|
2180
|
+
case '$': return '$';
|
|
2181
|
+
case '&': return matched;
|
|
2182
|
+
case '`': return stringSlice$4(str, 0, position);
|
|
2183
|
+
case "'": return stringSlice$4(str, tailPos);
|
|
2184
|
+
case '<':
|
|
2185
|
+
capture = namedCaptures[stringSlice$4(ch, 1, -1)];
|
|
2186
|
+
break;
|
|
2187
|
+
default: // \d\d?
|
|
2188
|
+
var n = +ch;
|
|
2189
|
+
if (n === 0) return match;
|
|
2190
|
+
if (n > m) {
|
|
2191
|
+
var f = floor$2(n / 10);
|
|
2192
|
+
if (f === 0) return match;
|
|
2193
|
+
if (f <= m) return captures[f - 1] === undefined ? charAt$1(ch, 1) : captures[f - 1] + charAt$1(ch, 1);
|
|
2194
|
+
return match;
|
|
2195
|
+
}
|
|
2196
|
+
capture = captures[n - 1];
|
|
2197
|
+
}
|
|
2198
|
+
return capture === undefined ? '' : capture;
|
|
2199
|
+
});
|
|
2200
|
+
};
|
|
2201
|
+
|
|
2202
|
+
var call$b = functionCall;
|
|
2203
|
+
var anObject$8 = anObject$f;
|
|
2204
|
+
var isCallable$8 = isCallable$o;
|
|
2205
|
+
var classof$4 = classofRaw$2;
|
|
2206
|
+
var regexpExec = regexpExec$2;
|
|
2207
|
+
|
|
2208
|
+
var $TypeError$a = TypeError;
|
|
2209
|
+
|
|
2210
|
+
// `RegExpExec` abstract operation
|
|
2211
|
+
// https://tc39.es/ecma262/#sec-regexpexec
|
|
2212
|
+
var regexpExecAbstract = function (R, S) {
|
|
2213
|
+
var exec = R.exec;
|
|
2214
|
+
if (isCallable$8(exec)) {
|
|
2215
|
+
var result = call$b(exec, R, S);
|
|
2216
|
+
if (result !== null) anObject$8(result);
|
|
2217
|
+
return result;
|
|
2218
|
+
}
|
|
2219
|
+
if (classof$4(R) === 'RegExp') return call$b(regexpExec, R, S);
|
|
2220
|
+
throw $TypeError$a('RegExp#exec called on incompatible receiver');
|
|
2221
|
+
};
|
|
2222
|
+
|
|
2223
|
+
var apply$1 = functionApply;
|
|
2224
|
+
var call$a = functionCall;
|
|
2225
|
+
var uncurryThis$c = functionUncurryThis;
|
|
2226
|
+
var fixRegExpWellKnownSymbolLogic$1 = fixRegexpWellKnownSymbolLogic;
|
|
2227
|
+
var fails$9 = fails$q;
|
|
2228
|
+
var anObject$7 = anObject$f;
|
|
2229
|
+
var isCallable$7 = isCallable$o;
|
|
2230
|
+
var isNullOrUndefined$4 = isNullOrUndefined$7;
|
|
2231
|
+
var toIntegerOrInfinity$2 = toIntegerOrInfinity$6;
|
|
2232
|
+
var toLength$1 = toLength$3;
|
|
2233
|
+
var toString$9 = toString$c;
|
|
2234
|
+
var requireObjectCoercible$5 = requireObjectCoercible$9;
|
|
2235
|
+
var advanceStringIndex$1 = advanceStringIndex$2;
|
|
2236
|
+
var getMethod$4 = getMethod$6;
|
|
2237
|
+
var getSubstitution$1 = getSubstitution$2;
|
|
2238
|
+
var regExpExec$1 = regexpExecAbstract;
|
|
2239
|
+
var wellKnownSymbol$a = wellKnownSymbol$k;
|
|
2240
|
+
|
|
2241
|
+
var REPLACE$1 = wellKnownSymbol$a('replace');
|
|
2242
|
+
var max$2 = Math.max;
|
|
2243
|
+
var min = Math.min;
|
|
2244
|
+
var concat = uncurryThis$c([].concat);
|
|
2245
|
+
var push$1 = uncurryThis$c([].push);
|
|
2246
|
+
var stringIndexOf$2 = uncurryThis$c(''.indexOf);
|
|
2247
|
+
var stringSlice$3 = uncurryThis$c(''.slice);
|
|
2248
|
+
|
|
2249
|
+
var maybeToString = function (it) {
|
|
2250
|
+
return it === undefined ? it : String(it);
|
|
2251
|
+
};
|
|
2252
|
+
|
|
2253
|
+
// IE <= 11 replaces $0 with the whole match, as if it was $&
|
|
2254
|
+
// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
|
|
2255
|
+
var REPLACE_KEEPS_$0 = (function () {
|
|
2256
|
+
// eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
|
|
2257
|
+
return 'a'.replace(/./, '$0') === '$0';
|
|
2258
|
+
})();
|
|
2259
|
+
|
|
2260
|
+
// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
|
|
2261
|
+
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
|
|
2262
|
+
if (/./[REPLACE$1]) {
|
|
2263
|
+
return /./[REPLACE$1]('a', '$0') === '';
|
|
2264
|
+
}
|
|
2265
|
+
return false;
|
|
2266
|
+
})();
|
|
2267
|
+
|
|
2268
|
+
var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$9(function () {
|
|
2269
|
+
var re = /./;
|
|
2270
|
+
re.exec = function () {
|
|
2271
|
+
var result = [];
|
|
2272
|
+
result.groups = { a: '7' };
|
|
2273
|
+
return result;
|
|
2274
|
+
};
|
|
2275
|
+
// eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
|
|
2276
|
+
return ''.replace(re, '$<a>') !== '7';
|
|
2277
|
+
});
|
|
2278
|
+
|
|
2279
|
+
// @@replace logic
|
|
2280
|
+
fixRegExpWellKnownSymbolLogic$1('replace', function (_, nativeReplace, maybeCallNative) {
|
|
2281
|
+
var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
|
|
2282
|
+
|
|
2283
|
+
return [
|
|
2284
|
+
// `String.prototype.replace` method
|
|
2285
|
+
// https://tc39.es/ecma262/#sec-string.prototype.replace
|
|
2286
|
+
function replace(searchValue, replaceValue) {
|
|
2287
|
+
var O = requireObjectCoercible$5(this);
|
|
2288
|
+
var replacer = isNullOrUndefined$4(searchValue) ? undefined : getMethod$4(searchValue, REPLACE$1);
|
|
2289
|
+
return replacer
|
|
2290
|
+
? call$a(replacer, searchValue, O, replaceValue)
|
|
2291
|
+
: call$a(nativeReplace, toString$9(O), searchValue, replaceValue);
|
|
2292
|
+
},
|
|
2293
|
+
// `RegExp.prototype[@@replace]` method
|
|
2294
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
|
|
2295
|
+
function (string, replaceValue) {
|
|
2296
|
+
var rx = anObject$7(this);
|
|
2297
|
+
var S = toString$9(string);
|
|
2298
|
+
|
|
2299
|
+
if (
|
|
2300
|
+
typeof replaceValue == 'string' &&
|
|
2301
|
+
stringIndexOf$2(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
|
|
2302
|
+
stringIndexOf$2(replaceValue, '$<') === -1
|
|
2303
|
+
) {
|
|
2304
|
+
var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
|
|
2305
|
+
if (res.done) return res.value;
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2308
|
+
var functionalReplace = isCallable$7(replaceValue);
|
|
2309
|
+
if (!functionalReplace) replaceValue = toString$9(replaceValue);
|
|
2310
|
+
|
|
2311
|
+
var global = rx.global;
|
|
2312
|
+
if (global) {
|
|
2313
|
+
var fullUnicode = rx.unicode;
|
|
2314
|
+
rx.lastIndex = 0;
|
|
2315
|
+
}
|
|
2316
|
+
var results = [];
|
|
2317
|
+
while (true) {
|
|
2318
|
+
var result = regExpExec$1(rx, S);
|
|
2319
|
+
if (result === null) break;
|
|
2320
|
+
|
|
2321
|
+
push$1(results, result);
|
|
2322
|
+
if (!global) break;
|
|
2323
|
+
|
|
2324
|
+
var matchStr = toString$9(result[0]);
|
|
2325
|
+
if (matchStr === '') rx.lastIndex = advanceStringIndex$1(S, toLength$1(rx.lastIndex), fullUnicode);
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
var accumulatedResult = '';
|
|
2329
|
+
var nextSourcePosition = 0;
|
|
2330
|
+
for (var i = 0; i < results.length; i++) {
|
|
2331
|
+
result = results[i];
|
|
2332
|
+
|
|
2333
|
+
var matched = toString$9(result[0]);
|
|
2334
|
+
var position = max$2(min(toIntegerOrInfinity$2(result.index), S.length), 0);
|
|
2335
|
+
var captures = [];
|
|
2336
|
+
// NOTE: This is equivalent to
|
|
2337
|
+
// captures = result.slice(1).map(maybeToString)
|
|
2338
|
+
// but for some reason `nativeSlice.call(result, 1, result.length)` (called in
|
|
2339
|
+
// the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
|
|
2340
|
+
// causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
|
|
2341
|
+
for (var j = 1; j < result.length; j++) push$1(captures, maybeToString(result[j]));
|
|
2342
|
+
var namedCaptures = result.groups;
|
|
2343
|
+
if (functionalReplace) {
|
|
2344
|
+
var replacerArgs = concat([matched], captures, position, S);
|
|
2345
|
+
if (namedCaptures !== undefined) push$1(replacerArgs, namedCaptures);
|
|
2346
|
+
var replacement = toString$9(apply$1(replaceValue, undefined, replacerArgs));
|
|
2347
|
+
} else {
|
|
2348
|
+
replacement = getSubstitution$1(matched, S, position, captures, namedCaptures, replaceValue);
|
|
2349
|
+
}
|
|
2350
|
+
if (position >= nextSourcePosition) {
|
|
2351
|
+
accumulatedResult += stringSlice$3(S, nextSourcePosition, position) + replacement;
|
|
2352
|
+
nextSourcePosition = position + matched.length;
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
return accumulatedResult + stringSlice$3(S, nextSourcePosition);
|
|
2356
|
+
}
|
|
2357
|
+
];
|
|
2358
|
+
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
|
|
2359
|
+
|
|
2360
|
+
var isObject$3 = isObject$a;
|
|
2361
|
+
var classof$3 = classofRaw$2;
|
|
2362
|
+
var wellKnownSymbol$9 = wellKnownSymbol$k;
|
|
2363
|
+
|
|
2364
|
+
var MATCH$1 = wellKnownSymbol$9('match');
|
|
2365
|
+
|
|
2366
|
+
// `IsRegExp` abstract operation
|
|
2367
|
+
// https://tc39.es/ecma262/#sec-isregexp
|
|
2368
|
+
var isRegexp = function (it) {
|
|
2369
|
+
var isRegExp;
|
|
2370
|
+
return isObject$3(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$3(it) == 'RegExp');
|
|
2371
|
+
};
|
|
2372
|
+
|
|
2373
|
+
var call$9 = functionCall;
|
|
2374
|
+
var hasOwn$2 = hasOwnProperty_1;
|
|
2375
|
+
var isPrototypeOf$3 = objectIsPrototypeOf;
|
|
2376
|
+
var regExpFlags = regexpFlags$1;
|
|
2377
|
+
|
|
2378
|
+
var RegExpPrototype$1 = RegExp.prototype;
|
|
2379
|
+
|
|
2380
|
+
var regexpGetFlags = function (R) {
|
|
2381
|
+
var flags = R.flags;
|
|
2382
|
+
return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn$2(R, 'flags') && isPrototypeOf$3(RegExpPrototype$1, R)
|
|
2383
|
+
? call$9(regExpFlags, R) : flags;
|
|
2384
|
+
};
|
|
2385
|
+
|
|
2386
|
+
var $$g = _export;
|
|
2387
|
+
var call$8 = functionCall;
|
|
2388
|
+
var uncurryThis$b = functionUncurryThis;
|
|
2389
|
+
var requireObjectCoercible$4 = requireObjectCoercible$9;
|
|
2390
|
+
var isCallable$6 = isCallable$o;
|
|
2391
|
+
var isNullOrUndefined$3 = isNullOrUndefined$7;
|
|
2392
|
+
var isRegExp$1 = isRegexp;
|
|
2393
|
+
var toString$8 = toString$c;
|
|
2394
|
+
var getMethod$3 = getMethod$6;
|
|
2395
|
+
var getRegExpFlags$1 = regexpGetFlags;
|
|
2396
|
+
var getSubstitution = getSubstitution$2;
|
|
2397
|
+
var wellKnownSymbol$8 = wellKnownSymbol$k;
|
|
2398
|
+
|
|
2399
|
+
var REPLACE = wellKnownSymbol$8('replace');
|
|
2400
|
+
var $TypeError$9 = TypeError;
|
|
2401
|
+
var indexOf = uncurryThis$b(''.indexOf);
|
|
2402
|
+
uncurryThis$b(''.replace);
|
|
2403
|
+
var stringSlice$2 = uncurryThis$b(''.slice);
|
|
2404
|
+
var max$1 = Math.max;
|
|
2405
|
+
|
|
2406
|
+
var stringIndexOf$1 = function (string, searchValue, fromIndex) {
|
|
2407
|
+
if (fromIndex > string.length) return -1;
|
|
2408
|
+
if (searchValue === '') return fromIndex;
|
|
2409
|
+
return indexOf(string, searchValue, fromIndex);
|
|
2410
|
+
};
|
|
2411
|
+
|
|
2412
|
+
// `String.prototype.replaceAll` method
|
|
2413
|
+
// https://tc39.es/ecma262/#sec-string.prototype.replaceall
|
|
2414
|
+
$$g({ target: 'String', proto: true }, {
|
|
2415
|
+
replaceAll: function replaceAll(searchValue, replaceValue) {
|
|
2416
|
+
var O = requireObjectCoercible$4(this);
|
|
2417
|
+
var IS_REG_EXP, flags, replacer, string, searchString, functionalReplace, searchLength, advanceBy, replacement;
|
|
2418
|
+
var position = 0;
|
|
2419
|
+
var endOfLastMatch = 0;
|
|
2420
|
+
var result = '';
|
|
2421
|
+
if (!isNullOrUndefined$3(searchValue)) {
|
|
2422
|
+
IS_REG_EXP = isRegExp$1(searchValue);
|
|
2423
|
+
if (IS_REG_EXP) {
|
|
2424
|
+
flags = toString$8(requireObjectCoercible$4(getRegExpFlags$1(searchValue)));
|
|
2425
|
+
if (!~indexOf(flags, 'g')) throw $TypeError$9('`.replaceAll` does not allow non-global regexes');
|
|
2426
|
+
}
|
|
2427
|
+
replacer = getMethod$3(searchValue, REPLACE);
|
|
2428
|
+
if (replacer) {
|
|
2429
|
+
return call$8(replacer, searchValue, O, replaceValue);
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
string = toString$8(O);
|
|
2433
|
+
searchString = toString$8(searchValue);
|
|
2434
|
+
functionalReplace = isCallable$6(replaceValue);
|
|
2435
|
+
if (!functionalReplace) replaceValue = toString$8(replaceValue);
|
|
2436
|
+
searchLength = searchString.length;
|
|
2437
|
+
advanceBy = max$1(1, searchLength);
|
|
2438
|
+
position = stringIndexOf$1(string, searchString, 0);
|
|
2439
|
+
while (position !== -1) {
|
|
2440
|
+
replacement = functionalReplace
|
|
2441
|
+
? toString$8(replaceValue(searchString, position, string))
|
|
2442
|
+
: getSubstitution(searchString, string, position, [], undefined, replaceValue);
|
|
2443
|
+
result += stringSlice$2(string, endOfLastMatch, position) + replacement;
|
|
2444
|
+
endOfLastMatch = position + searchLength;
|
|
2445
|
+
position = stringIndexOf$1(string, searchString, position + advanceBy);
|
|
2446
|
+
}
|
|
2447
|
+
if (endOfLastMatch < string.length) {
|
|
2448
|
+
result += stringSlice$2(string, endOfLastMatch);
|
|
2449
|
+
}
|
|
2450
|
+
return result;
|
|
2451
|
+
}
|
|
2452
|
+
});
|
|
2453
|
+
|
|
2454
|
+
/**
|
|
2455
|
+
* @internal
|
|
2456
|
+
*
|
|
2457
|
+
* # Date Utils - Formats a date to the current locale
|
|
2458
|
+
*
|
|
2459
|
+
* @category Utilities
|
|
2460
|
+
*/
|
|
2461
|
+
const formatDate = (date, locale = "en-US") => new Date(date).toLocaleDateString(locale, {
|
|
2462
|
+
day: "numeric",
|
|
2463
|
+
month: "long",
|
|
2464
|
+
year: "numeric"
|
|
2465
|
+
});
|
|
2466
|
+
/**
|
|
2467
|
+
* @internal
|
|
2468
|
+
* Get the locale data for a given locale string.
|
|
2469
|
+
* @param locale string i.e. "en-US"
|
|
2470
|
+
* @returns locale data
|
|
2471
|
+
*/
|
|
2472
|
+
const findDateLocale = (locale = "en-US") => {
|
|
2473
|
+
const loadableLocale = locale.replaceAll("-", "");
|
|
2474
|
+
const rootLocale = locale.split("-")[0];
|
|
2475
|
+
const targetLocale = loadableLocale in Locales ? loadableLocale : rootLocale;
|
|
2476
|
+
return Locales[targetLocale];
|
|
2477
|
+
};
|
|
2478
|
+
/**
|
|
2479
|
+
* @internal
|
|
2480
|
+
* Given a date and a locale, format the date to the locale's date format.
|
|
2481
|
+
* @param date
|
|
2482
|
+
* @param locale string i.e. "en-US"
|
|
2483
|
+
* @param dateFormat string. See https://date-fns.org/v3.3.1/docs/format
|
|
2484
|
+
* @returns formatted date string
|
|
2485
|
+
*/
|
|
2486
|
+
const formatByDateAndLocale = (date, locale = "en-US", dateFormat) => {
|
|
2487
|
+
const localeData = findDateLocale(locale);
|
|
2488
|
+
const localeDateFormat = getlocaleDateStringFormat(locale);
|
|
2489
|
+
return format(date, dateFormat !== null && dateFormat !== void 0 ? dateFormat : localeDateFormat, {
|
|
2490
|
+
locale: localeData
|
|
2491
|
+
});
|
|
2492
|
+
};
|
|
2493
|
+
/**
|
|
2494
|
+
* @internal
|
|
2495
|
+
* Parse a string in the CURRENT locale into a Date object.
|
|
2496
|
+
* @param date string
|
|
2497
|
+
* @param locale
|
|
2498
|
+
* @returns date
|
|
2499
|
+
*/
|
|
2500
|
+
const parseLocaleDate = (date, locale = "en-US", dateFormat = "P") => {
|
|
2501
|
+
const localeData = findDateLocale(locale);
|
|
2502
|
+
return parse(date, dateFormat, new Date(), {
|
|
2503
|
+
locale: localeData
|
|
2504
|
+
});
|
|
2505
|
+
};
|
|
2506
|
+
/**
|
|
2507
|
+
* @internal
|
|
2508
|
+
*
|
|
2509
|
+
* # Date Utils - formatDateDDMMYY
|
|
2510
|
+
*
|
|
2511
|
+
* @category Utilities
|
|
2512
|
+
*/
|
|
2513
|
+
const formatDateDDMMYY = (date, locale = "en-US") => new Date(date).toLocaleDateString(locale, {
|
|
2514
|
+
day: "2-digit",
|
|
2515
|
+
month: "2-digit",
|
|
2516
|
+
year: "2-digit"
|
|
2517
|
+
});
|
|
2518
|
+
/**
|
|
2519
|
+
* @internal
|
|
2520
|
+
*
|
|
2521
|
+
* # Date Utils - formatDateDDMMYYYY
|
|
2522
|
+
*
|
|
2523
|
+
* @category Utilities
|
|
2524
|
+
*/
|
|
2525
|
+
const formatDateDDMMYYYY = (date, locale = "en-US") => new Date(date).toLocaleDateString(locale, {
|
|
2526
|
+
day: "2-digit",
|
|
2527
|
+
month: "2-digit",
|
|
2528
|
+
year: "numeric"
|
|
2529
|
+
});
|
|
2530
|
+
/**
|
|
2531
|
+
* @internal
|
|
2532
|
+
*
|
|
2533
|
+
* Get the date format in the current locale i.e., "MM/DD/YYYY"
|
|
2534
|
+
*
|
|
2535
|
+
* @category Utilities
|
|
2536
|
+
* @returns Date format as string
|
|
2537
|
+
*/
|
|
2538
|
+
const getlocaleDateStringFormat = (locale = "en-US") => {
|
|
2539
|
+
var _a;
|
|
2540
|
+
const localeData = findDateLocale(locale);
|
|
2541
|
+
const dateFormatString = (_a = localeData.formatLong) === null || _a === void 0 ? void 0 : _a.date({
|
|
2542
|
+
width: "short"
|
|
2543
|
+
});
|
|
2544
|
+
return dateFormatString;
|
|
2545
|
+
};
|
|
2546
|
+
/**
|
|
2547
|
+
* @internal
|
|
2548
|
+
*
|
|
2549
|
+
* # Date Utils - Get the date a number of days after a given date
|
|
2550
|
+
*
|
|
2551
|
+
* @category Utilities
|
|
2552
|
+
*/
|
|
2553
|
+
const daysAfter = (days, date = new Date()) => {
|
|
2554
|
+
date = new Date(date);
|
|
2555
|
+
date.setDate(date.getDate() + days);
|
|
2556
|
+
return date;
|
|
2557
|
+
};
|
|
2558
|
+
/**
|
|
2559
|
+
* @internal
|
|
2560
|
+
*
|
|
2561
|
+
* # Date Utils - Get a cutoff date for a given date or the current date
|
|
2562
|
+
*
|
|
2563
|
+
* @category Utilities
|
|
2564
|
+
*/
|
|
2565
|
+
const nextDayCutoff = (cutoff, date = new Date()) => date.getHours() >= cutoff ? daysAfter(1, new Date(date)) : new Date(date);
|
|
2566
|
+
/**
|
|
2567
|
+
* @internal
|
|
2568
|
+
*
|
|
2569
|
+
* # Date Utils - get the most recent date from a list of dates
|
|
2570
|
+
*
|
|
2571
|
+
* @category Utilities
|
|
2572
|
+
*/
|
|
2573
|
+
const mostRecent = (...dates) => new Date(Math.max(...dates.map(Number)));
|
|
2574
|
+
/**
|
|
2575
|
+
* @internal
|
|
2576
|
+
*
|
|
2577
|
+
* # Date Utils - Given a date, return a new date with the time set to 00:00:00
|
|
2578
|
+
*
|
|
2579
|
+
* @category Utilities
|
|
2580
|
+
*/
|
|
2581
|
+
const omitTime = shipDate => {
|
|
2582
|
+
const date = shipDate ? new Date(shipDate) : new Date();
|
|
2583
|
+
return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
|
|
2584
|
+
};
|
|
2585
|
+
/**
|
|
2586
|
+
* @internal
|
|
2587
|
+
*
|
|
2588
|
+
* # Date Utils - getExpirationYears
|
|
2589
|
+
*
|
|
2590
|
+
* @category Utilities
|
|
2591
|
+
*/
|
|
2592
|
+
const getExpirationYears = yearsValid => {
|
|
2593
|
+
const currentYear = new Date().getFullYear();
|
|
2594
|
+
const years = [];
|
|
2595
|
+
for (let i = 0; i < yearsValid; i++) {
|
|
2596
|
+
years.push(`${currentYear + i}`);
|
|
2597
|
+
}
|
|
2598
|
+
return years;
|
|
2599
|
+
};
|
|
2600
|
+
/**
|
|
2601
|
+
* @internal
|
|
2602
|
+
*
|
|
2603
|
+
* # Date Utilities - sortByCreationDate
|
|
2604
|
+
*
|
|
2605
|
+
* @category Utilities
|
|
2606
|
+
*/
|
|
2607
|
+
const sortByCreationDate = (a, b, order = "desc") => {
|
|
2608
|
+
const [x, y] = order === "asc" ? [a, b] : [b, a];
|
|
2609
|
+
return new Date(x.createdAt).getTime() - new Date(y.createdAt).getTime();
|
|
2610
|
+
};
|
|
2611
|
+
/**
|
|
2612
|
+
* @internal
|
|
2613
|
+
*
|
|
2614
|
+
* # Date Utilities - isNowOrInTheFuture
|
|
2615
|
+
*
|
|
2616
|
+
* @category Utilities
|
|
2617
|
+
*/
|
|
2618
|
+
const isNowOrInTheFuture = shipDate => {
|
|
2619
|
+
if (shipDate) return new Date(shipDate) >= new Date();
|
|
2620
|
+
return false;
|
|
2621
|
+
};
|
|
2622
|
+
/**
|
|
2623
|
+
* @internal
|
|
2624
|
+
*
|
|
2625
|
+
* # Date Utilities - getRelativeDates
|
|
2626
|
+
*
|
|
2627
|
+
* @category Utilities
|
|
2628
|
+
*/
|
|
2629
|
+
const getRelativeDates = from => {
|
|
2630
|
+
const origin = from !== null && from !== void 0 ? from : new Date();
|
|
2631
|
+
return {
|
|
2632
|
+
firstDayOfMonth: new Date(origin.getFullYear(), origin.getMonth(), 1),
|
|
2633
|
+
lastDayOfTheMonth: new Date(origin.getFullYear(), origin.getMonth() + 1, 0),
|
|
2634
|
+
origin,
|
|
2635
|
+
previousMonthFirstDay: new Date(origin.getFullYear(), origin.getMonth() - 1, 1),
|
|
2636
|
+
previousMonthLastDay: new Date(origin.getFullYear(), origin.getMonth() - 1 + 1, 0),
|
|
2637
|
+
thirtyDaysAgo: new Date(new Date().setDate(origin.getDate() - 30))
|
|
2638
|
+
};
|
|
2639
|
+
};
|
|
2640
|
+
|
|
2641
|
+
/**
|
|
2642
|
+
* @internal
|
|
2643
|
+
*
|
|
2644
|
+
* # Create Coded Errors Utlity Function
|
|
2645
|
+
*
|
|
2646
|
+
* - This function extracts errors from our `Axios Responses`.
|
|
2647
|
+
*
|
|
2648
|
+
* @category Utilities
|
|
2649
|
+
*/
|
|
2650
|
+
const createCodedErrors = err => {
|
|
2651
|
+
var _a;
|
|
2652
|
+
if (axios.isAxiosError(err)) {
|
|
2653
|
+
return (_a = err.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
2654
|
+
}
|
|
2655
|
+
return [{
|
|
2656
|
+
errorCode: "unknown",
|
|
2657
|
+
errorSource: "elements",
|
|
2658
|
+
errorType: "unknown",
|
|
2659
|
+
message: err.message
|
|
2660
|
+
}];
|
|
2661
|
+
};
|
|
2662
|
+
/**
|
|
2663
|
+
* @internal
|
|
2664
|
+
*
|
|
2665
|
+
* - Joins a list of error-like object's messages and throws them as a single error.
|
|
2666
|
+
*
|
|
2667
|
+
* @category Utilities
|
|
2668
|
+
*/
|
|
2669
|
+
function throwJoinedMessages(errors) {
|
|
2670
|
+
throw new Error(errors.map(e => e.message).join(", "));
|
|
2671
|
+
}
|
|
2672
|
+
/**
|
|
2673
|
+
* @internal
|
|
2674
|
+
*
|
|
2675
|
+
* - If any CodedErrors exist, throw them all as a single error, otherwise assert errors is null.
|
|
2676
|
+
*
|
|
2677
|
+
* @category Utilities
|
|
2678
|
+
*/
|
|
2679
|
+
function throwAny(errors) {
|
|
2680
|
+
if (errors) throwJoinedMessages(errors);
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2683
|
+
/**
|
|
2684
|
+
* @namespace featureFlags
|
|
2685
|
+
*
|
|
2686
|
+
* - The `featureFlags` namespace contains all the feature flags available throughout the
|
|
2687
|
+
* application. All features are scoped by name to the component they are intended for.
|
|
2688
|
+
*
|
|
2689
|
+
* @example
|
|
2690
|
+
* ```tsx
|
|
2691
|
+
* export const featureFlags = {
|
|
2692
|
+
* ConfigureSalesOrderShipment: {
|
|
2693
|
+
* compatibleCountryCodes: ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"],
|
|
2694
|
+
* rateForm: {
|
|
2695
|
+
* enableFunding: false,
|
|
2696
|
+
* enableGlobalPostFiltering: false,
|
|
2697
|
+
* labelLayout: false,
|
|
2698
|
+
* nicknameRate: true,
|
|
2699
|
+
* saveRate: true,
|
|
2700
|
+
* },
|
|
2701
|
+
* shipmentForm: {
|
|
2702
|
+
* browseRates: true,
|
|
2703
|
+
* includeShipsuranceInsurance: true,
|
|
2704
|
+
* includeThirdPartyInsurance: true,
|
|
2705
|
+
* selectService: true,
|
|
2706
|
+
* shippingPresets: false,
|
|
2707
|
+
* },
|
|
2708
|
+
* },
|
|
2709
|
+
* Global: {
|
|
2710
|
+
* carriers: {
|
|
2711
|
+
* enabledCarriers: ["stamps_com", "ups", "dhl_express_walleted"],
|
|
2712
|
+
* },
|
|
2713
|
+
* presentation: {
|
|
2714
|
+
* poweredByShipEngine: false,
|
|
2715
|
+
* },
|
|
2716
|
+
* },
|
|
2717
|
+
* ViewShipment: {
|
|
2718
|
+
* shipment: {
|
|
2719
|
+
* schedulePickup: true,
|
|
2720
|
+
* },
|
|
2721
|
+
* },
|
|
2722
|
+
* } as const;
|
|
2723
|
+
* ```
|
|
2724
|
+
*/
|
|
2725
|
+
const featureFlags = {
|
|
2726
|
+
/**
|
|
2727
|
+
* `ConfigureSalesOrderShipment` all scoped feature flags for the shipment configuration
|
|
2728
|
+
* section of the `<PurchaseLabel />` element.
|
|
2729
|
+
*/
|
|
2730
|
+
ConfigureSalesOrderShipment: {
|
|
2731
|
+
/**
|
|
2732
|
+
* `compatibleCountryCodes` is a list of all supported `countries` available in ShipEngine
|
|
2733
|
+
* Elements.
|
|
2734
|
+
*/
|
|
2735
|
+
compatibleCountryCodes: ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"],
|
|
2736
|
+
/**
|
|
2737
|
+
* `configureShipment` is a group of flags related to the useConfigureShipment functionality
|
|
2738
|
+
*/
|
|
2739
|
+
configureShipment: {
|
|
2740
|
+
/**
|
|
2741
|
+
* `enableErrorWhenShipmentCancelled` when enabled will modify the default behavior of creating a new shipment for a salesorder to throwing an error
|
|
2742
|
+
*/
|
|
2743
|
+
enableErrorWhenShipmentCancelled: false
|
|
2744
|
+
},
|
|
2745
|
+
/**
|
|
2746
|
+
* @internal
|
|
2747
|
+
*
|
|
2748
|
+
* `partnerMessages` enables the partner consuming elements to specify override messages in specific cases.
|
|
2749
|
+
*/
|
|
2750
|
+
partnerMessages: {
|
|
2751
|
+
incompleteLabelPurchaseRequirements: undefined
|
|
2752
|
+
},
|
|
2753
|
+
/**
|
|
2754
|
+
* `rateForm` all scoped feature flags for the `rate form` section of the `<PurchaseLabel />`
|
|
2755
|
+
* element.
|
|
2756
|
+
*/
|
|
2757
|
+
rateForm: {
|
|
2758
|
+
/**
|
|
2759
|
+
* `enableFunding` enables the `funding` section of the rate form.
|
|
2760
|
+
*/
|
|
2761
|
+
enableFunding: false,
|
|
2762
|
+
/**
|
|
2763
|
+
* `enableGlobalPostFiltering` enables the `global post filtering` on all rates fetched
|
|
2764
|
+
* in the rates form.
|
|
2765
|
+
*/
|
|
2766
|
+
enableGlobalPostFiltering: false,
|
|
2767
|
+
/**
|
|
2768
|
+
* `labelLayout` enables the `label layout` section of the `<PurchaseLabel /> element.
|
|
2769
|
+
*/
|
|
2770
|
+
labelLayout: false,
|
|
2771
|
+
/**
|
|
2772
|
+
* `nicknameRate` enables showing the `carrier nickname` when rates are fetched.
|
|
2773
|
+
*/
|
|
2774
|
+
nicknameRate: true,
|
|
2775
|
+
/**
|
|
2776
|
+
* `requireDhlTermsAcknowledgement` enables the `DHL terms acknowledgement` when rates are fetched.
|
|
2777
|
+
*/
|
|
2778
|
+
requireDhlTermsAcknowledgement: false,
|
|
2779
|
+
/**
|
|
2780
|
+
* `saveRate` enables the `save rate` button in the rate form. This allows users to save a
|
|
2781
|
+
* `rateId` for a shipment to be purchased later.
|
|
2782
|
+
*/
|
|
2783
|
+
saveRate: true
|
|
2784
|
+
},
|
|
2785
|
+
/**
|
|
2786
|
+
* `shipmentForm` all scoped feature flags for the `shipment form` section of the
|
|
2787
|
+
* `<PurchaseLabel />` element.
|
|
2788
|
+
*/
|
|
2789
|
+
shipmentForm: {
|
|
2790
|
+
/**
|
|
2791
|
+
* `browseRates` enables the `browse rates` button in the shipment form. This allows users
|
|
2792
|
+
* to browse rates for a shipment with varying shipment configurations. This is useful for
|
|
2793
|
+
* rate shopping.
|
|
2794
|
+
*/
|
|
2795
|
+
browseRates: true,
|
|
2796
|
+
/**
|
|
2797
|
+
* `includeShipsuranceInsurance` enables the `shipsurance insurance` feature, allowing users
|
|
2798
|
+
* to select Shipsurance when insuring their shipment.
|
|
2799
|
+
*/
|
|
2800
|
+
includeShipsuranceInsurance: true,
|
|
2801
|
+
/**
|
|
2802
|
+
* `includeThirdPartyInsurance` enables the `third party insurance` feature, allowing users
|
|
2803
|
+
* to opt for third party insurance when insuring their shipment.
|
|
2804
|
+
*/
|
|
2805
|
+
includeThirdPartyInsurance: true,
|
|
2806
|
+
/**
|
|
2807
|
+
* `selectService` enables the `select service` feature, allowing users to select a service
|
|
2808
|
+
* when rate shopping across multiple carrier providers.
|
|
2809
|
+
*/
|
|
2810
|
+
selectService: true,
|
|
2811
|
+
/**
|
|
2812
|
+
* `shippingPresets` enables the `shipping presets` feature, allowing users to pass in a set
|
|
2813
|
+
* of shipping presets they wish to use within the shipment form of the `<PurchaseLabel />`
|
|
2814
|
+
* element.
|
|
2815
|
+
*/
|
|
2816
|
+
shippingPresets: false
|
|
2817
|
+
}
|
|
2818
|
+
},
|
|
2819
|
+
/**
|
|
2820
|
+
* `Global` all feature flags that are intended for use anywhere in ShipEngine Elements.
|
|
2821
|
+
*/
|
|
2822
|
+
Global: {
|
|
2823
|
+
/**
|
|
2824
|
+
* All global `carrier` related feature flags.
|
|
2825
|
+
*/
|
|
2826
|
+
carriers: {
|
|
2827
|
+
/**
|
|
2828
|
+
* `enabledCarriers` is a list of all `carriers` that are enabled for use in ShipEngine
|
|
2829
|
+
* Elements.
|
|
2830
|
+
*/
|
|
2831
|
+
enabledCarriers: ["stamps_com", "ups_walleted", "dhl_express_walleted", "ups", "hermes", "yodel_walleted"]
|
|
2832
|
+
},
|
|
2833
|
+
/**
|
|
2834
|
+
* All global `presentation` related feature flags.
|
|
2835
|
+
*/
|
|
2836
|
+
presentation: {
|
|
2837
|
+
/**
|
|
2838
|
+
* `poweredByShipEngine` enables the `powered by ShipEngine` logo in the footer various
|
|
2839
|
+
* elements.
|
|
2840
|
+
*/
|
|
2841
|
+
poweredByShipEngine: false
|
|
2842
|
+
}
|
|
2843
|
+
},
|
|
2844
|
+
/**
|
|
2845
|
+
* `ViewShipment` all scoped feature flags for the `<ViewShipment />` element.
|
|
2846
|
+
*/
|
|
2847
|
+
ViewShipment: {
|
|
2848
|
+
/**
|
|
2849
|
+
* `shipment` all shipment related features available in the `<ViewShipment />` element.
|
|
2850
|
+
*/
|
|
2851
|
+
shipment: {
|
|
2852
|
+
/**
|
|
2853
|
+
* `schedulePickup` enables the `schedule pickup` button in the `<ViewShipment />` element,
|
|
2854
|
+
* allowing users to schedule pick-ups for their shipments.
|
|
2855
|
+
*/
|
|
2856
|
+
schedulePickup: true
|
|
2857
|
+
}
|
|
2590
2858
|
}
|
|
2591
|
-
|
|
2592
|
-
if (SHAM) createNonEnumerableProperty(RegExpPrototype$2[SYMBOL], 'sham', true);
|
|
2593
2859
|
};
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
var
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
var createMethod = function (CONVERT_TO_STRING) {
|
|
2605
|
-
return function ($this, pos) {
|
|
2606
|
-
var S = toString$9(requireObjectCoercible$5($this));
|
|
2607
|
-
var position = toIntegerOrInfinity$3(pos);
|
|
2608
|
-
var size = S.length;
|
|
2609
|
-
var first, second;
|
|
2610
|
-
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
|
2611
|
-
first = charCodeAt(S, position);
|
|
2612
|
-
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
|
2613
|
-
|| (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
|
|
2614
|
-
? CONVERT_TO_STRING
|
|
2615
|
-
? charAt$3(S, position)
|
|
2616
|
-
: first
|
|
2617
|
-
: CONVERT_TO_STRING
|
|
2618
|
-
? stringSlice$5(S, position, position + 2)
|
|
2619
|
-
: (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
|
2860
|
+
/**
|
|
2861
|
+
* @internal
|
|
2862
|
+
*
|
|
2863
|
+
* # Feature Flags - featureFlagComponentNameLookup
|
|
2864
|
+
*/
|
|
2865
|
+
const featureFlagComponentNameLookup = componentName => {
|
|
2866
|
+
var _a;
|
|
2867
|
+
const lookup = {
|
|
2868
|
+
PurchaseLabel: "ConfigureSalesOrderShipment"
|
|
2620
2869
|
};
|
|
2870
|
+
return (_a = lookup[componentName]) !== null && _a !== void 0 ? _a : "";
|
|
2621
2871
|
};
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
};
|
|
2631
|
-
|
|
2632
|
-
var charAt$2 = stringMultibyte.charAt;
|
|
2633
|
-
|
|
2634
|
-
// `AdvanceStringIndex` abstract operation
|
|
2635
|
-
// https://tc39.es/ecma262/#sec-advancestringindex
|
|
2636
|
-
var advanceStringIndex$2 = function (S, index, unicode) {
|
|
2637
|
-
return index + (unicode ? charAt$2(S, index).length : 1);
|
|
2638
|
-
};
|
|
2639
|
-
|
|
2640
|
-
var uncurryThis$c = functionUncurryThis;
|
|
2641
|
-
var toObject$2 = toObject$7;
|
|
2642
|
-
|
|
2643
|
-
var floor$2 = Math.floor;
|
|
2644
|
-
var charAt$1 = uncurryThis$c(''.charAt);
|
|
2645
|
-
var replace$1 = uncurryThis$c(''.replace);
|
|
2646
|
-
var stringSlice$4 = uncurryThis$c(''.slice);
|
|
2647
|
-
var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
|
|
2648
|
-
var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
|
|
2649
|
-
|
|
2650
|
-
// `GetSubstitution` abstract operation
|
|
2651
|
-
// https://tc39.es/ecma262/#sec-getsubstitution
|
|
2652
|
-
var getSubstitution$2 = function (matched, str, position, captures, namedCaptures, replacement) {
|
|
2653
|
-
var tailPos = position + matched.length;
|
|
2654
|
-
var m = captures.length;
|
|
2655
|
-
var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
|
|
2656
|
-
if (namedCaptures !== undefined) {
|
|
2657
|
-
namedCaptures = toObject$2(namedCaptures);
|
|
2658
|
-
symbols = SUBSTITUTION_SYMBOLS;
|
|
2659
|
-
}
|
|
2660
|
-
return replace$1(replacement, symbols, function (match, ch) {
|
|
2661
|
-
var capture;
|
|
2662
|
-
switch (charAt$1(ch, 0)) {
|
|
2663
|
-
case '$': return '$';
|
|
2664
|
-
case '&': return matched;
|
|
2665
|
-
case '`': return stringSlice$4(str, 0, position);
|
|
2666
|
-
case "'": return stringSlice$4(str, tailPos);
|
|
2667
|
-
case '<':
|
|
2668
|
-
capture = namedCaptures[stringSlice$4(ch, 1, -1)];
|
|
2669
|
-
break;
|
|
2670
|
-
default: // \d\d?
|
|
2671
|
-
var n = +ch;
|
|
2672
|
-
if (n === 0) return match;
|
|
2673
|
-
if (n > m) {
|
|
2674
|
-
var f = floor$2(n / 10);
|
|
2675
|
-
if (f === 0) return match;
|
|
2676
|
-
if (f <= m) return captures[f - 1] === undefined ? charAt$1(ch, 1) : captures[f - 1] + charAt$1(ch, 1);
|
|
2677
|
-
return match;
|
|
2678
|
-
}
|
|
2679
|
-
capture = captures[n - 1];
|
|
2680
|
-
}
|
|
2681
|
-
return capture === undefined ? '' : capture;
|
|
2682
|
-
});
|
|
2872
|
+
/**
|
|
2873
|
+
* @internal
|
|
2874
|
+
*
|
|
2875
|
+
* # Feature Flags - getFeatures
|
|
2876
|
+
*/
|
|
2877
|
+
const getFeatures = (...element) => {
|
|
2878
|
+
return element.map(feat => {
|
|
2879
|
+
var _a;
|
|
2880
|
+
return (_a = get$1(featureFlags, feat)) !== null && _a !== void 0 ? _a : {};
|
|
2881
|
+
}).reduce((acc, feat) => Object.assign(acc, feat), {});
|
|
2683
2882
|
};
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
return result;
|
|
2701
|
-
}
|
|
2702
|
-
if (classof$4(R) === 'RegExp') return call$b(regexpExec, R, S);
|
|
2703
|
-
throw $TypeError$a('RegExp#exec called on incompatible receiver');
|
|
2883
|
+
/**
|
|
2884
|
+
* # Feature Flags - useFeatures
|
|
2885
|
+
*
|
|
2886
|
+
* - The `useFeatures` hook is used to retrieve the feature flags for a given component.
|
|
2887
|
+
*
|
|
2888
|
+
* @example
|
|
2889
|
+
* ```tsx
|
|
2890
|
+
* const features = useFeatures("Global");
|
|
2891
|
+
* ```
|
|
2892
|
+
*
|
|
2893
|
+
* <br />
|
|
2894
|
+
*
|
|
2895
|
+
* @see {@link featureFlags | All available `Feature Flags`}
|
|
2896
|
+
*/
|
|
2897
|
+
const useFeatures = (...element) => {
|
|
2898
|
+
return getFeatures(...element);
|
|
2704
2899
|
};
|
|
2705
2900
|
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2901
|
+
/**
|
|
2902
|
+
* @internal
|
|
2903
|
+
*
|
|
2904
|
+
* # Form Logger
|
|
2905
|
+
*
|
|
2906
|
+
* @description
|
|
2907
|
+
* This will log the values that are submitted to the validation resolver
|
|
2908
|
+
* (only REGISTERED form fields) and the results of that validation.
|
|
2909
|
+
*
|
|
2910
|
+
* @usage Wrap the submission:
|
|
2911
|
+
* `<form onSubmit={formLogger.capture(handleSubmit)}>`
|
|
2912
|
+
*
|
|
2913
|
+
* @category Utilities
|
|
2914
|
+
*/
|
|
2915
|
+
const formLogger = {
|
|
2916
|
+
capture(handleSubmit) {
|
|
2917
|
+
return e => {
|
|
2918
|
+
// Prevent parent form submission in nested forms. This shouldn't be necessary, but React's
|
|
2919
|
+
// event bubbling doesn't handle the formId target properly when passed through a portal.
|
|
2920
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
2921
|
+
this.isSubmitting = true;
|
|
2922
|
+
void handleSubmit(e);
|
|
2923
|
+
this.isSubmitting = false;
|
|
2924
|
+
};
|
|
2925
|
+
},
|
|
2926
|
+
isSubmitting: false,
|
|
2927
|
+
log: (values, getValidationResult) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2928
|
+
logger.info({
|
|
2929
|
+
obj: values
|
|
2930
|
+
}, "Validating registered form fields:");
|
|
2931
|
+
const validationResult = yield getValidationResult();
|
|
2932
|
+
if (Object.keys(validationResult.errors).length) logger.error({
|
|
2933
|
+
obj: validationResult.errors
|
|
2934
|
+
}, "Validation failed. Errors object:");else logger.info({
|
|
2935
|
+
obj: validationResult.values
|
|
2936
|
+
}, "Validation passed. Final payload after defaults & transforms:");
|
|
2937
|
+
return validationResult;
|
|
2938
|
+
})
|
|
2734
2939
|
};
|
|
2735
2940
|
|
|
2736
|
-
//
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
// eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
|
|
2740
|
-
return 'a'.replace(/./, '$0') === '$0';
|
|
2741
|
-
})();
|
|
2742
|
-
|
|
2743
|
-
// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
|
|
2744
|
-
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
|
|
2745
|
-
if (/./[REPLACE$1]) {
|
|
2746
|
-
return /./[REPLACE$1]('a', '$0') === '';
|
|
2747
|
-
}
|
|
2748
|
-
return false;
|
|
2749
|
-
})();
|
|
2750
|
-
|
|
2751
|
-
var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$8(function () {
|
|
2752
|
-
var re = /./;
|
|
2753
|
-
re.exec = function () {
|
|
2754
|
-
var result = [];
|
|
2755
|
-
result.groups = { a: '7' };
|
|
2756
|
-
return result;
|
|
2757
|
-
};
|
|
2758
|
-
// eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
|
|
2759
|
-
return ''.replace(re, '$<a>') !== '7';
|
|
2760
|
-
});
|
|
2941
|
+
// a string of all valid unicode whitespaces
|
|
2942
|
+
var whitespaces$4 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
|
|
2943
|
+
'\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
|
2761
2944
|
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2945
|
+
var uncurryThis$a = functionUncurryThis;
|
|
2946
|
+
var requireObjectCoercible$3 = requireObjectCoercible$9;
|
|
2947
|
+
var toString$7 = toString$c;
|
|
2948
|
+
var whitespaces$3 = whitespaces$4;
|
|
2765
2949
|
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
var O = requireObjectCoercible$4(this);
|
|
2771
|
-
var replacer = isNullOrUndefined$4(searchValue) ? undefined : getMethod$4(searchValue, REPLACE$1);
|
|
2772
|
-
return replacer
|
|
2773
|
-
? call$a(replacer, searchValue, O, replaceValue)
|
|
2774
|
-
: call$a(nativeReplace, toString$8(O), searchValue, replaceValue);
|
|
2775
|
-
},
|
|
2776
|
-
// `RegExp.prototype[@@replace]` method
|
|
2777
|
-
// https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
|
|
2778
|
-
function (string, replaceValue) {
|
|
2779
|
-
var rx = anObject$7(this);
|
|
2780
|
-
var S = toString$8(string);
|
|
2950
|
+
var replace$1 = uncurryThis$a(''.replace);
|
|
2951
|
+
var whitespace = '[' + whitespaces$3 + ']';
|
|
2952
|
+
var ltrim = RegExp('^' + whitespace + whitespace + '*');
|
|
2953
|
+
var rtrim = RegExp(whitespace + whitespace + '*$');
|
|
2781
2954
|
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2955
|
+
// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
|
|
2956
|
+
var createMethod = function (TYPE) {
|
|
2957
|
+
return function ($this) {
|
|
2958
|
+
var string = toString$7(requireObjectCoercible$3($this));
|
|
2959
|
+
if (TYPE & 1) string = replace$1(string, ltrim, '');
|
|
2960
|
+
if (TYPE & 2) string = replace$1(string, rtrim, '');
|
|
2961
|
+
return string;
|
|
2962
|
+
};
|
|
2963
|
+
};
|
|
2790
2964
|
|
|
2791
|
-
|
|
2792
|
-
|
|
2965
|
+
var stringTrim = {
|
|
2966
|
+
// `String.prototype.{ trimLeft, trimStart }` methods
|
|
2967
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trimstart
|
|
2968
|
+
start: createMethod(1),
|
|
2969
|
+
// `String.prototype.{ trimRight, trimEnd }` methods
|
|
2970
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trimend
|
|
2971
|
+
end: createMethod(2),
|
|
2972
|
+
// `String.prototype.trim` method
|
|
2973
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trim
|
|
2974
|
+
trim: createMethod(3)
|
|
2975
|
+
};
|
|
2793
2976
|
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
rx.lastIndex = 0;
|
|
2798
|
-
}
|
|
2799
|
-
var results = [];
|
|
2800
|
-
while (true) {
|
|
2801
|
-
var result = regExpExec$1(rx, S);
|
|
2802
|
-
if (result === null) break;
|
|
2977
|
+
var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
|
|
2978
|
+
var fails$8 = fails$q;
|
|
2979
|
+
var whitespaces$2 = whitespaces$4;
|
|
2803
2980
|
|
|
2804
|
-
|
|
2805
|
-
if (!global) break;
|
|
2981
|
+
var non = '\u200B\u0085\u180E';
|
|
2806
2982
|
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2983
|
+
// check that a method works with the correct list
|
|
2984
|
+
// of whitespaces and has a correct name
|
|
2985
|
+
var stringTrimForced = function (METHOD_NAME) {
|
|
2986
|
+
return fails$8(function () {
|
|
2987
|
+
return !!whitespaces$2[METHOD_NAME]()
|
|
2988
|
+
|| non[METHOD_NAME]() !== non
|
|
2989
|
+
|| (PROPER_FUNCTION_NAME$1 && whitespaces$2[METHOD_NAME].name !== METHOD_NAME);
|
|
2990
|
+
});
|
|
2991
|
+
};
|
|
2810
2992
|
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
result = results[i];
|
|
2993
|
+
var $$f = _export;
|
|
2994
|
+
var $trim = stringTrim.trim;
|
|
2995
|
+
var forcedStringTrimMethod = stringTrimForced;
|
|
2815
2996
|
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
// causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
|
|
2824
|
-
for (var j = 1; j < result.length; j++) push$1(captures, maybeToString(result[j]));
|
|
2825
|
-
var namedCaptures = result.groups;
|
|
2826
|
-
if (functionalReplace) {
|
|
2827
|
-
var replacerArgs = concat([matched], captures, position, S);
|
|
2828
|
-
if (namedCaptures !== undefined) push$1(replacerArgs, namedCaptures);
|
|
2829
|
-
var replacement = toString$8(apply$1(replaceValue, undefined, replacerArgs));
|
|
2830
|
-
} else {
|
|
2831
|
-
replacement = getSubstitution$1(matched, S, position, captures, namedCaptures, replaceValue);
|
|
2832
|
-
}
|
|
2833
|
-
if (position >= nextSourcePosition) {
|
|
2834
|
-
accumulatedResult += stringSlice$3(S, nextSourcePosition, position) + replacement;
|
|
2835
|
-
nextSourcePosition = position + matched.length;
|
|
2836
|
-
}
|
|
2837
|
-
}
|
|
2838
|
-
return accumulatedResult + stringSlice$3(S, nextSourcePosition);
|
|
2839
|
-
}
|
|
2840
|
-
];
|
|
2841
|
-
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
|
|
2997
|
+
// `String.prototype.trim` method
|
|
2998
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trim
|
|
2999
|
+
$$f({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
|
|
3000
|
+
trim: function trim() {
|
|
3001
|
+
return $trim(this);
|
|
3002
|
+
}
|
|
3003
|
+
});
|
|
2842
3004
|
|
|
2843
3005
|
/**
|
|
2844
3006
|
* @internal
|
|
@@ -2981,7 +3143,7 @@ const overrideCarrierCodes$1 = (carrier, overrides) => {
|
|
|
2981
3143
|
return overrides[carrier] || carrier;
|
|
2982
3144
|
};
|
|
2983
3145
|
|
|
2984
|
-
var $$
|
|
3146
|
+
var $$e = _export;
|
|
2985
3147
|
var $includes = arrayIncludes.includes;
|
|
2986
3148
|
var fails$7 = fails$q;
|
|
2987
3149
|
var addToUnscopables$1 = addToUnscopables$3;
|
|
@@ -2993,7 +3155,7 @@ var BROKEN_ON_SPARSE = fails$7(function () {
|
|
|
2993
3155
|
|
|
2994
3156
|
// `Array.prototype.includes` method
|
|
2995
3157
|
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
2996
|
-
$$
|
|
3158
|
+
$$e({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
|
|
2997
3159
|
includes: function includes(el /* , fromIndex = 0 */) {
|
|
2998
3160
|
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
2999
3161
|
}
|
|
@@ -3459,10 +3621,10 @@ const getSalesOrderItemsFromSalesOrderOrShipment = ({
|
|
|
3459
3621
|
|
|
3460
3622
|
var tryToString$3 = tryToString$5;
|
|
3461
3623
|
|
|
3462
|
-
var $TypeError$
|
|
3624
|
+
var $TypeError$8 = TypeError;
|
|
3463
3625
|
|
|
3464
3626
|
var deletePropertyOrThrow$1 = function (O, P) {
|
|
3465
|
-
if (!delete O[P]) throw $TypeError$
|
|
3627
|
+
if (!delete O[P]) throw $TypeError$8('Cannot delete property ' + tryToString$3(P) + ' of ' + tryToString$3(O));
|
|
3466
3628
|
};
|
|
3467
3629
|
|
|
3468
3630
|
var toPropertyKey = toPropertyKey$3;
|
|
@@ -3480,13 +3642,13 @@ var lengthOfArrayLike$4 = lengthOfArrayLike$7;
|
|
|
3480
3642
|
var createProperty$1 = createProperty$2;
|
|
3481
3643
|
|
|
3482
3644
|
var $Array$1 = Array;
|
|
3483
|
-
var max
|
|
3645
|
+
var max = Math.max;
|
|
3484
3646
|
|
|
3485
3647
|
var arraySliceSimple = function (O, start, end) {
|
|
3486
3648
|
var length = lengthOfArrayLike$4(O);
|
|
3487
3649
|
var k = toAbsoluteIndex(start, length);
|
|
3488
3650
|
var fin = toAbsoluteIndex(end === undefined ? length : end, length);
|
|
3489
|
-
var result = $Array$1(max
|
|
3651
|
+
var result = $Array$1(max(fin - k, 0));
|
|
3490
3652
|
for (var n = 0; k < fin; k++, n++) createProperty$1(result, n, O[k]);
|
|
3491
3653
|
result.length = n;
|
|
3492
3654
|
return result;
|
|
@@ -3553,13 +3715,13 @@ var webkit = userAgent$3.match(/AppleWebKit\/(\d+)\./);
|
|
|
3553
3715
|
|
|
3554
3716
|
var engineWebkitVersion = !!webkit && +webkit[1];
|
|
3555
3717
|
|
|
3556
|
-
var $$
|
|
3557
|
-
var uncurryThis$
|
|
3718
|
+
var $$d = _export;
|
|
3719
|
+
var uncurryThis$9 = functionUncurryThis;
|
|
3558
3720
|
var aCallable$7 = aCallable$a;
|
|
3559
3721
|
var toObject$1 = toObject$7;
|
|
3560
3722
|
var lengthOfArrayLike$3 = lengthOfArrayLike$7;
|
|
3561
3723
|
var deletePropertyOrThrow = deletePropertyOrThrow$1;
|
|
3562
|
-
var toString$
|
|
3724
|
+
var toString$6 = toString$c;
|
|
3563
3725
|
var fails$6 = fails$q;
|
|
3564
3726
|
var internalSort = arraySort;
|
|
3565
3727
|
var arrayMethodIsStrict = arrayMethodIsStrict$2;
|
|
@@ -3569,8 +3731,8 @@ var V8 = engineV8Version;
|
|
|
3569
3731
|
var WEBKIT = engineWebkitVersion;
|
|
3570
3732
|
|
|
3571
3733
|
var test = [];
|
|
3572
|
-
var nativeSort = uncurryThis$
|
|
3573
|
-
var push = uncurryThis$
|
|
3734
|
+
var nativeSort = uncurryThis$9(test.sort);
|
|
3735
|
+
var push = uncurryThis$9(test.push);
|
|
3574
3736
|
|
|
3575
3737
|
// IE8-
|
|
3576
3738
|
var FAILS_ON_UNDEFINED = fails$6(function () {
|
|
@@ -3625,13 +3787,13 @@ var getSortCompare = function (comparefn) {
|
|
|
3625
3787
|
if (y === undefined) return -1;
|
|
3626
3788
|
if (x === undefined) return 1;
|
|
3627
3789
|
if (comparefn !== undefined) return +comparefn(x, y) || 0;
|
|
3628
|
-
return toString$
|
|
3790
|
+
return toString$6(x) > toString$6(y) ? 1 : -1;
|
|
3629
3791
|
};
|
|
3630
3792
|
};
|
|
3631
3793
|
|
|
3632
3794
|
// `Array.prototype.sort` method
|
|
3633
3795
|
// https://tc39.es/ecma262/#sec-array.prototype.sort
|
|
3634
|
-
$$
|
|
3796
|
+
$$d({ target: 'Array', proto: true, forced: FORCED$3 }, {
|
|
3635
3797
|
sort: function sort(comparefn) {
|
|
3636
3798
|
if (comparefn !== undefined) aCallable$7(comparefn);
|
|
3637
3799
|
|
|
@@ -3708,22 +3870,22 @@ const getShipmentByStatus = (status, shipments) => shipments === null || shipmen
|
|
|
3708
3870
|
shipmentStatus
|
|
3709
3871
|
}) => shipmentStatus === status).sort(sortByCreationDate)[0];
|
|
3710
3872
|
|
|
3711
|
-
var uncurryThis$
|
|
3873
|
+
var uncurryThis$8 = functionUncurryThis;
|
|
3712
3874
|
|
|
3713
3875
|
// `thisNumberValue` abstract operation
|
|
3714
3876
|
// https://tc39.es/ecma262/#sec-thisnumbervalue
|
|
3715
|
-
var thisNumberValue$1 = uncurryThis$
|
|
3877
|
+
var thisNumberValue$1 = uncurryThis$8(1.0.valueOf);
|
|
3716
3878
|
|
|
3717
3879
|
var toIntegerOrInfinity$1 = toIntegerOrInfinity$6;
|
|
3718
|
-
var toString$
|
|
3719
|
-
var requireObjectCoercible$
|
|
3880
|
+
var toString$5 = toString$c;
|
|
3881
|
+
var requireObjectCoercible$2 = requireObjectCoercible$9;
|
|
3720
3882
|
|
|
3721
3883
|
var $RangeError$1 = RangeError;
|
|
3722
3884
|
|
|
3723
3885
|
// `String.prototype.repeat` method implementation
|
|
3724
3886
|
// https://tc39.es/ecma262/#sec-string.prototype.repeat
|
|
3725
3887
|
var stringRepeat = function repeat(count) {
|
|
3726
|
-
var str = toString$
|
|
3888
|
+
var str = toString$5(requireObjectCoercible$2(this));
|
|
3727
3889
|
var result = '';
|
|
3728
3890
|
var n = toIntegerOrInfinity$1(count);
|
|
3729
3891
|
if (n < 0 || n == Infinity) throw $RangeError$1('Wrong number of repetitions');
|
|
@@ -3731,8 +3893,8 @@ var stringRepeat = function repeat(count) {
|
|
|
3731
3893
|
return result;
|
|
3732
3894
|
};
|
|
3733
3895
|
|
|
3734
|
-
var $$
|
|
3735
|
-
var uncurryThis$
|
|
3896
|
+
var $$c = _export;
|
|
3897
|
+
var uncurryThis$7 = functionUncurryThis;
|
|
3736
3898
|
var toIntegerOrInfinity = toIntegerOrInfinity$6;
|
|
3737
3899
|
var thisNumberValue = thisNumberValue$1;
|
|
3738
3900
|
var $repeat = stringRepeat;
|
|
@@ -3741,9 +3903,9 @@ var fails$5 = fails$q;
|
|
|
3741
3903
|
var $RangeError = RangeError;
|
|
3742
3904
|
var $String = String;
|
|
3743
3905
|
var floor = Math.floor;
|
|
3744
|
-
var repeat = uncurryThis$
|
|
3745
|
-
var stringSlice$
|
|
3746
|
-
var nativeToFixed = uncurryThis$
|
|
3906
|
+
var repeat = uncurryThis$7($repeat);
|
|
3907
|
+
var stringSlice$1 = uncurryThis$7(''.slice);
|
|
3908
|
+
var nativeToFixed = uncurryThis$7(1.0.toFixed);
|
|
3747
3909
|
|
|
3748
3910
|
var pow = function (x, n, acc) {
|
|
3749
3911
|
return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
|
|
@@ -3805,7 +3967,7 @@ var FORCED$2 = fails$5(function () {
|
|
|
3805
3967
|
|
|
3806
3968
|
// `Number.prototype.toFixed` method
|
|
3807
3969
|
// https://tc39.es/ecma262/#sec-number.prototype.tofixed
|
|
3808
|
-
$$
|
|
3970
|
+
$$c({ target: 'Number', proto: true, forced: FORCED$2 }, {
|
|
3809
3971
|
toFixed: function toFixed(fractionDigits) {
|
|
3810
3972
|
var number = thisNumberValue(this);
|
|
3811
3973
|
var fractDigits = toIntegerOrInfinity(fractionDigits);
|
|
@@ -3855,7 +4017,7 @@ $$d({ target: 'Number', proto: true, forced: FORCED$2 }, {
|
|
|
3855
4017
|
k = result.length;
|
|
3856
4018
|
result = sign + (k <= fractDigits
|
|
3857
4019
|
? '0.' + repeat('0', fractDigits - k) + result
|
|
3858
|
-
: stringSlice$
|
|
4020
|
+
: stringSlice$1(result, 0, k - fractDigits) + '.' + stringSlice$1(result, k - fractDigits));
|
|
3859
4021
|
} else {
|
|
3860
4022
|
result = sign + result;
|
|
3861
4023
|
} return result;
|
|
@@ -3993,32 +4155,19 @@ function formatFractionalWeight(weight, unit) {
|
|
|
3993
4155
|
};
|
|
3994
4156
|
}
|
|
3995
4157
|
|
|
3996
|
-
var
|
|
3997
|
-
var classof$3 = classofRaw$2;
|
|
3998
|
-
var wellKnownSymbol$9 = wellKnownSymbol$k;
|
|
3999
|
-
|
|
4000
|
-
var MATCH$1 = wellKnownSymbol$9('match');
|
|
4001
|
-
|
|
4002
|
-
// `IsRegExp` abstract operation
|
|
4003
|
-
// https://tc39.es/ecma262/#sec-isregexp
|
|
4004
|
-
var isRegexp = function (it) {
|
|
4005
|
-
var isRegExp;
|
|
4006
|
-
return isObject$3(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$3(it) == 'RegExp');
|
|
4007
|
-
};
|
|
4008
|
-
|
|
4009
|
-
var isRegExp$1 = isRegexp;
|
|
4158
|
+
var isRegExp = isRegexp;
|
|
4010
4159
|
|
|
4011
|
-
var $TypeError$
|
|
4160
|
+
var $TypeError$7 = TypeError;
|
|
4012
4161
|
|
|
4013
4162
|
var notARegexp = function (it) {
|
|
4014
|
-
if (isRegExp
|
|
4015
|
-
throw $TypeError$
|
|
4163
|
+
if (isRegExp(it)) {
|
|
4164
|
+
throw $TypeError$7("The method doesn't accept regular expressions");
|
|
4016
4165
|
} return it;
|
|
4017
4166
|
};
|
|
4018
4167
|
|
|
4019
|
-
var wellKnownSymbol$
|
|
4168
|
+
var wellKnownSymbol$7 = wellKnownSymbol$k;
|
|
4020
4169
|
|
|
4021
|
-
var MATCH = wellKnownSymbol$
|
|
4170
|
+
var MATCH = wellKnownSymbol$7('match');
|
|
4022
4171
|
|
|
4023
4172
|
var correctIsRegexpLogic = function (METHOD_NAME) {
|
|
4024
4173
|
var regexp = /./;
|
|
@@ -4032,22 +4181,22 @@ var correctIsRegexpLogic = function (METHOD_NAME) {
|
|
|
4032
4181
|
} return false;
|
|
4033
4182
|
};
|
|
4034
4183
|
|
|
4035
|
-
var $$
|
|
4036
|
-
var uncurryThis$
|
|
4184
|
+
var $$b = _export;
|
|
4185
|
+
var uncurryThis$6 = functionUncurryThis;
|
|
4037
4186
|
var notARegExp = notARegexp;
|
|
4038
|
-
var requireObjectCoercible$
|
|
4039
|
-
var toString$
|
|
4187
|
+
var requireObjectCoercible$1 = requireObjectCoercible$9;
|
|
4188
|
+
var toString$4 = toString$c;
|
|
4040
4189
|
var correctIsRegExpLogic = correctIsRegexpLogic;
|
|
4041
4190
|
|
|
4042
|
-
var stringIndexOf
|
|
4191
|
+
var stringIndexOf = uncurryThis$6(''.indexOf);
|
|
4043
4192
|
|
|
4044
4193
|
// `String.prototype.includes` method
|
|
4045
4194
|
// https://tc39.es/ecma262/#sec-string.prototype.includes
|
|
4046
|
-
$$
|
|
4195
|
+
$$b({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
|
|
4047
4196
|
includes: function includes(searchString /* , position = 0 */) {
|
|
4048
|
-
return !!~stringIndexOf
|
|
4049
|
-
toString$
|
|
4050
|
-
toString$
|
|
4197
|
+
return !!~stringIndexOf(
|
|
4198
|
+
toString$4(requireObjectCoercible$1(this)),
|
|
4199
|
+
toString$4(notARegExp(searchString)),
|
|
4051
4200
|
arguments.length > 1 ? arguments[1] : undefined
|
|
4052
4201
|
);
|
|
4053
4202
|
}
|
|
@@ -4465,135 +4614,6 @@ const CreditCardInput = fieldProps => jsx(CreditCardInputController, Object.assi
|
|
|
4465
4614
|
}
|
|
4466
4615
|
}));
|
|
4467
4616
|
|
|
4468
|
-
var call$9 = functionCall;
|
|
4469
|
-
var hasOwn$2 = hasOwnProperty_1;
|
|
4470
|
-
var isPrototypeOf$3 = objectIsPrototypeOf;
|
|
4471
|
-
var regExpFlags = regexpFlags$1;
|
|
4472
|
-
|
|
4473
|
-
var RegExpPrototype$1 = RegExp.prototype;
|
|
4474
|
-
|
|
4475
|
-
var regexpGetFlags = function (R) {
|
|
4476
|
-
var flags = R.flags;
|
|
4477
|
-
return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn$2(R, 'flags') && isPrototypeOf$3(RegExpPrototype$1, R)
|
|
4478
|
-
? call$9(regExpFlags, R) : flags;
|
|
4479
|
-
};
|
|
4480
|
-
|
|
4481
|
-
var $$b = _export;
|
|
4482
|
-
var call$8 = functionCall;
|
|
4483
|
-
var uncurryThis$6 = functionUncurryThis;
|
|
4484
|
-
var requireObjectCoercible$1 = requireObjectCoercible$9;
|
|
4485
|
-
var isCallable$6 = isCallable$o;
|
|
4486
|
-
var isNullOrUndefined$3 = isNullOrUndefined$7;
|
|
4487
|
-
var isRegExp = isRegexp;
|
|
4488
|
-
var toString$4 = toString$c;
|
|
4489
|
-
var getMethod$3 = getMethod$6;
|
|
4490
|
-
var getRegExpFlags$1 = regexpGetFlags;
|
|
4491
|
-
var getSubstitution = getSubstitution$2;
|
|
4492
|
-
var wellKnownSymbol$7 = wellKnownSymbol$k;
|
|
4493
|
-
|
|
4494
|
-
var REPLACE = wellKnownSymbol$7('replace');
|
|
4495
|
-
var $TypeError$7 = TypeError;
|
|
4496
|
-
var indexOf = uncurryThis$6(''.indexOf);
|
|
4497
|
-
uncurryThis$6(''.replace);
|
|
4498
|
-
var stringSlice$1 = uncurryThis$6(''.slice);
|
|
4499
|
-
var max = Math.max;
|
|
4500
|
-
|
|
4501
|
-
var stringIndexOf = function (string, searchValue, fromIndex) {
|
|
4502
|
-
if (fromIndex > string.length) return -1;
|
|
4503
|
-
if (searchValue === '') return fromIndex;
|
|
4504
|
-
return indexOf(string, searchValue, fromIndex);
|
|
4505
|
-
};
|
|
4506
|
-
|
|
4507
|
-
// `String.prototype.replaceAll` method
|
|
4508
|
-
// https://tc39.es/ecma262/#sec-string.prototype.replaceall
|
|
4509
|
-
$$b({ target: 'String', proto: true }, {
|
|
4510
|
-
replaceAll: function replaceAll(searchValue, replaceValue) {
|
|
4511
|
-
var O = requireObjectCoercible$1(this);
|
|
4512
|
-
var IS_REG_EXP, flags, replacer, string, searchString, functionalReplace, searchLength, advanceBy, replacement;
|
|
4513
|
-
var position = 0;
|
|
4514
|
-
var endOfLastMatch = 0;
|
|
4515
|
-
var result = '';
|
|
4516
|
-
if (!isNullOrUndefined$3(searchValue)) {
|
|
4517
|
-
IS_REG_EXP = isRegExp(searchValue);
|
|
4518
|
-
if (IS_REG_EXP) {
|
|
4519
|
-
flags = toString$4(requireObjectCoercible$1(getRegExpFlags$1(searchValue)));
|
|
4520
|
-
if (!~indexOf(flags, 'g')) throw $TypeError$7('`.replaceAll` does not allow non-global regexes');
|
|
4521
|
-
}
|
|
4522
|
-
replacer = getMethod$3(searchValue, REPLACE);
|
|
4523
|
-
if (replacer) {
|
|
4524
|
-
return call$8(replacer, searchValue, O, replaceValue);
|
|
4525
|
-
}
|
|
4526
|
-
}
|
|
4527
|
-
string = toString$4(O);
|
|
4528
|
-
searchString = toString$4(searchValue);
|
|
4529
|
-
functionalReplace = isCallable$6(replaceValue);
|
|
4530
|
-
if (!functionalReplace) replaceValue = toString$4(replaceValue);
|
|
4531
|
-
searchLength = searchString.length;
|
|
4532
|
-
advanceBy = max(1, searchLength);
|
|
4533
|
-
position = stringIndexOf(string, searchString, 0);
|
|
4534
|
-
while (position !== -1) {
|
|
4535
|
-
replacement = functionalReplace
|
|
4536
|
-
? toString$4(replaceValue(searchString, position, string))
|
|
4537
|
-
: getSubstitution(searchString, string, position, [], undefined, replaceValue);
|
|
4538
|
-
result += stringSlice$1(string, endOfLastMatch, position) + replacement;
|
|
4539
|
-
endOfLastMatch = position + searchLength;
|
|
4540
|
-
position = stringIndexOf(string, searchString, position + advanceBy);
|
|
4541
|
-
}
|
|
4542
|
-
if (endOfLastMatch < string.length) {
|
|
4543
|
-
result += stringSlice$1(string, endOfLastMatch);
|
|
4544
|
-
}
|
|
4545
|
-
return result;
|
|
4546
|
-
}
|
|
4547
|
-
});
|
|
4548
|
-
|
|
4549
|
-
// TODO: Quick Fix for White Label; The navigator object cannot be accessed from within SSR,
|
|
4550
|
-
// so this provides default value until this feature can be refactored to support SSR.
|
|
4551
|
-
let _LOCALE = "en-US";
|
|
4552
|
-
try {
|
|
4553
|
-
_LOCALE = navigator.language;
|
|
4554
|
-
} catch (_a) {}
|
|
4555
|
-
const loadableLocale = _LOCALE.replaceAll("-", "");
|
|
4556
|
-
const loadableBackupLocale = _LOCALE.split("-")[0];
|
|
4557
|
-
let intlLocale = undefined;
|
|
4558
|
-
if (loadableLocale in Locales || loadableBackupLocale) {
|
|
4559
|
-
const targetLocale = loadableLocale in Locales ? loadableLocale : loadableBackupLocale;
|
|
4560
|
-
const l = Locales[targetLocale];
|
|
4561
|
-
registerLocale(_LOCALE, l);
|
|
4562
|
-
intlLocale = l;
|
|
4563
|
-
setDefaultLocale(_LOCALE);
|
|
4564
|
-
} else {
|
|
4565
|
-
// Really should never happen but this SHOULD revert to un-localized
|
|
4566
|
-
console.log(`User's navigator.language locale ${_LOCALE} could not be loaded because it was not found in date-fns.
|
|
4567
|
-
Backup attempt to load ${loadableBackupLocale} failed as well.
|
|
4568
|
-
Reverting to en-US.`);
|
|
4569
|
-
_LOCALE = "en-US";
|
|
4570
|
-
}
|
|
4571
|
-
const usaLocale = Locales["enUS"];
|
|
4572
|
-
const LOCALE = _LOCALE;
|
|
4573
|
-
/**
|
|
4574
|
-
* Parse a string in the CURRENT locale into a Date object.
|
|
4575
|
-
* current locale is determined by navigator.language for now
|
|
4576
|
-
* @param dateString
|
|
4577
|
-
*/
|
|
4578
|
-
const parseLocaleDate = dateString => dateString ? parse(dateString, "P", new Date(), intlLocale ? {
|
|
4579
|
-
locale: intlLocale
|
|
4580
|
-
} : undefined) : null;
|
|
4581
|
-
const parseUSADate = dateString => dateString ? parse(dateString, "P", new Date(), {
|
|
4582
|
-
locale: usaLocale
|
|
4583
|
-
}) : null;
|
|
4584
|
-
/**
|
|
4585
|
-
*
|
|
4586
|
-
* Format a date into a string in the CURRENT locale.
|
|
4587
|
-
* current locale is determined by navigator.language for now
|
|
4588
|
-
* @param date
|
|
4589
|
-
*/
|
|
4590
|
-
const formatLocaleDate = date => date ? format(date, "P", {
|
|
4591
|
-
locale: intlLocale
|
|
4592
|
-
}) : null;
|
|
4593
|
-
const formatUSADate = date => date ? format(date, "P", {
|
|
4594
|
-
locale: usaLocale
|
|
4595
|
-
}) : null;
|
|
4596
|
-
|
|
4597
4617
|
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)."; }
|
|
4598
4618
|
const getPopperStyles = theme => /*#__PURE__*/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== */");
|
|
4599
4619
|
const getWrapperStyles = theme => /*#__PURE__*/css(process.env.NODE_ENV === "production" ? {
|
|
@@ -4610,28 +4630,30 @@ const DatePickerController = createFieldController();
|
|
|
4610
4630
|
// Look, react-datepicker and webpack really don't get along.
|
|
4611
4631
|
const ReactDatePicker = RDP.default.default || RDP.default || RDP;
|
|
4612
4632
|
const DatePicker = fieldProps => {
|
|
4613
|
-
const
|
|
4633
|
+
const {
|
|
4634
|
+
locale: alchemyLocale
|
|
4635
|
+
} = useAlchemy();
|
|
4636
|
+
const rdpLocaleData = findDateLocale(alchemyLocale);
|
|
4637
|
+
const dateFormat = getlocaleDateStringFormat(alchemyLocale);
|
|
4614
4638
|
const theme = useTheme();
|
|
4615
4639
|
const datePickerRef = useRef(null);
|
|
4616
4640
|
return jsx(DatePickerController, Object.assign({}, fieldProps, {
|
|
4617
4641
|
children: _a => {
|
|
4618
4642
|
var _datePickerProps = __rest(_a, ["ref"]);
|
|
4619
|
-
// Lens the form's usa date string into a locale date string
|
|
4620
|
-
// for the now localized date picker
|
|
4621
4643
|
const onChange = date => {
|
|
4622
4644
|
var _a;
|
|
4623
|
-
|
|
4645
|
+
const formattedDate = formatByDateAndLocale(date, alchemyLocale, dateFormat);
|
|
4646
|
+
(_a = _datePickerProps.onChange) === null || _a === void 0 ? void 0 : _a.call(_datePickerProps, formattedDate);
|
|
4624
4647
|
};
|
|
4625
|
-
const value = formatLocaleDate(parseUSADate(_datePickerProps.value));
|
|
4626
4648
|
const datePickerProps = Object.assign(Object.assign({}, _datePickerProps), {
|
|
4627
4649
|
onChange,
|
|
4628
|
-
value
|
|
4650
|
+
value: _datePickerProps.value
|
|
4629
4651
|
});
|
|
4630
4652
|
return jsx("div", Object.assign({
|
|
4631
4653
|
css: getOverrideStyles(theme)
|
|
4632
4654
|
}, {
|
|
4633
4655
|
children: jsx(ReactDatePicker, Object.assign({
|
|
4634
|
-
locale:
|
|
4656
|
+
locale: rdpLocaleData
|
|
4635
4657
|
}, datePickerProps, {
|
|
4636
4658
|
customInput: /*#__PURE__*/createElement$2( /*#__PURE__*/forwardRef(function InputWrapper(_a, forwardedRef) {
|
|
4637
4659
|
var _b;
|
|
@@ -4666,24 +4688,24 @@ const DatePicker = fieldProps => {
|
|
|
4666
4688
|
return (_a = datePickerRef.current) === null || _a === void 0 ? void 0 : _a.setOpen(!datePickerRef.current.isCalendarOpen());
|
|
4667
4689
|
}
|
|
4668
4690
|
}),
|
|
4669
|
-
value: isFocused || value !==
|
|
4691
|
+
value: isFocused || value !== new Date().toLocaleDateString(alchemyLocale, {
|
|
4692
|
+
day: "2-digit",
|
|
4693
|
+
month: "2-digit",
|
|
4694
|
+
year: "numeric"
|
|
4695
|
+
}) ? value : datePickerProps.placeholderText
|
|
4670
4696
|
}));
|
|
4671
4697
|
})),
|
|
4672
4698
|
"data-testid": fieldProps.name ? camelize(fieldProps.name) : "date",
|
|
4699
|
+
dateFormat: dateFormat,
|
|
4673
4700
|
onCalendarOpen: () => {
|
|
4674
4701
|
var _a;
|
|
4675
4702
|
return (_a = datePickerRef.current) === null || _a === void 0 ? void 0 : _a.setFocus();
|
|
4676
4703
|
},
|
|
4677
|
-
onChange: (date, event) => {
|
|
4678
|
-
var _a;
|
|
4679
|
-
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
4680
|
-
(_a = datePickerProps.onChange) === null || _a === void 0 ? void 0 : _a.call(datePickerProps, date ? formatLocaleDate(date) : null);
|
|
4681
|
-
},
|
|
4682
4704
|
popperClassName: getPopperStyles(theme),
|
|
4683
4705
|
popperPlacement: "bottom-end",
|
|
4684
4706
|
preventOpenOnFocus: true,
|
|
4685
4707
|
ref: datePickerRef,
|
|
4686
|
-
selected: parseLocaleDate(datePickerProps.value),
|
|
4708
|
+
selected: parseLocaleDate(datePickerProps.value, alchemyLocale),
|
|
4687
4709
|
showPopperArrow: false,
|
|
4688
4710
|
wrapperClassName: getWrapperStyles()
|
|
4689
4711
|
}))
|
|
@@ -5590,6 +5612,9 @@ const RateCard = ({
|
|
|
5590
5612
|
const {
|
|
5591
5613
|
t
|
|
5592
5614
|
} = useTranslation(["common", "purchase-label", "void-label"]);
|
|
5615
|
+
const {
|
|
5616
|
+
locale: defaultLocale
|
|
5617
|
+
} = useAlchemy();
|
|
5593
5618
|
// determines if there is any action that needs to happen upon clicking an unselected Rate
|
|
5594
5619
|
const onClickAvailable = !!onClick && !_selected && rateId;
|
|
5595
5620
|
const onRateCardClick = () => onClickAvailable && onClick(rateId);
|
|
@@ -5657,7 +5682,7 @@ const RateCard = ({
|
|
|
5657
5682
|
}, {
|
|
5658
5683
|
children: carrierNickname
|
|
5659
5684
|
})), voidedAt && jsx(Typography, {
|
|
5660
|
-
children: `${t("void-label:voidedOn")} ${formatDateDDMMYY(voidedAt)}`
|
|
5685
|
+
children: `${t("void-label:voidedOn")} ${formatDateDDMMYY(voidedAt, defaultLocale)}`
|
|
5661
5686
|
}), deliveryDays && jsx(Typography, {
|
|
5662
5687
|
children: getDeliveryDaysLabel(deliveryDays)
|
|
5663
5688
|
}), children]
|
|
@@ -8443,6 +8468,9 @@ const DateRangeCombo = ({
|
|
|
8443
8468
|
const {
|
|
8444
8469
|
t
|
|
8445
8470
|
} = useTranslation();
|
|
8471
|
+
const {
|
|
8472
|
+
locale: defaultLocale
|
|
8473
|
+
} = useAlchemy();
|
|
8446
8474
|
const handleChangeSelected = nextOption => {
|
|
8447
8475
|
void (onChange === null || onChange === void 0 ? void 0 : onChange(nextOption, customRange));
|
|
8448
8476
|
};
|
|
@@ -8460,10 +8488,10 @@ const DateRangeCombo = ({
|
|
|
8460
8488
|
children: [jsx(Spacer, {
|
|
8461
8489
|
multiplier: 2
|
|
8462
8490
|
}), jsx(DatePicker$1, {
|
|
8463
|
-
dateFormat:
|
|
8491
|
+
dateFormat: getlocaleDateStringFormat(defaultLocale),
|
|
8464
8492
|
isClearable: true,
|
|
8465
8493
|
label: t("wallet-history:actions.chooseDate"),
|
|
8466
|
-
locale:
|
|
8494
|
+
locale: defaultLocale,
|
|
8467
8495
|
maxDate: new Date(),
|
|
8468
8496
|
onClickConfirm: dates => {
|
|
8469
8497
|
if (Array.isArray(dates) && dates.length === 2 && dates[1] !== null) handleConfirmCustomRange(dates);
|
|
@@ -9087,9 +9115,12 @@ const CellFormattedDate = ({
|
|
|
9087
9115
|
date,
|
|
9088
9116
|
short
|
|
9089
9117
|
}) => {
|
|
9118
|
+
const {
|
|
9119
|
+
locale: defaultLocale
|
|
9120
|
+
} = useAlchemy();
|
|
9090
9121
|
return jsx("div", {
|
|
9091
9122
|
children: jsx("div", {
|
|
9092
|
-
children: short ? formatDateDDMMYY(date) : formatDate(date)
|
|
9123
|
+
children: short ? formatDateDDMMYY(date, defaultLocale) : formatDate(date, defaultLocale)
|
|
9093
9124
|
})
|
|
9094
9125
|
});
|
|
9095
9126
|
};
|
|
@@ -15093,7 +15124,6 @@ const ProductsDisplay = ({
|
|
|
15093
15124
|
|
|
15094
15125
|
extendZod();
|
|
15095
15126
|
const getShipmentSchema = ({
|
|
15096
|
-
allowInternationalShipFrom,
|
|
15097
15127
|
dimensionsUnit,
|
|
15098
15128
|
isContentDescriptionRequired: _isContentDescriptionRequired = false,
|
|
15099
15129
|
isCustomsRequired: _isCustomsRequired = false,
|
|
@@ -15128,14 +15158,21 @@ const getShipmentSchema = ({
|
|
|
15128
15158
|
insuredValue: moneySchema.extend({
|
|
15129
15159
|
amount: z.number().positive()
|
|
15130
15160
|
}).optional(),
|
|
15131
|
-
products: z.object({
|
|
15161
|
+
products: _isCustomsRequired ? z.object({
|
|
15162
|
+
countryOfOrigin: z.string().nullishDefault(undefined),
|
|
15163
|
+
description: z.string().nullishDefault(undefined),
|
|
15164
|
+
harmonizedTariffCode: z.string().nullishDefault(undefined),
|
|
15165
|
+
productId: z.string().nullishDefault(undefined),
|
|
15166
|
+
quantity: z.number().int(),
|
|
15167
|
+
value: moneySchema
|
|
15168
|
+
}).array().min(1) : z.object({
|
|
15132
15169
|
countryOfOrigin: z.string().nullishDefault(undefined),
|
|
15133
15170
|
description: z.string().nullishDefault(undefined),
|
|
15134
15171
|
harmonizedTariffCode: z.string().nullishDefault(undefined),
|
|
15135
15172
|
productId: z.string().nullishDefault(undefined),
|
|
15136
15173
|
quantity: z.number().int(),
|
|
15137
15174
|
value: moneySchema
|
|
15138
|
-
}).array().
|
|
15175
|
+
}).array().nullish(),
|
|
15139
15176
|
type: z.object({
|
|
15140
15177
|
carrierId: z.string().nullish(),
|
|
15141
15178
|
code: z.string().nullish()
|
|
@@ -15157,10 +15194,7 @@ const getShipmentSchema = ({
|
|
|
15157
15194
|
}).nullish(),
|
|
15158
15195
|
shipDate: z.string(),
|
|
15159
15196
|
shipmentId: z.string().nullishDefault(undefined),
|
|
15160
|
-
warehouseId: z.string().refine(warehouseId => !!warehouseId, "purchase-label:schemaErrors.shipFromAddressRequired")
|
|
15161
|
-
var _a;
|
|
15162
|
-
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";
|
|
15163
|
-
}, "purchase-label:schemaErrors.shipFromUnitedStatesOnly")
|
|
15197
|
+
warehouseId: z.string().refine(warehouseId => !!warehouseId, "purchase-label:schemaErrors.shipFromAddressRequired")
|
|
15164
15198
|
});
|
|
15165
15199
|
const browseRatesSchema = baseSchema.extend({
|
|
15166
15200
|
__mode: z.literal("browse_rates")
|
|
@@ -15204,7 +15238,7 @@ const getShipmentSchema = ({
|
|
|
15204
15238
|
carrierId: (_b = schema.carrierId) !== null && _b !== void 0 ? _b : undefined,
|
|
15205
15239
|
// Clear customs if not required
|
|
15206
15240
|
customs: _isCustomsRequired ? schema.customs : undefined,
|
|
15207
|
-
packages: [Object.assign(Object.assign(Object.assign({}, pkg), !_requireMeasurements && !((_c = pkg.weight) === null || _c === void 0 ? void 0 : _c.value) && {
|
|
15241
|
+
packages: [Object.assign(Object.assign(Object.assign(Object.assign({}, pkg), !_requireMeasurements && !((_c = pkg.weight) === null || _c === void 0 ? void 0 : _c.value) && {
|
|
15208
15242
|
weight: {
|
|
15209
15243
|
unit: "ounce",
|
|
15210
15244
|
value: 16
|
|
@@ -15217,6 +15251,9 @@ const getShipmentSchema = ({
|
|
|
15217
15251
|
} : {
|
|
15218
15252
|
// set the value for packageId if it doesn't have a carrier (custom package)
|
|
15219
15253
|
packageId: code
|
|
15254
|
+
}), {
|
|
15255
|
+
// Clear products if customs not required
|
|
15256
|
+
products: _isCustomsRequired ? schema.packages[0].products : []
|
|
15220
15257
|
})],
|
|
15221
15258
|
serviceCode: (_d = service === null || service === void 0 ? void 0 : service.serviceCode) !== null && _d !== void 0 ? _d : undefined
|
|
15222
15259
|
});
|
|
@@ -15263,6 +15300,9 @@ const ShipmentForm = ({
|
|
|
15263
15300
|
const {
|
|
15264
15301
|
t
|
|
15265
15302
|
} = useTranslation(["purchase-label"]);
|
|
15303
|
+
const {
|
|
15304
|
+
locale: defaultLocale
|
|
15305
|
+
} = useAlchemy();
|
|
15266
15306
|
const [requireMeasurements, setRequireMeasurements] = useState(true);
|
|
15267
15307
|
const [insuranceEnabled, setInsuranceEnabled] = useState(false);
|
|
15268
15308
|
const {
|
|
@@ -15287,7 +15327,7 @@ const ShipmentForm = ({
|
|
|
15287
15327
|
const form = useForm({
|
|
15288
15328
|
defaultValues: {
|
|
15289
15329
|
__mode: features.browseRates ? "browse_rates" : "select_service",
|
|
15290
|
-
shipDate:
|
|
15330
|
+
shipDate: formatByDateAndLocale(minimumShipDate || new Date(), defaultLocale)
|
|
15291
15331
|
},
|
|
15292
15332
|
resolver: validationResolver(shipmentSchema)
|
|
15293
15333
|
});
|
|
@@ -15419,11 +15459,11 @@ const ShipmentForm = ({
|
|
|
15419
15459
|
carrierId: updatedShipment.carrierId,
|
|
15420
15460
|
serviceCode: updatedShipment.serviceCode
|
|
15421
15461
|
} : undefined,
|
|
15422
|
-
shipDate:
|
|
15462
|
+
shipDate: formatByDateAndLocale(mostRecent(omitTime(updatedShipment.shipDate), minimumShipDate), defaultLocale),
|
|
15423
15463
|
shipmentId: updatedShipment.shipmentId,
|
|
15424
15464
|
warehouseId: updatedShipment.warehouseId
|
|
15425
15465
|
}));
|
|
15426
|
-
}, [findCustomPackage, form, isCustomsRequired, isContentDescriptionRequired]);
|
|
15466
|
+
}, [findCustomPackage, form, isCustomsRequired, isContentDescriptionRequired, defaultLocale]);
|
|
15427
15467
|
// Allow us to imperatively trigger hydrateShipment from parent component
|
|
15428
15468
|
hydrateRef.current = hydrateShipment;
|
|
15429
15469
|
// Hydrate only the products portion of the shipment form
|
|
@@ -15442,10 +15482,23 @@ const ShipmentForm = ({
|
|
|
15442
15482
|
try {
|
|
15443
15483
|
const _m = values,
|
|
15444
15484
|
{
|
|
15445
|
-
__mode: discard
|
|
15485
|
+
__mode: discard,
|
|
15486
|
+
shipDate: payloadShipDate
|
|
15446
15487
|
} = _m,
|
|
15447
|
-
payload = __rest(_m, ["__mode"]);
|
|
15448
|
-
|
|
15488
|
+
payload = __rest(_m, ["__mode", "shipDate"]);
|
|
15489
|
+
let shipDate = payloadShipDate;
|
|
15490
|
+
if (defaultLocale !== "en-US") {
|
|
15491
|
+
// formate shipDate to en-US format before updating the shipment
|
|
15492
|
+
const date = parseLocaleDate(shipDate, defaultLocale);
|
|
15493
|
+
shipDate = formatByDateAndLocale(date, "en-US", "MM/dd/yyyy");
|
|
15494
|
+
}
|
|
15495
|
+
const updatedShipment = yield onSubmit(
|
|
15496
|
+
// using mergeWith to get a deep merge and also respect undefined values
|
|
15497
|
+
_$3.mergeWith(shipment, payload, (objValue, srcValue, key, obj) => {
|
|
15498
|
+
if (objValue !== srcValue && typeof srcValue === "undefined") {
|
|
15499
|
+
obj[key] = srcValue;
|
|
15500
|
+
}
|
|
15501
|
+
}));
|
|
15449
15502
|
// Defer shipment hydration to the task queue so that the submission promise resolves first, otherwise the
|
|
15450
15503
|
// submission count will increment after hydration resets the form, keeping it in revalidate mode
|
|
15451
15504
|
if (updatedShipment) setTimeout(() => hydrateShipment(updatedShipment), 0);
|
|
@@ -15586,7 +15639,6 @@ const ShipmentForm = ({
|
|
|
15586
15639
|
});
|
|
15587
15640
|
if (!shipment) throw new Error("errorMessages.unableToLoad.shipment");
|
|
15588
15641
|
const addressPreferenceIsEmpty = !addressLoading && isEmptyAddress(addressPreference === null || addressPreference === void 0 ? void 0 : addressPreference.selection); // undefined means it's still loading
|
|
15589
|
-
console.log(addressLoading || isEditShipFormToOpen || addressPreferenceIsEmpty);
|
|
15590
15642
|
return jsxs("form", Object.assign({
|
|
15591
15643
|
id: "shipment-form",
|
|
15592
15644
|
onSubmit: formLogger.capture(handleSubmit)
|
|
@@ -15652,7 +15704,7 @@ const ShipmentForm = ({
|
|
|
15652
15704
|
children: [jsx(Typography, Object.assign({
|
|
15653
15705
|
variant: "body2"
|
|
15654
15706
|
}, {
|
|
15655
|
-
children: formatDate(salesOrder.orderDate)
|
|
15707
|
+
children: formatDate(salesOrder.orderDate, defaultLocale)
|
|
15656
15708
|
})), jsx(Spacer, {})]
|
|
15657
15709
|
})), ((_d = salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.paymentDetails) === null || _d === void 0 ? void 0 : _d.grandTotal) && jsxs(FieldLabel, Object.assign({
|
|
15658
15710
|
label: t("purchase-label:fields.orderValue")
|
|
@@ -17004,20 +17056,23 @@ const usePendingShipment = ({
|
|
|
17004
17056
|
const customsFromSalesOrder = getCustomsFromSalesOrder(salesOrder, defaultWarehouse);
|
|
17005
17057
|
try {
|
|
17006
17058
|
setIsCreatingShipment(true);
|
|
17059
|
+
const isCustomsRequired = getIsCustomsRequiredForSalesOrder(salesOrder, defaultWarehouse);
|
|
17007
17060
|
const shipment = yield createShipment(Object.assign(Object.assign({
|
|
17008
17061
|
salesOrderId: salesOrder.salesOrderId,
|
|
17009
17062
|
warehouseId: defaultWarehouse.warehouseId
|
|
17010
|
-
},
|
|
17063
|
+
}, isCustomsRequired && {
|
|
17011
17064
|
customs: customsFromSalesOrder.customs
|
|
17012
17065
|
}), {
|
|
17013
|
-
packages: [{
|
|
17014
|
-
packageCode: "package"
|
|
17015
|
-
|
|
17066
|
+
packages: [Object.assign(Object.assign({
|
|
17067
|
+
packageCode: "package"
|
|
17068
|
+
}, isCustomsRequired && {
|
|
17069
|
+
products: customsFromSalesOrder.products
|
|
17070
|
+
}), {
|
|
17016
17071
|
weight: {
|
|
17017
17072
|
unit: "pound",
|
|
17018
17073
|
value: 0
|
|
17019
17074
|
}
|
|
17020
|
-
}]
|
|
17075
|
+
})]
|
|
17021
17076
|
}));
|
|
17022
17077
|
if (shipment) {
|
|
17023
17078
|
yield reloadShipments();
|
|
@@ -18225,6 +18280,19 @@ const Component$4 = _a => {
|
|
|
18225
18280
|
const {
|
|
18226
18281
|
data: fundingSource
|
|
18227
18282
|
} = useListFundingSources();
|
|
18283
|
+
const {
|
|
18284
|
+
locale: alchemyLocale
|
|
18285
|
+
} = useAlchemy();
|
|
18286
|
+
const defaultLocale = alchemyLocale !== null && alchemyLocale !== void 0 ? alchemyLocale : "en-US";
|
|
18287
|
+
const locale = findDateLocale(alchemyLocale);
|
|
18288
|
+
/**
|
|
18289
|
+
* Registers the alchemy locale for React Date Picker for use in the
|
|
18290
|
+
* Date Picker component. React Date Picker uses date-fns internationalization
|
|
18291
|
+
* to localize its display components. By default, the date picker will use the
|
|
18292
|
+
* locale globally set, which is English.
|
|
18293
|
+
*/
|
|
18294
|
+
registerLocale(defaultLocale, locale);
|
|
18295
|
+
setDefaultLocale(defaultLocale);
|
|
18228
18296
|
const currency = getCurrencyFromString((_b = fundingSource === null || fundingSource === void 0 ? void 0 : fundingSource[0]) === null || _b === void 0 ? void 0 : _b.currencyCode);
|
|
18229
18297
|
const incompleteRequirementsKeys = useMemo(() => {
|
|
18230
18298
|
const isMissingWarehouse = (warehouses === null || warehouses === void 0 ? void 0 : warehouses.length) === 0;
|
|
@@ -18466,6 +18534,9 @@ const Shipment = ({
|
|
|
18466
18534
|
const {
|
|
18467
18535
|
t
|
|
18468
18536
|
} = useTranslation(["common", "view-shipment"]);
|
|
18537
|
+
const {
|
|
18538
|
+
locale: defaultLocale
|
|
18539
|
+
} = useAlchemy();
|
|
18469
18540
|
const [showItems, setShowItems] = useState(false);
|
|
18470
18541
|
const {
|
|
18471
18542
|
confirmation: deliveryConfirmation,
|
|
@@ -18498,7 +18569,7 @@ const Shipment = ({
|
|
|
18498
18569
|
"data-testid": "shipDate",
|
|
18499
18570
|
label: t("view-shipment:fields.shipDate")
|
|
18500
18571
|
}, {
|
|
18501
|
-
children: [formatDate(omitTime(shipment.shipDate).toISOString()), jsx(Spacer, {})]
|
|
18572
|
+
children: [formatDate(omitTime(shipment.shipDate).toISOString(), defaultLocale), jsx(Spacer, {})]
|
|
18502
18573
|
})), jsxs(FieldLabel, Object.assign({
|
|
18503
18574
|
"data-testid": "shipFrom",
|
|
18504
18575
|
label: t("view-shipment:fields.warehouse")
|
|
@@ -18515,7 +18586,7 @@ const Shipment = ({
|
|
|
18515
18586
|
"data-testid": "orderDate",
|
|
18516
18587
|
label: t("view-shipment:fields.orderDate")
|
|
18517
18588
|
}, {
|
|
18518
|
-
children: [salesOrder ? formatDate(salesOrder.orderDate) : t("loading.salesOrder"), jsx(Spacer, {})]
|
|
18589
|
+
children: [salesOrder ? formatDate(salesOrder.orderDate, defaultLocale) : t("loading.salesOrder"), jsx(Spacer, {})]
|
|
18519
18590
|
})), hasSalesOrder && jsxs(FieldLabel, Object.assign({
|
|
18520
18591
|
"data-testid": "orderValue",
|
|
18521
18592
|
label: t("view-shipment:fields.orderValue")
|
|
@@ -20661,4 +20732,4 @@ var onboarding = /*#__PURE__*/Object.freeze({
|
|
|
20661
20732
|
Element: Element
|
|
20662
20733
|
});
|
|
20663
20734
|
|
|
20664
|
-
export { accountSettings as AccountSettings, AddFundsForm, AutoFundingForm, ButtonGroup, CarrierBalance, CarrierIcon, CarrierLogo, CellFormattedDate, CollapsiblePanel, CopyButton, Country, Cube, DateRangeCombo, DateRangeSelect, DisplayTerm, Drawer, ErrorFallback, fields as Field, FieldLabel, FormPortal, FundAndPurchase, GridController, InlineLabel, ItemsBreakdown, labelWorkflow as LabelWorkflow, LinkAction, listCarriers$1 as ListCarriers, Loader, ManageFunding, manageWarehouses$1 as ManageWarehouses, onboarding as Onboarding, PageLayoutProvider, Pager, PaymentMethodSettings, Portal, PoweredByShipEngine, purchaseLabel as PurchaseLabel, RootPortalProvider, Section, Spacer, Spread, StoryNotes, Tabs, themeCreator as ThemeCreator, ThemeCreatorProvider, UsState, UsaCity, viewShipment as ViewShipment, voidLabel as VoidLabel, addSpaceBetweenWords, assert, autoFundingSchema, calculateTotal, capitalizeFirstLetter, convertDecimalWeightToFractionalWeight, convertDimensions, convertFractionalWeightToDecimalWeight, convertPoundsAndOuncesToOunces, convertWeight, countries, countryCodes, createCodedErrors, createDictionary, createStyles, currencySymbol, daysAfter, errorMap, euCountryCodes, extendZod, featureFlagComponentNameLookup, featureFlags, formLogger, formatCreditCardNumber, formatDate, formatDateDDMMYY, formatDimensions, formatExpiration, formatFractionalWeight, formatMoney, getAddFundsSchema, getCancelledShipment, getCarrierIdByCarrierCode, getCurrencyFromString, getCurrencySymbolFromString, getCustomsFromSalesOrder, getExpirationYears, getFeatures, getIsCustomsRequiredForSalesOrder, getIsCustomsRequiredForShipment, getIsInternationalShipment, getPendingShipment, getRateRequiresAcknowledgement, getRelativeDates, getRequestedServices, getSalesOrderItemsFromSalesOrderOrShipment, getShipmentByStatus, getTotalRateAmount, isDecimalWeight, isDomesticAddress, isEmptyAddress, isFlatRatePackageCode, isMetricWeightUnit, isMilitaryAddress, isNowOrInTheFuture, isPoBox, isPoBoxAddress, isString, isUnitedStatesTerritory, isUnsupportedByUps, isUpsCarrier, isUspsCarrier, moneySchema, mostRecent, nextDayCutoff, omitTime, overrideCarrierCodes$1 as overrideCarrierCodes, pascalize, phoneSchema, phoneSchemaUnvalidated, postalCodeRegex$3 as postalCodeRegex, raise, sortByCreationDate, throwAny, throwJoinedMessages, usCities, usStateCodes, usStates, useAddressValidation, useBlackboxDetection, useCarrierMetadata, useConfirmationOptions, useCountryCodeOptions, useCustomsContentsOptions, useCustomsNonDeliveryOptions, useDateRangeOptions, useExpirationMonthOptions, useFeatures, useInsuranceProviderOptions, useNestedForm, usePackageOptions, usePageLayout, usePager, useRateOptions, useRootPortal, useRunOnceOnTrue, useScrubErrors, useServiceCodeOptions, useShipmentMetadata, useShippingPresetsOptions, useStateCodeOptions, useThemeCreator, useToggle, useWarehouseOptions, validationResolver };
|
|
20735
|
+
export { accountSettings as AccountSettings, AddFundsForm, AutoFundingForm, ButtonGroup, CarrierBalance, CarrierIcon, CarrierLogo, CellFormattedDate, CollapsiblePanel, CopyButton, Country, Cube, DateRangeCombo, DateRangeSelect, DisplayTerm, Drawer, ErrorFallback, fields as Field, FieldLabel, FormPortal, FundAndPurchase, GridController, InlineLabel, ItemsBreakdown, labelWorkflow as LabelWorkflow, LinkAction, listCarriers$1 as ListCarriers, Loader, ManageFunding, manageWarehouses$1 as ManageWarehouses, onboarding as Onboarding, PageLayoutProvider, Pager, PaymentMethodSettings, Portal, PoweredByShipEngine, purchaseLabel as PurchaseLabel, RootPortalProvider, Section, Spacer, Spread, StoryNotes, Tabs, themeCreator as ThemeCreator, ThemeCreatorProvider, UsState, UsaCity, viewShipment as ViewShipment, voidLabel as VoidLabel, addSpaceBetweenWords, assert, autoFundingSchema, calculateTotal, capitalizeFirstLetter, convertDecimalWeightToFractionalWeight, convertDimensions, convertFractionalWeightToDecimalWeight, convertPoundsAndOuncesToOunces, convertWeight, countries, countryCodes, createCodedErrors, createDictionary, createStyles, currencySymbol, daysAfter, errorMap, euCountryCodes, extendZod, featureFlagComponentNameLookup, featureFlags, findDateLocale, formLogger, formatByDateAndLocale, formatCreditCardNumber, formatDate, formatDateDDMMYY, formatDateDDMMYYYY, formatDimensions, formatExpiration, formatFractionalWeight, formatMoney, getAddFundsSchema, getCancelledShipment, getCarrierIdByCarrierCode, getCurrencyFromString, getCurrencySymbolFromString, getCustomsFromSalesOrder, getExpirationYears, getFeatures, getIsCustomsRequiredForSalesOrder, getIsCustomsRequiredForShipment, getIsInternationalShipment, getPendingShipment, getRateRequiresAcknowledgement, getRelativeDates, getRequestedServices, getSalesOrderItemsFromSalesOrderOrShipment, getShipmentByStatus, getTotalRateAmount, getlocaleDateStringFormat, isDecimalWeight, isDomesticAddress, isEmptyAddress, isFlatRatePackageCode, isMetricWeightUnit, isMilitaryAddress, isNowOrInTheFuture, isPoBox, isPoBoxAddress, isString, isUnitedStatesTerritory, isUnsupportedByUps, isUpsCarrier, isUspsCarrier, moneySchema, mostRecent, nextDayCutoff, omitTime, overrideCarrierCodes$1 as overrideCarrierCodes, parseLocaleDate, pascalize, phoneSchema, phoneSchemaUnvalidated, postalCodeRegex$3 as postalCodeRegex, raise, sortByCreationDate, throwAny, throwJoinedMessages, usCities, usStateCodes, usStates, useAddressValidation, useBlackboxDetection, useCarrierMetadata, useConfirmationOptions, useCountryCodeOptions, useCustomsContentsOptions, useCustomsNonDeliveryOptions, useDateRangeOptions, useExpirationMonthOptions, useFeatures, useInsuranceProviderOptions, useNestedForm, usePackageOptions, usePageLayout, usePager, useRateOptions, useRootPortal, useRunOnceOnTrue, useScrubErrors, useServiceCodeOptions, useShipmentMetadata, useShippingPresetsOptions, useStateCodeOptions, useThemeCreator, useToggle, useWarehouseOptions, validationResolver };
|