@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.
Files changed (66) hide show
  1. package/dist/ModalStatus.js +3 -4
  2. package/dist/arta.js +26 -39
  3. package/dist/bundle.js +1 -1
  4. package/dist/components/Date/SimpleDate.js +11 -11
  5. package/dist/components/Date/index.js +13 -13
  6. package/dist/components/Destination/countriesWithoutPostalCode.js +5 -4
  7. package/dist/components/Destination/index.js +20 -25
  8. package/dist/components/Disqualified/index.js +15 -14
  9. package/dist/components/DrawerFooter/index.js +7 -6
  10. package/dist/components/DrawerHeader/index.js +8 -8
  11. package/dist/components/DrawerInsurance/index.js +7 -6
  12. package/dist/components/Footer/index.js +7 -7
  13. package/dist/components/Header/index.js +7 -7
  14. package/dist/components/Invalidated/index.js +7 -7
  15. package/dist/components/Loading/index.js +7 -6
  16. package/dist/components/Modal/index.css.js +7 -0
  17. package/dist/components/Modal/index.d.ts +0 -1
  18. package/dist/components/Modal/index.js +67 -132
  19. package/dist/components/Package/index.js +24 -25
  20. package/dist/components/PackageEvents/index.js +43 -88
  21. package/dist/components/Pill/index.js +8 -8
  22. package/dist/components/Quotes/index.js +26 -25
  23. package/dist/components/SelectTrackingShipment/index.js +31 -35
  24. package/dist/components/ShipToFrom/index.js +13 -13
  25. package/dist/components/ShipmentException/icons/ExceptionIcon.js +12 -12
  26. package/dist/components/ShipmentException/icons/HexagonAlertBase.js +7 -7
  27. package/dist/components/ShipmentException/icons/HexagonPauseBase.js +7 -7
  28. package/dist/components/ShipmentException/icons/HexagonStopBase.js +7 -7
  29. package/dist/components/ShipmentException/index.js +25 -27
  30. package/dist/components/Summary/index.js +7 -7
  31. package/dist/components/Timeline/CheckedStep.js +12 -12
  32. package/dist/components/Timeline/CheckedSteps.js +7 -7
  33. package/dist/components/Timeline/EmptyStep.js +7 -7
  34. package/dist/components/Timeline/SecondaryStep.js +7 -7
  35. package/dist/components/Timeline/SecondarySteps.js +7 -7
  36. package/dist/components/Timeline/TimelineDefault.js +22 -22
  37. package/dist/components/Timeline/TimlineMinimal.js +24 -25
  38. package/dist/components/Timeline/defaultIcons/CancelledIcon.js +8 -8
  39. package/dist/components/Timeline/defaultIcons/CollectedIcon.js +9 -9
  40. package/dist/components/Timeline/defaultIcons/CompletedIcon.js +9 -9
  41. package/dist/components/Timeline/defaultIcons/ConfirmedIcon.js +9 -9
  42. package/dist/components/Timeline/defaultIcons/InTransitIcon.js +9 -9
  43. package/dist/components/Timeline/defaultIcons/PendingIcon.js +8 -8
  44. package/dist/components/Timeline/icons/CancelledIconBase.js +7 -7
  45. package/dist/components/Timeline/icons/CollectedIconBase.js +7 -7
  46. package/dist/components/Timeline/icons/CompletedIconBase.js +7 -7
  47. package/dist/components/Timeline/icons/ConfirmedIconBase.js +7 -7
  48. package/dist/components/Timeline/icons/InTransitIconBase.js +7 -7
  49. package/dist/components/Timeline/icons/PendingIconBase.js +7 -7
  50. package/dist/components/Timeline/index.js +9 -9
  51. package/dist/components/TrackingDrawer/index.css.js +7 -0
  52. package/dist/components/TrackingDrawer/index.d.ts +0 -1
  53. package/dist/components/TrackingDrawer/index.js +33 -81
  54. package/dist/components/TrackingShipment/index.js +27 -66
  55. package/dist/components/TrackingTop/index.js +14 -14
  56. package/dist/estimate.js +41 -83
  57. package/dist/estimateConfig.js +16 -14
  58. package/dist/fixtures/countries.js +5 -4
  59. package/dist/helper.js +61 -64
  60. package/dist/index.js +15 -34
  61. package/dist/requests.js +71 -191
  62. package/dist/tracking.js +77 -128
  63. package/dist/trackingConfig.js +11 -9
  64. package/package.json +8 -5
  65. package/dist/MetadataTypes.js +0 -2
  66. package/dist/typing.js +0 -1
