@shipengine/elements 2.11.1 → 2.13.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.
Files changed (109) hide show
  1. package/actions-menu.js +5 -5
  2. package/canada-ddp.js +1 -0
  3. package/carrier.js +1 -1
  4. package/components.js +1 -1
  5. package/elements.js +1 -1
  6. package/hooks.js +1 -1
  7. package/index.js +1 -1
  8. package/package.json +4 -4
  9. package/shipment.js +1 -1
  10. package/src/components/actions-menu/actions-menu.d.ts +2 -1
  11. package/src/components/add-funds-form/add-funds-form.d.ts +9 -1
  12. package/src/components/carrier-connection-card/carrier-connection-card.styles.d.ts +1 -1
  13. package/src/components/collapsible-panel/collapsible-panel.d.ts +15 -1
  14. package/src/components/field/date-picker/date-picker.d.ts +3 -1
  15. package/src/components/field/rate-select/rate-card/cost-breakdown/cost-breakdown.styles.d.ts +2 -1
  16. package/src/components/field/rate-select/rate-card/rate-card.styles.d.ts +1 -1
  17. package/src/components/field/select/select-with-categories.d.ts +1 -0
  18. package/src/components/grid-controller/grid-controller.styles.d.ts +8 -3
  19. package/src/components/grid-filters/components/label-id-filter/label-id-filter.styles.d.ts +1 -1
  20. package/src/components/grid-filters/grid-filters.d.ts +2 -1
  21. package/src/components/history/history-card/history-card.styles.d.ts +1 -1
  22. package/src/components/index.d.ts +1 -0
  23. package/src/components/save-status/save-status.d.ts +15 -1
  24. package/src/components/ship-from-address-form/index.d.ts +1 -0
  25. package/src/components/ship-from-address-form/ship-from-address-form-schema.d.ts +436 -0
  26. package/src/components/ship-from-address-form/ship-from-address-form.d.ts +20 -0
  27. package/src/components/ship-from-address-form/ship-from-address-form.styles.d.ts +20 -0
  28. package/src/components/templates/index.d.ts +1 -1
  29. package/src/components/templates/label-display/label-card.styles.d.ts +1 -1
  30. package/src/components/templates/rate-form/rate-form.d.ts +3 -2
  31. package/src/components/templates/shipment-form/sections/customs-forms/customs-forms.d.ts +2 -1
  32. package/src/components/templates/shipment-form/shipment-form.d.ts +10 -6
  33. package/src/components/templates/shipment-form/shipment-form.styles.d.ts +1 -0
  34. package/src/components/templates/shipment-form/shipment-schema.d.ts +41 -121
  35. package/src/components/templates/suspend-purchase/index.d.ts +1 -0
  36. package/src/components/templates/suspend-purchase/suspend-purchase.d.ts +8 -0
  37. package/src/components/templates/theme-creator/theme-creator.styles.d.ts +1 -1
  38. package/src/components/warehouse-form/warehouse-form-schema.d.ts +148 -34
  39. package/src/elements/labels-grid/hooks/use-labels-grid.d.ts +4 -0
  40. package/src/elements/labels-grid/labels-grid.d.ts +47 -23
  41. package/src/elements/manage-carriers/manage-carriers.d.ts +25 -1
  42. package/src/elements/manage-external-carriers/manage-external-carriers.d.ts +25 -1
  43. package/src/elements/manage-funding/manage-funding-element.d.ts +25 -1
  44. package/src/elements/manage-warehouses/manage-warehouses.d.ts +25 -1
  45. package/src/elements/payment-method-settings/payment-method-settings-element.d.ts +25 -1
  46. package/src/elements/purchase-label/configure-shipment.d.ts +3 -2
  47. package/src/elements/purchase-label/hooks/index.d.ts +0 -2
  48. package/src/elements/purchase-label/hooks/use-address.d.ts +1 -1
  49. package/src/elements/purchase-label/hooks/use-configure-shipment.d.ts +23 -12
  50. package/src/elements/purchase-label/hooks/use-customs.d.ts +1 -1
  51. package/src/elements/purchase-label/hooks/use-import-sales-order.d.ts +2 -1
  52. package/src/elements/purchase-label/hooks/use-shipment-form.d.ts +14 -5
  53. package/src/elements/purchase-label/purchase-label.d.ts +102 -49
  54. package/src/elements/select-label-layout/select-label-layout-element.d.ts +25 -1
  55. package/src/elements/shipment-summary/shipment-summary.d.ts +40 -8
  56. package/src/elements/shipments-grid/shipments-grid.d.ts +101 -21
  57. package/src/elements/theme-creator/theme-creator.d.ts +25 -1
  58. package/src/elements/transaction-history/transaction-history-element.d.ts +25 -1
  59. package/src/elements/unit-settings/unit-settings-element.d.ts +25 -1
  60. package/src/elements/vat-settings/vat-settings-element.d.ts +25 -1
  61. package/src/elements/void-label/components/actions/actions.d.ts +2 -1
  62. package/src/elements/void-label/void-label.d.ts +80 -25
  63. package/src/elements-provider/elements-context-provider.d.ts +10 -3
  64. package/src/elements-provider/elements-provider.d.ts +7 -2
  65. package/src/features/manage-carriers/index.d.ts +1 -0
  66. package/src/features/manage-carriers/manage-carriers.d.ts +12 -1
  67. package/src/features/manage-carriers/use-manage-carriers.d.ts +15 -0
  68. package/src/features/manage-funding/manage-funding.d.ts +10 -1
  69. package/src/features/vat-settings/use-vat-settings.d.ts +1 -1
  70. package/src/hooks/options/index.d.ts +1 -1
  71. package/src/hooks/options/use-insurance-provider-options.d.ts +1 -1
  72. package/src/hooks/options/use-ship-from-address-options.d.ts +19 -0
  73. package/src/hooks/options/use-shipment-metadata.d.ts +1 -0
  74. package/src/hooks/use-root-portal.d.ts +3 -2
  75. package/src/locales/en/index.d.ts +25 -1
  76. package/src/types/canada-ddp.d.ts +4 -0
  77. package/src/types/index.d.ts +2 -0
  78. package/src/types/ship-from-address.d.ts +4 -0
  79. package/src/utilities/feature-flags/types.d.ts +7 -1
  80. package/src/utilities/shipengine/address.d.ts +32 -0
  81. package/src/utilities/shipengine/sales-order.d.ts +2 -2
  82. package/src/utilities/shipengine/warehouses.d.ts +2 -1
  83. package/src/utilities/styles.d.ts +6 -2
  84. package/src/workflows/account-settings/account-settings.d.ts +25 -1
  85. package/src/workflows/account-settings/use-get-panel-props.d.ts +2 -2
  86. package/src/workflows/carrier-services/carrier-services.d.ts +75 -2
  87. package/src/workflows/connect-external-carrier/connect-external-carrier.d.ts +48 -1
  88. package/src/workflows/label-workflow/label-workflow.d.ts +10 -0
  89. package/src/workflows/onboarding/onboarding.d.ts +33 -2
  90. package/suspend-text.js +1 -1
  91. package/transaction-history-element.js +1 -1
  92. package/types.js +1 -1
  93. package/use-scrub-errors.js +1 -1
  94. package/use-toggle.js +1 -1
  95. package/use-unit-settings.js +1 -1
  96. package/usePager.js +1 -1
  97. package/utilities.js +1 -1
  98. package/validation.js +1 -1
  99. package/vat.js +1 -1
  100. package/wallet-form.js +1 -1
  101. package/workflows.js +1 -1
  102. package/src/components/templates/suspend-shipment/index.d.ts +0 -1
  103. package/src/components/templates/suspend-shipment/suspend-shipment.d.ts +0 -8
  104. package/src/elements/purchase-label/hooks/use-get-or-create-shipment.d.ts +0 -13
  105. package/src/elements/purchase-label/hooks/use-load-shipment.d.ts +0 -9
  106. package/src/elements/purchase-label/hooks/use-pending-shipment.d.ts +0 -13
  107. package/src/elements/purchase-label/purchase-label-by-sales-order.d.ts +0 -11
  108. package/src/elements/purchase-label/purchase-label-by-shipment.d.ts +0 -8
  109. package/src/hooks/options/use-warehouse-options.d.ts +0 -13
@@ -64,6 +64,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
64
64
  };
65
65
  errorMessages: {
66
66
  labelIdRequired: string;
67
+ request_failed_to_complete: string;
67
68
  };
68
69
  resultMessages: {
69
70
  approved: string;
@@ -622,6 +623,8 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
622
623
  status: string;
623
624
  trackingStatus: string;
624
625
  labelId: string;
626
+ externalOrderId: string;
627
+ externalShipmentId: string;
625
628
  };
626
629
  empty: {
627
630
  title: string;
@@ -816,6 +819,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
816
819
  description: string;
817
820
  harmonizedTariffCode: string;
818
821
  ifDeliveryFails: string;
822
+ dutiesTaxes: string;
819
823
  quantity: string;
820
824
  sku: string;
821
825
  value: string;
@@ -830,6 +834,17 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
830
834
  returnToSender: string;
831
835
  treatAsAbandoned: string;
832
836
  };
837
+ canadaDeliveredDuty: {
838
+ senderPrepay: string;
839
+ recipientPays: string;
840
+ tooltip: {
841
+ title: string;
842
+ restriction: string;
843
+ requirement1: string;
844
+ requirement2: string;
845
+ requirement3: string;
846
+ };
847
+ };
833
848
  removeAllDeclarations: string;
