@shipengine/elements 0.18.0 → 0.19.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,9 +1,9 @@
1
1
  import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
2
2
  import { useController, get as get$1, set as set$2, useWatch, useFormState, useForm } from 'react-hook-form';
3
3
  import { useTranslation, Trans, initReactI18next, I18nextProvider } from 'react-i18next';
4
- import { Typography, FormField, FieldMessageType, Input, Checkbox, Icon, Divider, Link, Select as Select$1, Next, Option, Button, Switch as Switch$1, Textarea, ButtonVariant, InlineNotification, NotificationType, ButtonColor, Grid, GridChild, Tag, TagColor, Skeleton, SkeletonAnimation, SkeletonVariant, SkeletonBackgroundColor, IconSize, Stepper, Step, Spinner, SpinnerSize, ChipList, Chip, ButtonSize, Table, TableBody, TableBaseRow, TableBodyCell, TableHeader, TableHeaderCell, useToggle as useToggle$1, Popover, DropdownOptionList, BottomSheet, GigerConfigProvider, EmotionReset, FontsLoader } from '@packlink/giger';
4
+ import { Typography, FormField, FieldMessageType, Input, Checkbox, Icon, Divider, Link, Select as Select$1, Next, Option, Button, Switch as Switch$1, Textarea, ButtonVariant, InlineNotification, NotificationType, ButtonColor, Grid, GridChild, Tag, TagColor, Skeleton, SkeletonAnimation, SkeletonVariant, SkeletonBackgroundColor, IconSize, Stepper, Step, Spinner, SpinnerSize, ChipList, Chip, ButtonSize, Table, TableBody, TableBaseRow, TableBodyCell, TableHeader, TableHeaderCell, useToggle as useToggle$1, Popover, DropdownOptionList, Pagination, BottomSheet, GigerConfigProvider, EmotionReset, FontsLoader } from '@packlink/giger';
5
5
  import axios from 'axios';
6
- import { logger, ShipEngineProvider, useValidateAddresses, useAddFunds, useGetCarrierById, useUpdateAutoFunding, useGetAutoFundingConfiguration, useListCarriers, useConnectCarrier, useListWarehouses, useUpdateWarehouse, useCreateWarehouse, useDeleteWarehouse, useUpdateSalesOrderShipment, useParseAddress, useListCustomPackageTypes, useCalculateRates, useCreateLabel, useListSalesOrderShipments, useCreateSalesOrderShipment, useGetAccountSettings, useListSalesOrders, useGetSalesOrder, useListOrderSources, useRefreshOrderSource, useGetShipment, useGetSalesOrderShipment, useListLabels, useGetLabel, useVoidLabel } from '@shipengine/react';
6
+ import { logger, ShipEngineProvider, useValidateAddresses, useAddFunds, useGetCarrierById, useUpdateAutoFunding, useGetAutoFundingConfiguration, useListCarriers, useConnectCarrier, useListWarehouses, useUpdateWarehouse, useCreateWarehouse, useDeleteWarehouse, useUpdateSalesOrderShipment, useParseAddress, useListCustomPackageTypes, useCalculateRates, useCreateLabel, useListSalesOrderShipments, useCreateSalesOrderShipment, useGetAccountSettings, useListSalesOrders, useGetSalesOrder, useListOrderSources, useRefreshOrderSource, useGetShipment, useGetSalesOrderShipment, useListLabels, useGetWalletTransactionHistory, useGetLabel, useVoidLabel } from '@shipengine/react';
7
7
  import { zodResolver } from '@hookform/resolvers/zod';
8
8
  import { z } from 'zod';
9
9
  import * as React from 'react';
@@ -23068,7 +23068,7 @@ const AddressParser = ({
23068
23068
  }));
23069
23069
  };
23070
23070
 
