@shipengine/elements 0.17.2 → 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/templates/address-form/address-fields.styles.d.ts +1 -0
- 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/wallet-form/wallet-schema.d.ts +7 -12
- package/index.cjs +1442 -1389
- package/index.js +1443 -1391
- 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/index.js
CHANGED
|
@@ -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,1092 +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
|
-
|
|
2477
|
-
/**
|
|
2478
|
-
* @category Utilities
|
|
2479
|
-
*/
|
|
2480
|
-
const getCustomsFromSalesOrder = (salesOrder, warehouse) => ({
|
|
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
|
-
};
|
|
2505
|
-
const getSalesOrderItemsFromSalesOrderOrShipment = ({
|
|
2506
|
-
salesOrder,
|
|
2507
|
-
shipment
|
|
2508
|
-
}) => {
|
|
2509
|
-
var _a, _b;
|
|
2510
|
-
return (_b = (_a = salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.salesOrderItems.map(item => ({
|
|
2511
|
-
detail: `SKU ${item.lineItemDetails.sku}`,
|
|
2512
|
-
name: item.lineItemDetails.name,
|
|
2513
|
-
quantity: item.quantity,
|
|
2514
|
-
subDetail: item.requestedShippingOptions.shippingService,
|
|
2515
|
-
subDetailValue: item.priceSummary.estimatedShipping,
|
|
2516
|
-
totalValue: item.priceSummary.total,
|
|
2517
|
-
value: item.priceSummary.unitPrice
|
|
2518
|
-
}))) !== null && _a !== void 0 ? _a : shipment === null || shipment === void 0 ? void 0 : shipment.items.map((item, i) => ({
|
|
2519
|
-
detail: `SKU ${item.sku}`,
|
|
2520
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || `ITEM ${i}`,
|
|
2521
|
-
quantity: item.quantity
|
|
2522
|
-
}))) !== null && _b !== void 0 ? _b : [];
|
|
2523
|
-
};
|
|
2524
|
-
|
|
2525
|
-
var tryToString$3 = tryToString$5;
|
|
2526
2220
|
|
|
2527
|
-
var
|
|
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/;
|
|
2528
2225
|
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
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
|
+
}
|
|
2532
2238
|
|
|
2533
|
-
|
|
2534
|
-
var definePropertyModule$1 = objectDefineProperty;
|
|
2535
|
-
var createPropertyDescriptor = createPropertyDescriptor$4;
|
|
2239
|
+
re.exec = function () { execCalled = true; return null; };
|
|
2536
2240
|
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
else object[propertyKey] = value;
|
|
2541
|
-
};
|
|
2241
|
+
re[SYMBOL]('');
|
|
2242
|
+
return !execCalled;
|
|
2243
|
+
});
|
|
2542
2244
|
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
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
|
+
});
|
|
2546
2265
|
|
|
2547
|
-
|
|
2548
|
-
|
|
2266
|
+
defineBuiltIn$4(String.prototype, KEY, methods[0]);
|
|
2267
|
+
defineBuiltIn$4(RegExpPrototype$2, SYMBOL, methods[1]);
|
|
2268
|
+
}
|
|
2549
2269
|
|
|
2550
|
-
|
|
2551
|
-
var length = lengthOfArrayLike$5(O);
|
|
2552
|
-
var k = toAbsoluteIndex(start, length);
|
|
2553
|
-
var fin = toAbsoluteIndex(end === undefined ? length : end, length);
|
|
2554
|
-
var result = $Array$1(max$1(fin - k, 0));
|
|
2555
|
-
for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
|
|
2556
|
-
result.length = n;
|
|
2557
|
-
return result;
|
|
2270
|
+
if (SHAM) createNonEnumerableProperty(RegExpPrototype$2[SYMBOL], 'sham', true);
|
|
2558
2271
|
};
|
|
2559
2272
|
|
|
2560
|
-
var
|
|
2273
|
+
var uncurryThis$d = functionUncurryThis;
|
|
2274
|
+
var toIntegerOrInfinity$4 = toIntegerOrInfinity$7;
|
|
2275
|
+
var toString$9 = toString$c;
|
|
2276
|
+
var requireObjectCoercible$5 = requireObjectCoercible$9;
|
|
2561
2277
|
|
|
2562
|
-
var
|
|
2278
|
+
var charAt$3 = uncurryThis$d(''.charAt);
|
|
2279
|
+
var charCodeAt = uncurryThis$d(''.charCodeAt);
|
|
2280
|
+
var stringSlice$5 = uncurryThis$d(''.slice);
|
|
2563
2281
|
|
|
2564
|
-
var
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
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
|
+
};
|
|
2573
2299
|
};
|
|
2574
2300
|
|
|
2575
|
-
var
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
element = array[i];
|
|
2583
|
-
while (j && comparefn(array[j - 1], element) > 0) {
|
|
2584
|
-
array[j] = array[--j];
|
|
2585
|
-
}
|
|
2586
|
-
if (j !== i++) array[j] = element;
|
|
2587
|
-
} return array;
|
|
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)
|
|
2588
2308
|
};
|
|
2589
2309
|
|
|
2590
|
-
var
|
|
2591
|
-
var llength = left.length;
|
|
2592
|
-
var rlength = right.length;
|
|
2593
|
-
var lindex = 0;
|
|
2594
|
-
var rindex = 0;
|
|
2310
|
+
var charAt$2 = stringMultibyte.charAt;
|
|
2595
2311
|
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
} return array;
|
|
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);
|
|
2601
2316
|
};
|
|
2602
2317
|
|
|
2603
|
-
var
|
|
2604
|
-
|
|
2605
|
-
var userAgent$4 = engineUserAgent;
|
|
2606
|
-
|
|
2607
|
-
var firefox = userAgent$4.match(/firefox\/(\d+)/i);
|
|
2608
|
-
|
|
2609
|
-
var engineFfVersion = !!firefox && +firefox[1];
|
|
2610
|
-
|
|
2611
|
-
var UA = engineUserAgent;
|
|
2318
|
+
var uncurryThis$c = functionUncurryThis;
|
|
2319
|
+
var toObject$3 = toObject$8;
|
|
2612
2320
|
|
|
2613
|
-
var
|
|
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;
|
|
2614
2327
|
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
var
|
|
2618
|
-
|
|
2619
|
-
var
|
|
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];
|
|
2358
|
+
}
|
|
2359
|
+
return capture === undefined ? '' : capture;
|
|
2360
|
+
});
|
|
2361
|
+
};
|
|
2620
2362
|
|
|
2621
|
-
var
|
|
2622
|
-
var
|
|
2623
|
-
var
|
|
2624
|
-
var
|
|
2625
|
-
var
|
|
2626
|
-
var deletePropertyOrThrow = deletePropertyOrThrow$1;
|
|
2627
|
-
var toString$9 = toString$c;
|
|
2628
|
-
var fails$9 = fails$r;
|
|
2629
|
-
var internalSort = arraySort;
|
|
2630
|
-
var arrayMethodIsStrict = arrayMethodIsStrict$2;
|
|
2631
|
-
var FF = engineFfVersion;
|
|
2632
|
-
var IE_OR_EDGE = engineIsIeOrEdge;
|
|
2633
|
-
var V8 = engineV8Version;
|
|
2634
|
-
var WEBKIT = engineWebkitVersion;
|
|
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;
|
|
2635
2368
|
|
|
2636
|
-
var
|
|
2637
|
-
var nativeSort = uncurryThis$f(test.sort);
|
|
2638
|
-
var push$1 = uncurryThis$f(test.push);
|
|
2369
|
+
var $TypeError$9 = TypeError;
|
|
2639
2370
|
|
|
2640
|
-
//
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
var
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
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
|
+
};
|
|
2650
2383
|
|
|
2651
|
-
var
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2384
|
+
var apply$1 = functionApply;
|
|
2385
|
+
var call$9 = functionCall;
|
|
2386
|
+
var uncurryThis$b = functionUncurryThis;
|
|
2387
|
+
var fixRegExpWellKnownSymbolLogic$1 = fixRegexpWellKnownSymbolLogic;
|
|
2388
|
+
var fails$9 = fails$r;
|
|
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;
|
|
2657
2401
|
|
|
2658
|
-
|
|
2659
|
-
|
|
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);
|
|
2660
2409
|
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2410
|
+
var maybeToString = function (it) {
|
|
2411
|
+
return it === undefined ? it : String(it);
|
|
2412
|
+
};
|
|
2664
2413
|
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
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
|
+
})();
|
|
2670
2420
|
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
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') === '';
|
|
2674
2425
|
}
|
|
2426
|
+
return false;
|
|
2427
|
+
})();
|
|
2675
2428
|
|
|
2676
|
-
|
|
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
|
+
});
|
|
2677
2439
|
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
}
|
|
2440
|
+
// @@replace logic
|
|
2441
|
+
fixRegExpWellKnownSymbolLogic$1('replace', function (_, nativeReplace, maybeCallNative) {
|
|
2442
|
+
var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
|
|
2682
2443
|
|
|
2683
|
-
return
|
|
2684
|
-
|
|
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);
|
|
2685
2459
|
|
|
2686
|
-
|
|
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
|
+
}
|
|
2687
2468
|
|
|
2688
|
-
var
|
|
2689
|
-
|
|
2690
|
-
if (y === undefined) return -1;
|
|
2691
|
-
if (x === undefined) return 1;
|
|
2692
|
-
if (comparefn !== undefined) return +comparefn(x, y) || 0;
|
|
2693
|
-
return toString$9(x) > toString$9(y) ? 1 : -1;
|
|
2694
|
-
};
|
|
2695
|
-
};
|
|
2469
|
+
var functionalReplace = isCallable$7(replaceValue);
|
|
2470
|
+
if (!functionalReplace) replaceValue = toString$8(replaceValue);
|
|
2696
2471
|
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
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;
|
|
2702
2481
|
|
|
2703
|
-
|
|
2482
|
+
push$1(results, result);
|
|
2483
|
+
if (!global) break;
|
|
2704
2484
|
|
|
2705
|
-
|
|
2485
|
+
var matchStr = toString$8(result[0]);
|
|
2486
|
+
if (matchStr === '') rx.lastIndex = advanceStringIndex$1(S, toLength$2(rx.lastIndex), fullUnicode);
|
|
2487
|
+
}
|
|
2706
2488
|
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2489
|
+
var accumulatedResult = '';
|
|
2490
|
+
var nextSourcePosition = 0;
|
|
2491
|
+
for (var i = 0; i < results.length; i++) {
|
|
2492
|
+
result = results[i];
|
|
2710
2493
|
|
|
2711
|
-
|
|
2712
|
-
|
|
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);
|
|
2713
2517
|
}
|
|
2518
|
+
];
|
|
2519
|
+
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
|
|
2714
2520
|
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
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
|
+
};
|
|
2719
2548
|
|
|
2720
|
-
|
|
2721
|
-
while (index < arrayLength) deletePropertyOrThrow(array, index++);
|
|
2549
|
+
const isString = x => typeof x === "string";
|
|
2722
2550
|
|
|
2723
|
-
|
|
2551
|
+
const getRateRequiresAcknowledgement = serviceCode => {
|
|
2552
|
+
switch (serviceCode) {
|
|
2553
|
+
case "usps_media_mail":
|
|
2554
|
+
return true;
|
|
2555
|
+
default:
|
|
2556
|
+
return false;
|
|
2724
2557
|
}
|
|
2725
|
-
}
|
|
2558
|
+
};
|
|
2559
|
+
const getTotalRateAmount = (rateCosts = {}) => calculateTotal(...Object.values(rateCosts));
|
|
2560
|
+
|
|
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;
|
|
2578
|
+
}
|
|
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
|
|
2726
2754
|
|
|
2727
2755
|
/**
|
|
2728
2756
|
* @category Utilities
|
|
2729
2757
|
*/
|
|
2730
|
-
const
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
}
|
|
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
|
+
};
|
|
2734
2762
|
/**
|
|
2735
2763
|
* @category Utilities
|
|
2736
2764
|
*/
|
|
2737
|
-
const
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
}
|
|
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
|
+
};
|
|
2741
2769
|
/**
|
|
2742
2770
|
* @category Utilities
|
|
2743
2771
|
*/
|
|
2744
|
-
const
|
|
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));
|
|
2745
2787
|
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
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
|
+
});
|
|
2797
|
+
|
|
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);
|
|
2753
2803
|
}
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2804
|
+
});
|
|
2805
|
+
|
|
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
|
+
});
|
|
2758
2823
|
}
|
|
2824
|
+
|
|
2759
2825
|
/**
|
|
2760
2826
|
* @category Utilities
|
|
2761
2827
|
*/
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
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 : [];
|
|
2871
|
+
};
|
|
2774
2872
|
|
|
2775
|
-
var
|
|
2776
|
-
var classof$4 = classofRaw$2;
|
|
2777
|
-
var wellKnownSymbol$a = wellKnownSymbol$j;
|
|
2873
|
+
var tryToString$3 = tryToString$5;
|
|
2778
2874
|
|
|
2779
|
-
var
|
|
2875
|
+
var $TypeError$8 = TypeError;
|
|
2780
2876
|
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
var isRegexp = function (it) {
|
|
2784
|
-
var isRegExp;
|
|
2785
|
-
return isObject$3(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$4(it) == 'RegExp');
|
|
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));
|
|
2786
2879
|
};
|
|
2787
2880
|
|
|
2788
|
-
var
|
|
2881
|
+
var toPropertyKey = toPropertyKey$3;
|
|
2882
|
+
var definePropertyModule$1 = objectDefineProperty;
|
|
2883
|
+
var createPropertyDescriptor = createPropertyDescriptor$4;
|
|
2789
2884
|
|
|
2790
|
-
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
|
+
};
|
|
2791
2890
|
|
|
2792
|
-
var
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
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;
|
|
2796
2906
|
};
|
|
2797
2907
|
|
|
2798
|
-
var
|
|
2908
|
+
var arraySlice$2 = arraySliceSimple;
|
|
2799
2909
|
|
|
2800
|
-
var
|
|
2910
|
+
var floor$1 = Math.floor;
|
|
2801
2911
|
|
|
2802
|
-
var
|
|
2803
|
-
var
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
} return false;
|
|
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
|
+
);
|
|
2812
2921
|
};
|
|
2813
2922
|
|
|
2814
|
-
var
|
|
2815
|
-
var
|
|
2816
|
-
var
|
|
2817
|
-
var
|
|
2818
|
-
var toString$8 = toString$c;
|
|
2819
|
-
var correctIsRegExpLogic$1 = correctIsRegexpLogic;
|
|
2923
|
+
var insertionSort = function (array, comparefn) {
|
|
2924
|
+
var length = array.length;
|
|
2925
|
+
var i = 1;
|
|
2926
|
+
var element, j;
|
|
2820
2927
|
|
|
2821
|
-
|
|
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
|
+
};
|
|
2822
2937
|
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
toString$8(requireObjectCoercible$5(this)),
|
|
2829
|
-
toString$8(notARegExp$1(searchString)),
|
|
2830
|
-
arguments.length > 1 ? arguments[1] : undefined
|
|
2831
|
-
);
|
|
2832
|
-
}
|
|
2833
|
-
});
|
|
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;
|
|
2834
2943
|
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
return
|
|
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;
|
|
2840
2949
|
};
|
|
2841
2950
|
|
|
2842
|
-
|
|
2951
|
+
var arraySort = mergeSort;
|
|
2843
2952
|
|
|
2844
|
-
|
|
2845
|
-
* Creates a Record of Emotion styles.
|
|
2846
|
-
*
|
|
2847
|
-
* Values may be any variant that a `css` prop can accept (a CSSObject, SerializedStyles, a FunctionInterpolation with theme, etc).
|
|
2848
|
-
*
|
|
2849
|
-
* Eliminates the need to explicitly type styles (while remaining fully typed w/ autocomplete).
|
|
2850
|
-
*
|
|
2851
|
-
* @example
|
|
2852
|
-
* ```
|
|
2853
|
-
* const styles = createStyles({
|
|
2854
|
-
* container: (theme) => ({ backgroundColor: theme.colors.primary }),
|
|
2855
|
-
* icon: { color: 'red' },
|
|
2856
|
-
* });
|
|
2857
|
-
* ```
|
|
2858
|
-
*/
|
|
2859
|
-
const createStyles = styles => styles;
|
|
2953
|
+
var userAgent$4 = engineUserAgent;
|
|
2860
2954
|
|
|
2861
|
-
|
|
2862
|
-
const meta = __rest(error, ["code", "message", "path"]);
|
|
2863
|
-
return JSON.stringify(Object.assign({
|
|
2864
|
-
message: translationKey
|
|
2865
|
-
}, meta));
|
|
2866
|
-
};
|
|
2867
|
-
/**
|
|
2868
|
-
* @category Utilities
|
|
2869
|
-
*/
|
|
2870
|
-
const errorMap = (issue, ctx) => {
|
|
2871
|
-
let messageCode;
|
|
2872
|
-
// TODO - Fill in the rest of the codes (positive, max, etc)
|
|
2873
|
-
switch (issue.code) {
|
|
2874
|
-
// Invalid Type
|
|
2875
|
-
case z.ZodIssueCode.invalid_type:
|
|
2876
|
-
switch (issue.received) {
|
|
2877
|
-
case "null":
|
|
2878
|
-
case "undefined":
|
|
2879
|
-
messageCode = "schemaErrors.required";
|
|
2880
|
-
break;
|
|
2881
|
-
}
|
|
2882
|
-
break;
|
|
2883
|
-
case z.ZodIssueCode.invalid_string:
|
|
2884
|
-
messageCode = "schemaErrors.invalidString";
|
|
2885
|
-
break;
|
|
2886
|
-
case z.ZodIssueCode.too_small:
|
|
2887
|
-
switch (issue.type) {
|
|
2888
|
-
case "number":
|
|
2889
|
-
if (issue.minimum === 0) {
|
|
2890
|
-
messageCode = issue.inclusive ? "schemaErrors.nonnegative" : "schemaErrors.positive";
|
|
2891
|
-
}
|
|
2892
|
-
break;
|
|
2893
|
-
case "string":
|
|
2894
|
-
messageCode = buildError("schemaErrors.tooFewCharacters", issue);
|
|
2895
|
-
break;
|
|
2896
|
-
}
|
|
2897
|
-
break;
|
|
2898
|
-
case z.ZodIssueCode.too_big:
|
|
2899
|
-
switch (issue.type) {
|
|
2900
|
-
case "string":
|
|
2901
|
-
messageCode = buildError("schemaErrors.tooManyCharacters", issue);
|
|
2902
|
-
break;
|
|
2903
|
-
}
|
|
2904
|
-
break;
|
|
2905
|
-
}
|
|
2906
|
-
return {
|
|
2907
|
-
message: messageCode !== null && messageCode !== void 0 ? messageCode : ctx.defaultError
|
|
2908
|
-
};
|
|
2909
|
-
};
|
|
2910
|
-
/**
|
|
2911
|
-
* @category Utilities
|
|
2912
|
-
*/
|
|
2913
|
-
const validationResolver = schema => (values, context, resolverOptions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2914
|
-
const getValidationResult = () => zodResolver(schema, {
|
|
2915
|
-
errorMap
|
|
2916
|
-
})(values, undefined, resolverOptions);
|
|
2917
|
-
const validationResult = yield formLogger.isSubmitting ? formLogger.log(values, getValidationResult) : getValidationResult();
|
|
2918
|
-
return validationResult;
|
|
2919
|
-
});
|
|
2955
|
+
var firefox = userAgent$4.match(/firefox\/(\d+)/i);
|
|
2920
2956
|
|
|
2921
|
-
|
|
2922
|
-
var {
|
|
2923
|
-
children,
|
|
2924
|
-
justify,
|
|
2925
|
-
toolbar = false
|
|
2926
|
-
} = _a,
|
|
2927
|
-
props = __rest(_a, ["children", "justify", "toolbar"]);
|
|
2928
|
-
const styles = {
|
|
2929
|
-
group: theme => Object.assign({
|
|
2930
|
-
alignItems: "center",
|
|
2931
|
-
display: "flex",
|
|
2932
|
-
justifyContent: justify,
|
|
2933
|
-
width: "100%"
|
|
2934
|
-
}, toolbar ? {
|
|
2935
|
-
"& > button": {
|
|
2936
|
-
"&:not(:first-of-type)": {
|
|
2937
|
-
borderBottomLeftRadius: 0,
|
|
2938
|
-
borderTopLeftRadius: 0
|
|
2939
|
-
},
|
|
2940
|
-
"&:not(:last-child)": {
|
|
2941
|
-
borderBottomRightRadius: 0,
|
|
2942
|
-
borderTopRightRadius: 0
|
|
2943
|
-
}
|
|
2944
|
-
}
|
|
2945
|
-
} : {
|
|
2946
|
-
gap: theme.spacing(2)
|
|
2947
|
-
})
|
|
2948
|
-
};
|
|
2949
|
-
return jsx("div", Object.assign({}, props, {
|
|
2950
|
-
css: styles.group,
|
|
2951
|
-
role: "group"
|
|
2952
|
-
}, {
|
|
2953
|
-
children: children
|
|
2954
|
-
}));
|
|
2955
|
-
};
|
|
2957
|
+
var engineFfVersion = !!firefox && +firefox[1];
|
|
2956
2958
|
|
|
2957
|
-
var
|
|
2959
|
+
var UA = engineUserAgent;
|
|
2958
2960
|
|
|
2959
|
-
var
|
|
2960
|
-
var apply$2 = FunctionPrototype.apply;
|
|
2961
|
-
var call$b = FunctionPrototype.call;
|
|
2961
|
+
var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
|
|
2962
2962
|
|
|
2963
|
-
|
|
2964
|
-
var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$b.bind(apply$2) : function () {
|
|
2965
|
-
return call$b.apply(apply$2, arguments);
|
|
2966
|
-
});
|
|
2963
|
+
var userAgent$3 = engineUserAgent;
|
|
2967
2964
|
|
|
2968
|
-
var
|
|
2969
|
-
var uncurryThis$d = functionUncurryThis;
|
|
2965
|
+
var webkit = userAgent$3.match(/AppleWebKit\/(\d+)\./);
|
|
2970
2966
|
|
|
2971
|
-
var
|
|
2972
|
-
// Nashorn bug:
|
|
2973
|
-
// https://github.com/zloirock/core-js/issues/1128
|
|
2974
|
-
// https://github.com/zloirock/core-js/issues/1130
|
|
2975
|
-
if (classofRaw(fn) === 'Function') return uncurryThis$d(fn);
|
|
2976
|
-
};
|
|
2967
|
+
var engineWebkitVersion = !!webkit && +webkit[1];
|
|
2977
2968
|
|
|
2978
|
-
|
|
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;
|
|
2979
2983
|
|
|
2980
|
-
var
|
|
2981
|
-
var
|
|
2982
|
-
var
|
|
2983
|
-
var fails$8 = fails$r;
|
|
2984
|
-
var wellKnownSymbol$8 = wellKnownSymbol$j;
|
|
2985
|
-
var createNonEnumerableProperty = createNonEnumerableProperty$5;
|
|
2984
|
+
var test = [];
|
|
2985
|
+
var nativeSort = uncurryThis$a(test.sort);
|
|
2986
|
+
var push = uncurryThis$a(test.push);
|
|
2986
2987
|
|
|
2987
|
-
|
|
2988
|
-
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');
|
|
2989
2998
|
|
|
2990
|
-
var
|
|
2991
|
-
|
|
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;
|
|
2992
3005
|
|
|
2993
|
-
var
|
|
2994
|
-
|
|
2995
|
-
var O = {};
|
|
2996
|
-
O[SYMBOL] = function () { return 7; };
|
|
2997
|
-
return ''[KEY](O) != 7;
|
|
2998
|
-
});
|
|
3006
|
+
var result = '';
|
|
3007
|
+
var code, chr, value, index;
|
|
2999
3008
|
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
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);
|
|
3004
3012
|
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
re = {};
|
|
3010
|
-
// RegExp[@@split] doesn't call the regex's exec method, but first creates
|
|
3011
|
-
// a new one. We need to return the patched regex when creating the new one.
|
|
3012
|
-
re.constructor = {};
|
|
3013
|
-
re.constructor[SPECIES$4] = function () { return re; };
|
|
3014
|
-
re.flags = '';
|
|
3015
|
-
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;
|
|
3016
3017
|
}
|
|
3017
3018
|
|
|
3018
|
-
|
|
3019
|
+
for (index = 0; index < 47; index++) {
|
|
3020
|
+
test.push({ k: chr + index, v: value });
|
|
3021
|
+
}
|
|
3022
|
+
}
|
|
3019
3023
|
|
|
3020
|
-
|
|
3021
|
-
return !execCalled;
|
|
3022
|
-
});
|
|
3024
|
+
test.sort(function (a, b) { return b.v - a.v; });
|
|
3023
3025
|
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
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;
|
|
3029
|
+
}
|
|
3030
|
+
|
|
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);
|
|
3052
|
+
|
|
3053
|
+
if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
|
|
3054
|
+
|
|
3055
|
+
var items = [];
|
|
3056
|
+
var arrayLength = lengthOfArrayLike$4(array);
|
|
3057
|
+
var itemsLength, index;
|
|
3044
3058
|
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3059
|
+
for (index = 0; index < arrayLength; index++) {
|
|
3060
|
+
if (index in array) push(items, array[index]);
|
|
3061
|
+
}
|
|
3048
3062
|
|
|
3049
|
-
|
|
3050
|
-
};
|
|
3063
|
+
internalSort(items, getSortCompare(comparefn));
|
|
3051
3064
|
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
var toString$7 = toString$c;
|
|
3055
|
-
var requireObjectCoercible$4 = requireObjectCoercible$9;
|
|
3065
|
+
itemsLength = lengthOfArrayLike$4(items);
|
|
3066
|
+
index = 0;
|
|
3056
3067
|
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
var stringSlice$5 = uncurryThis$b(''.slice);
|
|
3068
|
+
while (index < itemsLength) array[index] = items[index++];
|
|
3069
|
+
while (index < arrayLength) deletePropertyOrThrow(array, index++);
|
|
3060
3070
|
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3071
|
+
return array;
|
|
3072
|
+
}
|
|
3073
|
+
});
|
|
3074
|
+
|
|
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];
|
|
3093
|
+
|
|
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
|
+
};
|
|
3101
|
+
}
|
|
3102
|
+
return {
|
|
3103
|
+
unit: "ounce",
|
|
3104
|
+
value: (weight.whole || 0) * 16 + (weight.fractional || 0)
|
|
3077
3105
|
};
|
|
3078
|
-
}
|
|
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
|
+
}
|
|
3079
3122
|
|
|
3080
|
-
var
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
codeAt: createMethod(false),
|
|
3084
|
-
// `String.prototype.at` method
|
|
3085
|
-
// https://github.com/mathiasbynens/String.prototype.at
|
|
3086
|
-
charAt: createMethod(true)
|
|
3087
|
-
};
|
|
3123
|
+
var isObject$3 = isObject$a;
|
|
3124
|
+
var classof$3 = classofRaw$2;
|
|
3125
|
+
var wellKnownSymbol$8 = wellKnownSymbol$j;
|
|
3088
3126
|
|
|
3089
|
-
var
|
|
3127
|
+
var MATCH$1 = wellKnownSymbol$8('match');
|
|
3090
3128
|
|
|
3091
|
-
// `
|
|
3092
|
-
// https://tc39.es/ecma262/#sec-
|
|
3093
|
-
var
|
|
3094
|
-
|
|
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');
|
|
3095
3134
|
};
|
|
3096
3135
|
|
|
3097
|
-
var
|
|
3098
|
-
var toObject$2 = toObject$8;
|
|
3136
|
+
var isRegExp = isRegexp;
|
|
3099
3137
|
|
|
3100
|
-
var
|
|
3101
|
-
var charAt$1 = uncurryThis$a(''.charAt);
|
|
3102
|
-
var replace$1 = uncurryThis$a(''.replace);
|
|
3103
|
-
var stringSlice$4 = uncurryThis$a(''.slice);
|
|
3104
|
-
var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
|
|
3105
|
-
var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
|
|
3138
|
+
var $TypeError$7 = TypeError;
|
|
3106
3139
|
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
var m = captures.length;
|
|
3112
|
-
var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
|
|
3113
|
-
if (namedCaptures !== undefined) {
|
|
3114
|
-
namedCaptures = toObject$2(namedCaptures);
|
|
3115
|
-
symbols = SUBSTITUTION_SYMBOLS;
|
|
3116
|
-
}
|
|
3117
|
-
return replace$1(replacement, symbols, function (match, ch) {
|
|
3118
|
-
var capture;
|
|
3119
|
-
switch (charAt$1(ch, 0)) {
|
|
3120
|
-
case '$': return '$';
|
|
3121
|
-
case '&': return matched;
|
|
3122
|
-
case '`': return stringSlice$4(str, 0, position);
|
|
3123
|
-
case "'": return stringSlice$4(str, tailPos);
|
|
3124
|
-
case '<':
|
|
3125
|
-
capture = namedCaptures[stringSlice$4(ch, 1, -1)];
|
|
3126
|
-
break;
|
|
3127
|
-
default: // \d\d?
|
|
3128
|
-
var n = +ch;
|
|
3129
|
-
if (n === 0) return match;
|
|
3130
|
-
if (n > m) {
|
|
3131
|
-
var f = floor$1(n / 10);
|
|
3132
|
-
if (f === 0) return match;
|
|
3133
|
-
if (f <= m) return captures[f - 1] === undefined ? charAt$1(ch, 1) : captures[f - 1] + charAt$1(ch, 1);
|
|
3134
|
-
return match;
|
|
3135
|
-
}
|
|
3136
|
-
capture = captures[n - 1];
|
|
3137
|
-
}
|
|
3138
|
-
return capture === undefined ? '' : capture;
|
|
3139
|
-
});
|
|
3140
|
+
var notARegexp = function (it) {
|
|
3141
|
+
if (isRegExp(it)) {
|
|
3142
|
+
throw $TypeError$7("The method doesn't accept regular expressions");
|
|
3143
|
+
} return it;
|
|
3140
3144
|
};
|
|
3141
3145
|
|
|
3142
|
-
var
|
|
3143
|
-
var anObject$8 = anObject$f;
|
|
3144
|
-
var isCallable$8 = isCallable$o;
|
|
3145
|
-
var classof$3 = classofRaw$2;
|
|
3146
|
-
var regexpExec = regexpExec$2;
|
|
3146
|
+
var wellKnownSymbol$7 = wellKnownSymbol$j;
|
|
3147
3147
|
|
|
3148
|
-
var
|
|
3148
|
+
var MATCH = wellKnownSymbol$7('match');
|
|
3149
3149
|
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
throw $TypeError$7('RegExp#exec called on incompatible receiver');
|
|
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;
|
|
3161
3160
|
};
|
|
3162
3161
|
|
|
3163
|
-
var
|
|
3164
|
-
var call$9 = functionCall;
|
|
3162
|
+
var $$e = _export;
|
|
3165
3163
|
var uncurryThis$9 = functionUncurryThis;
|
|
3166
|
-
var
|
|
3167
|
-
var fails$7 = fails$r;
|
|
3168
|
-
var anObject$7 = anObject$f;
|
|
3169
|
-
var isCallable$7 = isCallable$o;
|
|
3170
|
-
var isNullOrUndefined$3 = isNullOrUndefined$6;
|
|
3171
|
-
var toIntegerOrInfinity$3 = toIntegerOrInfinity$7;
|
|
3172
|
-
var toLength$2 = toLength$4;
|
|
3173
|
-
var toString$6 = toString$c;
|
|
3164
|
+
var notARegExp$1 = notARegexp;
|
|
3174
3165
|
var requireObjectCoercible$3 = requireObjectCoercible$9;
|
|
3175
|
-
var
|
|
3176
|
-
var
|
|
3177
|
-
var getSubstitution = getSubstitution$1;
|
|
3178
|
-
var regExpExec$1 = regexpExecAbstract;
|
|
3179
|
-
var wellKnownSymbol$7 = wellKnownSymbol$j;
|
|
3166
|
+
var toString$6 = toString$c;
|
|
3167
|
+
var correctIsRegExpLogic$1 = correctIsRegexpLogic;
|
|
3180
3168
|
|
|
3181
|
-
var REPLACE = wellKnownSymbol$7('replace');
|
|
3182
|
-
var max = Math.max;
|
|
3183
|
-
var min$1 = Math.min;
|
|
3184
|
-
var concat = uncurryThis$9([].concat);
|
|
3185
|
-
var push = uncurryThis$9([].push);
|
|
3186
3169
|
var stringIndexOf = uncurryThis$9(''.indexOf);
|
|
3187
|
-
var stringSlice$3 = uncurryThis$9(''.slice);
|
|
3188
3170
|
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
}
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
})();
|
|
3199
|
-
|
|
3200
|
-
// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
|
|
3201
|
-
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
|
|
3202
|
-
if (/./[REPLACE]) {
|
|
3203
|
-
return /./[REPLACE]('a', '$0') === '';
|
|
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
|
+
);
|
|
3204
3180
|
}
|
|
3205
|
-
return false;
|
|
3206
|
-
})();
|
|
3207
|
-
|
|
3208
|
-
var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$7(function () {
|
|
3209
|
-
var re = /./;
|
|
3210
|
-
re.exec = function () {
|
|
3211
|
-
var result = [];
|
|
3212
|
-
result.groups = { a: '7' };
|
|
3213
|
-
return result;
|
|
3214
|
-
};
|
|
3215
|
-
// eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
|
|
3216
|
-
return ''.replace(re, '$<a>') !== '7';
|
|
3217
3181
|
});
|
|
3218
3182
|
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3183
|
+
/**
|
|
3184
|
+
* @category Utilities
|
|
3185
|
+
*/
|
|
3186
|
+
const isFlatRatePackageCode = packageCode => {
|
|
3187
|
+
return packageCode ? packageCode.includes("flat_rate") : false;
|
|
3188
|
+
};
|
|
3222
3189
|
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
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;
|
|
3238
3208
|
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
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;
|
|
3246
3229
|
}
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
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;
|
|
3255
3244
|
}
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
if (!global) break;
|
|
3263
|
-
|
|
3264
|
-
var matchStr = toString$6(result[0]);
|
|
3265
|
-
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;
|
|
3266
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
|
+
});
|
|
3267
3268
|
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
if (position >= nextSourcePosition) {
|
|
3291
|
-
accumulatedResult += stringSlice$3(S, nextSourcePosition, position) + replacement;
|
|
3292
|
-
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
|
|
3293
3291
|
}
|
|
3294
3292
|
}
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
}
|
|
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
|
+
};
|
|
3299
3304
|
|
|
3300
3305
|
const FieldLabel = ({
|
|
3301
3306
|
children,
|
|
@@ -3317,6 +3322,7 @@ const FieldLabel = ({
|
|
|
3317
3322
|
}, {
|
|
3318
3323
|
children: [label && jsxs("div", Object.assign({
|
|
3319
3324
|
css: theme => ({
|
|
3325
|
+
flexShrink: 0,
|
|
3320
3326
|
paddingTop: _withInput ? theme.spacing(subLabel ? 1 : 2) : undefined,
|
|
3321
3327
|
width: theme.spacing(12.5)
|
|
3322
3328
|
})
|
|
@@ -3465,7 +3471,7 @@ const getOverrideStyles = theme => ({
|
|
|
3465
3471
|
});
|
|
3466
3472
|
|
|
3467
3473
|
const CreditCardInputController = createFieldController();
|
|
3468
|
-
const transform$
|
|
3474
|
+
const transform$5 = {
|
|
3469
3475
|
in: v => v ? formatCreditCardNumber(v) : "",
|
|
3470
3476
|
out: event => event.target.value === "" ? null : event.target.value.replace(/\s/g, "")
|
|
3471
3477
|
};
|
|
@@ -3485,7 +3491,7 @@ const CreditCardInput = fieldProps => jsx(CreditCardInputController, Object.assi
|
|
|
3485
3491
|
if (e.target.value.replace(/\s/g, "").length > 16) {
|
|
3486
3492
|
e.preventDefault();
|
|
3487
3493
|
} else {
|
|
3488
|
-
onChange(transform$
|
|
3494
|
+
onChange(transform$5.out(e));
|
|
3489
3495
|
}
|
|
3490
3496
|
},
|
|
3491
3497
|
onKeyDown: e => {
|
|
@@ -3493,7 +3499,7 @@ const CreditCardInput = fieldProps => jsx(CreditCardInputController, Object.assi
|
|
|
3493
3499
|
if (!/^([0-9]|Backspace|Delete|Enter|Tab)$/i.test(e.key)) e.preventDefault();
|
|
3494
3500
|
},
|
|
3495
3501
|
type: "text",
|
|
3496
|
-
value: transform$
|
|
3502
|
+
value: transform$5.in(value)
|
|
3497
3503
|
}))
|
|
3498
3504
|
}));
|
|
3499
3505
|
}
|
|
@@ -3588,6 +3594,40 @@ const DatePicker = fieldProps => {
|
|
|
3588
3594
|
}));
|
|
3589
3595
|
};
|
|
3590
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
|
+
|
|
3591
3631
|
var classof$2 = classofRaw$2;
|
|
3592
3632
|
|
|
3593
3633
|
// `IsArray` abstract operation
|
|
@@ -22026,7 +22066,7 @@ const Switch = _a => {
|
|
|
22026
22066
|
defaultChecked = false,
|
|
22027
22067
|
children,
|
|
22028
22068
|
shouldUnmount,
|
|
22029
|
-
label,
|
|
22069
|
+
label = "",
|
|
22030
22070
|
onChange
|
|
22031
22071
|
} = _a,
|
|
22032
22072
|
props = __rest(_a, ["defaultChecked", "children", "shouldUnmount", "label", "onChange"]);
|
|
@@ -22105,6 +22145,7 @@ var fields = /*#__PURE__*/Object.freeze({
|
|
|
22105
22145
|
CreditCardInput: CreditCardInput,
|
|
22106
22146
|
CheckboxInput: CheckboxInput,
|
|
22107
22147
|
DatePicker: DatePicker,
|
|
22148
|
+
ExpirationInput: ExpirationInput,
|
|
22108
22149
|
InputGroup: InputGroup,
|
|
22109
22150
|
transform: transform$3,
|
|
22110
22151
|
MoneyInput: MoneyInput,
|
|
@@ -22796,6 +22837,34 @@ const AddressParser = ({
|
|
|
22796
22837
|
}));
|
|
22797
22838
|
};
|
|
22798
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
|
+
|
|
22799
22868
|
const AddressFields = ({
|
|
22800
22869
|
domestic,
|
|
22801
22870
|
form,
|
|
@@ -22829,21 +22898,6 @@ const AddressFields = ({
|
|
|
22829
22898
|
labelWeight: "normal",
|
|
22830
22899
|
name: _formatFieldName("companyName"),
|
|
22831
22900
|
nativeLabel: true
|
|
22832
|
-
}), jsx(Select, {
|
|
22833
|
-
control: form.control,
|
|
22834
|
-
form: formId,
|
|
22835
|
-
label: t("address.fields.countryCode"),
|
|
22836
|
-
labelWeight: "normal",
|
|
22837
|
-
name: _formatFieldName("countryCode"),
|
|
22838
|
-
nativeLabel: true,
|
|
22839
|
-
onChange: e => {
|
|
22840
|
-
if (typeof e === "string") {
|
|
22841
|
-
form.setValue(_formatFieldName("stateProvince"), null, {
|
|
22842
|
-
shouldValidate: isSubmitted
|
|
22843
|
-
});
|
|
22844
|
-
}
|
|
22845
|
-
},
|
|
22846
|
-
options: countryCodeOptions
|
|
22847
22901
|
}), jsx(TextInput, {
|
|
22848
22902
|
control: form.control,
|
|
22849
22903
|
form: formId,
|
|
@@ -22866,24 +22920,29 @@ const AddressFields = ({
|
|
|
22866
22920
|
labelWeight: "normal",
|
|
22867
22921
|
name: _formatFieldName("cityLocality"),
|
|
22868
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
|
|
22869
22938
|
}), jsxs("div", Object.assign({
|
|
22870
|
-
css:
|
|
22871
|
-
display: "flex",
|
|
22872
|
-
gap: theme.spacing(2),
|
|
22873
|
-
width: "100%"
|
|
22874
|
-
})
|
|
22939
|
+
css: styles$a.stateZipWrapper
|
|
22875
22940
|
}, {
|
|
22876
22941
|
children: [jsx("div", Object.assign({
|
|
22877
|
-
css:
|
|
22878
|
-
display: "flex",
|
|
22879
|
-
flex: "1 0 66%",
|
|
22880
|
-
width: "100%"
|
|
22881
|
-
}
|
|
22942
|
+
css: styles$a.stateWrapper
|
|
22882
22943
|
}, {
|
|
22883
22944
|
children: jsx("div", Object.assign({
|
|
22884
|
-
css:
|
|
22885
|
-
flexGrow: 1
|
|
22886
|
-
}
|
|
22945
|
+
css: styles$a.grow
|
|
22887
22946
|
}, {
|
|
22888
22947
|
children: watchCountryCode === "US" ?
|
|
22889
22948
|
// Domestic States
|
|
@@ -22907,15 +22966,10 @@ const AddressFields = ({
|
|
|
22907
22966
|
})
|
|
22908
22967
|
}))
|
|
22909
22968
|
})), jsx("div", Object.assign({
|
|
22910
|
-
css:
|
|
22911
|
-
display: "flex",
|
|
22912
|
-
width: "100%"
|
|
22913
|
-
}
|
|
22969
|
+
css: styles$a.zipWrapper
|
|
22914
22970
|
}, {
|
|
22915
22971
|
children: jsx("div", Object.assign({
|
|
22916
|
-
css:
|
|
22917
|
-
flexGrow: 1
|
|
22918
|
-
}
|
|
22972
|
+
css: styles$a.grow
|
|
22919
22973
|
}, {
|
|
22920
22974
|
children: jsx(TextInput, {
|
|
22921
22975
|
control: form.control,
|
|
@@ -23143,7 +23197,7 @@ const AddressForm = ({
|
|
|
23143
23197
|
}));
|
|
23144
23198
|
};
|
|
23145
23199
|
|
|
23146
|
-
const styles$
|
|
23200
|
+
const styles$9 = createStyles({
|
|
23147
23201
|
agreement: {
|
|
23148
23202
|
alignItems: "center",
|
|
23149
23203
|
display: "flex",
|
|
@@ -23213,10 +23267,10 @@ const DisplayCarrierTerms = c => {
|
|
|
23213
23267
|
const listCarrierLinks = () => {
|
|
23214
23268
|
return c.carrierTerms.links.map((term, index) => {
|
|
23215
23269
|
return jsx("li", Object.assign({
|
|
23216
|
-
css: styles$
|
|
23270
|
+
css: styles$9.listItems
|
|
23217
23271
|
}, {
|
|
23218
23272
|
children: jsx(Link, Object.assign({
|
|
23219
|
-
css: styles$
|
|
23273
|
+
css: styles$9.link,
|
|
23220
23274
|
href: term.url,
|
|
23221
23275
|
isExternal: true,
|
|
23222
23276
|
target: "_blank"
|
|
@@ -23232,18 +23286,18 @@ const DisplayCarrierTerms = c => {
|
|
|
23232
23286
|
};
|
|
23233
23287
|
const listCarrierTerms = () => {
|
|
23234
23288
|
return jsxs("div", Object.assign({
|
|
23235
|
-
css: styles$
|
|
23289
|
+
css: styles$9.terms
|
|
23236
23290
|
}, {
|
|
23237
23291
|
children: [jsx(Typography, Object.assign({
|
|
23238
23292
|
variant: "subtitle1"
|
|
23239
23293
|
}, {
|
|
23240
23294
|
children: c.carrierTerms.title
|
|
23241
23295
|
})), jsx("div", Object.assign({
|
|
23242
|
-
css: styles$
|
|
23296
|
+
css: styles$9.terms
|
|
23243
23297
|
}, {
|
|
23244
23298
|
children: listCarrierContent()
|
|
23245
23299
|
})), jsx("ul", Object.assign({
|
|
23246
|
-
css: styles$
|
|
23300
|
+
css: styles$9.links
|
|
23247
23301
|
}, {
|
|
23248
23302
|
children: listCarrierLinks()
|
|
23249
23303
|
}))]
|
|
@@ -23473,7 +23527,7 @@ const AddressDisplay = ({
|
|
|
23473
23527
|
}));
|
|
23474
23528
|
};
|
|
23475
23529
|
|
|
23476
|
-
const styles$
|
|
23530
|
+
const styles$8 = createStyles({
|
|
23477
23531
|
container: theme => ({
|
|
23478
23532
|
display: "flex",
|
|
23479
23533
|
gap: theme.spacing()
|
|
@@ -23511,13 +23565,13 @@ const Disclosure = ({
|
|
|
23511
23565
|
}, [open]);
|
|
23512
23566
|
return jsxs(Fragment, {
|
|
23513
23567
|
children: [jsxs("div", Object.assign({
|
|
23514
|
-
css: styles$
|
|
23568
|
+
css: styles$8.container
|
|
23515
23569
|
}, {
|
|
23516
23570
|
children: [jsx("div", {
|
|
23517
23571
|
children: label
|
|
23518
23572
|
}), _showToggle && jsx("button", Object.assign({
|
|
23519
23573
|
"aria-expanded": isOpen,
|
|
23520
|
-
css: styles$
|
|
23574
|
+
css: styles$8.toggle,
|
|
23521
23575
|
onClick: () => {
|
|
23522
23576
|
setIsOpen(!isOpen);
|
|
23523
23577
|
onToggle(!isOpen);
|
|
@@ -23525,12 +23579,12 @@ const Disclosure = ({
|
|
|
23525
23579
|
type: "button"
|
|
23526
23580
|
}, {
|
|
23527
23581
|
children: jsx(Icon, {
|
|
23528
|
-
css: styles$
|
|
23582
|
+
css: styles$8.icon,
|
|
23529
23583
|
name: isOpen ? IconNames.CHEVRON_TOP : IconNames.CHEVRON_BOTTOM
|
|
23530
23584
|
})
|
|
23531
23585
|
}))]
|
|
23532
23586
|
})), isOpen && jsx("div", Object.assign({
|
|
23533
|
-
css: styles$
|
|
23587
|
+
css: styles$8.content
|
|
23534
23588
|
}, {
|
|
23535
23589
|
children: typeof children === "function" ? children(() => setIsOpen(!isOpen)) : children
|
|
23536
23590
|
}))]
|
|
@@ -23670,7 +23724,7 @@ const getCarrierRecoverySchema = requiresAddress => z.object({
|
|
|
23670
23724
|
address: requiresAddress ? baseSchema : baseSchema.optional()
|
|
23671
23725
|
});
|
|
23672
23726
|
|
|
23673
|
-
const styles$
|
|
23727
|
+
const styles$7 = createStyles({
|
|
23674
23728
|
grid: theme => ({
|
|
23675
23729
|
margin: theme.spacing(4)
|
|
23676
23730
|
}),
|
|
@@ -23712,51 +23766,29 @@ const CarrierRecoveryForm = ({
|
|
|
23712
23766
|
id: "carrier-recovery-form",
|
|
23713
23767
|
onSubmit: formLogger.capture(handleSubmit)
|
|
23714
23768
|
}, {
|
|
23715
|
-
children: jsxs(Grid, Object.assign({
|
|
23716
|
-
css: styles$
|
|
23717
|
-
noPadding: true
|
|
23718
|
-
}, {
|
|
23719
|
-
children: [
|
|
23720
|
-
colSpan: 12
|
|
23721
|
-
}, {
|
|
23722
|
-
children: jsx(InlineNotification, Object.assign({
|
|
23723
|
-
title: t("register-wallet:sections.notifications.carrier.title", {
|
|
23724
|
-
carrierFriendlyName
|
|
23725
|
-
}),
|
|
23726
|
-
type: requiresAddress ? NotificationType.ERROR : NotificationType.ALERT
|
|
23727
|
-
}, {
|
|
23728
|
-
children: [address && t("register-wallet:sections.notifications.carrier.confirmAddress"), t("register-wallet:sections.notifications.carrier.description", {
|
|
23729
|
-
carrierFriendlyName
|
|
23730
|
-
})].join(" ")
|
|
23731
|
-
}))
|
|
23732
|
-
})), requiresAddress && jsxs(Fragment, {
|
|
23769
|
+
children: jsxs(Grid, Object.assign({
|
|
23770
|
+
css: styles$7.grid,
|
|
23771
|
+
noPadding: true
|
|
23772
|
+
}, {
|
|
23773
|
+
children: [requiresAddress && jsxs(Fragment, {
|
|
23733
23774
|
children: [jsx(GridChild, Object.assign({
|
|
23734
23775
|
colSpan: 12
|
|
23735
23776
|
}, {
|
|
23736
23777
|
children: jsx(Typography, Object.assign({
|
|
23737
|
-
css: styles$
|
|
23778
|
+
css: styles$7.heading,
|
|
23738
23779
|
variant: "heading4"
|
|
23739
23780
|
}, {
|
|
23740
23781
|
children: t("register-wallet:sections.carriers.title")
|
|
23741
23782
|
}))
|
|
23742
23783
|
})), jsx(GridChild, Object.assign({
|
|
23743
23784
|
colSpan: 12,
|
|
23744
|
-
css: styles$
|
|
23785
|
+
css: styles$7.subtitle
|
|
23745
23786
|
}, {
|
|
23746
23787
|
children: jsx(Typography, Object.assign({
|
|
23747
23788
|
variant: "subtitle1"
|
|
23748
23789
|
}, {
|
|
23749
23790
|
children: t("register-wallet:sections.carriers.subtitle")
|
|
23750
23791
|
}))
|
|
23751
|
-
})), jsx(GridChild, Object.assign({
|
|
23752
|
-
colSpan: 12,
|
|
23753
|
-
"data-testid": "address-fields"
|
|
23754
|
-
}, {
|
|
23755
|
-
children: jsx(AddressFields, {
|
|
23756
|
-
form: form,
|
|
23757
|
-
formatFieldName: fieldName => `address.${fieldName}`,
|
|
23758
|
-
optionalFields: ["addressLine2"]
|
|
23759
|
-
})
|
|
23760
23792
|
}))]
|
|
23761
23793
|
}), !!(errors === null || errors === void 0 ? void 0 : errors.length) && jsx(GridChild, Object.assign({
|
|
23762
23794
|
colSpan: 12
|
|
@@ -23771,6 +23803,15 @@ const CarrierRecoveryForm = ({
|
|
|
23771
23803
|
message
|
|
23772
23804
|
}) => message).join(" ")
|
|
23773
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
|
+
})
|
|
23774
23815
|
})), jsx(GridChild, Object.assign({
|
|
23775
23816
|
colSpan: 12
|
|
23776
23817
|
}, {
|
|
@@ -23802,76 +23843,6 @@ const carrierTermsFormSchema = z.object({
|
|
|
23802
23843
|
agreement: z.literal(true)
|
|
23803
23844
|
});
|
|
23804
23845
|
|
|
23805
|
-
/**
|
|
23806
|
-
* TODO: Temporary component (replace with carrier metadata)
|
|
23807
|
-
*/
|
|
23808
|
-
const CarrierTerms = ({
|
|
23809
|
-
carrierCode
|
|
23810
|
-
}) => {
|
|
23811
|
-
const upsLinks = [{
|
|
23812
|
-
text: "UPS Promotional Rates Agreement",
|
|
23813
|
-
url: "https://www.ups.com/assets/resources/media/en_US/CQF_US.pdf"
|
|
23814
|
-
}, {
|
|
23815
|
-
text: "UPS Technology Agreement",
|
|
23816
|
-
url: "https://www.ups.com/assets/resources/media/en_US/UTA.pdf"
|
|
23817
|
-
}, {
|
|
23818
|
-
text: "List of Prohibited Articles",
|
|
23819
|
-
url: "https://www.ups.com/kn/en/help-center/shipping-support/prohibited-items.page"
|
|
23820
|
-
}];
|
|
23821
|
-
switch (carrierCode) {
|
|
23822
|
-
case "ups":
|
|
23823
|
-
return jsxs("div", Object.assign({
|
|
23824
|
-
css: styles$a.terms
|
|
23825
|
-
}, {
|
|
23826
|
-
children: [jsx(Typography, Object.assign({
|
|
23827
|
-
variant: "subtitle1"
|
|
23828
|
-
}, {
|
|
23829
|
-
children: "UPS Promotional Rates and Technology Agreements"
|
|
23830
|
-
})), jsx(Typography, Object.assign({
|
|
23831
|
-
variant: "body1"
|
|
23832
|
-
}, {
|
|
23833
|
-
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."
|
|
23834
|
-
})), jsx(Typography, Object.assign({
|
|
23835
|
-
variant: "body1"
|
|
23836
|
-
}, {
|
|
23837
|
-
children: "To start shipping with UPS, you must first agree to the following:"
|
|
23838
|
-
})), jsx(Typography, Object.assign({
|
|
23839
|
-
variant: "body1"
|
|
23840
|
-
}, {
|
|
23841
|
-
children: "UPS, the UPS brandmark, UPS Ready, and the color brown are trademarks of the United Parcel Service of America, Inc. All Rights Reserved."
|
|
23842
|
-
})), jsx("ul", {
|
|
23843
|
-
children: upsLinks.map(({
|
|
23844
|
-
text,
|
|
23845
|
-
url
|
|
23846
|
-
}, idx) => jsx("li", Object.assign({
|
|
23847
|
-
css: styles$a.listItems
|
|
23848
|
-
}, {
|
|
23849
|
-
children: jsx(Link, Object.assign({
|
|
23850
|
-
href: url,
|
|
23851
|
-
isExternal: true,
|
|
23852
|
-
rel: "noreferrer",
|
|
23853
|
-
target: "_blank"
|
|
23854
|
-
}, {
|
|
23855
|
-
children: jsx(Typography, Object.assign({
|
|
23856
|
-
variant: "body1"
|
|
23857
|
-
}, {
|
|
23858
|
-
children: text
|
|
23859
|
-
}))
|
|
23860
|
-
}))
|
|
23861
|
-
}), idx))
|
|
23862
|
-
})]
|
|
23863
|
-
}));
|
|
23864
|
-
case "usps":
|
|
23865
|
-
case "stamps_com":
|
|
23866
|
-
return jsx(Typography, Object.assign({
|
|
23867
|
-
variant: "subtitle1"
|
|
23868
|
-
}, {
|
|
23869
|
-
children: "USPS Promotional Rates and Technology Agreements"
|
|
23870
|
-
}));
|
|
23871
|
-
default:
|
|
23872
|
-
return null;
|
|
23873
|
-
}
|
|
23874
|
-
};
|
|
23875
23846
|
const CarrierTermsForm = ({
|
|
23876
23847
|
carrierCodes,
|
|
23877
23848
|
onSubmit
|
|
@@ -23881,6 +23852,11 @@ const CarrierTermsForm = ({
|
|
|
23881
23852
|
} = useTranslation(["common"]);
|
|
23882
23853
|
const metadatas = useCarrierMetadata(carrierCodes);
|
|
23883
23854
|
const [showTerms, setShowTerms] = useState(false);
|
|
23855
|
+
const terms = metadatas.filter(({
|
|
23856
|
+
terms
|
|
23857
|
+
}) => terms).map(({
|
|
23858
|
+
terms
|
|
23859
|
+
}) => terms);
|
|
23884
23860
|
const form = useForm({
|
|
23885
23861
|
defaultValues: {
|
|
23886
23862
|
agreement: false
|
|
@@ -23892,7 +23868,7 @@ const CarrierTermsForm = ({
|
|
|
23892
23868
|
onSubmit(payload.agreement);
|
|
23893
23869
|
}));
|
|
23894
23870
|
return jsxs("div", Object.assign({
|
|
23895
|
-
css: styles$
|
|
23871
|
+
css: styles$9.termsForm,
|
|
23896
23872
|
"data-testid": "carrier-terms-form"
|
|
23897
23873
|
}, {
|
|
23898
23874
|
children: [jsx(Typography, Object.assign({
|
|
@@ -23908,7 +23884,7 @@ const CarrierTermsForm = ({
|
|
|
23908
23884
|
})), jsx(Spacer, {
|
|
23909
23885
|
multiplier: 1
|
|
23910
23886
|
}), jsx("div", Object.assign({
|
|
23911
|
-
css: styles$
|
|
23887
|
+
css: styles$9.carrierLogos
|
|
23912
23888
|
}, {
|
|
23913
23889
|
children: metadatas.map(({
|
|
23914
23890
|
name,
|
|
@@ -23924,7 +23900,7 @@ const CarrierTermsForm = ({
|
|
|
23924
23900
|
onSubmit: formLogger.capture(handleSubmit)
|
|
23925
23901
|
}, {
|
|
23926
23902
|
children: jsxs("div", Object.assign({
|
|
23927
|
-
css: styles$
|
|
23903
|
+
css: styles$9.agreement
|
|
23928
23904
|
}, {
|
|
23929
23905
|
children: [jsx("div", {
|
|
23930
23906
|
children: jsx(CheckboxInput, {
|
|
@@ -23937,7 +23913,7 @@ const CarrierTermsForm = ({
|
|
|
23937
23913
|
"data-testid": "terms-link",
|
|
23938
23914
|
onClick: e => {
|
|
23939
23915
|
e.preventDefault();
|
|
23940
|
-
setShowTerms(
|
|
23916
|
+
setShowTerms(prev => !prev);
|
|
23941
23917
|
},
|
|
23942
23918
|
role: "button"
|
|
23943
23919
|
})
|
|
@@ -23951,22 +23927,12 @@ const CarrierTermsForm = ({
|
|
|
23951
23927
|
name: "agreement"
|
|
23952
23928
|
})
|
|
23953
23929
|
}), showTerms && jsxs("div", Object.assign({
|
|
23954
|
-
css: styles$
|
|
23930
|
+
css: styles$9.well
|
|
23955
23931
|
}, {
|
|
23956
|
-
children: [
|
|
23957
|
-
|
|
23958
|
-
}, {
|
|
23959
|
-
|
|
23960
|
-
variant: "heading5"
|
|
23961
|
-
}, {
|
|
23962
|
-
children: t("carriers.terms.title")
|
|
23963
|
-
})), metadatas.map(({
|
|
23964
|
-
carrierCode
|
|
23965
|
-
}) => jsx(CarrierTerms, {
|
|
23966
|
-
carrierCode: carrierCode
|
|
23967
|
-
}, carrierCode))]
|
|
23968
|
-
})), jsx("div", Object.assign({
|
|
23969
|
-
css: styles$a.close
|
|
23932
|
+
children: [terms.map((t, idx) => jsx(DisplayCarrierTerms, {
|
|
23933
|
+
carrierTerms: t
|
|
23934
|
+
}, idx)), jsx("div", Object.assign({
|
|
23935
|
+
css: styles$9.close
|
|
23970
23936
|
}, {
|
|
23971
23937
|
children: jsx(Button, Object.assign({
|
|
23972
23938
|
onClick: () => setShowTerms(false),
|
|
@@ -24354,7 +24320,7 @@ const LandingPageForm = ({
|
|
|
24354
24320
|
}));
|
|
24355
24321
|
};
|
|
24356
24322
|
|
|
24357
|
-
const styles$
|
|
24323
|
+
const styles$6 = createStyles({
|
|
24358
24324
|
container: theme => ({
|
|
24359
24325
|
padding: theme.spacing(2)
|
|
24360
24326
|
}),
|
|
@@ -24364,7 +24330,8 @@ const styles$7 = createStyles({
|
|
|
24364
24330
|
header: {
|
|
24365
24331
|
alignItems: "center",
|
|
24366
24332
|
display: "flex",
|
|
24367
|
-
flexDirection: "column"
|
|
24333
|
+
flexDirection: "column",
|
|
24334
|
+
textAlign: "center"
|
|
24368
24335
|
}
|
|
24369
24336
|
});
|
|
24370
24337
|
|
|
@@ -24375,11 +24342,11 @@ const LandingPage = ({
|
|
|
24375
24342
|
t
|
|
24376
24343
|
} = useTranslation();
|
|
24377
24344
|
return jsxs("div", Object.assign({
|
|
24378
|
-
css: styles$
|
|
24345
|
+
css: styles$6.container,
|
|
24379
24346
|
"data-testid": "landing-page"
|
|
24380
24347
|
}, {
|
|
24381
24348
|
children: [jsxs("div", Object.assign({
|
|
24382
|
-
css: styles$
|
|
24349
|
+
css: styles$6.header
|
|
24383
24350
|
}, {
|
|
24384
24351
|
children: [jsx(Typography, Object.assign({
|
|
24385
24352
|
variant: "heading4"
|
|
@@ -24397,7 +24364,7 @@ const LandingPage = ({
|
|
|
24397
24364
|
})), jsx(LandingPageForm, {
|
|
24398
24365
|
onSubmit: onSubmit
|
|
24399
24366
|
}), jsxs("div", Object.assign({
|
|
24400
|
-
css: styles$
|
|
24367
|
+
css: styles$6.header
|
|
24401
24368
|
}, {
|
|
24402
24369
|
children: [jsx(Spacer, {
|
|
24403
24370
|
multiplier: 6
|
|
@@ -24408,7 +24375,7 @@ const LandingPage = ({
|
|
|
24408
24375
|
})), jsx(Spacer, {
|
|
24409
24376
|
multiplier: 2
|
|
24410
24377
|
}), jsx(Typography, Object.assign({
|
|
24411
|
-
css: styles$
|
|
24378
|
+
css: styles$6.description,
|
|
24412
24379
|
variant: "body1"
|
|
24413
24380
|
}, {
|
|
24414
24381
|
children: t("onboarding:landing.description")
|
|
@@ -24489,7 +24456,7 @@ const Accordion = _a => {
|
|
|
24489
24456
|
});
|
|
24490
24457
|
};
|
|
24491
24458
|
|
|
24492
|
-
const getStyles$
|
|
24459
|
+
const getStyles$4 = (isConnected = false) => createStyles({
|
|
24493
24460
|
connectButton: theme => [{
|
|
24494
24461
|
padding: `0 ${theme.spacing(.5)}px`
|
|
24495
24462
|
}, isConnected && {
|
|
@@ -24548,14 +24515,14 @@ const ListCarriersRow = ({
|
|
|
24548
24515
|
setIsSubmitting(false);
|
|
24549
24516
|
});
|
|
24550
24517
|
return jsxs("div", Object.assign({
|
|
24551
|
-
css: getStyles$
|
|
24518
|
+
css: getStyles$4().container,
|
|
24552
24519
|
"data-testid": "carrier-row"
|
|
24553
24520
|
}, {
|
|
24554
24521
|
children: [jsxs("div", Object.assign({
|
|
24555
|
-
css: getStyles$
|
|
24522
|
+
css: getStyles$4().rowContainer
|
|
24556
24523
|
}, {
|
|
24557
24524
|
children: [jsxs("div", Object.assign({
|
|
24558
|
-
css: getStyles$
|
|
24525
|
+
css: getStyles$4().logoContainer
|
|
24559
24526
|
}, {
|
|
24560
24527
|
children: [jsx("div", {
|
|
24561
24528
|
children: jsx("img", {
|
|
@@ -24574,7 +24541,7 @@ const ListCarriersRow = ({
|
|
|
24574
24541
|
}, {
|
|
24575
24542
|
children: jsx(Button, Object.assign({
|
|
24576
24543
|
color: ButtonColor.SECONDARY,
|
|
24577
|
-
css: getStyles$
|
|
24544
|
+
css: getStyles$4(isConnected).connectButton,
|
|
24578
24545
|
disabled: isConnected || showDropDown,
|
|
24579
24546
|
isLoading: isSubmitting,
|
|
24580
24547
|
onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -24594,7 +24561,7 @@ const ListCarriersRow = ({
|
|
|
24594
24561
|
}));
|
|
24595
24562
|
};
|
|
24596
24563
|
|
|
24597
|
-
const styles$
|
|
24564
|
+
const styles$5 = createStyles({
|
|
24598
24565
|
listContainer: theme => ({
|
|
24599
24566
|
"& > li:not(:last-of-type)": {
|
|
24600
24567
|
borderBottom: `1px solid ${theme.palette.gray.light}`
|
|
@@ -24641,7 +24608,7 @@ const ListCarriers$1 = ({
|
|
|
24641
24608
|
children: t("list-carriers:headers.accountCarriers")
|
|
24642
24609
|
}))
|
|
24643
24610
|
}), jsx("ul", Object.assign({
|
|
24644
|
-
css: styles$
|
|
24611
|
+
css: styles$5.listContainer
|
|
24645
24612
|
}, {
|
|
24646
24613
|
children: isLoading ? jsxs(Fragment, {
|
|
24647
24614
|
children: [jsx(LoadingSkeletonRow, {}), jsx(LoadingSkeletonRow, {}), jsx(LoadingSkeletonRow, {})]
|
|
@@ -24662,10 +24629,10 @@ const ListCarriers$1 = ({
|
|
|
24662
24629
|
};
|
|
24663
24630
|
const LoadingSkeletonRow = () => {
|
|
24664
24631
|
return jsxs("div", Object.assign({
|
|
24665
|
-
css: styles$
|
|
24632
|
+
css: styles$5.skeletonRow
|
|
24666
24633
|
}, {
|
|
24667
24634
|
children: [jsxs("div", Object.assign({
|
|
24668
|
-
css: styles$
|
|
24635
|
+
css: styles$5.skeletonLogoContainer
|
|
24669
24636
|
}, {
|
|
24670
24637
|
children: [jsx(Skeleton, {
|
|
24671
24638
|
animation: SkeletonAnimation.WAVE,
|
|
@@ -24689,7 +24656,7 @@ const LoadingSkeletonRow = () => {
|
|
|
24689
24656
|
}));
|
|
24690
24657
|
};
|
|
24691
24658
|
|
|
24692
|
-
const styles$
|
|
24659
|
+
const styles$4 = createStyles({
|
|
24693
24660
|
body: theme => ({
|
|
24694
24661
|
borderTop: `1px solid ${theme.palette.gray.light}`,
|
|
24695
24662
|
color: theme.palette.black,
|
|
@@ -24740,14 +24707,14 @@ const SettingsCard = ({
|
|
|
24740
24707
|
verticallyAligned
|
|
24741
24708
|
}) => {
|
|
24742
24709
|
return jsxs("div", Object.assign({
|
|
24743
|
-
css: verticallyAligned ? styles$
|
|
24710
|
+
css: verticallyAligned ? styles$4.verticalContainer : styles$4.container,
|
|
24744
24711
|
"data-testid": "settingsCard"
|
|
24745
24712
|
}, {
|
|
24746
24713
|
children: [jsxs("div", Object.assign({
|
|
24747
|
-
css: styles$
|
|
24714
|
+
css: styles$4.header
|
|
24748
24715
|
}, {
|
|
24749
24716
|
children: [jsxs("div", Object.assign({
|
|
24750
|
-
css: styles$
|
|
24717
|
+
css: styles$4.title
|
|
24751
24718
|
}, {
|
|
24752
24719
|
children: [typeof title === "string" ? jsx(Typography, Object.assign({
|
|
24753
24720
|
variant: "subtitle2"
|
|
@@ -24782,7 +24749,7 @@ const SettingsCard = ({
|
|
|
24782
24749
|
}))
|
|
24783
24750
|
}))]
|
|
24784
24751
|
})), children && jsx("div", Object.assign({
|
|
24785
|
-
css: styles$
|
|
24752
|
+
css: styles$4.body
|
|
24786
24753
|
}, {
|
|
24787
24754
|
children: jsxs("div", {
|
|
24788
24755
|
children: [children, accessoryAction && jsx(ButtonGroup, Object.assign({
|
|
@@ -24899,7 +24866,7 @@ const warehouseSchema = z.discriminatedUnion("returnToAddressIsDifferent", [z.ob
|
|
|
24899
24866
|
});
|
|
24900
24867
|
});
|
|
24901
24868
|
|
|
24902
|
-
const styles$
|
|
24869
|
+
const styles$3 = createStyles({
|
|
24903
24870
|
header: {
|
|
24904
24871
|
textAlign: "center"
|
|
24905
24872
|
},
|
|
@@ -24936,6 +24903,9 @@ const WarehouseForm = ({
|
|
|
24936
24903
|
returnToAddressIsDifferent: !lodash.exports.isEqual(warehouse.originAddress, warehouse.returnAddress)
|
|
24937
24904
|
}) : {
|
|
24938
24905
|
isDefault: false,
|
|
24906
|
+
originAddress: {
|
|
24907
|
+
countryCode: "US"
|
|
24908
|
+
},
|
|
24939
24909
|
returnToAddressIsDifferent: false
|
|
24940
24910
|
},
|
|
24941
24911
|
resolver: validationResolver(warehouseSchema)
|
|
@@ -24951,12 +24921,12 @@ const WarehouseForm = ({
|
|
|
24951
24921
|
}
|
|
24952
24922
|
}));
|
|
24953
24923
|
return jsxs("div", Object.assign({
|
|
24954
|
-
css: _isOnboarding ? styles$
|
|
24924
|
+
css: _isOnboarding ? styles$3.onboardingWell : styles$3.well,
|
|
24955
24925
|
"data-testid": "warehouse-form"
|
|
24956
24926
|
}, {
|
|
24957
24927
|
children: [_isOnboarding && jsxs(Fragment, {
|
|
24958
24928
|
children: [jsxs("div", Object.assign({
|
|
24959
|
-
css: styles$
|
|
24929
|
+
css: styles$3.header
|
|
24960
24930
|
}, {
|
|
24961
24931
|
children: [jsx(Typography, Object.assign({
|
|
24962
24932
|
variant: "heading4"
|
|
@@ -24993,7 +24963,8 @@ const WarehouseForm = ({
|
|
|
24993
24963
|
nativeLabel: true
|
|
24994
24964
|
}), jsx(AddressFields, {
|
|
24995
24965
|
form: form,
|
|
24996
|
-
formatFieldName: fieldName => `originAddress.${fieldName}
|
|
24966
|
+
formatFieldName: fieldName => `originAddress.${fieldName}`,
|
|
24967
|
+
optionalFields: ["addressLine2"]
|
|
24997
24968
|
}), jsx(CheckboxInput, {
|
|
24998
24969
|
checkboxLabel: t("manage-warehouses:residentialAddress"),
|
|
24999
24970
|
control: form.control,
|
|
@@ -26229,61 +26200,53 @@ const BillingFields = ({
|
|
|
26229
26200
|
const {
|
|
26230
26201
|
t
|
|
26231
26202
|
} = useTranslation();
|
|
26232
|
-
const expirationMonthOptions = useExpirationMonthOptions();
|
|
26233
26203
|
return jsxs(Fragment, {
|
|
26234
|
-
children: [jsx(
|
|
26235
|
-
|
|
26236
|
-
|
|
26237
|
-
|
|
26238
|
-
|
|
26239
|
-
|
|
26240
|
-
|
|
26241
|
-
|
|
26242
|
-
|
|
26243
|
-
|
|
26244
|
-
|
|
26245
|
-
|
|
26246
|
-
}, {
|
|
26247
|
-
|
|
26248
|
-
|
|
26249
|
-
|
|
26250
|
-
|
|
26251
|
-
name: "creditCard.number",
|
|
26252
|
-
nativeLabel: true
|
|
26253
|
-
})
|
|
26254
|
-
})), jsx(GridChild, Object.assign({
|
|
26255
|
-
colSpan: 6
|
|
26256
|
-
}, {
|
|
26257
|
-
children: jsx(Select, {
|
|
26258
|
-
control: form.control,
|
|
26259
|
-
label: t("billing.fields.expirationMonth"),
|
|
26260
|
-
labelWeight: "normal",
|
|
26261
|
-
name: "creditCard.expirationMonth",
|
|
26262
|
-
nativeLabel: true,
|
|
26263
|
-
options: expirationMonthOptions
|
|
26264
|
-
})
|
|
26265
|
-
})), jsx(GridChild, Object.assign({
|
|
26266
|
-
colSpan: 3
|
|
26267
|
-
}, {
|
|
26268
|
-
children: jsx(TextInput, {
|
|
26269
|
-
control: form.control,
|
|
26270
|
-
label: t("billing.fields.expirationYear"),
|
|
26271
|
-
labelWeight: "normal",
|
|
26272
|
-
maxLength: 4,
|
|
26273
|
-
name: "creditCard.expirationYear",
|
|
26274
|
-
nativeLabel: true
|
|
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%"
|
|
26275
26221
|
})
|
|
26276
|
-
})), jsx(GridChild, Object.assign({
|
|
26277
|
-
colSpan: 3
|
|
26278
26222
|
}, {
|
|
26279
|
-
children: jsx(
|
|
26280
|
-
|
|
26281
|
-
|
|
26282
|
-
|
|
26283
|
-
|
|
26284
|
-
|
|
26285
|
-
|
|
26286
|
-
|
|
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
|
+
}))]
|
|
26287
26250
|
}))]
|
|
26288
26251
|
});
|
|
26289
26252
|
};
|
|
@@ -26319,8 +26282,10 @@ const billingAddressSchema = addressSchema.extend({
|
|
|
26319
26282
|
});
|
|
26320
26283
|
const creditCardSchema = z.object({
|
|
26321
26284
|
cvv: z.string().trim().refine(cvv => cardValidator.cvv(cvv).isValid, "Invalid CVV"),
|
|
26322
|
-
|
|
26323
|
-
|
|
26285
|
+
expiration: z.string().trim().refine(expiration => {
|
|
26286
|
+
const [expirationMonth, expirationYear] = expiration.split("/");
|
|
26287
|
+
return expirationMonths.includes(expirationMonth) && expirationYears.includes(expirationYear);
|
|
26288
|
+
}, "Invalid expiration"),
|
|
26324
26289
|
name: z.string().trim().min(1),
|
|
26325
26290
|
number: z.string().trim().refine(number => cardValidator.number(number).isValid, "Invalid card number").refine(number => {
|
|
26326
26291
|
var _a, _b;
|
|
@@ -26328,11 +26293,16 @@ const creditCardSchema = z.object({
|
|
|
26328
26293
|
}, "schemaErrors.invalidCreditCardType")
|
|
26329
26294
|
}).transform(schema => {
|
|
26330
26295
|
var _a;
|
|
26331
|
-
const
|
|
26296
|
+
const {
|
|
26297
|
+
cvv,
|
|
26298
|
+
expiration
|
|
26299
|
+
} = schema,
|
|
26300
|
+
creditCard = __rest(schema, ["cvv", "expiration"]);
|
|
26332
26301
|
const creditCardVendor = (_a = cardValidator.number(creditCard.number).card) === null || _a === void 0 ? void 0 : _a.type;
|
|
26302
|
+
const [expirationMonth, expirationYear] = expiration.split("/");
|
|
26333
26303
|
return {
|
|
26334
|
-
expirationMonth:
|
|
26335
|
-
expirationYear:
|
|
26304
|
+
expirationMonth: expirationMonth,
|
|
26305
|
+
expirationYear: expirationYear,
|
|
26336
26306
|
name: creditCard.name,
|
|
26337
26307
|
number: creditCard.number,
|
|
26338
26308
|
type: creditCardVendor
|
|
@@ -26408,7 +26378,7 @@ const EditWalletAddressForm = ({
|
|
|
26408
26378
|
}));
|
|
26409
26379
|
};
|
|
26410
26380
|
|
|
26411
|
-
const styles$
|
|
26381
|
+
const styles$2 = createStyles({
|
|
26412
26382
|
grid: theme => ({
|
|
26413
26383
|
margin: theme.spacing(4)
|
|
26414
26384
|
}),
|
|
@@ -26432,7 +26402,11 @@ const WalletForm = ({
|
|
|
26432
26402
|
const form = useForm({
|
|
26433
26403
|
defaultValues:
|
|
26434
26404
|
// If the warehouse address is a PO Box they cannot use it as their billing address
|
|
26435
|
-
defaultWarehouseIsPoBox ? {
|
|
26405
|
+
defaultWarehouseIsPoBox ? {
|
|
26406
|
+
address: {
|
|
26407
|
+
countryCode: "US"
|
|
26408
|
+
}
|
|
26409
|
+
} : {
|
|
26436
26410
|
address: Object.assign(Object.assign({}, address), {
|
|
26437
26411
|
countryCode: address.countryCode
|
|
26438
26412
|
})
|
|
@@ -26456,21 +26430,21 @@ const WalletForm = ({
|
|
|
26456
26430
|
onSubmit: formLogger.capture(handleSubmit)
|
|
26457
26431
|
}, {
|
|
26458
26432
|
children: jsxs(Grid, Object.assign({
|
|
26459
|
-
css: styles$
|
|
26433
|
+
css: styles$2.grid,
|
|
26460
26434
|
noPadding: true
|
|
26461
26435
|
}, {
|
|
26462
26436
|
children: [jsx(GridChild, Object.assign({
|
|
26463
26437
|
colSpan: 12
|
|
26464
26438
|
}, {
|
|
26465
26439
|
children: jsx(Typography, Object.assign({
|
|
26466
|
-
css: styles$
|
|
26440
|
+
css: styles$2.heading,
|
|
26467
26441
|
variant: "heading4"
|
|
26468
26442
|
}, {
|
|
26469
26443
|
children: t("register-wallet:sections.billing.title")
|
|
26470
26444
|
}))
|
|
26471
26445
|
})), jsx(GridChild, Object.assign({
|
|
26472
26446
|
colSpan: 12,
|
|
26473
|
-
css: styles$
|
|
26447
|
+
css: styles$2.subtitle
|
|
26474
26448
|
}, {
|
|
26475
26449
|
children: jsx(Typography, Object.assign({
|
|
26476
26450
|
variant: "subtitle1"
|
|
@@ -26480,19 +26454,30 @@ const WalletForm = ({
|
|
|
26480
26454
|
})), jsx(GridChild, Object.assign({
|
|
26481
26455
|
colSpan: 12
|
|
26482
26456
|
}, {
|
|
26483
|
-
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({
|
|
26484
26465
|
title: t("register-wallet:sections.notifications.info.title"),
|
|
26485
26466
|
type: NotificationType.INFO
|
|
26486
26467
|
}, {
|
|
26487
26468
|
children: t("register-wallet:sections.notifications.info.description")
|
|
26488
26469
|
}))
|
|
26489
|
-
})), jsx(
|
|
26490
|
-
|
|
26491
|
-
}
|
|
26470
|
+
})), jsx(GridChild, Object.assign({
|
|
26471
|
+
colSpan: 12
|
|
26472
|
+
}, {
|
|
26473
|
+
children: jsx(BillingFields, {
|
|
26474
|
+
form: form
|
|
26475
|
+
})
|
|
26476
|
+
})), jsx(GridChild, Object.assign({
|
|
26492
26477
|
colSpan: 12
|
|
26493
26478
|
}, {
|
|
26494
26479
|
children: jsx(Typography, Object.assign({
|
|
26495
|
-
css: styles$
|
|
26480
|
+
css: styles$2.subtitle,
|
|
26496
26481
|
variant: "subtitle1"
|
|
26497
26482
|
}, {
|
|
26498
26483
|
children: t("register-wallet:sections.billing.addressSubTitle")
|
|
@@ -26529,18 +26514,7 @@ const WalletForm = ({
|
|
|
26529
26514
|
}, {
|
|
26530
26515
|
children: editWalletAddressForm
|
|
26531
26516
|
}))]
|
|
26532
|
-
}),
|
|
26533
|
-
colSpan: 12
|
|
26534
|
-
}, {
|
|
26535
|
-
children: jsx(InlineNotification, Object.assign({
|
|
26536
|
-
title: t("register-wallet:sections.notifications.error.title"),
|
|
26537
|
-
type: NotificationType.ERROR
|
|
26538
|
-
}, {
|
|
26539
|
-
children: errors.map(({
|
|
26540
|
-
message
|
|
26541
|
-
}) => message).join(" ")
|
|
26542
|
-
}))
|
|
26543
|
-
})), jsx(GridChild, Object.assign({
|
|
26517
|
+
}), jsx(GridChild, Object.assign({
|
|
26544
26518
|
colSpan: 12
|
|
26545
26519
|
}, {
|
|
26546
26520
|
children: jsx(ButtonGroup, Object.assign({
|
|
@@ -26559,22 +26533,17 @@ const WalletForm = ({
|
|
|
26559
26533
|
}));
|
|
26560
26534
|
};
|
|
26561
26535
|
|
|
26562
|
-
const styles$
|
|
26563
|
-
lastStep: {
|
|
26564
|
-
"& > span::first-of-type": {
|
|
26565
|
-
"::after": {
|
|
26566
|
-
// TODO: Polish - match Figma as much as possible
|
|
26567
|
-
}
|
|
26568
|
-
},
|
|
26569
|
-
"& > span:last-child": {
|
|
26570
|
-
position: "static"
|
|
26571
|
-
}
|
|
26572
|
-
},
|
|
26536
|
+
const styles$1 = createStyles({
|
|
26573
26537
|
step: {
|
|
26574
26538
|
"& > span:last-child": {
|
|
26575
26539
|
position: "static"
|
|
26576
26540
|
}
|
|
26577
|
-
}
|
|
26541
|
+
},
|
|
26542
|
+
wrapper: theme => ({
|
|
26543
|
+
height: "100%",
|
|
26544
|
+
padding: theme.spacing(2),
|
|
26545
|
+
width: "100%"
|
|
26546
|
+
})
|
|
26578
26547
|
});
|
|
26579
26548
|
|
|
26580
26549
|
const Onboarding$1 = ({
|
|
@@ -26582,8 +26551,6 @@ const Onboarding$1 = ({
|
|
|
26582
26551
|
createWarehouse,
|
|
26583
26552
|
onCarrierCreated,
|
|
26584
26553
|
onWarehouseCreated,
|
|
26585
|
-
isLoadingDhl,
|
|
26586
|
-
isLoadingUps,
|
|
26587
26554
|
onCompleteOnboarding,
|
|
26588
26555
|
registerDhlCarrier,
|
|
26589
26556
|
registerDhlCarrierErrors,
|
|
@@ -26625,16 +26592,20 @@ const Onboarding$1 = ({
|
|
|
26625
26592
|
address
|
|
26626
26593
|
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26627
26594
|
setAddress(address);
|
|
26628
|
-
|
|
26629
|
-
address
|
|
26630
|
-
|
|
26631
|
-
|
|
26632
|
-
|
|
26633
|
-
|
|
26634
|
-
|
|
26635
|
-
|
|
26636
|
-
|
|
26637
|
-
|
|
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
|
+
}
|
|
26638
26609
|
yield onCarrierCreated();
|
|
26639
26610
|
});
|
|
26640
26611
|
const handleCreateWarehouse = payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -26655,7 +26626,6 @@ const Onboarding$1 = ({
|
|
|
26655
26626
|
email: email,
|
|
26656
26627
|
nickname: "stamps_com"
|
|
26657
26628
|
});
|
|
26658
|
-
yield onCarrierCreated();
|
|
26659
26629
|
yield handleWalletRegistrationSuccess({
|
|
26660
26630
|
address
|
|
26661
26631
|
});
|
|
@@ -26706,11 +26676,6 @@ const Onboarding$1 = ({
|
|
|
26706
26676
|
});
|
|
26707
26677
|
}
|
|
26708
26678
|
if (hasStampsWallet) {
|
|
26709
|
-
if (isLoadingUps || isLoadingDhl) {
|
|
26710
|
-
return jsx(Loader, {
|
|
26711
|
-
message: t("loading.carriers")
|
|
26712
|
-
});
|
|
26713
|
-
}
|
|
26714
26679
|
// Step 4.1: Handle UPS Registration Errors
|
|
26715
26680
|
if (!hasUps && registerUpsCarrierErrors) {
|
|
26716
26681
|
return jsx(CarrierRecoveryForm, {
|
|
@@ -26735,27 +26700,29 @@ const Onboarding$1 = ({
|
|
|
26735
26700
|
});
|
|
26736
26701
|
}
|
|
26737
26702
|
}
|
|
26738
|
-
return
|
|
26703
|
+
return jsx(Loader, {});
|
|
26739
26704
|
};
|
|
26740
|
-
return jsxs(
|
|
26705
|
+
return jsxs("div", Object.assign({
|
|
26706
|
+
css: styles$1.wrapper
|
|
26707
|
+
}, {
|
|
26741
26708
|
children: [jsxs(Stepper, Object.assign({
|
|
26742
26709
|
currentStep: currentStep
|
|
26743
26710
|
}, {
|
|
26744
26711
|
children: [jsx(Step, {
|
|
26745
|
-
css: styles$
|
|
26712
|
+
css: styles$1.step,
|
|
26746
26713
|
label: t("onboarding:steps.login")
|
|
26747
26714
|
}), jsx(Step, {
|
|
26748
|
-
css: styles$
|
|
26715
|
+
css: styles$1.step,
|
|
26749
26716
|
label: t("onboarding:steps.carriers")
|
|
26750
26717
|
}), jsx(Step, {
|
|
26751
|
-
css: styles$
|
|
26718
|
+
css: styles$1.step,
|
|
26752
26719
|
label: t("onboarding:steps.addresses")
|
|
26753
26720
|
}), jsx(Step, {
|
|
26754
|
-
css: styles$
|
|
26721
|
+
css: styles$1.step,
|
|
26755
26722
|
label: t("onboarding:steps.payment")
|
|
26756
26723
|
})]
|
|
26757
26724
|
})), renderStep()]
|
|
26758
|
-
});
|
|
26725
|
+
}));
|
|
26759
26726
|
};
|
|
26760
26727
|
|
|
26761
26728
|
let _ = t => t,
|
|
@@ -26885,7 +26852,7 @@ const Loader = props => {
|
|
|
26885
26852
|
}));
|
|
26886
26853
|
};
|
|
26887
26854
|
|
|
26888
|
-
const getStyles$
|
|
26855
|
+
const getStyles$3 = ({
|
|
26889
26856
|
isDisabled,
|
|
26890
26857
|
isSelected
|
|
26891
26858
|
} = {}) => createStyles({
|
|
@@ -26992,7 +26959,7 @@ const AddFundsForm = ({
|
|
|
26992
26959
|
})), jsx(Spacer, {
|
|
26993
26960
|
multiplier: 2
|
|
26994
26961
|
}), jsx(ChipList, Object.assign({
|
|
26995
|
-
css: getStyles$
|
|
26962
|
+
css: getStyles$3().chipList,
|
|
26996
26963
|
onChange: idx => {
|
|
26997
26964
|
const chip = chips[idx];
|
|
26998
26965
|
setSelectedChip(chip);
|
|
@@ -27007,7 +26974,7 @@ const AddFundsForm = ({
|
|
|
27007
26974
|
}
|
|
27008
26975
|
}, {
|
|
27009
26976
|
children: chips.map(chip => jsx(Chip, Object.assign({
|
|
27010
|
-
css: getStyles$
|
|
26977
|
+
css: getStyles$3({
|
|
27011
26978
|
isDisabled: chip.value < _minimumAmount,
|
|
27012
26979
|
isSelected: chip.value === selectedChip.value
|
|
27013
26980
|
}).chip,
|
|
@@ -27024,7 +26991,7 @@ const AddFundsForm = ({
|
|
|
27024
26991
|
multiplier: 1
|
|
27025
26992
|
}), jsx(MoneyInput, {
|
|
27026
26993
|
control: form.control,
|
|
27027
|
-
css: getStyles$
|
|
26994
|
+
css: getStyles$3().fundsInput,
|
|
27028
26995
|
defaultValue: {
|
|
27029
26996
|
amount: undefined,
|
|
27030
26997
|
currency: SE.Currency.USD
|
|
@@ -27092,7 +27059,7 @@ const InlineLabel = ({
|
|
|
27092
27059
|
}), children]
|
|
27093
27060
|
}));
|
|
27094
27061
|
|
|
27095
|
-
const getStyles$
|
|
27062
|
+
const getStyles$2 = balance => createStyles({
|
|
27096
27063
|
balanceText: theme => ({
|
|
27097
27064
|
color: balance === undefined ? theme.palette.alert.main : balance >= 0 ? theme.palette.secondary.dark : theme.palette.error.main
|
|
27098
27065
|
})
|
|
@@ -27115,7 +27082,7 @@ const CarrierBalance = ({
|
|
|
27115
27082
|
}, {
|
|
27116
27083
|
children: isLoadingCarrier || isRefetchingCarrier ? jsx(Spinner, {}) : jsx(Typography, Object.assign({
|
|
27117
27084
|
bold: true,
|
|
27118
|
-
css: getStyles$
|
|
27085
|
+
css: getStyles$2(balance).balanceText
|
|
27119
27086
|
}, {
|
|
27120
27087
|
children: balance === undefined ? t("manage-funding:errors.balanceUnknown") : formatMoney({
|
|
27121
27088
|
amount: balance,
|
|
@@ -27176,7 +27143,7 @@ const Spread = ({
|
|
|
27176
27143
|
children: children
|
|
27177
27144
|
}));
|
|
27178
27145
|
|
|
27179
|
-
const getStyles = isCustomAmount => createStyles({
|
|
27146
|
+
const getStyles$1 = isCustomAmount => createStyles({
|
|
27180
27147
|
balanceText: theme => ({
|
|
27181
27148
|
color: theme.palette.secondary.dark
|
|
27182
27149
|
}),
|
|
@@ -27208,6 +27175,7 @@ const FundAndPurchase = ({
|
|
|
27208
27175
|
carrierId,
|
|
27209
27176
|
className,
|
|
27210
27177
|
disabled,
|
|
27178
|
+
isFundingEnabled,
|
|
27211
27179
|
isFundingRequired,
|
|
27212
27180
|
onSave,
|
|
27213
27181
|
purchaseAmount,
|
|
@@ -27235,14 +27203,14 @@ const FundAndPurchase = ({
|
|
|
27235
27203
|
});
|
|
27236
27204
|
// Automatically open the Add Funds form if the carrier's balance is insufficient.
|
|
27237
27205
|
useEffect(() => {
|
|
27238
|
-
if (isFundingRequired && (carrier === null || carrier === void 0 ? void 0 : carrier.balance) !== undefined && carrier.balance < purchaseAmount) setIsAddFundsFormOpen(true);
|
|
27239
|
-
}, [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]);
|
|
27240
27208
|
const renderActionButtons = (addFundsForm = {}) => jsxs(ButtonGroup, Object.assign({
|
|
27241
27209
|
justify: "end"
|
|
27242
27210
|
}, {
|
|
27243
27211
|
children: [jsx(Button, Object.assign({
|
|
27244
27212
|
bold: false,
|
|
27245
|
-
css: getStyles().saveRateButton,
|
|
27213
|
+
css: getStyles$1().saveRateButton,
|
|
27246
27214
|
disabled: disabled || !carrierId || isAddingFunds || isCreatingLabel,
|
|
27247
27215
|
isLoading: isSavingRate,
|
|
27248
27216
|
onClick: handleSaveRate,
|
|
@@ -27251,16 +27219,18 @@ const FundAndPurchase = ({
|
|
|
27251
27219
|
children: t("purchase-label:actions.saveRate")
|
|
27252
27220
|
})), jsx(Button, Object.assign({
|
|
27253
27221
|
"data-testid": "submit-fund-and-purchase",
|
|
27254
|
-
disabled: disabled || !carrierId || isFundingRequired && isAddFundsFormOpen && addFundsForm.isSubmitted && !addFundsForm.isValid,
|
|
27222
|
+
disabled: disabled || !carrierId || isFundingEnabled && isFundingRequired && isAddFundsFormOpen && addFundsForm.isSubmitted && !addFundsForm.isValid,
|
|
27255
27223
|
isLoading: addFundsForm.isSubmitting || isAddingFunds || isCreatingLabel,
|
|
27256
27224
|
onClick: isAddFundsFormOpen ? addFundsForm.submit : onPurchase
|
|
27257
27225
|
}, {
|
|
27258
27226
|
children: isAddFundsFormOpen ? t("manage-funding:actions.addFundsAndPurchase") : t("purchase-label:actions.purchaseNow")
|
|
27259
27227
|
}))]
|
|
27260
27228
|
}));
|
|
27229
|
+
// Render: not a walleted carrier;
|
|
27230
|
+
// don't show balance or funding form
|
|
27261
27231
|
if (!isFundingRequired) return jsx("div", Object.assign({
|
|
27262
27232
|
className: className,
|
|
27263
|
-
css: getStyles().container
|
|
27233
|
+
css: getStyles$1().container
|
|
27264
27234
|
}, {
|
|
27265
27235
|
children: renderActionButtons()
|
|
27266
27236
|
}));
|
|
@@ -27273,9 +27243,23 @@ const FundAndPurchase = ({
|
|
|
27273
27243
|
setIsAddFundsFormOpen(false);
|
|
27274
27244
|
onPurchase();
|
|
27275
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
|
|
27276
27260
|
return jsxs("div", Object.assign({
|
|
27277
27261
|
className: className,
|
|
27278
|
-
css: getStyles().container
|
|
27262
|
+
css: getStyles$1().container
|
|
27279
27263
|
}, {
|
|
27280
27264
|
children: [jsxs(Spread, {
|
|
27281
27265
|
children: [jsx(CarrierBalance, {
|
|
@@ -27306,13 +27290,13 @@ const FundAndPurchase = ({
|
|
|
27306
27290
|
var _a, _b;
|
|
27307
27291
|
return jsxs(Fragment, {
|
|
27308
27292
|
children: [jsxs("section", Object.assign({
|
|
27309
|
-
css: getStyles(addFundsForm.isCustomAmount).formExtension
|
|
27293
|
+
css: getStyles$1(addFundsForm.isCustomAmount).formExtension
|
|
27310
27294
|
}, {
|
|
27311
27295
|
children: [jsx(InlineLabel, Object.assign({
|
|
27312
27296
|
label: t("manage-funding:fundAndPurchase.newBalance")
|
|
27313
27297
|
}, {
|
|
27314
27298
|
children: jsx(Typography, Object.assign({
|
|
27315
|
-
css: getStyles().balanceText
|
|
27299
|
+
css: getStyles$1().balanceText
|
|
27316
27300
|
}, {
|
|
27317
27301
|
children: formatMoney({
|
|
27318
27302
|
amount: balance + ((_a = addFundsForm.selectedAmount) !== null && _a !== void 0 ? _a : 0),
|
|
@@ -27323,7 +27307,7 @@ const FundAndPurchase = ({
|
|
|
27323
27307
|
label: t("manage-funding:fundAndPurchase.finalBalance")
|
|
27324
27308
|
}, {
|
|
27325
27309
|
children: jsx(Typography, Object.assign({
|
|
27326
|
-
css: getStyles().balanceText
|
|
27310
|
+
css: getStyles$1().balanceText
|
|
27327
27311
|
}, {
|
|
27328
27312
|
children: formatMoney({
|
|
27329
27313
|
amount: balance + ((_b = addFundsForm.selectedAmount) !== null && _b !== void 0 ? _b : 0) - purchaseAmount,
|
|
@@ -27349,7 +27333,7 @@ const FundAndPurchase = ({
|
|
|
27349
27333
|
}));
|
|
27350
27334
|
};
|
|
27351
27335
|
|
|
27352
|
-
const styles
|
|
27336
|
+
const styles = createStyles({
|
|
27353
27337
|
fundAndPurchase: theme => ({
|
|
27354
27338
|
borderTop: `1px solid ${theme.palette.gray.ultraLight}`
|
|
27355
27339
|
}),
|
|
@@ -27488,7 +27472,7 @@ const RateForm = ({
|
|
|
27488
27472
|
onClick: onSelectRate,
|
|
27489
27473
|
options: showHiddenRates ? rateOptions : filteredRateOptions
|
|
27490
27474
|
}), rateOptions.some(option => option.requiresAcknowledgement) && rateOptions.length > 5 && jsx(Link, Object.assign({
|
|
27491
|
-
css: styles
|
|
27475
|
+
css: styles.showMoreOrLessRatesButton,
|
|
27492
27476
|
onClick: () => {
|
|
27493
27477
|
var _a;
|
|
27494
27478
|
setShowHiddenRates(!showHiddenRates);
|
|
@@ -27509,7 +27493,7 @@ const RateForm = ({
|
|
|
27509
27493
|
}))
|
|
27510
27494
|
}))]
|
|
27511
27495
|
}) : !isLoading && errors && !!errors.length ? null : jsxs("article", Object.assign({
|
|
27512
|
-
css: styles
|
|
27496
|
+
css: styles.ratesInterstitial,
|
|
27513
27497
|
role: "presentation"
|
|
27514
27498
|
}, {
|
|
27515
27499
|
children: [jsx(Cube, {
|
|
@@ -27529,8 +27513,9 @@ const RateForm = ({
|
|
|
27529
27513
|
})]
|
|
27530
27514
|
})), jsx(FundAndPurchase, {
|
|
27531
27515
|
carrierId: selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.carrierId,
|
|
27532
|
-
css: styles
|
|
27516
|
+
css: styles.fundAndPurchase,
|
|
27533
27517
|
disabled: disabled,
|
|
27518
|
+
isFundingEnabled: features === null || features === void 0 ? void 0 : features.enableFunding,
|
|
27534
27519
|
isFundingRequired: (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.balance) !== undefined && !!selectedRate.requiresFundedAmount,
|
|
27535
27520
|
onPurchase: handleSubmit,
|
|
27536
27521
|
onSave: handleSaveRate,
|
|
@@ -29127,26 +29112,35 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
29127
29112
|
WarehouseForm: WarehouseForm,
|
|
29128
29113
|
VoidLabel: VoidLabel$1,
|
|
29129
29114
|
WalletForm: WalletForm,
|
|
29130
|
-
styles: styles$
|
|
29115
|
+
styles: styles$2,
|
|
29131
29116
|
billingAddressSchema: billingAddressSchema,
|
|
29132
29117
|
walletSchema: walletSchema,
|
|
29133
29118
|
BillingFields: BillingFields
|
|
29134
29119
|
});
|
|
29135
29120
|
|
|
29136
|
-
const
|
|
29121
|
+
const getStyles = showForm => createStyles({
|
|
29122
|
+
edit: theme => ({
|
|
29123
|
+
color: theme.palette.primary.main,
|
|
29124
|
+
padding: `0 ${theme.spacing(2)}`
|
|
29125
|
+
}),
|
|
29137
29126
|
form: theme => ({
|
|
29138
29127
|
backgroundColor: theme.palette.gray.megaLight,
|
|
29139
|
-
display: "flex",
|
|
29128
|
+
display: showForm ? "flex" : "none",
|
|
29140
29129
|
flexDirection: "column",
|
|
29141
|
-
gap: theme.spacing(2),
|
|
29142
29130
|
padding: theme.spacing(2)
|
|
29143
|
-
})
|
|
29131
|
+
}),
|
|
29132
|
+
input: theme => ({
|
|
29133
|
+
width: theme.spacing(13)
|
|
29134
|
+
}),
|
|
29135
|
+
marginLeft: {
|
|
29136
|
+
marginLeft: "auto"
|
|
29137
|
+
}
|
|
29144
29138
|
});
|
|
29145
29139
|
|
|
29146
29140
|
const autoFundingSchema = z.object({
|
|
29147
29141
|
isEnabled: z.boolean(),
|
|
29148
29142
|
lowBalancePurchaseThreshold: moneySchema.extend({
|
|
29149
|
-
amount: z.number().min(
|
|
29143
|
+
amount: z.number().min(10)
|
|
29150
29144
|
}),
|
|
29151
29145
|
maximumPurchasesPerDay: z.number().min(1),
|
|
29152
29146
|
purchaseAmount: moneySchema.extend({
|
|
@@ -29156,7 +29150,9 @@ const autoFundingSchema = z.object({
|
|
|
29156
29150
|
|
|
29157
29151
|
/**
|
|
29158
29152
|
* This form that allows users to enable or disable auto funding, and
|
|
29159
|
-
* 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.
|
|
29160
29156
|
*/
|
|
29161
29157
|
const AutoFundingForm = ({
|
|
29162
29158
|
carrierId
|
|
@@ -29165,77 +29161,140 @@ const AutoFundingForm = ({
|
|
|
29165
29161
|
t
|
|
29166
29162
|
} = useTranslation();
|
|
29167
29163
|
const updateAutoFunding = useUpdateAutoFunding(carrierId);
|
|
29168
|
-
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);
|
|
29169
29171
|
const form = useForm({
|
|
29170
|
-
// TODO - [LMNT-663] We should probably make a hydration effect for autoFundingConfiguration.data
|
|
29171
|
-
defaultValues: autoFundingConfiguration.data,
|
|
29172
29172
|
resolver: validationResolver(autoFundingSchema)
|
|
29173
29173
|
});
|
|
29174
|
-
const {
|
|
29175
|
-
isDirty
|
|
29176
|
-
} = form.formState;
|
|
29177
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
|
+
});
|
|
29178
29180
|
const handleSubmit = formLogger.capture(form.handleSubmit(values => {
|
|
29181
|
+
setShowForm(prev => !prev);
|
|
29182
|
+
setIsSwitchOn(true);
|
|
29179
29183
|
const payload = values;
|
|
29180
29184
|
updateAutoFunding.mutate(payload, {
|
|
29181
29185
|
onSuccess: () => autoFundingConfiguration.refetch()
|
|
29182
29186
|
});
|
|
29183
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
|
+
*/
|
|
29184
29193
|
const handleToggle = isEnabled => {
|
|
29185
|
-
|
|
29186
|
-
|
|
29187
|
-
|
|
29188
|
-
if (
|
|
29189
|
-
|
|
29190
|
-
|
|
29191
|
-
|
|
29192
|
-
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()
|
|
29193
29201
|
});
|
|
29194
|
-
} else {
|
|
29195
|
-
// TODO - [LMNT-663] Should this throw?
|
|
29196
|
-
logger.error("Toggling auto-funding failed because autoFundingData is undefined.");
|
|
29197
29202
|
}
|
|
29198
29203
|
};
|
|
29199
|
-
if (autoFundingConfiguration.isLoading) return jsx(Loader, {
|
|
29204
|
+
if (autoFundingConfiguration.isLoading || updateAutoFunding.isLoading) return jsx(Loader, {
|
|
29200
29205
|
message: t("manage-funding:autoFunding.isLoading")
|
|
29201
29206
|
});
|
|
29207
|
+
if (!autoFundingSettings) throw new Error(t("errorMessages:unableToLoad.autoFundingSettings"));
|
|
29202
29208
|
return jsxs(Fragment, {
|
|
29203
|
-
children: [
|
|
29204
|
-
|
|
29205
|
-
|
|
29206
|
-
|
|
29207
|
-
|
|
29208
|
-
|
|
29209
|
-
|
|
29210
|
-
|
|
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({
|
|
29211
29235
|
css: styles.form,
|
|
29236
|
+
"data-testid": "auto-funding-form",
|
|
29212
29237
|
id: "auto-funding-form",
|
|
29213
29238
|
onSubmit: handleSubmit
|
|
29214
29239
|
}, {
|
|
29215
|
-
children: [jsx(
|
|
29216
|
-
|
|
29217
|
-
|
|
29218
|
-
|
|
29219
|
-
|
|
29220
|
-
|
|
29221
|
-
|
|
29222
|
-
|
|
29223
|
-
|
|
29224
|
-
|
|
29225
|
-
|
|
29226
|
-
|
|
29227
|
-
|
|
29228
|
-
|
|
29229
|
-
|
|
29230
|
-
|
|
29231
|
-
|
|
29232
|
-
|
|
29233
|
-
|
|
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({
|
|
29234
29294
|
justify: "end"
|
|
29235
29295
|
}, {
|
|
29236
29296
|
children: [jsx(Button, Object.assign({
|
|
29237
|
-
|
|
29238
|
-
onClick: () => form.reset(),
|
|
29297
|
+
onClick: isSwitchOn ? () => setShowForm(false) : () => handleToggle(false),
|
|
29239
29298
|
variant: ButtonVariant.TEXT
|
|
29240
29299
|
}, {
|
|
29241
29300
|
children: t("actions.cancel")
|
|
@@ -30342,8 +30401,7 @@ var common = {
|
|
|
30342
30401
|
differentBillingAddress: "Billing address is different from Ship From Address",
|
|
30343
30402
|
name: "Name on Card",
|
|
30344
30403
|
cardNumber: "Credit Card Number",
|
|
30345
|
-
|
|
30346
|
-
expirationYear: "Year",
|
|
30404
|
+
expiration: "Card Expiration",
|
|
30347
30405
|
cvv: "CVV"
|
|
30348
30406
|
}
|
|
30349
30407
|
},
|
|
@@ -30407,6 +30465,7 @@ var common = {
|
|
|
30407
30465
|
invalidNameOrCompany: "Recipient name and company name (if provided) must have two characters in first and last name.",
|
|
30408
30466
|
noWarehouses: "You must have an active warehouse in order to use this feature",
|
|
30409
30467
|
unableToLoad: {
|
|
30468
|
+
autoFundingSettings: "Unable to load auto funding settings",
|
|
30410
30469
|
carrier: "Unable to load carrier",
|
|
30411
30470
|
carriers: "Unable to load carriers",
|
|
30412
30471
|
salesOrder: "Unable to load order",
|
|
@@ -30537,16 +30596,19 @@ var manageFunding = {
|
|
|
30537
30596
|
saveRule: "Save Rule"
|
|
30538
30597
|
},
|
|
30539
30598
|
autoFunding: {
|
|
30540
|
-
|
|
30599
|
+
edit: "Edit",
|
|
30600
|
+
editSettings: "Edit Auto-Funding Settings",
|
|
30541
30601
|
error: {
|
|
30542
30602
|
title: "Auto-Funding Error",
|
|
30543
30603
|
message: "An error occurred while trying to configure to your auto-funding rules."
|
|
30544
30604
|
},
|
|
30605
|
+
isEnabledCTA: "Enable auto-funding",
|
|
30545
30606
|
isEnabled: "Enable Auto-Funding",
|
|
30546
30607
|
isLoading: "Loading auto-funding configuration...",
|
|
30547
|
-
lowBalancePurchaseThreshold: "
|
|
30548
|
-
maximumPurchasesPerDay: "Maximum
|
|
30549
|
-
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)."
|
|
30550
30612
|
},
|
|
30551
30613
|
addFunds: {
|
|
30552
30614
|
custom: "Custom...",
|
|
@@ -30558,7 +30620,8 @@ var manageFunding = {
|
|
|
30558
30620
|
labels: {
|
|
30559
30621
|
amount: "Amount"
|
|
30560
30622
|
},
|
|
30561
|
-
minimumPurchaseAmount: "Minimum Purchase $10.00"
|
|
30623
|
+
minimumPurchaseAmount: "Minimum Purchase $10.00",
|
|
30624
|
+
other: "Other..."
|
|
30562
30625
|
},
|
|
30563
30626
|
fundAndPurchase: {
|
|
30564
30627
|
finalBalance: "Final balance after payment:",
|
|
@@ -30728,7 +30791,7 @@ var registerWallet = {
|
|
|
30728
30791
|
billing: {
|
|
30729
30792
|
title: "Billing Management",
|
|
30730
30793
|
cardSubTitle: "Enter your credit card information",
|
|
30731
|
-
addressSubTitle: "
|
|
30794
|
+
addressSubTitle: "Billing Address",
|
|
30732
30795
|
info: "Your account balance handles the cost of labels, insurance and carrier adjustments."
|
|
30733
30796
|
},
|
|
30734
30797
|
carriers: {
|
|
@@ -31131,14 +31194,14 @@ const ManageWarehouses = () => {
|
|
|
31131
31194
|
returnAddress: payload.returnAddress,
|
|
31132
31195
|
warehouseId: warehouseId
|
|
31133
31196
|
});
|
|
31134
|
-
|
|
31197
|
+
yield refreshListWarehouses();
|
|
31135
31198
|
});
|
|
31136
31199
|
const handleSetDefault = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31137
31200
|
yield updateWarehouse(Object.assign(Object.assign({}, payload), {
|
|
31138
31201
|
isDefault: true,
|
|
31139
31202
|
warehouseId
|
|
31140
31203
|
}));
|
|
31141
|
-
|
|
31204
|
+
yield refreshListWarehouses();
|
|
31142
31205
|
});
|
|
31143
31206
|
if (isLoadingWarehouses) return jsx(Loader, {
|
|
31144
31207
|
message: t("loading.warehouses")
|
|
@@ -31767,9 +31830,6 @@ const ConfigureShipment = _a => {
|
|
|
31767
31830
|
const Onboarding = ({
|
|
31768
31831
|
onCompleteOnboarding
|
|
31769
31832
|
}) => {
|
|
31770
|
-
const {
|
|
31771
|
-
t
|
|
31772
|
-
} = useTranslation(["common", "register-wallet"]);
|
|
31773
31833
|
const {
|
|
31774
31834
|
data: warehouses,
|
|
31775
31835
|
refetch: refetchWarehouses
|
|
@@ -31787,13 +31847,11 @@ const Onboarding = ({
|
|
|
31787
31847
|
} = useConnectCarrier();
|
|
31788
31848
|
const {
|
|
31789
31849
|
error: registerUpsCarrierErrors,
|
|
31790
|
-
mutateAsync: registerUpsCarrier
|
|
31791
|
-
isLoading: isLoadingUps
|
|
31850
|
+
mutateAsync: registerUpsCarrier
|
|
31792
31851
|
} = useConnectCarrier();
|
|
31793
31852
|
const {
|
|
31794
31853
|
error: registerDhlCarrierErrors,
|
|
31795
|
-
mutateAsync: registerDhlCarrier
|
|
31796
|
-
isLoading: isLoadingDhl
|
|
31854
|
+
mutateAsync: registerDhlCarrier
|
|
31797
31855
|
} = useConnectCarrier();
|
|
31798
31856
|
const onWarehouseCreated = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
31799
31857
|
yield refetchWarehouses();
|
|
@@ -31801,17 +31859,11 @@ const Onboarding = ({
|
|
|
31801
31859
|
const onCarrierCreated = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
31802
31860
|
yield refetchCarriers();
|
|
31803
31861
|
}), [refetchCarriers]);
|
|
31804
|
-
if (!carriers) return jsx(Loader, {
|
|
31805
|
-
|
|
31806
|
-
});
|
|
31807
|
-
if (!warehouses) return jsx(Loader, {
|
|
31808
|
-
message: t("loading.warehouses")
|
|
31809
|
-
});
|
|
31862
|
+
if (!carriers) return jsx(Loader, {});
|
|
31863
|
+
if (!warehouses) return jsx(Loader, {});
|
|
31810
31864
|
return jsx(Onboarding$1, {
|
|
31811
31865
|
carriers: carriers,
|
|
31812
31866
|
createWarehouse: createWarehouse,
|
|
31813
|
-
isLoadingDhl: isLoadingDhl,
|
|
31814
|
-
isLoadingUps: isLoadingUps,
|
|
31815
31867
|
onCarrierCreated: onCarrierCreated,
|
|
31816
31868
|
onCompleteOnboarding: onCompleteOnboarding,
|
|
31817
31869
|
onWarehouseCreated: onWarehouseCreated,
|
|
@@ -32880,4 +32932,4 @@ const renderWithAllProviders = component => {
|
|
|
32880
32932
|
});
|
|
32881
32933
|
};
|
|
32882
32934
|
|
|
32883
|
-
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, 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 };
|
|
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 };
|