@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.cjs
CHANGED
|
@@ -2007,41 +2007,6 @@ $$i({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
|
|
|
2007
2007
|
}
|
|
2008
2008
|
});
|
|
2009
2009
|
|
|
2010
|
-
const currencySymbol = {
|
|
2011
|
-
aud: "$",
|
|
2012
|
-
cad: "$",
|
|
2013
|
-
eur: "€",
|
|
2014
|
-
gbp: "£",
|
|
2015
|
-
nzd: "$",
|
|
2016
|
-
usd: "$"
|
|
2017
|
-
};
|
|
2018
|
-
const formatMoney = (value, locale = "en-US") => {
|
|
2019
|
-
const currency = Intl.NumberFormat(locale, {
|
|
2020
|
-
currency: value.currency,
|
|
2021
|
-
style: "currency"
|
|
2022
|
-
});
|
|
2023
|
-
return currency.format(value.amount);
|
|
2024
|
-
};
|
|
2025
|
-
const calculateTotal = (...values) => {
|
|
2026
|
-
return values.reduce((total, value) => {
|
|
2027
|
-
var _a;
|
|
2028
|
-
return value ? total + ((_a = value.amount) !== null && _a !== void 0 ? _a : 0) : total;
|
|
2029
|
-
}, 0);
|
|
2030
|
-
};
|
|
2031
|
-
const formatCreditCardNumber = cc => [cc.substring(0, 4), cc.substring(4, 8), cc.substring(8, 12), cc.substring(12)].join(" ").trim();
|
|
2032
|
-
|
|
2033
|
-
const isString = x => typeof x === "string";
|
|
2034
|
-
|
|
2035
|
-
const getRateRequiresAcknowledgement = serviceCode => {
|
|
2036
|
-
switch (serviceCode) {
|
|
2037
|
-
case "usps_media_mail":
|
|
2038
|
-
return true;
|
|
2039
|
-
default:
|
|
2040
|
-
return false;
|
|
2041
|
-
}
|
|
2042
|
-
};
|
|
2043
|
-
const getTotalRateAmount = (rateCosts = {}) => calculateTotal(...Object.values(rateCosts));
|
|
2044
|
-
|
|
2045
2010
|
var anObject$9 = anObject$f;
|
|
2046
2011
|
|
|
2047
2012
|
// `RegExp.prototype.flags` getter implementation
|
|
@@ -2240,1092 +2205,1132 @@ $$h({ target: 'RegExp', proto: true, forced: /./.exec !== exec$2 }, {
|
|
|
2240
2205
|
exec: exec$2
|
|
2241
2206
|
});
|
|
2242
2207
|
|
|
2243
|
-
|
|
2244
|
-
const hasEuCustomsRules = true,
|
|
2245
|
-
hasProvinces = true,
|
|
2246
|
-
isMilitary = true,
|
|
2247
|
-
// United States territories that ship domestic but require customs
|
|
2248
|
-
// https://blog.stamps.com/2015/09/23/how-to-ship-packages-to-u-s-territories/
|
|
2249
|
-
isUnitedStatesTerritory$1 = true,
|
|
2250
|
-
supportsByoa = true;
|
|
2251
|
-
class Country {
|
|
2252
|
-
constructor(name, code, rules = {}) {
|
|
2253
|
-
var _a, _b, _c, _d;
|
|
2254
|
-
this.name = name;
|
|
2255
|
-
this.code = code;
|
|
2256
|
-
this.hasEuCustomsRules = (_a = rules.hasEuCustomsRules) !== null && _a !== void 0 ? _a : false;
|
|
2257
|
-
this.hasProvinces = (_b = rules.hasProvinces) !== null && _b !== void 0 ? _b : false;
|
|
2258
|
-
this.isUnitedStatesTerritory = (_c = rules.isUnitedStatesTerritory) !== null && _c !== void 0 ? _c : false;
|
|
2259
|
-
this.supportsByoa = (_d = rules.supportsByoa) !== null && _d !== void 0 ? _d : false;
|
|
2260
|
-
}
|
|
2261
|
-
}
|
|
2262
|
-
const countries = [new Country("Afghanistan", "AF"), new Country("Aland Islands", "AX"), new Country("Albania", "AL"), new Country("Algeria", "DZ"), new Country("American Samoa", "AS", {
|
|
2263
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2264
|
-
}), 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", {
|
|
2265
|
-
hasProvinces,
|
|
2266
|
-
supportsByoa
|
|
2267
|
-
}), new Country("Austria", "AT", {
|
|
2268
|
-
hasEuCustomsRules,
|
|
2269
|
-
supportsByoa
|
|
2270
|
-
}), 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", {
|
|
2271
|
-
hasEuCustomsRules,
|
|
2272
|
-
supportsByoa
|
|
2273
|
-
}), 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", {
|
|
2274
|
-
hasProvinces
|
|
2275
|
-
}), new Country("British Indian Ocean Territory", "IO"), new Country("British Virgin Islands", "VG"), new Country("Brunei Darussalam", "BN"), new Country("Bulgaria", "BG", {
|
|
2276
|
-
hasEuCustomsRules,
|
|
2277
|
-
supportsByoa
|
|
2278
|
-
}), new Country("Burkina Faso", "BF"), new Country("Burundi", "BI"), new Country("Canada", "CA", {
|
|
2279
|
-
hasProvinces
|
|
2280
|
-
}), 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", {
|
|
2281
|
-
hasEuCustomsRules,
|
|
2282
|
-
supportsByoa
|
|
2283
|
-
}), new Country("Cuba", "CU"), new Country("Curacao", "CW"), new Country("Cyprus", "CY", {
|
|
2284
|
-
hasEuCustomsRules,
|
|
2285
|
-
supportsByoa
|
|
2286
|
-
}), new Country("Czech Republic", "CZ", {
|
|
2287
|
-
hasEuCustomsRules,
|
|
2288
|
-
supportsByoa
|
|
2289
|
-
}), new Country("Denmark", "DK", {
|
|
2290
|
-
hasEuCustomsRules,
|
|
2291
|
-
supportsByoa
|
|
2292
|
-
}), 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", {
|
|
2293
|
-
hasEuCustomsRules,
|
|
2294
|
-
supportsByoa
|
|
2295
|
-
}), new Country("Ethiopia", "ET"), new Country("Falkland Islands", "FK"), new Country("Faroe Islands", "FO"), new Country("Federated States of Micronesia", "FM", {
|
|
2296
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2297
|
-
}), new Country("Fiji", "FJ"), new Country("Finland", "FI", {
|
|
2298
|
-
hasEuCustomsRules,
|
|
2299
|
-
supportsByoa
|
|
2300
|
-
}), new Country("France", "FR", {
|
|
2301
|
-
hasEuCustomsRules,
|
|
2302
|
-
supportsByoa
|
|
2303
|
-
}), 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", {
|
|
2304
|
-
hasEuCustomsRules,
|
|
2305
|
-
supportsByoa
|
|
2306
|
-
}), new Country("Ghana", "GH"), new Country("Gibraltar", "GI"), new Country("Greece", "GR", {
|
|
2307
|
-
hasEuCustomsRules,
|
|
2308
|
-
supportsByoa
|
|
2309
|
-
}), new Country("Greenland", "GL"), new Country("Grenada", "GD"), new Country("Guadeloupe", "GP"), new Country("Guam", "GU", {
|
|
2310
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2311
|
-
}), 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", {
|
|
2312
|
-
hasEuCustomsRules,
|
|
2313
|
-
supportsByoa
|
|
2314
|
-
}), new Country("Iceland", "IS"), new Country("India", "IN"), new Country("Indonesia", "ID"), new Country("Iran", "IR"), new Country("Iraq", "IQ"), new Country("Ireland", "IE", {
|
|
2315
|
-
hasEuCustomsRules,
|
|
2316
|
-
supportsByoa
|
|
2317
|
-
}), new Country("Isle of Man", "IM"), new Country("Israel", "IL"), new Country("Italy", "IT", {
|
|
2318
|
-
hasEuCustomsRules,
|
|
2319
|
-
supportsByoa
|
|
2320
|
-
}), new Country("Ivory Coast", "CI"), new Country("Jamaica", "JM"), new Country("Japan", "JP", {
|
|
2321
|
-
hasProvinces
|
|
2322
|
-
}), 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", {
|
|
2323
|
-
hasEuCustomsRules,
|
|
2324
|
-
supportsByoa
|
|
2325
|
-
}), new Country("Lebanon", "LB"), new Country("Lesotho", "LS"), new Country("Liberia", "LR"), new Country("Libya", "LY"), new Country("Liechtenstein", "LI"), new Country("Lithuania", "LT", {
|
|
2326
|
-
hasEuCustomsRules,
|
|
2327
|
-
supportsByoa
|
|
2328
|
-
}), new Country("Luxembourg", "LU", {
|
|
2329
|
-
hasEuCustomsRules,
|
|
2330
|
-
supportsByoa
|
|
2331
|
-
}), 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", {
|
|
2332
|
-
hasEuCustomsRules,
|
|
2333
|
-
supportsByoa
|
|
2334
|
-
}), new Country("Marshall Islands", "MH", {
|
|
2335
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2336
|
-
}), new Country("Martinique", "MQ"), new Country("Mauritania", "MR"), new Country("Mauritius0", "MU"), new Country("Mayotte", "YT"), new Country("Mexico", "MX", {
|
|
2337
|
-
supportsByoa
|
|
2338
|
-
}), 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", {
|
|
2339
|
-
hasEuCustomsRules,
|
|
2340
|
-
supportsByoa
|
|
2341
|
-
}), new Country("Netherlands Antilles", "AN"), new Country("New Caledonia", "NC"), new Country("New Zealand", "NZ", {
|
|
2342
|
-
supportsByoa
|
|
2343
|
-
}), 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", {
|
|
2344
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2345
|
-
}), new Country("Norway", "NO", {
|
|
2346
|
-
hasEuCustomsRules
|
|
2347
|
-
}), new Country("Oman", "OM"), new Country("Pakistan", "PK"), new Country("Palau", "PW", {
|
|
2348
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2349
|
-
}), 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", {
|
|
2350
|
-
hasEuCustomsRules
|
|
2351
|
-
}), new Country("Portugal", "PT", {
|
|
2352
|
-
hasEuCustomsRules,
|
|
2353
|
-
supportsByoa
|
|
2354
|
-
}),
|
|
2355
|
-
// TODO - Puerto Rico is a US territory but there are some funky rules with USPS that need to be addressed
|
|
2356
|
-
new Country("Puerto Rico", "PR", {
|
|
2357
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1,
|
|
2358
|
-
supportsByoa
|
|
2359
|
-
}), new Country("Qatar", "QA"), new Country("Reunion", "RE"), new Country("Romania", "RO", {
|
|
2360
|
-
hasEuCustomsRules,
|
|
2361
|
-
supportsByoa
|
|
2362
|
-
}), 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", {
|
|
2363
|
-
hasEuCustomsRules,
|
|
2364
|
-
supportsByoa
|
|
2365
|
-
}), new Country("Slovenia", "SI", {
|
|
2366
|
-
hasEuCustomsRules,
|
|
2367
|
-
supportsByoa
|
|
2368
|
-
}), 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", {
|
|
2369
|
-
hasEuCustomsRules,
|
|
2370
|
-
supportsByoa
|
|
2371
|
-
}), 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", {
|
|
2372
|
-
hasEuCustomsRules,
|
|
2373
|
-
supportsByoa
|
|
2374
|
-
}), new Country("Switzerland", "CH", {
|
|
2375
|
-
hasEuCustomsRules
|
|
2376
|
-
}), 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", {
|
|
2377
|
-
supportsByoa
|
|
2378
|
-
}), new Country("United States Virgin Islands", "VI", {
|
|
2379
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2380
|
-
}), new Country("U.S. Minor Outlying Islands", "UM", {
|
|
2381
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2382
|
-
}), new Country("United States of America", "US", {
|
|
2383
|
-
hasProvinces,
|
|
2384
|
-
supportsByoa
|
|
2385
|
-
}), 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")];
|
|
2386
|
-
const countryCodes = countries.map(c => c.code);
|
|
2387
|
-
const euCountryCodes = countries.filter(c => c.hasEuCustomsRules).map(c => c.code);
|
|
2388
|
-
// #endregion
|
|
2389
|
-
// #region [ rgba(0,0,0,0) ] Postal Codes
|
|
2390
|
-
const postalCodeRegex$3 = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
|
|
2391
|
-
class UsState {
|
|
2392
|
-
constructor(name, code, rules = {}) {
|
|
2393
|
-
var _a, _b;
|
|
2394
|
-
this.name = name;
|
|
2395
|
-
this.code = code;
|
|
2396
|
-
this.isMilitary = (_a = rules.isMilitary) !== null && _a !== void 0 ? _a : false;
|
|
2397
|
-
this.isUnitedStatesTerritory = (_b = rules.isUnitedStatesTerritory) !== null && _b !== void 0 ? _b : false;
|
|
2398
|
-
}
|
|
2399
|
-
}
|
|
2400
|
-
const usStates = [new UsState("Alabama", "AL"), new UsState("Alaska", "AK"), new UsState("American Samoa", "AS", {
|
|
2401
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2402
|
-
}), new UsState("Arizona", "AZ"), new UsState("Arkansas", "AR"), new UsState("Armed Forces Americas", "AA", {
|
|
2403
|
-
isMilitary
|
|
2404
|
-
}), new UsState("Armed Forces Europe", "AE", {
|
|
2405
|
-
isMilitary
|
|
2406
|
-
}), new UsState("Armed Forces Pacific", "AP", {
|
|
2407
|
-
isMilitary
|
|
2408
|
-
}), 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", {
|
|
2409
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2410
|
-
}), 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", {
|
|
2411
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2412
|
-
}), 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", {
|
|
2413
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2414
|
-
}), 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", {
|
|
2415
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2416
|
-
}), new UsState("U.S. Minor Outlying Islands", "UM", {
|
|
2417
|
-
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2418
|
-
})];
|
|
2419
|
-
const usStateCodes = usStates.map(item => item.code);
|
|
2420
|
-
class UsaCity {
|
|
2421
|
-
constructor(name, code, rules = {}) {
|
|
2422
|
-
var _a;
|
|
2423
|
-
this.name = name;
|
|
2424
|
-
this.code = code;
|
|
2425
|
-
this.isMilitary = (_a = rules.isMilitary) !== null && _a !== void 0 ? _a : false;
|
|
2426
|
-
}
|
|
2427
|
-
}
|
|
2428
|
-
const usCities = [new UsaCity("Army Post Office", "APO", {
|
|
2429
|
-
isMilitary
|
|
2430
|
-
}), new UsaCity("Diplomatic Post Office", "DPO", {
|
|
2431
|
-
isMilitary
|
|
2432
|
-
}), new UsaCity("Fleet Post Office", "FPO", {
|
|
2433
|
-
isMilitary
|
|
2434
|
-
})];
|
|
2435
|
-
// #endregion
|
|
2208
|
+
var NATIVE_BIND$1 = functionBindNative;
|
|
2436
2209
|
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2210
|
+
var FunctionPrototype = Function.prototype;
|
|
2211
|
+
var apply$2 = FunctionPrototype.apply;
|
|
2212
|
+
var call$b = FunctionPrototype.call;
|
|
2213
|
+
|
|
2214
|
+
// eslint-disable-next-line es/no-reflect -- safe
|
|
2215
|
+
var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$b.bind(apply$2) : function () {
|
|
2216
|
+
return call$b.apply(apply$2, arguments);
|
|
2217
|
+
});
|
|
2218
|
+
|
|
2219
|
+
var classofRaw = classofRaw$2;
|
|
2220
|
+
var uncurryThis$f = functionUncurryThis;
|
|
2221
|
+
|
|
2222
|
+
var functionUncurryThisClause = function (fn) {
|
|
2223
|
+
// Nashorn bug:
|
|
2224
|
+
// https://github.com/zloirock/core-js/issues/1128
|
|
2225
|
+
// https://github.com/zloirock/core-js/issues/1130
|
|
2226
|
+
if (classofRaw(fn) === 'Function') return uncurryThis$f(fn);
|
|
2443
2227
|
};
|
|
2444
|
-
/**
|
|
2445
|
-
* @category Utilities
|
|
2446
|
-
*/
|
|
2447
|
-
const isMilitaryAddress = address => {
|
|
2448
|
-
var _a, _b;
|
|
2449
|
-
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));
|
|
2450
|
-
};
|
|
2451
|
-
/**
|
|
2452
|
-
* @category Utilities
|
|
2453
|
-
*/
|
|
2454
|
-
const isUnitedStatesTerritory = address => {
|
|
2455
|
-
var _a, _b;
|
|
2456
|
-
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));
|
|
2457
|
-
};
|
|
2458
|
-
const PO_BOX_REGEX =
|
|
2459
|
-
// eslint-disable-next-line no-useless-escape
|
|
2460
|
-
/^(((p[\s\.\'\,]?[o\s][\.\'\,]?)\s?)|(post\s?office\s?))((box|bin|bo|b\.?)?\s?(num|number|#)?\s?\d+)/i;
|
|
2461
|
-
/**
|
|
2462
|
-
* @category Utilities
|
|
2463
|
-
*/
|
|
2464
|
-
const isPoBox = addressLine => PO_BOX_REGEX.test(addressLine);
|
|
2465
|
-
/**
|
|
2466
|
-
* @category Utilities
|
|
2467
|
-
*/
|
|
2468
|
-
const isPoBoxAddress = address => !!(isPoBox(address.addressLine1) || address.addressLine2 && isPoBox(address.addressLine2));
|
|
2469
|
-
|
|
2470
|
-
var $$g = _export;
|
|
2471
|
-
var $includes = arrayIncludes.includes;
|
|
2472
|
-
var fails$a = fails$r;
|
|
2473
|
-
var addToUnscopables$2 = addToUnscopables$4;
|
|
2474
2228
|
|
|
2475
|
-
//
|
|
2476
|
-
var BROKEN_ON_SPARSE = fails$a(function () {
|
|
2477
|
-
return !Array(1).includes();
|
|
2478
|
-
});
|
|
2229
|
+
// TODO: Remove from `core-js@4` since it's moved to entry points
|
|
2479
2230
|
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
});
|
|
2231
|
+
var uncurryThis$e = functionUncurryThisClause;
|
|
2232
|
+
var defineBuiltIn$4 = defineBuiltIn$8;
|
|
2233
|
+
var regexpExec$1 = regexpExec$2;
|
|
2234
|
+
var fails$a = fails$r;
|
|
2235
|
+
var wellKnownSymbol$a = wellKnownSymbol$j;
|
|
2236
|
+
var createNonEnumerableProperty = createNonEnumerableProperty$5;
|
|
2487
2237
|
|
|
2488
|
-
|
|
2489
|
-
|
|
2238
|
+
var SPECIES$4 = wellKnownSymbol$a('species');
|
|
2239
|
+
var RegExpPrototype$2 = RegExp.prototype;
|
|
2490
2240
|
|
|
2491
|
-
|
|
2492
|
-
|
|
2241
|
+
var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
|
|
2242
|
+
var SYMBOL = wellKnownSymbol$a(KEY);
|
|
2493
2243
|
|
|
2494
|
-
function
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
const hasAllZeroes = Object.values(dims).every(d => d === 0);
|
|
2500
|
-
return hasAllZeroes && !allowAllZeroes ? undefined : dims;
|
|
2501
|
-
}
|
|
2502
|
-
return Object.assign(Object.assign({}, dimensions), {
|
|
2503
|
-
unit: "inch"
|
|
2244
|
+
var DELEGATES_TO_SYMBOL = !fails$a(function () {
|
|
2245
|
+
// String methods call symbol-named RegEp methods
|
|
2246
|
+
var O = {};
|
|
2247
|
+
O[SYMBOL] = function () { return 7; };
|
|
2248
|
+
return ''[KEY](O) != 7;
|
|
2504
2249
|
});
|
|
2505
|
-
}
|
|
2506
|
-
|
|
2507
|
-
/**
|
|
2508
|
-
* @category Utilities
|
|
2509
|
-
*/
|
|
2510
|
-
const getCustomsFromSalesOrder = (salesOrder, warehouse) => ({
|
|
2511
|
-
contents: "merchandise",
|
|
2512
|
-
customsItems: salesOrder.salesOrderItems.filter(item => item.lineItemDetails.name.length > 0).map(item => ({
|
|
2513
|
-
countryOfOrigin: warehouse.originAddress.countryCode,
|
|
2514
|
-
description: item.lineItemDetails.name,
|
|
2515
|
-
quantity: item.quantity,
|
|
2516
|
-
value: item.priceSummary.unitPrice.amount
|
|
2517
|
-
})),
|
|
2518
|
-
nonDelivery: "return_to_sender"
|
|
2519
|
-
});
|
|
2520
|
-
/**
|
|
2521
|
-
* @category Utilities
|
|
2522
|
-
*/
|
|
2523
|
-
const getIsCustomsRequiredForSalesOrder = ({
|
|
2524
|
-
shipTo
|
|
2525
|
-
}, {
|
|
2526
|
-
originAddress
|
|
2527
|
-
}) => 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);
|
|
2528
|
-
/**
|
|
2529
|
-
* @category Utilities
|
|
2530
|
-
*/
|
|
2531
|
-
const getRequestedServices = salesOrder => {
|
|
2532
|
-
var _a;
|
|
2533
|
-
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)));
|
|
2534
|
-
};
|
|
2535
|
-
const getSalesOrderItemsFromSalesOrderOrShipment = ({
|
|
2536
|
-
salesOrder,
|
|
2537
|
-
shipment
|
|
2538
|
-
}) => {
|
|
2539
|
-
var _a, _b;
|
|
2540
|
-
return (_b = (_a = salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.salesOrderItems.map(item => ({
|
|
2541
|
-
detail: `SKU ${item.lineItemDetails.sku}`,
|
|
2542
|
-
name: item.lineItemDetails.name,
|
|
2543
|
-
quantity: item.quantity,
|
|
2544
|
-
subDetail: item.requestedShippingOptions.shippingService,
|
|
2545
|
-
subDetailValue: item.priceSummary.estimatedShipping,
|
|
2546
|
-
totalValue: item.priceSummary.total,
|
|
2547
|
-
value: item.priceSummary.unitPrice
|
|
2548
|
-
}))) !== null && _a !== void 0 ? _a : shipment === null || shipment === void 0 ? void 0 : shipment.items.map((item, i) => ({
|
|
2549
|
-
detail: `SKU ${item.sku}`,
|
|
2550
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || `ITEM ${i}`,
|
|
2551
|
-
quantity: item.quantity
|
|
2552
|
-
}))) !== null && _b !== void 0 ? _b : [];
|
|
2553
|
-
};
|
|
2554
|
-
|
|
2555
|
-
var tryToString$3 = tryToString$5;
|
|
2556
2250
|
|
|
2557
|
-
var
|
|
2251
|
+
var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails$a(function () {
|
|
2252
|
+
// Symbol-named RegExp methods call .exec
|
|
2253
|
+
var execCalled = false;
|
|
2254
|
+
var re = /a/;
|
|
2558
2255
|
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2256
|
+
if (KEY === 'split') {
|
|
2257
|
+
// We can't use real regex here since it causes deoptimization
|
|
2258
|
+
// and serious performance degradation in V8
|
|
2259
|
+
// https://github.com/zloirock/core-js/issues/306
|
|
2260
|
+
re = {};
|
|
2261
|
+
// RegExp[@@split] doesn't call the regex's exec method, but first creates
|
|
2262
|
+
// a new one. We need to return the patched regex when creating the new one.
|
|
2263
|
+
re.constructor = {};
|
|
2264
|
+
re.constructor[SPECIES$4] = function () { return re; };
|
|
2265
|
+
re.flags = '';
|
|
2266
|
+
re[SYMBOL] = /./[SYMBOL];
|
|
2267
|
+
}
|
|
2562
2268
|
|
|
2563
|
-
|
|
2564
|
-
var definePropertyModule$1 = objectDefineProperty;
|
|
2565
|
-
var createPropertyDescriptor = createPropertyDescriptor$4;
|
|
2269
|
+
re.exec = function () { execCalled = true; return null; };
|
|
2566
2270
|
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
else object[propertyKey] = value;
|
|
2571
|
-
};
|
|
2271
|
+
re[SYMBOL]('');
|
|
2272
|
+
return !execCalled;
|
|
2273
|
+
});
|
|
2572
2274
|
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2275
|
+
if (
|
|
2276
|
+
!DELEGATES_TO_SYMBOL ||
|
|
2277
|
+
!DELEGATES_TO_EXEC ||
|
|
2278
|
+
FORCED
|
|
2279
|
+
) {
|
|
2280
|
+
var uncurriedNativeRegExpMethod = uncurryThis$e(/./[SYMBOL]);
|
|
2281
|
+
var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
|
2282
|
+
var uncurriedNativeMethod = uncurryThis$e(nativeMethod);
|
|
2283
|
+
var $exec = regexp.exec;
|
|
2284
|
+
if ($exec === regexpExec$1 || $exec === RegExpPrototype$2.exec) {
|
|
2285
|
+
if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
|
|
2286
|
+
// The native String method already delegates to @@method (this
|
|
2287
|
+
// polyfilled function), leasing to infinite recursion.
|
|
2288
|
+
// We avoid it by directly calling the native @@method method.
|
|
2289
|
+
return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
|
|
2290
|
+
}
|
|
2291
|
+
return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
|
|
2292
|
+
}
|
|
2293
|
+
return { done: false };
|
|
2294
|
+
});
|
|
2576
2295
|
|
|
2577
|
-
|
|
2578
|
-
|
|
2296
|
+
defineBuiltIn$4(String.prototype, KEY, methods[0]);
|
|
2297
|
+
defineBuiltIn$4(RegExpPrototype$2, SYMBOL, methods[1]);
|
|
2298
|
+
}
|
|
2579
2299
|
|
|
2580
|
-
|
|
2581
|
-
var length = lengthOfArrayLike$5(O);
|
|
2582
|
-
var k = toAbsoluteIndex(start, length);
|
|
2583
|
-
var fin = toAbsoluteIndex(end === undefined ? length : end, length);
|
|
2584
|
-
var result = $Array$1(max$1(fin - k, 0));
|
|
2585
|
-
for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
|
|
2586
|
-
result.length = n;
|
|
2587
|
-
return result;
|
|
2300
|
+
if (SHAM) createNonEnumerableProperty(RegExpPrototype$2[SYMBOL], 'sham', true);
|
|
2588
2301
|
};
|
|
2589
2302
|
|
|
2590
|
-
var
|
|
2303
|
+
var uncurryThis$d = functionUncurryThis;
|
|
2304
|
+
var toIntegerOrInfinity$4 = toIntegerOrInfinity$7;
|
|
2305
|
+
var toString$9 = toString$c;
|
|
2306
|
+
var requireObjectCoercible$5 = requireObjectCoercible$9;
|
|
2591
2307
|
|
|
2592
|
-
var
|
|
2308
|
+
var charAt$3 = uncurryThis$d(''.charAt);
|
|
2309
|
+
var charCodeAt = uncurryThis$d(''.charCodeAt);
|
|
2310
|
+
var stringSlice$5 = uncurryThis$d(''.slice);
|
|
2593
2311
|
|
|
2594
|
-
var
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2312
|
+
var createMethod = function (CONVERT_TO_STRING) {
|
|
2313
|
+
return function ($this, pos) {
|
|
2314
|
+
var S = toString$9(requireObjectCoercible$5($this));
|
|
2315
|
+
var position = toIntegerOrInfinity$4(pos);
|
|
2316
|
+
var size = S.length;
|
|
2317
|
+
var first, second;
|
|
2318
|
+
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
|
2319
|
+
first = charCodeAt(S, position);
|
|
2320
|
+
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
|
2321
|
+
|| (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
|
|
2322
|
+
? CONVERT_TO_STRING
|
|
2323
|
+
? charAt$3(S, position)
|
|
2324
|
+
: first
|
|
2325
|
+
: CONVERT_TO_STRING
|
|
2326
|
+
? stringSlice$5(S, position, position + 2)
|
|
2327
|
+
: (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
|
2328
|
+
};
|
|
2603
2329
|
};
|
|
2604
2330
|
|
|
2605
|
-
var
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
element = array[i];
|
|
2613
|
-
while (j && comparefn(array[j - 1], element) > 0) {
|
|
2614
|
-
array[j] = array[--j];
|
|
2615
|
-
}
|
|
2616
|
-
if (j !== i++) array[j] = element;
|
|
2617
|
-
} return array;
|
|
2331
|
+
var stringMultibyte = {
|
|
2332
|
+
// `String.prototype.codePointAt` method
|
|
2333
|
+
// https://tc39.es/ecma262/#sec-string.prototype.codepointat
|
|
2334
|
+
codeAt: createMethod(false),
|
|
2335
|
+
// `String.prototype.at` method
|
|
2336
|
+
// https://github.com/mathiasbynens/String.prototype.at
|
|
2337
|
+
charAt: createMethod(true)
|
|
2618
2338
|
};
|
|
2619
2339
|
|
|
2620
|
-
var
|
|
2621
|
-
var llength = left.length;
|
|
2622
|
-
var rlength = right.length;
|
|
2623
|
-
var lindex = 0;
|
|
2624
|
-
var rindex = 0;
|
|
2340
|
+
var charAt$2 = stringMultibyte.charAt;
|
|
2625
2341
|
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
} return array;
|
|
2342
|
+
// `AdvanceStringIndex` abstract operation
|
|
2343
|
+
// https://tc39.es/ecma262/#sec-advancestringindex
|
|
2344
|
+
var advanceStringIndex$2 = function (S, index, unicode) {
|
|
2345
|
+
return index + (unicode ? charAt$2(S, index).length : 1);
|
|
2631
2346
|
};
|
|
2632
2347
|
|
|
2633
|
-
var
|
|
2634
|
-
|
|
2635
|
-
var userAgent$4 = engineUserAgent;
|
|
2636
|
-
|
|
2637
|
-
var firefox = userAgent$4.match(/firefox\/(\d+)/i);
|
|
2638
|
-
|
|
2639
|
-
var engineFfVersion = !!firefox && +firefox[1];
|
|
2640
|
-
|
|
2641
|
-
var UA = engineUserAgent;
|
|
2348
|
+
var uncurryThis$c = functionUncurryThis;
|
|
2349
|
+
var toObject$3 = toObject$8;
|
|
2642
2350
|
|
|
2643
|
-
var
|
|
2351
|
+
var floor$2 = Math.floor;
|
|
2352
|
+
var charAt$1 = uncurryThis$c(''.charAt);
|
|
2353
|
+
var replace$1 = uncurryThis$c(''.replace);
|
|
2354
|
+
var stringSlice$4 = uncurryThis$c(''.slice);
|
|
2355
|
+
var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
|
|
2356
|
+
var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
|
|
2644
2357
|
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
var
|
|
2648
|
-
|
|
2649
|
-
var
|
|
2358
|
+
// `GetSubstitution` abstract operation
|
|
2359
|
+
// https://tc39.es/ecma262/#sec-getsubstitution
|
|
2360
|
+
var getSubstitution$1 = function (matched, str, position, captures, namedCaptures, replacement) {
|
|
2361
|
+
var tailPos = position + matched.length;
|
|
2362
|
+
var m = captures.length;
|
|
2363
|
+
var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
|
|
2364
|
+
if (namedCaptures !== undefined) {
|
|
2365
|
+
namedCaptures = toObject$3(namedCaptures);
|
|
2366
|
+
symbols = SUBSTITUTION_SYMBOLS;
|
|
2367
|
+
}
|
|
2368
|
+
return replace$1(replacement, symbols, function (match, ch) {
|
|
2369
|
+
var capture;
|
|
2370
|
+
switch (charAt$1(ch, 0)) {
|
|
2371
|
+
case '$': return '$';
|
|
2372
|
+
case '&': return matched;
|
|
2373
|
+
case '`': return stringSlice$4(str, 0, position);
|
|
2374
|
+
case "'": return stringSlice$4(str, tailPos);
|
|
2375
|
+
case '<':
|
|
2376
|
+
capture = namedCaptures[stringSlice$4(ch, 1, -1)];
|
|
2377
|
+
break;
|
|
2378
|
+
default: // \d\d?
|
|
2379
|
+
var n = +ch;
|
|
2380
|
+
if (n === 0) return match;
|
|
2381
|
+
if (n > m) {
|
|
2382
|
+
var f = floor$2(n / 10);
|
|
2383
|
+
if (f === 0) return match;
|
|
2384
|
+
if (f <= m) return captures[f - 1] === undefined ? charAt$1(ch, 1) : captures[f - 1] + charAt$1(ch, 1);
|
|
2385
|
+
return match;
|
|
2386
|
+
}
|
|
2387
|
+
capture = captures[n - 1];
|
|
2388
|
+
}
|
|
2389
|
+
return capture === undefined ? '' : capture;
|
|
2390
|
+
});
|
|
2391
|
+
};
|
|
2650
2392
|
|
|
2651
|
-
var
|
|
2652
|
-
var
|
|
2653
|
-
var
|
|
2654
|
-
var
|
|
2655
|
-
var
|
|
2656
|
-
var deletePropertyOrThrow = deletePropertyOrThrow$1;
|
|
2657
|
-
var toString$9 = toString$c;
|
|
2658
|
-
var fails$9 = fails$r;
|
|
2659
|
-
var internalSort = arraySort;
|
|
2660
|
-
var arrayMethodIsStrict = arrayMethodIsStrict$2;
|
|
2661
|
-
var FF = engineFfVersion;
|
|
2662
|
-
var IE_OR_EDGE = engineIsIeOrEdge;
|
|
2663
|
-
var V8 = engineV8Version;
|
|
2664
|
-
var WEBKIT = engineWebkitVersion;
|
|
2393
|
+
var call$a = functionCall;
|
|
2394
|
+
var anObject$8 = anObject$f;
|
|
2395
|
+
var isCallable$8 = isCallable$o;
|
|
2396
|
+
var classof$4 = classofRaw$2;
|
|
2397
|
+
var regexpExec = regexpExec$2;
|
|
2665
2398
|
|
|
2666
|
-
var
|
|
2667
|
-
var nativeSort = uncurryThis$f(test.sort);
|
|
2668
|
-
var push$1 = uncurryThis$f(test.push);
|
|
2399
|
+
var $TypeError$9 = TypeError;
|
|
2669
2400
|
|
|
2670
|
-
//
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
var
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2401
|
+
// `RegExpExec` abstract operation
|
|
2402
|
+
// https://tc39.es/ecma262/#sec-regexpexec
|
|
2403
|
+
var regexpExecAbstract = function (R, S) {
|
|
2404
|
+
var exec = R.exec;
|
|
2405
|
+
if (isCallable$8(exec)) {
|
|
2406
|
+
var result = call$a(exec, R, S);
|
|
2407
|
+
if (result !== null) anObject$8(result);
|
|
2408
|
+
return result;
|
|
2409
|
+
}
|
|
2410
|
+
if (classof$4(R) === 'RegExp') return call$a(regexpExec, R, S);
|
|
2411
|
+
throw $TypeError$9('RegExp#exec called on incompatible receiver');
|
|
2412
|
+
};
|
|
2680
2413
|
|
|
2681
|
-
var
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2414
|
+
var apply$1 = functionApply;
|
|
2415
|
+
var call$9 = functionCall;
|
|
2416
|
+
var uncurryThis$b = functionUncurryThis;
|
|
2417
|
+
var fixRegExpWellKnownSymbolLogic$1 = fixRegexpWellKnownSymbolLogic;
|
|
2418
|
+
var fails$9 = fails$r;
|
|
2419
|
+
var anObject$7 = anObject$f;
|
|
2420
|
+
var isCallable$7 = isCallable$o;
|
|
2421
|
+
var isNullOrUndefined$3 = isNullOrUndefined$6;
|
|
2422
|
+
var toIntegerOrInfinity$3 = toIntegerOrInfinity$7;
|
|
2423
|
+
var toLength$2 = toLength$4;
|
|
2424
|
+
var toString$8 = toString$c;
|
|
2425
|
+
var requireObjectCoercible$4 = requireObjectCoercible$9;
|
|
2426
|
+
var advanceStringIndex$1 = advanceStringIndex$2;
|
|
2427
|
+
var getMethod$3 = getMethod$5;
|
|
2428
|
+
var getSubstitution = getSubstitution$1;
|
|
2429
|
+
var regExpExec$1 = regexpExecAbstract;
|
|
2430
|
+
var wellKnownSymbol$9 = wellKnownSymbol$j;
|
|
2687
2431
|
|
|
2688
|
-
|
|
2689
|
-
|
|
2432
|
+
var REPLACE = wellKnownSymbol$9('replace');
|
|
2433
|
+
var max$1 = Math.max;
|
|
2434
|
+
var min$1 = Math.min;
|
|
2435
|
+
var concat = uncurryThis$b([].concat);
|
|
2436
|
+
var push$1 = uncurryThis$b([].push);
|
|
2437
|
+
var stringIndexOf$1 = uncurryThis$b(''.indexOf);
|
|
2438
|
+
var stringSlice$3 = uncurryThis$b(''.slice);
|
|
2690
2439
|
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2440
|
+
var maybeToString = function (it) {
|
|
2441
|
+
return it === undefined ? it : String(it);
|
|
2442
|
+
};
|
|
2694
2443
|
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2444
|
+
// IE <= 11 replaces $0 with the whole match, as if it was $&
|
|
2445
|
+
// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
|
|
2446
|
+
var REPLACE_KEEPS_$0 = (function () {
|
|
2447
|
+
// eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
|
|
2448
|
+
return 'a'.replace(/./, '$0') === '$0';
|
|
2449
|
+
})();
|
|
2700
2450
|
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2451
|
+
// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
|
|
2452
|
+
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
|
|
2453
|
+
if (/./[REPLACE]) {
|
|
2454
|
+
return /./[REPLACE]('a', '$0') === '';
|
|
2704
2455
|
}
|
|
2456
|
+
return false;
|
|
2457
|
+
})();
|
|
2705
2458
|
|
|
2706
|
-
|
|
2459
|
+
var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$9(function () {
|
|
2460
|
+
var re = /./;
|
|
2461
|
+
re.exec = function () {
|
|
2462
|
+
var result = [];
|
|
2463
|
+
result.groups = { a: '7' };
|
|
2464
|
+
return result;
|
|
2465
|
+
};
|
|
2466
|
+
// eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
|
|
2467
|
+
return ''.replace(re, '$<a>') !== '7';
|
|
2468
|
+
});
|
|
2707
2469
|
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
}
|
|
2470
|
+
// @@replace logic
|
|
2471
|
+
fixRegExpWellKnownSymbolLogic$1('replace', function (_, nativeReplace, maybeCallNative) {
|
|
2472
|
+
var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
|
|
2712
2473
|
|
|
2713
|
-
return
|
|
2714
|
-
|
|
2474
|
+
return [
|
|
2475
|
+
// `String.prototype.replace` method
|
|
2476
|
+
// https://tc39.es/ecma262/#sec-string.prototype.replace
|
|
2477
|
+
function replace(searchValue, replaceValue) {
|
|
2478
|
+
var O = requireObjectCoercible$4(this);
|
|
2479
|
+
var replacer = isNullOrUndefined$3(searchValue) ? undefined : getMethod$3(searchValue, REPLACE);
|
|
2480
|
+
return replacer
|
|
2481
|
+
? call$9(replacer, searchValue, O, replaceValue)
|
|
2482
|
+
: call$9(nativeReplace, toString$8(O), searchValue, replaceValue);
|
|
2483
|
+
},
|
|
2484
|
+
// `RegExp.prototype[@@replace]` method
|
|
2485
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
|
|
2486
|
+
function (string, replaceValue) {
|
|
2487
|
+
var rx = anObject$7(this);
|
|
2488
|
+
var S = toString$8(string);
|
|
2715
2489
|
|
|
2716
|
-
|
|
2490
|
+
if (
|
|
2491
|
+
typeof replaceValue == 'string' &&
|
|
2492
|
+
stringIndexOf$1(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
|
|
2493
|
+
stringIndexOf$1(replaceValue, '$<') === -1
|
|
2494
|
+
) {
|
|
2495
|
+
var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
|
|
2496
|
+
if (res.done) return res.value;
|
|
2497
|
+
}
|
|
2717
2498
|
|
|
2718
|
-
var
|
|
2719
|
-
|
|
2720
|
-
if (y === undefined) return -1;
|
|
2721
|
-
if (x === undefined) return 1;
|
|
2722
|
-
if (comparefn !== undefined) return +comparefn(x, y) || 0;
|
|
2723
|
-
return toString$9(x) > toString$9(y) ? 1 : -1;
|
|
2724
|
-
};
|
|
2725
|
-
};
|
|
2499
|
+
var functionalReplace = isCallable$7(replaceValue);
|
|
2500
|
+
if (!functionalReplace) replaceValue = toString$8(replaceValue);
|
|
2726
2501
|
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2502
|
+
var global = rx.global;
|
|
2503
|
+
if (global) {
|
|
2504
|
+
var fullUnicode = rx.unicode;
|
|
2505
|
+
rx.lastIndex = 0;
|
|
2506
|
+
}
|
|
2507
|
+
var results = [];
|
|
2508
|
+
while (true) {
|
|
2509
|
+
var result = regExpExec$1(rx, S);
|
|
2510
|
+
if (result === null) break;
|
|
2732
2511
|
|
|
2733
|
-
|
|
2512
|
+
push$1(results, result);
|
|
2513
|
+
if (!global) break;
|
|
2734
2514
|
|
|
2735
|
-
|
|
2515
|
+
var matchStr = toString$8(result[0]);
|
|
2516
|
+
if (matchStr === '') rx.lastIndex = advanceStringIndex$1(S, toLength$2(rx.lastIndex), fullUnicode);
|
|
2517
|
+
}
|
|
2736
2518
|
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2519
|
+
var accumulatedResult = '';
|
|
2520
|
+
var nextSourcePosition = 0;
|
|
2521
|
+
for (var i = 0; i < results.length; i++) {
|
|
2522
|
+
result = results[i];
|
|
2740
2523
|
|
|
2741
|
-
|
|
2742
|
-
|
|
2524
|
+
var matched = toString$8(result[0]);
|
|
2525
|
+
var position = max$1(min$1(toIntegerOrInfinity$3(result.index), S.length), 0);
|
|
2526
|
+
var captures = [];
|
|
2527
|
+
// NOTE: This is equivalent to
|
|
2528
|
+
// captures = result.slice(1).map(maybeToString)
|
|
2529
|
+
// but for some reason `nativeSlice.call(result, 1, result.length)` (called in
|
|
2530
|
+
// the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
|
|
2531
|
+
// causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
|
|
2532
|
+
for (var j = 1; j < result.length; j++) push$1(captures, maybeToString(result[j]));
|
|
2533
|
+
var namedCaptures = result.groups;
|
|
2534
|
+
if (functionalReplace) {
|
|
2535
|
+
var replacerArgs = concat([matched], captures, position, S);
|
|
2536
|
+
if (namedCaptures !== undefined) push$1(replacerArgs, namedCaptures);
|
|
2537
|
+
var replacement = toString$8(apply$1(replaceValue, undefined, replacerArgs));
|
|
2538
|
+
} else {
|
|
2539
|
+
replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
|
|
2540
|
+
}
|
|
2541
|
+
if (position >= nextSourcePosition) {
|
|
2542
|
+
accumulatedResult += stringSlice$3(S, nextSourcePosition, position) + replacement;
|
|
2543
|
+
nextSourcePosition = position + matched.length;
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
return accumulatedResult + stringSlice$3(S, nextSourcePosition);
|
|
2743
2547
|
}
|
|
2548
|
+
];
|
|
2549
|
+
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
|
|
2744
2550
|
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2551
|
+
const currencySymbol = {
|
|
2552
|
+
aud: "$",
|
|
2553
|
+
cad: "$",
|
|
2554
|
+
eur: "€",
|
|
2555
|
+
gbp: "£",
|
|
2556
|
+
nzd: "$",
|
|
2557
|
+
usd: "$"
|
|
2558
|
+
};
|
|
2559
|
+
const formatMoney = (value, locale = "en-US") => {
|
|
2560
|
+
const currency = Intl.NumberFormat(locale, {
|
|
2561
|
+
currency: value.currency,
|
|
2562
|
+
style: "currency"
|
|
2563
|
+
});
|
|
2564
|
+
return currency.format(value.amount);
|
|
2565
|
+
};
|
|
2566
|
+
const calculateTotal = (...values) => {
|
|
2567
|
+
return values.reduce((total, value) => {
|
|
2568
|
+
var _a;
|
|
2569
|
+
return value ? total + ((_a = value.amount) !== null && _a !== void 0 ? _a : 0) : total;
|
|
2570
|
+
}, 0);
|
|
2571
|
+
};
|
|
2572
|
+
const formatCreditCardNumber = cc => [cc.substring(0, 4), cc.substring(4, 8), cc.substring(8, 12), cc.substring(12)].join(" ").trim();
|
|
2573
|
+
const formatExpiration = exp => {
|
|
2574
|
+
const digits = exp.replace(/\//g, "");
|
|
2575
|
+
if (digits.length > 2) return [digits.substring(0, 2), digits.substring(2, 6)].join("/").trim();
|
|
2576
|
+
return digits;
|
|
2577
|
+
};
|
|
2749
2578
|
|
|
2750
|
-
|
|
2751
|
-
while (index < arrayLength) deletePropertyOrThrow(array, index++);
|
|
2579
|
+
const isString = x => typeof x === "string";
|
|
2752
2580
|
|
|
2753
|
-
|
|
2581
|
+
const getRateRequiresAcknowledgement = serviceCode => {
|
|
2582
|
+
switch (serviceCode) {
|
|
2583
|
+
case "usps_media_mail":
|
|
2584
|
+
return true;
|
|
2585
|
+
default:
|
|
2586
|
+
return false;
|
|
2754
2587
|
}
|
|
2755
|
-
}
|
|
2588
|
+
};
|
|
2589
|
+
const getTotalRateAmount = (rateCosts = {}) => calculateTotal(...Object.values(rateCosts));
|
|
2590
|
+
|
|
2591
|
+
// Declaring these flags to allow shorthand object syntax, i.e. { flagName } instead of { flagName: true }
|
|
2592
|
+
const hasEuCustomsRules = true,
|
|
2593
|
+
hasProvinces = true,
|
|
2594
|
+
isMilitary = true,
|
|
2595
|
+
// United States territories that ship domestic but require customs
|
|
2596
|
+
// https://blog.stamps.com/2015/09/23/how-to-ship-packages-to-u-s-territories/
|
|
2597
|
+
isUnitedStatesTerritory$1 = true,
|
|
2598
|
+
supportsByoa = true;
|
|
2599
|
+
class Country {
|
|
2600
|
+
constructor(name, code, rules = {}) {
|
|
2601
|
+
var _a, _b, _c, _d;
|
|
2602
|
+
this.name = name;
|
|
2603
|
+
this.code = code;
|
|
2604
|
+
this.hasEuCustomsRules = (_a = rules.hasEuCustomsRules) !== null && _a !== void 0 ? _a : false;
|
|
2605
|
+
this.hasProvinces = (_b = rules.hasProvinces) !== null && _b !== void 0 ? _b : false;
|
|
2606
|
+
this.isUnitedStatesTerritory = (_c = rules.isUnitedStatesTerritory) !== null && _c !== void 0 ? _c : false;
|
|
2607
|
+
this.supportsByoa = (_d = rules.supportsByoa) !== null && _d !== void 0 ? _d : false;
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
const countries = [new Country("Afghanistan", "AF"), new Country("Aland Islands", "AX"), new Country("Albania", "AL"), new Country("Algeria", "DZ"), new Country("American Samoa", "AS", {
|
|
2611
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2612
|
+
}), 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", {
|
|
2613
|
+
hasProvinces,
|
|
2614
|
+
supportsByoa
|
|
2615
|
+
}), new Country("Austria", "AT", {
|
|
2616
|
+
hasEuCustomsRules,
|
|
2617
|
+
supportsByoa
|
|
2618
|
+
}), 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", {
|
|
2619
|
+
hasEuCustomsRules,
|
|
2620
|
+
supportsByoa
|
|
2621
|
+
}), 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", {
|
|
2622
|
+
hasProvinces
|
|
2623
|
+
}), new Country("British Indian Ocean Territory", "IO"), new Country("British Virgin Islands", "VG"), new Country("Brunei Darussalam", "BN"), new Country("Bulgaria", "BG", {
|
|
2624
|
+
hasEuCustomsRules,
|
|
2625
|
+
supportsByoa
|
|
2626
|
+
}), new Country("Burkina Faso", "BF"), new Country("Burundi", "BI"), new Country("Canada", "CA", {
|
|
2627
|
+
hasProvinces
|
|
2628
|
+
}), 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", {
|
|
2629
|
+
hasEuCustomsRules,
|
|
2630
|
+
supportsByoa
|
|
2631
|
+
}), new Country("Cuba", "CU"), new Country("Curacao", "CW"), new Country("Cyprus", "CY", {
|
|
2632
|
+
hasEuCustomsRules,
|
|
2633
|
+
supportsByoa
|
|
2634
|
+
}), new Country("Czech Republic", "CZ", {
|
|
2635
|
+
hasEuCustomsRules,
|
|
2636
|
+
supportsByoa
|
|
2637
|
+
}), new Country("Denmark", "DK", {
|
|
2638
|
+
hasEuCustomsRules,
|
|
2639
|
+
supportsByoa
|
|
2640
|
+
}), 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", {
|
|
2641
|
+
hasEuCustomsRules,
|
|
2642
|
+
supportsByoa
|
|
2643
|
+
}), new Country("Ethiopia", "ET"), new Country("Falkland Islands", "FK"), new Country("Faroe Islands", "FO"), new Country("Federated States of Micronesia", "FM", {
|
|
2644
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2645
|
+
}), new Country("Fiji", "FJ"), new Country("Finland", "FI", {
|
|
2646
|
+
hasEuCustomsRules,
|
|
2647
|
+
supportsByoa
|
|
2648
|
+
}), new Country("France", "FR", {
|
|
2649
|
+
hasEuCustomsRules,
|
|
2650
|
+
supportsByoa
|
|
2651
|
+
}), 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", {
|
|
2652
|
+
hasEuCustomsRules,
|
|
2653
|
+
supportsByoa
|
|
2654
|
+
}), new Country("Ghana", "GH"), new Country("Gibraltar", "GI"), new Country("Greece", "GR", {
|
|
2655
|
+
hasEuCustomsRules,
|
|
2656
|
+
supportsByoa
|
|
2657
|
+
}), new Country("Greenland", "GL"), new Country("Grenada", "GD"), new Country("Guadeloupe", "GP"), new Country("Guam", "GU", {
|
|
2658
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2659
|
+
}), 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", {
|
|
2660
|
+
hasEuCustomsRules,
|
|
2661
|
+
supportsByoa
|
|
2662
|
+
}), new Country("Iceland", "IS"), new Country("India", "IN"), new Country("Indonesia", "ID"), new Country("Iran", "IR"), new Country("Iraq", "IQ"), new Country("Ireland", "IE", {
|
|
2663
|
+
hasEuCustomsRules,
|
|
2664
|
+
supportsByoa
|
|
2665
|
+
}), new Country("Isle of Man", "IM"), new Country("Israel", "IL"), new Country("Italy", "IT", {
|
|
2666
|
+
hasEuCustomsRules,
|
|
2667
|
+
supportsByoa
|
|
2668
|
+
}), new Country("Ivory Coast", "CI"), new Country("Jamaica", "JM"), new Country("Japan", "JP", {
|
|
2669
|
+
hasProvinces
|
|
2670
|
+
}), 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", {
|
|
2671
|
+
hasEuCustomsRules,
|
|
2672
|
+
supportsByoa
|
|
2673
|
+
}), new Country("Lebanon", "LB"), new Country("Lesotho", "LS"), new Country("Liberia", "LR"), new Country("Libya", "LY"), new Country("Liechtenstein", "LI"), new Country("Lithuania", "LT", {
|
|
2674
|
+
hasEuCustomsRules,
|
|
2675
|
+
supportsByoa
|
|
2676
|
+
}), new Country("Luxembourg", "LU", {
|
|
2677
|
+
hasEuCustomsRules,
|
|
2678
|
+
supportsByoa
|
|
2679
|
+
}), 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", {
|
|
2680
|
+
hasEuCustomsRules,
|
|
2681
|
+
supportsByoa
|
|
2682
|
+
}), new Country("Marshall Islands", "MH", {
|
|
2683
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2684
|
+
}), new Country("Martinique", "MQ"), new Country("Mauritania", "MR"), new Country("Mauritius0", "MU"), new Country("Mayotte", "YT"), new Country("Mexico", "MX", {
|
|
2685
|
+
supportsByoa
|
|
2686
|
+
}), 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", {
|
|
2687
|
+
hasEuCustomsRules,
|
|
2688
|
+
supportsByoa
|
|
2689
|
+
}), new Country("Netherlands Antilles", "AN"), new Country("New Caledonia", "NC"), new Country("New Zealand", "NZ", {
|
|
2690
|
+
supportsByoa
|
|
2691
|
+
}), 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", {
|
|
2692
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2693
|
+
}), new Country("Norway", "NO", {
|
|
2694
|
+
hasEuCustomsRules
|
|
2695
|
+
}), new Country("Oman", "OM"), new Country("Pakistan", "PK"), new Country("Palau", "PW", {
|
|
2696
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2697
|
+
}), 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", {
|
|
2698
|
+
hasEuCustomsRules
|
|
2699
|
+
}), new Country("Portugal", "PT", {
|
|
2700
|
+
hasEuCustomsRules,
|
|
2701
|
+
supportsByoa
|
|
2702
|
+
}),
|
|
2703
|
+
// TODO - Puerto Rico is a US territory but there are some funky rules with USPS that need to be addressed
|
|
2704
|
+
new Country("Puerto Rico", "PR", {
|
|
2705
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1,
|
|
2706
|
+
supportsByoa
|
|
2707
|
+
}), new Country("Qatar", "QA"), new Country("Reunion", "RE"), new Country("Romania", "RO", {
|
|
2708
|
+
hasEuCustomsRules,
|
|
2709
|
+
supportsByoa
|
|
2710
|
+
}), 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", {
|
|
2711
|
+
hasEuCustomsRules,
|
|
2712
|
+
supportsByoa
|
|
2713
|
+
}), new Country("Slovenia", "SI", {
|
|
2714
|
+
hasEuCustomsRules,
|
|
2715
|
+
supportsByoa
|
|
2716
|
+
}), 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", {
|
|
2717
|
+
hasEuCustomsRules,
|
|
2718
|
+
supportsByoa
|
|
2719
|
+
}), 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", {
|
|
2720
|
+
hasEuCustomsRules,
|
|
2721
|
+
supportsByoa
|
|
2722
|
+
}), new Country("Switzerland", "CH", {
|
|
2723
|
+
hasEuCustomsRules
|
|
2724
|
+
}), 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", {
|
|
2725
|
+
supportsByoa
|
|
2726
|
+
}), new Country("United States Virgin Islands", "VI", {
|
|
2727
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2728
|
+
}), new Country("U.S. Minor Outlying Islands", "UM", {
|
|
2729
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2730
|
+
}), new Country("United States of America", "US", {
|
|
2731
|
+
hasProvinces,
|
|
2732
|
+
supportsByoa
|
|
2733
|
+
}), 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")];
|
|
2734
|
+
const countryCodes = countries.map(c => c.code);
|
|
2735
|
+
const euCountryCodes = countries.filter(c => c.hasEuCustomsRules).map(c => c.code);
|
|
2736
|
+
// #endregion
|
|
2737
|
+
// #region [ rgba(0,0,0,0) ] Postal Codes
|
|
2738
|
+
const postalCodeRegex$3 = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
|
|
2739
|
+
class UsState {
|
|
2740
|
+
constructor(name, code, rules = {}) {
|
|
2741
|
+
var _a, _b;
|
|
2742
|
+
this.name = name;
|
|
2743
|
+
this.code = code;
|
|
2744
|
+
this.isMilitary = (_a = rules.isMilitary) !== null && _a !== void 0 ? _a : false;
|
|
2745
|
+
this.isUnitedStatesTerritory = (_b = rules.isUnitedStatesTerritory) !== null && _b !== void 0 ? _b : false;
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2748
|
+
const usStates = [new UsState("Alabama", "AL"), new UsState("Alaska", "AK"), new UsState("American Samoa", "AS", {
|
|
2749
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2750
|
+
}), new UsState("Arizona", "AZ"), new UsState("Arkansas", "AR"), new UsState("Armed Forces Americas", "AA", {
|
|
2751
|
+
isMilitary
|
|
2752
|
+
}), new UsState("Armed Forces Europe", "AE", {
|
|
2753
|
+
isMilitary
|
|
2754
|
+
}), new UsState("Armed Forces Pacific", "AP", {
|
|
2755
|
+
isMilitary
|
|
2756
|
+
}), 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", {
|
|
2757
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2758
|
+
}), 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", {
|
|
2759
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2760
|
+
}), 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", {
|
|
2761
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2762
|
+
}), 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", {
|
|
2763
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2764
|
+
}), new UsState("U.S. Minor Outlying Islands", "UM", {
|
|
2765
|
+
isUnitedStatesTerritory: isUnitedStatesTerritory$1
|
|
2766
|
+
})];
|
|
2767
|
+
const usStateCodes = usStates.map(item => item.code);
|
|
2768
|
+
class UsaCity {
|
|
2769
|
+
constructor(name, code, rules = {}) {
|
|
2770
|
+
var _a;
|
|
2771
|
+
this.name = name;
|
|
2772
|
+
this.code = code;
|
|
2773
|
+
this.isMilitary = (_a = rules.isMilitary) !== null && _a !== void 0 ? _a : false;
|
|
2774
|
+
}
|
|
2775
|
+
}
|
|
2776
|
+
const usCities = [new UsaCity("Army Post Office", "APO", {
|
|
2777
|
+
isMilitary
|
|
2778
|
+
}), new UsaCity("Diplomatic Post Office", "DPO", {
|
|
2779
|
+
isMilitary
|
|
2780
|
+
}), new UsaCity("Fleet Post Office", "FPO", {
|
|
2781
|
+
isMilitary
|
|
2782
|
+
})];
|
|
2783
|
+
// #endregion
|
|
2756
2784
|
|
|
2757
2785
|
/**
|
|
2758
2786
|
* @category Utilities
|
|
2759
2787
|
*/
|
|
2760
|
-
const
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
}
|
|
2788
|
+
const isDomesticAddress = address => {
|
|
2789
|
+
var _a;
|
|
2790
|
+
return address.countryCode === "US" || ((_a = countries.find(c => c.code === address.countryCode)) === null || _a === void 0 ? void 0 : _a.isUnitedStatesTerritory);
|
|
2791
|
+
};
|
|
2764
2792
|
/**
|
|
2765
2793
|
* @category Utilities
|
|
2766
2794
|
*/
|
|
2767
|
-
const
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
}
|
|
2795
|
+
const isMilitaryAddress = address => {
|
|
2796
|
+
var _a, _b;
|
|
2797
|
+
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));
|
|
2798
|
+
};
|
|
2771
2799
|
/**
|
|
2772
2800
|
* @category Utilities
|
|
2773
2801
|
*/
|
|
2774
|
-
const
|
|
2802
|
+
const isUnitedStatesTerritory = address => {
|
|
2803
|
+
var _a, _b;
|
|
2804
|
+
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));
|
|
2805
|
+
};
|
|
2806
|
+
const PO_BOX_REGEX =
|
|
2807
|
+
// eslint-disable-next-line no-useless-escape
|
|
2808
|
+
/^(((p[\s\.\'\,]?[o\s][\.\'\,]?)\s?)|(post\s?office\s?))((box|bin|bo|b\.?)?\s?(num|number|#)?\s?\d+)/i;
|
|
2809
|
+
/**
|
|
2810
|
+
* @category Utilities
|
|
2811
|
+
*/
|
|
2812
|
+
const isPoBox = addressLine => PO_BOX_REGEX.test(addressLine);
|
|
2813
|
+
/**
|
|
2814
|
+
* @category Utilities
|
|
2815
|
+
*/
|
|
2816
|
+
const isPoBoxAddress = address => !!(isPoBox(address.addressLine1) || address.addressLine2 && isPoBox(address.addressLine2));
|
|
2775
2817
|
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2818
|
+
var $$g = _export;
|
|
2819
|
+
var $includes = arrayIncludes.includes;
|
|
2820
|
+
var fails$8 = fails$r;
|
|
2821
|
+
var addToUnscopables$2 = addToUnscopables$4;
|
|
2822
|
+
|
|
2823
|
+
// FF99+ bug
|
|
2824
|
+
var BROKEN_ON_SPARSE = fails$8(function () {
|
|
2825
|
+
return !Array(1).includes();
|
|
2826
|
+
});
|
|
2827
|
+
|
|
2828
|
+
// `Array.prototype.includes` method
|
|
2829
|
+
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
2830
|
+
$$g({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
|
|
2831
|
+
includes: function includes(el /* , fromIndex = 0 */) {
|
|
2832
|
+
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
2783
2833
|
}
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2834
|
+
});
|
|
2835
|
+
|
|
2836
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
2837
|
+
addToUnscopables$2('includes');
|
|
2838
|
+
|
|
2839
|
+
const USPS_CARRIER_CODES = ["usps", "stamps_com"];
|
|
2840
|
+
const isUspsCarrier = carrierCode => USPS_CARRIER_CODES.includes(carrierCode);
|
|
2841
|
+
|
|
2842
|
+
function convertDimensions(dimensions, {
|
|
2843
|
+
allowAllZeroes
|
|
2844
|
+
} = {}) {
|
|
2845
|
+
if ("unit" in dimensions) {
|
|
2846
|
+
const dims = __rest(dimensions, ["unit"]);
|
|
2847
|
+
const hasAllZeroes = Object.values(dims).every(d => d === 0);
|
|
2848
|
+
return hasAllZeroes && !allowAllZeroes ? undefined : dims;
|
|
2849
|
+
}
|
|
2850
|
+
return Object.assign(Object.assign({}, dimensions), {
|
|
2851
|
+
unit: "inch"
|
|
2852
|
+
});
|
|
2788
2853
|
}
|
|
2854
|
+
|
|
2789
2855
|
/**
|
|
2790
2856
|
* @category Utilities
|
|
2791
2857
|
*/
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2858
|
+
const getCustomsFromSalesOrder = (salesOrder, warehouse) => ({
|
|
2859
|
+
contents: "merchandise",
|
|
2860
|
+
customsItems: salesOrder.salesOrderItems.filter(item => item.lineItemDetails.name.length > 0).map(item => ({
|
|
2861
|
+
countryOfOrigin: warehouse.originAddress.countryCode,
|
|
2862
|
+
description: item.lineItemDetails.name,
|
|
2863
|
+
quantity: item.quantity,
|
|
2864
|
+
value: item.priceSummary.unitPrice.amount
|
|
2865
|
+
})),
|
|
2866
|
+
nonDelivery: "return_to_sender"
|
|
2867
|
+
});
|
|
2868
|
+
/**
|
|
2869
|
+
* @category Utilities
|
|
2870
|
+
*/
|
|
2871
|
+
const getIsCustomsRequiredForSalesOrder = ({
|
|
2872
|
+
shipTo
|
|
2873
|
+
}, {
|
|
2874
|
+
originAddress
|
|
2875
|
+
}) => 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);
|
|
2876
|
+
/**
|
|
2877
|
+
* @category Utilities
|
|
2878
|
+
*/
|
|
2879
|
+
const getRequestedServices = salesOrder => {
|
|
2880
|
+
var _a;
|
|
2881
|
+
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)));
|
|
2882
|
+
};
|
|
2883
|
+
const getSalesOrderItemsFromSalesOrderOrShipment = ({
|
|
2884
|
+
salesOrder,
|
|
2885
|
+
shipment
|
|
2886
|
+
}) => {
|
|
2887
|
+
var _a, _b;
|
|
2888
|
+
return (_b = (_a = salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.salesOrderItems.map(item => ({
|
|
2889
|
+
detail: `SKU ${item.lineItemDetails.sku}`,
|
|
2890
|
+
name: item.lineItemDetails.name,
|
|
2891
|
+
quantity: item.quantity,
|
|
2892
|
+
subDetail: item.requestedShippingOptions.shippingService,
|
|
2893
|
+
subDetailValue: item.priceSummary.estimatedShipping,
|
|
2894
|
+
totalValue: item.priceSummary.total,
|
|
2895
|
+
value: item.priceSummary.unitPrice
|
|
2896
|
+
}))) !== null && _a !== void 0 ? _a : shipment === null || shipment === void 0 ? void 0 : shipment.items.map((item, i) => ({
|
|
2897
|
+
detail: `SKU ${item.sku}`,
|
|
2898
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || `ITEM ${i}`,
|
|
2899
|
+
quantity: item.quantity
|
|
2900
|
+
}))) !== null && _b !== void 0 ? _b : [];
|
|
2901
|
+
};
|
|
2804
2902
|
|
|
2805
|
-
var
|
|
2806
|
-
var classof$4 = classofRaw$2;
|
|
2807
|
-
var wellKnownSymbol$a = wellKnownSymbol$j;
|
|
2903
|
+
var tryToString$3 = tryToString$5;
|
|
2808
2904
|
|
|
2809
|
-
var
|
|
2905
|
+
var $TypeError$8 = TypeError;
|
|
2810
2906
|
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
var isRegexp = function (it) {
|
|
2814
|
-
var isRegExp;
|
|
2815
|
-
return isObject$3(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$4(it) == 'RegExp');
|
|
2907
|
+
var deletePropertyOrThrow$1 = function (O, P) {
|
|
2908
|
+
if (!delete O[P]) throw $TypeError$8('Cannot delete property ' + tryToString$3(P) + ' of ' + tryToString$3(O));
|
|
2816
2909
|
};
|
|
2817
2910
|
|
|
2818
|
-
var
|
|
2911
|
+
var toPropertyKey = toPropertyKey$3;
|
|
2912
|
+
var definePropertyModule$1 = objectDefineProperty;
|
|
2913
|
+
var createPropertyDescriptor = createPropertyDescriptor$4;
|
|
2819
2914
|
|
|
2820
|
-
var $
|
|
2915
|
+
var createProperty$1 = function (object, key, value) {
|
|
2916
|
+
var propertyKey = toPropertyKey(key);
|
|
2917
|
+
if (propertyKey in object) definePropertyModule$1.f(object, propertyKey, createPropertyDescriptor(0, value));
|
|
2918
|
+
else object[propertyKey] = value;
|
|
2919
|
+
};
|
|
2821
2920
|
|
|
2822
|
-
var
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2921
|
+
var toAbsoluteIndex = toAbsoluteIndex$2;
|
|
2922
|
+
var lengthOfArrayLike$5 = lengthOfArrayLike$8;
|
|
2923
|
+
var createProperty = createProperty$1;
|
|
2924
|
+
|
|
2925
|
+
var $Array$1 = Array;
|
|
2926
|
+
var max = Math.max;
|
|
2927
|
+
|
|
2928
|
+
var arraySliceSimple = function (O, start, end) {
|
|
2929
|
+
var length = lengthOfArrayLike$5(O);
|
|
2930
|
+
var k = toAbsoluteIndex(start, length);
|
|
2931
|
+
var fin = toAbsoluteIndex(end === undefined ? length : end, length);
|
|
2932
|
+
var result = $Array$1(max(fin - k, 0));
|
|
2933
|
+
for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
|
|
2934
|
+
result.length = n;
|
|
2935
|
+
return result;
|
|
2826
2936
|
};
|
|
2827
2937
|
|
|
2828
|
-
var
|
|
2938
|
+
var arraySlice$2 = arraySliceSimple;
|
|
2829
2939
|
|
|
2830
|
-
var
|
|
2940
|
+
var floor$1 = Math.floor;
|
|
2831
2941
|
|
|
2832
|
-
var
|
|
2833
|
-
var
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
} return false;
|
|
2942
|
+
var mergeSort = function (array, comparefn) {
|
|
2943
|
+
var length = array.length;
|
|
2944
|
+
var middle = floor$1(length / 2);
|
|
2945
|
+
return length < 8 ? insertionSort(array, comparefn) : merge(
|
|
2946
|
+
array,
|
|
2947
|
+
mergeSort(arraySlice$2(array, 0, middle), comparefn),
|
|
2948
|
+
mergeSort(arraySlice$2(array, middle), comparefn),
|
|
2949
|
+
comparefn
|
|
2950
|
+
);
|
|
2842
2951
|
};
|
|
2843
2952
|
|
|
2844
|
-
var
|
|
2845
|
-
var
|
|
2846
|
-
var
|
|
2847
|
-
var
|
|
2848
|
-
var toString$8 = toString$c;
|
|
2849
|
-
var correctIsRegExpLogic$1 = correctIsRegexpLogic;
|
|
2953
|
+
var insertionSort = function (array, comparefn) {
|
|
2954
|
+
var length = array.length;
|
|
2955
|
+
var i = 1;
|
|
2956
|
+
var element, j;
|
|
2850
2957
|
|
|
2851
|
-
|
|
2958
|
+
while (i < length) {
|
|
2959
|
+
j = i;
|
|
2960
|
+
element = array[i];
|
|
2961
|
+
while (j && comparefn(array[j - 1], element) > 0) {
|
|
2962
|
+
array[j] = array[--j];
|
|
2963
|
+
}
|
|
2964
|
+
if (j !== i++) array[j] = element;
|
|
2965
|
+
} return array;
|
|
2966
|
+
};
|
|
2852
2967
|
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
toString$8(requireObjectCoercible$5(this)),
|
|
2859
|
-
toString$8(notARegExp$1(searchString)),
|
|
2860
|
-
arguments.length > 1 ? arguments[1] : undefined
|
|
2861
|
-
);
|
|
2862
|
-
}
|
|
2863
|
-
});
|
|
2968
|
+
var merge = function (array, left, right, comparefn) {
|
|
2969
|
+
var llength = left.length;
|
|
2970
|
+
var rlength = right.length;
|
|
2971
|
+
var lindex = 0;
|
|
2972
|
+
var rindex = 0;
|
|
2864
2973
|
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
return
|
|
2974
|
+
while (lindex < llength || rindex < rlength) {
|
|
2975
|
+
array[lindex + rindex] = (lindex < llength && rindex < rlength)
|
|
2976
|
+
? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
|
|
2977
|
+
: lindex < llength ? left[lindex++] : right[rindex++];
|
|
2978
|
+
} return array;
|
|
2870
2979
|
};
|
|
2871
2980
|
|
|
2872
|
-
|
|
2981
|
+
var arraySort = mergeSort;
|
|
2873
2982
|
|
|
2874
|
-
|
|
2875
|
-
* Creates a Record of Emotion styles.
|
|
2876
|
-
*
|
|
2877
|
-
* Values may be any variant that a `css` prop can accept (a CSSObject, SerializedStyles, a FunctionInterpolation with theme, etc).
|
|
2878
|
-
*
|
|
2879
|
-
* Eliminates the need to explicitly type styles (while remaining fully typed w/ autocomplete).
|
|
2880
|
-
*
|
|
2881
|
-
* @example
|
|
2882
|
-
* ```
|
|
2883
|
-
* const styles = createStyles({
|
|
2884
|
-
* container: (theme) => ({ backgroundColor: theme.colors.primary }),
|
|
2885
|
-
* icon: { color: 'red' },
|
|
2886
|
-
* });
|
|
2887
|
-
* ```
|
|
2888
|
-
*/
|
|
2889
|
-
const createStyles = styles => styles;
|
|
2983
|
+
var userAgent$4 = engineUserAgent;
|
|
2890
2984
|
|
|
2891
|
-
|
|
2892
|
-
const meta = __rest(error, ["code", "message", "path"]);
|
|
2893
|
-
return JSON.stringify(Object.assign({
|
|
2894
|
-
message: translationKey
|
|
2895
|
-
}, meta));
|
|
2896
|
-
};
|
|
2897
|
-
/**
|
|
2898
|
-
* @category Utilities
|
|
2899
|
-
*/
|
|
2900
|
-
const errorMap = (issue, ctx) => {
|
|
2901
|
-
let messageCode;
|
|
2902
|
-
// TODO - Fill in the rest of the codes (positive, max, etc)
|
|
2903
|
-
switch (issue.code) {
|
|
2904
|
-
// Invalid Type
|
|
2905
|
-
case zod.z.ZodIssueCode.invalid_type:
|
|
2906
|
-
switch (issue.received) {
|
|
2907
|
-
case "null":
|
|
2908
|
-
case "undefined":
|
|
2909
|
-
messageCode = "schemaErrors.required";
|
|
2910
|
-
break;
|
|
2911
|
-
}
|
|
2912
|
-
break;
|
|
2913
|
-
case zod.z.ZodIssueCode.invalid_string:
|
|
2914
|
-
messageCode = "schemaErrors.invalidString";
|
|
2915
|
-
break;
|
|
2916
|
-
case zod.z.ZodIssueCode.too_small:
|
|
2917
|
-
switch (issue.type) {
|
|
2918
|
-
case "number":
|
|
2919
|
-
if (issue.minimum === 0) {
|
|
2920
|
-
messageCode = issue.inclusive ? "schemaErrors.nonnegative" : "schemaErrors.positive";
|
|
2921
|
-
}
|
|
2922
|
-
break;
|
|
2923
|
-
case "string":
|
|
2924
|
-
messageCode = buildError("schemaErrors.tooFewCharacters", issue);
|
|
2925
|
-
break;
|
|
2926
|
-
}
|
|
2927
|
-
break;
|
|
2928
|
-
case zod.z.ZodIssueCode.too_big:
|
|
2929
|
-
switch (issue.type) {
|
|
2930
|
-
case "string":
|
|
2931
|
-
messageCode = buildError("schemaErrors.tooManyCharacters", issue);
|
|
2932
|
-
break;
|
|
2933
|
-
}
|
|
2934
|
-
break;
|
|
2935
|
-
}
|
|
2936
|
-
return {
|
|
2937
|
-
message: messageCode !== null && messageCode !== void 0 ? messageCode : ctx.defaultError
|
|
2938
|
-
};
|
|
2939
|
-
};
|
|
2940
|
-
/**
|
|
2941
|
-
* @category Utilities
|
|
2942
|
-
*/
|
|
2943
|
-
const validationResolver = schema => (values, context, resolverOptions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2944
|
-
const getValidationResult = () => zod$1.zodResolver(schema, {
|
|
2945
|
-
errorMap
|
|
2946
|
-
})(values, undefined, resolverOptions);
|
|
2947
|
-
const validationResult = yield formLogger.isSubmitting ? formLogger.log(values, getValidationResult) : getValidationResult();
|
|
2948
|
-
return validationResult;
|
|
2949
|
-
});
|
|
2985
|
+
var firefox = userAgent$4.match(/firefox\/(\d+)/i);
|
|
2950
2986
|
|
|
2951
|
-
|
|
2952
|
-
var {
|
|
2953
|
-
children,
|
|
2954
|
-
justify,
|
|
2955
|
-
toolbar = false
|
|
2956
|
-
} = _a,
|
|
2957
|
-
props = __rest(_a, ["children", "justify", "toolbar"]);
|
|
2958
|
-
const styles = {
|
|
2959
|
-
group: theme => Object.assign({
|
|
2960
|
-
alignItems: "center",
|
|
2961
|
-
display: "flex",
|
|
2962
|
-
justifyContent: justify,
|
|
2963
|
-
width: "100%"
|
|
2964
|
-
}, toolbar ? {
|
|
2965
|
-
"& > button": {
|
|
2966
|
-
"&:not(:first-of-type)": {
|
|
2967
|
-
borderBottomLeftRadius: 0,
|
|
2968
|
-
borderTopLeftRadius: 0
|
|
2969
|
-
},
|
|
2970
|
-
"&:not(:last-child)": {
|
|
2971
|
-
borderBottomRightRadius: 0,
|
|
2972
|
-
borderTopRightRadius: 0
|
|
2973
|
-
}
|
|
2974
|
-
}
|
|
2975
|
-
} : {
|
|
2976
|
-
gap: theme.spacing(2)
|
|
2977
|
-
})
|
|
2978
|
-
};
|
|
2979
|
-
return jsxRuntime.jsx("div", Object.assign({}, props, {
|
|
2980
|
-
css: styles.group,
|
|
2981
|
-
role: "group"
|
|
2982
|
-
}, {
|
|
2983
|
-
children: children
|
|
2984
|
-
}));
|
|
2985
|
-
};
|
|
2987
|
+
var engineFfVersion = !!firefox && +firefox[1];
|
|
2986
2988
|
|
|
2987
|
-
var
|
|
2989
|
+
var UA = engineUserAgent;
|
|
2988
2990
|
|
|
2989
|
-
var
|
|
2990
|
-
var apply$2 = FunctionPrototype.apply;
|
|
2991
|
-
var call$b = FunctionPrototype.call;
|
|
2991
|
+
var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
|
|
2992
2992
|
|
|
2993
|
-
|
|
2994
|
-
var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$b.bind(apply$2) : function () {
|
|
2995
|
-
return call$b.apply(apply$2, arguments);
|
|
2996
|
-
});
|
|
2993
|
+
var userAgent$3 = engineUserAgent;
|
|
2997
2994
|
|
|
2998
|
-
var
|
|
2999
|
-
var uncurryThis$d = functionUncurryThis;
|
|
2995
|
+
var webkit = userAgent$3.match(/AppleWebKit\/(\d+)\./);
|
|
3000
2996
|
|
|
3001
|
-
var
|
|
3002
|
-
// Nashorn bug:
|
|
3003
|
-
// https://github.com/zloirock/core-js/issues/1128
|
|
3004
|
-
// https://github.com/zloirock/core-js/issues/1130
|
|
3005
|
-
if (classofRaw(fn) === 'Function') return uncurryThis$d(fn);
|
|
3006
|
-
};
|
|
2997
|
+
var engineWebkitVersion = !!webkit && +webkit[1];
|
|
3007
2998
|
|
|
3008
|
-
|
|
2999
|
+
var $$f = _export;
|
|
3000
|
+
var uncurryThis$a = functionUncurryThis;
|
|
3001
|
+
var aCallable$7 = aCallable$a;
|
|
3002
|
+
var toObject$2 = toObject$8;
|
|
3003
|
+
var lengthOfArrayLike$4 = lengthOfArrayLike$8;
|
|
3004
|
+
var deletePropertyOrThrow = deletePropertyOrThrow$1;
|
|
3005
|
+
var toString$7 = toString$c;
|
|
3006
|
+
var fails$7 = fails$r;
|
|
3007
|
+
var internalSort = arraySort;
|
|
3008
|
+
var arrayMethodIsStrict = arrayMethodIsStrict$2;
|
|
3009
|
+
var FF = engineFfVersion;
|
|
3010
|
+
var IE_OR_EDGE = engineIsIeOrEdge;
|
|
3011
|
+
var V8 = engineV8Version;
|
|
3012
|
+
var WEBKIT = engineWebkitVersion;
|
|
3009
3013
|
|
|
3010
|
-
var
|
|
3011
|
-
var
|
|
3012
|
-
var
|
|
3013
|
-
var fails$8 = fails$r;
|
|
3014
|
-
var wellKnownSymbol$8 = wellKnownSymbol$j;
|
|
3015
|
-
var createNonEnumerableProperty = createNonEnumerableProperty$5;
|
|
3014
|
+
var test = [];
|
|
3015
|
+
var nativeSort = uncurryThis$a(test.sort);
|
|
3016
|
+
var push = uncurryThis$a(test.push);
|
|
3016
3017
|
|
|
3017
|
-
|
|
3018
|
-
var
|
|
3018
|
+
// IE8-
|
|
3019
|
+
var FAILS_ON_UNDEFINED = fails$7(function () {
|
|
3020
|
+
test.sort(undefined);
|
|
3021
|
+
});
|
|
3022
|
+
// V8 bug
|
|
3023
|
+
var FAILS_ON_NULL = fails$7(function () {
|
|
3024
|
+
test.sort(null);
|
|
3025
|
+
});
|
|
3026
|
+
// Old WebKit
|
|
3027
|
+
var STRICT_METHOD = arrayMethodIsStrict('sort');
|
|
3019
3028
|
|
|
3020
|
-
var
|
|
3021
|
-
|
|
3029
|
+
var STABLE_SORT = !fails$7(function () {
|
|
3030
|
+
// feature detection can be too slow, so check engines versions
|
|
3031
|
+
if (V8) return V8 < 70;
|
|
3032
|
+
if (FF && FF > 3) return;
|
|
3033
|
+
if (IE_OR_EDGE) return true;
|
|
3034
|
+
if (WEBKIT) return WEBKIT < 603;
|
|
3022
3035
|
|
|
3023
|
-
var
|
|
3024
|
-
|
|
3025
|
-
var O = {};
|
|
3026
|
-
O[SYMBOL] = function () { return 7; };
|
|
3027
|
-
return ''[KEY](O) != 7;
|
|
3028
|
-
});
|
|
3036
|
+
var result = '';
|
|
3037
|
+
var code, chr, value, index;
|
|
3029
3038
|
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
var re = /a/;
|
|
3039
|
+
// generate an array with more 512 elements (Chakra and old V8 fails only in this case)
|
|
3040
|
+
for (code = 65; code < 76; code++) {
|
|
3041
|
+
chr = String.fromCharCode(code);
|
|
3034
3042
|
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
re = {};
|
|
3040
|
-
// RegExp[@@split] doesn't call the regex's exec method, but first creates
|
|
3041
|
-
// a new one. We need to return the patched regex when creating the new one.
|
|
3042
|
-
re.constructor = {};
|
|
3043
|
-
re.constructor[SPECIES$4] = function () { return re; };
|
|
3044
|
-
re.flags = '';
|
|
3045
|
-
re[SYMBOL] = /./[SYMBOL];
|
|
3043
|
+
switch (code) {
|
|
3044
|
+
case 66: case 69: case 70: case 72: value = 3; break;
|
|
3045
|
+
case 68: case 71: value = 4; break;
|
|
3046
|
+
default: value = 2;
|
|
3046
3047
|
}
|
|
3047
3048
|
|
|
3048
|
-
|
|
3049
|
+
for (index = 0; index < 47; index++) {
|
|
3050
|
+
test.push({ k: chr + index, v: value });
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3049
3053
|
|
|
3050
|
-
|
|
3051
|
-
return !execCalled;
|
|
3052
|
-
});
|
|
3054
|
+
test.sort(function (a, b) { return b.v - a.v; });
|
|
3053
3055
|
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3056
|
+
for (index = 0; index < test.length; index++) {
|
|
3057
|
+
chr = test[index].k.charAt(0);
|
|
3058
|
+
if (result.charAt(result.length - 1) !== chr) result += chr;
|
|
3059
|
+
}
|
|
3060
|
+
|
|
3061
|
+
return result !== 'DGBEFHACIJK';
|
|
3062
|
+
});
|
|
3063
|
+
|
|
3064
|
+
var FORCED$3 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
|
|
3065
|
+
|
|
3066
|
+
var getSortCompare = function (comparefn) {
|
|
3067
|
+
return function (x, y) {
|
|
3068
|
+
if (y === undefined) return -1;
|
|
3069
|
+
if (x === undefined) return 1;
|
|
3070
|
+
if (comparefn !== undefined) return +comparefn(x, y) || 0;
|
|
3071
|
+
return toString$7(x) > toString$7(y) ? 1 : -1;
|
|
3072
|
+
};
|
|
3073
|
+
};
|
|
3074
|
+
|
|
3075
|
+
// `Array.prototype.sort` method
|
|
3076
|
+
// https://tc39.es/ecma262/#sec-array.prototype.sort
|
|
3077
|
+
$$f({ target: 'Array', proto: true, forced: FORCED$3 }, {
|
|
3078
|
+
sort: function sort(comparefn) {
|
|
3079
|
+
if (comparefn !== undefined) aCallable$7(comparefn);
|
|
3080
|
+
|
|
3081
|
+
var array = toObject$2(this);
|
|
3082
|
+
|
|
3083
|
+
if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
|
|
3084
|
+
|
|
3085
|
+
var items = [];
|
|
3086
|
+
var arrayLength = lengthOfArrayLike$4(array);
|
|
3087
|
+
var itemsLength, index;
|
|
3074
3088
|
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3089
|
+
for (index = 0; index < arrayLength; index++) {
|
|
3090
|
+
if (index in array) push(items, array[index]);
|
|
3091
|
+
}
|
|
3078
3092
|
|
|
3079
|
-
|
|
3080
|
-
};
|
|
3093
|
+
internalSort(items, getSortCompare(comparefn));
|
|
3081
3094
|
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
var toString$7 = toString$c;
|
|
3085
|
-
var requireObjectCoercible$4 = requireObjectCoercible$9;
|
|
3095
|
+
itemsLength = lengthOfArrayLike$4(items);
|
|
3096
|
+
index = 0;
|
|
3086
3097
|
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
var stringSlice$5 = uncurryThis$b(''.slice);
|
|
3098
|
+
while (index < itemsLength) array[index] = items[index++];
|
|
3099
|
+
while (index < arrayLength) deletePropertyOrThrow(array, index++);
|
|
3090
3100
|
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3101
|
+
return array;
|
|
3102
|
+
}
|
|
3103
|
+
});
|
|
3104
|
+
|
|
3105
|
+
/**
|
|
3106
|
+
* @category Utilities
|
|
3107
|
+
*/
|
|
3108
|
+
const getIsInternationalShipment = ({
|
|
3109
|
+
shipFrom,
|
|
3110
|
+
shipTo
|
|
3111
|
+
}) => (shipFrom === null || shipFrom === void 0 ? void 0 : shipFrom.countryCode) !== (shipTo === null || shipTo === void 0 ? void 0 : shipTo.countryCode);
|
|
3112
|
+
/**
|
|
3113
|
+
* @category Utilities
|
|
3114
|
+
*/
|
|
3115
|
+
const getIsCustomsRequiredForShipment = ({
|
|
3116
|
+
shipFrom,
|
|
3117
|
+
shipTo
|
|
3118
|
+
}) => 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);
|
|
3119
|
+
/**
|
|
3120
|
+
* @category Utilities
|
|
3121
|
+
*/
|
|
3122
|
+
const getPendingShipment = shipments => shipments === null || shipments === void 0 ? void 0 : shipments.filter(s => s.shipmentStatus === "pending").sort(sortByCreationDate)[0];
|
|
3123
|
+
|
|
3124
|
+
function convertWeight(weight) {
|
|
3125
|
+
if ("value" in weight) {
|
|
3126
|
+
const valueAsLbs = weight.value / 16;
|
|
3127
|
+
return {
|
|
3128
|
+
fractional: (valueAsLbs - Math.floor(valueAsLbs)) * 16,
|
|
3129
|
+
whole: Math.floor(valueAsLbs)
|
|
3130
|
+
};
|
|
3131
|
+
}
|
|
3132
|
+
return {
|
|
3133
|
+
unit: "ounce",
|
|
3134
|
+
value: (weight.whole || 0) * 16 + (weight.fractional || 0)
|
|
3107
3135
|
};
|
|
3108
|
-
}
|
|
3136
|
+
}
|
|
3137
|
+
/**
|
|
3138
|
+
* @category Utilities
|
|
3139
|
+
*/
|
|
3140
|
+
function formatFractionalWeight(weight) {
|
|
3141
|
+
if (!weight) return {
|
|
3142
|
+
fractional: 0,
|
|
3143
|
+
whole: 0
|
|
3144
|
+
};
|
|
3145
|
+
const valueAsOz = (weight.whole || 0) * 16 + (weight.fractional || 0);
|
|
3146
|
+
const valueAsLbs = valueAsOz / 16;
|
|
3147
|
+
return {
|
|
3148
|
+
fractional: Math.round((valueAsLbs - Math.floor(valueAsLbs)) * 16 * 100) / 100,
|
|
3149
|
+
whole: Math.floor(valueAsLbs)
|
|
3150
|
+
};
|
|
3151
|
+
}
|
|
3109
3152
|
|
|
3110
|
-
var
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
codeAt: createMethod(false),
|
|
3114
|
-
// `String.prototype.at` method
|
|
3115
|
-
// https://github.com/mathiasbynens/String.prototype.at
|
|
3116
|
-
charAt: createMethod(true)
|
|
3117
|
-
};
|
|
3153
|
+
var isObject$3 = isObject$a;
|
|
3154
|
+
var classof$3 = classofRaw$2;
|
|
3155
|
+
var wellKnownSymbol$8 = wellKnownSymbol$j;
|
|
3118
3156
|
|
|
3119
|
-
var
|
|
3157
|
+
var MATCH$1 = wellKnownSymbol$8('match');
|
|
3120
3158
|
|
|
3121
|
-
// `
|
|
3122
|
-
// https://tc39.es/ecma262/#sec-
|
|
3123
|
-
var
|
|
3124
|
-
|
|
3159
|
+
// `IsRegExp` abstract operation
|
|
3160
|
+
// https://tc39.es/ecma262/#sec-isregexp
|
|
3161
|
+
var isRegexp = function (it) {
|
|
3162
|
+
var isRegExp;
|
|
3163
|
+
return isObject$3(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$3(it) == 'RegExp');
|
|
3125
3164
|
};
|
|
3126
3165
|
|
|
3127
|
-
var
|
|
3128
|
-
var toObject$2 = toObject$8;
|
|
3166
|
+
var isRegExp = isRegexp;
|
|
3129
3167
|
|
|
3130
|
-
var
|
|
3131
|
-
var charAt$1 = uncurryThis$a(''.charAt);
|
|
3132
|
-
var replace$1 = uncurryThis$a(''.replace);
|
|
3133
|
-
var stringSlice$4 = uncurryThis$a(''.slice);
|
|
3134
|
-
var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
|
|
3135
|
-
var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
|
|
3168
|
+
var $TypeError$7 = TypeError;
|
|
3136
3169
|
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
var m = captures.length;
|
|
3142
|
-
var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
|
|
3143
|
-
if (namedCaptures !== undefined) {
|
|
3144
|
-
namedCaptures = toObject$2(namedCaptures);
|
|
3145
|
-
symbols = SUBSTITUTION_SYMBOLS;
|
|
3146
|
-
}
|
|
3147
|
-
return replace$1(replacement, symbols, function (match, ch) {
|
|
3148
|
-
var capture;
|
|
3149
|
-
switch (charAt$1(ch, 0)) {
|
|
3150
|
-
case '$': return '$';
|
|
3151
|
-
case '&': return matched;
|
|
3152
|
-
case '`': return stringSlice$4(str, 0, position);
|
|
3153
|
-
case "'": return stringSlice$4(str, tailPos);
|
|
3154
|
-
case '<':
|
|
3155
|
-
capture = namedCaptures[stringSlice$4(ch, 1, -1)];
|
|
3156
|
-
break;
|
|
3157
|
-
default: // \d\d?
|
|
3158
|
-
var n = +ch;
|
|
3159
|
-
if (n === 0) return match;
|
|
3160
|
-
if (n > m) {
|
|
3161
|
-
var f = floor$1(n / 10);
|
|
3162
|
-
if (f === 0) return match;
|
|
3163
|
-
if (f <= m) return captures[f - 1] === undefined ? charAt$1(ch, 1) : captures[f - 1] + charAt$1(ch, 1);
|
|
3164
|
-
return match;
|
|
3165
|
-
}
|
|
3166
|
-
capture = captures[n - 1];
|
|
3167
|
-
}
|
|
3168
|
-
return capture === undefined ? '' : capture;
|
|
3169
|
-
});
|
|
3170
|
+
var notARegexp = function (it) {
|
|
3171
|
+
if (isRegExp(it)) {
|
|
3172
|
+
throw $TypeError$7("The method doesn't accept regular expressions");
|
|
3173
|
+
} return it;
|
|
3170
3174
|
};
|
|
3171
3175
|
|
|
3172
|
-
var
|
|
3173
|
-
var anObject$8 = anObject$f;
|
|
3174
|
-
var isCallable$8 = isCallable$o;
|
|
3175
|
-
var classof$3 = classofRaw$2;
|
|
3176
|
-
var regexpExec = regexpExec$2;
|
|
3176
|
+
var wellKnownSymbol$7 = wellKnownSymbol$j;
|
|
3177
3177
|
|
|
3178
|
-
var
|
|
3178
|
+
var MATCH = wellKnownSymbol$7('match');
|
|
3179
3179
|
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
throw $TypeError$7('RegExp#exec called on incompatible receiver');
|
|
3180
|
+
var correctIsRegexpLogic = function (METHOD_NAME) {
|
|
3181
|
+
var regexp = /./;
|
|
3182
|
+
try {
|
|
3183
|
+
'/./'[METHOD_NAME](regexp);
|
|
3184
|
+
} catch (error1) {
|
|
3185
|
+
try {
|
|
3186
|
+
regexp[MATCH] = false;
|
|
3187
|
+
return '/./'[METHOD_NAME](regexp);
|
|
3188
|
+
} catch (error2) { /* empty */ }
|
|
3189
|
+
} return false;
|
|
3191
3190
|
};
|
|
3192
3191
|
|
|
3193
|
-
var
|
|
3194
|
-
var call$9 = functionCall;
|
|
3192
|
+
var $$e = _export;
|
|
3195
3193
|
var uncurryThis$9 = functionUncurryThis;
|
|
3196
|
-
var
|
|
3197
|
-
var fails$7 = fails$r;
|
|
3198
|
-
var anObject$7 = anObject$f;
|
|
3199
|
-
var isCallable$7 = isCallable$o;
|
|
3200
|
-
var isNullOrUndefined$3 = isNullOrUndefined$6;
|
|
3201
|
-
var toIntegerOrInfinity$3 = toIntegerOrInfinity$7;
|
|
3202
|
-
var toLength$2 = toLength$4;
|
|
3203
|
-
var toString$6 = toString$c;
|
|
3194
|
+
var notARegExp$1 = notARegexp;
|
|
3204
3195
|
var requireObjectCoercible$3 = requireObjectCoercible$9;
|
|
3205
|
-
var
|
|
3206
|
-
var
|
|
3207
|
-
var getSubstitution = getSubstitution$1;
|
|
3208
|
-
var regExpExec$1 = regexpExecAbstract;
|
|
3209
|
-
var wellKnownSymbol$7 = wellKnownSymbol$j;
|
|
3196
|
+
var toString$6 = toString$c;
|
|
3197
|
+
var correctIsRegExpLogic$1 = correctIsRegexpLogic;
|
|
3210
3198
|
|
|
3211
|
-
var REPLACE = wellKnownSymbol$7('replace');
|
|
3212
|
-
var max = Math.max;
|
|
3213
|
-
var min$1 = Math.min;
|
|
3214
|
-
var concat = uncurryThis$9([].concat);
|
|
3215
|
-
var push = uncurryThis$9([].push);
|
|
3216
3199
|
var stringIndexOf = uncurryThis$9(''.indexOf);
|
|
3217
|
-
var stringSlice$3 = uncurryThis$9(''.slice);
|
|
3218
3200
|
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
}
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
})();
|
|
3229
|
-
|
|
3230
|
-
// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
|
|
3231
|
-
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
|
|
3232
|
-
if (/./[REPLACE]) {
|
|
3233
|
-
return /./[REPLACE]('a', '$0') === '';
|
|
3201
|
+
// `String.prototype.includes` method
|
|
3202
|
+
// https://tc39.es/ecma262/#sec-string.prototype.includes
|
|
3203
|
+
$$e({ target: 'String', proto: true, forced: !correctIsRegExpLogic$1('includes') }, {
|
|
3204
|
+
includes: function includes(searchString /* , position = 0 */) {
|
|
3205
|
+
return !!~stringIndexOf(
|
|
3206
|
+
toString$6(requireObjectCoercible$3(this)),
|
|
3207
|
+
toString$6(notARegExp$1(searchString)),
|
|
3208
|
+
arguments.length > 1 ? arguments[1] : undefined
|
|
3209
|
+
);
|
|
3234
3210
|
}
|
|
3235
|
-
return false;
|
|
3236
|
-
})();
|
|
3237
|
-
|
|
3238
|
-
var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$7(function () {
|
|
3239
|
-
var re = /./;
|
|
3240
|
-
re.exec = function () {
|
|
3241
|
-
var result = [];
|
|
3242
|
-
result.groups = { a: '7' };
|
|
3243
|
-
return result;
|
|
3244
|
-
};
|
|
3245
|
-
// eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
|
|
3246
|
-
return ''.replace(re, '$<a>') !== '7';
|
|
3247
3211
|
});
|
|
3248
3212
|
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3213
|
+
/**
|
|
3214
|
+
* @category Utilities
|
|
3215
|
+
*/
|
|
3216
|
+
const isFlatRatePackageCode = packageCode => {
|
|
3217
|
+
return packageCode ? packageCode.includes("flat_rate") : false;
|
|
3218
|
+
};
|
|
3252
3219
|
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3220
|
+
const capitalizeFirstLetter = str => str.slice(0, 1).toUpperCase() + str.slice(1);
|
|
3221
|
+
|
|
3222
|
+
/**
|
|
3223
|
+
* Creates a Record of Emotion styles.
|
|
3224
|
+
*
|
|
3225
|
+
* Values may be any variant that a `css` prop can accept (a CSSObject, SerializedStyles, a FunctionInterpolation with theme, etc).
|
|
3226
|
+
*
|
|
3227
|
+
* Eliminates the need to explicitly type styles (while remaining fully typed w/ autocomplete).
|
|
3228
|
+
*
|
|
3229
|
+
* @example
|
|
3230
|
+
* ```
|
|
3231
|
+
* const styles = createStyles({
|
|
3232
|
+
* container: (theme) => ({ backgroundColor: theme.colors.primary }),
|
|
3233
|
+
* icon: { color: 'red' },
|
|
3234
|
+
* });
|
|
3235
|
+
* ```
|
|
3236
|
+
*/
|
|
3237
|
+
const createStyles = styles => styles;
|
|
3268
3238
|
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3239
|
+
const buildError = (translationKey, error) => {
|
|
3240
|
+
const meta = __rest(error, ["code", "message", "path"]);
|
|
3241
|
+
return JSON.stringify(Object.assign({
|
|
3242
|
+
message: translationKey
|
|
3243
|
+
}, meta));
|
|
3244
|
+
};
|
|
3245
|
+
/**
|
|
3246
|
+
* @category Utilities
|
|
3247
|
+
*/
|
|
3248
|
+
const errorMap = (issue, ctx) => {
|
|
3249
|
+
let messageCode;
|
|
3250
|
+
// TODO - Fill in the rest of the codes (positive, max, etc)
|
|
3251
|
+
switch (issue.code) {
|
|
3252
|
+
// Invalid Type
|
|
3253
|
+
case zod.z.ZodIssueCode.invalid_type:
|
|
3254
|
+
switch (issue.received) {
|
|
3255
|
+
case "null":
|
|
3256
|
+
case "undefined":
|
|
3257
|
+
messageCode = "schemaErrors.required";
|
|
3258
|
+
break;
|
|
3276
3259
|
}
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3260
|
+
break;
|
|
3261
|
+
case zod.z.ZodIssueCode.invalid_string:
|
|
3262
|
+
messageCode = "schemaErrors.invalidString";
|
|
3263
|
+
break;
|
|
3264
|
+
case zod.z.ZodIssueCode.too_small:
|
|
3265
|
+
switch (issue.type) {
|
|
3266
|
+
case "number":
|
|
3267
|
+
if (issue.minimum === 0) {
|
|
3268
|
+
messageCode = issue.inclusive ? "schemaErrors.nonnegative" : "schemaErrors.positive";
|
|
3269
|
+
}
|
|
3270
|
+
break;
|
|
3271
|
+
case "string":
|
|
3272
|
+
messageCode = buildError("schemaErrors.tooFewCharacters", issue);
|
|
3273
|
+
break;
|
|
3285
3274
|
}
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
if (!global) break;
|
|
3293
|
-
|
|
3294
|
-
var matchStr = toString$6(result[0]);
|
|
3295
|
-
if (matchStr === '') rx.lastIndex = advanceStringIndex$1(S, toLength$2(rx.lastIndex), fullUnicode);
|
|
3275
|
+
break;
|
|
3276
|
+
case zod.z.ZodIssueCode.too_big:
|
|
3277
|
+
switch (issue.type) {
|
|
3278
|
+
case "string":
|
|
3279
|
+
messageCode = buildError("schemaErrors.tooManyCharacters", issue);
|
|
3280
|
+
break;
|
|
3296
3281
|
}
|
|
3282
|
+
break;
|
|
3283
|
+
}
|
|
3284
|
+
return {
|
|
3285
|
+
message: messageCode !== null && messageCode !== void 0 ? messageCode : ctx.defaultError
|
|
3286
|
+
};
|
|
3287
|
+
};
|
|
3288
|
+
/**
|
|
3289
|
+
* @category Utilities
|
|
3290
|
+
*/
|
|
3291
|
+
const validationResolver = schema => (values, context, resolverOptions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3292
|
+
const getValidationResult = () => zod$1.zodResolver(schema, {
|
|
3293
|
+
errorMap
|
|
3294
|
+
})(values, undefined, resolverOptions);
|
|
3295
|
+
const validationResult = yield formLogger.isSubmitting ? formLogger.log(values, getValidationResult) : getValidationResult();
|
|
3296
|
+
return validationResult;
|
|
3297
|
+
});
|
|
3297
3298
|
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
if (position >= nextSourcePosition) {
|
|
3321
|
-
accumulatedResult += stringSlice$3(S, nextSourcePosition, position) + replacement;
|
|
3322
|
-
nextSourcePosition = position + matched.length;
|
|
3299
|
+
const ButtonGroup = _a => {
|
|
3300
|
+
var {
|
|
3301
|
+
children,
|
|
3302
|
+
justify,
|
|
3303
|
+
toolbar = false
|
|
3304
|
+
} = _a,
|
|
3305
|
+
props = __rest(_a, ["children", "justify", "toolbar"]);
|
|
3306
|
+
const styles = {
|
|
3307
|
+
group: theme => Object.assign({
|
|
3308
|
+
alignItems: "center",
|
|
3309
|
+
display: "flex",
|
|
3310
|
+
justifyContent: justify,
|
|
3311
|
+
width: "100%"
|
|
3312
|
+
}, toolbar ? {
|
|
3313
|
+
"& > button": {
|
|
3314
|
+
"&:not(:first-of-type)": {
|
|
3315
|
+
borderBottomLeftRadius: 0,
|
|
3316
|
+
borderTopLeftRadius: 0
|
|
3317
|
+
},
|
|
3318
|
+
"&:not(:last-child)": {
|
|
3319
|
+
borderBottomRightRadius: 0,
|
|
3320
|
+
borderTopRightRadius: 0
|
|
3323
3321
|
}
|
|
3324
3322
|
}
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
}
|
|
3323
|
+
} : {
|
|
3324
|
+
gap: theme.spacing(2)
|
|
3325
|
+
})
|
|
3326
|
+
};
|
|
3327
|
+
return jsxRuntime.jsx("div", Object.assign({}, props, {
|
|
3328
|
+
css: styles.group,
|
|
3329
|
+
role: "group"
|
|
3330
|
+
}, {
|
|
3331
|
+
children: children
|
|
3332
|
+
}));
|
|
3333
|
+
};
|
|
3329
3334
|
|
|
3330
3335
|
const FieldLabel = ({
|
|
3331
3336
|
children,
|
|
@@ -3347,6 +3352,7 @@ const FieldLabel = ({
|
|
|
3347
3352
|
}, {
|
|
3348
3353
|
children: [label && jsxRuntime.jsxs("div", Object.assign({
|
|
3349
3354
|
css: theme => ({
|
|
3355
|
+
flexShrink: 0,
|
|
3350
3356
|
paddingTop: _withInput ? theme.spacing(subLabel ? 1 : 2) : undefined,
|
|
3351
3357
|
width: theme.spacing(12.5)
|
|
3352
3358
|
})
|
|
@@ -3495,7 +3501,7 @@ const getOverrideStyles = theme => ({
|
|
|
3495
3501
|
});
|
|
3496
3502
|
|
|
3497
3503
|
const CreditCardInputController = createFieldController();
|
|
3498
|
-
const transform$
|
|
3504
|
+
const transform$5 = {
|
|
3499
3505
|
in: v => v ? formatCreditCardNumber(v) : "",
|
|
3500
3506
|
out: event => event.target.value === "" ? null : event.target.value.replace(/\s/g, "")
|
|
3501
3507
|
};
|
|
@@ -3515,7 +3521,7 @@ const CreditCardInput = fieldProps => jsxRuntime.jsx(CreditCardInputController,
|
|
|
3515
3521
|
if (e.target.value.replace(/\s/g, "").length > 16) {
|
|
3516
3522
|
e.preventDefault();
|
|
3517
3523
|
} else {
|
|
3518
|
-
onChange(transform$
|
|
3524
|
+
onChange(transform$5.out(e));
|
|
3519
3525
|
}
|
|
3520
3526
|
},
|
|
3521
3527
|
onKeyDown: e => {
|
|
@@ -3523,7 +3529,7 @@ const CreditCardInput = fieldProps => jsxRuntime.jsx(CreditCardInputController,
|
|
|
3523
3529
|
if (!/^([0-9]|Backspace|Delete|Enter|Tab)$/i.test(e.key)) e.preventDefault();
|
|
3524
3530
|
},
|
|
3525
3531
|
type: "text",
|
|
3526
|
-
value: transform$
|
|
3532
|
+
value: transform$5.in(value)
|
|
3527
3533
|
}))
|
|
3528
3534
|
}));
|
|
3529
3535
|
}
|
|
@@ -3618,6 +3624,40 @@ const DatePicker = fieldProps => {
|
|
|
3618
3624
|
}));
|
|
3619
3625
|
};
|
|
3620
3626
|
|
|
3627
|
+
const ExpirationInputController = createFieldController();
|
|
3628
|
+
const transform$4 = {
|
|
3629
|
+
in: v => v ? formatExpiration(v) : "",
|
|
3630
|
+
out: event => event.target.value === "" ? null : event.target.value
|
|
3631
|
+
};
|
|
3632
|
+
const ExpirationInput = fieldProps => jsxRuntime.jsx(ExpirationInputController, Object.assign({}, fieldProps, {
|
|
3633
|
+
children: _a => {
|
|
3634
|
+
var {
|
|
3635
|
+
onChange,
|
|
3636
|
+
value
|
|
3637
|
+
} = _a,
|
|
3638
|
+
expirationInputProps = __rest(_a, ["onChange", "value"]);
|
|
3639
|
+
return jsxRuntime.jsx("div", Object.assign({
|
|
3640
|
+
css: getOverrideStyles
|
|
3641
|
+
}, {
|
|
3642
|
+
children: jsxRuntime.jsx(giger.Input, Object.assign({}, expirationInputProps, {
|
|
3643
|
+
onChange: e => {
|
|
3644
|
+
if (e.target.value.length > 7) {
|
|
3645
|
+
e.preventDefault();
|
|
3646
|
+
} else {
|
|
3647
|
+
onChange(transform$4.out(e));
|
|
3648
|
+
}
|
|
3649
|
+
},
|
|
3650
|
+
onKeyDown: e => {
|
|
3651
|
+
// Prevent non-numeric characters
|
|
3652
|
+
if (!/^([0-9]|Backspace|Delete|Enter|Tab)$/i.test(e.key)) e.preventDefault();
|
|
3653
|
+
},
|
|
3654
|
+
type: "text",
|
|
3655
|
+
value: transform$4.in(value)
|
|
3656
|
+
}))
|
|
3657
|
+
}));
|
|
3658
|
+
}
|
|
3659
|
+
}));
|
|
3660
|
+
|
|
3621
3661
|
var classof$2 = classofRaw$2;
|
|
3622
3662
|
|
|
3623
3663
|
// `IsArray` abstract operation
|
|
@@ -22056,7 +22096,7 @@ const Switch = _a => {
|
|
|
22056
22096
|
defaultChecked = false,
|
|
22057
22097
|
children,
|
|
22058
22098
|
shouldUnmount,
|
|
22059
|
-
label,
|
|
22099
|
+
label = "",
|
|
22060
22100
|
onChange
|
|
22061
22101
|
} = _a,
|
|
22062
22102
|
props = __rest(_a, ["defaultChecked", "children", "shouldUnmount", "label", "onChange"]);
|
|
@@ -22135,6 +22175,7 @@ var fields = /*#__PURE__*/Object.freeze({
|
|
|
22135
22175
|
CreditCardInput: CreditCardInput,
|
|
22136
22176
|
CheckboxInput: CheckboxInput,
|
|
22137
22177
|
DatePicker: DatePicker,
|
|
22178
|
+
ExpirationInput: ExpirationInput,
|
|
22138
22179
|
InputGroup: InputGroup,
|
|
22139
22180
|
transform: transform$3,
|
|
22140
22181
|
MoneyInput: MoneyInput,
|
|
@@ -22826,6 +22867,34 @@ const AddressParser = ({
|
|
|
22826
22867
|
}));
|
|
22827
22868
|
};
|
|
22828
22869
|
|
|
22870
|
+
const styles$a = createStyles({
|
|
22871
|
+
grow: {
|
|
22872
|
+
flexGrow: 1
|
|
22873
|
+
},
|
|
22874
|
+
stateWrapper: {
|
|
22875
|
+
"@media (max-width: 375px)": {
|
|
22876
|
+
flex: "1 0 100%"
|
|
22877
|
+
},
|
|
22878
|
+
display: "flex",
|
|
22879
|
+
flex: "1 0 66%",
|
|
22880
|
+
width: "100%"
|
|
22881
|
+
},
|
|
22882
|
+
stateZipWrapper: theme => ({
|
|
22883
|
+
"@media (max-width: 375px)": {
|
|
22884
|
+
flexDirection: "column",
|
|
22885
|
+
gap: 0
|
|
22886
|
+
},
|
|
22887
|
+
display: "flex",
|
|
22888
|
+
flexDirection: "row",
|
|
22889
|
+
gap: theme.spacing(2),
|
|
22890
|
+
width: "100%"
|
|
22891
|
+
}),
|
|
22892
|
+
zipWrapper: {
|
|
22893
|
+
display: "flex",
|
|
22894
|
+
width: "100%"
|
|
22895
|
+
}
|
|
22896
|
+
});
|
|
22897
|
+
|
|
22829
22898
|
const AddressFields = ({
|
|
22830
22899
|
domestic,
|
|
22831
22900
|
form,
|
|
@@ -22859,21 +22928,6 @@ const AddressFields = ({
|
|
|
22859
22928
|
labelWeight: "normal",
|
|
22860
22929
|
name: _formatFieldName("companyName"),
|
|
22861
22930
|
nativeLabel: true
|
|
22862
|
-
}), jsxRuntime.jsx(Select, {
|
|
22863
|
-
control: form.control,
|
|
22864
|
-
form: formId,
|
|
22865
|
-
label: t("address.fields.countryCode"),
|
|
22866
|
-
labelWeight: "normal",
|
|
22867
|
-
name: _formatFieldName("countryCode"),
|
|
22868
|
-
nativeLabel: true,
|
|
22869
|
-
onChange: e => {
|
|
22870
|
-
if (typeof e === "string") {
|
|
22871
|
-
form.setValue(_formatFieldName("stateProvince"), null, {
|
|
22872
|
-
shouldValidate: isSubmitted
|
|
22873
|
-
});
|
|
22874
|
-
}
|
|
22875
|
-
},
|
|
22876
|
-
options: countryCodeOptions
|
|
22877
22931
|
}), jsxRuntime.jsx(TextInput, {
|
|
22878
22932
|
control: form.control,
|
|
22879
22933
|
form: formId,
|
|
@@ -22896,24 +22950,29 @@ const AddressFields = ({
|
|
|
22896
22950
|
labelWeight: "normal",
|
|
22897
22951
|
name: _formatFieldName("cityLocality"),
|
|
22898
22952
|
nativeLabel: true
|
|
22953
|
+
}), jsxRuntime.jsx(Select, {
|
|
22954
|
+
control: form.control,
|
|
22955
|
+
form: formId,
|
|
22956
|
+
label: t("address.fields.countryCode"),
|
|
22957
|
+
labelWeight: "normal",
|
|
22958
|
+
name: _formatFieldName("countryCode"),
|
|
22959
|
+
nativeLabel: true,
|
|
22960
|
+
onChange: e => {
|
|
22961
|
+
if (typeof e === "string") {
|
|
22962
|
+
form.setValue(_formatFieldName("stateProvince"), null, {
|
|
22963
|
+
shouldValidate: isSubmitted
|
|
22964
|
+
});
|
|
22965
|
+
}
|
|
22966
|
+
},
|
|
22967
|
+
options: countryCodeOptions
|
|
22899
22968
|
}), jsxRuntime.jsxs("div", Object.assign({
|
|
22900
|
-
css:
|
|
22901
|
-
display: "flex",
|
|
22902
|
-
gap: theme.spacing(2),
|
|
22903
|
-
width: "100%"
|
|
22904
|
-
})
|
|
22969
|
+
css: styles$a.stateZipWrapper
|
|
22905
22970
|
}, {
|
|
22906
22971
|
children: [jsxRuntime.jsx("div", Object.assign({
|
|
22907
|
-
css:
|
|
22908
|
-
display: "flex",
|
|
22909
|
-
flex: "1 0 66%",
|
|
22910
|
-
width: "100%"
|
|
22911
|
-
}
|
|
22972
|
+
css: styles$a.stateWrapper
|
|
22912
22973
|
}, {
|
|
22913
22974
|
children: jsxRuntime.jsx("div", Object.assign({
|
|
22914
|
-
css:
|
|
22915
|
-
flexGrow: 1
|
|
22916
|
-
}
|
|
22975
|
+
css: styles$a.grow
|
|
22917
22976
|
}, {
|
|
22918
22977
|
children: watchCountryCode === "US" ?
|
|
22919
22978
|
// Domestic States
|
|
@@ -22937,15 +22996,10 @@ const AddressFields = ({
|
|
|
22937
22996
|
})
|
|
22938
22997
|
}))
|
|
22939
22998
|
})), jsxRuntime.jsx("div", Object.assign({
|
|
22940
|
-
css:
|
|
22941
|
-
display: "flex",
|
|
22942
|
-
width: "100%"
|
|
22943
|
-
}
|
|
22999
|
+
css: styles$a.zipWrapper
|
|
22944
23000
|
}, {
|
|
22945
23001
|
children: jsxRuntime.jsx("div", Object.assign({
|
|
22946
|
-
css:
|
|
22947
|
-
flexGrow: 1
|
|
22948
|
-
}
|
|
23002
|
+
css: styles$a.grow
|
|
22949
23003
|
}, {
|
|
22950
23004
|
children: jsxRuntime.jsx(TextInput, {
|
|
22951
23005
|
control: form.control,
|
|
@@ -23173,7 +23227,7 @@ const AddressForm = ({
|
|
|
23173
23227
|
}));
|
|
23174
23228
|
};
|
|
23175
23229
|
|
|
23176
|
-
const styles$
|
|
23230
|
+
const styles$9 = createStyles({
|
|
23177
23231
|
agreement: {
|
|
23178
23232
|
alignItems: "center",
|
|
23179
23233
|
display: "flex",
|
|
@@ -23243,10 +23297,10 @@ const DisplayCarrierTerms = c => {
|
|
|
23243
23297
|
const listCarrierLinks = () => {
|
|
23244
23298
|
return c.carrierTerms.links.map((term, index) => {
|
|
23245
23299
|
return jsxRuntime.jsx("li", Object.assign({
|
|
23246
|
-
css: styles$
|
|
23300
|
+
css: styles$9.listItems
|
|
23247
23301
|
}, {
|
|
23248
23302
|
children: jsxRuntime.jsx(giger.Link, Object.assign({
|
|
23249
|
-
css: styles$
|
|
23303
|
+
css: styles$9.link,
|
|
23250
23304
|
href: term.url,
|
|
23251
23305
|
isExternal: true,
|
|
23252
23306
|
target: "_blank"
|
|
@@ -23262,18 +23316,18 @@ const DisplayCarrierTerms = c => {
|
|
|
23262
23316
|
};
|
|
23263
23317
|
const listCarrierTerms = () => {
|
|
23264
23318
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
23265
|
-
css: styles$
|
|
23319
|
+
css: styles$9.terms
|
|
23266
23320
|
}, {
|
|
23267
23321
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23268
23322
|
variant: "subtitle1"
|
|
23269
23323
|
}, {
|
|
23270
23324
|
children: c.carrierTerms.title
|
|
23271
23325
|
})), jsxRuntime.jsx("div", Object.assign({
|
|
23272
|
-
css: styles$
|
|
23326
|
+
css: styles$9.terms
|
|
23273
23327
|
}, {
|
|
23274
23328
|
children: listCarrierContent()
|
|
23275
23329
|
})), jsxRuntime.jsx("ul", Object.assign({
|
|
23276
|
-
css: styles$
|
|
23330
|
+
css: styles$9.links
|
|
23277
23331
|
}, {
|
|
23278
23332
|
children: listCarrierLinks()
|
|
23279
23333
|
}))]
|
|
@@ -23503,7 +23557,7 @@ const AddressDisplay = ({
|
|
|
23503
23557
|
}));
|
|
23504
23558
|
};
|
|
23505
23559
|
|
|
23506
|
-
const styles$
|
|
23560
|
+
const styles$8 = createStyles({
|
|
23507
23561
|
container: theme => ({
|
|
23508
23562
|
display: "flex",
|
|
23509
23563
|
gap: theme.spacing()
|
|
@@ -23541,13 +23595,13 @@ const Disclosure = ({
|
|
|
23541
23595
|
}, [open]);
|
|
23542
23596
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
23543
23597
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
23544
|
-
css: styles$
|
|
23598
|
+
css: styles$8.container
|
|
23545
23599
|
}, {
|
|
23546
23600
|
children: [jsxRuntime.jsx("div", {
|
|
23547
23601
|
children: label
|
|
23548
23602
|
}), _showToggle && jsxRuntime.jsx("button", Object.assign({
|
|
23549
23603
|
"aria-expanded": isOpen,
|
|
23550
|
-
css: styles$
|
|
23604
|
+
css: styles$8.toggle,
|
|
23551
23605
|
onClick: () => {
|
|
23552
23606
|
setIsOpen(!isOpen);
|
|
23553
23607
|
onToggle(!isOpen);
|
|
@@ -23555,12 +23609,12 @@ const Disclosure = ({
|
|
|
23555
23609
|
type: "button"
|
|
23556
23610
|
}, {
|
|
23557
23611
|
children: jsxRuntime.jsx(giger.Icon, {
|
|
23558
|
-
css: styles$
|
|
23612
|
+
css: styles$8.icon,
|
|
23559
23613
|
name: isOpen ? brands.IconNames.CHEVRON_TOP : brands.IconNames.CHEVRON_BOTTOM
|
|
23560
23614
|
})
|
|
23561
23615
|
}))]
|
|
23562
23616
|
})), isOpen && jsxRuntime.jsx("div", Object.assign({
|
|
23563
|
-
css: styles$
|
|
23617
|
+
css: styles$8.content
|
|
23564
23618
|
}, {
|
|
23565
23619
|
children: typeof children === "function" ? children(() => setIsOpen(!isOpen)) : children
|
|
23566
23620
|
}))]
|
|
@@ -23700,7 +23754,7 @@ const getCarrierRecoverySchema = requiresAddress => zod.z.object({
|
|
|
23700
23754
|
address: requiresAddress ? baseSchema : baseSchema.optional()
|
|
23701
23755
|
});
|
|
23702
23756
|
|
|
23703
|
-
const styles$
|
|
23757
|
+
const styles$7 = createStyles({
|
|
23704
23758
|
grid: theme => ({
|
|
23705
23759
|
margin: theme.spacing(4)
|
|
23706
23760
|
}),
|
|
@@ -23742,51 +23796,29 @@ const CarrierRecoveryForm = ({
|
|
|
23742
23796
|
id: "carrier-recovery-form",
|
|
23743
23797
|
onSubmit: formLogger.capture(handleSubmit)
|
|
23744
23798
|
}, {
|
|
23745
|
-
children: jsxRuntime.jsxs(giger.Grid, Object.assign({
|
|
23746
|
-
css: styles$
|
|
23747
|
-
noPadding: true
|
|
23748
|
-
}, {
|
|
23749
|
-
children: [jsxRuntime.
|
|
23750
|
-
colSpan: 12
|
|
23751
|
-
}, {
|
|
23752
|
-
children: jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
23753
|
-
title: t("register-wallet:sections.notifications.carrier.title", {
|
|
23754
|
-
carrierFriendlyName
|
|
23755
|
-
}),
|
|
23756
|
-
type: requiresAddress ? giger.NotificationType.ERROR : giger.NotificationType.ALERT
|
|
23757
|
-
}, {
|
|
23758
|
-
children: [address && t("register-wallet:sections.notifications.carrier.confirmAddress"), t("register-wallet:sections.notifications.carrier.description", {
|
|
23759
|
-
carrierFriendlyName
|
|
23760
|
-
})].join(" ")
|
|
23761
|
-
}))
|
|
23762
|
-
})), requiresAddress && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
23799
|
+
children: jsxRuntime.jsxs(giger.Grid, Object.assign({
|
|
23800
|
+
css: styles$7.grid,
|
|
23801
|
+
noPadding: true
|
|
23802
|
+
}, {
|
|
23803
|
+
children: [requiresAddress && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
23763
23804
|
children: [jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
23764
23805
|
colSpan: 12
|
|
23765
23806
|
}, {
|
|
23766
23807
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23767
|
-
css: styles$
|
|
23808
|
+
css: styles$7.heading,
|
|
23768
23809
|
variant: "heading4"
|
|
23769
23810
|
}, {
|
|
23770
23811
|
children: t("register-wallet:sections.carriers.title")
|
|
23771
23812
|
}))
|
|
23772
23813
|
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
23773
23814
|
colSpan: 12,
|
|
23774
|
-
css: styles$
|
|
23815
|
+
css: styles$7.subtitle
|
|
23775
23816
|
}, {
|
|
23776
23817
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23777
23818
|
variant: "subtitle1"
|
|
23778
23819
|
}, {
|
|
23779
23820
|
children: t("register-wallet:sections.carriers.subtitle")
|
|
23780
23821
|
}))
|
|
23781
|
-
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
23782
|
-
colSpan: 12,
|
|
23783
|
-
"data-testid": "address-fields"
|
|
23784
|
-
}, {
|
|
23785
|
-
children: jsxRuntime.jsx(AddressFields, {
|
|
23786
|
-
form: form,
|
|
23787
|
-
formatFieldName: fieldName => `address.${fieldName}`,
|
|
23788
|
-
optionalFields: ["addressLine2"]
|
|
23789
|
-
})
|
|
23790
23822
|
}))]
|
|
23791
23823
|
}), !!(errors === null || errors === void 0 ? void 0 : errors.length) && jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
23792
23824
|
colSpan: 12
|
|
@@ -23801,6 +23833,15 @@ const CarrierRecoveryForm = ({
|
|
|
23801
23833
|
message
|
|
23802
23834
|
}) => message).join(" ")
|
|
23803
23835
|
}))
|
|
23836
|
+
})), requiresAddress && jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
23837
|
+
colSpan: 12,
|
|
23838
|
+
"data-testid": "address-fields"
|
|
23839
|
+
}, {
|
|
23840
|
+
children: jsxRuntime.jsx(AddressFields, {
|
|
23841
|
+
form: form,
|
|
23842
|
+
formatFieldName: fieldName => `address.${fieldName}`,
|
|
23843
|
+
optionalFields: ["addressLine2"]
|
|
23844
|
+
})
|
|
23804
23845
|
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
23805
23846
|
colSpan: 12
|
|
23806
23847
|
}, {
|
|
@@ -23832,76 +23873,6 @@ const carrierTermsFormSchema = zod.z.object({
|
|
|
23832
23873
|
agreement: zod.z.literal(true)
|
|
23833
23874
|
});
|
|
23834
23875
|
|
|
23835
|
-
/**
|
|
23836
|
-
* TODO: Temporary component (replace with carrier metadata)
|
|
23837
|
-
*/
|
|
23838
|
-
const CarrierTerms = ({
|
|
23839
|
-
carrierCode
|
|
23840
|
-
}) => {
|
|
23841
|
-
const upsLinks = [{
|
|
23842
|
-
text: "UPS Promotional Rates Agreement",
|
|
23843
|
-
url: "https://www.ups.com/assets/resources/media/en_US/CQF_US.pdf"
|
|
23844
|
-
}, {
|
|
23845
|
-
text: "UPS Technology Agreement",
|
|
23846
|
-
url: "https://www.ups.com/assets/resources/media/en_US/UTA.pdf"
|
|
23847
|
-
}, {
|
|
23848
|
-
text: "List of Prohibited Articles",
|
|
23849
|
-
url: "https://www.ups.com/kn/en/help-center/shipping-support/prohibited-items.page"
|
|
23850
|
-
}];
|
|
23851
|
-
switch (carrierCode) {
|
|
23852
|
-
case "ups":
|
|
23853
|
-
return jsxRuntime.jsxs("div", Object.assign({
|
|
23854
|
-
css: styles$a.terms
|
|
23855
|
-
}, {
|
|
23856
|
-
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23857
|
-
variant: "subtitle1"
|
|
23858
|
-
}, {
|
|
23859
|
-
children: "UPS Promotional Rates and Technology Agreements"
|
|
23860
|
-
})), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23861
|
-
variant: "body1"
|
|
23862
|
-
}, {
|
|
23863
|
-
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."
|
|
23864
|
-
})), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23865
|
-
variant: "body1"
|
|
23866
|
-
}, {
|
|
23867
|
-
children: "To start shipping with UPS, you must first agree to the following:"
|
|
23868
|
-
})), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23869
|
-
variant: "body1"
|
|
23870
|
-
}, {
|
|
23871
|
-
children: "UPS, the UPS brandmark, UPS Ready, and the color brown are trademarks of the United Parcel Service of America, Inc. All Rights Reserved."
|
|
23872
|
-
})), jsxRuntime.jsx("ul", {
|
|
23873
|
-
children: upsLinks.map(({
|
|
23874
|
-
text,
|
|
23875
|
-
url
|
|
23876
|
-
}, idx) => jsxRuntime.jsx("li", Object.assign({
|
|
23877
|
-
css: styles$a.listItems
|
|
23878
|
-
}, {
|
|
23879
|
-
children: jsxRuntime.jsx(giger.Link, Object.assign({
|
|
23880
|
-
href: url,
|
|
23881
|
-
isExternal: true,
|
|
23882
|
-
rel: "noreferrer",
|
|
23883
|
-
target: "_blank"
|
|
23884
|
-
}, {
|
|
23885
|
-
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23886
|
-
variant: "body1"
|
|
23887
|
-
}, {
|
|
23888
|
-
children: text
|
|
23889
|
-
}))
|
|
23890
|
-
}))
|
|
23891
|
-
}), idx))
|
|
23892
|
-
})]
|
|
23893
|
-
}));
|
|
23894
|
-
case "usps":
|
|
23895
|
-
case "stamps_com":
|
|
23896
|
-
return jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23897
|
-
variant: "subtitle1"
|
|
23898
|
-
}, {
|
|
23899
|
-
children: "USPS Promotional Rates and Technology Agreements"
|
|
23900
|
-
}));
|
|
23901
|
-
default:
|
|
23902
|
-
return null;
|
|
23903
|
-
}
|
|
23904
|
-
};
|
|
23905
23876
|
const CarrierTermsForm = ({
|
|
23906
23877
|
carrierCodes,
|
|
23907
23878
|
onSubmit
|
|
@@ -23911,6 +23882,11 @@ const CarrierTermsForm = ({
|
|
|
23911
23882
|
} = reactI18next.useTranslation(["common"]);
|
|
23912
23883
|
const metadatas = useCarrierMetadata(carrierCodes);
|
|
23913
23884
|
const [showTerms, setShowTerms] = React.useState(false);
|
|
23885
|
+
const terms = metadatas.filter(({
|
|
23886
|
+
terms
|
|
23887
|
+
}) => terms).map(({
|
|
23888
|
+
terms
|
|
23889
|
+
}) => terms);
|
|
23914
23890
|
const form = reactHookForm.useForm({
|
|
23915
23891
|
defaultValues: {
|
|
23916
23892
|
agreement: false
|
|
@@ -23922,7 +23898,7 @@ const CarrierTermsForm = ({
|
|
|
23922
23898
|
onSubmit(payload.agreement);
|
|
23923
23899
|
}));
|
|
23924
23900
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
23925
|
-
css: styles$
|
|
23901
|
+
css: styles$9.termsForm,
|
|
23926
23902
|
"data-testid": "carrier-terms-form"
|
|
23927
23903
|
}, {
|
|
23928
23904
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
@@ -23938,7 +23914,7 @@ const CarrierTermsForm = ({
|
|
|
23938
23914
|
})), jsxRuntime.jsx(Spacer, {
|
|
23939
23915
|
multiplier: 1
|
|
23940
23916
|
}), jsxRuntime.jsx("div", Object.assign({
|
|
23941
|
-
css: styles$
|
|
23917
|
+
css: styles$9.carrierLogos
|
|
23942
23918
|
}, {
|
|
23943
23919
|
children: metadatas.map(({
|
|
23944
23920
|
name,
|
|
@@ -23954,7 +23930,7 @@ const CarrierTermsForm = ({
|
|
|
23954
23930
|
onSubmit: formLogger.capture(handleSubmit)
|
|
23955
23931
|
}, {
|
|
23956
23932
|
children: jsxRuntime.jsxs("div", Object.assign({
|
|
23957
|
-
css: styles$
|
|
23933
|
+
css: styles$9.agreement
|
|
23958
23934
|
}, {
|
|
23959
23935
|
children: [jsxRuntime.jsx("div", {
|
|
23960
23936
|
children: jsxRuntime.jsx(CheckboxInput, {
|
|
@@ -23967,7 +23943,7 @@ const CarrierTermsForm = ({
|
|
|
23967
23943
|
"data-testid": "terms-link",
|
|
23968
23944
|
onClick: e => {
|
|
23969
23945
|
e.preventDefault();
|
|
23970
|
-
setShowTerms(
|
|
23946
|
+
setShowTerms(prev => !prev);
|
|
23971
23947
|
},
|
|
23972
23948
|
role: "button"
|
|
23973
23949
|
})
|
|
@@ -23981,22 +23957,12 @@ const CarrierTermsForm = ({
|
|
|
23981
23957
|
name: "agreement"
|
|
23982
23958
|
})
|
|
23983
23959
|
}), showTerms && jsxRuntime.jsxs("div", Object.assign({
|
|
23984
|
-
css: styles$
|
|
23960
|
+
css: styles$9.well
|
|
23985
23961
|
}, {
|
|
23986
|
-
children: [
|
|
23987
|
-
|
|
23988
|
-
}, {
|
|
23989
|
-
|
|
23990
|
-
variant: "heading5"
|
|
23991
|
-
}, {
|
|
23992
|
-
children: t("carriers.terms.title")
|
|
23993
|
-
})), metadatas.map(({
|
|
23994
|
-
carrierCode
|
|
23995
|
-
}) => jsxRuntime.jsx(CarrierTerms, {
|
|
23996
|
-
carrierCode: carrierCode
|
|
23997
|
-
}, carrierCode))]
|
|
23998
|
-
})), jsxRuntime.jsx("div", Object.assign({
|
|
23999
|
-
css: styles$a.close
|
|
23962
|
+
children: [terms.map((t, idx) => jsxRuntime.jsx(DisplayCarrierTerms, {
|
|
23963
|
+
carrierTerms: t
|
|
23964
|
+
}, idx)), jsxRuntime.jsx("div", Object.assign({
|
|
23965
|
+
css: styles$9.close
|
|
24000
23966
|
}, {
|
|
24001
23967
|
children: jsxRuntime.jsx(giger.Button, Object.assign({
|
|
24002
23968
|
onClick: () => setShowTerms(false),
|
|
@@ -24384,7 +24350,7 @@ const LandingPageForm = ({
|
|
|
24384
24350
|
}));
|
|
24385
24351
|
};
|
|
24386
24352
|
|
|
24387
|
-
const styles$
|
|
24353
|
+
const styles$6 = createStyles({
|
|
24388
24354
|
container: theme => ({
|
|
24389
24355
|
padding: theme.spacing(2)
|
|
24390
24356
|
}),
|
|
@@ -24394,7 +24360,8 @@ const styles$7 = createStyles({
|
|
|
24394
24360
|
header: {
|
|
24395
24361
|
alignItems: "center",
|
|
24396
24362
|
display: "flex",
|
|
24397
|
-
flexDirection: "column"
|
|
24363
|
+
flexDirection: "column",
|
|
24364
|
+
textAlign: "center"
|
|
24398
24365
|
}
|
|
24399
24366
|
});
|
|
24400
24367
|
|
|
@@ -24405,11 +24372,11 @@ const LandingPage = ({
|
|
|
24405
24372
|
t
|
|
24406
24373
|
} = reactI18next.useTranslation();
|
|
24407
24374
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
24408
|
-
css: styles$
|
|
24375
|
+
css: styles$6.container,
|
|
24409
24376
|
"data-testid": "landing-page"
|
|
24410
24377
|
}, {
|
|
24411
24378
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24412
|
-
css: styles$
|
|
24379
|
+
css: styles$6.header
|
|
24413
24380
|
}, {
|
|
24414
24381
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24415
24382
|
variant: "heading4"
|
|
@@ -24427,7 +24394,7 @@ const LandingPage = ({
|
|
|
24427
24394
|
})), jsxRuntime.jsx(LandingPageForm, {
|
|
24428
24395
|
onSubmit: onSubmit
|
|
24429
24396
|
}), jsxRuntime.jsxs("div", Object.assign({
|
|
24430
|
-
css: styles$
|
|
24397
|
+
css: styles$6.header
|
|
24431
24398
|
}, {
|
|
24432
24399
|
children: [jsxRuntime.jsx(Spacer, {
|
|
24433
24400
|
multiplier: 6
|
|
@@ -24438,7 +24405,7 @@ const LandingPage = ({
|
|
|
24438
24405
|
})), jsxRuntime.jsx(Spacer, {
|
|
24439
24406
|
multiplier: 2
|
|
24440
24407
|
}), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24441
|
-
css: styles$
|
|
24408
|
+
css: styles$6.description,
|
|
24442
24409
|
variant: "body1"
|
|
24443
24410
|
}, {
|
|
24444
24411
|
children: t("onboarding:landing.description")
|
|
@@ -24519,7 +24486,7 @@ const Accordion = _a => {
|
|
|
24519
24486
|
});
|
|
24520
24487
|
};
|
|
24521
24488
|
|
|
24522
|
-
const getStyles$
|
|
24489
|
+
const getStyles$4 = (isConnected = false) => createStyles({
|
|
24523
24490
|
connectButton: theme => [{
|
|
24524
24491
|
padding: `0 ${theme.spacing(.5)}px`
|
|
24525
24492
|
}, isConnected && {
|
|
@@ -24578,14 +24545,14 @@ const ListCarriersRow = ({
|
|
|
24578
24545
|
setIsSubmitting(false);
|
|
24579
24546
|
});
|
|
24580
24547
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
24581
|
-
css: getStyles$
|
|
24548
|
+
css: getStyles$4().container,
|
|
24582
24549
|
"data-testid": "carrier-row"
|
|
24583
24550
|
}, {
|
|
24584
24551
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24585
|
-
css: getStyles$
|
|
24552
|
+
css: getStyles$4().rowContainer
|
|
24586
24553
|
}, {
|
|
24587
24554
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24588
|
-
css: getStyles$
|
|
24555
|
+
css: getStyles$4().logoContainer
|
|
24589
24556
|
}, {
|
|
24590
24557
|
children: [jsxRuntime.jsx("div", {
|
|
24591
24558
|
children: jsxRuntime.jsx("img", {
|
|
@@ -24604,7 +24571,7 @@ const ListCarriersRow = ({
|
|
|
24604
24571
|
}, {
|
|
24605
24572
|
children: jsxRuntime.jsx(giger.Button, Object.assign({
|
|
24606
24573
|
color: giger.ButtonColor.SECONDARY,
|
|
24607
|
-
css: getStyles$
|
|
24574
|
+
css: getStyles$4(isConnected).connectButton,
|
|
24608
24575
|
disabled: isConnected || showDropDown,
|
|
24609
24576
|
isLoading: isSubmitting,
|
|
24610
24577
|
onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -24624,7 +24591,7 @@ const ListCarriersRow = ({
|
|
|
24624
24591
|
}));
|
|
24625
24592
|
};
|
|
24626
24593
|
|
|
24627
|
-
const styles$
|
|
24594
|
+
const styles$5 = createStyles({
|
|
24628
24595
|
listContainer: theme => ({
|
|
24629
24596
|
"& > li:not(:last-of-type)": {
|
|
24630
24597
|
borderBottom: `1px solid ${theme.palette.gray.light}`
|
|
@@ -24671,7 +24638,7 @@ const ListCarriers$1 = ({
|
|
|
24671
24638
|
children: t("list-carriers:headers.accountCarriers")
|
|
24672
24639
|
}))
|
|
24673
24640
|
}), jsxRuntime.jsx("ul", Object.assign({
|
|
24674
|
-
css: styles$
|
|
24641
|
+
css: styles$5.listContainer
|
|
24675
24642
|
}, {
|
|
24676
24643
|
children: isLoading ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
24677
24644
|
children: [jsxRuntime.jsx(LoadingSkeletonRow, {}), jsxRuntime.jsx(LoadingSkeletonRow, {}), jsxRuntime.jsx(LoadingSkeletonRow, {})]
|
|
@@ -24692,10 +24659,10 @@ const ListCarriers$1 = ({
|
|
|
24692
24659
|
};
|
|
24693
24660
|
const LoadingSkeletonRow = () => {
|
|
24694
24661
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
24695
|
-
css: styles$
|
|
24662
|
+
css: styles$5.skeletonRow
|
|
24696
24663
|
}, {
|
|
24697
24664
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24698
|
-
css: styles$
|
|
24665
|
+
css: styles$5.skeletonLogoContainer
|
|
24699
24666
|
}, {
|
|
24700
24667
|
children: [jsxRuntime.jsx(giger.Skeleton, {
|
|
24701
24668
|
animation: giger.SkeletonAnimation.WAVE,
|
|
@@ -24719,7 +24686,7 @@ const LoadingSkeletonRow = () => {
|
|
|
24719
24686
|
}));
|
|
24720
24687
|
};
|
|
24721
24688
|
|
|
24722
|
-
const styles$
|
|
24689
|
+
const styles$4 = createStyles({
|
|
24723
24690
|
body: theme => ({
|
|
24724
24691
|
borderTop: `1px solid ${theme.palette.gray.light}`,
|
|
24725
24692
|
color: theme.palette.black,
|
|
@@ -24770,14 +24737,14 @@ const SettingsCard = ({
|
|
|
24770
24737
|
verticallyAligned
|
|
24771
24738
|
}) => {
|
|
24772
24739
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
24773
|
-
css: verticallyAligned ? styles$
|
|
24740
|
+
css: verticallyAligned ? styles$4.verticalContainer : styles$4.container,
|
|
24774
24741
|
"data-testid": "settingsCard"
|
|
24775
24742
|
}, {
|
|
24776
24743
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24777
|
-
css: styles$
|
|
24744
|
+
css: styles$4.header
|
|
24778
24745
|
}, {
|
|
24779
24746
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24780
|
-
css: styles$
|
|
24747
|
+
css: styles$4.title
|
|
24781
24748
|
}, {
|
|
24782
24749
|
children: [typeof title === "string" ? jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24783
24750
|
variant: "subtitle2"
|
|
@@ -24812,7 +24779,7 @@ const SettingsCard = ({
|
|
|
24812
24779
|
}))
|
|
24813
24780
|
}))]
|
|
24814
24781
|
})), children && jsxRuntime.jsx("div", Object.assign({
|
|
24815
|
-
css: styles$
|
|
24782
|
+
css: styles$4.body
|
|
24816
24783
|
}, {
|
|
24817
24784
|
children: jsxRuntime.jsxs("div", {
|
|
24818
24785
|
children: [children, accessoryAction && jsxRuntime.jsx(ButtonGroup, Object.assign({
|
|
@@ -24929,7 +24896,7 @@ const warehouseSchema = zod.z.discriminatedUnion("returnToAddressIsDifferent", [
|
|
|
24929
24896
|
});
|
|
24930
24897
|
});
|
|
24931
24898
|
|
|
24932
|
-
const styles$
|
|
24899
|
+
const styles$3 = createStyles({
|
|
24933
24900
|
header: {
|
|
24934
24901
|
textAlign: "center"
|
|
24935
24902
|
},
|
|
@@ -24966,6 +24933,9 @@ const WarehouseForm = ({
|
|
|
24966
24933
|
returnToAddressIsDifferent: !lodash.exports.isEqual(warehouse.originAddress, warehouse.returnAddress)
|
|
24967
24934
|
}) : {
|
|
24968
24935
|
isDefault: false,
|
|
24936
|
+
originAddress: {
|
|
24937
|
+
countryCode: "US"
|
|
24938
|
+
},
|
|
24969
24939
|
returnToAddressIsDifferent: false
|
|
24970
24940
|
},
|
|
24971
24941
|
resolver: validationResolver(warehouseSchema)
|
|
@@ -24981,12 +24951,12 @@ const WarehouseForm = ({
|
|
|
24981
24951
|
}
|
|
24982
24952
|
}));
|
|
24983
24953
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
24984
|
-
css: _isOnboarding ? styles$
|
|
24954
|
+
css: _isOnboarding ? styles$3.onboardingWell : styles$3.well,
|
|
24985
24955
|
"data-testid": "warehouse-form"
|
|
24986
24956
|
}, {
|
|
24987
24957
|
children: [_isOnboarding && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
24988
24958
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24989
|
-
css: styles$
|
|
24959
|
+
css: styles$3.header
|
|
24990
24960
|
}, {
|
|
24991
24961
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24992
24962
|
variant: "heading4"
|
|
@@ -25023,7 +24993,8 @@ const WarehouseForm = ({
|
|
|
25023
24993
|
nativeLabel: true
|
|
25024
24994
|
}), jsxRuntime.jsx(AddressFields, {
|
|
25025
24995
|
form: form,
|
|
25026
|
-
formatFieldName: fieldName => `originAddress.${fieldName}
|
|
24996
|
+
formatFieldName: fieldName => `originAddress.${fieldName}`,
|
|
24997
|
+
optionalFields: ["addressLine2"]
|
|
25027
24998
|
}), jsxRuntime.jsx(CheckboxInput, {
|
|
25028
24999
|
checkboxLabel: t("manage-warehouses:residentialAddress"),
|
|
25029
25000
|
control: form.control,
|
|
@@ -26259,61 +26230,53 @@ const BillingFields = ({
|
|
|
26259
26230
|
const {
|
|
26260
26231
|
t
|
|
26261
26232
|
} = reactI18next.useTranslation();
|
|
26262
|
-
const expirationMonthOptions = useExpirationMonthOptions();
|
|
26263
26233
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
26264
|
-
children: [jsxRuntime.jsx(
|
|
26265
|
-
|
|
26266
|
-
|
|
26267
|
-
|
|
26268
|
-
|
|
26269
|
-
|
|
26270
|
-
|
|
26271
|
-
|
|
26272
|
-
|
|
26273
|
-
|
|
26274
|
-
|
|
26275
|
-
|
|
26276
|
-
}, {
|
|
26277
|
-
|
|
26278
|
-
|
|
26279
|
-
|
|
26280
|
-
|
|
26281
|
-
name: "creditCard.number",
|
|
26282
|
-
nativeLabel: true
|
|
26283
|
-
})
|
|
26284
|
-
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26285
|
-
colSpan: 6
|
|
26286
|
-
}, {
|
|
26287
|
-
children: jsxRuntime.jsx(Select, {
|
|
26288
|
-
control: form.control,
|
|
26289
|
-
label: t("billing.fields.expirationMonth"),
|
|
26290
|
-
labelWeight: "normal",
|
|
26291
|
-
name: "creditCard.expirationMonth",
|
|
26292
|
-
nativeLabel: true,
|
|
26293
|
-
options: expirationMonthOptions
|
|
26294
|
-
})
|
|
26295
|
-
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26296
|
-
colSpan: 3
|
|
26297
|
-
}, {
|
|
26298
|
-
children: jsxRuntime.jsx(TextInput, {
|
|
26299
|
-
control: form.control,
|
|
26300
|
-
label: t("billing.fields.expirationYear"),
|
|
26301
|
-
labelWeight: "normal",
|
|
26302
|
-
maxLength: 4,
|
|
26303
|
-
name: "creditCard.expirationYear",
|
|
26304
|
-
nativeLabel: true
|
|
26234
|
+
children: [jsxRuntime.jsx(TextInput, {
|
|
26235
|
+
control: form.control,
|
|
26236
|
+
label: t("billing.fields.name"),
|
|
26237
|
+
labelWeight: "normal",
|
|
26238
|
+
name: "creditCard.name",
|
|
26239
|
+
nativeLabel: true
|
|
26240
|
+
}), jsxRuntime.jsx(CreditCardInput, {
|
|
26241
|
+
control: form.control,
|
|
26242
|
+
label: t("billing.fields.cardNumber"),
|
|
26243
|
+
labelWeight: "normal",
|
|
26244
|
+
name: "creditCard.number",
|
|
26245
|
+
nativeLabel: true
|
|
26246
|
+
}), jsxRuntime.jsxs("div", Object.assign({
|
|
26247
|
+
css: theme => ({
|
|
26248
|
+
display: "flex",
|
|
26249
|
+
gap: theme.spacing(2),
|
|
26250
|
+
width: "100%"
|
|
26305
26251
|
})
|
|
26306
|
-
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26307
|
-
colSpan: 3
|
|
26308
26252
|
}, {
|
|
26309
|
-
children: jsxRuntime.jsx(
|
|
26310
|
-
|
|
26311
|
-
|
|
26312
|
-
|
|
26313
|
-
|
|
26314
|
-
|
|
26315
|
-
|
|
26316
|
-
|
|
26253
|
+
children: [jsxRuntime.jsx("div", Object.assign({
|
|
26254
|
+
css: {
|
|
26255
|
+
flexGrow: "1"
|
|
26256
|
+
}
|
|
26257
|
+
}, {
|
|
26258
|
+
children: jsxRuntime.jsx(ExpirationInput, {
|
|
26259
|
+
control: form.control,
|
|
26260
|
+
label: t("billing.fields.expiration"),
|
|
26261
|
+
labelWeight: "normal",
|
|
26262
|
+
maxLength: 7,
|
|
26263
|
+
name: "creditCard.expiration",
|
|
26264
|
+
nativeLabel: true
|
|
26265
|
+
})
|
|
26266
|
+
})), jsxRuntime.jsx("div", Object.assign({
|
|
26267
|
+
css: {
|
|
26268
|
+
flexGrow: "1"
|
|
26269
|
+
}
|
|
26270
|
+
}, {
|
|
26271
|
+
children: jsxRuntime.jsx(TextInput, {
|
|
26272
|
+
control: form.control,
|
|
26273
|
+
label: t("billing.fields.cvv"),
|
|
26274
|
+
labelWeight: "normal",
|
|
26275
|
+
maxLength: 4,
|
|
26276
|
+
name: "creditCard.cvv",
|
|
26277
|
+
nativeLabel: true
|
|
26278
|
+
})
|
|
26279
|
+
}))]
|
|
26317
26280
|
}))]
|
|
26318
26281
|
});
|
|
26319
26282
|
};
|
|
@@ -26349,8 +26312,10 @@ const billingAddressSchema = addressSchema.extend({
|
|
|
26349
26312
|
});
|
|
26350
26313
|
const creditCardSchema = zod.z.object({
|
|
26351
26314
|
cvv: zod.z.string().trim().refine(cvv => cardValidator__default["default"].cvv(cvv).isValid, "Invalid CVV"),
|
|
26352
|
-
|
|
26353
|
-
|
|
26315
|
+
expiration: zod.z.string().trim().refine(expiration => {
|
|
26316
|
+
const [expirationMonth, expirationYear] = expiration.split("/");
|
|
26317
|
+
return expirationMonths.includes(expirationMonth) && expirationYears.includes(expirationYear);
|
|
26318
|
+
}, "Invalid expiration"),
|
|
26354
26319
|
name: zod.z.string().trim().min(1),
|
|
26355
26320
|
number: zod.z.string().trim().refine(number => cardValidator__default["default"].number(number).isValid, "Invalid card number").refine(number => {
|
|
26356
26321
|
var _a, _b;
|
|
@@ -26358,11 +26323,16 @@ const creditCardSchema = zod.z.object({
|
|
|
26358
26323
|
}, "schemaErrors.invalidCreditCardType")
|
|
26359
26324
|
}).transform(schema => {
|
|
26360
26325
|
var _a;
|
|
26361
|
-
const
|
|
26326
|
+
const {
|
|
26327
|
+
cvv,
|
|
26328
|
+
expiration
|
|
26329
|
+
} = schema,
|
|
26330
|
+
creditCard = __rest(schema, ["cvv", "expiration"]);
|
|
26362
26331
|
const creditCardVendor = (_a = cardValidator__default["default"].number(creditCard.number).card) === null || _a === void 0 ? void 0 : _a.type;
|
|
26332
|
+
const [expirationMonth, expirationYear] = expiration.split("/");
|
|
26363
26333
|
return {
|
|
26364
|
-
expirationMonth:
|
|
26365
|
-
expirationYear:
|
|
26334
|
+
expirationMonth: expirationMonth,
|
|
26335
|
+
expirationYear: expirationYear,
|
|
26366
26336
|
name: creditCard.name,
|
|
26367
26337
|
number: creditCard.number,
|
|
26368
26338
|
type: creditCardVendor
|
|
@@ -26438,7 +26408,7 @@ const EditWalletAddressForm = ({
|
|
|
26438
26408
|
}));
|
|
26439
26409
|
};
|
|
26440
26410
|
|
|
26441
|
-
const styles$
|
|
26411
|
+
const styles$2 = createStyles({
|
|
26442
26412
|
grid: theme => ({
|
|
26443
26413
|
margin: theme.spacing(4)
|
|
26444
26414
|
}),
|
|
@@ -26462,7 +26432,11 @@ const WalletForm = ({
|
|
|
26462
26432
|
const form = reactHookForm.useForm({
|
|
26463
26433
|
defaultValues:
|
|
26464
26434
|
// If the warehouse address is a PO Box they cannot use it as their billing address
|
|
26465
|
-
defaultWarehouseIsPoBox ? {
|
|
26435
|
+
defaultWarehouseIsPoBox ? {
|
|
26436
|
+
address: {
|
|
26437
|
+
countryCode: "US"
|
|
26438
|
+
}
|
|
26439
|
+
} : {
|
|
26466
26440
|
address: Object.assign(Object.assign({}, address), {
|
|
26467
26441
|
countryCode: address.countryCode
|
|
26468
26442
|
})
|
|
@@ -26486,21 +26460,21 @@ const WalletForm = ({
|
|
|
26486
26460
|
onSubmit: formLogger.capture(handleSubmit)
|
|
26487
26461
|
}, {
|
|
26488
26462
|
children: jsxRuntime.jsxs(giger.Grid, Object.assign({
|
|
26489
|
-
css: styles$
|
|
26463
|
+
css: styles$2.grid,
|
|
26490
26464
|
noPadding: true
|
|
26491
26465
|
}, {
|
|
26492
26466
|
children: [jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26493
26467
|
colSpan: 12
|
|
26494
26468
|
}, {
|
|
26495
26469
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
26496
|
-
css: styles$
|
|
26470
|
+
css: styles$2.heading,
|
|
26497
26471
|
variant: "heading4"
|
|
26498
26472
|
}, {
|
|
26499
26473
|
children: t("register-wallet:sections.billing.title")
|
|
26500
26474
|
}))
|
|
26501
26475
|
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26502
26476
|
colSpan: 12,
|
|
26503
|
-
css: styles$
|
|
26477
|
+
css: styles$2.subtitle
|
|
26504
26478
|
}, {
|
|
26505
26479
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
26506
26480
|
variant: "subtitle1"
|
|
@@ -26510,19 +26484,30 @@ const WalletForm = ({
|
|
|
26510
26484
|
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26511
26485
|
colSpan: 12
|
|
26512
26486
|
}, {
|
|
26513
|
-
children: jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
26487
|
+
children: (errors === null || errors === void 0 ? void 0 : errors.length) ? jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
26488
|
+
title: t("register-wallet:sections.notifications.error.title"),
|
|
26489
|
+
type: giger.NotificationType.ERROR
|
|
26490
|
+
}, {
|
|
26491
|
+
children: errors.map(({
|
|
26492
|
+
message
|
|
26493
|
+
}) => message).join(" ")
|
|
26494
|
+
})) : jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
26514
26495
|
title: t("register-wallet:sections.notifications.info.title"),
|
|
26515
26496
|
type: giger.NotificationType.INFO
|
|
26516
26497
|
}, {
|
|
26517
26498
|
children: t("register-wallet:sections.notifications.info.description")
|
|
26518
26499
|
}))
|
|
26519
|
-
})), jsxRuntime.jsx(
|
|
26520
|
-
|
|
26521
|
-
}
|
|
26500
|
+
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26501
|
+
colSpan: 12
|
|
26502
|
+
}, {
|
|
26503
|
+
children: jsxRuntime.jsx(BillingFields, {
|
|
26504
|
+
form: form
|
|
26505
|
+
})
|
|
26506
|
+
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26522
26507
|
colSpan: 12
|
|
26523
26508
|
}, {
|
|
26524
26509
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
26525
|
-
css: styles$
|
|
26510
|
+
css: styles$2.subtitle,
|
|
26526
26511
|
variant: "subtitle1"
|
|
26527
26512
|
}, {
|
|
26528
26513
|
children: t("register-wallet:sections.billing.addressSubTitle")
|
|
@@ -26559,18 +26544,7 @@ const WalletForm = ({
|
|
|
26559
26544
|
}, {
|
|
26560
26545
|
children: editWalletAddressForm
|
|
26561
26546
|
}))]
|
|
26562
|
-
}),
|
|
26563
|
-
colSpan: 12
|
|
26564
|
-
}, {
|
|
26565
|
-
children: jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
26566
|
-
title: t("register-wallet:sections.notifications.error.title"),
|
|
26567
|
-
type: giger.NotificationType.ERROR
|
|
26568
|
-
}, {
|
|
26569
|
-
children: errors.map(({
|
|
26570
|
-
message
|
|
26571
|
-
}) => message).join(" ")
|
|
26572
|
-
}))
|
|
26573
|
-
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26547
|
+
}), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26574
26548
|
colSpan: 12
|
|
26575
26549
|
}, {
|
|
26576
26550
|
children: jsxRuntime.jsx(ButtonGroup, Object.assign({
|
|
@@ -26589,22 +26563,17 @@ const WalletForm = ({
|
|
|
26589
26563
|
}));
|
|
26590
26564
|
};
|
|
26591
26565
|
|
|
26592
|
-
const styles$
|
|
26593
|
-
lastStep: {
|
|
26594
|
-
"& > span::first-of-type": {
|
|
26595
|
-
"::after": {
|
|
26596
|
-
// TODO: Polish - match Figma as much as possible
|
|
26597
|
-
}
|
|
26598
|
-
},
|
|
26599
|
-
"& > span:last-child": {
|
|
26600
|
-
position: "static"
|
|
26601
|
-
}
|
|
26602
|
-
},
|
|
26566
|
+
const styles$1 = createStyles({
|
|
26603
26567
|
step: {
|
|
26604
26568
|
"& > span:last-child": {
|
|
26605
26569
|
position: "static"
|
|
26606
26570
|
}
|
|
26607
|
-
}
|
|
26571
|
+
},
|
|
26572
|
+
wrapper: theme => ({
|
|
26573
|
+
height: "100%",
|
|
26574
|
+
padding: theme.spacing(2),
|
|
26575
|
+
width: "100%"
|
|
26576
|
+
})
|
|
26608
26577
|
});
|
|
26609
26578
|
|
|
26610
26579
|
const Onboarding$1 = ({
|
|
@@ -26612,8 +26581,6 @@ const Onboarding$1 = ({
|
|
|
26612
26581
|
createWarehouse,
|
|
26613
26582
|
onCarrierCreated,
|
|
26614
26583
|
onWarehouseCreated,
|
|
26615
|
-
isLoadingDhl,
|
|
26616
|
-
isLoadingUps,
|
|
26617
26584
|
onCompleteOnboarding,
|
|
26618
26585
|
registerDhlCarrier,
|
|
26619
26586
|
registerDhlCarrierErrors,
|
|
@@ -26655,16 +26622,20 @@ const Onboarding$1 = ({
|
|
|
26655
26622
|
address
|
|
26656
26623
|
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26657
26624
|
setAddress(address);
|
|
26658
|
-
|
|
26659
|
-
address
|
|
26660
|
-
|
|
26661
|
-
|
|
26662
|
-
|
|
26663
|
-
|
|
26664
|
-
|
|
26665
|
-
|
|
26666
|
-
|
|
26667
|
-
|
|
26625
|
+
try {
|
|
26626
|
+
yield Promise.all([!hasUps && address && registerUpsCarrier({
|
|
26627
|
+
address,
|
|
26628
|
+
agreeToCarrierTerms: agreedToTerms,
|
|
26629
|
+
carrierCode: "ups",
|
|
26630
|
+
email,
|
|
26631
|
+
nickname: "ups"
|
|
26632
|
+
}), !hasDhl && registerDhlCarrier({
|
|
26633
|
+
carrierCode: "dhl_express_walleted",
|
|
26634
|
+
nickname: "dhl_express_walleted"
|
|
26635
|
+
})]);
|
|
26636
|
+
} catch (_a) {
|
|
26637
|
+
// Errors shown inline for recovery
|
|
26638
|
+
}
|
|
26668
26639
|
yield onCarrierCreated();
|
|
26669
26640
|
});
|
|
26670
26641
|
const handleCreateWarehouse = payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -26685,7 +26656,6 @@ const Onboarding$1 = ({
|
|
|
26685
26656
|
email: email,
|
|
26686
26657
|
nickname: "stamps_com"
|
|
26687
26658
|
});
|
|
26688
|
-
yield onCarrierCreated();
|
|
26689
26659
|
yield handleWalletRegistrationSuccess({
|
|
26690
26660
|
address
|
|
26691
26661
|
});
|
|
@@ -26736,11 +26706,6 @@ const Onboarding$1 = ({
|
|
|
26736
26706
|
});
|
|
26737
26707
|
}
|
|
26738
26708
|
if (hasStampsWallet) {
|
|
26739
|
-
if (isLoadingUps || isLoadingDhl) {
|
|
26740
|
-
return jsxRuntime.jsx(Loader, {
|
|
26741
|
-
message: t("loading.carriers")
|
|
26742
|
-
});
|
|
26743
|
-
}
|
|
26744
26709
|
// Step 4.1: Handle UPS Registration Errors
|
|
26745
26710
|
if (!hasUps && registerUpsCarrierErrors) {
|
|
26746
26711
|
return jsxRuntime.jsx(CarrierRecoveryForm, {
|
|
@@ -26765,27 +26730,29 @@ const Onboarding$1 = ({
|
|
|
26765
26730
|
});
|
|
26766
26731
|
}
|
|
26767
26732
|
}
|
|
26768
|
-
return
|
|
26733
|
+
return jsxRuntime.jsx(Loader, {});
|
|
26769
26734
|
};
|
|
26770
|
-
return jsxRuntime.jsxs(
|
|
26735
|
+
return jsxRuntime.jsxs("div", Object.assign({
|
|
26736
|
+
css: styles$1.wrapper
|
|
26737
|
+
}, {
|
|
26771
26738
|
children: [jsxRuntime.jsxs(giger.Stepper, Object.assign({
|
|
26772
26739
|
currentStep: currentStep
|
|
26773
26740
|
}, {
|
|
26774
26741
|
children: [jsxRuntime.jsx(giger.Step, {
|
|
26775
|
-
css: styles$
|
|
26742
|
+
css: styles$1.step,
|
|
26776
26743
|
label: t("onboarding:steps.login")
|
|
26777
26744
|
}), jsxRuntime.jsx(giger.Step, {
|
|
26778
|
-
css: styles$
|
|
26745
|
+
css: styles$1.step,
|
|
26779
26746
|
label: t("onboarding:steps.carriers")
|
|
26780
26747
|
}), jsxRuntime.jsx(giger.Step, {
|
|
26781
|
-
css: styles$
|
|
26748
|
+
css: styles$1.step,
|
|
26782
26749
|
label: t("onboarding:steps.addresses")
|
|
26783
26750
|
}), jsxRuntime.jsx(giger.Step, {
|
|
26784
|
-
css: styles$
|
|
26751
|
+
css: styles$1.step,
|
|
26785
26752
|
label: t("onboarding:steps.payment")
|
|
26786
26753
|
})]
|
|
26787
26754
|
})), renderStep()]
|
|
26788
|
-
});
|
|
26755
|
+
}));
|
|
26789
26756
|
};
|
|
26790
26757
|
|
|
26791
26758
|
let _ = t => t,
|
|
@@ -26915,7 +26882,7 @@ const Loader = props => {
|
|
|
26915
26882
|
}));
|
|
26916
26883
|
};
|
|
26917
26884
|
|
|
26918
|
-
const getStyles$
|
|
26885
|
+
const getStyles$3 = ({
|
|
26919
26886
|
isDisabled,
|
|
26920
26887
|
isSelected
|
|
26921
26888
|
} = {}) => createStyles({
|
|
@@ -27022,7 +26989,7 @@ const AddFundsForm = ({
|
|
|
27022
26989
|
})), jsxRuntime.jsx(Spacer, {
|
|
27023
26990
|
multiplier: 2
|
|
27024
26991
|
}), jsxRuntime.jsx(giger.ChipList, Object.assign({
|
|
27025
|
-
css: getStyles$
|
|
26992
|
+
css: getStyles$3().chipList,
|
|
27026
26993
|
onChange: idx => {
|
|
27027
26994
|
const chip = chips[idx];
|
|
27028
26995
|
setSelectedChip(chip);
|
|
@@ -27037,7 +27004,7 @@ const AddFundsForm = ({
|
|
|
27037
27004
|
}
|
|
27038
27005
|
}, {
|
|
27039
27006
|
children: chips.map(chip => jsxRuntime.jsx(giger.Chip, Object.assign({
|
|
27040
|
-
css: getStyles$
|
|
27007
|
+
css: getStyles$3({
|
|
27041
27008
|
isDisabled: chip.value < _minimumAmount,
|
|
27042
27009
|
isSelected: chip.value === selectedChip.value
|
|
27043
27010
|
}).chip,
|
|
@@ -27054,7 +27021,7 @@ const AddFundsForm = ({
|
|
|
27054
27021
|
multiplier: 1
|
|
27055
27022
|
}), jsxRuntime.jsx(MoneyInput, {
|
|
27056
27023
|
control: form.control,
|
|
27057
|
-
css: getStyles$
|
|
27024
|
+
css: getStyles$3().fundsInput,
|
|
27058
27025
|
defaultValue: {
|
|
27059
27026
|
amount: undefined,
|
|
27060
27027
|
currency: api.SE.Currency.USD
|
|
@@ -27122,7 +27089,7 @@ const InlineLabel = ({
|
|
|
27122
27089
|
}), children]
|
|
27123
27090
|
}));
|
|
27124
27091
|
|
|
27125
|
-
const getStyles$
|
|
27092
|
+
const getStyles$2 = balance => createStyles({
|
|
27126
27093
|
balanceText: theme => ({
|
|
27127
27094
|
color: balance === undefined ? theme.palette.alert.main : balance >= 0 ? theme.palette.secondary.dark : theme.palette.error.main
|
|
27128
27095
|
})
|
|
@@ -27145,7 +27112,7 @@ const CarrierBalance = ({
|
|
|
27145
27112
|
}, {
|
|
27146
27113
|
children: isLoadingCarrier || isRefetchingCarrier ? jsxRuntime.jsx(giger.Spinner, {}) : jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
27147
27114
|
bold: true,
|
|
27148
|
-
css: getStyles$
|
|
27115
|
+
css: getStyles$2(balance).balanceText
|
|
27149
27116
|
}, {
|
|
27150
27117
|
children: balance === undefined ? t("manage-funding:errors.balanceUnknown") : formatMoney({
|
|
27151
27118
|
amount: balance,
|
|
@@ -27206,7 +27173,7 @@ const Spread = ({
|
|
|
27206
27173
|
children: children
|
|
27207
27174
|
}));
|
|
27208
27175
|
|
|
27209
|
-
const getStyles = isCustomAmount => createStyles({
|
|
27176
|
+
const getStyles$1 = isCustomAmount => createStyles({
|
|
27210
27177
|
balanceText: theme => ({
|
|
27211
27178
|
color: theme.palette.secondary.dark
|
|
27212
27179
|
}),
|
|
@@ -27238,6 +27205,7 @@ const FundAndPurchase = ({
|
|
|
27238
27205
|
carrierId,
|
|
27239
27206
|
className,
|
|
27240
27207
|
disabled,
|
|
27208
|
+
isFundingEnabled,
|
|
27241
27209
|
isFundingRequired,
|
|
27242
27210
|
onSave,
|
|
27243
27211
|
purchaseAmount,
|
|
@@ -27265,14 +27233,14 @@ const FundAndPurchase = ({
|
|
|
27265
27233
|
});
|
|
27266
27234
|
// Automatically open the Add Funds form if the carrier's balance is insufficient.
|
|
27267
27235
|
React.useEffect(() => {
|
|
27268
|
-
if (isFundingRequired && (carrier === null || carrier === void 0 ? void 0 : carrier.balance) !== undefined && carrier.balance < purchaseAmount) setIsAddFundsFormOpen(true);
|
|
27269
|
-
}, [carrier === null || carrier === void 0 ? void 0 : carrier.balance, isFundingRequired, purchaseAmount]);
|
|
27236
|
+
if (isFundingEnabled && isFundingRequired && (carrier === null || carrier === void 0 ? void 0 : carrier.balance) !== undefined && carrier.balance < purchaseAmount) setIsAddFundsFormOpen(true);
|
|
27237
|
+
}, [carrier === null || carrier === void 0 ? void 0 : carrier.balance, isFundingEnabled, isFundingRequired, purchaseAmount]);
|
|
27270
27238
|
const renderActionButtons = (addFundsForm = {}) => jsxRuntime.jsxs(ButtonGroup, Object.assign({
|
|
27271
27239
|
justify: "end"
|
|
27272
27240
|
}, {
|
|
27273
27241
|
children: [jsxRuntime.jsx(giger.Button, Object.assign({
|
|
27274
27242
|
bold: false,
|
|
27275
|
-
css: getStyles().saveRateButton,
|
|
27243
|
+
css: getStyles$1().saveRateButton,
|
|
27276
27244
|
disabled: disabled || !carrierId || isAddingFunds || isCreatingLabel,
|
|
27277
27245
|
isLoading: isSavingRate,
|
|
27278
27246
|
onClick: handleSaveRate,
|
|
@@ -27281,16 +27249,18 @@ const FundAndPurchase = ({
|
|
|
27281
27249
|
children: t("purchase-label:actions.saveRate")
|
|
27282
27250
|
})), jsxRuntime.jsx(giger.Button, Object.assign({
|
|
27283
27251
|
"data-testid": "submit-fund-and-purchase",
|
|
27284
|
-
disabled: disabled || !carrierId || isFundingRequired && isAddFundsFormOpen && addFundsForm.isSubmitted && !addFundsForm.isValid,
|
|
27252
|
+
disabled: disabled || !carrierId || isFundingEnabled && isFundingRequired && isAddFundsFormOpen && addFundsForm.isSubmitted && !addFundsForm.isValid,
|
|
27285
27253
|
isLoading: addFundsForm.isSubmitting || isAddingFunds || isCreatingLabel,
|
|
27286
27254
|
onClick: isAddFundsFormOpen ? addFundsForm.submit : onPurchase
|
|
27287
27255
|
}, {
|
|
27288
27256
|
children: isAddFundsFormOpen ? t("manage-funding:actions.addFundsAndPurchase") : t("purchase-label:actions.purchaseNow")
|
|
27289
27257
|
}))]
|
|
27290
27258
|
}));
|
|
27259
|
+
// Render: not a walleted carrier;
|
|
27260
|
+
// don't show balance or funding form
|
|
27291
27261
|
if (!isFundingRequired) return jsxRuntime.jsx("div", Object.assign({
|
|
27292
27262
|
className: className,
|
|
27293
|
-
css: getStyles().container
|
|
27263
|
+
css: getStyles$1().container
|
|
27294
27264
|
}, {
|
|
27295
27265
|
children: renderActionButtons()
|
|
27296
27266
|
}));
|
|
@@ -27303,9 +27273,23 @@ const FundAndPurchase = ({
|
|
|
27303
27273
|
setIsAddFundsFormOpen(false);
|
|
27304
27274
|
onPurchase();
|
|
27305
27275
|
};
|
|
27276
|
+
// Render: walleted carrier, but funding feature is not enabled;
|
|
27277
|
+
// show balance, but not the funding form.
|
|
27278
|
+
if (!isFundingEnabled) return jsxRuntime.jsxs("div", Object.assign({
|
|
27279
|
+
className: className,
|
|
27280
|
+
css: getStyles$1().container
|
|
27281
|
+
}, {
|
|
27282
|
+
children: [jsxRuntime.jsx(CarrierBalance, {
|
|
27283
|
+
carrierId: carrierId
|
|
27284
|
+
}), jsxRuntime.jsx(Spacer, {
|
|
27285
|
+
multiplier: 2
|
|
27286
|
+
}), renderActionButtons()]
|
|
27287
|
+
}));
|
|
27288
|
+
// Render: walleted carrier and funding feature is enabled;
|
|
27289
|
+
// show balance and funding form
|
|
27306
27290
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
27307
27291
|
className: className,
|
|
27308
|
-
css: getStyles().container
|
|
27292
|
+
css: getStyles$1().container
|
|
27309
27293
|
}, {
|
|
27310
27294
|
children: [jsxRuntime.jsxs(Spread, {
|
|
27311
27295
|
children: [jsxRuntime.jsx(CarrierBalance, {
|
|
@@ -27336,13 +27320,13 @@ const FundAndPurchase = ({
|
|
|
27336
27320
|
var _a, _b;
|
|
27337
27321
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
27338
27322
|
children: [jsxRuntime.jsxs("section", Object.assign({
|
|
27339
|
-
css: getStyles(addFundsForm.isCustomAmount).formExtension
|
|
27323
|
+
css: getStyles$1(addFundsForm.isCustomAmount).formExtension
|
|
27340
27324
|
}, {
|
|
27341
27325
|
children: [jsxRuntime.jsx(InlineLabel, Object.assign({
|
|
27342
27326
|
label: t("manage-funding:fundAndPurchase.newBalance")
|
|
27343
27327
|
}, {
|
|
27344
27328
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
27345
|
-
css: getStyles().balanceText
|
|
27329
|
+
css: getStyles$1().balanceText
|
|
27346
27330
|
}, {
|
|
27347
27331
|
children: formatMoney({
|
|
27348
27332
|
amount: balance + ((_a = addFundsForm.selectedAmount) !== null && _a !== void 0 ? _a : 0),
|
|
@@ -27353,7 +27337,7 @@ const FundAndPurchase = ({
|
|
|
27353
27337
|
label: t("manage-funding:fundAndPurchase.finalBalance")
|
|
27354
27338
|
}, {
|
|
27355
27339
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
27356
|
-
css: getStyles().balanceText
|
|
27340
|
+
css: getStyles$1().balanceText
|
|
27357
27341
|
}, {
|
|
27358
27342
|
children: formatMoney({
|
|
27359
27343
|
amount: balance + ((_b = addFundsForm.selectedAmount) !== null && _b !== void 0 ? _b : 0) - purchaseAmount,
|
|
@@ -27379,7 +27363,7 @@ const FundAndPurchase = ({
|
|
|
27379
27363
|
}));
|
|
27380
27364
|
};
|
|
27381
27365
|
|
|
27382
|
-
const styles
|
|
27366
|
+
const styles = createStyles({
|
|
27383
27367
|
fundAndPurchase: theme => ({
|
|
27384
27368
|
borderTop: `1px solid ${theme.palette.gray.ultraLight}`
|
|
27385
27369
|
}),
|
|
@@ -27518,7 +27502,7 @@ const RateForm = ({
|
|
|
27518
27502
|
onClick: onSelectRate,
|
|
27519
27503
|
options: showHiddenRates ? rateOptions : filteredRateOptions
|
|
27520
27504
|
}), rateOptions.some(option => option.requiresAcknowledgement) && rateOptions.length > 5 && jsxRuntime.jsx(giger.Link, Object.assign({
|
|
27521
|
-
css: styles
|
|
27505
|
+
css: styles.showMoreOrLessRatesButton,
|
|
27522
27506
|
onClick: () => {
|
|
27523
27507
|
var _a;
|
|
27524
27508
|
setShowHiddenRates(!showHiddenRates);
|
|
@@ -27539,7 +27523,7 @@ const RateForm = ({
|
|
|
27539
27523
|
}))
|
|
27540
27524
|
}))]
|
|
27541
27525
|
}) : !isLoading && errors && !!errors.length ? null : jsxRuntime.jsxs("article", Object.assign({
|
|
27542
|
-
css: styles
|
|
27526
|
+
css: styles.ratesInterstitial,
|
|
27543
27527
|
role: "presentation"
|
|
27544
27528
|
}, {
|
|
27545
27529
|
children: [jsxRuntime.jsx(Cube, {
|
|
@@ -27559,8 +27543,9 @@ const RateForm = ({
|
|
|
27559
27543
|
})]
|
|
27560
27544
|
})), jsxRuntime.jsx(FundAndPurchase, {
|
|
27561
27545
|
carrierId: selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.carrierId,
|
|
27562
|
-
css: styles
|
|
27546
|
+
css: styles.fundAndPurchase,
|
|
27563
27547
|
disabled: disabled,
|
|
27548
|
+
isFundingEnabled: features === null || features === void 0 ? void 0 : features.enableFunding,
|
|
27564
27549
|
isFundingRequired: (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.balance) !== undefined && !!selectedRate.requiresFundedAmount,
|
|
27565
27550
|
onPurchase: handleSubmit,
|
|
27566
27551
|
onSave: handleSaveRate,
|
|
@@ -29157,26 +29142,35 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
29157
29142
|
WarehouseForm: WarehouseForm,
|
|
29158
29143
|
VoidLabel: VoidLabel$1,
|
|
29159
29144
|
WalletForm: WalletForm,
|
|
29160
|
-
styles: styles$
|
|
29145
|
+
styles: styles$2,
|
|
29161
29146
|
billingAddressSchema: billingAddressSchema,
|
|
29162
29147
|
walletSchema: walletSchema,
|
|
29163
29148
|
BillingFields: BillingFields
|
|
29164
29149
|
});
|
|
29165
29150
|
|
|
29166
|
-
const
|
|
29151
|
+
const getStyles = showForm => createStyles({
|
|
29152
|
+
edit: theme => ({
|
|
29153
|
+
color: theme.palette.primary.main,
|
|
29154
|
+
padding: `0 ${theme.spacing(2)}`
|
|
29155
|
+
}),
|
|
29167
29156
|
form: theme => ({
|
|
29168
29157
|
backgroundColor: theme.palette.gray.megaLight,
|
|
29169
|
-
display: "flex",
|
|
29158
|
+
display: showForm ? "flex" : "none",
|
|
29170
29159
|
flexDirection: "column",
|
|
29171
|
-
gap: theme.spacing(2),
|
|
29172
29160
|
padding: theme.spacing(2)
|
|
29173
|
-
})
|
|
29161
|
+
}),
|
|
29162
|
+
input: theme => ({
|
|
29163
|
+
width: theme.spacing(13)
|
|
29164
|
+
}),
|
|
29165
|
+
marginLeft: {
|
|
29166
|
+
marginLeft: "auto"
|
|
29167
|
+
}
|
|
29174
29168
|
});
|
|
29175
29169
|
|
|
29176
29170
|
const autoFundingSchema = zod.z.object({
|
|
29177
29171
|
isEnabled: zod.z.boolean(),
|
|
29178
29172
|
lowBalancePurchaseThreshold: moneySchema.extend({
|
|
29179
|
-
amount: zod.z.number().min(
|
|
29173
|
+
amount: zod.z.number().min(10)
|
|
29180
29174
|
}),
|
|
29181
29175
|
maximumPurchasesPerDay: zod.z.number().min(1),
|
|
29182
29176
|
purchaseAmount: moneySchema.extend({
|
|
@@ -29186,7 +29180,9 @@ const autoFundingSchema = zod.z.object({
|
|
|
29186
29180
|
|
|
29187
29181
|
/**
|
|
29188
29182
|
* This form that allows users to enable or disable auto funding, and
|
|
29189
|
-
* configure auto funding
|
|
29183
|
+
* configure auto funding rules in ShipEngine API.
|
|
29184
|
+
*
|
|
29185
|
+
* @param carrierId The carrierId of the carrier provider you wish to configure auto-funding rules for.
|
|
29190
29186
|
*/
|
|
29191
29187
|
const AutoFundingForm = ({
|
|
29192
29188
|
carrierId
|
|
@@ -29195,77 +29191,140 @@ const AutoFundingForm = ({
|
|
|
29195
29191
|
t
|
|
29196
29192
|
} = reactI18next.useTranslation();
|
|
29197
29193
|
const updateAutoFunding = react.useUpdateAutoFunding(carrierId);
|
|
29198
|
-
const autoFundingConfiguration = react.useGetAutoFundingConfiguration();
|
|
29194
|
+
const autoFundingConfiguration = react.useGetAutoFundingConfiguration(carrierId);
|
|
29195
|
+
const {
|
|
29196
|
+
data: autoFundingSettings
|
|
29197
|
+
} = autoFundingConfiguration;
|
|
29198
|
+
const [showForm, setShowForm] = React.useState(false);
|
|
29199
|
+
const [isSwitchOn, setIsSwitchOn] = React.useState(false);
|
|
29200
|
+
const styles = getStyles(showForm);
|
|
29199
29201
|
const form = reactHookForm.useForm({
|
|
29200
|
-
// TODO - [LMNT-663] We should probably make a hydration effect for autoFundingConfiguration.data
|
|
29201
|
-
defaultValues: autoFundingConfiguration.data,
|
|
29202
29202
|
resolver: validationResolver(autoFundingSchema)
|
|
29203
29203
|
});
|
|
29204
|
-
const {
|
|
29205
|
-
isDirty
|
|
29206
|
-
} = form.formState;
|
|
29207
29204
|
const watchIsEnabled = form.watch("isEnabled");
|
|
29205
|
+
const formReset = isEnabled => form.reset(values => Object.assign(Object.assign({}, values), {
|
|
29206
|
+
isEnabled
|
|
29207
|
+
}), {
|
|
29208
|
+
keepDirty: true
|
|
29209
|
+
});
|
|
29208
29210
|
const handleSubmit = formLogger.capture(form.handleSubmit(values => {
|
|
29211
|
+
setShowForm(prev => !prev);
|
|
29212
|
+
setIsSwitchOn(true);
|
|
29209
29213
|
const payload = values;
|
|
29210
29214
|
updateAutoFunding.mutate(payload, {
|
|
29211
29215
|
onSuccess: () => autoFundingConfiguration.refetch()
|
|
29212
29216
|
});
|
|
29213
29217
|
}));
|
|
29218
|
+
/**
|
|
29219
|
+
* This function toggles the form visibility and conditionally disables auto-funding
|
|
29220
|
+
* when falsy. This is because when someone toggles the enable auto-funding switch
|
|
29221
|
+
* off, they do not want to have auto-funding enabled at all.
|
|
29222
|
+
*/
|
|
29214
29223
|
const handleToggle = isEnabled => {
|
|
29215
|
-
|
|
29216
|
-
|
|
29217
|
-
|
|
29218
|
-
if (
|
|
29219
|
-
|
|
29220
|
-
|
|
29221
|
-
|
|
29222
|
-
onSuccess: x => autoFundingConfiguration.refetch()
|
|
29224
|
+
setIsSwitchOn(isEnabled);
|
|
29225
|
+
setShowForm(isEnabled);
|
|
29226
|
+
formReset(isEnabled);
|
|
29227
|
+
if (!isEnabled) {
|
|
29228
|
+
setIsSwitchOn(isEnabled);
|
|
29229
|
+
updateAutoFunding.mutate(form.getValues(), {
|
|
29230
|
+
onSuccess: () => autoFundingConfiguration.refetch()
|
|
29223
29231
|
});
|
|
29224
|
-
} else {
|
|
29225
|
-
// TODO - [LMNT-663] Should this throw?
|
|
29226
|
-
react.logger.error("Toggling auto-funding failed because autoFundingData is undefined.");
|
|
29227
29232
|
}
|
|
29228
29233
|
};
|
|
29229
|
-
if (autoFundingConfiguration.isLoading) return jsxRuntime.jsx(Loader, {
|
|
29234
|
+
if (autoFundingConfiguration.isLoading || updateAutoFunding.isLoading) return jsxRuntime.jsx(Loader, {
|
|
29230
29235
|
message: t("manage-funding:autoFunding.isLoading")
|
|
29231
29236
|
});
|
|
29237
|
+
if (!autoFundingSettings) throw new Error(t("errorMessages:unableToLoad.autoFundingSettings"));
|
|
29232
29238
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
29233
|
-
children: [jsxRuntime.
|
|
29234
|
-
|
|
29235
|
-
|
|
29236
|
-
|
|
29237
|
-
|
|
29238
|
-
|
|
29239
|
-
|
|
29240
|
-
|
|
29239
|
+
children: [jsxRuntime.jsxs(Spread, {
|
|
29240
|
+
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
29241
|
+
bold: !!(autoFundingSettings === null || autoFundingSettings === void 0 ? void 0 : autoFundingSettings.isAutoPurchaseEnabled),
|
|
29242
|
+
variant: "body1"
|
|
29243
|
+
}, {
|
|
29244
|
+
children: t("manage-funding:autoFunding:isEnabledCTA")
|
|
29245
|
+
})), jsxRuntime.jsx(Switch, {
|
|
29246
|
+
"data-testid": "auto-funding-toggle",
|
|
29247
|
+
defaultChecked: isSwitchOn,
|
|
29248
|
+
name: "isEnabled",
|
|
29249
|
+
onChange: e => handleToggle(e.target.checked),
|
|
29250
|
+
value: true
|
|
29251
|
+
})]
|
|
29252
|
+
}), jsxRuntime.jsx(Spacer, {
|
|
29253
|
+
multiplier: 1
|
|
29254
|
+
}), !!(autoFundingSettings === null || autoFundingSettings === void 0 ? void 0 : autoFundingSettings.isAutoPurchaseEnabled) && !showForm && jsxRuntime.jsxs(Spread, {
|
|
29255
|
+
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
29256
|
+
variant: "body1"
|
|
29257
|
+
}, {
|
|
29258
|
+
children: t("manage-funding:autoFunding.readSettings", Object.assign({}, autoFundingSettings))
|
|
29259
|
+
})), jsxRuntime.jsx(LinkAction, {
|
|
29260
|
+
css: styles.edit,
|
|
29261
|
+
onClick: () => handleToggle(true),
|
|
29262
|
+
title: t("manage-funding:autoFunding:edit")
|
|
29263
|
+
})]
|
|
29264
|
+
}), jsxRuntime.jsxs("form", Object.assign({
|
|
29241
29265
|
css: styles.form,
|
|
29266
|
+
"data-testid": "auto-funding-form",
|
|
29242
29267
|
id: "auto-funding-form",
|
|
29243
29268
|
onSubmit: handleSubmit
|
|
29244
29269
|
}, {
|
|
29245
|
-
children: [jsxRuntime.jsx(
|
|
29246
|
-
|
|
29247
|
-
|
|
29248
|
-
|
|
29249
|
-
|
|
29250
|
-
|
|
29251
|
-
|
|
29252
|
-
|
|
29253
|
-
|
|
29254
|
-
|
|
29255
|
-
|
|
29256
|
-
|
|
29257
|
-
|
|
29258
|
-
|
|
29259
|
-
|
|
29260
|
-
|
|
29261
|
-
|
|
29262
|
-
|
|
29263
|
-
|
|
29270
|
+
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
29271
|
+
bold: true,
|
|
29272
|
+
variant: "body1"
|
|
29273
|
+
}, {
|
|
29274
|
+
children: t("manage-funding:autoFunding:editSettings")
|
|
29275
|
+
})), jsxRuntime.jsx("div", Object.assign({
|
|
29276
|
+
css: styles.marginLeft
|
|
29277
|
+
}, {
|
|
29278
|
+
children: jsxRuntime.jsx(MoneyInput, {
|
|
29279
|
+
control: form.control,
|
|
29280
|
+
css: styles.input,
|
|
29281
|
+
"data-testid": "auto-funding-threshold-input",
|
|
29282
|
+
defaultValue: {
|
|
29283
|
+
amount: autoFundingSettings === null || autoFundingSettings === void 0 ? void 0 : autoFundingSettings.autoPurchaseThreshold,
|
|
29284
|
+
currency: api.Currency.USD
|
|
29285
|
+
},
|
|
29286
|
+
disabled: !watchIsEnabled,
|
|
29287
|
+
label: t("manage-funding:autoFunding.lowBalancePurchaseThreshold"),
|
|
29288
|
+
labelWeight: "normal",
|
|
29289
|
+
name: "lowBalancePurchaseThreshold",
|
|
29290
|
+
showCurrencySymbol: true
|
|
29291
|
+
})
|
|
29292
|
+
})), jsxRuntime.jsx("div", Object.assign({
|
|
29293
|
+
css: styles.marginLeft
|
|
29294
|
+
}, {
|
|
29295
|
+
children: jsxRuntime.jsx(MoneyInput, {
|
|
29296
|
+
control: form.control,
|
|
29297
|
+
css: styles.input,
|
|
29298
|
+
"data-testid": "auto-funding-purchase-amount-input",
|
|
29299
|
+
defaultValue: {
|
|
29300
|
+
amount: autoFundingSettings === null || autoFundingSettings === void 0 ? void 0 : autoFundingSettings.autoPurchaseAmount,
|
|
29301
|
+
currency: api.Currency.USD
|
|
29302
|
+
},
|
|
29303
|
+
disabled: !watchIsEnabled,
|
|
29304
|
+
label: t("manage-funding:autoFunding.purchaseAmount"),
|
|
29305
|
+
labelWeight: "normal",
|
|
29306
|
+
name: "purchaseAmount",
|
|
29307
|
+
showCurrencySymbol: true
|
|
29308
|
+
})
|
|
29309
|
+
})), jsxRuntime.jsx("div", Object.assign({
|
|
29310
|
+
css: styles.marginLeft
|
|
29311
|
+
}, {
|
|
29312
|
+
children: jsxRuntime.jsx(NumberInput, {
|
|
29313
|
+
control: form.control,
|
|
29314
|
+
css: styles.input,
|
|
29315
|
+
"data-testid": "auto-funding-max-per-day-input",
|
|
29316
|
+
defaultValue: autoFundingSettings === null || autoFundingSettings === void 0 ? void 0 : autoFundingSettings.autoPurchaseCutoff,
|
|
29317
|
+
disabled: !watchIsEnabled,
|
|
29318
|
+
isInteger: true,
|
|
29319
|
+
label: t("manage-funding:autoFunding.maximumPurchasesPerDay"),
|
|
29320
|
+
labelWeight: "normal",
|
|
29321
|
+
name: "maximumPurchasesPerDay"
|
|
29322
|
+
})
|
|
29323
|
+
})), jsxRuntime.jsxs(ButtonGroup, Object.assign({
|
|
29264
29324
|
justify: "end"
|
|
29265
29325
|
}, {
|
|
29266
29326
|
children: [jsxRuntime.jsx(giger.Button, Object.assign({
|
|
29267
|
-
|
|
29268
|
-
onClick: () => form.reset(),
|
|
29327
|
+
onClick: isSwitchOn ? () => setShowForm(false) : () => handleToggle(false),
|
|
29269
29328
|
variant: giger.ButtonVariant.TEXT
|
|
29270
29329
|
}, {
|
|
29271
29330
|
children: t("actions.cancel")
|
|
@@ -30372,8 +30431,7 @@ var common = {
|
|
|
30372
30431
|
differentBillingAddress: "Billing address is different from Ship From Address",
|
|
30373
30432
|
name: "Name on Card",
|
|
30374
30433
|
cardNumber: "Credit Card Number",
|
|
30375
|
-
|
|
30376
|
-
expirationYear: "Year",
|
|
30434
|
+
expiration: "Card Expiration",
|
|
30377
30435
|
cvv: "CVV"
|
|
30378
30436
|
}
|
|
30379
30437
|
},
|
|
@@ -30437,6 +30495,7 @@ var common = {
|
|
|
30437
30495
|
invalidNameOrCompany: "Recipient name and company name (if provided) must have two characters in first and last name.",
|
|
30438
30496
|
noWarehouses: "You must have an active warehouse in order to use this feature",
|
|
30439
30497
|
unableToLoad: {
|
|
30498
|
+
autoFundingSettings: "Unable to load auto funding settings",
|
|
30440
30499
|
carrier: "Unable to load carrier",
|
|
30441
30500
|
carriers: "Unable to load carriers",
|
|
30442
30501
|
salesOrder: "Unable to load order",
|
|
@@ -30567,16 +30626,19 @@ var manageFunding = {
|
|
|
30567
30626
|
saveRule: "Save Rule"
|
|
30568
30627
|
},
|
|
30569
30628
|
autoFunding: {
|
|
30570
|
-
|
|
30629
|
+
edit: "Edit",
|
|
30630
|
+
editSettings: "Edit Auto-Funding Settings",
|
|
30571
30631
|
error: {
|
|
30572
30632
|
title: "Auto-Funding Error",
|
|
30573
30633
|
message: "An error occurred while trying to configure to your auto-funding rules."
|
|
30574
30634
|
},
|
|
30635
|
+
isEnabledCTA: "Enable auto-funding",
|
|
30575
30636
|
isEnabled: "Enable Auto-Funding",
|
|
30576
30637
|
isLoading: "Loading auto-funding configuration...",
|
|
30577
|
-
lowBalancePurchaseThreshold: "
|
|
30578
|
-
maximumPurchasesPerDay: "Maximum
|
|
30579
|
-
purchaseAmount: "
|
|
30638
|
+
lowBalancePurchaseThreshold: "When balance falls below",
|
|
30639
|
+
maximumPurchasesPerDay: "Maximum times per day",
|
|
30640
|
+
purchaseAmount: "Add the following amount",
|
|
30641
|
+
readSettings: "When balance falls below ${{autoPurchaseThreshold}}, add ${{autoPurchaseAmount}} (maximum {{autoPurchaseCutoff}} times per day)."
|
|
30580
30642
|
},
|
|
30581
30643
|
addFunds: {
|
|
30582
30644
|
custom: "Custom...",
|
|
@@ -30588,7 +30650,8 @@ var manageFunding = {
|
|
|
30588
30650
|
labels: {
|
|
30589
30651
|
amount: "Amount"
|
|
30590
30652
|
},
|
|
30591
|
-
minimumPurchaseAmount: "Minimum Purchase $10.00"
|
|
30653
|
+
minimumPurchaseAmount: "Minimum Purchase $10.00",
|
|
30654
|
+
other: "Other..."
|
|
30592
30655
|
},
|
|
30593
30656
|
fundAndPurchase: {
|
|
30594
30657
|
finalBalance: "Final balance after payment:",
|
|
@@ -30758,7 +30821,7 @@ var registerWallet = {
|
|
|
30758
30821
|
billing: {
|
|
30759
30822
|
title: "Billing Management",
|
|
30760
30823
|
cardSubTitle: "Enter your credit card information",
|
|
30761
|
-
addressSubTitle: "
|
|
30824
|
+
addressSubTitle: "Billing Address",
|
|
30762
30825
|
info: "Your account balance handles the cost of labels, insurance and carrier adjustments."
|
|
30763
30826
|
},
|
|
30764
30827
|
carriers: {
|
|
@@ -31161,14 +31224,14 @@ const ManageWarehouses = () => {
|
|
|
31161
31224
|
returnAddress: payload.returnAddress,
|
|
31162
31225
|
warehouseId: warehouseId
|
|
31163
31226
|
});
|
|
31164
|
-
|
|
31227
|
+
yield refreshListWarehouses();
|
|
31165
31228
|
});
|
|
31166
31229
|
const handleSetDefault = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31167
31230
|
yield updateWarehouse(Object.assign(Object.assign({}, payload), {
|
|
31168
31231
|
isDefault: true,
|
|
31169
31232
|
warehouseId
|
|
31170
31233
|
}));
|
|
31171
|
-
|
|
31234
|
+
yield refreshListWarehouses();
|
|
31172
31235
|
});
|
|
31173
31236
|
if (isLoadingWarehouses) return jsxRuntime.jsx(Loader, {
|
|
31174
31237
|
message: t("loading.warehouses")
|
|
@@ -31797,9 +31860,6 @@ const ConfigureShipment = _a => {
|
|
|
31797
31860
|
const Onboarding = ({
|
|
31798
31861
|
onCompleteOnboarding
|
|
31799
31862
|
}) => {
|
|
31800
|
-
const {
|
|
31801
|
-
t
|
|
31802
|
-
} = reactI18next.useTranslation(["common", "register-wallet"]);
|
|
31803
31863
|
const {
|
|
31804
31864
|
data: warehouses,
|
|
31805
31865
|
refetch: refetchWarehouses
|
|
@@ -31817,13 +31877,11 @@ const Onboarding = ({
|
|
|
31817
31877
|
} = react.useConnectCarrier();
|
|
31818
31878
|
const {
|
|
31819
31879
|
error: registerUpsCarrierErrors,
|
|
31820
|
-
mutateAsync: registerUpsCarrier
|
|
31821
|
-
isLoading: isLoadingUps
|
|
31880
|
+
mutateAsync: registerUpsCarrier
|
|
31822
31881
|
} = react.useConnectCarrier();
|
|
31823
31882
|
const {
|
|
31824
31883
|
error: registerDhlCarrierErrors,
|
|
31825
|
-
mutateAsync: registerDhlCarrier
|
|
31826
|
-
isLoading: isLoadingDhl
|
|
31884
|
+
mutateAsync: registerDhlCarrier
|
|
31827
31885
|
} = react.useConnectCarrier();
|
|
31828
31886
|
const onWarehouseCreated = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
31829
31887
|
yield refetchWarehouses();
|
|
@@ -31831,17 +31889,11 @@ const Onboarding = ({
|
|
|
31831
31889
|
const onCarrierCreated = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
31832
31890
|
yield refetchCarriers();
|
|
31833
31891
|
}), [refetchCarriers]);
|
|
31834
|
-
if (!carriers) return jsxRuntime.jsx(Loader, {
|
|
31835
|
-
|
|
31836
|
-
});
|
|
31837
|
-
if (!warehouses) return jsxRuntime.jsx(Loader, {
|
|
31838
|
-
message: t("loading.warehouses")
|
|
31839
|
-
});
|
|
31892
|
+
if (!carriers) return jsxRuntime.jsx(Loader, {});
|
|
31893
|
+
if (!warehouses) return jsxRuntime.jsx(Loader, {});
|
|
31840
31894
|
return jsxRuntime.jsx(Onboarding$1, {
|
|
31841
31895
|
carriers: carriers,
|
|
31842
31896
|
createWarehouse: createWarehouse,
|
|
31843
|
-
isLoadingDhl: isLoadingDhl,
|
|
31844
|
-
isLoadingUps: isLoadingUps,
|
|
31845
31897
|
onCarrierCreated: onCarrierCreated,
|
|
31846
31898
|
onCompleteOnboarding: onCompleteOnboarding,
|
|
31847
31899
|
onWarehouseCreated: onWarehouseCreated,
|
|
@@ -32971,6 +33023,7 @@ exports.extendZod = extendZod;
|
|
|
32971
33023
|
exports.formLogger = formLogger;
|
|
32972
33024
|
exports.formatCreditCardNumber = formatCreditCardNumber;
|
|
32973
33025
|
exports.formatDate = formatDate;
|
|
33026
|
+
exports.formatExpiration = formatExpiration;
|
|
32974
33027
|
exports.formatFractionalWeight = formatFractionalWeight;
|
|
32975
33028
|
exports.formatMoney = formatMoney;
|
|
32976
33029
|
exports.fractionalWeightFactory = fractionalWeightFactory;
|