@shipengine/elements 0.33.0 → 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.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';
@@ -4487,10 +4487,10 @@ const useBlackboxDetection = ({
4487
4487
  }) => {
4488
4488
  useEffect(() => {
4489
4489
  // basic configurations must be on page before snare.js is loaded
4490
- global.window.io_install_stm = false; // do not install Active X
4491
- global.window.io_exclude_stm = 12; // do not run Active X
4492
- global.window.io_install_flash = false; // do not install Flash
4493
- global.window.io_enable_rip = true; // collect Real IP information
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
4494
  const pollBlackBox = () => {
4495
4495
  try {
4496
4496
  if (typeof ioGetBlackbox !== "function") {
@@ -4509,7 +4509,7 @@ const useBlackboxDetection = ({
4509
4509
  };
4510
4510
  const intervalId = setInterval(pollBlackBox, 500);
4511
4511
  // attach script to DOM
4512
- const script = global.document.createElement("script");
4512
+ const script = document.createElement("script");
4513
4513
  script.type = "text/javascript";
4514
4514
  script.async = true;
4515
4515
  script.src = "https://mpsnare.iesnare.com/snare.js";
@@ -4518,16 +4518,16 @@ const useBlackboxDetection = ({
4518
4518
  onError();
4519
4519
  }
4520
4520
  });
4521
- global.document.head.appendChild(script);
4521
+ document.head.appendChild(script);
4522
4522
  return () => {
4523
4523
  if (intervalId) {
4524
4524
  clearTimeout(intervalId);
4525
4525
  }
4526
- delete global.window.io_install_stm;
4527
- delete global.window.io_exclude_stm;
4528
- delete global.window.io_install_flash;
4529
- delete global.window.io_enable_rip;
4530
- global.document.head.removeChild(script);
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
4531
  };
4532
4532
  }, [onSuccess, onError]);
4533
4533
  };
@@ -7423,6 +7423,7 @@ const getWrapperStyles = theme => /*#__PURE__*/css$1(process.env.NODE_ENV === "p
7423
7423
 
7424
7424
  const DatePickerController = createFieldController();
7425
7425
  const DatePicker = fieldProps => {
7426
+ const alchemy = useContext(AlchemyContext);
7426
7427
  const theme = useTheme();
7427
7428
  const datePickerRef = useRef(null);
7428
7429
  return jsx(DatePickerController, Object.assign({}, fieldProps, {
@@ -7443,7 +7444,7 @@ const DatePicker = fieldProps => {
7443
7444
  css: getOverrideStyles(theme)
7444
7445
  }, {
7445
7446
  children: jsx(ReactDatePicker, Object.assign({
7446
- locale: LOCALE
7447
+ locale: alchemy === null || alchemy === void 0 ? void 0 : alchemy.locale
7447
7448
  }, datePickerProps, {
7448
7449
  customInput: /*#__PURE__*/createElement$2( /*#__PURE__*/forwardRef(function InputWrapper(_a, forwardedRef) {
7449
7450
  var _b;
@@ -8814,16 +8815,8 @@ const AddFundsForm = ({
8814
8815
  }))]
8815
8816
  }))]
8816
8817
  })]
8817
- })), addFunds.error && jsxs(Fragment, {
8818
- children: [jsx(Spacer, {
8819
- multiplier: 1
8820
- }), jsx(InlineNotification, Object.assign({
8821
- title: t("manage-funding:addFunds.error.title"),
8822
- type: NotificationType.ERROR
8823
- }, {
8824
- children: addFunds.error[0].message
8825
- }))]
8826
- }), children === null || children === void 0 ? void 0 : children({
8818
+ })), children === null || children === void 0 ? void 0 : children({
8819
+ error: addFunds.error,
8827
8820
  isCustomAmount: selectedChip.value === "custom",
8828
8821
  isSubmitted,
8829
8822
  isSubmitting,
@@ -9165,6 +9158,12 @@ const AddressParser = ({
9165
9158
  const payload = values;
9166
9159
  onSubmit(payload);
9167
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
+ });
9168
9167
  const errors = (parseErrors === null || parseErrors === void 0 ? void 0 : parseErrors.length) ? [t("errorMessages.parsingFailure")] : undefined;
9169
9168
  const formInterface = jsxs(Fragment, {
9170
9169
  children: [jsx(TextArea, {
@@ -9782,29 +9781,23 @@ const AddressPreferenceSelect = ({
9782
9781
  case "ERROR":
9783
9782
  return jsxs(Fragment, {
9784
9783
  children: [jsx(Spacer, {
9785
- multiplier: 1
9784
+ multiplier: 2
9786
9785
  }), jsx(GridChild, Object.assign({
9787
- colSpan: 8,
9788
- css: theme => ({
9789
- paddingLeft: theme.spacing(1)
9790
- })
9786
+ colSpan: 8
9791
9787
  }, {
9792
9788
  children: jsx(InlineNotification, Object.assign({
9789
+ title: t("address.preference.addressNotValidated"),
9793
9790
  type: NotificationType.ALERT
9794
9791
  }, {
9795
9792
  children: t("address.preference.unableToValidate")
9796
9793
  }))
9797
9794
  })), jsx(Spacer, {
9798
- multiplier: 1
9799
- }), jsx(GridChild, Object.assign({
9800
- css: theme => ({
9801
- paddingLeft: theme.spacing(1)
9802
- })
9803
- }, {
9795
+ multiplier: 2
9796
+ }), jsx(GridChild, {
9804
9797
  children: jsx(AddressDisplay, {
9805
9798
  address: (_b = warehousePreference.validation) === null || _b === void 0 ? void 0 : _b.originalAddress
9806
9799
  })
9807
- }))]
9800
+ })]
9808
9801
  });
9809
9802
  default:
9810
9803
  // This code path should never be reached.
@@ -9827,7 +9820,7 @@ const AddressPreferenceSelect = ({
9827
9820
  children: t("common:address.preference.title")
9828
9821
  }))
9829
9822
  })), jsxs(GridChild, Object.assign({
9830
- colSpan: 8
9823
+ colSpan: 12
9831
9824
  }, {
9832
9825
  children: [jsx(Typography, Object.assign({
9833
9826
  css: {
@@ -10199,10 +10192,7 @@ const WalletForm = ({
10199
10192
  return [...(errors !== null && errors !== void 0 ? errors : []), blackBoxError];
10200
10193
  });
10201
10194
  },
10202
- onSuccess: bb => {
10203
- console.log("bb", bb);
10204
- form.setValue("iovationBlackbox", bb);
10205
- }
10195
+ onSuccess: bb => form.setValue("iovationBlackbox", bb)
10206
10196
  });
10207
10197
  const watchAddress = form.watch("address");
10208
10198
  const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
@@ -10892,7 +10882,8 @@ const styles$e = createStyles({
10892
10882
  display: "flex",
10893
10883
  flexDirection: "column",
10894
10884
  paddingBottom: theme.spacing(8),
10895
- paddingTop: theme.spacing(2)
10885
+ paddingTop: theme.spacing(2),
10886
+ textAlign: "center"
10896
10887
  }),
10897
10888
  termsLink: theme => ({
10898
10889
  alignItems: "center",
@@ -11954,7 +11945,8 @@ const styles$a = createStyles({
11954
11945
  });
11955
11946
 
11956
11947
  const LandingPage = ({
11957
- onSubmit
11948
+ onSubmit,
11949
+ partnerName
11958
11950
  }) => {
11959
11951
  const {
11960
11952
  t
@@ -11996,7 +11988,9 @@ const LandingPage = ({
11996
11988
  css: styles$a.description,
11997
11989
  variant: "body1"
11998
11990
  }, {
11999
- children: t("onboarding:landing.messageLine1")
11991
+ children: partnerName ? t("onboarding:landing.partnerMessageLine1", {
11992
+ partnerName: partnerName
11993
+ }) : t("onboarding:landing.messageLine1")
12000
11994
  })), jsx(Spacer, {
12001
11995
  multiplier: 2
12002
11996
  }), jsx(Typography, Object.assign({
@@ -12450,7 +12444,7 @@ const WarehouseForm = ({
12450
12444
  control: form.control,
12451
12445
  "data-testid": "warehouseFormSubmitButton",
12452
12446
  form: "warehouse-form",
12453
- requireDirty: true,
12447
+ requireDirty: !warehouse,
12454
12448
  variant: _isOnboarding ? ButtonVariant.FILLED : ButtonVariant.OUTLINED
12455
12449
  }, {
12456
12450
  children: submitButtonTitle
@@ -12667,11 +12661,21 @@ const styles$6 = createStyles({
12667
12661
  container: theme => ({
12668
12662
  padding: theme.spacing(2)
12669
12663
  }),
12664
+ iconTooltip: theme => ({
12665
+ color: theme.palette.secondary.main,
12666
+ display: "inline-block",
12667
+ marginLeft: theme.spacing(1),
12668
+ verticalAlign: "middle"
12669
+ }),
12670
12670
  step: {
12671
12671
  "& > span:last-child": {
12672
12672
  position: "static"
12673
12673
  }
12674
12674
  },
12675
+ tooltipContainer: () => ({
12676
+ maxWidth: "260px",
12677
+ textAlign: "left"
12678
+ }),
12675
12679
  walletFormHeader: theme => ({
12676
12680
  margin: theme.spacing(4)
12677
12681
  }),
@@ -12687,18 +12691,20 @@ const styles$6 = createStyles({
12687
12691
 
12688
12692
  const Onboarding = ({
12689
12693
  connectedCarriers,
12694
+ createFundingSource,
12695
+ createFundingSourceErrors,
12690
12696
  createWarehouse,
12691
12697
  features,
12692
12698
  fundingSources,
12693
12699
  isRegisteringCarriers,
12700
+ onboardingAddress,
12694
12701
  onCarrierCreated,
12695
12702
  onCompleteOnboarding,
12696
12703
  onFundingSourceCreated,
12697
12704
  onWarehouseCreated,
12705
+ partnerName,
12698
12706
  registerCarrier,
12699
12707
  registerCarrierErrors,
12700
- createFundingSource,
12701
- createFundingSourceErrors,
12702
12708
  warehouses
12703
12709
  }) => {
12704
12710
  var _a, _b, _c;
@@ -12732,6 +12738,7 @@ const Onboarding = ({
12732
12738
  const hasDhl = connectedCarriers === null || connectedCarriers === void 0 ? void 0 : connectedCarriers.some(c => c.carrierCode === "dhl_express_worldwide");
12733
12739
  const fundingSourceId = (fundingSources === null || fundingSources === void 0 ? void 0 : fundingSources.length) ? fundingSources[0].fundingSourceId : undefined;
12734
12740
  const hasCompletedOnboarding = onboardingComplete || warehouses.length && hasStampsWallet && (hasUps || !upsEnabled) && hasDhl;
12741
+ const containerRef = useRef(null);
12735
12742
  const currentStep = useMemo(() => {
12736
12743
  if (hasCompletedOnboarding) {
12737
12744
  return 5;
@@ -12844,7 +12851,8 @@ const Onboarding = ({
12844
12851
  }
12845
12852
  // Step 1: Landing Page
12846
12853
  if (!email) return jsx(LandingPage, {
12847
- onSubmit: e => setEmail(e)
12854
+ onSubmit: e => setEmail(e),
12855
+ partnerName: partnerName
12848
12856
  });
12849
12857
  // Step 2: Agree to Terms and Conditions
12850
12858
  if (!agreedToTerms) {
@@ -12893,7 +12901,8 @@ const Onboarding = ({
12893
12901
  onSubmit: payload => __awaiter(void 0, void 0, void 0, function* () {
12894
12902
  return handleCreateWarehouse(payload);
12895
12903
  }),
12896
- submitButtonTitle: t("actions.continue")
12904
+ submitButtonTitle: t("actions.continue"),
12905
+ warehouse: onboardingAddress
12897
12906
  })
12898
12907
  }));
12899
12908
  }
@@ -12916,21 +12925,39 @@ const Onboarding = ({
12916
12925
  variant: "subtitle1"
12917
12926
  }, {
12918
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
+ }))
12919
12951
  }))]
12920
12952
  })), jsx(Spacer, {
12921
12953
  multiplier: 1
12922
- }), (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({
12923
12955
  title: t("register-wallet:sections.notifications.error.title"),
12924
12956
  type: NotificationType.ERROR
12925
12957
  }, {
12926
12958
  children: createFundingSourceErrors.map(({
12927
12959
  message
12928
12960
  }) => message).join(" ")
12929
- })) : jsx(InlineNotification, Object.assign({
12930
- title: t("register-wallet:sections.notifications.info.title"),
12931
- type: NotificationType.INFO
12932
- }, {
12933
- children: t("register-wallet:sections.notifications.info.description")
12934
12961
  }))]
12935
12962
  })),
12936
12963
  onSubmit: payload => __awaiter(void 0, void 0, void 0, function* () {
@@ -12988,14 +13015,15 @@ const Onboarding = ({
12988
13015
  });
12989
13016
  };
12990
13017
  return jsxs("div", Object.assign({
12991
- css: styles$6.container
13018
+ css: styles$6.container,
13019
+ ref: containerRef
12992
13020
  }, {
12993
13021
  children: [jsxs(Stepper, Object.assign({
12994
13022
  currentStep: currentStep
12995
13023
  }, {
12996
13024
  children: [jsx(Step, {
12997
13025
  css: styles$6.step,
12998
- label: t("onboarding:steps.login")
13026
+ label: t("onboarding:steps.register")
12999
13027
  }), jsx(Step, {
13000
13028
  css: styles$6.step,
13001
13029
  label: t("onboarding:steps.carriers")
@@ -13004,7 +13032,7 @@ const Onboarding = ({
13004
13032
  label: t("onboarding:steps.addresses")
13005
13033
  }), jsx(Step, {
13006
13034
  css: styles$6.step,
13007
- label: t("onboarding:steps.payment")
13035
+ label: t("onboarding:steps.billing")
13008
13036
  })]
13009
13037
  })), renderStep(), ((_c = features === null || features === void 0 ? void 0 : features.presentation) === null || _c === void 0 ? void 0 : _c.poweredByShipEngine) && jsxs(Fragment, {
13010
13038
  children: [jsx(Spacer, {}), jsx(PoweredByShipEngine, {})]
@@ -13078,29 +13106,6 @@ const Cube = _a => {
13078
13106
  };
13079
13107
 
13080
13108
  const styles$5 = createStyles({
13081
- balanceText: theme => ({
13082
- color: theme.palette.secondary.dark
13083
- }),
13084
- container: theme => ({
13085
- padding: `${theme.spacing(3)}px ${theme.spacing(4)}px`
13086
- }),
13087
- getFormExtension: isCustomAmount => theme => ({
13088
- backgroundColor: theme.palette.gray.ultraLight,
13089
- display: "flex",
13090
- flexDirection: "column",
13091
- gap: theme.spacing(1),
13092
- // Negative margin is to compensate for the padding on AddFundsForm, since we want this
13093
- // section to seemlessly extend the form's well.
13094
- marginTop: theme.spacing(isCustomAmount ? -1.5 : -1),
13095
- padding: theme.spacing(2),
13096
- paddingTop: 0
13097
- }),
13098
- saveRateButton: {
13099
- whiteSpace: "nowrap"
13100
- }
13101
- });
13102
-
13103
- const styles$4 = createStyles({
13104
13109
  icon: theme => ({
13105
13110
  color: theme.palette.primary.main,
13106
13111
  marginRight: theme.spacing(2)
@@ -13145,10 +13150,10 @@ const Section = _a => {
13145
13150
  rest = __rest(_a, ["bold", "title", "children", "rightContent"]);
13146
13151
  return jsxs(Fragment, {
13147
13152
  children: [title && jsx("summary", Object.assign({
13148
- css: styles$4.summary
13153
+ css: styles$5.summary
13149
13154
  }, {
13150
13155
  children: jsxs("div", Object.assign({
13151
- css: styles$4.summaryWrapper
13156
+ css: styles$5.summaryWrapper
13152
13157
  }, {
13153
13158
  children: [jsx(Typography, Object.assign({
13154
13159
  bold: bold,
@@ -13156,19 +13161,42 @@ const Section = _a => {
13156
13161
  }, {
13157
13162
  children: title
13158
13163
  })), rightContent && jsx("div", Object.assign({
13159
- css: styles$4.rightContentWrapper
13164
+ css: styles$5.rightContentWrapper
13160
13165
  }, {
13161
13166
  children: rightContent
13162
13167
  }))]
13163
13168
  }))
13164
13169
  })), jsx("section", Object.assign({
13165
- css: styles$4.section
13170
+ css: styles$5.section
13166
13171
  }, rest, {
13167
13172
  children: children
13168
13173
  }))]
13169
13174
  });
13170
13175
  };
13171
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
+
13172
13200
  /**
13173
13201
  * Fund and Purchase handles the label purchase submission UX, ensuring that a user
13174
13202
  * has the necessary funds available and can add them if not. It allows a single button
@@ -13234,7 +13262,7 @@ const FundAndPurchase = ({
13234
13262
  }, {
13235
13263
  children: [jsx(Button, Object.assign({
13236
13264
  bold: false,
13237
- css: styles$5.saveRateButton,
13265
+ css: styles$4.saveRateButton,
13238
13266
  disabled: disabled || !carrierId || addFundsForm.isSubmitting || isRateFormSubmitting,
13239
13267
  isLoading: isSavingRate,
13240
13268
  onClick: handleSaveRate,
@@ -13254,7 +13282,7 @@ const FundAndPurchase = ({
13254
13282
  // render when no rate has been selected yet
13255
13283
  if (!carrierId) return jsxs("div", Object.assign({
13256
13284
  className: className,
13257
- css: styles$5.container
13285
+ css: styles$4.container
13258
13286
  }, {
13259
13287
  children: [jsxs(Spread, {
13260
13288
  children: [jsx(CarrierBalance, {
@@ -13278,7 +13306,7 @@ const FundAndPurchase = ({
13278
13306
  // show balance, but not the funding form.
13279
13307
  if (!isFundingEnabled) return jsxs("div", Object.assign({
13280
13308
  className: className,
13281
- css: styles$5.container
13309
+ css: styles$4.container
13282
13310
  }, {
13283
13311
  children: [jsx(CarrierBalance, {
13284
13312
  carrierId: carrierId
@@ -13320,13 +13348,13 @@ const FundAndPurchase = ({
13320
13348
  var _a, _b;
13321
13349
  return jsxs(Fragment, {
13322
13350
  children: [jsxs("section", Object.assign({
13323
- css: styles$5.getFormExtension(addFundsForm.isCustomAmount)
13351
+ css: styles$4.getFormExtension(addFundsForm.isCustomAmount)
13324
13352
  }, {
13325
13353
  children: [jsx(InlineLabel, Object.assign({
13326
13354
  label: t("manage-funding:fundAndPurchase.newBalance")
13327
13355
  }, {
13328
13356
  children: jsx(Typography, Object.assign({
13329
- css: styles$5.balanceText
13357
+ css: styles$4.balanceText
13330
13358
  }, {
13331
13359
  children: formatMoney({
13332
13360
  amount: balance + ((_a = addFundsForm.selectedAmount) !== null && _a !== void 0 ? _a : 0),
@@ -13337,7 +13365,7 @@ const FundAndPurchase = ({
13337
13365
  label: t("manage-funding:fundAndPurchase.finalBalance")
13338
13366
  }, {
13339
13367
  children: jsx(Typography, Object.assign({
13340
- css: styles$5.balanceText
13368
+ css: styles$4.balanceText
13341
13369
  }, {
13342
13370
  children: formatMoney({
13343
13371
  amount: balance + ((_b = addFundsForm.selectedAmount) !== null && _b !== void 0 ? _b : 0) - purchaseAmount,
@@ -13357,6 +13385,15 @@ const FundAndPurchase = ({
13357
13385
  }))]
13358
13386
  })), jsx(Spacer, {
13359
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
+ })]
13360
13397
  }), renderActionButtons(addFundsForm)]
13361
13398
  });
13362
13399
  }
@@ -15748,18 +15785,19 @@ var onboarding$1 = {
15748
15785
  title: "Onboarding",
15749
15786
  inlineTitle: "Why are we asking?",
15750
15787
  landing: {
15751
- action: "Login",
15788
+ action: "Register",
15752
15789
  title: "Register Your Account",
15753
15790
  subtitle: "Enter your email address to start shipping with discounted carrier rates",
15754
15791
  welcome: "Welcome",
15755
- messageLine1: "Simplify your shipping workflow – no subscription required.",
15756
- 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."
15757
15795
  },
15758
15796
  steps: {
15759
- login: "Login",
15797
+ register: "Register",
15760
15798
  carriers: "Carriers",
15761
15799
  addresses: "Addresses",
15762
- payment: "Payment"
15800
+ billing: "Billing"
15763
15801
  },
15764
15802
  warehouse: {
15765
15803
  title: "Ship From Address",
@@ -15889,8 +15927,8 @@ var registerWallet = {
15889
15927
  "register-wallet": {
15890
15928
  sections: {
15891
15929
  setup: {
15892
- title: "Carriers Agreement",
15893
- 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",
15894
15932
  descriptionTitle: "What is a wallet?",
15895
15933
  description: "Explaining the benefits of the wallet here"
15896
15934
  },
@@ -15910,7 +15948,7 @@ var registerWallet = {
15910
15948
  },
15911
15949
  info: {
15912
15950
  title: "Why we are asking?",
15913
- 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."
15914
15952
  },
15915
15953
  poBox: {
15916
15954
  title: "PO Box cannot be used for Billing",
@@ -16046,7 +16084,9 @@ var accountSettings = /*#__PURE__*/Object.freeze({
16046
16084
 
16047
16085
  const Component$3 = ({
16048
16086
  features,
16049
- onCompleteOnboarding
16087
+ onboardingAddress,
16088
+ onCompleteOnboarding,
16089
+ partnerName
16050
16090
  }) => {
16051
16091
  const {
16052
16092
  t
@@ -16099,10 +16139,12 @@ const Component$3 = ({
16099
16139
  features: features,
16100
16140
  fundingSources: fundingSources,
16101
16141
  isRegisteringCarriers: registeringCarriers || creatingFundingSource,
16142
+ onboardingAddress: onboardingAddress,
16102
16143
  onCarrierCreated: onCarrierCreated,
16103
16144
  onCompleteOnboarding: onCompleteOnboarding,
16104
16145
  onFundingSourceCreated: onFundingSourceCreated,
16105
16146
  onWarehouseCreated: onWarehouseCreated,
16147
+ partnerName: partnerName,
16106
16148
  registerCarrier: registerCarrier,
16107
16149
  registerCarrierErrors: registerCarrierErrors,
16108
16150
  warehouses: warehouses
@@ -16113,6 +16155,8 @@ const Element$4 = alchemy.createElement(Component$3, ErrorFallback, {
16113
16155
  height: "100%",
16114
16156
  maxWidth: "800px",
16115
16157
  minWidth: "440px",
16158
+ overflow: "auto",
16159
+ scrollbarGutter: "stable both-edges",
16116
16160
  width: "100%"
16117
16161
  },
16118
16162
  resources: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/elements",
3
- "version": "0.33.0",
3
+ "version": "0.34.0",
4
4
  "peerDependencies": {
5
5
  "@packlink/giger": "*",
6
6
  "react-i18next": "*",
@@ -1,5 +1,7 @@
1
1
  /// <reference types="react" />
2
+ import { SE } from "@shipengine/alchemy";
2
3
  export type AddFundsFormProvider = {
4
+ error?: SE.CodedError[] | null;
3
5
  isCustomAmount?: boolean;
4
6
  isSubmitted?: boolean;
5
7
  isSubmitting?: boolean;
@@ -47,6 +47,7 @@ export declare const styles: {
47
47
  flexDirection: "column";
48
48
  paddingBottom: number;
49
49
  paddingTop: number;
50
+ textAlign: "center";
50
51
  };
51
52
  termsLink: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
52
53
  alignItems: "center";
@@ -1,4 +1,5 @@
1
1
  export type LandingPageProps = {
2
2
  onSubmit: (payload: string) => void;
3
+ partnerName?: string;
3
4
  };
4
- export declare const LandingPage: ({ onSubmit }: LandingPageProps) => import("@emotion/react/jsx-runtime").JSX.Element;
5
+ export declare const LandingPage: ({ onSubmit, partnerName }: LandingPageProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -30,12 +30,14 @@ export type OnboardingProps = {
30
30
  features?: OnboardingFeatures;
31
31
  fundingSources?: SE.FundingSource[];
32
32
  isRegisteringCarriers?: boolean;
33
+ onboardingAddress?: Pick<SE.Warehouse, "name" | "isDefault" | "originAddress" | "returnAddress">;
33
34
  onCarrierCreated: () => Promise<void>;
34
35
  onCompleteOnboarding: () => void;
35
36
  onFundingSourceCreated: () => Promise<void>;
36
37
  onWarehouseCreated: () => Promise<void>;
38
+ partnerName?: string;
37
39
  registerCarrier: (payload: SE.CarrierRegistration) => Promise<SE.CarrierRegistrationResponse>;
38
40
  registerCarrierErrors: SE.CodedError[] | null;
39
41
  warehouses: SE.Warehouse[];
40
42
  };
41
- export declare const Onboarding: ({ connectedCarriers, createWarehouse, features, fundingSources, isRegisteringCarriers, onCarrierCreated, onCompleteOnboarding, onFundingSourceCreated, onWarehouseCreated, registerCarrier, registerCarrierErrors, createFundingSource, createFundingSourceErrors, warehouses, }: OnboardingProps) => import("@emotion/react/jsx-runtime").JSX.Element;
43
+ export declare const Onboarding: ({ connectedCarriers, createFundingSource, createFundingSourceErrors, createWarehouse, features, fundingSources, isRegisteringCarriers, onboardingAddress, onCarrierCreated, onCompleteOnboarding, onFundingSourceCreated, onWarehouseCreated, partnerName, registerCarrier, registerCarrierErrors, warehouses, }: OnboardingProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -2,11 +2,21 @@ export declare const styles: {
2
2
  container: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
3
3
  padding: number;
4
4
  };
5
+ iconTooltip: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
6
+ color: string;
7
+ display: "inline-block";
8
+ marginLeft: number;
9
+ verticalAlign: string;
10
+ };
5
11
  step: {
6
12
  "& > span:last-child": {
7
13
  position: "static";
8
14
  };
9
15
  };
16
+ tooltipContainer: () => {
17
+ maxWidth: string;
18
+ textAlign: "left";
19
+ };
10
20
  walletFormHeader: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
11
21
  margin: number;
12
22
  };
@@ -6,6 +6,6 @@ export type WarehouseFormProps = {
6
6
  onDelete?: () => void;
7
7
  onSubmit: (payload: WarehousePayload) => void;
8
8
  submitButtonTitle: string;
9
- warehouse?: SE.Warehouse;
9
+ warehouse?: SE.Warehouse | Pick<SE.Warehouse, "name" | "isDefault" | "originAddress" | "returnAddress">;
10
10
  };
11
11
  export declare const WarehouseForm: ({ isOnboarding, onCancel, onDelete, onSubmit, submitButtonTitle, warehouse, }: WarehouseFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -231,13 +231,14 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
231
231
  subtitle: string;
232
232
  welcome: string;
233
233
  messageLine1: string;
234
+ partnerMessageLine1: string;
234
235
  messageLine2: string;
235
236
  };
236
237
  steps: {
237
- login: string;
238
+ register: string;
238
239
  carriers: string;
239
240
  addresses: string;
240
- payment: string;
241
+ billing: string;
241
242
  };
242
243
  warehouse: {
243
244
  title: string;