@shipengine/elements 2.10.0 → 2.11.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.
Files changed (80) hide show
  1. package/actions-menu.js +5 -5
  2. package/carrier.js +1 -1
  3. package/components.js +1 -1
  4. package/elements.js +1 -1
  5. package/hooks.js +1 -1
  6. package/index.js +1 -1
  7. package/package.json +3 -3
  8. package/shipment.js +1 -1
  9. package/src/components/field/{rate-card → rate-select/rate-card}/cost-breakdown/cost-breakdown.styles.d.ts +0 -1
  10. package/src/components/field/rate-select/rate-card/rate-card.d.ts +16 -0
  11. package/src/components/field/rate-select/rate-card/rate-card.styles.d.ts +30 -0
  12. package/src/components/field/rate-select/rate-select.d.ts +1 -0
  13. package/src/components/fund-and-purchase/fund-and-purchase.d.ts +1 -1
  14. package/src/components/service-card/service-card.d.ts +36 -0
  15. package/src/components/service-card/service-card.styles.d.ts +68 -0
  16. package/src/components/service-point-display/service-point-display.d.ts +1 -0
  17. package/src/components/service-points/service-points.d.ts +3 -2
  18. package/src/components/service-points/service-points.styles.d.ts +6 -0
  19. package/src/components/templates/index.d.ts +1 -1
  20. package/src/components/templates/label-display/index.d.ts +1 -0
  21. package/src/components/templates/label-display/label-card.d.ts +17 -0
  22. package/src/components/templates/{label/label.styles.d.ts → label-display/label-card.styles.d.ts} +8 -2
  23. package/src/components/templates/{label/label.d.ts → label-display/label-display.d.ts} +3 -1
  24. package/src/components/templates/rate-form/rate-form.d.ts +2 -1
  25. package/src/components/templates/rate-form/rate-view.d.ts +2 -1
  26. package/src/components/templates/shipment-form/shipment-form.d.ts +1 -1
  27. package/src/components/templates/wallet-form/wallet-form.d.ts +2 -1
  28. package/src/elements/index.d.ts +2 -2
  29. package/src/elements/labels-grid/hooks/use-labels-grid.d.ts +5 -1
  30. package/src/elements/labels-grid/labels-grid.d.ts +34 -30
  31. package/src/elements/purchase-label/hooks/use-rates-form.d.ts +1 -0
  32. package/src/elements/purchase-label/hooks/use-shipment-form.d.ts +1 -1
  33. package/src/elements/select-label-layout/index.d.ts +1 -0
  34. package/src/features/index.d.ts +1 -1
  35. package/src/features/manage-carriers/hooks/use-carrier-metadata.d.ts +2 -2
  36. package/src/features/select-label-layout/index.d.ts +2 -0
  37. package/src/features/select-label-layout/select-label-layout.d.ts +7 -0
  38. package/src/features/{label-layout → select-label-layout}/use-label-layout.d.ts +2 -2
  39. package/src/features/unit-settings/unit-settings.d.ts +2 -2
  40. package/src/features/unit-settings/use-unit-settings.d.ts +3 -3
  41. package/src/features/vat-settings/use-vat-settings.d.ts +3 -3
  42. package/src/hooks/insurance/use-manage-funding-source-insurance.d.ts +1 -1
  43. package/src/index.d.ts +1 -0
  44. package/src/types/carrier-metadata.d.ts +1 -1
  45. package/src/utilities/feature-flags/types.d.ts +33 -0
  46. package/src/utilities/index.d.ts +1 -1
  47. package/src/utilities/tracking-formatter.d.ts +9 -0
  48. package/src/workflows/account-settings/account-settings.d.ts +2 -33
  49. package/src/workflows/account-settings/use-get-panel-props.d.ts +3 -3
  50. package/src/workflows/onboarding/components/funding-step/funding-step.d.ts +2 -1
  51. package/suspend-text.js +1 -1
  52. package/transaction-history-element.js +1 -1
  53. package/use-scrub-errors.js +1 -1
  54. package/use-toggle.js +1 -1
  55. package/use-unit-settings.js +1 -1
  56. package/usePager.js +1 -1
  57. package/utilities.js +1 -1
  58. package/validation.js +1 -0
  59. package/vat.js +1 -1
  60. package/wallet-form.js +1 -1
  61. package/workflows.js +1 -1
  62. package/insurance.js +0 -1
  63. package/src/components/field/rate-card/rate-card.d.ts +0 -19
  64. package/src/components/field/rate-card/rate-card.styles.d.ts +0 -23
  65. package/src/components/templates/label/index.d.ts +0 -1
  66. package/src/elements/label-layout/index.d.ts +0 -1
  67. package/src/features/label-layout/index.d.ts +0 -2
  68. package/src/features/label-layout/label-layout.d.ts +0 -7
  69. package/src/utilities/tracking-status-formatter.d.ts +0 -1
  70. /package/src/components/field/{rate-card → rate-select/rate-card}/cost-breakdown/cost-breakdown.d.ts +0 -0
  71. /package/src/components/field/{rate-card → rate-select/rate-card}/cost-breakdown/index.d.ts +0 -0
  72. /package/src/components/field/{rate-card → rate-select/rate-card}/index.d.ts +0 -0
  73. /package/src/components/field/{rate-card → rate-select/rate-card}/rate-detail-cost-breakdown/index.d.ts +0 -0
  74. /package/src/components/field/{rate-card → rate-select/rate-card}/rate-detail-cost-breakdown/rate-detail-cost-breakdown.d.ts +0 -0
  75. /package/src/components/field/{rate-card → rate-select/rate-card}/rate-detail-cost-breakdown/rate-detail-cost-breakdown.styles.d.ts +0 -0
  76. /package/src/components/{label → history/history-card/label}/index.d.ts +0 -0
  77. /package/src/components/{label → history/history-card/label}/label.d.ts +0 -0
  78. /package/src/components/{label → history/history-card/label}/label.styles.d.ts +0 -0
  79. /package/src/elements/{label-layout/label-layout-element.d.ts → select-label-layout/select-label-layout-element.d.ts} +0 -0
  80. /package/src/features/{label-layout/label-layout.styles.d.ts → select-label-layout/select-label-layout.styles.d.ts} +0 -0
