@shipengine/elements 0.29.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/elements",
3
- "version": "0.29.0",
3
+ "version": "0.31.0",
4
4
  "typedoc": {
5
5
  "entryPoint": "./src/index.ts",
6
6
  "readmeFile": "../../README.md",
@@ -30,8 +30,8 @@
30
30
  "@jest/globals": "28.1.3",
31
31
  "@packlink/brands": "3.24.0",
32
32
  "@packlink/giger-theme": "1.3.1",
33
- "@shipengine/alchemy": "0.5.1",
34
- "@shipengine/js-api": "0.14.1",
33
+ "@shipengine/alchemy": "0.5.14",
34
+ "@shipengine/js-api": "0.19.1",
35
35
  "@storybook/addons": "6.5.16",
36
36
  "@storybook/components": "7.0.0-rc.1",
37
37
  "@storybook/core-events": "7.0.0-rc.1",
@@ -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
  };
@@ -1,7 +1,6 @@
1
1
  import { SE } from "@shipengine/alchemy";
2
2
  export type EditBillingFormProps = {
3
- fundingSources?: SE.FundingSource[];
4
3
  onCancel: () => void;
5
4
  onSubmit: (billingInfo: SE.FundingSourceAddress, creditCardInfo: SE.CreditCardInfo) => void;
6
5
  };
