@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.cjs
CHANGED
|
@@ -7,9 +7,9 @@ var reactI18next = require('react-i18next');
|
|
|
7
7
|
var giger = require('@packlink/giger');
|
|
8
8
|
var alchemy = require('@shipengine/alchemy');
|
|
9
9
|
var axios = require('axios');
|
|
10
|
+
var _$3 = require('lodash');
|
|
10
11
|
var zod$1 = require('@hookform/resolvers/zod');
|
|
11
12
|
var zod = require('zod');
|
|
12
|
-
var _$3 = require('lodash');
|
|
13
13
|
var jsBase64 = require('js-base64');
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var gigerTheme = require('@packlink/giger-theme');
|
|
@@ -2018,6 +2018,13 @@ var addToUnscopables = addToUnscopables$3;
|
|
|
2018
2018
|
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
2019
2019
|
addToUnscopables('flatMap');
|
|
2020
2020
|
|
|
2021
|
+
/**
|
|
2022
|
+
* @internal
|
|
2023
|
+
*
|
|
2024
|
+
* # Delivery Confirmation Options Hook
|
|
2025
|
+
*
|
|
2026
|
+
* @category Hooks
|
|
2027
|
+
*/
|
|
2021
2028
|
const useConfirmationOptions = () => {
|
|
2022
2029
|
const {
|
|
2023
2030
|
t
|
|
@@ -2039,6 +2046,11 @@ const hasEuCustomsRules = true,
|
|
|
2039
2046
|
isUnitedStatesTerritory$1 = true,
|
|
2040
2047
|
isUnsupportedByUps$1 = true,
|
|
2041
2048
|
supportsByoa = true;
|
|
2049
|
+
/**
|
|
2050
|
+
* @internal
|
|
2051
|
+
*
|
|
2052
|
+
* # Address Utils - Country Type
|
|
2053
|
+
*/
|
|
2042
2054
|
class Country {
|
|
2043
2055
|
constructor(name, code, rules = {}) {
|
|
2044
2056
|
var _a, _b, _c, _d, _e;
|
|
@@ -2051,6 +2063,11 @@ class Country {
|
|
|
2051
2063
|
this.isUnsupportedByUps = (_e = rules.isUnsupportedByUps) !== null && _e !== void 0 ? _e : false;
|
|
2052
2064
|
}
|
|
2053
2065
|
}
|
|
2066
|
+
/**
|
|
2067
|
+
* @internal
|
|
2068
|
+
*
|
|
2069
|
+
* # Address Utils - Array of Countries and their codes
|
|
2070
|
+
*/
|
|
2054
2071
|
const countries = [new Country("Afghanistan", "AF"), new Country("Aland Islands", "AX"), new Country("Albania", "AL"), new Country("Algeria", "DZ"), new Country("American Samoa", "AS", {
|
|
2055
2072
|
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2056
2073
|
}), 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", {
|
|
@@ -2179,11 +2196,31 @@ new Country("Puerto Rico", "PR", {
|
|
|
2179
2196
|
hasProvinces,
|
|
2180
2197
|
supportsByoa
|
|
2181
2198
|
}), 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")];
|
|
2199
|
+
/**
|
|
2200
|
+
* @internal
|
|
2201
|
+
*
|
|
2202
|
+
* # Address Utils - Map of Country Codes
|
|
2203
|
+
*/
|
|
2182
2204
|
const countryCodes = countries.map(c => c.code);
|
|
2205
|
+
/**
|
|
2206
|
+
* @internal
|
|
2207
|
+
*
|
|
2208
|
+
* # Address Utils - EU Country Codes
|
|
2209
|
+
*/
|
|
2183
2210
|
const euCountryCodes = countries.filter(c => c.hasEuCustomsRules).map(c => c.code);
|
|
2184
2211
|
// #endregion
|
|
2185
2212
|
// #region [ rgba(0,0,0,0) ] Postal Codes
|
|
2213
|
+
/**
|
|
2214
|
+
* @internal
|
|
2215
|
+
*
|
|
2216
|
+
* # Address Utils - Postal Code Regex
|
|
2217
|
+
*/
|
|
2186
2218
|
const postalCodeRegex$3 = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
|
|
2219
|
+
/**
|
|
2220
|
+
* @internal
|
|
2221
|
+
*
|
|
2222
|
+
* # Address Utils - US State Type
|
|
2223
|
+
*/
|
|
2187
2224
|
class UsState {
|
|
2188
2225
|
constructor(name, code, rules = {}) {
|
|
2189
2226
|
var _a, _b;
|
|
@@ -2193,6 +2230,11 @@ class UsState {
|
|
|
2193
2230
|
this.isUnitedStatesTerritory = (_b = rules.isUnitedStatesTerritory) !== null && _b !== void 0 ? _b : false;
|
|
2194
2231
|
}
|
|
2195
2232
|
}
|
|
2233
|
+
/**
|
|
2234
|
+
* @internal
|
|
2235
|
+
*
|
|
2236
|
+
* # Address Utils - Array US States and their codes
|
|
2237
|
+
*/
|
|
2196
2238
|
const usStates = [new UsState("Alabama", "AL"), new UsState("Alaska", "AK"), new UsState("American Samoa", "AS", {
|
|
2197
2239
|
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2198
2240
|
}), new UsState("Arizona", "AZ"), new UsState("Arkansas", "AR"), new UsState("Armed Forces Americas", "AA", {
|
|
@@ -2212,7 +2254,17 @@ const usStates = [new UsState("Alabama", "AL"), new UsState("Alaska", "AK"), new
|
|
|
2212
2254
|
}), new UsState("U.S. Minor Outlying Islands", "UM", {
|
|
2213
2255
|
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2214
2256
|
})];
|
|
2257
|
+
/**
|
|
2258
|
+
* @internal
|
|
2259
|
+
*
|
|
2260
|
+
* # Address Utils - Map of US State Codes
|
|
2261
|
+
*/
|
|
2215
2262
|
const usStateCodes = usStates.map(item => item.code);
|
|
2263
|
+
/**
|
|
2264
|
+
* @internal
|
|
2265
|
+
*
|
|
2266
|
+
* # Address Utils - USA City Type
|
|
2267
|
+
*/
|
|
2216
2268
|
class UsaCity {
|
|
2217
2269
|
constructor(name, code, rules = {}) {
|
|
2218
2270
|
var _a;
|
|
@@ -2221,6 +2273,11 @@ class UsaCity {
|
|
|
2221
2273
|
this.isMilitary = (_a = rules.isMilitary) !== null && _a !== void 0 ? _a : false;
|
|
2222
2274
|
}
|
|
2223
2275
|
}
|
|
2276
|
+
/**
|
|
2277
|
+
* @internal
|
|
2278
|
+
*
|
|
2279
|
+
* # Address Utils - US Cities
|
|
2280
|
+
*/
|
|
2224
2281
|
const usCities = [new UsaCity("Army Post Office", "APO", {
|
|
2225
2282
|
isMilitary
|
|
2226
2283
|
}), new UsaCity("Diplomatic Post Office", "DPO", {
|
|
@@ -2230,11 +2287,36 @@ const usCities = [new UsaCity("Army Post Office", "APO", {
|
|
|
2230
2287
|
})];
|
|
2231
2288
|
// #endregion
|
|
2232
2289
|
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2290
|
+
/**
|
|
2291
|
+
* @internal
|
|
2292
|
+
*
|
|
2293
|
+
* # Country Code Options Hook
|
|
2294
|
+
*
|
|
2295
|
+
* @category Hooks
|
|
2296
|
+
*/
|
|
2297
|
+
const useCountryCodeOptions = domestic => {
|
|
2298
|
+
const countryCodeOptions = React.useMemo(() => countries.flatMap(v => domestic && v.code !== "US" && !v.isUnitedStatesTerritory ? [] : {
|
|
2299
|
+
label: v.name,
|
|
2300
|
+
value: v.code
|
|
2301
|
+
}), [domestic]);
|
|
2302
|
+
const defaultCountryCodeOption = React.useMemo(() => {
|
|
2303
|
+
const defaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
|
|
2304
|
+
const defaultCountryCode = defaultLocale.split("-")[1];
|
|
2305
|
+
return countryCodeOptions.find(option => option.value === defaultCountryCode);
|
|
2306
|
+
}, [countryCodeOptions]);
|
|
2307
|
+
return {
|
|
2308
|
+
countryCodeOptions,
|
|
2309
|
+
defaultCountryCodeOption
|
|
2310
|
+
};
|
|
2311
|
+
};
|
|
2237
2312
|
|
|
2313
|
+
/**
|
|
2314
|
+
* @internal
|
|
2315
|
+
*
|
|
2316
|
+
* # Customs Contents Options Hook
|
|
2317
|
+
*
|
|
2318
|
+
* @category Hooks
|
|
2319
|
+
*/
|
|
2238
2320
|
const useCustomsContentsOptions = () => {
|
|
2239
2321
|
const {
|
|
2240
2322
|
t
|
|
@@ -2245,6 +2327,13 @@ const useCustomsContentsOptions = () => {
|
|
|
2245
2327
|
})), [t]);
|
|
2246
2328
|
};
|
|
2247
2329
|
|
|
2330
|
+
/**
|
|
2331
|
+
* @internal
|
|
2332
|
+
*
|
|
2333
|
+
* # Customs Non-Delivery Options Hooks
|
|
2334
|
+
*
|
|
2335
|
+
* @category Hooks
|
|
2336
|
+
*/
|
|
2248
2337
|
const useCustomsNonDeliveryOptions = () => {
|
|
2249
2338
|
const {
|
|
2250
2339
|
t
|
|
@@ -2334,6 +2423,10 @@ $$f({ target: 'Array', proto: true, forced: !STRICT_METHOD$1 || CHROME_BUG }, {
|
|
|
2334
2423
|
});
|
|
2335
2424
|
|
|
2336
2425
|
/**
|
|
2426
|
+
* @internal
|
|
2427
|
+
*
|
|
2428
|
+
* # Create Dictionary Utility Function
|
|
2429
|
+
*
|
|
2337
2430
|
* @category Utilities
|
|
2338
2431
|
*/
|
|
2339
2432
|
const createDictionary = (items, getEntry) => {
|
|
@@ -2342,6 +2435,10 @@ const createDictionary = (items, getEntry) => {
|
|
|
2342
2435
|
};
|
|
2343
2436
|
|
|
2344
2437
|
/**
|
|
2438
|
+
* @internal
|
|
2439
|
+
*
|
|
2440
|
+
* # Date Utils - getDaysInMonth
|
|
2441
|
+
*
|
|
2345
2442
|
* @category Utilities
|
|
2346
2443
|
*/
|
|
2347
2444
|
const formatDate = (date, locale = "en-US") => new Date(date).toLocaleDateString(locale, {
|
|
@@ -2350,6 +2447,10 @@ const formatDate = (date, locale = "en-US") => new Date(date).toLocaleDateString
|
|
|
2350
2447
|
year: "numeric"
|
|
2351
2448
|
});
|
|
2352
2449
|
/**
|
|
2450
|
+
* @internal
|
|
2451
|
+
*
|
|
2452
|
+
* # Date Utils - formatDateDDMMYY
|
|
2453
|
+
*
|
|
2353
2454
|
* @category Utilities
|
|
2354
2455
|
*/
|
|
2355
2456
|
const formatDateDDMMYY = (date, locale = "en-US") => new Date(date).toLocaleDateString(locale, {
|
|
@@ -2358,6 +2459,10 @@ const formatDateDDMMYY = (date, locale = "en-US") => new Date(date).toLocaleDate
|
|
|
2358
2459
|
year: "2-digit"
|
|
2359
2460
|
});
|
|
2360
2461
|
/**
|
|
2462
|
+
* @internal
|
|
2463
|
+
*
|
|
2464
|
+
* # Date Utils - getDaysInMonth
|
|
2465
|
+
*
|
|
2361
2466
|
* @category Utilities
|
|
2362
2467
|
*/
|
|
2363
2468
|
const daysAfter = (days, date = new Date()) => {
|
|
@@ -2366,14 +2471,26 @@ const daysAfter = (days, date = new Date()) => {
|
|
|
2366
2471
|
return date;
|
|
2367
2472
|
};
|
|
2368
2473
|
/**
|
|
2474
|
+
* @internal
|
|
2475
|
+
*
|
|
2476
|
+
* # Date Utils - getDaysInMonth
|
|
2477
|
+
*
|
|
2369
2478
|
* @category Utilities
|
|
2370
2479
|
*/
|
|
2371
2480
|
const nextDayCutoff = (cutoff, date = new Date()) => date.getHours() >= cutoff ? daysAfter(1, new Date(date)) : new Date(date);
|
|
2372
2481
|
/**
|
|
2482
|
+
* @internal
|
|
2483
|
+
*
|
|
2484
|
+
* # Date Utils - getDaysInMonth
|
|
2485
|
+
*
|
|
2373
2486
|
* @category Utilities
|
|
2374
2487
|
*/
|
|
2375
2488
|
const mostRecent = (...dates) => new Date(Math.max(...dates.map(Number)));
|
|
2376
2489
|
/**
|
|
2490
|
+
* @internal
|
|
2491
|
+
*
|
|
2492
|
+
* # Date Utils - getDaysInMonth
|
|
2493
|
+
*
|
|
2377
2494
|
* @category Utilities
|
|
2378
2495
|
*/
|
|
2379
2496
|
const omitTime = shipDate => {
|
|
@@ -2381,6 +2498,10 @@ const omitTime = shipDate => {
|
|
|
2381
2498
|
return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
|
|
2382
2499
|
};
|
|
2383
2500
|
/**
|
|
2501
|
+
* @internal
|
|
2502
|
+
*
|
|
2503
|
+
* # Date Utils - getExpirationYears
|
|
2504
|
+
*
|
|
2384
2505
|
* @category Utilities
|
|
2385
2506
|
*/
|
|
2386
2507
|
const getExpirationYears = yearsValid => {
|
|
@@ -2391,17 +2512,35 @@ const getExpirationYears = yearsValid => {
|
|
|
2391
2512
|
}
|
|
2392
2513
|
return years;
|
|
2393
2514
|
};
|
|
2515
|
+
/**
|
|
2516
|
+
* @internal
|
|
2517
|
+
*
|
|
2518
|
+
* # Date Utilities - sortByCreationDate
|
|
2519
|
+
*
|
|
2520
|
+
* @category Utilities
|
|
2521
|
+
*/
|
|
2394
2522
|
const sortByCreationDate = (a, b, order = "desc") => {
|
|
2395
2523
|
const [x, y] = order === "asc" ? [a, b] : [b, a];
|
|
2396
2524
|
return new Date(x.createdAt).getTime() - new Date(y.createdAt).getTime();
|
|
2397
2525
|
};
|
|
2398
2526
|
/**
|
|
2527
|
+
* @internal
|
|
2528
|
+
*
|
|
2529
|
+
* # Date Utilities - isNowOrInTheFuture
|
|
2530
|
+
*
|
|
2399
2531
|
* @category Utilities
|
|
2400
2532
|
*/
|
|
2401
2533
|
const isNowOrInTheFuture = shipDate => {
|
|
2402
2534
|
if (shipDate) return new Date(shipDate) >= new Date();
|
|
2403
2535
|
return false;
|
|
2404
2536
|
};
|
|
2537
|
+
/**
|
|
2538
|
+
* @internal
|
|
2539
|
+
*
|
|
2540
|
+
* # Date Utilities - getRelativeDates
|
|
2541
|
+
*
|
|
2542
|
+
* @category Utilities
|
|
2543
|
+
*/
|
|
2405
2544
|
const getRelativeDates = from => {
|
|
2406
2545
|
const origin = from !== null && from !== void 0 ? from : new Date();
|
|
2407
2546
|
return {
|
|
@@ -2415,6 +2554,12 @@ const getRelativeDates = from => {
|
|
|
2415
2554
|
};
|
|
2416
2555
|
|
|
2417
2556
|
/**
|
|
2557
|
+
* @internal
|
|
2558
|
+
*
|
|
2559
|
+
* # Create Coded Errors Utlity Function
|
|
2560
|
+
*
|
|
2561
|
+
* - This function extracts errors from our `Axios Responses`.
|
|
2562
|
+
*
|
|
2418
2563
|
* @category Utilities
|
|
2419
2564
|
*/
|
|
2420
2565
|
const createCodedErrors = err => {
|
|
@@ -2430,19 +2575,229 @@ const createCodedErrors = err => {
|
|
|
2430
2575
|
}];
|
|
2431
2576
|
};
|
|
2432
2577
|
/**
|
|
2433
|
-
*
|
|
2578
|
+
* @internal
|
|
2579
|
+
*
|
|
2580
|
+
* - Joins a list of error-like object's messages and throws them as a single error.
|
|
2581
|
+
*
|
|
2582
|
+
* @category Utilities
|
|
2434
2583
|
*/
|
|
2435
2584
|
function throwJoinedMessages(errors) {
|
|
2436
2585
|
throw new Error(errors.map(e => e.message).join(", "));
|
|
2437
2586
|
}
|
|
2438
2587
|
/**
|
|
2439
|
-
*
|
|
2588
|
+
* @internal
|
|
2589
|
+
*
|
|
2590
|
+
* - If any CodedErrors exist, throw them all as a single error, otherwise assert errors is null.
|
|
2591
|
+
*
|
|
2592
|
+
* @category Utilities
|
|
2440
2593
|
*/
|
|
2441
2594
|
function throwAny(errors) {
|
|
2442
2595
|
if (errors) throwJoinedMessages(errors);
|
|
2443
2596
|
}
|
|
2444
2597
|
|
|
2445
2598
|
/**
|
|
2599
|
+
* @namespace featureFlags
|
|
2600
|
+
*
|
|
2601
|
+
* - The `featureFlags` namespace contains all the feature flags available throughout the
|
|
2602
|
+
* application. All features are scoped by name to the component they are intended for.
|
|
2603
|
+
*
|
|
2604
|
+
* @example
|
|
2605
|
+
* ```tsx
|
|
2606
|
+
* export const featureFlags = {
|
|
2607
|
+
* ConfigureSalesOrderShipment: {
|
|
2608
|
+
* compatibleCountryCodes: ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"],
|
|
2609
|
+
* rateForm: {
|
|
2610
|
+
* enableFunding: false,
|
|
2611
|
+
* enableGlobalPostFiltering: false,
|
|
2612
|
+
* labelLayout: false,
|
|
2613
|
+
* nicknameRate: true,
|
|
2614
|
+
* saveRate: true,
|
|
2615
|
+
* },
|
|
2616
|
+
* shipmentForm: {
|
|
2617
|
+
* browseRates: true,
|
|
2618
|
+
* includeShipsuranceInsurance: true,
|
|
2619
|
+
* includeThirdPartyInsurance: true,
|
|
2620
|
+
* selectService: true,
|
|
2621
|
+
* shippingPresets: false,
|
|
2622
|
+
* },
|
|
2623
|
+
* },
|
|
2624
|
+
* Global: {
|
|
2625
|
+
* carriers: {
|
|
2626
|
+
* enabledCarriers: ["stamps_com", "ups", "dhl_express_walleted"],
|
|
2627
|
+
* },
|
|
2628
|
+
* presentation: {
|
|
2629
|
+
* poweredByShipEngine: false,
|
|
2630
|
+
* },
|
|
2631
|
+
* },
|
|
2632
|
+
* ViewShipment: {
|
|
2633
|
+
* shipment: {
|
|
2634
|
+
* schedulePickup: true,
|
|
2635
|
+
* },
|
|
2636
|
+
* },
|
|
2637
|
+
* } as const;
|
|
2638
|
+
* ```
|
|
2639
|
+
*/
|
|
2640
|
+
const featureFlags = {
|
|
2641
|
+
/**
|
|
2642
|
+
* `ConfigureSalesOrderShipment` all scoped feature flags for the shipment configuration
|
|
2643
|
+
* section of the `<PurchaseLabel />` element.
|
|
2644
|
+
*/
|
|
2645
|
+
ConfigureSalesOrderShipment: {
|
|
2646
|
+
/**
|
|
2647
|
+
* `compatibleCountryCodes` is a list of all supported `countries` available in ShipEngine
|
|
2648
|
+
* Elements.
|
|
2649
|
+
*/
|
|
2650
|
+
compatibleCountryCodes: ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"],
|
|
2651
|
+
/**
|
|
2652
|
+
* `rateForm` all scoped feature flags for the `rate form` section of the `<PurchaseLabel />`
|
|
2653
|
+
* element.
|
|
2654
|
+
*/
|
|
2655
|
+
rateForm: {
|
|
2656
|
+
/**
|
|
2657
|
+
* `enableFunding` enables the `funding` section of the rate form.
|
|
2658
|
+
*/
|
|
2659
|
+
enableFunding: false,
|
|
2660
|
+
/**
|
|
2661
|
+
* `enableGlobalPostFiltering` enables the `global post filtering` on all rates fetched
|
|
2662
|
+
* in the rates form.
|
|
2663
|
+
*/
|
|
2664
|
+
enableGlobalPostFiltering: false,
|
|
2665
|
+
/**
|
|
2666
|
+
* `labelLayout` enables the `label layout` section of the `<PurchaseLabel /> element.
|
|
2667
|
+
*/
|
|
2668
|
+
labelLayout: false,
|
|
2669
|
+
/**
|
|
2670
|
+
* `nicknameRate` enables showing the `carrier nickname` when rates are fetched.
|
|
2671
|
+
*/
|
|
2672
|
+
nicknameRate: true,
|
|
2673
|
+
requireDhlTermsAcknowledgement: false,
|
|
2674
|
+
/**
|
|
2675
|
+
* `saveRate` enables the `save rate` button in the rate form. This allows users to save a
|
|
2676
|
+
* `rateId` for a shipment to be purchased later.
|
|
2677
|
+
*/
|
|
2678
|
+
saveRate: true
|
|
2679
|
+
},
|
|
2680
|
+
/**
|
|
2681
|
+
* `shipmentForm` all scoped feature flags for the `shipment form` section of the
|
|
2682
|
+
* `<PurchaseLabel />` element.
|
|
2683
|
+
*/
|
|
2684
|
+
shipmentForm: {
|
|
2685
|
+
/**
|
|
2686
|
+
* `browseRates` enables the `browse rates` button in the shipment form. This allows users
|
|
2687
|
+
* to browse rates for a shipment with varying shipment configurations. This is useful for
|
|
2688
|
+
* rate shopping.
|
|
2689
|
+
*/
|
|
2690
|
+
browseRates: true,
|
|
2691
|
+
/**
|
|
2692
|
+
* `includeShipsuranceInsurance` enables the `shipsurance insurance` feature, allowing users
|
|
2693
|
+
* to select Shipsurance when insuring their shipment.
|
|
2694
|
+
*/
|
|
2695
|
+
includeShipsuranceInsurance: true,
|
|
2696
|
+
/**
|
|
2697
|
+
* `includeThirdPartyInsurance` enables the `third party insurance` feature, allowing users
|
|
2698
|
+
* to opt for third party insurance when insuring their shipment.
|
|
2699
|
+
*/
|
|
2700
|
+
includeThirdPartyInsurance: true,
|
|
2701
|
+
/**
|
|
2702
|
+
* `selectService` enables the `select service` feature, allowing users to select a service
|
|
2703
|
+
* when rate shopping across multiple carrier providers.
|
|
2704
|
+
*/
|
|
2705
|
+
selectService: true,
|
|
2706
|
+
/**
|
|
2707
|
+
* `shippingPresets` enables the `shipping presets` feature, allowing users to pass in a set
|
|
2708
|
+
* of shipping presets they wish to use within the shipment form of the `<PurchaseLabel />`
|
|
2709
|
+
* element.
|
|
2710
|
+
*/
|
|
2711
|
+
shippingPresets: false
|
|
2712
|
+
}
|
|
2713
|
+
},
|
|
2714
|
+
/**
|
|
2715
|
+
* `Global` all feature flags that are intended for use anywhere in ShipEngine Elements.
|
|
2716
|
+
*/
|
|
2717
|
+
Global: {
|
|
2718
|
+
/**
|
|
2719
|
+
* All global `carrier` related feature flags.
|
|
2720
|
+
*/
|
|
2721
|
+
carriers: {
|
|
2722
|
+
/**
|
|
2723
|
+
* `enabledCarriers` is a list of all `carriers` that are enabled for use in ShipEngine
|
|
2724
|
+
* Elements.
|
|
2725
|
+
*/
|
|
2726
|
+
enabledCarriers: ["stamps_com", "ups", "dhl_express_walleted"]
|
|
2727
|
+
},
|
|
2728
|
+
/**
|
|
2729
|
+
* All global `presentation` related feature flags.
|
|
2730
|
+
*/
|
|
2731
|
+
presentation: {
|
|
2732
|
+
/**
|
|
2733
|
+
* `poweredByShipEngine` enables the `powered by ShipEngine` logo in the footer various
|
|
2734
|
+
* elements.
|
|
2735
|
+
*/
|
|
2736
|
+
poweredByShipEngine: false
|
|
2737
|
+
}
|
|
2738
|
+
},
|
|
2739
|
+
/**
|
|
2740
|
+
* `ViewShipment` all scoped feature flags for the `<ViewShipment />` element.
|
|
2741
|
+
*/
|
|
2742
|
+
ViewShipment: {
|
|
2743
|
+
/**
|
|
2744
|
+
* `shipment` all shipment related features available in the `<ViewShipment />` element.
|
|
2745
|
+
*/
|
|
2746
|
+
shipment: {
|
|
2747
|
+
/**
|
|
2748
|
+
* `schedulePickup` enables the `schedule pickup` button in the `<ViewShipment />` element,
|
|
2749
|
+
* allowing users to schedule pick-ups for their shipments.
|
|
2750
|
+
*/
|
|
2751
|
+
schedulePickup: true
|
|
2752
|
+
}
|
|
2753
|
+
}
|
|
2754
|
+
};
|
|
2755
|
+
/**
|
|
2756
|
+
* @internal
|
|
2757
|
+
*
|
|
2758
|
+
* # Feature Flags - featureFlagComponentNameLookup
|
|
2759
|
+
*/
|
|
2760
|
+
const featureFlagComponentNameLookup = componentName => {
|
|
2761
|
+
var _a;
|
|
2762
|
+
const lookup = {
|
|
2763
|
+
PurchaseLabel: "ConfigureSalesOrderShipment"
|
|
2764
|
+
};
|
|
2765
|
+
return (_a = lookup[componentName]) !== null && _a !== void 0 ? _a : "";
|
|
2766
|
+
};
|
|
2767
|
+
/**
|
|
2768
|
+
* @internal
|
|
2769
|
+
*
|
|
2770
|
+
* # Feature Flags - getFeatures
|
|
2771
|
+
*/
|
|
2772
|
+
const getFeatures = (...element) => {
|
|
2773
|
+
return element.map(feat => {
|
|
2774
|
+
var _a;
|
|
2775
|
+
return (_a = _$3.get(featureFlags, feat)) !== null && _a !== void 0 ? _a : {};
|
|
2776
|
+
}).reduce((acc, feat) => Object.assign(acc, feat), {});
|
|
2777
|
+
};
|
|
2778
|
+
/**
|
|
2779
|
+
* # Feature Flags - useFeatures
|
|
2780
|
+
*
|
|
2781
|
+
* - The `useFeatures` hook is used to retrieve the feature flags for a given component.
|
|
2782
|
+
*
|
|
2783
|
+
* @example
|
|
2784
|
+
* ```tsx
|
|
2785
|
+
* const features = useFeatures("Global");
|
|
2786
|
+
* ```
|
|
2787
|
+
*
|
|
2788
|
+
* <br />
|
|
2789
|
+
*
|
|
2790
|
+
* @see {@link featureFlags | All available `Feature Flags`}
|
|
2791
|
+
*/
|
|
2792
|
+
const useFeatures = (...element) => {
|
|
2793
|
+
return getFeatures(...element);
|
|
2794
|
+
};
|
|
2795
|
+
|
|
2796
|
+
/**
|
|
2797
|
+
* @internal
|
|
2798
|
+
*
|
|
2799
|
+
* # Form Logger
|
|
2800
|
+
*
|
|
2446
2801
|
* @description
|
|
2447
2802
|
* This will log the values that are submitted to the validation resolver
|
|
2448
2803
|
* (only REGISTERED form fields) and the results of that validation.
|
|
@@ -3073,6 +3428,11 @@ fixRegExpWellKnownSymbolLogic$1('replace', function (_, nativeReplace, maybeCall
|
|
|
3073
3428
|
];
|
|
3074
3429
|
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
|
|
3075
3430
|
|
|
3431
|
+
/**
|
|
3432
|
+
* @internal
|
|
3433
|
+
*
|
|
3434
|
+
* # Money Utils - currency Symbol
|
|
3435
|
+
*/
|
|
3076
3436
|
const currencySymbol = {
|
|
3077
3437
|
aud: "$",
|
|
3078
3438
|
cad: "$",
|
|
@@ -3081,6 +3441,11 @@ const currencySymbol = {
|
|
|
3081
3441
|
nzd: "$",
|
|
3082
3442
|
usd: "$"
|
|
3083
3443
|
};
|
|
3444
|
+
/**
|
|
3445
|
+
* @internal
|
|
3446
|
+
*
|
|
3447
|
+
* # Money Utils - formatMoney
|
|
3448
|
+
*/
|
|
3084
3449
|
const formatMoney = (value, locale = "en-US") => {
|
|
3085
3450
|
const currency = Intl.NumberFormat(locale, {
|
|
3086
3451
|
currency: value.currency,
|
|
@@ -3088,40 +3453,86 @@ const formatMoney = (value, locale = "en-US") => {
|
|
|
3088
3453
|
});
|
|
3089
3454
|
return currency.format(value.amount);
|
|
3090
3455
|
};
|
|
3456
|
+
/**
|
|
3457
|
+
* @internal
|
|
3458
|
+
*
|
|
3459
|
+
* # Money Utils - calculateTotal
|
|
3460
|
+
*/
|
|
3091
3461
|
const calculateTotal = (...values) => {
|
|
3092
3462
|
return values.reduce((total, value) => {
|
|
3093
3463
|
var _a;
|
|
3094
3464
|
return value ? total + ((_a = value.amount) !== null && _a !== void 0 ? _a : 0) : total;
|
|
3095
3465
|
}, 0);
|
|
3096
3466
|
};
|
|
3467
|
+
/**
|
|
3468
|
+
* @internal
|
|
3469
|
+
*
|
|
3470
|
+
* # Money Utils - formatCreditCardNumber
|
|
3471
|
+
*/
|
|
3097
3472
|
const formatCreditCardNumber = cc => [cc.substring(0, 4), cc.substring(4, 8), cc.substring(8, 12), cc.substring(12)].join(" ").trim();
|
|
3473
|
+
/**
|
|
3474
|
+
* @internal
|
|
3475
|
+
*
|
|
3476
|
+
* # Money Utils - formatExpiration
|
|
3477
|
+
*/
|
|
3098
3478
|
const formatExpiration = exp => {
|
|
3099
3479
|
const digits = exp.replace(/\//g, "");
|
|
3100
3480
|
if (digits.length > 2) return [digits.substring(0, 2), digits.substring(2, 6)].join("/").trim();
|
|
3101
3481
|
return digits;
|
|
3102
3482
|
};
|
|
3103
3483
|
|
|
3484
|
+
/**
|
|
3485
|
+
* @internal
|
|
3486
|
+
*
|
|
3487
|
+
* # String Predicate Utilities
|
|
3488
|
+
*
|
|
3489
|
+
* @category Utilities
|
|
3490
|
+
*/
|
|
3104
3491
|
const isString = x => typeof x === "string";
|
|
3105
3492
|
|
|
3106
|
-
|
|
3493
|
+
/**
|
|
3494
|
+
* @internal
|
|
3495
|
+
*
|
|
3496
|
+
* # Rates Utilities - getRateRequiresAcknowledgement
|
|
3497
|
+
*
|
|
3498
|
+
* @category Utilities
|
|
3499
|
+
*/
|
|
3500
|
+
const getRateRequiresAcknowledgement = (serviceCode, packageType, requireDhlTermsAcknowledgement) => {
|
|
3107
3501
|
switch (serviceCode) {
|
|
3108
3502
|
case "usps_media_mail":
|
|
3109
3503
|
return true;
|
|
3110
3504
|
case "usps_first_class_mail":
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
return false;
|
|
3505
|
+
return packageType === "large_envelope_or_flat";
|
|
3506
|
+
case "dhl_express_worldwide":
|
|
3507
|
+
return requireDhlTermsAcknowledgement;
|
|
3115
3508
|
default:
|
|
3116
3509
|
return false;
|
|
3117
3510
|
}
|
|
3118
3511
|
};
|
|
3512
|
+
/**
|
|
3513
|
+
* @internal
|
|
3514
|
+
*
|
|
3515
|
+
* # Rates Utilities - getTotalRateAmount
|
|
3516
|
+
*
|
|
3517
|
+
* @category Utilities
|
|
3518
|
+
*/
|
|
3119
3519
|
const getTotalRateAmount = (rateCosts = {}) => calculateTotal(...Object.values(rateCosts));
|
|
3520
|
+
/**
|
|
3521
|
+
* @internal
|
|
3522
|
+
*
|
|
3523
|
+
* # Rates Utilities - overrideCarrierCodes
|
|
3524
|
+
*
|
|
3525
|
+
* @category Utilities
|
|
3526
|
+
*/
|
|
3120
3527
|
const overrideCarrierCodes$1 = (carrier, overrides) => {
|
|
3121
3528
|
return overrides[carrier] || carrier;
|
|
3122
3529
|
};
|
|
3123
3530
|
|
|
3124
3531
|
/**
|
|
3532
|
+
* @internal
|
|
3533
|
+
*
|
|
3534
|
+
* # Address Utilities - isDomesticAddress
|
|
3535
|
+
*
|
|
3125
3536
|
* @category Utilities
|
|
3126
3537
|
*/
|
|
3127
3538
|
const isDomesticAddress = address => {
|
|
@@ -3129,6 +3540,10 @@ const isDomesticAddress = address => {
|
|
|
3129
3540
|
return address.countryCode === "US" || ((_a = countries.find(c => c.code === address.countryCode)) === null || _a === void 0 ? void 0 : _a.isUnitedStatesTerritory);
|
|
3130
3541
|
};
|
|
3131
3542
|
/**
|
|
3543
|
+
* @internal
|
|
3544
|
+
*
|
|
3545
|
+
* # Address Utilities - isMilitaryAddress
|
|
3546
|
+
*
|
|
3132
3547
|
* @category Utilities
|
|
3133
3548
|
*/
|
|
3134
3549
|
const isMilitaryAddress = address => {
|
|
@@ -3136,6 +3551,10 @@ const isMilitaryAddress = address => {
|
|
|
3136
3551
|
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));
|
|
3137
3552
|
};
|
|
3138
3553
|
/**
|
|
3554
|
+
* @internal
|
|
3555
|
+
*
|
|
3556
|
+
* # Address Utilities - isUnitedStatesTerritory
|
|
3557
|
+
*
|
|
3139
3558
|
* @category Utilities
|
|
3140
3559
|
*/
|
|
3141
3560
|
const isUnitedStatesTerritory = address => {
|
|
@@ -3143,6 +3562,10 @@ const isUnitedStatesTerritory = address => {
|
|
|
3143
3562
|
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));
|
|
3144
3563
|
};
|
|
3145
3564
|
/**
|
|
3565
|
+
* @internal
|
|
3566
|
+
*
|
|
3567
|
+
* # Address Utilities - isUnsupportedByUps
|
|
3568
|
+
*
|
|
3146
3569
|
* @category Utilities
|
|
3147
3570
|
*/
|
|
3148
3571
|
const isUnsupportedByUps = address => {
|
|
@@ -3153,39 +3576,90 @@ const PO_BOX_REGEX =
|
|
|
3153
3576
|
// eslint-disable-next-line no-useless-escape
|
|
3154
3577
|
/^(((p[\s\.\'\,]?[o\s][\.\'\,]?)\s?)|(post\s?office\s?))((box|bin|bo|b\.?)?\s?(num|number|#)?\s?\d+)/i;
|
|
3155
3578
|
/**
|
|
3579
|
+
* @internal
|
|
3580
|
+
*
|
|
3581
|
+
* # Address Utilities - isPoBox
|
|
3582
|
+
*
|
|
3156
3583
|
* @category Utilities
|
|
3157
3584
|
*/
|
|
3158
3585
|
const isPoBox = addressLine => PO_BOX_REGEX.test(addressLine);
|
|
3159
3586
|
/**
|
|
3587
|
+
* @internal
|
|
3588
|
+
*
|
|
3589
|
+
* # Address Utilities - isPoBoxAddress
|
|
3590
|
+
*
|
|
3160
3591
|
* @category Utilities
|
|
3161
3592
|
*/
|
|
3162
3593
|
const isPoBoxAddress = address => !!(isPoBox(address.addressLine1) || address.addressLine2 && isPoBox(address.addressLine2));
|
|
3594
|
+
/**
|
|
3595
|
+
* @internal
|
|
3596
|
+
*
|
|
3597
|
+
* # Address Utilities - isEmptyAddress
|
|
3598
|
+
*
|
|
3599
|
+
* @category Utilities
|
|
3600
|
+
*/
|
|
3163
3601
|
const isEmptyAddress = address => {
|
|
3164
3602
|
return !address || Object.entries(address).every(([key, value]) => key === "countryCode" || [null, "", "unknown"].includes(value));
|
|
3165
3603
|
};
|
|
3166
3604
|
|
|
3167
3605
|
const USPS_CARRIER_CODES = ["usps", "stamps_com"];
|
|
3606
|
+
/**
|
|
3607
|
+
* @internal
|
|
3608
|
+
*
|
|
3609
|
+
* # Carrier Utilities - isUspsCarrier
|
|
3610
|
+
*
|
|
3611
|
+
* @category Utilities
|
|
3612
|
+
*/
|
|
3168
3613
|
const isUspsCarrier = carrierCode => USPS_CARRIER_CODES.includes(carrierCode);
|
|
3614
|
+
/**
|
|
3615
|
+
* @internal
|
|
3616
|
+
*
|
|
3617
|
+
* # Carrier Utilities - isUpsCarrier
|
|
3618
|
+
*
|
|
3619
|
+
* @category Utilities
|
|
3620
|
+
*/
|
|
3169
3621
|
const isUpsCarrier = carrierCode => carrierCode === "ups";
|
|
3622
|
+
/**
|
|
3623
|
+
* @internal
|
|
3624
|
+
*
|
|
3625
|
+
* # Carrier Utilities - isFedexCarrier
|
|
3626
|
+
*
|
|
3627
|
+
* @category Utilities
|
|
3628
|
+
*/
|
|
3170
3629
|
const getCarrierIdByCarrierCode = (carriers = [], carrierCode) => {
|
|
3171
3630
|
const carrier = carriers.find(c => c.carrierCode === carrierCode);
|
|
3172
3631
|
return carrier === null || carrier === void 0 ? void 0 : carrier.carrierId;
|
|
3173
3632
|
};
|
|
3174
3633
|
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3634
|
+
/**
|
|
3635
|
+
* @internal
|
|
3636
|
+
*
|
|
3637
|
+
* # Convert Dimensions Utility Function
|
|
3638
|
+
*
|
|
3639
|
+
* @category Utilities
|
|
3640
|
+
*/
|
|
3641
|
+
const formatDimensions = dimensions => `${dimensions.length} x ${dimensions.width} x ${dimensions.height} `;
|
|
3642
|
+
function convertDimensions(dimensions, {
|
|
3643
|
+
allowAllZeroes
|
|
3644
|
+
} = {}) {
|
|
3645
|
+
const {
|
|
3646
|
+
length,
|
|
3647
|
+
width,
|
|
3648
|
+
height,
|
|
3649
|
+
unit
|
|
3650
|
+
} = dimensions;
|
|
3651
|
+
const hasAllZeroes = [length, width, height].every(v => v === 0);
|
|
3652
|
+
if (hasAllZeroes && !allowAllZeroes) return undefined;
|
|
3183
3653
|
return Object.assign(Object.assign({}, dimensions), {
|
|
3184
|
-
unit: "inch"
|
|
3654
|
+
unit: unit !== null && unit !== void 0 ? unit : "inch"
|
|
3185
3655
|
});
|
|
3186
3656
|
}
|
|
3187
3657
|
|
|
3188
3658
|
/**
|
|
3659
|
+
* @internal
|
|
3660
|
+
*
|
|
3661
|
+
* # Sales Order Utilities - getCustomsFromSalesOrder
|
|
3662
|
+
*
|
|
3189
3663
|
* @category Utilities
|
|
3190
3664
|
*/
|
|
3191
3665
|
const getCustomsFromSalesOrder = (salesOrder, warehouse) => ({
|
|
@@ -3199,6 +3673,10 @@ const getCustomsFromSalesOrder = (salesOrder, warehouse) => ({
|
|
|
3199
3673
|
nonDelivery: "return_to_sender"
|
|
3200
3674
|
});
|
|
3201
3675
|
/**
|
|
3676
|
+
* @internal
|
|
3677
|
+
*
|
|
3678
|
+
* # Sales Order Utilities - getIsCustomsRequiredForSalesOrder
|
|
3679
|
+
*
|
|
3202
3680
|
* @category Utilities
|
|
3203
3681
|
*/
|
|
3204
3682
|
const getIsCustomsRequiredForSalesOrder = ({
|
|
@@ -3207,12 +3685,23 @@ const getIsCustomsRequiredForSalesOrder = ({
|
|
|
3207
3685
|
originAddress
|
|
3208
3686
|
}) => 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);
|
|
3209
3687
|
/**
|
|
3688
|
+
* @internal
|
|
3689
|
+
*
|
|
3690
|
+
* # Sales Order Utilities - getRequestedServices
|
|
3691
|
+
*
|
|
3210
3692
|
* @category Utilities
|
|
3211
3693
|
*/
|
|
3212
3694
|
const getRequestedServices = salesOrder => {
|
|
3213
3695
|
var _a;
|
|
3214
3696
|
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)));
|
|
3215
3697
|
};
|
|
3698
|
+
/**
|
|
3699
|
+
* @internal
|
|
3700
|
+
*
|
|
3701
|
+
* # Sales Order Utilities - getSalesOrderItemsFromSalesOrderOrShipment
|
|
3702
|
+
*
|
|
3703
|
+
* @category Utilities
|
|
3704
|
+
*/
|
|
3216
3705
|
const getSalesOrderItemsFromSalesOrderOrShipment = ({
|
|
3217
3706
|
salesOrder,
|
|
3218
3707
|
shipment
|
|
@@ -3436,6 +3925,10 @@ $$c({ target: 'Array', proto: true, forced: FORCED$3 }, {
|
|
|
3436
3925
|
});
|
|
3437
3926
|
|
|
3438
3927
|
/**
|
|
3928
|
+
* @internal
|
|
3929
|
+
*
|
|
3930
|
+
* # Shipment Utilities - getIsInternationalShipment
|
|
3931
|
+
*
|
|
3439
3932
|
* @category Utilities
|
|
3440
3933
|
*/
|
|
3441
3934
|
const getIsInternationalShipment = ({
|
|
@@ -3443,6 +3936,10 @@ const getIsInternationalShipment = ({
|
|
|
3443
3936
|
shipTo
|
|
3444
3937
|
}) => (shipFrom === null || shipFrom === void 0 ? void 0 : shipFrom.countryCode) !== (shipTo === null || shipTo === void 0 ? void 0 : shipTo.countryCode);
|
|
3445
3938
|
/**
|
|
3939
|
+
* @internal
|
|
3940
|
+
*
|
|
3941
|
+
* # Shipment Utilities - getIsCustomsRequiredForShipment
|
|
3942
|
+
*
|
|
3446
3943
|
* @category Utilities
|
|
3447
3944
|
*/
|
|
3448
3945
|
const getIsCustomsRequiredForShipment = ({
|
|
@@ -3450,32 +3947,292 @@ const getIsCustomsRequiredForShipment = ({
|
|
|
3450
3947
|
shipTo
|
|
3451
3948
|
}) => 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);
|
|
3452
3949
|
/**
|
|
3950
|
+
* @internal
|
|
3951
|
+
*
|
|
3952
|
+
* # Shipment Utilities - getPendingShipment
|
|
3953
|
+
*
|
|
3453
3954
|
* @category Utilities
|
|
3454
3955
|
*/
|
|
3455
3956
|
const getPendingShipment = shipments => shipments === null || shipments === void 0 ? void 0 : shipments.filter(s => s.shipmentStatus === "pending").sort(sortByCreationDate)[0];
|
|
3456
3957
|
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3958
|
+
var uncurryThis$6 = functionUncurryThis;
|
|
3959
|
+
|
|
3960
|
+
// `thisNumberValue` abstract operation
|
|
3961
|
+
// https://tc39.es/ecma262/#sec-thisnumbervalue
|
|
3962
|
+
var thisNumberValue$1 = uncurryThis$6(1.0.valueOf);
|
|
3963
|
+
|
|
3964
|
+
var toIntegerOrInfinity$1 = toIntegerOrInfinity$6;
|
|
3965
|
+
var toString$5 = toString$c;
|
|
3966
|
+
var requireObjectCoercible$2 = requireObjectCoercible$9;
|
|
3967
|
+
|
|
3968
|
+
var $RangeError$1 = RangeError;
|
|
3969
|
+
|
|
3970
|
+
// `String.prototype.repeat` method implementation
|
|
3971
|
+
// https://tc39.es/ecma262/#sec-string.prototype.repeat
|
|
3972
|
+
var stringRepeat = function repeat(count) {
|
|
3973
|
+
var str = toString$5(requireObjectCoercible$2(this));
|
|
3974
|
+
var result = '';
|
|
3975
|
+
var n = toIntegerOrInfinity$1(count);
|
|
3976
|
+
if (n < 0 || n == Infinity) throw $RangeError$1('Wrong number of repetitions');
|
|
3977
|
+
for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;
|
|
3978
|
+
return result;
|
|
3979
|
+
};
|
|
3980
|
+
|
|
3981
|
+
var $$b = _export;
|
|
3982
|
+
var uncurryThis$5 = functionUncurryThis;
|
|
3983
|
+
var toIntegerOrInfinity = toIntegerOrInfinity$6;
|
|
3984
|
+
var thisNumberValue = thisNumberValue$1;
|
|
3985
|
+
var $repeat = stringRepeat;
|
|
3986
|
+
var fails$4 = fails$q;
|
|
3987
|
+
|
|
3988
|
+
var $RangeError = RangeError;
|
|
3989
|
+
var $String = String;
|
|
3990
|
+
var floor = Math.floor;
|
|
3991
|
+
var repeat = uncurryThis$5($repeat);
|
|
3992
|
+
var stringSlice$2 = uncurryThis$5(''.slice);
|
|
3993
|
+
var nativeToFixed = uncurryThis$5(1.0.toFixed);
|
|
3994
|
+
|
|
3995
|
+
var pow = function (x, n, acc) {
|
|
3996
|
+
return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
|
|
3997
|
+
};
|
|
3998
|
+
|
|
3999
|
+
var log = function (x) {
|
|
4000
|
+
var n = 0;
|
|
4001
|
+
var x2 = x;
|
|
4002
|
+
while (x2 >= 4096) {
|
|
4003
|
+
n += 12;
|
|
4004
|
+
x2 /= 4096;
|
|
3464
4005
|
}
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
};
|
|
4006
|
+
while (x2 >= 2) {
|
|
4007
|
+
n += 1;
|
|
4008
|
+
x2 /= 2;
|
|
4009
|
+
} return n;
|
|
4010
|
+
};
|
|
4011
|
+
|
|
4012
|
+
var multiply = function (data, n, c) {
|
|
4013
|
+
var index = -1;
|
|
4014
|
+
var c2 = c;
|
|
4015
|
+
while (++index < 6) {
|
|
4016
|
+
c2 += n * data[index];
|
|
4017
|
+
data[index] = c2 % 1e7;
|
|
4018
|
+
c2 = floor(c2 / 1e7);
|
|
4019
|
+
}
|
|
4020
|
+
};
|
|
4021
|
+
|
|
4022
|
+
var divide = function (data, n) {
|
|
4023
|
+
var index = 6;
|
|
4024
|
+
var c = 0;
|
|
4025
|
+
while (--index >= 0) {
|
|
4026
|
+
c += data[index];
|
|
4027
|
+
data[index] = floor(c / n);
|
|
4028
|
+
c = (c % n) * 1e7;
|
|
4029
|
+
}
|
|
4030
|
+
};
|
|
4031
|
+
|
|
4032
|
+
var dataToString = function (data) {
|
|
4033
|
+
var index = 6;
|
|
4034
|
+
var s = '';
|
|
4035
|
+
while (--index >= 0) {
|
|
4036
|
+
if (s !== '' || index === 0 || data[index] !== 0) {
|
|
4037
|
+
var t = $String(data[index]);
|
|
4038
|
+
s = s === '' ? t : s + repeat('0', 7 - t.length) + t;
|
|
4039
|
+
}
|
|
4040
|
+
} return s;
|
|
4041
|
+
};
|
|
4042
|
+
|
|
4043
|
+
var FORCED$2 = fails$4(function () {
|
|
4044
|
+
return nativeToFixed(0.00008, 3) !== '0.000' ||
|
|
4045
|
+
nativeToFixed(0.9, 0) !== '1' ||
|
|
4046
|
+
nativeToFixed(1.255, 2) !== '1.25' ||
|
|
4047
|
+
nativeToFixed(1000000000000000128.0, 0) !== '1000000000000000128';
|
|
4048
|
+
}) || !fails$4(function () {
|
|
4049
|
+
// V8 ~ Android 4.3-
|
|
4050
|
+
nativeToFixed({});
|
|
4051
|
+
});
|
|
4052
|
+
|
|
4053
|
+
// `Number.prototype.toFixed` method
|
|
4054
|
+
// https://tc39.es/ecma262/#sec-number.prototype.tofixed
|
|
4055
|
+
$$b({ target: 'Number', proto: true, forced: FORCED$2 }, {
|
|
4056
|
+
toFixed: function toFixed(fractionDigits) {
|
|
4057
|
+
var number = thisNumberValue(this);
|
|
4058
|
+
var fractDigits = toIntegerOrInfinity(fractionDigits);
|
|
4059
|
+
var data = [0, 0, 0, 0, 0, 0];
|
|
4060
|
+
var sign = '';
|
|
4061
|
+
var result = '0';
|
|
4062
|
+
var e, z, j, k;
|
|
4063
|
+
|
|
4064
|
+
// TODO: ES2018 increased the maximum number of fraction digits to 100, need to improve the implementation
|
|
4065
|
+
if (fractDigits < 0 || fractDigits > 20) throw $RangeError('Incorrect fraction digits');
|
|
4066
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
4067
|
+
if (number != number) return 'NaN';
|
|
4068
|
+
if (number <= -1e21 || number >= 1e21) return $String(number);
|
|
4069
|
+
if (number < 0) {
|
|
4070
|
+
sign = '-';
|
|
4071
|
+
number = -number;
|
|
4072
|
+
}
|
|
4073
|
+
if (number > 1e-21) {
|
|
4074
|
+
e = log(number * pow(2, 69, 1)) - 69;
|
|
4075
|
+
z = e < 0 ? number * pow(2, -e, 1) : number / pow(2, e, 1);
|
|
4076
|
+
z *= 0x10000000000000;
|
|
4077
|
+
e = 52 - e;
|
|
4078
|
+
if (e > 0) {
|
|
4079
|
+
multiply(data, 0, z);
|
|
4080
|
+
j = fractDigits;
|
|
4081
|
+
while (j >= 7) {
|
|
4082
|
+
multiply(data, 1e7, 0);
|
|
4083
|
+
j -= 7;
|
|
4084
|
+
}
|
|
4085
|
+
multiply(data, pow(10, j, 1), 0);
|
|
4086
|
+
j = e - 1;
|
|
4087
|
+
while (j >= 23) {
|
|
4088
|
+
divide(data, 1 << 23);
|
|
4089
|
+
j -= 23;
|
|
4090
|
+
}
|
|
4091
|
+
divide(data, 1 << j);
|
|
4092
|
+
multiply(data, 1, 1);
|
|
4093
|
+
divide(data, 2);
|
|
4094
|
+
result = dataToString(data);
|
|
4095
|
+
} else {
|
|
4096
|
+
multiply(data, 0, z);
|
|
4097
|
+
multiply(data, 1 << -e, 0);
|
|
4098
|
+
result = dataToString(data) + repeat('0', fractDigits);
|
|
4099
|
+
}
|
|
4100
|
+
}
|
|
4101
|
+
if (fractDigits > 0) {
|
|
4102
|
+
k = result.length;
|
|
4103
|
+
result = sign + (k <= fractDigits
|
|
4104
|
+
? '0.' + repeat('0', fractDigits - k) + result
|
|
4105
|
+
: stringSlice$2(result, 0, k - fractDigits) + '.' + stringSlice$2(result, k - fractDigits));
|
|
4106
|
+
} else {
|
|
4107
|
+
result = sign + result;
|
|
4108
|
+
} return result;
|
|
4109
|
+
}
|
|
4110
|
+
});
|
|
4111
|
+
|
|
4112
|
+
/**
|
|
4113
|
+
* @internal
|
|
4114
|
+
*
|
|
4115
|
+
* # Weight Utilities - isMetricWeightUnit
|
|
4116
|
+
*
|
|
4117
|
+
* - This utility function checks if the weight unit is `metric` and returns a `boolean`
|
|
4118
|
+
* indicating if it is metric or not.
|
|
4119
|
+
*
|
|
4120
|
+
* @param unit The weight unit to check (optional).
|
|
4121
|
+
*
|
|
4122
|
+
* @returns boolean Indicating if the weight unit is `metric`.
|
|
4123
|
+
*
|
|
4124
|
+
* @category Utilities
|
|
4125
|
+
*/
|
|
4126
|
+
const isMetricWeightUnit = unit => !!unit && ["gram", "kilogram"].includes(unit);
|
|
4127
|
+
/**
|
|
4128
|
+
* @internal
|
|
4129
|
+
*
|
|
4130
|
+
* # Weight Utilities - isDecimalWeight
|
|
4131
|
+
*
|
|
4132
|
+
* - This utility function checks if the weight is a `decimal` weight and returns a `boolean`
|
|
4133
|
+
* indicating if it is decimal or not.
|
|
4134
|
+
*
|
|
4135
|
+
* @param weight The weight to `check for a decimal` (optional).
|
|
4136
|
+
*
|
|
4137
|
+
* @returns boolean Indicating if the weight is a decimal weight.
|
|
4138
|
+
*
|
|
4139
|
+
* @category Utilities
|
|
4140
|
+
*/
|
|
4141
|
+
const isDecimalWeight = weight => "value" in weight;
|
|
4142
|
+
/**
|
|
4143
|
+
* @internal
|
|
4144
|
+
*
|
|
4145
|
+
* # Weight Utilities - convertPoundsAndOuncesToOunces
|
|
4146
|
+
*
|
|
4147
|
+
* - This utility function converts `pounds and ounces` to a `total of ounces`.
|
|
4148
|
+
*
|
|
4149
|
+
* @param weight The `pound + ounce` weight to convert to ounces.
|
|
4150
|
+
*
|
|
4151
|
+
* @returns number The total weight in `ounces`.
|
|
4152
|
+
*
|
|
4153
|
+
* @category Utilities
|
|
4154
|
+
*/
|
|
4155
|
+
const convertPoundsAndOuncesToOunces = weight => {
|
|
4156
|
+
var _a, _b;
|
|
4157
|
+
const pounds = (_a = weight.whole) !== null && _a !== void 0 ? _a : 0;
|
|
4158
|
+
const ounces = (_b = weight.fractional) !== null && _b !== void 0 ? _b : 0;
|
|
4159
|
+
return pounds * 16 + ounces;
|
|
4160
|
+
};
|
|
4161
|
+
/**
|
|
4162
|
+
* @internal
|
|
4163
|
+
*
|
|
4164
|
+
* # Weight Utilities - convertFractionalWeightToDecimalWeight
|
|
4165
|
+
*
|
|
4166
|
+
* - This utility function converts a `fractional weight` to a `decimal weight`.
|
|
4167
|
+
*
|
|
4168
|
+
* @param weight The fractional weight to convert to a decimal weight.
|
|
4169
|
+
* @param unit The target weight unit to convert to (optional).
|
|
4170
|
+
*
|
|
4171
|
+
* @returns WeightWithUnit The decimal weight with its unit.
|
|
4172
|
+
*
|
|
4173
|
+
* @category Utilities
|
|
4174
|
+
*/
|
|
4175
|
+
const convertFractionalWeightToDecimalWeight = (weight, unit) => isMetricWeightUnit(unit) ? {
|
|
4176
|
+
unit,
|
|
4177
|
+
value: weight.whole
|
|
4178
|
+
} : {
|
|
4179
|
+
unit: "ounce",
|
|
4180
|
+
value: convertPoundsAndOuncesToOunces(weight)
|
|
4181
|
+
};
|
|
4182
|
+
/**
|
|
4183
|
+
* @internal
|
|
4184
|
+
*
|
|
4185
|
+
* # Weight Utilities - convertDecimalWeightToFractionalWeight
|
|
4186
|
+
*
|
|
4187
|
+
* - This utility function converts a `decimal weight` to a `fractional weight`.
|
|
4188
|
+
*
|
|
4189
|
+
* @param weight The decimal weight to convert to a fractional weight.
|
|
4190
|
+
*
|
|
4191
|
+
* @returns FractionalWeight The converted fractional weight.
|
|
4192
|
+
*
|
|
4193
|
+
* @category Utilities
|
|
4194
|
+
*/
|
|
4195
|
+
const convertDecimalWeightToFractionalWeight = weight => isMetricWeightUnit(weight.unit) ? {
|
|
4196
|
+
fractional: 0,
|
|
4197
|
+
whole: weight.value
|
|
4198
|
+
} : {
|
|
4199
|
+
fractional: weight.value % 16,
|
|
4200
|
+
whole: Math.floor(weight.value / 16)
|
|
4201
|
+
};
|
|
4202
|
+
/**
|
|
4203
|
+
* @internal
|
|
4204
|
+
*
|
|
4205
|
+
* # Weight Utilities - convertWeight/2
|
|
4206
|
+
*/
|
|
4207
|
+
function convertWeight(weight, unit) {
|
|
4208
|
+
return isDecimalWeight(weight) ? convertDecimalWeightToFractionalWeight(weight) : convertFractionalWeightToDecimalWeight(weight, unit);
|
|
3469
4209
|
}
|
|
3470
4210
|
/**
|
|
4211
|
+
* @internal
|
|
4212
|
+
*
|
|
4213
|
+
* # Weight Utilities - formatFractionalWeight
|
|
4214
|
+
*
|
|
4215
|
+
* - This utility function formats a `fractional weight` for ease of use.
|
|
4216
|
+
*
|
|
4217
|
+
* @param weight The fractional weight to be formatted.
|
|
4218
|
+
*
|
|
4219
|
+
* @return FractionalWeight The formatted fractional weight.
|
|
4220
|
+
*
|
|
3471
4221
|
* @category Utilities
|
|
3472
4222
|
*/
|
|
3473
|
-
function formatFractionalWeight(weight) {
|
|
4223
|
+
function formatFractionalWeight(weight, unit) {
|
|
3474
4224
|
if (!weight) return {
|
|
3475
4225
|
fractional: 0,
|
|
3476
4226
|
whole: 0
|
|
3477
4227
|
};
|
|
3478
|
-
|
|
4228
|
+
//allow up to 5 decimal places for metric weights
|
|
4229
|
+
if (isMetricWeightUnit(unit) && weight.whole) {
|
|
4230
|
+
return {
|
|
4231
|
+
fractional: 0,
|
|
4232
|
+
whole: Number(weight.whole.toFixed(5)) || 0
|
|
4233
|
+
};
|
|
4234
|
+
}
|
|
4235
|
+
const valueAsOz = convertPoundsAndOuncesToOunces(weight);
|
|
3479
4236
|
const valueAsLbs = valueAsOz / 16;
|
|
3480
4237
|
return {
|
|
3481
4238
|
fractional: Math.round((valueAsLbs - Math.floor(valueAsLbs)) * 16 * 100) / 100,
|
|
@@ -3484,15 +4241,28 @@ function formatFractionalWeight(weight) {
|
|
|
3484
4241
|
}
|
|
3485
4242
|
|
|
3486
4243
|
/**
|
|
4244
|
+
* @internal
|
|
4245
|
+
*
|
|
4246
|
+
* # Package Utilities - isFlatRatePackageCode
|
|
4247
|
+
*
|
|
3487
4248
|
* @category Utilities
|
|
3488
4249
|
*/
|
|
3489
4250
|
const isFlatRatePackageCode = packageCode => {
|
|
3490
4251
|
return packageCode ? packageCode.includes("flat_rate") : false;
|
|
3491
4252
|
};
|
|
3492
4253
|
|
|
4254
|
+
/**
|
|
4255
|
+
* @internal
|
|
4256
|
+
*
|
|
4257
|
+
* # Capitalize First Letter Utility Function
|
|
4258
|
+
*
|
|
4259
|
+
* - This is a utility function that `capitalizes` the first letter of a given string.
|
|
4260
|
+
*/
|
|
3493
4261
|
const capitalizeFirstLetter = str => str.slice(0, 1).toUpperCase() + str.slice(1);
|
|
3494
4262
|
|
|
3495
4263
|
/**
|
|
4264
|
+
* @internal
|
|
4265
|
+
*
|
|
3496
4266
|
* Creates a Record of Emotion styles; eliminating the need to explicitly type styles
|
|
3497
4267
|
* while remaining fully typesafe w/ autocomplete.
|
|
3498
4268
|
*
|
|
@@ -3512,6 +4282,8 @@ const capitalizeFirstLetter = str => str.slice(0, 1).toUpperCase() + str.slice(1
|
|
|
3512
4282
|
* }),
|
|
3513
4283
|
* });
|
|
3514
4284
|
* ```
|
|
4285
|
+
*
|
|
4286
|
+
* @category Utilities
|
|
3515
4287
|
*/
|
|
3516
4288
|
const createStyles = styles => styles;
|
|
3517
4289
|
|
|
@@ -3522,6 +4294,10 @@ const buildError = (translationKey, error) => {
|
|
|
3522
4294
|
}, meta));
|
|
3523
4295
|
};
|
|
3524
4296
|
/**
|
|
4297
|
+
* @internal
|
|
4298
|
+
*
|
|
4299
|
+
* # Error Map
|
|
4300
|
+
*
|
|
3525
4301
|
* @category Utilities
|
|
3526
4302
|
*/
|
|
3527
4303
|
const errorMap = (issue, ctx) => {
|
|
@@ -3565,6 +4341,10 @@ const errorMap = (issue, ctx) => {
|
|
|
3565
4341
|
};
|
|
3566
4342
|
};
|
|
3567
4343
|
/**
|
|
4344
|
+
* @internal
|
|
4345
|
+
*
|
|
4346
|
+
* # Validation Resolver
|
|
4347
|
+
*
|
|
3568
4348
|
* @category Utilities
|
|
3569
4349
|
*/
|
|
3570
4350
|
const validationResolver = schema => (values, context, resolverOptions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -3575,57 +4355,14 @@ const validationResolver = schema => (values, context, resolverOptions) => __awa
|
|
|
3575
4355
|
return validationResult;
|
|
3576
4356
|
});
|
|
3577
4357
|
|
|
3578
|
-
const featureFlags = {
|
|
3579
|
-
ConfigureSalesOrderShipment: {
|
|
3580
|
-
compatibleCountryCodes: ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"],
|
|
3581
|
-
rateForm: {
|
|
3582
|
-
enableFunding: false,
|
|
3583
|
-
enableGlobalPostFiltering: false,
|
|
3584
|
-
labelLayout: false,
|
|
3585
|
-
nicknameRate: true,
|
|
3586
|
-
saveRate: true
|
|
3587
|
-
},
|
|
3588
|
-
shipmentForm: {
|
|
3589
|
-
browseRates: true,
|
|
3590
|
-
includeShipsuranceInsurance: true,
|
|
3591
|
-
includeThirdPartyInsurance: true,
|
|
3592
|
-
selectService: true,
|
|
3593
|
-
shippingPresets: false
|
|
3594
|
-
}
|
|
3595
|
-
},
|
|
3596
|
-
Global: {
|
|
3597
|
-
carriers: {
|
|
3598
|
-
enabledCarriers: ["stamps_com", "ups", "dhl_express_walleted"]
|
|
3599
|
-
},
|
|
3600
|
-
presentation: {
|
|
3601
|
-
poweredByShipEngine: false
|
|
3602
|
-
}
|
|
3603
|
-
},
|
|
3604
|
-
ViewShipment: {
|
|
3605
|
-
shipment: {
|
|
3606
|
-
schedulePickup: true
|
|
3607
|
-
}
|
|
3608
|
-
}
|
|
3609
|
-
};
|
|
3610
|
-
const featureFlagComponentNameLookup = componentName => {
|
|
3611
|
-
var _a;
|
|
3612
|
-
const lookup = {
|
|
3613
|
-
PurchaseLabel: "ConfigureSalesOrderShipment"
|
|
3614
|
-
};
|
|
3615
|
-
return (_a = lookup[componentName]) !== null && _a !== void 0 ? _a : "";
|
|
3616
|
-
};
|
|
3617
|
-
const getFeatures = (...element) => {
|
|
3618
|
-
return element.map(feat => {
|
|
3619
|
-
var _a;
|
|
3620
|
-
return (_a = _$3.get(featureFlags, feat)) !== null && _a !== void 0 ? _a : {};
|
|
3621
|
-
}).reduce((acc, feat) => Object.assign(acc, feat), {});
|
|
3622
|
-
};
|
|
3623
|
-
const useFeatures = (...element) => {
|
|
3624
|
-
return getFeatures(...element);
|
|
3625
|
-
};
|
|
3626
|
-
|
|
3627
4358
|
/**
|
|
3628
|
-
*
|
|
4359
|
+
* @internal
|
|
4360
|
+
*
|
|
4361
|
+
* # Date Range Options Hook
|
|
4362
|
+
*
|
|
4363
|
+
* A curated list of date range options relative to the immediate date.
|
|
4364
|
+
*
|
|
4365
|
+
* @see {@link DateRangeOption | The `DateRangeOption` type used in this hook}
|
|
3629
4366
|
*/
|
|
3630
4367
|
const useDateRangeOptions = () => {
|
|
3631
4368
|
const {
|
|
@@ -3655,6 +4392,13 @@ const useDateRangeOptions = () => {
|
|
|
3655
4392
|
return [options, optionsByValue];
|
|
3656
4393
|
};
|
|
3657
4394
|
|
|
4395
|
+
/**
|
|
4396
|
+
* @internal
|
|
4397
|
+
*
|
|
4398
|
+
* # Expiration Month Options Hook
|
|
4399
|
+
*
|
|
4400
|
+
* @cateogry Hooks
|
|
4401
|
+
*/
|
|
3658
4402
|
const useExpirationMonthOptions = () => {
|
|
3659
4403
|
const {
|
|
3660
4404
|
t
|
|
@@ -3698,6 +4442,13 @@ const useExpirationMonthOptions = () => {
|
|
|
3698
4442
|
}];
|
|
3699
4443
|
};
|
|
3700
4444
|
|
|
4445
|
+
/**
|
|
4446
|
+
* @internal
|
|
4447
|
+
*
|
|
4448
|
+
* # Insurance Provider Options Hook
|
|
4449
|
+
*
|
|
4450
|
+
* @category Hooks
|
|
4451
|
+
*/
|
|
3701
4452
|
const useInsuranceProviderOptions = (insuranceAccount, features) => {
|
|
3702
4453
|
const {
|
|
3703
4454
|
t
|
|
@@ -3708,6 +4459,13 @@ const useInsuranceProviderOptions = (insuranceAccount, features) => {
|
|
|
3708
4459
|
}), [t, insuranceAccount, features === null || features === void 0 ? void 0 : features.includeThirdPartyInsurance, features === null || features === void 0 ? void 0 : features.includeShipsuranceInsurance]);
|
|
3709
4460
|
};
|
|
3710
4461
|
|
|
4462
|
+
/**
|
|
4463
|
+
* @internal
|
|
4464
|
+
*
|
|
4465
|
+
* # Shipment Metadata Hook
|
|
4466
|
+
*
|
|
4467
|
+
* @category Hooks
|
|
4468
|
+
*/
|
|
3711
4469
|
const useShipmentMetadata = shipment => {
|
|
3712
4470
|
const isInternational = React.useMemo(() => {
|
|
3713
4471
|
return shipment ? getIsInternationalShipment(shipment) : false;
|
|
@@ -3721,13 +4479,22 @@ const useShipmentMetadata = shipment => {
|
|
|
3721
4479
|
var _a;
|
|
3722
4480
|
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";
|
|
3723
4481
|
}, [shipment]);
|
|
3724
|
-
|
|
4482
|
+
const shipmentUnits = React.useMemo(() => {
|
|
4483
|
+
const packageDimensions = shipment === null || shipment === void 0 ? void 0 : shipment.packages[0].dimensions;
|
|
4484
|
+
const packageWeight = shipment === null || shipment === void 0 ? void 0 : shipment.packages[0].weight;
|
|
4485
|
+
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];
|
|
4486
|
+
const hasAllZeroMeasurements = packageMeasurements.every(m => m === 0);
|
|
4487
|
+
return {
|
|
4488
|
+
hasAllZeroMeasurements
|
|
4489
|
+
};
|
|
4490
|
+
}, [shipment]);
|
|
4491
|
+
return Object.assign({
|
|
3725
4492
|
isContentDescriptionRequired,
|
|
3726
4493
|
isCustomsRequired,
|
|
3727
4494
|
isInternational,
|
|
3728
4495
|
isPoBox,
|
|
3729
4496
|
isUnsupportedUpsCountry
|
|
3730
|
-
};
|
|
4497
|
+
}, shipmentUnits);
|
|
3731
4498
|
};
|
|
3732
4499
|
|
|
3733
4500
|
let _$2 = t => t,
|
|
@@ -3737,6 +4504,13 @@ const findGenericPackageFromCarriers = carriers => {
|
|
|
3737
4504
|
const carrier = carriers.find(c => c.packages.some(p => p.packageCode === "package"));
|
|
3738
4505
|
return carrier === null || carrier === void 0 ? void 0 : carrier.packages.find(p => p.packageCode === "package");
|
|
3739
4506
|
};
|
|
4507
|
+
/**
|
|
4508
|
+
* @internal
|
|
4509
|
+
*
|
|
4510
|
+
* # Package Options Hook
|
|
4511
|
+
*
|
|
4512
|
+
* @category Hooks
|
|
4513
|
+
*/
|
|
3740
4514
|
const usePackageOptions = (carriers, customPackageTypes, shipment) => {
|
|
3741
4515
|
const {
|
|
3742
4516
|
t
|
|
@@ -3798,7 +4572,12 @@ const usePackageOptions = (carriers, customPackageTypes, shipment) => {
|
|
|
3798
4572
|
}, [carriers, customPackageTypes, isPoBox, isUnsupportedUpsCountry, t]);
|
|
3799
4573
|
};
|
|
3800
4574
|
|
|
3801
|
-
|
|
4575
|
+
/**
|
|
4576
|
+
* @internal
|
|
4577
|
+
*
|
|
4578
|
+
* # Rate Options Hook
|
|
4579
|
+
*/
|
|
4580
|
+
const useRateOptions = (rates, carriers, shipment, enableGlobalPostFiltering, requireDhlTermsAcknowledgement) => {
|
|
3802
4581
|
const carriersById = React.useMemo(() => createDictionary(carriers, c => ({
|
|
3803
4582
|
[c.carrierId]: c
|
|
3804
4583
|
})), [carriers]);
|
|
@@ -3823,13 +4602,20 @@ const useRateOptions = (rates, carriers, shipment, enableGlobalPostFiltering) =>
|
|
|
3823
4602
|
return Object.assign(Object.assign({}, r), {
|
|
3824
4603
|
balance,
|
|
3825
4604
|
messages: r.warningMessages,
|
|
3826
|
-
requiresAcknowledgement: getRateRequiresAcknowledgement(r.serviceCode, r.packageType),
|
|
4605
|
+
requiresAcknowledgement: getRateRequiresAcknowledgement(r.serviceCode, r.packageType, !!requireDhlTermsAcknowledgement),
|
|
3827
4606
|
requiresFundedAmount
|
|
3828
4607
|
});
|
|
3829
4608
|
});
|
|
3830
|
-
}, [carriersById, enableGlobalPostFiltering, isInternational, isPoBox, isUnsupportedUpsCountry, rates]);
|
|
4609
|
+
}, [carriersById, enableGlobalPostFiltering, isInternational, isPoBox, isUnsupportedUpsCountry, rates, requireDhlTermsAcknowledgement]);
|
|
3831
4610
|
};
|
|
3832
4611
|
|
|
4612
|
+
/**
|
|
4613
|
+
* @internal
|
|
4614
|
+
*
|
|
4615
|
+
* # Service Code Options Hook
|
|
4616
|
+
*
|
|
4617
|
+
* @category Hooks
|
|
4618
|
+
*/
|
|
3833
4619
|
const useServiceCodeOptions = (carriers, shipment) => {
|
|
3834
4620
|
const {
|
|
3835
4621
|
isInternational,
|
|
@@ -3894,34 +4680,39 @@ const getWarningStyles = theme => /*#__PURE__*/react.css({
|
|
|
3894
4680
|
width: theme.spacing()
|
|
3895
4681
|
}, process.env.NODE_ENV === "production" ? "" : ";label:getWarningStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInByZXNldC1kZXNjcmlwdG9yLnN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFxQjJDIiwiZmlsZSI6InByZXNldC1kZXNjcmlwdG9yLnN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdFwiO1xyXG5leHBvcnQgY29uc3QgZ2V0Q29udGFpbmVyU3R5bGVzID0gKHRoZW1lKSA9PiBjc3Moe1xyXG4gICAgZGlzcGxheTogXCJmbGV4XCIsXHJcbiAgICBmbGV4RGlyZWN0aW9uOiBcImNvbHVtblwiLFxyXG4gICAgaGVpZ2h0OiBcIjEwMCVcIixcclxuICAgIHBhZGRpbmdUb3A6IHRoZW1lLnNwYWNpbmcoMC41KSxcclxuICAgIHdpZHRoOiBcIm1heC1jb250ZW50XCIsXHJcbn0pO1xyXG5leHBvcnQgY29uc3QgZ2V0RGltZW5zaW9uU3R5bGVzID0gKHRoZW1lKSA9PiBjc3Moe1xyXG4gICAgY29sb3I6IHRoZW1lLnBhbGV0dGUuZ3JheS5tYWluLFxyXG4gICAgZm9udFNpemU6IHRoZW1lLnR5cG9ncmFwaHkuZm9udFNpemUuWFMsXHJcbn0pO1xyXG5leHBvcnQgY29uc3QgZ2V0U2VydmljZU5hbWVTdHlsZXMgPSAodGhlbWUpID0+IGNzcyh7XHJcbiAgICBmb250U2l6ZTogdGhlbWUudHlwb2dyYXBoeS5mb250U2l6ZS5YWFMsXHJcbiAgICBsaW5lSGVpZ2h0OiAwLFxyXG4gICAgcGFkZGluZ1RvcDogdGhlbWUuc3BhY2luZygpLFxyXG59KTtcclxuZXhwb3J0IGNvbnN0IGdldFByZXNldE5hbWVTdHlsZXMgPSAodGhlbWUpID0+IGNzcyh7XHJcbiAgICBmb250U2l6ZTogdGhlbWUudHlwb2dyYXBoeS5mb250U2l6ZS5YUyxcclxuICAgIGZvbnRXZWlnaHQ6IHRoZW1lLnR5cG9ncmFwaHkuZm9udFdlaWdodC5ib2xkLFxyXG59KTtcclxuZXhwb3J0IGNvbnN0IGdldFdhcm5pbmdTdHlsZXMgPSAodGhlbWUpID0+IGNzcyh7XHJcbiAgICBiYWNrZ3JvdW5kOiBcIm5vbmVcIixcclxuICAgIG1hcmdpbkxlZnQ6IFwiYXV0b1wiLFxyXG4gICAgbWFyZ2luUmlnaHQ6IHRoZW1lLnNwYWNpbmcoLTMpLFxyXG4gICAgbWFyZ2luVG9wOiB0aGVtZS5zcGFjaW5nKC01KSxcclxuICAgIHdpZHRoOiB0aGVtZS5zcGFjaW5nKCksXHJcbn0pO1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1wcmVzZXQtZGVzY3JpcHRvci5zdHlsZXMuanMubWFwIl19 */");
|
|
3896
4682
|
|
|
3897
|
-
const PresetDescriptor = preset =>
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
4683
|
+
const PresetDescriptor = preset => {
|
|
4684
|
+
const {
|
|
4685
|
+
t
|
|
4686
|
+
} = reactI18next.useTranslation();
|
|
4687
|
+
return jsxRuntime.jsx("div", Object.assign({
|
|
4688
|
+
css: getContainerStyles
|
|
4689
|
+
}, {
|
|
4690
|
+
children: jsxRuntime.jsxs("div", {
|
|
4691
|
+
children: [jsxRuntime.jsxs("div", {
|
|
4692
|
+
children: [jsxRuntime.jsx("span", Object.assign({
|
|
4693
|
+
css: getPresetNameStyles
|
|
4694
|
+
}, {
|
|
4695
|
+
children: preset.name
|
|
4696
|
+
})), jsxRuntime.jsx("span", Object.assign({
|
|
4697
|
+
css: getDimensionStyles
|
|
4698
|
+
}, {
|
|
4699
|
+
children: (preset.dimensions || preset.weight) && " - "
|
|
4700
|
+
})), preset.dimensions && jsxRuntime.jsx("span", Object.assign({
|
|
4701
|
+
css: getDimensionStyles
|
|
4702
|
+
}, {
|
|
4703
|
+
children: `${formatDimensions(preset.dimensions)} ` + t(`units.${preset.dimensions.unit}`)
|
|
4704
|
+
}))]
|
|
4705
|
+
}), jsxRuntime.jsx("div", Object.assign({
|
|
4706
|
+
css: getServiceNameStyles
|
|
3912
4707
|
}, {
|
|
3913
|
-
children:
|
|
3914
|
-
}))]
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
type: giger.NotificationType.ALERT
|
|
3922
|
-
})]
|
|
3923
|
-
})
|
|
3924
|
-
}));
|
|
4708
|
+
children: preset.serviceName && preset.serviceName
|
|
4709
|
+
})), preset.serviceName && ["USPS Parcel Select Ground", "USPS First Class Mail"].includes(preset.serviceName) && jsxRuntime.jsx(giger.InlineNotification, {
|
|
4710
|
+
css: getWarningStyles,
|
|
4711
|
+
type: giger.NotificationType.ALERT
|
|
4712
|
+
})]
|
|
4713
|
+
})
|
|
4714
|
+
}));
|
|
4715
|
+
};
|
|
3925
4716
|
|
|
3926
4717
|
const createCategoryFromShippingPresets = (categoryName, presets) => presets ? [{
|
|
3927
4718
|
categoryName: categoryName,
|
|
@@ -3931,6 +4722,11 @@ const createCategoryFromShippingPresets = (categoryName, presets) => presets ? [
|
|
|
3931
4722
|
value: p
|
|
3932
4723
|
}))
|
|
3933
4724
|
}] : [];
|
|
4725
|
+
/**
|
|
4726
|
+
* @internal
|
|
4727
|
+
*
|
|
4728
|
+
* # Shipping Preset Options Component
|
|
4729
|
+
*/
|
|
3934
4730
|
const useShippingPresetsOptions = ({
|
|
3935
4731
|
platform,
|
|
3936
4732
|
user
|
|
@@ -3946,11 +4742,25 @@ const useShippingPresetsOptions = ({
|
|
|
3946
4742
|
...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]);
|
|
3947
4743
|
};
|
|
3948
4744
|
|
|
4745
|
+
/**
|
|
4746
|
+
* @internal
|
|
4747
|
+
*
|
|
4748
|
+
* # State Code Options Hook
|
|
4749
|
+
*
|
|
4750
|
+
* @category Hooks
|
|
4751
|
+
*/
|
|
3949
4752
|
const useStateCodeOptions = domestic => React.useMemo(() => usStates.flatMap(v => !domestic || !v.isMilitary && !v.isUnitedStatesTerritory ? {
|
|
3950
4753
|
label: v.name,
|
|
3951
4754
|
value: v.code
|
|
3952
4755
|
} : []), [domestic]);
|
|
3953
4756
|
|
|
4757
|
+
/**
|
|
4758
|
+
* @internal
|
|
4759
|
+
*
|
|
4760
|
+
* # Warehouse Options Hook
|
|
4761
|
+
*
|
|
4762
|
+
* @category Hooks
|
|
4763
|
+
*/
|
|
3954
4764
|
const useWarehouseOptions = warehouses => React.useMemo(() => {
|
|
3955
4765
|
if (!warehouses) return undefined;
|
|
3956
4766
|
return warehouses.map(warehouse => ({
|
|
@@ -4072,6 +4882,13 @@ var _carrierMetadata = [
|
|
|
4072
4882
|
}
|
|
4073
4883
|
];
|
|
4074
4884
|
|
|
4885
|
+
/**
|
|
4886
|
+
* @internal
|
|
4887
|
+
*
|
|
4888
|
+
* # Carrier Metadata Hook
|
|
4889
|
+
*
|
|
4890
|
+
* @category Hooks
|
|
4891
|
+
*/
|
|
4075
4892
|
const useCarrierMetadata = carrierCodes => {
|
|
4076
4893
|
const carrierMetadatas = _carrierMetadata;
|
|
4077
4894
|
return carrierCodes ? carrierCodes.flatMap(code => {
|
|
@@ -4081,7 +4898,11 @@ const useCarrierMetadata = carrierCodes => {
|
|
|
4081
4898
|
};
|
|
4082
4899
|
|
|
4083
4900
|
/**
|
|
4084
|
-
*
|
|
4901
|
+
* @internal
|
|
4902
|
+
*
|
|
4903
|
+
* # Portal
|
|
4904
|
+
*
|
|
4905
|
+
* - A no-frills wrapper around React.createPortal for more elegant DOM composition
|
|
4085
4906
|
*
|
|
4086
4907
|
* @category Components
|
|
4087
4908
|
*
|
|
@@ -4101,11 +4922,15 @@ const Portal = ({
|
|
|
4101
4922
|
const RootPortalContext = /*#__PURE__*/React.createContext(undefined);
|
|
4102
4923
|
RootPortalContext.displayName = "RootPortalContext";
|
|
4103
4924
|
/**
|
|
4925
|
+
* @internal
|
|
4926
|
+
*
|
|
4927
|
+
* # Root Portal Provider
|
|
4928
|
+
*
|
|
4104
4929
|
* Provides access to a top-level 'root-portal' DOM node, adjacent the app 'root' div
|
|
4105
4930
|
*
|
|
4106
4931
|
* @category Providers
|
|
4107
4932
|
*
|
|
4108
|
-
* @see {@link
|
|
4933
|
+
* @see {@link useRootPortal | The associated `hook` for this provider}
|
|
4109
4934
|
*/
|
|
4110
4935
|
const RootPortalProvider = ({
|
|
4111
4936
|
children
|
|
@@ -4126,9 +4951,18 @@ const RootPortalProvider = ({
|
|
|
4126
4951
|
}));
|
|
4127
4952
|
};
|
|
4128
4953
|
/**
|
|
4129
|
-
*
|
|
4954
|
+
* @internal
|
|
4955
|
+
*
|
|
4956
|
+
* # Root Portal Provider Hook
|
|
4957
|
+
*
|
|
4958
|
+
* The `useRootPortal` hook provides access to a top-level 'root-portal' DOM node, adjacent
|
|
4959
|
+
* the app 'root' div.
|
|
4960
|
+
*
|
|
4961
|
+
* - Must be used within {@link RootPortalProvider | a `<RootPortalProvider />`}
|
|
4130
4962
|
*
|
|
4131
4963
|
* @category Elements Hooks
|
|
4964
|
+
*
|
|
4965
|
+
* @see {@link RootPortalProvider | The associated `provider` for this hook}
|
|
4132
4966
|
*/
|
|
4133
4967
|
const useRootPortal = () => {
|
|
4134
4968
|
const rootPortal = React.useContext(RootPortalContext);
|
|
@@ -4139,6 +4973,10 @@ const useRootPortal = () => {
|
|
|
4139
4973
|
};
|
|
4140
4974
|
|
|
4141
4975
|
/**
|
|
4976
|
+
* @internal
|
|
4977
|
+
*
|
|
4978
|
+
* # Nested Form Hook Component
|
|
4979
|
+
*
|
|
4142
4980
|
* Returns a nested form element that can be rendered within another form
|
|
4143
4981
|
*
|
|
4144
4982
|
* Handles closing the form on cancel or submission
|
|
@@ -4188,6 +5026,13 @@ const useNestedForm = (form, props) => {
|
|
|
4188
5026
|
|
|
4189
5027
|
const PageLayoutContext = /*#__PURE__*/React.createContext(undefined);
|
|
4190
5028
|
PageLayoutContext.displayName = "PageLayoutContext";
|
|
5029
|
+
/**
|
|
5030
|
+
* @internal
|
|
5031
|
+
*
|
|
5032
|
+
* # Page Layout Component
|
|
5033
|
+
*
|
|
5034
|
+
* @see {@link PageLayoutProviderProps | The props passed into the `<PageLayoutProvider />` component}
|
|
5035
|
+
*/
|
|
4191
5036
|
const PageLayoutProvider = ({
|
|
4192
5037
|
children
|
|
4193
5038
|
}) => {
|
|
@@ -4238,6 +5083,13 @@ const PageLayoutProvider = ({
|
|
|
4238
5083
|
}))
|
|
4239
5084
|
}));
|
|
4240
5085
|
};
|
|
5086
|
+
/**
|
|
5087
|
+
* @internal
|
|
5088
|
+
*
|
|
5089
|
+
* # Page Layout Hook
|
|
5090
|
+
*
|
|
5091
|
+
* @category Hooks
|
|
5092
|
+
*/
|
|
4241
5093
|
const usePageLayout = () => {
|
|
4242
5094
|
const layoutPortals = React.useContext(PageLayoutContext);
|
|
4243
5095
|
if (!layoutPortals) {
|
|
@@ -4247,7 +5099,11 @@ const usePageLayout = () => {
|
|
|
4247
5099
|
};
|
|
4248
5100
|
|
|
4249
5101
|
/**
|
|
4250
|
-
*
|
|
5102
|
+
* @internal
|
|
5103
|
+
*
|
|
5104
|
+
* # Run Once On True Hook
|
|
5105
|
+
*
|
|
5106
|
+
* - Runs a callback once and only once when a condition is true.
|
|
4251
5107
|
*
|
|
4252
5108
|
* @param conditionalEffect A logical expression ending with a callback
|
|
4253
5109
|
* @example useRunOnceOnTrue(testValue && anotherTestValue && (() => console.log("Hello world!")));
|
|
@@ -4263,7 +5119,11 @@ const useRunOnceOnTrue = conditionalEffect => {
|
|
|
4263
5119
|
};
|
|
4264
5120
|
|
|
4265
5121
|
/**
|
|
4266
|
-
*
|
|
5122
|
+
* @internal
|
|
5123
|
+
*
|
|
5124
|
+
* # Toggle Hook
|
|
5125
|
+
*
|
|
5126
|
+
* - Create a boolean that can be toggled or set to a specific value
|
|
4267
5127
|
*
|
|
4268
5128
|
* @example
|
|
4269
5129
|
* ```tsx
|
|
@@ -4407,13 +5267,13 @@ var iterate$3 = function (iterable, unboundFunction, options) {
|
|
|
4407
5267
|
} return new Result(false);
|
|
4408
5268
|
};
|
|
4409
5269
|
|
|
4410
|
-
var $$
|
|
5270
|
+
var $$a = _export;
|
|
4411
5271
|
var iterate$2 = iterate$3;
|
|
4412
5272
|
var createProperty = createProperty$2;
|
|
4413
5273
|
|
|
4414
5274
|
// `Object.fromEntries` method
|
|
4415
5275
|
// https://github.com/tc39/proposal-object-from-entries
|
|
4416
|
-
$$
|
|
5276
|
+
$$a({ target: 'Object', stat: true }, {
|
|
4417
5277
|
fromEntries: function fromEntries(iterable) {
|
|
4418
5278
|
var obj = {};
|
|
4419
5279
|
iterate$2(iterable, function (k, v) {
|
|
@@ -4423,6 +5283,13 @@ $$b({ target: 'Object', stat: true }, {
|
|
|
4423
5283
|
}
|
|
4424
5284
|
});
|
|
4425
5285
|
|
|
5286
|
+
/**
|
|
5287
|
+
* @internal
|
|
5288
|
+
*
|
|
5289
|
+
* # Address Validation Hook
|
|
5290
|
+
*
|
|
5291
|
+
* @cateogry Hooks
|
|
5292
|
+
*/
|
|
4426
5293
|
const useAddressValidation = () => {
|
|
4427
5294
|
const [validationPreference, setValidationPreference] = React.useState();
|
|
4428
5295
|
const {
|
|
@@ -4510,7 +5377,9 @@ const useAddressValidation = () => {
|
|
|
4510
5377
|
* There is a chance that more than one script will be mounted if this hook is used elsewhere.
|
|
4511
5378
|
*/
|
|
4512
5379
|
/**
|
|
4513
|
-
*
|
|
5380
|
+
* @internal
|
|
5381
|
+
*
|
|
5382
|
+
* - Creates an encoded device fingerprint string - aka black box - containing information about the end-user's computing device such as OS, browser, etc.
|
|
4514
5383
|
* https://developer.bazaarvoice.com/conversations-api/deprecations/iovation-web#snare_js_only
|
|
4515
5384
|
*/
|
|
4516
5385
|
const useBlackboxDetection = ({
|
|
@@ -4564,6 +5433,114 @@ const useBlackboxDetection = ({
|
|
|
4564
5433
|
}, [onSuccess, onError]);
|
|
4565
5434
|
};
|
|
4566
5435
|
|
|
5436
|
+
var call$6 = functionCall;
|
|
5437
|
+
var hasOwn$2 = hasOwnProperty_1;
|
|
5438
|
+
var isPrototypeOf$2 = objectIsPrototypeOf;
|
|
5439
|
+
var regExpFlags = regexpFlags$1;
|
|
5440
|
+
|
|
5441
|
+
var RegExpPrototype$1 = RegExp.prototype;
|
|
5442
|
+
|
|
5443
|
+
var regexpGetFlags = function (R) {
|
|
5444
|
+
var flags = R.flags;
|
|
5445
|
+
return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn$2(R, 'flags') && isPrototypeOf$2(RegExpPrototype$1, R)
|
|
5446
|
+
? call$6(regExpFlags, R) : flags;
|
|
5447
|
+
};
|
|
5448
|
+
|
|
5449
|
+
var $$9 = _export;
|
|
5450
|
+
var call$5 = functionCall;
|
|
5451
|
+
var uncurryThis$4 = functionUncurryThis;
|
|
5452
|
+
var requireObjectCoercible$1 = requireObjectCoercible$9;
|
|
5453
|
+
var isCallable$5 = isCallable$o;
|
|
5454
|
+
var isNullOrUndefined$2 = isNullOrUndefined$7;
|
|
5455
|
+
var isRegExp = isRegexp;
|
|
5456
|
+
var toString$4 = toString$c;
|
|
5457
|
+
var getMethod$1 = getMethod$6;
|
|
5458
|
+
var getRegExpFlags$1 = regexpGetFlags;
|
|
5459
|
+
var getSubstitution = getSubstitution$2;
|
|
5460
|
+
var wellKnownSymbol$4 = wellKnownSymbol$k;
|
|
5461
|
+
|
|
5462
|
+
var REPLACE = wellKnownSymbol$4('replace');
|
|
5463
|
+
var $TypeError$4 = TypeError;
|
|
5464
|
+
var indexOf = uncurryThis$4(''.indexOf);
|
|
5465
|
+
uncurryThis$4(''.replace);
|
|
5466
|
+
var stringSlice$1 = uncurryThis$4(''.slice);
|
|
5467
|
+
var max = Math.max;
|
|
5468
|
+
|
|
5469
|
+
var stringIndexOf = function (string, searchValue, fromIndex) {
|
|
5470
|
+
if (fromIndex > string.length) return -1;
|
|
5471
|
+
if (searchValue === '') return fromIndex;
|
|
5472
|
+
return indexOf(string, searchValue, fromIndex);
|
|
5473
|
+
};
|
|
5474
|
+
|
|
5475
|
+
// `String.prototype.replaceAll` method
|
|
5476
|
+
// https://tc39.es/ecma262/#sec-string.prototype.replaceall
|
|
5477
|
+
$$9({ target: 'String', proto: true }, {
|
|
5478
|
+
replaceAll: function replaceAll(searchValue, replaceValue) {
|
|
5479
|
+
var O = requireObjectCoercible$1(this);
|
|
5480
|
+
var IS_REG_EXP, flags, replacer, string, searchString, functionalReplace, searchLength, advanceBy, replacement;
|
|
5481
|
+
var position = 0;
|
|
5482
|
+
var endOfLastMatch = 0;
|
|
5483
|
+
var result = '';
|
|
5484
|
+
if (!isNullOrUndefined$2(searchValue)) {
|
|
5485
|
+
IS_REG_EXP = isRegExp(searchValue);
|
|
5486
|
+
if (IS_REG_EXP) {
|
|
5487
|
+
flags = toString$4(requireObjectCoercible$1(getRegExpFlags$1(searchValue)));
|
|
5488
|
+
if (!~indexOf(flags, 'g')) throw $TypeError$4('`.replaceAll` does not allow non-global regexes');
|
|
5489
|
+
}
|
|
5490
|
+
replacer = getMethod$1(searchValue, REPLACE);
|
|
5491
|
+
if (replacer) {
|
|
5492
|
+
return call$5(replacer, searchValue, O, replaceValue);
|
|
5493
|
+
}
|
|
5494
|
+
}
|
|
5495
|
+
string = toString$4(O);
|
|
5496
|
+
searchString = toString$4(searchValue);
|
|
5497
|
+
functionalReplace = isCallable$5(replaceValue);
|
|
5498
|
+
if (!functionalReplace) replaceValue = toString$4(replaceValue);
|
|
5499
|
+
searchLength = searchString.length;
|
|
5500
|
+
advanceBy = max(1, searchLength);
|
|
5501
|
+
position = stringIndexOf(string, searchString, 0);
|
|
5502
|
+
while (position !== -1) {
|
|
5503
|
+
replacement = functionalReplace
|
|
5504
|
+
? toString$4(replaceValue(searchString, position, string))
|
|
5505
|
+
: getSubstitution(searchString, string, position, [], undefined, replaceValue);
|
|
5506
|
+
result += stringSlice$1(string, endOfLastMatch, position) + replacement;
|
|
5507
|
+
endOfLastMatch = position + searchLength;
|
|
5508
|
+
position = stringIndexOf(string, searchString, position + advanceBy);
|
|
5509
|
+
}
|
|
5510
|
+
if (endOfLastMatch < string.length) {
|
|
5511
|
+
result += stringSlice$1(string, endOfLastMatch);
|
|
5512
|
+
}
|
|
5513
|
+
return result;
|
|
5514
|
+
}
|
|
5515
|
+
});
|
|
5516
|
+
|
|
5517
|
+
/**
|
|
5518
|
+
* @internal
|
|
5519
|
+
*
|
|
5520
|
+
* # Scrub Errors Hook
|
|
5521
|
+
*
|
|
5522
|
+
* Generic error pretty printer
|
|
5523
|
+
*
|
|
5524
|
+
* @category Hooks
|
|
5525
|
+
*/
|
|
5526
|
+
const useScrubErrors = ({
|
|
5527
|
+
scrubber,
|
|
5528
|
+
errors,
|
|
5529
|
+
predicate
|
|
5530
|
+
}) => {
|
|
5531
|
+
const {
|
|
5532
|
+
t
|
|
5533
|
+
} = reactI18next.useTranslation();
|
|
5534
|
+
return React.useMemo(() => errors === null || errors === void 0 ? void 0 : errors.map(e => {
|
|
5535
|
+
return t(jsBase64.encode(e.message), {
|
|
5536
|
+
defaultValue: !predicate || predicate(e) ? t(scrubber(e)) : networkErrorPrettyPrinter(e)
|
|
5537
|
+
});
|
|
5538
|
+
}), [errors, predicate, scrubber, t]);
|
|
5539
|
+
};
|
|
5540
|
+
const networkErrorPrettyPrinter = e => {
|
|
5541
|
+
return e.message.replaceAll(/Invalid rate\. Invalid rate\./g, "Invalid rate.");
|
|
5542
|
+
};
|
|
5543
|
+
|
|
4567
5544
|
const useListConnectedCarriers = () => {
|
|
4568
5545
|
const {
|
|
4569
5546
|
data: carriers,
|
|
@@ -4584,6 +5561,29 @@ const useListConnectedCarriers = () => {
|
|
|
4584
5561
|
};
|
|
4585
5562
|
};
|
|
4586
5563
|
|
|
5564
|
+
/**
|
|
5565
|
+
* # List-Carriers Component
|
|
5566
|
+
*
|
|
5567
|
+
* @param ComponentProps The base props that will be passed into the `<List-Carriers />` component.
|
|
5568
|
+
*
|
|
5569
|
+
* @returns Element A React element that renders the `<List-Carriers />` component allowing users
|
|
5570
|
+
* to view a list of carriers that are connected to their ShipEngine account. This component is
|
|
5571
|
+
* composed in the `<AccountSettings />` Element.
|
|
5572
|
+
*
|
|
5573
|
+
* @example
|
|
5574
|
+
* ```tsx
|
|
5575
|
+
* (() => {
|
|
5576
|
+
* const features = useFeatures("Global");
|
|
5577
|
+
*
|
|
5578
|
+
* return <ListCarriers.Component features={features} />;
|
|
5579
|
+
* })();
|
|
5580
|
+
* ```
|
|
5581
|
+
*
|
|
5582
|
+
* <br />
|
|
5583
|
+
*
|
|
5584
|
+
* @see {@link ListCarriers.ComponentProps | The props that are passed into the `<List-Carriers />` component}
|
|
5585
|
+
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<List-Carriers />` component}
|
|
5586
|
+
*/
|
|
4587
5587
|
const Component$6 = ({
|
|
4588
5588
|
features
|
|
4589
5589
|
}) => {
|
|
@@ -4628,6 +5628,29 @@ var listCarriers$1 = /*#__PURE__*/Object.freeze({
|
|
|
4628
5628
|
Component: Component$6
|
|
4629
5629
|
});
|
|
4630
5630
|
|
|
5631
|
+
/**
|
|
5632
|
+
* # Manage Warehouses Component
|
|
5633
|
+
*
|
|
5634
|
+
* - The `<ManageWarehouses />` component is used to manage warehouses on a user's ShipEngine account. Users can add, update, or make warehouses inactive.
|
|
5635
|
+
* `<AccountSettings />` Element.
|
|
5636
|
+
*
|
|
5637
|
+
* @param ComponentProps The base props that will be passed into the `<ManageWarehouses />` component.
|
|
5638
|
+
*
|
|
5639
|
+
* @returns Element A React element that renders the `<ManageWarehouses />` component allowing users
|
|
5640
|
+
* to manage warehouses on their ShipEngine account.
|
|
5641
|
+
*
|
|
5642
|
+
* @example
|
|
5643
|
+
* ```tsx
|
|
5644
|
+
* export const ManageWarehousesExample = () => {
|
|
5645
|
+
* return <ManageWarehouses.Component />;
|
|
5646
|
+
* };
|
|
5647
|
+
* ```
|
|
5648
|
+
*
|
|
5649
|
+
* <br />
|
|
5650
|
+
*
|
|
5651
|
+
* @see {@link ManageWarehouses.ComponentProps | The props that are passed into the `<ManageWarehouses />` component}
|
|
5652
|
+
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<ManageWarehouses />` component}
|
|
5653
|
+
*/
|
|
4631
5654
|
const Component$5 = ({
|
|
4632
5655
|
onWarehouseAddressValidation
|
|
4633
5656
|
}) => {
|
|
@@ -4661,211 +5684,57 @@ const Component$5 = ({
|
|
|
4661
5684
|
});
|
|
4662
5685
|
void refreshListWarehouses();
|
|
4663
5686
|
});
|
|
4664
|
-
const handleSubmitAddNewWarehouse = payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
4665
|
-
const result = yield createWarehouse(payload);
|
|
4666
|
-
if (result) void refreshListWarehouses();
|
|
4667
|
-
});
|
|
4668
|
-
const handleSubmitEditWarehouse = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4669
|
-
yield updateWarehouse({
|
|
4670
|
-
isDefault: payload.isDefault,
|
|
4671
|
-
name: payload.name,
|
|
4672
|
-
originAddress: payload.originAddress,
|
|
4673
|
-
returnAddress: payload.returnAddress,
|
|
4674
|
-
warehouseId: warehouseId
|
|
4675
|
-
});
|
|
4676
|
-
yield refreshListWarehouses();
|
|
4677
|
-
});
|
|
4678
|
-
const handleSetDefault = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4679
|
-
yield updateWarehouse(Object.assign(Object.assign({}, payload), {
|
|
4680
|
-
isDefault: true,
|
|
4681
|
-
warehouseId
|
|
4682
|
-
}));
|
|
4683
|
-
yield refreshListWarehouses();
|
|
4684
|
-
});
|
|
4685
|
-
if (listWarehouseErrors) {
|
|
4686
|
-
throw new Error(listWarehouseErrors.map(e => e.message).join(", "));
|
|
4687
|
-
}
|
|
4688
|
-
const sortedWarehouses = warehouses === null || warehouses === void 0 ? void 0 : warehouses.sort((a, b) => {
|
|
4689
|
-
if (b.isDefault && !a.isDefault) return 1;
|
|
4690
|
-
if (a.isDefault && !b.isDefault) return -1;
|
|
4691
|
-
return sortByCreationDate(a, b, "desc");
|
|
4692
|
-
});
|
|
4693
|
-
const errors = [...(updateWarehouseErrors !== null && updateWarehouseErrors !== void 0 ? updateWarehouseErrors : []), ...(createWarehouseErrors !== null && createWarehouseErrors !== void 0 ? createWarehouseErrors : []), ...(deleteWarehouseErrors !== null && deleteWarehouseErrors !== void 0 ? deleteWarehouseErrors : [])];
|
|
4694
|
-
return jsxRuntime.jsx(CollapsiblePanel, Object.assign({
|
|
4695
|
-
errors: errors,
|
|
4696
|
-
isSaving: creatingWarehouse || deletingWarehouse || updatingWarehouse,
|
|
4697
|
-
title: t("account-settings:sections.warehouses")
|
|
4698
|
-
}, {
|
|
4699
|
-
children: isLoadingWarehouses ? jsxRuntime.jsx(Loader, {
|
|
4700
|
-
message: t("loading.warehouses")
|
|
4701
|
-
}) : jsxRuntime.jsx(ManageWarehouses, {
|
|
4702
|
-
errors: errors,
|
|
4703
|
-
onAdd: handleSubmitAddNewWarehouse,
|
|
4704
|
-
onDelete: handleDeleteWarehouse,
|
|
4705
|
-
onEdit: handleSubmitEditWarehouse,
|
|
4706
|
-
onSetDefault: handleSetDefault,
|
|
4707
|
-
warehouses: sortedWarehouses || []
|
|
4708
|
-
})
|
|
4709
|
-
}));
|
|
4710
|
-
};
|
|
4711
|
-
|
|
4712
|
-
var manageWarehouses$1 = /*#__PURE__*/Object.freeze({
|
|
4713
|
-
__proto__: null,
|
|
4714
|
-
Component: Component$5
|
|
4715
|
-
});
|
|
4716
|
-
|
|
4717
|
-
var uncurryThis$6 = functionUncurryThis;
|
|
4718
|
-
|
|
4719
|
-
// `thisNumberValue` abstract operation
|
|
4720
|
-
// https://tc39.es/ecma262/#sec-thisnumbervalue
|
|
4721
|
-
var thisNumberValue$1 = uncurryThis$6(1.0.valueOf);
|
|
4722
|
-
|
|
4723
|
-
var toIntegerOrInfinity$1 = toIntegerOrInfinity$6;
|
|
4724
|
-
var toString$5 = toString$c;
|
|
4725
|
-
var requireObjectCoercible$2 = requireObjectCoercible$9;
|
|
4726
|
-
|
|
4727
|
-
var $RangeError$1 = RangeError;
|
|
4728
|
-
|
|
4729
|
-
// `String.prototype.repeat` method implementation
|
|
4730
|
-
// https://tc39.es/ecma262/#sec-string.prototype.repeat
|
|
4731
|
-
var stringRepeat = function repeat(count) {
|
|
4732
|
-
var str = toString$5(requireObjectCoercible$2(this));
|
|
4733
|
-
var result = '';
|
|
4734
|
-
var n = toIntegerOrInfinity$1(count);
|
|
4735
|
-
if (n < 0 || n == Infinity) throw $RangeError$1('Wrong number of repetitions');
|
|
4736
|
-
for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;
|
|
4737
|
-
return result;
|
|
4738
|
-
};
|
|
4739
|
-
|
|
4740
|
-
var $$a = _export;
|
|
4741
|
-
var uncurryThis$5 = functionUncurryThis;
|
|
4742
|
-
var toIntegerOrInfinity = toIntegerOrInfinity$6;
|
|
4743
|
-
var thisNumberValue = thisNumberValue$1;
|
|
4744
|
-
var $repeat = stringRepeat;
|
|
4745
|
-
var fails$4 = fails$q;
|
|
4746
|
-
|
|
4747
|
-
var $RangeError = RangeError;
|
|
4748
|
-
var $String = String;
|
|
4749
|
-
var floor = Math.floor;
|
|
4750
|
-
var repeat = uncurryThis$5($repeat);
|
|
4751
|
-
var stringSlice$2 = uncurryThis$5(''.slice);
|
|
4752
|
-
var nativeToFixed = uncurryThis$5(1.0.toFixed);
|
|
4753
|
-
|
|
4754
|
-
var pow = function (x, n, acc) {
|
|
4755
|
-
return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
|
|
4756
|
-
};
|
|
4757
|
-
|
|
4758
|
-
var log = function (x) {
|
|
4759
|
-
var n = 0;
|
|
4760
|
-
var x2 = x;
|
|
4761
|
-
while (x2 >= 4096) {
|
|
4762
|
-
n += 12;
|
|
4763
|
-
x2 /= 4096;
|
|
4764
|
-
}
|
|
4765
|
-
while (x2 >= 2) {
|
|
4766
|
-
n += 1;
|
|
4767
|
-
x2 /= 2;
|
|
4768
|
-
} return n;
|
|
4769
|
-
};
|
|
4770
|
-
|
|
4771
|
-
var multiply = function (data, n, c) {
|
|
4772
|
-
var index = -1;
|
|
4773
|
-
var c2 = c;
|
|
4774
|
-
while (++index < 6) {
|
|
4775
|
-
c2 += n * data[index];
|
|
4776
|
-
data[index] = c2 % 1e7;
|
|
4777
|
-
c2 = floor(c2 / 1e7);
|
|
4778
|
-
}
|
|
4779
|
-
};
|
|
4780
|
-
|
|
4781
|
-
var divide = function (data, n) {
|
|
4782
|
-
var index = 6;
|
|
4783
|
-
var c = 0;
|
|
4784
|
-
while (--index >= 0) {
|
|
4785
|
-
c += data[index];
|
|
4786
|
-
data[index] = floor(c / n);
|
|
4787
|
-
c = (c % n) * 1e7;
|
|
4788
|
-
}
|
|
4789
|
-
};
|
|
4790
|
-
|
|
4791
|
-
var dataToString = function (data) {
|
|
4792
|
-
var index = 6;
|
|
4793
|
-
var s = '';
|
|
4794
|
-
while (--index >= 0) {
|
|
4795
|
-
if (s !== '' || index === 0 || data[index] !== 0) {
|
|
4796
|
-
var t = $String(data[index]);
|
|
4797
|
-
s = s === '' ? t : s + repeat('0', 7 - t.length) + t;
|
|
4798
|
-
}
|
|
4799
|
-
} return s;
|
|
4800
|
-
};
|
|
4801
|
-
|
|
4802
|
-
var FORCED$2 = fails$4(function () {
|
|
4803
|
-
return nativeToFixed(0.00008, 3) !== '0.000' ||
|
|
4804
|
-
nativeToFixed(0.9, 0) !== '1' ||
|
|
4805
|
-
nativeToFixed(1.255, 2) !== '1.25' ||
|
|
4806
|
-
nativeToFixed(1000000000000000128.0, 0) !== '1000000000000000128';
|
|
4807
|
-
}) || !fails$4(function () {
|
|
4808
|
-
// V8 ~ Android 4.3-
|
|
4809
|
-
nativeToFixed({});
|
|
4810
|
-
});
|
|
4811
|
-
|
|
4812
|
-
// `Number.prototype.toFixed` method
|
|
4813
|
-
// https://tc39.es/ecma262/#sec-number.prototype.tofixed
|
|
4814
|
-
$$a({ target: 'Number', proto: true, forced: FORCED$2 }, {
|
|
4815
|
-
toFixed: function toFixed(fractionDigits) {
|
|
4816
|
-
var number = thisNumberValue(this);
|
|
4817
|
-
var fractDigits = toIntegerOrInfinity(fractionDigits);
|
|
4818
|
-
var data = [0, 0, 0, 0, 0, 0];
|
|
4819
|
-
var sign = '';
|
|
4820
|
-
var result = '0';
|
|
4821
|
-
var e, z, j, k;
|
|
4822
|
-
|
|
4823
|
-
// TODO: ES2018 increased the maximum number of fraction digits to 100, need to improve the implementation
|
|
4824
|
-
if (fractDigits < 0 || fractDigits > 20) throw $RangeError('Incorrect fraction digits');
|
|
4825
|
-
// eslint-disable-next-line no-self-compare -- NaN check
|
|
4826
|
-
if (number != number) return 'NaN';
|
|
4827
|
-
if (number <= -1e21 || number >= 1e21) return $String(number);
|
|
4828
|
-
if (number < 0) {
|
|
4829
|
-
sign = '-';
|
|
4830
|
-
number = -number;
|
|
4831
|
-
}
|
|
4832
|
-
if (number > 1e-21) {
|
|
4833
|
-
e = log(number * pow(2, 69, 1)) - 69;
|
|
4834
|
-
z = e < 0 ? number * pow(2, -e, 1) : number / pow(2, e, 1);
|
|
4835
|
-
z *= 0x10000000000000;
|
|
4836
|
-
e = 52 - e;
|
|
4837
|
-
if (e > 0) {
|
|
4838
|
-
multiply(data, 0, z);
|
|
4839
|
-
j = fractDigits;
|
|
4840
|
-
while (j >= 7) {
|
|
4841
|
-
multiply(data, 1e7, 0);
|
|
4842
|
-
j -= 7;
|
|
4843
|
-
}
|
|
4844
|
-
multiply(data, pow(10, j, 1), 0);
|
|
4845
|
-
j = e - 1;
|
|
4846
|
-
while (j >= 23) {
|
|
4847
|
-
divide(data, 1 << 23);
|
|
4848
|
-
j -= 23;
|
|
4849
|
-
}
|
|
4850
|
-
divide(data, 1 << j);
|
|
4851
|
-
multiply(data, 1, 1);
|
|
4852
|
-
divide(data, 2);
|
|
4853
|
-
result = dataToString(data);
|
|
4854
|
-
} else {
|
|
4855
|
-
multiply(data, 0, z);
|
|
4856
|
-
multiply(data, 1 << -e, 0);
|
|
4857
|
-
result = dataToString(data) + repeat('0', fractDigits);
|
|
4858
|
-
}
|
|
4859
|
-
}
|
|
4860
|
-
if (fractDigits > 0) {
|
|
4861
|
-
k = result.length;
|
|
4862
|
-
result = sign + (k <= fractDigits
|
|
4863
|
-
? '0.' + repeat('0', fractDigits - k) + result
|
|
4864
|
-
: stringSlice$2(result, 0, k - fractDigits) + '.' + stringSlice$2(result, k - fractDigits));
|
|
4865
|
-
} else {
|
|
4866
|
-
result = sign + result;
|
|
4867
|
-
} return result;
|
|
5687
|
+
const handleSubmitAddNewWarehouse = payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
5688
|
+
const result = yield createWarehouse(payload);
|
|
5689
|
+
if (result) void refreshListWarehouses();
|
|
5690
|
+
});
|
|
5691
|
+
const handleSubmitEditWarehouse = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5692
|
+
yield updateWarehouse({
|
|
5693
|
+
isDefault: payload.isDefault,
|
|
5694
|
+
name: payload.name,
|
|
5695
|
+
originAddress: payload.originAddress,
|
|
5696
|
+
returnAddress: payload.returnAddress,
|
|
5697
|
+
warehouseId: warehouseId
|
|
5698
|
+
});
|
|
5699
|
+
yield refreshListWarehouses();
|
|
5700
|
+
});
|
|
5701
|
+
const handleSetDefault = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5702
|
+
yield updateWarehouse(Object.assign(Object.assign({}, payload), {
|
|
5703
|
+
isDefault: true,
|
|
5704
|
+
warehouseId
|
|
5705
|
+
}));
|
|
5706
|
+
yield refreshListWarehouses();
|
|
5707
|
+
});
|
|
5708
|
+
if (listWarehouseErrors) {
|
|
5709
|
+
throw new Error(listWarehouseErrors.map(e => e.message).join(", "));
|
|
4868
5710
|
}
|
|
5711
|
+
const sortedWarehouses = warehouses === null || warehouses === void 0 ? void 0 : warehouses.sort((a, b) => {
|
|
5712
|
+
if (b.isDefault && !a.isDefault) return 1;
|
|
5713
|
+
if (a.isDefault && !b.isDefault) return -1;
|
|
5714
|
+
return sortByCreationDate(a, b, "desc");
|
|
5715
|
+
});
|
|
5716
|
+
const errors = [...(updateWarehouseErrors !== null && updateWarehouseErrors !== void 0 ? updateWarehouseErrors : []), ...(createWarehouseErrors !== null && createWarehouseErrors !== void 0 ? createWarehouseErrors : []), ...(deleteWarehouseErrors !== null && deleteWarehouseErrors !== void 0 ? deleteWarehouseErrors : [])];
|
|
5717
|
+
return jsxRuntime.jsx(CollapsiblePanel, Object.assign({
|
|
5718
|
+
errors: errors,
|
|
5719
|
+
isSaving: creatingWarehouse || deletingWarehouse || updatingWarehouse,
|
|
5720
|
+
title: t("account-settings:sections.warehouses")
|
|
5721
|
+
}, {
|
|
5722
|
+
children: isLoadingWarehouses ? jsxRuntime.jsx(Loader, {
|
|
5723
|
+
message: t("loading.warehouses")
|
|
5724
|
+
}) : jsxRuntime.jsx(ManageWarehouses, {
|
|
5725
|
+
errors: errors,
|
|
5726
|
+
onAdd: handleSubmitAddNewWarehouse,
|
|
5727
|
+
onDelete: handleDeleteWarehouse,
|
|
5728
|
+
onEdit: handleSubmitEditWarehouse,
|
|
5729
|
+
onSetDefault: handleSetDefault,
|
|
5730
|
+
warehouses: sortedWarehouses || []
|
|
5731
|
+
})
|
|
5732
|
+
}));
|
|
5733
|
+
};
|
|
5734
|
+
|
|
5735
|
+
var manageWarehouses$1 = /*#__PURE__*/Object.freeze({
|
|
5736
|
+
__proto__: null,
|
|
5737
|
+
Component: Component$5
|
|
4869
5738
|
});
|
|
4870
5739
|
|
|
4871
5740
|
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";
|
|
@@ -4904,10 +5773,10 @@ const Label$1 = ({
|
|
|
4904
5773
|
|
|
4905
5774
|
var getBuiltIn$2 = getBuiltIn$8;
|
|
4906
5775
|
var definePropertyModule = objectDefineProperty;
|
|
4907
|
-
var wellKnownSymbol$
|
|
5776
|
+
var wellKnownSymbol$3 = wellKnownSymbol$k;
|
|
4908
5777
|
var DESCRIPTORS$1 = descriptors;
|
|
4909
5778
|
|
|
4910
|
-
var SPECIES$2 = wellKnownSymbol$
|
|
5779
|
+
var SPECIES$2 = wellKnownSymbol$3('species');
|
|
4911
5780
|
|
|
4912
5781
|
var setSpecies$1 = function (CONSTRUCTOR_NAME) {
|
|
4913
5782
|
var Constructor = getBuiltIn$2(CONSTRUCTOR_NAME);
|
|
@@ -4921,49 +5790,49 @@ var setSpecies$1 = function (CONSTRUCTOR_NAME) {
|
|
|
4921
5790
|
}
|
|
4922
5791
|
};
|
|
4923
5792
|
|
|
4924
|
-
var isPrototypeOf$
|
|
5793
|
+
var isPrototypeOf$1 = objectIsPrototypeOf;
|
|
4925
5794
|
|
|
4926
|
-
var $TypeError$
|
|
5795
|
+
var $TypeError$3 = TypeError;
|
|
4927
5796
|
|
|
4928
5797
|
var anInstance$1 = function (it, Prototype) {
|
|
4929
|
-
if (isPrototypeOf$
|
|
4930
|
-
throw $TypeError$
|
|
5798
|
+
if (isPrototypeOf$1(Prototype, it)) return it;
|
|
5799
|
+
throw $TypeError$3('Incorrect invocation');
|
|
4931
5800
|
};
|
|
4932
5801
|
|
|
4933
5802
|
var isConstructor = isConstructor$2;
|
|
4934
5803
|
var tryToString = tryToString$5;
|
|
4935
5804
|
|
|
4936
|
-
var $TypeError$
|
|
5805
|
+
var $TypeError$2 = TypeError;
|
|
4937
5806
|
|
|
4938
5807
|
// `Assert: IsConstructor(argument) is true`
|
|
4939
5808
|
var aConstructor$1 = function (argument) {
|
|
4940
5809
|
if (isConstructor(argument)) return argument;
|
|
4941
|
-
throw $TypeError$
|
|
5810
|
+
throw $TypeError$2(tryToString(argument) + ' is not a constructor');
|
|
4942
5811
|
};
|
|
4943
5812
|
|
|
4944
5813
|
var anObject$3 = anObject$f;
|
|
4945
5814
|
var aConstructor = aConstructor$1;
|
|
4946
|
-
var isNullOrUndefined$
|
|
4947
|
-
var wellKnownSymbol$
|
|
5815
|
+
var isNullOrUndefined$1 = isNullOrUndefined$7;
|
|
5816
|
+
var wellKnownSymbol$2 = wellKnownSymbol$k;
|
|
4948
5817
|
|
|
4949
|
-
var SPECIES$1 = wellKnownSymbol$
|
|
5818
|
+
var SPECIES$1 = wellKnownSymbol$2('species');
|
|
4950
5819
|
|
|
4951
5820
|
// `SpeciesConstructor` abstract operation
|
|
4952
5821
|
// https://tc39.es/ecma262/#sec-speciesconstructor
|
|
4953
5822
|
var speciesConstructor$1 = function (O, defaultConstructor) {
|
|
4954
5823
|
var C = anObject$3(O).constructor;
|
|
4955
5824
|
var S;
|
|
4956
|
-
return C === undefined || isNullOrUndefined$
|
|
5825
|
+
return C === undefined || isNullOrUndefined$1(S = anObject$3(C)[SPECIES$1]) ? defaultConstructor : aConstructor(S);
|
|
4957
5826
|
};
|
|
4958
5827
|
|
|
4959
|
-
var uncurryThis$
|
|
5828
|
+
var uncurryThis$3 = functionUncurryThis;
|
|
4960
5829
|
|
|
4961
|
-
var arraySlice$1 = uncurryThis$
|
|
5830
|
+
var arraySlice$1 = uncurryThis$3([].slice);
|
|
4962
5831
|
|
|
4963
|
-
var $TypeError$
|
|
5832
|
+
var $TypeError$1 = TypeError;
|
|
4964
5833
|
|
|
4965
5834
|
var validateArgumentsLength$1 = function (passed, required) {
|
|
4966
|
-
if (passed < required) throw $TypeError$
|
|
5835
|
+
if (passed < required) throw $TypeError$1('Not enough arguments');
|
|
4967
5836
|
return passed;
|
|
4968
5837
|
};
|
|
4969
5838
|
|
|
@@ -4974,8 +5843,8 @@ var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$2);
|
|
|
4974
5843
|
var global$a = global$p;
|
|
4975
5844
|
var apply = functionApply;
|
|
4976
5845
|
var bind$2 = functionBindContext;
|
|
4977
|
-
var isCallable$
|
|
4978
|
-
var hasOwn$
|
|
5846
|
+
var isCallable$4 = isCallable$o;
|
|
5847
|
+
var hasOwn$1 = hasOwnProperty_1;
|
|
4979
5848
|
var fails$3 = fails$q;
|
|
4980
5849
|
var html = html$2;
|
|
4981
5850
|
var arraySlice = arraySlice$1;
|
|
@@ -5002,7 +5871,7 @@ try {
|
|
|
5002
5871
|
} catch (error) { /* empty */ }
|
|
5003
5872
|
|
|
5004
5873
|
var run = function (id) {
|
|
5005
|
-
if (hasOwn$
|
|
5874
|
+
if (hasOwn$1(queue$1, id)) {
|
|
5006
5875
|
var fn = queue$1[id];
|
|
5007
5876
|
delete queue$1[id];
|
|
5008
5877
|
fn();
|
|
@@ -5028,7 +5897,7 @@ var post = function (id) {
|
|
|
5028
5897
|
if (!set || !clear) {
|
|
5029
5898
|
set = function setImmediate(handler) {
|
|
5030
5899
|
validateArgumentsLength(arguments.length, 1);
|
|
5031
|
-
var fn = isCallable$
|
|
5900
|
+
var fn = isCallable$4(handler) ? handler : Function$1(handler);
|
|
5032
5901
|
var args = arraySlice(arguments, 1);
|
|
5033
5902
|
queue$1[++counter] = function () {
|
|
5034
5903
|
apply(fn, undefined, args);
|
|
@@ -5060,7 +5929,7 @@ if (!set || !clear) {
|
|
|
5060
5929
|
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
|
|
5061
5930
|
} else if (
|
|
5062
5931
|
global$a.addEventListener &&
|
|
5063
|
-
isCallable$
|
|
5932
|
+
isCallable$4(global$a.postMessage) &&
|
|
5064
5933
|
!global$a.importScripts &&
|
|
5065
5934
|
$location && $location.protocol !== 'file:' &&
|
|
5066
5935
|
!fails$3(post)
|
|
@@ -5241,18 +6110,18 @@ var engineIsBrowser = !IS_DENO$1 && !IS_NODE$1
|
|
|
5241
6110
|
|
|
5242
6111
|
var global$5 = global$p;
|
|
5243
6112
|
var NativePromiseConstructor$3 = promiseNativeConstructor;
|
|
5244
|
-
var isCallable$
|
|
6113
|
+
var isCallable$3 = isCallable$o;
|
|
5245
6114
|
var isForced = isForced_1;
|
|
5246
6115
|
var inspectSource = inspectSource$3;
|
|
5247
|
-
var wellKnownSymbol$
|
|
6116
|
+
var wellKnownSymbol$1 = wellKnownSymbol$k;
|
|
5248
6117
|
var IS_BROWSER = engineIsBrowser;
|
|
5249
6118
|
var IS_DENO = engineIsDeno;
|
|
5250
6119
|
var V8_VERSION = engineV8Version;
|
|
5251
6120
|
|
|
5252
6121
|
NativePromiseConstructor$3 && NativePromiseConstructor$3.prototype;
|
|
5253
|
-
var SPECIES = wellKnownSymbol$
|
|
6122
|
+
var SPECIES = wellKnownSymbol$1('species');
|
|
5254
6123
|
var SUBCLASSING = false;
|
|
5255
|
-
var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable$
|
|
6124
|
+
var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable$3(global$5.PromiseRejectionEvent);
|
|
5256
6125
|
|
|
5257
6126
|
var FORCED_PROMISE_CONSTRUCTOR$5 = isForced('Promise', function () {
|
|
5258
6127
|
var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor$3);
|
|
@@ -5288,12 +6157,12 @@ var newPromiseCapability$2 = {};
|
|
|
5288
6157
|
|
|
5289
6158
|
var aCallable$3 = aCallable$a;
|
|
5290
6159
|
|
|
5291
|
-
var $TypeError
|
|
6160
|
+
var $TypeError = TypeError;
|
|
5292
6161
|
|
|
5293
6162
|
var PromiseCapability = function (C) {
|
|
5294
6163
|
var resolve, reject;
|
|
5295
6164
|
this.promise = new C(function ($$resolve, $$reject) {
|
|
5296
|
-
if (resolve !== undefined || reject !== undefined) throw $TypeError
|
|
6165
|
+
if (resolve !== undefined || reject !== undefined) throw $TypeError('Bad Promise constructor');
|
|
5297
6166
|
resolve = $$resolve;
|
|
5298
6167
|
reject = $$reject;
|
|
5299
6168
|
});
|
|
@@ -5307,16 +6176,16 @@ newPromiseCapability$2.f = function (C) {
|
|
|
5307
6176
|
return new PromiseCapability(C);
|
|
5308
6177
|
};
|
|
5309
6178
|
|
|
5310
|
-
var $$
|
|
6179
|
+
var $$8 = _export;
|
|
5311
6180
|
var IS_NODE = engineIsNode;
|
|
5312
6181
|
var global$4 = global$p;
|
|
5313
|
-
var call$
|
|
6182
|
+
var call$4 = functionCall;
|
|
5314
6183
|
var defineBuiltIn$2 = defineBuiltIn$7;
|
|
5315
6184
|
var setPrototypeOf = objectSetPrototypeOf;
|
|
5316
6185
|
var setToStringTag = setToStringTag$3;
|
|
5317
6186
|
var setSpecies = setSpecies$1;
|
|
5318
6187
|
var aCallable$2 = aCallable$a;
|
|
5319
|
-
var isCallable$
|
|
6188
|
+
var isCallable$2 = isCallable$o;
|
|
5320
6189
|
var isObject$1 = isObject$a;
|
|
5321
6190
|
var anInstance = anInstance$1;
|
|
5322
6191
|
var speciesConstructor = speciesConstructor$1;
|
|
@@ -5359,7 +6228,7 @@ var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
|
|
|
5359
6228
|
// helpers
|
|
5360
6229
|
var isThenable = function (it) {
|
|
5361
6230
|
var then;
|
|
5362
|
-
return isObject$1(it) && isCallable$
|
|
6231
|
+
return isObject$1(it) && isCallable$2(then = it.then) ? then : false;
|
|
5363
6232
|
};
|
|
5364
6233
|
|
|
5365
6234
|
var callReaction = function (reaction, state) {
|
|
@@ -5388,7 +6257,7 @@ var callReaction = function (reaction, state) {
|
|
|
5388
6257
|
if (result === reaction.promise) {
|
|
5389
6258
|
reject(TypeError$1('Promise-chain cycle'));
|
|
5390
6259
|
} else if (then = isThenable(result)) {
|
|
5391
|
-
call$
|
|
6260
|
+
call$4(then, result, resolve, reject);
|
|
5392
6261
|
} else resolve(result);
|
|
5393
6262
|
} else reject(value);
|
|
5394
6263
|
} catch (error) {
|
|
@@ -5425,7 +6294,7 @@ var dispatchEvent = function (name, promise, reason) {
|
|
|
5425
6294
|
};
|
|
5426
6295
|
|
|
5427
6296
|
var onUnhandled = function (state) {
|
|
5428
|
-
call$
|
|
6297
|
+
call$4(task, global$4, function () {
|
|
5429
6298
|
var promise = state.facade;
|
|
5430
6299
|
var value = state.value;
|
|
5431
6300
|
var IS_UNHANDLED = isUnhandled(state);
|
|
@@ -5448,7 +6317,7 @@ var isUnhandled = function (state) {
|
|
|
5448
6317
|
};
|
|
5449
6318
|
|
|
5450
6319
|
var onHandleUnhandled = function (state) {
|
|
5451
|
-
call$
|
|
6320
|
+
call$4(task, global$4, function () {
|
|
5452
6321
|
var promise = state.facade;
|
|
5453
6322
|
if (IS_NODE) {
|
|
5454
6323
|
process$1.emit('rejectionHandled', promise);
|
|
@@ -5482,7 +6351,7 @@ var internalResolve = function (state, value, unwrap) {
|
|
|
5482
6351
|
microtask(function () {
|
|
5483
6352
|
var wrapper = { done: false };
|
|
5484
6353
|
try {
|
|
5485
|
-
call$
|
|
6354
|
+
call$4(then, value,
|
|
5486
6355
|
bind(internalResolve, wrapper, state),
|
|
5487
6356
|
bind(internalReject, wrapper, state)
|
|
5488
6357
|
);
|
|
@@ -5506,7 +6375,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
5506
6375
|
PromiseConstructor = function Promise(executor) {
|
|
5507
6376
|
anInstance(this, PromisePrototype);
|
|
5508
6377
|
aCallable$2(executor);
|
|
5509
|
-
call$
|
|
6378
|
+
call$4(Internal, this);
|
|
5510
6379
|
var state = getInternalPromiseState(this);
|
|
5511
6380
|
try {
|
|
5512
6381
|
executor(bind(internalResolve, state), bind(internalReject, state));
|
|
@@ -5537,8 +6406,8 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
5537
6406
|
var state = getInternalPromiseState(this);
|
|
5538
6407
|
var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));
|
|
5539
6408
|
state.parent = true;
|
|
5540
|
-
reaction.ok = isCallable$
|
|
5541
|
-
reaction.fail = isCallable$
|
|
6409
|
+
reaction.ok = isCallable$2(onFulfilled) ? onFulfilled : true;
|
|
6410
|
+
reaction.fail = isCallable$2(onRejected) && onRejected;
|
|
5542
6411
|
reaction.domain = IS_NODE ? process$1.domain : undefined;
|
|
5543
6412
|
if (state.state == PENDING) state.reactions.add(reaction);
|
|
5544
6413
|
else microtask(function () {
|
|
@@ -5561,7 +6430,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
5561
6430
|
: newGenericPromiseCapability(C);
|
|
5562
6431
|
};
|
|
5563
6432
|
|
|
5564
|
-
if (isCallable$
|
|
6433
|
+
if (isCallable$2(NativePromiseConstructor$2) && NativePromisePrototype$1 !== Object.prototype) {
|
|
5565
6434
|
nativeThen = NativePromisePrototype$1.then;
|
|
5566
6435
|
|
|
5567
6436
|
if (!NATIVE_PROMISE_SUBCLASSING) {
|
|
@@ -5569,7 +6438,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
5569
6438
|
defineBuiltIn$2(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
|
|
5570
6439
|
var that = this;
|
|
5571
6440
|
return new PromiseConstructor(function (resolve, reject) {
|
|
5572
|
-
call$
|
|
6441
|
+
call$4(nativeThen, that, resolve, reject);
|
|
5573
6442
|
}).then(onFulfilled, onRejected);
|
|
5574
6443
|
// https://github.com/zloirock/core-js/issues/640
|
|
5575
6444
|
}, { unsafe: true });
|
|
@@ -5587,16 +6456,16 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
5587
6456
|
}
|
|
5588
6457
|
}
|
|
5589
6458
|
|
|
5590
|
-
$$
|
|
6459
|
+
$$8({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
|
|
5591
6460
|
Promise: PromiseConstructor
|
|
5592
6461
|
});
|
|
5593
6462
|
|
|
5594
6463
|
setToStringTag(PromiseConstructor, PROMISE, false);
|
|
5595
6464
|
setSpecies(PROMISE);
|
|
5596
6465
|
|
|
5597
|
-
var wellKnownSymbol
|
|
6466
|
+
var wellKnownSymbol = wellKnownSymbol$k;
|
|
5598
6467
|
|
|
5599
|
-
var ITERATOR$2 = wellKnownSymbol
|
|
6468
|
+
var ITERATOR$2 = wellKnownSymbol('iterator');
|
|
5600
6469
|
var SAFE_CLOSING = false;
|
|
5601
6470
|
|
|
5602
6471
|
try {
|
|
@@ -5641,8 +6510,8 @@ var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCor
|
|
|
5641
6510
|
NativePromiseConstructor$1.all(iterable).then(undefined, function () { /* empty */ });
|
|
5642
6511
|
});
|
|
5643
6512
|
|
|
5644
|
-
var $$
|
|
5645
|
-
var call$
|
|
6513
|
+
var $$7 = _export;
|
|
6514
|
+
var call$3 = functionCall;
|
|
5646
6515
|
var aCallable$1 = aCallable$a;
|
|
5647
6516
|
var newPromiseCapabilityModule$2 = newPromiseCapability$2;
|
|
5648
6517
|
var perform$1 = perform$3;
|
|
@@ -5651,7 +6520,7 @@ var PROMISE_STATICS_INCORRECT_ITERATION$1 = promiseStaticsIncorrectIteration;
|
|
|
5651
6520
|
|
|
5652
6521
|
// `Promise.all` method
|
|
5653
6522
|
// https://tc39.es/ecma262/#sec-promise.all
|
|
5654
|
-
$$
|
|
6523
|
+
$$7({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
|
|
5655
6524
|
all: function all(iterable) {
|
|
5656
6525
|
var C = this;
|
|
5657
6526
|
var capability = newPromiseCapabilityModule$2.f(C);
|
|
@@ -5666,7 +6535,7 @@ $$8({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
|
|
|
5666
6535
|
var index = counter++;
|
|
5667
6536
|
var alreadyCalled = false;
|
|
5668
6537
|
remaining++;
|
|
5669
|
-
call$
|
|
6538
|
+
call$3($promiseResolve, C, promise).then(function (value) {
|
|
5670
6539
|
if (alreadyCalled) return;
|
|
5671
6540
|
alreadyCalled = true;
|
|
5672
6541
|
values[index] = value;
|
|
@@ -5680,33 +6549,33 @@ $$8({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
|
|
|
5680
6549
|
}
|
|
5681
6550
|
});
|
|
5682
6551
|
|
|
5683
|
-
var $$
|
|
6552
|
+
var $$6 = _export;
|
|
5684
6553
|
var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
|
|
5685
6554
|
var NativePromiseConstructor = promiseNativeConstructor;
|
|
5686
6555
|
var getBuiltIn$1 = getBuiltIn$8;
|
|
5687
|
-
var isCallable$
|
|
6556
|
+
var isCallable$1 = isCallable$o;
|
|
5688
6557
|
var defineBuiltIn$1 = defineBuiltIn$7;
|
|
5689
6558
|
|
|
5690
6559
|
var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
|
|
5691
6560
|
|
|
5692
6561
|
// `Promise.prototype.catch` method
|
|
5693
6562
|
// https://tc39.es/ecma262/#sec-promise.prototype.catch
|
|
5694
|
-
$$
|
|
6563
|
+
$$6({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
|
|
5695
6564
|
'catch': function (onRejected) {
|
|
5696
6565
|
return this.then(undefined, onRejected);
|
|
5697
6566
|
}
|
|
5698
6567
|
});
|
|
5699
6568
|
|
|
5700
6569
|
// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
|
|
5701
|
-
if (isCallable$
|
|
6570
|
+
if (isCallable$1(NativePromiseConstructor)) {
|
|
5702
6571
|
var method = getBuiltIn$1('Promise').prototype['catch'];
|
|
5703
6572
|
if (NativePromisePrototype['catch'] !== method) {
|
|
5704
6573
|
defineBuiltIn$1(NativePromisePrototype, 'catch', method, { unsafe: true });
|
|
5705
6574
|
}
|
|
5706
6575
|
}
|
|
5707
6576
|
|
|
5708
|
-
var $$
|
|
5709
|
-
var call$
|
|
6577
|
+
var $$5 = _export;
|
|
6578
|
+
var call$2 = functionCall;
|
|
5710
6579
|
var aCallable = aCallable$a;
|
|
5711
6580
|
var newPromiseCapabilityModule$1 = newPromiseCapability$2;
|
|
5712
6581
|
var perform = perform$3;
|
|
@@ -5715,7 +6584,7 @@ var PROMISE_STATICS_INCORRECT_ITERATION = promiseStaticsIncorrectIteration;
|
|
|
5715
6584
|
|
|
5716
6585
|
// `Promise.race` method
|
|
5717
6586
|
// https://tc39.es/ecma262/#sec-promise.race
|
|
5718
|
-
$$
|
|
6587
|
+
$$5({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
|
|
5719
6588
|
race: function race(iterable) {
|
|
5720
6589
|
var C = this;
|
|
5721
6590
|
var capability = newPromiseCapabilityModule$1.f(C);
|
|
@@ -5723,7 +6592,7 @@ $$6({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
|
|
|
5723
6592
|
var result = perform(function () {
|
|
5724
6593
|
var $promiseResolve = aCallable(C.resolve);
|
|
5725
6594
|
iterate(iterable, function (promise) {
|
|
5726
|
-
call$
|
|
6595
|
+
call$2($promiseResolve, C, promise).then(capability.resolve, reject);
|
|
5727
6596
|
});
|
|
5728
6597
|
});
|
|
5729
6598
|
if (result.error) reject(result.value);
|
|
@@ -5731,17 +6600,17 @@ $$6({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
|
|
|
5731
6600
|
}
|
|
5732
6601
|
});
|
|
5733
6602
|
|
|
5734
|
-
var $$
|
|
5735
|
-
var call$
|
|
6603
|
+
var $$4 = _export;
|
|
6604
|
+
var call$1 = functionCall;
|
|
5736
6605
|
var newPromiseCapabilityModule = newPromiseCapability$2;
|
|
5737
6606
|
var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
|
|
5738
6607
|
|
|
5739
6608
|
// `Promise.reject` method
|
|
5740
6609
|
// https://tc39.es/ecma262/#sec-promise.reject
|
|
5741
|
-
$$
|
|
6610
|
+
$$4({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
|
|
5742
6611
|
reject: function reject(r) {
|
|
5743
6612
|
var capability = newPromiseCapabilityModule.f(this);
|
|
5744
|
-
call$
|
|
6613
|
+
call$1(capability.reject, undefined, r);
|
|
5745
6614
|
return capability.promise;
|
|
5746
6615
|
}
|
|
5747
6616
|
});
|
|
@@ -5759,7 +6628,7 @@ var promiseResolve$1 = function (C, x) {
|
|
|
5759
6628
|
return promiseCapability.promise;
|
|
5760
6629
|
};
|
|
5761
6630
|
|
|
5762
|
-
var $$
|
|
6631
|
+
var $$3 = _export;
|
|
5763
6632
|
var getBuiltIn = getBuiltIn$8;
|
|
5764
6633
|
var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR;
|
|
5765
6634
|
var promiseResolve = promiseResolve$1;
|
|
@@ -5768,7 +6637,7 @@ getBuiltIn('Promise');
|
|
|
5768
6637
|
|
|
5769
6638
|
// `Promise.resolve` method
|
|
5770
6639
|
// https://tc39.es/ecma262/#sec-promise.resolve
|
|
5771
|
-
$$
|
|
6640
|
+
$$3({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
|
|
5772
6641
|
resolve: function resolve(x) {
|
|
5773
6642
|
return promiseResolve(this, x);
|
|
5774
6643
|
}
|
|
@@ -5783,6 +6652,11 @@ const icons = {
|
|
|
5783
6652
|
download: gigerTheme.IconNames.DOWNLOAD,
|
|
5784
6653
|
retry: gigerTheme.IconNames.CIRCULAR_ARROW
|
|
5785
6654
|
};
|
|
6655
|
+
/**
|
|
6656
|
+
* @internal
|
|
6657
|
+
*
|
|
6658
|
+
* # Link Action Component
|
|
6659
|
+
*/
|
|
5786
6660
|
const LinkAction = _a => {
|
|
5787
6661
|
var {
|
|
5788
6662
|
css,
|
|
@@ -5869,6 +6743,22 @@ const ErrorDisplay = () => jsxRuntime.jsxs("div", Object.assign({
|
|
|
5869
6743
|
}))]
|
|
5870
6744
|
}));
|
|
5871
6745
|
|
|
6746
|
+
/**
|
|
6747
|
+
* @internal
|
|
6748
|
+
*
|
|
6749
|
+
* # Spacer Component Util Function
|
|
6750
|
+
*
|
|
6751
|
+
* - This is a utility function that generates dynamic styles for the `<Spacer />` component.
|
|
6752
|
+
*
|
|
6753
|
+
* @param SpacerProps The base props that will be passed into the `<Spacer />` component at
|
|
6754
|
+
* point of use.
|
|
6755
|
+
*
|
|
6756
|
+
* @return Styles A `SerializedStyles` object that contains styles that can be consumed by
|
|
6757
|
+
* our `ThemeProvider` and `EmotionJSX.Element` components.
|
|
6758
|
+
*
|
|
6759
|
+
* @see {@link Spacer | The `<Spacer />` component that uses these dynamic styles}
|
|
6760
|
+
*
|
|
6761
|
+
*/
|
|
5872
6762
|
const getSpacerStyles = ({
|
|
5873
6763
|
displayOn,
|
|
5874
6764
|
multiplier: _multiplier = 4
|
|
@@ -5882,11 +6772,28 @@ const getSpacerStyles = ({
|
|
|
5882
6772
|
}), {
|
|
5883
6773
|
height: theme.spacing(_multiplier),
|
|
5884
6774
|
width: "100%"
|
|
5885
|
-
}), process.env.NODE_ENV === "production" ? "" : ";label:getSpacerStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
6775
|
+
}), 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== */");
|
|
6776
|
+
/**
|
|
6777
|
+
* @internal
|
|
6778
|
+
*
|
|
6779
|
+
* # Spacer Composition Component
|
|
6780
|
+
*
|
|
6781
|
+
* - The `Spacer` is a composition component used to create a space between elements
|
|
6782
|
+
* in the UI.
|
|
6783
|
+
*
|
|
6784
|
+
* @see {@link Spacer.SpacerProps | The props necessary to render the `<Spacer />` component}
|
|
6785
|
+
* @see {@link Spacer.getSpacerStyles | The util function that generates the styles for the `<Spacer />` component}
|
|
6786
|
+
*
|
|
6787
|
+
*/
|
|
5886
6788
|
const Spacer = props => jsxRuntime.jsx("div", {
|
|
5887
6789
|
css: getSpacerStyles(props)
|
|
5888
6790
|
});
|
|
5889
6791
|
|
|
6792
|
+
/**
|
|
6793
|
+
* @internal
|
|
6794
|
+
*
|
|
6795
|
+
* # Spread Component
|
|
6796
|
+
*/
|
|
5890
6797
|
const Spread = ({
|
|
5891
6798
|
children
|
|
5892
6799
|
}) => jsxRuntime.jsx("div", Object.assign({
|
|
@@ -6312,6 +7219,11 @@ const styles$s = createStyles({
|
|
|
6312
7219
|
})
|
|
6313
7220
|
});
|
|
6314
7221
|
|
|
7222
|
+
/**
|
|
7223
|
+
* @namespace WalletHistory
|
|
7224
|
+
*
|
|
7225
|
+
* # Wallet History
|
|
7226
|
+
*/
|
|
6315
7227
|
const WalletHistory = () => {
|
|
6316
7228
|
var _a;
|
|
6317
7229
|
const {
|
|
@@ -6574,6 +7486,11 @@ const LabelLayoutPurchase = ({
|
|
|
6574
7486
|
});
|
|
6575
7487
|
};
|
|
6576
7488
|
|
|
7489
|
+
/**
|
|
7490
|
+
* @internal
|
|
7491
|
+
*
|
|
7492
|
+
* # Loader Component
|
|
7493
|
+
*/
|
|
6577
7494
|
const Loader = props => {
|
|
6578
7495
|
return jsxRuntime.jsx("div", Object.assign({
|
|
6579
7496
|
css: {
|
|
@@ -6691,7 +7608,7 @@ const SaveStatus = ({
|
|
|
6691
7608
|
}))]
|
|
6692
7609
|
}));
|
|
6693
7610
|
}
|
|
6694
|
-
return !isSaving && !errors ? jsxRuntime.jsxs("div", Object.assign({
|
|
7611
|
+
return !isSaving && !(errors === null || errors === void 0 ? void 0 : errors.length) ? jsxRuntime.jsxs("div", Object.assign({
|
|
6695
7612
|
css: styles$r.container
|
|
6696
7613
|
}, {
|
|
6697
7614
|
children: [jsxRuntime.jsx("svg", Object.assign({
|
|
@@ -6755,6 +7672,16 @@ const styles$q = createStyles({
|
|
|
6755
7672
|
})
|
|
6756
7673
|
});
|
|
6757
7674
|
|
|
7675
|
+
/**
|
|
7676
|
+
* @internal
|
|
7677
|
+
*
|
|
7678
|
+
* # Collapsible Panel Component
|
|
7679
|
+
*
|
|
7680
|
+
* - The `<CollapsiblePanel />` composition component is used to group content together that can
|
|
7681
|
+
* be expanded or collapsed.
|
|
7682
|
+
*
|
|
7683
|
+
* @see {@link CollapsiblePanelProps | The props that are passed into the `<CollapsiblePanel />` component}
|
|
7684
|
+
*/
|
|
6758
7685
|
const CollapsiblePanel = ({
|
|
6759
7686
|
errors,
|
|
6760
7687
|
initialExpanded,
|
|
@@ -7002,6 +7929,11 @@ const LabelLayoutSettings = ({
|
|
|
7002
7929
|
}));
|
|
7003
7930
|
};
|
|
7004
7931
|
|
|
7932
|
+
/**
|
|
7933
|
+
* @namespace LabelLayout
|
|
7934
|
+
*
|
|
7935
|
+
* # Label Layout Component
|
|
7936
|
+
*/
|
|
7005
7937
|
const LabelLayout = ({
|
|
7006
7938
|
display
|
|
7007
7939
|
}) => {
|
|
@@ -7034,6 +7966,16 @@ const LabelLayout = ({
|
|
|
7034
7966
|
});
|
|
7035
7967
|
};
|
|
7036
7968
|
|
|
7969
|
+
/**
|
|
7970
|
+
* @internal
|
|
7971
|
+
*
|
|
7972
|
+
* # Button Group Component
|
|
7973
|
+
*
|
|
7974
|
+
* - The `<ButtonGroup />` is a composition component used to group buttons together that are
|
|
7975
|
+
* passed in as children.
|
|
7976
|
+
*
|
|
7977
|
+
* @see {@link ButtonGroupProps | The props that are passed into the `<ButtonGroup />` component}
|
|
7978
|
+
*/
|
|
7037
7979
|
const ButtonGroup = _a => {
|
|
7038
7980
|
var {
|
|
7039
7981
|
children,
|
|
@@ -7070,6 +8012,11 @@ const ButtonGroup = _a => {
|
|
|
7070
8012
|
}));
|
|
7071
8013
|
};
|
|
7072
8014
|
|
|
8015
|
+
/**
|
|
8016
|
+
* @internal
|
|
8017
|
+
*
|
|
8018
|
+
* # Field Label Component
|
|
8019
|
+
*/
|
|
7073
8020
|
const FieldLabel = ({
|
|
7074
8021
|
children,
|
|
7075
8022
|
label,
|
|
@@ -7312,87 +8259,6 @@ const CreditCardInput = fieldProps => jsxRuntime.jsx(CreditCardInputController,
|
|
|
7312
8259
|
}
|
|
7313
8260
|
}));
|
|
7314
8261
|
|
|
7315
|
-
var call$2 = functionCall;
|
|
7316
|
-
var hasOwn$1 = hasOwnProperty_1;
|
|
7317
|
-
var isPrototypeOf$1 = objectIsPrototypeOf;
|
|
7318
|
-
var regExpFlags = regexpFlags$1;
|
|
7319
|
-
|
|
7320
|
-
var RegExpPrototype$1 = RegExp.prototype;
|
|
7321
|
-
|
|
7322
|
-
var regexpGetFlags = function (R) {
|
|
7323
|
-
var flags = R.flags;
|
|
7324
|
-
return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn$1(R, 'flags') && isPrototypeOf$1(RegExpPrototype$1, R)
|
|
7325
|
-
? call$2(regExpFlags, R) : flags;
|
|
7326
|
-
};
|
|
7327
|
-
|
|
7328
|
-
var $$3 = _export;
|
|
7329
|
-
var call$1 = functionCall;
|
|
7330
|
-
var uncurryThis$3 = functionUncurryThis;
|
|
7331
|
-
var requireObjectCoercible$1 = requireObjectCoercible$9;
|
|
7332
|
-
var isCallable$1 = isCallable$o;
|
|
7333
|
-
var isNullOrUndefined$1 = isNullOrUndefined$7;
|
|
7334
|
-
var isRegExp = isRegexp;
|
|
7335
|
-
var toString$4 = toString$c;
|
|
7336
|
-
var getMethod$1 = getMethod$6;
|
|
7337
|
-
var getRegExpFlags$1 = regexpGetFlags;
|
|
7338
|
-
var getSubstitution = getSubstitution$2;
|
|
7339
|
-
var wellKnownSymbol = wellKnownSymbol$k;
|
|
7340
|
-
|
|
7341
|
-
var REPLACE = wellKnownSymbol('replace');
|
|
7342
|
-
var $TypeError = TypeError;
|
|
7343
|
-
var indexOf = uncurryThis$3(''.indexOf);
|
|
7344
|
-
uncurryThis$3(''.replace);
|
|
7345
|
-
var stringSlice$1 = uncurryThis$3(''.slice);
|
|
7346
|
-
var max = Math.max;
|
|
7347
|
-
|
|
7348
|
-
var stringIndexOf = function (string, searchValue, fromIndex) {
|
|
7349
|
-
if (fromIndex > string.length) return -1;
|
|
7350
|
-
if (searchValue === '') return fromIndex;
|
|
7351
|
-
return indexOf(string, searchValue, fromIndex);
|
|
7352
|
-
};
|
|
7353
|
-
|
|
7354
|
-
// `String.prototype.replaceAll` method
|
|
7355
|
-
// https://tc39.es/ecma262/#sec-string.prototype.replaceall
|
|
7356
|
-
$$3({ target: 'String', proto: true }, {
|
|
7357
|
-
replaceAll: function replaceAll(searchValue, replaceValue) {
|
|
7358
|
-
var O = requireObjectCoercible$1(this);
|
|
7359
|
-
var IS_REG_EXP, flags, replacer, string, searchString, functionalReplace, searchLength, advanceBy, replacement;
|
|
7360
|
-
var position = 0;
|
|
7361
|
-
var endOfLastMatch = 0;
|
|
7362
|
-
var result = '';
|
|
7363
|
-
if (!isNullOrUndefined$1(searchValue)) {
|
|
7364
|
-
IS_REG_EXP = isRegExp(searchValue);
|
|
7365
|
-
if (IS_REG_EXP) {
|
|
7366
|
-
flags = toString$4(requireObjectCoercible$1(getRegExpFlags$1(searchValue)));
|
|
7367
|
-
if (!~indexOf(flags, 'g')) throw $TypeError('`.replaceAll` does not allow non-global regexes');
|
|
7368
|
-
}
|
|
7369
|
-
replacer = getMethod$1(searchValue, REPLACE);
|
|
7370
|
-
if (replacer) {
|
|
7371
|
-
return call$1(replacer, searchValue, O, replaceValue);
|
|
7372
|
-
}
|
|
7373
|
-
}
|
|
7374
|
-
string = toString$4(O);
|
|
7375
|
-
searchString = toString$4(searchValue);
|
|
7376
|
-
functionalReplace = isCallable$1(replaceValue);
|
|
7377
|
-
if (!functionalReplace) replaceValue = toString$4(replaceValue);
|
|
7378
|
-
searchLength = searchString.length;
|
|
7379
|
-
advanceBy = max(1, searchLength);
|
|
7380
|
-
position = stringIndexOf(string, searchString, 0);
|
|
7381
|
-
while (position !== -1) {
|
|
7382
|
-
replacement = functionalReplace
|
|
7383
|
-
? toString$4(replaceValue(searchString, position, string))
|
|
7384
|
-
: getSubstitution(searchString, string, position, [], undefined, replaceValue);
|
|
7385
|
-
result += stringSlice$1(string, endOfLastMatch, position) + replacement;
|
|
7386
|
-
endOfLastMatch = position + searchLength;
|
|
7387
|
-
position = stringIndexOf(string, searchString, position + advanceBy);
|
|
7388
|
-
}
|
|
7389
|
-
if (endOfLastMatch < string.length) {
|
|
7390
|
-
result += stringSlice$1(string, endOfLastMatch);
|
|
7391
|
-
}
|
|
7392
|
-
return result;
|
|
7393
|
-
}
|
|
7394
|
-
});
|
|
7395
|
-
|
|
7396
8262
|
// TODO: Quick Fix for White Label; The navigator object cannot be accessed from within SSR,
|
|
7397
8263
|
// so this provides default value until this feature can be refactored to support SSR.
|
|
7398
8264
|
let _LOCALE = "en-US";
|
|
@@ -8200,6 +9066,19 @@ const getAcknowledgementLabel = (serviceCode, packageType) => {
|
|
|
8200
9066
|
});
|
|
8201
9067
|
}
|
|
8202
9068
|
return;
|
|
9069
|
+
case "dhl_express_worldwide":
|
|
9070
|
+
return jsxRuntime.jsxs(reactI18next.Trans, Object.assign({
|
|
9071
|
+
i18nKey: "purchase-label:rates.dhlExpressTermsAcknowledgement"
|
|
9072
|
+
}, {
|
|
9073
|
+
children: ["To start shipping with DHL, you are confirming that you have agreed to the ", jsxRuntime.jsx(giger.Link, Object.assign({
|
|
9074
|
+
href: "https://mydhl.express.dhl/us/en/legal/terms-and-conditions.html",
|
|
9075
|
+
isExternal: true,
|
|
9076
|
+
rel: "noreferrer",
|
|
9077
|
+
target: "_blank"
|
|
9078
|
+
}, {
|
|
9079
|
+
children: "terms and conditions"
|
|
9080
|
+
}))]
|
|
9081
|
+
}));
|
|
8203
9082
|
default:
|
|
8204
9083
|
return null;
|
|
8205
9084
|
}
|
|
@@ -8611,6 +9490,10 @@ var fields = /*#__PURE__*/Object.freeze({
|
|
|
8611
9490
|
});
|
|
8612
9491
|
|
|
8613
9492
|
/**
|
|
9493
|
+
* @internal
|
|
9494
|
+
*
|
|
9495
|
+
* # Form Portal Component
|
|
9496
|
+
*
|
|
8614
9497
|
* A drop-in replacement for the `<form>` tag that allows nested forms.
|
|
8615
9498
|
*
|
|
8616
9499
|
* Via portals, the <form> tag is mounted as a sibling of the app root. The form's
|
|
@@ -8680,6 +9563,10 @@ const styles$o = createStyles({
|
|
|
8680
9563
|
});
|
|
8681
9564
|
|
|
8682
9565
|
/**
|
|
9566
|
+
* @internal
|
|
9567
|
+
*
|
|
9568
|
+
* # Money Schema
|
|
9569
|
+
*
|
|
8683
9570
|
* @category Form Validation
|
|
8684
9571
|
*/
|
|
8685
9572
|
const moneySchema = zod.z.object({
|
|
@@ -8688,14 +9575,33 @@ const moneySchema = zod.z.object({
|
|
|
8688
9575
|
});
|
|
8689
9576
|
|
|
8690
9577
|
/**
|
|
9578
|
+
* @internal
|
|
9579
|
+
*
|
|
9580
|
+
* # Phone utils
|
|
9581
|
+
*
|
|
8691
9582
|
* @category Form Validation
|
|
8692
9583
|
*/
|
|
8693
9584
|
const phoneSchema = (defaultCountryCode = "US") => zod.z.string().trim().refine(val => min$3.isValidPhoneNumber(val, defaultCountryCode), "schemaErrors.notAValidPhoneNumber");
|
|
8694
9585
|
/**
|
|
9586
|
+
* @internal
|
|
9587
|
+
*
|
|
9588
|
+
* # Phone utils
|
|
9589
|
+
*
|
|
8695
9590
|
* @category Form Validation
|
|
8696
9591
|
*/
|
|
8697
9592
|
const phoneSchemaUnvalidated = zod.z.string().trim();
|
|
8698
9593
|
|
|
9594
|
+
/**
|
|
9595
|
+
* @internal
|
|
9596
|
+
*
|
|
9597
|
+
* # Add Funds Form Schema
|
|
9598
|
+
*
|
|
9599
|
+
* - A util function to create a dynamic form schema based on the mininum amount
|
|
9600
|
+
* passed into the function.
|
|
9601
|
+
*
|
|
9602
|
+
* @param minimumAmount - The minimum amount that can be added to the account. This defaults to
|
|
9603
|
+
* 10 if nothing is passed in.
|
|
9604
|
+
*/
|
|
8699
9605
|
const getAddFundsSchema = (minimumAmount = 10) => zod.z.object({
|
|
8700
9606
|
funds: moneySchema.extend({
|
|
8701
9607
|
amount: zod.z.number().min(minimumAmount)
|
|
@@ -8703,9 +9609,15 @@ const getAddFundsSchema = (minimumAmount = 10) => zod.z.object({
|
|
|
8703
9609
|
}).transform(data => data.funds);
|
|
8704
9610
|
|
|
8705
9611
|
/**
|
|
8706
|
-
*
|
|
9612
|
+
* @internal
|
|
9613
|
+
*
|
|
9614
|
+
* # Add Funds Form Component
|
|
8707
9615
|
*
|
|
8708
|
-
*
|
|
9616
|
+
* - Form for adding funds to a carrier's account.
|
|
9617
|
+
*
|
|
9618
|
+
* If a `render child` is provided, external control is assumed and the cancel / submit buttons are hidden.
|
|
9619
|
+
*
|
|
9620
|
+
* @see {@link AddFundsFormProps | The props that are passed into the `<AddFundsForm />` component}
|
|
8709
9621
|
*/
|
|
8710
9622
|
const AddFundsForm = ({
|
|
8711
9623
|
carrierId,
|
|
@@ -8847,7 +9759,16 @@ const AddFundsForm = ({
|
|
|
8847
9759
|
}))]
|
|
8848
9760
|
}))]
|
|
8849
9761
|
})]
|
|
8850
|
-
})), children
|
|
9762
|
+
})), !children && addFunds.error && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
9763
|
+
children: [jsxRuntime.jsx(Spacer, {
|
|
9764
|
+
multiplier: 1
|
|
9765
|
+
}), jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
9766
|
+
title: t("manage-funding:addFunds.error.title"),
|
|
9767
|
+
type: giger.NotificationType.ERROR
|
|
9768
|
+
}, {
|
|
9769
|
+
children: addFunds.error[0].message
|
|
9770
|
+
}))]
|
|
9771
|
+
}), children === null || children === void 0 ? void 0 : children({
|
|
8851
9772
|
error: addFunds.error,
|
|
8852
9773
|
isCustomAmount: selectedChip.value === "custom",
|
|
8853
9774
|
isSubmitted,
|
|
@@ -8878,6 +9799,13 @@ const styles$n = createStyles({
|
|
|
8878
9799
|
}
|
|
8879
9800
|
});
|
|
8880
9801
|
|
|
9802
|
+
/**
|
|
9803
|
+
* @internal
|
|
9804
|
+
*
|
|
9805
|
+
* # Auto Funding Form Schema
|
|
9806
|
+
*
|
|
9807
|
+
* @see {@link AutoFundingForm | Auto Funding Form component using this schema}
|
|
9808
|
+
* */
|
|
8881
9809
|
const autoFundingSchema = zod.z.object({
|
|
8882
9810
|
isEnabled: zod.z.boolean(),
|
|
8883
9811
|
lowBalancePurchaseThreshold: moneySchema.extend({
|
|
@@ -8890,10 +9818,19 @@ const autoFundingSchema = zod.z.object({
|
|
|
8890
9818
|
});
|
|
8891
9819
|
|
|
8892
9820
|
/**
|
|
9821
|
+
* @internal
|
|
9822
|
+
*
|
|
9823
|
+
* # Auto Funding Form Component
|
|
9824
|
+
*
|
|
8893
9825
|
* This form that allows users to enable or disable auto funding, and
|
|
8894
9826
|
* configure auto funding rules in ShipEngine API.
|
|
8895
9827
|
*
|
|
8896
9828
|
* @param carrierId The carrierId of the carrier provider you wish to configure auto-funding rules for.
|
|
9829
|
+
*
|
|
9830
|
+
* @returns Element A React element that renders the Auto Funding Form allowing users to configure
|
|
9831
|
+
* auto-funding rules for a given carrier provider.
|
|
9832
|
+
*
|
|
9833
|
+
* @see {@link AutoFundingFormProps | The props that are passed into the `<AutoFundingForm />` component}
|
|
8897
9834
|
*/
|
|
8898
9835
|
const AutoFundingForm = ({
|
|
8899
9836
|
carrierId
|
|
@@ -9070,6 +10007,11 @@ const styles$m = isLabelRight => createStyles({
|
|
|
9070
10007
|
})
|
|
9071
10008
|
});
|
|
9072
10009
|
|
|
10010
|
+
/**
|
|
10011
|
+
* @internal
|
|
10012
|
+
*
|
|
10013
|
+
* # Inline Label Component
|
|
10014
|
+
*/
|
|
9073
10015
|
const InlineLabel = ({
|
|
9074
10016
|
children,
|
|
9075
10017
|
label,
|
|
@@ -9089,6 +10031,16 @@ const styles$l = createStyles({
|
|
|
9089
10031
|
})
|
|
9090
10032
|
});
|
|
9091
10033
|
|
|
10034
|
+
/**
|
|
10035
|
+
* @internal
|
|
10036
|
+
*
|
|
10037
|
+
* # Carrier Balance
|
|
10038
|
+
*
|
|
10039
|
+
* - The `<CarrierBalance />` component is used to display the current balance for a given
|
|
10040
|
+
* carrier provider.
|
|
10041
|
+
*
|
|
10042
|
+
* @see {@link CarrierBalanceProps | The props for the `<CarrierBalance />` component}
|
|
10043
|
+
*/
|
|
9092
10044
|
const CarrierBalance = ({
|
|
9093
10045
|
balance,
|
|
9094
10046
|
carrierId
|
|
@@ -9118,6 +10070,22 @@ const CarrierBalance = ({
|
|
|
9118
10070
|
}));
|
|
9119
10071
|
};
|
|
9120
10072
|
|
|
10073
|
+
/**
|
|
10074
|
+
* @namespace ManageFunding
|
|
10075
|
+
*
|
|
10076
|
+
* # Manage Funding Component
|
|
10077
|
+
*
|
|
10078
|
+
* - The `<ManageFunding />` component is used to manage funding rules and add funds to a carrier
|
|
10079
|
+
* account, and is composed in the `<AccountSettings />` component.
|
|
10080
|
+
*
|
|
10081
|
+
* @param ManageFundingProps The base props that will be passed into the `<ManageFunding />` component.
|
|
10082
|
+
*
|
|
10083
|
+
* @returns Element A React element that renders the `<ManageFunding />` component allowing users
|
|
10084
|
+
* manage funding rules and add funds to their carrier accounts.
|
|
10085
|
+
*
|
|
10086
|
+
* @see {@link ManageFundingProps | The props that are passed into the `<ManageFunding />` component}
|
|
10087
|
+
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<ManageFunding />` component}
|
|
10088
|
+
*/
|
|
9121
10089
|
const ManageFunding = ({
|
|
9122
10090
|
carrierId
|
|
9123
10091
|
}) => {
|
|
@@ -9251,7 +10219,7 @@ const styles$k = createStyles({
|
|
|
9251
10219
|
flex: "1 0 100%"
|
|
9252
10220
|
},
|
|
9253
10221
|
display: "flex",
|
|
9254
|
-
flex: "1 0
|
|
10222
|
+
flex: "1 0 64%",
|
|
9255
10223
|
width: "100%"
|
|
9256
10224
|
},
|
|
9257
10225
|
stateZipWrapper: theme => ({
|
|
@@ -9281,7 +10249,10 @@ const AddressFields = ({
|
|
|
9281
10249
|
const {
|
|
9282
10250
|
t
|
|
9283
10251
|
} = reactI18next.useTranslation();
|
|
9284
|
-
const
|
|
10252
|
+
const {
|
|
10253
|
+
countryCodeOptions,
|
|
10254
|
+
defaultCountryCodeOption
|
|
10255
|
+
} = useCountryCodeOptions(domestic);
|
|
9285
10256
|
const stateCodeOptions = useStateCodeOptions(domestic);
|
|
9286
10257
|
const {
|
|
9287
10258
|
isSubmitted
|
|
@@ -9305,6 +10276,7 @@ const AddressFields = ({
|
|
|
9305
10276
|
nativeLabel: true
|
|
9306
10277
|
}), jsxRuntime.jsx(SelectAutoComplete, {
|
|
9307
10278
|
control: form.control,
|
|
10279
|
+
defaultValue: defaultCountryCodeOption === null || defaultCountryCodeOption === void 0 ? void 0 : defaultCountryCodeOption.value,
|
|
9308
10280
|
form: formId,
|
|
9309
10281
|
label: t("address.fields.countryCode"),
|
|
9310
10282
|
labelWeight: "normal",
|
|
@@ -9453,6 +10425,10 @@ function nullishDefault(defaultValue) {
|
|
|
9453
10425
|
return this.nullish().transform(v => v !== null && v !== void 0 ? v : defaultValue);
|
|
9454
10426
|
}
|
|
9455
10427
|
/**
|
|
10428
|
+
* @internal
|
|
10429
|
+
*
|
|
10430
|
+
* # Form Utilities
|
|
10431
|
+
*
|
|
9456
10432
|
* @category Form Validation
|
|
9457
10433
|
*/
|
|
9458
10434
|
const extendZod = () => {
|
|
@@ -9868,7 +10844,7 @@ const AddressPreferenceSelect = ({
|
|
|
9868
10844
|
warehousePreference: originAddress
|
|
9869
10845
|
})]
|
|
9870
10846
|
})), returnAddress && jsxRuntime.jsxs(giger.GridChild, Object.assign({
|
|
9871
|
-
colSpan:
|
|
10847
|
+
colSpan: 12
|
|
9872
10848
|
}, {
|
|
9873
10849
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
9874
10850
|
css: {
|
|
@@ -9916,6 +10892,7 @@ const AddressPreferenceProvider = props => {
|
|
|
9916
10892
|
onSubmit
|
|
9917
10893
|
} = props;
|
|
9918
10894
|
const [passengerData, setPassengerData] = React.useState();
|
|
10895
|
+
const [userInput, setUserInput] = React.useState();
|
|
9919
10896
|
const {
|
|
9920
10897
|
validate: validateAddress,
|
|
9921
10898
|
validationPreference,
|
|
@@ -9927,6 +10904,7 @@ const AddressPreferenceProvider = props => {
|
|
|
9927
10904
|
onValid,
|
|
9928
10905
|
data
|
|
9929
10906
|
} = payload;
|
|
10907
|
+
setUserInput(addresses);
|
|
9930
10908
|
const validationPreference = yield validateAddress(addresses);
|
|
9931
10909
|
const {
|
|
9932
10910
|
originAddress,
|
|
@@ -9960,6 +10938,7 @@ const AddressPreferenceProvider = props => {
|
|
|
9960
10938
|
return jsxRuntime.jsx(AddressPreferenceContext.Provider, Object.assign({
|
|
9961
10939
|
value: {
|
|
9962
10940
|
data: passengerData,
|
|
10941
|
+
userInput,
|
|
9963
10942
|
validateAddress: internalValidateAddress,
|
|
9964
10943
|
validationPreference
|
|
9965
10944
|
}
|
|
@@ -10213,7 +11192,7 @@ const WalletForm = ({
|
|
|
10213
11192
|
resolver: validationResolver(walletSchema)
|
|
10214
11193
|
});
|
|
10215
11194
|
useBlackboxDetection({
|
|
10216
|
-
onError: () => {
|
|
11195
|
+
onError: React.useCallback(() => {
|
|
10217
11196
|
setCodedErrors(errors => {
|
|
10218
11197
|
const blackBoxError = {
|
|
10219
11198
|
errorCode: "unspecified",
|
|
@@ -10223,8 +11202,8 @@ const WalletForm = ({
|
|
|
10223
11202
|
};
|
|
10224
11203
|
return [...(errors !== null && errors !== void 0 ? errors : []), blackBoxError];
|
|
10225
11204
|
});
|
|
10226
|
-
},
|
|
10227
|
-
onSuccess: bb => form.setValue("iovationBlackbox", bb)
|
|
11205
|
+
}, [setCodedErrors]),
|
|
11206
|
+
onSuccess: React.useCallback(bb => form.setValue("iovationBlackbox", bb), [form.setValue])
|
|
10228
11207
|
});
|
|
10229
11208
|
const watchAddress = form.watch("address");
|
|
10230
11209
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -10620,6 +11599,25 @@ const WalletCard = ({
|
|
|
10620
11599
|
}));
|
|
10621
11600
|
};
|
|
10622
11601
|
|
|
11602
|
+
/**
|
|
11603
|
+
* # Payment Method Settings Component
|
|
11604
|
+
*
|
|
11605
|
+
* - The `<PaymentMethodSettings />` component is used to manage the users payment information
|
|
11606
|
+
* and is composed in the `<AccountSettings />` component. For example, users can update their
|
|
11607
|
+
* billing information.
|
|
11608
|
+
*
|
|
11609
|
+
* @returns Elements A React element that renders the `<PaymentMethodSettings />` component
|
|
11610
|
+
* allowing uses to configure their payment settings.
|
|
11611
|
+
*
|
|
11612
|
+
* @example
|
|
11613
|
+
* ```tsx
|
|
11614
|
+
* <PaymentMethodSettings />
|
|
11615
|
+
* ```
|
|
11616
|
+
*
|
|
11617
|
+
* <br />
|
|
11618
|
+
*
|
|
11619
|
+
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<PaymentMethodSettings />` component}
|
|
11620
|
+
*/
|
|
10623
11621
|
const PaymentMethodSettings = () => {
|
|
10624
11622
|
var _a;
|
|
10625
11623
|
const {
|
|
@@ -10702,6 +11700,14 @@ const styles$f = createStyles({
|
|
|
10702
11700
|
}
|
|
10703
11701
|
});
|
|
10704
11702
|
|
|
11703
|
+
/**
|
|
11704
|
+
* @internal
|
|
11705
|
+
*
|
|
11706
|
+
* # Powered By ShipEngine Component
|
|
11707
|
+
*
|
|
11708
|
+
* - The `<PoweredByShipEngine />` composition component is used to render the
|
|
11709
|
+
* "Powered By ShipEngine" logo throughout the various elements.
|
|
11710
|
+
*/
|
|
10705
11711
|
const PoweredByShipEngine = () => {
|
|
10706
11712
|
const {
|
|
10707
11713
|
t
|
|
@@ -10717,6 +11723,11 @@ const PoweredByShipEngine = () => {
|
|
|
10717
11723
|
}));
|
|
10718
11724
|
};
|
|
10719
11725
|
|
|
11726
|
+
/**
|
|
11727
|
+
* @namespace UnitSettings
|
|
11728
|
+
*
|
|
11729
|
+
* # Unit Settings Component
|
|
11730
|
+
*/
|
|
10720
11731
|
const UnitSettings = () => {
|
|
10721
11732
|
const {
|
|
10722
11733
|
t
|
|
@@ -11673,7 +12684,9 @@ const CustomsItemForm = ({
|
|
|
11673
12684
|
const {
|
|
11674
12685
|
t
|
|
11675
12686
|
} = reactI18next.useTranslation();
|
|
11676
|
-
const
|
|
12687
|
+
const {
|
|
12688
|
+
countryCodeOptions
|
|
12689
|
+
} = useCountryCodeOptions();
|
|
11677
12690
|
const form = reactHookForm.useForm({
|
|
11678
12691
|
defaultValues: customsItem ? {
|
|
11679
12692
|
countryOfOrigin: customsItem.countryOfOrigin,
|
|
@@ -11779,6 +12792,10 @@ const CustomsItemForm = ({
|
|
|
11779
12792
|
};
|
|
11780
12793
|
|
|
11781
12794
|
/**
|
|
12795
|
+
* @internal
|
|
12796
|
+
*
|
|
12797
|
+
* # Copy Button
|
|
12798
|
+
*
|
|
11782
12799
|
* A copy button that copies the content to the users' clipboard and displays a
|
|
11783
12800
|
* checkmark on click.
|
|
11784
12801
|
*/
|
|
@@ -12351,12 +13368,15 @@ const WarehouseForm = ({
|
|
|
12351
13368
|
submitButtonTitle,
|
|
12352
13369
|
warehouse
|
|
12353
13370
|
}) => {
|
|
13371
|
+
var _a, _b;
|
|
12354
13372
|
const {
|
|
12355
13373
|
t
|
|
12356
13374
|
} = reactI18next.useTranslation(["common", "manage-warehouses"]);
|
|
12357
13375
|
const {
|
|
12358
|
-
validateAddress
|
|
13376
|
+
validateAddress,
|
|
13377
|
+
userInput
|
|
12359
13378
|
} = useAddressPreference();
|
|
13379
|
+
const hasDefaultValues = !!warehouse || !!userInput;
|
|
12360
13380
|
const form = reactHookForm.useForm({
|
|
12361
13381
|
defaultValues: warehouse ? Object.assign(Object.assign({}, warehouse), {
|
|
12362
13382
|
isDefault: warehouse.isDefault,
|
|
@@ -12367,6 +13387,14 @@ const WarehouseForm = ({
|
|
|
12367
13387
|
countryCode: warehouse.returnAddress.countryCode
|
|
12368
13388
|
}),
|
|
12369
13389
|
returnToAddressIsDifferent: !_$3.isEqual(warehouse.originAddress, warehouse.returnAddress)
|
|
13390
|
+
}) : userInput ? Object.assign(Object.assign({}, userInput), {
|
|
13391
|
+
originAddress: Object.assign(Object.assign({}, userInput.originAddress), {
|
|
13392
|
+
countryCode: userInput.originAddress.countryCode
|
|
13393
|
+
}),
|
|
13394
|
+
returnAddress: Object.assign(Object.assign({}, userInput.returnAddress), {
|
|
13395
|
+
countryCode: (_a = userInput.returnAddress) === null || _a === void 0 ? void 0 : _a.countryCode
|
|
13396
|
+
}),
|
|
13397
|
+
returnToAddressIsDifferent: (_b = !!userInput.returnAddress) !== null && _b !== void 0 ? _b : false
|
|
12370
13398
|
}) : {
|
|
12371
13399
|
isDefault: _isOnboarding ? true : false,
|
|
12372
13400
|
originAddress: {
|
|
@@ -12377,8 +13405,8 @@ const WarehouseForm = ({
|
|
|
12377
13405
|
resolver: validationResolver(warehouseSchema)
|
|
12378
13406
|
});
|
|
12379
13407
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
12380
|
-
const
|
|
12381
|
-
payload = __rest(
|
|
13408
|
+
const _c = values,
|
|
13409
|
+
payload = __rest(_c, ["returnToAddressIsDifferent"]);
|
|
12382
13410
|
yield validateAddress({
|
|
12383
13411
|
addresses: payload,
|
|
12384
13412
|
data: {
|
|
@@ -12407,12 +13435,6 @@ const WarehouseForm = ({
|
|
|
12407
13435
|
form: form,
|
|
12408
13436
|
formatFieldName: fieldName => `originAddress.${fieldName}`,
|
|
12409
13437
|
optionalFields: ["addressLine2"]
|
|
12410
|
-
}), jsxRuntime.jsx(CheckboxInput, {
|
|
12411
|
-
checkboxLabel: t("manage-warehouses:residentialAddress"),
|
|
12412
|
-
control: form.control,
|
|
12413
|
-
form: "warehouse-form",
|
|
12414
|
-
label: "originAddress.addressResidentialIndicator",
|
|
12415
|
-
name: "originAddress.addressResidentialIndicator"
|
|
12416
13438
|
}), !_isOnboarding && jsxRuntime.jsx(CheckboxInput, {
|
|
12417
13439
|
checkboxLabel: t("manage-warehouses:isDefault"),
|
|
12418
13440
|
control: form.control,
|
|
@@ -12440,18 +13462,12 @@ const WarehouseForm = ({
|
|
|
12440
13462
|
});
|
|
12441
13463
|
}
|
|
12442
13464
|
}
|
|
12443
|
-
}), form.watch("returnToAddressIsDifferent") && jsxRuntime.
|
|
12444
|
-
children:
|
|
13465
|
+
}), form.watch("returnToAddressIsDifferent") && jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
13466
|
+
children: jsxRuntime.jsx(AddressFields, {
|
|
12445
13467
|
form: form,
|
|
12446
13468
|
formatFieldName: fieldName => `returnAddress.${fieldName}`,
|
|
12447
13469
|
optionalFields: ["addressLine2"]
|
|
12448
|
-
})
|
|
12449
|
-
checkboxLabel: t("manage-warehouses:residentialAddress"),
|
|
12450
|
-
control: form.control,
|
|
12451
|
-
form: "warehouse-form",
|
|
12452
|
-
label: "returnAddress.addressResidentialIndicator",
|
|
12453
|
-
name: "returnAddress.addressResidentialIndicator"
|
|
12454
|
-
})]
|
|
13470
|
+
})
|
|
12455
13471
|
}), jsxRuntime.jsxs(ButtonGroup, Object.assign({
|
|
12456
13472
|
justify: "center"
|
|
12457
13473
|
}, {
|
|
@@ -12476,7 +13492,7 @@ const WarehouseForm = ({
|
|
|
12476
13492
|
control: form.control,
|
|
12477
13493
|
"data-testid": "warehouseFormSubmitButton",
|
|
12478
13494
|
form: "warehouse-form",
|
|
12479
|
-
requireDirty: !
|
|
13495
|
+
requireDirty: !hasDefaultValues,
|
|
12480
13496
|
variant: _isOnboarding ? giger.ButtonVariant.FILLED : giger.ButtonVariant.OUTLINED
|
|
12481
13497
|
}, {
|
|
12482
13498
|
children: submitButtonTitle
|
|
@@ -13075,6 +14091,15 @@ const Onboarding = ({
|
|
|
13075
14091
|
let _ = t => t,
|
|
13076
14092
|
_t,
|
|
13077
14093
|
_t2;
|
|
14094
|
+
/**
|
|
14095
|
+
* @internal
|
|
14096
|
+
*
|
|
14097
|
+
* # Cube Component
|
|
14098
|
+
*
|
|
14099
|
+
* - This is a spinning cube that is used to display a loading state.
|
|
14100
|
+
*
|
|
14101
|
+
* @see {@link CubePropTypes | The props that are passed into the `<Cube />` component}
|
|
14102
|
+
*/
|
|
13078
14103
|
const Cube = _a => {
|
|
13079
14104
|
var {
|
|
13080
14105
|
animate = false
|
|
@@ -13102,7 +14127,7 @@ const Cube = _a => {
|
|
|
13102
14127
|
const styles = {
|
|
13103
14128
|
bounce: /*#__PURE__*/react.css(Object.assign({}, animate && {
|
|
13104
14129
|
animation: `${bounce} 1s infinite`
|
|
13105
|
-
}), process.env.NODE_ENV === "production" ? "" : ";label:bounce;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
14130
|
+
}), process.env.NODE_ENV === "production" ? "" : ";label:bounce;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImN1YmUudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWtDZ0IiLCJmaWxlIjoiY3ViZS50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBfX3Jlc3QgfSBmcm9tIFwidHNsaWJcIjtcclxuaW1wb3J0IHsganN4IGFzIF9qc3ggfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3QvanN4LXJ1bnRpbWVcIjtcclxuaW1wb3J0IHsgY3NzLCBrZXlmcmFtZXMsIHVzZVRoZW1lIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XHJcbi8qKlxyXG4gKiBAaW50ZXJuYWxcclxuICpcclxuICogIyBDdWJlIENvbXBvbmVudFxyXG4gKlxyXG4gKiAtIFRoaXMgaXMgYSBzcGlubmluZyBjdWJlIHRoYXQgaXMgdXNlZCB0byBkaXNwbGF5IGEgbG9hZGluZyBzdGF0ZS5cclxuICpcclxuICogQHNlZSB7QGxpbmsgQ3ViZVByb3BUeXBlcyB8IFRoZSBwcm9wcyB0aGF0IGFyZSBwYXNzZWQgaW50byB0aGUgYDxDdWJlIC8+YCBjb21wb25lbnR9XHJcbiAqL1xyXG5leHBvcnQgY29uc3QgQ3ViZSA9IChfYSkgPT4ge1xyXG4gICAgdmFyIHsgYW5pbWF0ZSA9IGZhbHNlIH0gPSBfYSwgcHJvcHMgPSBfX3Jlc3QoX2EsIFtcImFuaW1hdGVcIl0pO1xyXG4gICAgY29uc3QgdGhlbWUgPSB1c2VUaGVtZSgpO1xyXG4gICAgY29uc3QgYm91bmNlID0ga2V5ZnJhbWVzIGBcbiAgICAwJSwgMTAwJSB7XG4gICAgICB0cmFuc2Zvcm06IHRyYW5zbGF0ZVkoLTI1JSk7XG4gICAgICBhbmltYXRpb24tdGltaW5nLWZ1bmN0aW9uOiBjdWJpYy1iZXppZXIoMC44LCAwLCAxLCAxKTtcbiAgICB9XG4gICAgNTAlIHtcbiAgICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgwKTtcbiAgICAgIGFuaW1hdGlvbi10aW1pbmctZnVuY3Rpb246IGN1YmljLWJlemllcigwLCAwLCAwLjIsIDEpO1xuICAgIH1cbiAgYDtcclxuICAgIGNvbnN0IHNwaW4gPSBrZXlmcmFtZXMgYFxuICAgIGZyb20ge1xuICAgICAgdHJhbnNmb3JtOiByb3RhdGUoMGRlZyk7XG4gICAgfVxuICAgIHRvIHtcbiAgICAgIHRyYW5zZm9ybTogcm90YXRlKDM2MGRlZyk7XG4gICAgfVxuICBgO1xyXG4gICAgY29uc3Qgc3R5bGVzID0ge1xyXG4gICAgICAgIGJvdW5jZTogY3NzKE9iamVjdC5hc3NpZ24oe30sIChhbmltYXRlICYmIHsgYW5pbWF0aW9uOiBgJHtib3VuY2V9IDFzIGluZmluaXRlYCB9KSkpLFxyXG4gICAgICAgIGNvbnRlbnQ6IGNzcyhPYmplY3QuYXNzaWduKHsgY2xpcFJ1bGU6IFwiZXZlbm9kZFwiLCBmaWxsUnVsZTogXCJldmVub2RkXCIsIGhlaWdodDogXCI1cmVtXCIsIHN0cm9rZUxpbmVKb2luOiBcInJvdW5kXCIsIHN0cm9rZU1pdGVyTGltaXQ6IFwiMlwiLCB3aWR0aDogXCI1cmVtXCIgfSwgKGFuaW1hdGUgJiYgeyBhbmltYXRpb246IGAke3NwaW59IDFzIGxpbmVhciBpbmZpbml0ZTtgIH0pKSksXHJcbiAgICB9O1xyXG4gICAgcmV0dXJuIChfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IHN0eWxlcy5ib3VuY2UgfSwgcHJvcHMsIHsgcm9sZTogXCJzdGF0dXNcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwic3ZnXCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IHN0eWxlcy5jb250ZW50LCBoZWlnaHQ6IFwiMTAwJVwiLCB2aWV3Qm94OiBcIjAgMCA0ODkgNDg5XCIsIHdpZHRoOiBcIjEwMCVcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwiZ1wiLCB7IGNoaWxkcmVuOiBfanN4KFwiZ1wiLCB7IGNoaWxkcmVuOiBfanN4KFwicGF0aFwiLCB7IGQ6IFwiTTQ4My42NzQsMTAxLjgzNkM0ODMuNjEsMTAxLjYwNCA0ODMuNTA2LDEwMS4zOTYgNDgzLjQxOCwxMDEuMThDNDgzLjI0MiwxMDAuNzI0IDQ4My4wNSwxMDAuMjg0IDQ4Mi43OTQsOTkuODY4QzQ4Mi42NSw5OS42MzYgNDgyLjQ5OCw5OS40MjggNDgyLjMzLDk5LjIxMkM0ODIuMDU4LDk4Ljg0NCA0ODEuNzU0LDk4LjUwOCA0ODEuNDEsOTguMTk2QzQ4MS4yMSw5OC4wMDQgNDgxLjAxLDk3LjgyOCA0ODAuNzg2LDk3LjY2QzQ4MC42NTgsOTcuNTY0IDQ4MC41NjIsOTcuNDQ0IDQ4MC40MzQsOTcuMzU2QzQ4MC4xMzgsOTcuMTU2IDQ3OS44MSw5Ny4wNDQgNDc5LjQ5OCw5Ni44ODRDNDc5LjMzOCw5Ni44MDQgNDc5LjIxOCw5Ni42ODQgNDc5LjA1LDk2LjYxMkwyNDcuMDUsMC42MTJDMjQ1LjA4MiwtMC4yMDQgMjQyLjg5LC0wLjIwNCAyNDAuOTIyLDAuNjEyTDguOTIyLDk2LjYxMkM4Ljc1NCw5Ni42ODQgOC42MjYsOTYuODA0IDguNDY2LDk2Ljg4NEM4LjE1NCw5Ny4wMzYgNy44MzQsOTcuMTU2IDcuNTQ2LDk3LjM0OEM3LjQxOCw5Ny40MzYgNy4zMjIsOTcuNTU2IDcuMTk0LDk3LjY1MkM2Ljk3LDk3LjgyIDYuNzc4LDk4LjAwNCA2LjU3OCw5OC4xODhDNi4yNDIsOTguNSA1LjkzOCw5OC44MzYgNS42NTgsOTkuMjA0QzUuNDksOTkuNDIgNS4zMzgsOTkuNjI4IDUuMTk0LDk5Ljg2QzQuOTM4LDEwMC4yNzYgNC43NDYsMTAwLjcxNiA0LjU3LDEwMS4xNzJDNC40ODIsMTAxLjM5NiA0LjM3OCwxMDEuNTk2IDQuMzE0LDEwMS44MjhDNC4xMywxMDIuNTMyIDQuMDAyLDEwMy4yNiA0LjAwMiwxMDQuMDA0TDQuMDAyLDM4NC4wMDRDNC4wMDIsMzg3LjI0NCA1Ljk1NCwzOTAuMTY0IDguOTM4LDM5MS4zOTZMMjQwLjkzOCw0ODcuMzk2QzI0MS4wNDIsNDg3LjQzNiAyNDEuMTU0LDQ4Ny40MiAyNDEuMjU4LDQ4Ny40NkMyNDIuMTQ2LDQ4Ny43ODggMjQzLjA1OCw0ODguMDA0IDI0NC4wMDIsNDg4LjAwNEMyNDQuOTQ2LDQ4OC4wMDQgMjQ1Ljg1OCw0ODcuNzg4IDI0Ni43NDYsNDg3LjQ2QzI0Ni44NSw0ODcuNDIgMjQ2Ljk2Miw0ODcuNDM2IDI0Ny4wNjYsNDg3LjM5Nkw0NzkuMDY2LDM5MS4zOTZDNDgyLjA1LDM5MC4xNjQgNDg0LjAwMiwzODcuMjQ0IDQ4NC4wMDIsMzg0LjAwNEw0ODQuMDAyLDEwNC4wMDRDNDg0LjAwMiwxMDMuMjYgNDgzLjg3NCwxMDIuNTMyIDQ4My42NzQsMTAxLjgzNlpNMjM2LjAwMiw0NjguMDI4TDIwLjAwMiwzNzguNjZMMjAuMDAyLDExNS45NzJMMjM2LjAwMiwyMDUuMzQ4TDIzNi4wMDIsNDY4LjAyOFpNMjQ0LjAwMiwxOTEuMzQ4TDMyLjkyMiwxMDQuMDA0TDI0NC4wMDIsMTYuNjZMNDU1LjA4MiwxMDQuMDA0TDI0NC4wMDIsMTkxLjM0OFpNNDY4LjAwMiwzNzguNjZMMjUyLjAwMiw0NjguMDM2TDI1Mi4wMDIsMjA1LjM0OEw0NjguMDAyLDExNS45NzJMNDY4LjAwMiwzNzguNjZaXCIsIGZpbGw6IHRoZW1lLnBhbGV0dGUucHJpbWFyeS5tYWluIH0pIH0pIH0pIH0pKSB9KSkpO1xyXG59O1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1jdWJlLmpzLm1hcCJdfQ== */"),
|
|
13106
14131
|
content: /*#__PURE__*/react.css(Object.assign({
|
|
13107
14132
|
clipRule: "evenodd",
|
|
13108
14133
|
fillRule: "evenodd",
|
|
@@ -13112,7 +14137,7 @@ const Cube = _a => {
|
|
|
13112
14137
|
width: "5rem"
|
|
13113
14138
|
}, animate && {
|
|
13114
14139
|
animation: `${spin} 1s linear infinite;`
|
|
13115
|
-
}), process.env.NODE_ENV === "production" ? "" : ";label:content;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
14140
|
+
}), process.env.NODE_ENV === "production" ? "" : ";label:content;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImN1YmUudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQW1DaUIiLCJmaWxlIjoiY3ViZS50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBfX3Jlc3QgfSBmcm9tIFwidHNsaWJcIjtcclxuaW1wb3J0IHsganN4IGFzIF9qc3ggfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3QvanN4LXJ1bnRpbWVcIjtcclxuaW1wb3J0IHsgY3NzLCBrZXlmcmFtZXMsIHVzZVRoZW1lIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XHJcbi8qKlxyXG4gKiBAaW50ZXJuYWxcclxuICpcclxuICogIyBDdWJlIENvbXBvbmVudFxyXG4gKlxyXG4gKiAtIFRoaXMgaXMgYSBzcGlubmluZyBjdWJlIHRoYXQgaXMgdXNlZCB0byBkaXNwbGF5IGEgbG9hZGluZyBzdGF0ZS5cclxuICpcclxuICogQHNlZSB7QGxpbmsgQ3ViZVByb3BUeXBlcyB8IFRoZSBwcm9wcyB0aGF0IGFyZSBwYXNzZWQgaW50byB0aGUgYDxDdWJlIC8+YCBjb21wb25lbnR9XHJcbiAqL1xyXG5leHBvcnQgY29uc3QgQ3ViZSA9IChfYSkgPT4ge1xyXG4gICAgdmFyIHsgYW5pbWF0ZSA9IGZhbHNlIH0gPSBfYSwgcHJvcHMgPSBfX3Jlc3QoX2EsIFtcImFuaW1hdGVcIl0pO1xyXG4gICAgY29uc3QgdGhlbWUgPSB1c2VUaGVtZSgpO1xyXG4gICAgY29uc3QgYm91bmNlID0ga2V5ZnJhbWVzIGBcbiAgICAwJSwgMTAwJSB7XG4gICAgICB0cmFuc2Zvcm06IHRyYW5zbGF0ZVkoLTI1JSk7XG4gICAgICBhbmltYXRpb24tdGltaW5nLWZ1bmN0aW9uOiBjdWJpYy1iZXppZXIoMC44LCAwLCAxLCAxKTtcbiAgICB9XG4gICAgNTAlIHtcbiAgICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgwKTtcbiAgICAgIGFuaW1hdGlvbi10aW1pbmctZnVuY3Rpb246IGN1YmljLWJlemllcigwLCAwLCAwLjIsIDEpO1xuICAgIH1cbiAgYDtcclxuICAgIGNvbnN0IHNwaW4gPSBrZXlmcmFtZXMgYFxuICAgIGZyb20ge1xuICAgICAgdHJhbnNmb3JtOiByb3RhdGUoMGRlZyk7XG4gICAgfVxuICAgIHRvIHtcbiAgICAgIHRyYW5zZm9ybTogcm90YXRlKDM2MGRlZyk7XG4gICAgfVxuICBgO1xyXG4gICAgY29uc3Qgc3R5bGVzID0ge1xyXG4gICAgICAgIGJvdW5jZTogY3NzKE9iamVjdC5hc3NpZ24oe30sIChhbmltYXRlICYmIHsgYW5pbWF0aW9uOiBgJHtib3VuY2V9IDFzIGluZmluaXRlYCB9KSkpLFxyXG4gICAgICAgIGNvbnRlbnQ6IGNzcyhPYmplY3QuYXNzaWduKHsgY2xpcFJ1bGU6IFwiZXZlbm9kZFwiLCBmaWxsUnVsZTogXCJldmVub2RkXCIsIGhlaWdodDogXCI1cmVtXCIsIHN0cm9rZUxpbmVKb2luOiBcInJvdW5kXCIsIHN0cm9rZU1pdGVyTGltaXQ6IFwiMlwiLCB3aWR0aDogXCI1cmVtXCIgfSwgKGFuaW1hdGUgJiYgeyBhbmltYXRpb246IGAke3NwaW59IDFzIGxpbmVhciBpbmZpbml0ZTtgIH0pKSksXHJcbiAgICB9O1xyXG4gICAgcmV0dXJuIChfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IHN0eWxlcy5ib3VuY2UgfSwgcHJvcHMsIHsgcm9sZTogXCJzdGF0dXNcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwic3ZnXCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IHN0eWxlcy5jb250ZW50LCBoZWlnaHQ6IFwiMTAwJVwiLCB2aWV3Qm94OiBcIjAgMCA0ODkgNDg5XCIsIHdpZHRoOiBcIjEwMCVcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwiZ1wiLCB7IGNoaWxkcmVuOiBfanN4KFwiZ1wiLCB7IGNoaWxkcmVuOiBfanN4KFwicGF0aFwiLCB7IGQ6IFwiTTQ4My42NzQsMTAxLjgzNkM0ODMuNjEsMTAxLjYwNCA0ODMuNTA2LDEwMS4zOTYgNDgzLjQxOCwxMDEuMThDNDgzLjI0MiwxMDAuNzI0IDQ4My4wNSwxMDAuMjg0IDQ4Mi43OTQsOTkuODY4QzQ4Mi42NSw5OS42MzYgNDgyLjQ5OCw5OS40MjggNDgyLjMzLDk5LjIxMkM0ODIuMDU4LDk4Ljg0NCA0ODEuNzU0LDk4LjUwOCA0ODEuNDEsOTguMTk2QzQ4MS4yMSw5OC4wMDQgNDgxLjAxLDk3LjgyOCA0ODAuNzg2LDk3LjY2QzQ4MC42NTgsOTcuNTY0IDQ4MC41NjIsOTcuNDQ0IDQ4MC40MzQsOTcuMzU2QzQ4MC4xMzgsOTcuMTU2IDQ3OS44MSw5Ny4wNDQgNDc5LjQ5OCw5Ni44ODRDNDc5LjMzOCw5Ni44MDQgNDc5LjIxOCw5Ni42ODQgNDc5LjA1LDk2LjYxMkwyNDcuMDUsMC42MTJDMjQ1LjA4MiwtMC4yMDQgMjQyLjg5LC0wLjIwNCAyNDAuOTIyLDAuNjEyTDguOTIyLDk2LjYxMkM4Ljc1NCw5Ni42ODQgOC42MjYsOTYuODA0IDguNDY2LDk2Ljg4NEM4LjE1NCw5Ny4wMzYgNy44MzQsOTcuMTU2IDcuNTQ2LDk3LjM0OEM3LjQxOCw5Ny40MzYgNy4zMjIsOTcuNTU2IDcuMTk0LDk3LjY1MkM2Ljk3LDk3LjgyIDYuNzc4LDk4LjAwNCA2LjU3OCw5OC4xODhDNi4yNDIsOTguNSA1LjkzOCw5OC44MzYgNS42NTgsOTkuMjA0QzUuNDksOTkuNDIgNS4zMzgsOTkuNjI4IDUuMTk0LDk5Ljg2QzQuOTM4LDEwMC4yNzYgNC43NDYsMTAwLjcxNiA0LjU3LDEwMS4xNzJDNC40ODIsMTAxLjM5NiA0LjM3OCwxMDEuNTk2IDQuMzE0LDEwMS44MjhDNC4xMywxMDIuNTMyIDQuMDAyLDEwMy4yNiA0LjAwMiwxMDQuMDA0TDQuMDAyLDM4NC4wMDRDNC4wMDIsMzg3LjI0NCA1Ljk1NCwzOTAuMTY0IDguOTM4LDM5MS4zOTZMMjQwLjkzOCw0ODcuMzk2QzI0MS4wNDIsNDg3LjQzNiAyNDEuMTU0LDQ4Ny40MiAyNDEuMjU4LDQ4Ny40NkMyNDIuMTQ2LDQ4Ny43ODggMjQzLjA1OCw0ODguMDA0IDI0NC4wMDIsNDg4LjAwNEMyNDQuOTQ2LDQ4OC4wMDQgMjQ1Ljg1OCw0ODcuNzg4IDI0Ni43NDYsNDg3LjQ2QzI0Ni44NSw0ODcuNDIgMjQ2Ljk2Miw0ODcuNDM2IDI0Ny4wNjYsNDg3LjM5Nkw0NzkuMDY2LDM5MS4zOTZDNDgyLjA1LDM5MC4xNjQgNDg0LjAwMiwzODcuMjQ0IDQ4NC4wMDIsMzg0LjAwNEw0ODQuMDAyLDEwNC4wMDRDNDg0LjAwMiwxMDMuMjYgNDgzLjg3NCwxMDIuNTMyIDQ4My42NzQsMTAxLjgzNlpNMjM2LjAwMiw0NjguMDI4TDIwLjAwMiwzNzguNjZMMjAuMDAyLDExNS45NzJMMjM2LjAwMiwyMDUuMzQ4TDIzNi4wMDIsNDY4LjAyOFpNMjQ0LjAwMiwxOTEuMzQ4TDMyLjkyMiwxMDQuMDA0TDI0NC4wMDIsMTYuNjZMNDU1LjA4MiwxMDQuMDA0TDI0NC4wMDIsMTkxLjM0OFpNNDY4LjAwMiwzNzguNjZMMjUyLjAwMiw0NjguMDM2TDI1Mi4wMDIsMjA1LjM0OEw0NjguMDAyLDExNS45NzJMNDY4LjAwMiwzNzguNjZaXCIsIGZpbGw6IHRoZW1lLnBhbGV0dGUucHJpbWFyeS5tYWluIH0pIH0pIH0pIH0pKSB9KSkpO1xyXG59O1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1jdWJlLmpzLm1hcCJdfQ== */")
|
|
13116
14141
|
};
|
|
13117
14142
|
return jsxRuntime.jsx("div", Object.assign({
|
|
13118
14143
|
css: styles.bounce
|
|
@@ -13172,6 +14197,11 @@ const styles$5 = createStyles({
|
|
|
13172
14197
|
})
|
|
13173
14198
|
});
|
|
13174
14199
|
|
|
14200
|
+
/**
|
|
14201
|
+
* @internal
|
|
14202
|
+
*
|
|
14203
|
+
* # Section Component
|
|
14204
|
+
*/
|
|
13175
14205
|
const Section = _a => {
|
|
13176
14206
|
var {
|
|
13177
14207
|
bold,
|
|
@@ -13230,9 +14260,15 @@ const styles$4 = createStyles({
|
|
|
13230
14260
|
});
|
|
13231
14261
|
|
|
13232
14262
|
/**
|
|
14263
|
+
* @internal
|
|
14264
|
+
*
|
|
14265
|
+
* # Fund And Purchase Component
|
|
14266
|
+
*
|
|
13233
14267
|
* Fund and Purchase handles the label purchase submission UX, ensuring that a user
|
|
13234
14268
|
* has the necessary funds available and can add them if not. It allows a single button
|
|
13235
14269
|
* to submit the funding form followed by the purchase form.
|
|
14270
|
+
*
|
|
14271
|
+
* @see {@link FundAndPurchaseProps | The props that are passed into the `<FundAndPurchase />` component}
|
|
13236
14272
|
*/
|
|
13237
14273
|
const FundAndPurchase = ({
|
|
13238
14274
|
balance: uspsBalance,
|
|
@@ -13461,7 +14497,7 @@ const RateForm = ({
|
|
|
13461
14497
|
carriers,
|
|
13462
14498
|
disabled,
|
|
13463
14499
|
errors,
|
|
13464
|
-
|
|
14500
|
+
displayableRateErrors,
|
|
13465
14501
|
displayableLabelErrors,
|
|
13466
14502
|
features,
|
|
13467
14503
|
labelErrors,
|
|
@@ -13475,7 +14511,7 @@ const RateForm = ({
|
|
|
13475
14511
|
shipment,
|
|
13476
14512
|
outOfBandDisplayableErrors
|
|
13477
14513
|
}) => {
|
|
13478
|
-
var _a, _b, _c, _d, _e;
|
|
14514
|
+
var _a, _b, _c, _d, _e, _f;
|
|
13479
14515
|
features = Object.assign({
|
|
13480
14516
|
presentation: {
|
|
13481
14517
|
poweredByShipEngine: false
|
|
@@ -13487,7 +14523,7 @@ const RateForm = ({
|
|
|
13487
14523
|
saveRate: true
|
|
13488
14524
|
}
|
|
13489
14525
|
}, features !== null && features !== void 0 ? features : {});
|
|
13490
|
-
const allDisplayableErrors = [...(
|
|
14526
|
+
const allDisplayableErrors = [...(displayableRateErrors !== null && displayableRateErrors !== void 0 ? displayableRateErrors : []), ...(outOfBandDisplayableErrors !== null && outOfBandDisplayableErrors !== void 0 ? outOfBandDisplayableErrors : [])];
|
|
13491
14527
|
const {
|
|
13492
14528
|
t
|
|
13493
14529
|
} = reactI18next.useTranslation();
|
|
@@ -13522,7 +14558,7 @@ const RateForm = ({
|
|
|
13522
14558
|
});
|
|
13523
14559
|
}
|
|
13524
14560
|
})));
|
|
13525
|
-
const rateOptions = useRateOptions(rates, carriers, shipment, !!((_a = features === null || features === void 0 ? void 0 : features.rateForm) === null || _a === void 0 ? void 0 : _a.enableGlobalPostFiltering));
|
|
14561
|
+
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));
|
|
13526
14562
|
// Return true if User has multiple accounts for a single carrier.
|
|
13527
14563
|
const hasDuplicateCarrierCode = carriers => {
|
|
13528
14564
|
const uniqueCarrierCodes = new Set();
|
|
@@ -13598,7 +14634,7 @@ const RateForm = ({
|
|
|
13598
14634
|
name: "rate",
|
|
13599
14635
|
nicknameFeature:
|
|
13600
14636
|
// if feature flag is on, and if account has duplicate carrierCodes, then show nickname
|
|
13601
|
-
((
|
|
14637
|
+
((_c = features === null || features === void 0 ? void 0 : features.rateForm) === null || _c === void 0 ? void 0 : _c.nicknameRate) && carriers && hasDuplicateCarrierCode(carriers),
|
|
13602
14638
|
onClick: onSelectRate,
|
|
13603
14639
|
options: showHiddenRates ? rateOptions : filteredRateOptions
|
|
13604
14640
|
}), rateOptions.some(option => option.requiresAcknowledgement) && rateOptions.length > 5 && jsxRuntime.jsx(giger.Link, Object.assign({
|
|
@@ -13636,10 +14672,10 @@ const RateForm = ({
|
|
|
13636
14672
|
type: giger.NotificationType.ERROR
|
|
13637
14673
|
}, {
|
|
13638
14674
|
children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
13639
|
-
children: [
|
|
14675
|
+
children: [displayableRateErrors, outOfBandDisplayableErrors, displayableLabelErrors]
|
|
13640
14676
|
})
|
|
13641
14677
|
}))]
|
|
13642
|
-
})), ((
|
|
14678
|
+
})), ((_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) && jsxRuntime.jsx(Section, Object.assign({
|
|
13643
14679
|
title: t("manage-defaults:label.title")
|
|
13644
14680
|
}, {
|
|
13645
14681
|
children: jsxRuntime.jsx(LabelLayout, {
|
|
@@ -13651,12 +14687,12 @@ const RateForm = ({
|
|
|
13651
14687
|
control: form.control,
|
|
13652
14688
|
css: styles$3.fundAndPurchase,
|
|
13653
14689
|
disabled: disabled,
|
|
13654
|
-
isFundingEnabled: !!((
|
|
14690
|
+
isFundingEnabled: !!((_e = features === null || features === void 0 ? void 0 : features.rateForm) === null || _e === void 0 ? void 0 : _e.enableFunding),
|
|
13655
14691
|
isFundingRequired: (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.balance) !== undefined && !!selectedRate.requiresFundedAmount,
|
|
13656
14692
|
onPurchase: handleSubmit,
|
|
13657
14693
|
onSave: handleSaveRate,
|
|
13658
14694
|
purchaseAmount: getTotalRateAmount(selectedRate)
|
|
13659
|
-
}), ((
|
|
14695
|
+
}), ((_f = features === null || features === void 0 ? void 0 : features.presentation) === null || _f === void 0 ? void 0 : _f.poweredByShipEngine) && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
13660
14696
|
children: [jsxRuntime.jsx(Spacer, {}), jsxRuntime.jsx(PoweredByShipEngine, {})]
|
|
13661
14697
|
})]
|
|
13662
14698
|
}));
|
|
@@ -13728,6 +14764,11 @@ const ItemsBreakdownTableHeader = ({
|
|
|
13728
14764
|
}))]
|
|
13729
14765
|
})
|
|
13730
14766
|
});
|
|
14767
|
+
/**
|
|
14768
|
+
* @internal
|
|
14769
|
+
*
|
|
14770
|
+
* # Items Breakdown Component
|
|
14771
|
+
*/
|
|
13731
14772
|
const ItemsBreakdown = ({
|
|
13732
14773
|
items
|
|
13733
14774
|
}) => {
|
|
@@ -14062,10 +15103,12 @@ const CustomsItemsDisplay = ({
|
|
|
14062
15103
|
extendZod();
|
|
14063
15104
|
const getShipmentSchema = ({
|
|
14064
15105
|
allowInternationalShipFrom,
|
|
14065
|
-
|
|
14066
|
-
requireMeasurements: _requireMeasurements = false,
|
|
15106
|
+
dimensionsUnit,
|
|
14067
15107
|
isContentDescriptionRequired: _isContentDescriptionRequired = false,
|
|
14068
|
-
isCustomsRequired: _isCustomsRequired = false
|
|
15108
|
+
isCustomsRequired: _isCustomsRequired = false,
|
|
15109
|
+
requireMeasurements: _requireMeasurements = false,
|
|
15110
|
+
warehouses,
|
|
15111
|
+
weightUnit
|
|
14069
15112
|
} = {}) => {
|
|
14070
15113
|
const baseSchema = zod.z.object({
|
|
14071
15114
|
advancedOptions: zod.z.object({
|
|
@@ -14096,7 +15139,9 @@ const getShipmentSchema = ({
|
|
|
14096
15139
|
height: zod.z.number().nonnegative().nullishDefault(0),
|
|
14097
15140
|
length: zod.z.number().nonnegative().nullishDefault(0),
|
|
14098
15141
|
width: zod.z.number().nonnegative().nullishDefault(0)
|
|
14099
|
-
}).nullish()).transform(dims => dims ? convertDimensions(dims)
|
|
15142
|
+
}).nullish()).transform(dims => dims ? convertDimensions(Object.assign(Object.assign({}, dims), {
|
|
15143
|
+
unit: dimensionsUnit !== null && dimensionsUnit !== void 0 ? dimensionsUnit : "inch"
|
|
15144
|
+
})) : undefined),
|
|
14100
15145
|
insuredValue: moneySchema.extend({
|
|
14101
15146
|
amount: zod.z.number().positive()
|
|
14102
15147
|
}).optional(),
|
|
@@ -14113,7 +15158,7 @@ const getShipmentSchema = ({
|
|
|
14113
15158
|
}) => whole || fractional, "schemaErrors.required") : zod.z.object({
|
|
14114
15159
|
fractional: zod.z.number().nonnegative().nullishDefault(0),
|
|
14115
15160
|
whole: zod.z.number().nonnegative().nullishDefault(0)
|
|
14116
|
-
}).nullish()).transform(weight => weight ? convertWeight(weight) : undefined)
|
|
15161
|
+
}).nullish()).transform(weight => weight ? convertWeight(weight, weightUnit) : undefined)
|
|
14117
15162
|
}).array().min(1),
|
|
14118
15163
|
service: zod.z.object({
|
|
14119
15164
|
carrierId: zod.z.string().nullish(),
|
|
@@ -14140,7 +15185,9 @@ const getShipmentSchema = ({
|
|
|
14140
15185
|
length,
|
|
14141
15186
|
width,
|
|
14142
15187
|
height
|
|
14143
|
-
}) => [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)
|
|
15188
|
+
}) => [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), {
|
|
15189
|
+
unit: dimensionsUnit !== null && dimensionsUnit !== void 0 ? dimensionsUnit : "inch"
|
|
15190
|
+
})))
|
|
14144
15191
|
}).array().min(1),
|
|
14145
15192
|
service: zod.z.object({
|
|
14146
15193
|
carrierId: zod.z.string(),
|
|
@@ -14188,6 +15235,7 @@ const getShipmentSchema = ({
|
|
|
14188
15235
|
const minimumShipDate = nextDayCutoff(17);
|
|
14189
15236
|
const maximumShipDate = daysAfter(7, minimumShipDate);
|
|
14190
15237
|
const ShipmentForm = ({
|
|
15238
|
+
accountSettings,
|
|
14191
15239
|
addressLoading,
|
|
14192
15240
|
addressPreference,
|
|
14193
15241
|
charsetWarning,
|
|
@@ -14228,14 +15276,22 @@ const ShipmentForm = ({
|
|
|
14228
15276
|
const [insuranceEnabled, setInsuranceEnabled] = React.useState(false);
|
|
14229
15277
|
const {
|
|
14230
15278
|
isContentDescriptionRequired,
|
|
14231
|
-
isCustomsRequired
|
|
15279
|
+
isCustomsRequired,
|
|
15280
|
+
hasAllZeroMeasurements
|
|
14232
15281
|
} = useShipmentMetadata(shipment);
|
|
15282
|
+
const packageDimensions = shipment === null || shipment === void 0 ? void 0 : shipment.packages[0].dimensions;
|
|
15283
|
+
const packageWeight = shipment === null || shipment === void 0 ? void 0 : shipment.packages[0].weight;
|
|
15284
|
+
// if package specs are all zeroes, assume it is a custom package and default to account settings units
|
|
15285
|
+
const [dimensionsUnit, weightUnit] = React.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]);
|
|
15286
|
+
const hasMeasurementUnits = React.useMemo(() => !!dimensionsUnit && !!weightUnit, [dimensionsUnit, weightUnit]);
|
|
14233
15287
|
const shipmentSchema = React.useMemo(() => getShipmentSchema({
|
|
15288
|
+
dimensionsUnit,
|
|
14234
15289
|
isContentDescriptionRequired,
|
|
14235
15290
|
isCustomsRequired,
|
|
14236
15291
|
requireMeasurements,
|
|
14237
|
-
warehouses: warehouses !== null && warehouses !== void 0 ? warehouses : []
|
|
14238
|
-
|
|
15292
|
+
warehouses: warehouses !== null && warehouses !== void 0 ? warehouses : [],
|
|
15293
|
+
weightUnit
|
|
15294
|
+
}), [isCustomsRequired, requireMeasurements, warehouses, isContentDescriptionRequired, weightUnit, dimensionsUnit]);
|
|
14239
15295
|
const requestedServices = React.useMemo(() => getRequestedServices(salesOrder), [salesOrder]);
|
|
14240
15296
|
const form = reactHookForm.useForm({
|
|
14241
15297
|
defaultValues: {
|
|
@@ -14286,10 +15342,10 @@ const ShipmentForm = ({
|
|
|
14286
15342
|
const {
|
|
14287
15343
|
whole,
|
|
14288
15344
|
fractional
|
|
14289
|
-
} = formatFractionalWeight(weight);
|
|
15345
|
+
} = formatFractionalWeight(weight, weightUnit);
|
|
14290
15346
|
form.setValue("packages.0.weight.whole", whole);
|
|
14291
15347
|
form.setValue("packages.0.weight.fractional", fractional);
|
|
14292
|
-
}, [form]);
|
|
15348
|
+
}, [form, weightUnit]);
|
|
14293
15349
|
const handleChangeMode = React.useCallback(nextMode => __awaiter(void 0, void 0, void 0, function* () {
|
|
14294
15350
|
if (nextMode === "browse_rates") {
|
|
14295
15351
|
// Browse Rates
|
|
@@ -14797,7 +15853,7 @@ const ShipmentForm = ({
|
|
|
14797
15853
|
name: "packages.0.type",
|
|
14798
15854
|
onCategoryChange: value => form.setValue("carrierId", value),
|
|
14799
15855
|
options: packageOptions
|
|
14800
|
-
}),
|
|
15856
|
+
}), hasMeasurementUnits && requireMeasurements ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
14801
15857
|
children: [jsxRuntime.jsxs(InputGroup, Object.assign({
|
|
14802
15858
|
control: form.control,
|
|
14803
15859
|
disabled: !!findCustomPackage(selectedPackage === null || selectedPackage === void 0 ? void 0 : selectedPackage.code),
|
|
@@ -14810,19 +15866,25 @@ const ShipmentForm = ({
|
|
|
14810
15866
|
control: form.control,
|
|
14811
15867
|
label: t("purchase-label:fields.dimensions.length"),
|
|
14812
15868
|
name: "packages.0.dimensions.length",
|
|
14813
|
-
placeholder: t(
|
|
15869
|
+
placeholder: t(`units.${dimensionsUnit}`)
|
|
14814
15870
|
}), jsxRuntime.jsx(NumberInput, {
|
|
14815
15871
|
control: form.control,
|
|
14816
15872
|
label: t("purchase-label:fields.dimensions.width"),
|
|
14817
15873
|
name: "packages.0.dimensions.width",
|
|
14818
|
-
placeholder: t(
|
|
15874
|
+
placeholder: t(`units.${dimensionsUnit}`)
|
|
14819
15875
|
}), jsxRuntime.jsx(NumberInput, {
|
|
14820
15876
|
control: form.control,
|
|
14821
15877
|
label: t("purchase-label:fields.dimensions.height"),
|
|
14822
15878
|
name: "packages.0.dimensions.height",
|
|
14823
|
-
placeholder: t(
|
|
15879
|
+
placeholder: t(`units.${dimensionsUnit}`)
|
|
14824
15880
|
})]
|
|
14825
|
-
})), jsxRuntime.
|
|
15881
|
+
})), weightUnit && isMetricWeightUnit(weightUnit) ? jsxRuntime.jsx(NumberInput, {
|
|
15882
|
+
control: form.control,
|
|
15883
|
+
label: t("purchase-label:fields.weightGroup"),
|
|
15884
|
+
name: "packages.0.weight.whole",
|
|
15885
|
+
onBlur: handleBlurWeight,
|
|
15886
|
+
placeholder: t(`units.${weightUnit}`)
|
|
15887
|
+
}) : jsxRuntime.jsxs(InputGroup, Object.assign({
|
|
14826
15888
|
control: form.control,
|
|
14827
15889
|
label: t("purchase-label:fields.weightGroup"),
|
|
14828
15890
|
name: "packages.0.weight",
|
|
@@ -14842,6 +15904,26 @@ const ShipmentForm = ({
|
|
|
14842
15904
|
placeholder: t("units.oz")
|
|
14843
15905
|
})]
|
|
14844
15906
|
}))]
|
|
15907
|
+
}) : jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
15908
|
+
children: [jsxRuntime.jsx(FieldLabel, Object.assign({
|
|
15909
|
+
label: t("purchase-label:fields.dimensionsGroup")
|
|
15910
|
+
}, {
|
|
15911
|
+
children: jsxRuntime.jsx(giger.Skeleton, {
|
|
15912
|
+
animation: giger.SkeletonAnimation.WAVE,
|
|
15913
|
+
backgroundColor: giger.SkeletonBackgroundColor.LIGHT,
|
|
15914
|
+
height: 50,
|
|
15915
|
+
variant: giger.SkeletonVariant.TEXT
|
|
15916
|
+
})
|
|
15917
|
+
})), jsxRuntime.jsx(Spacer, {}), jsxRuntime.jsx(FieldLabel, Object.assign({
|
|
15918
|
+
label: t("purchase-label:fields.weightGroup")
|
|
15919
|
+
}, {
|
|
15920
|
+
children: jsxRuntime.jsx(giger.Skeleton, {
|
|
15921
|
+
animation: giger.SkeletonAnimation.WAVE,
|
|
15922
|
+
backgroundColor: giger.SkeletonBackgroundColor.LIGHT,
|
|
15923
|
+
height: 50,
|
|
15924
|
+
variant: giger.SkeletonVariant.TEXT
|
|
15925
|
+
})
|
|
15926
|
+
})), jsxRuntime.jsx(Spacer, {})]
|
|
14845
15927
|
}), isContentDescriptionRequired && jsxRuntime.jsx(TextInput, {
|
|
14846
15928
|
control: form.control,
|
|
14847
15929
|
hint: t("purchase-label:hints.contentDescription"),
|
|
@@ -15020,6 +16102,13 @@ const Shipment = ({
|
|
|
15020
16102
|
const requestedServices = React.useMemo(() => getRequestedServices(salesOrder), [salesOrder]);
|
|
15021
16103
|
const activeLabel = React.useMemo(() => labels === null || labels === void 0 ? void 0 : labels.find(l => l.status === "completed"), [labels]);
|
|
15022
16104
|
const hasSalesOrder = React.useMemo(() => shipment.salesOrderIds.length > 0, [shipment.salesOrderIds.length]);
|
|
16105
|
+
const formatWeight = weight => isMetricWeightUnit(weight.unit) ? t(`weight.${weight.unit}`, {
|
|
16106
|
+
count: weight.value
|
|
16107
|
+
}) : [pounds > 0 ? t("weight.pounds", {
|
|
16108
|
+
count: pounds
|
|
16109
|
+
}) : "", ounces > 0 ? t("weight.ounces", {
|
|
16110
|
+
count: ounces
|
|
16111
|
+
}) : ""].filter(msg => msg.length).join(" ");
|
|
15023
16112
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
15024
16113
|
children: [jsxRuntime.jsxs(Section, Object.assign({
|
|
15025
16114
|
"data-testid": "orderDetail"
|
|
@@ -15105,16 +16194,12 @@ const Shipment = ({
|
|
|
15105
16194
|
"data-testid": "dimensions",
|
|
15106
16195
|
label: t("view-shipment:fields.dimensions")
|
|
15107
16196
|
}, {
|
|
15108
|
-
children: [`${dimensions
|
|
16197
|
+
children: [`${formatDimensions(dimensions)} ` + t(`units.${dimensions.unit}`), jsxRuntime.jsx(Spacer, {})]
|
|
15109
16198
|
})), jsxRuntime.jsx(FieldLabel, Object.assign({
|
|
15110
16199
|
"data-testid": "weight",
|
|
15111
16200
|
label: t("view-shipment:fields.weight")
|
|
15112
16201
|
}, {
|
|
15113
|
-
children:
|
|
15114
|
-
count: pounds
|
|
15115
|
-
}) : "", ounces > 0 ? t("weight.ounces", {
|
|
15116
|
-
count: ounces
|
|
15117
|
-
}) : ""].filter(unit => unit.length).join(" ")
|
|
16202
|
+
children: formatWeight(weight)
|
|
15118
16203
|
}))]
|
|
15119
16204
|
})), jsxRuntime.jsxs(Section, Object.assign({
|
|
15120
16205
|
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) ? jsxRuntime.jsx(giger.Link, Object.assign({
|
|
@@ -15268,6 +16353,9 @@ const styles = createStyles({
|
|
|
15268
16353
|
})
|
|
15269
16354
|
});
|
|
15270
16355
|
|
|
16356
|
+
/**
|
|
16357
|
+
* @internal
|
|
16358
|
+
*/
|
|
15271
16359
|
const DateRangeSelect = ({
|
|
15272
16360
|
fullWidth,
|
|
15273
16361
|
onChange,
|
|
@@ -15301,6 +16389,13 @@ const DateRangeSelect = ({
|
|
|
15301
16389
|
}));
|
|
15302
16390
|
};
|
|
15303
16391
|
|
|
16392
|
+
/**
|
|
16393
|
+
* @internal
|
|
16394
|
+
*
|
|
16395
|
+
* # Date Range Combo Component
|
|
16396
|
+
*
|
|
16397
|
+
* @see {@link DateRangeComboProps | This is the type of the props used in the `<DateRangeCombo />` component}
|
|
16398
|
+
*/
|
|
15304
16399
|
const DateRangeCombo = ({
|
|
15305
16400
|
children: renderChildren,
|
|
15306
16401
|
onChange,
|
|
@@ -15345,9 +16440,13 @@ const DateRangeCombo = ({
|
|
|
15345
16440
|
};
|
|
15346
16441
|
|
|
15347
16442
|
/**
|
|
16443
|
+
* @internal
|
|
16444
|
+
*
|
|
16445
|
+
* # Error Fallback Component
|
|
16446
|
+
*
|
|
15348
16447
|
* Fallback component for the Elements ErrorBoundary
|
|
15349
16448
|
*
|
|
15350
|
-
* @see {@link
|
|
16449
|
+
* @see {@link ErrorFallbackProps | The props that are passed into the `<ErrorFallback />` component}
|
|
15351
16450
|
*/
|
|
15352
16451
|
const ErrorFallback = ({
|
|
15353
16452
|
error
|
|
@@ -15381,7 +16480,11 @@ const ErrorFallback = ({
|
|
|
15381
16480
|
};
|
|
15382
16481
|
|
|
15383
16482
|
/**
|
|
15384
|
-
*
|
|
16483
|
+
* @internal
|
|
16484
|
+
*
|
|
16485
|
+
* # Story Notes Component
|
|
16486
|
+
*
|
|
16487
|
+
* - For relevant notes about Storybook stories
|
|
15385
16488
|
*
|
|
15386
16489
|
* Stopgap until we setup https://storybook.js.org/addons/@storybook/addon-docs
|
|
15387
16490
|
*/
|
|
@@ -15666,12 +16769,17 @@ var common = {
|
|
|
15666
16769
|
weight: {
|
|
15667
16770
|
ounces: "{{count}} oz",
|
|
15668
16771
|
pounds_one: "{{count}} lb",
|
|
15669
|
-
pounds_other: "{{count}} lbs"
|
|
16772
|
+
pounds_other: "{{count}} lbs",
|
|
16773
|
+
kilogram: "{{count}} kg",
|
|
16774
|
+
gram: "{{count}} g"
|
|
15670
16775
|
},
|
|
15671
16776
|
units: {
|
|
15672
|
-
|
|
16777
|
+
inch: "in",
|
|
15673
16778
|
lbs: "lbs",
|
|
15674
|
-
oz: "oz"
|
|
16779
|
+
oz: "oz",
|
|
16780
|
+
centimeter: "cm",
|
|
16781
|
+
gram: "g",
|
|
16782
|
+
kilogram: "kg"
|
|
15675
16783
|
},
|
|
15676
16784
|
"VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkMTAwLgo=": "$100 insurance included",
|
|
15677
16785
|
"VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkNTAuCg==": "$50 insurance included",
|
|
@@ -15679,7 +16787,8 @@ var common = {
|
|
|
15679
16787
|
"QWRkcmVzcyBub3QgZm91bmQ=": "There was an issue validating your address. Please try again.",
|
|
15680
16788
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: "UPS weight limit per package is 150 lbs.",
|
|
15681
16789
|
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: "Finish setting up your ShipStation Carriers in the ShipStation app",
|
|
15682
|
-
QSBzaGlwcGluZyBlcnJvciBvY2N1cnJlZDogTWlzc2luZyBvciBpbnZhbGlkIHNoaXBwZXIgbnVtYmVy: "Unable to
|
|
16790
|
+
QSBzaGlwcGluZyBlcnJvciBvY2N1cnJlZDogTWlzc2luZyBvciBpbnZhbGlkIHNoaXBwZXIgbnVtYmVy: "Unable to create label: Missing or Invalid Shipper Number. Please contact our support team to reset the carrier connection for your account.",
|
|
16791
|
+
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.",
|
|
15683
16792
|
"QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBNaXNzaW5nIG9yIGludmFsaWQgc2hpcCB0byBTdGF0ZVByb3ZpbmNlQ29kZQ==": "The State/Province Code Exceeds 5 Characters. Shorten the abbreviation or remove it, then try again.",
|
|
15684
16793
|
"QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnZhbGlkIHNvbGQgdG8gc3RhdGUgcHJvdmluY2UgY29kZS4gVmFsaWQgbGVuZ3RoIGlzIDAgdG8gNSBhbHBoYW51bWVyaWM=": "The State/Province Code Exceeds 5 Characters. Shorten the abbreviation or remove it, then try again."
|
|
15685
16794
|
};
|
|
@@ -15935,7 +17044,8 @@ var purchaseLabel$1 = {
|
|
|
15935
17044
|
},
|
|
15936
17045
|
rates: {
|
|
15937
17046
|
uspsMediaMailAcknowledgement: "I confirm that this package is compliant with <1>USPS guidelines for Media Mail®</1>",
|
|
15938
|
-
uspsFirstClassMailAcknowledgement_leof: "I understand the limitations and confirm that this package is compliant with USPS guidelines for First Class Mail Large Envelopes or Flats."
|
|
17047
|
+
uspsFirstClassMailAcknowledgement_leof: "I understand the limitations and confirm that this package is compliant with USPS guidelines for First Class Mail Large Envelopes or Flats.",
|
|
17048
|
+
dhlExpressTermsAcknowledgement: "To start shipping with DHL, you are confirming that you have agreed to the <1>terms and conditions</1>"
|
|
15939
17049
|
},
|
|
15940
17050
|
shipToAddressFormFields: "Ship To Address Form Fields",
|
|
15941
17051
|
sections: {
|
|
@@ -16085,6 +17195,31 @@ var walletHistory = {
|
|
|
16085
17195
|
|
|
16086
17196
|
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);
|
|
16087
17197
|
|
|
17198
|
+
/**
|
|
17199
|
+
* # Account Settings Component
|
|
17200
|
+
*
|
|
17201
|
+
* - The `<AccountSettings />` component is used to display the user's account settings, as well as
|
|
17202
|
+
* allowing them to make changes to various aspects of their account.
|
|
17203
|
+
*
|
|
17204
|
+
* @param onSaveSettings Any `void` function you wish to execute when the user saves any changes
|
|
17205
|
+
* to their account settings.
|
|
17206
|
+
*
|
|
17207
|
+
* @returns Element An EmotionJSX.Element that will render the `<AccountSettings />` component
|
|
17208
|
+
* with all the appropriate wrappers.
|
|
17209
|
+
*
|
|
17210
|
+
* @example
|
|
17211
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
17212
|
+
* ```tsx
|
|
17213
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
17214
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
17215
|
+
* resources: { en },
|
|
17216
|
+
* });
|
|
17217
|
+
* ```
|
|
17218
|
+
*
|
|
17219
|
+
* <br />
|
|
17220
|
+
*
|
|
17221
|
+
* @see {@link AccountSettings.Element | The **Element** created to render `<AccountSettings />`}
|
|
17222
|
+
*/
|
|
16088
17223
|
const Component$4 = ({
|
|
16089
17224
|
onSaveSettings
|
|
16090
17225
|
}) => {
|
|
@@ -16096,6 +17231,32 @@ const Component$4 = ({
|
|
|
16096
17231
|
onSaveSettings: onSaveSettings
|
|
16097
17232
|
});
|
|
16098
17233
|
};
|
|
17234
|
+
/**
|
|
17235
|
+
* # Registered Account Settings Element
|
|
17236
|
+
*
|
|
17237
|
+
* - This is the registered `<AccountSettings />` element that will be used to render the
|
|
17238
|
+
* `<AccountSettings.Element />` component.
|
|
17239
|
+
*
|
|
17240
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
17241
|
+
* the `<AccountSettings.Element />` component.
|
|
17242
|
+
*
|
|
17243
|
+
* @example
|
|
17244
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `AccountSettings`
|
|
17245
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
17246
|
+
* ```tsx
|
|
17247
|
+
* <AccountSettings.Element
|
|
17248
|
+
* onSaveSettings={() => console.log('Settings Saved!')}
|
|
17249
|
+
* />
|
|
17250
|
+
* ```
|
|
17251
|
+
*
|
|
17252
|
+
* <br />
|
|
17253
|
+
*
|
|
17254
|
+
* @see {@link AccountSettings.ComponentProps | The **props** that can be passed into the `<AccountSettings.Element />` component}
|
|
17255
|
+
* @see {@link ListCarriers.Component | The `<List-Carriers />` component used to view connected carriers}
|
|
17256
|
+
* @see {@link ManageWarehouses.Component | The `<ManageWarehouses />` component used to add, update, or remove warehouses}
|
|
17257
|
+
* @see {@link PaymentMethodSettings | The `<PaymentMethodSettings />` component used to manage payment methods}
|
|
17258
|
+
* @see {@link ManageFunding | The `<ManageFunding />` component used to manage funding rules and add funds to a carrier account}
|
|
17259
|
+
*/
|
|
16099
17260
|
const Element$5 = alchemy__default["default"].createElement(Component$4, ErrorFallback, {
|
|
16100
17261
|
css: {
|
|
16101
17262
|
height: "100%",
|
|
@@ -16114,6 +17275,39 @@ var accountSettings = /*#__PURE__*/Object.freeze({
|
|
|
16114
17275
|
Element: Element$5
|
|
16115
17276
|
});
|
|
16116
17277
|
|
|
17278
|
+
/**
|
|
17279
|
+
* # Onboarding Component
|
|
17280
|
+
*
|
|
17281
|
+
* - The `<Onboarding />` component is used to onboard a new user to the ShipEngine platform. This
|
|
17282
|
+
* component will allow the user to create a warehouse, register a carrier, and create a funding
|
|
17283
|
+
* source for their account. This is everything a user needs to begin fulfilling their shipments
|
|
17284
|
+
* using the ShipEngine Platform.
|
|
17285
|
+
*
|
|
17286
|
+
* @param ComponentProps The base props that will be passed into the `<Onboarding />` component.
|
|
17287
|
+
*
|
|
17288
|
+
* @returns Element An EmotionJSX.Element that will render the `<Onboarding />` component
|
|
17289
|
+
* with all the appropriate wrappers.
|
|
17290
|
+
*
|
|
17291
|
+
* @example
|
|
17292
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
17293
|
+
* ```tsx
|
|
17294
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
17295
|
+
* css: {
|
|
17296
|
+
* height: "100%",
|
|
17297
|
+
* maxWidth: "800px",
|
|
17298
|
+
* minWidth: "440px",
|
|
17299
|
+
* overflow: "auto",
|
|
17300
|
+
* scrollbarGutter: "stable both-edges",
|
|
17301
|
+
* width: "100%",
|
|
17302
|
+
* },
|
|
17303
|
+
* resources: { en },
|
|
17304
|
+
* });
|
|
17305
|
+
* ```
|
|
17306
|
+
*
|
|
17307
|
+
* <br />
|
|
17308
|
+
*
|
|
17309
|
+
* @see {@link Onboarding.Element | The **Element** created to render `<Onboarding />`}
|
|
17310
|
+
*/
|
|
16117
17311
|
const Component$3 = ({
|
|
16118
17312
|
features,
|
|
16119
17313
|
onboardingAddress,
|
|
@@ -16182,6 +17376,28 @@ const Component$3 = ({
|
|
|
16182
17376
|
warehouses: warehouses
|
|
16183
17377
|
});
|
|
16184
17378
|
};
|
|
17379
|
+
/**
|
|
17380
|
+
* # Registered Onboarding Element
|
|
17381
|
+
*
|
|
17382
|
+
* - This is the registered `<Onboarding />` element that will be used to render the
|
|
17383
|
+
* `<Onboarding.Element />` component.
|
|
17384
|
+
*
|
|
17385
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
17386
|
+
* the `<Onboarding.Element />` component.
|
|
17387
|
+
*
|
|
17388
|
+
* @example
|
|
17389
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `Onboarding`
|
|
17390
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
17391
|
+
* ```tsx
|
|
17392
|
+
* <Onboarding.Element
|
|
17393
|
+
* onCompleteOnboarding={() => console.log('Onboarding Complete!')}
|
|
17394
|
+
* />
|
|
17395
|
+
* ```
|
|
17396
|
+
*
|
|
17397
|
+
* <br />
|
|
17398
|
+
*
|
|
17399
|
+
* @see {@link Onboarding.ComponentProps | The **props** that can be passed into the `<Onboarding.Element />` component}
|
|
17400
|
+
*/
|
|
16185
17401
|
const Element$4 = alchemy__default["default"].createElement(Component$3, ErrorFallback, {
|
|
16186
17402
|
css: {
|
|
16187
17403
|
height: "100%",
|
|
@@ -16442,27 +17658,6 @@ const usePresets = ({
|
|
|
16442
17658
|
};
|
|
16443
17659
|
};
|
|
16444
17660
|
|
|
16445
|
-
/**
|
|
16446
|
-
* Generic error pretty printer
|
|
16447
|
-
* @param errors
|
|
16448
|
-
* @param predicate
|
|
16449
|
-
* @param scrubber
|
|
16450
|
-
*/
|
|
16451
|
-
const useScrubErrors = ({
|
|
16452
|
-
scrubber,
|
|
16453
|
-
errors,
|
|
16454
|
-
predicate
|
|
16455
|
-
}) => {
|
|
16456
|
-
const {
|
|
16457
|
-
t
|
|
16458
|
-
} = reactI18next.useTranslation();
|
|
16459
|
-
return React.useMemo(() => errors === null || errors === void 0 ? void 0 : errors.map(e => {
|
|
16460
|
-
return t(jsBase64.encode(e.message), {
|
|
16461
|
-
defaultValue: !predicate || predicate(e) ? t(scrubber(e)) : e.message
|
|
16462
|
-
});
|
|
16463
|
-
}), [errors, predicate, scrubber, t]);
|
|
16464
|
-
};
|
|
16465
|
-
|
|
16466
17661
|
var usps_first_class_mail = [
|
|
16467
17662
|
"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."
|
|
16468
17663
|
];
|
|
@@ -16555,11 +17750,13 @@ const useRequestRates = ({
|
|
|
16555
17750
|
reset: resetRates,
|
|
16556
17751
|
mutateAsync: calculateRates
|
|
16557
17752
|
} = alchemy.useCalculateRates();
|
|
16558
|
-
const requestRates = React.useCallback(shipment => __awaiter(void 0, void 0, void 0, function* () {
|
|
16559
|
-
var _a;
|
|
17753
|
+
const requestRates = React.useCallback((shipment, isInternational) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17754
|
+
var _a, _b;
|
|
17755
|
+
const internationalCarrierIds = (_a = carriers === null || carriers === void 0 ? void 0 : carriers.map(c => c.carrierId)) !== null && _a !== void 0 ? _a : [];
|
|
17756
|
+
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 : [];
|
|
16560
17757
|
const result = yield calculateRates({
|
|
16561
17758
|
rateOptions: {
|
|
16562
|
-
carrierIds: shipment.carrierId ? [shipment.carrierId] :
|
|
17759
|
+
carrierIds: shipment.carrierId ? [shipment.carrierId] : isInternational ? internationalCarrierIds : domesticCarrierIds,
|
|
16563
17760
|
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
|
|
16564
17761
|
: shipment.packages.map(pkg => pkg.packageCode),
|
|
16565
17762
|
serviceCodes: shipment.serviceCode ? [shipment.serviceCode] : undefined
|
|
@@ -16642,6 +17839,9 @@ const useRatesForm = ({
|
|
|
16642
17839
|
}) => {
|
|
16643
17840
|
var _a, _b;
|
|
16644
17841
|
const [beforeCreateError, setBeforeCreateError] = React.useState();
|
|
17842
|
+
const {
|
|
17843
|
+
isInternational
|
|
17844
|
+
} = useShipmentMetadata(shipment);
|
|
16645
17845
|
const {
|
|
16646
17846
|
data: carriers
|
|
16647
17847
|
} = alchemy.useListCarriers();
|
|
@@ -16714,38 +17914,39 @@ const useRatesForm = ({
|
|
|
16714
17914
|
shipDate: isNowOrInTheFuture(shipment.shipDate) ? shipment.shipDate : undefined
|
|
16715
17915
|
}));
|
|
16716
17916
|
if (updatedShipment) {
|
|
16717
|
-
yield requestRates(updatedShipment);
|
|
17917
|
+
yield requestRates(updatedShipment, isInternational);
|
|
16718
17918
|
yield onShipmentUpdated === null || onShipmentUpdated === void 0 ? void 0 : onShipmentUpdated(updatedShipment);
|
|
16719
17919
|
yield onRateSaved === null || onRateSaved === void 0 ? void 0 : onRateSaved(updatedShipment);
|
|
16720
17920
|
}
|
|
16721
|
-
}), [onRateSaved, onShipmentUpdated, requestRates, shipment, updateShipment]);
|
|
17921
|
+
}), [isInternational, onRateSaved, onShipmentUpdated, requestRates, shipment, updateShipment]);
|
|
16722
17922
|
let errors = [...(ratesErrors !== null && ratesErrors !== void 0 ? ratesErrors : []), ...((_a = ratesResponse === null || ratesResponse === void 0 ? void 0 : ratesResponse.errors) !== null && _a !== void 0 ? _a : [])];
|
|
16723
17923
|
if (beforeCreateError) errors = [...errors, beforeCreateError];
|
|
16724
17924
|
// Sometimes no rates are returned and no top-level errors are returned
|
|
16725
|
-
// but there are invalid rates with errors. This will expose those to the user
|
|
17925
|
+
// but there are invalid rates with errors. This will filter out duplicate error messages and expose those to the user
|
|
16726
17926
|
// so the rate list isn't empty after calculating rates.
|
|
16727
17927
|
if (!errors.length) {
|
|
16728
|
-
|
|
17928
|
+
const uniqueMessages = new Set(ratesResponse === null || ratesResponse === void 0 ? void 0 : ratesResponse.invalidRates.flatMap(r => r.errorMessages));
|
|
17929
|
+
errors = (_b = [...uniqueMessages].map(m => ({
|
|
16729
17930
|
errorCode: "unknown",
|
|
16730
17931
|
errorSource: "shipengine",
|
|
16731
17932
|
errorType: "unknown",
|
|
16732
17933
|
message: m,
|
|
16733
17934
|
name: "CodedError"
|
|
16734
|
-
})))
|
|
17935
|
+
}))) !== null && _b !== void 0 ? _b : [];
|
|
16735
17936
|
}
|
|
16736
|
-
const
|
|
17937
|
+
const displayableRateErrors = useScrubErrors({
|
|
16737
17938
|
errors: errors,
|
|
16738
17939
|
predicate: React.useCallback(e => e.message.includes("No rates are available for service_codes"), []),
|
|
16739
17940
|
scrubber: React.useCallback(() => "common:errorMessages.noRatesAvailable", [])
|
|
16740
17941
|
});
|
|
16741
17942
|
const displayableLabelErrors = useScrubErrors({
|
|
16742
17943
|
errors: labelErrors !== null && labelErrors !== void 0 ? labelErrors : undefined,
|
|
16743
|
-
scrubber: React.useCallback(e => e.message.replace(/Exception with code
|
|
17944
|
+
scrubber: React.useCallback(e => e.message.replace(/Exception with code \w+; module \d+, category \d+, item \d+/g, ""), [])
|
|
16744
17945
|
});
|
|
16745
17946
|
return {
|
|
16746
17947
|
carriers,
|
|
16747
|
-
displayableErrors,
|
|
16748
17948
|
displayableLabelErrors,
|
|
17949
|
+
displayableRateErrors,
|
|
16749
17950
|
errors: errors.length > 0 ? errors : undefined,
|
|
16750
17951
|
isLoading: ratesCalculating,
|
|
16751
17952
|
labelErrors: (labelErrors === null || labelErrors === void 0 ? void 0 : labelErrors.length) ? labelErrors : undefined,
|
|
@@ -16780,6 +17981,9 @@ const useShipmentForm = ({
|
|
|
16780
17981
|
const {
|
|
16781
17982
|
data: warehouses
|
|
16782
17983
|
} = alchemy.useListWarehouses();
|
|
17984
|
+
const {
|
|
17985
|
+
data: accountSettings
|
|
17986
|
+
} = alchemy.useGetAccountSettings();
|
|
16783
17987
|
const {
|
|
16784
17988
|
error: updateShipmentErrors,
|
|
16785
17989
|
mutateAsync: updateShipment,
|
|
@@ -16839,6 +18043,7 @@ const useShipmentForm = ({
|
|
|
16839
18043
|
scrubber: React.useCallback(() => "common:errorMessages.noRatesAvailable", [])
|
|
16840
18044
|
});
|
|
16841
18045
|
return {
|
|
18046
|
+
accountSettings,
|
|
16842
18047
|
addressLoading,
|
|
16843
18048
|
addressPreference,
|
|
16844
18049
|
carriers,
|
|
@@ -16878,6 +18083,9 @@ const ConfigureShipment = _a => {
|
|
|
16878
18083
|
} = _a,
|
|
16879
18084
|
props = __rest(_a, ["features", "onAddressValidation", "onApplyPreset", "onBeforeLabelCreate", "onChangeAddress", "onLabelCreateFailure", "onLabelCreateSuccess", "onRateSaved", "onRatesCalculated", "onShipmentUpdated", "printLabelLayout", "salesOrder", "shipment"]);
|
|
16880
18085
|
const hydrateRef = React.useRef();
|
|
18086
|
+
const {
|
|
18087
|
+
isInternational
|
|
18088
|
+
} = useShipmentMetadata(shipment);
|
|
16881
18089
|
const _b = useRatesForm({
|
|
16882
18090
|
onBeforeLabelCreate,
|
|
16883
18091
|
onLabelCreateFailure,
|
|
@@ -16904,15 +18112,15 @@ const ConfigureShipment = _a => {
|
|
|
16904
18112
|
onApplyPreset: React.useCallback((_preset, shipment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16905
18113
|
var _d;
|
|
16906
18114
|
if (shipment.packages[0].weight.value) {
|
|
16907
|
-
yield requestRates(shipment);
|
|
18115
|
+
yield requestRates(shipment, isInternational);
|
|
16908
18116
|
}
|
|
16909
18117
|
(_d = hydrateRef.current) === null || _d === void 0 ? void 0 : _d.call(hydrateRef, shipment);
|
|
16910
|
-
}), [requestRates]),
|
|
18118
|
+
}), [requestRates, isInternational]),
|
|
16911
18119
|
onChangeAddress,
|
|
16912
18120
|
onShipmentUpdated,
|
|
16913
18121
|
onSubmit: React.useCallback(shipment => __awaiter(void 0, void 0, void 0, function* () {
|
|
16914
|
-
yield requestRates(shipment);
|
|
16915
|
-
}), [requestRates]),
|
|
18122
|
+
yield requestRates(shipment, isInternational);
|
|
18123
|
+
}), [requestRates, isInternational]),
|
|
16916
18124
|
salesOrder,
|
|
16917
18125
|
shipment
|
|
16918
18126
|
}),
|
|
@@ -17214,6 +18422,30 @@ const PurchaseLabelByShipment = _a => {
|
|
|
17214
18422
|
}));
|
|
17215
18423
|
};
|
|
17216
18424
|
|
|
18425
|
+
/**
|
|
18426
|
+
* # Purchase Label Component
|
|
18427
|
+
*
|
|
18428
|
+
* The `<PurchaseLabel />` component is used to purchase shipping labels from various carriers
|
|
18429
|
+
*
|
|
18430
|
+
* @param ElementProps The props necessary to render the `<PurchaseLabel />` component for shipment
|
|
18431
|
+
* based or sales order based label purchasing.
|
|
18432
|
+
*
|
|
18433
|
+
* @returns Element An EmotionJSX.Element that will render the `<PurchaseLabel />` component
|
|
18434
|
+
* with all the appropriate wrappers.
|
|
18435
|
+
*
|
|
18436
|
+
* @example
|
|
18437
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
18438
|
+
* ```tsx
|
|
18439
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
18440
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
18441
|
+
* resources: { en },
|
|
18442
|
+
* });
|
|
18443
|
+
* ```
|
|
18444
|
+
*
|
|
18445
|
+
* <br />
|
|
18446
|
+
*
|
|
18447
|
+
* @see {@link PurchaseLabel.Element | The **Element** created to render `<PurchaseLabel />`}
|
|
18448
|
+
*/
|
|
17217
18449
|
const Component$2 = _a => {
|
|
17218
18450
|
var props = __rest(_a, []);
|
|
17219
18451
|
if ("salesOrderId" in props || "orderSourceCode" in props) {
|
|
@@ -17222,6 +18454,44 @@ const Component$2 = _a => {
|
|
|
17222
18454
|
return jsxRuntime.jsx(PurchaseLabelByShipment, Object.assign({}, props));
|
|
17223
18455
|
}
|
|
17224
18456
|
};
|
|
18457
|
+
/**
|
|
18458
|
+
* # Registered Purchase Label Element
|
|
18459
|
+
*
|
|
18460
|
+
* @param ElementProps The props necessary to render the `<PurchaseLabel.Element />` for shipment
|
|
18461
|
+
* based or sales order based label purchasing.
|
|
18462
|
+
*
|
|
18463
|
+
* @example
|
|
18464
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `PurchaseLabel`
|
|
18465
|
+
* Element directly.
|
|
18466
|
+
* ```tsx
|
|
18467
|
+
* <PurchaseLabel.Element
|
|
18468
|
+
* key={currentSalesOrderId}
|
|
18469
|
+
* printLabelLayout='4x6'
|
|
18470
|
+
* shippingPresets={presets}
|
|
18471
|
+
* onShipmentUpdated={(shipment) => console.log('Shipment Updated', shipment)}
|
|
18472
|
+
* onRateSaved={(
|
|
18473
|
+
* shipment: SE.SalesOrderShipment,
|
|
18474
|
+
* rate?: SE.Rate,
|
|
18475
|
+
* rateOptions?: SE.Rate[]
|
|
18476
|
+
* ) => console.log('Rate Saved', shipment, rate, rateOptions)}
|
|
18477
|
+
* onRatesCalculated={() => console.log('Rates Calculated')}
|
|
18478
|
+
* onBeforeLabelCreate={onBeforeLabelPurchase}
|
|
18479
|
+
* onLabelCreateSuccess={onLabelPurchaseSuccess}
|
|
18480
|
+
* onLabelCreateFailure={(rate) => console.log('Label Purchase Failed', rate)}
|
|
18481
|
+
* warehouseId={defaultWarehouseId}
|
|
18482
|
+
* />
|
|
18483
|
+
* ```
|
|
18484
|
+
*
|
|
18485
|
+
* <br />
|
|
18486
|
+
*
|
|
18487
|
+
* - Once a label has been purchased using this Element, you can take the `shipmentId` for the
|
|
18488
|
+
* associated shipment and pass it into the `<ViewShipment.Element />` Element in order to view
|
|
18489
|
+
* the shipment details.
|
|
18490
|
+
*
|
|
18491
|
+
* @see {@link PurchaseLabel.PurchaseLabelCommonProps | The **Common props** used in `<PurchaseLabel.Element />`}
|
|
18492
|
+
*
|
|
18493
|
+
* @see {@link ViewShipment.Element | The next step in the label purchase workflow `<ViewShipment.Element />`}
|
|
18494
|
+
*/
|
|
17225
18495
|
const Element$3 = alchemy__default["default"].createElement(Component$2, ErrorFallback, {
|
|
17226
18496
|
css: {
|
|
17227
18497
|
height: "100%",
|
|
@@ -17240,6 +18510,31 @@ var purchaseLabel = /*#__PURE__*/Object.freeze({
|
|
|
17240
18510
|
Element: Element$3
|
|
17241
18511
|
});
|
|
17242
18512
|
|
|
18513
|
+
/**
|
|
18514
|
+
* # View Shipment Component
|
|
18515
|
+
*
|
|
18516
|
+
* - The `<ViewShipment />` component is used to for viewing the shipment's tracking number, printing the label that
|
|
18517
|
+
* was created, and the option to void the label. When a label is voided, you can see a list of the
|
|
18518
|
+
* previously voided labels for a given shipment using this component.
|
|
18519
|
+
*
|
|
18520
|
+
* @param ComponentProps The base props that will be passed into the `<ViewShipment />` component.
|
|
18521
|
+
*
|
|
18522
|
+
* @returns Element An EmotionJSX.Element that will render the `<ViewShipment />` component
|
|
18523
|
+
* with all the appropriate wrappers.
|
|
18524
|
+
*
|
|
18525
|
+
* @example
|
|
18526
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
18527
|
+
* ```tsx
|
|
18528
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
18529
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
18530
|
+
* resources: { en },
|
|
18531
|
+
* });
|
|
18532
|
+
* ```
|
|
18533
|
+
*
|
|
18534
|
+
* <br />
|
|
18535
|
+
*
|
|
18536
|
+
* @see {@link ViewShipment.Element | The **Element** created to render `<ViewShipment />`}
|
|
18537
|
+
*/
|
|
17243
18538
|
const Component$1 = ({
|
|
17244
18539
|
features,
|
|
17245
18540
|
onClickPrintLabel,
|
|
@@ -17279,6 +18574,36 @@ const Component$1 = ({
|
|
|
17279
18574
|
warehouse: warehouse
|
|
17280
18575
|
});
|
|
17281
18576
|
};
|
|
18577
|
+
/**
|
|
18578
|
+
* # Registered View Shipment Element
|
|
18579
|
+
*
|
|
18580
|
+
* - This is the registered `<ViewShipment />` element that will be used to render the
|
|
18581
|
+
* `<ViewShipment.Element />` component.
|
|
18582
|
+
*
|
|
18583
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
18584
|
+
* the `<ViewShipment.Element />` component.
|
|
18585
|
+
*
|
|
18586
|
+
* @example
|
|
18587
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `ViewShipment`
|
|
18588
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
18589
|
+
* ```tsx
|
|
18590
|
+
* <ViewShipment.Element
|
|
18591
|
+
* onClickPurchaseLabel={({ salesOrderId }) => {
|
|
18592
|
+
* console.log('sales order ID', salesOrderId);
|
|
18593
|
+
* }}
|
|
18594
|
+
* onClickVoidLabel={({ labelId }) => {
|
|
18595
|
+
* console.log('voided label', labelId);
|
|
18596
|
+
* }}
|
|
18597
|
+
* shipmentId="se-1234567"
|
|
18598
|
+
* />
|
|
18599
|
+
* ```
|
|
18600
|
+
*
|
|
18601
|
+
* <br />
|
|
18602
|
+
*
|
|
18603
|
+
* @see {@link ViewShipment.ComponentProps | The **props** that can be passed into the `<ViewShipment.Element />` component}
|
|
18604
|
+
*
|
|
18605
|
+
* @see {@link VoidLabel.Element | The next step in the label purchase workflow `<VoidLabel.Element />`}
|
|
18606
|
+
**/
|
|
17282
18607
|
const Element$2 = alchemy__default["default"].createElement(Component$1, ErrorFallback, {
|
|
17283
18608
|
css: {
|
|
17284
18609
|
height: "100%",
|
|
@@ -17402,6 +18727,31 @@ const Message = ({
|
|
|
17402
18727
|
});
|
|
17403
18728
|
};
|
|
17404
18729
|
|
|
18730
|
+
/**
|
|
18731
|
+
* # Void Label Component
|
|
18732
|
+
*
|
|
18733
|
+
* - The `<VoidLabel />` component is used to void a given shipping label. When a label is voided,
|
|
18734
|
+
* you then get the option to view the associated shipment via the `View Shipment` Element, or
|
|
18735
|
+
* you can purchase another label for the shipment via the `Purchase Label` Element.
|
|
18736
|
+
*
|
|
18737
|
+
* @param ComponentProps The base props that will be passed into the `<VoidLabel />` component.
|
|
18738
|
+
*
|
|
18739
|
+
* @returns Element An EmotionJSX.Element that will render the `<VoidLabel />` component
|
|
18740
|
+
* with all the appropriate wrappers.
|
|
18741
|
+
*
|
|
18742
|
+
* @example
|
|
18743
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
18744
|
+
* ```tsx
|
|
18745
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
18746
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
18747
|
+
* resources: { en },
|
|
18748
|
+
* });
|
|
18749
|
+
* ```
|
|
18750
|
+
*
|
|
18751
|
+
* <br />
|
|
18752
|
+
*
|
|
18753
|
+
* @see {@link VoidLabel.Element | The **Element** created to render `<VoidLabel />`}
|
|
18754
|
+
*/
|
|
17405
18755
|
const Component = ({
|
|
17406
18756
|
features,
|
|
17407
18757
|
labelId,
|
|
@@ -17453,6 +18803,37 @@ const Component = ({
|
|
|
17453
18803
|
})]
|
|
17454
18804
|
});
|
|
17455
18805
|
};
|
|
18806
|
+
/**
|
|
18807
|
+
* # Registered Void Label Element
|
|
18808
|
+
*
|
|
18809
|
+
* - This is the registered `<VoidLabel />` element that will be used to render the
|
|
18810
|
+
* `<VoidLabel.Element />` component.
|
|
18811
|
+
*
|
|
18812
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
18813
|
+
* the `<VoidLabel.Element />` component.
|
|
18814
|
+
*
|
|
18815
|
+
* @example
|
|
18816
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `VoidLabel`
|
|
18817
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
18818
|
+
* ```tsx
|
|
18819
|
+
* <VoidLabel.Element
|
|
18820
|
+
* labelId="se-1234567"
|
|
18821
|
+
* onComplete={() => console.log('onComplete')}
|
|
18822
|
+
* onSuccess={(_, { salesOrderIds: [salesOrderId] }) =>
|
|
18823
|
+
* console.log('sales order ID', salesOrderId)
|
|
18824
|
+
* }
|
|
18825
|
+
* onViewShipment={({ shipmentId }) => {
|
|
18826
|
+
* console.log('onViewShipment', shipmentId);
|
|
18827
|
+
* }}
|
|
18828
|
+
* />
|
|
18829
|
+
* ```
|
|
18830
|
+
*
|
|
18831
|
+
* <br />
|
|
18832
|
+
*
|
|
18833
|
+
* @see {@link VoidLabel.ComponentProps | The **props** that can be passed into the `<VoidLabel.Element />` component}
|
|
18834
|
+
*
|
|
18835
|
+
* @see {@link PurchaseLabel.Element | Go back to the frst step in the label purchase workflow `<PurchaseLabel.Element />`}
|
|
18836
|
+
*/
|
|
17456
18837
|
const Element$1 = alchemy__default["default"].createElement(Component, ErrorFallback, {
|
|
17457
18838
|
css: {
|
|
17458
18839
|
height: "100%",
|
|
@@ -17471,6 +18852,31 @@ var voidLabel = /*#__PURE__*/Object.freeze({
|
|
|
17471
18852
|
Element: Element$1
|
|
17472
18853
|
});
|
|
17473
18854
|
|
|
18855
|
+
/**
|
|
18856
|
+
* @internal
|
|
18857
|
+
*
|
|
18858
|
+
* # Label Workflow Component
|
|
18859
|
+
*
|
|
18860
|
+
* @example
|
|
18861
|
+
* ```tsx
|
|
18862
|
+
* const {
|
|
18863
|
+
* labelId,
|
|
18864
|
+
* multiplexedId,
|
|
18865
|
+
* isVoidingLabel,
|
|
18866
|
+
* shipmentId,
|
|
18867
|
+
* setLabelId,
|
|
18868
|
+
* setShipmentId,
|
|
18869
|
+
* setIsVoidingLabel,
|
|
18870
|
+
* } = useLabelWorkflow({
|
|
18871
|
+
* _labelId,
|
|
18872
|
+
* _multiplexedId,
|
|
18873
|
+
* });
|
|
18874
|
+
* ```
|
|
18875
|
+
*
|
|
18876
|
+
* <br />
|
|
18877
|
+
*
|
|
18878
|
+
* @see {@link LabelWorkflow.Element | The `<LabelWorkflow.Element />` component using this hook}
|
|
18879
|
+
*/
|
|
17474
18880
|
const useLabelWorkflow = ({
|
|
17475
18881
|
_multiplexedId,
|
|
17476
18882
|
_labelId
|
|
@@ -17495,6 +18901,33 @@ const useLabelWorkflow = ({
|
|
|
17495
18901
|
shipmentId
|
|
17496
18902
|
};
|
|
17497
18903
|
};
|
|
18904
|
+
/**
|
|
18905
|
+
* @internal
|
|
18906
|
+
*
|
|
18907
|
+
* # Label Workflow Element
|
|
18908
|
+
*
|
|
18909
|
+
* - The `<LabelWorkflow.Element />` component is a composition of the PurchaseLabel, ViewShipment,
|
|
18910
|
+
* and VoidLabel elements that allows users to purchase a label, view the shipment details, and optionally void their shipping label.
|
|
18911
|
+
*
|
|
18912
|
+
* @param LabelWorkflowProps The props necessary to render the `<LabelWorkflow.Element />` for shipment
|
|
18913
|
+
* based or sales order based label purchasing.
|
|
18914
|
+
*
|
|
18915
|
+
* @returns Element A React Element that will render the `<LabelWorkflow />` component.
|
|
18916
|
+
*
|
|
18917
|
+
* @example
|
|
18918
|
+
* ```tsx
|
|
18919
|
+
* <LabelWorkflow
|
|
18920
|
+
* {...elementProps}
|
|
18921
|
+
* callbacks={{ onLabelCreateSuccess }}
|
|
18922
|
+
* multiplexedId={elementIdProps}
|
|
18923
|
+
* />
|
|
18924
|
+
* ```
|
|
18925
|
+
*
|
|
18926
|
+
* <br />
|
|
18927
|
+
*
|
|
18928
|
+
* @see {@link LabelWorkflowProps | The props that are passed into the `<LabelWorkflow />` component}
|
|
18929
|
+
* @see {@link LabelWorkflow.useLabelWorkflow | The `hook` that is used to manage the state of the `<LabelWorkflow />` component}
|
|
18930
|
+
*/
|
|
17498
18931
|
const Element = (
|
|
17499
18932
|
/*
|
|
17500
18933
|
The passed props are underscore prefixed as they will be stashed, then from them stateful versions will be made
|
|
@@ -17564,6 +18997,7 @@ The passed props are underscore prefixed as they will be stashed, then from them
|
|
|
17564
18997
|
|
|
17565
18998
|
var labelWorkflow = /*#__PURE__*/Object.freeze({
|
|
17566
18999
|
__proto__: null,
|
|
19000
|
+
useLabelWorkflow: useLabelWorkflow,
|
|
17567
19001
|
Element: Element
|
|
17568
19002
|
});
|
|
17569
19003
|
|
|
@@ -17610,7 +19044,10 @@ exports.VoidLabel = voidLabel;
|
|
|
17610
19044
|
exports.autoFundingSchema = autoFundingSchema;
|
|
17611
19045
|
exports.calculateTotal = calculateTotal;
|
|
17612
19046
|
exports.capitalizeFirstLetter = capitalizeFirstLetter;
|
|
19047
|
+
exports.convertDecimalWeightToFractionalWeight = convertDecimalWeightToFractionalWeight;
|
|
17613
19048
|
exports.convertDimensions = convertDimensions;
|
|
19049
|
+
exports.convertFractionalWeightToDecimalWeight = convertFractionalWeightToDecimalWeight;
|
|
19050
|
+
exports.convertPoundsAndOuncesToOunces = convertPoundsAndOuncesToOunces;
|
|
17614
19051
|
exports.convertWeight = convertWeight;
|
|
17615
19052
|
exports.countries = countries;
|
|
17616
19053
|
exports.countryCodes = countryCodes;
|
|
@@ -17623,10 +19060,12 @@ exports.errorMap = errorMap;
|
|
|
17623
19060
|
exports.euCountryCodes = euCountryCodes;
|
|
17624
19061
|
exports.extendZod = extendZod;
|
|
17625
19062
|
exports.featureFlagComponentNameLookup = featureFlagComponentNameLookup;
|
|
19063
|
+
exports.featureFlags = featureFlags;
|
|
17626
19064
|
exports.formLogger = formLogger;
|
|
17627
19065
|
exports.formatCreditCardNumber = formatCreditCardNumber;
|
|
17628
19066
|
exports.formatDate = formatDate;
|
|
17629
19067
|
exports.formatDateDDMMYY = formatDateDDMMYY;
|
|
19068
|
+
exports.formatDimensions = formatDimensions;
|
|
17630
19069
|
exports.formatExpiration = formatExpiration;
|
|
17631
19070
|
exports.formatFractionalWeight = formatFractionalWeight;
|
|
17632
19071
|
exports.formatMoney = formatMoney;
|
|
@@ -17644,9 +19083,11 @@ exports.getRelativeDates = getRelativeDates;
|
|
|
17644
19083
|
exports.getRequestedServices = getRequestedServices;
|
|
17645
19084
|
exports.getSalesOrderItemsFromSalesOrderOrShipment = getSalesOrderItemsFromSalesOrderOrShipment;
|
|
17646
19085
|
exports.getTotalRateAmount = getTotalRateAmount;
|
|
19086
|
+
exports.isDecimalWeight = isDecimalWeight;
|
|
17647
19087
|
exports.isDomesticAddress = isDomesticAddress;
|
|
17648
19088
|
exports.isEmptyAddress = isEmptyAddress;
|
|
17649
19089
|
exports.isFlatRatePackageCode = isFlatRatePackageCode;
|
|
19090
|
+
exports.isMetricWeightUnit = isMetricWeightUnit;
|
|
17650
19091
|
exports.isMilitaryAddress = isMilitaryAddress;
|
|
17651
19092
|
exports.isNowOrInTheFuture = isNowOrInTheFuture;
|
|
17652
19093
|
exports.isPoBox = isPoBox;
|
|
@@ -17687,6 +19128,7 @@ exports.usePageLayout = usePageLayout;
|
|
|
17687
19128
|
exports.useRateOptions = useRateOptions;
|
|
17688
19129
|
exports.useRootPortal = useRootPortal;
|
|
17689
19130
|
exports.useRunOnceOnTrue = useRunOnceOnTrue;
|
|
19131
|
+
exports.useScrubErrors = useScrubErrors;
|
|
17690
19132
|
exports.useServiceCodeOptions = useServiceCodeOptions;
|
|
17691
19133
|
exports.useShipmentMetadata = useShipmentMetadata;
|
|
17692
19134
|
exports.useShippingPresetsOptions = useShippingPresetsOptions;
|