834
849
  total: string;
835
850
  };
@@ -979,6 +994,9 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
979
994
  tooManyCharacters: string;
980
995
  requiredShipmentId: string;
981
996
  requiredLabelId: string;
997
+ heightExceeded: string;
998
+ widthExceeded: string;
999
+ lengthExceeded: string;
982
1000
  };
983
1001
  shippingPresets: {
984
1002
  apply: string;
@@ -1022,6 +1040,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
1022
1040
  edit: string;
1023
1041
  remove: string;
1024
1042
  viewDetails: string;
1043
+ cancelShipment: string;
1025
1044
  };
1026
1045
  };
1027
1046
  ZnVuZGluZ19zb3VyY2VfaWQgbXVzdCBiZSBhbiBpbnRlZ2Vy: string;
@@ -1052,7 +1071,12 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
1052
1071
  transactionHistory: string;
1053
1072
  adjustmentHistory: string;
1054
1073
  warehouses: string;
1055
- carriers: string;
1074
+ carriers: {
1075
+ title: string;
1076
+ customStatusMessages: {
1077
+ success: string;
1078
+ };
1079
+ };
1056
1080
  externalCarriers: string;
1057
1081
  labelLayout: string;
1058
1082
  unitSettings: string;
@@ -1,8 +1,8 @@
1
1
  import { CollapsiblePanelProps } from "../../components";
2
- import { ExternalCarriersProps, UnitSettingsProps } from "../../features";
2
+ import { ExternalCarriersProps, ShipEngineCarriersProps, UnitSettingsProps } from "../../features";
3
3
  import { ManageWarehousesProps } from "../../features/manage-warehouses/";
4
4
  import { SelectLabelLayoutSettingsProps } from "../../features/select-label-layout/select-label-layout";
5
- type SettingProps = ExternalCarriersProps | SelectLabelLayoutSettingsProps | UnitSettingsProps | ManageWarehousesProps;
5
+ type SettingProps = ShipEngineCarriersProps | ExternalCarriersProps | SelectLabelLayoutSettingsProps | UnitSettingsProps | ManageWarehousesProps;
6
6
  export type SettingPropsIntersection = ExternalCarriersProps & SelectLabelLayoutSettingsProps & UnitSettingsProps & ManageWarehousesProps;
