@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.
Files changed (26) hide show
  1. package/index.cjs +311 -130
  2. package/index.js +313 -133
  3. package/package.json +5 -10
  4. package/src/components/add-funds-form/add-funds-form.d.ts +2 -0
  5. package/src/components/templates/add-carrier-form/add-carrier-form-schema.d.ts +1 -1
  6. package/src/components/templates/address-form/address-form-schema.d.ts +153 -2
  7. package/src/components/templates/address-form/address-form.d.ts +2 -1
  8. package/src/components/templates/address-form/address-schema.d.ts +1 -1
  9. package/src/components/templates/carrier-recovery-form/carrier-recovery-form-schema.d.ts +5 -2
  10. package/src/components/templates/carrier-terms-form/carrier-terms-form.styles.d.ts +1 -0
  11. package/src/components/templates/landing-page/landing-page.d.ts +2 -1
  12. package/src/components/templates/onboarding/onboarding.d.ts +4 -1
  13. package/src/components/templates/onboarding/onboarding.styles.d.ts +10 -0
  14. package/src/components/templates/wallet-form/wallet-form.d.ts +1 -0
  15. package/src/components/templates/wallet-form/wallet-schema.d.ts +5 -2
  16. package/src/components/templates/warehouse-form/warehouse-form-schema.d.ts +3 -3
  17. package/src/components/templates/warehouse-form/warehouse-form.d.ts +1 -1
  18. package/src/elements/account-settings/account-settings.d.ts +8 -2
  19. package/src/elements/onboarding/onboarding.d.ts +11 -3
  20. package/src/elements/purchase-label/purchase-label.d.ts +8 -2
  21. package/src/elements/view-shipment/view-shipment.d.ts +8 -2
  22. package/src/elements/void-label/void-label.d.ts +8 -2
  23. package/src/hooks/index.d.ts +1 -0
  24. package/src/hooks/use-black-box-detection.d.ts +23 -0
  25. package/src/locales/en/index.d.ts +8 -2
  26. package/src/testing/extensions/queries/by-icon-name.d.ts +1 -1
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
2
2
  import { useTranslation, Trans } from 'react-i18next';
3
- import { InlineNotification, NotificationType, Typography, Link, ButtonSize, Spinner, Icon, IconSize, Divider, Skeleton, SkeletonAnimation, SkeletonVariant, Grid, GridChild, Pagination, SkeletonBackgroundColor, RadioGroup, Radio, SpinnerSize, FormField, FieldMessageType, Checkbox, Input, SelectAutocomplete, Select as Select$1, OptionGroup, Option, Button, Switch as Switch$1, Textarea, ChipList, Chip, ButtonVariant, ButtonColor, Tag, TagColor, Stepper, Step, Table, TableBody, TableBaseRow, TableBodyCell, TableHeader, TableHeaderCell, Popover, DropdownOptionList, DatePicker as DatePicker$1, BottomSheet } from '@packlink/giger';
4
- import alchemy, { SE, logger, useValidateAddresses, useListCarriers, useConnectCarrier, useListWarehouses, useUpdateWarehouse, useCreateWarehouse, useDeleteWarehouse, useGetWalletHistory, useGetAccountSettings, useUpdateAccountSettings, useAddFunds, useGetCarrierById, useUpdateAutoFunding, useGetAutoFundingConfiguration, Currency, useUpdateFundingSource, useListFundingSources, useCreateFundingSource, useRegisterCarrier, useUpdateSalesOrderShipment, useParseAddress, useListCustomPackageTypes, useCalculateRates, useGetShipmentRates, useListLabels, useCreateLabel, useListSalesOrderShipments, useCreateSalesOrderShipment, useListSalesOrders, useGetSalesOrder, useListOrderSources, useRefreshOrderSource, useCreateShipment, useGetShipment, useGetSalesOrderShipment, useGetLabel, useVoidLabel } from '@shipengine/alchemy';
3
+ import { InlineNotification, NotificationType, Typography, Link, ButtonSize, Spinner, Icon, IconSize, Divider, Skeleton, SkeletonAnimation, SkeletonVariant, Grid, GridChild, Pagination, SkeletonBackgroundColor, RadioGroup, Radio, SpinnerSize, FormField, FieldMessageType, Checkbox, Input, SelectAutocomplete, Select as Select$1, OptionGroup, Option, Button, Switch as Switch$1, Textarea, ChipList, Chip, ButtonVariant, ButtonColor, Tag, TagColor, Stepper, Step, IconTooltip, Table, TableBody, TableBaseRow, TableBodyCell, TableHeader, TableHeaderCell, Popover, DropdownOptionList, DatePicker as DatePicker$1, BottomSheet } from '@packlink/giger';
4
+ import alchemy, { SE, logger, useValidateAddresses, useListCarriers, useConnectCarrier, useListWarehouses, useUpdateWarehouse, useCreateWarehouse, useDeleteWarehouse, useGetWalletHistory, useGetAccountSettings, useUpdateAccountSettings, AlchemyContext, useAddFunds, useGetCarrierById, useUpdateAutoFunding, useGetAutoFundingConfiguration, Currency, useUpdateFundingSource, useListFundingSources, useCreateFundingSource, useRegisterCarrier, useUpdateSalesOrderShipment, useParseAddress, useListCustomPackageTypes, useCalculateRates, useGetShipmentRates, useListLabels, useCreateLabel, useListSalesOrderShipments, useCreateSalesOrderShipment, useListSalesOrders, useGetSalesOrder, useListOrderSources, useRefreshOrderSource, useCreateShipment, useGetShipment, useGetSalesOrderShipment, useGetLabel, useVoidLabel } from '@shipengine/alchemy';
5
5
  import axios from 'axios';
6
6
  import { zodResolver } from '@hookform/resolvers/zod';
7
7
  import { z } from 'zod';
@@ -13,7 +13,6 @@ import { IconNames } from '@packlink/giger-theme';
13
13
  import { css, keyframes, useTheme, createElement as createElement$3 } from '@emotion/react';
14
14
  import { camelize } from 'humps';
15
15
  import { createPortal } from 'react-dom';
16
- import { IconNames as IconNames$1 } from '@packlink/brands';
17
16
  import { useQueryClient } from 'react-query';
18
17
  import { useController, get as get$2, set as set$2, useWatch, useFormState, useForm } from 'react-hook-form';
19
18
  import ReactDatePicker, { registerLocale, setDefaultLocale } from 'react-datepicker';
@@ -4473,6 +4472,66 @@ const useAddressValidation = () => {
4473
4472
  };
4474
4473
  };
4475
4474
 