23071
- const styles$a = createStyles({
23071
+ const styles$b = createStyles({
23072
23072
  grow: {
23073
23073
  flexGrow: 1
23074
23074
  },
@@ -23167,13 +23167,13 @@ const AddressFields = ({
23167
23167
  },
23168
23168
  options: countryCodeOptions
23169
23169
  }), jsxs("div", Object.assign({
23170
- css: styles$a.stateZipWrapper
23170
+ css: styles$b.stateZipWrapper
23171
23171
  }, {
23172
23172
  children: [jsx("div", Object.assign({
23173
- css: styles$a.stateWrapper
23173
+ css: styles$b.stateWrapper
23174
23174
  }, {
23175
23175
  children: jsx("div", Object.assign({
23176
- css: styles$a.grow
23176
+ css: styles$b.grow
23177
23177
  }, {
23178
23178
  children: watchCountryCode === "US" ?
23179
23179
  // Domestic States
@@ -23197,10 +23197,10 @@ const AddressFields = ({
23197
23197
  })
23198
23198
  }))
23199
23199
  })), jsx("div", Object.assign({
23200
- css: styles$a.zipWrapper
23200
+ css: styles$b.zipWrapper
23201
23201
  }, {
23202
23202
  children: jsx("div", Object.assign({
23203
- css: styles$a.grow
23203
+ css: styles$b.grow
23204
23204
  }, {
23205
23205
  children: jsx(TextInput, {
23206
23206
  control: form.control,
@@ -23428,7 +23428,7 @@ const AddressForm = ({
23428
23428
  }));
23429
23429
  };
23430
23430
 
23431
- const styles$9 = createStyles({
23431
+ const styles$a = createStyles({
23432
23432
  agreement: {
23433
23433
  alignItems: "center",
23434
23434
  display: "flex",
@@ -23498,10 +23498,10 @@ const DisplayCarrierTerms = c => {
23498
23498
  const listCarrierLinks = () => {
23499
23499
  return c.carrierTerms.links.map((term, index) => {
23500
23500
  return jsx("li", Object.assign({
23501
- css: styles$9.listItems
23501
+ css: styles$a.listItems
23502
23502
  }, {
23503
23503
  children: jsx(Link, Object.assign({
23504
- css: styles$9.link,
23504
+ css: styles$a.link,
23505
23505
  href: term.url,
23506
23506
  isExternal: true,
23507
23507
  target: "_blank"
@@ -23517,18 +23517,18 @@ const DisplayCarrierTerms = c => {
23517
23517
  };
23518
23518
  const listCarrierTerms = () => {
23519
23519
  return jsxs("div", Object.assign({
23520
- css: styles$9.terms
23520
+ css: styles$a.terms
23521
23521
  }, {
23522
23522
  children: [jsx(Typography, Object.assign({
23523
23523
  variant: "subtitle1"
23524
23524
  }, {
23525
23525
  children: c.carrierTerms.title
23526
23526
  })), jsx("div", Object.assign({
23527
- css: styles$9.terms
23527
+ css: styles$a.terms
23528
23528
  }, {
23529
23529
  children: listCarrierContent()
23530
23530
  })), jsx("ul", Object.assign({
23531
- css: styles$9.links
23531
+ css: styles$a.links
23532
23532
  }, {
23533
23533
  children: listCarrierLinks()
23534
23534
  }))]
@@ -23758,7 +23758,7 @@ const AddressDisplay = ({
23758
23758
  }));
23759
23759
  };
23760
23760
 
23761
- const styles$8 = createStyles({
23761
+ const styles$9 = createStyles({
23762
23762
  container: theme => ({
23763
23763
  display: "flex",
23764
23764
  gap: theme.spacing()
@@ -23796,13 +23796,13 @@ const Disclosure = ({
23796
23796
  }, [open]);
23797
23797
  return jsxs(Fragment, {
23798
23798
  children: [jsxs("div", Object.assign({
23799
- css: styles$8.container
23799
+ css: styles$9.container
23800
23800
  }, {
23801
23801
  children: [jsx("div", {
23802
23802
  children: label
23803
23803
  }), _showToggle && jsx("button", Object.assign({
23804
23804
  "aria-expanded": isOpen,
23805
- css: styles$8.toggle,
23805
+ css: styles$9.toggle,
23806
23806
  onClick: () => {
23807
23807
  setIsOpen(!isOpen);
23808
23808
  onToggle(!isOpen);
@@ -23810,12 +23810,12 @@ const Disclosure = ({
23810
23810
  type: "button"
23811
23811
  }, {
23812
23812
  children: jsx(Icon, {
23813
- css: styles$8.icon,
23813
+ css: styles$9.icon,
23814
23814
  name: isOpen ? IconNames.CHEVRON_TOP : IconNames.CHEVRON_BOTTOM
23815
23815
  })
23816
23816
  }))]
23817
23817
  })), isOpen && jsx("div", Object.assign({
23818
- css: styles$8.content
23818
+ css: styles$9.content
23819
23819
  }, {
23820
23820
  children: typeof children === "function" ? children(() => setIsOpen(!isOpen)) : children
23821
23821
  }))]
@@ -23955,7 +23955,7 @@ const getCarrierRecoverySchema = requiresAddress => z.object({
23955
23955
  address: requiresAddress ? baseSchema : baseSchema.optional()
23956
23956
  });
23957
23957
 
23958
- const styles$7 = createStyles({
23958
+ const styles$8 = createStyles({
23959
23959
  grid: theme => ({
23960
23960
  margin: theme.spacing(4)
23961
23961
  }),
@@ -23998,7 +23998,7 @@ const CarrierRecoveryForm = ({
23998
23998
  onSubmit: formLogger.capture(handleSubmit)
23999
23999
  }, {
24000
24000
  children: jsxs(Grid, Object.assign({
24001
- css: styles$7.grid,
24001
+ css: styles$8.grid,
24002
24002
  noPadding: true
24003
24003
  }, {
24004
24004
  children: [requiresAddress && jsxs(Fragment, {
@@ -24006,14 +24006,14 @@ const CarrierRecoveryForm = ({
24006
24006
  colSpan: 12
24007
24007
  }, {
24008
24008
  children: jsx(Typography, Object.assign({
24009
- css: styles$7.heading,
24009
+ css: styles$8.heading,
24010
24010
  variant: "heading4"
24011
24011
  }, {
24012
24012
  children: t("register-wallet:sections.carriers.title")
24013
24013
  }))
24014
24014
  })), jsx(GridChild, Object.assign({
24015
24015
  colSpan: 12,
24016
- css: styles$7.subtitle
24016
+ css: styles$8.subtitle
24017
24017
  }, {
24018
24018
  children: jsx(Typography, Object.assign({
24019
24019
  variant: "subtitle1"
@@ -24099,7 +24099,7 @@ const CarrierTermsForm = ({
24099
24099
  onSubmit(payload.agreement);
24100
24100
  }));
24101
24101
  return jsxs("div", Object.assign({
24102
- css: styles$9.termsForm,
24102
+ css: styles$a.termsForm,
24103
24103
  "data-testid": "carrier-terms-form"
24104
24104
  }, {
24105
24105
  children: [jsx(Typography, Object.assign({
@@ -24115,7 +24115,7 @@ const CarrierTermsForm = ({
24115
24115
  })), jsx(Spacer, {
24116
24116
  multiplier: 1
24117
24117
  }), jsx("div", Object.assign({
24118
- css: styles$9.carrierLogos
24118
+ css: styles$a.carrierLogos
24119
24119
  }, {
24120
24120
  children: metadatas.map(({
24121
24121
  name,
@@ -24131,7 +24131,7 @@ const CarrierTermsForm = ({
24131
24131
  onSubmit: formLogger.capture(handleSubmit)
24132
24132
  }, {
24133
24133
  children: jsxs("div", Object.assign({
24134
- css: styles$9.agreement
24134
+ css: styles$a.agreement
24135
24135
  }, {
24136
24136
  children: [jsx("div", {
24137
24137
  children: jsx(CheckboxInput, {
@@ -24158,12 +24158,12 @@ const CarrierTermsForm = ({
24158
24158
  name: "agreement"
24159
24159
  })
24160
24160
  }), showTerms && jsxs("div", Object.assign({
24161
- css: styles$9.well
24161
+ css: styles$a.well
24162
24162
  }, {
24163
24163
  children: [terms.map((t, idx) => jsx(DisplayCarrierTerms, {
24164
24164
  carrierTerms: t
24165
24165
  }, idx)), jsx("div", Object.assign({
24166
- css: styles$9.close
24166
+ css: styles$a.close
24167
24167
  }, {
24168
24168
  children: jsx(Button, Object.assign({
24169
24169
  onClick: () => setShowTerms(false),
@@ -24551,7 +24551,7 @@ const LandingPageForm = ({
24551
24551
  }));
24552
24552
  };
24553
24553
 
24554
- const styles$6 = createStyles({
24554
+ const styles$7 = createStyles({
24555
24555
  container: theme => ({
24556
24556
  padding: theme.spacing(2)
24557
24557
  }),
@@ -24573,11 +24573,11 @@ const LandingPage = ({
24573
24573
  t
24574
24574
  } = useTranslation();
24575
24575
  return jsxs("div", Object.assign({
24576
- css: styles$6.container,
24576
+ css: styles$7.container,
24577
24577
  "data-testid": "landing-page"
24578
24578
  }, {
24579
24579
  children: [jsxs("div", Object.assign({
24580
- css: styles$6.header
24580
+ css: styles$7.header
24581
24581
  }, {
24582
24582
  children: [jsx(Typography, Object.assign({
24583
24583
  variant: "heading4"
@@ -24595,7 +24595,7 @@ const LandingPage = ({
24595
24595
  })), jsx(LandingPageForm, {
24596
24596
  onSubmit: onSubmit
24597
24597
  }), jsxs("div", Object.assign({
24598
- css: styles$6.header
24598
+ css: styles$7.header
24599
24599
  }, {
24600
24600
  children: [jsx(Spacer, {
24601
24601
  multiplier: 6
@@ -24606,7 +24606,7 @@ const LandingPage = ({
24606
24606
  })), jsx(Spacer, {
24607
24607
  multiplier: 2
24608
24608
  }), jsx(Typography, Object.assign({
24609
- css: styles$6.description,
24609
+ css: styles$7.description,
24610
24610
  variant: "body1"
24611
24611
  }, {
24612
24612
  children: t("onboarding:landing.description")
@@ -24790,7 +24790,7 @@ const ListCarriersRow = ({
24790
24790
  }));
24791
24791
  };
24792
24792
 
24793
- const styles$5 = createStyles({
24793
+ const styles$6 = createStyles({
24794
24794
  listContainer: theme => ({
24795
24795
  "& > li:not(:last-of-type)": {
24796
24796
  borderBottom: `1px solid ${theme.palette.gray.light}`
@@ -24837,7 +24837,7 @@ const ListCarriers$1 = ({
24837
24837
  children: t("list-carriers:headers.accountCarriers")
24838
24838
  }))
24839
24839
  }), jsx("ul", Object.assign({
24840
- css: styles$5.listContainer
24840
+ css: styles$6.listContainer
24841
24841
  }, {
24842
24842
  children: isLoading ? jsxs(Fragment, {
24843
24843
  children: [jsx(LoadingSkeletonRow, {}), jsx(LoadingSkeletonRow, {}), jsx(LoadingSkeletonRow, {})]
@@ -24858,10 +24858,10 @@ const ListCarriers$1 = ({
24858
24858
  };
24859
24859
  const LoadingSkeletonRow = () => {
24860
24860
  return jsxs("div", Object.assign({
24861
- css: styles$5.skeletonRow
24861
+ css: styles$6.skeletonRow
24862
24862
  }, {
24863
24863
  children: [jsxs("div", Object.assign({
24864
- css: styles$5.skeletonLogoContainer
24864
+ css: styles$6.skeletonLogoContainer
24865
24865
  }, {
24866
24866
  children: [jsx(Skeleton, {
24867
24867
  animation: SkeletonAnimation.WAVE,
@@ -24885,7 +24885,7 @@ const LoadingSkeletonRow = () => {
24885
24885
  }));
24886
24886
  };
24887
24887
 
24888
- const styles$4 = createStyles({
24888
+ const styles$5 = createStyles({
24889
24889
  body: theme => ({
24890
24890
  borderTop: `1px solid ${theme.palette.gray.light}`,
24891
24891
  color: theme.palette.black,
@@ -24936,14 +24936,14 @@ const SettingsCard = ({
24936
24936
  verticallyAligned
24937
24937
  }) => {
24938
24938
  return jsxs("div", Object.assign({
24939
- css: verticallyAligned ? styles$4.verticalContainer : styles$4.container,
24939
+ css: verticallyAligned ? styles$5.verticalContainer : styles$5.container,
24940
24940
  "data-testid": "settingsCard"
24941
24941
  }, {
24942
24942
  children: [jsxs("div", Object.assign({
24943
- css: styles$4.header
24943
+ css: styles$5.header
24944
24944
  }, {
24945
24945
  children: [jsxs("div", Object.assign({
24946
- css: styles$4.title
24946
+ css: styles$5.title
24947
24947
  }, {
24948
24948
  children: [typeof title === "string" ? jsx(Typography, Object.assign({
24949
24949
  variant: "subtitle2"
@@ -24978,7 +24978,7 @@ const SettingsCard = ({
24978
24978
  }))
24979
24979
  }))]
24980
24980
  })), children && jsx("div", Object.assign({
24981
- css: styles$4.body
24981
+ css: styles$5.body
24982
24982
  }, {
24983
24983
  children: jsxs("div", {
24984
24984
  children: [children, accessoryAction && jsx(ButtonGroup, Object.assign({
@@ -25055,7 +25055,9 @@ const WarehouseDisplay = ({
25055
25055
 
25056
25056
  const postalCodeRegex$1 = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
25057
25057
  const warehouseAddressSchema = addressSchema.extend({
25058
- addressResidentialIndicator: z.preprocess(v => v === "yes" ? true : false, z.boolean().default(false).transform(value => value ? "yes" : "no"))
25058
+ addressResidentialIndicator: z.preprocess(v => v === "yes" ? true : false, z.boolean().default(false).transform(value => value ? "yes" : "no")),
25059
+ companyName: z.string().trim().min(1),
25060
+ phone: z.string().trim().min(1)
25059
25061
  }).refine(schema => !schema.phone || isValidPhoneNumber(schema.phone, schema.countryCode), {
25060
25062
  message: "schemaErrors.notAValidPhoneNumber",
25061
25063
  path: ["phone"]
@@ -25136,7 +25138,8 @@ const WarehouseForm = ({
25136
25138
  nativeLabel: true
25137
25139
  }), jsx(AddressFields, {
25138
25140
  form: form,
25139
- formatFieldName: fieldName => `originAddress.${fieldName}`
25141
+ formatFieldName: fieldName => `originAddress.${fieldName}`,
25142
+ optionalFields: ["addressLine2"]
25140
25143
  }), jsx(CheckboxInput, {
25141
25144
  checkboxLabel: t("manage-warehouses:residentialAddress"),
25142
25145
  control: form.control,
@@ -25161,6 +25164,7 @@ const WarehouseForm = ({
25161
25164
  form.reset(formValues => Object.assign(Object.assign({}, formValues), {
25162
25165
  returnAddress: Object.assign(Object.assign({}, {}), {
25163
25166
  addressResidentialIndicator: false,
25167
+ companyName: "",
25164
25168
  countryCode: "US"
25165
25169
  }),
25166
25170
  returnToAddressIsDifferent: true
@@ -25172,7 +25176,8 @@ const WarehouseForm = ({
25172
25176
  }), form.watch("returnToAddressIsDifferent") && jsxs(Fragment, {
25173
25177
  children: [jsx(AddressFields, {
25174
25178
  form: form,
25175
- formatFieldName: fieldName => `returnAddress.${fieldName}`
25179
+ formatFieldName: fieldName => `returnAddress.${fieldName}`,
25180
+ optionalFields: ["addressLine2"]
25176
25181
  }), jsx(CheckboxInput, {
25177
25182
  checkboxLabel: t("manage-warehouses:residentialAddress"),
25178
25183
  control: form.control,
@@ -25457,7 +25462,7 @@ const WarehousePreferenceWizard = ({
25457
25462
  }));
25458
25463
  };
25459
25464
 
25460
- const styles$3 = createStyles({
25465
+ const styles$4 = createStyles({
25461
25466
  cardSpacing: theme => ({
25462
25467
  display: "flex",
25463
25468
  flexDirection: "column",
@@ -25490,9 +25495,9 @@ const ManageWarehouses$1 = ({
25490
25495
  const [showAddNewWarehouseForm, toggleShowAddNewWarehouseForm] = useToggle(false);
25491
25496
  return jsxs(Fragment, {
25492
25497
  children: [showAddNewWarehouseForm ? jsx(WarehousePreferenceWizard, {
25493
- css: styles$3.well,
25498
+ css: styles$4.well,
25494
25499
  formHeader: jsxs("div", Object.assign({
25495
- css: styles$3.header
25500
+ css: styles$4.header
25496
25501
  }, {
25497
25502
  children: [jsx(Typography, Object.assign({
25498
25503
  variant: "subtitle1"
@@ -25529,7 +25534,7 @@ const ManageWarehouses$1 = ({
25529
25534
  })]
25530
25535
  }))
25531
25536
  })), jsx("div", Object.assign({
25532
- css: styles$3.cardSpacing
25537
+ css: styles$4.cardSpacing
25533
25538
  }, {
25534
25539
  children: warehouses.sort((a, b) => {
25535
25540
  if (b.isDefault) return 1;
@@ -25537,9 +25542,9 @@ const ManageWarehouses$1 = ({
25537
25542
  }).map(warehouse => {
25538
25543
  if (editWarehouseId && editWarehouseId === warehouse.warehouseId) {
25539
25544
  return jsx(WarehousePreferenceWizard, {
25540
- css: styles$3.well,
25545
+ css: styles$4.well,
25541
25546
  formHeader: jsxs("div", Object.assign({
25542
- css: styles$3.header
25547
+ css: styles$4.header
25543
25548
  }, {
25544
25549
  children: [jsx(Typography, Object.assign({
25545
25550
  variant: "subtitle1"
@@ -26706,7 +26711,7 @@ const EditWalletAddressForm = ({
26706
26711
  }));
26707
26712
  };
26708
26713
 
26709
- const styles$2 = createStyles({
26714
+ const styles$3 = createStyles({
26710
26715
  grid: theme => ({
26711
26716
  margin: theme.spacing(4)
26712
26717
  }),
@@ -26758,21 +26763,21 @@ const WalletForm = ({
26758
26763
  onSubmit: formLogger.capture(handleSubmit)
26759
26764
  }, {
26760
26765
  children: jsxs(Grid, Object.assign({
26761
- css: styles$2.grid,
26766
+ css: styles$3.grid,
26762
26767
  noPadding: true
26763
26768
  }, {
26764
26769
  children: [jsx(GridChild, Object.assign({
26765
26770
  colSpan: 12
26766
26771
  }, {
26767
26772
  children: jsx(Typography, Object.assign({
26768
- css: styles$2.heading,
26773
+ css: styles$3.heading,
26769
26774
  variant: "heading4"
26770
26775
  }, {
26771
26776
  children: t("register-wallet:sections.billing.title")
26772
26777
  }))
26773
26778
  })), jsx(GridChild, Object.assign({
26774
26779
  colSpan: 12,
26775
- css: styles$2.subtitle
26780
+ css: styles$3.subtitle
26776
26781
  }, {
26777
26782
  children: jsx(Typography, Object.assign({
26778
26783
  variant: "subtitle1"
@@ -26805,7 +26810,7 @@ const WalletForm = ({
26805
26810
  colSpan: 12
26806
26811
  }, {
26807
26812
  children: jsx(Typography, Object.assign({
26808
- css: styles$2.subtitle,
26813
+ css: styles$3.subtitle,
26809
26814
  variant: "subtitle1"
26810
26815
  }, {
26811
26816
  children: t("register-wallet:sections.billing.addressSubTitle")
@@ -26861,7 +26866,7 @@ const WalletForm = ({
26861
26866
  }));
26862
26867
  };
26863
26868
 
26864
- const styles$1 = createStyles({
26869
+ const styles$2 = createStyles({
26865
26870
  step: {
26866
26871
  "& > span:last-child": {
26867
26872
  position: "static"
@@ -26879,6 +26884,9 @@ const Onboarding$1 = ({
26879
26884
  createWarehouse,
26880
26885
  onCarrierCreated,
26881
26886
  onWarehouseCreated,
26887
+ onValidateWarehouse,
26888
+ warehousePreference,
26889
+ setWarehousePreference,
26882
26890
  onCompleteOnboarding,
26883
26891
  registerDhlCarrier,
26884
26892
  registerDhlCarrierErrors,
@@ -26886,7 +26894,8 @@ const Onboarding$1 = ({
26886
26894
  registerStampsCarrierErrors,
26887
26895
  registerUpsCarrier,
26888
26896
  registerUpsCarrierErrors,
26889
- warehouses
26897
+ warehouses,
26898
+ validationErrors
26890
26899
  }) => {
26891
26900
  const {
26892
26901
  t
@@ -26939,6 +26948,7 @@ const Onboarding$1 = ({
26939
26948
  const handleCreateWarehouse = payload => __awaiter(void 0, void 0, void 0, function* () {
26940
26949
  const result = yield createWarehouse(payload);
26941
26950
  if (result) yield onWarehouseCreated();
26951
+ setHasValidAddress(true);
26942
26952
  });
26943
26953
  const handleWalletRegistration = ({
26944
26954
  address,
@@ -26984,14 +26994,34 @@ const Onboarding$1 = ({
26984
26994
  }
26985
26995
  if (agreedToTerms && !warehouses.length && !hasValidAddress) {
26986
26996
  // Step 3: Add Ship From (Warehouse) Address
26987
- return jsx(WarehouseForm, {
26997
+ return jsx(WarehousePreferenceWizard, {
26998
+ formHeader: jsxs("div", Object.assign({
26999
+ css: {
27000
+ textAlign: "center"
27001
+ }
27002
+ }, {
27003
+ children: [jsx(Typography, Object.assign({
27004
+ variant: "heading4"
27005
+ }, {
27006
+ children: t("onboarding:warehouse.title")
27007
+ })), jsx(Spacer, {
27008
+ multiplier: 2
27009
+ }), jsx(Typography, Object.assign({
27010
+ variant: "subtitle1"
27011
+ }, {
27012
+ children: t("onboarding:warehouse.subtitle")
27013
+ })), jsx(Spacer, {
27014
+ multiplier: 1
27015
+ })]
27016
+ })),
26988
27017
  isOnboarding: true,
26989
27018
  onSubmit: payload => {
26990
27019
  handleCreateWarehouse(payload);
26991
- setHasValidAddress(true);
26992
- // Step 3.1: TODO: LMNT-815 Validate Address
27020
+ setWarehousePreference(undefined);
26993
27021
  },
26994
- submitButtonTitle: t("actions.continue")
27022
+ onValidate: onValidateWarehouse,
27023
+ submitButtonTitle: t("actions.continue"),
27024
+ warehousePreference: warehousePreference
26995
27025
  });
26996
27026
  }
26997
27027
  // Step 4: Register Stamps Wallet, UPS, DHL
@@ -27031,22 +27061,22 @@ const Onboarding$1 = ({
27031
27061
  return jsx(Loader, {});
27032
27062
  };
27033
27063
  return jsxs("div", Object.assign({
27034
- css: styles$1.wrapper
27064
+ css: styles$2.wrapper
27035
27065
  }, {
27036
27066
  children: [jsxs(Stepper, Object.assign({
27037
27067
  currentStep: currentStep
27038
27068
  }, {
27039
27069
  children: [jsx(Step, {
27040
- css: styles$1.step,
27070
+ css: styles$2.step,
27041
27071
  label: t("onboarding:steps.login")
27042
27072
  }), jsx(Step, {
27043
- css: styles$1.step,
27073
+ css: styles$2.step,
27044
27074
  label: t("onboarding:steps.carriers")
27045
27075
  }), jsx(Step, {
27046
- css: styles$1.step,
27076
+ css: styles$2.step,
27047
27077
  label: t("onboarding:steps.addresses")
27048
27078
  }), jsx(Step, {
27049
- css: styles$1.step,
27079
+ css: styles$2.step,
27050
27080
  label: t("onboarding:steps.payment")
27051
27081
  })]
27052
27082
  })), renderStep()]
@@ -27666,7 +27696,7 @@ const FundAndPurchase = ({
27666
27696
  }));
27667
27697
  };
27668
27698
 
27669
- const styles = createStyles({
27699
+ const styles$1 = createStyles({
27670
27700
  fundAndPurchase: theme => ({
27671
27701
  borderTop: `1px solid ${theme.palette.gray.ultraLight}`
27672
27702
  }),
@@ -27817,7 +27847,7 @@ const RateForm = ({
27817
27847
  onClick: onSelectRate,
27818
27848
  options: showHiddenRates ? rateOptions : filteredRateOptions
27819
27849
  }), rateOptions.some(option => option.requiresAcknowledgement) && rateOptions.length > 5 && jsx(Link, Object.assign({
27820
- css: styles.showMoreOrLessRatesButton,
27850
+ css: styles$1.showMoreOrLessRatesButton,
27821
27851
  onClick: () => {
27822
27852
  var _a;
27823
27853
  setShowHiddenRates(!showHiddenRates);
@@ -27838,7 +27868,7 @@ const RateForm = ({
27838
27868
  }))
27839
27869
  }))]
27840
27870
  }) : !isLoading && errors && !!errors.length ? null : jsxs("article", Object.assign({
27841
- css: styles.ratesInterstitial,
27871
+ css: styles$1.ratesInterstitial,
27842
27872
  role: "presentation"
27843
27873
  }, {
27844
27874
  children: [jsx(Cube, {
@@ -27859,7 +27889,7 @@ const RateForm = ({
27859
27889
  })), jsx(FundAndPurchase, {
27860
27890
  carrierId: selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.carrierId,
27861
27891
  control: form.control,
27862
- css: styles.fundAndPurchase,
27892
+ css: styles$1.fundAndPurchase,
27863
27893
  disabled: disabled,
27864
27894
  isFundingEnabled: features === null || features === void 0 ? void 0 : features.enableFunding,
27865
27895
  isFundingRequired: (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.balance) !== undefined && !!selectedRate.requiresFundedAmount,
@@ -29315,6 +29345,110 @@ const SuspendShipment = ({
29315
29345
  }));
29316
29346
  };
29317
29347
 
29348
+ const styles = createStyles({
29349
+ dateRangeInput: theme => ({
29350
+ width: theme.spacing(30)
29351
+ })
29352
+ });
29353
+
29354
+ const HistoryActions = () => {
29355
+ const {
29356
+ t
29357
+ } = useTranslation();
29358
+ const selectOptions = useMemo(() => [{
29359
+ label: t("wallet-history:historyOptions.custom"),
29360
+ value: t("wallet-history:historyOptions.custom")
29361
+ }, {
29362
+ label: t("wallet-history:historyOptions.last30days"),
29363
+ value: t("wallet-history:historyOptions.last30days")
29364
+ }, {
29365
+ label: t("wallet-history:historyOptions.thisMonth"),
29366
+ value: t("wallet-history:historyOptions.thisMonth")
29367
+ }, {
29368
+ label: t("wallet-history:historyOptions.lastMonth"),
29369
+ value: t("wallet-history:historyOptions.lastMonth")
29370
+ }], [t]);
29371
+ const [selectValue, setSelectValue] = useState();
29372
+ return jsxs(Spread, {
29373
+ children: [jsx(Select$1, Object.assign({
29374
+ css: styles.dateRangeInput,
29375
+ label: "Date range",
29376
+ leftContent: jsx(Icon, {
29377
+ name: IconNames.FILTER
29378
+ }),
29379
+ name: "date-range-select",
29380
+ onChange: newValue => setSelectValue(newValue),
29381
+ onClear: c => console.log("SELECT ON CLEAR CALLBACK:", c)
29382
+ }, {
29383
+ children: selectOptions.map(item => jsx(Option, Object.assign({
29384
+ value: item.value
29385
+ }, {
29386
+ children: item.label
29387
+ }), item.value))
29388
+ })), jsx(LinkAction, {
29389
+ onClick: x => console.log("Downloaded a CSV!", x),
29390
+ title: t("wallet-history:actions.downloadCsv")
29391
+ })]
29392
+ });
29393
+ };
29394
+
29395
+ const HistoryRow = ({
29396
+ key,
29397
+ rowItem
29398
+ }) => jsx("div", {
29399
+ children: "History Row Component"
29400
+ });
29401
+
29402
+ /**
29403
+ * This component is the list of events that represent the history of a
29404
+ * specific entity. The events are displayed in reverse chronological order.
29405
+ *
29406
+ * @param historyData The history data to display.
29407
+ */
29408
+ const HistoryList = ({
29409
+ historyData
29410
+ }) => {
29411
+ console.table(historyData);
29412
+ return jsx(Fragment, {
29413
+ children: [1, 2, 3].map((item, idx) => {
29414
+ return jsx(HistoryRow, {
29415
+ rowItem: item
29416
+ }, idx);
29417
+ })
29418
+ });
29419
+ };
29420
+
29421
+ const HistoryBody = ({
29422
+ historyData
29423
+ }) => {
29424
+ const [page, setPage] = useState(1);
29425
+ return jsxs(Fragment, {
29426
+ children: [jsx(HistoryActions, {}), jsx(HistoryList, {
29427
+ historyData: historyData
29428
+ }), jsxs(Fragment, {
29429
+ children: [jsxs("p", {
29430
+ children: ["Page ", jsx("strong", {
29431
+ children: page
29432
+ }), " selected."]
29433
+ }), jsx(Pagination, {
29434
+ boundaryPagesToShow: 7,
29435
+ currentPage: page,
29436
+ onPageChange: selectedPage => setPage(selectedPage),
29437
+ siblingCount: 2,
29438
+ totalPages: 20
29439
+ })]
29440
+ })]
29441
+ });
29442
+ };
29443
+
29444
+ const WalletHistory$1 = ({
29445
+ historyData
29446
+ }) => {
29447
+ return jsx(HistoryBody, {
29448
+ historyData: historyData
29449
+ });
29450
+ };
29451
+
29318
29452
  const VoidLabel$1 = ({
29319
29453
  onComplete,
29320
29454
  onSubmit,
@@ -29456,10 +29590,11 @@ var index$1 = /*#__PURE__*/Object.freeze({
29456
29590
  schedulePickupForCarrier: schedulePickupForCarrier,
29457
29591
  Shipment: Shipment$1,
29458
29592
  SuspendShipment: SuspendShipment,
29593
+ WalletHistory: WalletHistory$1,
29459
29594
  WarehouseForm: WarehouseForm,
29460
29595
  VoidLabel: VoidLabel$1,
29461
29596
  WalletForm: WalletForm,
29462
- styles: styles$2,
29597
+ styles: styles$3,
29463
29598
  billingAddressSchema: billingAddressSchema,
29464
29599
  walletSchema: walletSchema,
29465
29600
  BillingFields: BillingFields,
@@ -31245,7 +31380,21 @@ var voidLabel = {
31245
31380
  }
31246
31381
  };
31247
31382
 
31248
- var index = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, common$1), listCarriers), manageFunding), manageWarehouses), onboarding$1), purchaseLabel), registerCarrier), registerWallet), viewShipment), voidLabel);
31383
+ var walletHistory = {
31384
+ "wallet-history": {
31385
+ actions: {
31386
+ downloadCsv: "Download a CSV"
31387
+ },
31388
+ historyOptions: {
31389
+ custom: "Custom",
31390
+ last30days: "Last 30 days",
31391
+ thisMonth: "This month",
31392
+ lastMonth: "Last month"
31393
+ }
31394
+ }
31395
+ };
31396
+
31397
+ var index = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, common$1), listCarriers), manageFunding), manageWarehouses), onboarding$1), purchaseLabel), registerCarrier), registerWallet), viewShipment), voidLabel), walletHistory);
31249
31398
 
31250
31399
  var resources = /*#__PURE__*/Object.freeze({
31251
31400
  __proto__: null,
@@ -31515,7 +31664,7 @@ const ListCarriers = () => {
31515
31664
  });
31516
31665
  };
31517
31666
 
31518
- const Element$5 = registerElement("list-carriers", ListCarriers);
31667
+ const Element$6 = registerElement("list-carriers", ListCarriers);
31519
31668
 
31520
31669
  const ManageWarehouses = ({
31521
31670
  onWarehouseAddressValidation
@@ -31594,7 +31743,7 @@ const ManageWarehouses = ({
31594
31743
  });
31595
31744
  };
31596
31745
 
31597
- const Element$4 = registerElement("manage-warehouses", ManageWarehouses);
31746
+ const Element$5 = registerElement("manage-warehouses", ManageWarehouses);
31598
31747
 
31599
31748
  const useAddress = ({
31600
31749
  compatibleCountryCodes,
@@ -32227,6 +32376,12 @@ const Onboarding = ({
32227
32376
  const onWarehouseCreated = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
32228
32377
  yield refetchWarehouses();
32229
32378
  }), [refetchWarehouses]);
32379
+ const {
32380
+ errors: validateWarehouseErrors,
32381
+ validate: validateWarehouse,
32382
+ warehousePreference,
32383
+ setWarehousePreference
32384
+ } = useWarehouseValidation();
32230
32385
  const onCarrierCreated = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
32231
32386
  yield refetchCarriers();
32232
32387
  }), [refetchCarriers]);
@@ -32237,6 +32392,7 @@ const Onboarding = ({
32237
32392
  createWarehouse: createWarehouse,
32238
32393
  onCarrierCreated: onCarrierCreated,
32239
32394
  onCompleteOnboarding: onCompleteOnboarding,
32395
+ onValidateWarehouse: validateWarehouse,
32240
32396
  onWarehouseCreated: onWarehouseCreated,
32241
32397
  registerDhlCarrier: registerDhlCarrier,
32242
32398
  registerDhlCarrierErrors: registerDhlCarrierErrors,
@@ -32244,6 +32400,9 @@ const Onboarding = ({
32244
32400
  registerStampsCarrierErrors: registerStampsCarrierErrors,
32245
32401
  registerUpsCarrier: registerUpsCarrier,
32246
32402
  registerUpsCarrierErrors: registerUpsCarrierErrors,
32403
+ setWarehousePreference: setWarehousePreference,
32404
+ validationErrors: validateWarehouseErrors,
32405
+ warehousePreference: warehousePreference,
32247
32406
  warehouses: warehouses
32248
32407
  });
32249
32408
  };
@@ -32369,7 +32528,7 @@ const useImportSalesOrder = ({
32369
32528
  error: getSalesOrderErrors,
32370
32529
  refetch: refetchSalesOrder,
32371
32530
  isFetching: isFetchingSalesOrder
32372
- } = useGetSalesOrder(salesOrderId !== null && salesOrderId !== void 0 ? salesOrderId : salesOrders === null || salesOrders === void 0 ? void 0 : salesOrders[0].salesOrderId);
32531
+ } = useGetSalesOrder(salesOrderId !== null && salesOrderId !== void 0 ? salesOrderId : salesOrders && salesOrders[0] ? salesOrders[0].salesOrderId : undefined);
32373
32532
  const {
32374
32533
  data: orderSources,
32375
32534
  error: listOrderSourcesErrors
@@ -32377,6 +32536,7 @@ const useImportSalesOrder = ({
32377
32536
  const {
32378
32537
  data: refreshedOrderSource,
32379
32538
  error: refreshOrderSourceErrors,
32539
+ isLoading: isRefreshingOrderSource,
32380
32540
  mutateAsync: refreshOrderSource
32381
32541
  } = useRefreshOrderSource();
32382
32542
  useEffect(() => {
@@ -32396,7 +32556,7 @@ const useImportSalesOrder = ({
32396
32556
  const errors = [...(listOrderSourcesErrors !== null && listOrderSourcesErrors !== void 0 ? listOrderSourcesErrors : []), ...(listSalesOrdersErrors !== null && listSalesOrdersErrors !== void 0 ? listSalesOrdersErrors : []), ...(getSalesOrderErrors !== null && getSalesOrderErrors !== void 0 ? getSalesOrderErrors : []), ...(refreshOrderSourceErrors !== null && refreshOrderSourceErrors !== void 0 ? refreshOrderSourceErrors : [])];
32397
32557
  return {
32398
32558
  errors: errors.length > 0 ? errors : undefined,
32399
- isLoading: !salesOrder && !hasRefreshedOrderSource && errors.length === 0,
32559
+ isLoading: isFetchingSalesOrder || isFetchingSalesOrders || isRefreshingOrderSource || !hasRefreshedOrderSource && !salesOrder && (salesOrders === null || salesOrders === void 0 ? void 0 : salesOrders.length) === 0 && errors.length === 0,
32400
32560
  salesOrder
32401
32561
  };
32402
32562
  };
@@ -32554,6 +32714,13 @@ const Shipment = ({
32554
32714
  });
32555
32715
  };
32556
32716
 
32717
+ const WalletHistory = () => {
32718
+ const walletHistory = useGetWalletTransactionHistory(); // Mock data for now. Real implementation coming in a subsequent PR [LMNT-842] https://auctane.atlassian.net/browse/LMNT-842
32719
+ return jsx(WalletHistory$1, {
32720
+ historyData: walletHistory
32721
+ });
32722
+ };
32723
+
32557
32724
  const VoidLabel = ({
32558
32725
  labelId,
32559
32726
  onComplete,
@@ -32582,12 +32749,14 @@ const VoidLabel = ({
32582
32749
  });
32583
32750
  };
32584
32751
 
32585
- const Element$3 = registerElement("purchase-label", PurchaseLabel);
32752
+ const Element$4 = registerElement("purchase-label", PurchaseLabel);
32753
+
32754
+ const Element$3 = registerElement("onboarding", Onboarding);
32586
32755
 
32587
- const Element$2 = registerElement("onboarding", Onboarding);
32756
+ const Element$2 = registerElement("wallet-history", WalletHistory);
32588
32757
 
32589
32758
  const Element$1 = registerElement("view-shipment", Shipment);
32590
32759
 
32591
32760
  const Element = registerElement("void-label", VoidLabel);
32592
32761
 
32593
- export { Accordion, AddFundsForm, AutoFundingForm, ButtonGroup, CarrierBalance, Country, Cube, ElementsContext, ElementsProvider, ErrorBoundary, ErrorFallback, fields as Field, FieldLabel, FormPortal, FundAndPurchase, GigerProvider, InlineLabel, ItemsBreakdown, LinkAction, Element$5 as ListCarriers, Loader, ManageFunding, Element$4 as ManageWarehouses, Element$2 as Onboarding, PageLayoutProvider, Portal, Element$3 as PurchaseLabel, RootPortalProvider, Spacer, Spread, StoryNotes, index$1 as Templates, UsState, UsaCity, Element$1 as ViewShipment, Element as VoidLabel, autoFundingSchema, calculateTotal, capitalizeFirstLetter, convertDimensions, convertWeight, countries, countryCodes, createCodedErrors, createDictionary, createStyles, currencySymbol, daysAfter, errorMap, euCountryCodes, extendZod, formLogger, formatCreditCardNumber, formatDate, formatExpiration, formatFractionalWeight, formatMoney, getAddFundsSchema, getCustomsFromSalesOrder, getExpirationYears, getIsCustomsRequiredForSalesOrder, getIsCustomsRequiredForShipment, getIsInternationalShipment, getPendingShipment, getRateRequiresAcknowledgement, getRequestedServices, getSalesOrderItemsFromSalesOrderOrShipment, getTotalRateAmount, isDomesticAddress, isFlatRatePackageCode, isMilitaryAddress, isNowOrInTheFuture, isPoBox, isPoBoxAddress, isString, isUnitedStatesTerritory, isUspsCarrier, moneySchema, mostRecent, nextDayCutoff, omitTime, phoneSchema, phoneSchemaUnvalidated, postalCodeRegex$3 as postalCodeRegex, registerElement, sortByCreationDate, usCities, usStateCodes, usStates, useCarrierMetadata, useConfirmationOptions, useCountryCodeOptions, useCustomsContentsOptions, useCustomsNonDeliveryOptions, useElements, useExpirationMonthOptions, useInsuranceProviderOptions, useNestedForm, usePackageOptions, usePageLayout, useRateOptions, useRootPortal, useRunOnceOnTrue, useServiceCodeOptions, useShippingPresetsOptions, useStateCodeOptions, useToggle, useWarehouseOptions, useWarehouseValidation, validationResolver };
32762
+ export { Accordion, AddFundsForm, AutoFundingForm, ButtonGroup, CarrierBalance, Country, Cube, ElementsContext, ElementsProvider, ErrorBoundary, ErrorFallback, fields as Field, FieldLabel, FormPortal, FundAndPurchase, GigerProvider, InlineLabel, ItemsBreakdown, LinkAction, Element$6 as ListCarriers, Loader, ManageFunding, Element$5 as ManageWarehouses, Element$3 as Onboarding, PageLayoutProvider, Portal, Element$4 as PurchaseLabel, RootPortalProvider, Spacer, Spread, StoryNotes, index$1 as Templates, UsState, UsaCity, Element$1 as ViewShipment, Element as VoidLabel, Element$2 as WalletHistory, autoFundingSchema, calculateTotal, capitalizeFirstLetter, convertDimensions, convertWeight, countries, countryCodes, createCodedErrors, createDictionary, createStyles, currencySymbol, daysAfter, errorMap, euCountryCodes, extendZod, formLogger, formatCreditCardNumber, formatDate, formatExpiration, formatFractionalWeight, formatMoney, getAddFundsSchema, getCustomsFromSalesOrder, getExpirationYears, getIsCustomsRequiredForSalesOrder, getIsCustomsRequiredForShipment, getIsInternationalShipment, getPendingShipment, getRateRequiresAcknowledgement, getRequestedServices, getSalesOrderItemsFromSalesOrderOrShipment, getTotalRateAmount, isDomesticAddress, isFlatRatePackageCode, isMilitaryAddress, isNowOrInTheFuture, isPoBox, isPoBoxAddress, isString, isUnitedStatesTerritory, isUspsCarrier, moneySchema, mostRecent, nextDayCutoff, omitTime, phoneSchema, phoneSchemaUnvalidated, postalCodeRegex$3 as postalCodeRegex, registerElement, sortByCreationDate, usCities, usStateCodes, usStates, useCarrierMetadata, useConfirmationOptions, useCountryCodeOptions, useCustomsContentsOptions, useCustomsNonDeliveryOptions, useElements, useExpirationMonthOptions, useInsuranceProviderOptions, useNestedForm, usePackageOptions, usePageLayout, useRateOptions, useRootPortal, useRunOnceOnTrue, useServiceCodeOptions, useShippingPresetsOptions, useStateCodeOptions, useToggle, useWarehouseOptions, useWarehouseValidation, validationResolver };