@shipengine/elements 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +2019 -577
- package/index.js +2012 -578
- package/package.json +1 -1
- package/src/components/add-funds-form/add-funds-form.d.ts +20 -2
- package/src/components/add-funds-form/add-funds-schema.d.ts +26 -0
- package/src/components/address-preference-context/address-preference-context.d.ts +8 -0
- package/src/components/auto-funding-form/auto-funding-form.d.ts +22 -0
- package/src/components/auto-funding-form/auto-funding-schema.d.ts +17 -0
- package/src/components/button-group/button-group.d.ts +29 -0
- package/src/components/carrier-balance/carrier-balance.d.ts +23 -0
- package/src/components/collapsible-panel/collapsible-panel.d.ts +32 -0
- package/src/components/copy/copy-button.d.ts +4 -0
- package/src/components/cube/cube.d.ts +16 -0
- package/src/components/date-range-combo/date-range-combo.d.ts +14 -0
- package/src/components/date-range-select/date-range-select.d.ts +6 -0
- package/src/components/error-fallback/error-fallback.d.ts +12 -1
- package/src/components/field-label/field-label.d.ts +10 -0
- package/src/components/form-portal/form-portal.d.ts +9 -0
- package/src/components/fund-and-purchase/fund-and-purchase.d.ts +13 -0
- package/src/components/inline-label/inline-label.d.ts +10 -0
- package/src/components/items-breakdown/items-breakdown.d.ts +15 -0
- package/src/components/label-layout/label-layout.d.ts +5 -0
- package/src/components/link-action/link-action.d.ts +10 -0
- package/src/components/loader/loader.d.ts +5 -0
- package/src/components/manage-funding/manage-funding.d.ts +26 -0
- package/src/components/payment-method-settings/payment-method-settings.d.ts +19 -0
- package/src/components/portal/portal.d.ts +10 -1
- package/src/components/powered-by-shipengine/powered-by-shipengine.d.ts +8 -0
- package/src/components/section/section.d.ts +10 -0
- package/src/components/spacer/spacer.d.ts +30 -0
- package/src/components/spread/spread.d.ts +10 -0
- package/src/components/story-notes/story-notes.d.ts +10 -1
- package/src/components/templates/rate-form/rate-form.d.ts +2 -2
- package/src/components/templates/shipment-form/shipment-form.d.ts +2 -1
- package/src/components/templates/shipment-form/shipment-schema.d.ts +179 -17
- package/src/components/unit-settings/unit-settings.d.ts +5 -0
- package/src/constants/shipengine/address.d.ts +75 -0
- package/src/elements/account-settings/account-settings.d.ts +136 -1
- package/src/elements/configure-shipment/configure-shipment.d.ts +1 -0
- package/src/elements/configure-shipment/hooks/use-rates-form.d.ts +2 -2
- package/src/elements/configure-shipment/hooks/use-rates-with-cache.d.ts +1 -1
- package/src/elements/configure-shipment/hooks/use-request-rates.d.ts +1 -1
- package/src/elements/configure-shipment/hooks/use-shipment-form.d.ts +1 -0
- package/src/elements/list-carriers/list-carriers.d.ts +31 -0
- package/src/elements/manage-warehouses/manage-warehouses.d.ts +34 -0
- package/src/elements/onboarding/onboarding.d.ts +93 -2
- package/src/elements/purchase-label/purchase-label.d.ts +191 -7
- package/src/elements/shipengine-workflow/label-workflow.d.ts +138 -2
- package/src/elements/view-shipment/view-shipment.d.ts +128 -2
- package/src/elements/void-label/void-label.d.ts +134 -3
- package/src/extensions/zod.d.ts +5 -0
- package/src/factories/shipengine/package.d.ts +11 -0
- package/src/features/wallet-history/wallet-history.d.ts +5 -0
- package/src/hooks/index.d.ts +1 -0
- package/src/hooks/options/use-confirmation-options.d.ts +7 -0
- package/src/hooks/options/use-country-code-options.d.ts +16 -3
- package/src/hooks/options/use-customs-contents-options.d.ts +7 -0
- package/src/hooks/options/use-customs-non-delivery-options.d.ts +7 -0
- package/src/hooks/options/use-date-range-options.d.ts +22 -1
- package/src/hooks/options/use-expiration-month-options.d.ts +7 -0
- package/src/hooks/options/use-insurance-provider-options.d.ts +7 -0
- package/src/hooks/options/use-package-options.d.ts +7 -0
- package/src/hooks/options/use-rate-options.d.ts +11 -1
- package/src/hooks/options/use-service-code-options.d.ts +7 -0
- package/src/hooks/options/use-shipment-metadata.d.ts +8 -0
- package/src/hooks/options/use-shipping-presets-options.d.ts +10 -0
- package/src/hooks/options/use-state-code-options.d.ts +7 -0
- package/src/hooks/options/use-warehouse-options.d.ts +7 -0
- package/src/hooks/use-address-validation.d.ts +7 -0
- package/src/hooks/use-black-box-detection.d.ts +17 -1
- package/src/hooks/use-carrier-metadata.d.ts +7 -0
- package/src/hooks/use-nested-form.d.ts +9 -0
- package/src/hooks/use-page-layout.d.ts +25 -1
- package/src/hooks/use-root-portal.d.ts +15 -2
- package/src/hooks/use-run-once-on-true.d.ts +5 -1
- package/src/hooks/use-scrub-errors.d.ts +6 -3
- package/src/hooks/use-toggle.d.ts +5 -1
- package/src/locales/en/index.d.ts +8 -1
- package/src/schemas/shipengine/money.d.ts +4 -0
- package/src/schemas/shipengine/phone.d.ts +8 -0
- package/src/types/carrier-metadata.d.ts +20 -0
- package/src/utilities/create-dictionary.d.ts +4 -0
- package/src/utilities/date.d.ts +51 -2
- package/src/utilities/error.d.ts +16 -2
- package/src/utilities/feature-flags.d.ts +181 -0
- package/src/utilities/form-logger.d.ts +4 -0
- package/src/utilities/index.d.ts +1 -1
- package/src/utilities/money.d.ts +25 -0
- package/src/utilities/predicates/isString.d.ts +7 -0
- package/src/utilities/rates.d.ts +22 -1
- package/src/utilities/shipengine/address.d.ts +31 -0
- package/src/utilities/shipengine/carrier.d.ts +21 -0
- package/src/utilities/shipengine/dimensions.d.ts +27 -4
- package/src/utilities/shipengine/package.d.ts +4 -0
- package/src/utilities/shipengine/sales-order.d.ts +26 -0
- package/src/utilities/shipengine/shipment.d.ts +12 -0
- package/src/utilities/shipengine/weight.d.ts +92 -2
- package/src/utilities/string.d.ts +7 -0
- package/src/utilities/styles.d.ts +4 -0
- package/src/utilities/validation.d.ts +8 -0
package/index.js
CHANGED
|
@@ -3,9 +3,9 @@ import { useTranslation, Trans } from 'react-i18next';
|
|
|
3
3
|
import { InlineNotification, NotificationType, Typography, Link, ButtonSize, Spinner, Icon, IconSize, Divider, Skeleton, SkeletonAnimation, SkeletonVariant, Grid, GridChild, Pagination, SkeletonBackgroundColor, RadioGroup, Radio, SpinnerSize, FormField, FieldMessageType, Checkbox, Input, SelectAutocomplete, Select as Select$1, OptionGroup, Option, Button, Switch as Switch$1, Textarea, ChipList, Chip, ButtonVariant, ButtonColor, Tag, TagColor, Stepper, Step, IconTooltip, Table, TableBody, TableBaseRow, TableBodyCell, TableHeader, TableHeaderCell, Popover, DropdownOptionList, DatePicker as DatePicker$1, BottomSheet } from '@packlink/giger';
|
|
4
4
|
import alchemy, { SE, logger, useValidateAddresses, useListCarriers, useConnectCarrier, useListWarehouses, useUpdateWarehouse, useCreateWarehouse, useDeleteWarehouse, useGetWalletHistory, useGetAccountSettings, useUpdateAccountSettings, AlchemyContext, useAddFunds, useGetCarrierById, useUpdateAutoFunding, useGetAutoFundingConfiguration, Currency, useUpdateFundingSource, useListFundingSources, useCreateFundingSource, useRegisterCarrier, useUpdateSalesOrderShipment, useParseAddress, useListCustomPackageTypes, useCalculateRates, useGetShipmentRates, useListLabels, useCreateLabel, useListSalesOrderShipments, useCreateSalesOrderShipment, useListSalesOrders, useGetSalesOrder, useListOrderSources, useRefreshOrderSource, useCreateShipment, useGetShipment, useGetSalesOrderShipment, useGetLabel, useVoidLabel } from '@shipengine/alchemy';
|
|
5
5
|
import axios from 'axios';
|
|
6
|
+
import _$3, { get as get$1, isEqual } from 'lodash';
|
|
6
7
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
7
8
|
import { z } from 'zod';
|
|
8
|
-
import _$3, { get as get$1, isEqual } from 'lodash';
|
|
9
9
|
import { encode } from 'js-base64';
|
|
10
10
|
import * as React from 'react';
|
|
11
11
|
import { useMemo, createContext, useState, useContext, useReducer, useCallback, createElement as createElement$2, useRef, useEffect, forwardRef, memo, Fragment as Fragment$1 } from 'react';
|
|
@@ -1986,6 +1986,13 @@ var addToUnscopables = addToUnscopables$3;
|
|
|
1986
1986
|
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
1987
1987
|
addToUnscopables('flatMap');
|
|
1988
1988
|
|
|
1989
|
+
/**
|
|
1990
|
+
* @internal
|
|
1991
|
+
*
|
|
1992
|
+
* # Delivery Confirmation Options Hook
|
|
1993
|
+
*
|
|
1994
|
+
* @category Hooks
|
|
1995
|
+
*/
|
|
1989
1996
|
const useConfirmationOptions = () => {
|
|
1990
1997
|
const {
|
|
1991
1998
|
t
|
|
@@ -2007,6 +2014,11 @@ const hasEuCustomsRules = true,
|
|
|
2007
2014
|
isUnitedStatesTerritory$1 = true,
|
|
2008
2015
|
isUnsupportedByUps$1 = true,
|
|
2009
2016
|
supportsByoa = true;
|
|
2017
|
+
/**
|
|
2018
|
+
* @internal
|
|
2019
|
+
*
|
|
2020
|
+
* # Address Utils - Country Type
|
|
2021
|
+
*/
|
|
2010
2022
|
class Country {
|
|
2011
2023
|
constructor(name, code, rules = {}) {
|
|
2012
2024
|
var _a, _b, _c, _d, _e;
|
|
@@ -2019,6 +2031,11 @@ class Country {
|
|
|
2019
2031
|
this.isUnsupportedByUps = (_e = rules.isUnsupportedByUps) !== null && _e !== void 0 ? _e : false;
|
|
2020
2032
|
}
|
|
2021
2033
|
}
|
|
2034
|
+
/**
|
|
2035
|
+
* @internal
|
|
2036
|
+
*
|
|
2037
|
+
* # Address Utils - Array of Countries and their codes
|
|
2038
|
+
*/
|
|
2022
2039
|
const countries = [new Country("Afghanistan", "AF"), new Country("Aland Islands", "AX"), new Country("Albania", "AL"), new Country("Algeria", "DZ"), new Country("American Samoa", "AS", {
|
|
2023
2040
|
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2024
2041
|
}), new Country("Andorra", "AD"), new Country("Angola", "AO"), new Country("Anguilla", "AI"), new Country("Antarctica", "AQ"), new Country("Antigua Barbuda", "AG"), new Country("Argentina", "AR"), new Country("Armenia", "AM"), new Country("Aruba", "AW"), new Country("Australia", "AU", {
|
|
@@ -2147,11 +2164,31 @@ new Country("Puerto Rico", "PR", {
|
|
|
2147
2164
|
hasProvinces,
|
|
2148
2165
|
supportsByoa
|
|
2149
2166
|
}), new Country("Uruguay", "UY"), new Country("Uzbekistan", "UZ"), new Country("Vanuatu", "VU"), new Country("Venezuela", "VE"), new Country("Vietnam", "VN"), new Country("Wallis and Futuna Islands", "WF"), new Country("Western Sahara", "EH"), new Country("Yemen", "YE"), new Country("Zambia", "ZM"), new Country("Zimbabwe", "ZW")];
|
|
2167
|
+
/**
|
|
2168
|
+
* @internal
|
|
2169
|
+
*
|
|
2170
|
+
* # Address Utils - Map of Country Codes
|
|
2171
|
+
*/
|
|
2150
2172
|
const countryCodes = countries.map(c => c.code);
|
|
2173
|
+
/**
|
|
2174
|
+
* @internal
|
|
2175
|
+
*
|
|
2176
|
+
* # Address Utils - EU Country Codes
|
|
2177
|
+
*/
|
|
2151
2178
|
const euCountryCodes = countries.filter(c => c.hasEuCustomsRules).map(c => c.code);
|
|
2152
2179
|
// #endregion
|
|
2153
2180
|
// #region [ rgba(0,0,0,0) ] Postal Codes
|
|
2181
|
+
/**
|
|
2182
|
+
* @internal
|
|
2183
|
+
*
|
|
2184
|
+
* # Address Utils - Postal Code Regex
|
|
2185
|
+
*/
|
|
2154
2186
|
const postalCodeRegex$3 = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
|
|
2187
|
+
/**
|
|
2188
|
+
* @internal
|
|
2189
|
+
*
|
|
2190
|
+
* # Address Utils - US State Type
|
|
2191
|
+
*/
|
|
2155
2192
|
class UsState {
|
|
2156
2193
|
constructor(name, code, rules = {}) {
|
|
2157
2194
|
var _a, _b;
|
|
@@ -2161,6 +2198,11 @@ class UsState {
|
|
|
2161
2198
|
this.isUnitedStatesTerritory = (_b = rules.isUnitedStatesTerritory) !== null && _b !== void 0 ? _b : false;
|
|
2162
2199
|
}
|
|
2163
2200
|
}
|
|
2201
|
+
/**
|
|
2202
|
+
* @internal
|
|
2203
|
+
*
|
|
2204
|
+
* # Address Utils - Array US States and their codes
|
|
2205
|
+
*/
|
|
2164
2206
|
const usStates = [new UsState("Alabama", "AL"), new UsState("Alaska", "AK"), new UsState("American Samoa", "AS", {
|
|
2165
2207
|
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2166
2208
|
}), new UsState("Arizona", "AZ"), new UsState("Arkansas", "AR"), new UsState("Armed Forces Americas", "AA", {
|
|
@@ -2180,7 +2222,17 @@ const usStates = [new UsState("Alabama", "AL"), new UsState("Alaska", "AK"), new
|
|
|
2180
2222
|
}), new UsState("U.S. Minor Outlying Islands", "UM", {
|
|
2181
2223
|
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2182
2224
|
})];
|
|
2225
|
+
/**
|
|
2226
|
+
* @internal
|
|
2227
|
+
*
|
|
2228
|
+
* # Address Utils - Map of US State Codes
|
|
2229
|
+
*/
|
|
2183
2230
|
const usStateCodes = usStates.map(item => item.code);
|
|
2231
|
+
/**
|
|
2232
|
+
* @internal
|
|
2233
|
+
*
|
|
2234
|
+
* # Address Utils - USA City Type
|
|
2235
|
+
*/
|
|
2184
2236
|
class UsaCity {
|
|
2185
2237
|
constructor(name, code, rules = {}) {
|
|
2186
2238
|
var _a;
|
|
@@ -2189,6 +2241,11 @@ class UsaCity {
|
|
|
2189
2241
|
this.isMilitary = (_a = rules.isMilitary) !== null && _a !== void 0 ? _a : false;
|
|
2190
2242
|
}
|
|
2191
2243
|
}
|
|
2244
|
+
/**
|
|
2245
|
+
* @internal
|
|
2246
|
+
*
|
|
2247
|
+
* # Address Utils - US Cities
|
|
2248
|
+
*/
|
|
2192
2249
|
const usCities = [new UsaCity("Army Post Office", "APO", {
|
|
2193
2250
|
isMilitary
|
|
2194
2251
|
}), new UsaCity("Diplomatic Post Office", "DPO", {
|
|
@@ -2198,11 +2255,36 @@ const usCities = [new UsaCity("Army Post Office", "APO", {
|
|
|
2198
2255
|
})];
|
|
2199
2256
|
// #endregion
|
|
2200
2257
|
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2258
|
+
/**
|
|
2259
|
+
* @internal
|
|
2260
|
+
*
|
|
2261
|
+
* # Country Code Options Hook
|
|
2262
|
+
*
|
|
2263
|
+
* @category Hooks
|
|
2264
|
+
*/
|
|
2265
|
+
const useCountryCodeOptions = domestic => {
|
|
2266
|
+
const countryCodeOptions = useMemo(() => countries.flatMap(v => domestic && v.code !== "US" && !v.isUnitedStatesTerritory ? [] : {
|
|
2267
|
+
label: v.name,
|
|
2268
|
+
value: v.code
|
|
2269
|
+
}), [domestic]);
|
|
2270
|
+
const defaultCountryCodeOption = useMemo(() => {
|
|
2271
|
+
const defaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
|
|
2272
|
+
const defaultCountryCode = defaultLocale.split("-")[1];
|
|
2273
|
+
return countryCodeOptions.find(option => option.value === defaultCountryCode);
|
|
2274
|
+
}, [countryCodeOptions]);
|
|
2275
|
+
return {
|
|
2276
|
+
countryCodeOptions,
|
|
2277
|
+
defaultCountryCodeOption
|
|
2278
|
+
};
|
|
2279
|
+
};
|
|
2205
2280
|
|
|
2281
|
+
/**
|
|
2282
|
+
* @internal
|
|
2283
|
+
*
|
|
2284
|
+
* # Customs Contents Options Hook
|
|
2285
|
+
*
|
|
2286
|
+
* @category Hooks
|
|
2287
|
+
*/
|
|
2206
2288
|
const useCustomsContentsOptions = () => {
|
|
2207
2289
|
const {
|
|
2208
2290
|
t
|
|
@@ -2213,6 +2295,13 @@ const useCustomsContentsOptions = () => {
|
|
|
2213
2295
|
})), [t]);
|
|
2214
2296
|
};
|
|
2215
2297
|
|
|
2298
|
+
/**
|
|
2299
|
+
* @internal
|
|
2300
|
+
*
|
|
2301
|
+
* # Customs Non-Delivery Options Hooks
|
|
2302
|
+
*
|
|
2303
|
+
* @category Hooks
|
|
2304
|
+
*/
|
|
2216
2305
|
const useCustomsNonDeliveryOptions = () => {
|
|
2217
2306
|
const {
|
|
2218
2307
|
t
|
|
@@ -2302,6 +2391,10 @@ $$f({ target: 'Array', proto: true, forced: !STRICT_METHOD$1 || CHROME_BUG }, {
|
|
|
2302
2391
|
});
|
|
2303
2392
|
|
|
2304
2393
|
/**
|
|
2394
|
+
* @internal
|
|
2395
|
+
*
|
|
2396
|
+
* # Create Dictionary Utility Function
|
|
2397
|
+
*
|
|
2305
2398
|
* @category Utilities
|
|
2306
2399
|
*/
|
|
2307
2400
|
const createDictionary = (items, getEntry) => {
|
|
@@ -2310,6 +2403,10 @@ const createDictionary = (items, getEntry) => {
|
|
|
2310
2403
|
};
|
|
2311
2404
|
|
|
2312
2405
|
/**
|
|
2406
|
+
* @internal
|
|
2407
|
+
*
|
|
2408
|
+
* # Date Utils - getDaysInMonth
|
|
2409
|
+
*
|
|
2313
2410
|
* @category Utilities
|
|
2314
2411
|
*/
|
|
2315
2412
|
const formatDate = (date, locale = "en-US") => new Date(date).toLocaleDateString(locale, {
|
|
@@ -2318,6 +2415,10 @@ const formatDate = (date, locale = "en-US") => new Date(date).toLocaleDateString
|
|
|
2318
2415
|
year: "numeric"
|
|
2319
2416
|
});
|
|
2320
2417
|
/**
|
|
2418
|
+
* @internal
|
|
2419
|
+
*
|
|
2420
|
+
* # Date Utils - formatDateDDMMYY
|
|
2421
|
+
*
|
|
2321
2422
|
* @category Utilities
|
|
2322
2423
|
*/
|
|
2323
2424
|
const formatDateDDMMYY = (date, locale = "en-US") => new Date(date).toLocaleDateString(locale, {
|
|
@@ -2326,6 +2427,10 @@ const formatDateDDMMYY = (date, locale = "en-US") => new Date(date).toLocaleDate
|
|
|
2326
2427
|
year: "2-digit"
|
|
2327
2428
|
});
|
|
2328
2429
|
/**
|
|
2430
|
+
* @internal
|
|
2431
|
+
*
|
|
2432
|
+
* # Date Utils - getDaysInMonth
|
|
2433
|
+
*
|
|
2329
2434
|
* @category Utilities
|
|
2330
2435
|
*/
|
|
2331
2436
|
const daysAfter = (days, date = new Date()) => {
|
|
@@ -2334,14 +2439,26 @@ const daysAfter = (days, date = new Date()) => {
|
|
|
2334
2439
|
return date;
|
|
2335
2440
|
};
|
|
2336
2441
|
/**
|
|
2442
|
+
* @internal
|
|
2443
|
+
*
|
|
2444
|
+
* # Date Utils - getDaysInMonth
|
|
2445
|
+
*
|
|
2337
2446
|
* @category Utilities
|
|
2338
2447
|
*/
|
|
2339
2448
|
const nextDayCutoff = (cutoff, date = new Date()) => date.getHours() >= cutoff ? daysAfter(1, new Date(date)) : new Date(date);
|
|
2340
2449
|
/**
|
|
2450
|
+
* @internal
|
|
2451
|
+
*
|
|
2452
|
+
* # Date Utils - getDaysInMonth
|
|
2453
|
+
*
|
|
2341
2454
|
* @category Utilities
|
|
2342
2455
|
*/
|
|
2343
2456
|
const mostRecent = (...dates) => new Date(Math.max(...dates.map(Number)));
|
|
2344
2457
|
/**
|
|
2458
|
+
* @internal
|
|
2459
|
+
*
|
|
2460
|
+
* # Date Utils - getDaysInMonth
|
|
2461
|
+
*
|
|
2345
2462
|
* @category Utilities
|
|
2346
2463
|
*/
|
|
2347
2464
|
const omitTime = shipDate => {
|
|
@@ -2349,6 +2466,10 @@ const omitTime = shipDate => {
|
|
|
2349
2466
|
return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
|
|
2350
2467
|
};
|
|
2351
2468
|
/**
|
|
2469
|
+
* @internal
|
|
2470
|
+
*
|
|
2471
|
+
* # Date Utils - getExpirationYears
|
|
2472
|
+
*
|
|
2352
2473
|
* @category Utilities
|
|
2353
2474
|
*/
|
|
2354
2475
|
const getExpirationYears = yearsValid => {
|
|
@@ -2359,17 +2480,35 @@ const getExpirationYears = yearsValid => {
|
|
|
2359
2480
|
}
|
|
2360
2481
|
return years;
|
|
2361
2482
|
};
|
|
2483
|
+
/**
|
|
2484
|
+
* @internal
|
|
2485
|
+
*
|
|
2486
|
+
* # Date Utilities - sortByCreationDate
|
|
2487
|
+
*
|
|
2488
|
+
* @category Utilities
|
|
2489
|
+
*/
|
|
2362
2490
|
const sortByCreationDate = (a, b, order = "desc") => {
|
|
2363
2491
|
const [x, y] = order === "asc" ? [a, b] : [b, a];
|
|
2364
2492
|
return new Date(x.createdAt).getTime() - new Date(y.createdAt).getTime();
|
|
2365
2493
|
};
|
|
2366
2494
|
/**
|
|
2495
|
+
* @internal
|
|
2496
|
+
*
|
|
2497
|
+
* # Date Utilities - isNowOrInTheFuture
|
|
2498
|
+
*
|
|
2367
2499
|
* @category Utilities
|
|
2368
2500
|
*/
|
|
2369
2501
|
const isNowOrInTheFuture = shipDate => {
|
|
2370
2502
|
if (shipDate) return new Date(shipDate) >= new Date();
|
|
2371
2503
|
return false;
|
|
2372
2504
|
};
|
|
2505
|
+
/**
|
|
2506
|
+
* @internal
|
|
2507
|
+
*
|
|
2508
|
+
* # Date Utilities - getRelativeDates
|
|
2509
|
+
*
|
|
2510
|
+
* @category Utilities
|
|
2511
|
+
*/
|
|
2373
2512
|
const getRelativeDates = from => {
|
|
2374
2513
|
const origin = from !== null && from !== void 0 ? from : new Date();
|
|
2375
2514
|
return {
|
|
@@ -2383,6 +2522,12 @@ const getRelativeDates = from => {
|
|
|
2383
2522
|
};
|
|
2384
2523
|
|
|
2385
2524
|
/**
|
|
2525
|
+
* @internal
|
|
2526
|
+
*
|
|
2527
|
+
* # Create Coded Errors Utlity Function
|
|
2528
|
+
*
|
|
2529
|
+
* - This function extracts errors from our `Axios Responses`.
|
|
2530
|
+
*
|
|
2386
2531
|
* @category Utilities
|
|
2387
2532
|
*/
|
|
2388
2533
|
const createCodedErrors = err => {
|
|
@@ -2398,19 +2543,229 @@ const createCodedErrors = err => {
|
|
|
2398
2543
|
}];
|
|
2399
2544
|
};
|
|
2400
2545
|
/**
|
|
2401
|
-
*
|
|
2546
|
+
* @internal
|
|
2547
|
+
*
|
|
2548
|
+
* - Joins a list of error-like object's messages and throws them as a single error.
|
|
2549
|
+
*
|
|
2550
|
+
* @category Utilities
|
|
2402
2551
|
*/
|
|
2403
2552
|
function throwJoinedMessages(errors) {
|
|
2404
2553
|
throw new Error(errors.map(e => e.message).join(", "));
|
|
2405
2554
|
}
|
|
2406
2555
|
/**
|
|
2407
|
-
*
|
|
2556
|
+
* @internal
|
|
2557
|
+
*
|
|
2558
|
+
* - If any CodedErrors exist, throw them all as a single error, otherwise assert errors is null.
|
|
2559
|
+
*
|
|
2560
|
+
* @category Utilities
|
|
2408
2561
|
*/
|
|
2409
2562
|
function throwAny(errors) {
|
|
2410
2563
|
if (errors) throwJoinedMessages(errors);
|
|
2411
2564
|
}
|
|
2412
2565
|
|
|
2413
2566
|
/**
|
|
2567
|
+
* @namespace featureFlags
|
|
2568
|
+
*
|
|
2569
|
+
* - The `featureFlags` namespace contains all the feature flags available throughout the
|
|
2570
|
+
* application. All features are scoped by name to the component they are intended for.
|
|
2571
|
+
*
|
|
2572
|
+
* @example
|
|
2573
|
+
* ```tsx
|
|
2574
|
+
* export const featureFlags = {
|
|
2575
|
+
* ConfigureSalesOrderShipment: {
|
|
2576
|
+
* compatibleCountryCodes: ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"],
|
|
2577
|
+
* rateForm: {
|
|
2578
|
+
* enableFunding: false,
|
|
2579
|
+
* enableGlobalPostFiltering: false,
|
|
2580
|
+
* labelLayout: false,
|
|
2581
|
+
* nicknameRate: true,
|
|
2582
|
+
* saveRate: true,
|
|
2583
|
+
* },
|
|
2584
|
+
* shipmentForm: {
|
|
2585
|
+
* browseRates: true,
|
|
2586
|
+
* includeShipsuranceInsurance: true,
|
|
2587
|
+
* includeThirdPartyInsurance: true,
|
|
2588
|
+
* selectService: true,
|
|
2589
|
+
* shippingPresets: false,
|
|
2590
|
+
* },
|
|
2591
|
+
* },
|
|
2592
|
+
* Global: {
|
|
2593
|
+
* carriers: {
|
|
2594
|
+
* enabledCarriers: ["stamps_com", "ups", "dhl_express_walleted"],
|
|
2595
|
+
* },
|
|
2596
|
+
* presentation: {
|
|
2597
|
+
* poweredByShipEngine: false,
|
|
2598
|
+
* },
|
|
2599
|
+
* },
|
|
2600
|
+
* ViewShipment: {
|
|
2601
|
+
* shipment: {
|
|
2602
|
+
* schedulePickup: true,
|
|
2603
|
+
* },
|
|
2604
|
+
* },
|
|
2605
|
+
* } as const;
|
|
2606
|
+
* ```
|
|
2607
|
+
*/
|
|
2608
|
+
const featureFlags = {
|
|
2609
|
+
/**
|
|
2610
|
+
* `ConfigureSalesOrderShipment` all scoped feature flags for the shipment configuration
|
|
2611
|
+
* section of the `<PurchaseLabel />` element.
|
|
2612
|
+
*/
|
|
2613
|
+
ConfigureSalesOrderShipment: {
|
|
2614
|
+
/**
|
|
2615
|
+
* `compatibleCountryCodes` is a list of all supported `countries` available in ShipEngine
|
|
2616
|
+
* Elements.
|
|
2617
|
+
*/
|
|
2618
|
+
compatibleCountryCodes: ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"],
|
|
2619
|
+
/**
|
|
2620
|
+
* `rateForm` all scoped feature flags for the `rate form` section of the `<PurchaseLabel />`
|
|
2621
|
+
* element.
|
|
2622
|
+
*/
|
|
2623
|
+
rateForm: {
|
|
2624
|
+
/**
|
|
2625
|
+
* `enableFunding` enables the `funding` section of the rate form.
|
|
2626
|
+
*/
|
|
2627
|
+
enableFunding: false,
|
|
2628
|
+
/**
|
|
2629
|
+
* `enableGlobalPostFiltering` enables the `global post filtering` on all rates fetched
|
|
2630
|
+
* in the rates form.
|
|
2631
|
+
*/
|
|
2632
|
+
enableGlobalPostFiltering: false,
|
|
2633
|
+
/**
|
|
2634
|
+
* `labelLayout` enables the `label layout` section of the `<PurchaseLabel /> element.
|
|
2635
|
+
*/
|
|
2636
|
+
labelLayout: false,
|
|
2637
|
+
/**
|
|
2638
|
+
* `nicknameRate` enables showing the `carrier nickname` when rates are fetched.
|
|
2639
|
+
*/
|
|
2640
|
+
nicknameRate: true,
|
|
2641
|
+
requireDhlTermsAcknowledgement: false,
|
|
2642
|
+
/**
|
|
2643
|
+
* `saveRate` enables the `save rate` button in the rate form. This allows users to save a
|
|
2644
|
+
* `rateId` for a shipment to be purchased later.
|
|
2645
|
+
*/
|
|
2646
|
+
saveRate: true
|
|
2647
|
+
},
|
|
2648
|
+
/**
|
|
2649
|
+
* `shipmentForm` all scoped feature flags for the `shipment form` section of the
|
|
2650
|
+
* `<PurchaseLabel />` element.
|
|
2651
|
+
*/
|
|
2652
|
+
shipmentForm: {
|
|
2653
|
+
/**
|
|
2654
|
+
* `browseRates` enables the `browse rates` button in the shipment form. This allows users
|
|
2655
|
+
* to browse rates for a shipment with varying shipment configurations. This is useful for
|
|
2656
|
+
* rate shopping.
|
|
2657
|
+
*/
|
|
2658
|
+
browseRates: true,
|
|
2659
|
+
/**
|
|
2660
|
+
* `includeShipsuranceInsurance` enables the `shipsurance insurance` feature, allowing users
|
|
2661
|
+
* to select Shipsurance when insuring their shipment.
|
|
2662
|
+
*/
|
|
2663
|
+
includeShipsuranceInsurance: true,
|
|
2664
|
+
/**
|
|
2665
|
+
* `includeThirdPartyInsurance` enables the `third party insurance` feature, allowing users
|
|
2666
|
+
* to opt for third party insurance when insuring their shipment.
|
|
2667
|
+
*/
|
|
2668
|
+
includeThirdPartyInsurance: true,
|
|
2669
|
+
/**
|
|
2670
|
+
* `selectService` enables the `select service` feature, allowing users to select a service
|
|
2671
|
+
* when rate shopping across multiple carrier providers.
|
|
2672
|
+
*/
|
|
2673
|
+
selectService: true,
|
|
2674
|
+
/**
|
|
2675
|
+
* `shippingPresets` enables the `shipping presets` feature, allowing users to pass in a set
|
|
2676
|
+
* of shipping presets they wish to use within the shipment form of the `<PurchaseLabel />`
|
|
2677
|
+
* element.
|
|
2678
|
+
*/
|
|
2679
|
+
shippingPresets: false
|
|
2680
|
+
}
|
|
2681
|
+
},
|
|
2682
|
+
/**
|
|
2683
|
+
* `Global` all feature flags that are intended for use anywhere in ShipEngine Elements.
|
|
2684
|
+
*/
|
|
2685
|
+
Global: {
|
|
2686
|
+
/**
|
|
2687
|
+
* All global `carrier` related feature flags.
|
|
2688
|
+
*/
|
|
2689
|
+
carriers: {
|
|
2690
|
+
/**
|
|
2691
|
+
* `enabledCarriers` is a list of all `carriers` that are enabled for use in ShipEngine
|
|
2692
|
+
* Elements.
|
|
2693
|
+
*/
|
|
2694
|
+
enabledCarriers: ["stamps_com", "ups", "dhl_express_walleted"]
|
|
2695
|
+
},
|
|
2696
|
+
/**
|
|
2697
|
+
* All global `presentation` related feature flags.
|
|
2698
|
+
*/
|
|
2699
|
+
presentation: {
|
|
2700
|
+
/**
|
|
2701
|
+
* `poweredByShipEngine` enables the `powered by ShipEngine` logo in the footer various
|
|
2702
|
+
* elements.
|
|
2703
|
+
*/
|
|
2704
|
+
poweredByShipEngine: false
|
|
2705
|
+
}
|
|
2706
|
+
},
|
|
2707
|
+
/**
|
|
2708
|
+
* `ViewShipment` all scoped feature flags for the `<ViewShipment />` element.
|
|
2709
|
+
*/
|
|
2710
|
+
ViewShipment: {
|
|
2711
|
+
/**
|
|
2712
|
+
* `shipment` all shipment related features available in the `<ViewShipment />` element.
|
|
2713
|
+
*/
|
|
2714
|
+
shipment: {
|
|
2715
|
+
/**
|
|
2716
|
+
* `schedulePickup` enables the `schedule pickup` button in the `<ViewShipment />` element,
|
|
2717
|
+
* allowing users to schedule pick-ups for their shipments.
|
|
2718
|
+
*/
|
|
2719
|
+
schedulePickup: true
|
|
2720
|
+
}
|
|
2721
|
+
}
|
|
2722
|
+
};
|
|
2723
|
+
/**
|
|
2724
|
+
* @internal
|
|
2725
|
+
*
|
|
2726
|
+
* # Feature Flags - featureFlagComponentNameLookup
|
|
2727
|
+
*/
|
|
2728
|
+
const featureFlagComponentNameLookup = componentName => {
|
|
2729
|
+
var _a;
|
|
2730
|
+
const lookup = {
|
|
2731
|
+
PurchaseLabel: "ConfigureSalesOrderShipment"
|
|
2732
|
+
};
|
|
2733
|
+
return (_a = lookup[componentName]) !== null && _a !== void 0 ? _a : "";
|
|
2734
|
+
};
|
|
2735
|
+
/**
|
|
2736
|
+
* @internal
|
|
2737
|
+
*
|
|
2738
|
+
* # Feature Flags - getFeatures
|
|
2739
|
+
*/
|
|
2740
|
+
const getFeatures = (...element) => {
|
|
2741
|
+
return element.map(feat => {
|
|
2742
|
+
var _a;
|
|
2743
|
+
return (_a = get$1(featureFlags, feat)) !== null && _a !== void 0 ? _a : {};
|
|
2744
|
+
}).reduce((acc, feat) => Object.assign(acc, feat), {});
|
|
2745
|
+
};
|
|
2746
|
+
/**
|
|
2747
|
+
* # Feature Flags - useFeatures
|
|
2748
|
+
*
|
|
2749
|
+
* - The `useFeatures` hook is used to retrieve the feature flags for a given component.
|
|
2750
|
+
*
|
|
2751
|
+
* @example
|
|
2752
|
+
* ```tsx
|
|
2753
|
+
* const features = useFeatures("Global");
|
|
2754
|
+
* ```
|
|
2755
|
+
*
|
|
2756
|
+
* <br />
|
|
2757
|
+
*
|
|
2758
|
+
* @see {@link featureFlags | All available `Feature Flags`}
|
|
2759
|
+
*/
|
|
2760
|
+
const useFeatures = (...element) => {
|
|
2761
|
+
return getFeatures(...element);
|
|
2762
|
+
};
|
|
2763
|
+
|
|
2764
|
+
/**
|
|
2765
|
+
* @internal
|
|
2766
|
+
*
|
|
2767
|
+
* # Form Logger
|
|
2768
|
+
*
|
|
2414
2769
|
* @description
|
|
2415
2770
|
* This will log the values that are submitted to the validation resolver
|
|
2416
2771
|
* (only REGISTERED form fields) and the results of that validation.
|
|
@@ -3041,6 +3396,11 @@ fixRegExpWellKnownSymbolLogic$1('replace', function (_, nativeReplace, maybeCall
|
|
|
3041
3396
|
];
|
|
3042
3397
|
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
|
|
3043
3398
|
|
|
3399
|
+
/**
|
|
3400
|
+
* @internal
|
|
3401
|
+
*
|
|
3402
|
+
* # Money Utils - currency Symbol
|
|
3403
|
+
*/
|
|
3044
3404
|
const currencySymbol = {
|
|
3045
3405
|
aud: "$",
|
|
3046
3406
|
cad: "$",
|
|
@@ -3049,6 +3409,11 @@ const currencySymbol = {
|
|
|
3049
3409
|
nzd: "$",
|
|
3050
3410
|
usd: "$"
|
|
3051
3411
|
};
|
|
3412
|
+
/**
|
|
3413
|
+
* @internal
|
|
3414
|
+
*
|
|
3415
|
+
* # Money Utils - formatMoney
|
|
3416
|
+
*/
|
|
3052
3417
|
const formatMoney = (value, locale = "en-US") => {
|
|
3053
3418
|
const currency = Intl.NumberFormat(locale, {
|
|
3054
3419
|
currency: value.currency,
|
|
@@ -3056,40 +3421,86 @@ const formatMoney = (value, locale = "en-US") => {
|
|
|
3056
3421
|
});
|
|
3057
3422
|
return currency.format(value.amount);
|
|
3058
3423
|
};
|
|
3424
|
+
/**
|
|
3425
|
+
* @internal
|
|
3426
|
+
*
|
|
3427
|
+
* # Money Utils - calculateTotal
|
|
3428
|
+
*/
|
|
3059
3429
|
const calculateTotal = (...values) => {
|
|
3060
3430
|
return values.reduce((total, value) => {
|
|
3061
3431
|
var _a;
|
|
3062
3432
|
return value ? total + ((_a = value.amount) !== null && _a !== void 0 ? _a : 0) : total;
|
|
3063
3433
|
}, 0);
|
|
3064
3434
|
};
|
|
3435
|
+
/**
|
|
3436
|
+
* @internal
|
|
3437
|
+
*
|
|
3438
|
+
* # Money Utils - formatCreditCardNumber
|
|
3439
|
+
*/
|
|
3065
3440
|
const formatCreditCardNumber = cc => [cc.substring(0, 4), cc.substring(4, 8), cc.substring(8, 12), cc.substring(12)].join(" ").trim();
|
|
3441
|
+
/**
|
|
3442
|
+
* @internal
|
|
3443
|
+
*
|
|
3444
|
+
* # Money Utils - formatExpiration
|
|
3445
|
+
*/
|
|
3066
3446
|
const formatExpiration = exp => {
|
|
3067
3447
|
const digits = exp.replace(/\//g, "");
|
|
3068
3448
|
if (digits.length > 2) return [digits.substring(0, 2), digits.substring(2, 6)].join("/").trim();
|
|
3069
3449
|
return digits;
|
|
3070
3450
|
};
|
|
3071
3451
|
|
|
3452
|
+
/**
|
|
3453
|
+
* @internal
|
|
3454
|
+
*
|
|
3455
|
+
* # String Predicate Utilities
|
|
3456
|
+
*
|
|
3457
|
+
* @category Utilities
|
|
3458
|
+
*/
|
|
3072
3459
|
const isString = x => typeof x === "string";
|
|
3073
3460
|
|
|
3074
|
-
|
|
3461
|
+
/**
|
|
3462
|
+
* @internal
|
|
3463
|
+
*
|
|
3464
|
+
* # Rates Utilities - getRateRequiresAcknowledgement
|
|
3465
|
+
*
|
|
3466
|
+
* @category Utilities
|
|
3467
|
+
*/
|
|
3468
|
+
const getRateRequiresAcknowledgement = (serviceCode, packageType, requireDhlTermsAcknowledgement) => {
|
|
3075
3469
|
switch (serviceCode) {
|
|
3076
3470
|
case "usps_media_mail":
|
|
3077
3471
|
return true;
|
|
3078
3472
|
case "usps_first_class_mail":
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
return false;
|
|
3473
|
+
return packageType === "large_envelope_or_flat";
|
|
3474
|
+
case "dhl_express_worldwide":
|
|
3475
|
+
return requireDhlTermsAcknowledgement;
|
|
3083
3476
|
default:
|
|
3084
3477
|
return false;
|
|
3085
3478
|
}
|
|
3086
3479
|
};
|
|
3480
|
+
/**
|
|
3481
|
+
* @internal
|
|
3482
|
+
*
|
|
3483
|
+
* # Rates Utilities - getTotalRateAmount
|
|
3484
|
+
*
|
|
3485
|
+
* @category Utilities
|
|
3486
|
+
*/
|
|
3087
3487
|
const getTotalRateAmount = (rateCosts = {}) => calculateTotal(...Object.values(rateCosts));
|
|
3488
|
+
/**
|
|
3489
|
+
* @internal
|
|
3490
|
+
*
|
|
3491
|
+
* # Rates Utilities - overrideCarrierCodes
|
|
3492
|
+
*
|
|
3493
|
+
* @category Utilities
|
|
3494
|
+
*/
|
|
3088
3495
|
const overrideCarrierCodes$1 = (carrier, overrides) => {
|
|
3089
3496
|
return overrides[carrier] || carrier;
|
|
3090
3497
|
};
|
|
3091
3498
|
|
|
3092
3499
|
/**
|
|
3500
|
+
* @internal
|
|
3501
|
+
*
|
|
3502
|
+
* # Address Utilities - isDomesticAddress
|
|
3503
|
+
*
|
|
3093
3504
|
* @category Utilities
|
|
3094
3505
|
*/
|
|
3095
3506
|
const isDomesticAddress = address => {
|
|
@@ -3097,6 +3508,10 @@ const isDomesticAddress = address => {
|
|
|
3097
3508
|
return address.countryCode === "US" || ((_a = countries.find(c => c.code === address.countryCode)) === null || _a === void 0 ? void 0 : _a.isUnitedStatesTerritory);
|
|
3098
3509
|
};
|
|
3099
3510
|
/**
|
|
3511
|
+
* @internal
|
|
3512
|
+
*
|
|
3513
|
+
* # Address Utilities - isMilitaryAddress
|
|
3514
|
+
*
|
|
3100
3515
|
* @category Utilities
|
|
3101
3516
|
*/
|
|
3102
3517
|
const isMilitaryAddress = address => {
|
|
@@ -3104,6 +3519,10 @@ const isMilitaryAddress = address => {
|
|
|
3104
3519
|
return !!(((_a = usStates.find(s => s.code === address.stateProvince)) === null || _a === void 0 ? void 0 : _a.isMilitary) || ((_b = usCities.find(c => c.code === address.cityLocality)) === null || _b === void 0 ? void 0 : _b.isMilitary));
|
|
3105
3520
|
};
|
|
3106
3521
|
/**
|
|
3522
|
+
* @internal
|
|
3523
|
+
*
|
|
3524
|
+
* # Address Utilities - isUnitedStatesTerritory
|
|
3525
|
+
*
|
|
3107
3526
|
* @category Utilities
|
|
3108
3527
|
*/
|
|
3109
3528
|
const isUnitedStatesTerritory = address => {
|
|
@@ -3111,6 +3530,10 @@ const isUnitedStatesTerritory = address => {
|
|
|
3111
3530
|
return !!(((_a = countries.find(c => c.code === address.countryCode)) === null || _a === void 0 ? void 0 : _a.isUnitedStatesTerritory) || ((_b = usStates.find(s => s.code === address.stateProvince)) === null || _b === void 0 ? void 0 : _b.isUnitedStatesTerritory));
|
|
3112
3531
|
};
|
|
3113
3532
|
/**
|
|
3533
|
+
* @internal
|
|
3534
|
+
*
|
|
3535
|
+
* # Address Utilities - isUnsupportedByUps
|
|
3536
|
+
*
|
|
3114
3537
|
* @category Utilities
|
|
3115
3538
|
*/
|
|
3116
3539
|
const isUnsupportedByUps = address => {
|
|
@@ -3121,39 +3544,90 @@ const PO_BOX_REGEX =
|
|
|
3121
3544
|
// eslint-disable-next-line no-useless-escape
|
|
3122
3545
|
/^(((p[\s\.\'\,]?[o\s][\.\'\,]?)\s?)|(post\s?office\s?))((box|bin|bo|b\.?)?\s?(num|number|#)?\s?\d+)/i;
|
|
3123
3546
|
/**
|
|
3547
|
+
* @internal
|
|
3548
|
+
*
|
|
3549
|
+
* # Address Utilities - isPoBox
|
|
3550
|
+
*
|
|
3124
3551
|
* @category Utilities
|
|
3125
3552
|
*/
|
|
3126
3553
|
const isPoBox = addressLine => PO_BOX_REGEX.test(addressLine);
|
|
3127
3554
|
/**
|
|
3555
|
+
* @internal
|
|
3556
|
+
*
|
|
3557
|
+
* # Address Utilities - isPoBoxAddress
|
|
3558
|
+
*
|
|
3128
3559
|
* @category Utilities
|
|
3129
3560
|
*/
|
|
3130
3561
|
const isPoBoxAddress = address => !!(isPoBox(address.addressLine1) || address.addressLine2 && isPoBox(address.addressLine2));
|
|
3562
|
+
/**
|
|
3563
|
+
* @internal
|
|
3564
|
+
*
|
|
3565
|
+
* # Address Utilities - isEmptyAddress
|
|
3566
|
+
*
|
|
3567
|
+
* @category Utilities
|
|
3568
|
+
*/
|
|
3131
3569
|
const isEmptyAddress = address => {
|
|
3132
3570
|
return !address || Object.entries(address).every(([key, value]) => key === "countryCode" || [null, "", "unknown"].includes(value));
|
|
3133
3571
|
};
|
|
3134
3572
|
|
|
3135
3573
|
const USPS_CARRIER_CODES = ["usps", "stamps_com"];
|
|
3574
|
+
/**
|
|
3575
|
+
* @internal
|
|
3576
|
+
*
|
|
3577
|
+
* # Carrier Utilities - isUspsCarrier
|
|
3578
|
+
*
|
|
3579
|
+
* @category Utilities
|
|
3580
|
+
*/
|
|
3136
3581
|
const isUspsCarrier = carrierCode => USPS_CARRIER_CODES.includes(carrierCode);
|
|
3582
|
+
/**
|
|
3583
|
+
* @internal
|
|
3584
|
+
*
|
|
3585
|
+
* # Carrier Utilities - isUpsCarrier
|
|
3586
|
+
*
|
|
3587
|
+
* @category Utilities
|
|
3588
|
+
*/
|
|
3137
3589
|
const isUpsCarrier = carrierCode => carrierCode === "ups";
|
|
3590
|
+
/**
|
|
3591
|
+
* @internal
|
|
3592
|
+
*
|
|
3593
|
+
* # Carrier Utilities - isFedexCarrier
|
|
3594
|
+
*
|
|
3595
|
+
* @category Utilities
|
|
3596
|
+
*/
|
|
3138
3597
|
const getCarrierIdByCarrierCode = (carriers = [], carrierCode) => {
|
|
3139
3598
|
const carrier = carriers.find(c => c.carrierCode === carrierCode);
|
|
3140
3599
|
return carrier === null || carrier === void 0 ? void 0 : carrier.carrierId;
|
|
3141
3600
|
};
|
|
3142
3601
|
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3602
|
+
/**
|
|
3603
|
+
* @internal
|
|
3604
|
+
*
|
|
3605
|
+
* # Convert Dimensions Utility Function
|
|
3606
|
+
*
|
|
3607
|
+
* @category Utilities
|
|
3608
|
+
*/
|
|
3609
|
+
const formatDimensions = dimensions => `${dimensions.length} x ${dimensions.width} x ${dimensions.height} `;
|
|
3610
|
+
function convertDimensions(dimensions, {
|
|
3611
|
+
allowAllZeroes
|
|
3612
|
+
} = {}) {
|
|
3613
|
+
const {
|
|
3614
|
+
length,
|
|
3615
|
+
width,
|
|
3616
|
+
height,
|
|
3617
|
+
unit
|
|
3618
|
+
} = dimensions;
|
|
3619
|
+
const hasAllZeroes = [length, width, height].every(v => v === 0);
|
|
3620
|
+
if (hasAllZeroes && !allowAllZeroes) return undefined;
|
|
3151
3621
|
return Object.assign(Object.assign({}, dimensions), {
|
|
3152
|
-
unit: "inch"
|
|
3622
|
+
unit: unit !== null && unit !== void 0 ? unit : "inch"
|
|
3153
3623
|
});
|
|
3154
3624
|
}
|
|
3155
3625
|
|
|
3156
3626
|
/**
|
|
3627
|
+
* @internal
|
|
3628
|
+
*
|
|
3629
|
+
* # Sales Order Utilities - getCustomsFromSalesOrder
|
|
3630
|
+
*
|
|
3157
3631
|
* @category Utilities
|
|
3158
3632
|
*/
|
|
3159
3633
|
const getCustomsFromSalesOrder = (salesOrder, warehouse) => ({
|
|
@@ -3167,6 +3641,10 @@ const getCustomsFromSalesOrder = (salesOrder, warehouse) => ({
|
|
|
3167
3641
|
nonDelivery: "return_to_sender"
|
|
3168
3642
|
});
|
|
3169
3643
|
/**
|
|
3644
|
+
* @internal
|
|
3645
|
+
*
|
|
3646
|
+
* # Sales Order Utilities - getIsCustomsRequiredForSalesOrder
|
|
3647
|
+
*
|
|
3170
3648
|
* @category Utilities
|
|
3171
3649
|
*/
|
|
3172
3650
|
const getIsCustomsRequiredForSalesOrder = ({
|
|
@@ -3175,12 +3653,23 @@ const getIsCustomsRequiredForSalesOrder = ({
|
|
|
3175
3653
|
originAddress
|
|
3176
3654
|
}) => originAddress && isMilitaryAddress(originAddress) || shipTo && (isMilitaryAddress(shipTo) || isUnitedStatesTerritory(shipTo)) || (originAddress === null || originAddress === void 0 ? void 0 : originAddress.countryCode) !== (shipTo === null || shipTo === void 0 ? void 0 : shipTo.countryCode);
|
|
3177
3655
|
/**
|
|
3656
|
+
* @internal
|
|
3657
|
+
*
|
|
3658
|
+
* # Sales Order Utilities - getRequestedServices
|
|
3659
|
+
*
|
|
3178
3660
|
* @category Utilities
|
|
3179
3661
|
*/
|
|
3180
3662
|
const getRequestedServices = salesOrder => {
|
|
3181
3663
|
var _a;
|
|
3182
3664
|
return Array.from(new Set((_a = salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.salesOrderItems) === null || _a === void 0 ? void 0 : _a.filter(item => !!item.requestedShippingOptions.shippingService).map(item => item.requestedShippingOptions.shippingService)));
|
|
3183
3665
|
};
|
|
3666
|
+
/**
|
|
3667
|
+
* @internal
|
|
3668
|
+
*
|
|
3669
|
+
* # Sales Order Utilities - getSalesOrderItemsFromSalesOrderOrShipment
|
|
3670
|
+
*
|
|
3671
|
+
* @category Utilities
|
|
3672
|
+
*/
|
|
3184
3673
|
const getSalesOrderItemsFromSalesOrderOrShipment = ({
|
|
3185
3674
|
salesOrder,
|
|
3186
3675
|
shipment
|
|
@@ -3404,6 +3893,10 @@ $$c({ target: 'Array', proto: true, forced: FORCED$3 }, {
|
|
|
3404
3893
|
});
|
|
3405
3894
|
|
|
3406
3895
|
/**
|
|
3896
|
+
* @internal
|
|
3897
|
+
*
|
|
3898
|
+
* # Shipment Utilities - getIsInternationalShipment
|
|
3899
|
+
*
|
|
3407
3900
|
* @category Utilities
|
|
3408
3901
|
*/
|
|
3409
3902
|
const getIsInternationalShipment = ({
|
|
@@ -3411,6 +3904,10 @@ const getIsInternationalShipment = ({
|
|
|
3411
3904
|
shipTo
|
|
3412
3905
|
}) => (shipFrom === null || shipFrom === void 0 ? void 0 : shipFrom.countryCode) !== (shipTo === null || shipTo === void 0 ? void 0 : shipTo.countryCode);
|
|
3413
3906
|
/**
|
|
3907
|
+
* @internal
|
|
3908
|
+
*
|
|
3909
|
+
* # Shipment Utilities - getIsCustomsRequiredForShipment
|
|
3910
|
+
*
|
|
3414
3911
|
* @category Utilities
|
|
3415
3912
|
*/
|
|
3416
3913
|
const getIsCustomsRequiredForShipment = ({
|
|
@@ -3418,32 +3915,292 @@ const getIsCustomsRequiredForShipment = ({
|
|
|
3418
3915
|
shipTo
|
|
3419
3916
|
}) => shipFrom && isMilitaryAddress(shipFrom) || shipTo && (isMilitaryAddress(shipTo) || isUnitedStatesTerritory(shipTo)) || (shipFrom === null || shipFrom === void 0 ? void 0 : shipFrom.countryCode) !== (shipTo === null || shipTo === void 0 ? void 0 : shipTo.countryCode);
|
|
3420
3917
|
/**
|
|
3918
|
+
* @internal
|
|
3919
|
+
*
|
|
3920
|
+
* # Shipment Utilities - getPendingShipment
|
|
3921
|
+
*
|
|
3421
3922
|
* @category Utilities
|
|
3422
3923
|
*/
|
|
3423
3924
|
const getPendingShipment = shipments => shipments === null || shipments === void 0 ? void 0 : shipments.filter(s => s.shipmentStatus === "pending").sort(sortByCreationDate)[0];
|
|
3424
3925
|
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3926
|
+
var uncurryThis$6 = functionUncurryThis;
|
|
3927
|
+
|
|
3928
|
+
// `thisNumberValue` abstract operation
|
|
3929
|
+
// https://tc39.es/ecma262/#sec-thisnumbervalue
|
|
3930
|
+
var thisNumberValue$1 = uncurryThis$6(1.0.valueOf);
|
|
3931
|
+
|
|
3932
|
+
var toIntegerOrInfinity$1 = toIntegerOrInfinity$6;
|
|
3933
|
+
var toString$5 = toString$c;
|
|
3934
|
+
var requireObjectCoercible$2 = requireObjectCoercible$9;
|
|
3935
|
+
|
|
3936
|
+
var $RangeError$1 = RangeError;
|
|
3937
|
+
|
|
3938
|
+
// `String.prototype.repeat` method implementation
|
|
3939
|
+
// https://tc39.es/ecma262/#sec-string.prototype.repeat
|
|
3940
|
+
var stringRepeat = function repeat(count) {
|
|
3941
|
+
var str = toString$5(requireObjectCoercible$2(this));
|
|
3942
|
+
var result = '';
|
|
3943
|
+
var n = toIntegerOrInfinity$1(count);
|
|
3944
|
+
if (n < 0 || n == Infinity) throw $RangeError$1('Wrong number of repetitions');
|
|
3945
|
+
for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;
|
|
3946
|
+
return result;
|
|
3947
|
+
};
|
|
3948
|
+
|
|
3949
|
+
var $$b = _export;
|
|
3950
|
+
var uncurryThis$5 = functionUncurryThis;
|
|
3951
|
+
var toIntegerOrInfinity = toIntegerOrInfinity$6;
|
|
3952
|
+
var thisNumberValue = thisNumberValue$1;
|
|
3953
|
+
var $repeat = stringRepeat;
|
|
3954
|
+
var fails$4 = fails$q;
|
|
3955
|
+
|
|
3956
|
+
var $RangeError = RangeError;
|
|
3957
|
+
var $String = String;
|
|
3958
|
+
var floor = Math.floor;
|
|
3959
|
+
var repeat = uncurryThis$5($repeat);
|
|
3960
|
+
var stringSlice$2 = uncurryThis$5(''.slice);
|
|
3961
|
+
var nativeToFixed = uncurryThis$5(1.0.toFixed);
|
|
3962
|
+
|
|
3963
|
+
var pow = function (x, n, acc) {
|
|
3964
|
+
return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
|
|
3965
|
+
};
|
|
3966
|
+
|
|
3967
|
+
var log = function (x) {
|
|
3968
|
+
var n = 0;
|
|
3969
|
+
var x2 = x;
|
|
3970
|
+
while (x2 >= 4096) {
|
|
3971
|
+
n += 12;
|
|
3972
|
+
x2 /= 4096;
|
|
3432
3973
|
}
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
};
|
|
3974
|
+
while (x2 >= 2) {
|
|
3975
|
+
n += 1;
|
|
3976
|
+
x2 /= 2;
|
|
3977
|
+
} return n;
|
|
3978
|
+
};
|
|
3979
|
+
|
|
3980
|
+
var multiply = function (data, n, c) {
|
|
3981
|
+
var index = -1;
|
|
3982
|
+
var c2 = c;
|
|
3983
|
+
while (++index < 6) {
|
|
3984
|
+
c2 += n * data[index];
|
|
3985
|
+
data[index] = c2 % 1e7;
|
|
3986
|
+
c2 = floor(c2 / 1e7);
|
|
3987
|
+
}
|
|
3988
|
+
};
|
|
3989
|
+
|
|
3990
|
+
var divide = function (data, n) {
|
|
3991
|
+
var index = 6;
|
|
3992
|
+
var c = 0;
|
|
3993
|
+
while (--index >= 0) {
|
|
3994
|
+
c += data[index];
|
|
3995
|
+
data[index] = floor(c / n);
|
|
3996
|
+
c = (c % n) * 1e7;
|
|
3997
|
+
}
|
|
3998
|
+
};
|
|
3999
|
+
|
|
4000
|
+
var dataToString = function (data) {
|
|
4001
|
+
var index = 6;
|
|
4002
|
+
var s = '';
|
|
4003
|
+
while (--index >= 0) {
|
|
4004
|
+
if (s !== '' || index === 0 || data[index] !== 0) {
|
|
4005
|
+
var t = $String(data[index]);
|
|
4006
|
+
s = s === '' ? t : s + repeat('0', 7 - t.length) + t;
|
|
4007
|
+
}
|
|
4008
|
+
} return s;
|
|
4009
|
+
};
|
|
4010
|
+
|
|
4011
|
+
var FORCED$2 = fails$4(function () {
|
|
4012
|
+
return nativeToFixed(0.00008, 3) !== '0.000' ||
|
|
4013
|
+
nativeToFixed(0.9, 0) !== '1' ||
|
|
4014
|
+
nativeToFixed(1.255, 2) !== '1.25' ||
|
|
4015
|
+
nativeToFixed(1000000000000000128.0, 0) !== '1000000000000000128';
|
|
4016
|
+
}) || !fails$4(function () {
|
|
4017
|
+
// V8 ~ Android 4.3-
|
|
4018
|
+
nativeToFixed({});
|
|
4019
|
+
});
|
|
4020
|
+
|
|
4021
|
+
// `Number.prototype.toFixed` method
|
|
4022
|
+
// https://tc39.es/ecma262/#sec-number.prototype.tofixed
|
|
4023
|
+
$$b({ target: 'Number', proto: true, forced: FORCED$2 }, {
|
|
4024
|
+
toFixed: function toFixed(fractionDigits) {
|
|
4025
|
+
var number = thisNumberValue(this);
|
|
4026
|
+
var fractDigits = toIntegerOrInfinity(fractionDigits);
|
|
4027
|
+
var data = [0, 0, 0, 0, 0, 0];
|
|
4028
|
+
var sign = '';
|
|
4029
|
+
var result = '0';
|
|
4030
|
+
var e, z, j, k;
|
|
4031
|
+
|
|
4032
|
+
// TODO: ES2018 increased the maximum number of fraction digits to 100, need to improve the implementation
|
|
4033
|
+
if (fractDigits < 0 || fractDigits > 20) throw $RangeError('Incorrect fraction digits');
|
|
4034
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
4035
|
+
if (number != number) return 'NaN';
|
|
4036
|
+
if (number <= -1e21 || number >= 1e21) return $String(number);
|
|
4037
|
+
if (number < 0) {
|
|
4038
|
+
sign = '-';
|
|
4039
|
+
number = -number;
|
|
4040
|
+
}
|
|
4041
|
+
if (number > 1e-21) {
|
|
4042
|
+
e = log(number * pow(2, 69, 1)) - 69;
|
|
4043
|
+
z = e < 0 ? number * pow(2, -e, 1) : number / pow(2, e, 1);
|
|
4044
|
+
z *= 0x10000000000000;
|
|
4045
|
+
e = 52 - e;
|
|
4046
|
+
if (e > 0) {
|
|
4047
|
+
multiply(data, 0, z);
|
|
4048
|
+
j = fractDigits;
|
|
4049
|
+
while (j >= 7) {
|
|
4050
|
+
multiply(data, 1e7, 0);
|
|
4051
|
+
j -= 7;
|
|
4052
|
+
}
|
|
4053
|
+
multiply(data, pow(10, j, 1), 0);
|
|
4054
|
+
j = e - 1;
|
|
4055
|
+
while (j >= 23) {
|
|
4056
|
+
divide(data, 1 << 23);
|
|
4057
|
+
j -= 23;
|
|
4058
|
+
}
|
|
4059
|
+
divide(data, 1 << j);
|
|
4060
|
+
multiply(data, 1, 1);
|
|
4061
|
+
divide(data, 2);
|
|
4062
|
+
result = dataToString(data);
|
|
4063
|
+
} else {
|
|
4064
|
+
multiply(data, 0, z);
|
|
4065
|
+
multiply(data, 1 << -e, 0);
|
|
4066
|
+
result = dataToString(data) + repeat('0', fractDigits);
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
if (fractDigits > 0) {
|
|
4070
|
+
k = result.length;
|
|
4071
|
+
result = sign + (k <= fractDigits
|
|
4072
|
+
? '0.' + repeat('0', fractDigits - k) + result
|
|
4073
|
+
: stringSlice$2(result, 0, k - fractDigits) + '.' + stringSlice$2(result, k - fractDigits));
|
|
4074
|
+
} else {
|
|
4075
|
+
result = sign + result;
|
|
4076
|
+
} return result;
|
|
4077
|
+
}
|
|
4078
|
+
});
|
|
4079
|
+
|
|
4080
|
+
/**
|
|
4081
|
+
* @internal
|
|
4082
|
+
*
|
|
4083
|
+
* # Weight Utilities - isMetricWeightUnit
|
|
4084
|
+
*
|
|
4085
|
+
* - This utility function checks if the weight unit is `metric` and returns a `boolean`
|
|
4086
|
+
* indicating if it is metric or not.
|
|
4087
|
+
*
|
|
4088
|
+
* @param unit The weight unit to check (optional).
|
|
4089
|
+
*
|
|
4090
|
+
* @returns boolean Indicating if the weight unit is `metric`.
|
|
4091
|
+
*
|
|
4092
|
+
* @category Utilities
|
|
4093
|
+
*/
|
|
4094
|
+
const isMetricWeightUnit = unit => !!unit && ["gram", "kilogram"].includes(unit);
|
|
4095
|
+
/**
|
|
4096
|
+
* @internal
|
|
4097
|
+
*
|
|
4098
|
+
* # Weight Utilities - isDecimalWeight
|
|
4099
|
+
*
|
|
4100
|
+
* - This utility function checks if the weight is a `decimal` weight and returns a `boolean`
|
|
4101
|
+
* indicating if it is decimal or not.
|
|
4102
|
+
*
|
|
4103
|
+
* @param weight The weight to `check for a decimal` (optional).
|
|
4104
|
+
*
|
|
4105
|
+
* @returns boolean Indicating if the weight is a decimal weight.
|
|
4106
|
+
*
|
|
4107
|
+
* @category Utilities
|
|
4108
|
+
*/
|
|
4109
|
+
const isDecimalWeight = weight => "value" in weight;
|
|
4110
|
+
/**
|
|
4111
|
+
* @internal
|
|
4112
|
+
*
|
|
4113
|
+
* # Weight Utilities - convertPoundsAndOuncesToOunces
|
|
4114
|
+
*
|
|
4115
|
+
* - This utility function converts `pounds and ounces` to a `total of ounces`.
|
|
4116
|
+
*
|
|
4117
|
+
* @param weight The `pound + ounce` weight to convert to ounces.
|
|
4118
|
+
*
|
|
4119
|
+
* @returns number The total weight in `ounces`.
|
|
4120
|
+
*
|
|
4121
|
+
* @category Utilities
|
|
4122
|
+
*/
|
|
4123
|
+
const convertPoundsAndOuncesToOunces = weight => {
|
|
4124
|
+
var _a, _b;
|
|
4125
|
+
const pounds = (_a = weight.whole) !== null && _a !== void 0 ? _a : 0;
|
|
4126
|
+
const ounces = (_b = weight.fractional) !== null && _b !== void 0 ? _b : 0;
|
|
4127
|
+
return pounds * 16 + ounces;
|
|
4128
|
+
};
|
|
4129
|
+
/**
|
|
4130
|
+
* @internal
|
|
4131
|
+
*
|
|
4132
|
+
* # Weight Utilities - convertFractionalWeightToDecimalWeight
|
|
4133
|
+
*
|
|
4134
|
+
* - This utility function converts a `fractional weight` to a `decimal weight`.
|
|
4135
|
+
*
|
|
4136
|
+
* @param weight The fractional weight to convert to a decimal weight.
|
|
4137
|
+
* @param unit The target weight unit to convert to (optional).
|
|
4138
|
+
*
|
|
4139
|
+
* @returns WeightWithUnit The decimal weight with its unit.
|
|
4140
|
+
*
|
|
4141
|
+
* @category Utilities
|
|
4142
|
+
*/
|
|
4143
|
+
const convertFractionalWeightToDecimalWeight = (weight, unit) => isMetricWeightUnit(unit) ? {
|
|
4144
|
+
unit,
|
|
4145
|
+
value: weight.whole
|
|
4146
|
+
} : {
|
|
4147
|
+
unit: "ounce",
|
|
4148
|
+
value: convertPoundsAndOuncesToOunces(weight)
|
|
4149
|
+
};
|
|
4150
|
+
/**
|
|
4151
|
+
* @internal
|
|
4152
|
+
*
|
|
4153
|
+
* # Weight Utilities - convertDecimalWeightToFractionalWeight
|
|
4154
|
+
*
|
|
4155
|
+
* - This utility function converts a `decimal weight` to a `fractional weight`.
|
|
4156
|
+
*
|
|
4157
|
+
* @param weight The decimal weight to convert to a fractional weight.
|
|
4158
|
+
*
|
|
4159
|
+
* @returns FractionalWeight The converted fractional weight.
|
|
4160
|
+
*
|
|
4161
|
+
* @category Utilities
|
|
4162
|
+
*/
|
|
4163
|
+
const convertDecimalWeightToFractionalWeight = weight => isMetricWeightUnit(weight.unit) ? {
|
|
4164
|
+
fractional: 0,
|
|
4165
|
+
whole: weight.value
|
|
4166
|
+
} : {
|
|
4167
|
+
fractional: weight.value % 16,
|
|
4168
|
+
whole: Math.floor(weight.value / 16)
|
|
4169
|
+
};
|
|
4170
|
+
/**
|
|
4171
|
+
* @internal
|
|
4172
|
+
*
|
|
4173
|
+
* # Weight Utilities - convertWeight/2
|
|
4174
|
+
*/
|
|
4175
|
+
function convertWeight(weight, unit) {
|
|
4176
|
+
return isDecimalWeight(weight) ? convertDecimalWeightToFractionalWeight(weight) : convertFractionalWeightToDecimalWeight(weight, unit);
|
|
3437
4177
|
}
|
|
3438
4178
|
/**
|
|
4179
|
+
* @internal
|
|
4180
|
+
*
|
|
4181
|
+
* # Weight Utilities - formatFractionalWeight
|
|
4182
|
+
*
|
|
4183
|
+
* - This utility function formats a `fractional weight` for ease of use.
|
|
4184
|
+
*
|
|
4185
|
+
* @param weight The fractional weight to be formatted.
|
|
4186
|
+
*
|
|
4187
|
+
* @return FractionalWeight The formatted fractional weight.
|
|
4188
|
+
*
|
|
3439
4189
|
* @category Utilities
|
|
3440
4190
|
*/
|
|
3441
|
-
function formatFractionalWeight(weight) {
|
|
4191
|
+
function formatFractionalWeight(weight, unit) {
|
|
3442
4192
|
if (!weight) return {
|
|
3443
4193
|
fractional: 0,
|
|
3444
4194
|
whole: 0
|
|
3445
4195
|
};
|
|
3446
|
-
|
|
4196
|
+
//allow up to 5 decimal places for metric weights
|
|
4197
|
+
if (isMetricWeightUnit(unit) && weight.whole) {
|
|
4198
|
+
return {
|
|
4199
|
+
fractional: 0,
|
|
4200
|
+
whole: Number(weight.whole.toFixed(5)) || 0
|
|
4201
|
+
};
|
|
4202
|
+
}
|
|
4203
|
+
const valueAsOz = convertPoundsAndOuncesToOunces(weight);
|
|
3447
4204
|
const valueAsLbs = valueAsOz / 16;
|
|
3448
4205
|
return {
|
|
3449
4206
|
fractional: Math.round((valueAsLbs - Math.floor(valueAsLbs)) * 16 * 100) / 100,
|
|
@@ -3452,15 +4209,28 @@ function formatFractionalWeight(weight) {
|
|
|
3452
4209
|
}
|
|
3453
4210
|
|
|
3454
4211
|
/**
|
|
4212
|
+
* @internal
|
|
4213
|
+
*
|
|
4214
|
+
* # Package Utilities - isFlatRatePackageCode
|
|
4215
|
+
*
|
|
3455
4216
|
* @category Utilities
|
|
3456
4217
|
*/
|
|
3457
4218
|
const isFlatRatePackageCode = packageCode => {
|
|
3458
4219
|
return packageCode ? packageCode.includes("flat_rate") : false;
|
|
3459
4220
|
};
|
|
3460
4221
|
|
|
4222
|
+
/**
|
|
4223
|
+
* @internal
|
|
4224
|
+
*
|
|
4225
|
+
* # Capitalize First Letter Utility Function
|
|
4226
|
+
*
|
|
4227
|
+
* - This is a utility function that `capitalizes` the first letter of a given string.
|
|
4228
|
+
*/
|
|
3461
4229
|
const capitalizeFirstLetter = str => str.slice(0, 1).toUpperCase() + str.slice(1);
|
|
3462
4230
|
|
|
3463
4231
|
/**
|
|
4232
|
+
* @internal
|
|
4233
|
+
*
|
|
3464
4234
|
* Creates a Record of Emotion styles; eliminating the need to explicitly type styles
|
|
3465
4235
|
* while remaining fully typesafe w/ autocomplete.
|
|
3466
4236
|
*
|
|
@@ -3480,6 +4250,8 @@ const capitalizeFirstLetter = str => str.slice(0, 1).toUpperCase() + str.slice(1
|
|
|
3480
4250
|
* }),
|
|
3481
4251
|
* });
|
|
3482
4252
|
* ```
|
|
4253
|
+
*
|
|
4254
|
+
* @category Utilities
|
|
3483
4255
|
*/
|
|
3484
4256
|
const createStyles = styles => styles;
|
|
3485
4257
|
|
|
@@ -3490,6 +4262,10 @@ const buildError = (translationKey, error) => {
|
|
|
3490
4262
|
}, meta));
|
|
3491
4263
|
};
|
|
3492
4264
|
/**
|
|
4265
|
+
* @internal
|
|
4266
|
+
*
|
|
4267
|
+
* # Error Map
|
|
4268
|
+
*
|
|
3493
4269
|
* @category Utilities
|
|
3494
4270
|
*/
|
|
3495
4271
|
const errorMap = (issue, ctx) => {
|
|
@@ -3533,6 +4309,10 @@ const errorMap = (issue, ctx) => {
|
|
|
3533
4309
|
};
|
|
3534
4310
|
};
|
|
3535
4311
|
/**
|
|
4312
|
+
* @internal
|
|
4313
|
+
*
|
|
4314
|
+
* # Validation Resolver
|
|
4315
|
+
*
|
|
3536
4316
|
* @category Utilities
|
|
3537
4317
|
*/
|
|
3538
4318
|
const validationResolver = schema => (values, context, resolverOptions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -3543,57 +4323,14 @@ const validationResolver = schema => (values, context, resolverOptions) => __awa
|
|
|
3543
4323
|
return validationResult;
|
|
3544
4324
|
});
|
|
3545
4325
|
|
|
3546
|
-
const featureFlags = {
|
|
3547
|
-
ConfigureSalesOrderShipment: {
|
|
3548
|
-
compatibleCountryCodes: ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"],
|
|
3549
|
-
rateForm: {
|
|
3550
|
-
enableFunding: false,
|
|
3551
|
-
enableGlobalPostFiltering: false,
|
|
3552
|
-
labelLayout: false,
|
|
3553
|
-
nicknameRate: true,
|
|
3554
|
-
saveRate: true
|
|
3555
|
-
},
|
|
3556
|
-
shipmentForm: {
|
|
3557
|
-
browseRates: true,
|
|
3558
|
-
includeShipsuranceInsurance: true,
|
|
3559
|
-
includeThirdPartyInsurance: true,
|
|
3560
|
-
selectService: true,
|
|
3561
|
-
shippingPresets: false
|
|
3562
|
-
}
|
|
3563
|
-
},
|
|
3564
|
-
Global: {
|
|
3565
|
-
carriers: {
|
|
3566
|
-
enabledCarriers: ["stamps_com", "ups", "dhl_express_walleted"]
|
|
3567
|
-
},
|
|
3568
|
-
presentation: {
|
|
3569
|
-
poweredByShipEngine: false
|
|
3570
|
-
}
|
|
3571
|
-
},
|
|
3572
|
-
ViewShipment: {
|
|
3573
|
-
shipment: {
|
|
3574
|
-
schedulePickup: true
|
|
3575
|
-
}
|
|
3576
|
-
}
|
|
3577
|
-
};
|
|
3578
|
-
const featureFlagComponentNameLookup = componentName => {
|
|
3579
|
-
var _a;
|
|
3580
|
-
const lookup = {
|
|
3581
|
-
PurchaseLabel: "ConfigureSalesOrderShipment"
|
|
3582
|
-
};
|
|
3583
|
-
return (_a = lookup[componentName]) !== null && _a !== void 0 ? _a : "";
|
|
3584
|
-
};
|
|
3585
|
-
const getFeatures = (...element) => {
|
|
3586
|
-
return element.map(feat => {
|
|
3587
|
-
var _a;
|
|
3588
|
-
return (_a = get$1(featureFlags, feat)) !== null && _a !== void 0 ? _a : {};
|
|
3589
|
-
}).reduce((acc, feat) => Object.assign(acc, feat), {});
|
|
3590
|
-
};
|
|
3591
|
-
const useFeatures = (...element) => {
|
|
3592
|
-
return getFeatures(...element);
|
|
3593
|
-
};
|
|
3594
|
-
|
|
3595
4326
|
/**
|
|
3596
|
-
*
|
|
4327
|
+
* @internal
|
|
4328
|
+
*
|
|
4329
|
+
* # Date Range Options Hook
|
|
4330
|
+
*
|
|
4331
|
+
* A curated list of date range options relative to the immediate date.
|
|
4332
|
+
*
|
|
4333
|
+
* @see {@link DateRangeOption | The `DateRangeOption` type used in this hook}
|
|
3597
4334
|
*/
|
|
3598
4335
|
const useDateRangeOptions = () => {
|
|
3599
4336
|
const {
|
|
@@ -3623,6 +4360,13 @@ const useDateRangeOptions = () => {
|
|
|
3623
4360
|
return [options, optionsByValue];
|
|
3624
4361
|
};
|
|
3625
4362
|
|
|
4363
|
+
/**
|
|
4364
|
+
* @internal
|
|
4365
|
+
*
|
|
4366
|
+
* # Expiration Month Options Hook
|
|
4367
|
+
*
|
|
4368
|
+
* @cateogry Hooks
|
|
4369
|
+
*/
|
|
3626
4370
|
const useExpirationMonthOptions = () => {
|
|
3627
4371
|
const {
|
|
3628
4372
|
t
|
|
@@ -3666,6 +4410,13 @@ const useExpirationMonthOptions = () => {
|
|
|
3666
4410
|
}];
|
|
3667
4411
|
};
|
|
3668
4412
|
|
|
4413
|
+
/**
|
|
4414
|
+
* @internal
|
|
4415
|
+
*
|
|
4416
|
+
* # Insurance Provider Options Hook
|
|
4417
|
+
*
|
|
4418
|
+
* @category Hooks
|
|
4419
|
+
*/
|
|
3669
4420
|
const useInsuranceProviderOptions = (insuranceAccount, features) => {
|
|
3670
4421
|
const {
|
|
3671
4422
|
t
|
|
@@ -3676,6 +4427,13 @@ const useInsuranceProviderOptions = (insuranceAccount, features) => {
|
|
|
3676
4427
|
}), [t, insuranceAccount, features === null || features === void 0 ? void 0 : features.includeThirdPartyInsurance, features === null || features === void 0 ? void 0 : features.includeShipsuranceInsurance]);
|
|
3677
4428
|
};
|
|
3678
4429
|
|
|
4430
|
+
/**
|
|
4431
|
+
* @internal
|
|
4432
|
+
*
|
|
4433
|
+
* # Shipment Metadata Hook
|
|
4434
|
+
*
|
|
4435
|
+
* @category Hooks
|
|
4436
|
+
*/
|
|
3679
4437
|
const useShipmentMetadata = shipment => {
|
|
3680
4438
|
const isInternational = useMemo(() => {
|
|
3681
4439
|
return shipment ? getIsInternationalShipment(shipment) : false;
|
|
@@ -3689,13 +4447,22 @@ const useShipmentMetadata = shipment => {
|
|
|
3689
4447
|
var _a;
|
|
3690
4448
|
return shipment && ((_a = shipment.shipFrom) === null || _a === void 0 ? void 0 : _a.countryCode) === "MX" || (shipment === null || shipment === void 0 ? void 0 : shipment.shipTo.countryCode) === "MX";
|
|
3691
4449
|
}, [shipment]);
|
|
3692
|
-
|
|
4450
|
+
const shipmentUnits = useMemo(() => {
|
|
4451
|
+
const packageDimensions = shipment === null || shipment === void 0 ? void 0 : shipment.packages[0].dimensions;
|
|
4452
|
+
const packageWeight = shipment === null || shipment === void 0 ? void 0 : shipment.packages[0].weight;
|
|
4453
|
+
const packageMeasurements = [packageDimensions === null || packageDimensions === void 0 ? void 0 : packageDimensions.height, packageDimensions === null || packageDimensions === void 0 ? void 0 : packageDimensions.length, packageDimensions === null || packageDimensions === void 0 ? void 0 : packageDimensions.width, packageWeight === null || packageWeight === void 0 ? void 0 : packageWeight.value];
|
|
4454
|
+
const hasAllZeroMeasurements = packageMeasurements.every(m => m === 0);
|
|
4455
|
+
return {
|
|
4456
|
+
hasAllZeroMeasurements
|
|
4457
|
+
};
|
|
4458
|
+
}, [shipment]);
|
|
4459
|
+
return Object.assign({
|
|
3693
4460
|
isContentDescriptionRequired,
|
|
3694
4461
|
isCustomsRequired,
|
|
3695
4462
|
isInternational,
|
|
3696
4463
|
isPoBox,
|
|
3697
4464
|
isUnsupportedUpsCountry
|
|
3698
|
-
};
|
|
4465
|
+
}, shipmentUnits);
|
|
3699
4466
|
};
|
|
3700
4467
|
|
|
3701
4468
|
let _$2 = t => t,
|
|
@@ -3705,6 +4472,13 @@ const findGenericPackageFromCarriers = carriers => {
|
|
|
3705
4472
|
const carrier = carriers.find(c => c.packages.some(p => p.packageCode === "package"));
|
|
3706
4473
|
return carrier === null || carrier === void 0 ? void 0 : carrier.packages.find(p => p.packageCode === "package");
|
|
3707
4474
|
};
|
|
4475
|
+
/**
|
|
4476
|
+
* @internal
|
|
4477
|
+
*
|
|
4478
|
+
* # Package Options Hook
|
|
4479
|
+
*
|
|
4480
|
+
* @category Hooks
|
|
4481
|
+
*/
|
|
3708
4482
|
const usePackageOptions = (carriers, customPackageTypes, shipment) => {
|
|
3709
4483
|
const {
|
|
3710
4484
|
t
|
|
@@ -3766,7 +4540,12 @@ const usePackageOptions = (carriers, customPackageTypes, shipment) => {
|
|
|
3766
4540
|
}, [carriers, customPackageTypes, isPoBox, isUnsupportedUpsCountry, t]);
|
|
3767
4541
|
};
|
|
3768
4542
|
|
|
3769
|
-
|
|
4543
|
+
/**
|
|
4544
|
+
* @internal
|
|
4545
|
+
*
|
|
4546
|
+
* # Rate Options Hook
|
|
4547
|
+
*/
|
|
4548
|
+
const useRateOptions = (rates, carriers, shipment, enableGlobalPostFiltering, requireDhlTermsAcknowledgement) => {
|
|
3770
4549
|
const carriersById = useMemo(() => createDictionary(carriers, c => ({
|
|
3771
4550
|
[c.carrierId]: c
|
|
3772
4551
|
})), [carriers]);
|
|
@@ -3791,13 +4570,20 @@ const useRateOptions = (rates, carriers, shipment, enableGlobalPostFiltering) =>
|
|
|
3791
4570
|
return Object.assign(Object.assign({}, r), {
|
|
3792
4571
|
balance,
|
|
3793
4572
|
messages: r.warningMessages,
|
|
3794
|
-
requiresAcknowledgement: getRateRequiresAcknowledgement(r.serviceCode, r.packageType),
|
|
4573
|
+
requiresAcknowledgement: getRateRequiresAcknowledgement(r.serviceCode, r.packageType, !!requireDhlTermsAcknowledgement),
|
|
3795
4574
|
requiresFundedAmount
|
|
3796
4575
|
});
|
|
3797
4576
|
});
|
|
3798
|
-
}, [carriersById, enableGlobalPostFiltering, isInternational, isPoBox, isUnsupportedUpsCountry, rates]);
|
|
4577
|
+
}, [carriersById, enableGlobalPostFiltering, isInternational, isPoBox, isUnsupportedUpsCountry, rates, requireDhlTermsAcknowledgement]);
|
|
3799
4578
|
};
|
|
3800
4579
|
|
|
4580
|
+
/**
|
|
4581
|
+
* @internal
|
|
4582
|
+
*
|
|
4583
|
+
* # Service Code Options Hook
|
|
4584
|
+
*
|
|
4585
|
+
* @category Hooks
|
|
4586
|
+
*/
|
|
3801
4587
|
const useServiceCodeOptions = (carriers, shipment) => {
|
|
3802
4588
|
const {
|
|
3803
4589
|
isInternational,
|
|
@@ -3862,34 +4648,39 @@ const getWarningStyles = theme => /*#__PURE__*/css({
|
|
|
3862
4648
|
width: theme.spacing()
|
|
3863
4649
|
}, process.env.NODE_ENV === "production" ? "" : ";label:getWarningStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInByZXNldC1kZXNjcmlwdG9yLnN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFxQjJDIiwiZmlsZSI6InByZXNldC1kZXNjcmlwdG9yLnN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdFwiO1xyXG5leHBvcnQgY29uc3QgZ2V0Q29udGFpbmVyU3R5bGVzID0gKHRoZW1lKSA9PiBjc3Moe1xyXG4gICAgZGlzcGxheTogXCJmbGV4XCIsXHJcbiAgICBmbGV4RGlyZWN0aW9uOiBcImNvbHVtblwiLFxyXG4gICAgaGVpZ2h0OiBcIjEwMCVcIixcclxuICAgIHBhZGRpbmdUb3A6IHRoZW1lLnNwYWNpbmcoMC41KSxcclxuICAgIHdpZHRoOiBcIm1heC1jb250ZW50XCIsXHJcbn0pO1xyXG5leHBvcnQgY29uc3QgZ2V0RGltZW5zaW9uU3R5bGVzID0gKHRoZW1lKSA9PiBjc3Moe1xyXG4gICAgY29sb3I6IHRoZW1lLnBhbGV0dGUuZ3JheS5tYWluLFxyXG4gICAgZm9udFNpemU6IHRoZW1lLnR5cG9ncmFwaHkuZm9udFNpemUuWFMsXHJcbn0pO1xyXG5leHBvcnQgY29uc3QgZ2V0U2VydmljZU5hbWVTdHlsZXMgPSAodGhlbWUpID0+IGNzcyh7XHJcbiAgICBmb250U2l6ZTogdGhlbWUudHlwb2dyYXBoeS5mb250U2l6ZS5YWFMsXHJcbiAgICBsaW5lSGVpZ2h0OiAwLFxyXG4gICAgcGFkZGluZ1RvcDogdGhlbWUuc3BhY2luZygpLFxyXG59KTtcclxuZXhwb3J0IGNvbnN0IGdldFByZXNldE5hbWVTdHlsZXMgPSAodGhlbWUpID0+IGNzcyh7XHJcbiAgICBmb250U2l6ZTogdGhlbWUudHlwb2dyYXBoeS5mb250U2l6ZS5YUyxcclxuICAgIGZvbnRXZWlnaHQ6IHRoZW1lLnR5cG9ncmFwaHkuZm9udFdlaWdodC5ib2xkLFxyXG59KTtcclxuZXhwb3J0IGNvbnN0IGdldFdhcm5pbmdTdHlsZXMgPSAodGhlbWUpID0+IGNzcyh7XHJcbiAgICBiYWNrZ3JvdW5kOiBcIm5vbmVcIixcclxuICAgIG1hcmdpbkxlZnQ6IFwiYXV0b1wiLFxyXG4gICAgbWFyZ2luUmlnaHQ6IHRoZW1lLnNwYWNpbmcoLTMpLFxyXG4gICAgbWFyZ2luVG9wOiB0aGVtZS5zcGFjaW5nKC01KSxcclxuICAgIHdpZHRoOiB0aGVtZS5zcGFjaW5nKCksXHJcbn0pO1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1wcmVzZXQtZGVzY3JpcHRvci5zdHlsZXMuanMubWFwIl19 */");
|
|
3864
4650
|
|
|
3865
|
-
const PresetDescriptor = preset =>
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
4651
|
+
const PresetDescriptor = preset => {
|
|
4652
|
+
const {
|
|
4653
|
+
t
|
|
4654
|
+
} = useTranslation();
|
|
4655
|
+
return jsx("div", Object.assign({
|
|
4656
|
+
css: getContainerStyles
|
|
4657
|
+
}, {
|
|
4658
|
+
children: jsxs("div", {
|
|
4659
|
+
children: [jsxs("div", {
|
|
4660
|
+
children: [jsx("span", Object.assign({
|
|
4661
|
+
css: getPresetNameStyles
|
|
4662
|
+
}, {
|
|
4663
|
+
children: preset.name
|
|
4664
|
+
})), jsx("span", Object.assign({
|
|
4665
|
+
css: getDimensionStyles
|
|
4666
|
+
}, {
|
|
4667
|
+
children: (preset.dimensions || preset.weight) && " - "
|
|
4668
|
+
})), preset.dimensions && jsx("span", Object.assign({
|
|
4669
|
+
css: getDimensionStyles
|
|
4670
|
+
}, {
|
|
4671
|
+
children: `${formatDimensions(preset.dimensions)} ` + t(`units.${preset.dimensions.unit}`)
|
|
4672
|
+
}))]
|
|
4673
|
+
}), jsx("div", Object.assign({
|
|
4674
|
+
css: getServiceNameStyles
|
|
3880
4675
|
}, {
|
|
3881
|
-
children:
|
|
3882
|
-
}))]
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
type: NotificationType.ALERT
|
|
3890
|
-
})]
|
|
3891
|
-
})
|
|
3892
|
-
}));
|
|
4676
|
+
children: preset.serviceName && preset.serviceName
|
|
4677
|
+
})), preset.serviceName && ["USPS Parcel Select Ground", "USPS First Class Mail"].includes(preset.serviceName) && jsx(InlineNotification, {
|
|
4678
|
+
css: getWarningStyles,
|
|
4679
|
+
type: NotificationType.ALERT
|
|
4680
|
+
})]
|
|
4681
|
+
})
|
|
4682
|
+
}));
|
|
4683
|
+
};
|
|
3893
4684
|
|
|
3894
4685
|
const createCategoryFromShippingPresets = (categoryName, presets) => presets ? [{
|
|
3895
4686
|
categoryName: categoryName,
|
|
@@ -3899,6 +4690,11 @@ const createCategoryFromShippingPresets = (categoryName, presets) => presets ? [
|
|
|
3899
4690
|
value: p
|
|
3900
4691
|
}))
|
|
3901
4692
|
}] : [];
|
|
4693
|
+
/**
|
|
4694
|
+
* @internal
|
|
4695
|
+
*
|
|
4696
|
+
* # Shipping Preset Options Component
|
|
4697
|
+
*/
|
|
3902
4698
|
const useShippingPresetsOptions = ({
|
|
3903
4699
|
platform,
|
|
3904
4700
|
user
|
|
@@ -3914,11 +4710,25 @@ const useShippingPresetsOptions = ({
|
|
|
3914
4710
|
...createCategoryFromShippingPresets(t("shippingPresets.platform"), isInternational ? platform === null || platform === void 0 ? void 0 : platform.international : platform === null || platform === void 0 ? void 0 : platform.domestic)], [isInternational, platform, t, user]);
|
|
3915
4711
|
};
|
|
3916
4712
|
|
|
4713
|
+
/**
|
|
4714
|
+
* @internal
|
|
4715
|
+
*
|
|
4716
|
+
* # State Code Options Hook
|
|
4717
|
+
*
|
|
4718
|
+
* @category Hooks
|
|
4719
|
+
*/
|
|
3917
4720
|
const useStateCodeOptions = domestic => useMemo(() => usStates.flatMap(v => !domestic || !v.isMilitary && !v.isUnitedStatesTerritory ? {
|
|
3918
4721
|
label: v.name,
|
|
3919
4722
|
value: v.code
|
|
3920
4723
|
} : []), [domestic]);
|
|
3921
4724
|
|
|
4725
|
+
/**
|
|
4726
|
+
* @internal
|
|
4727
|
+
*
|
|
4728
|
+
* # Warehouse Options Hook
|
|
4729
|
+
*
|
|
4730
|
+
* @category Hooks
|
|
4731
|
+
*/
|
|
3922
4732
|
const useWarehouseOptions = warehouses => useMemo(() => {
|
|
3923
4733
|
if (!warehouses) return undefined;
|
|
3924
4734
|
return warehouses.map(warehouse => ({
|
|
@@ -4040,6 +4850,13 @@ var _carrierMetadata = [
|
|
|
4040
4850
|
}
|
|
4041
4851
|
];
|
|
4042
4852
|
|
|
4853
|
+
/**
|
|
4854
|
+
* @internal
|
|
4855
|
+
*
|
|
4856
|
+
* # Carrier Metadata Hook
|
|
4857
|
+
*
|
|
4858
|
+
* @category Hooks
|
|
4859
|
+
*/
|
|
4043
4860
|
const useCarrierMetadata = carrierCodes => {
|
|
4044
4861
|
const carrierMetadatas = _carrierMetadata;
|
|
4045
4862
|
return carrierCodes ? carrierCodes.flatMap(code => {
|
|
@@ -4049,7 +4866,11 @@ const useCarrierMetadata = carrierCodes => {
|
|
|
4049
4866
|
};
|
|
4050
4867
|
|
|
4051
4868
|
/**
|
|
4052
|
-
*
|
|
4869
|
+
* @internal
|
|
4870
|
+
*
|
|
4871
|
+
* # Portal
|
|
4872
|
+
*
|
|
4873
|
+
* - A no-frills wrapper around React.createPortal for more elegant DOM composition
|
|
4053
4874
|
*
|
|
4054
4875
|
* @category Components
|
|
4055
4876
|
*
|
|
@@ -4069,11 +4890,15 @@ const Portal = ({
|
|
|
4069
4890
|
const RootPortalContext = /*#__PURE__*/createContext(undefined);
|
|
4070
4891
|
RootPortalContext.displayName = "RootPortalContext";
|
|
4071
4892
|
/**
|
|
4893
|
+
* @internal
|
|
4894
|
+
*
|
|
4895
|
+
* # Root Portal Provider
|
|
4896
|
+
*
|
|
4072
4897
|
* Provides access to a top-level 'root-portal' DOM node, adjacent the app 'root' div
|
|
4073
4898
|
*
|
|
4074
4899
|
* @category Providers
|
|
4075
4900
|
*
|
|
4076
|
-
* @see {@link
|
|
4901
|
+
* @see {@link useRootPortal | The associated `hook` for this provider}
|
|
4077
4902
|
*/
|
|
4078
4903
|
const RootPortalProvider = ({
|
|
4079
4904
|
children
|
|
@@ -4094,9 +4919,18 @@ const RootPortalProvider = ({
|
|
|
4094
4919
|
}));
|
|
4095
4920
|
};
|
|
4096
4921
|
/**
|
|
4097
|
-
*
|
|
4922
|
+
* @internal
|
|
4923
|
+
*
|
|
4924
|
+
* # Root Portal Provider Hook
|
|
4925
|
+
*
|
|
4926
|
+
* The `useRootPortal` hook provides access to a top-level 'root-portal' DOM node, adjacent
|
|
4927
|
+
* the app 'root' div.
|
|
4928
|
+
*
|
|
4929
|
+
* - Must be used within {@link RootPortalProvider | a `<RootPortalProvider />`}
|
|
4098
4930
|
*
|
|
4099
4931
|
* @category Elements Hooks
|
|
4932
|
+
*
|
|
4933
|
+
* @see {@link RootPortalProvider | The associated `provider` for this hook}
|
|
4100
4934
|
*/
|
|
4101
4935
|
const useRootPortal = () => {
|
|
4102
4936
|
const rootPortal = useContext(RootPortalContext);
|
|
@@ -4107,6 +4941,10 @@ const useRootPortal = () => {
|
|
|
4107
4941
|
};
|
|
4108
4942
|
|
|
4109
4943
|
/**
|
|
4944
|
+
* @internal
|
|
4945
|
+
*
|
|
4946
|
+
* # Nested Form Hook Component
|
|
4947
|
+
*
|
|
4110
4948
|
* Returns a nested form element that can be rendered within another form
|
|
4111
4949
|
*
|
|
4112
4950
|
* Handles closing the form on cancel or submission
|
|
@@ -4156,6 +4994,13 @@ const useNestedForm = (form, props) => {
|
|
|
4156
4994
|
|
|
4157
4995
|
const PageLayoutContext = /*#__PURE__*/createContext(undefined);
|
|
4158
4996
|
PageLayoutContext.displayName = "PageLayoutContext";
|
|
4997
|
+
/**
|
|
4998
|
+
* @internal
|
|
4999
|
+
*
|
|
5000
|
+
* # Page Layout Component
|
|
5001
|
+
*
|
|
5002
|
+
* @see {@link PageLayoutProviderProps | The props passed into the `<PageLayoutProvider />` component}
|
|
5003
|
+
*/
|
|
4159
5004
|
const PageLayoutProvider = ({
|
|
4160
5005
|
children
|
|
4161
5006
|
}) => {
|
|
@@ -4206,6 +5051,13 @@ const PageLayoutProvider = ({
|
|
|
4206
5051
|
}))
|
|
4207
5052
|
}));
|
|
4208
5053
|
};
|
|
5054
|
+
/**
|
|
5055
|
+
* @internal
|
|
5056
|
+
*
|
|
5057
|
+
* # Page Layout Hook
|
|
5058
|
+
*
|
|
5059
|
+
* @category Hooks
|
|
5060
|
+
*/
|
|
4209
5061
|
const usePageLayout = () => {
|
|
4210
5062
|
const layoutPortals = useContext(PageLayoutContext);
|
|
4211
5063
|
if (!layoutPortals) {
|
|
@@ -4215,7 +5067,11 @@ const usePageLayout = () => {
|
|
|
4215
5067
|
};
|
|
4216
5068
|
|
|
4217
5069
|
/**
|
|
4218
|
-
*
|
|
5070
|
+
* @internal
|
|
5071
|
+
*
|
|
5072
|
+
* # Run Once On True Hook
|
|
5073
|
+
*
|
|
5074
|
+
* - Runs a callback once and only once when a condition is true.
|
|
4219
5075
|
*
|
|
4220
5076
|
* @param conditionalEffect A logical expression ending with a callback
|
|
4221
5077
|
* @example useRunOnceOnTrue(testValue && anotherTestValue && (() => console.log("Hello world!")));
|
|
@@ -4231,7 +5087,11 @@ const useRunOnceOnTrue = conditionalEffect => {
|
|
|
4231
5087
|
};
|
|
4232
5088
|
|
|
4233
5089
|
/**
|
|
4234
|
-
*
|
|
5090
|
+
* @internal
|
|
5091
|
+
*
|
|
5092
|
+
* # Toggle Hook
|
|
5093
|
+
*
|
|
5094
|
+
* - Create a boolean that can be toggled or set to a specific value
|
|
4235
5095
|
*
|
|
4236
5096
|
* @example
|
|
4237
5097
|
* ```tsx
|
|
@@ -4375,13 +5235,13 @@ var iterate$3 = function (iterable, unboundFunction, options) {
|
|
|
4375
5235
|
} return new Result(false);
|
|
4376
5236
|
};
|
|
4377
5237
|
|
|
4378
|
-
var $$
|
|
5238
|
+
var $$a = _export;
|
|
4379
5239
|
var iterate$2 = iterate$3;
|
|
4380
5240
|
var createProperty = createProperty$2;
|
|
4381
5241
|
|
|
4382
5242
|
// `Object.fromEntries` method
|
|
4383
5243
|
// https://github.com/tc39/proposal-object-from-entries
|
|
4384
|
-
$$
|
|
5244
|
+
$$a({ target: 'Object', stat: true }, {
|
|
4385
5245
|
fromEntries: function fromEntries(iterable) {
|
|
4386
5246
|
var obj = {};
|
|
4387
5247
|
iterate$2(iterable, function (k, v) {
|
|
@@ -4391,6 +5251,13 @@ $$b({ target: 'Object', stat: true }, {
|
|
|
4391
5251
|
}
|
|
4392
5252
|
});
|
|
4393
5253
|
|
|
5254
|
+
/**
|
|
5255
|
+
* @internal
|
|
5256
|
+
*
|
|
5257
|
+
* # Address Validation Hook
|
|
5258
|
+
*
|
|
5259
|
+
* @cateogry Hooks
|
|
5260
|
+
*/
|
|
4394
5261
|
const useAddressValidation = () => {
|
|
4395
5262
|
const [validationPreference, setValidationPreference] = useState();
|
|
4396
5263
|
const {
|
|
@@ -4478,7 +5345,9 @@ const useAddressValidation = () => {
|
|
|
4478
5345
|
* There is a chance that more than one script will be mounted if this hook is used elsewhere.
|
|
4479
5346
|
*/
|
|
4480
5347
|
/**
|
|
4481
|
-
*
|
|
5348
|
+
* @internal
|
|
5349
|
+
*
|
|
5350
|
+
* - Creates an encoded device fingerprint string - aka black box - containing information about the end-user's computing device such as OS, browser, etc.
|
|
4482
5351
|
* https://developer.bazaarvoice.com/conversations-api/deprecations/iovation-web#snare_js_only
|
|
4483
5352
|
*/
|
|
4484
5353
|
const useBlackboxDetection = ({
|
|
@@ -4532,6 +5401,114 @@ const useBlackboxDetection = ({
|
|
|
4532
5401
|
}, [onSuccess, onError]);
|
|
4533
5402
|
};
|
|
4534
5403
|
|
|
5404
|
+
var call$6 = functionCall;
|
|
5405
|
+
var hasOwn$2 = hasOwnProperty_1;
|
|
5406
|
+
var isPrototypeOf$2 = objectIsPrototypeOf;
|
|
5407
|
+
var regExpFlags = regexpFlags$1;
|
|
5408
|
+
|
|
5409
|
+
var RegExpPrototype$1 = RegExp.prototype;
|
|
5410
|
+
|
|
5411
|
+
var regexpGetFlags = function (R) {
|
|
5412
|
+
var flags = R.flags;
|
|
5413
|
+
return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn$2(R, 'flags') && isPrototypeOf$2(RegExpPrototype$1, R)
|
|
5414
|
+
? call$6(regExpFlags, R) : flags;
|
|
5415
|
+
};
|
|
5416
|
+
|
|
5417
|
+
var $$9 = _export;
|
|
5418
|
+
var call$5 = functionCall;
|
|
5419
|
+
var uncurryThis$4 = functionUncurryThis;
|
|
5420
|
+
var requireObjectCoercible$1 = requireObjectCoercible$9;
|
|
5421
|
+
var isCallable$5 = isCallable$o;
|
|
5422
|
+
var isNullOrUndefined$2 = isNullOrUndefined$7;
|
|
5423
|
+
var isRegExp = isRegexp;
|
|
5424
|
+
var toString$4 = toString$c;
|
|
5425
|
+
var getMethod$1 = getMethod$6;
|
|
5426
|
+
var getRegExpFlags$1 = regexpGetFlags;
|
|
5427
|
+
var getSubstitution = getSubstitution$2;
|
|
5428
|
+
var wellKnownSymbol$4 = wellKnownSymbol$k;
|
|
5429
|
+
|
|
5430
|
+
var REPLACE = wellKnownSymbol$4('replace');
|
|
5431
|
+
var $TypeError$4 = TypeError;
|
|
5432
|
+
var indexOf = uncurryThis$4(''.indexOf);
|
|
5433
|
+
uncurryThis$4(''.replace);
|
|
5434
|
+
var stringSlice$1 = uncurryThis$4(''.slice);
|
|
5435
|
+
var max = Math.max;
|
|
5436
|
+
|
|
5437
|
+
var stringIndexOf = function (string, searchValue, fromIndex) {
|
|
5438
|
+
if (fromIndex > string.length) return -1;
|
|
5439
|
+
if (searchValue === '') return fromIndex;
|
|
5440
|
+
return indexOf(string, searchValue, fromIndex);
|
|
5441
|
+
};
|
|
5442
|
+
|
|
5443
|
+
// `String.prototype.replaceAll` method
|
|
5444
|
+
// https://tc39.es/ecma262/#sec-string.prototype.replaceall
|
|
5445
|
+
$$9({ target: 'String', proto: true }, {
|
|
5446
|
+
replaceAll: function replaceAll(searchValue, replaceValue) {
|
|
5447
|
+
var O = requireObjectCoercible$1(this);
|
|
5448
|
+
var IS_REG_EXP, flags, replacer, string, searchString, functionalReplace, searchLength, advanceBy, replacement;
|
|
5449
|
+
var position = 0;
|
|
5450
|
+
var endOfLastMatch = 0;
|
|
5451
|
+
var result = '';
|
|
5452
|
+
if (!isNullOrUndefined$2(searchValue)) {
|
|
5453
|
+
IS_REG_EXP = isRegExp(searchValue);
|
|
5454
|
+
if (IS_REG_EXP) {
|
|
5455
|
+
flags = toString$4(requireObjectCoercible$1(getRegExpFlags$1(searchValue)));
|
|
5456
|
+
if (!~indexOf(flags, 'g')) throw $TypeError$4('`.replaceAll` does not allow non-global regexes');
|
|
5457
|
+
}
|
|
5458
|
+
replacer = getMethod$1(searchValue, REPLACE);
|
|
5459
|
+
if (replacer) {
|
|
5460
|
+
return call$5(replacer, searchValue, O, replaceValue);
|
|
5461
|
+
}
|
|
5462
|
+
}
|
|
5463
|
+
string = toString$4(O);
|
|
5464
|
+
searchString = toString$4(searchValue);
|
|
5465
|
+
functionalReplace = isCallable$5(replaceValue);
|
|
5466
|
+
if (!functionalReplace) replaceValue = toString$4(replaceValue);
|
|
5467
|
+
searchLength = searchString.length;
|
|
5468
|
+
advanceBy = max(1, searchLength);
|
|
5469
|
+
position = stringIndexOf(string, searchString, 0);
|
|
5470
|
+
while (position !== -1) {
|
|
5471
|
+
replacement = functionalReplace
|
|
5472
|
+
? toString$4(replaceValue(searchString, position, string))
|
|
5473
|
+
: getSubstitution(searchString, string, position, [], undefined, replaceValue);
|
|
5474
|
+
result += stringSlice$1(string, endOfLastMatch, position) + replacement;
|
|
5475
|
+
endOfLastMatch = position + searchLength;
|
|
5476
|
+
position = stringIndexOf(string, searchString, position + advanceBy);
|
|
5477
|
+
}
|
|
5478
|
+
if (endOfLastMatch < string.length) {
|
|
5479
|
+
result += stringSlice$1(string, endOfLastMatch);
|
|
5480
|
+
}
|
|
5481
|
+
return result;
|
|
5482
|
+
}
|
|
5483
|
+
});
|
|
5484
|
+
|
|
5485
|
+
/**
|
|
5486
|
+
* @internal
|
|
5487
|
+
*
|
|
5488
|
+
* # Scrub Errors Hook
|
|
5489
|
+
*
|
|
5490
|
+
* Generic error pretty printer
|
|
5491
|
+
*
|
|
5492
|
+
* @category Hooks
|
|
5493
|
+
*/
|
|
5494
|
+
const useScrubErrors = ({
|
|
5495
|
+
scrubber,
|
|
5496
|
+
errors,
|
|
5497
|
+
predicate
|
|
5498
|
+
}) => {
|
|
5499
|
+
const {
|
|
5500
|
+
t
|
|
5501
|
+
} = useTranslation();
|
|
5502
|
+
return useMemo(() => errors === null || errors === void 0 ? void 0 : errors.map(e => {
|
|
5503
|
+
return t(encode(e.message), {
|
|
5504
|
+
defaultValue: !predicate || predicate(e) ? t(scrubber(e)) : networkErrorPrettyPrinter(e)
|
|
5505
|
+
});
|
|
5506
|
+
}), [errors, predicate, scrubber, t]);
|
|
5507
|
+
};
|
|
5508
|
+
const networkErrorPrettyPrinter = e => {
|
|
5509
|
+
return e.message.replaceAll(/Invalid rate\. Invalid rate\./g, "Invalid rate.");
|
|
5510
|
+
};
|
|
5511
|
+
|
|
4535
5512
|
const useListConnectedCarriers = () => {
|
|
4536
5513
|
const {
|
|
4537
5514
|
data: carriers,
|
|
@@ -4552,6 +5529,29 @@ const useListConnectedCarriers = () => {
|
|
|
4552
5529
|
};
|
|
4553
5530
|
};
|
|
4554
5531
|
|
|
5532
|
+
/**
|
|
5533
|
+
* # List-Carriers Component
|
|
5534
|
+
*
|
|
5535
|
+
* @param ComponentProps The base props that will be passed into the `<List-Carriers />` component.
|
|
5536
|
+
*
|
|
5537
|
+
* @returns Element A React element that renders the `<List-Carriers />` component allowing users
|
|
5538
|
+
* to view a list of carriers that are connected to their ShipEngine account. This component is
|
|
5539
|
+
* composed in the `<AccountSettings />` Element.
|
|
5540
|
+
*
|
|
5541
|
+
* @example
|
|
5542
|
+
* ```tsx
|
|
5543
|
+
* (() => {
|
|
5544
|
+
* const features = useFeatures("Global");
|
|
5545
|
+
*
|
|
5546
|
+
* return <ListCarriers.Component features={features} />;
|
|
5547
|
+
* })();
|
|
5548
|
+
* ```
|
|
5549
|
+
*
|
|
5550
|
+
* <br />
|
|
5551
|
+
*
|
|
5552
|
+
* @see {@link ListCarriers.ComponentProps | The props that are passed into the `<List-Carriers />` component}
|
|
5553
|
+
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<List-Carriers />` component}
|
|
5554
|
+
*/
|
|
4555
5555
|
const Component$6 = ({
|
|
4556
5556
|
features
|
|
4557
5557
|
}) => {
|
|
@@ -4596,6 +5596,29 @@ var listCarriers$1 = /*#__PURE__*/Object.freeze({
|
|
|
4596
5596
|
Component: Component$6
|
|
4597
5597
|
});
|
|
4598
5598
|
|
|
5599
|
+
/**
|
|
5600
|
+
* # Manage Warehouses Component
|
|
5601
|
+
*
|
|
5602
|
+
* - The `<ManageWarehouses />` component is used to manage warehouses on a user's ShipEngine account. Users can add, update, or make warehouses inactive.
|
|
5603
|
+
* `<AccountSettings />` Element.
|
|
5604
|
+
*
|
|
5605
|
+
* @param ComponentProps The base props that will be passed into the `<ManageWarehouses />` component.
|
|
5606
|
+
*
|
|
5607
|
+
* @returns Element A React element that renders the `<ManageWarehouses />` component allowing users
|
|
5608
|
+
* to manage warehouses on their ShipEngine account.
|
|
5609
|
+
*
|
|
5610
|
+
* @example
|
|
5611
|
+
* ```tsx
|
|
5612
|
+
* export const ManageWarehousesExample = () => {
|
|
5613
|
+
* return <ManageWarehouses.Component />;
|
|
5614
|
+
* };
|
|
5615
|
+
* ```
|
|
5616
|
+
*
|
|
5617
|
+
* <br />
|
|
5618
|
+
*
|
|
5619
|
+
* @see {@link ManageWarehouses.ComponentProps | The props that are passed into the `<ManageWarehouses />` component}
|
|
5620
|
+
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<ManageWarehouses />` component}
|
|
5621
|
+
*/
|
|
4599
5622
|
const Component$5 = ({
|
|
4600
5623
|
onWarehouseAddressValidation
|
|
4601
5624
|
}) => {
|
|
@@ -4629,211 +5652,57 @@ const Component$5 = ({
|
|
|
4629
5652
|
});
|
|
4630
5653
|
void refreshListWarehouses();
|
|
4631
5654
|
});
|
|
4632
|
-
const handleSubmitAddNewWarehouse = payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
4633
|
-
const result = yield createWarehouse(payload);
|
|
4634
|
-
if (result) void refreshListWarehouses();
|
|
4635
|
-
});
|
|
4636
|
-
const handleSubmitEditWarehouse = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4637
|
-
yield updateWarehouse({
|
|
4638
|
-
isDefault: payload.isDefault,
|
|
4639
|
-
name: payload.name,
|
|
4640
|
-
originAddress: payload.originAddress,
|
|
4641
|
-
returnAddress: payload.returnAddress,
|
|
4642
|
-
warehouseId: warehouseId
|
|
4643
|
-
});
|
|
4644
|
-
yield refreshListWarehouses();
|
|
4645
|
-
});
|
|
4646
|
-
const handleSetDefault = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4647
|
-
yield updateWarehouse(Object.assign(Object.assign({}, payload), {
|
|
4648
|
-
isDefault: true,
|
|
4649
|
-
warehouseId
|
|
4650
|
-
}));
|
|
4651
|
-
yield refreshListWarehouses();
|
|
4652
|
-
});
|
|
4653
|
-
if (listWarehouseErrors) {
|
|
4654
|
-
throw new Error(listWarehouseErrors.map(e => e.message).join(", "));
|
|
4655
|
-
}
|
|
4656
|
-
const sortedWarehouses = warehouses === null || warehouses === void 0 ? void 0 : warehouses.sort((a, b) => {
|
|
4657
|
-
if (b.isDefault && !a.isDefault) return 1;
|
|
4658
|
-
if (a.isDefault && !b.isDefault) return -1;
|
|
4659
|
-
return sortByCreationDate(a, b, "desc");
|
|
4660
|
-
});
|
|
4661
|
-
const errors = [...(updateWarehouseErrors !== null && updateWarehouseErrors !== void 0 ? updateWarehouseErrors : []), ...(createWarehouseErrors !== null && createWarehouseErrors !== void 0 ? createWarehouseErrors : []), ...(deleteWarehouseErrors !== null && deleteWarehouseErrors !== void 0 ? deleteWarehouseErrors : [])];
|
|
4662
|
-
return jsx(CollapsiblePanel, Object.assign({
|
|
4663
|
-
errors: errors,
|
|
4664
|
-
isSaving: creatingWarehouse || deletingWarehouse || updatingWarehouse,
|
|
4665
|
-
title: t("account-settings:sections.warehouses")
|
|
4666
|
-
}, {
|
|
4667
|
-
children: isLoadingWarehouses ? jsx(Loader, {
|
|
4668
|
-
message: t("loading.warehouses")
|
|
4669
|
-
}) : jsx(ManageWarehouses, {
|
|
4670
|
-
errors: errors,
|
|
4671
|
-
onAdd: handleSubmitAddNewWarehouse,
|
|
4672
|
-
onDelete: handleDeleteWarehouse,
|
|
4673
|
-
onEdit: handleSubmitEditWarehouse,
|
|
4674
|
-
onSetDefault: handleSetDefault,
|
|
4675
|
-
warehouses: sortedWarehouses || []
|
|
4676
|
-
})
|
|
4677
|
-
}));
|
|
4678
|
-
};
|
|
4679
|
-
|
|
4680
|
-
var manageWarehouses$1 = /*#__PURE__*/Object.freeze({
|
|
4681
|
-
__proto__: null,
|
|
4682
|
-
Component: Component$5
|
|
4683
|
-
});
|
|
4684
|
-
|
|
4685
|
-
var uncurryThis$6 = functionUncurryThis;
|
|
4686
|
-
|
|
4687
|
-
// `thisNumberValue` abstract operation
|
|
4688
|
-
// https://tc39.es/ecma262/#sec-thisnumbervalue
|
|
4689
|
-
var thisNumberValue$1 = uncurryThis$6(1.0.valueOf);
|
|
4690
|
-
|
|
4691
|
-
var toIntegerOrInfinity$1 = toIntegerOrInfinity$6;
|
|
4692
|
-
var toString$5 = toString$c;
|
|
4693
|
-
var requireObjectCoercible$2 = requireObjectCoercible$9;
|
|
4694
|
-
|
|
4695
|
-
var $RangeError$1 = RangeError;
|
|
4696
|
-
|
|
4697
|
-
// `String.prototype.repeat` method implementation
|
|
4698
|
-
// https://tc39.es/ecma262/#sec-string.prototype.repeat
|
|
4699
|
-
var stringRepeat = function repeat(count) {
|
|
4700
|
-
var str = toString$5(requireObjectCoercible$2(this));
|
|
4701
|
-
var result = '';
|
|
4702
|
-
var n = toIntegerOrInfinity$1(count);
|
|
4703
|
-
if (n < 0 || n == Infinity) throw $RangeError$1('Wrong number of repetitions');
|
|
4704
|
-
for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;
|
|
4705
|
-
return result;
|
|
4706
|
-
};
|
|
4707
|
-
|
|
4708
|
-
var $$a = _export;
|
|
4709
|
-
var uncurryThis$5 = functionUncurryThis;
|
|
4710
|
-
var toIntegerOrInfinity = toIntegerOrInfinity$6;
|
|
4711
|
-
var thisNumberValue = thisNumberValue$1;
|
|
4712
|
-
var $repeat = stringRepeat;
|
|
4713
|
-
var fails$4 = fails$q;
|
|
4714
|
-
|
|
4715
|
-
var $RangeError = RangeError;
|
|
4716
|
-
var $String = String;
|
|
4717
|
-
var floor = Math.floor;
|
|
4718
|
-
var repeat = uncurryThis$5($repeat);
|
|
4719
|
-
var stringSlice$2 = uncurryThis$5(''.slice);
|
|
4720
|
-
var nativeToFixed = uncurryThis$5(1.0.toFixed);
|
|
4721
|
-
|
|
4722
|
-
var pow = function (x, n, acc) {
|
|
4723
|
-
return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
|
|
4724
|
-
};
|
|
4725
|
-
|
|
4726
|
-
var log = function (x) {
|
|
4727
|
-
var n = 0;
|
|
4728
|
-
var x2 = x;
|
|
4729
|
-
while (x2 >= 4096) {
|
|
4730
|
-
n += 12;
|
|
4731
|
-
x2 /= 4096;
|
|
4732
|
-
}
|
|
4733
|
-
while (x2 >= 2) {
|
|
4734
|
-
n += 1;
|
|
4735
|
-
x2 /= 2;
|
|
4736
|
-
} return n;
|
|
4737
|
-
};
|
|
4738
|
-
|
|
4739
|
-
var multiply = function (data, n, c) {
|
|
4740
|
-
var index = -1;
|
|
4741
|
-
var c2 = c;
|
|
4742
|
-
while (++index < 6) {
|
|
4743
|
-
c2 += n * data[index];
|
|
4744
|
-
data[index] = c2 % 1e7;
|
|
4745
|
-
c2 = floor(c2 / 1e7);
|
|
4746
|
-
}
|
|
4747
|
-
};
|
|
4748
|
-
|
|
4749
|
-
var divide = function (data, n) {
|
|
4750
|
-
var index = 6;
|
|
4751
|
-
var c = 0;
|
|
4752
|
-
while (--index >= 0) {
|
|
4753
|
-
c += data[index];
|
|
4754
|
-
data[index] = floor(c / n);
|
|
4755
|
-
c = (c % n) * 1e7;
|
|
4756
|
-
}
|
|
4757
|
-
};
|
|
4758
|
-
|
|
4759
|
-
var dataToString = function (data) {
|
|
4760
|
-
var index = 6;
|
|
4761
|
-
var s = '';
|
|
4762
|
-
while (--index >= 0) {
|
|
4763
|
-
if (s !== '' || index === 0 || data[index] !== 0) {
|
|
4764
|
-
var t = $String(data[index]);
|
|
4765
|
-
s = s === '' ? t : s + repeat('0', 7 - t.length) + t;
|
|
4766
|
-
}
|
|
4767
|
-
} return s;
|
|
4768
|
-
};
|
|
4769
|
-
|
|
4770
|
-
var FORCED$2 = fails$4(function () {
|
|
4771
|
-
return nativeToFixed(0.00008, 3) !== '0.000' ||
|
|
4772
|
-
nativeToFixed(0.9, 0) !== '1' ||
|
|
4773
|
-
nativeToFixed(1.255, 2) !== '1.25' ||
|
|
4774
|
-
nativeToFixed(1000000000000000128.0, 0) !== '1000000000000000128';
|
|
4775
|
-
}) || !fails$4(function () {
|
|
4776
|
-
// V8 ~ Android 4.3-
|
|
4777
|
-
nativeToFixed({});
|
|
4778
|
-
});
|
|
4779
|
-
|
|
4780
|
-
// `Number.prototype.toFixed` method
|
|
4781
|
-
// https://tc39.es/ecma262/#sec-number.prototype.tofixed
|
|
4782
|
-
$$a({ target: 'Number', proto: true, forced: FORCED$2 }, {
|
|
4783
|
-
toFixed: function toFixed(fractionDigits) {
|
|
4784
|
-
var number = thisNumberValue(this);
|
|
4785
|
-
var fractDigits = toIntegerOrInfinity(fractionDigits);
|
|
4786
|
-
var data = [0, 0, 0, 0, 0, 0];
|
|
4787
|
-
var sign = '';
|
|
4788
|
-
var result = '0';
|
|
4789
|
-
var e, z, j, k;
|
|
4790
|
-
|
|
4791
|
-
// TODO: ES2018 increased the maximum number of fraction digits to 100, need to improve the implementation
|
|
4792
|
-
if (fractDigits < 0 || fractDigits > 20) throw $RangeError('Incorrect fraction digits');
|
|
4793
|
-
// eslint-disable-next-line no-self-compare -- NaN check
|
|
4794
|
-
if (number != number) return 'NaN';
|
|
4795
|
-
if (number <= -1e21 || number >= 1e21) return $String(number);
|
|
4796
|
-
if (number < 0) {
|
|
4797
|
-
sign = '-';
|
|
4798
|
-
number = -number;
|
|
4799
|
-
}
|
|
4800
|
-
if (number > 1e-21) {
|
|
4801
|
-
e = log(number * pow(2, 69, 1)) - 69;
|
|
4802
|
-
z = e < 0 ? number * pow(2, -e, 1) : number / pow(2, e, 1);
|
|
4803
|
-
z *= 0x10000000000000;
|
|
4804
|
-
e = 52 - e;
|
|
4805
|
-
if (e > 0) {
|
|
4806
|
-
multiply(data, 0, z);
|
|
4807
|
-
j = fractDigits;
|
|
4808
|
-
while (j >= 7) {
|
|
4809
|
-
multiply(data, 1e7, 0);
|
|
4810
|
-
j -= 7;
|
|
4811
|
-
}
|
|
4812
|
-
multiply(data, pow(10, j, 1), 0);
|
|
4813
|
-
j = e - 1;
|
|
4814
|
-
while (j >= 23) {
|
|
4815
|
-
divide(data, 1 << 23);
|
|
4816
|
-
j -= 23;
|
|
4817
|
-
}
|
|
4818
|
-
divide(data, 1 << j);
|
|
4819
|
-
multiply(data, 1, 1);
|
|
4820
|
-
divide(data, 2);
|
|
4821
|
-
result = dataToString(data);
|
|
4822
|
-
} else {
|
|
4823
|
-
multiply(data, 0, z);
|
|
4824
|
-
multiply(data, 1 << -e, 0);
|
|
4825
|
-
result = dataToString(data) + repeat('0', fractDigits);
|
|
4826
|
-
}
|
|
4827
|
-
}
|
|
4828
|
-
if (fractDigits > 0) {
|
|
4829
|
-
k = result.length;
|
|
4830
|
-
result = sign + (k <= fractDigits
|
|
4831
|
-
? '0.' + repeat('0', fractDigits - k) + result
|
|
4832
|
-
: stringSlice$2(result, 0, k - fractDigits) + '.' + stringSlice$2(result, k - fractDigits));
|
|
4833
|
-
} else {
|
|
4834
|
-
result = sign + result;
|
|
4835
|
-
} return result;
|
|
5655
|
+
const handleSubmitAddNewWarehouse = payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
5656
|
+
const result = yield createWarehouse(payload);
|
|
5657
|
+
if (result) void refreshListWarehouses();
|
|
5658
|
+
});
|
|
5659
|
+
const handleSubmitEditWarehouse = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5660
|
+
yield updateWarehouse({
|
|
5661
|
+
isDefault: payload.isDefault,
|
|
5662
|
+
name: payload.name,
|
|
5663
|
+
originAddress: payload.originAddress,
|
|
5664
|
+
returnAddress: payload.returnAddress,
|
|
5665
|
+
warehouseId: warehouseId
|
|
5666
|
+
});
|
|
5667
|
+
yield refreshListWarehouses();
|
|
5668
|
+
});
|
|
5669
|
+
const handleSetDefault = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5670
|
+
yield updateWarehouse(Object.assign(Object.assign({}, payload), {
|
|
5671
|
+
isDefault: true,
|
|
5672
|
+
warehouseId
|
|
5673
|
+
}));
|
|
5674
|
+
yield refreshListWarehouses();
|
|
5675
|
+
});
|
|
5676
|
+
if (listWarehouseErrors) {
|
|
5677
|
+
throw new Error(listWarehouseErrors.map(e => e.message).join(", "));
|
|
4836
5678
|
}
|
|
5679
|
+
const sortedWarehouses = warehouses === null || warehouses === void 0 ? void 0 : warehouses.sort((a, b) => {
|
|
5680
|
+
if (b.isDefault && !a.isDefault) return 1;
|
|
5681
|
+
if (a.isDefault && !b.isDefault) return -1;
|
|
5682
|
+
return sortByCreationDate(a, b, "desc");
|
|
5683
|
+
});
|
|
5684
|
+
const errors = [...(updateWarehouseErrors !== null && updateWarehouseErrors !== void 0 ? updateWarehouseErrors : []), ...(createWarehouseErrors !== null && createWarehouseErrors !== void 0 ? createWarehouseErrors : []), ...(deleteWarehouseErrors !== null && deleteWarehouseErrors !== void 0 ? deleteWarehouseErrors : [])];
|
|
5685
|
+
return jsx(CollapsiblePanel, Object.assign({
|
|
5686
|
+
errors: errors,
|
|
5687
|
+
isSaving: creatingWarehouse || deletingWarehouse || updatingWarehouse,
|
|
5688
|
+
title: t("account-settings:sections.warehouses")
|
|
5689
|
+
}, {
|
|
5690
|
+
children: isLoadingWarehouses ? jsx(Loader, {
|
|
5691
|
+
message: t("loading.warehouses")
|
|
5692
|
+
}) : jsx(ManageWarehouses, {
|
|
5693
|
+
errors: errors,
|
|
5694
|
+
onAdd: handleSubmitAddNewWarehouse,
|
|
5695
|
+
onDelete: handleDeleteWarehouse,
|
|
5696
|
+
onEdit: handleSubmitEditWarehouse,
|
|
5697
|
+
onSetDefault: handleSetDefault,
|
|
5698
|
+
warehouses: sortedWarehouses || []
|
|
5699
|
+
})
|
|
5700
|
+
}));
|
|
5701
|
+
};
|
|
5702
|
+
|
|
5703
|
+
var manageWarehouses$1 = /*#__PURE__*/Object.freeze({
|
|
5704
|
+
__proto__: null,
|
|
5705
|
+
Component: Component$5
|
|
4837
5706
|
});
|
|
4838
5707
|
|
|
4839
5708
|
var img$5 = "data:image/svg+xml,%3csvg fill='none' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='M22.9425 6.62223L18.63 5.81973C18.4275 5.78223 18.2325 5.91723 18.195 6.11973L17.3925 10.4322C17.355 10.6347 17.49 10.8297 17.6925 10.8672C17.715 10.8672 17.7375 10.8672 17.76 10.8672C17.94 10.8672 18.0975 10.7397 18.1275 10.5597L18.765 7.13973C21.15 10.3872 20.8125 14.9472 17.9475 17.8047C15.3225 20.4297 11.25 20.9697 8.04001 19.1247C7.86001 19.0197 7.63501 19.0797 7.53001 19.2597C7.42501 19.4397 7.49251 19.6647 7.66501 19.7697C9.05251 20.5722 10.5975 20.9622 12.1275 20.9622C14.4525 20.9622 16.755 20.0622 18.48 18.3372C21.5925 15.2247 21.9675 10.2597 19.3875 6.71973L22.8 7.34973C22.995 7.38723 23.1975 7.25223 23.235 7.04973C23.2725 6.84723 23.1375 6.65223 22.935 6.61473L22.9425 6.62223Z' fill='black' /%3e %3cpath d='M6.30022 12.7798C6.09772 12.7423 5.90272 12.8773 5.86522 13.0798L5.24272 16.4548C3.15022 13.2223 3.60022 8.91728 6.33022 6.18728C8.85022 3.66728 12.6752 3.05228 15.8477 4.65728C16.0277 4.74728 16.2602 4.67978 16.3502 4.49228C16.4402 4.30478 16.3727 4.07978 16.1852 3.98978C12.7202 2.23478 8.54272 2.90978 5.79772 5.65478C2.79022 8.66228 2.31772 13.3948 4.65022 16.9273L1.19272 16.2898C0.990221 16.2523 0.795221 16.3873 0.757721 16.5898C0.720221 16.7923 0.855221 16.9873 1.05772 17.0248L5.37022 17.8273C5.37022 17.8273 5.41522 17.8273 5.43772 17.8273C5.61772 17.8273 5.77522 17.6998 5.80522 17.5198L6.60772 13.2073C6.64522 13.0048 6.51022 12.8098 6.30772 12.7723L6.30022 12.7798Z' fill='black' /%3e %3cpath d='M15.0824 13.2223C14.9249 12.9373 14.7224 12.6973 14.4674 12.4948C14.2124 12.2998 13.9349 12.1348 13.6274 11.9998C13.3199 11.8648 13.0124 11.7598 12.7124 11.6773L12.3149 11.5648V7.87482C12.8324 7.91232 13.2749 8.06232 13.6349 8.33232C14.0549 8.64732 14.2874 9.07482 14.3399 9.60732H15.1874C15.1724 9.11982 15.0224 8.68482 14.7524 8.30232C14.4824 7.91982 14.1149 7.61982 13.6574 7.40232C13.2599 7.21482 12.8099 7.12482 12.3149 7.09482V6.31482C12.3149 6.14232 12.1799 6.00732 12.0074 6.00732C11.8349 6.00732 11.6999 6.14232 11.6999 6.31482V7.10982C11.2649 7.14732 10.8449 7.22982 10.4774 7.40232C10.0049 7.61982 9.62988 7.92732 9.35238 8.31732C9.07488 8.70732 8.93988 9.16482 8.93988 9.67482C8.93988 10.2898 9.14988 10.7998 9.56238 11.1898C9.97488 11.5798 10.5599 11.8948 11.3174 12.1198L11.6999 12.2323V16.1323C11.3849 16.1098 11.0849 16.0573 10.8224 15.9523C10.4699 15.8173 10.1849 15.6148 9.96738 15.3523C9.74988 15.0898 9.62238 14.7673 9.59238 14.3923V14.3323C9.59238 14.0848 9.38988 13.8823 9.14238 13.8823C8.89488 13.8823 8.69238 14.0848 8.69238 14.3323V14.3923C8.72988 14.8948 8.87988 15.3448 9.15738 15.7273C9.43488 16.1098 9.80988 16.4098 10.2899 16.6273C10.6949 16.8073 11.1749 16.8973 11.6999 16.9273V17.6848C11.6999 17.8573 11.8349 17.9923 12.0074 17.9923C12.1799 17.9923 12.3149 17.8573 12.3149 17.6848V16.9348C12.8699 16.9048 13.3574 16.7923 13.7774 16.5898C14.2724 16.3498 14.6549 16.0273 14.9174 15.6148C15.1799 15.2023 15.3149 14.7448 15.3149 14.2348C15.3149 13.8373 15.2399 13.4923 15.0824 13.2073V13.2223ZM11.0099 11.1448C10.7849 11.0473 10.5749 10.9348 10.3949 10.7923C10.2074 10.6573 10.0574 10.4923 9.95238 10.3048C9.84738 10.1173 9.78738 9.89232 9.78738 9.63732C9.78738 9.29232 9.88488 8.98482 10.0724 8.71482C10.2674 8.44482 10.5299 8.23482 10.8674 8.07732C11.1149 7.96482 11.3924 7.91232 11.6924 7.88232V11.3848C11.4599 11.3173 11.2349 11.2348 11.0024 11.1373L11.0099 11.1448ZM14.1449 15.2473C13.9274 15.5398 13.6349 15.7648 13.2674 15.9223C12.9824 16.0423 12.6599 16.1023 12.3149 16.1323V12.4198L12.4649 12.4648C12.8624 12.5773 13.2074 12.7123 13.5149 12.8623C13.8149 13.0123 14.0549 13.1998 14.2199 13.4173C14.3849 13.6348 14.4749 13.9123 14.4749 14.2348C14.4749 14.6173 14.3699 14.9548 14.1524 15.2473H14.1449Z' fill='black' /%3e %3cpath d='M14.7525 10.0796C14.985 10.0796 15.1725 9.89211 15.1725 9.65961V9.59961H14.3325V9.65961C14.3325 9.89211 14.52 10.0796 14.7525 10.0796Z' fill='black' /%3e%3c/svg%3e";
|
|
@@ -4872,10 +5741,10 @@ const Label$1 = ({
|
|
|
4872
5741
|
|
|
4873
5742
|
var getBuiltIn$2 = getBuiltIn$8;
|
|
4874
5743
|
var definePropertyModule = objectDefineProperty;
|
|
4875
|
-
var wellKnownSymbol$
|
|
5744
|
+
var wellKnownSymbol$3 = wellKnownSymbol$k;
|
|
4876
5745
|
var DESCRIPTORS$1 = descriptors;
|
|
4877
5746
|
|
|
4878
|
-
var SPECIES$2 = wellKnownSymbol$
|
|
5747
|
+
var SPECIES$2 = wellKnownSymbol$3('species');
|
|
4879
5748
|
|
|
4880
5749
|
var setSpecies$1 = function (CONSTRUCTOR_NAME) {
|
|
4881
5750
|
var Constructor = getBuiltIn$2(CONSTRUCTOR_NAME);
|
|
@@ -4889,49 +5758,49 @@ var setSpecies$1 = function (CONSTRUCTOR_NAME) {
|
|
|
4889
5758
|
}
|
|
4890
5759
|
};
|
|
4891
5760
|
|
|
4892
|
-
var isPrototypeOf$
|
|
5761
|
+
var isPrototypeOf$1 = objectIsPrototypeOf;
|
|
4893
5762
|
|
|
4894
|
-
var $TypeError$
|
|
5763
|
+
var $TypeError$3 = TypeError;
|
|
4895
5764
|
|
|
4896
5765
|
var anInstance$1 = function (it, Prototype) {
|
|
4897
|
-
if (isPrototypeOf$
|
|
4898
|
-
throw $TypeError$
|
|
5766
|
+
if (isPrototypeOf$1(Prototype, it)) return it;
|
|
5767
|
+
throw $TypeError$3('Incorrect invocation');
|
|
4899
5768
|
};
|
|
4900
5769
|
|
|
4901
5770
|
var isConstructor = isConstructor$2;
|
|
4902
5771
|
var tryToString = tryToString$5;
|
|
4903
5772
|
|
|
4904
|
-
var $TypeError$
|
|
5773
|
+
var $TypeError$2 = TypeError;
|
|
4905
5774
|
|
|
4906
5775
|
// `Assert: IsConstructor(argument) is true`
|
|
4907
5776
|
var aConstructor$1 = function (argument) {
|
|
4908
5777
|
if (isConstructor(argument)) return argument;
|
|
4909
|
-
throw $TypeError$
|
|
5778
|
+
throw $TypeError$2(tryToString(argument) + ' is not a constructor');
|
|
4910
5779
|
};
|
|
4911
5780
|
|
|
4912
5781
|
var anObject$3 = anObject$f;
|
|
4913
5782
|
var aConstructor = aConstructor$1;
|
|
4914
|
-
var isNullOrUndefined$
|
|
4915
|
-
var wellKnownSymbol$
|
|
5783
|
+
var isNullOrUndefined$1 = isNullOrUndefined$7;
|
|
5784
|
+
var wellKnownSymbol$2 = wellKnownSymbol$k;
|
|
4916
5785
|
|
|
4917
|
-
var SPECIES$1 = wellKnownSymbol$
|
|
5786
|
+
var SPECIES$1 = wellKnownSymbol$2('species');
|
|
4918
5787
|
|
|
4919
5788
|
// `SpeciesConstructor` abstract operation
|
|
4920
5789
|
// https://tc39.es/ecma262/#sec-speciesconstructor
|
|
4921
5790
|
var speciesConstructor$1 = function (O, defaultConstructor) {
|
|
4922
5791
|
var C = anObject$3(O).constructor;
|
|
4923
5792
|
var S;
|
|
4924
|
-
return C === undefined || isNullOrUndefined$
|
|
5793
|
+
return C === undefined || isNullOrUndefined$1(S = anObject$3(C)[SPECIES$1]) ? defaultConstructor : aConstructor(S);
|
|
4925
5794
|
};
|
|
4926
5795
|
|
|
4927
|
-
var uncurryThis$
|
|
5796
|
+
var uncurryThis$3 = functionUncurryThis;
|
|
4928
5797
|
|
|
4929
|
-
var arraySlice$1 = uncurryThis$
|
|
5798
|
+
var arraySlice$1 = uncurryThis$3([].slice);
|
|
4930
5799
|
|
|
4931
|
-
var $TypeError$
|
|
5800
|
+
var $TypeError$1 = TypeError;
|
|
4932
5801
|
|
|
4933
5802
|
var validateArgumentsLength$1 = function (passed, required) {
|
|
4934
|
-
if (passed < required) throw $TypeError$
|
|
5803
|
+
if (passed < required) throw $TypeError$1('Not enough arguments');
|
|
4935
5804
|
return passed;
|
|
4936
5805
|
};
|
|
4937
5806
|
|
|
@@ -4942,8 +5811,8 @@ var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$2);
|
|
|
4942
5811
|
var global$a = global$p;
|
|
4943
5812
|
var apply = functionApply;
|
|
4944
5813
|
var bind$2 = functionBindContext;
|
|
4945
|
-
var isCallable$
|
|
4946
|
-
var hasOwn$
|
|
5814
|
+
var isCallable$4 = isCallable$o;
|
|
5815
|
+
var hasOwn$1 = hasOwnProperty_1;
|
|
4947
5816
|
var fails$3 = fails$q;
|
|
4948
5817
|
var html = html$2;
|
|
4949
5818
|
var arraySlice = arraySlice$1;
|
|
@@ -4970,7 +5839,7 @@ try {
|
|
|
4970
5839
|
} catch (error) { /* empty */ }
|
|
4971
5840
|
|
|
4972
5841
|
var run = function (id) {
|
|
4973
|
-
if (hasOwn$
|
|
5842
|
+
if (hasOwn$1(queue$1, id)) {
|
|
4974
5843
|
var fn = queue$1[id];
|
|
4975
5844
|
delete queue$1[id];
|
|
4976
5845
|
fn();
|
|
@@ -4996,7 +5865,7 @@ var post = function (id) {
|
|
|
4996
5865
|
if (!set || !clear) {
|
|
4997
5866
|
set = function setImmediate(handler) {
|
|
4998
5867
|
validateArgumentsLength(arguments.length, 1);
|
|
4999
|
-
var fn = isCallable$
|
|
5868
|
+
var fn = isCallable$4(handler) ? handler : Function$1(handler);
|
|
5000
5869
|
var args = arraySlice(arguments, 1);
|
|
5001
5870
|
queue$1[++counter] = function () {
|
|
5002
5871
|
apply(fn, undefined, args);
|
|
@@ -5028,7 +5897,7 @@ if (!set || !clear) {
|
|
|
5028
5897
|
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
|
|
5029
5898
|
} else if (
|
|
5030
5899
|
global$a.addEventListener &&
|
|
5031
|
-
isCallable$
|
|
5900
|
+
isCallable$4(global$a.postMessage) &&
|
|
5032
5901
|
!global$a.importScripts &&
|
|
5033
5902
|
$location && $location.protocol !== 'file:' &&
|
|
5034
5903
|
!fails$3(post)
|
|
@@ -5209,18 +6078,18 @@ var engineIsBrowser = !IS_DENO$1 && !IS_NODE$1
|
|
|
5209
6078
|
|
|
5210
6079
|
var global$5 = global$p;
|
|
5211
6080
|
var NativePromiseConstructor$3 = promiseNativeConstructor;
|
|
5212
|
-
var isCallable$
|
|
6081
|
+
var isCallable$3 = isCallable$o;
|
|
5213
6082
|
var isForced = isForced_1;
|
|
5214
6083
|
var inspectSource = inspectSource$3;
|
|
5215
|
-
var wellKnownSymbol$
|
|
6084
|
+
var wellKnownSymbol$1 = wellKnownSymbol$k;
|
|
5216
6085
|
var IS_BROWSER = engineIsBrowser;
|
|
5217
6086
|
var IS_DENO = engineIsDeno;
|
|
5218
6087
|
var V8_VERSION = engineV8Version;
|
|
5219
6088
|
|
|
5220
6089
|
NativePromiseConstructor$3 && NativePromiseConstructor$3.prototype;
|
|
5221
|
-
var SPECIES = wellKnownSymbol$
|
|
6090
|
+
var SPECIES = wellKnownSymbol$1('species');
|
|
5222
6091
|
var SUBCLASSING = false;
|
|
5223
|
-
var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable$
|
|
6092
|
+
var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable$3(global$5.PromiseRejectionEvent);
|
|
5224
6093
|
|
|
5225
6094
|
var FORCED_PROMISE_CONSTRUCTOR$5 = isForced('Promise', function () {
|
|
5226
6095
|
var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor$3);
|
|
@@ -5256,12 +6125,12 @@ var newPromiseCapability$2 = {};
|
|
|
5256
6125
|
|
|
5257
6126
|
var aCallable$3 = aCallable$a;
|
|
5258
6127
|
|
|
5259
|
-
var $TypeError
|
|
6128
|
+
var $TypeError = TypeError;
|
|
5260
6129
|
|
|
5261
6130
|
var PromiseCapability = function (C) {
|
|
5262
6131
|
var resolve, reject;
|
|
5263
6132
|
this.promise = new C(function ($$resolve, $$reject) {
|
|
5264
|
-
if (resolve !== undefined || reject !== undefined) throw $TypeError
|
|
6133
|
+
if (resolve !== undefined || reject !== undefined) throw $TypeError('Bad Promise constructor');
|
|
5265
6134
|
resolve = $$resolve;
|
|
5266
6135
|
reject = $$reject;
|
|
5267
6136
|
});
|
|
@@ -5275,16 +6144,16 @@ newPromiseCapability$2.f = function (C) {
|
|
|
5275
6144
|
return new PromiseCapability(C);
|
|
5276
6145
|
};
|
|
5277
6146
|
|
|
5278
|
-
var $$
|
|
6147
|
+
var $$8 = _export;
|
|
5279
6148
|
var IS_NODE = engineIsNode;
|
|
5280
6149
|
var global$4 = global$p;
|
|
5281
|
-
var call$
|
|
6150
|
+
var call$4 = functionCall;
|
|
5282
6151
|
var defineBuiltIn$2 = defineBuiltIn$7;
|
|
5283
6152
|
var setPrototypeOf = objectSetPrototypeOf;
|
|
5284
6153
|
var setToStringTag = setToStringTag$3;
|
|
5285
6154
|
var setSpecies = setSpecies$1;
|
|
5286
6155
|
var aCallable$2 = aCallable$a;
|
|
5287
|
-
var isCallable$
|
|
6156
|
+
var isCallable$2 = isCallable$o;
|
|
5288
6157
|
var isObject$1 = isObject$a;
|
|
5289
6158
|
var anInstance = anInstance$1;
|
|
5290
6159
|
var speciesConstructor = speciesConstructor$1;
|
|
@@ -5327,7 +6196,7 @@ var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
|
|
|
5327
6196
|
// helpers
|
|
5328
6197
|
var isThenable = function (it) {
|
|
5329
6198
|
var then;
|
|
5330
|
-
return isObject$1(it) && isCallable$
|
|
6199
|
+
return isObject$1(it) && isCallable$2(then = it.then) ? then : false;
|
|
5331
6200
|
};
|
|
5332
6201
|
|
|
5333
6202
|
var callReaction = function (reaction, state) {
|
|
@@ -5356,7 +6225,7 @@ var callReaction = function (reaction, state) {
|
|
|
5356
6225
|
if (result === reaction.promise) {
|
|
5357
6226
|
reject(TypeError$1('Promise-chain cycle'));
|
|
5358
6227
|
} else if (then = isThenable(result)) {
|
|
5359
|
-
call$
|
|
6228
|
+
call$4(then, result, resolve, reject);
|
|
5360
6229
|
} else resolve(result);
|
|
5361
6230
|
} else reject(value);
|
|
5362
6231
|
} catch (error) {
|
|
@@ -5393,7 +6262,7 @@ var dispatchEvent = function (name, promise, reason) {
|
|
|
5393
6262
|
};
|
|
5394
6263
|
|
|
5395
6264
|
var onUnhandled = function (state) {
|
|
5396
|
-
call$
|
|
6265
|
+
call$4(task, global$4, function () {
|
|
5397
6266
|
var promise = state.facade;
|
|
5398
6267
|
var value = state.value;
|
|
5399
6268
|
var IS_UNHANDLED = isUnhandled(state);
|
|
@@ -5416,7 +6285,7 @@ var isUnhandled = function (state) {
|
|
|
5416
6285
|
};
|
|
5417
6286
|
|
|
5418
6287
|
var onHandleUnhandled = function (state) {
|
|
5419
|
-
call$
|
|
6288
|
+
call$4(task, global$4, function () {
|
|
5420
6289
|
var promise = state.facade;
|
|
5421
6290
|
if (IS_NODE) {
|
|
5422
6291
|
process$1.emit('rejectionHandled', promise);
|
|
@@ -5450,7 +6319,7 @@ var internalResolve = function (state, value, unwrap) {
|
|
|
5450
6319
|
microtask(function () {
|
|
5451
6320
|
var wrapper = { done: false };
|
|
5452
6321
|
try {
|
|
5453
|
-
call$
|
|
6322
|
+
call$4(then, value,
|
|
5454
6323
|
bind(internalResolve, wrapper, state),
|
|
5455
6324
|
bind(internalReject, wrapper, state)
|
|
5456
6325
|
);
|
|
@@ -5474,7 +6343,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
5474
6343
|
PromiseConstructor = function Promise(executor) {
|
|
5475
6344
|
anInstance(this, PromisePrototype);
|
|
5476
6345
|
aCallable$2(executor);
|
|
5477
|
-
call$
|
|
6346
|
+
call$4(Internal, this);
|
|
5478
6347
|
var state = getInternalPromiseState(this);
|
|
5479
6348
|
try {
|
|
5480
6349
|
executor(bind(internalResolve, state), bind(internalReject, state));
|
|
@@ -5505,8 +6374,8 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
5505
6374
|
var state = getInternalPromiseState(this);
|
|
5506
6375
|
var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));
|
|
5507
6376
|
state.parent = true;
|
|
5508
|
-
reaction.ok = isCallable$
|
|
5509
|
-
reaction.fail = isCallable$
|
|
6377
|
+
reaction.ok = isCallable$2(onFulfilled) ? onFulfilled : true;
|
|
6378
|
+
reaction.fail = isCallable$2(onRejected) && onRejected;
|
|
5510
6379
|
reaction.domain = IS_NODE ? process$1.domain : undefined;
|
|
5511
6380
|
if (state.state == PENDING) state.reactions.add(reaction);
|
|
5512
6381
|
else microtask(function () {
|
|
@@ -5529,7 +6398,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
5529
6398
|
: newGenericPromiseCapability(C);
|
|
5530
6399
|
};
|
|
5531
6400
|
|
|
5532
|
-
if (isCallable$
|
|
6401
|
+
if (isCallable$2(NativePromiseConstructor$2) && NativePromisePrototype$1 !== Object.prototype) {
|
|
5533
6402
|
nativeThen = NativePromisePrototype$1.then;
|
|
5534
6403
|
|
|
5535
6404
|
if (!NATIVE_PROMISE_SUBCLASSING) {
|
|
@@ -5537,7 +6406,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
5537
6406
|
defineBuiltIn$2(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
|
|
5538
6407
|
var that = this;
|
|
5539
6408
|
return new PromiseConstructor(function (resolve, reject) {
|
|
5540
|
-
call$
|
|
6409
|
+
call$4(nativeThen, that, resolve, reject);
|
|
5541
6410
|
}).then(onFulfilled, onRejected);
|
|
5542
6411
|
// https://github.com/zloirock/core-js/issues/640
|
|
5543
6412
|
}, { unsafe: true });
|
|
@@ -5555,16 +6424,16 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
5555
6424
|
}
|
|
5556
6425
|
}
|
|
5557
6426
|
|
|
5558
|
-
$$
|
|
6427
|
+
$$8({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
|
|
5559
6428
|
Promise: PromiseConstructor
|
|
5560
6429
|
});
|
|
5561
6430
|
|
|
5562
6431
|
setToStringTag(PromiseConstructor, PROMISE, false);
|
|
5563
6432
|
setSpecies(PROMISE);
|
|
5564
6433
|
|
|
5565
|
-
var wellKnownSymbol
|
|
6434
|
+
var wellKnownSymbol = wellKnownSymbol$k;
|
|
5566
6435
|
|
|
5567
|
-
var ITERATOR$2 = wellKnownSymbol
|
|
6436
|
+
var ITERATOR$2 = wellKnownSymbol('iterator');
|
|
5568
6437
|
var SAFE_CLOSING = false;
|
|
5569
6438
|
|
|
5570
6439
|
try {
|
|
@@ -5609,8 +6478,8 @@ var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCor
|
|
|
5609
6478
|
NativePromiseConstructor$1.all(iterable).then(undefined, function () { /* empty */ });
|
|
5610
6479
|
});
|
|
5611
6480
|
|
|
5612
|
-
var $$
|
|
5613
|
-
var call$
|
|
6481
|
+
var $$7 = _export;
|
|
6482
|
+
var call$3 = functionCall;
|
|
5614
6483
|
var aCallable$1 = aCallable$a;
|
|
5615
6484
|
var newPromiseCapabilityModule$2 = newPromiseCapability$2;
|
|
5616
6485
|
var perform$1 = perform$3;
|
|
@@ -5619,7 +6488,7 @@ var PROMISE_STATICS_INCORRECT_ITERATION$1 = promiseStaticsIncorrectIteration;
|
|
|
5619
6488
|
|
|
5620
6489
|
// `Promise.all` method
|
|
5621
6490
|
// https://tc39.es/ecma262/#sec-promise.all
|
|
5622
|
-
$$
|
|
6491
|
+
$$7({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
|
|
5623
6492
|
all: function all(iterable) {
|
|
5624
6493
|
var C = this;
|
|
5625
6494
|
var capability = newPromiseCapabilityModule$2.f(C);
|
|
@@ -5634,7 +6503,7 @@ $$8({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
|
|
|
5634
6503
|
var index = counter++;
|
|
5635
6504
|
var alreadyCalled = false;
|
|
5636
6505
|
remaining++;
|
|
5637
|
-
call$
|
|
6506
|
+
call$3($promiseResolve, C, promise).then(function (value) {
|
|
5638
6507
|
if (alreadyCalled) return;
|
|
5639
6508
|
alreadyCalled = true;
|
|
5640
6509
|
values[index] = value;
|
|
@@ -5648,33 +6517,33 @@ $$8({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
|
|
|
5648
6517
|
}
|
|
5649
6518
|
});
|
|
5650
6519
|
|
|
5651
|
-
var $$
|
|
6520
|
+
var $$6 = _export;
|
|
5652
6521
|
var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
|
|
5653
6522
|
var NativePromiseConstructor = promiseNativeConstructor;
|
|
5654
6523
|
var getBuiltIn$1 = getBuiltIn$8;
|
|
5655
|
-
var isCallable$
|
|
6524
|
+
var isCallable$1 = isCallable$o;
|
|
5656
6525
|
var defineBuiltIn$1 = defineBuiltIn$7;
|
|
5657
6526
|
|
|
5658
6527
|
var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
|
|
5659
6528
|
|
|
5660
6529
|
// `Promise.prototype.catch` method
|
|
5661
6530
|
// https://tc39.es/ecma262/#sec-promise.prototype.catch
|
|
5662
|
-
$$
|
|
6531
|
+
$$6({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
|
|
5663
6532
|
'catch': function (onRejected) {
|
|
5664
6533
|
return this.then(undefined, onRejected);
|
|
5665
6534
|
}
|
|
5666
6535
|
});
|
|
5667
6536
|
|
|
5668
6537
|
// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
|
|
5669
|
-
if (isCallable$
|
|
6538
|
+
if (isCallable$1(NativePromiseConstructor)) {
|
|
5670
6539
|
var method = getBuiltIn$1('Promise').prototype['catch'];
|
|
5671
6540
|
if (NativePromisePrototype['catch'] !== method) {
|
|
5672
6541
|
defineBuiltIn$1(NativePromisePrototype, 'catch', method, { unsafe: true });
|
|
5673
6542
|
}
|
|
5674
6543
|
}
|
|
5675
6544
|
|
|
5676
|
-
var $$
|
|
5677
|
-
var call$
|
|
6545
|
+
var $$5 = _export;
|
|
6546
|
+
var call$2 = functionCall;
|
|
5678
6547
|
var aCallable = aCallable$a;
|
|
5679
6548
|
var newPromiseCapabilityModule$1 = newPromiseCapability$2;
|
|
5680
6549
|
var perform = perform$3;
|
|
@@ -5683,7 +6552,7 @@ var PROMISE_STATICS_INCORRECT_ITERATION = promiseStaticsIncorrectIteration;
|
|
|
5683
6552
|
|
|
5684
6553
|
// `Promise.race` method
|
|
5685
6554
|
// https://tc39.es/ecma262/#sec-promise.race
|
|
5686
|
-
$$
|
|
6555
|
+
$$5({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
|
|
5687
6556
|
race: function race(iterable) {
|
|
5688
6557
|
var C = this;
|
|
5689
6558
|
var capability = newPromiseCapabilityModule$1.f(C);
|
|
@@ -5691,7 +6560,7 @@ $$6({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
|
|
|
5691
6560
|
var result = perform(function () {
|
|
5692
6561
|
var $promiseResolve = aCallable(C.resolve);
|
|
5693
6562
|
iterate(iterable, function (promise) {
|
|
5694
|
-
call$
|
|
6563
|
+
call$2($promiseResolve, C, promise).then(capability.resolve, reject);
|
|
5695
6564
|
});
|
|
5696
6565
|
});
|
|
5697
6566
|
if (result.error) reject(result.value);
|
|
@@ -5699,17 +6568,17 @@ $$6({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
|
|
|
5699
6568
|
}
|
|
5700
6569
|
});
|
|
5701
6570
|
|
|
5702
|
-
var $$
|
|
5703
|
-
var call$
|
|
6571
|
+
var $$4 = _export;
|
|
6572
|
+
var call$1 = functionCall;
|
|
5704
6573
|
var newPromiseCapabilityModule = newPromiseCapability$2;
|
|
5705
6574
|
var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
|
|
5706
6575
|
|
|
5707
6576
|
// `Promise.reject` method
|
|
5708
6577
|
// https://tc39.es/ecma262/#sec-promise.reject
|
|
5709
|
-
$$
|
|
6578
|
+
$$4({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
|
|
5710
6579
|
reject: function reject(r) {
|
|
5711
6580
|
var capability = newPromiseCapabilityModule.f(this);
|
|
5712
|
-
call$
|
|
6581
|
+
call$1(capability.reject, undefined, r);
|
|
5713
6582
|
return capability.promise;
|
|
5714
6583
|
}
|
|
5715
6584
|
});
|
|
@@ -5727,7 +6596,7 @@ var promiseResolve$1 = function (C, x) {
|
|
|
5727
6596
|
return promiseCapability.promise;
|
|
5728
6597
|
};
|
|
5729
6598
|
|
|
5730
|
-
var $$
|
|
6599
|
+
var $$3 = _export;
|
|
5731
6600
|
var getBuiltIn = getBuiltIn$8;
|
|
5732
6601
|
var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR;
|
|
5733
6602
|
var promiseResolve = promiseResolve$1;
|
|
@@ -5736,7 +6605,7 @@ getBuiltIn('Promise');
|
|
|
5736
6605
|
|
|
5737
6606
|
// `Promise.resolve` method
|
|
5738
6607
|
// https://tc39.es/ecma262/#sec-promise.resolve
|
|
5739
|
-
$$
|
|
6608
|
+
$$3({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
|
|
5740
6609
|
resolve: function resolve(x) {
|
|
5741
6610
|
return promiseResolve(this, x);
|
|
5742
6611
|
}
|
|
@@ -5751,6 +6620,11 @@ const icons = {
|
|
|
5751
6620
|
download: IconNames.DOWNLOAD,
|
|
5752
6621
|
retry: IconNames.CIRCULAR_ARROW
|
|
5753
6622
|
};
|
|
6623
|
+
/**
|
|
6624
|
+
* @internal
|
|
6625
|
+
*
|
|
6626
|
+
* # Link Action Component
|
|
6627
|
+
*/
|
|
5754
6628
|
const LinkAction = _a => {
|
|
5755
6629
|
var {
|
|
5756
6630
|
css,
|
|
@@ -5837,6 +6711,22 @@ const ErrorDisplay = () => jsxs("div", Object.assign({
|
|
|
5837
6711
|
}))]
|
|
5838
6712
|
}));
|
|
5839
6713
|
|
|
6714
|
+
/**
|
|
6715
|
+
* @internal
|
|
6716
|
+
*
|
|
6717
|
+
* # Spacer Component Util Function
|
|
6718
|
+
*
|
|
6719
|
+
* - This is a utility function that generates dynamic styles for the `<Spacer />` component.
|
|
6720
|
+
*
|
|
6721
|
+
* @param SpacerProps The base props that will be passed into the `<Spacer />` component at
|
|
6722
|
+
* point of use.
|
|
6723
|
+
*
|
|
6724
|
+
* @return Styles A `SerializedStyles` object that contains styles that can be consumed by
|
|
6725
|
+
* our `ThemeProvider` and `EmotionJSX.Element` components.
|
|
6726
|
+
*
|
|
6727
|
+
* @see {@link Spacer | The `<Spacer />` component that uses these dynamic styles}
|
|
6728
|
+
*
|
|
6729
|
+
*/
|
|
5840
6730
|
const getSpacerStyles = ({
|
|
5841
6731
|
displayOn,
|
|
5842
6732
|
multiplier: _multiplier = 4
|
|
@@ -5850,11 +6740,28 @@ const getSpacerStyles = ({
|
|
|
5850
6740
|
}), {
|
|
5851
6741
|
height: theme.spacing(_multiplier),
|
|
5852
6742
|
width: "100%"
|
|
5853
|
-
}), process.env.NODE_ENV === "production" ? "" : ";label:getSpacerStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
6743
|
+
}), process.env.NODE_ENV === "production" ? "" : ";label:getSpacerStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNwYWNlci50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBa0JzRSIsImZpbGUiOiJzcGFjZXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsganN4IGFzIF9qc3ggfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3QvanN4LXJ1bnRpbWVcIjtcclxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XHJcbi8qKlxyXG4gKiBAaW50ZXJuYWxcclxuICpcclxuICogIyBTcGFjZXIgQ29tcG9uZW50IFV0aWwgRnVuY3Rpb25cclxuICpcclxuICogLSBUaGlzIGlzIGEgdXRpbGl0eSBmdW5jdGlvbiB0aGF0IGdlbmVyYXRlcyBkeW5hbWljIHN0eWxlcyBmb3IgdGhlIGA8U3BhY2VyIC8+YCBjb21wb25lbnQuXHJcbiAqXHJcbiAqIEBwYXJhbSBTcGFjZXJQcm9wcyBUaGUgYmFzZSBwcm9wcyB0aGF0IHdpbGwgYmUgcGFzc2VkIGludG8gdGhlIGA8U3BhY2VyIC8+YCBjb21wb25lbnQgYXRcclxuICogcG9pbnQgb2YgdXNlLlxyXG4gKlxyXG4gKiBAcmV0dXJuIFN0eWxlcyBBIGBTZXJpYWxpemVkU3R5bGVzYCBvYmplY3QgdGhhdCBjb250YWlucyBzdHlsZXMgdGhhdCBjYW4gYmUgY29uc3VtZWQgYnlcclxuICogb3VyIGBUaGVtZVByb3ZpZGVyYCBhbmQgYEVtb3Rpb25KU1guRWxlbWVudGAgY29tcG9uZW50cy5cclxuICpcclxuICogQHNlZSB7QGxpbmsgU3BhY2VyIHwgVGhlIGA8U3BhY2VyIC8+YCBjb21wb25lbnQgdGhhdCB1c2VzIHRoZXNlIGR5bmFtaWMgc3R5bGVzfVxyXG4gKlxyXG4gKi9cclxuY29uc3QgZ2V0U3BhY2VyU3R5bGVzID0gKHsgZGlzcGxheU9uLCBtdWx0aXBsaWVyID0gNCB9KSA9PiAodGhlbWUpID0+IGNzcyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sIChkaXNwbGF5T25cclxuICAgID8geyBkaXNwbGF5OiBcIm5vbmVcIiwgW3RoZW1lLm1lZGlhUXVlcnkoZGlzcGxheU9uKV06IHsgZGlzcGxheTogXCJibG9ja1wiIH0gfVxyXG4gICAgOiB7IGRpc3BsYXk6IFwiYmxvY2tcIiB9KSksIHsgaGVpZ2h0OiB0aGVtZS5zcGFjaW5nKG11bHRpcGxpZXIpLCB3aWR0aDogXCIxMDAlXCIgfSkpO1xyXG4vKipcclxuICogQGludGVybmFsXHJcbiAqXHJcbiAqICMgU3BhY2VyIENvbXBvc2l0aW9uIENvbXBvbmVudFxyXG4gKlxyXG4gKiAtIFRoZSBgU3BhY2VyYCBpcyBhIGNvbXBvc2l0aW9uIGNvbXBvbmVudCB1c2VkIHRvIGNyZWF0ZSBhIHNwYWNlIGJldHdlZW4gZWxlbWVudHNcclxuICogaW4gdGhlIFVJLlxyXG4gKlxyXG4gKiBAc2VlIHtAbGluayBTcGFjZXIuU3BhY2VyUHJvcHMgfCBUaGUgcHJvcHMgbmVjZXNzYXJ5IHRvIHJlbmRlciB0aGUgYDxTcGFjZXIgLz5gIGNvbXBvbmVudH1cclxuICogQHNlZSB7QGxpbmsgU3BhY2VyLmdldFNwYWNlclN0eWxlcyB8IFRoZSB1dGlsIGZ1bmN0aW9uIHRoYXQgZ2VuZXJhdGVzIHRoZSBzdHlsZXMgZm9yIHRoZSBgPFNwYWNlciAvPmAgY29tcG9uZW50fVxyXG4gKlxyXG4gKi9cclxuZXhwb3J0IGNvbnN0IFNwYWNlciA9IChwcm9wcykgPT4gX2pzeChcImRpdlwiLCB7IGNzczogZ2V0U3BhY2VyU3R5bGVzKHByb3BzKSB9KTtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9c3BhY2VyLmpzLm1hcCJdfQ== */");
|
|
6744
|
+
/**
|
|
6745
|
+
* @internal
|
|
6746
|
+
*
|
|
6747
|
+
* # Spacer Composition Component
|
|
6748
|
+
*
|
|
6749
|
+
* - The `Spacer` is a composition component used to create a space between elements
|
|
6750
|
+
* in the UI.
|
|
6751
|
+
*
|
|
6752
|
+
* @see {@link Spacer.SpacerProps | The props necessary to render the `<Spacer />` component}
|
|
6753
|
+
* @see {@link Spacer.getSpacerStyles | The util function that generates the styles for the `<Spacer />` component}
|
|
6754
|
+
*
|
|
6755
|
+
*/
|
|
5854
6756
|
const Spacer = props => jsx("div", {
|
|
5855
6757
|
css: getSpacerStyles(props)
|
|
5856
6758
|
});
|
|
5857
6759
|
|
|
6760
|
+
/**
|
|
6761
|
+
* @internal
|
|
6762
|
+
*
|
|
6763
|
+
* # Spread Component
|
|
6764
|
+
*/
|
|
5858
6765
|
const Spread = ({
|
|
5859
6766
|
children
|
|
5860
6767
|
}) => jsx("div", Object.assign({
|
|
@@ -6280,6 +7187,11 @@ const styles$s = createStyles({
|
|
|
6280
7187
|
})
|
|
6281
7188
|
});
|
|
6282
7189
|
|
|
7190
|
+
/**
|
|
7191
|
+
* @namespace WalletHistory
|
|
7192
|
+
*
|
|
7193
|
+
* # Wallet History
|
|
7194
|
+
*/
|
|
6283
7195
|
const WalletHistory = () => {
|
|
6284
7196
|
var _a;
|
|
6285
7197
|
const {
|
|
@@ -6542,6 +7454,11 @@ const LabelLayoutPurchase = ({
|
|
|
6542
7454
|
});
|
|
6543
7455
|
};
|
|
6544
7456
|
|
|
7457
|
+
/**
|
|
7458
|
+
* @internal
|
|
7459
|
+
*
|
|
7460
|
+
* # Loader Component
|
|
7461
|
+
*/
|
|
6545
7462
|
const Loader = props => {
|
|
6546
7463
|
return jsx("div", Object.assign({
|
|
6547
7464
|
css: {
|
|
@@ -6659,7 +7576,7 @@ const SaveStatus = ({
|
|
|
6659
7576
|
}))]
|
|
6660
7577
|
}));
|
|
6661
7578
|
}
|
|
6662
|
-
return !isSaving && !errors ? jsxs("div", Object.assign({
|
|
7579
|
+
return !isSaving && !(errors === null || errors === void 0 ? void 0 : errors.length) ? jsxs("div", Object.assign({
|
|
6663
7580
|
css: styles$r.container
|
|
6664
7581
|
}, {
|
|
6665
7582
|
children: [jsx("svg", Object.assign({
|
|
@@ -6723,6 +7640,16 @@ const styles$q = createStyles({
|
|
|
6723
7640
|
})
|
|
6724
7641
|
});
|
|
6725
7642
|
|
|
7643
|
+
/**
|
|
7644
|
+
* @internal
|
|
7645
|
+
*
|
|
7646
|
+
* # Collapsible Panel Component
|
|
7647
|
+
*
|
|
7648
|
+
* - The `<CollapsiblePanel />` composition component is used to group content together that can
|
|
7649
|
+
* be expanded or collapsed.
|
|
7650
|
+
*
|
|
7651
|
+
* @see {@link CollapsiblePanelProps | The props that are passed into the `<CollapsiblePanel />` component}
|
|
7652
|
+
*/
|
|
6726
7653
|
const CollapsiblePanel = ({
|
|
6727
7654
|
errors,
|
|
6728
7655
|
initialExpanded,
|
|
@@ -6970,6 +7897,11 @@ const LabelLayoutSettings = ({
|
|
|
6970
7897
|
}));
|
|
6971
7898
|
};
|
|
6972
7899
|
|
|
7900
|
+
/**
|
|
7901
|
+
* @namespace LabelLayout
|
|
7902
|
+
*
|
|
7903
|
+
* # Label Layout Component
|
|
7904
|
+
*/
|
|
6973
7905
|
const LabelLayout = ({
|
|
6974
7906
|
display
|
|
6975
7907
|
}) => {
|
|
@@ -7002,6 +7934,16 @@ const LabelLayout = ({
|
|
|
7002
7934
|
});
|
|
7003
7935
|
};
|
|
7004
7936
|
|
|
7937
|
+
/**
|
|
7938
|
+
* @internal
|
|
7939
|
+
*
|
|
7940
|
+
* # Button Group Component
|
|
7941
|
+
*
|
|
7942
|
+
* - The `<ButtonGroup />` is a composition component used to group buttons together that are
|
|
7943
|
+
* passed in as children.
|
|
7944
|
+
*
|
|
7945
|
+
* @see {@link ButtonGroupProps | The props that are passed into the `<ButtonGroup />` component}
|
|
7946
|
+
*/
|
|
7005
7947
|
const ButtonGroup = _a => {
|
|
7006
7948
|
var {
|
|
7007
7949
|
children,
|
|
@@ -7038,6 +7980,11 @@ const ButtonGroup = _a => {
|
|
|
7038
7980
|
}));
|
|
7039
7981
|
};
|
|
7040
7982
|
|
|
7983
|
+
/**
|
|
7984
|
+
* @internal
|
|
7985
|
+
*
|
|
7986
|
+
* # Field Label Component
|
|
7987
|
+
*/
|
|
7041
7988
|
const FieldLabel = ({
|
|
7042
7989
|
children,
|
|
7043
7990
|
label,
|
|
@@ -7280,87 +8227,6 @@ const CreditCardInput = fieldProps => jsx(CreditCardInputController, Object.assi
|
|
|
7280
8227
|
}
|
|
7281
8228
|
}));
|
|
7282
8229
|
|
|
7283
|
-
var call$2 = functionCall;
|
|
7284
|
-
var hasOwn$1 = hasOwnProperty_1;
|
|
7285
|
-
var isPrototypeOf$1 = objectIsPrototypeOf;
|
|
7286
|
-
var regExpFlags = regexpFlags$1;
|
|
7287
|
-
|
|
7288
|
-
var RegExpPrototype$1 = RegExp.prototype;
|
|
7289
|
-
|
|
7290
|
-
var regexpGetFlags = function (R) {
|
|
7291
|
-
var flags = R.flags;
|
|
7292
|
-
return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn$1(R, 'flags') && isPrototypeOf$1(RegExpPrototype$1, R)
|
|
7293
|
-
? call$2(regExpFlags, R) : flags;
|
|
7294
|
-
};
|
|
7295
|
-
|
|
7296
|
-
var $$3 = _export;
|
|
7297
|
-
var call$1 = functionCall;
|
|
7298
|
-
var uncurryThis$3 = functionUncurryThis;
|
|
7299
|
-
var requireObjectCoercible$1 = requireObjectCoercible$9;
|
|
7300
|
-
var isCallable$1 = isCallable$o;
|
|
7301
|
-
var isNullOrUndefined$1 = isNullOrUndefined$7;
|
|
7302
|
-
var isRegExp = isRegexp;
|
|
7303
|
-
var toString$4 = toString$c;
|
|
7304
|
-
var getMethod$1 = getMethod$6;
|
|
7305
|
-
var getRegExpFlags$1 = regexpGetFlags;
|
|
7306
|
-
var getSubstitution = getSubstitution$2;
|
|
7307
|
-
var wellKnownSymbol = wellKnownSymbol$k;
|
|
7308
|
-
|
|
7309
|
-
var REPLACE = wellKnownSymbol('replace');
|
|
7310
|
-
var $TypeError = TypeError;
|
|
7311
|
-
var indexOf = uncurryThis$3(''.indexOf);
|
|
7312
|
-
uncurryThis$3(''.replace);
|
|
7313
|
-
var stringSlice$1 = uncurryThis$3(''.slice);
|
|
7314
|
-
var max = Math.max;
|
|
7315
|
-
|
|
7316
|
-
var stringIndexOf = function (string, searchValue, fromIndex) {
|
|
7317
|
-
if (fromIndex > string.length) return -1;
|
|
7318
|
-
if (searchValue === '') return fromIndex;
|
|
7319
|
-
return indexOf(string, searchValue, fromIndex);
|
|
7320
|
-
};
|
|
7321
|
-
|
|
7322
|
-
// `String.prototype.replaceAll` method
|
|
7323
|
-
// https://tc39.es/ecma262/#sec-string.prototype.replaceall
|
|
7324
|
-
$$3({ target: 'String', proto: true }, {
|
|
7325
|
-
replaceAll: function replaceAll(searchValue, replaceValue) {
|
|
7326
|
-
var O = requireObjectCoercible$1(this);
|
|
7327
|
-
var IS_REG_EXP, flags, replacer, string, searchString, functionalReplace, searchLength, advanceBy, replacement;
|
|
7328
|
-
var position = 0;
|
|
7329
|
-
var endOfLastMatch = 0;
|
|
7330
|
-
var result = '';
|
|
7331
|
-
if (!isNullOrUndefined$1(searchValue)) {
|
|
7332
|
-
IS_REG_EXP = isRegExp(searchValue);
|
|
7333
|
-
if (IS_REG_EXP) {
|
|
7334
|
-
flags = toString$4(requireObjectCoercible$1(getRegExpFlags$1(searchValue)));
|
|
7335
|
-
if (!~indexOf(flags, 'g')) throw $TypeError('`.replaceAll` does not allow non-global regexes');
|
|
7336
|
-
}
|
|
7337
|
-
replacer = getMethod$1(searchValue, REPLACE);
|
|
7338
|
-
if (replacer) {
|
|
7339
|
-
return call$1(replacer, searchValue, O, replaceValue);
|
|
7340
|
-
}
|
|
7341
|
-
}
|
|
7342
|
-
string = toString$4(O);
|
|
7343
|
-
searchString = toString$4(searchValue);
|
|
7344
|
-
functionalReplace = isCallable$1(replaceValue);
|
|
7345
|
-
if (!functionalReplace) replaceValue = toString$4(replaceValue);
|
|
7346
|
-
searchLength = searchString.length;
|
|
7347
|
-
advanceBy = max(1, searchLength);
|
|
7348
|
-
position = stringIndexOf(string, searchString, 0);
|
|
7349
|
-
while (position !== -1) {
|
|
7350
|
-
replacement = functionalReplace
|
|
7351
|
-
? toString$4(replaceValue(searchString, position, string))
|
|
7352
|
-
: getSubstitution(searchString, string, position, [], undefined, replaceValue);
|
|
7353
|
-
result += stringSlice$1(string, endOfLastMatch, position) + replacement;
|
|
7354
|
-
endOfLastMatch = position + searchLength;
|
|
7355
|
-
position = stringIndexOf(string, searchString, position + advanceBy);
|
|
7356
|
-
}
|
|
7357
|
-
if (endOfLastMatch < string.length) {
|
|
7358
|
-
result += stringSlice$1(string, endOfLastMatch);
|
|
7359
|
-
}
|
|
7360
|
-
return result;
|
|
7361
|
-
}
|
|
7362
|
-
});
|
|
7363
|
-
|
|
7364
8230
|
// TODO: Quick Fix for White Label; The navigator object cannot be accessed from within SSR,
|
|
7365
8231
|
// so this provides default value until this feature can be refactored to support SSR.
|
|
7366
8232
|
let _LOCALE = "en-US";
|
|
@@ -8168,6 +9034,19 @@ const getAcknowledgementLabel = (serviceCode, packageType) => {
|
|
|
8168
9034
|
});
|
|
8169
9035
|
}
|
|
8170
9036
|
return;
|
|
9037
|
+
case "dhl_express_worldwide":
|
|
9038
|
+
return jsxs(Trans, Object.assign({
|
|
9039
|
+
i18nKey: "purchase-label:rates.dhlExpressTermsAcknowledgement"
|
|
9040
|
+
}, {
|
|
9041
|
+
children: ["To start shipping with DHL, you are confirming that you have agreed to the ", jsx(Link, Object.assign({
|
|
9042
|
+
href: "https://mydhl.express.dhl/us/en/legal/terms-and-conditions.html",
|
|
9043
|
+
isExternal: true,
|
|
9044
|
+
rel: "noreferrer",
|
|
9045
|
+
target: "_blank"
|
|
9046
|
+
}, {
|
|
9047
|
+
children: "terms and conditions"
|
|
9048
|
+
}))]
|
|
9049
|
+
}));
|
|
8171
9050
|
default:
|
|
8172
9051
|
return null;
|
|
8173
9052
|
}
|
|
@@ -8579,6 +9458,10 @@ var fields = /*#__PURE__*/Object.freeze({
|
|
|
8579
9458
|
});
|
|
8580
9459
|
|
|
8581
9460
|
/**
|
|
9461
|
+
* @internal
|
|
9462
|
+
*
|
|
9463
|
+
* # Form Portal Component
|
|
9464
|
+
*
|
|
8582
9465
|
* A drop-in replacement for the `<form>` tag that allows nested forms.
|
|
8583
9466
|
*
|
|
8584
9467
|
* Via portals, the <form> tag is mounted as a sibling of the app root. The form's
|
|
@@ -8648,6 +9531,10 @@ const styles$o = createStyles({
|
|
|
8648
9531
|
});
|
|
8649
9532
|
|
|
8650
9533
|
/**
|
|
9534
|
+
* @internal
|
|
9535
|
+
*
|
|
9536
|
+
* # Money Schema
|
|
9537
|
+
*
|
|
8651
9538
|
* @category Form Validation
|
|
8652
9539
|
*/
|
|
8653
9540
|
const moneySchema = z.object({
|
|
@@ -8656,14 +9543,33 @@ const moneySchema = z.object({
|
|
|
8656
9543
|
});
|
|
8657
9544
|
|
|
8658
9545
|
/**
|
|
9546
|
+
* @internal
|
|
9547
|
+
*
|
|
9548
|
+
* # Phone utils
|
|
9549
|
+
*
|
|
8659
9550
|
* @category Form Validation
|
|
8660
9551
|
*/
|
|
8661
9552
|
const phoneSchema = (defaultCountryCode = "US") => z.string().trim().refine(val => isValidPhoneNumber(val, defaultCountryCode), "schemaErrors.notAValidPhoneNumber");
|
|
8662
9553
|
/**
|
|
9554
|
+
* @internal
|
|
9555
|
+
*
|
|
9556
|
+
* # Phone utils
|
|
9557
|
+
*
|
|
8663
9558
|
* @category Form Validation
|
|
8664
9559
|
*/
|
|
8665
9560
|
const phoneSchemaUnvalidated = z.string().trim();
|
|
8666
9561
|
|
|
9562
|
+
/**
|
|
9563
|
+
* @internal
|
|
9564
|
+
*
|
|
9565
|
+
* # Add Funds Form Schema
|
|
9566
|
+
*
|
|
9567
|
+
* - A util function to create a dynamic form schema based on the mininum amount
|
|
9568
|
+
* passed into the function.
|
|
9569
|
+
*
|
|
9570
|
+
* @param minimumAmount - The minimum amount that can be added to the account. This defaults to
|
|
9571
|
+
* 10 if nothing is passed in.
|
|
9572
|
+
*/
|
|
8667
9573
|
const getAddFundsSchema = (minimumAmount = 10) => z.object({
|
|
8668
9574
|
funds: moneySchema.extend({
|
|
8669
9575
|
amount: z.number().min(minimumAmount)
|
|
@@ -8671,9 +9577,15 @@ const getAddFundsSchema = (minimumAmount = 10) => z.object({
|
|
|
8671
9577
|
}).transform(data => data.funds);
|
|
8672
9578
|
|
|
8673
9579
|
/**
|
|
8674
|
-
*
|
|
9580
|
+
* @internal
|
|
9581
|
+
*
|
|
9582
|
+
* # Add Funds Form Component
|
|
8675
9583
|
*
|
|
8676
|
-
*
|
|
9584
|
+
* - Form for adding funds to a carrier's account.
|
|
9585
|
+
*
|
|
9586
|
+
* If a `render child` is provided, external control is assumed and the cancel / submit buttons are hidden.
|
|
9587
|
+
*
|
|
9588
|
+
* @see {@link AddFundsFormProps | The props that are passed into the `<AddFundsForm />` component}
|
|
8677
9589
|
*/
|
|
8678
9590
|
const AddFundsForm = ({
|
|
8679
9591
|
carrierId,
|
|
@@ -8815,7 +9727,16 @@ const AddFundsForm = ({
|
|
|
8815
9727
|
}))]
|
|
8816
9728
|
}))]
|
|
8817
9729
|
})]
|
|
8818
|
-
})), children
|
|
9730
|
+
})), !children && addFunds.error && jsxs(Fragment, {
|
|
9731
|
+
children: [jsx(Spacer, {
|
|
9732
|
+
multiplier: 1
|
|
9733
|
+
}), jsx(InlineNotification, Object.assign({
|
|
9734
|
+
title: t("manage-funding:addFunds.error.title"),
|
|
9735
|
+
type: NotificationType.ERROR
|
|
9736
|
+
}, {
|
|
9737
|
+
children: addFunds.error[0].message
|
|
9738
|
+
}))]
|
|
9739
|
+
}), children === null || children === void 0 ? void 0 : children({
|
|
8819
9740
|
error: addFunds.error,
|
|
8820
9741
|
isCustomAmount: selectedChip.value === "custom",
|
|
8821
9742
|
isSubmitted,
|
|
@@ -8846,6 +9767,13 @@ const styles$n = createStyles({
|
|
|
8846
9767
|
}
|
|
8847
9768
|
});
|
|
8848
9769
|
|
|
9770
|
+
/**
|
|
9771
|
+
* @internal
|
|
9772
|
+
*
|
|
9773
|
+
* # Auto Funding Form Schema
|
|
9774
|
+
*
|
|
9775
|
+
* @see {@link AutoFundingForm | Auto Funding Form component using this schema}
|
|
9776
|
+
* */
|
|
8849
9777
|
const autoFundingSchema = z.object({
|
|
8850
9778
|
isEnabled: z.boolean(),
|
|
8851
9779
|
lowBalancePurchaseThreshold: moneySchema.extend({
|
|
@@ -8858,10 +9786,19 @@ const autoFundingSchema = z.object({
|
|
|
8858
9786
|
});
|
|
8859
9787
|
|
|
8860
9788
|
/**
|
|
9789
|
+
* @internal
|
|
9790
|
+
*
|
|
9791
|
+
* # Auto Funding Form Component
|
|
9792
|
+
*
|
|
8861
9793
|
* This form that allows users to enable or disable auto funding, and
|
|
8862
9794
|
* configure auto funding rules in ShipEngine API.
|
|
8863
9795
|
*
|
|
8864
9796
|
* @param carrierId The carrierId of the carrier provider you wish to configure auto-funding rules for.
|
|
9797
|
+
*
|
|
9798
|
+
* @returns Element A React element that renders the Auto Funding Form allowing users to configure
|
|
9799
|
+
* auto-funding rules for a given carrier provider.
|
|
9800
|
+
*
|
|
9801
|
+
* @see {@link AutoFundingFormProps | The props that are passed into the `<AutoFundingForm />` component}
|
|
8865
9802
|
*/
|
|
8866
9803
|
const AutoFundingForm = ({
|
|
8867
9804
|
carrierId
|
|
@@ -9038,6 +9975,11 @@ const styles$m = isLabelRight => createStyles({
|
|
|
9038
9975
|
})
|
|
9039
9976
|
});
|
|
9040
9977
|
|
|
9978
|
+
/**
|
|
9979
|
+
* @internal
|
|
9980
|
+
*
|
|
9981
|
+
* # Inline Label Component
|
|
9982
|
+
*/
|
|
9041
9983
|
const InlineLabel = ({
|
|
9042
9984
|
children,
|
|
9043
9985
|
label,
|
|
@@ -9057,6 +9999,16 @@ const styles$l = createStyles({
|
|
|
9057
9999
|
})
|
|
9058
10000
|
});
|
|
9059
10001
|
|
|
10002
|
+
/**
|
|
10003
|
+
* @internal
|
|
10004
|
+
*
|
|
10005
|
+
* # Carrier Balance
|
|
10006
|
+
*
|
|
10007
|
+
* - The `<CarrierBalance />` component is used to display the current balance for a given
|
|
10008
|
+
* carrier provider.
|
|
10009
|
+
*
|
|
10010
|
+
* @see {@link CarrierBalanceProps | The props for the `<CarrierBalance />` component}
|
|
10011
|
+
*/
|
|
9060
10012
|
const CarrierBalance = ({
|
|
9061
10013
|
balance,
|
|
9062
10014
|
carrierId
|
|
@@ -9086,6 +10038,22 @@ const CarrierBalance = ({
|
|
|
9086
10038
|
}));
|
|
9087
10039
|
};
|
|
9088
10040
|
|
|
10041
|
+
/**
|
|
10042
|
+
* @namespace ManageFunding
|
|
10043
|
+
*
|
|
10044
|
+
* # Manage Funding Component
|
|
10045
|
+
*
|
|
10046
|
+
* - The `<ManageFunding />` component is used to manage funding rules and add funds to a carrier
|
|
10047
|
+
* account, and is composed in the `<AccountSettings />` component.
|
|
10048
|
+
*
|
|
10049
|
+
* @param ManageFundingProps The base props that will be passed into the `<ManageFunding />` component.
|
|
10050
|
+
*
|
|
10051
|
+
* @returns Element A React element that renders the `<ManageFunding />` component allowing users
|
|
10052
|
+
* manage funding rules and add funds to their carrier accounts.
|
|
10053
|
+
*
|
|
10054
|
+
* @see {@link ManageFundingProps | The props that are passed into the `<ManageFunding />` component}
|
|
10055
|
+
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<ManageFunding />` component}
|
|
10056
|
+
*/
|
|
9089
10057
|
const ManageFunding = ({
|
|
9090
10058
|
carrierId
|
|
9091
10059
|
}) => {
|
|
@@ -9219,7 +10187,7 @@ const styles$k = createStyles({
|
|
|
9219
10187
|
flex: "1 0 100%"
|
|
9220
10188
|
},
|
|
9221
10189
|
display: "flex",
|
|
9222
|
-
flex: "1 0
|
|
10190
|
+
flex: "1 0 64%",
|
|
9223
10191
|
width: "100%"
|
|
9224
10192
|
},
|
|
9225
10193
|
stateZipWrapper: theme => ({
|
|
@@ -9249,7 +10217,10 @@ const AddressFields = ({
|
|
|
9249
10217
|
const {
|
|
9250
10218
|
t
|
|
9251
10219
|
} = useTranslation();
|
|
9252
|
-
const
|
|
10220
|
+
const {
|
|
10221
|
+
countryCodeOptions,
|
|
10222
|
+
defaultCountryCodeOption
|
|
10223
|
+
} = useCountryCodeOptions(domestic);
|
|
9253
10224
|
const stateCodeOptions = useStateCodeOptions(domestic);
|
|
9254
10225
|
const {
|
|
9255
10226
|
isSubmitted
|
|
@@ -9273,6 +10244,7 @@ const AddressFields = ({
|
|
|
9273
10244
|
nativeLabel: true
|
|
9274
10245
|
}), jsx(SelectAutoComplete, {
|
|
9275
10246
|
control: form.control,
|
|
10247
|
+
defaultValue: defaultCountryCodeOption === null || defaultCountryCodeOption === void 0 ? void 0 : defaultCountryCodeOption.value,
|
|
9276
10248
|
form: formId,
|
|
9277
10249
|
label: t("address.fields.countryCode"),
|
|
9278
10250
|
labelWeight: "normal",
|
|
@@ -9421,6 +10393,10 @@ function nullishDefault(defaultValue) {
|
|
|
9421
10393
|
return this.nullish().transform(v => v !== null && v !== void 0 ? v : defaultValue);
|
|
9422
10394
|
}
|
|
9423
10395
|
/**
|
|
10396
|
+
* @internal
|
|
10397
|
+
*
|
|
10398
|
+
* # Form Utilities
|
|
10399
|
+
*
|
|
9424
10400
|
* @category Form Validation
|
|
9425
10401
|
*/
|
|
9426
10402
|
const extendZod = () => {
|
|
@@ -9836,7 +10812,7 @@ const AddressPreferenceSelect = ({
|
|
|
9836
10812
|
warehousePreference: originAddress
|
|
9837
10813
|
})]
|
|
9838
10814
|
})), returnAddress && jsxs(GridChild, Object.assign({
|
|
9839
|
-
colSpan:
|
|
10815
|
+
colSpan: 12
|
|
9840
10816
|
}, {
|
|
9841
10817
|
children: [jsx(Typography, Object.assign({
|
|
9842
10818
|
css: {
|
|
@@ -9884,6 +10860,7 @@ const AddressPreferenceProvider = props => {
|
|
|
9884
10860
|
onSubmit
|
|
9885
10861
|
} = props;
|
|
9886
10862
|
const [passengerData, setPassengerData] = useState();
|
|
10863
|
+
const [userInput, setUserInput] = useState();
|
|
9887
10864
|
const {
|
|
9888
10865
|
validate: validateAddress,
|
|
9889
10866
|
validationPreference,
|
|
@@ -9895,6 +10872,7 @@ const AddressPreferenceProvider = props => {
|
|
|
9895
10872
|
onValid,
|
|
9896
10873
|
data
|
|
9897
10874
|
} = payload;
|
|
10875
|
+
setUserInput(addresses);
|
|
9898
10876
|
const validationPreference = yield validateAddress(addresses);
|
|
9899
10877
|
const {
|
|
9900
10878
|
originAddress,
|
|
@@ -9928,6 +10906,7 @@ const AddressPreferenceProvider = props => {
|
|
|
9928
10906
|
return jsx(AddressPreferenceContext.Provider, Object.assign({
|
|
9929
10907
|
value: {
|
|
9930
10908
|
data: passengerData,
|
|
10909
|
+
userInput,
|
|
9931
10910
|
validateAddress: internalValidateAddress,
|
|
9932
10911
|
validationPreference
|
|
9933
10912
|
}
|
|
@@ -10181,7 +11160,7 @@ const WalletForm = ({
|
|
|
10181
11160
|
resolver: validationResolver(walletSchema)
|
|
10182
11161
|
});
|
|
10183
11162
|
useBlackboxDetection({
|
|
10184
|
-
onError: () => {
|
|
11163
|
+
onError: useCallback(() => {
|
|
10185
11164
|
setCodedErrors(errors => {
|
|
10186
11165
|
const blackBoxError = {
|
|
10187
11166
|
errorCode: "unspecified",
|
|
@@ -10191,8 +11170,8 @@ const WalletForm = ({
|
|
|
10191
11170
|
};
|
|
10192
11171
|
return [...(errors !== null && errors !== void 0 ? errors : []), blackBoxError];
|
|
10193
11172
|
});
|
|
10194
|
-
},
|
|
10195
|
-
onSuccess: bb => form.setValue("iovationBlackbox", bb)
|
|
11173
|
+
}, [setCodedErrors]),
|
|
11174
|
+
onSuccess: useCallback(bb => form.setValue("iovationBlackbox", bb), [form.setValue])
|
|
10196
11175
|
});
|
|
10197
11176
|
const watchAddress = form.watch("address");
|
|
10198
11177
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -10588,6 +11567,25 @@ const WalletCard = ({
|
|
|
10588
11567
|
}));
|
|
10589
11568
|
};
|
|
10590
11569
|
|
|
11570
|
+
/**
|
|
11571
|
+
* # Payment Method Settings Component
|
|
11572
|
+
*
|
|
11573
|
+
* - The `<PaymentMethodSettings />` component is used to manage the users payment information
|
|
11574
|
+
* and is composed in the `<AccountSettings />` component. For example, users can update their
|
|
11575
|
+
* billing information.
|
|
11576
|
+
*
|
|
11577
|
+
* @returns Elements A React element that renders the `<PaymentMethodSettings />` component
|
|
11578
|
+
* allowing uses to configure their payment settings.
|
|
11579
|
+
*
|
|
11580
|
+
* @example
|
|
11581
|
+
* ```tsx
|
|
11582
|
+
* <PaymentMethodSettings />
|
|
11583
|
+
* ```
|
|
11584
|
+
*
|
|
11585
|
+
* <br />
|
|
11586
|
+
*
|
|
11587
|
+
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<PaymentMethodSettings />` component}
|
|
11588
|
+
*/
|
|
10591
11589
|
const PaymentMethodSettings = () => {
|
|
10592
11590
|
var _a;
|
|
10593
11591
|
const {
|
|
@@ -10670,6 +11668,14 @@ const styles$f = createStyles({
|
|
|
10670
11668
|
}
|
|
10671
11669
|
});
|
|
10672
11670
|
|
|
11671
|
+
/**
|
|
11672
|
+
* @internal
|
|
11673
|
+
*
|
|
11674
|
+
* # Powered By ShipEngine Component
|
|
11675
|
+
*
|
|
11676
|
+
* - The `<PoweredByShipEngine />` composition component is used to render the
|
|
11677
|
+
* "Powered By ShipEngine" logo throughout the various elements.
|
|
11678
|
+
*/
|
|
10673
11679
|
const PoweredByShipEngine = () => {
|
|
10674
11680
|
const {
|
|
10675
11681
|
t
|
|
@@ -10685,6 +11691,11 @@ const PoweredByShipEngine = () => {
|
|
|
10685
11691
|
}));
|
|
10686
11692
|
};
|
|
10687
11693
|
|
|
11694
|
+
/**
|
|
11695
|
+
* @namespace UnitSettings
|
|
11696
|
+
*
|
|
11697
|
+
* # Unit Settings Component
|
|
11698
|
+
*/
|
|
10688
11699
|
const UnitSettings = () => {
|
|
10689
11700
|
const {
|
|
10690
11701
|
t
|
|
@@ -11641,7 +12652,9 @@ const CustomsItemForm = ({
|
|
|
11641
12652
|
const {
|
|
11642
12653
|
t
|
|
11643
12654
|
} = useTranslation();
|
|
11644
|
-
const
|
|
12655
|
+
const {
|
|
12656
|
+
countryCodeOptions
|
|
12657
|
+
} = useCountryCodeOptions();
|
|
11645
12658
|
const form = useForm({
|
|
11646
12659
|
defaultValues: customsItem ? {
|
|
11647
12660
|
countryOfOrigin: customsItem.countryOfOrigin,
|
|
@@ -11747,6 +12760,10 @@ const CustomsItemForm = ({
|
|
|
11747
12760
|
};
|
|
11748
12761
|
|
|
11749
12762
|
/**
|
|
12763
|
+
* @internal
|
|
12764
|
+
*
|
|
12765
|
+
* # Copy Button
|
|
12766
|
+
*
|
|
11750
12767
|
* A copy button that copies the content to the users' clipboard and displays a
|
|
11751
12768
|
* checkmark on click.
|
|
11752
12769
|
*/
|
|
@@ -12319,12 +13336,15 @@ const WarehouseForm = ({
|
|
|
12319
13336
|
submitButtonTitle,
|
|
12320
13337
|
warehouse
|
|
12321
13338
|
}) => {
|
|
13339
|
+
var _a, _b;
|
|
12322
13340
|
const {
|
|
12323
13341
|
t
|
|
12324
13342
|
} = useTranslation(["common", "manage-warehouses"]);
|
|
12325
13343
|
const {
|
|
12326
|
-
validateAddress
|
|
13344
|
+
validateAddress,
|
|
13345
|
+
userInput
|
|
12327
13346
|
} = useAddressPreference();
|
|
13347
|
+
const hasDefaultValues = !!warehouse || !!userInput;
|
|
12328
13348
|
const form = useForm({
|
|
12329
13349
|
defaultValues: warehouse ? Object.assign(Object.assign({}, warehouse), {
|
|
12330
13350
|
isDefault: warehouse.isDefault,
|
|
@@ -12335,6 +13355,14 @@ const WarehouseForm = ({
|
|
|
12335
13355
|
countryCode: warehouse.returnAddress.countryCode
|
|
12336
13356
|
}),
|
|
12337
13357
|
returnToAddressIsDifferent: !isEqual(warehouse.originAddress, warehouse.returnAddress)
|
|
13358
|
+
}) : userInput ? Object.assign(Object.assign({}, userInput), {
|
|
13359
|
+
originAddress: Object.assign(Object.assign({}, userInput.originAddress), {
|
|
13360
|
+
countryCode: userInput.originAddress.countryCode
|
|
13361
|
+
}),
|
|
13362
|
+
returnAddress: Object.assign(Object.assign({}, userInput.returnAddress), {
|
|
13363
|
+
countryCode: (_a = userInput.returnAddress) === null || _a === void 0 ? void 0 : _a.countryCode
|
|
13364
|
+
}),
|
|
13365
|
+
returnToAddressIsDifferent: (_b = !!userInput.returnAddress) !== null && _b !== void 0 ? _b : false
|
|
12338
13366
|
}) : {
|
|
12339
13367
|
isDefault: _isOnboarding ? true : false,
|
|
12340
13368
|
originAddress: {
|
|
@@ -12345,8 +13373,8 @@ const WarehouseForm = ({
|
|
|
12345
13373
|
resolver: validationResolver(warehouseSchema)
|
|
12346
13374
|
});
|
|
12347
13375
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
12348
|
-
const
|
|
12349
|
-
payload = __rest(
|
|
13376
|
+
const _c = values,
|
|
13377
|
+
payload = __rest(_c, ["returnToAddressIsDifferent"]);
|
|
12350
13378
|
yield validateAddress({
|
|
12351
13379
|
addresses: payload,
|
|
12352
13380
|
data: {
|
|
@@ -12375,12 +13403,6 @@ const WarehouseForm = ({
|
|
|
12375
13403
|
form: form,
|
|
12376
13404
|
formatFieldName: fieldName => `originAddress.${fieldName}`,
|
|
12377
13405
|
optionalFields: ["addressLine2"]
|
|
12378
|
-
}), jsx(CheckboxInput, {
|
|
12379
|
-
checkboxLabel: t("manage-warehouses:residentialAddress"),
|
|
12380
|
-
control: form.control,
|
|
12381
|
-
form: "warehouse-form",
|
|
12382
|
-
label: "originAddress.addressResidentialIndicator",
|
|
12383
|
-
name: "originAddress.addressResidentialIndicator"
|
|
12384
13406
|
}), !_isOnboarding && jsx(CheckboxInput, {
|
|
12385
13407
|
checkboxLabel: t("manage-warehouses:isDefault"),
|
|
12386
13408
|
control: form.control,
|
|
@@ -12408,18 +13430,12 @@ const WarehouseForm = ({
|
|
|
12408
13430
|
});
|
|
12409
13431
|
}
|
|
12410
13432
|
}
|
|
12411
|
-
}), form.watch("returnToAddressIsDifferent") &&
|
|
12412
|
-
children:
|
|
13433
|
+
}), form.watch("returnToAddressIsDifferent") && jsx(Fragment, {
|
|
13434
|
+
children: jsx(AddressFields, {
|
|
12413
13435
|
form: form,
|
|
12414
13436
|
formatFieldName: fieldName => `returnAddress.${fieldName}`,
|
|
12415
13437
|
optionalFields: ["addressLine2"]
|
|
12416
|
-
})
|
|
12417
|
-
checkboxLabel: t("manage-warehouses:residentialAddress"),
|
|
12418
|
-
control: form.control,
|
|
12419
|
-
form: "warehouse-form",
|
|
12420
|
-
label: "returnAddress.addressResidentialIndicator",
|
|
12421
|
-
name: "returnAddress.addressResidentialIndicator"
|
|
12422
|
-
})]
|
|
13438
|
+
})
|
|
12423
13439
|
}), jsxs(ButtonGroup, Object.assign({
|
|
12424
13440
|
justify: "center"
|
|
12425
13441
|
}, {
|
|
@@ -12444,7 +13460,7 @@ const WarehouseForm = ({
|
|
|
12444
13460
|
control: form.control,
|
|
12445
13461
|
"data-testid": "warehouseFormSubmitButton",
|
|
12446
13462
|
form: "warehouse-form",
|
|
12447
|
-
requireDirty: !
|
|
13463
|
+
requireDirty: !hasDefaultValues,
|
|
12448
13464
|
variant: _isOnboarding ? ButtonVariant.FILLED : ButtonVariant.OUTLINED
|
|
12449
13465
|
}, {
|
|
12450
13466
|
children: submitButtonTitle
|
|
@@ -13043,6 +14059,15 @@ const Onboarding = ({
|
|
|
13043
14059
|
let _ = t => t,
|
|
13044
14060
|
_t,
|
|
13045
14061
|
_t2;
|
|
14062
|
+
/**
|
|
14063
|
+
* @internal
|
|
14064
|
+
*
|
|
14065
|
+
* # Cube Component
|
|
14066
|
+
*
|
|
14067
|
+
* - This is a spinning cube that is used to display a loading state.
|
|
14068
|
+
*
|
|
14069
|
+
* @see {@link CubePropTypes | The props that are passed into the `<Cube />` component}
|
|
14070
|
+
*/
|
|
13046
14071
|
const Cube = _a => {
|
|
13047
14072
|
var {
|
|
13048
14073
|
animate = false
|
|
@@ -13070,7 +14095,7 @@ const Cube = _a => {
|
|
|
13070
14095
|
const styles = {
|
|
13071
14096
|
bounce: /*#__PURE__*/css(Object.assign({}, animate && {
|
|
13072
14097
|
animation: `${bounce} 1s infinite`
|
|
13073
|
-
}), process.env.NODE_ENV === "production" ? "" : ";label:bounce;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
14098
|
+
}), process.env.NODE_ENV === "production" ? "" : ";label:bounce;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImN1YmUudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWtDZ0IiLCJmaWxlIjoiY3ViZS50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBfX3Jlc3QgfSBmcm9tIFwidHNsaWJcIjtcclxuaW1wb3J0IHsganN4IGFzIF9qc3ggfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3QvanN4LXJ1bnRpbWVcIjtcclxuaW1wb3J0IHsgY3NzLCBrZXlmcmFtZXMsIHVzZVRoZW1lIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XHJcbi8qKlxyXG4gKiBAaW50ZXJuYWxcclxuICpcclxuICogIyBDdWJlIENvbXBvbmVudFxyXG4gKlxyXG4gKiAtIFRoaXMgaXMgYSBzcGlubmluZyBjdWJlIHRoYXQgaXMgdXNlZCB0byBkaXNwbGF5IGEgbG9hZGluZyBzdGF0ZS5cclxuICpcclxuICogQHNlZSB7QGxpbmsgQ3ViZVByb3BUeXBlcyB8IFRoZSBwcm9wcyB0aGF0IGFyZSBwYXNzZWQgaW50byB0aGUgYDxDdWJlIC8+YCBjb21wb25lbnR9XHJcbiAqL1xyXG5leHBvcnQgY29uc3QgQ3ViZSA9IChfYSkgPT4ge1xyXG4gICAgdmFyIHsgYW5pbWF0ZSA9IGZhbHNlIH0gPSBfYSwgcHJvcHMgPSBfX3Jlc3QoX2EsIFtcImFuaW1hdGVcIl0pO1xyXG4gICAgY29uc3QgdGhlbWUgPSB1c2VUaGVtZSgpO1xyXG4gICAgY29uc3QgYm91bmNlID0ga2V5ZnJhbWVzIGBcbiAgICAwJSwgMTAwJSB7XG4gICAgICB0cmFuc2Zvcm06IHRyYW5zbGF0ZVkoLTI1JSk7XG4gICAgICBhbmltYXRpb24tdGltaW5nLWZ1bmN0aW9uOiBjdWJpYy1iZXppZXIoMC44LCAwLCAxLCAxKTtcbiAgICB9XG4gICAgNTAlIHtcbiAgICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgwKTtcbiAgICAgIGFuaW1hdGlvbi10aW1pbmctZnVuY3Rpb246IGN1YmljLWJlemllcigwLCAwLCAwLjIsIDEpO1xuICAgIH1cbiAgYDtcclxuICAgIGNvbnN0IHNwaW4gPSBrZXlmcmFtZXMgYFxuICAgIGZyb20ge1xuICAgICAgdHJhbnNmb3JtOiByb3RhdGUoMGRlZyk7XG4gICAgfVxuICAgIHRvIHtcbiAgICAgIHRyYW5zZm9ybTogcm90YXRlKDM2MGRlZyk7XG4gICAgfVxuICBgO1xyXG4gICAgY29uc3Qgc3R5bGVzID0ge1xyXG4gICAgICAgIGJvdW5jZTogY3NzKE9iamVjdC5hc3NpZ24oe30sIChhbmltYXRlICYmIHsgYW5pbWF0aW9uOiBgJHtib3VuY2V9IDFzIGluZmluaXRlYCB9KSkpLFxyXG4gICAgICAgIGNvbnRlbnQ6IGNzcyhPYmplY3QuYXNzaWduKHsgY2xpcFJ1bGU6IFwiZXZlbm9kZFwiLCBmaWxsUnVsZTogXCJldmVub2RkXCIsIGhlaWdodDogXCI1cmVtXCIsIHN0cm9rZUxpbmVKb2luOiBcInJvdW5kXCIsIHN0cm9rZU1pdGVyTGltaXQ6IFwiMlwiLCB3aWR0aDogXCI1cmVtXCIgfSwgKGFuaW1hdGUgJiYgeyBhbmltYXRpb246IGAke3NwaW59IDFzIGxpbmVhciBpbmZpbml0ZTtgIH0pKSksXHJcbiAgICB9O1xyXG4gICAgcmV0dXJuIChfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IHN0eWxlcy5ib3VuY2UgfSwgcHJvcHMsIHsgcm9sZTogXCJzdGF0dXNcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwic3ZnXCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IHN0eWxlcy5jb250ZW50LCBoZWlnaHQ6IFwiMTAwJVwiLCB2aWV3Qm94OiBcIjAgMCA0ODkgNDg5XCIsIHdpZHRoOiBcIjEwMCVcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwiZ1wiLCB7IGNoaWxkcmVuOiBfanN4KFwiZ1wiLCB7IGNoaWxkcmVuOiBfanN4KFwicGF0aFwiLCB7IGQ6IFwiTTQ4My42NzQsMTAxLjgzNkM0ODMuNjEsMTAxLjYwNCA0ODMuNTA2LDEwMS4zOTYgNDgzLjQxOCwxMDEuMThDNDgzLjI0MiwxMDAuNzI0IDQ4My4wNSwxMDAuMjg0IDQ4Mi43OTQsOTkuODY4QzQ4Mi42NSw5OS42MzYgNDgyLjQ5OCw5OS40MjggNDgyLjMzLDk5LjIxMkM0ODIuMDU4LDk4Ljg0NCA0ODEuNzU0LDk4LjUwOCA0ODEuNDEsOTguMTk2QzQ4MS4yMSw5OC4wMDQgNDgxLjAxLDk3LjgyOCA0ODAuNzg2LDk3LjY2QzQ4MC42NTgsOTcuNTY0IDQ4MC41NjIsOTcuNDQ0IDQ4MC40MzQsOTcuMzU2QzQ4MC4xMzgsOTcuMTU2IDQ3OS44MSw5Ny4wNDQgNDc5LjQ5OCw5Ni44ODRDNDc5LjMzOCw5Ni44MDQgNDc5LjIxOCw5Ni42ODQgNDc5LjA1LDk2LjYxMkwyNDcuMDUsMC42MTJDMjQ1LjA4MiwtMC4yMDQgMjQyLjg5LC0wLjIwNCAyNDAuOTIyLDAuNjEyTDguOTIyLDk2LjYxMkM4Ljc1NCw5Ni42ODQgOC42MjYsOTYuODA0IDguNDY2LDk2Ljg4NEM4LjE1NCw5Ny4wMzYgNy44MzQsOTcuMTU2IDcuNTQ2LDk3LjM0OEM3LjQxOCw5Ny40MzYgNy4zMjIsOTcuNTU2IDcuMTk0LDk3LjY1MkM2Ljk3LDk3LjgyIDYuNzc4LDk4LjAwNCA2LjU3OCw5OC4xODhDNi4yNDIsOTguNSA1LjkzOCw5OC44MzYgNS42NTgsOTkuMjA0QzUuNDksOTkuNDIgNS4zMzgsOTkuNjI4IDUuMTk0LDk5Ljg2QzQuOTM4LDEwMC4yNzYgNC43NDYsMTAwLjcxNiA0LjU3LDEwMS4xNzJDNC40ODIsMTAxLjM5NiA0LjM3OCwxMDEuNTk2IDQuMzE0LDEwMS44MjhDNC4xMywxMDIuNTMyIDQuMDAyLDEwMy4yNiA0LjAwMiwxMDQuMDA0TDQuMDAyLDM4NC4wMDRDNC4wMDIsMzg3LjI0NCA1Ljk1NCwzOTAuMTY0IDguOTM4LDM5MS4zOTZMMjQwLjkzOCw0ODcuMzk2QzI0MS4wNDIsNDg3LjQzNiAyNDEuMTU0LDQ4Ny40MiAyNDEuMjU4LDQ4Ny40NkMyNDIuMTQ2LDQ4Ny43ODggMjQzLjA1OCw0ODguMDA0IDI0NC4wMDIsNDg4LjAwNEMyNDQuOTQ2LDQ4OC4wMDQgMjQ1Ljg1OCw0ODcuNzg4IDI0Ni43NDYsNDg3LjQ2QzI0Ni44NSw0ODcuNDIgMjQ2Ljk2Miw0ODcuNDM2IDI0Ny4wNjYsNDg3LjM5Nkw0NzkuMDY2LDM5MS4zOTZDNDgyLjA1LDM5MC4xNjQgNDg0LjAwMiwzODcuMjQ0IDQ4NC4wMDIsMzg0LjAwNEw0ODQuMDAyLDEwNC4wMDRDNDg0LjAwMiwxMDMuMjYgNDgzLjg3NCwxMDIuNTMyIDQ4My42NzQsMTAxLjgzNlpNMjM2LjAwMiw0NjguMDI4TDIwLjAwMiwzNzguNjZMMjAuMDAyLDExNS45NzJMMjM2LjAwMiwyMDUuMzQ4TDIzNi4wMDIsNDY4LjAyOFpNMjQ0LjAwMiwxOTEuMzQ4TDMyLjkyMiwxMDQuMDA0TDI0NC4wMDIsMTYuNjZMNDU1LjA4MiwxMDQuMDA0TDI0NC4wMDIsMTkxLjM0OFpNNDY4LjAwMiwzNzguNjZMMjUyLjAwMiw0NjguMDM2TDI1Mi4wMDIsMjA1LjM0OEw0NjguMDAyLDExNS45NzJMNDY4LjAwMiwzNzguNjZaXCIsIGZpbGw6IHRoZW1lLnBhbGV0dGUucHJpbWFyeS5tYWluIH0pIH0pIH0pIH0pKSB9KSkpO1xyXG59O1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1jdWJlLmpzLm1hcCJdfQ== */"),
|
|
13074
14099
|
content: /*#__PURE__*/css(Object.assign({
|
|
13075
14100
|
clipRule: "evenodd",
|
|
13076
14101
|
fillRule: "evenodd",
|
|
@@ -13080,7 +14105,7 @@ const Cube = _a => {
|
|
|
13080
14105
|
width: "5rem"
|
|
13081
14106
|
}, animate && {
|
|
13082
14107
|
animation: `${spin} 1s linear infinite;`
|
|
13083
|
-
}), process.env.NODE_ENV === "production" ? "" : ";label:content;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
14108
|
+
}), process.env.NODE_ENV === "production" ? "" : ";label:content;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImN1YmUudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQW1DaUIiLCJmaWxlIjoiY3ViZS50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBfX3Jlc3QgfSBmcm9tIFwidHNsaWJcIjtcclxuaW1wb3J0IHsganN4IGFzIF9qc3ggfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3QvanN4LXJ1bnRpbWVcIjtcclxuaW1wb3J0IHsgY3NzLCBrZXlmcmFtZXMsIHVzZVRoZW1lIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XHJcbi8qKlxyXG4gKiBAaW50ZXJuYWxcclxuICpcclxuICogIyBDdWJlIENvbXBvbmVudFxyXG4gKlxyXG4gKiAtIFRoaXMgaXMgYSBzcGlubmluZyBjdWJlIHRoYXQgaXMgdXNlZCB0byBkaXNwbGF5IGEgbG9hZGluZyBzdGF0ZS5cclxuICpcclxuICogQHNlZSB7QGxpbmsgQ3ViZVByb3BUeXBlcyB8IFRoZSBwcm9wcyB0aGF0IGFyZSBwYXNzZWQgaW50byB0aGUgYDxDdWJlIC8+YCBjb21wb25lbnR9XHJcbiAqL1xyXG5leHBvcnQgY29uc3QgQ3ViZSA9IChfYSkgPT4ge1xyXG4gICAgdmFyIHsgYW5pbWF0ZSA9IGZhbHNlIH0gPSBfYSwgcHJvcHMgPSBfX3Jlc3QoX2EsIFtcImFuaW1hdGVcIl0pO1xyXG4gICAgY29uc3QgdGhlbWUgPSB1c2VUaGVtZSgpO1xyXG4gICAgY29uc3QgYm91bmNlID0ga2V5ZnJhbWVzIGBcbiAgICAwJSwgMTAwJSB7XG4gICAgICB0cmFuc2Zvcm06IHRyYW5zbGF0ZVkoLTI1JSk7XG4gICAgICBhbmltYXRpb24tdGltaW5nLWZ1bmN0aW9uOiBjdWJpYy1iZXppZXIoMC44LCAwLCAxLCAxKTtcbiAgICB9XG4gICAgNTAlIHtcbiAgICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgwKTtcbiAgICAgIGFuaW1hdGlvbi10aW1pbmctZnVuY3Rpb246IGN1YmljLWJlemllcigwLCAwLCAwLjIsIDEpO1xuICAgIH1cbiAgYDtcclxuICAgIGNvbnN0IHNwaW4gPSBrZXlmcmFtZXMgYFxuICAgIGZyb20ge1xuICAgICAgdHJhbnNmb3JtOiByb3RhdGUoMGRlZyk7XG4gICAgfVxuICAgIHRvIHtcbiAgICAgIHRyYW5zZm9ybTogcm90YXRlKDM2MGRlZyk7XG4gICAgfVxuICBgO1xyXG4gICAgY29uc3Qgc3R5bGVzID0ge1xyXG4gICAgICAgIGJvdW5jZTogY3NzKE9iamVjdC5hc3NpZ24oe30sIChhbmltYXRlICYmIHsgYW5pbWF0aW9uOiBgJHtib3VuY2V9IDFzIGluZmluaXRlYCB9KSkpLFxyXG4gICAgICAgIGNvbnRlbnQ6IGNzcyhPYmplY3QuYXNzaWduKHsgY2xpcFJ1bGU6IFwiZXZlbm9kZFwiLCBmaWxsUnVsZTogXCJldmVub2RkXCIsIGhlaWdodDogXCI1cmVtXCIsIHN0cm9rZUxpbmVKb2luOiBcInJvdW5kXCIsIHN0cm9rZU1pdGVyTGltaXQ6IFwiMlwiLCB3aWR0aDogXCI1cmVtXCIgfSwgKGFuaW1hdGUgJiYgeyBhbmltYXRpb246IGAke3NwaW59IDFzIGxpbmVhciBpbmZpbml0ZTtgIH0pKSksXHJcbiAgICB9O1xyXG4gICAgcmV0dXJuIChfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IHN0eWxlcy5ib3VuY2UgfSwgcHJvcHMsIHsgcm9sZTogXCJzdGF0dXNcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwic3ZnXCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IHN0eWxlcy5jb250ZW50LCBoZWlnaHQ6IFwiMTAwJVwiLCB2aWV3Qm94OiBcIjAgMCA0ODkgNDg5XCIsIHdpZHRoOiBcIjEwMCVcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwiZ1wiLCB7IGNoaWxkcmVuOiBfanN4KFwiZ1wiLCB7IGNoaWxkcmVuOiBfanN4KFwicGF0aFwiLCB7IGQ6IFwiTTQ4My42NzQsMTAxLjgzNkM0ODMuNjEsMTAxLjYwNCA0ODMuNTA2LDEwMS4zOTYgNDgzLjQxOCwxMDEuMThDNDgzLjI0MiwxMDAuNzI0IDQ4My4wNSwxMDAuMjg0IDQ4Mi43OTQsOTkuODY4QzQ4Mi42NSw5OS42MzYgNDgyLjQ5OCw5OS40MjggNDgyLjMzLDk5LjIxMkM0ODIuMDU4LDk4Ljg0NCA0ODEuNzU0LDk4LjUwOCA0ODEuNDEsOTguMTk2QzQ4MS4yMSw5OC4wMDQgNDgxLjAxLDk3LjgyOCA0ODAuNzg2LDk3LjY2QzQ4MC42NTgsOTcuNTY0IDQ4MC41NjIsOTcuNDQ0IDQ4MC40MzQsOTcuMzU2QzQ4MC4xMzgsOTcuMTU2IDQ3OS44MSw5Ny4wNDQgNDc5LjQ5OCw5Ni44ODRDNDc5LjMzOCw5Ni44MDQgNDc5LjIxOCw5Ni42ODQgNDc5LjA1LDk2LjYxMkwyNDcuMDUsMC42MTJDMjQ1LjA4MiwtMC4yMDQgMjQyLjg5LC0wLjIwNCAyNDAuOTIyLDAuNjEyTDguOTIyLDk2LjYxMkM4Ljc1NCw5Ni42ODQgOC42MjYsOTYuODA0IDguNDY2LDk2Ljg4NEM4LjE1NCw5Ny4wMzYgNy44MzQsOTcuMTU2IDcuNTQ2LDk3LjM0OEM3LjQxOCw5Ny40MzYgNy4zMjIsOTcuNTU2IDcuMTk0LDk3LjY1MkM2Ljk3LDk3LjgyIDYuNzc4LDk4LjAwNCA2LjU3OCw5OC4xODhDNi4yNDIsOTguNSA1LjkzOCw5OC44MzYgNS42NTgsOTkuMjA0QzUuNDksOTkuNDIgNS4zMzgsOTkuNjI4IDUuMTk0LDk5Ljg2QzQuOTM4LDEwMC4yNzYgNC43NDYsMTAwLjcxNiA0LjU3LDEwMS4xNzJDNC40ODIsMTAxLjM5NiA0LjM3OCwxMDEuNTk2IDQuMzE0LDEwMS44MjhDNC4xMywxMDIuNTMyIDQuMDAyLDEwMy4yNiA0LjAwMiwxMDQuMDA0TDQuMDAyLDM4NC4wMDRDNC4wMDIsMzg3LjI0NCA1Ljk1NCwzOTAuMTY0IDguOTM4LDM5MS4zOTZMMjQwLjkzOCw0ODcuMzk2QzI0MS4wNDIsNDg3LjQzNiAyNDEuMTU0LDQ4Ny40MiAyNDEuMjU4LDQ4Ny40NkMyNDIuMTQ2LDQ4Ny43ODggMjQzLjA1OCw0ODguMDA0IDI0NC4wMDIsNDg4LjAwNEMyNDQuOTQ2LDQ4OC4wMDQgMjQ1Ljg1OCw0ODcuNzg4IDI0Ni43NDYsNDg3LjQ2QzI0Ni44NSw0ODcuNDIgMjQ2Ljk2Miw0ODcuNDM2IDI0Ny4wNjYsNDg3LjM5Nkw0NzkuMDY2LDM5MS4zOTZDNDgyLjA1LDM5MC4xNjQgNDg0LjAwMiwzODcuMjQ0IDQ4NC4wMDIsMzg0LjAwNEw0ODQuMDAyLDEwNC4wMDRDNDg0LjAwMiwxMDMuMjYgNDgzLjg3NCwxMDIuNTMyIDQ4My42NzQsMTAxLjgzNlpNMjM2LjAwMiw0NjguMDI4TDIwLjAwMiwzNzguNjZMMjAuMDAyLDExNS45NzJMMjM2LjAwMiwyMDUuMzQ4TDIzNi4wMDIsNDY4LjAyOFpNMjQ0LjAwMiwxOTEuMzQ4TDMyLjkyMiwxMDQuMDA0TDI0NC4wMDIsMTYuNjZMNDU1LjA4MiwxMDQuMDA0TDI0NC4wMDIsMTkxLjM0OFpNNDY4LjAwMiwzNzguNjZMMjUyLjAwMiw0NjguMDM2TDI1Mi4wMDIsMjA1LjM0OEw0NjguMDAyLDExNS45NzJMNDY4LjAwMiwzNzguNjZaXCIsIGZpbGw6IHRoZW1lLnBhbGV0dGUucHJpbWFyeS5tYWluIH0pIH0pIH0pIH0pKSB9KSkpO1xyXG59O1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1jdWJlLmpzLm1hcCJdfQ== */")
|
|
13084
14109
|
};
|
|
13085
14110
|
return jsx("div", Object.assign({
|
|
13086
14111
|
css: styles.bounce
|
|
@@ -13140,6 +14165,11 @@ const styles$5 = createStyles({
|
|
|
13140
14165
|
})
|
|
13141
14166
|
});
|
|
13142
14167
|
|
|
14168
|
+
/**
|
|
14169
|
+
* @internal
|
|
14170
|
+
*
|
|
14171
|
+
* # Section Component
|
|
14172
|
+
*/
|
|
13143
14173
|
const Section = _a => {
|
|
13144
14174
|
var {
|
|
13145
14175
|
bold,
|
|
@@ -13198,9 +14228,15 @@ const styles$4 = createStyles({
|
|
|
13198
14228
|
});
|
|
13199
14229
|
|
|
13200
14230
|
/**
|
|
14231
|
+
* @internal
|
|
14232
|
+
*
|
|
14233
|
+
* # Fund And Purchase Component
|
|
14234
|
+
*
|
|
13201
14235
|
* Fund and Purchase handles the label purchase submission UX, ensuring that a user
|
|
13202
14236
|
* has the necessary funds available and can add them if not. It allows a single button
|
|
13203
14237
|
* to submit the funding form followed by the purchase form.
|
|
14238
|
+
*
|
|
14239
|
+
* @see {@link FundAndPurchaseProps | The props that are passed into the `<FundAndPurchase />` component}
|
|
13204
14240
|
*/
|
|
13205
14241
|
const FundAndPurchase = ({
|
|
13206
14242
|
balance: uspsBalance,
|
|
@@ -13429,7 +14465,7 @@ const RateForm = ({
|
|
|
13429
14465
|
carriers,
|
|
13430
14466
|
disabled,
|
|
13431
14467
|
errors,
|
|
13432
|
-
|
|
14468
|
+
displayableRateErrors,
|
|
13433
14469
|
displayableLabelErrors,
|
|
13434
14470
|
features,
|
|
13435
14471
|
labelErrors,
|
|
@@ -13443,7 +14479,7 @@ const RateForm = ({
|
|
|
13443
14479
|
shipment,
|
|
13444
14480
|
outOfBandDisplayableErrors
|
|
13445
14481
|
}) => {
|
|
13446
|
-
var _a, _b, _c, _d, _e;
|
|
14482
|
+
var _a, _b, _c, _d, _e, _f;
|
|
13447
14483
|
features = Object.assign({
|
|
13448
14484
|
presentation: {
|
|
13449
14485
|
poweredByShipEngine: false
|
|
@@ -13455,7 +14491,7 @@ const RateForm = ({
|
|
|
13455
14491
|
saveRate: true
|
|
13456
14492
|
}
|
|
13457
14493
|
}, features !== null && features !== void 0 ? features : {});
|
|
13458
|
-
const allDisplayableErrors = [...(
|
|
14494
|
+
const allDisplayableErrors = [...(displayableRateErrors !== null && displayableRateErrors !== void 0 ? displayableRateErrors : []), ...(outOfBandDisplayableErrors !== null && outOfBandDisplayableErrors !== void 0 ? outOfBandDisplayableErrors : [])];
|
|
13459
14495
|
const {
|
|
13460
14496
|
t
|
|
13461
14497
|
} = useTranslation();
|
|
@@ -13490,7 +14526,7 @@ const RateForm = ({
|
|
|
13490
14526
|
});
|
|
13491
14527
|
}
|
|
13492
14528
|
})));
|
|
13493
|
-
const rateOptions = useRateOptions(rates, carriers, shipment, !!((_a = features === null || features === void 0 ? void 0 : features.rateForm) === null || _a === void 0 ? void 0 : _a.enableGlobalPostFiltering));
|
|
14529
|
+
const rateOptions = useRateOptions(rates, carriers, shipment, !!((_a = features === null || features === void 0 ? void 0 : features.rateForm) === null || _a === void 0 ? void 0 : _a.enableGlobalPostFiltering), !!((_b = features === null || features === void 0 ? void 0 : features.rateForm) === null || _b === void 0 ? void 0 : _b.requireDhlTermsAcknowledgement));
|
|
13494
14530
|
// Return true if User has multiple accounts for a single carrier.
|
|
13495
14531
|
const hasDuplicateCarrierCode = carriers => {
|
|
13496
14532
|
const uniqueCarrierCodes = new Set();
|
|
@@ -13566,7 +14602,7 @@ const RateForm = ({
|
|
|
13566
14602
|
name: "rate",
|
|
13567
14603
|
nicknameFeature:
|
|
13568
14604
|
// if feature flag is on, and if account has duplicate carrierCodes, then show nickname
|
|
13569
|
-
((
|
|
14605
|
+
((_c = features === null || features === void 0 ? void 0 : features.rateForm) === null || _c === void 0 ? void 0 : _c.nicknameRate) && carriers && hasDuplicateCarrierCode(carriers),
|
|
13570
14606
|
onClick: onSelectRate,
|
|
13571
14607
|
options: showHiddenRates ? rateOptions : filteredRateOptions
|
|
13572
14608
|
}), rateOptions.some(option => option.requiresAcknowledgement) && rateOptions.length > 5 && jsx(Link, Object.assign({
|
|
@@ -13604,10 +14640,10 @@ const RateForm = ({
|
|
|
13604
14640
|
type: NotificationType.ERROR
|
|
13605
14641
|
}, {
|
|
13606
14642
|
children: jsxs(Fragment, {
|
|
13607
|
-
children: [
|
|
14643
|
+
children: [displayableRateErrors, outOfBandDisplayableErrors, displayableLabelErrors]
|
|
13608
14644
|
})
|
|
13609
14645
|
}))]
|
|
13610
|
-
})), ((
|
|
14646
|
+
})), ((_d = features === null || features === void 0 ? void 0 : features.rateForm) === null || _d === void 0 ? void 0 : _d.labelLayout) && !labelsLoading && !(labels === null || labels === void 0 ? void 0 : labels.length) && jsx(Section, Object.assign({
|
|
13611
14647
|
title: t("manage-defaults:label.title")
|
|
13612
14648
|
}, {
|
|
13613
14649
|
children: jsx(LabelLayout, {
|
|
@@ -13619,12 +14655,12 @@ const RateForm = ({
|
|
|
13619
14655
|
control: form.control,
|
|
13620
14656
|
css: styles$3.fundAndPurchase,
|
|
13621
14657
|
disabled: disabled,
|
|
13622
|
-
isFundingEnabled: !!((
|
|
14658
|
+
isFundingEnabled: !!((_e = features === null || features === void 0 ? void 0 : features.rateForm) === null || _e === void 0 ? void 0 : _e.enableFunding),
|
|
13623
14659
|
isFundingRequired: (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.balance) !== undefined && !!selectedRate.requiresFundedAmount,
|
|
13624
14660
|
onPurchase: handleSubmit,
|
|
13625
14661
|
onSave: handleSaveRate,
|
|
13626
14662
|
purchaseAmount: getTotalRateAmount(selectedRate)
|
|
13627
|
-
}), ((
|
|
14663
|
+
}), ((_f = features === null || features === void 0 ? void 0 : features.presentation) === null || _f === void 0 ? void 0 : _f.poweredByShipEngine) && jsxs(Fragment, {
|
|
13628
14664
|
children: [jsx(Spacer, {}), jsx(PoweredByShipEngine, {})]
|
|
13629
14665
|
})]
|
|
13630
14666
|
}));
|
|
@@ -13696,6 +14732,11 @@ const ItemsBreakdownTableHeader = ({
|
|
|
13696
14732
|
}))]
|
|
13697
14733
|
})
|
|
13698
14734
|
});
|
|
14735
|
+
/**
|
|
14736
|
+
* @internal
|
|
14737
|
+
*
|
|
14738
|
+
* # Items Breakdown Component
|
|
14739
|
+
*/
|
|
13699
14740
|
const ItemsBreakdown = ({
|
|
13700
14741
|
items
|
|
13701
14742
|
}) => {
|
|
@@ -14030,10 +15071,12 @@ const CustomsItemsDisplay = ({
|
|
|
14030
15071
|
extendZod();
|
|
14031
15072
|
const getShipmentSchema = ({
|
|
14032
15073
|
allowInternationalShipFrom,
|
|
14033
|
-
|
|
14034
|
-
requireMeasurements: _requireMeasurements = false,
|
|
15074
|
+
dimensionsUnit,
|
|
14035
15075
|
isContentDescriptionRequired: _isContentDescriptionRequired = false,
|
|
14036
|
-
isCustomsRequired: _isCustomsRequired = false
|
|
15076
|
+
isCustomsRequired: _isCustomsRequired = false,
|
|
15077
|
+
requireMeasurements: _requireMeasurements = false,
|
|
15078
|
+
warehouses,
|
|
15079
|
+
weightUnit
|
|
14037
15080
|
} = {}) => {
|
|
14038
15081
|
const baseSchema = z.object({
|
|
14039
15082
|
advancedOptions: z.object({
|
|
@@ -14064,7 +15107,9 @@ const getShipmentSchema = ({
|
|
|
14064
15107
|
height: z.number().nonnegative().nullishDefault(0),
|
|
14065
15108
|
length: z.number().nonnegative().nullishDefault(0),
|
|
14066
15109
|
width: z.number().nonnegative().nullishDefault(0)
|
|
14067
|
-
}).nullish()).transform(dims => dims ? convertDimensions(dims)
|
|
15110
|
+
}).nullish()).transform(dims => dims ? convertDimensions(Object.assign(Object.assign({}, dims), {
|
|
15111
|
+
unit: dimensionsUnit !== null && dimensionsUnit !== void 0 ? dimensionsUnit : "inch"
|
|
15112
|
+
})) : undefined),
|
|
14068
15113
|
insuredValue: moneySchema.extend({
|
|
14069
15114
|
amount: z.number().positive()
|
|
14070
15115
|
}).optional(),
|
|
@@ -14081,7 +15126,7 @@ const getShipmentSchema = ({
|
|
|
14081
15126
|
}) => whole || fractional, "schemaErrors.required") : z.object({
|
|
14082
15127
|
fractional: z.number().nonnegative().nullishDefault(0),
|
|
14083
15128
|
whole: z.number().nonnegative().nullishDefault(0)
|
|
14084
|
-
}).nullish()).transform(weight => weight ? convertWeight(weight) : undefined)
|
|
15129
|
+
}).nullish()).transform(weight => weight ? convertWeight(weight, weightUnit) : undefined)
|
|
14085
15130
|
}).array().min(1),
|
|
14086
15131
|
service: z.object({
|
|
14087
15132
|
carrierId: z.string().nullish(),
|
|
@@ -14108,7 +15153,9 @@ const getShipmentSchema = ({
|
|
|
14108
15153
|
length,
|
|
14109
15154
|
width,
|
|
14110
15155
|
height
|
|
14111
|
-
}) => [length, width, height].every(d => d === 0) || [length, width, height].every(d => d !== 0), "schemaErrors.group.allMeasurementsOrNone").nullish().transform(dims => !dims || Object.values(dims).every(d => d === 0) ? undefined : convertDimensions(dims)
|
|
15156
|
+
}) => [length, width, height].every(d => d === 0) || [length, width, height].every(d => d !== 0), "schemaErrors.group.allMeasurementsOrNone").nullish().transform(dims => !dims || Object.values(dims).every(d => d === 0) ? undefined : convertDimensions(Object.assign(Object.assign({}, dims), {
|
|
15157
|
+
unit: dimensionsUnit !== null && dimensionsUnit !== void 0 ? dimensionsUnit : "inch"
|
|
15158
|
+
})))
|
|
14112
15159
|
}).array().min(1),
|
|
14113
15160
|
service: z.object({
|
|
14114
15161
|
carrierId: z.string(),
|
|
@@ -14156,6 +15203,7 @@ const getShipmentSchema = ({
|
|
|
14156
15203
|
const minimumShipDate = nextDayCutoff(17);
|
|
14157
15204
|
const maximumShipDate = daysAfter(7, minimumShipDate);
|
|
14158
15205
|
const ShipmentForm = ({
|
|
15206
|
+
accountSettings,
|
|
14159
15207
|
addressLoading,
|
|
14160
15208
|
addressPreference,
|
|
14161
15209
|
charsetWarning,
|
|
@@ -14196,14 +15244,22 @@ const ShipmentForm = ({
|
|
|
14196
15244
|
const [insuranceEnabled, setInsuranceEnabled] = useState(false);
|
|
14197
15245
|
const {
|
|
14198
15246
|
isContentDescriptionRequired,
|
|
14199
|
-
isCustomsRequired
|
|
15247
|
+
isCustomsRequired,
|
|
15248
|
+
hasAllZeroMeasurements
|
|
14200
15249
|
} = useShipmentMetadata(shipment);
|
|
15250
|
+
const packageDimensions = shipment === null || shipment === void 0 ? void 0 : shipment.packages[0].dimensions;
|
|
15251
|
+
const packageWeight = shipment === null || shipment === void 0 ? void 0 : shipment.packages[0].weight;
|
|
15252
|
+
// if package specs are all zeroes, assume it is a custom package and default to account settings units
|
|
15253
|
+
const [dimensionsUnit, weightUnit] = useMemo(() => hasAllZeroMeasurements ? [accountSettings === null || accountSettings === void 0 ? void 0 : accountSettings.dimensionsUnit, accountSettings === null || accountSettings === void 0 ? void 0 : accountSettings.weightUnit] : [packageDimensions === null || packageDimensions === void 0 ? void 0 : packageDimensions.unit, packageWeight === null || packageWeight === void 0 ? void 0 : packageWeight.unit], [packageDimensions, packageWeight, hasAllZeroMeasurements, accountSettings]);
|
|
15254
|
+
const hasMeasurementUnits = useMemo(() => !!dimensionsUnit && !!weightUnit, [dimensionsUnit, weightUnit]);
|
|
14201
15255
|
const shipmentSchema = useMemo(() => getShipmentSchema({
|
|
15256
|
+
dimensionsUnit,
|
|
14202
15257
|
isContentDescriptionRequired,
|
|
14203
15258
|
isCustomsRequired,
|
|
14204
15259
|
requireMeasurements,
|
|
14205
|
-
warehouses: warehouses !== null && warehouses !== void 0 ? warehouses : []
|
|
14206
|
-
|
|
15260
|
+
warehouses: warehouses !== null && warehouses !== void 0 ? warehouses : [],
|
|
15261
|
+
weightUnit
|
|
15262
|
+
}), [isCustomsRequired, requireMeasurements, warehouses, isContentDescriptionRequired, weightUnit, dimensionsUnit]);
|
|
14207
15263
|
const requestedServices = useMemo(() => getRequestedServices(salesOrder), [salesOrder]);
|
|
14208
15264
|
const form = useForm({
|
|
14209
15265
|
defaultValues: {
|
|
@@ -14254,10 +15310,10 @@ const ShipmentForm = ({
|
|
|
14254
15310
|
const {
|
|
14255
15311
|
whole,
|
|
14256
15312
|
fractional
|
|
14257
|
-
} = formatFractionalWeight(weight);
|
|
15313
|
+
} = formatFractionalWeight(weight, weightUnit);
|
|
14258
15314
|
form.setValue("packages.0.weight.whole", whole);
|
|
14259
15315
|
form.setValue("packages.0.weight.fractional", fractional);
|
|
14260
|
-
}, [form]);
|
|
15316
|
+
}, [form, weightUnit]);
|
|
14261
15317
|
const handleChangeMode = useCallback(nextMode => __awaiter(void 0, void 0, void 0, function* () {
|
|
14262
15318
|
if (nextMode === "browse_rates") {
|
|
14263
15319
|
// Browse Rates
|
|
@@ -14765,7 +15821,7 @@ const ShipmentForm = ({
|
|
|
14765
15821
|
name: "packages.0.type",
|
|
14766
15822
|
onCategoryChange: value => form.setValue("carrierId", value),
|
|
14767
15823
|
options: packageOptions
|
|
14768
|
-
}),
|
|
15824
|
+
}), hasMeasurementUnits && requireMeasurements ? jsxs(Fragment, {
|
|
14769
15825
|
children: [jsxs(InputGroup, Object.assign({
|
|
14770
15826
|
control: form.control,
|
|
14771
15827
|
disabled: !!findCustomPackage(selectedPackage === null || selectedPackage === void 0 ? void 0 : selectedPackage.code),
|
|
@@ -14778,19 +15834,25 @@ const ShipmentForm = ({
|
|
|
14778
15834
|
control: form.control,
|
|
14779
15835
|
label: t("purchase-label:fields.dimensions.length"),
|
|
14780
15836
|
name: "packages.0.dimensions.length",
|
|
14781
|
-
placeholder: t(
|
|
15837
|
+
placeholder: t(`units.${dimensionsUnit}`)
|
|
14782
15838
|
}), jsx(NumberInput, {
|
|
14783
15839
|
control: form.control,
|
|
14784
15840
|
label: t("purchase-label:fields.dimensions.width"),
|
|
14785
15841
|
name: "packages.0.dimensions.width",
|
|
14786
|
-
placeholder: t(
|
|
15842
|
+
placeholder: t(`units.${dimensionsUnit}`)
|
|
14787
15843
|
}), jsx(NumberInput, {
|
|
14788
15844
|
control: form.control,
|
|
14789
15845
|
label: t("purchase-label:fields.dimensions.height"),
|
|
14790
15846
|
name: "packages.0.dimensions.height",
|
|
14791
|
-
placeholder: t(
|
|
15847
|
+
placeholder: t(`units.${dimensionsUnit}`)
|
|
14792
15848
|
})]
|
|
14793
|
-
})),
|
|
15849
|
+
})), weightUnit && isMetricWeightUnit(weightUnit) ? jsx(NumberInput, {
|
|
15850
|
+
control: form.control,
|
|
15851
|
+
label: t("purchase-label:fields.weightGroup"),
|
|
15852
|
+
name: "packages.0.weight.whole",
|
|
15853
|
+
onBlur: handleBlurWeight,
|
|
15854
|
+
placeholder: t(`units.${weightUnit}`)
|
|
15855
|
+
}) : jsxs(InputGroup, Object.assign({
|
|
14794
15856
|
control: form.control,
|
|
14795
15857
|
label: t("purchase-label:fields.weightGroup"),
|
|
14796
15858
|
name: "packages.0.weight",
|
|
@@ -14810,6 +15872,26 @@ const ShipmentForm = ({
|
|
|
14810
15872
|
placeholder: t("units.oz")
|
|
14811
15873
|
})]
|
|
14812
15874
|
}))]
|
|
15875
|
+
}) : jsxs(Fragment, {
|
|
15876
|
+
children: [jsx(FieldLabel, Object.assign({
|
|
15877
|
+
label: t("purchase-label:fields.dimensionsGroup")
|
|
15878
|
+
}, {
|
|
15879
|
+
children: jsx(Skeleton, {
|
|
15880
|
+
animation: SkeletonAnimation.WAVE,
|
|
15881
|
+
backgroundColor: SkeletonBackgroundColor.LIGHT,
|
|
15882
|
+
height: 50,
|
|
15883
|
+
variant: SkeletonVariant.TEXT
|
|
15884
|
+
})
|
|
15885
|
+
})), jsx(Spacer, {}), jsx(FieldLabel, Object.assign({
|
|
15886
|
+
label: t("purchase-label:fields.weightGroup")
|
|
15887
|
+
}, {
|
|
15888
|
+
children: jsx(Skeleton, {
|
|
15889
|
+
animation: SkeletonAnimation.WAVE,
|
|
15890
|
+
backgroundColor: SkeletonBackgroundColor.LIGHT,
|
|
15891
|
+
height: 50,
|
|
15892
|
+
variant: SkeletonVariant.TEXT
|
|
15893
|
+
})
|
|
15894
|
+
})), jsx(Spacer, {})]
|
|
14813
15895
|
}), isContentDescriptionRequired && jsx(TextInput, {
|
|
14814
15896
|
control: form.control,
|
|
14815
15897
|
hint: t("purchase-label:hints.contentDescription"),
|
|
@@ -14988,6 +16070,13 @@ const Shipment = ({
|
|
|
14988
16070
|
const requestedServices = useMemo(() => getRequestedServices(salesOrder), [salesOrder]);
|
|
14989
16071
|
const activeLabel = useMemo(() => labels === null || labels === void 0 ? void 0 : labels.find(l => l.status === "completed"), [labels]);
|
|
14990
16072
|
const hasSalesOrder = useMemo(() => shipment.salesOrderIds.length > 0, [shipment.salesOrderIds.length]);
|
|
16073
|
+
const formatWeight = weight => isMetricWeightUnit(weight.unit) ? t(`weight.${weight.unit}`, {
|
|
16074
|
+
count: weight.value
|
|
16075
|
+
}) : [pounds > 0 ? t("weight.pounds", {
|
|
16076
|
+
count: pounds
|
|
16077
|
+
}) : "", ounces > 0 ? t("weight.ounces", {
|
|
16078
|
+
count: ounces
|
|
16079
|
+
}) : ""].filter(msg => msg.length).join(" ");
|
|
14991
16080
|
return jsxs(Fragment, {
|
|
14992
16081
|
children: [jsxs(Section, Object.assign({
|
|
14993
16082
|
"data-testid": "orderDetail"
|
|
@@ -15073,16 +16162,12 @@ const Shipment = ({
|
|
|
15073
16162
|
"data-testid": "dimensions",
|
|
15074
16163
|
label: t("view-shipment:fields.dimensions")
|
|
15075
16164
|
}, {
|
|
15076
|
-
children: [`${dimensions
|
|
16165
|
+
children: [`${formatDimensions(dimensions)} ` + t(`units.${dimensions.unit}`), jsx(Spacer, {})]
|
|
15077
16166
|
})), jsx(FieldLabel, Object.assign({
|
|
15078
16167
|
"data-testid": "weight",
|
|
15079
16168
|
label: t("view-shipment:fields.weight")
|
|
15080
16169
|
}, {
|
|
15081
|
-
children:
|
|
15082
|
-
count: pounds
|
|
15083
|
-
}) : "", ounces > 0 ? t("weight.ounces", {
|
|
15084
|
-
count: ounces
|
|
15085
|
-
}) : ""].filter(unit => unit.length).join(" ")
|
|
16170
|
+
children: formatWeight(weight)
|
|
15086
16171
|
}))]
|
|
15087
16172
|
})), jsxs(Section, Object.assign({
|
|
15088
16173
|
rightContent: ((_a = features === null || features === void 0 ? void 0 : features.shipment) === null || _a === void 0 ? void 0 : _a.schedulePickup) && schedulePickupForCarrier(activeLabel === null || activeLabel === void 0 ? void 0 : activeLabel.carrierCode) ? jsx(Link, Object.assign({
|
|
@@ -15236,6 +16321,9 @@ const styles = createStyles({
|
|
|
15236
16321
|
})
|
|
15237
16322
|
});
|
|
15238
16323
|
|
|
16324
|
+
/**
|
|
16325
|
+
* @internal
|
|
16326
|
+
*/
|
|
15239
16327
|
const DateRangeSelect = ({
|
|
15240
16328
|
fullWidth,
|
|
15241
16329
|
onChange,
|
|
@@ -15269,6 +16357,13 @@ const DateRangeSelect = ({
|
|
|
15269
16357
|
}));
|
|
15270
16358
|
};
|
|
15271
16359
|
|
|
16360
|
+
/**
|
|
16361
|
+
* @internal
|
|
16362
|
+
*
|
|
16363
|
+
* # Date Range Combo Component
|
|
16364
|
+
*
|
|
16365
|
+
* @see {@link DateRangeComboProps | This is the type of the props used in the `<DateRangeCombo />` component}
|
|
16366
|
+
*/
|
|
15272
16367
|
const DateRangeCombo = ({
|
|
15273
16368
|
children: renderChildren,
|
|
15274
16369
|
onChange,
|
|
@@ -15313,9 +16408,13 @@ const DateRangeCombo = ({
|
|
|
15313
16408
|
};
|
|
15314
16409
|
|
|
15315
16410
|
/**
|
|
16411
|
+
* @internal
|
|
16412
|
+
*
|
|
16413
|
+
* # Error Fallback Component
|
|
16414
|
+
*
|
|
15316
16415
|
* Fallback component for the Elements ErrorBoundary
|
|
15317
16416
|
*
|
|
15318
|
-
* @see {@link
|
|
16417
|
+
* @see {@link ErrorFallbackProps | The props that are passed into the `<ErrorFallback />` component}
|
|
15319
16418
|
*/
|
|
15320
16419
|
const ErrorFallback = ({
|
|
15321
16420
|
error
|
|
@@ -15349,7 +16448,11 @@ const ErrorFallback = ({
|
|
|
15349
16448
|
};
|
|
15350
16449
|
|
|
15351
16450
|
/**
|
|
15352
|
-
*
|
|
16451
|
+
* @internal
|
|
16452
|
+
*
|
|
16453
|
+
* # Story Notes Component
|
|
16454
|
+
*
|
|
16455
|
+
* - For relevant notes about Storybook stories
|
|
15353
16456
|
*
|
|
15354
16457
|
* Stopgap until we setup https://storybook.js.org/addons/@storybook/addon-docs
|
|
15355
16458
|
*/
|
|
@@ -15634,12 +16737,17 @@ var common = {
|
|
|
15634
16737
|
weight: {
|
|
15635
16738
|
ounces: "{{count}} oz",
|
|
15636
16739
|
pounds_one: "{{count}} lb",
|
|
15637
|
-
pounds_other: "{{count}} lbs"
|
|
16740
|
+
pounds_other: "{{count}} lbs",
|
|
16741
|
+
kilogram: "{{count}} kg",
|
|
16742
|
+
gram: "{{count}} g"
|
|
15638
16743
|
},
|
|
15639
16744
|
units: {
|
|
15640
|
-
|
|
16745
|
+
inch: "in",
|
|
15641
16746
|
lbs: "lbs",
|
|
15642
|
-
oz: "oz"
|
|
16747
|
+
oz: "oz",
|
|
16748
|
+
centimeter: "cm",
|
|
16749
|
+
gram: "g",
|
|
16750
|
+
kilogram: "kg"
|
|
15643
16751
|
},
|
|
15644
16752
|
"VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkMTAwLgo=": "$100 insurance included",
|
|
15645
16753
|
"VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkNTAuCg==": "$50 insurance included",
|
|
@@ -15647,7 +16755,8 @@ var common = {
|
|
|
15647
16755
|
"QWRkcmVzcyBub3QgZm91bmQ=": "There was an issue validating your address. Please try again.",
|
|
15648
16756
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: "UPS weight limit per package is 150 lbs.",
|
|
15649
16757
|
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: "Finish setting up your ShipStation Carriers in the ShipStation app",
|
|
15650
|
-
QSBzaGlwcGluZyBlcnJvciBvY2N1cnJlZDogTWlzc2luZyBvciBpbnZhbGlkIHNoaXBwZXIgbnVtYmVy: "Unable to
|
|
16758
|
+
QSBzaGlwcGluZyBlcnJvciBvY2N1cnJlZDogTWlzc2luZyBvciBpbnZhbGlkIHNoaXBwZXIgbnVtYmVy: "Unable to create label: Missing or Invalid Shipper Number. Please contact our support team to reset the carrier connection for your account.",
|
|
16759
|
+
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBNaXNzaW5nIG9yIGludmFsaWQgc2hpcHBlciBuYW1l: "Unable to create label: The selected service requires a Company Name be added to your Ship From Location. Please contact our support team if you continue to experience issues.",
|
|
15651
16760
|
"QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBNaXNzaW5nIG9yIGludmFsaWQgc2hpcCB0byBTdGF0ZVByb3ZpbmNlQ29kZQ==": "The State/Province Code Exceeds 5 Characters. Shorten the abbreviation or remove it, then try again.",
|
|
15652
16761
|
"QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnZhbGlkIHNvbGQgdG8gc3RhdGUgcHJvdmluY2UgY29kZS4gVmFsaWQgbGVuZ3RoIGlzIDAgdG8gNSBhbHBoYW51bWVyaWM=": "The State/Province Code Exceeds 5 Characters. Shorten the abbreviation or remove it, then try again."
|
|
15653
16762
|
};
|
|
@@ -15903,7 +17012,8 @@ var purchaseLabel$1 = {
|
|
|
15903
17012
|
},
|
|
15904
17013
|
rates: {
|
|
15905
17014
|
uspsMediaMailAcknowledgement: "I confirm that this package is compliant with <1>USPS guidelines for Media Mail®</1>",
|
|
15906
|
-
uspsFirstClassMailAcknowledgement_leof: "I understand the limitations and confirm that this package is compliant with USPS guidelines for First Class Mail Large Envelopes or Flats."
|
|
17015
|
+
uspsFirstClassMailAcknowledgement_leof: "I understand the limitations and confirm that this package is compliant with USPS guidelines for First Class Mail Large Envelopes or Flats.",
|
|
17016
|
+
dhlExpressTermsAcknowledgement: "To start shipping with DHL, you are confirming that you have agreed to the <1>terms and conditions</1>"
|
|
15907
17017
|
},
|
|
15908
17018
|
shipToAddressFormFields: "Ship To Address Form Fields",
|
|
15909
17019
|
sections: {
|
|
@@ -16053,6 +17163,31 @@ var walletHistory = {
|
|
|
16053
17163
|
|
|
16054
17164
|
var en = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, accoutSettings), common$1), listCarriers), manageDefaults), manageFunding), manageWarehouses), manageDefaults), onboarding$2), paymentMethod), purchaseLabel$1), registerCarrier), registerWallet), viewShipment$1), voidLabel$1), walletHistory);
|
|
16055
17165
|
|
|
17166
|
+
/**
|
|
17167
|
+
* # Account Settings Component
|
|
17168
|
+
*
|
|
17169
|
+
* - The `<AccountSettings />` component is used to display the user's account settings, as well as
|
|
17170
|
+
* allowing them to make changes to various aspects of their account.
|
|
17171
|
+
*
|
|
17172
|
+
* @param onSaveSettings Any `void` function you wish to execute when the user saves any changes
|
|
17173
|
+
* to their account settings.
|
|
17174
|
+
*
|
|
17175
|
+
* @returns Element An EmotionJSX.Element that will render the `<AccountSettings />` component
|
|
17176
|
+
* with all the appropriate wrappers.
|
|
17177
|
+
*
|
|
17178
|
+
* @example
|
|
17179
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
17180
|
+
* ```tsx
|
|
17181
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
17182
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
17183
|
+
* resources: { en },
|
|
17184
|
+
* });
|
|
17185
|
+
* ```
|
|
17186
|
+
*
|
|
17187
|
+
* <br />
|
|
17188
|
+
*
|
|
17189
|
+
* @see {@link AccountSettings.Element | The **Element** created to render `<AccountSettings />`}
|
|
17190
|
+
*/
|
|
16056
17191
|
const Component$4 = ({
|
|
16057
17192
|
onSaveSettings
|
|
16058
17193
|
}) => {
|
|
@@ -16064,6 +17199,32 @@ const Component$4 = ({
|
|
|
16064
17199
|
onSaveSettings: onSaveSettings
|
|
16065
17200
|
});
|
|
16066
17201
|
};
|
|
17202
|
+
/**
|
|
17203
|
+
* # Registered Account Settings Element
|
|
17204
|
+
*
|
|
17205
|
+
* - This is the registered `<AccountSettings />` element that will be used to render the
|
|
17206
|
+
* `<AccountSettings.Element />` component.
|
|
17207
|
+
*
|
|
17208
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
17209
|
+
* the `<AccountSettings.Element />` component.
|
|
17210
|
+
*
|
|
17211
|
+
* @example
|
|
17212
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `AccountSettings`
|
|
17213
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
17214
|
+
* ```tsx
|
|
17215
|
+
* <AccountSettings.Element
|
|
17216
|
+
* onSaveSettings={() => console.log('Settings Saved!')}
|
|
17217
|
+
* />
|
|
17218
|
+
* ```
|
|
17219
|
+
*
|
|
17220
|
+
* <br />
|
|
17221
|
+
*
|
|
17222
|
+
* @see {@link AccountSettings.ComponentProps | The **props** that can be passed into the `<AccountSettings.Element />` component}
|
|
17223
|
+
* @see {@link ListCarriers.Component | The `<List-Carriers />` component used to view connected carriers}
|
|
17224
|
+
* @see {@link ManageWarehouses.Component | The `<ManageWarehouses />` component used to add, update, or remove warehouses}
|
|
17225
|
+
* @see {@link PaymentMethodSettings | The `<PaymentMethodSettings />` component used to manage payment methods}
|
|
17226
|
+
* @see {@link ManageFunding | The `<ManageFunding />` component used to manage funding rules and add funds to a carrier account}
|
|
17227
|
+
*/
|
|
16067
17228
|
const Element$5 = alchemy.createElement(Component$4, ErrorFallback, {
|
|
16068
17229
|
css: {
|
|
16069
17230
|
height: "100%",
|
|
@@ -16082,6 +17243,39 @@ var accountSettings = /*#__PURE__*/Object.freeze({
|
|
|
16082
17243
|
Element: Element$5
|
|
16083
17244
|
});
|
|
16084
17245
|
|
|
17246
|
+
/**
|
|
17247
|
+
* # Onboarding Component
|
|
17248
|
+
*
|
|
17249
|
+
* - The `<Onboarding />` component is used to onboard a new user to the ShipEngine platform. This
|
|
17250
|
+
* component will allow the user to create a warehouse, register a carrier, and create a funding
|
|
17251
|
+
* source for their account. This is everything a user needs to begin fulfilling their shipments
|
|
17252
|
+
* using the ShipEngine Platform.
|
|
17253
|
+
*
|
|
17254
|
+
* @param ComponentProps The base props that will be passed into the `<Onboarding />` component.
|
|
17255
|
+
*
|
|
17256
|
+
* @returns Element An EmotionJSX.Element that will render the `<Onboarding />` component
|
|
17257
|
+
* with all the appropriate wrappers.
|
|
17258
|
+
*
|
|
17259
|
+
* @example
|
|
17260
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
17261
|
+
* ```tsx
|
|
17262
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
17263
|
+
* css: {
|
|
17264
|
+
* height: "100%",
|
|
17265
|
+
* maxWidth: "800px",
|
|
17266
|
+
* minWidth: "440px",
|
|
17267
|
+
* overflow: "auto",
|
|
17268
|
+
* scrollbarGutter: "stable both-edges",
|
|
17269
|
+
* width: "100%",
|
|
17270
|
+
* },
|
|
17271
|
+
* resources: { en },
|
|
17272
|
+
* });
|
|
17273
|
+
* ```
|
|
17274
|
+
*
|
|
17275
|
+
* <br />
|
|
17276
|
+
*
|
|
17277
|
+
* @see {@link Onboarding.Element | The **Element** created to render `<Onboarding />`}
|
|
17278
|
+
*/
|
|
16085
17279
|
const Component$3 = ({
|
|
16086
17280
|
features,
|
|
16087
17281
|
onboardingAddress,
|
|
@@ -16150,6 +17344,28 @@ const Component$3 = ({
|
|
|
16150
17344
|
warehouses: warehouses
|
|
16151
17345
|
});
|
|
16152
17346
|
};
|
|
17347
|
+
/**
|
|
17348
|
+
* # Registered Onboarding Element
|
|
17349
|
+
*
|
|
17350
|
+
* - This is the registered `<Onboarding />` element that will be used to render the
|
|
17351
|
+
* `<Onboarding.Element />` component.
|
|
17352
|
+
*
|
|
17353
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
17354
|
+
* the `<Onboarding.Element />` component.
|
|
17355
|
+
*
|
|
17356
|
+
* @example
|
|
17357
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `Onboarding`
|
|
17358
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
17359
|
+
* ```tsx
|
|
17360
|
+
* <Onboarding.Element
|
|
17361
|
+
* onCompleteOnboarding={() => console.log('Onboarding Complete!')}
|
|
17362
|
+
* />
|
|
17363
|
+
* ```
|
|
17364
|
+
*
|
|
17365
|
+
* <br />
|
|
17366
|
+
*
|
|
17367
|
+
* @see {@link Onboarding.ComponentProps | The **props** that can be passed into the `<Onboarding.Element />` component}
|
|
17368
|
+
*/
|
|
16153
17369
|
const Element$4 = alchemy.createElement(Component$3, ErrorFallback, {
|
|
16154
17370
|
css: {
|
|
16155
17371
|
height: "100%",
|
|
@@ -16410,27 +17626,6 @@ const usePresets = ({
|
|
|
16410
17626
|
};
|
|
16411
17627
|
};
|
|
16412
17628
|
|
|
16413
|
-
/**
|
|
16414
|
-
* Generic error pretty printer
|
|
16415
|
-
* @param errors
|
|
16416
|
-
* @param predicate
|
|
16417
|
-
* @param scrubber
|
|
16418
|
-
*/
|
|
16419
|
-
const useScrubErrors = ({
|
|
16420
|
-
scrubber,
|
|
16421
|
-
errors,
|
|
16422
|
-
predicate
|
|
16423
|
-
}) => {
|
|
16424
|
-
const {
|
|
16425
|
-
t
|
|
16426
|
-
} = useTranslation();
|
|
16427
|
-
return useMemo(() => errors === null || errors === void 0 ? void 0 : errors.map(e => {
|
|
16428
|
-
return t(encode(e.message), {
|
|
16429
|
-
defaultValue: !predicate || predicate(e) ? t(scrubber(e)) : e.message
|
|
16430
|
-
});
|
|
16431
|
-
}), [errors, predicate, scrubber, t]);
|
|
16432
|
-
};
|
|
16433
|
-
|
|
16434
17629
|
var usps_first_class_mail = [
|
|
16435
17630
|
"First Class Mail shipments must weigh less than {{weight}} oz. Shipments exceeding the weight entered when buying the label will be charged an adjustment fee by USPS."
|
|
16436
17631
|
];
|
|
@@ -16523,11 +17718,13 @@ const useRequestRates = ({
|
|
|
16523
17718
|
reset: resetRates,
|
|
16524
17719
|
mutateAsync: calculateRates
|
|
16525
17720
|
} = useCalculateRates();
|
|
16526
|
-
const requestRates = useCallback(shipment => __awaiter(void 0, void 0, void 0, function* () {
|
|
16527
|
-
var _a;
|
|
17721
|
+
const requestRates = useCallback((shipment, isInternational) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17722
|
+
var _a, _b;
|
|
17723
|
+
const internationalCarrierIds = (_a = carriers === null || carriers === void 0 ? void 0 : carriers.map(c => c.carrierId)) !== null && _a !== void 0 ? _a : [];
|
|
17724
|
+
const domesticCarrierIds = (_b = carriers === null || carriers === void 0 ? void 0 : carriers.filter(c => !["dhl"].includes(c.carrierCode)).map(c => c.carrierId)) !== null && _b !== void 0 ? _b : [];
|
|
16528
17725
|
const result = yield calculateRates({
|
|
16529
17726
|
rateOptions: {
|
|
16530
|
-
carrierIds: shipment.carrierId ? [shipment.carrierId] :
|
|
17727
|
+
carrierIds: shipment.carrierId ? [shipment.carrierId] : isInternational ? internationalCarrierIds : domesticCarrierIds,
|
|
16531
17728
|
packageTypes: (customPackageTypes === null || customPackageTypes === void 0 ? void 0 : customPackageTypes.find(p => p.packageId === shipment.packages[0].packageId)) ? ["package"] // Only specify package types for non-custom packages
|
|
16532
17729
|
: shipment.packages.map(pkg => pkg.packageCode),
|
|
16533
17730
|
serviceCodes: shipment.serviceCode ? [shipment.serviceCode] : undefined
|
|
@@ -16610,6 +17807,9 @@ const useRatesForm = ({
|
|
|
16610
17807
|
}) => {
|
|
16611
17808
|
var _a, _b;
|
|
16612
17809
|
const [beforeCreateError, setBeforeCreateError] = useState();
|
|
17810
|
+
const {
|
|
17811
|
+
isInternational
|
|
17812
|
+
} = useShipmentMetadata(shipment);
|
|
16613
17813
|
const {
|
|
16614
17814
|
data: carriers
|
|
16615
17815
|
} = useListCarriers();
|
|
@@ -16682,38 +17882,39 @@ const useRatesForm = ({
|
|
|
16682
17882
|
shipDate: isNowOrInTheFuture(shipment.shipDate) ? shipment.shipDate : undefined
|
|
16683
17883
|
}));
|
|
16684
17884
|
if (updatedShipment) {
|
|
16685
|
-
yield requestRates(updatedShipment);
|
|
17885
|
+
yield requestRates(updatedShipment, isInternational);
|
|
16686
17886
|
yield onShipmentUpdated === null || onShipmentUpdated === void 0 ? void 0 : onShipmentUpdated(updatedShipment);
|
|
16687
17887
|
yield onRateSaved === null || onRateSaved === void 0 ? void 0 : onRateSaved(updatedShipment);
|
|
16688
17888
|
}
|
|
16689
|
-
}), [onRateSaved, onShipmentUpdated, requestRates, shipment, updateShipment]);
|
|
17889
|
+
}), [isInternational, onRateSaved, onShipmentUpdated, requestRates, shipment, updateShipment]);
|
|
16690
17890
|
let errors = [...(ratesErrors !== null && ratesErrors !== void 0 ? ratesErrors : []), ...((_a = ratesResponse === null || ratesResponse === void 0 ? void 0 : ratesResponse.errors) !== null && _a !== void 0 ? _a : [])];
|
|
16691
17891
|
if (beforeCreateError) errors = [...errors, beforeCreateError];
|
|
16692
17892
|
// Sometimes no rates are returned and no top-level errors are returned
|
|
16693
|
-
// but there are invalid rates with errors. This will expose those to the user
|
|
17893
|
+
// but there are invalid rates with errors. This will filter out duplicate error messages and expose those to the user
|
|
16694
17894
|
// so the rate list isn't empty after calculating rates.
|
|
16695
17895
|
if (!errors.length) {
|
|
16696
|
-
|
|
17896
|
+
const uniqueMessages = new Set(ratesResponse === null || ratesResponse === void 0 ? void 0 : ratesResponse.invalidRates.flatMap(r => r.errorMessages));
|
|
17897
|
+
errors = (_b = [...uniqueMessages].map(m => ({
|
|
16697
17898
|
errorCode: "unknown",
|
|
16698
17899
|
errorSource: "shipengine",
|
|
16699
17900
|
errorType: "unknown",
|
|
16700
17901
|
message: m,
|
|
16701
17902
|
name: "CodedError"
|
|
16702
|
-
})))
|
|
17903
|
+
}))) !== null && _b !== void 0 ? _b : [];
|
|
16703
17904
|
}
|
|
16704
|
-
const
|
|
17905
|
+
const displayableRateErrors = useScrubErrors({
|
|
16705
17906
|
errors: errors,
|
|
16706
17907
|
predicate: useCallback(e => e.message.includes("No rates are available for service_codes"), []),
|
|
16707
17908
|
scrubber: useCallback(() => "common:errorMessages.noRatesAvailable", [])
|
|
16708
17909
|
});
|
|
16709
17910
|
const displayableLabelErrors = useScrubErrors({
|
|
16710
17911
|
errors: labelErrors !== null && labelErrors !== void 0 ? labelErrors : undefined,
|
|
16711
|
-
scrubber: useCallback(e => e.message.replace(/Exception with code
|
|
17912
|
+
scrubber: useCallback(e => e.message.replace(/Exception with code \w+; module \d+, category \d+, item \d+/g, ""), [])
|
|
16712
17913
|
});
|
|
16713
17914
|
return {
|
|
16714
17915
|
carriers,
|
|
16715
|
-
displayableErrors,
|
|
16716
17916
|
displayableLabelErrors,
|
|
17917
|
+
displayableRateErrors,
|
|
16717
17918
|
errors: errors.length > 0 ? errors : undefined,
|
|
16718
17919
|
isLoading: ratesCalculating,
|
|
16719
17920
|
labelErrors: (labelErrors === null || labelErrors === void 0 ? void 0 : labelErrors.length) ? labelErrors : undefined,
|
|
@@ -16748,6 +17949,9 @@ const useShipmentForm = ({
|
|
|
16748
17949
|
const {
|
|
16749
17950
|
data: warehouses
|
|
16750
17951
|
} = useListWarehouses();
|
|
17952
|
+
const {
|
|
17953
|
+
data: accountSettings
|
|
17954
|
+
} = useGetAccountSettings();
|
|
16751
17955
|
const {
|
|
16752
17956
|
error: updateShipmentErrors,
|
|
16753
17957
|
mutateAsync: updateShipment,
|
|
@@ -16807,6 +18011,7 @@ const useShipmentForm = ({
|
|
|
16807
18011
|
scrubber: useCallback(() => "common:errorMessages.noRatesAvailable", [])
|
|
16808
18012
|
});
|
|
16809
18013
|
return {
|
|
18014
|
+
accountSettings,
|
|
16810
18015
|
addressLoading,
|
|
16811
18016
|
addressPreference,
|
|
16812
18017
|
carriers,
|
|
@@ -16846,6 +18051,9 @@ const ConfigureShipment = _a => {
|
|
|
16846
18051
|
} = _a,
|
|
16847
18052
|
props = __rest(_a, ["features", "onAddressValidation", "onApplyPreset", "onBeforeLabelCreate", "onChangeAddress", "onLabelCreateFailure", "onLabelCreateSuccess", "onRateSaved", "onRatesCalculated", "onShipmentUpdated", "printLabelLayout", "salesOrder", "shipment"]);
|
|
16848
18053
|
const hydrateRef = useRef();
|
|
18054
|
+
const {
|
|
18055
|
+
isInternational
|
|
18056
|
+
} = useShipmentMetadata(shipment);
|
|
16849
18057
|
const _b = useRatesForm({
|
|
16850
18058
|
onBeforeLabelCreate,
|
|
16851
18059
|
onLabelCreateFailure,
|
|
@@ -16872,15 +18080,15 @@ const ConfigureShipment = _a => {
|
|
|
16872
18080
|
onApplyPreset: useCallback((_preset, shipment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16873
18081
|
var _d;
|
|
16874
18082
|
if (shipment.packages[0].weight.value) {
|
|
16875
|
-
yield requestRates(shipment);
|
|
18083
|
+
yield requestRates(shipment, isInternational);
|
|
16876
18084
|
}
|
|
16877
18085
|
(_d = hydrateRef.current) === null || _d === void 0 ? void 0 : _d.call(hydrateRef, shipment);
|
|
16878
|
-
}), [requestRates]),
|
|
18086
|
+
}), [requestRates, isInternational]),
|
|
16879
18087
|
onChangeAddress,
|
|
16880
18088
|
onShipmentUpdated,
|
|
16881
18089
|
onSubmit: useCallback(shipment => __awaiter(void 0, void 0, void 0, function* () {
|
|
16882
|
-
yield requestRates(shipment);
|
|
16883
|
-
}), [requestRates]),
|
|
18090
|
+
yield requestRates(shipment, isInternational);
|
|
18091
|
+
}), [requestRates, isInternational]),
|
|
16884
18092
|
salesOrder,
|
|
16885
18093
|
shipment
|
|
16886
18094
|
}),
|
|
@@ -17182,6 +18390,30 @@ const PurchaseLabelByShipment = _a => {
|
|
|
17182
18390
|
}));
|
|
17183
18391
|
};
|
|
17184
18392
|
|
|
18393
|
+
/**
|
|
18394
|
+
* # Purchase Label Component
|
|
18395
|
+
*
|
|
18396
|
+
* The `<PurchaseLabel />` component is used to purchase shipping labels from various carriers
|
|
18397
|
+
*
|
|
18398
|
+
* @param ElementProps The props necessary to render the `<PurchaseLabel />` component for shipment
|
|
18399
|
+
* based or sales order based label purchasing.
|
|
18400
|
+
*
|
|
18401
|
+
* @returns Element An EmotionJSX.Element that will render the `<PurchaseLabel />` component
|
|
18402
|
+
* with all the appropriate wrappers.
|
|
18403
|
+
*
|
|
18404
|
+
* @example
|
|
18405
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
18406
|
+
* ```tsx
|
|
18407
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
18408
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
18409
|
+
* resources: { en },
|
|
18410
|
+
* });
|
|
18411
|
+
* ```
|
|
18412
|
+
*
|
|
18413
|
+
* <br />
|
|
18414
|
+
*
|
|
18415
|
+
* @see {@link PurchaseLabel.Element | The **Element** created to render `<PurchaseLabel />`}
|
|
18416
|
+
*/
|
|
17185
18417
|
const Component$2 = _a => {
|
|
17186
18418
|
var props = __rest(_a, []);
|
|
17187
18419
|
if ("salesOrderId" in props || "orderSourceCode" in props) {
|
|
@@ -17190,6 +18422,44 @@ const Component$2 = _a => {
|
|
|
17190
18422
|
return jsx(PurchaseLabelByShipment, Object.assign({}, props));
|
|
17191
18423
|
}
|
|
17192
18424
|
};
|
|
18425
|
+
/**
|
|
18426
|
+
* # Registered Purchase Label Element
|
|
18427
|
+
*
|
|
18428
|
+
* @param ElementProps The props necessary to render the `<PurchaseLabel.Element />` for shipment
|
|
18429
|
+
* based or sales order based label purchasing.
|
|
18430
|
+
*
|
|
18431
|
+
* @example
|
|
18432
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `PurchaseLabel`
|
|
18433
|
+
* Element directly.
|
|
18434
|
+
* ```tsx
|
|
18435
|
+
* <PurchaseLabel.Element
|
|
18436
|
+
* key={currentSalesOrderId}
|
|
18437
|
+
* printLabelLayout='4x6'
|
|
18438
|
+
* shippingPresets={presets}
|
|
18439
|
+
* onShipmentUpdated={(shipment) => console.log('Shipment Updated', shipment)}
|
|
18440
|
+
* onRateSaved={(
|
|
18441
|
+
* shipment: SE.SalesOrderShipment,
|
|
18442
|
+
* rate?: SE.Rate,
|
|
18443
|
+
* rateOptions?: SE.Rate[]
|
|
18444
|
+
* ) => console.log('Rate Saved', shipment, rate, rateOptions)}
|
|
18445
|
+
* onRatesCalculated={() => console.log('Rates Calculated')}
|
|
18446
|
+
* onBeforeLabelCreate={onBeforeLabelPurchase}
|
|
18447
|
+
* onLabelCreateSuccess={onLabelPurchaseSuccess}
|
|
18448
|
+
* onLabelCreateFailure={(rate) => console.log('Label Purchase Failed', rate)}
|
|
18449
|
+
* warehouseId={defaultWarehouseId}
|
|
18450
|
+
* />
|
|
18451
|
+
* ```
|
|
18452
|
+
*
|
|
18453
|
+
* <br />
|
|
18454
|
+
*
|
|
18455
|
+
* - Once a label has been purchased using this Element, you can take the `shipmentId` for the
|
|
18456
|
+
* associated shipment and pass it into the `<ViewShipment.Element />` Element in order to view
|
|
18457
|
+
* the shipment details.
|
|
18458
|
+
*
|
|
18459
|
+
* @see {@link PurchaseLabel.PurchaseLabelCommonProps | The **Common props** used in `<PurchaseLabel.Element />`}
|
|
18460
|
+
*
|
|
18461
|
+
* @see {@link ViewShipment.Element | The next step in the label purchase workflow `<ViewShipment.Element />`}
|
|
18462
|
+
*/
|
|
17193
18463
|
const Element$3 = alchemy.createElement(Component$2, ErrorFallback, {
|
|
17194
18464
|
css: {
|
|
17195
18465
|
height: "100%",
|
|
@@ -17208,6 +18478,31 @@ var purchaseLabel = /*#__PURE__*/Object.freeze({
|
|
|
17208
18478
|
Element: Element$3
|
|
17209
18479
|
});
|
|
17210
18480
|
|
|
18481
|
+
/**
|
|
18482
|
+
* # View Shipment Component
|
|
18483
|
+
*
|
|
18484
|
+
* - The `<ViewShipment />` component is used to for viewing the shipment's tracking number, printing the label that
|
|
18485
|
+
* was created, and the option to void the label. When a label is voided, you can see a list of the
|
|
18486
|
+
* previously voided labels for a given shipment using this component.
|
|
18487
|
+
*
|
|
18488
|
+
* @param ComponentProps The base props that will be passed into the `<ViewShipment />` component.
|
|
18489
|
+
*
|
|
18490
|
+
* @returns Element An EmotionJSX.Element that will render the `<ViewShipment />` component
|
|
18491
|
+
* with all the appropriate wrappers.
|
|
18492
|
+
*
|
|
18493
|
+
* @example
|
|
18494
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
18495
|
+
* ```tsx
|
|
18496
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
18497
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
18498
|
+
* resources: { en },
|
|
18499
|
+
* });
|
|
18500
|
+
* ```
|
|
18501
|
+
*
|
|
18502
|
+
* <br />
|
|
18503
|
+
*
|
|
18504
|
+
* @see {@link ViewShipment.Element | The **Element** created to render `<ViewShipment />`}
|
|
18505
|
+
*/
|
|
17211
18506
|
const Component$1 = ({
|
|
17212
18507
|
features,
|
|
17213
18508
|
onClickPrintLabel,
|
|
@@ -17247,6 +18542,36 @@ const Component$1 = ({
|
|
|
17247
18542
|
warehouse: warehouse
|
|
17248
18543
|
});
|
|
17249
18544
|
};
|
|
18545
|
+
/**
|
|
18546
|
+
* # Registered View Shipment Element
|
|
18547
|
+
*
|
|
18548
|
+
* - This is the registered `<ViewShipment />` element that will be used to render the
|
|
18549
|
+
* `<ViewShipment.Element />` component.
|
|
18550
|
+
*
|
|
18551
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
18552
|
+
* the `<ViewShipment.Element />` component.
|
|
18553
|
+
*
|
|
18554
|
+
* @example
|
|
18555
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `ViewShipment`
|
|
18556
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
18557
|
+
* ```tsx
|
|
18558
|
+
* <ViewShipment.Element
|
|
18559
|
+
* onClickPurchaseLabel={({ salesOrderId }) => {
|
|
18560
|
+
* console.log('sales order ID', salesOrderId);
|
|
18561
|
+
* }}
|
|
18562
|
+
* onClickVoidLabel={({ labelId }) => {
|
|
18563
|
+
* console.log('voided label', labelId);
|
|
18564
|
+
* }}
|
|
18565
|
+
* shipmentId="se-1234567"
|
|
18566
|
+
* />
|
|
18567
|
+
* ```
|
|
18568
|
+
*
|
|
18569
|
+
* <br />
|
|
18570
|
+
*
|
|
18571
|
+
* @see {@link ViewShipment.ComponentProps | The **props** that can be passed into the `<ViewShipment.Element />` component}
|
|
18572
|
+
*
|
|
18573
|
+
* @see {@link VoidLabel.Element | The next step in the label purchase workflow `<VoidLabel.Element />`}
|
|
18574
|
+
**/
|
|
17250
18575
|
const Element$2 = alchemy.createElement(Component$1, ErrorFallback, {
|
|
17251
18576
|
css: {
|
|
17252
18577
|
height: "100%",
|
|
@@ -17370,6 +18695,31 @@ const Message = ({
|
|
|
17370
18695
|
});
|
|
17371
18696
|
};
|
|
17372
18697
|
|
|
18698
|
+
/**
|
|
18699
|
+
* # Void Label Component
|
|
18700
|
+
*
|
|
18701
|
+
* - The `<VoidLabel />` component is used to void a given shipping label. When a label is voided,
|
|
18702
|
+
* you then get the option to view the associated shipment via the `View Shipment` Element, or
|
|
18703
|
+
* you can purchase another label for the shipment via the `Purchase Label` Element.
|
|
18704
|
+
*
|
|
18705
|
+
* @param ComponentProps The base props that will be passed into the `<VoidLabel />` component.
|
|
18706
|
+
*
|
|
18707
|
+
* @returns Element An EmotionJSX.Element that will render the `<VoidLabel />` component
|
|
18708
|
+
* with all the appropriate wrappers.
|
|
18709
|
+
*
|
|
18710
|
+
* @example
|
|
18711
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
18712
|
+
* ```tsx
|
|
18713
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
18714
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
18715
|
+
* resources: { en },
|
|
18716
|
+
* });
|
|
18717
|
+
* ```
|
|
18718
|
+
*
|
|
18719
|
+
* <br />
|
|
18720
|
+
*
|
|
18721
|
+
* @see {@link VoidLabel.Element | The **Element** created to render `<VoidLabel />`}
|
|
18722
|
+
*/
|
|
17373
18723
|
const Component = ({
|
|
17374
18724
|
features,
|
|
17375
18725
|
labelId,
|
|
@@ -17421,6 +18771,37 @@ const Component = ({
|
|
|
17421
18771
|
})]
|
|
17422
18772
|
});
|
|
17423
18773
|
};
|
|
18774
|
+
/**
|
|
18775
|
+
* # Registered Void Label Element
|
|
18776
|
+
*
|
|
18777
|
+
* - This is the registered `<VoidLabel />` element that will be used to render the
|
|
18778
|
+
* `<VoidLabel.Element />` component.
|
|
18779
|
+
*
|
|
18780
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
18781
|
+
* the `<VoidLabel.Element />` component.
|
|
18782
|
+
*
|
|
18783
|
+
* @example
|
|
18784
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `VoidLabel`
|
|
18785
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
18786
|
+
* ```tsx
|
|
18787
|
+
* <VoidLabel.Element
|
|
18788
|
+
* labelId="se-1234567"
|
|
18789
|
+
* onComplete={() => console.log('onComplete')}
|
|
18790
|
+
* onSuccess={(_, { salesOrderIds: [salesOrderId] }) =>
|
|
18791
|
+
* console.log('sales order ID', salesOrderId)
|
|
18792
|
+
* }
|
|
18793
|
+
* onViewShipment={({ shipmentId }) => {
|
|
18794
|
+
* console.log('onViewShipment', shipmentId);
|
|
18795
|
+
* }}
|
|
18796
|
+
* />
|
|
18797
|
+
* ```
|
|
18798
|
+
*
|
|
18799
|
+
* <br />
|
|
18800
|
+
*
|
|
18801
|
+
* @see {@link VoidLabel.ComponentProps | The **props** that can be passed into the `<VoidLabel.Element />` component}
|
|
18802
|
+
*
|
|
18803
|
+
* @see {@link PurchaseLabel.Element | Go back to the frst step in the label purchase workflow `<PurchaseLabel.Element />`}
|
|
18804
|
+
*/
|
|
17424
18805
|
const Element$1 = alchemy.createElement(Component, ErrorFallback, {
|
|
17425
18806
|
css: {
|
|
17426
18807
|
height: "100%",
|
|
@@ -17439,6 +18820,31 @@ var voidLabel = /*#__PURE__*/Object.freeze({
|
|
|
17439
18820
|
Element: Element$1
|
|
17440
18821
|
});
|
|
17441
18822
|
|
|
18823
|
+
/**
|
|
18824
|
+
* @internal
|
|
18825
|
+
*
|
|
18826
|
+
* # Label Workflow Component
|
|
18827
|
+
*
|
|
18828
|
+
* @example
|
|
18829
|
+
* ```tsx
|
|
18830
|
+
* const {
|
|
18831
|
+
* labelId,
|
|
18832
|
+
* multiplexedId,
|
|
18833
|
+
* isVoidingLabel,
|
|
18834
|
+
* shipmentId,
|
|
18835
|
+
* setLabelId,
|
|
18836
|
+
* setShipmentId,
|
|
18837
|
+
* setIsVoidingLabel,
|
|
18838
|
+
* } = useLabelWorkflow({
|
|
18839
|
+
* _labelId,
|
|
18840
|
+
* _multiplexedId,
|
|
18841
|
+
* });
|
|
18842
|
+
* ```
|
|
18843
|
+
*
|
|
18844
|
+
* <br />
|
|
18845
|
+
*
|
|
18846
|
+
* @see {@link LabelWorkflow.Element | The `<LabelWorkflow.Element />` component using this hook}
|
|
18847
|
+
*/
|
|
17442
18848
|
const useLabelWorkflow = ({
|
|
17443
18849
|
_multiplexedId,
|
|
17444
18850
|
_labelId
|
|
@@ -17463,6 +18869,33 @@ const useLabelWorkflow = ({
|
|
|
17463
18869
|
shipmentId
|
|
17464
18870
|
};
|
|
17465
18871
|
};
|
|
18872
|
+
/**
|
|
18873
|
+
* @internal
|
|
18874
|
+
*
|
|
18875
|
+
* # Label Workflow Element
|
|
18876
|
+
*
|
|
18877
|
+
* - The `<LabelWorkflow.Element />` component is a composition of the PurchaseLabel, ViewShipment,
|
|
18878
|
+
* and VoidLabel elements that allows users to purchase a label, view the shipment details, and optionally void their shipping label.
|
|
18879
|
+
*
|
|
18880
|
+
* @param LabelWorkflowProps The props necessary to render the `<LabelWorkflow.Element />` for shipment
|
|
18881
|
+
* based or sales order based label purchasing.
|
|
18882
|
+
*
|
|
18883
|
+
* @returns Element A React Element that will render the `<LabelWorkflow />` component.
|
|
18884
|
+
*
|
|
18885
|
+
* @example
|
|
18886
|
+
* ```tsx
|
|
18887
|
+
* <LabelWorkflow
|
|
18888
|
+
* {...elementProps}
|
|
18889
|
+
* callbacks={{ onLabelCreateSuccess }}
|
|
18890
|
+
* multiplexedId={elementIdProps}
|
|
18891
|
+
* />
|
|
18892
|
+
* ```
|
|
18893
|
+
*
|
|
18894
|
+
* <br />
|
|
18895
|
+
*
|
|
18896
|
+
* @see {@link LabelWorkflowProps | The props that are passed into the `<LabelWorkflow />` component}
|
|
18897
|
+
* @see {@link LabelWorkflow.useLabelWorkflow | The `hook` that is used to manage the state of the `<LabelWorkflow />` component}
|
|
18898
|
+
*/
|
|
17466
18899
|
const Element = (
|
|
17467
18900
|
/*
|
|
17468
18901
|
The passed props are underscore prefixed as they will be stashed, then from them stateful versions will be made
|
|
@@ -17532,7 +18965,8 @@ The passed props are underscore prefixed as they will be stashed, then from them
|
|
|
17532
18965
|
|
|
17533
18966
|
var labelWorkflow = /*#__PURE__*/Object.freeze({
|
|
17534
18967
|
__proto__: null,
|
|
18968
|
+
useLabelWorkflow: useLabelWorkflow,
|
|
17535
18969
|
Element: Element
|
|
17536
18970
|
});
|
|
17537
18971
|
|
|
17538
|
-
export { accountSettings as AccountSettings, AddFundsForm, AutoFundingForm, ButtonGroup, CarrierBalance, CollapsiblePanel, CopyButton, Country, Cube, DateRangeCombo, DateRangeSelect, ErrorFallback, fields as Field, FieldLabel, FormPortal, FundAndPurchase, InlineLabel, ItemsBreakdown, labelWorkflow as LabelWorkflow, LinkAction, listCarriers$1 as ListCarriers, Loader, ManageFunding, manageWarehouses$1 as ManageWarehouses, onboarding as Onboarding, PageLayoutProvider, PaymentMethodSettings, Portal, PoweredByShipEngine, purchaseLabel as PurchaseLabel, RootPortalProvider, Section, Spacer, Spread, StoryNotes, index as Templates, UsState, UsaCity, viewShipment as ViewShipment, voidLabel as VoidLabel, autoFundingSchema, calculateTotal, capitalizeFirstLetter, convertDimensions, convertWeight, countries, countryCodes, createCodedErrors, createDictionary, createStyles, currencySymbol, daysAfter, errorMap, euCountryCodes, extendZod, featureFlagComponentNameLookup, formLogger, formatCreditCardNumber, formatDate, formatDateDDMMYY, formatExpiration, formatFractionalWeight, formatMoney, getAddFundsSchema, getCarrierIdByCarrierCode, getCustomsFromSalesOrder, getExpirationYears, getFeatures, getIsCustomsRequiredForSalesOrder, getIsCustomsRequiredForShipment, getIsInternationalShipment, getPendingShipment, getRateRequiresAcknowledgement, getRelativeDates, getRequestedServices, getSalesOrderItemsFromSalesOrderOrShipment, getTotalRateAmount, isDomesticAddress, isEmptyAddress, isFlatRatePackageCode, isMilitaryAddress, isNowOrInTheFuture, isPoBox, isPoBoxAddress, isString, isUnitedStatesTerritory, isUnsupportedByUps, isUpsCarrier, isUspsCarrier, moneySchema, mostRecent, nextDayCutoff, omitTime, overrideCarrierCodes$1 as overrideCarrierCodes, phoneSchema, phoneSchemaUnvalidated, postalCodeRegex$3 as postalCodeRegex, sortByCreationDate, throwAny, throwJoinedMessages, usCities, usStateCodes, usStates, useAddressValidation, useBlackboxDetection, useCarrierMetadata, useConfirmationOptions, useCountryCodeOptions, useCustomsContentsOptions, useCustomsNonDeliveryOptions, useDateRangeOptions, useExpirationMonthOptions, useFeatures, useInsuranceProviderOptions, useNestedForm, usePackageOptions, usePageLayout, useRateOptions, useRootPortal, useRunOnceOnTrue, useServiceCodeOptions, useShipmentMetadata, useShippingPresetsOptions, useStateCodeOptions, useToggle, useWarehouseOptions, validationResolver };
|
|
18972
|
+
export { accountSettings as AccountSettings, AddFundsForm, AutoFundingForm, ButtonGroup, CarrierBalance, CollapsiblePanel, CopyButton, Country, Cube, DateRangeCombo, DateRangeSelect, ErrorFallback, fields as Field, FieldLabel, FormPortal, FundAndPurchase, InlineLabel, ItemsBreakdown, labelWorkflow as LabelWorkflow, LinkAction, listCarriers$1 as ListCarriers, Loader, ManageFunding, manageWarehouses$1 as ManageWarehouses, onboarding as Onboarding, PageLayoutProvider, PaymentMethodSettings, Portal, PoweredByShipEngine, purchaseLabel as PurchaseLabel, RootPortalProvider, Section, Spacer, Spread, StoryNotes, index as Templates, UsState, UsaCity, viewShipment as ViewShipment, voidLabel as VoidLabel, 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, getCarrierIdByCarrierCode, getCustomsFromSalesOrder, getExpirationYears, getFeatures, getIsCustomsRequiredForSalesOrder, getIsCustomsRequiredForShipment, getIsInternationalShipment, getPendingShipment, getRateRequiresAcknowledgement, getRelativeDates, getRequestedServices, getSalesOrderItemsFromSalesOrderOrShipment, getTotalRateAmount, isDecimalWeight, isDomesticAddress, isEmptyAddress, isFlatRatePackageCode, isMetricWeightUnit, isMilitaryAddress, isNowOrInTheFuture, isPoBox, isPoBoxAddress, isString, isUnitedStatesTerritory, isUnsupportedByUps, isUpsCarrier, isUspsCarrier, moneySchema, mostRecent, nextDayCutoff, omitTime, overrideCarrierCodes$1 as overrideCarrierCodes, phoneSchema, phoneSchemaUnvalidated, postalCodeRegex$3 as postalCodeRegex, sortByCreationDate, throwAny, throwJoinedMessages, usCities, usStateCodes, usStates, useAddressValidation, useBlackboxDetection, useCarrierMetadata, useConfirmationOptions, useCountryCodeOptions, useCustomsContentsOptions, useCustomsNonDeliveryOptions, useDateRangeOptions, useExpirationMonthOptions, useFeatures, useInsuranceProviderOptions, useNestedForm, usePackageOptions, usePageLayout, useRateOptions, useRootPortal, useRunOnceOnTrue, useScrubErrors, useServiceCodeOptions, useShipmentMetadata, useShippingPresetsOptions, useStateCodeOptions, useToggle, useWarehouseOptions, validationResolver };
|