@shipengine/elements 1.4.0 → 1.5.1

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
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import { useEffect, useRef, createElement as createElement$2, forwardRef, useCallback, useReducer, useMemo, useState, createContext, useContext, memo, useLayoutEffect, Fragment as Fragment$1 } from 'react';
4
4
  import { useController, get as get$2, set as set$2, useWatch, useFormState, useForm } from 'react-hook-form';
5
5
  import { useTranslation, Trans } from 'react-i18next';
6
- import alchemy, { logger, SE, useAlchemy, useListServicePoints, useValidateAddresses, useAddFunds, useGetCarrierById, useUpdateAutoFunding, useGetAutoFundingConfiguration, useUpdateFundingSource, useListFundingSources, useConnectCarrierAccount, useGetCarrierConnectionForm, useListCarrierConnections, useListCarriers, useConnectCarrier, useListWarehouses, useUpdateWarehouse, useCreateWarehouse, useDeleteWarehouse, useGetFundingSourceTransactions, useListSalesOrderShipments, useGetAccountSettings, useUpdateAccountSettings, useUpdateSalesOrderShipment, useParseAddress, useListCustomPackageTypes, useCalculateRates, useGetShipmentRates, useListLabels, useCreateLabel, useCreateSalesOrderShipment, CodedError, useListSalesOrders, useGetSalesOrder, useListOrderSources, useRefreshOrderSource, useGetInsuranceAccount, useCreateShipment, useGetShipment, useGetSalesOrderShipment, useGetLabel, useVoidLabel, useCreateFundingSource, useRegisterCarrier, useGetFundingSourceMetadata } from '@shipengine/alchemy';
6
+ import alchemy, { logger, SE, useAlchemy, useListServicePoints, useValidateAddresses, useAddFunds, useGetCarrierById, useUpdateAutoFunding, useGetAutoFundingConfiguration, useUpdateFundingSource, useListFundingSources, useConnectCarrierAccount, useGetCarrierConnectionForm, useListCarrierConnections, useListCarriers, useConnectCarrier, useListWarehouses, useUpdateWarehouse, useCreateWarehouse, useDeleteWarehouse, useGetFundingSourceTransactions, useListSalesOrderShipments, useGetAccountSettings, useUpdateAccountSettings, useUpdateSalesOrderShipment, useParseAddress, useListCustomPackageTypes, useCalculateRates, useGetShipmentRates, useListLabels, useCreateLabel, useCreateSalesOrderShipment, CodedError, useListSalesOrders, useGetSalesOrder, useListOrderSources, useRefreshOrderSource, useGetInsuranceAccount, useCreateShipment, useGetShipment, useGetSalesOrderShipment, useGetLabel, useVoidLabel, useListShipments, useCreateFundingSource, useRegisterCarrier, useGetFundingSourceMetadata } from '@shipengine/alchemy';
7
7
  import { Typography, IconTooltip, IconSize, FormField, FieldMessageType, Checkbox, Input, Icon, InlineNotification, NotificationType, Tag, TagColor, TagVariant, Divider, Button, ButtonVariant, Skeleton, SkeletonAnimation, SkeletonBackgroundColor, SkeletonVariant, Link, SelectAutocomplete, Select as Select$1, OptionGroup, Option, Switch as Switch$1, Textarea, Spinner, SpinnerSize, ChipList, Chip, ButtonSize, DatePicker as DatePicker$1, Table, TableFooter, TableHeader, TableHeaderRow, TableHeaderCell, TableBody, TableRow, TableBodyCell, TableBaseRow, DropdownOptionList, Pagination, Grid, GridChild, RadioGroup, Radio, ButtonColor, Dialog, DialogHeader, ButtonIcon, DialogContent, Popover, BottomSheet, Stepper, Step } from '@shipengine/giger';
8
8
  import { format, parse } from 'date-fns';
9
9
  import * as Locales from 'date-fns/locale';
