@shipengine/elements 0.30.0 → 0.32.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/elements",
3
- "version": "0.30.0",
3
+ "version": "0.32.0",
4
4
  "typedoc": {
5
5
  "entryPoint": "./src/index.ts",
6
6
  "readmeFile": "../../README.md",
@@ -4,3 +4,4 @@ export declare const getContainerStyles: (theme: Theme) => SerializedStyles;
4
4
  export declare const getDimensionStyles: (theme: Theme) => SerializedStyles;
5
5
  export declare const getServiceNameStyles: (theme: Theme) => SerializedStyles;
6
6
  export declare const getPresetNameStyles: (theme: Theme) => SerializedStyles;
7
+ export declare const getWarningStyles: (theme: Theme) => SerializedStyles;
@@ -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;
@@ -71,6 +71,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
71
71
  sections: {
72
72
  labels: string;
73
73
  };
74
+ noLabels: string;
74
75
  };
75
76
  "register-wallet": {
76
77
  sections: {
@@ -488,6 +489,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
488
489
  };
489
490
  errorMessages: {
490
491
  invalidNameOrCompany: string;
492
+ parsingFailure: string;
491
493
  noWarehouses: string;
492
494
  unableToLoad: {
493
495
  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;
@@ -73,6 +73,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
73
73
  sections: {
74
74
  labels: string;
75
75
  };
76
+ noLabels: string;
76
77
  };
77
78
  "register-wallet": {
78
79
  sections: {
@@ -490,6 +491,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
490
491
  };
491
492
  errorMessages: {
492
493
  invalidNameOrCompany: string;
494
+ parsingFailure: string;
493
495
  noWarehouses: string;
494
496
  unableToLoad: {
495
497
  accountSettings: string;
@@ -92,6 +92,7 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
92
92
  sections: {
93
93
  labels: string;
94
94
  };
95
+ noLabels: string;
95
96
  };
96
97
  "register-wallet": {
97
98
  sections: {
@@ -509,6 +510,7 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
509
510
  };
510
511
  errorMessages: {
511
512
  invalidNameOrCompany: string;
513
+ parsingFailure: string;
512
514
  noWarehouses: string;
513
515
  unableToLoad: {
514
516
  accountSettings: string;
@@ -77,6 +77,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
77
77
  sections: {
78
78
  labels: string;
79
79
  };
80
+ noLabels: string;
80
81
  };
81
82
  "register-wallet": {
82
83
  sections: {
@@ -494,6 +495,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
494
495
  };
495
496
  errorMessages: {
496
497
  invalidNameOrCompany: string;
498
+ parsingFailure: string;
497
499
  noWarehouses: string;
498
500
  unableToLoad: {
499
501
  accountSettings: string;
@@ -80,6 +80,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
80
80
  sections: {
81
81
  labels: string;
82
82
  };
83
+ noLabels: string;
83
84
  };
84
85
  "register-wallet": {
85
86
  sections: {
@@ -497,6 +498,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
497
498
  };
498
499
  errorMessages: {
499
500
  invalidNameOrCompany: string;
501
+ parsingFailure: string;
500
502
  noWarehouses: string;
501
503
  unableToLoad: {
502
504
  accountSettings: string;
@@ -64,6 +64,7 @@ declare const _default: {
64
64
  sections: {
65
65
  labels: string;
66
66
  };
67
+ noLabels: string;
67
68
  };
68
69
  "register-wallet": {
69
70
  sections: {
@@ -481,6 +482,7 @@ declare const _default: {
481
482
  };
482
483
  errorMessages: {
483
484
  invalidNameOrCompany: string;
485
+ parsingFailure: string;
484
486
  noWarehouses: string;
485
487
  unableToLoad: {
486
488
  accountSettings: string;