@shipengine/elements 0.4.3 → 0.4.5
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 +18 -31
- package/index.js +19 -32
- package/package.json +4 -5
package/index.cjs
CHANGED
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var elementsCore = require('@shipengine/elements-core');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var react = require('react');
|
|
8
|
-
var giger = require('@packlink/giger');
|
|
9
8
|
var elementsUi = require('@shipengine/elements-ui');
|
|
10
9
|
|
|
11
10
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -20278,36 +20277,26 @@ const SalesOrder = ({
|
|
|
20278
20277
|
const handleLabelCreated = react.useCallback(label => __awaiter(void 0, void 0, void 0, function* () {
|
|
20279
20278
|
if (label) onPurchase === null || onPurchase === void 0 ? void 0 : onPurchase(label);
|
|
20280
20279
|
}), [onPurchase]);
|
|
20281
|
-
if (salesOrders.isLoading) return jsxRuntime.jsx(
|
|
20282
|
-
|
|
20283
|
-
}
|
|
20284
|
-
children: t("loading.salesOrder")
|
|
20285
|
-
}));
|
|
20280
|
+
if (salesOrders.isLoading) return jsxRuntime.jsx(elementsUi.Loader, {
|
|
20281
|
+
message: t("loading.salesOrder")
|
|
20282
|
+
});
|
|
20286
20283
|
if (salesOrders.errors) throw new Error(salesOrders.errors.map(e => e.message).join(", "));
|
|
20287
|
-
if (orderSources.isLoading) return jsxRuntime.jsx(
|
|
20288
|
-
|
|
20289
|
-
}
|
|
20290
|
-
children: t("loading.importingSalesOrder")
|
|
20291
|
-
}));
|
|
20284
|
+
if (orderSources.isLoading) return jsxRuntime.jsx(elementsUi.Loader, {
|
|
20285
|
+
message: t("loading.importingSalesOrder")
|
|
20286
|
+
});
|
|
20292
20287
|
if (orderSources.errors) throw new Error(orderSources.errors.map(e => e.message).join(", "));
|
|
20293
20288
|
if (!salesOrders.data) throw new Error(t("errorMessages.unableToLoad.salesOrder"));
|
|
20294
|
-
if (salesOrders.data.length === 0) return jsxRuntime.jsx(
|
|
20295
|
-
|
|
20296
|
-
}
|
|
20297
|
-
|
|
20298
|
-
|
|
20299
|
-
|
|
20300
|
-
size: giger.SpinnerSize.SIZE_LARGE
|
|
20301
|
-
}, {
|
|
20302
|
-
children: t("loading.shipment")
|
|
20303
|
-
}));
|
|
20289
|
+
if (salesOrders.data.length === 0) return jsxRuntime.jsx(elementsUi.Loader, {
|
|
20290
|
+
message: t("loading.importingSalesOrder")
|
|
20291
|
+
});
|
|
20292
|
+
if (shipments.isLoading) return jsxRuntime.jsx(elementsUi.Loader, {
|
|
20293
|
+
message: t("loading.shipment")
|
|
20294
|
+
});
|
|
20304
20295
|
if (shipments.errors) throw new Error(shipments.errors.map(e => e.message).join(", "));
|
|
20305
20296
|
if (!shipments.data) throw new Error(t("errorMessages.unableToLoad.shipment"));
|
|
20306
|
-
if (carriers.isLoading) return jsxRuntime.jsx(
|
|
20307
|
-
|
|
20308
|
-
}
|
|
20309
|
-
children: t("loading.carriers")
|
|
20310
|
-
}));
|
|
20297
|
+
if (carriers.isLoading) return jsxRuntime.jsx(elementsUi.Loader, {
|
|
20298
|
+
message: t("loading.carriers")
|
|
20299
|
+
});
|
|
20311
20300
|
const salesOrder = salesOrders.data[0];
|
|
20312
20301
|
const shipment = shipments.data.find(s => s.shipmentStatus === "pending");
|
|
20313
20302
|
return jsxRuntime.jsxs(elementsUi.Templates.SalesOrder, Object.assign({
|
|
@@ -20353,11 +20342,9 @@ const Shipment = ({
|
|
|
20353
20342
|
});
|
|
20354
20343
|
const warehouses = elementsCore.useListWarehouses();
|
|
20355
20344
|
const carriers = elementsCore.useListCarriers();
|
|
20356
|
-
if (!shipment.data && !shipment.errors) return jsxRuntime.jsx(
|
|
20357
|
-
|
|
20358
|
-
}
|
|
20359
|
-
children: t("loading.shipment")
|
|
20360
|
-
}));
|
|
20345
|
+
if (!shipment.data && !shipment.errors) return jsxRuntime.jsx(elementsUi.Loader, {
|
|
20346
|
+
message: t("loading.shipment")
|
|
20347
|
+
});
|
|
20361
20348
|
if (shipment.errors) throw new Error(shipment.errors.map(e => e.message).join(", "));
|
|
20362
20349
|
if (!shipment.data) throw new Error("errorMessages.unableToLoad.shipment");
|
|
20363
20350
|
const warehouse = (_b = warehouses.data) === null || _b === void 0 ? void 0 : _b.find(w => {
|
package/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { useTranslation, useLogger, useListWarehouses, useListCarriers, useCreateShipment, useUpdateShipment, useParseAddress, useListCustomPackageTypes, useCreateLabel, isDomesticAddress, useListSalesOrders, useListOrderSources, useRefreshOrderSource, useCalculateRates, useValidateAddresses, useListShipments, registerElement, useGetShipment, useListLabels, useGetLabel, useVoidLabel } from '@shipengine/elements-core';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { useCallback, useMemo, useState, useEffect } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import { Templates } from '@shipengine/elements-ui';
|
|
4
|
+
import { Templates, Loader } from '@shipengine/elements-ui';
|
|
6
5
|
|
|
7
6
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
8
7
|
|
|
@@ -20274,36 +20273,26 @@ const SalesOrder = ({
|
|
|
20274
20273
|
const handleLabelCreated = useCallback(label => __awaiter(void 0, void 0, void 0, function* () {
|
|
20275
20274
|
if (label) onPurchase === null || onPurchase === void 0 ? void 0 : onPurchase(label);
|
|
20276
20275
|
}), [onPurchase]);
|
|
20277
|
-
if (salesOrders.isLoading) return jsx(
|
|
20278
|
-
|
|
20279
|
-
}
|
|
20280
|
-
children: t("loading.salesOrder")
|
|
20281
|
-
}));
|
|
20276
|
+
if (salesOrders.isLoading) return jsx(Loader, {
|
|
20277
|
+
message: t("loading.salesOrder")
|
|
20278
|
+
});
|
|
20282
20279
|
if (salesOrders.errors) throw new Error(salesOrders.errors.map(e => e.message).join(", "));
|
|
20283
|
-
if (orderSources.isLoading) return jsx(
|
|
20284
|
-
|
|
20285
|
-
}
|
|
20286
|
-
children: t("loading.importingSalesOrder")
|
|
20287
|
-
}));
|
|
20280
|
+
if (orderSources.isLoading) return jsx(Loader, {
|
|
20281
|
+
message: t("loading.importingSalesOrder")
|
|
20282
|
+
});
|
|
20288
20283
|
if (orderSources.errors) throw new Error(orderSources.errors.map(e => e.message).join(", "));
|
|
20289
20284
|
if (!salesOrders.data) throw new Error(t("errorMessages.unableToLoad.salesOrder"));
|
|
20290
|
-
if (salesOrders.data.length === 0) return jsx(
|
|
20291
|
-
|
|
20292
|
-
}
|
|
20293
|
-
|
|
20294
|
-
|
|
20295
|
-
|
|
20296
|
-
size: SpinnerSize.SIZE_LARGE
|
|
20297
|
-
}, {
|
|
20298
|
-
children: t("loading.shipment")
|
|
20299
|
-
}));
|
|
20285
|
+
if (salesOrders.data.length === 0) return jsx(Loader, {
|
|
20286
|
+
message: t("loading.importingSalesOrder")
|
|
20287
|
+
});
|
|
20288
|
+
if (shipments.isLoading) return jsx(Loader, {
|
|
20289
|
+
message: t("loading.shipment")
|
|
20290
|
+
});
|
|
20300
20291
|
if (shipments.errors) throw new Error(shipments.errors.map(e => e.message).join(", "));
|
|
20301
20292
|
if (!shipments.data) throw new Error(t("errorMessages.unableToLoad.shipment"));
|
|
20302
|
-
if (carriers.isLoading) return jsx(
|
|
20303
|
-
|
|
20304
|
-
}
|
|
20305
|
-
children: t("loading.carriers")
|
|
20306
|
-
}));
|
|
20293
|
+
if (carriers.isLoading) return jsx(Loader, {
|
|
20294
|
+
message: t("loading.carriers")
|
|
20295
|
+
});
|
|
20307
20296
|
const salesOrder = salesOrders.data[0];
|
|
20308
20297
|
const shipment = shipments.data.find(s => s.shipmentStatus === "pending");
|
|
20309
20298
|
return jsxs(Templates.SalesOrder, Object.assign({
|
|
@@ -20349,11 +20338,9 @@ const Shipment = ({
|
|
|
20349
20338
|
});
|
|
20350
20339
|
const warehouses = useListWarehouses();
|
|
20351
20340
|
const carriers = useListCarriers();
|
|
20352
|
-
if (!shipment.data && !shipment.errors) return jsx(
|
|
20353
|
-
|
|
20354
|
-
}
|
|
20355
|
-
children: t("loading.shipment")
|
|
20356
|
-
}));
|
|
20341
|
+
if (!shipment.data && !shipment.errors) return jsx(Loader, {
|
|
20342
|
+
message: t("loading.shipment")
|
|
20343
|
+
});
|
|
20357
20344
|
if (shipment.errors) throw new Error(shipment.errors.map(e => e.message).join(", "));
|
|
20358
20345
|
if (!shipment.data) throw new Error("errorMessages.unableToLoad.shipment");
|
|
20359
20346
|
const warehouse = (_b = warehouses.data) === null || _b === void 0 ? void 0 : _b.find(w => {
|
package/package.json
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipengine/elements",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"module": "./index.js",
|
|
5
5
|
"main": "./index.cjs",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@shipengine/elements-core": "0.4.
|
|
10
|
-
"@shipengine/elements-ui": "0.4.
|
|
11
|
-
"react": "^18.2.0"
|
|
12
|
-
"@packlink/giger": "^67.3.13"
|
|
9
|
+
"@shipengine/elements-core": "0.4.5",
|
|
10
|
+
"@shipengine/elements-ui": "0.4.5",
|
|
11
|
+
"react": "^18.2.0"
|
|
13
12
|
},
|
|
14
13
|
"peerDependencies": {}
|
|
15
14
|
}
|