@artaio/arta-browser 2.19.0 → 2.19.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/dist/ModalStatus.js +3 -4
- package/dist/arta.js +26 -39
- package/dist/bundle.js +1 -1
- package/dist/components/Date/SimpleDate.js +11 -11
- package/dist/components/Date/index.js +13 -13
- package/dist/components/Destination/countriesWithoutPostalCode.js +5 -4
- package/dist/components/Destination/index.js +20 -25
- package/dist/components/Disqualified/index.js +15 -14
- package/dist/components/DrawerFooter/index.js +7 -6
- package/dist/components/DrawerHeader/index.js +8 -8
- package/dist/components/DrawerInsurance/index.js +7 -6
- package/dist/components/Footer/index.js +7 -7
- package/dist/components/Header/index.js +7 -7
- package/dist/components/Invalidated/index.js +7 -7
- package/dist/components/Loading/index.js +7 -6
- package/dist/components/Modal/index.css.js +7 -0
- package/dist/components/Modal/index.d.ts +0 -1
- package/dist/components/Modal/index.js +67 -132
- package/dist/components/Package/index.js +24 -25
- package/dist/components/PackageEvents/index.js +43 -88
- package/dist/components/Pill/index.js +8 -8
- package/dist/components/Quotes/index.js +26 -25
- package/dist/components/SelectTrackingShipment/index.js +31 -35
- package/dist/components/ShipToFrom/index.js +13 -13
- package/dist/components/ShipmentException/icons/ExceptionIcon.js +12 -12
- package/dist/components/ShipmentException/icons/HexagonAlertBase.js +7 -7
- package/dist/components/ShipmentException/icons/HexagonPauseBase.js +7 -7
- package/dist/components/ShipmentException/icons/HexagonStopBase.js +7 -7
- package/dist/components/ShipmentException/index.js +25 -27
- package/dist/components/Summary/index.js +7 -7
- package/dist/components/Timeline/CheckedStep.js +12 -12
- package/dist/components/Timeline/CheckedSteps.js +7 -7
- package/dist/components/Timeline/EmptyStep.js +7 -7
- package/dist/components/Timeline/SecondaryStep.js +7 -7
- package/dist/components/Timeline/SecondarySteps.js +7 -7
- package/dist/components/Timeline/TimelineDefault.js +22 -22
- package/dist/components/Timeline/TimlineMinimal.js +24 -25
- package/dist/components/Timeline/defaultIcons/CancelledIcon.js +8 -8
- package/dist/components/Timeline/defaultIcons/CollectedIcon.js +9 -9
- package/dist/components/Timeline/defaultIcons/CompletedIcon.js +9 -9
- package/dist/components/Timeline/defaultIcons/ConfirmedIcon.js +9 -9
- package/dist/components/Timeline/defaultIcons/InTransitIcon.js +9 -9
- package/dist/components/Timeline/defaultIcons/PendingIcon.js +8 -8
- package/dist/components/Timeline/icons/CancelledIconBase.js +7 -7
- package/dist/components/Timeline/icons/CollectedIconBase.js +7 -7
- package/dist/components/Timeline/icons/CompletedIconBase.js +7 -7
- package/dist/components/Timeline/icons/ConfirmedIconBase.js +7 -7
- package/dist/components/Timeline/icons/InTransitIconBase.js +7 -7
- package/dist/components/Timeline/icons/PendingIconBase.js +7 -7
- package/dist/components/Timeline/index.js +9 -9
- package/dist/components/TrackingDrawer/index.css.js +7 -0
- package/dist/components/TrackingDrawer/index.d.ts +0 -1
- package/dist/components/TrackingDrawer/index.js +33 -81
- package/dist/components/TrackingShipment/index.js +27 -66
- package/dist/components/TrackingTop/index.js +14 -14
- package/dist/estimate.js +41 -83
- package/dist/estimateConfig.js +16 -14
- package/dist/fixtures/countries.js +5 -4
- package/dist/helper.js +61 -64
- package/dist/index.js +15 -34
- package/dist/requests.js +71 -191
- package/dist/tracking.js +77 -128
- package/dist/trackingConfig.js +11 -9
- package/package.json +8 -5
- package/dist/MetadataTypes.js +0 -2
- package/dist/typing.js +0 -1
|
@@ -1,84 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.TrackingDrawer = void 0;
|
|
40
|
-
var jsx_runtime_1 = require("preact/jsx-runtime");
|
|
41
|
-
var hooks_1 = require("preact/hooks");
|
|
42
|
-
var helper_1 = require("../../helper");
|
|
43
|
-
var DrawerHeader_1 = require("../DrawerHeader");
|
|
44
|
-
require("./index.css");
|
|
45
|
-
var requests_1 = require("../../requests");
|
|
46
|
-
var DrawerFooter_1 = require("../DrawerFooter");
|
|
47
|
-
var TrackingShipment_1 = require("../TrackingShipment");
|
|
48
|
-
var SelectTrackingShipment_1 = require("../SelectTrackingShipment");
|
|
49
|
-
var TrackingDrawer = function (_a) {
|
|
50
|
-
var shipmentIds = _a.shipmentIds, config = _a.config, onClose = _a.onClose;
|
|
51
|
-
var position = config.style.position;
|
|
52
|
-
var style = (0, helper_1.getTrackingStyle)(config);
|
|
53
|
-
var _b = (0, hooks_1.useState)(null), shipments = _b[0], setShipments = _b[1];
|
|
54
|
-
var _c = (0, hooks_1.useState)(null), selectedShipment = _c[0], setSelectedShipment = _c[1];
|
|
55
|
-
(0, hooks_1.useEffect)(function () {
|
|
56
|
-
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
57
|
-
var ships;
|
|
58
|
-
return __generator(this, function (_a) {
|
|
59
|
-
switch (_a.label) {
|
|
60
|
-
case 0: return [4 /*yield*/, Promise.all(shipmentIds.map(function (shipmentId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
61
|
-
return __generator(this, function (_a) {
|
|
62
|
-
switch (_a.label) {
|
|
63
|
-
case 0: return [4 /*yield*/, (0, requests_1.loadShipment)(config, shipmentId)];
|
|
64
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}); }))];
|
|
68
|
-
case 1:
|
|
69
|
-
ships = _a.sent();
|
|
70
|
-
setShipments(ships);
|
|
71
|
-
return [2 /*return*/];
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}); })();
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('preact/jsx-runtime');
|
|
4
|
+
var hooks = require('preact/hooks');
|
|
5
|
+
var helper = require('../../helper.js');
|
|
6
|
+
var index$1 = require('../DrawerHeader/index.js');
|
|
7
|
+
var index = require('./index.css.js');
|
|
8
|
+
var requests = require('../../requests.js');
|
|
9
|
+
var index$4 = require('../DrawerFooter/index.js');
|
|
10
|
+
var index$2 = require('../TrackingShipment/index.js');
|
|
11
|
+
var index$3 = require('../SelectTrackingShipment/index.js');
|
|
12
|
+
|
|
13
|
+
const TrackingDrawer = ({ shipmentIds, config, onClose, }) => {
|
|
14
|
+
const position = config.style.position;
|
|
15
|
+
const style = helper.getTrackingStyle(config);
|
|
16
|
+
const [shipments, setShipments] = hooks.useState(null);
|
|
17
|
+
const [selectedShipment, setSelectedShipment] = hooks.useState(null);
|
|
18
|
+
hooks.useEffect(() => {
|
|
19
|
+
(async () => {
|
|
20
|
+
const ships = await Promise.all(shipmentIds.map(async (shipmentId) => {
|
|
21
|
+
return await requests.loadShipment(config, shipmentId);
|
|
22
|
+
}));
|
|
23
|
+
setShipments(ships);
|
|
24
|
+
//TODO should we ship.packages.filter(pkg => pkg.objects?.length)); ??
|
|
25
|
+
})();
|
|
75
26
|
}, [shipmentIds]);
|
|
76
|
-
return ((
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
27
|
+
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("style", { children: index.default }), jsxRuntime.jsxs("div", { class: "artajs", children: [config.style.backdropEnabled && (jsxRuntime.jsx("div", { onClick: onClose, style: style, class: "artajs__drawer__backdrop" })), jsxRuntime.jsx("div", { style: style, class: `artajs__drawer ${position === 'left'
|
|
28
|
+
? 'artajs__drawer__left'
|
|
29
|
+
: 'artajs__drawer__right'}`, children: jsxRuntime.jsxs("div", { class: "artajs__tracking__out__wrapper", children: [jsxRuntime.jsx(index$1.DrawerHeader, { title: selectedShipment
|
|
30
|
+
? config.text.header.titleShipmentDetail
|
|
31
|
+
: shipments && shipments.length > 1
|
|
32
|
+
? config.text.header.titleShipmentList
|
|
33
|
+
: config.text.header.title, onClose: onClose, setSelectedShipment: setSelectedShipment, multiple: !!selectedShipment, config: config }), shipments?.length ? (shipments.length === 1 || selectedShipment ? (jsxRuntime.jsx(index$2.TrackingShipment, { shipment: selectedShipment ?? shipments[0], config: config })) : (jsxRuntime.jsx(index$3.SelectTrackingShipment, { shipments: shipments, config: config, setSelectedShipment: setSelectedShipment }))) : (jsxRuntime.jsxs("div", { class: "artajs__tracking__body", children: [jsxRuntime.jsx("div", { class: "artajs__drawer__loading" }), jsxRuntime.jsx(index$4.DrawerFooter, {})] }))] }) })] })] }));
|
|
83
34
|
};
|
|
35
|
+
|
|
84
36
|
exports.TrackingDrawer = TrackingDrawer;
|
|
@@ -1,73 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.TrackingShipment = exports.hasActiveException = void 0;
|
|
40
|
-
var jsx_runtime_1 = require("preact/jsx-runtime");
|
|
41
|
-
var hooks_1 = require("preact/hooks");
|
|
42
|
-
var ShipToFrom_1 = require("../ShipToFrom");
|
|
43
|
-
var Package_1 = require("../Package");
|
|
44
|
-
var Timeline_1 = require("../Timeline");
|
|
45
|
-
var TrackingTop_1 = require("../TrackingTop");
|
|
46
|
-
var DrawerFooter_1 = require("../DrawerFooter");
|
|
47
|
-
var DrawerInsurance_1 = require("../DrawerInsurance");
|
|
48
|
-
var Summary_1 = require("../Summary");
|
|
49
|
-
var ShipmentException_1 = require("../ShipmentException");
|
|
50
|
-
var PackageEvents_1 = require("../PackageEvents");
|
|
51
|
-
var hasActiveException = function (shipment) {
|
|
52
|
-
return (shipment.shipment_exceptions.some(function (ex) { return ex.status !== 'resolved'; }) &&
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('preact/jsx-runtime');
|
|
4
|
+
var hooks = require('preact/hooks');
|
|
5
|
+
var index$4 = require('../ShipToFrom/index.js');
|
|
6
|
+
var index$5 = require('../Package/index.js');
|
|
7
|
+
var index$1 = require('../Timeline/index.js');
|
|
8
|
+
var index$3 = require('../TrackingTop/index.js');
|
|
9
|
+
var index$8 = require('../DrawerFooter/index.js');
|
|
10
|
+
var index$6 = require('../DrawerInsurance/index.js');
|
|
11
|
+
var index$7 = require('../Summary/index.js');
|
|
12
|
+
var index$2 = require('../ShipmentException/index.js');
|
|
13
|
+
var index = require('../PackageEvents/index.js');
|
|
14
|
+
|
|
15
|
+
const hasActiveException = (shipment) => {
|
|
16
|
+
return (shipment.shipment_exceptions.some((ex) => ex.status !== 'resolved') &&
|
|
53
17
|
shipment.status !== 'completed');
|
|
54
18
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return __generator(this, function (_a) {
|
|
63
|
-
setPackagesWithObjects(shipment.packages);
|
|
64
|
-
return [2 /*return*/];
|
|
65
|
-
});
|
|
66
|
-
}); })();
|
|
19
|
+
const TrackingShipment = ({ shipment, config, }) => {
|
|
20
|
+
const [packagesWithObjects, setPackagesWithObjects] = hooks.useState([]);
|
|
21
|
+
const [packageId, setPackageId] = hooks.useState(null);
|
|
22
|
+
hooks.useEffect(() => {
|
|
23
|
+
(async () => {
|
|
24
|
+
setPackagesWithObjects(shipment.packages);
|
|
25
|
+
})();
|
|
67
26
|
}, [shipment]);
|
|
68
27
|
if (packageId != null) {
|
|
69
|
-
return (
|
|
28
|
+
return (jsxRuntime.jsx(index.PackageEvents, { packageId: packageId, shipment: shipment, config: config, setPackageId: setPackageId }));
|
|
70
29
|
}
|
|
71
|
-
return (
|
|
30
|
+
return (jsxRuntime.jsxs("div", { class: "artajs__tracking__body", children: [jsxRuntime.jsx(index$1.Timeline, { shipment: shipment, config: config }), jsxRuntime.jsx("div", { class: "artajs__tracking__timeline__divider" }), hasActiveException(shipment) && (jsxRuntime.jsx(index$2.ShipmentException, { shipment: shipment, config: config })), jsxRuntime.jsx(index$3.TrackingTop, { config: config, shipment: shipment }), jsxRuntime.jsx(index$4.ShipToFrom, { config: config, shipment: shipment }), packagesWithObjects.map((pkg, index) => (jsxRuntime.jsx(index$5.Package, { title: `#${index + 1}`, pkg: pkg, shipment: shipment, config: config, setPackageId: setPackageId }))), shipment.insurance_policy != null && jsxRuntime.jsx(index$6.DrawerInsurance, {}), jsxRuntime.jsx(index$7.Summary, { config: config, shipment: shipment }), jsxRuntime.jsx(index$8.DrawerFooter, {})] }));
|
|
72
31
|
};
|
|
32
|
+
|
|
73
33
|
exports.TrackingShipment = TrackingShipment;
|
|
34
|
+
exports.hasActiveException = hasActiveException;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('preact/jsx-runtime');
|
|
4
|
+
var index = require('../Date/index.js');
|
|
5
|
+
|
|
6
|
+
const getLabelAndDates = (shipment, config) => {
|
|
7
7
|
if (shipment.status === 'completed') {
|
|
8
8
|
return {
|
|
9
9
|
label: config.text.completedCTA,
|
|
@@ -17,8 +17,8 @@ var getLabelAndDates = function (shipment, config) {
|
|
|
17
17
|
dates: null,
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const start = shipment.delivery_start != null ? new Date(shipment.delivery_start) : null;
|
|
21
|
+
const end = shipment.delivery_end != null ? new Date(shipment.delivery_end) : null;
|
|
22
22
|
if (start == null && end == null) {
|
|
23
23
|
return {
|
|
24
24
|
label: config.text.checkBackLater,
|
|
@@ -54,11 +54,11 @@ var getLabelAndDates = function (shipment, config) {
|
|
|
54
54
|
dates: null,
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var parsedDates = dates === null || dates === void 0 ? void 0 : dates.map(Date_1.parseStringDate);
|
|
62
|
-
return ((0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__top__wrapper", children: (0, jsx_runtime_1.jsxs)("div", { class: "artajs__tracking__top__divider", children: [(0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__top__cta", children: (0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__top__text", children: label }) }), parsedDates != null && parsedDates.length === 1 && ((0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__top__date__wrapper", children: (0, jsx_runtime_1.jsxs)("div", { class: "artajs__tracking__top__date__aligner", children: [(0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__top__date__day", children: "".concat(config.text.dates.weekdays[parsedDates[0].weekday], ", ").concat(config.text.dates.months[parsedDates[0].month]) }), (0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__top__date__day__numeric", children: "".concat(parsedDates[0].day).padStart(2, '0') })] }) })), parsedDates != null && parsedDates.length === 2 && ((0, jsx_runtime_1.jsxs)("div", { class: "artajs__tracking__top__date__wrapper", children: [(0, jsx_runtime_1.jsxs)("div", { class: "artajs__tracking__top__date__aligner", children: [(0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__top__date__day", children: "".concat(config.text.dates.weekdays[parsedDates[0].weekday], ", ").concat(config.text.dates.months[parsedDates[0].month]) }), (0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__top__date__day__numeric", children: "".concat(parsedDates[0].day).padStart(2, '0') })] }), (0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__top__date__aligner", children: (0, jsx_runtime_1.jsx)("div", { class: "artajas__tracking__top__date__and", children: config.text.inTransitCTAAndLabel }) }), (0, jsx_runtime_1.jsxs)("div", { class: "artajs__tracking__top__date__aligner", children: [(0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__top__date__day", children: "".concat(config.text.dates.weekdays[parsedDates[1].weekday], ", ").concat(config.text.dates.months[parsedDates[1].month]) }), (0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__top__date__day__numeric", children: "".concat(parsedDates[1].day).padStart(2, '0') })] })] }))] }) }));
|
|
57
|
+
const TrackingTop = ({ shipment, config }) => {
|
|
58
|
+
const { label, dates } = getLabelAndDates(shipment, config);
|
|
59
|
+
const parsedDates = dates?.map(index.parseStringDate);
|
|
60
|
+
return (jsxRuntime.jsx("div", { class: "artajs__tracking__top__wrapper", children: jsxRuntime.jsxs("div", { class: "artajs__tracking__top__divider", children: [jsxRuntime.jsx("div", { class: "artajs__tracking__top__cta", children: jsxRuntime.jsx("div", { class: "artajs__tracking__top__text", children: label }) }), parsedDates != null && parsedDates.length === 1 && (jsxRuntime.jsx("div", { class: "artajs__tracking__top__date__wrapper", children: jsxRuntime.jsxs("div", { class: "artajs__tracking__top__date__aligner", children: [jsxRuntime.jsx("div", { class: "artajs__tracking__top__date__day", children: `${config.text.dates.weekdays[parsedDates[0].weekday]}, ${config.text.dates.months[parsedDates[0].month]}` }), jsxRuntime.jsx("div", { class: "artajs__tracking__top__date__day__numeric", children: `${parsedDates[0].day}`.padStart(2, '0') })] }) })), parsedDates != null && parsedDates.length === 2 && (jsxRuntime.jsxs("div", { class: "artajs__tracking__top__date__wrapper", children: [jsxRuntime.jsxs("div", { class: "artajs__tracking__top__date__aligner", children: [jsxRuntime.jsx("div", { class: "artajs__tracking__top__date__day", children: `${config.text.dates.weekdays[parsedDates[0].weekday]}, ${config.text.dates.months[parsedDates[0].month]}` }), jsxRuntime.jsx("div", { class: "artajs__tracking__top__date__day__numeric", children: `${parsedDates[0].day}`.padStart(2, '0') })] }), jsxRuntime.jsx("div", { class: "artajs__tracking__top__date__aligner", children: jsxRuntime.jsx("div", { class: "artajas__tracking__top__date__and", children: config.text.inTransitCTAAndLabel }) }), jsxRuntime.jsxs("div", { class: "artajs__tracking__top__date__aligner", children: [jsxRuntime.jsx("div", { class: "artajs__tracking__top__date__day", children: `${config.text.dates.weekdays[parsedDates[1].weekday]}, ${config.text.dates.months[parsedDates[1].month]}` }), jsxRuntime.jsx("div", { class: "artajs__tracking__top__date__day__numeric", children: `${parsedDates[1].day}`.padStart(2, '0') })] })] }))] }) }));
|
|
63
61
|
};
|
|
62
|
+
|
|
64
63
|
exports.TrackingTop = TrackingTop;
|
|
64
|
+
exports.getLabelAndDates = getLabelAndDates;
|
package/dist/estimate.js
CHANGED
|
@@ -1,99 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
var jsx_runtime_1 = require("preact/jsx-runtime");
|
|
40
|
-
var preact_1 = require("preact");
|
|
41
|
-
var Modal_1 = require("./components/Modal");
|
|
42
|
-
var requests_1 = require("./requests");
|
|
43
|
-
var helper_1 = require("./helper");
|
|
44
|
-
var Estimate = /** @class */ (function () {
|
|
45
|
-
function Estimate(estimateBody, config, el) {
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('preact/jsx-runtime');
|
|
6
|
+
var preact = require('preact');
|
|
7
|
+
var index = require('./components/Modal/index.js');
|
|
8
|
+
var requests = require('./requests.js');
|
|
9
|
+
var helper = require('./helper.js');
|
|
10
|
+
|
|
11
|
+
class Estimate {
|
|
12
|
+
estimateBody;
|
|
13
|
+
config;
|
|
14
|
+
el;
|
|
15
|
+
isReady = false;
|
|
16
|
+
isOpen = false;
|
|
17
|
+
addedOrientationChangeListener = false;
|
|
18
|
+
constructor(estimateBody, config, el) {
|
|
46
19
|
this.estimateBody = estimateBody;
|
|
47
20
|
this.config = config;
|
|
48
21
|
this.el = el;
|
|
49
|
-
this.isReady = false;
|
|
50
|
-
this.isOpen = false;
|
|
51
|
-
this.addedOrientationChangeListener = false;
|
|
52
22
|
}
|
|
53
|
-
|
|
54
|
-
var _this = this;
|
|
23
|
+
open() {
|
|
55
24
|
if (!this.addedOrientationChangeListener) {
|
|
56
|
-
window.screen.orientation.addEventListener('change',
|
|
57
|
-
|
|
58
|
-
if (
|
|
59
|
-
|
|
25
|
+
window.screen.orientation.addEventListener('change', () => {
|
|
26
|
+
helper.applySmallMobileStyling(this.config);
|
|
27
|
+
if (this.isOpen) {
|
|
28
|
+
this.render();
|
|
60
29
|
}
|
|
61
30
|
});
|
|
62
31
|
this.addedOrientationChangeListener = true;
|
|
63
32
|
}
|
|
64
33
|
this.render();
|
|
65
34
|
this.isOpen = true;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
(0, preact_1.render)((0, jsx_runtime_1.jsx)("div", {}), this.el);
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
preact.render(jsxRuntime.jsx(index.Modal, { onClose: this.config.onClose ?? this.onClose.bind(this), estimateBody: this.estimateBody, config: this.config }), this.el);
|
|
38
|
+
}
|
|
39
|
+
close() {
|
|
40
|
+
preact.render(jsxRuntime.jsx("div", {}), this.el);
|
|
73
41
|
this.isOpen = false;
|
|
74
|
-
}
|
|
75
|
-
|
|
42
|
+
}
|
|
43
|
+
onClose(e) {
|
|
76
44
|
e.preventDefault();
|
|
77
45
|
this.close();
|
|
78
46
|
this.isOpen = false;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return [2 /*return*/, Promise.reject(errors)];
|
|
90
|
-
}
|
|
91
|
-
this.isReady = true;
|
|
92
|
-
return [2 /*return*/];
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
return Estimate;
|
|
98
|
-
}());
|
|
47
|
+
}
|
|
48
|
+
async validate() {
|
|
49
|
+
const errors = await requests.validateEstimateBody(this.config, this.estimateBody);
|
|
50
|
+
if (errors && Object.keys(errors).length > 0) {
|
|
51
|
+
return Promise.reject(errors);
|
|
52
|
+
}
|
|
53
|
+
this.isReady = true;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
99
57
|
exports.default = Estimate;
|
package/dist/estimateConfig.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index$2 = require('./components/Destination/index.js');
|
|
4
|
+
var index = require('./components/Disqualified/index.js');
|
|
5
|
+
var index$1 = require('./components/Quotes/index.js');
|
|
6
|
+
var helper = require('./helper.js');
|
|
7
|
+
|
|
8
|
+
const defaultEstimateConfig = {
|
|
9
9
|
style: {
|
|
10
10
|
color: {
|
|
11
11
|
background: '#FFFFFF',
|
|
@@ -38,18 +38,20 @@ exports.defaultEstimateConfig = {
|
|
|
38
38
|
header: {
|
|
39
39
|
title: 'Estimate Shipping Costs',
|
|
40
40
|
},
|
|
41
|
-
destination:
|
|
42
|
-
quoted:
|
|
43
|
-
disqualified:
|
|
41
|
+
destination: index$2.defaultDestinationConfig,
|
|
42
|
+
quoted: index$1.defaultQuoteConfig,
|
|
43
|
+
disqualified: index.defaultDisqualifiedConfig,
|
|
44
44
|
invalidated: {
|
|
45
45
|
message: 'Unfortunately we could not successfully geocode the origin location to provide a shipping estimate.',
|
|
46
46
|
detail: 'The address may be missing components or invalid.',
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
const getFullEstimateConfig = (artaConfig, estimateConfig) => {
|
|
51
|
+
const finalConfig = helper.nestedObjectAssign(helper.deepClone(defaultEstimateConfig), artaConfig, helper.deepClean(estimateConfig));
|
|
52
|
+
helper.applySmallMobileStyling(finalConfig);
|
|
53
53
|
return finalConfig;
|
|
54
54
|
};
|
|
55
|
+
|
|
56
|
+
exports.defaultEstimateConfig = defaultEstimateConfig;
|
|
55
57
|
exports.getFullEstimateConfig = getFullEstimateConfig;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.countries = [
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const countries = [
|
|
5
4
|
{ code: 'AF', name: 'Afghanistan' },
|
|
6
5
|
{ code: 'AX', name: 'Aland Islands' },
|
|
7
6
|
{ code: 'AL', name: 'Albania' },
|
|
@@ -248,3 +247,5 @@ exports.countries = [
|
|
|
248
247
|
{ code: 'ZM', name: 'Zambia' },
|
|
249
248
|
{ code: 'ZW', name: 'Zimbabwe' },
|
|
250
249
|
];
|
|
250
|
+
|
|
251
|
+
exports.countries = countries;
|