@shipengine/elements 0.36.0 → 0.37.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/elements",
3
- "version": "0.36.0",
3
+ "version": "0.37.0",
4
4
  "peerDependencies": {
5
5
  "@packlink/giger": "*",
6
6
  "react-i18next": "*",
@@ -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,16 @@ 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
+ partnerMessages?: {
16
+ incompleteLabelPurchaseRequirements?: string;
17
+ };
18
+ selectService?: boolean;
19
+ shippingPresets?: boolean;
20
+ };
11
21
  export type ShipmentFormProps = {
12
22
  accountSettings?: SE.AccountSettings;
13
23
  addressLoading: boolean;
@@ -45,11 +55,4 @@ export type CharsetWarning = {
45
55
  message: string;
46
56
  title?: string;
47
57
  };
48
- export type ShipmentFormFeatures = {
49
- browseRates?: boolean;
50
- includeShipsuranceInsurance?: boolean;
51
- includeThirdPartyInsurance?: boolean;
52
- selectService?: boolean;
53
- shippingPresets?: boolean;
54
- };
55
58
  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
- noWarehouses: string;
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;
@@ -22,10 +34,12 @@ export type ConfigureShipmentFeatures = {
22
34
  export type ConfigureShipmentProps = {
23
35
  errors?: Templates.ShipmentFormProps["errors"];
24
36
  features?: ConfigureShipmentFeatures;
37
+ getPreferredRates?: (shipment: SE.SalesOrderShipment, isInternational: boolean) => Promise<PreferredRatesResponse | undefined>;
25
38
  isLoading?: Templates.ShipmentFormProps["isLoading"];
26
39
  onAddressValidation?: UseShipmentFormProps["onAddressValidation"];
27
40
  onApplyPreset?: UseShipmentFormProps["onApplyPreset"];
28
41
  onBeforeLabelCreate?: UseRatesFormProps["onBeforeLabelCreate"];
42
+ onBeforeRateSaved?: UseRatesFormProps["onBeforeRateSaved"];
29
43
  onChangeAddress?: UseShipmentFormProps["onChangeAddress"];
30
44
  onChangeShipmentFormMode?: Templates.ShipmentFormProps["onChangeMode"];
31
45
  onLabelCreateFailure?: UseRatesFormProps["onLabelCreateFailure"];
@@ -34,10 +48,11 @@ export type ConfigureShipmentProps = {
34
48
  onRatesCalculated?: UseRatesFormProps["onRatesCalculated"];
35
49
  onShipmentUpdated: UseShipmentFormProps["onShipmentUpdated"];
36
50
  onToggleAddressPreferenceDisclosure?: Templates.ShipmentFormProps["onToggleAddressPreferenceDisclosure"];
51
+ preferredServiceCodes?: Templates.RateFormProps["preferredServiceCodes"];
37
52
  printLabelLayout?: UseRatesFormProps["printLabelLayout"];
38
53
  salesOrder?: SE.SalesOrder;
39
54
  shipment?: SE.SalesOrderShipment;
40
55
  shippingPresets?: UseShippingPresetsOptionsProps;
41
56
  warehouseId?: string;
42
57
  };
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;
58
+ 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;
@@ -4,3 +4,5 @@ export * from "./use-presets";
4
4
  export * from "./use-rates-form";
5
5
  export * from "./use-shipment-form";
6
6
  export * from "./use-rates-with-cache";
7
+ export * from "./use-request-rates";
8
+ export * from "./use-request-preferred-rates";
@@ -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
- onBeforeLabelCreate?: (rate: SE.Rate, shipment: SE.SalesOrderShipment) => Promise<void> | void;
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: SE.RateResponse | {
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
- ratesCalculating: boolean;
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
- noWarehouses: string;
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`
@@ -348,13 +367,19 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
348
367
  estimatedShipping: string;
349
368
  insurance: string;
350
369
  insuranceProvider: string;
351
- insuredValue: string;
370
+ insuredValue: string; /**
371
+ * `onApplyPreset` is an async/sync callback function that will be invoked each time a `Preset`
372
+ * has been applied to a shipment.
373
+ */
352
374
  items: string;
353
375
  orderDate: string;
354
376
  orderValue: string;
355
377
  packageCode: string;
356
378
  requestedShipping: string;
357
- shipDate: string;
379
+ shipDate: string; /**
380
+ * `onBeforeLabelCreate` is an async/sync callback function that will be invoked before every
381
+ * label purchase.
382
+ */
358
383
  service: string;
359
384
  shipTo: string;
360
385
  addShipToAddress: string;
@@ -385,8 +410,18 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
385
410
  rates: {
386
411
  uspsMediaMailAcknowledgement: string;
387
412
  uspsFirstClassMailAcknowledgement_leof: string;
413
+ rateSavings: string;
414
+ upsGroundSaverTermsAcknowledgement: string;
388
415
  dhlExpressTermsAcknowledgement: string;
389
416
  };
417
+ requirements: {
418
+ noWarehouse: string; /**
419
+ * `onRateSaved` is an async/sync callback function that will be invoked each time a rate is
420
+ * saved by the user when rate shopping in the host application.
421
+ */
422
+ noCarrier: string;
423
+ noWarehouseOrCarrier: string;
424
+ };
390
425
  shipToAddressFormFields: string;
391
426
  sections: {
392
427
  customsForm: string;
@@ -648,7 +683,10 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
648
683
  none: string;
649
684
  signature: string;
650
685
  verbalConfirmation: string;
651
- };
686
+ }; /**
687
+ * `onLabelCreateFailure` is an async/sync callback function that will be invoked each time a
688
+ * label purchase fails.
689
+ */
652
690
  customs: {
653
691
  addDeclaration: string;
654
692
  contents: {
@@ -663,12 +701,7 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
663
701
  fields: {
664
702
  contentsType: string;
665
703
  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
- */
704
+ description: string;
672
705
  harmonizedTariffCode: string;
673
706
  ifDeliveryFails: string;
674
707
  quantity: string;
@@ -685,11 +718,8 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
685
718
  };
686
719
  errorMessages: {
687
720
  invalidNameOrCompany: string;
688
- parsingFailure: string; /**
689
- * `shippingPresets` is an object that contains configured shipment details/specs
690
- * (dimensions, shipping service, etc) that can be applied to a shipment when purchasing a label.
691
- */
692
- noWarehouses: string;
721
+ parsingFailure: string;
722
+ incompleteLabelPurchaseRequirements: string;
693
723
  unableToLoad: {
694
724
  accountSettings: string;
695
725
  autoFundingSettings: 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
- noWarehouses: string;
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
- noWarehouses: string;
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
- noWarehouses: string;
498
+ incompleteLabelPurchaseRequirements: string;
492
499
  unableToLoad: {
493
500
  accountSettings: string;
494
501
  autoFundingSettings: string;
@@ -73,6 +73,9 @@ export declare const featureFlags: {
73
73
  * `nicknameRate` enables showing the `carrier nickname` when rates are fetched.
74
74
  */
75
75
  readonly nicknameRate: true;
76
+ /**
77
+ * `requireDhlTermsAcknowledgement` enables the `DHL terms acknowledgement` when rates are fetched.
78
+ */
76
79
  readonly requireDhlTermsAcknowledgement: false;
77
80
  /**
78
81
  * `saveRate` enables the `save rate` button in the rate form. This allows users to save a
@@ -101,6 +104,14 @@ export declare const featureFlags: {
101
104
  * to opt for third party insurance when insuring their shipment.
102
105
  */
103
106
  readonly includeThirdPartyInsurance: true;
107
+ /**
108
+ * @internal
109
+ *
110
+ * `partnerMessages` enables the partner consuming elements to specify override messages in specific cases.
111
+ */
112
+ readonly partnerMessages: {
113
+ readonly incompleteLabelPurchaseRequirements: undefined;
114
+ };
104
115
  /**
105
116
  * `selectService` enables the `select service` feature, allowing users to select a service
106
117
  * when rate shopping across multiple carrier providers.