@shipengine/elements 0.36.0 → 0.37.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/index.cjs +541 -207
- package/index.js +542 -208
- package/package.json +1 -1
- package/src/components/field/rate-card/rate-card.d.ts +3 -1
- package/src/components/field/rate-card/rate-card.styles.d.ts +2 -0
- package/src/components/field/rate-select/rate-select.d.ts +2 -0
- package/src/components/fund-and-purchase/fund-and-purchase.d.ts +2 -1
- package/src/components/templates/rate-form/rate-form.d.ts +4 -2
- package/src/components/templates/shipment-form/shipment-form.d.ts +7 -7
- package/src/elements/account-settings/account-settings.d.ts +8 -1
- package/src/elements/configure-shipment/configure-shipment.d.ts +19 -1
- package/src/elements/configure-shipment/hooks/index.d.ts +2 -0
- package/src/elements/configure-shipment/hooks/use-rates-form.d.ts +14 -2
- package/src/elements/configure-shipment/hooks/use-rates-with-cache.d.ts +5 -3
- package/src/elements/configure-shipment/hooks/use-request-preferred-rates.d.ts +7 -0
- package/src/elements/configure-shipment/hooks/use-request-rates.d.ts +5 -2
- package/src/elements/onboarding/onboarding.d.ts +8 -1
- package/src/elements/purchase-label/purchase-label.d.ts +60 -36
- package/src/elements/view-shipment/view-shipment.d.ts +8 -1
- package/src/elements/void-label/void-label.d.ts +8 -1
- package/src/hooks/options/use-rate-options.d.ts +3 -1
- package/src/locales/en/index.d.ts +8 -1
- package/src/utilities/feature-flags.d.ts +11 -0
package/package.json
CHANGED
|
@@ -2,10 +2,12 @@ import { WithCommonProps } from "@packlink/giger";
|
|
|
2
2
|
import { RateOption } from "../../../hooks";
|
|
3
3
|
export type RateCardProps = Partial<RateOption> & WithCommonProps<{
|
|
4
4
|
isAcknowledged?: boolean;
|
|
5
|
+
isPreferredRate?: boolean;
|
|
5
6
|
onClick?: (rateId: string) => void;
|
|
6
7
|
onClickAcknowledgement?: (isAcknowledged: boolean) => void;
|
|
7
8
|
selected?: boolean;
|
|
9
|
+
selectedRateCost?: number;
|
|
8
10
|
voided?: boolean;
|
|
9
11
|
voidedAt?: string;
|
|
10
12
|
}>;
|
|
11
|
-
export declare const RateCard: ({ carrierCode, carrierFriendlyName, carrierNickname, children, className, confirmationAmount, deliveryDays, insuranceAmount, isAcknowledged, messages, onClick, onClickAcknowledgement, otherAmount, rateId, requiresAcknowledgement, selected, serviceCode, packageType, serviceType, shippingAmount, taxAmount, voided, voidedAt, }: RateCardProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const RateCard: ({ carrierCode, carrierFriendlyName, carrierNickname, children, className, confirmationAmount, deliveryDays, insuranceAmount, isAcknowledged, messages, onClick, onClickAcknowledgement, otherAmount, rateId, requiresAcknowledgement, rateAcknowledgementMessage, selected, serviceCode, packageType, serviceType, shippingAmount, taxAmount, voided, voidedAt, isPreferredRate, selectedRateCost, }: RateCardProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -7,6 +7,8 @@ export declare const getArticleSelectedStyles: (theme: Theme) => SerializedStyle
|
|
|
7
7
|
export declare const getArticleVoidedStyles: () => SerializedStyles;
|
|
8
8
|
export declare const getSectionStyles: (theme: Theme) => SerializedStyles;
|
|
9
9
|
export declare const getRateImageStyles: (theme: Theme) => SerializedStyles;
|
|
10
|
+
export declare const getRateSavingsSectionStyles: () => SerializedStyles;
|
|
11
|
+
export declare const getRateSavingsStyles: (theme: Theme) => SerializedStyles;
|
|
10
12
|
export declare const getRateInfoStyles: (theme: Theme) => SerializedStyles;
|
|
11
13
|
export declare const getServiceTypeStyles: (theme: Theme) => SerializedStyles;
|
|
12
14
|
export declare const getCarrierNameStyles: (theme: Theme) => SerializedStyles;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { RateOption } from "../../../hooks";
|
|
2
|
+
import { RateFormProps } from "../../templates";
|
|
2
3
|
import { ControlledField } from "../create-field-controller";
|
|
3
4
|
type RateSelectProps = {
|
|
4
5
|
nicknameFeature?: boolean;
|
|
5
6
|
options: RateOption[];
|
|
7
|
+
preferredServiceCodes?: RateFormProps["preferredServiceCodes"];
|
|
6
8
|
};
|
|
7
9
|
type RateSelectOptions = {
|
|
8
10
|
onClick?: (rateId: string) => void;
|
|
@@ -14,6 +14,7 @@ export type FundAndPurchaseProps = {
|
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
isFundingEnabled?: boolean;
|
|
16
16
|
isFundingRequired: boolean;
|
|
17
|
+
isPreferredRate?: boolean;
|
|
17
18
|
onPurchase: () => void;
|
|
18
19
|
onSave: () => Promise<void>;
|
|
19
20
|
purchaseAmount: number;
|
|
@@ -29,4 +30,4 @@ export type FundAndPurchaseProps = {
|
|
|
29
30
|
*
|
|
30
31
|
* @see {@link FundAndPurchaseProps | The props that are passed into the `<FundAndPurchase />` component}
|
|
31
32
|
*/
|
|
32
|
-
export declare const FundAndPurchase: ({ balance: uspsBalance, carrierId, className, control, disabled, isFundingEnabled, isFundingRequired, onSave, purchaseAmount, onPurchase, }: FundAndPurchaseProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
33
|
+
export declare const FundAndPurchase: ({ balance: uspsBalance, carrierId, className, control, disabled, isFundingEnabled, isFundingRequired, isPreferredRate, onSave, purchaseAmount, onPurchase, }: FundAndPurchaseProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SE } from "@shipengine/alchemy";
|
|
2
|
-
import { ConfigureShipmentFeatures } from "../../../elements/configure-shipment";
|
|
2
|
+
import { ConfigureShipmentFeatures, PreferredRatesResponse } from "../../../elements/configure-shipment";
|
|
3
3
|
export type RateFormProps = {
|
|
4
4
|
carriers?: SE.Carrier[];
|
|
5
5
|
disabled?: boolean;
|
|
@@ -15,7 +15,9 @@ export type RateFormProps = {
|
|
|
15
15
|
onSelectRate?: (rateId: string) => void;
|
|
16
16
|
onSubmit?: (rateId: string) => Promise<void> | void;
|
|
17
17
|
outOfBandDisplayableErrors?: string[];
|
|
18
|
+
preferredRates?: PreferredRatesResponse;
|
|
19
|
+
preferredServiceCodes?: string[];
|
|
18
20
|
rates?: SE.Rate[];
|
|
19
21
|
shipment?: SE.SalesOrderShipment;
|
|
20
22
|
};
|
|
21
|
-
export declare const RateForm: ({ carriers, disabled, errors, displayableRateErrors, displayableLabelErrors, features, labelErrors, labels, labelsLoading, isLoading, onSave, onSelectRate, onSubmit, rates, shipment, outOfBandDisplayableErrors, }: RateFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare const RateForm: ({ carriers, disabled, errors, displayableRateErrors, displayableLabelErrors, features, labelErrors, labels, labelsLoading, isLoading, onSave, onSelectRate, onSubmit, rates, preferredRates, shipment, outOfBandDisplayableErrors, preferredServiceCodes, }: RateFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -8,6 +8,13 @@ export type OnChangeAddressOptions = {
|
|
|
8
8
|
shouldValidate?: boolean;
|
|
9
9
|
};
|
|
10
10
|
export type ShipmentFormMode = "browse_rates" | "select_service";
|
|
11
|
+
export type ShipmentFormFeatures = {
|
|
12
|
+
browseRates?: boolean;
|
|
13
|
+
includeShipsuranceInsurance?: boolean;
|
|
14
|
+
includeThirdPartyInsurance?: boolean;
|
|
15
|
+
selectService?: boolean;
|
|
16
|
+
shippingPresets?: boolean;
|
|
17
|
+
};
|
|
11
18
|
export type ShipmentFormProps = {
|
|
12
19
|
accountSettings?: SE.AccountSettings;
|
|
13
20
|
addressLoading: boolean;
|
|
@@ -45,11 +52,4 @@ export type CharsetWarning = {
|
|
|
45
52
|
message: string;
|
|
46
53
|
title?: string;
|
|
47
54
|
};
|
|
48
|
-
export type ShipmentFormFeatures = {
|
|
49
|
-
browseRates?: boolean;
|
|
50
|
-
includeShipsuranceInsurance?: boolean;
|
|
51
|
-
includeThirdPartyInsurance?: boolean;
|
|
52
|
-
selectService?: boolean;
|
|
53
|
-
shippingPresets?: boolean;
|
|
54
|
-
};
|
|
55
55
|
export declare const ShipmentForm: ({ accountSettings, 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;
|
|
@@ -323,8 +323,15 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
323
323
|
rates: {
|
|
324
324
|
uspsMediaMailAcknowledgement: string;
|
|
325
325
|
uspsFirstClassMailAcknowledgement_leof: string;
|
|
326
|
+
rateSavings: string;
|
|
327
|
+
upsGroundSaverTermsAcknowledgement: string;
|
|
326
328
|
dhlExpressTermsAcknowledgement: string;
|
|
327
329
|
};
|
|
330
|
+
requirements: {
|
|
331
|
+
noWarehouse: string;
|
|
332
|
+
noCarrier: string;
|
|
333
|
+
noWarehouseOrCarrier: string;
|
|
334
|
+
};
|
|
328
335
|
shipToAddressFormFields: string;
|
|
329
336
|
sections: {
|
|
330
337
|
customsForm: string;
|
|
@@ -616,7 +623,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
616
623
|
errorMessages: {
|
|
617
624
|
invalidNameOrCompany: string;
|
|
618
625
|
parsingFailure: string;
|
|
619
|
-
|
|
626
|
+
incompleteLabelPurchaseRequirements: string;
|
|
620
627
|
unableToLoad: {
|
|
621
628
|
accountSettings: string;
|
|
622
629
|
autoFundingSettings: string;
|
|
@@ -2,6 +2,18 @@ import { SE } from "@shipengine/alchemy";
|
|
|
2
2
|
import { Templates } from "../../components";
|
|
3
3
|
import { UseShippingPresetsOptionsProps } from "../../hooks";
|
|
4
4
|
import { UseRatesFormProps, UseShipmentFormProps } from "./hooks";
|
|
5
|
+
export type PreferredRateAcknowledgementMessage = {
|
|
6
|
+
link?: {
|
|
7
|
+
text: string;
|
|
8
|
+
url: string;
|
|
9
|
+
};
|
|
10
|
+
primaryMessage: string;
|
|
11
|
+
secondaryMessage?: string;
|
|
12
|
+
};
|
|
13
|
+
export type PreferredRatesResponse = Array<{
|
|
14
|
+
rate: SE.Rate;
|
|
15
|
+
rateAcknowledgementMessage?: PreferredRateAcknowledgementMessage;
|
|
16
|
+
}>;
|
|
5
17
|
export type ShipmentFormMode = "browse_rates" | "select_service";
|
|
6
18
|
export type RateFormFeatures = {
|
|
7
19
|
enableFunding?: boolean;
|
|
@@ -13,6 +25,9 @@ export type RateFormFeatures = {
|
|
|
13
25
|
};
|
|
14
26
|
export type ConfigureShipmentFeatures = {
|
|
15
27
|
compatibleCountryCodes?: UseShipmentFormProps["compatibleCountryCodes"];
|
|
28
|
+
partnerMessages?: {
|
|
29
|
+
incompleteLabelPurchaseRequirements?: string;
|
|
30
|
+
};
|
|
16
31
|
presentation?: {
|
|
17
32
|
poweredByShipEngine?: boolean;
|
|
18
33
|
};
|
|
@@ -22,10 +37,12 @@ export type ConfigureShipmentFeatures = {
|
|
|
22
37
|
export type ConfigureShipmentProps = {
|
|
23
38
|
errors?: Templates.ShipmentFormProps["errors"];
|
|
24
39
|
features?: ConfigureShipmentFeatures;
|
|
40
|
+
getPreferredRates?: (shipment: SE.SalesOrderShipment, isInternational: boolean) => Promise<PreferredRatesResponse | undefined>;
|
|
25
41
|
isLoading?: Templates.ShipmentFormProps["isLoading"];
|
|
26
42
|
onAddressValidation?: UseShipmentFormProps["onAddressValidation"];
|
|
27
43
|
onApplyPreset?: UseShipmentFormProps["onApplyPreset"];
|
|
28
44
|
onBeforeLabelCreate?: UseRatesFormProps["onBeforeLabelCreate"];
|
|
45
|
+
onBeforeRateSaved?: UseRatesFormProps["onBeforeRateSaved"];
|
|
29
46
|
onChangeAddress?: UseShipmentFormProps["onChangeAddress"];
|
|
30
47
|
onChangeShipmentFormMode?: Templates.ShipmentFormProps["onChangeMode"];
|
|
31
48
|
onLabelCreateFailure?: UseRatesFormProps["onLabelCreateFailure"];
|
|
@@ -34,10 +51,11 @@ export type ConfigureShipmentProps = {
|
|
|
34
51
|
onRatesCalculated?: UseRatesFormProps["onRatesCalculated"];
|
|
35
52
|
onShipmentUpdated: UseShipmentFormProps["onShipmentUpdated"];
|
|
36
53
|
onToggleAddressPreferenceDisclosure?: Templates.ShipmentFormProps["onToggleAddressPreferenceDisclosure"];
|
|
54
|
+
preferredServiceCodes?: Templates.RateFormProps["preferredServiceCodes"];
|
|
37
55
|
printLabelLayout?: UseRatesFormProps["printLabelLayout"];
|
|
38
56
|
salesOrder?: SE.SalesOrder;
|
|
39
57
|
shipment?: SE.SalesOrderShipment;
|
|
40
58
|
shippingPresets?: UseShippingPresetsOptionsProps;
|
|
41
59
|
warehouseId?: string;
|
|
42
60
|
};
|
|
43
|
-
export declare const ConfigureShipment: ({ features, onAddressValidation, onApplyPreset, onBeforeLabelCreate, onChangeAddress, onLabelCreateFailure, onLabelCreateSuccess, onRateSaved, onRatesCalculated, onShipmentUpdated, printLabelLayout, salesOrder, shipment, ...props }: ConfigureShipmentProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
61
|
+
export declare const ConfigureShipment: ({ features, getPreferredRates, onAddressValidation, onApplyPreset, onBeforeLabelCreate, onChangeAddress, onLabelCreateFailure, onLabelCreateSuccess, onRateSaved, onRatesCalculated, onShipmentUpdated, printLabelLayout, preferredServiceCodes, salesOrder, shipment, onBeforeRateSaved, ...props }: ConfigureShipmentProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { SE } from "@shipengine/alchemy";
|
|
2
2
|
import { UseRatesWithCacheProps } from "./use-rates-with-cache";
|
|
3
3
|
export type UseRatesFormProps = {
|
|
4
|
-
|
|
4
|
+
getPreferredRates?: UseRatesWithCacheProps["getPreferredRates"];
|
|
5
|
+
onBeforeLabelCreate?: (rate: SE.Rate, shipment: SE.SalesOrderShipment) => Promise<void> | Promise<{
|
|
6
|
+
error?: SE.CodedError;
|
|
7
|
+
rate?: SE.Rate;
|
|
8
|
+
}> | void;
|
|
9
|
+
onBeforeRateSaved?: (carrierId: string, serviceCode: string) => Promise<void> | Promise<{
|
|
10
|
+
data?: {
|
|
11
|
+
carrierId: string;
|
|
12
|
+
serviceCode: string;
|
|
13
|
+
};
|
|
14
|
+
error?: SE.CodedError;
|
|
15
|
+
}> | void;
|
|
5
16
|
onLabelCreateFailure?: (rate: SE.Rate, shipment: SE.SalesOrderShipment) => Promise<void> | void;
|
|
6
17
|
onLabelCreateSuccess?: (label: SE.Label, shipment: SE.SalesOrderShipment) => Promise<void> | void;
|
|
7
18
|
onRateSaved?: (shipment: SE.SalesOrderShipment) => Promise<void> | void;
|
|
@@ -10,7 +21,7 @@ export type UseRatesFormProps = {
|
|
|
10
21
|
printLabelLayout?: SE.LabelLayout;
|
|
11
22
|
shipment?: SE.SalesOrderShipment;
|
|
12
23
|
};
|
|
13
|
-
export declare const useRatesForm: ({ onBeforeLabelCreate, onLabelCreateFailure, onLabelCreateSuccess, onRateSaved, onRatesCalculated, onShipmentUpdated, printLabelLayout, shipment, }: UseRatesFormProps) => {
|
|
24
|
+
export declare const useRatesForm: ({ getPreferredRates, onBeforeRateSaved, onBeforeLabelCreate, onLabelCreateFailure, onLabelCreateSuccess, onRateSaved, onRatesCalculated, onShipmentUpdated, printLabelLayout, shipment, }: UseRatesFormProps) => {
|
|
14
25
|
carriers: SE.Carrier[] | undefined;
|
|
15
26
|
displayableLabelErrors: string[] | undefined;
|
|
16
27
|
displayableRateErrors: string[] | undefined;
|
|
@@ -21,6 +32,7 @@ export declare const useRatesForm: ({ onBeforeLabelCreate, onLabelCreateFailure,
|
|
|
21
32
|
labelsLoading: boolean;
|
|
22
33
|
onSave: ({ carrierId, serviceCode }: Pick<SE.Rate, "carrierId" | "serviceCode">) => Promise<void>;
|
|
23
34
|
onSubmit: (rateId: string) => Promise<void>;
|
|
35
|
+
preferredRates: import("..").PreferredRatesResponse | undefined;
|
|
24
36
|
rates: SE.Rate[] | undefined;
|
|
25
37
|
requestRates: (shipment: SE.SalesOrderShipment, isInternational: boolean) => Promise<void>;
|
|
26
38
|
resetLabel: () => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SE } from "@shipengine/alchemy";
|
|
2
2
|
import { UseRequestRatesProps } from "./use-request-rates";
|
|
3
3
|
export type UseRatesWithCacheProps = {
|
|
4
|
+
getPreferredRates?: UseRequestRatesProps["getPreferredRates"];
|
|
4
5
|
onRatesCalculated: UseRequestRatesProps["onRatesCalculated"];
|
|
5
6
|
shipment?: SE.SalesOrderShipment;
|
|
6
7
|
};
|
|
@@ -13,10 +14,11 @@ export type UseRatesWithCacheProps = {
|
|
|
13
14
|
* It also intercepts the resetRates function from useRequestRates to set a flag to ignore this caching.
|
|
14
15
|
* (this transparently returns the behaviors to the default useRequestRates behavior)
|
|
15
16
|
*/
|
|
16
|
-
export declare const useRatesWithCache: ({ shipment, onRatesCalculated }: UseRatesWithCacheProps) => {
|
|
17
|
+
export declare const useRatesWithCache: ({ shipment, onRatesCalculated, getPreferredRates, }: UseRatesWithCacheProps) => {
|
|
18
|
+
preferredRatesResponse: import("..").PreferredRatesResponse | undefined;
|
|
17
19
|
ratesCalculating: boolean;
|
|
18
20
|
ratesErrors: SE.CodedError[] | null;
|
|
19
|
-
ratesResponse:
|
|
21
|
+
ratesResponse: {
|
|
20
22
|
created_at: string;
|
|
21
23
|
errors: SE.CodedError[];
|
|
22
24
|
invalidRates: SE.Rate[];
|
|
@@ -24,7 +26,7 @@ export declare const useRatesWithCache: ({ shipment, onRatesCalculated }: UseRat
|
|
|
24
26
|
rates: SE.Rate[];
|
|
25
27
|
shipment_id: string;
|
|
26
28
|
status: "error" | "working" | "completed" | "partial";
|
|
27
|
-
} | undefined;
|
|
29
|
+
} | SE.RateResponse | undefined;
|
|
28
30
|
requestRates: (shipment: SE.SalesOrderShipment, isInternational: boolean) => Promise<void>;
|
|
29
31
|
resetRates: () => void;
|
|
30
32
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SE } from "@shipengine/alchemy";
|
|
2
|
+
import { UseRequestRatesProps } from "./use-request-rates";
|
|
3
|
+
export type RequestPreferredRatesProps = {
|
|
4
|
+
getPreferredRates?: UseRequestRatesProps["getPreferredRates"];
|
|
5
|
+
};
|
|
6
|
+
export type CalculatePreferredRatesData = Parameters<Required<UseRequestRatesProps>["getPreferredRates"]>;
|
|
7
|
+
export declare const useRequestPreferredRates: ({ getPreferredRates }: RequestPreferredRatesProps) => import("react-query").UseMutationResult<import("..").PreferredRatesResponse | undefined, SE.CodedError[], [shipment: SE.SalesOrderShipment, isInternational: boolean], unknown>;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { SE } from "@shipengine/alchemy";
|
|
2
|
+
import { ConfigureShipmentProps, PreferredRatesResponse } from "../configure-shipment";
|
|
2
3
|
export type UseRequestRatesProps = {
|
|
4
|
+
getPreferredRates?: ConfigureShipmentProps["getPreferredRates"];
|
|
3
5
|
onRatesCalculated?: (rates: SE.Rate[], shipment: SE.SalesOrderShipment) => Promise<void> | void;
|
|
4
6
|
};
|
|
5
|
-
export declare const useRequestRates: ({ onRatesCalculated }: UseRequestRatesProps) => {
|
|
6
|
-
|
|
7
|
+
export declare const useRequestRates: ({ onRatesCalculated, getPreferredRates }: UseRequestRatesProps) => {
|
|
8
|
+
isCalculating: boolean;
|
|
9
|
+
preferredRatesResponse: PreferredRatesResponse | undefined;
|
|
7
10
|
ratesErrors: SE.CodedError[] | null;
|
|
8
11
|
ratesResponse: SE.RateResponse | undefined;
|
|
9
12
|
requestRates: (shipment: SE.SalesOrderShipment, isInternational: boolean) => Promise<void>;
|
|
@@ -290,8 +290,15 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
290
290
|
rates: {
|
|
291
291
|
uspsMediaMailAcknowledgement: string;
|
|
292
292
|
uspsFirstClassMailAcknowledgement_leof: string;
|
|
293
|
+
rateSavings: string;
|
|
294
|
+
upsGroundSaverTermsAcknowledgement: string;
|
|
293
295
|
dhlExpressTermsAcknowledgement: string;
|
|
294
296
|
};
|
|
297
|
+
requirements: {
|
|
298
|
+
noWarehouse: string;
|
|
299
|
+
noCarrier: string;
|
|
300
|
+
noWarehouseOrCarrier: string;
|
|
301
|
+
};
|
|
295
302
|
shipToAddressFormFields: string;
|
|
296
303
|
sections: {
|
|
297
304
|
customsForm: string;
|
|
@@ -578,7 +585,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
578
585
|
errorMessages: {
|
|
579
586
|
invalidNameOrCompany: string;
|
|
580
587
|
parsingFailure: string;
|
|
581
|
-
|
|
588
|
+
incompleteLabelPurchaseRequirements: string;
|
|
582
589
|
unableToLoad: {
|
|
583
590
|
accountSettings: string;
|
|
584
591
|
autoFundingSettings: string;
|
|
@@ -17,6 +17,15 @@ export type PurchaseLabelCommonProps = {
|
|
|
17
17
|
* `features` is a set of feature flags you would like to enable or disable in this component.
|
|
18
18
|
*/
|
|
19
19
|
features?: ConfigureShipmentProps["features"];
|
|
20
|
+
/**
|
|
21
|
+
*`getPreferredRates is an async/sync optional callback function that will be invoked each time rates are caculated.
|
|
22
|
+
* This is an optional callback function that returns an array of ShipEngine rates. The rates from this response will
|
|
23
|
+
* be spliced into the normal get rates response the Elements makes internally. If a service code matches a service
|
|
24
|
+
* code on a rate returned from getPreferredRates, the rate returned from getPreferredRates will not be shown in the
|
|
25
|
+
* rate form. These preferred rates will be displayed with a set of UI enhancements that incude a dynamic cost savings
|
|
26
|
+
* flag and green checkmark when the rate is selected.
|
|
27
|
+
*/
|
|
28
|
+
getPreferredRates?: ConfigureShipmentProps["getPreferredRates"];
|
|
20
29
|
/**
|
|
21
30
|
* `onAddressValidation` is an async/sync callback function that will be invoked on each Address
|
|
22
31
|
* validation request. For example, whenever you update the `Ship To Address` or
|
|
@@ -33,6 +42,11 @@ export type PurchaseLabelCommonProps = {
|
|
|
33
42
|
* label purchase.
|
|
34
43
|
*/
|
|
35
44
|
onBeforeLabelCreate?: ConfigureShipmentProps["onBeforeLabelCreate"];
|
|
45
|
+
/**
|
|
46
|
+
* `onBeforeRateSave` is an async/sync callback function that will be invoked before each time a user
|
|
47
|
+
* saves a rate.
|
|
48
|
+
*/
|
|
49
|
+
onBeforeRateSaved?: ConfigureShipmentProps["onBeforeRateSaved"];
|
|
36
50
|
/**
|
|
37
51
|
* `onChangeAddress` is an async/sync callback function that will be invoked each time a
|
|
38
52
|
* `Ship To Address` or `Ship From Address` has been updated.
|
|
@@ -80,6 +94,11 @@ export type PurchaseLabelCommonProps = {
|
|
|
80
94
|
* the formatted address that we return after validation.
|
|
81
95
|
*/
|
|
82
96
|
onToggleAddressPreferenceDisclosure?: ConfigureShipmentProps["onToggleAddressPreferenceDisclosure"];
|
|
97
|
+
/**
|
|
98
|
+
* `preferredServiceCodes` is an array of service codes you would like to be marked as preferred. The services
|
|
99
|
+
* codes corresponding rate will get the same UI enhancements as the rates received from getPreferredRates.
|
|
100
|
+
*/
|
|
101
|
+
preferredServiceCodes?: ConfigureShipmentProps["preferredServiceCodes"];
|
|
83
102
|
/**
|
|
84
103
|
* `printLabelLayout` is a string that represents the label layout you would like to use when
|
|
85
104
|
* purchasing a label. e.g. `4x6`
|
|
@@ -130,7 +149,7 @@ export type ElementProps = PurchaseLabelByShipmentProps | PurchaseLabelSalesOrde
|
|
|
130
149
|
*
|
|
131
150
|
* @see {@link PurchaseLabel.Element | The **Element** created to render `<PurchaseLabel />`}
|
|
132
151
|
*/
|
|
133
|
-
export declare const Component: ({ ...props }: ElementProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
152
|
+
export declare const Component: ({ features, ...props }: ElementProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
134
153
|
/**
|
|
135
154
|
* # Registered Purchase Label Element
|
|
136
155
|
*
|
|
@@ -235,7 +254,14 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
235
254
|
highVolumeForms: string;
|
|
236
255
|
multipleShippingServices: string;
|
|
237
256
|
sections: {
|
|
238
|
-
labels: string;
|
|
257
|
+
labels: string; /**
|
|
258
|
+
*`getPreferredRates is an async/sync optional callback function that will be invoked each time rates are caculated.
|
|
259
|
+
* This is an optional callback function that returns an array of ShipEngine rates. The rates from this response will
|
|
260
|
+
* be spliced into the normal get rates response the Elements makes internally. If a service code matches a service
|
|
261
|
+
* code on a rate returned from getPreferredRates, the rate returned from getPreferredRates will not be shown in the
|
|
262
|
+
* rate form. These preferred rates will be displayed with a set of UI enhancements that incude a dynamic cost savings
|
|
263
|
+
* flag and green checkmark when the rate is selected.
|
|
264
|
+
*/
|
|
239
265
|
};
|
|
240
266
|
noLabels: string;
|
|
241
267
|
};
|
|
@@ -309,22 +335,12 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
309
335
|
currentBalance: string;
|
|
310
336
|
insufficientBalanceCTA: string;
|
|
311
337
|
};
|
|
312
|
-
/**
|
|
313
|
-
* # Purchase Label Component Props
|
|
314
|
-
*
|
|
315
|
-
* These are the shared props that will be passed into the `<PurchaseLabel.Element />`, and work
|
|
316
|
-
* for either shipment-based or sales order-based label purchasing.
|
|
317
|
-
*
|
|
318
|
-
* @see {@link PurchaseLabel.Element | This prop types usage in `<PurchaseLabel.Element />`}
|
|
319
|
-
*/
|
|
320
338
|
cta: {
|
|
321
339
|
addPackageDetails: string;
|
|
322
340
|
};
|
|
323
341
|
errorMessages: {
|
|
324
342
|
customsItemsRequired: string;
|
|
325
|
-
invalidAddress: string;
|
|
326
|
-
* `features` is a set of feature flags you would like to enable or disable in this component.
|
|
327
|
-
*/
|
|
343
|
+
invalidAddress: string;
|
|
328
344
|
noRates: string;
|
|
329
345
|
salesOrderNotLoaded: string;
|
|
330
346
|
unsupportedAddress: string;
|
|
@@ -367,6 +383,10 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
367
383
|
today: string;
|
|
368
384
|
};
|
|
369
385
|
hints: {
|
|
386
|
+
/**
|
|
387
|
+
* `onBeforeRateSave` is an async/sync callback function that will be invoked before each time a user
|
|
388
|
+
* saves a rate.
|
|
389
|
+
*/
|
|
370
390
|
contentDescription: string;
|
|
371
391
|
};
|
|
372
392
|
loading: {
|
|
@@ -385,8 +405,18 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
385
405
|
rates: {
|
|
386
406
|
uspsMediaMailAcknowledgement: string;
|
|
387
407
|
uspsFirstClassMailAcknowledgement_leof: string;
|
|
408
|
+
rateSavings: string; /**
|
|
409
|
+
* `onLabelCreateSuccess` is an async/sync callback provided by the client that is invoked if the
|
|
410
|
+
* label is successfully created/purchased.
|
|
411
|
+
*/
|
|
412
|
+
upsGroundSaverTermsAcknowledgement: string;
|
|
388
413
|
dhlExpressTermsAcknowledgement: string;
|
|
389
414
|
};
|
|
415
|
+
requirements: {
|
|
416
|
+
noWarehouse: string;
|
|
417
|
+
noCarrier: string;
|
|
418
|
+
noWarehouseOrCarrier: string;
|
|
419
|
+
};
|
|
390
420
|
shipToAddressFormFields: string;
|
|
391
421
|
sections: {
|
|
392
422
|
customsForm: string;
|
|
@@ -423,6 +453,9 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
423
453
|
inlineMessage: string;
|
|
424
454
|
};
|
|
425
455
|
success: {
|
|
456
|
+
/**
|
|
457
|
+
* `features` is a set of feature flags you would like to enable or disable in this component.
|
|
458
|
+
*/
|
|
426
459
|
title: string;
|
|
427
460
|
subtitle: string;
|
|
428
461
|
action: string;
|
|
@@ -447,14 +480,6 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
447
480
|
status: {
|
|
448
481
|
saving: string;
|
|
449
482
|
saved: string;
|
|
450
|
-
/**
|
|
451
|
-
* # Purchase Label Component Props
|
|
452
|
-
*
|
|
453
|
-
* These are the shared props that will be passed into the `<PurchaseLabel.Element />`, and work
|
|
454
|
-
* for either shipment-based or sales order-based label purchasing.
|
|
455
|
-
*
|
|
456
|
-
* @see {@link PurchaseLabel.Element | This prop types usage in `<PurchaseLabel.Element />`}
|
|
457
|
-
*/
|
|
458
483
|
savingFailed: string;
|
|
459
484
|
};
|
|
460
485
|
units: {
|
|
@@ -468,9 +493,7 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
468
493
|
title: string;
|
|
469
494
|
standard: string;
|
|
470
495
|
g: string;
|
|
471
|
-
kg: string;
|
|
472
|
-
* `features` is a set of feature flags you would like to enable or disable in this component.
|
|
473
|
-
*/
|
|
496
|
+
kg: string;
|
|
474
497
|
};
|
|
475
498
|
};
|
|
476
499
|
};
|
|
@@ -663,12 +686,7 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
663
686
|
fields: {
|
|
664
687
|
contentsType: string;
|
|
665
688
|
countryOfOrigin: string;
|
|
666
|
-
description: string;
|
|
667
|
-
* `onToggleAddressPreferenceDisclosure` is an async/sync callback function that will be invoked
|
|
668
|
-
* each time the user toggles the `Address Preference` disclosure. This disclosure component
|
|
669
|
-
* allows the user to select whether they would like to use the address they entered, or
|
|
670
|
-
* the formatted address that we return after validation.
|
|
671
|
-
*/
|
|
689
|
+
description: string;
|
|
672
690
|
harmonizedTariffCode: string;
|
|
673
691
|
ifDeliveryFails: string;
|
|
674
692
|
quantity: string;
|
|
@@ -685,16 +703,19 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
685
703
|
};
|
|
686
704
|
errorMessages: {
|
|
687
705
|
invalidNameOrCompany: string;
|
|
688
|
-
parsingFailure: string;
|
|
689
|
-
|
|
690
|
-
* (dimensions, shipping service, etc) that can be applied to a shipment when purchasing a label.
|
|
691
|
-
*/
|
|
692
|
-
noWarehouses: string;
|
|
706
|
+
parsingFailure: string;
|
|
707
|
+
incompleteLabelPurchaseRequirements: string;
|
|
693
708
|
unableToLoad: {
|
|
694
709
|
accountSettings: string;
|
|
695
710
|
autoFundingSettings: string;
|
|
696
711
|
carrier: string;
|
|
697
712
|
carriers: string;
|
|
713
|
+
/**
|
|
714
|
+
* `onToggleAddressPreferenceDisclosure` is an async/sync callback function that will be invoked
|
|
715
|
+
* each time the user toggles the `Address Preference` disclosure. This disclosure component
|
|
716
|
+
* allows the user to select whether they would like to use the address they entered, or
|
|
717
|
+
* the formatted address that we return after validation.
|
|
718
|
+
*/
|
|
698
719
|
label: string;
|
|
699
720
|
salesOrder: string;
|
|
700
721
|
shipment: string;
|
|
@@ -727,7 +748,10 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
727
748
|
connectingCarriers: string;
|
|
728
749
|
data: string;
|
|
729
750
|
importingSalesOrder: string;
|
|
730
|
-
label: string;
|
|
751
|
+
label: string; /**
|
|
752
|
+
* `warehouseId` is a string that represents a previously configured warehouse you would
|
|
753
|
+
* like to use as the `Ship From Address` when purchasing a label.
|
|
754
|
+
*/
|
|
731
755
|
onboarding: string;
|
|
732
756
|
salesOrder: string;
|
|
733
757
|
shipment: string;
|
|
@@ -295,8 +295,15 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
295
295
|
rates: {
|
|
296
296
|
uspsMediaMailAcknowledgement: string;
|
|
297
297
|
uspsFirstClassMailAcknowledgement_leof: string;
|
|
298
|
+
rateSavings: string;
|
|
299
|
+
upsGroundSaverTermsAcknowledgement: string;
|
|
298
300
|
dhlExpressTermsAcknowledgement: string;
|
|
299
301
|
};
|
|
302
|
+
requirements: {
|
|
303
|
+
noWarehouse: string;
|
|
304
|
+
noCarrier: string;
|
|
305
|
+
noWarehouseOrCarrier: string;
|
|
306
|
+
};
|
|
300
307
|
shipToAddressFormFields: string;
|
|
301
308
|
sections: {
|
|
302
309
|
customsForm: string;
|
|
@@ -613,7 +620,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
613
620
|
errorMessages: {
|
|
614
621
|
invalidNameOrCompany: string;
|
|
615
622
|
parsingFailure: string;
|
|
616
|
-
|
|
623
|
+
incompleteLabelPurchaseRequirements: string;
|
|
617
624
|
unableToLoad: {
|
|
618
625
|
accountSettings: string;
|
|
619
626
|
autoFundingSettings: string;
|
|
@@ -303,8 +303,15 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
303
303
|
rates: {
|
|
304
304
|
uspsMediaMailAcknowledgement: string;
|
|
305
305
|
uspsFirstClassMailAcknowledgement_leof: string;
|
|
306
|
+
rateSavings: string;
|
|
307
|
+
upsGroundSaverTermsAcknowledgement: string;
|
|
306
308
|
dhlExpressTermsAcknowledgement: string;
|
|
307
309
|
};
|
|
310
|
+
requirements: {
|
|
311
|
+
noWarehouse: string;
|
|
312
|
+
noCarrier: string;
|
|
313
|
+
noWarehouseOrCarrier: string;
|
|
314
|
+
};
|
|
308
315
|
shipToAddressFormFields: string;
|
|
309
316
|
sections: {
|
|
310
317
|
customsForm: string;
|
|
@@ -616,7 +623,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
616
623
|
errorMessages: {
|
|
617
624
|
invalidNameOrCompany: string;
|
|
618
625
|
parsingFailure: string;
|
|
619
|
-
|
|
626
|
+
incompleteLabelPurchaseRequirements: string;
|
|
620
627
|
unableToLoad: {
|
|
621
628
|
accountSettings: string;
|
|
622
629
|
autoFundingSettings: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SE } from "@shipengine/alchemy";
|
|
2
|
+
import { PreferredRateAcknowledgementMessage, PreferredRatesResponse } from "../../elements/configure-shipment";
|
|
2
3
|
/**
|
|
3
4
|
* @internal
|
|
4
5
|
*
|
|
@@ -7,6 +8,7 @@ import { SE } from "@shipengine/alchemy";
|
|
|
7
8
|
export type RateOption = Omit<SE.Rate, "warningMessages"> & {
|
|
8
9
|
balance?: number;
|
|
9
10
|
messages: string[];
|
|
11
|
+
rateAcknowledgementMessage?: PreferredRateAcknowledgementMessage;
|
|
10
12
|
requiresAcknowledgement?: boolean;
|
|
11
13
|
requiresFundedAmount?: boolean;
|
|
12
14
|
};
|
|
@@ -15,4 +17,4 @@ export type RateOption = Omit<SE.Rate, "warningMessages"> & {
|
|
|
15
17
|
*
|
|
16
18
|
* # Rate Options Hook
|
|
17
19
|
*/
|
|
18
|
-
export declare const useRateOptions: (rates?: SE.Rate[], carriers?: SE.Carrier[], shipment?: SE.SalesOrderShipment, enableGlobalPostFiltering?: boolean, requireDhlTermsAcknowledgement?: boolean) => RateOption[];
|
|
20
|
+
export declare const useRateOptions: (rates?: SE.Rate[], preferredRates?: PreferredRatesResponse, carriers?: SE.Carrier[], shipment?: SE.SalesOrderShipment, enableGlobalPostFiltering?: boolean, requireDhlTermsAcknowledgement?: boolean) => RateOption[];
|
|
@@ -202,8 +202,15 @@ declare const _default: {
|
|
|
202
202
|
rates: {
|
|
203
203
|
uspsMediaMailAcknowledgement: string;
|
|
204
204
|
uspsFirstClassMailAcknowledgement_leof: string;
|
|
205
|
+
rateSavings: string;
|
|
206
|
+
upsGroundSaverTermsAcknowledgement: string;
|
|
205
207
|
dhlExpressTermsAcknowledgement: string;
|
|
206
208
|
};
|
|
209
|
+
requirements: {
|
|
210
|
+
noWarehouse: string;
|
|
211
|
+
noCarrier: string;
|
|
212
|
+
noWarehouseOrCarrier: string;
|
|
213
|
+
};
|
|
207
214
|
shipToAddressFormFields: string;
|
|
208
215
|
sections: {
|
|
209
216
|
customsForm: string;
|
|
@@ -488,7 +495,7 @@ declare const _default: {
|
|
|
488
495
|
errorMessages: {
|
|
489
496
|
invalidNameOrCompany: string;
|
|
490
497
|
parsingFailure: string;
|
|
491
|
-
|
|
498
|
+
incompleteLabelPurchaseRequirements: string;
|
|
492
499
|
unableToLoad: {
|
|
493
500
|
accountSettings: string;
|
|
494
501
|
autoFundingSettings: string;
|
|
@@ -51,6 +51,14 @@ export declare const featureFlags: {
|
|
|
51
51
|
* Elements.
|
|
52
52
|
*/
|
|
53
53
|
readonly compatibleCountryCodes: readonly ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"];
|
|
54
|
+
/**
|
|
55
|
+
* @internal
|
|
56
|
+
*
|
|
57
|
+
* `partnerMessages` enables the partner consuming elements to specify override messages in specific cases.
|
|
58
|
+
*/
|
|
59
|
+
readonly partnerMessages: {
|
|
60
|
+
readonly incompleteLabelPurchaseRequirements: undefined;
|
|
61
|
+
};
|
|
54
62
|
/**
|
|
55
63
|
* `rateForm` all scoped feature flags for the `rate form` section of the `<PurchaseLabel />`
|
|
56
64
|
* element.
|
|
@@ -73,6 +81,9 @@ export declare const featureFlags: {
|
|
|
73
81
|
* `nicknameRate` enables showing the `carrier nickname` when rates are fetched.
|
|
74
82
|
*/
|
|
75
83
|
readonly nicknameRate: true;
|
|
84
|
+
/**
|
|
85
|
+
* `requireDhlTermsAcknowledgement` enables the `DHL terms acknowledgement` when rates are fetched.
|
|
86
|
+
*/
|
|
76
87
|
readonly requireDhlTermsAcknowledgement: false;
|
|
77
88
|
/**
|
|
78
89
|
* `saveRate` enables the `save rate` button in the rate form. This allows users to save a
|