@shipengine/elements 0.34.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1819 -381
- package/index.js +1812 -382
- package/package.json +1 -1
- package/src/components/add-funds-form/add-funds-form.d.ts +20 -2
- package/src/components/add-funds-form/add-funds-schema.d.ts +26 -0
- package/src/components/address-preference-context/address-preference-context.d.ts +8 -0
- package/src/components/auto-funding-form/auto-funding-form.d.ts +22 -0
- package/src/components/auto-funding-form/auto-funding-schema.d.ts +17 -0
- package/src/components/button-group/button-group.d.ts +29 -0
- package/src/components/carrier-balance/carrier-balance.d.ts +23 -0
- package/src/components/collapsible-panel/collapsible-panel.d.ts +32 -0
- package/src/components/copy/copy-button.d.ts +4 -0
- package/src/components/cube/cube.d.ts +16 -0
- package/src/components/date-range-combo/date-range-combo.d.ts +14 -0
- package/src/components/date-range-select/date-range-select.d.ts +6 -0
- package/src/components/error-fallback/error-fallback.d.ts +12 -1
- package/src/components/field-label/field-label.d.ts +10 -0
- package/src/components/form-portal/form-portal.d.ts +9 -0
- package/src/components/fund-and-purchase/fund-and-purchase.d.ts +13 -0
- package/src/components/inline-label/inline-label.d.ts +10 -0
- package/src/components/items-breakdown/items-breakdown.d.ts +15 -0
- package/src/components/label-layout/label-layout.d.ts +5 -0
- package/src/components/link-action/link-action.d.ts +10 -0
- package/src/components/loader/loader.d.ts +5 -0
- package/src/components/manage-funding/manage-funding.d.ts +26 -0
- package/src/components/payment-method-settings/payment-method-settings.d.ts +19 -0
- package/src/components/portal/portal.d.ts +10 -1
- package/src/components/powered-by-shipengine/powered-by-shipengine.d.ts +8 -0
- package/src/components/section/section.d.ts +10 -0
- package/src/components/spacer/spacer.d.ts +30 -0
- package/src/components/spread/spread.d.ts +10 -0
- package/src/components/story-notes/story-notes.d.ts +10 -1
- package/src/components/templates/rate-form/rate-form.d.ts +2 -2
- package/src/components/templates/shipment-form/shipment-form.d.ts +2 -1
- package/src/components/templates/shipment-form/shipment-schema.d.ts +179 -17
- package/src/components/unit-settings/unit-settings.d.ts +5 -0
- package/src/constants/shipengine/address.d.ts +75 -0
- package/src/elements/account-settings/account-settings.d.ts +136 -1
- package/src/elements/configure-shipment/configure-shipment.d.ts +1 -0
- package/src/elements/configure-shipment/hooks/use-rates-form.d.ts +2 -2
- package/src/elements/configure-shipment/hooks/use-rates-with-cache.d.ts +1 -1
- package/src/elements/configure-shipment/hooks/use-request-rates.d.ts +1 -1
- package/src/elements/configure-shipment/hooks/use-shipment-form.d.ts +1 -0
- package/src/elements/list-carriers/list-carriers.d.ts +31 -0
- package/src/elements/manage-warehouses/manage-warehouses.d.ts +34 -0
- package/src/elements/onboarding/onboarding.d.ts +93 -2
- package/src/elements/purchase-label/purchase-label.d.ts +191 -7
- package/src/elements/shipengine-workflow/label-workflow.d.ts +138 -2
- package/src/elements/view-shipment/view-shipment.d.ts +128 -2
- package/src/elements/void-label/void-label.d.ts +134 -3
- package/src/extensions/zod.d.ts +5 -0
- package/src/factories/shipengine/package.d.ts +11 -0
- package/src/features/wallet-history/wallet-history.d.ts +5 -0
- package/src/hooks/index.d.ts +1 -0
- package/src/hooks/options/use-confirmation-options.d.ts +7 -0
- package/src/hooks/options/use-country-code-options.d.ts +16 -3
- package/src/hooks/options/use-customs-contents-options.d.ts +7 -0
- package/src/hooks/options/use-customs-non-delivery-options.d.ts +7 -0
- package/src/hooks/options/use-date-range-options.d.ts +22 -1
- package/src/hooks/options/use-expiration-month-options.d.ts +7 -0
- package/src/hooks/options/use-insurance-provider-options.d.ts +7 -0
- package/src/hooks/options/use-package-options.d.ts +7 -0
- package/src/hooks/options/use-rate-options.d.ts +11 -1
- package/src/hooks/options/use-service-code-options.d.ts +7 -0
- package/src/hooks/options/use-shipment-metadata.d.ts +8 -0
- package/src/hooks/options/use-shipping-presets-options.d.ts +10 -0
- package/src/hooks/options/use-state-code-options.d.ts +7 -0
- package/src/hooks/options/use-warehouse-options.d.ts +7 -0
- package/src/hooks/use-address-validation.d.ts +7 -0
- package/src/hooks/use-black-box-detection.d.ts +17 -1
- package/src/hooks/use-carrier-metadata.d.ts +7 -0
- package/src/hooks/use-nested-form.d.ts +9 -0
- package/src/hooks/use-page-layout.d.ts +25 -1
- package/src/hooks/use-root-portal.d.ts +15 -2
- package/src/hooks/use-run-once-on-true.d.ts +5 -1
- package/src/hooks/use-scrub-errors.d.ts +6 -3
- package/src/hooks/use-toggle.d.ts +5 -1
- package/src/locales/en/index.d.ts +8 -1
- package/src/schemas/shipengine/money.d.ts +4 -0
- package/src/schemas/shipengine/phone.d.ts +8 -0
- package/src/types/carrier-metadata.d.ts +20 -0
- package/src/utilities/create-dictionary.d.ts +4 -0
- package/src/utilities/date.d.ts +51 -2
- package/src/utilities/error.d.ts +16 -2
- package/src/utilities/feature-flags.d.ts +181 -0
- package/src/utilities/form-logger.d.ts +4 -0
- package/src/utilities/index.d.ts +1 -1
- package/src/utilities/money.d.ts +25 -0
- package/src/utilities/predicates/isString.d.ts +7 -0
- package/src/utilities/rates.d.ts +22 -1
- package/src/utilities/shipengine/address.d.ts +31 -0
- package/src/utilities/shipengine/carrier.d.ts +21 -0
- package/src/utilities/shipengine/dimensions.d.ts +27 -4
- package/src/utilities/shipengine/package.d.ts +4 -0
- package/src/utilities/shipengine/sales-order.d.ts +26 -0
- package/src/utilities/shipengine/shipment.d.ts +12 -0
- package/src/utilities/shipengine/weight.d.ts +92 -2
- package/src/utilities/string.d.ts +7 -0
- package/src/utilities/styles.d.ts +4 -0
- package/src/utilities/validation.d.ts +8 -0
package/index.js
CHANGED
|
@@ -3,9 +3,9 @@ import { useTranslation, Trans } from 'react-i18next';
|
|
|
3
3
|
import { InlineNotification, NotificationType, Typography, Link, ButtonSize, Spinner, Icon, IconSize, Divider, Skeleton, SkeletonAnimation, SkeletonVariant, Grid, GridChild, Pagination, SkeletonBackgroundColor, RadioGroup, Radio, SpinnerSize, FormField, FieldMessageType, Checkbox, Input, SelectAutocomplete, Select as Select$1, OptionGroup, Option, Button, Switch as Switch$1, Textarea, ChipList, Chip, ButtonVariant, ButtonColor, Tag, TagColor, Stepper, Step, IconTooltip, Table, TableBody, TableBaseRow, TableBodyCell, TableHeader, TableHeaderCell, Popover, DropdownOptionList, DatePicker as DatePicker$1, BottomSheet } from '@packlink/giger';
|
|
4
4
|
import alchemy, { SE, logger, useValidateAddresses, useListCarriers, useConnectCarrier, useListWarehouses, useUpdateWarehouse, useCreateWarehouse, useDeleteWarehouse, useGetWalletHistory, useGetAccountSettings, useUpdateAccountSettings, AlchemyContext, useAddFunds, useGetCarrierById, useUpdateAutoFunding, useGetAutoFundingConfiguration, Currency, useUpdateFundingSource, useListFundingSources, useCreateFundingSource, useRegisterCarrier, useUpdateSalesOrderShipment, useParseAddress, useListCustomPackageTypes, useCalculateRates, useGetShipmentRates, useListLabels, useCreateLabel, useListSalesOrderShipments, useCreateSalesOrderShipment, useListSalesOrders, useGetSalesOrder, useListOrderSources, useRefreshOrderSource, useCreateShipment, useGetShipment, useGetSalesOrderShipment, useGetLabel, useVoidLabel } from '@shipengine/alchemy';
|
|
5
5
|
import axios from 'axios';
|
|
6
|
+
import _$3, { get as get$1, isEqual } from 'lodash';
|
|
6
7
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
7
8
|
import { z } from 'zod';
|
|
8
|
-
import _$3, { get as get$1, isEqual } from 'lodash';
|
|
9
9
|
import { encode } from 'js-base64';
|
|
10
10
|
import * as React from 'react';
|
|
11
11
|
import { useMemo, createContext, useState, useContext, useReducer, useCallback, createElement as createElement$2, useRef, useEffect, forwardRef, memo, Fragment as Fragment$1 } from 'react';
|
|
@@ -1986,6 +1986,13 @@ var addToUnscopables = addToUnscopables$3;
|
|
|
1986
1986
|
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
1987
1987
|
addToUnscopables('flatMap');
|
|
1988
1988
|
|
|
1989
|
+
/**
|
|
1990
|
+
* @internal
|
|
1991
|
+
*
|
|
1992
|
+
* # Delivery Confirmation Options Hook
|
|
1993
|
+
*
|
|
1994
|
+
* @category Hooks
|
|
1995
|
+
*/
|
|
1989
1996
|
const useConfirmationOptions = () => {
|
|
1990
1997
|
const {
|
|
1991
1998
|
t
|
|
@@ -2007,6 +2014,11 @@ const hasEuCustomsRules = true,
|
|
|
2007
2014
|
isUnitedStatesTerritory$1 = true,
|
|
2008
2015
|
isUnsupportedByUps$1 = true,
|
|
2009
2016
|
supportsByoa = true;
|
|
2017
|
+
/**
|
|
2018
|
+
* @internal
|
|
2019
|
+
*
|
|
2020
|
+
* # Address Utils - Country Type
|
|
2021
|
+
*/
|
|
2010
2022
|
class Country {
|
|
2011
2023
|
constructor(name, code, rules = {}) {
|
|
2012
2024
|
var _a, _b, _c, _d, _e;
|
|
@@ -2019,6 +2031,11 @@ class Country {
|
|
|
2019
2031
|
this.isUnsupportedByUps = (_e = rules.isUnsupportedByUps) !== null && _e !== void 0 ? _e : false;
|
|
2020
2032
|
}
|
|
2021
2033
|
}
|
|
2034
|
+
/**
|
|
2035
|
+
* @internal
|
|
2036
|
+
*
|
|
2037
|
+
* # Address Utils - Array of Countries and their codes
|
|
2038
|
+
*/
|
|
2022
2039
|
const countries = [new Country("Afghanistan", "AF"), new Country("Aland Islands", "AX"), new Country("Albania", "AL"), new Country("Algeria", "DZ"), new Country("American Samoa", "AS", {
|
|
2023
2040
|
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2024
2041
|
}), new Country("Andorra", "AD"), new Country("Angola", "AO"), new Country("Anguilla", "AI"), new Country("Antarctica", "AQ"), new Country("Antigua Barbuda", "AG"), new Country("Argentina", "AR"), new Country("Armenia", "AM"), new Country("Aruba", "AW"), new Country("Australia", "AU", {
|
|
@@ -2147,11 +2164,31 @@ new Country("Puerto Rico", "PR", {
|
|
|
2147
2164
|
hasProvinces,
|
|
2148
2165
|
supportsByoa
|
|
2149
2166
|
}), new Country("Uruguay", "UY"), new Country("Uzbekistan", "UZ"), new Country("Vanuatu", "VU"), new Country("Venezuela", "VE"), new Country("Vietnam", "VN"), new Country("Wallis and Futuna Islands", "WF"), new Country("Western Sahara", "EH"), new Country("Yemen", "YE"), new Country("Zambia", "ZM"), new Country("Zimbabwe", "ZW")];
|
|
2167
|
+
/**
|
|
2168
|
+
* @internal
|
|
2169
|
+
*
|
|
2170
|
+
* # Address Utils - Map of Country Codes
|
|
2171
|
+
*/
|
|
2150
2172
|
const countryCodes = countries.map(c => c.code);
|
|
2173
|
+
/**
|
|
2174
|
+
* @internal
|
|
2175
|
+
*
|
|
2176
|
+
* # Address Utils - EU Country Codes
|
|
2177
|
+
*/
|
|
2151
2178
|
const euCountryCodes = countries.filter(c => c.hasEuCustomsRules).map(c => c.code);
|
|
2152
2179
|
// #endregion
|
|
2153
2180
|
// #region [ rgba(0,0,0,0) ] Postal Codes
|
|
2181
|
+
/**
|
|
2182
|
+
* @internal
|
|
2183
|
+
*
|
|
2184
|
+
* # Address Utils - Postal Code Regex
|
|
2185
|
+
*/
|
|
2154
2186
|
const postalCodeRegex$3 = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
|
|
2187
|
+
/**
|
|
2188
|
+
* @internal
|
|
2189
|
+
*
|
|
2190
|
+
* # Address Utils - US State Type
|
|
2191
|
+
*/
|
|
2155
2192
|
class UsState {
|
|
2156
2193
|
constructor(name, code, rules = {}) {
|
|
2157
2194
|
var _a, _b;
|
|
@@ -2161,6 +2198,11 @@ class UsState {
|
|
|
2161
2198
|
this.isUnitedStatesTerritory = (_b = rules.isUnitedStatesTerritory) !== null && _b !== void 0 ? _b : false;
|
|
2162
2199
|
}
|
|
2163
2200
|
}
|
|
2201
|
+
/**
|
|
2202
|
+
* @internal
|
|
2203
|
+
*
|
|
2204
|
+
* # Address Utils - Array US States and their codes
|
|
2205
|
+
*/
|
|
2164
2206
|
const usStates = [new UsState("Alabama", "AL"), new UsState("Alaska", "AK"), new UsState("American Samoa", "AS", {
|
|
2165
2207
|
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2166
2208
|
}), new UsState("Arizona", "AZ"), new UsState("Arkansas", "AR"), new UsState("Armed Forces Americas", "AA", {
|
|
@@ -2180,7 +2222,17 @@ const usStates = [new UsState("Alabama", "AL"), new UsState("Alaska", "AK"), new
|
|
|
2180
2222
|
}), new UsState("U.S. Minor Outlying Islands", "UM", {
|
|
2181
2223
|
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2182
2224
|
})];
|
|
2225
|
+
/**
|
|
2226
|
+
* @internal
|
|
2227
|
+
*
|
|
2228
|
+
* # Address Utils - Map of US State Codes
|
|
2229
|
+
*/
|
|
2183
2230
|
const usStateCodes = usStates.map(item => item.code);
|
|
2231
|
+
/**
|
|
2232
|
+
* @internal
|
|
2233
|
+
*
|
|
2234
|
+
* # Address Utils - USA City Type
|
|
2235
|
+
*/
|
|
2184
2236
|
class UsaCity {
|
|
2185
2237
|
constructor(name, code, rules = {}) {
|
|
2186
2238
|
var _a;
|
|
@@ -2189,6 +2241,11 @@ class UsaCity {
|
|
|
2189
2241
|
this.isMilitary = (_a = rules.isMilitary) !== null && _a !== void 0 ? _a : false;
|
|
2190
2242
|
}
|
|
2191
2243
|
}
|
|
2244
|
+
/**
|
|
2245
|
+
* @internal
|
|
2246
|
+
*
|
|
2247
|
+
* # Address Utils - US Cities
|
|
2248
|
+
*/
|
|
2192
2249
|
const usCities = [new UsaCity("Army Post Office", "APO", {
|
|
2193
2250
|
isMilitary
|
|
2194
2251
|
}), new UsaCity("Diplomatic Post Office", "DPO", {
|
|
@@ -2198,11 +2255,36 @@ const usCities = [new UsaCity("Army Post Office", "APO", {
|
|
|
2198
2255
|
})];
|
|
2199
2256
|
// #endregion
|
|
2200
2257
|
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2258
|
+
/**
|
|
2259
|
+
* @internal
|
|
2260
|
+
*
|
|
2261
|
+
* # Country Code Options Hook
|
|
2262
|
+
*
|
|
2263
|
+
* @category Hooks
|
|
2264
|
+
*/
|
|
2265
|
+
const useCountryCodeOptions = domestic => {
|
|
2266
|
+
const countryCodeOptions = useMemo(() => countries.flatMap(v => domestic && v.code !== "US" && !v.isUnitedStatesTerritory ? [] : {
|
|
2267
|
+
label: v.name,
|
|
2268
|
+
value: v.code
|
|
2269
|
+
}), [domestic]);
|
|
2270
|
+
const defaultCountryCodeOption = useMemo(() => {
|
|
2271
|
+
const defaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
|
|
2272
|
+
const defaultCountryCode = defaultLocale.split("-")[1];
|
|
2273
|
+
return countryCodeOptions.find(option => option.value === defaultCountryCode);
|
|
2274
|
+
}, [countryCodeOptions]);
|
|
2275
|
+
return {
|
|
2276
|
+
countryCodeOptions,
|
|
2277
|
+
defaultCountryCodeOption
|
|
2278
|
+
};
|
|
2279
|
+
};
|
|
2205
2280
|
|
|
2281
|
+
/**
|
|
2282
|
+
* @internal
|
|
2283
|
+
*
|
|
2284
|
+
* # Customs Contents Options Hook
|
|
2285
|
+
*
|
|
2286
|
+
* @category Hooks
|
|
2287
|
+
*/
|
|
2206
2288
|
const useCustomsContentsOptions = () => {
|
|
2207
2289
|
const {
|
|
2208
2290
|
t
|
|
@@ -2213,6 +2295,13 @@ const useCustomsContentsOptions = () => {
|
|
|
2213
2295
|
})), [t]);
|
|
2214
2296
|
};
|
|
2215
2297
|
|
|
2298
|
+
/**
|
|
2299
|
+
* @internal
|
|
2300
|
+
*
|
|
2301
|
+
* # Customs Non-Delivery Options Hooks
|
|
2302
|
+
*
|
|
2303
|
+
* @category Hooks
|
|
2304
|
+
*/
|
|
2216
2305
|
const useCustomsNonDeliveryOptions = () => {
|
|
2217
2306
|
const {
|
|
2218
2307
|
t
|
|
@@ -2302,6 +2391,10 @@ $$f({ target: 'Array', proto: true, forced: !STRICT_METHOD$1 || CHROME_BUG }, {
|
|
|
2302
2391
|
});
|
|
2303
2392
|
|
|
2304
2393
|
/**
|
|
2394
|
+
* @internal
|
|
2395
|
+
*
|
|
2396
|
+
* # Create Dictionary Utility Function
|
|
2397
|
+
*
|
|
2305
2398
|
* @category Utilities
|
|
2306
2399
|
*/
|
|
2307
2400
|
const createDictionary = (items, getEntry) => {
|
|
@@ -2310,6 +2403,10 @@ const createDictionary = (items, getEntry) => {
|
|
|
2310
2403
|
};
|
|
2311
2404
|
|
|
2312
2405
|
/**
|
|
2406
|
+
* @internal
|
|
2407
|
+
*
|
|
2408
|
+
* # Date Utils - getDaysInMonth
|
|
2409
|
+
*
|
|
2313
2410
|
* @category Utilities
|
|
2314
2411
|
*/
|
|
2315
2412
|
const formatDate = (date, locale = "en-US") => new Date(date).toLocaleDateString(locale, {
|
|
@@ -2318,6 +2415,10 @@ const formatDate = (date, locale = "en-US") => new Date(date).toLocaleDateString
|
|
|
2318
2415
|
year: "numeric"
|
|
2319
2416
|
});
|
|
2320
2417
|
/**
|
|
2418
|
+
* @internal
|
|
2419
|
+
*
|
|
2420
|
+
* # Date Utils - formatDateDDMMYY
|
|
2421
|
+
*
|
|
2321
2422
|
* @category Utilities
|
|
2322
2423
|
*/
|
|
2323
2424
|
const formatDateDDMMYY = (date, locale = "en-US") => new Date(date).toLocaleDateString(locale, {
|
|
@@ -2326,6 +2427,10 @@ const formatDateDDMMYY = (date, locale = "en-US") => new Date(date).toLocaleDate
|
|
|
2326
2427
|
year: "2-digit"
|
|
2327
2428
|
});
|
|
2328
2429
|
/**
|
|
2430
|
+
* @internal
|
|
2431
|
+
*
|
|
2432
|
+
* # Date Utils - getDaysInMonth
|
|
2433
|
+
*
|
|
2329
2434
|
* @category Utilities
|
|
2330
2435
|
*/
|
|
2331
2436
|
const daysAfter = (days, date = new Date()) => {
|
|
@@ -2334,14 +2439,26 @@ const daysAfter = (days, date = new Date()) => {
|
|
|
2334
2439
|
return date;
|
|
2335
2440
|
};
|
|
2336
2441
|
/**
|
|
2442
|
+
* @internal
|
|
2443
|
+
*
|
|
2444
|
+
* # Date Utils - getDaysInMonth
|
|
2445
|
+
*
|
|
2337
2446
|
* @category Utilities
|
|
2338
2447
|
*/
|
|
2339
2448
|
const nextDayCutoff = (cutoff, date = new Date()) => date.getHours() >= cutoff ? daysAfter(1, new Date(date)) : new Date(date);
|
|
2340
2449
|
/**
|
|
2450
|
+
* @internal
|
|
2451
|
+
*
|
|
2452
|
+
* # Date Utils - getDaysInMonth
|
|
2453
|
+
*
|
|
2341
2454
|
* @category Utilities
|
|
2342
2455
|
*/
|
|
2343
2456
|
const mostRecent = (...dates) => new Date(Math.max(...dates.map(Number)));
|
|
2344
2457
|
/**
|
|
2458
|
+
* @internal
|
|
2459
|
+
*
|
|
2460
|
+
* # Date Utils - getDaysInMonth
|
|
2461
|
+
*
|
|
2345
2462
|
* @category Utilities
|
|
2346
2463
|
*/
|
|
2347
2464
|
const omitTime = shipDate => {
|
|
@@ -2349,6 +2466,10 @@ const omitTime = shipDate => {
|
|
|
2349
2466
|
return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
|
|
2350
2467
|
};
|
|
2351
2468
|
/**
|
|
2469
|
+
* @internal
|
|
2470
|
+
*
|
|
2471
|
+
* # Date Utils - getExpirationYears
|
|
2472
|
+
*
|
|
2352
2473
|
* @category Utilities
|
|
2353
2474
|
*/
|
|
2354
2475
|
const getExpirationYears = yearsValid => {
|
|
@@ -2359,17 +2480,35 @@ const getExpirationYears = yearsValid => {
|
|
|
2359
2480
|
}
|
|
2360
2481
|
return years;
|
|
2361
2482
|
};
|
|
2483
|
+
/**
|
|
2484
|
+
* @internal
|
|
2485
|
+
*
|
|
2486
|
+
* # Date Utilities - sortByCreationDate
|
|
2487
|
+
*
|
|
2488
|
+
* @category Utilities
|
|
2489
|
+
*/
|
|
2362
2490
|
const sortByCreationDate = (a, b, order = "desc") => {
|
|
2363
2491
|
const [x, y] = order === "asc" ? [a, b] : [b, a];
|
|
2364
2492
|
return new Date(x.createdAt).getTime() - new Date(y.createdAt).getTime();
|
|
2365
2493
|
};
|
|
2366
2494
|
/**
|
|
2495
|
+
* @internal
|
|
2496
|
+
*
|
|
2497
|
+
* # Date Utilities - isNowOrInTheFuture
|
|
2498
|
+
*
|
|
2367
2499
|
* @category Utilities
|
|
2368
2500
|
*/
|
|
2369
2501
|
const isNowOrInTheFuture = shipDate => {
|
|
2370
2502
|
if (shipDate) return new Date(shipDate) >= new Date();
|
|
2371
2503
|
return false;
|
|
2372
2504
|
};
|
|
2505
|
+
/**
|
|
2506
|
+
* @internal
|
|
2507
|
+
*
|
|
2508
|
+
* # Date Utilities - getRelativeDates
|
|
2509
|
+
*
|
|
2510
|
+
* @category Utilities
|
|
2511
|
+
*/
|
|
2373
2512
|
const getRelativeDates = from => {
|
|
2374
2513
|
const origin = from !== null && from !== void 0 ? from : new Date();
|
|
2375
2514
|
return {
|
|
@@ -2383,6 +2522,12 @@ const getRelativeDates = from => {
|
|
|
2383
2522
|
};
|
|
2384
2523
|
|
|
2385
2524
|
/**
|
|
2525
|
+
* @internal
|
|
2526
|
+
*
|
|
2527
|
+
* # Create Coded Errors Utlity Function
|
|
2528
|
+
*
|
|
2529
|
+
* - This function extracts errors from our `Axios Responses`.
|
|
2530
|
+
*
|
|
2386
2531
|
* @category Utilities
|
|
2387
2532
|
*/
|
|
2388
2533
|
const createCodedErrors = err => {
|
|
@@ -2398,19 +2543,229 @@ const createCodedErrors = err => {
|
|
|
2398
2543
|
}];
|
|
2399
2544
|
};
|
|
2400
2545
|
/**
|
|
2401
|
-
*
|
|
2546
|
+
* @internal
|
|
2547
|
+
*
|
|
2548
|
+
* - Joins a list of error-like object's messages and throws them as a single error.
|
|
2549
|
+
*
|
|
2550
|
+
* @category Utilities
|
|
2402
2551
|
*/
|
|
2403
2552
|
function throwJoinedMessages(errors) {
|
|
2404
2553
|
throw new Error(errors.map(e => e.message).join(", "));
|
|
2405
2554
|
}
|
|
2406
2555
|
/**
|
|
2407
|
-
*
|
|
2556
|
+
* @internal
|
|
2557
|
+
*
|
|
2558
|
+
* - If any CodedErrors exist, throw them all as a single error, otherwise assert errors is null.
|
|
2559
|
+
*
|
|
2560
|
+
* @category Utilities
|
|
2408
2561
|
*/
|
|
2409
2562
|
function throwAny(errors) {
|
|
2410
2563
|
if (errors) throwJoinedMessages(errors);
|
|
2411
2564
|
}
|
|
2412
2565
|
|
|
2413
2566
|
/**
|
|
2567
|
+
* @namespace featureFlags
|
|
2568
|
+
*
|
|
2569
|
+
* - The `featureFlags` namespace contains all the feature flags available throughout the
|
|
2570
|
+
* application. All features are scoped by name to the component they are intended for.
|
|
2571
|
+
*
|
|
2572
|
+
* @example
|
|
2573
|
+
* ```tsx
|
|
2574
|
+
* export const featureFlags = {
|
|
2575
|
+
* ConfigureSalesOrderShipment: {
|
|
2576
|
+
* compatibleCountryCodes: ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"],
|
|
2577
|
+
* rateForm: {
|
|
2578
|
+
* enableFunding: false,
|
|
2579
|
+
* enableGlobalPostFiltering: false,
|
|
2580
|
+
* labelLayout: false,
|
|
2581
|
+
* nicknameRate: true,
|
|
2582
|
+
* saveRate: true,
|
|
2583
|
+
* },
|
|
2584
|
+
* shipmentForm: {
|
|
2585
|
+
* browseRates: true,
|
|
2586
|
+
* includeShipsuranceInsurance: true,
|
|
2587
|
+
* includeThirdPartyInsurance: true,
|
|
2588
|
+
* selectService: true,
|
|
2589
|
+
* shippingPresets: false,
|
|
2590
|
+
* },
|
|
2591
|
+
* },
|
|
2592
|
+
* Global: {
|
|
2593
|
+
* carriers: {
|
|
2594
|
+
* enabledCarriers: ["stamps_com", "ups", "dhl_express_walleted"],
|
|
2595
|
+
* },
|
|
2596
|
+
* presentation: {
|
|
2597
|
+
* poweredByShipEngine: false,
|
|
2598
|
+
* },
|
|
2599
|
+
* },
|
|
2600
|
+
* ViewShipment: {
|
|
2601
|
+
* shipment: {
|
|
2602
|
+
* schedulePickup: true,
|
|
2603
|
+
* },
|
|
2604
|
+
* },
|
|
2605
|
+
* } as const;
|
|
2606
|
+
* ```
|
|
2607
|
+
*/
|
|
2608
|
+
const featureFlags = {
|
|
2609
|
+
/**
|
|
2610
|
+
* `ConfigureSalesOrderShipment` all scoped feature flags for the shipment configuration
|
|
2611
|
+
* section of the `<PurchaseLabel />` element.
|
|
2612
|
+
*/
|
|
2613
|
+
ConfigureSalesOrderShipment: {
|
|
2614
|
+
/**
|
|
2615
|
+
* `compatibleCountryCodes` is a list of all supported `countries` available in ShipEngine
|
|
2616
|
+
* Elements.
|
|
2617
|
+
*/
|
|
2618
|
+
compatibleCountryCodes: ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"],
|
|
2619
|
+
/**
|
|
2620
|
+
* `rateForm` all scoped feature flags for the `rate form` section of the `<PurchaseLabel />`
|
|
2621
|
+
* element.
|
|
2622
|
+
*/
|
|
2623
|
+
rateForm: {
|
|
2624
|
+
/**
|
|
2625
|
+
* `enableFunding` enables the `funding` section of the rate form.
|
|
2626
|
+
*/
|
|
2627
|
+
enableFunding: false,
|
|
2628
|
+
/**
|
|
2629
|
+
* `enableGlobalPostFiltering` enables the `global post filtering` on all rates fetched
|
|
2630
|
+
* in the rates form.
|
|
2631
|
+
*/
|
|
2632
|
+
enableGlobalPostFiltering: false,
|
|
2633
|
+
/**
|
|
2634
|
+
* `labelLayout` enables the `label layout` section of the `<PurchaseLabel /> element.
|
|
2635
|
+
*/
|
|
2636
|
+
labelLayout: false,
|
|
2637
|
+
/**
|
|
2638
|
+
* `nicknameRate` enables showing the `carrier nickname` when rates are fetched.
|
|
2639
|
+
*/
|
|
2640
|
+
nicknameRate: true,
|
|
2641
|
+
requireDhlTermsAcknowledgement: false,
|
|
2642
|
+
/**
|
|
2643
|
+
* `saveRate` enables the `save rate` button in the rate form. This allows users to save a
|
|
2644
|
+
* `rateId` for a shipment to be purchased later.
|
|
2645
|
+
*/
|
|
2646
|
+
saveRate: true
|
|
2647
|
+
},
|
|
2648
|
+
/**
|
|
2649
|
+
* `shipmentForm` all scoped feature flags for the `shipment form` section of the
|
|
2650
|
+
* `<PurchaseLabel />` element.
|
|
2651
|
+
*/
|
|
2652
|
+
shipmentForm: {
|
|
2653
|
+
/**
|
|
2654
|
+
* `browseRates` enables the `browse rates` button in the shipment form. This allows users
|
|
2655
|
+
* to browse rates for a shipment with varying shipment configurations. This is useful for
|
|
2656
|
+
* rate shopping.
|
|
2657
|
+
*/
|
|
2658
|
+
browseRates: true,
|
|
2659
|
+
/**
|
|
2660
|
+
* `includeShipsuranceInsurance` enables the `shipsurance insurance` feature, allowing users
|
|
2661
|
+
* to select Shipsurance when insuring their shipment.
|
|
2662
|
+
*/
|
|
2663
|
+
includeShipsuranceInsurance: true,
|
|
2664
|
+
/**
|
|
2665
|
+
* `includeThirdPartyInsurance` enables the `third party insurance` feature, allowing users
|
|
2666
|
+
* to opt for third party insurance when insuring their shipment.
|
|
2667
|
+
*/
|
|
2668
|
+
includeThirdPartyInsurance: true,
|
|
2669
|
+
/**
|
|
2670
|
+
* `selectService` enables the `select service` feature, allowing users to select a service
|
|
2671
|
+
* when rate shopping across multiple carrier providers.
|
|
2672
|
+
*/
|
|
2673
|
+
selectService: true,
|
|
2674
|
+
/**
|
|
2675
|
+
* `shippingPresets` enables the `shipping presets` feature, allowing users to pass in a set
|
|
2676
|
+
* of shipping presets they wish to use within the shipment form of the `<PurchaseLabel />`
|
|
2677
|
+
* element.
|
|
2678
|
+
*/
|
|
2679
|
+
shippingPresets: false
|
|
2680
|
+
}
|
|
2681
|
+
},
|
|
2682
|
+
/**
|
|
2683
|
+
* `Global` all feature flags that are intended for use anywhere in ShipEngine Elements.
|
|
2684
|
+
*/
|
|
2685
|
+
Global: {
|
|
2686
|
+
/**
|
|
2687
|
+
* All global `carrier` related feature flags.
|
|
2688
|
+
*/
|
|
2689
|
+
carriers: {
|
|
2690
|
+
/**
|
|
2691
|
+
* `enabledCarriers` is a list of all `carriers` that are enabled for use in ShipEngine
|
|
2692
|
+
* Elements.
|
|
2693
|
+
*/
|
|
2694
|
+
enabledCarriers: ["stamps_com", "ups", "dhl_express_walleted"]
|
|
2695
|
+
},
|
|
2696
|
+
/**
|
|
2697
|
+
* All global `presentation` related feature flags.
|
|
2698
|
+
*/
|
|
2699
|
+
presentation: {
|
|
2700
|
+
/**
|
|
2701
|
+
* `poweredByShipEngine` enables the `powered by ShipEngine` logo in the footer various
|
|
2702
|
+
* elements.
|
|
2703
|
+
*/
|
|
2704
|
+
poweredByShipEngine: false
|
|
2705
|
+
}
|
|
2706
|
+
},
|
|
2707
|
+
/**
|
|
2708
|
+
* `ViewShipment` all scoped feature flags for the `<ViewShipment />` element.
|
|
2709
|
+
*/
|
|
2710
|
+
ViewShipment: {
|
|
2711
|
+
/**
|
|
2712
|
+
* `shipment` all shipment related features available in the `<ViewShipment />` element.
|
|
2713
|
+
*/
|
|
2714
|
+
shipment: {
|
|
2715
|
+
/**
|
|
2716
|
+
* `schedulePickup` enables the `schedule pickup` button in the `<ViewShipment />` element,
|
|
2717
|
+
* allowing users to schedule pick-ups for their shipments.
|
|
2718
|
+
*/
|
|
2719
|
+
schedulePickup: true
|
|
2720
|
+
}
|
|
2721
|
+
}
|
|
2722
|
+
};
|
|
2723
|
+
/**
|
|
2724
|
+
* @internal
|
|
2725
|
+
*
|
|
2726
|
+
* # Feature Flags - featureFlagComponentNameLookup
|
|
2727
|
+
*/
|
|
2728
|
+
const featureFlagComponentNameLookup = componentName => {
|
|
2729
|
+
var _a;
|
|
2730
|
+
const lookup = {
|
|
2731
|
+
PurchaseLabel: "ConfigureSalesOrderShipment"
|
|
2732
|
+
};
|
|
2733
|
+
return (_a = lookup[componentName]) !== null && _a !== void 0 ? _a : "";
|
|
2734
|
+
};
|
|
2735
|
+
/**
|
|
2736
|
+
* @internal
|
|
2737
|
+
*
|
|
2738
|
+
* # Feature Flags - getFeatures
|
|
2739
|
+
*/
|
|
2740
|
+
const getFeatures = (...element) => {
|
|
2741
|
+
return element.map(feat => {
|
|
2742
|
+
var _a;
|
|
2743
|
+
return (_a = get$1(featureFlags, feat)) !== null && _a !== void 0 ? _a : {};
|
|
2744
|
+
}).reduce((acc, feat) => Object.assign(acc, feat), {});
|
|
2745
|
+
};
|
|
2746
|
+
/**
|
|
2747
|
+
* # Feature Flags - useFeatures
|
|
2748
|
+
*
|
|
2749
|
+
* - The `useFeatures` hook is used to retrieve the feature flags for a given component.
|
|
2750
|
+
*
|
|
2751
|
+
* @example
|
|
2752
|
+
* ```tsx
|
|
2753
|
+
* const features = useFeatures("Global");
|
|
2754
|
+
* ```
|
|
2755
|
+
*
|
|
2756
|
+
* <br />
|
|
2757
|
+
*
|
|
2758
|
+
* @see {@link featureFlags | All available `Feature Flags`}
|
|
2759
|
+
*/
|
|
2760
|
+
const useFeatures = (...element) => {
|
|
2761
|
+
return getFeatures(...element);
|
|
2762
|
+
};
|
|
2763
|
+
|
|
2764
|
+
/**
|
|
2765
|
+
* @internal
|
|
2766
|
+
*
|
|
2767
|
+
* # Form Logger
|
|
2768
|
+
*
|
|
2414
2769
|
* @description
|
|
2415
2770
|
* This will log the values that are submitted to the validation resolver
|
|
2416
2771
|
* (only REGISTERED form fields) and the results of that validation.
|
|
@@ -3041,6 +3396,11 @@ fixRegExpWellKnownSymbolLogic$1('replace', function (_, nativeReplace, maybeCall
|
|
|
3041
3396
|
];
|
|
3042
3397
|
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
|
|
3043
3398
|
|
|
3399
|
+
/**
|
|
3400
|
+
* @internal
|
|
3401
|
+
*
|
|
3402
|
+
* # Money Utils - currency Symbol
|
|
3403
|
+
*/
|
|
3044
3404
|
const currencySymbol = {
|
|
3045
3405
|
aud: "$",
|
|
3046
3406
|
cad: "$",
|
|
@@ -3049,6 +3409,11 @@ const currencySymbol = {
|
|
|
3049
3409
|
nzd: "$",
|
|
3050
3410
|
usd: "$"
|
|
3051
3411
|
};
|
|
3412
|
+
/**
|
|
3413
|
+
* @internal
|
|
3414
|
+
*
|
|
3415
|
+
* # Money Utils - formatMoney
|
|
3416
|
+
*/
|
|
3052
3417
|
const formatMoney = (value, locale = "en-US") => {
|
|
3053
3418
|
const currency = Intl.NumberFormat(locale, {
|
|
3054
3419
|
currency: value.currency,
|
|
@@ -3056,40 +3421,86 @@ const formatMoney = (value, locale = "en-US") => {
|
|
|
3056
3421
|
});
|
|
3057
3422
|
return currency.format(value.amount);
|
|
3058
3423
|
};
|
|
3424
|
+
/**
|
|
3425
|
+
* @internal
|
|
3426
|
+
*
|
|
3427
|
+
* # Money Utils - calculateTotal
|
|
3428
|
+
*/
|
|
3059
3429
|
const calculateTotal = (...values) => {
|
|
3060
3430
|
return values.reduce((total, value) => {
|
|
3061
3431
|
var _a;
|
|
3062
3432
|
return value ? total + ((_a = value.amount) !== null && _a !== void 0 ? _a : 0) : total;
|
|
3063
3433
|
}, 0);
|
|
3064
3434
|
};
|
|
3435
|
+
/**
|
|
3436
|
+
* @internal
|
|
3437
|
+
*
|
|
3438
|
+
* # Money Utils - formatCreditCardNumber
|
|
3439
|
+
*/
|
|
3065
3440
|
const formatCreditCardNumber = cc => [cc.substring(0, 4), cc.substring(4, 8), cc.substring(8, 12), cc.substring(12)].join(" ").trim();
|
|
3441
|
+
/**
|
|
3442
|
+
* @internal
|
|
3443
|
+
*
|
|
3444
|
+
* # Money Utils - formatExpiration
|
|
3445
|
+
*/
|
|
3066
3446
|
const formatExpiration = exp => {
|
|
3067
3447
|
const digits = exp.replace(/\//g, "");
|
|
3068
3448
|
if (digits.length > 2) return [digits.substring(0, 2), digits.substring(2, 6)].join("/").trim();
|
|
3069
3449
|
return digits;
|
|
3070
3450
|
};
|
|
3071
3451
|
|
|
3452
|
+
/**
|
|
3453
|
+
* @internal
|
|
3454
|
+
*
|
|
3455
|
+
* # String Predicate Utilities
|
|
3456
|
+
*
|
|
3457
|
+
* @category Utilities
|
|
3458
|
+
*/
|
|
3072
3459
|
const isString = x => typeof x === "string";
|
|
3073
3460
|
|
|
3074
|
-
|
|
3461
|
+
/**
|
|
3462
|
+
* @internal
|
|
3463
|
+
*
|
|
3464
|
+
* # Rates Utilities - getRateRequiresAcknowledgement
|
|
3465
|
+
*
|
|
3466
|
+
* @category Utilities
|
|
3467
|
+
*/
|
|
3468
|
+
const getRateRequiresAcknowledgement = (serviceCode, packageType, requireDhlTermsAcknowledgement) => {
|
|
3075
3469
|
switch (serviceCode) {
|
|
3076
3470
|
case "usps_media_mail":
|
|
3077
3471
|
return true;
|
|
3078
3472
|
case "usps_first_class_mail":
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
return false;
|
|
3473
|
+
return packageType === "large_envelope_or_flat";
|
|
3474
|
+
case "dhl_express_worldwide":
|
|
3475
|
+
return requireDhlTermsAcknowledgement;
|
|
3083
3476
|
default:
|
|
3084
3477
|
return false;
|
|
3085
3478
|
}
|
|
3086
3479
|
};
|
|
3480
|
+
/**
|
|
3481
|
+
* @internal
|
|
3482
|
+
*
|
|
3483
|
+
* # Rates Utilities - getTotalRateAmount
|
|
3484
|
+
*
|
|
3485
|
+
* @category Utilities
|
|
3486
|
+
*/
|
|
3087
3487
|
const getTotalRateAmount = (rateCosts = {}) => calculateTotal(...Object.values(rateCosts));
|
|
3488
|
+
/**
|
|
3489
|
+
* @internal
|
|
3490
|
+
*
|
|
3491
|
+
* # Rates Utilities - overrideCarrierCodes
|
|
3492
|
+
*
|
|
3493
|
+
* @category Utilities
|
|
3494
|
+
*/
|
|
3088
3495
|
const overrideCarrierCodes$1 = (carrier, overrides) => {
|
|
3089
3496
|
return overrides[carrier] || carrier;
|
|
3090
3497
|
};
|
|
3091
3498
|
|
|
3092
3499
|
/**
|
|
3500
|
+
* @internal
|
|
3501
|
+
*
|
|
3502
|
+
* # Address Utilities - isDomesticAddress
|
|
3503
|
+
*
|
|
3093
3504
|
* @category Utilities
|
|
3094
3505
|
*/
|
|
3095
3506
|
const isDomesticAddress = address => {
|
|
@@ -3097,6 +3508,10 @@ const isDomesticAddress = address => {
|
|
|
3097
3508
|
return address.countryCode === "US" || ((_a = countries.find(c => c.code === address.countryCode)) === null || _a === void 0 ? void 0 : _a.isUnitedStatesTerritory);
|
|
3098
3509
|
};
|
|
3099
3510
|
/**
|
|
3511
|
+
* @internal
|
|
3512
|
+
*
|
|
3513
|
+
* # Address Utilities - isMilitaryAddress
|
|
3514
|
+
*
|
|
3100
3515
|
* @category Utilities
|
|
3101
3516
|
*/
|
|
3102
3517
|
const isMilitaryAddress = address => {
|
|
@@ -3104,6 +3519,10 @@ const isMilitaryAddress = address => {
|
|
|
3104
3519
|
return !!(((_a = usStates.find(s => s.code === address.stateProvince)) === null || _a === void 0 ? void 0 : _a.isMilitary) || ((_b = usCities.find(c => c.code === address.cityLocality)) === null || _b === void 0 ? void 0 : _b.isMilitary));
|
|
3105
3520
|
};
|
|
3106
3521
|
/**
|
|
3522
|
+
* @internal
|
|
3523
|
+
*
|
|
3524
|
+
* # Address Utilities - isUnitedStatesTerritory
|
|
3525
|
+
*
|
|
3107
3526
|
* @category Utilities
|
|
3108
3527
|
*/
|
|
3109
3528
|
const isUnitedStatesTerritory = address => {
|
|
@@ -3111,6 +3530,10 @@ const isUnitedStatesTerritory = address => {
|
|
|
3111
3530
|
return !!(((_a = countries.find(c => c.code === address.countryCode)) === null || _a === void 0 ? void 0 : _a.isUnitedStatesTerritory) || ((_b = usStates.find(s => s.code === address.stateProvince)) === null || _b === void 0 ? void 0 : _b.isUnitedStatesTerritory));
|
|
3112
3531
|
};
|
|
3113
3532
|
/**
|
|
3533
|
+
* @internal
|
|
3534
|
+
*
|
|
3535
|
+
* # Address Utilities - isUnsupportedByUps
|
|
3536
|
+
*
|
|
3114
3537
|
* @category Utilities
|
|
3115
3538
|
*/
|
|
3116
3539
|
const isUnsupportedByUps = address => {
|
|
@@ -3121,39 +3544,90 @@ const PO_BOX_REGEX =
|
|
|
3121
3544
|
// eslint-disable-next-line no-useless-escape
|
|
3122
3545
|
/^(((p[\s\.\'\,]?[o\s][\.\'\,]?)\s?)|(post\s?office\s?))((box|bin|bo|b\.?)?\s?(num|number|#)?\s?\d+)/i;
|
|
3123
3546
|
/**
|
|
3547
|
+
* @internal
|
|
3548
|
+
*
|
|
3549
|
+
* # Address Utilities - isPoBox
|
|
3550
|
+
*
|
|
3124
3551
|
* @category Utilities
|
|
3125
3552
|
*/
|
|
3126
3553
|
const isPoBox = addressLine => PO_BOX_REGEX.test(addressLine);
|
|
3127
3554
|
/**
|
|
3555
|
+
* @internal
|
|
3556
|
+
*
|
|
3557
|
+
* # Address Utilities - isPoBoxAddress
|
|
3558
|
+
*
|
|
3128
3559
|
* @category Utilities
|
|
3129
3560
|
*/
|
|
3130
3561
|
const isPoBoxAddress = address => !!(isPoBox(address.addressLine1) || address.addressLine2 && isPoBox(address.addressLine2));
|
|
3562
|
+
/**
|
|
3563
|
+
* @internal
|
|
3564
|
+
*
|
|
3565
|
+
* # Address Utilities - isEmptyAddress
|
|
3566
|
+
*
|
|
3567
|
+
* @category Utilities
|
|
3568
|
+
*/
|
|
3131
3569
|
const isEmptyAddress = address => {
|
|
3132
3570
|
return !address || Object.entries(address).every(([key, value]) => key === "countryCode" || [null, "", "unknown"].includes(value));
|
|
3133
3571
|
};
|
|
3134
3572
|
|
|
3135
3573
|
const USPS_CARRIER_CODES = ["usps", "stamps_com"];
|
|
3574
|
+
/**
|
|
3575
|
+
* @internal
|
|
3576
|
+
*
|
|
3577
|
+
* # Carrier Utilities - isUspsCarrier
|
|
3578
|
+
*
|
|
3579
|
+
* @category Utilities
|
|
3580
|
+
*/
|
|
3136
3581
|
const isUspsCarrier = carrierCode => USPS_CARRIER_CODES.includes(carrierCode);
|
|
3582
|
+
/**
|
|
3583
|
+
* @internal
|
|
3584
|
+
*
|
|
3585
|
+
* # Carrier Utilities - isUpsCarrier
|
|
3586
|
+
*
|
|
3587
|
+
* @category Utilities
|
|
3588
|
+
*/
|
|
3137
3589
|
const isUpsCarrier = carrierCode => carrierCode === "ups";
|
|
3590
|
+
/**
|
|
3591
|
+
* @internal
|
|
3592
|
+
*
|
|
3593
|
+
* # Carrier Utilities - isFedexCarrier
|
|
3594
|
+
*
|
|
3595
|
+
* @category Utilities
|
|
3596
|
+
*/
|
|
3138
3597
|
const getCarrierIdByCarrierCode = (carriers = [], carrierCode) => {
|
|
3139
3598
|
const carrier = carriers.find(c => c.carrierCode === carrierCode);
|
|
3140
3599
|
return carrier === null || carrier === void 0 ? void 0 : carrier.carrierId;
|
|
3141
3600
|
};
|
|
3142
3601
|
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3602
|
+
/**
|
|
3603
|
+
* @internal
|
|
3604
|
+
*
|
|
3605
|
+
* # Convert Dimensions Utility Function
|
|
3606
|
+
*
|
|
3607
|
+
* @category Utilities
|
|
3608
|
+
*/
|
|
3609
|
+
const formatDimensions = dimensions => `${dimensions.length} x ${dimensions.width} x ${dimensions.height} `;
|
|
3610
|
+
function convertDimensions(dimensions, {
|
|
3611
|
+
allowAllZeroes
|
|
3612
|
+
} = {}) {
|
|
3613
|
+
const {
|
|
3614
|
+
length,
|
|
3615
|
+
width,
|
|
3616
|
+
height,
|
|
3617
|
+
unit
|
|
3618
|
+
} = dimensions;
|
|
3619
|
+
const hasAllZeroes = [length, width, height].every(v => v === 0);
|
|
3620
|
+
if (hasAllZeroes && !allowAllZeroes) return undefined;
|
|
3151
3621
|
return Object.assign(Object.assign({}, dimensions), {
|
|
3152
|
-
unit: "inch"
|
|
3622
|
+
unit: unit !== null && unit !== void 0 ? unit : "inch"
|
|
3153
3623
|
});
|
|
3154
3624
|
}
|
|
3155
3625
|
|
|
3156
3626
|
/**
|
|
3627
|
+
* @internal
|
|
3628
|
+
*
|
|
3629
|
+
* # Sales Order Utilities - getCustomsFromSalesOrder
|
|
3630
|
+
*
|
|
3157
3631
|
* @category Utilities
|
|
3158
3632
|
*/
|
|
3159
3633
|
const getCustomsFromSalesOrder = (salesOrder, warehouse) => ({
|
|
@@ -3167,6 +3641,10 @@ const getCustomsFromSalesOrder = (salesOrder, warehouse) => ({
|
|
|
3167
3641
|
nonDelivery: "return_to_sender"
|
|
3168
3642
|
});
|
|
3169
3643
|
/**
|
|
3644
|
+
* @internal
|
|
3645
|
+
*
|
|
3646
|
+
* # Sales Order Utilities - getIsCustomsRequiredForSalesOrder
|
|
3647
|
+
*
|
|
3170
3648
|
* @category Utilities
|
|
3171
3649
|
*/
|
|
3172
3650
|
const getIsCustomsRequiredForSalesOrder = ({
|
|
@@ -3175,12 +3653,23 @@ const getIsCustomsRequiredForSalesOrder = ({
|
|
|
3175
3653
|
originAddress
|
|
3176
3654
|
}) => originAddress && isMilitaryAddress(originAddress) || shipTo && (isMilitaryAddress(shipTo) || isUnitedStatesTerritory(shipTo)) || (originAddress === null || originAddress === void 0 ? void 0 : originAddress.countryCode) !== (shipTo === null || shipTo === void 0 ? void 0 : shipTo.countryCode);
|
|
3177
3655
|
/**
|
|
3656
|
+
* @internal
|
|
3657
|
+
*
|
|
3658
|
+
* # Sales Order Utilities - getRequestedServices
|
|
3659
|
+
*
|
|
3178
3660
|
* @category Utilities
|
|
3179
3661
|
*/
|
|
3180
3662
|
const getRequestedServices = salesOrder => {
|
|
3181
3663
|
var _a;
|
|
3182
3664
|
return Array.from(new Set((_a = salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.salesOrderItems) === null || _a === void 0 ? void 0 : _a.filter(item => !!item.requestedShippingOptions.shippingService).map(item => item.requestedShippingOptions.shippingService)));
|
|
3183
3665
|
};
|
|
3666
|
+
/**
|
|
3667
|
+
* @internal
|
|
3668
|
+
*
|
|
3669
|
+
* # Sales Order Utilities - getSalesOrderItemsFromSalesOrderOrShipment
|
|
3670
|
+
*
|
|
3671
|
+
* @category Utilities
|
|
3672
|
+
*/
|
|
3184
3673
|
const getSalesOrderItemsFromSalesOrderOrShipment = ({
|
|
3185
3674
|
salesOrder,
|
|
3186
3675
|
shipment
|
|
@@ -3404,6 +3893,10 @@ $$c({ target: 'Array', proto: true, forced: FORCED$3 }, {
|
|
|
3404
3893
|
});
|
|
3405
3894
|
|
|
3406
3895
|
/**
|
|
3896
|
+
* @internal
|
|
3897
|
+
*
|
|
3898
|
+
* # Shipment Utilities - getIsInternationalShipment
|
|
3899
|
+
*
|
|
3407
3900
|
* @category Utilities
|
|
3408
3901
|
*/
|
|
3409
3902
|
const getIsInternationalShipment = ({
|
|
@@ -3411,6 +3904,10 @@ const getIsInternationalShipment = ({
|
|
|
3411
3904
|
shipTo
|
|
3412
3905
|
}) => (shipFrom === null || shipFrom === void 0 ? void 0 : shipFrom.countryCode) !== (shipTo === null || shipTo === void 0 ? void 0 : shipTo.countryCode);
|
|
3413
3906
|
/**
|
|
3907
|
+
* @internal
|
|
3908
|
+
*
|
|
3909
|
+
* # Shipment Utilities - getIsCustomsRequiredForShipment
|
|
3910
|
+
*
|
|
3414
3911
|
* @category Utilities
|
|
3415
3912
|
*/
|
|
3416
3913
|
const getIsCustomsRequiredForShipment = ({
|
|
@@ -3418,32 +3915,292 @@ const getIsCustomsRequiredForShipment = ({
|
|
|
3418
3915
|
shipTo
|
|
3419
3916
|
}) => shipFrom && isMilitaryAddress(shipFrom) || shipTo && (isMilitaryAddress(shipTo) || isUnitedStatesTerritory(shipTo)) || (shipFrom === null || shipFrom === void 0 ? void 0 : shipFrom.countryCode) !== (shipTo === null || shipTo === void 0 ? void 0 : shipTo.countryCode);
|
|
3420
3917
|
/**
|
|
3918
|
+
* @internal
|
|
3919
|
+
*
|
|
3920
|
+
* # Shipment Utilities - getPendingShipment
|
|
3921
|
+
*
|
|
3421
3922
|
* @category Utilities
|
|
3422
3923
|
*/
|
|
3423
3924
|
const getPendingShipment = shipments => shipments === null || shipments === void 0 ? void 0 : shipments.filter(s => s.shipmentStatus === "pending").sort(sortByCreationDate)[0];
|
|
3424
3925
|
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3926
|
+
var uncurryThis$6 = functionUncurryThis;
|
|
3927
|
+
|
|
3928
|
+
// `thisNumberValue` abstract operation
|
|
3929
|
+
// https://tc39.es/ecma262/#sec-thisnumbervalue
|
|
3930
|
+
var thisNumberValue$1 = uncurryThis$6(1.0.valueOf);
|
|
3931
|
+
|
|
3932
|
+
var toIntegerOrInfinity$1 = toIntegerOrInfinity$6;
|
|
3933
|
+
var toString$5 = toString$c;
|
|
3934
|
+
var requireObjectCoercible$2 = requireObjectCoercible$9;
|
|
3935
|
+
|
|
3936
|
+
var $RangeError$1 = RangeError;
|
|
3937
|
+
|
|
3938
|
+
// `String.prototype.repeat` method implementation
|
|
3939
|
+
// https://tc39.es/ecma262/#sec-string.prototype.repeat
|
|
3940
|
+
var stringRepeat = function repeat(count) {
|
|
3941
|
+
var str = toString$5(requireObjectCoercible$2(this));
|
|
3942
|
+
var result = '';
|
|
3943
|
+
var n = toIntegerOrInfinity$1(count);
|
|
3944
|
+
if (n < 0 || n == Infinity) throw $RangeError$1('Wrong number of repetitions');
|
|
3945
|
+
for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;
|
|
3946
|
+
return result;
|
|
3947
|
+
};
|
|
3948
|
+
|
|
3949
|
+
var $$b = _export;
|
|
3950
|
+
var uncurryThis$5 = functionUncurryThis;
|
|
3951
|
+
var toIntegerOrInfinity = toIntegerOrInfinity$6;
|
|
3952
|
+
var thisNumberValue = thisNumberValue$1;
|
|
3953
|
+
var $repeat = stringRepeat;
|
|
3954
|
+
var fails$4 = fails$q;
|
|
3955
|
+
|
|
3956
|
+
var $RangeError = RangeError;
|
|
3957
|
+
var $String = String;
|
|
3958
|
+
var floor = Math.floor;
|
|
3959
|
+
var repeat = uncurryThis$5($repeat);
|
|
3960
|
+
var stringSlice$2 = uncurryThis$5(''.slice);
|
|
3961
|
+
var nativeToFixed = uncurryThis$5(1.0.toFixed);
|
|
3962
|
+
|
|
3963
|
+
var pow = function (x, n, acc) {
|
|
3964
|
+
return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
|
|
3965
|
+
};
|
|
3966
|
+
|
|
3967
|
+
var log = function (x) {
|
|
3968
|
+
var n = 0;
|
|
3969
|
+
var x2 = x;
|
|
3970
|
+
while (x2 >= 4096) {
|
|
3971
|
+
n += 12;
|
|
3972
|
+
x2 /= 4096;
|
|
3432
3973
|
}
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
};
|
|
3974
|
+
while (x2 >= 2) {
|
|
3975
|
+
n += 1;
|
|
3976
|
+
x2 /= 2;
|
|
3977
|
+
} return n;
|
|
3978
|
+
};
|
|
3979
|
+
|
|
3980
|
+
var multiply = function (data, n, c) {
|
|
3981
|
+
var index = -1;
|
|
3982
|
+
var c2 = c;
|
|
3983
|
+
while (++index < 6) {
|
|
3984
|
+
c2 += n * data[index];
|
|
3985
|
+
data[index] = c2 % 1e7;
|
|
3986
|
+
c2 = floor(c2 / 1e7);
|
|
3987
|
+
}
|
|
3988
|
+
};
|
|
3989
|
+
|
|
3990
|
+
var divide = function (data, n) {
|
|
3991
|
+
var index = 6;
|
|
3992
|
+
var c = 0;
|
|
3993
|
+
while (--index >= 0) {
|
|
3994
|
+
c += data[index];
|
|
3995
|
+
data[index] = floor(c / n);
|
|
3996
|
+
c = (c % n) * 1e7;
|
|
3997
|
+
}
|
|
3998
|
+
};
|
|
3999
|
+
|
|
4000
|
+
var dataToString = function (data) {
|
|
4001
|
+
var index = 6;
|
|
4002
|
+
var s = '';
|
|
4003
|
+
while (--index >= 0) {
|
|
4004
|
+
if (s !== '' || index === 0 || data[index] !== 0) {
|
|
4005
|
+
var t = $String(data[index]);
|
|
4006
|
+
s = s === '' ? t : s + repeat('0', 7 - t.length) + t;
|
|
4007
|
+
}
|
|
4008
|
+
} return s;
|
|
4009
|
+
};
|
|
4010
|
+
|
|
4011
|
+
var FORCED$2 = fails$4(function () {
|
|
4012
|
+
return nativeToFixed(0.00008, 3) !== '0.000' ||
|
|
4013
|
+
nativeToFixed(0.9, 0) !== '1' ||
|
|
4014
|
+
nativeToFixed(1.255, 2) !== '1.25' ||
|
|
4015
|
+
nativeToFixed(1000000000000000128.0, 0) !== '1000000000000000128';
|
|
4016
|
+
}) || !fails$4(function () {
|
|
4017
|
+
// V8 ~ Android 4.3-
|
|
4018
|
+
nativeToFixed({});
|
|
4019
|
+
});
|
|
4020
|
+
|
|
4021
|
+
// `Number.prototype.toFixed` method
|
|
4022
|
+
// https://tc39.es/ecma262/#sec-number.prototype.tofixed
|
|
4023
|
+
$$b({ target: 'Number', proto: true, forced: FORCED$2 }, {
|
|
4024
|
+
toFixed: function toFixed(fractionDigits) {
|
|
4025
|
+
var number = thisNumberValue(this);
|
|
4026
|
+
var fractDigits = toIntegerOrInfinity(fractionDigits);
|
|
4027
|
+
var data = [0, 0, 0, 0, 0, 0];
|
|
4028
|
+
var sign = '';
|
|
4029
|
+
var result = '0';
|
|
4030
|
+
var e, z, j, k;
|
|
4031
|
+
|
|
4032
|
+
// TODO: ES2018 increased the maximum number of fraction digits to 100, need to improve the implementation
|
|
4033
|
+
if (fractDigits < 0 || fractDigits > 20) throw $RangeError('Incorrect fraction digits');
|
|
4034
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
4035
|
+
if (number != number) return 'NaN';
|
|
4036
|
+
if (number <= -1e21 || number >= 1e21) return $String(number);
|
|
4037
|
+
if (number < 0) {
|
|
4038
|
+
sign = '-';
|
|
4039
|
+
number = -number;
|
|
4040
|
+
}
|
|
4041
|
+
if (number > 1e-21) {
|
|
4042
|
+
e = log(number * pow(2, 69, 1)) - 69;
|
|
4043
|
+
z = e < 0 ? number * pow(2, -e, 1) : number / pow(2, e, 1);
|
|
4044
|
+
z *= 0x10000000000000;
|
|
4045
|
+
e = 52 - e;
|
|
4046
|
+
if (e > 0) {
|
|
4047
|
+
multiply(data, 0, z);
|
|
4048
|
+
j = fractDigits;
|
|
4049
|
+
while (j >= 7) {
|
|
4050
|
+
multiply(data, 1e7, 0);
|
|
4051
|
+
j -= 7;
|
|
4052
|
+
}
|
|
4053
|
+
multiply(data, pow(10, j, 1), 0);
|
|
4054
|
+
j = e - 1;
|
|
4055
|
+
while (j >= 23) {
|
|
4056
|
+
divide(data, 1 << 23);
|
|
4057
|
+
j -= 23;
|
|
4058
|
+
}
|
|
4059
|
+
divide(data, 1 << j);
|
|
4060
|
+
multiply(data, 1, 1);
|
|
4061
|
+
divide(data, 2);
|
|
4062
|
+
result = dataToString(data);
|
|
4063
|
+
} else {
|
|
4064
|
+
multiply(data, 0, z);
|
|
4065
|
+
multiply(data, 1 << -e, 0);
|
|
4066
|
+
result = dataToString(data) + repeat('0', fractDigits);
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
if (fractDigits > 0) {
|
|
4070
|
+
k = result.length;
|
|
4071
|
+
result = sign + (k <= fractDigits
|
|
4072
|
+
? '0.' + repeat('0', fractDigits - k) + result
|
|
4073
|
+
: stringSlice$2(result, 0, k - fractDigits) + '.' + stringSlice$2(result, k - fractDigits));
|
|
4074
|
+
} else {
|
|
4075
|
+
result = sign + result;
|
|
4076
|
+
} return result;
|
|
4077
|
+
}
|
|
4078
|
+
});
|
|
4079
|
+
|
|
4080
|
+
/**
|
|
4081
|
+
* @internal
|
|
4082
|
+
*
|
|
4083
|
+
* # Weight Utilities - isMetricWeightUnit
|
|
4084
|
+
*
|
|
4085
|
+
* - This utility function checks if the weight unit is `metric` and returns a `boolean`
|
|
4086
|
+
* indicating if it is metric or not.
|
|
4087
|
+
*
|
|
4088
|
+
* @param unit The weight unit to check (optional).
|
|
4089
|
+
*
|
|
4090
|
+
* @returns boolean Indicating if the weight unit is `metric`.
|
|
4091
|
+
*
|
|
4092
|
+
* @category Utilities
|
|
4093
|
+
*/
|
|
4094
|
+
const isMetricWeightUnit = unit => !!unit && ["gram", "kilogram"].includes(unit);
|
|
4095
|
+
/**
|
|
4096
|
+
* @internal
|
|
4097
|
+
*
|
|
4098
|
+
* # Weight Utilities - isDecimalWeight
|
|
4099
|
+
*
|
|
4100
|
+
* - This utility function checks if the weight is a `decimal` weight and returns a `boolean`
|
|
4101
|
+
* indicating if it is decimal or not.
|
|
4102
|
+
*
|
|
4103
|
+
* @param weight The weight to `check for a decimal` (optional).
|
|
4104
|
+
*
|
|
4105
|
+
* @returns boolean Indicating if the weight is a decimal weight.
|
|
4106
|
+
*
|
|
4107
|
+
* @category Utilities
|
|
4108
|
+
*/
|
|
4109
|
+
const isDecimalWeight = weight => "value" in weight;
|
|
4110
|
+
/**
|
|
4111
|
+
* @internal
|
|
4112
|
+
*
|
|
4113
|
+
* # Weight Utilities - convertPoundsAndOuncesToOunces
|
|
4114
|
+
*
|
|
4115
|
+
* - This utility function converts `pounds and ounces` to a `total of ounces`.
|
|
4116
|
+
*
|
|
4117
|
+
* @param weight The `pound + ounce` weight to convert to ounces.
|
|
4118
|
+
*
|
|
4119
|
+
* @returns number The total weight in `ounces`.
|
|
4120
|
+
*
|
|
4121
|
+
* @category Utilities
|
|
4122
|
+
*/
|
|
4123
|
+
const convertPoundsAndOuncesToOunces = weight => {
|
|
4124
|
+
var _a, _b;
|
|
4125
|
+
const pounds = (_a = weight.whole) !== null && _a !== void 0 ? _a : 0;
|
|
4126
|
+
const ounces = (_b = weight.fractional) !== null && _b !== void 0 ? _b : 0;
|
|
4127
|
+
return pounds * 16 + ounces;
|
|
4128
|
+
};
|
|
4129
|
+
/**
|
|
4130
|
+
* @internal
|
|
4131
|
+
*
|
|
4132
|
+
* # Weight Utilities - convertFractionalWeightToDecimalWeight
|
|
4133
|
+
*
|
|
4134
|
+
* - This utility function converts a `fractional weight` to a `decimal weight`.
|
|
4135
|
+
*
|
|
4136
|
+
* @param weight The fractional weight to convert to a decimal weight.
|
|
4137
|
+
* @param unit The target weight unit to convert to (optional).
|
|
4138
|
+
*
|
|
4139
|
+
* @returns WeightWithUnit The decimal weight with its unit.
|
|
4140
|
+
*
|
|
4141
|
+
* @category Utilities
|
|
4142
|
+
*/
|
|
4143
|
+
const convertFractionalWeightToDecimalWeight = (weight, unit) => isMetricWeightUnit(unit) ? {
|
|
4144
|
+
unit,
|
|
4145
|
+
value: weight.whole
|
|
4146
|
+
} : {
|
|
4147
|
+
unit: "ounce",
|
|
4148
|
+
value: convertPoundsAndOuncesToOunces(weight)
|
|
4149
|
+
};
|
|
4150
|
+
/**
|
|
4151
|
+
* @internal
|
|
4152
|
+
*
|
|
4153
|
+
* # Weight Utilities - convertDecimalWeightToFractionalWeight
|
|
4154
|
+
*
|
|
4155
|
+
* - This utility function converts a `decimal weight` to a `fractional weight`.
|
|
4156
|
+
*
|
|
4157
|
+
* @param weight The decimal weight to convert to a fractional weight.
|
|
4158
|
+
*
|
|
4159
|
+
* @returns FractionalWeight The converted fractional weight.
|
|
4160
|
+
*
|
|
4161
|
+
* @category Utilities
|
|
4162
|
+
*/
|
|
4163
|
+
const convertDecimalWeightToFractionalWeight = weight => isMetricWeightUnit(weight.unit) ? {
|
|
4164
|
+
fractional: 0,
|
|
4165
|
+
whole: weight.value
|
|
4166
|
+
} : {
|
|
4167
|
+
fractional: weight.value % 16,
|
|
4168
|
+
whole: Math.floor(weight.value / 16)
|
|
4169
|
+
};
|
|
4170
|
+
/**
|
|
4171
|
+
* @internal
|
|
4172
|
+
*
|
|
4173
|
+
* # Weight Utilities - convertWeight/2
|
|
4174
|
+
*/
|
|
4175
|
+
function convertWeight(weight, unit) {
|
|
4176
|
+
return isDecimalWeight(weight) ? convertDecimalWeightToFractionalWeight(weight) : convertFractionalWeightToDecimalWeight(weight, unit);
|
|
3437
4177
|
}
|
|
3438
4178
|
/**
|
|
4179
|
+
* @internal
|
|
4180
|
+
*
|
|
4181
|
+
* # Weight Utilities - formatFractionalWeight
|
|
4182
|
+
*
|
|
4183
|
+
* - This utility function formats a `fractional weight` for ease of use.
|
|
4184
|
+
*
|
|
4185
|
+
* @param weight The fractional weight to be formatted.
|
|
4186
|
+
*
|
|
4187
|
+
* @return FractionalWeight The formatted fractional weight.
|
|
4188
|
+
*
|
|
3439
4189
|
* @category Utilities
|
|
3440
4190
|
*/
|
|
3441
|
-
function formatFractionalWeight(weight) {
|
|
4191
|
+
function formatFractionalWeight(weight, unit) {
|
|
3442
4192
|
if (!weight) return {
|
|
3443
4193
|
fractional: 0,
|
|
3444
4194
|
whole: 0
|
|
3445
4195
|
};
|
|
3446
|
-
|
|
4196
|
+
//allow up to 5 decimal places for metric weights
|
|
4197
|
+
if (isMetricWeightUnit(unit) && weight.whole) {
|
|
4198
|
+
return {
|
|
4199
|
+
fractional: 0,
|
|
4200
|
+
whole: Number(weight.whole.toFixed(5)) || 0
|
|
4201
|
+
};
|
|
4202
|
+
}
|
|
4203
|
+
const valueAsOz = convertPoundsAndOuncesToOunces(weight);
|
|
3447
4204
|
const valueAsLbs = valueAsOz / 16;
|
|
3448
4205
|
return {
|
|
3449
4206
|
fractional: Math.round((valueAsLbs - Math.floor(valueAsLbs)) * 16 * 100) / 100,
|
|
@@ -3452,15 +4209,28 @@ function formatFractionalWeight(weight) {
|
|
|
3452
4209
|
}
|
|
3453
4210
|
|
|
3454
4211
|
/**
|
|
4212
|
+
* @internal
|
|
4213
|
+
*
|
|
4214
|
+
* # Package Utilities - isFlatRatePackageCode
|
|
4215
|
+
*
|
|
3455
4216
|
* @category Utilities
|
|
3456
4217
|
*/
|
|
3457
4218
|
const isFlatRatePackageCode = packageCode => {
|
|
3458
4219
|
return packageCode ? packageCode.includes("flat_rate") : false;
|
|
3459
4220
|
};
|
|
3460
4221
|
|
|
4222
|
+
/**
|
|
4223
|
+
* @internal
|
|
4224
|
+
*
|
|
4225
|
+
* # Capitalize First Letter Utility Function
|
|
4226
|
+
*
|
|
4227
|
+
* - This is a utility function that `capitalizes` the first letter of a given string.
|
|
4228
|
+
*/
|
|
3461
4229
|
const capitalizeFirstLetter = str => str.slice(0, 1).toUpperCase() + str.slice(1);
|
|
3462
4230
|
|
|
3463
4231
|
/**
|
|
4232
|
+
* @internal
|
|
4233
|
+
*
|
|
3464
4234
|
* Creates a Record of Emotion styles; eliminating the need to explicitly type styles
|
|
3465
4235
|
* while remaining fully typesafe w/ autocomplete.
|
|
3466
4236
|
*
|
|
@@ -3480,6 +4250,8 @@ const capitalizeFirstLetter = str => str.slice(0, 1).toUpperCase() + str.slice(1
|
|
|
3480
4250
|
* }),
|
|
3481
4251
|
* });
|
|
3482
4252
|
* ```
|
|
4253
|
+
*
|
|
4254
|
+
* @category Utilities
|
|
3483
4255
|
*/
|
|
3484
4256
|
const createStyles = styles => styles;
|
|
3485
4257
|
|
|
@@ -3490,6 +4262,10 @@ const buildError = (translationKey, error) => {
|
|
|
3490
4262
|
}, meta));
|
|
3491
4263
|
};
|
|
3492
4264
|
/**
|
|
4265
|
+
* @internal
|
|
4266
|
+
*
|
|
4267
|
+
* # Error Map
|
|
4268
|
+
*
|
|
3493
4269
|
* @category Utilities
|
|
3494
4270
|
*/
|
|
3495
4271
|
const errorMap = (issue, ctx) => {
|
|
@@ -3533,6 +4309,10 @@ const errorMap = (issue, ctx) => {
|
|
|
3533
4309
|
};
|
|
3534
4310
|
};
|
|
3535
4311
|
/**
|
|
4312
|
+
* @internal
|
|
4313
|
+
*
|
|
4314
|
+
* # Validation Resolver
|
|
4315
|
+
*
|
|
3536
4316
|
* @category Utilities
|
|
3537
4317
|
*/
|
|
3538
4318
|
const validationResolver = schema => (values, context, resolverOptions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -3543,57 +4323,14 @@ const validationResolver = schema => (values, context, resolverOptions) => __awa
|
|
|
3543
4323
|
return validationResult;
|
|
3544
4324
|
});
|
|
3545
4325
|
|
|
3546
|
-
const featureFlags = {
|
|
3547
|
-
ConfigureSalesOrderShipment: {
|
|
3548
|
-
compatibleCountryCodes: ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"],
|
|
3549
|
-
rateForm: {
|
|
3550
|
-
enableFunding: false,
|
|
3551
|
-
enableGlobalPostFiltering: false,
|
|
3552
|
-
labelLayout: false,
|
|
3553
|
-
nicknameRate: true,
|
|
3554
|
-
saveRate: true
|
|
3555
|
-
},
|
|
3556
|
-
shipmentForm: {
|
|
3557
|
-
browseRates: true,
|
|
3558
|
-
includeShipsuranceInsurance: true,
|
|
3559
|
-
includeThirdPartyInsurance: true,
|
|
3560
|
-
selectService: true,
|
|
3561
|
-
shippingPresets: false
|
|
3562
|
-
}
|
|
3563
|
-
},
|
|
3564
|
-
Global: {
|
|
3565
|
-
carriers: {
|
|
3566
|
-
enabledCarriers: ["stamps_com", "ups", "dhl_express_walleted"]
|
|
3567
|
-
},
|
|
3568
|
-
presentation: {
|
|
3569
|
-
poweredByShipEngine: false
|
|
3570
|
-
}
|
|
3571
|
-
},
|
|
3572
|
-
ViewShipment: {
|
|
3573
|
-
shipment: {
|
|
3574
|
-
schedulePickup: true
|
|
3575
|
-
}
|
|
3576
|
-
}
|
|
3577
|
-
};
|
|
3578
|
-
const featureFlagComponentNameLookup = componentName => {
|
|
3579
|
-
var _a;
|
|
3580
|
-
const lookup = {
|
|
3581
|
-
PurchaseLabel: "ConfigureSalesOrderShipment"
|
|
3582
|
-
};
|
|
3583
|
-
return (_a = lookup[componentName]) !== null && _a !== void 0 ? _a : "";
|
|
3584
|
-
};
|
|
3585
|
-
const getFeatures = (...element) => {
|
|
3586
|
-
return element.map(feat => {
|
|
3587
|
-
var _a;
|
|
3588
|
-
return (_a = get$1(featureFlags, feat)) !== null && _a !== void 0 ? _a : {};
|
|
3589
|
-
}).reduce((acc, feat) => Object.assign(acc, feat), {});
|
|
3590
|
-
};
|
|
3591
|
-
const useFeatures = (...element) => {
|
|
3592
|
-
return getFeatures(...element);
|
|
3593
|
-
};
|
|
3594
|
-
|
|
3595
4326
|
/**
|
|
3596
|
-
*
|
|
4327
|
+
* @internal
|
|
4328
|
+
*
|
|
4329
|
+
* # Date Range Options Hook
|
|
4330
|
+
*
|
|
4331
|
+
* A curated list of date range options relative to the immediate date.
|
|
4332
|
+
*
|
|
4333
|
+
* @see {@link DateRangeOption | The `DateRangeOption` type used in this hook}
|
|
3597
4334
|
*/
|
|
3598
4335
|
const useDateRangeOptions = () => {
|
|
3599
4336
|
const {
|
|
@@ -3623,6 +4360,13 @@ const useDateRangeOptions = () => {
|
|
|
3623
4360
|
return [options, optionsByValue];
|
|
3624
4361
|
};
|
|
3625
4362
|
|
|
4363
|
+
/**
|
|
4364
|
+
* @internal
|
|
4365
|
+
*
|
|
4366
|
+
* # Expiration Month Options Hook
|
|
4367
|
+
*
|
|
4368
|
+
* @cateogry Hooks
|
|
4369
|
+
*/
|
|
3626
4370
|
const useExpirationMonthOptions = () => {
|
|
3627
4371
|
const {
|
|
3628
4372
|
t
|
|
@@ -3666,6 +4410,13 @@ const useExpirationMonthOptions = () => {
|
|
|
3666
4410
|
}];
|
|
3667
4411
|
};
|
|
3668
4412
|
|
|
4413
|
+
/**
|
|
4414
|
+
* @internal
|
|
4415
|
+
*
|
|
4416
|
+
* # Insurance Provider Options Hook
|
|
4417
|
+
*
|
|
4418
|
+
* @category Hooks
|
|
4419
|
+
*/
|
|
3669
4420
|
const useInsuranceProviderOptions = (insuranceAccount, features) => {
|
|
3670
4421
|
const {
|
|
3671
4422
|
t
|
|
@@ -3676,6 +4427,13 @@ const useInsuranceProviderOptions = (insuranceAccount, features) => {
|
|
|
3676
4427
|
}), [t, insuranceAccount, features === null || features === void 0 ? void 0 : features.includeThirdPartyInsurance, features === null || features === void 0 ? void 0 : features.includeShipsuranceInsurance]);
|
|
3677
4428
|
};
|
|
3678
4429
|
|
|
4430
|
+
/**
|
|
4431
|
+
* @internal
|
|
4432
|
+
*
|
|
4433
|
+
* # Shipment Metadata Hook
|
|
4434
|
+
*
|
|
4435
|
+
* @category Hooks
|
|
4436
|
+
*/
|
|
3679
4437
|
const useShipmentMetadata = shipment => {
|
|
3680
4438
|
const isInternational = useMemo(() => {
|
|
3681
4439
|
return shipment ? getIsInternationalShipment(shipment) : false;
|
|
@@ -3689,13 +4447,22 @@ const useShipmentMetadata = shipment => {
|
|
|
3689
4447
|
var _a;
|
|
3690
4448
|
return shipment && ((_a = shipment.shipFrom) === null || _a === void 0 ? void 0 : _a.countryCode) === "MX" || (shipment === null || shipment === void 0 ? void 0 : shipment.shipTo.countryCode) === "MX";
|
|
3691
4449
|
}, [shipment]);
|
|
3692
|
-
|
|
4450
|
+
const shipmentUnits = useMemo(() => {
|
|
4451
|
+
const packageDimensions = shipment === null || shipment === void 0 ? void 0 : shipment.packages[0].dimensions;
|
|
4452
|
+
const packageWeight = shipment === null || shipment === void 0 ? void 0 : shipment.packages[0].weight;
|
|
4453
|
+
const packageMeasurements = [packageDimensions === null || packageDimensions === void 0 ? void 0 : packageDimensions.height, packageDimensions === null || packageDimensions === void 0 ? void 0 : packageDimensions.length, packageDimensions === null || packageDimensions === void 0 ? void 0 : packageDimensions.width, packageWeight === null || packageWeight === void 0 ? void 0 : packageWeight.value];
|
|
4454
|
+
const hasAllZeroMeasurements = packageMeasurements.every(m => m === 0);
|
|
4455
|
+
return {
|
|
4456
|
+
hasAllZeroMeasurements
|
|
4457
|
+
};
|
|
4458
|
+
}, [shipment]);
|
|
4459
|
+
return Object.assign({
|
|
3693
4460
|
isContentDescriptionRequired,
|
|
3694
4461
|
isCustomsRequired,
|
|
3695
4462
|
isInternational,
|
|
3696
4463
|
isPoBox,
|
|
3697
4464
|
isUnsupportedUpsCountry
|
|
3698
|
-
};
|
|
4465
|
+
}, shipmentUnits);
|
|
3699
4466
|
};
|
|
3700
4467
|
|
|
3701
4468
|
let _$2 = t => t,
|
|
@@ -3705,6 +4472,13 @@ const findGenericPackageFromCarriers = carriers => {
|
|
|
3705
4472
|
const carrier = carriers.find(c => c.packages.some(p => p.packageCode === "package"));
|
|
3706
4473
|
return carrier === null || carrier === void 0 ? void 0 : carrier.packages.find(p => p.packageCode === "package");
|
|
3707
4474
|
};
|
|
4475
|
+
/**
|
|
4476
|
+
* @internal
|
|
4477
|
+
*
|
|
4478
|
+
* # Package Options Hook
|
|
4479
|
+
*
|
|
4480
|
+
* @category Hooks
|
|
4481
|
+
*/
|
|
3708
4482
|
const usePackageOptions = (carriers, customPackageTypes, shipment) => {
|
|
3709
4483
|
const {
|
|
3710
4484
|
t
|
|
@@ -3766,7 +4540,12 @@ const usePackageOptions = (carriers, customPackageTypes, shipment) => {
|
|
|
3766
4540
|
}, [carriers, customPackageTypes, isPoBox, isUnsupportedUpsCountry, t]);
|
|
3767
4541
|
};
|
|
3768
4542
|
|
|
3769
|
-
|
|
4543
|
+
/**
|
|
4544
|
+
* @internal
|
|
4545
|
+
*
|
|
4546
|
+
* # Rate Options Hook
|
|
4547
|
+
*/
|
|
4548
|
+
const useRateOptions = (rates, carriers, shipment, enableGlobalPostFiltering, requireDhlTermsAcknowledgement) => {
|
|
3770
4549
|
const carriersById = useMemo(() => createDictionary(carriers, c => ({
|
|
3771
4550
|
[c.carrierId]: c
|
|
3772
4551
|
})), [carriers]);
|
|
@@ -3791,13 +4570,20 @@ const useRateOptions = (rates, carriers, shipment, enableGlobalPostFiltering) =>
|
|
|
3791
4570
|
return Object.assign(Object.assign({}, r), {
|
|
3792
4571
|
balance,
|
|
3793
4572
|
messages: r.warningMessages,
|
|
3794
|
-
requiresAcknowledgement: getRateRequiresAcknowledgement(r.serviceCode, r.packageType),
|
|
4573
|
+
requiresAcknowledgement: getRateRequiresAcknowledgement(r.serviceCode, r.packageType, !!requireDhlTermsAcknowledgement),
|
|
3795
4574
|
requiresFundedAmount
|
|
3796
4575
|
});
|
|
3797
4576
|
});
|
|
3798
|
-
}, [carriersById, enableGlobalPostFiltering, isInternational, isPoBox, isUnsupportedUpsCountry, rates]);
|
|
4577
|
+
}, [carriersById, enableGlobalPostFiltering, isInternational, isPoBox, isUnsupportedUpsCountry, rates, requireDhlTermsAcknowledgement]);
|
|
3799
4578
|
};
|
|
3800
4579
|
|
|
4580
|
+
/**
|
|
4581
|
+
* @internal
|
|
4582
|
+
*
|
|
4583
|
+
* # Service Code Options Hook
|
|
4584
|
+
*
|
|
4585
|
+
* @category Hooks
|
|
4586
|
+
*/
|
|
3801
4587
|
const useServiceCodeOptions = (carriers, shipment) => {
|
|
3802
4588
|
const {
|
|
3803
4589
|
isInternational,
|
|
@@ -3862,34 +4648,39 @@ const getWarningStyles = theme => /*#__PURE__*/css({
|
|
|
3862
4648
|
width: theme.spacing()
|
|
3863
4649
|
}, process.env.NODE_ENV === "production" ? "" : ";label:getWarningStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInByZXNldC1kZXNjcmlwdG9yLnN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFxQjJDIiwiZmlsZSI6InByZXNldC1kZXNjcmlwdG9yLnN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdFwiO1xyXG5leHBvcnQgY29uc3QgZ2V0Q29udGFpbmVyU3R5bGVzID0gKHRoZW1lKSA9PiBjc3Moe1xyXG4gICAgZGlzcGxheTogXCJmbGV4XCIsXHJcbiAgICBmbGV4RGlyZWN0aW9uOiBcImNvbHVtblwiLFxyXG4gICAgaGVpZ2h0OiBcIjEwMCVcIixcclxuICAgIHBhZGRpbmdUb3A6IHRoZW1lLnNwYWNpbmcoMC41KSxcclxuICAgIHdpZHRoOiBcIm1heC1jb250ZW50XCIsXHJcbn0pO1xyXG5leHBvcnQgY29uc3QgZ2V0RGltZW5zaW9uU3R5bGVzID0gKHRoZW1lKSA9PiBjc3Moe1xyXG4gICAgY29sb3I6IHRoZW1lLnBhbGV0dGUuZ3JheS5tYWluLFxyXG4gICAgZm9udFNpemU6IHRoZW1lLnR5cG9ncmFwaHkuZm9udFNpemUuWFMsXHJcbn0pO1xyXG5leHBvcnQgY29uc3QgZ2V0U2VydmljZU5hbWVTdHlsZXMgPSAodGhlbWUpID0+IGNzcyh7XHJcbiAgICBmb250U2l6ZTogdGhlbWUudHlwb2dyYXBoeS5mb250U2l6ZS5YWFMsXHJcbiAgICBsaW5lSGVpZ2h0OiAwLFxyXG4gICAgcGFkZGluZ1RvcDogdGhlbWUuc3BhY2luZygpLFxyXG59KTtcclxuZXhwb3J0IGNvbnN0IGdldFByZXNldE5hbWVTdHlsZXMgPSAodGhlbWUpID0+IGNzcyh7XHJcbiAgICBmb250U2l6ZTogdGhlbWUudHlwb2dyYXBoeS5mb250U2l6ZS5YUyxcclxuICAgIGZvbnRXZWlnaHQ6IHRoZW1lLnR5cG9ncmFwaHkuZm9udFdlaWdodC5ib2xkLFxyXG59KTtcclxuZXhwb3J0IGNvbnN0IGdldFdhcm5pbmdTdHlsZXMgPSAodGhlbWUpID0+IGNzcyh7XHJcbiAgICBiYWNrZ3JvdW5kOiBcIm5vbmVcIixcclxuICAgIG1hcmdpbkxlZnQ6IFwiYXV0b1wiLFxyXG4gICAgbWFyZ2luUmlnaHQ6IHRoZW1lLnNwYWNpbmcoLTMpLFxyXG4gICAgbWFyZ2luVG9wOiB0aGVtZS5zcGFjaW5nKC01KSxcclxuICAgIHdpZHRoOiB0aGVtZS5zcGFjaW5nKCksXHJcbn0pO1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1wcmVzZXQtZGVzY3JpcHRvci5zdHlsZXMuanMubWFwIl19 */");
|
|
3864
4650
|
|
|
3865
|
-
const PresetDescriptor = preset =>
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
4651
|
+
const PresetDescriptor = preset => {
|
|
4652
|
+
const {
|
|
4653
|
+
t
|
|
4654
|
+
} = useTranslation();
|
|
4655
|
+
return jsx("div", Object.assign({
|
|
4656
|
+
css: getContainerStyles
|
|
4657
|
+
}, {
|
|
4658
|
+
children: jsxs("div", {
|
|
4659
|
+
children: [jsxs("div", {
|
|
4660
|
+
children: [jsx("span", Object.assign({
|
|
4661
|
+
css: getPresetNameStyles
|
|
4662
|
+
}, {
|
|
4663
|
+
children: preset.name
|
|
4664
|
+
})), jsx("span", Object.assign({
|
|
4665
|
+
css: getDimensionStyles
|
|
4666
|
+
}, {
|
|
4667
|
+
children: (preset.dimensions || preset.weight) && " - "
|
|
4668
|
+
})), preset.dimensions && jsx("span", Object.assign({
|
|
4669
|
+
css: getDimensionStyles
|
|
4670
|
+
}, {
|
|
4671
|
+
children: `${formatDimensions(preset.dimensions)} ` + t(`units.${preset.dimensions.unit}`)
|
|
4672
|
+
}))]
|
|
4673
|
+
}), jsx("div", Object.assign({
|
|
4674
|
+
css: getServiceNameStyles
|
|
3880
4675
|
}, {
|
|
3881
|
-
children:
|
|
3882
|
-
}))]
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
type: NotificationType.ALERT
|
|
3890
|
-
})]
|
|
3891
|
-
})
|
|
3892
|
-
}));
|
|
4676
|
+
children: preset.serviceName && preset.serviceName
|
|
4677
|
+
})), preset.serviceName && ["USPS Parcel Select Ground", "USPS First Class Mail"].includes(preset.serviceName) && jsx(InlineNotification, {
|
|
4678
|
+
css: getWarningStyles,
|
|
4679
|
+
type: NotificationType.ALERT
|
|
4680
|
+
})]
|
|
4681
|
+
})
|
|
4682
|
+
}));
|
|
4683
|
+
};
|
|
3893
4684
|
|
|
3894
4685
|
const createCategoryFromShippingPresets = (categoryName, presets) => presets ? [{
|
|
3895
4686
|
categoryName: categoryName,
|
|
@@ -3899,6 +4690,11 @@ const createCategoryFromShippingPresets = (categoryName, presets) => presets ? [
|
|
|
3899
4690
|
value: p
|
|
3900
4691
|
}))
|
|
3901
4692
|
}] : [];
|
|
4693
|
+
/**
|
|
4694
|
+
* @internal
|
|
4695
|
+
*
|
|
4696
|
+
* # Shipping Preset Options Component
|
|
4697
|
+
*/
|
|
3902
4698
|
const useShippingPresetsOptions = ({
|
|
3903
4699
|
platform,
|
|
3904
4700
|
user
|
|
@@ -3914,11 +4710,25 @@ const useShippingPresetsOptions = ({
|
|
|
3914
4710
|
...createCategoryFromShippingPresets(t("shippingPresets.platform"), isInternational ? platform === null || platform === void 0 ? void 0 : platform.international : platform === null || platform === void 0 ? void 0 : platform.domestic)], [isInternational, platform, t, user]);
|
|
3915
4711
|
};
|
|
3916
4712
|
|
|
4713
|
+
/**
|
|
4714
|
+
* @internal
|
|
4715
|
+
*
|
|
4716
|
+
* # State Code Options Hook
|
|
4717
|
+
*
|
|
4718
|
+
* @category Hooks
|
|
4719
|
+
*/
|
|
3917
4720
|
const useStateCodeOptions = domestic => useMemo(() => usStates.flatMap(v => !domestic || !v.isMilitary && !v.isUnitedStatesTerritory ? {
|
|
3918
4721
|
label: v.name,
|
|
3919
4722
|
value: v.code
|
|
3920
4723
|
} : []), [domestic]);
|
|
3921
4724
|
|
|
4725
|
+
/**
|
|
4726
|
+
* @internal
|
|
4727
|
+
*
|
|
4728
|
+
* # Warehouse Options Hook
|
|
4729
|
+
*
|
|
4730
|
+
* @category Hooks
|
|
4731
|
+
*/
|
|
3922
4732
|
const useWarehouseOptions = warehouses => useMemo(() => {
|
|
3923
4733
|
if (!warehouses) return undefined;
|
|
3924
4734
|
return warehouses.map(warehouse => ({
|
|
@@ -4040,6 +4850,13 @@ var _carrierMetadata = [
|
|
|
4040
4850
|
}
|
|
4041
4851
|
];
|
|
4042
4852
|
|
|
4853
|
+
/**
|
|
4854
|
+
* @internal
|
|
4855
|
+
*
|
|
4856
|
+
* # Carrier Metadata Hook
|
|
4857
|
+
*
|
|
4858
|
+
* @category Hooks
|
|
4859
|
+
*/
|
|
4043
4860
|
const useCarrierMetadata = carrierCodes => {
|
|
4044
4861
|
const carrierMetadatas = _carrierMetadata;
|
|
4045
4862
|
return carrierCodes ? carrierCodes.flatMap(code => {
|
|
@@ -4049,7 +4866,11 @@ const useCarrierMetadata = carrierCodes => {
|
|
|
4049
4866
|
};
|
|
4050
4867
|
|
|
4051
4868
|
/**
|
|
4052
|
-
*
|
|
4869
|
+
* @internal
|
|
4870
|
+
*
|
|
4871
|
+
* # Portal
|
|
4872
|
+
*
|
|
4873
|
+
* - A no-frills wrapper around React.createPortal for more elegant DOM composition
|
|
4053
4874
|
*
|
|
4054
4875
|
* @category Components
|
|
4055
4876
|
*
|
|
@@ -4069,11 +4890,15 @@ const Portal = ({
|
|
|
4069
4890
|
const RootPortalContext = /*#__PURE__*/createContext(undefined);
|
|
4070
4891
|
RootPortalContext.displayName = "RootPortalContext";
|
|
4071
4892
|
/**
|
|
4893
|
+
* @internal
|
|
4894
|
+
*
|
|
4895
|
+
* # Root Portal Provider
|
|
4896
|
+
*
|
|
4072
4897
|
* Provides access to a top-level 'root-portal' DOM node, adjacent the app 'root' div
|
|
4073
4898
|
*
|
|
4074
4899
|
* @category Providers
|
|
4075
4900
|
*
|
|
4076
|
-
* @see {@link
|
|
4901
|
+
* @see {@link useRootPortal | The associated `hook` for this provider}
|
|
4077
4902
|
*/
|
|
4078
4903
|
const RootPortalProvider = ({
|
|
4079
4904
|
children
|
|
@@ -4094,9 +4919,18 @@ const RootPortalProvider = ({
|
|
|
4094
4919
|
}));
|
|
4095
4920
|
};
|
|
4096
4921
|
/**
|
|
4097
|
-
*
|
|
4922
|
+
* @internal
|
|
4923
|
+
*
|
|
4924
|
+
* # Root Portal Provider Hook
|
|
4925
|
+
*
|
|
4926
|
+
* The `useRootPortal` hook provides access to a top-level 'root-portal' DOM node, adjacent
|
|
4927
|
+
* the app 'root' div.
|
|
4928
|
+
*
|
|
4929
|
+
* - Must be used within {@link RootPortalProvider | a `<RootPortalProvider />`}
|
|
4098
4930
|
*
|
|
4099
4931
|
* @category Elements Hooks
|
|
4932
|
+
*
|
|
4933
|
+
* @see {@link RootPortalProvider | The associated `provider` for this hook}
|
|
4100
4934
|
*/
|
|
4101
4935
|
const useRootPortal = () => {
|
|
4102
4936
|
const rootPortal = useContext(RootPortalContext);
|
|
@@ -4107,6 +4941,10 @@ const useRootPortal = () => {
|
|
|
4107
4941
|
};
|
|
4108
4942
|
|
|
4109
4943
|
/**
|
|
4944
|
+
* @internal
|
|
4945
|
+
*
|
|
4946
|
+
* # Nested Form Hook Component
|
|
4947
|
+
*
|
|
4110
4948
|
* Returns a nested form element that can be rendered within another form
|
|
4111
4949
|
*
|
|
4112
4950
|
* Handles closing the form on cancel or submission
|
|
@@ -4156,6 +4994,13 @@ const useNestedForm = (form, props) => {
|
|
|
4156
4994
|
|
|
4157
4995
|
const PageLayoutContext = /*#__PURE__*/createContext(undefined);
|
|
4158
4996
|
PageLayoutContext.displayName = "PageLayoutContext";
|
|
4997
|
+
/**
|
|
4998
|
+
* @internal
|
|
4999
|
+
*
|
|
5000
|
+
* # Page Layout Component
|
|
5001
|
+
*
|
|
5002
|
+
* @see {@link PageLayoutProviderProps | The props passed into the `<PageLayoutProvider />` component}
|
|
5003
|
+
*/
|
|
4159
5004
|
const PageLayoutProvider = ({
|
|
4160
5005
|
children
|
|
4161
5006
|
}) => {
|
|
@@ -4206,6 +5051,13 @@ const PageLayoutProvider = ({
|
|
|
4206
5051
|
}))
|
|
4207
5052
|
}));
|
|
4208
5053
|
};
|
|
5054
|
+
/**
|
|
5055
|
+
* @internal
|
|
5056
|
+
*
|
|
5057
|
+
* # Page Layout Hook
|
|
5058
|
+
*
|
|
5059
|
+
* @category Hooks
|
|
5060
|
+
*/
|
|
4209
5061
|
const usePageLayout = () => {
|
|
4210
5062
|
const layoutPortals = useContext(PageLayoutContext);
|
|
4211
5063
|
if (!layoutPortals) {
|
|
@@ -4215,7 +5067,11 @@ const usePageLayout = () => {
|
|
|
4215
5067
|
};
|
|
4216
5068
|
|
|
4217
5069
|
/**
|
|
4218
|
-
*
|
|
5070
|
+
* @internal
|
|
5071
|
+
*
|
|
5072
|
+
* # Run Once On True Hook
|
|
5073
|
+
*
|
|
5074
|
+
* - Runs a callback once and only once when a condition is true.
|
|
4219
5075
|
*
|
|
4220
5076
|
* @param conditionalEffect A logical expression ending with a callback
|
|
4221
5077
|
* @example useRunOnceOnTrue(testValue && anotherTestValue && (() => console.log("Hello world!")));
|
|
@@ -4231,7 +5087,11 @@ const useRunOnceOnTrue = conditionalEffect => {
|
|
|
4231
5087
|
};
|
|
4232
5088
|
|
|
4233
5089
|
/**
|
|
4234
|
-
*
|
|
5090
|
+
* @internal
|
|
5091
|
+
*
|
|
5092
|
+
* # Toggle Hook
|
|
5093
|
+
*
|
|
5094
|
+
* - Create a boolean that can be toggled or set to a specific value
|
|
4235
5095
|
*
|
|
4236
5096
|
* @example
|
|
4237
5097
|
* ```tsx
|
|
@@ -4375,13 +5235,13 @@ var iterate$3 = function (iterable, unboundFunction, options) {
|
|
|
4375
5235
|
} return new Result(false);
|
|
4376
5236
|
};
|
|
4377
5237
|
|
|
4378
|
-
var $$
|
|
5238
|
+
var $$a = _export;
|
|
4379
5239
|
var iterate$2 = iterate$3;
|
|
4380
5240
|
var createProperty = createProperty$2;
|
|
4381
5241
|
|
|
4382
5242
|
// `Object.fromEntries` method
|
|
4383
5243
|
// https://github.com/tc39/proposal-object-from-entries
|
|
4384
|
-
$$
|
|
5244
|
+
$$a({ target: 'Object', stat: true }, {
|
|
4385
5245
|
fromEntries: function fromEntries(iterable) {
|
|
4386
5246
|
var obj = {};
|
|
4387
5247
|
iterate$2(iterable, function (k, v) {
|
|
@@ -4391,6 +5251,13 @@ $$b({ target: 'Object', stat: true }, {
|
|
|
4391
5251
|
}
|
|
4392
5252
|
});
|
|
4393
5253
|
|
|
5254
|
+
/**
|
|
5255
|
+
* @internal
|
|
5256
|
+
*
|
|
5257
|
+
* # Address Validation Hook
|
|
5258
|
+
*
|
|
5259
|
+
* @cateogry Hooks
|
|
5260
|
+
*/
|
|
4394
5261
|
const useAddressValidation = () => {
|
|
4395
5262
|
const [validationPreference, setValidationPreference] = useState();
|
|
4396
5263
|
const {
|
|
@@ -4478,7 +5345,9 @@ const useAddressValidation = () => {
|
|
|
4478
5345
|
* There is a chance that more than one script will be mounted if this hook is used elsewhere.
|
|
4479
5346
|
*/
|
|
4480
5347
|
/**
|
|
4481
|
-
*
|
|
5348
|
+
* @internal
|
|
5349
|
+
*
|
|
5350
|
+
* - Creates an encoded device fingerprint string - aka black box - containing information about the end-user's computing device such as OS, browser, etc.
|
|
4482
5351
|
* https://developer.bazaarvoice.com/conversations-api/deprecations/iovation-web#snare_js_only
|
|
4483
5352
|
*/
|
|
4484
5353
|
const useBlackboxDetection = ({
|
|
@@ -4532,6 +5401,30 @@ const useBlackboxDetection = ({
|
|
|
4532
5401
|
}, [onSuccess, onError]);
|
|
4533
5402
|
};
|
|
4534
5403
|
|
|
5404
|
+
/**
|
|
5405
|
+
* @internal
|
|
5406
|
+
*
|
|
5407
|
+
* # Scrub Errors Hook
|
|
5408
|
+
*
|
|
5409
|
+
* Generic error pretty printer
|
|
5410
|
+
*
|
|
5411
|
+
* @category Hooks
|
|
5412
|
+
*/
|
|
5413
|
+
const useScrubErrors = ({
|
|
5414
|
+
scrubber,
|
|
5415
|
+
errors,
|
|
5416
|
+
predicate
|
|
5417
|
+
}) => {
|
|
5418
|
+
const {
|
|
5419
|
+
t
|
|
5420
|
+
} = useTranslation();
|
|
5421
|
+
return useMemo(() => errors === null || errors === void 0 ? void 0 : errors.map(e => {
|
|
5422
|
+
return t(encode(e.message), {
|
|
5423
|
+
defaultValue: !predicate || predicate(e) ? t(scrubber(e)) : e.message
|
|
5424
|
+
});
|
|
5425
|
+
}), [errors, predicate, scrubber, t]);
|
|
5426
|
+
};
|
|
5427
|
+
|
|
4535
5428
|
const useListConnectedCarriers = () => {
|
|
4536
5429
|
const {
|
|
4537
5430
|
data: carriers,
|
|
@@ -4552,6 +5445,29 @@ const useListConnectedCarriers = () => {
|
|
|
4552
5445
|
};
|
|
4553
5446
|
};
|
|
4554
5447
|
|
|
5448
|
+
/**
|
|
5449
|
+
* # List-Carriers Component
|
|
5450
|
+
*
|
|
5451
|
+
* @param ComponentProps The base props that will be passed into the `<List-Carriers />` component.
|
|
5452
|
+
*
|
|
5453
|
+
* @returns Element A React element that renders the `<List-Carriers />` component allowing users
|
|
5454
|
+
* to view a list of carriers that are connected to their ShipEngine account. This component is
|
|
5455
|
+
* composed in the `<AccountSettings />` Element.
|
|
5456
|
+
*
|
|
5457
|
+
* @example
|
|
5458
|
+
* ```tsx
|
|
5459
|
+
* (() => {
|
|
5460
|
+
* const features = useFeatures("Global");
|
|
5461
|
+
*
|
|
5462
|
+
* return <ListCarriers.Component features={features} />;
|
|
5463
|
+
* })();
|
|
5464
|
+
* ```
|
|
5465
|
+
*
|
|
5466
|
+
* <br />
|
|
5467
|
+
*
|
|
5468
|
+
* @see {@link ListCarriers.ComponentProps | The props that are passed into the `<List-Carriers />` component}
|
|
5469
|
+
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<List-Carriers />` component}
|
|
5470
|
+
*/
|
|
4555
5471
|
const Component$6 = ({
|
|
4556
5472
|
features
|
|
4557
5473
|
}) => {
|
|
@@ -4596,6 +5512,29 @@ var listCarriers$1 = /*#__PURE__*/Object.freeze({
|
|
|
4596
5512
|
Component: Component$6
|
|
4597
5513
|
});
|
|
4598
5514
|
|
|
5515
|
+
/**
|
|
5516
|
+
* # Manage Warehouses Component
|
|
5517
|
+
*
|
|
5518
|
+
* - The `<ManageWarehouses />` component is used to manage warehouses on a user's ShipEngine account. Users can add, update, or make warehouses inactive.
|
|
5519
|
+
* `<AccountSettings />` Element.
|
|
5520
|
+
*
|
|
5521
|
+
* @param ComponentProps The base props that will be passed into the `<ManageWarehouses />` component.
|
|
5522
|
+
*
|
|
5523
|
+
* @returns Element A React element that renders the `<ManageWarehouses />` component allowing users
|
|
5524
|
+
* to manage warehouses on their ShipEngine account.
|
|
5525
|
+
*
|
|
5526
|
+
* @example
|
|
5527
|
+
* ```tsx
|
|
5528
|
+
* export const ManageWarehousesExample = () => {
|
|
5529
|
+
* return <ManageWarehouses.Component />;
|
|
5530
|
+
* };
|
|
5531
|
+
* ```
|
|
5532
|
+
*
|
|
5533
|
+
* <br />
|
|
5534
|
+
*
|
|
5535
|
+
* @see {@link ManageWarehouses.ComponentProps | The props that are passed into the `<ManageWarehouses />` component}
|
|
5536
|
+
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<ManageWarehouses />` component}
|
|
5537
|
+
*/
|
|
4599
5538
|
const Component$5 = ({
|
|
4600
5539
|
onWarehouseAddressValidation
|
|
4601
5540
|
}) => {
|
|
@@ -4682,160 +5621,6 @@ var manageWarehouses$1 = /*#__PURE__*/Object.freeze({
|
|
|
4682
5621
|
Component: Component$5
|
|
4683
5622
|
});
|
|
4684
5623
|
|
|
4685
|
-
var uncurryThis$6 = functionUncurryThis;
|
|
4686
|
-
|
|
4687
|
-
// `thisNumberValue` abstract operation
|
|
4688
|
-
// https://tc39.es/ecma262/#sec-thisnumbervalue
|
|
4689
|
-
var thisNumberValue$1 = uncurryThis$6(1.0.valueOf);
|
|
4690
|
-
|
|
4691
|
-
var toIntegerOrInfinity$1 = toIntegerOrInfinity$6;
|
|
4692
|
-
var toString$5 = toString$c;
|
|
4693
|
-
var requireObjectCoercible$2 = requireObjectCoercible$9;
|
|
4694
|
-
|
|
4695
|
-
var $RangeError$1 = RangeError;
|
|
4696
|
-
|
|
4697
|
-
// `String.prototype.repeat` method implementation
|
|
4698
|
-
// https://tc39.es/ecma262/#sec-string.prototype.repeat
|
|
4699
|
-
var stringRepeat = function repeat(count) {
|
|
4700
|
-
var str = toString$5(requireObjectCoercible$2(this));
|
|
4701
|
-
var result = '';
|
|
4702
|
-
var n = toIntegerOrInfinity$1(count);
|
|
4703
|
-
if (n < 0 || n == Infinity) throw $RangeError$1('Wrong number of repetitions');
|
|
4704
|
-
for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;
|
|
4705
|
-
return result;
|
|
4706
|
-
};
|
|
4707
|
-
|
|
4708
|
-
var $$a = _export;
|
|
4709
|
-
var uncurryThis$5 = functionUncurryThis;
|
|
4710
|
-
var toIntegerOrInfinity = toIntegerOrInfinity$6;
|
|
4711
|
-
var thisNumberValue = thisNumberValue$1;
|
|
4712
|
-
var $repeat = stringRepeat;
|
|
4713
|
-
var fails$4 = fails$q;
|
|
4714
|
-
|
|
4715
|
-
var $RangeError = RangeError;
|
|
4716
|
-
var $String = String;
|
|
4717
|
-
var floor = Math.floor;
|
|
4718
|
-
var repeat = uncurryThis$5($repeat);
|
|
4719
|
-
var stringSlice$2 = uncurryThis$5(''.slice);
|
|
4720
|
-
var nativeToFixed = uncurryThis$5(1.0.toFixed);
|
|
4721
|
-
|
|
4722
|
-
var pow = function (x, n, acc) {
|
|
4723
|
-
return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
|
|
4724
|
-
};
|
|
4725
|
-
|
|
4726
|
-
var log = function (x) {
|
|
4727
|
-
var n = 0;
|
|
4728
|
-
var x2 = x;
|
|
4729
|
-
while (x2 >= 4096) {
|
|
4730
|
-
n += 12;
|
|
4731
|
-
x2 /= 4096;
|
|
4732
|
-
}
|
|
4733
|
-
while (x2 >= 2) {
|
|
4734
|
-
n += 1;
|
|
4735
|
-
x2 /= 2;
|
|
4736
|
-
} return n;
|
|
4737
|
-
};
|
|
4738
|
-
|
|
4739
|
-
var multiply = function (data, n, c) {
|
|
4740
|
-
var index = -1;
|
|
4741
|
-
var c2 = c;
|
|
4742
|
-
while (++index < 6) {
|
|
4743
|
-
c2 += n * data[index];
|
|
4744
|
-
data[index] = c2 % 1e7;
|
|
4745
|
-
c2 = floor(c2 / 1e7);
|
|
4746
|
-
}
|
|
4747
|
-
};
|
|
4748
|
-
|
|
4749
|
-
var divide = function (data, n) {
|
|
4750
|
-
var index = 6;
|
|
4751
|
-
var c = 0;
|
|
4752
|
-
while (--index >= 0) {
|
|
4753
|
-
c += data[index];
|
|
4754
|
-
data[index] = floor(c / n);
|
|
4755
|
-
c = (c % n) * 1e7;
|
|
4756
|
-
}
|
|
4757
|
-
};
|
|
4758
|
-
|
|
4759
|
-
var dataToString = function (data) {
|
|
4760
|
-
var index = 6;
|
|
4761
|
-
var s = '';
|
|
4762
|
-
while (--index >= 0) {
|
|
4763
|
-
if (s !== '' || index === 0 || data[index] !== 0) {
|
|
4764
|
-
var t = $String(data[index]);
|
|
4765
|
-
s = s === '' ? t : s + repeat('0', 7 - t.length) + t;
|
|
4766
|
-
}
|
|
4767
|
-
} return s;
|
|
4768
|
-
};
|
|
4769
|
-
|
|
4770
|
-
var FORCED$2 = fails$4(function () {
|
|
4771
|
-
return nativeToFixed(0.00008, 3) !== '0.000' ||
|
|
4772
|
-
nativeToFixed(0.9, 0) !== '1' ||
|
|
4773
|
-
nativeToFixed(1.255, 2) !== '1.25' ||
|
|
4774
|
-
nativeToFixed(1000000000000000128.0, 0) !== '1000000000000000128';
|
|
4775
|
-
}) || !fails$4(function () {
|
|
4776
|
-
// V8 ~ Android 4.3-
|
|
4777
|
-
nativeToFixed({});
|
|
4778
|
-
});
|
|
4779
|
-
|
|
4780
|
-
// `Number.prototype.toFixed` method
|
|
4781
|
-
// https://tc39.es/ecma262/#sec-number.prototype.tofixed
|
|
4782
|
-
$$a({ target: 'Number', proto: true, forced: FORCED$2 }, {
|
|
4783
|
-
toFixed: function toFixed(fractionDigits) {
|
|
4784
|
-
var number = thisNumberValue(this);
|
|
4785
|
-
var fractDigits = toIntegerOrInfinity(fractionDigits);
|
|
4786
|
-
var data = [0, 0, 0, 0, 0, 0];
|
|
4787
|
-
var sign = '';
|
|
4788
|
-
var result = '0';
|
|
4789
|
-
var e, z, j, k;
|
|
4790
|
-
|
|
4791
|
-
// TODO: ES2018 increased the maximum number of fraction digits to 100, need to improve the implementation
|
|
4792
|
-
if (fractDigits < 0 || fractDigits > 20) throw $RangeError('Incorrect fraction digits');
|
|
4793
|
-
// eslint-disable-next-line no-self-compare -- NaN check
|
|
4794
|
-
if (number != number) return 'NaN';
|
|
4795
|
-
if (number <= -1e21 || number >= 1e21) return $String(number);
|
|
4796
|
-
if (number < 0) {
|
|
4797
|
-
sign = '-';
|
|
4798
|
-
number = -number;
|
|
4799
|
-
}
|
|
4800
|
-
if (number > 1e-21) {
|
|
4801
|
-
e = log(number * pow(2, 69, 1)) - 69;
|
|
4802
|
-
z = e < 0 ? number * pow(2, -e, 1) : number / pow(2, e, 1);
|
|
4803
|
-
z *= 0x10000000000000;
|
|
4804
|
-
e = 52 - e;
|
|
4805
|
-
if (e > 0) {
|
|
4806
|
-
multiply(data, 0, z);
|
|
4807
|
-
j = fractDigits;
|
|
4808
|
-
while (j >= 7) {
|
|
4809
|
-
multiply(data, 1e7, 0);
|
|
4810
|
-
j -= 7;
|
|
4811
|
-
}
|
|
4812
|
-
multiply(data, pow(10, j, 1), 0);
|
|
4813
|
-
j = e - 1;
|
|
4814
|
-
while (j >= 23) {
|
|
4815
|
-
divide(data, 1 << 23);
|
|
4816
|
-
j -= 23;
|
|
4817
|
-
}
|
|
4818
|
-
divide(data, 1 << j);
|
|
4819
|
-
multiply(data, 1, 1);
|
|
4820
|
-
divide(data, 2);
|
|
4821
|
-
result = dataToString(data);
|
|
4822
|
-
} else {
|
|
4823
|
-
multiply(data, 0, z);
|
|
4824
|
-
multiply(data, 1 << -e, 0);
|
|
4825
|
-
result = dataToString(data) + repeat('0', fractDigits);
|
|
4826
|
-
}
|
|
4827
|
-
}
|
|
4828
|
-
if (fractDigits > 0) {
|
|
4829
|
-
k = result.length;
|
|
4830
|
-
result = sign + (k <= fractDigits
|
|
4831
|
-
? '0.' + repeat('0', fractDigits - k) + result
|
|
4832
|
-
: stringSlice$2(result, 0, k - fractDigits) + '.' + stringSlice$2(result, k - fractDigits));
|
|
4833
|
-
} else {
|
|
4834
|
-
result = sign + result;
|
|
4835
|
-
} return result;
|
|
4836
|
-
}
|
|
4837
|
-
});
|
|
4838
|
-
|
|
4839
5624
|
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";
|
|
4840
5625
|
|
|
4841
5626
|
const styles$w = ({
|
|
@@ -5751,6 +6536,11 @@ const icons = {
|
|
|
5751
6536
|
download: IconNames.DOWNLOAD,
|
|
5752
6537
|
retry: IconNames.CIRCULAR_ARROW
|
|
5753
6538
|
};
|
|
6539
|
+
/**
|
|
6540
|
+
* @internal
|
|
6541
|
+
*
|
|
6542
|
+
* # Link Action Component
|
|
6543
|
+
*/
|
|
5754
6544
|
const LinkAction = _a => {
|
|
5755
6545
|
var {
|
|
5756
6546
|
css,
|
|
@@ -5837,6 +6627,22 @@ const ErrorDisplay = () => jsxs("div", Object.assign({
|
|
|
5837
6627
|
}))]
|
|
5838
6628
|
}));
|
|
5839
6629
|
|
|
6630
|
+
/**
|
|
6631
|
+
* @internal
|
|
6632
|
+
*
|
|
6633
|
+
* # Spacer Component Util Function
|
|
6634
|
+
*
|
|
6635
|
+
* - This is a utility function that generates dynamic styles for the `<Spacer />` component.
|
|
6636
|
+
*
|
|
6637
|
+
* @param SpacerProps The base props that will be passed into the `<Spacer />` component at
|
|
6638
|
+
* point of use.
|
|
6639
|
+
*
|
|
6640
|
+
* @return Styles A `SerializedStyles` object that contains styles that can be consumed by
|
|
6641
|
+
* our `ThemeProvider` and `EmotionJSX.Element` components.
|
|
6642
|
+
*
|
|
6643
|
+
* @see {@link Spacer | The `<Spacer />` component that uses these dynamic styles}
|
|
6644
|
+
*
|
|
6645
|
+
*/
|
|
5840
6646
|
const getSpacerStyles = ({
|
|
5841
6647
|
displayOn,
|
|
5842
6648
|
multiplier: _multiplier = 4
|
|
@@ -5850,11 +6656,28 @@ const getSpacerStyles = ({
|
|
|
5850
6656
|
}), {
|
|
5851
6657
|
height: theme.spacing(_multiplier),
|
|
5852
6658
|
width: "100%"
|
|
5853
|
-
}), process.env.NODE_ENV === "production" ? "" : ";label:getSpacerStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
6659
|
+
}), 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== */");
|
|
6660
|
+
/**
|
|
6661
|
+
* @internal
|
|
6662
|
+
*
|
|
6663
|
+
* # Spacer Composition Component
|
|
6664
|
+
*
|
|
6665
|
+
* - The `Spacer` is a composition component used to create a space between elements
|
|
6666
|
+
* in the UI.
|
|
6667
|
+
*
|
|
6668
|
+
* @see {@link Spacer.SpacerProps | The props necessary to render the `<Spacer />` component}
|
|
6669
|
+
* @see {@link Spacer.getSpacerStyles | The util function that generates the styles for the `<Spacer />` component}
|
|
6670
|
+
*
|
|
6671
|
+
*/
|
|
5854
6672
|
const Spacer = props => jsx("div", {
|
|
5855
6673
|
css: getSpacerStyles(props)
|
|
5856
6674
|
});
|
|
5857
6675
|
|
|
6676
|
+
/**
|
|
6677
|
+
* @internal
|
|
6678
|
+
*
|
|
6679
|
+
* # Spread Component
|
|
6680
|
+
*/
|
|
5858
6681
|
const Spread = ({
|
|
5859
6682
|
children
|
|
5860
6683
|
}) => jsx("div", Object.assign({
|
|
@@ -6280,6 +7103,11 @@ const styles$s = createStyles({
|
|
|
6280
7103
|
})
|
|
6281
7104
|
});
|
|
6282
7105
|
|
|
7106
|
+
/**
|
|
7107
|
+
* @namespace WalletHistory
|
|
7108
|
+
*
|
|
7109
|
+
* # Wallet History
|
|
7110
|
+
*/
|
|
6283
7111
|
const WalletHistory = () => {
|
|
6284
7112
|
var _a;
|
|
6285
7113
|
const {
|
|
@@ -6542,6 +7370,11 @@ const LabelLayoutPurchase = ({
|
|
|
6542
7370
|
});
|
|
6543
7371
|
};
|
|
6544
7372
|
|
|
7373
|
+
/**
|
|
7374
|
+
* @internal
|
|
7375
|
+
*
|
|
7376
|
+
* # Loader Component
|
|
7377
|
+
*/
|
|
6545
7378
|
const Loader = props => {
|
|
6546
7379
|
return jsx("div", Object.assign({
|
|
6547
7380
|
css: {
|
|
@@ -6659,7 +7492,7 @@ const SaveStatus = ({
|
|
|
6659
7492
|
}))]
|
|
6660
7493
|
}));
|
|
6661
7494
|
}
|
|
6662
|
-
return !isSaving && !errors ? jsxs("div", Object.assign({
|
|
7495
|
+
return !isSaving && !(errors === null || errors === void 0 ? void 0 : errors.length) ? jsxs("div", Object.assign({
|
|
6663
7496
|
css: styles$r.container
|
|
6664
7497
|
}, {
|
|
6665
7498
|
children: [jsx("svg", Object.assign({
|
|
@@ -6723,6 +7556,16 @@ const styles$q = createStyles({
|
|
|
6723
7556
|
})
|
|
6724
7557
|
});
|
|
6725
7558
|
|
|
7559
|
+
/**
|
|
7560
|
+
* @internal
|
|
7561
|
+
*
|
|
7562
|
+
* # Collapsible Panel Component
|
|
7563
|
+
*
|
|
7564
|
+
* - The `<CollapsiblePanel />` composition component is used to group content together that can
|
|
7565
|
+
* be expanded or collapsed.
|
|
7566
|
+
*
|
|
7567
|
+
* @see {@link CollapsiblePanelProps | The props that are passed into the `<CollapsiblePanel />` component}
|
|
7568
|
+
*/
|
|
6726
7569
|
const CollapsiblePanel = ({
|
|
6727
7570
|
errors,
|
|
6728
7571
|
initialExpanded,
|
|
@@ -6970,6 +7813,11 @@ const LabelLayoutSettings = ({
|
|
|
6970
7813
|
}));
|
|
6971
7814
|
};
|
|
6972
7815
|
|
|
7816
|
+
/**
|
|
7817
|
+
* @namespace LabelLayout
|
|
7818
|
+
*
|
|
7819
|
+
* # Label Layout Component
|
|
7820
|
+
*/
|
|
6973
7821
|
const LabelLayout = ({
|
|
6974
7822
|
display
|
|
6975
7823
|
}) => {
|
|
@@ -7002,6 +7850,16 @@ const LabelLayout = ({
|
|
|
7002
7850
|
});
|
|
7003
7851
|
};
|
|
7004
7852
|
|
|
7853
|
+
/**
|
|
7854
|
+
* @internal
|
|
7855
|
+
*
|
|
7856
|
+
* # Button Group Component
|
|
7857
|
+
*
|
|
7858
|
+
* - The `<ButtonGroup />` is a composition component used to group buttons together that are
|
|
7859
|
+
* passed in as children.
|
|
7860
|
+
*
|
|
7861
|
+
* @see {@link ButtonGroupProps | The props that are passed into the `<ButtonGroup />` component}
|
|
7862
|
+
*/
|
|
7005
7863
|
const ButtonGroup = _a => {
|
|
7006
7864
|
var {
|
|
7007
7865
|
children,
|
|
@@ -7038,6 +7896,11 @@ const ButtonGroup = _a => {
|
|
|
7038
7896
|
}));
|
|
7039
7897
|
};
|
|
7040
7898
|
|
|
7899
|
+
/**
|
|
7900
|
+
* @internal
|
|
7901
|
+
*
|
|
7902
|
+
* # Field Label Component
|
|
7903
|
+
*/
|
|
7041
7904
|
const FieldLabel = ({
|
|
7042
7905
|
children,
|
|
7043
7906
|
label,
|
|
@@ -8168,6 +9031,19 @@ const getAcknowledgementLabel = (serviceCode, packageType) => {
|
|
|
8168
9031
|
});
|
|
8169
9032
|
}
|
|
8170
9033
|
return;
|
|
9034
|
+
case "dhl_express_worldwide":
|
|
9035
|
+
return jsxs(Trans, Object.assign({
|
|
9036
|
+
i18nKey: "purchase-label:rates.dhlExpressTermsAcknowledgement"
|
|
9037
|
+
}, {
|
|
9038
|
+
children: ["To start shipping with DHL, you are confirming that you have agreed to the ", jsx(Link, Object.assign({
|
|
9039
|
+
href: "https://mydhl.express.dhl/us/en/legal/terms-and-conditions.html",
|
|
9040
|
+
isExternal: true,
|
|
9041
|
+
rel: "noreferrer",
|
|
9042
|
+
target: "_blank"
|
|
9043
|
+
}, {
|
|
9044
|
+
children: "terms and conditions"
|
|
9045
|
+
}))]
|
|
9046
|
+
}));
|
|
8171
9047
|
default:
|
|
8172
9048
|
return null;
|
|
8173
9049
|
}
|
|
@@ -8579,6 +9455,10 @@ var fields = /*#__PURE__*/Object.freeze({
|
|
|
8579
9455
|
});
|
|
8580
9456
|
|
|
8581
9457
|
/**
|
|
9458
|
+
* @internal
|
|
9459
|
+
*
|
|
9460
|
+
* # Form Portal Component
|
|
9461
|
+
*
|
|
8582
9462
|
* A drop-in replacement for the `<form>` tag that allows nested forms.
|
|
8583
9463
|
*
|
|
8584
9464
|
* Via portals, the <form> tag is mounted as a sibling of the app root. The form's
|
|
@@ -8648,6 +9528,10 @@ const styles$o = createStyles({
|
|
|
8648
9528
|
});
|
|
8649
9529
|
|
|
8650
9530
|
/**
|
|
9531
|
+
* @internal
|
|
9532
|
+
*
|
|
9533
|
+
* # Money Schema
|
|
9534
|
+
*
|
|
8651
9535
|
* @category Form Validation
|
|
8652
9536
|
*/
|
|
8653
9537
|
const moneySchema = z.object({
|
|
@@ -8656,14 +9540,33 @@ const moneySchema = z.object({
|
|
|
8656
9540
|
});
|
|
8657
9541
|
|
|
8658
9542
|
/**
|
|
9543
|
+
* @internal
|
|
9544
|
+
*
|
|
9545
|
+
* # Phone utils
|
|
9546
|
+
*
|
|
8659
9547
|
* @category Form Validation
|
|
8660
9548
|
*/
|
|
8661
9549
|
const phoneSchema = (defaultCountryCode = "US") => z.string().trim().refine(val => isValidPhoneNumber(val, defaultCountryCode), "schemaErrors.notAValidPhoneNumber");
|
|
8662
9550
|
/**
|
|
9551
|
+
* @internal
|
|
9552
|
+
*
|
|
9553
|
+
* # Phone utils
|
|
9554
|
+
*
|
|
8663
9555
|
* @category Form Validation
|
|
8664
9556
|
*/
|
|
8665
9557
|
const phoneSchemaUnvalidated = z.string().trim();
|
|
8666
9558
|
|
|
9559
|
+
/**
|
|
9560
|
+
* @internal
|
|
9561
|
+
*
|
|
9562
|
+
* # Add Funds Form Schema
|
|
9563
|
+
*
|
|
9564
|
+
* - A util function to create a dynamic form schema based on the mininum amount
|
|
9565
|
+
* passed into the function.
|
|
9566
|
+
*
|
|
9567
|
+
* @param minimumAmount - The minimum amount that can be added to the account. This defaults to
|
|
9568
|
+
* 10 if nothing is passed in.
|
|
9569
|
+
*/
|
|
8667
9570
|
const getAddFundsSchema = (minimumAmount = 10) => z.object({
|
|
8668
9571
|
funds: moneySchema.extend({
|
|
8669
9572
|
amount: z.number().min(minimumAmount)
|
|
@@ -8671,9 +9574,15 @@ const getAddFundsSchema = (minimumAmount = 10) => z.object({
|
|
|
8671
9574
|
}).transform(data => data.funds);
|
|
8672
9575
|
|
|
8673
9576
|
/**
|
|
8674
|
-
*
|
|
9577
|
+
* @internal
|
|
9578
|
+
*
|
|
9579
|
+
* # Add Funds Form Component
|
|
9580
|
+
*
|
|
9581
|
+
* - Form for adding funds to a carrier's account.
|
|
8675
9582
|
*
|
|
8676
|
-
* If a render child is provided, external control is assumed and the cancel / submit buttons are hidden.
|
|
9583
|
+
* If a `render child` is provided, external control is assumed and the cancel / submit buttons are hidden.
|
|
9584
|
+
*
|
|
9585
|
+
* @see {@link AddFundsFormProps | The props that are passed into the `<AddFundsForm />` component}
|
|
8677
9586
|
*/
|
|
8678
9587
|
const AddFundsForm = ({
|
|
8679
9588
|
carrierId,
|
|
@@ -8815,7 +9724,16 @@ const AddFundsForm = ({
|
|
|
8815
9724
|
}))]
|
|
8816
9725
|
}))]
|
|
8817
9726
|
})]
|
|
8818
|
-
})), children
|
|
9727
|
+
})), !children && addFunds.error && jsxs(Fragment, {
|
|
9728
|
+
children: [jsx(Spacer, {
|
|
9729
|
+
multiplier: 1
|
|
9730
|
+
}), jsx(InlineNotification, Object.assign({
|
|
9731
|
+
title: t("manage-funding:addFunds.error.title"),
|
|
9732
|
+
type: NotificationType.ERROR
|
|
9733
|
+
}, {
|
|
9734
|
+
children: addFunds.error[0].message
|
|
9735
|
+
}))]
|
|
9736
|
+
}), children === null || children === void 0 ? void 0 : children({
|
|
8819
9737
|
error: addFunds.error,
|
|
8820
9738
|
isCustomAmount: selectedChip.value === "custom",
|
|
8821
9739
|
isSubmitted,
|
|
@@ -8846,6 +9764,13 @@ const styles$n = createStyles({
|
|
|
8846
9764
|
}
|
|
8847
9765
|
});
|
|
8848
9766
|
|
|
9767
|
+
/**
|
|
9768
|
+
* @internal
|
|
9769
|
+
*
|
|
9770
|
+
* # Auto Funding Form Schema
|
|
9771
|
+
*
|
|
9772
|
+
* @see {@link AutoFundingForm | Auto Funding Form component using this schema}
|
|
9773
|
+
* */
|
|
8849
9774
|
const autoFundingSchema = z.object({
|
|
8850
9775
|
isEnabled: z.boolean(),
|
|
8851
9776
|
lowBalancePurchaseThreshold: moneySchema.extend({
|
|
@@ -8858,10 +9783,19 @@ const autoFundingSchema = z.object({
|
|
|
8858
9783
|
});
|
|
8859
9784
|
|
|
8860
9785
|
/**
|
|
9786
|
+
* @internal
|
|
9787
|
+
*
|
|
9788
|
+
* # Auto Funding Form Component
|
|
9789
|
+
*
|
|
8861
9790
|
* This form that allows users to enable or disable auto funding, and
|
|
8862
9791
|
* configure auto funding rules in ShipEngine API.
|
|
8863
9792
|
*
|
|
8864
9793
|
* @param carrierId The carrierId of the carrier provider you wish to configure auto-funding rules for.
|
|
9794
|
+
*
|
|
9795
|
+
* @returns Element A React element that renders the Auto Funding Form allowing users to configure
|
|
9796
|
+
* auto-funding rules for a given carrier provider.
|
|
9797
|
+
*
|
|
9798
|
+
* @see {@link AutoFundingFormProps | The props that are passed into the `<AutoFundingForm />` component}
|
|
8865
9799
|
*/
|
|
8866
9800
|
const AutoFundingForm = ({
|
|
8867
9801
|
carrierId
|
|
@@ -9038,6 +9972,11 @@ const styles$m = isLabelRight => createStyles({
|
|
|
9038
9972
|
})
|
|
9039
9973
|
});
|
|
9040
9974
|
|
|
9975
|
+
/**
|
|
9976
|
+
* @internal
|
|
9977
|
+
*
|
|
9978
|
+
* # Inline Label Component
|
|
9979
|
+
*/
|
|
9041
9980
|
const InlineLabel = ({
|
|
9042
9981
|
children,
|
|
9043
9982
|
label,
|
|
@@ -9057,6 +9996,16 @@ const styles$l = createStyles({
|
|
|
9057
9996
|
})
|
|
9058
9997
|
});
|
|
9059
9998
|
|
|
9999
|
+
/**
|
|
10000
|
+
* @internal
|
|
10001
|
+
*
|
|
10002
|
+
* # Carrier Balance
|
|
10003
|
+
*
|
|
10004
|
+
* - The `<CarrierBalance />` component is used to display the current balance for a given
|
|
10005
|
+
* carrier provider.
|
|
10006
|
+
*
|
|
10007
|
+
* @see {@link CarrierBalanceProps | The props for the `<CarrierBalance />` component}
|
|
10008
|
+
*/
|
|
9060
10009
|
const CarrierBalance = ({
|
|
9061
10010
|
balance,
|
|
9062
10011
|
carrierId
|
|
@@ -9086,6 +10035,22 @@ const CarrierBalance = ({
|
|
|
9086
10035
|
}));
|
|
9087
10036
|
};
|
|
9088
10037
|
|
|
10038
|
+
/**
|
|
10039
|
+
* @namespace ManageFunding
|
|
10040
|
+
*
|
|
10041
|
+
* # Manage Funding Component
|
|
10042
|
+
*
|
|
10043
|
+
* - The `<ManageFunding />` component is used to manage funding rules and add funds to a carrier
|
|
10044
|
+
* account, and is composed in the `<AccountSettings />` component.
|
|
10045
|
+
*
|
|
10046
|
+
* @param ManageFundingProps The base props that will be passed into the `<ManageFunding />` component.
|
|
10047
|
+
*
|
|
10048
|
+
* @returns Element A React element that renders the `<ManageFunding />` component allowing users
|
|
10049
|
+
* manage funding rules and add funds to their carrier accounts.
|
|
10050
|
+
*
|
|
10051
|
+
* @see {@link ManageFundingProps | The props that are passed into the `<ManageFunding />` component}
|
|
10052
|
+
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<ManageFunding />` component}
|
|
10053
|
+
*/
|
|
9089
10054
|
const ManageFunding = ({
|
|
9090
10055
|
carrierId
|
|
9091
10056
|
}) => {
|
|
@@ -9219,7 +10184,7 @@ const styles$k = createStyles({
|
|
|
9219
10184
|
flex: "1 0 100%"
|
|
9220
10185
|
},
|
|
9221
10186
|
display: "flex",
|
|
9222
|
-
flex: "1 0
|
|
10187
|
+
flex: "1 0 64%",
|
|
9223
10188
|
width: "100%"
|
|
9224
10189
|
},
|
|
9225
10190
|
stateZipWrapper: theme => ({
|
|
@@ -9249,7 +10214,10 @@ const AddressFields = ({
|
|
|
9249
10214
|
const {
|
|
9250
10215
|
t
|
|
9251
10216
|
} = useTranslation();
|
|
9252
|
-
const
|
|
10217
|
+
const {
|
|
10218
|
+
countryCodeOptions,
|
|
10219
|
+
defaultCountryCodeOption
|
|
10220
|
+
} = useCountryCodeOptions(domestic);
|
|
9253
10221
|
const stateCodeOptions = useStateCodeOptions(domestic);
|
|
9254
10222
|
const {
|
|
9255
10223
|
isSubmitted
|
|
@@ -9273,6 +10241,7 @@ const AddressFields = ({
|
|
|
9273
10241
|
nativeLabel: true
|
|
9274
10242
|
}), jsx(SelectAutoComplete, {
|
|
9275
10243
|
control: form.control,
|
|
10244
|
+
defaultValue: defaultCountryCodeOption === null || defaultCountryCodeOption === void 0 ? void 0 : defaultCountryCodeOption.value,
|
|
9276
10245
|
form: formId,
|
|
9277
10246
|
label: t("address.fields.countryCode"),
|
|
9278
10247
|
labelWeight: "normal",
|
|
@@ -9421,6 +10390,10 @@ function nullishDefault(defaultValue) {
|
|
|
9421
10390
|
return this.nullish().transform(v => v !== null && v !== void 0 ? v : defaultValue);
|
|
9422
10391
|
}
|
|
9423
10392
|
/**
|
|
10393
|
+
* @internal
|
|
10394
|
+
*
|
|
10395
|
+
* # Form Utilities
|
|
10396
|
+
*
|
|
9424
10397
|
* @category Form Validation
|
|
9425
10398
|
*/
|
|
9426
10399
|
const extendZod = () => {
|
|
@@ -9836,7 +10809,7 @@ const AddressPreferenceSelect = ({
|
|
|
9836
10809
|
warehousePreference: originAddress
|
|
9837
10810
|
})]
|
|
9838
10811
|
})), returnAddress && jsxs(GridChild, Object.assign({
|
|
9839
|
-
colSpan:
|
|
10812
|
+
colSpan: 12
|
|
9840
10813
|
}, {
|
|
9841
10814
|
children: [jsx(Typography, Object.assign({
|
|
9842
10815
|
css: {
|
|
@@ -9884,6 +10857,7 @@ const AddressPreferenceProvider = props => {
|
|
|
9884
10857
|
onSubmit
|
|
9885
10858
|
} = props;
|
|
9886
10859
|
const [passengerData, setPassengerData] = useState();
|
|
10860
|
+
const [userInput, setUserInput] = useState();
|
|
9887
10861
|
const {
|
|
9888
10862
|
validate: validateAddress,
|
|
9889
10863
|
validationPreference,
|
|
@@ -9895,6 +10869,7 @@ const AddressPreferenceProvider = props => {
|
|
|
9895
10869
|
onValid,
|
|
9896
10870
|
data
|
|
9897
10871
|
} = payload;
|
|
10872
|
+
setUserInput(addresses);
|
|
9898
10873
|
const validationPreference = yield validateAddress(addresses);
|
|
9899
10874
|
const {
|
|
9900
10875
|
originAddress,
|
|
@@ -9928,6 +10903,7 @@ const AddressPreferenceProvider = props => {
|
|
|
9928
10903
|
return jsx(AddressPreferenceContext.Provider, Object.assign({
|
|
9929
10904
|
value: {
|
|
9930
10905
|
data: passengerData,
|
|
10906
|
+
userInput,
|
|
9931
10907
|
validateAddress: internalValidateAddress,
|
|
9932
10908
|
validationPreference
|
|
9933
10909
|
}
|
|
@@ -10181,7 +11157,7 @@ const WalletForm = ({
|
|
|
10181
11157
|
resolver: validationResolver(walletSchema)
|
|
10182
11158
|
});
|
|
10183
11159
|
useBlackboxDetection({
|
|
10184
|
-
onError: () => {
|
|
11160
|
+
onError: useCallback(() => {
|
|
10185
11161
|
setCodedErrors(errors => {
|
|
10186
11162
|
const blackBoxError = {
|
|
10187
11163
|
errorCode: "unspecified",
|
|
@@ -10191,8 +11167,8 @@ const WalletForm = ({
|
|
|
10191
11167
|
};
|
|
10192
11168
|
return [...(errors !== null && errors !== void 0 ? errors : []), blackBoxError];
|
|
10193
11169
|
});
|
|
10194
|
-
},
|
|
10195
|
-
onSuccess: bb => form.setValue("iovationBlackbox", bb)
|
|
11170
|
+
}, [setCodedErrors]),
|
|
11171
|
+
onSuccess: useCallback(bb => form.setValue("iovationBlackbox", bb), [form.setValue])
|
|
10196
11172
|
});
|
|
10197
11173
|
const watchAddress = form.watch("address");
|
|
10198
11174
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -10588,6 +11564,25 @@ const WalletCard = ({
|
|
|
10588
11564
|
}));
|
|
10589
11565
|
};
|
|
10590
11566
|
|
|
11567
|
+
/**
|
|
11568
|
+
* # Payment Method Settings Component
|
|
11569
|
+
*
|
|
11570
|
+
* - The `<PaymentMethodSettings />` component is used to manage the users payment information
|
|
11571
|
+
* and is composed in the `<AccountSettings />` component. For example, users can update their
|
|
11572
|
+
* billing information.
|
|
11573
|
+
*
|
|
11574
|
+
* @returns Elements A React element that renders the `<PaymentMethodSettings />` component
|
|
11575
|
+
* allowing uses to configure their payment settings.
|
|
11576
|
+
*
|
|
11577
|
+
* @example
|
|
11578
|
+
* ```tsx
|
|
11579
|
+
* <PaymentMethodSettings />
|
|
11580
|
+
* ```
|
|
11581
|
+
*
|
|
11582
|
+
* <br />
|
|
11583
|
+
*
|
|
11584
|
+
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<PaymentMethodSettings />` component}
|
|
11585
|
+
*/
|
|
10591
11586
|
const PaymentMethodSettings = () => {
|
|
10592
11587
|
var _a;
|
|
10593
11588
|
const {
|
|
@@ -10670,6 +11665,14 @@ const styles$f = createStyles({
|
|
|
10670
11665
|
}
|
|
10671
11666
|
});
|
|
10672
11667
|
|
|
11668
|
+
/**
|
|
11669
|
+
* @internal
|
|
11670
|
+
*
|
|
11671
|
+
* # Powered By ShipEngine Component
|
|
11672
|
+
*
|
|
11673
|
+
* - The `<PoweredByShipEngine />` composition component is used to render the
|
|
11674
|
+
* "Powered By ShipEngine" logo throughout the various elements.
|
|
11675
|
+
*/
|
|
10673
11676
|
const PoweredByShipEngine = () => {
|
|
10674
11677
|
const {
|
|
10675
11678
|
t
|
|
@@ -10685,6 +11688,11 @@ const PoweredByShipEngine = () => {
|
|
|
10685
11688
|
}));
|
|
10686
11689
|
};
|
|
10687
11690
|
|
|
11691
|
+
/**
|
|
11692
|
+
* @namespace UnitSettings
|
|
11693
|
+
*
|
|
11694
|
+
* # Unit Settings Component
|
|
11695
|
+
*/
|
|
10688
11696
|
const UnitSettings = () => {
|
|
10689
11697
|
const {
|
|
10690
11698
|
t
|
|
@@ -11641,7 +12649,9 @@ const CustomsItemForm = ({
|
|
|
11641
12649
|
const {
|
|
11642
12650
|
t
|
|
11643
12651
|
} = useTranslation();
|
|
11644
|
-
const
|
|
12652
|
+
const {
|
|
12653
|
+
countryCodeOptions
|
|
12654
|
+
} = useCountryCodeOptions();
|
|
11645
12655
|
const form = useForm({
|
|
11646
12656
|
defaultValues: customsItem ? {
|
|
11647
12657
|
countryOfOrigin: customsItem.countryOfOrigin,
|
|
@@ -11747,6 +12757,10 @@ const CustomsItemForm = ({
|
|
|
11747
12757
|
};
|
|
11748
12758
|
|
|
11749
12759
|
/**
|
|
12760
|
+
* @internal
|
|
12761
|
+
*
|
|
12762
|
+
* # Copy Button
|
|
12763
|
+
*
|
|
11750
12764
|
* A copy button that copies the content to the users' clipboard and displays a
|
|
11751
12765
|
* checkmark on click.
|
|
11752
12766
|
*/
|
|
@@ -12319,12 +13333,15 @@ const WarehouseForm = ({
|
|
|
12319
13333
|
submitButtonTitle,
|
|
12320
13334
|
warehouse
|
|
12321
13335
|
}) => {
|
|
13336
|
+
var _a, _b;
|
|
12322
13337
|
const {
|
|
12323
13338
|
t
|
|
12324
13339
|
} = useTranslation(["common", "manage-warehouses"]);
|
|
12325
13340
|
const {
|
|
12326
|
-
validateAddress
|
|
13341
|
+
validateAddress,
|
|
13342
|
+
userInput
|
|
12327
13343
|
} = useAddressPreference();
|
|
13344
|
+
const hasDefaultValues = !!warehouse || !!userInput;
|
|
12328
13345
|
const form = useForm({
|
|
12329
13346
|
defaultValues: warehouse ? Object.assign(Object.assign({}, warehouse), {
|
|
12330
13347
|
isDefault: warehouse.isDefault,
|
|
@@ -12335,6 +13352,14 @@ const WarehouseForm = ({
|
|
|
12335
13352
|
countryCode: warehouse.returnAddress.countryCode
|
|
12336
13353
|
}),
|
|
12337
13354
|
returnToAddressIsDifferent: !isEqual(warehouse.originAddress, warehouse.returnAddress)
|
|
13355
|
+
}) : userInput ? Object.assign(Object.assign({}, userInput), {
|
|
13356
|
+
originAddress: Object.assign(Object.assign({}, userInput.originAddress), {
|
|
13357
|
+
countryCode: userInput.originAddress.countryCode
|
|
13358
|
+
}),
|
|
13359
|
+
returnAddress: Object.assign(Object.assign({}, userInput.returnAddress), {
|
|
13360
|
+
countryCode: (_a = userInput.returnAddress) === null || _a === void 0 ? void 0 : _a.countryCode
|
|
13361
|
+
}),
|
|
13362
|
+
returnToAddressIsDifferent: (_b = !!userInput.returnAddress) !== null && _b !== void 0 ? _b : false
|
|
12338
13363
|
}) : {
|
|
12339
13364
|
isDefault: _isOnboarding ? true : false,
|
|
12340
13365
|
originAddress: {
|
|
@@ -12345,8 +13370,8 @@ const WarehouseForm = ({
|
|
|
12345
13370
|
resolver: validationResolver(warehouseSchema)
|
|
12346
13371
|
});
|
|
12347
13372
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
12348
|
-
const
|
|
12349
|
-
payload = __rest(
|
|
13373
|
+
const _c = values,
|
|
13374
|
+
payload = __rest(_c, ["returnToAddressIsDifferent"]);
|
|
12350
13375
|
yield validateAddress({
|
|
12351
13376
|
addresses: payload,
|
|
12352
13377
|
data: {
|
|
@@ -12375,12 +13400,6 @@ const WarehouseForm = ({
|
|
|
12375
13400
|
form: form,
|
|
12376
13401
|
formatFieldName: fieldName => `originAddress.${fieldName}`,
|
|
12377
13402
|
optionalFields: ["addressLine2"]
|
|
12378
|
-
}), jsx(CheckboxInput, {
|
|
12379
|
-
checkboxLabel: t("manage-warehouses:residentialAddress"),
|
|
12380
|
-
control: form.control,
|
|
12381
|
-
form: "warehouse-form",
|
|
12382
|
-
label: "originAddress.addressResidentialIndicator",
|
|
12383
|
-
name: "originAddress.addressResidentialIndicator"
|
|
12384
13403
|
}), !_isOnboarding && jsx(CheckboxInput, {
|
|
12385
13404
|
checkboxLabel: t("manage-warehouses:isDefault"),
|
|
12386
13405
|
control: form.control,
|
|
@@ -12408,18 +13427,12 @@ const WarehouseForm = ({
|
|
|
12408
13427
|
});
|
|
12409
13428
|
}
|
|
12410
13429
|
}
|
|
12411
|
-
}), form.watch("returnToAddressIsDifferent") &&
|
|
12412
|
-
children:
|
|
13430
|
+
}), form.watch("returnToAddressIsDifferent") && jsx(Fragment, {
|
|
13431
|
+
children: jsx(AddressFields, {
|
|
12413
13432
|
form: form,
|
|
12414
13433
|
formatFieldName: fieldName => `returnAddress.${fieldName}`,
|
|
12415
13434
|
optionalFields: ["addressLine2"]
|
|
12416
|
-
})
|
|
12417
|
-
checkboxLabel: t("manage-warehouses:residentialAddress"),
|
|
12418
|
-
control: form.control,
|
|
12419
|
-
form: "warehouse-form",
|
|
12420
|
-
label: "returnAddress.addressResidentialIndicator",
|
|
12421
|
-
name: "returnAddress.addressResidentialIndicator"
|
|
12422
|
-
})]
|
|
13435
|
+
})
|
|
12423
13436
|
}), jsxs(ButtonGroup, Object.assign({
|
|
12424
13437
|
justify: "center"
|
|
12425
13438
|
}, {
|
|
@@ -12444,7 +13457,7 @@ const WarehouseForm = ({
|
|
|
12444
13457
|
control: form.control,
|
|
12445
13458
|
"data-testid": "warehouseFormSubmitButton",
|
|
12446
13459
|
form: "warehouse-form",
|
|
12447
|
-
requireDirty: !
|
|
13460
|
+
requireDirty: !hasDefaultValues,
|
|
12448
13461
|
variant: _isOnboarding ? ButtonVariant.FILLED : ButtonVariant.OUTLINED
|
|
12449
13462
|
}, {
|
|
12450
13463
|
children: submitButtonTitle
|
|
@@ -13043,6 +14056,15 @@ const Onboarding = ({
|
|
|
13043
14056
|
let _ = t => t,
|
|
13044
14057
|
_t,
|
|
13045
14058
|
_t2;
|
|
14059
|
+
/**
|
|
14060
|
+
* @internal
|
|
14061
|
+
*
|
|
14062
|
+
* # Cube Component
|
|
14063
|
+
*
|
|
14064
|
+
* - This is a spinning cube that is used to display a loading state.
|
|
14065
|
+
*
|
|
14066
|
+
* @see {@link CubePropTypes | The props that are passed into the `<Cube />` component}
|
|
14067
|
+
*/
|
|
13046
14068
|
const Cube = _a => {
|
|
13047
14069
|
var {
|
|
13048
14070
|
animate = false
|
|
@@ -13070,7 +14092,7 @@ const Cube = _a => {
|
|
|
13070
14092
|
const styles = {
|
|
13071
14093
|
bounce: /*#__PURE__*/css(Object.assign({}, animate && {
|
|
13072
14094
|
animation: `${bounce} 1s infinite`
|
|
13073
|
-
}), process.env.NODE_ENV === "production" ? "" : ";label:bounce;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
14095
|
+
}), process.env.NODE_ENV === "production" ? "" : ";label:bounce;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImN1YmUudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWtDZ0IiLCJmaWxlIjoiY3ViZS50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBfX3Jlc3QgfSBmcm9tIFwidHNsaWJcIjtcclxuaW1wb3J0IHsganN4IGFzIF9qc3ggfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3QvanN4LXJ1bnRpbWVcIjtcclxuaW1wb3J0IHsgY3NzLCBrZXlmcmFtZXMsIHVzZVRoZW1lIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XHJcbi8qKlxyXG4gKiBAaW50ZXJuYWxcclxuICpcclxuICogIyBDdWJlIENvbXBvbmVudFxyXG4gKlxyXG4gKiAtIFRoaXMgaXMgYSBzcGlubmluZyBjdWJlIHRoYXQgaXMgdXNlZCB0byBkaXNwbGF5IGEgbG9hZGluZyBzdGF0ZS5cclxuICpcclxuICogQHNlZSB7QGxpbmsgQ3ViZVByb3BUeXBlcyB8IFRoZSBwcm9wcyB0aGF0IGFyZSBwYXNzZWQgaW50byB0aGUgYDxDdWJlIC8+YCBjb21wb25lbnR9XHJcbiAqL1xyXG5leHBvcnQgY29uc3QgQ3ViZSA9IChfYSkgPT4ge1xyXG4gICAgdmFyIHsgYW5pbWF0ZSA9IGZhbHNlIH0gPSBfYSwgcHJvcHMgPSBfX3Jlc3QoX2EsIFtcImFuaW1hdGVcIl0pO1xyXG4gICAgY29uc3QgdGhlbWUgPSB1c2VUaGVtZSgpO1xyXG4gICAgY29uc3QgYm91bmNlID0ga2V5ZnJhbWVzIGBcbiAgICAwJSwgMTAwJSB7XG4gICAgICB0cmFuc2Zvcm06IHRyYW5zbGF0ZVkoLTI1JSk7XG4gICAgICBhbmltYXRpb24tdGltaW5nLWZ1bmN0aW9uOiBjdWJpYy1iZXppZXIoMC44LCAwLCAxLCAxKTtcbiAgICB9XG4gICAgNTAlIHtcbiAgICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgwKTtcbiAgICAgIGFuaW1hdGlvbi10aW1pbmctZnVuY3Rpb246IGN1YmljLWJlemllcigwLCAwLCAwLjIsIDEpO1xuICAgIH1cbiAgYDtcclxuICAgIGNvbnN0IHNwaW4gPSBrZXlmcmFtZXMgYFxuICAgIGZyb20ge1xuICAgICAgdHJhbnNmb3JtOiByb3RhdGUoMGRlZyk7XG4gICAgfVxuICAgIHRvIHtcbiAgICAgIHRyYW5zZm9ybTogcm90YXRlKDM2MGRlZyk7XG4gICAgfVxuICBgO1xyXG4gICAgY29uc3Qgc3R5bGVzID0ge1xyXG4gICAgICAgIGJvdW5jZTogY3NzKE9iamVjdC5hc3NpZ24oe30sIChhbmltYXRlICYmIHsgYW5pbWF0aW9uOiBgJHtib3VuY2V9IDFzIGluZmluaXRlYCB9KSkpLFxyXG4gICAgICAgIGNvbnRlbnQ6IGNzcyhPYmplY3QuYXNzaWduKHsgY2xpcFJ1bGU6IFwiZXZlbm9kZFwiLCBmaWxsUnVsZTogXCJldmVub2RkXCIsIGhlaWdodDogXCI1cmVtXCIsIHN0cm9rZUxpbmVKb2luOiBcInJvdW5kXCIsIHN0cm9rZU1pdGVyTGltaXQ6IFwiMlwiLCB3aWR0aDogXCI1cmVtXCIgfSwgKGFuaW1hdGUgJiYgeyBhbmltYXRpb246IGAke3NwaW59IDFzIGxpbmVhciBpbmZpbml0ZTtgIH0pKSksXHJcbiAgICB9O1xyXG4gICAgcmV0dXJuIChfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IHN0eWxlcy5ib3VuY2UgfSwgcHJvcHMsIHsgcm9sZTogXCJzdGF0dXNcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwic3ZnXCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IHN0eWxlcy5jb250ZW50LCBoZWlnaHQ6IFwiMTAwJVwiLCB2aWV3Qm94OiBcIjAgMCA0ODkgNDg5XCIsIHdpZHRoOiBcIjEwMCVcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwiZ1wiLCB7IGNoaWxkcmVuOiBfanN4KFwiZ1wiLCB7IGNoaWxkcmVuOiBfanN4KFwicGF0aFwiLCB7IGQ6IFwiTTQ4My42NzQsMTAxLjgzNkM0ODMuNjEsMTAxLjYwNCA0ODMuNTA2LDEwMS4zOTYgNDgzLjQxOCwxMDEuMThDNDgzLjI0MiwxMDAuNzI0IDQ4My4wNSwxMDAuMjg0IDQ4Mi43OTQsOTkuODY4QzQ4Mi42NSw5OS42MzYgNDgyLjQ5OCw5OS40MjggNDgyLjMzLDk5LjIxMkM0ODIuMDU4LDk4Ljg0NCA0ODEuNzU0LDk4LjUwOCA0ODEuNDEsOTguMTk2QzQ4MS4yMSw5OC4wMDQgNDgxLjAxLDk3LjgyOCA0ODAuNzg2LDk3LjY2QzQ4MC42NTgsOTcuNTY0IDQ4MC41NjIsOTcuNDQ0IDQ4MC40MzQsOTcuMzU2QzQ4MC4xMzgsOTcuMTU2IDQ3OS44MSw5Ny4wNDQgNDc5LjQ5OCw5Ni44ODRDNDc5LjMzOCw5Ni44MDQgNDc5LjIxOCw5Ni42ODQgNDc5LjA1LDk2LjYxMkwyNDcuMDUsMC42MTJDMjQ1LjA4MiwtMC4yMDQgMjQyLjg5LC0wLjIwNCAyNDAuOTIyLDAuNjEyTDguOTIyLDk2LjYxMkM4Ljc1NCw5Ni42ODQgOC42MjYsOTYuODA0IDguNDY2LDk2Ljg4NEM4LjE1NCw5Ny4wMzYgNy44MzQsOTcuMTU2IDcuNTQ2LDk3LjM0OEM3LjQxOCw5Ny40MzYgNy4zMjIsOTcuNTU2IDcuMTk0LDk3LjY1MkM2Ljk3LDk3LjgyIDYuNzc4LDk4LjAwNCA2LjU3OCw5OC4xODhDNi4yNDIsOTguNSA1LjkzOCw5OC44MzYgNS42NTgsOTkuMjA0QzUuNDksOTkuNDIgNS4zMzgsOTkuNjI4IDUuMTk0LDk5Ljg2QzQuOTM4LDEwMC4yNzYgNC43NDYsMTAwLjcxNiA0LjU3LDEwMS4xNzJDNC40ODIsMTAxLjM5NiA0LjM3OCwxMDEuNTk2IDQuMzE0LDEwMS44MjhDNC4xMywxMDIuNTMyIDQuMDAyLDEwMy4yNiA0LjAwMiwxMDQuMDA0TDQuMDAyLDM4NC4wMDRDNC4wMDIsMzg3LjI0NCA1Ljk1NCwzOTAuMTY0IDguOTM4LDM5MS4zOTZMMjQwLjkzOCw0ODcuMzk2QzI0MS4wNDIsNDg3LjQzNiAyNDEuMTU0LDQ4Ny40MiAyNDEuMjU4LDQ4Ny40NkMyNDIuMTQ2LDQ4Ny43ODggMjQzLjA1OCw0ODguMDA0IDI0NC4wMDIsNDg4LjAwNEMyNDQuOTQ2LDQ4OC4wMDQgMjQ1Ljg1OCw0ODcuNzg4IDI0Ni43NDYsNDg3LjQ2QzI0Ni44NSw0ODcuNDIgMjQ2Ljk2Miw0ODcuNDM2IDI0Ny4wNjYsNDg3LjM5Nkw0NzkuMDY2LDM5MS4zOTZDNDgyLjA1LDM5MC4xNjQgNDg0LjAwMiwzODcuMjQ0IDQ4NC4wMDIsMzg0LjAwNEw0ODQuMDAyLDEwNC4wMDRDNDg0LjAwMiwxMDMuMjYgNDgzLjg3NCwxMDIuNTMyIDQ4My42NzQsMTAxLjgzNlpNMjM2LjAwMiw0NjguMDI4TDIwLjAwMiwzNzguNjZMMjAuMDAyLDExNS45NzJMMjM2LjAwMiwyMDUuMzQ4TDIzNi4wMDIsNDY4LjAyOFpNMjQ0LjAwMiwxOTEuMzQ4TDMyLjkyMiwxMDQuMDA0TDI0NC4wMDIsMTYuNjZMNDU1LjA4MiwxMDQuMDA0TDI0NC4wMDIsMTkxLjM0OFpNNDY4LjAwMiwzNzguNjZMMjUyLjAwMiw0NjguMDM2TDI1Mi4wMDIsMjA1LjM0OEw0NjguMDAyLDExNS45NzJMNDY4LjAwMiwzNzguNjZaXCIsIGZpbGw6IHRoZW1lLnBhbGV0dGUucHJpbWFyeS5tYWluIH0pIH0pIH0pIH0pKSB9KSkpO1xyXG59O1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1jdWJlLmpzLm1hcCJdfQ== */"),
|
|
13074
14096
|
content: /*#__PURE__*/css(Object.assign({
|
|
13075
14097
|
clipRule: "evenodd",
|
|
13076
14098
|
fillRule: "evenodd",
|
|
@@ -13080,7 +14102,7 @@ const Cube = _a => {
|
|
|
13080
14102
|
width: "5rem"
|
|
13081
14103
|
}, animate && {
|
|
13082
14104
|
animation: `${spin} 1s linear infinite;`
|
|
13083
|
-
}), process.env.NODE_ENV === "production" ? "" : ";label:content;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
14105
|
+
}), process.env.NODE_ENV === "production" ? "" : ";label:content;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImN1YmUudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQW1DaUIiLCJmaWxlIjoiY3ViZS50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBfX3Jlc3QgfSBmcm9tIFwidHNsaWJcIjtcclxuaW1wb3J0IHsganN4IGFzIF9qc3ggfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3QvanN4LXJ1bnRpbWVcIjtcclxuaW1wb3J0IHsgY3NzLCBrZXlmcmFtZXMsIHVzZVRoZW1lIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XHJcbi8qKlxyXG4gKiBAaW50ZXJuYWxcclxuICpcclxuICogIyBDdWJlIENvbXBvbmVudFxyXG4gKlxyXG4gKiAtIFRoaXMgaXMgYSBzcGlubmluZyBjdWJlIHRoYXQgaXMgdXNlZCB0byBkaXNwbGF5IGEgbG9hZGluZyBzdGF0ZS5cclxuICpcclxuICogQHNlZSB7QGxpbmsgQ3ViZVByb3BUeXBlcyB8IFRoZSBwcm9wcyB0aGF0IGFyZSBwYXNzZWQgaW50byB0aGUgYDxDdWJlIC8+YCBjb21wb25lbnR9XHJcbiAqL1xyXG5leHBvcnQgY29uc3QgQ3ViZSA9IChfYSkgPT4ge1xyXG4gICAgdmFyIHsgYW5pbWF0ZSA9IGZhbHNlIH0gPSBfYSwgcHJvcHMgPSBfX3Jlc3QoX2EsIFtcImFuaW1hdGVcIl0pO1xyXG4gICAgY29uc3QgdGhlbWUgPSB1c2VUaGVtZSgpO1xyXG4gICAgY29uc3QgYm91bmNlID0ga2V5ZnJhbWVzIGBcbiAgICAwJSwgMTAwJSB7XG4gICAgICB0cmFuc2Zvcm06IHRyYW5zbGF0ZVkoLTI1JSk7XG4gICAgICBhbmltYXRpb24tdGltaW5nLWZ1bmN0aW9uOiBjdWJpYy1iZXppZXIoMC44LCAwLCAxLCAxKTtcbiAgICB9XG4gICAgNTAlIHtcbiAgICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgwKTtcbiAgICAgIGFuaW1hdGlvbi10aW1pbmctZnVuY3Rpb246IGN1YmljLWJlemllcigwLCAwLCAwLjIsIDEpO1xuICAgIH1cbiAgYDtcclxuICAgIGNvbnN0IHNwaW4gPSBrZXlmcmFtZXMgYFxuICAgIGZyb20ge1xuICAgICAgdHJhbnNmb3JtOiByb3RhdGUoMGRlZyk7XG4gICAgfVxuICAgIHRvIHtcbiAgICAgIHRyYW5zZm9ybTogcm90YXRlKDM2MGRlZyk7XG4gICAgfVxuICBgO1xyXG4gICAgY29uc3Qgc3R5bGVzID0ge1xyXG4gICAgICAgIGJvdW5jZTogY3NzKE9iamVjdC5hc3NpZ24oe30sIChhbmltYXRlICYmIHsgYW5pbWF0aW9uOiBgJHtib3VuY2V9IDFzIGluZmluaXRlYCB9KSkpLFxyXG4gICAgICAgIGNvbnRlbnQ6IGNzcyhPYmplY3QuYXNzaWduKHsgY2xpcFJ1bGU6IFwiZXZlbm9kZFwiLCBmaWxsUnVsZTogXCJldmVub2RkXCIsIGhlaWdodDogXCI1cmVtXCIsIHN0cm9rZUxpbmVKb2luOiBcInJvdW5kXCIsIHN0cm9rZU1pdGVyTGltaXQ6IFwiMlwiLCB3aWR0aDogXCI1cmVtXCIgfSwgKGFuaW1hdGUgJiYgeyBhbmltYXRpb246IGAke3NwaW59IDFzIGxpbmVhciBpbmZpbml0ZTtgIH0pKSksXHJcbiAgICB9O1xyXG4gICAgcmV0dXJuIChfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IHN0eWxlcy5ib3VuY2UgfSwgcHJvcHMsIHsgcm9sZTogXCJzdGF0dXNcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwic3ZnXCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IHN0eWxlcy5jb250ZW50LCBoZWlnaHQ6IFwiMTAwJVwiLCB2aWV3Qm94OiBcIjAgMCA0ODkgNDg5XCIsIHdpZHRoOiBcIjEwMCVcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwiZ1wiLCB7IGNoaWxkcmVuOiBfanN4KFwiZ1wiLCB7IGNoaWxkcmVuOiBfanN4KFwicGF0aFwiLCB7IGQ6IFwiTTQ4My42NzQsMTAxLjgzNkM0ODMuNjEsMTAxLjYwNCA0ODMuNTA2LDEwMS4zOTYgNDgzLjQxOCwxMDEuMThDNDgzLjI0MiwxMDAuNzI0IDQ4My4wNSwxMDAuMjg0IDQ4Mi43OTQsOTkuODY4QzQ4Mi42NSw5OS42MzYgNDgyLjQ5OCw5OS40MjggNDgyLjMzLDk5LjIxMkM0ODIuMDU4LDk4Ljg0NCA0ODEuNzU0LDk4LjUwOCA0ODEuNDEsOTguMTk2QzQ4MS4yMSw5OC4wMDQgNDgxLjAxLDk3LjgyOCA0ODAuNzg2LDk3LjY2QzQ4MC42NTgsOTcuNTY0IDQ4MC41NjIsOTcuNDQ0IDQ4MC40MzQsOTcuMzU2QzQ4MC4xMzgsOTcuMTU2IDQ3OS44MSw5Ny4wNDQgNDc5LjQ5OCw5Ni44ODRDNDc5LjMzOCw5Ni44MDQgNDc5LjIxOCw5Ni42ODQgNDc5LjA1LDk2LjYxMkwyNDcuMDUsMC42MTJDMjQ1LjA4MiwtMC4yMDQgMjQyLjg5LC0wLjIwNCAyNDAuOTIyLDAuNjEyTDguOTIyLDk2LjYxMkM4Ljc1NCw5Ni42ODQgOC42MjYsOTYuODA0IDguNDY2LDk2Ljg4NEM4LjE1NCw5Ny4wMzYgNy44MzQsOTcuMTU2IDcuNTQ2LDk3LjM0OEM3LjQxOCw5Ny40MzYgNy4zMjIsOTcuNTU2IDcuMTk0LDk3LjY1MkM2Ljk3LDk3LjgyIDYuNzc4LDk4LjAwNCA2LjU3OCw5OC4xODhDNi4yNDIsOTguNSA1LjkzOCw5OC44MzYgNS42NTgsOTkuMjA0QzUuNDksOTkuNDIgNS4zMzgsOTkuNjI4IDUuMTk0LDk5Ljg2QzQuOTM4LDEwMC4yNzYgNC43NDYsMTAwLjcxNiA0LjU3LDEwMS4xNzJDNC40ODIsMTAxLjM5NiA0LjM3OCwxMDEuNTk2IDQuMzE0LDEwMS44MjhDNC4xMywxMDIuNTMyIDQuMDAyLDEwMy4yNiA0LjAwMiwxMDQuMDA0TDQuMDAyLDM4NC4wMDRDNC4wMDIsMzg3LjI0NCA1Ljk1NCwzOTAuMTY0IDguOTM4LDM5MS4zOTZMMjQwLjkzOCw0ODcuMzk2QzI0MS4wNDIsNDg3LjQzNiAyNDEuMTU0LDQ4Ny40MiAyNDEuMjU4LDQ4Ny40NkMyNDIuMTQ2LDQ4Ny43ODggMjQzLjA1OCw0ODguMDA0IDI0NC4wMDIsNDg4LjAwNEMyNDQuOTQ2LDQ4OC4wMDQgMjQ1Ljg1OCw0ODcuNzg4IDI0Ni43NDYsNDg3LjQ2QzI0Ni44NSw0ODcuNDIgMjQ2Ljk2Miw0ODcuNDM2IDI0Ny4wNjYsNDg3LjM5Nkw0NzkuMDY2LDM5MS4zOTZDNDgyLjA1LDM5MC4xNjQgNDg0LjAwMiwzODcuMjQ0IDQ4NC4wMDIsMzg0LjAwNEw0ODQuMDAyLDEwNC4wMDRDNDg0LjAwMiwxMDMuMjYgNDgzLjg3NCwxMDIuNTMyIDQ4My42NzQsMTAxLjgzNlpNMjM2LjAwMiw0NjguMDI4TDIwLjAwMiwzNzguNjZMMjAuMDAyLDExNS45NzJMMjM2LjAwMiwyMDUuMzQ4TDIzNi4wMDIsNDY4LjAyOFpNMjQ0LjAwMiwxOTEuMzQ4TDMyLjkyMiwxMDQuMDA0TDI0NC4wMDIsMTYuNjZMNDU1LjA4MiwxMDQuMDA0TDI0NC4wMDIsMTkxLjM0OFpNNDY4LjAwMiwzNzguNjZMMjUyLjAwMiw0NjguMDM2TDI1Mi4wMDIsMjA1LjM0OEw0NjguMDAyLDExNS45NzJMNDY4LjAwMiwzNzguNjZaXCIsIGZpbGw6IHRoZW1lLnBhbGV0dGUucHJpbWFyeS5tYWluIH0pIH0pIH0pIH0pKSB9KSkpO1xyXG59O1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1jdWJlLmpzLm1hcCJdfQ== */")
|
|
13084
14106
|
};
|
|
13085
14107
|
return jsx("div", Object.assign({
|
|
13086
14108
|
css: styles.bounce
|
|
@@ -13140,6 +14162,11 @@ const styles$5 = createStyles({
|
|
|
13140
14162
|
})
|
|
13141
14163
|
});
|
|
13142
14164
|
|
|
14165
|
+
/**
|
|
14166
|
+
* @internal
|
|
14167
|
+
*
|
|
14168
|
+
* # Section Component
|
|
14169
|
+
*/
|
|
13143
14170
|
const Section = _a => {
|
|
13144
14171
|
var {
|
|
13145
14172
|
bold,
|
|
@@ -13198,9 +14225,15 @@ const styles$4 = createStyles({
|
|
|
13198
14225
|
});
|
|
13199
14226
|
|
|
13200
14227
|
/**
|
|
14228
|
+
* @internal
|
|
14229
|
+
*
|
|
14230
|
+
* # Fund And Purchase Component
|
|
14231
|
+
*
|
|
13201
14232
|
* Fund and Purchase handles the label purchase submission UX, ensuring that a user
|
|
13202
14233
|
* has the necessary funds available and can add them if not. It allows a single button
|
|
13203
14234
|
* to submit the funding form followed by the purchase form.
|
|
14235
|
+
*
|
|
14236
|
+
* @see {@link FundAndPurchaseProps | The props that are passed into the `<FundAndPurchase />` component}
|
|
13204
14237
|
*/
|
|
13205
14238
|
const FundAndPurchase = ({
|
|
13206
14239
|
balance: uspsBalance,
|
|
@@ -13429,7 +14462,7 @@ const RateForm = ({
|
|
|
13429
14462
|
carriers,
|
|
13430
14463
|
disabled,
|
|
13431
14464
|
errors,
|
|
13432
|
-
|
|
14465
|
+
displayableRateErrors,
|
|
13433
14466
|
displayableLabelErrors,
|
|
13434
14467
|
features,
|
|
13435
14468
|
labelErrors,
|
|
@@ -13443,7 +14476,7 @@ const RateForm = ({
|
|
|
13443
14476
|
shipment,
|
|
13444
14477
|
outOfBandDisplayableErrors
|
|
13445
14478
|
}) => {
|
|
13446
|
-
var _a, _b, _c, _d, _e;
|
|
14479
|
+
var _a, _b, _c, _d, _e, _f;
|
|
13447
14480
|
features = Object.assign({
|
|
13448
14481
|
presentation: {
|
|
13449
14482
|
poweredByShipEngine: false
|
|
@@ -13455,7 +14488,7 @@ const RateForm = ({
|
|
|
13455
14488
|
saveRate: true
|
|
13456
14489
|
}
|
|
13457
14490
|
}, features !== null && features !== void 0 ? features : {});
|
|
13458
|
-
const allDisplayableErrors = [...(
|
|
14491
|
+
const allDisplayableErrors = [...(displayableRateErrors !== null && displayableRateErrors !== void 0 ? displayableRateErrors : []), ...(outOfBandDisplayableErrors !== null && outOfBandDisplayableErrors !== void 0 ? outOfBandDisplayableErrors : [])];
|
|
13459
14492
|
const {
|
|
13460
14493
|
t
|
|
13461
14494
|
} = useTranslation();
|
|
@@ -13490,7 +14523,7 @@ const RateForm = ({
|
|
|
13490
14523
|
});
|
|
13491
14524
|
}
|
|
13492
14525
|
})));
|
|
13493
|
-
const rateOptions = useRateOptions(rates, carriers, shipment, !!((_a = features === null || features === void 0 ? void 0 : features.rateForm) === null || _a === void 0 ? void 0 : _a.enableGlobalPostFiltering));
|
|
14526
|
+
const rateOptions = useRateOptions(rates, carriers, shipment, !!((_a = features === null || features === void 0 ? void 0 : features.rateForm) === null || _a === void 0 ? void 0 : _a.enableGlobalPostFiltering), !!((_b = features === null || features === void 0 ? void 0 : features.rateForm) === null || _b === void 0 ? void 0 : _b.requireDhlTermsAcknowledgement));
|
|
13494
14527
|
// Return true if User has multiple accounts for a single carrier.
|
|
13495
14528
|
const hasDuplicateCarrierCode = carriers => {
|
|
13496
14529
|
const uniqueCarrierCodes = new Set();
|
|
@@ -13566,7 +14599,7 @@ const RateForm = ({
|
|
|
13566
14599
|
name: "rate",
|
|
13567
14600
|
nicknameFeature:
|
|
13568
14601
|
// if feature flag is on, and if account has duplicate carrierCodes, then show nickname
|
|
13569
|
-
((
|
|
14602
|
+
((_c = features === null || features === void 0 ? void 0 : features.rateForm) === null || _c === void 0 ? void 0 : _c.nicknameRate) && carriers && hasDuplicateCarrierCode(carriers),
|
|
13570
14603
|
onClick: onSelectRate,
|
|
13571
14604
|
options: showHiddenRates ? rateOptions : filteredRateOptions
|
|
13572
14605
|
}), rateOptions.some(option => option.requiresAcknowledgement) && rateOptions.length > 5 && jsx(Link, Object.assign({
|
|
@@ -13604,10 +14637,10 @@ const RateForm = ({
|
|
|
13604
14637
|
type: NotificationType.ERROR
|
|
13605
14638
|
}, {
|
|
13606
14639
|
children: jsxs(Fragment, {
|
|
13607
|
-
children: [
|
|
14640
|
+
children: [displayableRateErrors, outOfBandDisplayableErrors, displayableLabelErrors]
|
|
13608
14641
|
})
|
|
13609
14642
|
}))]
|
|
13610
|
-
})), ((
|
|
14643
|
+
})), ((_d = features === null || features === void 0 ? void 0 : features.rateForm) === null || _d === void 0 ? void 0 : _d.labelLayout) && !labelsLoading && !(labels === null || labels === void 0 ? void 0 : labels.length) && jsx(Section, Object.assign({
|
|
13611
14644
|
title: t("manage-defaults:label.title")
|
|
13612
14645
|
}, {
|
|
13613
14646
|
children: jsx(LabelLayout, {
|
|
@@ -13619,12 +14652,12 @@ const RateForm = ({
|
|
|
13619
14652
|
control: form.control,
|
|
13620
14653
|
css: styles$3.fundAndPurchase,
|
|
13621
14654
|
disabled: disabled,
|
|
13622
|
-
isFundingEnabled: !!((
|
|
14655
|
+
isFundingEnabled: !!((_e = features === null || features === void 0 ? void 0 : features.rateForm) === null || _e === void 0 ? void 0 : _e.enableFunding),
|
|
13623
14656
|
isFundingRequired: (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.balance) !== undefined && !!selectedRate.requiresFundedAmount,
|
|
13624
14657
|
onPurchase: handleSubmit,
|
|
13625
14658
|
onSave: handleSaveRate,
|
|
13626
14659
|
purchaseAmount: getTotalRateAmount(selectedRate)
|
|
13627
|
-
}), ((
|
|
14660
|
+
}), ((_f = features === null || features === void 0 ? void 0 : features.presentation) === null || _f === void 0 ? void 0 : _f.poweredByShipEngine) && jsxs(Fragment, {
|
|
13628
14661
|
children: [jsx(Spacer, {}), jsx(PoweredByShipEngine, {})]
|
|
13629
14662
|
})]
|
|
13630
14663
|
}));
|
|
@@ -13696,6 +14729,11 @@ const ItemsBreakdownTableHeader = ({
|
|
|
13696
14729
|
}))]
|
|
13697
14730
|
})
|
|
13698
14731
|
});
|
|
14732
|
+
/**
|
|
14733
|
+
* @internal
|
|
14734
|
+
*
|
|
14735
|
+
* # Items Breakdown Component
|
|
14736
|
+
*/
|
|
13699
14737
|
const ItemsBreakdown = ({
|
|
13700
14738
|
items
|
|
13701
14739
|
}) => {
|
|
@@ -14030,10 +15068,12 @@ const CustomsItemsDisplay = ({
|
|
|
14030
15068
|
extendZod();
|
|
14031
15069
|
const getShipmentSchema = ({
|
|
14032
15070
|
allowInternationalShipFrom,
|
|
14033
|
-
|
|
14034
|
-
requireMeasurements: _requireMeasurements = false,
|
|
15071
|
+
dimensionsUnit,
|
|
14035
15072
|
isContentDescriptionRequired: _isContentDescriptionRequired = false,
|
|
14036
|
-
isCustomsRequired: _isCustomsRequired = false
|
|
15073
|
+
isCustomsRequired: _isCustomsRequired = false,
|
|
15074
|
+
requireMeasurements: _requireMeasurements = false,
|
|
15075
|
+
warehouses,
|
|
15076
|
+
weightUnit
|
|
14037
15077
|
} = {}) => {
|
|
14038
15078
|
const baseSchema = z.object({
|
|
14039
15079
|
advancedOptions: z.object({
|
|
@@ -14064,7 +15104,9 @@ const getShipmentSchema = ({
|
|
|
14064
15104
|
height: z.number().nonnegative().nullishDefault(0),
|
|
14065
15105
|
length: z.number().nonnegative().nullishDefault(0),
|
|
14066
15106
|
width: z.number().nonnegative().nullishDefault(0)
|
|
14067
|
-
}).nullish()).transform(dims => dims ? convertDimensions(dims)
|
|
15107
|
+
}).nullish()).transform(dims => dims ? convertDimensions(Object.assign(Object.assign({}, dims), {
|
|
15108
|
+
unit: dimensionsUnit !== null && dimensionsUnit !== void 0 ? dimensionsUnit : "inch"
|
|
15109
|
+
})) : undefined),
|
|
14068
15110
|
insuredValue: moneySchema.extend({
|
|
14069
15111
|
amount: z.number().positive()
|
|
14070
15112
|
}).optional(),
|
|
@@ -14081,7 +15123,7 @@ const getShipmentSchema = ({
|
|
|
14081
15123
|
}) => whole || fractional, "schemaErrors.required") : z.object({
|
|
14082
15124
|
fractional: z.number().nonnegative().nullishDefault(0),
|
|
14083
15125
|
whole: z.number().nonnegative().nullishDefault(0)
|
|
14084
|
-
}).nullish()).transform(weight => weight ? convertWeight(weight) : undefined)
|
|
15126
|
+
}).nullish()).transform(weight => weight ? convertWeight(weight, weightUnit) : undefined)
|
|
14085
15127
|
}).array().min(1),
|
|
14086
15128
|
service: z.object({
|
|
14087
15129
|
carrierId: z.string().nullish(),
|
|
@@ -14108,7 +15150,9 @@ const getShipmentSchema = ({
|
|
|
14108
15150
|
length,
|
|
14109
15151
|
width,
|
|
14110
15152
|
height
|
|
14111
|
-
}) => [length, width, height].every(d => d === 0) || [length, width, height].every(d => d !== 0), "schemaErrors.group.allMeasurementsOrNone").nullish().transform(dims => !dims || Object.values(dims).every(d => d === 0) ? undefined : convertDimensions(dims)
|
|
15153
|
+
}) => [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), {
|
|
15154
|
+
unit: dimensionsUnit !== null && dimensionsUnit !== void 0 ? dimensionsUnit : "inch"
|
|
15155
|
+
})))
|
|
14112
15156
|
}).array().min(1),
|
|
14113
15157
|
service: z.object({
|
|
14114
15158
|
carrierId: z.string(),
|
|
@@ -14156,6 +15200,7 @@ const getShipmentSchema = ({
|
|
|
14156
15200
|
const minimumShipDate = nextDayCutoff(17);
|
|
14157
15201
|
const maximumShipDate = daysAfter(7, minimumShipDate);
|
|
14158
15202
|
const ShipmentForm = ({
|
|
15203
|
+
accountSettings,
|
|
14159
15204
|
addressLoading,
|
|
14160
15205
|
addressPreference,
|
|
14161
15206
|
charsetWarning,
|
|
@@ -14196,14 +15241,22 @@ const ShipmentForm = ({
|
|
|
14196
15241
|
const [insuranceEnabled, setInsuranceEnabled] = useState(false);
|
|
14197
15242
|
const {
|
|
14198
15243
|
isContentDescriptionRequired,
|
|
14199
|
-
isCustomsRequired
|
|
15244
|
+
isCustomsRequired,
|
|
15245
|
+
hasAllZeroMeasurements
|
|
14200
15246
|
} = useShipmentMetadata(shipment);
|
|
15247
|
+
const packageDimensions = shipment === null || shipment === void 0 ? void 0 : shipment.packages[0].dimensions;
|
|
15248
|
+
const packageWeight = shipment === null || shipment === void 0 ? void 0 : shipment.packages[0].weight;
|
|
15249
|
+
// if package specs are all zeroes, assume it is a custom package and default to account settings units
|
|
15250
|
+
const [dimensionsUnit, weightUnit] = useMemo(() => hasAllZeroMeasurements ? [accountSettings === null || accountSettings === void 0 ? void 0 : accountSettings.dimensionsUnit, accountSettings === null || accountSettings === void 0 ? void 0 : accountSettings.weightUnit] : [packageDimensions === null || packageDimensions === void 0 ? void 0 : packageDimensions.unit, packageWeight === null || packageWeight === void 0 ? void 0 : packageWeight.unit], [packageDimensions, packageWeight, hasAllZeroMeasurements, accountSettings]);
|
|
15251
|
+
const hasMeasurementUnits = useMemo(() => !!dimensionsUnit && !!weightUnit, [dimensionsUnit, weightUnit]);
|
|
14201
15252
|
const shipmentSchema = useMemo(() => getShipmentSchema({
|
|
15253
|
+
dimensionsUnit,
|
|
14202
15254
|
isContentDescriptionRequired,
|
|
14203
15255
|
isCustomsRequired,
|
|
14204
15256
|
requireMeasurements,
|
|
14205
|
-
warehouses: warehouses !== null && warehouses !== void 0 ? warehouses : []
|
|
14206
|
-
|
|
15257
|
+
warehouses: warehouses !== null && warehouses !== void 0 ? warehouses : [],
|
|
15258
|
+
weightUnit
|
|
15259
|
+
}), [isCustomsRequired, requireMeasurements, warehouses, isContentDescriptionRequired, weightUnit, dimensionsUnit]);
|
|
14207
15260
|
const requestedServices = useMemo(() => getRequestedServices(salesOrder), [salesOrder]);
|
|
14208
15261
|
const form = useForm({
|
|
14209
15262
|
defaultValues: {
|
|
@@ -14254,10 +15307,10 @@ const ShipmentForm = ({
|
|
|
14254
15307
|
const {
|
|
14255
15308
|
whole,
|
|
14256
15309
|
fractional
|
|
14257
|
-
} = formatFractionalWeight(weight);
|
|
15310
|
+
} = formatFractionalWeight(weight, weightUnit);
|
|
14258
15311
|
form.setValue("packages.0.weight.whole", whole);
|
|
14259
15312
|
form.setValue("packages.0.weight.fractional", fractional);
|
|
14260
|
-
}, [form]);
|
|
15313
|
+
}, [form, weightUnit]);
|
|
14261
15314
|
const handleChangeMode = useCallback(nextMode => __awaiter(void 0, void 0, void 0, function* () {
|
|
14262
15315
|
if (nextMode === "browse_rates") {
|
|
14263
15316
|
// Browse Rates
|
|
@@ -14765,7 +15818,7 @@ const ShipmentForm = ({
|
|
|
14765
15818
|
name: "packages.0.type",
|
|
14766
15819
|
onCategoryChange: value => form.setValue("carrierId", value),
|
|
14767
15820
|
options: packageOptions
|
|
14768
|
-
}),
|
|
15821
|
+
}), hasMeasurementUnits && requireMeasurements ? jsxs(Fragment, {
|
|
14769
15822
|
children: [jsxs(InputGroup, Object.assign({
|
|
14770
15823
|
control: form.control,
|
|
14771
15824
|
disabled: !!findCustomPackage(selectedPackage === null || selectedPackage === void 0 ? void 0 : selectedPackage.code),
|
|
@@ -14778,19 +15831,25 @@ const ShipmentForm = ({
|
|
|
14778
15831
|
control: form.control,
|
|
14779
15832
|
label: t("purchase-label:fields.dimensions.length"),
|
|
14780
15833
|
name: "packages.0.dimensions.length",
|
|
14781
|
-
placeholder: t(
|
|
15834
|
+
placeholder: t(`units.${dimensionsUnit}`)
|
|
14782
15835
|
}), jsx(NumberInput, {
|
|
14783
15836
|
control: form.control,
|
|
14784
15837
|
label: t("purchase-label:fields.dimensions.width"),
|
|
14785
15838
|
name: "packages.0.dimensions.width",
|
|
14786
|
-
placeholder: t(
|
|
15839
|
+
placeholder: t(`units.${dimensionsUnit}`)
|
|
14787
15840
|
}), jsx(NumberInput, {
|
|
14788
15841
|
control: form.control,
|
|
14789
15842
|
label: t("purchase-label:fields.dimensions.height"),
|
|
14790
15843
|
name: "packages.0.dimensions.height",
|
|
14791
|
-
placeholder: t(
|
|
15844
|
+
placeholder: t(`units.${dimensionsUnit}`)
|
|
14792
15845
|
})]
|
|
14793
|
-
})),
|
|
15846
|
+
})), weightUnit && isMetricWeightUnit(weightUnit) ? jsx(NumberInput, {
|
|
15847
|
+
control: form.control,
|
|
15848
|
+
label: t("purchase-label:fields.weightGroup"),
|
|
15849
|
+
name: "packages.0.weight.whole",
|
|
15850
|
+
onBlur: handleBlurWeight,
|
|
15851
|
+
placeholder: t(`units.${weightUnit}`)
|
|
15852
|
+
}) : jsxs(InputGroup, Object.assign({
|
|
14794
15853
|
control: form.control,
|
|
14795
15854
|
label: t("purchase-label:fields.weightGroup"),
|
|
14796
15855
|
name: "packages.0.weight",
|
|
@@ -14810,6 +15869,26 @@ const ShipmentForm = ({
|
|
|
14810
15869
|
placeholder: t("units.oz")
|
|
14811
15870
|
})]
|
|
14812
15871
|
}))]
|
|
15872
|
+
}) : jsxs(Fragment, {
|
|
15873
|
+
children: [jsx(FieldLabel, Object.assign({
|
|
15874
|
+
label: t("purchase-label:fields.dimensionsGroup")
|
|
15875
|
+
}, {
|
|
15876
|
+
children: jsx(Skeleton, {
|
|
15877
|
+
animation: SkeletonAnimation.WAVE,
|
|
15878
|
+
backgroundColor: SkeletonBackgroundColor.LIGHT,
|
|
15879
|
+
height: 50,
|
|
15880
|
+
variant: SkeletonVariant.TEXT
|
|
15881
|
+
})
|
|
15882
|
+
})), jsx(Spacer, {}), jsx(FieldLabel, Object.assign({
|
|
15883
|
+
label: t("purchase-label:fields.weightGroup")
|
|
15884
|
+
}, {
|
|
15885
|
+
children: jsx(Skeleton, {
|
|
15886
|
+
animation: SkeletonAnimation.WAVE,
|
|
15887
|
+
backgroundColor: SkeletonBackgroundColor.LIGHT,
|
|
15888
|
+
height: 50,
|
|
15889
|
+
variant: SkeletonVariant.TEXT
|
|
15890
|
+
})
|
|
15891
|
+
})), jsx(Spacer, {})]
|
|
14813
15892
|
}), isContentDescriptionRequired && jsx(TextInput, {
|
|
14814
15893
|
control: form.control,
|
|
14815
15894
|
hint: t("purchase-label:hints.contentDescription"),
|
|
@@ -14988,6 +16067,13 @@ const Shipment = ({
|
|
|
14988
16067
|
const requestedServices = useMemo(() => getRequestedServices(salesOrder), [salesOrder]);
|
|
14989
16068
|
const activeLabel = useMemo(() => labels === null || labels === void 0 ? void 0 : labels.find(l => l.status === "completed"), [labels]);
|
|
14990
16069
|
const hasSalesOrder = useMemo(() => shipment.salesOrderIds.length > 0, [shipment.salesOrderIds.length]);
|
|
16070
|
+
const formatWeight = weight => isMetricWeightUnit(weight.unit) ? t(`weight.${weight.unit}`, {
|
|
16071
|
+
count: weight.value
|
|
16072
|
+
}) : [pounds > 0 ? t("weight.pounds", {
|
|
16073
|
+
count: pounds
|
|
16074
|
+
}) : "", ounces > 0 ? t("weight.ounces", {
|
|
16075
|
+
count: ounces
|
|
16076
|
+
}) : ""].filter(msg => msg.length).join(" ");
|
|
14991
16077
|
return jsxs(Fragment, {
|
|
14992
16078
|
children: [jsxs(Section, Object.assign({
|
|
14993
16079
|
"data-testid": "orderDetail"
|
|
@@ -15073,16 +16159,12 @@ const Shipment = ({
|
|
|
15073
16159
|
"data-testid": "dimensions",
|
|
15074
16160
|
label: t("view-shipment:fields.dimensions")
|
|
15075
16161
|
}, {
|
|
15076
|
-
children: [`${dimensions
|
|
16162
|
+
children: [`${formatDimensions(dimensions)} ` + t(`units.${dimensions.unit}`), jsx(Spacer, {})]
|
|
15077
16163
|
})), jsx(FieldLabel, Object.assign({
|
|
15078
16164
|
"data-testid": "weight",
|
|
15079
16165
|
label: t("view-shipment:fields.weight")
|
|
15080
16166
|
}, {
|
|
15081
|
-
children:
|
|
15082
|
-
count: pounds
|
|
15083
|
-
}) : "", ounces > 0 ? t("weight.ounces", {
|
|
15084
|
-
count: ounces
|
|
15085
|
-
}) : ""].filter(unit => unit.length).join(" ")
|
|
16167
|
+
children: formatWeight(weight)
|
|
15086
16168
|
}))]
|
|
15087
16169
|
})), jsxs(Section, Object.assign({
|
|
15088
16170
|
rightContent: ((_a = features === null || features === void 0 ? void 0 : features.shipment) === null || _a === void 0 ? void 0 : _a.schedulePickup) && schedulePickupForCarrier(activeLabel === null || activeLabel === void 0 ? void 0 : activeLabel.carrierCode) ? jsx(Link, Object.assign({
|
|
@@ -15236,6 +16318,9 @@ const styles = createStyles({
|
|
|
15236
16318
|
})
|
|
15237
16319
|
});
|
|
15238
16320
|
|
|
16321
|
+
/**
|
|
16322
|
+
* @internal
|
|
16323
|
+
*/
|
|
15239
16324
|
const DateRangeSelect = ({
|
|
15240
16325
|
fullWidth,
|
|
15241
16326
|
onChange,
|
|
@@ -15269,6 +16354,13 @@ const DateRangeSelect = ({
|
|
|
15269
16354
|
}));
|
|
15270
16355
|
};
|
|
15271
16356
|
|
|
16357
|
+
/**
|
|
16358
|
+
* @internal
|
|
16359
|
+
*
|
|
16360
|
+
* # Date Range Combo Component
|
|
16361
|
+
*
|
|
16362
|
+
* @see {@link DateRangeComboProps | This is the type of the props used in the `<DateRangeCombo />` component}
|
|
16363
|
+
*/
|
|
15272
16364
|
const DateRangeCombo = ({
|
|
15273
16365
|
children: renderChildren,
|
|
15274
16366
|
onChange,
|
|
@@ -15313,9 +16405,13 @@ const DateRangeCombo = ({
|
|
|
15313
16405
|
};
|
|
15314
16406
|
|
|
15315
16407
|
/**
|
|
16408
|
+
* @internal
|
|
16409
|
+
*
|
|
16410
|
+
* # Error Fallback Component
|
|
16411
|
+
*
|
|
15316
16412
|
* Fallback component for the Elements ErrorBoundary
|
|
15317
16413
|
*
|
|
15318
|
-
* @see {@link
|
|
16414
|
+
* @see {@link ErrorFallbackProps | The props that are passed into the `<ErrorFallback />` component}
|
|
15319
16415
|
*/
|
|
15320
16416
|
const ErrorFallback = ({
|
|
15321
16417
|
error
|
|
@@ -15349,7 +16445,11 @@ const ErrorFallback = ({
|
|
|
15349
16445
|
};
|
|
15350
16446
|
|
|
15351
16447
|
/**
|
|
15352
|
-
*
|
|
16448
|
+
* @internal
|
|
16449
|
+
*
|
|
16450
|
+
* # Story Notes Component
|
|
16451
|
+
*
|
|
16452
|
+
* - For relevant notes about Storybook stories
|
|
15353
16453
|
*
|
|
15354
16454
|
* Stopgap until we setup https://storybook.js.org/addons/@storybook/addon-docs
|
|
15355
16455
|
*/
|
|
@@ -15634,12 +16734,17 @@ var common = {
|
|
|
15634
16734
|
weight: {
|
|
15635
16735
|
ounces: "{{count}} oz",
|
|
15636
16736
|
pounds_one: "{{count}} lb",
|
|
15637
|
-
pounds_other: "{{count}} lbs"
|
|
16737
|
+
pounds_other: "{{count}} lbs",
|
|
16738
|
+
kilogram: "{{count}} kg",
|
|
16739
|
+
gram: "{{count}} g"
|
|
15638
16740
|
},
|
|
15639
16741
|
units: {
|
|
15640
|
-
|
|
16742
|
+
inch: "in",
|
|
15641
16743
|
lbs: "lbs",
|
|
15642
|
-
oz: "oz"
|
|
16744
|
+
oz: "oz",
|
|
16745
|
+
centimeter: "cm",
|
|
16746
|
+
gram: "g",
|
|
16747
|
+
kilogram: "kg"
|
|
15643
16748
|
},
|
|
15644
16749
|
"VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkMTAwLgo=": "$100 insurance included",
|
|
15645
16750
|
"VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkNTAuCg==": "$50 insurance included",
|
|
@@ -15647,7 +16752,8 @@ var common = {
|
|
|
15647
16752
|
"QWRkcmVzcyBub3QgZm91bmQ=": "There was an issue validating your address. Please try again.",
|
|
15648
16753
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: "UPS weight limit per package is 150 lbs.",
|
|
15649
16754
|
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: "Finish setting up your ShipStation Carriers in the ShipStation app",
|
|
15650
|
-
QSBzaGlwcGluZyBlcnJvciBvY2N1cnJlZDogTWlzc2luZyBvciBpbnZhbGlkIHNoaXBwZXIgbnVtYmVy: "Unable to
|
|
16755
|
+
QSBzaGlwcGluZyBlcnJvciBvY2N1cnJlZDogTWlzc2luZyBvciBpbnZhbGlkIHNoaXBwZXIgbnVtYmVy: "Unable to create label: Missing or Invalid Shipper Number. Please contact our support team to reset the carrier connection for your account.",
|
|
16756
|
+
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBNaXNzaW5nIG9yIGludmFsaWQgc2hpcHBlciBuYW1l: "Unable to create label: The selected service requires a Company Name be added to your Ship From Location. Please contact our support team if you continue to experience issues.",
|
|
15651
16757
|
"QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBNaXNzaW5nIG9yIGludmFsaWQgc2hpcCB0byBTdGF0ZVByb3ZpbmNlQ29kZQ==": "The State/Province Code Exceeds 5 Characters. Shorten the abbreviation or remove it, then try again.",
|
|
15652
16758
|
"QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnZhbGlkIHNvbGQgdG8gc3RhdGUgcHJvdmluY2UgY29kZS4gVmFsaWQgbGVuZ3RoIGlzIDAgdG8gNSBhbHBoYW51bWVyaWM=": "The State/Province Code Exceeds 5 Characters. Shorten the abbreviation or remove it, then try again."
|
|
15653
16759
|
};
|
|
@@ -15903,7 +17009,8 @@ var purchaseLabel$1 = {
|
|
|
15903
17009
|
},
|
|
15904
17010
|
rates: {
|
|
15905
17011
|
uspsMediaMailAcknowledgement: "I confirm that this package is compliant with <1>USPS guidelines for Media Mail®</1>",
|
|
15906
|
-
uspsFirstClassMailAcknowledgement_leof: "I understand the limitations and confirm that this package is compliant with USPS guidelines for First Class Mail Large Envelopes or Flats."
|
|
17012
|
+
uspsFirstClassMailAcknowledgement_leof: "I understand the limitations and confirm that this package is compliant with USPS guidelines for First Class Mail Large Envelopes or Flats.",
|
|
17013
|
+
dhlExpressTermsAcknowledgement: "To start shipping with DHL, you are confirming that you have agreed to the <1>terms and conditions</1>"
|
|
15907
17014
|
},
|
|
15908
17015
|
shipToAddressFormFields: "Ship To Address Form Fields",
|
|
15909
17016
|
sections: {
|
|
@@ -16053,6 +17160,31 @@ var walletHistory = {
|
|
|
16053
17160
|
|
|
16054
17161
|
var en = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, accoutSettings), common$1), listCarriers), manageDefaults), manageFunding), manageWarehouses), manageDefaults), onboarding$2), paymentMethod), purchaseLabel$1), registerCarrier), registerWallet), viewShipment$1), voidLabel$1), walletHistory);
|
|
16055
17162
|
|
|
17163
|
+
/**
|
|
17164
|
+
* # Account Settings Component
|
|
17165
|
+
*
|
|
17166
|
+
* - The `<AccountSettings />` component is used to display the user's account settings, as well as
|
|
17167
|
+
* allowing them to make changes to various aspects of their account.
|
|
17168
|
+
*
|
|
17169
|
+
* @param onSaveSettings Any `void` function you wish to execute when the user saves any changes
|
|
17170
|
+
* to their account settings.
|
|
17171
|
+
*
|
|
17172
|
+
* @returns Element An EmotionJSX.Element that will render the `<AccountSettings />` component
|
|
17173
|
+
* with all the appropriate wrappers.
|
|
17174
|
+
*
|
|
17175
|
+
* @example
|
|
17176
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
17177
|
+
* ```tsx
|
|
17178
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
17179
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
17180
|
+
* resources: { en },
|
|
17181
|
+
* });
|
|
17182
|
+
* ```
|
|
17183
|
+
*
|
|
17184
|
+
* <br />
|
|
17185
|
+
*
|
|
17186
|
+
* @see {@link AccountSettings.Element | The **Element** created to render `<AccountSettings />`}
|
|
17187
|
+
*/
|
|
16056
17188
|
const Component$4 = ({
|
|
16057
17189
|
onSaveSettings
|
|
16058
17190
|
}) => {
|
|
@@ -16064,6 +17196,32 @@ const Component$4 = ({
|
|
|
16064
17196
|
onSaveSettings: onSaveSettings
|
|
16065
17197
|
});
|
|
16066
17198
|
};
|
|
17199
|
+
/**
|
|
17200
|
+
* # Registered Account Settings Element
|
|
17201
|
+
*
|
|
17202
|
+
* - This is the registered `<AccountSettings />` element that will be used to render the
|
|
17203
|
+
* `<AccountSettings.Element />` component.
|
|
17204
|
+
*
|
|
17205
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
17206
|
+
* the `<AccountSettings.Element />` component.
|
|
17207
|
+
*
|
|
17208
|
+
* @example
|
|
17209
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `AccountSettings`
|
|
17210
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
17211
|
+
* ```tsx
|
|
17212
|
+
* <AccountSettings.Element
|
|
17213
|
+
* onSaveSettings={() => console.log('Settings Saved!')}
|
|
17214
|
+
* />
|
|
17215
|
+
* ```
|
|
17216
|
+
*
|
|
17217
|
+
* <br />
|
|
17218
|
+
*
|
|
17219
|
+
* @see {@link AccountSettings.ComponentProps | The **props** that can be passed into the `<AccountSettings.Element />` component}
|
|
17220
|
+
* @see {@link ListCarriers.Component | The `<List-Carriers />` component used to view connected carriers}
|
|
17221
|
+
* @see {@link ManageWarehouses.Component | The `<ManageWarehouses />` component used to add, update, or remove warehouses}
|
|
17222
|
+
* @see {@link PaymentMethodSettings | The `<PaymentMethodSettings />` component used to manage payment methods}
|
|
17223
|
+
* @see {@link ManageFunding | The `<ManageFunding />` component used to manage funding rules and add funds to a carrier account}
|
|
17224
|
+
*/
|
|
16067
17225
|
const Element$5 = alchemy.createElement(Component$4, ErrorFallback, {
|
|
16068
17226
|
css: {
|
|
16069
17227
|
height: "100%",
|
|
@@ -16082,6 +17240,39 @@ var accountSettings = /*#__PURE__*/Object.freeze({
|
|
|
16082
17240
|
Element: Element$5
|
|
16083
17241
|
});
|
|
16084
17242
|
|
|
17243
|
+
/**
|
|
17244
|
+
* # Onboarding Component
|
|
17245
|
+
*
|
|
17246
|
+
* - The `<Onboarding />` component is used to onboard a new user to the ShipEngine platform. This
|
|
17247
|
+
* component will allow the user to create a warehouse, register a carrier, and create a funding
|
|
17248
|
+
* source for their account. This is everything a user needs to begin fulfilling their shipments
|
|
17249
|
+
* using the ShipEngine Platform.
|
|
17250
|
+
*
|
|
17251
|
+
* @param ComponentProps The base props that will be passed into the `<Onboarding />` component.
|
|
17252
|
+
*
|
|
17253
|
+
* @returns Element An EmotionJSX.Element that will render the `<Onboarding />` component
|
|
17254
|
+
* with all the appropriate wrappers.
|
|
17255
|
+
*
|
|
17256
|
+
* @example
|
|
17257
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
17258
|
+
* ```tsx
|
|
17259
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
17260
|
+
* css: {
|
|
17261
|
+
* height: "100%",
|
|
17262
|
+
* maxWidth: "800px",
|
|
17263
|
+
* minWidth: "440px",
|
|
17264
|
+
* overflow: "auto",
|
|
17265
|
+
* scrollbarGutter: "stable both-edges",
|
|
17266
|
+
* width: "100%",
|
|
17267
|
+
* },
|
|
17268
|
+
* resources: { en },
|
|
17269
|
+
* });
|
|
17270
|
+
* ```
|
|
17271
|
+
*
|
|
17272
|
+
* <br />
|
|
17273
|
+
*
|
|
17274
|
+
* @see {@link Onboarding.Element | The **Element** created to render `<Onboarding />`}
|
|
17275
|
+
*/
|
|
16085
17276
|
const Component$3 = ({
|
|
16086
17277
|
features,
|
|
16087
17278
|
onboardingAddress,
|
|
@@ -16150,6 +17341,28 @@ const Component$3 = ({
|
|
|
16150
17341
|
warehouses: warehouses
|
|
16151
17342
|
});
|
|
16152
17343
|
};
|
|
17344
|
+
/**
|
|
17345
|
+
* # Registered Onboarding Element
|
|
17346
|
+
*
|
|
17347
|
+
* - This is the registered `<Onboarding />` element that will be used to render the
|
|
17348
|
+
* `<Onboarding.Element />` component.
|
|
17349
|
+
*
|
|
17350
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
17351
|
+
* the `<Onboarding.Element />` component.
|
|
17352
|
+
*
|
|
17353
|
+
* @example
|
|
17354
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `Onboarding`
|
|
17355
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
17356
|
+
* ```tsx
|
|
17357
|
+
* <Onboarding.Element
|
|
17358
|
+
* onCompleteOnboarding={() => console.log('Onboarding Complete!')}
|
|
17359
|
+
* />
|
|
17360
|
+
* ```
|
|
17361
|
+
*
|
|
17362
|
+
* <br />
|
|
17363
|
+
*
|
|
17364
|
+
* @see {@link Onboarding.ComponentProps | The **props** that can be passed into the `<Onboarding.Element />` component}
|
|
17365
|
+
*/
|
|
16153
17366
|
const Element$4 = alchemy.createElement(Component$3, ErrorFallback, {
|
|
16154
17367
|
css: {
|
|
16155
17368
|
height: "100%",
|
|
@@ -16410,27 +17623,6 @@ const usePresets = ({
|
|
|
16410
17623
|
};
|
|
16411
17624
|
};
|
|
16412
17625
|
|
|
16413
|
-
/**
|
|
16414
|
-
* Generic error pretty printer
|
|
16415
|
-
* @param errors
|
|
16416
|
-
* @param predicate
|
|
16417
|
-
* @param scrubber
|
|
16418
|
-
*/
|
|
16419
|
-
const useScrubErrors = ({
|
|
16420
|
-
scrubber,
|
|
16421
|
-
errors,
|
|
16422
|
-
predicate
|
|
16423
|
-
}) => {
|
|
16424
|
-
const {
|
|
16425
|
-
t
|
|
16426
|
-
} = useTranslation();
|
|
16427
|
-
return useMemo(() => errors === null || errors === void 0 ? void 0 : errors.map(e => {
|
|
16428
|
-
return t(encode(e.message), {
|
|
16429
|
-
defaultValue: !predicate || predicate(e) ? t(scrubber(e)) : e.message
|
|
16430
|
-
});
|
|
16431
|
-
}), [errors, predicate, scrubber, t]);
|
|
16432
|
-
};
|
|
16433
|
-
|
|
16434
17626
|
var usps_first_class_mail = [
|
|
16435
17627
|
"First Class Mail shipments must weigh less than {{weight}} oz. Shipments exceeding the weight entered when buying the label will be charged an adjustment fee by USPS."
|
|
16436
17628
|
];
|
|
@@ -16523,11 +17715,13 @@ const useRequestRates = ({
|
|
|
16523
17715
|
reset: resetRates,
|
|
16524
17716
|
mutateAsync: calculateRates
|
|
16525
17717
|
} = useCalculateRates();
|
|
16526
|
-
const requestRates = useCallback(shipment => __awaiter(void 0, void 0, void 0, function* () {
|
|
16527
|
-
var _a;
|
|
17718
|
+
const requestRates = useCallback((shipment, isInternational) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17719
|
+
var _a, _b;
|
|
17720
|
+
const internationalCarrierIds = (_a = carriers === null || carriers === void 0 ? void 0 : carriers.map(c => c.carrierId)) !== null && _a !== void 0 ? _a : [];
|
|
17721
|
+
const domesticCarrierIds = (_b = carriers === null || carriers === void 0 ? void 0 : carriers.filter(c => !["dhl"].includes(c.carrierCode)).map(c => c.carrierId)) !== null && _b !== void 0 ? _b : [];
|
|
16528
17722
|
const result = yield calculateRates({
|
|
16529
17723
|
rateOptions: {
|
|
16530
|
-
carrierIds: shipment.carrierId ? [shipment.carrierId] :
|
|
17724
|
+
carrierIds: shipment.carrierId ? [shipment.carrierId] : isInternational ? internationalCarrierIds : domesticCarrierIds,
|
|
16531
17725
|
packageTypes: (customPackageTypes === null || customPackageTypes === void 0 ? void 0 : customPackageTypes.find(p => p.packageId === shipment.packages[0].packageId)) ? ["package"] // Only specify package types for non-custom packages
|
|
16532
17726
|
: shipment.packages.map(pkg => pkg.packageCode),
|
|
16533
17727
|
serviceCodes: shipment.serviceCode ? [shipment.serviceCode] : undefined
|
|
@@ -16610,6 +17804,9 @@ const useRatesForm = ({
|
|
|
16610
17804
|
}) => {
|
|
16611
17805
|
var _a, _b;
|
|
16612
17806
|
const [beforeCreateError, setBeforeCreateError] = useState();
|
|
17807
|
+
const {
|
|
17808
|
+
isInternational
|
|
17809
|
+
} = useShipmentMetadata(shipment);
|
|
16613
17810
|
const {
|
|
16614
17811
|
data: carriers
|
|
16615
17812
|
} = useListCarriers();
|
|
@@ -16682,11 +17879,11 @@ const useRatesForm = ({
|
|
|
16682
17879
|
shipDate: isNowOrInTheFuture(shipment.shipDate) ? shipment.shipDate : undefined
|
|
16683
17880
|
}));
|
|
16684
17881
|
if (updatedShipment) {
|
|
16685
|
-
yield requestRates(updatedShipment);
|
|
17882
|
+
yield requestRates(updatedShipment, isInternational);
|
|
16686
17883
|
yield onShipmentUpdated === null || onShipmentUpdated === void 0 ? void 0 : onShipmentUpdated(updatedShipment);
|
|
16687
17884
|
yield onRateSaved === null || onRateSaved === void 0 ? void 0 : onRateSaved(updatedShipment);
|
|
16688
17885
|
}
|
|
16689
|
-
}), [onRateSaved, onShipmentUpdated, requestRates, shipment, updateShipment]);
|
|
17886
|
+
}), [isInternational, onRateSaved, onShipmentUpdated, requestRates, shipment, updateShipment]);
|
|
16690
17887
|
let errors = [...(ratesErrors !== null && ratesErrors !== void 0 ? ratesErrors : []), ...((_a = ratesResponse === null || ratesResponse === void 0 ? void 0 : ratesResponse.errors) !== null && _a !== void 0 ? _a : [])];
|
|
16691
17888
|
if (beforeCreateError) errors = [...errors, beforeCreateError];
|
|
16692
17889
|
// Sometimes no rates are returned and no top-level errors are returned
|
|
@@ -16701,7 +17898,7 @@ const useRatesForm = ({
|
|
|
16701
17898
|
name: "CodedError"
|
|
16702
17899
|
})))) !== null && _b !== void 0 ? _b : [];
|
|
16703
17900
|
}
|
|
16704
|
-
const
|
|
17901
|
+
const displayableRateErrors = useScrubErrors({
|
|
16705
17902
|
errors: errors,
|
|
16706
17903
|
predicate: useCallback(e => e.message.includes("No rates are available for service_codes"), []),
|
|
16707
17904
|
scrubber: useCallback(() => "common:errorMessages.noRatesAvailable", [])
|
|
@@ -16712,8 +17909,8 @@ const useRatesForm = ({
|
|
|
16712
17909
|
});
|
|
16713
17910
|
return {
|
|
16714
17911
|
carriers,
|
|
16715
|
-
displayableErrors,
|
|
16716
17912
|
displayableLabelErrors,
|
|
17913
|
+
displayableRateErrors,
|
|
16717
17914
|
errors: errors.length > 0 ? errors : undefined,
|
|
16718
17915
|
isLoading: ratesCalculating,
|
|
16719
17916
|
labelErrors: (labelErrors === null || labelErrors === void 0 ? void 0 : labelErrors.length) ? labelErrors : undefined,
|
|
@@ -16748,6 +17945,9 @@ const useShipmentForm = ({
|
|
|
16748
17945
|
const {
|
|
16749
17946
|
data: warehouses
|
|
16750
17947
|
} = useListWarehouses();
|
|
17948
|
+
const {
|
|
17949
|
+
data: accountSettings
|
|
17950
|
+
} = useGetAccountSettings();
|
|
16751
17951
|
const {
|
|
16752
17952
|
error: updateShipmentErrors,
|
|
16753
17953
|
mutateAsync: updateShipment,
|
|
@@ -16807,6 +18007,7 @@ const useShipmentForm = ({
|
|
|
16807
18007
|
scrubber: useCallback(() => "common:errorMessages.noRatesAvailable", [])
|
|
16808
18008
|
});
|
|
16809
18009
|
return {
|
|
18010
|
+
accountSettings,
|
|
16810
18011
|
addressLoading,
|
|
16811
18012
|
addressPreference,
|
|
16812
18013
|
carriers,
|
|
@@ -16846,6 +18047,9 @@ const ConfigureShipment = _a => {
|
|
|
16846
18047
|
} = _a,
|
|
16847
18048
|
props = __rest(_a, ["features", "onAddressValidation", "onApplyPreset", "onBeforeLabelCreate", "onChangeAddress", "onLabelCreateFailure", "onLabelCreateSuccess", "onRateSaved", "onRatesCalculated", "onShipmentUpdated", "printLabelLayout", "salesOrder", "shipment"]);
|
|
16848
18049
|
const hydrateRef = useRef();
|
|
18050
|
+
const {
|
|
18051
|
+
isInternational
|
|
18052
|
+
} = useShipmentMetadata(shipment);
|
|
16849
18053
|
const _b = useRatesForm({
|
|
16850
18054
|
onBeforeLabelCreate,
|
|
16851
18055
|
onLabelCreateFailure,
|
|
@@ -16872,15 +18076,15 @@ const ConfigureShipment = _a => {
|
|
|
16872
18076
|
onApplyPreset: useCallback((_preset, shipment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16873
18077
|
var _d;
|
|
16874
18078
|
if (shipment.packages[0].weight.value) {
|
|
16875
|
-
yield requestRates(shipment);
|
|
18079
|
+
yield requestRates(shipment, isInternational);
|
|
16876
18080
|
}
|
|
16877
18081
|
(_d = hydrateRef.current) === null || _d === void 0 ? void 0 : _d.call(hydrateRef, shipment);
|
|
16878
|
-
}), [requestRates]),
|
|
18082
|
+
}), [requestRates, isInternational]),
|
|
16879
18083
|
onChangeAddress,
|
|
16880
18084
|
onShipmentUpdated,
|
|
16881
18085
|
onSubmit: useCallback(shipment => __awaiter(void 0, void 0, void 0, function* () {
|
|
16882
|
-
yield requestRates(shipment);
|
|
16883
|
-
}), [requestRates]),
|
|
18086
|
+
yield requestRates(shipment, isInternational);
|
|
18087
|
+
}), [requestRates, isInternational]),
|
|
16884
18088
|
salesOrder,
|
|
16885
18089
|
shipment
|
|
16886
18090
|
}),
|
|
@@ -17182,6 +18386,30 @@ const PurchaseLabelByShipment = _a => {
|
|
|
17182
18386
|
}));
|
|
17183
18387
|
};
|
|
17184
18388
|
|
|
18389
|
+
/**
|
|
18390
|
+
* # Purchase Label Component
|
|
18391
|
+
*
|
|
18392
|
+
* The `<PurchaseLabel />` component is used to purchase shipping labels from various carriers
|
|
18393
|
+
*
|
|
18394
|
+
* @param ElementProps The props necessary to render the `<PurchaseLabel />` component for shipment
|
|
18395
|
+
* based or sales order based label purchasing.
|
|
18396
|
+
*
|
|
18397
|
+
* @returns Element An EmotionJSX.Element that will render the `<PurchaseLabel />` component
|
|
18398
|
+
* with all the appropriate wrappers.
|
|
18399
|
+
*
|
|
18400
|
+
* @example
|
|
18401
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
18402
|
+
* ```tsx
|
|
18403
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
18404
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
18405
|
+
* resources: { en },
|
|
18406
|
+
* });
|
|
18407
|
+
* ```
|
|
18408
|
+
*
|
|
18409
|
+
* <br />
|
|
18410
|
+
*
|
|
18411
|
+
* @see {@link PurchaseLabel.Element | The **Element** created to render `<PurchaseLabel />`}
|
|
18412
|
+
*/
|
|
17185
18413
|
const Component$2 = _a => {
|
|
17186
18414
|
var props = __rest(_a, []);
|
|
17187
18415
|
if ("salesOrderId" in props || "orderSourceCode" in props) {
|
|
@@ -17190,6 +18418,44 @@ const Component$2 = _a => {
|
|
|
17190
18418
|
return jsx(PurchaseLabelByShipment, Object.assign({}, props));
|
|
17191
18419
|
}
|
|
17192
18420
|
};
|
|
18421
|
+
/**
|
|
18422
|
+
* # Registered Purchase Label Element
|
|
18423
|
+
*
|
|
18424
|
+
* @param ElementProps The props necessary to render the `<PurchaseLabel.Element />` for shipment
|
|
18425
|
+
* based or sales order based label purchasing.
|
|
18426
|
+
*
|
|
18427
|
+
* @example
|
|
18428
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `PurchaseLabel`
|
|
18429
|
+
* Element directly.
|
|
18430
|
+
* ```tsx
|
|
18431
|
+
* <PurchaseLabel.Element
|
|
18432
|
+
* key={currentSalesOrderId}
|
|
18433
|
+
* printLabelLayout='4x6'
|
|
18434
|
+
* shippingPresets={presets}
|
|
18435
|
+
* onShipmentUpdated={(shipment) => console.log('Shipment Updated', shipment)}
|
|
18436
|
+
* onRateSaved={(
|
|
18437
|
+
* shipment: SE.SalesOrderShipment,
|
|
18438
|
+
* rate?: SE.Rate,
|
|
18439
|
+
* rateOptions?: SE.Rate[]
|
|
18440
|
+
* ) => console.log('Rate Saved', shipment, rate, rateOptions)}
|
|
18441
|
+
* onRatesCalculated={() => console.log('Rates Calculated')}
|
|
18442
|
+
* onBeforeLabelCreate={onBeforeLabelPurchase}
|
|
18443
|
+
* onLabelCreateSuccess={onLabelPurchaseSuccess}
|
|
18444
|
+
* onLabelCreateFailure={(rate) => console.log('Label Purchase Failed', rate)}
|
|
18445
|
+
* warehouseId={defaultWarehouseId}
|
|
18446
|
+
* />
|
|
18447
|
+
* ```
|
|
18448
|
+
*
|
|
18449
|
+
* <br />
|
|
18450
|
+
*
|
|
18451
|
+
* - Once a label has been purchased using this Element, you can take the `shipmentId` for the
|
|
18452
|
+
* associated shipment and pass it into the `<ViewShipment.Element />` Element in order to view
|
|
18453
|
+
* the shipment details.
|
|
18454
|
+
*
|
|
18455
|
+
* @see {@link PurchaseLabel.PurchaseLabelCommonProps | The **Common props** used in `<PurchaseLabel.Element />`}
|
|
18456
|
+
*
|
|
18457
|
+
* @see {@link ViewShipment.Element | The next step in the label purchase workflow `<ViewShipment.Element />`}
|
|
18458
|
+
*/
|
|
17193
18459
|
const Element$3 = alchemy.createElement(Component$2, ErrorFallback, {
|
|
17194
18460
|
css: {
|
|
17195
18461
|
height: "100%",
|
|
@@ -17208,6 +18474,31 @@ var purchaseLabel = /*#__PURE__*/Object.freeze({
|
|
|
17208
18474
|
Element: Element$3
|
|
17209
18475
|
});
|
|
17210
18476
|
|
|
18477
|
+
/**
|
|
18478
|
+
* # View Shipment Component
|
|
18479
|
+
*
|
|
18480
|
+
* - The `<ViewShipment />` component is used to for viewing the shipment's tracking number, printing the label that
|
|
18481
|
+
* was created, and the option to void the label. When a label is voided, you can see a list of the
|
|
18482
|
+
* previously voided labels for a given shipment using this component.
|
|
18483
|
+
*
|
|
18484
|
+
* @param ComponentProps The base props that will be passed into the `<ViewShipment />` component.
|
|
18485
|
+
*
|
|
18486
|
+
* @returns Element An EmotionJSX.Element that will render the `<ViewShipment />` component
|
|
18487
|
+
* with all the appropriate wrappers.
|
|
18488
|
+
*
|
|
18489
|
+
* @example
|
|
18490
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
18491
|
+
* ```tsx
|
|
18492
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
18493
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
18494
|
+
* resources: { en },
|
|
18495
|
+
* });
|
|
18496
|
+
* ```
|
|
18497
|
+
*
|
|
18498
|
+
* <br />
|
|
18499
|
+
*
|
|
18500
|
+
* @see {@link ViewShipment.Element | The **Element** created to render `<ViewShipment />`}
|
|
18501
|
+
*/
|
|
17211
18502
|
const Component$1 = ({
|
|
17212
18503
|
features,
|
|
17213
18504
|
onClickPrintLabel,
|
|
@@ -17247,6 +18538,36 @@ const Component$1 = ({
|
|
|
17247
18538
|
warehouse: warehouse
|
|
17248
18539
|
});
|
|
17249
18540
|
};
|
|
18541
|
+
/**
|
|
18542
|
+
* # Registered View Shipment Element
|
|
18543
|
+
*
|
|
18544
|
+
* - This is the registered `<ViewShipment />` element that will be used to render the
|
|
18545
|
+
* `<ViewShipment.Element />` component.
|
|
18546
|
+
*
|
|
18547
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
18548
|
+
* the `<ViewShipment.Element />` component.
|
|
18549
|
+
*
|
|
18550
|
+
* @example
|
|
18551
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `ViewShipment`
|
|
18552
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
18553
|
+
* ```tsx
|
|
18554
|
+
* <ViewShipment.Element
|
|
18555
|
+
* onClickPurchaseLabel={({ salesOrderId }) => {
|
|
18556
|
+
* console.log('sales order ID', salesOrderId);
|
|
18557
|
+
* }}
|
|
18558
|
+
* onClickVoidLabel={({ labelId }) => {
|
|
18559
|
+
* console.log('voided label', labelId);
|
|
18560
|
+
* }}
|
|
18561
|
+
* shipmentId="se-1234567"
|
|
18562
|
+
* />
|
|
18563
|
+
* ```
|
|
18564
|
+
*
|
|
18565
|
+
* <br />
|
|
18566
|
+
*
|
|
18567
|
+
* @see {@link ViewShipment.ComponentProps | The **props** that can be passed into the `<ViewShipment.Element />` component}
|
|
18568
|
+
*
|
|
18569
|
+
* @see {@link VoidLabel.Element | The next step in the label purchase workflow `<VoidLabel.Element />`}
|
|
18570
|
+
**/
|
|
17250
18571
|
const Element$2 = alchemy.createElement(Component$1, ErrorFallback, {
|
|
17251
18572
|
css: {
|
|
17252
18573
|
height: "100%",
|
|
@@ -17370,6 +18691,31 @@ const Message = ({
|
|
|
17370
18691
|
});
|
|
17371
18692
|
};
|
|
17372
18693
|
|
|
18694
|
+
/**
|
|
18695
|
+
* # Void Label Component
|
|
18696
|
+
*
|
|
18697
|
+
* - The `<VoidLabel />` component is used to void a given shipping label. When a label is voided,
|
|
18698
|
+
* you then get the option to view the associated shipment via the `View Shipment` Element, or
|
|
18699
|
+
* you can purchase another label for the shipment via the `Purchase Label` Element.
|
|
18700
|
+
*
|
|
18701
|
+
* @param ComponentProps The base props that will be passed into the `<VoidLabel />` component.
|
|
18702
|
+
*
|
|
18703
|
+
* @returns Element An EmotionJSX.Element that will render the `<VoidLabel />` component
|
|
18704
|
+
* with all the appropriate wrappers.
|
|
18705
|
+
*
|
|
18706
|
+
* @example
|
|
18707
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
18708
|
+
* ```tsx
|
|
18709
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
18710
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
18711
|
+
* resources: { en },
|
|
18712
|
+
* });
|
|
18713
|
+
* ```
|
|
18714
|
+
*
|
|
18715
|
+
* <br />
|
|
18716
|
+
*
|
|
18717
|
+
* @see {@link VoidLabel.Element | The **Element** created to render `<VoidLabel />`}
|
|
18718
|
+
*/
|
|
17373
18719
|
const Component = ({
|
|
17374
18720
|
features,
|
|
17375
18721
|
labelId,
|
|
@@ -17421,6 +18767,37 @@ const Component = ({
|
|
|
17421
18767
|
})]
|
|
17422
18768
|
});
|
|
17423
18769
|
};
|
|
18770
|
+
/**
|
|
18771
|
+
* # Registered Void Label Element
|
|
18772
|
+
*
|
|
18773
|
+
* - This is the registered `<VoidLabel />` element that will be used to render the
|
|
18774
|
+
* `<VoidLabel.Element />` component.
|
|
18775
|
+
*
|
|
18776
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
18777
|
+
* the `<VoidLabel.Element />` component.
|
|
18778
|
+
*
|
|
18779
|
+
* @example
|
|
18780
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `VoidLabel`
|
|
18781
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
18782
|
+
* ```tsx
|
|
18783
|
+
* <VoidLabel.Element
|
|
18784
|
+
* labelId="se-1234567"
|
|
18785
|
+
* onComplete={() => console.log('onComplete')}
|
|
18786
|
+
* onSuccess={(_, { salesOrderIds: [salesOrderId] }) =>
|
|
18787
|
+
* console.log('sales order ID', salesOrderId)
|
|
18788
|
+
* }
|
|
18789
|
+
* onViewShipment={({ shipmentId }) => {
|
|
18790
|
+
* console.log('onViewShipment', shipmentId);
|
|
18791
|
+
* }}
|
|
18792
|
+
* />
|
|
18793
|
+
* ```
|
|
18794
|
+
*
|
|
18795
|
+
* <br />
|
|
18796
|
+
*
|
|
18797
|
+
* @see {@link VoidLabel.ComponentProps | The **props** that can be passed into the `<VoidLabel.Element />` component}
|
|
18798
|
+
*
|
|
18799
|
+
* @see {@link PurchaseLabel.Element | Go back to the frst step in the label purchase workflow `<PurchaseLabel.Element />`}
|
|
18800
|
+
*/
|
|
17424
18801
|
const Element$1 = alchemy.createElement(Component, ErrorFallback, {
|
|
17425
18802
|
css: {
|
|
17426
18803
|
height: "100%",
|
|
@@ -17439,6 +18816,31 @@ var voidLabel = /*#__PURE__*/Object.freeze({
|
|
|
17439
18816
|
Element: Element$1
|
|
17440
18817
|
});
|
|
17441
18818
|
|
|
18819
|
+
/**
|
|
18820
|
+
* @internal
|
|
18821
|
+
*
|
|
18822
|
+
* # Label Workflow Component
|
|
18823
|
+
*
|
|
18824
|
+
* @example
|
|
18825
|
+
* ```tsx
|
|
18826
|
+
* const {
|
|
18827
|
+
* labelId,
|
|
18828
|
+
* multiplexedId,
|
|
18829
|
+
* isVoidingLabel,
|
|
18830
|
+
* shipmentId,
|
|
18831
|
+
* setLabelId,
|
|
18832
|
+
* setShipmentId,
|
|
18833
|
+
* setIsVoidingLabel,
|
|
18834
|
+
* } = useLabelWorkflow({
|
|
18835
|
+
* _labelId,
|
|
18836
|
+
* _multiplexedId,
|
|
18837
|
+
* });
|
|
18838
|
+
* ```
|
|
18839
|
+
*
|
|
18840
|
+
* <br />
|
|
18841
|
+
*
|
|
18842
|
+
* @see {@link LabelWorkflow.Element | The `<LabelWorkflow.Element />` component using this hook}
|
|
18843
|
+
*/
|
|
17442
18844
|
const useLabelWorkflow = ({
|
|
17443
18845
|
_multiplexedId,
|
|
17444
18846
|
_labelId
|
|
@@ -17463,6 +18865,33 @@ const useLabelWorkflow = ({
|
|
|
17463
18865
|
shipmentId
|
|
17464
18866
|
};
|
|
17465
18867
|
};
|
|
18868
|
+
/**
|
|
18869
|
+
* @internal
|
|
18870
|
+
*
|
|
18871
|
+
* # Label Workflow Element
|
|
18872
|
+
*
|
|
18873
|
+
* - The `<LabelWorkflow.Element />` component is a composition of the PurchaseLabel, ViewShipment,
|
|
18874
|
+
* and VoidLabel elements that allows users to purchase a label, view the shipment details, and optionally void their shipping label.
|
|
18875
|
+
*
|
|
18876
|
+
* @param LabelWorkflowProps The props necessary to render the `<LabelWorkflow.Element />` for shipment
|
|
18877
|
+
* based or sales order based label purchasing.
|
|
18878
|
+
*
|
|
18879
|
+
* @returns Element A React Element that will render the `<LabelWorkflow />` component.
|
|
18880
|
+
*
|
|
18881
|
+
* @example
|
|
18882
|
+
* ```tsx
|
|
18883
|
+
* <LabelWorkflow
|
|
18884
|
+
* {...elementProps}
|
|
18885
|
+
* callbacks={{ onLabelCreateSuccess }}
|
|
18886
|
+
* multiplexedId={elementIdProps}
|
|
18887
|
+
* />
|
|
18888
|
+
* ```
|
|
18889
|
+
*
|
|
18890
|
+
* <br />
|
|
18891
|
+
*
|
|
18892
|
+
* @see {@link LabelWorkflowProps | The props that are passed into the `<LabelWorkflow />` component}
|
|
18893
|
+
* @see {@link LabelWorkflow.useLabelWorkflow | The `hook` that is used to manage the state of the `<LabelWorkflow />` component}
|
|
18894
|
+
*/
|
|
17466
18895
|
const Element = (
|
|
17467
18896
|
/*
|
|
17468
18897
|
The passed props are underscore prefixed as they will be stashed, then from them stateful versions will be made
|
|
@@ -17532,7 +18961,8 @@ The passed props are underscore prefixed as they will be stashed, then from them
|
|
|
17532
18961
|
|
|
17533
18962
|
var labelWorkflow = /*#__PURE__*/Object.freeze({
|
|
17534
18963
|
__proto__: null,
|
|
18964
|
+
useLabelWorkflow: useLabelWorkflow,
|
|
17535
18965
|
Element: Element
|
|
17536
18966
|
});
|
|
17537
18967
|
|
|
17538
|
-
export { accountSettings as AccountSettings, AddFundsForm, AutoFundingForm, ButtonGroup, CarrierBalance, CollapsiblePanel, CopyButton, Country, Cube, DateRangeCombo, DateRangeSelect, ErrorFallback, fields as Field, FieldLabel, FormPortal, FundAndPurchase, InlineLabel, ItemsBreakdown, labelWorkflow as LabelWorkflow, LinkAction, listCarriers$1 as ListCarriers, Loader, ManageFunding, manageWarehouses$1 as ManageWarehouses, onboarding as Onboarding, PageLayoutProvider, PaymentMethodSettings, Portal, PoweredByShipEngine, purchaseLabel as PurchaseLabel, RootPortalProvider, Section, Spacer, Spread, StoryNotes, index as Templates, UsState, UsaCity, viewShipment as ViewShipment, voidLabel as VoidLabel, autoFundingSchema, calculateTotal, capitalizeFirstLetter, convertDimensions, convertWeight, countries, countryCodes, createCodedErrors, createDictionary, createStyles, currencySymbol, daysAfter, errorMap, euCountryCodes, extendZod, featureFlagComponentNameLookup, formLogger, formatCreditCardNumber, formatDate, formatDateDDMMYY, formatExpiration, formatFractionalWeight, formatMoney, getAddFundsSchema, getCarrierIdByCarrierCode, getCustomsFromSalesOrder, getExpirationYears, getFeatures, getIsCustomsRequiredForSalesOrder, getIsCustomsRequiredForShipment, getIsInternationalShipment, getPendingShipment, getRateRequiresAcknowledgement, getRelativeDates, getRequestedServices, getSalesOrderItemsFromSalesOrderOrShipment, getTotalRateAmount, isDomesticAddress, isEmptyAddress, isFlatRatePackageCode, isMilitaryAddress, isNowOrInTheFuture, isPoBox, isPoBoxAddress, isString, isUnitedStatesTerritory, isUnsupportedByUps, isUpsCarrier, isUspsCarrier, moneySchema, mostRecent, nextDayCutoff, omitTime, overrideCarrierCodes$1 as overrideCarrierCodes, phoneSchema, phoneSchemaUnvalidated, postalCodeRegex$3 as postalCodeRegex, sortByCreationDate, throwAny, throwJoinedMessages, usCities, usStateCodes, usStates, useAddressValidation, useBlackboxDetection, useCarrierMetadata, useConfirmationOptions, useCountryCodeOptions, useCustomsContentsOptions, useCustomsNonDeliveryOptions, useDateRangeOptions, useExpirationMonthOptions, useFeatures, useInsuranceProviderOptions, useNestedForm, usePackageOptions, usePageLayout, useRateOptions, useRootPortal, useRunOnceOnTrue, useServiceCodeOptions, useShipmentMetadata, useShippingPresetsOptions, useStateCodeOptions, useToggle, useWarehouseOptions, validationResolver };
|
|
18968
|
+
export { accountSettings as AccountSettings, AddFundsForm, AutoFundingForm, ButtonGroup, CarrierBalance, CollapsiblePanel, CopyButton, Country, Cube, DateRangeCombo, DateRangeSelect, ErrorFallback, fields as Field, FieldLabel, FormPortal, FundAndPurchase, InlineLabel, ItemsBreakdown, labelWorkflow as LabelWorkflow, LinkAction, listCarriers$1 as ListCarriers, Loader, ManageFunding, manageWarehouses$1 as ManageWarehouses, onboarding as Onboarding, PageLayoutProvider, PaymentMethodSettings, Portal, PoweredByShipEngine, purchaseLabel as PurchaseLabel, RootPortalProvider, Section, Spacer, Spread, StoryNotes, index as Templates, UsState, UsaCity, viewShipment as ViewShipment, voidLabel as VoidLabel, autoFundingSchema, calculateTotal, capitalizeFirstLetter, convertDecimalWeightToFractionalWeight, convertDimensions, convertFractionalWeightToDecimalWeight, convertPoundsAndOuncesToOunces, convertWeight, countries, countryCodes, createCodedErrors, createDictionary, createStyles, currencySymbol, daysAfter, errorMap, euCountryCodes, extendZod, featureFlagComponentNameLookup, featureFlags, formLogger, formatCreditCardNumber, formatDate, formatDateDDMMYY, formatDimensions, formatExpiration, formatFractionalWeight, formatMoney, getAddFundsSchema, getCarrierIdByCarrierCode, getCustomsFromSalesOrder, getExpirationYears, getFeatures, getIsCustomsRequiredForSalesOrder, getIsCustomsRequiredForShipment, getIsInternationalShipment, getPendingShipment, getRateRequiresAcknowledgement, getRelativeDates, getRequestedServices, getSalesOrderItemsFromSalesOrderOrShipment, getTotalRateAmount, isDecimalWeight, isDomesticAddress, isEmptyAddress, isFlatRatePackageCode, isMetricWeightUnit, isMilitaryAddress, isNowOrInTheFuture, isPoBox, isPoBoxAddress, isString, isUnitedStatesTerritory, isUnsupportedByUps, isUpsCarrier, isUspsCarrier, moneySchema, mostRecent, nextDayCutoff, omitTime, overrideCarrierCodes$1 as overrideCarrierCodes, phoneSchema, phoneSchemaUnvalidated, postalCodeRegex$3 as postalCodeRegex, sortByCreationDate, throwAny, throwJoinedMessages, usCities, usStateCodes, usStates, useAddressValidation, useBlackboxDetection, useCarrierMetadata, useConfirmationOptions, useCountryCodeOptions, useCustomsContentsOptions, useCustomsNonDeliveryOptions, useDateRangeOptions, useExpirationMonthOptions, useFeatures, useInsuranceProviderOptions, useNestedForm, usePackageOptions, usePageLayout, useRateOptions, useRootPortal, useRunOnceOnTrue, useScrubErrors, useServiceCodeOptions, useShipmentMetadata, useShippingPresetsOptions, useStateCodeOptions, useToggle, useWarehouseOptions, validationResolver };
|