@shipengine/elements 0.21.5 → 0.23.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 +427 -245
- package/index.js +427 -248
- package/package.json +4 -3
- package/src/components/copy/copy-button.d.ts +7 -0
- package/src/components/copy/index.d.ts +1 -0
- package/src/components/field/field.styles.d.ts +6 -0
- package/src/components/field/rate-card/rate-card.d.ts +2 -1
- package/src/components/field/rate-card/rate-card.styles.d.ts +1 -0
- package/src/components/field/switch/switch.d.ts +1 -1
- package/src/components/index.d.ts +1 -0
- package/src/components/items-breakdown/items-breakdown.styles.d.ts +1 -3
- package/src/components/link-action/link-action.d.ts +2 -0
- package/src/components/templates/address-form/address-form.d.ts +1 -1
- package/src/components/templates/label/label.styles.d.ts +1 -0
- package/src/components/templates/shipment-form/shipment-form.d.ts +1 -1
- package/src/components/templates/shipment-form/shipment-schema.d.ts +56 -18
- package/src/elements/configure-shipment/hooks/index.d.ts +1 -0
- package/src/elements/configure-shipment/hooks/use-rates-form.d.ts +2 -2
- package/src/elements/configure-shipment/hooks/use-rates-with-cache.d.ts +30 -0
- package/src/elements/list-carriers/list-carriers.d.ts +3 -3
- package/src/elements/manage-warehouses/manage-warehouses.d.ts +3 -3
- package/src/elements/onboarding/onboarding.d.ts +3 -3
- package/src/elements/purchase-label/purchase-label.d.ts +3 -3
- package/src/elements/view-shipment/view-shipment.d.ts +3 -3
- package/src/elements/void-label/void-label.d.ts +3 -3
- package/src/locales/en/index.d.ts +3 -3
- package/src/mocks/warehouses/handlers.d.ts +2 -0
- package/src/utilities/date.d.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipengine/elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"typedoc": {
|
|
5
5
|
"entryPoint": "./src/index.ts",
|
|
6
6
|
"readmeFile": "../../README.md",
|
|
@@ -29,12 +29,13 @@
|
|
|
29
29
|
"@hookform/resolvers": "2.9.1",
|
|
30
30
|
"@packlink/brands": "3.24.0",
|
|
31
31
|
"@packlink/giger-theme": "1.3.1",
|
|
32
|
-
"@shipengine/alchemy": "0.4.
|
|
33
|
-
"@shipengine/js-api": "0.
|
|
32
|
+
"@shipengine/alchemy": "0.4.13",
|
|
33
|
+
"@shipengine/js-api": "0.7.0",
|
|
34
34
|
"@storybook/manager-api": "7.0.0-rc.1",
|
|
35
35
|
"@storybook/theming": "7.0.0-rc.1",
|
|
36
36
|
"axios": "0.26.1",
|
|
37
37
|
"card-validator": "8.1.1",
|
|
38
|
+
"copy-to-clipboard": "3.3.3",
|
|
38
39
|
"humps": "2.0.1",
|
|
39
40
|
"js-base64": "3.7.3",
|
|
40
41
|
"libphonenumber-js": "1.10.14",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./copy-button";
|
|
@@ -7,5 +7,6 @@ export type RateCardProps = Partial<RateOption> & WithCommonProps<{
|
|
|
7
7
|
recommended?: boolean;
|
|
8
8
|
selected?: boolean;
|
|
9
9
|
voided?: boolean;
|
|
10
|
+
voidedAt?: string;
|
|
10
11
|
}>;
|
|
11
|
-
export declare const RateCard: ({ carrierCode, carrierFriendlyName, carrierNickname, children, className, confirmationAmount, deliveryDays, insuranceAmount, isAcknowledged, messages, onClick, onClickAcknowledgement, otherAmount, rateId, recommended, requiresAcknowledgement, selected, serviceCode, serviceType, shippingAmount, taxAmount, voided, }: RateCardProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const RateCard: ({ carrierCode, carrierFriendlyName, carrierNickname, children, className, confirmationAmount, deliveryDays, insuranceAmount, isAcknowledged, messages, onClick, onClickAcknowledgement, otherAmount, rateId, recommended, requiresAcknowledgement, selected, serviceCode, serviceType, shippingAmount, taxAmount, voided, voidedAt, }: RateCardProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -19,3 +19,4 @@ export declare const getFooterListWithMultipleMessagesStyles: (theme: Theme) =>
|
|
|
19
19
|
export declare const getFooterListItemStyles: (theme: Theme) => SerializedStyles;
|
|
20
20
|
export declare const getAcknowledgmentStyles: (theme: Theme) => SerializedStyles;
|
|
21
21
|
export declare const getCheckboxWrapperStyles: () => SerializedStyles;
|
|
22
|
+
export declare const getTypographyVoidedStyles: () => SerializedStyles;
|
|
@@ -3,7 +3,7 @@ import { ISwitchProps } from "@packlink/giger";
|
|
|
3
3
|
export type SwitchProps = {
|
|
4
4
|
children?: React.ReactNode;
|
|
5
5
|
defaultChecked?: boolean;
|
|
6
|
-
label?:
|
|
6
|
+
label?: React.ReactNode;
|
|
7
7
|
shouldUnmount?: boolean;
|
|
8
8
|
} & Omit<ISwitchProps, "children">;
|
|
9
9
|
export declare const Switch: ({ defaultChecked, children, shouldUnmount, label, onChange, ...props }: SwitchProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -3,6 +3,7 @@ export * from "./add-funds-form";
|
|
|
3
3
|
export * from "./auto-funding-form";
|
|
4
4
|
export * from "./button-group";
|
|
5
5
|
export * from "./carrier-balance";
|
|
6
|
+
export * from "./copy";
|
|
6
7
|
export * from "./cube";
|
|
7
8
|
export * from "./date-range-combo";
|
|
8
9
|
export * from "./date-range-select";
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getNumericCellStyle: (theme: Theme) => import("@emotion/utils").SerializedStyles;
|
|
3
|
-
export declare const getTableWrapperStyles: (theme: Theme) => import("@emotion/utils").SerializedStyles;
|
|
1
|
+
export declare const styles: Record<"itemDetail" | "itemName" | "numericCell" | "tableWrapper", import("@emotion/serialize").Interpolation<import("@packlink/giger-theme/dist/lib/Theme").Theme>>;
|
|
@@ -2,6 +2,8 @@ import { ILinkProps } from "@packlink/giger";
|
|
|
2
2
|
import { IconNames } from "@packlink/giger-theme";
|
|
3
3
|
declare const icons: {
|
|
4
4
|
readonly add: IconNames.ADD;
|
|
5
|
+
readonly checkFilled: IconNames.CHECK_FILLED;
|
|
6
|
+
readonly copy: IconNames.COPY;
|
|
5
7
|
readonly download: IconNames.DOWNLOAD;
|
|
6
8
|
};
|
|
7
9
|
export type LinkActionProps = {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: Record<"trackingNumber" | "truncatedTrackingNumber", import("@emotion/serialize").Interpolation<import("@packlink/giger-theme/dist/lib/Theme").Theme>>;
|
|
@@ -8,6 +8,13 @@ type GetShipmentSchemaOptions = {
|
|
|
8
8
|
warehouses?: SE.Warehouse[];
|
|
9
9
|
};
|
|
10
10
|
export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouses, requireMeasurements, isContentDescriptionRequired, isCustomsRequired, }?: GetShipmentSchemaOptions) => z.ZodEffects<z.ZodDiscriminatedUnion<"__mode", z.Primitive, z.ZodObject<z.extendShape<{
|
|
11
|
+
advancedOptions: z.ZodOptional<z.ZodObject<{
|
|
12
|
+
additionalHandling: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
additionalHandling?: boolean | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
additionalHandling?: boolean | undefined;
|
|
17
|
+
}>>;
|
|
11
18
|
carrierId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
12
19
|
confirmation: z.ZodDefault<z.ZodNativeEnum<typeof SE.ConfirmationType>>;
|
|
13
20
|
customs: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -110,11 +117,11 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
110
117
|
carrierId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
111
118
|
code: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
112
119
|
}, "strip", z.ZodTypeAny, {
|
|
113
|
-
carrierId?: string | null | undefined;
|
|
114
120
|
code?: string | null | undefined;
|
|
115
|
-
}, {
|
|
116
121
|
carrierId?: string | null | undefined;
|
|
122
|
+
}, {
|
|
117
123
|
code?: string | null | undefined;
|
|
124
|
+
carrierId?: string | null | undefined;
|
|
118
125
|
}>;
|
|
119
126
|
weight: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
120
127
|
fractional: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodNumber>>, number, number | null | undefined>;
|
|
@@ -156,8 +163,8 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
156
163
|
} | undefined;
|
|
157
164
|
weight?: SE.WeightWithUnit | undefined;
|
|
158
165
|
type: {
|
|
159
|
-
carrierId?: string | null | undefined;
|
|
160
166
|
code?: string | null | undefined;
|
|
167
|
+
carrierId?: string | null | undefined;
|
|
161
168
|
};
|
|
162
169
|
}, {
|
|
163
170
|
contentDescription?: string | null | undefined;
|
|
@@ -182,8 +189,8 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
182
189
|
whole?: number | null | undefined;
|
|
183
190
|
} | null | undefined;
|
|
184
191
|
type: {
|
|
185
|
-
carrierId?: string | null | undefined;
|
|
186
192
|
code?: string | null | undefined;
|
|
193
|
+
carrierId?: string | null | undefined;
|
|
187
194
|
};
|
|
188
195
|
}>, "many">;
|
|
189
196
|
service: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -202,6 +209,9 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
202
209
|
}, {
|
|
203
210
|
__mode: z.ZodLiteral<"browse_rates">;
|
|
204
211
|
}>, "strip", z.ZodTypeAny, {
|
|
212
|
+
advancedOptions?: {
|
|
213
|
+
additionalHandling?: boolean | undefined;
|
|
214
|
+
} | undefined;
|
|
205
215
|
carrierId?: string | null | undefined;
|
|
206
216
|
customs?: {
|
|
207
217
|
contents: SE.CustomsContentsType;
|
|
@@ -232,13 +242,16 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
232
242
|
} | undefined;
|
|
233
243
|
weight?: SE.WeightWithUnit | undefined;
|
|
234
244
|
type: {
|
|
235
|
-
carrierId?: string | null | undefined;
|
|
236
245
|
code?: string | null | undefined;
|
|
246
|
+
carrierId?: string | null | undefined;
|
|
237
247
|
};
|
|
238
248
|
}[];
|
|
239
249
|
shipDate: string;
|
|
240
250
|
warehouseId: string;
|
|
241
251
|
}, {
|
|
252
|
+
advancedOptions?: {
|
|
253
|
+
additionalHandling?: boolean | undefined;
|
|
254
|
+
} | undefined;
|
|
242
255
|
carrierId?: string | null | undefined;
|
|
243
256
|
confirmation?: SE.ConfirmationType | undefined;
|
|
244
257
|
customs?: {
|
|
@@ -283,13 +296,20 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
283
296
|
whole?: number | null | undefined;
|
|
284
297
|
} | null | undefined;
|
|
285
298
|
type: {
|
|
286
|
-
carrierId?: string | null | undefined;
|
|
287
299
|
code?: string | null | undefined;
|
|
300
|
+
carrierId?: string | null | undefined;
|
|
288
301
|
};
|
|
289
302
|
}[];
|
|
290
303
|
shipDate: string;
|
|
291
304
|
warehouseId: string;
|
|
292
305
|
}> | z.ZodObject<z.extendShape<{
|
|
306
|
+
advancedOptions: z.ZodOptional<z.ZodObject<{
|
|
307
|
+
additionalHandling: z.ZodOptional<z.ZodBoolean>;
|
|
308
|
+
}, "strip", z.ZodTypeAny, {
|
|
309
|
+
additionalHandling?: boolean | undefined;
|
|
310
|
+
}, {
|
|
311
|
+
additionalHandling?: boolean | undefined;
|
|
312
|
+
}>>;
|
|
293
313
|
carrierId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
294
314
|
confirmation: z.ZodDefault<z.ZodNativeEnum<typeof SE.ConfirmationType>>;
|
|
295
315
|
customs: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -392,11 +412,11 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
392
412
|
carrierId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
393
413
|
code: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
394
414
|
}, "strip", z.ZodTypeAny, {
|
|
395
|
-
carrierId?: string | null | undefined;
|
|
396
415
|
code?: string | null | undefined;
|
|
397
|
-
}, {
|
|
398
416
|
carrierId?: string | null | undefined;
|
|
417
|
+
}, {
|
|
399
418
|
code?: string | null | undefined;
|
|
419
|
+
carrierId?: string | null | undefined;
|
|
400
420
|
}>;
|
|
401
421
|
weight: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
402
422
|
fractional: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodNumber>>, number, number | null | undefined>;
|
|
@@ -438,8 +458,8 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
438
458
|
} | undefined;
|
|
439
459
|
weight?: SE.WeightWithUnit | undefined;
|
|
440
460
|
type: {
|
|
441
|
-
carrierId?: string | null | undefined;
|
|
442
461
|
code?: string | null | undefined;
|
|
462
|
+
carrierId?: string | null | undefined;
|
|
443
463
|
};
|
|
444
464
|
}, {
|
|
445
465
|
contentDescription?: string | null | undefined;
|
|
@@ -464,8 +484,8 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
464
484
|
whole?: number | null | undefined;
|
|
465
485
|
} | null | undefined;
|
|
466
486
|
type: {
|
|
467
|
-
carrierId?: string | null | undefined;
|
|
468
487
|
code?: string | null | undefined;
|
|
488
|
+
carrierId?: string | null | undefined;
|
|
469
489
|
};
|
|
470
490
|
}>, "many">;
|
|
471
491
|
service: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -534,11 +554,11 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
534
554
|
carrierId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
535
555
|
code: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
536
556
|
}, "strip", z.ZodTypeAny, {
|
|
537
|
-
carrierId?: string | null | undefined;
|
|
538
557
|
code?: string | null | undefined;
|
|
539
|
-
}, {
|
|
540
558
|
carrierId?: string | null | undefined;
|
|
559
|
+
}, {
|
|
541
560
|
code?: string | null | undefined;
|
|
561
|
+
carrierId?: string | null | undefined;
|
|
542
562
|
}>;
|
|
543
563
|
weight: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
544
564
|
fractional: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodNumber>>, number, number | null | undefined>;
|
|
@@ -606,8 +626,8 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
606
626
|
} | undefined;
|
|
607
627
|
weight?: SE.WeightWithUnit | undefined;
|
|
608
628
|
type: {
|
|
609
|
-
carrierId?: string | null | undefined;
|
|
610
629
|
code?: string | null | undefined;
|
|
630
|
+
carrierId?: string | null | undefined;
|
|
611
631
|
};
|
|
612
632
|
}, {
|
|
613
633
|
contentDescription?: string | null | undefined;
|
|
@@ -628,8 +648,8 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
628
648
|
whole?: number | null | undefined;
|
|
629
649
|
} | null | undefined;
|
|
630
650
|
type: {
|
|
631
|
-
carrierId?: string | null | undefined;
|
|
632
651
|
code?: string | null | undefined;
|
|
652
|
+
carrierId?: string | null | undefined;
|
|
633
653
|
};
|
|
634
654
|
}>, "many">;
|
|
635
655
|
service: z.ZodObject<{
|
|
@@ -643,6 +663,9 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
643
663
|
serviceCode: string;
|
|
644
664
|
}>;
|
|
645
665
|
}>, "strip", z.ZodTypeAny, {
|
|
666
|
+
advancedOptions?: {
|
|
667
|
+
additionalHandling?: boolean | undefined;
|
|
668
|
+
} | undefined;
|
|
646
669
|
carrierId?: string | null | undefined;
|
|
647
670
|
customs?: {
|
|
648
671
|
contents: SE.CustomsContentsType;
|
|
@@ -669,8 +692,8 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
669
692
|
} | undefined;
|
|
670
693
|
weight?: SE.WeightWithUnit | undefined;
|
|
671
694
|
type: {
|
|
672
|
-
carrierId?: string | null | undefined;
|
|
673
695
|
code?: string | null | undefined;
|
|
696
|
+
carrierId?: string | null | undefined;
|
|
674
697
|
};
|
|
675
698
|
}[];
|
|
676
699
|
service: {
|
|
@@ -680,6 +703,9 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
680
703
|
shipDate: string;
|
|
681
704
|
warehouseId: string;
|
|
682
705
|
}, {
|
|
706
|
+
advancedOptions?: {
|
|
707
|
+
additionalHandling?: boolean | undefined;
|
|
708
|
+
} | undefined;
|
|
683
709
|
carrierId?: string | null | undefined;
|
|
684
710
|
confirmation?: SE.ConfirmationType | undefined;
|
|
685
711
|
customs?: {
|
|
@@ -716,8 +742,8 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
716
742
|
whole?: number | null | undefined;
|
|
717
743
|
} | null | undefined;
|
|
718
744
|
type: {
|
|
719
|
-
carrierId?: string | null | undefined;
|
|
720
745
|
code?: string | null | undefined;
|
|
746
|
+
carrierId?: string | null | undefined;
|
|
721
747
|
};
|
|
722
748
|
}[];
|
|
723
749
|
service: {
|
|
@@ -788,6 +814,9 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
788
814
|
} | undefined;
|
|
789
815
|
})[];
|
|
790
816
|
serviceCode: string | undefined;
|
|
817
|
+
advancedOptions?: {
|
|
818
|
+
additionalHandling?: boolean | undefined;
|
|
819
|
+
} | undefined;
|
|
791
820
|
shipmentId?: string | undefined;
|
|
792
821
|
__mode: "browse_rates";
|
|
793
822
|
confirmation: SE.ConfirmationType;
|
|
@@ -856,6 +885,9 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
856
885
|
} | undefined;
|
|
857
886
|
})[];
|
|
858
887
|
serviceCode: string | undefined;
|
|
888
|
+
advancedOptions?: {
|
|
889
|
+
additionalHandling?: boolean | undefined;
|
|
890
|
+
} | undefined;
|
|
859
891
|
shipmentId?: string | undefined;
|
|
860
892
|
__mode: "select_service";
|
|
861
893
|
confirmation: SE.ConfirmationType;
|
|
@@ -863,6 +895,9 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
863
895
|
shipDate: string;
|
|
864
896
|
warehouseId: string;
|
|
865
897
|
}, {
|
|
898
|
+
advancedOptions?: {
|
|
899
|
+
additionalHandling?: boolean | undefined;
|
|
900
|
+
} | undefined;
|
|
866
901
|
carrierId?: string | null | undefined;
|
|
867
902
|
confirmation?: SE.ConfirmationType | undefined;
|
|
868
903
|
customs?: {
|
|
@@ -907,13 +942,16 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
907
942
|
whole?: number | null | undefined;
|
|
908
943
|
} | null | undefined;
|
|
909
944
|
type: {
|
|
910
|
-
carrierId?: string | null | undefined;
|
|
911
945
|
code?: string | null | undefined;
|
|
946
|
+
carrierId?: string | null | undefined;
|
|
912
947
|
};
|
|
913
948
|
}[];
|
|
914
949
|
shipDate: string;
|
|
915
950
|
warehouseId: string;
|
|
916
951
|
} | {
|
|
952
|
+
advancedOptions?: {
|
|
953
|
+
additionalHandling?: boolean | undefined;
|
|
954
|
+
} | undefined;
|
|
917
955
|
carrierId?: string | null | undefined;
|
|
918
956
|
confirmation?: SE.ConfirmationType | undefined;
|
|
919
957
|
customs?: {
|
|
@@ -950,8 +988,8 @@ export declare const getShipmentSchema: ({ allowInternationalShipFrom, warehouse
|
|
|
950
988
|
whole?: number | null | undefined;
|
|
951
989
|
} | null | undefined;
|
|
952
990
|
type: {
|
|
953
|
-
carrierId?: string | null | undefined;
|
|
954
991
|
code?: string | null | undefined;
|
|
992
|
+
carrierId?: string | null | undefined;
|
|
955
993
|
};
|
|
956
994
|
}[];
|
|
957
995
|
service: {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SE } from "@shipengine/alchemy";
|
|
2
|
-
import {
|
|
2
|
+
import { UseRatesWithCacheProps } from "./use-rates-with-cache";
|
|
3
3
|
export type UseRatesFormProps = {
|
|
4
4
|
onBeforeLabelCreate?: (rate: SE.Rate, shipment: SE.SalesOrderShipment) => Promise<void> | void;
|
|
5
5
|
onLabelCreateFailure?: (rate: SE.Rate, shipment: SE.SalesOrderShipment) => Promise<void> | void;
|
|
6
6
|
onLabelCreateSuccess?: (label: SE.Label, shipment: SE.SalesOrderShipment) => Promise<void> | void;
|
|
7
7
|
onRateSaved?: (shipment: SE.SalesOrderShipment) => Promise<void> | void;
|
|
8
|
-
onRatesCalculated?:
|
|
8
|
+
onRatesCalculated?: UseRatesWithCacheProps["onRatesCalculated"];
|
|
9
9
|
onShipmentUpdated?: (shipment: SE.SalesOrderShipment) => Promise<void> | void;
|
|
10
10
|
printLabelLayout?: SE.LabelLayout;
|
|
11
11
|
shipment?: SE.SalesOrderShipment;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SE } from "@shipengine/alchemy";
|
|
2
|
+
import { UseRequestRatesProps } from "./use-request-rates";
|
|
3
|
+
export type UseRatesWithCacheProps = {
|
|
4
|
+
onRatesCalculated: UseRequestRatesProps["onRatesCalculated"];
|
|
5
|
+
shipment?: SE.SalesOrderShipment;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Since useFormHook doesn't have a "submit if valid and don't paint errors" option,
|
|
9
|
+
* instead one can use this hook to prefetch previously calculated rates from /v1/shipments/:shipment_id/rates
|
|
10
|
+
* which this hook will blend into the "real" useRequestRates hook's loading state and response values,
|
|
11
|
+
* masquerading as a cached value from the real endpoint without having a flash of error hints.
|
|
12
|
+
*
|
|
13
|
+
* It also intercepts the resetRates function from useRequestRates to set a flag to ignore this caching.
|
|
14
|
+
* (this transparently returns the behaviors to the default useRequestRates behavior)
|
|
15
|
+
*/
|
|
16
|
+
export declare const useRatesWithCache: ({ shipment, onRatesCalculated }: UseRatesWithCacheProps) => {
|
|
17
|
+
ratesCalculating: boolean;
|
|
18
|
+
ratesErrors: SE.CodedError[] | null;
|
|
19
|
+
ratesResponse: SE.RateResponse | {
|
|
20
|
+
created_at: string;
|
|
21
|
+
errors: SE.CodedError[];
|
|
22
|
+
invalidRates: SE.Rate[];
|
|
23
|
+
rate_request_id: string;
|
|
24
|
+
rates: SE.Rate[];
|
|
25
|
+
shipment_id: string;
|
|
26
|
+
status: "error" | "working" | "completed" | "partial";
|
|
27
|
+
} | undefined;
|
|
28
|
+
requestRates: (shipment: SE.SalesOrderShipment) => Promise<void>;
|
|
29
|
+
resetRates: () => void;
|
|
30
|
+
};
|
|
@@ -32,9 +32,7 @@ export declare const Element: ({ resources, ...props }: object & {
|
|
|
32
32
|
approved: string;
|
|
33
33
|
rejected: string;
|
|
34
34
|
};
|
|
35
|
-
|
|
36
|
-
salesOrder: string;
|
|
37
|
-
};
|
|
35
|
+
voidedOn: string;
|
|
38
36
|
};
|
|
39
37
|
"view-shipment": {
|
|
40
38
|
actions: {
|
|
@@ -145,6 +143,7 @@ export declare const Element: ({ resources, ...props }: object & {
|
|
|
145
143
|
results: string;
|
|
146
144
|
};
|
|
147
145
|
fields: {
|
|
146
|
+
"requires-additional-handling": string;
|
|
148
147
|
addOns: string;
|
|
149
148
|
contentDescription: string;
|
|
150
149
|
confirmation: string;
|
|
@@ -571,6 +570,7 @@ export declare const Element: ({ resources, ...props }: object & {
|
|
|
571
570
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnN1ZmZpY2llbnQgYWNjb3VudCBiYWxhbmNlLiBBY2NvdW50IGV4Y2VwdGlvbiBFeGNlcHRpb24gd2l0aCBjb2RlIDB4MDA1NjAxMDE7IG1vZHVsZSA4NiwgY2F0ZWdvcnkgMSwgaXRlbSAx: string;
|
|
572
571
|
"QWRkcmVzcyBub3QgZm91bmQ=": string;
|
|
573
572
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: string;
|
|
573
|
+
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: string;
|
|
574
574
|
};
|
|
575
575
|
};
|
|
576
576
|
} | undefined;
|
|
@@ -36,9 +36,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
36
36
|
approved: string;
|
|
37
37
|
rejected: string;
|
|
38
38
|
};
|
|
39
|
-
|
|
40
|
-
salesOrder: string;
|
|
41
|
-
};
|
|
39
|
+
voidedOn: string;
|
|
42
40
|
};
|
|
43
41
|
"view-shipment": {
|
|
44
42
|
actions: {
|
|
@@ -149,6 +147,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
149
147
|
results: string;
|
|
150
148
|
};
|
|
151
149
|
fields: {
|
|
150
|
+
"requires-additional-handling": string;
|
|
152
151
|
addOns: string;
|
|
153
152
|
contentDescription: string;
|
|
154
153
|
confirmation: string;
|
|
@@ -575,6 +574,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
575
574
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnN1ZmZpY2llbnQgYWNjb3VudCBiYWxhbmNlLiBBY2NvdW50IGV4Y2VwdGlvbiBFeGNlcHRpb24gd2l0aCBjb2RlIDB4MDA1NjAxMDE7IG1vZHVsZSA4NiwgY2F0ZWdvcnkgMSwgaXRlbSAx: string;
|
|
576
575
|
"QWRkcmVzcyBub3QgZm91bmQ=": string;
|
|
577
576
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: string;
|
|
577
|
+
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: string;
|
|
578
578
|
};
|
|
579
579
|
};
|
|
580
580
|
} | undefined;
|
|
@@ -35,9 +35,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
35
35
|
approved: string;
|
|
36
36
|
rejected: string;
|
|
37
37
|
};
|
|
38
|
-
|
|
39
|
-
salesOrder: string;
|
|
40
|
-
};
|
|
38
|
+
voidedOn: string;
|
|
41
39
|
};
|
|
42
40
|
"view-shipment": {
|
|
43
41
|
actions: {
|
|
@@ -148,6 +146,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
148
146
|
results: string;
|
|
149
147
|
};
|
|
150
148
|
fields: {
|
|
149
|
+
"requires-additional-handling": string;
|
|
151
150
|
addOns: string;
|
|
152
151
|
contentDescription: string;
|
|
153
152
|
confirmation: string;
|
|
@@ -574,6 +573,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
574
573
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnN1ZmZpY2llbnQgYWNjb3VudCBiYWxhbmNlLiBBY2NvdW50IGV4Y2VwdGlvbiBFeGNlcHRpb24gd2l0aCBjb2RlIDB4MDA1NjAxMDE7IG1vZHVsZSA4NiwgY2F0ZWdvcnkgMSwgaXRlbSAx: string;
|
|
575
574
|
"QWRkcmVzcyBub3QgZm91bmQ=": string;
|
|
576
575
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: string;
|
|
576
|
+
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: string;
|
|
577
577
|
};
|
|
578
578
|
};
|
|
579
579
|
} | undefined;
|
|
@@ -38,9 +38,7 @@ export declare const Element: ({ resources, ...props }: SalesOrderProps & {
|
|
|
38
38
|
approved: string;
|
|
39
39
|
rejected: string;
|
|
40
40
|
};
|
|
41
|
-
|
|
42
|
-
salesOrder: string;
|
|
43
|
-
};
|
|
41
|
+
voidedOn: string;
|
|
44
42
|
};
|
|
45
43
|
"view-shipment": {
|
|
46
44
|
actions: {
|
|
@@ -151,6 +149,7 @@ export declare const Element: ({ resources, ...props }: SalesOrderProps & {
|
|
|
151
149
|
results: string;
|
|
152
150
|
};
|
|
153
151
|
fields: {
|
|
152
|
+
"requires-additional-handling": string;
|
|
154
153
|
addOns: string;
|
|
155
154
|
contentDescription: string;
|
|
156
155
|
confirmation: string;
|
|
@@ -577,6 +576,7 @@ export declare const Element: ({ resources, ...props }: SalesOrderProps & {
|
|
|
577
576
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnN1ZmZpY2llbnQgYWNjb3VudCBiYWxhbmNlLiBBY2NvdW50IGV4Y2VwdGlvbiBFeGNlcHRpb24gd2l0aCBjb2RlIDB4MDA1NjAxMDE7IG1vZHVsZSA4NiwgY2F0ZWdvcnkgMSwgaXRlbSAx: string;
|
|
578
577
|
"QWRkcmVzcyBub3QgZm91bmQ=": string;
|
|
579
578
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: string;
|
|
579
|
+
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: string;
|
|
580
580
|
};
|
|
581
581
|
};
|
|
582
582
|
} | undefined;
|
|
@@ -44,9 +44,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
44
44
|
approved: string;
|
|
45
45
|
rejected: string;
|
|
46
46
|
};
|
|
47
|
-
|
|
48
|
-
salesOrder: string;
|
|
49
|
-
};
|
|
47
|
+
voidedOn: string;
|
|
50
48
|
};
|
|
51
49
|
"view-shipment": {
|
|
52
50
|
actions: {
|
|
@@ -157,6 +155,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
157
155
|
results: string;
|
|
158
156
|
};
|
|
159
157
|
fields: {
|
|
158
|
+
"requires-additional-handling": string;
|
|
160
159
|
addOns: string;
|
|
161
160
|
contentDescription: string;
|
|
162
161
|
confirmation: string;
|
|
@@ -583,6 +582,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
583
582
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnN1ZmZpY2llbnQgYWNjb3VudCBiYWxhbmNlLiBBY2NvdW50IGV4Y2VwdGlvbiBFeGNlcHRpb24gd2l0aCBjb2RlIDB4MDA1NjAxMDE7IG1vZHVsZSA4NiwgY2F0ZWdvcnkgMSwgaXRlbSAx: string;
|
|
584
583
|
"QWRkcmVzcyBub3QgZm91bmQ=": string;
|
|
585
584
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: string;
|
|
585
|
+
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: string;
|
|
586
586
|
};
|
|
587
587
|
};
|
|
588
588
|
} | undefined;
|
|
@@ -39,9 +39,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
39
39
|
approved: string;
|
|
40
40
|
rejected: string;
|
|
41
41
|
};
|
|
42
|
-
|
|
43
|
-
salesOrder: string;
|
|
44
|
-
};
|
|
42
|
+
voidedOn: string;
|
|
45
43
|
};
|
|
46
44
|
"view-shipment": {
|
|
47
45
|
actions: {
|
|
@@ -152,6 +150,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
152
150
|
results: string;
|
|
153
151
|
};
|
|
154
152
|
fields: {
|
|
153
|
+
"requires-additional-handling": string;
|
|
155
154
|
addOns: string;
|
|
156
155
|
contentDescription: string;
|
|
157
156
|
confirmation: string;
|
|
@@ -578,6 +577,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
578
577
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnN1ZmZpY2llbnQgYWNjb3VudCBiYWxhbmNlLiBBY2NvdW50IGV4Y2VwdGlvbiBFeGNlcHRpb24gd2l0aCBjb2RlIDB4MDA1NjAxMDE7IG1vZHVsZSA4NiwgY2F0ZWdvcnkgMSwgaXRlbSAx: string;
|
|
579
578
|
"QWRkcmVzcyBub3QgZm91bmQ=": string;
|
|
580
579
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: string;
|
|
580
|
+
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: string;
|
|
581
581
|
};
|
|
582
582
|
};
|
|
583
583
|
} | undefined;
|
|
@@ -28,9 +28,7 @@ declare const _default: {
|
|
|
28
28
|
approved: string;
|
|
29
29
|
rejected: string;
|
|
30
30
|
};
|
|
31
|
-
|
|
32
|
-
salesOrder: string;
|
|
33
|
-
};
|
|
31
|
+
voidedOn: string;
|
|
34
32
|
};
|
|
35
33
|
"view-shipment": {
|
|
36
34
|
actions: {
|
|
@@ -141,6 +139,7 @@ declare const _default: {
|
|
|
141
139
|
results: string;
|
|
142
140
|
};
|
|
143
141
|
fields: {
|
|
142
|
+
"requires-additional-handling": string;
|
|
144
143
|
addOns: string;
|
|
145
144
|
contentDescription: string;
|
|
146
145
|
confirmation: string;
|
|
@@ -567,6 +566,7 @@ declare const _default: {
|
|
|
567
566
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnN1ZmZpY2llbnQgYWNjb3VudCBiYWxhbmNlLiBBY2NvdW50IGV4Y2VwdGlvbiBFeGNlcHRpb24gd2l0aCBjb2RlIDB4MDA1NjAxMDE7IG1vZHVsZSA4NiwgY2F0ZWdvcnkgMSwgaXRlbSAx: string;
|
|
568
567
|
"QWRkcmVzcyBub3QgZm91bmQ=": string;
|
|
569
568
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: string;
|
|
569
|
+
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: string;
|
|
570
570
|
};
|
|
571
571
|
};
|
|
572
572
|
export default _default;
|
|
@@ -3,6 +3,8 @@ import { SE } from "@shipengine/alchemy";
|
|
|
3
3
|
export type CreateWarehouseHandlersParams = {
|
|
4
4
|
get?: DeepPartial<SE.Warehouse>;
|
|
5
5
|
list?: [count: number, listParams?: DeepPartial<SE.Warehouse>];
|
|
6
|
+
suggested?: boolean;
|
|
7
|
+
validate?: "unverified" | "verified" | "warning" | "error";
|
|
6
8
|
};
|
|
7
9
|
export declare const createWarehouseHandlers: (params?: CreateWarehouseHandlersParams) => {
|
|
8
10
|
database: {
|
package/src/utilities/date.d.ts
CHANGED