@shipengine/elements 0.16.0 → 0.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/components/add-funds-form/add-funds-form.d.ts +22 -0
  2. package/components/add-funds-form/add-funds-form.styles.d.ts +6 -0
  3. package/components/{organisms/manual-funding-form/manual-funding-schema.d.ts → add-funds-form/add-funds-schema.d.ts} +13 -3
  4. package/components/add-funds-form/index.d.ts +2 -0
  5. package/components/auto-funding-form/auto-funding-form.d.ts +8 -0
  6. package/components/auto-funding-form/index.d.ts +2 -0
  7. package/components/carrier-balance/carrier-balance.d.ts +4 -0
  8. package/components/carrier-balance/carrier-balance.styles.d.ts +1 -0
  9. package/components/carrier-balance/index.d.ts +1 -0
  10. package/components/field/create-field-controller.d.ts +2 -1
  11. package/components/fund-and-purchase/fund-and-purchase.d.ts +15 -0
  12. package/components/fund-and-purchase/fund-and-purchase.styles.d.ts +1 -0
  13. package/components/fund-and-purchase/index.d.ts +1 -0
  14. package/components/index.d.ts +9 -0
  15. package/components/inline-label/index.d.ts +1 -0
  16. package/components/inline-label/inline-label.d.ts +6 -0
  17. package/components/items-breakdown/items-breakdown.d.ts +1 -1
  18. package/components/link-action/index.d.ts +1 -0
  19. package/components/link-action/link-action.d.ts +12 -0
  20. package/components/manage-funding/manage-funding.d.ts +4 -0
  21. package/components/spread/index.d.ts +1 -0
  22. package/components/spread/spread.d.ts +5 -0
  23. package/components/story-notes/index.d.ts +1 -0
  24. package/components/story-notes/story-notes.d.ts +11 -0
  25. package/components/templates/completion-page/completion-page.d.ts +4 -0
  26. package/components/templates/completion-page/index.d.ts +1 -0
  27. package/components/templates/index.d.ts +2 -2
  28. package/components/templates/list-carriers-row/list-carriers-row.styles.d.ts +1 -1
  29. package/components/templates/rate-form/rate-form.styles.d.ts +1 -0
  30. package/components/templates/shipment-form/shipment-form.d.ts +1 -1
  31. package/components/templates/suspend-sales-order/index.d.ts +1 -0
  32. package/components/templates/suspend-sales-order/suspend-sales-order.d.ts +8 -0
  33. package/components/templates/suspend-shipment/index.d.ts +1 -0
  34. package/components/templates/suspend-shipment/suspend-shipment.d.ts +8 -0
  35. package/elements/components/configure-shipment/configure-shipment.d.ts +1 -1
  36. package/elements/components/configure-shipment/hooks/use-address.d.ts +1 -1
  37. package/elements/components/configure-shipment/hooks/use-shipment-form.d.ts +2 -2
  38. package/elements/components/index.d.ts +1 -2
  39. package/elements/components/{sales-order → purchase-label}/hooks/use-configure-shipment.d.ts +1 -1
  40. package/elements/components/purchase-label/hooks/use-load-shipment.d.ts +9 -0
  41. package/elements/components/purchase-label/index.d.ts +3 -0
  42. package/elements/components/{sales-order/sales-order.d.ts → purchase-label/purchase-label-by-sales-order.d.ts} +1 -1
  43. package/elements/components/purchase-label/purchase-label-by-shipment.d.ts +9 -0
  44. package/elements/components/purchase-label/purchase-label.d.ts +6 -0
  45. package/elements/index.d.ts +0 -1
  46. package/elements/purchase-label.d.ts +3 -1
  47. package/hooks/use-elements.d.ts +2 -1
  48. package/hooks/use-nested-form.d.ts +2 -2
  49. package/index.cjs +1326 -947
  50. package/index.js +1315 -948
  51. package/locales/en/index.d.ts +19 -6
  52. package/mocks/carriers/handlers.d.ts +12 -1
  53. package/mocks/carriers/index.d.ts +1 -0
  54. package/mocks/index.d.ts +2 -0
  55. package/mocks/server.d.ts +2 -0
  56. package/mocks/warehouses/handlers.d.ts +1 -0
  57. package/mocks/warehouses/index.d.ts +1 -0
  58. package/package.json +5 -4
  59. package/testing/render.d.ts +5 -0
  60. package/utilities/rates.d.ts +1 -1
  61. package/utilities/shipengine/sales-order.d.ts +10 -0
  62. package/components/organisms/auto-funding-form/auto-funding-form.d.ts +0 -16
  63. package/components/organisms/auto-funding-form/index.d.ts +0 -1
  64. package/components/organisms/index.d.ts +0 -2
  65. package/components/organisms/manual-funding-form/index.d.ts +0 -2
  66. package/components/organisms/manual-funding-form/manual-funding-form.d.ts +0 -18
  67. package/components/templates/funding-methods/funding-methods.d.ts +0 -18
  68. package/components/templates/funding-methods/funding-methods.styles.d.ts +0 -1
  69. package/components/templates/funding-methods/index.d.ts +0 -1
  70. package/components/templates/sales-order/index.d.ts +0 -1
  71. package/components/templates/sales-order/sales-order.d.ts +0 -8
  72. package/elements/components/manage-funding/manage-funding.d.ts +0 -6
  73. package/elements/components/sales-order/index.d.ts +0 -1
  74. package/elements/manage-funding.d.ts +0 -1
  75. package/mocks/handlers.d.ts +0 -12
  76. /package/components/{organisms/auto-funding-form → auto-funding-form}/auto-funding-form.styles.d.ts +0 -0
  77. /package/components/{organisms/auto-funding-form → auto-funding-form}/auto-funding-schema.d.ts +0 -0
  78. /package/{elements/components → components}/manage-funding/index.d.ts +0 -0
  79. /package/elements/components/{sales-order → purchase-label}/hooks/index.d.ts +0 -0
  80. /package/elements/components/{sales-order → purchase-label}/hooks/use-import-sales-order.d.ts +0 -0
  81. /package/elements/components/{sales-order → purchase-label}/hooks/use-pending-shipment.d.ts +0 -0
package/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
2
2
  import { useController, get as get$1, set as set$2, useWatch, useFormState, useForm } from 'react-hook-form';
3
3
  import { useTranslation, Trans, initReactI18next, I18nextProvider } from 'react-i18next';
4
- import { Typography, FormField, FieldMessageType, Input, Checkbox, Icon, Divider, Link, Select as Select$1, Next, Option, Button, Switch as Switch$1, Textarea, ButtonVariant, InlineNotification, NotificationType, ButtonColor, Grid, GridChild, Tag, TagColor, Spinner, SpinnerSize, ChipList, Chip, ButtonSize, IconSize, Skeleton, SkeletonAnimation, SkeletonVariant, SkeletonBackgroundColor, Stepper, Step, BottomSheet, Table, TableBody, TableBaseRow, TableBodyCell, TableHeader, TableHeaderCell, useToggle as useToggle$1, Popover, DropdownOptionList, GigerConfigProvider, EmotionReset, FontsLoader } from '@packlink/giger';
4
+ import { Typography, FormField, FieldMessageType, Input, Checkbox, Icon, Divider, Link, Select as Select$1, Next, Option, Button, Switch as Switch$1, Textarea, ButtonVariant, InlineNotification, NotificationType, ButtonColor, Grid, GridChild, Tag, TagColor, Skeleton, SkeletonAnimation, SkeletonVariant, SkeletonBackgroundColor, IconSize, Stepper, Step, Spinner, SpinnerSize, ChipList, Chip, ButtonSize, Table, TableBody, TableBaseRow, TableBodyCell, TableHeader, TableHeaderCell, useToggle as useToggle$1, Popover, DropdownOptionList, BottomSheet, GigerConfigProvider, EmotionReset, FontsLoader } from '@packlink/giger';
5
5
  import axios from 'axios';
6
- import { logger, ShipEngineProvider, useListCarriers, useConnectCarrier, useValidateAddresses, useUpdateSalesOrderShipment, useParseAddress, useListCustomPackageTypes, useCalculateRates, useCreateLabel, useListWarehouses, useAddFunds, useGetAutoFundingConfiguration, useUpdateAutoFunding, useUpdateWarehouse, useCreateWarehouse, useDeleteWarehouse, useListSalesOrderShipments, useCreateSalesOrderShipment, useGetAccountSettings, useListSalesOrders, useGetSalesOrder, useListOrderSources, useRefreshOrderSource, useGetSalesOrderShipment, useListLabels, useGetLabel, useVoidLabel } from '@shipengine/react';
6
+ import { logger, ShipEngineProvider, useAddFunds, useGetCarrierById, useUpdateAutoFunding, useGetAutoFundingConfiguration, useListCarriers, useConnectCarrier, useListWarehouses, useUpdateWarehouse, useCreateWarehouse, useDeleteWarehouse, useValidateAddresses, useUpdateSalesOrderShipment, useParseAddress, useListCustomPackageTypes, useCalculateRates, useCreateLabel, useListSalesOrderShipments, useCreateSalesOrderShipment, useGetAccountSettings, useListSalesOrders, useGetSalesOrder, useListOrderSources, useRefreshOrderSource, useGetShipment, useGetSalesOrderShipment, useListLabels, useGetLabel, useVoidLabel } from '@shipengine/react';
7
7
  import { zodResolver } from '@hookform/resolvers/zod';
8
8
  import { z } from 'zod';
9
9
  import * as React from 'react';
@@ -18,6 +18,7 @@ import { createPortal } from 'react-dom';
18
18
  import { isValidPhoneNumber } from 'libphonenumber-js/min';
19
19
  import cardValidator from 'card-validator';
20
20
  import { encode } from 'js-base64';
21
+ import { useIsMutating } from 'react-query';
21
22
  import { stringify, COMMENT, rulesheet, middleware, RULESET, combine, match as match$1, serialize, copy, replace as replace$4, WEBKIT as WEBKIT$1, MOZ, MS, KEYFRAMES, DECLARATION, compile, dealloc, alloc, hash, charat, strlen, indexof, next, token, from, peek, delimit, slice, position, prefixer as prefixer$1 } from 'stylis';
22
23
  import i18n from 'i18next';
23
24
  import languageDetector from 'i18next-browser-languagedetector';
@@ -2009,7 +2010,7 @@ const getRateRequiresAcknowledgement = serviceCode => {
2009
2010
  return false;
2010
2011
  }
2011
2012
  };
2012
- const getTotalRateAmount = rateCosts => calculateTotal(...Object.values(rateCosts));
2013
+ const getTotalRateAmount = (rateCosts = {}) => calculateTotal(...Object.values(rateCosts));
2013
2014
 
2014
2015
  var anObject$9 = anObject$f;
2015
2016
 
@@ -2501,6 +2502,25 @@ const getRequestedServices = salesOrder => {
2501
2502
  var _a;
2502
2503
  return Array.from(new Set((_a = salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.salesOrderItems) === null || _a === void 0 ? void 0 : _a.filter(item => !!item.requestedShippingOptions.shippingService).map(item => item.requestedShippingOptions.shippingService)));
2503
2504
  };
2505
+ const getSalesOrderItemsFromSalesOrderOrShipment = ({
2506
+ salesOrder,
2507
+ shipment
2508
+ }) => {
2509
+ var _a, _b;
2510
+ return (_b = (_a = salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.salesOrderItems.map(item => ({
2511
+ detail: `SKU ${item.lineItemDetails.sku}`,
2512
+ name: item.lineItemDetails.name,
2513
+ quantity: item.quantity,
2514
+ subDetail: item.requestedShippingOptions.shippingService,
2515
+ subDetailValue: item.priceSummary.estimatedShipping,
2516
+ totalValue: item.priceSummary.total,
2517
+ value: item.priceSummary.unitPrice
2518
+ }))) !== null && _a !== void 0 ? _a : shipment === null || shipment === void 0 ? void 0 : shipment.items.map((item, i) => ({
2519
+ detail: `SKU ${item.sku}`,
2520
+ name: (item === null || item === void 0 ? void 0 : item.name) || `ITEM ${i}`,
2521
+ quantity: item.quantity
2522
+ }))) !== null && _b !== void 0 ? _b : [];
2523
+ };
2504
2524
 
2505
2525
  var tryToString$3 = tryToString$5;
2506
2526
 