@@ -1,6 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { SE } from "@shipengine/js-api";
3
+ import { LabelsGridFeatures } from "../../utilities";
3
4
  export type LabelsGridProps = {
5
+ /**
6
+ * `features` provides optional feature configuration for the Element
7
+ * If no value is defined, default configuration will be used.
8
+ */
9
+ features?: LabelsGridFeatures;
4
10
  /**
5
11
  * `labelStatus` is the status of the labels you wish to view.
6
12
  * If no value is defined, all labels will be rendered.
@@ -30,16 +36,8 @@ export type LabelsGridProps = {
30
36
  * `onRowClick` callback invoked when a row is clicked.
31
37
  */
32
38
  onRowClick?: (label: SE.Label) => void;
33
- /**
34
- * `showLabelIdFilter` controls the display of the label Id search filter
35
- */
36
- showLabelIdFilter?: boolean;
37
- /**
38
- * `showShipmentIdFilter` controls the display of the shipmentId search filter
39
- */
40
- showShipmentIdFilter?: boolean;
41
39
  };
42
- export declare const Component: ({ labelStatus, showShipmentIdFilter, showLabelIdFilter, onClickPrintLabel, onClickVoidLabel, onClickPrintForms, onClickViewDetails, onRowClick, }: LabelsGridProps) => import("@emotion/react/jsx-runtime").JSX.Element;
40
+ export declare const Component: ({ labelStatus, features, onClickPrintLabel, onClickVoidLabel, onClickPrintForms, onClickViewDetails, onRowClick, }: LabelsGridProps) => import("@emotion/react/jsx-runtime").JSX.Element;
43
41
  export declare const Element: ({ resources, ...props }: LabelsGridProps & {
44
42
  resources?: {
45
43
  en: {
@@ -130,7 +128,9 @@ export declare const Element: ({ resources, ...props }: LabelsGridProps & {
130
128
  highVolumeForms: string;
131
129
  multipleShippingServices: string;
132
130
  sections: {
133
- labels: string;
131
+ labels: string; /**
132
+ * `onRowClick` callback invoked when a row is clicked.
133
+ */
134
134
  shipmentSummary: string;
135
135
  };
136
136
  noLabels: string;
@@ -205,9 +205,7 @@ export declare const Element: ({ resources, ...props }: LabelsGridProps & {
205
205
  };
206
206
  carrier: {
207
207
  title: string;
208
- confirmAddress: string; /**
209
- * `onRowClick` callback invoked when a row is clicked.
210
- */
208
+ confirmAddress: string;
211
209
  description: string;
212
210
  };
213
211
  blackBox: {
@@ -258,10 +256,7 @@ export declare const Element: ({ resources, ...props }: LabelsGridProps & {
258
256
  pickup: string;
259
257
  location_fee: string;
260
258
  oversize: string;
261
- returns: string; /**
262
- * `labelStatus` is the status of the labels you wish to view.
263
- * If no value is defined, all labels will be rendered.
264
- */
259
+ returns: string;
265
260
  notifications: string;
266
261
  tip: string;
267
262
  duties_and_taxes: string;
@@ -271,7 +266,10 @@ export declare const Element: ({ resources, ...props }: LabelsGridProps & {
271
266
  auctane_service_fee: string;
272
267
  product_price: string;
273
268
  };
274
- };
269
+ }; /**
270
+ * `labelStatus` is the status of the labels you wish to view.
271
+ * If no value is defined, all labels will be rendered.
272
+ */
275
273
  "purchase-label": {
276
274
  title: string;
277
275
  actions: {
@@ -294,7 +292,10 @@ export declare const Element: ({ resources, ...props }: LabelsGridProps & {
294
292
  parcelguard: string;
295
293
  };
296
294
  errorMessages: {
297
- customsItemsRequired: string;
295
+ customsItemsRequired: string; /**
296
+ * `features` provides optional feature configuration for the Element
297
+ * If no value is defined, default configuration will be used.
298
+ */
298
299
  invalidAddress: string;
299
300
  noRates: string;
300
301
  salesOrderNotLoaded: string;
@@ -442,10 +443,7 @@ export declare const Element: ({ resources, ...props }: LabelsGridProps & {
442
443
  title: string;
443
444
  subtitle: string;
444
445
  };
445
- }; /**
446
- * `onClickPrintLabel` is an optional callback function that will be invoked when the user clicks the
447
- * `Print Label` button.
448
- */
446
+ };
449
447
  success: {
450
448
  title: string;
451
449
  subtitle: string;
@@ -541,7 +539,10 @@ export declare const Element: ({ resources, ...props }: LabelsGridProps & {
541
539
  insufficientFunds: string;
542
540
  insufficientFundsTitle: string;
543
541
  negativeBalance: string;
544
- negativeBalanceTitle: string;
542
+ negativeBalanceTitle: string; /**
543
+ * `onClickVoidLabel` is a callback function that controls the display of `Void Label` button and
544
+ * will be invoked when the user clicks on it.
545
+ */
545
546
  newBalance: string;
546
547
  };
547
548
  errors: {
@@ -661,7 +662,10 @@ export declare const Element: ({ resources, ...props }: LabelsGridProps & {
661
662
  error: string;
662
663
  };
663
664
  actions: {
664
- title: string;
665
+ title: string; /**
666
+ * `labelStatus` is the status of the labels you wish to view.
667
+ * If no value is defined, all labels will be rendered.
668
+ */
665
669
  print: string;
666
670
  void: string;
667
671
  printForms: string;
@@ -1068,13 +1072,13 @@ export declare const Element: ({ resources, ...props }: LabelsGridProps & {
1068
1072
  transactionHistory: string;
1069
1073
  adjustmentHistory: string;
1070
1074
  warehouses: string;
1071
- carriers: string; /**
1072
- * `labelStatus` is the status of the labels you wish to view.
1073
- * If no value is defined, all labels will be rendered.
1074
- */
1075
+ carriers: string;
1075
1076
  externalCarriers: string;
1076
1077
  labelLayout: string;
1077
- unitSettings: string;
1078
+ unitSettings: string; /**
1079
+ * `features` provides optional feature configuration for the Element
1080
+ * If no value is defined, default configuration will be used.
1081
+ */
1078
1082
  vatSettings: string;
1079
1083
  };
1080
1084
  };
@@ -42,4 +42,5 @@ export declare const useRatesForm: ({ getPreferredRates, onBeforeRateSaved, onBe
42
42
  servicePointsFetching: boolean;
43
43
  servicePointsResponse: SE.ServicePointsListResponse | undefined;
44
44
  shipment: SE.SalesOrderShipment | undefined;
45
+ showVatFeatures: boolean;
45
46
  };
@@ -13,7 +13,7 @@ export type UseShipmentFormProps = {
13
13
  shipment?: SE.SalesOrderShipment;
14
14
  };
15
15
  export declare const useShipmentForm: ({ compatibleCountryCodes, onAddressValidation, onApplyPreset, onChangeAddress, onShipmentUpdated, onSubmit, salesOrder, shipment, }: UseShipmentFormProps) => {
16
- accountSettings: SE.AccountSettings | undefined;
16
+ accountSettings: SE.ShipEngineAccountSettings | undefined;
17
17
  addressLoading: boolean;
18
18
  addressPreference: import("../../../components/templates").AddressPreference | undefined;
19
19
  carriers: SE.Carrier[] | undefined;
@@ -0,0 +1 @@
1
+ export * as SelectLabelLayout from "./select-label-layout-element";
@@ -1,4 +1,4 @@
1
- export * from "./label-layout";
1
+ export * from "./select-label-layout";
2
2
  export * from "./manage-carriers";
3
3
  export * from "./manage-external-carriers";
4
4
  export * from "./manage-funding";
@@ -1,2 +1,2 @@
1
- import { CarrierMetadata } from "../../../types";
2
- export declare const useCarrierMetadata: () => CarrierMetadata;
1
+ import { ElementsCarrierMetadata } from "../../../types";
2
+ export declare const useCarrierMetadata: () => ElementsCarrierMetadata;
@@ -0,0 +1,2 @@
1
+ export * as SelectLabelLayout from "./select-label-layout";
2
+ export * from "./use-label-layout";
@@ -0,0 +1,7 @@
1
+ import { SE } from "@shipengine/react-api";
2
+ export type SelectLabelLayoutSettingsProps = {
3
+ accountSettings?: SE.ShipEngineAccountSettings;
4
+ updateAccountSettings: (newAccountSetting: Partial<SE.ShipEngineAccountSettings>) => Promise<void>;
5
+ };
6
+ export declare const Settings: ({ accountSettings, updateAccountSettings, }: SelectLabelLayoutSettingsProps) => import("@emotion/react/jsx-runtime").JSX.Element;
7
+ export declare const Purchase: () => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { SE } from "@shipengine/react-api";
2
2
  export declare const useLabelLayout: () => {
3
- accountSettings: SE.AccountSettings | undefined;
3
+ accountSettings: SE.ShipEngineAccountSettings | undefined;
4
4
  isUpdatingLabelLayout: boolean;
5
- updateAccountSettings: (newAccountSetting: Partial<SE.AccountSettings>) => Promise<void>;
5
+ updateAccountSettings: (newAccountSetting: Partial<SE.ShipEngineAccountSettings>) => Promise<void>;
6
6
  updateLabelLayoutErrors: SE.CodedError[] | null;
7
7
  };
@@ -1,9 +1,9 @@
1
1
  import { SE } from "@shipengine/react-api";
2
2
  export type UnitSettingsProps = {
3
- accountSettings?: SE.AccountSettings;
3
+ accountSettings?: SE.ShipEngineAccountSettings;
4
4
  getVatSettingsErrors?: SE.CodedError[] | null;
5
5
  isLoading: boolean;
6
6
  refreshAccountSettings: () => void;
7
- updateAccountSettings: (payload: Partial<SE.AccountSettings>) => void;
7
+ updateAccountSettings: (payload: Partial<SE.ShipEngineAccountSettings>) => void;
8
8
  };
9
9
  export declare const UnitSettings: ({ accountSettings, getVatSettingsErrors: errors, isLoading, refreshAccountSettings, updateAccountSettings, }: UnitSettingsProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,10 +1,10 @@
1
1
  import { SE } from "@shipengine/react-api";
2
2
  export declare const useUnitSettings: () => {
3
- accountSettings: SE.AccountSettings | undefined;
3
+ accountSettings: SE.ShipEngineAccountSettings | undefined;
4
4
  getVatSettingsErrors: SE.CodedError[] | null;
5
5
  isLoading: boolean;
6
6
  isUpdatingUnitSettings: boolean;
7
- refreshAccountSettings: <TPageData>(options?: (import("@tanstack/query-core").RefetchOptions & import("@tanstack/query-core").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/query-core").QueryObserverResult<SE.AccountSettings, SE.CodedError[]>>;
8
- updateAccountSettings: (newAccountSetting: Partial<SE.AccountSettings>) => Promise<void>;
7
+ refreshAccountSettings: <TPageData>(options?: (import("@tanstack/query-core").RefetchOptions & import("@tanstack/query-core").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/query-core").QueryObserverResult<SE.ShipEngineAccountSettings, SE.CodedError[]>>;
8
+ updateAccountSettings: (newAccountSetting: Partial<SE.ShipEngineAccountSettings>) => Promise<void>;
9
9
  updateUnitSettingsErrors: SE.CodedError[] | null;
10
10
  };
@@ -1,8 +1,8 @@
1
1
  export declare const useVatSettings: () => {
2
2
  getVatSettingsErrors: import("@shipengine/react-api").CodedError[] | null;
3
3
  isLoading: boolean;
4
- refreshVatSettings: <TPageData>(options?: (import("@tanstack/query-core").RefetchOptions & import("@tanstack/query-core").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@shipengine/react-api").AccountSettings, import("@shipengine/react-api").CodedError[]>>;
5
- updateVatSettings: import("@tanstack/react-query").UseMutateAsyncFunction<import("@shipengine/react-api").AccountSettings, import("@shipengine/react-api").CodedError[], Partial<import("@shipengine/react-api").AccountSettings>, unknown>;
4
+ refreshVatSettings: <TPageData>(options?: (import("@tanstack/query-core").RefetchOptions & import("@tanstack/query-core").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@shipengine/react-api").ShipEngineAccountSettings, import("@shipengine/react-api").CodedError[]>>;
5
+ updateVatSettings: import("@tanstack/react-query").UseMutateAsyncFunction<import("@shipengine/react-api").ShipEngineAccountSettings, import("@shipengine/react-api").CodedError[], SE.AccountSettings, unknown>;
6
6
  updateVatSettingsErrors: import("@shipengine/react-api").CodedError[] | null;
7
- vatSettings: import("@shipengine/react-api").AccountSettings | undefined;
7
+ vatSettings: import("@shipengine/react-api").ShipEngineAccountSettings | undefined;
8
8
  };
@@ -1,7 +1,7 @@
1
1
  import { SE } from "@shipengine/react-api";
2
2
  import { InsuranceProviderProfile } from "../../types";
3
3
  export declare const useManageFundingSourceInsurance: () => {
4
- hasInsuranceToRegister: boolean;
4
+ hasInsuranceToRegister: boolean | undefined;
5
5
  insuranceAcceptedTerms: SE.Term[] | undefined;
6
6
  insuranceProviderProfiles: InsuranceProviderProfile[] | undefined;
7
7
  loading: boolean;
package/src/index.d.ts CHANGED
@@ -9,3 +9,4 @@ export * from "./types";
9
9
  export * from "./utilities";
10
10
  export * from "./workflows";
11
11
  export * from "./elements-provider";
12
+ export * from "@shipengine/react-api";
@@ -29,7 +29,7 @@ export type CarrierTerms = {
29
29
  export type CarrierWithFriendlyName = {
30
30
  name: string;
31
31
  };
32
- export type CarrierMetadata = Record<string, CarrierWithFriendlyName>;
32
+ export type ElementsCarrierMetadata = Record<string, CarrierWithFriendlyName>;
33
33
  export type CarrierMetadataFromFundingSource = {
34
34
  carrierProfile: SE.MetadataCarrierProfile;
35
35
  friendlyName: string;
@@ -123,6 +123,34 @@ export type AccountSettingsFeatures = {
123
123
  */
124
124
  showVatSettings?: boolean;
125
125
  };
126
+ export type LabelColumnName = "shipmentId" | "labelId" | "packages" | "recipient" | "shippingService" | "createdDate" | "shipDate" | "status" | "trackingStatus";
127
+ export type BaseLabelColumnConfig = {
128
+ /**
129
+ * The name identifying the column
130
+ */
131
+ name: Exclude<LabelColumnName, "shipmentId" | "labelId">;
132
+ };
133
+ export type FilterableLabelColumnConfig = {
134
+ /**
135
+ * Allow filtering by this column
136
+ */
137
+ allowFilter?: boolean;
138
+ /**
139
+ * The name identifying the column
140
+ */
141
+ name: Extract<LabelColumnName, "shipmentId" | "labelId">;
142
+ };
143
+ export type LabelColumnConfig = BaseLabelColumnConfig | FilterableLabelColumnConfig;
144
+ export type LabelsGridFeatures = {
145
+ /**
146
+ * Configure label grid columns
147
+ */
148
+ columns?: LabelColumnConfig[];
149
+ /**
150
+ * Configure label grid columns
151
+ */
152
+ showActions?: boolean;
153
+ };
126
154
  export type GlobalFeatures = {
127
155
  /**
128
156
  * Availible "Bring your own carrier" carrier codes for carriers that may be added. If this is omitted, new carriers may not be added by this element.
@@ -132,6 +160,10 @@ export type GlobalFeatures = {
132
160
  * list of all walleted carriers that are enabled for use in Elements.
133
161
  */
134
162
  enabledShipEngineCarriers?: EnabledShipEngineCarriers;
163
+ /**
164
+ * Enable parcel guard related features for the different parts of UI
165
+ */
166
+ enableParcelGuard?: boolean;
135
167
  /**
136
168
  * Use Elements in Sandbox mode. Requires a sandbox partner.
137
169
  */
@@ -148,6 +180,7 @@ export type GlobalFeatures = {
148
180
  export type ElementsFeatureFlags = {
149
181
  accountSettingsFeatures?: AccountSettingsFeatures;
150
182
  globalFeatures?: GlobalFeatures;
183
+ labelsGridFeatures?: LabelsGridFeatures;
151
184
  purchaseLabelFeatures?: PurchaseLabelFeatures;
152
185
  shipmentSummaryFeatures?: ShipmentSummaryFeatures;
153
186
  };
@@ -13,6 +13,6 @@ export * from "./rate-details";
13
13
  export * from "./rates";
14
14
  export * from "./shipengine";
15
15
  export * from "./styles";
16
- export * from "./tracking-status-formatter";
16
+ export * from "./tracking-formatter";
17
17
  export * from "./validation";
18
18
  export * from "./vat";
@@ -0,0 +1,9 @@
1
+ export declare const trackingStatusFormatter: (status: string) => string | undefined;
2
+ /**
3
+ * @internal
4
+ *
5
+ * # Format Tracking Number Utility Function
6
+ *
7
+ * - This is a utility function that formats the tracking number to display only the last 25 characters, in reverse truncated fashion as the last numbers of a tracking number are the most unique/important.
8
+ */
9
+ export declare const formatTrackingNumber: (trackingNumber: string) => string;
@@ -138,9 +138,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
138
138
  verifiedVat: string;
139
139
  vatFormErrors: {
140
140
  invalidFieldValue: string;
141
- verificationFailure: string; /**
142
- * `features` is a set of feature flags you would like to enable or disable in this component.
143
- */
141
+ verificationFailure: string;
144
142
  forbidden: string;
145
143
  connectionNotSupported: string;
146
144
  genericTitle: string;
@@ -425,9 +423,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
425
423
  title: string;
426
424
  subtitle: string;
427
425
  inlineMessage: string;
428
- }; /**
429
- * `features` is a set of feature flags you would like to enable or disable in this component.
430
- */
426
+ };
431
427
  errors: {
432
428
  noCarriers: {
433
429
  title: string;
@@ -468,30 +464,6 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
468
464
  tooltip: {
469
465
  warehouse: string;
470
466
  };
471
- /**
472
- * # Registered Account Settings Element
473
- *
474
- * - This is the registered `<AccountSettings />` element that will be used to render the
475
- * `<AccountSettings.Element />` component.
476
- *
477
- * @param ElementProps The props, callbacks, and resources necessary to render
478
- * the `<AccountSettings.Element />` component.
479
- *
480
- * @example
481
- * The `<Component />` is the source JSX that is rendered when you make use of the `AccountSettings`
482
- * Element directly. Here is a brief example of how you would use it within your application.
483
- * ```tsx
484
- * <AccountSettings.Element/>
485
- * ```
486
- *
487
- * <br />
488
- *
489
- * @see {@link AccountSettings.ComponentProps | The **props** that can be passed into the `<AccountSettings.Element />` component}
490
- * @see {@link CarrierServices.Element | The `<CarrierServices />` component used to view connected carriers and manage funding}
491
- * @see {@link ManageWarehouses.Component | The `<ManageWarehouses />` component used to add, update, or remove warehouses}
492
- * @see {@link PaymentMethodSettings | The `<PaymentMethodSettings />` component used to manage payment methods}
493
- * @see {@link ManageFunding | The `<ManageFunding />` component used to manage funding rules and add funds to a carrier account}
494
- */
495
467
  welcomePage: {
496
468
  title: string;
497
469
  message: string;
@@ -1084,9 +1056,6 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
1084
1056
  externalCarriers: string;
1085
1057
  labelLayout: string;
1086
1058
  unitSettings: string;
1087
- /**
1088
- * `features` is a set of feature flags you would like to enable or disable in this component.
1089
- */
1090
1059
  vatSettings: string;
1091
1060
  };
1092
1061
  };
@@ -1,9 +1,9 @@
1
1
  import { CollapsiblePanelProps } from "../../components";
2
2
  import { ExternalCarriersProps, UnitSettingsProps } from "../../features";
3
- import { LabelLayoutSettingsProps } from "../../features/label-layout/label-layout";
4
3
  import { ManageWarehousesProps } from "../../features/manage-warehouses/";
5
- type SettingProps = ExternalCarriersProps | LabelLayoutSettingsProps | UnitSettingsProps | ManageWarehousesProps;
6
- export type SettingPropsIntersection = ExternalCarriersProps & LabelLayoutSettingsProps & UnitSettingsProps & ManageWarehousesProps;
4
+ import { SelectLabelLayoutSettingsProps } from "../../features/select-label-layout/select-label-layout";
5
+ type SettingProps = ExternalCarriersProps | SelectLabelLayoutSettingsProps | UnitSettingsProps | ManageWarehousesProps;
6
+ export type SettingPropsIntersection = ExternalCarriersProps & SelectLabelLayoutSettingsProps & UnitSettingsProps & ManageWarehousesProps;
7
7
  export declare const useGetPanelProps: () => {
8
8
  getSettingPanelProps: (setting: string) => [panelProps?: CollapsiblePanelProps, settingProps?: SettingProps];
9
9
  };
@@ -3,5 +3,6 @@ import { WalletPayload } from "../../../../components/templates/wallet-form";
3
3
  export type FundingStepProps = {
4
4
  address: SE.Address;
5
5
  onSubmit: (payload: WalletPayload) => void;
6
+ showVatSettings?: boolean;
6
7
  };
7
- export declare const FundingStep: ({ address, onSubmit, }: FundingStepProps) => import("@emotion/react/jsx-runtime").JSX.Element;
8
+ export declare const FundingStep: ({ address, onSubmit, showVatSettings }: FundingStepProps) => import("@emotion/react/jsx-runtime").JSX.Element;
package/suspend-text.js CHANGED
@@ -1 +1 @@
1
- import{N as e,O as t,Q as n,U as a,X as o,Y as i,Z as r,_ as s,$ as c,a0 as l,a1 as g,a2 as p,M as d,a3 as m,a4 as h,K as u}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{h as W}from"./vat.js";var z=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:h,TextInput:u});const B=W({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:A.CHEVRON_TOP,onClick:()=>l(),size:T.SIZE_MEDIUM}:{name:A.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,z as f};
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 +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 b,T as m}from"./use-unit-settings.js";import{T as v,i as f,n as C,J as O,t as y,w as j,P as S,z as w,G as x}from"./actions-menu.js";import{k as E,t as _,q as k,V as 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 J}from"react";import{useListLabels as Y,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{e 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}=Y({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=J(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))},Je=s(Ze,C,{resources:{en:r}});var Ye=Object.freeze({__proto__:null,Component:Ze,Element:Je});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,Ye 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 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};