7
- export declare const EditBillingForm: ({ fundingSources, onCancel, onSubmit }: EditBillingFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
6
+ export declare const EditBillingForm: ({ onCancel, onSubmit }: EditBillingFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -22,7 +22,9 @@ export type OnboardingFeatures = {
22
22
  };
23
23
  export type OnboardingProps = {
24
24
  connectedCarriers: SE.Carrier[];
25
- createFundingSource: (payload: SE.CreateFundingSource) => Promise<SE.CreateFundingSourceResponse>;
25
+ createFundingSource: (payload: SE.CreateFundingSource) => Promise<{
26
+ fundingSource: SE.FundingSource;
27
+ }>;
26
28
  createFundingSourceErrors: SE.CodedError[] | null;
27
29
  createWarehouse: (payload: Partial<SE.Warehouse>) => Promise<SE.Warehouse>;
28
30
  features?: OnboardingFeatures;
@@ -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;
@@ -1,4 +1,6 @@
1
+ import { SE } from "@shipengine/alchemy";
1
2
  export type WalletCardProps = {
3
+ fundingSource?: SE.FundingSource;
2
4
  onEdit: () => void;
3
5
  };
4
- export declare const WalletCard: ({ onEdit }: WalletCardProps) => import("@emotion/react/jsx-runtime").JSX.Element;
6
+ export declare const WalletCard: ({ fundingSource, onEdit }: WalletCardProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { CreditCardVendor } from "@shipengine/alchemy";
2
+ import { Provider } from "@shipengine/alchemy";
3
3
  export declare const billingAddressSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<z.extendShape<{
4
4
  addressLine1: z.ZodString;
5
5
  addressLine2: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodString>>, string | undefined, string | null | undefined>;
@@ -14,6 +14,7 @@ export declare const billingAddressSchema: z.ZodEffects<z.ZodEffects<z.ZodEffect
14
14
  addressLine1: z.ZodEffects<z.ZodString, string, string>;
15
15
  addressLine2: z.ZodEffects<z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodString>>, string | undefined, string | null | undefined>, string | undefined, string | null | undefined>;
16
16
  companyName: z.ZodString;
17
+ email: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodString>>, string, string | null | undefined>;
17
18
  phone: z.ZodString;
18
19
  }>, "strip", z.ZodTypeAny, {
19
20
  addressLine2?: string | undefined;
@@ -25,9 +26,11 @@ export declare const billingAddressSchema: z.ZodEffects<z.ZodEffects<z.ZodEffect
25
26
  phone: string;
26
27
  postalCode: string;
27
28
  stateProvince: string;
29
+ email: string;
28
30
  }, {
29
31
  addressLine2?: string | null | undefined;
30
32
  stateProvince?: string | null | undefined;
33
+ email?: string | null | undefined;
31
34
  addressLine1: string;
32
35
  cityLocality: string;
33
36
  companyName: string;
@@ -45,9 +48,11 @@ export declare const billingAddressSchema: z.ZodEffects<z.ZodEffects<z.ZodEffect
45
48
  phone: string;
46
49
  postalCode: string;
47
50
  stateProvince: string;
51
+ email: string;
48
52
  }, {
49
53
  addressLine2?: string | null | undefined;
50
54
  stateProvince?: string | null | undefined;
55
+ email?: string | null | undefined;
51
56
  addressLine1: string;
52
57
  cityLocality: string;
53
58
  companyName: string;
@@ -65,9 +70,11 @@ export declare const billingAddressSchema: z.ZodEffects<z.ZodEffects<z.ZodEffect
65
70
  phone: string;
66
71
  postalCode: string;
67
72
  stateProvince: string;
73
+ email: string;
68
74
  }, {
69
75
  addressLine2?: string | null | undefined;
70
76
  stateProvince?: string | null | undefined;
77
+ email?: string | null | undefined;
71
78
  addressLine1: string;
72
79
  cityLocality: string;
73
80
  companyName: string;
@@ -85,9 +92,11 @@ export declare const billingAddressSchema: z.ZodEffects<z.ZodEffects<z.ZodEffect
85
92
  phone: string;
86
93
  postalCode: string;
87
94
  stateProvince: string;
95
+ email: string;
88
96
  }, {
89
97
  addressLine2?: string | null | undefined;
90
98
  stateProvince?: string | null | undefined;
99
+ email?: string | null | undefined;
91
100
  addressLine1: string;
92
101
  cityLocality: string;
93
102
  companyName: string;
@@ -113,6 +122,7 @@ export declare const walletSchema: z.ZodObject<{
113
122
  addressLine1: z.ZodEffects<z.ZodString, string, string>;
114
123
  addressLine2: z.ZodEffects<z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodString>>, string | undefined, string | null | undefined>, string | undefined, string | null | undefined>;
115
124
  companyName: z.ZodString;
125
+ email: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodString>>, string, string | null | undefined>;
116
126
  phone: z.ZodString;
117
127
  }>, "strip", z.ZodTypeAny, {
118
128
  addressLine2?: string | undefined;
@@ -124,9 +134,11 @@ export declare const walletSchema: z.ZodObject<{
124
134
  phone: string;
125
135
  postalCode: string;
126
136
  stateProvince: string;
137
+ email: string;
127
138
  }, {
128
139
  addressLine2?: string | null | undefined;
129
140
  stateProvince?: string | null | undefined;
141
+ email?: string | null | undefined;
130
142
  addressLine1: string;
131
143
  cityLocality: string;
132
144
  companyName: string;
@@ -144,9 +156,11 @@ export declare const walletSchema: z.ZodObject<{
144
156
  phone: string;
145
157
  postalCode: string;
146
158
  stateProvince: string;
159
+ email: string;
147
160
  }, {
148
161
  addressLine2?: string | null | undefined;
149
162
  stateProvince?: string | null | undefined;
163
+ email?: string | null | undefined;
150
164
  addressLine1: string;
151
165
  cityLocality: string;
152
166
  companyName: string;
@@ -164,9 +178,11 @@ export declare const walletSchema: z.ZodObject<{
164
178
  phone: string;
165
179
  postalCode: string;
166
180
  stateProvince: string;
181
+ email: string;
167
182
  }, {
168
183
  addressLine2?: string | null | undefined;
169
184
  stateProvince?: string | null | undefined;
185
+ email?: string | null | undefined;
170
186
  addressLine1: string;
171
187
  cityLocality: string;
172
188
  companyName: string;
@@ -184,9 +200,11 @@ export declare const walletSchema: z.ZodObject<{
184
200
  phone: string;
185
201
  postalCode: string;
186
202
  stateProvince: string;
203
+ email: string;
187
204
  }, {
188
205
  addressLine2?: string | null | undefined;
189
206
  stateProvince?: string | null | undefined;
207
+ email?: string | null | undefined;
190
208
  addressLine1: string;
191
209
  cityLocality: string;
192
210
  companyName: string;
@@ -216,7 +234,7 @@ export declare const walletSchema: z.ZodObject<{
216
234
  expirationMonth: number;
217
235
  expirationYear: number;
218
236
  name: string;
219
- provider: CreditCardVendor;
237
+ provider: Provider;
220
238
  }, {
221
239
  number: string;
222
240
  name: string;
@@ -234,6 +252,7 @@ export declare const walletSchema: z.ZodObject<{
234
252
  phone: string;
235
253
  postalCode: string;
236
254
  stateProvince: string;
255
+ email: string;
237
256
  };
238
257
  creditCard: {
239
258
  cardNumber: string;
@@ -241,12 +260,13 @@ export declare const walletSchema: z.ZodObject<{
241
260
  expirationMonth: number;
242
261
  expirationYear: number;
243
262
  name: string;
244
- provider: CreditCardVendor;
263
+ provider: Provider;
245
264
  };
246
265
  }, {
247
266
  address: {
248
267
  addressLine2?: string | null | undefined;
249
268
  stateProvince?: string | null | undefined;
269
+ email?: string | null | undefined;
250
270
  addressLine1: string;
251
271
  cityLocality: string;
252
272
  companyName: string;
@@ -212,6 +212,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
212
212
  shipment: string;
213
213
  rate_one: string;
214
214
  rate_other: string;
215
+ payment: string;
215
216
  };
216
217
  };
217
218
  "payment-method": {
@@ -487,6 +488,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
487
488
  };
488
489
  errorMessages: {
489
490
  invalidNameOrCompany: string;
491
+ parsingFailure: string;
490
492
  noWarehouses: string;
491
493
  unableToLoad: {
492
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;
@@ -214,6 +214,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
214
214
  shipment: string;
215
215
  rate_one: string;
216
216
  rate_other: string;
217
+ payment: string;
217
218
  };
218
219
  };
219
220
  "payment-method": {
@@ -489,6 +490,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
489
490
  };
490
491
  errorMessages: {
491
492
  invalidNameOrCompany: string;
493
+ parsingFailure: string;
492
494
  noWarehouses: string;
493
495
  unableToLoad: {
494
496
  accountSettings: string;
@@ -233,6 +233,7 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
233
233
  shipment: string;
234
234
  rate_one: string;
235
235
  rate_other: string;
236
+ payment: string;
236
237
  };
237
238
  };
238
239
  "payment-method": {
@@ -508,6 +509,7 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
508
509
  };
509
510
  errorMessages: {
510
511
  invalidNameOrCompany: string;
512
+ parsingFailure: string;
511
513
  noWarehouses: string;
512
514
  unableToLoad: {
513
515
  accountSettings: string;
@@ -218,6 +218,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
218
218
  shipment: string;
219
219
  rate_one: string;
220
220
  rate_other: string;
221
+ payment: string;
221
222
  };
222
223
  };
223
224
  "payment-method": {
@@ -493,6 +494,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
493
494
  };
494
495
  errorMessages: {
495
496
  invalidNameOrCompany: string;
497
+ parsingFailure: string;
496
498
  noWarehouses: string;
497
499
  unableToLoad: {
498
500
  accountSettings: string;
@@ -221,6 +221,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
221
221
  shipment: string;
222
222
  rate_one: string;
223
223
  rate_other: string;
224
+ payment: string;
224
225
  };
225
226
  };
226
227
  "payment-method": {
@@ -496,6 +497,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
496
497
  };
497
498
  errorMessages: {
498
499
  invalidNameOrCompany: string;
500
+ parsingFailure: string;
499
501
  noWarehouses: string;
500
502
  unableToLoad: {
501
503
  accountSettings: string;
@@ -205,6 +205,7 @@ declare const _default: {
205
205
  shipment: string;
206
206
  rate_one: string;
207
207
  rate_other: string;
208
+ payment: string;
208
209
  };
209
210
  };
210
211
  "payment-method": {
@@ -480,6 +481,7 @@ declare const _default: {
480
481
  };
481
482
  errorMessages: {
482
483
  invalidNameOrCompany: string;
484
+ parsingFailure: string;
483
485
  noWarehouses: string;
484
486
  unableToLoad: {
485
487
  accountSettings: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { prettyFormat as __ } from "@testing-library/dom/types/pretty-dom";
2
3
  import { UserEvent } from "@testing-library/user-event/dist/types/setup/setup";
3
4
  import { IconNames, Theme } from "@packlink/giger-theme";