@shipengine/elements 0.22.0 → 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 +284 -190
- package/index.js +285 -192
- package/package.json +3 -3
- 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/items-breakdown/items-breakdown.styles.d.ts +1 -3
- 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 +2 -3
- package/src/elements/manage-warehouses/manage-warehouses.d.ts +2 -3
- package/src/elements/onboarding/onboarding.d.ts +2 -3
- package/src/elements/purchase-label/purchase-label.d.ts +2 -3
- package/src/elements/view-shipment/view-shipment.d.ts +2 -3
- package/src/elements/void-label/void-label.d.ts +2 -3
- package/src/locales/en/index.d.ts +2 -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,8 +29,8 @@
|
|
|
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",
|
|
@@ -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;
|
|
@@ -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>>;
|
|
@@ -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: {
|
|
@@ -572,6 +570,7 @@ export declare const Element: ({ resources, ...props }: object & {
|
|
|
572
570
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnN1ZmZpY2llbnQgYWNjb3VudCBiYWxhbmNlLiBBY2NvdW50IGV4Y2VwdGlvbiBFeGNlcHRpb24gd2l0aCBjb2RlIDB4MDA1NjAxMDE7IG1vZHVsZSA4NiwgY2F0ZWdvcnkgMSwgaXRlbSAx: string;
|
|
573
571
|
"QWRkcmVzcyBub3QgZm91bmQ=": string;
|
|
574
572
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: string;
|
|
573
|
+
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: string;
|
|
575
574
|
};
|
|
576
575
|
};
|
|
577
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: {
|
|
@@ -576,6 +574,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
576
574
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnN1ZmZpY2llbnQgYWNjb3VudCBiYWxhbmNlLiBBY2NvdW50IGV4Y2VwdGlvbiBFeGNlcHRpb24gd2l0aCBjb2RlIDB4MDA1NjAxMDE7IG1vZHVsZSA4NiwgY2F0ZWdvcnkgMSwgaXRlbSAx: string;
|
|
577
575
|
"QWRkcmVzcyBub3QgZm91bmQ=": string;
|
|
578
576
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: string;
|
|
577
|
+
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: string;
|
|
579
578
|
};
|
|
580
579
|
};
|
|
581
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: {
|
|
@@ -575,6 +573,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
575
573
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnN1ZmZpY2llbnQgYWNjb3VudCBiYWxhbmNlLiBBY2NvdW50IGV4Y2VwdGlvbiBFeGNlcHRpb24gd2l0aCBjb2RlIDB4MDA1NjAxMDE7IG1vZHVsZSA4NiwgY2F0ZWdvcnkgMSwgaXRlbSAx: string;
|
|
576
574
|
"QWRkcmVzcyBub3QgZm91bmQ=": string;
|
|
577
575
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: string;
|
|
576
|
+
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: string;
|
|
578
577
|
};
|
|
579
578
|
};
|
|
580
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: {
|
|
@@ -578,6 +576,7 @@ export declare const Element: ({ resources, ...props }: SalesOrderProps & {
|
|
|
578
576
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnN1ZmZpY2llbnQgYWNjb3VudCBiYWxhbmNlLiBBY2NvdW50IGV4Y2VwdGlvbiBFeGNlcHRpb24gd2l0aCBjb2RlIDB4MDA1NjAxMDE7IG1vZHVsZSA4NiwgY2F0ZWdvcnkgMSwgaXRlbSAx: string;
|
|
579
577
|
"QWRkcmVzcyBub3QgZm91bmQ=": string;
|
|
580
578
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: string;
|
|
579
|
+
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: string;
|
|
581
580
|
};
|
|
582
581
|
};
|
|
583
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: {
|
|
@@ -584,6 +582,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
584
582
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnN1ZmZpY2llbnQgYWNjb3VudCBiYWxhbmNlLiBBY2NvdW50IGV4Y2VwdGlvbiBFeGNlcHRpb24gd2l0aCBjb2RlIDB4MDA1NjAxMDE7IG1vZHVsZSA4NiwgY2F0ZWdvcnkgMSwgaXRlbSAx: string;
|
|
585
583
|
"QWRkcmVzcyBub3QgZm91bmQ=": string;
|
|
586
584
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: string;
|
|
585
|
+
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: string;
|
|
587
586
|
};
|
|
588
587
|
};
|
|
589
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: {
|
|
@@ -579,6 +577,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
579
577
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnN1ZmZpY2llbnQgYWNjb3VudCBiYWxhbmNlLiBBY2NvdW50IGV4Y2VwdGlvbiBFeGNlcHRpb24gd2l0aCBjb2RlIDB4MDA1NjAxMDE7IG1vZHVsZSA4NiwgY2F0ZWdvcnkgMSwgaXRlbSAx: string;
|
|
580
578
|
"QWRkcmVzcyBub3QgZm91bmQ=": string;
|
|
581
579
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: string;
|
|
580
|
+
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: string;
|
|
582
581
|
};
|
|
583
582
|
};
|
|
584
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: {
|
|
@@ -568,6 +566,7 @@ declare const _default: {
|
|
|
568
566
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnN1ZmZpY2llbnQgYWNjb3VudCBiYWxhbmNlLiBBY2NvdW50IGV4Y2VwdGlvbiBFeGNlcHRpb24gd2l0aCBjb2RlIDB4MDA1NjAxMDE7IG1vZHVsZSA4NiwgY2F0ZWdvcnkgMSwgaXRlbSAx: string;
|
|
569
567
|
"QWRkcmVzcyBub3QgZm91bmQ=": string;
|
|
570
568
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: string;
|
|
569
|
+
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: string;
|
|
571
570
|
};
|
|
572
571
|
};
|
|
573
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