@shipengine/elements 0.37.1 → 0.37.3
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 +137 -46
- package/index.js +137 -48
- package/package.json +1 -1
- package/src/components/templates/customs-items-display/customs-items-display.styles.d.ts +25 -1
- package/src/components/templates/rate-form/rate-form.d.ts +2 -3
- package/src/elements/account-settings/account-settings.d.ts +3 -1
- package/src/elements/configure-shipment/configure-shipment.d.ts +4 -1
- package/src/elements/configure-shipment/hooks/use-rates-form.d.ts +2 -3
- package/src/elements/onboarding/onboarding.d.ts +25 -1
- package/src/elements/purchase-label/hooks/use-configure-shipment.d.ts +2 -1
- package/src/elements/purchase-label/hooks/use-pending-shipment.d.ts +4 -3
- package/src/elements/purchase-label/purchase-label.d.ts +28 -11
- package/src/elements/view-shipment/view-shipment.d.ts +10 -1
- package/src/elements/void-label/void-label.d.ts +3 -1
- package/src/locales/en/index.d.ts +3 -1
- package/src/utilities/feature-flags.d.ts +9 -0
- package/src/utilities/shipengine/shipment.d.ts +16 -0
|
@@ -586,6 +586,29 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
586
586
|
invalidNameOrCompany: string;
|
|
587
587
|
parsingFailure: string;
|
|
588
588
|
incompleteLabelPurchaseRequirements: string;
|
|
589
|
+
shipmentCancelled: string;
|
|
590
|
+
/**
|
|
591
|
+
* # Registered Onboarding Element
|
|
592
|
+
*
|
|
593
|
+
* - This is the registered `<Onboarding />` element that will be used to render the
|
|
594
|
+
* `<Onboarding.Element />` component.
|
|
595
|
+
*
|
|
596
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
597
|
+
* the `<Onboarding.Element />` component.
|
|
598
|
+
*
|
|
599
|
+
* @example
|
|
600
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `Onboarding`
|
|
601
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
602
|
+
* ```tsx
|
|
603
|
+
* <Onboarding.Element
|
|
604
|
+
* onCompleteOnboarding={() => console.log('Onboarding Complete!')}
|
|
605
|
+
* />
|
|
606
|
+
* ```
|
|
607
|
+
*
|
|
608
|
+
* <br />
|
|
609
|
+
*
|
|
610
|
+
* @see {@link Onboarding.ComponentProps | The **props** that can be passed into the `<Onboarding.Element />` component}
|
|
611
|
+
*/
|
|
589
612
|
unableToLoad: {
|
|
590
613
|
accountSettings: string;
|
|
591
614
|
autoFundingSettings: string;
|
|
@@ -606,6 +629,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
606
629
|
purchase: string;
|
|
607
630
|
rateInvalid: string;
|
|
608
631
|
security: string;
|
|
632
|
+
shipmentStatus: string;
|
|
609
633
|
system: string;
|
|
610
634
|
unknown: string;
|
|
611
635
|
validation: string;
|
|
@@ -664,7 +688,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
664
688
|
invalidAddressNameStrict: string;
|
|
665
689
|
invalidAddressPoBox: string;
|
|
666
690
|
invalidCreditCardType: string;
|
|
667
|
-
|
|
691
|
+
invalidExpirationDate: string;
|
|
668
692
|
invalidPostalCode: string;
|
|
669
693
|
invalidStateProvince: string;
|
|
670
694
|
invalidString: string;
|
|
@@ -2,13 +2,14 @@ import { SE } from "@shipengine/alchemy";
|
|
|
2
2
|
import { ConfigureShipmentProps } from "../../configure-shipment";
|
|
3
3
|
import { UsePendingShipmentProps } from "./use-pending-shipment";
|
|
4
4
|
export type UseConfigureShipmentProps = {
|
|
5
|
+
errorWhenShipmentCancelled?: boolean;
|
|
5
6
|
onLoad?: UsePendingShipmentProps["onLoad"];
|
|
6
7
|
onShipmentUpdated?: ConfigureShipmentProps["onShipmentUpdated"];
|
|
7
8
|
printLabelLayout?: SE.LabelLayout;
|
|
8
9
|
salesOrder?: SE.SalesOrder;
|
|
9
10
|
warehouseId?: UsePendingShipmentProps["warehouseId"];
|
|
10
11
|
};
|
|
11
|
-
export declare const useConfigureShipment: ({ onLoad, onShipmentUpdated, salesOrder, warehouseId, printLabelLayout, }: UseConfigureShipmentProps) => {
|
|
12
|
+
export declare const useConfigureShipment: ({ onLoad, errorWhenShipmentCancelled, onShipmentUpdated, salesOrder, warehouseId, printLabelLayout, }: UseConfigureShipmentProps) => {
|
|
12
13
|
errors: SE.CodedError[] | undefined;
|
|
13
14
|
isLoading: boolean;
|
|
14
15
|
onShipmentUpdated: (shipment: SE.SalesOrderShipment) => Promise<void>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { SE } from "@shipengine/alchemy";
|
|
1
|
+
import { CodedError, SE } from "@shipengine/alchemy";
|
|
2
2
|
export type UsePendingShipmentProps = {
|
|
3
|
+
breakOnCancelledShipment?: boolean;
|
|
3
4
|
onLoad?: (salesOrder: SE.SalesOrder, shipments: SE.SalesOrderShipment[], pendingShipment?: SE.SalesOrderShipment) => Promise<void> | void;
|
|
4
5
|
salesOrder?: SE.SalesOrder;
|
|
5
6
|
warehouseId?: string;
|
|
6
7
|
};
|
|
7
|
-
export declare const usePendingShipment: ({ onLoad, salesOrder, warehouseId, }: UsePendingShipmentProps) => {
|
|
8
|
+
export declare const usePendingShipment: ({ breakOnCancelledShipment, onLoad, salesOrder, warehouseId, }: UsePendingShipmentProps) => {
|
|
8
9
|
isPendingShipmentLoading: boolean;
|
|
9
10
|
pendingShipment: SE.SalesOrderShipment | undefined;
|
|
10
|
-
pendingShipmentErrors:
|
|
11
|
+
pendingShipmentErrors: CodedError[] | undefined;
|
|
11
12
|
reloadPendingShipment: () => Promise<SE.SalesOrderShipment | undefined>;
|
|
12
13
|
};
|
|
@@ -705,17 +705,12 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
705
705
|
invalidNameOrCompany: string;
|
|
706
706
|
parsingFailure: string;
|
|
707
707
|
incompleteLabelPurchaseRequirements: string;
|
|
708
|
+
shipmentCancelled: string;
|
|
708
709
|
unableToLoad: {
|
|
709
710
|
accountSettings: string;
|
|
710
711
|
autoFundingSettings: string;
|
|
711
712
|
carrier: string;
|
|
712
713
|
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
|
-
*/
|
|
719
714
|
label: string;
|
|
720
715
|
salesOrder: string;
|
|
721
716
|
shipment: string;
|
|
@@ -731,6 +726,7 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
731
726
|
purchase: string;
|
|
732
727
|
rateInvalid: string;
|
|
733
728
|
security: string;
|
|
729
|
+
shipmentStatus: string;
|
|
734
730
|
system: string;
|
|
735
731
|
unknown: string;
|
|
736
732
|
validation: string;
|
|
@@ -748,10 +744,7 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
748
744
|
connectingCarriers: string;
|
|
749
745
|
data: string;
|
|
750
746
|
importingSalesOrder: 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
|
-
*/
|
|
747
|
+
label: string;
|
|
755
748
|
onboarding: string;
|
|
756
749
|
salesOrder: string;
|
|
757
750
|
shipment: string;
|
|
@@ -769,6 +762,30 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
769
762
|
september: string;
|
|
770
763
|
october: string;
|
|
771
764
|
november: string;
|
|
765
|
+
/**
|
|
766
|
+
* # Purchase Label Component
|
|
767
|
+
*
|
|
768
|
+
* The `<PurchaseLabel />` component is used to purchase shipping labels from various carriers
|
|
769
|
+
*
|
|
770
|
+
* @param ElementProps The props necessary to render the `<PurchaseLabel />` component for shipment
|
|
771
|
+
* based or sales order based label purchasing.
|
|
772
|
+
*
|
|
773
|
+
* @returns Element An EmotionJSX.Element that will render the `<PurchaseLabel />` component
|
|
774
|
+
* with all the appropriate wrappers.
|
|
775
|
+
*
|
|
776
|
+
* @example
|
|
777
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
778
|
+
* ```tsx
|
|
779
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
780
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
781
|
+
* resources: { en },
|
|
782
|
+
* });
|
|
783
|
+
* ```
|
|
784
|
+
*
|
|
785
|
+
* <br />
|
|
786
|
+
*
|
|
787
|
+
* @see {@link PurchaseLabel.Element | The **Element** created to render `<PurchaseLabel />`}
|
|
788
|
+
*/
|
|
772
789
|
december: string;
|
|
773
790
|
};
|
|
774
791
|
packageCategories: {
|
|
@@ -792,7 +809,7 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
792
809
|
invalidAddressNameStrict: string;
|
|
793
810
|
invalidAddressPoBox: string;
|
|
794
811
|
invalidCreditCardType: string;
|
|
795
|
-
|
|
812
|
+
invalidExpirationDate: string;
|
|
796
813
|
invalidPostalCode: string;
|
|
797
814
|
invalidStateProvince: string;
|
|
798
815
|
invalidString: string;
|
|
@@ -621,9 +621,17 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
621
621
|
invalidNameOrCompany: string;
|
|
622
622
|
parsingFailure: string;
|
|
623
623
|
incompleteLabelPurchaseRequirements: string;
|
|
624
|
+
shipmentCancelled: string;
|
|
624
625
|
unableToLoad: {
|
|
625
626
|
accountSettings: string;
|
|
626
627
|
autoFundingSettings: string;
|
|
628
|
+
/**
|
|
629
|
+
* # View Shipment Element Props
|
|
630
|
+
*
|
|
631
|
+
* - These are the base props that will be passed into the `<ViewShipment />` element.
|
|
632
|
+
*
|
|
633
|
+
* @see {@link ViewShipment.Element | See the full type that `typeof Element` will return}
|
|
634
|
+
*/
|
|
627
635
|
carrier: string;
|
|
628
636
|
carriers: string;
|
|
629
637
|
label: string;
|
|
@@ -641,6 +649,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
641
649
|
purchase: string;
|
|
642
650
|
rateInvalid: string;
|
|
643
651
|
security: string;
|
|
652
|
+
shipmentStatus: string;
|
|
644
653
|
system: string;
|
|
645
654
|
unknown: string;
|
|
646
655
|
validation: string;
|
|
@@ -699,7 +708,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
699
708
|
invalidAddressNameStrict: string;
|
|
700
709
|
invalidAddressPoBox: string;
|
|
701
710
|
invalidCreditCardType: string;
|
|
702
|
-
|
|
711
|
+
invalidExpirationDate: string;
|
|
703
712
|
invalidPostalCode: string;
|
|
704
713
|
invalidStateProvince: string;
|
|
705
714
|
invalidString: string;
|
|
@@ -624,6 +624,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
624
624
|
invalidNameOrCompany: string;
|
|
625
625
|
parsingFailure: string;
|
|
626
626
|
incompleteLabelPurchaseRequirements: string;
|
|
627
|
+
shipmentCancelled: string;
|
|
627
628
|
unableToLoad: {
|
|
628
629
|
accountSettings: string;
|
|
629
630
|
autoFundingSettings: string;
|
|
@@ -644,6 +645,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
644
645
|
purchase: string;
|
|
645
646
|
rateInvalid: string;
|
|
646
647
|
security: string;
|
|
648
|
+
shipmentStatus: string;
|
|
647
649
|
system: string;
|
|
648
650
|
unknown: string;
|
|
649
651
|
validation: string;
|
|
@@ -702,7 +704,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
702
704
|
invalidAddressNameStrict: string;
|
|
703
705
|
invalidAddressPoBox: string;
|
|
704
706
|
invalidCreditCardType: string;
|
|
705
|
-
|
|
707
|
+
invalidExpirationDate: string;
|
|
706
708
|
invalidPostalCode: string;
|
|
707
709
|
invalidStateProvince: string;
|
|
708
710
|
invalidString: string;
|
|
@@ -496,6 +496,7 @@ declare const _default: {
|
|
|
496
496
|
invalidNameOrCompany: string;
|
|
497
497
|
parsingFailure: string;
|
|
498
498
|
incompleteLabelPurchaseRequirements: string;
|
|
499
|
+
shipmentCancelled: string;
|
|
499
500
|
unableToLoad: {
|
|
500
501
|
accountSettings: string;
|
|
501
502
|
autoFundingSettings: string;
|
|
@@ -516,6 +517,7 @@ declare const _default: {
|
|
|
516
517
|
purchase: string;
|
|
517
518
|
rateInvalid: string;
|
|
518
519
|
security: string;
|
|
520
|
+
shipmentStatus: string;
|
|
519
521
|
system: string;
|
|
520
522
|
unknown: string;
|
|
521
523
|
validation: string;
|
|
@@ -574,7 +576,7 @@ declare const _default: {
|
|
|
574
576
|
invalidAddressNameStrict: string;
|
|
575
577
|
invalidAddressPoBox: string;
|
|
576
578
|
invalidCreditCardType: string;
|
|
577
|
-
|
|
579
|
+
invalidExpirationDate: string;
|
|
578
580
|
invalidPostalCode: string;
|
|
579
581
|
invalidStateProvince: string;
|
|
580
582
|
invalidString: string;
|
|
@@ -51,6 +51,15 @@ 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
|
+
* `configureShipment` is a group of flags related to the useConfigureShipment functionality
|
|
56
|
+
*/
|
|
57
|
+
readonly configureShipment: {
|
|
58
|
+
/**
|
|
59
|
+
* `enableErrorWhenShipmentCancelled` when enabled will modify the default behavior of creating a new shipment for a salesorder to throwing an error
|
|
60
|
+
*/
|
|
61
|
+
readonly enableErrorWhenShipmentCancelled: false;
|
|
62
|
+
};
|
|
54
63
|
/**
|
|
55
64
|
* @internal
|
|
56
65
|
*
|
|
@@ -18,8 +18,24 @@ export declare const getIsCustomsRequiredForShipment: ({ shipFrom, shipTo }: SE.
|
|
|
18
18
|
/**
|
|
19
19
|
* @internal
|
|
20
20
|
*
|
|
21
|
+
* @deprecated please use getShipmentByStatus instead
|
|
21
22
|
* # Shipment Utilities - getPendingShipment
|
|
22
23
|
*
|
|
23
24
|
* @category Utilities
|
|
24
25
|
*/
|
|
25
26
|
export declare const getPendingShipment: (shipments?: SE.SalesOrderShipment[]) => SE.SalesOrderShipment | undefined;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @deprecated please use getShipmentByStatus instead
|
|
30
|
+
* @internal
|
|
31
|
+
* @param shipments
|
|
32
|
+
* @returns the latest created shipment whose status is `cancelled`
|
|
33
|
+
*/
|
|
34
|
+
export declare const getCancelledShipment: (shipments?: SE.SalesOrderShipment[]) => SE.SalesOrderShipment | undefined;
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @param status string containing one of the following values - "pending", "processing", "label_purchased", "cancelled"
|
|
38
|
+
* @param shipments optional list of shipments to filter from
|
|
39
|
+
* @returns latest created shipment whose shipmentStatus matches the param status
|
|
40
|
+
*/
|
|
41
|
+
export declare const getShipmentByStatus: (status: SE.ShipmentStatus, shipments?: SE.SalesOrderShipment[]) => SE.SalesOrderShipment | undefined;
|