@shipengine/elements 0.34.0 → 0.36.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 +2019 -577
- package/index.js +2012 -578
- package/package.json +1 -1
- package/src/components/add-funds-form/add-funds-form.d.ts +20 -2
- package/src/components/add-funds-form/add-funds-schema.d.ts +26 -0
- package/src/components/address-preference-context/address-preference-context.d.ts +8 -0
- package/src/components/auto-funding-form/auto-funding-form.d.ts +22 -0
- package/src/components/auto-funding-form/auto-funding-schema.d.ts +17 -0
- package/src/components/button-group/button-group.d.ts +29 -0
- package/src/components/carrier-balance/carrier-balance.d.ts +23 -0
- package/src/components/collapsible-panel/collapsible-panel.d.ts +32 -0
- package/src/components/copy/copy-button.d.ts +4 -0
- package/src/components/cube/cube.d.ts +16 -0
- package/src/components/date-range-combo/date-range-combo.d.ts +14 -0
- package/src/components/date-range-select/date-range-select.d.ts +6 -0
- package/src/components/error-fallback/error-fallback.d.ts +12 -1
- package/src/components/field-label/field-label.d.ts +10 -0
- package/src/components/form-portal/form-portal.d.ts +9 -0
- package/src/components/fund-and-purchase/fund-and-purchase.d.ts +13 -0
- package/src/components/inline-label/inline-label.d.ts +10 -0
- package/src/components/items-breakdown/items-breakdown.d.ts +15 -0
- package/src/components/label-layout/label-layout.d.ts +5 -0
- package/src/components/link-action/link-action.d.ts +10 -0
- package/src/components/loader/loader.d.ts +5 -0
- package/src/components/manage-funding/manage-funding.d.ts +26 -0
- package/src/components/payment-method-settings/payment-method-settings.d.ts +19 -0
- package/src/components/portal/portal.d.ts +10 -1
- package/src/components/powered-by-shipengine/powered-by-shipengine.d.ts +8 -0
- package/src/components/section/section.d.ts +10 -0
- package/src/components/spacer/spacer.d.ts +30 -0
- package/src/components/spread/spread.d.ts +10 -0
- package/src/components/story-notes/story-notes.d.ts +10 -1
- package/src/components/templates/rate-form/rate-form.d.ts +2 -2
- package/src/components/templates/shipment-form/shipment-form.d.ts +2 -1
- package/src/components/templates/shipment-form/shipment-schema.d.ts +179 -17
- package/src/components/unit-settings/unit-settings.d.ts +5 -0
- package/src/constants/shipengine/address.d.ts +75 -0
- package/src/elements/account-settings/account-settings.d.ts +136 -1
- package/src/elements/configure-shipment/configure-shipment.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 +1 -1
- package/src/elements/configure-shipment/hooks/use-request-rates.d.ts +1 -1
- package/src/elements/configure-shipment/hooks/use-shipment-form.d.ts +1 -0
- package/src/elements/list-carriers/list-carriers.d.ts +31 -0
- package/src/elements/manage-warehouses/manage-warehouses.d.ts +34 -0
- package/src/elements/onboarding/onboarding.d.ts +93 -2
- package/src/elements/purchase-label/purchase-label.d.ts +191 -7
- package/src/elements/shipengine-workflow/label-workflow.d.ts +138 -2
- package/src/elements/view-shipment/view-shipment.d.ts +128 -2
- package/src/elements/void-label/void-label.d.ts +134 -3
- package/src/extensions/zod.d.ts +5 -0
- package/src/factories/shipengine/package.d.ts +11 -0
- package/src/features/wallet-history/wallet-history.d.ts +5 -0
- package/src/hooks/index.d.ts +1 -0
- package/src/hooks/options/use-confirmation-options.d.ts +7 -0
- package/src/hooks/options/use-country-code-options.d.ts +16 -3
- package/src/hooks/options/use-customs-contents-options.d.ts +7 -0
- package/src/hooks/options/use-customs-non-delivery-options.d.ts +7 -0
- package/src/hooks/options/use-date-range-options.d.ts +22 -1
- package/src/hooks/options/use-expiration-month-options.d.ts +7 -0
- package/src/hooks/options/use-insurance-provider-options.d.ts +7 -0
- package/src/hooks/options/use-package-options.d.ts +7 -0
- package/src/hooks/options/use-rate-options.d.ts +11 -1
- package/src/hooks/options/use-service-code-options.d.ts +7 -0
- package/src/hooks/options/use-shipment-metadata.d.ts +8 -0
- package/src/hooks/options/use-shipping-presets-options.d.ts +10 -0
- package/src/hooks/options/use-state-code-options.d.ts +7 -0
- package/src/hooks/options/use-warehouse-options.d.ts +7 -0
- package/src/hooks/use-address-validation.d.ts +7 -0
- package/src/hooks/use-black-box-detection.d.ts +17 -1
- package/src/hooks/use-carrier-metadata.d.ts +7 -0
- package/src/hooks/use-nested-form.d.ts +9 -0
- package/src/hooks/use-page-layout.d.ts +25 -1
- package/src/hooks/use-root-portal.d.ts +15 -2
- package/src/hooks/use-run-once-on-true.d.ts +5 -1
- package/src/hooks/use-scrub-errors.d.ts +6 -3
- package/src/hooks/use-toggle.d.ts +5 -1
- package/src/locales/en/index.d.ts +8 -1
- package/src/schemas/shipengine/money.d.ts +4 -0
- package/src/schemas/shipengine/phone.d.ts +8 -0
- package/src/types/carrier-metadata.d.ts +20 -0
- package/src/utilities/create-dictionary.d.ts +4 -0
- package/src/utilities/date.d.ts +51 -2
- package/src/utilities/error.d.ts +16 -2
- package/src/utilities/feature-flags.d.ts +181 -0
- package/src/utilities/form-logger.d.ts +4 -0
- package/src/utilities/index.d.ts +1 -1
- package/src/utilities/money.d.ts +25 -0
- package/src/utilities/predicates/isString.d.ts +7 -0
- package/src/utilities/rates.d.ts +22 -1
- package/src/utilities/shipengine/address.d.ts +31 -0
- package/src/utilities/shipengine/carrier.d.ts +21 -0
- package/src/utilities/shipengine/dimensions.d.ts +27 -4
- package/src/utilities/shipengine/package.d.ts +4 -0
- package/src/utilities/shipengine/sales-order.d.ts +26 -0
- package/src/utilities/shipengine/shipment.d.ts +12 -0
- package/src/utilities/shipengine/weight.d.ts +92 -2
- package/src/utilities/string.d.ts +7 -0
- package/src/utilities/styles.d.ts +4 -0
- package/src/utilities/validation.d.ts +8 -0
|
@@ -1,26 +1,57 @@
|
|
|
1
1
|
import { SE } from "@shipengine/alchemy";
|
|
2
2
|
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*
|
|
5
|
+
* # Address Utilities - isDomesticAddress
|
|
6
|
+
*
|
|
3
7
|
* @category Utilities
|
|
4
8
|
*/
|
|
5
9
|
export declare const isDomesticAddress: (address: Pick<SE.Address, "countryCode">) => boolean | undefined;
|
|
6
10
|
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*
|
|
13
|
+
* # Address Utilities - isMilitaryAddress
|
|
14
|
+
*
|
|
7
15
|
* @category Utilities
|
|
8
16
|
*/
|
|
9
17
|
export declare const isMilitaryAddress: (address: SE.Address) => boolean;
|
|
10
18
|
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*
|
|
21
|
+
* # Address Utilities - isUnitedStatesTerritory
|
|
22
|
+
*
|
|
11
23
|
* @category Utilities
|
|
12
24
|
*/
|
|
13
25
|
export declare const isUnitedStatesTerritory: (address: SE.Address) => boolean;
|
|
14
26
|
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*
|
|
29
|
+
* # Address Utilities - isUnsupportedByUps
|
|
30
|
+
*
|
|
15
31
|
* @category Utilities
|
|
16
32
|
*/
|
|
17
33
|
export declare const isUnsupportedByUps: (address: SE.Address) => boolean;
|
|
18
34
|
/**
|
|
35
|
+
* @internal
|
|
36
|
+
*
|
|
37
|
+
* # Address Utilities - isPoBox
|
|
38
|
+
*
|
|
19
39
|
* @category Utilities
|
|
20
40
|
*/
|
|
21
41
|
export declare const isPoBox: (addressLine: string) => boolean;
|
|
22
42
|
/**
|
|
43
|
+
* @internal
|
|
44
|
+
*
|
|
45
|
+
* # Address Utilities - isPoBoxAddress
|
|
46
|
+
*
|
|
23
47
|
* @category Utilities
|
|
24
48
|
*/
|
|
25
49
|
export declare const isPoBoxAddress: (address: SE.Address) => boolean;
|
|
50
|
+
/**
|
|
51
|
+
* @internal
|
|
52
|
+
*
|
|
53
|
+
* # Address Utilities - isEmptyAddress
|
|
54
|
+
*
|
|
55
|
+
* @category Utilities
|
|
56
|
+
*/
|
|
26
57
|
export declare const isEmptyAddress: (address?: SE.Address) => boolean;
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
import { SE } from "@shipengine/alchemy";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*
|
|
5
|
+
* # Carrier Utilities - isUspsCarrier
|
|
6
|
+
*
|
|
7
|
+
* @category Utilities
|
|
8
|
+
*/
|
|
2
9
|
export declare const isUspsCarrier: (carrierCode: string) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*
|
|
13
|
+
* # Carrier Utilities - isUpsCarrier
|
|
14
|
+
*
|
|
15
|
+
* @category Utilities
|
|
16
|
+
*/
|
|
3
17
|
export declare const isUpsCarrier: (carrierCode: string) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*
|
|
21
|
+
* # Carrier Utilities - isFedexCarrier
|
|
22
|
+
*
|
|
23
|
+
* @category Utilities
|
|
24
|
+
*/
|
|
4
25
|
export declare const getCarrierIdByCarrierCode: (carriers: SE.Carrier[] | undefined, carrierCode: string) => string | undefined;
|
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
import { SE } from "@shipengine/alchemy";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*
|
|
5
|
+
* # Convert Dimensions Options Type
|
|
6
|
+
*
|
|
7
|
+
* @see {@link convertDimensions | The Convert Dimensions Utility Function}
|
|
8
|
+
*/
|
|
9
|
+
export type ConvertDimensionsOptions = {
|
|
10
|
+
/**
|
|
11
|
+
* `allowAllZeroes` indicates if you want to allow zeros in the returned dimensions.
|
|
12
|
+
*/
|
|
3
13
|
allowAllZeroes?: boolean;
|
|
4
14
|
};
|
|
5
15
|
/**
|
|
16
|
+
* @internal
|
|
17
|
+
*
|
|
18
|
+
* # Convert Dimensions Utility Function
|
|
19
|
+
*
|
|
6
20
|
* @category Utilities
|
|
7
21
|
*/
|
|
8
|
-
export declare
|
|
9
|
-
export declare function convertDimensions(dimensions: SE.DimensionsWithUnit,
|
|
10
|
-
|
|
22
|
+
export declare const formatDimensions: (dimensions: SE.DimensionsWithUnit) => string;
|
|
23
|
+
export declare function convertDimensions(dimensions: SE.DimensionsWithUnit, { allowAllZeroes }?: ConvertDimensionsOptions): {
|
|
24
|
+
unit: SE.DimensionUnit;
|
|
25
|
+
girth?: number | undefined;
|
|
26
|
+
height: number;
|
|
27
|
+
length: number;
|
|
28
|
+
lengthPlusGirth?: number | undefined;
|
|
29
|
+
noThreeSidesExceed?: number | undefined;
|
|
30
|
+
noTwoSidesExceed?: number | undefined;
|
|
31
|
+
volume?: number | undefined;
|
|
32
|
+
width: number;
|
|
33
|
+
} | undefined;
|
|
@@ -1,20 +1,46 @@
|
|
|
1
1
|
import { SE } from "@shipengine/alchemy";
|
|
2
2
|
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*
|
|
5
|
+
* # Sales Order Utilities - getCustomsFromSalesOrder
|
|
6
|
+
*
|
|
3
7
|
* @category Utilities
|
|
4
8
|
*/
|
|
5
9
|
export declare const getCustomsFromSalesOrder: (salesOrder: SE.SalesOrder, warehouse: SE.Warehouse) => SE.Customs;
|
|
6
10
|
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*
|
|
13
|
+
* # Sales Order Utilities - getIsCustomsRequiredForSalesOrder
|
|
14
|
+
*
|
|
7
15
|
* @category Utilities
|
|
8
16
|
*/
|
|
9
17
|
export declare const getIsCustomsRequiredForSalesOrder: ({ shipTo }: SE.SalesOrder, { originAddress }: SE.Warehouse) => boolean;
|
|
10
18
|
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*
|
|
21
|
+
* # Sales Order Utilities - getRequestedServices
|
|
22
|
+
*
|
|
11
23
|
* @category Utilities
|
|
12
24
|
*/
|
|
13
25
|
export declare const getRequestedServices: (salesOrder: SE.SalesOrder | undefined) => string[];
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*
|
|
29
|
+
* # Sales Order Shipment Type
|
|
30
|
+
*
|
|
31
|
+
* @category Utilities
|
|
32
|
+
*/
|
|
14
33
|
type SalesOrderOrShipment = {
|
|
15
34
|
salesOrder?: SE.SalesOrder;
|
|
16
35
|
shipment?: SE.SalesOrderShipment;
|
|
17
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* @internal
|
|
39
|
+
*
|
|
40
|
+
* # Sales Order Utilities - getSalesOrderItemsFromSalesOrderOrShipment
|
|
41
|
+
*
|
|
42
|
+
* @category Utilities
|
|
43
|
+
*/
|
|
18
44
|
export declare const getSalesOrderItemsFromSalesOrderOrShipment: ({ salesOrder, shipment, }: SalesOrderOrShipment) => {
|
|
19
45
|
detail: string;
|
|
20
46
|
name: string;
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import { SE } from "@shipengine/alchemy";
|
|
2
2
|
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*
|
|
5
|
+
* # Shipment Utilities - getIsInternationalShipment
|
|
6
|
+
*
|
|
3
7
|
* @category Utilities
|
|
4
8
|
*/
|
|
5
9
|
export declare const getIsInternationalShipment: ({ shipFrom, shipTo }: SE.SalesOrderShipment) => boolean;
|
|
6
10
|
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*
|
|
13
|
+
* # Shipment Utilities - getIsCustomsRequiredForShipment
|
|
14
|
+
*
|
|
7
15
|
* @category Utilities
|
|
8
16
|
*/
|
|
9
17
|
export declare const getIsCustomsRequiredForShipment: ({ shipFrom, shipTo }: SE.SalesOrderShipment) => boolean;
|
|
10
18
|
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*
|
|
21
|
+
* # Shipment Utilities - getPendingShipment
|
|
22
|
+
*
|
|
11
23
|
* @category Utilities
|
|
12
24
|
*/
|
|
13
25
|
export declare const getPendingShipment: (shipments?: SE.SalesOrderShipment[]) => SE.SalesOrderShipment | undefined;
|
|
@@ -1,13 +1,103 @@
|
|
|
1
1
|
import { SE } from "@shipengine/alchemy";
|
|
2
2
|
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*
|
|
5
|
+
* # Weight Utilities - isMetricWeightUnit
|
|
6
|
+
*
|
|
7
|
+
* - This utility function checks if the weight unit is `metric` and returns a `boolean`
|
|
8
|
+
* indicating if it is metric or not.
|
|
9
|
+
*
|
|
10
|
+
* @param unit The weight unit to check (optional).
|
|
11
|
+
*
|
|
12
|
+
* @returns boolean Indicating if the weight unit is `metric`.
|
|
13
|
+
*
|
|
3
14
|
* @category Utilities
|
|
4
15
|
*/
|
|
16
|
+
export declare const isMetricWeightUnit: (unit?: SE.WeightUnit) => unit is "gram" | "kilogram";
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*
|
|
20
|
+
* # Weight Utilities - isDecimalWeight
|
|
21
|
+
*
|
|
22
|
+
* - This utility function checks if the weight is a `decimal` weight and returns a `boolean`
|
|
23
|
+
* indicating if it is decimal or not.
|
|
24
|
+
*
|
|
25
|
+
* @param weight The weight to `check for a decimal` (optional).
|
|
26
|
+
*
|
|
27
|
+
* @returns boolean Indicating if the weight is a decimal weight.
|
|
28
|
+
*
|
|
29
|
+
* @category Utilities
|
|
30
|
+
*/
|
|
31
|
+
export declare const isDecimalWeight: (weight: SE.WeightWithUnit | SE.FractionalWeight) => weight is SE.WeightWithUnit;
|
|
32
|
+
/**
|
|
33
|
+
* @internal
|
|
34
|
+
*
|
|
35
|
+
* # Weight Utilities - convertPoundsAndOuncesToOunces
|
|
36
|
+
*
|
|
37
|
+
* - This utility function converts `pounds and ounces` to a `total of ounces`.
|
|
38
|
+
*
|
|
39
|
+
* @param weight The `pound + ounce` weight to convert to ounces.
|
|
40
|
+
*
|
|
41
|
+
* @returns number The total weight in `ounces`.
|
|
42
|
+
*
|
|
43
|
+
* @category Utilities
|
|
44
|
+
*/
|
|
45
|
+
export declare const convertPoundsAndOuncesToOunces: (weight: SE.FractionalWeight) => number;
|
|
46
|
+
/**
|
|
47
|
+
* @internal
|
|
48
|
+
*
|
|
49
|
+
* # Weight Utilities - convertFractionalWeightToDecimalWeight
|
|
50
|
+
*
|
|
51
|
+
* - This utility function converts a `fractional weight` to a `decimal weight`.
|
|
52
|
+
*
|
|
53
|
+
* @param weight The fractional weight to convert to a decimal weight.
|
|
54
|
+
* @param unit The target weight unit to convert to (optional).
|
|
55
|
+
*
|
|
56
|
+
* @returns WeightWithUnit The decimal weight with its unit.
|
|
57
|
+
*
|
|
58
|
+
* @category Utilities
|
|
59
|
+
*/
|
|
60
|
+
export declare const convertFractionalWeightToDecimalWeight: (weight: SE.FractionalWeight, unit?: SE.WeightUnit) => SE.WeightWithUnit;
|
|
61
|
+
/**
|
|
62
|
+
* @internal
|
|
63
|
+
*
|
|
64
|
+
* # Weight Utilities - convertDecimalWeightToFractionalWeight
|
|
65
|
+
*
|
|
66
|
+
* - This utility function converts a `decimal weight` to a `fractional weight`.
|
|
67
|
+
*
|
|
68
|
+
* @param weight The decimal weight to convert to a fractional weight.
|
|
69
|
+
*
|
|
70
|
+
* @returns FractionalWeight The converted fractional weight.
|
|
71
|
+
*
|
|
72
|
+
* @category Utilities
|
|
73
|
+
*/
|
|
74
|
+
export declare const convertDecimalWeightToFractionalWeight: (weight: SE.WeightWithUnit) => SE.FractionalWeight;
|
|
75
|
+
/**
|
|
76
|
+
* @internal
|
|
77
|
+
*
|
|
78
|
+
* # Weight Utilities - convertWeight/1
|
|
79
|
+
*/
|
|
5
80
|
export declare function convertWeight(weight: SE.WeightWithUnit): SE.FractionalWeight;
|
|
6
|
-
export declare function convertWeight(weight: SE.FractionalWeight): SE.WeightWithUnit;
|
|
7
81
|
/**
|
|
82
|
+
* @internal
|
|
83
|
+
*
|
|
84
|
+
* # Weight Utilities - convertWeight/2
|
|
85
|
+
*/
|
|
86
|
+
export declare function convertWeight(weight: SE.FractionalWeight, unit?: SE.WeightUnit): SE.WeightWithUnit;
|
|
87
|
+
/**
|
|
88
|
+
* @internal
|
|
89
|
+
*
|
|
90
|
+
* # Weight Utilities - formatFractionalWeight
|
|
91
|
+
*
|
|
92
|
+
* - This utility function formats a `fractional weight` for ease of use.
|
|
93
|
+
*
|
|
94
|
+
* @param weight The fractional weight to be formatted.
|
|
95
|
+
*
|
|
96
|
+
* @return FractionalWeight The formatted fractional weight.
|
|
97
|
+
*
|
|
8
98
|
* @category Utilities
|
|
9
99
|
*/
|
|
10
100
|
export declare function formatFractionalWeight(weight: {
|
|
11
101
|
fractional?: number | null;
|
|
12
102
|
whole?: number | null;
|
|
13
|
-
} | undefined | null): SE.FractionalWeight;
|
|
103
|
+
} | undefined | null, unit?: SE.WeightUnit): SE.FractionalWeight;
|
|
@@ -15,6 +15,8 @@ type NotGETUP = `get${Uncapitalize<string>}`;
|
|
|
15
15
|
type NotGetterKey = NotG | NotGE | NotGET | NotGETUP;
|
|
16
16
|
type StylesConstraint = Record<GetterKey, GetterFunction> & Record<`${NotGetterKey}${string}`, Interpolation<Theme>>;
|
|
17
17
|
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*
|
|
18
20
|
* Creates a Record of Emotion styles; eliminating the need to explicitly type styles
|
|
19
21
|
* while remaining fully typesafe w/ autocomplete.
|
|
20
22
|
*
|
|
@@ -34,6 +36,8 @@ type StylesConstraint = Record<GetterKey, GetterFunction> & Record<`${NotGetterK
|
|
|
34
36
|
* }),
|
|
35
37
|
* });
|
|
36
38
|
* ```
|
|
39
|
+
*
|
|
40
|
+
* @category Utilities
|
|
37
41
|
*/
|
|
38
42
|
export declare const createStyles: <T extends StylesConstraint>(styles: T) => T;
|
|
39
43
|
export {};
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { Resolver } from "@hookform/resolvers/zod";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*
|
|
6
|
+
* # Error Map
|
|
7
|
+
*
|
|
4
8
|
* @category Utilities
|
|
5
9
|
*/
|
|
6
10
|
export declare const errorMap: z.ZodErrorMap;
|
|
7
11
|
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*
|
|
14
|
+
* # Validation Resolver
|
|
15
|
+
*
|
|
8
16
|
* @category Utilities
|
|
9
17
|
*/
|
|
10
18
|
export declare const validationResolver: <T extends z.ZodType<any, any, any>>(schema: T) => ReturnType<Resolver>;
|