7
7
  export declare const useGetPanelProps: () => {
8
8
  getSettingPanelProps: (setting: string) => [panelProps?: CollapsiblePanelProps, settingProps?: SettingProps];
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { CodedError } from "@shipengine/react-api";
2
3
  /**
3
4
  * # Carrier-Services Component
4
5
  *
@@ -23,9 +24,11 @@
23
24
  * @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<CarrierServices />` component}
24
25
  */
25
26
  export type CarrierServicesProps = {
27
+ addedFundsError?: CodedError[] | null;
28
+ addFunds?: () => Promise<any>;
26
29
  onRedirectToOnboarding?: () => void;
27
30
  };
28
- export declare const Component: ({ onRedirectToOnboarding }: CarrierServicesProps) => import("@emotion/react/jsx-runtime").JSX.Element;
31
+ export declare const Component: ({ onRedirectToOnboarding, addFunds, addedFundsError }: CarrierServicesProps) => import("@emotion/react/jsx-runtime").JSX.Element;
29
32
  export declare const Element: ({ resources, ...props }: CarrierServicesProps & {
30
33
  resources?: {
31
34
  en: {
@@ -58,6 +61,7 @@ export declare const Element: ({ resources, ...props }: CarrierServicesProps & {
58
61
  };
59
62
  errorMessages: {
60
63
  labelIdRequired: string;
64
+ request_failed_to_complete: string;
61
65
  };
62
66
  resultMessages: {
63
67
  approved: string;
@@ -128,6 +132,29 @@ export declare const Element: ({ resources, ...props }: CarrierServicesProps & {
128
132
  vatFormText: string;
129
133
  vatFormRegisterLater: string;
130
134
  vatNumberInputHint: string;
135
+ /**
136
+ * # Carrier-Services Component
137
+ *
138
+ * @param ComponentProps The base props that will be passed into the `<CarrierServices />` component.
139
+ *
140
+ * @returns Element A React element that renders the `<CarrierServices />` component allowing users
141
+ * to view a list of carriers that are connected to their ShipEngine account, add funds to their wallet, view transaction history, and manage their payment method. This component is
142
+ * composed in the `<AccountSettings />` Element.
143
+ *
144
+ * @example
145
+ * ```tsx
146
+ * (() => {
147
+ * const features = useFeatures("Global");
148
+ *
149
+ * return <CarrierServices.Element features={features} />;
150
+ * })();
151
+ * ```
152
+ *
153
+ * <br />
154
+ *
155
+ * @see {@link CarrierServices.ComponentProps | The props that are passed into the `<CarrierServices />` component}
156
+ * @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<CarrierServices />` component}
157
+ */
131
158
  vatNumberInputPlaceholder: string;
132
159
  verifiedVat: string;
133
160
  vatFormErrors: {
@@ -592,6 +619,29 @@ export declare const Element: ({ resources, ...props }: CarrierServicesProps & {
592
619
  pdf: string;
593
620
  };
594
621
  };
622
+ /**
623
+ * # Carrier-Services Component
624
+ *
625
+ * @param ComponentProps The base props that will be passed into the `<CarrierServices />` component.
626
+ *
627
+ * @returns Element A React element that renders the `<CarrierServices />` component allowing users
628
+ * to view a list of carriers that are connected to their ShipEngine account, add funds to their wallet, view transaction history, and manage their payment method. This component is
629
+ * composed in the `<AccountSettings />` Element.
630
+ *
631
+ * @example
632
+ * ```tsx
633
+ * (() => {
634
+ * const features = useFeatures("Global");
635
+ *
636
+ * return <CarrierServices.Element features={features} />;
637
+ * })();
638
+ * ```
639
+ *
640
+ * <br />
641
+ *
642
+ * @see {@link CarrierServices.ComponentProps | The props that are passed into the `<CarrierServices />` component}
643
+ * @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<CarrierServices />` component}
644
+ */
595
645
  emptyState: {
596
646
  title: string;
597
647
  subtitle: string;
@@ -616,6 +666,8 @@ export declare const Element: ({ resources, ...props }: CarrierServicesProps & {
616
666
  status: string;
617
667
  trackingStatus: string;
618
668
  labelId: string;
669
+ externalOrderId: string;
670
+ externalShipmentId: string;
619
671
  };
620
672
  empty: {
621
673
  title: string;
@@ -810,6 +862,7 @@ export declare const Element: ({ resources, ...props }: CarrierServicesProps & {
810
862
  description: string;
811
863
  harmonizedTariffCode: string;
812
864
  ifDeliveryFails: string;
865
+ dutiesTaxes: string;
813
866
  quantity: string;
814
867
  sku: string;
815
868
  value: string;
@@ -824,6 +877,17 @@ export declare const Element: ({ resources, ...props }: CarrierServicesProps & {
824
877
  returnToSender: string;
825
878
  treatAsAbandoned: string;
826
879
  };
880
+ canadaDeliveredDuty: {
881
+ senderPrepay: string;
882
+ recipientPays: string;
883
+ tooltip: {
884
+ title: string;
885
+ restriction: string;
886
+ requirement1: string;
887
+ requirement2: string;
888
+ requirement3: string;
889
+ };
890
+ };
827
891
  removeAllDeclarations: string;
828
892
  total: string;
829
893
  };
@@ -973,6 +1037,9 @@ export declare const Element: ({ resources, ...props }: CarrierServicesProps & {
973
1037
  tooManyCharacters: string;
974
1038
  requiredShipmentId: string;
975
1039
  requiredLabelId: string;
1040
+ heightExceeded: string;
1041
+ widthExceeded: string;
1042
+ lengthExceeded: string;
976
1043
  };
977
1044
  shippingPresets: {
978
1045
  apply: string;
@@ -1016,6 +1083,7 @@ export declare const Element: ({ resources, ...props }: CarrierServicesProps & {
1016
1083
  edit: string;
1017
1084
  remove: string;
1018
1085
  viewDetails: string;
1086
+ cancelShipment: string;
1019
1087
  };
1020
1088
  };
1021
1089
  ZnVuZGluZ19zb3VyY2VfaWQgbXVzdCBiZSBhbiBpbnRlZ2Vy: string;
@@ -1046,7 +1114,12 @@ export declare const Element: ({ resources, ...props }: CarrierServicesProps & {
1046
1114
  transactionHistory: string;
1047
1115
  adjustmentHistory: string;
1048
1116
  warehouses: string;
1049
- carriers: string;
1117
+ carriers: {
1118
+ title: string;
1119
+ customStatusMessages: {
1120
+ success: string;
1121
+ };
1122
+ };
1050
1123
  externalCarriers: string;
1051
1124
  labelLayout: string;
1052
1125
  unitSettings: string;
@@ -65,6 +65,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
65
65
  };
66
66
  errorMessages: {
67
67
  labelIdRequired: string;
68
+ request_failed_to_complete: string;
68
69
  };
69
70
  resultMessages: {
70
71
  approved: string;
@@ -72,6 +73,29 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
72
73
  dpdwallet: string;
73
74
  };
74
75
  refund_process: string;
76
+ /**
77
+ * # ConnectExternalCarrier Component
78
+ *
79
+ * @param ComponentProps The base props that will be passed into the `<ConnectExternalCarrier />` component.
80
+ *
81
+ * @returns Element A React element that renders the `<ConnectExternalCarrier />` component allowing users
82
+ * to connect their own existing carrier account. If no carrier is provided, the user may
83
+ * select from a list of carriers specified by `features.availableCarrierConnections`.
84
+ * This component is composed in the `<AccountSettings />` Element.
85
+ *
86
+ * @example
87
+ * ```tsx
88
+ * (() => {
89
+ * const features = useFeatures("CarrierConnections");
90
+ *
91
+ * return <ConnectExternalCarrier.Component features={features} />;
92
+ * })();
93
+ * ```
94
+ *
95
+ * <br />
96
+ *
97
+ * @see {@link ConnectExternalCarrier.ComponentProps | The props that are passed into the `<ConnectExternalCarrier />` component}
98
+ */
75
99
  refund_rules: string;
76
100
  resultTitles: {
77
101
  approved: string;
@@ -623,6 +647,8 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
623
647
  status: string;
624
648
  trackingStatus: string;
625
649
  labelId: string;
650
+ externalOrderId: string;
651
+ externalShipmentId: string;
626
652
  };
627
653
  empty: {
628
654
  title: string;
@@ -817,6 +843,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
817
843
  description: string;
818
844
  harmonizedTariffCode: string;
819
845
  ifDeliveryFails: string;
846
+ dutiesTaxes: string;
820
847
  quantity: string;
821
848
  sku: string;
822
849
  value: string;
@@ -831,6 +858,17 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
831
858
  returnToSender: string;
832
859
  treatAsAbandoned: string;
833
860
  };
861
+ canadaDeliveredDuty: {
862
+ senderPrepay: string;
863
+ recipientPays: string;
864
+ tooltip: {
865
+ title: string;
866
+ restriction: string;
867
+ requirement1: string;
868
+ requirement2: string;
869
+ requirement3: string;
870
+ };
871
+ };
834
872
  removeAllDeclarations: string;
835
873
  total: string;
836
874
  };
@@ -980,6 +1018,9 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
980
1018
  tooManyCharacters: string;
981
1019
  requiredShipmentId: string;
982
1020
  requiredLabelId: string;
1021
+ heightExceeded: string;
1022
+ widthExceeded: string;
1023
+ lengthExceeded: string;
983
1024
  };
984
1025
  shippingPresets: {
985
1026
  apply: string;
@@ -1023,6 +1064,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
1023
1064
  edit: string;
1024
1065
  remove: string;
1025
1066
  viewDetails: string;
1067
+ cancelShipment: string;
1026
1068
  };
1027
1069
  };
1028
1070
  ZnVuZGluZ19zb3VyY2VfaWQgbXVzdCBiZSBhbiBpbnRlZ2Vy: string;
@@ -1053,7 +1095,12 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
1053
1095
  transactionHistory: string;
1054
1096
  adjustmentHistory: string;
1055
1097
  warehouses: string;
1056
- carriers: string;
1098
+ carriers: {
1099
+ title: string;
1100
+ customStatusMessages: {
1101
+ success: string;
1102
+ };
1103
+ };
1057
1104
  externalCarriers: string;
1058
1105
  labelLayout: string;
1059
1106
  unitSettings: string;
@@ -24,6 +24,11 @@ export type LabelWorkflowProps = {
24
24
  onLabelCreateSuccess?: (label: {
25
25
  labelId: string;
26
26
  }, shipment: Shipment) => void;
27
+ /**
28
+ * `onRateSaved` is an async/sync callback function that will be invoked each time a rate is
29
+ * saved by the user.
30
+ */
31
+ onRateSaved?: (shipment: SE.SalesOrderShipment) => Promise<void> | void;
27
32
  /**
28
33
  * `onVoidLabelComplete` is a callback function that will be invoked when the request to void a given
29
34
  * shipping label is completed.
@@ -67,6 +72,11 @@ export declare const useLabelWorkflow: ({ _multiplexedId, }: {
67
72
  onLabelCreateSuccess?: ((label: {
68
73
  labelId: string;
69
74
  }, shipment: Shipment) => void) | undefined;
75
+ /**
76
+ * `onRateSaved` is an async/sync callback function that will be invoked each time a rate is
77
+ * saved by the user.
78
+ */
79
+ onRateSaved?: ((shipment: SE.SalesOrderShipment) => Promise<void> | void) | undefined;
70
80
  /**
71
81
  * `onVoidLabelComplete` is a callback function that will be invoked when the request to void a given
72
82
  * shipping label is completed.
@@ -101,6 +101,14 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
101
101
  };
102
102
  errorMessages: {
103
103
  labelIdRequired: string;
104
+ /**
105
+ * # Onboarding Component Props
106
+ *
107
+ * - These are the base props that will be passed into the `<Onboarding />` component.
108
+ *
109
+ * @see {@link Onboarding.Component | This prop types usage in the `<Onboarding />` component}
110
+ */
111
+ request_failed_to_complete: string;
104
112
  };
105
113
  resultMessages: {
106
114
  approved: string;
@@ -659,6 +667,8 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
659
667
  status: string;
660
668
  trackingStatus: string;
661
669
  labelId: string;
670
+ externalOrderId: string;
671
+ externalShipmentId: string;
662
672
  };
663
673
  empty: {
664
674
  title: string;
@@ -666,7 +676,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
666
676
  };
667
677
  emptyWithFilters: {
668
678
  title: string;
669
- subtitle: string; /** Invoked when the onboarding process is completed. */
679
+ subtitle: string;
670
680
  button: string;
671
681
  };
672
682
  status: {
@@ -860,6 +870,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
860
870
  description: string;
861
871
  harmonizedTariffCode: string;
862
872
  ifDeliveryFails: string;
873
+ dutiesTaxes: string;
863
874
  quantity: string;
864
875
  sku: string;
865
876
  value: string;
@@ -874,6 +885,17 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
874
885
  returnToSender: string;
875
886
  treatAsAbandoned: string;
876
887
  };
888
+ canadaDeliveredDuty: {
889
+ senderPrepay: string;
890
+ recipientPays: string;
891
+ tooltip: {
892
+ title: string;
893
+ restriction: string;
894
+ requirement1: string;
895
+ requirement2: string;
896
+ requirement3: string;
897
+ };
898
+ };
877
899
  removeAllDeclarations: string;
878
900
  total: string;
879
901
  };
@@ -1023,6 +1045,9 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
1023
1045
  tooManyCharacters: string;
1024
1046
  requiredShipmentId: string;
1025
1047
  requiredLabelId: string;
1048
+ heightExceeded: string;
1049
+ widthExceeded: string;
1050
+ lengthExceeded: string;
1026
1051
  };
1027
1052
  shippingPresets: {
1028
1053
  apply: string;
@@ -1066,6 +1091,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
1066
1091
  edit: string;
1067
1092
  remove: string;
1068
1093
  viewDetails: string;
1094
+ cancelShipment: string;
1069
1095
  };
1070
1096
  };
1071
1097
  ZnVuZGluZ19zb3VyY2VfaWQgbXVzdCBiZSBhbiBpbnRlZ2Vy: string;
@@ -1096,7 +1122,12 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
1096
1122
  transactionHistory: string;
1097
1123
  adjustmentHistory: string;
1098
1124
  warehouses: string;
1099
- carriers: string;
1125
+ carriers: {
1126
+ title: string;
1127
+ customStatusMessages: {
1128
+ success: string;
1129
+ };
1130
+ };
1100
1131
  externalCarriers: string;
1101
1132
  labelLayout: string;
1102
1133
  unitSettings: string;
package/suspend-text.js CHANGED
@@ -1 +1 @@
1
- import{J as e,K as t,M as n,N as a,O as o,Q as i,U as r,X as s,Y as c,Z as l,_ as g,$ as p,G as d,a0 as m,a1 as u,z as h}from"./actions-menu.js";import{jsxs as b,jsx as f,Fragment as C}from"@emotion/react/jsx-runtime";import{useState as w,useRef as S,useCallback as x}from"react";import{useTranslation as O,Trans as v}from"react-i18next";import{Button as j,ButtonVariant as I,Icon as y,IconSize as T,DropdownOptionList as k,Option as E,Pagination as P,Typography as _,Skeleton as D,SkeletonAnimation as M,SkeletonVariant as R}from"@shipengine/giger";import{IconNames as z}from"@shipengine/giger-theme";import{b as A}from"./validation.js";var W=Object.freeze({__proto__:null,CheckboxInput:e,CreditCardInput:t,DatePicker:n,ExpirationInput:a,InputGroup:o,transform:i,MoneyInput:r,NumberInput:s,RateSelect:c,SelectAutoComplete:l,Select:g,SelectWithCategories:p,SubmitButton:d,Switch:m,TextArea:u,TextInput:h});const B=A({footer:{"> *":{borderTop:"0 !important"},alignItems:"center",display:"flex",justifyContent:"space-between",width:"100%"},leftFooter:e=>({display:"flex",margin:e.spacing(2),span:{fontWeight:e.typography.fontWeight.bold}}),rowCount:e=>({alignItems:"center",display:"flex",marginRight:e.spacing(4),whiteSpace:"pre"}),rowCountDropDown:{"> * > *":{justifyContent:"center !important"}},rowsActions:e=>({"#selected-row":{":hover":{backgroundColor:"transparent"},borderRadius:e.borderRadius.XS,color:e.palette.black,padding:e.spacing(1),paddingRight:e.spacing(.5)},alignItems:"baseline",display:"flex",span:{alignSelf:"center"}})}),N=[5,10,25,50],X=({currentPageSize:e,pagingData:t,rowCountSelection:n=N,onPageSelect:a,onPageSizeSelect:o})=>{const[i,r]=w(!1),s=S(null),{t:c}=O(),l=x((()=>r((e=>!e))),[]);return b("div",Object.assign({css:B.footer},{children:[b("div",Object.assign({css:B.leftFooter},{children:[f("div",Object.assign({css:B.rowCount},{children:f(v,{components:[f("b",{style:{fontWeight:"bold"}},"1")],count:t.total,i18nKey:"common:grid.row-count",values:{firstIndex:0!==t.total?1+(t.page-1)*e:0,lastIndex:Math.min(t.total,t.page*e)}})})),b("div",Object.assign({css:B.rowsActions},{children:[c("common:grid.rows"),f(j,Object.assign({id:"selected-row",onClick:()=>l(),ref:s,variant:I.TEXT},{children:e})),f(y,i?{name:z.CHEVRON_TOP,onClick:()=>l(),size:T.SIZE_MEDIUM}:{name:z.CHEVRON_BOTTOM,onClick:()=>l(),size:T.SIZE_MEDIUM}),f(k,Object.assign({css:B.rowCountDropDown,dropdownWidth:"max-content",isOpen:i,onChange:()=>l(),onClickAway:e=>{var t;(null===(t=s.current)||void 0===t?void 0:t.contains(e.target))||l()},placement:"bottom",reference:s.current},{children:n.map((e=>f(E,Object.assign({onClick:()=>o(e),value:String(e)},{children:e}),e)))}))]}))]})),f("div",{children:f(P,{boundaryPagesToShow:5,currentPage:t.page,onPageChange:a,totalPages:t.pages})})]}))},U=({children:e,notes:t})=>b(C,{children:[b("div",Object.assign({css:()=>({backgroundColor:"lightsteelblue",marginBottom:"16px",padding:"16px",paddingLeft:"32px"})},{children:[f(_,Object.assign({variant:"heading5"},{children:"Story notes:"})),f("ul",Object.assign({css:e=>({"> li":{marginTop:e.spacing(1)}})},{children:t.map((e=>f("li",{children:e},e)))}))]})),f("hr",{css:()=>({backgroundColor:"transparent",borderTop:"1px dotted lightgrey",marginBottom:"16px"})}),e]}),V=({children:e,loading:t})=>t?f(D,{animation:M.WAVE,variant:R.TEXT}):f("span",{children:e});export{X as P,U as S,V as a,W as f};
1
+ import{K as e,M as t,N as n,O as a,Q as o,U as i,X as r,Y as s,Z as c,_ as l,$ as g,a0 as p,J as d,a1 as m,a2 as u,G as h}from"./actions-menu.js";import{jsxs as b,jsx as f,Fragment as C}from"@emotion/react/jsx-runtime";import{useState as w,useRef as S,useCallback as x}from"react";import{useTranslation as O,Trans as v}from"react-i18next";import{Button as j,ButtonVariant as I,Icon as y,IconSize as T,DropdownOptionList as k,Option as E,Pagination as P,Typography as _,Skeleton as D,SkeletonAnimation as M,SkeletonVariant as R}from"@shipengine/giger";import{IconNames as A}from"@shipengine/giger-theme";import{b as W,s as z}from"./validation.js";var B=Object.freeze({__proto__:null,CheckboxInput:e,CreditCardInput:t,DatePicker:n,ExpirationInput:a,InputGroup:o,transform:i,MoneyInput:r,NumberInput:s,RateSelect:c,SelectAutoComplete:l,Select:g,SelectWithCategories:p,SubmitButton:d,Switch:m,TextArea:u,TextInput:h});const N=W({footer:{"> *":{borderTop:"0 !important"},alignItems:"center",display:"flex",justifyContent:"space-between",width:"100%"},leftFooter:e=>({display:"flex",margin:z(e).spacing(2),span:{fontWeight:z(e).typography.fontWeight.bold}}),rowCount:e=>({alignItems:"center",display:"flex",marginRight:z(e).spacing(4),whiteSpace:"pre"}),rowCountDropDown:{"> * > *":{justifyContent:"center !important"}},rowsActions:e=>({"#selected-row":{":hover":{backgroundColor:"transparent"},borderRadius:z(e).borderRadius.XS,color:z(e).palette.black,padding:z(e).spacing(1),paddingRight:z(e).spacing(.5)},alignItems:"baseline",display:"flex",span:{alignSelf:"center"}})}),X=[5,10,25,50],U=({currentPageSize:e,pagingData:t,rowCountSelection:n=X,onPageSelect:a,onPageSizeSelect:o})=>{const[i,r]=w(!1),s=S(null),{t:c}=O(),l=x((()=>r((e=>!e))),[]);return b("div",Object.assign({css:N.footer},{children:[b("div",Object.assign({css:N.leftFooter},{children:[f("div",Object.assign({css:N.rowCount},{children:f(v,{components:[f("b",{style:{fontWeight:"bold"}},"1")],count:t.total,i18nKey:"common:grid.row-count",values:{firstIndex:0!==t.total?1+(t.page-1)*e:0,lastIndex:Math.min(t.total,t.page*e)}})})),b("div",Object.assign({css:N.rowsActions},{children:[c("common:grid.rows"),f(j,Object.assign({id:"selected-row",onClick:()=>l(),ref:s,variant:I.TEXT},{children:e})),f(y,i?{name:A.CHEVRON_TOP,onClick:()=>l(),size:T.SIZE_MEDIUM}:{name:A.CHEVRON_BOTTOM,onClick:()=>l(),size:T.SIZE_MEDIUM}),f(k,Object.assign({css:N.rowCountDropDown,dropdownWidth:"max-content",isOpen:i,onChange:()=>l(),onClickAway:e=>{var t;(null===(t=s.current)||void 0===t?void 0:t.contains(e.target))||l()},placement:"bottom",reference:s.current},{children:n.map((e=>f(E,Object.assign({onClick:()=>o(e),value:String(e)},{children:e}),e)))}))]}))]})),f("div",{children:f(P,{boundaryPagesToShow:5,currentPage:t.page,onPageChange:a,totalPages:t.pages})})]}))},V=({children:e,notes:t})=>b(C,{children:[b("div",Object.assign({css:()=>({backgroundColor:"lightsteelblue",marginBottom:"16px",padding:"16px",paddingLeft:"32px"})},{children:[f(_,Object.assign({variant:"heading5"},{children:"Story notes:"})),f("ul",Object.assign({css:e=>({"> li":{marginTop:z(e).spacing(1)}})},{children:t.map((e=>f("li",{children:e},e)))}))]})),f("hr",{css:()=>({backgroundColor:"transparent",borderTop:"1px dotted lightgrey",marginBottom:"16px"})}),e]}),Z=({children:e,loading:t})=>t?f(D,{animation:M.WAVE,variant:R.TEXT}):f("span",{children:e});export{U as P,V as S,Z as a,B as f};
@@ -1 +1 @@
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 m,T as b}from"./use-unit-settings.js";import{T as v,h as f,l as C,q as O,x as y,u as j,P as S,y as w}from"./actions-menu.js";import{t as x,x as E,v as _,Z as k}from"./carrier.js";import{useState as F,useCallback as I,useRef as T,useEffect as D,useMemo as P,useContext as A,createContext as L}from"react";import{useTranslation as R}from"react-i18next";import{Icon as z,IconSize as N,Select as B,Option as $,Input as W,Popover as M,Typography as U,TagColor as G,Next as V,Tag as K,TagVariant as H,EmptyState as q,Button as Z}from"@shipengine/giger";import{useListLabels as Y,useGetLabel 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,C as ae,E as se,G as re,b as ie,a as oe}from"./usePager.js";import{b as le}from"./validation.js";import{e as ce,f as de}from"./use-toggle.js";import{formatISO as pe}from"date-fns/formatISO";import{isSameDay as ge}from"date-fns/isSameDay";import{isWithinInterval as ue}from"date-fns/isWithinInterval";import{setHours as he}from"date-fns/setHours";import{setMinutes as me}from"date-fns/setMinutes";import{IconNames as be}from"@shipengine/giger-theme";const ve=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)})}),fe=({paletteConfig:n,onUpdatePaletteConfig:a,formatKey:s})=>{const[r,i]=F(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=I(((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:x(a)}),e(z,{name:r.has(a)?be.CHEVRON_TOP:be.CHEVRON_BOTTOM,size:N.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=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"})}),Oe=({onUpdateTypographyConfig:a,typographyConfig:s,formatKey:r})=>{const i=I(((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=I(((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(B,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($,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(W,{"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=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`})}),je=({themeConfig:n,onUpdateThemeConfig:a,presets:s,showDrawer:r})=>{const i=T(n),[o,l]=F(!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:x(e),value:x(e)})),[d,p]=F(c.sort()[0].value),g=e=>E(_(e)),u=T(null),[h,m]=ce(!1),b=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(),m()},ref:u},{children:["Presets",e(z,{name:be.CARET_BOTTOM,size:N.SIZE_SMALL})]})),e(M,Object.assign({container:document.querySelector("#theme-creator"),isOpen:h,onClickAway:()=>m(),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(),m(),b(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(),m(),b(t.themeConfig)},role:"menuitem"},{children:t.presetName}),t.presetName)))]}))}))]}):e("button",Object.assign({"aria-label":"Set Default Theme",css:ye.presetsButton,onClick:()=>{b(i.current)},role:"menuitem"},{children:"Reset to Default"}))]})),e(U,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(te,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=k(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 Fe=({isModalFullScreen:t})=>{const n=k(l(),[]);return e(c,Object.assign({isModalFullScreen:t},n))},Ie=s(Fe,C,{resources:{en:r}});var Te=Object.freeze({__proto__:null,Component:Fe,Element:Ie});const De=le({errorState:e=>Object.assign({backgroundColor:e.palette.white},e.getComponentOverride("Table")),tableParagraph:{margin:0}}),Pe=({labelStatus:a,features:s,onClickPrintLabel:r,onClickVoidLabel:i,onClickPrintForms:o,onClickViewDetails:l,onRowClick:c})=>{var d,p;const{t:g}=R(["common","list-labels"]),{globalFeatures:u,getFeatures:h}=de(),m=h("labelsGridFeatures");s=Object.assign(Object.assign({},m),null!=s?s:{});const b=P((()=>{var e;return null===(e=null==s?void 0:s.columns)||void 0===e?void 0:e.find((e=>"labelId"===e.name))}),[s]),v=P((()=>{var e;return null===(e=null==s?void 0:s.columns)||void 0===e?void 0:e.find((e=>"shipmentId"===e.name))}),[s]),f=b&&(null===(d=b.allowFilter)||void 0===d||d),C=v&&(null===(p=v.allowFilter)||void 0===p||p),{labels:x,getGridData:E,isError:_,isLoading:k,filters:I,setFilters:T,pageConfig:A,isAnyFilterActive:L,shouldShowFilters:z,clearAllFilters:N}=(({labelStatus:e,showShipmentIdFilter:t,showLabelIdFilter:n})=>{var a,s;const r={labelId:{enabled:!!n,value:""},shipmentId:{enabled:!!t,value:""}},{getServiceName:i}=ee(),{page:o,pageSize:l,pagerProps:c}=ne(20),[d,p]=F(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}));D((()=>{p({labelId:{enabled:!!n,value:""},shipmentId:{enabled:!!t,value:""}})}),[n,t]);const{data:h,isLoading:m,isError:b}=Y({queryFnParams:{labelStatus:e,page:o,pageSize:l,shipmentId:d.shipmentId.value||void 0,sortBy:"modified_at",sortDir:"desc"}}),v=P((()=>(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}=J((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:b,isLoading:m||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:f,showShipmentIdFilter:C}),B=P((()=>{var a;const r={completed:{color:G.SUCCESS,text:g("list-labels:status.completed")},error:{color:G.ERROR,text:g("list-labels:status.error")},processing:{color:G.INFO,text:g("list-labels:status.processing")},voided:{color:G.INFO,text:g("list-labels:status.voided")}},i={delivered:{color:G.SUCCESS,text:g("list-labels:trackingStatus.delivered")},error:{color:G.ERROR,text:g("list-labels:trackingStatus.error")},in_transit:{color:G.GRAY,text:g("list-labels:trackingStatus.inTransit")},unknown:{color:G.ALERT,text:g("list-labels:trackingStatus.unknown")}},o={createdDate:{headerContent:g("list-labels:headers.created"),renderCellContent:t=>e(ae,{date:t.createdAt,short:!0})},labelId:{headerContent:g("list-labels:headers.labelId"),renderCellContent:t=>e(U,Object.assign({component:"span",variant:"body2"},{children:t.labelId}))},packages:{headerContent:g("list-labels:headers.parcels"),renderCellContent:t=>e(U,Object.assign({component:"span",variant:"body2"},{children:t.packages.length}))},recipient:{headerContent:g("list-labels:headers.recipient"),renderCellContent:a=>t(n,{children:[e(U,Object.assign({component:"p",css:De.tableParagraph,variant:"body2"},{children:a.shipTo.name})),t(U,Object.assign({component:"p",css:De.tableParagraph,variant:"body2"},{children:[a.shipTo.postalCode,", ",a.shipTo.cityLocality]}))]})},shipDate:{headerContent:g("list-labels:headers.shipDate"),renderCellContent:t=>e(ae,{date:t.shipDate,short:!0})},shipmentId:{headerContent:g("list-labels:headers.shipmentId"),renderCellContent:t=>e(U,Object.assign({component:"span",variant:"body2"},{children:t.shipmentId}))},shippingService:{headerContent:g("list-labels:headers.shipping"),renderCellContent:a=>t(n,{children:[e(U,Object.assign({component:"p",css:De.tableParagraph,variant:"body2"},{children:a.serviceName||a.serviceCode})),a.trackable&&e(V.Link,Object.assign({bold:!1,href:a.trackingUrl,isExternal:!0,target:"_blank"},{children:a.trackingNumber}))]})},status:{headerContent:g("list-labels:headers.status"),renderCellContent:t=>e(K,Object.assign({color:r[t.status].color,variant:H.LINEAL_FILLED},{children:r[t.status].text}))},trackingStatus:{headerContent:g("list-labels:headers.trackingStatus"),renderCellContent:t=>e(K,Object.assign({color:i[t.trackingStatus].color,variant:H.LINEAL_FILLED},{children:i[t.trackingStatus].text}))}},l=[];return null===(a=null==s?void 0:s.columns)||void 0===a||a.forEach((e=>{o[e.name]&&l.push(o[e.name])})),l}),[s,g]);if(k)return e(O,{message:g("loading.labels")});if(_)return e(se,{css:De.errorState,subtitle:[g("list-labels:errorMessages.subtitle"),g("errorMessages.refreshAndTryAgain")],title:g("list-labels:errorMessages.title")});const $=(e,t)=>{e===w.PRINT_LABEL&&(e=>{null==r||r(),window.open(e.labelDownload.href,"_blank","noopener, noreferrer")})(t),e===w.VOID_LABEL&&(null==i||i(t)),e===w.PRINT_FORMS&&(e=>{null==o||o(),window.open(e.formDownload.href,"_blank","noopener, noreferrer")})(t),e===w.VIEW_DETAILS&&(null==l||l(t))};return(null==s?void 0:s.showActions)&&x.some((e=>"completed"===e.status))&&B.push({headerContent:"",renderCellContent:t=>{var n,a;const s=!!(null===(n=t.labelDownload)||void 0===n?void 0:n.href)&&"completed"===t.status,r=!!i&&"completed"===t.status,o=!!(null===(a=t.formDownload)||void 0===a?void 0:a.href)&&"completed"===t.status,c=!!l;if(!(s||r||o||c))return null;const d=[...c?[w.VIEW_DETAILS]:[],...s?[w.PRINT_LABEL]:[],...r?[w.VOID_LABEL]:[],...o?[w.PRINT_FORMS]:[]];return e(y,{allowedActions:d,onActionClick:e=>$(e,t)})}}),t(n,{children:[e(re,{columns:B,data:E(),emptyContent:e(q,L?Object.assign({isElevated:!1,subtitle:g("list-labels:emptyWithFilters.subtitle"),title:g("list-labels:emptyWithFilters.title")},{children:e(Z,Object.assign({onClick:N},{children:g("list-labels:emptyWithFilters.button")}))}):{isElevated:!1,subtitle:g("list-labels:empty.subtitle"),title:g("list-labels:empty.title")}),filters:z&&e(ie,{filters:I,onClearAllFilters:N,onFiltersUpdated:T}),footerContent:e(oe,{onPageChange:A.pagerProps.onPageSelect,page:A.currentPage,pages:A.pagesAmount,pageSize:A.pageSize,showPagination:A.showPagination,total:A.totalElements}),onRowClick:c}),u.poweredByShipEngine&&t(n,{children:[e(j,{}),e(S,{})]})]})},Ae=s(Pe,C,{css:{height:"100%",minWidth:"440px",width:"100%"},resources:{en:r}});var Le=Object.freeze({__proto__:null,Component:Pe,Element:Ae});const Re=(e,t)=>({end:he(me(t,59),23),start:he(me(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}=ee(),{page:c,pageSize:d,pagerProps:p}=ne(20),[g,u]=F(o),h=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}));D((()=>{const e=ze(t,n);u(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=Re(e,t);return{createdAtEnd:pe(n.end),createdAtStart:pe(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=P((()=>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&&(h||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,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,ge(a,s)&&ge(a,new Date(r))||ue(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==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),u(e)},shipments:C,shouldShowFilters:O}},Be=le({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}=R(["common","list-shipments"]),{globalFeatures:l}=de(),{isLoading:c,isError:d,filters:p,setFilters:g,pageConfig:u,getGridData:h,isAnyFilterActive:m,shouldShowFilters:b,clearAllFilters:v}=Ne({shipmentStatus:s,showCreatedDateFilter:i,showShipmentIdFilter:r});if(c)return e(O,{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:G.ALERT,text:o("list-shipments:status.cancelled")},label_purchased:{color:G.SUCCESS,text:o("list-shipments:status.purchased")},pending:{color:G.SUCCESS,text:o("list-shipments:status.readyToBuy")},processing:{color:G.INFO,text:o("list-shipments:status.processing")}},C=[{headerContent:o("list-shipments:headers.shipmentId"),renderCellContent:t=>e(U,Object.assign({component:"p",css:Be.tableParagraph,variant:"body2"},{children:t.shipmentId}))},{headerContent:o("list-shipments:headers.parcels"),renderCellContent:t=>e(U,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(U,Object.assign({component:"p",css:Be.tableParagraph,variant:"body2"},{children:a.shipTo.name})),r&&e(U,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(U,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(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(K,Object.assign({color:f[t.shipmentStatus].color,variant:H.LINEAL_FILLED},{children:f[t.shipmentStatus].text}))}];return t(n,{children:[e(re,{columns:C,data:h(),emptyContent:e(q,m?Object.assign({isElevated:!1,subtitle:o("list-shipments:emptyState.filtersSubtitle"),title:o("list-shipments:emptyState.filtersTitle")},{children:e(Z,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: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=L(void 0),Ge=({children:t,editableTheme:n})=>{const[a,s]=F(n);return e(Ue.Provider,Object.assign({value:{setThemeConfig:s,themeConfig:a}},{children:t}))},Ve=()=>{const e=A(Ue);if(!e)throw new Error("useThemeConfigurator must be used within a ThemeConfiguratorProvider");return e},Ke=t=>{var n=k(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=k(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=k(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(m,{onRedirectToOnboarding:t}),rt=s(st,C,{resources:{en:r}});var it=Object.freeze({__proto__:null,Component:st,Element:rt});const ot=()=>e(b,{}),lt=s(ot,C,{resources:{en:r}});var ct=Object.freeze({__proto__:null,Component:ot,Element:lt});export{Ge as T,ke as a,Te 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};
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 l,d as o,E as d,f as c,U as p,g,h as u,i as h,P as m,T as b}from"./use-unit-settings.js";import{T as v,h as C,l as f,q as O,x as j,u as y,P as S,y as w}from"./actions-menu.js";import{t as x,x as I,v as k,a1 as E}from"./carrier.js";import{useState as _,useCallback as T,useRef as F,useEffect as P,useMemo as A,useContext as D,createContext as L}from"react";import{useTranslation as R}from"react-i18next";import{Icon as z,IconSize as N,Select as B,Option as $,Input as M,Popover as W,Typography as U,TagColor as G,Next as V,Tag as H,TagVariant as K,EmptyState as q,Button as Z}from"@shipengine/giger";import{useListLabels as Y,useGetLabel 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,C as ae,E as se,G as re,b as ie,a as le}from"./usePager.js";import{b as oe,s as de}from"./validation.js";import{f as ce,g as pe}from"./use-toggle.js";import{formatISO as ge}from"date-fns/formatISO";import{isSameDay as ue}from"date-fns/isSameDay";import{isWithinInterval as he}from"date-fns/isWithinInterval";import{setHours as me}from"date-fns/setHours";import{setMinutes as be}from"date-fns/setMinutes";import{IconNames as ve}from"@shipengine/giger-theme";const Ce=oe({category:{alignItems:"center",cursor:"pointer",display:"flex",flexDirection:"row",justifyContent:"space-between"},colorPicker:e=>({"&::-webkit-color-swatch":{border:`1px solid ${de(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:de(e).spacing(4.25),outline:"none",width:de(e).spacing(4.25)}),container:e=>({marginBottom:de(e).spacing(2)}),input:e=>({border:`1px solid ${de(e).palette.gray.light}`,borderRadius:"4px",color:de(e).palette.gray.main,fontSize:"14px",padding:de(e).spacing(1)}),inputContainer:e=>({alignItems:"center",display:"flex",flexDirection:"row",justifyContent:"space-between",padding:`${de(e).spacing(2)}px 0`}),wrapper:e=>({display:"flex",gap:de(e).spacing(1)})}),fe=({paletteConfig:n,onUpdatePaletteConfig:a,formatKey:s})=>{const[r,i]=_(new Set),l=e=>{i((t=>{const n=new Set(t);return n.has(e)?new Set([...n].filter((t=>t!==e))):new Set([...n,e])}))},o=T(((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:Ce.container,id:a},{children:[t("div",Object.assign({"aria-expanded":r.has(a),css:Ce.category,onClick:e=>{e.preventDefault(),l(a)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),l(a))},role:"button",tabIndex:0},{children:[e("p",{children:x(a)}),e(z,{name:r.has(a)?ve.CHEVRON_TOP:ve.CHEVRON_BOTTOM,size:N.SIZE_REGULAR})]})),r.has(a)&&Object.keys(n[a]).map((r=>t("div",Object.assign({css:Ce.inputContainer,id:"input-container"},{children:[e("label",Object.assign({css:{fontWeight:"bold"},htmlFor:`${a}.${r}`},{children:s(r)})),t("form",Object.assign({css:Ce.wrapper},{children:[e("input",{css:Ce.input,onChange:e=>{e.preventDefault(),o(a,r,e.target.value)},onKeyDown:e=>{"Enter"===e.key&&e.preventDefault()},type:"text",value:n[a][r]}),e("input",{css:Ce.colorPicker,onChange:e=>o(a,r,e.target.value),type:"color",value:n[a][r]})]}))]}),r)))]}),a)))}))},Oe=oe({input:e=>({border:`1px solid ${de(e).palette.gray.light}`,borderRadius:"4px",color:de(e).palette.gray.main,fontSize:"14px",maxWidth:de(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:de(e).spacing(1),justifyContent:"space-between"}),sectionContainer:e=>({marginBottom:de(e).spacing(4)}),select:e=>({border:`1px solid ${de(e).palette.gray.light}`,borderRadius:"4px",color:de(e).palette.gray.main,fontSize:"14px"})}),je=({onUpdateTypographyConfig:a,typographyConfig:s,formatKey:r})=>{const i=T(((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]),l=T(((e,t)=>{if(e)return e[t]}),[]),o=(t,n)=>{var a;const r=[{label:"Normal",value:"400"},{label:"Semi Bold",value:"600"},{label:"Bold",value:"700"}],o=null===(a=l(s,t))||void 0===a?void 0:a.fontWeight.toString(),d=void 0!==o?r.find((e=>e.value===o)):void 0;return e(B,Object.assign({css:Oe.select,label:"Font Weight",name:"font-weight",onChange:(e,a)=>i(t,n,null==a?void 0:a.value),value:d},{children:r.map((t=>e($,Object.assign({value:t.value},{children:t.label}),t.value)))}))},d=(t,n)=>{var a;const r=null===(a=l(s,t))||void 0===a?void 0:a.fontSize.replace("px","");return e(M,{"aria-labelledby":`${t}.${n}`,css:Oe.input,label:"Font Size(px)",onChange:e=>{e.target.value.match(/^\d{0,2}$/)&&i(t,n,`${e.target.value}px`)},value:r})},c=(t,a)=>{switch(a){case"fontWeight":return e(n,{children:o(t,a)});case"fontSize":return e(n,{children:d(t,a)});default:return null}};return e("div",{children:s&&Object.keys(s).map((n=>t("div",Object.assign({css:Oe.sectionContainer},{children:[e("p",Object.assign({css:Oe.keys,id:n},{children:r(n)})),e("section",Object.assign({css:Oe.section},{children:Object.keys(s[n]).map((t=>e("div",Object.assign({id:`${n}.${t}`},{children:c(n,t)}),t)))}))]}),n)))})},ye=oe({container:e=>({color:de(e).palette.gray.dark,display:"flex",flexDirection:"column",flexGrow:1,overflow:"hidden",position:"relative"}),content:e=>({display:"flex",flexDirection:"column",gap:de(e).spacing(3),padding:de(e).spacing(3)}),copy:e=>({backgroundColor:de(e).palette.white,borderRadius:"4px",padding:de(e).spacing(.5)}),drawerHeader:e=>({alignItems:"center",display:"flex",gap:de(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:de(e).spacing(1)}),pre:e=>({backgroundColor:"#FFFFFF66",borderRadius:"8px",fontSize:"14px",padding:de(e).spacing(.3)}),presetOption:e=>({"&:hover":{backgroundColor:"scopeTheme(theme).palette.gray.ultraLight"},backgroundColor:"transparent",borderRadius:"4px",fontSize:"14px",padding:de(e).spacing(1)}),presetsButton:e=>({"&:hover":{backgroundColor:"#d1d4d7"},backgroundColor:"#E4E5E7",borderRadius:"4px",cursor:"pointer",display:"flex",fontSize:"14px",gap:de(e).spacing(.5),padding:`${de(e).spacing(.5)}px ${de(e).spacing(1)}px`})}),Se=({themeConfig:n,onUpdateThemeConfig:a,presets:s,showDrawer:r})=>{const i=F(n),[l,o]=_(!1),d=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:x(e),value:x(e)})),[c,p]=_(d.sort()[0].value),g=e=>I(k(e)),u=F(null),[h,m]=ce(!1),b=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:c,tabs:d}),s?t("div",{children:[t("button",Object.assign({"aria-controls":"presets-popover","aria-expanded":h,css:ye.presetsButton,onClick:e=>{e.preventDefault(),m()},ref:u},{children:["Presets",e(z,{name:ve.CARET_BOTTOM,size:N.SIZE_SMALL})]})),e(W,Object.assign({container:document.querySelector("#theme-creator"),isOpen:h,onClickAway:()=>m(),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(),m(),b(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(),m(),b(t.themeConfig)},role:"menuitem"},{children:t.presetName}),t.presetName)))]}))}))]}):e("button",Object.assign({"aria-label":"Set Default Theme",css:ye.presetsButton,onClick:()=>{b(i.current)},role:"menuitem"},{children:"Reset to Default"}))]})),e(U,Object.assign({role:"heading",variant:"heading4"},{children:`${c} 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(je,{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,c)]})),r&&e(te,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(C,{content:r.copyToClipboardText})}))]})),isOpen:l,toggleDrawer:()=>o(!l)},{children:r.content}))]}))},we=({onRedirectToOnboarding:t})=>e(a,{onRedirectToOnboarding:t}),xe=s(we,f,{resources:{en:r}});var Ie=Object.freeze({__proto__:null,Component:we,Element:xe});const ke=()=>{const t=E(i(),[]);return e(l,Object.assign({},t))},Ee=s(ke,f,{resources:{en:r}});var _e=Object.freeze({__proto__:null,Component:ke,Element:Ee});const Te=({isModalFullScreen:t})=>{const n=E(o(),[]);return e(d,Object.assign({isModalFullScreen:t},n))},Fe=s(Te,f,{resources:{en:r}});var Pe=Object.freeze({__proto__:null,Component:Te,Element:Fe});const Ae=oe({errorState:e=>Object.assign({backgroundColor:de(e).palette.white},de(e).getComponentOverride("Table")),tableParagraph:{margin:0}}),De=({labelStatus:a,features:s,onClickPrintLabel:r,onClickVoidLabel:i,onClickPrintForms:l,onClickViewDetails:o,onRowClick:d,onClickExternalOrderId:c,onClickExternalShipmentId:p})=>{var g,u;const{t:h}=R(["common","list-labels"]),{globalFeatures:m,getFeatures:b}=pe(),v=b("labelsGridFeatures");s=Object.assign(Object.assign({},v),null!=s?s:{});const C=A((()=>{var e;return null===(e=null==s?void 0:s.columns)||void 0===e?void 0:e.find((e=>"labelId"===e.name))}),[s]),f=A((()=>{var e;return null===(e=null==s?void 0:s.columns)||void 0===e?void 0:e.find((e=>"shipmentId"===e.name))}),[s]),x=C&&(null===(g=C.allowFilter)||void 0===g||g),I=f&&(null===(u=f.allowFilter)||void 0===u||u),{labels:k,getGridData:E,isError:T,isLoading:F,filters:D,setFilters:L,pageConfig:z,isAnyFilterActive:N,shouldShowFilters:B,clearAllFilters:$}=(({labelStatus:e,showShipmentIdFilter:t,showLabelIdFilter:n})=>{var a,s;const r={labelId:{enabled:!!n,value:""},shipmentId:{enabled:!!t,value:""}},{getServiceName:i}=ee(),{page:l,pageSize:o,pagerProps:d}=ne(20),[c,p]=_(r),g=Object.keys(c).some((e=>{const t=c[e];return(null==t?void 0:t.enabled)&&t.value})),u=Object.keys(c).some((e=>{const t=c[e];return null==t?void 0:t.enabled}));P((()=>{p({labelId:{enabled:!!n,value:""},shipmentId:{enabled:!!t,value:""}})}),[n,t]);const{data:h,isLoading:m,isError:b}=Y({queryFnParams:{labelStatus:e,page:l,pageSize:o,shipmentId:c.shipmentId.value||void 0,sortBy:"modified_at",sortDir:"desc"}}),v=A((()=>(null==h?void 0:h.labels.map((e=>Object.assign(Object.assign({},e),{serviceName:i(e)}))))||[]),[null==h?void 0:h.labels,i]),C=u&&(g||Boolean(null==v?void 0:v.length)),{data:f,isError:O,isInitialLoading:j}=J((null===(a=c.labelId)||void 0===a?void 0:a.value)||void 0),y=null===(s=c.labelId)||void 0===s?void 0:s.value,S=(t=>{if(y&&!O){let n=!0;return e&&e!==(null==t?void 0:t.status)&&(n=!1),""!==(null==c?void 0:c.shipmentId.value)&&(null==c?void 0:c.shipmentId.value)!==(null==t?void 0:t.shipmentId)&&(n=!1),n?t:void 0}})(f),w=y&&(O||!S);return{clearAllFilters:()=>{p(r)},filters:c,getGridData:()=>S?[Object.assign(Object.assign({},S),{serviceName:i(S)})]:w?[]:v||[],isAnyFilterActive:g,isError:b,isLoading:m||j,labels:v,pageConfig:{currentPage:S?1:(null==h?void 0:h.page)||0,pagerProps:d,pagesAmount:(null==h?void 0:h.pages)||0,pageSize:o,showPagination:!S&&((null==h?void 0:h.total)||0)>o,totalElements:S?1:(null==h?void 0:h.total)||0},setFilters:e=>{d.onPageSelect(1),p(e)},shouldShowFilters:C}})({labelStatus:a,showLabelIdFilter:x,showShipmentIdFilter:I}),M=A((()=>({labelId:Object.assign(Object.assign({},D.labelId),{nickname:null==C?void 0:C.nickname}),shipmentId:Object.assign(Object.assign({},D.shipmentId),{nickname:null==f?void 0:f.nickname})})),[D,C,f]),W=A((()=>{var a;const r={completed:{color:G.SUCCESS,text:h("list-labels:status.completed")},error:{color:G.ERROR,text:h("list-labels:status.error")},processing:{color:G.INFO,text:h("list-labels:status.processing")},voided:{color:G.INFO,text:h("list-labels:status.voided")}},i={delivered:{color:G.SUCCESS,text:h("list-labels:trackingStatus.delivered")},error:{color:G.ERROR,text:h("list-labels:trackingStatus.error")},in_transit:{color:G.GRAY,text:h("list-labels:trackingStatus.inTransit")},unknown:{color:G.ALERT,text:h("list-labels:trackingStatus.unknown")}},l={createdDate:{headerContent:h("list-labels:headers.created"),renderCellContent:t=>e(ae,{date:t.createdAt,short:!0})},externalOrderId:{headerContent:h("list-labels:headers.externalOrderId"),renderCellContent:t=>t.externalOrderId&&c?e(V.Link,Object.assign({bold:!1,onClick:()=>{var e;return null==c?void 0:c(null!==(e=t.externalOrderId)&&void 0!==e?e:void 0)}},{children:t.externalOrderId})):e(U,Object.assign({component:"span",variant:"body2"},{children:t.externalOrderId}))},externalShipmentId:{headerContent:h("list-labels:headers.externalShipmentId"),renderCellContent:t=>t.externalShipmentId&&p?e(V.Link,Object.assign({bold:!1,onClick:()=>{var e;return null==p?void 0:p(null!==(e=t.externalShipmentId)&&void 0!==e?e:void 0)}},{children:t.externalShipmentId})):e(U,Object.assign({component:"span",variant:"body2"},{children:t.externalShipmentId}))},labelId:{headerContent:h("list-labels:headers.labelId"),renderCellContent:t=>e(U,Object.assign({component:"span",variant:"body2"},{children:t.labelId}))},packages:{headerContent:h("list-labels:headers.parcels"),renderCellContent:t=>e(U,Object.assign({component:"span",variant:"body2"},{children:t.packages.length}))},recipient:{headerContent:h("list-labels:headers.recipient"),renderCellContent:a=>t(n,{children:[e(U,Object.assign({component:"p",css:Ae.tableParagraph,variant:"body2"},{children:a.shipTo.name})),t(U,Object.assign({component:"p",css:Ae.tableParagraph,variant:"body2"},{children:[a.shipTo.postalCode,", ",a.shipTo.cityLocality]}))]})},shipDate:{headerContent:h("list-labels:headers.shipDate"),renderCellContent:t=>e(ae,{date:t.shipDate,short:!0})},shipmentId:{headerContent:h("list-labels:headers.shipmentId"),renderCellContent:t=>e(U,Object.assign({component:"span",variant:"body2"},{children:t.shipmentId}))},shippingService:{headerContent:h("list-labels:headers.shipping"),renderCellContent:a=>t(n,{children:[e(U,Object.assign({component:"p",css:Ae.tableParagraph,variant:"body2"},{children:a.serviceName||a.serviceCode})),a.trackable&&e(V.Link,Object.assign({bold:!1,href:a.trackingUrl,isExternal:!0,target:"_blank"},{children:a.trackingNumber}))]})},status:{headerContent:h("list-labels:headers.status"),renderCellContent:t=>e(H,Object.assign({color:r[t.status].color,variant:K.LINEAL_FILLED},{children:r[t.status].text}))},trackingStatus:{headerContent:h("list-labels:headers.trackingStatus"),renderCellContent:t=>e(H,Object.assign({color:i[t.trackingStatus].color,variant:K.LINEAL_FILLED},{children:i[t.trackingStatus].text}))}},o=[];return null===(a=null==s?void 0:s.columns)||void 0===a||a.forEach((e=>{l[e.name]&&(e.nickname?o.push(Object.assign(Object.assign({},l[e.name]),{headerContent:e.nickname})):o.push(l[e.name]))})),o}),[s,h,c,p]);if(F)return e(O,{message:h("loading.labels")});if(T)return e(se,{css:Ae.errorState,subtitle:[h("list-labels:errorMessages.subtitle"),h("errorMessages.refreshAndTryAgain")],title:h("list-labels:errorMessages.title")});const Q=(e,t)=>{e===w.PRINT_LABEL&&(e=>{null==r||r(),window.open(e.labelDownload.href,"_blank","noopener, noreferrer")})(t),e===w.VOID_LABEL&&(null==i||i(t)),e===w.PRINT_FORMS&&(e=>{null==l||l(),window.open(e.formDownload.href,"_blank","noopener, noreferrer")})(t),e===w.VIEW_DETAILS&&(null==o||o(t))};return(null==s?void 0:s.showActions)&&k.some((e=>"completed"===e.status))&&W.push({headerContent:"",renderCellContent:t=>{var n,a;const s=!!(null===(n=t.labelDownload)||void 0===n?void 0:n.href)&&"completed"===t.status,r=!!i&&"completed"===t.status,l=!!(null===(a=t.formDownload)||void 0===a?void 0:a.href)&&"completed"===t.status,d=!!o;if(!(s||r||l||d))return null;const c=[...d?[w.VIEW_DETAILS]:[],...s?[w.PRINT_LABEL]:[],...r?[w.VOID_LABEL]:[],...l?[w.PRINT_FORMS]:[]];return e(j,{allowedActions:c,onActionClick:e=>Q(e,t)})}}),t(n,{children:[e(re,{columns:W,data:E(),emptyContent:e(q,N?Object.assign({isElevated:!1,subtitle:h("list-labels:emptyWithFilters.subtitle"),title:h("list-labels:emptyWithFilters.title")},{children:e(Z,Object.assign({onClick:$},{children:h("list-labels:emptyWithFilters.button")}))}):{isElevated:!1,subtitle:h("list-labels:empty.subtitle"),title:h("list-labels:empty.title")}),filters:B&&e(ie,{filters:M,onClearAllFilters:$,onFiltersUpdated:L}),footerContent:e(le,{onPageChange:z.pagerProps.onPageSelect,page:z.currentPage,pages:z.pagesAmount,pageSize:z.pageSize,showPagination:z.showPagination,total:z.totalElements}),onRowClick:d}),m.poweredByShipEngine&&t(n,{children:[e(y,{}),e(S,{})]})]})},Le=s(De,f,{css:{height:"100%",minWidth:"440px",width:"100%"},resources:{en:r}});var Re=Object.freeze({__proto__:null,Component:De,Element:Le});const ze=(e,t)=>({end:me(be(t,59),23),start:me(be(e,0),0)}),Ne=(e,t)=>({createdDate:{enabled:t,value:null},shipmentId:{enabled:e,value:""}}),Be=({shipmentStatus:e,showShipmentIdFilter:t=!0,showCreatedDateFilter:n=!0})=>{var a,s,r,i;const l=Ne(t,n),{getServiceName:o}=ee(),{page:d,pageSize:c,pagerProps:p}=ne(20),[g,u]=_(l),h=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}));P((()=>{const e=Ne(t,n);u(e)}),[n,t]);const{data:b,isLoading:v,isError:C}=Q(Object.assign({page:d,pageSize:c,shipmentStatus:e,sortBy:"modified_at",sortDir:"desc"},((e,t)=>{if(!e||!t)return{};const n=ze(e,t);return{createdAtEnd:ge(n.end),createdAtStart:ge(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))),f=A((()=>null==b?void 0:b.shipments.map((e=>Object.assign(Object.assign({},e),{serviceName:o(e)})))),[null==b?void 0:b.shipments,o]),O=m&&(h||Boolean(null==f?void 0:f.length)),{data:j,error:y,isInitialLoading:S}=X({queryFnParams:{shipmentId:g.shipmentId.value||void 0},retry:!1}),w=g.shipmentId.value,x=(t=>{var n,a,s,r;if(w&&!y){let i=!0;e&&(null==t?void 0:t.shipmentStatus)!==e&&(i=!1);const l=null===(n=g.createdDate)||void 0===n?void 0:n.value;return(null==l?void 0:l.start)&&l.end&&(null==t?void 0:t.createdAt)&&(a=l.start,s=l.end,r=t.createdAt,ue(a,s)&&ue(a,new Date(r))||he(new Date(r),ze(a,s))||(i=!1)),i?t:void 0}})(j),I=w&&(y||!x);return{clearAllFilters:()=>{u(l)},filters:g,getGridData:()=>x?[Object.assign(Object.assign({},x),{serviceName:o(x)})]:I?[]:f||[],isAnyFilterActive:h,isError:C,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:c,showPagination:!x&&((null==b?void 0:b.total)||0)>c,totalElements:x?1:(null==b?void 0:b.total)||0},setFilters:e=>{p.onPageSelect(1),u(e)},shipments:f,shouldShowFilters:O}},$e=oe({errorState:e=>Object.assign({backgroundColor:de(e).palette.white},de(e).getComponentOverride("Table")),tableParagraph:{margin:0}}),Me=({onRowClick:a,onClickCancelShipment:s,shipmentStatus:r,showShipmentIdFilter:i=!0,showCreatedDateFilter:l=!0})=>{const{t:o}=R(["common","list-shipments"]),{globalFeatures:d}=pe(),{isLoading:c,isError:p,filters:g,setFilters:u,pageConfig:h,getGridData:m,isAnyFilterActive:b,shouldShowFilters:v,clearAllFilters:C}=Be({shipmentStatus:r,showCreatedDateFilter:l,showShipmentIdFilter:i});if(c)return e(O,{message:o("loading.shipments")});if(p)return e(se,{css:$e.errorState,subtitle:[o("list-shipments:errorMessages.subtitle"),o("errorMessages.refreshAndTryAgain")],title:o("list-shipments:errorMessages.title")});const f={cancelled:{color:G.ALERT,text:o("list-shipments:status.cancelled")},label_purchased:{color:G.SUCCESS,text:o("list-shipments:status.purchased")},pending:{color:G.SUCCESS,text:o("list-shipments:status.readyToBuy")},processing:{color:G.INFO,text:o("list-shipments:status.processing")}},x=[{headerContent:o("list-shipments:headers.shipmentId"),renderCellContent:t=>e(U,Object.assign({component:"p",css:$e.tableParagraph,variant:"body2"},{children:t.shipmentId}))},{headerContent:o("list-shipments:headers.parcels"),renderCellContent:t=>e(U,Object.assign({component:"p",css:$e.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(U,Object.assign({component:"p",css:$e.tableParagraph,variant:"body2"},{children:a.shipTo.name})),r&&e(U,Object.assign({component:"p",css:$e.tableParagraph,variant:"body2"},{children:[a.shipTo.postalCode,a.shipTo.cityLocality].filter(Boolean).join(", ")}))]}):"--"}},{headerContent:o("list-shipments:headers.shipping"),renderCellContent:t=>e(U,Object.assign({component:"p",css:$e.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(H,Object.assign({color:f[t.shipmentStatus].color,variant:K.LINEAL_FILLED},{children:f[t.shipmentStatus].text}))},{headerContent:"",renderCellContent:t=>{const n=[...!!s&&"pending"===t.shipmentStatus?[w.CANCEL_SHIPMENT]:[]];return n.length>0&&e(j,{allowedActions:n,onActionClick:e=>((e,t)=>{e===w.CANCEL_SHIPMENT&&(null==s||s(t))})(e,t)})}}];return t(n,{children:[e(re,{columns:x,data:m(),emptyContent:e(q,b?Object.assign({isElevated:!1,subtitle:o("list-shipments:emptyState.filtersSubtitle"),title:o("list-shipments:emptyState.filtersTitle")},{children:e(Z,Object.assign({onClick:C},{children:o("list-shipments:emptyState.viewAll")}))}):{isElevated:!1,subtitle:o("list-shipments:emptyState.subtitle"),title:o("list-shipments:emptyState.title")}),filters:v&&e(ie,{filters:g,onClearAllFilters:C,onFiltersUpdated:u}),footerContent:e(le,{onPageChange:h.pagerProps.onPageSelect,page:h.currentPage,pages:h.pagesAmount,pageSize:h.pageSize,showPagination:h.showPagination,total:h.totalElements}),onRowClick:a}),d.poweredByShipEngine&&t(n,{children:[e(y,{}),e(S,{})]})]})},We=s(Me,f,{css:{height:"100%",minWidth:"440px",width:"100%"},resources:{en:r}});var Ue=Object.freeze({__proto__:null,Component:Me,Element:We});const Ge=L(void 0),Ve=({children:t,editableTheme:n})=>{const[a,s]=_(n);return e(Ge.Provider,Object.assign({value:{setThemeConfig:s,themeConfig:a}},{children:t}))},He=()=>{const e=D(Ge);if(!e)throw new Error("useThemeConfigurator must be used within a ThemeConfiguratorProvider");return e},Ke=t=>{var n=E(t,[]);return e(Se,Object.assign({},n))},qe=s(Ke,f,{resources:{en:r}});var Ze=Object.freeze({__proto__:null,Component:Ke,Element:qe});const Ye=()=>{const t=E(c(),[]);return e(p,Object.assign({},t))},Je=s(Ye,f,{resources:{en:r}});var Qe=Object.freeze({__proto__:null,Component:Ye,Element:Je});const Xe=({onRedirectToOnboarding:t})=>e(g,{onRedirectToOnboarding:t}),et=s(Xe,f,{resources:{en:r}});var tt=Object.freeze({__proto__:null,Component:Xe,Element:et});const nt=()=>{const t=E(u(),[]);return e(h,Object.assign({},t))},at=s(nt,f,{resources:{en:r}});var st=Object.freeze({__proto__:null,Component:nt,Element:at});const rt=({onRedirectToOnboarding:t})=>e(m,{onRedirectToOnboarding:t}),it=s(rt,f,{resources:{en:r}});var lt=Object.freeze({__proto__:null,Component:rt,Element:it});const ot=()=>e(b,{}),dt=s(ot,f,{resources:{en:r}});var ct=Object.freeze({__proto__:null,Component:ot,Element:dt});export{Ve as T,_e as a,Pe as b,Qe as c,tt as d,st as e,ct as f,Re as l,Ie as m,lt as p,Ue as s,Ze as t,He as u};
package/types.js CHANGED
@@ -1 +1 @@
1
-
1
+ export{C as CanadaDeliveredDutyOptions}from"./canada-ddp.js";