@shipengine/elements 0.32.2 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +311 -130
- package/index.js +313 -133
- package/package.json +5 -10
- package/src/components/add-funds-form/add-funds-form.d.ts +2 -0
- package/src/components/templates/add-carrier-form/add-carrier-form-schema.d.ts +1 -1
- package/src/components/templates/address-form/address-form-schema.d.ts +153 -2
- package/src/components/templates/address-form/address-form.d.ts +2 -1
- package/src/components/templates/address-form/address-schema.d.ts +1 -1
- package/src/components/templates/carrier-recovery-form/carrier-recovery-form-schema.d.ts +5 -2
- package/src/components/templates/carrier-terms-form/carrier-terms-form.styles.d.ts +1 -0
- package/src/components/templates/landing-page/landing-page.d.ts +2 -1
- package/src/components/templates/onboarding/onboarding.d.ts +4 -1
- package/src/components/templates/onboarding/onboarding.styles.d.ts +10 -0
- package/src/components/templates/wallet-form/wallet-form.d.ts +1 -0
- package/src/components/templates/wallet-form/wallet-schema.d.ts +5 -2
- package/src/components/templates/warehouse-form/warehouse-form-schema.d.ts +3 -3
- package/src/components/templates/warehouse-form/warehouse-form.d.ts +1 -1
- package/src/elements/account-settings/account-settings.d.ts +8 -2
- package/src/elements/onboarding/onboarding.d.ts +11 -3
- package/src/elements/purchase-label/purchase-label.d.ts +8 -2
- package/src/elements/view-shipment/view-shipment.d.ts +8 -2
- package/src/elements/void-label/void-label.d.ts +8 -2
- package/src/hooks/index.d.ts +1 -0
- package/src/hooks/use-black-box-detection.d.ts +23 -0
- package/src/locales/en/index.d.ts +8 -2
- package/src/testing/extensions/queries/by-icon-name.d.ts +1 -1
package/index.cjs
CHANGED
|
@@ -16,7 +16,6 @@ var gigerTheme = require('@packlink/giger-theme');
|
|
|
16
16
|
var react = require('@emotion/react');
|
|
17
17
|
var humps = require('humps');
|
|
18
18
|
var reactDom = require('react-dom');
|
|
19
|
-
var brands = require('@packlink/brands');
|
|
20
19
|
var reactQuery = require('react-query');
|
|
21
20
|
var reactHookForm = require('react-hook-form');
|
|
22
21
|
var ReactDatePicker = require('react-datepicker');
|
|
@@ -4505,6 +4504,66 @@ const useAddressValidation = () => {
|
|
|
4505
4504
|
};
|
|
4506
4505
|
};
|
|
4507
4506
|
|
|
4507
|
+
/*
|
|
4508
|
+
* ****** WARNING *******
|
|
4509
|
+
* This hook was designed with the intention of only being used within the onboarding flow during carrier registration and carrier recovery and as such is not intended to be used elsewhere.
|
|
4510
|
+
* There is a chance that more than one script will be mounted if this hook is used elsewhere.
|
|
4511
|
+
*/
|
|
4512
|
+
/**
|
|
4513
|
+
* Creates an encoded device fingerprint string - aka black box - containing information about the end-user's computing device such as OS, browser, etc.
|
|
4514
|
+
* https://developer.bazaarvoice.com/conversations-api/deprecations/iovation-web#snare_js_only
|
|
4515
|
+
*/
|
|
4516
|
+
const useBlackboxDetection = ({
|
|
4517
|
+
onSuccess,
|
|
4518
|
+
onError
|
|
4519
|
+
}) => {
|
|
4520
|
+
React.useEffect(() => {
|
|
4521
|
+
// basic configurations must be on page before snare.js is loaded
|
|
4522
|
+
window.io_install_stm = false; // do not install Active X
|
|
4523
|
+
window.io_exclude_stm = 12; // do not run Active X
|
|
4524
|
+
window.io_install_flash = false; // do not install Flash
|
|
4525
|
+
window.io_enable_rip = true; // collect Real IP information
|
|
4526
|
+
const pollBlackBox = () => {
|
|
4527
|
+
try {
|
|
4528
|
+
if (typeof ioGetBlackbox !== "function") {
|
|
4529
|
+
return;
|
|
4530
|
+
}
|
|
4531
|
+
// eslint-disable-next-line
|
|
4532
|
+
const blackboxInfo = ioGetBlackbox();
|
|
4533
|
+
// Each call to ioGetBlackbox() returns a JavaScript object with information about the current state of the black box and eventually the black box string itself
|
|
4534
|
+
if (blackboxInfo.finished) {
|
|
4535
|
+
clearTimeout(intervalId);
|
|
4536
|
+
onSuccess(blackboxInfo.blackbox);
|
|
4537
|
+
}
|
|
4538
|
+
} catch (_e) {
|
|
4539
|
+
onError();
|
|
4540
|
+
}
|
|
4541
|
+
};
|
|
4542
|
+
const intervalId = setInterval(pollBlackBox, 500);
|
|
4543
|
+
// attach script to DOM
|
|
4544
|
+
const script = document.createElement("script");
|
|
4545
|
+
script.type = "text/javascript";
|
|
4546
|
+
script.async = true;
|
|
4547
|
+
script.src = "https://mpsnare.iesnare.com/snare.js";
|
|
4548
|
+
script.addEventListener("error", _e => {
|
|
4549
|
+
if (typeof ioGetBlackbox !== "function") {
|
|
4550
|
+
onError();
|
|
4551
|
+
}
|
|
4552
|
+
});
|
|
4553
|
+
document.head.appendChild(script);
|
|
4554
|
+
return () => {
|
|
4555
|
+
if (intervalId) {
|
|
4556
|
+
clearTimeout(intervalId);
|
|
4557
|
+
}
|
|
4558
|
+
delete window.io_install_stm;
|
|
4559
|
+
delete window.io_exclude_stm;
|
|
4560
|
+
delete window.io_install_flash;
|
|
4561
|
+
delete window.io_enable_rip;
|
|
4562
|
+
document.head.removeChild(script);
|
|
4563
|
+
};
|
|
4564
|
+
}, [onSuccess, onError]);
|
|
4565
|
+
};
|
|
4566
|
+
|
|
4508
4567
|
const useListConnectedCarriers = () => {
|
|
4509
4568
|
const {
|
|
4510
4569
|
data: carriers,
|
|
@@ -6887,7 +6946,7 @@ const LabelLayoutSettings = ({
|
|
|
6887
6946
|
}, {
|
|
6888
6947
|
children: [labelLayout === "letter" && jsxRuntime.jsx(giger.Icon, {
|
|
6889
6948
|
css: styles$p.icon,
|
|
6890
|
-
name:
|
|
6949
|
+
name: gigerTheme.IconNames.CHECK_FILLED
|
|
6891
6950
|
}), jsxRuntime.jsx("div", Object.assign({
|
|
6892
6951
|
css: styles$p.letterInner
|
|
6893
6952
|
}, {
|
|
@@ -6919,7 +6978,7 @@ const LabelLayoutSettings = ({
|
|
|
6919
6978
|
}, {
|
|
6920
6979
|
children: [labelLayout === "4x6" && jsxRuntime.jsx(giger.Icon, {
|
|
6921
6980
|
css: styles$p.icon,
|
|
6922
|
-
name:
|
|
6981
|
+
name: gigerTheme.IconNames.CHECK_FILLED
|
|
6923
6982
|
}), jsxRuntime.jsx("div", Object.assign({
|
|
6924
6983
|
css: styles$p.thermalInner
|
|
6925
6984
|
}, {
|
|
@@ -7396,6 +7455,7 @@ const getWrapperStyles = theme => /*#__PURE__*/css.css(process.env.NODE_ENV ===
|
|
|
7396
7455
|
|
|
7397
7456
|
const DatePickerController = createFieldController();
|
|
7398
7457
|
const DatePicker = fieldProps => {
|
|
7458
|
+
const alchemy$1 = React.useContext(alchemy.AlchemyContext);
|
|
7399
7459
|
const theme = react.useTheme();
|
|
7400
7460
|
const datePickerRef = React.useRef(null);
|
|
7401
7461
|
return jsxRuntime.jsx(DatePickerController, Object.assign({}, fieldProps, {
|
|
@@ -7416,7 +7476,7 @@ const DatePicker = fieldProps => {
|
|
|
7416
7476
|
css: getOverrideStyles(theme)
|
|
7417
7477
|
}, {
|
|
7418
7478
|
children: jsxRuntime.jsx(ReactDatePicker__default["default"], Object.assign({
|
|
7419
|
-
locale:
|
|
7479
|
+
locale: alchemy$1 === null || alchemy$1 === void 0 ? void 0 : alchemy$1.locale
|
|
7420
7480
|
}, datePickerProps, {
|
|
7421
7481
|
customInput: /*#__PURE__*/React.createElement( /*#__PURE__*/React.forwardRef(function InputWrapper(_a, forwardedRef) {
|
|
7422
7482
|
var _b;
|
|
@@ -8787,16 +8847,8 @@ const AddFundsForm = ({
|
|
|
8787
8847
|
}))]
|
|
8788
8848
|
}))]
|
|
8789
8849
|
})]
|
|
8790
|
-
})),
|
|
8791
|
-
|
|
8792
|
-
multiplier: 1
|
|
8793
|
-
}), jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
8794
|
-
title: t("manage-funding:addFunds.error.title"),
|
|
8795
|
-
type: giger.NotificationType.ERROR
|
|
8796
|
-
}, {
|
|
8797
|
-
children: addFunds.error[0].message
|
|
8798
|
-
}))]
|
|
8799
|
-
}), children === null || children === void 0 ? void 0 : children({
|
|
8850
|
+
})), children === null || children === void 0 ? void 0 : children({
|
|
8851
|
+
error: addFunds.error,
|
|
8800
8852
|
isCustomAmount: selectedChip.value === "custom",
|
|
8801
8853
|
isSubmitted,
|
|
8802
8854
|
isSubmitting,
|
|
@@ -9033,7 +9085,7 @@ const InlineLabel = ({
|
|
|
9033
9085
|
|
|
9034
9086
|
const styles$l = createStyles({
|
|
9035
9087
|
getBalanceText: balance => theme => ({
|
|
9036
|
-
color: balance === undefined ? theme.palette.
|
|
9088
|
+
color: balance === undefined ? theme.palette.gray.main : balance >= 0 ? theme.palette.secondary.dark : theme.palette.error.main
|
|
9037
9089
|
})
|
|
9038
9090
|
});
|
|
9039
9091
|
|
|
@@ -9058,7 +9110,7 @@ const CarrierBalance = ({
|
|
|
9058
9110
|
bold: true,
|
|
9059
9111
|
css: styles$l.getBalanceText(carrierBalance)
|
|
9060
9112
|
}, {
|
|
9061
|
-
children: carrierBalance === undefined ?
|
|
9113
|
+
children: carrierBalance === undefined ? "----" : formatMoney({
|
|
9062
9114
|
amount: carrierBalance,
|
|
9063
9115
|
currency: alchemy.SE.Currency.USD
|
|
9064
9116
|
})
|
|
@@ -9138,6 +9190,12 @@ const AddressParser = ({
|
|
|
9138
9190
|
const payload = values;
|
|
9139
9191
|
onSubmit(payload);
|
|
9140
9192
|
}));
|
|
9193
|
+
form.watch((data, {
|
|
9194
|
+
name
|
|
9195
|
+
}) => {
|
|
9196
|
+
var _a;
|
|
9197
|
+
if (name === "fullAddress" && ((_a = data.fullAddress) === null || _a === void 0 ? void 0 : _a.length) == null) reset === null || reset === void 0 ? void 0 : reset();
|
|
9198
|
+
});
|
|
9141
9199
|
const errors = (parseErrors === null || parseErrors === void 0 ? void 0 : parseErrors.length) ? [t("errorMessages.parsingFailure")] : undefined;
|
|
9142
9200
|
const formInterface = jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
9143
9201
|
children: [jsxRuntime.jsx(TextArea, {
|
|
@@ -9342,19 +9400,6 @@ const AddressFields = ({
|
|
|
9342
9400
|
});
|
|
9343
9401
|
};
|
|
9344
9402
|
|
|
9345
|
-
/* eslint-disable @typescript-eslint/no-unused-vars -- Allow unused generics in ZodObject interface overload */
|
|
9346
|
-
function nullishDefault(defaultValue) {
|
|
9347
|
-
return this.nullish().transform(v => v !== null && v !== void 0 ? v : defaultValue);
|
|
9348
|
-
}
|
|
9349
|
-
/**
|
|
9350
|
-
* @category Form Validation
|
|
9351
|
-
*/
|
|
9352
|
-
const extendZod = () => {
|
|
9353
|
-
zod.z.ZodString.prototype.nullishDefault = nullishDefault;
|
|
9354
|
-
zod.z.ZodNumber.prototype.nullishDefault = nullishDefault;
|
|
9355
|
-
zod.z.ZodObject.prototype.nullishDefault = nullishDefault;
|
|
9356
|
-
};
|
|
9357
|
-
|
|
9358
9403
|
var call = functionCall;
|
|
9359
9404
|
var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
|
|
9360
9405
|
var anObject = anObject$f;
|
|
@@ -9403,8 +9448,20 @@ fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNa
|
|
|
9403
9448
|
];
|
|
9404
9449
|
});
|
|
9405
9450
|
|
|
9451
|
+
/* eslint-disable @typescript-eslint/no-unused-vars -- Allow unused generics in ZodObject interface overload */
|
|
9452
|
+
function nullishDefault(defaultValue) {
|
|
9453
|
+
return this.nullish().transform(v => v !== null && v !== void 0 ? v : defaultValue);
|
|
9454
|
+
}
|
|
9455
|
+
/**
|
|
9456
|
+
* @category Form Validation
|
|
9457
|
+
*/
|
|
9458
|
+
const extendZod = () => {
|
|
9459
|
+
zod.z.ZodString.prototype.nullishDefault = nullishDefault;
|
|
9460
|
+
zod.z.ZodNumber.prototype.nullishDefault = nullishDefault;
|
|
9461
|
+
zod.z.ZodObject.prototype.nullishDefault = nullishDefault;
|
|
9462
|
+
};
|
|
9463
|
+
|
|
9406
9464
|
extendZod();
|
|
9407
|
-
const refineName = n => n.match(/^[a-zA-Z']{2,} [a-zA-Z']{2,}/);
|
|
9408
9465
|
const addressLine1Schema = zod.z.string().trim().min(1);
|
|
9409
9466
|
const addressLine2Schema = zod.z.string().trim().nullishDefault(undefined);
|
|
9410
9467
|
const companyNameSchema = zod.z.string().trim().min(2).max(40).nullishDefault(undefined).or(zod.z.literal("")).transform(companyName => companyName || undefined);
|
|
@@ -9414,7 +9471,7 @@ const addressSchema = zod.z.object({
|
|
|
9414
9471
|
cityLocality: zod.z.string().trim().min(1),
|
|
9415
9472
|
companyName: companyNameSchema,
|
|
9416
9473
|
countryCode: zod.z.enum(countryCodes),
|
|
9417
|
-
name: zod.z.string().trim().min(1)
|
|
9474
|
+
name: zod.z.string().trim().min(1),
|
|
9418
9475
|
phone: zod.z.string().trim().nullishDefault(""),
|
|
9419
9476
|
postalCode: zod.z.string().trim(),
|
|
9420
9477
|
stateProvince: zod.z.string().trim().nullishDefault("")
|
|
@@ -9422,7 +9479,14 @@ const addressSchema = zod.z.object({
|
|
|
9422
9479
|
|
|
9423
9480
|
extendZod();
|
|
9424
9481
|
const postalCodeRegex$2 = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
|
|
9425
|
-
const
|
|
9482
|
+
const refineName = n => n.match(/^[a-zA-Z']/);
|
|
9483
|
+
const refineNameStrict = n => n.match(/^[a-zA-Z']{2,} [a-zA-Z']{2,}/);
|
|
9484
|
+
const shipToAddressSchema = addressSchema.refine(schema => {
|
|
9485
|
+
return refineName(schema.name);
|
|
9486
|
+
}, {
|
|
9487
|
+
message: "schemaErrors.invalidAddressName",
|
|
9488
|
+
path: ["name"]
|
|
9489
|
+
}).refine(schema => !schema.phone || min$3.isValidPhoneNumber(schema.phone, schema.countryCode), {
|
|
9426
9490
|
message: "schemaErrors.notAValidPhoneNumber",
|
|
9427
9491
|
path: ["phone"]
|
|
9428
9492
|
}).refine(schema => {
|
|
@@ -9442,11 +9506,18 @@ const addressFormSchema = addressSchema.refine(schema => !schema.phone || min$3.
|
|
|
9442
9506
|
message: "schemaErrors.invalidPostalCode",
|
|
9443
9507
|
path: ["postalCode"]
|
|
9444
9508
|
});
|
|
9509
|
+
const addressFormSchema = shipToAddressSchema.refine(schema => {
|
|
9510
|
+
return refineNameStrict(schema.name);
|
|
9511
|
+
}, {
|
|
9512
|
+
message: "schemaErrors.invalidAddressNameStrict",
|
|
9513
|
+
path: ["name"]
|
|
9514
|
+
});
|
|
9445
9515
|
|
|
9446
9516
|
const AddressForm = ({
|
|
9447
9517
|
address,
|
|
9448
9518
|
domestic,
|
|
9449
9519
|
formId,
|
|
9520
|
+
isShipToForm,
|
|
9450
9521
|
onCancel,
|
|
9451
9522
|
onCancelParse,
|
|
9452
9523
|
onSubmit,
|
|
@@ -9460,7 +9531,7 @@ const AddressForm = ({
|
|
|
9460
9531
|
} = reactI18next.useTranslation();
|
|
9461
9532
|
const form = reactHookForm.useForm({
|
|
9462
9533
|
defaultValues: Object.assign({}, address && address),
|
|
9463
|
-
resolver: validationResolver(addressFormSchema)
|
|
9534
|
+
resolver: validationResolver(isShipToForm ? shipToAddressSchema : addressFormSchema)
|
|
9464
9535
|
});
|
|
9465
9536
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
9466
9537
|
const payload = __rest(values, []);
|
|
@@ -9742,29 +9813,23 @@ const AddressPreferenceSelect = ({
|
|
|
9742
9813
|
case "ERROR":
|
|
9743
9814
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
9744
9815
|
children: [jsxRuntime.jsx(Spacer, {
|
|
9745
|
-
multiplier:
|
|
9816
|
+
multiplier: 2
|
|
9746
9817
|
}), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
9747
|
-
colSpan: 8
|
|
9748
|
-
css: theme => ({
|
|
9749
|
-
paddingLeft: theme.spacing(1)
|
|
9750
|
-
})
|
|
9818
|
+
colSpan: 8
|
|
9751
9819
|
}, {
|
|
9752
9820
|
children: jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
9821
|
+
title: t("address.preference.addressNotValidated"),
|
|
9753
9822
|
type: giger.NotificationType.ALERT
|
|
9754
9823
|
}, {
|
|
9755
9824
|
children: t("address.preference.unableToValidate")
|
|
9756
9825
|
}))
|
|
9757
9826
|
})), jsxRuntime.jsx(Spacer, {
|
|
9758
|
-
multiplier:
|
|
9759
|
-
}), jsxRuntime.jsx(giger.GridChild,
|
|
9760
|
-
css: theme => ({
|
|
9761
|
-
paddingLeft: theme.spacing(1)
|
|
9762
|
-
})
|
|
9763
|
-
}, {
|
|
9827
|
+
multiplier: 2
|
|
9828
|
+
}), jsxRuntime.jsx(giger.GridChild, {
|
|
9764
9829
|
children: jsxRuntime.jsx(AddressDisplay, {
|
|
9765
9830
|
address: (_b = warehousePreference.validation) === null || _b === void 0 ? void 0 : _b.originalAddress
|
|
9766
9831
|
})
|
|
9767
|
-
})
|
|
9832
|
+
})]
|
|
9768
9833
|
});
|
|
9769
9834
|
default:
|
|
9770
9835
|
// This code path should never be reached.
|
|
@@ -9787,7 +9852,7 @@ const AddressPreferenceSelect = ({
|
|
|
9787
9852
|
children: t("common:address.preference.title")
|
|
9788
9853
|
}))
|
|
9789
9854
|
})), jsxRuntime.jsxs(giger.GridChild, Object.assign({
|
|
9790
|
-
colSpan:
|
|
9855
|
+
colSpan: 12
|
|
9791
9856
|
}, {
|
|
9792
9857
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
9793
9858
|
css: {
|
|
@@ -10045,7 +10110,8 @@ const creditCardSchema = zod.z.object({
|
|
|
10045
10110
|
});
|
|
10046
10111
|
const walletSchema = zod.z.object({
|
|
10047
10112
|
address: billingAddressSchema,
|
|
10048
|
-
creditCard: creditCardSchema
|
|
10113
|
+
creditCard: creditCardSchema,
|
|
10114
|
+
iovationBlackbox: zod.z.string().trim().min(1)
|
|
10049
10115
|
});
|
|
10050
10116
|
|
|
10051
10117
|
const EditWalletAddressForm = ({
|
|
@@ -10131,6 +10197,7 @@ const WalletForm = ({
|
|
|
10131
10197
|
const {
|
|
10132
10198
|
validateAddress
|
|
10133
10199
|
} = useAddressPreference();
|
|
10200
|
+
const [codedErrors, setCodedErrors] = React.useState(errors);
|
|
10134
10201
|
const form = reactHookForm.useForm({
|
|
10135
10202
|
defaultValues:
|
|
10136
10203
|
// If the warehouse address is a PO Box they cannot use it as their billing address
|
|
@@ -10145,6 +10212,20 @@ const WalletForm = ({
|
|
|
10145
10212
|
},
|
|
10146
10213
|
resolver: validationResolver(walletSchema)
|
|
10147
10214
|
});
|
|
10215
|
+
useBlackboxDetection({
|
|
10216
|
+
onError: () => {
|
|
10217
|
+
setCodedErrors(errors => {
|
|
10218
|
+
const blackBoxError = {
|
|
10219
|
+
errorCode: "unspecified",
|
|
10220
|
+
errorSource: "client",
|
|
10221
|
+
errorType: "unknown",
|
|
10222
|
+
message: t("register-wallet:sections.notifications.blackBox.description")
|
|
10223
|
+
};
|
|
10224
|
+
return [...(errors !== null && errors !== void 0 ? errors : []), blackBoxError];
|
|
10225
|
+
});
|
|
10226
|
+
},
|
|
10227
|
+
onSuccess: bb => form.setValue("iovationBlackbox", bb)
|
|
10228
|
+
});
|
|
10148
10229
|
const watchAddress = form.watch("address");
|
|
10149
10230
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
10150
10231
|
const payload = __rest(values, []);
|
|
@@ -10158,7 +10239,8 @@ const WalletForm = ({
|
|
|
10158
10239
|
onValid: validatedAddressesPayload => __awaiter(void 0, void 0, void 0, function* () {
|
|
10159
10240
|
yield onSubmit({
|
|
10160
10241
|
address: validatedAddressesPayload.originAddress,
|
|
10161
|
-
creditCard: payload.creditCard
|
|
10242
|
+
creditCard: payload.creditCard,
|
|
10243
|
+
iovationBlackbox: payload.iovationBlackbox
|
|
10162
10244
|
});
|
|
10163
10245
|
})
|
|
10164
10246
|
});
|
|
@@ -10181,11 +10263,11 @@ const WalletForm = ({
|
|
|
10181
10263
|
children: [jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
10182
10264
|
colSpan: 12
|
|
10183
10265
|
}, {
|
|
10184
|
-
children: (
|
|
10266
|
+
children: !!(codedErrors === null || codedErrors === void 0 ? void 0 : codedErrors.length) && jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
10185
10267
|
title: t("register-wallet:sections.notifications.error.title"),
|
|
10186
10268
|
type: giger.NotificationType.ERROR
|
|
10187
10269
|
}, {
|
|
10188
|
-
children:
|
|
10270
|
+
children: codedErrors.map(({
|
|
10189
10271
|
message
|
|
10190
10272
|
}) => message).join(" ")
|
|
10191
10273
|
}))
|
|
@@ -10832,7 +10914,8 @@ const styles$e = createStyles({
|
|
|
10832
10914
|
display: "flex",
|
|
10833
10915
|
flexDirection: "column",
|
|
10834
10916
|
paddingBottom: theme.spacing(8),
|
|
10835
|
-
paddingTop: theme.spacing(2)
|
|
10917
|
+
paddingTop: theme.spacing(2),
|
|
10918
|
+
textAlign: "center"
|
|
10836
10919
|
}),
|
|
10837
10920
|
termsLink: theme => ({
|
|
10838
10921
|
alignItems: "center",
|
|
@@ -11179,10 +11262,10 @@ const AddressPreferenceDisplay = ({
|
|
|
11179
11262
|
children: [jsxRuntime.jsx(giger.Button, Object.assign({
|
|
11180
11263
|
bold: false,
|
|
11181
11264
|
isFullWidth: true,
|
|
11182
|
-
onClick: () => {
|
|
11183
|
-
handleChangePreference();
|
|
11265
|
+
onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
11266
|
+
yield handleChangePreference();
|
|
11184
11267
|
toggleDisclosure();
|
|
11185
|
-
},
|
|
11268
|
+
}),
|
|
11186
11269
|
type: "button",
|
|
11187
11270
|
variant: giger.ButtonVariant.OUTLINED
|
|
11188
11271
|
}, {
|
|
@@ -11227,7 +11310,8 @@ const baseSchema = addressSchema.extend({
|
|
|
11227
11310
|
path: ["postalCode"]
|
|
11228
11311
|
});
|
|
11229
11312
|
const getCarrierRecoverySchema = requiresAddress => zod.z.object({
|
|
11230
|
-
address: requiresAddress ? baseSchema : baseSchema.optional()
|
|
11313
|
+
address: requiresAddress ? baseSchema : baseSchema.optional(),
|
|
11314
|
+
iovationBlackbox: zod.z.string().trim().min(1)
|
|
11231
11315
|
});
|
|
11232
11316
|
|
|
11233
11317
|
const styles$c = createStyles({
|
|
@@ -11254,6 +11338,7 @@ const CarrierRecoveryForm = ({
|
|
|
11254
11338
|
const {
|
|
11255
11339
|
t
|
|
11256
11340
|
} = reactI18next.useTranslation();
|
|
11341
|
+
const [codedErrors, setCodedErrors] = React.useState(errors);
|
|
11257
11342
|
const metadata = useCarrierMetadata();
|
|
11258
11343
|
const carrier = metadata.find(m => m.carrierCode === carrierCode);
|
|
11259
11344
|
const carrierFriendlyName = (_a = carrier === null || carrier === void 0 ? void 0 : carrier.shortname) !== null && _a !== void 0 ? _a : "your carrier";
|
|
@@ -11266,6 +11351,22 @@ const CarrierRecoveryForm = ({
|
|
|
11266
11351
|
}),
|
|
11267
11352
|
resolver: validationResolver(getCarrierRecoverySchema(requiresAddress))
|
|
11268
11353
|
});
|
|
11354
|
+
useBlackboxDetection({
|
|
11355
|
+
onError: () => {
|
|
11356
|
+
setCodedErrors(errors => {
|
|
11357
|
+
const blackBoxError = {
|
|
11358
|
+
errorCode: "unspecified",
|
|
11359
|
+
errorSource: "client",
|
|
11360
|
+
errorType: "unknown",
|
|
11361
|
+
message: t("register-wallet:sections.notifications.blackBox.description")
|
|
11362
|
+
};
|
|
11363
|
+
return [...(errors !== null && errors !== void 0 ? errors : []), blackBoxError];
|
|
11364
|
+
});
|
|
11365
|
+
},
|
|
11366
|
+
onSuccess: bb => {
|
|
11367
|
+
form.setValue("iovationBlackbox", bb);
|
|
11368
|
+
}
|
|
11369
|
+
});
|
|
11269
11370
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
11270
11371
|
yield onSubmit(fundingSourceId, values);
|
|
11271
11372
|
}));
|
|
@@ -11297,7 +11398,7 @@ const CarrierRecoveryForm = ({
|
|
|
11297
11398
|
children: t("register-wallet:sections.carriers.subtitle")
|
|
11298
11399
|
}))
|
|
11299
11400
|
}))]
|
|
11300
|
-
}), !!(
|
|
11401
|
+
}), !!(codedErrors === null || codedErrors === void 0 ? void 0 : codedErrors.length) && jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
11301
11402
|
colSpan: 12
|
|
11302
11403
|
}, {
|
|
11303
11404
|
children: jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
@@ -11306,7 +11407,7 @@ const CarrierRecoveryForm = ({
|
|
|
11306
11407
|
}),
|
|
11307
11408
|
type: giger.NotificationType.ERROR
|
|
11308
11409
|
}, {
|
|
11309
|
-
children:
|
|
11410
|
+
children: codedErrors.map(({
|
|
11310
11411
|
message
|
|
11311
11412
|
}) => message).join(" ")
|
|
11312
11413
|
}))
|
|
@@ -11852,7 +11953,6 @@ const LandingPageForm = ({
|
|
|
11852
11953
|
alwaysRequireValidity: true,
|
|
11853
11954
|
control: form.control,
|
|
11854
11955
|
"data-testid": "onboarding:landing.action",
|
|
11855
|
-
form: "landing-page-form",
|
|
11856
11956
|
variant: giger.ButtonVariant.FILLED
|
|
11857
11957
|
}, {
|
|
11858
11958
|
children: t("onboarding:landing.action")
|
|
@@ -11877,7 +11977,8 @@ const styles$a = createStyles({
|
|
|
11877
11977
|
});
|
|
11878
11978
|
|
|
11879
11979
|
const LandingPage = ({
|
|
11880
|
-
onSubmit
|
|
11980
|
+
onSubmit,
|
|
11981
|
+
partnerName
|
|
11881
11982
|
}) => {
|
|
11882
11983
|
const {
|
|
11883
11984
|
t
|
|
@@ -11919,7 +12020,9 @@ const LandingPage = ({
|
|
|
11919
12020
|
css: styles$a.description,
|
|
11920
12021
|
variant: "body1"
|
|
11921
12022
|
}, {
|
|
11922
|
-
children: t("onboarding:landing.
|
|
12023
|
+
children: partnerName ? t("onboarding:landing.partnerMessageLine1", {
|
|
12024
|
+
partnerName: partnerName
|
|
12025
|
+
}) : t("onboarding:landing.messageLine1")
|
|
11923
12026
|
})), jsxRuntime.jsx(Spacer, {
|
|
11924
12027
|
multiplier: 2
|
|
11925
12028
|
}), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
@@ -12373,7 +12476,7 @@ const WarehouseForm = ({
|
|
|
12373
12476
|
control: form.control,
|
|
12374
12477
|
"data-testid": "warehouseFormSubmitButton",
|
|
12375
12478
|
form: "warehouse-form",
|
|
12376
|
-
requireDirty:
|
|
12479
|
+
requireDirty: !warehouse,
|
|
12377
12480
|
variant: _isOnboarding ? giger.ButtonVariant.FILLED : giger.ButtonVariant.OUTLINED
|
|
12378
12481
|
}, {
|
|
12379
12482
|
children: submitButtonTitle
|
|
@@ -12590,11 +12693,21 @@ const styles$6 = createStyles({
|
|
|
12590
12693
|
container: theme => ({
|
|
12591
12694
|
padding: theme.spacing(2)
|
|
12592
12695
|
}),
|
|
12696
|
+
iconTooltip: theme => ({
|
|
12697
|
+
color: theme.palette.secondary.main,
|
|
12698
|
+
display: "inline-block",
|
|
12699
|
+
marginLeft: theme.spacing(1),
|
|
12700
|
+
verticalAlign: "middle"
|
|
12701
|
+
}),
|
|
12593
12702
|
step: {
|
|
12594
12703
|
"& > span:last-child": {
|
|
12595
12704
|
position: "static"
|
|
12596
12705
|
}
|
|
12597
12706
|
},
|
|
12707
|
+
tooltipContainer: () => ({
|
|
12708
|
+
maxWidth: "260px",
|
|
12709
|
+
textAlign: "left"
|
|
12710
|
+
}),
|
|
12598
12711
|
walletFormHeader: theme => ({
|
|
12599
12712
|
margin: theme.spacing(4)
|
|
12600
12713
|
}),
|
|
@@ -12610,17 +12723,20 @@ const styles$6 = createStyles({
|
|
|
12610
12723
|
|
|
12611
12724
|
const Onboarding = ({
|
|
12612
12725
|
connectedCarriers,
|
|
12726
|
+
createFundingSource,
|
|
12727
|
+
createFundingSourceErrors,
|
|
12613
12728
|
createWarehouse,
|
|
12614
12729
|
features,
|
|
12615
12730
|
fundingSources,
|
|
12731
|
+
isRegisteringCarriers,
|
|
12732
|
+
onboardingAddress,
|
|
12616
12733
|
onCarrierCreated,
|
|
12617
12734
|
onCompleteOnboarding,
|
|
12618
12735
|
onFundingSourceCreated,
|
|
12619
12736
|
onWarehouseCreated,
|
|
12737
|
+
partnerName,
|
|
12620
12738
|
registerCarrier,
|
|
12621
12739
|
registerCarrierErrors,
|
|
12622
|
-
createFundingSource,
|
|
12623
|
-
createFundingSourceErrors,
|
|
12624
12740
|
warehouses
|
|
12625
12741
|
}) => {
|
|
12626
12742
|
var _a, _b, _c;
|
|
@@ -12654,6 +12770,7 @@ const Onboarding = ({
|
|
|
12654
12770
|
const hasDhl = connectedCarriers === null || connectedCarriers === void 0 ? void 0 : connectedCarriers.some(c => c.carrierCode === "dhl_express_worldwide");
|
|
12655
12771
|
const fundingSourceId = (fundingSources === null || fundingSources === void 0 ? void 0 : fundingSources.length) ? fundingSources[0].fundingSourceId : undefined;
|
|
12656
12772
|
const hasCompletedOnboarding = onboardingComplete || warehouses.length && hasStampsWallet && (hasUps || !upsEnabled) && hasDhl;
|
|
12773
|
+
const containerRef = React.useRef(null);
|
|
12657
12774
|
const currentStep = React.useMemo(() => {
|
|
12658
12775
|
if (hasCompletedOnboarding) {
|
|
12659
12776
|
return 5;
|
|
@@ -12679,8 +12796,9 @@ const Onboarding = ({
|
|
|
12679
12796
|
return [];
|
|
12680
12797
|
};
|
|
12681
12798
|
const handleWalletRegistrationSuccess = (fundingSourceId, {
|
|
12682
|
-
address
|
|
12683
|
-
|
|
12799
|
+
address,
|
|
12800
|
+
iovationBlackbox
|
|
12801
|
+
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
12684
12802
|
const addressToRegister = address !== null && address !== void 0 ? address : defaultWarehouse.originAddress;
|
|
12685
12803
|
const pickupAddress = Object.assign(Object.assign({}, addressToRegister), {
|
|
12686
12804
|
company: addressToRegister.companyName || "",
|
|
@@ -12697,6 +12815,7 @@ const Onboarding = ({
|
|
|
12697
12815
|
agreeToTerms: true,
|
|
12698
12816
|
carrierCode: "ups_walleted",
|
|
12699
12817
|
fundingSourceId: fundingSourceId,
|
|
12818
|
+
iovationBlackBox: iovationBlackbox,
|
|
12700
12819
|
pickupAddress: pickupAddress
|
|
12701
12820
|
});
|
|
12702
12821
|
}
|
|
@@ -12705,7 +12824,8 @@ const Onboarding = ({
|
|
|
12705
12824
|
acceptedTerms: getTerms("dhl_express_walleted"),
|
|
12706
12825
|
agreeToTerms: true,
|
|
12707
12826
|
carrierCode: "dhl_express_worldwide",
|
|
12708
|
-
fundingSourceId: fundingSourceId
|
|
12827
|
+
fundingSourceId: fundingSourceId,
|
|
12828
|
+
iovationBlackBox: iovationBlackbox
|
|
12709
12829
|
});
|
|
12710
12830
|
}
|
|
12711
12831
|
return {
|
|
@@ -12726,7 +12846,8 @@ const Onboarding = ({
|
|
|
12726
12846
|
});
|
|
12727
12847
|
const handleWalletRegistration = ({
|
|
12728
12848
|
address,
|
|
12729
|
-
creditCard
|
|
12849
|
+
creditCard,
|
|
12850
|
+
iovationBlackbox
|
|
12730
12851
|
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
12731
12852
|
setHasCompletedBilling(true);
|
|
12732
12853
|
const billingInfo = Object.assign(Object.assign({}, address), {
|
|
@@ -12739,11 +12860,14 @@ const Onboarding = ({
|
|
|
12739
12860
|
acceptedTerms: getTerms("stamps_com"),
|
|
12740
12861
|
agreeToTerms: agreedToTerms,
|
|
12741
12862
|
billingInfo: billingInfo,
|
|
12863
|
+
iovationBlackBox: iovationBlackbox,
|
|
12742
12864
|
paymentMethod: {
|
|
12743
12865
|
creditCardInfo: Object.assign({}, creditCard)
|
|
12744
12866
|
}
|
|
12745
12867
|
});
|
|
12746
|
-
yield handleWalletRegistrationSuccess(fundingSource.fundingSource.fundingSourceId
|
|
12868
|
+
yield handleWalletRegistrationSuccess(fundingSource.fundingSource.fundingSourceId, {
|
|
12869
|
+
iovationBlackbox
|
|
12870
|
+
});
|
|
12747
12871
|
} catch (_e) {
|
|
12748
12872
|
setHasCompletedBilling(false);
|
|
12749
12873
|
}
|
|
@@ -12759,7 +12883,8 @@ const Onboarding = ({
|
|
|
12759
12883
|
}
|
|
12760
12884
|
// Step 1: Landing Page
|
|
12761
12885
|
if (!email) return jsxRuntime.jsx(LandingPage, {
|
|
12762
|
-
onSubmit: e => setEmail(e)
|
|
12886
|
+
onSubmit: e => setEmail(e),
|
|
12887
|
+
partnerName: partnerName
|
|
12763
12888
|
});
|
|
12764
12889
|
// Step 2: Agree to Terms and Conditions
|
|
12765
12890
|
if (!agreedToTerms) {
|
|
@@ -12808,7 +12933,8 @@ const Onboarding = ({
|
|
|
12808
12933
|
onSubmit: payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
12809
12934
|
return handleCreateWarehouse(payload);
|
|
12810
12935
|
}),
|
|
12811
|
-
submitButtonTitle: t("actions.continue")
|
|
12936
|
+
submitButtonTitle: t("actions.continue"),
|
|
12937
|
+
warehouse: onboardingAddress
|
|
12812
12938
|
})
|
|
12813
12939
|
}));
|
|
12814
12940
|
}
|
|
@@ -12831,21 +12957,39 @@ const Onboarding = ({
|
|
|
12831
12957
|
variant: "subtitle1"
|
|
12832
12958
|
}, {
|
|
12833
12959
|
children: t("register-wallet:sections.billing.cardSubTitle")
|
|
12960
|
+
})), jsxRuntime.jsx(giger.IconTooltip, Object.assign({
|
|
12961
|
+
container: containerRef.current,
|
|
12962
|
+
css: styles$6.iconTooltip,
|
|
12963
|
+
icon: gigerTheme.IconNames.INFO_FILLED,
|
|
12964
|
+
placement: "auto",
|
|
12965
|
+
size: giger.IconSize.SIZE_MEDIUM
|
|
12966
|
+
}, {
|
|
12967
|
+
children: jsxRuntime.jsxs("div", Object.assign({
|
|
12968
|
+
css: styles$6.tooltipContainer
|
|
12969
|
+
}, {
|
|
12970
|
+
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
12971
|
+
bold: true,
|
|
12972
|
+
variant: "small"
|
|
12973
|
+
}, {
|
|
12974
|
+
children: t("register-wallet:sections.notifications.info.title")
|
|
12975
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
12976
|
+
multiplier: 1
|
|
12977
|
+
}), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
12978
|
+
variant: "small"
|
|
12979
|
+
}, {
|
|
12980
|
+
children: t("register-wallet:sections.notifications.info.description")
|
|
12981
|
+
}))]
|
|
12982
|
+
}))
|
|
12834
12983
|
}))]
|
|
12835
12984
|
})), jsxRuntime.jsx(Spacer, {
|
|
12836
12985
|
multiplier: 1
|
|
12837
|
-
}), (createFundingSourceErrors === null || createFundingSourceErrors === void 0 ? void 0 : createFundingSourceErrors.length)
|
|
12986
|
+
}), !!(createFundingSourceErrors === null || createFundingSourceErrors === void 0 ? void 0 : createFundingSourceErrors.length) && jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
12838
12987
|
title: t("register-wallet:sections.notifications.error.title"),
|
|
12839
12988
|
type: giger.NotificationType.ERROR
|
|
12840
12989
|
}, {
|
|
12841
12990
|
children: createFundingSourceErrors.map(({
|
|
12842
12991
|
message
|
|
12843
12992
|
}) => message).join(" ")
|
|
12844
|
-
})) : jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
12845
|
-
title: t("register-wallet:sections.notifications.info.title"),
|
|
12846
|
-
type: giger.NotificationType.INFO
|
|
12847
|
-
}, {
|
|
12848
|
-
children: t("register-wallet:sections.notifications.info.description")
|
|
12849
12993
|
}))]
|
|
12850
12994
|
})),
|
|
12851
12995
|
onSubmit: payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -12893,19 +13037,25 @@ const Onboarding = ({
|
|
|
12893
13037
|
});
|
|
12894
13038
|
}
|
|
12895
13039
|
}
|
|
13040
|
+
if (isRegisteringCarriers || currentStep === 4) {
|
|
13041
|
+
return jsxRuntime.jsx(Loader, {
|
|
13042
|
+
message: t("loading.connectingCarriers")
|
|
13043
|
+
});
|
|
13044
|
+
}
|
|
12896
13045
|
return jsxRuntime.jsx(Loader, {
|
|
12897
13046
|
message: t("loading.onboarding")
|
|
12898
13047
|
});
|
|
12899
13048
|
};
|
|
12900
13049
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
12901
|
-
css: styles$6.container
|
|
13050
|
+
css: styles$6.container,
|
|
13051
|
+
ref: containerRef
|
|
12902
13052
|
}, {
|
|
12903
13053
|
children: [jsxRuntime.jsxs(giger.Stepper, Object.assign({
|
|
12904
13054
|
currentStep: currentStep
|
|
12905
13055
|
}, {
|
|
12906
13056
|
children: [jsxRuntime.jsx(giger.Step, {
|
|
12907
13057
|
css: styles$6.step,
|
|
12908
|
-
label: t("onboarding:steps.
|
|
13058
|
+
label: t("onboarding:steps.register")
|
|
12909
13059
|
}), jsxRuntime.jsx(giger.Step, {
|
|
12910
13060
|
css: styles$6.step,
|
|
12911
13061
|
label: t("onboarding:steps.carriers")
|
|
@@ -12914,7 +13064,7 @@ const Onboarding = ({
|
|
|
12914
13064
|
label: t("onboarding:steps.addresses")
|
|
12915
13065
|
}), jsxRuntime.jsx(giger.Step, {
|
|
12916
13066
|
css: styles$6.step,
|
|
12917
|
-
label: t("onboarding:steps.
|
|
13067
|
+
label: t("onboarding:steps.billing")
|
|
12918
13068
|
})]
|
|
12919
13069
|
})), renderStep(), ((_c = features === null || features === void 0 ? void 0 : features.presentation) === null || _c === void 0 ? void 0 : _c.poweredByShipEngine) && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
12920
13070
|
children: [jsxRuntime.jsx(Spacer, {}), jsxRuntime.jsx(PoweredByShipEngine, {})]
|
|
@@ -12988,29 +13138,6 @@ const Cube = _a => {
|
|
|
12988
13138
|
};
|
|
12989
13139
|
|
|
12990
13140
|
const styles$5 = createStyles({
|
|
12991
|
-
balanceText: theme => ({
|
|
12992
|
-
color: theme.palette.secondary.dark
|
|
12993
|
-
}),
|
|
12994
|
-
container: theme => ({
|
|
12995
|
-
padding: `${theme.spacing(3)}px ${theme.spacing(4)}px`
|
|
12996
|
-
}),
|
|
12997
|
-
getFormExtension: isCustomAmount => theme => ({
|
|
12998
|
-
backgroundColor: theme.palette.gray.ultraLight,
|
|
12999
|
-
display: "flex",
|
|
13000
|
-
flexDirection: "column",
|
|
13001
|
-
gap: theme.spacing(1),
|
|
13002
|
-
// Negative margin is to compensate for the padding on AddFundsForm, since we want this
|
|
13003
|
-
// section to seemlessly extend the form's well.
|
|
13004
|
-
marginTop: theme.spacing(isCustomAmount ? -1.5 : -1),
|
|
13005
|
-
padding: theme.spacing(2),
|
|
13006
|
-
paddingTop: 0
|
|
13007
|
-
}),
|
|
13008
|
-
saveRateButton: {
|
|
13009
|
-
whiteSpace: "nowrap"
|
|
13010
|
-
}
|
|
13011
|
-
});
|
|
13012
|
-
|
|
13013
|
-
const styles$4 = createStyles({
|
|
13014
13141
|
icon: theme => ({
|
|
13015
13142
|
color: theme.palette.primary.main,
|
|
13016
13143
|
marginRight: theme.spacing(2)
|
|
@@ -13055,10 +13182,10 @@ const Section = _a => {
|
|
|
13055
13182
|
rest = __rest(_a, ["bold", "title", "children", "rightContent"]);
|
|
13056
13183
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
13057
13184
|
children: [title && jsxRuntime.jsx("summary", Object.assign({
|
|
13058
|
-
css: styles$
|
|
13185
|
+
css: styles$5.summary
|
|
13059
13186
|
}, {
|
|
13060
13187
|
children: jsxRuntime.jsxs("div", Object.assign({
|
|
13061
|
-
css: styles$
|
|
13188
|
+
css: styles$5.summaryWrapper
|
|
13062
13189
|
}, {
|
|
13063
13190
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
13064
13191
|
bold: bold,
|
|
@@ -13066,19 +13193,42 @@ const Section = _a => {
|
|
|
13066
13193
|
}, {
|
|
13067
13194
|
children: title
|
|
13068
13195
|
})), rightContent && jsxRuntime.jsx("div", Object.assign({
|
|
13069
|
-
css: styles$
|
|
13196
|
+
css: styles$5.rightContentWrapper
|
|
13070
13197
|
}, {
|
|
13071
13198
|
children: rightContent
|
|
13072
13199
|
}))]
|
|
13073
13200
|
}))
|
|
13074
13201
|
})), jsxRuntime.jsx("section", Object.assign({
|
|
13075
|
-
css: styles$
|
|
13202
|
+
css: styles$5.section
|
|
13076
13203
|
}, rest, {
|
|
13077
13204
|
children: children
|
|
13078
13205
|
}))]
|
|
13079
13206
|
});
|
|
13080
13207
|
};
|
|
13081
13208
|
|
|
13209
|
+
const styles$4 = createStyles({
|
|
13210
|
+
balanceText: theme => ({
|
|
13211
|
+
color: theme.palette.secondary.dark
|
|
13212
|
+
}),
|
|
13213
|
+
container: theme => ({
|
|
13214
|
+
padding: `${theme.spacing(3)}px ${theme.spacing(4)}px`
|
|
13215
|
+
}),
|
|
13216
|
+
getFormExtension: isCustomAmount => theme => ({
|
|
13217
|
+
backgroundColor: theme.palette.gray.ultraLight,
|
|
13218
|
+
display: "flex",
|
|
13219
|
+
flexDirection: "column",
|
|
13220
|
+
gap: theme.spacing(1),
|
|
13221
|
+
// Negative margin is to compensate for the padding on AddFundsForm, since we want this
|
|
13222
|
+
// section to seemlessly extend the form's well.
|
|
13223
|
+
marginTop: theme.spacing(isCustomAmount ? -1.5 : -1),
|
|
13224
|
+
padding: theme.spacing(2),
|
|
13225
|
+
paddingTop: 0
|
|
13226
|
+
}),
|
|
13227
|
+
saveRateButton: {
|
|
13228
|
+
whiteSpace: "nowrap"
|
|
13229
|
+
}
|
|
13230
|
+
});
|
|
13231
|
+
|
|
13082
13232
|
/**
|
|
13083
13233
|
* Fund and Purchase handles the label purchase submission UX, ensuring that a user
|
|
13084
13234
|
* has the necessary funds available and can add them if not. It allows a single button
|
|
@@ -13144,7 +13294,7 @@ const FundAndPurchase = ({
|
|
|
13144
13294
|
}, {
|
|
13145
13295
|
children: [jsxRuntime.jsx(giger.Button, Object.assign({
|
|
13146
13296
|
bold: false,
|
|
13147
|
-
css: styles$
|
|
13297
|
+
css: styles$4.saveRateButton,
|
|
13148
13298
|
disabled: disabled || !carrierId || addFundsForm.isSubmitting || isRateFormSubmitting,
|
|
13149
13299
|
isLoading: isSavingRate,
|
|
13150
13300
|
onClick: handleSaveRate,
|
|
@@ -13164,7 +13314,7 @@ const FundAndPurchase = ({
|
|
|
13164
13314
|
// render when no rate has been selected yet
|
|
13165
13315
|
if (!carrierId) return jsxRuntime.jsxs("div", Object.assign({
|
|
13166
13316
|
className: className,
|
|
13167
|
-
css: styles$
|
|
13317
|
+
css: styles$4.container
|
|
13168
13318
|
}, {
|
|
13169
13319
|
children: [jsxRuntime.jsxs(Spread, {
|
|
13170
13320
|
children: [jsxRuntime.jsx(CarrierBalance, {
|
|
@@ -13188,7 +13338,7 @@ const FundAndPurchase = ({
|
|
|
13188
13338
|
// show balance, but not the funding form.
|
|
13189
13339
|
if (!isFundingEnabled) return jsxRuntime.jsxs("div", Object.assign({
|
|
13190
13340
|
className: className,
|
|
13191
|
-
css: styles$
|
|
13341
|
+
css: styles$4.container
|
|
13192
13342
|
}, {
|
|
13193
13343
|
children: [jsxRuntime.jsx(CarrierBalance, {
|
|
13194
13344
|
carrierId: carrierId
|
|
@@ -13230,13 +13380,13 @@ const FundAndPurchase = ({
|
|
|
13230
13380
|
var _a, _b;
|
|
13231
13381
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
13232
13382
|
children: [jsxRuntime.jsxs("section", Object.assign({
|
|
13233
|
-
css: styles$
|
|
13383
|
+
css: styles$4.getFormExtension(addFundsForm.isCustomAmount)
|
|
13234
13384
|
}, {
|
|
13235
13385
|
children: [jsxRuntime.jsx(InlineLabel, Object.assign({
|
|
13236
13386
|
label: t("manage-funding:fundAndPurchase.newBalance")
|
|
13237
13387
|
}, {
|
|
13238
13388
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
13239
|
-
css: styles$
|
|
13389
|
+
css: styles$4.balanceText
|
|
13240
13390
|
}, {
|
|
13241
13391
|
children: formatMoney({
|
|
13242
13392
|
amount: balance + ((_a = addFundsForm.selectedAmount) !== null && _a !== void 0 ? _a : 0),
|
|
@@ -13247,7 +13397,7 @@ const FundAndPurchase = ({
|
|
|
13247
13397
|
label: t("manage-funding:fundAndPurchase.finalBalance")
|
|
13248
13398
|
}, {
|
|
13249
13399
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
13250
|
-
css: styles$
|
|
13400
|
+
css: styles$4.balanceText
|
|
13251
13401
|
}, {
|
|
13252
13402
|
children: formatMoney({
|
|
13253
13403
|
amount: balance + ((_b = addFundsForm.selectedAmount) !== null && _b !== void 0 ? _b : 0) - purchaseAmount,
|
|
@@ -13267,6 +13417,15 @@ const FundAndPurchase = ({
|
|
|
13267
13417
|
}))]
|
|
13268
13418
|
})), jsxRuntime.jsx(Spacer, {
|
|
13269
13419
|
multiplier: 2
|
|
13420
|
+
}), addFundsForm.error && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
13421
|
+
children: [jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
13422
|
+
title: t("manage-funding:addFunds.error.title"),
|
|
13423
|
+
type: giger.NotificationType.ERROR
|
|
13424
|
+
}, {
|
|
13425
|
+
children: addFundsForm.error[0].message
|
|
13426
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
13427
|
+
multiplier: 2
|
|
13428
|
+
})]
|
|
13270
13429
|
}), renderActionButtons(addFundsForm)]
|
|
13271
13430
|
});
|
|
13272
13431
|
}
|
|
@@ -14327,6 +14486,7 @@ const ShipmentForm = ({
|
|
|
14327
14486
|
const [editShipToForm, isEditShipFormToOpen, toggleIsEditShipFormToOpen] = useNestedForm(AddressForm, {
|
|
14328
14487
|
address: (_b = (_a = addressPreference === null || addressPreference === void 0 ? void 0 : addressPreference.selection) !== null && _a !== void 0 ? _a : shipment === null || shipment === void 0 ? void 0 : shipment.shipTo) !== null && _b !== void 0 ? _b : salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.shipTo,
|
|
14329
14488
|
formId: "edit-ship-to-form",
|
|
14489
|
+
isShipToForm: true,
|
|
14330
14490
|
onSubmit: handleSubmitEditShipTo,
|
|
14331
14491
|
onSubmitParse: onSubmitParseShipTo,
|
|
14332
14492
|
parseAddressErrors,
|
|
@@ -14554,6 +14714,7 @@ const ShipmentForm = ({
|
|
|
14554
14714
|
})), jsxRuntime.jsx(giger.DropdownOptionList, Object.assign({
|
|
14555
14715
|
"data-id": "dropdown",
|
|
14556
14716
|
dropdownWidth: "400px",
|
|
14717
|
+
hideWhenReferenceNotVisible: true,
|
|
14557
14718
|
isOpen: showApplyPreset,
|
|
14558
14719
|
onChange: () => setShowApplyPreset(false),
|
|
14559
14720
|
onClickAway: e => {
|
|
@@ -15061,6 +15222,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
15061
15222
|
addCarrierSchema: addCarrierSchema,
|
|
15062
15223
|
AddressDisplay: AddressDisplay,
|
|
15063
15224
|
AddressForm: AddressForm,
|
|
15225
|
+
shipToAddressSchema: shipToAddressSchema,
|
|
15064
15226
|
addressFormSchema: addressFormSchema,
|
|
15065
15227
|
AddressFields: AddressFields,
|
|
15066
15228
|
addressLine1Schema: addressLine1Schema,
|
|
@@ -15124,7 +15286,7 @@ const DateRangeSelect = ({
|
|
|
15124
15286
|
"data-testid": "date-range-select",
|
|
15125
15287
|
label: t("wallet-history:dateRange"),
|
|
15126
15288
|
leftContent: jsxRuntime.jsx(giger.Icon, {
|
|
15127
|
-
name:
|
|
15289
|
+
name: gigerTheme.IconNames.FILTER
|
|
15128
15290
|
}),
|
|
15129
15291
|
name: "date-range-select",
|
|
15130
15292
|
onChange: handleChange,
|
|
@@ -15439,6 +15601,7 @@ var common = {
|
|
|
15439
15601
|
accountSettings: "Loading account settings...",
|
|
15440
15602
|
carrier: "Loading carrier...",
|
|
15441
15603
|
carriers: "Loading carriers...",
|
|
15604
|
+
connectingCarriers: "Connecting carriers...",
|
|
15442
15605
|
data: "Loading...",
|
|
15443
15606
|
importingSalesOrder: "Importing order...",
|
|
15444
15607
|
label: "Loading label...",
|
|
@@ -15478,7 +15641,8 @@ var common = {
|
|
|
15478
15641
|
group: {
|
|
15479
15642
|
allMeasurementsOrNone: "All measurements must be provided when entering {{fieldLabel}}"
|
|
15480
15643
|
},
|
|
15481
|
-
invalidAddressName: "
|
|
15644
|
+
invalidAddressName: "Invalid recipient name.",
|
|
15645
|
+
invalidAddressNameStrict: "Recipient Name must have two characters in First and Last Name.",
|
|
15482
15646
|
invalidAddressPoBox: "A physical address is required for wallet registration. You can add a PO Box as a Ship From address.",
|
|
15483
15647
|
invalidCreditCardType: "Card type must be Visa, Mastercard, American Express, or Discover",
|
|
15484
15648
|
invalidExpiration: "Invalid Expiration Date",
|
|
@@ -15653,18 +15817,19 @@ var onboarding$1 = {
|
|
|
15653
15817
|
title: "Onboarding",
|
|
15654
15818
|
inlineTitle: "Why are we asking?",
|
|
15655
15819
|
landing: {
|
|
15656
|
-
action: "
|
|
15820
|
+
action: "Register",
|
|
15657
15821
|
title: "Register Your Account",
|
|
15658
15822
|
subtitle: "Enter your email address to start shipping with discounted carrier rates",
|
|
15659
15823
|
welcome: "Welcome",
|
|
15660
|
-
messageLine1: "Simplify your shipping workflow
|
|
15661
|
-
|
|
15824
|
+
messageLine1: "Simplify your shipping workflow.",
|
|
15825
|
+
partnerMessageLine1: "Simplify your shipping workflow inside {{partnerName}}.",
|
|
15826
|
+
messageLine2: "Let’s begin your account registration so that you can compare carrier services, ship domestic and international orders, and manage your postage payments."
|
|
15662
15827
|
},
|
|
15663
15828
|
steps: {
|
|
15664
|
-
|
|
15829
|
+
register: "Register",
|
|
15665
15830
|
carriers: "Carriers",
|
|
15666
15831
|
addresses: "Addresses",
|
|
15667
|
-
|
|
15832
|
+
billing: "Billing"
|
|
15668
15833
|
},
|
|
15669
15834
|
warehouse: {
|
|
15670
15835
|
title: "Ship From Address",
|
|
@@ -15794,8 +15959,8 @@ var registerWallet = {
|
|
|
15794
15959
|
"register-wallet": {
|
|
15795
15960
|
sections: {
|
|
15796
15961
|
setup: {
|
|
15797
|
-
title: "Carriers
|
|
15798
|
-
subtitle: "
|
|
15962
|
+
title: "Activate Carriers",
|
|
15963
|
+
subtitle: "Activate the carriers in our service by agreeing to the carriers’ Terms of Service",
|
|
15799
15964
|
descriptionTitle: "What is a wallet?",
|
|
15800
15965
|
description: "Explaining the benefits of the wallet here"
|
|
15801
15966
|
},
|
|
@@ -15815,7 +15980,7 @@ var registerWallet = {
|
|
|
15815
15980
|
},
|
|
15816
15981
|
info: {
|
|
15817
15982
|
title: "Why we are asking?",
|
|
15818
|
-
description: "
|
|
15983
|
+
description: "We are offering a secure account balance to handle the cost of labels, insurance and carrier adjustments."
|
|
15819
15984
|
},
|
|
15820
15985
|
poBox: {
|
|
15821
15986
|
title: "PO Box cannot be used for Billing",
|
|
@@ -15825,6 +15990,9 @@ var registerWallet = {
|
|
|
15825
15990
|
title: "There was an error connecting {{carrierFriendlyName}}",
|
|
15826
15991
|
confirmAddress: "Confirm your address details and try again.",
|
|
15827
15992
|
description: "You can also skip this step for now and connect {{carrierFriendlyName}} in your Account Settings later."
|
|
15993
|
+
},
|
|
15994
|
+
blackBox: {
|
|
15995
|
+
description: "Please turn off all tracking add-ons like ad-blockers; they restrict our ability to confirm your activity is valid so we can more effectively prevent fraud."
|
|
15828
15996
|
}
|
|
15829
15997
|
}
|
|
15830
15998
|
},
|
|
@@ -15948,7 +16116,9 @@ var accountSettings = /*#__PURE__*/Object.freeze({
|
|
|
15948
16116
|
|
|
15949
16117
|
const Component$3 = ({
|
|
15950
16118
|
features,
|
|
15951
|
-
|
|
16119
|
+
onboardingAddress,
|
|
16120
|
+
onCompleteOnboarding,
|
|
16121
|
+
partnerName
|
|
15952
16122
|
}) => {
|
|
15953
16123
|
const {
|
|
15954
16124
|
t
|
|
@@ -15966,6 +16136,7 @@ const Component$3 = ({
|
|
|
15966
16136
|
} = alchemy.useListCarriers();
|
|
15967
16137
|
const {
|
|
15968
16138
|
error: createFundingSourceErrors,
|
|
16139
|
+
isLoading: creatingFundingSource,
|
|
15969
16140
|
mutateAsync: createFundingSource
|
|
15970
16141
|
} = alchemy.useCreateFundingSource();
|
|
15971
16142
|
const {
|
|
@@ -15974,7 +16145,8 @@ const Component$3 = ({
|
|
|
15974
16145
|
} = alchemy.useListFundingSources();
|
|
15975
16146
|
const {
|
|
15976
16147
|
error: registerCarrierErrors,
|
|
15977
|
-
mutateAsync: registerCarrier
|
|
16148
|
+
mutateAsync: registerCarrier,
|
|
16149
|
+
isLoading: registeringCarriers
|
|
15978
16150
|
} = alchemy.useRegisterCarrier();
|
|
15979
16151
|
const onWarehouseCreated = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
15980
16152
|
yield refetchWarehouses();
|
|
@@ -15998,10 +16170,13 @@ const Component$3 = ({
|
|
|
15998
16170
|
createWarehouse: createWarehouse,
|
|
15999
16171
|
features: features,
|
|
16000
16172
|
fundingSources: fundingSources,
|
|
16173
|
+
isRegisteringCarriers: registeringCarriers || creatingFundingSource,
|
|
16174
|
+
onboardingAddress: onboardingAddress,
|
|
16001
16175
|
onCarrierCreated: onCarrierCreated,
|
|
16002
16176
|
onCompleteOnboarding: onCompleteOnboarding,
|
|
16003
16177
|
onFundingSourceCreated: onFundingSourceCreated,
|
|
16004
16178
|
onWarehouseCreated: onWarehouseCreated,
|
|
16179
|
+
partnerName: partnerName,
|
|
16005
16180
|
registerCarrier: registerCarrier,
|
|
16006
16181
|
registerCarrierErrors: registerCarrierErrors,
|
|
16007
16182
|
warehouses: warehouses
|
|
@@ -16012,6 +16187,8 @@ const Element$4 = alchemy__default["default"].createElement(Component$3, ErrorFa
|
|
|
16012
16187
|
height: "100%",
|
|
16013
16188
|
maxWidth: "800px",
|
|
16014
16189
|
minWidth: "440px",
|
|
16190
|
+
overflow: "auto",
|
|
16191
|
+
scrollbarGutter: "stable both-edges",
|
|
16015
16192
|
width: "100%"
|
|
16016
16193
|
},
|
|
16017
16194
|
resources: {
|
|
@@ -16115,7 +16292,6 @@ const useAddress = ({
|
|
|
16115
16292
|
return parseResult;
|
|
16116
16293
|
});
|
|
16117
16294
|
const handleValidateAddress = React.useCallback((address, fallbackAddress) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16118
|
-
setAddressPreference(undefined);
|
|
16119
16295
|
if (compatibleCountryCodes && !compatibleCountryCodes.includes(address.countryCode)) {
|
|
16120
16296
|
resetAddressPreference({
|
|
16121
16297
|
messages: [],
|
|
@@ -16129,6 +16305,7 @@ const useAddress = ({
|
|
|
16129
16305
|
if (addressValidation) {
|
|
16130
16306
|
const updatedAddressPreference = resetAddressPreference(addressValidation, fallbackAddress);
|
|
16131
16307
|
yield onValidation === null || onValidation === void 0 ? void 0 : onValidation(updatedAddressPreference);
|
|
16308
|
+
return updatedAddressPreference;
|
|
16132
16309
|
} else {
|
|
16133
16310
|
// validate_and_clean failure is preventing the address preference object
|
|
16134
16311
|
// from being refreshed. Manualy set the address preference to an error state.
|
|
@@ -16139,20 +16316,23 @@ const useAddress = ({
|
|
|
16139
16316
|
originalAddress: address,
|
|
16140
16317
|
status: "error"
|
|
16141
16318
|
});
|
|
16319
|
+
return;
|
|
16142
16320
|
}
|
|
16143
|
-
}), [compatibleCountryCodes, onValidation, resetAddressPreference, validateAddresses]);
|
|
16321
|
+
}), [compatibleCountryCodes, onValidation, resetAddressPreference, setAddressPreference, validateAddresses]);
|
|
16144
16322
|
const handleChangeAddress = React.useCallback((shipTo, {
|
|
16145
16323
|
shouldValidate
|
|
16146
16324
|
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16325
|
+
var _a;
|
|
16147
16326
|
if (!shipment) throw new Error("shipment not found");
|
|
16327
|
+
let updatedAddressPreference;
|
|
16328
|
+
if (shouldValidate) {
|
|
16329
|
+
updatedAddressPreference = yield handleValidateAddress(shipTo);
|
|
16330
|
+
}
|
|
16148
16331
|
const updatedShipment = yield updateShipment(Object.assign(Object.assign({}, shipment), {
|
|
16149
16332
|
shipDate: isNowOrInTheFuture(shipment.shipDate) ? shipment.shipDate : undefined,
|
|
16150
|
-
shipTo
|
|
16333
|
+
shipTo: (_a = updatedAddressPreference === null || updatedAddressPreference === void 0 ? void 0 : updatedAddressPreference.selection) !== null && _a !== void 0 ? _a : shipTo
|
|
16151
16334
|
}));
|
|
16152
16335
|
yield onChange === null || onChange === void 0 ? void 0 : onChange(shipment, updatedShipment);
|
|
16153
|
-
if (shouldValidate) {
|
|
16154
|
-
yield handleValidateAddress(shipTo);
|
|
16155
|
-
}
|
|
16156
16336
|
return updatedShipment;
|
|
16157
16337
|
}), [handleValidateAddress, onChange, shipment, updateShipment]);
|
|
16158
16338
|
React.useEffect(() => {
|
|
@@ -17491,6 +17671,7 @@ exports.usCities = usCities;
|
|
|
17491
17671
|
exports.usStateCodes = usStateCodes;
|
|
17492
17672
|
exports.usStates = usStates;
|
|
17493
17673
|
exports.useAddressValidation = useAddressValidation;
|
|
17674
|
+
exports.useBlackboxDetection = useBlackboxDetection;
|
|
17494
17675
|
exports.useCarrierMetadata = useCarrierMetadata;
|
|
17495
17676
|
exports.useConfirmationOptions = useConfirmationOptions;
|
|
17496
17677
|
exports.useCountryCodeOptions = useCountryCodeOptions;
|