@shipengine/elements 0.30.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -8905,10 +8905,12 @@ const addressParserSchema = zod.z.object({
8905
8905
  });
8906
8906
 
8907
8907
  const AddressParser = ({
8908
+ errors: parseErrors,
8908
8909
  formId,
8909
8910
  onCancel,
8910
8911
  onSubmit,
8911
- portalRef
8912
+ portalRef,
8913
+ reset
8912
8914
  }) => {
8913
8915
  const {
8914
8916
  t
@@ -8920,20 +8922,26 @@ const AddressParser = ({
8920
8922
  const payload = values;
8921
8923
  onSubmit(payload);
8922
8924
  }));
8925
+ const errors = (parseErrors === null || parseErrors === void 0 ? void 0 : parseErrors.length) ? [t("errorMessages.parsingFailure")] : undefined;
8923
8926
  const formInterface = jsxRuntime.jsxs(jsxRuntime.Fragment, {
8924
8927
  children: [jsxRuntime.jsx(TextArea, {
8925
8928
  control: form.control,
8929
+ errors: errors,
8926
8930
  form: formId,
8927
8931
  label: t("address.parserFields.fullAddress"),
8928
8932
  labelWeight: "normal",
8929
8933
  name: "fullAddress",
8934
+ nativeLabel: true,
8930
8935
  rows: 4
8931
8936
  }), jsxRuntime.jsxs(ButtonGroup, Object.assign({
8932
8937
  justify: "end"
8933
8938
  }, {
8934
8939
  children: [onCancel && jsxRuntime.jsx(giger.Button, Object.assign({
8935
8940
  bold: false,
8936
- onClick: onCancel,
8941
+ onClick: () => {
8942
+ onCancel();
8943
+ reset && reset();
8944
+ },
8937
8945
  type: "button",
8938
8946
  variant: giger.ButtonVariant.TEXT
8939
8947
  }, {
@@ -9227,7 +9235,9 @@ const AddressForm = ({
9227
9235
  onCancelParse,
9228
9236
  onSubmit,
9229
9237
  onSubmitParse,
9230
- portalRef
9238
+ parseAddressErrors,
9239
+ portalRef,
9240
+ resetParseAddress
9231
9241
  }) => {
9232
9242
  const {
9233
9243
  t
@@ -9250,9 +9260,11 @@ const AddressForm = ({
9250
9260
  });
9251
9261
  }), [form, onSubmitParse]);
9252
9262
  const [addressParser, isAddressParserOpen, toggleIsAddressParserOpen] = useNestedForm(AddressParser, {
9263
+ errors: parseAddressErrors,
9253
9264
  formId: `${formId !== null && formId !== void 0 ? formId : ""}-address-parser`,
9254
9265
  onCancel: onCancelParse,
9255
- onSubmit: handleSubmitParse
9266
+ onSubmit: handleSubmitParse,
9267
+ reset: resetParseAddress
9256
9268
  });
9257
9269
  const formInterface = jsxRuntime.jsxs("div", Object.assign({
9258
9270
  css: theme => ({
@@ -10576,11 +10588,10 @@ const styles$f = createStyles({
10576
10588
  display: "flex",
10577
10589
  flexDirection: "column"
10578
10590
  },
10579
- icon: theme => ({
10580
- padding: `${theme.spacing(0.4)}px 0 0 ${theme.spacing(0.5)}px`,
10581
- position: "absolute"
10582
- }),
10583
10591
  link: {
10592
+ "&:visited": {
10593
+ color: "#006fbb"
10594
+ },
10584
10595
  border: "none"
10585
10596
  },
10586
10597
  links: theme => ({
@@ -10607,6 +10618,11 @@ const styles$f = createStyles({
10607
10618
  paddingBottom: theme.spacing(8),
10608
10619
  paddingTop: theme.spacing(2)
10609
10620
  }),
10621
+ termsLink: theme => ({
10622
+ alignItems: "center",
10623
+ display: "inline-flex",
10624
+ fontWeight: theme.typography.fontWeight.normal
10625
+ }),
10610
10626
  termsList: {
10611
10627
  listStyle: "none"
10612
10628
  },
@@ -11182,14 +11198,11 @@ const CarrierTermsForm = ({
11182
11198
  checkboxLabel: jsxRuntime.jsx(reactI18next.Trans, {
11183
11199
  components: {
11184
11200
  icon: jsxRuntime.jsx(giger.Icon, {
11185
- css: styles$f.icon,
11186
11201
  name: showTerms ? gigerTheme.IconNames.CHEVRON_TOP : gigerTheme.IconNames.CHEVRON_BOTTOM,
11187
11202
  size: giger.IconSize.SIZE_SMALL
11188
11203
  }),
11189
11204
  terms: jsxRuntime.jsx(giger.Link, {
11190
- css: theme => ({
11191
- fontWeight: theme.typography.fontWeight.normal
11192
- }),
11205
+ css: styles$f.termsLink,
11193
11206
  "data-testid": "terms-link",
11194
11207
  onClick: e => {
11195
11208
  e.preventDefault();
@@ -13818,6 +13831,8 @@ const ShipmentForm = ({
13818
13831
  onSubmitParseShipTo,
13819
13832
  onToggleAddressPreferenceDisclosure,
13820
13833
  onUpdateCustoms,
13834
+ parseAddressErrors,
13835
+ resetParseAddress,
13821
13836
  salesOrder,
13822
13837
  shipment,
13823
13838
  shippingPresets,
@@ -14097,7 +14112,9 @@ const ShipmentForm = ({
14097
14112
  address: (_b = (_a = addressPreference === null || addressPreference === void 0 ? void 0 : addressPreference.selection) !== null && _a !== void 0 ? _a : shipment === null || shipment === void 0 ? void 0 : shipment.shipTo) !== null && _b !== void 0 ? _b : salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.shipTo,
14098
14113
  formId: "edit-ship-to-form",
14099
14114
  onSubmit: handleSubmitEditShipTo,
14100
- onSubmitParse: onSubmitParseShipTo
14115
+ onSubmitParse: onSubmitParseShipTo,
14116
+ parseAddressErrors,
14117
+ resetParseAddress
14101
14118
  });
14102
14119
  const handleUpdateCustomsItems = React.useCallback(customsItems => __awaiter(void 0, void 0, void 0, function* () {
14103
14120
  const result = yield onUpdateCustoms === null || onUpdateCustoms === void 0 ? void 0 : onUpdateCustoms({
@@ -15367,6 +15384,7 @@ var common = {
15367
15384
  },
15368
15385
  errorMessages: {
15369
15386
  invalidNameOrCompany: "Recipient name and company name (if provided) must have two characters in first and last name.",
15387
+ parsingFailure: "Parsing failed. Please check address and try again.",
15370
15388
  noWarehouses: "You must have an active Ship From Location to use this feature.",
15371
15389
  unableToLoad: {
15372
15390
  accountSettings: "Unable to load account settings",
@@ -16007,13 +16025,16 @@ const useAddress = ({
16007
16025
  } = alchemy.useUpdateSalesOrderShipment();
16008
16026
  const {
16009
16027
  error: parseAddressErrors,
16010
- mutateAsync: parseAddress
16028
+ mutateAsync: parseAddress,
16029
+ reset: resetParseAddress
16011
16030
  } = alchemy.useParseAddress();
16012
16031
  const [addressPreference, _setAddressPreference] = React.useState();
16013
16032
  const [loading, setLoading] = React.useState(true);
16014
16033
  const setAddressPreference = React.useCallback((...args) => {
16015
- setLoading(false);
16016
16034
  _setAddressPreference(...args);
16035
+ if (args.length > 0 && args[0]) {
16036
+ setLoading(false);
16037
+ }
16017
16038
  }, [_setAddressPreference]);
16018
16039
  const toggle = React.useCallback(() => {
16019
16040
  let updatedSelection = undefined;
@@ -16140,14 +16161,16 @@ const useAddress = ({
16140
16161
  title: t("charsetWarnings.address.title")
16141
16162
  };
16142
16163
  }, undefined), [addressPreference === null || addressPreference === void 0 ? void 0 : addressPreference.selection, t]);
16143
- const errors = [...(validateAddressErrors !== null && validateAddressErrors !== void 0 ? validateAddressErrors : []), ...(updateShipmentErrors !== null && updateShipmentErrors !== void 0 ? updateShipmentErrors : []), ...(parseAddressErrors !== null && parseAddressErrors !== void 0 ? parseAddressErrors : [])];
16164
+ const errors = [...(validateAddressErrors !== null && validateAddressErrors !== void 0 ? validateAddressErrors : []), ...(updateShipmentErrors !== null && updateShipmentErrors !== void 0 ? updateShipmentErrors : [])];
16144
16165
  return {
16145
- addressLoading: loading,
16146
16166
  addressErrors: errors.length > 0 ? errors : undefined,
16167
+ addressLoading: loading,
16147
16168
  addressPreference,
16148
16169
  charsetWarning,
16149
16170
  handleChangeAddress,
16150
- handleParseShipTo
16171
+ handleParseShipTo,
16172
+ parseAddressErrors: parseAddressErrors !== null && parseAddressErrors !== void 0 ? parseAddressErrors : undefined,
16173
+ resetParseAddress
16151
16174
  };
16152
16175
  };
16153
16176
 
@@ -16243,6 +16266,9 @@ const useScrubErrors = ({
16243
16266
  var usps_first_class_mail = [
16244
16267
  "First Class Mail shipments must weigh less than {{weight}} oz. Shipments exceeding the weight entered when buying the label will be charged an adjustment fee by USPS."
16245
16268
  ];
16269
+ var usps_ground_advantage = [
16270
+ "USPS Ground Advantage™ service is an affordable and reliable way to send packages inside the U.S. expected in 2–5 business days for items up to 70 lbs."
16271
+ ];
16246
16272
  var usps_media_mail = [
16247
16273
  "Media Mail® can only be used for shipping books, sound recordings, manuscripts, printed music, and other media in packages weighing 70 lbs. or less. Packages containing unsupported items may be subject to post-billing adjustment fees or returned to the sender."
16248
16274
  ];
@@ -16284,6 +16310,7 @@ var rateMessages = {
16284
16310
  "Tracking and refunds are not available for First Class Mail Large Envelopes or Flats labels."
16285
16311
  ],
16286
16312
  usps_first_class_mail: usps_first_class_mail,
16313
+ usps_ground_advantage: usps_ground_advantage,
16287
16314
  usps_media_mail: usps_media_mail,
16288
16315
  usps_parcel_select: usps_parcel_select,
16289
16316
  usps_priority_mail: usps_priority_mail,
@@ -16564,7 +16591,9 @@ const useShipmentForm = ({
16564
16591
  addressPreference,
16565
16592
  charsetWarning,
16566
16593
  handleChangeAddress,
16567
- handleParseShipTo
16594
+ handleParseShipTo,
16595
+ parseAddressErrors,
16596
+ resetParseAddress
16568
16597
  } = useAddress({
16569
16598
  compatibleCountryCodes,
16570
16599
  onChange: React.useCallback((oldShipment, updatedShipment) => __awaiter(void 0, void 0, void 0, function* () {
@@ -16622,6 +16651,8 @@ const useShipmentForm = ({
16622
16651
  onSubmit: handleSubmit,
16623
16652
  onSubmitParseShipTo: handleParseShipTo,
16624
16653
  onUpdateCustoms: handleUpdateCustoms,
16654
+ parseAddressErrors,
16655
+ resetParseAddress,
16625
16656
  resetSalesOrderShipment,
16626
16657
  salesOrder,
16627
16658
  shipment,
package/index.js CHANGED
@@ -8873,10 +8873,12 @@ const addressParserSchema = z.object({
8873
8873
  });
8874
8874
 
8875
8875
  const AddressParser = ({
8876
+ errors: parseErrors,
8876
8877
  formId,
8877
8878
  onCancel,
8878
8879
  onSubmit,
8879
- portalRef
8880
+ portalRef,
8881
+ reset
8880
8882
  }) => {
8881
8883
  const {
8882
8884
  t
@@ -8888,20 +8890,26 @@ const AddressParser = ({
8888
8890
  const payload = values;
8889
8891
  onSubmit(payload);
8890
8892
  }));
8893
+ const errors = (parseErrors === null || parseErrors === void 0 ? void 0 : parseErrors.length) ? [t("errorMessages.parsingFailure")] : undefined;
8891
8894
  const formInterface = jsxs(Fragment, {
8892
8895
  children: [jsx(TextArea, {
8893
8896
  control: form.control,
8897
+ errors: errors,
8894
8898
  form: formId,
8895
8899
  label: t("address.parserFields.fullAddress"),
8896
8900
  labelWeight: "normal",
8897
8901
  name: "fullAddress",
8902
+ nativeLabel: true,
8898
8903
  rows: 4
8899
8904
  }), jsxs(ButtonGroup, Object.assign({
8900
8905
  justify: "end"
8901
8906
  }, {
8902
8907
  children: [onCancel && jsx(Button, Object.assign({
8903
8908
  bold: false,
8904
- onClick: onCancel,
8909
+ onClick: () => {
8910
+ onCancel();
8911
+ reset && reset();
8912
+ },
8905
8913
  type: "button",
8906
8914
  variant: ButtonVariant.TEXT
8907
8915
  }, {
@@ -9195,7 +9203,9 @@ const AddressForm = ({
9195
9203
  onCancelParse,
9196
9204
  onSubmit,
9197
9205
  onSubmitParse,
9198
- portalRef
9206
+ parseAddressErrors,
9207
+ portalRef,
9208
+ resetParseAddress
9199
9209
  }) => {
9200
9210
  const {
9201
9211
  t
@@ -9218,9 +9228,11 @@ const AddressForm = ({
9218
9228
  });
9219
9229
  }), [form, onSubmitParse]);
9220
9230
  const [addressParser, isAddressParserOpen, toggleIsAddressParserOpen] = useNestedForm(AddressParser, {
9231
+ errors: parseAddressErrors,
9221
9232
  formId: `${formId !== null && formId !== void 0 ? formId : ""}-address-parser`,
9222
9233
  onCancel: onCancelParse,
9223
- onSubmit: handleSubmitParse
9234
+ onSubmit: handleSubmitParse,
9235
+ reset: resetParseAddress
9224
9236
  });
9225
9237
  const formInterface = jsxs("div", Object.assign({
9226
9238
  css: theme => ({
@@ -10544,11 +10556,10 @@ const styles$f = createStyles({
10544
10556
  display: "flex",
10545
10557
  flexDirection: "column"
10546
10558
  },
10547
- icon: theme => ({
10548
- padding: `${theme.spacing(0.4)}px 0 0 ${theme.spacing(0.5)}px`,
10549
- position: "absolute"
10550
- }),
10551
10559
  link: {
10560
+ "&:visited": {
10561
+ color: "#006fbb"
10562
+ },
10552
10563
  border: "none"
10553
10564
  },
10554
10565
  links: theme => ({
@@ -10575,6 +10586,11 @@ const styles$f = createStyles({
10575
10586
  paddingBottom: theme.spacing(8),
10576
10587
  paddingTop: theme.spacing(2)
10577
10588
  }),
10589
+ termsLink: theme => ({
10590
+ alignItems: "center",
10591
+ display: "inline-flex",
10592
+ fontWeight: theme.typography.fontWeight.normal
10593
+ }),
10578
10594
  termsList: {
10579
10595
  listStyle: "none"
10580
10596
  },
@@ -11150,14 +11166,11 @@ const CarrierTermsForm = ({
11150
11166
  checkboxLabel: jsx(Trans, {
11151
11167
  components: {
11152
11168
  icon: jsx(Icon, {
11153
- css: styles$f.icon,
11154
11169
  name: showTerms ? IconNames.CHEVRON_TOP : IconNames.CHEVRON_BOTTOM,
11155
11170
  size: IconSize.SIZE_SMALL
11156
11171
  }),
11157
11172
  terms: jsx(Link, {
11158
- css: theme => ({
11159
- fontWeight: theme.typography.fontWeight.normal
11160
- }),
11173
+ css: styles$f.termsLink,
11161
11174
  "data-testid": "terms-link",
11162
11175
  onClick: e => {
11163
11176
  e.preventDefault();
@@ -13786,6 +13799,8 @@ const ShipmentForm = ({
13786
13799
  onSubmitParseShipTo,
13787
13800
  onToggleAddressPreferenceDisclosure,
13788
13801
  onUpdateCustoms,
13802
+ parseAddressErrors,
13803
+ resetParseAddress,
13789
13804
  salesOrder,
13790
13805
  shipment,
13791
13806
  shippingPresets,
@@ -14065,7 +14080,9 @@ const ShipmentForm = ({
14065
14080
  address: (_b = (_a = addressPreference === null || addressPreference === void 0 ? void 0 : addressPreference.selection) !== null && _a !== void 0 ? _a : shipment === null || shipment === void 0 ? void 0 : shipment.shipTo) !== null && _b !== void 0 ? _b : salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.shipTo,
14066
14081
  formId: "edit-ship-to-form",
14067
14082
  onSubmit: handleSubmitEditShipTo,
14068
- onSubmitParse: onSubmitParseShipTo
14083
+ onSubmitParse: onSubmitParseShipTo,
14084
+ parseAddressErrors,
14085
+ resetParseAddress
14069
14086
  });
14070
14087
  const handleUpdateCustomsItems = useCallback(customsItems => __awaiter(void 0, void 0, void 0, function* () {
14071
14088
  const result = yield onUpdateCustoms === null || onUpdateCustoms === void 0 ? void 0 : onUpdateCustoms({
@@ -15335,6 +15352,7 @@ var common = {
15335
15352
  },
15336
15353
  errorMessages: {
15337
15354
  invalidNameOrCompany: "Recipient name and company name (if provided) must have two characters in first and last name.",
15355
+ parsingFailure: "Parsing failed. Please check address and try again.",
15338
15356
  noWarehouses: "You must have an active Ship From Location to use this feature.",
15339
15357
  unableToLoad: {
15340
15358
  accountSettings: "Unable to load account settings",
@@ -15975,13 +15993,16 @@ const useAddress = ({
15975
15993
  } = useUpdateSalesOrderShipment();
15976
15994
  const {
15977
15995
  error: parseAddressErrors,
15978
- mutateAsync: parseAddress
15996
+ mutateAsync: parseAddress,
15997
+ reset: resetParseAddress
15979
15998
  } = useParseAddress();
15980
15999
  const [addressPreference, _setAddressPreference] = useState();
15981
16000
  const [loading, setLoading] = useState(true);
15982
16001
  const setAddressPreference = useCallback((...args) => {
15983
- setLoading(false);
15984
16002
  _setAddressPreference(...args);
16003
+ if (args.length > 0 && args[0]) {
16004
+ setLoading(false);
16005
+ }
15985
16006
  }, [_setAddressPreference]);
15986
16007
  const toggle = useCallback(() => {
15987
16008
  let updatedSelection = undefined;
@@ -16108,14 +16129,16 @@ const useAddress = ({
16108
16129
  title: t("charsetWarnings.address.title")
16109
16130
  };
16110
16131
  }, undefined), [addressPreference === null || addressPreference === void 0 ? void 0 : addressPreference.selection, t]);
16111
- const errors = [...(validateAddressErrors !== null && validateAddressErrors !== void 0 ? validateAddressErrors : []), ...(updateShipmentErrors !== null && updateShipmentErrors !== void 0 ? updateShipmentErrors : []), ...(parseAddressErrors !== null && parseAddressErrors !== void 0 ? parseAddressErrors : [])];
16132
+ const errors = [...(validateAddressErrors !== null && validateAddressErrors !== void 0 ? validateAddressErrors : []), ...(updateShipmentErrors !== null && updateShipmentErrors !== void 0 ? updateShipmentErrors : [])];
16112
16133
  return {
16113
- addressLoading: loading,
16114
16134
  addressErrors: errors.length > 0 ? errors : undefined,
16135
+ addressLoading: loading,
16115
16136
  addressPreference,
16116
16137
  charsetWarning,
16117
16138
  handleChangeAddress,
16118
- handleParseShipTo
16139
+ handleParseShipTo,
16140
+ parseAddressErrors: parseAddressErrors !== null && parseAddressErrors !== void 0 ? parseAddressErrors : undefined,
16141
+ resetParseAddress
16119
16142
  };
16120
16143
  };
16121
16144
 
@@ -16211,6 +16234,9 @@ const useScrubErrors = ({
16211
16234
  var usps_first_class_mail = [
16212
16235
  "First Class Mail shipments must weigh less than {{weight}} oz. Shipments exceeding the weight entered when buying the label will be charged an adjustment fee by USPS."
16213
16236
  ];
16237
+ var usps_ground_advantage = [
16238
+ "USPS Ground Advantage™ service is an affordable and reliable way to send packages inside the U.S. expected in 2–5 business days for items up to 70 lbs."
16239
+ ];
16214
16240
  var usps_media_mail = [
16215
16241
  "Media Mail® can only be used for shipping books, sound recordings, manuscripts, printed music, and other media in packages weighing 70 lbs. or less. Packages containing unsupported items may be subject to post-billing adjustment fees or returned to the sender."
16216
16242
  ];
@@ -16252,6 +16278,7 @@ var rateMessages = {
16252
16278
  "Tracking and refunds are not available for First Class Mail Large Envelopes or Flats labels."
16253
16279
  ],
16254
16280
  usps_first_class_mail: usps_first_class_mail,
16281
+ usps_ground_advantage: usps_ground_advantage,
16255
16282
  usps_media_mail: usps_media_mail,
16256
16283
  usps_parcel_select: usps_parcel_select,
16257
16284
  usps_priority_mail: usps_priority_mail,
@@ -16532,7 +16559,9 @@ const useShipmentForm = ({
16532
16559
  addressPreference,
16533
16560
  charsetWarning,
16534
16561
  handleChangeAddress,
16535
- handleParseShipTo
16562
+ handleParseShipTo,
16563
+ parseAddressErrors,
16564
+ resetParseAddress
16536
16565
  } = useAddress({
16537
16566
  compatibleCountryCodes,
16538
16567
  onChange: useCallback((oldShipment, updatedShipment) => __awaiter(void 0, void 0, void 0, function* () {
@@ -16590,6 +16619,8 @@ const useShipmentForm = ({
16590
16619
  onSubmit: handleSubmit,
16591
16620
  onSubmitParseShipTo: handleParseShipTo,
16592
16621
  onUpdateCustoms: handleUpdateCustoms,
16622
+ parseAddressErrors,
16623
+ resetParseAddress,
16593
16624
  resetSalesOrderShipment,
16594
16625
  salesOrder,
16595
16626
  shipment,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/elements",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "typedoc": {
5
5
  "entryPoint": "./src/index.ts",
6
6
  "readmeFile": "../../README.md",
@@ -8,6 +8,8 @@ export type AddressFormProps<T = undefined> = {
8
8
  onCancelParse?: () => void;
9
9
  onSubmit: (payload: SE.Address) => void;
10
10
  onSubmitParse?: (payload: AddressParserPayload) => Promise<SE.AddressExtraction | undefined>;
11
+ parseAddressErrors?: SE.CodedError[];
12
+ resetParseAddress?: () => void;
11
13
  } & ({
12
14
  formId: string;
13
15
  portalRef: React.RefObject<T>;
@@ -15,4 +17,4 @@ export type AddressFormProps<T = undefined> = {
15
17
  formId?: string;
16
18
  portalRef?: never;
17
19
  });
18
- export declare const AddressForm: <T extends Element>({ address, domestic, formId, onCancel, onCancelParse, onSubmit, onSubmitParse, portalRef, }: AddressFormProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
20
+ export declare const AddressForm: <T extends Element>({ address, domestic, formId, onCancel, onCancelParse, onSubmit, onSubmitParse, parseAddressErrors, portalRef, resetParseAddress, }: AddressFormProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,8 +1,11 @@
1
1
  /// <reference types="react" />
2
+ import { SE } from "@shipengine/js-api";
2
3
  import { AddressParserPayload } from "./address-parser-schema";
3
4
  export type AddressParserProps<T = undefined> = {
5
+ errors?: SE.CodedError[];
4
6
  onCancel?: () => void;
5
7
  onSubmit: (payload: AddressParserPayload) => void;
8
+ reset?: () => void;
6
9
  } & ({
7
10
  formId: string;
8
11
  portalRef: React.RefObject<T>;
@@ -10,4 +13,4 @@ export type AddressParserProps<T = undefined> = {
10
13
  formId?: string;
11
14
  portalRef?: never;
12
15
  });
13
- export declare const AddressParser: <T extends Element>({ formId, onCancel, onSubmit, portalRef, }: AddressParserProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
16
+ export declare const AddressParser: <T extends Element>({ errors: parseErrors, formId, onCancel, onSubmit, portalRef, reset, }: AddressParserProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -18,11 +18,10 @@ export declare const styles: {
18
18
  display: "flex";
19
19
  flexDirection: "column";
20
20
  };
21
- icon: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
22
- padding: string;
23
- position: "absolute";
24
- };
25
21
  link: {
22
+ "&:visited": {
23
+ color: "#006fbb";
24
+ };
26
25
  border: string;
27
26
  };
28
27
  links: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
@@ -49,6 +48,11 @@ export declare const styles: {
49
48
  paddingBottom: number;
50
49
  paddingTop: number;
51
50
  };
51
+ termsLink: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
52
+ alignItems: "center";
53
+ display: "inline-flex";
54
+ fontWeight: number;
55
+ };
52
56
  termsList: {
53
57
  listStyle: "none";
54
58
  };
@@ -31,6 +31,8 @@ export type ShipmentFormProps = {
31
31
  onSubmitParseShipTo: (payload: AddressParserPayload) => Promise<SE.AddressExtraction | undefined>;
32
32
  onToggleAddressPreferenceDisclosure?: AddressPreferenceDisplayProps["onToggleDisclosure"];
33
33
  onUpdateCustoms?: (customs: SE.Customs) => Promise<SE.SalesOrderShipment | undefined>;
34
+ parseAddressErrors?: SE.CodedError[];
35
+ resetParseAddress?: () => void;
34
36
  salesOrder?: SE.SalesOrder;
35
37
  shipment?: SE.SalesOrderShipment;
36
38
  shippingPresets?: UseShippingPresetsOptionsProps;
@@ -49,4 +51,4 @@ export type ShipmentFormFeatures = {
49
51
  selectService?: boolean;
50
52
  shippingPresets?: boolean;
51
53
  };
52
- export declare const ShipmentForm: ({ addressLoading, addressPreference, charsetWarning, carriers, customPackageTypes, errors, features, hydrateRef, insuranceAccount, isLoading, onApplyPreset, onChangeAddress, onChangeMode, onDirty, onSubmit, onSubmitParseShipTo, onToggleAddressPreferenceDisclosure, onUpdateCustoms, salesOrder, shipment, shippingPresets, warehouseId, warehouses, }: ShipmentFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
54
+ export declare const ShipmentForm: ({ addressLoading, addressPreference, charsetWarning, carriers, customPackageTypes, errors, features, hydrateRef, insuranceAccount, isLoading, onApplyPreset, onChangeAddress, onChangeMode, onDirty, onSubmit, onSubmitParseShipTo, onToggleAddressPreferenceDisclosure, onUpdateCustoms, parseAddressErrors, resetParseAddress, salesOrder, shipment, shippingPresets, warehouseId, warehouses, }: ShipmentFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -488,6 +488,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
488
488
  };
489
489
  errorMessages: {
490
490
  invalidNameOrCompany: string;
491
+ parsingFailure: string;
491
492
  noWarehouses: string;
492
493
  unableToLoad: {
493
494
  accountSettings: string;
@@ -9,10 +9,12 @@ export type UseAddressProps = {
9
9
  shipment?: SE.SalesOrderShipment;
10
10
  };
11
11
  export declare const useAddress: ({ compatibleCountryCodes, onChange, onValidation, salesOrder, shipment, }: UseAddressProps) => {
12
- addressLoading: boolean;
13
12
  addressErrors: SE.CodedError[] | undefined;
13
+ addressLoading: boolean;
14
14
  addressPreference: Templates.AddressPreference | undefined;
15
15
  charsetWarning: Templates.CharsetWarning | undefined;
16
16
  handleChangeAddress: (shipTo: SE.Address, { shouldValidate }: Templates.OnChangeAddressOptions) => Promise<SE.SalesOrderShipment>;
17
17
  handleParseShipTo: ({ fullAddress }: Templates.AddressParserPayload) => Promise<SE.AddressExtraction>;
18
+ parseAddressErrors: SE.CodedError[] | undefined;
19
+ resetParseAddress: () => void;
18
20
  };
@@ -27,6 +27,8 @@ export declare const useShipmentForm: ({ compatibleCountryCodes, onAddressValida
27
27
  fullAddress: string;
28
28
  }) => Promise<SE.AddressExtraction>;
29
29
  onUpdateCustoms: (customs: SE.Customs) => Promise<SE.SalesOrderShipment>;
30
+ parseAddressErrors: SE.CodedError[] | undefined;
31
+ resetParseAddress: () => void;
30
32
  resetSalesOrderShipment: () => void;
31
33
  salesOrder: SE.SalesOrder | undefined;
32
34
  shipment: SE.SalesOrderShipment | undefined;
@@ -490,6 +490,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
490
490
  };
491
491
  errorMessages: {
492
492
  invalidNameOrCompany: string;
493
+ parsingFailure: string;
493
494
  noWarehouses: string;
494
495
  unableToLoad: {
495
496
  accountSettings: string;
@@ -509,6 +509,7 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
509
509
  };
510
510
  errorMessages: {
511
511
  invalidNameOrCompany: string;
512
+ parsingFailure: string;
512
513
  noWarehouses: string;
513
514
  unableToLoad: {
514
515
  accountSettings: string;
@@ -494,6 +494,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
494
494
  };
495
495
  errorMessages: {
496
496
  invalidNameOrCompany: string;
497
+ parsingFailure: string;
497
498
  noWarehouses: string;
498
499
  unableToLoad: {
499
500
  accountSettings: string;
@@ -497,6 +497,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
497
497
  };
498
498
  errorMessages: {
499
499
  invalidNameOrCompany: string;
500
+ parsingFailure: string;
500
501
  noWarehouses: string;
501
502
  unableToLoad: {
502
503
  accountSettings: string;
@@ -481,6 +481,7 @@ declare const _default: {
481
481
  };
482
482
  errorMessages: {
483
483
  invalidNameOrCompany: string;
484
+ parsingFailure: string;
484
485
  noWarehouses: string;
485
486
  unableToLoad: {
486
487
  accountSettings: string;