@shipengine/elements 0.33.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1975 -493
- package/index.js +1970 -496
- package/package.json +1 -1
- package/src/components/add-funds-form/add-funds-form.d.ts +22 -2
- package/src/components/add-funds-form/add-funds-schema.d.ts +26 -0
- package/src/components/address-preference-context/address-preference-context.d.ts +8 -0
- package/src/components/auto-funding-form/auto-funding-form.d.ts +22 -0
- package/src/components/auto-funding-form/auto-funding-schema.d.ts +17 -0
- package/src/components/button-group/button-group.d.ts +29 -0
- package/src/components/carrier-balance/carrier-balance.d.ts +23 -0
- package/src/components/collapsible-panel/collapsible-panel.d.ts +32 -0
- package/src/components/copy/copy-button.d.ts +4 -0
- package/src/components/cube/cube.d.ts +16 -0
- package/src/components/date-range-combo/date-range-combo.d.ts +14 -0
- package/src/components/date-range-select/date-range-select.d.ts +6 -0
- package/src/components/error-fallback/error-fallback.d.ts +12 -1
- package/src/components/field-label/field-label.d.ts +10 -0
- package/src/components/form-portal/form-portal.d.ts +9 -0
- package/src/components/fund-and-purchase/fund-and-purchase.d.ts +13 -0
- package/src/components/inline-label/inline-label.d.ts +10 -0
- package/src/components/items-breakdown/items-breakdown.d.ts +15 -0
- package/src/components/label-layout/label-layout.d.ts +5 -0
- package/src/components/link-action/link-action.d.ts +10 -0
- package/src/components/loader/loader.d.ts +5 -0
- package/src/components/manage-funding/manage-funding.d.ts +26 -0
- package/src/components/payment-method-settings/payment-method-settings.d.ts +19 -0
- package/src/components/portal/portal.d.ts +10 -1
- package/src/components/powered-by-shipengine/powered-by-shipengine.d.ts +8 -0
- package/src/components/section/section.d.ts +10 -0
- package/src/components/spacer/spacer.d.ts +30 -0
- package/src/components/spread/spread.d.ts +10 -0
- package/src/components/story-notes/story-notes.d.ts +10 -1
- package/src/components/templates/carrier-terms-form/carrier-terms-form.styles.d.ts +1 -0
- package/src/components/templates/landing-page/landing-page.d.ts +2 -1
- package/src/components/templates/onboarding/onboarding.d.ts +3 -1
- package/src/components/templates/onboarding/onboarding.styles.d.ts +10 -0
- package/src/components/templates/rate-form/rate-form.d.ts +2 -2
- package/src/components/templates/shipment-form/shipment-form.d.ts +2 -1
- package/src/components/templates/shipment-form/shipment-schema.d.ts +179 -17
- package/src/components/templates/warehouse-form/warehouse-form.d.ts +1 -1
- package/src/components/unit-settings/unit-settings.d.ts +5 -0
- package/src/constants/shipengine/address.d.ts +75 -0
- package/src/elements/account-settings/account-settings.d.ts +139 -3
- package/src/elements/configure-shipment/configure-shipment.d.ts +1 -0
- package/src/elements/configure-shipment/hooks/use-rates-form.d.ts +2 -2
- package/src/elements/configure-shipment/hooks/use-rates-with-cache.d.ts +1 -1
- package/src/elements/configure-shipment/hooks/use-request-rates.d.ts +1 -1
- package/src/elements/configure-shipment/hooks/use-shipment-form.d.ts +1 -0
- package/src/elements/list-carriers/list-carriers.d.ts +31 -0
- package/src/elements/manage-warehouses/manage-warehouses.d.ts +34 -0
- package/src/elements/onboarding/onboarding.d.ts +99 -5
- package/src/elements/purchase-label/purchase-label.d.ts +194 -9
- package/src/elements/shipengine-workflow/label-workflow.d.ts +138 -2
- package/src/elements/view-shipment/view-shipment.d.ts +131 -4
- package/src/elements/void-label/void-label.d.ts +137 -5
- package/src/extensions/zod.d.ts +5 -0
- package/src/factories/shipengine/package.d.ts +11 -0
- package/src/features/wallet-history/wallet-history.d.ts +5 -0
- package/src/hooks/index.d.ts +1 -0
- package/src/hooks/options/use-confirmation-options.d.ts +7 -0
- package/src/hooks/options/use-country-code-options.d.ts +16 -3
- package/src/hooks/options/use-customs-contents-options.d.ts +7 -0
- package/src/hooks/options/use-customs-non-delivery-options.d.ts +7 -0
- package/src/hooks/options/use-date-range-options.d.ts +22 -1
- package/src/hooks/options/use-expiration-month-options.d.ts +7 -0
- package/src/hooks/options/use-insurance-provider-options.d.ts +7 -0
- package/src/hooks/options/use-package-options.d.ts +7 -0
- package/src/hooks/options/use-rate-options.d.ts +11 -1
- package/src/hooks/options/use-service-code-options.d.ts +7 -0
- package/src/hooks/options/use-shipment-metadata.d.ts +8 -0
- package/src/hooks/options/use-shipping-presets-options.d.ts +10 -0
- package/src/hooks/options/use-state-code-options.d.ts +7 -0
- package/src/hooks/options/use-warehouse-options.d.ts +7 -0
- package/src/hooks/use-address-validation.d.ts +7 -0
- package/src/hooks/use-black-box-detection.d.ts +17 -1
- package/src/hooks/use-carrier-metadata.d.ts +7 -0
- package/src/hooks/use-nested-form.d.ts +9 -0
- package/src/hooks/use-page-layout.d.ts +25 -1
- package/src/hooks/use-root-portal.d.ts +15 -2
- package/src/hooks/use-run-once-on-true.d.ts +5 -1
- package/src/hooks/use-scrub-errors.d.ts +6 -3
- package/src/hooks/use-toggle.d.ts +5 -1
- package/src/locales/en/index.d.ts +11 -3
- package/src/schemas/shipengine/money.d.ts +4 -0
- package/src/schemas/shipengine/phone.d.ts +8 -0
- package/src/types/carrier-metadata.d.ts +20 -0
- package/src/utilities/create-dictionary.d.ts +4 -0
- package/src/utilities/date.d.ts +51 -2
- package/src/utilities/error.d.ts +16 -2
- package/src/utilities/feature-flags.d.ts +181 -0
- package/src/utilities/form-logger.d.ts +4 -0
- package/src/utilities/index.d.ts +1 -1
- package/src/utilities/money.d.ts +25 -0
- package/src/utilities/predicates/isString.d.ts +7 -0
- package/src/utilities/rates.d.ts +22 -1
- package/src/utilities/shipengine/address.d.ts +31 -0
- package/src/utilities/shipengine/carrier.d.ts +21 -0
- package/src/utilities/shipengine/dimensions.d.ts +27 -4
- package/src/utilities/shipengine/package.d.ts +4 -0
- package/src/utilities/shipengine/sales-order.d.ts +26 -0
- package/src/utilities/shipengine/shipment.d.ts +12 -0
- package/src/utilities/shipengine/weight.d.ts +92 -2
- package/src/utilities/string.d.ts +7 -0
- package/src/utilities/styles.d.ts +4 -0
- package/src/utilities/validation.d.ts +8 -0
package/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
2
2
|
import { useTranslation, Trans } from 'react-i18next';
|
|
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, Table, TableBody, TableBaseRow, TableBodyCell, TableHeader, TableHeaderCell, Popover, DropdownOptionList, DatePicker as DatePicker$1, BottomSheet } from '@packlink/giger';
|
|
4
|
-
import alchemy, { SE, logger, useValidateAddresses, useListCarriers, useConnectCarrier, useListWarehouses, useUpdateWarehouse, useCreateWarehouse, useDeleteWarehouse, useGetWalletHistory, useGetAccountSettings, useUpdateAccountSettings, 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';
|
|
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
|
+
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,67 +4309,28 @@ const errorMap = (issue, ctx) => {
|
|
|
3533
4309
|
};
|
|
3534
4310
|
};
|
|
3535
4311
|
/**
|
|
3536
|
-
* @
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
const
|
|
3547
|
-
|
|
3548
|
-
|
|
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
|
-
};
|
|
4312
|
+
* @internal
|
|
4313
|
+
*
|
|
4314
|
+
* # Validation Resolver
|
|
4315
|
+
*
|
|
4316
|
+
* @category Utilities
|
|
4317
|
+
*/
|
|
4318
|
+
const validationResolver = schema => (values, context, resolverOptions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4319
|
+
const getValidationResult = () => zodResolver(schema, {
|
|
4320
|
+
errorMap
|
|
4321
|
+
})(values, undefined, resolverOptions);
|
|
4322
|
+
const validationResult = yield formLogger.isSubmitting ? formLogger.log(values, getValidationResult) : getValidationResult();
|
|
4323
|
+
return validationResult;
|
|
4324
|
+
});
|
|
3594
4325
|
|
|
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 = ({
|
|
@@ -4487,10 +5356,10 @@ const useBlackboxDetection = ({
|
|
|
4487
5356
|
}) => {
|
|
4488
5357
|
useEffect(() => {
|
|
4489
5358
|
// basic configurations must be on page before snare.js is loaded
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
5359
|
+
window.io_install_stm = false; // do not install Active X
|
|
5360
|
+
window.io_exclude_stm = 12; // do not run Active X
|
|
5361
|
+
window.io_install_flash = false; // do not install Flash
|
|
5362
|
+
window.io_enable_rip = true; // collect Real IP information
|
|
4494
5363
|
const pollBlackBox = () => {
|
|
4495
5364
|
try {
|
|
4496
5365
|
if (typeof ioGetBlackbox !== "function") {
|
|
@@ -4509,7 +5378,7 @@ const useBlackboxDetection = ({
|
|
|
4509
5378
|
};
|
|
4510
5379
|
const intervalId = setInterval(pollBlackBox, 500);
|
|
4511
5380
|
// attach script to DOM
|
|
4512
|
-
const script =
|
|
5381
|
+
const script = document.createElement("script");
|
|
4513
5382
|
script.type = "text/javascript";
|
|
4514
5383
|
script.async = true;
|
|
4515
5384
|
script.src = "https://mpsnare.iesnare.com/snare.js";
|
|
@@ -4518,20 +5387,44 @@ const useBlackboxDetection = ({
|
|
|
4518
5387
|
onError();
|
|
4519
5388
|
}
|
|
4520
5389
|
});
|
|
4521
|
-
|
|
5390
|
+
document.head.appendChild(script);
|
|
4522
5391
|
return () => {
|
|
4523
5392
|
if (intervalId) {
|
|
4524
5393
|
clearTimeout(intervalId);
|
|
4525
5394
|
}
|
|
4526
|
-
delete
|
|
4527
|
-
delete
|
|
4528
|
-
delete
|
|
4529
|
-
delete
|
|
4530
|
-
|
|
5395
|
+
delete window.io_install_stm;
|
|
5396
|
+
delete window.io_exclude_stm;
|
|
5397
|
+
delete window.io_install_flash;
|
|
5398
|
+
delete window.io_enable_rip;
|
|
5399
|
+
document.head.removeChild(script);
|
|
4531
5400
|
};
|
|
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
|
}) => {
|
|
@@ -4661,179 +5600,25 @@ const Component$5 = ({
|
|
|
4661
5600
|
const errors = [...(updateWarehouseErrors !== null && updateWarehouseErrors !== void 0 ? updateWarehouseErrors : []), ...(createWarehouseErrors !== null && createWarehouseErrors !== void 0 ? createWarehouseErrors : []), ...(deleteWarehouseErrors !== null && deleteWarehouseErrors !== void 0 ? deleteWarehouseErrors : [])];
|
|
4662
5601
|
return jsx(CollapsiblePanel, Object.assign({
|
|
4663
5602
|
errors: errors,
|
|
4664
|
-
isSaving: creatingWarehouse || deletingWarehouse || updatingWarehouse,
|
|
4665
|
-
title: t("account-settings:sections.warehouses")
|
|
4666
|
-
}, {
|
|
4667
|
-
children: isLoadingWarehouses ? jsx(Loader, {
|
|
4668
|
-
message: t("loading.warehouses")
|
|
4669
|
-
}) : jsx(ManageWarehouses, {
|
|
4670
|
-
errors: errors,
|
|
4671
|
-
onAdd: handleSubmitAddNewWarehouse,
|
|
4672
|
-
onDelete: handleDeleteWarehouse,
|
|
4673
|
-
onEdit: handleSubmitEditWarehouse,
|
|
4674
|
-
onSetDefault: handleSetDefault,
|
|
4675
|
-
warehouses: sortedWarehouses || []
|
|
4676
|
-
})
|
|
4677
|
-
}));
|
|
4678
|
-
};
|
|
4679
|
-
|
|
4680
|
-
var manageWarehouses$1 = /*#__PURE__*/Object.freeze({
|
|
4681
|
-
__proto__: null,
|
|
4682
|
-
Component: Component$5
|
|
4683
|
-
});
|
|
4684
|
-
|
|
4685
|
-
var uncurryThis$6 = functionUncurryThis;
|
|
4686
|
-
|
|
4687
|
-
// `thisNumberValue` abstract operation
|
|
4688
|
-
// https://tc39.es/ecma262/#sec-thisnumbervalue
|
|
4689
|
-
var thisNumberValue$1 = uncurryThis$6(1.0.valueOf);
|
|
4690
|
-
|
|
4691
|
-
var toIntegerOrInfinity$1 = toIntegerOrInfinity$6;
|
|
4692
|
-
var toString$5 = toString$c;
|
|
4693
|
-
var requireObjectCoercible$2 = requireObjectCoercible$9;
|
|
4694
|
-
|
|
4695
|
-
var $RangeError$1 = RangeError;
|
|
4696
|
-
|
|
4697
|
-
// `String.prototype.repeat` method implementation
|
|
4698
|
-
// https://tc39.es/ecma262/#sec-string.prototype.repeat
|
|
4699
|
-
var stringRepeat = function repeat(count) {
|
|
4700
|
-
var str = toString$5(requireObjectCoercible$2(this));
|
|
4701
|
-
var result = '';
|
|
4702
|
-
var n = toIntegerOrInfinity$1(count);
|
|
4703
|
-
if (n < 0 || n == Infinity) throw $RangeError$1('Wrong number of repetitions');
|
|
4704
|
-
for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;
|
|
4705
|
-
return result;
|
|
4706
|
-
};
|
|
4707
|
-
|
|
4708
|
-
var $$a = _export;
|
|
4709
|
-
var uncurryThis$5 = functionUncurryThis;
|
|
4710
|
-
var toIntegerOrInfinity = toIntegerOrInfinity$6;
|
|
4711
|
-
var thisNumberValue = thisNumberValue$1;
|
|
4712
|
-
var $repeat = stringRepeat;
|
|
4713
|
-
var fails$4 = fails$q;
|
|
4714
|
-
|
|
4715
|
-
var $RangeError = RangeError;
|
|
4716
|
-
var $String = String;
|
|
4717
|
-
var floor = Math.floor;
|
|
4718
|
-
var repeat = uncurryThis$5($repeat);
|
|
4719
|
-
var stringSlice$2 = uncurryThis$5(''.slice);
|
|
4720
|
-
var nativeToFixed = uncurryThis$5(1.0.toFixed);
|
|
4721
|
-
|
|
4722
|
-
var pow = function (x, n, acc) {
|
|
4723
|
-
return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
|
|
4724
|
-
};
|
|
4725
|
-
|
|
4726
|
-
var log = function (x) {
|
|
4727
|
-
var n = 0;
|
|
4728
|
-
var x2 = x;
|
|
4729
|
-
while (x2 >= 4096) {
|
|
4730
|
-
n += 12;
|
|
4731
|
-
x2 /= 4096;
|
|
4732
|
-
}
|
|
4733
|
-
while (x2 >= 2) {
|
|
4734
|
-
n += 1;
|
|
4735
|
-
x2 /= 2;
|
|
4736
|
-
} return n;
|
|
4737
|
-
};
|
|
4738
|
-
|
|
4739
|
-
var multiply = function (data, n, c) {
|
|
4740
|
-
var index = -1;
|
|
4741
|
-
var c2 = c;
|
|
4742
|
-
while (++index < 6) {
|
|
4743
|
-
c2 += n * data[index];
|
|
4744
|
-
data[index] = c2 % 1e7;
|
|
4745
|
-
c2 = floor(c2 / 1e7);
|
|
4746
|
-
}
|
|
4747
|
-
};
|
|
4748
|
-
|
|
4749
|
-
var divide = function (data, n) {
|
|
4750
|
-
var index = 6;
|
|
4751
|
-
var c = 0;
|
|
4752
|
-
while (--index >= 0) {
|
|
4753
|
-
c += data[index];
|
|
4754
|
-
data[index] = floor(c / n);
|
|
4755
|
-
c = (c % n) * 1e7;
|
|
4756
|
-
}
|
|
4757
|
-
};
|
|
4758
|
-
|
|
4759
|
-
var dataToString = function (data) {
|
|
4760
|
-
var index = 6;
|
|
4761
|
-
var s = '';
|
|
4762
|
-
while (--index >= 0) {
|
|
4763
|
-
if (s !== '' || index === 0 || data[index] !== 0) {
|
|
4764
|
-
var t = $String(data[index]);
|
|
4765
|
-
s = s === '' ? t : s + repeat('0', 7 - t.length) + t;
|
|
4766
|
-
}
|
|
4767
|
-
} return s;
|
|
5603
|
+
isSaving: creatingWarehouse || deletingWarehouse || updatingWarehouse,
|
|
5604
|
+
title: t("account-settings:sections.warehouses")
|
|
5605
|
+
}, {
|
|
5606
|
+
children: isLoadingWarehouses ? jsx(Loader, {
|
|
5607
|
+
message: t("loading.warehouses")
|
|
5608
|
+
}) : jsx(ManageWarehouses, {
|
|
5609
|
+
errors: errors,
|
|
5610
|
+
onAdd: handleSubmitAddNewWarehouse,
|
|
5611
|
+
onDelete: handleDeleteWarehouse,
|
|
5612
|
+
onEdit: handleSubmitEditWarehouse,
|
|
5613
|
+
onSetDefault: handleSetDefault,
|
|
5614
|
+
warehouses: sortedWarehouses || []
|
|
5615
|
+
})
|
|
5616
|
+
}));
|
|
4768
5617
|
};
|
|
4769
5618
|
|
|
4770
|
-
var
|
|
4771
|
-
|
|
4772
|
-
|
|
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
|
-
}
|
|
5619
|
+
var manageWarehouses$1 = /*#__PURE__*/Object.freeze({
|
|
5620
|
+
__proto__: null,
|
|
5621
|
+
Component: Component$5
|
|
4837
5622
|
});
|
|
4838
5623
|
|
|
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";
|
|
@@ -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,
|
|
@@ -7423,6 +8286,7 @@ const getWrapperStyles = theme => /*#__PURE__*/css$1(process.env.NODE_ENV === "p
|
|
|
7423
8286
|
|
|
7424
8287
|
const DatePickerController = createFieldController();
|
|
7425
8288
|
const DatePicker = fieldProps => {
|
|
8289
|
+
const alchemy = useContext(AlchemyContext);
|
|
7426
8290
|
const theme = useTheme();
|
|
7427
8291
|
const datePickerRef = useRef(null);
|
|
7428
8292
|
return jsx(DatePickerController, Object.assign({}, fieldProps, {
|
|
@@ -7443,7 +8307,7 @@ const DatePicker = fieldProps => {
|
|
|
7443
8307
|
css: getOverrideStyles(theme)
|
|
7444
8308
|
}, {
|
|
7445
8309
|
children: jsx(ReactDatePicker, Object.assign({
|
|
7446
|
-
locale:
|
|
8310
|
+
locale: alchemy === null || alchemy === void 0 ? void 0 : alchemy.locale
|
|
7447
8311
|
}, datePickerProps, {
|
|
7448
8312
|
customInput: /*#__PURE__*/createElement$2( /*#__PURE__*/forwardRef(function InputWrapper(_a, forwardedRef) {
|
|
7449
8313
|
var _b;
|
|
@@ -8167,6 +9031,19 @@ const getAcknowledgementLabel = (serviceCode, packageType) => {
|
|
|
8167
9031
|
});
|
|
8168
9032
|
}
|
|
8169
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
|
+
}));
|
|
8170
9047
|
default:
|
|
8171
9048
|
return null;
|
|
8172
9049
|
}
|
|
@@ -8578,6 +9455,10 @@ var fields = /*#__PURE__*/Object.freeze({
|
|
|
8578
9455
|
});
|
|
8579
9456
|
|
|
8580
9457
|
/**
|
|
9458
|
+
* @internal
|
|
9459
|
+
*
|
|
9460
|
+
* # Form Portal Component
|
|
9461
|
+
*
|
|
8581
9462
|
* A drop-in replacement for the `<form>` tag that allows nested forms.
|
|
8582
9463
|
*
|
|
8583
9464
|
* Via portals, the <form> tag is mounted as a sibling of the app root. The form's
|
|
@@ -8647,6 +9528,10 @@ const styles$o = createStyles({
|
|
|
8647
9528
|
});
|
|
8648
9529
|
|
|
8649
9530
|
/**
|
|
9531
|
+
* @internal
|
|
9532
|
+
*
|
|
9533
|
+
* # Money Schema
|
|
9534
|
+
*
|
|
8650
9535
|
* @category Form Validation
|
|
8651
9536
|
*/
|
|
8652
9537
|
const moneySchema = z.object({
|
|
@@ -8655,14 +9540,33 @@ const moneySchema = z.object({
|
|
|
8655
9540
|
});
|
|
8656
9541
|
|
|
8657
9542
|
/**
|
|
9543
|
+
* @internal
|
|
9544
|
+
*
|
|
9545
|
+
* # Phone utils
|
|
9546
|
+
*
|
|
8658
9547
|
* @category Form Validation
|
|
8659
9548
|
*/
|
|
8660
9549
|
const phoneSchema = (defaultCountryCode = "US") => z.string().trim().refine(val => isValidPhoneNumber(val, defaultCountryCode), "schemaErrors.notAValidPhoneNumber");
|
|
8661
9550
|
/**
|
|
9551
|
+
* @internal
|
|
9552
|
+
*
|
|
9553
|
+
* # Phone utils
|
|
9554
|
+
*
|
|
8662
9555
|
* @category Form Validation
|
|
8663
9556
|
*/
|
|
8664
9557
|
const phoneSchemaUnvalidated = z.string().trim();
|
|
8665
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
|
+
*/
|
|
8666
9570
|
const getAddFundsSchema = (minimumAmount = 10) => z.object({
|
|
8667
9571
|
funds: moneySchema.extend({
|
|
8668
9572
|
amount: z.number().min(minimumAmount)
|
|
@@ -8670,9 +9574,15 @@ const getAddFundsSchema = (minimumAmount = 10) => z.object({
|
|
|
8670
9574
|
}).transform(data => data.funds);
|
|
8671
9575
|
|
|
8672
9576
|
/**
|
|
8673
|
-
*
|
|
9577
|
+
* @internal
|
|
9578
|
+
*
|
|
9579
|
+
* # Add Funds Form Component
|
|
9580
|
+
*
|
|
9581
|
+
* - Form for adding funds to a carrier's account.
|
|
8674
9582
|
*
|
|
8675
|
-
* 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}
|
|
8676
9586
|
*/
|
|
8677
9587
|
const AddFundsForm = ({
|
|
8678
9588
|
carrierId,
|
|
@@ -8814,7 +9724,7 @@ const AddFundsForm = ({
|
|
|
8814
9724
|
}))]
|
|
8815
9725
|
}))]
|
|
8816
9726
|
})]
|
|
8817
|
-
})), addFunds.error && jsxs(Fragment, {
|
|
9727
|
+
})), !children && addFunds.error && jsxs(Fragment, {
|
|
8818
9728
|
children: [jsx(Spacer, {
|
|
8819
9729
|
multiplier: 1
|
|
8820
9730
|
}), jsx(InlineNotification, Object.assign({
|
|
@@ -8824,6 +9734,7 @@ const AddFundsForm = ({
|
|
|
8824
9734
|
children: addFunds.error[0].message
|
|
8825
9735
|
}))]
|
|
8826
9736
|
}), children === null || children === void 0 ? void 0 : children({
|
|
9737
|
+
error: addFunds.error,
|
|
8827
9738
|
isCustomAmount: selectedChip.value === "custom",
|
|
8828
9739
|
isSubmitted,
|
|
8829
9740
|
isSubmitting,
|
|
@@ -8853,6 +9764,13 @@ const styles$n = createStyles({
|
|
|
8853
9764
|
}
|
|
8854
9765
|
});
|
|
8855
9766
|
|
|
9767
|
+
/**
|
|
9768
|
+
* @internal
|
|
9769
|
+
*
|
|
9770
|
+
* # Auto Funding Form Schema
|
|
9771
|
+
*
|
|
9772
|
+
* @see {@link AutoFundingForm | Auto Funding Form component using this schema}
|
|
9773
|
+
* */
|
|
8856
9774
|
const autoFundingSchema = z.object({
|
|
8857
9775
|
isEnabled: z.boolean(),
|
|
8858
9776
|
lowBalancePurchaseThreshold: moneySchema.extend({
|
|
@@ -8865,10 +9783,19 @@ const autoFundingSchema = z.object({
|
|
|
8865
9783
|
});
|
|
8866
9784
|
|
|
8867
9785
|
/**
|
|
9786
|
+
* @internal
|
|
9787
|
+
*
|
|
9788
|
+
* # Auto Funding Form Component
|
|
9789
|
+
*
|
|
8868
9790
|
* This form that allows users to enable or disable auto funding, and
|
|
8869
9791
|
* configure auto funding rules in ShipEngine API.
|
|
8870
9792
|
*
|
|
8871
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}
|
|
8872
9799
|
*/
|
|
8873
9800
|
const AutoFundingForm = ({
|
|
8874
9801
|
carrierId
|
|
@@ -9045,6 +9972,11 @@ const styles$m = isLabelRight => createStyles({
|
|
|
9045
9972
|
})
|
|
9046
9973
|
});
|
|
9047
9974
|
|
|
9975
|
+
/**
|
|
9976
|
+
* @internal
|
|
9977
|
+
*
|
|
9978
|
+
* # Inline Label Component
|
|
9979
|
+
*/
|
|
9048
9980
|
const InlineLabel = ({
|
|
9049
9981
|
children,
|
|
9050
9982
|
label,
|
|
@@ -9064,6 +9996,16 @@ const styles$l = createStyles({
|
|
|
9064
9996
|
})
|
|
9065
9997
|
});
|
|
9066
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
|
+
*/
|
|
9067
10009
|
const CarrierBalance = ({
|
|
9068
10010
|
balance,
|
|
9069
10011
|
carrierId
|
|
@@ -9093,6 +10035,22 @@ const CarrierBalance = ({
|
|
|
9093
10035
|
}));
|
|
9094
10036
|
};
|
|
9095
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
|
+
*/
|
|
9096
10054
|
const ManageFunding = ({
|
|
9097
10055
|
carrierId
|
|
9098
10056
|
}) => {
|
|
@@ -9165,6 +10123,12 @@ const AddressParser = ({
|
|
|
9165
10123
|
const payload = values;
|
|
9166
10124
|
onSubmit(payload);
|
|
9167
10125
|
}));
|
|
10126
|
+
form.watch((data, {
|
|
10127
|
+
name
|
|
10128
|
+
}) => {
|
|
10129
|
+
var _a;
|
|
10130
|
+
if (name === "fullAddress" && ((_a = data.fullAddress) === null || _a === void 0 ? void 0 : _a.length) == null) reset === null || reset === void 0 ? void 0 : reset();
|
|
10131
|
+
});
|
|
9168
10132
|
const errors = (parseErrors === null || parseErrors === void 0 ? void 0 : parseErrors.length) ? [t("errorMessages.parsingFailure")] : undefined;
|
|
9169
10133
|
const formInterface = jsxs(Fragment, {
|
|
9170
10134
|
children: [jsx(TextArea, {
|
|
@@ -9220,7 +10184,7 @@ const styles$k = createStyles({
|
|
|
9220
10184
|
flex: "1 0 100%"
|
|
9221
10185
|
},
|
|
9222
10186
|
display: "flex",
|
|
9223
|
-
flex: "1 0
|
|
10187
|
+
flex: "1 0 64%",
|
|
9224
10188
|
width: "100%"
|
|
9225
10189
|
},
|
|
9226
10190
|
stateZipWrapper: theme => ({
|
|
@@ -9250,7 +10214,10 @@ const AddressFields = ({
|
|
|
9250
10214
|
const {
|
|
9251
10215
|
t
|
|
9252
10216
|
} = useTranslation();
|
|
9253
|
-
const
|
|
10217
|
+
const {
|
|
10218
|
+
countryCodeOptions,
|
|
10219
|
+
defaultCountryCodeOption
|
|
10220
|
+
} = useCountryCodeOptions(domestic);
|
|
9254
10221
|
const stateCodeOptions = useStateCodeOptions(domestic);
|
|
9255
10222
|
const {
|
|
9256
10223
|
isSubmitted
|
|
@@ -9274,6 +10241,7 @@ const AddressFields = ({
|
|
|
9274
10241
|
nativeLabel: true
|
|
9275
10242
|
}), jsx(SelectAutoComplete, {
|
|
9276
10243
|
control: form.control,
|
|
10244
|
+
defaultValue: defaultCountryCodeOption === null || defaultCountryCodeOption === void 0 ? void 0 : defaultCountryCodeOption.value,
|
|
9277
10245
|
form: formId,
|
|
9278
10246
|
label: t("address.fields.countryCode"),
|
|
9279
10247
|
labelWeight: "normal",
|
|
@@ -9422,6 +10390,10 @@ function nullishDefault(defaultValue) {
|
|
|
9422
10390
|
return this.nullish().transform(v => v !== null && v !== void 0 ? v : defaultValue);
|
|
9423
10391
|
}
|
|
9424
10392
|
/**
|
|
10393
|
+
* @internal
|
|
10394
|
+
*
|
|
10395
|
+
* # Form Utilities
|
|
10396
|
+
*
|
|
9425
10397
|
* @category Form Validation
|
|
9426
10398
|
*/
|
|
9427
10399
|
const extendZod = () => {
|
|
@@ -9782,29 +10754,23 @@ const AddressPreferenceSelect = ({
|
|
|
9782
10754
|
case "ERROR":
|
|
9783
10755
|
return jsxs(Fragment, {
|
|
9784
10756
|
children: [jsx(Spacer, {
|
|
9785
|
-
multiplier:
|
|
10757
|
+
multiplier: 2
|
|
9786
10758
|
}), jsx(GridChild, Object.assign({
|
|
9787
|
-
colSpan: 8
|
|
9788
|
-
css: theme => ({
|
|
9789
|
-
paddingLeft: theme.spacing(1)
|
|
9790
|
-
})
|
|
10759
|
+
colSpan: 8
|
|
9791
10760
|
}, {
|
|
9792
10761
|
children: jsx(InlineNotification, Object.assign({
|
|
10762
|
+
title: t("address.preference.addressNotValidated"),
|
|
9793
10763
|
type: NotificationType.ALERT
|
|
9794
10764
|
}, {
|
|
9795
10765
|
children: t("address.preference.unableToValidate")
|
|
9796
10766
|
}))
|
|
9797
10767
|
})), jsx(Spacer, {
|
|
9798
|
-
multiplier:
|
|
9799
|
-
}), jsx(GridChild,
|
|
9800
|
-
css: theme => ({
|
|
9801
|
-
paddingLeft: theme.spacing(1)
|
|
9802
|
-
})
|
|
9803
|
-
}, {
|
|
10768
|
+
multiplier: 2
|
|
10769
|
+
}), jsx(GridChild, {
|
|
9804
10770
|
children: jsx(AddressDisplay, {
|
|
9805
10771
|
address: (_b = warehousePreference.validation) === null || _b === void 0 ? void 0 : _b.originalAddress
|
|
9806
10772
|
})
|
|
9807
|
-
})
|
|
10773
|
+
})]
|
|
9808
10774
|
});
|
|
9809
10775
|
default:
|
|
9810
10776
|
// This code path should never be reached.
|
|
@@ -9827,7 +10793,7 @@ const AddressPreferenceSelect = ({
|
|
|
9827
10793
|
children: t("common:address.preference.title")
|
|
9828
10794
|
}))
|
|
9829
10795
|
})), jsxs(GridChild, Object.assign({
|
|
9830
|
-
colSpan:
|
|
10796
|
+
colSpan: 12
|
|
9831
10797
|
}, {
|
|
9832
10798
|
children: [jsx(Typography, Object.assign({
|
|
9833
10799
|
css: {
|
|
@@ -9843,7 +10809,7 @@ const AddressPreferenceSelect = ({
|
|
|
9843
10809
|
warehousePreference: originAddress
|
|
9844
10810
|
})]
|
|
9845
10811
|
})), returnAddress && jsxs(GridChild, Object.assign({
|
|
9846
|
-
colSpan:
|
|
10812
|
+
colSpan: 12
|
|
9847
10813
|
}, {
|
|
9848
10814
|
children: [jsx(Typography, Object.assign({
|
|
9849
10815
|
css: {
|
|
@@ -9891,6 +10857,7 @@ const AddressPreferenceProvider = props => {
|
|
|
9891
10857
|
onSubmit
|
|
9892
10858
|
} = props;
|
|
9893
10859
|
const [passengerData, setPassengerData] = useState();
|
|
10860
|
+
const [userInput, setUserInput] = useState();
|
|
9894
10861
|
const {
|
|
9895
10862
|
validate: validateAddress,
|
|
9896
10863
|
validationPreference,
|
|
@@ -9902,6 +10869,7 @@ const AddressPreferenceProvider = props => {
|
|
|
9902
10869
|
onValid,
|
|
9903
10870
|
data
|
|
9904
10871
|
} = payload;
|
|
10872
|
+
setUserInput(addresses);
|
|
9905
10873
|
const validationPreference = yield validateAddress(addresses);
|
|
9906
10874
|
const {
|
|
9907
10875
|
originAddress,
|
|
@@ -9935,6 +10903,7 @@ const AddressPreferenceProvider = props => {
|
|
|
9935
10903
|
return jsx(AddressPreferenceContext.Provider, Object.assign({
|
|
9936
10904
|
value: {
|
|
9937
10905
|
data: passengerData,
|
|
10906
|
+
userInput,
|
|
9938
10907
|
validateAddress: internalValidateAddress,
|
|
9939
10908
|
validationPreference
|
|
9940
10909
|
}
|
|
@@ -10188,7 +11157,7 @@ const WalletForm = ({
|
|
|
10188
11157
|
resolver: validationResolver(walletSchema)
|
|
10189
11158
|
});
|
|
10190
11159
|
useBlackboxDetection({
|
|
10191
|
-
onError: () => {
|
|
11160
|
+
onError: useCallback(() => {
|
|
10192
11161
|
setCodedErrors(errors => {
|
|
10193
11162
|
const blackBoxError = {
|
|
10194
11163
|
errorCode: "unspecified",
|
|
@@ -10198,11 +11167,8 @@ const WalletForm = ({
|
|
|
10198
11167
|
};
|
|
10199
11168
|
return [...(errors !== null && errors !== void 0 ? errors : []), blackBoxError];
|
|
10200
11169
|
});
|
|
10201
|
-
},
|
|
10202
|
-
onSuccess: bb =>
|
|
10203
|
-
console.log("bb", bb);
|
|
10204
|
-
form.setValue("iovationBlackbox", bb);
|
|
10205
|
-
}
|
|
11170
|
+
}, [setCodedErrors]),
|
|
11171
|
+
onSuccess: useCallback(bb => form.setValue("iovationBlackbox", bb), [form.setValue])
|
|
10206
11172
|
});
|
|
10207
11173
|
const watchAddress = form.watch("address");
|
|
10208
11174
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -10598,6 +11564,25 @@ const WalletCard = ({
|
|
|
10598
11564
|
}));
|
|
10599
11565
|
};
|
|
10600
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
|
+
*/
|
|
10601
11586
|
const PaymentMethodSettings = () => {
|
|
10602
11587
|
var _a;
|
|
10603
11588
|
const {
|
|
@@ -10680,6 +11665,14 @@ const styles$f = createStyles({
|
|
|
10680
11665
|
}
|
|
10681
11666
|
});
|
|
10682
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
|
+
*/
|
|
10683
11676
|
const PoweredByShipEngine = () => {
|
|
10684
11677
|
const {
|
|
10685
11678
|
t
|
|
@@ -10695,6 +11688,11 @@ const PoweredByShipEngine = () => {
|
|
|
10695
11688
|
}));
|
|
10696
11689
|
};
|
|
10697
11690
|
|
|
11691
|
+
/**
|
|
11692
|
+
* @namespace UnitSettings
|
|
11693
|
+
*
|
|
11694
|
+
* # Unit Settings Component
|
|
11695
|
+
*/
|
|
10698
11696
|
const UnitSettings = () => {
|
|
10699
11697
|
const {
|
|
10700
11698
|
t
|
|
@@ -10892,7 +11890,8 @@ const styles$e = createStyles({
|
|
|
10892
11890
|
display: "flex",
|
|
10893
11891
|
flexDirection: "column",
|
|
10894
11892
|
paddingBottom: theme.spacing(8),
|
|
10895
|
-
paddingTop: theme.spacing(2)
|
|
11893
|
+
paddingTop: theme.spacing(2),
|
|
11894
|
+
textAlign: "center"
|
|
10896
11895
|
}),
|
|
10897
11896
|
termsLink: theme => ({
|
|
10898
11897
|
alignItems: "center",
|
|
@@ -11650,7 +12649,9 @@ const CustomsItemForm = ({
|
|
|
11650
12649
|
const {
|
|
11651
12650
|
t
|
|
11652
12651
|
} = useTranslation();
|
|
11653
|
-
const
|
|
12652
|
+
const {
|
|
12653
|
+
countryCodeOptions
|
|
12654
|
+
} = useCountryCodeOptions();
|
|
11654
12655
|
const form = useForm({
|
|
11655
12656
|
defaultValues: customsItem ? {
|
|
11656
12657
|
countryOfOrigin: customsItem.countryOfOrigin,
|
|
@@ -11756,6 +12757,10 @@ const CustomsItemForm = ({
|
|
|
11756
12757
|
};
|
|
11757
12758
|
|
|
11758
12759
|
/**
|
|
12760
|
+
* @internal
|
|
12761
|
+
*
|
|
12762
|
+
* # Copy Button
|
|
12763
|
+
*
|
|
11759
12764
|
* A copy button that copies the content to the users' clipboard and displays a
|
|
11760
12765
|
* checkmark on click.
|
|
11761
12766
|
*/
|
|
@@ -11954,7 +12959,8 @@ const styles$a = createStyles({
|
|
|
11954
12959
|
});
|
|
11955
12960
|
|
|
11956
12961
|
const LandingPage = ({
|
|
11957
|
-
onSubmit
|
|
12962
|
+
onSubmit,
|
|
12963
|
+
partnerName
|
|
11958
12964
|
}) => {
|
|
11959
12965
|
const {
|
|
11960
12966
|
t
|
|
@@ -11996,7 +13002,9 @@ const LandingPage = ({
|
|
|
11996
13002
|
css: styles$a.description,
|
|
11997
13003
|
variant: "body1"
|
|
11998
13004
|
}, {
|
|
11999
|
-
children: t("onboarding:landing.
|
|
13005
|
+
children: partnerName ? t("onboarding:landing.partnerMessageLine1", {
|
|
13006
|
+
partnerName: partnerName
|
|
13007
|
+
}) : t("onboarding:landing.messageLine1")
|
|
12000
13008
|
})), jsx(Spacer, {
|
|
12001
13009
|
multiplier: 2
|
|
12002
13010
|
}), jsx(Typography, Object.assign({
|
|
@@ -12325,12 +13333,15 @@ const WarehouseForm = ({
|
|
|
12325
13333
|
submitButtonTitle,
|
|
12326
13334
|
warehouse
|
|
12327
13335
|
}) => {
|
|
13336
|
+
var _a, _b;
|
|
12328
13337
|
const {
|
|
12329
13338
|
t
|
|
12330
13339
|
} = useTranslation(["common", "manage-warehouses"]);
|
|
12331
13340
|
const {
|
|
12332
|
-
validateAddress
|
|
13341
|
+
validateAddress,
|
|
13342
|
+
userInput
|
|
12333
13343
|
} = useAddressPreference();
|
|
13344
|
+
const hasDefaultValues = !!warehouse || !!userInput;
|
|
12334
13345
|
const form = useForm({
|
|
12335
13346
|
defaultValues: warehouse ? Object.assign(Object.assign({}, warehouse), {
|
|
12336
13347
|
isDefault: warehouse.isDefault,
|
|
@@ -12341,6 +13352,14 @@ const WarehouseForm = ({
|
|
|
12341
13352
|
countryCode: warehouse.returnAddress.countryCode
|
|
12342
13353
|
}),
|
|
12343
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
|
|
12344
13363
|
}) : {
|
|
12345
13364
|
isDefault: _isOnboarding ? true : false,
|
|
12346
13365
|
originAddress: {
|
|
@@ -12351,8 +13370,8 @@ const WarehouseForm = ({
|
|
|
12351
13370
|
resolver: validationResolver(warehouseSchema)
|
|
12352
13371
|
});
|
|
12353
13372
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
12354
|
-
const
|
|
12355
|
-
payload = __rest(
|
|
13373
|
+
const _c = values,
|
|
13374
|
+
payload = __rest(_c, ["returnToAddressIsDifferent"]);
|
|
12356
13375
|
yield validateAddress({
|
|
12357
13376
|
addresses: payload,
|
|
12358
13377
|
data: {
|
|
@@ -12381,12 +13400,6 @@ const WarehouseForm = ({
|
|
|
12381
13400
|
form: form,
|
|
12382
13401
|
formatFieldName: fieldName => `originAddress.${fieldName}`,
|
|
12383
13402
|
optionalFields: ["addressLine2"]
|
|
12384
|
-
}), jsx(CheckboxInput, {
|
|
12385
|
-
checkboxLabel: t("manage-warehouses:residentialAddress"),
|
|
12386
|
-
control: form.control,
|
|
12387
|
-
form: "warehouse-form",
|
|
12388
|
-
label: "originAddress.addressResidentialIndicator",
|
|
12389
|
-
name: "originAddress.addressResidentialIndicator"
|
|
12390
13403
|
}), !_isOnboarding && jsx(CheckboxInput, {
|
|
12391
13404
|
checkboxLabel: t("manage-warehouses:isDefault"),
|
|
12392
13405
|
control: form.control,
|
|
@@ -12414,18 +13427,12 @@ const WarehouseForm = ({
|
|
|
12414
13427
|
});
|
|
12415
13428
|
}
|
|
12416
13429
|
}
|
|
12417
|
-
}), form.watch("returnToAddressIsDifferent") &&
|
|
12418
|
-
children:
|
|
13430
|
+
}), form.watch("returnToAddressIsDifferent") && jsx(Fragment, {
|
|
13431
|
+
children: jsx(AddressFields, {
|
|
12419
13432
|
form: form,
|
|
12420
13433
|
formatFieldName: fieldName => `returnAddress.${fieldName}`,
|
|
12421
13434
|
optionalFields: ["addressLine2"]
|
|
12422
|
-
})
|
|
12423
|
-
checkboxLabel: t("manage-warehouses:residentialAddress"),
|
|
12424
|
-
control: form.control,
|
|
12425
|
-
form: "warehouse-form",
|
|
12426
|
-
label: "returnAddress.addressResidentialIndicator",
|
|
12427
|
-
name: "returnAddress.addressResidentialIndicator"
|
|
12428
|
-
})]
|
|
13435
|
+
})
|
|
12429
13436
|
}), jsxs(ButtonGroup, Object.assign({
|
|
12430
13437
|
justify: "center"
|
|
12431
13438
|
}, {
|
|
@@ -12450,7 +13457,7 @@ const WarehouseForm = ({
|
|
|
12450
13457
|
control: form.control,
|
|
12451
13458
|
"data-testid": "warehouseFormSubmitButton",
|
|
12452
13459
|
form: "warehouse-form",
|
|
12453
|
-
requireDirty:
|
|
13460
|
+
requireDirty: !hasDefaultValues,
|
|
12454
13461
|
variant: _isOnboarding ? ButtonVariant.FILLED : ButtonVariant.OUTLINED
|
|
12455
13462
|
}, {
|
|
12456
13463
|
children: submitButtonTitle
|
|
@@ -12667,11 +13674,21 @@ const styles$6 = createStyles({
|
|
|
12667
13674
|
container: theme => ({
|
|
12668
13675
|
padding: theme.spacing(2)
|
|
12669
13676
|
}),
|
|
13677
|
+
iconTooltip: theme => ({
|
|
13678
|
+
color: theme.palette.secondary.main,
|
|
13679
|
+
display: "inline-block",
|
|
13680
|
+
marginLeft: theme.spacing(1),
|
|
13681
|
+
verticalAlign: "middle"
|
|
13682
|
+
}),
|
|
12670
13683
|
step: {
|
|
12671
13684
|
"& > span:last-child": {
|
|
12672
13685
|
position: "static"
|
|
12673
13686
|
}
|
|
12674
13687
|
},
|
|
13688
|
+
tooltipContainer: () => ({
|
|
13689
|
+
maxWidth: "260px",
|
|
13690
|
+
textAlign: "left"
|
|
13691
|
+
}),
|
|
12675
13692
|
walletFormHeader: theme => ({
|
|
12676
13693
|
margin: theme.spacing(4)
|
|
12677
13694
|
}),
|
|
@@ -12687,18 +13704,20 @@ const styles$6 = createStyles({
|
|
|
12687
13704
|
|
|
12688
13705
|
const Onboarding = ({
|
|
12689
13706
|
connectedCarriers,
|
|
13707
|
+
createFundingSource,
|
|
13708
|
+
createFundingSourceErrors,
|
|
12690
13709
|
createWarehouse,
|
|
12691
13710
|
features,
|
|
12692
13711
|
fundingSources,
|
|
12693
13712
|
isRegisteringCarriers,
|
|
13713
|
+
onboardingAddress,
|
|
12694
13714
|
onCarrierCreated,
|
|
12695
13715
|
onCompleteOnboarding,
|
|
12696
13716
|
onFundingSourceCreated,
|
|
12697
13717
|
onWarehouseCreated,
|
|
13718
|
+
partnerName,
|
|
12698
13719
|
registerCarrier,
|
|
12699
13720
|
registerCarrierErrors,
|
|
12700
|
-
createFundingSource,
|
|
12701
|
-
createFundingSourceErrors,
|
|
12702
13721
|
warehouses
|
|
12703
13722
|
}) => {
|
|
12704
13723
|
var _a, _b, _c;
|
|
@@ -12732,6 +13751,7 @@ const Onboarding = ({
|
|
|
12732
13751
|
const hasDhl = connectedCarriers === null || connectedCarriers === void 0 ? void 0 : connectedCarriers.some(c => c.carrierCode === "dhl_express_worldwide");
|
|
12733
13752
|
const fundingSourceId = (fundingSources === null || fundingSources === void 0 ? void 0 : fundingSources.length) ? fundingSources[0].fundingSourceId : undefined;
|
|
12734
13753
|
const hasCompletedOnboarding = onboardingComplete || warehouses.length && hasStampsWallet && (hasUps || !upsEnabled) && hasDhl;
|
|
13754
|
+
const containerRef = useRef(null);
|
|
12735
13755
|
const currentStep = useMemo(() => {
|
|
12736
13756
|
if (hasCompletedOnboarding) {
|
|
12737
13757
|
return 5;
|
|
@@ -12844,7 +13864,8 @@ const Onboarding = ({
|
|
|
12844
13864
|
}
|
|
12845
13865
|
// Step 1: Landing Page
|
|
12846
13866
|
if (!email) return jsx(LandingPage, {
|
|
12847
|
-
onSubmit: e => setEmail(e)
|
|
13867
|
+
onSubmit: e => setEmail(e),
|
|
13868
|
+
partnerName: partnerName
|
|
12848
13869
|
});
|
|
12849
13870
|
// Step 2: Agree to Terms and Conditions
|
|
12850
13871
|
if (!agreedToTerms) {
|
|
@@ -12893,7 +13914,8 @@ const Onboarding = ({
|
|
|
12893
13914
|
onSubmit: payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
12894
13915
|
return handleCreateWarehouse(payload);
|
|
12895
13916
|
}),
|
|
12896
|
-
submitButtonTitle: t("actions.continue")
|
|
13917
|
+
submitButtonTitle: t("actions.continue"),
|
|
13918
|
+
warehouse: onboardingAddress
|
|
12897
13919
|
})
|
|
12898
13920
|
}));
|
|
12899
13921
|
}
|
|
@@ -12916,21 +13938,39 @@ const Onboarding = ({
|
|
|
12916
13938
|
variant: "subtitle1"
|
|
12917
13939
|
}, {
|
|
12918
13940
|
children: t("register-wallet:sections.billing.cardSubTitle")
|
|
13941
|
+
})), jsx(IconTooltip, Object.assign({
|
|
13942
|
+
container: containerRef.current,
|
|
13943
|
+
css: styles$6.iconTooltip,
|
|
13944
|
+
icon: IconNames.INFO_FILLED,
|
|
13945
|
+
placement: "auto",
|
|
13946
|
+
size: IconSize.SIZE_MEDIUM
|
|
13947
|
+
}, {
|
|
13948
|
+
children: jsxs("div", Object.assign({
|
|
13949
|
+
css: styles$6.tooltipContainer
|
|
13950
|
+
}, {
|
|
13951
|
+
children: [jsx(Typography, Object.assign({
|
|
13952
|
+
bold: true,
|
|
13953
|
+
variant: "small"
|
|
13954
|
+
}, {
|
|
13955
|
+
children: t("register-wallet:sections.notifications.info.title")
|
|
13956
|
+
})), jsx(Spacer, {
|
|
13957
|
+
multiplier: 1
|
|
13958
|
+
}), jsx(Typography, Object.assign({
|
|
13959
|
+
variant: "small"
|
|
13960
|
+
}, {
|
|
13961
|
+
children: t("register-wallet:sections.notifications.info.description")
|
|
13962
|
+
}))]
|
|
13963
|
+
}))
|
|
12919
13964
|
}))]
|
|
12920
13965
|
})), jsx(Spacer, {
|
|
12921
13966
|
multiplier: 1
|
|
12922
|
-
}), (createFundingSourceErrors === null || createFundingSourceErrors === void 0 ? void 0 : createFundingSourceErrors.length)
|
|
13967
|
+
}), !!(createFundingSourceErrors === null || createFundingSourceErrors === void 0 ? void 0 : createFundingSourceErrors.length) && jsx(InlineNotification, Object.assign({
|
|
12923
13968
|
title: t("register-wallet:sections.notifications.error.title"),
|
|
12924
13969
|
type: NotificationType.ERROR
|
|
12925
13970
|
}, {
|
|
12926
13971
|
children: createFundingSourceErrors.map(({
|
|
12927
13972
|
message
|
|
12928
13973
|
}) => message).join(" ")
|
|
12929
|
-
})) : jsx(InlineNotification, Object.assign({
|
|
12930
|
-
title: t("register-wallet:sections.notifications.info.title"),
|
|
12931
|
-
type: NotificationType.INFO
|
|
12932
|
-
}, {
|
|
12933
|
-
children: t("register-wallet:sections.notifications.info.description")
|
|
12934
13974
|
}))]
|
|
12935
13975
|
})),
|
|
12936
13976
|
onSubmit: payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -12988,14 +14028,15 @@ const Onboarding = ({
|
|
|
12988
14028
|
});
|
|
12989
14029
|
};
|
|
12990
14030
|
return jsxs("div", Object.assign({
|
|
12991
|
-
css: styles$6.container
|
|
14031
|
+
css: styles$6.container,
|
|
14032
|
+
ref: containerRef
|
|
12992
14033
|
}, {
|
|
12993
14034
|
children: [jsxs(Stepper, Object.assign({
|
|
12994
14035
|
currentStep: currentStep
|
|
12995
14036
|
}, {
|
|
12996
14037
|
children: [jsx(Step, {
|
|
12997
14038
|
css: styles$6.step,
|
|
12998
|
-
label: t("onboarding:steps.
|
|
14039
|
+
label: t("onboarding:steps.register")
|
|
12999
14040
|
}), jsx(Step, {
|
|
13000
14041
|
css: styles$6.step,
|
|
13001
14042
|
label: t("onboarding:steps.carriers")
|
|
@@ -13004,7 +14045,7 @@ const Onboarding = ({
|
|
|
13004
14045
|
label: t("onboarding:steps.addresses")
|
|
13005
14046
|
}), jsx(Step, {
|
|
13006
14047
|
css: styles$6.step,
|
|
13007
|
-
label: t("onboarding:steps.
|
|
14048
|
+
label: t("onboarding:steps.billing")
|
|
13008
14049
|
})]
|
|
13009
14050
|
})), renderStep(), ((_c = features === null || features === void 0 ? void 0 : features.presentation) === null || _c === void 0 ? void 0 : _c.poweredByShipEngine) && jsxs(Fragment, {
|
|
13010
14051
|
children: [jsx(Spacer, {}), jsx(PoweredByShipEngine, {})]
|
|
@@ -13015,6 +14056,15 @@ const Onboarding = ({
|
|
|
13015
14056
|
let _ = t => t,
|
|
13016
14057
|
_t,
|
|
13017
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
|
+
*/
|
|
13018
14068
|
const Cube = _a => {
|
|
13019
14069
|
var {
|
|
13020
14070
|
animate = false
|
|
@@ -13042,7 +14092,7 @@ const Cube = _a => {
|
|
|
13042
14092
|
const styles = {
|
|
13043
14093
|
bounce: /*#__PURE__*/css(Object.assign({}, animate && {
|
|
13044
14094
|
animation: `${bounce} 1s infinite`
|
|
13045
|
-
}), 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== */"),
|
|
13046
14096
|
content: /*#__PURE__*/css(Object.assign({
|
|
13047
14097
|
clipRule: "evenodd",
|
|
13048
14098
|
fillRule: "evenodd",
|
|
@@ -13052,7 +14102,7 @@ const Cube = _a => {
|
|
|
13052
14102
|
width: "5rem"
|
|
13053
14103
|
}, animate && {
|
|
13054
14104
|
animation: `${spin} 1s linear infinite;`
|
|
13055
|
-
}), 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== */")
|
|
13056
14106
|
};
|
|
13057
14107
|
return jsx("div", Object.assign({
|
|
13058
14108
|
css: styles.bounce
|
|
@@ -13078,29 +14128,6 @@ const Cube = _a => {
|
|
|
13078
14128
|
};
|
|
13079
14129
|
|
|
13080
14130
|
const styles$5 = createStyles({
|
|
13081
|
-
balanceText: theme => ({
|
|
13082
|
-
color: theme.palette.secondary.dark
|
|
13083
|
-
}),
|
|
13084
|
-
container: theme => ({
|
|
13085
|
-
padding: `${theme.spacing(3)}px ${theme.spacing(4)}px`
|
|
13086
|
-
}),
|
|
13087
|
-
getFormExtension: isCustomAmount => theme => ({
|
|
13088
|
-
backgroundColor: theme.palette.gray.ultraLight,
|
|
13089
|
-
display: "flex",
|
|
13090
|
-
flexDirection: "column",
|
|
13091
|
-
gap: theme.spacing(1),
|
|
13092
|
-
// Negative margin is to compensate for the padding on AddFundsForm, since we want this
|
|
13093
|
-
// section to seemlessly extend the form's well.
|
|
13094
|
-
marginTop: theme.spacing(isCustomAmount ? -1.5 : -1),
|
|
13095
|
-
padding: theme.spacing(2),
|
|
13096
|
-
paddingTop: 0
|
|
13097
|
-
}),
|
|
13098
|
-
saveRateButton: {
|
|
13099
|
-
whiteSpace: "nowrap"
|
|
13100
|
-
}
|
|
13101
|
-
});
|
|
13102
|
-
|
|
13103
|
-
const styles$4 = createStyles({
|
|
13104
14131
|
icon: theme => ({
|
|
13105
14132
|
color: theme.palette.primary.main,
|
|
13106
14133
|
marginRight: theme.spacing(2)
|
|
@@ -13135,6 +14162,11 @@ const styles$4 = createStyles({
|
|
|
13135
14162
|
})
|
|
13136
14163
|
});
|
|
13137
14164
|
|
|
14165
|
+
/**
|
|
14166
|
+
* @internal
|
|
14167
|
+
*
|
|
14168
|
+
* # Section Component
|
|
14169
|
+
*/
|
|
13138
14170
|
const Section = _a => {
|
|
13139
14171
|
var {
|
|
13140
14172
|
bold,
|
|
@@ -13145,10 +14177,10 @@ const Section = _a => {
|
|
|
13145
14177
|
rest = __rest(_a, ["bold", "title", "children", "rightContent"]);
|
|
13146
14178
|
return jsxs(Fragment, {
|
|
13147
14179
|
children: [title && jsx("summary", Object.assign({
|
|
13148
|
-
css: styles$
|
|
14180
|
+
css: styles$5.summary
|
|
13149
14181
|
}, {
|
|
13150
14182
|
children: jsxs("div", Object.assign({
|
|
13151
|
-
css: styles$
|
|
14183
|
+
css: styles$5.summaryWrapper
|
|
13152
14184
|
}, {
|
|
13153
14185
|
children: [jsx(Typography, Object.assign({
|
|
13154
14186
|
bold: bold,
|
|
@@ -13156,23 +14188,52 @@ const Section = _a => {
|
|
|
13156
14188
|
}, {
|
|
13157
14189
|
children: title
|
|
13158
14190
|
})), rightContent && jsx("div", Object.assign({
|
|
13159
|
-
css: styles$
|
|
14191
|
+
css: styles$5.rightContentWrapper
|
|
13160
14192
|
}, {
|
|
13161
14193
|
children: rightContent
|
|
13162
14194
|
}))]
|
|
13163
14195
|
}))
|
|
13164
14196
|
})), jsx("section", Object.assign({
|
|
13165
|
-
css: styles$
|
|
14197
|
+
css: styles$5.section
|
|
13166
14198
|
}, rest, {
|
|
13167
14199
|
children: children
|
|
13168
14200
|
}))]
|
|
13169
14201
|
});
|
|
13170
14202
|
};
|
|
13171
14203
|
|
|
14204
|
+
const styles$4 = createStyles({
|
|
14205
|
+
balanceText: theme => ({
|
|
14206
|
+
color: theme.palette.secondary.dark
|
|
14207
|
+
}),
|
|
14208
|
+
container: theme => ({
|
|
14209
|
+
padding: `${theme.spacing(3)}px ${theme.spacing(4)}px`
|
|
14210
|
+
}),
|
|
14211
|
+
getFormExtension: isCustomAmount => theme => ({
|
|
14212
|
+
backgroundColor: theme.palette.gray.ultraLight,
|
|
14213
|
+
display: "flex",
|
|
14214
|
+
flexDirection: "column",
|
|
14215
|
+
gap: theme.spacing(1),
|
|
14216
|
+
// Negative margin is to compensate for the padding on AddFundsForm, since we want this
|
|
14217
|
+
// section to seemlessly extend the form's well.
|
|
14218
|
+
marginTop: theme.spacing(isCustomAmount ? -1.5 : -1),
|
|
14219
|
+
padding: theme.spacing(2),
|
|
14220
|
+
paddingTop: 0
|
|
14221
|
+
}),
|
|
14222
|
+
saveRateButton: {
|
|
14223
|
+
whiteSpace: "nowrap"
|
|
14224
|
+
}
|
|
14225
|
+
});
|
|
14226
|
+
|
|
13172
14227
|
/**
|
|
14228
|
+
* @internal
|
|
14229
|
+
*
|
|
14230
|
+
* # Fund And Purchase Component
|
|
14231
|
+
*
|
|
13173
14232
|
* Fund and Purchase handles the label purchase submission UX, ensuring that a user
|
|
13174
14233
|
* has the necessary funds available and can add them if not. It allows a single button
|
|
13175
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}
|
|
13176
14237
|
*/
|
|
13177
14238
|
const FundAndPurchase = ({
|
|
13178
14239
|
balance: uspsBalance,
|
|
@@ -13234,7 +14295,7 @@ const FundAndPurchase = ({
|
|
|
13234
14295
|
}, {
|
|
13235
14296
|
children: [jsx(Button, Object.assign({
|
|
13236
14297
|
bold: false,
|
|
13237
|
-
css: styles$
|
|
14298
|
+
css: styles$4.saveRateButton,
|
|
13238
14299
|
disabled: disabled || !carrierId || addFundsForm.isSubmitting || isRateFormSubmitting,
|
|
13239
14300
|
isLoading: isSavingRate,
|
|
13240
14301
|
onClick: handleSaveRate,
|
|
@@ -13254,7 +14315,7 @@ const FundAndPurchase = ({
|
|
|
13254
14315
|
// render when no rate has been selected yet
|
|
13255
14316
|
if (!carrierId) return jsxs("div", Object.assign({
|
|
13256
14317
|
className: className,
|
|
13257
|
-
css: styles$
|
|
14318
|
+
css: styles$4.container
|
|
13258
14319
|
}, {
|
|
13259
14320
|
children: [jsxs(Spread, {
|
|
13260
14321
|
children: [jsx(CarrierBalance, {
|
|
@@ -13278,7 +14339,7 @@ const FundAndPurchase = ({
|
|
|
13278
14339
|
// show balance, but not the funding form.
|
|
13279
14340
|
if (!isFundingEnabled) return jsxs("div", Object.assign({
|
|
13280
14341
|
className: className,
|
|
13281
|
-
css: styles$
|
|
14342
|
+
css: styles$4.container
|
|
13282
14343
|
}, {
|
|
13283
14344
|
children: [jsx(CarrierBalance, {
|
|
13284
14345
|
carrierId: carrierId
|
|
@@ -13320,13 +14381,13 @@ const FundAndPurchase = ({
|
|
|
13320
14381
|
var _a, _b;
|
|
13321
14382
|
return jsxs(Fragment, {
|
|
13322
14383
|
children: [jsxs("section", Object.assign({
|
|
13323
|
-
css: styles$
|
|
14384
|
+
css: styles$4.getFormExtension(addFundsForm.isCustomAmount)
|
|
13324
14385
|
}, {
|
|
13325
14386
|
children: [jsx(InlineLabel, Object.assign({
|
|
13326
14387
|
label: t("manage-funding:fundAndPurchase.newBalance")
|
|
13327
14388
|
}, {
|
|
13328
14389
|
children: jsx(Typography, Object.assign({
|
|
13329
|
-
css: styles$
|
|
14390
|
+
css: styles$4.balanceText
|
|
13330
14391
|
}, {
|
|
13331
14392
|
children: formatMoney({
|
|
13332
14393
|
amount: balance + ((_a = addFundsForm.selectedAmount) !== null && _a !== void 0 ? _a : 0),
|
|
@@ -13337,7 +14398,7 @@ const FundAndPurchase = ({
|
|
|
13337
14398
|
label: t("manage-funding:fundAndPurchase.finalBalance")
|
|
13338
14399
|
}, {
|
|
13339
14400
|
children: jsx(Typography, Object.assign({
|
|
13340
|
-
css: styles$
|
|
14401
|
+
css: styles$4.balanceText
|
|
13341
14402
|
}, {
|
|
13342
14403
|
children: formatMoney({
|
|
13343
14404
|
amount: balance + ((_b = addFundsForm.selectedAmount) !== null && _b !== void 0 ? _b : 0) - purchaseAmount,
|
|
@@ -13357,6 +14418,15 @@ const FundAndPurchase = ({
|
|
|
13357
14418
|
}))]
|
|
13358
14419
|
})), jsx(Spacer, {
|
|
13359
14420
|
multiplier: 2
|
|
14421
|
+
}), addFundsForm.error && jsxs(Fragment, {
|
|
14422
|
+
children: [jsx(InlineNotification, Object.assign({
|
|
14423
|
+
title: t("manage-funding:addFunds.error.title"),
|
|
14424
|
+
type: NotificationType.ERROR
|
|
14425
|
+
}, {
|
|
14426
|
+
children: addFundsForm.error[0].message
|
|
14427
|
+
})), jsx(Spacer, {
|
|
14428
|
+
multiplier: 2
|
|
14429
|
+
})]
|
|
13360
14430
|
}), renderActionButtons(addFundsForm)]
|
|
13361
14431
|
});
|
|
13362
14432
|
}
|
|
@@ -13392,7 +14462,7 @@ const RateForm = ({
|
|
|
13392
14462
|
carriers,
|
|
13393
14463
|
disabled,
|
|
13394
14464
|
errors,
|
|
13395
|
-
|
|
14465
|
+
displayableRateErrors,
|
|
13396
14466
|
displayableLabelErrors,
|
|
13397
14467
|
features,
|
|
13398
14468
|
labelErrors,
|
|
@@ -13406,7 +14476,7 @@ const RateForm = ({
|
|
|
13406
14476
|
shipment,
|
|
13407
14477
|
outOfBandDisplayableErrors
|
|
13408
14478
|
}) => {
|
|
13409
|
-
var _a, _b, _c, _d, _e;
|
|
14479
|
+
var _a, _b, _c, _d, _e, _f;
|
|
13410
14480
|
features = Object.assign({
|
|
13411
14481
|
presentation: {
|
|
13412
14482
|
poweredByShipEngine: false
|
|
@@ -13418,7 +14488,7 @@ const RateForm = ({
|
|
|
13418
14488
|
saveRate: true
|
|
13419
14489
|
}
|
|
13420
14490
|
}, features !== null && features !== void 0 ? features : {});
|
|
13421
|
-
const allDisplayableErrors = [...(
|
|
14491
|
+
const allDisplayableErrors = [...(displayableRateErrors !== null && displayableRateErrors !== void 0 ? displayableRateErrors : []), ...(outOfBandDisplayableErrors !== null && outOfBandDisplayableErrors !== void 0 ? outOfBandDisplayableErrors : [])];
|
|
13422
14492
|
const {
|
|
13423
14493
|
t
|
|
13424
14494
|
} = useTranslation();
|
|
@@ -13453,7 +14523,7 @@ const RateForm = ({
|
|
|
13453
14523
|
});
|
|
13454
14524
|
}
|
|
13455
14525
|
})));
|
|
13456
|
-
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));
|
|
13457
14527
|
// Return true if User has multiple accounts for a single carrier.
|
|
13458
14528
|
const hasDuplicateCarrierCode = carriers => {
|
|
13459
14529
|
const uniqueCarrierCodes = new Set();
|
|
@@ -13529,7 +14599,7 @@ const RateForm = ({
|
|
|
13529
14599
|
name: "rate",
|
|
13530
14600
|
nicknameFeature:
|
|
13531
14601
|
// if feature flag is on, and if account has duplicate carrierCodes, then show nickname
|
|
13532
|
-
((
|
|
14602
|
+
((_c = features === null || features === void 0 ? void 0 : features.rateForm) === null || _c === void 0 ? void 0 : _c.nicknameRate) && carriers && hasDuplicateCarrierCode(carriers),
|
|
13533
14603
|
onClick: onSelectRate,
|
|
13534
14604
|
options: showHiddenRates ? rateOptions : filteredRateOptions
|
|
13535
14605
|
}), rateOptions.some(option => option.requiresAcknowledgement) && rateOptions.length > 5 && jsx(Link, Object.assign({
|
|
@@ -13567,10 +14637,10 @@ const RateForm = ({
|
|
|
13567
14637
|
type: NotificationType.ERROR
|
|
13568
14638
|
}, {
|
|
13569
14639
|
children: jsxs(Fragment, {
|
|
13570
|
-
children: [
|
|
14640
|
+
children: [displayableRateErrors, outOfBandDisplayableErrors, displayableLabelErrors]
|
|
13571
14641
|
})
|
|
13572
14642
|
}))]
|
|
13573
|
-
})), ((
|
|
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({
|
|
13574
14644
|
title: t("manage-defaults:label.title")
|
|
13575
14645
|
}, {
|
|
13576
14646
|
children: jsx(LabelLayout, {
|
|
@@ -13582,12 +14652,12 @@ const RateForm = ({
|
|
|
13582
14652
|
control: form.control,
|
|
13583
14653
|
css: styles$3.fundAndPurchase,
|
|
13584
14654
|
disabled: disabled,
|
|
13585
|
-
isFundingEnabled: !!((
|
|
14655
|
+
isFundingEnabled: !!((_e = features === null || features === void 0 ? void 0 : features.rateForm) === null || _e === void 0 ? void 0 : _e.enableFunding),
|
|
13586
14656
|
isFundingRequired: (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.balance) !== undefined && !!selectedRate.requiresFundedAmount,
|
|
13587
14657
|
onPurchase: handleSubmit,
|
|
13588
14658
|
onSave: handleSaveRate,
|
|
13589
14659
|
purchaseAmount: getTotalRateAmount(selectedRate)
|
|
13590
|
-
}), ((
|
|
14660
|
+
}), ((_f = features === null || features === void 0 ? void 0 : features.presentation) === null || _f === void 0 ? void 0 : _f.poweredByShipEngine) && jsxs(Fragment, {
|
|
13591
14661
|
children: [jsx(Spacer, {}), jsx(PoweredByShipEngine, {})]
|
|
13592
14662
|
})]
|
|
13593
14663
|
}));
|
|
@@ -13659,6 +14729,11 @@ const ItemsBreakdownTableHeader = ({
|
|
|
13659
14729
|
}))]
|
|
13660
14730
|
})
|
|
13661
14731
|
});
|
|
14732
|
+
/**
|
|
14733
|
+
* @internal
|
|
14734
|
+
*
|
|
14735
|
+
* # Items Breakdown Component
|
|
14736
|
+
*/
|
|
13662
14737
|
const ItemsBreakdown = ({
|
|
13663
14738
|
items
|
|
13664
14739
|
}) => {
|
|
@@ -13993,10 +15068,12 @@ const CustomsItemsDisplay = ({
|
|
|
13993
15068
|
extendZod();
|
|
13994
15069
|
const getShipmentSchema = ({
|
|
13995
15070
|
allowInternationalShipFrom,
|
|
13996
|
-
|
|
13997
|
-
requireMeasurements: _requireMeasurements = false,
|
|
15071
|
+
dimensionsUnit,
|
|
13998
15072
|
isContentDescriptionRequired: _isContentDescriptionRequired = false,
|
|
13999
|
-
isCustomsRequired: _isCustomsRequired = false
|
|
15073
|
+
isCustomsRequired: _isCustomsRequired = false,
|
|
15074
|
+
requireMeasurements: _requireMeasurements = false,
|
|
15075
|
+
warehouses,
|
|
15076
|
+
weightUnit
|
|
14000
15077
|
} = {}) => {
|
|
14001
15078
|
const baseSchema = z.object({
|
|
14002
15079
|
advancedOptions: z.object({
|
|
@@ -14027,7 +15104,9 @@ const getShipmentSchema = ({
|
|
|
14027
15104
|
height: z.number().nonnegative().nullishDefault(0),
|
|
14028
15105
|
length: z.number().nonnegative().nullishDefault(0),
|
|
14029
15106
|
width: z.number().nonnegative().nullishDefault(0)
|
|
14030
|
-
}).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),
|
|
14031
15110
|
insuredValue: moneySchema.extend({
|
|
14032
15111
|
amount: z.number().positive()
|
|
14033
15112
|
}).optional(),
|
|
@@ -14044,7 +15123,7 @@ const getShipmentSchema = ({
|
|
|
14044
15123
|
}) => whole || fractional, "schemaErrors.required") : z.object({
|
|
14045
15124
|
fractional: z.number().nonnegative().nullishDefault(0),
|
|
14046
15125
|
whole: z.number().nonnegative().nullishDefault(0)
|
|
14047
|
-
}).nullish()).transform(weight => weight ? convertWeight(weight) : undefined)
|
|
15126
|
+
}).nullish()).transform(weight => weight ? convertWeight(weight, weightUnit) : undefined)
|
|
14048
15127
|
}).array().min(1),
|
|
14049
15128
|
service: z.object({
|
|
14050
15129
|
carrierId: z.string().nullish(),
|
|
@@ -14071,7 +15150,9 @@ const getShipmentSchema = ({
|
|
|
14071
15150
|
length,
|
|
14072
15151
|
width,
|
|
14073
15152
|
height
|
|
14074
|
-
}) => [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
|
+
})))
|
|
14075
15156
|
}).array().min(1),
|
|
14076
15157
|
service: z.object({
|
|
14077
15158
|
carrierId: z.string(),
|
|
@@ -14119,6 +15200,7 @@ const getShipmentSchema = ({
|
|
|
14119
15200
|
const minimumShipDate = nextDayCutoff(17);
|
|
14120
15201
|
const maximumShipDate = daysAfter(7, minimumShipDate);
|
|
14121
15202
|
const ShipmentForm = ({
|
|
15203
|
+
accountSettings,
|
|
14122
15204
|
addressLoading,
|
|
14123
15205
|
addressPreference,
|
|
14124
15206
|
charsetWarning,
|
|
@@ -14159,14 +15241,22 @@ const ShipmentForm = ({
|
|
|
14159
15241
|
const [insuranceEnabled, setInsuranceEnabled] = useState(false);
|
|
14160
15242
|
const {
|
|
14161
15243
|
isContentDescriptionRequired,
|
|
14162
|
-
isCustomsRequired
|
|
15244
|
+
isCustomsRequired,
|
|
15245
|
+
hasAllZeroMeasurements
|
|
14163
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]);
|
|
14164
15252
|
const shipmentSchema = useMemo(() => getShipmentSchema({
|
|
15253
|
+
dimensionsUnit,
|
|
14165
15254
|
isContentDescriptionRequired,
|
|
14166
15255
|
isCustomsRequired,
|
|
14167
15256
|
requireMeasurements,
|
|
14168
|
-
warehouses: warehouses !== null && warehouses !== void 0 ? warehouses : []
|
|
14169
|
-
|
|
15257
|
+
warehouses: warehouses !== null && warehouses !== void 0 ? warehouses : [],
|
|
15258
|
+
weightUnit
|
|
15259
|
+
}), [isCustomsRequired, requireMeasurements, warehouses, isContentDescriptionRequired, weightUnit, dimensionsUnit]);
|
|
14170
15260
|
const requestedServices = useMemo(() => getRequestedServices(salesOrder), [salesOrder]);
|
|
14171
15261
|
const form = useForm({
|
|
14172
15262
|
defaultValues: {
|
|
@@ -14217,10 +15307,10 @@ const ShipmentForm = ({
|
|
|
14217
15307
|
const {
|
|
14218
15308
|
whole,
|
|
14219
15309
|
fractional
|
|
14220
|
-
} = formatFractionalWeight(weight);
|
|
15310
|
+
} = formatFractionalWeight(weight, weightUnit);
|
|
14221
15311
|
form.setValue("packages.0.weight.whole", whole);
|
|
14222
15312
|
form.setValue("packages.0.weight.fractional", fractional);
|
|
14223
|
-
}, [form]);
|
|
15313
|
+
}, [form, weightUnit]);
|
|
14224
15314
|
const handleChangeMode = useCallback(nextMode => __awaiter(void 0, void 0, void 0, function* () {
|
|
14225
15315
|
if (nextMode === "browse_rates") {
|
|
14226
15316
|
// Browse Rates
|
|
@@ -14728,7 +15818,7 @@ const ShipmentForm = ({
|
|
|
14728
15818
|
name: "packages.0.type",
|
|
14729
15819
|
onCategoryChange: value => form.setValue("carrierId", value),
|
|
14730
15820
|
options: packageOptions
|
|
14731
|
-
}),
|
|
15821
|
+
}), hasMeasurementUnits && requireMeasurements ? jsxs(Fragment, {
|
|
14732
15822
|
children: [jsxs(InputGroup, Object.assign({
|
|
14733
15823
|
control: form.control,
|
|
14734
15824
|
disabled: !!findCustomPackage(selectedPackage === null || selectedPackage === void 0 ? void 0 : selectedPackage.code),
|
|
@@ -14741,19 +15831,25 @@ const ShipmentForm = ({
|
|
|
14741
15831
|
control: form.control,
|
|
14742
15832
|
label: t("purchase-label:fields.dimensions.length"),
|
|
14743
15833
|
name: "packages.0.dimensions.length",
|
|
14744
|
-
placeholder: t(
|
|
15834
|
+
placeholder: t(`units.${dimensionsUnit}`)
|
|
14745
15835
|
}), jsx(NumberInput, {
|
|
14746
15836
|
control: form.control,
|
|
14747
15837
|
label: t("purchase-label:fields.dimensions.width"),
|
|
14748
15838
|
name: "packages.0.dimensions.width",
|
|
14749
|
-
placeholder: t(
|
|
15839
|
+
placeholder: t(`units.${dimensionsUnit}`)
|
|
14750
15840
|
}), jsx(NumberInput, {
|
|
14751
15841
|
control: form.control,
|
|
14752
15842
|
label: t("purchase-label:fields.dimensions.height"),
|
|
14753
15843
|
name: "packages.0.dimensions.height",
|
|
14754
|
-
placeholder: t(
|
|
15844
|
+
placeholder: t(`units.${dimensionsUnit}`)
|
|
14755
15845
|
})]
|
|
14756
|
-
})),
|
|
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({
|
|
14757
15853
|
control: form.control,
|
|
14758
15854
|
label: t("purchase-label:fields.weightGroup"),
|
|
14759
15855
|
name: "packages.0.weight",
|
|
@@ -14773,6 +15869,26 @@ const ShipmentForm = ({
|
|
|
14773
15869
|
placeholder: t("units.oz")
|
|
14774
15870
|
})]
|
|
14775
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, {})]
|
|
14776
15892
|
}), isContentDescriptionRequired && jsx(TextInput, {
|
|
14777
15893
|
control: form.control,
|
|
14778
15894
|
hint: t("purchase-label:hints.contentDescription"),
|
|
@@ -14951,6 +16067,13 @@ const Shipment = ({
|
|
|
14951
16067
|
const requestedServices = useMemo(() => getRequestedServices(salesOrder), [salesOrder]);
|
|
14952
16068
|
const activeLabel = useMemo(() => labels === null || labels === void 0 ? void 0 : labels.find(l => l.status === "completed"), [labels]);
|
|
14953
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(" ");
|
|
14954
16077
|
return jsxs(Fragment, {
|
|
14955
16078
|
children: [jsxs(Section, Object.assign({
|
|
14956
16079
|
"data-testid": "orderDetail"
|
|
@@ -15036,16 +16159,12 @@ const Shipment = ({
|
|
|
15036
16159
|
"data-testid": "dimensions",
|
|
15037
16160
|
label: t("view-shipment:fields.dimensions")
|
|
15038
16161
|
}, {
|
|
15039
|
-
children: [`${dimensions
|
|
16162
|
+
children: [`${formatDimensions(dimensions)} ` + t(`units.${dimensions.unit}`), jsx(Spacer, {})]
|
|
15040
16163
|
})), jsx(FieldLabel, Object.assign({
|
|
15041
16164
|
"data-testid": "weight",
|
|
15042
16165
|
label: t("view-shipment:fields.weight")
|
|
15043
16166
|
}, {
|
|
15044
|
-
children:
|
|
15045
|
-
count: pounds
|
|
15046
|
-
}) : "", ounces > 0 ? t("weight.ounces", {
|
|
15047
|
-
count: ounces
|
|
15048
|
-
}) : ""].filter(unit => unit.length).join(" ")
|
|
16167
|
+
children: formatWeight(weight)
|
|
15049
16168
|
}))]
|
|
15050
16169
|
})), jsxs(Section, Object.assign({
|
|
15051
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({
|
|
@@ -15199,6 +16318,9 @@ const styles = createStyles({
|
|
|
15199
16318
|
})
|
|
15200
16319
|
});
|
|
15201
16320
|
|
|
16321
|
+
/**
|
|
16322
|
+
* @internal
|
|
16323
|
+
*/
|
|
15202
16324
|
const DateRangeSelect = ({
|
|
15203
16325
|
fullWidth,
|
|
15204
16326
|
onChange,
|
|
@@ -15232,6 +16354,13 @@ const DateRangeSelect = ({
|
|
|
15232
16354
|
}));
|
|
15233
16355
|
};
|
|
15234
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
|
+
*/
|
|
15235
16364
|
const DateRangeCombo = ({
|
|
15236
16365
|
children: renderChildren,
|
|
15237
16366
|
onChange,
|
|
@@ -15276,9 +16405,13 @@ const DateRangeCombo = ({
|
|
|
15276
16405
|
};
|
|
15277
16406
|
|
|
15278
16407
|
/**
|
|
16408
|
+
* @internal
|
|
16409
|
+
*
|
|
16410
|
+
* # Error Fallback Component
|
|
16411
|
+
*
|
|
15279
16412
|
* Fallback component for the Elements ErrorBoundary
|
|
15280
16413
|
*
|
|
15281
|
-
* @see {@link
|
|
16414
|
+
* @see {@link ErrorFallbackProps | The props that are passed into the `<ErrorFallback />` component}
|
|
15282
16415
|
*/
|
|
15283
16416
|
const ErrorFallback = ({
|
|
15284
16417
|
error
|
|
@@ -15312,7 +16445,11 @@ const ErrorFallback = ({
|
|
|
15312
16445
|
};
|
|
15313
16446
|
|
|
15314
16447
|
/**
|
|
15315
|
-
*
|
|
16448
|
+
* @internal
|
|
16449
|
+
*
|
|
16450
|
+
* # Story Notes Component
|
|
16451
|
+
*
|
|
16452
|
+
* - For relevant notes about Storybook stories
|
|
15316
16453
|
*
|
|
15317
16454
|
* Stopgap until we setup https://storybook.js.org/addons/@storybook/addon-docs
|
|
15318
16455
|
*/
|
|
@@ -15597,12 +16734,17 @@ var common = {
|
|
|
15597
16734
|
weight: {
|
|
15598
16735
|
ounces: "{{count}} oz",
|
|
15599
16736
|
pounds_one: "{{count}} lb",
|
|
15600
|
-
pounds_other: "{{count}} lbs"
|
|
16737
|
+
pounds_other: "{{count}} lbs",
|
|
16738
|
+
kilogram: "{{count}} kg",
|
|
16739
|
+
gram: "{{count}} g"
|
|
15601
16740
|
},
|
|
15602
16741
|
units: {
|
|
15603
|
-
|
|
16742
|
+
inch: "in",
|
|
15604
16743
|
lbs: "lbs",
|
|
15605
|
-
oz: "oz"
|
|
16744
|
+
oz: "oz",
|
|
16745
|
+
centimeter: "cm",
|
|
16746
|
+
gram: "g",
|
|
16747
|
+
kilogram: "kg"
|
|
15606
16748
|
},
|
|
15607
16749
|
"VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkMTAwLgo=": "$100 insurance included",
|
|
15608
16750
|
"VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkNTAuCg==": "$50 insurance included",
|
|
@@ -15610,7 +16752,8 @@ var common = {
|
|
|
15610
16752
|
"QWRkcmVzcyBub3QgZm91bmQ=": "There was an issue validating your address. Please try again.",
|
|
15611
16753
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: "UPS weight limit per package is 150 lbs.",
|
|
15612
16754
|
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: "Finish setting up your ShipStation Carriers in the ShipStation app",
|
|
15613
|
-
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.",
|
|
15614
16757
|
"QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBNaXNzaW5nIG9yIGludmFsaWQgc2hpcCB0byBTdGF0ZVByb3ZpbmNlQ29kZQ==": "The State/Province Code Exceeds 5 Characters. Shorten the abbreviation or remove it, then try again.",
|
|
15615
16758
|
"QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnZhbGlkIHNvbGQgdG8gc3RhdGUgcHJvdmluY2UgY29kZS4gVmFsaWQgbGVuZ3RoIGlzIDAgdG8gNSBhbHBoYW51bWVyaWM=": "The State/Province Code Exceeds 5 Characters. Shorten the abbreviation or remove it, then try again."
|
|
15616
16759
|
};
|
|
@@ -15748,18 +16891,19 @@ var onboarding$1 = {
|
|
|
15748
16891
|
title: "Onboarding",
|
|
15749
16892
|
inlineTitle: "Why are we asking?",
|
|
15750
16893
|
landing: {
|
|
15751
|
-
action: "
|
|
16894
|
+
action: "Register",
|
|
15752
16895
|
title: "Register Your Account",
|
|
15753
16896
|
subtitle: "Enter your email address to start shipping with discounted carrier rates",
|
|
15754
16897
|
welcome: "Welcome",
|
|
15755
|
-
messageLine1: "Simplify your shipping workflow
|
|
15756
|
-
|
|
16898
|
+
messageLine1: "Simplify your shipping workflow.",
|
|
16899
|
+
partnerMessageLine1: "Simplify your shipping workflow inside {{partnerName}}.",
|
|
16900
|
+
messageLine2: "Let’s begin your account registration so that you can compare carrier services, ship domestic and international orders, and manage your postage payments."
|
|
15757
16901
|
},
|
|
15758
16902
|
steps: {
|
|
15759
|
-
|
|
16903
|
+
register: "Register",
|
|
15760
16904
|
carriers: "Carriers",
|
|
15761
16905
|
addresses: "Addresses",
|
|
15762
|
-
|
|
16906
|
+
billing: "Billing"
|
|
15763
16907
|
},
|
|
15764
16908
|
warehouse: {
|
|
15765
16909
|
title: "Ship From Address",
|
|
@@ -15865,7 +17009,8 @@ var purchaseLabel$1 = {
|
|
|
15865
17009
|
},
|
|
15866
17010
|
rates: {
|
|
15867
17011
|
uspsMediaMailAcknowledgement: "I confirm that this package is compliant with <1>USPS guidelines for Media Mail®</1>",
|
|
15868
|
-
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>"
|
|
15869
17014
|
},
|
|
15870
17015
|
shipToAddressFormFields: "Ship To Address Form Fields",
|
|
15871
17016
|
sections: {
|
|
@@ -15889,8 +17034,8 @@ var registerWallet = {
|
|
|
15889
17034
|
"register-wallet": {
|
|
15890
17035
|
sections: {
|
|
15891
17036
|
setup: {
|
|
15892
|
-
title: "Carriers
|
|
15893
|
-
subtitle: "
|
|
17037
|
+
title: "Activate Carriers",
|
|
17038
|
+
subtitle: "Activate the carriers in our service by agreeing to the carriers’ Terms of Service",
|
|
15894
17039
|
descriptionTitle: "What is a wallet?",
|
|
15895
17040
|
description: "Explaining the benefits of the wallet here"
|
|
15896
17041
|
},
|
|
@@ -15910,7 +17055,7 @@ var registerWallet = {
|
|
|
15910
17055
|
},
|
|
15911
17056
|
info: {
|
|
15912
17057
|
title: "Why we are asking?",
|
|
15913
|
-
description: "
|
|
17058
|
+
description: "We are offering a secure account balance to handle the cost of labels, insurance and carrier adjustments."
|
|
15914
17059
|
},
|
|
15915
17060
|
poBox: {
|
|
15916
17061
|
title: "PO Box cannot be used for Billing",
|
|
@@ -16015,6 +17160,31 @@ var walletHistory = {
|
|
|
16015
17160
|
|
|
16016
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);
|
|
16017
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
|
+
*/
|
|
16018
17188
|
const Component$4 = ({
|
|
16019
17189
|
onSaveSettings
|
|
16020
17190
|
}) => {
|
|
@@ -16026,6 +17196,32 @@ const Component$4 = ({
|
|
|
16026
17196
|
onSaveSettings: onSaveSettings
|
|
16027
17197
|
});
|
|
16028
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
|
+
*/
|
|
16029
17225
|
const Element$5 = alchemy.createElement(Component$4, ErrorFallback, {
|
|
16030
17226
|
css: {
|
|
16031
17227
|
height: "100%",
|
|
@@ -16044,9 +17240,44 @@ var accountSettings = /*#__PURE__*/Object.freeze({
|
|
|
16044
17240
|
Element: Element$5
|
|
16045
17241
|
});
|
|
16046
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
|
+
*/
|
|
16047
17276
|
const Component$3 = ({
|
|
16048
17277
|
features,
|
|
16049
|
-
|
|
17278
|
+
onboardingAddress,
|
|
17279
|
+
onCompleteOnboarding,
|
|
17280
|
+
partnerName
|
|
16050
17281
|
}) => {
|
|
16051
17282
|
const {
|
|
16052
17283
|
t
|
|
@@ -16099,20 +17330,46 @@ const Component$3 = ({
|
|
|
16099
17330
|
features: features,
|
|
16100
17331
|
fundingSources: fundingSources,
|
|
16101
17332
|
isRegisteringCarriers: registeringCarriers || creatingFundingSource,
|
|
17333
|
+
onboardingAddress: onboardingAddress,
|
|
16102
17334
|
onCarrierCreated: onCarrierCreated,
|
|
16103
17335
|
onCompleteOnboarding: onCompleteOnboarding,
|
|
16104
17336
|
onFundingSourceCreated: onFundingSourceCreated,
|
|
16105
17337
|
onWarehouseCreated: onWarehouseCreated,
|
|
17338
|
+
partnerName: partnerName,
|
|
16106
17339
|
registerCarrier: registerCarrier,
|
|
16107
17340
|
registerCarrierErrors: registerCarrierErrors,
|
|
16108
17341
|
warehouses: warehouses
|
|
16109
17342
|
});
|
|
16110
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
|
+
*/
|
|
16111
17366
|
const Element$4 = alchemy.createElement(Component$3, ErrorFallback, {
|
|
16112
17367
|
css: {
|
|
16113
17368
|
height: "100%",
|
|
16114
17369
|
maxWidth: "800px",
|
|
16115
17370
|
minWidth: "440px",
|
|
17371
|
+
overflow: "auto",
|
|
17372
|
+
scrollbarGutter: "stable both-edges",
|
|
16116
17373
|
width: "100%"
|
|
16117
17374
|
},
|
|
16118
17375
|
resources: {
|
|
@@ -16366,27 +17623,6 @@ const usePresets = ({
|
|
|
16366
17623
|
};
|
|
16367
17624
|
};
|
|
16368
17625
|
|
|
16369
|
-
/**
|
|
16370
|
-
* Generic error pretty printer
|
|
16371
|
-
* @param errors
|
|
16372
|
-
* @param predicate
|
|
16373
|
-
* @param scrubber
|
|
16374
|
-
*/
|
|
16375
|
-
const useScrubErrors = ({
|
|
16376
|
-
scrubber,
|
|
16377
|
-
errors,
|
|
16378
|
-
predicate
|
|
16379
|
-
}) => {
|
|
16380
|
-
const {
|
|
16381
|
-
t
|
|
16382
|
-
} = useTranslation();
|
|
16383
|
-
return useMemo(() => errors === null || errors === void 0 ? void 0 : errors.map(e => {
|
|
16384
|
-
return t(encode(e.message), {
|
|
16385
|
-
defaultValue: !predicate || predicate(e) ? t(scrubber(e)) : e.message
|
|
16386
|
-
});
|
|
16387
|
-
}), [errors, predicate, scrubber, t]);
|
|
16388
|
-
};
|
|
16389
|
-
|
|
16390
17626
|
var usps_first_class_mail = [
|
|
16391
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."
|
|
16392
17628
|
];
|
|
@@ -16479,11 +17715,13 @@ const useRequestRates = ({
|
|
|
16479
17715
|
reset: resetRates,
|
|
16480
17716
|
mutateAsync: calculateRates
|
|
16481
17717
|
} = useCalculateRates();
|
|
16482
|
-
const requestRates = useCallback(shipment => __awaiter(void 0, void 0, void 0, function* () {
|
|
16483
|
-
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 : [];
|
|
16484
17722
|
const result = yield calculateRates({
|
|
16485
17723
|
rateOptions: {
|
|
16486
|
-
carrierIds: shipment.carrierId ? [shipment.carrierId] :
|
|
17724
|
+
carrierIds: shipment.carrierId ? [shipment.carrierId] : isInternational ? internationalCarrierIds : domesticCarrierIds,
|
|
16487
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
|
|
16488
17726
|
: shipment.packages.map(pkg => pkg.packageCode),
|
|
16489
17727
|
serviceCodes: shipment.serviceCode ? [shipment.serviceCode] : undefined
|
|
@@ -16566,6 +17804,9 @@ const useRatesForm = ({
|
|
|
16566
17804
|
}) => {
|
|
16567
17805
|
var _a, _b;
|
|
16568
17806
|
const [beforeCreateError, setBeforeCreateError] = useState();
|
|
17807
|
+
const {
|
|
17808
|
+
isInternational
|
|
17809
|
+
} = useShipmentMetadata(shipment);
|
|
16569
17810
|
const {
|
|
16570
17811
|
data: carriers
|
|
16571
17812
|
} = useListCarriers();
|
|
@@ -16638,11 +17879,11 @@ const useRatesForm = ({
|
|
|
16638
17879
|
shipDate: isNowOrInTheFuture(shipment.shipDate) ? shipment.shipDate : undefined
|
|
16639
17880
|
}));
|
|
16640
17881
|
if (updatedShipment) {
|
|
16641
|
-
yield requestRates(updatedShipment);
|
|
17882
|
+
yield requestRates(updatedShipment, isInternational);
|
|
16642
17883
|
yield onShipmentUpdated === null || onShipmentUpdated === void 0 ? void 0 : onShipmentUpdated(updatedShipment);
|
|
16643
17884
|
yield onRateSaved === null || onRateSaved === void 0 ? void 0 : onRateSaved(updatedShipment);
|
|
16644
17885
|
}
|
|
16645
|
-
}), [onRateSaved, onShipmentUpdated, requestRates, shipment, updateShipment]);
|
|
17886
|
+
}), [isInternational, onRateSaved, onShipmentUpdated, requestRates, shipment, updateShipment]);
|
|
16646
17887
|
let errors = [...(ratesErrors !== null && ratesErrors !== void 0 ? ratesErrors : []), ...((_a = ratesResponse === null || ratesResponse === void 0 ? void 0 : ratesResponse.errors) !== null && _a !== void 0 ? _a : [])];
|
|
16647
17888
|
if (beforeCreateError) errors = [...errors, beforeCreateError];
|
|
16648
17889
|
// Sometimes no rates are returned and no top-level errors are returned
|
|
@@ -16657,7 +17898,7 @@ const useRatesForm = ({
|
|
|
16657
17898
|
name: "CodedError"
|
|
16658
17899
|
})))) !== null && _b !== void 0 ? _b : [];
|
|
16659
17900
|
}
|
|
16660
|
-
const
|
|
17901
|
+
const displayableRateErrors = useScrubErrors({
|
|
16661
17902
|
errors: errors,
|
|
16662
17903
|
predicate: useCallback(e => e.message.includes("No rates are available for service_codes"), []),
|
|
16663
17904
|
scrubber: useCallback(() => "common:errorMessages.noRatesAvailable", [])
|
|
@@ -16668,8 +17909,8 @@ const useRatesForm = ({
|
|
|
16668
17909
|
});
|
|
16669
17910
|
return {
|
|
16670
17911
|
carriers,
|
|
16671
|
-
displayableErrors,
|
|
16672
17912
|
displayableLabelErrors,
|
|
17913
|
+
displayableRateErrors,
|
|
16673
17914
|
errors: errors.length > 0 ? errors : undefined,
|
|
16674
17915
|
isLoading: ratesCalculating,
|
|
16675
17916
|
labelErrors: (labelErrors === null || labelErrors === void 0 ? void 0 : labelErrors.length) ? labelErrors : undefined,
|
|
@@ -16704,6 +17945,9 @@ const useShipmentForm = ({
|
|
|
16704
17945
|
const {
|
|
16705
17946
|
data: warehouses
|
|
16706
17947
|
} = useListWarehouses();
|
|
17948
|
+
const {
|
|
17949
|
+
data: accountSettings
|
|
17950
|
+
} = useGetAccountSettings();
|
|
16707
17951
|
const {
|
|
16708
17952
|
error: updateShipmentErrors,
|
|
16709
17953
|
mutateAsync: updateShipment,
|
|
@@ -16763,6 +18007,7 @@ const useShipmentForm = ({
|
|
|
16763
18007
|
scrubber: useCallback(() => "common:errorMessages.noRatesAvailable", [])
|
|
16764
18008
|
});
|
|
16765
18009
|
return {
|
|
18010
|
+
accountSettings,
|
|
16766
18011
|
addressLoading,
|
|
16767
18012
|
addressPreference,
|
|
16768
18013
|
carriers,
|
|
@@ -16802,6 +18047,9 @@ const ConfigureShipment = _a => {
|
|
|
16802
18047
|
} = _a,
|
|
16803
18048
|
props = __rest(_a, ["features", "onAddressValidation", "onApplyPreset", "onBeforeLabelCreate", "onChangeAddress", "onLabelCreateFailure", "onLabelCreateSuccess", "onRateSaved", "onRatesCalculated", "onShipmentUpdated", "printLabelLayout", "salesOrder", "shipment"]);
|
|
16804
18049
|
const hydrateRef = useRef();
|
|
18050
|
+
const {
|
|
18051
|
+
isInternational
|
|
18052
|
+
} = useShipmentMetadata(shipment);
|
|
16805
18053
|
const _b = useRatesForm({
|
|
16806
18054
|
onBeforeLabelCreate,
|
|
16807
18055
|
onLabelCreateFailure,
|
|
@@ -16828,15 +18076,15 @@ const ConfigureShipment = _a => {
|
|
|
16828
18076
|
onApplyPreset: useCallback((_preset, shipment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16829
18077
|
var _d;
|
|
16830
18078
|
if (shipment.packages[0].weight.value) {
|
|
16831
|
-
yield requestRates(shipment);
|
|
18079
|
+
yield requestRates(shipment, isInternational);
|
|
16832
18080
|
}
|
|
16833
18081
|
(_d = hydrateRef.current) === null || _d === void 0 ? void 0 : _d.call(hydrateRef, shipment);
|
|
16834
|
-
}), [requestRates]),
|
|
18082
|
+
}), [requestRates, isInternational]),
|
|
16835
18083
|
onChangeAddress,
|
|
16836
18084
|
onShipmentUpdated,
|
|
16837
18085
|
onSubmit: useCallback(shipment => __awaiter(void 0, void 0, void 0, function* () {
|
|
16838
|
-
yield requestRates(shipment);
|
|
16839
|
-
}), [requestRates]),
|
|
18086
|
+
yield requestRates(shipment, isInternational);
|
|
18087
|
+
}), [requestRates, isInternational]),
|
|
16840
18088
|
salesOrder,
|
|
16841
18089
|
shipment
|
|
16842
18090
|
}),
|
|
@@ -17138,6 +18386,30 @@ const PurchaseLabelByShipment = _a => {
|
|
|
17138
18386
|
}));
|
|
17139
18387
|
};
|
|
17140
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
|
+
*/
|
|
17141
18413
|
const Component$2 = _a => {
|
|
17142
18414
|
var props = __rest(_a, []);
|
|
17143
18415
|
if ("salesOrderId" in props || "orderSourceCode" in props) {
|
|
@@ -17146,6 +18418,44 @@ const Component$2 = _a => {
|
|
|
17146
18418
|
return jsx(PurchaseLabelByShipment, Object.assign({}, props));
|
|
17147
18419
|
}
|
|
17148
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
|
+
*/
|
|
17149
18459
|
const Element$3 = alchemy.createElement(Component$2, ErrorFallback, {
|
|
17150
18460
|
css: {
|
|
17151
18461
|
height: "100%",
|
|
@@ -17164,6 +18474,31 @@ var purchaseLabel = /*#__PURE__*/Object.freeze({
|
|
|
17164
18474
|
Element: Element$3
|
|
17165
18475
|
});
|
|
17166
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
|
+
*/
|
|
17167
18502
|
const Component$1 = ({
|
|
17168
18503
|
features,
|
|
17169
18504
|
onClickPrintLabel,
|
|
@@ -17203,6 +18538,36 @@ const Component$1 = ({
|
|
|
17203
18538
|
warehouse: warehouse
|
|
17204
18539
|
});
|
|
17205
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
|
+
**/
|
|
17206
18571
|
const Element$2 = alchemy.createElement(Component$1, ErrorFallback, {
|
|
17207
18572
|
css: {
|
|
17208
18573
|
height: "100%",
|
|
@@ -17326,6 +18691,31 @@ const Message = ({
|
|
|
17326
18691
|
});
|
|
17327
18692
|
};
|
|
17328
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
|
+
*/
|
|
17329
18719
|
const Component = ({
|
|
17330
18720
|
features,
|
|
17331
18721
|
labelId,
|
|
@@ -17377,6 +18767,37 @@ const Component = ({
|
|
|
17377
18767
|
})]
|
|
17378
18768
|
});
|
|
17379
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
|
+
*/
|
|
17380
18801
|
const Element$1 = alchemy.createElement(Component, ErrorFallback, {
|
|
17381
18802
|
css: {
|
|
17382
18803
|
height: "100%",
|
|
@@ -17395,6 +18816,31 @@ var voidLabel = /*#__PURE__*/Object.freeze({
|
|
|
17395
18816
|
Element: Element$1
|
|
17396
18817
|
});
|
|
17397
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
|
+
*/
|
|
17398
18844
|
const useLabelWorkflow = ({
|
|
17399
18845
|
_multiplexedId,
|
|
17400
18846
|
_labelId
|
|
@@ -17419,6 +18865,33 @@ const useLabelWorkflow = ({
|
|
|
17419
18865
|
shipmentId
|
|
17420
18866
|
};
|
|
17421
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
|
+
*/
|
|
17422
18895
|
const Element = (
|
|
17423
18896
|
/*
|
|
17424
18897
|
The passed props are underscore prefixed as they will be stashed, then from them stateful versions will be made
|
|
@@ -17488,7 +18961,8 @@ The passed props are underscore prefixed as they will be stashed, then from them
|
|
|
17488
18961
|
|
|
17489
18962
|
var labelWorkflow = /*#__PURE__*/Object.freeze({
|
|
17490
18963
|
__proto__: null,
|
|
18964
|
+
useLabelWorkflow: useLabelWorkflow,
|
|
17491
18965
|
Element: Element
|
|
17492
18966
|
});
|
|
17493
18967
|
|
|
17494
|
-
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 };
|