@@ -3297,8 +3317,8 @@ const FieldLabel = ({
3297
3317
  }, {
3298
3318
  children: [label && jsxs("div", Object.assign({
3299
3319
  css: theme => ({
3300
- minWidth: "100px",
3301
- paddingTop: _withInput ? theme.spacing(subLabel ? 1 : 2) : undefined
3320
+ paddingTop: _withInput ? theme.spacing(subLabel ? 1 : 2) : undefined,
3321
+ width: theme.spacing(12.5)
3302
3322
  })
3303
3323
  }, {
3304
3324
  children: [jsx(Typography, Object.assign({
@@ -3331,6 +3351,7 @@ const createFieldController = (options = {}) => function FieldController(_a) {
3331
3351
  displayErrors = true,
3332
3352
  displayLabel = true,
3333
3353
  errors: errorsProp,
3354
+ hint,
3334
3355
  inputOnly,
3335
3356
  isOptional,
3336
3357
  label,
@@ -3341,7 +3362,7 @@ const createFieldController = (options = {}) => function FieldController(_a) {
3341
3362
  shouldUnregister,
3342
3363
  subLabel
3343
3364
  } = _a,
3344
- formInputProps = __rest(_a, ["children", "control", "defaultValue", "displayErrors", "displayLabel", "errors", "inputOnly", "isOptional", "label", "labelWeight", "name", "nativeLabel", "rules", "shouldUnregister", "subLabel"]);
3365
+ formInputProps = __rest(_a, ["children", "control", "defaultValue", "displayErrors", "displayLabel", "errors", "hint", "inputOnly", "isOptional", "label", "labelWeight", "name", "nativeLabel", "rules", "shouldUnregister", "subLabel"]);
3345
3366
  const {
3346
3367
  field,
3347
3368
  fieldState
@@ -3417,6 +3438,9 @@ const createFieldController = (options = {}) => function FieldController(_a) {
3417
3438
  message: displayErrors && mergedErrorMessages.length > 0 ? {
3418
3439
  content: mergedErrorMessages.join(", "),
3419
3440
  type: FieldMessageType.ERROR
3441
+ } : hint ? {
3442
+ content: hint,
3443
+ type: FieldMessageType.HINT
3420
3444
  } : undefined
3421
3445
  }, {
3422
3446
  children: input
@@ -21971,9 +21995,10 @@ const SubmitButton = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function SubmitB
21971
21995
  children,
21972
21996
  control,
21973
21997
  disabled,
21998
+ isLoading,
21974
21999
  requireDirty
21975
22000
  } = _a,
21976
- props = __rest(_a, ["alwaysRequireValidity", "children", "control", "disabled", "requireDirty"]);
22001
+ props = __rest(_a, ["alwaysRequireValidity", "children", "control", "disabled", "isLoading", "requireDirty"]);
21977
22002
  const {
21978
22003
  isDirty,
21979
22004
  isValid,
@@ -21987,7 +22012,7 @@ const SubmitButton = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function SubmitB
21987
22012
  disabled: disabled || !isDirty && requireDirty || !isValid && (alwaysRequireValidity || isSubmitted) || isSubmitting,
21988
22013
  formNoValidate // Bypass all browser validations on form inputs
21989
22014
  : true,
21990
- isLoading: isSubmitting,
22015
+ isLoading: isLoading || isSubmitting,
21991
22016
  ref: forwardedRef,
21992
22017
  type: "submit"
21993
22018
  }, props, {
@@ -23118,7 +23143,7 @@ const AddressForm = ({
23118
23143
  }));
23119
23144
  };
23120
23145
 
23121
- const styles$b = createStyles({
23146
+ const styles$a = createStyles({
23122
23147
  agreement: {
23123
23148
  alignItems: "center",
23124
23149
  display: "flex",
@@ -23188,10 +23213,10 @@ const DisplayCarrierTerms = c => {
23188
23213
  const listCarrierLinks = () => {
23189
23214
  return c.carrierTerms.links.map((term, index) => {
23190
23215
  return jsx("li", Object.assign({
23191
- css: styles$b.listItems
23216
+ css: styles$a.listItems
23192
23217
  }, {
23193
23218
  children: jsx(Link, Object.assign({
23194
- css: styles$b.link,
23219
+ css: styles$a.link,
23195
23220
  href: term.url,
23196
23221
  isExternal: true,
23197
23222
  target: "_blank"
@@ -23207,18 +23232,18 @@ const DisplayCarrierTerms = c => {
23207
23232
  };
23208
23233
  const listCarrierTerms = () => {
23209
23234
  return jsxs("div", Object.assign({
23210
- css: styles$b.terms
23235
+ css: styles$a.terms
23211
23236
  }, {
23212
23237
  children: [jsx(Typography, Object.assign({
23213
23238
  variant: "subtitle1"
23214
23239
  }, {
23215
23240
  children: c.carrierTerms.title
23216
23241
  })), jsx("div", Object.assign({
23217
- css: styles$b.terms
23242
+ css: styles$a.terms
23218
23243
  }, {
23219
23244
  children: listCarrierContent()
23220
23245
  })), jsx("ul", Object.assign({
23221
- css: styles$b.links
23246
+ css: styles$a.links
23222
23247
  }, {
23223
23248
  children: listCarrierLinks()
23224
23249
  }))]
@@ -23448,7 +23473,7 @@ const AddressDisplay = ({
23448
23473
  }));
23449
23474
  };
23450
23475
 
23451
- const styles$a = createStyles({
23476
+ const styles$9 = createStyles({
23452
23477
  container: theme => ({
23453
23478
  display: "flex",
23454
23479
  gap: theme.spacing()
@@ -23486,13 +23511,13 @@ const Disclosure = ({
23486
23511
  }, [open]);
23487
23512
  return jsxs(Fragment, {
23488
23513
  children: [jsxs("div", Object.assign({
23489
- css: styles$a.container
23514
+ css: styles$9.container
23490
23515
  }, {
23491
23516
  children: [jsx("div", {
23492
23517
  children: label
23493
23518
  }), _showToggle && jsx("button", Object.assign({
23494
23519
  "aria-expanded": isOpen,
23495
- css: styles$a.toggle,
23520
+ css: styles$9.toggle,
23496
23521
  onClick: () => {
23497
23522
  setIsOpen(!isOpen);
23498
23523
  onToggle(!isOpen);
@@ -23500,12 +23525,12 @@ const Disclosure = ({
23500
23525
  type: "button"
23501
23526
  }, {
23502
23527
  children: jsx(Icon, {
23503
- css: styles$a.icon,
23528
+ css: styles$9.icon,
23504
23529
  name: isOpen ? IconNames.CHEVRON_TOP : IconNames.CHEVRON_BOTTOM
23505
23530
  })
23506
23531
  }))]
23507
23532
  })), isOpen && jsx("div", Object.assign({
23508
- css: styles$a.content
23533
+ css: styles$9.content
23509
23534
  }, {
23510
23535
  children: typeof children === "function" ? children(() => setIsOpen(!isOpen)) : children
23511
23536
  }))]
@@ -23645,7 +23670,7 @@ const getCarrierRecoverySchema = requiresAddress => z.object({
23645
23670
  address: requiresAddress ? baseSchema : baseSchema.optional()
23646
23671
  });
23647
23672
 
23648
- const styles$9 = createStyles({
23673
+ const styles$8 = createStyles({
23649
23674
  grid: theme => ({
23650
23675
  margin: theme.spacing(4)
23651
23676
  }),
@@ -23688,7 +23713,7 @@ const CarrierRecoveryForm = ({
23688
23713
  onSubmit: formLogger.capture(handleSubmit)
23689
23714
  }, {
23690
23715
  children: jsxs(Grid, Object.assign({
23691
- css: styles$9.grid,
23716
+ css: styles$8.grid,
23692
23717
  noPadding: true
23693
23718
  }, {
23694
23719
  children: [jsx(GridChild, Object.assign({
@@ -23709,14 +23734,14 @@ const CarrierRecoveryForm = ({
23709
23734
  colSpan: 12
23710
23735
  }, {
23711
23736
  children: jsx(Typography, Object.assign({
23712
- css: styles$9.heading,
23737
+ css: styles$8.heading,
23713
23738
  variant: "heading4"
23714
23739
  }, {
23715
23740
  children: t("register-wallet:sections.carriers.title")
23716
23741
  }))
23717
23742
  })), jsx(GridChild, Object.assign({
23718
23743
  colSpan: 12,
23719
- css: styles$9.subtitle
23744
+ css: styles$8.subtitle
23720
23745
  }, {
23721
23746
  children: jsx(Typography, Object.assign({
23722
23747
  variant: "subtitle1"
@@ -23796,7 +23821,7 @@ const CarrierTerms = ({
23796
23821
  switch (carrierCode) {
23797
23822
  case "ups":
23798
23823
  return jsxs("div", Object.assign({
23799
- css: styles$b.terms
23824
+ css: styles$a.terms
23800
23825
  }, {
23801
23826
  children: [jsx(Typography, Object.assign({
23802
23827
  variant: "subtitle1"
@@ -23819,7 +23844,7 @@ const CarrierTerms = ({
23819
23844
  text,
23820
23845
  url
23821
23846
  }, idx) => jsx("li", Object.assign({
23822
- css: styles$b.listItems
23847
+ css: styles$a.listItems
23823
23848
  }, {
23824
23849
  children: jsx(Link, Object.assign({
23825
23850
  href: url,
@@ -23867,7 +23892,7 @@ const CarrierTermsForm = ({
23867
23892
  onSubmit(payload.agreement);
23868
23893
  }));
23869
23894
  return jsxs("div", Object.assign({
23870
- css: styles$b.termsForm,
23895
+ css: styles$a.termsForm,
23871
23896
  "data-testid": "carrier-terms-form"
23872
23897
  }, {
23873
23898
  children: [jsx(Typography, Object.assign({
@@ -23883,7 +23908,7 @@ const CarrierTermsForm = ({
23883
23908
  })), jsx(Spacer, {
23884
23909
  multiplier: 1
23885
23910
  }), jsx("div", Object.assign({
23886
- css: styles$b.carrierLogos
23911
+ css: styles$a.carrierLogos
23887
23912
  }, {
23888
23913
  children: metadatas.map(({
23889
23914
  name,
@@ -23899,7 +23924,7 @@ const CarrierTermsForm = ({
23899
23924
  onSubmit: formLogger.capture(handleSubmit)
23900
23925
  }, {
23901
23926
  children: jsxs("div", Object.assign({
23902
- css: styles$b.agreement
23927
+ css: styles$a.agreement
23903
23928
  }, {
23904
23929
  children: [jsx("div", {
23905
23930
  children: jsx(CheckboxInput, {
@@ -23926,10 +23951,10 @@ const CarrierTermsForm = ({
23926
23951
  name: "agreement"
23927
23952
  })
23928
23953
  }), showTerms && jsxs("div", Object.assign({
23929
- css: styles$b.well
23954
+ css: styles$a.well
23930
23955
  }, {
23931
23956
  children: [jsxs("div", Object.assign({
23932
- css: styles$b.terms
23957
+ css: styles$a.terms
23933
23958
  }, {
23934
23959
  children: [jsx(Typography, Object.assign({
23935
23960
  variant: "heading5"
@@ -23941,7 +23966,7 @@ const CarrierTermsForm = ({
23941
23966
  carrierCode: carrierCode
23942
23967
  }, carrierCode))]
23943
23968
  })), jsx("div", Object.assign({
23944
- css: styles$b.close
23969
+ css: styles$a.close
23945
23970
  }, {
23946
23971
  children: jsx(Button, Object.assign({
23947
23972
  onClick: () => setShowTerms(false),
@@ -24190,522 +24215,138 @@ const CustomsItemForm = ({
24190
24215
  }));
24191
24216
  };
24192
24217
 
24193
- const Loader = props => {
24194
- return jsx("div", Object.assign({
24195
- css: {
24196
- alignItems: "center",
24197
- display: "flex",
24198
- flexDirection: "column",
24199
- height: "100%",
24200
- justifyContent: "center",
24201
- textAlign: "center",
24202
- width: "100%"
24203
- }
24204
- }, {
24205
- children: jsx(Spinner, Object.assign({}, props, {
24206
- size: SpinnerSize.SIZE_LARGE
24207
- }))
24208
- }));
24209
- };
24210
-
24211
- const styles$8 = createStyles({
24212
- form: theme => ({
24213
- backgroundColor: theme.palette.gray.megaLight,
24214
- display: "flex",
24215
- flexDirection: "column",
24216
- gap: theme.spacing(2),
24217
- padding: theme.spacing(2)
24218
- })
24219
- });
24220
-
24221
- const autoFundingSchema = z.object({
24222
- isEnabled: z.boolean(),
24223
- lowBalancePurchaseThreshold: moneySchema.extend({
24224
- amount: z.number().min(25)
24225
- }),
24226
- maximumPurchasesPerDay: z.number().min(1),
24227
- purchaseAmount: moneySchema.extend({
24228
- amount: z.number().min(10).max(10000)
24229
- })
24230
- });
24231
-
24232
- /**
24233
- * This form that allows users to enable or disable auto funding, and
24234
- * configure auto funding settings in ShipEngine API.
24235
- */
24236
- const AutoFundingForm = ({
24237
- defaultValues,
24238
- errorMessage,
24239
- hasError,
24240
- isInteger,
24241
- isLoading,
24242
- onSubmit,
24243
- onToggle
24218
+ const Label = ({
24219
+ label,
24220
+ onClickVoid,
24221
+ onClickPrintLabel
24244
24222
  }) => {
24223
+ var _a, _b, _c, _d, _e, _f;
24245
24224
  const {
24246
24225
  t
24247
- } = useTranslation();
24248
- // const [showForm, toggleShowForm] = useReducer((n) => !n, false); May still need this in a subsequent PR
24249
- const form = useForm({
24250
- defaultValues: defaultValues,
24251
- resolver: validationResolver(autoFundingSchema)
24252
- });
24253
- const {
24254
- isDirty
24255
- } = form.formState;
24256
- const watchIsEnabled = form.watch("isEnabled");
24257
- const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
24258
- yield onSubmit(values);
24259
- }));
24260
- if (isLoading) return jsx(Loader, {
24261
- message: t("manage-funding:autoFunding.isLoading")
24262
- });
24226
+ } = useTranslation(["common", "view-shipment"]);
24227
+ const insuranceOrConfirmationMessages = [];
24228
+ if (label.insuredValue && label.insuredValue.amount !== 0) {
24229
+ insuranceOrConfirmationMessages.push(t("view-shipment:fields.insuredValue", {
24230
+ insuredValue: formatMoney(label.insuredValue)
24231
+ }));
24232
+ }
24233
+ if (label.deliveryConfirmation && label.deliveryConfirmation !== "none") {
24234
+ insuranceOrConfirmationMessages.push(t("view-shipment:fields.deliveryConfirmation", {
24235
+ deliveryConfirmation: t(`common:confirmationTypes.${camelize(label.deliveryConfirmation)}`)
24236
+ }));
24237
+ }
24263
24238
  return jsxs(Fragment, {
24264
- children: [jsx(Switch, {
24265
- defaultChecked: defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.isEnabled,
24266
- label: t("manage-funding:autoFunding.addFundsAutomatically"),
24267
- name: "isEnabled",
24268
- onChange: evt => {
24269
- form.reset(Object.assign(Object.assign({}, form.getValues()), {
24270
- isEnabled: evt.target.checked
24271
- }));
24272
- onToggle(evt.target.checked);
24273
- },
24274
- value: true
24275
- }), watchIsEnabled && jsxs("form", Object.assign({
24276
- css: styles$8.form,
24277
- id: "auto-funding-form",
24278
- onSubmit: formLogger.capture(handleSubmit)
24239
+ children: [["processing", "completed"].includes(label.status) ? jsx(RateCard, Object.assign({
24240
+ carrierCode: (_a = label.carrier) === null || _a === void 0 ? void 0 : _a.carrierCode,
24241
+ carrierFriendlyName: (_b = label.carrier) === null || _b === void 0 ? void 0 : _b.friendlyName,
24242
+ // TODO: LMNT-418 Enable Nickname via FF
24243
+ // carrierNickname={label.carrier?.nickname}
24244
+ insuranceAmount: label.insuranceCost,
24245
+ messages: insuranceOrConfirmationMessages,
24246
+ selected: true,
24247
+ serviceType: (_c = label.service) === null || _c === void 0 ? void 0 : _c.name,
24248
+ shippingAmount: label.shipmentCost
24279
24249
  }, {
24280
- children: [jsx(MoneyInput, {
24281
- control: form.control,
24282
- disabled: !watchIsEnabled,
24283
- label: t("manage-funding:autoFunding.purchaseAmount"),
24284
- name: "purchaseAmount",
24285
- showCurrencySymbol: true
24286
- }), jsx(MoneyInput, {
24287
- control: form.control,
24288
- disabled: !watchIsEnabled,
24289
- label: t("manage-funding:autoFunding.lowBalancePurchaseThreshold"),
24290
- name: "lowBalancePurchaseThreshold",
24291
- showCurrencySymbol: true
24292
- }), jsx(NumberInput, {
24293
- control: form.control,
24294
- disabled: !watchIsEnabled,
24295
- label: t("manage-funding:autoFunding.maximumPurchasesPerDay"),
24296
- name: "maximumPurchasesPerDay"
24297
- }), jsxs(ButtonGroup, Object.assign({
24298
- justify: "end"
24299
- }, {
24300
- children: [jsx(Button, Object.assign({
24301
- disabled: !isDirty,
24302
- onClick: () => form.reset(),
24303
- variant: ButtonVariant.TEXT
24250
+ children: label.trackingNumber && jsx("div", {
24251
+ children: label.trackingNumber.toString()
24252
+ })
24253
+ })) : jsx(RateCard, {
24254
+ carrierCode: (_d = label.carrier) === null || _d === void 0 ? void 0 : _d.carrierCode,
24255
+ carrierFriendlyName: (_e = label.carrier) === null || _e === void 0 ? void 0 : _e.friendlyName,
24256
+ // TODO: LMNT-418 Enable Nickname via FF
24257
+ // carrierNickname={label.carrier?.nickname}
24258
+ insuranceAmount: label.insuranceCost,
24259
+ selected: true,
24260
+ serviceType: (_f = label.service) === null || _f === void 0 ? void 0 : _f.name,
24261
+ shippingAmount: label.shipmentCost,
24262
+ voided: label.voided
24263
+ }), label.status === "completed" && jsxs(Fragment, {
24264
+ children: [jsx(Spacer, {
24265
+ multiplier: 2
24266
+ }), jsxs(ButtonGroup, {
24267
+ children: [onClickVoid && label.status === "completed" && jsx(Button, Object.assign({
24268
+ bold: false,
24269
+ css: {
24270
+ whiteSpace: "nowrap"
24271
+ },
24272
+ onClick: () => onClickVoid(label),
24273
+ type: "submit",
24274
+ variant: ButtonVariant.OUTLINED
24304
24275
  }, {
24305
- children: t("actions.cancel")
24306
- })), jsx(SubmitButton, Object.assign({
24307
- control: form.control,
24308
- "data-testid": "autoFunding.submit",
24309
- disabled: !watchIsEnabled,
24310
- requireDirty: true,
24276
+ children: t("view-shipment:actions.void")
24277
+ })), label.formDownload && jsx(Button, Object.assign({
24278
+ bold: false,
24279
+ css: {
24280
+ whiteSpace: "nowrap"
24281
+ },
24282
+ onClick: () => {
24283
+ window.open(label.formDownload.href, "_blank", "noopener, noreferrer");
24284
+ },
24311
24285
  variant: ButtonVariant.OUTLINED
24312
24286
  }, {
24313
- children: t("manage-funding:actions.saveRule")
24287
+ children: t("view-shipment:actions.printForms")
24288
+ })), jsx(Button, Object.assign({
24289
+ bold: false,
24290
+ css: {
24291
+ whiteSpace: "nowrap"
24292
+ },
24293
+ isFullWidth: true,
24294
+ onClick: () => {
24295
+ onClickPrintLabel === null || onClickPrintLabel === void 0 ? void 0 : onClickPrintLabel();
24296
+ window.open(label.labelDownload.href, "_blank", "noopener, noreferrer");
24297
+ // window.open(label.labelFormat, "_blank", "noopener, noreferrer");
24298
+ }
24299
+ }, {
24300
+ children: t("view-shipment:actions.printLabel")
24314
24301
  }))]
24315
- }))]
24316
- })), hasError && errorMessage && jsxs(Fragment, {
24317
- children: [jsx(Spacer, {}), jsx(InlineNotification, Object.assign({
24318
- title: t("manage-funding:autoFunding.error.title"),
24319
- type: NotificationType.ERROR
24320
- }, {
24321
- children: errorMessage
24322
- })), jsx(Spacer, {})]
24302
+ })]
24323
24303
  })]
24324
24304
  });
24325
24305
  };
24326
24306
 
24327
- const manualFundingSchema = z.object({
24328
- funds: moneySchema.extend({
24329
- amount: z.number().min(10)
24330
- })
24307
+ const landingPageFormSchema = z.object({
24308
+ email: z.string().trim().email()
24331
24309
  });
24332
24310
 
24333
- const ManualFundingForm = ({
24334
- currentBalance,
24335
- errorMessage,
24336
- formId,
24337
- hasError,
24338
- isLoading,
24339
- onCancel,
24340
- onSubmit,
24341
- portalRef,
24342
- requiredAmount
24311
+ const LandingPageForm = ({
24312
+ onSubmit
24343
24313
  }) => {
24344
- var _a;
24345
24314
  const {
24346
24315
  t
24347
24316
  } = useTranslation();
24348
- const fundingRecommendations = useMemo(() => ["$20", "$50", "$100", t("manage-funding:actions.other")], [t]);
24349
- const suggestedAmount = Math.max(requiredAmount !== null && requiredAmount !== void 0 ? requiredAmount : 0, 10);
24350
- const [selectedFundingAmountIndex, setSelectedFundingAmountIndex] = useState(requiredAmount ? 3 : 0);
24351
- const [showFormInput, toggleShowFormInput] = useToggle(!!requiredAmount);
24352
- const getSelectedFundingValue = value => {
24353
- return Number(value.replace(/[^0-9.-]+/g, ""));
24354
- };
24355
24317
  const form = useForm({
24356
24318
  defaultValues: {
24357
- funds: {
24358
- amount: suggestedAmount,
24359
- currency: SE.Currency.USD
24360
- }
24319
+ email: ""
24361
24320
  },
24362
- resolver: validationResolver(manualFundingSchema)
24321
+ resolver: validationResolver(landingPageFormSchema)
24363
24322
  });
24364
- const resultingBalance = currentBalance + ((_a = form.watch("funds").amount) !== null && _a !== void 0 ? _a : 0);
24365
- const formInterface = jsxs("section", Object.assign({
24366
- css: theme => ({
24367
- backgroundColor: theme.palette.gray.megaLight,
24368
- padding: theme.spacing(2)
24369
- })
24323
+ const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
24324
+ const payload = values;
24325
+ onSubmit(payload.email);
24326
+ }));
24327
+ return jsxs("form", Object.assign({
24328
+ id: "landing-page-form",
24329
+ onSubmit: formLogger.capture(handleSubmit)
24370
24330
  }, {
24371
- children: [jsx(Typography, Object.assign({
24372
- bold: true
24373
- }, {
24374
- children: t("manage-funding:addFunds")
24375
- })), jsx(Spacer, {
24376
- multiplier: 2
24377
- }), jsx(ChipList, Object.assign({
24378
- onChange: idx => {
24379
- setSelectedFundingAmountIndex(idx);
24380
- if (idx === fundingRecommendations.length - 1) {
24381
- toggleShowFormInput(true);
24382
- return;
24383
- } else {
24384
- toggleShowFormInput(false);
24385
- form.reset({
24386
- funds: {
24387
- amount: getSelectedFundingValue(fundingRecommendations[idx]),
24388
- currency: SE.Currency.USD
24389
- }
24390
- });
24391
- }
24392
- }
24331
+ children: [jsx(TextInput, {
24332
+ control: form.control,
24333
+ "data-testid": "fields.email",
24334
+ form: "landing-page-form",
24335
+ label: t("address.fields.email"),
24336
+ labelWeight: "normal",
24337
+ name: "email",
24338
+ nativeLabel: true
24339
+ }), jsx(Spacer, {
24340
+ multiplier: 4
24341
+ }), jsx(ButtonGroup, Object.assign({
24342
+ justify: "center"
24393
24343
  }, {
24394
- children: fundingRecommendations.map((item, idx) => jsx(Chip, Object.assign({
24395
- css: theme => ({
24396
- backgroundColor: idx !== selectedFundingAmountIndex ? theme.palette.white : theme.palette.primary.main,
24397
- color: idx !== selectedFundingAmountIndex ? theme.palette.gray.main : theme.palette.white
24398
- }),
24399
- isSelected: idx === selectedFundingAmountIndex
24400
- }, {
24401
- children: item
24402
- }), idx))
24403
- })), jsx(Spacer, {
24404
- multiplier: 1
24405
- }), showFormInput && jsxs(Fragment, {
24406
- children: [jsx(MoneyInput, {
24344
+ children: jsx(SubmitButton, Object.assign({
24345
+ alwaysRequireValidity: true,
24407
24346
  control: form.control,
24408
- defaultValue: {
24409
- amount: undefined,
24410
- currency: SE.Currency.USD
24411
- },
24412
- label: t("manage-funding:otp.labels.amount"),
24413
- name: "funds",
24414
- placeholder: "Amount",
24415
- showCurrencySymbol: true,
24416
- subLabel: "Minimum purchase $10.00"
24417
- }), jsxs(FieldLabel, Object.assign({
24418
- label: t("manage-funding:otp.labels.resultingBalance")
24419
- }, {
24420
- children: [jsx(Typography, Object.assign({
24421
- variant: "body1"
24422
- }, {
24423
- children: formatMoney({
24424
- amount: resultingBalance,
24425
- currency: SE.Currency.USD
24426
- })
24427
- })), jsx(Spacer, {})]
24428
- }))]
24429
- }), jsxs(ButtonGroup, Object.assign({
24430
- justify: "end"
24431
- }, {
24432
- children: [jsx(Button, Object.assign({
24433
- onClick: onCancel,
24434
- variant: ButtonVariant.TEXT
24435
- }, {
24436
- children: t("actions.cancel")
24437
- })), jsx(SubmitButton, Object.assign({
24438
- control: form.control,
24439
- form: formId,
24440
- variant: ButtonVariant.OUTLINED
24441
- }, {
24442
- children: t(formId ? "actions.purchase" : "manage-funding:actions.addNow")
24443
- }))]
24444
- }))]
24445
- }));
24446
- if (isLoading) return jsx(Loader, {
24447
- message: t("manage-funding:otp.isLoading")
24448
- });
24449
- return jsxs(Fragment, {
24450
- children: [jsx("form", Object.assign({
24451
- id: formId,
24452
- onSubmit: formLogger.capture(form.handleSubmit(onSubmit))
24453
- }, {
24454
- children: portalRef !== undefined ?
24455
- // Nested form in a well
24456
- jsx(Portal, Object.assign({
24457
- target: portalRef
24458
- }, {
24459
- children: jsx("section", Object.assign({
24460
- css: theme => ({
24461
- backgroundColor: theme.palette.gray.megaLight,
24462
- padding: theme.spacing(2)
24463
- })
24464
- }, {
24465
- children: formInterface
24466
- }))
24467
- })) :
24468
- // Standalone form
24469
- formInterface
24470
- })), hasError && errorMessage && jsxs(Fragment, {
24471
- children: [jsx(Spacer, {}), jsx(InlineNotification, Object.assign({
24472
- title: t("manage-funding:otp.error.title"),
24473
- type: NotificationType.ERROR
24474
- }, {
24475
- children: errorMessage
24476
- })), jsx(Spacer, {})]
24477
- })]
24478
- });
24479
- };
24480
-
24481
- const styles$7 = createStyles({
24482
- addFundsButton: theme => ({
24483
- alignItems: "center",
24484
- display: "flex",
24485
- gap: theme.spacing(1)
24486
- }),
24487
- balanceText: theme => ({
24488
- color: theme.palette.success.main
24489
- }),
24490
- header: theme => ({
24491
- display: "flex",
24492
- gap: theme.spacing(2),
24493
- justifyContent: "space-between"
24494
- }),
24495
- negativeBalanceText: theme => ({
24496
- color: theme.palette.error.main
24497
- })
24498
- });
24499
-
24500
- const FundingMethods = ({
24501
- addFundsErrorMessage,
24502
- autoFundingData,
24503
- autoFundingErrorMessage,
24504
- fundingMethod,
24505
- hasAutoFundingError,
24506
- hasManualFundingError,
24507
- isAutoFundingLoading,
24508
- isManualFundingLoading,
24509
- manualFundingCurrentBalance,
24510
- manualFundingRequiredAmount,
24511
- onSubmitAutoFunding,
24512
- onSubmitManualFunding,
24513
- onToggleAutoFunding
24514
- }) => {
24515
- const {
24516
- t
24517
- } = useTranslation();
24518
- const [showFundingMethods, toggleShowFundingMethods] = useToggle(false);
24519
- return jsxs(Fragment, {
24520
- children: [jsxs("div", Object.assign({
24521
- css: styles$7.header
24522
- }, {
24523
- children: [jsxs("div", {
24524
- children: [jsx(Typography, Object.assign({
24525
- variant: "body1"
24526
- }, {
24527
- children: t("manage-funding:currentBalance")
24528
- })), jsx(Typography, Object.assign({
24529
- bold: true,
24530
- css: manualFundingCurrentBalance >= 0 ? styles$7.balanceText : styles$7.negativeBalanceText,
24531
- variant: "body1"
24532
- }, {
24533
- children: formatMoney({
24534
- amount: manualFundingCurrentBalance,
24535
- currency: SE.Currency.USD
24536
- })
24537
- }))]
24538
- }), jsxs(Link, Object.assign({
24539
- bold: true,
24540
- css: styles$7.addFundsButton,
24541
- onClick: toggleShowFundingMethods,
24542
- size: ButtonSize.MEDIUM
24543
- }, {
24544
- children: [t("manage-funding:addFunds"), jsx(Icon, {
24545
- name: IconNames.ADD,
24546
- size: IconSize.SIZE_MEDIUM,
24547
- title: "Add Funds"
24548
- })]
24549
- }))]
24550
- })), jsx(Spacer, {}), jsx("div", Object.assign({
24551
- css: theme => Object.assign(Object.assign({}, !showFundingMethods && {
24552
- display: "none"
24553
- }), {
24554
- marginBottom: theme.spacing(2)
24555
- })
24556
- }, {
24557
- children: ["manual", "both"].includes(fundingMethod) && jsx(ManualFundingForm, {
24558
- currentBalance: manualFundingCurrentBalance,
24559
- errorMessage: addFundsErrorMessage,
24560
- hasError: hasManualFundingError,
24561
- isLoading: isManualFundingLoading,
24562
- onCancel: toggleShowFundingMethods,
24563
- onSubmit: onSubmitManualFunding,
24564
- requiredAmount: manualFundingRequiredAmount
24565
- })
24566
- })), ["auto", "both"].includes(fundingMethod) && jsx(AutoFundingForm, {
24567
- defaultValues: autoFundingData,
24568
- errorMessage: autoFundingErrorMessage,
24569
- hasError: hasAutoFundingError,
24570
- isLoading: isAutoFundingLoading,
24571
- onSubmit: onSubmitAutoFunding,
24572
- onToggle: onToggleAutoFunding
24573
- })]
24574
- });
24575
- };
24576
-
24577
- const Label = ({
24578
- label,
24579
- onClickVoid,
24580
- onClickPrintLabel
24581
- }) => {
24582
- var _a, _b, _c, _d, _e, _f;
24583
- const {
24584
- t
24585
- } = useTranslation(["common", "view-shipment"]);
24586
- const insuranceOrConfirmationMessages = [];
24587
- if (label.insuredValue && label.insuredValue.amount !== 0) {
24588
- insuranceOrConfirmationMessages.push(t("view-shipment:fields.insuredValue", {
24589
- insuredValue: formatMoney(label.insuredValue)
24590
- }));
24591
- }
24592
- if (label.deliveryConfirmation && label.deliveryConfirmation !== "none") {
24593
- insuranceOrConfirmationMessages.push(t("view-shipment:fields.deliveryConfirmation", {
24594
- deliveryConfirmation: t(`common:confirmationTypes.${camelize(label.deliveryConfirmation)}`)
24595
- }));
24596
- }
24597
- return jsxs(Fragment, {
24598
- children: [["processing", "completed"].includes(label.status) ? jsx(RateCard, Object.assign({
24599
- carrierCode: (_a = label.carrier) === null || _a === void 0 ? void 0 : _a.carrierCode,
24600
- carrierFriendlyName: (_b = label.carrier) === null || _b === void 0 ? void 0 : _b.friendlyName,
24601
- // TODO: LMNT-418 Enable Nickname via FF
24602
- // carrierNickname={label.carrier?.nickname}
24603
- insuranceAmount: label.insuranceCost,
24604
- messages: insuranceOrConfirmationMessages,
24605
- selected: true,
24606
- serviceType: (_c = label.service) === null || _c === void 0 ? void 0 : _c.name,
24607
- shippingAmount: label.shipmentCost
24608
- }, {
24609
- children: label.trackingNumber && jsx("div", {
24610
- children: label.trackingNumber.toString()
24611
- })
24612
- })) : jsx(RateCard, {
24613
- carrierCode: (_d = label.carrier) === null || _d === void 0 ? void 0 : _d.carrierCode,
24614
- carrierFriendlyName: (_e = label.carrier) === null || _e === void 0 ? void 0 : _e.friendlyName,
24615
- // TODO: LMNT-418 Enable Nickname via FF
24616
- // carrierNickname={label.carrier?.nickname}
24617
- insuranceAmount: label.insuranceCost,
24618
- selected: true,
24619
- serviceType: (_f = label.service) === null || _f === void 0 ? void 0 : _f.name,
24620
- shippingAmount: label.shipmentCost,
24621
- voided: label.voided
24622
- }), label.status === "completed" && jsxs(Fragment, {
24623
- children: [jsx(Spacer, {
24624
- multiplier: 2
24625
- }), jsxs(ButtonGroup, {
24626
- children: [onClickVoid && label.status === "completed" && jsx(Button, Object.assign({
24627
- bold: false,
24628
- css: {
24629
- whiteSpace: "nowrap"
24630
- },
24631
- onClick: () => onClickVoid(label),
24632
- type: "submit",
24633
- variant: ButtonVariant.OUTLINED
24634
- }, {
24635
- children: t("view-shipment:actions.void")
24636
- })), label.formDownload && jsx(Button, Object.assign({
24637
- bold: false,
24638
- css: {
24639
- whiteSpace: "nowrap"
24640
- },
24641
- onClick: () => {
24642
- window.open(label.formDownload.href, "_blank", "noopener, noreferrer");
24643
- },
24644
- variant: ButtonVariant.OUTLINED
24645
- }, {
24646
- children: t("view-shipment:actions.printForms")
24647
- })), jsx(Button, Object.assign({
24648
- bold: false,
24649
- css: {
24650
- whiteSpace: "nowrap"
24651
- },
24652
- isFullWidth: true,
24653
- onClick: () => {
24654
- onClickPrintLabel === null || onClickPrintLabel === void 0 ? void 0 : onClickPrintLabel();
24655
- window.open(label.labelDownload.href, "_blank", "noopener, noreferrer");
24656
- // window.open(label.labelFormat, "_blank", "noopener, noreferrer");
24657
- }
24658
- }, {
24659
- children: t("view-shipment:actions.printLabel")
24660
- }))]
24661
- })]
24662
- })]
24663
- });
24664
- };
24665
-
24666
- const landingPageFormSchema = z.object({
24667
- email: z.string().trim().email()
24668
- });
24669
-
24670
- const LandingPageForm = ({
24671
- onSubmit
24672
- }) => {
24673
- const {
24674
- t
24675
- } = useTranslation();
24676
- const form = useForm({
24677
- defaultValues: {
24678
- email: ""
24679
- },
24680
- resolver: validationResolver(landingPageFormSchema)
24681
- });
24682
- const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
24683
- const payload = values;
24684
- onSubmit(payload.email);
24685
- }));
24686
- return jsxs("form", Object.assign({
24687
- id: "landing-page-form",
24688
- onSubmit: formLogger.capture(handleSubmit)
24689
- }, {
24690
- children: [jsx(TextInput, {
24691
- control: form.control,
24692
- "data-testid": "fields.email",
24693
- form: "landing-page-form",
24694
- label: t("address.fields.email"),
24695
- labelWeight: "normal",
24696
- name: "email",
24697
- nativeLabel: true
24698
- }), jsx(Spacer, {
24699
- multiplier: 4
24700
- }), jsx(ButtonGroup, Object.assign({
24701
- justify: "center"
24702
- }, {
24703
- children: jsx(SubmitButton, Object.assign({
24704
- alwaysRequireValidity: true,
24705
- control: form.control,
24706
- "data-testid": "onboarding:landing.action",
24707
- form: "landing-page-form",
24708
- variant: ButtonVariant.FILLED
24347
+ "data-testid": "onboarding:landing.action",
24348
+ form: "landing-page-form",
24349
+ variant: ButtonVariant.FILLED
24709
24350
  }, {
24710
24351
  children: t("onboarding:landing.action")
24711
24352
  }))
@@ -24713,7 +24354,7 @@ const LandingPageForm = ({
24713
24354
  }));
24714
24355
  };
24715
24356
 
24716
- const styles$6 = createStyles({
24357
+ const styles$7 = createStyles({
24717
24358
  container: theme => ({
24718
24359
  padding: theme.spacing(2)
24719
24360
  }),
@@ -24734,11 +24375,11 @@ const LandingPage = ({
24734
24375
  t
24735
24376
  } = useTranslation();
24736
24377
  return jsxs("div", Object.assign({
24737
- css: styles$6.container,
24378
+ css: styles$7.container,
24738
24379
  "data-testid": "landing-page"
24739
24380
  }, {
24740
24381
  children: [jsxs("div", Object.assign({
24741
- css: styles$6.header
24382
+ css: styles$7.header
24742
24383
  }, {
24743
24384
  children: [jsx(Typography, Object.assign({
24744
24385
  variant: "heading4"
@@ -24756,7 +24397,7 @@ const LandingPage = ({
24756
24397
  })), jsx(LandingPageForm, {
24757
24398
  onSubmit: onSubmit
24758
24399
  }), jsxs("div", Object.assign({
24759
- css: styles$6.header
24400
+ css: styles$7.header
24760
24401
  }, {
24761
24402
  children: [jsx(Spacer, {
24762
24403
  multiplier: 6
@@ -24767,7 +24408,7 @@ const LandingPage = ({
24767
24408
  })), jsx(Spacer, {
24768
24409
  multiplier: 2
24769
24410
  }), jsx(Typography, Object.assign({
24770
- css: styles$6.description,
24411
+ css: styles$7.description,
24771
24412
  variant: "body1"
24772
24413
  }, {
24773
24414
  children: t("onboarding:landing.description")
@@ -24848,18 +24489,17 @@ const Accordion = _a => {
24848
24489
  });
24849
24490
  };
24850
24491
 
24851
- const styles$5 = createStyles({
24852
- carrierTypography: theme => ({
24853
- color: theme.palette.black
24854
- }),
24492
+ const getStyles$3 = (isConnected = false) => createStyles({
24493
+ connectButton: theme => [{
24494
+ padding: `0 ${theme.spacing(.5)}px`
24495
+ }, isConnected && {
24496
+ backgroundColor: theme.palette.success.main,
24497
+ color: theme.palette.white
24498
+ }],
24855
24499
  container: {
24856
24500
  display: "flex",
24857
24501
  flexDirection: "column"
24858
24502
  },
24859
- loadingButtonContainer: {
24860
- alignItems: "center",
24861
- display: "flex"
24862
- },
24863
24503
  logoContainer: theme => ({
24864
24504
  alignItems: "center",
24865
24505
  columnGap: `${theme.spacing(1)}px`,
@@ -24870,31 +24510,6 @@ const styles$5 = createStyles({
24870
24510
  display: "flex",
24871
24511
  justifyContent: "space-between",
24872
24512
  padding: `${theme.spacing(2)}px`
24873
- }),
24874
- statusChipConnected: theme => ({
24875
- alignItems: 'center',
24876
- background: theme.palette.success.main,
24877
- borderRadius: theme.borderRadius.S,
24878
- color: theme.palette.white,
24879
- display: 'flex',
24880
- flex: 'none',
24881
- flexDirection: 'row',
24882
- fontSize: theme.typography.fontSize.S,
24883
- fontWeight: theme.typography.fontWeight.bold,
24884
- gap: `${theme.spacing(1)}px}`,
24885
- height: '20px',
24886
- justifyContent: 'center',
24887
- lineHeight: `${theme.spacing(2.5)} px`,
24888
- order: '0',
24889
- padding: `${theme.spacing(.5)} px`,
24890
- width: '81px'
24891
- }),
24892
- statusChipNotConnected: theme => ({
24893
- background: 'none',
24894
- color: theme.palette.secondary.main,
24895
- fontSize: theme.typography.fontSize.M,
24896
- fontWeight: theme.typography.fontWeight.bold,
24897
- lineHeight: `${theme.spacing(3)} px`
24898
24513
  })
24899
24514
  });
24900
24515
 
@@ -24905,7 +24520,7 @@ var _ref$1 = process.env.NODE_ENV === "production" ? {
24905
24520
  } : {
24906
24521
  name: "111ty02-css",
24907
24522
  styles: "align-items:center;display:flex;label:css;",
24908
- map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpc3QtY2FycmllcnMtcm93LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFtQm9iIiwiZmlsZSI6Imxpc3QtY2FycmllcnMtcm93LnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IF9fYXdhaXRlciB9IGZyb20gXCJ0c2xpYlwiO1xyXG5pbXBvcnQgeyBqc3ggYXMgX2pzeCwganN4cyBhcyBfanN4cyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdC9qc3gtcnVudGltZVwiO1xyXG5pbXBvcnQgeyBjc3MgfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3RcIjtcclxuaW1wb3J0IHsgdXNlU3RhdGUgfSBmcm9tIFwicmVhY3RcIjtcclxuaW1wb3J0IHsgdXNlVHJhbnNsYXRpb24gfSBmcm9tIFwicmVhY3QtaTE4bmV4dFwiO1xyXG5pbXBvcnQgeyBCdXR0b24sIEJ1dHRvblZhcmlhbnQsIFR5cG9ncmFwaHkgfSBmcm9tIFwiQHBhY2tsaW5rL2dpZ2VyXCI7XHJcbmltcG9ydCB7IFRlbXBsYXRlcyB9IGZyb20gXCIuLi8uLi8uLi9jb21wb25lbnRzXCI7XHJcbmltcG9ydCB7IHN0eWxlcyB9IGZyb20gXCIuL2xpc3QtY2FycmllcnMtcm93LnN0eWxlc1wiO1xyXG5leHBvcnQgY29uc3QgTGlzdENhcnJpZXJzUm93ID0gKHsgY29ubmVjdGVkQ2FycmllcjogeyBjYXJyaWVyLCBpc0Nvbm5lY3RlZCB9LCByZWdpc3RlckNhcnJpZXIsIHJlZ2lzdGVyQ2FycmllckVycm9ycywgfSkgPT4ge1xyXG4gICAgY29uc3QgeyBuYW1lLCBsb2dvLCByZXF1aXJlZEZpZWxkcyB9ID0gY2FycmllcjtcclxuICAgIGNvbnN0IHsgdCB9ID0gdXNlVHJhbnNsYXRpb24oW1wibGlzdC1jYXJyaWVyc1wiXSk7XHJcbiAgICBjb25zdCBbc2hvd0Ryb3BEb3duLCBzZXRTaG93RHJvcERvd25dID0gdXNlU3RhdGUoZmFsc2UpO1xyXG4gICAgY29uc3QgW2lzU3VibWl0dGluZywgc2V0SXNTdWJtaXR0aW5nXSA9IHVzZVN0YXRlKGZhbHNlKTtcclxuICAgIGNvbnN0IGhhbmRsZVJlZ2lzdGVyID0gKHZhbHVlcykgPT4gX19hd2FpdGVyKHZvaWQgMCwgdm9pZCAwLCB2b2lkIDAsIGZ1bmN0aW9uKiAoKSB7XHJcbiAgICAgICAgc2V0SXNTdWJtaXR0aW5nKHRydWUpO1xyXG4gICAgICAgIHlpZWxkIHJlZ2lzdGVyQ2Fycmllcih2YWx1ZXMpO1xyXG4gICAgICAgIHNob3dEcm9wRG93biAmJiBzZXRTaG93RHJvcERvd24oZmFsc2UpO1xyXG4gICAgICAgIHNldElzU3VibWl0dGluZyhmYWxzZSk7XHJcbiAgICB9KTtcclxuICAgIHJldHVybiAoX2pzeHMoXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNzczogc3R5bGVzLmNvbnRhaW5lciB9LCB7IGNoaWxkcmVuOiBbX2pzeHMoXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNzczogc3R5bGVzLnJvd0NvbnRhaW5lciB9LCB7IGNoaWxkcmVuOiBbX2pzeHMoXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNzczogc3R5bGVzLmxvZ29Db250YWluZXIgfSwgeyBjaGlsZHJlbjogW19qc3goXCJkaXZcIiwgeyBjaGlsZHJlbjogX2pzeChcImltZ1wiLCB7IGFsdDogYCR7bmFtZX0tbG9nb2AsIGhlaWdodDogNDgsIHNyYzogbG9nbywgd2lkdGg6IDQ4IH0pIH0pLCBfanN4KFR5cG9ncmFwaHksIE9iamVjdC5hc3NpZ24oeyB2YXJpYW50OiBcInN1YnRpdGxlMVwiIH0sIHsgY2hpbGRyZW46IG5hbWUgfSkpXSB9KSksIF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNzczogY3NzKHsgYWxpZ25JdGVtczogXCJjZW50ZXJcIiwgZGlzcGxheTogXCJmbGV4XCIgfSkgfSwgeyBjaGlsZHJlbjogX2pzeChCdXR0b24sIE9iamVjdC5hc3NpZ24oeyBkaXNhYmxlZDogaXNDb25uZWN0ZWQgfHwgc2hvd0Ryb3BEb3duLCBpc0xvYWRpbmc6IGlzU3VibWl0dGluZywgb25DbGljazogKCkgPT4gX19hd2FpdGVyKHZvaWQgMCwgdm9pZCAwLCB2b2lkIDAsIGZ1bmN0aW9uKiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlcXVpcmVkRmllbGRzID09PSBudWxsIHx8IHJlcXVpcmVkRmllbGRzID09PSB2b2lkIDAgPyB2b2lkIDAgOiByZXF1aXJlZEZpZWxkcy5pbmNsdWRlcyhcImFkZHJlc3NcIikpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFNob3dEcm9wRG93bih0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHlpZWxkIGhhbmRsZVJlZ2lzdGVyKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdmFyaWFudDogQnV0dG9uVmFyaWFudC5URVhUIH0sIHsgY2hpbGRyZW46IGlzQ29ubmVjdGVkXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPyB0KFwibGlzdC1jYXJyaWVyczphY3Rpb25zLnN0YXR1cy5jb25uZWN0ZWRcIilcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IHQoXCJsaXN0LWNhcnJpZXJzOmFjdGlvbnMuc3RhdHVzLm5vdENvbm5lY3RlZFwiKSB9KSkgfSkpXSB9KSksIHNob3dEcm9wRG93biAmJiAoX2pzeChUZW1wbGF0ZXMuQWRkQ2FycmllckZvcm0sIHsgY2FycmllclRlcm1zOiBjYXJyaWVyLnRlcm1zICYmIGNhcnJpZXIudGVybXMsIG9uQ2FuY2VsOiAoKSA9PiBzZXRTaG93RHJvcERvd24oZmFsc2UpLCBvblN1Ym1pdDogKHZhbHVlcykgPT4gaGFuZGxlUmVnaXN0ZXIodmFsdWVzKSwgcmVnaXN0ZXJDYXJyaWVyRXJyb3JzOiByZWdpc3RlckNhcnJpZXJFcnJvcnMgfSkpXSB9KSkpO1xyXG59O1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1saXN0LWNhcnJpZXJzLXJvdy5qcy5tYXAiXX0= */",
24523
+ map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpc3QtY2FycmllcnMtcm93LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFtQmllIiwiZmlsZSI6Imxpc3QtY2FycmllcnMtcm93LnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IF9fYXdhaXRlciB9IGZyb20gXCJ0c2xpYlwiO1xyXG5pbXBvcnQgeyBqc3ggYXMgX2pzeCwganN4cyBhcyBfanN4cyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdC9qc3gtcnVudGltZVwiO1xyXG5pbXBvcnQgeyBjc3MgfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3RcIjtcclxuaW1wb3J0IHsgdXNlU3RhdGUgfSBmcm9tIFwicmVhY3RcIjtcclxuaW1wb3J0IHsgdXNlVHJhbnNsYXRpb24gfSBmcm9tIFwicmVhY3QtaTE4bmV4dFwiO1xyXG5pbXBvcnQgeyBCdXR0b24sIEJ1dHRvbkNvbG9yLCBCdXR0b25WYXJpYW50LCBUeXBvZ3JhcGh5IH0gZnJvbSBcIkBwYWNrbGluay9naWdlclwiO1xyXG5pbXBvcnQgeyBUZW1wbGF0ZXMgfSBmcm9tIFwiLi4vLi4vLi4vY29tcG9uZW50c1wiO1xyXG5pbXBvcnQgeyBnZXRTdHlsZXMgfSBmcm9tIFwiLi9saXN0LWNhcnJpZXJzLXJvdy5zdHlsZXNcIjtcclxuZXhwb3J0IGNvbnN0IExpc3RDYXJyaWVyc1JvdyA9ICh7IGNvbm5lY3RlZENhcnJpZXI6IHsgY2FycmllciwgaXNDb25uZWN0ZWQgfSwgcmVnaXN0ZXJDYXJyaWVyLCByZWdpc3RlckNhcnJpZXJFcnJvcnMsIH0pID0+IHtcclxuICAgIGNvbnN0IHsgc2hvcnRuYW1lOiBuYW1lLCBsb2dvLCByZXF1aXJlZEZpZWxkcyB9ID0gY2FycmllcjtcclxuICAgIGNvbnN0IHsgdCB9ID0gdXNlVHJhbnNsYXRpb24oW1wibGlzdC1jYXJyaWVyc1wiXSk7XHJcbiAgICBjb25zdCBbc2hvd0Ryb3BEb3duLCBzZXRTaG93RHJvcERvd25dID0gdXNlU3RhdGUoZmFsc2UpO1xyXG4gICAgY29uc3QgW2lzU3VibWl0dGluZywgc2V0SXNTdWJtaXR0aW5nXSA9IHVzZVN0YXRlKGZhbHNlKTtcclxuICAgIGNvbnN0IGhhbmRsZVJlZ2lzdGVyID0gKHZhbHVlcykgPT4gX19hd2FpdGVyKHZvaWQgMCwgdm9pZCAwLCB2b2lkIDAsIGZ1bmN0aW9uKiAoKSB7XHJcbiAgICAgICAgc2V0SXNTdWJtaXR0aW5nKHRydWUpO1xyXG4gICAgICAgIHlpZWxkIHJlZ2lzdGVyQ2Fycmllcih2YWx1ZXMpO1xyXG4gICAgICAgIHNob3dEcm9wRG93biAmJiBzZXRTaG93RHJvcERvd24oZmFsc2UpO1xyXG4gICAgICAgIHNldElzU3VibWl0dGluZyhmYWxzZSk7XHJcbiAgICB9KTtcclxuICAgIHJldHVybiAoX2pzeHMoXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNzczogZ2V0U3R5bGVzKCkuY29udGFpbmVyLCBcImRhdGEtdGVzdGlkXCI6IFwiY2Fycmllci1yb3dcIiB9LCB7IGNoaWxkcmVuOiBbX2pzeHMoXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNzczogZ2V0U3R5bGVzKCkucm93Q29udGFpbmVyIH0sIHsgY2hpbGRyZW46IFtfanN4cyhcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY3NzOiBnZXRTdHlsZXMoKS5sb2dvQ29udGFpbmVyIH0sIHsgY2hpbGRyZW46IFtfanN4KFwiZGl2XCIsIHsgY2hpbGRyZW46IF9qc3goXCJpbWdcIiwgeyBhbHQ6IGAke25hbWV9LWxvZ29gLCBoZWlnaHQ6IDQwLCBzcmM6IGxvZ28sIHdpZHRoOiA0MCB9KSB9KSwgX2pzeChUeXBvZ3JhcGh5LCBPYmplY3QuYXNzaWduKHsgdmFyaWFudDogXCJzdWJ0aXRsZTFcIiB9LCB7IGNoaWxkcmVuOiBuYW1lIH0pKV0gfSkpLCBfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IGNzcyh7IGFsaWduSXRlbXM6IFwiY2VudGVyXCIsIGRpc3BsYXk6IFwiZmxleFwiIH0pIH0sIHsgY2hpbGRyZW46IF9qc3goQnV0dG9uLCBPYmplY3QuYXNzaWduKHsgY29sb3I6IEJ1dHRvbkNvbG9yLlNFQ09OREFSWSwgY3NzOiBnZXRTdHlsZXMoaXNDb25uZWN0ZWQpLmNvbm5lY3RCdXR0b24sIGRpc2FibGVkOiBpc0Nvbm5lY3RlZCB8fCBzaG93RHJvcERvd24sIGlzTG9hZGluZzogaXNTdWJtaXR0aW5nLCBvbkNsaWNrOiAoKSA9PiBfX2F3YWl0ZXIodm9pZCAwLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVxdWlyZWRGaWVsZHMgPT09IG51bGwgfHwgcmVxdWlyZWRGaWVsZHMgPT09IHZvaWQgMCA/IHZvaWQgMCA6IHJlcXVpcmVkRmllbGRzLmluY2x1ZGVzKFwiYWRkcmVzc1wiKSlcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd0Ryb3BEb3duKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2VcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeWllbGQgaGFuZGxlUmVnaXN0ZXIoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB2YXJpYW50OiBCdXR0b25WYXJpYW50LlRFWFQgfSwgeyBjaGlsZHJlbjogaXNDb25uZWN0ZWRcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IHQoXCJsaXN0LWNhcnJpZXJzOmFjdGlvbnMuc3RhdHVzLmNvbm5lY3RlZFwiKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogdChcImxpc3QtY2FycmllcnM6YWN0aW9ucy5zdGF0dXMubm90Q29ubmVjdGVkXCIpIH0pKSB9KSldIH0pKSwgc2hvd0Ryb3BEb3duICYmIChfanN4KFRlbXBsYXRlcy5BZGRDYXJyaWVyRm9ybSwgeyBjYXJyaWVyVGVybXM6IGNhcnJpZXIudGVybXMgJiYgY2Fycmllci50ZXJtcywgb25DYW5jZWw6ICgpID0+IHNldFNob3dEcm9wRG93bihmYWxzZSksIG9uU3VibWl0OiAodmFsdWVzKSA9PiBoYW5kbGVSZWdpc3Rlcih2YWx1ZXMpLCByZWdpc3RlckNhcnJpZXJFcnJvcnM6IHJlZ2lzdGVyQ2FycmllckVycm9ycyB9KSldIH0pKSk7XHJcbn07XHJcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPWxpc3QtY2FycmllcnMtcm93LmpzLm1hcCJdfQ== */",
24909
24524
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__$2
24910
24525
  };
24911
24526
  const ListCarriersRow = ({
@@ -24917,7 +24532,7 @@ const ListCarriersRow = ({
24917
24532
  registerCarrierErrors
24918
24533
  }) => {
24919
24534
  const {
24920
- name,
24535
+ shortname: name,
24921
24536
  logo,
24922
24537
  requiredFields
24923
24538
  } = carrier;
@@ -24933,20 +24548,21 @@ const ListCarriersRow = ({
24933
24548
  setIsSubmitting(false);
24934
24549
  });
24935
24550
  return jsxs("div", Object.assign({
24936
- css: styles$5.container
24551
+ css: getStyles$3().container,
24552
+ "data-testid": "carrier-row"
24937
24553
  }, {
24938
24554
  children: [jsxs("div", Object.assign({
24939
- css: styles$5.rowContainer
24555
+ css: getStyles$3().rowContainer
24940
24556
  }, {
24941
24557
  children: [jsxs("div", Object.assign({
24942
- css: styles$5.logoContainer
24558
+ css: getStyles$3().logoContainer
24943
24559
  }, {
24944
24560
  children: [jsx("div", {
24945
24561
  children: jsx("img", {
24946
24562
  alt: `${name}-logo`,
24947
- height: 48,
24563
+ height: 40,
24948
24564
  src: logo,
24949
- width: 48
24565
+ width: 40
24950
24566
  })
24951
24567
  }), jsx(Typography, Object.assign({
24952
24568
  variant: "subtitle1"
@@ -24957,6 +24573,8 @@ const ListCarriersRow = ({
24957
24573
  css: _ref$1
24958
24574
  }, {
24959
24575
  children: jsx(Button, Object.assign({
24576
+ color: ButtonColor.SECONDARY,
24577
+ css: getStyles$3(isConnected).connectButton,
24960
24578
  disabled: isConnected || showDropDown,
24961
24579
  isLoading: isSubmitting,
24962
24580
  onClick: () => __awaiter(void 0, void 0, void 0, function* () {
@@ -24976,7 +24594,7 @@ const ListCarriersRow = ({
24976
24594
  }));
24977
24595
  };
24978
24596
 
24979
- const styles$4 = createStyles({
24597
+ const styles$6 = createStyles({
24980
24598
  listContainer: theme => ({
24981
24599
  "& > li:not(:last-of-type)": {
24982
24600
  borderBottom: `1px solid ${theme.palette.gray.light}`
@@ -25023,7 +24641,7 @@ const ListCarriers$1 = ({
25023
24641
  children: t("list-carriers:headers.accountCarriers")
25024
24642
  }))
25025
24643
  }), jsx("ul", Object.assign({
25026
- css: styles$4.listContainer
24644
+ css: styles$6.listContainer
25027
24645
  }, {
25028
24646
  children: isLoading ? jsxs(Fragment, {
25029
24647
  children: [jsx(LoadingSkeletonRow, {}), jsx(LoadingSkeletonRow, {}), jsx(LoadingSkeletonRow, {})]
@@ -25044,10 +24662,10 @@ const ListCarriers$1 = ({
25044
24662
  };
25045
24663
  const LoadingSkeletonRow = () => {
25046
24664
  return jsxs("div", Object.assign({
25047
- css: styles$4.skeletonRow
24665
+ css: styles$6.skeletonRow
25048
24666
  }, {
25049
24667
  children: [jsxs("div", Object.assign({
25050
- css: styles$4.skeletonLogoContainer
24668
+ css: styles$6.skeletonLogoContainer
25051
24669
  }, {
25052
24670
  children: [jsx(Skeleton, {
25053
24671
  animation: SkeletonAnimation.WAVE,
@@ -25071,7 +24689,7 @@ const LoadingSkeletonRow = () => {
25071
24689
  }));
25072
24690
  };
25073
24691
 
25074
- const styles$3 = createStyles({
24692
+ const styles$5 = createStyles({
25075
24693
  body: theme => ({
25076
24694
  borderTop: `1px solid ${theme.palette.gray.light}`,
25077
24695
  color: theme.palette.black,
@@ -25122,14 +24740,14 @@ const SettingsCard = ({
25122
24740
  verticallyAligned
25123
24741
  }) => {
25124
24742
  return jsxs("div", Object.assign({
25125
- css: verticallyAligned ? styles$3.verticalContainer : styles$3.container,
24743
+ css: verticallyAligned ? styles$5.verticalContainer : styles$5.container,
25126
24744
  "data-testid": "settingsCard"
25127
24745
  }, {
25128
24746
  children: [jsxs("div", Object.assign({
25129
- css: styles$3.header
24747
+ css: styles$5.header
25130
24748
  }, {
25131
24749
  children: [jsxs("div", Object.assign({
25132
- css: styles$3.title
24750
+ css: styles$5.title
25133
24751
  }, {
25134
24752
  children: [typeof title === "string" ? jsx(Typography, Object.assign({
25135
24753
  variant: "subtitle2"
@@ -25164,7 +24782,7 @@ const SettingsCard = ({
25164
24782
  }))
25165
24783
  }))]
25166
24784
  })), children && jsx("div", Object.assign({
25167
- css: styles$3.body
24785
+ css: styles$5.body
25168
24786
  }, {
25169
24787
  children: jsxs("div", {
25170
24788
  children: [children, accessoryAction && jsx(ButtonGroup, Object.assign({
@@ -25281,7 +24899,7 @@ const warehouseSchema = z.discriminatedUnion("returnToAddressIsDifferent", [z.ob
25281
24899
  });
25282
24900
  });
25283
24901
 
25284
- const styles$2 = createStyles({
24902
+ const styles$4 = createStyles({
25285
24903
  header: {
25286
24904
  textAlign: "center"
25287
24905
  },
@@ -25333,12 +24951,12 @@ const WarehouseForm = ({
25333
24951
  }
25334
24952
  }));
25335
24953
  return jsxs("div", Object.assign({
25336
- css: _isOnboarding ? styles$2.onboardingWell : styles$2.well,
24954
+ css: _isOnboarding ? styles$4.onboardingWell : styles$4.well,
25337
24955
  "data-testid": "warehouse-form"
25338
24956
  }, {
25339
24957
  children: [_isOnboarding && jsxs(Fragment, {
25340
24958
  children: [jsxs("div", Object.assign({
25341
- css: styles$2.header
24959
+ css: styles$4.header
25342
24960
  }, {
25343
24961
  children: [jsx(Typography, Object.assign({
25344
24962
  variant: "heading4"
@@ -26542,21 +26160,84 @@ $$3({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
26542
26160
  }
26543
26161
  });
26544
26162
 
26545
- const BillingFields = ({
26546
- form
26163
+ const CompletionPage = ({
26164
+ onContinue
26547
26165
  }) => {
26548
26166
  const {
26549
26167
  t
26550
- } = useTranslation();
26551
- const expirationMonthOptions = useExpirationMonthOptions();
26552
- return jsxs(Fragment, {
26553
- children: [jsx(GridChild, Object.assign({
26554
- colSpan: 12
26168
+ } = useTranslation(["common", "onboarding"]);
26169
+ return jsxs("div", Object.assign({
26170
+ css: {
26171
+ alignItems: "center",
26172
+ display: "flex",
26173
+ flexDirection: "column"
26174
+ },
26175
+ "data-testid": "onboarding-complete"
26176
+ }, {
26177
+ children: [jsx(Typography, Object.assign({
26178
+ variant: "heading4"
26555
26179
  }, {
26556
- children: jsx(TextInput, {
26557
- control: form.control,
26558
- label: t("billing.fields.name"),
26559
- labelWeight: "normal",
26180
+ children: t("onboarding:success.title")
26181
+ })), jsx(Spacer, {
26182
+ multiplier: 2
26183
+ }), jsx(Typography, Object.assign({
26184
+ variant: "subtitle1"
26185
+ }, {
26186
+ children: t("onboarding:success.subtitle")
26187
+ })), jsx(Spacer, {
26188
+ multiplier: 10
26189
+ }), jsxs("svg", Object.assign({
26190
+ fill: "none",
26191
+ height: "86",
26192
+ viewBox: "0 0 86 86",
26193
+ width: "86",
26194
+ xmlns: "http://www.w3.org/2000/svg"
26195
+ }, {
26196
+ children: [jsx("circle", {
26197
+ cx: "43",
26198
+ cy: "43.3379",
26199
+ fill: "#E8F6FF",
26200
+ r: "42.5"
26201
+ }), jsx("path", {
26202
+ d: "M56.6583 26.4724C57.2882 25.8425 58.3095 25.8425 58.9393 26.4724L64.1038 31.6369C64.7337 32.2668 64.7337 33.288 64.1038 33.9179L37.8303 60.1915L30.3848 52.746L56.6583 26.4724Z",
26203
+ fill: "#006FBB"
26204
+ }), jsx("path", {
26205
+ d: "M21.4724 43.8446C20.8425 43.2147 20.8425 42.1935 21.4724 41.5636L26.4689 36.5671C27.0988 35.9372 28.12 35.9372 28.7499 36.5671L45.1032 52.9204L37.8257 60.1979L21.4724 43.8446Z",
26206
+ fill: "#006FBB"
26207
+ })]
26208
+ })), jsx(Spacer, {
26209
+ multiplier: 10
26210
+ }), jsx(ButtonGroup, Object.assign({
26211
+ justify: "center"
26212
+ }, {
26213
+ children: jsx(Button, Object.assign({
26214
+ bold: false,
26215
+ color: ButtonColor.PRIMARY,
26216
+ onClick: onContinue,
26217
+ type: "button",
26218
+ variant: ButtonVariant.FILLED
26219
+ }, {
26220
+ children: t("onboarding:success.action")
26221
+ }))
26222
+ }))]
26223
+ }));
26224
+ };
26225
+
26226
+ const BillingFields = ({
26227
+ form
26228
+ }) => {
26229
+ const {
26230
+ t
26231
+ } = useTranslation();
26232
+ const expirationMonthOptions = useExpirationMonthOptions();
26233
+ return jsxs(Fragment, {
26234
+ children: [jsx(GridChild, Object.assign({
26235
+ colSpan: 12
26236
+ }, {
26237
+ children: jsx(TextInput, {
26238
+ control: form.control,
26239
+ label: t("billing.fields.name"),
26240
+ labelWeight: "normal",
26560
26241
  name: "creditCard.name",
26561
26242
  nativeLabel: true
26562
26243
  })
@@ -26727,7 +26408,7 @@ const EditWalletAddressForm = ({
26727
26408
  }));
26728
26409
  };
26729
26410
 
26730
- const styles$1 = createStyles({
26411
+ const styles$3 = createStyles({
26731
26412
  grid: theme => ({
26732
26413
  margin: theme.spacing(4)
26733
26414
  }),
@@ -26775,21 +26456,21 @@ const WalletForm = ({
26775
26456
  onSubmit: formLogger.capture(handleSubmit)
26776
26457
  }, {
26777
26458
  children: jsxs(Grid, Object.assign({
26778
- css: styles$1.grid,
26459
+ css: styles$3.grid,
26779
26460
  noPadding: true
26780
26461
  }, {
26781
26462
  children: [jsx(GridChild, Object.assign({
26782
26463
  colSpan: 12
26783
26464
  }, {
26784
26465
  children: jsx(Typography, Object.assign({
26785
- css: styles$1.heading,
26466
+ css: styles$3.heading,
26786
26467
  variant: "heading4"
26787
26468
  }, {
26788
26469
  children: t("register-wallet:sections.billing.title")
26789
26470
  }))
26790
26471
  })), jsx(GridChild, Object.assign({
26791
26472
  colSpan: 12,
26792
- css: styles$1.subtitle
26473
+ css: styles$3.subtitle
26793
26474
  }, {
26794
26475
  children: jsx(Typography, Object.assign({
26795
26476
  variant: "subtitle1"
@@ -26811,7 +26492,7 @@ const WalletForm = ({
26811
26492
  colSpan: 12
26812
26493
  }, {
26813
26494
  children: jsx(Typography, Object.assign({
26814
- css: styles$1.subtitle,
26495
+ css: styles$3.subtitle,
26815
26496
  variant: "subtitle1"
26816
26497
  }, {
26817
26498
  children: t("register-wallet:sections.billing.addressSubTitle")
@@ -26878,7 +26559,7 @@ const WalletForm = ({
26878
26559
  }));
26879
26560
  };
26880
26561
 
26881
- const styles = createStyles({
26562
+ const styles$2 = createStyles({
26882
26563
  lastStep: {
26883
26564
  "& > span::first-of-type": {
26884
26565
  "::after": {
@@ -26983,40 +26664,9 @@ const Onboarding$1 = ({
26983
26664
  var _a;
26984
26665
  // Step 5: Onboarding Complete
26985
26666
  if (hasCompletedOnboarding) {
26986
- return jsxs("div", Object.assign({
26987
- css: {
26988
- alignItems: "center",
26989
- display: "flex",
26990
- flexDirection: "column"
26991
- },
26992
- "data-testid": "onboarding-complete"
26993
- }, {
26994
- children: [jsx(Typography, Object.assign({
26995
- variant: "heading4"
26996
- }, {
26997
- children: t("onboarding:success.title")
26998
- })), jsx(Spacer, {
26999
- multiplier: 2
27000
- }), jsx(Typography, Object.assign({
27001
- variant: "subtitle1"
27002
- }, {
27003
- children: t("onboarding:success.subtitle")
27004
- })), jsx(Spacer, {
27005
- multiplier: 48
27006
- }), jsx(ButtonGroup, Object.assign({
27007
- justify: "center"
27008
- }, {
27009
- children: jsx(Button, Object.assign({
27010
- bold: false,
27011
- color: ButtonColor.PRIMARY,
27012
- onClick: onCompleteOnboarding,
27013
- type: "button",
27014
- variant: ButtonVariant.FILLED
27015
- }, {
27016
- children: t("onboarding:success.action")
27017
- }))
27018
- }))]
27019
- }));
26667
+ return jsx(CompletionPage, {
26668
+ onContinue: onCompleteOnboarding
26669
+ });
27020
26670
  }
27021
26671
  // Step 1: Landing Page
27022
26672
  if (!email) return jsx(LandingPage, {
@@ -27092,16 +26742,16 @@ const Onboarding$1 = ({
27092
26742
  currentStep: currentStep
27093
26743
  }, {
27094
26744
  children: [jsx(Step, {
27095
- css: styles.step,
26745
+ css: styles$2.step,
27096
26746
  label: t("onboarding:steps.login")
27097
26747
  }), jsx(Step, {
27098
- css: styles.step,
26748
+ css: styles$2.step,
27099
26749
  label: t("onboarding:steps.carriers")
27100
26750
  }), jsx(Step, {
27101
- css: styles.step,
26751
+ css: styles$2.step,
27102
26752
  label: t("onboarding:steps.addresses")
27103
26753
  }), jsx(Step, {
27104
- css: styles.lastStep,
26754
+ css: styles$2.lastStep,
27105
26755
  label: t("onboarding:steps.payment")
27106
26756
  })]
27107
26757
  })), renderStep()]
@@ -27155,24 +26805,567 @@ const Cube = _a => {
27155
26805
  }, props, {
27156
26806
  role: "status"
27157
26807
  }, {
27158
- children: jsx("svg", Object.assign({
27159
- css: styles.content,
27160
- height: "100%",
27161
- viewBox: "0 0 489 489",
27162
- width: "100%"
26808
+ children: jsx("svg", Object.assign({
26809
+ css: styles.content,
26810
+ height: "100%",
26811
+ viewBox: "0 0 489 489",
26812
+ width: "100%"
26813
+ }, {
26814
+ children: jsx("g", {
26815
+ children: jsx("g", {
26816
+ children: jsx("path", {
26817
+ d: "M483.674,101.836C483.61,101.604 483.506,101.396 483.418,101.18C483.242,100.724 483.05,100.284 482.794,99.868C482.65,99.636 482.498,99.428 482.33,99.212C482.058,98.844 481.754,98.508 481.41,98.196C481.21,98.004 481.01,97.828 480.786,97.66C480.658,97.564 480.562,97.444 480.434,97.356C480.138,97.156 479.81,97.044 479.498,96.884C479.338,96.804 479.218,96.684 479.05,96.612L247.05,0.612C245.082,-0.204 242.89,-0.204 240.922,0.612L8.922,96.612C8.754,96.684 8.626,96.804 8.466,96.884C8.154,97.036 7.834,97.156 7.546,97.348C7.418,97.436 7.322,97.556 7.194,97.652C6.97,97.82 6.778,98.004 6.578,98.188C6.242,98.5 5.938,98.836 5.658,99.204C5.49,99.42 5.338,99.628 5.194,99.86C4.938,100.276 4.746,100.716 4.57,101.172C4.482,101.396 4.378,101.596 4.314,101.828C4.13,102.532 4.002,103.26 4.002,104.004L4.002,384.004C4.002,387.244 5.954,390.164 8.938,391.396L240.938,487.396C241.042,487.436 241.154,487.42 241.258,487.46C242.146,487.788 243.058,488.004 244.002,488.004C244.946,488.004 245.858,487.788 246.746,487.46C246.85,487.42 246.962,487.436 247.066,487.396L479.066,391.396C482.05,390.164 484.002,387.244 484.002,384.004L484.002,104.004C484.002,103.26 483.874,102.532 483.674,101.836ZM236.002,468.028L20.002,378.66L20.002,115.972L236.002,205.348L236.002,468.028ZM244.002,191.348L32.922,104.004L244.002,16.66L455.082,104.004L244.002,191.348ZM468.002,378.66L252.002,468.036L252.002,205.348L468.002,115.972L468.002,378.66Z",
26818
+ fill: theme.palette.primary.main
26819
+ })
26820
+ })
26821
+ })
26822
+ }))
26823
+ }));
26824
+ };
26825
+
26826
+ /**
26827
+ * A drop-in replacement for the `<form>` tag that allows nested forms.
26828
+ *
26829
+ * Via portals, the <form> tag is mounted as a sibling of the app root. The form's
26830
+ * interface is then mounted back at the point of use.
26831
+ */
26832
+ const FormPortal = ({
26833
+ css,
26834
+ children,
26835
+ id,
26836
+ onSubmit,
26837
+ variant
26838
+ }) => {
26839
+ const rootTarget = useRootPortal();
26840
+ const [interfaceTarget, setInterfaceTarget] = useState(null);
26841
+ const onMountInterfaceTarget = useCallback(element => {
26842
+ if (element) setInterfaceTarget(element);
26843
+ }, []);
26844
+ const formStyle = [variant === "well" && (theme => ({
26845
+ backgroundColor: theme.palette.gray.ultraLight,
26846
+ padding: theme.spacing(2)
26847
+ })), css];
26848
+ return jsxs(Fragment, {
26849
+ children: [jsx(Portal, Object.assign({
26850
+ target: rootTarget
26851
+ }, {
26852
+ children: jsx("form", Object.assign({
26853
+ id: id,
26854
+ onSubmit: onSubmit
26855
+ }, {
26856
+ children: jsx(Portal, Object.assign({
26857
+ target: interfaceTarget
26858
+ }, {
26859
+ children: children
26860
+ }))
26861
+ }))
26862
+ })), jsx("section", {
26863
+ css: formStyle,
26864
+ id: id + "-interface",
26865
+ ref: onMountInterfaceTarget
26866
+ })]
26867
+ });
26868
+ };
26869
+
26870
+ const Loader = props => {
26871
+ return jsx("div", Object.assign({
26872
+ css: {
26873
+ alignItems: "center",
26874
+ display: "flex",
26875
+ flexDirection: "column",
26876
+ height: "100%",
26877
+ justifyContent: "center",
26878
+ textAlign: "center",
26879
+ width: "100%"
26880
+ }
26881
+ }, {
26882
+ children: jsx(Spinner, Object.assign({}, props, {
26883
+ size: SpinnerSize.SIZE_LARGE
26884
+ }))
26885
+ }));
26886
+ };
26887
+
26888
+ const getStyles$2 = ({
26889
+ isDisabled,
26890
+ isSelected
26891
+ } = {}) => createStyles({
26892
+ chip: theme => [isSelected ? {
26893
+ backgroundColor: theme.palette.secondary.ultraLight,
26894
+ color: theme.palette.secondary.main
26895
+ } : {
26896
+ backgroundColor: theme.palette.white,
26897
+ color: theme.palette.gray.main
26898
+ },
26899
+ // TODO [LMNT-663] - Giger's Chip component needs support added for an isDisabled prop
26900
+ isDisabled && {
26901
+ backgroundColor: theme.palette.gray.light,
26902
+ cursor: "none",
26903
+ pointerEvents: "none"
26904
+ }],
26905
+ chipList: theme => ({
26906
+ gap: theme.spacing(1)
26907
+ }),
26908
+ fundsInput: theme => ({
26909
+ maxWidth: theme.spacing(24)
26910
+ })
26911
+ });
26912
+
26913
+ const getAddFundsSchema = (minimumAmount = 10) => z.object({
26914
+ funds: moneySchema.extend({
26915
+ amount: z.number().min(minimumAmount)
26916
+ })
26917
+ }).transform(data => data.funds);
26918
+
26919
+ /**
26920
+ * Form for adding funds to a carrier's account.
26921
+ *
26922
+ * If a render child is provided, external control is assumed and the cancel / submit buttons are hidden.
26923
+ */
26924
+ const AddFundsForm = ({
26925
+ carrierId,
26926
+ children,
26927
+ onCancel,
26928
+ onSuccess,
26929
+ minimumAmount: _minimumAmount = 0
26930
+ }) => {
26931
+ const {
26932
+ t
26933
+ } = useTranslation();
26934
+ const addFunds = useAddFunds(carrierId);
26935
+ const carrier = useGetCarrierById(carrierId);
26936
+ const chips = [{
26937
+ label: "$20",
26938
+ value: 20
26939
+ }, {
26940
+ label: "$50",
26941
+ value: 50
26942
+ }, {
26943
+ label: "$100",
26944
+ value: 100
26945
+ }, {
26946
+ label: t("manage-funding:addFunds.custom"),
26947
+ value: "custom"
26948
+ }];
26949
+ const [selectedChip, setSelectedChip] = useState(_minimumAmount > 0 ? chips[3] : chips[0]);
26950
+ _minimumAmount = Math.max(_minimumAmount, 10);
26951
+ const form = useForm({
26952
+ defaultValues: {
26953
+ funds: {
26954
+ amount: selectedChip.value === "custom" ? _minimumAmount : selectedChip.value,
26955
+ currency: SE.Currency.USD
26956
+ }
26957
+ },
26958
+ resolver: validationResolver(getAddFundsSchema(_minimumAmount))
26959
+ });
26960
+ const {
26961
+ isSubmitted,
26962
+ isValid
26963
+ } = form.formState;
26964
+ const watchAmount = form.watch("funds").amount;
26965
+ const formId = "add-funds-form";
26966
+ const handleSubmit = formLogger.capture(form.handleSubmit(values => {
26967
+ const payload = values;
26968
+ addFunds.mutate(payload, {
26969
+ onSuccess: () => onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess()
26970
+ });
26971
+ }));
26972
+ if (carrier.isLoading) return jsx(Loader, {
26973
+ message: t("loading.carrier")
26974
+ });
26975
+ if (!carrier.data) throw new Error("errorMessages.unableToLoad.carrier");
26976
+ const balance = carrier.data.balance;
26977
+ if (balance === undefined) return jsx(InlineNotification, Object.assign({
26978
+ type: NotificationType.ERROR
26979
+ }, {
26980
+ children: t("manage-funding:errors.unableToFindBalance")
26981
+ }));
26982
+ return jsxs(Fragment, {
26983
+ children: [jsxs(FormPortal, Object.assign({
26984
+ id: formId,
26985
+ onSubmit: handleSubmit,
26986
+ variant: "well"
26987
+ }, {
26988
+ children: [jsx(Typography, Object.assign({
26989
+ bold: true
26990
+ }, {
26991
+ children: t("manage-funding:actions.addFunds")
26992
+ })), jsx(Spacer, {
26993
+ multiplier: 2
26994
+ }), jsx(ChipList, Object.assign({
26995
+ css: getStyles$2().chipList,
26996
+ onChange: idx => {
26997
+ const chip = chips[idx];
26998
+ setSelectedChip(chip);
26999
+ if (chip.value !== "custom") {
27000
+ form.reset({
27001
+ funds: {
27002
+ amount: chip.value,
27003
+ currency: SE.Currency.USD
27004
+ }
27005
+ });
27006
+ }
27007
+ }
27008
+ }, {
27009
+ children: chips.map(chip => jsx(Chip, Object.assign({
27010
+ css: getStyles$2({
27011
+ isDisabled: chip.value < _minimumAmount,
27012
+ isSelected: chip.value === selectedChip.value
27013
+ }).chip,
27014
+ isSelected: chip.value === selectedChip.value
27015
+ }, {
27016
+ children: jsx(Typography, Object.assign({
27017
+ variant: "small"
27018
+ }, {
27019
+ children: chip.label
27020
+ }))
27021
+ }), chip.label))
27022
+ })), selectedChip.value === "custom" && jsxs(Fragment, {
27023
+ children: [jsx(Spacer, {
27024
+ multiplier: 1
27025
+ }), jsx(MoneyInput, {
27026
+ control: form.control,
27027
+ css: getStyles$2().fundsInput,
27028
+ defaultValue: {
27029
+ amount: undefined,
27030
+ currency: SE.Currency.USD
27031
+ },
27032
+ form: formId,
27033
+ hint: t("manage-funding:addFunds.minimumPurchaseAmount"),
27034
+ label: t("manage-funding:addFunds.labels.amount"),
27035
+ name: "funds",
27036
+ nativeLabel: true,
27037
+ showCurrencySymbol: true
27038
+ })]
27039
+ }), !children && jsxs(Fragment, {
27040
+ children: [jsx(Spacer, {
27041
+ multiplier: selectedChip.value !== "custom" ? 1.5 : 1
27042
+ }), jsxs(ButtonGroup, Object.assign({
27043
+ justify: "end"
27044
+ }, {
27045
+ children: [onCancel && jsx(Button, Object.assign({
27046
+ onClick: onCancel,
27047
+ variant: ButtonVariant.TEXT
27048
+ }, {
27049
+ children: t("actions.cancel")
27050
+ })), jsx(SubmitButton, Object.assign({
27051
+ control: form.control,
27052
+ form: formId,
27053
+ isLoading: addFunds.isLoading,
27054
+ variant: ButtonVariant.OUTLINED
27055
+ }, {
27056
+ children: t("manage-funding:actions.addNow")
27057
+ }))]
27058
+ }))]
27059
+ })]
27060
+ })), addFunds.error && jsxs(Fragment, {
27061
+ children: [jsx(Spacer, {
27062
+ multiplier: 1
27063
+ }), jsx(InlineNotification, Object.assign({
27064
+ title: t("manage-funding:addFunds.error.title"),
27065
+ type: NotificationType.ERROR
27066
+ }, {
27067
+ children: addFunds.error[0].message
27068
+ }))]
27069
+ }), children === null || children === void 0 ? void 0 : children({
27070
+ isCustomAmount: selectedChip.value === "custom",
27071
+ isSubmitted,
27072
+ isSubmitting: addFunds.isLoading,
27073
+ isValid,
27074
+ selectedAmount: watchAmount,
27075
+ submit: handleSubmit
27076
+ })]
27077
+ });
27078
+ };
27079
+
27080
+ const InlineLabel = ({
27081
+ children,
27082
+ label
27083
+ }) => jsxs("div", Object.assign({
27084
+ css: theme => ({
27085
+ alignItems: "center",
27086
+ display: "flex",
27087
+ gap: theme.spacing(1)
27088
+ })
27089
+ }, {
27090
+ children: [jsx(Typography, {
27091
+ children: label
27092
+ }), children]
27093
+ }));
27094
+
27095
+ const getStyles$1 = balance => createStyles({
27096
+ balanceText: theme => ({
27097
+ color: balance === undefined ? theme.palette.alert.main : balance >= 0 ? theme.palette.secondary.dark : theme.palette.error.main
27098
+ })
27099
+ });
27100
+
27101
+ const CarrierBalance = ({
27102
+ carrierId
27103
+ }) => {
27104
+ const {
27105
+ t
27106
+ } = useTranslation();
27107
+ const {
27108
+ data: carrier,
27109
+ isLoading: isLoadingCarrier,
27110
+ isRefetching: isRefetchingCarrier
27111
+ } = useGetCarrierById(carrierId);
27112
+ const balance = carrier === null || carrier === void 0 ? void 0 : carrier.balance;
27113
+ return jsx(InlineLabel, Object.assign({
27114
+ label: t("manage-funding:currentBalance")
27115
+ }, {
27116
+ children: isLoadingCarrier || isRefetchingCarrier ? jsx(Spinner, {}) : jsx(Typography, Object.assign({
27117
+ bold: true,
27118
+ css: getStyles$1(balance).balanceText
27119
+ }, {
27120
+ children: balance === undefined ? t("manage-funding:errors.balanceUnknown") : formatMoney({
27121
+ amount: balance,
27122
+ currency: SE.Currency.USD
27123
+ })
27124
+ }))
27125
+ }));
27126
+ };
27127
+
27128
+ const icons = {
27129
+ add: IconNames.ADD,
27130
+ download: IconNames.DOWNLOAD
27131
+ };
27132
+ const LinkAction = _a => {
27133
+ var {
27134
+ css,
27135
+ icon,
27136
+ isDisabled,
27137
+ isLoading,
27138
+ title
27139
+ } = _a,
27140
+ props = __rest(_a, ["css", "icon", "isDisabled", "isLoading", "title"]);
27141
+ return jsx(Link, Object.assign({}, props, {
27142
+ bold: true,
27143
+ css: theme => [{
27144
+ alignItems: "center",
27145
+ display: "flex",
27146
+ gap: theme.spacing(1)
27147
+ },
27148
+ // TODO [LMNT-663] - Giger's Link component does not render isDisabled state unless isButton is true
27149
+ (isDisabled || isLoading) && {
27150
+ color: theme.palette.gray.main,
27151
+ cursor: "none",
27152
+ pointerEvents: "none"
27153
+ }, css],
27154
+ isDisabled: isDisabled,
27155
+ size: ButtonSize.MEDIUM
27156
+ }, {
27157
+ children: isLoading ? jsx(Spinner, {}) : jsxs(Fragment, {
27158
+ children: [title, icon && jsx(Icon, {
27159
+ name: icons[icon],
27160
+ size: IconSize.SIZE_MEDIUM,
27161
+ title: title
27162
+ })]
27163
+ })
27164
+ }));
27165
+ };
27166
+
27167
+ const Spread = ({
27168
+ children
27169
+ }) => jsx("div", Object.assign({
27170
+ css: theme => ({
27171
+ display: "flex",
27172
+ gap: theme.spacing(2),
27173
+ justifyContent: "space-between"
27174
+ })
27175
+ }, {
27176
+ children: children
27177
+ }));
27178
+
27179
+ const getStyles = isCustomAmount => createStyles({
27180
+ balanceText: theme => ({
27181
+ color: theme.palette.secondary.dark
27182
+ }),
27183
+ container: theme => ({
27184
+ padding: theme.spacing(3)
27185
+ }),
27186
+ formExtension: theme => ({
27187
+ backgroundColor: theme.palette.gray.ultraLight,
27188
+ display: "flex",
27189
+ flexDirection: "column",
27190
+ gap: theme.spacing(1),
27191
+ // Negative margin is to compensate for the padding on AddFundsForm, since we want this
27192
+ // section to seemlessly extend the form's well.
27193
+ marginTop: theme.spacing(isCustomAmount ? -1.5 : -1),
27194
+ padding: theme.spacing(2),
27195
+ paddingTop: 0
27196
+ }),
27197
+ saveRateButton: {
27198
+ whiteSpace: "nowrap"
27199
+ }
27200
+ });
27201
+
27202
+ /**
27203
+ * Fund and Purchase handles the label purchase submission UX, ensuring that a user
27204
+ * has the necessary funds available and can add them if not. It allows a single button
27205
+ * to submit the funding form followed by the purchase form.
27206
+ */
27207
+ const FundAndPurchase = ({
27208
+ carrierId,
27209
+ className,
27210
+ disabled,
27211
+ isFundingRequired,
27212
+ onSave,
27213
+ purchaseAmount,
27214
+ onPurchase
27215
+ }) => {
27216
+ const {
27217
+ t
27218
+ } = useTranslation();
27219
+ const [isAddFundsFormOpen, setIsAddFundsFormOpen] = useState(false);
27220
+ const {
27221
+ data: carrier,
27222
+ isLoading: isLoadingCarrier
27223
+ } = useGetCarrierById(carrierId);
27224
+ const isAddingFunds = !!useIsMutating({
27225
+ mutationKey: ["useAddFunds"]
27226
+ });
27227
+ const isCreatingLabel = !!useIsMutating({
27228
+ mutationKey: ["useCreateLabel"]
27229
+ });
27230
+ const [isSavingRate, setIsSavingRate] = useState(false);
27231
+ const handleSaveRate = () => __awaiter(void 0, void 0, void 0, function* () {
27232
+ setIsSavingRate(true);
27233
+ yield onSave();
27234
+ setIsSavingRate(false);
27235
+ });
27236
+ // Automatically open the Add Funds form if the carrier's balance is insufficient.
27237
+ useEffect(() => {
27238
+ if (isFundingRequired && (carrier === null || carrier === void 0 ? void 0 : carrier.balance) !== undefined && carrier.balance < purchaseAmount) setIsAddFundsFormOpen(true);
27239
+ }, [carrier === null || carrier === void 0 ? void 0 : carrier.balance, isFundingRequired, purchaseAmount]);
27240
+ const renderActionButtons = (addFundsForm = {}) => jsxs(ButtonGroup, Object.assign({
27241
+ justify: "end"
27242
+ }, {
27243
+ children: [jsx(Button, Object.assign({
27244
+ bold: false,
27245
+ css: getStyles().saveRateButton,
27246
+ disabled: disabled || !carrierId || isAddingFunds || isCreatingLabel,
27247
+ isLoading: isSavingRate,
27248
+ onClick: handleSaveRate,
27249
+ variant: ButtonVariant.OUTLINED
27250
+ }, {
27251
+ children: t("purchase-label:actions.saveRate")
27252
+ })), jsx(Button, Object.assign({
27253
+ "data-testid": "submit-fund-and-purchase",
27254
+ disabled: disabled || !carrierId || isFundingRequired && isAddFundsFormOpen && addFundsForm.isSubmitted && !addFundsForm.isValid,
27255
+ isLoading: addFundsForm.isSubmitting || isAddingFunds || isCreatingLabel,
27256
+ onClick: isAddFundsFormOpen ? addFundsForm.submit : onPurchase
27257
+ }, {
27258
+ children: isAddFundsFormOpen ? t("manage-funding:actions.addFundsAndPurchase") : t("purchase-label:actions.purchaseNow")
27259
+ }))]
27260
+ }));
27261
+ if (!isFundingRequired) return jsx("div", Object.assign({
27262
+ className: className,
27263
+ css: getStyles().container
27264
+ }, {
27265
+ children: renderActionButtons()
27266
+ }));
27267
+ if (isLoadingCarrier) return jsx(Loader, {
27268
+ message: t("loading.carrier")
27269
+ });
27270
+ if (!carrier || !carrierId) throw new Error("errorMessages.unableToLoad.carrier");
27271
+ const balance = carrier.balance;
27272
+ const handleAddFundsSuccess = () => {
27273
+ setIsAddFundsFormOpen(false);
27274
+ onPurchase();
27275
+ };
27276
+ return jsxs("div", Object.assign({
27277
+ className: className,
27278
+ css: getStyles().container
27279
+ }, {
27280
+ children: [jsxs(Spread, {
27281
+ children: [jsx(CarrierBalance, {
27282
+ carrierId: carrierId
27283
+ }), jsx(LinkAction, {
27284
+ icon: "add",
27285
+ isDisabled: isAddFundsFormOpen || isAddingFunds || isCreatingLabel,
27286
+ onClick: () => setIsAddFundsFormOpen(true),
27287
+ title: t("manage-funding:actions.addFunds")
27288
+ })]
27289
+ }), jsx(Spacer, {
27290
+ multiplier: 2
27291
+ }), balance < purchaseAmount && jsxs(Fragment, {
27292
+ children: [jsx(InlineNotification, Object.assign({
27293
+ title: t(`manage-funding:fundAndPurchase.${balance < 0 ? "negativeBalanceTitle" : "insufficientFundsTitle"}`),
27294
+ type: NotificationType.ALERT
27295
+ }, {
27296
+ children: t(`manage-funding:fundAndPurchase.${balance < 0 ? "negativeBalance" : "insufficientFunds"}`)
27297
+ })), jsx(Spacer, {
27298
+ multiplier: 2
27299
+ })]
27300
+ }), isAddFundsFormOpen ? jsx(AddFundsForm, Object.assign({
27301
+ carrierId: carrierId,
27302
+ minimumAmount: purchaseAmount - balance,
27303
+ onSuccess: handleAddFundsSuccess
27163
27304
  }, {
27164
- children: jsx("g", {
27165
- children: jsx("g", {
27166
- children: jsx("path", {
27167
- d: "M483.674,101.836C483.61,101.604 483.506,101.396 483.418,101.18C483.242,100.724 483.05,100.284 482.794,99.868C482.65,99.636 482.498,99.428 482.33,99.212C482.058,98.844 481.754,98.508 481.41,98.196C481.21,98.004 481.01,97.828 480.786,97.66C480.658,97.564 480.562,97.444 480.434,97.356C480.138,97.156 479.81,97.044 479.498,96.884C479.338,96.804 479.218,96.684 479.05,96.612L247.05,0.612C245.082,-0.204 242.89,-0.204 240.922,0.612L8.922,96.612C8.754,96.684 8.626,96.804 8.466,96.884C8.154,97.036 7.834,97.156 7.546,97.348C7.418,97.436 7.322,97.556 7.194,97.652C6.97,97.82 6.778,98.004 6.578,98.188C6.242,98.5 5.938,98.836 5.658,99.204C5.49,99.42 5.338,99.628 5.194,99.86C4.938,100.276 4.746,100.716 4.57,101.172C4.482,101.396 4.378,101.596 4.314,101.828C4.13,102.532 4.002,103.26 4.002,104.004L4.002,384.004C4.002,387.244 5.954,390.164 8.938,391.396L240.938,487.396C241.042,487.436 241.154,487.42 241.258,487.46C242.146,487.788 243.058,488.004 244.002,488.004C244.946,488.004 245.858,487.788 246.746,487.46C246.85,487.42 246.962,487.436 247.066,487.396L479.066,391.396C482.05,390.164 484.002,387.244 484.002,384.004L484.002,104.004C484.002,103.26 483.874,102.532 483.674,101.836ZM236.002,468.028L20.002,378.66L20.002,115.972L236.002,205.348L236.002,468.028ZM244.002,191.348L32.922,104.004L244.002,16.66L455.082,104.004L244.002,191.348ZM468.002,378.66L252.002,468.036L252.002,205.348L468.002,115.972L468.002,378.66Z",
27168
- fill: theme.palette.primary.main
27169
- })
27170
- })
27171
- })
27172
- }))
27305
+ children: addFundsForm => {
27306
+ var _a, _b;
27307
+ return jsxs(Fragment, {
27308
+ children: [jsxs("section", Object.assign({
27309
+ css: getStyles(addFundsForm.isCustomAmount).formExtension
27310
+ }, {
27311
+ children: [jsx(InlineLabel, Object.assign({
27312
+ label: t("manage-funding:fundAndPurchase.newBalance")
27313
+ }, {
27314
+ children: jsx(Typography, Object.assign({
27315
+ css: getStyles().balanceText
27316
+ }, {
27317
+ children: formatMoney({
27318
+ amount: balance + ((_a = addFundsForm.selectedAmount) !== null && _a !== void 0 ? _a : 0),
27319
+ currency: SE.Currency.USD
27320
+ })
27321
+ }))
27322
+ })), jsx(InlineLabel, Object.assign({
27323
+ label: t("manage-funding:fundAndPurchase.finalBalance")
27324
+ }, {
27325
+ children: jsx(Typography, Object.assign({
27326
+ css: getStyles().balanceText
27327
+ }, {
27328
+ children: formatMoney({
27329
+ amount: balance + ((_b = addFundsForm.selectedAmount) !== null && _b !== void 0 ? _b : 0) - purchaseAmount,
27330
+ currency: SE.Currency.USD
27331
+ })
27332
+ }))
27333
+ })), balance >= purchaseAmount && jsx(ButtonGroup, Object.assign({
27334
+ justify: "end"
27335
+ }, {
27336
+ children: jsx(Button, Object.assign({
27337
+ onClick: () => setIsAddFundsFormOpen(false),
27338
+ variant: ButtonVariant.TEXT
27339
+ }, {
27340
+ children: t("actions.cancel")
27341
+ }))
27342
+ }))]
27343
+ })), jsx(Spacer, {
27344
+ multiplier: 2
27345
+ }), renderActionButtons(addFundsForm)]
27346
+ });
27347
+ }
27348
+ })) : renderActionButtons()]
27173
27349
  }));
27174
27350
  };
27175
27351
 
27352
+ const styles$1 = createStyles({
27353
+ fundAndPurchase: theme => ({
27354
+ borderTop: `1px solid ${theme.palette.gray.ultraLight}`
27355
+ }),
27356
+ ratesInterstitial: {
27357
+ alignItems: "center",
27358
+ display: "flex",
27359
+ flexDirection: "column",
27360
+ justifyContent: "center",
27361
+ textAlign: "center"
27362
+ },
27363
+ showMoreOrLessRatesButton: {
27364
+ alignItems: "center",
27365
+ display: "flex"
27366
+ }
27367
+ });
27368
+
27176
27369
  const rateSchema = z.object({
27177
27370
  rate: z.object({
27178
27371
  isAcknowledged: z.boolean().refine(v => v === true, "purchase-label:schemaErrors.needToAcknowledge"),
@@ -27201,7 +27394,7 @@ const RateForm = ({
27201
27394
  }, features !== null && features !== void 0 ? features : {});
27202
27395
  const {
27203
27396
  t
27204
- } = useTranslation(["common", "purchase-label"]);
27397
+ } = useTranslation();
27205
27398
  const rateFormScrollToRef = useRef(null);
27206
27399
  const [showHiddenRates, setShowHiddenRates] = useState(false);
27207
27400
  const form = useForm({
@@ -27214,16 +27407,13 @@ const RateForm = ({
27214
27407
  mode: "onChange",
27215
27408
  resolver: validationResolver(rateSchema)
27216
27409
  });
27217
- const {
27218
- isDirty
27219
- } = form.formState;
27220
27410
  const {
27221
27411
  rateId: selectedRateId
27222
27412
  } = form.watch("rate");
27223
- const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
27413
+ const handleSubmit = formLogger.capture(form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
27224
27414
  const rateId = values;
27225
27415
  yield onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(rateId);
27226
- }));
27416
+ })));
27227
27417
  const rateOptions = useRateOptions(rates, carriers, shipment, features.enableGlobalPostFiltering
27228
27418
  // TODO: LMNT-677: fix RecommendedRate logic
27229
27419
  // {
@@ -27245,13 +27435,10 @@ const RateForm = ({
27245
27435
  );
27246
27436
 
27247
27437
  const selectedRate = useMemo(() => rateOptions === null || rateOptions === void 0 ? void 0 : rateOptions.find(r => r.rateId === selectedRateId), [rateOptions, selectedRateId]);
27248
- const [isRateSaving, setIsRateSaving] = useState(false);
27249
27438
  const handleSaveRate = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
27250
27439
  const isValid = yield form.trigger();
27251
27440
  if (!isValid) return;
27252
- setIsRateSaving(true);
27253
27441
  if (selectedRate) yield onSave === null || onSave === void 0 ? void 0 : onSave(selectedRate);
27254
- setIsRateSaving(false);
27255
27442
  // sets the form to not be dirty, so that Save is disabled
27256
27443
  form.reset(form.getValues());
27257
27444
  }), [form, onSave, selectedRate]);
@@ -27280,15 +27467,6 @@ const RateForm = ({
27280
27467
  }, 0);
27281
27468
  }
27282
27469
  }, [form, rateOptions, errors === null || errors === void 0 ? void 0 : errors.length]);
27283
- const formatFundingAmount = selectedRate => {
27284
- var _a;
27285
- const totalRateAmount = getTotalRateAmount(selectedRate);
27286
- const walletBalance = (_a = selectedRate.balance) !== null && _a !== void 0 ? _a : 0;
27287
- return formatMoney({
27288
- amount: Math.max(totalRateAmount - walletBalance, 0),
27289
- currency: SE.Currency.USD
27290
- });
27291
- };
27292
27470
  return jsxs("form", Object.assign({
27293
27471
  id: "rate-form",
27294
27472
  onSubmit: handleSubmit,
@@ -27310,10 +27488,7 @@ const RateForm = ({
27310
27488
  onClick: onSelectRate,
27311
27489
  options: showHiddenRates ? rateOptions : filteredRateOptions
27312
27490
  }), rateOptions.some(option => option.requiresAcknowledgement) && rateOptions.length > 5 && jsx(Link, Object.assign({
27313
- css: {
27314
- alignItems: "center",
27315
- display: "flex"
27316
- },
27491
+ css: styles$1.showMoreOrLessRatesButton,
27317
27492
  onClick: () => {
27318
27493
  var _a;
27319
27494
  setShowHiddenRates(!showHiddenRates);
@@ -27334,13 +27509,7 @@ const RateForm = ({
27334
27509
  }))
27335
27510
  }))]
27336
27511
  }) : !isLoading && errors && !!errors.length ? null : jsxs("article", Object.assign({
27337
- css: {
27338
- alignItems: "center",
27339
- display: "flex",
27340
- flexDirection: "column",
27341
- justifyContent: "center",
27342
- textAlign: "center"
27343
- },
27512
+ css: styles$1.ratesInterstitial,
27344
27513
  role: "presentation"
27345
27514
  }, {
27346
27515
  children: [jsx(Cube, {
@@ -27358,63 +27527,19 @@ const RateForm = ({
27358
27527
  }))]
27359
27528
  }))]
27360
27529
  })]
27361
- })), jsxs(BottomSheet, Object.assign({
27362
- alwaysVisible: true,
27363
- css: theme => ({
27364
- borderTop: `1px solid ${theme.palette.gray.ultraLight}`,
27365
- boxShadow: "none",
27366
- position: "static"
27367
- })
27368
- }, {
27369
- children: [typeof (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.balance) === "number" && selectedRate.requiresFundedAmount && jsxs(Fragment, {
27370
- children: [jsx(Typography, Object.assign({
27371
- variant: "body1"
27372
- }, {
27373
- children: t("purchase-label:balance.currentBalance")
27374
- })), jsx(Typography, Object.assign({
27375
- color: selectedRate.balance < 0 ? "error.main" : undefined
27376
- }, {
27377
- children: ` ${formatMoney({
27378
- amount: selectedRate.balance,
27379
- currency: SE.Currency.USD
27380
- })}`
27381
- })), jsx(Spacer, {
27382
- multiplier: 2
27383
- })]
27384
- }), jsx("div", Object.assign({
27385
- "data-testid": "actions"
27386
- }, {
27387
- children: jsxs(ButtonGroup, Object.assign({
27388
- "data-testid": "actions"
27389
- }, {
27390
- children: [(features === null || features === void 0 ? void 0 : features.saveRate) && jsx(Button, Object.assign({
27391
- bold: false,
27392
- css: {
27393
- whiteSpace: "nowrap"
27394
- },
27395
- disabled: !isDirty || disabled,
27396
- isLoading: isRateSaving,
27397
- onClick: handleSaveRate,
27398
- variant: ButtonVariant.OUTLINED
27399
- }, {
27400
- children: t("purchase-label:actions.saveRate")
27401
- })), jsx(SubmitButton, Object.assign({
27402
- alwaysRequireValidity: true,
27403
- control: form.control,
27404
- "data-testid": "purchaseLabel",
27405
- disabled: !selectedRate || disabled,
27406
- form: "rate-form",
27407
- isFullWidth: true
27408
- }, {
27409
- children: (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.balance) ? `${t("purchase-label:actions.purchaseNow")} - ${formatFundingAmount(selectedRate)}` : t("purchase-label:actions.purchaseNow")
27410
- }))]
27411
- }))
27412
- }))]
27413
- }))]
27530
+ })), jsx(FundAndPurchase, {
27531
+ carrierId: selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.carrierId,
27532
+ css: styles$1.fundAndPurchase,
27533
+ disabled: disabled,
27534
+ isFundingRequired: (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.balance) !== undefined && !!selectedRate.requiresFundedAmount,
27535
+ onPurchase: handleSubmit,
27536
+ onSave: handleSaveRate,
27537
+ purchaseAmount: getTotalRateAmount(selectedRate)
27538
+ })]
27414
27539
  }));
27415
27540
  };
27416
27541
 
27417
- const SalesOrder$1 = ({
27542
+ const SuspendSalesOrder = ({
27418
27543
  children,
27419
27544
  errors,
27420
27545
  isLoading,
@@ -27459,17 +27584,20 @@ const getTableWrapperStyles = theme => /*#__PURE__*/css$1({
27459
27584
  }
27460
27585
  }, process.env.NODE_ENV === "production" ? "" : ";label:getTableWrapperStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIml0ZW1zLWJyZWFrZG93bi5zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS2dEIiwiZmlsZSI6Iml0ZW1zLWJyZWFrZG93bi5zdHlsZXMudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBjc3MgfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3RcIjtcclxuZXhwb3J0IGNvbnN0IGdldE51bWVyaWNDZWxsU3R5bGUgPSAodGhlbWUpID0+IGNzcyh7XHJcbiAgICB0ZXh0QWxpZ246IFwicmlnaHRcIixcclxuICAgIHdpZHRoOiBcIjEwMHB4XCIsXHJcbn0pO1xyXG5leHBvcnQgY29uc3QgZ2V0VGFibGVXcmFwcGVyU3R5bGVzID0gKHRoZW1lKSA9PiBjc3Moe1xyXG4gICAgXCImJiA+IGRpdlwiOiB7XHJcbiAgICAgICAgYm94U2hhZG93OiBcIm5vbmVcIixcclxuICAgIH0sXHJcbiAgICBcIiYmID4gZGl2IHRhYmxlIHRoZWFkIHRoXCI6IHtcclxuICAgICAgICBmb250U3R5bGU6IFwiaXRhbGljXCIsXHJcbiAgICAgICAgZm9udFdlaWdodDogdGhlbWUudHlwb2dyYXBoeS5mb250V2VpZ2h0Lm5vcm1hbCxcclxuICAgIH0sXHJcbn0pO1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1pdGVtcy1icmVha2Rvd24uc3R5bGVzLmpzLm1hcCJdfQ== */");
27461
27586
 
27462
- const ItemsBreakdownTableHeader = () => jsx(TableHeader, {
27587
+ const ItemsBreakdownTableHeader = ({
27588
+ hasValue,
27589
+ hasTotal
27590
+ }) => jsx(TableHeader, {
27463
27591
  children: jsxs(TableBaseRow, {
27464
27592
  children: [jsx(TableHeaderCell, {}), jsx(TableHeaderCell, Object.assign({
27465
27593
  css: getNumericCellStyle
27466
27594
  }, {
27467
27595
  children: "Qty"
27468
- })), jsx(TableHeaderCell, Object.assign({
27596
+ })), hasValue && jsx(TableHeaderCell, Object.assign({
27469
27597
  css: getNumericCellStyle
27470
27598
  }, {
27471
27599
  children: "$/ea"
27472
- })), jsx(TableHeaderCell, Object.assign({
27600
+ })), hasTotal && jsx(TableHeaderCell, Object.assign({
27473
27601
  css: getNumericCellStyle
27474
27602
  }, {
27475
27603
  children: "$ Total"
@@ -27479,11 +27607,16 @@ const ItemsBreakdownTableHeader = () => jsx(TableHeader, {
27479
27607
  const ItemsBreakdown = ({
27480
27608
  items
27481
27609
  }) => {
27610
+ const hasValue = items.some(item => item.value !== undefined);
27611
+ const hasTotal = items.some(item => item.totalValue !== undefined);
27482
27612
  return jsx("div", Object.assign({
27483
27613
  css: getTableWrapperStyles
27484
27614
  }, {
27485
27615
  children: jsx(Table, Object.assign({
27486
- header: jsx(ItemsBreakdownTableHeader, {})
27616
+ header: jsx(ItemsBreakdownTableHeader, {
27617
+ hasTotal: hasTotal,
27618
+ hasValue: hasValue
27619
+ })
27487
27620
  }, {
27488
27621
  children: jsx(TableBody, {
27489
27622
  children: items.map(({
@@ -27503,11 +27636,11 @@ const ItemsBreakdown = ({
27503
27636
  css: getNumericCellStyle
27504
27637
  }, {
27505
27638
  children: quantity
27506
- })), jsx(TableBodyCell, Object.assign({
27639
+ })), hasValue && jsx(TableBodyCell, Object.assign({
27507
27640
  css: getNumericCellStyle
27508
27641
  }, {
27509
- children: formatMoney(value)
27510
- })), jsx(TableBodyCell, Object.assign({
27642
+ children: value && formatMoney(value)
27643
+ })), hasTotal && jsx(TableBodyCell, Object.assign({
27511
27644
  css: getNumericCellStyle
27512
27645
  }, {
27513
27646
  children: totalValue && formatMoney(totalValue)
@@ -27920,7 +28053,7 @@ const ShipmentForm = ({
27920
28053
  warehouseId,
27921
28054
  warehouses
27922
28055
  }) => {
27923
- var _a, _b, _c, _d;
28056
+ var _a, _b, _c, _d, _e;
27924
28057
  features = Object.assign({
27925
28058
  browseRates: true,
27926
28059
  includeShipsuranceInsurance: true,
@@ -28093,8 +28226,8 @@ const ShipmentForm = ({
28093
28226
  }
28094
28227
  }, [form]);
28095
28228
  const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
28096
- const _e = values,
28097
- payload = __rest(_e, ["__mode"]);
28229
+ const _f = values,
28230
+ payload = __rest(_f, ["__mode"]);
28098
28231
  const updatedShipment = yield onSubmit(Object.assign(Object.assign({}, shipment || {}), payload));
28099
28232
  // Defer shipment hydration to the task queue so that the submission promise resolves first, otherwise the
28100
28233
  // submission count will increment after hydration resets the form, keeping it in revalidate mode
@@ -28208,6 +28341,10 @@ const ShipmentForm = ({
28208
28341
  } = form.getValues();
28209
28342
  form.setValue("__mode", (features === null || features === void 0 ? void 0 : features.selectService) ? __mode : "browse_rates");
28210
28343
  }, [form, features === null || features === void 0 ? void 0 : features.selectService]);
28344
+ const salesOrderItems = useMemo(() => getSalesOrderItemsFromSalesOrderOrShipment({
28345
+ salesOrder,
28346
+ shipment
28347
+ }), [salesOrder, shipment]);
28211
28348
  if (isLoading) return jsx(Loader, {
28212
28349
  message: t("loading.shipment")
28213
28350
  });
@@ -28270,7 +28407,7 @@ const ShipmentForm = ({
28270
28407
  }), jsx(Spacer, {
28271
28408
  displayOn: isEditShipFormToOpen ? "tablet" : undefined,
28272
28409
  multiplier: 2
28273
- }), editShipToForm, jsxs(FieldLabel, Object.assign({
28410
+ }), editShipToForm, (salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.orderDate) && jsxs(FieldLabel, Object.assign({
28274
28411
  label: t("purchase-label:fields.orderDate")
28275
28412
  }, {
28276
28413
  children: [jsx(Typography, Object.assign({
@@ -28278,7 +28415,7 @@ const ShipmentForm = ({
28278
28415
  }, {
28279
28416
  children: formatDate(salesOrder.orderDate)
28280
28417
  })), jsx(Spacer, {})]
28281
- })), jsxs(FieldLabel, Object.assign({
28418
+ })), ((_b = salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.paymentDetails) === null || _b === void 0 ? void 0 : _b.grandTotal) && jsxs(FieldLabel, Object.assign({
28282
28419
  label: t("purchase-label:fields.orderValue")
28283
28420
  }, {
28284
28421
  children: [jsx(Typography, Object.assign({
@@ -28294,7 +28431,7 @@ const ShipmentForm = ({
28294
28431
  }, {
28295
28432
  children: requestedServices.length > 1 ? t("purchase-label:multipleShippingServices") : requestedServices[0].toString()
28296
28433
  })), jsx(Spacer, {})]
28297
- })), salesOrder.paymentDetails.estimatedShipping.amount > 0 && jsxs(FieldLabel, Object.assign({
28434
+ })), salesOrder && salesOrder.paymentDetails.estimatedShipping.amount > 0 && jsxs(FieldLabel, Object.assign({
28298
28435
  label: t("purchase-label:fields.estimatedShipping")
28299
28436
  }, {
28300
28437
  children: [jsx(Typography, Object.assign({
@@ -28302,7 +28439,7 @@ const ShipmentForm = ({
28302
28439
  }, {
28303
28440
  children: formatMoney(salesOrder.paymentDetails.estimatedShipping)
28304
28441
  })), jsx(Spacer, {})]
28305
- })), salesOrder && salesOrder.salesOrderItems.length > 0 && jsx(FieldLabel, Object.assign({
28442
+ })), salesOrderItems.length > 0 && jsx(FieldLabel, Object.assign({
28306
28443
  label: t("purchase-label:fields.items")
28307
28444
  }, {
28308
28445
  children: jsxs("div", Object.assign({
@@ -28314,7 +28451,7 @@ const ShipmentForm = ({
28314
28451
  children: [jsx(Typography, Object.assign({
28315
28452
  variant: "body2"
28316
28453
  }, {
28317
- children: salesOrder.salesOrderItems.reduce((total, i) => i.quantity + total, 0).toString()
28454
+ children: salesOrderItems.length.toString()
28318
28455
  })), jsxs(Link, Object.assign({
28319
28456
  css: theme => ({
28320
28457
  alignItems: "center",
@@ -28333,15 +28470,7 @@ const ShipmentForm = ({
28333
28470
  }))]
28334
28471
  }))
28335
28472
  })), showItems && jsx(ItemsBreakdown, {
28336
- items: salesOrder.salesOrderItems.map(item => ({
28337
- detail: `SKU ${item.lineItemDetails.sku}`,
28338
- name: item.lineItemDetails.name,
28339
- quantity: item.quantity,
28340
- subDetail: item.requestedShippingOptions.shippingService,
28341
- subDetailValue: item.priceSummary.estimatedShipping,
28342
- totalValue: item.priceSummary.total,
28343
- value: item.priceSummary.unitPrice
28344
- }))
28473
+ items: salesOrderItems
28345
28474
  })]
28346
28475
  })), jsx("div", {
28347
28476
  ref: customsItemErrorScrollToRef
@@ -28365,7 +28494,7 @@ const ShipmentForm = ({
28365
28494
  }), jsx(CustomsItemsDisplay, {
28366
28495
  onUpdate: handleUpdateCustomsItems,
28367
28496
  shipment: shipment
28368
- }), ((_b = customsErrors === null || customsErrors === void 0 ? void 0 : customsErrors.customsItems) === null || _b === void 0 ? void 0 : _b.type) === "too_small" && jsxs(Fragment, {
28497
+ }), ((_c = customsErrors === null || customsErrors === void 0 ? void 0 : customsErrors.customsItems) === null || _c === void 0 ? void 0 : _c.type) === "too_small" && jsxs(Fragment, {
28369
28498
  children: [jsx(Spacer, {}), jsx(InlineNotification, {
28370
28499
  title: t("purchase-label:errorMessages.customsItemsRequired"),
28371
28500
  type: NotificationType.ERROR
@@ -28525,7 +28654,7 @@ const ShipmentForm = ({
28525
28654
  label: "purchase-label:fields.addOns"
28526
28655
  }, {
28527
28656
  children: [jsx(Switch, Object.assign({
28528
- defaultChecked: ((_c = shipment === null || shipment === void 0 ? void 0 : shipment.confirmation) !== null && _c !== void 0 ? _c : "none") !== "none",
28657
+ defaultChecked: ((_d = shipment === null || shipment === void 0 ? void 0 : shipment.confirmation) !== null && _d !== void 0 ? _d : "none") !== "none",
28529
28658
  label: t("purchase-label:fields.confirmation"),
28530
28659
  name: "confirmationEnabled",
28531
28660
  shouldUnmount: true,
@@ -28541,7 +28670,7 @@ const ShipmentForm = ({
28541
28670
  shouldUnregister: true
28542
28671
  })
28543
28672
  })), jsxs(Switch, Object.assign({
28544
- defaultChecked: ((_d = shipment === null || shipment === void 0 ? void 0 : shipment.insuranceProvider) !== null && _d !== void 0 ? _d : "none") !== "none",
28673
+ defaultChecked: ((_e = shipment === null || shipment === void 0 ? void 0 : shipment.insuranceProvider) !== null && _e !== void 0 ? _e : "none") !== "none",
28545
28674
  label: t("purchase-label:fields.insurance"),
28546
28675
  name: "insuranceEnabled",
28547
28676
  onChange: () => setInsuranceEnabled(true),
@@ -28830,6 +28959,30 @@ const Shipment$1 = ({
28830
28959
  });
28831
28960
  };
28832
28961
 
28962
+ const SuspendShipment = ({
28963
+ children,
28964
+ errors,
28965
+ isLoading,
28966
+ shipment
28967
+ }) => {
28968
+ const {
28969
+ t
28970
+ } = useTranslation(["common", "purchase-label"]);
28971
+ if (isLoading) return jsx(Loader, {
28972
+ message: t("loading.shipment")
28973
+ });
28974
+ if (errors) throw new Error(errors.map(e => e.message).join(", "));
28975
+ if (!shipment) throw new Error("errorMessages.unableToLoad.shipment");
28976
+ return jsx("div", Object.assign({
28977
+ css: {
28978
+ height: "100%",
28979
+ width: "100%"
28980
+ }
28981
+ }, {
28982
+ children: children
28983
+ }));
28984
+ };
28985
+
28833
28986
  const VoidLabel$1 = ({
28834
28987
  onComplete,
28835
28988
  onSubmit,
@@ -28960,26 +29113,155 @@ var index$1 = /*#__PURE__*/Object.freeze({
28960
29113
  CarrierTermsForm: CarrierTermsForm,
28961
29114
  CustomsItemForm: CustomsItemForm,
28962
29115
  getCustomsItemFormSchema: getCustomsItemFormSchema,
28963
- FundingMethods: FundingMethods,
28964
29116
  Label: Label,
28965
29117
  LandingPage: LandingPage,
28966
29118
  ListCarriers: ListCarriers$1,
28967
29119
  ManageWarehouses: ManageWarehouses$1,
28968
29120
  Onboarding: Onboarding$1,
28969
29121
  RateForm: RateForm,
28970
- SalesOrder: SalesOrder$1,
29122
+ SuspendSalesOrder: SuspendSalesOrder,
28971
29123
  ShipmentForm: ShipmentForm,
28972
29124
  schedulePickupForCarrier: schedulePickupForCarrier,
28973
29125
  Shipment: Shipment$1,
29126
+ SuspendShipment: SuspendShipment,
28974
29127
  WarehouseForm: WarehouseForm,
28975
29128
  VoidLabel: VoidLabel$1,
28976
29129
  WalletForm: WalletForm,
28977
- styles: styles$1,
29130
+ styles: styles$3,
28978
29131
  billingAddressSchema: billingAddressSchema,
28979
29132
  walletSchema: walletSchema,
28980
29133
  BillingFields: BillingFields
28981
29134
  });
28982
29135
 
29136
+ const styles = createStyles({
29137
+ form: theme => ({
29138
+ backgroundColor: theme.palette.gray.megaLight,
29139
+ display: "flex",
29140
+ flexDirection: "column",
29141
+ gap: theme.spacing(2),
29142
+ padding: theme.spacing(2)
29143
+ })
29144
+ });
29145
+
29146
+ const autoFundingSchema = z.object({
29147
+ isEnabled: z.boolean(),
29148
+ lowBalancePurchaseThreshold: moneySchema.extend({
29149
+ amount: z.number().min(25)
29150
+ }),
29151
+ maximumPurchasesPerDay: z.number().min(1),
29152
+ purchaseAmount: moneySchema.extend({
29153
+ amount: z.number().min(10).max(10000)
29154
+ })
29155
+ });
29156
+
29157
+ /**
29158
+ * This form that allows users to enable or disable auto funding, and
29159
+ * configure auto funding settings in ShipEngine API.
29160
+ */
29161
+ const AutoFundingForm = ({
29162
+ carrierId
29163
+ }) => {
29164
+ const {
29165
+ t
29166
+ } = useTranslation();
29167
+ const updateAutoFunding = useUpdateAutoFunding(carrierId);
29168
+ const autoFundingConfiguration = useGetAutoFundingConfiguration();
29169
+ const form = useForm({
29170
+ // TODO - [LMNT-663] We should probably make a hydration effect for autoFundingConfiguration.data
29171
+ defaultValues: autoFundingConfiguration.data,
29172
+ resolver: validationResolver(autoFundingSchema)
29173
+ });
29174
+ const {
29175
+ isDirty
29176
+ } = form.formState;
29177
+ const watchIsEnabled = form.watch("isEnabled");
29178
+ const handleSubmit = formLogger.capture(form.handleSubmit(values => {
29179
+ const payload = values;
29180
+ updateAutoFunding.mutate(payload, {
29181
+ onSuccess: () => autoFundingConfiguration.refetch()
29182
+ });
29183
+ }));
29184
+ const handleToggle = isEnabled => {
29185
+ form.reset(values => Object.assign(Object.assign({}, values), {
29186
+ isEnabled
29187
+ }));
29188
+ if (autoFundingConfiguration.data) {
29189
+ updateAutoFunding.mutate(Object.assign(Object.assign({}, autoFundingConfiguration.data), {
29190
+ isEnabled
29191
+ }), {
29192
+ onSuccess: x => autoFundingConfiguration.refetch()
29193
+ });
29194
+ } else {
29195
+ // TODO - [LMNT-663] Should this throw?
29196
+ logger.error("Toggling auto-funding failed because autoFundingData is undefined.");
29197
+ }
29198
+ };
29199
+ if (autoFundingConfiguration.isLoading) return jsx(Loader, {
29200
+ message: t("manage-funding:autoFunding.isLoading")
29201
+ });
29202
+ return jsxs(Fragment, {
29203
+ children: [jsx(Switch, {
29204
+ defaultChecked: false,
29205
+ // defaultChecked={autoFundingConfiguration.data?.isEnabled}
29206
+ label: t("manage-funding:autoFunding.addFundsAutomatically"),
29207
+ name: "isEnabled",
29208
+ onChange: e => handleToggle(e.target.checked),
29209
+ value: true
29210
+ }), watchIsEnabled && jsxs("form", Object.assign({
29211
+ css: styles.form,
29212
+ id: "auto-funding-form",
29213
+ onSubmit: handleSubmit
29214
+ }, {
29215
+ children: [jsx(MoneyInput, {
29216
+ control: form.control,
29217
+ disabled: !watchIsEnabled,
29218
+ label: t("manage-funding:autoFunding.purchaseAmount"),
29219
+ name: "purchaseAmount",
29220
+ showCurrencySymbol: true
29221
+ }), jsx(MoneyInput, {
29222
+ control: form.control,
29223
+ disabled: !watchIsEnabled,
29224
+ label: t("manage-funding:autoFunding.lowBalancePurchaseThreshold"),
29225
+ name: "lowBalancePurchaseThreshold",
29226
+ showCurrencySymbol: true
29227
+ }), jsx(NumberInput, {
29228
+ control: form.control,
29229
+ disabled: !watchIsEnabled,
29230
+ isInteger: true,
29231
+ label: t("manage-funding:autoFunding.maximumPurchasesPerDay"),
29232
+ name: "maximumPurchasesPerDay"
29233
+ }), jsxs(ButtonGroup, Object.assign({
29234
+ justify: "end"
29235
+ }, {
29236
+ children: [jsx(Button, Object.assign({
29237
+ disabled: !isDirty,
29238
+ onClick: () => form.reset(),
29239
+ variant: ButtonVariant.TEXT
29240
+ }, {
29241
+ children: t("actions.cancel")
29242
+ })), jsx(SubmitButton, Object.assign({
29243
+ control: form.control,
29244
+ "data-testid": "submit-auto-funding",
29245
+ disabled: !watchIsEnabled,
29246
+ requireDirty: true,
29247
+ variant: ButtonVariant.OUTLINED
29248
+ }, {
29249
+ children: t("manage-funding:actions.saveRule")
29250
+ }))]
29251
+ }))]
29252
+ })), autoFundingConfiguration.error && jsxs(Fragment, {
29253
+ children: [jsx(Spacer, {
29254
+ multiplier: 1
29255
+ }), jsx(InlineNotification, Object.assign({
29256
+ title: t("manage-funding:autoFunding.error.title"),
29257
+ type: NotificationType.ERROR
29258
+ }, {
29259
+ children: autoFundingConfiguration.error[0].message
29260
+ }))]
29261
+ })]
29262
+ });
29263
+ };
29264
+
28983
29265
  /**
28984
29266
  * Captures errors thrown within an Element, logs them and displays a fallback component
28985
29267
  *
@@ -29043,49 +29325,82 @@ class ErrorBoundary extends React.Component {
29043
29325
  }
29044
29326
  }
29045
29327
 
29328
+ const ManageFunding = ({
29329
+ carrierId
29330
+ }) => {
29331
+ const {
29332
+ t
29333
+ } = useTranslation();
29334
+ const {
29335
+ isLoading: isLoadingCarrier
29336
+ } = useGetCarrierById(carrierId);
29337
+ const [isAddFundsFormOpen, setIsAddFundsFormOpen] = useState(false);
29338
+ if (isLoadingCarrier) return jsx(Loader, {
29339
+ message: t("loading.carrier")
29340
+ });
29341
+ return jsxs("section", {
29342
+ children: [jsxs(Spread, {
29343
+ children: [jsx(CarrierBalance, {
29344
+ carrierId: carrierId
29345
+ }), jsx(LinkAction, {
29346
+ icon: "add",
29347
+ isDisabled: isAddFundsFormOpen,
29348
+ onClick: () => setIsAddFundsFormOpen(true),
29349
+ title: t("manage-funding:actions.addFunds")
29350
+ })]
29351
+ }), isAddFundsFormOpen && jsxs(Fragment, {
29352
+ children: [jsx(Spacer, {
29353
+ multiplier: 2
29354
+ }), jsx(AddFundsForm, {
29355
+ carrierId: carrierId,
29356
+ onCancel: () => setIsAddFundsFormOpen(false)
29357
+ })]
29358
+ }), jsx(Spacer, {
29359
+ multiplier: 2
29360
+ })]
29361
+ });
29362
+ };
29363
+
29046
29364
  /**
29047
- * A drop-in replacement for the `<form>` tag that allows nested forms.
29365
+ * For relevant notes about Storybook stories
29048
29366
  *
29049
- * Via portals, the <form> tag is mounted as a sibling of the app root. The form's
29050
- * interface is then mounted back at the point of use.
29367
+ * Stopgap until we setup https://storybook.js.org/addons/@storybook/addon-docs
29051
29368
  */
29052
- const FormPortal = ({
29053
- css,
29369
+ const StoryNotes = ({
29054
29370
  children,
29055
- id,
29056
- onSubmit,
29057
- variant
29058
- }) => {
29059
- const rootTarget = useRootPortal();
29060
- const [interfaceTarget, setInterfaceTarget] = useState(null);
29061
- const onMountInterfaceTarget = useCallback(element => {
29062
- if (element) setInterfaceTarget(element);
29063
- }, []);
29064
- const formStyle = [variant === "well" && (theme => ({
29065
- backgroundColor: theme.palette.gray.megaLight,
29066
- padding: theme.spacing(2)
29067
- })), css];
29068
- return jsxs(Fragment, {
29069
- children: [jsx(Portal, Object.assign({
29070
- target: rootTarget
29371
+ notes
29372
+ }) => jsxs(Fragment, {
29373
+ children: [jsxs("div", Object.assign({
29374
+ css: () => ({
29375
+ backgroundColor: "lightsteelblue",
29376
+ marginBottom: "16px",
29377
+ padding: "16px",
29378
+ paddingLeft: "32px"
29379
+ })
29380
+ }, {
29381
+ children: [jsx(Typography, Object.assign({
29382
+ variant: "heading5"
29071
29383
  }, {
29072
- children: jsx("form", Object.assign({
29073
- id: id,
29074
- onSubmit: onSubmit
29075
- }, {
29076
- children: jsx(Portal, Object.assign({
29077
- target: interfaceTarget
29078
- }, {
29079
- children: children
29080
- }))
29081
- }))
29082
- })), jsx("section", {
29083
- css: formStyle,
29084
- id: id + "-interface",
29085
- ref: onMountInterfaceTarget
29086
- })]
29087
- });
29088
- };
29384
+ children: "Story notes:"
29385
+ })), jsx("ul", Object.assign({
29386
+ css: theme => ({
29387
+ "> li": {
29388
+ marginTop: theme.spacing(1)
29389
+ }
29390
+ })
29391
+ }, {
29392
+ children: notes.map(n => jsx("li", {
29393
+ children: n
29394
+ }, n))
29395
+ }))]
29396
+ })), jsx("hr", {
29397
+ css: () => ({
29398
+ backgroundColor: "transparent",
29399
+ borderTop: "1px dotted lightgrey",
29400
+ marginBottom: "16px"
29401
+ })
29402
+ }), children]
29403
+ });
29089
29404
 
29090
29405
  var $$2 = _export;
29091
29406
  var uncurryThis = functionUncurryThisClause;
@@ -30092,6 +30407,7 @@ var common = {
30092
30407
  invalidNameOrCompany: "Recipient name and company name (if provided) must have two characters in first and last name.",
30093
30408
  noWarehouses: "You must have an active warehouse in order to use this feature",
30094
30409
  unableToLoad: {
30410
+ carrier: "Unable to load carrier",
30095
30411
  carriers: "Unable to load carriers",
30096
30412
  salesOrder: "Unable to load order",
30097
30413
  shipment: "Unable to load shipment",
@@ -30118,6 +30434,7 @@ var common = {
30118
30434
  thirdParty: "Third Party"
30119
30435
  },
30120
30436
  loading: {
30437
+ carrier: "Loading carrier...",
30121
30438
  carriers: "Loading carriers...",
30122
30439
  data: "Loading...",
30123
30440
  importingSalesOrder: "Importing order...",
@@ -30214,11 +30531,11 @@ var listCarriers = {
30214
30531
  var manageFunding = {
30215
30532
  "manage-funding": {
30216
30533
  actions: {
30534
+ addFunds: "Add Funds",
30535
+ addFundsAndPurchase: "Add Funds & Purchase",
30217
30536
  addNow: "Add Now",
30218
- saveRule: "Save Rule",
30219
- other: "Other..."
30537
+ saveRule: "Save Rule"
30220
30538
  },
30221
- addFunds: "Add Funds",
30222
30539
  autoFunding: {
30223
30540
  addFundsAutomatically: "Add Funds Automatically",
30224
30541
  error: {
@@ -30231,20 +30548,31 @@ var manageFunding = {
30231
30548
  maximumPurchasesPerDay: "Maximum Purchases Per Day",
30232
30549
  purchaseAmount: "Purchase Amount"
30233
30550
  },
30234
- currentBalance: "Current Balance: ",
30235
- otp: {
30551
+ addFunds: {
30552
+ custom: "Custom...",
30236
30553
  error: {
30237
30554
  title: "Manual-Funding Error",
30238
30555
  message: "An error occurred while trying add funds to your ShipEngine wallet."
30239
30556
  },
30240
30557
  isLoading: "Adding funds to your ShipEngine wallet...",
30241
30558
  labels: {
30242
- amount: "Amount",
30243
- currentBalance: "Current Balance",
30244
- resultingBalance: "Resulting Balance"
30559
+ amount: "Amount"
30245
30560
  },
30246
30561
  minimumPurchaseAmount: "Minimum Purchase $10.00"
30247
30562
  },
30563
+ fundAndPurchase: {
30564
+ finalBalance: "Final balance after payment:",
30565
+ insufficientFunds: "Add funds below to purchase label.",
30566
+ insufficientFundsTitle: "Not enough money in your account",
30567
+ negativeBalance: "You will be charged this amount in addition to the label cost.",
30568
+ negativeBalanceTitle: "Negative balance (due to adjustments)",
30569
+ newBalance: "New balance after adding funds:"
30570
+ },
30571
+ errors: {
30572
+ balanceUnknown: "Unknown",
30573
+ unableToFindBalance: "There was a problem retrieving your balance. Please try again later."
30574
+ },
30575
+ currentBalance: "Current balance:",
30248
30576
  maximumBalanceAmount: "Balance may not exceed $10,000.00"
30249
30577
  }
30250
30578
  };
@@ -30762,7 +31090,75 @@ const ListCarriers = () => {
30762
31090
  });
30763
31091
  };
30764
31092
 
30765
- const Element$6 = registerElement("list-carriers", ListCarriers);
31093
+ const Element$5 = registerElement("list-carriers", ListCarriers);
31094
+
31095
+ const ManageWarehouses = () => {
31096
+ const {
31097
+ t
31098
+ } = useTranslation();
31099
+ const {
31100
+ data: warehouses,
31101
+ error: listWarehouseErrors,
31102
+ isLoading: isLoadingWarehouses,
31103
+ refetch: refreshListWarehouses
31104
+ } = useListWarehouses();
31105
+ const {
31106
+ error: updateWarehouseErrors,
31107
+ mutateAsync: updateWarehouse
31108
+ } = useUpdateWarehouse();
31109
+ const {
31110
+ error: createWarehouseErrors,
31111
+ mutateAsync: createWarehouse
31112
+ } = useCreateWarehouse();
31113
+ const {
31114
+ error: deleteWarehouseErrors,
31115
+ mutateAsync: deleteWarehouse
31116
+ } = useDeleteWarehouse();
31117
+ const handleDeleteWarehouse = warehouseId => __awaiter(void 0, void 0, void 0, function* () {
31118
+ yield deleteWarehouse({
31119
+ warehouseId
31120
+ });
31121
+ void refreshListWarehouses();
31122
+ });
31123
+ const handleSubmitAddNewWarehouse = payload => __awaiter(void 0, void 0, void 0, function* () {
31124
+ const result = yield createWarehouse(payload);
31125
+ if (result) void refreshListWarehouses();
31126
+ });
31127
+ const handleSubmitEditWarehouse = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
31128
+ yield updateWarehouse({
31129
+ name: payload.name,
31130
+ originAddress: payload.originAddress,
31131
+ returnAddress: payload.returnAddress,
31132
+ warehouseId: warehouseId
31133
+ });
31134
+ void refreshListWarehouses();
31135
+ });
31136
+ const handleSetDefault = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
31137
+ yield updateWarehouse(Object.assign(Object.assign({}, payload), {
31138
+ isDefault: true,
31139
+ warehouseId
31140
+ }));
31141
+ void refreshListWarehouses();
31142
+ });
31143
+ if (isLoadingWarehouses) return jsx(Loader, {
31144
+ message: t("loading.warehouses")
31145
+ });
31146
+ if (!warehouses) {
31147
+ if (listWarehouseErrors) throw new Error(listWarehouseErrors.map(e => e.message).join(", "));
31148
+ throw new Error("errorMessages.unableToLoad.warehouses");
31149
+ }
31150
+ const errors = [...(updateWarehouseErrors !== null && updateWarehouseErrors !== void 0 ? updateWarehouseErrors : []), ...(createWarehouseErrors !== null && createWarehouseErrors !== void 0 ? createWarehouseErrors : []), ...(deleteWarehouseErrors !== null && deleteWarehouseErrors !== void 0 ? deleteWarehouseErrors : [])];
31151
+ return jsx(ManageWarehouses$1, {
31152
+ errors: errors,
31153
+ onAdd: handleSubmitAddNewWarehouse,
31154
+ onDelete: handleDeleteWarehouse,
31155
+ onEdit: handleSubmitEditWarehouse,
31156
+ onSetDefault: handleSetDefault,
31157
+ warehouses: warehouses
31158
+ });
31159
+ };
31160
+
31161
+ const Element$4 = registerElement("manage-warehouses", ManageWarehouses);
30766
31162
 
30767
31163
  const useAddress = ({
30768
31164
  compatibleCountryCodes,
@@ -30888,7 +31284,7 @@ const useAddress = ({
30888
31284
  }), [handleValidateAddress, onChange, shipment, updateShipment]);
30889
31285
  useEffect(() => {
30890
31286
  if (!addressPreference && (shipment === null || shipment === void 0 ? void 0 : shipment.shipTo)) {
30891
- handleValidateAddress(shipment === null || shipment === void 0 ? void 0 : shipment.shipTo, salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.shipTo);
31287
+ void handleValidateAddress(shipment === null || shipment === void 0 ? void 0 : shipment.shipTo, salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.shipTo);
30892
31288
  }
30893
31289
  }, [addressPreference, handleValidateAddress, salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.shipTo, shipment === null || shipment === void 0 ? void 0 : shipment.shipTo]);
30894
31290
  const charsetWarning = useMemo(() => Object.keys((addressPreference === null || addressPreference === void 0 ? void 0 : addressPreference.selection) || {}).reduce((warning, key) => {
@@ -31368,135 +31764,6 @@ const ConfigureShipment = _a => {
31368
31764
  });
31369
31765
  };
31370
31766
 
31371
- const ManageFunding = ({
31372
- carrierId,
31373
- fundingMethod,
31374
- requiredAmount
31375
- }) => {
31376
- // const { data: carriersData, loading, error } = useListCarriers();
31377
- var _a, _b;
31378
- const {
31379
- data: addFundsData,
31380
- error: addFundsErrors,
31381
- mutateAsync: addFunds,
31382
- isLoading: isAddFundsLoading,
31383
- reset: addFundsRefresh
31384
- } = useAddFunds();
31385
- const {
31386
- data: autoFundingData,
31387
- error: autoFundingErrors,
31388
- isLoading: isAutoFundingLoading,
31389
- refetch: refreshAutoFundingConfiguration
31390
- } = useGetAutoFundingConfiguration();
31391
- const {
31392
- mutateAsync: configureAutoFunding
31393
- } = useUpdateAutoFunding();
31394
- const handleSubmitManualFunding = payload => __awaiter(void 0, void 0, void 0, function* () {
31395
- const result = yield addFunds({
31396
- amount: payload.funds,
31397
- carrierId
31398
- });
31399
- if (result) void addFundsRefresh();
31400
- });
31401
- const handleSubmitAutoFunding = payload => __awaiter(void 0, void 0, void 0, function* () {
31402
- const result = yield configureAutoFunding(Object.assign({
31403
- carrierId
31404
- }, payload));
31405
- if (result) void refreshAutoFundingConfiguration();
31406
- });
31407
- const handleToggleAutoFunding = isEnabled => __awaiter(void 0, void 0, void 0, function* () {
31408
- if (autoFundingData) {
31409
- const result = yield configureAutoFunding(Object.assign(Object.assign({}, autoFundingData), {
31410
- carrierId,
31411
- isEnabled
31412
- }));
31413
- if (result) void refreshAutoFundingConfiguration();
31414
- } else {
31415
- console.error("Toggling auto-funding failed because autoFundingData is undefined.");
31416
- }
31417
- });
31418
- return jsx(FundingMethods, {
31419
- autoFundingData: autoFundingData,
31420
- autoFundingErrorMessage: autoFundingErrors ? (_a = autoFundingErrors[0]) === null || _a === void 0 ? void 0 : _a.message : undefined,
31421
- fundingMethod: fundingMethod !== null && fundingMethod !== void 0 ? fundingMethod : "both",
31422
- hasAutoFundingError: !!(autoFundingErrors === null || autoFundingErrors === void 0 ? void 0 : autoFundingErrors.length),
31423
- hasManualFundingError: !!(addFundsErrors === null || addFundsErrors === void 0 ? void 0 : addFundsErrors.length),
31424
- isAutoFundingLoading: isAutoFundingLoading,
31425
- isManualFundingLoading: isAddFundsLoading,
31426
- manualFundingCurrentBalance: (_b = addFundsData === null || addFundsData === void 0 ? void 0 : addFundsData.balance.amount) !== null && _b !== void 0 ? _b : 0,
31427
- manualFundingRequiredAmount: requiredAmount,
31428
- onSubmitAutoFunding: handleSubmitAutoFunding,
31429
- onSubmitManualFunding: handleSubmitManualFunding,
31430
- onToggleAutoFunding: handleToggleAutoFunding
31431
- });
31432
- };
31433
-
31434
- const ManageWarehouses = () => {
31435
- const {
31436
- t
31437
- } = useTranslation();
31438
- const {
31439
- data: warehouses,
31440
- error: listWarehouseErrors,
31441
- isLoading: isLoadingWarehouses,
31442
- refetch: refreshListWarehouses
31443
- } = useListWarehouses();
31444
- const {
31445
- error: updateWarehouseErrors,
31446
- mutateAsync: updateWarehouse
31447
- } = useUpdateWarehouse();
31448
- const {
31449
- error: createWarehouseErrors,
31450
- mutateAsync: createWarehouse
31451
- } = useCreateWarehouse();
31452
- const {
31453
- error: deleteWarehouseErrors,
31454
- mutateAsync: deleteWarehouse
31455
- } = useDeleteWarehouse();
31456
- const handleDeleteWarehouse = warehouseId => __awaiter(void 0, void 0, void 0, function* () {
31457
- yield deleteWarehouse({
31458
- warehouseId
31459
- });
31460
- void refreshListWarehouses();
31461
- });
31462
- const handleSubmitAddNewWarehouse = payload => __awaiter(void 0, void 0, void 0, function* () {
31463
- const result = yield createWarehouse(payload);
31464
- if (result) void refreshListWarehouses();
31465
- });
31466
- const handleSubmitEditWarehouse = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
31467
- yield updateWarehouse({
31468
- name: payload.name,
31469
- originAddress: payload.originAddress,
31470
- returnAddress: payload.returnAddress,
31471
- warehouseId: warehouseId
31472
- });
31473
- void refreshListWarehouses();
31474
- });
31475
- const handleSetDefault = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
31476
- yield updateWarehouse(Object.assign(Object.assign({}, payload), {
31477
- isDefault: true,
31478
- warehouseId
31479
- }));
31480
- void refreshListWarehouses();
31481
- });
31482
- if (isLoadingWarehouses) return jsx(Loader, {
31483
- message: t("loading.warehouses")
31484
- });
31485
- if (!warehouses) {
31486
- if (listWarehouseErrors) throw new Error(listWarehouseErrors.map(e => e.message).join(", "));
31487
- throw new Error("errorMessages.unableToLoad.warehouses");
31488
- }
31489
- const errors = [...(updateWarehouseErrors !== null && updateWarehouseErrors !== void 0 ? updateWarehouseErrors : []), ...(createWarehouseErrors !== null && createWarehouseErrors !== void 0 ? createWarehouseErrors : []), ...(deleteWarehouseErrors !== null && deleteWarehouseErrors !== void 0 ? deleteWarehouseErrors : [])];
31490
- return jsx(ManageWarehouses$1, {
31491
- errors: errors,
31492
- onAdd: handleSubmitAddNewWarehouse,
31493
- onDelete: handleDeleteWarehouse,
31494
- onEdit: handleSubmitEditWarehouse,
31495
- onSetDefault: handleSetDefault,
31496
- warehouses: warehouses
31497
- });
31498
- };
31499
-
31500
31767
  const Onboarding = ({
31501
31768
  onCompleteOnboarding
31502
31769
  }) => {
@@ -31629,7 +31896,8 @@ const useConfigureShipment = ({
31629
31896
  onLoad,
31630
31897
  onShipmentUpdated,
31631
31898
  salesOrder,
31632
- warehouseId
31899
+ warehouseId,
31900
+ printLabelLayout
31633
31901
  }) => {
31634
31902
  var _a, _b;
31635
31903
  const {
@@ -31646,12 +31914,12 @@ const useConfigureShipment = ({
31646
31914
  yield reloadPendingShipment();
31647
31915
  yield onShipmentUpdated === null || onShipmentUpdated === void 0 ? void 0 : onShipmentUpdated(shipment);
31648
31916
  }), [onShipmentUpdated, reloadPendingShipment]);
31649
- const printLabelLayout = (_b = (_a = useGetAccountSettings().data) === null || _a === void 0 ? void 0 : _a.defaultLabelLayout) !== null && _b !== void 0 ? _b : "4x6";
31917
+ const labelLayoutSetting = (_b = (_a = useGetAccountSettings().data) === null || _a === void 0 ? void 0 : _a.defaultLabelLayout) !== null && _b !== void 0 ? _b : "4x6";
31650
31918
  return {
31651
31919
  errors: pendingShipmentErrors,
31652
31920
  isLoading: isPendingShipmentLoading,
31653
31921
  onShipmentUpdated: handleShipmentUpdated,
31654
- printLabelLayout,
31922
+ printLabelLayout: printLabelLayout ? printLabelLayout : labelLayoutSetting,
31655
31923
  shipment: pendingShipment,
31656
31924
  warehouseId
31657
31925
  };
@@ -31710,7 +31978,7 @@ const useImportSalesOrder = ({
31710
31978
  };
31711
31979
  };
31712
31980
 
31713
- const SalesOrder = _a => {
31981
+ const PurchaseLabelBySalesOrder = _a => {
31714
31982
  var {
31715
31983
  features,
31716
31984
  externalOrderId,
@@ -31740,7 +32008,7 @@ const SalesOrder = _a => {
31740
32008
  salesOrder,
31741
32009
  warehouseId
31742
32010
  });
31743
- return jsx(SalesOrder$1, Object.assign({
32011
+ return jsx(SuspendSalesOrder, Object.assign({
31744
32012
  salesOrder: salesOrder
31745
32013
  }, salesOrderProps, {
31746
32014
  children: salesOrder && jsx(ConfigureShipment, Object.assign({
@@ -31750,6 +32018,79 @@ const SalesOrder = _a => {
31750
32018
  }));
31751
32019
  };
31752
32020
 
32021
+ const useLoadShipment = ({
32022
+ shipmentId
32023
+ }) => {
32024
+ const {
32025
+ data: shipment,
32026
+ error: loadShipmentErrors,
32027
+ refetch: refetchShipment,
32028
+ isLoading
32029
+ } = useGetShipment(shipmentId);
32030
+ const errors = [...(loadShipmentErrors !== null && loadShipmentErrors !== void 0 ? loadShipmentErrors : [])];
32031
+ return {
32032
+ errors: errors.length > 0 ? errors : undefined,
32033
+ isLoading: isLoading,
32034
+ refetchShipment,
32035
+ shipment
32036
+ };
32037
+ };
32038
+
32039
+ const PurchaseLabelByShipment = _a => {
32040
+ var {
32041
+ shipmentId,
32042
+ onLoad,
32043
+ onShipmentUpdated,
32044
+ features
32045
+ } = _a,
32046
+ props = __rest(_a, ["shipmentId", "onLoad", "onShipmentUpdated", "features"]);
32047
+ const _b = useLoadShipment({
32048
+ shipmentId
32049
+ }),
32050
+ {
32051
+ shipment
32052
+ } = _b,
32053
+ shipmentProps = __rest(_b, ["shipment"]);
32054
+ return jsx(SuspendShipment, Object.assign({
32055
+ shipment: shipment
32056
+ }, shipmentProps, {
32057
+ children: shipment && jsx(ConfigureShipment, Object.assign({
32058
+ errors: shipmentProps.errors,
32059
+ features: features,
32060
+ isLoading: shipmentProps.isLoading,
32061
+ onAddressValidation: props.onAddressValidation,
32062
+ onApplyPreset: props.onApplyPreset,
32063
+ onBeforeLabelCreate: props.onBeforeLabelCreate,
32064
+ onChangeAddress: props.onChangeAddress,
32065
+ onChangeShipmentFormMode: props.onChangeShipmentFormMode,
32066
+ onLabelCreateFailure: props.onLabelCreateFailure,
32067
+ onLabelCreateSuccess: props.onLabelCreateSuccess,
32068
+ onRateSaved: props.onRateSaved,
32069
+ onRatesCalculated: props.onRatesCalculated,
32070
+ onShipmentUpdated: onShipmentUpdated,
32071
+ onToggleAddressPreferenceDisclosure: props.onToggleAddressPreferenceDisclosure,
32072
+ printLabelLayout: props.printLabelLayout,
32073
+ shipment: shipment,
32074
+ shippingPresets: props.shippingPresets,
32075
+ warehouseId: props.warehouseId
32076
+ }, props))
32077
+ }));
32078
+ };
32079
+
32080
+ const PurchaseLabel = _a => {
32081
+ var {
32082
+ shipmentId
32083
+ } = _a,
32084
+ props = __rest(_a, ["shipmentId"]);
32085
+ if (shipmentId) {
32086
+ return jsx(PurchaseLabelByShipment, Object.assign({
32087
+ shipmentId: shipmentId
32088
+ }, props));
32089
+ } else {
32090
+ return jsx(PurchaseLabelBySalesOrder, Object.assign({}, props));
32091
+ }
32092
+ };
32093
+
31753
32094
  const Shipment = ({
31754
32095
  features,
31755
32096
  onClickPrintLabel,
@@ -31818,11 +32159,7 @@ const VoidLabel = ({
31818
32159
  });
31819
32160
  };
31820
32161
 
31821
- const Element$5 = registerElement("manage-funding", ManageFunding);
31822
-
31823
- const Element$4 = registerElement("manage-warehouses", ManageWarehouses);
31824
-
31825
- const Element$3 = registerElement("purchase-label", SalesOrder);
32162
+ const Element$3 = registerElement("purchase-label", PurchaseLabel);
31826
32163
 
31827
32164
  const Element$2 = registerElement("onboarding", Onboarding);
31828
32165
 
@@ -32512,5 +32849,35 @@ const renderWithProviders = component => {
32512
32849
  })
32513
32850
  });
32514
32851
  };
32852
+ /**
32853
+ * Wraps the test with all of the usual Shipengine / Giger / i18 / etc providers that a full, registered "Element" would have.
32854
+ * This allows components to simulate usage in an Element via `decorators: [withAllProviders]`
32855
+ **/
32856
+ const renderWithAllProviders = component => {
32857
+ const theme = createTheme(BrandName.FALLBACK);
32858
+ return render(component, {
32859
+ wrapper: ({
32860
+ children
32861
+ }) => jsx(ShipEngineProvider, Object.assign({
32862
+ baseURL: "/api",
32863
+ getToken: () => {
32864
+ var _a;
32865
+ return (_a = process.env.STORYBOOK_TOKEN) !== null && _a !== void 0 ? _a : "none";
32866
+ }
32867
+ }, {
32868
+ children: jsx(RootPortalProvider, {
32869
+ children: jsx(GigerConfigProvider, Object.assign({
32870
+ resolveIcon: name => `<svg>${name}</svg>`
32871
+ }, {
32872
+ children: jsx(ThemeProvider, Object.assign({
32873
+ theme: deserialize(theme)
32874
+ }, {
32875
+ children: children
32876
+ }))
32877
+ }))
32878
+ })
32879
+ }))
32880
+ });
32881
+ };
32515
32882
 
32516
- export { Accordion, ButtonGroup, Country, Cube, ElementsContext, ElementsProvider, ErrorBoundary, ErrorFallback, fields as Field, FieldLabel, FormPortal, GigerProvider, ItemsBreakdown, Element$6 as ListCarriers, Loader, Element$5 as ManageFunding, Element$4 as ManageWarehouses, Element$2 as Onboarding, PageLayoutProvider, Portal, Element$3 as PurchaseLabel, RootPortalProvider, Spacer, index$1 as Templates, UsState, UsaCity, Element$1 as ViewShipment, Element as VoidLabel, addressFactory, addressPreferenceFactory, addressValidationFactory, calculateTotal, capitalizeFirstLetter, carrierFactory, carrierOptionFactory, convertDimensions, convertWeight, countries, countryCodes, createCodedErrors, createDictionary, createStyles, currencySymbol, customsItemFactory, daysAfter, downloadFactory, errorMap, euCountryCodes, extendZod, formLogger, formatCreditCardNumber, formatDate, formatFractionalWeight, formatMoney, fractionalWeightFactory, getCustomsFromSalesOrder, getExpirationYears, getIsCustomsRequiredForSalesOrder, getIsCustomsRequiredForShipment, getIsInternationalShipment, getPendingShipment, getRateRequiresAcknowledgement, getRequestedServices, getTotalRateAmount, isDomesticAddress, isFlatRatePackageCode, isMilitaryAddress, isNowOrInTheFuture, isPoBox, isPoBoxAddress, isString, isUnitedStatesTerritory, isUspsCarrier, labelFactory, linkedResourceFactory, moneyFactory, moneySchema, mostRecent, nextDayCutoff, omitTime, orderSourceFactory, orderSourceRefreshInfoFactory, packageFactory, phoneSchema, phoneSchemaUnvalidated, postalCodeRegex$3 as postalCodeRegex, randomDeliveryConfirmation, randomFulfillmentStatus, randomInsuranceProvider, randomOrderSourceCode, randomPaymentStatus, randomShipengineId, randomShipengineSlug, randomWeightUnit, registerElement, renderWithProviders, salesOrderFactory, salesOrderItemFactory, salesOrderShipmentFactory, serviceFactory, shipmentFactory, shipmentItemFactory, shipmentPackageFactory, sortByCreationDate, tristateValue, usCities, usStateCodes, usStates, useCarrierMetadata, useConfirmationOptions, useCountryCodeOptions, useCustomsContentsOptions, useCustomsNonDeliveryOptions, useElements, useExpirationMonthOptions, useInsuranceProviderOptions, useNestedForm, usePackageOptions, usePageLayout, useRateOptions, useRootPortal, useRunOnceOnTrue, useServiceCodeOptions, useShippingPresetsOptions, useStateCodeOptions, useToggle, useWarehouseOptions, validationResolver, warehouseFactory, weightFactory, weightWithUnitFactory };
32883
+ export { Accordion, AddFundsForm, AutoFundingForm, ButtonGroup, CarrierBalance, Country, Cube, ElementsContext, ElementsProvider, ErrorBoundary, ErrorFallback, fields as Field, FieldLabel, FormPortal, FundAndPurchase, GigerProvider, InlineLabel, ItemsBreakdown, LinkAction, Element$5 as ListCarriers, Loader, ManageFunding, Element$4 as ManageWarehouses, Element$2 as Onboarding, PageLayoutProvider, Portal, Element$3 as PurchaseLabel, RootPortalProvider, Spacer, Spread, StoryNotes, index$1 as Templates, UsState, UsaCity, Element$1 as ViewShipment, Element as VoidLabel, addressFactory, addressPreferenceFactory, addressValidationFactory, autoFundingSchema, calculateTotal, capitalizeFirstLetter, carrierFactory, carrierOptionFactory, convertDimensions, convertWeight, countries, countryCodes, createCodedErrors, createDictionary, createStyles, currencySymbol, customsItemFactory, daysAfter, downloadFactory, errorMap, euCountryCodes, extendZod, formLogger, formatCreditCardNumber, formatDate, formatFractionalWeight, formatMoney, fractionalWeightFactory, getAddFundsSchema, getCustomsFromSalesOrder, getExpirationYears, getIsCustomsRequiredForSalesOrder, getIsCustomsRequiredForShipment, getIsInternationalShipment, getPendingShipment, getRateRequiresAcknowledgement, getRequestedServices, getSalesOrderItemsFromSalesOrderOrShipment, getTotalRateAmount, isDomesticAddress, isFlatRatePackageCode, isMilitaryAddress, isNowOrInTheFuture, isPoBox, isPoBoxAddress, isString, isUnitedStatesTerritory, isUspsCarrier, labelFactory, linkedResourceFactory, moneyFactory, moneySchema, mostRecent, nextDayCutoff, omitTime, orderSourceFactory, orderSourceRefreshInfoFactory, packageFactory, phoneSchema, phoneSchemaUnvalidated, postalCodeRegex$3 as postalCodeRegex, randomDeliveryConfirmation, randomFulfillmentStatus, randomInsuranceProvider, randomOrderSourceCode, randomPaymentStatus, randomShipengineId, randomShipengineSlug, randomWeightUnit, registerElement, renderWithAllProviders, renderWithProviders, salesOrderFactory, salesOrderItemFactory, salesOrderShipmentFactory, serviceFactory, shipmentFactory, shipmentItemFactory, shipmentPackageFactory, sortByCreationDate, tristateValue, usCities, usStateCodes, usStates, useCarrierMetadata, useConfirmationOptions, useCountryCodeOptions, useCustomsContentsOptions, useCustomsNonDeliveryOptions, useElements, useExpirationMonthOptions, useInsuranceProviderOptions, useNestedForm, usePackageOptions, usePageLayout, useRateOptions, useRootPortal, useRunOnceOnTrue, useServiceCodeOptions, useShippingPresetsOptions, useStateCodeOptions, useToggle, useWarehouseOptions, validationResolver, warehouseFactory, weightFactory, weightWithUnitFactory };