@@ -2802,6 +2802,11 @@ const featureFlags = {
2802
2802
  * `<PurchaseLabel />` element.
2803
2803
  */
2804
2804
  shipmentForm: {
2805
+ /**
2806
+ * `addOns` enables the `Add-Ons` section of the shipment form. This allows users to
2807
+ * add additional services to their shipment such as delivery confirmation and insurance.
2808
+ */
2809
+ addOns: true,
2805
2810
  /**
2806
2811
  * `browseRates` enables the `browse rates` button in the shipment form. This allows users
2807
2812
  * to browse rates for a shipment with varying shipment configurations. This is useful for
@@ -15143,7 +15148,7 @@ var en = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(O
15143
15148
  *
15144
15149
  * @see {@link ConnectCarrier.ComponentProps | The props that are passed into the `<ConnectCarrier />` component}
15145
15150
  */
15146
- const Component$9 = ({
15151
+ const Component$b = ({
15147
15152
  carrierName,
15148
15153
  features,
15149
15154
  onCancel,
@@ -15212,7 +15217,7 @@ const Component$9 = ({
15212
15217
  }
15213
15218
  });
15214
15219
  };
15215
- alchemy.createElement(Component$9, ErrorFallback, {
15220
+ alchemy.createElement(Component$b, ErrorFallback, {
15216
15221
  css: {
15217
15222
  height: "100%",
15218
15223
  maxWidth: "800px",
@@ -15248,7 +15253,7 @@ alchemy.createElement(Component$9, ErrorFallback, {
15248
15253
  * @see {@link ExternalCarriers.ComponentProps | The props that are passed into the `<ExternalCarriers />` component}
15249
15254
  * @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<ExternalCarriers />` component}
15250
15255
  */
15251
- const Component$8 = ({
15256
+ const Component$a = ({
15252
15257
  features
15253
15258
  }) => {
15254
15259
  const {
@@ -15273,7 +15278,7 @@ const Component$8 = ({
15273
15278
  }, [isAddingCarrier, connectedCarriersFetching]);
15274
15279
  const carrierList = useMemo(() => {
15275
15280
  const carriers = [];
15276
- connectedCarriers === null || connectedCarriers === void 0 ? void 0 : connectedCarriers.forEach(carrier => {
15281
+ connectedCarriers === null || connectedCarriers === void 0 ? void 0 : connectedCarriers.filter(carrier => !carrier.requiresFundedAmount).forEach(carrier => {
15277
15282
  const metadata = carrierMetadata === null || carrierMetadata === void 0 ? void 0 : carrierMetadata.find(m => m.carrierName === carrier.carrierCode);
15278
15283
  if (metadata) {
15279
15284
  carriers.push({
@@ -15306,7 +15311,7 @@ const Component$8 = ({
15306
15311
  textAlign: "left"
15307
15312
  }
15308
15313
  }, {
15309
- children: jsx(Component$9, {
15314
+ children: jsx(Component$b, {
15310
15315
  features: features,
15311
15316
  onCarrierConnected: () => {
15312
15317
  setAddModalOpen(false);
@@ -15321,7 +15326,7 @@ const Component$8 = ({
15321
15326
 
15322
15327
  var externalCarriers = /*#__PURE__*/Object.freeze({
15323
15328
  __proto__: null,
15324
- Component: Component$8
15329
+ Component: Component$a
15325
15330
  });
15326
15331
 
15327
15332
  const styles$l = createStyles({
@@ -15751,7 +15756,7 @@ const useListConnectedCarriers = () => {
15751
15756
  * @see {@link ListCarriers.ComponentProps | The props that are passed into the `<List-Carriers />` component}
15752
15757
  * @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<List-Carriers />` component}
15753
15758
  */
15754
- const Component$7 = ({
15759
+ const Component$9 = ({
15755
15760
  features
15756
15761
  }) => {
15757
15762
  const {
@@ -15792,7 +15797,7 @@ const Component$7 = ({
15792
15797
 
15793
15798
  var listCarriers = /*#__PURE__*/Object.freeze({
15794
15799
  __proto__: null,
15795
- Component: Component$7
15800
+ Component: Component$9
15796
15801
  });
15797
15802
 
15798
15803
  const WarehouseDisplay = ({
@@ -16332,24 +16337,19 @@ const ManageWarehouses = ({
16332
16337
  }),
16333
16338
  submitButtonTitle: t("actions.save")
16334
16339
  })
16335
- })) : jsx(ButtonGroup, Object.assign({
16336
- justify: "end"
16337
- }, {
16338
- children: jsxs(Button, Object.assign({
16339
- bold: false,
16340
- onClick: () => toggleShowAddNewWarehouseForm(true),
16341
- type: "button",
16342
- variant: ButtonVariant.TEXT
16340
+ })) : jsxs(Fragment, {
16341
+ children: [jsx(ButtonGroup, Object.assign({
16342
+ justify: "end"
16343
16343
  }, {
16344
- children: [t("manage-warehouses:addNew"), jsx(Icon, {
16345
- css: {
16346
- paddingLeft: 6
16347
- },
16348
- name: IconNames.ADD,
16349
- size: IconSize.SIZE_SMALL
16350
- })]
16351
- }))
16352
- })), jsx("div", Object.assign({
16344
+ children: jsx(LinkAction, {
16345
+ icon: "add",
16346
+ onClick: () => toggleShowAddNewWarehouseForm(true),
16347
+ title: t("manage-warehouses:addNew")
16348
+ })
16349
+ })), jsx(Spacer, {
16350
+ multiplier: 2
16351
+ })]
16352
+ }), jsx("div", Object.assign({
16353
16353
  css: styles$i.cardSpacing
16354
16354
  }, {
16355
16355
  children: warehouses.map(warehouse => {
@@ -16436,7 +16436,7 @@ const ManageWarehouses = ({
16436
16436
  * @see {@link ManageWarehouses.ComponentProps | The props that are passed into the `<ManageWarehouses />` component}
16437
16437
  * @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<ManageWarehouses />` component}
16438
16438
  */
16439
- const Component$6 = ({
16439
+ const Component$8 = ({
16440
16440
  onWarehouseAddressValidation: _ARE_WE_ACTUALLY_GOING_TO_USE_THIS
16441
16441
  }) => {
16442
16442
  const {
@@ -16519,7 +16519,7 @@ const Component$6 = ({
16519
16519
 
16520
16520
  var manageWarehouses = /*#__PURE__*/Object.freeze({
16521
16521
  __proto__: null,
16522
- Component: Component$6
16522
+ Component: Component$8
16523
16523
  });
16524
16524
 
16525
16525
  var img = "data:image/svg+xml,%3csvg fill='none' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='M22.9425 6.62223L18.63 5.81973C18.4275 5.78223 18.2325 5.91723 18.195 6.11973L17.3925 10.4322C17.355 10.6347 17.49 10.8297 17.6925 10.8672C17.715 10.8672 17.7375 10.8672 17.76 10.8672C17.94 10.8672 18.0975 10.7397 18.1275 10.5597L18.765 7.13973C21.15 10.3872 20.8125 14.9472 17.9475 17.8047C15.3225 20.4297 11.25 20.9697 8.04001 19.1247C7.86001 19.0197 7.63501 19.0797 7.53001 19.2597C7.42501 19.4397 7.49251 19.6647 7.66501 19.7697C9.05251 20.5722 10.5975 20.9622 12.1275 20.9622C14.4525 20.9622 16.755 20.0622 18.48 18.3372C21.5925 15.2247 21.9675 10.2597 19.3875 6.71973L22.8 7.34973C22.995 7.38723 23.1975 7.25223 23.235 7.04973C23.2725 6.84723 23.1375 6.65223 22.935 6.61473L22.9425 6.62223Z' fill='black' /%3e %3cpath d='M6.30022 12.7798C6.09772 12.7423 5.90272 12.8773 5.86522 13.0798L5.24272 16.4548C3.15022 13.2223 3.60022 8.91728 6.33022 6.18728C8.85022 3.66728 12.6752 3.05228 15.8477 4.65728C16.0277 4.74728 16.2602 4.67978 16.3502 4.49228C16.4402 4.30478 16.3727 4.07978 16.1852 3.98978C12.7202 2.23478 8.54272 2.90978 5.79772 5.65478C2.79022 8.66228 2.31772 13.3948 4.65022 16.9273L1.19272 16.2898C0.990221 16.2523 0.795221 16.3873 0.757721 16.5898C0.720221 16.7923 0.855221 16.9873 1.05772 17.0248L5.37022 17.8273C5.37022 17.8273 5.41522 17.8273 5.43772 17.8273C5.61772 17.8273 5.77522 17.6998 5.80522 17.5198L6.60772 13.2073C6.64522 13.0048 6.51022 12.8098 6.30772 12.7723L6.30022 12.7798Z' fill='black' /%3e %3cpath d='M15.0824 13.2223C14.9249 12.9373 14.7224 12.6973 14.4674 12.4948C14.2124 12.2998 13.9349 12.1348 13.6274 11.9998C13.3199 11.8648 13.0124 11.7598 12.7124 11.6773L12.3149 11.5648V7.87482C12.8324 7.91232 13.2749 8.06232 13.6349 8.33232C14.0549 8.64732 14.2874 9.07482 14.3399 9.60732H15.1874C15.1724 9.11982 15.0224 8.68482 14.7524 8.30232C14.4824 7.91982 14.1149 7.61982 13.6574 7.40232C13.2599 7.21482 12.8099 7.12482 12.3149 7.09482V6.31482C12.3149 6.14232 12.1799 6.00732 12.0074 6.00732C11.8349 6.00732 11.6999 6.14232 11.6999 6.31482V7.10982C11.2649 7.14732 10.8449 7.22982 10.4774 7.40232C10.0049 7.61982 9.62988 7.92732 9.35238 8.31732C9.07488 8.70732 8.93988 9.16482 8.93988 9.67482C8.93988 10.2898 9.14988 10.7998 9.56238 11.1898C9.97488 11.5798 10.5599 11.8948 11.3174 12.1198L11.6999 12.2323V16.1323C11.3849 16.1098 11.0849 16.0573 10.8224 15.9523C10.4699 15.8173 10.1849 15.6148 9.96738 15.3523C9.74988 15.0898 9.62238 14.7673 9.59238 14.3923V14.3323C9.59238 14.0848 9.38988 13.8823 9.14238 13.8823C8.89488 13.8823 8.69238 14.0848 8.69238 14.3323V14.3923C8.72988 14.8948 8.87988 15.3448 9.15738 15.7273C9.43488 16.1098 9.80988 16.4098 10.2899 16.6273C10.6949 16.8073 11.1749 16.8973 11.6999 16.9273V17.6848C11.6999 17.8573 11.8349 17.9923 12.0074 17.9923C12.1799 17.9923 12.3149 17.8573 12.3149 17.6848V16.9348C12.8699 16.9048 13.3574 16.7923 13.7774 16.5898C14.2724 16.3498 14.6549 16.0273 14.9174 15.6148C15.1799 15.2023 15.3149 14.7448 15.3149 14.2348C15.3149 13.8373 15.2399 13.4923 15.0824 13.2073V13.2223ZM11.0099 11.1448C10.7849 11.0473 10.5749 10.9348 10.3949 10.7923C10.2074 10.6573 10.0574 10.4923 9.95238 10.3048C9.84738 10.1173 9.78738 9.89232 9.78738 9.63732C9.78738 9.29232 9.88488 8.98482 10.0724 8.71482C10.2674 8.44482 10.5299 8.23482 10.8674 8.07732C11.1149 7.96482 11.3924 7.91232 11.6924 7.88232V11.3848C11.4599 11.3173 11.2349 11.2348 11.0024 11.1373L11.0099 11.1448ZM14.1449 15.2473C13.9274 15.5398 13.6349 15.7648 13.2674 15.9223C12.9824 16.0423 12.6599 16.1023 12.3149 16.1323V12.4198L12.4649 12.4648C12.8624 12.5773 13.2074 12.7123 13.5149 12.8623C13.8149 13.0123 14.0549 13.1998 14.2199 13.4173C14.3849 13.6348 14.4749 13.9123 14.4749 14.2348C14.4749 14.6173 14.3699 14.9548 14.1524 15.2473H14.1449Z' fill='black' /%3e %3cpath d='M14.7525 10.0796C14.985 10.0796 15.1725 9.89211 15.1725 9.65961V9.59961H14.3325V9.65961C14.3325 9.89211 14.52 10.0796 14.7525 10.0796Z' fill='black' /%3e%3c/svg%3e";
@@ -17701,9 +17701,9 @@ const AccountSettings = _a => {
17701
17701
  }), jsx(ManageFunding, {
17702
17702
  carrierId: carriers ? carriers[0].carrierId : "",
17703
17703
  currency: currency
17704
- }), jsx(PaymentMethodSettings, {}), jsx(WalletHistory, {}), jsx(Component$6, {}), jsx(Component$7, {
17704
+ }), jsx(PaymentMethodSettings, {}), jsx(WalletHistory, {}), jsx(Component$8, {}), jsx(Component$9, {
17705
17705
  features: features
17706
- }), jsx(Component$8, {
17706
+ }), jsx(Component$a, {
17707
17707
  features: features
17708
17708
  }), jsx(LabelLayout, {
17709
17709
  display: "settings"
@@ -17739,7 +17739,7 @@ const AccountSettings = _a => {
17739
17739
  *
17740
17740
  * @see {@link AccountSettings.Element | The **Element** created to render `<AccountSettings />`}
17741
17741
  */
17742
- const Component$5 = ({
17742
+ const Component$7 = ({
17743
17743
  features,
17744
17744
  onSaveSettings
17745
17745
  }) => {
@@ -17783,7 +17783,7 @@ const Component$5 = ({
17783
17783
  * @see {@link PaymentMethodSettings | The `<PaymentMethodSettings />` component used to manage payment methods}
17784
17784
  * @see {@link ManageFunding | The `<ManageFunding />` component used to manage funding rules and add funds to a carrier account}
17785
17785
  */
17786
- const Element$6 = alchemy.createElement(Component$5, ErrorFallback, {
17786
+ const Element$8 = alchemy.createElement(Component$7, ErrorFallback, {
17787
17787
  css: {
17788
17788
  height: "100%",
17789
17789
  maxWidth: "800px",
@@ -17797,8 +17797,8 @@ const Element$6 = alchemy.createElement(Component$5, ErrorFallback, {
17797
17797
 
17798
17798
  var accountSettings = /*#__PURE__*/Object.freeze({
17799
17799
  __proto__: null,
17800
- Component: Component$5,
17801
- Element: Element$6
17800
+ Component: Component$7,
17801
+ Element: Element$8
17802
17802
  });
17803
17803
 
17804
17804
  const SuspendSalesOrder = ({
@@ -19089,6 +19089,7 @@ const ShipmentForm = ({
19089
19089
  }) => {
19090
19090
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
19091
19091
  features = Object.assign({
19092
+ addOns: true,
19092
19093
  browseRates: true,
19093
19094
  includeShipsuranceInsurance: true,
19094
19095
  includeThirdPartyInsurance: true,
@@ -19774,82 +19775,84 @@ const ShipmentForm = ({
19774
19775
  hint: t("purchase-label:hints.contentDescription"),
19775
19776
  label: t("purchase-label:fields.contentDescription"),
19776
19777
  name: "packages.0.contentDescription"
19777
- }), jsx(Divider, {}), jsx(Spacer, {}), jsxs(FieldLabel, Object.assign({
19778
- label: "purchase-label:fields.addOns"
19779
- }, {
19780
- children: [jsx(Switch, Object.assign({
19781
- defaultChecked: ((_g = shipment === null || shipment === void 0 ? void 0 : shipment.confirmation) !== null && _g !== void 0 ? _g : "none") !== "none",
19782
- label: t("purchase-label:fields.confirmation"),
19783
- name: "confirmationEnabled",
19784
- onChange: e => form.setValue("confirmation", e.target.checked ? SE.ConfirmationType.DELIVERY : undefined, {
19785
- shouldDirty: true
19786
- }),
19787
- shouldUnmount: true,
19788
- value: ((_h = shipment === null || shipment === void 0 ? void 0 : shipment.confirmation) !== null && _h !== void 0 ? _h : "none") !== "none"
19778
+ }), features.addOns && jsxs(Fragment, {
19779
+ children: [jsx(Divider, {}), jsx(Spacer, {}), jsxs(FieldLabel, Object.assign({
19780
+ label: "purchase-label:fields.addOns"
19789
19781
  }, {
19790
- children: jsx(Select, {
19791
- control: form.control,
19792
- defaultValue: SE.ConfirmationType.DELIVERY,
19793
- displayLabel: false,
19782
+ children: [jsx(Switch, Object.assign({
19783
+ defaultChecked: ((_g = shipment === null || shipment === void 0 ? void 0 : shipment.confirmation) !== null && _g !== void 0 ? _g : "none") !== "none",
19794
19784
  label: t("purchase-label:fields.confirmation"),
19795
- name: "confirmation",
19796
- options: confirmationOptions,
19797
- shouldUnregister: true
19798
- })
19799
- })), jsxs(Switch, Object.assign({
19800
- defaultChecked: ((_j = shipment === null || shipment === void 0 ? void 0 : shipment.insuranceProvider) !== null && _j !== void 0 ? _j : "none") !== "none",
19801
- label: t("purchase-label:fields.insurance"),
19802
- name: "insuranceEnabled",
19803
- onChange: e => {
19804
- setInsuranceEnabled(e.target.checked);
19805
- form.setValue("insuranceProvider", e.target.checked ? SE.InsuranceProviderType.CARRIER : undefined, {
19785
+ name: "confirmationEnabled",
19786
+ onChange: e => form.setValue("confirmation", e.target.checked ? SE.ConfirmationType.DELIVERY : undefined, {
19806
19787
  shouldDirty: true
19807
- });
19808
- },
19809
- shouldUnmount: true,
19810
- value: ((_k = shipment === null || shipment === void 0 ? void 0 : shipment.insuranceProvider) !== null && _k !== void 0 ? _k : "none") !== "none"
19811
- }, {
19812
- children: [insuranceProviderOptions.length === 1 && insuranceProviderOptions[0].value === "carrier" ? null : jsx(Select, {
19813
- control: form.control,
19814
- defaultValue: insuranceEnabled ? SE.InsuranceProviderType.CARRIER : SE.InsuranceProviderType.NONE,
19815
- displayLabel: false,
19816
- label: t("purchase-label:fields.insuranceProvider"),
19817
- name: "insuranceProvider",
19818
- options: insuranceProviderOptions,
19819
- shouldUnregister: true
19820
- }), jsx(MoneyInput, {
19821
- control: form.control,
19822
- defaultValue: {
19823
- amount: undefined,
19824
- currency
19788
+ }),
19789
+ shouldUnmount: true,
19790
+ value: ((_h = shipment === null || shipment === void 0 ? void 0 : shipment.confirmation) !== null && _h !== void 0 ? _h : "none") !== "none"
19791
+ }, {
19792
+ children: jsx(Select, {
19793
+ control: form.control,
19794
+ defaultValue: SE.ConfirmationType.DELIVERY,
19795
+ displayLabel: false,
19796
+ label: t("purchase-label:fields.confirmation"),
19797
+ name: "confirmation",
19798
+ options: confirmationOptions,
19799
+ shouldUnregister: true
19800
+ })
19801
+ })), jsxs(Switch, Object.assign({
19802
+ defaultChecked: ((_j = shipment === null || shipment === void 0 ? void 0 : shipment.insuranceProvider) !== null && _j !== void 0 ? _j : "none") !== "none",
19803
+ label: t("purchase-label:fields.insurance"),
19804
+ name: "insuranceEnabled",
19805
+ onChange: e => {
19806
+ setInsuranceEnabled(e.target.checked);
19807
+ form.setValue("insuranceProvider", e.target.checked ? SE.InsuranceProviderType.CARRIER : undefined, {
19808
+ shouldDirty: true
19809
+ });
19825
19810
  },
19826
- displayLabel: false,
19827
- label: t("purchase-label:fields.insuredValue"),
19828
- name: "packages.0.insuredValue",
19829
- placeholder: t("purchase-label:fields.insuredValue"),
19830
- shouldUnregister: true,
19831
- showCurrencySymbol: true
19811
+ shouldUnmount: true,
19812
+ value: ((_k = shipment === null || shipment === void 0 ? void 0 : shipment.insuranceProvider) !== null && _k !== void 0 ? _k : "none") !== "none"
19813
+ }, {
19814
+ children: [insuranceProviderOptions.length === 1 && insuranceProviderOptions[0].value === "carrier" ? null : jsx(Select, {
19815
+ control: form.control,
19816
+ defaultValue: insuranceEnabled ? SE.InsuranceProviderType.CARRIER : SE.InsuranceProviderType.NONE,
19817
+ displayLabel: false,
19818
+ label: t("purchase-label:fields.insuranceProvider"),
19819
+ name: "insuranceProvider",
19820
+ options: insuranceProviderOptions,
19821
+ shouldUnregister: true
19822
+ }), jsx(MoneyInput, {
19823
+ control: form.control,
19824
+ defaultValue: {
19825
+ amount: undefined,
19826
+ currency
19827
+ },
19828
+ displayLabel: false,
19829
+ label: t("purchase-label:fields.insuredValue"),
19830
+ name: "packages.0.insuredValue",
19831
+ placeholder: t("purchase-label:fields.insuredValue"),
19832
+ shouldUnregister: true,
19833
+ showCurrencySymbol: true
19834
+ })]
19835
+ })), hasUpsOptions && jsx(Switch, {
19836
+ defaultChecked: ((_l = shipment === null || shipment === void 0 ? void 0 : shipment.advancedOptions) === null || _l === void 0 ? void 0 : _l.additionalHandling) || false,
19837
+ label: jsx(Trans, {
19838
+ components: {
19839
+ Link: jsx(Link, {
19840
+ href: "https://help.paypal.shipstation.com/hc/en-us/articles/13823149193755-UPS-Additional-Handling",
19841
+ rel: "noopener noreferrer",
19842
+ target: "_blank"
19843
+ })
19844
+ },
19845
+ i18nKey: "purchase-label:fields.requires-additional-handling",
19846
+ t: t
19847
+ }),
19848
+ name: "advancedOptions.additionalHandling",
19849
+ onChange: e => form.setValue("advancedOptions.additionalHandling", e.target.checked, {
19850
+ shouldDirty: true
19851
+ }),
19852
+ value: form.getValues("advancedOptions.additionalHandling") || false
19832
19853
  })]
19833
- })), hasUpsOptions && jsx(Switch, {
19834
- defaultChecked: ((_l = shipment === null || shipment === void 0 ? void 0 : shipment.advancedOptions) === null || _l === void 0 ? void 0 : _l.additionalHandling) || false,
19835
- label: jsx(Trans, {
19836
- components: {
19837
- Link: jsx(Link, {
19838
- href: "https://help.paypal.shipstation.com/hc/en-us/articles/13823149193755-UPS-Additional-Handling",
19839
- rel: "noopener noreferrer",
19840
- target: "_blank"
19841
- })
19842
- },
19843
- i18nKey: "purchase-label:fields.requires-additional-handling",
19844
- t: t
19845
- }),
19846
- name: "advancedOptions.additionalHandling",
19847
- onChange: e => form.setValue("advancedOptions.additionalHandling", e.target.checked, {
19848
- shouldDirty: true
19849
- }),
19850
- value: form.getValues("advancedOptions.additionalHandling") || false
19851
- })]
19852
- })), jsx("div", Object.assign({
19854
+ }))]
19855
+ }), jsx("div", Object.assign({
19853
19856
  css: {
19854
19857
  display: "flex",
19855
19858
  justifyContent: "flex-end"
@@ -22046,7 +22049,7 @@ const PurchaseLabelByShipment = _a => {
22046
22049
  *
22047
22050
  * @see {@link PurchaseLabel.Element | The **Element** created to render `<PurchaseLabel />`}
22048
22051
  */
22049
- const Component$4 = _a => {
22052
+ const Component$6 = _a => {
22050
22053
  var _b, _c;
22051
22054
  var {
22052
22055
  features
@@ -22138,7 +22141,7 @@ const Component$4 = _a => {
22138
22141
  *
22139
22142
  * @see {@link ViewShipment.Element | The next step in the label purchase workflow `<ViewShipment.Element />`}
22140
22143
  */
22141
- const Element$5 = alchemy.createElement(Component$4, ErrorFallback, {
22144
+ const Element$7 = alchemy.createElement(Component$6, ErrorFallback, {
22142
22145
  css: {
22143
22146
  height: "100%",
22144
22147
  maxWidth: "800px",
@@ -22152,8 +22155,8 @@ const Element$5 = alchemy.createElement(Component$4, ErrorFallback, {
22152
22155
 
22153
22156
  var purchaseLabel = /*#__PURE__*/Object.freeze({
22154
22157
  __proto__: null,
22155
- Component: Component$4,
22156
- Element: Element$5
22158
+ Component: Component$6,
22159
+ Element: Element$7
22157
22160
  });
22158
22161
 
22159
22162
  const styles$8 = createStyles({
@@ -22515,338 +22518,642 @@ const Shipment = ({
22515
22518
  });
22516
22519
  };
22517
22520
 
22518
- /**
22519
- * # View Shipment Component
22520
- *
22521
- * - The `<ViewShipment />` component is used to for viewing the shipment's tracking number, printing the label that
22522
- * was created, and the option to void the label. When a label is voided, you can see a list of the
22523
- * previously voided labels for a given shipment using this component.
22524
- *
22525
- * @param ComponentProps The base props that will be passed into the `<ViewShipment />` component.
22526
- *
22527
- * @returns Element An EmotionJSX.Element that will render the `<ViewShipment />` component
22528
- * with all the appropriate wrappers.
22529
- *
22530
- * @example
22531
- * You can see how the `<Component />` is used in the `createElement` function call below.
22532
- * ```tsx
22533
- * export const Element = alchemy.createElement(Component, ErrorFallback, {
22534
- * css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
22535
- * resources: { en },
22536
- * });
22537
- * ```
22538
- *
22539
- * <br />
22540
- *
22541
- * @see {@link ViewShipment.Element | The **Element** created to render `<ViewShipment />`}
22542
- */
22543
- const Component$3 = ({
22544
- features,
22545
- onClickPrintLabel,
22546
- onClickPurchaseLabel,
22547
- onClickVoidLabel,
22548
- shipmentId
22549
- }) => {
22550
- var _a, _b, _c;
22551
- const {
22552
- t
22553
- } = useTranslation(["common", "view-shipment"]);
22554
- const shipment = useGetSalesOrderShipment(shipmentId);
22555
- const {
22556
- data: {
22557
- labels = []
22558
- } = {}
22559
- } = useListLabels({
22560
- shipmentId
22561
- });
22562
- const salesOrder = useGetSalesOrder((_b = (_a = shipment.data) === null || _a === void 0 ? void 0 : _a.salesOrderIds) === null || _b === void 0 ? void 0 : _b[0]);
22563
- const warehouses = useListWarehouses();
22564
- const carriers = useListCarriers();
22565
- if (shipment.isInitialLoading) return jsx(Loader, {
22566
- message: t("loading.shipment")
22567
- });
22568
- if (shipment.error) throw new Error(shipment.error.map(e => e.message).join(", "));
22569
- if (!shipment.data) throw new Error("errorMessages.unableToLoad.shipment");
22570
- const warehouse = (_c = warehouses.data) === null || _c === void 0 ? void 0 : _c.find(w => {
22571
- var _a;
22572
- return w.warehouseId === ((_a = shipment.data) === null || _a === void 0 ? void 0 : _a.warehouseId);
22573
- });
22574
- return jsx(Shipment, {
22575
- carriers: carriers.data,
22576
- features: features,
22577
- labels: labels,
22578
- onClickPrintLabel: onClickPrintLabel,
22579
- onClickPurchaseLabel: onClickPurchaseLabel,
22580
- onClickVoidLabel: onClickVoidLabel,
22581
- salesOrder: salesOrder.data,
22582
- shipment: shipment.data,
22583
- warehouse: warehouse
22584
- });
22585
- };
22586
- /**
22587
- * # Registered View Shipment Element
22588
- *
22589
- * - This is the registered `<ViewShipment />` element that will be used to render the
22590
- * `<ViewShipment.Element />` component.
22591
- *
22592
- * @param ElementProps The props, callbacks, and resources necessary to render
22593
- * the `<ViewShipment.Element />` component.
22594
- *
22595
- * @example
22596
- * The `<Component />` is the source JSX that is rendered when you make use of the `ViewShipment`
22597
- * Element directly. Here is a brief example of how you would use it within your application.
22598
- * ```tsx
22599
- * <ViewShipment.Element
22600
- * onClickPurchaseLabel={({ salesOrderId }) => {
22601
- * console.log('sales order ID', salesOrderId);
22602
- * }}
22603
- * onClickVoidLabel={({ labelId }) => {
22604
- * console.log('voided label', labelId);
22605
- * }}
22606
- * shipmentId="se-1234567"
22607
- * />
22608
- * ```
22609
- *
22610
- * <br />
22611
- *
22612
- * @see {@link ViewShipment.ComponentProps | The **props** that can be passed into the `<ViewShipment.Element />` component}
22613
- *
22614
- * @see {@link VoidLabel.Element | The next step in the label purchase workflow `<VoidLabel.Element />`}
22615
- **/
22616
- const Element$4 = alchemy.createElement(Component$3, ErrorFallback, {
22617
- css: {
22618
- height: "100%",
22619
- maxWidth: "800px",
22620
- minWidth: "440px",
22621
- width: "100%"
22521
+ const styles$7 = createStyles({
22522
+ category: {
22523
+ alignItems: "center",
22524
+ cursor: "pointer",
22525
+ display: "flex",
22526
+ flexDirection: "row",
22527
+ justifyContent: "space-between"
22622
22528
  },
22623
- resources: {
22624
- en
22625
- }
22626
- });
22627
-
22628
- var viewShipment = /*#__PURE__*/Object.freeze({
22629
- __proto__: null,
22630
- Component: Component$3,
22631
- Element: Element$4
22529
+ colorPicker: theme => ({
22530
+ "&::-webkit-color-swatch": {
22531
+ border: `1px solid ${theme.palette.gray.light}`,
22532
+ borderRadius: "4px",
22533
+ padding: 0
22534
+ },
22535
+ "&::-webkit-color-swatch-wrapper": {
22536
+ padding: 0
22537
+ },
22538
+ alignSelf: "center",
22539
+ appearance: "none",
22540
+ background: "none",
22541
+ border: 0,
22542
+ cursor: "pointer",
22543
+ height: theme.spacing(4.25),
22544
+ outline: "none",
22545
+ width: theme.spacing(4.25)
22546
+ }),
22547
+ container: theme => ({
22548
+ marginBottom: theme.spacing(2)
22549
+ }),
22550
+ input: theme => ({
22551
+ border: `1px solid ${theme.palette.gray.light}`,
22552
+ borderRadius: "4px",
22553
+ color: theme.palette.gray.main,
22554
+ fontSize: "14px",
22555
+ padding: theme.spacing(1)
22556
+ }),
22557
+ inputContainer: theme => ({
22558
+ alignItems: "center",
22559
+ display: "flex",
22560
+ flexDirection: "row",
22561
+ justifyContent: "space-between",
22562
+ padding: `${theme.spacing(2)}px 0`
22563
+ }),
22564
+ wrapper: theme => ({
22565
+ display: "flex",
22566
+ gap: theme.spacing(1)
22567
+ })
22632
22568
  });
22633
22569
 
22634
- const Actions = ({
22635
- onComplete,
22636
- onSubmit,
22637
- onViewShipment,
22638
- shipment,
22639
- voidRequest
22570
+ const ColorPaletteEditor = ({
22571
+ paletteConfig,
22572
+ onUpdatePaletteConfig,
22573
+ formatKey
22640
22574
  }) => {
22641
- const {
22642
- t
22643
- } = useTranslation(["common", "void-label"]);
22644
- const [isSubmitting, setIsSubmitting] = useState(false);
22645
- const handleSubmit = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
22646
- setIsSubmitting(true);
22647
- yield onSubmit();
22648
- setIsSubmitting(false);
22649
- }), [onSubmit]);
22650
- return jsx(BottomSheet, Object.assign({
22651
- alwaysVisible: true,
22652
- css: theme => ({
22653
- borderTop: `1px solid ${theme.palette.gray.ultraLight}`,
22654
- boxShadow: "none",
22655
- position: "static"
22656
- })
22657
- }, {
22658
- children: (voidRequest === null || voidRequest === void 0 ? void 0 : voidRequest.approved) ?
22659
- // The void request has been approved
22660
- jsxs(ButtonGroup, {
22661
- children: [jsx(Button, Object.assign({
22662
- bold: false,
22663
- onClick: () => onComplete(voidRequest, shipment),
22664
- variant: ButtonVariant.OUTLINED
22575
+ const [expandedCategories, setExpandedCategories] = useState(new Set());
22576
+ const toggleExpandedCategories = category => {
22577
+ setExpandedCategories(prev => {
22578
+ const openCategories = new Set(prev);
22579
+ if (openCategories.has(category)) {
22580
+ return new Set([...openCategories].filter(item => item !== category));
22581
+ } else {
22582
+ return new Set([...openCategories, category]);
22583
+ }
22584
+ });
22585
+ };
22586
+ const handleInputChange = useCallback((category, key, value) => {
22587
+ const updatedConfig = Object.assign(Object.assign({}, paletteConfig || {}), {
22588
+ [category]: Object.assign(Object.assign({}, (paletteConfig === null || paletteConfig === void 0 ? void 0 : paletteConfig[category]) || {}), {
22589
+ [key]: value
22590
+ })
22591
+ });
22592
+ onUpdatePaletteConfig(updatedConfig);
22593
+ }, [onUpdatePaletteConfig, paletteConfig]);
22594
+ return jsx("div", Object.assign({
22595
+ "data-test-id": "color-palette-editor"
22596
+ }, {
22597
+ children: paletteConfig && Object.keys(paletteConfig).map(category => jsxs("div", Object.assign({
22598
+ css: styles$7.container,
22599
+ id: category
22600
+ }, {
22601
+ children: [jsxs("div", Object.assign({
22602
+ "aria-expanded": expandedCategories.has(category),
22603
+ css: styles$7.category,
22604
+ onClick: event => {
22605
+ event.preventDefault();
22606
+ toggleExpandedCategories(category);
22607
+ },
22608
+ role: "button"
22665
22609
  }, {
22666
- children: t("void-label:actions.complete")
22667
- })), jsx(Button, Object.assign({
22668
- bold: false,
22669
- isFullWidth: true,
22670
- onClick: () => onViewShipment(shipment)
22610
+ children: [jsx("p", {
22611
+ children: capitalizeFirstLetter(category)
22612
+ }), jsx(Icon, {
22613
+ name: expandedCategories.has(category) ? IconNames.CHEVRON_TOP : IconNames.CHEVRON_BOTTOM,
22614
+ size: IconSize.SIZE_REGULAR
22615
+ })]
22616
+ })), expandedCategories.has(category) && Object.keys(paletteConfig[category]).map(key => jsxs("div", Object.assign({
22617
+ css: styles$7.inputContainer,
22618
+ id: "input-container"
22671
22619
  }, {
22672
- children: t("void-label:actions.viewShipment")
22673
- }))]
22674
- }) :
22675
- // The void request has yet to be made or was rejected
22676
- jsx(Button, Object.assign({
22677
- bold: false,
22678
- isFullWidth: true,
22679
- isLoading: isSubmitting,
22680
- onClick: handleSubmit
22681
- }, {
22682
- children: t("void-label:actions.confirmVoid")
22683
- }))
22620
+ children: [jsx("label", Object.assign({
22621
+ css: {
22622
+ fontWeight: "bold"
22623
+ },
22624
+ htmlFor: `${category}.${key}`
22625
+ }, {
22626
+ children: formatKey(key)
22627
+ })), jsxs("form", Object.assign({
22628
+ css: styles$7.wrapper
22629
+ }, {
22630
+ children: [jsx("input", {
22631
+ css: styles$7.input,
22632
+ onChange: e => {
22633
+ if (e.target.value.match(/^#[0-9A-Fa-f]{0,6}$/)) handleInputChange(category, key, e.target.value);
22634
+ },
22635
+ onKeyDown: e => {
22636
+ if (e.key === "Enter") e.preventDefault();
22637
+ },
22638
+ type: "text",
22639
+ value: paletteConfig[category][key]
22640
+ }), jsx("input", {
22641
+ css: styles$7.colorPicker,
22642
+ onChange: e => handleInputChange(category, key, e.target.value),
22643
+ type: "color",
22644
+ value: paletteConfig[category][key]
22645
+ })]
22646
+ }))]
22647
+ }), key))]
22648
+ }), category))
22684
22649
  }));
22685
22650
  };
22686
22651
 
22687
- const Message = ({
22688
- voidRequest
22652
+ const styles$6 = createStyles({
22653
+ input: theme => ({
22654
+ border: `1px solid ${theme.palette.gray.light}`,
22655
+ borderRadius: "4px",
22656
+ color: theme.palette.gray.main,
22657
+ fontSize: "14px",
22658
+ maxWidth: theme.spacing(16),
22659
+ padding: 0
22660
+ }),
22661
+ keys: {
22662
+ fontSize: "16px",
22663
+ fontWeight: "bold",
22664
+ marginTop: "8px"
22665
+ },
22666
+ section: theme => ({
22667
+ "& > div:first-child": {
22668
+ flexGrow: 3
22669
+ },
22670
+ "& > div:last-child": {
22671
+ flexShrink: 1
22672
+ },
22673
+ display: "flex",
22674
+ gap: theme.spacing(1),
22675
+ justifyContent: "space-between"
22676
+ }),
22677
+ sectionContainer: theme => ({
22678
+ marginBottom: theme.spacing(4)
22679
+ }),
22680
+ select: theme => ({
22681
+ border: `1px solid ${theme.palette.gray.light}`,
22682
+ borderRadius: "4px",
22683
+ color: theme.palette.gray.main,
22684
+ fontSize: "14px"
22685
+ })
22686
+ });
22687
+
22688
+ const TypographyEditor = ({
22689
+ onUpdateTypographyConfig,
22690
+ typographyConfig,
22691
+ formatKey
22689
22692
  }) => {
22690
- const {
22691
- t
22692
- } = useTranslation(["common", "void-label"]);
22693
- return jsx(Section, {
22694
- children: voidRequest ? jsxs("section", Object.assign({
22695
- css: {
22696
- textAlign: "center",
22697
- width: "100%"
22698
- }
22693
+ const handleInputChange = useCallback((variant, key, value) => {
22694
+ const updatedConfig = Object.assign(Object.assign({}, typographyConfig || {}), {
22695
+ [variant]: Object.assign(Object.assign({}, (typographyConfig === null || typographyConfig === void 0 ? void 0 : typographyConfig[variant]) || {}), {
22696
+ [key]: value
22697
+ })
22698
+ });
22699
+ onUpdateTypographyConfig(updatedConfig);
22700
+ }, [onUpdateTypographyConfig, typographyConfig]);
22701
+ const getNestedValue = useCallback((obj, key) => {
22702
+ if (!obj) return undefined;
22703
+ return obj[key];
22704
+ }, []);
22705
+ const renderFontWeightSelect = (variant, key) => {
22706
+ var _a;
22707
+ const options = [{
22708
+ label: "Normal",
22709
+ value: "400"
22699
22710
  }, {
22700
- children: [jsx(Icon, {
22701
- css: theme => ({
22702
- color: (voidRequest === null || voidRequest === void 0 ? void 0 : voidRequest.approved) ? theme.palette.success.main : theme.palette.error.main
22703
- }),
22704
- name: (voidRequest === null || voidRequest === void 0 ? void 0 : voidRequest.approved) ? IconNames.CHECK_FILLED : IconNames.ALERT,
22705
- size: IconSize.SIZE_LARGE
22706
- }), (voidRequest === null || voidRequest === void 0 ? void 0 : voidRequest.approved) ? jsxs(Fragment, {
22707
- children: [jsx(Typography, Object.assign({
22708
- component: "h2"
22709
- }, {
22710
- children: t("void-label:resultTitles.approved")
22711
- })), jsx(Typography, {
22712
- children: t("void-label:resultMessages.approved")
22713
- })]
22714
- }) : jsxs(Fragment, {
22715
- children: [jsx(Typography, Object.assign({
22716
- component: "h2"
22717
- }, {
22718
- children: t("void-label:resultTitles.rejected")
22719
- })), jsx(Typography, {
22720
- children: jsx("p", {
22721
- dangerouslySetInnerHTML: {
22722
- __html: t("void-label:resultMessages.rejected")
22723
- }
22724
- })
22725
- })]
22726
- })]
22727
- })) : jsxs(Fragment, {
22728
- children: [jsx(Typography, {
22729
- children: t("void-label:refund_process")
22730
- }), jsx(Typography, Object.assign({
22731
- component: "p"
22711
+ label: "Semi Bold",
22712
+ value: "600"
22713
+ }, {
22714
+ label: "Bold",
22715
+ value: "700"
22716
+ }];
22717
+ const fontWeightValue = (_a = getNestedValue(typographyConfig, variant)) === null || _a === void 0 ? void 0 : _a.fontWeight.toString();
22718
+ const selectOption = fontWeightValue !== undefined ? options.find(option => option.value === fontWeightValue) : undefined;
22719
+ return jsx(Select$1, Object.assign({
22720
+ css: styles$6.select,
22721
+ label: "Font Weight",
22722
+ name: "font-weight",
22723
+ onChange: (_name, value) => handleInputChange(variant, key, value === null || value === void 0 ? void 0 : value.value),
22724
+ value: selectOption
22725
+ }, {
22726
+ children: options.map(option => jsx(Option, Object.assign({
22727
+ value: option.value
22732
22728
  }, {
22733
- children: t("void-label:refund_rules")
22734
- }))]
22735
- })
22736
- });
22737
- };
22738
-
22739
- /**
22740
- * # Void Label Component
22741
- *
22742
- * - The `<VoidLabel />` component is used to void a given shipping label. When a label is voided,
22743
- * you then get the option to view the associated shipment via the `View Shipment` Element, or
22744
- * you can purchase another label for the shipment via the `Purchase Label` Element.
22745
- *
22746
- * @param ComponentProps The base props that will be passed into the `<VoidLabel />` component.
22747
- *
22748
- * @returns Element An EmotionJSX.Element that will render the `<VoidLabel />` component
22749
- * with all the appropriate wrappers.
22750
- *
22751
- * @example
22752
- * You can see how the `<Component />` is used in the `createElement` function call below.
22753
- * ```tsx
22754
- * export const Element = alchemy.createElement(Component, ErrorFallback, {
22755
- * css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
22756
- * resources: { en },
22757
- * });
22758
- * ```
22759
- *
22760
- * <br />
22761
- *
22762
- * @see {@link VoidLabel.Element | The **Element** created to render `<VoidLabel />`}
22763
- */
22764
- const Component$2 = ({
22765
- features,
22766
- labelId,
22767
- onComplete,
22768
- onSuccess,
22769
- onViewShipment
22770
- }) => {
22771
- var _a, _b;
22772
- features = Object.assign({
22773
- presentation: {
22774
- poweredByShipEngine: false
22775
- }
22776
- }, features !== null && features !== void 0 ? features : {});
22777
- // TODO [LMNT-910] - labelId should be a required prop
22778
- if (!labelId) throw new Error("void-label:errorMessages.labelIdRequired");
22729
+ children: option.label
22730
+ }), option.value))
22731
+ }));
22732
+ };
22733
+ const renderFontSizeInput = (variant, key) => {
22734
+ var _a;
22735
+ const formattedFontSizeValue = (_a = getNestedValue(typographyConfig, variant)) === null || _a === void 0 ? void 0 : _a.fontSize.replace("px", "");
22736
+ return jsx(Input, {
22737
+ "aria-labelledby": `${variant}.${key}`,
22738
+ css: styles$6.input,
22739
+ label: "Font Size(px)",
22740
+ onChange: e => {
22741
+ if (e.target.value.match(/^\d{0,2}$/)) handleInputChange(variant, key, `${e.target.value}px`);
22742
+ },
22743
+ value: formattedFontSizeValue
22744
+ });
22745
+ };
22746
+ const renderChildren = (variant, key) => {
22747
+ switch (key) {
22748
+ case "fontWeight":
22749
+ return jsx(Fragment, {
22750
+ children: renderFontWeightSelect(variant, key)
22751
+ });
22752
+ case "fontSize":
22753
+ return jsx(Fragment, {
22754
+ children: renderFontSizeInput(variant, key)
22755
+ });
22756
+ default:
22757
+ return null;
22758
+ }
22759
+ };
22760
+ return jsx("div", {
22761
+ children: typographyConfig && Object.keys(typographyConfig).map(variant => jsxs("div", Object.assign({
22762
+ css: styles$6.sectionContainer
22763
+ }, {
22764
+ children: [jsx("p", Object.assign({
22765
+ css: styles$6.keys,
22766
+ id: variant
22767
+ }, {
22768
+ children: formatKey(variant)
22769
+ })), jsx("section", Object.assign({
22770
+ css: styles$6.section
22771
+ }, {
22772
+ children: Object.keys(typographyConfig[variant]).map(key => jsx("div", Object.assign({
22773
+ id: `${variant}.${key}`
22774
+ }, {
22775
+ children: renderChildren(variant, key)
22776
+ }), key))
22777
+ }))]
22778
+ }), variant))
22779
+ });
22780
+ };
22781
+
22782
+ const styles$5 = createStyles({
22783
+ container: theme => ({
22784
+ color: theme.palette.gray.dark,
22785
+ display: "flex",
22786
+ flexDirection: "column",
22787
+ flexGrow: 1,
22788
+ overflow: "hidden",
22789
+ position: "relative"
22790
+ }),
22791
+ content: theme => ({
22792
+ display: "flex",
22793
+ flexDirection: "column",
22794
+ gap: theme.spacing(3),
22795
+ padding: theme.spacing(3)
22796
+ }),
22797
+ copy: theme => ({
22798
+ backgroundColor: theme.palette.white,
22799
+ borderRadius: "4px",
22800
+ padding: theme.spacing(0.5)
22801
+ }),
22802
+ drawerHeader: theme => ({
22803
+ alignItems: "center",
22804
+ display: "flex",
22805
+ gap: theme.spacing(2),
22806
+ justifyContent: "end",
22807
+ width: "50%"
22808
+ }),
22809
+ drawerWrapper: {
22810
+ display: "flex",
22811
+ justifyContent: "space-between",
22812
+ position: "relative"
22813
+ },
22814
+ header: {
22815
+ alignItems: "center",
22816
+ display: "flex",
22817
+ justifyContent: "space-between"
22818
+ },
22819
+ popoverWrapper: theme => ({
22820
+ display: "flex",
22821
+ flexDirection: "column",
22822
+ gap: theme.spacing(1)
22823
+ }),
22824
+ pre: theme => ({
22825
+ backgroundColor: "#FFFFFF66",
22826
+ borderRadius: "8px",
22827
+ fontSize: "14px",
22828
+ padding: theme.spacing(0.3)
22829
+ }),
22830
+ presetOption: theme => ({
22831
+ "&:hover": {
22832
+ backgroundColor: "theme.palette.gray.ultraLight"
22833
+ },
22834
+ backgroundColor: "transparent",
22835
+ borderRadius: "4px",
22836
+ fontSize: "14px",
22837
+ padding: theme.spacing(1)
22838
+ }),
22839
+ presetsButton: theme => ({
22840
+ "&:hover": {
22841
+ backgroundColor: "#d1d4d7"
22842
+ },
22843
+ backgroundColor: "#E4E5E7",
22844
+ borderRadius: "4px",
22845
+ cursor: "pointer",
22846
+ display: "flex",
22847
+ fontSize: "14px",
22848
+ gap: theme.spacing(0.5),
22849
+ padding: `${theme.spacing(0.5)}px ${theme.spacing(1)}px`
22850
+ })
22851
+ });
22852
+
22853
+ const ThemeCreator = ({
22854
+ themeConfig,
22855
+ onUpdateThemeConfig,
22856
+ presets,
22857
+ showDrawer
22858
+ }) => {
22859
+ const defaultThemeConfigRef = useRef(themeConfig);
22860
+ const [isDrawerOpen, setIsDrawerOpen] = useState(false);
22861
+ const globalKeys = Object.keys(themeConfig);
22862
+ // If the themeConfig has a "components" key, show only the child component keys, not "components" itself
22863
+ const tabs = globalKeys.flatMap(key => {
22864
+ if (key === "components" && themeConfig[key] && typeof themeConfig[key] === "object") {
22865
+ const childComponentKeys = Object.keys(themeConfig[key]);
22866
+ return childComponentKeys;
22867
+ } else {
22868
+ return [key];
22869
+ }
22870
+ });
22871
+ const formattedThemeTabs = tabs.map(tab => {
22872
+ if (tab === "palette") {
22873
+ return "Color Palette";
22874
+ }
22875
+ return capitalizeFirstLetter(tab);
22876
+ });
22877
+ const [selectedTab, setSelectedTab] = useState(formattedThemeTabs.sort()[0]);
22878
+ const handleSelectedTab = tab => {
22879
+ setSelectedTab(tab);
22880
+ };
22881
+ const formatKey = key => addSpaceBetweenWords(pascalize(key));
22882
+ const renderContentBySelectedTab = (themeConfig, selectedTab) => {
22883
+ var _a;
22884
+ switch (selectedTab) {
22885
+ case "Color Palette":
22886
+ return jsx(ColorPaletteEditor, {
22887
+ formatKey: formatKey,
22888
+ onUpdatePaletteConfig: updatedPalette => {
22889
+ onUpdateThemeConfig(Object.assign(Object.assign({}, themeConfig), {
22890
+ palette: updatedPalette
22891
+ }));
22892
+ },
22893
+ paletteConfig: themeConfig.palette
22894
+ });
22895
+ case "Typography":
22896
+ return jsx(TypographyEditor, {
22897
+ formatKey: formatKey,
22898
+ onUpdateTypographyConfig: updatedTypography => {
22899
+ onUpdateThemeConfig(Object.assign(Object.assign({}, themeConfig), {
22900
+ components: Object.assign(Object.assign({}, themeConfig.components), {
22901
+ Typography: updatedTypography
22902
+ })
22903
+ }));
22904
+ },
22905
+ typographyConfig: (_a = themeConfig.components) === null || _a === void 0 ? void 0 : _a.Typography
22906
+ });
22907
+ default:
22908
+ return null;
22909
+ }
22910
+ };
22911
+ // const formattedThemeObj = `const theme = ${JSON.stringify(themeConfig, null, 2)}`;
22912
+ const presetsRef = useRef(null);
22913
+ const [showPresets, toggleShowPresets] = useToggle(false);
22914
+ const applyPreset = theme => {
22915
+ onUpdateThemeConfig(theme);
22916
+ };
22917
+ return jsxs("div", Object.assign({
22918
+ "aria-label": "Theme Creator",
22919
+ css: styles$5.container,
22920
+ "data-testid": "theme-creator",
22921
+ role: "region"
22922
+ }, {
22923
+ children: [jsxs("div", Object.assign({
22924
+ css: styles$5.content
22925
+ }, {
22926
+ children: [jsxs("div", Object.assign({
22927
+ css: styles$5.header
22928
+ }, {
22929
+ children: [jsx(Tabs, {
22930
+ onSelectTab: handleSelectedTab,
22931
+ selectedTab: selectedTab,
22932
+ tabs: formattedThemeTabs
22933
+ }), presets ? jsxs("div", {
22934
+ children: [jsxs("button", Object.assign({
22935
+ "aria-controls": "presets-popover",
22936
+ "aria-expanded": showPresets,
22937
+ css: styles$5.presetsButton,
22938
+ onClick: e => {
22939
+ e.preventDefault();
22940
+ toggleShowPresets();
22941
+ },
22942
+ ref: presetsRef
22943
+ }, {
22944
+ children: ["Presets", jsx(Icon, {
22945
+ name: IconNames.CARET_BOTTOM,
22946
+ size: IconSize.SIZE_SMALL
22947
+ })]
22948
+ })), jsx(Popover, Object.assign({
22949
+ container: document.querySelector("#theme-creator"),
22950
+ isOpen: showPresets,
22951
+ onClickAway: () => toggleShowPresets(),
22952
+ placement: "bottom-end",
22953
+ reference: presetsRef.current
22954
+ }, {
22955
+ children: jsxs("div", Object.assign({
22956
+ css: styles$5.popoverWrapper
22957
+ }, {
22958
+ children: [jsx("button", Object.assign({
22959
+ "aria-label": "Set Default Theme",
22960
+ css: styles$5.presetOption,
22961
+ onClick: e => {
22962
+ e.preventDefault();
22963
+ toggleShowPresets();
22964
+ applyPreset(defaultThemeConfigRef.current);
22965
+ },
22966
+ role: "menuitem"
22967
+ }, {
22968
+ children: "Default"
22969
+ })), presets.map(preset => jsx("button", Object.assign({
22970
+ "aria-label": `Set ${preset.presetName} Theme`,
22971
+ css: styles$5.presetOption,
22972
+ onClick: e => {
22973
+ e.preventDefault();
22974
+ toggleShowPresets();
22975
+ applyPreset(preset.themeConfig);
22976
+ },
22977
+ role: "menuitem"
22978
+ }, {
22979
+ children: preset.presetName
22980
+ }), preset.presetName))]
22981
+ }))
22982
+ }))]
22983
+ }) :
22984
+ //reset to default button
22985
+ jsx("button", Object.assign({
22986
+ "aria-label": "Set Default Theme",
22987
+ css: styles$5.presetsButton,
22988
+ onClick: () => {
22989
+ applyPreset(defaultThemeConfigRef.current);
22990
+ },
22991
+ role: "menuitem"
22992
+ }, {
22993
+ children: "Reset to Default"
22994
+ }))]
22995
+ })), jsx(Typography, Object.assign({
22996
+ role: "heading",
22997
+ variant: "heading4"
22998
+ }, {
22999
+ children: `${selectedTab} Editor`
23000
+ })), renderContentBySelectedTab(themeConfig, selectedTab)]
23001
+ })), showDrawer && jsx(Drawer, Object.assign({
23002
+ "aria-label": "Show themeConfig.js Code Drawer",
23003
+ headerContent: jsxs("div", Object.assign({
23004
+ css: styles$5.drawerHeader
23005
+ }, {
23006
+ children: [jsx("pre", Object.assign({
23007
+ css: styles$5.pre
23008
+ }, {
23009
+ children: "themeConfig.js"
23010
+ })), showDrawer.copyToClipboardText && jsx("div", Object.assign({
23011
+ css: styles$5.copy
23012
+ }, {
23013
+ children: jsx(CopyButton, {
23014
+ content: showDrawer.copyToClipboardText
23015
+ })
23016
+ }))]
23017
+ })),
23018
+ isOpen: isDrawerOpen,
23019
+ toggleDrawer: () => setIsDrawerOpen(!isDrawerOpen)
23020
+ }, {
23021
+ children: showDrawer.content
23022
+ }))]
23023
+ }));
23024
+ };
23025
+
23026
+ const Component$5 = ({
23027
+ onRowClick
23028
+ }) => {
22779
23029
  const {
22780
23030
  t
22781
- } = useTranslation();
22782
- const label = useGetLabel(labelId);
22783
- const shipment = useGetSalesOrderShipment((_a = label.data) === null || _a === void 0 ? void 0 : _a.shipmentId);
22784
- const voidLabel = useVoidLabel();
22785
- if (label.isInitialLoading) return jsx(Loader, {
22786
- message: t("loading.label")
23031
+ } = useTranslation(["common", "list-labels"]);
23032
+ const {
23033
+ page,
23034
+ pageSize,
23035
+ pagerProps
23036
+ } = usePager();
23037
+ const {
23038
+ data: carriersData,
23039
+ isLoading: carriersLoading
23040
+ } = useListCarriers();
23041
+ const {
23042
+ data: labelsData,
23043
+ isLoading,
23044
+ isError,
23045
+ error
23046
+ } = useListLabels({
23047
+ page,
23048
+ pageSize
22787
23049
  });
22788
- if (shipment.isInitialLoading) return jsx(Loader, {
22789
- message: t("loading.shipment")
23050
+ const shipmentIds = (labelsData === null || labelsData === void 0 ? void 0 : labelsData.labels) ? labelsData.labels.filter(l => l.shipmentId).map(l => l.shipmentId) : [];
23051
+ const {
23052
+ data: shipmentsData,
23053
+ isLoading: shipmentsLoading
23054
+ } = useListSalesOrderShipments({
23055
+ shipmentIds
22790
23056
  });
22791
- throwAny(label.error);
22792
- throwAny(shipment.error);
22793
- if (!label.data) throw new Error("errorMessages.unableToLoad.label");
22794
- if (!shipment.data) throw new Error("errorMessages.unableToLoad.shipment");
22795
- const handleVoidLabelSubmit = () => __awaiter(void 0, void 0, void 0, function* () {
22796
- const result = yield voidLabel.mutateAsync(labelId);
22797
- if (result.approved) {
22798
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(label.data, shipment.data);
22799
- }
23057
+ if (isLoading) return jsx(Loader, {
23058
+ message: t("loading.labels")
22800
23059
  });
22801
- return jsxs(Fragment, {
22802
- children: [jsx(Message, {
22803
- voidRequest: voidLabel.data
22804
- }), jsx(Actions, {
22805
- onComplete: onComplete,
22806
- onSubmit: handleVoidLabelSubmit,
22807
- onViewShipment: onViewShipment,
22808
- shipment: shipment.data,
22809
- voidRequest: voidLabel.data
22810
- }), ((_b = features === null || features === void 0 ? void 0 : features.presentation) === null || _b === void 0 ? void 0 : _b.poweredByShipEngine) && jsxs(Fragment, {
22811
- children: [jsx(Spacer, {}), jsx(PoweredByShipEngine, {})]
22812
- })]
23060
+ if (isError) throw new Error(error.map(e => e.message).join(", "));
23061
+ if (!labelsData) throw new Error(t("errorMessages.unableToLoad.labels"));
23062
+ const columns = [{
23063
+ headerContent: t("list-labels:headers.labelId"),
23064
+ renderCellContent: data => {
23065
+ return jsx("div", {
23066
+ children: data.labelId
23067
+ });
23068
+ }
23069
+ }, {
23070
+ headerContent: t("list-labels:headers.created"),
23071
+ renderCellContent: data => {
23072
+ return (data === null || data === void 0 ? void 0 : data.shipDate) && jsx(CellFormattedDate, {
23073
+ date: data.shipDate
23074
+ });
23075
+ }
23076
+ }, {
23077
+ headerContent: t("list-labels:headers.shipTo"),
23078
+ renderCellContent: data => {
23079
+ const labelShipment = shipmentsData === null || shipmentsData === void 0 ? void 0 : shipmentsData.find(s => s.shipmentId === data.shipmentId);
23080
+ const displayAddress = labelShipment && labelShipment.shipTo.addressLine1 ? jsx(AddressDisplay, {
23081
+ address: labelShipment.shipTo
23082
+ }) : "--";
23083
+ return jsx(SuspendText, Object.assign({
23084
+ loading: shipmentsLoading
23085
+ }, {
23086
+ children: displayAddress
23087
+ }));
23088
+ }
23089
+ }, {
23090
+ headerContent: t("list-labels:headers.service"),
23091
+ renderCellContent: data => {
23092
+ if (!carriersLoading && carriersData) {
23093
+ const carrier = carriersData.find(c => c.carrierCode === data.carrierCode);
23094
+ if (carrier) {
23095
+ const service = carrier.services.find(s => s.serviceCode === data.serviceCode);
23096
+ if (service) {
23097
+ return jsxs("div", {
23098
+ children: [jsx(CarrierIcon, {
23099
+ carrierCode: data.carrierCode
23100
+ }, data.carrierCode), "\u00A0 ", service.name]
23101
+ });
23102
+ }
23103
+ }
23104
+ }
23105
+ return jsxs(SuspendText, Object.assign({
23106
+ loading: carriersLoading
23107
+ }, {
23108
+ children: ["`$", data.carrierCode, " - $", data.serviceCode, "`"]
23109
+ }));
23110
+ }
23111
+ }, {
23112
+ // Download
23113
+ headerContent: jsx("div", {
23114
+ "aria-label": t("list-labels:headers.download")
23115
+ }),
23116
+ renderCellContent: data => {
23117
+ if (data.status === "completed") return jsx("div", Object.assign({
23118
+ css: {
23119
+ textAlign: "right"
23120
+ }
23121
+ }, {
23122
+ children: jsx(ButtonIcon, {
23123
+ ariaDescribedby: "",
23124
+ children: t("list-labels:actions.download.pdf"),
23125
+ icon: IconNames.DOWNLOAD,
23126
+ onClick: e => {
23127
+ e.stopPropagation();
23128
+ window.open(data.labelDownload.pdf);
23129
+ }
23130
+ })
23131
+ }));
23132
+ return jsx("div", Object.assign({
23133
+ css: {
23134
+ textAlign: "right"
23135
+ }
23136
+ }, {
23137
+ children: jsx(Tag, Object.assign({
23138
+ color: TagColor.INFO
23139
+ }, {
23140
+ children: data.status.toLocaleUpperCase()
23141
+ }))
23142
+ }));
23143
+ }
23144
+ }];
23145
+ return jsx(GridController, {
23146
+ columns: columns,
23147
+ data: labelsData.labels,
23148
+ footerContent: jsx(Pager, Object.assign({}, pagerProps, {
23149
+ pagingData: labelsData
23150
+ })),
23151
+ onRowClick: onRowClick
22813
23152
  });
22814
23153
  };
22815
- /**
22816
- * # Registered Void Label Element
22817
- *
22818
- * - This is the registered `<VoidLabel />` element that will be used to render the
22819
- * `<VoidLabel.Element />` component.
22820
- *
22821
- * @param ElementProps The props, callbacks, and resources necessary to render
22822
- * the `<VoidLabel.Element />` component.
22823
- *
22824
- * @example
22825
- * The `<Component />` is the source JSX that is rendered when you make use of the `VoidLabel`
22826
- * Element directly. Here is a brief example of how you would use it within your application.
22827
- * ```tsx
22828
- * <VoidLabel.Element
22829
- * labelId="se-1234567"
22830
- * onComplete={() => console.log('onComplete')}
22831
- * onSuccess={(_, { salesOrderIds: [salesOrderId] }) =>
22832
- * console.log('sales order ID', salesOrderId)
22833
- * }
22834
- * onViewShipment={({ shipmentId }) => {
22835
- * console.log('onViewShipment', shipmentId);
22836
- * }}
22837
- * />
22838
- * ```
22839
- *
22840
- * <br />
22841
- *
22842
- * @see {@link VoidLabel.ComponentProps | The **props** that can be passed into the `<VoidLabel.Element />` component}
22843
- *
22844
- * @see {@link PurchaseLabel.Element | Go back to the frst step in the label purchase workflow `<PurchaseLabel.Element />`}
22845
- */
22846
- const Element$3 = alchemy.createElement(Component$2, ErrorFallback, {
23154
+ const Element$6 = alchemy.createElement(Component$5, ErrorFallback, {
22847
23155
  css: {
22848
23156
  height: "100%",
22849
- maxWidth: "800px",
22850
23157
  minWidth: "440px",
22851
23158
  width: "100%"
22852
23159
  },
@@ -22855,686 +23162,600 @@ const Element$3 = alchemy.createElement(Component$2, ErrorFallback, {
22855
23162
  }
22856
23163
  });
22857
23164
 
22858
- var voidLabel = /*#__PURE__*/Object.freeze({
23165
+ var labelsGrid = /*#__PURE__*/Object.freeze({
22859
23166
  __proto__: null,
22860
- Component: Component$2,
22861
- Element: Element$3
23167
+ Element: Element$6
22862
23168
  });
22863
23169
 
22864
23170
  /**
22865
- * @internal
23171
+ * # View Shipment Component
22866
23172
  *
22867
- * # Label Workflow Component
23173
+ * - The `<ViewShipment />` component is used to for viewing the shipment's tracking number, printing the label that
23174
+ * was created, and the option to void the label. When a label is voided, you can see a list of the
23175
+ * previously voided labels for a given shipment using this component.
23176
+ *
23177
+ * @param ComponentProps The base props that will be passed into the `<ViewShipment />` component.
23178
+ *
23179
+ * @returns Element An EmotionJSX.Element that will render the `<ViewShipment />` component
23180
+ * with all the appropriate wrappers.
22868
23181
  *
22869
23182
  * @example
23183
+ * You can see how the `<Component />` is used in the `createElement` function call below.
22870
23184
  * ```tsx
22871
- * const {
22872
- * labelId,
22873
- * multiplexedId,
22874
- * isVoidingLabel,
22875
- * shipmentId,
22876
- * setLabelId,
22877
- * setShipmentId,
22878
- * setIsVoidingLabel,
22879
- * } = useLabelWorkflow({
22880
- * _labelId,
22881
- * _multiplexedId,
22882
- * });
23185
+ * export const Element = alchemy.createElement(Component, ErrorFallback, {
23186
+ * css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
23187
+ * resources: { en },
23188
+ * });
22883
23189
  * ```
22884
23190
  *
22885
23191
  * <br />
22886
23192
  *
22887
- * @see {@link LabelWorkflow.Element | The `<LabelWorkflow.Element />` component using this hook}
23193
+ * @see {@link ViewShipment.Element | The **Element** created to render `<ViewShipment />`}
22888
23194
  */
22889
- const useLabelWorkflow = ({
22890
- _multiplexedId,
22891
- _labelId
23195
+ const Component$4 = ({
23196
+ features,
23197
+ onClickPrintLabel,
23198
+ onClickPurchaseLabel,
23199
+ onClickVoidLabel,
23200
+ shipmentId
22892
23201
  }) => {
22893
- // Fix first ids as the user of the library shouldn't be changing them
22894
- const [multiplexedId, setMultiplexedId] = useState(_multiplexedId);
22895
- const [shipmentId, setShipmentId] = useState("shipmentId" in _multiplexedId ? _multiplexedId.shipmentId : undefined);
22896
- const [labelId, _setLabelId] = useState(_labelId);
22897
- const [isVoidingLabel, setIsVoidingLabel] = useState(false);
22898
- const setLabelId = useCallback(nextLabelId => {
22899
- setIsVoidingLabel(false);
22900
- _setLabelId(nextLabelId);
22901
- }, []);
22902
- return {
22903
- isVoidingLabel,
22904
- labelId,
22905
- multiplexedId,
22906
- setIsVoidingLabel,
22907
- setLabelId,
22908
- setMultiplexedId,
22909
- setShipmentId,
23202
+ var _a, _b, _c;
23203
+ const {
23204
+ t
23205
+ } = useTranslation(["common", "view-shipment"]);
23206
+ const shipment = useGetSalesOrderShipment(shipmentId);
23207
+ const {
23208
+ data: {
23209
+ labels = []
23210
+ } = {}
23211
+ } = useListLabels({
22910
23212
  shipmentId
22911
- };
23213
+ });
23214
+ const salesOrder = useGetSalesOrder((_b = (_a = shipment.data) === null || _a === void 0 ? void 0 : _a.salesOrderIds) === null || _b === void 0 ? void 0 : _b[0]);
23215
+ const warehouses = useListWarehouses();
23216
+ const carriers = useListCarriers();
23217
+ if (shipment.isInitialLoading) return jsx(Loader, {
23218
+ message: t("loading.shipment")
23219
+ });
23220
+ if (shipment.error) throw new Error(shipment.error.map(e => e.message).join(", "));
23221
+ if (!shipment.data) throw new Error("errorMessages.unableToLoad.shipment");
23222
+ const warehouse = (_c = warehouses.data) === null || _c === void 0 ? void 0 : _c.find(w => {
23223
+ var _a;
23224
+ return w.warehouseId === ((_a = shipment.data) === null || _a === void 0 ? void 0 : _a.warehouseId);
23225
+ });
23226
+ return jsx(Shipment, {
23227
+ carriers: carriers.data,
23228
+ features: features,
23229
+ labels: labels,
23230
+ onClickPrintLabel: onClickPrintLabel,
23231
+ onClickPurchaseLabel: onClickPurchaseLabel,
23232
+ onClickVoidLabel: onClickVoidLabel,
23233
+ salesOrder: salesOrder.data,
23234
+ shipment: shipment.data,
23235
+ warehouse: warehouse
23236
+ });
22912
23237
  };
22913
23238
  /**
22914
- * @internal
22915
- *
22916
- * # Label Workflow Element
22917
- *
22918
- * - The `<LabelWorkflow.Element />` component is a composition of the PurchaseLabel, ViewShipment,
22919
- * and VoidLabel elements that allows users to purchase a label, view the shipment details, and optionally void their shipping label.
23239
+ * # Registered View Shipment Element
22920
23240
  *
22921
- * @param LabelWorkflowProps The props necessary to render the `<LabelWorkflow.Element />` for shipment
22922
- * based or sales order based label purchasing.
23241
+ * - This is the registered `<ViewShipment />` element that will be used to render the
23242
+ * `<ViewShipment.Element />` component.
22923
23243
  *
22924
- * @returns Element A React Element that will render the `<LabelWorkflow />` component.
23244
+ * @param ElementProps The props, callbacks, and resources necessary to render
23245
+ * the `<ViewShipment.Element />` component.
22925
23246
  *
22926
23247
  * @example
23248
+ * The `<Component />` is the source JSX that is rendered when you make use of the `ViewShipment`
23249
+ * Element directly. Here is a brief example of how you would use it within your application.
22927
23250
  * ```tsx
22928
- * <LabelWorkflow
22929
- * {...elementProps}
22930
- * callbacks={{ onLabelCreateSuccess }}
22931
- * multiplexedId={elementIdProps}
23251
+ * <ViewShipment.Element
23252
+ * onClickPurchaseLabel={({ salesOrderId }) => {
23253
+ * console.log('sales order ID', salesOrderId);
23254
+ * }}
23255
+ * onClickVoidLabel={({ labelId }) => {
23256
+ * console.log('voided label', labelId);
23257
+ * }}
23258
+ * shipmentId="se-1234567"
22932
23259
  * />
22933
23260
  * ```
22934
23261
  *
22935
23262
  * <br />
22936
23263
  *
22937
- * @see {@link LabelWorkflowProps | The props that are passed into the `<LabelWorkflow />` component}
22938
- * @see {@link LabelWorkflow.useLabelWorkflow | The `hook` that is used to manage the state of the `<LabelWorkflow />` component}
22939
- */
22940
- const Element$2 = (
22941
- /*
22942
- The passed props are underscore prefixed as they will be stashed, then from them stateful versions will be made
22943
- */
22944
- {
22945
- multiplexedId: _multiplexedId,
22946
- labelId: _labelId,
22947
- features: propFeatures,
22948
- callbacks
22949
- }) => {
22950
- const {
22951
- labelId,
22952
- multiplexedId,
22953
- isVoidingLabel,
22954
- shipmentId,
22955
- setLabelId,
22956
- setShipmentId,
22957
- setIsVoidingLabel
22958
- } = useLabelWorkflow({
22959
- _labelId,
22960
- _multiplexedId
22961
- });
22962
- const _features = useFeatures("Globals");
22963
- const features = useMemo(() => {
22964
- var _a;
22965
- return Object.assign(Object.assign(Object.assign({}, propFeatures), _features), {
22966
- global: Object.assign(Object.assign({}, _features.global), {
22967
- presentation: Object.assign(Object.assign({}, (_a = _features.global) === null || _a === void 0 ? void 0 : _a.presentation), {
22968
- poweredByShipEngine: true
22969
- })
22970
- })
22971
- });
22972
- }, []);
22973
- return !labelId ? jsx(Element$5, Object.assign({}, multiplexedId, {
22974
- features: features,
22975
- onLabelCreateSuccess: (label, shipment) => {
22976
- var _a;
22977
- setLabelId(label.labelId);
22978
- setShipmentId(shipment.shipmentId);
22979
- (_a = callbacks === null || callbacks === void 0 ? void 0 : callbacks.onLabelCreateSuccess) === null || _a === void 0 ? void 0 : _a.call(callbacks, label, shipment);
22980
- },
22981
- onLoad: (salesOrder, shipments, pendingShipment) => {
22982
- if (shipments.length > 0) {
22983
- setShipmentId(prior => prior !== undefined ? prior : shipments[0].shipmentId);
22984
- }
22985
- }
22986
- })) : !isVoidingLabel ? jsx(Element$4, {
22987
- features: features,
22988
- onClickPurchaseLabel: () => {
22989
- setLabelId(undefined);
22990
- },
22991
- onClickVoidLabel: () => {
22992
- setIsVoidingLabel(true);
22993
- },
22994
- shipmentId: shipmentId
22995
- }) : jsx(Element$3, {
22996
- features: features,
22997
- labelId: labelId,
22998
- onComplete: () => {
22999
- setIsVoidingLabel(false);
23000
- },
23001
- onViewShipment: () => {
23002
- setIsVoidingLabel(false);
23003
- }
23004
- });
23005
- };
23006
-
23007
- var labelWorkflow = /*#__PURE__*/Object.freeze({
23008
- __proto__: null,
23009
- useLabelWorkflow: useLabelWorkflow,
23010
- Element: Element$2
23264
+ * @see {@link ViewShipment.ComponentProps | The **props** that can be passed into the `<ViewShipment.Element />` component}
23265
+ *
23266
+ * @see {@link VoidLabel.Element | The next step in the label purchase workflow `<VoidLabel.Element />`}
23267
+ **/
23268
+ const Element$5 = alchemy.createElement(Component$4, ErrorFallback, {
23269
+ css: {
23270
+ height: "100%",
23271
+ maxWidth: "800px",
23272
+ minWidth: "440px",
23273
+ width: "100%"
23274
+ },
23275
+ resources: {
23276
+ en
23277
+ }
23011
23278
  });
23012
23279
 
23013
- const ThemeCreatorContext = /*#__PURE__*/createContext(undefined);
23014
- const ThemeCreatorProvider = ({
23015
- children,
23016
- editableTheme
23017
- }) => {
23018
- const [themeConfig, setThemeConfig] = useState(editableTheme);
23019
- return jsx(ThemeCreatorContext.Provider, Object.assign({
23020
- value: {
23021
- setThemeConfig,
23022
- themeConfig
23023
- }
23024
- }, {
23025
- children: children
23026
- }));
23027
- };
23028
- const useThemeCreator = () => {
23029
- const themeCreatorContext = useContext(ThemeCreatorContext);
23030
- if (!themeCreatorContext) throw new Error("useThemeConfigurator must be used within a ThemeConfiguratorProvider");
23031
- return themeCreatorContext;
23032
- };
23033
-
23034
- const styles$7 = createStyles({
23035
- category: {
23036
- alignItems: "center",
23037
- cursor: "pointer",
23038
- display: "flex",
23039
- flexDirection: "row",
23040
- justifyContent: "space-between"
23041
- },
23042
- colorPicker: theme => ({
23043
- "&::-webkit-color-swatch": {
23044
- border: `1px solid ${theme.palette.gray.light}`,
23045
- borderRadius: "4px",
23046
- padding: 0
23047
- },
23048
- "&::-webkit-color-swatch-wrapper": {
23049
- padding: 0
23050
- },
23051
- alignSelf: "center",
23052
- appearance: "none",
23053
- background: "none",
23054
- border: 0,
23055
- cursor: "pointer",
23056
- height: theme.spacing(4.25),
23057
- outline: "none",
23058
- width: theme.spacing(4.25)
23059
- }),
23060
- container: theme => ({
23061
- marginBottom: theme.spacing(2)
23062
- }),
23063
- input: theme => ({
23064
- border: `1px solid ${theme.palette.gray.light}`,
23065
- borderRadius: "4px",
23066
- color: theme.palette.gray.main,
23067
- fontSize: "14px",
23068
- padding: theme.spacing(1)
23069
- }),
23070
- inputContainer: theme => ({
23071
- alignItems: "center",
23072
- display: "flex",
23073
- flexDirection: "row",
23074
- justifyContent: "space-between",
23075
- padding: `${theme.spacing(2)}px 0`
23076
- }),
23077
- wrapper: theme => ({
23078
- display: "flex",
23079
- gap: theme.spacing(1)
23080
- })
23280
+ var viewShipment = /*#__PURE__*/Object.freeze({
23281
+ __proto__: null,
23282
+ Component: Component$4,
23283
+ Element: Element$5
23081
23284
  });
23082
23285
 
23083
- const ColorPaletteEditor = ({
23084
- paletteConfig,
23085
- onUpdatePaletteConfig,
23086
- formatKey
23286
+ const Actions = ({
23287
+ onComplete,
23288
+ onSubmit,
23289
+ onViewShipment,
23290
+ shipment,
23291
+ voidRequest
23087
23292
  }) => {
23088
- const [expandedCategories, setExpandedCategories] = useState(new Set());
23089
- const toggleExpandedCategories = category => {
23090
- setExpandedCategories(prev => {
23091
- const openCategories = new Set(prev);
23092
- if (openCategories.has(category)) {
23093
- return new Set([...openCategories].filter(item => item !== category));
23094
- } else {
23095
- return new Set([...openCategories, category]);
23096
- }
23097
- });
23098
- };
23099
- const handleInputChange = useCallback((category, key, value) => {
23100
- const updatedConfig = Object.assign(Object.assign({}, paletteConfig || {}), {
23101
- [category]: Object.assign(Object.assign({}, (paletteConfig === null || paletteConfig === void 0 ? void 0 : paletteConfig[category]) || {}), {
23102
- [key]: value
23103
- })
23104
- });
23105
- onUpdatePaletteConfig(updatedConfig);
23106
- }, [onUpdatePaletteConfig, paletteConfig]);
23107
- return jsx("div", Object.assign({
23108
- "data-test-id": "color-palette-editor"
23293
+ const {
23294
+ t
23295
+ } = useTranslation(["common", "void-label"]);
23296
+ const [isSubmitting, setIsSubmitting] = useState(false);
23297
+ const handleSubmit = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
23298
+ setIsSubmitting(true);
23299
+ yield onSubmit();
23300
+ setIsSubmitting(false);
23301
+ }), [onSubmit]);
23302
+ return jsx(BottomSheet, Object.assign({
23303
+ alwaysVisible: true,
23304
+ css: theme => ({
23305
+ borderTop: `1px solid ${theme.palette.gray.ultraLight}`,
23306
+ boxShadow: "none",
23307
+ position: "static"
23308
+ })
23109
23309
  }, {
23110
- children: paletteConfig && Object.keys(paletteConfig).map(category => jsxs("div", Object.assign({
23111
- css: styles$7.container,
23112
- id: category
23113
- }, {
23114
- children: [jsxs("div", Object.assign({
23115
- "aria-expanded": expandedCategories.has(category),
23116
- css: styles$7.category,
23117
- onClick: event => {
23118
- event.preventDefault();
23119
- toggleExpandedCategories(category);
23120
- },
23121
- role: "button"
23310
+ children: (voidRequest === null || voidRequest === void 0 ? void 0 : voidRequest.approved) ?
23311
+ // The void request has been approved
23312
+ jsxs(ButtonGroup, {
23313
+ children: [jsx(Button, Object.assign({
23314
+ bold: false,
23315
+ onClick: () => onComplete(voidRequest, shipment),
23316
+ variant: ButtonVariant.OUTLINED
23122
23317
  }, {
23123
- children: [jsx("p", {
23124
- children: capitalizeFirstLetter(category)
23125
- }), jsx(Icon, {
23126
- name: expandedCategories.has(category) ? IconNames.CHEVRON_TOP : IconNames.CHEVRON_BOTTOM,
23127
- size: IconSize.SIZE_REGULAR
23128
- })]
23129
- })), expandedCategories.has(category) && Object.keys(paletteConfig[category]).map(key => jsxs("div", Object.assign({
23130
- css: styles$7.inputContainer,
23131
- id: "input-container"
23318
+ children: t("void-label:actions.complete")
23319
+ })), jsx(Button, Object.assign({
23320
+ bold: false,
23321
+ isFullWidth: true,
23322
+ onClick: () => onViewShipment(shipment)
23132
23323
  }, {
23133
- children: [jsx("label", Object.assign({
23134
- css: {
23135
- fontWeight: "bold"
23136
- },
23137
- htmlFor: `${category}.${key}`
23324
+ children: t("void-label:actions.viewShipment")
23325
+ }))]
23326
+ }) :
23327
+ // The void request has yet to be made or was rejected
23328
+ jsx(Button, Object.assign({
23329
+ bold: false,
23330
+ isFullWidth: true,
23331
+ isLoading: isSubmitting,
23332
+ onClick: handleSubmit
23333
+ }, {
23334
+ children: t("void-label:actions.confirmVoid")
23335
+ }))
23336
+ }));
23337
+ };
23338
+
23339
+ const Message = ({
23340
+ voidRequest
23341
+ }) => {
23342
+ const {
23343
+ t
23344
+ } = useTranslation(["common", "void-label"]);
23345
+ return jsx(Section, {
23346
+ children: voidRequest ? jsxs("section", Object.assign({
23347
+ css: {
23348
+ textAlign: "center",
23349
+ width: "100%"
23350
+ }
23351
+ }, {
23352
+ children: [jsx(Icon, {
23353
+ css: theme => ({
23354
+ color: (voidRequest === null || voidRequest === void 0 ? void 0 : voidRequest.approved) ? theme.palette.success.main : theme.palette.error.main
23355
+ }),
23356
+ name: (voidRequest === null || voidRequest === void 0 ? void 0 : voidRequest.approved) ? IconNames.CHECK_FILLED : IconNames.ALERT,
23357
+ size: IconSize.SIZE_LARGE
23358
+ }), (voidRequest === null || voidRequest === void 0 ? void 0 : voidRequest.approved) ? jsxs(Fragment, {
23359
+ children: [jsx(Typography, Object.assign({
23360
+ component: "h2"
23138
23361
  }, {
23139
- children: formatKey(key)
23140
- })), jsxs("form", Object.assign({
23141
- css: styles$7.wrapper
23362
+ children: t("void-label:resultTitles.approved")
23363
+ })), jsx(Typography, {
23364
+ children: t("void-label:resultMessages.approved")
23365
+ })]
23366
+ }) : jsxs(Fragment, {
23367
+ children: [jsx(Typography, Object.assign({
23368
+ component: "h2"
23142
23369
  }, {
23143
- children: [jsx("input", {
23144
- css: styles$7.input,
23145
- onChange: e => {
23146
- if (e.target.value.match(/^#[0-9A-Fa-f]{0,6}$/)) handleInputChange(category, key, e.target.value);
23147
- },
23148
- onKeyDown: e => {
23149
- if (e.key === "Enter") e.preventDefault();
23150
- },
23151
- type: "text",
23152
- value: paletteConfig[category][key]
23153
- }), jsx("input", {
23154
- css: styles$7.colorPicker,
23155
- onChange: e => handleInputChange(category, key, e.target.value),
23156
- type: "color",
23157
- value: paletteConfig[category][key]
23158
- })]
23159
- }))]
23160
- }), key))]
23161
- }), category))
23162
- }));
23370
+ children: t("void-label:resultTitles.rejected")
23371
+ })), jsx(Typography, {
23372
+ children: jsx("p", {
23373
+ dangerouslySetInnerHTML: {
23374
+ __html: t("void-label:resultMessages.rejected")
23375
+ }
23376
+ })
23377
+ })]
23378
+ })]
23379
+ })) : jsxs(Fragment, {
23380
+ children: [jsx(Typography, {
23381
+ children: t("void-label:refund_process")
23382
+ }), jsx(Typography, Object.assign({
23383
+ component: "p"
23384
+ }, {
23385
+ children: t("void-label:refund_rules")
23386
+ }))]
23387
+ })
23388
+ });
23163
23389
  };
23164
23390
 
23165
- const styles$6 = createStyles({
23166
- input: theme => ({
23167
- border: `1px solid ${theme.palette.gray.light}`,
23168
- borderRadius: "4px",
23169
- color: theme.palette.gray.main,
23170
- fontSize: "14px",
23171
- maxWidth: theme.spacing(16),
23172
- padding: 0
23173
- }),
23174
- keys: {
23175
- fontSize: "16px",
23176
- fontWeight: "bold",
23177
- marginTop: "8px"
23391
+ /**
23392
+ * # Void Label Component
23393
+ *
23394
+ * - The `<VoidLabel />` component is used to void a given shipping label. When a label is voided,
23395
+ * you then get the option to view the associated shipment via the `View Shipment` Element, or
23396
+ * you can purchase another label for the shipment via the `Purchase Label` Element.
23397
+ *
23398
+ * @param ComponentProps The base props that will be passed into the `<VoidLabel />` component.
23399
+ *
23400
+ * @returns Element An EmotionJSX.Element that will render the `<VoidLabel />` component
23401
+ * with all the appropriate wrappers.
23402
+ *
23403
+ * @example
23404
+ * You can see how the `<Component />` is used in the `createElement` function call below.
23405
+ * ```tsx
23406
+ * export const Element = alchemy.createElement(Component, ErrorFallback, {
23407
+ * css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
23408
+ * resources: { en },
23409
+ * });
23410
+ * ```
23411
+ *
23412
+ * <br />
23413
+ *
23414
+ * @see {@link VoidLabel.Element | The **Element** created to render `<VoidLabel />`}
23415
+ */
23416
+ const Component$3 = ({
23417
+ features,
23418
+ labelId,
23419
+ onComplete,
23420
+ onSuccess,
23421
+ onViewShipment
23422
+ }) => {
23423
+ var _a, _b;
23424
+ features = Object.assign({
23425
+ presentation: {
23426
+ poweredByShipEngine: false
23427
+ }
23428
+ }, features !== null && features !== void 0 ? features : {});
23429
+ // TODO [LMNT-910] - labelId should be a required prop
23430
+ if (!labelId) throw new Error("void-label:errorMessages.labelIdRequired");
23431
+ const {
23432
+ t
23433
+ } = useTranslation();
23434
+ const label = useGetLabel(labelId);
23435
+ const shipment = useGetSalesOrderShipment((_a = label.data) === null || _a === void 0 ? void 0 : _a.shipmentId);
23436
+ const voidLabel = useVoidLabel();
23437
+ if (label.isInitialLoading) return jsx(Loader, {
23438
+ message: t("loading.label")
23439
+ });
23440
+ if (shipment.isInitialLoading) return jsx(Loader, {
23441
+ message: t("loading.shipment")
23442
+ });
23443
+ throwAny(label.error);
23444
+ throwAny(shipment.error);
23445
+ if (!label.data) throw new Error("errorMessages.unableToLoad.label");
23446
+ if (!shipment.data) throw new Error("errorMessages.unableToLoad.shipment");
23447
+ const handleVoidLabelSubmit = () => __awaiter(void 0, void 0, void 0, function* () {
23448
+ const result = yield voidLabel.mutateAsync(labelId);
23449
+ if (result.approved) {
23450
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(label.data, shipment.data);
23451
+ }
23452
+ });
23453
+ return jsxs(Fragment, {
23454
+ children: [jsx(Message, {
23455
+ voidRequest: voidLabel.data
23456
+ }), jsx(Actions, {
23457
+ onComplete: onComplete,
23458
+ onSubmit: handleVoidLabelSubmit,
23459
+ onViewShipment: onViewShipment,
23460
+ shipment: shipment.data,
23461
+ voidRequest: voidLabel.data
23462
+ }), ((_b = features === null || features === void 0 ? void 0 : features.presentation) === null || _b === void 0 ? void 0 : _b.poweredByShipEngine) && jsxs(Fragment, {
23463
+ children: [jsx(Spacer, {}), jsx(PoweredByShipEngine, {})]
23464
+ })]
23465
+ });
23466
+ };
23467
+ /**
23468
+ * # Registered Void Label Element
23469
+ *
23470
+ * - This is the registered `<VoidLabel />` element that will be used to render the
23471
+ * `<VoidLabel.Element />` component.
23472
+ *
23473
+ * @param ElementProps The props, callbacks, and resources necessary to render
23474
+ * the `<VoidLabel.Element />` component.
23475
+ *
23476
+ * @example
23477
+ * The `<Component />` is the source JSX that is rendered when you make use of the `VoidLabel`
23478
+ * Element directly. Here is a brief example of how you would use it within your application.
23479
+ * ```tsx
23480
+ * <VoidLabel.Element
23481
+ * labelId="se-1234567"
23482
+ * onComplete={() => console.log('onComplete')}
23483
+ * onSuccess={(_, { salesOrderIds: [salesOrderId] }) =>
23484
+ * console.log('sales order ID', salesOrderId)
23485
+ * }
23486
+ * onViewShipment={({ shipmentId }) => {
23487
+ * console.log('onViewShipment', shipmentId);
23488
+ * }}
23489
+ * />
23490
+ * ```
23491
+ *
23492
+ * <br />
23493
+ *
23494
+ * @see {@link VoidLabel.ComponentProps | The **props** that can be passed into the `<VoidLabel.Element />` component}
23495
+ *
23496
+ * @see {@link PurchaseLabel.Element | Go back to the frst step in the label purchase workflow `<PurchaseLabel.Element />`}
23497
+ */
23498
+ const Element$4 = alchemy.createElement(Component$3, ErrorFallback, {
23499
+ css: {
23500
+ height: "100%",
23501
+ maxWidth: "800px",
23502
+ minWidth: "440px",
23503
+ width: "100%"
23178
23504
  },
23179
- section: theme => ({
23180
- "& > div:first-child": {
23181
- flexGrow: 3
23182
- },
23183
- "& > div:last-child": {
23184
- flexShrink: 1
23185
- },
23186
- display: "flex",
23187
- gap: theme.spacing(1),
23188
- justifyContent: "space-between"
23189
- }),
23190
- sectionContainer: theme => ({
23191
- marginBottom: theme.spacing(4)
23192
- }),
23193
- select: theme => ({
23194
- border: `1px solid ${theme.palette.gray.light}`,
23195
- borderRadius: "4px",
23196
- color: theme.palette.gray.main,
23197
- fontSize: "14px"
23198
- })
23505
+ resources: {
23506
+ en
23507
+ }
23199
23508
  });
23200
23509
 
23201
- const TypographyEditor = ({
23202
- onUpdateTypographyConfig,
23203
- typographyConfig,
23204
- formatKey
23510
+ var voidLabel = /*#__PURE__*/Object.freeze({
23511
+ __proto__: null,
23512
+ Component: Component$3,
23513
+ Element: Element$4
23514
+ });
23515
+
23516
+ /**
23517
+ * @internal
23518
+ *
23519
+ * # Label Workflow Component
23520
+ *
23521
+ * @example
23522
+ * ```tsx
23523
+ * const {
23524
+ * labelId,
23525
+ * multiplexedId,
23526
+ * isVoidingLabel,
23527
+ * shipmentId,
23528
+ * setLabelId,
23529
+ * setShipmentId,
23530
+ * setIsVoidingLabel,
23531
+ * } = useLabelWorkflow({
23532
+ * _labelId,
23533
+ * _multiplexedId,
23534
+ * });
23535
+ * ```
23536
+ *
23537
+ * <br />
23538
+ *
23539
+ * @see {@link LabelWorkflow.Element | The `<LabelWorkflow.Element />` component using this hook}
23540
+ */
23541
+ const useLabelWorkflow = ({
23542
+ _multiplexedId,
23543
+ _labelId
23205
23544
  }) => {
23206
- const handleInputChange = useCallback((variant, key, value) => {
23207
- const updatedConfig = Object.assign(Object.assign({}, typographyConfig || {}), {
23208
- [variant]: Object.assign(Object.assign({}, (typographyConfig === null || typographyConfig === void 0 ? void 0 : typographyConfig[variant]) || {}), {
23209
- [key]: value
23210
- })
23211
- });
23212
- onUpdateTypographyConfig(updatedConfig);
23213
- }, [onUpdateTypographyConfig, typographyConfig]);
23214
- const getNestedValue = useCallback((obj, key) => {
23215
- if (!obj) return undefined;
23216
- return obj[key];
23545
+ // Fix first ids as the user of the library shouldn't be changing them
23546
+ const [multiplexedId, setMultiplexedId] = useState(_multiplexedId);
23547
+ const [shipmentId, setShipmentId] = useState("shipmentId" in _multiplexedId ? _multiplexedId.shipmentId : undefined);
23548
+ const [labelId, _setLabelId] = useState(_labelId);
23549
+ const [isVoidingLabel, setIsVoidingLabel] = useState(false);
23550
+ const setLabelId = useCallback(nextLabelId => {
23551
+ setIsVoidingLabel(false);
23552
+ _setLabelId(nextLabelId);
23217
23553
  }, []);
23218
- const renderFontWeightSelect = (variant, key) => {
23219
- var _a;
23220
- const options = [{
23221
- label: "Normal",
23222
- value: "400"
23223
- }, {
23224
- label: "Semi Bold",
23225
- value: "600"
23226
- }, {
23227
- label: "Bold",
23228
- value: "700"
23229
- }];
23230
- const fontWeightValue = (_a = getNestedValue(typographyConfig, variant)) === null || _a === void 0 ? void 0 : _a.fontWeight.toString();
23231
- const selectOption = fontWeightValue !== undefined ? options.find(option => option.value === fontWeightValue) : undefined;
23232
- return jsx(Select$1, Object.assign({
23233
- css: styles$6.select,
23234
- label: "Font Weight",
23235
- name: "font-weight",
23236
- onChange: (_name, value) => handleInputChange(variant, key, value === null || value === void 0 ? void 0 : value.value),
23237
- value: selectOption
23238
- }, {
23239
- children: options.map(option => jsx(Option, Object.assign({
23240
- value: option.value
23241
- }, {
23242
- children: option.label
23243
- }), option.value))
23244
- }));
23554
+ return {
23555
+ isVoidingLabel,
23556
+ labelId,
23557
+ multiplexedId,
23558
+ setIsVoidingLabel,
23559
+ setLabelId,
23560
+ setMultiplexedId,
23561
+ setShipmentId,
23562
+ shipmentId
23245
23563
  };
23246
- const renderFontSizeInput = (variant, key) => {
23564
+ };
23565
+ /**
23566
+ * @internal
23567
+ *
23568
+ * # Label Workflow Element
23569
+ *
23570
+ * - The `<LabelWorkflow.Element />` component is a composition of the PurchaseLabel, ViewShipment,
23571
+ * and VoidLabel elements that allows users to purchase a label, view the shipment details, and optionally void their shipping label.
23572
+ *
23573
+ * @param LabelWorkflowProps The props necessary to render the `<LabelWorkflow.Element />` for shipment
23574
+ * based or sales order based label purchasing.
23575
+ *
23576
+ * @returns Element A React Element that will render the `<LabelWorkflow />` component.
23577
+ *
23578
+ * @example
23579
+ * ```tsx
23580
+ * <LabelWorkflow
23581
+ * {...elementProps}
23582
+ * callbacks={{ onLabelCreateSuccess }}
23583
+ * multiplexedId={elementIdProps}
23584
+ * />
23585
+ * ```
23586
+ *
23587
+ * <br />
23588
+ *
23589
+ * @see {@link LabelWorkflowProps | The props that are passed into the `<LabelWorkflow />` component}
23590
+ * @see {@link LabelWorkflow.useLabelWorkflow | The `hook` that is used to manage the state of the `<LabelWorkflow />` component}
23591
+ */
23592
+ const Element$3 = (
23593
+ /*
23594
+ The passed props are underscore prefixed as they will be stashed, then from them stateful versions will be made
23595
+ */
23596
+ {
23597
+ multiplexedId: _multiplexedId,
23598
+ labelId: _labelId,
23599
+ features: propFeatures,
23600
+ callbacks
23601
+ }) => {
23602
+ const {
23603
+ labelId,
23604
+ multiplexedId,
23605
+ isVoidingLabel,
23606
+ shipmentId,
23607
+ setLabelId,
23608
+ setShipmentId,
23609
+ setIsVoidingLabel
23610
+ } = useLabelWorkflow({
23611
+ _labelId,
23612
+ _multiplexedId
23613
+ });
23614
+ const _features = useFeatures("Globals");
23615
+ const features = useMemo(() => {
23247
23616
  var _a;
23248
- const formattedFontSizeValue = (_a = getNestedValue(typographyConfig, variant)) === null || _a === void 0 ? void 0 : _a.fontSize.replace("px", "");
23249
- return jsx(Input, {
23250
- "aria-labelledby": `${variant}.${key}`,
23251
- css: styles$6.input,
23252
- label: "Font Size(px)",
23253
- onChange: e => {
23254
- if (e.target.value.match(/^\d{0,2}$/)) handleInputChange(variant, key, `${e.target.value}px`);
23255
- },
23256
- value: formattedFontSizeValue
23617
+ return Object.assign(Object.assign(Object.assign({}, propFeatures), _features), {
23618
+ global: Object.assign(Object.assign({}, _features.global), {
23619
+ presentation: Object.assign(Object.assign({}, (_a = _features.global) === null || _a === void 0 ? void 0 : _a.presentation), {
23620
+ poweredByShipEngine: true
23621
+ })
23622
+ })
23257
23623
  });
23258
- };
23259
- const renderChildren = (variant, key) => {
23260
- switch (key) {
23261
- case "fontWeight":
23262
- return jsx(Fragment, {
23263
- children: renderFontWeightSelect(variant, key)
23264
- });
23265
- case "fontSize":
23266
- return jsx(Fragment, {
23267
- children: renderFontSizeInput(variant, key)
23268
- });
23269
- default:
23270
- return null;
23271
- }
23272
- };
23273
- return jsx("div", {
23274
- children: typographyConfig && Object.keys(typographyConfig).map(variant => jsxs("div", Object.assign({
23275
- css: styles$6.sectionContainer
23276
- }, {
23277
- children: [jsx("p", Object.assign({
23278
- css: styles$6.keys,
23279
- id: variant
23280
- }, {
23281
- children: formatKey(variant)
23282
- })), jsx("section", Object.assign({
23283
- css: styles$6.section
23284
- }, {
23285
- children: Object.keys(typographyConfig[variant]).map(key => jsx("div", Object.assign({
23286
- id: `${variant}.${key}`
23287
- }, {
23288
- children: renderChildren(variant, key)
23289
- }), key))
23290
- }))]
23291
- }), variant))
23292
- });
23293
- };
23294
-
23295
- const styles$5 = createStyles({
23296
- container: theme => ({
23297
- color: theme.palette.gray.dark,
23298
- display: "flex",
23299
- flexDirection: "column",
23300
- flexGrow: 1,
23301
- overflow: "hidden",
23302
- position: "relative"
23303
- }),
23304
- content: theme => ({
23305
- display: "flex",
23306
- flexDirection: "column",
23307
- gap: theme.spacing(3),
23308
- padding: theme.spacing(3)
23309
- }),
23310
- copy: theme => ({
23311
- backgroundColor: theme.palette.white,
23312
- borderRadius: "4px",
23313
- padding: theme.spacing(0.5)
23314
- }),
23315
- drawerHeader: theme => ({
23316
- alignItems: "center",
23317
- display: "flex",
23318
- gap: theme.spacing(2),
23319
- justifyContent: "end",
23320
- width: "50%"
23321
- }),
23322
- drawerWrapper: {
23323
- display: "flex",
23324
- justifyContent: "space-between",
23325
- position: "relative"
23326
- },
23327
- header: {
23328
- alignItems: "center",
23329
- display: "flex",
23330
- justifyContent: "space-between"
23331
- },
23332
- popoverWrapper: theme => ({
23333
- display: "flex",
23334
- flexDirection: "column",
23335
- gap: theme.spacing(1)
23336
- }),
23337
- pre: theme => ({
23338
- backgroundColor: "#FFFFFF66",
23339
- borderRadius: "8px",
23340
- fontSize: "14px",
23341
- padding: theme.spacing(0.3)
23342
- }),
23343
- presetOption: theme => ({
23344
- "&:hover": {
23345
- backgroundColor: "theme.palette.gray.ultraLight"
23624
+ }, []);
23625
+ return !labelId ? jsx(Element$7, Object.assign({}, multiplexedId, {
23626
+ features: features,
23627
+ onLabelCreateSuccess: (label, shipment) => {
23628
+ var _a;
23629
+ setLabelId(label.labelId);
23630
+ setShipmentId(shipment.shipmentId);
23631
+ (_a = callbacks === null || callbacks === void 0 ? void 0 : callbacks.onLabelCreateSuccess) === null || _a === void 0 ? void 0 : _a.call(callbacks, label, shipment);
23346
23632
  },
23347
- backgroundColor: "transparent",
23348
- borderRadius: "4px",
23349
- fontSize: "14px",
23350
- padding: theme.spacing(1)
23351
- }),
23352
- presetsButton: theme => ({
23353
- "&:hover": {
23354
- backgroundColor: "#d1d4d7"
23633
+ onLoad: (salesOrder, shipments, pendingShipment) => {
23634
+ if (shipments.length > 0) {
23635
+ setShipmentId(prior => prior !== undefined ? prior : shipments[0].shipmentId);
23636
+ }
23637
+ }
23638
+ })) : !isVoidingLabel ? jsx(Element$5, {
23639
+ features: features,
23640
+ onClickPurchaseLabel: () => {
23641
+ setLabelId(undefined);
23355
23642
  },
23356
- backgroundColor: "#E4E5E7",
23357
- borderRadius: "4px",
23358
- cursor: "pointer",
23359
- display: "flex",
23360
- fontSize: "14px",
23361
- gap: theme.spacing(0.5),
23362
- padding: `${theme.spacing(0.5)}px ${theme.spacing(1)}px`
23363
- })
23643
+ onClickVoidLabel: () => {
23644
+ setIsVoidingLabel(true);
23645
+ },
23646
+ shipmentId: shipmentId
23647
+ }) : jsx(Element$4, {
23648
+ features: features,
23649
+ labelId: labelId,
23650
+ onComplete: () => {
23651
+ setIsVoidingLabel(false);
23652
+ },
23653
+ onViewShipment: () => {
23654
+ setIsVoidingLabel(false);
23655
+ }
23656
+ });
23657
+ };
23658
+
23659
+ var labelWorkflow = /*#__PURE__*/Object.freeze({
23660
+ __proto__: null,
23661
+ useLabelWorkflow: useLabelWorkflow,
23662
+ Element: Element$3
23364
23663
  });
23365
23664
 
23366
- const ThemeCreator = ({
23367
- themeConfig,
23368
- onUpdateThemeConfig,
23369
- presets,
23370
- showDrawer
23665
+ const Component$2 = ({
23666
+ onRowClick,
23667
+ shipmentStatus: _shipmentStatus = "pending"
23371
23668
  }) => {
23372
- const defaultThemeConfigRef = useRef(themeConfig);
23373
- const [isDrawerOpen, setIsDrawerOpen] = useState(false);
23374
- const globalKeys = Object.keys(themeConfig);
23375
- // If the themeConfig has a "components" key, show only the child component keys, not "components" itself
23376
- const tabs = globalKeys.flatMap(key => {
23377
- if (key === "components" && themeConfig[key] && typeof themeConfig[key] === "object") {
23378
- const childComponentKeys = Object.keys(themeConfig[key]);
23379
- return childComponentKeys;
23380
- } else {
23381
- return [key];
23382
- }
23669
+ const {
23670
+ t
23671
+ } = useTranslation(["common", "list-shipments"]);
23672
+ const {
23673
+ page,
23674
+ pageSize,
23675
+ pagerProps
23676
+ } = usePager();
23677
+ const {
23678
+ data,
23679
+ isLoading,
23680
+ isError,
23681
+ error
23682
+ } = useListShipments({
23683
+ page,
23684
+ pageSize,
23685
+ shipmentStatus: _shipmentStatus
23383
23686
  });
23384
- const formattedThemeTabs = tabs.map(tab => {
23385
- if (tab === "palette") {
23386
- return "Color Palette";
23687
+ if (isLoading) return jsx(Loader, {
23688
+ message: t("loading.shipments")
23689
+ });
23690
+ if (isError) throw new Error(error.map(e => e.message).join(", "));
23691
+ if (!data) throw new Error(t("errorMessages.unableToLoad.shipments"));
23692
+ const columns = [{
23693
+ headerContent: t("list-shipments:headers.shipmentId"),
23694
+ renderCellContent: shipment => {
23695
+ return jsx("div", {
23696
+ children: shipment.shipmentId
23697
+ });
23387
23698
  }
23388
- return capitalizeFirstLetter(tab);
23699
+ }, {
23700
+ headerContent: t("list-shipments:headers.shipTo"),
23701
+ renderCellContent: shipment => {
23702
+ return shipment.shipTo.addressLine1 ? jsx(AddressDisplay, {
23703
+ address: shipment.shipTo
23704
+ }) : "--";
23705
+ }
23706
+ }, {
23707
+ headerContent: t("list-shipments:headers.shipDate"),
23708
+ renderCellContent: shipment => {
23709
+ return shipment.shipDate ? jsx(CellFormattedDate, {
23710
+ date: shipment.shipDate
23711
+ }) : "--";
23712
+ }
23713
+ }];
23714
+ return jsx(GridController, {
23715
+ columns: columns,
23716
+ data: data.shipments,
23717
+ footerContent: jsx(Pager, Object.assign({}, pagerProps, {
23718
+ pagingData: data
23719
+ })),
23720
+ onRowClick: onRowClick
23389
23721
  });
23390
- const [selectedTab, setSelectedTab] = useState(formattedThemeTabs.sort()[0]);
23391
- const handleSelectedTab = tab => {
23392
- setSelectedTab(tab);
23393
- };
23394
- const formatKey = key => addSpaceBetweenWords(pascalize(key));
23395
- const renderContentBySelectedTab = (themeConfig, selectedTab) => {
23396
- var _a;
23397
- switch (selectedTab) {
23398
- case "Color Palette":
23399
- return jsx(ColorPaletteEditor, {
23400
- formatKey: formatKey,
23401
- onUpdatePaletteConfig: updatedPalette => {
23402
- onUpdateThemeConfig(Object.assign(Object.assign({}, themeConfig), {
23403
- palette: updatedPalette
23404
- }));
23405
- },
23406
- paletteConfig: themeConfig.palette
23407
- });
23408
- case "Typography":
23409
- return jsx(TypographyEditor, {
23410
- formatKey: formatKey,
23411
- onUpdateTypographyConfig: updatedTypography => {
23412
- onUpdateThemeConfig(Object.assign(Object.assign({}, themeConfig), {
23413
- components: Object.assign(Object.assign({}, themeConfig.components), {
23414
- Typography: updatedTypography
23415
- })
23416
- }));
23417
- },
23418
- typographyConfig: (_a = themeConfig.components) === null || _a === void 0 ? void 0 : _a.Typography
23419
- });
23420
- default:
23421
- return null;
23722
+ };
23723
+ const Element$2 = alchemy.createElement(Component$2, ErrorFallback, {
23724
+ css: {
23725
+ height: "100%",
23726
+ minWidth: "440px",
23727
+ width: "100%"
23728
+ },
23729
+ resources: {
23730
+ en
23731
+ }
23732
+ });
23733
+
23734
+ var shipmentsGrid = /*#__PURE__*/Object.freeze({
23735
+ __proto__: null,
23736
+ Element: Element$2
23737
+ });
23738
+
23739
+ const ThemeCreatorContext = /*#__PURE__*/createContext(undefined);
23740
+ const ThemeCreatorProvider = ({
23741
+ children,
23742
+ editableTheme
23743
+ }) => {
23744
+ const [themeConfig, setThemeConfig] = useState(editableTheme);
23745
+ return jsx(ThemeCreatorContext.Provider, Object.assign({
23746
+ value: {
23747
+ setThemeConfig,
23748
+ themeConfig
23422
23749
  }
23423
- };
23424
- // const formattedThemeObj = `const theme = ${JSON.stringify(themeConfig, null, 2)}`;
23425
- const presetsRef = useRef(null);
23426
- const [showPresets, toggleShowPresets] = useToggle(false);
23427
- const applyPreset = theme => {
23428
- onUpdateThemeConfig(theme);
23429
- };
23430
- return jsxs("div", Object.assign({
23431
- "aria-label": "Theme Creator",
23432
- css: styles$5.container,
23433
- "data-testid": "theme-creator",
23434
- role: "region"
23435
23750
  }, {
23436
- children: [jsxs("div", Object.assign({
23437
- css: styles$5.content
23438
- }, {
23439
- children: [jsxs("div", Object.assign({
23440
- css: styles$5.header
23441
- }, {
23442
- children: [jsx(Tabs, {
23443
- onSelectTab: handleSelectedTab,
23444
- selectedTab: selectedTab,
23445
- tabs: formattedThemeTabs
23446
- }), presets ? jsxs("div", {
23447
- children: [jsxs("button", Object.assign({
23448
- "aria-controls": "presets-popover",
23449
- "aria-expanded": showPresets,
23450
- css: styles$5.presetsButton,
23451
- onClick: e => {
23452
- e.preventDefault();
23453
- toggleShowPresets();
23454
- },
23455
- ref: presetsRef
23456
- }, {
23457
- children: ["Presets", jsx(Icon, {
23458
- name: IconNames.CARET_BOTTOM,
23459
- size: IconSize.SIZE_SMALL
23460
- })]
23461
- })), jsx(Popover, Object.assign({
23462
- container: document.querySelector("#theme-creator"),
23463
- isOpen: showPresets,
23464
- onClickAway: () => toggleShowPresets(),
23465
- placement: "bottom-end",
23466
- reference: presetsRef.current
23467
- }, {
23468
- children: jsxs("div", Object.assign({
23469
- css: styles$5.popoverWrapper
23470
- }, {
23471
- children: [jsx("button", Object.assign({
23472
- "aria-label": "Set Default Theme",
23473
- css: styles$5.presetOption,
23474
- onClick: e => {
23475
- e.preventDefault();
23476
- toggleShowPresets();
23477
- applyPreset(defaultThemeConfigRef.current);
23478
- },
23479
- role: "menuitem"
23480
- }, {
23481
- children: "Default"
23482
- })), presets.map(preset => jsx("button", Object.assign({
23483
- "aria-label": `Set ${preset.presetName} Theme`,
23484
- css: styles$5.presetOption,
23485
- onClick: e => {
23486
- e.preventDefault();
23487
- toggleShowPresets();
23488
- applyPreset(preset.themeConfig);
23489
- },
23490
- role: "menuitem"
23491
- }, {
23492
- children: preset.presetName
23493
- }), preset.presetName))]
23494
- }))
23495
- }))]
23496
- }) :
23497
- //reset to default button
23498
- jsx("button", Object.assign({
23499
- "aria-label": "Set Default Theme",
23500
- css: styles$5.presetsButton,
23501
- onClick: () => {
23502
- applyPreset(defaultThemeConfigRef.current);
23503
- },
23504
- role: "menuitem"
23505
- }, {
23506
- children: "Reset to Default"
23507
- }))]
23508
- })), jsx(Typography, Object.assign({
23509
- role: "heading",
23510
- variant: "heading4"
23511
- }, {
23512
- children: `${selectedTab} Editor`
23513
- })), renderContentBySelectedTab(themeConfig, selectedTab)]
23514
- })), showDrawer && jsx(Drawer, Object.assign({
23515
- "aria-label": "Show themeConfig.js Code Drawer",
23516
- headerContent: jsxs("div", Object.assign({
23517
- css: styles$5.drawerHeader
23518
- }, {
23519
- children: [jsx("pre", Object.assign({
23520
- css: styles$5.pre
23521
- }, {
23522
- children: "themeConfig.js"
23523
- })), showDrawer.copyToClipboardText && jsx("div", Object.assign({
23524
- css: styles$5.copy
23525
- }, {
23526
- children: jsx(CopyButton, {
23527
- content: showDrawer.copyToClipboardText
23528
- })
23529
- }))]
23530
- })),
23531
- isOpen: isDrawerOpen,
23532
- toggleDrawer: () => setIsDrawerOpen(!isDrawerOpen)
23533
- }, {
23534
- children: showDrawer.content
23535
- }))]
23751
+ children: children
23536
23752
  }));
23537
23753
  };
23754
+ const useThemeCreator = () => {
23755
+ const themeCreatorContext = useContext(ThemeCreatorContext);
23756
+ if (!themeCreatorContext) throw new Error("useThemeConfigurator must be used within a ThemeConfiguratorProvider");
23757
+ return themeCreatorContext;
23758
+ };
23538
23759
 
23539
23760
  const Component$1 = _a => {
23540
23761
  var props = __rest(_a, []);
@@ -24527,4 +24748,4 @@ var onboarding = /*#__PURE__*/Object.freeze({
24527
24748
  Element: Element
24528
24749
  });
24529
24750
 
24530
- export { accountSettings as AccountSettings, AddFundsForm, AutoFundingForm, ButtonGroup, CarrierBalance, CarrierConnectionCard, CarrierIcon, CarrierLogo, CellFormattedDate, CollapsiblePanel, CopyButton, Country, Cube, DateRangeCombo, DateRangeSelect, DisplayTerm, Drawer, ErrorFallback, externalCarriers as ExternalCarriers, fields as Field, FieldLabel, FormPortal, FundAndPurchase, GridController, InlineLabel, ItemsBreakdown, labelWorkflow as LabelWorkflow, LinkAction, listCarriers as ListCarriers, Loader, ManageFunding, manageWarehouses as ManageWarehouses, onboarding as Onboarding, PageLayoutProvider, Pager, PaymentMethodSettings, Portal, PoweredByShipEngine, PudoType, purchaseLabel as PurchaseLabel, RootPortalProvider, Section, SkeletonCarrierRow, Spacer, Spread, StoryNotes, SuspendText, Tabs, themeCreator as ThemeCreator, ThemeCreatorProvider, UsState, UsaCity, viewShipment as ViewShipment, voidLabel as VoidLabel, addEmailToValidation, addSpaceBetweenWords, assert, autoFundingSchema, calculateTotal, capitalizeFirstLetter, convertDecimalWeightToFractionalWeight, convertDimensions, convertFractionalWeightToDecimalWeight, convertPoundsAndOuncesToOunces, convertWeight, countries, countryCodes, createCodedErrors, createDictionary, createStyles, currencySymbol, daysAfter, errorMap, euCountryCodes, extendZod, featureFlagComponentNameLookup, featureFlags, findDateLocale, formLogger, formatByDateAndLocale, formatCreditCardNumber, formatDate, formatDateDDMMYY, formatDateDDMMYYYY, formatDimensions, formatExpiration, formatFractionalWeight, formatMoney, getAddFundsSchema, getCancelledShipment, getCarrierIdByCarrierCode, getCurrencyFromString, getCurrencySymbolFromString, getCustomsFromSalesOrder, getExpirationYears, getFeatures, getIsCustomsRequiredForSalesOrder, getIsCustomsRequiredForShipment, getIsInternationalShipment, getPendingShipment, getRateRequiresAcknowledgement, getRelativeDates, getRequestedServices, getSalesOrderItemsFromSalesOrderOrShipment, getShipmentByStatus, getTotalRateAmount, getlocaleDateStringFormat, isCollectionService, isDecimalWeight, isDomesticAddress, isEmptyAddress, isFlatRatePackageCode, isMetricWeightUnit, isMilitaryAddress, isNowOrInTheFuture, isPoBox, isPoBoxAddress, isPudoEligibleRate, isString, isUnitedStatesTerritory, isUnsupportedByUps, isUpsCarrier, isUspsCarrier, moneySchema, mostRecent, nextDayCutoff, omitTime, overrideCarrierCodes$1 as overrideCarrierCodes, parseLocaleDate, pascalize, phoneSchema, phoneSchemaUnvalidated, postalCodeRegex$3 as postalCodeRegex, raise, sortByCreationDate, throwAny, throwJoinedMessages, usCities, usStateCodes, usStates, useAddressValidation, useBlackboxDetection, useCarrierMetadata, useConfirmationOptions, useCountryCodeOptions, useCustomsContentsOptions, useCustomsNonDeliveryOptions, useDateRangeOptions, useExpirationMonthOptions, useFeatures, useInsuranceProviderOptions, useNestedForm, usePackageOptions, usePageLayout, usePager, useRateOptions, useRootPortal, useRunOnceOnTrue, useScrubErrors, useServiceCodeOptions, useServicePoints, useShipmentMetadata, useShippingPresetsOptions, useStateCodeOptions, useThemeCreator, useToggle, useWarehouseOptions, validationResolver };
24751
+ export { accountSettings as AccountSettings, AddFundsForm, AutoFundingForm, ButtonGroup, CarrierBalance, CarrierConnectionCard, CarrierIcon, CarrierLogo, CellFormattedDate, CollapsiblePanel, CopyButton, Country, Cube, DateRangeCombo, DateRangeSelect, DisplayTerm, Drawer, ErrorFallback, externalCarriers as ExternalCarriers, fields as Field, FieldLabel, FormPortal, FundAndPurchase, GridController, InlineLabel, ItemsBreakdown, labelWorkflow as LabelWorkflow, labelsGrid as LabelsGrid, LinkAction, listCarriers as ListCarriers, Loader, ManageFunding, manageWarehouses as ManageWarehouses, onboarding as Onboarding, PageLayoutProvider, Pager, PaymentMethodSettings, Portal, PoweredByShipEngine, PudoType, purchaseLabel as PurchaseLabel, RootPortalProvider, Section, shipmentsGrid as ShipmentsGrid, SkeletonCarrierRow, Spacer, Spread, StoryNotes, SuspendText, Tabs, themeCreator as ThemeCreator, ThemeCreatorProvider, UsState, UsaCity, viewShipment as ViewShipment, voidLabel as VoidLabel, addEmailToValidation, addSpaceBetweenWords, assert, autoFundingSchema, calculateTotal, capitalizeFirstLetter, convertDecimalWeightToFractionalWeight, convertDimensions, convertFractionalWeightToDecimalWeight, convertPoundsAndOuncesToOunces, convertWeight, countries, countryCodes, createCodedErrors, createDictionary, createStyles, currencySymbol, daysAfter, errorMap, euCountryCodes, extendZod, featureFlagComponentNameLookup, featureFlags, findDateLocale, formLogger, formatByDateAndLocale, formatCreditCardNumber, formatDate, formatDateDDMMYY, formatDateDDMMYYYY, formatDimensions, formatExpiration, formatFractionalWeight, formatMoney, getAddFundsSchema, getCancelledShipment, getCarrierIdByCarrierCode, getCurrencyFromString, getCurrencySymbolFromString, getCustomsFromSalesOrder, getExpirationYears, getFeatures, getIsCustomsRequiredForSalesOrder, getIsCustomsRequiredForShipment, getIsInternationalShipment, getPendingShipment, getRateRequiresAcknowledgement, getRelativeDates, getRequestedServices, getSalesOrderItemsFromSalesOrderOrShipment, getShipmentByStatus, getTotalRateAmount, getlocaleDateStringFormat, isCollectionService, isDecimalWeight, isDomesticAddress, isEmptyAddress, isFlatRatePackageCode, isMetricWeightUnit, isMilitaryAddress, isNowOrInTheFuture, isPoBox, isPoBoxAddress, isPudoEligibleRate, isString, isUnitedStatesTerritory, isUnsupportedByUps, isUpsCarrier, isUspsCarrier, moneySchema, mostRecent, nextDayCutoff, omitTime, overrideCarrierCodes$1 as overrideCarrierCodes, parseLocaleDate, pascalize, phoneSchema, phoneSchemaUnvalidated, postalCodeRegex$3 as postalCodeRegex, raise, sortByCreationDate, throwAny, throwJoinedMessages, usCities, usStateCodes, usStates, useAddressValidation, useBlackboxDetection, useCarrierMetadata, useConfirmationOptions, useCountryCodeOptions, useCustomsContentsOptions, useCustomsNonDeliveryOptions, useDateRangeOptions, useExpirationMonthOptions, useFeatures, useInsuranceProviderOptions, useNestedForm, usePackageOptions, usePageLayout, usePager, useRateOptions, useRootPortal, useRunOnceOnTrue, useScrubErrors, useServiceCodeOptions, useServicePoints, useShipmentMetadata, useShippingPresetsOptions, useStateCodeOptions, useThemeCreator, useToggle, useWarehouseOptions, validationResolver };