@shipengine/elements 0.22.0 → 0.23.1

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.22.0",
3
+ "version": "0.23.1",
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.10",
33
- "@shipengine/js-api": "0.6.2",
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",
@@ -4,4 +4,10 @@ export declare const getOverrideStyles: (theme: Theme) => {
4
4
  cursor: string;
5
5
  fontWeight: number;
6
6
  };
7
+ "&& input:hover": {
8
+ cursor: string;
9
+ };
10
+ "&&.disabled input:hover": {
11
+ cursor: string;
12
+ };
7
13
  };
@@ -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
- import { Theme } from "@packlink/giger-theme";
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,6 +1 @@
1
- export declare const getCustomsActionsStyles: () => import("@emotion/utils").SerializedStyles;
2
- export declare const getCustomsDescriptionStyle: () => import("@emotion/utils").SerializedStyles;
3
- export declare const getCustomsItemInfoLeftStyle: () => import("@emotion/utils").SerializedStyles;
4
- export declare const getCustomsItemInfoRightStyle: () => import("@emotion/utils").SerializedStyles;
5
- export declare const getCustomsHeaderStyle: () => import("@emotion/utils").SerializedStyles;
6
- export declare const getNumericCellStyle: () => import("@emotion/utils").SerializedStyles;
1
+ export declare const styles: Record<"actions" | "actionsButton" | "actionsColumn" | "headerDescription" | "headerEach" | "headerQty" | "headerTotal" | "hsCode" | "itemEach" | "itemInfoLeft" | "itemQty" | "itemTotal", import("@emotion/serialize").Interpolation<import("@packlink/giger-theme/dist/lib/Theme").Theme>>;
@@ -3,3 +3,4 @@ export * from "./use-customs";
3
3
  export * from "./use-presets";
4
4
  export * from "./use-rates-form";
5
5
  export * from "./use-shipment-form";
6
+ export * from "./use-rates-with-cache";
@@ -1,11 +1,11 @@
1
1
  import { SE } from "@shipengine/alchemy";
2
- import { UseRequestRatesProps } from "./use-request-rates";
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?: UseRequestRatesProps["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
- sections: {
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
- sections: {
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
- sections: {
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
- sections: {
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
- sections: {
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
- sections: {
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
- sections: {
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: {
@@ -2,6 +2,10 @@
2
2
  * @category Utilities
3
3
  */
4
4
  export declare const formatDate: (date: string, locale?: string) => string;
5
+ /**
6
+ * @category Utilities
7
+ */
8
+ export declare const formatDateDDMMYY: (date: string, locale?: string) => string;
5
9
  /**
6
10
  * @category Utilities
7
11
  */