4475
+ /*
4476
+ * ****** WARNING *******
4477
+ * 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.
4478
+ * There is a chance that more than one script will be mounted if this hook is used elsewhere.
4479
+ */
4480
+ /**
4481
+ * Creates an encoded device fingerprint string - aka black box - containing information about the end-user's computing device such as OS, browser, etc.
4482
+ * https://developer.bazaarvoice.com/conversations-api/deprecations/iovation-web#snare_js_only
4483
+ */
4484
+ const useBlackboxDetection = ({
4485
+ onSuccess,
4486
+ onError
4487
+ }) => {
4488
+ useEffect(() => {
4489
+ // basic configurations must be on page before snare.js is loaded
4490
+ window.io_install_stm = false; // do not install Active X
4491
+ window.io_exclude_stm = 12; // do not run Active X
4492
+ window.io_install_flash = false; // do not install Flash
4493
+ window.io_enable_rip = true; // collect Real IP information
4494
+ const pollBlackBox = () => {
4495
+ try {
4496
+ if (typeof ioGetBlackbox !== "function") {
4497
+ return;
4498
+ }
4499
+ // eslint-disable-next-line
4500
+ const blackboxInfo = ioGetBlackbox();
4501
+ // 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
4502
+ if (blackboxInfo.finished) {
4503
+ clearTimeout(intervalId);
4504
+ onSuccess(blackboxInfo.blackbox);
4505
+ }
4506
+ } catch (_e) {
4507
+ onError();
4508
+ }
4509
+ };
4510
+ const intervalId = setInterval(pollBlackBox, 500);
4511
+ // attach script to DOM
4512
+ const script = document.createElement("script");
4513
+ script.type = "text/javascript";
4514
+ script.async = true;
4515
+ script.src = "https://mpsnare.iesnare.com/snare.js";
4516
+ script.addEventListener("error", _e => {
4517
+ if (typeof ioGetBlackbox !== "function") {
4518
+ onError();
4519
+ }
4520
+ });
4521
+ document.head.appendChild(script);
4522
+ return () => {
4523
+ if (intervalId) {
4524
+ clearTimeout(intervalId);
4525
+ }
4526
+ delete window.io_install_stm;
4527
+ delete window.io_exclude_stm;
4528
+ delete window.io_install_flash;
4529
+ delete window.io_enable_rip;
4530
+ document.head.removeChild(script);
4531
+ };
4532
+ }, [onSuccess, onError]);
4533
+ };
4534
+
4476
4535
  const useListConnectedCarriers = () => {
4477
4536
  const {
4478
4537
  data: carriers,
@@ -6855,7 +6914,7 @@ const LabelLayoutSettings = ({
6855
6914
  }, {
6856
6915
  children: [labelLayout === "letter" && jsx(Icon, {
6857
6916
  css: styles$p.icon,
6858
- name: IconNames$1.CHECK_FILLED
6917
+ name: IconNames.CHECK_FILLED
6859
6918
  }), jsx("div", Object.assign({
6860
6919
  css: styles$p.letterInner
6861
6920
  }, {
@@ -6887,7 +6946,7 @@ const LabelLayoutSettings = ({
6887
6946
  }, {
6888
6947
  children: [labelLayout === "4x6" && jsx(Icon, {
6889
6948
  css: styles$p.icon,
6890
- name: IconNames$1.CHECK_FILLED
6949
+ name: IconNames.CHECK_FILLED
6891
6950
  }), jsx("div", Object.assign({
6892
6951
  css: styles$p.thermalInner
6893
6952
  }, {
@@ -7364,6 +7423,7 @@ const getWrapperStyles = theme => /*#__PURE__*/css$1(process.env.NODE_ENV === "p
7364
7423
 
7365
7424
  const DatePickerController = createFieldController();
7366
7425
  const DatePicker = fieldProps => {
7426
+ const alchemy = useContext(AlchemyContext);
7367
7427
  const theme = useTheme();
7368
7428
  const datePickerRef = useRef(null);
7369
7429
  return jsx(DatePickerController, Object.assign({}, fieldProps, {
@@ -7384,7 +7444,7 @@ const DatePicker = fieldProps => {
7384
7444
  css: getOverrideStyles(theme)
7385
7445
  }, {
7386
7446
  children: jsx(ReactDatePicker, Object.assign({
7387
- locale: LOCALE
7447
+ locale: alchemy === null || alchemy === void 0 ? void 0 : alchemy.locale
7388
7448
  }, datePickerProps, {
7389
7449
  customInput: /*#__PURE__*/createElement$2( /*#__PURE__*/forwardRef(function InputWrapper(_a, forwardedRef) {
7390
7450
  var _b;
@@ -8755,16 +8815,8 @@ const AddFundsForm = ({
8755
8815
  }))]
8756
8816
  }))]
8757
8817
  })]
8758
- })), addFunds.error && jsxs(Fragment, {
8759
- children: [jsx(Spacer, {
8760
- multiplier: 1
8761
- }), jsx(InlineNotification, Object.assign({
8762
- title: t("manage-funding:addFunds.error.title"),
8763
- type: NotificationType.ERROR
8764
- }, {
8765
- children: addFunds.error[0].message
8766
- }))]
8767
- }), children === null || children === void 0 ? void 0 : children({
8818
+ })), children === null || children === void 0 ? void 0 : children({
8819
+ error: addFunds.error,
8768
8820
  isCustomAmount: selectedChip.value === "custom",
8769
8821
  isSubmitted,
8770
8822
  isSubmitting,
@@ -9001,7 +9053,7 @@ const InlineLabel = ({
9001
9053
 
9002
9054
  const styles$l = createStyles({
9003
9055
  getBalanceText: balance => theme => ({
9004
- color: balance === undefined ? theme.palette.alert.main : balance >= 0 ? theme.palette.secondary.dark : theme.palette.error.main
9056
+ color: balance === undefined ? theme.palette.gray.main : balance >= 0 ? theme.palette.secondary.dark : theme.palette.error.main
9005
9057
  })
9006
9058
  });
9007
9059
 
@@ -9026,7 +9078,7 @@ const CarrierBalance = ({
9026
9078
  bold: true,
9027
9079
  css: styles$l.getBalanceText(carrierBalance)
9028
9080
  }, {
9029
- children: carrierBalance === undefined ? t("manage-funding:errors.balanceUnknown") : formatMoney({
9081
+ children: carrierBalance === undefined ? "----" : formatMoney({
9030
9082
  amount: carrierBalance,
9031
9083
  currency: SE.Currency.USD
9032
9084
  })
@@ -9106,6 +9158,12 @@ const AddressParser = ({
9106
9158
  const payload = values;
9107
9159
  onSubmit(payload);
9108
9160
  }));
9161
+ form.watch((data, {
9162
+ name
9163
+ }) => {
9164
+ var _a;
9165
+ if (name === "fullAddress" && ((_a = data.fullAddress) === null || _a === void 0 ? void 0 : _a.length) == null) reset === null || reset === void 0 ? void 0 : reset();
9166
+ });
9109
9167
  const errors = (parseErrors === null || parseErrors === void 0 ? void 0 : parseErrors.length) ? [t("errorMessages.parsingFailure")] : undefined;
9110
9168
  const formInterface = jsxs(Fragment, {
9111
9169
  children: [jsx(TextArea, {
@@ -9310,19 +9368,6 @@ const AddressFields = ({
9310
9368
  });
9311
9369
  };
9312
9370
 
9313
- /* eslint-disable @typescript-eslint/no-unused-vars -- Allow unused generics in ZodObject interface overload */
9314
- function nullishDefault(defaultValue) {
9315
- return this.nullish().transform(v => v !== null && v !== void 0 ? v : defaultValue);
9316
- }
9317
- /**
9318
- * @category Form Validation
9319
- */
9320
- const extendZod = () => {
9321
- z.ZodString.prototype.nullishDefault = nullishDefault;
9322
- z.ZodNumber.prototype.nullishDefault = nullishDefault;
9323
- z.ZodObject.prototype.nullishDefault = nullishDefault;
9324
- };
9325
-
9326
9371
  var call = functionCall;
9327
9372
  var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
9328
9373
  var anObject = anObject$f;
@@ -9371,8 +9416,20 @@ fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNa
9371
9416
  ];
9372
9417
  });
9373
9418
 
9419
+ /* eslint-disable @typescript-eslint/no-unused-vars -- Allow unused generics in ZodObject interface overload */
9420
+ function nullishDefault(defaultValue) {
9421
+ return this.nullish().transform(v => v !== null && v !== void 0 ? v : defaultValue);
9422
+ }
9423
+ /**
9424
+ * @category Form Validation
9425
+ */
9426
+ const extendZod = () => {
9427
+ z.ZodString.prototype.nullishDefault = nullishDefault;
9428
+ z.ZodNumber.prototype.nullishDefault = nullishDefault;
9429
+ z.ZodObject.prototype.nullishDefault = nullishDefault;
9430
+ };
9431
+
9374
9432
  extendZod();
9375
- const refineName = n => n.match(/^[a-zA-Z']{2,} [a-zA-Z']{2,}/);
9376
9433
  const addressLine1Schema = z.string().trim().min(1);
9377
9434
  const addressLine2Schema = z.string().trim().nullishDefault(undefined);
9378
9435
  const companyNameSchema = z.string().trim().min(2).max(40).nullishDefault(undefined).or(z.literal("")).transform(companyName => companyName || undefined);
@@ -9382,7 +9439,7 @@ const addressSchema = z.object({
9382
9439
  cityLocality: z.string().trim().min(1),
9383
9440
  companyName: companyNameSchema,
9384
9441
  countryCode: z.enum(countryCodes),
9385
- name: z.string().trim().min(1).refine(refineName, "schemaErrors.invalidAddressName"),
9442
+ name: z.string().trim().min(1),
9386
9443
  phone: z.string().trim().nullishDefault(""),
9387
9444
  postalCode: z.string().trim(),
9388
9445
  stateProvince: z.string().trim().nullishDefault("")
@@ -9390,7 +9447,14 @@ const addressSchema = z.object({
9390
9447
 
9391
9448
  extendZod();
9392
9449
  const postalCodeRegex$2 = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
9393
- const addressFormSchema = addressSchema.refine(schema => !schema.phone || isValidPhoneNumber(schema.phone, schema.countryCode), {
9450
+ const refineName = n => n.match(/^[a-zA-Z']/);
9451
+ const refineNameStrict = n => n.match(/^[a-zA-Z']{2,} [a-zA-Z']{2,}/);
9452
+ const shipToAddressSchema = addressSchema.refine(schema => {
9453
+ return refineName(schema.name);
9454
+ }, {
9455
+ message: "schemaErrors.invalidAddressName",
9456
+ path: ["name"]
9457
+ }).refine(schema => !schema.phone || isValidPhoneNumber(schema.phone, schema.countryCode), {
9394
9458
  message: "schemaErrors.notAValidPhoneNumber",
9395
9459
  path: ["phone"]
9396
9460
  }).refine(schema => {
@@ -9410,11 +9474,18 @@ const addressFormSchema = addressSchema.refine(schema => !schema.phone || isVali
9410
9474
  message: "schemaErrors.invalidPostalCode",
9411
9475
  path: ["postalCode"]
9412
9476
  });
9477
+ const addressFormSchema = shipToAddressSchema.refine(schema => {
9478
+ return refineNameStrict(schema.name);
9479
+ }, {
9480
+ message: "schemaErrors.invalidAddressNameStrict",
9481
+ path: ["name"]
9482
+ });
9413
9483
 
9414
9484
  const AddressForm = ({
9415
9485
  address,
9416
9486
  domestic,
9417
9487
  formId,
9488
+ isShipToForm,
9418
9489
  onCancel,
9419
9490
  onCancelParse,
9420
9491
  onSubmit,
@@ -9428,7 +9499,7 @@ const AddressForm = ({
9428
9499
  } = useTranslation();
9429
9500
  const form = useForm({
9430
9501
  defaultValues: Object.assign({}, address && address),
9431
- resolver: validationResolver(addressFormSchema)
9502
+ resolver: validationResolver(isShipToForm ? shipToAddressSchema : addressFormSchema)
9432
9503
  });
9433
9504
  const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
9434
9505
  const payload = __rest(values, []);
@@ -9710,29 +9781,23 @@ const AddressPreferenceSelect = ({
9710
9781
  case "ERROR":
9711
9782
  return jsxs(Fragment, {
9712
9783
  children: [jsx(Spacer, {
9713
- multiplier: 1
9784
+ multiplier: 2
9714
9785
  }), jsx(GridChild, Object.assign({
9715
- colSpan: 8,
9716
- css: theme => ({
9717
- paddingLeft: theme.spacing(1)
9718
- })
9786
+ colSpan: 8
9719
9787
  }, {
9720
9788
  children: jsx(InlineNotification, Object.assign({
9789
+ title: t("address.preference.addressNotValidated"),
9721
9790
  type: NotificationType.ALERT
9722
9791
  }, {
9723
9792
  children: t("address.preference.unableToValidate")
9724
9793
  }))
9725
9794
  })), jsx(Spacer, {
9726
- multiplier: 1
9727
- }), jsx(GridChild, Object.assign({
9728
- css: theme => ({
9729
- paddingLeft: theme.spacing(1)
9730
- })
9731
- }, {
9795
+ multiplier: 2
9796
+ }), jsx(GridChild, {
9732
9797
  children: jsx(AddressDisplay, {
9733
9798
  address: (_b = warehousePreference.validation) === null || _b === void 0 ? void 0 : _b.originalAddress
9734
9799
  })
9735
- }))]
9800
+ })]
9736
9801
  });
9737
9802
  default:
9738
9803
  // This code path should never be reached.
@@ -9755,7 +9820,7 @@ const AddressPreferenceSelect = ({
9755
9820
  children: t("common:address.preference.title")
9756
9821
  }))
9757
9822
  })), jsxs(GridChild, Object.assign({
9758
- colSpan: 8
9823
+ colSpan: 12
9759
9824
  }, {
9760
9825
  children: [jsx(Typography, Object.assign({
9761
9826
  css: {
@@ -10013,7 +10078,8 @@ const creditCardSchema = z.object({
10013
10078
  });
10014
10079
  const walletSchema = z.object({
10015
10080
  address: billingAddressSchema,
10016
- creditCard: creditCardSchema
10081
+ creditCard: creditCardSchema,
10082
+ iovationBlackbox: z.string().trim().min(1)
10017
10083
  });
10018
10084
 
10019
10085
  const EditWalletAddressForm = ({
@@ -10099,6 +10165,7 @@ const WalletForm = ({
10099
10165
  const {
10100
10166
  validateAddress
10101
10167
  } = useAddressPreference();
10168
+ const [codedErrors, setCodedErrors] = useState(errors);
10102
10169
  const form = useForm({
10103
10170
  defaultValues:
10104
10171
  // If the warehouse address is a PO Box they cannot use it as their billing address
@@ -10113,6 +10180,20 @@ const WalletForm = ({
10113
10180
  },
10114
10181
  resolver: validationResolver(walletSchema)
10115
10182
  });
10183
+ useBlackboxDetection({
10184
+ onError: () => {
10185
+ setCodedErrors(errors => {
10186
+ const blackBoxError = {
10187
+ errorCode: "unspecified",
10188
+ errorSource: "client",
10189
+ errorType: "unknown",
10190
+ message: t("register-wallet:sections.notifications.blackBox.description")
10191
+ };
10192
+ return [...(errors !== null && errors !== void 0 ? errors : []), blackBoxError];
10193
+ });
10194
+ },
10195
+ onSuccess: bb => form.setValue("iovationBlackbox", bb)
10196
+ });
10116
10197
  const watchAddress = form.watch("address");
10117
10198
  const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
10118
10199
  const payload = __rest(values, []);
@@ -10126,7 +10207,8 @@ const WalletForm = ({
10126
10207
  onValid: validatedAddressesPayload => __awaiter(void 0, void 0, void 0, function* () {
10127
10208
  yield onSubmit({
10128
10209
  address: validatedAddressesPayload.originAddress,
10129
- creditCard: payload.creditCard
10210
+ creditCard: payload.creditCard,
10211
+ iovationBlackbox: payload.iovationBlackbox
10130
10212
  });
10131
10213
  })
10132
10214
  });
@@ -10149,11 +10231,11 @@ const WalletForm = ({
10149
10231
  children: [jsx(GridChild, Object.assign({
10150
10232
  colSpan: 12
10151
10233
  }, {
10152
- children: (errors === null || errors === void 0 ? void 0 : errors.length) && jsx(InlineNotification, Object.assign({
10234
+ children: !!(codedErrors === null || codedErrors === void 0 ? void 0 : codedErrors.length) && jsx(InlineNotification, Object.assign({
10153
10235
  title: t("register-wallet:sections.notifications.error.title"),
10154
10236
  type: NotificationType.ERROR
10155
10237
  }, {
10156
- children: errors.map(({
10238
+ children: codedErrors.map(({
10157
10239
  message
10158
10240
  }) => message).join(" ")
10159
10241
  }))
@@ -10800,7 +10882,8 @@ const styles$e = createStyles({
10800
10882
  display: "flex",
10801
10883
  flexDirection: "column",
10802
10884
  paddingBottom: theme.spacing(8),
10803
- paddingTop: theme.spacing(2)
10885
+ paddingTop: theme.spacing(2),
10886
+ textAlign: "center"
10804
10887
  }),
10805
10888
  termsLink: theme => ({
10806
10889
  alignItems: "center",
@@ -11147,10 +11230,10 @@ const AddressPreferenceDisplay = ({
11147
11230
  children: [jsx(Button, Object.assign({
11148
11231
  bold: false,
11149
11232
  isFullWidth: true,
11150
- onClick: () => {
11151
- handleChangePreference();
11233
+ onClick: () => __awaiter(void 0, void 0, void 0, function* () {
11234
+ yield handleChangePreference();
11152
11235
  toggleDisclosure();
11153
- },
11236
+ }),
11154
11237
  type: "button",
11155
11238
  variant: ButtonVariant.OUTLINED
11156
11239
  }, {
@@ -11195,7 +11278,8 @@ const baseSchema = addressSchema.extend({
11195
11278
  path: ["postalCode"]
11196
11279
  });
11197
11280
  const getCarrierRecoverySchema = requiresAddress => z.object({
11198
- address: requiresAddress ? baseSchema : baseSchema.optional()
11281
+ address: requiresAddress ? baseSchema : baseSchema.optional(),
11282
+ iovationBlackbox: z.string().trim().min(1)
11199
11283
  });
11200
11284
 
11201
11285
  const styles$c = createStyles({
@@ -11222,6 +11306,7 @@ const CarrierRecoveryForm = ({
11222
11306
  const {
11223
11307
  t
11224
11308
  } = useTranslation();
11309
+ const [codedErrors, setCodedErrors] = useState(errors);
11225
11310
  const metadata = useCarrierMetadata();
11226
11311
  const carrier = metadata.find(m => m.carrierCode === carrierCode);
11227
11312
  const carrierFriendlyName = (_a = carrier === null || carrier === void 0 ? void 0 : carrier.shortname) !== null && _a !== void 0 ? _a : "your carrier";
@@ -11234,6 +11319,22 @@ const CarrierRecoveryForm = ({
11234
11319
  }),
11235
11320
  resolver: validationResolver(getCarrierRecoverySchema(requiresAddress))
11236
11321
  });
11322
+ useBlackboxDetection({
11323
+ onError: () => {
11324
+ setCodedErrors(errors => {
11325
+ const blackBoxError = {
11326
+ errorCode: "unspecified",
11327
+ errorSource: "client",
11328
+ errorType: "unknown",
11329
+ message: t("register-wallet:sections.notifications.blackBox.description")
11330
+ };
11331
+ return [...(errors !== null && errors !== void 0 ? errors : []), blackBoxError];
11332
+ });
11333
+ },
11334
+ onSuccess: bb => {
11335
+ form.setValue("iovationBlackbox", bb);
11336
+ }
11337
+ });
11237
11338
  const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
11238
11339
  yield onSubmit(fundingSourceId, values);
11239
11340
  }));
@@ -11265,7 +11366,7 @@ const CarrierRecoveryForm = ({
11265
11366
  children: t("register-wallet:sections.carriers.subtitle")
11266
11367
  }))
11267
11368
  }))]
11268
- }), !!(errors === null || errors === void 0 ? void 0 : errors.length) && jsx(GridChild, Object.assign({
11369
+ }), !!(codedErrors === null || codedErrors === void 0 ? void 0 : codedErrors.length) && jsx(GridChild, Object.assign({
11269
11370
  colSpan: 12
11270
11371
  }, {
11271
11372
  children: jsx(InlineNotification, Object.assign({
@@ -11274,7 +11375,7 @@ const CarrierRecoveryForm = ({
11274
11375
  }),
11275
11376
  type: NotificationType.ERROR
11276
11377
  }, {
11277
- children: errors.map(({
11378
+ children: codedErrors.map(({
11278
11379
  message
11279
11380
  }) => message).join(" ")
11280
11381
  }))
@@ -11820,7 +11921,6 @@ const LandingPageForm = ({
11820
11921
  alwaysRequireValidity: true,
11821
11922
  control: form.control,
11822
11923
  "data-testid": "onboarding:landing.action",
11823
- form: "landing-page-form",
11824
11924
  variant: ButtonVariant.FILLED
11825
11925
  }, {
11826
11926
  children: t("onboarding:landing.action")
@@ -11845,7 +11945,8 @@ const styles$a = createStyles({
11845
11945
  });
11846
11946
 
11847
11947
  const LandingPage = ({
11848
- onSubmit
11948
+ onSubmit,
11949
+ partnerName
11849
11950
  }) => {
11850
11951
  const {
11851
11952
  t
@@ -11887,7 +11988,9 @@ const LandingPage = ({
11887
11988
  css: styles$a.description,
11888
11989
  variant: "body1"
11889
11990
  }, {
11890
- children: t("onboarding:landing.messageLine1")
11991
+ children: partnerName ? t("onboarding:landing.partnerMessageLine1", {
11992
+ partnerName: partnerName
11993
+ }) : t("onboarding:landing.messageLine1")
11891
11994
  })), jsx(Spacer, {
11892
11995
  multiplier: 2
11893
11996
  }), jsx(Typography, Object.assign({
@@ -12341,7 +12444,7 @@ const WarehouseForm = ({
12341
12444
  control: form.control,
12342
12445
  "data-testid": "warehouseFormSubmitButton",
12343
12446
  form: "warehouse-form",
12344
- requireDirty: true,
12447
+ requireDirty: !warehouse,
12345
12448
  variant: _isOnboarding ? ButtonVariant.FILLED : ButtonVariant.OUTLINED
12346
12449
  }, {
12347
12450
  children: submitButtonTitle
@@ -12558,11 +12661,21 @@ const styles$6 = createStyles({
12558
12661
  container: theme => ({
12559
12662
  padding: theme.spacing(2)
12560
12663
  }),
12664
+ iconTooltip: theme => ({
12665
+ color: theme.palette.secondary.main,
12666
+ display: "inline-block",
12667
+ marginLeft: theme.spacing(1),
12668
+ verticalAlign: "middle"
12669
+ }),
12561
12670
  step: {
12562
12671
  "& > span:last-child": {
12563
12672
  position: "static"
12564
12673
  }
12565
12674
  },
12675
+ tooltipContainer: () => ({
12676
+ maxWidth: "260px",
12677
+ textAlign: "left"
12678
+ }),
12566
12679
  walletFormHeader: theme => ({
12567
12680
  margin: theme.spacing(4)
12568
12681
  }),
@@ -12578,17 +12691,20 @@ const styles$6 = createStyles({
12578
12691
 
12579
12692
  const Onboarding = ({
12580
12693
  connectedCarriers,
12694
+ createFundingSource,
12695
+ createFundingSourceErrors,
12581
12696
  createWarehouse,
12582
12697
  features,
12583
12698
  fundingSources,
12699
+ isRegisteringCarriers,
12700
+ onboardingAddress,
12584
12701
  onCarrierCreated,
12585
12702
  onCompleteOnboarding,
12586
12703
  onFundingSourceCreated,
12587
12704
  onWarehouseCreated,
12705
+ partnerName,
12588
12706
  registerCarrier,
12589
12707
  registerCarrierErrors,
12590
- createFundingSource,
12591
- createFundingSourceErrors,
12592
12708
  warehouses
12593
12709
  }) => {
12594
12710
  var _a, _b, _c;
@@ -12622,6 +12738,7 @@ const Onboarding = ({
12622
12738
  const hasDhl = connectedCarriers === null || connectedCarriers === void 0 ? void 0 : connectedCarriers.some(c => c.carrierCode === "dhl_express_worldwide");
12623
12739
  const fundingSourceId = (fundingSources === null || fundingSources === void 0 ? void 0 : fundingSources.length) ? fundingSources[0].fundingSourceId : undefined;
12624
12740
  const hasCompletedOnboarding = onboardingComplete || warehouses.length && hasStampsWallet && (hasUps || !upsEnabled) && hasDhl;
12741
+ const containerRef = useRef(null);
12625
12742
  const currentStep = useMemo(() => {
12626
12743
  if (hasCompletedOnboarding) {
12627
12744
  return 5;
@@ -12647,8 +12764,9 @@ const Onboarding = ({
12647
12764
  return [];
12648
12765
  };
12649
12766
  const handleWalletRegistrationSuccess = (fundingSourceId, {
12650
- address
12651
- } = {}) => __awaiter(void 0, void 0, void 0, function* () {
12767
+ address,
12768
+ iovationBlackbox
12769
+ }) => __awaiter(void 0, void 0, void 0, function* () {
12652
12770
  const addressToRegister = address !== null && address !== void 0 ? address : defaultWarehouse.originAddress;
12653
12771
  const pickupAddress = Object.assign(Object.assign({}, addressToRegister), {
12654
12772
  company: addressToRegister.companyName || "",
@@ -12665,6 +12783,7 @@ const Onboarding = ({
12665
12783
  agreeToTerms: true,
12666
12784
  carrierCode: "ups_walleted",
12667
12785
  fundingSourceId: fundingSourceId,
12786
+ iovationBlackBox: iovationBlackbox,
12668
12787
  pickupAddress: pickupAddress
12669
12788
  });
12670
12789
  }
@@ -12673,7 +12792,8 @@ const Onboarding = ({
12673
12792
  acceptedTerms: getTerms("dhl_express_walleted"),
12674
12793
  agreeToTerms: true,
12675
12794
  carrierCode: "dhl_express_worldwide",
12676
- fundingSourceId: fundingSourceId
12795
+ fundingSourceId: fundingSourceId,
12796
+ iovationBlackBox: iovationBlackbox
12677
12797
  });
12678
12798
  }
12679
12799
  return {
@@ -12694,7 +12814,8 @@ const Onboarding = ({
12694
12814
  });
12695
12815
  const handleWalletRegistration = ({
12696
12816
  address,
12697
- creditCard
12817
+ creditCard,
12818
+ iovationBlackbox
12698
12819
  }) => __awaiter(void 0, void 0, void 0, function* () {
12699
12820
  setHasCompletedBilling(true);
12700
12821
  const billingInfo = Object.assign(Object.assign({}, address), {
@@ -12707,11 +12828,14 @@ const Onboarding = ({
12707
12828
  acceptedTerms: getTerms("stamps_com"),
12708
12829
  agreeToTerms: agreedToTerms,
12709
12830
  billingInfo: billingInfo,
12831
+ iovationBlackBox: iovationBlackbox,
12710
12832
  paymentMethod: {
12711
12833
  creditCardInfo: Object.assign({}, creditCard)
12712
12834
  }
12713
12835
  });
12714
- yield handleWalletRegistrationSuccess(fundingSource.fundingSource.fundingSourceId);
12836
+ yield handleWalletRegistrationSuccess(fundingSource.fundingSource.fundingSourceId, {
12837
+ iovationBlackbox
12838
+ });
12715
12839
  } catch (_e) {
12716
12840
  setHasCompletedBilling(false);
12717
12841
  }
@@ -12727,7 +12851,8 @@ const Onboarding = ({
12727
12851
  }
12728
12852
  // Step 1: Landing Page
12729
12853
  if (!email) return jsx(LandingPage, {
12730
- onSubmit: e => setEmail(e)
12854
+ onSubmit: e => setEmail(e),
12855
+ partnerName: partnerName
12731
12856
  });
12732
12857
  // Step 2: Agree to Terms and Conditions
12733
12858
  if (!agreedToTerms) {
@@ -12776,7 +12901,8 @@ const Onboarding = ({
12776
12901
  onSubmit: payload => __awaiter(void 0, void 0, void 0, function* () {
12777
12902
  return handleCreateWarehouse(payload);
12778
12903
  }),
12779
- submitButtonTitle: t("actions.continue")
12904
+ submitButtonTitle: t("actions.continue"),
12905
+ warehouse: onboardingAddress
12780
12906
  })
12781
12907
  }));
12782
12908
  }
@@ -12799,21 +12925,39 @@ const Onboarding = ({
12799
12925
  variant: "subtitle1"
12800
12926
  }, {
12801
12927
  children: t("register-wallet:sections.billing.cardSubTitle")
12928
+ })), jsx(IconTooltip, Object.assign({
12929
+ container: containerRef.current,
12930
+ css: styles$6.iconTooltip,
12931
+ icon: IconNames.INFO_FILLED,
12932
+ placement: "auto",
12933
+ size: IconSize.SIZE_MEDIUM
12934
+ }, {
12935
+ children: jsxs("div", Object.assign({
12936
+ css: styles$6.tooltipContainer
12937
+ }, {
12938
+ children: [jsx(Typography, Object.assign({
12939
+ bold: true,
12940
+ variant: "small"
12941
+ }, {
12942
+ children: t("register-wallet:sections.notifications.info.title")
12943
+ })), jsx(Spacer, {
12944
+ multiplier: 1
12945
+ }), jsx(Typography, Object.assign({
12946
+ variant: "small"
12947
+ }, {
12948
+ children: t("register-wallet:sections.notifications.info.description")
12949
+ }))]
12950
+ }))
12802
12951
  }))]
12803
12952
  })), jsx(Spacer, {
12804
12953
  multiplier: 1
12805
- }), (createFundingSourceErrors === null || createFundingSourceErrors === void 0 ? void 0 : createFundingSourceErrors.length) ? jsx(InlineNotification, Object.assign({
12954
+ }), !!(createFundingSourceErrors === null || createFundingSourceErrors === void 0 ? void 0 : createFundingSourceErrors.length) && jsx(InlineNotification, Object.assign({
12806
12955
  title: t("register-wallet:sections.notifications.error.title"),
12807
12956
  type: NotificationType.ERROR
12808
12957
  }, {
12809
12958
  children: createFundingSourceErrors.map(({
12810
12959
  message
12811
12960
  }) => message).join(" ")
12812
- })) : jsx(InlineNotification, Object.assign({
12813
- title: t("register-wallet:sections.notifications.info.title"),
12814
- type: NotificationType.INFO
12815
- }, {
12816
- children: t("register-wallet:sections.notifications.info.description")
12817
12961
  }))]
12818
12962
  })),
12819
12963
  onSubmit: payload => __awaiter(void 0, void 0, void 0, function* () {
@@ -12861,19 +13005,25 @@ const Onboarding = ({
12861
13005
  });
12862
13006
  }
12863
13007
  }
13008
+ if (isRegisteringCarriers || currentStep === 4) {
13009
+ return jsx(Loader, {
13010
+ message: t("loading.connectingCarriers")
13011
+ });
13012
+ }
12864
13013
  return jsx(Loader, {
12865
13014
  message: t("loading.onboarding")
12866
13015
  });
12867
13016
  };
12868
13017
  return jsxs("div", Object.assign({
12869
- css: styles$6.container
13018
+ css: styles$6.container,
13019
+ ref: containerRef
12870
13020
  }, {
12871
13021
  children: [jsxs(Stepper, Object.assign({
12872
13022
  currentStep: currentStep
12873
13023
  }, {
12874
13024
  children: [jsx(Step, {
12875
13025
  css: styles$6.step,
12876
- label: t("onboarding:steps.login")
13026
+ label: t("onboarding:steps.register")
12877
13027
  }), jsx(Step, {
12878
13028
  css: styles$6.step,
12879
13029
  label: t("onboarding:steps.carriers")
@@ -12882,7 +13032,7 @@ const Onboarding = ({
12882
13032
  label: t("onboarding:steps.addresses")
12883
13033
  }), jsx(Step, {
12884
13034
  css: styles$6.step,
12885
- label: t("onboarding:steps.payment")
13035
+ label: t("onboarding:steps.billing")
12886
13036
  })]
12887
13037
  })), renderStep(), ((_c = features === null || features === void 0 ? void 0 : features.presentation) === null || _c === void 0 ? void 0 : _c.poweredByShipEngine) && jsxs(Fragment, {
12888
13038
  children: [jsx(Spacer, {}), jsx(PoweredByShipEngine, {})]
@@ -12956,29 +13106,6 @@ const Cube = _a => {
12956
13106
  };
12957
13107
 
12958
13108
  const styles$5 = createStyles({
12959
- balanceText: theme => ({
12960
- color: theme.palette.secondary.dark
12961
- }),
12962
- container: theme => ({
12963
- padding: `${theme.spacing(3)}px ${theme.spacing(4)}px`
12964
- }),
12965
- getFormExtension: isCustomAmount => theme => ({
12966
- backgroundColor: theme.palette.gray.ultraLight,
12967
- display: "flex",
12968
- flexDirection: "column",
12969
- gap: theme.spacing(1),
12970
- // Negative margin is to compensate for the padding on AddFundsForm, since we want this
12971
- // section to seemlessly extend the form's well.
12972
- marginTop: theme.spacing(isCustomAmount ? -1.5 : -1),
12973
- padding: theme.spacing(2),
12974
- paddingTop: 0
12975
- }),
12976
- saveRateButton: {
12977
- whiteSpace: "nowrap"
12978
- }
12979
- });
12980
-
12981
- const styles$4 = createStyles({
12982
13109
  icon: theme => ({
12983
13110
  color: theme.palette.primary.main,
12984
13111
  marginRight: theme.spacing(2)
@@ -13023,10 +13150,10 @@ const Section = _a => {
13023
13150
  rest = __rest(_a, ["bold", "title", "children", "rightContent"]);
13024
13151
  return jsxs(Fragment, {
13025
13152
  children: [title && jsx("summary", Object.assign({
13026
- css: styles$4.summary
13153
+ css: styles$5.summary
13027
13154
  }, {
13028
13155
  children: jsxs("div", Object.assign({
13029
- css: styles$4.summaryWrapper
13156
+ css: styles$5.summaryWrapper
13030
13157
  }, {
13031
13158
  children: [jsx(Typography, Object.assign({
13032
13159
  bold: bold,
@@ -13034,19 +13161,42 @@ const Section = _a => {
13034
13161
  }, {
13035
13162
  children: title
13036
13163
  })), rightContent && jsx("div", Object.assign({
13037
- css: styles$4.rightContentWrapper
13164
+ css: styles$5.rightContentWrapper
13038
13165
  }, {
13039
13166
  children: rightContent
13040
13167
  }))]
13041
13168
  }))
13042
13169
  })), jsx("section", Object.assign({
13043
- css: styles$4.section
13170
+ css: styles$5.section
13044
13171
  }, rest, {
13045
13172
  children: children
13046
13173
  }))]
13047
13174
  });
13048
13175
  };
13049
13176
 
13177
+ const styles$4 = createStyles({
13178
+ balanceText: theme => ({
13179
+ color: theme.palette.secondary.dark
13180
+ }),
13181
+ container: theme => ({
13182
+ padding: `${theme.spacing(3)}px ${theme.spacing(4)}px`
13183
+ }),
13184
+ getFormExtension: isCustomAmount => theme => ({
13185
+ backgroundColor: theme.palette.gray.ultraLight,
13186
+ display: "flex",
13187
+ flexDirection: "column",
13188
+ gap: theme.spacing(1),
13189
+ // Negative margin is to compensate for the padding on AddFundsForm, since we want this
13190
+ // section to seemlessly extend the form's well.
13191
+ marginTop: theme.spacing(isCustomAmount ? -1.5 : -1),
13192
+ padding: theme.spacing(2),
13193
+ paddingTop: 0
13194
+ }),
13195
+ saveRateButton: {
13196
+ whiteSpace: "nowrap"
13197
+ }
13198
+ });
13199
+
13050
13200
  /**
13051
13201
  * Fund and Purchase handles the label purchase submission UX, ensuring that a user
13052
13202
  * has the necessary funds available and can add them if not. It allows a single button
@@ -13112,7 +13262,7 @@ const FundAndPurchase = ({
13112
13262
  }, {
13113
13263
  children: [jsx(Button, Object.assign({
13114
13264
  bold: false,
13115
- css: styles$5.saveRateButton,
13265
+ css: styles$4.saveRateButton,
13116
13266
  disabled: disabled || !carrierId || addFundsForm.isSubmitting || isRateFormSubmitting,
13117
13267
  isLoading: isSavingRate,
13118
13268
  onClick: handleSaveRate,
@@ -13132,7 +13282,7 @@ const FundAndPurchase = ({
13132
13282
  // render when no rate has been selected yet
13133
13283
  if (!carrierId) return jsxs("div", Object.assign({
13134
13284
  className: className,
13135
- css: styles$5.container
13285
+ css: styles$4.container
13136
13286
  }, {
13137
13287
  children: [jsxs(Spread, {
13138
13288
  children: [jsx(CarrierBalance, {
@@ -13156,7 +13306,7 @@ const FundAndPurchase = ({
13156
13306
  // show balance, but not the funding form.
13157
13307
  if (!isFundingEnabled) return jsxs("div", Object.assign({
13158
13308
  className: className,
13159
- css: styles$5.container
13309
+ css: styles$4.container
13160
13310
  }, {
13161
13311
  children: [jsx(CarrierBalance, {
13162
13312
  carrierId: carrierId
@@ -13198,13 +13348,13 @@ const FundAndPurchase = ({
13198
13348
  var _a, _b;
13199
13349
  return jsxs(Fragment, {
13200
13350
  children: [jsxs("section", Object.assign({
13201
- css: styles$5.getFormExtension(addFundsForm.isCustomAmount)
13351
+ css: styles$4.getFormExtension(addFundsForm.isCustomAmount)
13202
13352
  }, {
13203
13353
  children: [jsx(InlineLabel, Object.assign({
13204
13354
  label: t("manage-funding:fundAndPurchase.newBalance")
13205
13355
  }, {
13206
13356
  children: jsx(Typography, Object.assign({
13207
- css: styles$5.balanceText
13357
+ css: styles$4.balanceText
13208
13358
  }, {
13209
13359
  children: formatMoney({
13210
13360
  amount: balance + ((_a = addFundsForm.selectedAmount) !== null && _a !== void 0 ? _a : 0),
@@ -13215,7 +13365,7 @@ const FundAndPurchase = ({
13215
13365
  label: t("manage-funding:fundAndPurchase.finalBalance")
13216
13366
  }, {
13217
13367
  children: jsx(Typography, Object.assign({
13218
- css: styles$5.balanceText
13368
+ css: styles$4.balanceText
13219
13369
  }, {
13220
13370
  children: formatMoney({
13221
13371
  amount: balance + ((_b = addFundsForm.selectedAmount) !== null && _b !== void 0 ? _b : 0) - purchaseAmount,
@@ -13235,6 +13385,15 @@ const FundAndPurchase = ({
13235
13385
  }))]
13236
13386
  })), jsx(Spacer, {
13237
13387
  multiplier: 2
13388
+ }), addFundsForm.error && jsxs(Fragment, {
13389
+ children: [jsx(InlineNotification, Object.assign({
13390
+ title: t("manage-funding:addFunds.error.title"),
13391
+ type: NotificationType.ERROR
13392
+ }, {
13393
+ children: addFundsForm.error[0].message
13394
+ })), jsx(Spacer, {
13395
+ multiplier: 2
13396
+ })]
13238
13397
  }), renderActionButtons(addFundsForm)]
13239
13398
  });
13240
13399
  }
@@ -14295,6 +14454,7 @@ const ShipmentForm = ({
14295
14454
  const [editShipToForm, isEditShipFormToOpen, toggleIsEditShipFormToOpen] = useNestedForm(AddressForm, {
14296
14455
  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,
14297
14456
  formId: "edit-ship-to-form",
14457
+ isShipToForm: true,
14298
14458
  onSubmit: handleSubmitEditShipTo,
14299
14459
  onSubmitParse: onSubmitParseShipTo,
14300
14460
  parseAddressErrors,
@@ -14522,6 +14682,7 @@ const ShipmentForm = ({
14522
14682
  })), jsx(DropdownOptionList, Object.assign({
14523
14683
  "data-id": "dropdown",
14524
14684
  dropdownWidth: "400px",
14685
+ hideWhenReferenceNotVisible: true,
14525
14686
  isOpen: showApplyPreset,
14526
14687
  onChange: () => setShowApplyPreset(false),
14527
14688
  onClickAway: e => {
@@ -15029,6 +15190,7 @@ var index = /*#__PURE__*/Object.freeze({
15029
15190
  addCarrierSchema: addCarrierSchema,
15030
15191
  AddressDisplay: AddressDisplay,
15031
15192
  AddressForm: AddressForm,
15193
+ shipToAddressSchema: shipToAddressSchema,
15032
15194
  addressFormSchema: addressFormSchema,
15033
15195
  AddressFields: AddressFields,
15034
15196
  addressLine1Schema: addressLine1Schema,
@@ -15092,7 +15254,7 @@ const DateRangeSelect = ({
15092
15254
  "data-testid": "date-range-select",
15093
15255
  label: t("wallet-history:dateRange"),
15094
15256
  leftContent: jsx(Icon, {
15095
- name: IconNames$1.FILTER
15257
+ name: IconNames.FILTER
15096
15258
  }),
15097
15259
  name: "date-range-select",
15098
15260
  onChange: handleChange,
@@ -15407,6 +15569,7 @@ var common = {
15407
15569
  accountSettings: "Loading account settings...",
15408
15570
  carrier: "Loading carrier...",
15409
15571
  carriers: "Loading carriers...",
15572
+ connectingCarriers: "Connecting carriers...",
15410
15573
  data: "Loading...",
15411
15574
  importingSalesOrder: "Importing order...",
15412
15575
  label: "Loading label...",
@@ -15446,7 +15609,8 @@ var common = {
15446
15609
  group: {
15447
15610
  allMeasurementsOrNone: "All measurements must be provided when entering {{fieldLabel}}"
15448
15611
  },
15449
- invalidAddressName: "Recipient Name must have two characters in First and Last Name.",
15612
+ invalidAddressName: "Invalid recipient name.",
15613
+ invalidAddressNameStrict: "Recipient Name must have two characters in First and Last Name.",
15450
15614
  invalidAddressPoBox: "A physical address is required for wallet registration. You can add a PO Box as a Ship From address.",
15451
15615
  invalidCreditCardType: "Card type must be Visa, Mastercard, American Express, or Discover",
15452
15616
  invalidExpiration: "Invalid Expiration Date",
@@ -15621,18 +15785,19 @@ var onboarding$1 = {
15621
15785
  title: "Onboarding",
15622
15786
  inlineTitle: "Why are we asking?",
15623
15787
  landing: {
15624
- action: "Login",
15788
+ action: "Register",
15625
15789
  title: "Register Your Account",
15626
15790
  subtitle: "Enter your email address to start shipping with discounted carrier rates",
15627
15791
  welcome: "Welcome",
15628
- messageLine1: "Simplify your shipping workflow – no subscription required.",
15629
- messageLine2: "You can compare carrier services, ship domestic and international orders, and manage your postage payments."
15792
+ messageLine1: "Simplify your shipping workflow.",
15793
+ partnerMessageLine1: "Simplify your shipping workflow inside {{partnerName}}.",
15794
+ messageLine2: "Let’s begin your account registration so that you can compare carrier services, ship domestic and international orders, and manage your postage payments."
15630
15795
  },
15631
15796
  steps: {
15632
- login: "Login",
15797
+ register: "Register",
15633
15798
  carriers: "Carriers",
15634
15799
  addresses: "Addresses",
15635
- payment: "Payment"
15800
+ billing: "Billing"
15636
15801
  },
15637
15802
  warehouse: {
15638
15803
  title: "Ship From Address",
@@ -15762,8 +15927,8 @@ var registerWallet = {
15762
15927
  "register-wallet": {
15763
15928
  sections: {
15764
15929
  setup: {
15765
- title: "Carriers Agreement",
15766
- subtitle: "Our service is including these carriers by default",
15930
+ title: "Activate Carriers",
15931
+ subtitle: "Activate the carriers in our service by agreeing to the carriers Terms of Service",
15767
15932
  descriptionTitle: "What is a wallet?",
15768
15933
  description: "Explaining the benefits of the wallet here"
15769
15934
  },
@@ -15783,7 +15948,7 @@ var registerWallet = {
15783
15948
  },
15784
15949
  info: {
15785
15950
  title: "Why we are asking?",
15786
- description: "Your account balance handles the cost of labels, insurance and carrier adjustments."
15951
+ description: "We are offering a secure account balance to handle the cost of labels, insurance and carrier adjustments."
15787
15952
  },
15788
15953
  poBox: {
15789
15954
  title: "PO Box cannot be used for Billing",
@@ -15793,6 +15958,9 @@ var registerWallet = {
15793
15958
  title: "There was an error connecting {{carrierFriendlyName}}",
15794
15959
  confirmAddress: "Confirm your address details and try again.",
15795
15960
  description: "You can also skip this step for now and connect {{carrierFriendlyName}} in your Account Settings later."
15961
+ },
15962
+ blackBox: {
15963
+ 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."
15796
15964
  }
15797
15965
  }
15798
15966
  },
@@ -15916,7 +16084,9 @@ var accountSettings = /*#__PURE__*/Object.freeze({
15916
16084
 
15917
16085
  const Component$3 = ({
15918
16086
  features,
15919
- onCompleteOnboarding
16087
+ onboardingAddress,
16088
+ onCompleteOnboarding,
16089
+ partnerName
15920
16090
  }) => {
15921
16091
  const {
15922
16092
  t
@@ -15934,6 +16104,7 @@ const Component$3 = ({
15934
16104
  } = useListCarriers();
15935
16105
  const {
15936
16106
  error: createFundingSourceErrors,
16107
+ isLoading: creatingFundingSource,
15937
16108
  mutateAsync: createFundingSource
15938
16109
  } = useCreateFundingSource();
15939
16110
  const {
@@ -15942,7 +16113,8 @@ const Component$3 = ({
15942
16113
  } = useListFundingSources();
15943
16114
  const {
15944
16115
  error: registerCarrierErrors,
15945
- mutateAsync: registerCarrier
16116
+ mutateAsync: registerCarrier,
16117
+ isLoading: registeringCarriers
15946
16118
  } = useRegisterCarrier();
15947
16119
  const onWarehouseCreated = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
15948
16120
  yield refetchWarehouses();
@@ -15966,10 +16138,13 @@ const Component$3 = ({
15966
16138
  createWarehouse: createWarehouse,
15967
16139
  features: features,
15968
16140
  fundingSources: fundingSources,
16141
+ isRegisteringCarriers: registeringCarriers || creatingFundingSource,
16142
+ onboardingAddress: onboardingAddress,
15969
16143
  onCarrierCreated: onCarrierCreated,
15970
16144
  onCompleteOnboarding: onCompleteOnboarding,
15971
16145
  onFundingSourceCreated: onFundingSourceCreated,
15972
16146
  onWarehouseCreated: onWarehouseCreated,
16147
+ partnerName: partnerName,
15973
16148
  registerCarrier: registerCarrier,
15974
16149
  registerCarrierErrors: registerCarrierErrors,
15975
16150
  warehouses: warehouses
@@ -15980,6 +16155,8 @@ const Element$4 = alchemy.createElement(Component$3, ErrorFallback, {
15980
16155
  height: "100%",
15981
16156
  maxWidth: "800px",
15982
16157
  minWidth: "440px",
16158
+ overflow: "auto",
16159
+ scrollbarGutter: "stable both-edges",
15983
16160
  width: "100%"
15984
16161
  },
15985
16162
  resources: {
@@ -16083,7 +16260,6 @@ const useAddress = ({
16083
16260
  return parseResult;
16084
16261
  });
16085
16262
  const handleValidateAddress = useCallback((address, fallbackAddress) => __awaiter(void 0, void 0, void 0, function* () {
16086
- setAddressPreference(undefined);
16087
16263
  if (compatibleCountryCodes && !compatibleCountryCodes.includes(address.countryCode)) {
16088
16264
  resetAddressPreference({
16089
16265
  messages: [],
@@ -16097,6 +16273,7 @@ const useAddress = ({
16097
16273
  if (addressValidation) {
16098
16274
  const updatedAddressPreference = resetAddressPreference(addressValidation, fallbackAddress);
16099
16275
  yield onValidation === null || onValidation === void 0 ? void 0 : onValidation(updatedAddressPreference);
16276
+ return updatedAddressPreference;
16100
16277
  } else {
16101
16278
  // validate_and_clean failure is preventing the address preference object
16102
16279
  // from being refreshed. Manualy set the address preference to an error state.
@@ -16107,20 +16284,23 @@ const useAddress = ({
16107
16284
  originalAddress: address,
16108
16285
  status: "error"
16109
16286
  });
16287
+ return;
16110
16288
  }
16111
- }), [compatibleCountryCodes, onValidation, resetAddressPreference, validateAddresses]);
16289
+ }), [compatibleCountryCodes, onValidation, resetAddressPreference, setAddressPreference, validateAddresses]);
16112
16290
  const handleChangeAddress = useCallback((shipTo, {
16113
16291
  shouldValidate
16114
16292
  }) => __awaiter(void 0, void 0, void 0, function* () {
16293
+ var _a;
16115
16294
  if (!shipment) throw new Error("shipment not found");
16295
+ let updatedAddressPreference;
16296
+ if (shouldValidate) {
16297
+ updatedAddressPreference = yield handleValidateAddress(shipTo);
16298
+ }
16116
16299
  const updatedShipment = yield updateShipment(Object.assign(Object.assign({}, shipment), {
16117
16300
  shipDate: isNowOrInTheFuture(shipment.shipDate) ? shipment.shipDate : undefined,
16118
- shipTo
16301
+ shipTo: (_a = updatedAddressPreference === null || updatedAddressPreference === void 0 ? void 0 : updatedAddressPreference.selection) !== null && _a !== void 0 ? _a : shipTo
16119
16302
  }));
16120
16303
  yield onChange === null || onChange === void 0 ? void 0 : onChange(shipment, updatedShipment);
16121
- if (shouldValidate) {
16122
- yield handleValidateAddress(shipTo);
16123
- }
16124
16304
  return updatedShipment;
16125
16305
  }), [handleValidateAddress, onChange, shipment, updateShipment]);
16126
16306
  useEffect(() => {
@@ -17355,4 +17535,4 @@ var labelWorkflow = /*#__PURE__*/Object.freeze({
17355
17535
  Element: Element
17356
17536
  });
17357
17537
 
17358
- export { accountSettings as AccountSettings, AddFundsForm, AutoFundingForm, ButtonGroup, CarrierBalance, CollapsiblePanel, CopyButton, Country, Cube, DateRangeCombo, DateRangeSelect, ErrorFallback, fields as Field, FieldLabel, FormPortal, FundAndPurchase, InlineLabel, ItemsBreakdown, labelWorkflow as LabelWorkflow, LinkAction, listCarriers$1 as ListCarriers, Loader, ManageFunding, manageWarehouses$1 as ManageWarehouses, onboarding as Onboarding, PageLayoutProvider, PaymentMethodSettings, Portal, PoweredByShipEngine, purchaseLabel as PurchaseLabel, RootPortalProvider, Section, Spacer, Spread, StoryNotes, index as Templates, UsState, UsaCity, viewShipment as ViewShipment, voidLabel as VoidLabel, autoFundingSchema, calculateTotal, capitalizeFirstLetter, convertDimensions, convertWeight, countries, countryCodes, createCodedErrors, createDictionary, createStyles, currencySymbol, daysAfter, errorMap, euCountryCodes, extendZod, featureFlagComponentNameLookup, formLogger, formatCreditCardNumber, formatDate, formatDateDDMMYY, formatExpiration, formatFractionalWeight, formatMoney, getAddFundsSchema, getCarrierIdByCarrierCode, getCustomsFromSalesOrder, getExpirationYears, getFeatures, getIsCustomsRequiredForSalesOrder, getIsCustomsRequiredForShipment, getIsInternationalShipment, getPendingShipment, getRateRequiresAcknowledgement, getRelativeDates, getRequestedServices, getSalesOrderItemsFromSalesOrderOrShipment, getTotalRateAmount, isDomesticAddress, isEmptyAddress, isFlatRatePackageCode, isMilitaryAddress, isNowOrInTheFuture, isPoBox, isPoBoxAddress, isString, isUnitedStatesTerritory, isUnsupportedByUps, isUpsCarrier, isUspsCarrier, moneySchema, mostRecent, nextDayCutoff, omitTime, overrideCarrierCodes$1 as overrideCarrierCodes, phoneSchema, phoneSchemaUnvalidated, postalCodeRegex$3 as postalCodeRegex, sortByCreationDate, throwAny, throwJoinedMessages, usCities, usStateCodes, usStates, useAddressValidation, useCarrierMetadata, useConfirmationOptions, useCountryCodeOptions, useCustomsContentsOptions, useCustomsNonDeliveryOptions, useDateRangeOptions, useExpirationMonthOptions, useFeatures, useInsuranceProviderOptions, useNestedForm, usePackageOptions, usePageLayout, useRateOptions, useRootPortal, useRunOnceOnTrue, useServiceCodeOptions, useShipmentMetadata, useShippingPresetsOptions, useStateCodeOptions, useToggle, useWarehouseOptions, validationResolver };
17538
+ export { accountSettings as AccountSettings, AddFundsForm, AutoFundingForm, ButtonGroup, CarrierBalance, CollapsiblePanel, CopyButton, Country, Cube, DateRangeCombo, DateRangeSelect, ErrorFallback, fields as Field, FieldLabel, FormPortal, FundAndPurchase, InlineLabel, ItemsBreakdown, labelWorkflow as LabelWorkflow, LinkAction, listCarriers$1 as ListCarriers, Loader, ManageFunding, manageWarehouses$1 as ManageWarehouses, onboarding as Onboarding, PageLayoutProvider, PaymentMethodSettings, Portal, PoweredByShipEngine, purchaseLabel as PurchaseLabel, RootPortalProvider, Section, Spacer, Spread, StoryNotes, index as Templates, UsState, UsaCity, viewShipment as ViewShipment, voidLabel as VoidLabel, autoFundingSchema, calculateTotal, capitalizeFirstLetter, convertDimensions, convertWeight, countries, countryCodes, createCodedErrors, createDictionary, createStyles, currencySymbol, daysAfter, errorMap, euCountryCodes, extendZod, featureFlagComponentNameLookup, formLogger, formatCreditCardNumber, formatDate, formatDateDDMMYY, formatExpiration, formatFractionalWeight, formatMoney, getAddFundsSchema, getCarrierIdByCarrierCode, getCustomsFromSalesOrder, getExpirationYears, getFeatures, getIsCustomsRequiredForSalesOrder, getIsCustomsRequiredForShipment, getIsInternationalShipment, getPendingShipment, getRateRequiresAcknowledgement, getRelativeDates, getRequestedServices, getSalesOrderItemsFromSalesOrderOrShipment, getTotalRateAmount, isDomesticAddress, isEmptyAddress, isFlatRatePackageCode, isMilitaryAddress, isNowOrInTheFuture, isPoBox, isPoBoxAddress, isString, isUnitedStatesTerritory, isUnsupportedByUps, isUpsCarrier, isUspsCarrier, moneySchema, mostRecent, nextDayCutoff, omitTime, overrideCarrierCodes$1 as overrideCarrierCodes, phoneSchema, phoneSchemaUnvalidated, postalCodeRegex$3 as postalCodeRegex, sortByCreationDate, throwAny, throwJoinedMessages, usCities, usStateCodes, usStates, useAddressValidation, useBlackboxDetection, useCarrierMetadata, useConfirmationOptions, useCountryCodeOptions, useCustomsContentsOptions, useCustomsNonDeliveryOptions, useDateRangeOptions, useExpirationMonthOptions, useFeatures, useInsuranceProviderOptions, useNestedForm, usePackageOptions, usePageLayout, useRateOptions, useRootPortal, useRunOnceOnTrue, useServiceCodeOptions, useShipmentMetadata, useShippingPresetsOptions, useStateCodeOptions, useToggle, useWarehouseOptions, validationResolver };