@shipengine/elements 2.8.1 → 2.9.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/actions-menu.js +1 -1
- package/package.json +1 -1
- package/src/components/field/select/select.d.ts +1 -1
- package/src/components/grid-filters/components/index.d.ts +1 -0
- package/src/components/grid-filters/components/label-id-filter/index.d.ts +1 -0
- package/src/components/grid-filters/components/label-id-filter/label-id-filter-shema.d.ts +9 -0
- package/src/components/grid-filters/components/label-id-filter/label-id-filter.d.ts +23 -0
- package/src/components/grid-filters/components/label-id-filter/label-id-filter.styles.d.ts +7 -0
- package/src/components/grid-filters/grid-filters.d.ts +1 -0
- package/src/components/templates/shipment-form/shipment-form.styles.d.ts +10 -0
- package/src/elements/label-layout/label-layout-element.d.ts +5 -0
- package/src/elements/labels-grid/hooks/use-labels-grid.d.ts +66 -22
- package/src/elements/labels-grid/labels-grid.d.ts +12 -9
- package/src/elements/manage-carriers/manage-carriers.d.ts +5 -0
- package/src/elements/manage-external-carriers/manage-external-carriers.d.ts +5 -0
- package/src/elements/manage-funding/manage-funding-element.d.ts +5 -0
- package/src/elements/manage-warehouses/manage-warehouses.d.ts +5 -0
- package/src/elements/payment-method-settings/payment-method-settings-element.d.ts +5 -0
- package/src/elements/purchase-label/hooks/use-get-or-create-shipment.d.ts +1 -1
- package/src/elements/purchase-label/purchase-label.d.ts +5 -0
- package/src/elements/shipment-summary/shipment-summary.d.ts +9 -0
- package/src/elements/shipments-grid/shipments-grid.d.ts +30 -17
- package/src/elements/theme-creator/theme-creator.d.ts +5 -0
- package/src/elements/transaction-history/transaction-history-element.d.ts +5 -0
- package/src/elements/unit-settings/unit-settings-element.d.ts +5 -0
- package/src/elements/vat-settings/vat-settings-element.d.ts +5 -0
- package/src/elements/void-label/void-label.d.ts +5 -0
- package/src/hooks/options/use-warehouse-options.d.ts +0 -1
- package/src/locales/en/index.d.ts +5 -0
- package/src/workflows/account-settings/account-settings.d.ts +5 -0
- package/src/workflows/carrier-services/carrier-services.d.ts +5 -0
- package/src/workflows/connect-external-carrier/connect-external-carrier.d.ts +5 -0
- package/src/workflows/onboarding/onboarding.d.ts +6 -1
- package/transaction-history-element.js +1 -1
- package/use-scrub-errors.js +1 -1
- package/use-unit-settings.js +1 -1
- package/usePager.js +1 -1
|
@@ -109,9 +109,7 @@ export declare const Element: ({ resources, ...props }: ShipmentsGridProps & {
|
|
|
109
109
|
refund_rules: string;
|
|
110
110
|
resultTitles: {
|
|
111
111
|
approved: string;
|
|
112
|
-
rejected: string;
|
|
113
|
-
* `showCreatedDateFilter` controls the display of the Created Date filter
|
|
114
|
-
*/
|
|
112
|
+
rejected: string;
|
|
115
113
|
};
|
|
116
114
|
voidedOn: string;
|
|
117
115
|
};
|
|
@@ -161,10 +159,7 @@ export declare const Element: ({ resources, ...props }: ShipmentsGridProps & {
|
|
|
161
159
|
vatFormErrors: {
|
|
162
160
|
invalidFieldValue: string;
|
|
163
161
|
verificationFailure: string;
|
|
164
|
-
forbidden: string;
|
|
165
|
-
* `shipmentStatus` is the status of the shipments you wish to view.
|
|
166
|
-
* If no value is defined, all shipments will be rendered.
|
|
167
|
-
*/
|
|
162
|
+
forbidden: string;
|
|
168
163
|
connectionNotSupported: string;
|
|
169
164
|
genericTitle: string;
|
|
170
165
|
genericText: string;
|
|
@@ -213,9 +208,7 @@ export declare const Element: ({ resources, ...props }: ShipmentsGridProps & {
|
|
|
213
208
|
};
|
|
214
209
|
poBox: {
|
|
215
210
|
title: string;
|
|
216
|
-
description: string;
|
|
217
|
-
* `showCreatedDateFilter` controls the display of the Created Date filter
|
|
218
|
-
*/
|
|
211
|
+
description: string;
|
|
219
212
|
};
|
|
220
213
|
carrier: {
|
|
221
214
|
title: string;
|
|
@@ -269,6 +262,11 @@ export declare const Element: ({ resources, ...props }: ShipmentsGridProps & {
|
|
|
269
262
|
special_goods: string;
|
|
270
263
|
pickup: string;
|
|
271
264
|
location_fee: string;
|
|
265
|
+
/**
|
|
266
|
+
* # Shipments Grid Props
|
|
267
|
+
*
|
|
268
|
+
* @see {@link ShipmentsGrid.Element | This prop types usage in `<ShipmentsGrid />`}
|
|
269
|
+
*/
|
|
272
270
|
oversize: string;
|
|
273
271
|
returns: string;
|
|
274
272
|
notifications: string;
|
|
@@ -518,9 +516,7 @@ export declare const Element: ({ resources, ...props }: ShipmentsGridProps & {
|
|
|
518
516
|
title: string;
|
|
519
517
|
message: string;
|
|
520
518
|
};
|
|
521
|
-
isLoading: string;
|
|
522
|
-
* `showShipmentIdFilter` controls the display of the shipmentId search filter
|
|
523
|
-
*/
|
|
519
|
+
isLoading: string;
|
|
524
520
|
labels: {
|
|
525
521
|
amount: string;
|
|
526
522
|
};
|
|
@@ -575,6 +571,9 @@ export declare const Element: ({ resources, ...props }: ShipmentsGridProps & {
|
|
|
575
571
|
metric: string;
|
|
576
572
|
};
|
|
577
573
|
weight: {
|
|
574
|
+
/**
|
|
575
|
+
* `onRowClick` callback invoked when a row is clicked.
|
|
576
|
+
*/
|
|
578
577
|
title: string;
|
|
579
578
|
standard: string;
|
|
580
579
|
g: string;
|
|
@@ -614,7 +613,9 @@ export declare const Element: ({ resources, ...props }: ShipmentsGridProps & {
|
|
|
614
613
|
};
|
|
615
614
|
errorMessages: {
|
|
616
615
|
title: string;
|
|
617
|
-
subtitle: string;
|
|
616
|
+
subtitle: string; /**
|
|
617
|
+
* `showCreatedDateFilter` controls the display of the Created Date filter
|
|
618
|
+
*/
|
|
618
619
|
};
|
|
619
620
|
};
|
|
620
621
|
"list-labels": {
|
|
@@ -628,6 +629,7 @@ export declare const Element: ({ resources, ...props }: ShipmentsGridProps & {
|
|
|
628
629
|
shipDate: string;
|
|
629
630
|
status: string;
|
|
630
631
|
trackingStatus: string;
|
|
632
|
+
labelId: string;
|
|
631
633
|
};
|
|
632
634
|
empty: {
|
|
633
635
|
title: string;
|
|
@@ -678,7 +680,9 @@ export declare const Element: ({ resources, ...props }: ShipmentsGridProps & {
|
|
|
678
680
|
search: string;
|
|
679
681
|
settingsModal: {
|
|
680
682
|
closeDialog: string;
|
|
681
|
-
header: string;
|
|
683
|
+
header: string; /**
|
|
684
|
+
* `onRowClick` callback invoked when a row is clicked.
|
|
685
|
+
*/
|
|
682
686
|
};
|
|
683
687
|
status: {
|
|
684
688
|
connected: string;
|
|
@@ -720,10 +724,15 @@ export declare const Element: ({ resources, ...props }: ShipmentsGridProps & {
|
|
|
720
724
|
addressLine2: string;
|
|
721
725
|
cityLocality: string;
|
|
722
726
|
stateProvince: string;
|
|
723
|
-
postalCode: string;
|
|
727
|
+
postalCode: string; /**
|
|
728
|
+
* `onRowClick` callback invoked when a row is clicked.
|
|
729
|
+
*/
|
|
724
730
|
phone: string;
|
|
725
731
|
email: string;
|
|
726
|
-
addressResidentialIndicator: string;
|
|
732
|
+
addressResidentialIndicator: string; /**
|
|
733
|
+
* `shipmentStatus` is the status of the shipments you wish to view.
|
|
734
|
+
* If no value is defined, all shipments will be rendered.
|
|
735
|
+
*/
|
|
727
736
|
};
|
|
728
737
|
noResults: string;
|
|
729
738
|
subFields: {
|
|
@@ -881,6 +890,8 @@ export declare const Element: ({ resources, ...props }: ShipmentsGridProps & {
|
|
|
881
890
|
rows: string;
|
|
882
891
|
clearAll: string;
|
|
883
892
|
shipmentId: string;
|
|
893
|
+
labelId: string;
|
|
894
|
+
labelIdFilter: string;
|
|
884
895
|
createdDate: string;
|
|
885
896
|
shipmentIdFilter: string;
|
|
886
897
|
createdDateFilter: string;
|
|
@@ -888,6 +899,7 @@ export declare const Element: ({ resources, ...props }: ShipmentsGridProps & {
|
|
|
888
899
|
clear: string;
|
|
889
900
|
search: string;
|
|
890
901
|
shipmentIdHint: string;
|
|
902
|
+
labelIdHint: string;
|
|
891
903
|
dateFilterToday: string;
|
|
892
904
|
dateFilterLast7Days: string;
|
|
893
905
|
dateFilterLast30Days: string;
|
|
@@ -969,6 +981,7 @@ export declare const Element: ({ resources, ...props }: ShipmentsGridProps & {
|
|
|
969
981
|
tooFewCharacters: string;
|
|
970
982
|
tooManyCharacters: string;
|
|
971
983
|
requiredShipmentId: string;
|
|
984
|
+
requiredLabelId: string;
|
|
972
985
|
};
|
|
973
986
|
shippingPresets: {
|
|
974
987
|
apply: string;
|
|
@@ -565,6 +565,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
565
565
|
shipDate: string;
|
|
566
566
|
status: string;
|
|
567
567
|
trackingStatus: string;
|
|
568
|
+
labelId: string;
|
|
568
569
|
};
|
|
569
570
|
empty: {
|
|
570
571
|
title: string;
|
|
@@ -818,6 +819,8 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
818
819
|
rows: string;
|
|
819
820
|
clearAll: string;
|
|
820
821
|
shipmentId: string;
|
|
822
|
+
labelId: string;
|
|
823
|
+
labelIdFilter: string;
|
|
821
824
|
createdDate: string;
|
|
822
825
|
shipmentIdFilter: string;
|
|
823
826
|
createdDateFilter: string;
|
|
@@ -825,6 +828,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
825
828
|
clear: string;
|
|
826
829
|
search: string;
|
|
827
830
|
shipmentIdHint: string;
|
|
831
|
+
labelIdHint: string;
|
|
828
832
|
dateFilterToday: string;
|
|
829
833
|
dateFilterLast7Days: string;
|
|
830
834
|
dateFilterLast30Days: string;
|
|
@@ -906,6 +910,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
906
910
|
tooFewCharacters: string;
|
|
907
911
|
tooManyCharacters: string;
|
|
908
912
|
requiredShipmentId: string;
|
|
913
|
+
requiredLabelId: string;
|
|
909
914
|
};
|
|
910
915
|
shippingPresets: {
|
|
911
916
|
apply: string;
|
|
@@ -552,6 +552,7 @@ export declare const Element: ({ resources, ...props }: object & {
|
|
|
552
552
|
shipDate: string;
|
|
553
553
|
status: string;
|
|
554
554
|
trackingStatus: string;
|
|
555
|
+
labelId: string;
|
|
555
556
|
};
|
|
556
557
|
empty: {
|
|
557
558
|
title: string;
|
|
@@ -805,6 +806,8 @@ export declare const Element: ({ resources, ...props }: object & {
|
|
|
805
806
|
rows: string;
|
|
806
807
|
clearAll: string;
|
|
807
808
|
shipmentId: string;
|
|
809
|
+
labelId: string;
|
|
810
|
+
labelIdFilter: string;
|
|
808
811
|
createdDate: string;
|
|
809
812
|
shipmentIdFilter: string;
|
|
810
813
|
createdDateFilter: string;
|
|
@@ -812,6 +815,7 @@ export declare const Element: ({ resources, ...props }: object & {
|
|
|
812
815
|
clear: string;
|
|
813
816
|
search: string;
|
|
814
817
|
shipmentIdHint: string;
|
|
818
|
+
labelIdHint: string;
|
|
815
819
|
dateFilterToday: string;
|
|
816
820
|
dateFilterLast7Days: string;
|
|
817
821
|
dateFilterLast30Days: string;
|
|
@@ -893,6 +897,7 @@ export declare const Element: ({ resources, ...props }: object & {
|
|
|
893
897
|
tooFewCharacters: string;
|
|
894
898
|
tooManyCharacters: string;
|
|
895
899
|
requiredShipmentId: string;
|
|
900
|
+
requiredLabelId: string;
|
|
896
901
|
};
|
|
897
902
|
shippingPresets: {
|
|
898
903
|
apply: string;
|
|
@@ -552,6 +552,7 @@ export declare const Element: ({ resources, ...props }: object & {
|
|
|
552
552
|
shipDate: string;
|
|
553
553
|
status: string;
|
|
554
554
|
trackingStatus: string;
|
|
555
|
+
labelId: string;
|
|
555
556
|
};
|
|
556
557
|
empty: {
|
|
557
558
|
title: string;
|
|
@@ -805,6 +806,8 @@ export declare const Element: ({ resources, ...props }: object & {
|
|
|
805
806
|
rows: string;
|
|
806
807
|
clearAll: string;
|
|
807
808
|
shipmentId: string;
|
|
809
|
+
labelId: string;
|
|
810
|
+
labelIdFilter: string;
|
|
808
811
|
createdDate: string;
|
|
809
812
|
shipmentIdFilter: string;
|
|
810
813
|
createdDateFilter: string;
|
|
@@ -812,6 +815,7 @@ export declare const Element: ({ resources, ...props }: object & {
|
|
|
812
815
|
clear: string;
|
|
813
816
|
search: string;
|
|
814
817
|
shipmentIdHint: string;
|
|
818
|
+
labelIdHint: string;
|
|
815
819
|
dateFilterToday: string;
|
|
816
820
|
dateFilterLast7Days: string;
|
|
817
821
|
dateFilterLast30Days: string;
|
|
@@ -893,6 +897,7 @@ export declare const Element: ({ resources, ...props }: object & {
|
|
|
893
897
|
tooFewCharacters: string;
|
|
894
898
|
tooManyCharacters: string;
|
|
895
899
|
requiredShipmentId: string;
|
|
900
|
+
requiredLabelId: string;
|
|
896
901
|
};
|
|
897
902
|
shippingPresets: {
|
|
898
903
|
apply: string;
|
|
@@ -552,6 +552,7 @@ export declare const Element: ({ resources, ...props }: object & {
|
|
|
552
552
|
shipDate: string;
|
|
553
553
|
status: string;
|
|
554
554
|
trackingStatus: string;
|
|
555
|
+
labelId: string;
|
|
555
556
|
};
|
|
556
557
|
empty: {
|
|
557
558
|
title: string;
|
|
@@ -805,6 +806,8 @@ export declare const Element: ({ resources, ...props }: object & {
|
|
|
805
806
|
rows: string;
|
|
806
807
|
clearAll: string;
|
|
807
808
|
shipmentId: string;
|
|
809
|
+
labelId: string;
|
|
810
|
+
labelIdFilter: string;
|
|
808
811
|
createdDate: string;
|
|
809
812
|
shipmentIdFilter: string;
|
|
810
813
|
createdDateFilter: string;
|
|
@@ -812,6 +815,7 @@ export declare const Element: ({ resources, ...props }: object & {
|
|
|
812
815
|
clear: string;
|
|
813
816
|
search: string;
|
|
814
817
|
shipmentIdHint: string;
|
|
818
|
+
labelIdHint: string;
|
|
815
819
|
dateFilterToday: string;
|
|
816
820
|
dateFilterLast7Days: string;
|
|
817
821
|
dateFilterLast30Days: string;
|
|
@@ -893,6 +897,7 @@ export declare const Element: ({ resources, ...props }: object & {
|
|
|
893
897
|
tooFewCharacters: string;
|
|
894
898
|
tooManyCharacters: string;
|
|
895
899
|
requiredShipmentId: string;
|
|
900
|
+
requiredLabelId: string;
|
|
896
901
|
};
|
|
897
902
|
shippingPresets: {
|
|
898
903
|
apply: string;
|
|
@@ -685,6 +685,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
685
685
|
shipDate: string;
|
|
686
686
|
status: string;
|
|
687
687
|
trackingStatus: string;
|
|
688
|
+
labelId: string;
|
|
688
689
|
};
|
|
689
690
|
empty: {
|
|
690
691
|
title: string;
|
|
@@ -943,6 +944,8 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
943
944
|
rows: string;
|
|
944
945
|
clearAll: string;
|
|
945
946
|
shipmentId: string;
|
|
947
|
+
labelId: string;
|
|
948
|
+
labelIdFilter: string;
|
|
946
949
|
createdDate: string;
|
|
947
950
|
shipmentIdFilter: string;
|
|
948
951
|
createdDateFilter: string;
|
|
@@ -950,6 +953,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
950
953
|
clear: string;
|
|
951
954
|
search: string;
|
|
952
955
|
shipmentIdHint: string;
|
|
956
|
+
labelIdHint: string;
|
|
953
957
|
dateFilterToday: string;
|
|
954
958
|
dateFilterLast7Days: string;
|
|
955
959
|
dateFilterLast30Days: string;
|
|
@@ -1031,6 +1035,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
1031
1035
|
tooFewCharacters: string;
|
|
1032
1036
|
tooManyCharacters: string;
|
|
1033
1037
|
requiredShipmentId: string;
|
|
1038
|
+
requiredLabelId: string;
|
|
1034
1039
|
};
|
|
1035
1040
|
shippingPresets: {
|
|
1036
1041
|
apply: string;
|
|
@@ -8,7 +8,6 @@ import { SE } from "@shipengine/react-api";
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const useWarehouseOptions: (warehouses?: SE.Warehouse[], rightContentAction?: ((warehouseId: string) => void) | undefined) => {
|
|
10
10
|
label: string;
|
|
11
|
-
rightContent: import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
11
|
subLabel: string;
|
|
13
12
|
value: string;
|
|
14
13
|
}[] | undefined;
|
|
@@ -548,6 +548,7 @@ declare const _default: {
|
|
|
548
548
|
shipDate: string;
|
|
549
549
|
status: string;
|
|
550
550
|
trackingStatus: string;
|
|
551
|
+
labelId: string;
|
|
551
552
|
};
|
|
552
553
|
empty: {
|
|
553
554
|
title: string;
|
|
@@ -801,6 +802,8 @@ declare const _default: {
|
|
|
801
802
|
rows: string;
|
|
802
803
|
clearAll: string;
|
|
803
804
|
shipmentId: string;
|
|
805
|
+
labelId: string;
|
|
806
|
+
labelIdFilter: string;
|
|
804
807
|
createdDate: string;
|
|
805
808
|
shipmentIdFilter: string;
|
|
806
809
|
createdDateFilter: string;
|
|
@@ -808,6 +811,7 @@ declare const _default: {
|
|
|
808
811
|
clear: string;
|
|
809
812
|
search: string;
|
|
810
813
|
shipmentIdHint: string;
|
|
814
|
+
labelIdHint: string;
|
|
811
815
|
dateFilterToday: string;
|
|
812
816
|
dateFilterLast7Days: string;
|
|
813
817
|
dateFilterLast30Days: string;
|
|
@@ -889,6 +893,7 @@ declare const _default: {
|
|
|
889
893
|
tooFewCharacters: string;
|
|
890
894
|
tooManyCharacters: string;
|
|
891
895
|
requiredShipmentId: string;
|
|
896
|
+
requiredLabelId: string;
|
|
892
897
|
};
|
|
893
898
|
shippingPresets: {
|
|
894
899
|
apply: string;
|
|
@@ -586,6 +586,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
586
586
|
shipDate: string;
|
|
587
587
|
status: string;
|
|
588
588
|
trackingStatus: string;
|
|
589
|
+
labelId: string;
|
|
589
590
|
};
|
|
590
591
|
empty: {
|
|
591
592
|
title: string;
|
|
@@ -839,6 +840,8 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
839
840
|
rows: string;
|
|
840
841
|
clearAll: string;
|
|
841
842
|
shipmentId: string;
|
|
843
|
+
labelId: string;
|
|
844
|
+
labelIdFilter: string;
|
|
842
845
|
createdDate: string;
|
|
843
846
|
shipmentIdFilter: string;
|
|
844
847
|
createdDateFilter: string;
|
|
@@ -846,6 +849,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
846
849
|
clear: string;
|
|
847
850
|
search: string;
|
|
848
851
|
shipmentIdHint: string;
|
|
852
|
+
labelIdHint: string;
|
|
849
853
|
dateFilterToday: string;
|
|
850
854
|
dateFilterLast7Days: string;
|
|
851
855
|
dateFilterLast30Days: string;
|
|
@@ -927,6 +931,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
927
931
|
tooFewCharacters: string;
|
|
928
932
|
tooManyCharacters: string;
|
|
929
933
|
requiredShipmentId: string;
|
|
934
|
+
requiredLabelId: string;
|
|
930
935
|
};
|
|
931
936
|
shippingPresets: {
|
|
932
937
|
apply: string;
|
|
@@ -578,6 +578,7 @@ export declare const Element: ({ resources, ...props }: CarrierServicesProps & {
|
|
|
578
578
|
shipDate: string;
|
|
579
579
|
status: string;
|
|
580
580
|
trackingStatus: string;
|
|
581
|
+
labelId: string;
|
|
581
582
|
};
|
|
582
583
|
empty: {
|
|
583
584
|
title: string;
|
|
@@ -831,6 +832,8 @@ export declare const Element: ({ resources, ...props }: CarrierServicesProps & {
|
|
|
831
832
|
rows: string;
|
|
832
833
|
clearAll: string;
|
|
833
834
|
shipmentId: string;
|
|
835
|
+
labelId: string;
|
|
836
|
+
labelIdFilter: string;
|
|
834
837
|
createdDate: string;
|
|
835
838
|
shipmentIdFilter: string;
|
|
836
839
|
createdDateFilter: string;
|
|
@@ -838,6 +841,7 @@ export declare const Element: ({ resources, ...props }: CarrierServicesProps & {
|
|
|
838
841
|
clear: string;
|
|
839
842
|
search: string;
|
|
840
843
|
shipmentIdHint: string;
|
|
844
|
+
labelIdHint: string;
|
|
841
845
|
dateFilterToday: string;
|
|
842
846
|
dateFilterLast7Days: string;
|
|
843
847
|
dateFilterLast30Days: string;
|
|
@@ -919,6 +923,7 @@ export declare const Element: ({ resources, ...props }: CarrierServicesProps & {
|
|
|
919
923
|
tooFewCharacters: string;
|
|
920
924
|
tooManyCharacters: string;
|
|
921
925
|
requiredShipmentId: string;
|
|
926
|
+
requiredLabelId: string;
|
|
922
927
|
};
|
|
923
928
|
shippingPresets: {
|
|
924
929
|
apply: string;
|
|
@@ -585,6 +585,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
585
585
|
shipDate: string;
|
|
586
586
|
status: string;
|
|
587
587
|
trackingStatus: string;
|
|
588
|
+
labelId: string;
|
|
588
589
|
};
|
|
589
590
|
empty: {
|
|
590
591
|
title: string;
|
|
@@ -838,6 +839,8 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
838
839
|
rows: string;
|
|
839
840
|
clearAll: string;
|
|
840
841
|
shipmentId: string;
|
|
842
|
+
labelId: string;
|
|
843
|
+
labelIdFilter: string;
|
|
841
844
|
createdDate: string;
|
|
842
845
|
shipmentIdFilter: string;
|
|
843
846
|
createdDateFilter: string;
|
|
@@ -845,6 +848,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
845
848
|
clear: string;
|
|
846
849
|
search: string;
|
|
847
850
|
shipmentIdHint: string;
|
|
851
|
+
labelIdHint: string;
|
|
848
852
|
dateFilterToday: string;
|
|
849
853
|
dateFilterLast7Days: string;
|
|
850
854
|
dateFilterLast30Days: string;
|
|
@@ -926,6 +930,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
926
930
|
tooFewCharacters: string;
|
|
927
931
|
tooManyCharacters: string;
|
|
928
932
|
requiredShipmentId: string;
|
|
933
|
+
requiredLabelId: string;
|
|
929
934
|
};
|
|
930
935
|
shippingPresets: {
|
|
931
936
|
apply: string;
|
|
@@ -621,6 +621,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
621
621
|
shipDate: string;
|
|
622
622
|
status: string;
|
|
623
623
|
trackingStatus: string;
|
|
624
|
+
labelId: string;
|
|
624
625
|
};
|
|
625
626
|
empty: {
|
|
626
627
|
title: string;
|
|
@@ -628,7 +629,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
628
629
|
};
|
|
629
630
|
emptyWithFilters: {
|
|
630
631
|
title: string;
|
|
631
|
-
subtitle: string;
|
|
632
|
+
subtitle: string; /** Invoked when the onboarding process is completed. */
|
|
632
633
|
button: string;
|
|
633
634
|
};
|
|
634
635
|
status: {
|
|
@@ -881,6 +882,8 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
881
882
|
rows: string;
|
|
882
883
|
clearAll: string;
|
|
883
884
|
shipmentId: string;
|
|
885
|
+
labelId: string;
|
|
886
|
+
labelIdFilter: string;
|
|
884
887
|
createdDate: string;
|
|
885
888
|
shipmentIdFilter: string;
|
|
886
889
|
createdDateFilter: string;
|
|
@@ -888,6 +891,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
888
891
|
clear: string;
|
|
889
892
|
search: string;
|
|
890
893
|
shipmentIdHint: string;
|
|
894
|
+
labelIdHint: string;
|
|
891
895
|
dateFilterToday: string;
|
|
892
896
|
dateFilterLast7Days: string;
|
|
893
897
|
dateFilterLast30Days: string;
|
|
@@ -969,6 +973,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
969
973
|
tooFewCharacters: string;
|
|
970
974
|
tooManyCharacters: string;
|
|
971
975
|
requiredShipmentId: string;
|
|
976
|
+
requiredLabelId: string;
|
|
972
977
|
};
|
|
973
978
|
shippingPresets: {
|
|
974
979
|
apply: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as n}from"@emotion/react/jsx-runtime";import{S as s,c as a,e as r,u as i,M as o,d as l,E as c,f as d,U as p,g,h,i as u,P as m,T as b}from"./use-unit-settings.js";import{T as v,h as f,m as C,G as O,r as y,v as j,P as S,y as w,z as x}from"./actions-menu.js";import{k as _,t as E,q as k,T}from"./carrier.js";import{useTranslation as F}from"react-i18next";import{Icon as P,IconSize as A,Select as D,Option as I,Input as L,Popover as R,Typography as z,TagColor as N,Next as B,Tag as $,TagVariant as W,EmptyState as M,Button as U}from"@shipengine/giger";import{useState as G,useCallback as V,useRef as K,useEffect as H,useMemo as q,useContext as Z,createContext as Y}from"react";import{useListLabels as J,useListShipments as Q,useGetShipment as X}from"@shipengine/react-api";import{u as ee}from"./use-get-service-name.js";import{D as te,u as ne,E as se,C as ae,G as re,b as ie,a as oe}from"./usePager.js";import{h as le}from"./vat.js";import{formatISO as ce}from"date-fns/formatISO";import{isSameDay as de}from"date-fns/isSameDay";import{isWithinInterval as pe}from"date-fns/isWithinInterval";import{setHours as ge}from"date-fns/setHours";import{setMinutes as he}from"date-fns/setMinutes";import{IconNames as ue}from"@shipengine/giger-theme";import{d as me}from"./use-toggle.js";const be=le({category:{alignItems:"center",cursor:"pointer",display:"flex",flexDirection:"row",justifyContent:"space-between"},colorPicker:e=>({"&::-webkit-color-swatch":{border:`1px solid ${e.palette.gray.light}`,borderRadius:"4px",padding:0},"&::-webkit-color-swatch-wrapper":{padding:0},alignSelf:"center",appearance:"none",background:"none",border:0,cursor:"pointer",height:e.spacing(4.25),outline:"none",width:e.spacing(4.25)}),container:e=>({marginBottom:e.spacing(2)}),input:e=>({border:`1px solid ${e.palette.gray.light}`,borderRadius:"4px",color:e.palette.gray.main,fontSize:"14px",padding:e.spacing(1)}),inputContainer:e=>({alignItems:"center",display:"flex",flexDirection:"row",justifyContent:"space-between",padding:`${e.spacing(2)}px 0`}),wrapper:e=>({display:"flex",gap:e.spacing(1)})}),ve=({paletteConfig:n,onUpdatePaletteConfig:s,formatKey:a})=>{const[r,i]=G(new Set),o=e=>{i((t=>{const n=new Set(t);return n.has(e)?new Set([...n].filter((t=>t!==e))):new Set([...n,e])}))},l=V(((e,t,a)=>{const r=(e=>{if(e)return e.match(/^#[0-9A-Fa-f]{0,6}$/)?e:e.match(/^[0-9A-Fa-f]{6}$/)?`#${e}`:void 0})(a),i=Object.assign(Object.assign({},n||{}),{[e]:Object.assign(Object.assign({},(null==n?void 0:n[e])||{}),{[t]:r})});s(i)}),[s,n]);return e("div",Object.assign({"data-test-id":"color-palette-editor"},{children:n&&Object.keys(n).map((s=>t("div",Object.assign({css:be.container,id:s},{children:[t("div",Object.assign({"aria-expanded":r.has(s),css:be.category,onClick:e=>{e.preventDefault(),o(s)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),o(s))},role:"button",tabIndex:0},{children:[e("p",{children:_(s)}),e(P,{name:r.has(s)?ue.CHEVRON_TOP:ue.CHEVRON_BOTTOM,size:A.SIZE_REGULAR})]})),r.has(s)&&Object.keys(n[s]).map((r=>t("div",Object.assign({css:be.inputContainer,id:"input-container"},{children:[e("label",Object.assign({css:{fontWeight:"bold"},htmlFor:`${s}.${r}`},{children:a(r)})),t("form",Object.assign({css:be.wrapper},{children:[e("input",{css:be.input,onChange:e=>{e.preventDefault(),l(s,r,e.target.value)},onKeyDown:e=>{"Enter"===e.key&&e.preventDefault()},type:"text",value:n[s][r]}),e("input",{css:be.colorPicker,onChange:e=>l(s,r,e.target.value),type:"color",value:n[s][r]})]}))]}),r)))]}),s)))}))},fe=le({input:e=>({border:`1px solid ${e.palette.gray.light}`,borderRadius:"4px",color:e.palette.gray.main,fontSize:"14px",maxWidth:e.spacing(16),padding:0}),keys:{fontSize:"16px",fontWeight:"bold",marginTop:"8px"},section:e=>({"& > div:first-child":{flexGrow:3},"& > div:last-child":{flexShrink:1},display:"flex",gap:e.spacing(1),justifyContent:"space-between"}),sectionContainer:e=>({marginBottom:e.spacing(4)}),select:e=>({border:`1px solid ${e.palette.gray.light}`,borderRadius:"4px",color:e.palette.gray.main,fontSize:"14px"})}),Ce=({onUpdateTypographyConfig:s,typographyConfig:a,formatKey:r})=>{const i=V(((e,t,n)=>{const r=Object.assign(Object.assign({},a||{}),{[e]:Object.assign(Object.assign({},(null==a?void 0:a[e])||{}),{[t]:n})});s(r)}),[s,a]),o=V(((e,t)=>{if(e)return e[t]}),[]),l=(t,n)=>{var s;const r=[{label:"Normal",value:"400"},{label:"Semi Bold",value:"600"},{label:"Bold",value:"700"}],l=null===(s=o(a,t))||void 0===s?void 0:s.fontWeight.toString(),c=void 0!==l?r.find((e=>e.value===l)):void 0;return e(D,Object.assign({css:fe.select,label:"Font Weight",name:"font-weight",onChange:(e,s)=>i(t,n,null==s?void 0:s.value),value:c},{children:r.map((t=>e(I,Object.assign({value:t.value},{children:t.label}),t.value)))}))},c=(t,n)=>{var s;const r=null===(s=o(a,t))||void 0===s?void 0:s.fontSize.replace("px","");return e(L,{"aria-labelledby":`${t}.${n}`,css:fe.input,label:"Font Size(px)",onChange:e=>{e.target.value.match(/^\d{0,2}$/)&&i(t,n,`${e.target.value}px`)},value:r})},d=(t,s)=>{switch(s){case"fontWeight":return e(n,{children:l(t,s)});case"fontSize":return e(n,{children:c(t,s)});default:return null}};return e("div",{children:a&&Object.keys(a).map((n=>t("div",Object.assign({css:fe.sectionContainer},{children:[e("p",Object.assign({css:fe.keys,id:n},{children:r(n)})),e("section",Object.assign({css:fe.section},{children:Object.keys(a[n]).map((t=>e("div",Object.assign({id:`${n}.${t}`},{children:d(n,t)}),t)))}))]}),n)))})},Oe=le({container:e=>({color:e.palette.gray.dark,display:"flex",flexDirection:"column",flexGrow:1,overflow:"hidden",position:"relative"}),content:e=>({display:"flex",flexDirection:"column",gap:e.spacing(3),padding:e.spacing(3)}),copy:e=>({backgroundColor:e.palette.white,borderRadius:"4px",padding:e.spacing(.5)}),drawerHeader:e=>({alignItems:"center",display:"flex",gap:e.spacing(2),justifyContent:"end",width:"50%"}),drawerWrapper:{display:"flex",justifyContent:"space-between",position:"relative"},header:{alignItems:"center",display:"flex",justifyContent:"space-between"},popoverWrapper:e=>({display:"flex",flexDirection:"column",gap:e.spacing(1)}),pre:e=>({backgroundColor:"#FFFFFF66",borderRadius:"8px",fontSize:"14px",padding:e.spacing(.3)}),presetOption:e=>({"&:hover":{backgroundColor:"theme.palette.gray.ultraLight"},backgroundColor:"transparent",borderRadius:"4px",fontSize:"14px",padding:e.spacing(1)}),presetsButton:e=>({"&:hover":{backgroundColor:"#d1d4d7"},backgroundColor:"#E4E5E7",borderRadius:"4px",cursor:"pointer",display:"flex",fontSize:"14px",gap:e.spacing(.5),padding:`${e.spacing(.5)}px ${e.spacing(1)}px`})}),ye=({themeConfig:n,onUpdateThemeConfig:s,presets:a,showDrawer:r})=>{const i=K(n),[o,l]=G(!1),c=Object.keys(n).flatMap((e=>{if("components"===e&&n[e]&&"object"==typeof n[e]){return Object.keys(n[e])}return[e]})).map((e=>"palette"===e?{label:"Color Palette",value:"Color Palette"}:{label:_(e),value:_(e)})),[d,p]=G(c.sort()[0].value),g=e=>E(k(e)),h=K(null),[u,m]=me(!1),b=e=>{s(e)};return t("div",Object.assign({"aria-label":"Theme Creator",css:Oe.container,"data-testid":"theme-creator",role:"region"},{children:[t("div",Object.assign({css:Oe.content},{children:[t("div",Object.assign({css:Oe.header},{children:[e(v,{onSelectTab:e=>{p(e)},selectedTab:d,tabs:c}),a?t("div",{children:[t("button",Object.assign({"aria-controls":"presets-popover","aria-expanded":u,css:Oe.presetsButton,onClick:e=>{e.preventDefault(),m()},ref:h},{children:["Presets",e(P,{name:ue.CARET_BOTTOM,size:A.SIZE_SMALL})]})),e(R,Object.assign({container:document.querySelector("#theme-creator"),isOpen:u,onClickAway:()=>m(),placement:"bottom-end",reference:h.current},{children:t("div",Object.assign({css:Oe.popoverWrapper},{children:[e("button",Object.assign({"aria-label":"Set Default Theme",css:Oe.presetOption,onClick:e=>{e.preventDefault(),m(),b(i.current)},role:"menuitem"},{children:"Default"})),a.map((t=>e("button",Object.assign({"aria-label":`Set ${t.presetName} Theme`,css:Oe.presetOption,onClick:e=>{e.preventDefault(),m(),b(t.themeConfig)},role:"menuitem"},{children:t.presetName}),t.presetName)))]}))}))]}):e("button",Object.assign({"aria-label":"Set Default Theme",css:Oe.presetsButton,onClick:()=>{b(i.current)},role:"menuitem"},{children:"Reset to Default"}))]})),e(z,Object.assign({role:"heading",variant:"heading4"},{children:`${d} Editor`})),((t,n)=>{var a;switch(n){case"Color Palette":return e(ve,{formatKey:g,onUpdatePaletteConfig:e=>{s(Object.assign(Object.assign({},t),{palette:e}))},paletteConfig:t.palette});case"Typography":return e(Ce,{formatKey:g,onUpdateTypographyConfig:e=>{s(Object.assign(Object.assign({},t),{components:Object.assign(Object.assign({},t.components),{Typography:e})}))},typographyConfig:null===(a=t.components)||void 0===a?void 0:a.Typography});default:return null}})(n,d)]})),r&&e(te,Object.assign({"aria-label":"Show themeConfig.js Code Drawer",headerContent:t("div",Object.assign({css:Oe.drawerHeader},{children:[e("pre",Object.assign({css:Oe.pre},{children:"themeConfig.js"})),r.copyToClipboardText&&e("div",Object.assign({css:Oe.copy},{children:e(f,{content:r.copyToClipboardText})}))]})),isOpen:o,toggleDrawer:()=>l(!o)},{children:r.content}))]}))},je=({onRedirectToOnboarding:t})=>e(s,{onRedirectToOnboarding:t}),Se=a(je,C,{resources:{en:r}});var we=Object.freeze({__proto__:null,Component:je,Element:Se});const xe=()=>{const t=T(i(),[]);return e(o,Object.assign({},t))},_e=a(xe,C,{resources:{en:r}});var Ee=Object.freeze({__proto__:null,Component:xe,Element:_e});const ke=({isModalFullScreen:t})=>{const n=T(l(),[]);return e(c,Object.assign({isModalFullScreen:t},n))},Te=a(ke,C,{resources:{en:r}});var Fe=Object.freeze({__proto__:null,Component:ke,Element:Te});const Pe=le({errorState:e=>Object.assign({backgroundColor:e.palette.white},e.getComponentOverride("Table")),tableParagraph:{margin:0}}),Ae=({labelStatus:s,showShipmentIdFilter:a=!0,onClickPrintLabel:r,onClickVoidLabel:i,onClickPrintForms:o,onClickViewDetails:l,onRowClick:c})=>{const{t:d}=F(["common","list-labels"]),{globalFeatures:p}=O(),{labels:g,isLoading:h,isError:u,filters:m,setFilters:b,pageConfig:v,isAnyFilterActive:f,shouldShowFilters:C,clearAllFilters:_}=(({labelStatus:e,showShipmentIdFilter:t})=>{const n={shipmentId:{enabled:!!t,value:""}},[s,a]=G(n),r=Object.keys(s).some((e=>{const t=s[e];return(null==t?void 0:t.enabled)&&t.value})),i=Object.keys(s).some((e=>{const t=s[e];return null==t?void 0:t.enabled}));H((()=>{a({shipmentId:{enabled:!!t,value:""}})}),[t]);const{getServiceName:o}=ee(),{page:l,pageSize:c,pagerProps:d}=ne(20),{data:p,isLoading:g,isError:h}=J({queryFnParams:{labelStatus:e,page:l,pageSize:c,shipmentId:s.shipmentId.value||void 0,sortBy:"modified_at",sortDir:"desc"}}),u=q((()=>(null==p?void 0:p.labels.map((e=>Object.assign(Object.assign({},e),{serviceName:o(e)}))))||[]),[null==p?void 0:p.labels,o]),m=i&&(r||Boolean(null==u?void 0:u.length));return{clearAllFilters:()=>{a(n)},filters:s,isAnyFilterActive:r,isError:h,isLoading:g,labels:u,pageConfig:{currentPage:(null==p?void 0:p.page)||0,pagerProps:d,pagesAmount:(null==p?void 0:p.pages)||0,pageSize:c,showPagination:((null==p?void 0:p.total)||0)>c,totalElements:(null==p?void 0:p.total)||0},setFilters:a,shouldShowFilters:m}})({labelStatus:s,showShipmentIdFilter:a});if(h)return e(y,{message:d("loading.labels")});if(u)return e(se,{css:Pe.errorState,subtitle:[d("list-labels:errorMessages.subtitle"),d("errorMessages.refreshAndTryAgain")],title:d("list-labels:errorMessages.title")});const E={completed:{color:N.SUCCESS,text:d("list-labels:status.completed")},error:{color:N.ERROR,text:d("list-labels:status.error")},processing:{color:N.INFO,text:d("list-labels:status.processing")},voided:{color:N.INFO,text:d("list-labels:status.voided")}},k={delivered:{color:N.SUCCESS,text:d("list-labels:trackingStatus.delivered")},error:{color:N.ERROR,text:d("list-labels:trackingStatus.error")},in_transit:{color:N.GRAY,text:d("list-labels:trackingStatus.inTransit")},unknown:{color:N.ALERT,text:d("list-labels:trackingStatus.unknown")}},T=(e,t)=>{e===x.PRINT_LABEL&&(e=>{null==r||r(),window.open(e.labelDownload.href,"_blank","noopener, noreferrer")})(t),e===x.VOID_LABEL&&(null==i||i(t)),e===x.PRINT_FORMS&&(e=>{null==o||o(),window.open(e.formDownload.href,"_blank","noopener, noreferrer")})(t),e===x.VIEW_DETAILS&&(null==l||l(t))},P=[{headerContent:d("list-labels:headers.shipmentId"),renderCellContent:t=>e(z,Object.assign({component:"span",variant:"body2"},{children:t.shipmentId}))},{headerContent:d("list-labels:headers.parcels"),renderCellContent:t=>e(z,Object.assign({component:"span",variant:"body2"},{children:t.packages.length}))},{headerContent:d("list-labels:headers.recipient"),renderCellContent:s=>t(n,{children:[e(z,Object.assign({component:"p",css:Pe.tableParagraph,variant:"body2"},{children:s.shipTo.name})),t(z,Object.assign({component:"p",css:Pe.tableParagraph,variant:"body2"},{children:[s.shipTo.postalCode,", ",s.shipTo.cityLocality]}))]})},{headerContent:d("list-labels:headers.shipping"),renderCellContent:s=>t(n,{children:[e(z,Object.assign({component:"p",css:Pe.tableParagraph,variant:"body2"},{children:s.serviceName||s.serviceCode})),s.trackable&&e(B.Link,Object.assign({bold:!1,href:s.trackingUrl,isExternal:!0,target:"_blank"},{children:s.trackingNumber}))]})},{headerContent:d("list-labels:headers.created"),renderCellContent:t=>e(ae,{date:t.createdAt,short:!0})},{headerContent:d("list-labels:headers.shipDate"),renderCellContent:t=>e(ae,{date:t.shipDate,short:!0})},{headerContent:d("list-labels:headers.status"),renderCellContent:t=>e($,Object.assign({color:E[t.status].color,variant:W.LINEAL_FILLED},{children:E[t.status].text}))},{headerContent:d("list-labels:headers.trackingStatus"),renderCellContent:t=>e($,Object.assign({color:k[t.trackingStatus].color,variant:W.LINEAL_FILLED},{children:k[t.trackingStatus].text}))}];return g.some((e=>"completed"===e.status))&&P.push({headerContent:"",renderCellContent:t=>{var n,s;const a=!!(null===(n=t.labelDownload)||void 0===n?void 0:n.href)&&"completed"===t.status,r=!!i&&"completed"===t.status,o=!!(null===(s=t.formDownload)||void 0===s?void 0:s.href)&&"completed"===t.status,c=!!l;if(!(a||r||o||c))return null;const d=[...c?[x.VIEW_DETAILS]:[],...a?[x.PRINT_LABEL]:[],...r?[x.VOID_LABEL]:[],...o?[x.PRINT_FORMS]:[]];return e(w,{allowedActions:d,onActionClick:e=>T(e,t)})}}),t(n,{children:[e(re,{columns:P,data:g,emptyContent:e(M,f?Object.assign({isElevated:!1,subtitle:d("list-labels:emptyWithFilters.subtitle"),title:d("list-labels:emptyWithFilters.title")},{children:e(U,Object.assign({onClick:_},{children:d("list-labels:emptyWithFilters.button")}))}):{isElevated:!1,subtitle:d("list-labels:empty.subtitle"),title:d("list-labels:empty.title")}),filters:C&&e(ie,{filters:m,onClearAllFilters:_,onFiltersUpdated:b}),footerContent:e(oe,{onPageChange:v.pagerProps.onPageSelect,page:v.currentPage,pages:v.pagesAmount,pageSize:v.pageSize,showPagination:v.showPagination,total:v.totalElements}),onRowClick:c}),p.poweredByShipEngine&&t(n,{children:[e(j,{}),e(S,{})]})]})},De=a(Ae,C,{css:{height:"100%",minWidth:"440px",width:"100%"},resources:{en:r}});var Ie=Object.freeze({__proto__:null,Component:Ae,Element:De});const Le=(e,t)=>({end:ge(he(t,59),23),start:ge(he(e,0),0)}),Re=(e,t)=>({createdDate:{enabled:t,value:null},shipmentId:{enabled:e,value:""}}),ze=({shipmentStatus:e,showShipmentIdFilter:t=!0,showCreatedDateFilter:n=!0})=>{var s,a,r,i;const o=Re(t,n),{getServiceName:l}=ee(),{page:c,pageSize:d,pagerProps:p}=ne(20),[g,h]=G(o),u=Object.keys(g).some((e=>{const t=g[e];return(null==t?void 0:t.enabled)&&t.value})),m=Object.keys(g).some((e=>{const t=g[e];return null==t?void 0:t.enabled}));H((()=>{const e=Re(t,n);h(e)}),[n,t]);const{data:b,isLoading:v,isError:f}=Q(Object.assign({page:c,pageSize:d,shipmentStatus:e,sortBy:"modified_at",sortDir:"desc"},((e,t)=>{if(!e||!t)return{};const n=Le(e,t);return{createdAtEnd:ce(n.end),createdAtStart:ce(n.start)}})(null===(a=null===(s=g.createdDate)||void 0===s?void 0:s.value)||void 0===a?void 0:a.start,null===(i=null===(r=g.createdDate)||void 0===r?void 0:r.value)||void 0===i?void 0:i.end))),C=q((()=>null==b?void 0:b.shipments.map((e=>Object.assign(Object.assign({},e),{serviceName:l(e)})))),[null==b?void 0:b.shipments,l]),O=m&&(u||Boolean(null==C?void 0:C.length)),{data:y,error:j,isInitialLoading:S}=X({queryFnParams:{shipmentId:g.shipmentId.value||void 0},retry:!1}),w=g.shipmentId.value,x=(t=>{var n,s,a,r;if(w&&!j){let i=!0;e&&(null==t?void 0:t.shipmentStatus)!==e&&(i=!1);const o=null===(n=g.createdDate)||void 0===n?void 0:n.value;return(null==o?void 0:o.start)&&o.end&&(null==t?void 0:t.createdAt)&&(s=o.start,a=o.end,r=t.createdAt,de(s,a)&&de(s,new Date(r))||pe(new Date(r),Le(s,a))||(i=!1)),i?t:void 0}})(y),_=w&&(j||!x);return{clearAllFilters:()=>{h(o)},filters:g,getGridData:()=>x?[Object.assign(Object.assign({},x),{serviceName:l(x)})]:_?[]:C||[],isAnyFilterActive:u,isError:f,isLoading:v||S,pageConfig:{currentPage:x?1:(null==b?void 0:b.page)||0,pagerProps:p,pagesAmount:(null==b?void 0:b.pages)||0,pageSize:d,showPagination:!x&&((null==b?void 0:b.total)||0)>d,totalElements:x?1:(null==b?void 0:b.total)||0},setFilters:e=>{p.onPageSelect(1),h(e)},shipments:C,shouldShowFilters:O}},Ne=le({errorState:e=>Object.assign({backgroundColor:e.palette.white},e.getComponentOverride("Table")),tableParagraph:{margin:0}}),Be=({onRowClick:s,shipmentStatus:a,showShipmentIdFilter:r=!0,showCreatedDateFilter:i=!0})=>{const{t:o}=F(["common","list-shipments"]),{globalFeatures:l}=O(),{isLoading:c,isError:d,filters:p,setFilters:g,pageConfig:h,getGridData:u,isAnyFilterActive:m,shouldShowFilters:b,clearAllFilters:v}=ze({shipmentStatus:a,showCreatedDateFilter:i,showShipmentIdFilter:r});if(c)return e(y,{message:o("loading.shipments")});if(d)return e(se,{css:Ne.errorState,subtitle:[o("list-shipments:errorMessages.subtitle"),o("errorMessages.refreshAndTryAgain")],title:o("list-shipments:errorMessages.title")});const f={cancelled:{color:N.ALERT,text:o("list-shipments:status.cancelled")},label_purchased:{color:N.SUCCESS,text:o("list-shipments:status.purchased")},pending:{color:N.SUCCESS,text:o("list-shipments:status.readyToBuy")},processing:{color:N.INFO,text:o("list-shipments:status.processing")}},C=[{headerContent:o("list-shipments:headers.shipmentId"),renderCellContent:t=>e(z,Object.assign({component:"p",css:Ne.tableParagraph,variant:"body2"},{children:t.shipmentId}))},{headerContent:o("list-shipments:headers.parcels"),renderCellContent:t=>e(z,Object.assign({component:"p",css:Ne.tableParagraph,variant:"body2"},{children:t.packages.length}))},{headerContent:o("list-shipments:headers.recipient"),renderCellContent:s=>{const a=!!(s.shipTo.name||s.shipTo.postalCode||s.shipTo.cityLocality),r=!(!s.shipTo.postalCode&&!s.shipTo.cityLocality);return a?t(n,{children:[e(z,Object.assign({component:"p",css:Ne.tableParagraph,variant:"body2"},{children:s.shipTo.name})),r&&e(z,Object.assign({component:"p",css:Ne.tableParagraph,variant:"body2"},{children:[s.shipTo.postalCode,s.shipTo.cityLocality].filter(Boolean).join(", ")}))]}):"--"}},{headerContent:o("list-shipments:headers.shipping"),renderCellContent:t=>e(z,Object.assign({component:"p",css:Ne.tableParagraph,variant:"body2"},{children:t.serviceName||o("list-shipments:none")}))},{headerContent:o("list-shipments:headers.created"),renderCellContent:t=>e(ae,{date:t.createdAt,short:!0})},{headerContent:o("list-shipments:headers.modified"),renderCellContent:t=>e(ae,{date:t.modifiedAt,short:!0})},{headerContent:o("list-shipments:headers.status"),renderCellContent:t=>e($,Object.assign({color:f[t.shipmentStatus].color,variant:W.LINEAL_FILLED},{children:f[t.shipmentStatus].text}))}];return t(n,{children:[e(re,{columns:C,data:u(),emptyContent:e(M,m?Object.assign({isElevated:!1,subtitle:o("list-shipments:emptyState.filtersSubtitle"),title:o("list-shipments:emptyState.filtersTitle")},{children:e(U,Object.assign({onClick:v},{children:o("list-shipments:emptyState.viewAll")}))}):{isElevated:!1,subtitle:o("list-shipments:emptyState.subtitle"),title:o("list-shipments:emptyState.title")}),filters:b&&e(ie,{filters:p,onClearAllFilters:v,onFiltersUpdated:g}),footerContent:e(oe,{onPageChange:h.pagerProps.onPageSelect,page:h.currentPage,pages:h.pagesAmount,pageSize:h.pageSize,showPagination:h.showPagination,total:h.totalElements}),onRowClick:s}),l.poweredByShipEngine&&t(n,{children:[e(j,{}),e(S,{})]})]})},$e=a(Be,C,{css:{height:"100%",minWidth:"440px",width:"100%"},resources:{en:r}});var We=Object.freeze({__proto__:null,Component:Be,Element:$e});const Me=Y(void 0),Ue=({children:t,editableTheme:n})=>{const[s,a]=G(n);return e(Me.Provider,Object.assign({value:{setThemeConfig:a,themeConfig:s}},{children:t}))},Ge=()=>{const e=Z(Me);if(!e)throw new Error("useThemeConfigurator must be used within a ThemeConfiguratorProvider");return e},Ve=t=>{var n=T(t,[]);return e(ye,Object.assign({},n))},Ke=a(Ve,C,{resources:{en:r}});var He=Object.freeze({__proto__:null,Component:Ve,Element:Ke});const qe=()=>{const t=T(d(),[]);return e(p,Object.assign({},t))},Ze=a(qe,C,{resources:{en:r}});var Ye=Object.freeze({__proto__:null,Component:qe,Element:Ze});const Je=({onRedirectToOnboarding:t})=>e(g,{onRedirectToOnboarding:t}),Qe=a(Je,C,{resources:{en:r}});var Xe=Object.freeze({__proto__:null,Component:Je,Element:Qe});const et=()=>{const t=T(h(),[]);return e(u,Object.assign({},t))},tt=a(et,C,{resources:{en:r}});var nt=Object.freeze({__proto__:null,Component:et,Element:tt});const st=({onRedirectToOnboarding:t})=>e(m,{onRedirectToOnboarding:t}),at=a(st,C,{resources:{en:r}});var rt=Object.freeze({__proto__:null,Component:st,Element:at});const it=()=>e(b,{}),ot=a(it,C,{resources:{en:r}});var lt=Object.freeze({__proto__:null,Component:it,Element:ot});export{Ue as T,Ee as a,Fe as b,Ye as c,Xe as d,nt as e,lt as f,Ie as l,we as m,rt as p,We as s,He as t,Ge as u};
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as n}from"@emotion/react/jsx-runtime";import{S as a,c as s,e as r,u as i,M as o,d as l,E as c,f as d,U as p,g,h as u,i as h,P as b,T as m}from"./use-unit-settings.js";import{T as v,h as f,m as C,G as O,r as y,v as j,P as S,y as w,z as x}from"./actions-menu.js";import{k as E,t as _,q as k,T}from"./carrier.js";import{useTranslation as F}from"react-i18next";import{Icon as I,IconSize as P,Select as D,Option as A,Input as L,Popover as R,Typography as z,TagColor as N,Next as B,Tag as $,TagVariant as W,EmptyState as M,Button as U}from"@shipengine/giger";import{useState as G,useCallback as V,useRef as K,useEffect as H,useMemo as q,useContext as Z,createContext as Y}from"react";import{useListLabels as J,useGetLabel as Q,useListShipments as X,useGetShipment as ee}from"@shipengine/react-api";import{u as te}from"./use-get-service-name.js";import{D as ne,u as ae,E as se,C as re,G as ie,b as oe,a as le}from"./usePager.js";import{h as ce}from"./vat.js";import{formatISO as de}from"date-fns/formatISO";import{isSameDay as pe}from"date-fns/isSameDay";import{isWithinInterval as ge}from"date-fns/isWithinInterval";import{setHours as ue}from"date-fns/setHours";import{setMinutes as he}from"date-fns/setMinutes";import{IconNames as be}from"@shipengine/giger-theme";import{d as me}from"./use-toggle.js";const ve=ce({category:{alignItems:"center",cursor:"pointer",display:"flex",flexDirection:"row",justifyContent:"space-between"},colorPicker:e=>({"&::-webkit-color-swatch":{border:`1px solid ${e.palette.gray.light}`,borderRadius:"4px",padding:0},"&::-webkit-color-swatch-wrapper":{padding:0},alignSelf:"center",appearance:"none",background:"none",border:0,cursor:"pointer",height:e.spacing(4.25),outline:"none",width:e.spacing(4.25)}),container:e=>({marginBottom:e.spacing(2)}),input:e=>({border:`1px solid ${e.palette.gray.light}`,borderRadius:"4px",color:e.palette.gray.main,fontSize:"14px",padding:e.spacing(1)}),inputContainer:e=>({alignItems:"center",display:"flex",flexDirection:"row",justifyContent:"space-between",padding:`${e.spacing(2)}px 0`}),wrapper:e=>({display:"flex",gap:e.spacing(1)})}),fe=({paletteConfig:n,onUpdatePaletteConfig:a,formatKey:s})=>{const[r,i]=G(new Set),o=e=>{i((t=>{const n=new Set(t);return n.has(e)?new Set([...n].filter((t=>t!==e))):new Set([...n,e])}))},l=V(((e,t,s)=>{const r=(e=>{if(e)return e.match(/^#[0-9A-Fa-f]{0,6}$/)?e:e.match(/^[0-9A-Fa-f]{6}$/)?`#${e}`:void 0})(s),i=Object.assign(Object.assign({},n||{}),{[e]:Object.assign(Object.assign({},(null==n?void 0:n[e])||{}),{[t]:r})});a(i)}),[a,n]);return e("div",Object.assign({"data-test-id":"color-palette-editor"},{children:n&&Object.keys(n).map((a=>t("div",Object.assign({css:ve.container,id:a},{children:[t("div",Object.assign({"aria-expanded":r.has(a),css:ve.category,onClick:e=>{e.preventDefault(),o(a)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),o(a))},role:"button",tabIndex:0},{children:[e("p",{children:E(a)}),e(I,{name:r.has(a)?be.CHEVRON_TOP:be.CHEVRON_BOTTOM,size:P.SIZE_REGULAR})]})),r.has(a)&&Object.keys(n[a]).map((r=>t("div",Object.assign({css:ve.inputContainer,id:"input-container"},{children:[e("label",Object.assign({css:{fontWeight:"bold"},htmlFor:`${a}.${r}`},{children:s(r)})),t("form",Object.assign({css:ve.wrapper},{children:[e("input",{css:ve.input,onChange:e=>{e.preventDefault(),l(a,r,e.target.value)},onKeyDown:e=>{"Enter"===e.key&&e.preventDefault()},type:"text",value:n[a][r]}),e("input",{css:ve.colorPicker,onChange:e=>l(a,r,e.target.value),type:"color",value:n[a][r]})]}))]}),r)))]}),a)))}))},Ce=ce({input:e=>({border:`1px solid ${e.palette.gray.light}`,borderRadius:"4px",color:e.palette.gray.main,fontSize:"14px",maxWidth:e.spacing(16),padding:0}),keys:{fontSize:"16px",fontWeight:"bold",marginTop:"8px"},section:e=>({"& > div:first-child":{flexGrow:3},"& > div:last-child":{flexShrink:1},display:"flex",gap:e.spacing(1),justifyContent:"space-between"}),sectionContainer:e=>({marginBottom:e.spacing(4)}),select:e=>({border:`1px solid ${e.palette.gray.light}`,borderRadius:"4px",color:e.palette.gray.main,fontSize:"14px"})}),Oe=({onUpdateTypographyConfig:a,typographyConfig:s,formatKey:r})=>{const i=V(((e,t,n)=>{const r=Object.assign(Object.assign({},s||{}),{[e]:Object.assign(Object.assign({},(null==s?void 0:s[e])||{}),{[t]:n})});a(r)}),[a,s]),o=V(((e,t)=>{if(e)return e[t]}),[]),l=(t,n)=>{var a;const r=[{label:"Normal",value:"400"},{label:"Semi Bold",value:"600"},{label:"Bold",value:"700"}],l=null===(a=o(s,t))||void 0===a?void 0:a.fontWeight.toString(),c=void 0!==l?r.find((e=>e.value===l)):void 0;return e(D,Object.assign({css:Ce.select,label:"Font Weight",name:"font-weight",onChange:(e,a)=>i(t,n,null==a?void 0:a.value),value:c},{children:r.map((t=>e(A,Object.assign({value:t.value},{children:t.label}),t.value)))}))},c=(t,n)=>{var a;const r=null===(a=o(s,t))||void 0===a?void 0:a.fontSize.replace("px","");return e(L,{"aria-labelledby":`${t}.${n}`,css:Ce.input,label:"Font Size(px)",onChange:e=>{e.target.value.match(/^\d{0,2}$/)&&i(t,n,`${e.target.value}px`)},value:r})},d=(t,a)=>{switch(a){case"fontWeight":return e(n,{children:l(t,a)});case"fontSize":return e(n,{children:c(t,a)});default:return null}};return e("div",{children:s&&Object.keys(s).map((n=>t("div",Object.assign({css:Ce.sectionContainer},{children:[e("p",Object.assign({css:Ce.keys,id:n},{children:r(n)})),e("section",Object.assign({css:Ce.section},{children:Object.keys(s[n]).map((t=>e("div",Object.assign({id:`${n}.${t}`},{children:d(n,t)}),t)))}))]}),n)))})},ye=ce({container:e=>({color:e.palette.gray.dark,display:"flex",flexDirection:"column",flexGrow:1,overflow:"hidden",position:"relative"}),content:e=>({display:"flex",flexDirection:"column",gap:e.spacing(3),padding:e.spacing(3)}),copy:e=>({backgroundColor:e.palette.white,borderRadius:"4px",padding:e.spacing(.5)}),drawerHeader:e=>({alignItems:"center",display:"flex",gap:e.spacing(2),justifyContent:"end",width:"50%"}),drawerWrapper:{display:"flex",justifyContent:"space-between",position:"relative"},header:{alignItems:"center",display:"flex",justifyContent:"space-between"},popoverWrapper:e=>({display:"flex",flexDirection:"column",gap:e.spacing(1)}),pre:e=>({backgroundColor:"#FFFFFF66",borderRadius:"8px",fontSize:"14px",padding:e.spacing(.3)}),presetOption:e=>({"&:hover":{backgroundColor:"theme.palette.gray.ultraLight"},backgroundColor:"transparent",borderRadius:"4px",fontSize:"14px",padding:e.spacing(1)}),presetsButton:e=>({"&:hover":{backgroundColor:"#d1d4d7"},backgroundColor:"#E4E5E7",borderRadius:"4px",cursor:"pointer",display:"flex",fontSize:"14px",gap:e.spacing(.5),padding:`${e.spacing(.5)}px ${e.spacing(1)}px`})}),je=({themeConfig:n,onUpdateThemeConfig:a,presets:s,showDrawer:r})=>{const i=K(n),[o,l]=G(!1),c=Object.keys(n).flatMap((e=>{if("components"===e&&n[e]&&"object"==typeof n[e]){return Object.keys(n[e])}return[e]})).map((e=>"palette"===e?{label:"Color Palette",value:"Color Palette"}:{label:E(e),value:E(e)})),[d,p]=G(c.sort()[0].value),g=e=>_(k(e)),u=K(null),[h,b]=me(!1),m=e=>{a(e)};return t("div",Object.assign({"aria-label":"Theme Creator",css:ye.container,"data-testid":"theme-creator",role:"region"},{children:[t("div",Object.assign({css:ye.content},{children:[t("div",Object.assign({css:ye.header},{children:[e(v,{onSelectTab:e=>{p(e)},selectedTab:d,tabs:c}),s?t("div",{children:[t("button",Object.assign({"aria-controls":"presets-popover","aria-expanded":h,css:ye.presetsButton,onClick:e=>{e.preventDefault(),b()},ref:u},{children:["Presets",e(I,{name:be.CARET_BOTTOM,size:P.SIZE_SMALL})]})),e(R,Object.assign({container:document.querySelector("#theme-creator"),isOpen:h,onClickAway:()=>b(),placement:"bottom-end",reference:u.current},{children:t("div",Object.assign({css:ye.popoverWrapper},{children:[e("button",Object.assign({"aria-label":"Set Default Theme",css:ye.presetOption,onClick:e=>{e.preventDefault(),b(),m(i.current)},role:"menuitem"},{children:"Default"})),s.map((t=>e("button",Object.assign({"aria-label":`Set ${t.presetName} Theme`,css:ye.presetOption,onClick:e=>{e.preventDefault(),b(),m(t.themeConfig)},role:"menuitem"},{children:t.presetName}),t.presetName)))]}))}))]}):e("button",Object.assign({"aria-label":"Set Default Theme",css:ye.presetsButton,onClick:()=>{m(i.current)},role:"menuitem"},{children:"Reset to Default"}))]})),e(z,Object.assign({role:"heading",variant:"heading4"},{children:`${d} Editor`})),((t,n)=>{var s;switch(n){case"Color Palette":return e(fe,{formatKey:g,onUpdatePaletteConfig:e=>{a(Object.assign(Object.assign({},t),{palette:e}))},paletteConfig:t.palette});case"Typography":return e(Oe,{formatKey:g,onUpdateTypographyConfig:e=>{a(Object.assign(Object.assign({},t),{components:Object.assign(Object.assign({},t.components),{Typography:e})}))},typographyConfig:null===(s=t.components)||void 0===s?void 0:s.Typography});default:return null}})(n,d)]})),r&&e(ne,Object.assign({"aria-label":"Show themeConfig.js Code Drawer",headerContent:t("div",Object.assign({css:ye.drawerHeader},{children:[e("pre",Object.assign({css:ye.pre},{children:"themeConfig.js"})),r.copyToClipboardText&&e("div",Object.assign({css:ye.copy},{children:e(f,{content:r.copyToClipboardText})}))]})),isOpen:o,toggleDrawer:()=>l(!o)},{children:r.content}))]}))},Se=({onRedirectToOnboarding:t})=>e(a,{onRedirectToOnboarding:t}),we=s(Se,C,{resources:{en:r}});var xe=Object.freeze({__proto__:null,Component:Se,Element:we});const Ee=()=>{const t=T(i(),[]);return e(o,Object.assign({},t))},_e=s(Ee,C,{resources:{en:r}});var ke=Object.freeze({__proto__:null,Component:Ee,Element:_e});const Te=({isModalFullScreen:t})=>{const n=T(l(),[]);return e(c,Object.assign({isModalFullScreen:t},n))},Fe=s(Te,C,{resources:{en:r}});var Ie=Object.freeze({__proto__:null,Component:Te,Element:Fe});const Pe=ce({errorState:e=>Object.assign({backgroundColor:e.palette.white},e.getComponentOverride("Table")),tableParagraph:{margin:0}}),De=({labelStatus:a,showShipmentIdFilter:s=!0,showLabelIdFilter:r=!0,onClickPrintLabel:i,onClickVoidLabel:o,onClickPrintForms:l,onClickViewDetails:c,onRowClick:d})=>{const{t:p}=F(["common","list-labels"]),{globalFeatures:g}=O(),{labels:u,getGridData:h,isError:b,isLoading:m,filters:v,setFilters:f,pageConfig:C,isAnyFilterActive:E,shouldShowFilters:_,clearAllFilters:k}=(({labelStatus:e,showShipmentIdFilter:t,showLabelIdFilter:n})=>{var a,s;const r={labelId:{enabled:!!n,value:""},shipmentId:{enabled:!!t,value:""}},{getServiceName:i}=te(),{page:o,pageSize:l,pagerProps:c}=ae(20),[d,p]=G(r),g=Object.keys(d).some((e=>{const t=d[e];return(null==t?void 0:t.enabled)&&t.value})),u=Object.keys(d).some((e=>{const t=d[e];return null==t?void 0:t.enabled}));H((()=>{p({labelId:{enabled:!!n,value:""},shipmentId:{enabled:!!t,value:""}})}),[n,t]);const{data:h,isLoading:b,isError:m}=J({queryFnParams:{labelStatus:e,page:o,pageSize:l,shipmentId:d.shipmentId.value||void 0,sortBy:"modified_at",sortDir:"desc"}}),v=q((()=>(null==h?void 0:h.labels.map((e=>Object.assign(Object.assign({},e),{serviceName:i(e)}))))||[]),[null==h?void 0:h.labels,i]),f=u&&(g||Boolean(null==v?void 0:v.length)),{data:C,isError:O,isInitialLoading:y}=Q((null===(a=d.labelId)||void 0===a?void 0:a.value)||void 0),j=null===(s=d.labelId)||void 0===s?void 0:s.value,S=(t=>{if(j&&!O){let n=!0;return e&&e!==(null==t?void 0:t.status)&&(n=!1),""!==(null==d?void 0:d.shipmentId.value)&&(null==d?void 0:d.shipmentId.value)!==(null==t?void 0:t.shipmentId)&&(n=!1),n?t:void 0}})(C),w=j&&(O||!S);return{clearAllFilters:()=>{p(r)},filters:d,getGridData:()=>S?[Object.assign(Object.assign({},S),{serviceName:i(S)})]:w?[]:v||[],isAnyFilterActive:g,isError:m,isLoading:b||y,labels:v,pageConfig:{currentPage:S?1:(null==h?void 0:h.page)||0,pagerProps:c,pagesAmount:(null==h?void 0:h.pages)||0,pageSize:l,showPagination:!S&&((null==h?void 0:h.total)||0)>l,totalElements:S?1:(null==h?void 0:h.total)||0},setFilters:e=>{c.onPageSelect(1),p(e)},shouldShowFilters:f}})({labelStatus:a,showLabelIdFilter:r,showShipmentIdFilter:s});if(m)return e(y,{message:p("loading.labels")});if(b)return e(se,{css:Pe.errorState,subtitle:[p("list-labels:errorMessages.subtitle"),p("errorMessages.refreshAndTryAgain")],title:p("list-labels:errorMessages.title")});const T={completed:{color:N.SUCCESS,text:p("list-labels:status.completed")},error:{color:N.ERROR,text:p("list-labels:status.error")},processing:{color:N.INFO,text:p("list-labels:status.processing")},voided:{color:N.INFO,text:p("list-labels:status.voided")}},I={delivered:{color:N.SUCCESS,text:p("list-labels:trackingStatus.delivered")},error:{color:N.ERROR,text:p("list-labels:trackingStatus.error")},in_transit:{color:N.GRAY,text:p("list-labels:trackingStatus.inTransit")},unknown:{color:N.ALERT,text:p("list-labels:trackingStatus.unknown")}},P=(e,t)=>{e===x.PRINT_LABEL&&(e=>{null==i||i(),window.open(e.labelDownload.href,"_blank","noopener, noreferrer")})(t),e===x.VOID_LABEL&&(null==o||o(t)),e===x.PRINT_FORMS&&(e=>{null==l||l(),window.open(e.formDownload.href,"_blank","noopener, noreferrer")})(t),e===x.VIEW_DETAILS&&(null==c||c(t))},D=[{headerContent:p("list-labels:headers.shipmentId"),renderCellContent:t=>e(z,Object.assign({component:"span",variant:"body2"},{children:t.shipmentId}))},{headerContent:p("list-labels:headers.labelId"),renderCellContent:t=>e(z,Object.assign({component:"span",variant:"body2"},{children:t.labelId}))},{headerContent:p("list-labels:headers.parcels"),renderCellContent:t=>e(z,Object.assign({component:"span",variant:"body2"},{children:t.packages.length}))},{headerContent:p("list-labels:headers.recipient"),renderCellContent:a=>t(n,{children:[e(z,Object.assign({component:"p",css:Pe.tableParagraph,variant:"body2"},{children:a.shipTo.name})),t(z,Object.assign({component:"p",css:Pe.tableParagraph,variant:"body2"},{children:[a.shipTo.postalCode,", ",a.shipTo.cityLocality]}))]})},{headerContent:p("list-labels:headers.shipping"),renderCellContent:a=>t(n,{children:[e(z,Object.assign({component:"p",css:Pe.tableParagraph,variant:"body2"},{children:a.serviceName||a.serviceCode})),a.trackable&&e(B.Link,Object.assign({bold:!1,href:a.trackingUrl,isExternal:!0,target:"_blank"},{children:a.trackingNumber}))]})},{headerContent:p("list-labels:headers.created"),renderCellContent:t=>e(re,{date:t.createdAt,short:!0})},{headerContent:p("list-labels:headers.shipDate"),renderCellContent:t=>e(re,{date:t.shipDate,short:!0})},{headerContent:p("list-labels:headers.status"),renderCellContent:t=>e($,Object.assign({color:T[t.status].color,variant:W.LINEAL_FILLED},{children:T[t.status].text}))},{headerContent:p("list-labels:headers.trackingStatus"),renderCellContent:t=>e($,Object.assign({color:I[t.trackingStatus].color,variant:W.LINEAL_FILLED},{children:I[t.trackingStatus].text}))}];return u.some((e=>"completed"===e.status))&&D.push({headerContent:"",renderCellContent:t=>{var n,a;const s=!!(null===(n=t.labelDownload)||void 0===n?void 0:n.href)&&"completed"===t.status,r=!!o&&"completed"===t.status,i=!!(null===(a=t.formDownload)||void 0===a?void 0:a.href)&&"completed"===t.status,l=!!c;if(!(s||r||i||l))return null;const d=[...l?[x.VIEW_DETAILS]:[],...s?[x.PRINT_LABEL]:[],...r?[x.VOID_LABEL]:[],...i?[x.PRINT_FORMS]:[]];return e(w,{allowedActions:d,onActionClick:e=>P(e,t)})}}),t(n,{children:[e(ie,{columns:D,data:h(),emptyContent:e(M,E?Object.assign({isElevated:!1,subtitle:p("list-labels:emptyWithFilters.subtitle"),title:p("list-labels:emptyWithFilters.title")},{children:e(U,Object.assign({onClick:k},{children:p("list-labels:emptyWithFilters.button")}))}):{isElevated:!1,subtitle:p("list-labels:empty.subtitle"),title:p("list-labels:empty.title")}),filters:_&&e(oe,{filters:v,onClearAllFilters:k,onFiltersUpdated:f}),footerContent:e(le,{onPageChange:C.pagerProps.onPageSelect,page:C.currentPage,pages:C.pagesAmount,pageSize:C.pageSize,showPagination:C.showPagination,total:C.totalElements}),onRowClick:d}),g.poweredByShipEngine&&t(n,{children:[e(j,{}),e(S,{})]})]})},Ae=s(De,C,{css:{height:"100%",minWidth:"440px",width:"100%"},resources:{en:r}});var Le=Object.freeze({__proto__:null,Component:De,Element:Ae});const Re=(e,t)=>({end:ue(he(t,59),23),start:ue(he(e,0),0)}),ze=(e,t)=>({createdDate:{enabled:t,value:null},shipmentId:{enabled:e,value:""}}),Ne=({shipmentStatus:e,showShipmentIdFilter:t=!0,showCreatedDateFilter:n=!0})=>{var a,s,r,i;const o=ze(t,n),{getServiceName:l}=te(),{page:c,pageSize:d,pagerProps:p}=ae(20),[g,u]=G(o),h=Object.keys(g).some((e=>{const t=g[e];return(null==t?void 0:t.enabled)&&t.value})),b=Object.keys(g).some((e=>{const t=g[e];return null==t?void 0:t.enabled}));H((()=>{const e=ze(t,n);u(e)}),[n,t]);const{data:m,isLoading:v,isError:f}=X(Object.assign({page:c,pageSize:d,shipmentStatus:e,sortBy:"modified_at",sortDir:"desc"},((e,t)=>{if(!e||!t)return{};const n=Re(e,t);return{createdAtEnd:de(n.end),createdAtStart:de(n.start)}})(null===(s=null===(a=g.createdDate)||void 0===a?void 0:a.value)||void 0===s?void 0:s.start,null===(i=null===(r=g.createdDate)||void 0===r?void 0:r.value)||void 0===i?void 0:i.end))),C=q((()=>null==m?void 0:m.shipments.map((e=>Object.assign(Object.assign({},e),{serviceName:l(e)})))),[null==m?void 0:m.shipments,l]),O=b&&(h||Boolean(null==C?void 0:C.length)),{data:y,error:j,isInitialLoading:S}=ee({queryFnParams:{shipmentId:g.shipmentId.value||void 0},retry:!1}),w=g.shipmentId.value,x=(t=>{var n,a,s,r;if(w&&!j){let i=!0;e&&(null==t?void 0:t.shipmentStatus)!==e&&(i=!1);const o=null===(n=g.createdDate)||void 0===n?void 0:n.value;return(null==o?void 0:o.start)&&o.end&&(null==t?void 0:t.createdAt)&&(a=o.start,s=o.end,r=t.createdAt,pe(a,s)&&pe(a,new Date(r))||ge(new Date(r),Re(a,s))||(i=!1)),i?t:void 0}})(y),E=w&&(j||!x);return{clearAllFilters:()=>{u(o)},filters:g,getGridData:()=>x?[Object.assign(Object.assign({},x),{serviceName:l(x)})]:E?[]:C||[],isAnyFilterActive:h,isError:f,isLoading:v||S,pageConfig:{currentPage:x?1:(null==m?void 0:m.page)||0,pagerProps:p,pagesAmount:(null==m?void 0:m.pages)||0,pageSize:d,showPagination:!x&&((null==m?void 0:m.total)||0)>d,totalElements:x?1:(null==m?void 0:m.total)||0},setFilters:e=>{p.onPageSelect(1),u(e)},shipments:C,shouldShowFilters:O}},Be=ce({errorState:e=>Object.assign({backgroundColor:e.palette.white},e.getComponentOverride("Table")),tableParagraph:{margin:0}}),$e=({onRowClick:a,shipmentStatus:s,showShipmentIdFilter:r=!0,showCreatedDateFilter:i=!0})=>{const{t:o}=F(["common","list-shipments"]),{globalFeatures:l}=O(),{isLoading:c,isError:d,filters:p,setFilters:g,pageConfig:u,getGridData:h,isAnyFilterActive:b,shouldShowFilters:m,clearAllFilters:v}=Ne({shipmentStatus:s,showCreatedDateFilter:i,showShipmentIdFilter:r});if(c)return e(y,{message:o("loading.shipments")});if(d)return e(se,{css:Be.errorState,subtitle:[o("list-shipments:errorMessages.subtitle"),o("errorMessages.refreshAndTryAgain")],title:o("list-shipments:errorMessages.title")});const f={cancelled:{color:N.ALERT,text:o("list-shipments:status.cancelled")},label_purchased:{color:N.SUCCESS,text:o("list-shipments:status.purchased")},pending:{color:N.SUCCESS,text:o("list-shipments:status.readyToBuy")},processing:{color:N.INFO,text:o("list-shipments:status.processing")}},C=[{headerContent:o("list-shipments:headers.shipmentId"),renderCellContent:t=>e(z,Object.assign({component:"p",css:Be.tableParagraph,variant:"body2"},{children:t.shipmentId}))},{headerContent:o("list-shipments:headers.parcels"),renderCellContent:t=>e(z,Object.assign({component:"p",css:Be.tableParagraph,variant:"body2"},{children:t.packages.length}))},{headerContent:o("list-shipments:headers.recipient"),renderCellContent:a=>{const s=!!(a.shipTo.name||a.shipTo.postalCode||a.shipTo.cityLocality),r=!(!a.shipTo.postalCode&&!a.shipTo.cityLocality);return s?t(n,{children:[e(z,Object.assign({component:"p",css:Be.tableParagraph,variant:"body2"},{children:a.shipTo.name})),r&&e(z,Object.assign({component:"p",css:Be.tableParagraph,variant:"body2"},{children:[a.shipTo.postalCode,a.shipTo.cityLocality].filter(Boolean).join(", ")}))]}):"--"}},{headerContent:o("list-shipments:headers.shipping"),renderCellContent:t=>e(z,Object.assign({component:"p",css:Be.tableParagraph,variant:"body2"},{children:t.serviceName||o("list-shipments:none")}))},{headerContent:o("list-shipments:headers.created"),renderCellContent:t=>e(re,{date:t.createdAt,short:!0})},{headerContent:o("list-shipments:headers.modified"),renderCellContent:t=>e(re,{date:t.modifiedAt,short:!0})},{headerContent:o("list-shipments:headers.status"),renderCellContent:t=>e($,Object.assign({color:f[t.shipmentStatus].color,variant:W.LINEAL_FILLED},{children:f[t.shipmentStatus].text}))}];return t(n,{children:[e(ie,{columns:C,data:h(),emptyContent:e(M,b?Object.assign({isElevated:!1,subtitle:o("list-shipments:emptyState.filtersSubtitle"),title:o("list-shipments:emptyState.filtersTitle")},{children:e(U,Object.assign({onClick:v},{children:o("list-shipments:emptyState.viewAll")}))}):{isElevated:!1,subtitle:o("list-shipments:emptyState.subtitle"),title:o("list-shipments:emptyState.title")}),filters:m&&e(oe,{filters:p,onClearAllFilters:v,onFiltersUpdated:g}),footerContent:e(le,{onPageChange:u.pagerProps.onPageSelect,page:u.currentPage,pages:u.pagesAmount,pageSize:u.pageSize,showPagination:u.showPagination,total:u.totalElements}),onRowClick:a}),l.poweredByShipEngine&&t(n,{children:[e(j,{}),e(S,{})]})]})},We=s($e,C,{css:{height:"100%",minWidth:"440px",width:"100%"},resources:{en:r}});var Me=Object.freeze({__proto__:null,Component:$e,Element:We});const Ue=Y(void 0),Ge=({children:t,editableTheme:n})=>{const[a,s]=G(n);return e(Ue.Provider,Object.assign({value:{setThemeConfig:s,themeConfig:a}},{children:t}))},Ve=()=>{const e=Z(Ue);if(!e)throw new Error("useThemeConfigurator must be used within a ThemeConfiguratorProvider");return e},Ke=t=>{var n=T(t,[]);return e(je,Object.assign({},n))},He=s(Ke,C,{resources:{en:r}});var qe=Object.freeze({__proto__:null,Component:Ke,Element:He});const Ze=()=>{const t=T(d(),[]);return e(p,Object.assign({},t))},Ye=s(Ze,C,{resources:{en:r}});var Je=Object.freeze({__proto__:null,Component:Ze,Element:Ye});const Qe=({onRedirectToOnboarding:t})=>e(g,{onRedirectToOnboarding:t}),Xe=s(Qe,C,{resources:{en:r}});var et=Object.freeze({__proto__:null,Component:Qe,Element:Xe});const tt=()=>{const t=T(u(),[]);return e(h,Object.assign({},t))},nt=s(tt,C,{resources:{en:r}});var at=Object.freeze({__proto__:null,Component:tt,Element:nt});const st=({onRedirectToOnboarding:t})=>e(b,{onRedirectToOnboarding:t}),rt=s(st,C,{resources:{en:r}});var it=Object.freeze({__proto__:null,Component:st,Element:rt});const ot=()=>e(m,{}),lt=s(ot,C,{resources:{en:r}});var ct=Object.freeze({__proto__:null,Component:ot,Element:lt});export{Ge as T,ke as a,Ie as b,Je as c,et as d,at as e,ct as f,Le as l,xe as m,it as p,Me as s,qe as t,Ve as u};
|