@shipengine/elements 0.33.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 +1975 -493
- package/index.js +1970 -496
- package/package.json +1 -1
- package/src/components/add-funds-form/add-funds-form.d.ts +22 -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/carrier-terms-form/carrier-terms-form.styles.d.ts +1 -0
- package/src/components/templates/landing-page/landing-page.d.ts +2 -1
- package/src/components/templates/onboarding/onboarding.d.ts +3 -1
- package/src/components/templates/onboarding/onboarding.styles.d.ts +10 -0
- 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/templates/warehouse-form/warehouse-form.d.ts +1 -1
- 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 +139 -3
- 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 +99 -5
- package/src/elements/purchase-label/purchase-label.d.ts +194 -9
- package/src/elements/shipengine-workflow/label-workflow.d.ts +138 -2
- package/src/elements/view-shipment/view-shipment.d.ts +131 -4
- package/src/elements/void-label/void-label.d.ts +137 -5
- 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 +11 -3
- 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,67 +4341,28 @@ const errorMap = (issue, ctx) => {
|
|
|
3565
4341
|
};
|
|
3566
4342
|
};
|
|
3567
4343
|
/**
|
|
3568
|
-
* @
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
const
|
|
3579
|
-
|
|
3580
|
-
|
|
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
|
-
};
|
|
4344
|
+
* @internal
|
|
4345
|
+
*
|
|
4346
|
+
* # Validation Resolver
|
|
4347
|
+
*
|
|
4348
|
+
* @category Utilities
|
|
4349
|
+
*/
|
|
4350
|
+
const validationResolver = schema => (values, context, resolverOptions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4351
|
+
const getValidationResult = () => zod$1.zodResolver(schema, {
|
|
4352
|
+
errorMap
|
|
4353
|
+
})(values, undefined, resolverOptions);
|
|
4354
|
+
const validationResult = yield formLogger.isSubmitting ? formLogger.log(values, getValidationResult) : getValidationResult();
|
|
4355
|
+
return validationResult;
|
|
4356
|
+
});
|
|
3626
4357
|
|
|
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 = ({
|
|
@@ -4519,10 +5388,10 @@ const useBlackboxDetection = ({
|
|
|
4519
5388
|
}) => {
|
|
4520
5389
|
React.useEffect(() => {
|
|
4521
5390
|
// basic configurations must be on page before snare.js is loaded
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
5391
|
+
window.io_install_stm = false; // do not install Active X
|
|
5392
|
+
window.io_exclude_stm = 12; // do not run Active X
|
|
5393
|
+
window.io_install_flash = false; // do not install Flash
|
|
5394
|
+
window.io_enable_rip = true; // collect Real IP information
|
|
4526
5395
|
const pollBlackBox = () => {
|
|
4527
5396
|
try {
|
|
4528
5397
|
if (typeof ioGetBlackbox !== "function") {
|
|
@@ -4541,7 +5410,7 @@ const useBlackboxDetection = ({
|
|
|
4541
5410
|
};
|
|
4542
5411
|
const intervalId = setInterval(pollBlackBox, 500);
|
|
4543
5412
|
// attach script to DOM
|
|
4544
|
-
const script =
|
|
5413
|
+
const script = document.createElement("script");
|
|
4545
5414
|
script.type = "text/javascript";
|
|
4546
5415
|
script.async = true;
|
|
4547
5416
|
script.src = "https://mpsnare.iesnare.com/snare.js";
|
|
@@ -4550,20 +5419,44 @@ const useBlackboxDetection = ({
|
|
|
4550
5419
|
onError();
|
|
4551
5420
|
}
|
|
4552
5421
|
});
|
|
4553
|
-
|
|
5422
|
+
document.head.appendChild(script);
|
|
4554
5423
|
return () => {
|
|
4555
5424
|
if (intervalId) {
|
|
4556
5425
|
clearTimeout(intervalId);
|
|
4557
5426
|
}
|
|
4558
|
-
delete
|
|
4559
|
-
delete
|
|
4560
|
-
delete
|
|
4561
|
-
delete
|
|
4562
|
-
|
|
5427
|
+
delete window.io_install_stm;
|
|
5428
|
+
delete window.io_exclude_stm;
|
|
5429
|
+
delete window.io_install_flash;
|
|
5430
|
+
delete window.io_enable_rip;
|
|
5431
|
+
document.head.removeChild(script);
|
|
4563
5432
|
};
|
|
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
|
}) => {
|
|
@@ -4693,179 +5632,25 @@ const Component$5 = ({
|
|
|
4693
5632
|
const errors = [...(updateWarehouseErrors !== null && updateWarehouseErrors !== void 0 ? updateWarehouseErrors : []), ...(createWarehouseErrors !== null && createWarehouseErrors !== void 0 ? createWarehouseErrors : []), ...(deleteWarehouseErrors !== null && deleteWarehouseErrors !== void 0 ? deleteWarehouseErrors : [])];
|
|
4694
5633
|
return jsxRuntime.jsx(CollapsiblePanel, Object.assign({
|
|
4695
5634
|
errors: errors,
|
|
4696
|
-
isSaving: creatingWarehouse || deletingWarehouse || updatingWarehouse,
|
|
4697
|
-
title: t("account-settings:sections.warehouses")
|
|
4698
|
-
}, {
|
|
4699
|
-
children: isLoadingWarehouses ? jsxRuntime.jsx(Loader, {
|
|
4700
|
-
message: t("loading.warehouses")
|
|
4701
|
-
}) : jsxRuntime.jsx(ManageWarehouses, {
|
|
4702
|
-
errors: errors,
|
|
4703
|
-
onAdd: handleSubmitAddNewWarehouse,
|
|
4704
|
-
onDelete: handleDeleteWarehouse,
|
|
4705
|
-
onEdit: handleSubmitEditWarehouse,
|
|
4706
|
-
onSetDefault: handleSetDefault,
|
|
4707
|
-
warehouses: sortedWarehouses || []
|
|
4708
|
-
})
|
|
4709
|
-
}));
|
|
4710
|
-
};
|
|
4711
|
-
|
|
4712
|
-
var manageWarehouses$1 = /*#__PURE__*/Object.freeze({
|
|
4713
|
-
__proto__: null,
|
|
4714
|
-
Component: Component$5
|
|
4715
|
-
});
|
|
4716
|
-
|
|
4717
|
-
var uncurryThis$6 = functionUncurryThis;
|
|
4718
|
-
|
|
4719
|
-
// `thisNumberValue` abstract operation
|
|
4720
|
-
// https://tc39.es/ecma262/#sec-thisnumbervalue
|
|
4721
|
-
var thisNumberValue$1 = uncurryThis$6(1.0.valueOf);
|
|
4722
|
-
|
|
4723
|
-
var toIntegerOrInfinity$1 = toIntegerOrInfinity$6;
|
|
4724
|
-
var toString$5 = toString$c;
|
|
4725
|
-
var requireObjectCoercible$2 = requireObjectCoercible$9;
|
|
4726
|
-
|
|
4727
|
-
var $RangeError$1 = RangeError;
|
|
4728
|
-
|
|
4729
|
-
// `String.prototype.repeat` method implementation
|
|
4730
|
-
// https://tc39.es/ecma262/#sec-string.prototype.repeat
|
|
4731
|
-
var stringRepeat = function repeat(count) {
|
|
4732
|
-
var str = toString$5(requireObjectCoercible$2(this));
|
|
4733
|
-
var result = '';
|
|
4734
|
-
var n = toIntegerOrInfinity$1(count);
|
|
4735
|
-
if (n < 0 || n == Infinity) throw $RangeError$1('Wrong number of repetitions');
|
|
4736
|
-
for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;
|
|
4737
|
-
return result;
|
|
4738
|
-
};
|
|
4739
|
-
|
|
4740
|
-
var $$a = _export;
|
|
4741
|
-
var uncurryThis$5 = functionUncurryThis;
|
|
4742
|
-
var toIntegerOrInfinity = toIntegerOrInfinity$6;
|
|
4743
|
-
var thisNumberValue = thisNumberValue$1;
|
|
4744
|
-
var $repeat = stringRepeat;
|
|
4745
|
-
var fails$4 = fails$q;
|
|
4746
|
-
|
|
4747
|
-
var $RangeError = RangeError;
|
|
4748
|
-
var $String = String;
|
|
4749
|
-
var floor = Math.floor;
|
|
4750
|
-
var repeat = uncurryThis$5($repeat);
|
|
4751
|
-
var stringSlice$2 = uncurryThis$5(''.slice);
|
|
4752
|
-
var nativeToFixed = uncurryThis$5(1.0.toFixed);
|
|
4753
|
-
|
|
4754
|
-
var pow = function (x, n, acc) {
|
|
4755
|
-
return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
|
|
4756
|
-
};
|
|
4757
|
-
|
|
4758
|
-
var log = function (x) {
|
|
4759
|
-
var n = 0;
|
|
4760
|
-
var x2 = x;
|
|
4761
|
-
while (x2 >= 4096) {
|
|
4762
|
-
n += 12;
|
|
4763
|
-
x2 /= 4096;
|
|
4764
|
-
}
|
|
4765
|
-
while (x2 >= 2) {
|
|
4766
|
-
n += 1;
|
|
4767
|
-
x2 /= 2;
|
|
4768
|
-
} return n;
|
|
4769
|
-
};
|
|
4770
|
-
|
|
4771
|
-
var multiply = function (data, n, c) {
|
|
4772
|
-
var index = -1;
|
|
4773
|
-
var c2 = c;
|
|
4774
|
-
while (++index < 6) {
|
|
4775
|
-
c2 += n * data[index];
|
|
4776
|
-
data[index] = c2 % 1e7;
|
|
4777
|
-
c2 = floor(c2 / 1e7);
|
|
4778
|
-
}
|
|
4779
|
-
};
|
|
4780
|
-
|
|
4781
|
-
var divide = function (data, n) {
|
|
4782
|
-
var index = 6;
|
|
4783
|
-
var c = 0;
|
|
4784
|
-
while (--index >= 0) {
|
|
4785
|
-
c += data[index];
|
|
4786
|
-
data[index] = floor(c / n);
|
|
4787
|
-
c = (c % n) * 1e7;
|
|
4788
|
-
}
|
|
4789
|
-
};
|
|
4790
|
-
|
|
4791
|
-
var dataToString = function (data) {
|
|
4792
|
-
var index = 6;
|
|
4793
|
-
var s = '';
|
|
4794
|
-
while (--index >= 0) {
|
|
4795
|
-
if (s !== '' || index === 0 || data[index] !== 0) {
|
|
4796
|
-
var t = $String(data[index]);
|
|
4797
|
-
s = s === '' ? t : s + repeat('0', 7 - t.length) + t;
|
|
4798
|
-
}
|
|
4799
|
-
} return s;
|
|
5635
|
+
isSaving: creatingWarehouse || deletingWarehouse || updatingWarehouse,
|
|
5636
|
+
title: t("account-settings:sections.warehouses")
|
|
5637
|
+
}, {
|
|
5638
|
+
children: isLoadingWarehouses ? jsxRuntime.jsx(Loader, {
|
|
5639
|
+
message: t("loading.warehouses")
|
|
5640
|
+
}) : jsxRuntime.jsx(ManageWarehouses, {
|
|
5641
|
+
errors: errors,
|
|
5642
|
+
onAdd: handleSubmitAddNewWarehouse,
|
|
5643
|
+
onDelete: handleDeleteWarehouse,
|
|
5644
|
+
onEdit: handleSubmitEditWarehouse,
|
|
5645
|
+
onSetDefault: handleSetDefault,
|
|
5646
|
+
warehouses: sortedWarehouses || []
|
|
5647
|
+
})
|
|
5648
|
+
}));
|
|
4800
5649
|
};
|
|
4801
5650
|
|
|
4802
|
-
var
|
|
4803
|
-
|
|
4804
|
-
|
|
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
|
-
}
|
|
5651
|
+
var manageWarehouses$1 = /*#__PURE__*/Object.freeze({
|
|
5652
|
+
__proto__: null,
|
|
5653
|
+
Component: Component$5
|
|
4869
5654
|
});
|
|
4870
5655
|
|
|
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";
|
|
@@ -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,
|
|
@@ -7455,6 +8318,7 @@ const getWrapperStyles = theme => /*#__PURE__*/css.css(process.env.NODE_ENV ===
|
|
|
7455
8318
|
|
|
7456
8319
|
const DatePickerController = createFieldController();
|
|
7457
8320
|
const DatePicker = fieldProps => {
|
|
8321
|
+
const alchemy$1 = React.useContext(alchemy.AlchemyContext);
|
|
7458
8322
|
const theme = react.useTheme();
|
|
7459
8323
|
const datePickerRef = React.useRef(null);
|
|
7460
8324
|
return jsxRuntime.jsx(DatePickerController, Object.assign({}, fieldProps, {
|
|
@@ -7475,7 +8339,7 @@ const DatePicker = fieldProps => {
|
|
|
7475
8339
|
css: getOverrideStyles(theme)
|
|
7476
8340
|
}, {
|
|
7477
8341
|
children: jsxRuntime.jsx(ReactDatePicker__default["default"], Object.assign({
|
|
7478
|
-
locale:
|
|
8342
|
+
locale: alchemy$1 === null || alchemy$1 === void 0 ? void 0 : alchemy$1.locale
|
|
7479
8343
|
}, datePickerProps, {
|
|
7480
8344
|
customInput: /*#__PURE__*/React.createElement( /*#__PURE__*/React.forwardRef(function InputWrapper(_a, forwardedRef) {
|
|
7481
8345
|
var _b;
|
|
@@ -8199,6 +9063,19 @@ const getAcknowledgementLabel = (serviceCode, packageType) => {
|
|
|
8199
9063
|
});
|
|
8200
9064
|
}
|
|
8201
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
|
+
}));
|
|
8202
9079
|
default:
|
|
8203
9080
|
return null;
|
|
8204
9081
|
}
|
|
@@ -8610,6 +9487,10 @@ var fields = /*#__PURE__*/Object.freeze({
|
|
|
8610
9487
|
});
|
|
8611
9488
|
|
|
8612
9489
|
/**
|
|
9490
|
+
* @internal
|
|
9491
|
+
*
|
|
9492
|
+
* # Form Portal Component
|
|
9493
|
+
*
|
|
8613
9494
|
* A drop-in replacement for the `<form>` tag that allows nested forms.
|
|
8614
9495
|
*
|
|
8615
9496
|
* Via portals, the <form> tag is mounted as a sibling of the app root. The form's
|
|
@@ -8679,6 +9560,10 @@ const styles$o = createStyles({
|
|
|
8679
9560
|
});
|
|
8680
9561
|
|
|
8681
9562
|
/**
|
|
9563
|
+
* @internal
|
|
9564
|
+
*
|
|
9565
|
+
* # Money Schema
|
|
9566
|
+
*
|
|
8682
9567
|
* @category Form Validation
|
|
8683
9568
|
*/
|
|
8684
9569
|
const moneySchema = zod.z.object({
|
|
@@ -8687,14 +9572,33 @@ const moneySchema = zod.z.object({
|
|
|
8687
9572
|
});
|
|
8688
9573
|
|
|
8689
9574
|
/**
|
|
9575
|
+
* @internal
|
|
9576
|
+
*
|
|
9577
|
+
* # Phone utils
|
|
9578
|
+
*
|
|
8690
9579
|
* @category Form Validation
|
|
8691
9580
|
*/
|
|
8692
9581
|
const phoneSchema = (defaultCountryCode = "US") => zod.z.string().trim().refine(val => min$3.isValidPhoneNumber(val, defaultCountryCode), "schemaErrors.notAValidPhoneNumber");
|
|
8693
9582
|
/**
|
|
9583
|
+
* @internal
|
|
9584
|
+
*
|
|
9585
|
+
* # Phone utils
|
|
9586
|
+
*
|
|
8694
9587
|
* @category Form Validation
|
|
8695
9588
|
*/
|
|
8696
9589
|
const phoneSchemaUnvalidated = zod.z.string().trim();
|
|
8697
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
|
+
*/
|
|
8698
9602
|
const getAddFundsSchema = (minimumAmount = 10) => zod.z.object({
|
|
8699
9603
|
funds: moneySchema.extend({
|
|
8700
9604
|
amount: zod.z.number().min(minimumAmount)
|
|
@@ -8702,9 +9606,15 @@ const getAddFundsSchema = (minimumAmount = 10) => zod.z.object({
|
|
|
8702
9606
|
}).transform(data => data.funds);
|
|
8703
9607
|
|
|
8704
9608
|
/**
|
|
8705
|
-
*
|
|
9609
|
+
* @internal
|
|
9610
|
+
*
|
|
9611
|
+
* # Add Funds Form Component
|
|
9612
|
+
*
|
|
9613
|
+
* - Form for adding funds to a carrier's account.
|
|
8706
9614
|
*
|
|
8707
|
-
* 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}
|
|
8708
9618
|
*/
|
|
8709
9619
|
const AddFundsForm = ({
|
|
8710
9620
|
carrierId,
|
|
@@ -8846,7 +9756,7 @@ const AddFundsForm = ({
|
|
|
8846
9756
|
}))]
|
|
8847
9757
|
}))]
|
|
8848
9758
|
})]
|
|
8849
|
-
})), addFunds.error && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
9759
|
+
})), !children && addFunds.error && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
8850
9760
|
children: [jsxRuntime.jsx(Spacer, {
|
|
8851
9761
|
multiplier: 1
|
|
8852
9762
|
}), jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
@@ -8856,6 +9766,7 @@ const AddFundsForm = ({
|
|
|
8856
9766
|
children: addFunds.error[0].message
|
|
8857
9767
|
}))]
|
|
8858
9768
|
}), children === null || children === void 0 ? void 0 : children({
|
|
9769
|
+
error: addFunds.error,
|
|
8859
9770
|
isCustomAmount: selectedChip.value === "custom",
|
|
8860
9771
|
isSubmitted,
|
|
8861
9772
|
isSubmitting,
|
|
@@ -8885,6 +9796,13 @@ const styles$n = createStyles({
|
|
|
8885
9796
|
}
|
|
8886
9797
|
});
|
|
8887
9798
|
|
|
9799
|
+
/**
|
|
9800
|
+
* @internal
|
|
9801
|
+
*
|
|
9802
|
+
* # Auto Funding Form Schema
|
|
9803
|
+
*
|
|
9804
|
+
* @see {@link AutoFundingForm | Auto Funding Form component using this schema}
|
|
9805
|
+
* */
|
|
8888
9806
|
const autoFundingSchema = zod.z.object({
|
|
8889
9807
|
isEnabled: zod.z.boolean(),
|
|
8890
9808
|
lowBalancePurchaseThreshold: moneySchema.extend({
|
|
@@ -8897,10 +9815,19 @@ const autoFundingSchema = zod.z.object({
|
|
|
8897
9815
|
});
|
|
8898
9816
|
|
|
8899
9817
|
/**
|
|
9818
|
+
* @internal
|
|
9819
|
+
*
|
|
9820
|
+
* # Auto Funding Form Component
|
|
9821
|
+
*
|
|
8900
9822
|
* This form that allows users to enable or disable auto funding, and
|
|
8901
9823
|
* configure auto funding rules in ShipEngine API.
|
|
8902
9824
|
*
|
|
8903
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}
|
|
8904
9831
|
*/
|
|
8905
9832
|
const AutoFundingForm = ({
|
|
8906
9833
|
carrierId
|
|
@@ -9077,6 +10004,11 @@ const styles$m = isLabelRight => createStyles({
|
|
|
9077
10004
|
})
|
|
9078
10005
|
});
|
|
9079
10006
|
|
|
10007
|
+
/**
|
|
10008
|
+
* @internal
|
|
10009
|
+
*
|
|
10010
|
+
* # Inline Label Component
|
|
10011
|
+
*/
|
|
9080
10012
|
const InlineLabel = ({
|
|
9081
10013
|
children,
|
|
9082
10014
|
label,
|
|
@@ -9096,6 +10028,16 @@ const styles$l = createStyles({
|
|
|
9096
10028
|
})
|
|
9097
10029
|
});
|
|
9098
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
|
+
*/
|
|
9099
10041
|
const CarrierBalance = ({
|
|
9100
10042
|
balance,
|
|
9101
10043
|
carrierId
|
|
@@ -9125,6 +10067,22 @@ const CarrierBalance = ({
|
|
|
9125
10067
|
}));
|
|
9126
10068
|
};
|
|
9127
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
|
+
*/
|
|
9128
10086
|
const ManageFunding = ({
|
|
9129
10087
|
carrierId
|
|
9130
10088
|
}) => {
|
|
@@ -9197,6 +10155,12 @@ const AddressParser = ({
|
|
|
9197
10155
|
const payload = values;
|
|
9198
10156
|
onSubmit(payload);
|
|
9199
10157
|
}));
|
|
10158
|
+
form.watch((data, {
|
|
10159
|
+
name
|
|
10160
|
+
}) => {
|
|
10161
|
+
var _a;
|
|
10162
|
+
if (name === "fullAddress" && ((_a = data.fullAddress) === null || _a === void 0 ? void 0 : _a.length) == null) reset === null || reset === void 0 ? void 0 : reset();
|
|
10163
|
+
});
|
|
9200
10164
|
const errors = (parseErrors === null || parseErrors === void 0 ? void 0 : parseErrors.length) ? [t("errorMessages.parsingFailure")] : undefined;
|
|
9201
10165
|
const formInterface = jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
9202
10166
|
children: [jsxRuntime.jsx(TextArea, {
|
|
@@ -9252,7 +10216,7 @@ const styles$k = createStyles({
|
|
|
9252
10216
|
flex: "1 0 100%"
|
|
9253
10217
|
},
|
|
9254
10218
|
display: "flex",
|
|
9255
|
-
flex: "1 0
|
|
10219
|
+
flex: "1 0 64%",
|
|
9256
10220
|
width: "100%"
|
|
9257
10221
|
},
|
|
9258
10222
|
stateZipWrapper: theme => ({
|
|
@@ -9282,7 +10246,10 @@ const AddressFields = ({
|
|
|
9282
10246
|
const {
|
|
9283
10247
|
t
|
|
9284
10248
|
} = reactI18next.useTranslation();
|
|
9285
|
-
const
|
|
10249
|
+
const {
|
|
10250
|
+
countryCodeOptions,
|
|
10251
|
+
defaultCountryCodeOption
|
|
10252
|
+
} = useCountryCodeOptions(domestic);
|
|
9286
10253
|
const stateCodeOptions = useStateCodeOptions(domestic);
|
|
9287
10254
|
const {
|
|
9288
10255
|
isSubmitted
|
|
@@ -9306,6 +10273,7 @@ const AddressFields = ({
|
|
|
9306
10273
|
nativeLabel: true
|
|
9307
10274
|
}), jsxRuntime.jsx(SelectAutoComplete, {
|
|
9308
10275
|
control: form.control,
|
|
10276
|
+
defaultValue: defaultCountryCodeOption === null || defaultCountryCodeOption === void 0 ? void 0 : defaultCountryCodeOption.value,
|
|
9309
10277
|
form: formId,
|
|
9310
10278
|
label: t("address.fields.countryCode"),
|
|
9311
10279
|
labelWeight: "normal",
|
|
@@ -9454,6 +10422,10 @@ function nullishDefault(defaultValue) {
|
|
|
9454
10422
|
return this.nullish().transform(v => v !== null && v !== void 0 ? v : defaultValue);
|
|
9455
10423
|
}
|
|
9456
10424
|
/**
|
|
10425
|
+
* @internal
|
|
10426
|
+
*
|
|
10427
|
+
* # Form Utilities
|
|
10428
|
+
*
|
|
9457
10429
|
* @category Form Validation
|
|
9458
10430
|
*/
|
|
9459
10431
|
const extendZod = () => {
|
|
@@ -9814,29 +10786,23 @@ const AddressPreferenceSelect = ({
|
|
|
9814
10786
|
case "ERROR":
|
|
9815
10787
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
9816
10788
|
children: [jsxRuntime.jsx(Spacer, {
|
|
9817
|
-
multiplier:
|
|
10789
|
+
multiplier: 2
|
|
9818
10790
|
}), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
9819
|
-
colSpan: 8
|
|
9820
|
-
css: theme => ({
|
|
9821
|
-
paddingLeft: theme.spacing(1)
|
|
9822
|
-
})
|
|
10791
|
+
colSpan: 8
|
|
9823
10792
|
}, {
|
|
9824
10793
|
children: jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
10794
|
+
title: t("address.preference.addressNotValidated"),
|
|
9825
10795
|
type: giger.NotificationType.ALERT
|
|
9826
10796
|
}, {
|
|
9827
10797
|
children: t("address.preference.unableToValidate")
|
|
9828
10798
|
}))
|
|
9829
10799
|
})), jsxRuntime.jsx(Spacer, {
|
|
9830
|
-
multiplier:
|
|
9831
|
-
}), jsxRuntime.jsx(giger.GridChild,
|
|
9832
|
-
css: theme => ({
|
|
9833
|
-
paddingLeft: theme.spacing(1)
|
|
9834
|
-
})
|
|
9835
|
-
}, {
|
|
10800
|
+
multiplier: 2
|
|
10801
|
+
}), jsxRuntime.jsx(giger.GridChild, {
|
|
9836
10802
|
children: jsxRuntime.jsx(AddressDisplay, {
|
|
9837
10803
|
address: (_b = warehousePreference.validation) === null || _b === void 0 ? void 0 : _b.originalAddress
|
|
9838
10804
|
})
|
|
9839
|
-
})
|
|
10805
|
+
})]
|
|
9840
10806
|
});
|
|
9841
10807
|
default:
|
|
9842
10808
|
// This code path should never be reached.
|
|
@@ -9859,7 +10825,7 @@ const AddressPreferenceSelect = ({
|
|
|
9859
10825
|
children: t("common:address.preference.title")
|
|
9860
10826
|
}))
|
|
9861
10827
|
})), jsxRuntime.jsxs(giger.GridChild, Object.assign({
|
|
9862
|
-
colSpan:
|
|
10828
|
+
colSpan: 12
|
|
9863
10829
|
}, {
|
|
9864
10830
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
9865
10831
|
css: {
|
|
@@ -9875,7 +10841,7 @@ const AddressPreferenceSelect = ({
|
|
|
9875
10841
|
warehousePreference: originAddress
|
|
9876
10842
|
})]
|
|
9877
10843
|
})), returnAddress && jsxRuntime.jsxs(giger.GridChild, Object.assign({
|
|
9878
|
-
colSpan:
|
|
10844
|
+
colSpan: 12
|
|
9879
10845
|
}, {
|
|
9880
10846
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
9881
10847
|
css: {
|
|
@@ -9923,6 +10889,7 @@ const AddressPreferenceProvider = props => {
|
|
|
9923
10889
|
onSubmit
|
|
9924
10890
|
} = props;
|
|
9925
10891
|
const [passengerData, setPassengerData] = React.useState();
|
|
10892
|
+
const [userInput, setUserInput] = React.useState();
|
|
9926
10893
|
const {
|
|
9927
10894
|
validate: validateAddress,
|
|
9928
10895
|
validationPreference,
|
|
@@ -9934,6 +10901,7 @@ const AddressPreferenceProvider = props => {
|
|
|
9934
10901
|
onValid,
|
|
9935
10902
|
data
|
|
9936
10903
|
} = payload;
|
|
10904
|
+
setUserInput(addresses);
|
|
9937
10905
|
const validationPreference = yield validateAddress(addresses);
|
|
9938
10906
|
const {
|
|
9939
10907
|
originAddress,
|
|
@@ -9967,6 +10935,7 @@ const AddressPreferenceProvider = props => {
|
|
|
9967
10935
|
return jsxRuntime.jsx(AddressPreferenceContext.Provider, Object.assign({
|
|
9968
10936
|
value: {
|
|
9969
10937
|
data: passengerData,
|
|
10938
|
+
userInput,
|
|
9970
10939
|
validateAddress: internalValidateAddress,
|
|
9971
10940
|
validationPreference
|
|
9972
10941
|
}
|
|
@@ -10220,7 +11189,7 @@ const WalletForm = ({
|
|
|
10220
11189
|
resolver: validationResolver(walletSchema)
|
|
10221
11190
|
});
|
|
10222
11191
|
useBlackboxDetection({
|
|
10223
|
-
onError: () => {
|
|
11192
|
+
onError: React.useCallback(() => {
|
|
10224
11193
|
setCodedErrors(errors => {
|
|
10225
11194
|
const blackBoxError = {
|
|
10226
11195
|
errorCode: "unspecified",
|
|
@@ -10230,11 +11199,8 @@ const WalletForm = ({
|
|
|
10230
11199
|
};
|
|
10231
11200
|
return [...(errors !== null && errors !== void 0 ? errors : []), blackBoxError];
|
|
10232
11201
|
});
|
|
10233
|
-
},
|
|
10234
|
-
onSuccess: bb =>
|
|
10235
|
-
console.log("bb", bb);
|
|
10236
|
-
form.setValue("iovationBlackbox", bb);
|
|
10237
|
-
}
|
|
11202
|
+
}, [setCodedErrors]),
|
|
11203
|
+
onSuccess: React.useCallback(bb => form.setValue("iovationBlackbox", bb), [form.setValue])
|
|
10238
11204
|
});
|
|
10239
11205
|
const watchAddress = form.watch("address");
|
|
10240
11206
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -10630,6 +11596,25 @@ const WalletCard = ({
|
|
|
10630
11596
|
}));
|
|
10631
11597
|
};
|
|
10632
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
|
+
*/
|
|
10633
11618
|
const PaymentMethodSettings = () => {
|
|
10634
11619
|
var _a;
|
|
10635
11620
|
const {
|
|
@@ -10712,6 +11697,14 @@ const styles$f = createStyles({
|
|
|
10712
11697
|
}
|
|
10713
11698
|
});
|
|
10714
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
|
+
*/
|
|
10715
11708
|
const PoweredByShipEngine = () => {
|
|
10716
11709
|
const {
|
|
10717
11710
|
t
|
|
@@ -10727,6 +11720,11 @@ const PoweredByShipEngine = () => {
|
|
|
10727
11720
|
}));
|
|
10728
11721
|
};
|
|
10729
11722
|
|
|
11723
|
+
/**
|
|
11724
|
+
* @namespace UnitSettings
|
|
11725
|
+
*
|
|
11726
|
+
* # Unit Settings Component
|
|
11727
|
+
*/
|
|
10730
11728
|
const UnitSettings = () => {
|
|
10731
11729
|
const {
|
|
10732
11730
|
t
|
|
@@ -10924,7 +11922,8 @@ const styles$e = createStyles({
|
|
|
10924
11922
|
display: "flex",
|
|
10925
11923
|
flexDirection: "column",
|
|
10926
11924
|
paddingBottom: theme.spacing(8),
|
|
10927
|
-
paddingTop: theme.spacing(2)
|
|
11925
|
+
paddingTop: theme.spacing(2),
|
|
11926
|
+
textAlign: "center"
|
|
10928
11927
|
}),
|
|
10929
11928
|
termsLink: theme => ({
|
|
10930
11929
|
alignItems: "center",
|
|
@@ -11682,7 +12681,9 @@ const CustomsItemForm = ({
|
|
|
11682
12681
|
const {
|
|
11683
12682
|
t
|
|
11684
12683
|
} = reactI18next.useTranslation();
|
|
11685
|
-
const
|
|
12684
|
+
const {
|
|
12685
|
+
countryCodeOptions
|
|
12686
|
+
} = useCountryCodeOptions();
|
|
11686
12687
|
const form = reactHookForm.useForm({
|
|
11687
12688
|
defaultValues: customsItem ? {
|
|
11688
12689
|
countryOfOrigin: customsItem.countryOfOrigin,
|
|
@@ -11788,6 +12789,10 @@ const CustomsItemForm = ({
|
|
|
11788
12789
|
};
|
|
11789
12790
|
|
|
11790
12791
|
/**
|
|
12792
|
+
* @internal
|
|
12793
|
+
*
|
|
12794
|
+
* # Copy Button
|
|
12795
|
+
*
|
|
11791
12796
|
* A copy button that copies the content to the users' clipboard and displays a
|
|
11792
12797
|
* checkmark on click.
|
|
11793
12798
|
*/
|
|
@@ -11986,7 +12991,8 @@ const styles$a = createStyles({
|
|
|
11986
12991
|
});
|
|
11987
12992
|
|
|
11988
12993
|
const LandingPage = ({
|
|
11989
|
-
onSubmit
|
|
12994
|
+
onSubmit,
|
|
12995
|
+
partnerName
|
|
11990
12996
|
}) => {
|
|
11991
12997
|
const {
|
|
11992
12998
|
t
|
|
@@ -12028,7 +13034,9 @@ const LandingPage = ({
|
|
|
12028
13034
|
css: styles$a.description,
|
|
12029
13035
|
variant: "body1"
|
|
12030
13036
|
}, {
|
|
12031
|
-
children: t("onboarding:landing.
|
|
13037
|
+
children: partnerName ? t("onboarding:landing.partnerMessageLine1", {
|
|
13038
|
+
partnerName: partnerName
|
|
13039
|
+
}) : t("onboarding:landing.messageLine1")
|
|
12032
13040
|
})), jsxRuntime.jsx(Spacer, {
|
|
12033
13041
|
multiplier: 2
|
|
12034
13042
|
}), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
@@ -12357,12 +13365,15 @@ const WarehouseForm = ({
|
|
|
12357
13365
|
submitButtonTitle,
|
|
12358
13366
|
warehouse
|
|
12359
13367
|
}) => {
|
|
13368
|
+
var _a, _b;
|
|
12360
13369
|
const {
|
|
12361
13370
|
t
|
|
12362
13371
|
} = reactI18next.useTranslation(["common", "manage-warehouses"]);
|
|
12363
13372
|
const {
|
|
12364
|
-
validateAddress
|
|
13373
|
+
validateAddress,
|
|
13374
|
+
userInput
|
|
12365
13375
|
} = useAddressPreference();
|
|
13376
|
+
const hasDefaultValues = !!warehouse || !!userInput;
|
|
12366
13377
|
const form = reactHookForm.useForm({
|
|
12367
13378
|
defaultValues: warehouse ? Object.assign(Object.assign({}, warehouse), {
|
|
12368
13379
|
isDefault: warehouse.isDefault,
|
|
@@ -12373,6 +13384,14 @@ const WarehouseForm = ({
|
|
|
12373
13384
|
countryCode: warehouse.returnAddress.countryCode
|
|
12374
13385
|
}),
|
|
12375
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
|
|
12376
13395
|
}) : {
|
|
12377
13396
|
isDefault: _isOnboarding ? true : false,
|
|
12378
13397
|
originAddress: {
|
|
@@ -12383,8 +13402,8 @@ const WarehouseForm = ({
|
|
|
12383
13402
|
resolver: validationResolver(warehouseSchema)
|
|
12384
13403
|
});
|
|
12385
13404
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
12386
|
-
const
|
|
12387
|
-
payload = __rest(
|
|
13405
|
+
const _c = values,
|
|
13406
|
+
payload = __rest(_c, ["returnToAddressIsDifferent"]);
|
|
12388
13407
|
yield validateAddress({
|
|
12389
13408
|
addresses: payload,
|
|
12390
13409
|
data: {
|
|
@@ -12413,12 +13432,6 @@ const WarehouseForm = ({
|
|
|
12413
13432
|
form: form,
|
|
12414
13433
|
formatFieldName: fieldName => `originAddress.${fieldName}`,
|
|
12415
13434
|
optionalFields: ["addressLine2"]
|
|
12416
|
-
}), jsxRuntime.jsx(CheckboxInput, {
|
|
12417
|
-
checkboxLabel: t("manage-warehouses:residentialAddress"),
|
|
12418
|
-
control: form.control,
|
|
12419
|
-
form: "warehouse-form",
|
|
12420
|
-
label: "originAddress.addressResidentialIndicator",
|
|
12421
|
-
name: "originAddress.addressResidentialIndicator"
|
|
12422
13435
|
}), !_isOnboarding && jsxRuntime.jsx(CheckboxInput, {
|
|
12423
13436
|
checkboxLabel: t("manage-warehouses:isDefault"),
|
|
12424
13437
|
control: form.control,
|
|
@@ -12446,18 +13459,12 @@ const WarehouseForm = ({
|
|
|
12446
13459
|
});
|
|
12447
13460
|
}
|
|
12448
13461
|
}
|
|
12449
|
-
}), form.watch("returnToAddressIsDifferent") && jsxRuntime.
|
|
12450
|
-
children:
|
|
13462
|
+
}), form.watch("returnToAddressIsDifferent") && jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
13463
|
+
children: jsxRuntime.jsx(AddressFields, {
|
|
12451
13464
|
form: form,
|
|
12452
13465
|
formatFieldName: fieldName => `returnAddress.${fieldName}`,
|
|
12453
13466
|
optionalFields: ["addressLine2"]
|
|
12454
|
-
})
|
|
12455
|
-
checkboxLabel: t("manage-warehouses:residentialAddress"),
|
|
12456
|
-
control: form.control,
|
|
12457
|
-
form: "warehouse-form",
|
|
12458
|
-
label: "returnAddress.addressResidentialIndicator",
|
|
12459
|
-
name: "returnAddress.addressResidentialIndicator"
|
|
12460
|
-
})]
|
|
13467
|
+
})
|
|
12461
13468
|
}), jsxRuntime.jsxs(ButtonGroup, Object.assign({
|
|
12462
13469
|
justify: "center"
|
|
12463
13470
|
}, {
|
|
@@ -12482,7 +13489,7 @@ const WarehouseForm = ({
|
|
|
12482
13489
|
control: form.control,
|
|
12483
13490
|
"data-testid": "warehouseFormSubmitButton",
|
|
12484
13491
|
form: "warehouse-form",
|
|
12485
|
-
requireDirty:
|
|
13492
|
+
requireDirty: !hasDefaultValues,
|
|
12486
13493
|
variant: _isOnboarding ? giger.ButtonVariant.FILLED : giger.ButtonVariant.OUTLINED
|
|
12487
13494
|
}, {
|
|
12488
13495
|
children: submitButtonTitle
|
|
@@ -12699,11 +13706,21 @@ const styles$6 = createStyles({
|
|
|
12699
13706
|
container: theme => ({
|
|
12700
13707
|
padding: theme.spacing(2)
|
|
12701
13708
|
}),
|
|
13709
|
+
iconTooltip: theme => ({
|
|
13710
|
+
color: theme.palette.secondary.main,
|
|
13711
|
+
display: "inline-block",
|
|
13712
|
+
marginLeft: theme.spacing(1),
|
|
13713
|
+
verticalAlign: "middle"
|
|
13714
|
+
}),
|
|
12702
13715
|
step: {
|
|
12703
13716
|
"& > span:last-child": {
|
|
12704
13717
|
position: "static"
|
|
12705
13718
|
}
|
|
12706
13719
|
},
|
|
13720
|
+
tooltipContainer: () => ({
|
|
13721
|
+
maxWidth: "260px",
|
|
13722
|
+
textAlign: "left"
|
|
13723
|
+
}),
|
|
12707
13724
|
walletFormHeader: theme => ({
|
|
12708
13725
|
margin: theme.spacing(4)
|
|
12709
13726
|
}),
|
|
@@ -12719,18 +13736,20 @@ const styles$6 = createStyles({
|
|
|
12719
13736
|
|
|
12720
13737
|
const Onboarding = ({
|
|
12721
13738
|
connectedCarriers,
|
|
13739
|
+
createFundingSource,
|
|
13740
|
+
createFundingSourceErrors,
|
|
12722
13741
|
createWarehouse,
|
|
12723
13742
|
features,
|
|
12724
13743
|
fundingSources,
|
|
12725
13744
|
isRegisteringCarriers,
|
|
13745
|
+
onboardingAddress,
|
|
12726
13746
|
onCarrierCreated,
|
|
12727
13747
|
onCompleteOnboarding,
|
|
12728
13748
|
onFundingSourceCreated,
|
|
12729
13749
|
onWarehouseCreated,
|
|
13750
|
+
partnerName,
|
|
12730
13751
|
registerCarrier,
|
|
12731
13752
|
registerCarrierErrors,
|
|
12732
|
-
createFundingSource,
|
|
12733
|
-
createFundingSourceErrors,
|
|
12734
13753
|
warehouses
|
|
12735
13754
|
}) => {
|
|
12736
13755
|
var _a, _b, _c;
|
|
@@ -12764,6 +13783,7 @@ const Onboarding = ({
|
|
|
12764
13783
|
const hasDhl = connectedCarriers === null || connectedCarriers === void 0 ? void 0 : connectedCarriers.some(c => c.carrierCode === "dhl_express_worldwide");
|
|
12765
13784
|
const fundingSourceId = (fundingSources === null || fundingSources === void 0 ? void 0 : fundingSources.length) ? fundingSources[0].fundingSourceId : undefined;
|
|
12766
13785
|
const hasCompletedOnboarding = onboardingComplete || warehouses.length && hasStampsWallet && (hasUps || !upsEnabled) && hasDhl;
|
|
13786
|
+
const containerRef = React.useRef(null);
|
|
12767
13787
|
const currentStep = React.useMemo(() => {
|
|
12768
13788
|
if (hasCompletedOnboarding) {
|
|
12769
13789
|
return 5;
|
|
@@ -12876,7 +13896,8 @@ const Onboarding = ({
|
|
|
12876
13896
|
}
|
|
12877
13897
|
// Step 1: Landing Page
|
|
12878
13898
|
if (!email) return jsxRuntime.jsx(LandingPage, {
|
|
12879
|
-
onSubmit: e => setEmail(e)
|
|
13899
|
+
onSubmit: e => setEmail(e),
|
|
13900
|
+
partnerName: partnerName
|
|
12880
13901
|
});
|
|
12881
13902
|
// Step 2: Agree to Terms and Conditions
|
|
12882
13903
|
if (!agreedToTerms) {
|
|
@@ -12925,7 +13946,8 @@ const Onboarding = ({
|
|
|
12925
13946
|
onSubmit: payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
12926
13947
|
return handleCreateWarehouse(payload);
|
|
12927
13948
|
}),
|
|
12928
|
-
submitButtonTitle: t("actions.continue")
|
|
13949
|
+
submitButtonTitle: t("actions.continue"),
|
|
13950
|
+
warehouse: onboardingAddress
|
|
12929
13951
|
})
|
|
12930
13952
|
}));
|
|
12931
13953
|
}
|
|
@@ -12948,21 +13970,39 @@ const Onboarding = ({
|
|
|
12948
13970
|
variant: "subtitle1"
|
|
12949
13971
|
}, {
|
|
12950
13972
|
children: t("register-wallet:sections.billing.cardSubTitle")
|
|
13973
|
+
})), jsxRuntime.jsx(giger.IconTooltip, Object.assign({
|
|
13974
|
+
container: containerRef.current,
|
|
13975
|
+
css: styles$6.iconTooltip,
|
|
13976
|
+
icon: gigerTheme.IconNames.INFO_FILLED,
|
|
13977
|
+
placement: "auto",
|
|
13978
|
+
size: giger.IconSize.SIZE_MEDIUM
|
|
13979
|
+
}, {
|
|
13980
|
+
children: jsxRuntime.jsxs("div", Object.assign({
|
|
13981
|
+
css: styles$6.tooltipContainer
|
|
13982
|
+
}, {
|
|
13983
|
+
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
13984
|
+
bold: true,
|
|
13985
|
+
variant: "small"
|
|
13986
|
+
}, {
|
|
13987
|
+
children: t("register-wallet:sections.notifications.info.title")
|
|
13988
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
13989
|
+
multiplier: 1
|
|
13990
|
+
}), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
13991
|
+
variant: "small"
|
|
13992
|
+
}, {
|
|
13993
|
+
children: t("register-wallet:sections.notifications.info.description")
|
|
13994
|
+
}))]
|
|
13995
|
+
}))
|
|
12951
13996
|
}))]
|
|
12952
13997
|
})), jsxRuntime.jsx(Spacer, {
|
|
12953
13998
|
multiplier: 1
|
|
12954
|
-
}), (createFundingSourceErrors === null || createFundingSourceErrors === void 0 ? void 0 : createFundingSourceErrors.length)
|
|
13999
|
+
}), !!(createFundingSourceErrors === null || createFundingSourceErrors === void 0 ? void 0 : createFundingSourceErrors.length) && jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
12955
14000
|
title: t("register-wallet:sections.notifications.error.title"),
|
|
12956
14001
|
type: giger.NotificationType.ERROR
|
|
12957
14002
|
}, {
|
|
12958
14003
|
children: createFundingSourceErrors.map(({
|
|
12959
14004
|
message
|
|
12960
14005
|
}) => message).join(" ")
|
|
12961
|
-
})) : jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
12962
|
-
title: t("register-wallet:sections.notifications.info.title"),
|
|
12963
|
-
type: giger.NotificationType.INFO
|
|
12964
|
-
}, {
|
|
12965
|
-
children: t("register-wallet:sections.notifications.info.description")
|
|
12966
14006
|
}))]
|
|
12967
14007
|
})),
|
|
12968
14008
|
onSubmit: payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -13020,14 +14060,15 @@ const Onboarding = ({
|
|
|
13020
14060
|
});
|
|
13021
14061
|
};
|
|
13022
14062
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
13023
|
-
css: styles$6.container
|
|
14063
|
+
css: styles$6.container,
|
|
14064
|
+
ref: containerRef
|
|
13024
14065
|
}, {
|
|
13025
14066
|
children: [jsxRuntime.jsxs(giger.Stepper, Object.assign({
|
|
13026
14067
|
currentStep: currentStep
|
|
13027
14068
|
}, {
|
|
13028
14069
|
children: [jsxRuntime.jsx(giger.Step, {
|
|
13029
14070
|
css: styles$6.step,
|
|
13030
|
-
label: t("onboarding:steps.
|
|
14071
|
+
label: t("onboarding:steps.register")
|
|
13031
14072
|
}), jsxRuntime.jsx(giger.Step, {
|
|
13032
14073
|
css: styles$6.step,
|
|
13033
14074
|
label: t("onboarding:steps.carriers")
|
|
@@ -13036,7 +14077,7 @@ const Onboarding = ({
|
|
|
13036
14077
|
label: t("onboarding:steps.addresses")
|
|
13037
14078
|
}), jsxRuntime.jsx(giger.Step, {
|
|
13038
14079
|
css: styles$6.step,
|
|
13039
|
-
label: t("onboarding:steps.
|
|
14080
|
+
label: t("onboarding:steps.billing")
|
|
13040
14081
|
})]
|
|
13041
14082
|
})), renderStep(), ((_c = features === null || features === void 0 ? void 0 : features.presentation) === null || _c === void 0 ? void 0 : _c.poweredByShipEngine) && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
13042
14083
|
children: [jsxRuntime.jsx(Spacer, {}), jsxRuntime.jsx(PoweredByShipEngine, {})]
|
|
@@ -13047,6 +14088,15 @@ const Onboarding = ({
|
|
|
13047
14088
|
let _ = t => t,
|
|
13048
14089
|
_t,
|
|
13049
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
|
+
*/
|
|
13050
14100
|
const Cube = _a => {
|
|
13051
14101
|
var {
|
|
13052
14102
|
animate = false
|
|
@@ -13074,7 +14124,7 @@ const Cube = _a => {
|
|
|
13074
14124
|
const styles = {
|
|
13075
14125
|
bounce: /*#__PURE__*/react.css(Object.assign({}, animate && {
|
|
13076
14126
|
animation: `${bounce} 1s infinite`
|
|
13077
|
-
}), 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== */"),
|
|
13078
14128
|
content: /*#__PURE__*/react.css(Object.assign({
|
|
13079
14129
|
clipRule: "evenodd",
|
|
13080
14130
|
fillRule: "evenodd",
|
|
@@ -13084,7 +14134,7 @@ const Cube = _a => {
|
|
|
13084
14134
|
width: "5rem"
|
|
13085
14135
|
}, animate && {
|
|
13086
14136
|
animation: `${spin} 1s linear infinite;`
|
|
13087
|
-
}), 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== */")
|
|
13088
14138
|
};
|
|
13089
14139
|
return jsxRuntime.jsx("div", Object.assign({
|
|
13090
14140
|
css: styles.bounce
|
|
@@ -13110,29 +14160,6 @@ const Cube = _a => {
|
|
|
13110
14160
|
};
|
|
13111
14161
|
|
|
13112
14162
|
const styles$5 = createStyles({
|
|
13113
|
-
balanceText: theme => ({
|
|
13114
|
-
color: theme.palette.secondary.dark
|
|
13115
|
-
}),
|
|
13116
|
-
container: theme => ({
|
|
13117
|
-
padding: `${theme.spacing(3)}px ${theme.spacing(4)}px`
|
|
13118
|
-
}),
|
|
13119
|
-
getFormExtension: isCustomAmount => theme => ({
|
|
13120
|
-
backgroundColor: theme.palette.gray.ultraLight,
|
|
13121
|
-
display: "flex",
|
|
13122
|
-
flexDirection: "column",
|
|
13123
|
-
gap: theme.spacing(1),
|
|
13124
|
-
// Negative margin is to compensate for the padding on AddFundsForm, since we want this
|
|
13125
|
-
// section to seemlessly extend the form's well.
|
|
13126
|
-
marginTop: theme.spacing(isCustomAmount ? -1.5 : -1),
|
|
13127
|
-
padding: theme.spacing(2),
|
|
13128
|
-
paddingTop: 0
|
|
13129
|
-
}),
|
|
13130
|
-
saveRateButton: {
|
|
13131
|
-
whiteSpace: "nowrap"
|
|
13132
|
-
}
|
|
13133
|
-
});
|
|
13134
|
-
|
|
13135
|
-
const styles$4 = createStyles({
|
|
13136
14163
|
icon: theme => ({
|
|
13137
14164
|
color: theme.palette.primary.main,
|
|
13138
14165
|
marginRight: theme.spacing(2)
|
|
@@ -13167,6 +14194,11 @@ const styles$4 = createStyles({
|
|
|
13167
14194
|
})
|
|
13168
14195
|
});
|
|
13169
14196
|
|
|
14197
|
+
/**
|
|
14198
|
+
* @internal
|
|
14199
|
+
*
|
|
14200
|
+
* # Section Component
|
|
14201
|
+
*/
|
|
13170
14202
|
const Section = _a => {
|
|
13171
14203
|
var {
|
|
13172
14204
|
bold,
|
|
@@ -13177,10 +14209,10 @@ const Section = _a => {
|
|
|
13177
14209
|
rest = __rest(_a, ["bold", "title", "children", "rightContent"]);
|
|
13178
14210
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
13179
14211
|
children: [title && jsxRuntime.jsx("summary", Object.assign({
|
|
13180
|
-
css: styles$
|
|
14212
|
+
css: styles$5.summary
|
|
13181
14213
|
}, {
|
|
13182
14214
|
children: jsxRuntime.jsxs("div", Object.assign({
|
|
13183
|
-
css: styles$
|
|
14215
|
+
css: styles$5.summaryWrapper
|
|
13184
14216
|
}, {
|
|
13185
14217
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
13186
14218
|
bold: bold,
|
|
@@ -13188,23 +14220,52 @@ const Section = _a => {
|
|
|
13188
14220
|
}, {
|
|
13189
14221
|
children: title
|
|
13190
14222
|
})), rightContent && jsxRuntime.jsx("div", Object.assign({
|
|
13191
|
-
css: styles$
|
|
14223
|
+
css: styles$5.rightContentWrapper
|
|
13192
14224
|
}, {
|
|
13193
14225
|
children: rightContent
|
|
13194
14226
|
}))]
|
|
13195
14227
|
}))
|
|
13196
14228
|
})), jsxRuntime.jsx("section", Object.assign({
|
|
13197
|
-
css: styles$
|
|
14229
|
+
css: styles$5.section
|
|
13198
14230
|
}, rest, {
|
|
13199
14231
|
children: children
|
|
13200
14232
|
}))]
|
|
13201
14233
|
});
|
|
13202
14234
|
};
|
|
13203
14235
|
|
|
14236
|
+
const styles$4 = createStyles({
|
|
14237
|
+
balanceText: theme => ({
|
|
14238
|
+
color: theme.palette.secondary.dark
|
|
14239
|
+
}),
|
|
14240
|
+
container: theme => ({
|
|
14241
|
+
padding: `${theme.spacing(3)}px ${theme.spacing(4)}px`
|
|
14242
|
+
}),
|
|
14243
|
+
getFormExtension: isCustomAmount => theme => ({
|
|
14244
|
+
backgroundColor: theme.palette.gray.ultraLight,
|
|
14245
|
+
display: "flex",
|
|
14246
|
+
flexDirection: "column",
|
|
14247
|
+
gap: theme.spacing(1),
|
|
14248
|
+
// Negative margin is to compensate for the padding on AddFundsForm, since we want this
|
|
14249
|
+
// section to seemlessly extend the form's well.
|
|
14250
|
+
marginTop: theme.spacing(isCustomAmount ? -1.5 : -1),
|
|
14251
|
+
padding: theme.spacing(2),
|
|
14252
|
+
paddingTop: 0
|
|
14253
|
+
}),
|
|
14254
|
+
saveRateButton: {
|
|
14255
|
+
whiteSpace: "nowrap"
|
|
14256
|
+
}
|
|
14257
|
+
});
|
|
14258
|
+
|
|
13204
14259
|
/**
|
|
14260
|
+
* @internal
|
|
14261
|
+
*
|
|
14262
|
+
* # Fund And Purchase Component
|
|
14263
|
+
*
|
|
13205
14264
|
* Fund and Purchase handles the label purchase submission UX, ensuring that a user
|
|
13206
14265
|
* has the necessary funds available and can add them if not. It allows a single button
|
|
13207
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}
|
|
13208
14269
|
*/
|
|
13209
14270
|
const FundAndPurchase = ({
|
|
13210
14271
|
balance: uspsBalance,
|
|
@@ -13266,7 +14327,7 @@ const FundAndPurchase = ({
|
|
|
13266
14327
|
}, {
|
|
13267
14328
|
children: [jsxRuntime.jsx(giger.Button, Object.assign({
|
|
13268
14329
|
bold: false,
|
|
13269
|
-
css: styles$
|
|
14330
|
+
css: styles$4.saveRateButton,
|
|
13270
14331
|
disabled: disabled || !carrierId || addFundsForm.isSubmitting || isRateFormSubmitting,
|
|
13271
14332
|
isLoading: isSavingRate,
|
|
13272
14333
|
onClick: handleSaveRate,
|
|
@@ -13286,7 +14347,7 @@ const FundAndPurchase = ({
|
|
|
13286
14347
|
// render when no rate has been selected yet
|
|
13287
14348
|
if (!carrierId) return jsxRuntime.jsxs("div", Object.assign({
|
|
13288
14349
|
className: className,
|
|
13289
|
-
css: styles$
|
|
14350
|
+
css: styles$4.container
|
|
13290
14351
|
}, {
|
|
13291
14352
|
children: [jsxRuntime.jsxs(Spread, {
|
|
13292
14353
|
children: [jsxRuntime.jsx(CarrierBalance, {
|
|
@@ -13310,7 +14371,7 @@ const FundAndPurchase = ({
|
|
|
13310
14371
|
// show balance, but not the funding form.
|
|
13311
14372
|
if (!isFundingEnabled) return jsxRuntime.jsxs("div", Object.assign({
|
|
13312
14373
|
className: className,
|
|
13313
|
-
css: styles$
|
|
14374
|
+
css: styles$4.container
|
|
13314
14375
|
}, {
|
|
13315
14376
|
children: [jsxRuntime.jsx(CarrierBalance, {
|
|
13316
14377
|
carrierId: carrierId
|
|
@@ -13352,13 +14413,13 @@ const FundAndPurchase = ({
|
|
|
13352
14413
|
var _a, _b;
|
|
13353
14414
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
13354
14415
|
children: [jsxRuntime.jsxs("section", Object.assign({
|
|
13355
|
-
css: styles$
|
|
14416
|
+
css: styles$4.getFormExtension(addFundsForm.isCustomAmount)
|
|
13356
14417
|
}, {
|
|
13357
14418
|
children: [jsxRuntime.jsx(InlineLabel, Object.assign({
|
|
13358
14419
|
label: t("manage-funding:fundAndPurchase.newBalance")
|
|
13359
14420
|
}, {
|
|
13360
14421
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
13361
|
-
css: styles$
|
|
14422
|
+
css: styles$4.balanceText
|
|
13362
14423
|
}, {
|
|
13363
14424
|
children: formatMoney({
|
|
13364
14425
|
amount: balance + ((_a = addFundsForm.selectedAmount) !== null && _a !== void 0 ? _a : 0),
|
|
@@ -13369,7 +14430,7 @@ const FundAndPurchase = ({
|
|
|
13369
14430
|
label: t("manage-funding:fundAndPurchase.finalBalance")
|
|
13370
14431
|
}, {
|
|
13371
14432
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
13372
|
-
css: styles$
|
|
14433
|
+
css: styles$4.balanceText
|
|
13373
14434
|
}, {
|
|
13374
14435
|
children: formatMoney({
|
|
13375
14436
|
amount: balance + ((_b = addFundsForm.selectedAmount) !== null && _b !== void 0 ? _b : 0) - purchaseAmount,
|
|
@@ -13389,6 +14450,15 @@ const FundAndPurchase = ({
|
|
|
13389
14450
|
}))]
|
|
13390
14451
|
})), jsxRuntime.jsx(Spacer, {
|
|
13391
14452
|
multiplier: 2
|
|
14453
|
+
}), addFundsForm.error && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
14454
|
+
children: [jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
14455
|
+
title: t("manage-funding:addFunds.error.title"),
|
|
14456
|
+
type: giger.NotificationType.ERROR
|
|
14457
|
+
}, {
|
|
14458
|
+
children: addFundsForm.error[0].message
|
|
14459
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
14460
|
+
multiplier: 2
|
|
14461
|
+
})]
|
|
13392
14462
|
}), renderActionButtons(addFundsForm)]
|
|
13393
14463
|
});
|
|
13394
14464
|
}
|
|
@@ -13424,7 +14494,7 @@ const RateForm = ({
|
|
|
13424
14494
|
carriers,
|
|
13425
14495
|
disabled,
|
|
13426
14496
|
errors,
|
|
13427
|
-
|
|
14497
|
+
displayableRateErrors,
|
|
13428
14498
|
displayableLabelErrors,
|
|
13429
14499
|
features,
|
|
13430
14500
|
labelErrors,
|
|
@@ -13438,7 +14508,7 @@ const RateForm = ({
|
|
|
13438
14508
|
shipment,
|
|
13439
14509
|
outOfBandDisplayableErrors
|
|
13440
14510
|
}) => {
|
|
13441
|
-
var _a, _b, _c, _d, _e;
|
|
14511
|
+
var _a, _b, _c, _d, _e, _f;
|
|
13442
14512
|
features = Object.assign({
|
|
13443
14513
|
presentation: {
|
|
13444
14514
|
poweredByShipEngine: false
|
|
@@ -13450,7 +14520,7 @@ const RateForm = ({
|
|
|
13450
14520
|
saveRate: true
|
|
13451
14521
|
}
|
|
13452
14522
|
}, features !== null && features !== void 0 ? features : {});
|
|
13453
|
-
const allDisplayableErrors = [...(
|
|
14523
|
+
const allDisplayableErrors = [...(displayableRateErrors !== null && displayableRateErrors !== void 0 ? displayableRateErrors : []), ...(outOfBandDisplayableErrors !== null && outOfBandDisplayableErrors !== void 0 ? outOfBandDisplayableErrors : [])];
|
|
13454
14524
|
const {
|
|
13455
14525
|
t
|
|
13456
14526
|
} = reactI18next.useTranslation();
|
|
@@ -13485,7 +14555,7 @@ const RateForm = ({
|
|
|
13485
14555
|
});
|
|
13486
14556
|
}
|
|
13487
14557
|
})));
|
|
13488
|
-
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));
|
|
13489
14559
|
// Return true if User has multiple accounts for a single carrier.
|
|
13490
14560
|
const hasDuplicateCarrierCode = carriers => {
|
|
13491
14561
|
const uniqueCarrierCodes = new Set();
|
|
@@ -13561,7 +14631,7 @@ const RateForm = ({
|
|
|
13561
14631
|
name: "rate",
|
|
13562
14632
|
nicknameFeature:
|
|
13563
14633
|
// if feature flag is on, and if account has duplicate carrierCodes, then show nickname
|
|
13564
|
-
((
|
|
14634
|
+
((_c = features === null || features === void 0 ? void 0 : features.rateForm) === null || _c === void 0 ? void 0 : _c.nicknameRate) && carriers && hasDuplicateCarrierCode(carriers),
|
|
13565
14635
|
onClick: onSelectRate,
|
|
13566
14636
|
options: showHiddenRates ? rateOptions : filteredRateOptions
|
|
13567
14637
|
}), rateOptions.some(option => option.requiresAcknowledgement) && rateOptions.length > 5 && jsxRuntime.jsx(giger.Link, Object.assign({
|
|
@@ -13599,10 +14669,10 @@ const RateForm = ({
|
|
|
13599
14669
|
type: giger.NotificationType.ERROR
|
|
13600
14670
|
}, {
|
|
13601
14671
|
children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
13602
|
-
children: [
|
|
14672
|
+
children: [displayableRateErrors, outOfBandDisplayableErrors, displayableLabelErrors]
|
|
13603
14673
|
})
|
|
13604
14674
|
}))]
|
|
13605
|
-
})), ((
|
|
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({
|
|
13606
14676
|
title: t("manage-defaults:label.title")
|
|
13607
14677
|
}, {
|
|
13608
14678
|
children: jsxRuntime.jsx(LabelLayout, {
|
|
@@ -13614,12 +14684,12 @@ const RateForm = ({
|
|
|
13614
14684
|
control: form.control,
|
|
13615
14685
|
css: styles$3.fundAndPurchase,
|
|
13616
14686
|
disabled: disabled,
|
|
13617
|
-
isFundingEnabled: !!((
|
|
14687
|
+
isFundingEnabled: !!((_e = features === null || features === void 0 ? void 0 : features.rateForm) === null || _e === void 0 ? void 0 : _e.enableFunding),
|
|
13618
14688
|
isFundingRequired: (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.balance) !== undefined && !!selectedRate.requiresFundedAmount,
|
|
13619
14689
|
onPurchase: handleSubmit,
|
|
13620
14690
|
onSave: handleSaveRate,
|
|
13621
14691
|
purchaseAmount: getTotalRateAmount(selectedRate)
|
|
13622
|
-
}), ((
|
|
14692
|
+
}), ((_f = features === null || features === void 0 ? void 0 : features.presentation) === null || _f === void 0 ? void 0 : _f.poweredByShipEngine) && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
13623
14693
|
children: [jsxRuntime.jsx(Spacer, {}), jsxRuntime.jsx(PoweredByShipEngine, {})]
|
|
13624
14694
|
})]
|
|
13625
14695
|
}));
|
|
@@ -13691,6 +14761,11 @@ const ItemsBreakdownTableHeader = ({
|
|
|
13691
14761
|
}))]
|
|
13692
14762
|
})
|
|
13693
14763
|
});
|
|
14764
|
+
/**
|
|
14765
|
+
* @internal
|
|
14766
|
+
*
|
|
14767
|
+
* # Items Breakdown Component
|
|
14768
|
+
*/
|
|
13694
14769
|
const ItemsBreakdown = ({
|
|
13695
14770
|
items
|
|
13696
14771
|
}) => {
|
|
@@ -14025,10 +15100,12 @@ const CustomsItemsDisplay = ({
|
|
|
14025
15100
|
extendZod();
|
|
14026
15101
|
const getShipmentSchema = ({
|
|
14027
15102
|
allowInternationalShipFrom,
|
|
14028
|
-
|
|
14029
|
-
requireMeasurements: _requireMeasurements = false,
|
|
15103
|
+
dimensionsUnit,
|
|
14030
15104
|
isContentDescriptionRequired: _isContentDescriptionRequired = false,
|
|
14031
|
-
isCustomsRequired: _isCustomsRequired = false
|
|
15105
|
+
isCustomsRequired: _isCustomsRequired = false,
|
|
15106
|
+
requireMeasurements: _requireMeasurements = false,
|
|
15107
|
+
warehouses,
|
|
15108
|
+
weightUnit
|
|
14032
15109
|
} = {}) => {
|
|
14033
15110
|
const baseSchema = zod.z.object({
|
|
14034
15111
|
advancedOptions: zod.z.object({
|
|
@@ -14059,7 +15136,9 @@ const getShipmentSchema = ({
|
|
|
14059
15136
|
height: zod.z.number().nonnegative().nullishDefault(0),
|
|
14060
15137
|
length: zod.z.number().nonnegative().nullishDefault(0),
|
|
14061
15138
|
width: zod.z.number().nonnegative().nullishDefault(0)
|
|
14062
|
-
}).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),
|
|
14063
15142
|
insuredValue: moneySchema.extend({
|
|
14064
15143
|
amount: zod.z.number().positive()
|
|
14065
15144
|
}).optional(),
|
|
@@ -14076,7 +15155,7 @@ const getShipmentSchema = ({
|
|
|
14076
15155
|
}) => whole || fractional, "schemaErrors.required") : zod.z.object({
|
|
14077
15156
|
fractional: zod.z.number().nonnegative().nullishDefault(0),
|
|
14078
15157
|
whole: zod.z.number().nonnegative().nullishDefault(0)
|
|
14079
|
-
}).nullish()).transform(weight => weight ? convertWeight(weight) : undefined)
|
|
15158
|
+
}).nullish()).transform(weight => weight ? convertWeight(weight, weightUnit) : undefined)
|
|
14080
15159
|
}).array().min(1),
|
|
14081
15160
|
service: zod.z.object({
|
|
14082
15161
|
carrierId: zod.z.string().nullish(),
|
|
@@ -14103,7 +15182,9 @@ const getShipmentSchema = ({
|
|
|
14103
15182
|
length,
|
|
14104
15183
|
width,
|
|
14105
15184
|
height
|
|
14106
|
-
}) => [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
|
+
})))
|
|
14107
15188
|
}).array().min(1),
|
|
14108
15189
|
service: zod.z.object({
|
|
14109
15190
|
carrierId: zod.z.string(),
|
|
@@ -14151,6 +15232,7 @@ const getShipmentSchema = ({
|
|
|
14151
15232
|
const minimumShipDate = nextDayCutoff(17);
|
|
14152
15233
|
const maximumShipDate = daysAfter(7, minimumShipDate);
|
|
14153
15234
|
const ShipmentForm = ({
|
|
15235
|
+
accountSettings,
|
|
14154
15236
|
addressLoading,
|
|
14155
15237
|
addressPreference,
|
|
14156
15238
|
charsetWarning,
|
|
@@ -14191,14 +15273,22 @@ const ShipmentForm = ({
|
|
|
14191
15273
|
const [insuranceEnabled, setInsuranceEnabled] = React.useState(false);
|
|
14192
15274
|
const {
|
|
14193
15275
|
isContentDescriptionRequired,
|
|
14194
|
-
isCustomsRequired
|
|
15276
|
+
isCustomsRequired,
|
|
15277
|
+
hasAllZeroMeasurements
|
|
14195
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]);
|
|
14196
15284
|
const shipmentSchema = React.useMemo(() => getShipmentSchema({
|
|
15285
|
+
dimensionsUnit,
|
|
14197
15286
|
isContentDescriptionRequired,
|
|
14198
15287
|
isCustomsRequired,
|
|
14199
15288
|
requireMeasurements,
|
|
14200
|
-
warehouses: warehouses !== null && warehouses !== void 0 ? warehouses : []
|
|
14201
|
-
|
|
15289
|
+
warehouses: warehouses !== null && warehouses !== void 0 ? warehouses : [],
|
|
15290
|
+
weightUnit
|
|
15291
|
+
}), [isCustomsRequired, requireMeasurements, warehouses, isContentDescriptionRequired, weightUnit, dimensionsUnit]);
|
|
14202
15292
|
const requestedServices = React.useMemo(() => getRequestedServices(salesOrder), [salesOrder]);
|
|
14203
15293
|
const form = reactHookForm.useForm({
|
|
14204
15294
|
defaultValues: {
|
|
@@ -14249,10 +15339,10 @@ const ShipmentForm = ({
|
|
|
14249
15339
|
const {
|
|
14250
15340
|
whole,
|
|
14251
15341
|
fractional
|
|
14252
|
-
} = formatFractionalWeight(weight);
|
|
15342
|
+
} = formatFractionalWeight(weight, weightUnit);
|
|
14253
15343
|
form.setValue("packages.0.weight.whole", whole);
|
|
14254
15344
|
form.setValue("packages.0.weight.fractional", fractional);
|
|
14255
|
-
}, [form]);
|
|
15345
|
+
}, [form, weightUnit]);
|
|
14256
15346
|
const handleChangeMode = React.useCallback(nextMode => __awaiter(void 0, void 0, void 0, function* () {
|
|
14257
15347
|
if (nextMode === "browse_rates") {
|
|
14258
15348
|
// Browse Rates
|
|
@@ -14760,7 +15850,7 @@ const ShipmentForm = ({
|
|
|
14760
15850
|
name: "packages.0.type",
|
|
14761
15851
|
onCategoryChange: value => form.setValue("carrierId", value),
|
|
14762
15852
|
options: packageOptions
|
|
14763
|
-
}),
|
|
15853
|
+
}), hasMeasurementUnits && requireMeasurements ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
14764
15854
|
children: [jsxRuntime.jsxs(InputGroup, Object.assign({
|
|
14765
15855
|
control: form.control,
|
|
14766
15856
|
disabled: !!findCustomPackage(selectedPackage === null || selectedPackage === void 0 ? void 0 : selectedPackage.code),
|
|
@@ -14773,19 +15863,25 @@ const ShipmentForm = ({
|
|
|
14773
15863
|
control: form.control,
|
|
14774
15864
|
label: t("purchase-label:fields.dimensions.length"),
|
|
14775
15865
|
name: "packages.0.dimensions.length",
|
|
14776
|
-
placeholder: t(
|
|
15866
|
+
placeholder: t(`units.${dimensionsUnit}`)
|
|
14777
15867
|
}), jsxRuntime.jsx(NumberInput, {
|
|
14778
15868
|
control: form.control,
|
|
14779
15869
|
label: t("purchase-label:fields.dimensions.width"),
|
|
14780
15870
|
name: "packages.0.dimensions.width",
|
|
14781
|
-
placeholder: t(
|
|
15871
|
+
placeholder: t(`units.${dimensionsUnit}`)
|
|
14782
15872
|
}), jsxRuntime.jsx(NumberInput, {
|
|
14783
15873
|
control: form.control,
|
|
14784
15874
|
label: t("purchase-label:fields.dimensions.height"),
|
|
14785
15875
|
name: "packages.0.dimensions.height",
|
|
14786
|
-
placeholder: t(
|
|
15876
|
+
placeholder: t(`units.${dimensionsUnit}`)
|
|
14787
15877
|
})]
|
|
14788
|
-
})), 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({
|
|
14789
15885
|
control: form.control,
|
|
14790
15886
|
label: t("purchase-label:fields.weightGroup"),
|
|
14791
15887
|
name: "packages.0.weight",
|
|
@@ -14805,6 +15901,26 @@ const ShipmentForm = ({
|
|
|
14805
15901
|
placeholder: t("units.oz")
|
|
14806
15902
|
})]
|
|
14807
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, {})]
|
|
14808
15924
|
}), isContentDescriptionRequired && jsxRuntime.jsx(TextInput, {
|
|
14809
15925
|
control: form.control,
|
|
14810
15926
|
hint: t("purchase-label:hints.contentDescription"),
|
|
@@ -14983,6 +16099,13 @@ const Shipment = ({
|
|
|
14983
16099
|
const requestedServices = React.useMemo(() => getRequestedServices(salesOrder), [salesOrder]);
|
|
14984
16100
|
const activeLabel = React.useMemo(() => labels === null || labels === void 0 ? void 0 : labels.find(l => l.status === "completed"), [labels]);
|
|
14985
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(" ");
|
|
14986
16109
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
14987
16110
|
children: [jsxRuntime.jsxs(Section, Object.assign({
|
|
14988
16111
|
"data-testid": "orderDetail"
|
|
@@ -15068,16 +16191,12 @@ const Shipment = ({
|
|
|
15068
16191
|
"data-testid": "dimensions",
|
|
15069
16192
|
label: t("view-shipment:fields.dimensions")
|
|
15070
16193
|
}, {
|
|
15071
|
-
children: [`${dimensions
|
|
16194
|
+
children: [`${formatDimensions(dimensions)} ` + t(`units.${dimensions.unit}`), jsxRuntime.jsx(Spacer, {})]
|
|
15072
16195
|
})), jsxRuntime.jsx(FieldLabel, Object.assign({
|
|
15073
16196
|
"data-testid": "weight",
|
|
15074
16197
|
label: t("view-shipment:fields.weight")
|
|
15075
16198
|
}, {
|
|
15076
|
-
children:
|
|
15077
|
-
count: pounds
|
|
15078
|
-
}) : "", ounces > 0 ? t("weight.ounces", {
|
|
15079
|
-
count: ounces
|
|
15080
|
-
}) : ""].filter(unit => unit.length).join(" ")
|
|
16199
|
+
children: formatWeight(weight)
|
|
15081
16200
|
}))]
|
|
15082
16201
|
})), jsxRuntime.jsxs(Section, Object.assign({
|
|
15083
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({
|
|
@@ -15231,6 +16350,9 @@ const styles = createStyles({
|
|
|
15231
16350
|
})
|
|
15232
16351
|
});
|
|
15233
16352
|
|
|
16353
|
+
/**
|
|
16354
|
+
* @internal
|
|
16355
|
+
*/
|
|
15234
16356
|
const DateRangeSelect = ({
|
|
15235
16357
|
fullWidth,
|
|
15236
16358
|
onChange,
|
|
@@ -15264,6 +16386,13 @@ const DateRangeSelect = ({
|
|
|
15264
16386
|
}));
|
|
15265
16387
|
};
|
|
15266
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
|
+
*/
|
|
15267
16396
|
const DateRangeCombo = ({
|
|
15268
16397
|
children: renderChildren,
|
|
15269
16398
|
onChange,
|
|
@@ -15308,9 +16437,13 @@ const DateRangeCombo = ({
|
|
|
15308
16437
|
};
|
|
15309
16438
|
|
|
15310
16439
|
/**
|
|
16440
|
+
* @internal
|
|
16441
|
+
*
|
|
16442
|
+
* # Error Fallback Component
|
|
16443
|
+
*
|
|
15311
16444
|
* Fallback component for the Elements ErrorBoundary
|
|
15312
16445
|
*
|
|
15313
|
-
* @see {@link
|
|
16446
|
+
* @see {@link ErrorFallbackProps | The props that are passed into the `<ErrorFallback />` component}
|
|
15314
16447
|
*/
|
|
15315
16448
|
const ErrorFallback = ({
|
|
15316
16449
|
error
|
|
@@ -15344,7 +16477,11 @@ const ErrorFallback = ({
|
|
|
15344
16477
|
};
|
|
15345
16478
|
|
|
15346
16479
|
/**
|
|
15347
|
-
*
|
|
16480
|
+
* @internal
|
|
16481
|
+
*
|
|
16482
|
+
* # Story Notes Component
|
|
16483
|
+
*
|
|
16484
|
+
* - For relevant notes about Storybook stories
|
|
15348
16485
|
*
|
|
15349
16486
|
* Stopgap until we setup https://storybook.js.org/addons/@storybook/addon-docs
|
|
15350
16487
|
*/
|
|
@@ -15629,12 +16766,17 @@ var common = {
|
|
|
15629
16766
|
weight: {
|
|
15630
16767
|
ounces: "{{count}} oz",
|
|
15631
16768
|
pounds_one: "{{count}} lb",
|
|
15632
|
-
pounds_other: "{{count}} lbs"
|
|
16769
|
+
pounds_other: "{{count}} lbs",
|
|
16770
|
+
kilogram: "{{count}} kg",
|
|
16771
|
+
gram: "{{count}} g"
|
|
15633
16772
|
},
|
|
15634
16773
|
units: {
|
|
15635
|
-
|
|
16774
|
+
inch: "in",
|
|
15636
16775
|
lbs: "lbs",
|
|
15637
|
-
oz: "oz"
|
|
16776
|
+
oz: "oz",
|
|
16777
|
+
centimeter: "cm",
|
|
16778
|
+
gram: "g",
|
|
16779
|
+
kilogram: "kg"
|
|
15638
16780
|
},
|
|
15639
16781
|
"VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkMTAwLgo=": "$100 insurance included",
|
|
15640
16782
|
"VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkNTAuCg==": "$50 insurance included",
|
|
@@ -15642,7 +16784,8 @@ var common = {
|
|
|
15642
16784
|
"QWRkcmVzcyBub3QgZm91bmQ=": "There was an issue validating your address. Please try again.",
|
|
15643
16785
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: "UPS weight limit per package is 150 lbs.",
|
|
15644
16786
|
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: "Finish setting up your ShipStation Carriers in the ShipStation app",
|
|
15645
|
-
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.",
|
|
15646
16789
|
"QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBNaXNzaW5nIG9yIGludmFsaWQgc2hpcCB0byBTdGF0ZVByb3ZpbmNlQ29kZQ==": "The State/Province Code Exceeds 5 Characters. Shorten the abbreviation or remove it, then try again.",
|
|
15647
16790
|
"QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnZhbGlkIHNvbGQgdG8gc3RhdGUgcHJvdmluY2UgY29kZS4gVmFsaWQgbGVuZ3RoIGlzIDAgdG8gNSBhbHBoYW51bWVyaWM=": "The State/Province Code Exceeds 5 Characters. Shorten the abbreviation or remove it, then try again."
|
|
15648
16791
|
};
|
|
@@ -15780,18 +16923,19 @@ var onboarding$1 = {
|
|
|
15780
16923
|
title: "Onboarding",
|
|
15781
16924
|
inlineTitle: "Why are we asking?",
|
|
15782
16925
|
landing: {
|
|
15783
|
-
action: "
|
|
16926
|
+
action: "Register",
|
|
15784
16927
|
title: "Register Your Account",
|
|
15785
16928
|
subtitle: "Enter your email address to start shipping with discounted carrier rates",
|
|
15786
16929
|
welcome: "Welcome",
|
|
15787
|
-
messageLine1: "Simplify your shipping workflow
|
|
15788
|
-
|
|
16930
|
+
messageLine1: "Simplify your shipping workflow.",
|
|
16931
|
+
partnerMessageLine1: "Simplify your shipping workflow inside {{partnerName}}.",
|
|
16932
|
+
messageLine2: "Let’s begin your account registration so that you can compare carrier services, ship domestic and international orders, and manage your postage payments."
|
|
15789
16933
|
},
|
|
15790
16934
|
steps: {
|
|
15791
|
-
|
|
16935
|
+
register: "Register",
|
|
15792
16936
|
carriers: "Carriers",
|
|
15793
16937
|
addresses: "Addresses",
|
|
15794
|
-
|
|
16938
|
+
billing: "Billing"
|
|
15795
16939
|
},
|
|
15796
16940
|
warehouse: {
|
|
15797
16941
|
title: "Ship From Address",
|
|
@@ -15897,7 +17041,8 @@ var purchaseLabel$1 = {
|
|
|
15897
17041
|
},
|
|
15898
17042
|
rates: {
|
|
15899
17043
|
uspsMediaMailAcknowledgement: "I confirm that this package is compliant with <1>USPS guidelines for Media Mail®</1>",
|
|
15900
|
-
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>"
|
|
15901
17046
|
},
|
|
15902
17047
|
shipToAddressFormFields: "Ship To Address Form Fields",
|
|
15903
17048
|
sections: {
|
|
@@ -15921,8 +17066,8 @@ var registerWallet = {
|
|
|
15921
17066
|
"register-wallet": {
|
|
15922
17067
|
sections: {
|
|
15923
17068
|
setup: {
|
|
15924
|
-
title: "Carriers
|
|
15925
|
-
subtitle: "
|
|
17069
|
+
title: "Activate Carriers",
|
|
17070
|
+
subtitle: "Activate the carriers in our service by agreeing to the carriers’ Terms of Service",
|
|
15926
17071
|
descriptionTitle: "What is a wallet?",
|
|
15927
17072
|
description: "Explaining the benefits of the wallet here"
|
|
15928
17073
|
},
|
|
@@ -15942,7 +17087,7 @@ var registerWallet = {
|
|
|
15942
17087
|
},
|
|
15943
17088
|
info: {
|
|
15944
17089
|
title: "Why we are asking?",
|
|
15945
|
-
description: "
|
|
17090
|
+
description: "We are offering a secure account balance to handle the cost of labels, insurance and carrier adjustments."
|
|
15946
17091
|
},
|
|
15947
17092
|
poBox: {
|
|
15948
17093
|
title: "PO Box cannot be used for Billing",
|
|
@@ -16047,6 +17192,31 @@ var walletHistory = {
|
|
|
16047
17192
|
|
|
16048
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);
|
|
16049
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
|
+
*/
|
|
16050
17220
|
const Component$4 = ({
|
|
16051
17221
|
onSaveSettings
|
|
16052
17222
|
}) => {
|
|
@@ -16058,6 +17228,32 @@ const Component$4 = ({
|
|
|
16058
17228
|
onSaveSettings: onSaveSettings
|
|
16059
17229
|
});
|
|
16060
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
|
+
*/
|
|
16061
17257
|
const Element$5 = alchemy__default["default"].createElement(Component$4, ErrorFallback, {
|
|
16062
17258
|
css: {
|
|
16063
17259
|
height: "100%",
|
|
@@ -16076,9 +17272,44 @@ var accountSettings = /*#__PURE__*/Object.freeze({
|
|
|
16076
17272
|
Element: Element$5
|
|
16077
17273
|
});
|
|
16078
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
|
+
*/
|
|
16079
17308
|
const Component$3 = ({
|
|
16080
17309
|
features,
|
|
16081
|
-
|
|
17310
|
+
onboardingAddress,
|
|
17311
|
+
onCompleteOnboarding,
|
|
17312
|
+
partnerName
|
|
16082
17313
|
}) => {
|
|
16083
17314
|
const {
|
|
16084
17315
|
t
|
|
@@ -16131,20 +17362,46 @@ const Component$3 = ({
|
|
|
16131
17362
|
features: features,
|
|
16132
17363
|
fundingSources: fundingSources,
|
|
16133
17364
|
isRegisteringCarriers: registeringCarriers || creatingFundingSource,
|
|
17365
|
+
onboardingAddress: onboardingAddress,
|
|
16134
17366
|
onCarrierCreated: onCarrierCreated,
|
|
16135
17367
|
onCompleteOnboarding: onCompleteOnboarding,
|
|
16136
17368
|
onFundingSourceCreated: onFundingSourceCreated,
|
|
16137
17369
|
onWarehouseCreated: onWarehouseCreated,
|
|
17370
|
+
partnerName: partnerName,
|
|
16138
17371
|
registerCarrier: registerCarrier,
|
|
16139
17372
|
registerCarrierErrors: registerCarrierErrors,
|
|
16140
17373
|
warehouses: warehouses
|
|
16141
17374
|
});
|
|
16142
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
|
+
*/
|
|
16143
17398
|
const Element$4 = alchemy__default["default"].createElement(Component$3, ErrorFallback, {
|
|
16144
17399
|
css: {
|
|
16145
17400
|
height: "100%",
|
|
16146
17401
|
maxWidth: "800px",
|
|
16147
17402
|
minWidth: "440px",
|
|
17403
|
+
overflow: "auto",
|
|
17404
|
+
scrollbarGutter: "stable both-edges",
|
|
16148
17405
|
width: "100%"
|
|
16149
17406
|
},
|
|
16150
17407
|
resources: {
|
|
@@ -16398,27 +17655,6 @@ const usePresets = ({
|
|
|
16398
17655
|
};
|
|
16399
17656
|
};
|
|
16400
17657
|
|
|
16401
|
-
/**
|
|
16402
|
-
* Generic error pretty printer
|
|
16403
|
-
* @param errors
|
|
16404
|
-
* @param predicate
|
|
16405
|
-
* @param scrubber
|
|
16406
|
-
*/
|
|
16407
|
-
const useScrubErrors = ({
|
|
16408
|
-
scrubber,
|
|
16409
|
-
errors,
|
|
16410
|
-
predicate
|
|
16411
|
-
}) => {
|
|
16412
|
-
const {
|
|
16413
|
-
t
|
|
16414
|
-
} = reactI18next.useTranslation();
|
|
16415
|
-
return React.useMemo(() => errors === null || errors === void 0 ? void 0 : errors.map(e => {
|
|
16416
|
-
return t(jsBase64.encode(e.message), {
|
|
16417
|
-
defaultValue: !predicate || predicate(e) ? t(scrubber(e)) : e.message
|
|
16418
|
-
});
|
|
16419
|
-
}), [errors, predicate, scrubber, t]);
|
|
16420
|
-
};
|
|
16421
|
-
|
|
16422
17658
|
var usps_first_class_mail = [
|
|
16423
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."
|
|
16424
17660
|
];
|
|
@@ -16511,11 +17747,13 @@ const useRequestRates = ({
|
|
|
16511
17747
|
reset: resetRates,
|
|
16512
17748
|
mutateAsync: calculateRates
|
|
16513
17749
|
} = alchemy.useCalculateRates();
|
|
16514
|
-
const requestRates = React.useCallback(shipment => __awaiter(void 0, void 0, void 0, function* () {
|
|
16515
|
-
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 : [];
|
|
16516
17754
|
const result = yield calculateRates({
|
|
16517
17755
|
rateOptions: {
|
|
16518
|
-
carrierIds: shipment.carrierId ? [shipment.carrierId] :
|
|
17756
|
+
carrierIds: shipment.carrierId ? [shipment.carrierId] : isInternational ? internationalCarrierIds : domesticCarrierIds,
|
|
16519
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
|
|
16520
17758
|
: shipment.packages.map(pkg => pkg.packageCode),
|
|
16521
17759
|
serviceCodes: shipment.serviceCode ? [shipment.serviceCode] : undefined
|
|
@@ -16598,6 +17836,9 @@ const useRatesForm = ({
|
|
|
16598
17836
|
}) => {
|
|
16599
17837
|
var _a, _b;
|
|
16600
17838
|
const [beforeCreateError, setBeforeCreateError] = React.useState();
|
|
17839
|
+
const {
|
|
17840
|
+
isInternational
|
|
17841
|
+
} = useShipmentMetadata(shipment);
|
|
16601
17842
|
const {
|
|
16602
17843
|
data: carriers
|
|
16603
17844
|
} = alchemy.useListCarriers();
|
|
@@ -16670,11 +17911,11 @@ const useRatesForm = ({
|
|
|
16670
17911
|
shipDate: isNowOrInTheFuture(shipment.shipDate) ? shipment.shipDate : undefined
|
|
16671
17912
|
}));
|
|
16672
17913
|
if (updatedShipment) {
|
|
16673
|
-
yield requestRates(updatedShipment);
|
|
17914
|
+
yield requestRates(updatedShipment, isInternational);
|
|
16674
17915
|
yield onShipmentUpdated === null || onShipmentUpdated === void 0 ? void 0 : onShipmentUpdated(updatedShipment);
|
|
16675
17916
|
yield onRateSaved === null || onRateSaved === void 0 ? void 0 : onRateSaved(updatedShipment);
|
|
16676
17917
|
}
|
|
16677
|
-
}), [onRateSaved, onShipmentUpdated, requestRates, shipment, updateShipment]);
|
|
17918
|
+
}), [isInternational, onRateSaved, onShipmentUpdated, requestRates, shipment, updateShipment]);
|
|
16678
17919
|
let errors = [...(ratesErrors !== null && ratesErrors !== void 0 ? ratesErrors : []), ...((_a = ratesResponse === null || ratesResponse === void 0 ? void 0 : ratesResponse.errors) !== null && _a !== void 0 ? _a : [])];
|
|
16679
17920
|
if (beforeCreateError) errors = [...errors, beforeCreateError];
|
|
16680
17921
|
// Sometimes no rates are returned and no top-level errors are returned
|
|
@@ -16689,7 +17930,7 @@ const useRatesForm = ({
|
|
|
16689
17930
|
name: "CodedError"
|
|
16690
17931
|
})))) !== null && _b !== void 0 ? _b : [];
|
|
16691
17932
|
}
|
|
16692
|
-
const
|
|
17933
|
+
const displayableRateErrors = useScrubErrors({
|
|
16693
17934
|
errors: errors,
|
|
16694
17935
|
predicate: React.useCallback(e => e.message.includes("No rates are available for service_codes"), []),
|
|
16695
17936
|
scrubber: React.useCallback(() => "common:errorMessages.noRatesAvailable", [])
|
|
@@ -16700,8 +17941,8 @@ const useRatesForm = ({
|
|
|
16700
17941
|
});
|
|
16701
17942
|
return {
|
|
16702
17943
|
carriers,
|
|
16703
|
-
displayableErrors,
|
|
16704
17944
|
displayableLabelErrors,
|
|
17945
|
+
displayableRateErrors,
|
|
16705
17946
|
errors: errors.length > 0 ? errors : undefined,
|
|
16706
17947
|
isLoading: ratesCalculating,
|
|
16707
17948
|
labelErrors: (labelErrors === null || labelErrors === void 0 ? void 0 : labelErrors.length) ? labelErrors : undefined,
|
|
@@ -16736,6 +17977,9 @@ const useShipmentForm = ({
|
|
|
16736
17977
|
const {
|
|
16737
17978
|
data: warehouses
|
|
16738
17979
|
} = alchemy.useListWarehouses();
|
|
17980
|
+
const {
|
|
17981
|
+
data: accountSettings
|
|
17982
|
+
} = alchemy.useGetAccountSettings();
|
|
16739
17983
|
const {
|
|
16740
17984
|
error: updateShipmentErrors,
|
|
16741
17985
|
mutateAsync: updateShipment,
|
|
@@ -16795,6 +18039,7 @@ const useShipmentForm = ({
|
|
|
16795
18039
|
scrubber: React.useCallback(() => "common:errorMessages.noRatesAvailable", [])
|
|
16796
18040
|
});
|
|
16797
18041
|
return {
|
|
18042
|
+
accountSettings,
|
|
16798
18043
|
addressLoading,
|
|
16799
18044
|
addressPreference,
|
|
16800
18045
|
carriers,
|
|
@@ -16834,6 +18079,9 @@ const ConfigureShipment = _a => {
|
|
|
16834
18079
|
} = _a,
|
|
16835
18080
|
props = __rest(_a, ["features", "onAddressValidation", "onApplyPreset", "onBeforeLabelCreate", "onChangeAddress", "onLabelCreateFailure", "onLabelCreateSuccess", "onRateSaved", "onRatesCalculated", "onShipmentUpdated", "printLabelLayout", "salesOrder", "shipment"]);
|
|
16836
18081
|
const hydrateRef = React.useRef();
|
|
18082
|
+
const {
|
|
18083
|
+
isInternational
|
|
18084
|
+
} = useShipmentMetadata(shipment);
|
|
16837
18085
|
const _b = useRatesForm({
|
|
16838
18086
|
onBeforeLabelCreate,
|
|
16839
18087
|
onLabelCreateFailure,
|
|
@@ -16860,15 +18108,15 @@ const ConfigureShipment = _a => {
|
|
|
16860
18108
|
onApplyPreset: React.useCallback((_preset, shipment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16861
18109
|
var _d;
|
|
16862
18110
|
if (shipment.packages[0].weight.value) {
|
|
16863
|
-
yield requestRates(shipment);
|
|
18111
|
+
yield requestRates(shipment, isInternational);
|
|
16864
18112
|
}
|
|
16865
18113
|
(_d = hydrateRef.current) === null || _d === void 0 ? void 0 : _d.call(hydrateRef, shipment);
|
|
16866
|
-
}), [requestRates]),
|
|
18114
|
+
}), [requestRates, isInternational]),
|
|
16867
18115
|
onChangeAddress,
|
|
16868
18116
|
onShipmentUpdated,
|
|
16869
18117
|
onSubmit: React.useCallback(shipment => __awaiter(void 0, void 0, void 0, function* () {
|
|
16870
|
-
yield requestRates(shipment);
|
|
16871
|
-
}), [requestRates]),
|
|
18118
|
+
yield requestRates(shipment, isInternational);
|
|
18119
|
+
}), [requestRates, isInternational]),
|
|
16872
18120
|
salesOrder,
|
|
16873
18121
|
shipment
|
|
16874
18122
|
}),
|
|
@@ -17170,6 +18418,30 @@ const PurchaseLabelByShipment = _a => {
|
|
|
17170
18418
|
}));
|
|
17171
18419
|
};
|
|
17172
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
|
+
*/
|
|
17173
18445
|
const Component$2 = _a => {
|
|
17174
18446
|
var props = __rest(_a, []);
|
|
17175
18447
|
if ("salesOrderId" in props || "orderSourceCode" in props) {
|
|
@@ -17178,6 +18450,44 @@ const Component$2 = _a => {
|
|
|
17178
18450
|
return jsxRuntime.jsx(PurchaseLabelByShipment, Object.assign({}, props));
|
|
17179
18451
|
}
|
|
17180
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
|
+
*/
|
|
17181
18491
|
const Element$3 = alchemy__default["default"].createElement(Component$2, ErrorFallback, {
|
|
17182
18492
|
css: {
|
|
17183
18493
|
height: "100%",
|
|
@@ -17196,6 +18506,31 @@ var purchaseLabel = /*#__PURE__*/Object.freeze({
|
|
|
17196
18506
|
Element: Element$3
|
|
17197
18507
|
});
|
|
17198
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
|
+
*/
|
|
17199
18534
|
const Component$1 = ({
|
|
17200
18535
|
features,
|
|
17201
18536
|
onClickPrintLabel,
|
|
@@ -17235,6 +18570,36 @@ const Component$1 = ({
|
|
|
17235
18570
|
warehouse: warehouse
|
|
17236
18571
|
});
|
|
17237
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
|
+
**/
|
|
17238
18603
|
const Element$2 = alchemy__default["default"].createElement(Component$1, ErrorFallback, {
|
|
17239
18604
|
css: {
|
|
17240
18605
|
height: "100%",
|
|
@@ -17358,6 +18723,31 @@ const Message = ({
|
|
|
17358
18723
|
});
|
|
17359
18724
|
};
|
|
17360
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
|
+
*/
|
|
17361
18751
|
const Component = ({
|
|
17362
18752
|
features,
|
|
17363
18753
|
labelId,
|
|
@@ -17409,6 +18799,37 @@ const Component = ({
|
|
|
17409
18799
|
})]
|
|
17410
18800
|
});
|
|
17411
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
|
+
*/
|
|
17412
18833
|
const Element$1 = alchemy__default["default"].createElement(Component, ErrorFallback, {
|
|
17413
18834
|
css: {
|
|
17414
18835
|
height: "100%",
|
|
@@ -17427,6 +18848,31 @@ var voidLabel = /*#__PURE__*/Object.freeze({
|
|
|
17427
18848
|
Element: Element$1
|
|
17428
18849
|
});
|
|
17429
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
|
+
*/
|
|
17430
18876
|
const useLabelWorkflow = ({
|
|
17431
18877
|
_multiplexedId,
|
|
17432
18878
|
_labelId
|
|
@@ -17451,6 +18897,33 @@ const useLabelWorkflow = ({
|
|
|
17451
18897
|
shipmentId
|
|
17452
18898
|
};
|
|
17453
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
|
+
*/
|
|
17454
18927
|
const Element = (
|
|
17455
18928
|
/*
|
|
17456
18929
|
The passed props are underscore prefixed as they will be stashed, then from them stateful versions will be made
|
|
@@ -17520,6 +18993,7 @@ The passed props are underscore prefixed as they will be stashed, then from them
|
|
|
17520
18993
|
|
|
17521
18994
|
var labelWorkflow = /*#__PURE__*/Object.freeze({
|
|
17522
18995
|
__proto__: null,
|
|
18996
|
+
useLabelWorkflow: useLabelWorkflow,
|
|
17523
18997
|
Element: Element
|
|
17524
18998
|
});
|
|
17525
18999
|
|
|
@@ -17566,7 +19040,10 @@ exports.VoidLabel = voidLabel;
|
|
|
17566
19040
|
exports.autoFundingSchema = autoFundingSchema;
|
|
17567
19041
|
exports.calculateTotal = calculateTotal;
|
|
17568
19042
|
exports.capitalizeFirstLetter = capitalizeFirstLetter;
|
|
19043
|
+
exports.convertDecimalWeightToFractionalWeight = convertDecimalWeightToFractionalWeight;
|
|
17569
19044
|
exports.convertDimensions = convertDimensions;
|
|
19045
|
+
exports.convertFractionalWeightToDecimalWeight = convertFractionalWeightToDecimalWeight;
|
|
19046
|
+
exports.convertPoundsAndOuncesToOunces = convertPoundsAndOuncesToOunces;
|
|
17570
19047
|
exports.convertWeight = convertWeight;
|
|
17571
19048
|
exports.countries = countries;
|
|
17572
19049
|
exports.countryCodes = countryCodes;
|
|
@@ -17579,10 +19056,12 @@ exports.errorMap = errorMap;
|
|
|
17579
19056
|
exports.euCountryCodes = euCountryCodes;
|
|
17580
19057
|
exports.extendZod = extendZod;
|
|
17581
19058
|
exports.featureFlagComponentNameLookup = featureFlagComponentNameLookup;
|
|
19059
|
+
exports.featureFlags = featureFlags;
|
|
17582
19060
|
exports.formLogger = formLogger;
|
|
17583
19061
|
exports.formatCreditCardNumber = formatCreditCardNumber;
|
|
17584
19062
|
exports.formatDate = formatDate;
|
|
17585
19063
|
exports.formatDateDDMMYY = formatDateDDMMYY;
|
|
19064
|
+
exports.formatDimensions = formatDimensions;
|
|
17586
19065
|
exports.formatExpiration = formatExpiration;
|
|
17587
19066
|
exports.formatFractionalWeight = formatFractionalWeight;
|
|
17588
19067
|
exports.formatMoney = formatMoney;
|
|
@@ -17600,9 +19079,11 @@ exports.getRelativeDates = getRelativeDates;
|
|
|
17600
19079
|
exports.getRequestedServices = getRequestedServices;
|
|
17601
19080
|
exports.getSalesOrderItemsFromSalesOrderOrShipment = getSalesOrderItemsFromSalesOrderOrShipment;
|
|
17602
19081
|
exports.getTotalRateAmount = getTotalRateAmount;
|
|
19082
|
+
exports.isDecimalWeight = isDecimalWeight;
|
|
17603
19083
|
exports.isDomesticAddress = isDomesticAddress;
|
|
17604
19084
|
exports.isEmptyAddress = isEmptyAddress;
|
|
17605
19085
|
exports.isFlatRatePackageCode = isFlatRatePackageCode;
|
|
19086
|
+
exports.isMetricWeightUnit = isMetricWeightUnit;
|
|
17606
19087
|
exports.isMilitaryAddress = isMilitaryAddress;
|
|
17607
19088
|
exports.isNowOrInTheFuture = isNowOrInTheFuture;
|
|
17608
19089
|
exports.isPoBox = isPoBox;
|
|
@@ -17643,6 +19124,7 @@ exports.usePageLayout = usePageLayout;
|
|
|
17643
19124
|
exports.useRateOptions = useRateOptions;
|
|
17644
19125
|
exports.useRootPortal = useRootPortal;
|
|
17645
19126
|
exports.useRunOnceOnTrue = useRunOnceOnTrue;
|
|
19127
|
+
exports.useScrubErrors = useScrubErrors;
|
|
17646
19128
|
exports.useServiceCodeOptions = useServiceCodeOptions;
|
|
17647
19129
|
exports.useShipmentMetadata = useShipmentMetadata;
|
|
17648
19130
|
exports.useShippingPresetsOptions = useShippingPresetsOptions;
|