@shipengine/elements 0.34.0 → 0.35.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 +1819 -381
- package/index.js +1812 -382
- 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,30 @@ const useBlackboxDetection = ({
|
|
|
4564
5433
|
}, [onSuccess, onError]);
|
|
4565
5434
|
};
|
|
4566
5435
|
|
|
5436
|
+
/**
|
|
5437
|
+
* @internal
|
|
5438
|
+
*
|
|
5439
|
+
* # Scrub Errors Hook
|
|
5440
|
+
*
|
|
5441
|
+
* Generic error pretty printer
|
|
5442
|
+
*
|
|
5443
|
+
* @category Hooks
|
|
5444
|
+
*/
|
|
5445
|
+
const useScrubErrors = ({
|
|
5446
|
+
scrubber,
|
|
5447
|
+
errors,
|
|
5448
|
+
predicate
|
|
5449
|
+
}) => {
|
|
5450
|
+
const {
|
|
5451
|
+
t
|
|
5452
|
+
} = reactI18next.useTranslation();
|
|
5453
|
+
return React.useMemo(() => errors === null || errors === void 0 ? void 0 : errors.map(e => {
|
|
5454
|
+
return t(jsBase64.encode(e.message), {
|
|
5455
|
+
defaultValue: !predicate || predicate(e) ? t(scrubber(e)) : e.message
|
|
5456
|
+
});
|
|
5457
|
+
}), [errors, predicate, scrubber, t]);
|
|
5458
|
+
};
|
|
5459
|
+
|
|
4567
5460
|
const useListConnectedCarriers = () => {
|
|
4568
5461
|
const {
|
|
4569
5462
|
data: carriers,
|
|
@@ -4584,6 +5477,29 @@ const useListConnectedCarriers = () => {
|
|
|
4584
5477
|
};
|
|
4585
5478
|
};
|
|
4586
5479
|
|
|
5480
|
+
/**
|
|
5481
|
+
* # List-Carriers Component
|
|
5482
|
+
*
|
|
5483
|
+
* @param ComponentProps The base props that will be passed into the `<List-Carriers />` component.
|
|
5484
|
+
*
|
|
5485
|
+
* @returns Element A React element that renders the `<List-Carriers />` component allowing users
|
|
5486
|
+
* to view a list of carriers that are connected to their ShipEngine account. This component is
|
|
5487
|
+
* composed in the `<AccountSettings />` Element.
|
|
5488
|
+
*
|
|
5489
|
+
* @example
|
|
5490
|
+
* ```tsx
|
|
5491
|
+
* (() => {
|
|
5492
|
+
* const features = useFeatures("Global");
|
|
5493
|
+
*
|
|
5494
|
+
* return <ListCarriers.Component features={features} />;
|
|
5495
|
+
* })();
|
|
5496
|
+
* ```
|
|
5497
|
+
*
|
|
5498
|
+
* <br />
|
|
5499
|
+
*
|
|
5500
|
+
* @see {@link ListCarriers.ComponentProps | The props that are passed into the `<List-Carriers />` component}
|
|
5501
|
+
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<List-Carriers />` component}
|
|
5502
|
+
*/
|
|
4587
5503
|
const Component$6 = ({
|
|
4588
5504
|
features
|
|
4589
5505
|
}) => {
|
|
@@ -4628,6 +5544,29 @@ var listCarriers$1 = /*#__PURE__*/Object.freeze({
|
|
|
4628
5544
|
Component: Component$6
|
|
4629
5545
|
});
|
|
4630
5546
|
|
|
5547
|
+
/**
|
|
5548
|
+
* # Manage Warehouses Component
|
|
5549
|
+
*
|
|
5550
|
+
* - The `<ManageWarehouses />` component is used to manage warehouses on a user's ShipEngine account. Users can add, update, or make warehouses inactive.
|
|
5551
|
+
* `<AccountSettings />` Element.
|
|
5552
|
+
*
|
|
5553
|
+
* @param ComponentProps The base props that will be passed into the `<ManageWarehouses />` component.
|
|
5554
|
+
*
|
|
5555
|
+
* @returns Element A React element that renders the `<ManageWarehouses />` component allowing users
|
|
5556
|
+
* to manage warehouses on their ShipEngine account.
|
|
5557
|
+
*
|
|
5558
|
+
* @example
|
|
5559
|
+
* ```tsx
|
|
5560
|
+
* export const ManageWarehousesExample = () => {
|
|
5561
|
+
* return <ManageWarehouses.Component />;
|
|
5562
|
+
* };
|
|
5563
|
+
* ```
|
|
5564
|
+
*
|
|
5565
|
+
* <br />
|
|
5566
|
+
*
|
|
5567
|
+
* @see {@link ManageWarehouses.ComponentProps | The props that are passed into the `<ManageWarehouses />` component}
|
|
5568
|
+
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<ManageWarehouses />` component}
|
|
5569
|
+
*/
|
|
4631
5570
|
const Component$5 = ({
|
|
4632
5571
|
onWarehouseAddressValidation
|
|
4633
5572
|
}) => {
|
|
@@ -4714,160 +5653,6 @@ var manageWarehouses$1 = /*#__PURE__*/Object.freeze({
|
|
|
4714
5653
|
Component: Component$5
|
|
4715
5654
|
});
|
|
4716
5655
|
|
|
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;
|
|
4868
|
-
}
|
|
4869
|
-
});
|
|
4870
|
-
|
|
4871
5656
|
var img$5 = "data:image/svg+xml,%3csvg fill='none' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='M22.9425 6.62223L18.63 5.81973C18.4275 5.78223 18.2325 5.91723 18.195 6.11973L17.3925 10.4322C17.355 10.6347 17.49 10.8297 17.6925 10.8672C17.715 10.8672 17.7375 10.8672 17.76 10.8672C17.94 10.8672 18.0975 10.7397 18.1275 10.5597L18.765 7.13973C21.15 10.3872 20.8125 14.9472 17.9475 17.8047C15.3225 20.4297 11.25 20.9697 8.04001 19.1247C7.86001 19.0197 7.63501 19.0797 7.53001 19.2597C7.42501 19.4397 7.49251 19.6647 7.66501 19.7697C9.05251 20.5722 10.5975 20.9622 12.1275 20.9622C14.4525 20.9622 16.755 20.0622 18.48 18.3372C21.5925 15.2247 21.9675 10.2597 19.3875 6.71973L22.8 7.34973C22.995 7.38723 23.1975 7.25223 23.235 7.04973C23.2725 6.84723 23.1375 6.65223 22.935 6.61473L22.9425 6.62223Z' fill='black' /%3e %3cpath d='M6.30022 12.7798C6.09772 12.7423 5.90272 12.8773 5.86522 13.0798L5.24272 16.4548C3.15022 13.2223 3.60022 8.91728 6.33022 6.18728C8.85022 3.66728 12.6752 3.05228 15.8477 4.65728C16.0277 4.74728 16.2602 4.67978 16.3502 4.49228C16.4402 4.30478 16.3727 4.07978 16.1852 3.98978C12.7202 2.23478 8.54272 2.90978 5.79772 5.65478C2.79022 8.66228 2.31772 13.3948 4.65022 16.9273L1.19272 16.2898C0.990221 16.2523 0.795221 16.3873 0.757721 16.5898C0.720221 16.7923 0.855221 16.9873 1.05772 17.0248L5.37022 17.8273C5.37022 17.8273 5.41522 17.8273 5.43772 17.8273C5.61772 17.8273 5.77522 17.6998 5.80522 17.5198L6.60772 13.2073C6.64522 13.0048 6.51022 12.8098 6.30772 12.7723L6.30022 12.7798Z' fill='black' /%3e %3cpath d='M15.0824 13.2223C14.9249 12.9373 14.7224 12.6973 14.4674 12.4948C14.2124 12.2998 13.9349 12.1348 13.6274 11.9998C13.3199 11.8648 13.0124 11.7598 12.7124 11.6773L12.3149 11.5648V7.87482C12.8324 7.91232 13.2749 8.06232 13.6349 8.33232C14.0549 8.64732 14.2874 9.07482 14.3399 9.60732H15.1874C15.1724 9.11982 15.0224 8.68482 14.7524 8.30232C14.4824 7.91982 14.1149 7.61982 13.6574 7.40232C13.2599 7.21482 12.8099 7.12482 12.3149 7.09482V6.31482C12.3149 6.14232 12.1799 6.00732 12.0074 6.00732C11.8349 6.00732 11.6999 6.14232 11.6999 6.31482V7.10982C11.2649 7.14732 10.8449 7.22982 10.4774 7.40232C10.0049 7.61982 9.62988 7.92732 9.35238 8.31732C9.07488 8.70732 8.93988 9.16482 8.93988 9.67482C8.93988 10.2898 9.14988 10.7998 9.56238 11.1898C9.97488 11.5798 10.5599 11.8948 11.3174 12.1198L11.6999 12.2323V16.1323C11.3849 16.1098 11.0849 16.0573 10.8224 15.9523C10.4699 15.8173 10.1849 15.6148 9.96738 15.3523C9.74988 15.0898 9.62238 14.7673 9.59238 14.3923V14.3323C9.59238 14.0848 9.38988 13.8823 9.14238 13.8823C8.89488 13.8823 8.69238 14.0848 8.69238 14.3323V14.3923C8.72988 14.8948 8.87988 15.3448 9.15738 15.7273C9.43488 16.1098 9.80988 16.4098 10.2899 16.6273C10.6949 16.8073 11.1749 16.8973 11.6999 16.9273V17.6848C11.6999 17.8573 11.8349 17.9923 12.0074 17.9923C12.1799 17.9923 12.3149 17.8573 12.3149 17.6848V16.9348C12.8699 16.9048 13.3574 16.7923 13.7774 16.5898C14.2724 16.3498 14.6549 16.0273 14.9174 15.6148C15.1799 15.2023 15.3149 14.7448 15.3149 14.2348C15.3149 13.8373 15.2399 13.4923 15.0824 13.2073V13.2223ZM11.0099 11.1448C10.7849 11.0473 10.5749 10.9348 10.3949 10.7923C10.2074 10.6573 10.0574 10.4923 9.95238 10.3048C9.84738 10.1173 9.78738 9.89232 9.78738 9.63732C9.78738 9.29232 9.88488 8.98482 10.0724 8.71482C10.2674 8.44482 10.5299 8.23482 10.8674 8.07732C11.1149 7.96482 11.3924 7.91232 11.6924 7.88232V11.3848C11.4599 11.3173 11.2349 11.2348 11.0024 11.1373L11.0099 11.1448ZM14.1449 15.2473C13.9274 15.5398 13.6349 15.7648 13.2674 15.9223C12.9824 16.0423 12.6599 16.1023 12.3149 16.1323V12.4198L12.4649 12.4648C12.8624 12.5773 13.2074 12.7123 13.5149 12.8623C13.8149 13.0123 14.0549 13.1998 14.2199 13.4173C14.3849 13.6348 14.4749 13.9123 14.4749 14.2348C14.4749 14.6173 14.3699 14.9548 14.1524 15.2473H14.1449Z' fill='black' /%3e %3cpath d='M14.7525 10.0796C14.985 10.0796 15.1725 9.89211 15.1725 9.65961V9.59961H14.3325V9.65961C14.3325 9.89211 14.52 10.0796 14.7525 10.0796Z' fill='black' /%3e%3c/svg%3e";
|
|
4872
5657
|
|
|
4873
5658
|
const styles$w = ({
|
|
@@ -5783,6 +6568,11 @@ const icons = {
|
|
|
5783
6568
|
download: gigerTheme.IconNames.DOWNLOAD,
|
|
5784
6569
|
retry: gigerTheme.IconNames.CIRCULAR_ARROW
|
|
5785
6570
|
};
|
|
6571
|
+
/**
|
|
6572
|
+
* @internal
|
|
6573
|
+
*
|
|
6574
|
+
* # Link Action Component
|
|
6575
|
+
*/
|
|
5786
6576
|
const LinkAction = _a => {
|
|
5787
6577
|
var {
|
|
5788
6578
|
css,
|
|
@@ -5869,6 +6659,22 @@ const ErrorDisplay = () => jsxRuntime.jsxs("div", Object.assign({
|
|
|
5869
6659
|
}))]
|
|
5870
6660
|
}));
|
|
5871
6661
|
|
|
6662
|
+
/**
|
|
6663
|
+
* @internal
|
|
6664
|
+
*
|
|
6665
|
+
* # Spacer Component Util Function
|
|
6666
|
+
*
|
|
6667
|
+
* - This is a utility function that generates dynamic styles for the `<Spacer />` component.
|
|
6668
|
+
*
|
|
6669
|
+
* @param SpacerProps The base props that will be passed into the `<Spacer />` component at
|
|
6670
|
+
* point of use.
|
|
6671
|
+
*
|
|
6672
|
+
* @return Styles A `SerializedStyles` object that contains styles that can be consumed by
|
|
6673
|
+
* our `ThemeProvider` and `EmotionJSX.Element` components.
|
|
6674
|
+
*
|
|
6675
|
+
* @see {@link Spacer | The `<Spacer />` component that uses these dynamic styles}
|
|
6676
|
+
*
|
|
6677
|
+
*/
|
|
5872
6678
|
const getSpacerStyles = ({
|
|
5873
6679
|
displayOn,
|
|
5874
6680
|
multiplier: _multiplier = 4
|
|
@@ -5882,11 +6688,28 @@ const getSpacerStyles = ({
|
|
|
5882
6688
|
}), {
|
|
5883
6689
|
height: theme.spacing(_multiplier),
|
|
5884
6690
|
width: "100%"
|
|
5885
|
-
}), process.env.NODE_ENV === "production" ? "" : ";label:getSpacerStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
6691
|
+
}), 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== */");
|
|
6692
|
+
/**
|
|
6693
|
+
* @internal
|
|
6694
|
+
*
|
|
6695
|
+
* # Spacer Composition Component
|
|
6696
|
+
*
|
|
6697
|
+
* - The `Spacer` is a composition component used to create a space between elements
|
|
6698
|
+
* in the UI.
|
|
6699
|
+
*
|
|
6700
|
+
* @see {@link Spacer.SpacerProps | The props necessary to render the `<Spacer />` component}
|
|
6701
|
+
* @see {@link Spacer.getSpacerStyles | The util function that generates the styles for the `<Spacer />` component}
|
|
6702
|
+
*
|
|
6703
|
+
*/
|
|
5886
6704
|
const Spacer = props => jsxRuntime.jsx("div", {
|
|
5887
6705
|
css: getSpacerStyles(props)
|
|
5888
6706
|
});
|
|
5889
6707
|
|
|
6708
|
+
/**
|
|
6709
|
+
* @internal
|
|
6710
|
+
*
|
|
6711
|
+
* # Spread Component
|
|
6712
|
+
*/
|
|
5890
6713
|
const Spread = ({
|
|
5891
6714
|
children
|
|
5892
6715
|
}) => jsxRuntime.jsx("div", Object.assign({
|
|
@@ -6312,6 +7135,11 @@ const styles$s = createStyles({
|
|
|
6312
7135
|
})
|
|
6313
7136
|
});
|
|
6314
7137
|
|
|
7138
|
+
/**
|
|
7139
|
+
* @namespace WalletHistory
|
|
7140
|
+
*
|
|
7141
|
+
* # Wallet History
|
|
7142
|
+
*/
|
|
6315
7143
|
const WalletHistory = () => {
|
|
6316
7144
|
var _a;
|
|
6317
7145
|
const {
|
|
@@ -6574,6 +7402,11 @@ const LabelLayoutPurchase = ({
|
|
|
6574
7402
|
});
|
|
6575
7403
|
};
|
|
6576
7404
|
|
|
7405
|
+
/**
|
|
7406
|
+
* @internal
|
|
7407
|
+
*
|
|
7408
|
+
* # Loader Component
|
|
7409
|
+
*/
|
|
6577
7410
|
const Loader = props => {
|
|
6578
7411
|
return jsxRuntime.jsx("div", Object.assign({
|
|
6579
7412
|
css: {
|
|
@@ -6691,7 +7524,7 @@ const SaveStatus = ({
|
|
|
6691
7524
|
}))]
|
|
6692
7525
|
}));
|
|
6693
7526
|
}
|
|
6694
|
-
return !isSaving && !errors ? jsxRuntime.jsxs("div", Object.assign({
|
|
7527
|
+
return !isSaving && !(errors === null || errors === void 0 ? void 0 : errors.length) ? jsxRuntime.jsxs("div", Object.assign({
|
|
6695
7528
|
css: styles$r.container
|
|
6696
7529
|
}, {
|
|
6697
7530
|
children: [jsxRuntime.jsx("svg", Object.assign({
|
|
@@ -6755,6 +7588,16 @@ const styles$q = createStyles({
|
|
|
6755
7588
|
})
|
|
6756
7589
|
});
|
|
6757
7590
|
|
|
7591
|
+
/**
|
|
7592
|
+
* @internal
|
|
7593
|
+
*
|
|
7594
|
+
* # Collapsible Panel Component
|
|
7595
|
+
*
|
|
7596
|
+
* - The `<CollapsiblePanel />` composition component is used to group content together that can
|
|
7597
|
+
* be expanded or collapsed.
|
|
7598
|
+
*
|
|
7599
|
+
* @see {@link CollapsiblePanelProps | The props that are passed into the `<CollapsiblePanel />` component}
|
|
7600
|
+
*/
|
|
6758
7601
|
const CollapsiblePanel = ({
|
|
6759
7602
|
errors,
|
|
6760
7603
|
initialExpanded,
|
|
@@ -7002,6 +7845,11 @@ const LabelLayoutSettings = ({
|
|
|
7002
7845
|
}));
|
|
7003
7846
|
};
|
|
7004
7847
|
|
|
7848
|
+
/**
|
|
7849
|
+
* @namespace LabelLayout
|
|
7850
|
+
*
|
|
7851
|
+
* # Label Layout Component
|
|
7852
|
+
*/
|
|
7005
7853
|
const LabelLayout = ({
|
|
7006
7854
|
display
|
|
7007
7855
|
}) => {
|
|
@@ -7034,6 +7882,16 @@ const LabelLayout = ({
|
|
|
7034
7882
|
});
|
|
7035
7883
|
};
|
|
7036
7884
|
|
|
7885
|
+
/**
|
|
7886
|
+
* @internal
|
|
7887
|
+
*
|
|
7888
|
+
* # Button Group Component
|
|
7889
|
+
*
|
|
7890
|
+
* - The `<ButtonGroup />` is a composition component used to group buttons together that are
|
|
7891
|
+
* passed in as children.
|
|
7892
|
+
*
|
|
7893
|
+
* @see {@link ButtonGroupProps | The props that are passed into the `<ButtonGroup />` component}
|
|
7894
|
+
*/
|
|
7037
7895
|
const ButtonGroup = _a => {
|
|
7038
7896
|
var {
|
|
7039
7897
|
children,
|
|
@@ -7070,6 +7928,11 @@ const ButtonGroup = _a => {
|
|
|
7070
7928
|
}));
|
|
7071
7929
|
};
|
|
7072
7930
|
|
|
7931
|
+
/**
|
|
7932
|
+
* @internal
|
|
7933
|
+
*
|
|
7934
|
+
* # Field Label Component
|
|
7935
|
+
*/
|
|
7073
7936
|
const FieldLabel = ({
|
|
7074
7937
|
children,
|
|
7075
7938
|
label,
|
|
@@ -8200,6 +9063,19 @@ const getAcknowledgementLabel = (serviceCode, packageType) => {
|
|
|
8200
9063
|
});
|
|
8201
9064
|
}
|
|
8202
9065
|
return;
|
|
9066
|
+
case "dhl_express_worldwide":
|
|
9067
|
+
return jsxRuntime.jsxs(reactI18next.Trans, Object.assign({
|
|
9068
|
+
i18nKey: "purchase-label:rates.dhlExpressTermsAcknowledgement"
|
|
9069
|
+
}, {
|
|
9070
|
+
children: ["To start shipping with DHL, you are confirming that you have agreed to the ", jsxRuntime.jsx(giger.Link, Object.assign({
|
|
9071
|
+
href: "https://mydhl.express.dhl/us/en/legal/terms-and-conditions.html",
|
|
9072
|
+
isExternal: true,
|
|
9073
|
+
rel: "noreferrer",
|
|
9074
|
+
target: "_blank"
|
|
9075
|
+
}, {
|
|
9076
|
+
children: "terms and conditions"
|
|
9077
|
+
}))]
|
|
9078
|
+
}));
|
|
8203
9079
|
default:
|
|
8204
9080
|
return null;
|
|
8205
9081
|
}
|
|
@@ -8611,6 +9487,10 @@ var fields = /*#__PURE__*/Object.freeze({
|
|
|
8611
9487
|
});
|
|
8612
9488
|
|
|
8613
9489
|
/**
|
|
9490
|
+
* @internal
|
|
9491
|
+
*
|
|
9492
|
+
* # Form Portal Component
|
|
9493
|
+
*
|
|
8614
9494
|
* A drop-in replacement for the `<form>` tag that allows nested forms.
|
|
8615
9495
|
*
|
|
8616
9496
|
* Via portals, the <form> tag is mounted as a sibling of the app root. The form's
|
|
@@ -8680,6 +9560,10 @@ const styles$o = createStyles({
|
|
|
8680
9560
|
});
|
|
8681
9561
|
|
|
8682
9562
|
/**
|
|
9563
|
+
* @internal
|
|
9564
|
+
*
|
|
9565
|
+
* # Money Schema
|
|
9566
|
+
*
|
|
8683
9567
|
* @category Form Validation
|
|
8684
9568
|
*/
|
|
8685
9569
|
const moneySchema = zod.z.object({
|
|
@@ -8688,14 +9572,33 @@ const moneySchema = zod.z.object({
|
|
|
8688
9572
|
});
|
|
8689
9573
|
|
|
8690
9574
|
/**
|
|
9575
|
+
* @internal
|
|
9576
|
+
*
|
|
9577
|
+
* # Phone utils
|
|
9578
|
+
*
|
|
8691
9579
|
* @category Form Validation
|
|
8692
9580
|
*/
|
|
8693
9581
|
const phoneSchema = (defaultCountryCode = "US") => zod.z.string().trim().refine(val => min$3.isValidPhoneNumber(val, defaultCountryCode), "schemaErrors.notAValidPhoneNumber");
|
|
8694
9582
|
/**
|
|
9583
|
+
* @internal
|
|
9584
|
+
*
|
|
9585
|
+
* # Phone utils
|
|
9586
|
+
*
|
|
8695
9587
|
* @category Form Validation
|
|
8696
9588
|
*/
|
|
8697
9589
|
const phoneSchemaUnvalidated = zod.z.string().trim();
|
|
8698
9590
|
|
|
9591
|
+
/**
|
|
9592
|
+
* @internal
|
|
9593
|
+
*
|
|
9594
|
+
* # Add Funds Form Schema
|
|
9595
|
+
*
|
|
9596
|
+
* - A util function to create a dynamic form schema based on the mininum amount
|
|
9597
|
+
* passed into the function.
|
|
9598
|
+
*
|
|
9599
|
+
* @param minimumAmount - The minimum amount that can be added to the account. This defaults to
|
|
9600
|
+
* 10 if nothing is passed in.
|
|
9601
|
+
*/
|
|
8699
9602
|
const getAddFundsSchema = (minimumAmount = 10) => zod.z.object({
|
|
8700
9603
|
funds: moneySchema.extend({
|
|
8701
9604
|
amount: zod.z.number().min(minimumAmount)
|
|
@@ -8703,9 +9606,15 @@ const getAddFundsSchema = (minimumAmount = 10) => zod.z.object({
|
|
|
8703
9606
|
}).transform(data => data.funds);
|
|
8704
9607
|
|
|
8705
9608
|
/**
|
|
8706
|
-
*
|
|
9609
|
+
* @internal
|
|
9610
|
+
*
|
|
9611
|
+
* # Add Funds Form Component
|
|
9612
|
+
*
|
|
9613
|
+
* - Form for adding funds to a carrier's account.
|
|
8707
9614
|
*
|
|
8708
|
-
* If a render child is provided, external control is assumed and the cancel / submit buttons are hidden.
|
|
9615
|
+
* If a `render child` is provided, external control is assumed and the cancel / submit buttons are hidden.
|
|
9616
|
+
*
|
|
9617
|
+
* @see {@link AddFundsFormProps | The props that are passed into the `<AddFundsForm />` component}
|
|
8709
9618
|
*/
|
|
8710
9619
|
const AddFundsForm = ({
|
|
8711
9620
|
carrierId,
|
|
@@ -8847,7 +9756,16 @@ const AddFundsForm = ({
|
|
|
8847
9756
|
}))]
|
|
8848
9757
|
}))]
|
|
8849
9758
|
})]
|
|
8850
|
-
})), children
|
|
9759
|
+
})), !children && addFunds.error && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
9760
|
+
children: [jsxRuntime.jsx(Spacer, {
|
|
9761
|
+
multiplier: 1
|
|
9762
|
+
}), jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
9763
|
+
title: t("manage-funding:addFunds.error.title"),
|
|
9764
|
+
type: giger.NotificationType.ERROR
|
|
9765
|
+
}, {
|
|
9766
|
+
children: addFunds.error[0].message
|
|
9767
|
+
}))]
|
|
9768
|
+
}), children === null || children === void 0 ? void 0 : children({
|
|
8851
9769
|
error: addFunds.error,
|
|
8852
9770
|
isCustomAmount: selectedChip.value === "custom",
|
|
8853
9771
|
isSubmitted,
|
|
@@ -8878,6 +9796,13 @@ const styles$n = createStyles({
|
|
|
8878
9796
|
}
|
|
8879
9797
|
});
|
|
8880
9798
|
|
|
9799
|
+
/**
|
|
9800
|
+
* @internal
|
|
9801
|
+
*
|
|
9802
|
+
* # Auto Funding Form Schema
|
|
9803
|
+
*
|
|
9804
|
+
* @see {@link AutoFundingForm | Auto Funding Form component using this schema}
|
|
9805
|
+
* */
|
|
8881
9806
|
const autoFundingSchema = zod.z.object({
|
|
8882
9807
|
isEnabled: zod.z.boolean(),
|
|
8883
9808
|
lowBalancePurchaseThreshold: moneySchema.extend({
|
|
@@ -8890,10 +9815,19 @@ const autoFundingSchema = zod.z.object({
|
|
|
8890
9815
|
});
|
|
8891
9816
|
|
|
8892
9817
|
/**
|
|
9818
|
+
* @internal
|
|
9819
|
+
*
|
|
9820
|
+
* # Auto Funding Form Component
|
|
9821
|
+
*
|
|
8893
9822
|
* This form that allows users to enable or disable auto funding, and
|
|
8894
9823
|
* configure auto funding rules in ShipEngine API.
|
|
8895
9824
|
*
|
|
8896
9825
|
* @param carrierId The carrierId of the carrier provider you wish to configure auto-funding rules for.
|
|
9826
|
+
*
|
|
9827
|
+
* @returns Element A React element that renders the Auto Funding Form allowing users to configure
|
|
9828
|
+
* auto-funding rules for a given carrier provider.
|
|
9829
|
+
*
|
|
9830
|
+
* @see {@link AutoFundingFormProps | The props that are passed into the `<AutoFundingForm />` component}
|
|
8897
9831
|
*/
|
|
8898
9832
|
const AutoFundingForm = ({
|
|
8899
9833
|
carrierId
|
|
@@ -9070,6 +10004,11 @@ const styles$m = isLabelRight => createStyles({
|
|
|
9070
10004
|
})
|
|
9071
10005
|
});
|
|
9072
10006
|
|
|
10007
|
+
/**
|
|
10008
|
+
* @internal
|
|
10009
|
+
*
|
|
10010
|
+
* # Inline Label Component
|
|
10011
|
+
*/
|
|
9073
10012
|
const InlineLabel = ({
|
|
9074
10013
|
children,
|
|
9075
10014
|
label,
|
|
@@ -9089,6 +10028,16 @@ const styles$l = createStyles({
|
|
|
9089
10028
|
})
|
|
9090
10029
|
});
|
|
9091
10030
|
|
|
10031
|
+
/**
|
|
10032
|
+
* @internal
|
|
10033
|
+
*
|
|
10034
|
+
* # Carrier Balance
|
|
10035
|
+
*
|
|
10036
|
+
* - The `<CarrierBalance />` component is used to display the current balance for a given
|
|
10037
|
+
* carrier provider.
|
|
10038
|
+
*
|
|
10039
|
+
* @see {@link CarrierBalanceProps | The props for the `<CarrierBalance />` component}
|
|
10040
|
+
*/
|
|
9092
10041
|
const CarrierBalance = ({
|
|
9093
10042
|
balance,
|
|
9094
10043
|
carrierId
|
|
@@ -9118,6 +10067,22 @@ const CarrierBalance = ({
|
|
|
9118
10067
|
}));
|
|
9119
10068
|
};
|
|
9120
10069
|
|
|
10070
|
+
/**
|
|
10071
|
+
* @namespace ManageFunding
|
|
10072
|
+
*
|
|
10073
|
+
* # Manage Funding Component
|
|
10074
|
+
*
|
|
10075
|
+
* - The `<ManageFunding />` component is used to manage funding rules and add funds to a carrier
|
|
10076
|
+
* account, and is composed in the `<AccountSettings />` component.
|
|
10077
|
+
*
|
|
10078
|
+
* @param ManageFundingProps The base props that will be passed into the `<ManageFunding />` component.
|
|
10079
|
+
*
|
|
10080
|
+
* @returns Element A React element that renders the `<ManageFunding />` component allowing users
|
|
10081
|
+
* manage funding rules and add funds to their carrier accounts.
|
|
10082
|
+
*
|
|
10083
|
+
* @see {@link ManageFundingProps | The props that are passed into the `<ManageFunding />` component}
|
|
10084
|
+
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<ManageFunding />` component}
|
|
10085
|
+
*/
|
|
9121
10086
|
const ManageFunding = ({
|
|
9122
10087
|
carrierId
|
|
9123
10088
|
}) => {
|
|
@@ -9251,7 +10216,7 @@ const styles$k = createStyles({
|
|
|
9251
10216
|
flex: "1 0 100%"
|
|
9252
10217
|
},
|
|
9253
10218
|
display: "flex",
|
|
9254
|
-
flex: "1 0
|
|
10219
|
+
flex: "1 0 64%",
|
|
9255
10220
|
width: "100%"
|
|
9256
10221
|
},
|
|
9257
10222
|
stateZipWrapper: theme => ({
|
|
@@ -9281,7 +10246,10 @@ const AddressFields = ({
|
|
|
9281
10246
|
const {
|
|
9282
10247
|
t
|
|
9283
10248
|
} = reactI18next.useTranslation();
|
|
9284
|
-
const
|
|
10249
|
+
const {
|
|
10250
|
+
countryCodeOptions,
|
|
10251
|
+
defaultCountryCodeOption
|
|
10252
|
+
} = useCountryCodeOptions(domestic);
|
|
9285
10253
|
const stateCodeOptions = useStateCodeOptions(domestic);
|
|
9286
10254
|
const {
|
|
9287
10255
|
isSubmitted
|
|
@@ -9305,6 +10273,7 @@ const AddressFields = ({
|
|
|
9305
10273
|
nativeLabel: true
|
|
9306
10274
|
}), jsxRuntime.jsx(SelectAutoComplete, {
|
|
9307
10275
|
control: form.control,
|
|
10276
|
+
defaultValue: defaultCountryCodeOption === null || defaultCountryCodeOption === void 0 ? void 0 : defaultCountryCodeOption.value,
|
|
9308
10277
|
form: formId,
|
|
9309
10278
|
label: t("address.fields.countryCode"),
|
|
9310
10279
|
labelWeight: "normal",
|
|
@@ -9453,6 +10422,10 @@ function nullishDefault(defaultValue) {
|
|
|
9453
10422
|
return this.nullish().transform(v => v !== null && v !== void 0 ? v : defaultValue);
|
|
9454
10423
|
}
|
|
9455
10424
|
/**
|
|
10425
|
+
* @internal
|
|
10426
|
+
*
|
|
10427
|
+
* # Form Utilities
|
|
10428
|
+
*
|
|
9456
10429
|
* @category Form Validation
|
|
9457
10430
|
*/
|
|
9458
10431
|
const extendZod = () => {
|
|
@@ -9868,7 +10841,7 @@ const AddressPreferenceSelect = ({
|
|
|
9868
10841
|
warehousePreference: originAddress
|
|
9869
10842
|
})]
|
|
9870
10843
|
})), returnAddress && jsxRuntime.jsxs(giger.GridChild, Object.assign({
|
|
9871
|
-
colSpan:
|
|
10844
|
+
colSpan: 12
|
|
9872
10845
|
}, {
|
|
9873
10846
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
9874
10847
|
css: {
|
|
@@ -9916,6 +10889,7 @@ const AddressPreferenceProvider = props => {
|
|
|
9916
10889
|
onSubmit
|
|
9917
10890
|
} = props;
|
|
9918
10891
|
const [passengerData, setPassengerData] = React.useState();
|
|
10892
|
+
const [userInput, setUserInput] = React.useState();
|
|
9919
10893
|
const {
|
|
9920
10894
|
validate: validateAddress,
|
|
9921
10895
|
validationPreference,
|
|
@@ -9927,6 +10901,7 @@ const AddressPreferenceProvider = props => {
|
|
|
9927
10901
|
onValid,
|
|
9928
10902
|
data
|
|
9929
10903
|
} = payload;
|
|
10904
|
+
setUserInput(addresses);
|
|
9930
10905
|
const validationPreference = yield validateAddress(addresses);
|
|
9931
10906
|
const {
|
|
9932
10907
|
originAddress,
|
|
@@ -9960,6 +10935,7 @@ const AddressPreferenceProvider = props => {
|
|
|
9960
10935
|
return jsxRuntime.jsx(AddressPreferenceContext.Provider, Object.assign({
|
|
9961
10936
|
value: {
|
|
9962
10937
|
data: passengerData,
|
|
10938
|
+
userInput,
|
|
9963
10939
|
validateAddress: internalValidateAddress,
|
|
9964
10940
|
validationPreference
|
|
9965
10941
|
}
|
|
@@ -10213,7 +11189,7 @@ const WalletForm = ({
|
|
|
10213
11189
|
resolver: validationResolver(walletSchema)
|
|
10214
11190
|
});
|
|
10215
11191
|
useBlackboxDetection({
|
|
10216
|
-
onError: () => {
|
|
11192
|
+
onError: React.useCallback(() => {
|
|
10217
11193
|
setCodedErrors(errors => {
|
|
10218
11194
|
const blackBoxError = {
|
|
10219
11195
|
errorCode: "unspecified",
|
|
@@ -10223,8 +11199,8 @@ const WalletForm = ({
|
|
|
10223
11199
|
};
|
|
10224
11200
|
return [...(errors !== null && errors !== void 0 ? errors : []), blackBoxError];
|
|
10225
11201
|
});
|
|
10226
|
-
},
|
|
10227
|
-
onSuccess: bb => form.setValue("iovationBlackbox", bb)
|
|
11202
|
+
}, [setCodedErrors]),
|
|
11203
|
+
onSuccess: React.useCallback(bb => form.setValue("iovationBlackbox", bb), [form.setValue])
|
|
10228
11204
|
});
|
|
10229
11205
|
const watchAddress = form.watch("address");
|
|
10230
11206
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -10620,6 +11596,25 @@ const WalletCard = ({
|
|
|
10620
11596
|
}));
|
|
10621
11597
|
};
|
|
10622
11598
|
|
|
11599
|
+
/**
|
|
11600
|
+
* # Payment Method Settings Component
|
|
11601
|
+
*
|
|
11602
|
+
* - The `<PaymentMethodSettings />` component is used to manage the users payment information
|
|
11603
|
+
* and is composed in the `<AccountSettings />` component. For example, users can update their
|
|
11604
|
+
* billing information.
|
|
11605
|
+
*
|
|
11606
|
+
* @returns Elements A React element that renders the `<PaymentMethodSettings />` component
|
|
11607
|
+
* allowing uses to configure their payment settings.
|
|
11608
|
+
*
|
|
11609
|
+
* @example
|
|
11610
|
+
* ```tsx
|
|
11611
|
+
* <PaymentMethodSettings />
|
|
11612
|
+
* ```
|
|
11613
|
+
*
|
|
11614
|
+
* <br />
|
|
11615
|
+
*
|
|
11616
|
+
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<PaymentMethodSettings />` component}
|
|
11617
|
+
*/
|
|
10623
11618
|
const PaymentMethodSettings = () => {
|
|
10624
11619
|
var _a;
|
|
10625
11620
|
const {
|
|
@@ -10702,6 +11697,14 @@ const styles$f = createStyles({
|
|
|
10702
11697
|
}
|
|
10703
11698
|
});
|
|
10704
11699
|
|
|
11700
|
+
/**
|
|
11701
|
+
* @internal
|
|
11702
|
+
*
|
|
11703
|
+
* # Powered By ShipEngine Component
|
|
11704
|
+
*
|
|
11705
|
+
* - The `<PoweredByShipEngine />` composition component is used to render the
|
|
11706
|
+
* "Powered By ShipEngine" logo throughout the various elements.
|
|
11707
|
+
*/
|
|
10705
11708
|
const PoweredByShipEngine = () => {
|
|
10706
11709
|
const {
|
|
10707
11710
|
t
|
|
@@ -10717,6 +11720,11 @@ const PoweredByShipEngine = () => {
|
|
|
10717
11720
|
}));
|
|
10718
11721
|
};
|
|
10719
11722
|
|
|
11723
|
+
/**
|
|
11724
|
+
* @namespace UnitSettings
|
|
11725
|
+
*
|
|
11726
|
+
* # Unit Settings Component
|
|
11727
|
+
*/
|
|
10720
11728
|
const UnitSettings = () => {
|
|
10721
11729
|
const {
|
|
10722
11730
|
t
|
|
@@ -11673,7 +12681,9 @@ const CustomsItemForm = ({
|
|
|
11673
12681
|
const {
|
|
11674
12682
|
t
|
|
11675
12683
|
} = reactI18next.useTranslation();
|
|
11676
|
-
const
|
|
12684
|
+
const {
|
|
12685
|
+
countryCodeOptions
|
|
12686
|
+
} = useCountryCodeOptions();
|
|
11677
12687
|
const form = reactHookForm.useForm({
|
|
11678
12688
|
defaultValues: customsItem ? {
|
|
11679
12689
|
countryOfOrigin: customsItem.countryOfOrigin,
|
|
@@ -11779,6 +12789,10 @@ const CustomsItemForm = ({
|
|
|
11779
12789
|
};
|
|
11780
12790
|
|
|
11781
12791
|
/**
|
|
12792
|
+
* @internal
|
|
12793
|
+
*
|
|
12794
|
+
* # Copy Button
|
|
12795
|
+
*
|
|
11782
12796
|
* A copy button that copies the content to the users' clipboard and displays a
|
|
11783
12797
|
* checkmark on click.
|
|
11784
12798
|
*/
|
|
@@ -12351,12 +13365,15 @@ const WarehouseForm = ({
|
|
|
12351
13365
|
submitButtonTitle,
|
|
12352
13366
|
warehouse
|
|
12353
13367
|
}) => {
|
|
13368
|
+
var _a, _b;
|
|
12354
13369
|
const {
|
|
12355
13370
|
t
|
|
12356
13371
|
} = reactI18next.useTranslation(["common", "manage-warehouses"]);
|
|
12357
13372
|
const {
|
|
12358
|
-
validateAddress
|
|
13373
|
+
validateAddress,
|
|
13374
|
+
userInput
|
|
12359
13375
|
} = useAddressPreference();
|
|
13376
|
+
const hasDefaultValues = !!warehouse || !!userInput;
|
|
12360
13377
|
const form = reactHookForm.useForm({
|
|
12361
13378
|
defaultValues: warehouse ? Object.assign(Object.assign({}, warehouse), {
|
|
12362
13379
|
isDefault: warehouse.isDefault,
|
|
@@ -12367,6 +13384,14 @@ const WarehouseForm = ({
|
|
|
12367
13384
|
countryCode: warehouse.returnAddress.countryCode
|
|
12368
13385
|
}),
|
|
12369
13386
|
returnToAddressIsDifferent: !_$3.isEqual(warehouse.originAddress, warehouse.returnAddress)
|
|
13387
|
+
}) : userInput ? Object.assign(Object.assign({}, userInput), {
|
|
13388
|
+
originAddress: Object.assign(Object.assign({}, userInput.originAddress), {
|
|
13389
|
+
countryCode: userInput.originAddress.countryCode
|
|
13390
|
+
}),
|
|
13391
|
+
returnAddress: Object.assign(Object.assign({}, userInput.returnAddress), {
|
|
13392
|
+
countryCode: (_a = userInput.returnAddress) === null || _a === void 0 ? void 0 : _a.countryCode
|
|
13393
|
+
}),
|
|
13394
|
+
returnToAddressIsDifferent: (_b = !!userInput.returnAddress) !== null && _b !== void 0 ? _b : false
|
|
12370
13395
|
}) : {
|
|
12371
13396
|
isDefault: _isOnboarding ? true : false,
|
|
12372
13397
|
originAddress: {
|
|
@@ -12377,8 +13402,8 @@ const WarehouseForm = ({
|
|
|
12377
13402
|
resolver: validationResolver(warehouseSchema)
|
|
12378
13403
|
});
|
|
12379
13404
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
12380
|
-
const
|
|
12381
|
-
payload = __rest(
|
|
13405
|
+
const _c = values,
|
|
13406
|
+
payload = __rest(_c, ["returnToAddressIsDifferent"]);
|
|
12382
13407
|
yield validateAddress({
|
|
12383
13408
|
addresses: payload,
|
|
12384
13409
|
data: {
|
|
@@ -12407,12 +13432,6 @@ const WarehouseForm = ({
|
|
|
12407
13432
|
form: form,
|
|
12408
13433
|
formatFieldName: fieldName => `originAddress.${fieldName}`,
|
|
12409
13434
|
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
13435
|
}), !_isOnboarding && jsxRuntime.jsx(CheckboxInput, {
|
|
12417
13436
|
checkboxLabel: t("manage-warehouses:isDefault"),
|
|
12418
13437
|
control: form.control,
|
|
@@ -12440,18 +13459,12 @@ const WarehouseForm = ({
|
|
|
12440
13459
|
});
|
|
12441
13460
|
}
|
|
12442
13461
|
}
|
|
12443
|
-
}), form.watch("returnToAddressIsDifferent") && jsxRuntime.
|
|
12444
|
-
children:
|
|
13462
|
+
}), form.watch("returnToAddressIsDifferent") && jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
13463
|
+
children: jsxRuntime.jsx(AddressFields, {
|
|
12445
13464
|
form: form,
|
|
12446
13465
|
formatFieldName: fieldName => `returnAddress.${fieldName}`,
|
|
12447
13466
|
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
|
-
})]
|
|
13467
|
+
})
|
|
12455
13468
|
}), jsxRuntime.jsxs(ButtonGroup, Object.assign({
|
|
12456
13469
|
justify: "center"
|
|
12457
13470
|
}, {
|
|
@@ -12476,7 +13489,7 @@ const WarehouseForm = ({
|
|
|
12476
13489
|
control: form.control,
|
|
12477
13490
|
"data-testid": "warehouseFormSubmitButton",
|
|
12478
13491
|
form: "warehouse-form",
|
|
12479
|
-
requireDirty: !
|
|
13492
|
+
requireDirty: !hasDefaultValues,
|
|
12480
13493
|
variant: _isOnboarding ? giger.ButtonVariant.FILLED : giger.ButtonVariant.OUTLINED
|
|
12481
13494
|
}, {
|
|
12482
13495
|
children: submitButtonTitle
|
|
@@ -13075,6 +14088,15 @@ const Onboarding = ({
|
|
|
13075
14088
|
let _ = t => t,
|
|
13076
14089
|
_t,
|
|
13077
14090
|
_t2;
|
|
14091
|
+
/**
|
|
14092
|
+
* @internal
|
|
14093
|
+
*
|
|
14094
|
+
* # Cube Component
|
|
14095
|
+
*
|
|
14096
|
+
* - This is a spinning cube that is used to display a loading state.
|
|
14097
|
+
*
|
|
14098
|
+
* @see {@link CubePropTypes | The props that are passed into the `<Cube />` component}
|
|
14099
|
+
*/
|
|
13078
14100
|
const Cube = _a => {
|
|
13079
14101
|
var {
|
|
13080
14102
|
animate = false
|
|
@@ -13102,7 +14124,7 @@ const Cube = _a => {
|
|
|
13102
14124
|
const styles = {
|
|
13103
14125
|
bounce: /*#__PURE__*/react.css(Object.assign({}, animate && {
|
|
13104
14126
|
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,
|
|
14127
|
+
}), process.env.NODE_ENV === "production" ? "" : ";label:bounce;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImN1YmUudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWtDZ0IiLCJmaWxlIjoiY3ViZS50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBfX3Jlc3QgfSBmcm9tIFwidHNsaWJcIjtcclxuaW1wb3J0IHsganN4IGFzIF9qc3ggfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3QvanN4LXJ1bnRpbWVcIjtcclxuaW1wb3J0IHsgY3NzLCBrZXlmcmFtZXMsIHVzZVRoZW1lIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XHJcbi8qKlxyXG4gKiBAaW50ZXJuYWxcclxuICpcclxuICogIyBDdWJlIENvbXBvbmVudFxyXG4gKlxyXG4gKiAtIFRoaXMgaXMgYSBzcGlubmluZyBjdWJlIHRoYXQgaXMgdXNlZCB0byBkaXNwbGF5IGEgbG9hZGluZyBzdGF0ZS5cclxuICpcclxuICogQHNlZSB7QGxpbmsgQ3ViZVByb3BUeXBlcyB8IFRoZSBwcm9wcyB0aGF0IGFyZSBwYXNzZWQgaW50byB0aGUgYDxDdWJlIC8+YCBjb21wb25lbnR9XHJcbiAqL1xyXG5leHBvcnQgY29uc3QgQ3ViZSA9IChfYSkgPT4ge1xyXG4gICAgdmFyIHsgYW5pbWF0ZSA9IGZhbHNlIH0gPSBfYSwgcHJvcHMgPSBfX3Jlc3QoX2EsIFtcImFuaW1hdGVcIl0pO1xyXG4gICAgY29uc3QgdGhlbWUgPSB1c2VUaGVtZSgpO1xyXG4gICAgY29uc3QgYm91bmNlID0ga2V5ZnJhbWVzIGBcbiAgICAwJSwgMTAwJSB7XG4gICAgICB0cmFuc2Zvcm06IHRyYW5zbGF0ZVkoLTI1JSk7XG4gICAgICBhbmltYXRpb24tdGltaW5nLWZ1bmN0aW9uOiBjdWJpYy1iZXppZXIoMC44LCAwLCAxLCAxKTtcbiAgICB9XG4gICAgNTAlIHtcbiAgICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgwKTtcbiAgICAgIGFuaW1hdGlvbi10aW1pbmctZnVuY3Rpb246IGN1YmljLWJlemllcigwLCAwLCAwLjIsIDEpO1xuICAgIH1cbiAgYDtcclxuICAgIGNvbnN0IHNwaW4gPSBrZXlmcmFtZXMgYFxuICAgIGZyb20ge1xuICAgICAgdHJhbnNmb3JtOiByb3RhdGUoMGRlZyk7XG4gICAgfVxuICAgIHRvIHtcbiAgICAgIHRyYW5zZm9ybTogcm90YXRlKDM2MGRlZyk7XG4gICAgfVxuICBgO1xyXG4gICAgY29uc3Qgc3R5bGVzID0ge1xyXG4gICAgICAgIGJvdW5jZTogY3NzKE9iamVjdC5hc3NpZ24oe30sIChhbmltYXRlICYmIHsgYW5pbWF0aW9uOiBgJHtib3VuY2V9IDFzIGluZmluaXRlYCB9KSkpLFxyXG4gICAgICAgIGNvbnRlbnQ6IGNzcyhPYmplY3QuYXNzaWduKHsgY2xpcFJ1bGU6IFwiZXZlbm9kZFwiLCBmaWxsUnVsZTogXCJldmVub2RkXCIsIGhlaWdodDogXCI1cmVtXCIsIHN0cm9rZUxpbmVKb2luOiBcInJvdW5kXCIsIHN0cm9rZU1pdGVyTGltaXQ6IFwiMlwiLCB3aWR0aDogXCI1cmVtXCIgfSwgKGFuaW1hdGUgJiYgeyBhbmltYXRpb246IGAke3NwaW59IDFzIGxpbmVhciBpbmZpbml0ZTtgIH0pKSksXHJcbiAgICB9O1xyXG4gICAgcmV0dXJuIChfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IHN0eWxlcy5ib3VuY2UgfSwgcHJvcHMsIHsgcm9sZTogXCJzdGF0dXNcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwic3ZnXCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IHN0eWxlcy5jb250ZW50LCBoZWlnaHQ6IFwiMTAwJVwiLCB2aWV3Qm94OiBcIjAgMCA0ODkgNDg5XCIsIHdpZHRoOiBcIjEwMCVcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwiZ1wiLCB7IGNoaWxkcmVuOiBfanN4KFwiZ1wiLCB7IGNoaWxkcmVuOiBfanN4KFwicGF0aFwiLCB7IGQ6IFwiTTQ4My42NzQsMTAxLjgzNkM0ODMuNjEsMTAxLjYwNCA0ODMuNTA2LDEwMS4zOTYgNDgzLjQxOCwxMDEuMThDNDgzLjI0MiwxMDAuNzI0IDQ4My4wNSwxMDAuMjg0IDQ4Mi43OTQsOTkuODY4QzQ4Mi42NSw5OS42MzYgNDgyLjQ5OCw5OS40MjggNDgyLjMzLDk5LjIxMkM0ODIuMDU4LDk4Ljg0NCA0ODEuNzU0LDk4LjUwOCA0ODEuNDEsOTguMTk2QzQ4MS4yMSw5OC4wMDQgNDgxLjAxLDk3LjgyOCA0ODAuNzg2LDk3LjY2QzQ4MC42NTgsOTcuNTY0IDQ4MC41NjIsOTcuNDQ0IDQ4MC40MzQsOTcuMzU2QzQ4MC4xMzgsOTcuMTU2IDQ3OS44MSw5Ny4wNDQgNDc5LjQ5OCw5Ni44ODRDNDc5LjMzOCw5Ni44MDQgNDc5LjIxOCw5Ni42ODQgNDc5LjA1LDk2LjYxMkwyNDcuMDUsMC42MTJDMjQ1LjA4MiwtMC4yMDQgMjQyLjg5LC0wLjIwNCAyNDAuOTIyLDAuNjEyTDguOTIyLDk2LjYxMkM4Ljc1NCw5Ni42ODQgOC42MjYsOTYuODA0IDguNDY2LDk2Ljg4NEM4LjE1NCw5Ny4wMzYgNy44MzQsOTcuMTU2IDcuNTQ2LDk3LjM0OEM3LjQxOCw5Ny40MzYgNy4zMjIsOTcuNTU2IDcuMTk0LDk3LjY1MkM2Ljk3LDk3LjgyIDYuNzc4LDk4LjAwNCA2LjU3OCw5OC4xODhDNi4yNDIsOTguNSA1LjkzOCw5OC44MzYgNS42NTgsOTkuMjA0QzUuNDksOTkuNDIgNS4zMzgsOTkuNjI4IDUuMTk0LDk5Ljg2QzQuOTM4LDEwMC4yNzYgNC43NDYsMTAwLjcxNiA0LjU3LDEwMS4xNzJDNC40ODIsMTAxLjM5NiA0LjM3OCwxMDEuNTk2IDQuMzE0LDEwMS44MjhDNC4xMywxMDIuNTMyIDQuMDAyLDEwMy4yNiA0LjAwMiwxMDQuMDA0TDQuMDAyLDM4NC4wMDRDNC4wMDIsMzg3LjI0NCA1Ljk1NCwzOTAuMTY0IDguOTM4LDM5MS4zOTZMMjQwLjkzOCw0ODcuMzk2QzI0MS4wNDIsNDg3LjQzNiAyNDEuMTU0LDQ4Ny40MiAyNDEuMjU4LDQ4Ny40NkMyNDIuMTQ2LDQ4Ny43ODggMjQzLjA1OCw0ODguMDA0IDI0NC4wMDIsNDg4LjAwNEMyNDQuOTQ2LDQ4OC4wMDQgMjQ1Ljg1OCw0ODcuNzg4IDI0Ni43NDYsNDg3LjQ2QzI0Ni44NSw0ODcuNDIgMjQ2Ljk2Miw0ODcuNDM2IDI0Ny4wNjYsNDg3LjM5Nkw0NzkuMDY2LDM5MS4zOTZDNDgyLjA1LDM5MC4xNjQgNDg0LjAwMiwzODcuMjQ0IDQ4NC4wMDIsMzg0LjAwNEw0ODQuMDAyLDEwNC4wMDRDNDg0LjAwMiwxMDMuMjYgNDgzLjg3NCwxMDIuNTMyIDQ4My42NzQsMTAxLjgzNlpNMjM2LjAwMiw0NjguMDI4TDIwLjAwMiwzNzguNjZMMjAuMDAyLDExNS45NzJMMjM2LjAwMiwyMDUuMzQ4TDIzNi4wMDIsNDY4LjAyOFpNMjQ0LjAwMiwxOTEuMzQ4TDMyLjkyMiwxMDQuMDA0TDI0NC4wMDIsMTYuNjZMNDU1LjA4MiwxMDQuMDA0TDI0NC4wMDIsMTkxLjM0OFpNNDY4LjAwMiwzNzguNjZMMjUyLjAwMiw0NjguMDM2TDI1Mi4wMDIsMjA1LjM0OEw0NjguMDAyLDExNS45NzJMNDY4LjAwMiwzNzguNjZaXCIsIGZpbGw6IHRoZW1lLnBhbGV0dGUucHJpbWFyeS5tYWluIH0pIH0pIH0pIH0pKSB9KSkpO1xyXG59O1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1jdWJlLmpzLm1hcCJdfQ== */"),
|
|
13106
14128
|
content: /*#__PURE__*/react.css(Object.assign({
|
|
13107
14129
|
clipRule: "evenodd",
|
|
13108
14130
|
fillRule: "evenodd",
|
|
@@ -13112,7 +14134,7 @@ const Cube = _a => {
|
|
|
13112
14134
|
width: "5rem"
|
|
13113
14135
|
}, animate && {
|
|
13114
14136
|
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,
|
|
14137
|
+
}), process.env.NODE_ENV === "production" ? "" : ";label:content;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImN1YmUudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQW1DaUIiLCJmaWxlIjoiY3ViZS50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBfX3Jlc3QgfSBmcm9tIFwidHNsaWJcIjtcclxuaW1wb3J0IHsganN4IGFzIF9qc3ggfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3QvanN4LXJ1bnRpbWVcIjtcclxuaW1wb3J0IHsgY3NzLCBrZXlmcmFtZXMsIHVzZVRoZW1lIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XHJcbi8qKlxyXG4gKiBAaW50ZXJuYWxcclxuICpcclxuICogIyBDdWJlIENvbXBvbmVudFxyXG4gKlxyXG4gKiAtIFRoaXMgaXMgYSBzcGlubmluZyBjdWJlIHRoYXQgaXMgdXNlZCB0byBkaXNwbGF5IGEgbG9hZGluZyBzdGF0ZS5cclxuICpcclxuICogQHNlZSB7QGxpbmsgQ3ViZVByb3BUeXBlcyB8IFRoZSBwcm9wcyB0aGF0IGFyZSBwYXNzZWQgaW50byB0aGUgYDxDdWJlIC8+YCBjb21wb25lbnR9XHJcbiAqL1xyXG5leHBvcnQgY29uc3QgQ3ViZSA9IChfYSkgPT4ge1xyXG4gICAgdmFyIHsgYW5pbWF0ZSA9IGZhbHNlIH0gPSBfYSwgcHJvcHMgPSBfX3Jlc3QoX2EsIFtcImFuaW1hdGVcIl0pO1xyXG4gICAgY29uc3QgdGhlbWUgPSB1c2VUaGVtZSgpO1xyXG4gICAgY29uc3QgYm91bmNlID0ga2V5ZnJhbWVzIGBcbiAgICAwJSwgMTAwJSB7XG4gICAgICB0cmFuc2Zvcm06IHRyYW5zbGF0ZVkoLTI1JSk7XG4gICAgICBhbmltYXRpb24tdGltaW5nLWZ1bmN0aW9uOiBjdWJpYy1iZXppZXIoMC44LCAwLCAxLCAxKTtcbiAgICB9XG4gICAgNTAlIHtcbiAgICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgwKTtcbiAgICAgIGFuaW1hdGlvbi10aW1pbmctZnVuY3Rpb246IGN1YmljLWJlemllcigwLCAwLCAwLjIsIDEpO1xuICAgIH1cbiAgYDtcclxuICAgIGNvbnN0IHNwaW4gPSBrZXlmcmFtZXMgYFxuICAgIGZyb20ge1xuICAgICAgdHJhbnNmb3JtOiByb3RhdGUoMGRlZyk7XG4gICAgfVxuICAgIHRvIHtcbiAgICAgIHRyYW5zZm9ybTogcm90YXRlKDM2MGRlZyk7XG4gICAgfVxuICBgO1xyXG4gICAgY29uc3Qgc3R5bGVzID0ge1xyXG4gICAgICAgIGJvdW5jZTogY3NzKE9iamVjdC5hc3NpZ24oe30sIChhbmltYXRlICYmIHsgYW5pbWF0aW9uOiBgJHtib3VuY2V9IDFzIGluZmluaXRlYCB9KSkpLFxyXG4gICAgICAgIGNvbnRlbnQ6IGNzcyhPYmplY3QuYXNzaWduKHsgY2xpcFJ1bGU6IFwiZXZlbm9kZFwiLCBmaWxsUnVsZTogXCJldmVub2RkXCIsIGhlaWdodDogXCI1cmVtXCIsIHN0cm9rZUxpbmVKb2luOiBcInJvdW5kXCIsIHN0cm9rZU1pdGVyTGltaXQ6IFwiMlwiLCB3aWR0aDogXCI1cmVtXCIgfSwgKGFuaW1hdGUgJiYgeyBhbmltYXRpb246IGAke3NwaW59IDFzIGxpbmVhciBpbmZpbml0ZTtgIH0pKSksXHJcbiAgICB9O1xyXG4gICAgcmV0dXJuIChfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IHN0eWxlcy5ib3VuY2UgfSwgcHJvcHMsIHsgcm9sZTogXCJzdGF0dXNcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwic3ZnXCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IHN0eWxlcy5jb250ZW50LCBoZWlnaHQ6IFwiMTAwJVwiLCB2aWV3Qm94OiBcIjAgMCA0ODkgNDg5XCIsIHdpZHRoOiBcIjEwMCVcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwiZ1wiLCB7IGNoaWxkcmVuOiBfanN4KFwiZ1wiLCB7IGNoaWxkcmVuOiBfanN4KFwicGF0aFwiLCB7IGQ6IFwiTTQ4My42NzQsMTAxLjgzNkM0ODMuNjEsMTAxLjYwNCA0ODMuNTA2LDEwMS4zOTYgNDgzLjQxOCwxMDEuMThDNDgzLjI0MiwxMDAuNzI0IDQ4My4wNSwxMDAuMjg0IDQ4Mi43OTQsOTkuODY4QzQ4Mi42NSw5OS42MzYgNDgyLjQ5OCw5OS40MjggNDgyLjMzLDk5LjIxMkM0ODIuMDU4LDk4Ljg0NCA0ODEuNzU0LDk4LjUwOCA0ODEuNDEsOTguMTk2QzQ4MS4yMSw5OC4wMDQgNDgxLjAxLDk3LjgyOCA0ODAuNzg2LDk3LjY2QzQ4MC42NTgsOTcuNTY0IDQ4MC41NjIsOTcuNDQ0IDQ4MC40MzQsOTcuMzU2QzQ4MC4xMzgsOTcuMTU2IDQ3OS44MSw5Ny4wNDQgNDc5LjQ5OCw5Ni44ODRDNDc5LjMzOCw5Ni44MDQgNDc5LjIxOCw5Ni42ODQgNDc5LjA1LDk2LjYxMkwyNDcuMDUsMC42MTJDMjQ1LjA4MiwtMC4yMDQgMjQyLjg5LC0wLjIwNCAyNDAuOTIyLDAuNjEyTDguOTIyLDk2LjYxMkM4Ljc1NCw5Ni42ODQgOC42MjYsOTYuODA0IDguNDY2LDk2Ljg4NEM4LjE1NCw5Ny4wMzYgNy44MzQsOTcuMTU2IDcuNTQ2LDk3LjM0OEM3LjQxOCw5Ny40MzYgNy4zMjIsOTcuNTU2IDcuMTk0LDk3LjY1MkM2Ljk3LDk3LjgyIDYuNzc4LDk4LjAwNCA2LjU3OCw5OC4xODhDNi4yNDIsOTguNSA1LjkzOCw5OC44MzYgNS42NTgsOTkuMjA0QzUuNDksOTkuNDIgNS4zMzgsOTkuNjI4IDUuMTk0LDk5Ljg2QzQuOTM4LDEwMC4yNzYgNC43NDYsMTAwLjcxNiA0LjU3LDEwMS4xNzJDNC40ODIsMTAxLjM5NiA0LjM3OCwxMDEuNTk2IDQuMzE0LDEwMS44MjhDNC4xMywxMDIuNTMyIDQuMDAyLDEwMy4yNiA0LjAwMiwxMDQuMDA0TDQuMDAyLDM4NC4wMDRDNC4wMDIsMzg3LjI0NCA1Ljk1NCwzOTAuMTY0IDguOTM4LDM5MS4zOTZMMjQwLjkzOCw0ODcuMzk2QzI0MS4wNDIsNDg3LjQzNiAyNDEuMTU0LDQ4Ny40MiAyNDEuMjU4LDQ4Ny40NkMyNDIuMTQ2LDQ4Ny43ODggMjQzLjA1OCw0ODguMDA0IDI0NC4wMDIsNDg4LjAwNEMyNDQuOTQ2LDQ4OC4wMDQgMjQ1Ljg1OCw0ODcuNzg4IDI0Ni43NDYsNDg3LjQ2QzI0Ni44NSw0ODcuNDIgMjQ2Ljk2Miw0ODcuNDM2IDI0Ny4wNjYsNDg3LjM5Nkw0NzkuMDY2LDM5MS4zOTZDNDgyLjA1LDM5MC4xNjQgNDg0LjAwMiwzODcuMjQ0IDQ4NC4wMDIsMzg0LjAwNEw0ODQuMDAyLDEwNC4wMDRDNDg0LjAwMiwxMDMuMjYgNDgzLjg3NCwxMDIuNTMyIDQ4My42NzQsMTAxLjgzNlpNMjM2LjAwMiw0NjguMDI4TDIwLjAwMiwzNzguNjZMMjAuMDAyLDExNS45NzJMMjM2LjAwMiwyMDUuMzQ4TDIzNi4wMDIsNDY4LjAyOFpNMjQ0LjAwMiwxOTEuMzQ4TDMyLjkyMiwxMDQuMDA0TDI0NC4wMDIsMTYuNjZMNDU1LjA4MiwxMDQuMDA0TDI0NC4wMDIsMTkxLjM0OFpNNDY4LjAwMiwzNzguNjZMMjUyLjAwMiw0NjguMDM2TDI1Mi4wMDIsMjA1LjM0OEw0NjguMDAyLDExNS45NzJMNDY4LjAwMiwzNzguNjZaXCIsIGZpbGw6IHRoZW1lLnBhbGV0dGUucHJpbWFyeS5tYWluIH0pIH0pIH0pIH0pKSB9KSkpO1xyXG59O1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1jdWJlLmpzLm1hcCJdfQ== */")
|
|
13116
14138
|
};
|
|
13117
14139
|
return jsxRuntime.jsx("div", Object.assign({
|
|
13118
14140
|
css: styles.bounce
|
|
@@ -13172,6 +14194,11 @@ const styles$5 = createStyles({
|
|
|
13172
14194
|
})
|
|
13173
14195
|
});
|
|
13174
14196
|
|
|
14197
|
+
/**
|
|
14198
|
+
* @internal
|
|
14199
|
+
*
|
|
14200
|
+
* # Section Component
|
|
14201
|
+
*/
|
|
13175
14202
|
const Section = _a => {
|
|
13176
14203
|
var {
|
|
13177
14204
|
bold,
|
|
@@ -13230,9 +14257,15 @@ const styles$4 = createStyles({
|
|
|
13230
14257
|
});
|
|
13231
14258
|
|
|
13232
14259
|
/**
|
|
14260
|
+
* @internal
|
|
14261
|
+
*
|
|
14262
|
+
* # Fund And Purchase Component
|
|
14263
|
+
*
|
|
13233
14264
|
* Fund and Purchase handles the label purchase submission UX, ensuring that a user
|
|
13234
14265
|
* has the necessary funds available and can add them if not. It allows a single button
|
|
13235
14266
|
* to submit the funding form followed by the purchase form.
|
|
14267
|
+
*
|
|
14268
|
+
* @see {@link FundAndPurchaseProps | The props that are passed into the `<FundAndPurchase />` component}
|
|
13236
14269
|
*/
|
|
13237
14270
|
const FundAndPurchase = ({
|
|
13238
14271
|
balance: uspsBalance,
|
|
@@ -13461,7 +14494,7 @@ const RateForm = ({
|
|
|
13461
14494
|
carriers,
|
|
13462
14495
|
disabled,
|
|
13463
14496
|
errors,
|
|
13464
|
-
|
|
14497
|
+
displayableRateErrors,
|
|
13465
14498
|
displayableLabelErrors,
|
|
13466
14499
|
features,
|
|
13467
14500
|
labelErrors,
|
|
@@ -13475,7 +14508,7 @@ const RateForm = ({
|
|
|
13475
14508
|
shipment,
|
|
13476
14509
|
outOfBandDisplayableErrors
|
|
13477
14510
|
}) => {
|
|
13478
|
-
var _a, _b, _c, _d, _e;
|
|
14511
|
+
var _a, _b, _c, _d, _e, _f;
|
|
13479
14512
|
features = Object.assign({
|
|
13480
14513
|
presentation: {
|
|
13481
14514
|
poweredByShipEngine: false
|
|
@@ -13487,7 +14520,7 @@ const RateForm = ({
|
|
|
13487
14520
|
saveRate: true
|
|
13488
14521
|
}
|
|
13489
14522
|
}, features !== null && features !== void 0 ? features : {});
|
|
13490
|
-
const allDisplayableErrors = [...(
|
|
14523
|
+
const allDisplayableErrors = [...(displayableRateErrors !== null && displayableRateErrors !== void 0 ? displayableRateErrors : []), ...(outOfBandDisplayableErrors !== null && outOfBandDisplayableErrors !== void 0 ? outOfBandDisplayableErrors : [])];
|
|
13491
14524
|
const {
|
|
13492
14525
|
t
|
|
13493
14526
|
} = reactI18next.useTranslation();
|
|
@@ -13522,7 +14555,7 @@ const RateForm = ({
|
|
|
13522
14555
|
});
|
|
13523
14556
|
}
|
|
13524
14557
|
})));
|
|
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));
|
|
14558
|
+
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
14559
|
// Return true if User has multiple accounts for a single carrier.
|
|
13527
14560
|
const hasDuplicateCarrierCode = carriers => {
|
|
13528
14561
|
const uniqueCarrierCodes = new Set();
|
|
@@ -13598,7 +14631,7 @@ const RateForm = ({
|
|
|
13598
14631
|
name: "rate",
|
|
13599
14632
|
nicknameFeature:
|
|
13600
14633
|
// if feature flag is on, and if account has duplicate carrierCodes, then show nickname
|
|
13601
|
-
((
|
|
14634
|
+
((_c = features === null || features === void 0 ? void 0 : features.rateForm) === null || _c === void 0 ? void 0 : _c.nicknameRate) && carriers && hasDuplicateCarrierCode(carriers),
|
|
13602
14635
|
onClick: onSelectRate,
|
|
13603
14636
|
options: showHiddenRates ? rateOptions : filteredRateOptions
|
|
13604
14637
|
}), rateOptions.some(option => option.requiresAcknowledgement) && rateOptions.length > 5 && jsxRuntime.jsx(giger.Link, Object.assign({
|
|
@@ -13636,10 +14669,10 @@ const RateForm = ({
|
|
|
13636
14669
|
type: giger.NotificationType.ERROR
|
|
13637
14670
|
}, {
|
|
13638
14671
|
children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
13639
|
-
children: [
|
|
14672
|
+
children: [displayableRateErrors, outOfBandDisplayableErrors, displayableLabelErrors]
|
|
13640
14673
|
})
|
|
13641
14674
|
}))]
|
|
13642
|
-
})), ((
|
|
14675
|
+
})), ((_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
14676
|
title: t("manage-defaults:label.title")
|
|
13644
14677
|
}, {
|
|
13645
14678
|
children: jsxRuntime.jsx(LabelLayout, {
|
|
@@ -13651,12 +14684,12 @@ const RateForm = ({
|
|
|
13651
14684
|
control: form.control,
|
|
13652
14685
|
css: styles$3.fundAndPurchase,
|
|
13653
14686
|
disabled: disabled,
|
|
13654
|
-
isFundingEnabled: !!((
|
|
14687
|
+
isFundingEnabled: !!((_e = features === null || features === void 0 ? void 0 : features.rateForm) === null || _e === void 0 ? void 0 : _e.enableFunding),
|
|
13655
14688
|
isFundingRequired: (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.balance) !== undefined && !!selectedRate.requiresFundedAmount,
|
|
13656
14689
|
onPurchase: handleSubmit,
|
|
13657
14690
|
onSave: handleSaveRate,
|
|
13658
14691
|
purchaseAmount: getTotalRateAmount(selectedRate)
|
|
13659
|
-
}), ((
|
|
14692
|
+
}), ((_f = features === null || features === void 0 ? void 0 : features.presentation) === null || _f === void 0 ? void 0 : _f.poweredByShipEngine) && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
13660
14693
|
children: [jsxRuntime.jsx(Spacer, {}), jsxRuntime.jsx(PoweredByShipEngine, {})]
|
|
13661
14694
|
})]
|
|
13662
14695
|
}));
|
|
@@ -13728,6 +14761,11 @@ const ItemsBreakdownTableHeader = ({
|
|
|
13728
14761
|
}))]
|
|
13729
14762
|
})
|
|
13730
14763
|
});
|
|
14764
|
+
/**
|
|
14765
|
+
* @internal
|
|
14766
|
+
*
|
|
14767
|
+
* # Items Breakdown Component
|
|
14768
|
+
*/
|
|
13731
14769
|
const ItemsBreakdown = ({
|
|
13732
14770
|
items
|
|
13733
14771
|
}) => {
|
|
@@ -14062,10 +15100,12 @@ const CustomsItemsDisplay = ({
|
|
|
14062
15100
|
extendZod();
|
|
14063
15101
|
const getShipmentSchema = ({
|
|
14064
15102
|
allowInternationalShipFrom,
|
|
14065
|
-
|
|
14066
|
-
requireMeasurements: _requireMeasurements = false,
|
|
15103
|
+
dimensionsUnit,
|
|
14067
15104
|
isContentDescriptionRequired: _isContentDescriptionRequired = false,
|
|
14068
|
-
isCustomsRequired: _isCustomsRequired = false
|
|
15105
|
+
isCustomsRequired: _isCustomsRequired = false,
|
|
15106
|
+
requireMeasurements: _requireMeasurements = false,
|
|
15107
|
+
warehouses,
|
|
15108
|
+
weightUnit
|
|
14069
15109
|
} = {}) => {
|
|
14070
15110
|
const baseSchema = zod.z.object({
|
|
14071
15111
|
advancedOptions: zod.z.object({
|
|
@@ -14096,7 +15136,9 @@ const getShipmentSchema = ({
|
|
|
14096
15136
|
height: zod.z.number().nonnegative().nullishDefault(0),
|
|
14097
15137
|
length: zod.z.number().nonnegative().nullishDefault(0),
|
|
14098
15138
|
width: zod.z.number().nonnegative().nullishDefault(0)
|
|
14099
|
-
}).nullish()).transform(dims => dims ? convertDimensions(dims)
|
|
15139
|
+
}).nullish()).transform(dims => dims ? convertDimensions(Object.assign(Object.assign({}, dims), {
|
|
15140
|
+
unit: dimensionsUnit !== null && dimensionsUnit !== void 0 ? dimensionsUnit : "inch"
|
|
15141
|
+
})) : undefined),
|
|
14100
15142
|
insuredValue: moneySchema.extend({
|
|
14101
15143
|
amount: zod.z.number().positive()
|
|
14102
15144
|
}).optional(),
|
|
@@ -14113,7 +15155,7 @@ const getShipmentSchema = ({
|
|
|
14113
15155
|
}) => whole || fractional, "schemaErrors.required") : zod.z.object({
|
|
14114
15156
|
fractional: zod.z.number().nonnegative().nullishDefault(0),
|
|
14115
15157
|
whole: zod.z.number().nonnegative().nullishDefault(0)
|
|
14116
|
-
}).nullish()).transform(weight => weight ? convertWeight(weight) : undefined)
|
|
15158
|
+
}).nullish()).transform(weight => weight ? convertWeight(weight, weightUnit) : undefined)
|
|
14117
15159
|
}).array().min(1),
|
|
14118
15160
|
service: zod.z.object({
|
|
14119
15161
|
carrierId: zod.z.string().nullish(),
|
|
@@ -14140,7 +15182,9 @@ const getShipmentSchema = ({
|
|
|
14140
15182
|
length,
|
|
14141
15183
|
width,
|
|
14142
15184
|
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)
|
|
15185
|
+
}) => [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), {
|
|
15186
|
+
unit: dimensionsUnit !== null && dimensionsUnit !== void 0 ? dimensionsUnit : "inch"
|
|
15187
|
+
})))
|
|
14144
15188
|
}).array().min(1),
|
|
14145
15189
|
service: zod.z.object({
|
|
14146
15190
|
carrierId: zod.z.string(),
|
|
@@ -14188,6 +15232,7 @@ const getShipmentSchema = ({
|
|
|
14188
15232
|
const minimumShipDate = nextDayCutoff(17);
|
|
14189
15233
|
const maximumShipDate = daysAfter(7, minimumShipDate);
|
|
14190
15234
|
const ShipmentForm = ({
|
|
15235
|
+
accountSettings,
|
|
14191
15236
|
addressLoading,
|
|
14192
15237
|
addressPreference,
|
|
14193
15238
|
charsetWarning,
|
|
@@ -14228,14 +15273,22 @@ const ShipmentForm = ({
|
|
|
14228
15273
|
const [insuranceEnabled, setInsuranceEnabled] = React.useState(false);
|
|
14229
15274
|
const {
|
|
14230
15275
|
isContentDescriptionRequired,
|
|
14231
|
-
isCustomsRequired
|
|
15276
|
+
isCustomsRequired,
|
|
15277
|
+
hasAllZeroMeasurements
|
|
14232
15278
|
} = useShipmentMetadata(shipment);
|
|
15279
|
+
const packageDimensions = shipment === null || shipment === void 0 ? void 0 : shipment.packages[0].dimensions;
|
|
15280
|
+
const packageWeight = shipment === null || shipment === void 0 ? void 0 : shipment.packages[0].weight;
|
|
15281
|
+
// if package specs are all zeroes, assume it is a custom package and default to account settings units
|
|
15282
|
+
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]);
|
|
15283
|
+
const hasMeasurementUnits = React.useMemo(() => !!dimensionsUnit && !!weightUnit, [dimensionsUnit, weightUnit]);
|
|
14233
15284
|
const shipmentSchema = React.useMemo(() => getShipmentSchema({
|
|
15285
|
+
dimensionsUnit,
|
|
14234
15286
|
isContentDescriptionRequired,
|
|
14235
15287
|
isCustomsRequired,
|
|
14236
15288
|
requireMeasurements,
|
|
14237
|
-
warehouses: warehouses !== null && warehouses !== void 0 ? warehouses : []
|
|
14238
|
-
|
|
15289
|
+
warehouses: warehouses !== null && warehouses !== void 0 ? warehouses : [],
|
|
15290
|
+
weightUnit
|
|
15291
|
+
}), [isCustomsRequired, requireMeasurements, warehouses, isContentDescriptionRequired, weightUnit, dimensionsUnit]);
|
|
14239
15292
|
const requestedServices = React.useMemo(() => getRequestedServices(salesOrder), [salesOrder]);
|
|
14240
15293
|
const form = reactHookForm.useForm({
|
|
14241
15294
|
defaultValues: {
|
|
@@ -14286,10 +15339,10 @@ const ShipmentForm = ({
|
|
|
14286
15339
|
const {
|
|
14287
15340
|
whole,
|
|
14288
15341
|
fractional
|
|
14289
|
-
} = formatFractionalWeight(weight);
|
|
15342
|
+
} = formatFractionalWeight(weight, weightUnit);
|
|
14290
15343
|
form.setValue("packages.0.weight.whole", whole);
|
|
14291
15344
|
form.setValue("packages.0.weight.fractional", fractional);
|
|
14292
|
-
}, [form]);
|
|
15345
|
+
}, [form, weightUnit]);
|
|
14293
15346
|
const handleChangeMode = React.useCallback(nextMode => __awaiter(void 0, void 0, void 0, function* () {
|
|
14294
15347
|
if (nextMode === "browse_rates") {
|
|
14295
15348
|
// Browse Rates
|
|
@@ -14797,7 +15850,7 @@ const ShipmentForm = ({
|
|
|
14797
15850
|
name: "packages.0.type",
|
|
14798
15851
|
onCategoryChange: value => form.setValue("carrierId", value),
|
|
14799
15852
|
options: packageOptions
|
|
14800
|
-
}),
|
|
15853
|
+
}), hasMeasurementUnits && requireMeasurements ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
14801
15854
|
children: [jsxRuntime.jsxs(InputGroup, Object.assign({
|
|
14802
15855
|
control: form.control,
|
|
14803
15856
|
disabled: !!findCustomPackage(selectedPackage === null || selectedPackage === void 0 ? void 0 : selectedPackage.code),
|
|
@@ -14810,19 +15863,25 @@ const ShipmentForm = ({
|
|
|
14810
15863
|
control: form.control,
|
|
14811
15864
|
label: t("purchase-label:fields.dimensions.length"),
|
|
14812
15865
|
name: "packages.0.dimensions.length",
|
|
14813
|
-
placeholder: t(
|
|
15866
|
+
placeholder: t(`units.${dimensionsUnit}`)
|
|
14814
15867
|
}), jsxRuntime.jsx(NumberInput, {
|
|
14815
15868
|
control: form.control,
|
|
14816
15869
|
label: t("purchase-label:fields.dimensions.width"),
|
|
14817
15870
|
name: "packages.0.dimensions.width",
|
|
14818
|
-
placeholder: t(
|
|
15871
|
+
placeholder: t(`units.${dimensionsUnit}`)
|
|
14819
15872
|
}), jsxRuntime.jsx(NumberInput, {
|
|
14820
15873
|
control: form.control,
|
|
14821
15874
|
label: t("purchase-label:fields.dimensions.height"),
|
|
14822
15875
|
name: "packages.0.dimensions.height",
|
|
14823
|
-
placeholder: t(
|
|
15876
|
+
placeholder: t(`units.${dimensionsUnit}`)
|
|
14824
15877
|
})]
|
|
14825
|
-
})), jsxRuntime.
|
|
15878
|
+
})), weightUnit && isMetricWeightUnit(weightUnit) ? jsxRuntime.jsx(NumberInput, {
|
|
15879
|
+
control: form.control,
|
|
15880
|
+
label: t("purchase-label:fields.weightGroup"),
|
|
15881
|
+
name: "packages.0.weight.whole",
|
|
15882
|
+
onBlur: handleBlurWeight,
|
|
15883
|
+
placeholder: t(`units.${weightUnit}`)
|
|
15884
|
+
}) : jsxRuntime.jsxs(InputGroup, Object.assign({
|
|
14826
15885
|
control: form.control,
|
|
14827
15886
|
label: t("purchase-label:fields.weightGroup"),
|
|
14828
15887
|
name: "packages.0.weight",
|
|
@@ -14842,6 +15901,26 @@ const ShipmentForm = ({
|
|
|
14842
15901
|
placeholder: t("units.oz")
|
|
14843
15902
|
})]
|
|
14844
15903
|
}))]
|
|
15904
|
+
}) : jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
15905
|
+
children: [jsxRuntime.jsx(FieldLabel, Object.assign({
|
|
15906
|
+
label: t("purchase-label:fields.dimensionsGroup")
|
|
15907
|
+
}, {
|
|
15908
|
+
children: jsxRuntime.jsx(giger.Skeleton, {
|
|
15909
|
+
animation: giger.SkeletonAnimation.WAVE,
|
|
15910
|
+
backgroundColor: giger.SkeletonBackgroundColor.LIGHT,
|
|
15911
|
+
height: 50,
|
|
15912
|
+
variant: giger.SkeletonVariant.TEXT
|
|
15913
|
+
})
|
|
15914
|
+
})), jsxRuntime.jsx(Spacer, {}), jsxRuntime.jsx(FieldLabel, Object.assign({
|
|
15915
|
+
label: t("purchase-label:fields.weightGroup")
|
|
15916
|
+
}, {
|
|
15917
|
+
children: jsxRuntime.jsx(giger.Skeleton, {
|
|
15918
|
+
animation: giger.SkeletonAnimation.WAVE,
|
|
15919
|
+
backgroundColor: giger.SkeletonBackgroundColor.LIGHT,
|
|
15920
|
+
height: 50,
|
|
15921
|
+
variant: giger.SkeletonVariant.TEXT
|
|
15922
|
+
})
|
|
15923
|
+
})), jsxRuntime.jsx(Spacer, {})]
|
|
14845
15924
|
}), isContentDescriptionRequired && jsxRuntime.jsx(TextInput, {
|
|
14846
15925
|
control: form.control,
|
|
14847
15926
|
hint: t("purchase-label:hints.contentDescription"),
|
|
@@ -15020,6 +16099,13 @@ const Shipment = ({
|
|
|
15020
16099
|
const requestedServices = React.useMemo(() => getRequestedServices(salesOrder), [salesOrder]);
|
|
15021
16100
|
const activeLabel = React.useMemo(() => labels === null || labels === void 0 ? void 0 : labels.find(l => l.status === "completed"), [labels]);
|
|
15022
16101
|
const hasSalesOrder = React.useMemo(() => shipment.salesOrderIds.length > 0, [shipment.salesOrderIds.length]);
|
|
16102
|
+
const formatWeight = weight => isMetricWeightUnit(weight.unit) ? t(`weight.${weight.unit}`, {
|
|
16103
|
+
count: weight.value
|
|
16104
|
+
}) : [pounds > 0 ? t("weight.pounds", {
|
|
16105
|
+
count: pounds
|
|
16106
|
+
}) : "", ounces > 0 ? t("weight.ounces", {
|
|
16107
|
+
count: ounces
|
|
16108
|
+
}) : ""].filter(msg => msg.length).join(" ");
|
|
15023
16109
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
15024
16110
|
children: [jsxRuntime.jsxs(Section, Object.assign({
|
|
15025
16111
|
"data-testid": "orderDetail"
|
|
@@ -15105,16 +16191,12 @@ const Shipment = ({
|
|
|
15105
16191
|
"data-testid": "dimensions",
|
|
15106
16192
|
label: t("view-shipment:fields.dimensions")
|
|
15107
16193
|
}, {
|
|
15108
|
-
children: [`${dimensions
|
|
16194
|
+
children: [`${formatDimensions(dimensions)} ` + t(`units.${dimensions.unit}`), jsxRuntime.jsx(Spacer, {})]
|
|
15109
16195
|
})), jsxRuntime.jsx(FieldLabel, Object.assign({
|
|
15110
16196
|
"data-testid": "weight",
|
|
15111
16197
|
label: t("view-shipment:fields.weight")
|
|
15112
16198
|
}, {
|
|
15113
|
-
children:
|
|
15114
|
-
count: pounds
|
|
15115
|
-
}) : "", ounces > 0 ? t("weight.ounces", {
|
|
15116
|
-
count: ounces
|
|
15117
|
-
}) : ""].filter(unit => unit.length).join(" ")
|
|
16199
|
+
children: formatWeight(weight)
|
|
15118
16200
|
}))]
|
|
15119
16201
|
})), jsxRuntime.jsxs(Section, Object.assign({
|
|
15120
16202
|
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 +16350,9 @@ const styles = createStyles({
|
|
|
15268
16350
|
})
|
|
15269
16351
|
});
|
|
15270
16352
|
|
|
16353
|
+
/**
|
|
16354
|
+
* @internal
|
|
16355
|
+
*/
|
|
15271
16356
|
const DateRangeSelect = ({
|
|
15272
16357
|
fullWidth,
|
|
15273
16358
|
onChange,
|
|
@@ -15301,6 +16386,13 @@ const DateRangeSelect = ({
|
|
|
15301
16386
|
}));
|
|
15302
16387
|
};
|
|
15303
16388
|
|
|
16389
|
+
/**
|
|
16390
|
+
* @internal
|
|
16391
|
+
*
|
|
16392
|
+
* # Date Range Combo Component
|
|
16393
|
+
*
|
|
16394
|
+
* @see {@link DateRangeComboProps | This is the type of the props used in the `<DateRangeCombo />` component}
|
|
16395
|
+
*/
|
|
15304
16396
|
const DateRangeCombo = ({
|
|
15305
16397
|
children: renderChildren,
|
|
15306
16398
|
onChange,
|
|
@@ -15345,9 +16437,13 @@ const DateRangeCombo = ({
|
|
|
15345
16437
|
};
|
|
15346
16438
|
|
|
15347
16439
|
/**
|
|
16440
|
+
* @internal
|
|
16441
|
+
*
|
|
16442
|
+
* # Error Fallback Component
|
|
16443
|
+
*
|
|
15348
16444
|
* Fallback component for the Elements ErrorBoundary
|
|
15349
16445
|
*
|
|
15350
|
-
* @see {@link
|
|
16446
|
+
* @see {@link ErrorFallbackProps | The props that are passed into the `<ErrorFallback />` component}
|
|
15351
16447
|
*/
|
|
15352
16448
|
const ErrorFallback = ({
|
|
15353
16449
|
error
|
|
@@ -15381,7 +16477,11 @@ const ErrorFallback = ({
|
|
|
15381
16477
|
};
|
|
15382
16478
|
|
|
15383
16479
|
/**
|
|
15384
|
-
*
|
|
16480
|
+
* @internal
|
|
16481
|
+
*
|
|
16482
|
+
* # Story Notes Component
|
|
16483
|
+
*
|
|
16484
|
+
* - For relevant notes about Storybook stories
|
|
15385
16485
|
*
|
|
15386
16486
|
* Stopgap until we setup https://storybook.js.org/addons/@storybook/addon-docs
|
|
15387
16487
|
*/
|
|
@@ -15666,12 +16766,17 @@ var common = {
|
|
|
15666
16766
|
weight: {
|
|
15667
16767
|
ounces: "{{count}} oz",
|
|
15668
16768
|
pounds_one: "{{count}} lb",
|
|
15669
|
-
pounds_other: "{{count}} lbs"
|
|
16769
|
+
pounds_other: "{{count}} lbs",
|
|
16770
|
+
kilogram: "{{count}} kg",
|
|
16771
|
+
gram: "{{count}} g"
|
|
15670
16772
|
},
|
|
15671
16773
|
units: {
|
|
15672
|
-
|
|
16774
|
+
inch: "in",
|
|
15673
16775
|
lbs: "lbs",
|
|
15674
|
-
oz: "oz"
|
|
16776
|
+
oz: "oz",
|
|
16777
|
+
centimeter: "cm",
|
|
16778
|
+
gram: "g",
|
|
16779
|
+
kilogram: "kg"
|
|
15675
16780
|
},
|
|
15676
16781
|
"VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkMTAwLgo=": "$100 insurance included",
|
|
15677
16782
|
"VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkNTAuCg==": "$50 insurance included",
|
|
@@ -15679,7 +16784,8 @@ var common = {
|
|
|
15679
16784
|
"QWRkcmVzcyBub3QgZm91bmQ=": "There was an issue validating your address. Please try again.",
|
|
15680
16785
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: "UPS weight limit per package is 150 lbs.",
|
|
15681
16786
|
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: "Finish setting up your ShipStation Carriers in the ShipStation app",
|
|
15682
|
-
QSBzaGlwcGluZyBlcnJvciBvY2N1cnJlZDogTWlzc2luZyBvciBpbnZhbGlkIHNoaXBwZXIgbnVtYmVy: "Unable to
|
|
16787
|
+
QSBzaGlwcGluZyBlcnJvciBvY2N1cnJlZDogTWlzc2luZyBvciBpbnZhbGlkIHNoaXBwZXIgbnVtYmVy: "Unable to create label: Missing or Invalid Shipper Number. Please contact our support team to reset the carrier connection for your account.",
|
|
16788
|
+
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
16789
|
"QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBNaXNzaW5nIG9yIGludmFsaWQgc2hpcCB0byBTdGF0ZVByb3ZpbmNlQ29kZQ==": "The State/Province Code Exceeds 5 Characters. Shorten the abbreviation or remove it, then try again.",
|
|
15684
16790
|
"QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnZhbGlkIHNvbGQgdG8gc3RhdGUgcHJvdmluY2UgY29kZS4gVmFsaWQgbGVuZ3RoIGlzIDAgdG8gNSBhbHBoYW51bWVyaWM=": "The State/Province Code Exceeds 5 Characters. Shorten the abbreviation or remove it, then try again."
|
|
15685
16791
|
};
|
|
@@ -15935,7 +17041,8 @@ var purchaseLabel$1 = {
|
|
|
15935
17041
|
},
|
|
15936
17042
|
rates: {
|
|
15937
17043
|
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."
|
|
17044
|
+
uspsFirstClassMailAcknowledgement_leof: "I understand the limitations and confirm that this package is compliant with USPS guidelines for First Class Mail Large Envelopes or Flats.",
|
|
17045
|
+
dhlExpressTermsAcknowledgement: "To start shipping with DHL, you are confirming that you have agreed to the <1>terms and conditions</1>"
|
|
15939
17046
|
},
|
|
15940
17047
|
shipToAddressFormFields: "Ship To Address Form Fields",
|
|
15941
17048
|
sections: {
|
|
@@ -16085,6 +17192,31 @@ var walletHistory = {
|
|
|
16085
17192
|
|
|
16086
17193
|
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
17194
|
|
|
17195
|
+
/**
|
|
17196
|
+
* # Account Settings Component
|
|
17197
|
+
*
|
|
17198
|
+
* - The `<AccountSettings />` component is used to display the user's account settings, as well as
|
|
17199
|
+
* allowing them to make changes to various aspects of their account.
|
|
17200
|
+
*
|
|
17201
|
+
* @param onSaveSettings Any `void` function you wish to execute when the user saves any changes
|
|
17202
|
+
* to their account settings.
|
|
17203
|
+
*
|
|
17204
|
+
* @returns Element An EmotionJSX.Element that will render the `<AccountSettings />` component
|
|
17205
|
+
* with all the appropriate wrappers.
|
|
17206
|
+
*
|
|
17207
|
+
* @example
|
|
17208
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
17209
|
+
* ```tsx
|
|
17210
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
17211
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
17212
|
+
* resources: { en },
|
|
17213
|
+
* });
|
|
17214
|
+
* ```
|
|
17215
|
+
*
|
|
17216
|
+
* <br />
|
|
17217
|
+
*
|
|
17218
|
+
* @see {@link AccountSettings.Element | The **Element** created to render `<AccountSettings />`}
|
|
17219
|
+
*/
|
|
16088
17220
|
const Component$4 = ({
|
|
16089
17221
|
onSaveSettings
|
|
16090
17222
|
}) => {
|
|
@@ -16096,6 +17228,32 @@ const Component$4 = ({
|
|
|
16096
17228
|
onSaveSettings: onSaveSettings
|
|
16097
17229
|
});
|
|
16098
17230
|
};
|
|
17231
|
+
/**
|
|
17232
|
+
* # Registered Account Settings Element
|
|
17233
|
+
*
|
|
17234
|
+
* - This is the registered `<AccountSettings />` element that will be used to render the
|
|
17235
|
+
* `<AccountSettings.Element />` component.
|
|
17236
|
+
*
|
|
17237
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
17238
|
+
* the `<AccountSettings.Element />` component.
|
|
17239
|
+
*
|
|
17240
|
+
* @example
|
|
17241
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `AccountSettings`
|
|
17242
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
17243
|
+
* ```tsx
|
|
17244
|
+
* <AccountSettings.Element
|
|
17245
|
+
* onSaveSettings={() => console.log('Settings Saved!')}
|
|
17246
|
+
* />
|
|
17247
|
+
* ```
|
|
17248
|
+
*
|
|
17249
|
+
* <br />
|
|
17250
|
+
*
|
|
17251
|
+
* @see {@link AccountSettings.ComponentProps | The **props** that can be passed into the `<AccountSettings.Element />` component}
|
|
17252
|
+
* @see {@link ListCarriers.Component | The `<List-Carriers />` component used to view connected carriers}
|
|
17253
|
+
* @see {@link ManageWarehouses.Component | The `<ManageWarehouses />` component used to add, update, or remove warehouses}
|
|
17254
|
+
* @see {@link PaymentMethodSettings | The `<PaymentMethodSettings />` component used to manage payment methods}
|
|
17255
|
+
* @see {@link ManageFunding | The `<ManageFunding />` component used to manage funding rules and add funds to a carrier account}
|
|
17256
|
+
*/
|
|
16099
17257
|
const Element$5 = alchemy__default["default"].createElement(Component$4, ErrorFallback, {
|
|
16100
17258
|
css: {
|
|
16101
17259
|
height: "100%",
|
|
@@ -16114,6 +17272,39 @@ var accountSettings = /*#__PURE__*/Object.freeze({
|
|
|
16114
17272
|
Element: Element$5
|
|
16115
17273
|
});
|
|
16116
17274
|
|
|
17275
|
+
/**
|
|
17276
|
+
* # Onboarding Component
|
|
17277
|
+
*
|
|
17278
|
+
* - The `<Onboarding />` component is used to onboard a new user to the ShipEngine platform. This
|
|
17279
|
+
* component will allow the user to create a warehouse, register a carrier, and create a funding
|
|
17280
|
+
* source for their account. This is everything a user needs to begin fulfilling their shipments
|
|
17281
|
+
* using the ShipEngine Platform.
|
|
17282
|
+
*
|
|
17283
|
+
* @param ComponentProps The base props that will be passed into the `<Onboarding />` component.
|
|
17284
|
+
*
|
|
17285
|
+
* @returns Element An EmotionJSX.Element that will render the `<Onboarding />` component
|
|
17286
|
+
* with all the appropriate wrappers.
|
|
17287
|
+
*
|
|
17288
|
+
* @example
|
|
17289
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
17290
|
+
* ```tsx
|
|
17291
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
17292
|
+
* css: {
|
|
17293
|
+
* height: "100%",
|
|
17294
|
+
* maxWidth: "800px",
|
|
17295
|
+
* minWidth: "440px",
|
|
17296
|
+
* overflow: "auto",
|
|
17297
|
+
* scrollbarGutter: "stable both-edges",
|
|
17298
|
+
* width: "100%",
|
|
17299
|
+
* },
|
|
17300
|
+
* resources: { en },
|
|
17301
|
+
* });
|
|
17302
|
+
* ```
|
|
17303
|
+
*
|
|
17304
|
+
* <br />
|
|
17305
|
+
*
|
|
17306
|
+
* @see {@link Onboarding.Element | The **Element** created to render `<Onboarding />`}
|
|
17307
|
+
*/
|
|
16117
17308
|
const Component$3 = ({
|
|
16118
17309
|
features,
|
|
16119
17310
|
onboardingAddress,
|
|
@@ -16182,6 +17373,28 @@ const Component$3 = ({
|
|
|
16182
17373
|
warehouses: warehouses
|
|
16183
17374
|
});
|
|
16184
17375
|
};
|
|
17376
|
+
/**
|
|
17377
|
+
* # Registered Onboarding Element
|
|
17378
|
+
*
|
|
17379
|
+
* - This is the registered `<Onboarding />` element that will be used to render the
|
|
17380
|
+
* `<Onboarding.Element />` component.
|
|
17381
|
+
*
|
|
17382
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
17383
|
+
* the `<Onboarding.Element />` component.
|
|
17384
|
+
*
|
|
17385
|
+
* @example
|
|
17386
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `Onboarding`
|
|
17387
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
17388
|
+
* ```tsx
|
|
17389
|
+
* <Onboarding.Element
|
|
17390
|
+
* onCompleteOnboarding={() => console.log('Onboarding Complete!')}
|
|
17391
|
+
* />
|
|
17392
|
+
* ```
|
|
17393
|
+
*
|
|
17394
|
+
* <br />
|
|
17395
|
+
*
|
|
17396
|
+
* @see {@link Onboarding.ComponentProps | The **props** that can be passed into the `<Onboarding.Element />` component}
|
|
17397
|
+
*/
|
|
16185
17398
|
const Element$4 = alchemy__default["default"].createElement(Component$3, ErrorFallback, {
|
|
16186
17399
|
css: {
|
|
16187
17400
|
height: "100%",
|
|
@@ -16442,27 +17655,6 @@ const usePresets = ({
|
|
|
16442
17655
|
};
|
|
16443
17656
|
};
|
|
16444
17657
|
|
|
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
17658
|
var usps_first_class_mail = [
|
|
16467
17659
|
"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
17660
|
];
|
|
@@ -16555,11 +17747,13 @@ const useRequestRates = ({
|
|
|
16555
17747
|
reset: resetRates,
|
|
16556
17748
|
mutateAsync: calculateRates
|
|
16557
17749
|
} = alchemy.useCalculateRates();
|
|
16558
|
-
const requestRates = React.useCallback(shipment => __awaiter(void 0, void 0, void 0, function* () {
|
|
16559
|
-
var _a;
|
|
17750
|
+
const requestRates = React.useCallback((shipment, isInternational) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17751
|
+
var _a, _b;
|
|
17752
|
+
const internationalCarrierIds = (_a = carriers === null || carriers === void 0 ? void 0 : carriers.map(c => c.carrierId)) !== null && _a !== void 0 ? _a : [];
|
|
17753
|
+
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
17754
|
const result = yield calculateRates({
|
|
16561
17755
|
rateOptions: {
|
|
16562
|
-
carrierIds: shipment.carrierId ? [shipment.carrierId] :
|
|
17756
|
+
carrierIds: shipment.carrierId ? [shipment.carrierId] : isInternational ? internationalCarrierIds : domesticCarrierIds,
|
|
16563
17757
|
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
17758
|
: shipment.packages.map(pkg => pkg.packageCode),
|
|
16565
17759
|
serviceCodes: shipment.serviceCode ? [shipment.serviceCode] : undefined
|
|
@@ -16642,6 +17836,9 @@ const useRatesForm = ({
|
|
|
16642
17836
|
}) => {
|
|
16643
17837
|
var _a, _b;
|
|
16644
17838
|
const [beforeCreateError, setBeforeCreateError] = React.useState();
|
|
17839
|
+
const {
|
|
17840
|
+
isInternational
|
|
17841
|
+
} = useShipmentMetadata(shipment);
|
|
16645
17842
|
const {
|
|
16646
17843
|
data: carriers
|
|
16647
17844
|
} = alchemy.useListCarriers();
|
|
@@ -16714,11 +17911,11 @@ const useRatesForm = ({
|
|
|
16714
17911
|
shipDate: isNowOrInTheFuture(shipment.shipDate) ? shipment.shipDate : undefined
|
|
16715
17912
|
}));
|
|
16716
17913
|
if (updatedShipment) {
|
|
16717
|
-
yield requestRates(updatedShipment);
|
|
17914
|
+
yield requestRates(updatedShipment, isInternational);
|
|
16718
17915
|
yield onShipmentUpdated === null || onShipmentUpdated === void 0 ? void 0 : onShipmentUpdated(updatedShipment);
|
|
16719
17916
|
yield onRateSaved === null || onRateSaved === void 0 ? void 0 : onRateSaved(updatedShipment);
|
|
16720
17917
|
}
|
|
16721
|
-
}), [onRateSaved, onShipmentUpdated, requestRates, shipment, updateShipment]);
|
|
17918
|
+
}), [isInternational, onRateSaved, onShipmentUpdated, requestRates, shipment, updateShipment]);
|
|
16722
17919
|
let errors = [...(ratesErrors !== null && ratesErrors !== void 0 ? ratesErrors : []), ...((_a = ratesResponse === null || ratesResponse === void 0 ? void 0 : ratesResponse.errors) !== null && _a !== void 0 ? _a : [])];
|
|
16723
17920
|
if (beforeCreateError) errors = [...errors, beforeCreateError];
|
|
16724
17921
|
// Sometimes no rates are returned and no top-level errors are returned
|
|
@@ -16733,7 +17930,7 @@ const useRatesForm = ({
|
|
|
16733
17930
|
name: "CodedError"
|
|
16734
17931
|
})))) !== null && _b !== void 0 ? _b : [];
|
|
16735
17932
|
}
|
|
16736
|
-
const
|
|
17933
|
+
const displayableRateErrors = useScrubErrors({
|
|
16737
17934
|
errors: errors,
|
|
16738
17935
|
predicate: React.useCallback(e => e.message.includes("No rates are available for service_codes"), []),
|
|
16739
17936
|
scrubber: React.useCallback(() => "common:errorMessages.noRatesAvailable", [])
|
|
@@ -16744,8 +17941,8 @@ const useRatesForm = ({
|
|
|
16744
17941
|
});
|
|
16745
17942
|
return {
|
|
16746
17943
|
carriers,
|
|
16747
|
-
displayableErrors,
|
|
16748
17944
|
displayableLabelErrors,
|
|
17945
|
+
displayableRateErrors,
|
|
16749
17946
|
errors: errors.length > 0 ? errors : undefined,
|
|
16750
17947
|
isLoading: ratesCalculating,
|
|
16751
17948
|
labelErrors: (labelErrors === null || labelErrors === void 0 ? void 0 : labelErrors.length) ? labelErrors : undefined,
|
|
@@ -16780,6 +17977,9 @@ const useShipmentForm = ({
|
|
|
16780
17977
|
const {
|
|
16781
17978
|
data: warehouses
|
|
16782
17979
|
} = alchemy.useListWarehouses();
|
|
17980
|
+
const {
|
|
17981
|
+
data: accountSettings
|
|
17982
|
+
} = alchemy.useGetAccountSettings();
|
|
16783
17983
|
const {
|
|
16784
17984
|
error: updateShipmentErrors,
|
|
16785
17985
|
mutateAsync: updateShipment,
|
|
@@ -16839,6 +18039,7 @@ const useShipmentForm = ({
|
|
|
16839
18039
|
scrubber: React.useCallback(() => "common:errorMessages.noRatesAvailable", [])
|
|
16840
18040
|
});
|
|
16841
18041
|
return {
|
|
18042
|
+
accountSettings,
|
|
16842
18043
|
addressLoading,
|
|
16843
18044
|
addressPreference,
|
|
16844
18045
|
carriers,
|
|
@@ -16878,6 +18079,9 @@ const ConfigureShipment = _a => {
|
|
|
16878
18079
|
} = _a,
|
|
16879
18080
|
props = __rest(_a, ["features", "onAddressValidation", "onApplyPreset", "onBeforeLabelCreate", "onChangeAddress", "onLabelCreateFailure", "onLabelCreateSuccess", "onRateSaved", "onRatesCalculated", "onShipmentUpdated", "printLabelLayout", "salesOrder", "shipment"]);
|
|
16880
18081
|
const hydrateRef = React.useRef();
|
|
18082
|
+
const {
|
|
18083
|
+
isInternational
|
|
18084
|
+
} = useShipmentMetadata(shipment);
|
|
16881
18085
|
const _b = useRatesForm({
|
|
16882
18086
|
onBeforeLabelCreate,
|
|
16883
18087
|
onLabelCreateFailure,
|
|
@@ -16904,15 +18108,15 @@ const ConfigureShipment = _a => {
|
|
|
16904
18108
|
onApplyPreset: React.useCallback((_preset, shipment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16905
18109
|
var _d;
|
|
16906
18110
|
if (shipment.packages[0].weight.value) {
|
|
16907
|
-
yield requestRates(shipment);
|
|
18111
|
+
yield requestRates(shipment, isInternational);
|
|
16908
18112
|
}
|
|
16909
18113
|
(_d = hydrateRef.current) === null || _d === void 0 ? void 0 : _d.call(hydrateRef, shipment);
|
|
16910
|
-
}), [requestRates]),
|
|
18114
|
+
}), [requestRates, isInternational]),
|
|
16911
18115
|
onChangeAddress,
|
|
16912
18116
|
onShipmentUpdated,
|
|
16913
18117
|
onSubmit: React.useCallback(shipment => __awaiter(void 0, void 0, void 0, function* () {
|
|
16914
|
-
yield requestRates(shipment);
|
|
16915
|
-
}), [requestRates]),
|
|
18118
|
+
yield requestRates(shipment, isInternational);
|
|
18119
|
+
}), [requestRates, isInternational]),
|
|
16916
18120
|
salesOrder,
|
|
16917
18121
|
shipment
|
|
16918
18122
|
}),
|
|
@@ -17214,6 +18418,30 @@ const PurchaseLabelByShipment = _a => {
|
|
|
17214
18418
|
}));
|
|
17215
18419
|
};
|
|
17216
18420
|
|
|
18421
|
+
/**
|
|
18422
|
+
* # Purchase Label Component
|
|
18423
|
+
*
|
|
18424
|
+
* The `<PurchaseLabel />` component is used to purchase shipping labels from various carriers
|
|
18425
|
+
*
|
|
18426
|
+
* @param ElementProps The props necessary to render the `<PurchaseLabel />` component for shipment
|
|
18427
|
+
* based or sales order based label purchasing.
|
|
18428
|
+
*
|
|
18429
|
+
* @returns Element An EmotionJSX.Element that will render the `<PurchaseLabel />` component
|
|
18430
|
+
* with all the appropriate wrappers.
|
|
18431
|
+
*
|
|
18432
|
+
* @example
|
|
18433
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
18434
|
+
* ```tsx
|
|
18435
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
18436
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
18437
|
+
* resources: { en },
|
|
18438
|
+
* });
|
|
18439
|
+
* ```
|
|
18440
|
+
*
|
|
18441
|
+
* <br />
|
|
18442
|
+
*
|
|
18443
|
+
* @see {@link PurchaseLabel.Element | The **Element** created to render `<PurchaseLabel />`}
|
|
18444
|
+
*/
|
|
17217
18445
|
const Component$2 = _a => {
|
|
17218
18446
|
var props = __rest(_a, []);
|
|
17219
18447
|
if ("salesOrderId" in props || "orderSourceCode" in props) {
|
|
@@ -17222,6 +18450,44 @@ const Component$2 = _a => {
|
|
|
17222
18450
|
return jsxRuntime.jsx(PurchaseLabelByShipment, Object.assign({}, props));
|
|
17223
18451
|
}
|
|
17224
18452
|
};
|
|
18453
|
+
/**
|
|
18454
|
+
* # Registered Purchase Label Element
|
|
18455
|
+
*
|
|
18456
|
+
* @param ElementProps The props necessary to render the `<PurchaseLabel.Element />` for shipment
|
|
18457
|
+
* based or sales order based label purchasing.
|
|
18458
|
+
*
|
|
18459
|
+
* @example
|
|
18460
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `PurchaseLabel`
|
|
18461
|
+
* Element directly.
|
|
18462
|
+
* ```tsx
|
|
18463
|
+
* <PurchaseLabel.Element
|
|
18464
|
+
* key={currentSalesOrderId}
|
|
18465
|
+
* printLabelLayout='4x6'
|
|
18466
|
+
* shippingPresets={presets}
|
|
18467
|
+
* onShipmentUpdated={(shipment) => console.log('Shipment Updated', shipment)}
|
|
18468
|
+
* onRateSaved={(
|
|
18469
|
+
* shipment: SE.SalesOrderShipment,
|
|
18470
|
+
* rate?: SE.Rate,
|
|
18471
|
+
* rateOptions?: SE.Rate[]
|
|
18472
|
+
* ) => console.log('Rate Saved', shipment, rate, rateOptions)}
|
|
18473
|
+
* onRatesCalculated={() => console.log('Rates Calculated')}
|
|
18474
|
+
* onBeforeLabelCreate={onBeforeLabelPurchase}
|
|
18475
|
+
* onLabelCreateSuccess={onLabelPurchaseSuccess}
|
|
18476
|
+
* onLabelCreateFailure={(rate) => console.log('Label Purchase Failed', rate)}
|
|
18477
|
+
* warehouseId={defaultWarehouseId}
|
|
18478
|
+
* />
|
|
18479
|
+
* ```
|
|
18480
|
+
*
|
|
18481
|
+
* <br />
|
|
18482
|
+
*
|
|
18483
|
+
* - Once a label has been purchased using this Element, you can take the `shipmentId` for the
|
|
18484
|
+
* associated shipment and pass it into the `<ViewShipment.Element />` Element in order to view
|
|
18485
|
+
* the shipment details.
|
|
18486
|
+
*
|
|
18487
|
+
* @see {@link PurchaseLabel.PurchaseLabelCommonProps | The **Common props** used in `<PurchaseLabel.Element />`}
|
|
18488
|
+
*
|
|
18489
|
+
* @see {@link ViewShipment.Element | The next step in the label purchase workflow `<ViewShipment.Element />`}
|
|
18490
|
+
*/
|
|
17225
18491
|
const Element$3 = alchemy__default["default"].createElement(Component$2, ErrorFallback, {
|
|
17226
18492
|
css: {
|
|
17227
18493
|
height: "100%",
|
|
@@ -17240,6 +18506,31 @@ var purchaseLabel = /*#__PURE__*/Object.freeze({
|
|
|
17240
18506
|
Element: Element$3
|
|
17241
18507
|
});
|
|
17242
18508
|
|
|
18509
|
+
/**
|
|
18510
|
+
* # View Shipment Component
|
|
18511
|
+
*
|
|
18512
|
+
* - The `<ViewShipment />` component is used to for viewing the shipment's tracking number, printing the label that
|
|
18513
|
+
* was created, and the option to void the label. When a label is voided, you can see a list of the
|
|
18514
|
+
* previously voided labels for a given shipment using this component.
|
|
18515
|
+
*
|
|
18516
|
+
* @param ComponentProps The base props that will be passed into the `<ViewShipment />` component.
|
|
18517
|
+
*
|
|
18518
|
+
* @returns Element An EmotionJSX.Element that will render the `<ViewShipment />` component
|
|
18519
|
+
* with all the appropriate wrappers.
|
|
18520
|
+
*
|
|
18521
|
+
* @example
|
|
18522
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
18523
|
+
* ```tsx
|
|
18524
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
18525
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
18526
|
+
* resources: { en },
|
|
18527
|
+
* });
|
|
18528
|
+
* ```
|
|
18529
|
+
*
|
|
18530
|
+
* <br />
|
|
18531
|
+
*
|
|
18532
|
+
* @see {@link ViewShipment.Element | The **Element** created to render `<ViewShipment />`}
|
|
18533
|
+
*/
|
|
17243
18534
|
const Component$1 = ({
|
|
17244
18535
|
features,
|
|
17245
18536
|
onClickPrintLabel,
|
|
@@ -17279,6 +18570,36 @@ const Component$1 = ({
|
|
|
17279
18570
|
warehouse: warehouse
|
|
17280
18571
|
});
|
|
17281
18572
|
};
|
|
18573
|
+
/**
|
|
18574
|
+
* # Registered View Shipment Element
|
|
18575
|
+
*
|
|
18576
|
+
* - This is the registered `<ViewShipment />` element that will be used to render the
|
|
18577
|
+
* `<ViewShipment.Element />` component.
|
|
18578
|
+
*
|
|
18579
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
18580
|
+
* the `<ViewShipment.Element />` component.
|
|
18581
|
+
*
|
|
18582
|
+
* @example
|
|
18583
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `ViewShipment`
|
|
18584
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
18585
|
+
* ```tsx
|
|
18586
|
+
* <ViewShipment.Element
|
|
18587
|
+
* onClickPurchaseLabel={({ salesOrderId }) => {
|
|
18588
|
+
* console.log('sales order ID', salesOrderId);
|
|
18589
|
+
* }}
|
|
18590
|
+
* onClickVoidLabel={({ labelId }) => {
|
|
18591
|
+
* console.log('voided label', labelId);
|
|
18592
|
+
* }}
|
|
18593
|
+
* shipmentId="se-1234567"
|
|
18594
|
+
* />
|
|
18595
|
+
* ```
|
|
18596
|
+
*
|
|
18597
|
+
* <br />
|
|
18598
|
+
*
|
|
18599
|
+
* @see {@link ViewShipment.ComponentProps | The **props** that can be passed into the `<ViewShipment.Element />` component}
|
|
18600
|
+
*
|
|
18601
|
+
* @see {@link VoidLabel.Element | The next step in the label purchase workflow `<VoidLabel.Element />`}
|
|
18602
|
+
**/
|
|
17282
18603
|
const Element$2 = alchemy__default["default"].createElement(Component$1, ErrorFallback, {
|
|
17283
18604
|
css: {
|
|
17284
18605
|
height: "100%",
|
|
@@ -17402,6 +18723,31 @@ const Message = ({
|
|
|
17402
18723
|
});
|
|
17403
18724
|
};
|
|
17404
18725
|
|
|
18726
|
+
/**
|
|
18727
|
+
* # Void Label Component
|
|
18728
|
+
*
|
|
18729
|
+
* - The `<VoidLabel />` component is used to void a given shipping label. When a label is voided,
|
|
18730
|
+
* you then get the option to view the associated shipment via the `View Shipment` Element, or
|
|
18731
|
+
* you can purchase another label for the shipment via the `Purchase Label` Element.
|
|
18732
|
+
*
|
|
18733
|
+
* @param ComponentProps The base props that will be passed into the `<VoidLabel />` component.
|
|
18734
|
+
*
|
|
18735
|
+
* @returns Element An EmotionJSX.Element that will render the `<VoidLabel />` component
|
|
18736
|
+
* with all the appropriate wrappers.
|
|
18737
|
+
*
|
|
18738
|
+
* @example
|
|
18739
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
18740
|
+
* ```tsx
|
|
18741
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
18742
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
18743
|
+
* resources: { en },
|
|
18744
|
+
* });
|
|
18745
|
+
* ```
|
|
18746
|
+
*
|
|
18747
|
+
* <br />
|
|
18748
|
+
*
|
|
18749
|
+
* @see {@link VoidLabel.Element | The **Element** created to render `<VoidLabel />`}
|
|
18750
|
+
*/
|
|
17405
18751
|
const Component = ({
|
|
17406
18752
|
features,
|
|
17407
18753
|
labelId,
|
|
@@ -17453,6 +18799,37 @@ const Component = ({
|
|
|
17453
18799
|
})]
|
|
17454
18800
|
});
|
|
17455
18801
|
};
|
|
18802
|
+
/**
|
|
18803
|
+
* # Registered Void Label Element
|
|
18804
|
+
*
|
|
18805
|
+
* - This is the registered `<VoidLabel />` element that will be used to render the
|
|
18806
|
+
* `<VoidLabel.Element />` component.
|
|
18807
|
+
*
|
|
18808
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
18809
|
+
* the `<VoidLabel.Element />` component.
|
|
18810
|
+
*
|
|
18811
|
+
* @example
|
|
18812
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `VoidLabel`
|
|
18813
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
18814
|
+
* ```tsx
|
|
18815
|
+
* <VoidLabel.Element
|
|
18816
|
+
* labelId="se-1234567"
|
|
18817
|
+
* onComplete={() => console.log('onComplete')}
|
|
18818
|
+
* onSuccess={(_, { salesOrderIds: [salesOrderId] }) =>
|
|
18819
|
+
* console.log('sales order ID', salesOrderId)
|
|
18820
|
+
* }
|
|
18821
|
+
* onViewShipment={({ shipmentId }) => {
|
|
18822
|
+
* console.log('onViewShipment', shipmentId);
|
|
18823
|
+
* }}
|
|
18824
|
+
* />
|
|
18825
|
+
* ```
|
|
18826
|
+
*
|
|
18827
|
+
* <br />
|
|
18828
|
+
*
|
|
18829
|
+
* @see {@link VoidLabel.ComponentProps | The **props** that can be passed into the `<VoidLabel.Element />` component}
|
|
18830
|
+
*
|
|
18831
|
+
* @see {@link PurchaseLabel.Element | Go back to the frst step in the label purchase workflow `<PurchaseLabel.Element />`}
|
|
18832
|
+
*/
|
|
17456
18833
|
const Element$1 = alchemy__default["default"].createElement(Component, ErrorFallback, {
|
|
17457
18834
|
css: {
|
|
17458
18835
|
height: "100%",
|
|
@@ -17471,6 +18848,31 @@ var voidLabel = /*#__PURE__*/Object.freeze({
|
|
|
17471
18848
|
Element: Element$1
|
|
17472
18849
|
});
|
|
17473
18850
|
|
|
18851
|
+
/**
|
|
18852
|
+
* @internal
|
|
18853
|
+
*
|
|
18854
|
+
* # Label Workflow Component
|
|
18855
|
+
*
|
|
18856
|
+
* @example
|
|
18857
|
+
* ```tsx
|
|
18858
|
+
* const {
|
|
18859
|
+
* labelId,
|
|
18860
|
+
* multiplexedId,
|
|
18861
|
+
* isVoidingLabel,
|
|
18862
|
+
* shipmentId,
|
|
18863
|
+
* setLabelId,
|
|
18864
|
+
* setShipmentId,
|
|
18865
|
+
* setIsVoidingLabel,
|
|
18866
|
+
* } = useLabelWorkflow({
|
|
18867
|
+
* _labelId,
|
|
18868
|
+
* _multiplexedId,
|
|
18869
|
+
* });
|
|
18870
|
+
* ```
|
|
18871
|
+
*
|
|
18872
|
+
* <br />
|
|
18873
|
+
*
|
|
18874
|
+
* @see {@link LabelWorkflow.Element | The `<LabelWorkflow.Element />` component using this hook}
|
|
18875
|
+
*/
|
|
17474
18876
|
const useLabelWorkflow = ({
|
|
17475
18877
|
_multiplexedId,
|
|
17476
18878
|
_labelId
|
|
@@ -17495,6 +18897,33 @@ const useLabelWorkflow = ({
|
|
|
17495
18897
|
shipmentId
|
|
17496
18898
|
};
|
|
17497
18899
|
};
|
|
18900
|
+
/**
|
|
18901
|
+
* @internal
|
|
18902
|
+
*
|
|
18903
|
+
* # Label Workflow Element
|
|
18904
|
+
*
|
|
18905
|
+
* - The `<LabelWorkflow.Element />` component is a composition of the PurchaseLabel, ViewShipment,
|
|
18906
|
+
* and VoidLabel elements that allows users to purchase a label, view the shipment details, and optionally void their shipping label.
|
|
18907
|
+
*
|
|
18908
|
+
* @param LabelWorkflowProps The props necessary to render the `<LabelWorkflow.Element />` for shipment
|
|
18909
|
+
* based or sales order based label purchasing.
|
|
18910
|
+
*
|
|
18911
|
+
* @returns Element A React Element that will render the `<LabelWorkflow />` component.
|
|
18912
|
+
*
|
|
18913
|
+
* @example
|
|
18914
|
+
* ```tsx
|
|
18915
|
+
* <LabelWorkflow
|
|
18916
|
+
* {...elementProps}
|
|
18917
|
+
* callbacks={{ onLabelCreateSuccess }}
|
|
18918
|
+
* multiplexedId={elementIdProps}
|
|
18919
|
+
* />
|
|
18920
|
+
* ```
|
|
18921
|
+
*
|
|
18922
|
+
* <br />
|
|
18923
|
+
*
|
|
18924
|
+
* @see {@link LabelWorkflowProps | The props that are passed into the `<LabelWorkflow />` component}
|
|
18925
|
+
* @see {@link LabelWorkflow.useLabelWorkflow | The `hook` that is used to manage the state of the `<LabelWorkflow />` component}
|
|
18926
|
+
*/
|
|
17498
18927
|
const Element = (
|
|
17499
18928
|
/*
|
|
17500
18929
|
The passed props are underscore prefixed as they will be stashed, then from them stateful versions will be made
|
|
@@ -17564,6 +18993,7 @@ The passed props are underscore prefixed as they will be stashed, then from them
|
|
|
17564
18993
|
|
|
17565
18994
|
var labelWorkflow = /*#__PURE__*/Object.freeze({
|
|
17566
18995
|
__proto__: null,
|
|
18996
|
+
useLabelWorkflow: useLabelWorkflow,
|
|
17567
18997
|
Element: Element
|
|
17568
18998
|
});
|
|
17569
18999
|
|
|
@@ -17610,7 +19040,10 @@ exports.VoidLabel = voidLabel;
|
|
|
17610
19040
|
exports.autoFundingSchema = autoFundingSchema;
|
|
17611
19041
|
exports.calculateTotal = calculateTotal;
|
|
17612
19042
|
exports.capitalizeFirstLetter = capitalizeFirstLetter;
|
|
19043
|
+
exports.convertDecimalWeightToFractionalWeight = convertDecimalWeightToFractionalWeight;
|
|
17613
19044
|
exports.convertDimensions = convertDimensions;
|
|
19045
|
+
exports.convertFractionalWeightToDecimalWeight = convertFractionalWeightToDecimalWeight;
|
|
19046
|
+
exports.convertPoundsAndOuncesToOunces = convertPoundsAndOuncesToOunces;
|
|
17614
19047
|
exports.convertWeight = convertWeight;
|
|
17615
19048
|
exports.countries = countries;
|
|
17616
19049
|
exports.countryCodes = countryCodes;
|
|
@@ -17623,10 +19056,12 @@ exports.errorMap = errorMap;
|
|
|
17623
19056
|
exports.euCountryCodes = euCountryCodes;
|
|
17624
19057
|
exports.extendZod = extendZod;
|
|
17625
19058
|
exports.featureFlagComponentNameLookup = featureFlagComponentNameLookup;
|
|
19059
|
+
exports.featureFlags = featureFlags;
|
|
17626
19060
|
exports.formLogger = formLogger;
|
|
17627
19061
|
exports.formatCreditCardNumber = formatCreditCardNumber;
|
|
17628
19062
|
exports.formatDate = formatDate;
|
|
17629
19063
|
exports.formatDateDDMMYY = formatDateDDMMYY;
|
|
19064
|
+
exports.formatDimensions = formatDimensions;
|
|
17630
19065
|
exports.formatExpiration = formatExpiration;
|
|
17631
19066
|
exports.formatFractionalWeight = formatFractionalWeight;
|
|
17632
19067
|
exports.formatMoney = formatMoney;
|
|
@@ -17644,9 +19079,11 @@ exports.getRelativeDates = getRelativeDates;
|
|
|
17644
19079
|
exports.getRequestedServices = getRequestedServices;
|
|
17645
19080
|
exports.getSalesOrderItemsFromSalesOrderOrShipment = getSalesOrderItemsFromSalesOrderOrShipment;
|
|
17646
19081
|
exports.getTotalRateAmount = getTotalRateAmount;
|
|
19082
|
+
exports.isDecimalWeight = isDecimalWeight;
|
|
17647
19083
|
exports.isDomesticAddress = isDomesticAddress;
|
|
17648
19084
|
exports.isEmptyAddress = isEmptyAddress;
|
|
17649
19085
|
exports.isFlatRatePackageCode = isFlatRatePackageCode;
|
|
19086
|
+
exports.isMetricWeightUnit = isMetricWeightUnit;
|
|
17650
19087
|
exports.isMilitaryAddress = isMilitaryAddress;
|
|
17651
19088
|
exports.isNowOrInTheFuture = isNowOrInTheFuture;
|
|
17652
19089
|
exports.isPoBox = isPoBox;
|
|
@@ -17687,6 +19124,7 @@ exports.usePageLayout = usePageLayout;
|
|
|
17687
19124
|
exports.useRateOptions = useRateOptions;
|
|
17688
19125
|
exports.useRootPortal = useRootPortal;
|
|
17689
19126
|
exports.useRunOnceOnTrue = useRunOnceOnTrue;
|
|
19127
|
+
exports.useScrubErrors = useScrubErrors;
|
|
17690
19128
|
exports.useServiceCodeOptions = useServiceCodeOptions;
|
|
17691
19129
|
exports.useShipmentMetadata = useShipmentMetadata;
|
|
17692
19130
|
exports.useShippingPresetsOptions = useShippingPresetsOptions;
|