@shipengine/elements 0.16.1 → 0.17.3
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/components/auto-funding-form/auto-funding-form.d.ts +3 -1
- package/components/auto-funding-form/auto-funding-form.styles.d.ts +2 -1
- package/components/field/expiration-input/expiration-input.d.ts +3 -0
- package/components/field/expiration-input/index.d.ts +1 -0
- package/components/field/fields.d.ts +1 -0
- package/components/field/switch/switch.d.ts +1 -1
- package/components/fund-and-purchase/fund-and-purchase.d.ts +2 -1
- package/components/items-breakdown/items-breakdown.d.ts +1 -1
- package/components/templates/address-form/address-fields.styles.d.ts +1 -0
- package/components/templates/completion-page/completion-page.d.ts +4 -0
- package/components/templates/completion-page/index.d.ts +1 -0
- package/components/templates/index.d.ts +2 -1
- package/components/templates/list-carriers-row/list-carriers-row.styles.d.ts +1 -1
- package/components/templates/onboarding/onboarding.d.ts +1 -3
- package/components/templates/onboarding/onboarding.styles.d.ts +1 -1
- package/components/templates/rate-form/rate-form.d.ts +1 -0
- package/components/templates/shipment-form/shipment-form.d.ts +1 -1
- package/components/templates/suspend-sales-order/index.d.ts +1 -0
- package/components/templates/suspend-sales-order/suspend-sales-order.d.ts +8 -0
- package/components/templates/suspend-shipment/index.d.ts +1 -0
- package/components/templates/suspend-shipment/suspend-shipment.d.ts +8 -0
- package/components/templates/wallet-form/wallet-schema.d.ts +7 -12
- package/elements/components/configure-shipment/configure-shipment.d.ts +1 -1
- package/elements/components/configure-shipment/hooks/use-address.d.ts +1 -1
- package/elements/components/configure-shipment/hooks/use-shipment-form.d.ts +2 -2
- package/elements/components/index.d.ts +1 -1
- package/elements/components/{sales-order → purchase-label}/hooks/use-configure-shipment.d.ts +1 -1
- package/elements/components/purchase-label/hooks/use-load-shipment.d.ts +9 -0
- package/elements/components/purchase-label/index.d.ts +3 -0
- package/elements/components/{sales-order/sales-order.d.ts → purchase-label/purchase-label-by-sales-order.d.ts} +1 -1
- package/elements/components/purchase-label/purchase-label-by-shipment.d.ts +9 -0
- package/elements/components/purchase-label/purchase-label.d.ts +6 -0
- package/elements/purchase-label.d.ts +3 -1
- package/hooks/use-elements.d.ts +2 -1
- package/index.cjs +1733 -1548
- package/index.js +1734 -1551
- package/locales/en/index.d.ts +7 -3
- package/mocks/carriers/handlers.d.ts +3 -0
- package/mocks/warehouses/handlers.d.ts +12 -1
- package/package.json +3 -3
- package/utilities/money.d.ts +1 -0
- package/utilities/shipengine/sales-order.d.ts +10 -0
- package/components/templates/sales-order/index.d.ts +0 -1
- package/components/templates/sales-order/sales-order.d.ts +0 -8
- package/elements/components/sales-order/index.d.ts +0 -1
- /package/elements/components/{sales-order → purchase-label}/hooks/index.d.ts +0 -0
- /package/elements/components/{sales-order → purchase-label}/hooks/use-import-sales-order.d.ts +0 -0
- /package/elements/components/{sales-order → purchase-label}/hooks/use-pending-shipment.d.ts +0 -0
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useController, get as get$1, set as set$2, useWatch, useFormState, useF
|
|
|
3
3
|
import { useTranslation, Trans, initReactI18next, I18nextProvider } from 'react-i18next';
|
|
4
4
|
import { Typography, FormField, FieldMessageType, Input, Checkbox, Icon, Divider, Link, Select as Select$1, Next, Option, Button, Switch as Switch$1, Textarea, ButtonVariant, InlineNotification, NotificationType, ButtonColor, Grid, GridChild, Tag, TagColor, Skeleton, SkeletonAnimation, SkeletonVariant, SkeletonBackgroundColor, IconSize, Stepper, Step, Spinner, SpinnerSize, ChipList, Chip, ButtonSize, Table, TableBody, TableBaseRow, TableBodyCell, TableHeader, TableHeaderCell, useToggle as useToggle$1, Popover, DropdownOptionList, BottomSheet, GigerConfigProvider, EmotionReset, FontsLoader } from '@packlink/giger';
|
|
5
5
|
import axios from 'axios';
|
|
6
|
-
import { logger, ShipEngineProvider, useAddFunds, useGetCarrierById, useUpdateAutoFunding, useGetAutoFundingConfiguration, useListCarriers, useConnectCarrier, useListWarehouses, useUpdateWarehouse, useCreateWarehouse, useDeleteWarehouse, useValidateAddresses, useUpdateSalesOrderShipment, useParseAddress, useListCustomPackageTypes, useCalculateRates, useCreateLabel, useListSalesOrderShipments, useCreateSalesOrderShipment, useGetAccountSettings, useListSalesOrders, useGetSalesOrder, useListOrderSources, useRefreshOrderSource, useGetSalesOrderShipment, useListLabels, useGetLabel, useVoidLabel } from '@shipengine/react';
|
|
6
|
+
import { logger, ShipEngineProvider, useAddFunds, useGetCarrierById, useUpdateAutoFunding, useGetAutoFundingConfiguration, useListCarriers, useConnectCarrier, useListWarehouses, useUpdateWarehouse, useCreateWarehouse, useDeleteWarehouse, useValidateAddresses, useUpdateSalesOrderShipment, useParseAddress, useListCustomPackageTypes, useCalculateRates, useCreateLabel, useListSalesOrderShipments, useCreateSalesOrderShipment, useGetAccountSettings, useListSalesOrders, useGetSalesOrder, useListOrderSources, useRefreshOrderSource, useGetShipment, useGetSalesOrderShipment, useListLabels, useGetLabel, useVoidLabel } from '@shipengine/react';
|
|
7
7
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import * as React from 'react';
|
|
@@ -13,7 +13,7 @@ import { camelize } from 'humps';
|
|
|
13
13
|
import ReactDatePicker from 'react-datepicker';
|
|
14
14
|
import { IconNames, createTheme, BrandName, deserialize } from '@packlink/brands';
|
|
15
15
|
import { css } from '@emotion/css';
|
|
16
|
-
import { SE } from '@shipengine/api';
|
|
16
|
+
import { SE, Currency } from '@shipengine/api';
|
|
17
17
|
import { createPortal } from 'react-dom';
|
|
18
18
|
import { isValidPhoneNumber } from 'libphonenumber-js/min';
|
|
19
19
|
import cardValidator from 'card-validator';
|
|
@@ -1977,41 +1977,6 @@ $$i({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
|
|
|
1977
1977
|
}
|
|
1978
1978
|
});
|
|
1979
1979
|
|
|
1980
|
-
const currencySymbol = {
|
|
1981
|
-
aud: "$",
|
|
1982
|
-
cad: "$",
|
|
1983
|
-
eur: "€",
|
|
1984
|
-
gbp: "£",
|
|
1985
|
-
nzd: "$",
|
|
1986
|
-
usd: "$"
|
|
1987
|
-
};
|
|
1988
|
-
const formatMoney = (value, locale = "en-US") => {
|
|
1989
|
-
const currency = Intl.NumberFormat(locale, {
|
|
1990
|
-
currency: value.currency,
|
|
1991
|
-
style: "currency"
|
|
1992
|
-
});
|
|
1993
|
-
return currency.format(value.amount);
|
|
1994
|
-
};
|
|
1995
|
-
const calculateTotal = (...values) => {
|
|
1996
|
-
return values.reduce((total, value) => {
|
|
1997
|
-
var _a;
|
|
1998
|
-
return value ? total + ((_a = value.amount) !== null && _a !== void 0 ? _a : 0) : total;
|
|
1999
|
-
}, 0);
|
|
2000
|
-
};
|
|
2001
|
-
const formatCreditCardNumber = cc => [cc.substring(0, 4), cc.substring(4, 8), cc.substring(8, 12), cc.substring(12)].join(" ").trim();
|
|
2002
|
-
|
|
2003
|
-
const isString = x => typeof x === "string";
|
|
2004
|
-
|
|
2005
|
-
const getRateRequiresAcknowledgement = serviceCode => {
|
|
2006
|
-
switch (serviceCode) {
|
|
2007
|
-
case "usps_media_mail":
|
|
2008
|
-
return true;
|
|
2009
|
-
default:
|
|
2010
|
-
return false;
|
|
2011
|
-
}
|
|
2012
|
-
};
|
|
2013
|
-
const getTotalRateAmount = (rateCosts = {}) => calculateTotal(...Object.values(rateCosts));
|
|
2014
|
-
|
|
2015
1980
|
var anObject$9 = anObject$f;
|
|
2016
1981
|
|
|
2017
1982
|
// `RegExp.prototype.flags` getter implementation
|
|
@@ -2210,1073 +2175,1132 @@ $$h({ target: 'RegExp', proto: true, forced: /./.exec !== exec$2 }, {
|
|
|
2210
2175
|
exec: exec$2
|
|
2211
2176
|
});
|
|
2212
2177
|
|
|
2213
|
-
|
|
2214
|
-
const hasEuCustomsRules = true,
|
|
2215
|
-
hasProvinces = true,
|
|
2216
|
-
isMilitary = true,
|
|
2217
|
-
// United States territories that ship domestic but require customs
|
|
2218
|
-
// https://blog.stamps.com/2015/09/23/how-to-ship-packages-to-u-s-territories/
|
|
2219
|
-
isUnitedStatesTerritory$1 = true,
|
|
2220
|
-
supportsByoa = true;
|
|
2221
|
-
class Country {
|
|
2222
|
-
constructor(name, code, rules = {}) {
|
|
2223
|
-
var _a, _b, _c, _d;
|
|
2224
|
-
this.name = name;
|
|
2225
|
-
this.code = code;
|
|
2226
|
-
this.hasEuCustomsRules = (_a = rules.hasEuCustomsRules) !== null && _a !== void 0 ? _a : false;
|
|
2227
|
-
this.hasProvinces = (_b = rules.hasProvinces) !== null && _b !== void 0 ? _b : false;
|
|
2228
|
-
this.isUnitedStatesTerritory = (_c = rules.isUnitedStatesTerritory) !== null && _c !== void 0 ? _c : false;
|
|
2229
|
-
this.supportsByoa = (_d = rules.supportsByoa) !== null && _d !== void 0 ? _d : false;
|
|
2230
|
-
}
|
|
2231
|
-
}
|
|
2232
|
-
const countries = [new Country("Afghanistan", "AF"), new Country("Aland Islands", "AX"), new Country("Albania", "AL"), new Country("Algeria", "DZ"), new Country("American Samoa", "AS", {
|
|
2233
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2234
|
-
}), 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", {
|
|
2235
|
-
hasProvinces,
|
|
2236
|
-
supportsByoa
|
|
2237
|
-
}), new Country("Austria", "AT", {
|
|
2238
|
-
hasEuCustomsRules,
|
|
2239
|
-
supportsByoa
|
|
2240
|
-
}), new Country("Azerbaijan", "AZ"), new Country("Bahamas", "BS"), new Country("Bahrain", "BH"), new Country("Bangladesh", "BD"), new Country("Barbados", "BB"), new Country("Belarus", "BY"), new Country("Belgium", "BE", {
|
|
2241
|
-
hasEuCustomsRules,
|
|
2242
|
-
supportsByoa
|
|
2243
|
-
}), new Country("Belize", "BZ"), new Country("Benin", "BJ"), new Country("Bermuda", "BM"), new Country("Bhutan", "BT"), new Country("Bolivia", "BO"), new Country("Bonaire, Sint Eustatius And Saba", "BQ"), new Country("Bosnia and Herzegovina", "BA"), new Country("Botswana", "BW"), new Country("Brazil", "BR", {
|
|
2244
|
-
hasProvinces
|
|
2245
|
-
}), new Country("British Indian Ocean Territory", "IO"), new Country("British Virgin Islands", "VG"), new Country("Brunei Darussalam", "BN"), new Country("Bulgaria", "BG", {
|
|
2246
|
-
hasEuCustomsRules,
|
|
2247
|
-
supportsByoa
|
|
2248
|
-
}), new Country("Burkina Faso", "BF"), new Country("Burundi", "BI"), new Country("Canada", "CA", {
|
|
2249
|
-
hasProvinces
|
|
2250
|
-
}), new Country("Cambodia", "KH"), new Country("Cameroon", "CM"), new Country("Cape Verde Islands", "CV"), new Country("Cayman Islands", "KY"), new Country("Central African Republic", "CF"), new Country("Chad", "TD"), new Country("Chile", "CL"), new Country("China", "CN"), new Country("Christmas Island", "CX"), new Country("Cocos(Keeling) Islands", "CC"), new Country("Colombia", "CO"), new Country("Comoros", "KM"), new Country("Congo", "CG"), new Country("Congo, The Democratic Republic of", "CD"), new Country("Cook Islands", "CK"), new Country("Costa Rica", "CR"), new Country("Croatia", "HR", {
|
|
2251
|
-
hasEuCustomsRules,
|
|
2252
|
-
supportsByoa
|
|
2253
|
-
}), new Country("Cuba", "CU"), new Country("Curacao", "CW"), new Country("Cyprus", "CY", {
|
|
2254
|
-
hasEuCustomsRules,
|
|
2255
|
-
supportsByoa
|
|
2256
|
-
}), new Country("Czech Republic", "CZ", {
|
|
2257
|
-
hasEuCustomsRules,
|
|
2258
|
-
supportsByoa
|
|
2259
|
-
}), new Country("Denmark", "DK", {
|
|
2260
|
-
hasEuCustomsRules,
|
|
2261
|
-
supportsByoa
|
|
2262
|
-
}), new Country("Djibouti", "DJ"), new Country("Dominica", "DM"), new Country("Dominican Republic", "DO"), new Country("Ecuador", "EC"), new Country("Egypt", "EG"), new Country("El Salvador", "SV"), new Country("Equatorial Guinea", "GQ"), new Country("Eritrea", "ER"), new Country("Estonia", "EE", {
|
|
2263
|
-
hasEuCustomsRules,
|
|
2264
|
-
supportsByoa
|
|
2265
|
-
}), new Country("Ethiopia", "ET"), new Country("Falkland Islands", "FK"), new Country("Faroe Islands", "FO"), new Country("Federated States of Micronesia", "FM", {
|
|
2266
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2267
|
-
}), new Country("Fiji", "FJ"), new Country("Finland", "FI", {
|
|
2268
|
-
hasEuCustomsRules,
|
|
2269
|
-
supportsByoa
|
|
2270
|
-
}), new Country("France", "FR", {
|
|
2271
|
-
hasEuCustomsRules,
|
|
2272
|
-
supportsByoa
|
|
2273
|
-
}), new Country("French Guiana", "GF"), new Country("French Polynesia", "PF"), new Country("French Southern Territories", "TF"), new Country("Gabon", "GA"), new Country("Gambia", "GM"), new Country("Georgia", "GE"), new Country("Germany", "DE", {
|
|
2274
|
-
hasEuCustomsRules,
|
|
2275
|
-
supportsByoa
|
|
2276
|
-
}), new Country("Ghana", "GH"), new Country("Gibraltar", "GI"), new Country("Greece", "GR", {
|
|
2277
|
-
hasEuCustomsRules,
|
|
2278
|
-
supportsByoa
|
|
2279
|
-
}), new Country("Greenland", "GL"), new Country("Grenada", "GD"), new Country("Guadeloupe", "GP"), new Country("Guam", "GU", {
|
|
2280
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2281
|
-
}), new Country("Guatemala", "GT"), new Country("Guernsey", "GG"), new Country("Guinea", "GN"), new Country("Guinea - Bissau", "GW"), new Country("Guyana", "GY"), new Country("Haiti", "HT"), new Country("Holy See", "VA"), new Country("Honduras", "HN"), new Country("Hong Kong", "HK"), new Country("Hungary", "HU", {
|
|
2282
|
-
hasEuCustomsRules,
|
|
2283
|
-
supportsByoa
|
|
2284
|
-
}), new Country("Iceland", "IS"), new Country("India", "IN"), new Country("Indonesia", "ID"), new Country("Iran", "IR"), new Country("Iraq", "IQ"), new Country("Ireland", "IE", {
|
|
2285
|
-
hasEuCustomsRules,
|
|
2286
|
-
supportsByoa
|
|
2287
|
-
}), new Country("Isle of Man", "IM"), new Country("Israel", "IL"), new Country("Italy", "IT", {
|
|
2288
|
-
hasEuCustomsRules,
|
|
2289
|
-
supportsByoa
|
|
2290
|
-
}), new Country("Ivory Coast", "CI"), new Country("Jamaica", "JM"), new Country("Japan", "JP", {
|
|
2291
|
-
hasProvinces
|
|
2292
|
-
}), new Country("Jersey", "JE"), new Country("Jordan", "JO"), new Country("Kazakhstan", "KZ"), new Country("Kenya", "KE"), new Country("Kiribati", "KI"), new Country("Korea, Republic of", "KR"), new Country("Kuwait", "KW"), new Country("Kyrgyzstan", "KG"), new Country("Laos", "LA"), new Country("Latvia", "LV", {
|
|
2293
|
-
hasEuCustomsRules,
|
|
2294
|
-
supportsByoa
|
|
2295
|
-
}), new Country("Lebanon", "LB"), new Country("Lesotho", "LS"), new Country("Liberia", "LR"), new Country("Libya", "LY"), new Country("Liechtenstein", "LI"), new Country("Lithuania", "LT", {
|
|
2296
|
-
hasEuCustomsRules,
|
|
2297
|
-
supportsByoa
|
|
2298
|
-
}), new Country("Luxembourg", "LU", {
|
|
2299
|
-
hasEuCustomsRules,
|
|
2300
|
-
supportsByoa
|
|
2301
|
-
}), new Country("Macao", "MO"), new Country("Macedonia", "MK"), new Country("Madagascar", "MG"), new Country("Malawi", "MW"), new Country("Malaysia", "MY"), new Country("Maldives", "MV"), new Country("Mali", "ML"), new Country("Malta", "MT", {
|
|
2302
|
-
hasEuCustomsRules,
|
|
2303
|
-
supportsByoa
|
|
2304
|
-
}), new Country("Marshall Islands", "MH", {
|
|
2305
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2306
|
-
}), new Country("Martinique", "MQ"), new Country("Mauritania", "MR"), new Country("Mauritius0", "MU"), new Country("Mayotte", "YT"), new Country("Mexico", "MX", {
|
|
2307
|
-
supportsByoa
|
|
2308
|
-
}), new Country("Moldova", "MD"), new Country("Monaco", "MC"), new Country("Mongolia", "MN"), new Country("Montenegro", "ME"), new Country("Montserrat", "MS"), new Country("Morocco", "MA"), new Country("Mozambique", "MZ"), new Country("Myanmar", "MM"), new Country("Namibia", "NA"), new Country("Nauru", "NR"), new Country("Nepal", "NP"), new Country("Netherlands", "NL", {
|
|
2309
|
-
hasEuCustomsRules,
|
|
2310
|
-
supportsByoa
|
|
2311
|
-
}), new Country("Netherlands Antilles", "AN"), new Country("New Caledonia", "NC"), new Country("New Zealand", "NZ", {
|
|
2312
|
-
supportsByoa
|
|
2313
|
-
}), new Country("Nicaragua", "NI"), new Country("Niger", "NE"), new Country("Nigeria", "NG"), new Country("Niue", "NU"), new Country("Norfolk Island", "NF"), new Country("North Korea", "KP"), new Country("Northern Mariana Islands", "MP", {
|
|
2314
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2315
|
-
}), new Country("Norway", "NO", {
|
|
2316
|
-
hasEuCustomsRules
|
|
2317
|
-
}), new Country("Oman", "OM"), new Country("Pakistan", "PK"), new Country("Palau", "PW", {
|
|
2318
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2319
|
-
}), new Country("Palestinian Territory", "PS"), new Country("Panama", "PA"), new Country("Papua New Guinea", "PG"), new Country("Paraguay", "PY"), new Country("Peru", "PE"), new Country("Philippines", "PH"), new Country("Pitcairn Island", "PN"), new Country("Poland", "PL", {
|
|
2320
|
-
hasEuCustomsRules
|
|
2321
|
-
}), new Country("Portugal", "PT", {
|
|
2322
|
-
hasEuCustomsRules,
|
|
2323
|
-
supportsByoa
|
|
2324
|
-
}),
|
|
2325
|
-
// TODO - Puerto Rico is a US territory but there are some funky rules with USPS that need to be addressed
|
|
2326
|
-
new Country("Puerto Rico", "PR", {
|
|
2327
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1,
|
|
2328
|
-
supportsByoa
|
|
2329
|
-
}), new Country("Qatar", "QA"), new Country("Reunion", "RE"), new Country("Romania", "RO", {
|
|
2330
|
-
hasEuCustomsRules,
|
|
2331
|
-
supportsByoa
|
|
2332
|
-
}), new Country("Russia", "RU"), new Country("Rwanda", "RW"), new Country("Saint Barthelemy", "BL"), new Country("Saint Helena", "SH"), new Country("Saint Kitts and Nevis", "KN"), new Country("Saint Lucia", "LC"), new Country("Saint Martin", "MF"), new Country("Saint Pierre and Miquelon", "PM"), new Country("Saint Vincent & the Grenadines", "VC"), new Country("Samoa", "WS"), new Country("San Marino", "SM"), new Country("Sao Tome and Principe", "ST"), new Country("Saudi Arabia", "SA"), new Country("Senegal", "SN"), new Country("Serbia", "RS"), new Country("Seychelles", "SC"), new Country("Sierra Leone", "SL"), new Country("Singapore", "SG"), new Country("Sint Maarten(Dutch)", "SX"), new Country("Slovakia", "SK", {
|
|
2333
|
-
hasEuCustomsRules,
|
|
2334
|
-
supportsByoa
|
|
2335
|
-
}), new Country("Slovenia", "SI", {
|
|
2336
|
-
hasEuCustomsRules,
|
|
2337
|
-
supportsByoa
|
|
2338
|
-
}), new Country("Solomon Islands", "SB"), new Country("Somalia", "SO"), new Country("South Africa", "ZA"), new Country("South Georgia & the South Sandwich Islands", "GS"), new Country("South Sudan", "SS"), new Country("Spain", "ES", {
|
|
2339
|
-
hasEuCustomsRules,
|
|
2340
|
-
supportsByoa
|
|
2341
|
-
}), new Country("Sri Lanka", "LK"), new Country("Sudan", "SD"), new Country("Suriname", "SR"), new Country("Svalbard & Jan Mayen Islands", "SJ"), new Country("Swaziland", "SZ"), new Country("Sweden", "SE", {
|
|
2342
|
-
hasEuCustomsRules,
|
|
2343
|
-
supportsByoa
|
|
2344
|
-
}), new Country("Switzerland", "CH", {
|
|
2345
|
-
hasEuCustomsRules
|
|
2346
|
-
}), new Country("Syria", "SY"), new Country("Taiwan", "TW"), new Country("Tajikistan", "TJ"), new Country("Tanzania", "TZ"), new Country("Thailand", "TH"), new Country("Timor - Leste(formerly East Timor)", "TL"), new Country("Togo", "TG"), new Country("Tokelau", "TK"), new Country("Tonga", "TO"), new Country("Trinidad and Tobago", "TT"), new Country("Tunisia", "TN"), new Country("Turkey", "TR"), new Country("Turkmenistan", "TM"), new Country("Turks and Caicos Islands", "TC"), new Country("Tuvalu", "TV"), new Country("Uganda", "UG"), new Country("Ukraine", "UA"), new Country("United Arab Emirates", "AE"), new Country("United Kingdom", "GB", {
|
|
2347
|
-
supportsByoa
|
|
2348
|
-
}), new Country("United States Virgin Islands", "VI", {
|
|
2349
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2350
|
-
}), new Country("U.S. Minor Outlying Islands", "UM", {
|
|
2351
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2352
|
-
}), new Country("United States of America", "US", {
|
|
2353
|
-
hasProvinces,
|
|
2354
|
-
supportsByoa
|
|
2355
|
-
}), 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")];
|
|
2356
|
-
const countryCodes = countries.map(c => c.code);
|
|
2357
|
-
const euCountryCodes = countries.filter(c => c.hasEuCustomsRules).map(c => c.code);
|
|
2358
|
-
// #endregion
|
|
2359
|
-
// #region [ rgba(0,0,0,0) ] Postal Codes
|
|
2360
|
-
const postalCodeRegex$3 = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
|
|
2361
|
-
class UsState {
|
|
2362
|
-
constructor(name, code, rules = {}) {
|
|
2363
|
-
var _a, _b;
|
|
2364
|
-
this.name = name;
|
|
2365
|
-
this.code = code;
|
|
2366
|
-
this.isMilitary = (_a = rules.isMilitary) !== null && _a !== void 0 ? _a : false;
|
|
2367
|
-
this.isUnitedStatesTerritory = (_b = rules.isUnitedStatesTerritory) !== null && _b !== void 0 ? _b : false;
|
|
2368
|
-
}
|
|
2369
|
-
}
|
|
2370
|
-
const usStates = [new UsState("Alabama", "AL"), new UsState("Alaska", "AK"), new UsState("American Samoa", "AS", {
|
|
2371
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2372
|
-
}), new UsState("Arizona", "AZ"), new UsState("Arkansas", "AR"), new UsState("Armed Forces Americas", "AA", {
|
|
2373
|
-
isMilitary
|
|
2374
|
-
}), new UsState("Armed Forces Europe", "AE", {
|
|
2375
|
-
isMilitary
|
|
2376
|
-
}), new UsState("Armed Forces Pacific", "AP", {
|
|
2377
|
-
isMilitary
|
|
2378
|
-
}), new UsState("California", "CA"), new UsState("Colorado", "CO"), new UsState("Connecticut", "CT"), new UsState("Delaware", "DE"), new UsState("District of Columbia", "DC"), new UsState("Florida", "FL"), new UsState("Georgia", "GA"), new UsState("Guam", "GU", {
|
|
2379
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2380
|
-
}), new UsState("Hawaii", "HI"), new UsState("Idaho", "ID"), new UsState("Illinois", "IL"), new UsState("Indiana", "IN"), new UsState("Iowa", "IA"), new UsState("Kansas", "KS"), new UsState("Kentucky", "KY"), new UsState("Louisiana", "LA"), new UsState("Maine", "ME"), new UsState("Maryland", "MD"), new UsState("Massachusetts", "MA"), new UsState("Michigan", "MI"), new UsState("Minnesota", "MN"), new UsState("Mississippi", "MS"), new UsState("Missouri", "MO"), new UsState("Montana", "MT"), new UsState("Nebraska", "NE"), new UsState("Nevada", "NV"), new UsState("New Hampshire", "NH"), new UsState("New Jersey", "NJ"), new UsState("New Mexico", "NM"), new UsState("New York", "NY"), new UsState("North Carolina", "NC"), new UsState("North Dakota", "ND"), new UsState("Ohio", "OH"), new UsState("Oklahoma", "OK"), new UsState("Oregon", "OR"), new UsState("Pennsylvania", "PA"), new UsState("Puerto Rico", "PR", {
|
|
2381
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2382
|
-
}), new UsState("Rhode Island", "RI"), new UsState("South Carolina", "SC"), new UsState("South Dakota", "SD"), new UsState("Tennessee", "TN"), new UsState("Texas", "TX"), new UsState("Utah", "UT"), new UsState("Vermont", "VT"), new UsState("Virgin Islands", "VI", {
|
|
2383
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2384
|
-
}), new UsState("Virginia", "VA"), new UsState("Washington", "WA"), new UsState("West Virginia", "WV"), new UsState("Wisconsin", "WI"), new UsState("Wyoming", "WY"), new UsState("Northern Mariana Islands", "MP", {
|
|
2385
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2386
|
-
}), new UsState("U.S. Minor Outlying Islands", "UM", {
|
|
2387
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2388
|
-
})];
|
|
2389
|
-
const usStateCodes = usStates.map(item => item.code);
|
|
2390
|
-
class UsaCity {
|
|
2391
|
-
constructor(name, code, rules = {}) {
|
|
2392
|
-
var _a;
|
|
2393
|
-
this.name = name;
|
|
2394
|
-
this.code = code;
|
|
2395
|
-
this.isMilitary = (_a = rules.isMilitary) !== null && _a !== void 0 ? _a : false;
|
|
2396
|
-
}
|
|
2397
|
-
}
|
|
2398
|
-
const usCities = [new UsaCity("Army Post Office", "APO", {
|
|
2399
|
-
isMilitary
|
|
2400
|
-
}), new UsaCity("Diplomatic Post Office", "DPO", {
|
|
2401
|
-
isMilitary
|
|
2402
|
-
}), new UsaCity("Fleet Post Office", "FPO", {
|
|
2403
|
-
isMilitary
|
|
2404
|
-
})];
|
|
2405
|
-
// #endregion
|
|
2178
|
+
var NATIVE_BIND$1 = functionBindNative;
|
|
2406
2179
|
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2180
|
+
var FunctionPrototype = Function.prototype;
|
|
2181
|
+
var apply$2 = FunctionPrototype.apply;
|
|
2182
|
+
var call$b = FunctionPrototype.call;
|
|
2183
|
+
|
|
2184
|
+
// eslint-disable-next-line es/no-reflect -- safe
|
|
2185
|
+
var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$b.bind(apply$2) : function () {
|
|
2186
|
+
return call$b.apply(apply$2, arguments);
|
|
2187
|
+
});
|
|
2188
|
+
|
|
2189
|
+
var classofRaw = classofRaw$2;
|
|
2190
|
+
var uncurryThis$f = functionUncurryThis;
|
|
2191
|
+
|
|
2192
|
+
var functionUncurryThisClause = function (fn) {
|
|
2193
|
+
// Nashorn bug:
|
|
2194
|
+
// https://github.com/zloirock/core-js/issues/1128
|
|
2195
|
+
// https://github.com/zloirock/core-js/issues/1130
|
|
2196
|
+
if (classofRaw(fn) === 'Function') return uncurryThis$f(fn);
|
|
2413
2197
|
};
|
|
2414
|
-
/**
|
|
2415
|
-
* @category Utilities
|
|
2416
|
-
*/
|
|
2417
|
-
const isMilitaryAddress = address => {
|
|
2418
|
-
var _a, _b;
|
|
2419
|
-
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));
|
|
2420
|
-
};
|
|
2421
|
-
/**
|
|
2422
|
-
* @category Utilities
|
|
2423
|
-
*/
|
|
2424
|
-
const isUnitedStatesTerritory = address => {
|
|
2425
|
-
var _a, _b;
|
|
2426
|
-
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));
|
|
2427
|
-
};
|
|
2428
|
-
const PO_BOX_REGEX =
|
|
2429
|
-
// eslint-disable-next-line no-useless-escape
|
|
2430
|
-
/^(((p[\s\.\'\,]?[o\s][\.\'\,]?)\s?)|(post\s?office\s?))((box|bin|bo|b\.?)?\s?(num|number|#)?\s?\d+)/i;
|
|
2431
|
-
/**
|
|
2432
|
-
* @category Utilities
|
|
2433
|
-
*/
|
|
2434
|
-
const isPoBox = addressLine => PO_BOX_REGEX.test(addressLine);
|
|
2435
|
-
/**
|
|
2436
|
-
* @category Utilities
|
|
2437
|
-
*/
|
|
2438
|
-
const isPoBoxAddress = address => !!(isPoBox(address.addressLine1) || address.addressLine2 && isPoBox(address.addressLine2));
|
|
2439
|
-
|
|
2440
|
-
var $$g = _export;
|
|
2441
|
-
var $includes = arrayIncludes.includes;
|
|
2442
|
-
var fails$a = fails$r;
|
|
2443
|
-
var addToUnscopables$2 = addToUnscopables$4;
|
|
2444
2198
|
|
|
2445
|
-
//
|
|
2446
|
-
var BROKEN_ON_SPARSE = fails$a(function () {
|
|
2447
|
-
return !Array(1).includes();
|
|
2448
|
-
});
|
|
2199
|
+
// TODO: Remove from `core-js@4` since it's moved to entry points
|
|
2449
2200
|
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
});
|
|
2201
|
+
var uncurryThis$e = functionUncurryThisClause;
|
|
2202
|
+
var defineBuiltIn$4 = defineBuiltIn$8;
|
|
2203
|
+
var regexpExec$1 = regexpExec$2;
|
|
2204
|
+
var fails$a = fails$r;
|
|
2205
|
+
var wellKnownSymbol$a = wellKnownSymbol$j;
|
|
2206
|
+
var createNonEnumerableProperty = createNonEnumerableProperty$5;
|
|
2457
2207
|
|
|
2458
|
-
|
|
2459
|
-
|
|
2208
|
+
var SPECIES$4 = wellKnownSymbol$a('species');
|
|
2209
|
+
var RegExpPrototype$2 = RegExp.prototype;
|
|
2460
2210
|
|
|
2461
|
-
|
|
2462
|
-
|
|
2211
|
+
var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
|
|
2212
|
+
var SYMBOL = wellKnownSymbol$a(KEY);
|
|
2463
2213
|
|
|
2464
|
-
function
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
const hasAllZeroes = Object.values(dims).every(d => d === 0);
|
|
2470
|
-
return hasAllZeroes && !allowAllZeroes ? undefined : dims;
|
|
2471
|
-
}
|
|
2472
|
-
return Object.assign(Object.assign({}, dimensions), {
|
|
2473
|
-
unit: "inch"
|
|
2214
|
+
var DELEGATES_TO_SYMBOL = !fails$a(function () {
|
|
2215
|
+
// String methods call symbol-named RegEp methods
|
|
2216
|
+
var O = {};
|
|
2217
|
+
O[SYMBOL] = function () { return 7; };
|
|
2218
|
+
return ''[KEY](O) != 7;
|
|
2474
2219
|
});
|
|
2475
|
-
}
|
|
2476
2220
|
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
contents: "merchandise",
|
|
2482
|
-
customsItems: salesOrder.salesOrderItems.filter(item => item.lineItemDetails.name.length > 0).map(item => ({
|
|
2483
|
-
countryOfOrigin: warehouse.originAddress.countryCode,
|
|
2484
|
-
description: item.lineItemDetails.name,
|
|
2485
|
-
quantity: item.quantity,
|
|
2486
|
-
value: item.priceSummary.unitPrice.amount
|
|
2487
|
-
})),
|
|
2488
|
-
nonDelivery: "return_to_sender"
|
|
2489
|
-
});
|
|
2490
|
-
/**
|
|
2491
|
-
* @category Utilities
|
|
2492
|
-
*/
|
|
2493
|
-
const getIsCustomsRequiredForSalesOrder = ({
|
|
2494
|
-
shipTo
|
|
2495
|
-
}, {
|
|
2496
|
-
originAddress
|
|
2497
|
-
}) => 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);
|
|
2498
|
-
/**
|
|
2499
|
-
* @category Utilities
|
|
2500
|
-
*/
|
|
2501
|
-
const getRequestedServices = salesOrder => {
|
|
2502
|
-
var _a;
|
|
2503
|
-
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)));
|
|
2504
|
-
};
|
|
2221
|
+
var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails$a(function () {
|
|
2222
|
+
// Symbol-named RegExp methods call .exec
|
|
2223
|
+
var execCalled = false;
|
|
2224
|
+
var re = /a/;
|
|
2505
2225
|
|
|
2506
|
-
|
|
2226
|
+
if (KEY === 'split') {
|
|
2227
|
+
// We can't use real regex here since it causes deoptimization
|
|
2228
|
+
// and serious performance degradation in V8
|
|
2229
|
+
// https://github.com/zloirock/core-js/issues/306
|
|
2230
|
+
re = {};
|
|
2231
|
+
// RegExp[@@split] doesn't call the regex's exec method, but first creates
|
|
2232
|
+
// a new one. We need to return the patched regex when creating the new one.
|
|
2233
|
+
re.constructor = {};
|
|
2234
|
+
re.constructor[SPECIES$4] = function () { return re; };
|
|
2235
|
+
re.flags = '';
|
|
2236
|
+
re[SYMBOL] = /./[SYMBOL];
|
|
2237
|
+
}
|
|
2507
2238
|
|
|
2508
|
-
|
|
2239
|
+
re.exec = function () { execCalled = true; return null; };
|
|
2509
2240
|
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
};
|
|
2241
|
+
re[SYMBOL]('');
|
|
2242
|
+
return !execCalled;
|
|
2243
|
+
});
|
|
2513
2244
|
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2245
|
+
if (
|
|
2246
|
+
!DELEGATES_TO_SYMBOL ||
|
|
2247
|
+
!DELEGATES_TO_EXEC ||
|
|
2248
|
+
FORCED
|
|
2249
|
+
) {
|
|
2250
|
+
var uncurriedNativeRegExpMethod = uncurryThis$e(/./[SYMBOL]);
|
|
2251
|
+
var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
|
2252
|
+
var uncurriedNativeMethod = uncurryThis$e(nativeMethod);
|
|
2253
|
+
var $exec = regexp.exec;
|
|
2254
|
+
if ($exec === regexpExec$1 || $exec === RegExpPrototype$2.exec) {
|
|
2255
|
+
if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
|
|
2256
|
+
// The native String method already delegates to @@method (this
|
|
2257
|
+
// polyfilled function), leasing to infinite recursion.
|
|
2258
|
+
// We avoid it by directly calling the native @@method method.
|
|
2259
|
+
return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
|
|
2260
|
+
}
|
|
2261
|
+
return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
|
|
2262
|
+
}
|
|
2263
|
+
return { done: false };
|
|
2264
|
+
});
|
|
2517
2265
|
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2266
|
+
defineBuiltIn$4(String.prototype, KEY, methods[0]);
|
|
2267
|
+
defineBuiltIn$4(RegExpPrototype$2, SYMBOL, methods[1]);
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
if (SHAM) createNonEnumerableProperty(RegExpPrototype$2[SYMBOL], 'sham', true);
|
|
2522
2271
|
};
|
|
2523
2272
|
|
|
2524
|
-
var
|
|
2525
|
-
var
|
|
2526
|
-
var
|
|
2273
|
+
var uncurryThis$d = functionUncurryThis;
|
|
2274
|
+
var toIntegerOrInfinity$4 = toIntegerOrInfinity$7;
|
|
2275
|
+
var toString$9 = toString$c;
|
|
2276
|
+
var requireObjectCoercible$5 = requireObjectCoercible$9;
|
|
2527
2277
|
|
|
2528
|
-
var $
|
|
2529
|
-
var
|
|
2278
|
+
var charAt$3 = uncurryThis$d(''.charAt);
|
|
2279
|
+
var charCodeAt = uncurryThis$d(''.charCodeAt);
|
|
2280
|
+
var stringSlice$5 = uncurryThis$d(''.slice);
|
|
2530
2281
|
|
|
2531
|
-
var
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2282
|
+
var createMethod = function (CONVERT_TO_STRING) {
|
|
2283
|
+
return function ($this, pos) {
|
|
2284
|
+
var S = toString$9(requireObjectCoercible$5($this));
|
|
2285
|
+
var position = toIntegerOrInfinity$4(pos);
|
|
2286
|
+
var size = S.length;
|
|
2287
|
+
var first, second;
|
|
2288
|
+
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
|
2289
|
+
first = charCodeAt(S, position);
|
|
2290
|
+
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
|
2291
|
+
|| (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
|
|
2292
|
+
? CONVERT_TO_STRING
|
|
2293
|
+
? charAt$3(S, position)
|
|
2294
|
+
: first
|
|
2295
|
+
: CONVERT_TO_STRING
|
|
2296
|
+
? stringSlice$5(S, position, position + 2)
|
|
2297
|
+
: (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
|
2298
|
+
};
|
|
2539
2299
|
};
|
|
2540
2300
|
|
|
2541
|
-
var
|
|
2301
|
+
var stringMultibyte = {
|
|
2302
|
+
// `String.prototype.codePointAt` method
|
|
2303
|
+
// https://tc39.es/ecma262/#sec-string.prototype.codepointat
|
|
2304
|
+
codeAt: createMethod(false),
|
|
2305
|
+
// `String.prototype.at` method
|
|
2306
|
+
// https://github.com/mathiasbynens/String.prototype.at
|
|
2307
|
+
charAt: createMethod(true)
|
|
2308
|
+
};
|
|
2542
2309
|
|
|
2543
|
-
var
|
|
2310
|
+
var charAt$2 = stringMultibyte.charAt;
|
|
2544
2311
|
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
return
|
|
2549
|
-
array,
|
|
2550
|
-
mergeSort(arraySlice$2(array, 0, middle), comparefn),
|
|
2551
|
-
mergeSort(arraySlice$2(array, middle), comparefn),
|
|
2552
|
-
comparefn
|
|
2553
|
-
);
|
|
2312
|
+
// `AdvanceStringIndex` abstract operation
|
|
2313
|
+
// https://tc39.es/ecma262/#sec-advancestringindex
|
|
2314
|
+
var advanceStringIndex$2 = function (S, index, unicode) {
|
|
2315
|
+
return index + (unicode ? charAt$2(S, index).length : 1);
|
|
2554
2316
|
};
|
|
2555
2317
|
|
|
2556
|
-
var
|
|
2557
|
-
|
|
2558
|
-
var i = 1;
|
|
2559
|
-
var element, j;
|
|
2318
|
+
var uncurryThis$c = functionUncurryThis;
|
|
2319
|
+
var toObject$3 = toObject$8;
|
|
2560
2320
|
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2321
|
+
var floor$2 = Math.floor;
|
|
2322
|
+
var charAt$1 = uncurryThis$c(''.charAt);
|
|
2323
|
+
var replace$1 = uncurryThis$c(''.replace);
|
|
2324
|
+
var stringSlice$4 = uncurryThis$c(''.slice);
|
|
2325
|
+
var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
|
|
2326
|
+
var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
|
|
2327
|
+
|
|
2328
|
+
// `GetSubstitution` abstract operation
|
|
2329
|
+
// https://tc39.es/ecma262/#sec-getsubstitution
|
|
2330
|
+
var getSubstitution$1 = function (matched, str, position, captures, namedCaptures, replacement) {
|
|
2331
|
+
var tailPos = position + matched.length;
|
|
2332
|
+
var m = captures.length;
|
|
2333
|
+
var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
|
|
2334
|
+
if (namedCaptures !== undefined) {
|
|
2335
|
+
namedCaptures = toObject$3(namedCaptures);
|
|
2336
|
+
symbols = SUBSTITUTION_SYMBOLS;
|
|
2337
|
+
}
|
|
2338
|
+
return replace$1(replacement, symbols, function (match, ch) {
|
|
2339
|
+
var capture;
|
|
2340
|
+
switch (charAt$1(ch, 0)) {
|
|
2341
|
+
case '$': return '$';
|
|
2342
|
+
case '&': return matched;
|
|
2343
|
+
case '`': return stringSlice$4(str, 0, position);
|
|
2344
|
+
case "'": return stringSlice$4(str, tailPos);
|
|
2345
|
+
case '<':
|
|
2346
|
+
capture = namedCaptures[stringSlice$4(ch, 1, -1)];
|
|
2347
|
+
break;
|
|
2348
|
+
default: // \d\d?
|
|
2349
|
+
var n = +ch;
|
|
2350
|
+
if (n === 0) return match;
|
|
2351
|
+
if (n > m) {
|
|
2352
|
+
var f = floor$2(n / 10);
|
|
2353
|
+
if (f === 0) return match;
|
|
2354
|
+
if (f <= m) return captures[f - 1] === undefined ? charAt$1(ch, 1) : captures[f - 1] + charAt$1(ch, 1);
|
|
2355
|
+
return match;
|
|
2356
|
+
}
|
|
2357
|
+
capture = captures[n - 1];
|
|
2566
2358
|
}
|
|
2567
|
-
|
|
2568
|
-
}
|
|
2359
|
+
return capture === undefined ? '' : capture;
|
|
2360
|
+
});
|
|
2569
2361
|
};
|
|
2570
2362
|
|
|
2571
|
-
var
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2363
|
+
var call$a = functionCall;
|
|
2364
|
+
var anObject$8 = anObject$f;
|
|
2365
|
+
var isCallable$8 = isCallable$o;
|
|
2366
|
+
var classof$4 = classofRaw$2;
|
|
2367
|
+
var regexpExec = regexpExec$2;
|
|
2576
2368
|
|
|
2577
|
-
|
|
2578
|
-
array[lindex + rindex] = (lindex < llength && rindex < rlength)
|
|
2579
|
-
? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
|
|
2580
|
-
: lindex < llength ? left[lindex++] : right[rindex++];
|
|
2581
|
-
} return array;
|
|
2582
|
-
};
|
|
2583
|
-
|
|
2584
|
-
var arraySort = mergeSort;
|
|
2585
|
-
|
|
2586
|
-
var userAgent$4 = engineUserAgent;
|
|
2587
|
-
|
|
2588
|
-
var firefox = userAgent$4.match(/firefox\/(\d+)/i);
|
|
2589
|
-
|
|
2590
|
-
var engineFfVersion = !!firefox && +firefox[1];
|
|
2591
|
-
|
|
2592
|
-
var UA = engineUserAgent;
|
|
2593
|
-
|
|
2594
|
-
var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
|
|
2595
|
-
|
|
2596
|
-
var userAgent$3 = engineUserAgent;
|
|
2597
|
-
|
|
2598
|
-
var webkit = userAgent$3.match(/AppleWebKit\/(\d+)\./);
|
|
2369
|
+
var $TypeError$9 = TypeError;
|
|
2599
2370
|
|
|
2600
|
-
|
|
2371
|
+
// `RegExpExec` abstract operation
|
|
2372
|
+
// https://tc39.es/ecma262/#sec-regexpexec
|
|
2373
|
+
var regexpExecAbstract = function (R, S) {
|
|
2374
|
+
var exec = R.exec;
|
|
2375
|
+
if (isCallable$8(exec)) {
|
|
2376
|
+
var result = call$a(exec, R, S);
|
|
2377
|
+
if (result !== null) anObject$8(result);
|
|
2378
|
+
return result;
|
|
2379
|
+
}
|
|
2380
|
+
if (classof$4(R) === 'RegExp') return call$a(regexpExec, R, S);
|
|
2381
|
+
throw $TypeError$9('RegExp#exec called on incompatible receiver');
|
|
2382
|
+
};
|
|
2601
2383
|
|
|
2602
|
-
var
|
|
2603
|
-
var
|
|
2604
|
-
var
|
|
2605
|
-
var
|
|
2606
|
-
var lengthOfArrayLike$4 = lengthOfArrayLike$8;
|
|
2607
|
-
var deletePropertyOrThrow = deletePropertyOrThrow$1;
|
|
2608
|
-
var toString$9 = toString$c;
|
|
2384
|
+
var apply$1 = functionApply;
|
|
2385
|
+
var call$9 = functionCall;
|
|
2386
|
+
var uncurryThis$b = functionUncurryThis;
|
|
2387
|
+
var fixRegExpWellKnownSymbolLogic$1 = fixRegexpWellKnownSymbolLogic;
|
|
2609
2388
|
var fails$9 = fails$r;
|
|
2610
|
-
var
|
|
2611
|
-
var
|
|
2612
|
-
var
|
|
2613
|
-
var
|
|
2614
|
-
var
|
|
2615
|
-
var
|
|
2616
|
-
|
|
2617
|
-
var
|
|
2618
|
-
var
|
|
2619
|
-
var
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
var FAILS_ON_UNDEFINED = fails$9(function () {
|
|
2623
|
-
test.sort(undefined);
|
|
2624
|
-
});
|
|
2625
|
-
// V8 bug
|
|
2626
|
-
var FAILS_ON_NULL = fails$9(function () {
|
|
2627
|
-
test.sort(null);
|
|
2628
|
-
});
|
|
2629
|
-
// Old WebKit
|
|
2630
|
-
var STRICT_METHOD = arrayMethodIsStrict('sort');
|
|
2631
|
-
|
|
2632
|
-
var STABLE_SORT = !fails$9(function () {
|
|
2633
|
-
// feature detection can be too slow, so check engines versions
|
|
2634
|
-
if (V8) return V8 < 70;
|
|
2635
|
-
if (FF && FF > 3) return;
|
|
2636
|
-
if (IE_OR_EDGE) return true;
|
|
2637
|
-
if (WEBKIT) return WEBKIT < 603;
|
|
2389
|
+
var anObject$7 = anObject$f;
|
|
2390
|
+
var isCallable$7 = isCallable$o;
|
|
2391
|
+
var isNullOrUndefined$3 = isNullOrUndefined$6;
|
|
2392
|
+
var toIntegerOrInfinity$3 = toIntegerOrInfinity$7;
|
|
2393
|
+
var toLength$2 = toLength$4;
|
|
2394
|
+
var toString$8 = toString$c;
|
|
2395
|
+
var requireObjectCoercible$4 = requireObjectCoercible$9;
|
|
2396
|
+
var advanceStringIndex$1 = advanceStringIndex$2;
|
|
2397
|
+
var getMethod$3 = getMethod$5;
|
|
2398
|
+
var getSubstitution = getSubstitution$1;
|
|
2399
|
+
var regExpExec$1 = regexpExecAbstract;
|
|
2400
|
+
var wellKnownSymbol$9 = wellKnownSymbol$j;
|
|
2638
2401
|
|
|
2639
|
-
|
|
2640
|
-
|
|
2402
|
+
var REPLACE = wellKnownSymbol$9('replace');
|
|
2403
|
+
var max$1 = Math.max;
|
|
2404
|
+
var min$1 = Math.min;
|
|
2405
|
+
var concat = uncurryThis$b([].concat);
|
|
2406
|
+
var push$1 = uncurryThis$b([].push);
|
|
2407
|
+
var stringIndexOf$1 = uncurryThis$b(''.indexOf);
|
|
2408
|
+
var stringSlice$3 = uncurryThis$b(''.slice);
|
|
2641
2409
|
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2410
|
+
var maybeToString = function (it) {
|
|
2411
|
+
return it === undefined ? it : String(it);
|
|
2412
|
+
};
|
|
2645
2413
|
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2414
|
+
// IE <= 11 replaces $0 with the whole match, as if it was $&
|
|
2415
|
+
// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
|
|
2416
|
+
var REPLACE_KEEPS_$0 = (function () {
|
|
2417
|
+
// eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
|
|
2418
|
+
return 'a'.replace(/./, '$0') === '$0';
|
|
2419
|
+
})();
|
|
2651
2420
|
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2421
|
+
// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
|
|
2422
|
+
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
|
|
2423
|
+
if (/./[REPLACE]) {
|
|
2424
|
+
return /./[REPLACE]('a', '$0') === '';
|
|
2655
2425
|
}
|
|
2426
|
+
return false;
|
|
2427
|
+
})();
|
|
2656
2428
|
|
|
2657
|
-
|
|
2429
|
+
var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$9(function () {
|
|
2430
|
+
var re = /./;
|
|
2431
|
+
re.exec = function () {
|
|
2432
|
+
var result = [];
|
|
2433
|
+
result.groups = { a: '7' };
|
|
2434
|
+
return result;
|
|
2435
|
+
};
|
|
2436
|
+
// eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
|
|
2437
|
+
return ''.replace(re, '$<a>') !== '7';
|
|
2438
|
+
});
|
|
2658
2439
|
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
}
|
|
2440
|
+
// @@replace logic
|
|
2441
|
+
fixRegExpWellKnownSymbolLogic$1('replace', function (_, nativeReplace, maybeCallNative) {
|
|
2442
|
+
var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
|
|
2663
2443
|
|
|
2664
|
-
return
|
|
2665
|
-
|
|
2444
|
+
return [
|
|
2445
|
+
// `String.prototype.replace` method
|
|
2446
|
+
// https://tc39.es/ecma262/#sec-string.prototype.replace
|
|
2447
|
+
function replace(searchValue, replaceValue) {
|
|
2448
|
+
var O = requireObjectCoercible$4(this);
|
|
2449
|
+
var replacer = isNullOrUndefined$3(searchValue) ? undefined : getMethod$3(searchValue, REPLACE);
|
|
2450
|
+
return replacer
|
|
2451
|
+
? call$9(replacer, searchValue, O, replaceValue)
|
|
2452
|
+
: call$9(nativeReplace, toString$8(O), searchValue, replaceValue);
|
|
2453
|
+
},
|
|
2454
|
+
// `RegExp.prototype[@@replace]` method
|
|
2455
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
|
|
2456
|
+
function (string, replaceValue) {
|
|
2457
|
+
var rx = anObject$7(this);
|
|
2458
|
+
var S = toString$8(string);
|
|
2666
2459
|
|
|
2667
|
-
|
|
2460
|
+
if (
|
|
2461
|
+
typeof replaceValue == 'string' &&
|
|
2462
|
+
stringIndexOf$1(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
|
|
2463
|
+
stringIndexOf$1(replaceValue, '$<') === -1
|
|
2464
|
+
) {
|
|
2465
|
+
var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
|
|
2466
|
+
if (res.done) return res.value;
|
|
2467
|
+
}
|
|
2668
2468
|
|
|
2669
|
-
var
|
|
2670
|
-
|
|
2671
|
-
if (y === undefined) return -1;
|
|
2672
|
-
if (x === undefined) return 1;
|
|
2673
|
-
if (comparefn !== undefined) return +comparefn(x, y) || 0;
|
|
2674
|
-
return toString$9(x) > toString$9(y) ? 1 : -1;
|
|
2675
|
-
};
|
|
2676
|
-
};
|
|
2469
|
+
var functionalReplace = isCallable$7(replaceValue);
|
|
2470
|
+
if (!functionalReplace) replaceValue = toString$8(replaceValue);
|
|
2677
2471
|
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2472
|
+
var global = rx.global;
|
|
2473
|
+
if (global) {
|
|
2474
|
+
var fullUnicode = rx.unicode;
|
|
2475
|
+
rx.lastIndex = 0;
|
|
2476
|
+
}
|
|
2477
|
+
var results = [];
|
|
2478
|
+
while (true) {
|
|
2479
|
+
var result = regExpExec$1(rx, S);
|
|
2480
|
+
if (result === null) break;
|
|
2683
2481
|
|
|
2684
|
-
|
|
2482
|
+
push$1(results, result);
|
|
2483
|
+
if (!global) break;
|
|
2685
2484
|
|
|
2686
|
-
|
|
2485
|
+
var matchStr = toString$8(result[0]);
|
|
2486
|
+
if (matchStr === '') rx.lastIndex = advanceStringIndex$1(S, toLength$2(rx.lastIndex), fullUnicode);
|
|
2487
|
+
}
|
|
2687
2488
|
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2489
|
+
var accumulatedResult = '';
|
|
2490
|
+
var nextSourcePosition = 0;
|
|
2491
|
+
for (var i = 0; i < results.length; i++) {
|
|
2492
|
+
result = results[i];
|
|
2691
2493
|
|
|
2692
|
-
|
|
2693
|
-
|
|
2494
|
+
var matched = toString$8(result[0]);
|
|
2495
|
+
var position = max$1(min$1(toIntegerOrInfinity$3(result.index), S.length), 0);
|
|
2496
|
+
var captures = [];
|
|
2497
|
+
// NOTE: This is equivalent to
|
|
2498
|
+
// captures = result.slice(1).map(maybeToString)
|
|
2499
|
+
// but for some reason `nativeSlice.call(result, 1, result.length)` (called in
|
|
2500
|
+
// the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
|
|
2501
|
+
// causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
|
|
2502
|
+
for (var j = 1; j < result.length; j++) push$1(captures, maybeToString(result[j]));
|
|
2503
|
+
var namedCaptures = result.groups;
|
|
2504
|
+
if (functionalReplace) {
|
|
2505
|
+
var replacerArgs = concat([matched], captures, position, S);
|
|
2506
|
+
if (namedCaptures !== undefined) push$1(replacerArgs, namedCaptures);
|
|
2507
|
+
var replacement = toString$8(apply$1(replaceValue, undefined, replacerArgs));
|
|
2508
|
+
} else {
|
|
2509
|
+
replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
|
|
2510
|
+
}
|
|
2511
|
+
if (position >= nextSourcePosition) {
|
|
2512
|
+
accumulatedResult += stringSlice$3(S, nextSourcePosition, position) + replacement;
|
|
2513
|
+
nextSourcePosition = position + matched.length;
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2516
|
+
return accumulatedResult + stringSlice$3(S, nextSourcePosition);
|
|
2694
2517
|
}
|
|
2518
|
+
];
|
|
2519
|
+
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
|
|
2695
2520
|
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2521
|
+
const currencySymbol = {
|
|
2522
|
+
aud: "$",
|
|
2523
|
+
cad: "$",
|
|
2524
|
+
eur: "€",
|
|
2525
|
+
gbp: "£",
|
|
2526
|
+
nzd: "$",
|
|
2527
|
+
usd: "$"
|
|
2528
|
+
};
|
|
2529
|
+
const formatMoney = (value, locale = "en-US") => {
|
|
2530
|
+
const currency = Intl.NumberFormat(locale, {
|
|
2531
|
+
currency: value.currency,
|
|
2532
|
+
style: "currency"
|
|
2533
|
+
});
|
|
2534
|
+
return currency.format(value.amount);
|
|
2535
|
+
};
|
|
2536
|
+
const calculateTotal = (...values) => {
|
|
2537
|
+
return values.reduce((total, value) => {
|
|
2538
|
+
var _a;
|
|
2539
|
+
return value ? total + ((_a = value.amount) !== null && _a !== void 0 ? _a : 0) : total;
|
|
2540
|
+
}, 0);
|
|
2541
|
+
};
|
|
2542
|
+
const formatCreditCardNumber = cc => [cc.substring(0, 4), cc.substring(4, 8), cc.substring(8, 12), cc.substring(12)].join(" ").trim();
|
|
2543
|
+
const formatExpiration = exp => {
|
|
2544
|
+
const digits = exp.replace(/\//g, "");
|
|
2545
|
+
if (digits.length > 2) return [digits.substring(0, 2), digits.substring(2, 6)].join("/").trim();
|
|
2546
|
+
return digits;
|
|
2547
|
+
};
|
|
2700
2548
|
|
|
2701
|
-
|
|
2702
|
-
while (index < arrayLength) deletePropertyOrThrow(array, index++);
|
|
2549
|
+
const isString = x => typeof x === "string";
|
|
2703
2550
|
|
|
2704
|
-
|
|
2551
|
+
const getRateRequiresAcknowledgement = serviceCode => {
|
|
2552
|
+
switch (serviceCode) {
|
|
2553
|
+
case "usps_media_mail":
|
|
2554
|
+
return true;
|
|
2555
|
+
default:
|
|
2556
|
+
return false;
|
|
2705
2557
|
}
|
|
2706
|
-
}
|
|
2558
|
+
};
|
|
2559
|
+
const getTotalRateAmount = (rateCosts = {}) => calculateTotal(...Object.values(rateCosts));
|
|
2707
2560
|
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
const getPendingShipment = shipments => shipments === null || shipments === void 0 ? void 0 : shipments.filter(s => s.shipmentStatus === "pending").sort(sortByCreationDate)[0];
|
|
2726
|
-
|
|
2727
|
-
function convertWeight(weight) {
|
|
2728
|
-
if ("value" in weight) {
|
|
2729
|
-
const valueAsLbs = weight.value / 16;
|
|
2730
|
-
return {
|
|
2731
|
-
fractional: (valueAsLbs - Math.floor(valueAsLbs)) * 16,
|
|
2732
|
-
whole: Math.floor(valueAsLbs)
|
|
2733
|
-
};
|
|
2561
|
+
// Declaring these flags to allow shorthand object syntax, i.e. { flagName } instead of { flagName: true }
|
|
2562
|
+
const hasEuCustomsRules = true,
|
|
2563
|
+
hasProvinces = true,
|
|
2564
|
+
isMilitary = true,
|
|
2565
|
+
// United States territories that ship domestic but require customs
|
|
2566
|
+
// https://blog.stamps.com/2015/09/23/how-to-ship-packages-to-u-s-territories/
|
|
2567
|
+
isUnitedStatesTerritory$1 = true,
|
|
2568
|
+
supportsByoa = true;
|
|
2569
|
+
class Country {
|
|
2570
|
+
constructor(name, code, rules = {}) {
|
|
2571
|
+
var _a, _b, _c, _d;
|
|
2572
|
+
this.name = name;
|
|
2573
|
+
this.code = code;
|
|
2574
|
+
this.hasEuCustomsRules = (_a = rules.hasEuCustomsRules) !== null && _a !== void 0 ? _a : false;
|
|
2575
|
+
this.hasProvinces = (_b = rules.hasProvinces) !== null && _b !== void 0 ? _b : false;
|
|
2576
|
+
this.isUnitedStatesTerritory = (_c = rules.isUnitedStatesTerritory) !== null && _c !== void 0 ? _c : false;
|
|
2577
|
+
this.supportsByoa = (_d = rules.supportsByoa) !== null && _d !== void 0 ? _d : false;
|
|
2734
2578
|
}
|
|
2735
|
-
return {
|
|
2736
|
-
unit: "ounce",
|
|
2737
|
-
value: (weight.whole || 0) * 16 + (weight.fractional || 0)
|
|
2738
|
-
};
|
|
2739
2579
|
}
|
|
2580
|
+
const countries = [new Country("Afghanistan", "AF"), new Country("Aland Islands", "AX"), new Country("Albania", "AL"), new Country("Algeria", "DZ"), new Country("American Samoa", "AS", {
|
|
2581
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2582
|
+
}), 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", {
|
|
2583
|
+
hasProvinces,
|
|
2584
|
+
supportsByoa
|
|
2585
|
+
}), new Country("Austria", "AT", {
|
|
2586
|
+
hasEuCustomsRules,
|
|
2587
|
+
supportsByoa
|
|
2588
|
+
}), new Country("Azerbaijan", "AZ"), new Country("Bahamas", "BS"), new Country("Bahrain", "BH"), new Country("Bangladesh", "BD"), new Country("Barbados", "BB"), new Country("Belarus", "BY"), new Country("Belgium", "BE", {
|
|
2589
|
+
hasEuCustomsRules,
|
|
2590
|
+
supportsByoa
|
|
2591
|
+
}), new Country("Belize", "BZ"), new Country("Benin", "BJ"), new Country("Bermuda", "BM"), new Country("Bhutan", "BT"), new Country("Bolivia", "BO"), new Country("Bonaire, Sint Eustatius And Saba", "BQ"), new Country("Bosnia and Herzegovina", "BA"), new Country("Botswana", "BW"), new Country("Brazil", "BR", {
|
|
2592
|
+
hasProvinces
|
|
2593
|
+
}), new Country("British Indian Ocean Territory", "IO"), new Country("British Virgin Islands", "VG"), new Country("Brunei Darussalam", "BN"), new Country("Bulgaria", "BG", {
|
|
2594
|
+
hasEuCustomsRules,
|
|
2595
|
+
supportsByoa
|
|
2596
|
+
}), new Country("Burkina Faso", "BF"), new Country("Burundi", "BI"), new Country("Canada", "CA", {
|
|
2597
|
+
hasProvinces
|
|
2598
|
+
}), new Country("Cambodia", "KH"), new Country("Cameroon", "CM"), new Country("Cape Verde Islands", "CV"), new Country("Cayman Islands", "KY"), new Country("Central African Republic", "CF"), new Country("Chad", "TD"), new Country("Chile", "CL"), new Country("China", "CN"), new Country("Christmas Island", "CX"), new Country("Cocos(Keeling) Islands", "CC"), new Country("Colombia", "CO"), new Country("Comoros", "KM"), new Country("Congo", "CG"), new Country("Congo, The Democratic Republic of", "CD"), new Country("Cook Islands", "CK"), new Country("Costa Rica", "CR"), new Country("Croatia", "HR", {
|
|
2599
|
+
hasEuCustomsRules,
|
|
2600
|
+
supportsByoa
|
|
2601
|
+
}), new Country("Cuba", "CU"), new Country("Curacao", "CW"), new Country("Cyprus", "CY", {
|
|
2602
|
+
hasEuCustomsRules,
|
|
2603
|
+
supportsByoa
|
|
2604
|
+
}), new Country("Czech Republic", "CZ", {
|
|
2605
|
+
hasEuCustomsRules,
|
|
2606
|
+
supportsByoa
|
|
2607
|
+
}), new Country("Denmark", "DK", {
|
|
2608
|
+
hasEuCustomsRules,
|
|
2609
|
+
supportsByoa
|
|
2610
|
+
}), new Country("Djibouti", "DJ"), new Country("Dominica", "DM"), new Country("Dominican Republic", "DO"), new Country("Ecuador", "EC"), new Country("Egypt", "EG"), new Country("El Salvador", "SV"), new Country("Equatorial Guinea", "GQ"), new Country("Eritrea", "ER"), new Country("Estonia", "EE", {
|
|
2611
|
+
hasEuCustomsRules,
|
|
2612
|
+
supportsByoa
|
|
2613
|
+
}), new Country("Ethiopia", "ET"), new Country("Falkland Islands", "FK"), new Country("Faroe Islands", "FO"), new Country("Federated States of Micronesia", "FM", {
|
|
2614
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2615
|
+
}), new Country("Fiji", "FJ"), new Country("Finland", "FI", {
|
|
2616
|
+
hasEuCustomsRules,
|
|
2617
|
+
supportsByoa
|
|
2618
|
+
}), new Country("France", "FR", {
|
|
2619
|
+
hasEuCustomsRules,
|
|
2620
|
+
supportsByoa
|
|
2621
|
+
}), new Country("French Guiana", "GF"), new Country("French Polynesia", "PF"), new Country("French Southern Territories", "TF"), new Country("Gabon", "GA"), new Country("Gambia", "GM"), new Country("Georgia", "GE"), new Country("Germany", "DE", {
|
|
2622
|
+
hasEuCustomsRules,
|
|
2623
|
+
supportsByoa
|
|
2624
|
+
}), new Country("Ghana", "GH"), new Country("Gibraltar", "GI"), new Country("Greece", "GR", {
|
|
2625
|
+
hasEuCustomsRules,
|
|
2626
|
+
supportsByoa
|
|
2627
|
+
}), new Country("Greenland", "GL"), new Country("Grenada", "GD"), new Country("Guadeloupe", "GP"), new Country("Guam", "GU", {
|
|
2628
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2629
|
+
}), new Country("Guatemala", "GT"), new Country("Guernsey", "GG"), new Country("Guinea", "GN"), new Country("Guinea - Bissau", "GW"), new Country("Guyana", "GY"), new Country("Haiti", "HT"), new Country("Holy See", "VA"), new Country("Honduras", "HN"), new Country("Hong Kong", "HK"), new Country("Hungary", "HU", {
|
|
2630
|
+
hasEuCustomsRules,
|
|
2631
|
+
supportsByoa
|
|
2632
|
+
}), new Country("Iceland", "IS"), new Country("India", "IN"), new Country("Indonesia", "ID"), new Country("Iran", "IR"), new Country("Iraq", "IQ"), new Country("Ireland", "IE", {
|
|
2633
|
+
hasEuCustomsRules,
|
|
2634
|
+
supportsByoa
|
|
2635
|
+
}), new Country("Isle of Man", "IM"), new Country("Israel", "IL"), new Country("Italy", "IT", {
|
|
2636
|
+
hasEuCustomsRules,
|
|
2637
|
+
supportsByoa
|
|
2638
|
+
}), new Country("Ivory Coast", "CI"), new Country("Jamaica", "JM"), new Country("Japan", "JP", {
|
|
2639
|
+
hasProvinces
|
|
2640
|
+
}), new Country("Jersey", "JE"), new Country("Jordan", "JO"), new Country("Kazakhstan", "KZ"), new Country("Kenya", "KE"), new Country("Kiribati", "KI"), new Country("Korea, Republic of", "KR"), new Country("Kuwait", "KW"), new Country("Kyrgyzstan", "KG"), new Country("Laos", "LA"), new Country("Latvia", "LV", {
|
|
2641
|
+
hasEuCustomsRules,
|
|
2642
|
+
supportsByoa
|
|
2643
|
+
}), new Country("Lebanon", "LB"), new Country("Lesotho", "LS"), new Country("Liberia", "LR"), new Country("Libya", "LY"), new Country("Liechtenstein", "LI"), new Country("Lithuania", "LT", {
|
|
2644
|
+
hasEuCustomsRules,
|
|
2645
|
+
supportsByoa
|
|
2646
|
+
}), new Country("Luxembourg", "LU", {
|
|
2647
|
+
hasEuCustomsRules,
|
|
2648
|
+
supportsByoa
|
|
2649
|
+
}), new Country("Macao", "MO"), new Country("Macedonia", "MK"), new Country("Madagascar", "MG"), new Country("Malawi", "MW"), new Country("Malaysia", "MY"), new Country("Maldives", "MV"), new Country("Mali", "ML"), new Country("Malta", "MT", {
|
|
2650
|
+
hasEuCustomsRules,
|
|
2651
|
+
supportsByoa
|
|
2652
|
+
}), new Country("Marshall Islands", "MH", {
|
|
2653
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2654
|
+
}), new Country("Martinique", "MQ"), new Country("Mauritania", "MR"), new Country("Mauritius0", "MU"), new Country("Mayotte", "YT"), new Country("Mexico", "MX", {
|
|
2655
|
+
supportsByoa
|
|
2656
|
+
}), new Country("Moldova", "MD"), new Country("Monaco", "MC"), new Country("Mongolia", "MN"), new Country("Montenegro", "ME"), new Country("Montserrat", "MS"), new Country("Morocco", "MA"), new Country("Mozambique", "MZ"), new Country("Myanmar", "MM"), new Country("Namibia", "NA"), new Country("Nauru", "NR"), new Country("Nepal", "NP"), new Country("Netherlands", "NL", {
|
|
2657
|
+
hasEuCustomsRules,
|
|
2658
|
+
supportsByoa
|
|
2659
|
+
}), new Country("Netherlands Antilles", "AN"), new Country("New Caledonia", "NC"), new Country("New Zealand", "NZ", {
|
|
2660
|
+
supportsByoa
|
|
2661
|
+
}), new Country("Nicaragua", "NI"), new Country("Niger", "NE"), new Country("Nigeria", "NG"), new Country("Niue", "NU"), new Country("Norfolk Island", "NF"), new Country("North Korea", "KP"), new Country("Northern Mariana Islands", "MP", {
|
|
2662
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2663
|
+
}), new Country("Norway", "NO", {
|
|
2664
|
+
hasEuCustomsRules
|
|
2665
|
+
}), new Country("Oman", "OM"), new Country("Pakistan", "PK"), new Country("Palau", "PW", {
|
|
2666
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2667
|
+
}), new Country("Palestinian Territory", "PS"), new Country("Panama", "PA"), new Country("Papua New Guinea", "PG"), new Country("Paraguay", "PY"), new Country("Peru", "PE"), new Country("Philippines", "PH"), new Country("Pitcairn Island", "PN"), new Country("Poland", "PL", {
|
|
2668
|
+
hasEuCustomsRules
|
|
2669
|
+
}), new Country("Portugal", "PT", {
|
|
2670
|
+
hasEuCustomsRules,
|
|
2671
|
+
supportsByoa
|
|
2672
|
+
}),
|
|
2673
|
+
// TODO - Puerto Rico is a US territory but there are some funky rules with USPS that need to be addressed
|
|
2674
|
+
new Country("Puerto Rico", "PR", {
|
|
2675
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1,
|
|
2676
|
+
supportsByoa
|
|
2677
|
+
}), new Country("Qatar", "QA"), new Country("Reunion", "RE"), new Country("Romania", "RO", {
|
|
2678
|
+
hasEuCustomsRules,
|
|
2679
|
+
supportsByoa
|
|
2680
|
+
}), new Country("Russia", "RU"), new Country("Rwanda", "RW"), new Country("Saint Barthelemy", "BL"), new Country("Saint Helena", "SH"), new Country("Saint Kitts and Nevis", "KN"), new Country("Saint Lucia", "LC"), new Country("Saint Martin", "MF"), new Country("Saint Pierre and Miquelon", "PM"), new Country("Saint Vincent & the Grenadines", "VC"), new Country("Samoa", "WS"), new Country("San Marino", "SM"), new Country("Sao Tome and Principe", "ST"), new Country("Saudi Arabia", "SA"), new Country("Senegal", "SN"), new Country("Serbia", "RS"), new Country("Seychelles", "SC"), new Country("Sierra Leone", "SL"), new Country("Singapore", "SG"), new Country("Sint Maarten(Dutch)", "SX"), new Country("Slovakia", "SK", {
|
|
2681
|
+
hasEuCustomsRules,
|
|
2682
|
+
supportsByoa
|
|
2683
|
+
}), new Country("Slovenia", "SI", {
|
|
2684
|
+
hasEuCustomsRules,
|
|
2685
|
+
supportsByoa
|
|
2686
|
+
}), new Country("Solomon Islands", "SB"), new Country("Somalia", "SO"), new Country("South Africa", "ZA"), new Country("South Georgia & the South Sandwich Islands", "GS"), new Country("South Sudan", "SS"), new Country("Spain", "ES", {
|
|
2687
|
+
hasEuCustomsRules,
|
|
2688
|
+
supportsByoa
|
|
2689
|
+
}), new Country("Sri Lanka", "LK"), new Country("Sudan", "SD"), new Country("Suriname", "SR"), new Country("Svalbard & Jan Mayen Islands", "SJ"), new Country("Swaziland", "SZ"), new Country("Sweden", "SE", {
|
|
2690
|
+
hasEuCustomsRules,
|
|
2691
|
+
supportsByoa
|
|
2692
|
+
}), new Country("Switzerland", "CH", {
|
|
2693
|
+
hasEuCustomsRules
|
|
2694
|
+
}), new Country("Syria", "SY"), new Country("Taiwan", "TW"), new Country("Tajikistan", "TJ"), new Country("Tanzania", "TZ"), new Country("Thailand", "TH"), new Country("Timor - Leste(formerly East Timor)", "TL"), new Country("Togo", "TG"), new Country("Tokelau", "TK"), new Country("Tonga", "TO"), new Country("Trinidad and Tobago", "TT"), new Country("Tunisia", "TN"), new Country("Turkey", "TR"), new Country("Turkmenistan", "TM"), new Country("Turks and Caicos Islands", "TC"), new Country("Tuvalu", "TV"), new Country("Uganda", "UG"), new Country("Ukraine", "UA"), new Country("United Arab Emirates", "AE"), new Country("United Kingdom", "GB", {
|
|
2695
|
+
supportsByoa
|
|
2696
|
+
}), new Country("United States Virgin Islands", "VI", {
|
|
2697
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2698
|
+
}), new Country("U.S. Minor Outlying Islands", "UM", {
|
|
2699
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2700
|
+
}), new Country("United States of America", "US", {
|
|
2701
|
+
hasProvinces,
|
|
2702
|
+
supportsByoa
|
|
2703
|
+
}), 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")];
|
|
2704
|
+
const countryCodes = countries.map(c => c.code);
|
|
2705
|
+
const euCountryCodes = countries.filter(c => c.hasEuCustomsRules).map(c => c.code);
|
|
2706
|
+
// #endregion
|
|
2707
|
+
// #region [ rgba(0,0,0,0) ] Postal Codes
|
|
2708
|
+
const postalCodeRegex$3 = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
|
|
2709
|
+
class UsState {
|
|
2710
|
+
constructor(name, code, rules = {}) {
|
|
2711
|
+
var _a, _b;
|
|
2712
|
+
this.name = name;
|
|
2713
|
+
this.code = code;
|
|
2714
|
+
this.isMilitary = (_a = rules.isMilitary) !== null && _a !== void 0 ? _a : false;
|
|
2715
|
+
this.isUnitedStatesTerritory = (_b = rules.isUnitedStatesTerritory) !== null && _b !== void 0 ? _b : false;
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
const usStates = [new UsState("Alabama", "AL"), new UsState("Alaska", "AK"), new UsState("American Samoa", "AS", {
|
|
2719
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2720
|
+
}), new UsState("Arizona", "AZ"), new UsState("Arkansas", "AR"), new UsState("Armed Forces Americas", "AA", {
|
|
2721
|
+
isMilitary
|
|
2722
|
+
}), new UsState("Armed Forces Europe", "AE", {
|
|
2723
|
+
isMilitary
|
|
2724
|
+
}), new UsState("Armed Forces Pacific", "AP", {
|
|
2725
|
+
isMilitary
|
|
2726
|
+
}), new UsState("California", "CA"), new UsState("Colorado", "CO"), new UsState("Connecticut", "CT"), new UsState("Delaware", "DE"), new UsState("District of Columbia", "DC"), new UsState("Florida", "FL"), new UsState("Georgia", "GA"), new UsState("Guam", "GU", {
|
|
2727
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2728
|
+
}), new UsState("Hawaii", "HI"), new UsState("Idaho", "ID"), new UsState("Illinois", "IL"), new UsState("Indiana", "IN"), new UsState("Iowa", "IA"), new UsState("Kansas", "KS"), new UsState("Kentucky", "KY"), new UsState("Louisiana", "LA"), new UsState("Maine", "ME"), new UsState("Maryland", "MD"), new UsState("Massachusetts", "MA"), new UsState("Michigan", "MI"), new UsState("Minnesota", "MN"), new UsState("Mississippi", "MS"), new UsState("Missouri", "MO"), new UsState("Montana", "MT"), new UsState("Nebraska", "NE"), new UsState("Nevada", "NV"), new UsState("New Hampshire", "NH"), new UsState("New Jersey", "NJ"), new UsState("New Mexico", "NM"), new UsState("New York", "NY"), new UsState("North Carolina", "NC"), new UsState("North Dakota", "ND"), new UsState("Ohio", "OH"), new UsState("Oklahoma", "OK"), new UsState("Oregon", "OR"), new UsState("Pennsylvania", "PA"), new UsState("Puerto Rico", "PR", {
|
|
2729
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2730
|
+
}), new UsState("Rhode Island", "RI"), new UsState("South Carolina", "SC"), new UsState("South Dakota", "SD"), new UsState("Tennessee", "TN"), new UsState("Texas", "TX"), new UsState("Utah", "UT"), new UsState("Vermont", "VT"), new UsState("Virgin Islands", "VI", {
|
|
2731
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2732
|
+
}), new UsState("Virginia", "VA"), new UsState("Washington", "WA"), new UsState("West Virginia", "WV"), new UsState("Wisconsin", "WI"), new UsState("Wyoming", "WY"), new UsState("Northern Mariana Islands", "MP", {
|
|
2733
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2734
|
+
}), new UsState("U.S. Minor Outlying Islands", "UM", {
|
|
2735
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2736
|
+
})];
|
|
2737
|
+
const usStateCodes = usStates.map(item => item.code);
|
|
2738
|
+
class UsaCity {
|
|
2739
|
+
constructor(name, code, rules = {}) {
|
|
2740
|
+
var _a;
|
|
2741
|
+
this.name = name;
|
|
2742
|
+
this.code = code;
|
|
2743
|
+
this.isMilitary = (_a = rules.isMilitary) !== null && _a !== void 0 ? _a : false;
|
|
2744
|
+
}
|
|
2745
|
+
}
|
|
2746
|
+
const usCities = [new UsaCity("Army Post Office", "APO", {
|
|
2747
|
+
isMilitary
|
|
2748
|
+
}), new UsaCity("Diplomatic Post Office", "DPO", {
|
|
2749
|
+
isMilitary
|
|
2750
|
+
}), new UsaCity("Fleet Post Office", "FPO", {
|
|
2751
|
+
isMilitary
|
|
2752
|
+
})];
|
|
2753
|
+
// #endregion
|
|
2754
|
+
|
|
2740
2755
|
/**
|
|
2741
2756
|
* @category Utilities
|
|
2742
2757
|
*/
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2758
|
+
const isDomesticAddress = address => {
|
|
2759
|
+
var _a;
|
|
2760
|
+
return address.countryCode === "US" || ((_a = countries.find(c => c.code === address.countryCode)) === null || _a === void 0 ? void 0 : _a.isUnitedStatesTerritory);
|
|
2761
|
+
};
|
|
2762
|
+
/**
|
|
2763
|
+
* @category Utilities
|
|
2764
|
+
*/
|
|
2765
|
+
const isMilitaryAddress = address => {
|
|
2766
|
+
var _a, _b;
|
|
2767
|
+
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));
|
|
2768
|
+
};
|
|
2769
|
+
/**
|
|
2770
|
+
* @category Utilities
|
|
2771
|
+
*/
|
|
2772
|
+
const isUnitedStatesTerritory = address => {
|
|
2773
|
+
var _a, _b;
|
|
2774
|
+
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));
|
|
2775
|
+
};
|
|
2776
|
+
const PO_BOX_REGEX =
|
|
2777
|
+
// eslint-disable-next-line no-useless-escape
|
|
2778
|
+
/^(((p[\s\.\'\,]?[o\s][\.\'\,]?)\s?)|(post\s?office\s?))((box|bin|bo|b\.?)?\s?(num|number|#)?\s?\d+)/i;
|
|
2779
|
+
/**
|
|
2780
|
+
* @category Utilities
|
|
2781
|
+
*/
|
|
2782
|
+
const isPoBox = addressLine => PO_BOX_REGEX.test(addressLine);
|
|
2783
|
+
/**
|
|
2784
|
+
* @category Utilities
|
|
2785
|
+
*/
|
|
2786
|
+
const isPoBoxAddress = address => !!(isPoBox(address.addressLine1) || address.addressLine2 && isPoBox(address.addressLine2));
|
|
2755
2787
|
|
|
2756
|
-
var
|
|
2757
|
-
var
|
|
2758
|
-
var
|
|
2788
|
+
var $$g = _export;
|
|
2789
|
+
var $includes = arrayIncludes.includes;
|
|
2790
|
+
var fails$8 = fails$r;
|
|
2791
|
+
var addToUnscopables$2 = addToUnscopables$4;
|
|
2792
|
+
|
|
2793
|
+
// FF99+ bug
|
|
2794
|
+
var BROKEN_ON_SPARSE = fails$8(function () {
|
|
2795
|
+
return !Array(1).includes();
|
|
2796
|
+
});
|
|
2759
2797
|
|
|
2760
|
-
|
|
2798
|
+
// `Array.prototype.includes` method
|
|
2799
|
+
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
2800
|
+
$$g({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
|
|
2801
|
+
includes: function includes(el /* , fromIndex = 0 */) {
|
|
2802
|
+
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
2803
|
+
}
|
|
2804
|
+
});
|
|
2761
2805
|
|
|
2762
|
-
//
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2806
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
2807
|
+
addToUnscopables$2('includes');
|
|
2808
|
+
|
|
2809
|
+
const USPS_CARRIER_CODES = ["usps", "stamps_com"];
|
|
2810
|
+
const isUspsCarrier = carrierCode => USPS_CARRIER_CODES.includes(carrierCode);
|
|
2811
|
+
|
|
2812
|
+
function convertDimensions(dimensions, {
|
|
2813
|
+
allowAllZeroes
|
|
2814
|
+
} = {}) {
|
|
2815
|
+
if ("unit" in dimensions) {
|
|
2816
|
+
const dims = __rest(dimensions, ["unit"]);
|
|
2817
|
+
const hasAllZeroes = Object.values(dims).every(d => d === 0);
|
|
2818
|
+
return hasAllZeroes && !allowAllZeroes ? undefined : dims;
|
|
2819
|
+
}
|
|
2820
|
+
return Object.assign(Object.assign({}, dimensions), {
|
|
2821
|
+
unit: "inch"
|
|
2822
|
+
});
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
/**
|
|
2826
|
+
* @category Utilities
|
|
2827
|
+
*/
|
|
2828
|
+
const getCustomsFromSalesOrder = (salesOrder, warehouse) => ({
|
|
2829
|
+
contents: "merchandise",
|
|
2830
|
+
customsItems: salesOrder.salesOrderItems.filter(item => item.lineItemDetails.name.length > 0).map(item => ({
|
|
2831
|
+
countryOfOrigin: warehouse.originAddress.countryCode,
|
|
2832
|
+
description: item.lineItemDetails.name,
|
|
2833
|
+
quantity: item.quantity,
|
|
2834
|
+
value: item.priceSummary.unitPrice.amount
|
|
2835
|
+
})),
|
|
2836
|
+
nonDelivery: "return_to_sender"
|
|
2837
|
+
});
|
|
2838
|
+
/**
|
|
2839
|
+
* @category Utilities
|
|
2840
|
+
*/
|
|
2841
|
+
const getIsCustomsRequiredForSalesOrder = ({
|
|
2842
|
+
shipTo
|
|
2843
|
+
}, {
|
|
2844
|
+
originAddress
|
|
2845
|
+
}) => 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);
|
|
2846
|
+
/**
|
|
2847
|
+
* @category Utilities
|
|
2848
|
+
*/
|
|
2849
|
+
const getRequestedServices = salesOrder => {
|
|
2850
|
+
var _a;
|
|
2851
|
+
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)));
|
|
2852
|
+
};
|
|
2853
|
+
const getSalesOrderItemsFromSalesOrderOrShipment = ({
|
|
2854
|
+
salesOrder,
|
|
2855
|
+
shipment
|
|
2856
|
+
}) => {
|
|
2857
|
+
var _a, _b;
|
|
2858
|
+
return (_b = (_a = salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.salesOrderItems.map(item => ({
|
|
2859
|
+
detail: `SKU ${item.lineItemDetails.sku}`,
|
|
2860
|
+
name: item.lineItemDetails.name,
|
|
2861
|
+
quantity: item.quantity,
|
|
2862
|
+
subDetail: item.requestedShippingOptions.shippingService,
|
|
2863
|
+
subDetailValue: item.priceSummary.estimatedShipping,
|
|
2864
|
+
totalValue: item.priceSummary.total,
|
|
2865
|
+
value: item.priceSummary.unitPrice
|
|
2866
|
+
}))) !== null && _a !== void 0 ? _a : shipment === null || shipment === void 0 ? void 0 : shipment.items.map((item, i) => ({
|
|
2867
|
+
detail: `SKU ${item.sku}`,
|
|
2868
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || `ITEM ${i}`,
|
|
2869
|
+
quantity: item.quantity
|
|
2870
|
+
}))) !== null && _b !== void 0 ? _b : [];
|
|
2767
2871
|
};
|
|
2768
2872
|
|
|
2769
|
-
var
|
|
2873
|
+
var tryToString$3 = tryToString$5;
|
|
2770
2874
|
|
|
2771
2875
|
var $TypeError$8 = TypeError;
|
|
2772
2876
|
|
|
2773
|
-
var
|
|
2774
|
-
if (
|
|
2775
|
-
throw $TypeError$8("The method doesn't accept regular expressions");
|
|
2776
|
-
} return it;
|
|
2877
|
+
var deletePropertyOrThrow$1 = function (O, P) {
|
|
2878
|
+
if (!delete O[P]) throw $TypeError$8('Cannot delete property ' + tryToString$3(P) + ' of ' + tryToString$3(O));
|
|
2777
2879
|
};
|
|
2778
2880
|
|
|
2779
|
-
var
|
|
2881
|
+
var toPropertyKey = toPropertyKey$3;
|
|
2882
|
+
var definePropertyModule$1 = objectDefineProperty;
|
|
2883
|
+
var createPropertyDescriptor = createPropertyDescriptor$4;
|
|
2780
2884
|
|
|
2781
|
-
var
|
|
2885
|
+
var createProperty$1 = function (object, key, value) {
|
|
2886
|
+
var propertyKey = toPropertyKey(key);
|
|
2887
|
+
if (propertyKey in object) definePropertyModule$1.f(object, propertyKey, createPropertyDescriptor(0, value));
|
|
2888
|
+
else object[propertyKey] = value;
|
|
2889
|
+
};
|
|
2782
2890
|
|
|
2783
|
-
var
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2891
|
+
var toAbsoluteIndex = toAbsoluteIndex$2;
|
|
2892
|
+
var lengthOfArrayLike$5 = lengthOfArrayLike$8;
|
|
2893
|
+
var createProperty = createProperty$1;
|
|
2894
|
+
|
|
2895
|
+
var $Array$1 = Array;
|
|
2896
|
+
var max = Math.max;
|
|
2897
|
+
|
|
2898
|
+
var arraySliceSimple = function (O, start, end) {
|
|
2899
|
+
var length = lengthOfArrayLike$5(O);
|
|
2900
|
+
var k = toAbsoluteIndex(start, length);
|
|
2901
|
+
var fin = toAbsoluteIndex(end === undefined ? length : end, length);
|
|
2902
|
+
var result = $Array$1(max(fin - k, 0));
|
|
2903
|
+
for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
|
|
2904
|
+
result.length = n;
|
|
2905
|
+
return result;
|
|
2793
2906
|
};
|
|
2794
2907
|
|
|
2795
|
-
var
|
|
2796
|
-
var uncurryThis$e = functionUncurryThis;
|
|
2797
|
-
var notARegExp$1 = notARegexp;
|
|
2798
|
-
var requireObjectCoercible$5 = requireObjectCoercible$9;
|
|
2799
|
-
var toString$8 = toString$c;
|
|
2800
|
-
var correctIsRegExpLogic$1 = correctIsRegexpLogic;
|
|
2908
|
+
var arraySlice$2 = arraySliceSimple;
|
|
2801
2909
|
|
|
2802
|
-
var
|
|
2910
|
+
var floor$1 = Math.floor;
|
|
2803
2911
|
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
});
|
|
2912
|
+
var mergeSort = function (array, comparefn) {
|
|
2913
|
+
var length = array.length;
|
|
2914
|
+
var middle = floor$1(length / 2);
|
|
2915
|
+
return length < 8 ? insertionSort(array, comparefn) : merge(
|
|
2916
|
+
array,
|
|
2917
|
+
mergeSort(arraySlice$2(array, 0, middle), comparefn),
|
|
2918
|
+
mergeSort(arraySlice$2(array, middle), comparefn),
|
|
2919
|
+
comparefn
|
|
2920
|
+
);
|
|
2921
|
+
};
|
|
2815
2922
|
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2923
|
+
var insertionSort = function (array, comparefn) {
|
|
2924
|
+
var length = array.length;
|
|
2925
|
+
var i = 1;
|
|
2926
|
+
var element, j;
|
|
2927
|
+
|
|
2928
|
+
while (i < length) {
|
|
2929
|
+
j = i;
|
|
2930
|
+
element = array[i];
|
|
2931
|
+
while (j && comparefn(array[j - 1], element) > 0) {
|
|
2932
|
+
array[j] = array[--j];
|
|
2933
|
+
}
|
|
2934
|
+
if (j !== i++) array[j] = element;
|
|
2935
|
+
} return array;
|
|
2936
|
+
};
|
|
2937
|
+
|
|
2938
|
+
var merge = function (array, left, right, comparefn) {
|
|
2939
|
+
var llength = left.length;
|
|
2940
|
+
var rlength = right.length;
|
|
2941
|
+
var lindex = 0;
|
|
2942
|
+
var rindex = 0;
|
|
2943
|
+
|
|
2944
|
+
while (lindex < llength || rindex < rlength) {
|
|
2945
|
+
array[lindex + rindex] = (lindex < llength && rindex < rlength)
|
|
2946
|
+
? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
|
|
2947
|
+
: lindex < llength ? left[lindex++] : right[rindex++];
|
|
2948
|
+
} return array;
|
|
2821
2949
|
};
|
|
2822
2950
|
|
|
2823
|
-
|
|
2951
|
+
var arraySort = mergeSort;
|
|
2824
2952
|
|
|
2825
|
-
|
|
2826
|
-
* Creates a Record of Emotion styles.
|
|
2827
|
-
*
|
|
2828
|
-
* Values may be any variant that a `css` prop can accept (a CSSObject, SerializedStyles, a FunctionInterpolation with theme, etc).
|
|
2829
|
-
*
|
|
2830
|
-
* Eliminates the need to explicitly type styles (while remaining fully typed w/ autocomplete).
|
|
2831
|
-
*
|
|
2832
|
-
* @example
|
|
2833
|
-
* ```
|
|
2834
|
-
* const styles = createStyles({
|
|
2835
|
-
* container: (theme) => ({ backgroundColor: theme.colors.primary }),
|
|
2836
|
-
* icon: { color: 'red' },
|
|
2837
|
-
* });
|
|
2838
|
-
* ```
|
|
2839
|
-
*/
|
|
2840
|
-
const createStyles = styles => styles;
|
|
2953
|
+
var userAgent$4 = engineUserAgent;
|
|
2841
2954
|
|
|
2842
|
-
|
|
2843
|
-
const meta = __rest(error, ["code", "message", "path"]);
|
|
2844
|
-
return JSON.stringify(Object.assign({
|
|
2845
|
-
message: translationKey
|
|
2846
|
-
}, meta));
|
|
2847
|
-
};
|
|
2848
|
-
/**
|
|
2849
|
-
* @category Utilities
|
|
2850
|
-
*/
|
|
2851
|
-
const errorMap = (issue, ctx) => {
|
|
2852
|
-
let messageCode;
|
|
2853
|
-
// TODO - Fill in the rest of the codes (positive, max, etc)
|
|
2854
|
-
switch (issue.code) {
|
|
2855
|
-
// Invalid Type
|
|
2856
|
-
case z.ZodIssueCode.invalid_type:
|
|
2857
|
-
switch (issue.received) {
|
|
2858
|
-
case "null":
|
|
2859
|
-
case "undefined":
|
|
2860
|
-
messageCode = "schemaErrors.required";
|
|
2861
|
-
break;
|
|
2862
|
-
}
|
|
2863
|
-
break;
|
|
2864
|
-
case z.ZodIssueCode.invalid_string:
|
|
2865
|
-
messageCode = "schemaErrors.invalidString";
|
|
2866
|
-
break;
|
|
2867
|
-
case z.ZodIssueCode.too_small:
|
|
2868
|
-
switch (issue.type) {
|
|
2869
|
-
case "number":
|
|
2870
|
-
if (issue.minimum === 0) {
|
|
2871
|
-
messageCode = issue.inclusive ? "schemaErrors.nonnegative" : "schemaErrors.positive";
|
|
2872
|
-
}
|
|
2873
|
-
break;
|
|
2874
|
-
case "string":
|
|
2875
|
-
messageCode = buildError("schemaErrors.tooFewCharacters", issue);
|
|
2876
|
-
break;
|
|
2877
|
-
}
|
|
2878
|
-
break;
|
|
2879
|
-
case z.ZodIssueCode.too_big:
|
|
2880
|
-
switch (issue.type) {
|
|
2881
|
-
case "string":
|
|
2882
|
-
messageCode = buildError("schemaErrors.tooManyCharacters", issue);
|
|
2883
|
-
break;
|
|
2884
|
-
}
|
|
2885
|
-
break;
|
|
2886
|
-
}
|
|
2887
|
-
return {
|
|
2888
|
-
message: messageCode !== null && messageCode !== void 0 ? messageCode : ctx.defaultError
|
|
2889
|
-
};
|
|
2890
|
-
};
|
|
2891
|
-
/**
|
|
2892
|
-
* @category Utilities
|
|
2893
|
-
*/
|
|
2894
|
-
const validationResolver = schema => (values, context, resolverOptions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2895
|
-
const getValidationResult = () => zodResolver(schema, {
|
|
2896
|
-
errorMap
|
|
2897
|
-
})(values, undefined, resolverOptions);
|
|
2898
|
-
const validationResult = yield formLogger.isSubmitting ? formLogger.log(values, getValidationResult) : getValidationResult();
|
|
2899
|
-
return validationResult;
|
|
2900
|
-
});
|
|
2955
|
+
var firefox = userAgent$4.match(/firefox\/(\d+)/i);
|
|
2901
2956
|
|
|
2902
|
-
|
|
2903
|
-
var {
|
|
2904
|
-
children,
|
|
2905
|
-
justify,
|
|
2906
|
-
toolbar = false
|
|
2907
|
-
} = _a,
|
|
2908
|
-
props = __rest(_a, ["children", "justify", "toolbar"]);
|
|
2909
|
-
const styles = {
|
|
2910
|
-
group: theme => Object.assign({
|
|
2911
|
-
alignItems: "center",
|
|
2912
|
-
display: "flex",
|
|
2913
|
-
justifyContent: justify,
|
|
2914
|
-
width: "100%"
|
|
2915
|
-
}, toolbar ? {
|
|
2916
|
-
"& > button": {
|
|
2917
|
-
"&:not(:first-of-type)": {
|
|
2918
|
-
borderBottomLeftRadius: 0,
|
|
2919
|
-
borderTopLeftRadius: 0
|
|
2920
|
-
},
|
|
2921
|
-
"&:not(:last-child)": {
|
|
2922
|
-
borderBottomRightRadius: 0,
|
|
2923
|
-
borderTopRightRadius: 0
|
|
2924
|
-
}
|
|
2925
|
-
}
|
|
2926
|
-
} : {
|
|
2927
|
-
gap: theme.spacing(2)
|
|
2928
|
-
})
|
|
2929
|
-
};
|
|
2930
|
-
return jsx("div", Object.assign({}, props, {
|
|
2931
|
-
css: styles.group,
|
|
2932
|
-
role: "group"
|
|
2933
|
-
}, {
|
|
2934
|
-
children: children
|
|
2935
|
-
}));
|
|
2936
|
-
};
|
|
2957
|
+
var engineFfVersion = !!firefox && +firefox[1];
|
|
2937
2958
|
|
|
2938
|
-
var
|
|
2959
|
+
var UA = engineUserAgent;
|
|
2939
2960
|
|
|
2940
|
-
var
|
|
2941
|
-
var apply$2 = FunctionPrototype.apply;
|
|
2942
|
-
var call$b = FunctionPrototype.call;
|
|
2961
|
+
var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
|
|
2943
2962
|
|
|
2944
|
-
|
|
2945
|
-
var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$b.bind(apply$2) : function () {
|
|
2946
|
-
return call$b.apply(apply$2, arguments);
|
|
2947
|
-
});
|
|
2963
|
+
var userAgent$3 = engineUserAgent;
|
|
2948
2964
|
|
|
2949
|
-
var
|
|
2950
|
-
var uncurryThis$d = functionUncurryThis;
|
|
2965
|
+
var webkit = userAgent$3.match(/AppleWebKit\/(\d+)\./);
|
|
2951
2966
|
|
|
2952
|
-
var
|
|
2953
|
-
// Nashorn bug:
|
|
2954
|
-
// https://github.com/zloirock/core-js/issues/1128
|
|
2955
|
-
// https://github.com/zloirock/core-js/issues/1130
|
|
2956
|
-
if (classofRaw(fn) === 'Function') return uncurryThis$d(fn);
|
|
2957
|
-
};
|
|
2967
|
+
var engineWebkitVersion = !!webkit && +webkit[1];
|
|
2958
2968
|
|
|
2959
|
-
|
|
2969
|
+
var $$f = _export;
|
|
2970
|
+
var uncurryThis$a = functionUncurryThis;
|
|
2971
|
+
var aCallable$7 = aCallable$a;
|
|
2972
|
+
var toObject$2 = toObject$8;
|
|
2973
|
+
var lengthOfArrayLike$4 = lengthOfArrayLike$8;
|
|
2974
|
+
var deletePropertyOrThrow = deletePropertyOrThrow$1;
|
|
2975
|
+
var toString$7 = toString$c;
|
|
2976
|
+
var fails$7 = fails$r;
|
|
2977
|
+
var internalSort = arraySort;
|
|
2978
|
+
var arrayMethodIsStrict = arrayMethodIsStrict$2;
|
|
2979
|
+
var FF = engineFfVersion;
|
|
2980
|
+
var IE_OR_EDGE = engineIsIeOrEdge;
|
|
2981
|
+
var V8 = engineV8Version;
|
|
2982
|
+
var WEBKIT = engineWebkitVersion;
|
|
2960
2983
|
|
|
2961
|
-
var
|
|
2962
|
-
var
|
|
2963
|
-
var
|
|
2964
|
-
var fails$8 = fails$r;
|
|
2965
|
-
var wellKnownSymbol$8 = wellKnownSymbol$j;
|
|
2966
|
-
var createNonEnumerableProperty = createNonEnumerableProperty$5;
|
|
2984
|
+
var test = [];
|
|
2985
|
+
var nativeSort = uncurryThis$a(test.sort);
|
|
2986
|
+
var push = uncurryThis$a(test.push);
|
|
2967
2987
|
|
|
2968
|
-
|
|
2969
|
-
var
|
|
2988
|
+
// IE8-
|
|
2989
|
+
var FAILS_ON_UNDEFINED = fails$7(function () {
|
|
2990
|
+
test.sort(undefined);
|
|
2991
|
+
});
|
|
2992
|
+
// V8 bug
|
|
2993
|
+
var FAILS_ON_NULL = fails$7(function () {
|
|
2994
|
+
test.sort(null);
|
|
2995
|
+
});
|
|
2996
|
+
// Old WebKit
|
|
2997
|
+
var STRICT_METHOD = arrayMethodIsStrict('sort');
|
|
2970
2998
|
|
|
2971
|
-
var
|
|
2972
|
-
|
|
2999
|
+
var STABLE_SORT = !fails$7(function () {
|
|
3000
|
+
// feature detection can be too slow, so check engines versions
|
|
3001
|
+
if (V8) return V8 < 70;
|
|
3002
|
+
if (FF && FF > 3) return;
|
|
3003
|
+
if (IE_OR_EDGE) return true;
|
|
3004
|
+
if (WEBKIT) return WEBKIT < 603;
|
|
2973
3005
|
|
|
2974
|
-
var
|
|
2975
|
-
|
|
2976
|
-
var O = {};
|
|
2977
|
-
O[SYMBOL] = function () { return 7; };
|
|
2978
|
-
return ''[KEY](O) != 7;
|
|
2979
|
-
});
|
|
3006
|
+
var result = '';
|
|
3007
|
+
var code, chr, value, index;
|
|
2980
3008
|
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
var re = /a/;
|
|
3009
|
+
// generate an array with more 512 elements (Chakra and old V8 fails only in this case)
|
|
3010
|
+
for (code = 65; code < 76; code++) {
|
|
3011
|
+
chr = String.fromCharCode(code);
|
|
2985
3012
|
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
re = {};
|
|
2991
|
-
// RegExp[@@split] doesn't call the regex's exec method, but first creates
|
|
2992
|
-
// a new one. We need to return the patched regex when creating the new one.
|
|
2993
|
-
re.constructor = {};
|
|
2994
|
-
re.constructor[SPECIES$4] = function () { return re; };
|
|
2995
|
-
re.flags = '';
|
|
2996
|
-
re[SYMBOL] = /./[SYMBOL];
|
|
3013
|
+
switch (code) {
|
|
3014
|
+
case 66: case 69: case 70: case 72: value = 3; break;
|
|
3015
|
+
case 68: case 71: value = 4; break;
|
|
3016
|
+
default: value = 2;
|
|
2997
3017
|
}
|
|
2998
3018
|
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
});
|
|
3019
|
+
for (index = 0; index < 47; index++) {
|
|
3020
|
+
test.push({ k: chr + index, v: value });
|
|
3021
|
+
}
|
|
3022
|
+
}
|
|
3004
3023
|
|
|
3005
|
-
|
|
3006
|
-
!DELEGATES_TO_SYMBOL ||
|
|
3007
|
-
!DELEGATES_TO_EXEC ||
|
|
3008
|
-
FORCED
|
|
3009
|
-
) {
|
|
3010
|
-
var uncurriedNativeRegExpMethod = uncurryThis$c(/./[SYMBOL]);
|
|
3011
|
-
var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
|
3012
|
-
var uncurriedNativeMethod = uncurryThis$c(nativeMethod);
|
|
3013
|
-
var $exec = regexp.exec;
|
|
3014
|
-
if ($exec === regexpExec$1 || $exec === RegExpPrototype$2.exec) {
|
|
3015
|
-
if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
|
|
3016
|
-
// The native String method already delegates to @@method (this
|
|
3017
|
-
// polyfilled function), leasing to infinite recursion.
|
|
3018
|
-
// We avoid it by directly calling the native @@method method.
|
|
3019
|
-
return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
|
|
3020
|
-
}
|
|
3021
|
-
return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
|
|
3022
|
-
}
|
|
3023
|
-
return { done: false };
|
|
3024
|
-
});
|
|
3024
|
+
test.sort(function (a, b) { return b.v - a.v; });
|
|
3025
3025
|
|
|
3026
|
-
|
|
3027
|
-
|
|
3026
|
+
for (index = 0; index < test.length; index++) {
|
|
3027
|
+
chr = test[index].k.charAt(0);
|
|
3028
|
+
if (result.charAt(result.length - 1) !== chr) result += chr;
|
|
3028
3029
|
}
|
|
3029
3030
|
|
|
3030
|
-
|
|
3031
|
-
};
|
|
3031
|
+
return result !== 'DGBEFHACIJK';
|
|
3032
|
+
});
|
|
3033
|
+
|
|
3034
|
+
var FORCED$3 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
|
|
3035
|
+
|
|
3036
|
+
var getSortCompare = function (comparefn) {
|
|
3037
|
+
return function (x, y) {
|
|
3038
|
+
if (y === undefined) return -1;
|
|
3039
|
+
if (x === undefined) return 1;
|
|
3040
|
+
if (comparefn !== undefined) return +comparefn(x, y) || 0;
|
|
3041
|
+
return toString$7(x) > toString$7(y) ? 1 : -1;
|
|
3042
|
+
};
|
|
3043
|
+
};
|
|
3044
|
+
|
|
3045
|
+
// `Array.prototype.sort` method
|
|
3046
|
+
// https://tc39.es/ecma262/#sec-array.prototype.sort
|
|
3047
|
+
$$f({ target: 'Array', proto: true, forced: FORCED$3 }, {
|
|
3048
|
+
sort: function sort(comparefn) {
|
|
3049
|
+
if (comparefn !== undefined) aCallable$7(comparefn);
|
|
3050
|
+
|
|
3051
|
+
var array = toObject$2(this);
|
|
3032
3052
|
|
|
3033
|
-
|
|
3034
|
-
var toIntegerOrInfinity$4 = toIntegerOrInfinity$7;
|
|
3035
|
-
var toString$7 = toString$c;
|
|
3036
|
-
var requireObjectCoercible$4 = requireObjectCoercible$9;
|
|
3053
|
+
if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
|
|
3037
3054
|
|
|
3038
|
-
var
|
|
3039
|
-
var
|
|
3040
|
-
var
|
|
3055
|
+
var items = [];
|
|
3056
|
+
var arrayLength = lengthOfArrayLike$4(array);
|
|
3057
|
+
var itemsLength, index;
|
|
3041
3058
|
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
var position = toIntegerOrInfinity$4(pos);
|
|
3046
|
-
var size = S.length;
|
|
3047
|
-
var first, second;
|
|
3048
|
-
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
|
3049
|
-
first = charCodeAt(S, position);
|
|
3050
|
-
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
|
3051
|
-
|| (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
|
|
3052
|
-
? CONVERT_TO_STRING
|
|
3053
|
-
? charAt$3(S, position)
|
|
3054
|
-
: first
|
|
3055
|
-
: CONVERT_TO_STRING
|
|
3056
|
-
? stringSlice$5(S, position, position + 2)
|
|
3057
|
-
: (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
|
3058
|
-
};
|
|
3059
|
-
};
|
|
3059
|
+
for (index = 0; index < arrayLength; index++) {
|
|
3060
|
+
if (index in array) push(items, array[index]);
|
|
3061
|
+
}
|
|
3060
3062
|
|
|
3061
|
-
|
|
3062
|
-
// `String.prototype.codePointAt` method
|
|
3063
|
-
// https://tc39.es/ecma262/#sec-string.prototype.codepointat
|
|
3064
|
-
codeAt: createMethod(false),
|
|
3065
|
-
// `String.prototype.at` method
|
|
3066
|
-
// https://github.com/mathiasbynens/String.prototype.at
|
|
3067
|
-
charAt: createMethod(true)
|
|
3068
|
-
};
|
|
3063
|
+
internalSort(items, getSortCompare(comparefn));
|
|
3069
3064
|
|
|
3070
|
-
|
|
3065
|
+
itemsLength = lengthOfArrayLike$4(items);
|
|
3066
|
+
index = 0;
|
|
3071
3067
|
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
var advanceStringIndex$2 = function (S, index, unicode) {
|
|
3075
|
-
return index + (unicode ? charAt$2(S, index).length : 1);
|
|
3076
|
-
};
|
|
3068
|
+
while (index < itemsLength) array[index] = items[index++];
|
|
3069
|
+
while (index < arrayLength) deletePropertyOrThrow(array, index++);
|
|
3077
3070
|
|
|
3078
|
-
|
|
3079
|
-
|
|
3071
|
+
return array;
|
|
3072
|
+
}
|
|
3073
|
+
});
|
|
3080
3074
|
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3075
|
+
/**
|
|
3076
|
+
* @category Utilities
|
|
3077
|
+
*/
|
|
3078
|
+
const getIsInternationalShipment = ({
|
|
3079
|
+
shipFrom,
|
|
3080
|
+
shipTo
|
|
3081
|
+
}) => (shipFrom === null || shipFrom === void 0 ? void 0 : shipFrom.countryCode) !== (shipTo === null || shipTo === void 0 ? void 0 : shipTo.countryCode);
|
|
3082
|
+
/**
|
|
3083
|
+
* @category Utilities
|
|
3084
|
+
*/
|
|
3085
|
+
const getIsCustomsRequiredForShipment = ({
|
|
3086
|
+
shipFrom,
|
|
3087
|
+
shipTo
|
|
3088
|
+
}) => 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);
|
|
3089
|
+
/**
|
|
3090
|
+
* @category Utilities
|
|
3091
|
+
*/
|
|
3092
|
+
const getPendingShipment = shipments => shipments === null || shipments === void 0 ? void 0 : shipments.filter(s => s.shipmentStatus === "pending").sort(sortByCreationDate)[0];
|
|
3087
3093
|
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
namedCaptures = toObject$2(namedCaptures);
|
|
3096
|
-
symbols = SUBSTITUTION_SYMBOLS;
|
|
3094
|
+
function convertWeight(weight) {
|
|
3095
|
+
if ("value" in weight) {
|
|
3096
|
+
const valueAsLbs = weight.value / 16;
|
|
3097
|
+
return {
|
|
3098
|
+
fractional: (valueAsLbs - Math.floor(valueAsLbs)) * 16,
|
|
3099
|
+
whole: Math.floor(valueAsLbs)
|
|
3100
|
+
};
|
|
3097
3101
|
}
|
|
3098
|
-
return
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
}
|
|
3119
|
-
return capture === undefined ? '' : capture;
|
|
3120
|
-
});
|
|
3121
|
-
};
|
|
3102
|
+
return {
|
|
3103
|
+
unit: "ounce",
|
|
3104
|
+
value: (weight.whole || 0) * 16 + (weight.fractional || 0)
|
|
3105
|
+
};
|
|
3106
|
+
}
|
|
3107
|
+
/**
|
|
3108
|
+
* @category Utilities
|
|
3109
|
+
*/
|
|
3110
|
+
function formatFractionalWeight(weight) {
|
|
3111
|
+
if (!weight) return {
|
|
3112
|
+
fractional: 0,
|
|
3113
|
+
whole: 0
|
|
3114
|
+
};
|
|
3115
|
+
const valueAsOz = (weight.whole || 0) * 16 + (weight.fractional || 0);
|
|
3116
|
+
const valueAsLbs = valueAsOz / 16;
|
|
3117
|
+
return {
|
|
3118
|
+
fractional: Math.round((valueAsLbs - Math.floor(valueAsLbs)) * 16 * 100) / 100,
|
|
3119
|
+
whole: Math.floor(valueAsLbs)
|
|
3120
|
+
};
|
|
3121
|
+
}
|
|
3122
3122
|
|
|
3123
|
-
var
|
|
3124
|
-
var anObject$8 = anObject$f;
|
|
3125
|
-
var isCallable$8 = isCallable$o;
|
|
3123
|
+
var isObject$3 = isObject$a;
|
|
3126
3124
|
var classof$3 = classofRaw$2;
|
|
3127
|
-
var
|
|
3125
|
+
var wellKnownSymbol$8 = wellKnownSymbol$j;
|
|
3126
|
+
|
|
3127
|
+
var MATCH$1 = wellKnownSymbol$8('match');
|
|
3128
|
+
|
|
3129
|
+
// `IsRegExp` abstract operation
|
|
3130
|
+
// https://tc39.es/ecma262/#sec-isregexp
|
|
3131
|
+
var isRegexp = function (it) {
|
|
3132
|
+
var isRegExp;
|
|
3133
|
+
return isObject$3(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$3(it) == 'RegExp');
|
|
3134
|
+
};
|
|
3135
|
+
|
|
3136
|
+
var isRegExp = isRegexp;
|
|
3128
3137
|
|
|
3129
3138
|
var $TypeError$7 = TypeError;
|
|
3130
3139
|
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
if (isCallable$8(exec)) {
|
|
3136
|
-
var result = call$a(exec, R, S);
|
|
3137
|
-
if (result !== null) anObject$8(result);
|
|
3138
|
-
return result;
|
|
3139
|
-
}
|
|
3140
|
-
if (classof$3(R) === 'RegExp') return call$a(regexpExec, R, S);
|
|
3141
|
-
throw $TypeError$7('RegExp#exec called on incompatible receiver');
|
|
3140
|
+
var notARegexp = function (it) {
|
|
3141
|
+
if (isRegExp(it)) {
|
|
3142
|
+
throw $TypeError$7("The method doesn't accept regular expressions");
|
|
3143
|
+
} return it;
|
|
3142
3144
|
};
|
|
3143
3145
|
|
|
3144
|
-
var apply$1 = functionApply;
|
|
3145
|
-
var call$9 = functionCall;
|
|
3146
|
-
var uncurryThis$9 = functionUncurryThis;
|
|
3147
|
-
var fixRegExpWellKnownSymbolLogic$1 = fixRegexpWellKnownSymbolLogic;
|
|
3148
|
-
var fails$7 = fails$r;
|
|
3149
|
-
var anObject$7 = anObject$f;
|
|
3150
|
-
var isCallable$7 = isCallable$o;
|
|
3151
|
-
var isNullOrUndefined$3 = isNullOrUndefined$6;
|
|
3152
|
-
var toIntegerOrInfinity$3 = toIntegerOrInfinity$7;
|
|
3153
|
-
var toLength$2 = toLength$4;
|
|
3154
|
-
var toString$6 = toString$c;
|
|
3155
|
-
var requireObjectCoercible$3 = requireObjectCoercible$9;
|
|
3156
|
-
var advanceStringIndex$1 = advanceStringIndex$2;
|
|
3157
|
-
var getMethod$3 = getMethod$5;
|
|
3158
|
-
var getSubstitution = getSubstitution$1;
|
|
3159
|
-
var regExpExec$1 = regexpExecAbstract;
|
|
3160
3146
|
var wellKnownSymbol$7 = wellKnownSymbol$j;
|
|
3161
3147
|
|
|
3162
|
-
var
|
|
3163
|
-
var max = Math.max;
|
|
3164
|
-
var min$1 = Math.min;
|
|
3165
|
-
var concat = uncurryThis$9([].concat);
|
|
3166
|
-
var push = uncurryThis$9([].push);
|
|
3167
|
-
var stringIndexOf = uncurryThis$9(''.indexOf);
|
|
3168
|
-
var stringSlice$3 = uncurryThis$9(''.slice);
|
|
3148
|
+
var MATCH = wellKnownSymbol$7('match');
|
|
3169
3149
|
|
|
3170
|
-
var
|
|
3171
|
-
|
|
3150
|
+
var correctIsRegexpLogic = function (METHOD_NAME) {
|
|
3151
|
+
var regexp = /./;
|
|
3152
|
+
try {
|
|
3153
|
+
'/./'[METHOD_NAME](regexp);
|
|
3154
|
+
} catch (error1) {
|
|
3155
|
+
try {
|
|
3156
|
+
regexp[MATCH] = false;
|
|
3157
|
+
return '/./'[METHOD_NAME](regexp);
|
|
3158
|
+
} catch (error2) { /* empty */ }
|
|
3159
|
+
} return false;
|
|
3172
3160
|
};
|
|
3173
3161
|
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
var
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3162
|
+
var $$e = _export;
|
|
3163
|
+
var uncurryThis$9 = functionUncurryThis;
|
|
3164
|
+
var notARegExp$1 = notARegexp;
|
|
3165
|
+
var requireObjectCoercible$3 = requireObjectCoercible$9;
|
|
3166
|
+
var toString$6 = toString$c;
|
|
3167
|
+
var correctIsRegExpLogic$1 = correctIsRegexpLogic;
|
|
3180
3168
|
|
|
3181
|
-
|
|
3182
|
-
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
|
|
3183
|
-
if (/./[REPLACE]) {
|
|
3184
|
-
return /./[REPLACE]('a', '$0') === '';
|
|
3185
|
-
}
|
|
3186
|
-
return false;
|
|
3187
|
-
})();
|
|
3169
|
+
var stringIndexOf = uncurryThis$9(''.indexOf);
|
|
3188
3170
|
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3171
|
+
// `String.prototype.includes` method
|
|
3172
|
+
// https://tc39.es/ecma262/#sec-string.prototype.includes
|
|
3173
|
+
$$e({ target: 'String', proto: true, forced: !correctIsRegExpLogic$1('includes') }, {
|
|
3174
|
+
includes: function includes(searchString /* , position = 0 */) {
|
|
3175
|
+
return !!~stringIndexOf(
|
|
3176
|
+
toString$6(requireObjectCoercible$3(this)),
|
|
3177
|
+
toString$6(notARegExp$1(searchString)),
|
|
3178
|
+
arguments.length > 1 ? arguments[1] : undefined
|
|
3179
|
+
);
|
|
3180
|
+
}
|
|
3198
3181
|
});
|
|
3199
3182
|
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3183
|
+
/**
|
|
3184
|
+
* @category Utilities
|
|
3185
|
+
*/
|
|
3186
|
+
const isFlatRatePackageCode = packageCode => {
|
|
3187
|
+
return packageCode ? packageCode.includes("flat_rate") : false;
|
|
3188
|
+
};
|
|
3203
3189
|
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3190
|
+
const capitalizeFirstLetter = str => str.slice(0, 1).toUpperCase() + str.slice(1);
|
|
3191
|
+
|
|
3192
|
+
/**
|
|
3193
|
+
* Creates a Record of Emotion styles.
|
|
3194
|
+
*
|
|
3195
|
+
* Values may be any variant that a `css` prop can accept (a CSSObject, SerializedStyles, a FunctionInterpolation with theme, etc).
|
|
3196
|
+
*
|
|
3197
|
+
* Eliminates the need to explicitly type styles (while remaining fully typed w/ autocomplete).
|
|
3198
|
+
*
|
|
3199
|
+
* @example
|
|
3200
|
+
* ```
|
|
3201
|
+
* const styles = createStyles({
|
|
3202
|
+
* container: (theme) => ({ backgroundColor: theme.colors.primary }),
|
|
3203
|
+
* icon: { color: 'red' },
|
|
3204
|
+
* });
|
|
3205
|
+
* ```
|
|
3206
|
+
*/
|
|
3207
|
+
const createStyles = styles => styles;
|
|
3219
3208
|
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3209
|
+
const buildError = (translationKey, error) => {
|
|
3210
|
+
const meta = __rest(error, ["code", "message", "path"]);
|
|
3211
|
+
return JSON.stringify(Object.assign({
|
|
3212
|
+
message: translationKey
|
|
3213
|
+
}, meta));
|
|
3214
|
+
};
|
|
3215
|
+
/**
|
|
3216
|
+
* @category Utilities
|
|
3217
|
+
*/
|
|
3218
|
+
const errorMap = (issue, ctx) => {
|
|
3219
|
+
let messageCode;
|
|
3220
|
+
// TODO - Fill in the rest of the codes (positive, max, etc)
|
|
3221
|
+
switch (issue.code) {
|
|
3222
|
+
// Invalid Type
|
|
3223
|
+
case z.ZodIssueCode.invalid_type:
|
|
3224
|
+
switch (issue.received) {
|
|
3225
|
+
case "null":
|
|
3226
|
+
case "undefined":
|
|
3227
|
+
messageCode = "schemaErrors.required";
|
|
3228
|
+
break;
|
|
3227
3229
|
}
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3230
|
+
break;
|
|
3231
|
+
case z.ZodIssueCode.invalid_string:
|
|
3232
|
+
messageCode = "schemaErrors.invalidString";
|
|
3233
|
+
break;
|
|
3234
|
+
case z.ZodIssueCode.too_small:
|
|
3235
|
+
switch (issue.type) {
|
|
3236
|
+
case "number":
|
|
3237
|
+
if (issue.minimum === 0) {
|
|
3238
|
+
messageCode = issue.inclusive ? "schemaErrors.nonnegative" : "schemaErrors.positive";
|
|
3239
|
+
}
|
|
3240
|
+
break;
|
|
3241
|
+
case "string":
|
|
3242
|
+
messageCode = buildError("schemaErrors.tooFewCharacters", issue);
|
|
3243
|
+
break;
|
|
3236
3244
|
}
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
if (!global) break;
|
|
3244
|
-
|
|
3245
|
-
var matchStr = toString$6(result[0]);
|
|
3246
|
-
if (matchStr === '') rx.lastIndex = advanceStringIndex$1(S, toLength$2(rx.lastIndex), fullUnicode);
|
|
3245
|
+
break;
|
|
3246
|
+
case z.ZodIssueCode.too_big:
|
|
3247
|
+
switch (issue.type) {
|
|
3248
|
+
case "string":
|
|
3249
|
+
messageCode = buildError("schemaErrors.tooManyCharacters", issue);
|
|
3250
|
+
break;
|
|
3247
3251
|
}
|
|
3252
|
+
break;
|
|
3253
|
+
}
|
|
3254
|
+
return {
|
|
3255
|
+
message: messageCode !== null && messageCode !== void 0 ? messageCode : ctx.defaultError
|
|
3256
|
+
};
|
|
3257
|
+
};
|
|
3258
|
+
/**
|
|
3259
|
+
* @category Utilities
|
|
3260
|
+
*/
|
|
3261
|
+
const validationResolver = schema => (values, context, resolverOptions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3262
|
+
const getValidationResult = () => zodResolver(schema, {
|
|
3263
|
+
errorMap
|
|
3264
|
+
})(values, undefined, resolverOptions);
|
|
3265
|
+
const validationResult = yield formLogger.isSubmitting ? formLogger.log(values, getValidationResult) : getValidationResult();
|
|
3266
|
+
return validationResult;
|
|
3267
|
+
});
|
|
3248
3268
|
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
if (position >= nextSourcePosition) {
|
|
3272
|
-
accumulatedResult += stringSlice$3(S, nextSourcePosition, position) + replacement;
|
|
3273
|
-
nextSourcePosition = position + matched.length;
|
|
3269
|
+
const ButtonGroup = _a => {
|
|
3270
|
+
var {
|
|
3271
|
+
children,
|
|
3272
|
+
justify,
|
|
3273
|
+
toolbar = false
|
|
3274
|
+
} = _a,
|
|
3275
|
+
props = __rest(_a, ["children", "justify", "toolbar"]);
|
|
3276
|
+
const styles = {
|
|
3277
|
+
group: theme => Object.assign({
|
|
3278
|
+
alignItems: "center",
|
|
3279
|
+
display: "flex",
|
|
3280
|
+
justifyContent: justify,
|
|
3281
|
+
width: "100%"
|
|
3282
|
+
}, toolbar ? {
|
|
3283
|
+
"& > button": {
|
|
3284
|
+
"&:not(:first-of-type)": {
|
|
3285
|
+
borderBottomLeftRadius: 0,
|
|
3286
|
+
borderTopLeftRadius: 0
|
|
3287
|
+
},
|
|
3288
|
+
"&:not(:last-child)": {
|
|
3289
|
+
borderBottomRightRadius: 0,
|
|
3290
|
+
borderTopRightRadius: 0
|
|
3274
3291
|
}
|
|
3275
3292
|
}
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
}
|
|
3293
|
+
} : {
|
|
3294
|
+
gap: theme.spacing(2)
|
|
3295
|
+
})
|
|
3296
|
+
};
|
|
3297
|
+
return jsx("div", Object.assign({}, props, {
|
|
3298
|
+
css: styles.group,
|
|
3299
|
+
role: "group"
|
|
3300
|
+
}, {
|
|
3301
|
+
children: children
|
|
3302
|
+
}));
|
|
3303
|
+
};
|
|
3280
3304
|
|
|
3281
3305
|
const FieldLabel = ({
|
|
3282
3306
|
children,
|
|
@@ -3298,8 +3322,9 @@ const FieldLabel = ({
|
|
|
3298
3322
|
}, {
|
|
3299
3323
|
children: [label && jsxs("div", Object.assign({
|
|
3300
3324
|
css: theme => ({
|
|
3301
|
-
|
|
3302
|
-
paddingTop: _withInput ? theme.spacing(subLabel ? 1 : 2) : undefined
|
|
3325
|
+
flexShrink: 0,
|
|
3326
|
+
paddingTop: _withInput ? theme.spacing(subLabel ? 1 : 2) : undefined,
|
|
3327
|
+
width: theme.spacing(12.5)
|
|
3303
3328
|
})
|
|
3304
3329
|
}, {
|
|
3305
3330
|
children: [jsx(Typography, Object.assign({
|
|
@@ -3446,7 +3471,7 @@ const getOverrideStyles = theme => ({
|
|
|
3446
3471
|
});
|
|
3447
3472
|
|
|
3448
3473
|
const CreditCardInputController = createFieldController();
|
|
3449
|
-
const transform$
|
|
3474
|
+
const transform$5 = {
|
|
3450
3475
|
in: v => v ? formatCreditCardNumber(v) : "",
|
|
3451
3476
|
out: event => event.target.value === "" ? null : event.target.value.replace(/\s/g, "")
|
|
3452
3477
|
};
|
|
@@ -3466,7 +3491,7 @@ const CreditCardInput = fieldProps => jsx(CreditCardInputController, Object.assi
|
|
|
3466
3491
|
if (e.target.value.replace(/\s/g, "").length > 16) {
|
|
3467
3492
|
e.preventDefault();
|
|
3468
3493
|
} else {
|
|
3469
|
-
onChange(transform$
|
|
3494
|
+
onChange(transform$5.out(e));
|
|
3470
3495
|
}
|
|
3471
3496
|
},
|
|
3472
3497
|
onKeyDown: e => {
|
|
@@ -3474,7 +3499,7 @@ const CreditCardInput = fieldProps => jsx(CreditCardInputController, Object.assi
|
|
|
3474
3499
|
if (!/^([0-9]|Backspace|Delete|Enter|Tab)$/i.test(e.key)) e.preventDefault();
|
|
3475
3500
|
},
|
|
3476
3501
|
type: "text",
|
|
3477
|
-
value: transform$
|
|
3502
|
+
value: transform$5.in(value)
|
|
3478
3503
|
}))
|
|
3479
3504
|
}));
|
|
3480
3505
|
}
|
|
@@ -3569,6 +3594,40 @@ const DatePicker = fieldProps => {
|
|
|
3569
3594
|
}));
|
|
3570
3595
|
};
|
|
3571
3596
|
|
|
3597
|
+
const ExpirationInputController = createFieldController();
|
|
3598
|
+
const transform$4 = {
|
|
3599
|
+
in: v => v ? formatExpiration(v) : "",
|
|
3600
|
+
out: event => event.target.value === "" ? null : event.target.value
|
|
3601
|
+
};
|
|
3602
|
+
const ExpirationInput = fieldProps => jsx(ExpirationInputController, Object.assign({}, fieldProps, {
|
|
3603
|
+
children: _a => {
|
|
3604
|
+
var {
|
|
3605
|
+
onChange,
|
|
3606
|
+
value
|
|
3607
|
+
} = _a,
|
|
3608
|
+
expirationInputProps = __rest(_a, ["onChange", "value"]);
|
|
3609
|
+
return jsx("div", Object.assign({
|
|
3610
|
+
css: getOverrideStyles
|
|
3611
|
+
}, {
|
|
3612
|
+
children: jsx(Input, Object.assign({}, expirationInputProps, {
|
|
3613
|
+
onChange: e => {
|
|
3614
|
+
if (e.target.value.length > 7) {
|
|
3615
|
+
e.preventDefault();
|
|
3616
|
+
} else {
|
|
3617
|
+
onChange(transform$4.out(e));
|
|
3618
|
+
}
|
|
3619
|
+
},
|
|
3620
|
+
onKeyDown: e => {
|
|
3621
|
+
// Prevent non-numeric characters
|
|
3622
|
+
if (!/^([0-9]|Backspace|Delete|Enter|Tab)$/i.test(e.key)) e.preventDefault();
|
|
3623
|
+
},
|
|
3624
|
+
type: "text",
|
|
3625
|
+
value: transform$4.in(value)
|
|
3626
|
+
}))
|
|
3627
|
+
}));
|
|
3628
|
+
}
|
|
3629
|
+
}));
|
|
3630
|
+
|
|
3572
3631
|
var classof$2 = classofRaw$2;
|
|
3573
3632
|
|
|
3574
3633
|
// `IsArray` abstract operation
|
|
@@ -22007,7 +22066,7 @@ const Switch = _a => {
|
|
|
22007
22066
|
defaultChecked = false,
|
|
22008
22067
|
children,
|
|
22009
22068
|
shouldUnmount,
|
|
22010
|
-
label,
|
|
22069
|
+
label = "",
|
|
22011
22070
|
onChange
|
|
22012
22071
|
} = _a,
|
|
22013
22072
|
props = __rest(_a, ["defaultChecked", "children", "shouldUnmount", "label", "onChange"]);
|
|
@@ -22086,6 +22145,7 @@ var fields = /*#__PURE__*/Object.freeze({
|
|
|
22086
22145
|
CreditCardInput: CreditCardInput,
|
|
22087
22146
|
CheckboxInput: CheckboxInput,
|
|
22088
22147
|
DatePicker: DatePicker,
|
|
22148
|
+
ExpirationInput: ExpirationInput,
|
|
22089
22149
|
InputGroup: InputGroup,
|
|
22090
22150
|
transform: transform$3,
|
|
22091
22151
|
MoneyInput: MoneyInput,
|
|
@@ -22777,6 +22837,34 @@ const AddressParser = ({
|
|
|
22777
22837
|
}));
|
|
22778
22838
|
};
|
|
22779
22839
|
|
|
22840
|
+
const styles$a = createStyles({
|
|
22841
|
+
grow: {
|
|
22842
|
+
flexGrow: 1
|
|
22843
|
+
},
|
|
22844
|
+
stateWrapper: {
|
|
22845
|
+
"@media (max-width: 375px)": {
|
|
22846
|
+
flex: "1 0 100%"
|
|
22847
|
+
},
|
|
22848
|
+
display: "flex",
|
|
22849
|
+
flex: "1 0 66%",
|
|
22850
|
+
width: "100%"
|
|
22851
|
+
},
|
|
22852
|
+
stateZipWrapper: theme => ({
|
|
22853
|
+
"@media (max-width: 375px)": {
|
|
22854
|
+
flexDirection: "column",
|
|
22855
|
+
gap: 0
|
|
22856
|
+
},
|
|
22857
|
+
display: "flex",
|
|
22858
|
+
flexDirection: "row",
|
|
22859
|
+
gap: theme.spacing(2),
|
|
22860
|
+
width: "100%"
|
|
22861
|
+
}),
|
|
22862
|
+
zipWrapper: {
|
|
22863
|
+
display: "flex",
|
|
22864
|
+
width: "100%"
|
|
22865
|
+
}
|
|
22866
|
+
});
|
|
22867
|
+
|
|
22780
22868
|
const AddressFields = ({
|
|
22781
22869
|
domestic,
|
|
22782
22870
|
form,
|
|
@@ -22810,21 +22898,6 @@ const AddressFields = ({
|
|
|
22810
22898
|
labelWeight: "normal",
|
|
22811
22899
|
name: _formatFieldName("companyName"),
|
|
22812
22900
|
nativeLabel: true
|
|
22813
|
-
}), jsx(Select, {
|
|
22814
|
-
control: form.control,
|
|
22815
|
-
form: formId,
|
|
22816
|
-
label: t("address.fields.countryCode"),
|
|
22817
|
-
labelWeight: "normal",
|
|
22818
|
-
name: _formatFieldName("countryCode"),
|
|
22819
|
-
nativeLabel: true,
|
|
22820
|
-
onChange: e => {
|
|
22821
|
-
if (typeof e === "string") {
|
|
22822
|
-
form.setValue(_formatFieldName("stateProvince"), null, {
|
|
22823
|
-
shouldValidate: isSubmitted
|
|
22824
|
-
});
|
|
22825
|
-
}
|
|
22826
|
-
},
|
|
22827
|
-
options: countryCodeOptions
|
|
22828
22901
|
}), jsx(TextInput, {
|
|
22829
22902
|
control: form.control,
|
|
22830
22903
|
form: formId,
|
|
@@ -22847,24 +22920,29 @@ const AddressFields = ({
|
|
|
22847
22920
|
labelWeight: "normal",
|
|
22848
22921
|
name: _formatFieldName("cityLocality"),
|
|
22849
22922
|
nativeLabel: true
|
|
22923
|
+
}), jsx(Select, {
|
|
22924
|
+
control: form.control,
|
|
22925
|
+
form: formId,
|
|
22926
|
+
label: t("address.fields.countryCode"),
|
|
22927
|
+
labelWeight: "normal",
|
|
22928
|
+
name: _formatFieldName("countryCode"),
|
|
22929
|
+
nativeLabel: true,
|
|
22930
|
+
onChange: e => {
|
|
22931
|
+
if (typeof e === "string") {
|
|
22932
|
+
form.setValue(_formatFieldName("stateProvince"), null, {
|
|
22933
|
+
shouldValidate: isSubmitted
|
|
22934
|
+
});
|
|
22935
|
+
}
|
|
22936
|
+
},
|
|
22937
|
+
options: countryCodeOptions
|
|
22850
22938
|
}), jsxs("div", Object.assign({
|
|
22851
|
-
css:
|
|
22852
|
-
display: "flex",
|
|
22853
|
-
gap: theme.spacing(2),
|
|
22854
|
-
width: "100%"
|
|
22855
|
-
})
|
|
22939
|
+
css: styles$a.stateZipWrapper
|
|
22856
22940
|
}, {
|
|
22857
22941
|
children: [jsx("div", Object.assign({
|
|
22858
|
-
css:
|
|
22859
|
-
display: "flex",
|
|
22860
|
-
flex: "1 0 66%",
|
|
22861
|
-
width: "100%"
|
|
22862
|
-
}
|
|
22942
|
+
css: styles$a.stateWrapper
|
|
22863
22943
|
}, {
|
|
22864
22944
|
children: jsx("div", Object.assign({
|
|
22865
|
-
css:
|
|
22866
|
-
flexGrow: 1
|
|
22867
|
-
}
|
|
22945
|
+
css: styles$a.grow
|
|
22868
22946
|
}, {
|
|
22869
22947
|
children: watchCountryCode === "US" ?
|
|
22870
22948
|
// Domestic States
|
|
@@ -22888,15 +22966,10 @@ const AddressFields = ({
|
|
|
22888
22966
|
})
|
|
22889
22967
|
}))
|
|
22890
22968
|
})), jsx("div", Object.assign({
|
|
22891
|
-
css:
|
|
22892
|
-
display: "flex",
|
|
22893
|
-
width: "100%"
|
|
22894
|
-
}
|
|
22969
|
+
css: styles$a.zipWrapper
|
|
22895
22970
|
}, {
|
|
22896
22971
|
children: jsx("div", Object.assign({
|
|
22897
|
-
css:
|
|
22898
|
-
flexGrow: 1
|
|
22899
|
-
}
|
|
22972
|
+
css: styles$a.grow
|
|
22900
22973
|
}, {
|
|
22901
22974
|
children: jsx(TextInput, {
|
|
22902
22975
|
control: form.control,
|
|
@@ -23124,7 +23197,7 @@ const AddressForm = ({
|
|
|
23124
23197
|
}));
|
|
23125
23198
|
};
|
|
23126
23199
|
|
|
23127
|
-
const styles$
|
|
23200
|
+
const styles$9 = createStyles({
|
|
23128
23201
|
agreement: {
|
|
23129
23202
|
alignItems: "center",
|
|
23130
23203
|
display: "flex",
|
|
@@ -23194,10 +23267,10 @@ const DisplayCarrierTerms = c => {
|
|
|
23194
23267
|
const listCarrierLinks = () => {
|
|
23195
23268
|
return c.carrierTerms.links.map((term, index) => {
|
|
23196
23269
|
return jsx("li", Object.assign({
|
|
23197
|
-
css: styles$
|
|
23270
|
+
css: styles$9.listItems
|
|
23198
23271
|
}, {
|
|
23199
23272
|
children: jsx(Link, Object.assign({
|
|
23200
|
-
css: styles$
|
|
23273
|
+
css: styles$9.link,
|
|
23201
23274
|
href: term.url,
|
|
23202
23275
|
isExternal: true,
|
|
23203
23276
|
target: "_blank"
|
|
@@ -23213,18 +23286,18 @@ const DisplayCarrierTerms = c => {
|
|
|
23213
23286
|
};
|
|
23214
23287
|
const listCarrierTerms = () => {
|
|
23215
23288
|
return jsxs("div", Object.assign({
|
|
23216
|
-
css: styles$
|
|
23289
|
+
css: styles$9.terms
|
|
23217
23290
|
}, {
|
|
23218
23291
|
children: [jsx(Typography, Object.assign({
|
|
23219
23292
|
variant: "subtitle1"
|
|
23220
23293
|
}, {
|
|
23221
23294
|
children: c.carrierTerms.title
|
|
23222
23295
|
})), jsx("div", Object.assign({
|
|
23223
|
-
css: styles$
|
|
23296
|
+
css: styles$9.terms
|
|
23224
23297
|
}, {
|
|
23225
23298
|
children: listCarrierContent()
|
|
23226
23299
|
})), jsx("ul", Object.assign({
|
|
23227
|
-
css: styles$
|
|
23300
|
+
css: styles$9.links
|
|
23228
23301
|
}, {
|
|
23229
23302
|
children: listCarrierLinks()
|
|
23230
23303
|
}))]
|
|
@@ -23454,7 +23527,7 @@ const AddressDisplay = ({
|
|
|
23454
23527
|
}));
|
|
23455
23528
|
};
|
|
23456
23529
|
|
|
23457
|
-
const styles$
|
|
23530
|
+
const styles$8 = createStyles({
|
|
23458
23531
|
container: theme => ({
|
|
23459
23532
|
display: "flex",
|
|
23460
23533
|
gap: theme.spacing()
|
|
@@ -23492,13 +23565,13 @@ const Disclosure = ({
|
|
|
23492
23565
|
}, [open]);
|
|
23493
23566
|
return jsxs(Fragment, {
|
|
23494
23567
|
children: [jsxs("div", Object.assign({
|
|
23495
|
-
css: styles$
|
|
23568
|
+
css: styles$8.container
|
|
23496
23569
|
}, {
|
|
23497
23570
|
children: [jsx("div", {
|
|
23498
23571
|
children: label
|
|
23499
23572
|
}), _showToggle && jsx("button", Object.assign({
|
|
23500
23573
|
"aria-expanded": isOpen,
|
|
23501
|
-
css: styles$
|
|
23574
|
+
css: styles$8.toggle,
|
|
23502
23575
|
onClick: () => {
|
|
23503
23576
|
setIsOpen(!isOpen);
|
|
23504
23577
|
onToggle(!isOpen);
|
|
@@ -23506,12 +23579,12 @@ const Disclosure = ({
|
|
|
23506
23579
|
type: "button"
|
|
23507
23580
|
}, {
|
|
23508
23581
|
children: jsx(Icon, {
|
|
23509
|
-
css: styles$
|
|
23582
|
+
css: styles$8.icon,
|
|
23510
23583
|
name: isOpen ? IconNames.CHEVRON_TOP : IconNames.CHEVRON_BOTTOM
|
|
23511
23584
|
})
|
|
23512
23585
|
}))]
|
|
23513
23586
|
})), isOpen && jsx("div", Object.assign({
|
|
23514
|
-
css: styles$
|
|
23587
|
+
css: styles$8.content
|
|
23515
23588
|
}, {
|
|
23516
23589
|
children: typeof children === "function" ? children(() => setIsOpen(!isOpen)) : children
|
|
23517
23590
|
}))]
|
|
@@ -23651,7 +23724,7 @@ const getCarrierRecoverySchema = requiresAddress => z.object({
|
|
|
23651
23724
|
address: requiresAddress ? baseSchema : baseSchema.optional()
|
|
23652
23725
|
});
|
|
23653
23726
|
|
|
23654
|
-
const styles$
|
|
23727
|
+
const styles$7 = createStyles({
|
|
23655
23728
|
grid: theme => ({
|
|
23656
23729
|
margin: theme.spacing(4)
|
|
23657
23730
|
}),
|
|
@@ -23694,50 +23767,28 @@ const CarrierRecoveryForm = ({
|
|
|
23694
23767
|
onSubmit: formLogger.capture(handleSubmit)
|
|
23695
23768
|
}, {
|
|
23696
23769
|
children: jsxs(Grid, Object.assign({
|
|
23697
|
-
css: styles$
|
|
23698
|
-
noPadding: true
|
|
23699
|
-
}, {
|
|
23700
|
-
children: [
|
|
23701
|
-
colSpan: 12
|
|
23702
|
-
}, {
|
|
23703
|
-
children: jsx(InlineNotification, Object.assign({
|
|
23704
|
-
title: t("register-wallet:sections.notifications.carrier.title", {
|
|
23705
|
-
carrierFriendlyName
|
|
23706
|
-
}),
|
|
23707
|
-
type: requiresAddress ? NotificationType.ERROR : NotificationType.ALERT
|
|
23708
|
-
}, {
|
|
23709
|
-
children: [address && t("register-wallet:sections.notifications.carrier.confirmAddress"), t("register-wallet:sections.notifications.carrier.description", {
|
|
23710
|
-
carrierFriendlyName
|
|
23711
|
-
})].join(" ")
|
|
23712
|
-
}))
|
|
23713
|
-
})), requiresAddress && jsxs(Fragment, {
|
|
23770
|
+
css: styles$7.grid,
|
|
23771
|
+
noPadding: true
|
|
23772
|
+
}, {
|
|
23773
|
+
children: [requiresAddress && jsxs(Fragment, {
|
|
23714
23774
|
children: [jsx(GridChild, Object.assign({
|
|
23715
23775
|
colSpan: 12
|
|
23716
23776
|
}, {
|
|
23717
23777
|
children: jsx(Typography, Object.assign({
|
|
23718
|
-
css: styles$
|
|
23778
|
+
css: styles$7.heading,
|
|
23719
23779
|
variant: "heading4"
|
|
23720
23780
|
}, {
|
|
23721
23781
|
children: t("register-wallet:sections.carriers.title")
|
|
23722
23782
|
}))
|
|
23723
23783
|
})), jsx(GridChild, Object.assign({
|
|
23724
23784
|
colSpan: 12,
|
|
23725
|
-
css: styles$
|
|
23785
|
+
css: styles$7.subtitle
|
|
23726
23786
|
}, {
|
|
23727
23787
|
children: jsx(Typography, Object.assign({
|
|
23728
23788
|
variant: "subtitle1"
|
|
23729
23789
|
}, {
|
|
23730
23790
|
children: t("register-wallet:sections.carriers.subtitle")
|
|
23731
23791
|
}))
|
|
23732
|
-
})), jsx(GridChild, Object.assign({
|
|
23733
|
-
colSpan: 12,
|
|
23734
|
-
"data-testid": "address-fields"
|
|
23735
|
-
}, {
|
|
23736
|
-
children: jsx(AddressFields, {
|
|
23737
|
-
form: form,
|
|
23738
|
-
formatFieldName: fieldName => `address.${fieldName}`,
|
|
23739
|
-
optionalFields: ["addressLine2"]
|
|
23740
|
-
})
|
|
23741
23792
|
}))]
|
|
23742
23793
|
}), !!(errors === null || errors === void 0 ? void 0 : errors.length) && jsx(GridChild, Object.assign({
|
|
23743
23794
|
colSpan: 12
|
|
@@ -23752,6 +23803,15 @@ const CarrierRecoveryForm = ({
|
|
|
23752
23803
|
message
|
|
23753
23804
|
}) => message).join(" ")
|
|
23754
23805
|
}))
|
|
23806
|
+
})), requiresAddress && jsx(GridChild, Object.assign({
|
|
23807
|
+
colSpan: 12,
|
|
23808
|
+
"data-testid": "address-fields"
|
|
23809
|
+
}, {
|
|
23810
|
+
children: jsx(AddressFields, {
|
|
23811
|
+
form: form,
|
|
23812
|
+
formatFieldName: fieldName => `address.${fieldName}`,
|
|
23813
|
+
optionalFields: ["addressLine2"]
|
|
23814
|
+
})
|
|
23755
23815
|
})), jsx(GridChild, Object.assign({
|
|
23756
23816
|
colSpan: 12
|
|
23757
23817
|
}, {
|
|
@@ -23783,76 +23843,6 @@ const carrierTermsFormSchema = z.object({
|
|
|
23783
23843
|
agreement: z.literal(true)
|
|
23784
23844
|
});
|
|
23785
23845
|
|
|
23786
|
-
/**
|
|
23787
|
-
* TODO: Temporary component (replace with carrier metadata)
|
|
23788
|
-
*/
|
|
23789
|
-
const CarrierTerms = ({
|
|
23790
|
-
carrierCode
|
|
23791
|
-
}) => {
|
|
23792
|
-
const upsLinks = [{
|
|
23793
|
-
text: "UPS Promotional Rates Agreement",
|
|
23794
|
-
url: "https://www.ups.com/assets/resources/media/en_US/CQF_US.pdf"
|
|
23795
|
-
}, {
|
|
23796
|
-
text: "UPS Technology Agreement",
|
|
23797
|
-
url: "https://www.ups.com/assets/resources/media/en_US/UTA.pdf"
|
|
23798
|
-
}, {
|
|
23799
|
-
text: "List of Prohibited Articles",
|
|
23800
|
-
url: "https://www.ups.com/kn/en/help-center/shipping-support/prohibited-items.page"
|
|
23801
|
-
}];
|
|
23802
|
-
switch (carrierCode) {
|
|
23803
|
-
case "ups":
|
|
23804
|
-
return jsxs("div", Object.assign({
|
|
23805
|
-
css: styles$b.terms
|
|
23806
|
-
}, {
|
|
23807
|
-
children: [jsx(Typography, Object.assign({
|
|
23808
|
-
variant: "subtitle1"
|
|
23809
|
-
}, {
|
|
23810
|
-
children: "UPS Promotional Rates and Technology Agreements"
|
|
23811
|
-
})), jsx(Typography, Object.assign({
|
|
23812
|
-
variant: "body1"
|
|
23813
|
-
}, {
|
|
23814
|
-
children: "I have read and agree to the Terms and Conditions and the Privacy Policy, and I confirm that information I have provided is accurate and truthful."
|
|
23815
|
-
})), jsx(Typography, Object.assign({
|
|
23816
|
-
variant: "body1"
|
|
23817
|
-
}, {
|
|
23818
|
-
children: "To start shipping with UPS, you must first agree to the following:"
|
|
23819
|
-
})), jsx(Typography, Object.assign({
|
|
23820
|
-
variant: "body1"
|
|
23821
|
-
}, {
|
|
23822
|
-
children: "UPS, the UPS brandmark, UPS Ready, and the color brown are trademarks of the United Parcel Service of America, Inc. All Rights Reserved."
|
|
23823
|
-
})), jsx("ul", {
|
|
23824
|
-
children: upsLinks.map(({
|
|
23825
|
-
text,
|
|
23826
|
-
url
|
|
23827
|
-
}, idx) => jsx("li", Object.assign({
|
|
23828
|
-
css: styles$b.listItems
|
|
23829
|
-
}, {
|
|
23830
|
-
children: jsx(Link, Object.assign({
|
|
23831
|
-
href: url,
|
|
23832
|
-
isExternal: true,
|
|
23833
|
-
rel: "noreferrer",
|
|
23834
|
-
target: "_blank"
|
|
23835
|
-
}, {
|
|
23836
|
-
children: jsx(Typography, Object.assign({
|
|
23837
|
-
variant: "body1"
|
|
23838
|
-
}, {
|
|
23839
|
-
children: text
|
|
23840
|
-
}))
|
|
23841
|
-
}))
|
|
23842
|
-
}), idx))
|
|
23843
|
-
})]
|
|
23844
|
-
}));
|
|
23845
|
-
case "usps":
|
|
23846
|
-
case "stamps_com":
|
|
23847
|
-
return jsx(Typography, Object.assign({
|
|
23848
|
-
variant: "subtitle1"
|
|
23849
|
-
}, {
|
|
23850
|
-
children: "USPS Promotional Rates and Technology Agreements"
|
|
23851
|
-
}));
|
|
23852
|
-
default:
|
|
23853
|
-
return null;
|
|
23854
|
-
}
|
|
23855
|
-
};
|
|
23856
23846
|
const CarrierTermsForm = ({
|
|
23857
23847
|
carrierCodes,
|
|
23858
23848
|
onSubmit
|
|
@@ -23862,6 +23852,11 @@ const CarrierTermsForm = ({
|
|
|
23862
23852
|
} = useTranslation(["common"]);
|
|
23863
23853
|
const metadatas = useCarrierMetadata(carrierCodes);
|
|
23864
23854
|
const [showTerms, setShowTerms] = useState(false);
|
|
23855
|
+
const terms = metadatas.filter(({
|
|
23856
|
+
terms
|
|
23857
|
+
}) => terms).map(({
|
|
23858
|
+
terms
|
|
23859
|
+
}) => terms);
|
|
23865
23860
|
const form = useForm({
|
|
23866
23861
|
defaultValues: {
|
|
23867
23862
|
agreement: false
|
|
@@ -23873,7 +23868,7 @@ const CarrierTermsForm = ({
|
|
|
23873
23868
|
onSubmit(payload.agreement);
|
|
23874
23869
|
}));
|
|
23875
23870
|
return jsxs("div", Object.assign({
|
|
23876
|
-
css: styles$
|
|
23871
|
+
css: styles$9.termsForm,
|
|
23877
23872
|
"data-testid": "carrier-terms-form"
|
|
23878
23873
|
}, {
|
|
23879
23874
|
children: [jsx(Typography, Object.assign({
|
|
@@ -23889,7 +23884,7 @@ const CarrierTermsForm = ({
|
|
|
23889
23884
|
})), jsx(Spacer, {
|
|
23890
23885
|
multiplier: 1
|
|
23891
23886
|
}), jsx("div", Object.assign({
|
|
23892
|
-
css: styles$
|
|
23887
|
+
css: styles$9.carrierLogos
|
|
23893
23888
|
}, {
|
|
23894
23889
|
children: metadatas.map(({
|
|
23895
23890
|
name,
|
|
@@ -23905,7 +23900,7 @@ const CarrierTermsForm = ({
|
|
|
23905
23900
|
onSubmit: formLogger.capture(handleSubmit)
|
|
23906
23901
|
}, {
|
|
23907
23902
|
children: jsxs("div", Object.assign({
|
|
23908
|
-
css: styles$
|
|
23903
|
+
css: styles$9.agreement
|
|
23909
23904
|
}, {
|
|
23910
23905
|
children: [jsx("div", {
|
|
23911
23906
|
children: jsx(CheckboxInput, {
|
|
@@ -23918,7 +23913,7 @@ const CarrierTermsForm = ({
|
|
|
23918
23913
|
"data-testid": "terms-link",
|
|
23919
23914
|
onClick: e => {
|
|
23920
23915
|
e.preventDefault();
|
|
23921
|
-
setShowTerms(
|
|
23916
|
+
setShowTerms(prev => !prev);
|
|
23922
23917
|
},
|
|
23923
23918
|
role: "button"
|
|
23924
23919
|
})
|
|
@@ -23932,22 +23927,12 @@ const CarrierTermsForm = ({
|
|
|
23932
23927
|
name: "agreement"
|
|
23933
23928
|
})
|
|
23934
23929
|
}), showTerms && jsxs("div", Object.assign({
|
|
23935
|
-
css: styles$
|
|
23930
|
+
css: styles$9.well
|
|
23936
23931
|
}, {
|
|
23937
|
-
children: [
|
|
23938
|
-
|
|
23939
|
-
}, {
|
|
23940
|
-
|
|
23941
|
-
variant: "heading5"
|
|
23942
|
-
}, {
|
|
23943
|
-
children: t("carriers.terms.title")
|
|
23944
|
-
})), metadatas.map(({
|
|
23945
|
-
carrierCode
|
|
23946
|
-
}) => jsx(CarrierTerms, {
|
|
23947
|
-
carrierCode: carrierCode
|
|
23948
|
-
}, carrierCode))]
|
|
23949
|
-
})), jsx("div", Object.assign({
|
|
23950
|
-
css: styles$b.close
|
|
23932
|
+
children: [terms.map((t, idx) => jsx(DisplayCarrierTerms, {
|
|
23933
|
+
carrierTerms: t
|
|
23934
|
+
}, idx)), jsx("div", Object.assign({
|
|
23935
|
+
css: styles$9.close
|
|
23951
23936
|
}, {
|
|
23952
23937
|
children: jsx(Button, Object.assign({
|
|
23953
23938
|
onClick: () => setShowTerms(false),
|
|
@@ -24335,7 +24320,7 @@ const LandingPageForm = ({
|
|
|
24335
24320
|
}));
|
|
24336
24321
|
};
|
|
24337
24322
|
|
|
24338
|
-
const styles$
|
|
24323
|
+
const styles$6 = createStyles({
|
|
24339
24324
|
container: theme => ({
|
|
24340
24325
|
padding: theme.spacing(2)
|
|
24341
24326
|
}),
|
|
@@ -24345,7 +24330,8 @@ const styles$8 = createStyles({
|
|
|
24345
24330
|
header: {
|
|
24346
24331
|
alignItems: "center",
|
|
24347
24332
|
display: "flex",
|
|
24348
|
-
flexDirection: "column"
|
|
24333
|
+
flexDirection: "column",
|
|
24334
|
+
textAlign: "center"
|
|
24349
24335
|
}
|
|
24350
24336
|
});
|
|
24351
24337
|
|
|
@@ -24356,11 +24342,11 @@ const LandingPage = ({
|
|
|
24356
24342
|
t
|
|
24357
24343
|
} = useTranslation();
|
|
24358
24344
|
return jsxs("div", Object.assign({
|
|
24359
|
-
css: styles$
|
|
24345
|
+
css: styles$6.container,
|
|
24360
24346
|
"data-testid": "landing-page"
|
|
24361
24347
|
}, {
|
|
24362
24348
|
children: [jsxs("div", Object.assign({
|
|
24363
|
-
css: styles$
|
|
24349
|
+
css: styles$6.header
|
|
24364
24350
|
}, {
|
|
24365
24351
|
children: [jsx(Typography, Object.assign({
|
|
24366
24352
|
variant: "heading4"
|
|
@@ -24378,7 +24364,7 @@ const LandingPage = ({
|
|
|
24378
24364
|
})), jsx(LandingPageForm, {
|
|
24379
24365
|
onSubmit: onSubmit
|
|
24380
24366
|
}), jsxs("div", Object.assign({
|
|
24381
|
-
css: styles$
|
|
24367
|
+
css: styles$6.header
|
|
24382
24368
|
}, {
|
|
24383
24369
|
children: [jsx(Spacer, {
|
|
24384
24370
|
multiplier: 6
|
|
@@ -24389,7 +24375,7 @@ const LandingPage = ({
|
|
|
24389
24375
|
})), jsx(Spacer, {
|
|
24390
24376
|
multiplier: 2
|
|
24391
24377
|
}), jsx(Typography, Object.assign({
|
|
24392
|
-
css: styles$
|
|
24378
|
+
css: styles$6.description,
|
|
24393
24379
|
variant: "body1"
|
|
24394
24380
|
}, {
|
|
24395
24381
|
children: t("onboarding:landing.description")
|
|
@@ -24470,18 +24456,17 @@ const Accordion = _a => {
|
|
|
24470
24456
|
});
|
|
24471
24457
|
};
|
|
24472
24458
|
|
|
24473
|
-
const
|
|
24474
|
-
|
|
24475
|
-
|
|
24476
|
-
}
|
|
24459
|
+
const getStyles$4 = (isConnected = false) => createStyles({
|
|
24460
|
+
connectButton: theme => [{
|
|
24461
|
+
padding: `0 ${theme.spacing(.5)}px`
|
|
24462
|
+
}, isConnected && {
|
|
24463
|
+
backgroundColor: theme.palette.success.main,
|
|
24464
|
+
color: theme.palette.white
|
|
24465
|
+
}],
|
|
24477
24466
|
container: {
|
|
24478
24467
|
display: "flex",
|
|
24479
24468
|
flexDirection: "column"
|
|
24480
24469
|
},
|
|
24481
|
-
loadingButtonContainer: {
|
|
24482
|
-
alignItems: "center",
|
|
24483
|
-
display: "flex"
|
|
24484
|
-
},
|
|
24485
24470
|
logoContainer: theme => ({
|
|
24486
24471
|
alignItems: "center",
|
|
24487
24472
|
columnGap: `${theme.spacing(1)}px`,
|
|
@@ -24492,31 +24477,6 @@ const styles$7 = createStyles({
|
|
|
24492
24477
|
display: "flex",
|
|
24493
24478
|
justifyContent: "space-between",
|
|
24494
24479
|
padding: `${theme.spacing(2)}px`
|
|
24495
|
-
}),
|
|
24496
|
-
statusChipConnected: theme => ({
|
|
24497
|
-
alignItems: 'center',
|
|
24498
|
-
background: theme.palette.success.main,
|
|
24499
|
-
borderRadius: theme.borderRadius.S,
|
|
24500
|
-
color: theme.palette.white,
|
|
24501
|
-
display: 'flex',
|
|
24502
|
-
flex: 'none',
|
|
24503
|
-
flexDirection: 'row',
|
|
24504
|
-
fontSize: theme.typography.fontSize.S,
|
|
24505
|
-
fontWeight: theme.typography.fontWeight.bold,
|
|
24506
|
-
gap: `${theme.spacing(1)}px}`,
|
|
24507
|
-
height: '20px',
|
|
24508
|
-
justifyContent: 'center',
|
|
24509
|
-
lineHeight: `${theme.spacing(2.5)} px`,
|
|
24510
|
-
order: '0',
|
|
24511
|
-
padding: `${theme.spacing(.5)} px`,
|
|
24512
|
-
width: '81px'
|
|
24513
|
-
}),
|
|
24514
|
-
statusChipNotConnected: theme => ({
|
|
24515
|
-
background: 'none',
|
|
24516
|
-
color: theme.palette.secondary.main,
|
|
24517
|
-
fontSize: theme.typography.fontSize.M,
|
|
24518
|
-
fontWeight: theme.typography.fontWeight.bold,
|
|
24519
|
-
lineHeight: `${theme.spacing(3)} px`
|
|
24520
24480
|
})
|
|
24521
24481
|
});
|
|
24522
24482
|
|
|
@@ -24527,7 +24487,7 @@ var _ref$1 = process.env.NODE_ENV === "production" ? {
|
|
|
24527
24487
|
} : {
|
|
24528
24488
|
name: "111ty02-css",
|
|
24529
24489
|
styles: "align-items:center;display:flex;label:css;",
|
|
24530
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
24490
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpc3QtY2FycmllcnMtcm93LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFtQmllIiwiZmlsZSI6Imxpc3QtY2FycmllcnMtcm93LnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IF9fYXdhaXRlciB9IGZyb20gXCJ0c2xpYlwiO1xyXG5pbXBvcnQgeyBqc3ggYXMgX2pzeCwganN4cyBhcyBfanN4cyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdC9qc3gtcnVudGltZVwiO1xyXG5pbXBvcnQgeyBjc3MgfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3RcIjtcclxuaW1wb3J0IHsgdXNlU3RhdGUgfSBmcm9tIFwicmVhY3RcIjtcclxuaW1wb3J0IHsgdXNlVHJhbnNsYXRpb24gfSBmcm9tIFwicmVhY3QtaTE4bmV4dFwiO1xyXG5pbXBvcnQgeyBCdXR0b24sIEJ1dHRvbkNvbG9yLCBCdXR0b25WYXJpYW50LCBUeXBvZ3JhcGh5IH0gZnJvbSBcIkBwYWNrbGluay9naWdlclwiO1xyXG5pbXBvcnQgeyBUZW1wbGF0ZXMgfSBmcm9tIFwiLi4vLi4vLi4vY29tcG9uZW50c1wiO1xyXG5pbXBvcnQgeyBnZXRTdHlsZXMgfSBmcm9tIFwiLi9saXN0LWNhcnJpZXJzLXJvdy5zdHlsZXNcIjtcclxuZXhwb3J0IGNvbnN0IExpc3RDYXJyaWVyc1JvdyA9ICh7IGNvbm5lY3RlZENhcnJpZXI6IHsgY2FycmllciwgaXNDb25uZWN0ZWQgfSwgcmVnaXN0ZXJDYXJyaWVyLCByZWdpc3RlckNhcnJpZXJFcnJvcnMsIH0pID0+IHtcclxuICAgIGNvbnN0IHsgc2hvcnRuYW1lOiBuYW1lLCBsb2dvLCByZXF1aXJlZEZpZWxkcyB9ID0gY2FycmllcjtcclxuICAgIGNvbnN0IHsgdCB9ID0gdXNlVHJhbnNsYXRpb24oW1wibGlzdC1jYXJyaWVyc1wiXSk7XHJcbiAgICBjb25zdCBbc2hvd0Ryb3BEb3duLCBzZXRTaG93RHJvcERvd25dID0gdXNlU3RhdGUoZmFsc2UpO1xyXG4gICAgY29uc3QgW2lzU3VibWl0dGluZywgc2V0SXNTdWJtaXR0aW5nXSA9IHVzZVN0YXRlKGZhbHNlKTtcclxuICAgIGNvbnN0IGhhbmRsZVJlZ2lzdGVyID0gKHZhbHVlcykgPT4gX19hd2FpdGVyKHZvaWQgMCwgdm9pZCAwLCB2b2lkIDAsIGZ1bmN0aW9uKiAoKSB7XHJcbiAgICAgICAgc2V0SXNTdWJtaXR0aW5nKHRydWUpO1xyXG4gICAgICAgIHlpZWxkIHJlZ2lzdGVyQ2Fycmllcih2YWx1ZXMpO1xyXG4gICAgICAgIHNob3dEcm9wRG93biAmJiBzZXRTaG93RHJvcERvd24oZmFsc2UpO1xyXG4gICAgICAgIHNldElzU3VibWl0dGluZyhmYWxzZSk7XHJcbiAgICB9KTtcclxuICAgIHJldHVybiAoX2pzeHMoXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNzczogZ2V0U3R5bGVzKCkuY29udGFpbmVyLCBcImRhdGEtdGVzdGlkXCI6IFwiY2Fycmllci1yb3dcIiB9LCB7IGNoaWxkcmVuOiBbX2pzeHMoXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNzczogZ2V0U3R5bGVzKCkucm93Q29udGFpbmVyIH0sIHsgY2hpbGRyZW46IFtfanN4cyhcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY3NzOiBnZXRTdHlsZXMoKS5sb2dvQ29udGFpbmVyIH0sIHsgY2hpbGRyZW46IFtfanN4KFwiZGl2XCIsIHsgY2hpbGRyZW46IF9qc3goXCJpbWdcIiwgeyBhbHQ6IGAke25hbWV9LWxvZ29gLCBoZWlnaHQ6IDQwLCBzcmM6IGxvZ28sIHdpZHRoOiA0MCB9KSB9KSwgX2pzeChUeXBvZ3JhcGh5LCBPYmplY3QuYXNzaWduKHsgdmFyaWFudDogXCJzdWJ0aXRsZTFcIiB9LCB7IGNoaWxkcmVuOiBuYW1lIH0pKV0gfSkpLCBfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IGNzcyh7IGFsaWduSXRlbXM6IFwiY2VudGVyXCIsIGRpc3BsYXk6IFwiZmxleFwiIH0pIH0sIHsgY2hpbGRyZW46IF9qc3goQnV0dG9uLCBPYmplY3QuYXNzaWduKHsgY29sb3I6IEJ1dHRvbkNvbG9yLlNFQ09OREFSWSwgY3NzOiBnZXRTdHlsZXMoaXNDb25uZWN0ZWQpLmNvbm5lY3RCdXR0b24sIGRpc2FibGVkOiBpc0Nvbm5lY3RlZCB8fCBzaG93RHJvcERvd24sIGlzTG9hZGluZzogaXNTdWJtaXR0aW5nLCBvbkNsaWNrOiAoKSA9PiBfX2F3YWl0ZXIodm9pZCAwLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVxdWlyZWRGaWVsZHMgPT09IG51bGwgfHwgcmVxdWlyZWRGaWVsZHMgPT09IHZvaWQgMCA/IHZvaWQgMCA6IHJlcXVpcmVkRmllbGRzLmluY2x1ZGVzKFwiYWRkcmVzc1wiKSlcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd0Ryb3BEb3duKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2VcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeWllbGQgaGFuZGxlUmVnaXN0ZXIoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB2YXJpYW50OiBCdXR0b25WYXJpYW50LlRFWFQgfSwgeyBjaGlsZHJlbjogaXNDb25uZWN0ZWRcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IHQoXCJsaXN0LWNhcnJpZXJzOmFjdGlvbnMuc3RhdHVzLmNvbm5lY3RlZFwiKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogdChcImxpc3QtY2FycmllcnM6YWN0aW9ucy5zdGF0dXMubm90Q29ubmVjdGVkXCIpIH0pKSB9KSldIH0pKSwgc2hvd0Ryb3BEb3duICYmIChfanN4KFRlbXBsYXRlcy5BZGRDYXJyaWVyRm9ybSwgeyBjYXJyaWVyVGVybXM6IGNhcnJpZXIudGVybXMgJiYgY2Fycmllci50ZXJtcywgb25DYW5jZWw6ICgpID0+IHNldFNob3dEcm9wRG93bihmYWxzZSksIG9uU3VibWl0OiAodmFsdWVzKSA9PiBoYW5kbGVSZWdpc3Rlcih2YWx1ZXMpLCByZWdpc3RlckNhcnJpZXJFcnJvcnM6IHJlZ2lzdGVyQ2FycmllckVycm9ycyB9KSldIH0pKSk7XHJcbn07XHJcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPWxpc3QtY2FycmllcnMtcm93LmpzLm1hcCJdfQ== */",
|
|
24531
24491
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$2
|
|
24532
24492
|
};
|
|
24533
24493
|
const ListCarriersRow = ({
|
|
@@ -24539,7 +24499,7 @@ const ListCarriersRow = ({
|
|
|
24539
24499
|
registerCarrierErrors
|
|
24540
24500
|
}) => {
|
|
24541
24501
|
const {
|
|
24542
|
-
name,
|
|
24502
|
+
shortname: name,
|
|
24543
24503
|
logo,
|
|
24544
24504
|
requiredFields
|
|
24545
24505
|
} = carrier;
|
|
@@ -24555,20 +24515,21 @@ const ListCarriersRow = ({
|
|
|
24555
24515
|
setIsSubmitting(false);
|
|
24556
24516
|
});
|
|
24557
24517
|
return jsxs("div", Object.assign({
|
|
24558
|
-
css:
|
|
24518
|
+
css: getStyles$4().container,
|
|
24519
|
+
"data-testid": "carrier-row"
|
|
24559
24520
|
}, {
|
|
24560
24521
|
children: [jsxs("div", Object.assign({
|
|
24561
|
-
css:
|
|
24522
|
+
css: getStyles$4().rowContainer
|
|
24562
24523
|
}, {
|
|
24563
24524
|
children: [jsxs("div", Object.assign({
|
|
24564
|
-
css:
|
|
24525
|
+
css: getStyles$4().logoContainer
|
|
24565
24526
|
}, {
|
|
24566
24527
|
children: [jsx("div", {
|
|
24567
24528
|
children: jsx("img", {
|
|
24568
24529
|
alt: `${name}-logo`,
|
|
24569
|
-
height:
|
|
24530
|
+
height: 40,
|
|
24570
24531
|
src: logo,
|
|
24571
|
-
width:
|
|
24532
|
+
width: 40
|
|
24572
24533
|
})
|
|
24573
24534
|
}), jsx(Typography, Object.assign({
|
|
24574
24535
|
variant: "subtitle1"
|
|
@@ -24579,6 +24540,8 @@ const ListCarriersRow = ({
|
|
|
24579
24540
|
css: _ref$1
|
|
24580
24541
|
}, {
|
|
24581
24542
|
children: jsx(Button, Object.assign({
|
|
24543
|
+
color: ButtonColor.SECONDARY,
|
|
24544
|
+
css: getStyles$4(isConnected).connectButton,
|
|
24582
24545
|
disabled: isConnected || showDropDown,
|
|
24583
24546
|
isLoading: isSubmitting,
|
|
24584
24547
|
onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -24598,7 +24561,7 @@ const ListCarriersRow = ({
|
|
|
24598
24561
|
}));
|
|
24599
24562
|
};
|
|
24600
24563
|
|
|
24601
|
-
const styles$
|
|
24564
|
+
const styles$5 = createStyles({
|
|
24602
24565
|
listContainer: theme => ({
|
|
24603
24566
|
"& > li:not(:last-of-type)": {
|
|
24604
24567
|
borderBottom: `1px solid ${theme.palette.gray.light}`
|
|
@@ -24645,7 +24608,7 @@ const ListCarriers$1 = ({
|
|
|
24645
24608
|
children: t("list-carriers:headers.accountCarriers")
|
|
24646
24609
|
}))
|
|
24647
24610
|
}), jsx("ul", Object.assign({
|
|
24648
|
-
css: styles$
|
|
24611
|
+
css: styles$5.listContainer
|
|
24649
24612
|
}, {
|
|
24650
24613
|
children: isLoading ? jsxs(Fragment, {
|
|
24651
24614
|
children: [jsx(LoadingSkeletonRow, {}), jsx(LoadingSkeletonRow, {}), jsx(LoadingSkeletonRow, {})]
|
|
@@ -24666,10 +24629,10 @@ const ListCarriers$1 = ({
|
|
|
24666
24629
|
};
|
|
24667
24630
|
const LoadingSkeletonRow = () => {
|
|
24668
24631
|
return jsxs("div", Object.assign({
|
|
24669
|
-
css: styles$
|
|
24632
|
+
css: styles$5.skeletonRow
|
|
24670
24633
|
}, {
|
|
24671
24634
|
children: [jsxs("div", Object.assign({
|
|
24672
|
-
css: styles$
|
|
24635
|
+
css: styles$5.skeletonLogoContainer
|
|
24673
24636
|
}, {
|
|
24674
24637
|
children: [jsx(Skeleton, {
|
|
24675
24638
|
animation: SkeletonAnimation.WAVE,
|
|
@@ -24693,7 +24656,7 @@ const LoadingSkeletonRow = () => {
|
|
|
24693
24656
|
}));
|
|
24694
24657
|
};
|
|
24695
24658
|
|
|
24696
|
-
const styles$
|
|
24659
|
+
const styles$4 = createStyles({
|
|
24697
24660
|
body: theme => ({
|
|
24698
24661
|
borderTop: `1px solid ${theme.palette.gray.light}`,
|
|
24699
24662
|
color: theme.palette.black,
|
|
@@ -24744,14 +24707,14 @@ const SettingsCard = ({
|
|
|
24744
24707
|
verticallyAligned
|
|
24745
24708
|
}) => {
|
|
24746
24709
|
return jsxs("div", Object.assign({
|
|
24747
|
-
css: verticallyAligned ? styles$
|
|
24710
|
+
css: verticallyAligned ? styles$4.verticalContainer : styles$4.container,
|
|
24748
24711
|
"data-testid": "settingsCard"
|
|
24749
24712
|
}, {
|
|
24750
24713
|
children: [jsxs("div", Object.assign({
|
|
24751
|
-
css: styles$
|
|
24714
|
+
css: styles$4.header
|
|
24752
24715
|
}, {
|
|
24753
24716
|
children: [jsxs("div", Object.assign({
|
|
24754
|
-
css: styles$
|
|
24717
|
+
css: styles$4.title
|
|
24755
24718
|
}, {
|
|
24756
24719
|
children: [typeof title === "string" ? jsx(Typography, Object.assign({
|
|
24757
24720
|
variant: "subtitle2"
|
|
@@ -24786,7 +24749,7 @@ const SettingsCard = ({
|
|
|
24786
24749
|
}))
|
|
24787
24750
|
}))]
|
|
24788
24751
|
})), children && jsx("div", Object.assign({
|
|
24789
|
-
css: styles$
|
|
24752
|
+
css: styles$4.body
|
|
24790
24753
|
}, {
|
|
24791
24754
|
children: jsxs("div", {
|
|
24792
24755
|
children: [children, accessoryAction && jsx(ButtonGroup, Object.assign({
|
|
@@ -24903,7 +24866,7 @@ const warehouseSchema = z.discriminatedUnion("returnToAddressIsDifferent", [z.ob
|
|
|
24903
24866
|
});
|
|
24904
24867
|
});
|
|
24905
24868
|
|
|
24906
|
-
const styles$
|
|
24869
|
+
const styles$3 = createStyles({
|
|
24907
24870
|
header: {
|
|
24908
24871
|
textAlign: "center"
|
|
24909
24872
|
},
|
|
@@ -24940,6 +24903,9 @@ const WarehouseForm = ({
|
|
|
24940
24903
|
returnToAddressIsDifferent: !lodash.exports.isEqual(warehouse.originAddress, warehouse.returnAddress)
|
|
24941
24904
|
}) : {
|
|
24942
24905
|
isDefault: false,
|
|
24906
|
+
originAddress: {
|
|
24907
|
+
countryCode: "US"
|
|
24908
|
+
},
|
|
24943
24909
|
returnToAddressIsDifferent: false
|
|
24944
24910
|
},
|
|
24945
24911
|
resolver: validationResolver(warehouseSchema)
|
|
@@ -24955,12 +24921,12 @@ const WarehouseForm = ({
|
|
|
24955
24921
|
}
|
|
24956
24922
|
}));
|
|
24957
24923
|
return jsxs("div", Object.assign({
|
|
24958
|
-
css: _isOnboarding ? styles$
|
|
24924
|
+
css: _isOnboarding ? styles$3.onboardingWell : styles$3.well,
|
|
24959
24925
|
"data-testid": "warehouse-form"
|
|
24960
24926
|
}, {
|
|
24961
24927
|
children: [_isOnboarding && jsxs(Fragment, {
|
|
24962
24928
|
children: [jsxs("div", Object.assign({
|
|
24963
|
-
css: styles$
|
|
24929
|
+
css: styles$3.header
|
|
24964
24930
|
}, {
|
|
24965
24931
|
children: [jsx(Typography, Object.assign({
|
|
24966
24932
|
variant: "heading4"
|
|
@@ -24997,7 +24963,8 @@ const WarehouseForm = ({
|
|
|
24997
24963
|
nativeLabel: true
|
|
24998
24964
|
}), jsx(AddressFields, {
|
|
24999
24965
|
form: form,
|
|
25000
|
-
formatFieldName: fieldName => `originAddress.${fieldName}
|
|
24966
|
+
formatFieldName: fieldName => `originAddress.${fieldName}`,
|
|
24967
|
+
optionalFields: ["addressLine2"]
|
|
25001
24968
|
}), jsx(CheckboxInput, {
|
|
25002
24969
|
checkboxLabel: t("manage-warehouses:residentialAddress"),
|
|
25003
24970
|
control: form.control,
|
|
@@ -26164,67 +26131,122 @@ $$3({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
|
|
|
26164
26131
|
}
|
|
26165
26132
|
});
|
|
26166
26133
|
|
|
26167
|
-
const
|
|
26168
|
-
|
|
26134
|
+
const CompletionPage = ({
|
|
26135
|
+
onContinue
|
|
26169
26136
|
}) => {
|
|
26170
26137
|
const {
|
|
26171
26138
|
t
|
|
26172
|
-
} = useTranslation();
|
|
26173
|
-
|
|
26174
|
-
|
|
26175
|
-
|
|
26176
|
-
|
|
26139
|
+
} = useTranslation(["common", "onboarding"]);
|
|
26140
|
+
return jsxs("div", Object.assign({
|
|
26141
|
+
css: {
|
|
26142
|
+
alignItems: "center",
|
|
26143
|
+
display: "flex",
|
|
26144
|
+
flexDirection: "column"
|
|
26145
|
+
},
|
|
26146
|
+
"data-testid": "onboarding-complete"
|
|
26147
|
+
}, {
|
|
26148
|
+
children: [jsx(Typography, Object.assign({
|
|
26149
|
+
variant: "heading4"
|
|
26177
26150
|
}, {
|
|
26178
|
-
children:
|
|
26179
|
-
|
|
26180
|
-
|
|
26181
|
-
|
|
26182
|
-
|
|
26183
|
-
nativeLabel: true
|
|
26184
|
-
})
|
|
26185
|
-
})), jsx(GridChild, Object.assign({
|
|
26186
|
-
colSpan: 12
|
|
26151
|
+
children: t("onboarding:success.title")
|
|
26152
|
+
})), jsx(Spacer, {
|
|
26153
|
+
multiplier: 2
|
|
26154
|
+
}), jsx(Typography, Object.assign({
|
|
26155
|
+
variant: "subtitle1"
|
|
26187
26156
|
}, {
|
|
26188
|
-
children:
|
|
26189
|
-
|
|
26190
|
-
|
|
26191
|
-
|
|
26192
|
-
|
|
26193
|
-
|
|
26194
|
-
|
|
26195
|
-
|
|
26196
|
-
|
|
26157
|
+
children: t("onboarding:success.subtitle")
|
|
26158
|
+
})), jsx(Spacer, {
|
|
26159
|
+
multiplier: 10
|
|
26160
|
+
}), jsxs("svg", Object.assign({
|
|
26161
|
+
fill: "none",
|
|
26162
|
+
height: "86",
|
|
26163
|
+
viewBox: "0 0 86 86",
|
|
26164
|
+
width: "86",
|
|
26165
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
26197
26166
|
}, {
|
|
26198
|
-
children: jsx(
|
|
26199
|
-
|
|
26200
|
-
|
|
26201
|
-
|
|
26202
|
-
|
|
26203
|
-
|
|
26204
|
-
|
|
26205
|
-
|
|
26206
|
-
|
|
26207
|
-
|
|
26167
|
+
children: [jsx("circle", {
|
|
26168
|
+
cx: "43",
|
|
26169
|
+
cy: "43.3379",
|
|
26170
|
+
fill: "#E8F6FF",
|
|
26171
|
+
r: "42.5"
|
|
26172
|
+
}), jsx("path", {
|
|
26173
|
+
d: "M56.6583 26.4724C57.2882 25.8425 58.3095 25.8425 58.9393 26.4724L64.1038 31.6369C64.7337 32.2668 64.7337 33.288 64.1038 33.9179L37.8303 60.1915L30.3848 52.746L56.6583 26.4724Z",
|
|
26174
|
+
fill: "#006FBB"
|
|
26175
|
+
}), jsx("path", {
|
|
26176
|
+
d: "M21.4724 43.8446C20.8425 43.2147 20.8425 42.1935 21.4724 41.5636L26.4689 36.5671C27.0988 35.9372 28.12 35.9372 28.7499 36.5671L45.1032 52.9204L37.8257 60.1979L21.4724 43.8446Z",
|
|
26177
|
+
fill: "#006FBB"
|
|
26178
|
+
})]
|
|
26179
|
+
})), jsx(Spacer, {
|
|
26180
|
+
multiplier: 10
|
|
26181
|
+
}), jsx(ButtonGroup, Object.assign({
|
|
26182
|
+
justify: "center"
|
|
26208
26183
|
}, {
|
|
26209
|
-
children: jsx(
|
|
26210
|
-
|
|
26211
|
-
|
|
26212
|
-
|
|
26213
|
-
|
|
26214
|
-
|
|
26215
|
-
|
|
26184
|
+
children: jsx(Button, Object.assign({
|
|
26185
|
+
bold: false,
|
|
26186
|
+
color: ButtonColor.PRIMARY,
|
|
26187
|
+
onClick: onContinue,
|
|
26188
|
+
type: "button",
|
|
26189
|
+
variant: ButtonVariant.FILLED
|
|
26190
|
+
}, {
|
|
26191
|
+
children: t("onboarding:success.action")
|
|
26192
|
+
}))
|
|
26193
|
+
}))]
|
|
26194
|
+
}));
|
|
26195
|
+
};
|
|
26196
|
+
|
|
26197
|
+
const BillingFields = ({
|
|
26198
|
+
form
|
|
26199
|
+
}) => {
|
|
26200
|
+
const {
|
|
26201
|
+
t
|
|
26202
|
+
} = useTranslation();
|
|
26203
|
+
return jsxs(Fragment, {
|
|
26204
|
+
children: [jsx(TextInput, {
|
|
26205
|
+
control: form.control,
|
|
26206
|
+
label: t("billing.fields.name"),
|
|
26207
|
+
labelWeight: "normal",
|
|
26208
|
+
name: "creditCard.name",
|
|
26209
|
+
nativeLabel: true
|
|
26210
|
+
}), jsx(CreditCardInput, {
|
|
26211
|
+
control: form.control,
|
|
26212
|
+
label: t("billing.fields.cardNumber"),
|
|
26213
|
+
labelWeight: "normal",
|
|
26214
|
+
name: "creditCard.number",
|
|
26215
|
+
nativeLabel: true
|
|
26216
|
+
}), jsxs("div", Object.assign({
|
|
26217
|
+
css: theme => ({
|
|
26218
|
+
display: "flex",
|
|
26219
|
+
gap: theme.spacing(2),
|
|
26220
|
+
width: "100%"
|
|
26216
26221
|
})
|
|
26217
|
-
})), jsx(GridChild, Object.assign({
|
|
26218
|
-
colSpan: 3
|
|
26219
26222
|
}, {
|
|
26220
|
-
children: jsx(
|
|
26221
|
-
|
|
26222
|
-
|
|
26223
|
-
|
|
26224
|
-
|
|
26225
|
-
|
|
26226
|
-
|
|
26227
|
-
|
|
26223
|
+
children: [jsx("div", Object.assign({
|
|
26224
|
+
css: {
|
|
26225
|
+
flexGrow: "1"
|
|
26226
|
+
}
|
|
26227
|
+
}, {
|
|
26228
|
+
children: jsx(ExpirationInput, {
|
|
26229
|
+
control: form.control,
|
|
26230
|
+
label: t("billing.fields.expiration"),
|
|
26231
|
+
labelWeight: "normal",
|
|
26232
|
+
maxLength: 7,
|
|
26233
|
+
name: "creditCard.expiration",
|
|
26234
|
+
nativeLabel: true
|
|
26235
|
+
})
|
|
26236
|
+
})), jsx("div", Object.assign({
|
|
26237
|
+
css: {
|
|
26238
|
+
flexGrow: "1"
|
|
26239
|
+
}
|
|
26240
|
+
}, {
|
|
26241
|
+
children: jsx(TextInput, {
|
|
26242
|
+
control: form.control,
|
|
26243
|
+
label: t("billing.fields.cvv"),
|
|
26244
|
+
labelWeight: "normal",
|
|
26245
|
+
maxLength: 4,
|
|
26246
|
+
name: "creditCard.cvv",
|
|
26247
|
+
nativeLabel: true
|
|
26248
|
+
})
|
|
26249
|
+
}))]
|
|
26228
26250
|
}))]
|
|
26229
26251
|
});
|
|
26230
26252
|
};
|
|
@@ -26260,8 +26282,10 @@ const billingAddressSchema = addressSchema.extend({
|
|
|
26260
26282
|
});
|
|
26261
26283
|
const creditCardSchema = z.object({
|
|
26262
26284
|
cvv: z.string().trim().refine(cvv => cardValidator.cvv(cvv).isValid, "Invalid CVV"),
|
|
26263
|
-
|
|
26264
|
-
|
|
26285
|
+
expiration: z.string().trim().refine(expiration => {
|
|
26286
|
+
const [expirationMonth, expirationYear] = expiration.split("/");
|
|
26287
|
+
return expirationMonths.includes(expirationMonth) && expirationYears.includes(expirationYear);
|
|
26288
|
+
}, "Invalid expiration"),
|
|
26265
26289
|
name: z.string().trim().min(1),
|
|
26266
26290
|
number: z.string().trim().refine(number => cardValidator.number(number).isValid, "Invalid card number").refine(number => {
|
|
26267
26291
|
var _a, _b;
|
|
@@ -26269,11 +26293,16 @@ const creditCardSchema = z.object({
|
|
|
26269
26293
|
}, "schemaErrors.invalidCreditCardType")
|
|
26270
26294
|
}).transform(schema => {
|
|
26271
26295
|
var _a;
|
|
26272
|
-
const
|
|
26296
|
+
const {
|
|
26297
|
+
cvv,
|
|
26298
|
+
expiration
|
|
26299
|
+
} = schema,
|
|
26300
|
+
creditCard = __rest(schema, ["cvv", "expiration"]);
|
|
26273
26301
|
const creditCardVendor = (_a = cardValidator.number(creditCard.number).card) === null || _a === void 0 ? void 0 : _a.type;
|
|
26302
|
+
const [expirationMonth, expirationYear] = expiration.split("/");
|
|
26274
26303
|
return {
|
|
26275
|
-
expirationMonth:
|
|
26276
|
-
expirationYear:
|
|
26304
|
+
expirationMonth: expirationMonth,
|
|
26305
|
+
expirationYear: expirationYear,
|
|
26277
26306
|
name: creditCard.name,
|
|
26278
26307
|
number: creditCard.number,
|
|
26279
26308
|
type: creditCardVendor
|
|
@@ -26349,7 +26378,7 @@ const EditWalletAddressForm = ({
|
|
|
26349
26378
|
}));
|
|
26350
26379
|
};
|
|
26351
26380
|
|
|
26352
|
-
const styles$
|
|
26381
|
+
const styles$2 = createStyles({
|
|
26353
26382
|
grid: theme => ({
|
|
26354
26383
|
margin: theme.spacing(4)
|
|
26355
26384
|
}),
|
|
@@ -26373,7 +26402,11 @@ const WalletForm = ({
|
|
|
26373
26402
|
const form = useForm({
|
|
26374
26403
|
defaultValues:
|
|
26375
26404
|
// If the warehouse address is a PO Box they cannot use it as their billing address
|
|
26376
|
-
defaultWarehouseIsPoBox ? {
|
|
26405
|
+
defaultWarehouseIsPoBox ? {
|
|
26406
|
+
address: {
|
|
26407
|
+
countryCode: "US"
|
|
26408
|
+
}
|
|
26409
|
+
} : {
|
|
26377
26410
|
address: Object.assign(Object.assign({}, address), {
|
|
26378
26411
|
countryCode: address.countryCode
|
|
26379
26412
|
})
|
|
@@ -26397,21 +26430,21 @@ const WalletForm = ({
|
|
|
26397
26430
|
onSubmit: formLogger.capture(handleSubmit)
|
|
26398
26431
|
}, {
|
|
26399
26432
|
children: jsxs(Grid, Object.assign({
|
|
26400
|
-
css: styles$
|
|
26433
|
+
css: styles$2.grid,
|
|
26401
26434
|
noPadding: true
|
|
26402
26435
|
}, {
|
|
26403
26436
|
children: [jsx(GridChild, Object.assign({
|
|
26404
26437
|
colSpan: 12
|
|
26405
26438
|
}, {
|
|
26406
26439
|
children: jsx(Typography, Object.assign({
|
|
26407
|
-
css: styles$
|
|
26440
|
+
css: styles$2.heading,
|
|
26408
26441
|
variant: "heading4"
|
|
26409
26442
|
}, {
|
|
26410
26443
|
children: t("register-wallet:sections.billing.title")
|
|
26411
26444
|
}))
|
|
26412
26445
|
})), jsx(GridChild, Object.assign({
|
|
26413
26446
|
colSpan: 12,
|
|
26414
|
-
css: styles$
|
|
26447
|
+
css: styles$2.subtitle
|
|
26415
26448
|
}, {
|
|
26416
26449
|
children: jsx(Typography, Object.assign({
|
|
26417
26450
|
variant: "subtitle1"
|
|
@@ -26421,19 +26454,30 @@ const WalletForm = ({
|
|
|
26421
26454
|
})), jsx(GridChild, Object.assign({
|
|
26422
26455
|
colSpan: 12
|
|
26423
26456
|
}, {
|
|
26424
|
-
children: jsx(InlineNotification, Object.assign({
|
|
26457
|
+
children: (errors === null || errors === void 0 ? void 0 : errors.length) ? jsx(InlineNotification, Object.assign({
|
|
26458
|
+
title: t("register-wallet:sections.notifications.error.title"),
|
|
26459
|
+
type: NotificationType.ERROR
|
|
26460
|
+
}, {
|
|
26461
|
+
children: errors.map(({
|
|
26462
|
+
message
|
|
26463
|
+
}) => message).join(" ")
|
|
26464
|
+
})) : jsx(InlineNotification, Object.assign({
|
|
26425
26465
|
title: t("register-wallet:sections.notifications.info.title"),
|
|
26426
26466
|
type: NotificationType.INFO
|
|
26427
26467
|
}, {
|
|
26428
26468
|
children: t("register-wallet:sections.notifications.info.description")
|
|
26429
26469
|
}))
|
|
26430
|
-
})), jsx(
|
|
26431
|
-
|
|
26432
|
-
}
|
|
26470
|
+
})), jsx(GridChild, Object.assign({
|
|
26471
|
+
colSpan: 12
|
|
26472
|
+
}, {
|
|
26473
|
+
children: jsx(BillingFields, {
|
|
26474
|
+
form: form
|
|
26475
|
+
})
|
|
26476
|
+
})), jsx(GridChild, Object.assign({
|
|
26433
26477
|
colSpan: 12
|
|
26434
26478
|
}, {
|
|
26435
26479
|
children: jsx(Typography, Object.assign({
|
|
26436
|
-
css: styles$
|
|
26480
|
+
css: styles$2.subtitle,
|
|
26437
26481
|
variant: "subtitle1"
|
|
26438
26482
|
}, {
|
|
26439
26483
|
children: t("register-wallet:sections.billing.addressSubTitle")
|
|
@@ -26470,18 +26514,7 @@ const WalletForm = ({
|
|
|
26470
26514
|
}, {
|
|
26471
26515
|
children: editWalletAddressForm
|
|
26472
26516
|
}))]
|
|
26473
|
-
}),
|
|
26474
|
-
colSpan: 12
|
|
26475
|
-
}, {
|
|
26476
|
-
children: jsx(InlineNotification, Object.assign({
|
|
26477
|
-
title: t("register-wallet:sections.notifications.error.title"),
|
|
26478
|
-
type: NotificationType.ERROR
|
|
26479
|
-
}, {
|
|
26480
|
-
children: errors.map(({
|
|
26481
|
-
message
|
|
26482
|
-
}) => message).join(" ")
|
|
26483
|
-
}))
|
|
26484
|
-
})), jsx(GridChild, Object.assign({
|
|
26517
|
+
}), jsx(GridChild, Object.assign({
|
|
26485
26518
|
colSpan: 12
|
|
26486
26519
|
}, {
|
|
26487
26520
|
children: jsx(ButtonGroup, Object.assign({
|
|
@@ -26500,22 +26533,17 @@ const WalletForm = ({
|
|
|
26500
26533
|
}));
|
|
26501
26534
|
};
|
|
26502
26535
|
|
|
26503
|
-
const styles$
|
|
26504
|
-
lastStep: {
|
|
26505
|
-
"& > span::first-of-type": {
|
|
26506
|
-
"::after": {
|
|
26507
|
-
// TODO: Polish - match Figma as much as possible
|
|
26508
|
-
}
|
|
26509
|
-
},
|
|
26510
|
-
"& > span:last-child": {
|
|
26511
|
-
position: "static"
|
|
26512
|
-
}
|
|
26513
|
-
},
|
|
26536
|
+
const styles$1 = createStyles({
|
|
26514
26537
|
step: {
|
|
26515
26538
|
"& > span:last-child": {
|
|
26516
26539
|
position: "static"
|
|
26517
26540
|
}
|
|
26518
|
-
}
|
|
26541
|
+
},
|
|
26542
|
+
wrapper: theme => ({
|
|
26543
|
+
height: "100%",
|
|
26544
|
+
padding: theme.spacing(2),
|
|
26545
|
+
width: "100%"
|
|
26546
|
+
})
|
|
26519
26547
|
});
|
|
26520
26548
|
|
|
26521
26549
|
const Onboarding$1 = ({
|
|
@@ -26523,8 +26551,6 @@ const Onboarding$1 = ({
|
|
|
26523
26551
|
createWarehouse,
|
|
26524
26552
|
onCarrierCreated,
|
|
26525
26553
|
onWarehouseCreated,
|
|
26526
|
-
isLoadingDhl,
|
|
26527
|
-
isLoadingUps,
|
|
26528
26554
|
onCompleteOnboarding,
|
|
26529
26555
|
registerDhlCarrier,
|
|
26530
26556
|
registerDhlCarrierErrors,
|
|
@@ -26566,16 +26592,20 @@ const Onboarding$1 = ({
|
|
|
26566
26592
|
address
|
|
26567
26593
|
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26568
26594
|
setAddress(address);
|
|
26569
|
-
|
|
26570
|
-
address
|
|
26571
|
-
|
|
26572
|
-
|
|
26573
|
-
|
|
26574
|
-
|
|
26575
|
-
|
|
26576
|
-
|
|
26577
|
-
|
|
26578
|
-
|
|
26595
|
+
try {
|
|
26596
|
+
yield Promise.all([!hasUps && address && registerUpsCarrier({
|
|
26597
|
+
address,
|
|
26598
|
+
agreeToCarrierTerms: agreedToTerms,
|
|
26599
|
+
carrierCode: "ups",
|
|
26600
|
+
email,
|
|
26601
|
+
nickname: "ups"
|
|
26602
|
+
}), !hasDhl && registerDhlCarrier({
|
|
26603
|
+
carrierCode: "dhl_express_walleted",
|
|
26604
|
+
nickname: "dhl_express_walleted"
|
|
26605
|
+
})]);
|
|
26606
|
+
} catch (_a) {
|
|
26607
|
+
// Errors shown inline for recovery
|
|
26608
|
+
}
|
|
26579
26609
|
yield onCarrierCreated();
|
|
26580
26610
|
});
|
|
26581
26611
|
const handleCreateWarehouse = payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -26583,62 +26613,30 @@ const Onboarding$1 = ({
|
|
|
26583
26613
|
if (result) yield onWarehouseCreated();
|
|
26584
26614
|
});
|
|
26585
26615
|
const handleWalletRegistration = ({
|
|
26586
|
-
address,
|
|
26587
|
-
creditCard
|
|
26588
|
-
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26589
|
-
setAddress(address);
|
|
26590
|
-
// Step 4.1: Validate Address (if different from warehouse)
|
|
26591
|
-
yield registerStampsCarrier({
|
|
26592
|
-
address: address,
|
|
26593
|
-
agreeToCarrierTerms: agreedToTerms,
|
|
26594
|
-
carrierCode: "stamps_com",
|
|
26595
|
-
creditCard: creditCard,
|
|
26596
|
-
email: email,
|
|
26597
|
-
nickname: "stamps_com"
|
|
26598
|
-
});
|
|
26599
|
-
yield
|
|
26600
|
-
|
|
26601
|
-
|
|
26602
|
-
|
|
26603
|
-
|
|
26604
|
-
|
|
26605
|
-
|
|
26606
|
-
|
|
26607
|
-
|
|
26608
|
-
|
|
26609
|
-
|
|
26610
|
-
alignItems: "center",
|
|
26611
|
-
display: "flex",
|
|
26612
|
-
flexDirection: "column"
|
|
26613
|
-
},
|
|
26614
|
-
"data-testid": "onboarding-complete"
|
|
26615
|
-
}, {
|
|
26616
|
-
children: [jsx(Typography, Object.assign({
|
|
26617
|
-
variant: "heading4"
|
|
26618
|
-
}, {
|
|
26619
|
-
children: t("onboarding:success.title")
|
|
26620
|
-
})), jsx(Spacer, {
|
|
26621
|
-
multiplier: 2
|
|
26622
|
-
}), jsx(Typography, Object.assign({
|
|
26623
|
-
variant: "subtitle1"
|
|
26624
|
-
}, {
|
|
26625
|
-
children: t("onboarding:success.subtitle")
|
|
26626
|
-
})), jsx(Spacer, {
|
|
26627
|
-
multiplier: 48
|
|
26628
|
-
}), jsx(ButtonGroup, Object.assign({
|
|
26629
|
-
justify: "center"
|
|
26630
|
-
}, {
|
|
26631
|
-
children: jsx(Button, Object.assign({
|
|
26632
|
-
bold: false,
|
|
26633
|
-
color: ButtonColor.PRIMARY,
|
|
26634
|
-
onClick: onCompleteOnboarding,
|
|
26635
|
-
type: "button",
|
|
26636
|
-
variant: ButtonVariant.FILLED
|
|
26637
|
-
}, {
|
|
26638
|
-
children: t("onboarding:success.action")
|
|
26639
|
-
}))
|
|
26640
|
-
}))]
|
|
26641
|
-
}));
|
|
26616
|
+
address,
|
|
26617
|
+
creditCard
|
|
26618
|
+
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26619
|
+
setAddress(address);
|
|
26620
|
+
// Step 4.1: Validate Address (if different from warehouse)
|
|
26621
|
+
yield registerStampsCarrier({
|
|
26622
|
+
address: address,
|
|
26623
|
+
agreeToCarrierTerms: agreedToTerms,
|
|
26624
|
+
carrierCode: "stamps_com",
|
|
26625
|
+
creditCard: creditCard,
|
|
26626
|
+
email: email,
|
|
26627
|
+
nickname: "stamps_com"
|
|
26628
|
+
});
|
|
26629
|
+
yield handleWalletRegistrationSuccess({
|
|
26630
|
+
address
|
|
26631
|
+
});
|
|
26632
|
+
});
|
|
26633
|
+
const renderStep = () => {
|
|
26634
|
+
var _a;
|
|
26635
|
+
// Step 5: Onboarding Complete
|
|
26636
|
+
if (hasCompletedOnboarding) {
|
|
26637
|
+
return jsx(CompletionPage, {
|
|
26638
|
+
onContinue: onCompleteOnboarding
|
|
26639
|
+
});
|
|
26642
26640
|
}
|
|
26643
26641
|
// Step 1: Landing Page
|
|
26644
26642
|
if (!email) return jsx(LandingPage, {
|
|
@@ -26678,11 +26676,6 @@ const Onboarding$1 = ({
|
|
|
26678
26676
|
});
|
|
26679
26677
|
}
|
|
26680
26678
|
if (hasStampsWallet) {
|
|
26681
|
-
if (isLoadingUps || isLoadingDhl) {
|
|
26682
|
-
return jsx(Loader, {
|
|
26683
|
-
message: t("loading.carriers")
|
|
26684
|
-
});
|
|
26685
|
-
}
|
|
26686
26679
|
// Step 4.1: Handle UPS Registration Errors
|
|
26687
26680
|
if (!hasUps && registerUpsCarrierErrors) {
|
|
26688
26681
|
return jsx(CarrierRecoveryForm, {
|
|
@@ -26707,27 +26700,29 @@ const Onboarding$1 = ({
|
|
|
26707
26700
|
});
|
|
26708
26701
|
}
|
|
26709
26702
|
}
|
|
26710
|
-
return
|
|
26703
|
+
return jsx(Loader, {});
|
|
26711
26704
|
};
|
|
26712
|
-
return jsxs(
|
|
26705
|
+
return jsxs("div", Object.assign({
|
|
26706
|
+
css: styles$1.wrapper
|
|
26707
|
+
}, {
|
|
26713
26708
|
children: [jsxs(Stepper, Object.assign({
|
|
26714
26709
|
currentStep: currentStep
|
|
26715
26710
|
}, {
|
|
26716
26711
|
children: [jsx(Step, {
|
|
26717
|
-
css: styles$
|
|
26712
|
+
css: styles$1.step,
|
|
26718
26713
|
label: t("onboarding:steps.login")
|
|
26719
26714
|
}), jsx(Step, {
|
|
26720
|
-
css: styles$
|
|
26715
|
+
css: styles$1.step,
|
|
26721
26716
|
label: t("onboarding:steps.carriers")
|
|
26722
26717
|
}), jsx(Step, {
|
|
26723
|
-
css: styles$
|
|
26718
|
+
css: styles$1.step,
|
|
26724
26719
|
label: t("onboarding:steps.addresses")
|
|
26725
26720
|
}), jsx(Step, {
|
|
26726
|
-
css: styles$
|
|
26721
|
+
css: styles$1.step,
|
|
26727
26722
|
label: t("onboarding:steps.payment")
|
|
26728
26723
|
})]
|
|
26729
26724
|
})), renderStep()]
|
|
26730
|
-
});
|
|
26725
|
+
}));
|
|
26731
26726
|
};
|
|
26732
26727
|
|
|
26733
26728
|
let _ = t => t,
|
|
@@ -26857,7 +26852,7 @@ const Loader = props => {
|
|
|
26857
26852
|
}));
|
|
26858
26853
|
};
|
|
26859
26854
|
|
|
26860
|
-
const getStyles$
|
|
26855
|
+
const getStyles$3 = ({
|
|
26861
26856
|
isDisabled,
|
|
26862
26857
|
isSelected
|
|
26863
26858
|
} = {}) => createStyles({
|
|
@@ -26964,7 +26959,7 @@ const AddFundsForm = ({
|
|
|
26964
26959
|
})), jsx(Spacer, {
|
|
26965
26960
|
multiplier: 2
|
|
26966
26961
|
}), jsx(ChipList, Object.assign({
|
|
26967
|
-
css: getStyles$
|
|
26962
|
+
css: getStyles$3().chipList,
|
|
26968
26963
|
onChange: idx => {
|
|
26969
26964
|
const chip = chips[idx];
|
|
26970
26965
|
setSelectedChip(chip);
|
|
@@ -26979,7 +26974,7 @@ const AddFundsForm = ({
|
|
|
26979
26974
|
}
|
|
26980
26975
|
}, {
|
|
26981
26976
|
children: chips.map(chip => jsx(Chip, Object.assign({
|
|
26982
|
-
css: getStyles$
|
|
26977
|
+
css: getStyles$3({
|
|
26983
26978
|
isDisabled: chip.value < _minimumAmount,
|
|
26984
26979
|
isSelected: chip.value === selectedChip.value
|
|
26985
26980
|
}).chip,
|
|
@@ -26996,7 +26991,7 @@ const AddFundsForm = ({
|
|
|
26996
26991
|
multiplier: 1
|
|
26997
26992
|
}), jsx(MoneyInput, {
|
|
26998
26993
|
control: form.control,
|
|
26999
|
-
css: getStyles$
|
|
26994
|
+
css: getStyles$3().fundsInput,
|
|
27000
26995
|
defaultValue: {
|
|
27001
26996
|
amount: undefined,
|
|
27002
26997
|
currency: SE.Currency.USD
|
|
@@ -27064,7 +27059,7 @@ const InlineLabel = ({
|
|
|
27064
27059
|
}), children]
|
|
27065
27060
|
}));
|
|
27066
27061
|
|
|
27067
|
-
const getStyles$
|
|
27062
|
+
const getStyles$2 = balance => createStyles({
|
|
27068
27063
|
balanceText: theme => ({
|
|
27069
27064
|
color: balance === undefined ? theme.palette.alert.main : balance >= 0 ? theme.palette.secondary.dark : theme.palette.error.main
|
|
27070
27065
|
})
|
|
@@ -27087,7 +27082,7 @@ const CarrierBalance = ({
|
|
|
27087
27082
|
}, {
|
|
27088
27083
|
children: isLoadingCarrier || isRefetchingCarrier ? jsx(Spinner, {}) : jsx(Typography, Object.assign({
|
|
27089
27084
|
bold: true,
|
|
27090
|
-
css: getStyles$
|
|
27085
|
+
css: getStyles$2(balance).balanceText
|
|
27091
27086
|
}, {
|
|
27092
27087
|
children: balance === undefined ? t("manage-funding:errors.balanceUnknown") : formatMoney({
|
|
27093
27088
|
amount: balance,
|
|
@@ -27148,7 +27143,7 @@ const Spread = ({
|
|
|
27148
27143
|
children: children
|
|
27149
27144
|
}));
|
|
27150
27145
|
|
|
27151
|
-
const getStyles = isCustomAmount => createStyles({
|
|
27146
|
+
const getStyles$1 = isCustomAmount => createStyles({
|
|
27152
27147
|
balanceText: theme => ({
|
|
27153
27148
|
color: theme.palette.secondary.dark
|
|
27154
27149
|
}),
|
|
@@ -27180,6 +27175,7 @@ const FundAndPurchase = ({
|
|
|
27180
27175
|
carrierId,
|
|
27181
27176
|
className,
|
|
27182
27177
|
disabled,
|
|
27178
|
+
isFundingEnabled,
|
|
27183
27179
|
isFundingRequired,
|
|
27184
27180
|
onSave,
|
|
27185
27181
|
purchaseAmount,
|
|
@@ -27207,14 +27203,14 @@ const FundAndPurchase = ({
|
|
|
27207
27203
|
});
|
|
27208
27204
|
// Automatically open the Add Funds form if the carrier's balance is insufficient.
|
|
27209
27205
|
useEffect(() => {
|
|
27210
|
-
if (isFundingRequired && (carrier === null || carrier === void 0 ? void 0 : carrier.balance) !== undefined && carrier.balance < purchaseAmount) setIsAddFundsFormOpen(true);
|
|
27211
|
-
}, [carrier === null || carrier === void 0 ? void 0 : carrier.balance, isFundingRequired, purchaseAmount]);
|
|
27206
|
+
if (isFundingEnabled && isFundingRequired && (carrier === null || carrier === void 0 ? void 0 : carrier.balance) !== undefined && carrier.balance < purchaseAmount) setIsAddFundsFormOpen(true);
|
|
27207
|
+
}, [carrier === null || carrier === void 0 ? void 0 : carrier.balance, isFundingEnabled, isFundingRequired, purchaseAmount]);
|
|
27212
27208
|
const renderActionButtons = (addFundsForm = {}) => jsxs(ButtonGroup, Object.assign({
|
|
27213
27209
|
justify: "end"
|
|
27214
27210
|
}, {
|
|
27215
27211
|
children: [jsx(Button, Object.assign({
|
|
27216
27212
|
bold: false,
|
|
27217
|
-
css: getStyles().saveRateButton,
|
|
27213
|
+
css: getStyles$1().saveRateButton,
|
|
27218
27214
|
disabled: disabled || !carrierId || isAddingFunds || isCreatingLabel,
|
|
27219
27215
|
isLoading: isSavingRate,
|
|
27220
27216
|
onClick: handleSaveRate,
|
|
@@ -27223,16 +27219,18 @@ const FundAndPurchase = ({
|
|
|
27223
27219
|
children: t("purchase-label:actions.saveRate")
|
|
27224
27220
|
})), jsx(Button, Object.assign({
|
|
27225
27221
|
"data-testid": "submit-fund-and-purchase",
|
|
27226
|
-
disabled: disabled || !carrierId || isFundingRequired && isAddFundsFormOpen && addFundsForm.isSubmitted && !addFundsForm.isValid,
|
|
27222
|
+
disabled: disabled || !carrierId || isFundingEnabled && isFundingRequired && isAddFundsFormOpen && addFundsForm.isSubmitted && !addFundsForm.isValid,
|
|
27227
27223
|
isLoading: addFundsForm.isSubmitting || isAddingFunds || isCreatingLabel,
|
|
27228
27224
|
onClick: isAddFundsFormOpen ? addFundsForm.submit : onPurchase
|
|
27229
27225
|
}, {
|
|
27230
27226
|
children: isAddFundsFormOpen ? t("manage-funding:actions.addFundsAndPurchase") : t("purchase-label:actions.purchaseNow")
|
|
27231
27227
|
}))]
|
|
27232
27228
|
}));
|
|
27229
|
+
// Render: not a walleted carrier;
|
|
27230
|
+
// don't show balance or funding form
|
|
27233
27231
|
if (!isFundingRequired) return jsx("div", Object.assign({
|
|
27234
27232
|
className: className,
|
|
27235
|
-
css: getStyles().container
|
|
27233
|
+
css: getStyles$1().container
|
|
27236
27234
|
}, {
|
|
27237
27235
|
children: renderActionButtons()
|
|
27238
27236
|
}));
|
|
@@ -27245,9 +27243,23 @@ const FundAndPurchase = ({
|
|
|
27245
27243
|
setIsAddFundsFormOpen(false);
|
|
27246
27244
|
onPurchase();
|
|
27247
27245
|
};
|
|
27246
|
+
// Render: walleted carrier, but funding feature is not enabled;
|
|
27247
|
+
// show balance, but not the funding form.
|
|
27248
|
+
if (!isFundingEnabled) return jsxs("div", Object.assign({
|
|
27249
|
+
className: className,
|
|
27250
|
+
css: getStyles$1().container
|
|
27251
|
+
}, {
|
|
27252
|
+
children: [jsx(CarrierBalance, {
|
|
27253
|
+
carrierId: carrierId
|
|
27254
|
+
}), jsx(Spacer, {
|
|
27255
|
+
multiplier: 2
|
|
27256
|
+
}), renderActionButtons()]
|
|
27257
|
+
}));
|
|
27258
|
+
// Render: walleted carrier and funding feature is enabled;
|
|
27259
|
+
// show balance and funding form
|
|
27248
27260
|
return jsxs("div", Object.assign({
|
|
27249
27261
|
className: className,
|
|
27250
|
-
css: getStyles().container
|
|
27262
|
+
css: getStyles$1().container
|
|
27251
27263
|
}, {
|
|
27252
27264
|
children: [jsxs(Spread, {
|
|
27253
27265
|
children: [jsx(CarrierBalance, {
|
|
@@ -27278,13 +27290,13 @@ const FundAndPurchase = ({
|
|
|
27278
27290
|
var _a, _b;
|
|
27279
27291
|
return jsxs(Fragment, {
|
|
27280
27292
|
children: [jsxs("section", Object.assign({
|
|
27281
|
-
css: getStyles(addFundsForm.isCustomAmount).formExtension
|
|
27293
|
+
css: getStyles$1(addFundsForm.isCustomAmount).formExtension
|
|
27282
27294
|
}, {
|
|
27283
27295
|
children: [jsx(InlineLabel, Object.assign({
|
|
27284
27296
|
label: t("manage-funding:fundAndPurchase.newBalance")
|
|
27285
27297
|
}, {
|
|
27286
27298
|
children: jsx(Typography, Object.assign({
|
|
27287
|
-
css: getStyles().balanceText
|
|
27299
|
+
css: getStyles$1().balanceText
|
|
27288
27300
|
}, {
|
|
27289
27301
|
children: formatMoney({
|
|
27290
27302
|
amount: balance + ((_a = addFundsForm.selectedAmount) !== null && _a !== void 0 ? _a : 0),
|
|
@@ -27295,7 +27307,7 @@ const FundAndPurchase = ({
|
|
|
27295
27307
|
label: t("manage-funding:fundAndPurchase.finalBalance")
|
|
27296
27308
|
}, {
|
|
27297
27309
|
children: jsx(Typography, Object.assign({
|
|
27298
|
-
css: getStyles().balanceText
|
|
27310
|
+
css: getStyles$1().balanceText
|
|
27299
27311
|
}, {
|
|
27300
27312
|
children: formatMoney({
|
|
27301
27313
|
amount: balance + ((_b = addFundsForm.selectedAmount) !== null && _b !== void 0 ? _b : 0) - purchaseAmount,
|
|
@@ -27321,7 +27333,7 @@ const FundAndPurchase = ({
|
|
|
27321
27333
|
}));
|
|
27322
27334
|
};
|
|
27323
27335
|
|
|
27324
|
-
const styles
|
|
27336
|
+
const styles = createStyles({
|
|
27325
27337
|
fundAndPurchase: theme => ({
|
|
27326
27338
|
borderTop: `1px solid ${theme.palette.gray.ultraLight}`
|
|
27327
27339
|
}),
|
|
@@ -27460,7 +27472,7 @@ const RateForm = ({
|
|
|
27460
27472
|
onClick: onSelectRate,
|
|
27461
27473
|
options: showHiddenRates ? rateOptions : filteredRateOptions
|
|
27462
27474
|
}), rateOptions.some(option => option.requiresAcknowledgement) && rateOptions.length > 5 && jsx(Link, Object.assign({
|
|
27463
|
-
css: styles
|
|
27475
|
+
css: styles.showMoreOrLessRatesButton,
|
|
27464
27476
|
onClick: () => {
|
|
27465
27477
|
var _a;
|
|
27466
27478
|
setShowHiddenRates(!showHiddenRates);
|
|
@@ -27481,7 +27493,7 @@ const RateForm = ({
|
|
|
27481
27493
|
}))
|
|
27482
27494
|
}))]
|
|
27483
27495
|
}) : !isLoading && errors && !!errors.length ? null : jsxs("article", Object.assign({
|
|
27484
|
-
css: styles
|
|
27496
|
+
css: styles.ratesInterstitial,
|
|
27485
27497
|
role: "presentation"
|
|
27486
27498
|
}, {
|
|
27487
27499
|
children: [jsx(Cube, {
|
|
@@ -27501,8 +27513,9 @@ const RateForm = ({
|
|
|
27501
27513
|
})]
|
|
27502
27514
|
})), jsx(FundAndPurchase, {
|
|
27503
27515
|
carrierId: selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.carrierId,
|
|
27504
|
-
css: styles
|
|
27516
|
+
css: styles.fundAndPurchase,
|
|
27505
27517
|
disabled: disabled,
|
|
27518
|
+
isFundingEnabled: features === null || features === void 0 ? void 0 : features.enableFunding,
|
|
27506
27519
|
isFundingRequired: (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.balance) !== undefined && !!selectedRate.requiresFundedAmount,
|
|
27507
27520
|
onPurchase: handleSubmit,
|
|
27508
27521
|
onSave: handleSaveRate,
|
|
@@ -27511,7 +27524,7 @@ const RateForm = ({
|
|
|
27511
27524
|
}));
|
|
27512
27525
|
};
|
|
27513
27526
|
|
|
27514
|
-
const
|
|
27527
|
+
const SuspendSalesOrder = ({
|
|
27515
27528
|
children,
|
|
27516
27529
|
errors,
|
|
27517
27530
|
isLoading,
|
|
@@ -27556,17 +27569,20 @@ const getTableWrapperStyles = theme => /*#__PURE__*/css$1({
|
|
|
27556
27569
|
}
|
|
27557
27570
|
}, process.env.NODE_ENV === "production" ? "" : ";label:getTableWrapperStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIml0ZW1zLWJyZWFrZG93bi5zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS2dEIiwiZmlsZSI6Iml0ZW1zLWJyZWFrZG93bi5zdHlsZXMudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBjc3MgfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3RcIjtcclxuZXhwb3J0IGNvbnN0IGdldE51bWVyaWNDZWxsU3R5bGUgPSAodGhlbWUpID0+IGNzcyh7XHJcbiAgICB0ZXh0QWxpZ246IFwicmlnaHRcIixcclxuICAgIHdpZHRoOiBcIjEwMHB4XCIsXHJcbn0pO1xyXG5leHBvcnQgY29uc3QgZ2V0VGFibGVXcmFwcGVyU3R5bGVzID0gKHRoZW1lKSA9PiBjc3Moe1xyXG4gICAgXCImJiA+IGRpdlwiOiB7XHJcbiAgICAgICAgYm94U2hhZG93OiBcIm5vbmVcIixcclxuICAgIH0sXHJcbiAgICBcIiYmID4gZGl2IHRhYmxlIHRoZWFkIHRoXCI6IHtcclxuICAgICAgICBmb250U3R5bGU6IFwiaXRhbGljXCIsXHJcbiAgICAgICAgZm9udFdlaWdodDogdGhlbWUudHlwb2dyYXBoeS5mb250V2VpZ2h0Lm5vcm1hbCxcclxuICAgIH0sXHJcbn0pO1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1pdGVtcy1icmVha2Rvd24uc3R5bGVzLmpzLm1hcCJdfQ== */");
|
|
27558
27571
|
|
|
27559
|
-
const ItemsBreakdownTableHeader = (
|
|
27572
|
+
const ItemsBreakdownTableHeader = ({
|
|
27573
|
+
hasValue,
|
|
27574
|
+
hasTotal
|
|
27575
|
+
}) => jsx(TableHeader, {
|
|
27560
27576
|
children: jsxs(TableBaseRow, {
|
|
27561
27577
|
children: [jsx(TableHeaderCell, {}), jsx(TableHeaderCell, Object.assign({
|
|
27562
27578
|
css: getNumericCellStyle
|
|
27563
27579
|
}, {
|
|
27564
27580
|
children: "Qty"
|
|
27565
|
-
})), jsx(TableHeaderCell, Object.assign({
|
|
27581
|
+
})), hasValue && jsx(TableHeaderCell, Object.assign({
|
|
27566
27582
|
css: getNumericCellStyle
|
|
27567
27583
|
}, {
|
|
27568
27584
|
children: "$/ea"
|
|
27569
|
-
})), jsx(TableHeaderCell, Object.assign({
|
|
27585
|
+
})), hasTotal && jsx(TableHeaderCell, Object.assign({
|
|
27570
27586
|
css: getNumericCellStyle
|
|
27571
27587
|
}, {
|
|
27572
27588
|
children: "$ Total"
|
|
@@ -27576,11 +27592,16 @@ const ItemsBreakdownTableHeader = () => jsx(TableHeader, {
|
|
|
27576
27592
|
const ItemsBreakdown = ({
|
|
27577
27593
|
items
|
|
27578
27594
|
}) => {
|
|
27595
|
+
const hasValue = items.some(item => item.value !== undefined);
|
|
27596
|
+
const hasTotal = items.some(item => item.totalValue !== undefined);
|
|
27579
27597
|
return jsx("div", Object.assign({
|
|
27580
27598
|
css: getTableWrapperStyles
|
|
27581
27599
|
}, {
|
|
27582
27600
|
children: jsx(Table, Object.assign({
|
|
27583
|
-
header: jsx(ItemsBreakdownTableHeader, {
|
|
27601
|
+
header: jsx(ItemsBreakdownTableHeader, {
|
|
27602
|
+
hasTotal: hasTotal,
|
|
27603
|
+
hasValue: hasValue
|
|
27604
|
+
})
|
|
27584
27605
|
}, {
|
|
27585
27606
|
children: jsx(TableBody, {
|
|
27586
27607
|
children: items.map(({
|
|
@@ -27600,11 +27621,11 @@ const ItemsBreakdown = ({
|
|
|
27600
27621
|
css: getNumericCellStyle
|
|
27601
27622
|
}, {
|
|
27602
27623
|
children: quantity
|
|
27603
|
-
})), jsx(TableBodyCell, Object.assign({
|
|
27624
|
+
})), hasValue && jsx(TableBodyCell, Object.assign({
|
|
27604
27625
|
css: getNumericCellStyle
|
|
27605
27626
|
}, {
|
|
27606
|
-
children: formatMoney(value)
|
|
27607
|
-
})), jsx(TableBodyCell, Object.assign({
|
|
27627
|
+
children: value && formatMoney(value)
|
|
27628
|
+
})), hasTotal && jsx(TableBodyCell, Object.assign({
|
|
27608
27629
|
css: getNumericCellStyle
|
|
27609
27630
|
}, {
|
|
27610
27631
|
children: totalValue && formatMoney(totalValue)
|
|
@@ -28017,7 +28038,7 @@ const ShipmentForm = ({
|
|
|
28017
28038
|
warehouseId,
|
|
28018
28039
|
warehouses
|
|
28019
28040
|
}) => {
|
|
28020
|
-
var _a, _b, _c, _d;
|
|
28041
|
+
var _a, _b, _c, _d, _e;
|
|
28021
28042
|
features = Object.assign({
|
|
28022
28043
|
browseRates: true,
|
|
28023
28044
|
includeShipsuranceInsurance: true,
|
|
@@ -28190,8 +28211,8 @@ const ShipmentForm = ({
|
|
|
28190
28211
|
}
|
|
28191
28212
|
}, [form]);
|
|
28192
28213
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
28193
|
-
const
|
|
28194
|
-
payload = __rest(
|
|
28214
|
+
const _f = values,
|
|
28215
|
+
payload = __rest(_f, ["__mode"]);
|
|
28195
28216
|
const updatedShipment = yield onSubmit(Object.assign(Object.assign({}, shipment || {}), payload));
|
|
28196
28217
|
// Defer shipment hydration to the task queue so that the submission promise resolves first, otherwise the
|
|
28197
28218
|
// submission count will increment after hydration resets the form, keeping it in revalidate mode
|
|
@@ -28305,6 +28326,10 @@ const ShipmentForm = ({
|
|
|
28305
28326
|
} = form.getValues();
|
|
28306
28327
|
form.setValue("__mode", (features === null || features === void 0 ? void 0 : features.selectService) ? __mode : "browse_rates");
|
|
28307
28328
|
}, [form, features === null || features === void 0 ? void 0 : features.selectService]);
|
|
28329
|
+
const salesOrderItems = useMemo(() => getSalesOrderItemsFromSalesOrderOrShipment({
|
|
28330
|
+
salesOrder,
|
|
28331
|
+
shipment
|
|
28332
|
+
}), [salesOrder, shipment]);
|
|
28308
28333
|
if (isLoading) return jsx(Loader, {
|
|
28309
28334
|
message: t("loading.shipment")
|
|
28310
28335
|
});
|
|
@@ -28367,7 +28392,7 @@ const ShipmentForm = ({
|
|
|
28367
28392
|
}), jsx(Spacer, {
|
|
28368
28393
|
displayOn: isEditShipFormToOpen ? "tablet" : undefined,
|
|
28369
28394
|
multiplier: 2
|
|
28370
|
-
}), editShipToForm, jsxs(FieldLabel, Object.assign({
|
|
28395
|
+
}), editShipToForm, (salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.orderDate) && jsxs(FieldLabel, Object.assign({
|
|
28371
28396
|
label: t("purchase-label:fields.orderDate")
|
|
28372
28397
|
}, {
|
|
28373
28398
|
children: [jsx(Typography, Object.assign({
|
|
@@ -28375,7 +28400,7 @@ const ShipmentForm = ({
|
|
|
28375
28400
|
}, {
|
|
28376
28401
|
children: formatDate(salesOrder.orderDate)
|
|
28377
28402
|
})), jsx(Spacer, {})]
|
|
28378
|
-
})), jsxs(FieldLabel, Object.assign({
|
|
28403
|
+
})), ((_b = salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.paymentDetails) === null || _b === void 0 ? void 0 : _b.grandTotal) && jsxs(FieldLabel, Object.assign({
|
|
28379
28404
|
label: t("purchase-label:fields.orderValue")
|
|
28380
28405
|
}, {
|
|
28381
28406
|
children: [jsx(Typography, Object.assign({
|
|
@@ -28391,7 +28416,7 @@ const ShipmentForm = ({
|
|
|
28391
28416
|
}, {
|
|
28392
28417
|
children: requestedServices.length > 1 ? t("purchase-label:multipleShippingServices") : requestedServices[0].toString()
|
|
28393
28418
|
})), jsx(Spacer, {})]
|
|
28394
|
-
})), salesOrder.paymentDetails.estimatedShipping.amount > 0 && jsxs(FieldLabel, Object.assign({
|
|
28419
|
+
})), salesOrder && salesOrder.paymentDetails.estimatedShipping.amount > 0 && jsxs(FieldLabel, Object.assign({
|
|
28395
28420
|
label: t("purchase-label:fields.estimatedShipping")
|
|
28396
28421
|
}, {
|
|
28397
28422
|
children: [jsx(Typography, Object.assign({
|
|
@@ -28399,7 +28424,7 @@ const ShipmentForm = ({
|
|
|
28399
28424
|
}, {
|
|
28400
28425
|
children: formatMoney(salesOrder.paymentDetails.estimatedShipping)
|
|
28401
28426
|
})), jsx(Spacer, {})]
|
|
28402
|
-
})),
|
|
28427
|
+
})), salesOrderItems.length > 0 && jsx(FieldLabel, Object.assign({
|
|
28403
28428
|
label: t("purchase-label:fields.items")
|
|
28404
28429
|
}, {
|
|
28405
28430
|
children: jsxs("div", Object.assign({
|
|
@@ -28411,7 +28436,7 @@ const ShipmentForm = ({
|
|
|
28411
28436
|
children: [jsx(Typography, Object.assign({
|
|
28412
28437
|
variant: "body2"
|
|
28413
28438
|
}, {
|
|
28414
|
-
children:
|
|
28439
|
+
children: salesOrderItems.length.toString()
|
|
28415
28440
|
})), jsxs(Link, Object.assign({
|
|
28416
28441
|
css: theme => ({
|
|
28417
28442
|
alignItems: "center",
|
|
@@ -28430,15 +28455,7 @@ const ShipmentForm = ({
|
|
|
28430
28455
|
}))]
|
|
28431
28456
|
}))
|
|
28432
28457
|
})), showItems && jsx(ItemsBreakdown, {
|
|
28433
|
-
items:
|
|
28434
|
-
detail: `SKU ${item.lineItemDetails.sku}`,
|
|
28435
|
-
name: item.lineItemDetails.name,
|
|
28436
|
-
quantity: item.quantity,
|
|
28437
|
-
subDetail: item.requestedShippingOptions.shippingService,
|
|
28438
|
-
subDetailValue: item.priceSummary.estimatedShipping,
|
|
28439
|
-
totalValue: item.priceSummary.total,
|
|
28440
|
-
value: item.priceSummary.unitPrice
|
|
28441
|
-
}))
|
|
28458
|
+
items: salesOrderItems
|
|
28442
28459
|
})]
|
|
28443
28460
|
})), jsx("div", {
|
|
28444
28461
|
ref: customsItemErrorScrollToRef
|
|
@@ -28462,7 +28479,7 @@ const ShipmentForm = ({
|
|
|
28462
28479
|
}), jsx(CustomsItemsDisplay, {
|
|
28463
28480
|
onUpdate: handleUpdateCustomsItems,
|
|
28464
28481
|
shipment: shipment
|
|
28465
|
-
}), ((
|
|
28482
|
+
}), ((_c = customsErrors === null || customsErrors === void 0 ? void 0 : customsErrors.customsItems) === null || _c === void 0 ? void 0 : _c.type) === "too_small" && jsxs(Fragment, {
|
|
28466
28483
|
children: [jsx(Spacer, {}), jsx(InlineNotification, {
|
|
28467
28484
|
title: t("purchase-label:errorMessages.customsItemsRequired"),
|
|
28468
28485
|
type: NotificationType.ERROR
|
|
@@ -28622,7 +28639,7 @@ const ShipmentForm = ({
|
|
|
28622
28639
|
label: "purchase-label:fields.addOns"
|
|
28623
28640
|
}, {
|
|
28624
28641
|
children: [jsx(Switch, Object.assign({
|
|
28625
|
-
defaultChecked: ((
|
|
28642
|
+
defaultChecked: ((_d = shipment === null || shipment === void 0 ? void 0 : shipment.confirmation) !== null && _d !== void 0 ? _d : "none") !== "none",
|
|
28626
28643
|
label: t("purchase-label:fields.confirmation"),
|
|
28627
28644
|
name: "confirmationEnabled",
|
|
28628
28645
|
shouldUnmount: true,
|
|
@@ -28638,7 +28655,7 @@ const ShipmentForm = ({
|
|
|
28638
28655
|
shouldUnregister: true
|
|
28639
28656
|
})
|
|
28640
28657
|
})), jsxs(Switch, Object.assign({
|
|
28641
|
-
defaultChecked: ((
|
|
28658
|
+
defaultChecked: ((_e = shipment === null || shipment === void 0 ? void 0 : shipment.insuranceProvider) !== null && _e !== void 0 ? _e : "none") !== "none",
|
|
28642
28659
|
label: t("purchase-label:fields.insurance"),
|
|
28643
28660
|
name: "insuranceEnabled",
|
|
28644
28661
|
onChange: () => setInsuranceEnabled(true),
|
|
@@ -28927,6 +28944,30 @@ const Shipment$1 = ({
|
|
|
28927
28944
|
});
|
|
28928
28945
|
};
|
|
28929
28946
|
|
|
28947
|
+
const SuspendShipment = ({
|
|
28948
|
+
children,
|
|
28949
|
+
errors,
|
|
28950
|
+
isLoading,
|
|
28951
|
+
shipment
|
|
28952
|
+
}) => {
|
|
28953
|
+
const {
|
|
28954
|
+
t
|
|
28955
|
+
} = useTranslation(["common", "purchase-label"]);
|
|
28956
|
+
if (isLoading) return jsx(Loader, {
|
|
28957
|
+
message: t("loading.shipment")
|
|
28958
|
+
});
|
|
28959
|
+
if (errors) throw new Error(errors.map(e => e.message).join(", "));
|
|
28960
|
+
if (!shipment) throw new Error("errorMessages.unableToLoad.shipment");
|
|
28961
|
+
return jsx("div", Object.assign({
|
|
28962
|
+
css: {
|
|
28963
|
+
height: "100%",
|
|
28964
|
+
width: "100%"
|
|
28965
|
+
}
|
|
28966
|
+
}, {
|
|
28967
|
+
children: children
|
|
28968
|
+
}));
|
|
28969
|
+
};
|
|
28970
|
+
|
|
28930
28971
|
const VoidLabel$1 = ({
|
|
28931
28972
|
onComplete,
|
|
28932
28973
|
onSubmit,
|
|
@@ -29063,33 +29104,43 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
29063
29104
|
ManageWarehouses: ManageWarehouses$1,
|
|
29064
29105
|
Onboarding: Onboarding$1,
|
|
29065
29106
|
RateForm: RateForm,
|
|
29066
|
-
|
|
29107
|
+
SuspendSalesOrder: SuspendSalesOrder,
|
|
29067
29108
|
ShipmentForm: ShipmentForm,
|
|
29068
29109
|
schedulePickupForCarrier: schedulePickupForCarrier,
|
|
29069
29110
|
Shipment: Shipment$1,
|
|
29111
|
+
SuspendShipment: SuspendShipment,
|
|
29070
29112
|
WarehouseForm: WarehouseForm,
|
|
29071
29113
|
VoidLabel: VoidLabel$1,
|
|
29072
29114
|
WalletForm: WalletForm,
|
|
29073
|
-
styles: styles$
|
|
29115
|
+
styles: styles$2,
|
|
29074
29116
|
billingAddressSchema: billingAddressSchema,
|
|
29075
29117
|
walletSchema: walletSchema,
|
|
29076
29118
|
BillingFields: BillingFields
|
|
29077
29119
|
});
|
|
29078
29120
|
|
|
29079
|
-
const
|
|
29121
|
+
const getStyles = showForm => createStyles({
|
|
29122
|
+
edit: theme => ({
|
|
29123
|
+
color: theme.palette.primary.main,
|
|
29124
|
+
padding: `0 ${theme.spacing(2)}`
|
|
29125
|
+
}),
|
|
29080
29126
|
form: theme => ({
|
|
29081
29127
|
backgroundColor: theme.palette.gray.megaLight,
|
|
29082
|
-
display: "flex",
|
|
29128
|
+
display: showForm ? "flex" : "none",
|
|
29083
29129
|
flexDirection: "column",
|
|
29084
|
-
gap: theme.spacing(2),
|
|
29085
29130
|
padding: theme.spacing(2)
|
|
29086
|
-
})
|
|
29131
|
+
}),
|
|
29132
|
+
input: theme => ({
|
|
29133
|
+
width: theme.spacing(13)
|
|
29134
|
+
}),
|
|
29135
|
+
marginLeft: {
|
|
29136
|
+
marginLeft: "auto"
|
|
29137
|
+
}
|
|
29087
29138
|
});
|
|
29088
29139
|
|
|
29089
29140
|
const autoFundingSchema = z.object({
|
|
29090
29141
|
isEnabled: z.boolean(),
|
|
29091
29142
|
lowBalancePurchaseThreshold: moneySchema.extend({
|
|
29092
|
-
amount: z.number().min(
|
|
29143
|
+
amount: z.number().min(10)
|
|
29093
29144
|
}),
|
|
29094
29145
|
maximumPurchasesPerDay: z.number().min(1),
|
|
29095
29146
|
purchaseAmount: moneySchema.extend({
|
|
@@ -29099,7 +29150,9 @@ const autoFundingSchema = z.object({
|
|
|
29099
29150
|
|
|
29100
29151
|
/**
|
|
29101
29152
|
* This form that allows users to enable or disable auto funding, and
|
|
29102
|
-
* configure auto funding
|
|
29153
|
+
* configure auto funding rules in ShipEngine API.
|
|
29154
|
+
*
|
|
29155
|
+
* @param carrierId The carrierId of the carrier provider you wish to configure auto-funding rules for.
|
|
29103
29156
|
*/
|
|
29104
29157
|
const AutoFundingForm = ({
|
|
29105
29158
|
carrierId
|
|
@@ -29108,77 +29161,140 @@ const AutoFundingForm = ({
|
|
|
29108
29161
|
t
|
|
29109
29162
|
} = useTranslation();
|
|
29110
29163
|
const updateAutoFunding = useUpdateAutoFunding(carrierId);
|
|
29111
|
-
const autoFundingConfiguration = useGetAutoFundingConfiguration();
|
|
29164
|
+
const autoFundingConfiguration = useGetAutoFundingConfiguration(carrierId);
|
|
29165
|
+
const {
|
|
29166
|
+
data: autoFundingSettings
|
|
29167
|
+
} = autoFundingConfiguration;
|
|
29168
|
+
const [showForm, setShowForm] = useState(false);
|
|
29169
|
+
const [isSwitchOn, setIsSwitchOn] = useState(false);
|
|
29170
|
+
const styles = getStyles(showForm);
|
|
29112
29171
|
const form = useForm({
|
|
29113
|
-
// TODO - [LMNT-663] We should probably make a hydration effect for autoFundingConfiguration.data
|
|
29114
|
-
defaultValues: autoFundingConfiguration.data,
|
|
29115
29172
|
resolver: validationResolver(autoFundingSchema)
|
|
29116
29173
|
});
|
|
29117
|
-
const {
|
|
29118
|
-
isDirty
|
|
29119
|
-
} = form.formState;
|
|
29120
29174
|
const watchIsEnabled = form.watch("isEnabled");
|
|
29175
|
+
const formReset = isEnabled => form.reset(values => Object.assign(Object.assign({}, values), {
|
|
29176
|
+
isEnabled
|
|
29177
|
+
}), {
|
|
29178
|
+
keepDirty: true
|
|
29179
|
+
});
|
|
29121
29180
|
const handleSubmit = formLogger.capture(form.handleSubmit(values => {
|
|
29181
|
+
setShowForm(prev => !prev);
|
|
29182
|
+
setIsSwitchOn(true);
|
|
29122
29183
|
const payload = values;
|
|
29123
29184
|
updateAutoFunding.mutate(payload, {
|
|
29124
29185
|
onSuccess: () => autoFundingConfiguration.refetch()
|
|
29125
29186
|
});
|
|
29126
29187
|
}));
|
|
29188
|
+
/**
|
|
29189
|
+
* This function toggles the form visibility and conditionally disables auto-funding
|
|
29190
|
+
* when falsy. This is because when someone toggles the enable auto-funding switch
|
|
29191
|
+
* off, they do not want to have auto-funding enabled at all.
|
|
29192
|
+
*/
|
|
29127
29193
|
const handleToggle = isEnabled => {
|
|
29128
|
-
|
|
29129
|
-
|
|
29130
|
-
|
|
29131
|
-
if (
|
|
29132
|
-
|
|
29133
|
-
|
|
29134
|
-
|
|
29135
|
-
onSuccess: x => autoFundingConfiguration.refetch()
|
|
29194
|
+
setIsSwitchOn(isEnabled);
|
|
29195
|
+
setShowForm(isEnabled);
|
|
29196
|
+
formReset(isEnabled);
|
|
29197
|
+
if (!isEnabled) {
|
|
29198
|
+
setIsSwitchOn(isEnabled);
|
|
29199
|
+
updateAutoFunding.mutate(form.getValues(), {
|
|
29200
|
+
onSuccess: () => autoFundingConfiguration.refetch()
|
|
29136
29201
|
});
|
|
29137
|
-
} else {
|
|
29138
|
-
// TODO - [LMNT-663] Should this throw?
|
|
29139
|
-
logger.error("Toggling auto-funding failed because autoFundingData is undefined.");
|
|
29140
29202
|
}
|
|
29141
29203
|
};
|
|
29142
|
-
if (autoFundingConfiguration.isLoading) return jsx(Loader, {
|
|
29204
|
+
if (autoFundingConfiguration.isLoading || updateAutoFunding.isLoading) return jsx(Loader, {
|
|
29143
29205
|
message: t("manage-funding:autoFunding.isLoading")
|
|
29144
29206
|
});
|
|
29207
|
+
if (!autoFundingSettings) throw new Error(t("errorMessages:unableToLoad.autoFundingSettings"));
|
|
29145
29208
|
return jsxs(Fragment, {
|
|
29146
|
-
children: [
|
|
29147
|
-
|
|
29148
|
-
|
|
29149
|
-
|
|
29150
|
-
|
|
29151
|
-
|
|
29152
|
-
|
|
29153
|
-
|
|
29209
|
+
children: [jsxs(Spread, {
|
|
29210
|
+
children: [jsx(Typography, Object.assign({
|
|
29211
|
+
bold: !!(autoFundingSettings === null || autoFundingSettings === void 0 ? void 0 : autoFundingSettings.isAutoPurchaseEnabled),
|
|
29212
|
+
variant: "body1"
|
|
29213
|
+
}, {
|
|
29214
|
+
children: t("manage-funding:autoFunding:isEnabledCTA")
|
|
29215
|
+
})), jsx(Switch, {
|
|
29216
|
+
"data-testid": "auto-funding-toggle",
|
|
29217
|
+
defaultChecked: isSwitchOn,
|
|
29218
|
+
name: "isEnabled",
|
|
29219
|
+
onChange: e => handleToggle(e.target.checked),
|
|
29220
|
+
value: true
|
|
29221
|
+
})]
|
|
29222
|
+
}), jsx(Spacer, {
|
|
29223
|
+
multiplier: 1
|
|
29224
|
+
}), !!(autoFundingSettings === null || autoFundingSettings === void 0 ? void 0 : autoFundingSettings.isAutoPurchaseEnabled) && !showForm && jsxs(Spread, {
|
|
29225
|
+
children: [jsx(Typography, Object.assign({
|
|
29226
|
+
variant: "body1"
|
|
29227
|
+
}, {
|
|
29228
|
+
children: t("manage-funding:autoFunding.readSettings", Object.assign({}, autoFundingSettings))
|
|
29229
|
+
})), jsx(LinkAction, {
|
|
29230
|
+
css: styles.edit,
|
|
29231
|
+
onClick: () => handleToggle(true),
|
|
29232
|
+
title: t("manage-funding:autoFunding:edit")
|
|
29233
|
+
})]
|
|
29234
|
+
}), jsxs("form", Object.assign({
|
|
29154
29235
|
css: styles.form,
|
|
29236
|
+
"data-testid": "auto-funding-form",
|
|
29155
29237
|
id: "auto-funding-form",
|
|
29156
29238
|
onSubmit: handleSubmit
|
|
29157
29239
|
}, {
|
|
29158
|
-
children: [jsx(
|
|
29159
|
-
|
|
29160
|
-
|
|
29161
|
-
|
|
29162
|
-
|
|
29163
|
-
|
|
29164
|
-
|
|
29165
|
-
|
|
29166
|
-
|
|
29167
|
-
|
|
29168
|
-
|
|
29169
|
-
|
|
29170
|
-
|
|
29171
|
-
|
|
29172
|
-
|
|
29173
|
-
|
|
29174
|
-
|
|
29175
|
-
|
|
29176
|
-
|
|
29240
|
+
children: [jsx(Typography, Object.assign({
|
|
29241
|
+
bold: true,
|
|
29242
|
+
variant: "body1"
|
|
29243
|
+
}, {
|
|
29244
|
+
children: t("manage-funding:autoFunding:editSettings")
|
|
29245
|
+
})), jsx("div", Object.assign({
|
|
29246
|
+
css: styles.marginLeft
|
|
29247
|
+
}, {
|
|
29248
|
+
children: jsx(MoneyInput, {
|
|
29249
|
+
control: form.control,
|
|
29250
|
+
css: styles.input,
|
|
29251
|
+
"data-testid": "auto-funding-threshold-input",
|
|
29252
|
+
defaultValue: {
|
|
29253
|
+
amount: autoFundingSettings === null || autoFundingSettings === void 0 ? void 0 : autoFundingSettings.autoPurchaseThreshold,
|
|
29254
|
+
currency: Currency.USD
|
|
29255
|
+
},
|
|
29256
|
+
disabled: !watchIsEnabled,
|
|
29257
|
+
label: t("manage-funding:autoFunding.lowBalancePurchaseThreshold"),
|
|
29258
|
+
labelWeight: "normal",
|
|
29259
|
+
name: "lowBalancePurchaseThreshold",
|
|
29260
|
+
showCurrencySymbol: true
|
|
29261
|
+
})
|
|
29262
|
+
})), jsx("div", Object.assign({
|
|
29263
|
+
css: styles.marginLeft
|
|
29264
|
+
}, {
|
|
29265
|
+
children: jsx(MoneyInput, {
|
|
29266
|
+
control: form.control,
|
|
29267
|
+
css: styles.input,
|
|
29268
|
+
"data-testid": "auto-funding-purchase-amount-input",
|
|
29269
|
+
defaultValue: {
|
|
29270
|
+
amount: autoFundingSettings === null || autoFundingSettings === void 0 ? void 0 : autoFundingSettings.autoPurchaseAmount,
|
|
29271
|
+
currency: Currency.USD
|
|
29272
|
+
},
|
|
29273
|
+
disabled: !watchIsEnabled,
|
|
29274
|
+
label: t("manage-funding:autoFunding.purchaseAmount"),
|
|
29275
|
+
labelWeight: "normal",
|
|
29276
|
+
name: "purchaseAmount",
|
|
29277
|
+
showCurrencySymbol: true
|
|
29278
|
+
})
|
|
29279
|
+
})), jsx("div", Object.assign({
|
|
29280
|
+
css: styles.marginLeft
|
|
29281
|
+
}, {
|
|
29282
|
+
children: jsx(NumberInput, {
|
|
29283
|
+
control: form.control,
|
|
29284
|
+
css: styles.input,
|
|
29285
|
+
"data-testid": "auto-funding-max-per-day-input",
|
|
29286
|
+
defaultValue: autoFundingSettings === null || autoFundingSettings === void 0 ? void 0 : autoFundingSettings.autoPurchaseCutoff,
|
|
29287
|
+
disabled: !watchIsEnabled,
|
|
29288
|
+
isInteger: true,
|
|
29289
|
+
label: t("manage-funding:autoFunding.maximumPurchasesPerDay"),
|
|
29290
|
+
labelWeight: "normal",
|
|
29291
|
+
name: "maximumPurchasesPerDay"
|
|
29292
|
+
})
|
|
29293
|
+
})), jsxs(ButtonGroup, Object.assign({
|
|
29177
29294
|
justify: "end"
|
|
29178
29295
|
}, {
|
|
29179
29296
|
children: [jsx(Button, Object.assign({
|
|
29180
|
-
|
|
29181
|
-
onClick: () => form.reset(),
|
|
29297
|
+
onClick: isSwitchOn ? () => setShowForm(false) : () => handleToggle(false),
|
|
29182
29298
|
variant: ButtonVariant.TEXT
|
|
29183
29299
|
}, {
|
|
29184
29300
|
children: t("actions.cancel")
|
|
@@ -30285,8 +30401,7 @@ var common = {
|
|
|
30285
30401
|
differentBillingAddress: "Billing address is different from Ship From Address",
|
|
30286
30402
|
name: "Name on Card",
|
|
30287
30403
|
cardNumber: "Credit Card Number",
|
|
30288
|
-
|
|
30289
|
-
expirationYear: "Year",
|
|
30404
|
+
expiration: "Card Expiration",
|
|
30290
30405
|
cvv: "CVV"
|
|
30291
30406
|
}
|
|
30292
30407
|
},
|
|
@@ -30350,6 +30465,7 @@ var common = {
|
|
|
30350
30465
|
invalidNameOrCompany: "Recipient name and company name (if provided) must have two characters in first and last name.",
|
|
30351
30466
|
noWarehouses: "You must have an active warehouse in order to use this feature",
|
|
30352
30467
|
unableToLoad: {
|
|
30468
|
+
autoFundingSettings: "Unable to load auto funding settings",
|
|
30353
30469
|
carrier: "Unable to load carrier",
|
|
30354
30470
|
carriers: "Unable to load carriers",
|
|
30355
30471
|
salesOrder: "Unable to load order",
|
|
@@ -30480,16 +30596,19 @@ var manageFunding = {
|
|
|
30480
30596
|
saveRule: "Save Rule"
|
|
30481
30597
|
},
|
|
30482
30598
|
autoFunding: {
|
|
30483
|
-
|
|
30599
|
+
edit: "Edit",
|
|
30600
|
+
editSettings: "Edit Auto-Funding Settings",
|
|
30484
30601
|
error: {
|
|
30485
30602
|
title: "Auto-Funding Error",
|
|
30486
30603
|
message: "An error occurred while trying to configure to your auto-funding rules."
|
|
30487
30604
|
},
|
|
30605
|
+
isEnabledCTA: "Enable auto-funding",
|
|
30488
30606
|
isEnabled: "Enable Auto-Funding",
|
|
30489
30607
|
isLoading: "Loading auto-funding configuration...",
|
|
30490
|
-
lowBalancePurchaseThreshold: "
|
|
30491
|
-
maximumPurchasesPerDay: "Maximum
|
|
30492
|
-
purchaseAmount: "
|
|
30608
|
+
lowBalancePurchaseThreshold: "When balance falls below",
|
|
30609
|
+
maximumPurchasesPerDay: "Maximum times per day",
|
|
30610
|
+
purchaseAmount: "Add the following amount",
|
|
30611
|
+
readSettings: "When balance falls below ${{autoPurchaseThreshold}}, add ${{autoPurchaseAmount}} (maximum {{autoPurchaseCutoff}} times per day)."
|
|
30493
30612
|
},
|
|
30494
30613
|
addFunds: {
|
|
30495
30614
|
custom: "Custom...",
|
|
@@ -30501,7 +30620,8 @@ var manageFunding = {
|
|
|
30501
30620
|
labels: {
|
|
30502
30621
|
amount: "Amount"
|
|
30503
30622
|
},
|
|
30504
|
-
minimumPurchaseAmount: "Minimum Purchase $10.00"
|
|
30623
|
+
minimumPurchaseAmount: "Minimum Purchase $10.00",
|
|
30624
|
+
other: "Other..."
|
|
30505
30625
|
},
|
|
30506
30626
|
fundAndPurchase: {
|
|
30507
30627
|
finalBalance: "Final balance after payment:",
|
|
@@ -30671,7 +30791,7 @@ var registerWallet = {
|
|
|
30671
30791
|
billing: {
|
|
30672
30792
|
title: "Billing Management",
|
|
30673
30793
|
cardSubTitle: "Enter your credit card information",
|
|
30674
|
-
addressSubTitle: "
|
|
30794
|
+
addressSubTitle: "Billing Address",
|
|
30675
30795
|
info: "Your account balance handles the cost of labels, insurance and carrier adjustments."
|
|
30676
30796
|
},
|
|
30677
30797
|
carriers: {
|
|
@@ -31074,14 +31194,14 @@ const ManageWarehouses = () => {
|
|
|
31074
31194
|
returnAddress: payload.returnAddress,
|
|
31075
31195
|
warehouseId: warehouseId
|
|
31076
31196
|
});
|
|
31077
|
-
|
|
31197
|
+
yield refreshListWarehouses();
|
|
31078
31198
|
});
|
|
31079
31199
|
const handleSetDefault = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31080
31200
|
yield updateWarehouse(Object.assign(Object.assign({}, payload), {
|
|
31081
31201
|
isDefault: true,
|
|
31082
31202
|
warehouseId
|
|
31083
31203
|
}));
|
|
31084
|
-
|
|
31204
|
+
yield refreshListWarehouses();
|
|
31085
31205
|
});
|
|
31086
31206
|
if (isLoadingWarehouses) return jsx(Loader, {
|
|
31087
31207
|
message: t("loading.warehouses")
|
|
@@ -31227,7 +31347,7 @@ const useAddress = ({
|
|
|
31227
31347
|
}), [handleValidateAddress, onChange, shipment, updateShipment]);
|
|
31228
31348
|
useEffect(() => {
|
|
31229
31349
|
if (!addressPreference && (shipment === null || shipment === void 0 ? void 0 : shipment.shipTo)) {
|
|
31230
|
-
handleValidateAddress(shipment === null || shipment === void 0 ? void 0 : shipment.shipTo, salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.shipTo);
|
|
31350
|
+
void handleValidateAddress(shipment === null || shipment === void 0 ? void 0 : shipment.shipTo, salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.shipTo);
|
|
31231
31351
|
}
|
|
31232
31352
|
}, [addressPreference, handleValidateAddress, salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.shipTo, shipment === null || shipment === void 0 ? void 0 : shipment.shipTo]);
|
|
31233
31353
|
const charsetWarning = useMemo(() => Object.keys((addressPreference === null || addressPreference === void 0 ? void 0 : addressPreference.selection) || {}).reduce((warning, key) => {
|
|
@@ -31707,6 +31827,56 @@ const ConfigureShipment = _a => {
|
|
|
31707
31827
|
});
|
|
31708
31828
|
};
|
|
31709
31829
|
|
|
31830
|
+
const Onboarding = ({
|
|
31831
|
+
onCompleteOnboarding
|
|
31832
|
+
}) => {
|
|
31833
|
+
const {
|
|
31834
|
+
data: warehouses,
|
|
31835
|
+
refetch: refetchWarehouses
|
|
31836
|
+
} = useListWarehouses();
|
|
31837
|
+
const {
|
|
31838
|
+
mutateAsync: createWarehouse
|
|
31839
|
+
} = useCreateWarehouse();
|
|
31840
|
+
const {
|
|
31841
|
+
data: carriers,
|
|
31842
|
+
refetch: refetchCarriers
|
|
31843
|
+
} = useListCarriers();
|
|
31844
|
+
const {
|
|
31845
|
+
error: registerStampsCarrierErrors,
|
|
31846
|
+
mutateAsync: registerStampsCarrier
|
|
31847
|
+
} = useConnectCarrier();
|
|
31848
|
+
const {
|
|
31849
|
+
error: registerUpsCarrierErrors,
|
|
31850
|
+
mutateAsync: registerUpsCarrier
|
|
31851
|
+
} = useConnectCarrier();
|
|
31852
|
+
const {
|
|
31853
|
+
error: registerDhlCarrierErrors,
|
|
31854
|
+
mutateAsync: registerDhlCarrier
|
|
31855
|
+
} = useConnectCarrier();
|
|
31856
|
+
const onWarehouseCreated = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
31857
|
+
yield refetchWarehouses();
|
|
31858
|
+
}), [refetchWarehouses]);
|
|
31859
|
+
const onCarrierCreated = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
31860
|
+
yield refetchCarriers();
|
|
31861
|
+
}), [refetchCarriers]);
|
|
31862
|
+
if (!carriers) return jsx(Loader, {});
|
|
31863
|
+
if (!warehouses) return jsx(Loader, {});
|
|
31864
|
+
return jsx(Onboarding$1, {
|
|
31865
|
+
carriers: carriers,
|
|
31866
|
+
createWarehouse: createWarehouse,
|
|
31867
|
+
onCarrierCreated: onCarrierCreated,
|
|
31868
|
+
onCompleteOnboarding: onCompleteOnboarding,
|
|
31869
|
+
onWarehouseCreated: onWarehouseCreated,
|
|
31870
|
+
registerDhlCarrier: registerDhlCarrier,
|
|
31871
|
+
registerDhlCarrierErrors: registerDhlCarrierErrors,
|
|
31872
|
+
registerStampsCarrier: registerStampsCarrier,
|
|
31873
|
+
registerStampsCarrierErrors: registerStampsCarrierErrors,
|
|
31874
|
+
registerUpsCarrier: registerUpsCarrier,
|
|
31875
|
+
registerUpsCarrierErrors: registerUpsCarrierErrors,
|
|
31876
|
+
warehouses: warehouses
|
|
31877
|
+
});
|
|
31878
|
+
};
|
|
31879
|
+
|
|
31710
31880
|
const usePendingShipment = ({
|
|
31711
31881
|
onLoad,
|
|
31712
31882
|
salesOrder,
|
|
@@ -31778,7 +31948,8 @@ const useConfigureShipment = ({
|
|
|
31778
31948
|
onLoad,
|
|
31779
31949
|
onShipmentUpdated,
|
|
31780
31950
|
salesOrder,
|
|
31781
|
-
warehouseId
|
|
31951
|
+
warehouseId,
|
|
31952
|
+
printLabelLayout
|
|
31782
31953
|
}) => {
|
|
31783
31954
|
var _a, _b;
|
|
31784
31955
|
const {
|
|
@@ -31795,12 +31966,12 @@ const useConfigureShipment = ({
|
|
|
31795
31966
|
yield reloadPendingShipment();
|
|
31796
31967
|
yield onShipmentUpdated === null || onShipmentUpdated === void 0 ? void 0 : onShipmentUpdated(shipment);
|
|
31797
31968
|
}), [onShipmentUpdated, reloadPendingShipment]);
|
|
31798
|
-
const
|
|
31969
|
+
const labelLayoutSetting = (_b = (_a = useGetAccountSettings().data) === null || _a === void 0 ? void 0 : _a.defaultLabelLayout) !== null && _b !== void 0 ? _b : "4x6";
|
|
31799
31970
|
return {
|
|
31800
31971
|
errors: pendingShipmentErrors,
|
|
31801
31972
|
isLoading: isPendingShipmentLoading,
|
|
31802
31973
|
onShipmentUpdated: handleShipmentUpdated,
|
|
31803
|
-
printLabelLayout,
|
|
31974
|
+
printLabelLayout: printLabelLayout ? printLabelLayout : labelLayoutSetting,
|
|
31804
31975
|
shipment: pendingShipment,
|
|
31805
31976
|
warehouseId
|
|
31806
31977
|
};
|
|
@@ -31859,7 +32030,7 @@ const useImportSalesOrder = ({
|
|
|
31859
32030
|
};
|
|
31860
32031
|
};
|
|
31861
32032
|
|
|
31862
|
-
const
|
|
32033
|
+
const PurchaseLabelBySalesOrder = _a => {
|
|
31863
32034
|
var {
|
|
31864
32035
|
features,
|
|
31865
32036
|
externalOrderId,
|
|
@@ -31889,7 +32060,7 @@ const SalesOrder = _a => {
|
|
|
31889
32060
|
salesOrder,
|
|
31890
32061
|
warehouseId
|
|
31891
32062
|
});
|
|
31892
|
-
return jsx(
|
|
32063
|
+
return jsx(SuspendSalesOrder, Object.assign({
|
|
31893
32064
|
salesOrder: salesOrder
|
|
31894
32065
|
}, salesOrderProps, {
|
|
31895
32066
|
children: salesOrder && jsx(ConfigureShipment, Object.assign({
|
|
@@ -31899,67 +32070,77 @@ const SalesOrder = _a => {
|
|
|
31899
32070
|
}));
|
|
31900
32071
|
};
|
|
31901
32072
|
|
|
31902
|
-
const
|
|
31903
|
-
|
|
31904
|
-
const Onboarding = ({
|
|
31905
|
-
onCompleteOnboarding
|
|
32073
|
+
const useLoadShipment = ({
|
|
32074
|
+
shipmentId
|
|
31906
32075
|
}) => {
|
|
31907
32076
|
const {
|
|
31908
|
-
|
|
31909
|
-
|
|
31910
|
-
|
|
31911
|
-
|
|
31912
|
-
|
|
31913
|
-
|
|
31914
|
-
|
|
31915
|
-
|
|
31916
|
-
|
|
31917
|
-
|
|
31918
|
-
|
|
31919
|
-
|
|
31920
|
-
|
|
31921
|
-
|
|
31922
|
-
|
|
31923
|
-
|
|
31924
|
-
|
|
31925
|
-
|
|
31926
|
-
|
|
31927
|
-
|
|
31928
|
-
|
|
31929
|
-
|
|
31930
|
-
const {
|
|
31931
|
-
|
|
31932
|
-
|
|
31933
|
-
|
|
31934
|
-
|
|
31935
|
-
|
|
31936
|
-
|
|
31937
|
-
|
|
31938
|
-
|
|
31939
|
-
|
|
31940
|
-
|
|
31941
|
-
|
|
31942
|
-
|
|
31943
|
-
|
|
31944
|
-
|
|
31945
|
-
|
|
31946
|
-
|
|
31947
|
-
|
|
31948
|
-
|
|
31949
|
-
|
|
31950
|
-
|
|
31951
|
-
|
|
31952
|
-
|
|
31953
|
-
|
|
31954
|
-
|
|
31955
|
-
|
|
31956
|
-
|
|
31957
|
-
|
|
31958
|
-
|
|
31959
|
-
|
|
31960
|
-
|
|
31961
|
-
|
|
31962
|
-
|
|
32077
|
+
data: shipment,
|
|
32078
|
+
error: loadShipmentErrors,
|
|
32079
|
+
refetch: refetchShipment,
|
|
32080
|
+
isLoading
|
|
32081
|
+
} = useGetShipment(shipmentId);
|
|
32082
|
+
const errors = [...(loadShipmentErrors !== null && loadShipmentErrors !== void 0 ? loadShipmentErrors : [])];
|
|
32083
|
+
return {
|
|
32084
|
+
errors: errors.length > 0 ? errors : undefined,
|
|
32085
|
+
isLoading: isLoading,
|
|
32086
|
+
refetchShipment,
|
|
32087
|
+
shipment
|
|
32088
|
+
};
|
|
32089
|
+
};
|
|
32090
|
+
|
|
32091
|
+
const PurchaseLabelByShipment = _a => {
|
|
32092
|
+
var {
|
|
32093
|
+
shipmentId,
|
|
32094
|
+
onLoad,
|
|
32095
|
+
onShipmentUpdated,
|
|
32096
|
+
features
|
|
32097
|
+
} = _a,
|
|
32098
|
+
props = __rest(_a, ["shipmentId", "onLoad", "onShipmentUpdated", "features"]);
|
|
32099
|
+
const _b = useLoadShipment({
|
|
32100
|
+
shipmentId
|
|
32101
|
+
}),
|
|
32102
|
+
{
|
|
32103
|
+
shipment
|
|
32104
|
+
} = _b,
|
|
32105
|
+
shipmentProps = __rest(_b, ["shipment"]);
|
|
32106
|
+
return jsx(SuspendShipment, Object.assign({
|
|
32107
|
+
shipment: shipment
|
|
32108
|
+
}, shipmentProps, {
|
|
32109
|
+
children: shipment && jsx(ConfigureShipment, Object.assign({
|
|
32110
|
+
errors: shipmentProps.errors,
|
|
32111
|
+
features: features,
|
|
32112
|
+
isLoading: shipmentProps.isLoading,
|
|
32113
|
+
onAddressValidation: props.onAddressValidation,
|
|
32114
|
+
onApplyPreset: props.onApplyPreset,
|
|
32115
|
+
onBeforeLabelCreate: props.onBeforeLabelCreate,
|
|
32116
|
+
onChangeAddress: props.onChangeAddress,
|
|
32117
|
+
onChangeShipmentFormMode: props.onChangeShipmentFormMode,
|
|
32118
|
+
onLabelCreateFailure: props.onLabelCreateFailure,
|
|
32119
|
+
onLabelCreateSuccess: props.onLabelCreateSuccess,
|
|
32120
|
+
onRateSaved: props.onRateSaved,
|
|
32121
|
+
onRatesCalculated: props.onRatesCalculated,
|
|
32122
|
+
onShipmentUpdated: onShipmentUpdated,
|
|
32123
|
+
onToggleAddressPreferenceDisclosure: props.onToggleAddressPreferenceDisclosure,
|
|
32124
|
+
printLabelLayout: props.printLabelLayout,
|
|
32125
|
+
shipment: shipment,
|
|
32126
|
+
shippingPresets: props.shippingPresets,
|
|
32127
|
+
warehouseId: props.warehouseId
|
|
32128
|
+
}, props))
|
|
32129
|
+
}));
|
|
32130
|
+
};
|
|
32131
|
+
|
|
32132
|
+
const PurchaseLabel = _a => {
|
|
32133
|
+
var {
|
|
32134
|
+
shipmentId
|
|
32135
|
+
} = _a,
|
|
32136
|
+
props = __rest(_a, ["shipmentId"]);
|
|
32137
|
+
if (shipmentId) {
|
|
32138
|
+
return jsx(PurchaseLabelByShipment, Object.assign({
|
|
32139
|
+
shipmentId: shipmentId
|
|
32140
|
+
}, props));
|
|
32141
|
+
} else {
|
|
32142
|
+
return jsx(PurchaseLabelBySalesOrder, Object.assign({}, props));
|
|
32143
|
+
}
|
|
31963
32144
|
};
|
|
31964
32145
|
|
|
31965
32146
|
const Shipment = ({
|
|
@@ -32030,6 +32211,8 @@ const VoidLabel = ({
|
|
|
32030
32211
|
});
|
|
32031
32212
|
};
|
|
32032
32213
|
|
|
32214
|
+
const Element$3 = registerElement("purchase-label", PurchaseLabel);
|
|
32215
|
+
|
|
32033
32216
|
const Element$2 = registerElement("onboarding", Onboarding);
|
|
32034
32217
|
|
|
32035
32218
|
const Element$1 = registerElement("view-shipment", Shipment);
|
|
@@ -32749,4 +32932,4 @@ const renderWithAllProviders = component => {
|
|
|
32749
32932
|
});
|
|
32750
32933
|
};
|
|
32751
32934
|
|
|
32752
|
-
export { Accordion, AddFundsForm, AutoFundingForm, ButtonGroup, CarrierBalance, Country, Cube, ElementsContext, ElementsProvider, ErrorBoundary, ErrorFallback, fields as Field, FieldLabel, FormPortal, FundAndPurchase, GigerProvider, InlineLabel, ItemsBreakdown, LinkAction, Element$5 as ListCarriers, Loader, ManageFunding, Element$4 as ManageWarehouses, Element$2 as Onboarding, PageLayoutProvider, Portal, Element$3 as PurchaseLabel, RootPortalProvider, Spacer, Spread, StoryNotes, index$1 as Templates, UsState, UsaCity, Element$1 as ViewShipment, Element as VoidLabel, addressFactory, addressPreferenceFactory, addressValidationFactory, autoFundingSchema, calculateTotal, capitalizeFirstLetter, carrierFactory, carrierOptionFactory, convertDimensions, convertWeight, countries, countryCodes, createCodedErrors, createDictionary, createStyles, currencySymbol, customsItemFactory, daysAfter, downloadFactory, errorMap, euCountryCodes, extendZod, formLogger, formatCreditCardNumber, formatDate, formatFractionalWeight, formatMoney, fractionalWeightFactory, getAddFundsSchema, getCustomsFromSalesOrder, getExpirationYears, getIsCustomsRequiredForSalesOrder, getIsCustomsRequiredForShipment, getIsInternationalShipment, getPendingShipment, getRateRequiresAcknowledgement, getRequestedServices, getTotalRateAmount, isDomesticAddress, isFlatRatePackageCode, isMilitaryAddress, isNowOrInTheFuture, isPoBox, isPoBoxAddress, isString, isUnitedStatesTerritory, isUspsCarrier, labelFactory, linkedResourceFactory, moneyFactory, moneySchema, mostRecent, nextDayCutoff, omitTime, orderSourceFactory, orderSourceRefreshInfoFactory, packageFactory, phoneSchema, phoneSchemaUnvalidated, postalCodeRegex$3 as postalCodeRegex, randomDeliveryConfirmation, randomFulfillmentStatus, randomInsuranceProvider, randomOrderSourceCode, randomPaymentStatus, randomShipengineId, randomShipengineSlug, randomWeightUnit, registerElement, renderWithAllProviders, renderWithProviders, salesOrderFactory, salesOrderItemFactory, salesOrderShipmentFactory, serviceFactory, shipmentFactory, shipmentItemFactory, shipmentPackageFactory, sortByCreationDate, tristateValue, usCities, usStateCodes, usStates, useCarrierMetadata, useConfirmationOptions, useCountryCodeOptions, useCustomsContentsOptions, useCustomsNonDeliveryOptions, useElements, useExpirationMonthOptions, useInsuranceProviderOptions, useNestedForm, usePackageOptions, usePageLayout, useRateOptions, useRootPortal, useRunOnceOnTrue, useServiceCodeOptions, useShippingPresetsOptions, useStateCodeOptions, useToggle, useWarehouseOptions, validationResolver, warehouseFactory, weightFactory, weightWithUnitFactory };
|
|
32935
|
+
export { Accordion, AddFundsForm, AutoFundingForm, ButtonGroup, CarrierBalance, Country, Cube, ElementsContext, ElementsProvider, ErrorBoundary, ErrorFallback, fields as Field, FieldLabel, FormPortal, FundAndPurchase, GigerProvider, InlineLabel, ItemsBreakdown, LinkAction, Element$5 as ListCarriers, Loader, ManageFunding, Element$4 as ManageWarehouses, Element$2 as Onboarding, PageLayoutProvider, Portal, Element$3 as PurchaseLabel, RootPortalProvider, Spacer, Spread, StoryNotes, index$1 as Templates, UsState, UsaCity, Element$1 as ViewShipment, Element as VoidLabel, addressFactory, addressPreferenceFactory, addressValidationFactory, autoFundingSchema, calculateTotal, capitalizeFirstLetter, carrierFactory, carrierOptionFactory, convertDimensions, convertWeight, countries, countryCodes, createCodedErrors, createDictionary, createStyles, currencySymbol, customsItemFactory, daysAfter, downloadFactory, errorMap, euCountryCodes, extendZod, formLogger, formatCreditCardNumber, formatDate, formatExpiration, formatFractionalWeight, formatMoney, fractionalWeightFactory, getAddFundsSchema, getCustomsFromSalesOrder, getExpirationYears, getIsCustomsRequiredForSalesOrder, getIsCustomsRequiredForShipment, getIsInternationalShipment, getPendingShipment, getRateRequiresAcknowledgement, getRequestedServices, getSalesOrderItemsFromSalesOrderOrShipment, getTotalRateAmount, isDomesticAddress, isFlatRatePackageCode, isMilitaryAddress, isNowOrInTheFuture, isPoBox, isPoBoxAddress, isString, isUnitedStatesTerritory, isUspsCarrier, labelFactory, linkedResourceFactory, moneyFactory, moneySchema, mostRecent, nextDayCutoff, omitTime, orderSourceFactory, orderSourceRefreshInfoFactory, packageFactory, phoneSchema, phoneSchemaUnvalidated, postalCodeRegex$3 as postalCodeRegex, randomDeliveryConfirmation, randomFulfillmentStatus, randomInsuranceProvider, randomOrderSourceCode, randomPaymentStatus, randomShipengineId, randomShipengineSlug, randomWeightUnit, registerElement, renderWithAllProviders, renderWithProviders, salesOrderFactory, salesOrderItemFactory, salesOrderShipmentFactory, serviceFactory, shipmentFactory, shipmentItemFactory, shipmentPackageFactory, sortByCreationDate, tristateValue, usCities, usStateCodes, usStates, useCarrierMetadata, useConfirmationOptions, useCountryCodeOptions, useCustomsContentsOptions, useCustomsNonDeliveryOptions, useElements, useExpirationMonthOptions, useInsuranceProviderOptions, useNestedForm, usePackageOptions, usePageLayout, useRateOptions, useRootPortal, useRunOnceOnTrue, useServiceCodeOptions, useShippingPresetsOptions, useStateCodeOptions, useToggle, useWarehouseOptions, validationResolver, warehouseFactory, weightFactory, weightWithUnitFactory };
|