@@ -1,138 +1,73 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
24
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
- 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;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('preact/jsx-runtime');
4
+ var index$1 = require('../Header/index.js');
5
+ var index$4 = require('../Destination/index.js');
6
+ var index$3 = require('../Footer/index.js');
7
+ var hooks = require('preact/hooks');
8
+ var index = require('./index.css.js');
9
+ var index$2 = require('../Loading/index.js');
10
+ var index$5 = require('../Quotes/index.js');
11
+ var helper = require('../../helper.js');
12
+ var requests = require('../../requests.js');
13
+ var index$7 = require('../Disqualified/index.js');
14
+ var ModalStatus = require('../../ModalStatus.js');
15
+ var index$6 = require('../Invalidated/index.js');
16
+
17
+ const Modal = ({ estimateBody, onClose, config }) => {
18
+ const position = config.style.position;
19
+ const [destination, setDestination] = hooks.useState();
20
+ const [parsedOrigin, setParsedOrigin] = hooks.useState('');
21
+ const [status, setStatus] = hooks.useState(ModalStatus.ModalStatus.LOADING);
22
+ const [hostedSession, setHostedSession] = hooks.useState();
23
+ const [quoteRequest, setQuoteRequest] = hooks.useState();
24
+ const [errors, setErrors] = hooks.useState();
25
+ const style = helper.getEstimateStyle(config);
26
+ hooks.useEffect(() => {
27
+ (async () => {
28
+ setErrors([]);
29
+ setStatus(ModalStatus.ModalStatus.LOADING);
30
+ const session = await requests.loadHostedSessions(config, estimateBody);
31
+ setHostedSession(session);
32
+ setParsedOrigin(helper.parseEstimatedLocation(session.origin));
33
+ if (!session.origin.estimated_city) {
34
+ setStatus(ModalStatus.ModalStatus.INVALIDATED);
35
+ return;
43
36
  }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.Modal = void 0;
51
- var jsx_runtime_1 = require("preact/jsx-runtime");
52
- var Header_1 = require("../Header");
53
- var Destination_1 = require("../Destination");
54
- var Footer_1 = require("../Footer");
55
- var hooks_1 = require("preact/hooks");
56
- require("./index.css");
57
- var Loading_1 = require("../Loading");
58
- var Quotes_1 = require("../Quotes");
59
- var helper_1 = require("../../helper");
60
- var requests_1 = require("../../requests");
61
- var Disqualified_1 = require("../Disqualified");
62
- var ModalStatus_1 = require("../../ModalStatus");
63
- var Invalidated_1 = require("../Invalidated");
64
- var Modal = function (_a) {
65
- var estimateBody = _a.estimateBody, onClose = _a.onClose, config = _a.config;
66
- var position = config.style.position;
67
- var _b = (0, hooks_1.useState)(), destination = _b[0], setDestination = _b[1];
68
- var _c = (0, hooks_1.useState)(''), parsedOrigin = _c[0], setParsedOrigin = _c[1];
69
- var _d = (0, hooks_1.useState)(ModalStatus_1.ModalStatus.LOADING), status = _d[0], setStatus = _d[1];
70
- var _e = (0, hooks_1.useState)(), hostedSession = _e[0], setHostedSession = _e[1];
71
- var _f = (0, hooks_1.useState)(), quoteRequest = _f[0], setQuoteRequest = _f[1];
72
- var _g = (0, hooks_1.useState)(), errors = _g[0], setErrors = _g[1];
73
- var style = (0, helper_1.getEstimateStyle)(config);
74
- (0, hooks_1.useEffect)(function () {
75
- (function () { return __awaiter(void 0, void 0, void 0, function () {
76
- var session;
77
- return __generator(this, function (_a) {
78
- switch (_a.label) {
79
- case 0:
80
- setErrors([]);
81
- setStatus(ModalStatus_1.ModalStatus.LOADING);
82
- return [4 /*yield*/, (0, requests_1.loadHostedSessions)(config, estimateBody)];
83
- case 1:
84
- session = _a.sent();
85
- setHostedSession(session);
86
- setParsedOrigin((0, helper_1.parseEstimatedLocation)(session.origin));
87
- if (!session.origin.estimated_city) {
88
- setStatus(ModalStatus_1.ModalStatus.INVALIDATED);
89
- return [2 /*return*/];
90
- }
91
- setStatus(ModalStatus_1.ModalStatus.OPEN);
92
- return [2 /*return*/];
93
- }
94
- });
95
- }); })();
37
+ setStatus(ModalStatus.ModalStatus.OPEN);
38
+ })();
96
39
  }, [estimateBody.origin, estimateBody.objects]);
97
- (0, hooks_1.useEffect)(function () {
98
- (function () { return __awaiter(void 0, void 0, void 0, function () {
99
- var esimate, sess, req, errorMessages;
100
- return __generator(this, function (_a) {
101
- switch (_a.label) {
102
- case 0:
103
- setErrors([]);
104
- if (!destination) {
105
- return [2 /*return*/];
106
- }
107
- setStatus(ModalStatus_1.ModalStatus.LOADING);
108
- esimate = __assign(__assign({}, estimateBody), { destination: destination });
109
- sess = hostedSession
110
- ? hostedSession
111
- : { id: '', private_token: '', origin: estimateBody.origin };
112
- return [4 /*yield*/, (0, requests_1.loadQuoteRequests)(config, sess, esimate)];
113
- case 1:
114
- req = _a.sent();
115
- if (req.err) {
116
- errorMessages = (0, helper_1.parseErrors)(req.err.errors);
117
- setErrors(errorMessages);
118
- setStatus(ModalStatus_1.ModalStatus.OPEN);
119
- }
120
- else {
121
- setQuoteRequest(req);
122
- if (req.quotes && req.quotes.length > 0) {
123
- setStatus(ModalStatus_1.ModalStatus.QUOTED);
124
- }
125
- else {
126
- setStatus(ModalStatus_1.ModalStatus.DISQUALIFIED);
127
- }
128
- }
129
- return [2 /*return*/];
40
+ hooks.useEffect(() => {
41
+ (async () => {
42
+ setErrors([]);
43
+ if (!destination) {
44
+ return;
45
+ }
46
+ setStatus(ModalStatus.ModalStatus.LOADING);
47
+ const esimate = { ...estimateBody, destination };
48
+ const sess = hostedSession
49
+ ? hostedSession
50
+ : { id: '', private_token: '', origin: estimateBody.origin };
51
+ const req = await requests.loadQuoteRequests(config, sess, esimate);
52
+ if (req.err) {
53
+ const errorMessages = helper.parseErrors(req.err.errors);
54
+ setErrors(errorMessages);
55
+ setStatus(ModalStatus.ModalStatus.OPEN);
56
+ }
57
+ else {
58
+ setQuoteRequest(req);
59
+ if (req.quotes && req.quotes.length > 0) {
60
+ setStatus(ModalStatus.ModalStatus.QUOTED);
130
61
  }
131
- });
132
- }); })();
62
+ else {
63
+ setStatus(ModalStatus.ModalStatus.DISQUALIFIED);
64
+ }
65
+ }
66
+ })();
133
67
  }, [destination]);
134
- return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", { class: "artajs", children: [position === 'center' && ((0, jsx_runtime_1.jsx)("div", { class: "artajs__modal__backdrop", onClick: onClose })), (0, jsx_runtime_1.jsxs)("div", { class: "artajs__modal artajs__modal__".concat(position), style: style, children: [(0, jsx_runtime_1.jsx)(Header_1.Header, { onClose: onClose, title: config.text.header.title, lineColor: config.style.color.border }), status === ModalStatus_1.ModalStatus.LOADING && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(Loading_1.Loading, {}), (0, jsx_runtime_1.jsx)(Footer_1.Footer, { absolute: true })] })), status === ModalStatus_1.ModalStatus.OPEN && ((0, jsx_runtime_1.jsx)(Destination_1.Destination, { parsedOrigin: parsedOrigin, textConfig: (0, helper_1.getDestinationConfig)(config), setDestination: setDestination })), status === ModalStatus_1.ModalStatus.QUOTED && quoteRequest && ((0, jsx_runtime_1.jsx)(Quotes_1.Quotes, { quoteRequest: quoteRequest, showCostRange: config.style.pricingDisplay === 'range', textConfig: (0, helper_1.getQuoteConfig)(config), setStatus: setStatus })), status === ModalStatus_1.ModalStatus.INVALIDATED && ((0, jsx_runtime_1.jsx)(Invalidated_1.Invalidated, { message: config.text.invalidated.message, detail: config.text.invalidated.detail })), status === ModalStatus_1.ModalStatus.DISQUALIFIED && quoteRequest && ((0, jsx_runtime_1.jsx)(Disqualified_1.Disqualified, { quoteRequest: quoteRequest, textConfig: (0, helper_1.getDisqualifiedConfig)(config), setStatus: setStatus })), status !== ModalStatus_1.ModalStatus.LOADING && (0, jsx_runtime_1.jsx)(Footer_1.Footer, {}), errors && errors.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { class: "artajs__modal__error__container", children: [(0, jsx_runtime_1.jsx)("div", { class: "artajs__modal__error", children: errors.map(function (error, i) {
135
- return (0, jsx_runtime_1.jsx)("span", { children: error }, "arta-error-".concat(i));
136
- }) }), (0, jsx_runtime_1.jsx)("div", { className: "artajs__modal__error__close", children: (0, jsx_runtime_1.jsx)("a", { onClick: function () { return setErrors([]); }, href: "#", children: (0, jsx_runtime_1.jsxs)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("line", { x1: "6.70711", y1: "6.29289", x2: "18.0208", y2: "17.6066", "stroke-width": "2" }), (0, jsx_runtime_1.jsx)("line", { x1: "6.29289", y1: "17.6066", x2: "17.6066", y2: "6.29291", "stroke-width": "2" })] }) }) })] }))] })] }) }));
68
+ return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("style", { children: index.default }), jsxRuntime.jsxs("div", { class: "artajs", children: [position === 'center' && (jsxRuntime.jsx("div", { class: "artajs__modal__backdrop", onClick: onClose })), jsxRuntime.jsxs("div", { class: `artajs__modal artajs__modal__${position}`, style: style, children: [jsxRuntime.jsx(index$1.Header, { onClose: onClose, title: config.text.header.title, lineColor: config.style.color.border }), status === ModalStatus.ModalStatus.LOADING && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(index$2.Loading, {}), jsxRuntime.jsx(index$3.Footer, { absolute: true })] })), status === ModalStatus.ModalStatus.OPEN && (jsxRuntime.jsx(index$4.Destination, { parsedOrigin: parsedOrigin, textConfig: helper.getDestinationConfig(config), setDestination: setDestination })), status === ModalStatus.ModalStatus.QUOTED && quoteRequest && (jsxRuntime.jsx(index$5.Quotes, { quoteRequest: quoteRequest, showCostRange: config.style.pricingDisplay === 'range', textConfig: helper.getQuoteConfig(config), setStatus: setStatus })), status === ModalStatus.ModalStatus.INVALIDATED && (jsxRuntime.jsx(index$6.Invalidated, { message: config.text.invalidated.message, detail: config.text.invalidated.detail })), status === ModalStatus.ModalStatus.DISQUALIFIED && quoteRequest && (jsxRuntime.jsx(index$7.Disqualified, { quoteRequest: quoteRequest, textConfig: helper.getDisqualifiedConfig(config), setStatus: setStatus })), status !== ModalStatus.ModalStatus.LOADING && jsxRuntime.jsx(index$3.Footer, {}), errors && errors.length > 0 && (jsxRuntime.jsxs("div", { class: "artajs__modal__error__container", children: [jsxRuntime.jsx("div", { class: "artajs__modal__error", children: errors.map((error, i) => {
69
+ return jsxRuntime.jsx("span", { children: error }, `arta-error-${i}`);
70
+ }) }), jsxRuntime.jsx("div", { className: "artajs__modal__error__close", children: jsxRuntime.jsx("a", { onClick: () => setErrors([]), href: "#", children: jsxRuntime.jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("line", { x1: "6.70711", y1: "6.29289", x2: "18.0208", y2: "17.6066", "stroke-width": "2" }), jsxRuntime.jsx("line", { x1: "6.29289", y1: "17.6066", x2: "17.6066", y2: "6.29291", "stroke-width": "2" })] }) }) })] }))] })] })] }));
137
71
  };
