@shipengine/elements 0.37.1 → 0.37.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.
package/index.cjs CHANGED
@@ -12832,7 +12832,7 @@ const CustomsItemForm = ({
12832
12832
  }));
12833
12833
  const formInterface = jsxRuntime.jsxs("section", Object.assign({
12834
12834
  css: theme => ({
12835
- backgroundColor: theme.palette.gray.megaLight,
12835
+ backgroundColor: theme.palette.gray.ultraLight,
12836
12836
  padding: theme.spacing(2)
12837
12837
  })
12838
12838
  }, {
@@ -14635,22 +14635,21 @@ const rateSchema = zod.z.object({
14635
14635
  const RateForm = ({
14636
14636
  carriers,
14637
14637
  disabled,
14638
- errors,
14639
14638
  displayableRateErrors,
14640
- displayableLabelErrors,
14639
+ errors,
14641
14640
  features,
14641
+ isLoading,
14642
14642
  labelErrors,
14643
14643
  labels,
14644
14644
  labelsLoading,
14645
- isLoading,
14646
14645
  onSave,
14647
14646
  onSelectRate,
14648
14647
  onSubmit,
14649
- rates,
14650
- preferredRates,
14651
- shipment,
14652
14648
  outOfBandDisplayableErrors,
14653
- preferredServiceCodes
14649
+ preferredRates,
14650
+ preferredServiceCodes,
14651
+ rates,
14652
+ shipment
14654
14653
  }) => {
14655
14654
  var _a, _b, _c, _d, _e, _f;
14656
14655
  features = Object.assign({
@@ -14664,7 +14663,6 @@ const RateForm = ({
14664
14663
  saveRate: true
14665
14664
  }
14666
14665
  }, features !== null && features !== void 0 ? features : {});
14667
- const allDisplayableErrors = [...(displayableRateErrors !== null && displayableRateErrors !== void 0 ? displayableRateErrors : []), ...(outOfBandDisplayableErrors !== null && outOfBandDisplayableErrors !== void 0 ? outOfBandDisplayableErrors : [])];
14668
14666
  const {
14669
14667
  t
14670
14668
  } = reactI18next.useTranslation();
@@ -14762,6 +14760,22 @@ const RateForm = ({
14762
14760
  const preferredRate = preferredRates === null || preferredRates === void 0 ? void 0 : preferredRates.find(r => r.rate.rateId === (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.rateId));
14763
14761
  return !!preferredRate;
14764
14762
  }, [preferredRates, selectedRate]);
14763
+ const displayableErrors = React.useMemo(() => {
14764
+ const rateAndShipmentErrors = [...(displayableRateErrors !== null && displayableRateErrors !== void 0 ? displayableRateErrors : []), ...(outOfBandDisplayableErrors !== null && outOfBandDisplayableErrors !== void 0 ? outOfBandDisplayableErrors : [])];
14765
+ if (rateAndShipmentErrors.length && rateOptions.length === 0) {
14766
+ return {
14767
+ messages: rateAndShipmentErrors,
14768
+ title: "errorTypes.rateInvalid"
14769
+ };
14770
+ }
14771
+ if (labelErrors === null || labelErrors === void 0 ? void 0 : labelErrors.length) {
14772
+ return {
14773
+ messages: labelErrors,
14774
+ title: "errorTypes.purchase"
14775
+ };
14776
+ }
14777
+ return undefined;
14778
+ }, [rateOptions, labelErrors, displayableRateErrors, outOfBandDisplayableErrors]);
14765
14779
  return jsxRuntime.jsxs("form", Object.assign({
14766
14780
  id: "rate-form",
14767
14781
  onSubmit: handleSubmit,
@@ -14806,7 +14820,7 @@ const RateForm = ({
14806
14820
  children: showHiddenRates ? t("purchase-label:actions.showFewerRates") : t("purchase-label:actions.showMoreRates")
14807
14821
  }))
14808
14822
  }))]
14809
- }) : !isLoading && !!allDisplayableErrors.length ? null : jsxRuntime.jsxs("article", Object.assign({
14823
+ }) : !isLoading && !!displayableErrors ? null : jsxRuntime.jsxs("article", Object.assign({
14810
14824
  css: styles$3.ratesInterstitial,
14811
14825
  role: "presentation"
14812
14826
  }, {
@@ -14815,13 +14829,11 @@ const RateForm = ({
14815
14829
  }), jsxRuntime.jsx(Spacer, {}), isLoading ? t("purchase-label:loading.calculatingRates") : t("purchase-label:cta.addPackageDetails")]
14816
14830
  })), jsxRuntime.jsx(Spacer, {
14817
14831
  multiplier: 2
14818
- }), !isLoading && (!!allDisplayableErrors.length && rateOptions.length === 0 || !!(labelErrors === null || labelErrors === void 0 ? void 0 : labelErrors.length)) && jsxRuntime.jsx(giger.InlineNotification, Object.assign({
14819
- title: t("errorTypes.rateInvalid"),
14832
+ }), !isLoading && !!displayableErrors && jsxRuntime.jsx(giger.InlineNotification, Object.assign({
14833
+ title: t(displayableErrors.title),
14820
14834
  type: giger.NotificationType.ERROR
14821
14835
  }, {
14822
- children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
14823
- children: [displayableRateErrors, outOfBandDisplayableErrors, displayableLabelErrors]
14824
- })
14836
+ children: displayableErrors.messages
14825
14837
  }))]
14826
14838
  })), ((_d = features === null || features === void 0 ? void 0 : features.rateForm) === null || _d === void 0 ? void 0 : _d.labelLayout) && !labelsLoading && !(labels === null || labels === void 0 ? void 0 : labels.length) && jsxRuntime.jsx(Section, Object.assign({
14827
14839
  title: t("manage-defaults:label.title")
@@ -14990,21 +15002,37 @@ const styles$1 = createStyles({
14990
15002
  padding: `${theme.spacing(1)}px ${theme.spacing(2)}px 0 ${theme.spacing(1)}px`,
14991
15003
  width: theme.spacing(5)
14992
15004
  }),
15005
+ header: theme => ({
15006
+ "& > tr > th": {
15007
+ "&:after": {
15008
+ borderBottom: "none"
15009
+ }
15010
+ }
15011
+ }),
15012
+ headerActions: theme => ({
15013
+ backgroundColor: theme.palette.gray.ultraLight,
15014
+ padding: `${theme.spacing(1)}px ${theme.spacing(2)}px 0 ${theme.spacing(1)}px`,
15015
+ width: theme.spacing(5)
15016
+ }),
14993
15017
  headerDescription: theme => ({
15018
+ backgroundColor: theme.palette.gray.ultraLight,
14994
15019
  overflow: "visible",
14995
15020
  padding: `${theme.spacing(1)}px ${theme.spacing(2)}px`
14996
15021
  }),
14997
15022
  headerEach: theme => ({
15023
+ backgroundColor: theme.palette.gray.ultraLight,
14998
15024
  padding: `${theme.spacing(1)}px ${theme.spacing(1)}px ${theme.spacing(1)}px 0`,
14999
15025
  textAlign: "right",
15000
15026
  width: theme.spacing(10)
15001
15027
  }),
15002
15028
  headerQty: theme => ({
15029
+ backgroundColor: theme.palette.gray.ultraLight,
15003
15030
  padding: theme.spacing(1),
15004
15031
  textAlign: "right",
15005
15032
  width: theme.spacing(5)
15006
15033
  }),
15007
15034
  headerTotal: theme => ({
15035
+ backgroundColor: theme.palette.gray.ultraLight,
15008
15036
  padding: `${theme.spacing(1)}px 0 ${theme.spacing(1)}px ${theme.spacing(1)}px`,
15009
15037
  textAlign: "right",
15010
15038
  width: theme.spacing(10)
@@ -15026,7 +15054,7 @@ const styles$1 = createStyles({
15026
15054
  itemQty: theme => ({
15027
15055
  overflow: "visible",
15028
15056
  padding: `${theme.spacing(1)}px ${theme.spacing(1)}px 0`,
15029
- textAlign: "center",
15057
+ textAlign: "right",
15030
15058
  width: theme.spacing(5)
15031
15059
  }),
15032
15060
  itemTotal: theme => ({
@@ -15034,6 +15062,14 @@ const styles$1 = createStyles({
15034
15062
  padding: `${theme.spacing(1)}px 0 0 ${theme.spacing(1)}px`,
15035
15063
  textAlign: "right",
15036
15064
  width: theme.spacing(10)
15065
+ }),
15066
+ subtitle: () => ({
15067
+ letterSpacing: "0.01em"
15068
+ }),
15069
+ table: () => ({
15070
+ border: "1px solid #d4e4e8",
15071
+ borderRadius: "0",
15072
+ boxShadow: "none"
15037
15073
  })
15038
15074
  });
15039
15075
 
@@ -15144,12 +15180,15 @@ const CustomsItemsDisplay = ({
15144
15180
  }))]
15145
15181
  })), customsItems.length > 0 && jsxRuntime.jsxs(jsxRuntime.Fragment, {
15146
15182
  children: [jsxRuntime.jsx(Spacer, {}), jsxRuntime.jsx(giger.Table, Object.assign({
15147
- header: jsxRuntime.jsx(giger.TableHeader, {
15183
+ header: jsxRuntime.jsx(giger.TableHeader, Object.assign({
15184
+ css: styles$1.header
15185
+ }, {
15148
15186
  children: jsxRuntime.jsxs(giger.TableBaseRow, {
15149
15187
  children: [jsxRuntime.jsx(giger.TableHeaderCell, Object.assign({
15150
15188
  css: styles$1.headerDescription
15151
15189
  }, {
15152
15190
  children: jsxRuntime.jsx(giger.Typography, Object.assign({
15191
+ css: styles$1.subtitle,
15153
15192
  variant: "subtitle2"
15154
15193
  }, {
15155
15194
  children: t("customs.fields.description")
@@ -15158,6 +15197,7 @@ const CustomsItemsDisplay = ({
15158
15197
  css: styles$1.headerEach
15159
15198
  }, {
15160
15199
  children: jsxRuntime.jsx(giger.Typography, Object.assign({
15200
+ css: styles$1.subtitle,
15161
15201
  variant: "subtitle2"
15162
15202
  }, {
15163
15203
  children: t("customs.each", {
@@ -15168,6 +15208,7 @@ const CustomsItemsDisplay = ({
15168
15208
  css: styles$1.headerQty
15169
15209
  }, {
15170
15210
  children: jsxRuntime.jsx(giger.Typography, Object.assign({
15211
+ css: styles$1.subtitle,
15171
15212
  variant: "subtitle2"
15172
15213
  }, {
15173
15214
  children: t("customs.fields.quantity")
@@ -15176,6 +15217,7 @@ const CustomsItemsDisplay = ({
15176
15217
  css: styles$1.headerTotal
15177
15218
  }, {
15178
15219
  children: jsxRuntime.jsx(giger.Typography, Object.assign({
15220
+ css: styles$1.subtitle,
15179
15221
  variant: "subtitle2"
15180
15222
  }, {
15181
15223
  children: t("customs.total", {
@@ -15183,10 +15225,11 @@ const CustomsItemsDisplay = ({
15183
15225
  })
15184
15226
  }))
15185
15227
  })), jsxRuntime.jsx(giger.TableHeaderCell, {
15186
- css: styles$1.actionsColumn
15228
+ css: styles$1.headerActions
15187
15229
  })]
15188
15230
  })
15189
- })
15231
+ })),
15232
+ outerWrapperStyles: styles$1.table
15190
15233
  }, {
15191
15234
  children: jsxRuntime.jsx(giger.TableBody, {
15192
15235
  children: customsItems.map(item => jsxRuntime.jsxs(React.Fragment, {
@@ -16897,7 +16940,7 @@ var common = {
16897
16940
  invalidAddressNameStrict: "Recipient Name must have two characters in First and Last Name.",
16898
16941
  invalidAddressPoBox: "A physical address is required for wallet registration. You can add a PO Box as a Ship From address.",
16899
16942
  invalidCreditCardType: "Card type must be Visa, Mastercard, American Express, or Discover",
16900
- invalidExpiration: "Invalid Expiration Date",
16943
+ invalidExpirationDate: "Invalid Expiration Date",
16901
16944
  invalidPostalCode: "Invalid Postal Code",
16902
16945
  invalidStateProvince: "Invalid State",
16903
16946
  invalidString: "{{fieldLabel}} is invalid",
@@ -17933,12 +17976,12 @@ const useRequestRates = ({
17933
17976
  getPreferredRates
17934
17977
  });
17935
17978
  const requestRates = React.useCallback((shipment, isInternational) => __awaiter(void 0, void 0, void 0, function* () {
17936
- var _a, _b;
17937
- const internationalCarrierIds = (_a = carriers === null || carriers === void 0 ? void 0 : carriers.map(c => c.carrierId)) !== null && _a !== void 0 ? _a : [];
17938
- const domesticCarrierIds = (_b = carriers === null || carriers === void 0 ? void 0 : carriers.filter(c => !["dhl"].includes(c.carrierCode)).map(c => c.carrierId)) !== null && _b !== void 0 ? _b : [];
17979
+ var _a;
17980
+ // filter out DHL for domestic shipments
17981
+ const carrierIds = (_a = carriers === null || carriers === void 0 ? void 0 : carriers.filter(c => isInternational || !c.carrierCode.includes("dhl")).map(c => c.carrierId)) !== null && _a !== void 0 ? _a : [];
17939
17982
  const standardRatesResponse = yield calculateRates({
17940
17983
  rateOptions: {
17941
- carrierIds: shipment.carrierId ? [shipment.carrierId] : isInternational ? internationalCarrierIds : domesticCarrierIds,
17984
+ carrierIds: shipment.carrierId ? [shipment.carrierId] : carrierIds,
17942
17985
  packageTypes: (customPackageTypes === null || customPackageTypes === void 0 ? void 0 : customPackageTypes.find(p => p.packageId === shipment.packages[0].packageId)) ? ["package"] // Only specify package types for non-custom packages
17943
17986
  : shipment.packages.map(pkg => pkg.packageCode),
17944
17987
  serviceCodes: shipment.serviceCode ? [shipment.serviceCode] : undefined
@@ -18236,11 +18279,10 @@ const useRatesForm = ({
18236
18279
  });
18237
18280
  return {
18238
18281
  carriers,
18239
- displayableLabelErrors,
18240
18282
  displayableRateErrors,
18241
18283
  errors: errors.length > 0 ? errors : undefined,
18242
18284
  isLoading: ratesCalculating,
18243
- labelErrors: (labelErrors === null || labelErrors === void 0 ? void 0 : labelErrors.length) ? labelErrors : undefined,
18285
+ labelErrors: displayableLabelErrors,
18244
18286
  labels,
18245
18287
  labelsLoading,
18246
18288
  onSave: handleSave,
package/index.js CHANGED
@@ -12800,7 +12800,7 @@ const CustomsItemForm = ({
12800
12800
  }));
12801
12801
  const formInterface = jsxs("section", Object.assign({
12802
12802
  css: theme => ({
12803
- backgroundColor: theme.palette.gray.megaLight,
12803
+ backgroundColor: theme.palette.gray.ultraLight,
12804
12804
  padding: theme.spacing(2)
12805
12805
  })
12806
12806
  }, {
@@ -14603,22 +14603,21 @@ const rateSchema = z.object({
14603
14603
  const RateForm = ({
14604
14604
  carriers,
14605
14605
  disabled,
14606
- errors,
14607
14606
  displayableRateErrors,
14608
- displayableLabelErrors,
14607
+ errors,
14609
14608
  features,
14609
+ isLoading,
14610
14610
  labelErrors,
14611
14611
  labels,
14612
14612
  labelsLoading,
14613
- isLoading,
14614
14613
  onSave,
14615
14614
  onSelectRate,
14616
14615
  onSubmit,
14617
- rates,
14618
- preferredRates,
14619
- shipment,
14620
14616
  outOfBandDisplayableErrors,
14621
- preferredServiceCodes
14617
+ preferredRates,
14618
+ preferredServiceCodes,
14619
+ rates,
14620
+ shipment
14622
14621
  }) => {
14623
14622
  var _a, _b, _c, _d, _e, _f;
14624
14623
  features = Object.assign({
@@ -14632,7 +14631,6 @@ const RateForm = ({
14632
14631
  saveRate: true
14633
14632
  }
14634
14633
  }, features !== null && features !== void 0 ? features : {});
14635
- const allDisplayableErrors = [...(displayableRateErrors !== null && displayableRateErrors !== void 0 ? displayableRateErrors : []), ...(outOfBandDisplayableErrors !== null && outOfBandDisplayableErrors !== void 0 ? outOfBandDisplayableErrors : [])];
14636
14634
  const {
14637
14635
  t
14638
14636
  } = useTranslation();
@@ -14730,6 +14728,22 @@ const RateForm = ({
14730
14728
  const preferredRate = preferredRates === null || preferredRates === void 0 ? void 0 : preferredRates.find(r => r.rate.rateId === (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.rateId));
14731
14729
  return !!preferredRate;
14732
14730
  }, [preferredRates, selectedRate]);
14731
+ const displayableErrors = useMemo(() => {
14732
+ const rateAndShipmentErrors = [...(displayableRateErrors !== null && displayableRateErrors !== void 0 ? displayableRateErrors : []), ...(outOfBandDisplayableErrors !== null && outOfBandDisplayableErrors !== void 0 ? outOfBandDisplayableErrors : [])];
14733
+ if (rateAndShipmentErrors.length && rateOptions.length === 0) {
14734
+ return {
14735
+ messages: rateAndShipmentErrors,
14736
+ title: "errorTypes.rateInvalid"
14737
+ };
14738
+ }
14739
+ if (labelErrors === null || labelErrors === void 0 ? void 0 : labelErrors.length) {
14740
+ return {
14741
+ messages: labelErrors,
14742
+ title: "errorTypes.purchase"
14743
+ };
14744
+ }
14745
+ return undefined;
14746
+ }, [rateOptions, labelErrors, displayableRateErrors, outOfBandDisplayableErrors]);
14733
14747
  return jsxs("form", Object.assign({
14734
14748
  id: "rate-form",
14735
14749
  onSubmit: handleSubmit,
@@ -14774,7 +14788,7 @@ const RateForm = ({
14774
14788
  children: showHiddenRates ? t("purchase-label:actions.showFewerRates") : t("purchase-label:actions.showMoreRates")
14775
14789
  }))
14776
14790
  }))]
14777
- }) : !isLoading && !!allDisplayableErrors.length ? null : jsxs("article", Object.assign({
14791
+ }) : !isLoading && !!displayableErrors ? null : jsxs("article", Object.assign({
14778
14792
  css: styles$3.ratesInterstitial,
14779
14793
  role: "presentation"
14780
14794
  }, {
@@ -14783,13 +14797,11 @@ const RateForm = ({
14783
14797
  }), jsx(Spacer, {}), isLoading ? t("purchase-label:loading.calculatingRates") : t("purchase-label:cta.addPackageDetails")]
14784
14798
  })), jsx(Spacer, {
14785
14799
  multiplier: 2
14786
- }), !isLoading && (!!allDisplayableErrors.length && rateOptions.length === 0 || !!(labelErrors === null || labelErrors === void 0 ? void 0 : labelErrors.length)) && jsx(InlineNotification, Object.assign({
14787
- title: t("errorTypes.rateInvalid"),
14800
+ }), !isLoading && !!displayableErrors && jsx(InlineNotification, Object.assign({
14801
+ title: t(displayableErrors.title),
14788
14802
  type: NotificationType.ERROR
14789
14803
  }, {
14790
- children: jsxs(Fragment, {
14791
- children: [displayableRateErrors, outOfBandDisplayableErrors, displayableLabelErrors]
14792
- })
14804
+ children: displayableErrors.messages
14793
14805
  }))]
14794
14806
  })), ((_d = features === null || features === void 0 ? void 0 : features.rateForm) === null || _d === void 0 ? void 0 : _d.labelLayout) && !labelsLoading && !(labels === null || labels === void 0 ? void 0 : labels.length) && jsx(Section, Object.assign({
14795
14807
  title: t("manage-defaults:label.title")
@@ -14958,21 +14970,37 @@ const styles$1 = createStyles({
14958
14970
  padding: `${theme.spacing(1)}px ${theme.spacing(2)}px 0 ${theme.spacing(1)}px`,
14959
14971
  width: theme.spacing(5)
14960
14972
  }),
14973
+ header: theme => ({
14974
+ "& > tr > th": {
14975
+ "&:after": {
14976
+ borderBottom: "none"
14977
+ }
14978
+ }
14979
+ }),
14980
+ headerActions: theme => ({
14981
+ backgroundColor: theme.palette.gray.ultraLight,
14982
+ padding: `${theme.spacing(1)}px ${theme.spacing(2)}px 0 ${theme.spacing(1)}px`,
14983
+ width: theme.spacing(5)
14984
+ }),
14961
14985
  headerDescription: theme => ({
14986
+ backgroundColor: theme.palette.gray.ultraLight,
14962
14987
  overflow: "visible",
14963
14988
  padding: `${theme.spacing(1)}px ${theme.spacing(2)}px`
14964
14989
  }),
14965
14990
  headerEach: theme => ({
14991
+ backgroundColor: theme.palette.gray.ultraLight,
14966
14992
  padding: `${theme.spacing(1)}px ${theme.spacing(1)}px ${theme.spacing(1)}px 0`,
14967
14993
  textAlign: "right",
14968
14994
  width: theme.spacing(10)
14969
14995
  }),
14970
14996
  headerQty: theme => ({
14997
+ backgroundColor: theme.palette.gray.ultraLight,
14971
14998
  padding: theme.spacing(1),
14972
14999
  textAlign: "right",
14973
15000
  width: theme.spacing(5)
14974
15001
  }),
14975
15002
  headerTotal: theme => ({
15003
+ backgroundColor: theme.palette.gray.ultraLight,
14976
15004
  padding: `${theme.spacing(1)}px 0 ${theme.spacing(1)}px ${theme.spacing(1)}px`,
14977
15005
  textAlign: "right",
14978
15006
  width: theme.spacing(10)
@@ -14994,7 +15022,7 @@ const styles$1 = createStyles({
14994
15022
  itemQty: theme => ({
14995
15023
  overflow: "visible",
14996
15024
  padding: `${theme.spacing(1)}px ${theme.spacing(1)}px 0`,
14997
- textAlign: "center",
15025
+ textAlign: "right",
14998
15026
  width: theme.spacing(5)
14999
15027
  }),
15000
15028
  itemTotal: theme => ({
@@ -15002,6 +15030,14 @@ const styles$1 = createStyles({
15002
15030
  padding: `${theme.spacing(1)}px 0 0 ${theme.spacing(1)}px`,
15003
15031
  textAlign: "right",
15004
15032
  width: theme.spacing(10)
15033
+ }),
15034
+ subtitle: () => ({
15035
+ letterSpacing: "0.01em"
15036
+ }),
15037
+ table: () => ({
15038
+ border: "1px solid #d4e4e8",
15039
+ borderRadius: "0",
15040
+ boxShadow: "none"
15005
15041
  })
15006
15042
  });
15007
15043
 
@@ -15112,12 +15148,15 @@ const CustomsItemsDisplay = ({
15112
15148
  }))]
15113
15149
  })), customsItems.length > 0 && jsxs(Fragment, {
15114
15150
  children: [jsx(Spacer, {}), jsx(Table, Object.assign({
15115
- header: jsx(TableHeader, {
15151
+ header: jsx(TableHeader, Object.assign({
15152
+ css: styles$1.header
15153
+ }, {
15116
15154
  children: jsxs(TableBaseRow, {
15117
15155
  children: [jsx(TableHeaderCell, Object.assign({
15118
15156
  css: styles$1.headerDescription
15119
15157
  }, {
15120
15158
  children: jsx(Typography, Object.assign({
15159
+ css: styles$1.subtitle,
15121
15160
  variant: "subtitle2"
15122
15161
  }, {
15123
15162
  children: t("customs.fields.description")
@@ -15126,6 +15165,7 @@ const CustomsItemsDisplay = ({
15126
15165
  css: styles$1.headerEach
15127
15166
  }, {
15128
15167
  children: jsx(Typography, Object.assign({
15168
+ css: styles$1.subtitle,
15129
15169
  variant: "subtitle2"
15130
15170
  }, {
15131
15171
  children: t("customs.each", {
@@ -15136,6 +15176,7 @@ const CustomsItemsDisplay = ({
15136
15176
  css: styles$1.headerQty
15137
15177
  }, {
15138
15178
  children: jsx(Typography, Object.assign({
15179
+ css: styles$1.subtitle,
15139
15180
  variant: "subtitle2"
15140
15181
  }, {
15141
15182
  children: t("customs.fields.quantity")
@@ -15144,6 +15185,7 @@ const CustomsItemsDisplay = ({
15144
15185
  css: styles$1.headerTotal
15145
15186
  }, {
15146
15187
  children: jsx(Typography, Object.assign({
15188
+ css: styles$1.subtitle,
15147
15189
  variant: "subtitle2"
15148
15190
  }, {
15149
15191
  children: t("customs.total", {
@@ -15151,10 +15193,11 @@ const CustomsItemsDisplay = ({
15151
15193
  })
15152
15194
  }))
15153
15195
  })), jsx(TableHeaderCell, {
15154
- css: styles$1.actionsColumn
15196
+ css: styles$1.headerActions
15155
15197
  })]
15156
15198
  })
15157
- })
15199
+ })),
15200
+ outerWrapperStyles: styles$1.table
15158
15201
  }, {
15159
15202
  children: jsx(TableBody, {
15160
15203
  children: customsItems.map(item => jsxs(Fragment$1, {
@@ -16865,7 +16908,7 @@ var common = {
16865
16908
  invalidAddressNameStrict: "Recipient Name must have two characters in First and Last Name.",
16866
16909
  invalidAddressPoBox: "A physical address is required for wallet registration. You can add a PO Box as a Ship From address.",
16867
16910
  invalidCreditCardType: "Card type must be Visa, Mastercard, American Express, or Discover",
16868
- invalidExpiration: "Invalid Expiration Date",
16911
+ invalidExpirationDate: "Invalid Expiration Date",
16869
16912
  invalidPostalCode: "Invalid Postal Code",
16870
16913
  invalidStateProvince: "Invalid State",
16871
16914
  invalidString: "{{fieldLabel}} is invalid",
@@ -17901,12 +17944,12 @@ const useRequestRates = ({
17901
17944
  getPreferredRates
17902
17945
  });
17903
17946
  const requestRates = useCallback((shipment, isInternational) => __awaiter(void 0, void 0, void 0, function* () {
17904
- var _a, _b;
17905
- const internationalCarrierIds = (_a = carriers === null || carriers === void 0 ? void 0 : carriers.map(c => c.carrierId)) !== null && _a !== void 0 ? _a : [];
17906
- const domesticCarrierIds = (_b = carriers === null || carriers === void 0 ? void 0 : carriers.filter(c => !["dhl"].includes(c.carrierCode)).map(c => c.carrierId)) !== null && _b !== void 0 ? _b : [];
17947
+ var _a;
17948
+ // filter out DHL for domestic shipments
17949
+ const carrierIds = (_a = carriers === null || carriers === void 0 ? void 0 : carriers.filter(c => isInternational || !c.carrierCode.includes("dhl")).map(c => c.carrierId)) !== null && _a !== void 0 ? _a : [];
17907
17950
  const standardRatesResponse = yield calculateRates({
17908
17951
  rateOptions: {
17909
- carrierIds: shipment.carrierId ? [shipment.carrierId] : isInternational ? internationalCarrierIds : domesticCarrierIds,
17952
+ carrierIds: shipment.carrierId ? [shipment.carrierId] : carrierIds,
17910
17953
  packageTypes: (customPackageTypes === null || customPackageTypes === void 0 ? void 0 : customPackageTypes.find(p => p.packageId === shipment.packages[0].packageId)) ? ["package"] // Only specify package types for non-custom packages
17911
17954
  : shipment.packages.map(pkg => pkg.packageCode),
17912
17955
  serviceCodes: shipment.serviceCode ? [shipment.serviceCode] : undefined
@@ -18204,11 +18247,10 @@ const useRatesForm = ({
18204
18247
  });
18205
18248
  return {
18206
18249
  carriers,
18207
- displayableLabelErrors,
18208
18250
  displayableRateErrors,
18209
18251
  errors: errors.length > 0 ? errors : undefined,
18210
18252
  isLoading: ratesCalculating,
18211
- labelErrors: (labelErrors === null || labelErrors === void 0 ? void 0 : labelErrors.length) ? labelErrors : undefined,
18253
+ labelErrors: displayableLabelErrors,
18212
18254
  labels,
18213
18255
  labelsLoading,
18214
18256
  onSave: handleSave,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/elements",
3
- "version": "0.37.1",
3
+ "version": "0.37.2",
4
4
  "peerDependencies": {
5
5
  "@packlink/giger": "*",
6
6
  "react-i18next": "*",
@@ -12,21 +12,37 @@ export declare const styles: {
12
12
  padding: string;
13
13
  width: number;
14
14
  };
15
+ header: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
16
+ "& > tr > th": {
17
+ "&:after": {
18
+ borderBottom: string;
19
+ };
20
+ };
21
+ };
22
+ headerActions: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
23
+ backgroundColor: string;
24
+ padding: string;
25
+ width: number;
26
+ };
15
27
  headerDescription: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
28
+ backgroundColor: string;
16
29
  overflow: "visible";
17
30
  padding: string;
18
31
  };
19
32
  headerEach: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
33
+ backgroundColor: string;
20
34
  padding: string;
21
35
  textAlign: "right";
22
36
  width: number;
23
37
  };
24
38
  headerQty: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
39
+ backgroundColor: string;
25
40
  padding: number;
26
41
  textAlign: "right";
27
42
  width: number;
28
43
  };
29
44
  headerTotal: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
45
+ backgroundColor: string;
30
46
  padding: string;
31
47
  textAlign: "right";
32
48
  width: number;
@@ -48,7 +64,7 @@ export declare const styles: {
48
64
  itemQty: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
49
65
  overflow: "visible";
50
66
  padding: string;
51
- textAlign: "center";
67
+ textAlign: "right";
52
68
  width: number;
53
69
  };
54
70
  itemTotal: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
@@ -57,4 +73,12 @@ export declare const styles: {
57
73
  textAlign: "right";
58
74
  width: number;
59
75
  };
76
+ subtitle: () => {
77
+ letterSpacing: string;
78
+ };
79
+ table: () => {
80
+ border: string;
81
+ borderRadius: string;
82
+ boxShadow: "none";
83
+ };
60
84
  };
@@ -3,12 +3,11 @@ import { ConfigureShipmentFeatures, PreferredRatesResponse } from "../../../elem
3
3
  export type RateFormProps = {
4
4
  carriers?: SE.Carrier[];
5
5
  disabled?: boolean;
6
- displayableLabelErrors?: string[];
7
6
  displayableRateErrors?: string[];
8
7
  errors?: SE.CodedError[];
9
8
  features?: ConfigureShipmentFeatures;
10
9
  isLoading?: boolean;
11
- labelErrors?: SE.CodedError[];
10
+ labelErrors?: string[];
12
11
  labels?: SE.Label[];
13
12
  labelsLoading?: boolean;
14
13
  onSave?: (rate: Pick<SE.Rate, "carrierId" | "serviceCode">) => Promise<void> | void;
@@ -20,4 +19,4 @@ export type RateFormProps = {
20
19
  rates?: SE.Rate[];
21
20
  shipment?: SE.SalesOrderShipment;
22
21
  };
23
- export declare const RateForm: ({ carriers, disabled, errors, displayableRateErrors, displayableLabelErrors, features, labelErrors, labels, labelsLoading, isLoading, onSave, onSelectRate, onSubmit, rates, preferredRates, shipment, outOfBandDisplayableErrors, preferredServiceCodes, }: RateFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
22
+ export declare const RateForm: ({ carriers, disabled, displayableRateErrors, errors, features, isLoading, labelErrors, labels, labelsLoading, onSave, onSelectRate, onSubmit, outOfBandDisplayableErrors, preferredRates, preferredServiceCodes, rates, shipment, }: RateFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -702,7 +702,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
702
702
  invalidAddressNameStrict: string;
703
703
  invalidAddressPoBox: string;
704
704
  invalidCreditCardType: string;
705
- invalidExpiration: string;
705
+ invalidExpirationDate: string;
706
706
  invalidPostalCode: string;
707
707
  invalidStateProvince: string;
708
708
  invalidString: string;
@@ -5,7 +5,7 @@ export type UseRatesFormProps = {
5
5
  onBeforeLabelCreate?: (rate: SE.Rate, shipment: SE.SalesOrderShipment) => Promise<void> | Promise<{
6
6
  error?: SE.CodedError;
7
7
  rate?: SE.Rate;
8
- }> | void;
8
+ } | undefined> | void;
9
9
  onBeforeRateSaved?: (carrierId: string, serviceCode: string) => Promise<void> | Promise<{
10
10
  data?: {
11
11
  carrierId: string;
@@ -23,11 +23,10 @@ export type UseRatesFormProps = {
23
23
  };
24
24
  export declare const useRatesForm: ({ getPreferredRates, onBeforeRateSaved, onBeforeLabelCreate, onLabelCreateFailure, onLabelCreateSuccess, onRateSaved, onRatesCalculated, onShipmentUpdated, printLabelLayout, shipment, }: UseRatesFormProps) => {
25
25
  carriers: SE.Carrier[] | undefined;
26
- displayableLabelErrors: string[] | undefined;
27
26
  displayableRateErrors: string[] | undefined;
28
27
  errors: SE.CodedError[] | undefined;
29
28
  isLoading: boolean;
30
- labelErrors: SE.CodedError[] | undefined;
29
+ labelErrors: string[] | undefined;
31
30
  labels: SE.Label[] | undefined;
32
31
  labelsLoading: boolean;
33
32
  onSave: ({ carrierId, serviceCode }: Pick<SE.Rate, "carrierId" | "serviceCode">) => Promise<void>;
@@ -664,7 +664,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
664
664
  invalidAddressNameStrict: string;
665
665
  invalidAddressPoBox: string;
666
666
  invalidCreditCardType: string;
667
- invalidExpiration: string;
667
+ invalidExpirationDate: string;
668
668
  invalidPostalCode: string;
669
669
  invalidStateProvince: string;
670
670
  invalidString: string;
@@ -792,7 +792,7 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
792
792
  invalidAddressNameStrict: string;
793
793
  invalidAddressPoBox: string;
794
794
  invalidCreditCardType: string;
795
- invalidExpiration: string;
795
+ invalidExpirationDate: string;
796
796
  invalidPostalCode: string;
797
797
  invalidStateProvince: string;
798
798
  invalidString: string;
@@ -699,7 +699,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
699
699
  invalidAddressNameStrict: string;
700
700
  invalidAddressPoBox: string;
701
701
  invalidCreditCardType: string;
702
- invalidExpiration: string;
702
+ invalidExpirationDate: string;
703
703
  invalidPostalCode: string;
704
704
  invalidStateProvince: string;
705
705
  invalidString: string;
@@ -702,7 +702,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
702
702
  invalidAddressNameStrict: string;
703
703
  invalidAddressPoBox: string;
704
704
  invalidCreditCardType: string;
705
- invalidExpiration: string;
705
+ invalidExpirationDate: string;
706
706
  invalidPostalCode: string;
707
707
  invalidStateProvince: string;
708
708
  invalidString: string;
@@ -574,7 +574,7 @@ declare const _default: {
574
574
  invalidAddressNameStrict: string;
575
575
  invalidAddressPoBox: string;
576
576
  invalidCreditCardType: string;
577
- invalidExpiration: string;
577
+ invalidExpirationDate: string;
578
578
  invalidPostalCode: string;
579
579
  invalidStateProvince: string;
580
580
  invalidString: string;