@shipengine/elements 0.16.1 → 0.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/auto-funding-form/auto-funding-form.d.ts +3 -1
- package/components/auto-funding-form/auto-funding-form.styles.d.ts +2 -1
- package/components/field/expiration-input/expiration-input.d.ts +3 -0
- package/components/field/expiration-input/index.d.ts +1 -0
- package/components/field/fields.d.ts +1 -0
- package/components/field/switch/switch.d.ts +1 -1
- package/components/fund-and-purchase/fund-and-purchase.d.ts +2 -1
- package/components/items-breakdown/items-breakdown.d.ts +1 -1
- package/components/templates/address-form/address-fields.styles.d.ts +1 -0
- package/components/templates/completion-page/completion-page.d.ts +4 -0
- package/components/templates/completion-page/index.d.ts +1 -0
- package/components/templates/index.d.ts +2 -1
- package/components/templates/list-carriers-row/list-carriers-row.styles.d.ts +1 -1
- package/components/templates/onboarding/onboarding.d.ts +1 -3
- package/components/templates/onboarding/onboarding.styles.d.ts +1 -1
- package/components/templates/rate-form/rate-form.d.ts +1 -0
- package/components/templates/shipment-form/shipment-form.d.ts +1 -1
- package/components/templates/suspend-sales-order/index.d.ts +1 -0
- package/components/templates/suspend-sales-order/suspend-sales-order.d.ts +8 -0
- package/components/templates/suspend-shipment/index.d.ts +1 -0
- package/components/templates/suspend-shipment/suspend-shipment.d.ts +8 -0
- package/components/templates/wallet-form/wallet-schema.d.ts +7 -12
- package/elements/components/configure-shipment/configure-shipment.d.ts +1 -1
- package/elements/components/configure-shipment/hooks/use-address.d.ts +1 -1
- package/elements/components/configure-shipment/hooks/use-shipment-form.d.ts +2 -2
- package/elements/components/index.d.ts +1 -1
- package/elements/components/{sales-order → purchase-label}/hooks/use-configure-shipment.d.ts +1 -1
- package/elements/components/purchase-label/hooks/use-load-shipment.d.ts +9 -0
- package/elements/components/purchase-label/index.d.ts +3 -0
- package/elements/components/{sales-order/sales-order.d.ts → purchase-label/purchase-label-by-sales-order.d.ts} +1 -1
- package/elements/components/purchase-label/purchase-label-by-shipment.d.ts +9 -0
- package/elements/components/purchase-label/purchase-label.d.ts +6 -0
- package/elements/purchase-label.d.ts +3 -1
- package/hooks/use-elements.d.ts +2 -1
- package/index.cjs +1733 -1548
- package/index.js +1734 -1551
- package/locales/en/index.d.ts +7 -3
- package/mocks/carriers/handlers.d.ts +3 -0
- package/mocks/warehouses/handlers.d.ts +12 -1
- package/package.json +3 -3
- package/utilities/money.d.ts +1 -0
- package/utilities/shipengine/sales-order.d.ts +10 -0
- package/components/templates/sales-order/index.d.ts +0 -1
- package/components/templates/sales-order/sales-order.d.ts +0 -8
- package/elements/components/sales-order/index.d.ts +0 -1
- /package/elements/components/{sales-order → purchase-label}/hooks/index.d.ts +0 -0
- /package/elements/components/{sales-order → purchase-label}/hooks/use-import-sales-order.d.ts +0 -0
- /package/elements/components/{sales-order → purchase-label}/hooks/use-pending-shipment.d.ts +0 -0
package/index.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,1073 +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
2250
|
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
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
|
-
};
|
|
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/;
|
|
2535
2255
|
|
|
2536
|
-
|
|
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
|
+
}
|
|
2537
2268
|
|
|
2538
|
-
|
|
2269
|
+
re.exec = function () { execCalled = true; return null; };
|
|
2539
2270
|
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
};
|
|
2271
|
+
re[SYMBOL]('');
|
|
2272
|
+
return !execCalled;
|
|
2273
|
+
});
|
|
2543
2274
|
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
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
|
+
});
|
|
2547
2295
|
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2296
|
+
defineBuiltIn$4(String.prototype, KEY, methods[0]);
|
|
2297
|
+
defineBuiltIn$4(RegExpPrototype$2, SYMBOL, methods[1]);
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2300
|
+
if (SHAM) createNonEnumerableProperty(RegExpPrototype$2[SYMBOL], 'sham', true);
|
|
2552
2301
|
};
|
|
2553
2302
|
|
|
2554
|
-
var
|
|
2555
|
-
var
|
|
2556
|
-
var
|
|
2303
|
+
var uncurryThis$d = functionUncurryThis;
|
|
2304
|
+
var toIntegerOrInfinity$4 = toIntegerOrInfinity$7;
|
|
2305
|
+
var toString$9 = toString$c;
|
|
2306
|
+
var requireObjectCoercible$5 = requireObjectCoercible$9;
|
|
2557
2307
|
|
|
2558
|
-
var $
|
|
2559
|
-
var
|
|
2308
|
+
var charAt$3 = uncurryThis$d(''.charAt);
|
|
2309
|
+
var charCodeAt = uncurryThis$d(''.charCodeAt);
|
|
2310
|
+
var stringSlice$5 = uncurryThis$d(''.slice);
|
|
2560
2311
|
|
|
2561
|
-
var
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
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
|
+
};
|
|
2569
2329
|
};
|
|
2570
2330
|
|
|
2571
|
-
var
|
|
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)
|
|
2338
|
+
};
|
|
2572
2339
|
|
|
2573
|
-
var
|
|
2340
|
+
var charAt$2 = stringMultibyte.charAt;
|
|
2574
2341
|
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
return
|
|
2579
|
-
array,
|
|
2580
|
-
mergeSort(arraySlice$2(array, 0, middle), comparefn),
|
|
2581
|
-
mergeSort(arraySlice$2(array, middle), comparefn),
|
|
2582
|
-
comparefn
|
|
2583
|
-
);
|
|
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);
|
|
2584
2346
|
};
|
|
2585
2347
|
|
|
2586
|
-
var
|
|
2587
|
-
|
|
2588
|
-
var i = 1;
|
|
2589
|
-
var element, j;
|
|
2348
|
+
var uncurryThis$c = functionUncurryThis;
|
|
2349
|
+
var toObject$3 = toObject$8;
|
|
2590
2350
|
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
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;
|
|
2357
|
+
|
|
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];
|
|
2596
2388
|
}
|
|
2597
|
-
|
|
2598
|
-
}
|
|
2389
|
+
return capture === undefined ? '' : capture;
|
|
2390
|
+
});
|
|
2599
2391
|
};
|
|
2600
2392
|
|
|
2601
|
-
var
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
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;
|
|
2606
2398
|
|
|
2607
|
-
|
|
2608
|
-
array[lindex + rindex] = (lindex < llength && rindex < rlength)
|
|
2609
|
-
? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
|
|
2610
|
-
: lindex < llength ? left[lindex++] : right[rindex++];
|
|
2611
|
-
} return array;
|
|
2612
|
-
};
|
|
2613
|
-
|
|
2614
|
-
var arraySort = mergeSort;
|
|
2615
|
-
|
|
2616
|
-
var userAgent$4 = engineUserAgent;
|
|
2617
|
-
|
|
2618
|
-
var firefox = userAgent$4.match(/firefox\/(\d+)/i);
|
|
2619
|
-
|
|
2620
|
-
var engineFfVersion = !!firefox && +firefox[1];
|
|
2621
|
-
|
|
2622
|
-
var UA = engineUserAgent;
|
|
2623
|
-
|
|
2624
|
-
var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
|
|
2625
|
-
|
|
2626
|
-
var userAgent$3 = engineUserAgent;
|
|
2627
|
-
|
|
2628
|
-
var webkit = userAgent$3.match(/AppleWebKit\/(\d+)\./);
|
|
2399
|
+
var $TypeError$9 = TypeError;
|
|
2629
2400
|
|
|
2630
|
-
|
|
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
|
+
};
|
|
2631
2413
|
|
|
2632
|
-
var
|
|
2633
|
-
var
|
|
2634
|
-
var
|
|
2635
|
-
var
|
|
2636
|
-
var lengthOfArrayLike$4 = lengthOfArrayLike$8;
|
|
2637
|
-
var deletePropertyOrThrow = deletePropertyOrThrow$1;
|
|
2638
|
-
var toString$9 = toString$c;
|
|
2414
|
+
var apply$1 = functionApply;
|
|
2415
|
+
var call$9 = functionCall;
|
|
2416
|
+
var uncurryThis$b = functionUncurryThis;
|
|
2417
|
+
var fixRegExpWellKnownSymbolLogic$1 = fixRegexpWellKnownSymbolLogic;
|
|
2639
2418
|
var fails$9 = fails$r;
|
|
2640
|
-
var
|
|
2641
|
-
var
|
|
2642
|
-
var
|
|
2643
|
-
var
|
|
2644
|
-
var
|
|
2645
|
-
var
|
|
2646
|
-
|
|
2647
|
-
var
|
|
2648
|
-
var
|
|
2649
|
-
var
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
var FAILS_ON_UNDEFINED = fails$9(function () {
|
|
2653
|
-
test.sort(undefined);
|
|
2654
|
-
});
|
|
2655
|
-
// V8 bug
|
|
2656
|
-
var FAILS_ON_NULL = fails$9(function () {
|
|
2657
|
-
test.sort(null);
|
|
2658
|
-
});
|
|
2659
|
-
// Old WebKit
|
|
2660
|
-
var STRICT_METHOD = arrayMethodIsStrict('sort');
|
|
2661
|
-
|
|
2662
|
-
var STABLE_SORT = !fails$9(function () {
|
|
2663
|
-
// feature detection can be too slow, so check engines versions
|
|
2664
|
-
if (V8) return V8 < 70;
|
|
2665
|
-
if (FF && FF > 3) return;
|
|
2666
|
-
if (IE_OR_EDGE) return true;
|
|
2667
|
-
if (WEBKIT) return WEBKIT < 603;
|
|
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;
|
|
2668
2431
|
|
|
2669
|
-
|
|
2670
|
-
|
|
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);
|
|
2671
2439
|
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2440
|
+
var maybeToString = function (it) {
|
|
2441
|
+
return it === undefined ? it : String(it);
|
|
2442
|
+
};
|
|
2675
2443
|
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
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
|
+
})();
|
|
2681
2450
|
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
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') === '';
|
|
2685
2455
|
}
|
|
2456
|
+
return false;
|
|
2457
|
+
})();
|
|
2686
2458
|
|
|
2687
|
-
|
|
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
|
+
});
|
|
2688
2469
|
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
}
|
|
2470
|
+
// @@replace logic
|
|
2471
|
+
fixRegExpWellKnownSymbolLogic$1('replace', function (_, nativeReplace, maybeCallNative) {
|
|
2472
|
+
var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
|
|
2693
2473
|
|
|
2694
|
-
return
|
|
2695
|
-
|
|
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);
|
|
2696
2489
|
|
|
2697
|
-
|
|
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
|
+
}
|
|
2698
2498
|
|
|
2699
|
-
var
|
|
2700
|
-
|
|
2701
|
-
if (y === undefined) return -1;
|
|
2702
|
-
if (x === undefined) return 1;
|
|
2703
|
-
if (comparefn !== undefined) return +comparefn(x, y) || 0;
|
|
2704
|
-
return toString$9(x) > toString$9(y) ? 1 : -1;
|
|
2705
|
-
};
|
|
2706
|
-
};
|
|
2499
|
+
var functionalReplace = isCallable$7(replaceValue);
|
|
2500
|
+
if (!functionalReplace) replaceValue = toString$8(replaceValue);
|
|
2707
2501
|
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
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;
|
|
2713
2511
|
|
|
2714
|
-
|
|
2512
|
+
push$1(results, result);
|
|
2513
|
+
if (!global) break;
|
|
2715
2514
|
|
|
2716
|
-
|
|
2515
|
+
var matchStr = toString$8(result[0]);
|
|
2516
|
+
if (matchStr === '') rx.lastIndex = advanceStringIndex$1(S, toLength$2(rx.lastIndex), fullUnicode);
|
|
2517
|
+
}
|
|
2717
2518
|
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2519
|
+
var accumulatedResult = '';
|
|
2520
|
+
var nextSourcePosition = 0;
|
|
2521
|
+
for (var i = 0; i < results.length; i++) {
|
|
2522
|
+
result = results[i];
|
|
2721
2523
|
|
|
2722
|
-
|
|
2723
|
-
|
|
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);
|
|
2724
2547
|
}
|
|
2548
|
+
];
|
|
2549
|
+
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
|
|
2725
2550
|
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
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
|
+
};
|
|
2730
2578
|
|
|
2731
|
-
|
|
2732
|
-
while (index < arrayLength) deletePropertyOrThrow(array, index++);
|
|
2579
|
+
const isString = x => typeof x === "string";
|
|
2733
2580
|
|
|
2734
|
-
|
|
2581
|
+
const getRateRequiresAcknowledgement = serviceCode => {
|
|
2582
|
+
switch (serviceCode) {
|
|
2583
|
+
case "usps_media_mail":
|
|
2584
|
+
return true;
|
|
2585
|
+
default:
|
|
2586
|
+
return false;
|
|
2735
2587
|
}
|
|
2736
|
-
}
|
|
2588
|
+
};
|
|
2589
|
+
const getTotalRateAmount = (rateCosts = {}) => calculateTotal(...Object.values(rateCosts));
|
|
2737
2590
|
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
const getPendingShipment = shipments => shipments === null || shipments === void 0 ? void 0 : shipments.filter(s => s.shipmentStatus === "pending").sort(sortByCreationDate)[0];
|
|
2756
|
-
|
|
2757
|
-
function convertWeight(weight) {
|
|
2758
|
-
if ("value" in weight) {
|
|
2759
|
-
const valueAsLbs = weight.value / 16;
|
|
2760
|
-
return {
|
|
2761
|
-
fractional: (valueAsLbs - Math.floor(valueAsLbs)) * 16,
|
|
2762
|
-
whole: Math.floor(valueAsLbs)
|
|
2763
|
-
};
|
|
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;
|
|
2764
2608
|
}
|
|
2765
|
-
return {
|
|
2766
|
-
unit: "ounce",
|
|
2767
|
-
value: (weight.whole || 0) * 16 + (weight.fractional || 0)
|
|
2768
|
-
};
|
|
2769
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
|
|
2784
|
+
|
|
2770
2785
|
/**
|
|
2771
2786
|
* @category Utilities
|
|
2772
2787
|
*/
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
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
|
+
};
|
|
2792
|
+
/**
|
|
2793
|
+
* @category Utilities
|
|
2794
|
+
*/
|
|
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
|
+
};
|
|
2799
|
+
/**
|
|
2800
|
+
* @category Utilities
|
|
2801
|
+
*/
|
|
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));
|
|
2785
2817
|
|
|
2786
|
-
var
|
|
2787
|
-
var
|
|
2788
|
-
var
|
|
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
|
+
});
|
|
2789
2827
|
|
|
2790
|
-
|
|
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);
|
|
2833
|
+
}
|
|
2834
|
+
});
|
|
2791
2835
|
|
|
2792
|
-
//
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
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
|
+
});
|
|
2853
|
+
}
|
|
2854
|
+
|
|
2855
|
+
/**
|
|
2856
|
+
* @category Utilities
|
|
2857
|
+
*/
|
|
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 : [];
|
|
2797
2901
|
};
|
|
2798
2902
|
|
|
2799
|
-
var
|
|
2903
|
+
var tryToString$3 = tryToString$5;
|
|
2800
2904
|
|
|
2801
2905
|
var $TypeError$8 = TypeError;
|
|
2802
2906
|
|
|
2803
|
-
var
|
|
2804
|
-
if (
|
|
2805
|
-
throw $TypeError$8("The method doesn't accept regular expressions");
|
|
2806
|
-
} return it;
|
|
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));
|
|
2807
2909
|
};
|
|
2808
2910
|
|
|
2809
|
-
var
|
|
2911
|
+
var toPropertyKey = toPropertyKey$3;
|
|
2912
|
+
var definePropertyModule$1 = objectDefineProperty;
|
|
2913
|
+
var createPropertyDescriptor = createPropertyDescriptor$4;
|
|
2810
2914
|
|
|
2811
|
-
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
|
+
};
|
|
2812
2920
|
|
|
2813
|
-
var
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
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;
|
|
2823
2936
|
};
|
|
2824
2937
|
|
|
2825
|
-
var
|
|
2826
|
-
var uncurryThis$e = functionUncurryThis;
|
|
2827
|
-
var notARegExp$1 = notARegexp;
|
|
2828
|
-
var requireObjectCoercible$5 = requireObjectCoercible$9;
|
|
2829
|
-
var toString$8 = toString$c;
|
|
2830
|
-
var correctIsRegExpLogic$1 = correctIsRegexpLogic;
|
|
2938
|
+
var arraySlice$2 = arraySliceSimple;
|
|
2831
2939
|
|
|
2832
|
-
var
|
|
2940
|
+
var floor$1 = Math.floor;
|
|
2833
2941
|
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
});
|
|
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
|
+
);
|
|
2951
|
+
};
|
|
2845
2952
|
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2953
|
+
var insertionSort = function (array, comparefn) {
|
|
2954
|
+
var length = array.length;
|
|
2955
|
+
var i = 1;
|
|
2956
|
+
var element, j;
|
|
2957
|
+
|
|
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
|
+
};
|
|
2967
|
+
|
|
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;
|
|
2973
|
+
|
|
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;
|
|
2851
2979
|
};
|
|
2852
2980
|
|
|
2853
|
-
|
|
2981
|
+
var arraySort = mergeSort;
|
|
2854
2982
|
|
|
2855
|
-
|
|
2856
|
-
* Creates a Record of Emotion styles.
|
|
2857
|
-
*
|
|
2858
|
-
* Values may be any variant that a `css` prop can accept (a CSSObject, SerializedStyles, a FunctionInterpolation with theme, etc).
|
|
2859
|
-
*
|
|
2860
|
-
* Eliminates the need to explicitly type styles (while remaining fully typed w/ autocomplete).
|
|
2861
|
-
*
|
|
2862
|
-
* @example
|
|
2863
|
-
* ```
|
|
2864
|
-
* const styles = createStyles({
|
|
2865
|
-
* container: (theme) => ({ backgroundColor: theme.colors.primary }),
|
|
2866
|
-
* icon: { color: 'red' },
|
|
2867
|
-
* });
|
|
2868
|
-
* ```
|
|
2869
|
-
*/
|
|
2870
|
-
const createStyles = styles => styles;
|
|
2983
|
+
var userAgent$4 = engineUserAgent;
|
|
2871
2984
|
|
|
2872
|
-
|
|
2873
|
-
const meta = __rest(error, ["code", "message", "path"]);
|
|
2874
|
-
return JSON.stringify(Object.assign({
|
|
2875
|
-
message: translationKey
|
|
2876
|
-
}, meta));
|
|
2877
|
-
};
|
|
2878
|
-
/**
|
|
2879
|
-
* @category Utilities
|
|
2880
|
-
*/
|
|
2881
|
-
const errorMap = (issue, ctx) => {
|
|
2882
|
-
let messageCode;
|
|
2883
|
-
// TODO - Fill in the rest of the codes (positive, max, etc)
|
|
2884
|
-
switch (issue.code) {
|
|
2885
|
-
// Invalid Type
|
|
2886
|
-
case zod.z.ZodIssueCode.invalid_type:
|
|
2887
|
-
switch (issue.received) {
|
|
2888
|
-
case "null":
|
|
2889
|
-
case "undefined":
|
|
2890
|
-
messageCode = "schemaErrors.required";
|
|
2891
|
-
break;
|
|
2892
|
-
}
|
|
2893
|
-
break;
|
|
2894
|
-
case zod.z.ZodIssueCode.invalid_string:
|
|
2895
|
-
messageCode = "schemaErrors.invalidString";
|
|
2896
|
-
break;
|
|
2897
|
-
case zod.z.ZodIssueCode.too_small:
|
|
2898
|
-
switch (issue.type) {
|
|
2899
|
-
case "number":
|
|
2900
|
-
if (issue.minimum === 0) {
|
|
2901
|
-
messageCode = issue.inclusive ? "schemaErrors.nonnegative" : "schemaErrors.positive";
|
|
2902
|
-
}
|
|
2903
|
-
break;
|
|
2904
|
-
case "string":
|
|
2905
|
-
messageCode = buildError("schemaErrors.tooFewCharacters", issue);
|
|
2906
|
-
break;
|
|
2907
|
-
}
|
|
2908
|
-
break;
|
|
2909
|
-
case zod.z.ZodIssueCode.too_big:
|
|
2910
|
-
switch (issue.type) {
|
|
2911
|
-
case "string":
|
|
2912
|
-
messageCode = buildError("schemaErrors.tooManyCharacters", issue);
|
|
2913
|
-
break;
|
|
2914
|
-
}
|
|
2915
|
-
break;
|
|
2916
|
-
}
|
|
2917
|
-
return {
|
|
2918
|
-
message: messageCode !== null && messageCode !== void 0 ? messageCode : ctx.defaultError
|
|
2919
|
-
};
|
|
2920
|
-
};
|
|
2921
|
-
/**
|
|
2922
|
-
* @category Utilities
|
|
2923
|
-
*/
|
|
2924
|
-
const validationResolver = schema => (values, context, resolverOptions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2925
|
-
const getValidationResult = () => zod$1.zodResolver(schema, {
|
|
2926
|
-
errorMap
|
|
2927
|
-
})(values, undefined, resolverOptions);
|
|
2928
|
-
const validationResult = yield formLogger.isSubmitting ? formLogger.log(values, getValidationResult) : getValidationResult();
|
|
2929
|
-
return validationResult;
|
|
2930
|
-
});
|
|
2985
|
+
var firefox = userAgent$4.match(/firefox\/(\d+)/i);
|
|
2931
2986
|
|
|
2932
|
-
|
|
2933
|
-
var {
|
|
2934
|
-
children,
|
|
2935
|
-
justify,
|
|
2936
|
-
toolbar = false
|
|
2937
|
-
} = _a,
|
|
2938
|
-
props = __rest(_a, ["children", "justify", "toolbar"]);
|
|
2939
|
-
const styles = {
|
|
2940
|
-
group: theme => Object.assign({
|
|
2941
|
-
alignItems: "center",
|
|
2942
|
-
display: "flex",
|
|
2943
|
-
justifyContent: justify,
|
|
2944
|
-
width: "100%"
|
|
2945
|
-
}, toolbar ? {
|
|
2946
|
-
"& > button": {
|
|
2947
|
-
"&:not(:first-of-type)": {
|
|
2948
|
-
borderBottomLeftRadius: 0,
|
|
2949
|
-
borderTopLeftRadius: 0
|
|
2950
|
-
},
|
|
2951
|
-
"&:not(:last-child)": {
|
|
2952
|
-
borderBottomRightRadius: 0,
|
|
2953
|
-
borderTopRightRadius: 0
|
|
2954
|
-
}
|
|
2955
|
-
}
|
|
2956
|
-
} : {
|
|
2957
|
-
gap: theme.spacing(2)
|
|
2958
|
-
})
|
|
2959
|
-
};
|
|
2960
|
-
return jsxRuntime.jsx("div", Object.assign({}, props, {
|
|
2961
|
-
css: styles.group,
|
|
2962
|
-
role: "group"
|
|
2963
|
-
}, {
|
|
2964
|
-
children: children
|
|
2965
|
-
}));
|
|
2966
|
-
};
|
|
2987
|
+
var engineFfVersion = !!firefox && +firefox[1];
|
|
2967
2988
|
|
|
2968
|
-
var
|
|
2989
|
+
var UA = engineUserAgent;
|
|
2969
2990
|
|
|
2970
|
-
var
|
|
2971
|
-
var apply$2 = FunctionPrototype.apply;
|
|
2972
|
-
var call$b = FunctionPrototype.call;
|
|
2991
|
+
var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
|
|
2973
2992
|
|
|
2974
|
-
|
|
2975
|
-
var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$b.bind(apply$2) : function () {
|
|
2976
|
-
return call$b.apply(apply$2, arguments);
|
|
2977
|
-
});
|
|
2993
|
+
var userAgent$3 = engineUserAgent;
|
|
2978
2994
|
|
|
2979
|
-
var
|
|
2980
|
-
var uncurryThis$d = functionUncurryThis;
|
|
2995
|
+
var webkit = userAgent$3.match(/AppleWebKit\/(\d+)\./);
|
|
2981
2996
|
|
|
2982
|
-
var
|
|
2983
|
-
// Nashorn bug:
|
|
2984
|
-
// https://github.com/zloirock/core-js/issues/1128
|
|
2985
|
-
// https://github.com/zloirock/core-js/issues/1130
|
|
2986
|
-
if (classofRaw(fn) === 'Function') return uncurryThis$d(fn);
|
|
2987
|
-
};
|
|
2997
|
+
var engineWebkitVersion = !!webkit && +webkit[1];
|
|
2988
2998
|
|
|
2989
|
-
|
|
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;
|
|
2990
3013
|
|
|
2991
|
-
var
|
|
2992
|
-
var
|
|
2993
|
-
var
|
|
2994
|
-
var fails$8 = fails$r;
|
|
2995
|
-
var wellKnownSymbol$8 = wellKnownSymbol$j;
|
|
2996
|
-
var createNonEnumerableProperty = createNonEnumerableProperty$5;
|
|
3014
|
+
var test = [];
|
|
3015
|
+
var nativeSort = uncurryThis$a(test.sort);
|
|
3016
|
+
var push = uncurryThis$a(test.push);
|
|
2997
3017
|
|
|
2998
|
-
|
|
2999
|
-
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');
|
|
3000
3028
|
|
|
3001
|
-
var
|
|
3002
|
-
|
|
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;
|
|
3003
3035
|
|
|
3004
|
-
var
|
|
3005
|
-
|
|
3006
|
-
var O = {};
|
|
3007
|
-
O[SYMBOL] = function () { return 7; };
|
|
3008
|
-
return ''[KEY](O) != 7;
|
|
3009
|
-
});
|
|
3036
|
+
var result = '';
|
|
3037
|
+
var code, chr, value, index;
|
|
3010
3038
|
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
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);
|
|
3015
3042
|
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
re = {};
|
|
3021
|
-
// RegExp[@@split] doesn't call the regex's exec method, but first creates
|
|
3022
|
-
// a new one. We need to return the patched regex when creating the new one.
|
|
3023
|
-
re.constructor = {};
|
|
3024
|
-
re.constructor[SPECIES$4] = function () { return re; };
|
|
3025
|
-
re.flags = '';
|
|
3026
|
-
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;
|
|
3027
3047
|
}
|
|
3028
3048
|
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
});
|
|
3049
|
+
for (index = 0; index < 47; index++) {
|
|
3050
|
+
test.push({ k: chr + index, v: value });
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3034
3053
|
|
|
3035
|
-
|
|
3036
|
-
!DELEGATES_TO_SYMBOL ||
|
|
3037
|
-
!DELEGATES_TO_EXEC ||
|
|
3038
|
-
FORCED
|
|
3039
|
-
) {
|
|
3040
|
-
var uncurriedNativeRegExpMethod = uncurryThis$c(/./[SYMBOL]);
|
|
3041
|
-
var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
|
3042
|
-
var uncurriedNativeMethod = uncurryThis$c(nativeMethod);
|
|
3043
|
-
var $exec = regexp.exec;
|
|
3044
|
-
if ($exec === regexpExec$1 || $exec === RegExpPrototype$2.exec) {
|
|
3045
|
-
if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
|
|
3046
|
-
// The native String method already delegates to @@method (this
|
|
3047
|
-
// polyfilled function), leasing to infinite recursion.
|
|
3048
|
-
// We avoid it by directly calling the native @@method method.
|
|
3049
|
-
return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
|
|
3050
|
-
}
|
|
3051
|
-
return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
|
|
3052
|
-
}
|
|
3053
|
-
return { done: false };
|
|
3054
|
-
});
|
|
3054
|
+
test.sort(function (a, b) { return b.v - a.v; });
|
|
3055
3055
|
|
|
3056
|
-
|
|
3057
|
-
|
|
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;
|
|
3058
3059
|
}
|
|
3059
3060
|
|
|
3060
|
-
|
|
3061
|
-
};
|
|
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);
|
|
3062
3082
|
|
|
3063
|
-
|
|
3064
|
-
var toIntegerOrInfinity$4 = toIntegerOrInfinity$7;
|
|
3065
|
-
var toString$7 = toString$c;
|
|
3066
|
-
var requireObjectCoercible$4 = requireObjectCoercible$9;
|
|
3083
|
+
if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
|
|
3067
3084
|
|
|
3068
|
-
var
|
|
3069
|
-
var
|
|
3070
|
-
var
|
|
3085
|
+
var items = [];
|
|
3086
|
+
var arrayLength = lengthOfArrayLike$4(array);
|
|
3087
|
+
var itemsLength, index;
|
|
3071
3088
|
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
var position = toIntegerOrInfinity$4(pos);
|
|
3076
|
-
var size = S.length;
|
|
3077
|
-
var first, second;
|
|
3078
|
-
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
|
3079
|
-
first = charCodeAt(S, position);
|
|
3080
|
-
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
|
3081
|
-
|| (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
|
|
3082
|
-
? CONVERT_TO_STRING
|
|
3083
|
-
? charAt$3(S, position)
|
|
3084
|
-
: first
|
|
3085
|
-
: CONVERT_TO_STRING
|
|
3086
|
-
? stringSlice$5(S, position, position + 2)
|
|
3087
|
-
: (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
|
3088
|
-
};
|
|
3089
|
-
};
|
|
3089
|
+
for (index = 0; index < arrayLength; index++) {
|
|
3090
|
+
if (index in array) push(items, array[index]);
|
|
3091
|
+
}
|
|
3090
3092
|
|
|
3091
|
-
|
|
3092
|
-
// `String.prototype.codePointAt` method
|
|
3093
|
-
// https://tc39.es/ecma262/#sec-string.prototype.codepointat
|
|
3094
|
-
codeAt: createMethod(false),
|
|
3095
|
-
// `String.prototype.at` method
|
|
3096
|
-
// https://github.com/mathiasbynens/String.prototype.at
|
|
3097
|
-
charAt: createMethod(true)
|
|
3098
|
-
};
|
|
3093
|
+
internalSort(items, getSortCompare(comparefn));
|
|
3099
3094
|
|
|
3100
|
-
|
|
3095
|
+
itemsLength = lengthOfArrayLike$4(items);
|
|
3096
|
+
index = 0;
|
|
3101
3097
|
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
var advanceStringIndex$2 = function (S, index, unicode) {
|
|
3105
|
-
return index + (unicode ? charAt$2(S, index).length : 1);
|
|
3106
|
-
};
|
|
3098
|
+
while (index < itemsLength) array[index] = items[index++];
|
|
3099
|
+
while (index < arrayLength) deletePropertyOrThrow(array, index++);
|
|
3107
3100
|
|
|
3108
|
-
|
|
3109
|
-
|
|
3101
|
+
return array;
|
|
3102
|
+
}
|
|
3103
|
+
});
|
|
3110
3104
|
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
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];
|
|
3117
3123
|
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
namedCaptures = toObject$2(namedCaptures);
|
|
3126
|
-
symbols = SUBSTITUTION_SYMBOLS;
|
|
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
|
+
};
|
|
3127
3131
|
}
|
|
3128
|
-
return
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
}
|
|
3149
|
-
return capture === undefined ? '' : capture;
|
|
3150
|
-
});
|
|
3151
|
-
};
|
|
3132
|
+
return {
|
|
3133
|
+
unit: "ounce",
|
|
3134
|
+
value: (weight.whole || 0) * 16 + (weight.fractional || 0)
|
|
3135
|
+
};
|
|
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
|
+
}
|
|
3152
3152
|
|
|
3153
|
-
var
|
|
3154
|
-
var anObject$8 = anObject$f;
|
|
3155
|
-
var isCallable$8 = isCallable$o;
|
|
3153
|
+
var isObject$3 = isObject$a;
|
|
3156
3154
|
var classof$3 = classofRaw$2;
|
|
3157
|
-
var
|
|
3155
|
+
var wellKnownSymbol$8 = wellKnownSymbol$j;
|
|
3156
|
+
|
|
3157
|
+
var MATCH$1 = wellKnownSymbol$8('match');
|
|
3158
|
+
|
|
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');
|
|
3164
|
+
};
|
|
3165
|
+
|
|
3166
|
+
var isRegExp = isRegexp;
|
|
3158
3167
|
|
|
3159
3168
|
var $TypeError$7 = TypeError;
|
|
3160
3169
|
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
if (isCallable$8(exec)) {
|
|
3166
|
-
var result = call$a(exec, R, S);
|
|
3167
|
-
if (result !== null) anObject$8(result);
|
|
3168
|
-
return result;
|
|
3169
|
-
}
|
|
3170
|
-
if (classof$3(R) === 'RegExp') return call$a(regexpExec, R, S);
|
|
3171
|
-
throw $TypeError$7('RegExp#exec called on incompatible receiver');
|
|
3170
|
+
var notARegexp = function (it) {
|
|
3171
|
+
if (isRegExp(it)) {
|
|
3172
|
+
throw $TypeError$7("The method doesn't accept regular expressions");
|
|
3173
|
+
} return it;
|
|
3172
3174
|
};
|
|
3173
3175
|
|
|
3174
|
-
var apply$1 = functionApply;
|
|
3175
|
-
var call$9 = functionCall;
|
|
3176
|
-
var uncurryThis$9 = functionUncurryThis;
|
|
3177
|
-
var fixRegExpWellKnownSymbolLogic$1 = fixRegexpWellKnownSymbolLogic;
|
|
3178
|
-
var fails$7 = fails$r;
|
|
3179
|
-
var anObject$7 = anObject$f;
|
|
3180
|
-
var isCallable$7 = isCallable$o;
|
|
3181
|
-
var isNullOrUndefined$3 = isNullOrUndefined$6;
|
|
3182
|
-
var toIntegerOrInfinity$3 = toIntegerOrInfinity$7;
|
|
3183
|
-
var toLength$2 = toLength$4;
|
|
3184
|
-
var toString$6 = toString$c;
|
|
3185
|
-
var requireObjectCoercible$3 = requireObjectCoercible$9;
|
|
3186
|
-
var advanceStringIndex$1 = advanceStringIndex$2;
|
|
3187
|
-
var getMethod$3 = getMethod$5;
|
|
3188
|
-
var getSubstitution = getSubstitution$1;
|
|
3189
|
-
var regExpExec$1 = regexpExecAbstract;
|
|
3190
3176
|
var wellKnownSymbol$7 = wellKnownSymbol$j;
|
|
3191
3177
|
|
|
3192
|
-
var
|
|
3193
|
-
var max = Math.max;
|
|
3194
|
-
var min$1 = Math.min;
|
|
3195
|
-
var concat = uncurryThis$9([].concat);
|
|
3196
|
-
var push = uncurryThis$9([].push);
|
|
3197
|
-
var stringIndexOf = uncurryThis$9(''.indexOf);
|
|
3198
|
-
var stringSlice$3 = uncurryThis$9(''.slice);
|
|
3178
|
+
var MATCH = wellKnownSymbol$7('match');
|
|
3199
3179
|
|
|
3200
|
-
var
|
|
3201
|
-
|
|
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;
|
|
3202
3190
|
};
|
|
3203
3191
|
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
var
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3192
|
+
var $$e = _export;
|
|
3193
|
+
var uncurryThis$9 = functionUncurryThis;
|
|
3194
|
+
var notARegExp$1 = notARegexp;
|
|
3195
|
+
var requireObjectCoercible$3 = requireObjectCoercible$9;
|
|
3196
|
+
var toString$6 = toString$c;
|
|
3197
|
+
var correctIsRegExpLogic$1 = correctIsRegexpLogic;
|
|
3210
3198
|
|
|
3211
|
-
|
|
3212
|
-
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
|
|
3213
|
-
if (/./[REPLACE]) {
|
|
3214
|
-
return /./[REPLACE]('a', '$0') === '';
|
|
3215
|
-
}
|
|
3216
|
-
return false;
|
|
3217
|
-
})();
|
|
3199
|
+
var stringIndexOf = uncurryThis$9(''.indexOf);
|
|
3218
3200
|
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
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
|
+
);
|
|
3210
|
+
}
|
|
3228
3211
|
});
|
|
3229
3212
|
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3213
|
+
/**
|
|
3214
|
+
* @category Utilities
|
|
3215
|
+
*/
|
|
3216
|
+
const isFlatRatePackageCode = packageCode => {
|
|
3217
|
+
return packageCode ? packageCode.includes("flat_rate") : false;
|
|
3218
|
+
};
|
|
3233
3219
|
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
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;
|
|
3249
3238
|
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
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;
|
|
3257
3259
|
}
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
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;
|
|
3266
3274
|
}
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
if (!global) break;
|
|
3274
|
-
|
|
3275
|
-
var matchStr = toString$6(result[0]);
|
|
3276
|
-
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;
|
|
3277
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
|
+
});
|
|
3278
3298
|
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
if (position >= nextSourcePosition) {
|
|
3302
|
-
accumulatedResult += stringSlice$3(S, nextSourcePosition, position) + replacement;
|
|
3303
|
-
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
|
|
3304
3321
|
}
|
|
3305
3322
|
}
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
}
|
|
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
|
+
};
|
|
3310
3334
|
|
|
3311
3335
|
const FieldLabel = ({
|
|
3312
3336
|
children,
|
|
@@ -3328,8 +3352,9 @@ const FieldLabel = ({
|
|
|
3328
3352
|
}, {
|
|
3329
3353
|
children: [label && jsxRuntime.jsxs("div", Object.assign({
|
|
3330
3354
|
css: theme => ({
|
|
3331
|
-
|
|
3332
|
-
paddingTop: _withInput ? theme.spacing(subLabel ? 1 : 2) : undefined
|
|
3355
|
+
flexShrink: 0,
|
|
3356
|
+
paddingTop: _withInput ? theme.spacing(subLabel ? 1 : 2) : undefined,
|
|
3357
|
+
width: theme.spacing(12.5)
|
|
3333
3358
|
})
|
|
3334
3359
|
}, {
|
|
3335
3360
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
@@ -3476,7 +3501,7 @@ const getOverrideStyles = theme => ({
|
|
|
3476
3501
|
});
|
|
3477
3502
|
|
|
3478
3503
|
const CreditCardInputController = createFieldController();
|
|
3479
|
-
const transform$
|
|
3504
|
+
const transform$5 = {
|
|
3480
3505
|
in: v => v ? formatCreditCardNumber(v) : "",
|
|
3481
3506
|
out: event => event.target.value === "" ? null : event.target.value.replace(/\s/g, "")
|
|
3482
3507
|
};
|
|
@@ -3496,7 +3521,7 @@ const CreditCardInput = fieldProps => jsxRuntime.jsx(CreditCardInputController,
|
|
|
3496
3521
|
if (e.target.value.replace(/\s/g, "").length > 16) {
|
|
3497
3522
|
e.preventDefault();
|
|
3498
3523
|
} else {
|
|
3499
|
-
onChange(transform$
|
|
3524
|
+
onChange(transform$5.out(e));
|
|
3500
3525
|
}
|
|
3501
3526
|
},
|
|
3502
3527
|
onKeyDown: e => {
|
|
@@ -3504,7 +3529,7 @@ const CreditCardInput = fieldProps => jsxRuntime.jsx(CreditCardInputController,
|
|
|
3504
3529
|
if (!/^([0-9]|Backspace|Delete|Enter|Tab)$/i.test(e.key)) e.preventDefault();
|
|
3505
3530
|
},
|
|
3506
3531
|
type: "text",
|
|
3507
|
-
value: transform$
|
|
3532
|
+
value: transform$5.in(value)
|
|
3508
3533
|
}))
|
|
3509
3534
|
}));
|
|
3510
3535
|
}
|
|
@@ -3599,6 +3624,40 @@ const DatePicker = fieldProps => {
|
|
|
3599
3624
|
}));
|
|
3600
3625
|
};
|
|
3601
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
|
+
|
|
3602
3661
|
var classof$2 = classofRaw$2;
|
|
3603
3662
|
|
|
3604
3663
|
// `IsArray` abstract operation
|
|
@@ -22037,7 +22096,7 @@ const Switch = _a => {
|
|
|
22037
22096
|
defaultChecked = false,
|
|
22038
22097
|
children,
|
|
22039
22098
|
shouldUnmount,
|
|
22040
|
-
label,
|
|
22099
|
+
label = "",
|
|
22041
22100
|
onChange
|
|
22042
22101
|
} = _a,
|
|
22043
22102
|
props = __rest(_a, ["defaultChecked", "children", "shouldUnmount", "label", "onChange"]);
|
|
@@ -22116,6 +22175,7 @@ var fields = /*#__PURE__*/Object.freeze({
|
|
|
22116
22175
|
CreditCardInput: CreditCardInput,
|
|
22117
22176
|
CheckboxInput: CheckboxInput,
|
|
22118
22177
|
DatePicker: DatePicker,
|
|
22178
|
+
ExpirationInput: ExpirationInput,
|
|
22119
22179
|
InputGroup: InputGroup,
|
|
22120
22180
|
transform: transform$3,
|
|
22121
22181
|
MoneyInput: MoneyInput,
|
|
@@ -22807,6 +22867,34 @@ const AddressParser = ({
|
|
|
22807
22867
|
}));
|
|
22808
22868
|
};
|
|
22809
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
|
+
|
|
22810
22898
|
const AddressFields = ({
|
|
22811
22899
|
domestic,
|
|
22812
22900
|
form,
|
|
@@ -22840,21 +22928,6 @@ const AddressFields = ({
|
|
|
22840
22928
|
labelWeight: "normal",
|
|
22841
22929
|
name: _formatFieldName("companyName"),
|
|
22842
22930
|
nativeLabel: true
|
|
22843
|
-
}), jsxRuntime.jsx(Select, {
|
|
22844
|
-
control: form.control,
|
|
22845
|
-
form: formId,
|
|
22846
|
-
label: t("address.fields.countryCode"),
|
|
22847
|
-
labelWeight: "normal",
|
|
22848
|
-
name: _formatFieldName("countryCode"),
|
|
22849
|
-
nativeLabel: true,
|
|
22850
|
-
onChange: e => {
|
|
22851
|
-
if (typeof e === "string") {
|
|
22852
|
-
form.setValue(_formatFieldName("stateProvince"), null, {
|
|
22853
|
-
shouldValidate: isSubmitted
|
|
22854
|
-
});
|
|
22855
|
-
}
|
|
22856
|
-
},
|
|
22857
|
-
options: countryCodeOptions
|
|
22858
22931
|
}), jsxRuntime.jsx(TextInput, {
|
|
22859
22932
|
control: form.control,
|
|
22860
22933
|
form: formId,
|
|
@@ -22877,24 +22950,29 @@ const AddressFields = ({
|
|
|
22877
22950
|
labelWeight: "normal",
|
|
22878
22951
|
name: _formatFieldName("cityLocality"),
|
|
22879
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
|
|
22880
22968
|
}), jsxRuntime.jsxs("div", Object.assign({
|
|
22881
|
-
css:
|
|
22882
|
-
display: "flex",
|
|
22883
|
-
gap: theme.spacing(2),
|
|
22884
|
-
width: "100%"
|
|
22885
|
-
})
|
|
22969
|
+
css: styles$a.stateZipWrapper
|
|
22886
22970
|
}, {
|
|
22887
22971
|
children: [jsxRuntime.jsx("div", Object.assign({
|
|
22888
|
-
css:
|
|
22889
|
-
display: "flex",
|
|
22890
|
-
flex: "1 0 66%",
|
|
22891
|
-
width: "100%"
|
|
22892
|
-
}
|
|
22972
|
+
css: styles$a.stateWrapper
|
|
22893
22973
|
}, {
|
|
22894
22974
|
children: jsxRuntime.jsx("div", Object.assign({
|
|
22895
|
-
css:
|
|
22896
|
-
flexGrow: 1
|
|
22897
|
-
}
|
|
22975
|
+
css: styles$a.grow
|
|
22898
22976
|
}, {
|
|
22899
22977
|
children: watchCountryCode === "US" ?
|
|
22900
22978
|
// Domestic States
|
|
@@ -22918,15 +22996,10 @@ const AddressFields = ({
|
|
|
22918
22996
|
})
|
|
22919
22997
|
}))
|
|
22920
22998
|
})), jsxRuntime.jsx("div", Object.assign({
|
|
22921
|
-
css:
|
|
22922
|
-
display: "flex",
|
|
22923
|
-
width: "100%"
|
|
22924
|
-
}
|
|
22999
|
+
css: styles$a.zipWrapper
|
|
22925
23000
|
}, {
|
|
22926
23001
|
children: jsxRuntime.jsx("div", Object.assign({
|
|
22927
|
-
css:
|
|
22928
|
-
flexGrow: 1
|
|
22929
|
-
}
|
|
23002
|
+
css: styles$a.grow
|
|
22930
23003
|
}, {
|
|
22931
23004
|
children: jsxRuntime.jsx(TextInput, {
|
|
22932
23005
|
control: form.control,
|
|
@@ -23154,7 +23227,7 @@ const AddressForm = ({
|
|
|
23154
23227
|
}));
|
|
23155
23228
|
};
|
|
23156
23229
|
|
|
23157
|
-
const styles$
|
|
23230
|
+
const styles$9 = createStyles({
|
|
23158
23231
|
agreement: {
|
|
23159
23232
|
alignItems: "center",
|
|
23160
23233
|
display: "flex",
|
|
@@ -23224,10 +23297,10 @@ const DisplayCarrierTerms = c => {
|
|
|
23224
23297
|
const listCarrierLinks = () => {
|
|
23225
23298
|
return c.carrierTerms.links.map((term, index) => {
|
|
23226
23299
|
return jsxRuntime.jsx("li", Object.assign({
|
|
23227
|
-
css: styles$
|
|
23300
|
+
css: styles$9.listItems
|
|
23228
23301
|
}, {
|
|
23229
23302
|
children: jsxRuntime.jsx(giger.Link, Object.assign({
|
|
23230
|
-
css: styles$
|
|
23303
|
+
css: styles$9.link,
|
|
23231
23304
|
href: term.url,
|
|
23232
23305
|
isExternal: true,
|
|
23233
23306
|
target: "_blank"
|
|
@@ -23243,18 +23316,18 @@ const DisplayCarrierTerms = c => {
|
|
|
23243
23316
|
};
|
|
23244
23317
|
const listCarrierTerms = () => {
|
|
23245
23318
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
23246
|
-
css: styles$
|
|
23319
|
+
css: styles$9.terms
|
|
23247
23320
|
}, {
|
|
23248
23321
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23249
23322
|
variant: "subtitle1"
|
|
23250
23323
|
}, {
|
|
23251
23324
|
children: c.carrierTerms.title
|
|
23252
23325
|
})), jsxRuntime.jsx("div", Object.assign({
|
|
23253
|
-
css: styles$
|
|
23326
|
+
css: styles$9.terms
|
|
23254
23327
|
}, {
|
|
23255
23328
|
children: listCarrierContent()
|
|
23256
23329
|
})), jsxRuntime.jsx("ul", Object.assign({
|
|
23257
|
-
css: styles$
|
|
23330
|
+
css: styles$9.links
|
|
23258
23331
|
}, {
|
|
23259
23332
|
children: listCarrierLinks()
|
|
23260
23333
|
}))]
|
|
@@ -23484,7 +23557,7 @@ const AddressDisplay = ({
|
|
|
23484
23557
|
}));
|
|
23485
23558
|
};
|
|
23486
23559
|
|
|
23487
|
-
const styles$
|
|
23560
|
+
const styles$8 = createStyles({
|
|
23488
23561
|
container: theme => ({
|
|
23489
23562
|
display: "flex",
|
|
23490
23563
|
gap: theme.spacing()
|
|
@@ -23522,13 +23595,13 @@ const Disclosure = ({
|
|
|
23522
23595
|
}, [open]);
|
|
23523
23596
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
23524
23597
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
23525
|
-
css: styles$
|
|
23598
|
+
css: styles$8.container
|
|
23526
23599
|
}, {
|
|
23527
23600
|
children: [jsxRuntime.jsx("div", {
|
|
23528
23601
|
children: label
|
|
23529
23602
|
}), _showToggle && jsxRuntime.jsx("button", Object.assign({
|
|
23530
23603
|
"aria-expanded": isOpen,
|
|
23531
|
-
css: styles$
|
|
23604
|
+
css: styles$8.toggle,
|
|
23532
23605
|
onClick: () => {
|
|
23533
23606
|
setIsOpen(!isOpen);
|
|
23534
23607
|
onToggle(!isOpen);
|
|
@@ -23536,12 +23609,12 @@ const Disclosure = ({
|
|
|
23536
23609
|
type: "button"
|
|
23537
23610
|
}, {
|
|
23538
23611
|
children: jsxRuntime.jsx(giger.Icon, {
|
|
23539
|
-
css: styles$
|
|
23612
|
+
css: styles$8.icon,
|
|
23540
23613
|
name: isOpen ? brands.IconNames.CHEVRON_TOP : brands.IconNames.CHEVRON_BOTTOM
|
|
23541
23614
|
})
|
|
23542
23615
|
}))]
|
|
23543
23616
|
})), isOpen && jsxRuntime.jsx("div", Object.assign({
|
|
23544
|
-
css: styles$
|
|
23617
|
+
css: styles$8.content
|
|
23545
23618
|
}, {
|
|
23546
23619
|
children: typeof children === "function" ? children(() => setIsOpen(!isOpen)) : children
|
|
23547
23620
|
}))]
|
|
@@ -23681,7 +23754,7 @@ const getCarrierRecoverySchema = requiresAddress => zod.z.object({
|
|
|
23681
23754
|
address: requiresAddress ? baseSchema : baseSchema.optional()
|
|
23682
23755
|
});
|
|
23683
23756
|
|
|
23684
|
-
const styles$
|
|
23757
|
+
const styles$7 = createStyles({
|
|
23685
23758
|
grid: theme => ({
|
|
23686
23759
|
margin: theme.spacing(4)
|
|
23687
23760
|
}),
|
|
@@ -23724,50 +23797,28 @@ const CarrierRecoveryForm = ({
|
|
|
23724
23797
|
onSubmit: formLogger.capture(handleSubmit)
|
|
23725
23798
|
}, {
|
|
23726
23799
|
children: jsxRuntime.jsxs(giger.Grid, Object.assign({
|
|
23727
|
-
css: styles$
|
|
23728
|
-
noPadding: true
|
|
23729
|
-
}, {
|
|
23730
|
-
children: [jsxRuntime.
|
|
23731
|
-
colSpan: 12
|
|
23732
|
-
}, {
|
|
23733
|
-
children: jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
23734
|
-
title: t("register-wallet:sections.notifications.carrier.title", {
|
|
23735
|
-
carrierFriendlyName
|
|
23736
|
-
}),
|
|
23737
|
-
type: requiresAddress ? giger.NotificationType.ERROR : giger.NotificationType.ALERT
|
|
23738
|
-
}, {
|
|
23739
|
-
children: [address && t("register-wallet:sections.notifications.carrier.confirmAddress"), t("register-wallet:sections.notifications.carrier.description", {
|
|
23740
|
-
carrierFriendlyName
|
|
23741
|
-
})].join(" ")
|
|
23742
|
-
}))
|
|
23743
|
-
})), requiresAddress && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
23800
|
+
css: styles$7.grid,
|
|
23801
|
+
noPadding: true
|
|
23802
|
+
}, {
|
|
23803
|
+
children: [requiresAddress && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
23744
23804
|
children: [jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
23745
23805
|
colSpan: 12
|
|
23746
23806
|
}, {
|
|
23747
23807
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23748
|
-
css: styles$
|
|
23808
|
+
css: styles$7.heading,
|
|
23749
23809
|
variant: "heading4"
|
|
23750
23810
|
}, {
|
|
23751
23811
|
children: t("register-wallet:sections.carriers.title")
|
|
23752
23812
|
}))
|
|
23753
23813
|
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
23754
23814
|
colSpan: 12,
|
|
23755
|
-
css: styles$
|
|
23815
|
+
css: styles$7.subtitle
|
|
23756
23816
|
}, {
|
|
23757
23817
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23758
23818
|
variant: "subtitle1"
|
|
23759
23819
|
}, {
|
|
23760
23820
|
children: t("register-wallet:sections.carriers.subtitle")
|
|
23761
23821
|
}))
|
|
23762
|
-
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
23763
|
-
colSpan: 12,
|
|
23764
|
-
"data-testid": "address-fields"
|
|
23765
|
-
}, {
|
|
23766
|
-
children: jsxRuntime.jsx(AddressFields, {
|
|
23767
|
-
form: form,
|
|
23768
|
-
formatFieldName: fieldName => `address.${fieldName}`,
|
|
23769
|
-
optionalFields: ["addressLine2"]
|
|
23770
|
-
})
|
|
23771
23822
|
}))]
|
|
23772
23823
|
}), !!(errors === null || errors === void 0 ? void 0 : errors.length) && jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
23773
23824
|
colSpan: 12
|
|
@@ -23782,6 +23833,15 @@ const CarrierRecoveryForm = ({
|
|
|
23782
23833
|
message
|
|
23783
23834
|
}) => message).join(" ")
|
|
23784
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
|
+
})
|
|
23785
23845
|
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
23786
23846
|
colSpan: 12
|
|
23787
23847
|
}, {
|
|
@@ -23813,76 +23873,6 @@ const carrierTermsFormSchema = zod.z.object({
|
|
|
23813
23873
|
agreement: zod.z.literal(true)
|
|
23814
23874
|
});
|
|
23815
23875
|
|
|
23816
|
-
/**
|
|
23817
|
-
* TODO: Temporary component (replace with carrier metadata)
|
|
23818
|
-
*/
|
|
23819
|
-
const CarrierTerms = ({
|
|
23820
|
-
carrierCode
|
|
23821
|
-
}) => {
|
|
23822
|
-
const upsLinks = [{
|
|
23823
|
-
text: "UPS Promotional Rates Agreement",
|
|
23824
|
-
url: "https://www.ups.com/assets/resources/media/en_US/CQF_US.pdf"
|
|
23825
|
-
}, {
|
|
23826
|
-
text: "UPS Technology Agreement",
|
|
23827
|
-
url: "https://www.ups.com/assets/resources/media/en_US/UTA.pdf"
|
|
23828
|
-
}, {
|
|
23829
|
-
text: "List of Prohibited Articles",
|
|
23830
|
-
url: "https://www.ups.com/kn/en/help-center/shipping-support/prohibited-items.page"
|
|
23831
|
-
}];
|
|
23832
|
-
switch (carrierCode) {
|
|
23833
|
-
case "ups":
|
|
23834
|
-
return jsxRuntime.jsxs("div", Object.assign({
|
|
23835
|
-
css: styles$b.terms
|
|
23836
|
-
}, {
|
|
23837
|
-
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23838
|
-
variant: "subtitle1"
|
|
23839
|
-
}, {
|
|
23840
|
-
children: "UPS Promotional Rates and Technology Agreements"
|
|
23841
|
-
})), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23842
|
-
variant: "body1"
|
|
23843
|
-
}, {
|
|
23844
|
-
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."
|
|
23845
|
-
})), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23846
|
-
variant: "body1"
|
|
23847
|
-
}, {
|
|
23848
|
-
children: "To start shipping with UPS, you must first agree to the following:"
|
|
23849
|
-
})), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23850
|
-
variant: "body1"
|
|
23851
|
-
}, {
|
|
23852
|
-
children: "UPS, the UPS brandmark, UPS Ready, and the color brown are trademarks of the United Parcel Service of America, Inc. All Rights Reserved."
|
|
23853
|
-
})), jsxRuntime.jsx("ul", {
|
|
23854
|
-
children: upsLinks.map(({
|
|
23855
|
-
text,
|
|
23856
|
-
url
|
|
23857
|
-
}, idx) => jsxRuntime.jsx("li", Object.assign({
|
|
23858
|
-
css: styles$b.listItems
|
|
23859
|
-
}, {
|
|
23860
|
-
children: jsxRuntime.jsx(giger.Link, Object.assign({
|
|
23861
|
-
href: url,
|
|
23862
|
-
isExternal: true,
|
|
23863
|
-
rel: "noreferrer",
|
|
23864
|
-
target: "_blank"
|
|
23865
|
-
}, {
|
|
23866
|
-
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23867
|
-
variant: "body1"
|
|
23868
|
-
}, {
|
|
23869
|
-
children: text
|
|
23870
|
-
}))
|
|
23871
|
-
}))
|
|
23872
|
-
}), idx))
|
|
23873
|
-
})]
|
|
23874
|
-
}));
|
|
23875
|
-
case "usps":
|
|
23876
|
-
case "stamps_com":
|
|
23877
|
-
return jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23878
|
-
variant: "subtitle1"
|
|
23879
|
-
}, {
|
|
23880
|
-
children: "USPS Promotional Rates and Technology Agreements"
|
|
23881
|
-
}));
|
|
23882
|
-
default:
|
|
23883
|
-
return null;
|
|
23884
|
-
}
|
|
23885
|
-
};
|
|
23886
23876
|
const CarrierTermsForm = ({
|
|
23887
23877
|
carrierCodes,
|
|
23888
23878
|
onSubmit
|
|
@@ -23892,6 +23882,11 @@ const CarrierTermsForm = ({
|
|
|
23892
23882
|
} = reactI18next.useTranslation(["common"]);
|
|
23893
23883
|
const metadatas = useCarrierMetadata(carrierCodes);
|
|
23894
23884
|
const [showTerms, setShowTerms] = React.useState(false);
|
|
23885
|
+
const terms = metadatas.filter(({
|
|
23886
|
+
terms
|
|
23887
|
+
}) => terms).map(({
|
|
23888
|
+
terms
|
|
23889
|
+
}) => terms);
|
|
23895
23890
|
const form = reactHookForm.useForm({
|
|
23896
23891
|
defaultValues: {
|
|
23897
23892
|
agreement: false
|
|
@@ -23903,7 +23898,7 @@ const CarrierTermsForm = ({
|
|
|
23903
23898
|
onSubmit(payload.agreement);
|
|
23904
23899
|
}));
|
|
23905
23900
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
23906
|
-
css: styles$
|
|
23901
|
+
css: styles$9.termsForm,
|
|
23907
23902
|
"data-testid": "carrier-terms-form"
|
|
23908
23903
|
}, {
|
|
23909
23904
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
@@ -23919,7 +23914,7 @@ const CarrierTermsForm = ({
|
|
|
23919
23914
|
})), jsxRuntime.jsx(Spacer, {
|
|
23920
23915
|
multiplier: 1
|
|
23921
23916
|
}), jsxRuntime.jsx("div", Object.assign({
|
|
23922
|
-
css: styles$
|
|
23917
|
+
css: styles$9.carrierLogos
|
|
23923
23918
|
}, {
|
|
23924
23919
|
children: metadatas.map(({
|
|
23925
23920
|
name,
|
|
@@ -23935,7 +23930,7 @@ const CarrierTermsForm = ({
|
|
|
23935
23930
|
onSubmit: formLogger.capture(handleSubmit)
|
|
23936
23931
|
}, {
|
|
23937
23932
|
children: jsxRuntime.jsxs("div", Object.assign({
|
|
23938
|
-
css: styles$
|
|
23933
|
+
css: styles$9.agreement
|
|
23939
23934
|
}, {
|
|
23940
23935
|
children: [jsxRuntime.jsx("div", {
|
|
23941
23936
|
children: jsxRuntime.jsx(CheckboxInput, {
|
|
@@ -23948,7 +23943,7 @@ const CarrierTermsForm = ({
|
|
|
23948
23943
|
"data-testid": "terms-link",
|
|
23949
23944
|
onClick: e => {
|
|
23950
23945
|
e.preventDefault();
|
|
23951
|
-
setShowTerms(
|
|
23946
|
+
setShowTerms(prev => !prev);
|
|
23952
23947
|
},
|
|
23953
23948
|
role: "button"
|
|
23954
23949
|
})
|
|
@@ -23962,22 +23957,12 @@ const CarrierTermsForm = ({
|
|
|
23962
23957
|
name: "agreement"
|
|
23963
23958
|
})
|
|
23964
23959
|
}), showTerms && jsxRuntime.jsxs("div", Object.assign({
|
|
23965
|
-
css: styles$
|
|
23960
|
+
css: styles$9.well
|
|
23966
23961
|
}, {
|
|
23967
|
-
children: [
|
|
23968
|
-
|
|
23969
|
-
}, {
|
|
23970
|
-
|
|
23971
|
-
variant: "heading5"
|
|
23972
|
-
}, {
|
|
23973
|
-
children: t("carriers.terms.title")
|
|
23974
|
-
})), metadatas.map(({
|
|
23975
|
-
carrierCode
|
|
23976
|
-
}) => jsxRuntime.jsx(CarrierTerms, {
|
|
23977
|
-
carrierCode: carrierCode
|
|
23978
|
-
}, carrierCode))]
|
|
23979
|
-
})), jsxRuntime.jsx("div", Object.assign({
|
|
23980
|
-
css: styles$b.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
|
|
23981
23966
|
}, {
|
|
23982
23967
|
children: jsxRuntime.jsx(giger.Button, Object.assign({
|
|
23983
23968
|
onClick: () => setShowTerms(false),
|
|
@@ -24365,7 +24350,7 @@ const LandingPageForm = ({
|
|
|
24365
24350
|
}));
|
|
24366
24351
|
};
|
|
24367
24352
|
|
|
24368
|
-
const styles$
|
|
24353
|
+
const styles$6 = createStyles({
|
|
24369
24354
|
container: theme => ({
|
|
24370
24355
|
padding: theme.spacing(2)
|
|
24371
24356
|
}),
|
|
@@ -24375,7 +24360,8 @@ const styles$8 = createStyles({
|
|
|
24375
24360
|
header: {
|
|
24376
24361
|
alignItems: "center",
|
|
24377
24362
|
display: "flex",
|
|
24378
|
-
flexDirection: "column"
|
|
24363
|
+
flexDirection: "column",
|
|
24364
|
+
textAlign: "center"
|
|
24379
24365
|
}
|
|
24380
24366
|
});
|
|
24381
24367
|
|
|
@@ -24386,11 +24372,11 @@ const LandingPage = ({
|
|
|
24386
24372
|
t
|
|
24387
24373
|
} = reactI18next.useTranslation();
|
|
24388
24374
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
24389
|
-
css: styles$
|
|
24375
|
+
css: styles$6.container,
|
|
24390
24376
|
"data-testid": "landing-page"
|
|
24391
24377
|
}, {
|
|
24392
24378
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24393
|
-
css: styles$
|
|
24379
|
+
css: styles$6.header
|
|
24394
24380
|
}, {
|
|
24395
24381
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24396
24382
|
variant: "heading4"
|
|
@@ -24408,7 +24394,7 @@ const LandingPage = ({
|
|
|
24408
24394
|
})), jsxRuntime.jsx(LandingPageForm, {
|
|
24409
24395
|
onSubmit: onSubmit
|
|
24410
24396
|
}), jsxRuntime.jsxs("div", Object.assign({
|
|
24411
|
-
css: styles$
|
|
24397
|
+
css: styles$6.header
|
|
24412
24398
|
}, {
|
|
24413
24399
|
children: [jsxRuntime.jsx(Spacer, {
|
|
24414
24400
|
multiplier: 6
|
|
@@ -24419,7 +24405,7 @@ const LandingPage = ({
|
|
|
24419
24405
|
})), jsxRuntime.jsx(Spacer, {
|
|
24420
24406
|
multiplier: 2
|
|
24421
24407
|
}), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24422
|
-
css: styles$
|
|
24408
|
+
css: styles$6.description,
|
|
24423
24409
|
variant: "body1"
|
|
24424
24410
|
}, {
|
|
24425
24411
|
children: t("onboarding:landing.description")
|
|
@@ -24500,18 +24486,17 @@ const Accordion = _a => {
|
|
|
24500
24486
|
});
|
|
24501
24487
|
};
|
|
24502
24488
|
|
|
24503
|
-
const
|
|
24504
|
-
|
|
24505
|
-
|
|
24506
|
-
}
|
|
24489
|
+
const getStyles$4 = (isConnected = false) => createStyles({
|
|
24490
|
+
connectButton: theme => [{
|
|
24491
|
+
padding: `0 ${theme.spacing(.5)}px`
|
|
24492
|
+
}, isConnected && {
|
|
24493
|
+
backgroundColor: theme.palette.success.main,
|
|
24494
|
+
color: theme.palette.white
|
|
24495
|
+
}],
|
|
24507
24496
|
container: {
|
|
24508
24497
|
display: "flex",
|
|
24509
24498
|
flexDirection: "column"
|
|
24510
24499
|
},
|
|
24511
|
-
loadingButtonContainer: {
|
|
24512
|
-
alignItems: "center",
|
|
24513
|
-
display: "flex"
|
|
24514
|
-
},
|
|
24515
24500
|
logoContainer: theme => ({
|
|
24516
24501
|
alignItems: "center",
|
|
24517
24502
|
columnGap: `${theme.spacing(1)}px`,
|
|
@@ -24522,31 +24507,6 @@ const styles$7 = createStyles({
|
|
|
24522
24507
|
display: "flex",
|
|
24523
24508
|
justifyContent: "space-between",
|
|
24524
24509
|
padding: `${theme.spacing(2)}px`
|
|
24525
|
-
}),
|
|
24526
|
-
statusChipConnected: theme => ({
|
|
24527
|
-
alignItems: 'center',
|
|
24528
|
-
background: theme.palette.success.main,
|
|
24529
|
-
borderRadius: theme.borderRadius.S,
|
|
24530
|
-
color: theme.palette.white,
|
|
24531
|
-
display: 'flex',
|
|
24532
|
-
flex: 'none',
|
|
24533
|
-
flexDirection: 'row',
|
|
24534
|
-
fontSize: theme.typography.fontSize.S,
|
|
24535
|
-
fontWeight: theme.typography.fontWeight.bold,
|
|
24536
|
-
gap: `${theme.spacing(1)}px}`,
|
|
24537
|
-
height: '20px',
|
|
24538
|
-
justifyContent: 'center',
|
|
24539
|
-
lineHeight: `${theme.spacing(2.5)} px`,
|
|
24540
|
-
order: '0',
|
|
24541
|
-
padding: `${theme.spacing(.5)} px`,
|
|
24542
|
-
width: '81px'
|
|
24543
|
-
}),
|
|
24544
|
-
statusChipNotConnected: theme => ({
|
|
24545
|
-
background: 'none',
|
|
24546
|
-
color: theme.palette.secondary.main,
|
|
24547
|
-
fontSize: theme.typography.fontSize.M,
|
|
24548
|
-
fontWeight: theme.typography.fontWeight.bold,
|
|
24549
|
-
lineHeight: `${theme.spacing(3)} px`
|
|
24550
24510
|
})
|
|
24551
24511
|
});
|
|
24552
24512
|
|
|
@@ -24557,7 +24517,7 @@ var _ref$1 = process.env.NODE_ENV === "production" ? {
|
|
|
24557
24517
|
} : {
|
|
24558
24518
|
name: "111ty02-css",
|
|
24559
24519
|
styles: "align-items:center;display:flex;label:css;",
|
|
24560
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
24520
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpc3QtY2FycmllcnMtcm93LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFtQmllIiwiZmlsZSI6Imxpc3QtY2FycmllcnMtcm93LnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IF9fYXdhaXRlciB9IGZyb20gXCJ0c2xpYlwiO1xyXG5pbXBvcnQgeyBqc3ggYXMgX2pzeCwganN4cyBhcyBfanN4cyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdC9qc3gtcnVudGltZVwiO1xyXG5pbXBvcnQgeyBjc3MgfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3RcIjtcclxuaW1wb3J0IHsgdXNlU3RhdGUgfSBmcm9tIFwicmVhY3RcIjtcclxuaW1wb3J0IHsgdXNlVHJhbnNsYXRpb24gfSBmcm9tIFwicmVhY3QtaTE4bmV4dFwiO1xyXG5pbXBvcnQgeyBCdXR0b24sIEJ1dHRvbkNvbG9yLCBCdXR0b25WYXJpYW50LCBUeXBvZ3JhcGh5IH0gZnJvbSBcIkBwYWNrbGluay9naWdlclwiO1xyXG5pbXBvcnQgeyBUZW1wbGF0ZXMgfSBmcm9tIFwiLi4vLi4vLi4vY29tcG9uZW50c1wiO1xyXG5pbXBvcnQgeyBnZXRTdHlsZXMgfSBmcm9tIFwiLi9saXN0LWNhcnJpZXJzLXJvdy5zdHlsZXNcIjtcclxuZXhwb3J0IGNvbnN0IExpc3RDYXJyaWVyc1JvdyA9ICh7IGNvbm5lY3RlZENhcnJpZXI6IHsgY2FycmllciwgaXNDb25uZWN0ZWQgfSwgcmVnaXN0ZXJDYXJyaWVyLCByZWdpc3RlckNhcnJpZXJFcnJvcnMsIH0pID0+IHtcclxuICAgIGNvbnN0IHsgc2hvcnRuYW1lOiBuYW1lLCBsb2dvLCByZXF1aXJlZEZpZWxkcyB9ID0gY2FycmllcjtcclxuICAgIGNvbnN0IHsgdCB9ID0gdXNlVHJhbnNsYXRpb24oW1wibGlzdC1jYXJyaWVyc1wiXSk7XHJcbiAgICBjb25zdCBbc2hvd0Ryb3BEb3duLCBzZXRTaG93RHJvcERvd25dID0gdXNlU3RhdGUoZmFsc2UpO1xyXG4gICAgY29uc3QgW2lzU3VibWl0dGluZywgc2V0SXNTdWJtaXR0aW5nXSA9IHVzZVN0YXRlKGZhbHNlKTtcclxuICAgIGNvbnN0IGhhbmRsZVJlZ2lzdGVyID0gKHZhbHVlcykgPT4gX19hd2FpdGVyKHZvaWQgMCwgdm9pZCAwLCB2b2lkIDAsIGZ1bmN0aW9uKiAoKSB7XHJcbiAgICAgICAgc2V0SXNTdWJtaXR0aW5nKHRydWUpO1xyXG4gICAgICAgIHlpZWxkIHJlZ2lzdGVyQ2Fycmllcih2YWx1ZXMpO1xyXG4gICAgICAgIHNob3dEcm9wRG93biAmJiBzZXRTaG93RHJvcERvd24oZmFsc2UpO1xyXG4gICAgICAgIHNldElzU3VibWl0dGluZyhmYWxzZSk7XHJcbiAgICB9KTtcclxuICAgIHJldHVybiAoX2pzeHMoXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNzczogZ2V0U3R5bGVzKCkuY29udGFpbmVyLCBcImRhdGEtdGVzdGlkXCI6IFwiY2Fycmllci1yb3dcIiB9LCB7IGNoaWxkcmVuOiBbX2pzeHMoXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNzczogZ2V0U3R5bGVzKCkucm93Q29udGFpbmVyIH0sIHsgY2hpbGRyZW46IFtfanN4cyhcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY3NzOiBnZXRTdHlsZXMoKS5sb2dvQ29udGFpbmVyIH0sIHsgY2hpbGRyZW46IFtfanN4KFwiZGl2XCIsIHsgY2hpbGRyZW46IF9qc3goXCJpbWdcIiwgeyBhbHQ6IGAke25hbWV9LWxvZ29gLCBoZWlnaHQ6IDQwLCBzcmM6IGxvZ28sIHdpZHRoOiA0MCB9KSB9KSwgX2pzeChUeXBvZ3JhcGh5LCBPYmplY3QuYXNzaWduKHsgdmFyaWFudDogXCJzdWJ0aXRsZTFcIiB9LCB7IGNoaWxkcmVuOiBuYW1lIH0pKV0gfSkpLCBfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IGNzcyh7IGFsaWduSXRlbXM6IFwiY2VudGVyXCIsIGRpc3BsYXk6IFwiZmxleFwiIH0pIH0sIHsgY2hpbGRyZW46IF9qc3goQnV0dG9uLCBPYmplY3QuYXNzaWduKHsgY29sb3I6IEJ1dHRvbkNvbG9yLlNFQ09OREFSWSwgY3NzOiBnZXRTdHlsZXMoaXNDb25uZWN0ZWQpLmNvbm5lY3RCdXR0b24sIGRpc2FibGVkOiBpc0Nvbm5lY3RlZCB8fCBzaG93RHJvcERvd24sIGlzTG9hZGluZzogaXNTdWJtaXR0aW5nLCBvbkNsaWNrOiAoKSA9PiBfX2F3YWl0ZXIodm9pZCAwLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVxdWlyZWRGaWVsZHMgPT09IG51bGwgfHwgcmVxdWlyZWRGaWVsZHMgPT09IHZvaWQgMCA/IHZvaWQgMCA6IHJlcXVpcmVkRmllbGRzLmluY2x1ZGVzKFwiYWRkcmVzc1wiKSlcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd0Ryb3BEb3duKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2VcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeWllbGQgaGFuZGxlUmVnaXN0ZXIoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB2YXJpYW50OiBCdXR0b25WYXJpYW50LlRFWFQgfSwgeyBjaGlsZHJlbjogaXNDb25uZWN0ZWRcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IHQoXCJsaXN0LWNhcnJpZXJzOmFjdGlvbnMuc3RhdHVzLmNvbm5lY3RlZFwiKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogdChcImxpc3QtY2FycmllcnM6YWN0aW9ucy5zdGF0dXMubm90Q29ubmVjdGVkXCIpIH0pKSB9KSldIH0pKSwgc2hvd0Ryb3BEb3duICYmIChfanN4KFRlbXBsYXRlcy5BZGRDYXJyaWVyRm9ybSwgeyBjYXJyaWVyVGVybXM6IGNhcnJpZXIudGVybXMgJiYgY2Fycmllci50ZXJtcywgb25DYW5jZWw6ICgpID0+IHNldFNob3dEcm9wRG93bihmYWxzZSksIG9uU3VibWl0OiAodmFsdWVzKSA9PiBoYW5kbGVSZWdpc3Rlcih2YWx1ZXMpLCByZWdpc3RlckNhcnJpZXJFcnJvcnM6IHJlZ2lzdGVyQ2FycmllckVycm9ycyB9KSldIH0pKSk7XHJcbn07XHJcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPWxpc3QtY2FycmllcnMtcm93LmpzLm1hcCJdfQ== */",
|
|
24561
24521
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$2
|
|
24562
24522
|
};
|
|
24563
24523
|
const ListCarriersRow = ({
|
|
@@ -24569,7 +24529,7 @@ const ListCarriersRow = ({
|
|
|
24569
24529
|
registerCarrierErrors
|
|
24570
24530
|
}) => {
|
|
24571
24531
|
const {
|
|
24572
|
-
name,
|
|
24532
|
+
shortname: name,
|
|
24573
24533
|
logo,
|
|
24574
24534
|
requiredFields
|
|
24575
24535
|
} = carrier;
|
|
@@ -24585,20 +24545,21 @@ const ListCarriersRow = ({
|
|
|
24585
24545
|
setIsSubmitting(false);
|
|
24586
24546
|
});
|
|
24587
24547
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
24588
|
-
css:
|
|
24548
|
+
css: getStyles$4().container,
|
|
24549
|
+
"data-testid": "carrier-row"
|
|
24589
24550
|
}, {
|
|
24590
24551
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24591
|
-
css:
|
|
24552
|
+
css: getStyles$4().rowContainer
|
|
24592
24553
|
}, {
|
|
24593
24554
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24594
|
-
css:
|
|
24555
|
+
css: getStyles$4().logoContainer
|
|
24595
24556
|
}, {
|
|
24596
24557
|
children: [jsxRuntime.jsx("div", {
|
|
24597
24558
|
children: jsxRuntime.jsx("img", {
|
|
24598
24559
|
alt: `${name}-logo`,
|
|
24599
|
-
height:
|
|
24560
|
+
height: 40,
|
|
24600
24561
|
src: logo,
|
|
24601
|
-
width:
|
|
24562
|
+
width: 40
|
|
24602
24563
|
})
|
|
24603
24564
|
}), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24604
24565
|
variant: "subtitle1"
|
|
@@ -24609,6 +24570,8 @@ const ListCarriersRow = ({
|
|
|
24609
24570
|
css: _ref$1
|
|
24610
24571
|
}, {
|
|
24611
24572
|
children: jsxRuntime.jsx(giger.Button, Object.assign({
|
|
24573
|
+
color: giger.ButtonColor.SECONDARY,
|
|
24574
|
+
css: getStyles$4(isConnected).connectButton,
|
|
24612
24575
|
disabled: isConnected || showDropDown,
|
|
24613
24576
|
isLoading: isSubmitting,
|
|
24614
24577
|
onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -24628,7 +24591,7 @@ const ListCarriersRow = ({
|
|
|
24628
24591
|
}));
|
|
24629
24592
|
};
|
|
24630
24593
|
|
|
24631
|
-
const styles$
|
|
24594
|
+
const styles$5 = createStyles({
|
|
24632
24595
|
listContainer: theme => ({
|
|
24633
24596
|
"& > li:not(:last-of-type)": {
|
|
24634
24597
|
borderBottom: `1px solid ${theme.palette.gray.light}`
|
|
@@ -24675,7 +24638,7 @@ const ListCarriers$1 = ({
|
|
|
24675
24638
|
children: t("list-carriers:headers.accountCarriers")
|
|
24676
24639
|
}))
|
|
24677
24640
|
}), jsxRuntime.jsx("ul", Object.assign({
|
|
24678
|
-
css: styles$
|
|
24641
|
+
css: styles$5.listContainer
|
|
24679
24642
|
}, {
|
|
24680
24643
|
children: isLoading ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
24681
24644
|
children: [jsxRuntime.jsx(LoadingSkeletonRow, {}), jsxRuntime.jsx(LoadingSkeletonRow, {}), jsxRuntime.jsx(LoadingSkeletonRow, {})]
|
|
@@ -24696,10 +24659,10 @@ const ListCarriers$1 = ({
|
|
|
24696
24659
|
};
|
|
24697
24660
|
const LoadingSkeletonRow = () => {
|
|
24698
24661
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
24699
|
-
css: styles$
|
|
24662
|
+
css: styles$5.skeletonRow
|
|
24700
24663
|
}, {
|
|
24701
24664
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24702
|
-
css: styles$
|
|
24665
|
+
css: styles$5.skeletonLogoContainer
|
|
24703
24666
|
}, {
|
|
24704
24667
|
children: [jsxRuntime.jsx(giger.Skeleton, {
|
|
24705
24668
|
animation: giger.SkeletonAnimation.WAVE,
|
|
@@ -24723,7 +24686,7 @@ const LoadingSkeletonRow = () => {
|
|
|
24723
24686
|
}));
|
|
24724
24687
|
};
|
|
24725
24688
|
|
|
24726
|
-
const styles$
|
|
24689
|
+
const styles$4 = createStyles({
|
|
24727
24690
|
body: theme => ({
|
|
24728
24691
|
borderTop: `1px solid ${theme.palette.gray.light}`,
|
|
24729
24692
|
color: theme.palette.black,
|
|
@@ -24774,14 +24737,14 @@ const SettingsCard = ({
|
|
|
24774
24737
|
verticallyAligned
|
|
24775
24738
|
}) => {
|
|
24776
24739
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
24777
|
-
css: verticallyAligned ? styles$
|
|
24740
|
+
css: verticallyAligned ? styles$4.verticalContainer : styles$4.container,
|
|
24778
24741
|
"data-testid": "settingsCard"
|
|
24779
24742
|
}, {
|
|
24780
24743
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24781
|
-
css: styles$
|
|
24744
|
+
css: styles$4.header
|
|
24782
24745
|
}, {
|
|
24783
24746
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24784
|
-
css: styles$
|
|
24747
|
+
css: styles$4.title
|
|
24785
24748
|
}, {
|
|
24786
24749
|
children: [typeof title === "string" ? jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24787
24750
|
variant: "subtitle2"
|
|
@@ -24816,7 +24779,7 @@ const SettingsCard = ({
|
|
|
24816
24779
|
}))
|
|
24817
24780
|
}))]
|
|
24818
24781
|
})), children && jsxRuntime.jsx("div", Object.assign({
|
|
24819
|
-
css: styles$
|
|
24782
|
+
css: styles$4.body
|
|
24820
24783
|
}, {
|
|
24821
24784
|
children: jsxRuntime.jsxs("div", {
|
|
24822
24785
|
children: [children, accessoryAction && jsxRuntime.jsx(ButtonGroup, Object.assign({
|
|
@@ -24933,7 +24896,7 @@ const warehouseSchema = zod.z.discriminatedUnion("returnToAddressIsDifferent", [
|
|
|
24933
24896
|
});
|
|
24934
24897
|
});
|
|
24935
24898
|
|
|
24936
|
-
const styles$
|
|
24899
|
+
const styles$3 = createStyles({
|
|
24937
24900
|
header: {
|
|
24938
24901
|
textAlign: "center"
|
|
24939
24902
|
},
|
|
@@ -24970,6 +24933,9 @@ const WarehouseForm = ({
|
|
|
24970
24933
|
returnToAddressIsDifferent: !lodash.exports.isEqual(warehouse.originAddress, warehouse.returnAddress)
|
|
24971
24934
|
}) : {
|
|
24972
24935
|
isDefault: false,
|
|
24936
|
+
originAddress: {
|
|
24937
|
+
countryCode: "US"
|
|
24938
|
+
},
|
|
24973
24939
|
returnToAddressIsDifferent: false
|
|
24974
24940
|
},
|
|
24975
24941
|
resolver: validationResolver(warehouseSchema)
|
|
@@ -24985,12 +24951,12 @@ const WarehouseForm = ({
|
|
|
24985
24951
|
}
|
|
24986
24952
|
}));
|
|
24987
24953
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
24988
|
-
css: _isOnboarding ? styles$
|
|
24954
|
+
css: _isOnboarding ? styles$3.onboardingWell : styles$3.well,
|
|
24989
24955
|
"data-testid": "warehouse-form"
|
|
24990
24956
|
}, {
|
|
24991
24957
|
children: [_isOnboarding && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
24992
24958
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24993
|
-
css: styles$
|
|
24959
|
+
css: styles$3.header
|
|
24994
24960
|
}, {
|
|
24995
24961
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24996
24962
|
variant: "heading4"
|
|
@@ -25027,7 +24993,8 @@ const WarehouseForm = ({
|
|
|
25027
24993
|
nativeLabel: true
|
|
25028
24994
|
}), jsxRuntime.jsx(AddressFields, {
|
|
25029
24995
|
form: form,
|
|
25030
|
-
formatFieldName: fieldName => `originAddress.${fieldName}
|
|
24996
|
+
formatFieldName: fieldName => `originAddress.${fieldName}`,
|
|
24997
|
+
optionalFields: ["addressLine2"]
|
|
25031
24998
|
}), jsxRuntime.jsx(CheckboxInput, {
|
|
25032
24999
|
checkboxLabel: t("manage-warehouses:residentialAddress"),
|
|
25033
25000
|
control: form.control,
|
|
@@ -26194,67 +26161,122 @@ $$3({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
|
|
|
26194
26161
|
}
|
|
26195
26162
|
});
|
|
26196
26163
|
|
|
26197
|
-
const
|
|
26198
|
-
|
|
26164
|
+
const CompletionPage = ({
|
|
26165
|
+
onContinue
|
|
26199
26166
|
}) => {
|
|
26200
26167
|
const {
|
|
26201
26168
|
t
|
|
26202
|
-
} = reactI18next.useTranslation();
|
|
26203
|
-
|
|
26204
|
-
|
|
26205
|
-
|
|
26206
|
-
|
|
26169
|
+
} = reactI18next.useTranslation(["common", "onboarding"]);
|
|
26170
|
+
return jsxRuntime.jsxs("div", Object.assign({
|
|
26171
|
+
css: {
|
|
26172
|
+
alignItems: "center",
|
|
26173
|
+
display: "flex",
|
|
26174
|
+
flexDirection: "column"
|
|
26175
|
+
},
|
|
26176
|
+
"data-testid": "onboarding-complete"
|
|
26177
|
+
}, {
|
|
26178
|
+
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
26179
|
+
variant: "heading4"
|
|
26207
26180
|
}, {
|
|
26208
|
-
children:
|
|
26209
|
-
|
|
26210
|
-
|
|
26211
|
-
|
|
26212
|
-
|
|
26213
|
-
nativeLabel: true
|
|
26214
|
-
})
|
|
26215
|
-
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26216
|
-
colSpan: 12
|
|
26181
|
+
children: t("onboarding:success.title")
|
|
26182
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
26183
|
+
multiplier: 2
|
|
26184
|
+
}), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
26185
|
+
variant: "subtitle1"
|
|
26217
26186
|
}, {
|
|
26218
|
-
children:
|
|
26219
|
-
|
|
26220
|
-
|
|
26221
|
-
|
|
26222
|
-
|
|
26223
|
-
|
|
26224
|
-
|
|
26225
|
-
|
|
26226
|
-
|
|
26187
|
+
children: t("onboarding:success.subtitle")
|
|
26188
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
26189
|
+
multiplier: 10
|
|
26190
|
+
}), jsxRuntime.jsxs("svg", Object.assign({
|
|
26191
|
+
fill: "none",
|
|
26192
|
+
height: "86",
|
|
26193
|
+
viewBox: "0 0 86 86",
|
|
26194
|
+
width: "86",
|
|
26195
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
26227
26196
|
}, {
|
|
26228
|
-
children: jsxRuntime.jsx(
|
|
26229
|
-
|
|
26230
|
-
|
|
26231
|
-
|
|
26232
|
-
|
|
26233
|
-
|
|
26234
|
-
|
|
26235
|
-
|
|
26236
|
-
|
|
26237
|
-
|
|
26197
|
+
children: [jsxRuntime.jsx("circle", {
|
|
26198
|
+
cx: "43",
|
|
26199
|
+
cy: "43.3379",
|
|
26200
|
+
fill: "#E8F6FF",
|
|
26201
|
+
r: "42.5"
|
|
26202
|
+
}), jsxRuntime.jsx("path", {
|
|
26203
|
+
d: "M56.6583 26.4724C57.2882 25.8425 58.3095 25.8425 58.9393 26.4724L64.1038 31.6369C64.7337 32.2668 64.7337 33.288 64.1038 33.9179L37.8303 60.1915L30.3848 52.746L56.6583 26.4724Z",
|
|
26204
|
+
fill: "#006FBB"
|
|
26205
|
+
}), jsxRuntime.jsx("path", {
|
|
26206
|
+
d: "M21.4724 43.8446C20.8425 43.2147 20.8425 42.1935 21.4724 41.5636L26.4689 36.5671C27.0988 35.9372 28.12 35.9372 28.7499 36.5671L45.1032 52.9204L37.8257 60.1979L21.4724 43.8446Z",
|
|
26207
|
+
fill: "#006FBB"
|
|
26208
|
+
})]
|
|
26209
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
26210
|
+
multiplier: 10
|
|
26211
|
+
}), jsxRuntime.jsx(ButtonGroup, Object.assign({
|
|
26212
|
+
justify: "center"
|
|
26238
26213
|
}, {
|
|
26239
|
-
children: jsxRuntime.jsx(
|
|
26240
|
-
|
|
26241
|
-
|
|
26242
|
-
|
|
26243
|
-
|
|
26244
|
-
|
|
26245
|
-
|
|
26214
|
+
children: jsxRuntime.jsx(giger.Button, Object.assign({
|
|
26215
|
+
bold: false,
|
|
26216
|
+
color: giger.ButtonColor.PRIMARY,
|
|
26217
|
+
onClick: onContinue,
|
|
26218
|
+
type: "button",
|
|
26219
|
+
variant: giger.ButtonVariant.FILLED
|
|
26220
|
+
}, {
|
|
26221
|
+
children: t("onboarding:success.action")
|
|
26222
|
+
}))
|
|
26223
|
+
}))]
|
|
26224
|
+
}));
|
|
26225
|
+
};
|
|
26226
|
+
|
|
26227
|
+
const BillingFields = ({
|
|
26228
|
+
form
|
|
26229
|
+
}) => {
|
|
26230
|
+
const {
|
|
26231
|
+
t
|
|
26232
|
+
} = reactI18next.useTranslation();
|
|
26233
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
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%"
|
|
26246
26251
|
})
|
|
26247
|
-
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26248
|
-
colSpan: 3
|
|
26249
26252
|
}, {
|
|
26250
|
-
children: jsxRuntime.jsx(
|
|
26251
|
-
|
|
26252
|
-
|
|
26253
|
-
|
|
26254
|
-
|
|
26255
|
-
|
|
26256
|
-
|
|
26257
|
-
|
|
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
|
+
}))]
|
|
26258
26280
|
}))]
|
|
26259
26281
|
});
|
|
26260
26282
|
};
|
|
@@ -26290,8 +26312,10 @@ const billingAddressSchema = addressSchema.extend({
|
|
|
26290
26312
|
});
|
|
26291
26313
|
const creditCardSchema = zod.z.object({
|
|
26292
26314
|
cvv: zod.z.string().trim().refine(cvv => cardValidator__default["default"].cvv(cvv).isValid, "Invalid CVV"),
|
|
26293
|
-
|
|
26294
|
-
|
|
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"),
|
|
26295
26319
|
name: zod.z.string().trim().min(1),
|
|
26296
26320
|
number: zod.z.string().trim().refine(number => cardValidator__default["default"].number(number).isValid, "Invalid card number").refine(number => {
|
|
26297
26321
|
var _a, _b;
|
|
@@ -26299,11 +26323,16 @@ const creditCardSchema = zod.z.object({
|
|
|
26299
26323
|
}, "schemaErrors.invalidCreditCardType")
|
|
26300
26324
|
}).transform(schema => {
|
|
26301
26325
|
var _a;
|
|
26302
|
-
const
|
|
26326
|
+
const {
|
|
26327
|
+
cvv,
|
|
26328
|
+
expiration
|
|
26329
|
+
} = schema,
|
|
26330
|
+
creditCard = __rest(schema, ["cvv", "expiration"]);
|
|
26303
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("/");
|
|
26304
26333
|
return {
|
|
26305
|
-
expirationMonth:
|
|
26306
|
-
expirationYear:
|
|
26334
|
+
expirationMonth: expirationMonth,
|
|
26335
|
+
expirationYear: expirationYear,
|
|
26307
26336
|
name: creditCard.name,
|
|
26308
26337
|
number: creditCard.number,
|
|
26309
26338
|
type: creditCardVendor
|
|
@@ -26379,7 +26408,7 @@ const EditWalletAddressForm = ({
|
|
|
26379
26408
|
}));
|
|
26380
26409
|
};
|
|
26381
26410
|
|
|
26382
|
-
const styles$
|
|
26411
|
+
const styles$2 = createStyles({
|
|
26383
26412
|
grid: theme => ({
|
|
26384
26413
|
margin: theme.spacing(4)
|
|
26385
26414
|
}),
|
|
@@ -26403,7 +26432,11 @@ const WalletForm = ({
|
|
|
26403
26432
|
const form = reactHookForm.useForm({
|
|
26404
26433
|
defaultValues:
|
|
26405
26434
|
// If the warehouse address is a PO Box they cannot use it as their billing address
|
|
26406
|
-
defaultWarehouseIsPoBox ? {
|
|
26435
|
+
defaultWarehouseIsPoBox ? {
|
|
26436
|
+
address: {
|
|
26437
|
+
countryCode: "US"
|
|
26438
|
+
}
|
|
26439
|
+
} : {
|
|
26407
26440
|
address: Object.assign(Object.assign({}, address), {
|
|
26408
26441
|
countryCode: address.countryCode
|
|
26409
26442
|
})
|
|
@@ -26427,21 +26460,21 @@ const WalletForm = ({
|
|
|
26427
26460
|
onSubmit: formLogger.capture(handleSubmit)
|
|
26428
26461
|
}, {
|
|
26429
26462
|
children: jsxRuntime.jsxs(giger.Grid, Object.assign({
|
|
26430
|
-
css: styles$
|
|
26463
|
+
css: styles$2.grid,
|
|
26431
26464
|
noPadding: true
|
|
26432
26465
|
}, {
|
|
26433
26466
|
children: [jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26434
26467
|
colSpan: 12
|
|
26435
26468
|
}, {
|
|
26436
26469
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
26437
|
-
css: styles$
|
|
26470
|
+
css: styles$2.heading,
|
|
26438
26471
|
variant: "heading4"
|
|
26439
26472
|
}, {
|
|
26440
26473
|
children: t("register-wallet:sections.billing.title")
|
|
26441
26474
|
}))
|
|
26442
26475
|
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26443
26476
|
colSpan: 12,
|
|
26444
|
-
css: styles$
|
|
26477
|
+
css: styles$2.subtitle
|
|
26445
26478
|
}, {
|
|
26446
26479
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
26447
26480
|
variant: "subtitle1"
|
|
@@ -26451,19 +26484,30 @@ const WalletForm = ({
|
|
|
26451
26484
|
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26452
26485
|
colSpan: 12
|
|
26453
26486
|
}, {
|
|
26454
|
-
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({
|
|
26455
26495
|
title: t("register-wallet:sections.notifications.info.title"),
|
|
26456
26496
|
type: giger.NotificationType.INFO
|
|
26457
26497
|
}, {
|
|
26458
26498
|
children: t("register-wallet:sections.notifications.info.description")
|
|
26459
26499
|
}))
|
|
26460
|
-
})), jsxRuntime.jsx(
|
|
26461
|
-
|
|
26462
|
-
}
|
|
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({
|
|
26463
26507
|
colSpan: 12
|
|
26464
26508
|
}, {
|
|
26465
26509
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
26466
|
-
css: styles$
|
|
26510
|
+
css: styles$2.subtitle,
|
|
26467
26511
|
variant: "subtitle1"
|
|
26468
26512
|
}, {
|
|
26469
26513
|
children: t("register-wallet:sections.billing.addressSubTitle")
|
|
@@ -26500,18 +26544,7 @@ const WalletForm = ({
|
|
|
26500
26544
|
}, {
|
|
26501
26545
|
children: editWalletAddressForm
|
|
26502
26546
|
}))]
|
|
26503
|
-
}),
|
|
26504
|
-
colSpan: 12
|
|
26505
|
-
}, {
|
|
26506
|
-
children: jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
26507
|
-
title: t("register-wallet:sections.notifications.error.title"),
|
|
26508
|
-
type: giger.NotificationType.ERROR
|
|
26509
|
-
}, {
|
|
26510
|
-
children: errors.map(({
|
|
26511
|
-
message
|
|
26512
|
-
}) => message).join(" ")
|
|
26513
|
-
}))
|
|
26514
|
-
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26547
|
+
}), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26515
26548
|
colSpan: 12
|
|
26516
26549
|
}, {
|
|
26517
26550
|
children: jsxRuntime.jsx(ButtonGroup, Object.assign({
|
|
@@ -26530,22 +26563,17 @@ const WalletForm = ({
|
|
|
26530
26563
|
}));
|
|
26531
26564
|
};
|
|
26532
26565
|
|
|
26533
|
-
const styles$
|
|
26534
|
-
lastStep: {
|
|
26535
|
-
"& > span::first-of-type": {
|
|
26536
|
-
"::after": {
|
|
26537
|
-
// TODO: Polish - match Figma as much as possible
|
|
26538
|
-
}
|
|
26539
|
-
},
|
|
26540
|
-
"& > span:last-child": {
|
|
26541
|
-
position: "static"
|
|
26542
|
-
}
|
|
26543
|
-
},
|
|
26566
|
+
const styles$1 = createStyles({
|
|
26544
26567
|
step: {
|
|
26545
26568
|
"& > span:last-child": {
|
|
26546
26569
|
position: "static"
|
|
26547
26570
|
}
|
|
26548
|
-
}
|
|
26571
|
+
},
|
|
26572
|
+
wrapper: theme => ({
|
|
26573
|
+
height: "100%",
|
|
26574
|
+
padding: theme.spacing(2),
|
|
26575
|
+
width: "100%"
|
|
26576
|
+
})
|
|
26549
26577
|
});
|
|
26550
26578
|
|
|
26551
26579
|
const Onboarding$1 = ({
|
|
@@ -26553,8 +26581,6 @@ const Onboarding$1 = ({
|
|
|
26553
26581
|
createWarehouse,
|
|
26554
26582
|
onCarrierCreated,
|
|
26555
26583
|
onWarehouseCreated,
|
|
26556
|
-
isLoadingDhl,
|
|
26557
|
-
isLoadingUps,
|
|
26558
26584
|
onCompleteOnboarding,
|
|
26559
26585
|
registerDhlCarrier,
|
|
26560
26586
|
registerDhlCarrierErrors,
|
|
@@ -26596,16 +26622,20 @@ const Onboarding$1 = ({
|
|
|
26596
26622
|
address
|
|
26597
26623
|
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26598
26624
|
setAddress(address);
|
|
26599
|
-
|
|
26600
|
-
address
|
|
26601
|
-
|
|
26602
|
-
|
|
26603
|
-
|
|
26604
|
-
|
|
26605
|
-
|
|
26606
|
-
|
|
26607
|
-
|
|
26608
|
-
|
|
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
|
+
}
|
|
26609
26639
|
yield onCarrierCreated();
|
|
26610
26640
|
});
|
|
26611
26641
|
const handleCreateWarehouse = payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -26613,62 +26643,30 @@ const Onboarding$1 = ({
|
|
|
26613
26643
|
if (result) yield onWarehouseCreated();
|
|
26614
26644
|
});
|
|
26615
26645
|
const handleWalletRegistration = ({
|
|
26616
|
-
address,
|
|
26617
|
-
creditCard
|
|
26618
|
-
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26619
|
-
setAddress(address);
|
|
26620
|
-
// Step 4.1: Validate Address (if different from warehouse)
|
|
26621
|
-
yield registerStampsCarrier({
|
|
26622
|
-
address: address,
|
|
26623
|
-
agreeToCarrierTerms: agreedToTerms,
|
|
26624
|
-
carrierCode: "stamps_com",
|
|
26625
|
-
creditCard: creditCard,
|
|
26626
|
-
email: email,
|
|
26627
|
-
nickname: "stamps_com"
|
|
26628
|
-
});
|
|
26629
|
-
yield
|
|
26630
|
-
|
|
26631
|
-
|
|
26632
|
-
|
|
26633
|
-
|
|
26634
|
-
|
|
26635
|
-
|
|
26636
|
-
|
|
26637
|
-
|
|
26638
|
-
|
|
26639
|
-
|
|
26640
|
-
alignItems: "center",
|
|
26641
|
-
display: "flex",
|
|
26642
|
-
flexDirection: "column"
|
|
26643
|
-
},
|
|
26644
|
-
"data-testid": "onboarding-complete"
|
|
26645
|
-
}, {
|
|
26646
|
-
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
26647
|
-
variant: "heading4"
|
|
26648
|
-
}, {
|
|
26649
|
-
children: t("onboarding:success.title")
|
|
26650
|
-
})), jsxRuntime.jsx(Spacer, {
|
|
26651
|
-
multiplier: 2
|
|
26652
|
-
}), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
26653
|
-
variant: "subtitle1"
|
|
26654
|
-
}, {
|
|
26655
|
-
children: t("onboarding:success.subtitle")
|
|
26656
|
-
})), jsxRuntime.jsx(Spacer, {
|
|
26657
|
-
multiplier: 48
|
|
26658
|
-
}), jsxRuntime.jsx(ButtonGroup, Object.assign({
|
|
26659
|
-
justify: "center"
|
|
26660
|
-
}, {
|
|
26661
|
-
children: jsxRuntime.jsx(giger.Button, Object.assign({
|
|
26662
|
-
bold: false,
|
|
26663
|
-
color: giger.ButtonColor.PRIMARY,
|
|
26664
|
-
onClick: onCompleteOnboarding,
|
|
26665
|
-
type: "button",
|
|
26666
|
-
variant: giger.ButtonVariant.FILLED
|
|
26667
|
-
}, {
|
|
26668
|
-
children: t("onboarding:success.action")
|
|
26669
|
-
}))
|
|
26670
|
-
}))]
|
|
26671
|
-
}));
|
|
26646
|
+
address,
|
|
26647
|
+
creditCard
|
|
26648
|
+
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26649
|
+
setAddress(address);
|
|
26650
|
+
// Step 4.1: Validate Address (if different from warehouse)
|
|
26651
|
+
yield registerStampsCarrier({
|
|
26652
|
+
address: address,
|
|
26653
|
+
agreeToCarrierTerms: agreedToTerms,
|
|
26654
|
+
carrierCode: "stamps_com",
|
|
26655
|
+
creditCard: creditCard,
|
|
26656
|
+
email: email,
|
|
26657
|
+
nickname: "stamps_com"
|
|
26658
|
+
});
|
|
26659
|
+
yield handleWalletRegistrationSuccess({
|
|
26660
|
+
address
|
|
26661
|
+
});
|
|
26662
|
+
});
|
|
26663
|
+
const renderStep = () => {
|
|
26664
|
+
var _a;
|
|
26665
|
+
// Step 5: Onboarding Complete
|
|
26666
|
+
if (hasCompletedOnboarding) {
|
|
26667
|
+
return jsxRuntime.jsx(CompletionPage, {
|
|
26668
|
+
onContinue: onCompleteOnboarding
|
|
26669
|
+
});
|
|
26672
26670
|
}
|
|
26673
26671
|
// Step 1: Landing Page
|
|
26674
26672
|
if (!email) return jsxRuntime.jsx(LandingPage, {
|
|
@@ -26708,11 +26706,6 @@ const Onboarding$1 = ({
|
|
|
26708
26706
|
});
|
|
26709
26707
|
}
|
|
26710
26708
|
if (hasStampsWallet) {
|
|
26711
|
-
if (isLoadingUps || isLoadingDhl) {
|
|
26712
|
-
return jsxRuntime.jsx(Loader, {
|
|
26713
|
-
message: t("loading.carriers")
|
|
26714
|
-
});
|
|
26715
|
-
}
|
|
26716
26709
|
// Step 4.1: Handle UPS Registration Errors
|
|
26717
26710
|
if (!hasUps && registerUpsCarrierErrors) {
|
|
26718
26711
|
return jsxRuntime.jsx(CarrierRecoveryForm, {
|
|
@@ -26737,27 +26730,29 @@ const Onboarding$1 = ({
|
|
|
26737
26730
|
});
|
|
26738
26731
|
}
|
|
26739
26732
|
}
|
|
26740
|
-
return
|
|
26733
|
+
return jsxRuntime.jsx(Loader, {});
|
|
26741
26734
|
};
|
|
26742
|
-
return jsxRuntime.jsxs(
|
|
26735
|
+
return jsxRuntime.jsxs("div", Object.assign({
|
|
26736
|
+
css: styles$1.wrapper
|
|
26737
|
+
}, {
|
|
26743
26738
|
children: [jsxRuntime.jsxs(giger.Stepper, Object.assign({
|
|
26744
26739
|
currentStep: currentStep
|
|
26745
26740
|
}, {
|
|
26746
26741
|
children: [jsxRuntime.jsx(giger.Step, {
|
|
26747
|
-
css: styles$
|
|
26742
|
+
css: styles$1.step,
|
|
26748
26743
|
label: t("onboarding:steps.login")
|
|
26749
26744
|
}), jsxRuntime.jsx(giger.Step, {
|
|
26750
|
-
css: styles$
|
|
26745
|
+
css: styles$1.step,
|
|
26751
26746
|
label: t("onboarding:steps.carriers")
|
|
26752
26747
|
}), jsxRuntime.jsx(giger.Step, {
|
|
26753
|
-
css: styles$
|
|
26748
|
+
css: styles$1.step,
|
|
26754
26749
|
label: t("onboarding:steps.addresses")
|
|
26755
26750
|
}), jsxRuntime.jsx(giger.Step, {
|
|
26756
|
-
css: styles$
|
|
26751
|
+
css: styles$1.step,
|
|
26757
26752
|
label: t("onboarding:steps.payment")
|
|
26758
26753
|
})]
|
|
26759
26754
|
})), renderStep()]
|
|
26760
|
-
});
|
|
26755
|
+
}));
|
|
26761
26756
|
};
|
|
26762
26757
|
|
|
26763
26758
|
let _ = t => t,
|
|
@@ -26887,7 +26882,7 @@ const Loader = props => {
|
|
|
26887
26882
|
}));
|
|
26888
26883
|
};
|
|
26889
26884
|
|
|
26890
|
-
const getStyles$
|
|
26885
|
+
const getStyles$3 = ({
|
|
26891
26886
|
isDisabled,
|
|
26892
26887
|
isSelected
|
|
26893
26888
|
} = {}) => createStyles({
|
|
@@ -26994,7 +26989,7 @@ const AddFundsForm = ({
|
|
|
26994
26989
|
})), jsxRuntime.jsx(Spacer, {
|
|
26995
26990
|
multiplier: 2
|
|
26996
26991
|
}), jsxRuntime.jsx(giger.ChipList, Object.assign({
|
|
26997
|
-
css: getStyles$
|
|
26992
|
+
css: getStyles$3().chipList,
|
|
26998
26993
|
onChange: idx => {
|
|
26999
26994
|
const chip = chips[idx];
|
|
27000
26995
|
setSelectedChip(chip);
|
|
@@ -27009,7 +27004,7 @@ const AddFundsForm = ({
|
|
|
27009
27004
|
}
|
|
27010
27005
|
}, {
|
|
27011
27006
|
children: chips.map(chip => jsxRuntime.jsx(giger.Chip, Object.assign({
|
|
27012
|
-
css: getStyles$
|
|
27007
|
+
css: getStyles$3({
|
|
27013
27008
|
isDisabled: chip.value < _minimumAmount,
|
|
27014
27009
|
isSelected: chip.value === selectedChip.value
|
|
27015
27010
|
}).chip,
|
|
@@ -27026,7 +27021,7 @@ const AddFundsForm = ({
|
|
|
27026
27021
|
multiplier: 1
|
|
27027
27022
|
}), jsxRuntime.jsx(MoneyInput, {
|
|
27028
27023
|
control: form.control,
|
|
27029
|
-
css: getStyles$
|
|
27024
|
+
css: getStyles$3().fundsInput,
|
|
27030
27025
|
defaultValue: {
|
|
27031
27026
|
amount: undefined,
|
|
27032
27027
|
currency: api.SE.Currency.USD
|
|
@@ -27094,7 +27089,7 @@ const InlineLabel = ({
|
|
|
27094
27089
|
}), children]
|
|
27095
27090
|
}));
|
|
27096
27091
|
|
|
27097
|
-
const getStyles$
|
|
27092
|
+
const getStyles$2 = balance => createStyles({
|
|
27098
27093
|
balanceText: theme => ({
|
|
27099
27094
|
color: balance === undefined ? theme.palette.alert.main : balance >= 0 ? theme.palette.secondary.dark : theme.palette.error.main
|
|
27100
27095
|
})
|
|
@@ -27117,7 +27112,7 @@ const CarrierBalance = ({
|
|
|
27117
27112
|
}, {
|
|
27118
27113
|
children: isLoadingCarrier || isRefetchingCarrier ? jsxRuntime.jsx(giger.Spinner, {}) : jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
27119
27114
|
bold: true,
|
|
27120
|
-
css: getStyles$
|
|
27115
|
+
css: getStyles$2(balance).balanceText
|
|
27121
27116
|
}, {
|
|
27122
27117
|
children: balance === undefined ? t("manage-funding:errors.balanceUnknown") : formatMoney({
|
|
27123
27118
|
amount: balance,
|
|
@@ -27178,7 +27173,7 @@ const Spread = ({
|
|
|
27178
27173
|
children: children
|
|
27179
27174
|
}));
|
|
27180
27175
|
|
|
27181
|
-
const getStyles = isCustomAmount => createStyles({
|
|
27176
|
+
const getStyles$1 = isCustomAmount => createStyles({
|
|
27182
27177
|
balanceText: theme => ({
|
|
27183
27178
|
color: theme.palette.secondary.dark
|
|
27184
27179
|
}),
|
|
@@ -27210,6 +27205,7 @@ const FundAndPurchase = ({
|
|
|
27210
27205
|
carrierId,
|
|
27211
27206
|
className,
|
|
27212
27207
|
disabled,
|
|
27208
|
+
isFundingEnabled,
|
|
27213
27209
|
isFundingRequired,
|
|
27214
27210
|
onSave,
|
|
27215
27211
|
purchaseAmount,
|
|
@@ -27237,14 +27233,14 @@ const FundAndPurchase = ({
|
|
|
27237
27233
|
});
|
|
27238
27234
|
// Automatically open the Add Funds form if the carrier's balance is insufficient.
|
|
27239
27235
|
React.useEffect(() => {
|
|
27240
|
-
if (isFundingRequired && (carrier === null || carrier === void 0 ? void 0 : carrier.balance) !== undefined && carrier.balance < purchaseAmount) setIsAddFundsFormOpen(true);
|
|
27241
|
-
}, [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]);
|
|
27242
27238
|
const renderActionButtons = (addFundsForm = {}) => jsxRuntime.jsxs(ButtonGroup, Object.assign({
|
|
27243
27239
|
justify: "end"
|
|
27244
27240
|
}, {
|
|
27245
27241
|
children: [jsxRuntime.jsx(giger.Button, Object.assign({
|
|
27246
27242
|
bold: false,
|
|
27247
|
-
css: getStyles().saveRateButton,
|
|
27243
|
+
css: getStyles$1().saveRateButton,
|
|
27248
27244
|
disabled: disabled || !carrierId || isAddingFunds || isCreatingLabel,
|
|
27249
27245
|
isLoading: isSavingRate,
|
|
27250
27246
|
onClick: handleSaveRate,
|
|
@@ -27253,16 +27249,18 @@ const FundAndPurchase = ({
|
|
|
27253
27249
|
children: t("purchase-label:actions.saveRate")
|
|
27254
27250
|
})), jsxRuntime.jsx(giger.Button, Object.assign({
|
|
27255
27251
|
"data-testid": "submit-fund-and-purchase",
|
|
27256
|
-
disabled: disabled || !carrierId || isFundingRequired && isAddFundsFormOpen && addFundsForm.isSubmitted && !addFundsForm.isValid,
|
|
27252
|
+
disabled: disabled || !carrierId || isFundingEnabled && isFundingRequired && isAddFundsFormOpen && addFundsForm.isSubmitted && !addFundsForm.isValid,
|
|
27257
27253
|
isLoading: addFundsForm.isSubmitting || isAddingFunds || isCreatingLabel,
|
|
27258
27254
|
onClick: isAddFundsFormOpen ? addFundsForm.submit : onPurchase
|
|
27259
27255
|
}, {
|
|
27260
27256
|
children: isAddFundsFormOpen ? t("manage-funding:actions.addFundsAndPurchase") : t("purchase-label:actions.purchaseNow")
|
|
27261
27257
|
}))]
|
|
27262
27258
|
}));
|
|
27259
|
+
// Render: not a walleted carrier;
|
|
27260
|
+
// don't show balance or funding form
|
|
27263
27261
|
if (!isFundingRequired) return jsxRuntime.jsx("div", Object.assign({
|
|
27264
27262
|
className: className,
|
|
27265
|
-
css: getStyles().container
|
|
27263
|
+
css: getStyles$1().container
|
|
27266
27264
|
}, {
|
|
27267
27265
|
children: renderActionButtons()
|
|
27268
27266
|
}));
|
|
@@ -27275,9 +27273,23 @@ const FundAndPurchase = ({
|
|
|
27275
27273
|
setIsAddFundsFormOpen(false);
|
|
27276
27274
|
onPurchase();
|
|
27277
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
|
|
27278
27290
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
27279
27291
|
className: className,
|
|
27280
|
-
css: getStyles().container
|
|
27292
|
+
css: getStyles$1().container
|
|
27281
27293
|
}, {
|
|
27282
27294
|
children: [jsxRuntime.jsxs(Spread, {
|
|
27283
27295
|
children: [jsxRuntime.jsx(CarrierBalance, {
|
|
@@ -27308,13 +27320,13 @@ const FundAndPurchase = ({
|
|
|
27308
27320
|
var _a, _b;
|
|
27309
27321
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
27310
27322
|
children: [jsxRuntime.jsxs("section", Object.assign({
|
|
27311
|
-
css: getStyles(addFundsForm.isCustomAmount).formExtension
|
|
27323
|
+
css: getStyles$1(addFundsForm.isCustomAmount).formExtension
|
|
27312
27324
|
}, {
|
|
27313
27325
|
children: [jsxRuntime.jsx(InlineLabel, Object.assign({
|
|
27314
27326
|
label: t("manage-funding:fundAndPurchase.newBalance")
|
|
27315
27327
|
}, {
|
|
27316
27328
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
27317
|
-
css: getStyles().balanceText
|
|
27329
|
+
css: getStyles$1().balanceText
|
|
27318
27330
|
}, {
|
|
27319
27331
|
children: formatMoney({
|
|
27320
27332
|
amount: balance + ((_a = addFundsForm.selectedAmount) !== null && _a !== void 0 ? _a : 0),
|
|
@@ -27325,7 +27337,7 @@ const FundAndPurchase = ({
|
|
|
27325
27337
|
label: t("manage-funding:fundAndPurchase.finalBalance")
|
|
27326
27338
|
}, {
|
|
27327
27339
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
27328
|
-
css: getStyles().balanceText
|
|
27340
|
+
css: getStyles$1().balanceText
|
|
27329
27341
|
}, {
|
|
27330
27342
|
children: formatMoney({
|
|
27331
27343
|
amount: balance + ((_b = addFundsForm.selectedAmount) !== null && _b !== void 0 ? _b : 0) - purchaseAmount,
|
|
@@ -27351,7 +27363,7 @@ const FundAndPurchase = ({
|
|
|
27351
27363
|
}));
|
|
27352
27364
|
};
|
|
27353
27365
|
|
|
27354
|
-
const styles
|
|
27366
|
+
const styles = createStyles({
|
|
27355
27367
|
fundAndPurchase: theme => ({
|
|
27356
27368
|
borderTop: `1px solid ${theme.palette.gray.ultraLight}`
|
|
27357
27369
|
}),
|
|
@@ -27490,7 +27502,7 @@ const RateForm = ({
|
|
|
27490
27502
|
onClick: onSelectRate,
|
|
27491
27503
|
options: showHiddenRates ? rateOptions : filteredRateOptions
|
|
27492
27504
|
}), rateOptions.some(option => option.requiresAcknowledgement) && rateOptions.length > 5 && jsxRuntime.jsx(giger.Link, Object.assign({
|
|
27493
|
-
css: styles
|
|
27505
|
+
css: styles.showMoreOrLessRatesButton,
|
|
27494
27506
|
onClick: () => {
|
|
27495
27507
|
var _a;
|
|
27496
27508
|
setShowHiddenRates(!showHiddenRates);
|
|
@@ -27511,7 +27523,7 @@ const RateForm = ({
|
|
|
27511
27523
|
}))
|
|
27512
27524
|
}))]
|
|
27513
27525
|
}) : !isLoading && errors && !!errors.length ? null : jsxRuntime.jsxs("article", Object.assign({
|
|
27514
|
-
css: styles
|
|
27526
|
+
css: styles.ratesInterstitial,
|
|
27515
27527
|
role: "presentation"
|
|
27516
27528
|
}, {
|
|
27517
27529
|
children: [jsxRuntime.jsx(Cube, {
|
|
@@ -27531,8 +27543,9 @@ const RateForm = ({
|
|
|
27531
27543
|
})]
|
|
27532
27544
|
})), jsxRuntime.jsx(FundAndPurchase, {
|
|
27533
27545
|
carrierId: selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.carrierId,
|
|
27534
|
-
css: styles
|
|
27546
|
+
css: styles.fundAndPurchase,
|
|
27535
27547
|
disabled: disabled,
|
|
27548
|
+
isFundingEnabled: features === null || features === void 0 ? void 0 : features.enableFunding,
|
|
27536
27549
|
isFundingRequired: (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.balance) !== undefined && !!selectedRate.requiresFundedAmount,
|
|
27537
27550
|
onPurchase: handleSubmit,
|
|
27538
27551
|
onSave: handleSaveRate,
|
|
@@ -27541,7 +27554,7 @@ const RateForm = ({
|
|
|
27541
27554
|
}));
|
|
27542
27555
|
};
|
|
27543
27556
|
|
|
27544
|
-
const
|
|
27557
|
+
const SuspendSalesOrder = ({
|
|
27545
27558
|
children,
|
|
27546
27559
|
errors,
|
|
27547
27560
|
isLoading,
|
|
@@ -27586,17 +27599,20 @@ const getTableWrapperStyles = theme => /*#__PURE__*/react$1.css({
|
|
|
27586
27599
|
}
|
|
27587
27600
|
}, process.env.NODE_ENV === "production" ? "" : ";label:getTableWrapperStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIml0ZW1zLWJyZWFrZG93bi5zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS2dEIiwiZmlsZSI6Iml0ZW1zLWJyZWFrZG93bi5zdHlsZXMudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBjc3MgfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3RcIjtcclxuZXhwb3J0IGNvbnN0IGdldE51bWVyaWNDZWxsU3R5bGUgPSAodGhlbWUpID0+IGNzcyh7XHJcbiAgICB0ZXh0QWxpZ246IFwicmlnaHRcIixcclxuICAgIHdpZHRoOiBcIjEwMHB4XCIsXHJcbn0pO1xyXG5leHBvcnQgY29uc3QgZ2V0VGFibGVXcmFwcGVyU3R5bGVzID0gKHRoZW1lKSA9PiBjc3Moe1xyXG4gICAgXCImJiA+IGRpdlwiOiB7XHJcbiAgICAgICAgYm94U2hhZG93OiBcIm5vbmVcIixcclxuICAgIH0sXHJcbiAgICBcIiYmID4gZGl2IHRhYmxlIHRoZWFkIHRoXCI6IHtcclxuICAgICAgICBmb250U3R5bGU6IFwiaXRhbGljXCIsXHJcbiAgICAgICAgZm9udFdlaWdodDogdGhlbWUudHlwb2dyYXBoeS5mb250V2VpZ2h0Lm5vcm1hbCxcclxuICAgIH0sXHJcbn0pO1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1pdGVtcy1icmVha2Rvd24uc3R5bGVzLmpzLm1hcCJdfQ== */");
|
|
27588
27601
|
|
|
27589
|
-
const ItemsBreakdownTableHeader = (
|
|
27602
|
+
const ItemsBreakdownTableHeader = ({
|
|
27603
|
+
hasValue,
|
|
27604
|
+
hasTotal
|
|
27605
|
+
}) => jsxRuntime.jsx(giger.TableHeader, {
|
|
27590
27606
|
children: jsxRuntime.jsxs(giger.TableBaseRow, {
|
|
27591
27607
|
children: [jsxRuntime.jsx(giger.TableHeaderCell, {}), jsxRuntime.jsx(giger.TableHeaderCell, Object.assign({
|
|
27592
27608
|
css: getNumericCellStyle
|
|
27593
27609
|
}, {
|
|
27594
27610
|
children: "Qty"
|
|
27595
|
-
})), jsxRuntime.jsx(giger.TableHeaderCell, Object.assign({
|
|
27611
|
+
})), hasValue && jsxRuntime.jsx(giger.TableHeaderCell, Object.assign({
|
|
27596
27612
|
css: getNumericCellStyle
|
|
27597
27613
|
}, {
|
|
27598
27614
|
children: "$/ea"
|
|
27599
|
-
})), jsxRuntime.jsx(giger.TableHeaderCell, Object.assign({
|
|
27615
|
+
})), hasTotal && jsxRuntime.jsx(giger.TableHeaderCell, Object.assign({
|
|
27600
27616
|
css: getNumericCellStyle
|
|
27601
27617
|
}, {
|
|
27602
27618
|
children: "$ Total"
|
|
@@ -27606,11 +27622,16 @@ const ItemsBreakdownTableHeader = () => jsxRuntime.jsx(giger.TableHeader, {
|
|
|
27606
27622
|
const ItemsBreakdown = ({
|
|
27607
27623
|
items
|
|
27608
27624
|
}) => {
|
|
27625
|
+
const hasValue = items.some(item => item.value !== undefined);
|
|
27626
|
+
const hasTotal = items.some(item => item.totalValue !== undefined);
|
|
27609
27627
|
return jsxRuntime.jsx("div", Object.assign({
|
|
27610
27628
|
css: getTableWrapperStyles
|
|
27611
27629
|
}, {
|
|
27612
27630
|
children: jsxRuntime.jsx(giger.Table, Object.assign({
|
|
27613
|
-
header: jsxRuntime.jsx(ItemsBreakdownTableHeader, {
|
|
27631
|
+
header: jsxRuntime.jsx(ItemsBreakdownTableHeader, {
|
|
27632
|
+
hasTotal: hasTotal,
|
|
27633
|
+
hasValue: hasValue
|
|
27634
|
+
})
|
|
27614
27635
|
}, {
|
|
27615
27636
|
children: jsxRuntime.jsx(giger.TableBody, {
|
|
27616
27637
|
children: items.map(({
|
|
@@ -27630,11 +27651,11 @@ const ItemsBreakdown = ({
|
|
|
27630
27651
|
css: getNumericCellStyle
|
|
27631
27652
|
}, {
|
|
27632
27653
|
children: quantity
|
|
27633
|
-
})), jsxRuntime.jsx(giger.TableBodyCell, Object.assign({
|
|
27654
|
+
})), hasValue && jsxRuntime.jsx(giger.TableBodyCell, Object.assign({
|
|
27634
27655
|
css: getNumericCellStyle
|
|
27635
27656
|
}, {
|
|
27636
|
-
children: formatMoney(value)
|
|
27637
|
-
})), jsxRuntime.jsx(giger.TableBodyCell, Object.assign({
|
|
27657
|
+
children: value && formatMoney(value)
|
|
27658
|
+
})), hasTotal && jsxRuntime.jsx(giger.TableBodyCell, Object.assign({
|
|
27638
27659
|
css: getNumericCellStyle
|
|
27639
27660
|
}, {
|
|
27640
27661
|
children: totalValue && formatMoney(totalValue)
|
|
@@ -28047,7 +28068,7 @@ const ShipmentForm = ({
|
|
|
28047
28068
|
warehouseId,
|
|
28048
28069
|
warehouses
|
|
28049
28070
|
}) => {
|
|
28050
|
-
var _a, _b, _c, _d;
|
|
28071
|
+
var _a, _b, _c, _d, _e;
|
|
28051
28072
|
features = Object.assign({
|
|
28052
28073
|
browseRates: true,
|
|
28053
28074
|
includeShipsuranceInsurance: true,
|
|
@@ -28220,8 +28241,8 @@ const ShipmentForm = ({
|
|
|
28220
28241
|
}
|
|
28221
28242
|
}, [form]);
|
|
28222
28243
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
28223
|
-
const
|
|
28224
|
-
payload = __rest(
|
|
28244
|
+
const _f = values,
|
|
28245
|
+
payload = __rest(_f, ["__mode"]);
|
|
28225
28246
|
const updatedShipment = yield onSubmit(Object.assign(Object.assign({}, shipment || {}), payload));
|
|
28226
28247
|
// Defer shipment hydration to the task queue so that the submission promise resolves first, otherwise the
|
|
28227
28248
|
// submission count will increment after hydration resets the form, keeping it in revalidate mode
|
|
@@ -28335,6 +28356,10 @@ const ShipmentForm = ({
|
|
|
28335
28356
|
} = form.getValues();
|
|
28336
28357
|
form.setValue("__mode", (features === null || features === void 0 ? void 0 : features.selectService) ? __mode : "browse_rates");
|
|
28337
28358
|
}, [form, features === null || features === void 0 ? void 0 : features.selectService]);
|
|
28359
|
+
const salesOrderItems = React.useMemo(() => getSalesOrderItemsFromSalesOrderOrShipment({
|
|
28360
|
+
salesOrder,
|
|
28361
|
+
shipment
|
|
28362
|
+
}), [salesOrder, shipment]);
|
|
28338
28363
|
if (isLoading) return jsxRuntime.jsx(Loader, {
|
|
28339
28364
|
message: t("loading.shipment")
|
|
28340
28365
|
});
|
|
@@ -28397,7 +28422,7 @@ const ShipmentForm = ({
|
|
|
28397
28422
|
}), jsxRuntime.jsx(Spacer, {
|
|
28398
28423
|
displayOn: isEditShipFormToOpen ? "tablet" : undefined,
|
|
28399
28424
|
multiplier: 2
|
|
28400
|
-
}), editShipToForm, jsxRuntime.jsxs(FieldLabel, Object.assign({
|
|
28425
|
+
}), editShipToForm, (salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.orderDate) && jsxRuntime.jsxs(FieldLabel, Object.assign({
|
|
28401
28426
|
label: t("purchase-label:fields.orderDate")
|
|
28402
28427
|
}, {
|
|
28403
28428
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
@@ -28405,7 +28430,7 @@ const ShipmentForm = ({
|
|
|
28405
28430
|
}, {
|
|
28406
28431
|
children: formatDate(salesOrder.orderDate)
|
|
28407
28432
|
})), jsxRuntime.jsx(Spacer, {})]
|
|
28408
|
-
})), jsxRuntime.jsxs(FieldLabel, Object.assign({
|
|
28433
|
+
})), ((_b = salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.paymentDetails) === null || _b === void 0 ? void 0 : _b.grandTotal) && jsxRuntime.jsxs(FieldLabel, Object.assign({
|
|
28409
28434
|
label: t("purchase-label:fields.orderValue")
|
|
28410
28435
|
}, {
|
|
28411
28436
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
@@ -28421,7 +28446,7 @@ const ShipmentForm = ({
|
|
|
28421
28446
|
}, {
|
|
28422
28447
|
children: requestedServices.length > 1 ? t("purchase-label:multipleShippingServices") : requestedServices[0].toString()
|
|
28423
28448
|
})), jsxRuntime.jsx(Spacer, {})]
|
|
28424
|
-
})), salesOrder.paymentDetails.estimatedShipping.amount > 0 && jsxRuntime.jsxs(FieldLabel, Object.assign({
|
|
28449
|
+
})), salesOrder && salesOrder.paymentDetails.estimatedShipping.amount > 0 && jsxRuntime.jsxs(FieldLabel, Object.assign({
|
|
28425
28450
|
label: t("purchase-label:fields.estimatedShipping")
|
|
28426
28451
|
}, {
|
|
28427
28452
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
@@ -28429,7 +28454,7 @@ const ShipmentForm = ({
|
|
|
28429
28454
|
}, {
|
|
28430
28455
|
children: formatMoney(salesOrder.paymentDetails.estimatedShipping)
|
|
28431
28456
|
})), jsxRuntime.jsx(Spacer, {})]
|
|
28432
|
-
})),
|
|
28457
|
+
})), salesOrderItems.length > 0 && jsxRuntime.jsx(FieldLabel, Object.assign({
|
|
28433
28458
|
label: t("purchase-label:fields.items")
|
|
28434
28459
|
}, {
|
|
28435
28460
|
children: jsxRuntime.jsxs("div", Object.assign({
|
|
@@ -28441,7 +28466,7 @@ const ShipmentForm = ({
|
|
|
28441
28466
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
28442
28467
|
variant: "body2"
|
|
28443
28468
|
}, {
|
|
28444
|
-
children:
|
|
28469
|
+
children: salesOrderItems.length.toString()
|
|
28445
28470
|
})), jsxRuntime.jsxs(giger.Link, Object.assign({
|
|
28446
28471
|
css: theme => ({
|
|
28447
28472
|
alignItems: "center",
|
|
@@ -28460,15 +28485,7 @@ const ShipmentForm = ({
|
|
|
28460
28485
|
}))]
|
|
28461
28486
|
}))
|
|
28462
28487
|
})), showItems && jsxRuntime.jsx(ItemsBreakdown, {
|
|
28463
|
-
items:
|
|
28464
|
-
detail: `SKU ${item.lineItemDetails.sku}`,
|
|
28465
|
-
name: item.lineItemDetails.name,
|
|
28466
|
-
quantity: item.quantity,
|
|
28467
|
-
subDetail: item.requestedShippingOptions.shippingService,
|
|
28468
|
-
subDetailValue: item.priceSummary.estimatedShipping,
|
|
28469
|
-
totalValue: item.priceSummary.total,
|
|
28470
|
-
value: item.priceSummary.unitPrice
|
|
28471
|
-
}))
|
|
28488
|
+
items: salesOrderItems
|
|
28472
28489
|
})]
|
|
28473
28490
|
})), jsxRuntime.jsx("div", {
|
|
28474
28491
|
ref: customsItemErrorScrollToRef
|
|
@@ -28492,7 +28509,7 @@ const ShipmentForm = ({
|
|
|
28492
28509
|
}), jsxRuntime.jsx(CustomsItemsDisplay, {
|
|
28493
28510
|
onUpdate: handleUpdateCustomsItems,
|
|
28494
28511
|
shipment: shipment
|
|
28495
|
-
}), ((
|
|
28512
|
+
}), ((_c = customsErrors === null || customsErrors === void 0 ? void 0 : customsErrors.customsItems) === null || _c === void 0 ? void 0 : _c.type) === "too_small" && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
28496
28513
|
children: [jsxRuntime.jsx(Spacer, {}), jsxRuntime.jsx(giger.InlineNotification, {
|
|
28497
28514
|
title: t("purchase-label:errorMessages.customsItemsRequired"),
|
|
28498
28515
|
type: giger.NotificationType.ERROR
|
|
@@ -28652,7 +28669,7 @@ const ShipmentForm = ({
|
|
|
28652
28669
|
label: "purchase-label:fields.addOns"
|
|
28653
28670
|
}, {
|
|
28654
28671
|
children: [jsxRuntime.jsx(Switch, Object.assign({
|
|
28655
|
-
defaultChecked: ((
|
|
28672
|
+
defaultChecked: ((_d = shipment === null || shipment === void 0 ? void 0 : shipment.confirmation) !== null && _d !== void 0 ? _d : "none") !== "none",
|
|
28656
28673
|
label: t("purchase-label:fields.confirmation"),
|
|
28657
28674
|
name: "confirmationEnabled",
|
|
28658
28675
|
shouldUnmount: true,
|
|
@@ -28668,7 +28685,7 @@ const ShipmentForm = ({
|
|
|
28668
28685
|
shouldUnregister: true
|
|
28669
28686
|
})
|
|
28670
28687
|
})), jsxRuntime.jsxs(Switch, Object.assign({
|
|
28671
|
-
defaultChecked: ((
|
|
28688
|
+
defaultChecked: ((_e = shipment === null || shipment === void 0 ? void 0 : shipment.insuranceProvider) !== null && _e !== void 0 ? _e : "none") !== "none",
|
|
28672
28689
|
label: t("purchase-label:fields.insurance"),
|
|
28673
28690
|
name: "insuranceEnabled",
|
|
28674
28691
|
onChange: () => setInsuranceEnabled(true),
|
|
@@ -28957,6 +28974,30 @@ const Shipment$1 = ({
|
|
|
28957
28974
|
});
|
|
28958
28975
|
};
|
|
28959
28976
|
|
|
28977
|
+
const SuspendShipment = ({
|
|
28978
|
+
children,
|
|
28979
|
+
errors,
|
|
28980
|
+
isLoading,
|
|
28981
|
+
shipment
|
|
28982
|
+
}) => {
|
|
28983
|
+
const {
|
|
28984
|
+
t
|
|
28985
|
+
} = reactI18next.useTranslation(["common", "purchase-label"]);
|
|
28986
|
+
if (isLoading) return jsxRuntime.jsx(Loader, {
|
|
28987
|
+
message: t("loading.shipment")
|
|
28988
|
+
});
|
|
28989
|
+
if (errors) throw new Error(errors.map(e => e.message).join(", "));
|
|
28990
|
+
if (!shipment) throw new Error("errorMessages.unableToLoad.shipment");
|
|
28991
|
+
return jsxRuntime.jsx("div", Object.assign({
|
|
28992
|
+
css: {
|
|
28993
|
+
height: "100%",
|
|
28994
|
+
width: "100%"
|
|
28995
|
+
}
|
|
28996
|
+
}, {
|
|
28997
|
+
children: children
|
|
28998
|
+
}));
|
|
28999
|
+
};
|
|
29000
|
+
|
|
28960
29001
|
const VoidLabel$1 = ({
|
|
28961
29002
|
onComplete,
|
|
28962
29003
|
onSubmit,
|
|
@@ -29093,33 +29134,43 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
29093
29134
|
ManageWarehouses: ManageWarehouses$1,
|
|
29094
29135
|
Onboarding: Onboarding$1,
|
|
29095
29136
|
RateForm: RateForm,
|
|
29096
|
-
|
|
29137
|
+
SuspendSalesOrder: SuspendSalesOrder,
|
|
29097
29138
|
ShipmentForm: ShipmentForm,
|
|
29098
29139
|
schedulePickupForCarrier: schedulePickupForCarrier,
|
|
29099
29140
|
Shipment: Shipment$1,
|
|
29141
|
+
SuspendShipment: SuspendShipment,
|
|
29100
29142
|
WarehouseForm: WarehouseForm,
|
|
29101
29143
|
VoidLabel: VoidLabel$1,
|
|
29102
29144
|
WalletForm: WalletForm,
|
|
29103
|
-
styles: styles$
|
|
29145
|
+
styles: styles$2,
|
|
29104
29146
|
billingAddressSchema: billingAddressSchema,
|
|
29105
29147
|
walletSchema: walletSchema,
|
|
29106
29148
|
BillingFields: BillingFields
|
|
29107
29149
|
});
|
|
29108
29150
|
|
|
29109
|
-
const
|
|
29151
|
+
const getStyles = showForm => createStyles({
|
|
29152
|
+
edit: theme => ({
|
|
29153
|
+
color: theme.palette.primary.main,
|
|
29154
|
+
padding: `0 ${theme.spacing(2)}`
|
|
29155
|
+
}),
|
|
29110
29156
|
form: theme => ({
|
|
29111
29157
|
backgroundColor: theme.palette.gray.megaLight,
|
|
29112
|
-
display: "flex",
|
|
29158
|
+
display: showForm ? "flex" : "none",
|
|
29113
29159
|
flexDirection: "column",
|
|
29114
|
-
gap: theme.spacing(2),
|
|
29115
29160
|
padding: theme.spacing(2)
|
|
29116
|
-
})
|
|
29161
|
+
}),
|
|
29162
|
+
input: theme => ({
|
|
29163
|
+
width: theme.spacing(13)
|
|
29164
|
+
}),
|
|
29165
|
+
marginLeft: {
|
|
29166
|
+
marginLeft: "auto"
|
|
29167
|
+
}
|
|
29117
29168
|
});
|
|
29118
29169
|
|
|
29119
29170
|
const autoFundingSchema = zod.z.object({
|
|
29120
29171
|
isEnabled: zod.z.boolean(),
|
|
29121
29172
|
lowBalancePurchaseThreshold: moneySchema.extend({
|
|
29122
|
-
amount: zod.z.number().min(
|
|
29173
|
+
amount: zod.z.number().min(10)
|
|
29123
29174
|
}),
|
|
29124
29175
|
maximumPurchasesPerDay: zod.z.number().min(1),
|
|
29125
29176
|
purchaseAmount: moneySchema.extend({
|
|
@@ -29129,7 +29180,9 @@ const autoFundingSchema = zod.z.object({
|
|
|
29129
29180
|
|
|
29130
29181
|
/**
|
|
29131
29182
|
* This form that allows users to enable or disable auto funding, and
|
|
29132
|
-
* 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.
|
|
29133
29186
|
*/
|
|
29134
29187
|
const AutoFundingForm = ({
|
|
29135
29188
|
carrierId
|
|
@@ -29138,77 +29191,140 @@ const AutoFundingForm = ({
|
|
|
29138
29191
|
t
|
|
29139
29192
|
} = reactI18next.useTranslation();
|
|
29140
29193
|
const updateAutoFunding = react.useUpdateAutoFunding(carrierId);
|
|
29141
|
-
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);
|
|
29142
29201
|
const form = reactHookForm.useForm({
|
|
29143
|
-
// TODO - [LMNT-663] We should probably make a hydration effect for autoFundingConfiguration.data
|
|
29144
|
-
defaultValues: autoFundingConfiguration.data,
|
|
29145
29202
|
resolver: validationResolver(autoFundingSchema)
|
|
29146
29203
|
});
|
|
29147
|
-
const {
|
|
29148
|
-
isDirty
|
|
29149
|
-
} = form.formState;
|
|
29150
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
|
+
});
|
|
29151
29210
|
const handleSubmit = formLogger.capture(form.handleSubmit(values => {
|
|
29211
|
+
setShowForm(prev => !prev);
|
|
29212
|
+
setIsSwitchOn(true);
|
|
29152
29213
|
const payload = values;
|
|
29153
29214
|
updateAutoFunding.mutate(payload, {
|
|
29154
29215
|
onSuccess: () => autoFundingConfiguration.refetch()
|
|
29155
29216
|
});
|
|
29156
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
|
+
*/
|
|
29157
29223
|
const handleToggle = isEnabled => {
|
|
29158
|
-
|
|
29159
|
-
|
|
29160
|
-
|
|
29161
|
-
if (
|
|
29162
|
-
|
|
29163
|
-
|
|
29164
|
-
|
|
29165
|
-
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()
|
|
29166
29231
|
});
|
|
29167
|
-
} else {
|
|
29168
|
-
// TODO - [LMNT-663] Should this throw?
|
|
29169
|
-
react.logger.error("Toggling auto-funding failed because autoFundingData is undefined.");
|
|
29170
29232
|
}
|
|
29171
29233
|
};
|
|
29172
|
-
if (autoFundingConfiguration.isLoading) return jsxRuntime.jsx(Loader, {
|
|
29234
|
+
if (autoFundingConfiguration.isLoading || updateAutoFunding.isLoading) return jsxRuntime.jsx(Loader, {
|
|
29173
29235
|
message: t("manage-funding:autoFunding.isLoading")
|
|
29174
29236
|
});
|
|
29237
|
+
if (!autoFundingSettings) throw new Error(t("errorMessages:unableToLoad.autoFundingSettings"));
|
|
29175
29238
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
29176
|
-
children: [jsxRuntime.
|
|
29177
|
-
|
|
29178
|
-
|
|
29179
|
-
|
|
29180
|
-
|
|
29181
|
-
|
|
29182
|
-
|
|
29183
|
-
|
|
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({
|
|
29184
29265
|
css: styles.form,
|
|
29266
|
+
"data-testid": "auto-funding-form",
|
|
29185
29267
|
id: "auto-funding-form",
|
|
29186
29268
|
onSubmit: handleSubmit
|
|
29187
29269
|
}, {
|
|
29188
|
-
children: [jsxRuntime.jsx(
|
|
29189
|
-
|
|
29190
|
-
|
|
29191
|
-
|
|
29192
|
-
|
|
29193
|
-
|
|
29194
|
-
|
|
29195
|
-
|
|
29196
|
-
|
|
29197
|
-
|
|
29198
|
-
|
|
29199
|
-
|
|
29200
|
-
|
|
29201
|
-
|
|
29202
|
-
|
|
29203
|
-
|
|
29204
|
-
|
|
29205
|
-
|
|
29206
|
-
|
|
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({
|
|
29207
29324
|
justify: "end"
|
|
29208
29325
|
}, {
|
|
29209
29326
|
children: [jsxRuntime.jsx(giger.Button, Object.assign({
|
|
29210
|
-
|
|
29211
|
-
onClick: () => form.reset(),
|
|
29327
|
+
onClick: isSwitchOn ? () => setShowForm(false) : () => handleToggle(false),
|
|
29212
29328
|
variant: giger.ButtonVariant.TEXT
|
|
29213
29329
|
}, {
|
|
29214
29330
|
children: t("actions.cancel")
|
|
@@ -30315,8 +30431,7 @@ var common = {
|
|
|
30315
30431
|
differentBillingAddress: "Billing address is different from Ship From Address",
|
|
30316
30432
|
name: "Name on Card",
|
|
30317
30433
|
cardNumber: "Credit Card Number",
|
|
30318
|
-
|
|
30319
|
-
expirationYear: "Year",
|
|
30434
|
+
expiration: "Card Expiration",
|
|
30320
30435
|
cvv: "CVV"
|
|
30321
30436
|
}
|
|
30322
30437
|
},
|
|
@@ -30380,6 +30495,7 @@ var common = {
|
|
|
30380
30495
|
invalidNameOrCompany: "Recipient name and company name (if provided) must have two characters in first and last name.",
|
|
30381
30496
|
noWarehouses: "You must have an active warehouse in order to use this feature",
|
|
30382
30497
|
unableToLoad: {
|
|
30498
|
+
autoFundingSettings: "Unable to load auto funding settings",
|
|
30383
30499
|
carrier: "Unable to load carrier",
|
|
30384
30500
|
carriers: "Unable to load carriers",
|
|
30385
30501
|
salesOrder: "Unable to load order",
|
|
@@ -30510,16 +30626,19 @@ var manageFunding = {
|
|
|
30510
30626
|
saveRule: "Save Rule"
|
|
30511
30627
|
},
|
|
30512
30628
|
autoFunding: {
|
|
30513
|
-
|
|
30629
|
+
edit: "Edit",
|
|
30630
|
+
editSettings: "Edit Auto-Funding Settings",
|
|
30514
30631
|
error: {
|
|
30515
30632
|
title: "Auto-Funding Error",
|
|
30516
30633
|
message: "An error occurred while trying to configure to your auto-funding rules."
|
|
30517
30634
|
},
|
|
30635
|
+
isEnabledCTA: "Enable auto-funding",
|
|
30518
30636
|
isEnabled: "Enable Auto-Funding",
|
|
30519
30637
|
isLoading: "Loading auto-funding configuration...",
|
|
30520
|
-
lowBalancePurchaseThreshold: "
|
|
30521
|
-
maximumPurchasesPerDay: "Maximum
|
|
30522
|
-
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)."
|
|
30523
30642
|
},
|
|
30524
30643
|
addFunds: {
|
|
30525
30644
|
custom: "Custom...",
|
|
@@ -30531,7 +30650,8 @@ var manageFunding = {
|
|
|
30531
30650
|
labels: {
|
|
30532
30651
|
amount: "Amount"
|
|
30533
30652
|
},
|
|
30534
|
-
minimumPurchaseAmount: "Minimum Purchase $10.00"
|
|
30653
|
+
minimumPurchaseAmount: "Minimum Purchase $10.00",
|
|
30654
|
+
other: "Other..."
|
|
30535
30655
|
},
|
|
30536
30656
|
fundAndPurchase: {
|
|
30537
30657
|
finalBalance: "Final balance after payment:",
|
|
@@ -30701,7 +30821,7 @@ var registerWallet = {
|
|
|
30701
30821
|
billing: {
|
|
30702
30822
|
title: "Billing Management",
|
|
30703
30823
|
cardSubTitle: "Enter your credit card information",
|
|
30704
|
-
addressSubTitle: "
|
|
30824
|
+
addressSubTitle: "Billing Address",
|
|
30705
30825
|
info: "Your account balance handles the cost of labels, insurance and carrier adjustments."
|
|
30706
30826
|
},
|
|
30707
30827
|
carriers: {
|
|
@@ -31104,14 +31224,14 @@ const ManageWarehouses = () => {
|
|
|
31104
31224
|
returnAddress: payload.returnAddress,
|
|
31105
31225
|
warehouseId: warehouseId
|
|
31106
31226
|
});
|
|
31107
|
-
|
|
31227
|
+
yield refreshListWarehouses();
|
|
31108
31228
|
});
|
|
31109
31229
|
const handleSetDefault = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31110
31230
|
yield updateWarehouse(Object.assign(Object.assign({}, payload), {
|
|
31111
31231
|
isDefault: true,
|
|
31112
31232
|
warehouseId
|
|
31113
31233
|
}));
|
|
31114
|
-
|
|
31234
|
+
yield refreshListWarehouses();
|
|
31115
31235
|
});
|
|
31116
31236
|
if (isLoadingWarehouses) return jsxRuntime.jsx(Loader, {
|
|
31117
31237
|
message: t("loading.warehouses")
|
|
@@ -31257,7 +31377,7 @@ const useAddress = ({
|
|
|
31257
31377
|
}), [handleValidateAddress, onChange, shipment, updateShipment]);
|
|
31258
31378
|
React.useEffect(() => {
|
|
31259
31379
|
if (!addressPreference && (shipment === null || shipment === void 0 ? void 0 : shipment.shipTo)) {
|
|
31260
|
-
handleValidateAddress(shipment === null || shipment === void 0 ? void 0 : shipment.shipTo, salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.shipTo);
|
|
31380
|
+
void handleValidateAddress(shipment === null || shipment === void 0 ? void 0 : shipment.shipTo, salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.shipTo);
|
|
31261
31381
|
}
|
|
31262
31382
|
}, [addressPreference, handleValidateAddress, salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.shipTo, shipment === null || shipment === void 0 ? void 0 : shipment.shipTo]);
|
|
31263
31383
|
const charsetWarning = React.useMemo(() => Object.keys((addressPreference === null || addressPreference === void 0 ? void 0 : addressPreference.selection) || {}).reduce((warning, key) => {
|
|
@@ -31737,6 +31857,56 @@ const ConfigureShipment = _a => {
|
|
|
31737
31857
|
});
|
|
31738
31858
|
};
|
|
31739
31859
|
|
|
31860
|
+
const Onboarding = ({
|
|
31861
|
+
onCompleteOnboarding
|
|
31862
|
+
}) => {
|
|
31863
|
+
const {
|
|
31864
|
+
data: warehouses,
|
|
31865
|
+
refetch: refetchWarehouses
|
|
31866
|
+
} = react.useListWarehouses();
|
|
31867
|
+
const {
|
|
31868
|
+
mutateAsync: createWarehouse
|
|
31869
|
+
} = react.useCreateWarehouse();
|
|
31870
|
+
const {
|
|
31871
|
+
data: carriers,
|
|
31872
|
+
refetch: refetchCarriers
|
|
31873
|
+
} = react.useListCarriers();
|
|
31874
|
+
const {
|
|
31875
|
+
error: registerStampsCarrierErrors,
|
|
31876
|
+
mutateAsync: registerStampsCarrier
|
|
31877
|
+
} = react.useConnectCarrier();
|
|
31878
|
+
const {
|
|
31879
|
+
error: registerUpsCarrierErrors,
|
|
31880
|
+
mutateAsync: registerUpsCarrier
|
|
31881
|
+
} = react.useConnectCarrier();
|
|
31882
|
+
const {
|
|
31883
|
+
error: registerDhlCarrierErrors,
|
|
31884
|
+
mutateAsync: registerDhlCarrier
|
|
31885
|
+
} = react.useConnectCarrier();
|
|
31886
|
+
const onWarehouseCreated = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
31887
|
+
yield refetchWarehouses();
|
|
31888
|
+
}), [refetchWarehouses]);
|
|
31889
|
+
const onCarrierCreated = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
31890
|
+
yield refetchCarriers();
|
|
31891
|
+
}), [refetchCarriers]);
|
|
31892
|
+
if (!carriers) return jsxRuntime.jsx(Loader, {});
|
|
31893
|
+
if (!warehouses) return jsxRuntime.jsx(Loader, {});
|
|
31894
|
+
return jsxRuntime.jsx(Onboarding$1, {
|
|
31895
|
+
carriers: carriers,
|
|
31896
|
+
createWarehouse: createWarehouse,
|
|
31897
|
+
onCarrierCreated: onCarrierCreated,
|
|
31898
|
+
onCompleteOnboarding: onCompleteOnboarding,
|
|
31899
|
+
onWarehouseCreated: onWarehouseCreated,
|
|
31900
|
+
registerDhlCarrier: registerDhlCarrier,
|
|
31901
|
+
registerDhlCarrierErrors: registerDhlCarrierErrors,
|
|
31902
|
+
registerStampsCarrier: registerStampsCarrier,
|
|
31903
|
+
registerStampsCarrierErrors: registerStampsCarrierErrors,
|
|
31904
|
+
registerUpsCarrier: registerUpsCarrier,
|
|
31905
|
+
registerUpsCarrierErrors: registerUpsCarrierErrors,
|
|
31906
|
+
warehouses: warehouses
|
|
31907
|
+
});
|
|
31908
|
+
};
|
|
31909
|
+
|
|
31740
31910
|
const usePendingShipment = ({
|
|
31741
31911
|
onLoad,
|
|
31742
31912
|
salesOrder,
|
|
@@ -31808,7 +31978,8 @@ const useConfigureShipment = ({
|
|
|
31808
31978
|
onLoad,
|
|
31809
31979
|
onShipmentUpdated,
|
|
31810
31980
|
salesOrder,
|
|
31811
|
-
warehouseId
|
|
31981
|
+
warehouseId,
|
|
31982
|
+
printLabelLayout
|
|
31812
31983
|
}) => {
|
|
31813
31984
|
var _a, _b;
|
|
31814
31985
|
const {
|
|
@@ -31825,12 +31996,12 @@ const useConfigureShipment = ({
|
|
|
31825
31996
|
yield reloadPendingShipment();
|
|
31826
31997
|
yield onShipmentUpdated === null || onShipmentUpdated === void 0 ? void 0 : onShipmentUpdated(shipment);
|
|
31827
31998
|
}), [onShipmentUpdated, reloadPendingShipment]);
|
|
31828
|
-
const
|
|
31999
|
+
const labelLayoutSetting = (_b = (_a = react.useGetAccountSettings().data) === null || _a === void 0 ? void 0 : _a.defaultLabelLayout) !== null && _b !== void 0 ? _b : "4x6";
|
|
31829
32000
|
return {
|
|
31830
32001
|
errors: pendingShipmentErrors,
|
|
31831
32002
|
isLoading: isPendingShipmentLoading,
|
|
31832
32003
|
onShipmentUpdated: handleShipmentUpdated,
|
|
31833
|
-
printLabelLayout,
|
|
32004
|
+
printLabelLayout: printLabelLayout ? printLabelLayout : labelLayoutSetting,
|
|
31834
32005
|
shipment: pendingShipment,
|
|
31835
32006
|
warehouseId
|
|
31836
32007
|
};
|
|
@@ -31889,7 +32060,7 @@ const useImportSalesOrder = ({
|
|
|
31889
32060
|
};
|
|
31890
32061
|
};
|
|
31891
32062
|
|
|
31892
|
-
const
|
|
32063
|
+
const PurchaseLabelBySalesOrder = _a => {
|
|
31893
32064
|
var {
|
|
31894
32065
|
features,
|
|
31895
32066
|
externalOrderId,
|
|
@@ -31919,7 +32090,7 @@ const SalesOrder = _a => {
|
|
|
31919
32090
|
salesOrder,
|
|
31920
32091
|
warehouseId
|
|
31921
32092
|
});
|
|
31922
|
-
return jsxRuntime.jsx(
|
|
32093
|
+
return jsxRuntime.jsx(SuspendSalesOrder, Object.assign({
|
|
31923
32094
|
salesOrder: salesOrder
|
|
31924
32095
|
}, salesOrderProps, {
|
|
31925
32096
|
children: salesOrder && jsxRuntime.jsx(ConfigureShipment, Object.assign({
|
|
@@ -31929,67 +32100,77 @@ const SalesOrder = _a => {
|
|
|
31929
32100
|
}));
|
|
31930
32101
|
};
|
|
31931
32102
|
|
|
31932
|
-
const
|
|
31933
|
-
|
|
31934
|
-
const Onboarding = ({
|
|
31935
|
-
onCompleteOnboarding
|
|
32103
|
+
const useLoadShipment = ({
|
|
32104
|
+
shipmentId
|
|
31936
32105
|
}) => {
|
|
31937
32106
|
const {
|
|
31938
|
-
|
|
31939
|
-
|
|
31940
|
-
|
|
31941
|
-
|
|
31942
|
-
|
|
31943
|
-
|
|
31944
|
-
|
|
31945
|
-
|
|
31946
|
-
|
|
31947
|
-
|
|
31948
|
-
|
|
31949
|
-
|
|
31950
|
-
|
|
31951
|
-
|
|
31952
|
-
|
|
31953
|
-
|
|
31954
|
-
|
|
31955
|
-
|
|
31956
|
-
|
|
31957
|
-
|
|
31958
|
-
|
|
31959
|
-
|
|
31960
|
-
const {
|
|
31961
|
-
|
|
31962
|
-
|
|
31963
|
-
|
|
31964
|
-
|
|
31965
|
-
|
|
31966
|
-
|
|
31967
|
-
|
|
31968
|
-
|
|
31969
|
-
|
|
31970
|
-
|
|
31971
|
-
|
|
31972
|
-
|
|
31973
|
-
|
|
31974
|
-
|
|
31975
|
-
|
|
31976
|
-
|
|
31977
|
-
|
|
31978
|
-
|
|
31979
|
-
|
|
31980
|
-
|
|
31981
|
-
|
|
31982
|
-
|
|
31983
|
-
|
|
31984
|
-
|
|
31985
|
-
|
|
31986
|
-
|
|
31987
|
-
|
|
31988
|
-
|
|
31989
|
-
|
|
31990
|
-
|
|
31991
|
-
|
|
31992
|
-
|
|
32107
|
+
data: shipment,
|
|
32108
|
+
error: loadShipmentErrors,
|
|
32109
|
+
refetch: refetchShipment,
|
|
32110
|
+
isLoading
|
|
32111
|
+
} = react.useGetShipment(shipmentId);
|
|
32112
|
+
const errors = [...(loadShipmentErrors !== null && loadShipmentErrors !== void 0 ? loadShipmentErrors : [])];
|
|
32113
|
+
return {
|
|
32114
|
+
errors: errors.length > 0 ? errors : undefined,
|
|
32115
|
+
isLoading: isLoading,
|
|
32116
|
+
refetchShipment,
|
|
32117
|
+
shipment
|
|
32118
|
+
};
|
|
32119
|
+
};
|
|
32120
|
+
|
|
32121
|
+
const PurchaseLabelByShipment = _a => {
|
|
32122
|
+
var {
|
|
32123
|
+
shipmentId,
|
|
32124
|
+
onLoad,
|
|
32125
|
+
onShipmentUpdated,
|
|
32126
|
+
features
|
|
32127
|
+
} = _a,
|
|
32128
|
+
props = __rest(_a, ["shipmentId", "onLoad", "onShipmentUpdated", "features"]);
|
|
32129
|
+
const _b = useLoadShipment({
|
|
32130
|
+
shipmentId
|
|
32131
|
+
}),
|
|
32132
|
+
{
|
|
32133
|
+
shipment
|
|
32134
|
+
} = _b,
|
|
32135
|
+
shipmentProps = __rest(_b, ["shipment"]);
|
|
32136
|
+
return jsxRuntime.jsx(SuspendShipment, Object.assign({
|
|
32137
|
+
shipment: shipment
|
|
32138
|
+
}, shipmentProps, {
|
|
32139
|
+
children: shipment && jsxRuntime.jsx(ConfigureShipment, Object.assign({
|
|
32140
|
+
errors: shipmentProps.errors,
|
|
32141
|
+
features: features,
|
|
32142
|
+
isLoading: shipmentProps.isLoading,
|
|
32143
|
+
onAddressValidation: props.onAddressValidation,
|
|
32144
|
+
onApplyPreset: props.onApplyPreset,
|
|
32145
|
+
onBeforeLabelCreate: props.onBeforeLabelCreate,
|
|
32146
|
+
onChangeAddress: props.onChangeAddress,
|
|
32147
|
+
onChangeShipmentFormMode: props.onChangeShipmentFormMode,
|
|
32148
|
+
onLabelCreateFailure: props.onLabelCreateFailure,
|
|
32149
|
+
onLabelCreateSuccess: props.onLabelCreateSuccess,
|
|
32150
|
+
onRateSaved: props.onRateSaved,
|
|
32151
|
+
onRatesCalculated: props.onRatesCalculated,
|
|
32152
|
+
onShipmentUpdated: onShipmentUpdated,
|
|
32153
|
+
onToggleAddressPreferenceDisclosure: props.onToggleAddressPreferenceDisclosure,
|
|
32154
|
+
printLabelLayout: props.printLabelLayout,
|
|
32155
|
+
shipment: shipment,
|
|
32156
|
+
shippingPresets: props.shippingPresets,
|
|
32157
|
+
warehouseId: props.warehouseId
|
|
32158
|
+
}, props))
|
|
32159
|
+
}));
|
|
32160
|
+
};
|
|
32161
|
+
|
|
32162
|
+
const PurchaseLabel = _a => {
|
|
32163
|
+
var {
|
|
32164
|
+
shipmentId
|
|
32165
|
+
} = _a,
|
|
32166
|
+
props = __rest(_a, ["shipmentId"]);
|
|
32167
|
+
if (shipmentId) {
|
|
32168
|
+
return jsxRuntime.jsx(PurchaseLabelByShipment, Object.assign({
|
|
32169
|
+
shipmentId: shipmentId
|
|
32170
|
+
}, props));
|
|
32171
|
+
} else {
|
|
32172
|
+
return jsxRuntime.jsx(PurchaseLabelBySalesOrder, Object.assign({}, props));
|
|
32173
|
+
}
|
|
31993
32174
|
};
|
|
31994
32175
|
|
|
31995
32176
|
const Shipment = ({
|
|
@@ -32060,6 +32241,8 @@ const VoidLabel = ({
|
|
|
32060
32241
|
});
|
|
32061
32242
|
};
|
|
32062
32243
|
|
|
32244
|
+
const Element$3 = registerElement("purchase-label", PurchaseLabel);
|
|
32245
|
+
|
|
32063
32246
|
const Element$2 = registerElement("onboarding", Onboarding);
|
|
32064
32247
|
|
|
32065
32248
|
const Element$1 = registerElement("view-shipment", Shipment);
|
|
@@ -32840,6 +33023,7 @@ exports.extendZod = extendZod;
|
|
|
32840
33023
|
exports.formLogger = formLogger;
|
|
32841
33024
|
exports.formatCreditCardNumber = formatCreditCardNumber;
|
|
32842
33025
|
exports.formatDate = formatDate;
|
|
33026
|
+
exports.formatExpiration = formatExpiration;
|
|
32843
33027
|
exports.formatFractionalWeight = formatFractionalWeight;
|
|
32844
33028
|
exports.formatMoney = formatMoney;
|
|
32845
33029
|
exports.fractionalWeightFactory = fractionalWeightFactory;
|
|
@@ -32852,6 +33036,7 @@ exports.getIsInternationalShipment = getIsInternationalShipment;
|
|
|
32852
33036
|
exports.getPendingShipment = getPendingShipment;
|
|
32853
33037
|
exports.getRateRequiresAcknowledgement = getRateRequiresAcknowledgement;
|
|
32854
33038
|
exports.getRequestedServices = getRequestedServices;
|
|
33039
|
+
exports.getSalesOrderItemsFromSalesOrderOrShipment = getSalesOrderItemsFromSalesOrderOrShipment;
|
|
32855
33040
|
exports.getTotalRateAmount = getTotalRateAmount;
|
|
32856
33041
|
exports.isDomesticAddress = isDomesticAddress;
|
|
32857
33042
|
exports.isFlatRatePackageCode = isFlatRatePackageCode;
|