72
+
138
73
  exports.Modal = Modal;
@@ -1,18 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Package = exports.objectDetailTitle = void 0;
4
- var jsx_runtime_1 = require("preact/jsx-runtime");
5
- var Pill_1 = require("../Pill");
6
- var objectDetailTitle = function (obj, config) {
7
- var _a, _b, _c;
8
- if (((_a = obj.details) === null || _a === void 0 ? void 0 : _a.title) == null &&
9
- ((_b = obj.details) === null || _b === void 0 ? void 0 : _b.creator) == null &&
10
- ((_c = obj.details) === null || _c === void 0 ? void 0 : _c.creation_date) == null) {
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('preact/jsx-runtime');
4
+ var index = require('../Pill/index.js');
5
+
6
+ const objectDetailTitle = (obj, config) => {
7
+ if (obj.details?.title == null &&
8
+ obj.details?.creator == null &&
9
+ obj.details?.creation_date == null) {
11
10
  return config.text.noObjectDetailsTitle;
12
11
  }
13
- var formattedString = '';
12
+ let formattedString = '';
14
13
  if (obj.details.title && obj.details.creator) {
15
- formattedString = "".concat(obj.details.title, ": ").concat(obj.details.creator);
14
+ formattedString = `${obj.details.title}: ${obj.details.creator}`;
16
15
  }
17
16
  else if (obj.details.title) {
18
17
  formattedString = obj.details.title;
@@ -26,28 +25,28 @@ var objectDetailTitle = function (obj, config) {
26
25
  }
27
26
  return formattedString;
28
27
  };
29
- exports.objectDetailTitle = objectDetailTitle;
30
- var Package = function (_a) {
31
- var config = _a.config, shipment = _a.shipment, pkg = _a.pkg, title = _a.title, setPackageId = _a.setPackageId;
32
- var pkgTracking = shipment.tracking.find(function (t) { return t.package_id === pkg.id; });
33
- return ((0, jsx_runtime_1.jsx)("div", { class: "artajs__packings__wrapper", children: (0, jsx_runtime_1.jsxs)("div", { class: "artajs__packings__spacer", children: [(0, jsx_runtime_1.jsx)("div", { class: "artajs__packings__spacer", children: (0, jsx_runtime_1.jsxs)("div", { class: "artajs__packings__header", children: [(0, jsx_runtime_1.jsxs)("div", { class: "artajs__packings__header__top", children: [(0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__header__text", children: title }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { config: config, status: pkg.status })] }), (pkgTracking === null || pkgTracking === void 0 ? void 0 : pkgTracking.carrier_name) && pkgTracking.tracking_number && ((0, jsx_runtime_1.jsx)("div", { class: "artajs__packings__header__body", children: pkgTracking.url ? ((0, jsx_runtime_1.jsxs)("div", { onClick: function (e) {
28
+ const Package = ({ config, shipment, pkg, title, setPackageId, }) => {
29
+ const pkgTracking = shipment.tracking.find((t) => t.package_id === pkg.id);
30
+ return (jsxRuntime.jsx("div", { class: "artajs__packings__wrapper", children: jsxRuntime.jsxs("div", { class: "artajs__packings__spacer", children: [jsxRuntime.jsx("div", { class: "artajs__packings__spacer", children: jsxRuntime.jsxs("div", { class: "artajs__packings__header", children: [jsxRuntime.jsxs("div", { class: "artajs__packings__header__top", children: [jsxRuntime.jsx("div", { class: "artajs__tracking__header__text", children: title }), jsxRuntime.jsx(index.Pill, { config: config, status: pkg.status })] }), pkgTracking?.carrier_name && pkgTracking.tracking_number && (jsxRuntime.jsx("div", { class: "artajs__packings__header__body", children: pkgTracking.url ? (jsxRuntime.jsxs("div", { onClick: (e) => {
34
31
  e.preventDefault();
35
32
  if (pkgTracking.url == null) {
36
33
  return;
37
34
  }
38
- var url = pkgTracking.url.startsWith('http')
35
+ const url = pkgTracking.url.startsWith('http')
39
36
  ? pkgTracking.url
40
- : "https://".concat(pkgTracking.url);
37
+ : `https://${pkgTracking.url}`;
41
38
  window.open(url, '_blank');
42
- }, className: "artajs__packings__text__regular__underline", children: [pkgTracking.carrier_name, " - ", pkgTracking.tracking_number] })) : ((0, jsx_runtime_1.jsxs)("div", { class: "artajs__tracking__timeline__step__text__primary", children: [pkgTracking.carrier_name, " - ", pkgTracking.tracking_number] })) })), pkg.package_events_count > 0 && ((0, jsx_runtime_1.jsx)("div", { onClick: function (e) {
39
+ }, className: "artajs__packings__text__regular__underline", children: [pkgTracking.carrier_name, " - ", pkgTracking.tracking_number] })) : (jsxRuntime.jsxs("div", { class: "artajs__tracking__timeline__step__text__primary", children: [pkgTracking.carrier_name, " - ", pkgTracking.tracking_number] })) })), pkg.package_events_count > 0 && (jsxRuntime.jsx("div", { onClick: (e) => {
43
40
  e.preventDefault();
44
41
  setPackageId(pkg.id);
45
- }, class: "artajs__packings__header__body", children: (0, jsx_runtime_1.jsx)("div", { class: "artajs__packings__text__small__underline", children: config.text.packageHistoryLabel }) }))] }) }), (0, jsx_runtime_1.jsx)("div", { class: "artajs__packings__line" }), (0, jsx_runtime_1.jsx)("div", { class: "artajs__packings__item", children: pkg.objects.map(function (obj) {
46
- var hasImage = obj.shipment_object_images && obj.shipment_object_images.length > 0;
47
- var thumbnailUrl = hasImage && obj.shipment_object_images
48
- ? "".concat(config.httpSchema, "://").concat(config.host, "/shipment_images/60x60/resize/").concat(obj.shipment_object_images[0].filename)
42
+ }, class: "artajs__packings__header__body", children: jsxRuntime.jsx("div", { class: "artajs__packings__text__small__underline", children: config.text.packageHistoryLabel }) }))] }) }), jsxRuntime.jsx("div", { class: "artajs__packings__line" }), jsxRuntime.jsx("div", { class: "artajs__packings__item", children: pkg.objects.map((obj) => {
43
+ const hasImage = obj.shipment_object_images && obj.shipment_object_images.length > 0;
44
+ const thumbnailUrl = hasImage && obj.shipment_object_images
45
+ ? `${config.httpSchema}://${config.host}/shipment_images/60x60/resize/${obj.shipment_object_images[0].filename}`
49
46
  : null;
50
- return ((0, jsx_runtime_1.jsxs)("div", { class: "artajs__packings__item__row", children: [config.showThumbnails && ((0, jsx_runtime_1.jsx)("div", { class: "artajs__packings__item__thumbnail", children: thumbnailUrl ? ((0, jsx_runtime_1.jsx)("img", { src: thumbnailUrl, alt: "shipment object image", class: "artajs__packings__item__thumbnail__img" })) : ((0, jsx_runtime_1.jsx)("div", { class: "artajs__packings__item__thumbnail__placeholder" })) })), (0, jsx_runtime_1.jsxs)("div", { class: "artajs__packings__item__content", children: [(0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__title", children: (0, exports.objectDetailTitle)(obj, config) }), (0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__subtype", children: obj.subtype_name })] })] }));
47
+ return (jsxRuntime.jsxs("div", { class: "artajs__packings__item__row", children: [config.showThumbnails && (jsxRuntime.jsx("div", { class: "artajs__packings__item__thumbnail", children: thumbnailUrl ? (jsxRuntime.jsx("img", { src: thumbnailUrl, alt: "shipment object image", class: "artajs__packings__item__thumbnail__img" })) : (jsxRuntime.jsx("div", { class: "artajs__packings__item__thumbnail__placeholder" })) })), jsxRuntime.jsxs("div", { class: "artajs__packings__item__content", children: [jsxRuntime.jsx("div", { class: "artajs__tracking__title", children: objectDetailTitle(obj, config) }), jsxRuntime.jsx("div", { class: "artajs__tracking__subtype", children: obj.subtype_name })] })] }));
51
48
  }) })] }) }));
52
49
  };
50
+
53
51
  exports.Package = Package;
52
+ exports.objectDetailTitle = objectDetailTitle;
@@ -1,60 +1,24 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
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.PackageEvents = void 0;
40
- var jsx_runtime_1 = require("preact/jsx-runtime");
41
- var hooks_1 = require("preact/hooks");
42
- var requests_1 = require("../../requests");
43
- var Date_1 = require("../Date");
44
- var DrawerFooter_1 = require("../DrawerFooter");
45
- var cleanLocationString = function (input) {
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('preact/jsx-runtime');
4
+ var hooks = require('preact/hooks');
5
+ var requests = require('../../requests.js');
6
+ var index$1 = require('../Date/index.js');
7
+ var index = require('../DrawerFooter/index.js');
8
+
9
+ const cleanLocationString = (input) => {
46
10
  if (input == null) {
47
11
  return null;
48
12
  }
49
13
  return input
50
14
  .split(',')
51
- .map(function (part) { return part.trim(); })
52
- .filter(function (part) { return part !== ''; })
15
+ .map((part) => part.trim())
16
+ .filter((part) => part !== '')
53
17
  .join(', ');
54
18
  };
55
- var groupByDate = function (data) {
56
- return data.reduce(function (groups, item) {
57
- var date = item.datetime.split('T')[0]; // Extract the date portion (YYYY-MM-DD)
19
+ const groupByDate = (data) => {
20
+ return data.reduce((groups, item) => {
21
+ const date = item.datetime.split('T')[0]; // Extract the date portion (YYYY-MM-DD)
58
22
  if (!groups[date]) {
59
23
  groups[date] = [];
60
24
  }
@@ -62,59 +26,50 @@ var groupByDate = function (data) {
62
26
  return groups;
63
27
  }, {});
64
28
  };
65
- var formatDate = function (date, config) {
66
- var _a = (0, Date_1.parseStringDate)(date), day = _a.day, weekday = _a.weekday, month = _a.month, year = _a.year;
67
- return "".concat(config.text.dates.weekdays[weekday], ", ").concat(config.text.dates.months[month], " ").concat(day, ", ").concat(year);
29
+ const formatDate = (date, config) => {
30
+ const { day, weekday, month, year } = index$1.parseStringDate(date);
31
+ return `${config.text.dates.weekdays[weekday]}, ${config.text.dates.months[month]} ${day}, ${year}`;
68
32
  };
69
- var PackageEvents = function (_a) {
70
- var _b;
71
- var shipment = _a.shipment, config = _a.config, setPackageId = _a.setPackageId, packageId = _a.packageId;
72
- var _c = (0, hooks_1.useState)(null), eventHistory = _c[0], setEventHistory = _c[1];
73
- var _d = (0, hooks_1.useState)(null), groupedEventHistory = _d[0], setGroupedEventHistory = _d[1];
74
- var packageIdx = shipment.packages.findIndex(function (p) { return p.id === packageId; });
75
- var pkgTracking = shipment.tracking.find(function (t) { return t.package_id === shipment.packages[packageIdx].id; });
76
- var counter = (_b = eventHistory === null || eventHistory === void 0 ? void 0 : eventHistory.length) !== null && _b !== void 0 ? _b : 0;
77
- (0, hooks_1.useEffect)(function () {
78
- (function () { return __awaiter(void 0, void 0, void 0, function () {
79
- var hist;
80
- return __generator(this, function (_a) {
81
- switch (_a.label) {
82
- case 0: return [4 /*yield*/, (0, requests_1.loadPackageEvents)(config, shipment.id, packageId)];
83
- case 1:
84
- hist = _a.sent();
85
- setEventHistory(hist);
86
- setGroupedEventHistory(groupByDate(hist));
87
- return [2 /*return*/];
88
- }
89
- });
90
- }); })();
33
+ const PackageEvents = ({ shipment, config, setPackageId, packageId, }) => {
34
+ const [eventHistory, setEventHistory] = hooks.useState(null);
35
+ const [groupedEventHistory, setGroupedEventHistory] = hooks.useState(null);
36
+ const packageIdx = shipment.packages.findIndex((p) => p.id === packageId);
37
+ const pkgTracking = shipment.tracking.find((t) => t.package_id === shipment.packages[packageIdx].id);
38
+ let counter = eventHistory?.length ?? 0;
39
+ hooks.useEffect(() => {
40
+ (async () => {
41
+ const hist = await requests.loadPackageEvents(config, shipment.id, packageId);
42
+ setEventHistory(hist);
43
+ setGroupedEventHistory(groupByDate(hist));
44
+ })();
91
45
  }, [packageId]);
92
- return ((0, jsx_runtime_1.jsxs)("div", { class: "artajs__tracking__events__wrapper", children: [(0, jsx_runtime_1.jsx)("div", { onClick: function (e) {
46
+ return (jsxRuntime.jsxs("div", { class: "artajs__tracking__events__wrapper", children: [jsxRuntime.jsx("div", { onClick: (e) => {
93
47
  e.preventDefault();
94
48
  setPackageId(null);
95
- }, class: "artajs__tracking__events__return", children: (0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__events__return__text", children: config.text.packageIdReturnLabel }) }), (0, jsx_runtime_1.jsxs)("div", { class: "artajs__tracking__events__header", children: [(0, jsx_runtime_1.jsxs)("div", { class: "artajs__tracking__events__header__title", children: [config.text.packageLabel, " #", packageIdx + 1, ' ', config.text.historyLabel] }), (pkgTracking === null || pkgTracking === void 0 ? void 0 : pkgTracking.carrier_name) &&
49
+ }, class: "artajs__tracking__events__return", children: jsxRuntime.jsx("div", { class: "artajs__tracking__events__return__text", children: config.text.packageIdReturnLabel }) }), jsxRuntime.jsxs("div", { class: "artajs__tracking__events__header", children: [jsxRuntime.jsxs("div", { class: "artajs__tracking__events__header__title", children: [config.text.packageLabel, " #", packageIdx + 1, ' ', config.text.historyLabel] }), pkgTracking?.carrier_name &&
96
50
  pkgTracking.tracking_number &&
97
- (pkgTracking.url ? ((0, jsx_runtime_1.jsxs)("div", { onClick: function (e) {
51
+ (pkgTracking.url ? (jsxRuntime.jsxs("div", { onClick: (e) => {
98
52
  e.preventDefault();
99
53
  if (pkgTracking.url == null) {
100
54
  return;
101
55
  }
102
- var url = pkgTracking.url.startsWith('http')
56
+ const url = pkgTracking.url.startsWith('http')
103
57
  ? pkgTracking.url
104
- : "https://".concat(pkgTracking.url);
58
+ : `https://${pkgTracking.url}`;
105
59
  window.open(url, '_blank');
106
- }, className: "artajs__packings__text__regular__underline", children: [pkgTracking.carrier_name, " - ", pkgTracking.tracking_number] })) : ((0, jsx_runtime_1.jsxs)("div", { class: "artajs__tracking__timeline__step__text__primary", children: [pkgTracking.carrier_name, " - ", pkgTracking.tracking_number] })))] }), groupedEventHistory ? ((0, jsx_runtime_1.jsxs)("div", { class: "artajs__tracking__events__body", children: [Object.values(groupedEventHistory).map(function (events, idx) {
107
- return ((0, jsx_runtime_1.jsxs)("div", { class: "artajs__tracking__events__group", children: [(0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__events__date", children: formatDate(events[0].datetime, config) }), (0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__events__group__item", children: events.map(function (event, idx2) {
108
- var _a;
109
- return ((0, jsx_runtime_1.jsxs)("div", { class: "artajs__tracking__events__group__content", children: [(0, jsx_runtime_1.jsx)("div", { class: idx === 0 && idx2 === 0
60
+ }, className: "artajs__packings__text__regular__underline", children: [pkgTracking.carrier_name, " - ", pkgTracking.tracking_number] })) : (jsxRuntime.jsxs("div", { class: "artajs__tracking__timeline__step__text__primary", children: [pkgTracking.carrier_name, " - ", pkgTracking.tracking_number] })))] }), groupedEventHistory ? (jsxRuntime.jsxs("div", { class: "artajs__tracking__events__body", children: [Object.values(groupedEventHistory).map((events, idx) => {
61
+ return (jsxRuntime.jsxs("div", { class: "artajs__tracking__events__group", children: [jsxRuntime.jsx("div", { class: "artajs__tracking__events__date", children: formatDate(events[0].datetime, config) }), jsxRuntime.jsx("div", { class: "artajs__tracking__events__group__item", children: events.map((event, idx2) => {
62
+ return (jsxRuntime.jsxs("div", { class: "artajs__tracking__events__group__content", children: [jsxRuntime.jsx("div", { class: idx === 0 && idx2 === 0
110
63
  ? 'artajs__tracking__events__group__number__primary'
111
- : 'artajs__tracking__events__group__number__secondary', children: counter-- }), (0, jsx_runtime_1.jsxs)("div", { class: "artajs__tracking__events__group__divider", children: [(0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__events__round", children: idx === 0 && idx2 === 0 ? ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "30", height: "30", viewBox: "0 0 30 30", fill: "none", children: (0, jsx_runtime_1.jsx)("circle", { cx: "15", cy: "15", r: "7.5", fill: config.style.color.iconPrimary }) })) : ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "30", height: "30", viewBox: "0 0 30 30", fill: "none", children: (0, jsx_runtime_1.jsx)("circle", { cx: "15", cy: "15", r: "7", fill: "none", stroke: config.style.color.iconTertiary, "stroke-width": "2" }) })) }), (0, jsx_runtime_1.jsx)("hr", { class: "artajs__tracking__events__vertical", style: "0 auto" })] }), (0, jsx_runtime_1.jsxs)("div", { class: "artajs__tracking__events__group__summary", children: [(0, jsx_runtime_1.jsx)("div", { class: idx === 0 && idx2 === 0
64
+ : 'artajs__tracking__events__group__number__secondary', children: counter-- }), jsxRuntime.jsxs("div", { class: "artajs__tracking__events__group__divider", children: [jsxRuntime.jsx("div", { class: "artajs__tracking__events__round", children: idx === 0 && idx2 === 0 ? (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "30", height: "30", viewBox: "0 0 30 30", fill: "none", children: jsxRuntime.jsx("circle", { cx: "15", cy: "15", r: "7.5", fill: config.style.color.iconPrimary }) })) : (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "30", height: "30", viewBox: "0 0 30 30", fill: "none", children: jsxRuntime.jsx("circle", { cx: "15", cy: "15", r: "7", fill: "none", stroke: config.style.color.iconTertiary, "stroke-width": "2" }) })) }), jsxRuntime.jsx("hr", { class: "artajs__tracking__events__vertical", style: "0 auto" })] }), jsxRuntime.jsxs("div", { class: "artajs__tracking__events__group__summary", children: [jsxRuntime.jsx("div", { class: idx === 0 && idx2 === 0
112
65
  ? 'artajs__tracking__events__group__location'
113
- : 'artajs__tracking__events__group__location__secondary', children: (_a = cleanLocationString(event.location)) !== null && _a !== void 0 ? _a : config.text.unknownLocation }), (0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__events__group__time", children: new Date(event.datetime).toLocaleTimeString([], {
66
+ : 'artajs__tracking__events__group__location__secondary', children: cleanLocationString(event.location) ??
67
+ config.text.unknownLocation }), jsxRuntime.jsx("div", { class: "artajs__tracking__events__group__time", children: new Date(event.datetime).toLocaleTimeString([], {
114
68
  hour: 'numeric',
115
69
  minute: '2-digit',
116
- }) }), (0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__events__group__description", children: event.summary })] })] }));
70
+ }) }), jsxRuntime.jsx("div", { class: "artajs__tracking__events__group__description", children: event.summary })] })] }));
117
71
  }) })] }));
118
- }), (0, jsx_runtime_1.jsx)(DrawerFooter_1.DrawerFooter, {})] })) : ((0, jsx_runtime_1.jsxs)("div", { class: "artajs__tracking__body", children: [(0, jsx_runtime_1.jsx)("div", { class: "artajs__drawer__loading" }), (0, jsx_runtime_1.jsx)(DrawerFooter_1.DrawerFooter, {})] }))] }));
72
+ }), jsxRuntime.jsx(index.DrawerFooter, {})] })) : (jsxRuntime.jsxs("div", { class: "artajs__tracking__body", children: [jsxRuntime.jsx("div", { class: "artajs__drawer__loading" }), jsxRuntime.jsx(index.DrawerFooter, {})] }))] }));
119
73
  };
74
+
120
75
  exports.PackageEvents = PackageEvents;
@@ -1,10 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Pill = void 0;
4
- var jsx_runtime_1 = require("preact/jsx-runtime");
5
- var Pill = function (_a) {
6
- var config = _a.config, status = _a.status;
7
- var pillStatus = status === 'in_transit' ? 'transit' : status;
8
- return ((0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__pill__wrapper", children: (0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__pill__round", style: { background: config.pill[pillStatus].backgroundColor }, children: (0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__pill__text", style: { color: config.pill[pillStatus].textColor }, children: config.pill[pillStatus].text }) }) }));
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('preact/jsx-runtime');
4
+
5
+ const Pill = ({ config, status }) => {
6
+ const pillStatus = status === 'in_transit' ? 'transit' : status;
7
+ return (jsxRuntime.jsx("div", { class: "artajs__tracking__pill__wrapper", children: jsxRuntime.jsx("div", { class: "artajs__tracking__pill__round", style: { background: config.pill[pillStatus].backgroundColor }, children: jsxRuntime.jsx("div", { class: "artajs__tracking__pill__text", style: { color: config.pill[pillStatus].textColor }, children: config.pill[pillStatus].text }) }) }));
9
8
  };
9
+
10
10
  exports.Pill = Pill;
@@ -1,13 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Quotes = exports.defaultQuoteConfig = void 0;
4
- var jsx_runtime_1 = require("preact/jsx-runtime");
5
- var helper_1 = require("../../helper");
6
- var ModalStatus_1 = require("../../ModalStatus");
7
- var formatCurrency = function (amount, currency) {
8
- var formatted = new Intl.NumberFormat('en-US', {
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('preact/jsx-runtime');
4
+ var helper = require('../../helper.js');
5
+ var ModalStatus = require('../../ModalStatus.js');
6
+
7
+ const formatCurrency = (amount, currency) => {
8
+ const formatted = new Intl.NumberFormat('en-US', {
9
9
  style: 'currency',
10
- currency: currency,
10
+ currency,
11
11
  currencyDisplay: 'narrowSymbol',
12
12
  maximumFractionDigits: 0,
13
13
  }).format(amount);
@@ -17,7 +17,7 @@ var formatCurrency = function (amount, currency) {
17
17
  }
18
18
  return formatted;
19
19
  };
20
- exports.defaultQuoteConfig = {
20
+ const defaultQuoteConfig = {
21
21
  shipFromLabel: 'These goods ship from:',
22
22
  shipToLabel: 'To:',
23
23
  disclaimerLabel: 'Actual shipping costs will be provided at checkout.',
@@ -25,27 +25,28 @@ exports.defaultQuoteConfig = {
25
25
  startsAtLabel: 'Shipping Starts at',
26
26
  artaInsuranceLabel: 'This estimate includes Arta Shipping Protection.',
27
27
  };
28
- var Quotes = function (_a) {
29
- var quoteRequest = _a.quoteRequest, showCostRange = _a.showCostRange, textConfig = _a.textConfig, setStatus = _a.setStatus;
30
- var onChangeDestination = function (e) {
28
+ const Quotes = ({ quoteRequest, showCostRange, textConfig, setStatus, }) => {
29
+ const onChangeDestination = (e) => {
31
30
  e.preventDefault();
32
- setStatus(ModalStatus_1.ModalStatus.OPEN);
31
+ setStatus(ModalStatus.ModalStatus.OPEN);
33
32
  };
34
- var quotes = quoteRequest.quotes;
33
+ const quotes = quoteRequest.quotes;
35
34
  if (quotes && quotes.length > 0) {
36
- quotes.sort(function (a, b) {
35
+ quotes.sort((a, b) => {
37
36
  return a.total - b.total;
38
37
  });
39
38
  }
40
- var hasInsurance = quoteRequest.insurance === 'arta_transit_insurance';
41
- var isInternational = quoteRequest.origin.estimated_country ===
39
+ const hasInsurance = quoteRequest.insurance === 'arta_transit_insurance';
40
+ const isInternational = quoteRequest.origin.estimated_country ===
42
41
  quoteRequest.destination.estimated_country;
43
- var parsedOrigin = (0, helper_1.parseEstimatedLocation)(quoteRequest.origin);
44
- var parsedDestination = (0, helper_1.parseEstimatedLocation)(quoteRequest.destination);
45
- return ((0, jsx_runtime_1.jsxs)("div", { class: "artajs__modal__quotes", children: [(0, jsx_runtime_1.jsx)("p", { class: "artajs__modal__quotes__context", children: textConfig.shipFromLabel }), (0, jsx_runtime_1.jsx)("p", { class: "artajs__modal__quotes__origin", children: (0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)("strong", { class: "artajs__modal__capitalize", children: parsedOrigin }), ' ', (0, jsx_runtime_1.jsx)("span", { class: "artajs__modal__quotes__light", children: textConfig.detailOriginLabel })] }) }), (0, jsx_runtime_1.jsxs)("p", { class: "artajs__modal__quotes__destination", children: [(0, jsx_runtime_1.jsx)("span", { class: "artajs__modal__quotes__small", children: textConfig.shipToLabel }), ' ', parsedDestination ? ((0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)("strong", { class: "artajs__modal__capitalize", children: parsedDestination }), ' ', (0, jsx_runtime_1.jsx)("span", { class: "artajs__modal__quotes__light", children: textConfig.detailDestinationLabel })] })) : ((0, jsx_runtime_1.jsx)("span", { children: "..." }))] }), showCostRange && quotes.length > 1 ? ((0, jsx_runtime_1.jsxs)("div", { class: "artajs__modal__quotes__box ".concat(!isInternational ? 'artajs__modal__quotes__box__padding__y' : ''), children: [(0, jsx_runtime_1.jsx)("p", { class: "artajs__modal__quotes__context", children: textConfig.rangeLabel }), (0, jsx_runtime_1.jsxs)("div", { class: "artajs__modal__quotes__price", children: [(0, jsx_runtime_1.jsxs)("strong", { class: "artajs__modal__quotes__price__amount", children: [formatCurrency(quotes[0].total, quoteRequest.currency), " -", ' ', formatCurrency(quotes[quotes.length - 1].total, quoteRequest.currency)] }), (0, jsx_runtime_1.jsx)("div", { class: "artajs__modal__quotes__price__currency_code", children: quoteRequest.currency })] }), isInternational && ((0, jsx_runtime_1.jsx)("p", { class: "artajs__modal__quotes__disclaimer", children: hasInsurance
46
- ? "".concat(textConfig.artaInsuranceLabel, " ").concat(textConfig.disclaimerLabel)
47
- : textConfig.disclaimerLabel }))] })) : ((0, jsx_runtime_1.jsxs)("div", { class: "artajs__modal__quotes__box ".concat(!isInternational ? 'artajs__modal__quotes__box__padding__y' : ''), children: [(0, jsx_runtime_1.jsx)("p", { class: "artajs__modal__quotes__context", children: textConfig.startsAtLabel }), (0, jsx_runtime_1.jsxs)("div", { class: "artajs__modal__quotes__price", children: [(0, jsx_runtime_1.jsx)("strong", { class: "artajs__modal__quotes__price__amount", children: formatCurrency(quotes[0].total, quoteRequest.currency) }), (0, jsx_runtime_1.jsx)("div", { class: "artajs__modal__quotes__price__currency_code", children: quoteRequest.currency })] }), isInternational && ((0, jsx_runtime_1.jsx)("p", { class: "artajs__modal__quotes__disclaimer", children: hasInsurance
48
- ? "".concat(textConfig.artaInsuranceLabel, " ").concat(textConfig.disclaimerLabel)
49
- : textConfig.disclaimerLabel }))] })), (0, jsx_runtime_1.jsx)("p", { class: "artajs__modal__quotes__change", children: (0, jsx_runtime_1.jsxs)("a", { onClick: onChangeDestination, href: "#", children: [(0, jsx_runtime_1.jsx)("svg", { height: "12", id: "chevron-left", viewBox: "0 0 32 32", width: "12", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M20 1 L24 5 L14 16 L24 27 L20 31 L6 16 z" }) }), textConfig.returnLinkLabel] }) })] }));
42
+ const parsedOrigin = helper.parseEstimatedLocation(quoteRequest.origin);
43
+ const parsedDestination = helper.parseEstimatedLocation(quoteRequest.destination);
44
+ return (jsxRuntime.jsxs("div", { class: "artajs__modal__quotes", children: [jsxRuntime.jsx("p", { class: "artajs__modal__quotes__context", children: textConfig.shipFromLabel }), jsxRuntime.jsx("p", { class: "artajs__modal__quotes__origin", children: jsxRuntime.jsxs("span", { children: [jsxRuntime.jsx("strong", { class: "artajs__modal__capitalize", children: parsedOrigin }), ' ', jsxRuntime.jsx("span", { class: "artajs__modal__quotes__light", children: textConfig.detailOriginLabel })] }) }), jsxRuntime.jsxs("p", { class: "artajs__modal__quotes__destination", children: [jsxRuntime.jsx("span", { class: "artajs__modal__quotes__small", children: textConfig.shipToLabel }), ' ', parsedDestination ? (jsxRuntime.jsxs("span", { children: [jsxRuntime.jsx("strong", { class: "artajs__modal__capitalize", children: parsedDestination }), ' ', jsxRuntime.jsx("span", { class: "artajs__modal__quotes__light", children: textConfig.detailDestinationLabel })] })) : (jsxRuntime.jsx("span", { children: "..." }))] }), showCostRange && quotes.length > 1 ? (jsxRuntime.jsxs("div", { class: `artajs__modal__quotes__box ${!isInternational ? 'artajs__modal__quotes__box__padding__y' : ''}`, children: [jsxRuntime.jsx("p", { class: "artajs__modal__quotes__context", children: textConfig.rangeLabel }), jsxRuntime.jsxs("div", { class: "artajs__modal__quotes__price", children: [jsxRuntime.jsxs("strong", { class: "artajs__modal__quotes__price__amount", children: [formatCurrency(quotes[0].total, quoteRequest.currency), " -", ' ', formatCurrency(quotes[quotes.length - 1].total, quoteRequest.currency)] }), jsxRuntime.jsx("div", { class: "artajs__modal__quotes__price__currency_code", children: quoteRequest.currency })] }), isInternational && (jsxRuntime.jsx("p", { class: "artajs__modal__quotes__disclaimer", children: hasInsurance
45
+ ? `${textConfig.artaInsuranceLabel} ${textConfig.disclaimerLabel}`
46
+ : textConfig.disclaimerLabel }))] })) : (jsxRuntime.jsxs("div", { class: `artajs__modal__quotes__box ${!isInternational ? 'artajs__modal__quotes__box__padding__y' : ''}`, children: [jsxRuntime.jsx("p", { class: "artajs__modal__quotes__context", children: textConfig.startsAtLabel }), jsxRuntime.jsxs("div", { class: "artajs__modal__quotes__price", children: [jsxRuntime.jsx("strong", { class: "artajs__modal__quotes__price__amount", children: formatCurrency(quotes[0].total, quoteRequest.currency) }), jsxRuntime.jsx("div", { class: "artajs__modal__quotes__price__currency_code", children: quoteRequest.currency })] }), isInternational && (jsxRuntime.jsx("p", { class: "artajs__modal__quotes__disclaimer", children: hasInsurance
47
+ ? `${textConfig.artaInsuranceLabel} ${textConfig.disclaimerLabel}`
48
+ : textConfig.disclaimerLabel }))] })), jsxRuntime.jsx("p", { class: "artajs__modal__quotes__change", children: jsxRuntime.jsxs("a", { onClick: onChangeDestination, href: "#", children: [jsxRuntime.jsx("svg", { height: "12", id: "chevron-left", viewBox: "0 0 32 32", width: "12", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M20 1 L24 5 L14 16 L24 27 L20 31 L6 16 z" }) }), textConfig.returnLinkLabel] }) })] }));
50
49
  };
50
+
51
51
  exports.Quotes = Quotes;
52
+ exports.defaultQuoteConfig = defaultQuoteConfig;