@shipengine/elements 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1168 -948
- package/index.js +1168 -950
- package/package.json +1 -1
- package/src/elements/index.d.ts +2 -0
package/index.cjs
CHANGED
|
@@ -15182,7 +15182,7 @@ var en = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(O
|
|
|
15182
15182
|
*
|
|
15183
15183
|
* @see {@link ConnectCarrier.ComponentProps | The props that are passed into the `<ConnectCarrier />` component}
|
|
15184
15184
|
*/
|
|
15185
|
-
const Component$
|
|
15185
|
+
const Component$b = ({
|
|
15186
15186
|
carrierName,
|
|
15187
15187
|
features,
|
|
15188
15188
|
onCancel,
|
|
@@ -15251,7 +15251,7 @@ const Component$9 = ({
|
|
|
15251
15251
|
}
|
|
15252
15252
|
});
|
|
15253
15253
|
};
|
|
15254
|
-
alchemy__default["default"].createElement(Component$
|
|
15254
|
+
alchemy__default["default"].createElement(Component$b, ErrorFallback, {
|
|
15255
15255
|
css: {
|
|
15256
15256
|
height: "100%",
|
|
15257
15257
|
maxWidth: "800px",
|
|
@@ -15287,7 +15287,7 @@ alchemy__default["default"].createElement(Component$9, ErrorFallback, {
|
|
|
15287
15287
|
* @see {@link ExternalCarriers.ComponentProps | The props that are passed into the `<ExternalCarriers />` component}
|
|
15288
15288
|
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<ExternalCarriers />` component}
|
|
15289
15289
|
*/
|
|
15290
|
-
const Component$
|
|
15290
|
+
const Component$a = ({
|
|
15291
15291
|
features
|
|
15292
15292
|
}) => {
|
|
15293
15293
|
const {
|
|
@@ -15345,7 +15345,7 @@ const Component$8 = ({
|
|
|
15345
15345
|
textAlign: "left"
|
|
15346
15346
|
}
|
|
15347
15347
|
}, {
|
|
15348
|
-
children: jsxRuntime.jsx(Component$
|
|
15348
|
+
children: jsxRuntime.jsx(Component$b, {
|
|
15349
15349
|
features: features,
|
|
15350
15350
|
onCarrierConnected: () => {
|
|
15351
15351
|
setAddModalOpen(false);
|
|
@@ -15360,7 +15360,7 @@ const Component$8 = ({
|
|
|
15360
15360
|
|
|
15361
15361
|
var externalCarriers = /*#__PURE__*/Object.freeze({
|
|
15362
15362
|
__proto__: null,
|
|
15363
|
-
Component: Component$
|
|
15363
|
+
Component: Component$a
|
|
15364
15364
|
});
|
|
15365
15365
|
|
|
15366
15366
|
const styles$l = createStyles({
|
|
@@ -15790,7 +15790,7 @@ const useListConnectedCarriers = () => {
|
|
|
15790
15790
|
* @see {@link ListCarriers.ComponentProps | The props that are passed into the `<List-Carriers />` component}
|
|
15791
15791
|
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<List-Carriers />` component}
|
|
15792
15792
|
*/
|
|
15793
|
-
const Component$
|
|
15793
|
+
const Component$9 = ({
|
|
15794
15794
|
features
|
|
15795
15795
|
}) => {
|
|
15796
15796
|
const {
|
|
@@ -15831,7 +15831,7 @@ const Component$7 = ({
|
|
|
15831
15831
|
|
|
15832
15832
|
var listCarriers = /*#__PURE__*/Object.freeze({
|
|
15833
15833
|
__proto__: null,
|
|
15834
|
-
Component: Component$
|
|
15834
|
+
Component: Component$9
|
|
15835
15835
|
});
|
|
15836
15836
|
|
|
15837
15837
|
const WarehouseDisplay = ({
|
|
@@ -16470,7 +16470,7 @@ const ManageWarehouses = ({
|
|
|
16470
16470
|
* @see {@link ManageWarehouses.ComponentProps | The props that are passed into the `<ManageWarehouses />` component}
|
|
16471
16471
|
* @see {@link AccountSettings.Element | The `<AccountSettings />` component renders the `<ManageWarehouses />` component}
|
|
16472
16472
|
*/
|
|
16473
|
-
const Component$
|
|
16473
|
+
const Component$8 = ({
|
|
16474
16474
|
onWarehouseAddressValidation: _ARE_WE_ACTUALLY_GOING_TO_USE_THIS
|
|
16475
16475
|
}) => {
|
|
16476
16476
|
const {
|
|
@@ -16553,7 +16553,7 @@ const Component$6 = ({
|
|
|
16553
16553
|
|
|
16554
16554
|
var manageWarehouses = /*#__PURE__*/Object.freeze({
|
|
16555
16555
|
__proto__: null,
|
|
16556
|
-
Component: Component$
|
|
16556
|
+
Component: Component$8
|
|
16557
16557
|
});
|
|
16558
16558
|
|
|
16559
16559
|
var img = "data:image/svg+xml,%3csvg fill='none' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='M22.9425 6.62223L18.63 5.81973C18.4275 5.78223 18.2325 5.91723 18.195 6.11973L17.3925 10.4322C17.355 10.6347 17.49 10.8297 17.6925 10.8672C17.715 10.8672 17.7375 10.8672 17.76 10.8672C17.94 10.8672 18.0975 10.7397 18.1275 10.5597L18.765 7.13973C21.15 10.3872 20.8125 14.9472 17.9475 17.8047C15.3225 20.4297 11.25 20.9697 8.04001 19.1247C7.86001 19.0197 7.63501 19.0797 7.53001 19.2597C7.42501 19.4397 7.49251 19.6647 7.66501 19.7697C9.05251 20.5722 10.5975 20.9622 12.1275 20.9622C14.4525 20.9622 16.755 20.0622 18.48 18.3372C21.5925 15.2247 21.9675 10.2597 19.3875 6.71973L22.8 7.34973C22.995 7.38723 23.1975 7.25223 23.235 7.04973C23.2725 6.84723 23.1375 6.65223 22.935 6.61473L22.9425 6.62223Z' fill='black' /%3e %3cpath d='M6.30022 12.7798C6.09772 12.7423 5.90272 12.8773 5.86522 13.0798L5.24272 16.4548C3.15022 13.2223 3.60022 8.91728 6.33022 6.18728C8.85022 3.66728 12.6752 3.05228 15.8477 4.65728C16.0277 4.74728 16.2602 4.67978 16.3502 4.49228C16.4402 4.30478 16.3727 4.07978 16.1852 3.98978C12.7202 2.23478 8.54272 2.90978 5.79772 5.65478C2.79022 8.66228 2.31772 13.3948 4.65022 16.9273L1.19272 16.2898C0.990221 16.2523 0.795221 16.3873 0.757721 16.5898C0.720221 16.7923 0.855221 16.9873 1.05772 17.0248L5.37022 17.8273C5.37022 17.8273 5.41522 17.8273 5.43772 17.8273C5.61772 17.8273 5.77522 17.6998 5.80522 17.5198L6.60772 13.2073C6.64522 13.0048 6.51022 12.8098 6.30772 12.7723L6.30022 12.7798Z' fill='black' /%3e %3cpath d='M15.0824 13.2223C14.9249 12.9373 14.7224 12.6973 14.4674 12.4948C14.2124 12.2998 13.9349 12.1348 13.6274 11.9998C13.3199 11.8648 13.0124 11.7598 12.7124 11.6773L12.3149 11.5648V7.87482C12.8324 7.91232 13.2749 8.06232 13.6349 8.33232C14.0549 8.64732 14.2874 9.07482 14.3399 9.60732H15.1874C15.1724 9.11982 15.0224 8.68482 14.7524 8.30232C14.4824 7.91982 14.1149 7.61982 13.6574 7.40232C13.2599 7.21482 12.8099 7.12482 12.3149 7.09482V6.31482C12.3149 6.14232 12.1799 6.00732 12.0074 6.00732C11.8349 6.00732 11.6999 6.14232 11.6999 6.31482V7.10982C11.2649 7.14732 10.8449 7.22982 10.4774 7.40232C10.0049 7.61982 9.62988 7.92732 9.35238 8.31732C9.07488 8.70732 8.93988 9.16482 8.93988 9.67482C8.93988 10.2898 9.14988 10.7998 9.56238 11.1898C9.97488 11.5798 10.5599 11.8948 11.3174 12.1198L11.6999 12.2323V16.1323C11.3849 16.1098 11.0849 16.0573 10.8224 15.9523C10.4699 15.8173 10.1849 15.6148 9.96738 15.3523C9.74988 15.0898 9.62238 14.7673 9.59238 14.3923V14.3323C9.59238 14.0848 9.38988 13.8823 9.14238 13.8823C8.89488 13.8823 8.69238 14.0848 8.69238 14.3323V14.3923C8.72988 14.8948 8.87988 15.3448 9.15738 15.7273C9.43488 16.1098 9.80988 16.4098 10.2899 16.6273C10.6949 16.8073 11.1749 16.8973 11.6999 16.9273V17.6848C11.6999 17.8573 11.8349 17.9923 12.0074 17.9923C12.1799 17.9923 12.3149 17.8573 12.3149 17.6848V16.9348C12.8699 16.9048 13.3574 16.7923 13.7774 16.5898C14.2724 16.3498 14.6549 16.0273 14.9174 15.6148C15.1799 15.2023 15.3149 14.7448 15.3149 14.2348C15.3149 13.8373 15.2399 13.4923 15.0824 13.2073V13.2223ZM11.0099 11.1448C10.7849 11.0473 10.5749 10.9348 10.3949 10.7923C10.2074 10.6573 10.0574 10.4923 9.95238 10.3048C9.84738 10.1173 9.78738 9.89232 9.78738 9.63732C9.78738 9.29232 9.88488 8.98482 10.0724 8.71482C10.2674 8.44482 10.5299 8.23482 10.8674 8.07732C11.1149 7.96482 11.3924 7.91232 11.6924 7.88232V11.3848C11.4599 11.3173 11.2349 11.2348 11.0024 11.1373L11.0099 11.1448ZM14.1449 15.2473C13.9274 15.5398 13.6349 15.7648 13.2674 15.9223C12.9824 16.0423 12.6599 16.1023 12.3149 16.1323V12.4198L12.4649 12.4648C12.8624 12.5773 13.2074 12.7123 13.5149 12.8623C13.8149 13.0123 14.0549 13.1998 14.2199 13.4173C14.3849 13.6348 14.4749 13.9123 14.4749 14.2348C14.4749 14.6173 14.3699 14.9548 14.1524 15.2473H14.1449Z' fill='black' /%3e %3cpath d='M14.7525 10.0796C14.985 10.0796 15.1725 9.89211 15.1725 9.65961V9.59961H14.3325V9.65961C14.3325 9.89211 14.52 10.0796 14.7525 10.0796Z' fill='black' /%3e%3c/svg%3e";
|
|
@@ -17735,9 +17735,9 @@ const AccountSettings = _a => {
|
|
|
17735
17735
|
}), jsxRuntime.jsx(ManageFunding, {
|
|
17736
17736
|
carrierId: carriers ? carriers[0].carrierId : "",
|
|
17737
17737
|
currency: currency
|
|
17738
|
-
}), jsxRuntime.jsx(PaymentMethodSettings, {}), jsxRuntime.jsx(WalletHistory, {}), jsxRuntime.jsx(Component$
|
|
17738
|
+
}), jsxRuntime.jsx(PaymentMethodSettings, {}), jsxRuntime.jsx(WalletHistory, {}), jsxRuntime.jsx(Component$8, {}), jsxRuntime.jsx(Component$9, {
|
|
17739
17739
|
features: features
|
|
17740
|
-
}), jsxRuntime.jsx(Component$
|
|
17740
|
+
}), jsxRuntime.jsx(Component$a, {
|
|
17741
17741
|
features: features
|
|
17742
17742
|
}), jsxRuntime.jsx(LabelLayout, {
|
|
17743
17743
|
display: "settings"
|
|
@@ -17773,7 +17773,7 @@ const AccountSettings = _a => {
|
|
|
17773
17773
|
*
|
|
17774
17774
|
* @see {@link AccountSettings.Element | The **Element** created to render `<AccountSettings />`}
|
|
17775
17775
|
*/
|
|
17776
|
-
const Component$
|
|
17776
|
+
const Component$7 = ({
|
|
17777
17777
|
features,
|
|
17778
17778
|
onSaveSettings
|
|
17779
17779
|
}) => {
|
|
@@ -17817,7 +17817,7 @@ const Component$5 = ({
|
|
|
17817
17817
|
* @see {@link PaymentMethodSettings | The `<PaymentMethodSettings />` component used to manage payment methods}
|
|
17818
17818
|
* @see {@link ManageFunding | The `<ManageFunding />` component used to manage funding rules and add funds to a carrier account}
|
|
17819
17819
|
*/
|
|
17820
|
-
const Element$
|
|
17820
|
+
const Element$8 = alchemy__default["default"].createElement(Component$7, ErrorFallback, {
|
|
17821
17821
|
css: {
|
|
17822
17822
|
height: "100%",
|
|
17823
17823
|
maxWidth: "800px",
|
|
@@ -17831,8 +17831,8 @@ const Element$6 = alchemy__default["default"].createElement(Component$5, ErrorFa
|
|
|
17831
17831
|
|
|
17832
17832
|
var accountSettings = /*#__PURE__*/Object.freeze({
|
|
17833
17833
|
__proto__: null,
|
|
17834
|
-
Component: Component$
|
|
17835
|
-
Element: Element$
|
|
17834
|
+
Component: Component$7,
|
|
17835
|
+
Element: Element$8
|
|
17836
17836
|
});
|
|
17837
17837
|
|
|
17838
17838
|
const SuspendSalesOrder = ({
|
|
@@ -22083,7 +22083,7 @@ const PurchaseLabelByShipment = _a => {
|
|
|
22083
22083
|
*
|
|
22084
22084
|
* @see {@link PurchaseLabel.Element | The **Element** created to render `<PurchaseLabel />`}
|
|
22085
22085
|
*/
|
|
22086
|
-
const Component$
|
|
22086
|
+
const Component$6 = _a => {
|
|
22087
22087
|
var _b, _c;
|
|
22088
22088
|
var {
|
|
22089
22089
|
features
|
|
@@ -22175,7 +22175,7 @@ const Component$4 = _a => {
|
|
|
22175
22175
|
*
|
|
22176
22176
|
* @see {@link ViewShipment.Element | The next step in the label purchase workflow `<ViewShipment.Element />`}
|
|
22177
22177
|
*/
|
|
22178
|
-
const Element$
|
|
22178
|
+
const Element$7 = alchemy__default["default"].createElement(Component$6, ErrorFallback, {
|
|
22179
22179
|
css: {
|
|
22180
22180
|
height: "100%",
|
|
22181
22181
|
maxWidth: "800px",
|
|
@@ -22189,8 +22189,8 @@ const Element$5 = alchemy__default["default"].createElement(Component$4, ErrorFa
|
|
|
22189
22189
|
|
|
22190
22190
|
var purchaseLabel = /*#__PURE__*/Object.freeze({
|
|
22191
22191
|
__proto__: null,
|
|
22192
|
-
Component: Component$
|
|
22193
|
-
Element: Element$
|
|
22192
|
+
Component: Component$6,
|
|
22193
|
+
Element: Element$7
|
|
22194
22194
|
});
|
|
22195
22195
|
|
|
22196
22196
|
const styles$8 = createStyles({
|
|
@@ -22552,338 +22552,642 @@ const Shipment = ({
|
|
|
22552
22552
|
});
|
|
22553
22553
|
};
|
|
22554
22554
|
|
|
22555
|
-
|
|
22556
|
-
|
|
22557
|
-
|
|
22558
|
-
|
|
22559
|
-
|
|
22560
|
-
|
|
22561
|
-
|
|
22562
|
-
* @param ComponentProps The base props that will be passed into the `<ViewShipment />` component.
|
|
22563
|
-
*
|
|
22564
|
-
* @returns Element An EmotionJSX.Element that will render the `<ViewShipment />` component
|
|
22565
|
-
* with all the appropriate wrappers.
|
|
22566
|
-
*
|
|
22567
|
-
* @example
|
|
22568
|
-
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
22569
|
-
* ```tsx
|
|
22570
|
-
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
22571
|
-
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
22572
|
-
* resources: { en },
|
|
22573
|
-
* });
|
|
22574
|
-
* ```
|
|
22575
|
-
*
|
|
22576
|
-
* <br />
|
|
22577
|
-
*
|
|
22578
|
-
* @see {@link ViewShipment.Element | The **Element** created to render `<ViewShipment />`}
|
|
22579
|
-
*/
|
|
22580
|
-
const Component$3 = ({
|
|
22581
|
-
features,
|
|
22582
|
-
onClickPrintLabel,
|
|
22583
|
-
onClickPurchaseLabel,
|
|
22584
|
-
onClickVoidLabel,
|
|
22585
|
-
shipmentId
|
|
22586
|
-
}) => {
|
|
22587
|
-
var _a, _b, _c;
|
|
22588
|
-
const {
|
|
22589
|
-
t
|
|
22590
|
-
} = reactI18next.useTranslation(["common", "view-shipment"]);
|
|
22591
|
-
const shipment = alchemy.useGetSalesOrderShipment(shipmentId);
|
|
22592
|
-
const {
|
|
22593
|
-
data: {
|
|
22594
|
-
labels = []
|
|
22595
|
-
} = {}
|
|
22596
|
-
} = alchemy.useListLabels({
|
|
22597
|
-
shipmentId
|
|
22598
|
-
});
|
|
22599
|
-
const salesOrder = alchemy.useGetSalesOrder((_b = (_a = shipment.data) === null || _a === void 0 ? void 0 : _a.salesOrderIds) === null || _b === void 0 ? void 0 : _b[0]);
|
|
22600
|
-
const warehouses = alchemy.useListWarehouses();
|
|
22601
|
-
const carriers = alchemy.useListCarriers();
|
|
22602
|
-
if (shipment.isInitialLoading) return jsxRuntime.jsx(Loader, {
|
|
22603
|
-
message: t("loading.shipment")
|
|
22604
|
-
});
|
|
22605
|
-
if (shipment.error) throw new Error(shipment.error.map(e => e.message).join(", "));
|
|
22606
|
-
if (!shipment.data) throw new Error("errorMessages.unableToLoad.shipment");
|
|
22607
|
-
const warehouse = (_c = warehouses.data) === null || _c === void 0 ? void 0 : _c.find(w => {
|
|
22608
|
-
var _a;
|
|
22609
|
-
return w.warehouseId === ((_a = shipment.data) === null || _a === void 0 ? void 0 : _a.warehouseId);
|
|
22610
|
-
});
|
|
22611
|
-
return jsxRuntime.jsx(Shipment, {
|
|
22612
|
-
carriers: carriers.data,
|
|
22613
|
-
features: features,
|
|
22614
|
-
labels: labels,
|
|
22615
|
-
onClickPrintLabel: onClickPrintLabel,
|
|
22616
|
-
onClickPurchaseLabel: onClickPurchaseLabel,
|
|
22617
|
-
onClickVoidLabel: onClickVoidLabel,
|
|
22618
|
-
salesOrder: salesOrder.data,
|
|
22619
|
-
shipment: shipment.data,
|
|
22620
|
-
warehouse: warehouse
|
|
22621
|
-
});
|
|
22622
|
-
};
|
|
22623
|
-
/**
|
|
22624
|
-
* # Registered View Shipment Element
|
|
22625
|
-
*
|
|
22626
|
-
* - This is the registered `<ViewShipment />` element that will be used to render the
|
|
22627
|
-
* `<ViewShipment.Element />` component.
|
|
22628
|
-
*
|
|
22629
|
-
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
22630
|
-
* the `<ViewShipment.Element />` component.
|
|
22631
|
-
*
|
|
22632
|
-
* @example
|
|
22633
|
-
* The `<Component />` is the source JSX that is rendered when you make use of the `ViewShipment`
|
|
22634
|
-
* Element directly. Here is a brief example of how you would use it within your application.
|
|
22635
|
-
* ```tsx
|
|
22636
|
-
* <ViewShipment.Element
|
|
22637
|
-
* onClickPurchaseLabel={({ salesOrderId }) => {
|
|
22638
|
-
* console.log('sales order ID', salesOrderId);
|
|
22639
|
-
* }}
|
|
22640
|
-
* onClickVoidLabel={({ labelId }) => {
|
|
22641
|
-
* console.log('voided label', labelId);
|
|
22642
|
-
* }}
|
|
22643
|
-
* shipmentId="se-1234567"
|
|
22644
|
-
* />
|
|
22645
|
-
* ```
|
|
22646
|
-
*
|
|
22647
|
-
* <br />
|
|
22648
|
-
*
|
|
22649
|
-
* @see {@link ViewShipment.ComponentProps | The **props** that can be passed into the `<ViewShipment.Element />` component}
|
|
22650
|
-
*
|
|
22651
|
-
* @see {@link VoidLabel.Element | The next step in the label purchase workflow `<VoidLabel.Element />`}
|
|
22652
|
-
**/
|
|
22653
|
-
const Element$4 = alchemy__default["default"].createElement(Component$3, ErrorFallback, {
|
|
22654
|
-
css: {
|
|
22655
|
-
height: "100%",
|
|
22656
|
-
maxWidth: "800px",
|
|
22657
|
-
minWidth: "440px",
|
|
22658
|
-
width: "100%"
|
|
22555
|
+
const styles$7 = createStyles({
|
|
22556
|
+
category: {
|
|
22557
|
+
alignItems: "center",
|
|
22558
|
+
cursor: "pointer",
|
|
22559
|
+
display: "flex",
|
|
22560
|
+
flexDirection: "row",
|
|
22561
|
+
justifyContent: "space-between"
|
|
22659
22562
|
},
|
|
22660
|
-
|
|
22661
|
-
|
|
22662
|
-
|
|
22663
|
-
|
|
22664
|
-
|
|
22665
|
-
|
|
22666
|
-
|
|
22667
|
-
|
|
22668
|
-
|
|
22563
|
+
colorPicker: theme => ({
|
|
22564
|
+
"&::-webkit-color-swatch": {
|
|
22565
|
+
border: `1px solid ${theme.palette.gray.light}`,
|
|
22566
|
+
borderRadius: "4px",
|
|
22567
|
+
padding: 0
|
|
22568
|
+
},
|
|
22569
|
+
"&::-webkit-color-swatch-wrapper": {
|
|
22570
|
+
padding: 0
|
|
22571
|
+
},
|
|
22572
|
+
alignSelf: "center",
|
|
22573
|
+
appearance: "none",
|
|
22574
|
+
background: "none",
|
|
22575
|
+
border: 0,
|
|
22576
|
+
cursor: "pointer",
|
|
22577
|
+
height: theme.spacing(4.25),
|
|
22578
|
+
outline: "none",
|
|
22579
|
+
width: theme.spacing(4.25)
|
|
22580
|
+
}),
|
|
22581
|
+
container: theme => ({
|
|
22582
|
+
marginBottom: theme.spacing(2)
|
|
22583
|
+
}),
|
|
22584
|
+
input: theme => ({
|
|
22585
|
+
border: `1px solid ${theme.palette.gray.light}`,
|
|
22586
|
+
borderRadius: "4px",
|
|
22587
|
+
color: theme.palette.gray.main,
|
|
22588
|
+
fontSize: "14px",
|
|
22589
|
+
padding: theme.spacing(1)
|
|
22590
|
+
}),
|
|
22591
|
+
inputContainer: theme => ({
|
|
22592
|
+
alignItems: "center",
|
|
22593
|
+
display: "flex",
|
|
22594
|
+
flexDirection: "row",
|
|
22595
|
+
justifyContent: "space-between",
|
|
22596
|
+
padding: `${theme.spacing(2)}px 0`
|
|
22597
|
+
}),
|
|
22598
|
+
wrapper: theme => ({
|
|
22599
|
+
display: "flex",
|
|
22600
|
+
gap: theme.spacing(1)
|
|
22601
|
+
})
|
|
22669
22602
|
});
|
|
22670
22603
|
|
|
22671
|
-
const
|
|
22672
|
-
|
|
22673
|
-
|
|
22674
|
-
|
|
22675
|
-
shipment,
|
|
22676
|
-
voidRequest
|
|
22604
|
+
const ColorPaletteEditor = ({
|
|
22605
|
+
paletteConfig,
|
|
22606
|
+
onUpdatePaletteConfig,
|
|
22607
|
+
formatKey
|
|
22677
22608
|
}) => {
|
|
22678
|
-
const
|
|
22679
|
-
|
|
22680
|
-
|
|
22681
|
-
|
|
22682
|
-
|
|
22683
|
-
|
|
22684
|
-
|
|
22685
|
-
|
|
22686
|
-
|
|
22687
|
-
|
|
22688
|
-
|
|
22689
|
-
|
|
22690
|
-
|
|
22691
|
-
|
|
22692
|
-
|
|
22693
|
-
|
|
22609
|
+
const [expandedCategories, setExpandedCategories] = React.useState(new Set());
|
|
22610
|
+
const toggleExpandedCategories = category => {
|
|
22611
|
+
setExpandedCategories(prev => {
|
|
22612
|
+
const openCategories = new Set(prev);
|
|
22613
|
+
if (openCategories.has(category)) {
|
|
22614
|
+
return new Set([...openCategories].filter(item => item !== category));
|
|
22615
|
+
} else {
|
|
22616
|
+
return new Set([...openCategories, category]);
|
|
22617
|
+
}
|
|
22618
|
+
});
|
|
22619
|
+
};
|
|
22620
|
+
const handleInputChange = React.useCallback((category, key, value) => {
|
|
22621
|
+
const updatedConfig = Object.assign(Object.assign({}, paletteConfig || {}), {
|
|
22622
|
+
[category]: Object.assign(Object.assign({}, (paletteConfig === null || paletteConfig === void 0 ? void 0 : paletteConfig[category]) || {}), {
|
|
22623
|
+
[key]: value
|
|
22624
|
+
})
|
|
22625
|
+
});
|
|
22626
|
+
onUpdatePaletteConfig(updatedConfig);
|
|
22627
|
+
}, [onUpdatePaletteConfig, paletteConfig]);
|
|
22628
|
+
return jsxRuntime.jsx("div", Object.assign({
|
|
22629
|
+
"data-test-id": "color-palette-editor"
|
|
22694
22630
|
}, {
|
|
22695
|
-
children:
|
|
22696
|
-
|
|
22697
|
-
|
|
22698
|
-
|
|
22699
|
-
|
|
22700
|
-
|
|
22701
|
-
|
|
22631
|
+
children: paletteConfig && Object.keys(paletteConfig).map(category => jsxRuntime.jsxs("div", Object.assign({
|
|
22632
|
+
css: styles$7.container,
|
|
22633
|
+
id: category
|
|
22634
|
+
}, {
|
|
22635
|
+
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
22636
|
+
"aria-expanded": expandedCategories.has(category),
|
|
22637
|
+
css: styles$7.category,
|
|
22638
|
+
onClick: event => {
|
|
22639
|
+
event.preventDefault();
|
|
22640
|
+
toggleExpandedCategories(category);
|
|
22641
|
+
},
|
|
22642
|
+
role: "button"
|
|
22702
22643
|
}, {
|
|
22703
|
-
children:
|
|
22704
|
-
|
|
22705
|
-
|
|
22706
|
-
|
|
22707
|
-
|
|
22644
|
+
children: [jsxRuntime.jsx("p", {
|
|
22645
|
+
children: capitalizeFirstLetter(category)
|
|
22646
|
+
}), jsxRuntime.jsx(giger.Icon, {
|
|
22647
|
+
name: expandedCategories.has(category) ? gigerTheme.IconNames.CHEVRON_TOP : gigerTheme.IconNames.CHEVRON_BOTTOM,
|
|
22648
|
+
size: giger.IconSize.SIZE_REGULAR
|
|
22649
|
+
})]
|
|
22650
|
+
})), expandedCategories.has(category) && Object.keys(paletteConfig[category]).map(key => jsxRuntime.jsxs("div", Object.assign({
|
|
22651
|
+
css: styles$7.inputContainer,
|
|
22652
|
+
id: "input-container"
|
|
22708
22653
|
}, {
|
|
22709
|
-
children:
|
|
22710
|
-
|
|
22711
|
-
|
|
22712
|
-
|
|
22713
|
-
|
|
22714
|
-
|
|
22715
|
-
|
|
22716
|
-
|
|
22717
|
-
|
|
22718
|
-
|
|
22719
|
-
|
|
22720
|
-
|
|
22654
|
+
children: [jsxRuntime.jsx("label", Object.assign({
|
|
22655
|
+
css: {
|
|
22656
|
+
fontWeight: "bold"
|
|
22657
|
+
},
|
|
22658
|
+
htmlFor: `${category}.${key}`
|
|
22659
|
+
}, {
|
|
22660
|
+
children: formatKey(key)
|
|
22661
|
+
})), jsxRuntime.jsxs("form", Object.assign({
|
|
22662
|
+
css: styles$7.wrapper
|
|
22663
|
+
}, {
|
|
22664
|
+
children: [jsxRuntime.jsx("input", {
|
|
22665
|
+
css: styles$7.input,
|
|
22666
|
+
onChange: e => {
|
|
22667
|
+
if (e.target.value.match(/^#[0-9A-Fa-f]{0,6}$/)) handleInputChange(category, key, e.target.value);
|
|
22668
|
+
},
|
|
22669
|
+
onKeyDown: e => {
|
|
22670
|
+
if (e.key === "Enter") e.preventDefault();
|
|
22671
|
+
},
|
|
22672
|
+
type: "text",
|
|
22673
|
+
value: paletteConfig[category][key]
|
|
22674
|
+
}), jsxRuntime.jsx("input", {
|
|
22675
|
+
css: styles$7.colorPicker,
|
|
22676
|
+
onChange: e => handleInputChange(category, key, e.target.value),
|
|
22677
|
+
type: "color",
|
|
22678
|
+
value: paletteConfig[category][key]
|
|
22679
|
+
})]
|
|
22680
|
+
}))]
|
|
22681
|
+
}), key))]
|
|
22682
|
+
}), category))
|
|
22721
22683
|
}));
|
|
22722
22684
|
};
|
|
22723
22685
|
|
|
22724
|
-
const
|
|
22725
|
-
|
|
22686
|
+
const styles$6 = createStyles({
|
|
22687
|
+
input: theme => ({
|
|
22688
|
+
border: `1px solid ${theme.palette.gray.light}`,
|
|
22689
|
+
borderRadius: "4px",
|
|
22690
|
+
color: theme.palette.gray.main,
|
|
22691
|
+
fontSize: "14px",
|
|
22692
|
+
maxWidth: theme.spacing(16),
|
|
22693
|
+
padding: 0
|
|
22694
|
+
}),
|
|
22695
|
+
keys: {
|
|
22696
|
+
fontSize: "16px",
|
|
22697
|
+
fontWeight: "bold",
|
|
22698
|
+
marginTop: "8px"
|
|
22699
|
+
},
|
|
22700
|
+
section: theme => ({
|
|
22701
|
+
"& > div:first-child": {
|
|
22702
|
+
flexGrow: 3
|
|
22703
|
+
},
|
|
22704
|
+
"& > div:last-child": {
|
|
22705
|
+
flexShrink: 1
|
|
22706
|
+
},
|
|
22707
|
+
display: "flex",
|
|
22708
|
+
gap: theme.spacing(1),
|
|
22709
|
+
justifyContent: "space-between"
|
|
22710
|
+
}),
|
|
22711
|
+
sectionContainer: theme => ({
|
|
22712
|
+
marginBottom: theme.spacing(4)
|
|
22713
|
+
}),
|
|
22714
|
+
select: theme => ({
|
|
22715
|
+
border: `1px solid ${theme.palette.gray.light}`,
|
|
22716
|
+
borderRadius: "4px",
|
|
22717
|
+
color: theme.palette.gray.main,
|
|
22718
|
+
fontSize: "14px"
|
|
22719
|
+
})
|
|
22720
|
+
});
|
|
22721
|
+
|
|
22722
|
+
const TypographyEditor = ({
|
|
22723
|
+
onUpdateTypographyConfig,
|
|
22724
|
+
typographyConfig,
|
|
22725
|
+
formatKey
|
|
22726
22726
|
}) => {
|
|
22727
|
-
const {
|
|
22728
|
-
|
|
22729
|
-
|
|
22730
|
-
|
|
22731
|
-
|
|
22732
|
-
|
|
22733
|
-
|
|
22734
|
-
|
|
22735
|
-
|
|
22727
|
+
const handleInputChange = React.useCallback((variant, key, value) => {
|
|
22728
|
+
const updatedConfig = Object.assign(Object.assign({}, typographyConfig || {}), {
|
|
22729
|
+
[variant]: Object.assign(Object.assign({}, (typographyConfig === null || typographyConfig === void 0 ? void 0 : typographyConfig[variant]) || {}), {
|
|
22730
|
+
[key]: value
|
|
22731
|
+
})
|
|
22732
|
+
});
|
|
22733
|
+
onUpdateTypographyConfig(updatedConfig);
|
|
22734
|
+
}, [onUpdateTypographyConfig, typographyConfig]);
|
|
22735
|
+
const getNestedValue = React.useCallback((obj, key) => {
|
|
22736
|
+
if (!obj) return undefined;
|
|
22737
|
+
return obj[key];
|
|
22738
|
+
}, []);
|
|
22739
|
+
const renderFontWeightSelect = (variant, key) => {
|
|
22740
|
+
var _a;
|
|
22741
|
+
const options = [{
|
|
22742
|
+
label: "Normal",
|
|
22743
|
+
value: "400"
|
|
22736
22744
|
}, {
|
|
22737
|
-
|
|
22738
|
-
|
|
22739
|
-
|
|
22740
|
-
|
|
22741
|
-
|
|
22742
|
-
|
|
22743
|
-
|
|
22744
|
-
|
|
22745
|
-
|
|
22746
|
-
|
|
22747
|
-
|
|
22748
|
-
|
|
22749
|
-
|
|
22750
|
-
|
|
22751
|
-
|
|
22752
|
-
|
|
22753
|
-
|
|
22754
|
-
}, {
|
|
22755
|
-
children: t("void-label:resultTitles.rejected")
|
|
22756
|
-
})), jsxRuntime.jsx(giger.Typography, {
|
|
22757
|
-
children: jsxRuntime.jsx("p", {
|
|
22758
|
-
dangerouslySetInnerHTML: {
|
|
22759
|
-
__html: t("void-label:resultMessages.rejected")
|
|
22760
|
-
}
|
|
22761
|
-
})
|
|
22762
|
-
})]
|
|
22763
|
-
})]
|
|
22764
|
-
})) : jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
22765
|
-
children: [jsxRuntime.jsx(giger.Typography, {
|
|
22766
|
-
children: t("void-label:refund_process")
|
|
22767
|
-
}), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
22768
|
-
component: "p"
|
|
22745
|
+
label: "Semi Bold",
|
|
22746
|
+
value: "600"
|
|
22747
|
+
}, {
|
|
22748
|
+
label: "Bold",
|
|
22749
|
+
value: "700"
|
|
22750
|
+
}];
|
|
22751
|
+
const fontWeightValue = (_a = getNestedValue(typographyConfig, variant)) === null || _a === void 0 ? void 0 : _a.fontWeight.toString();
|
|
22752
|
+
const selectOption = fontWeightValue !== undefined ? options.find(option => option.value === fontWeightValue) : undefined;
|
|
22753
|
+
return jsxRuntime.jsx(giger.Select, Object.assign({
|
|
22754
|
+
css: styles$6.select,
|
|
22755
|
+
label: "Font Weight",
|
|
22756
|
+
name: "font-weight",
|
|
22757
|
+
onChange: (_name, value) => handleInputChange(variant, key, value === null || value === void 0 ? void 0 : value.value),
|
|
22758
|
+
value: selectOption
|
|
22759
|
+
}, {
|
|
22760
|
+
children: options.map(option => jsxRuntime.jsx(giger.Option, Object.assign({
|
|
22761
|
+
value: option.value
|
|
22769
22762
|
}, {
|
|
22770
|
-
children:
|
|
22763
|
+
children: option.label
|
|
22764
|
+
}), option.value))
|
|
22765
|
+
}));
|
|
22766
|
+
};
|
|
22767
|
+
const renderFontSizeInput = (variant, key) => {
|
|
22768
|
+
var _a;
|
|
22769
|
+
const formattedFontSizeValue = (_a = getNestedValue(typographyConfig, variant)) === null || _a === void 0 ? void 0 : _a.fontSize.replace("px", "");
|
|
22770
|
+
return jsxRuntime.jsx(giger.Input, {
|
|
22771
|
+
"aria-labelledby": `${variant}.${key}`,
|
|
22772
|
+
css: styles$6.input,
|
|
22773
|
+
label: "Font Size(px)",
|
|
22774
|
+
onChange: e => {
|
|
22775
|
+
if (e.target.value.match(/^\d{0,2}$/)) handleInputChange(variant, key, `${e.target.value}px`);
|
|
22776
|
+
},
|
|
22777
|
+
value: formattedFontSizeValue
|
|
22778
|
+
});
|
|
22779
|
+
};
|
|
22780
|
+
const renderChildren = (variant, key) => {
|
|
22781
|
+
switch (key) {
|
|
22782
|
+
case "fontWeight":
|
|
22783
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
22784
|
+
children: renderFontWeightSelect(variant, key)
|
|
22785
|
+
});
|
|
22786
|
+
case "fontSize":
|
|
22787
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
22788
|
+
children: renderFontSizeInput(variant, key)
|
|
22789
|
+
});
|
|
22790
|
+
default:
|
|
22791
|
+
return null;
|
|
22792
|
+
}
|
|
22793
|
+
};
|
|
22794
|
+
return jsxRuntime.jsx("div", {
|
|
22795
|
+
children: typographyConfig && Object.keys(typographyConfig).map(variant => jsxRuntime.jsxs("div", Object.assign({
|
|
22796
|
+
css: styles$6.sectionContainer
|
|
22797
|
+
}, {
|
|
22798
|
+
children: [jsxRuntime.jsx("p", Object.assign({
|
|
22799
|
+
css: styles$6.keys,
|
|
22800
|
+
id: variant
|
|
22801
|
+
}, {
|
|
22802
|
+
children: formatKey(variant)
|
|
22803
|
+
})), jsxRuntime.jsx("section", Object.assign({
|
|
22804
|
+
css: styles$6.section
|
|
22805
|
+
}, {
|
|
22806
|
+
children: Object.keys(typographyConfig[variant]).map(key => jsxRuntime.jsx("div", Object.assign({
|
|
22807
|
+
id: `${variant}.${key}`
|
|
22808
|
+
}, {
|
|
22809
|
+
children: renderChildren(variant, key)
|
|
22810
|
+
}), key))
|
|
22771
22811
|
}))]
|
|
22772
|
-
})
|
|
22812
|
+
}), variant))
|
|
22773
22813
|
});
|
|
22774
22814
|
};
|
|
22775
22815
|
|
|
22776
|
-
|
|
22777
|
-
|
|
22778
|
-
|
|
22779
|
-
|
|
22780
|
-
|
|
22781
|
-
|
|
22782
|
-
|
|
22783
|
-
|
|
22784
|
-
|
|
22785
|
-
|
|
22786
|
-
|
|
22787
|
-
|
|
22788
|
-
|
|
22789
|
-
|
|
22790
|
-
|
|
22791
|
-
|
|
22792
|
-
|
|
22793
|
-
|
|
22794
|
-
|
|
22795
|
-
|
|
22796
|
-
|
|
22797
|
-
|
|
22798
|
-
|
|
22799
|
-
|
|
22800
|
-
|
|
22801
|
-
|
|
22802
|
-
|
|
22803
|
-
|
|
22804
|
-
|
|
22805
|
-
|
|
22806
|
-
|
|
22807
|
-
}
|
|
22808
|
-
|
|
22809
|
-
|
|
22810
|
-
|
|
22811
|
-
|
|
22812
|
-
|
|
22813
|
-
|
|
22814
|
-
|
|
22815
|
-
|
|
22816
|
-
|
|
22817
|
-
|
|
22818
|
-
|
|
22819
|
-
|
|
22820
|
-
|
|
22821
|
-
|
|
22822
|
-
|
|
22823
|
-
|
|
22824
|
-
|
|
22825
|
-
|
|
22826
|
-
|
|
22816
|
+
const styles$5 = createStyles({
|
|
22817
|
+
container: theme => ({
|
|
22818
|
+
color: theme.palette.gray.dark,
|
|
22819
|
+
display: "flex",
|
|
22820
|
+
flexDirection: "column",
|
|
22821
|
+
flexGrow: 1,
|
|
22822
|
+
overflow: "hidden",
|
|
22823
|
+
position: "relative"
|
|
22824
|
+
}),
|
|
22825
|
+
content: theme => ({
|
|
22826
|
+
display: "flex",
|
|
22827
|
+
flexDirection: "column",
|
|
22828
|
+
gap: theme.spacing(3),
|
|
22829
|
+
padding: theme.spacing(3)
|
|
22830
|
+
}),
|
|
22831
|
+
copy: theme => ({
|
|
22832
|
+
backgroundColor: theme.palette.white,
|
|
22833
|
+
borderRadius: "4px",
|
|
22834
|
+
padding: theme.spacing(0.5)
|
|
22835
|
+
}),
|
|
22836
|
+
drawerHeader: theme => ({
|
|
22837
|
+
alignItems: "center",
|
|
22838
|
+
display: "flex",
|
|
22839
|
+
gap: theme.spacing(2),
|
|
22840
|
+
justifyContent: "end",
|
|
22841
|
+
width: "50%"
|
|
22842
|
+
}),
|
|
22843
|
+
drawerWrapper: {
|
|
22844
|
+
display: "flex",
|
|
22845
|
+
justifyContent: "space-between",
|
|
22846
|
+
position: "relative"
|
|
22847
|
+
},
|
|
22848
|
+
header: {
|
|
22849
|
+
alignItems: "center",
|
|
22850
|
+
display: "flex",
|
|
22851
|
+
justifyContent: "space-between"
|
|
22852
|
+
},
|
|
22853
|
+
popoverWrapper: theme => ({
|
|
22854
|
+
display: "flex",
|
|
22855
|
+
flexDirection: "column",
|
|
22856
|
+
gap: theme.spacing(1)
|
|
22857
|
+
}),
|
|
22858
|
+
pre: theme => ({
|
|
22859
|
+
backgroundColor: "#FFFFFF66",
|
|
22860
|
+
borderRadius: "8px",
|
|
22861
|
+
fontSize: "14px",
|
|
22862
|
+
padding: theme.spacing(0.3)
|
|
22863
|
+
}),
|
|
22864
|
+
presetOption: theme => ({
|
|
22865
|
+
"&:hover": {
|
|
22866
|
+
backgroundColor: "theme.palette.gray.ultraLight"
|
|
22867
|
+
},
|
|
22868
|
+
backgroundColor: "transparent",
|
|
22869
|
+
borderRadius: "4px",
|
|
22870
|
+
fontSize: "14px",
|
|
22871
|
+
padding: theme.spacing(1)
|
|
22872
|
+
}),
|
|
22873
|
+
presetsButton: theme => ({
|
|
22874
|
+
"&:hover": {
|
|
22875
|
+
backgroundColor: "#d1d4d7"
|
|
22876
|
+
},
|
|
22877
|
+
backgroundColor: "#E4E5E7",
|
|
22878
|
+
borderRadius: "4px",
|
|
22879
|
+
cursor: "pointer",
|
|
22880
|
+
display: "flex",
|
|
22881
|
+
fontSize: "14px",
|
|
22882
|
+
gap: theme.spacing(0.5),
|
|
22883
|
+
padding: `${theme.spacing(0.5)}px ${theme.spacing(1)}px`
|
|
22884
|
+
})
|
|
22885
|
+
});
|
|
22886
|
+
|
|
22887
|
+
const ThemeCreator = ({
|
|
22888
|
+
themeConfig,
|
|
22889
|
+
onUpdateThemeConfig,
|
|
22890
|
+
presets,
|
|
22891
|
+
showDrawer
|
|
22892
|
+
}) => {
|
|
22893
|
+
const defaultThemeConfigRef = React.useRef(themeConfig);
|
|
22894
|
+
const [isDrawerOpen, setIsDrawerOpen] = React.useState(false);
|
|
22895
|
+
const globalKeys = Object.keys(themeConfig);
|
|
22896
|
+
// If the themeConfig has a "components" key, show only the child component keys, not "components" itself
|
|
22897
|
+
const tabs = globalKeys.flatMap(key => {
|
|
22898
|
+
if (key === "components" && themeConfig[key] && typeof themeConfig[key] === "object") {
|
|
22899
|
+
const childComponentKeys = Object.keys(themeConfig[key]);
|
|
22900
|
+
return childComponentKeys;
|
|
22901
|
+
} else {
|
|
22902
|
+
return [key];
|
|
22903
|
+
}
|
|
22827
22904
|
});
|
|
22828
|
-
|
|
22829
|
-
|
|
22830
|
-
|
|
22831
|
-
if (!shipment.data) throw new Error("errorMessages.unableToLoad.shipment");
|
|
22832
|
-
const handleVoidLabelSubmit = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
22833
|
-
const result = yield voidLabel.mutateAsync(labelId);
|
|
22834
|
-
if (result.approved) {
|
|
22835
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(label.data, shipment.data);
|
|
22905
|
+
const formattedThemeTabs = tabs.map(tab => {
|
|
22906
|
+
if (tab === "palette") {
|
|
22907
|
+
return "Color Palette";
|
|
22836
22908
|
}
|
|
22909
|
+
return capitalizeFirstLetter(tab);
|
|
22837
22910
|
});
|
|
22838
|
-
|
|
22839
|
-
|
|
22840
|
-
|
|
22841
|
-
|
|
22842
|
-
|
|
22843
|
-
|
|
22844
|
-
|
|
22845
|
-
|
|
22846
|
-
|
|
22847
|
-
|
|
22848
|
-
|
|
22849
|
-
|
|
22911
|
+
const [selectedTab, setSelectedTab] = React.useState(formattedThemeTabs.sort()[0]);
|
|
22912
|
+
const handleSelectedTab = tab => {
|
|
22913
|
+
setSelectedTab(tab);
|
|
22914
|
+
};
|
|
22915
|
+
const formatKey = key => addSpaceBetweenWords(pascalize(key));
|
|
22916
|
+
const renderContentBySelectedTab = (themeConfig, selectedTab) => {
|
|
22917
|
+
var _a;
|
|
22918
|
+
switch (selectedTab) {
|
|
22919
|
+
case "Color Palette":
|
|
22920
|
+
return jsxRuntime.jsx(ColorPaletteEditor, {
|
|
22921
|
+
formatKey: formatKey,
|
|
22922
|
+
onUpdatePaletteConfig: updatedPalette => {
|
|
22923
|
+
onUpdateThemeConfig(Object.assign(Object.assign({}, themeConfig), {
|
|
22924
|
+
palette: updatedPalette
|
|
22925
|
+
}));
|
|
22926
|
+
},
|
|
22927
|
+
paletteConfig: themeConfig.palette
|
|
22928
|
+
});
|
|
22929
|
+
case "Typography":
|
|
22930
|
+
return jsxRuntime.jsx(TypographyEditor, {
|
|
22931
|
+
formatKey: formatKey,
|
|
22932
|
+
onUpdateTypographyConfig: updatedTypography => {
|
|
22933
|
+
onUpdateThemeConfig(Object.assign(Object.assign({}, themeConfig), {
|
|
22934
|
+
components: Object.assign(Object.assign({}, themeConfig.components), {
|
|
22935
|
+
Typography: updatedTypography
|
|
22936
|
+
})
|
|
22937
|
+
}));
|
|
22938
|
+
},
|
|
22939
|
+
typographyConfig: (_a = themeConfig.components) === null || _a === void 0 ? void 0 : _a.Typography
|
|
22940
|
+
});
|
|
22941
|
+
default:
|
|
22942
|
+
return null;
|
|
22943
|
+
}
|
|
22944
|
+
};
|
|
22945
|
+
// const formattedThemeObj = `const theme = ${JSON.stringify(themeConfig, null, 2)}`;
|
|
22946
|
+
const presetsRef = React.useRef(null);
|
|
22947
|
+
const [showPresets, toggleShowPresets] = useToggle(false);
|
|
22948
|
+
const applyPreset = theme => {
|
|
22949
|
+
onUpdateThemeConfig(theme);
|
|
22950
|
+
};
|
|
22951
|
+
return jsxRuntime.jsxs("div", Object.assign({
|
|
22952
|
+
"aria-label": "Theme Creator",
|
|
22953
|
+
css: styles$5.container,
|
|
22954
|
+
"data-testid": "theme-creator",
|
|
22955
|
+
role: "region"
|
|
22956
|
+
}, {
|
|
22957
|
+
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
22958
|
+
css: styles$5.content
|
|
22959
|
+
}, {
|
|
22960
|
+
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
22961
|
+
css: styles$5.header
|
|
22962
|
+
}, {
|
|
22963
|
+
children: [jsxRuntime.jsx(Tabs, {
|
|
22964
|
+
onSelectTab: handleSelectedTab,
|
|
22965
|
+
selectedTab: selectedTab,
|
|
22966
|
+
tabs: formattedThemeTabs
|
|
22967
|
+
}), presets ? jsxRuntime.jsxs("div", {
|
|
22968
|
+
children: [jsxRuntime.jsxs("button", Object.assign({
|
|
22969
|
+
"aria-controls": "presets-popover",
|
|
22970
|
+
"aria-expanded": showPresets,
|
|
22971
|
+
css: styles$5.presetsButton,
|
|
22972
|
+
onClick: e => {
|
|
22973
|
+
e.preventDefault();
|
|
22974
|
+
toggleShowPresets();
|
|
22975
|
+
},
|
|
22976
|
+
ref: presetsRef
|
|
22977
|
+
}, {
|
|
22978
|
+
children: ["Presets", jsxRuntime.jsx(giger.Icon, {
|
|
22979
|
+
name: gigerTheme.IconNames.CARET_BOTTOM,
|
|
22980
|
+
size: giger.IconSize.SIZE_SMALL
|
|
22981
|
+
})]
|
|
22982
|
+
})), jsxRuntime.jsx(giger.Popover, Object.assign({
|
|
22983
|
+
container: document.querySelector("#theme-creator"),
|
|
22984
|
+
isOpen: showPresets,
|
|
22985
|
+
onClickAway: () => toggleShowPresets(),
|
|
22986
|
+
placement: "bottom-end",
|
|
22987
|
+
reference: presetsRef.current
|
|
22988
|
+
}, {
|
|
22989
|
+
children: jsxRuntime.jsxs("div", Object.assign({
|
|
22990
|
+
css: styles$5.popoverWrapper
|
|
22991
|
+
}, {
|
|
22992
|
+
children: [jsxRuntime.jsx("button", Object.assign({
|
|
22993
|
+
"aria-label": "Set Default Theme",
|
|
22994
|
+
css: styles$5.presetOption,
|
|
22995
|
+
onClick: e => {
|
|
22996
|
+
e.preventDefault();
|
|
22997
|
+
toggleShowPresets();
|
|
22998
|
+
applyPreset(defaultThemeConfigRef.current);
|
|
22999
|
+
},
|
|
23000
|
+
role: "menuitem"
|
|
23001
|
+
}, {
|
|
23002
|
+
children: "Default"
|
|
23003
|
+
})), presets.map(preset => jsxRuntime.jsx("button", Object.assign({
|
|
23004
|
+
"aria-label": `Set ${preset.presetName} Theme`,
|
|
23005
|
+
css: styles$5.presetOption,
|
|
23006
|
+
onClick: e => {
|
|
23007
|
+
e.preventDefault();
|
|
23008
|
+
toggleShowPresets();
|
|
23009
|
+
applyPreset(preset.themeConfig);
|
|
23010
|
+
},
|
|
23011
|
+
role: "menuitem"
|
|
23012
|
+
}, {
|
|
23013
|
+
children: preset.presetName
|
|
23014
|
+
}), preset.presetName))]
|
|
23015
|
+
}))
|
|
23016
|
+
}))]
|
|
23017
|
+
}) :
|
|
23018
|
+
//reset to default button
|
|
23019
|
+
jsxRuntime.jsx("button", Object.assign({
|
|
23020
|
+
"aria-label": "Set Default Theme",
|
|
23021
|
+
css: styles$5.presetsButton,
|
|
23022
|
+
onClick: () => {
|
|
23023
|
+
applyPreset(defaultThemeConfigRef.current);
|
|
23024
|
+
},
|
|
23025
|
+
role: "menuitem"
|
|
23026
|
+
}, {
|
|
23027
|
+
children: "Reset to Default"
|
|
23028
|
+
}))]
|
|
23029
|
+
})), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23030
|
+
role: "heading",
|
|
23031
|
+
variant: "heading4"
|
|
23032
|
+
}, {
|
|
23033
|
+
children: `${selectedTab} Editor`
|
|
23034
|
+
})), renderContentBySelectedTab(themeConfig, selectedTab)]
|
|
23035
|
+
})), showDrawer && jsxRuntime.jsx(Drawer, Object.assign({
|
|
23036
|
+
"aria-label": "Show themeConfig.js Code Drawer",
|
|
23037
|
+
headerContent: jsxRuntime.jsxs("div", Object.assign({
|
|
23038
|
+
css: styles$5.drawerHeader
|
|
23039
|
+
}, {
|
|
23040
|
+
children: [jsxRuntime.jsx("pre", Object.assign({
|
|
23041
|
+
css: styles$5.pre
|
|
23042
|
+
}, {
|
|
23043
|
+
children: "themeConfig.js"
|
|
23044
|
+
})), showDrawer.copyToClipboardText && jsxRuntime.jsx("div", Object.assign({
|
|
23045
|
+
css: styles$5.copy
|
|
23046
|
+
}, {
|
|
23047
|
+
children: jsxRuntime.jsx(CopyButton, {
|
|
23048
|
+
content: showDrawer.copyToClipboardText
|
|
23049
|
+
})
|
|
23050
|
+
}))]
|
|
23051
|
+
})),
|
|
23052
|
+
isOpen: isDrawerOpen,
|
|
23053
|
+
toggleDrawer: () => setIsDrawerOpen(!isDrawerOpen)
|
|
23054
|
+
}, {
|
|
23055
|
+
children: showDrawer.content
|
|
23056
|
+
}))]
|
|
23057
|
+
}));
|
|
23058
|
+
};
|
|
23059
|
+
|
|
23060
|
+
const Component$5 = ({
|
|
23061
|
+
onRowClick
|
|
23062
|
+
}) => {
|
|
23063
|
+
const {
|
|
23064
|
+
t
|
|
23065
|
+
} = reactI18next.useTranslation(["common", "list-labels"]);
|
|
23066
|
+
const {
|
|
23067
|
+
page,
|
|
23068
|
+
pageSize,
|
|
23069
|
+
pagerProps
|
|
23070
|
+
} = usePager();
|
|
23071
|
+
const {
|
|
23072
|
+
data: carriersData,
|
|
23073
|
+
isLoading: carriersLoading
|
|
23074
|
+
} = alchemy.useListCarriers();
|
|
23075
|
+
const {
|
|
23076
|
+
data: labelsData,
|
|
23077
|
+
isLoading,
|
|
23078
|
+
isError,
|
|
23079
|
+
error
|
|
23080
|
+
} = alchemy.useListLabels({
|
|
23081
|
+
page,
|
|
23082
|
+
pageSize
|
|
23083
|
+
});
|
|
23084
|
+
const shipmentIds = (labelsData === null || labelsData === void 0 ? void 0 : labelsData.labels) ? labelsData.labels.filter(l => l.shipmentId).map(l => l.shipmentId) : [];
|
|
23085
|
+
const {
|
|
23086
|
+
data: shipmentsData,
|
|
23087
|
+
isLoading: shipmentsLoading
|
|
23088
|
+
} = alchemy.useListSalesOrderShipments({
|
|
23089
|
+
shipmentIds
|
|
23090
|
+
});
|
|
23091
|
+
if (isLoading) return jsxRuntime.jsx(Loader, {
|
|
23092
|
+
message: t("loading.labels")
|
|
23093
|
+
});
|
|
23094
|
+
if (isError) throw new Error(error.map(e => e.message).join(", "));
|
|
23095
|
+
if (!labelsData) throw new Error(t("errorMessages.unableToLoad.labels"));
|
|
23096
|
+
const columns = [{
|
|
23097
|
+
headerContent: t("list-labels:headers.labelId"),
|
|
23098
|
+
renderCellContent: data => {
|
|
23099
|
+
return jsxRuntime.jsx("div", {
|
|
23100
|
+
children: data.labelId
|
|
23101
|
+
});
|
|
23102
|
+
}
|
|
23103
|
+
}, {
|
|
23104
|
+
headerContent: t("list-labels:headers.created"),
|
|
23105
|
+
renderCellContent: data => {
|
|
23106
|
+
return (data === null || data === void 0 ? void 0 : data.shipDate) && jsxRuntime.jsx(CellFormattedDate, {
|
|
23107
|
+
date: data.shipDate
|
|
23108
|
+
});
|
|
23109
|
+
}
|
|
23110
|
+
}, {
|
|
23111
|
+
headerContent: t("list-labels:headers.shipTo"),
|
|
23112
|
+
renderCellContent: data => {
|
|
23113
|
+
const labelShipment = shipmentsData === null || shipmentsData === void 0 ? void 0 : shipmentsData.find(s => s.shipmentId === data.shipmentId);
|
|
23114
|
+
const displayAddress = labelShipment && labelShipment.shipTo.addressLine1 ? jsxRuntime.jsx(AddressDisplay, {
|
|
23115
|
+
address: labelShipment.shipTo
|
|
23116
|
+
}) : "--";
|
|
23117
|
+
return jsxRuntime.jsx(SuspendText, Object.assign({
|
|
23118
|
+
loading: shipmentsLoading
|
|
23119
|
+
}, {
|
|
23120
|
+
children: displayAddress
|
|
23121
|
+
}));
|
|
23122
|
+
}
|
|
23123
|
+
}, {
|
|
23124
|
+
headerContent: t("list-labels:headers.service"),
|
|
23125
|
+
renderCellContent: data => {
|
|
23126
|
+
if (!carriersLoading && carriersData) {
|
|
23127
|
+
const carrier = carriersData.find(c => c.carrierCode === data.carrierCode);
|
|
23128
|
+
if (carrier) {
|
|
23129
|
+
const service = carrier.services.find(s => s.serviceCode === data.serviceCode);
|
|
23130
|
+
if (service) {
|
|
23131
|
+
return jsxRuntime.jsxs("div", {
|
|
23132
|
+
children: [jsxRuntime.jsx(CarrierIcon, {
|
|
23133
|
+
carrierCode: data.carrierCode
|
|
23134
|
+
}, data.carrierCode), "\u00A0 ", service.name]
|
|
23135
|
+
});
|
|
23136
|
+
}
|
|
23137
|
+
}
|
|
23138
|
+
}
|
|
23139
|
+
return jsxRuntime.jsxs(SuspendText, Object.assign({
|
|
23140
|
+
loading: carriersLoading
|
|
23141
|
+
}, {
|
|
23142
|
+
children: ["`$", data.carrierCode, " - $", data.serviceCode, "`"]
|
|
23143
|
+
}));
|
|
23144
|
+
}
|
|
23145
|
+
}, {
|
|
23146
|
+
// Download
|
|
23147
|
+
headerContent: jsxRuntime.jsx("div", {
|
|
23148
|
+
"aria-label": t("list-labels:headers.download")
|
|
23149
|
+
}),
|
|
23150
|
+
renderCellContent: data => {
|
|
23151
|
+
if (data.status === "completed") return jsxRuntime.jsx("div", Object.assign({
|
|
23152
|
+
css: {
|
|
23153
|
+
textAlign: "right"
|
|
23154
|
+
}
|
|
23155
|
+
}, {
|
|
23156
|
+
children: jsxRuntime.jsx(giger.ButtonIcon, {
|
|
23157
|
+
ariaDescribedby: "",
|
|
23158
|
+
children: t("list-labels:actions.download.pdf"),
|
|
23159
|
+
icon: gigerTheme.IconNames.DOWNLOAD,
|
|
23160
|
+
onClick: e => {
|
|
23161
|
+
e.stopPropagation();
|
|
23162
|
+
window.open(data.labelDownload.pdf);
|
|
23163
|
+
}
|
|
23164
|
+
})
|
|
23165
|
+
}));
|
|
23166
|
+
return jsxRuntime.jsx("div", Object.assign({
|
|
23167
|
+
css: {
|
|
23168
|
+
textAlign: "right"
|
|
23169
|
+
}
|
|
23170
|
+
}, {
|
|
23171
|
+
children: jsxRuntime.jsx(giger.Tag, Object.assign({
|
|
23172
|
+
color: giger.TagColor.INFO
|
|
23173
|
+
}, {
|
|
23174
|
+
children: data.status.toLocaleUpperCase()
|
|
23175
|
+
}))
|
|
23176
|
+
}));
|
|
23177
|
+
}
|
|
23178
|
+
}];
|
|
23179
|
+
return jsxRuntime.jsx(GridController, {
|
|
23180
|
+
columns: columns,
|
|
23181
|
+
data: labelsData.labels,
|
|
23182
|
+
footerContent: jsxRuntime.jsx(Pager, Object.assign({}, pagerProps, {
|
|
23183
|
+
pagingData: labelsData
|
|
23184
|
+
})),
|
|
23185
|
+
onRowClick: onRowClick
|
|
22850
23186
|
});
|
|
22851
23187
|
};
|
|
22852
|
-
|
|
22853
|
-
* # Registered Void Label Element
|
|
22854
|
-
*
|
|
22855
|
-
* - This is the registered `<VoidLabel />` element that will be used to render the
|
|
22856
|
-
* `<VoidLabel.Element />` component.
|
|
22857
|
-
*
|
|
22858
|
-
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
22859
|
-
* the `<VoidLabel.Element />` component.
|
|
22860
|
-
*
|
|
22861
|
-
* @example
|
|
22862
|
-
* The `<Component />` is the source JSX that is rendered when you make use of the `VoidLabel`
|
|
22863
|
-
* Element directly. Here is a brief example of how you would use it within your application.
|
|
22864
|
-
* ```tsx
|
|
22865
|
-
* <VoidLabel.Element
|
|
22866
|
-
* labelId="se-1234567"
|
|
22867
|
-
* onComplete={() => console.log('onComplete')}
|
|
22868
|
-
* onSuccess={(_, { salesOrderIds: [salesOrderId] }) =>
|
|
22869
|
-
* console.log('sales order ID', salesOrderId)
|
|
22870
|
-
* }
|
|
22871
|
-
* onViewShipment={({ shipmentId }) => {
|
|
22872
|
-
* console.log('onViewShipment', shipmentId);
|
|
22873
|
-
* }}
|
|
22874
|
-
* />
|
|
22875
|
-
* ```
|
|
22876
|
-
*
|
|
22877
|
-
* <br />
|
|
22878
|
-
*
|
|
22879
|
-
* @see {@link VoidLabel.ComponentProps | The **props** that can be passed into the `<VoidLabel.Element />` component}
|
|
22880
|
-
*
|
|
22881
|
-
* @see {@link PurchaseLabel.Element | Go back to the frst step in the label purchase workflow `<PurchaseLabel.Element />`}
|
|
22882
|
-
*/
|
|
22883
|
-
const Element$3 = alchemy__default["default"].createElement(Component$2, ErrorFallback, {
|
|
23188
|
+
const Element$6 = alchemy__default["default"].createElement(Component$5, ErrorFallback, {
|
|
22884
23189
|
css: {
|
|
22885
23190
|
height: "100%",
|
|
22886
|
-
maxWidth: "800px",
|
|
22887
23191
|
minWidth: "440px",
|
|
22888
23192
|
width: "100%"
|
|
22889
23193
|
},
|
|
@@ -22892,686 +23196,600 @@ const Element$3 = alchemy__default["default"].createElement(Component$2, ErrorFa
|
|
|
22892
23196
|
}
|
|
22893
23197
|
});
|
|
22894
23198
|
|
|
22895
|
-
var
|
|
23199
|
+
var labelsGrid = /*#__PURE__*/Object.freeze({
|
|
22896
23200
|
__proto__: null,
|
|
22897
|
-
|
|
22898
|
-
Element: Element$3
|
|
23201
|
+
Element: Element$6
|
|
22899
23202
|
});
|
|
22900
23203
|
|
|
22901
23204
|
/**
|
|
22902
|
-
*
|
|
23205
|
+
* # View Shipment Component
|
|
22903
23206
|
*
|
|
22904
|
-
*
|
|
23207
|
+
* - The `<ViewShipment />` component is used to for viewing the shipment's tracking number, printing the label that
|
|
23208
|
+
* was created, and the option to void the label. When a label is voided, you can see a list of the
|
|
23209
|
+
* previously voided labels for a given shipment using this component.
|
|
23210
|
+
*
|
|
23211
|
+
* @param ComponentProps The base props that will be passed into the `<ViewShipment />` component.
|
|
23212
|
+
*
|
|
23213
|
+
* @returns Element An EmotionJSX.Element that will render the `<ViewShipment />` component
|
|
23214
|
+
* with all the appropriate wrappers.
|
|
22905
23215
|
*
|
|
22906
23216
|
* @example
|
|
23217
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
22907
23218
|
* ```tsx
|
|
22908
|
-
*
|
|
22909
|
-
*
|
|
22910
|
-
*
|
|
22911
|
-
*
|
|
22912
|
-
* shipmentId,
|
|
22913
|
-
* setLabelId,
|
|
22914
|
-
* setShipmentId,
|
|
22915
|
-
* setIsVoidingLabel,
|
|
22916
|
-
* } = useLabelWorkflow({
|
|
22917
|
-
* _labelId,
|
|
22918
|
-
* _multiplexedId,
|
|
22919
|
-
* });
|
|
23219
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
23220
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
23221
|
+
* resources: { en },
|
|
23222
|
+
* });
|
|
22920
23223
|
* ```
|
|
22921
23224
|
*
|
|
22922
23225
|
* <br />
|
|
22923
23226
|
*
|
|
22924
|
-
* @see {@link
|
|
23227
|
+
* @see {@link ViewShipment.Element | The **Element** created to render `<ViewShipment />`}
|
|
22925
23228
|
*/
|
|
22926
|
-
const
|
|
22927
|
-
|
|
22928
|
-
|
|
23229
|
+
const Component$4 = ({
|
|
23230
|
+
features,
|
|
23231
|
+
onClickPrintLabel,
|
|
23232
|
+
onClickPurchaseLabel,
|
|
23233
|
+
onClickVoidLabel,
|
|
23234
|
+
shipmentId
|
|
22929
23235
|
}) => {
|
|
22930
|
-
|
|
22931
|
-
const
|
|
22932
|
-
|
|
22933
|
-
|
|
22934
|
-
const
|
|
22935
|
-
const
|
|
22936
|
-
|
|
22937
|
-
|
|
22938
|
-
|
|
22939
|
-
|
|
22940
|
-
isVoidingLabel,
|
|
22941
|
-
labelId,
|
|
22942
|
-
multiplexedId,
|
|
22943
|
-
setIsVoidingLabel,
|
|
22944
|
-
setLabelId,
|
|
22945
|
-
setMultiplexedId,
|
|
22946
|
-
setShipmentId,
|
|
23236
|
+
var _a, _b, _c;
|
|
23237
|
+
const {
|
|
23238
|
+
t
|
|
23239
|
+
} = reactI18next.useTranslation(["common", "view-shipment"]);
|
|
23240
|
+
const shipment = alchemy.useGetSalesOrderShipment(shipmentId);
|
|
23241
|
+
const {
|
|
23242
|
+
data: {
|
|
23243
|
+
labels = []
|
|
23244
|
+
} = {}
|
|
23245
|
+
} = alchemy.useListLabels({
|
|
22947
23246
|
shipmentId
|
|
22948
|
-
};
|
|
23247
|
+
});
|
|
23248
|
+
const salesOrder = alchemy.useGetSalesOrder((_b = (_a = shipment.data) === null || _a === void 0 ? void 0 : _a.salesOrderIds) === null || _b === void 0 ? void 0 : _b[0]);
|
|
23249
|
+
const warehouses = alchemy.useListWarehouses();
|
|
23250
|
+
const carriers = alchemy.useListCarriers();
|
|
23251
|
+
if (shipment.isInitialLoading) return jsxRuntime.jsx(Loader, {
|
|
23252
|
+
message: t("loading.shipment")
|
|
23253
|
+
});
|
|
23254
|
+
if (shipment.error) throw new Error(shipment.error.map(e => e.message).join(", "));
|
|
23255
|
+
if (!shipment.data) throw new Error("errorMessages.unableToLoad.shipment");
|
|
23256
|
+
const warehouse = (_c = warehouses.data) === null || _c === void 0 ? void 0 : _c.find(w => {
|
|
23257
|
+
var _a;
|
|
23258
|
+
return w.warehouseId === ((_a = shipment.data) === null || _a === void 0 ? void 0 : _a.warehouseId);
|
|
23259
|
+
});
|
|
23260
|
+
return jsxRuntime.jsx(Shipment, {
|
|
23261
|
+
carriers: carriers.data,
|
|
23262
|
+
features: features,
|
|
23263
|
+
labels: labels,
|
|
23264
|
+
onClickPrintLabel: onClickPrintLabel,
|
|
23265
|
+
onClickPurchaseLabel: onClickPurchaseLabel,
|
|
23266
|
+
onClickVoidLabel: onClickVoidLabel,
|
|
23267
|
+
salesOrder: salesOrder.data,
|
|
23268
|
+
shipment: shipment.data,
|
|
23269
|
+
warehouse: warehouse
|
|
23270
|
+
});
|
|
22949
23271
|
};
|
|
22950
23272
|
/**
|
|
22951
|
-
*
|
|
22952
|
-
*
|
|
22953
|
-
* # Label Workflow Element
|
|
22954
|
-
*
|
|
22955
|
-
* - The `<LabelWorkflow.Element />` component is a composition of the PurchaseLabel, ViewShipment,
|
|
22956
|
-
* and VoidLabel elements that allows users to purchase a label, view the shipment details, and optionally void their shipping label.
|
|
23273
|
+
* # Registered View Shipment Element
|
|
22957
23274
|
*
|
|
22958
|
-
*
|
|
22959
|
-
*
|
|
23275
|
+
* - This is the registered `<ViewShipment />` element that will be used to render the
|
|
23276
|
+
* `<ViewShipment.Element />` component.
|
|
22960
23277
|
*
|
|
22961
|
-
* @
|
|
23278
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
23279
|
+
* the `<ViewShipment.Element />` component.
|
|
22962
23280
|
*
|
|
22963
23281
|
* @example
|
|
23282
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `ViewShipment`
|
|
23283
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
22964
23284
|
* ```tsx
|
|
22965
|
-
* <
|
|
22966
|
-
*
|
|
22967
|
-
*
|
|
22968
|
-
*
|
|
23285
|
+
* <ViewShipment.Element
|
|
23286
|
+
* onClickPurchaseLabel={({ salesOrderId }) => {
|
|
23287
|
+
* console.log('sales order ID', salesOrderId);
|
|
23288
|
+
* }}
|
|
23289
|
+
* onClickVoidLabel={({ labelId }) => {
|
|
23290
|
+
* console.log('voided label', labelId);
|
|
23291
|
+
* }}
|
|
23292
|
+
* shipmentId="se-1234567"
|
|
22969
23293
|
* />
|
|
22970
23294
|
* ```
|
|
22971
23295
|
*
|
|
22972
23296
|
* <br />
|
|
22973
23297
|
*
|
|
22974
|
-
* @see {@link
|
|
22975
|
-
*
|
|
22976
|
-
|
|
22977
|
-
|
|
22978
|
-
|
|
22979
|
-
|
|
22980
|
-
|
|
22981
|
-
|
|
22982
|
-
|
|
22983
|
-
|
|
22984
|
-
|
|
22985
|
-
|
|
22986
|
-
|
|
22987
|
-
|
|
22988
|
-
labelId,
|
|
22989
|
-
multiplexedId,
|
|
22990
|
-
isVoidingLabel,
|
|
22991
|
-
shipmentId,
|
|
22992
|
-
setLabelId,
|
|
22993
|
-
setShipmentId,
|
|
22994
|
-
setIsVoidingLabel
|
|
22995
|
-
} = useLabelWorkflow({
|
|
22996
|
-
_labelId,
|
|
22997
|
-
_multiplexedId
|
|
22998
|
-
});
|
|
22999
|
-
const _features = useFeatures("Globals");
|
|
23000
|
-
const features = React.useMemo(() => {
|
|
23001
|
-
var _a;
|
|
23002
|
-
return Object.assign(Object.assign(Object.assign({}, propFeatures), _features), {
|
|
23003
|
-
global: Object.assign(Object.assign({}, _features.global), {
|
|
23004
|
-
presentation: Object.assign(Object.assign({}, (_a = _features.global) === null || _a === void 0 ? void 0 : _a.presentation), {
|
|
23005
|
-
poweredByShipEngine: true
|
|
23006
|
-
})
|
|
23007
|
-
})
|
|
23008
|
-
});
|
|
23009
|
-
}, []);
|
|
23010
|
-
return !labelId ? jsxRuntime.jsx(Element$5, Object.assign({}, multiplexedId, {
|
|
23011
|
-
features: features,
|
|
23012
|
-
onLabelCreateSuccess: (label, shipment) => {
|
|
23013
|
-
var _a;
|
|
23014
|
-
setLabelId(label.labelId);
|
|
23015
|
-
setShipmentId(shipment.shipmentId);
|
|
23016
|
-
(_a = callbacks === null || callbacks === void 0 ? void 0 : callbacks.onLabelCreateSuccess) === null || _a === void 0 ? void 0 : _a.call(callbacks, label, shipment);
|
|
23017
|
-
},
|
|
23018
|
-
onLoad: (salesOrder, shipments, pendingShipment) => {
|
|
23019
|
-
if (shipments.length > 0) {
|
|
23020
|
-
setShipmentId(prior => prior !== undefined ? prior : shipments[0].shipmentId);
|
|
23021
|
-
}
|
|
23022
|
-
}
|
|
23023
|
-
})) : !isVoidingLabel ? jsxRuntime.jsx(Element$4, {
|
|
23024
|
-
features: features,
|
|
23025
|
-
onClickPurchaseLabel: () => {
|
|
23026
|
-
setLabelId(undefined);
|
|
23027
|
-
},
|
|
23028
|
-
onClickVoidLabel: () => {
|
|
23029
|
-
setIsVoidingLabel(true);
|
|
23030
|
-
},
|
|
23031
|
-
shipmentId: shipmentId
|
|
23032
|
-
}) : jsxRuntime.jsx(Element$3, {
|
|
23033
|
-
features: features,
|
|
23034
|
-
labelId: labelId,
|
|
23035
|
-
onComplete: () => {
|
|
23036
|
-
setIsVoidingLabel(false);
|
|
23037
|
-
},
|
|
23038
|
-
onViewShipment: () => {
|
|
23039
|
-
setIsVoidingLabel(false);
|
|
23040
|
-
}
|
|
23041
|
-
});
|
|
23042
|
-
};
|
|
23043
|
-
|
|
23044
|
-
var labelWorkflow = /*#__PURE__*/Object.freeze({
|
|
23045
|
-
__proto__: null,
|
|
23046
|
-
useLabelWorkflow: useLabelWorkflow,
|
|
23047
|
-
Element: Element$2
|
|
23298
|
+
* @see {@link ViewShipment.ComponentProps | The **props** that can be passed into the `<ViewShipment.Element />` component}
|
|
23299
|
+
*
|
|
23300
|
+
* @see {@link VoidLabel.Element | The next step in the label purchase workflow `<VoidLabel.Element />`}
|
|
23301
|
+
**/
|
|
23302
|
+
const Element$5 = alchemy__default["default"].createElement(Component$4, ErrorFallback, {
|
|
23303
|
+
css: {
|
|
23304
|
+
height: "100%",
|
|
23305
|
+
maxWidth: "800px",
|
|
23306
|
+
minWidth: "440px",
|
|
23307
|
+
width: "100%"
|
|
23308
|
+
},
|
|
23309
|
+
resources: {
|
|
23310
|
+
en
|
|
23311
|
+
}
|
|
23048
23312
|
});
|
|
23049
23313
|
|
|
23050
|
-
|
|
23051
|
-
|
|
23052
|
-
|
|
23053
|
-
|
|
23054
|
-
}) => {
|
|
23055
|
-
const [themeConfig, setThemeConfig] = React.useState(editableTheme);
|
|
23056
|
-
return jsxRuntime.jsx(ThemeCreatorContext.Provider, Object.assign({
|
|
23057
|
-
value: {
|
|
23058
|
-
setThemeConfig,
|
|
23059
|
-
themeConfig
|
|
23060
|
-
}
|
|
23061
|
-
}, {
|
|
23062
|
-
children: children
|
|
23063
|
-
}));
|
|
23064
|
-
};
|
|
23065
|
-
const useThemeCreator = () => {
|
|
23066
|
-
const themeCreatorContext = React.useContext(ThemeCreatorContext);
|
|
23067
|
-
if (!themeCreatorContext) throw new Error("useThemeConfigurator must be used within a ThemeConfiguratorProvider");
|
|
23068
|
-
return themeCreatorContext;
|
|
23069
|
-
};
|
|
23070
|
-
|
|
23071
|
-
const styles$7 = createStyles({
|
|
23072
|
-
category: {
|
|
23073
|
-
alignItems: "center",
|
|
23074
|
-
cursor: "pointer",
|
|
23075
|
-
display: "flex",
|
|
23076
|
-
flexDirection: "row",
|
|
23077
|
-
justifyContent: "space-between"
|
|
23078
|
-
},
|
|
23079
|
-
colorPicker: theme => ({
|
|
23080
|
-
"&::-webkit-color-swatch": {
|
|
23081
|
-
border: `1px solid ${theme.palette.gray.light}`,
|
|
23082
|
-
borderRadius: "4px",
|
|
23083
|
-
padding: 0
|
|
23084
|
-
},
|
|
23085
|
-
"&::-webkit-color-swatch-wrapper": {
|
|
23086
|
-
padding: 0
|
|
23087
|
-
},
|
|
23088
|
-
alignSelf: "center",
|
|
23089
|
-
appearance: "none",
|
|
23090
|
-
background: "none",
|
|
23091
|
-
border: 0,
|
|
23092
|
-
cursor: "pointer",
|
|
23093
|
-
height: theme.spacing(4.25),
|
|
23094
|
-
outline: "none",
|
|
23095
|
-
width: theme.spacing(4.25)
|
|
23096
|
-
}),
|
|
23097
|
-
container: theme => ({
|
|
23098
|
-
marginBottom: theme.spacing(2)
|
|
23099
|
-
}),
|
|
23100
|
-
input: theme => ({
|
|
23101
|
-
border: `1px solid ${theme.palette.gray.light}`,
|
|
23102
|
-
borderRadius: "4px",
|
|
23103
|
-
color: theme.palette.gray.main,
|
|
23104
|
-
fontSize: "14px",
|
|
23105
|
-
padding: theme.spacing(1)
|
|
23106
|
-
}),
|
|
23107
|
-
inputContainer: theme => ({
|
|
23108
|
-
alignItems: "center",
|
|
23109
|
-
display: "flex",
|
|
23110
|
-
flexDirection: "row",
|
|
23111
|
-
justifyContent: "space-between",
|
|
23112
|
-
padding: `${theme.spacing(2)}px 0`
|
|
23113
|
-
}),
|
|
23114
|
-
wrapper: theme => ({
|
|
23115
|
-
display: "flex",
|
|
23116
|
-
gap: theme.spacing(1)
|
|
23117
|
-
})
|
|
23314
|
+
var viewShipment = /*#__PURE__*/Object.freeze({
|
|
23315
|
+
__proto__: null,
|
|
23316
|
+
Component: Component$4,
|
|
23317
|
+
Element: Element$5
|
|
23118
23318
|
});
|
|
23119
23319
|
|
|
23120
|
-
const
|
|
23121
|
-
|
|
23122
|
-
|
|
23123
|
-
|
|
23320
|
+
const Actions = ({
|
|
23321
|
+
onComplete,
|
|
23322
|
+
onSubmit,
|
|
23323
|
+
onViewShipment,
|
|
23324
|
+
shipment,
|
|
23325
|
+
voidRequest
|
|
23124
23326
|
}) => {
|
|
23125
|
-
const
|
|
23126
|
-
|
|
23127
|
-
|
|
23128
|
-
|
|
23129
|
-
|
|
23130
|
-
|
|
23131
|
-
|
|
23132
|
-
|
|
23133
|
-
|
|
23134
|
-
|
|
23135
|
-
|
|
23136
|
-
|
|
23137
|
-
|
|
23138
|
-
|
|
23139
|
-
|
|
23140
|
-
|
|
23141
|
-
});
|
|
23142
|
-
onUpdatePaletteConfig(updatedConfig);
|
|
23143
|
-
}, [onUpdatePaletteConfig, paletteConfig]);
|
|
23144
|
-
return jsxRuntime.jsx("div", Object.assign({
|
|
23145
|
-
"data-test-id": "color-palette-editor"
|
|
23327
|
+
const {
|
|
23328
|
+
t
|
|
23329
|
+
} = reactI18next.useTranslation(["common", "void-label"]);
|
|
23330
|
+
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
23331
|
+
const handleSubmit = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
23332
|
+
setIsSubmitting(true);
|
|
23333
|
+
yield onSubmit();
|
|
23334
|
+
setIsSubmitting(false);
|
|
23335
|
+
}), [onSubmit]);
|
|
23336
|
+
return jsxRuntime.jsx(giger.BottomSheet, Object.assign({
|
|
23337
|
+
alwaysVisible: true,
|
|
23338
|
+
css: theme => ({
|
|
23339
|
+
borderTop: `1px solid ${theme.palette.gray.ultraLight}`,
|
|
23340
|
+
boxShadow: "none",
|
|
23341
|
+
position: "static"
|
|
23342
|
+
})
|
|
23146
23343
|
}, {
|
|
23147
|
-
children:
|
|
23148
|
-
|
|
23149
|
-
|
|
23150
|
-
|
|
23151
|
-
|
|
23152
|
-
|
|
23153
|
-
|
|
23154
|
-
onClick: event => {
|
|
23155
|
-
event.preventDefault();
|
|
23156
|
-
toggleExpandedCategories(category);
|
|
23157
|
-
},
|
|
23158
|
-
role: "button"
|
|
23344
|
+
children: (voidRequest === null || voidRequest === void 0 ? void 0 : voidRequest.approved) ?
|
|
23345
|
+
// The void request has been approved
|
|
23346
|
+
jsxRuntime.jsxs(ButtonGroup, {
|
|
23347
|
+
children: [jsxRuntime.jsx(giger.Button, Object.assign({
|
|
23348
|
+
bold: false,
|
|
23349
|
+
onClick: () => onComplete(voidRequest, shipment),
|
|
23350
|
+
variant: giger.ButtonVariant.OUTLINED
|
|
23159
23351
|
}, {
|
|
23160
|
-
children:
|
|
23161
|
-
|
|
23162
|
-
|
|
23163
|
-
|
|
23164
|
-
|
|
23165
|
-
})]
|
|
23166
|
-
})), expandedCategories.has(category) && Object.keys(paletteConfig[category]).map(key => jsxRuntime.jsxs("div", Object.assign({
|
|
23167
|
-
css: styles$7.inputContainer,
|
|
23168
|
-
id: "input-container"
|
|
23352
|
+
children: t("void-label:actions.complete")
|
|
23353
|
+
})), jsxRuntime.jsx(giger.Button, Object.assign({
|
|
23354
|
+
bold: false,
|
|
23355
|
+
isFullWidth: true,
|
|
23356
|
+
onClick: () => onViewShipment(shipment)
|
|
23169
23357
|
}, {
|
|
23170
|
-
children:
|
|
23171
|
-
|
|
23172
|
-
|
|
23173
|
-
|
|
23174
|
-
|
|
23358
|
+
children: t("void-label:actions.viewShipment")
|
|
23359
|
+
}))]
|
|
23360
|
+
}) :
|
|
23361
|
+
// The void request has yet to be made or was rejected
|
|
23362
|
+
jsxRuntime.jsx(giger.Button, Object.assign({
|
|
23363
|
+
bold: false,
|
|
23364
|
+
isFullWidth: true,
|
|
23365
|
+
isLoading: isSubmitting,
|
|
23366
|
+
onClick: handleSubmit
|
|
23367
|
+
}, {
|
|
23368
|
+
children: t("void-label:actions.confirmVoid")
|
|
23369
|
+
}))
|
|
23370
|
+
}));
|
|
23371
|
+
};
|
|
23372
|
+
|
|
23373
|
+
const Message = ({
|
|
23374
|
+
voidRequest
|
|
23375
|
+
}) => {
|
|
23376
|
+
const {
|
|
23377
|
+
t
|
|
23378
|
+
} = reactI18next.useTranslation(["common", "void-label"]);
|
|
23379
|
+
return jsxRuntime.jsx(Section, {
|
|
23380
|
+
children: voidRequest ? jsxRuntime.jsxs("section", Object.assign({
|
|
23381
|
+
css: {
|
|
23382
|
+
textAlign: "center",
|
|
23383
|
+
width: "100%"
|
|
23384
|
+
}
|
|
23385
|
+
}, {
|
|
23386
|
+
children: [jsxRuntime.jsx(giger.Icon, {
|
|
23387
|
+
css: theme => ({
|
|
23388
|
+
color: (voidRequest === null || voidRequest === void 0 ? void 0 : voidRequest.approved) ? theme.palette.success.main : theme.palette.error.main
|
|
23389
|
+
}),
|
|
23390
|
+
name: (voidRequest === null || voidRequest === void 0 ? void 0 : voidRequest.approved) ? gigerTheme.IconNames.CHECK_FILLED : gigerTheme.IconNames.ALERT,
|
|
23391
|
+
size: giger.IconSize.SIZE_LARGE
|
|
23392
|
+
}), (voidRequest === null || voidRequest === void 0 ? void 0 : voidRequest.approved) ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
23393
|
+
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23394
|
+
component: "h2"
|
|
23175
23395
|
}, {
|
|
23176
|
-
children:
|
|
23177
|
-
})), jsxRuntime.
|
|
23178
|
-
|
|
23396
|
+
children: t("void-label:resultTitles.approved")
|
|
23397
|
+
})), jsxRuntime.jsx(giger.Typography, {
|
|
23398
|
+
children: t("void-label:resultMessages.approved")
|
|
23399
|
+
})]
|
|
23400
|
+
}) : jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
23401
|
+
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23402
|
+
component: "h2"
|
|
23179
23403
|
}, {
|
|
23180
|
-
children:
|
|
23181
|
-
|
|
23182
|
-
|
|
23183
|
-
|
|
23184
|
-
|
|
23185
|
-
|
|
23186
|
-
|
|
23187
|
-
|
|
23188
|
-
|
|
23189
|
-
|
|
23190
|
-
|
|
23191
|
-
|
|
23192
|
-
|
|
23193
|
-
|
|
23194
|
-
|
|
23195
|
-
|
|
23196
|
-
|
|
23197
|
-
|
|
23198
|
-
|
|
23199
|
-
}));
|
|
23404
|
+
children: t("void-label:resultTitles.rejected")
|
|
23405
|
+
})), jsxRuntime.jsx(giger.Typography, {
|
|
23406
|
+
children: jsxRuntime.jsx("p", {
|
|
23407
|
+
dangerouslySetInnerHTML: {
|
|
23408
|
+
__html: t("void-label:resultMessages.rejected")
|
|
23409
|
+
}
|
|
23410
|
+
})
|
|
23411
|
+
})]
|
|
23412
|
+
})]
|
|
23413
|
+
})) : jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
23414
|
+
children: [jsxRuntime.jsx(giger.Typography, {
|
|
23415
|
+
children: t("void-label:refund_process")
|
|
23416
|
+
}), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23417
|
+
component: "p"
|
|
23418
|
+
}, {
|
|
23419
|
+
children: t("void-label:refund_rules")
|
|
23420
|
+
}))]
|
|
23421
|
+
})
|
|
23422
|
+
});
|
|
23200
23423
|
};
|
|
23201
23424
|
|
|
23202
|
-
|
|
23203
|
-
|
|
23204
|
-
|
|
23205
|
-
|
|
23206
|
-
|
|
23207
|
-
|
|
23208
|
-
|
|
23209
|
-
|
|
23210
|
-
|
|
23211
|
-
|
|
23212
|
-
|
|
23213
|
-
|
|
23214
|
-
|
|
23425
|
+
/**
|
|
23426
|
+
* # Void Label Component
|
|
23427
|
+
*
|
|
23428
|
+
* - The `<VoidLabel />` component is used to void a given shipping label. When a label is voided,
|
|
23429
|
+
* you then get the option to view the associated shipment via the `View Shipment` Element, or
|
|
23430
|
+
* you can purchase another label for the shipment via the `Purchase Label` Element.
|
|
23431
|
+
*
|
|
23432
|
+
* @param ComponentProps The base props that will be passed into the `<VoidLabel />` component.
|
|
23433
|
+
*
|
|
23434
|
+
* @returns Element An EmotionJSX.Element that will render the `<VoidLabel />` component
|
|
23435
|
+
* with all the appropriate wrappers.
|
|
23436
|
+
*
|
|
23437
|
+
* @example
|
|
23438
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
23439
|
+
* ```tsx
|
|
23440
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
23441
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
23442
|
+
* resources: { en },
|
|
23443
|
+
* });
|
|
23444
|
+
* ```
|
|
23445
|
+
*
|
|
23446
|
+
* <br />
|
|
23447
|
+
*
|
|
23448
|
+
* @see {@link VoidLabel.Element | The **Element** created to render `<VoidLabel />`}
|
|
23449
|
+
*/
|
|
23450
|
+
const Component$3 = ({
|
|
23451
|
+
features,
|
|
23452
|
+
labelId,
|
|
23453
|
+
onComplete,
|
|
23454
|
+
onSuccess,
|
|
23455
|
+
onViewShipment
|
|
23456
|
+
}) => {
|
|
23457
|
+
var _a, _b;
|
|
23458
|
+
features = Object.assign({
|
|
23459
|
+
presentation: {
|
|
23460
|
+
poweredByShipEngine: false
|
|
23461
|
+
}
|
|
23462
|
+
}, features !== null && features !== void 0 ? features : {});
|
|
23463
|
+
// TODO [LMNT-910] - labelId should be a required prop
|
|
23464
|
+
if (!labelId) throw new Error("void-label:errorMessages.labelIdRequired");
|
|
23465
|
+
const {
|
|
23466
|
+
t
|
|
23467
|
+
} = reactI18next.useTranslation();
|
|
23468
|
+
const label = alchemy.useGetLabel(labelId);
|
|
23469
|
+
const shipment = alchemy.useGetSalesOrderShipment((_a = label.data) === null || _a === void 0 ? void 0 : _a.shipmentId);
|
|
23470
|
+
const voidLabel = alchemy.useVoidLabel();
|
|
23471
|
+
if (label.isInitialLoading) return jsxRuntime.jsx(Loader, {
|
|
23472
|
+
message: t("loading.label")
|
|
23473
|
+
});
|
|
23474
|
+
if (shipment.isInitialLoading) return jsxRuntime.jsx(Loader, {
|
|
23475
|
+
message: t("loading.shipment")
|
|
23476
|
+
});
|
|
23477
|
+
throwAny(label.error);
|
|
23478
|
+
throwAny(shipment.error);
|
|
23479
|
+
if (!label.data) throw new Error("errorMessages.unableToLoad.label");
|
|
23480
|
+
if (!shipment.data) throw new Error("errorMessages.unableToLoad.shipment");
|
|
23481
|
+
const handleVoidLabelSubmit = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
23482
|
+
const result = yield voidLabel.mutateAsync(labelId);
|
|
23483
|
+
if (result.approved) {
|
|
23484
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(label.data, shipment.data);
|
|
23485
|
+
}
|
|
23486
|
+
});
|
|
23487
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
23488
|
+
children: [jsxRuntime.jsx(Message, {
|
|
23489
|
+
voidRequest: voidLabel.data
|
|
23490
|
+
}), jsxRuntime.jsx(Actions, {
|
|
23491
|
+
onComplete: onComplete,
|
|
23492
|
+
onSubmit: handleVoidLabelSubmit,
|
|
23493
|
+
onViewShipment: onViewShipment,
|
|
23494
|
+
shipment: shipment.data,
|
|
23495
|
+
voidRequest: voidLabel.data
|
|
23496
|
+
}), ((_b = features === null || features === void 0 ? void 0 : features.presentation) === null || _b === void 0 ? void 0 : _b.poweredByShipEngine) && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
23497
|
+
children: [jsxRuntime.jsx(Spacer, {}), jsxRuntime.jsx(PoweredByShipEngine, {})]
|
|
23498
|
+
})]
|
|
23499
|
+
});
|
|
23500
|
+
};
|
|
23501
|
+
/**
|
|
23502
|
+
* # Registered Void Label Element
|
|
23503
|
+
*
|
|
23504
|
+
* - This is the registered `<VoidLabel />` element that will be used to render the
|
|
23505
|
+
* `<VoidLabel.Element />` component.
|
|
23506
|
+
*
|
|
23507
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
23508
|
+
* the `<VoidLabel.Element />` component.
|
|
23509
|
+
*
|
|
23510
|
+
* @example
|
|
23511
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `VoidLabel`
|
|
23512
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
23513
|
+
* ```tsx
|
|
23514
|
+
* <VoidLabel.Element
|
|
23515
|
+
* labelId="se-1234567"
|
|
23516
|
+
* onComplete={() => console.log('onComplete')}
|
|
23517
|
+
* onSuccess={(_, { salesOrderIds: [salesOrderId] }) =>
|
|
23518
|
+
* console.log('sales order ID', salesOrderId)
|
|
23519
|
+
* }
|
|
23520
|
+
* onViewShipment={({ shipmentId }) => {
|
|
23521
|
+
* console.log('onViewShipment', shipmentId);
|
|
23522
|
+
* }}
|
|
23523
|
+
* />
|
|
23524
|
+
* ```
|
|
23525
|
+
*
|
|
23526
|
+
* <br />
|
|
23527
|
+
*
|
|
23528
|
+
* @see {@link VoidLabel.ComponentProps | The **props** that can be passed into the `<VoidLabel.Element />` component}
|
|
23529
|
+
*
|
|
23530
|
+
* @see {@link PurchaseLabel.Element | Go back to the frst step in the label purchase workflow `<PurchaseLabel.Element />`}
|
|
23531
|
+
*/
|
|
23532
|
+
const Element$4 = alchemy__default["default"].createElement(Component$3, ErrorFallback, {
|
|
23533
|
+
css: {
|
|
23534
|
+
height: "100%",
|
|
23535
|
+
maxWidth: "800px",
|
|
23536
|
+
minWidth: "440px",
|
|
23537
|
+
width: "100%"
|
|
23215
23538
|
},
|
|
23216
|
-
|
|
23217
|
-
|
|
23218
|
-
|
|
23219
|
-
},
|
|
23220
|
-
"& > div:last-child": {
|
|
23221
|
-
flexShrink: 1
|
|
23222
|
-
},
|
|
23223
|
-
display: "flex",
|
|
23224
|
-
gap: theme.spacing(1),
|
|
23225
|
-
justifyContent: "space-between"
|
|
23226
|
-
}),
|
|
23227
|
-
sectionContainer: theme => ({
|
|
23228
|
-
marginBottom: theme.spacing(4)
|
|
23229
|
-
}),
|
|
23230
|
-
select: theme => ({
|
|
23231
|
-
border: `1px solid ${theme.palette.gray.light}`,
|
|
23232
|
-
borderRadius: "4px",
|
|
23233
|
-
color: theme.palette.gray.main,
|
|
23234
|
-
fontSize: "14px"
|
|
23235
|
-
})
|
|
23539
|
+
resources: {
|
|
23540
|
+
en
|
|
23541
|
+
}
|
|
23236
23542
|
});
|
|
23237
23543
|
|
|
23238
|
-
|
|
23239
|
-
|
|
23240
|
-
|
|
23241
|
-
|
|
23544
|
+
var voidLabel = /*#__PURE__*/Object.freeze({
|
|
23545
|
+
__proto__: null,
|
|
23546
|
+
Component: Component$3,
|
|
23547
|
+
Element: Element$4
|
|
23548
|
+
});
|
|
23549
|
+
|
|
23550
|
+
/**
|
|
23551
|
+
* @internal
|
|
23552
|
+
*
|
|
23553
|
+
* # Label Workflow Component
|
|
23554
|
+
*
|
|
23555
|
+
* @example
|
|
23556
|
+
* ```tsx
|
|
23557
|
+
* const {
|
|
23558
|
+
* labelId,
|
|
23559
|
+
* multiplexedId,
|
|
23560
|
+
* isVoidingLabel,
|
|
23561
|
+
* shipmentId,
|
|
23562
|
+
* setLabelId,
|
|
23563
|
+
* setShipmentId,
|
|
23564
|
+
* setIsVoidingLabel,
|
|
23565
|
+
* } = useLabelWorkflow({
|
|
23566
|
+
* _labelId,
|
|
23567
|
+
* _multiplexedId,
|
|
23568
|
+
* });
|
|
23569
|
+
* ```
|
|
23570
|
+
*
|
|
23571
|
+
* <br />
|
|
23572
|
+
*
|
|
23573
|
+
* @see {@link LabelWorkflow.Element | The `<LabelWorkflow.Element />` component using this hook}
|
|
23574
|
+
*/
|
|
23575
|
+
const useLabelWorkflow = ({
|
|
23576
|
+
_multiplexedId,
|
|
23577
|
+
_labelId
|
|
23242
23578
|
}) => {
|
|
23243
|
-
|
|
23244
|
-
|
|
23245
|
-
|
|
23246
|
-
|
|
23247
|
-
|
|
23248
|
-
|
|
23249
|
-
|
|
23250
|
-
|
|
23251
|
-
const getNestedValue = React.useCallback((obj, key) => {
|
|
23252
|
-
if (!obj) return undefined;
|
|
23253
|
-
return obj[key];
|
|
23579
|
+
// Fix first ids as the user of the library shouldn't be changing them
|
|
23580
|
+
const [multiplexedId, setMultiplexedId] = React.useState(_multiplexedId);
|
|
23581
|
+
const [shipmentId, setShipmentId] = React.useState("shipmentId" in _multiplexedId ? _multiplexedId.shipmentId : undefined);
|
|
23582
|
+
const [labelId, _setLabelId] = React.useState(_labelId);
|
|
23583
|
+
const [isVoidingLabel, setIsVoidingLabel] = React.useState(false);
|
|
23584
|
+
const setLabelId = React.useCallback(nextLabelId => {
|
|
23585
|
+
setIsVoidingLabel(false);
|
|
23586
|
+
_setLabelId(nextLabelId);
|
|
23254
23587
|
}, []);
|
|
23255
|
-
|
|
23256
|
-
|
|
23257
|
-
|
|
23258
|
-
|
|
23259
|
-
|
|
23260
|
-
|
|
23261
|
-
|
|
23262
|
-
|
|
23263
|
-
|
|
23264
|
-
label: "Bold",
|
|
23265
|
-
value: "700"
|
|
23266
|
-
}];
|
|
23267
|
-
const fontWeightValue = (_a = getNestedValue(typographyConfig, variant)) === null || _a === void 0 ? void 0 : _a.fontWeight.toString();
|
|
23268
|
-
const selectOption = fontWeightValue !== undefined ? options.find(option => option.value === fontWeightValue) : undefined;
|
|
23269
|
-
return jsxRuntime.jsx(giger.Select, Object.assign({
|
|
23270
|
-
css: styles$6.select,
|
|
23271
|
-
label: "Font Weight",
|
|
23272
|
-
name: "font-weight",
|
|
23273
|
-
onChange: (_name, value) => handleInputChange(variant, key, value === null || value === void 0 ? void 0 : value.value),
|
|
23274
|
-
value: selectOption
|
|
23275
|
-
}, {
|
|
23276
|
-
children: options.map(option => jsxRuntime.jsx(giger.Option, Object.assign({
|
|
23277
|
-
value: option.value
|
|
23278
|
-
}, {
|
|
23279
|
-
children: option.label
|
|
23280
|
-
}), option.value))
|
|
23281
|
-
}));
|
|
23588
|
+
return {
|
|
23589
|
+
isVoidingLabel,
|
|
23590
|
+
labelId,
|
|
23591
|
+
multiplexedId,
|
|
23592
|
+
setIsVoidingLabel,
|
|
23593
|
+
setLabelId,
|
|
23594
|
+
setMultiplexedId,
|
|
23595
|
+
setShipmentId,
|
|
23596
|
+
shipmentId
|
|
23282
23597
|
};
|
|
23283
|
-
|
|
23598
|
+
};
|
|
23599
|
+
/**
|
|
23600
|
+
* @internal
|
|
23601
|
+
*
|
|
23602
|
+
* # Label Workflow Element
|
|
23603
|
+
*
|
|
23604
|
+
* - The `<LabelWorkflow.Element />` component is a composition of the PurchaseLabel, ViewShipment,
|
|
23605
|
+
* and VoidLabel elements that allows users to purchase a label, view the shipment details, and optionally void their shipping label.
|
|
23606
|
+
*
|
|
23607
|
+
* @param LabelWorkflowProps The props necessary to render the `<LabelWorkflow.Element />` for shipment
|
|
23608
|
+
* based or sales order based label purchasing.
|
|
23609
|
+
*
|
|
23610
|
+
* @returns Element A React Element that will render the `<LabelWorkflow />` component.
|
|
23611
|
+
*
|
|
23612
|
+
* @example
|
|
23613
|
+
* ```tsx
|
|
23614
|
+
* <LabelWorkflow
|
|
23615
|
+
* {...elementProps}
|
|
23616
|
+
* callbacks={{ onLabelCreateSuccess }}
|
|
23617
|
+
* multiplexedId={elementIdProps}
|
|
23618
|
+
* />
|
|
23619
|
+
* ```
|
|
23620
|
+
*
|
|
23621
|
+
* <br />
|
|
23622
|
+
*
|
|
23623
|
+
* @see {@link LabelWorkflowProps | The props that are passed into the `<LabelWorkflow />` component}
|
|
23624
|
+
* @see {@link LabelWorkflow.useLabelWorkflow | The `hook` that is used to manage the state of the `<LabelWorkflow />` component}
|
|
23625
|
+
*/
|
|
23626
|
+
const Element$3 = (
|
|
23627
|
+
/*
|
|
23628
|
+
The passed props are underscore prefixed as they will be stashed, then from them stateful versions will be made
|
|
23629
|
+
*/
|
|
23630
|
+
{
|
|
23631
|
+
multiplexedId: _multiplexedId,
|
|
23632
|
+
labelId: _labelId,
|
|
23633
|
+
features: propFeatures,
|
|
23634
|
+
callbacks
|
|
23635
|
+
}) => {
|
|
23636
|
+
const {
|
|
23637
|
+
labelId,
|
|
23638
|
+
multiplexedId,
|
|
23639
|
+
isVoidingLabel,
|
|
23640
|
+
shipmentId,
|
|
23641
|
+
setLabelId,
|
|
23642
|
+
setShipmentId,
|
|
23643
|
+
setIsVoidingLabel
|
|
23644
|
+
} = useLabelWorkflow({
|
|
23645
|
+
_labelId,
|
|
23646
|
+
_multiplexedId
|
|
23647
|
+
});
|
|
23648
|
+
const _features = useFeatures("Globals");
|
|
23649
|
+
const features = React.useMemo(() => {
|
|
23284
23650
|
var _a;
|
|
23285
|
-
|
|
23286
|
-
|
|
23287
|
-
|
|
23288
|
-
|
|
23289
|
-
|
|
23290
|
-
|
|
23291
|
-
if (e.target.value.match(/^\d{0,2}$/)) handleInputChange(variant, key, `${e.target.value}px`);
|
|
23292
|
-
},
|
|
23293
|
-
value: formattedFontSizeValue
|
|
23651
|
+
return Object.assign(Object.assign(Object.assign({}, propFeatures), _features), {
|
|
23652
|
+
global: Object.assign(Object.assign({}, _features.global), {
|
|
23653
|
+
presentation: Object.assign(Object.assign({}, (_a = _features.global) === null || _a === void 0 ? void 0 : _a.presentation), {
|
|
23654
|
+
poweredByShipEngine: true
|
|
23655
|
+
})
|
|
23656
|
+
})
|
|
23294
23657
|
});
|
|
23295
|
-
};
|
|
23296
|
-
|
|
23297
|
-
|
|
23298
|
-
|
|
23299
|
-
|
|
23300
|
-
|
|
23301
|
-
|
|
23302
|
-
|
|
23303
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
23304
|
-
children: renderFontSizeInput(variant, key)
|
|
23305
|
-
});
|
|
23306
|
-
default:
|
|
23307
|
-
return null;
|
|
23308
|
-
}
|
|
23309
|
-
};
|
|
23310
|
-
return jsxRuntime.jsx("div", {
|
|
23311
|
-
children: typographyConfig && Object.keys(typographyConfig).map(variant => jsxRuntime.jsxs("div", Object.assign({
|
|
23312
|
-
css: styles$6.sectionContainer
|
|
23313
|
-
}, {
|
|
23314
|
-
children: [jsxRuntime.jsx("p", Object.assign({
|
|
23315
|
-
css: styles$6.keys,
|
|
23316
|
-
id: variant
|
|
23317
|
-
}, {
|
|
23318
|
-
children: formatKey(variant)
|
|
23319
|
-
})), jsxRuntime.jsx("section", Object.assign({
|
|
23320
|
-
css: styles$6.section
|
|
23321
|
-
}, {
|
|
23322
|
-
children: Object.keys(typographyConfig[variant]).map(key => jsxRuntime.jsx("div", Object.assign({
|
|
23323
|
-
id: `${variant}.${key}`
|
|
23324
|
-
}, {
|
|
23325
|
-
children: renderChildren(variant, key)
|
|
23326
|
-
}), key))
|
|
23327
|
-
}))]
|
|
23328
|
-
}), variant))
|
|
23329
|
-
});
|
|
23330
|
-
};
|
|
23331
|
-
|
|
23332
|
-
const styles$5 = createStyles({
|
|
23333
|
-
container: theme => ({
|
|
23334
|
-
color: theme.palette.gray.dark,
|
|
23335
|
-
display: "flex",
|
|
23336
|
-
flexDirection: "column",
|
|
23337
|
-
flexGrow: 1,
|
|
23338
|
-
overflow: "hidden",
|
|
23339
|
-
position: "relative"
|
|
23340
|
-
}),
|
|
23341
|
-
content: theme => ({
|
|
23342
|
-
display: "flex",
|
|
23343
|
-
flexDirection: "column",
|
|
23344
|
-
gap: theme.spacing(3),
|
|
23345
|
-
padding: theme.spacing(3)
|
|
23346
|
-
}),
|
|
23347
|
-
copy: theme => ({
|
|
23348
|
-
backgroundColor: theme.palette.white,
|
|
23349
|
-
borderRadius: "4px",
|
|
23350
|
-
padding: theme.spacing(0.5)
|
|
23351
|
-
}),
|
|
23352
|
-
drawerHeader: theme => ({
|
|
23353
|
-
alignItems: "center",
|
|
23354
|
-
display: "flex",
|
|
23355
|
-
gap: theme.spacing(2),
|
|
23356
|
-
justifyContent: "end",
|
|
23357
|
-
width: "50%"
|
|
23358
|
-
}),
|
|
23359
|
-
drawerWrapper: {
|
|
23360
|
-
display: "flex",
|
|
23361
|
-
justifyContent: "space-between",
|
|
23362
|
-
position: "relative"
|
|
23363
|
-
},
|
|
23364
|
-
header: {
|
|
23365
|
-
alignItems: "center",
|
|
23366
|
-
display: "flex",
|
|
23367
|
-
justifyContent: "space-between"
|
|
23368
|
-
},
|
|
23369
|
-
popoverWrapper: theme => ({
|
|
23370
|
-
display: "flex",
|
|
23371
|
-
flexDirection: "column",
|
|
23372
|
-
gap: theme.spacing(1)
|
|
23373
|
-
}),
|
|
23374
|
-
pre: theme => ({
|
|
23375
|
-
backgroundColor: "#FFFFFF66",
|
|
23376
|
-
borderRadius: "8px",
|
|
23377
|
-
fontSize: "14px",
|
|
23378
|
-
padding: theme.spacing(0.3)
|
|
23379
|
-
}),
|
|
23380
|
-
presetOption: theme => ({
|
|
23381
|
-
"&:hover": {
|
|
23382
|
-
backgroundColor: "theme.palette.gray.ultraLight"
|
|
23658
|
+
}, []);
|
|
23659
|
+
return !labelId ? jsxRuntime.jsx(Element$7, Object.assign({}, multiplexedId, {
|
|
23660
|
+
features: features,
|
|
23661
|
+
onLabelCreateSuccess: (label, shipment) => {
|
|
23662
|
+
var _a;
|
|
23663
|
+
setLabelId(label.labelId);
|
|
23664
|
+
setShipmentId(shipment.shipmentId);
|
|
23665
|
+
(_a = callbacks === null || callbacks === void 0 ? void 0 : callbacks.onLabelCreateSuccess) === null || _a === void 0 ? void 0 : _a.call(callbacks, label, shipment);
|
|
23383
23666
|
},
|
|
23384
|
-
|
|
23385
|
-
|
|
23386
|
-
|
|
23387
|
-
|
|
23388
|
-
|
|
23389
|
-
|
|
23390
|
-
|
|
23391
|
-
|
|
23667
|
+
onLoad: (salesOrder, shipments, pendingShipment) => {
|
|
23668
|
+
if (shipments.length > 0) {
|
|
23669
|
+
setShipmentId(prior => prior !== undefined ? prior : shipments[0].shipmentId);
|
|
23670
|
+
}
|
|
23671
|
+
}
|
|
23672
|
+
})) : !isVoidingLabel ? jsxRuntime.jsx(Element$5, {
|
|
23673
|
+
features: features,
|
|
23674
|
+
onClickPurchaseLabel: () => {
|
|
23675
|
+
setLabelId(undefined);
|
|
23392
23676
|
},
|
|
23393
|
-
|
|
23394
|
-
|
|
23395
|
-
|
|
23396
|
-
|
|
23397
|
-
|
|
23398
|
-
|
|
23399
|
-
|
|
23400
|
-
|
|
23677
|
+
onClickVoidLabel: () => {
|
|
23678
|
+
setIsVoidingLabel(true);
|
|
23679
|
+
},
|
|
23680
|
+
shipmentId: shipmentId
|
|
23681
|
+
}) : jsxRuntime.jsx(Element$4, {
|
|
23682
|
+
features: features,
|
|
23683
|
+
labelId: labelId,
|
|
23684
|
+
onComplete: () => {
|
|
23685
|
+
setIsVoidingLabel(false);
|
|
23686
|
+
},
|
|
23687
|
+
onViewShipment: () => {
|
|
23688
|
+
setIsVoidingLabel(false);
|
|
23689
|
+
}
|
|
23690
|
+
});
|
|
23691
|
+
};
|
|
23692
|
+
|
|
23693
|
+
var labelWorkflow = /*#__PURE__*/Object.freeze({
|
|
23694
|
+
__proto__: null,
|
|
23695
|
+
useLabelWorkflow: useLabelWorkflow,
|
|
23696
|
+
Element: Element$3
|
|
23401
23697
|
});
|
|
23402
23698
|
|
|
23403
|
-
const
|
|
23404
|
-
|
|
23405
|
-
|
|
23406
|
-
presets,
|
|
23407
|
-
showDrawer
|
|
23699
|
+
const Component$2 = ({
|
|
23700
|
+
onRowClick,
|
|
23701
|
+
shipmentStatus: _shipmentStatus = "pending"
|
|
23408
23702
|
}) => {
|
|
23409
|
-
const
|
|
23410
|
-
|
|
23411
|
-
|
|
23412
|
-
|
|
23413
|
-
|
|
23414
|
-
|
|
23415
|
-
|
|
23416
|
-
|
|
23417
|
-
|
|
23418
|
-
|
|
23419
|
-
|
|
23703
|
+
const {
|
|
23704
|
+
t
|
|
23705
|
+
} = reactI18next.useTranslation(["common", "list-shipments"]);
|
|
23706
|
+
const {
|
|
23707
|
+
page,
|
|
23708
|
+
pageSize,
|
|
23709
|
+
pagerProps
|
|
23710
|
+
} = usePager();
|
|
23711
|
+
const {
|
|
23712
|
+
data,
|
|
23713
|
+
isLoading,
|
|
23714
|
+
isError,
|
|
23715
|
+
error
|
|
23716
|
+
} = alchemy.useListShipments({
|
|
23717
|
+
page,
|
|
23718
|
+
pageSize,
|
|
23719
|
+
shipmentStatus: _shipmentStatus
|
|
23420
23720
|
});
|
|
23421
|
-
|
|
23422
|
-
|
|
23423
|
-
|
|
23721
|
+
if (isLoading) return jsxRuntime.jsx(Loader, {
|
|
23722
|
+
message: t("loading.shipments")
|
|
23723
|
+
});
|
|
23724
|
+
if (isError) throw new Error(error.map(e => e.message).join(", "));
|
|
23725
|
+
if (!data) throw new Error(t("errorMessages.unableToLoad.shipments"));
|
|
23726
|
+
const columns = [{
|
|
23727
|
+
headerContent: t("list-shipments:headers.shipmentId"),
|
|
23728
|
+
renderCellContent: shipment => {
|
|
23729
|
+
return jsxRuntime.jsx("div", {
|
|
23730
|
+
children: shipment.shipmentId
|
|
23731
|
+
});
|
|
23424
23732
|
}
|
|
23425
|
-
|
|
23733
|
+
}, {
|
|
23734
|
+
headerContent: t("list-shipments:headers.shipTo"),
|
|
23735
|
+
renderCellContent: shipment => {
|
|
23736
|
+
return shipment.shipTo.addressLine1 ? jsxRuntime.jsx(AddressDisplay, {
|
|
23737
|
+
address: shipment.shipTo
|
|
23738
|
+
}) : "--";
|
|
23739
|
+
}
|
|
23740
|
+
}, {
|
|
23741
|
+
headerContent: t("list-shipments:headers.shipDate"),
|
|
23742
|
+
renderCellContent: shipment => {
|
|
23743
|
+
return shipment.shipDate ? jsxRuntime.jsx(CellFormattedDate, {
|
|
23744
|
+
date: shipment.shipDate
|
|
23745
|
+
}) : "--";
|
|
23746
|
+
}
|
|
23747
|
+
}];
|
|
23748
|
+
return jsxRuntime.jsx(GridController, {
|
|
23749
|
+
columns: columns,
|
|
23750
|
+
data: data.shipments,
|
|
23751
|
+
footerContent: jsxRuntime.jsx(Pager, Object.assign({}, pagerProps, {
|
|
23752
|
+
pagingData: data
|
|
23753
|
+
})),
|
|
23754
|
+
onRowClick: onRowClick
|
|
23426
23755
|
});
|
|
23427
|
-
|
|
23428
|
-
|
|
23429
|
-
|
|
23430
|
-
|
|
23431
|
-
|
|
23432
|
-
|
|
23433
|
-
|
|
23434
|
-
|
|
23435
|
-
|
|
23436
|
-
|
|
23437
|
-
|
|
23438
|
-
|
|
23439
|
-
|
|
23440
|
-
|
|
23441
|
-
|
|
23442
|
-
|
|
23443
|
-
|
|
23444
|
-
|
|
23445
|
-
|
|
23446
|
-
|
|
23447
|
-
|
|
23448
|
-
|
|
23449
|
-
|
|
23450
|
-
|
|
23451
|
-
|
|
23452
|
-
|
|
23453
|
-
|
|
23454
|
-
},
|
|
23455
|
-
typographyConfig: (_a = themeConfig.components) === null || _a === void 0 ? void 0 : _a.Typography
|
|
23456
|
-
});
|
|
23457
|
-
default:
|
|
23458
|
-
return null;
|
|
23756
|
+
};
|
|
23757
|
+
const Element$2 = alchemy__default["default"].createElement(Component$2, ErrorFallback, {
|
|
23758
|
+
css: {
|
|
23759
|
+
height: "100%",
|
|
23760
|
+
minWidth: "440px",
|
|
23761
|
+
width: "100%"
|
|
23762
|
+
},
|
|
23763
|
+
resources: {
|
|
23764
|
+
en
|
|
23765
|
+
}
|
|
23766
|
+
});
|
|
23767
|
+
|
|
23768
|
+
var shipmentsGrid = /*#__PURE__*/Object.freeze({
|
|
23769
|
+
__proto__: null,
|
|
23770
|
+
Element: Element$2
|
|
23771
|
+
});
|
|
23772
|
+
|
|
23773
|
+
const ThemeCreatorContext = /*#__PURE__*/React.createContext(undefined);
|
|
23774
|
+
const ThemeCreatorProvider = ({
|
|
23775
|
+
children,
|
|
23776
|
+
editableTheme
|
|
23777
|
+
}) => {
|
|
23778
|
+
const [themeConfig, setThemeConfig] = React.useState(editableTheme);
|
|
23779
|
+
return jsxRuntime.jsx(ThemeCreatorContext.Provider, Object.assign({
|
|
23780
|
+
value: {
|
|
23781
|
+
setThemeConfig,
|
|
23782
|
+
themeConfig
|
|
23459
23783
|
}
|
|
23460
|
-
};
|
|
23461
|
-
// const formattedThemeObj = `const theme = ${JSON.stringify(themeConfig, null, 2)}`;
|
|
23462
|
-
const presetsRef = React.useRef(null);
|
|
23463
|
-
const [showPresets, toggleShowPresets] = useToggle(false);
|
|
23464
|
-
const applyPreset = theme => {
|
|
23465
|
-
onUpdateThemeConfig(theme);
|
|
23466
|
-
};
|
|
23467
|
-
return jsxRuntime.jsxs("div", Object.assign({
|
|
23468
|
-
"aria-label": "Theme Creator",
|
|
23469
|
-
css: styles$5.container,
|
|
23470
|
-
"data-testid": "theme-creator",
|
|
23471
|
-
role: "region"
|
|
23472
23784
|
}, {
|
|
23473
|
-
children:
|
|
23474
|
-
css: styles$5.content
|
|
23475
|
-
}, {
|
|
23476
|
-
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
23477
|
-
css: styles$5.header
|
|
23478
|
-
}, {
|
|
23479
|
-
children: [jsxRuntime.jsx(Tabs, {
|
|
23480
|
-
onSelectTab: handleSelectedTab,
|
|
23481
|
-
selectedTab: selectedTab,
|
|
23482
|
-
tabs: formattedThemeTabs
|
|
23483
|
-
}), presets ? jsxRuntime.jsxs("div", {
|
|
23484
|
-
children: [jsxRuntime.jsxs("button", Object.assign({
|
|
23485
|
-
"aria-controls": "presets-popover",
|
|
23486
|
-
"aria-expanded": showPresets,
|
|
23487
|
-
css: styles$5.presetsButton,
|
|
23488
|
-
onClick: e => {
|
|
23489
|
-
e.preventDefault();
|
|
23490
|
-
toggleShowPresets();
|
|
23491
|
-
},
|
|
23492
|
-
ref: presetsRef
|
|
23493
|
-
}, {
|
|
23494
|
-
children: ["Presets", jsxRuntime.jsx(giger.Icon, {
|
|
23495
|
-
name: gigerTheme.IconNames.CARET_BOTTOM,
|
|
23496
|
-
size: giger.IconSize.SIZE_SMALL
|
|
23497
|
-
})]
|
|
23498
|
-
})), jsxRuntime.jsx(giger.Popover, Object.assign({
|
|
23499
|
-
container: document.querySelector("#theme-creator"),
|
|
23500
|
-
isOpen: showPresets,
|
|
23501
|
-
onClickAway: () => toggleShowPresets(),
|
|
23502
|
-
placement: "bottom-end",
|
|
23503
|
-
reference: presetsRef.current
|
|
23504
|
-
}, {
|
|
23505
|
-
children: jsxRuntime.jsxs("div", Object.assign({
|
|
23506
|
-
css: styles$5.popoverWrapper
|
|
23507
|
-
}, {
|
|
23508
|
-
children: [jsxRuntime.jsx("button", Object.assign({
|
|
23509
|
-
"aria-label": "Set Default Theme",
|
|
23510
|
-
css: styles$5.presetOption,
|
|
23511
|
-
onClick: e => {
|
|
23512
|
-
e.preventDefault();
|
|
23513
|
-
toggleShowPresets();
|
|
23514
|
-
applyPreset(defaultThemeConfigRef.current);
|
|
23515
|
-
},
|
|
23516
|
-
role: "menuitem"
|
|
23517
|
-
}, {
|
|
23518
|
-
children: "Default"
|
|
23519
|
-
})), presets.map(preset => jsxRuntime.jsx("button", Object.assign({
|
|
23520
|
-
"aria-label": `Set ${preset.presetName} Theme`,
|
|
23521
|
-
css: styles$5.presetOption,
|
|
23522
|
-
onClick: e => {
|
|
23523
|
-
e.preventDefault();
|
|
23524
|
-
toggleShowPresets();
|
|
23525
|
-
applyPreset(preset.themeConfig);
|
|
23526
|
-
},
|
|
23527
|
-
role: "menuitem"
|
|
23528
|
-
}, {
|
|
23529
|
-
children: preset.presetName
|
|
23530
|
-
}), preset.presetName))]
|
|
23531
|
-
}))
|
|
23532
|
-
}))]
|
|
23533
|
-
}) :
|
|
23534
|
-
//reset to default button
|
|
23535
|
-
jsxRuntime.jsx("button", Object.assign({
|
|
23536
|
-
"aria-label": "Set Default Theme",
|
|
23537
|
-
css: styles$5.presetsButton,
|
|
23538
|
-
onClick: () => {
|
|
23539
|
-
applyPreset(defaultThemeConfigRef.current);
|
|
23540
|
-
},
|
|
23541
|
-
role: "menuitem"
|
|
23542
|
-
}, {
|
|
23543
|
-
children: "Reset to Default"
|
|
23544
|
-
}))]
|
|
23545
|
-
})), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23546
|
-
role: "heading",
|
|
23547
|
-
variant: "heading4"
|
|
23548
|
-
}, {
|
|
23549
|
-
children: `${selectedTab} Editor`
|
|
23550
|
-
})), renderContentBySelectedTab(themeConfig, selectedTab)]
|
|
23551
|
-
})), showDrawer && jsxRuntime.jsx(Drawer, Object.assign({
|
|
23552
|
-
"aria-label": "Show themeConfig.js Code Drawer",
|
|
23553
|
-
headerContent: jsxRuntime.jsxs("div", Object.assign({
|
|
23554
|
-
css: styles$5.drawerHeader
|
|
23555
|
-
}, {
|
|
23556
|
-
children: [jsxRuntime.jsx("pre", Object.assign({
|
|
23557
|
-
css: styles$5.pre
|
|
23558
|
-
}, {
|
|
23559
|
-
children: "themeConfig.js"
|
|
23560
|
-
})), showDrawer.copyToClipboardText && jsxRuntime.jsx("div", Object.assign({
|
|
23561
|
-
css: styles$5.copy
|
|
23562
|
-
}, {
|
|
23563
|
-
children: jsxRuntime.jsx(CopyButton, {
|
|
23564
|
-
content: showDrawer.copyToClipboardText
|
|
23565
|
-
})
|
|
23566
|
-
}))]
|
|
23567
|
-
})),
|
|
23568
|
-
isOpen: isDrawerOpen,
|
|
23569
|
-
toggleDrawer: () => setIsDrawerOpen(!isDrawerOpen)
|
|
23570
|
-
}, {
|
|
23571
|
-
children: showDrawer.content
|
|
23572
|
-
}))]
|
|
23785
|
+
children: children
|
|
23573
23786
|
}));
|
|
23574
23787
|
};
|
|
23788
|
+
const useThemeCreator = () => {
|
|
23789
|
+
const themeCreatorContext = React.useContext(ThemeCreatorContext);
|
|
23790
|
+
if (!themeCreatorContext) throw new Error("useThemeConfigurator must be used within a ThemeConfiguratorProvider");
|
|
23791
|
+
return themeCreatorContext;
|
|
23792
|
+
};
|
|
23575
23793
|
|
|
23576
23794
|
const Component$1 = _a => {
|
|
23577
23795
|
var props = __rest(_a, []);
|
|
@@ -24591,6 +24809,7 @@ exports.GridController = GridController;
|
|
|
24591
24809
|
exports.InlineLabel = InlineLabel;
|
|
24592
24810
|
exports.ItemsBreakdown = ItemsBreakdown;
|
|
24593
24811
|
exports.LabelWorkflow = labelWorkflow;
|
|
24812
|
+
exports.LabelsGrid = labelsGrid;
|
|
24594
24813
|
exports.LinkAction = LinkAction;
|
|
24595
24814
|
exports.ListCarriers = listCarriers;
|
|
24596
24815
|
exports.Loader = Loader;
|
|
@@ -24605,6 +24824,7 @@ exports.PoweredByShipEngine = PoweredByShipEngine;
|
|
|
24605
24824
|
exports.PurchaseLabel = purchaseLabel;
|
|
24606
24825
|
exports.RootPortalProvider = RootPortalProvider;
|
|
24607
24826
|
exports.Section = Section;
|
|
24827
|
+
exports.ShipmentsGrid = shipmentsGrid;
|
|
24608
24828
|
exports.SkeletonCarrierRow = SkeletonCarrierRow;
|
|
24609
24829
|
exports.Spacer = Spacer;
|
|
24610
24830
|
exports.Spread = Spread;
|