@artaio/arta-browser 2.6.0 → 2.9.4-add-backdrop72cde9bc5f6b74ebbea4e133e6113ca295d73401

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 (93) hide show
  1. package/dist/arta.d.ts +5 -1
  2. package/dist/arta.js +14 -1
  3. package/dist/bundle.js +1 -1
  4. package/dist/components/Date/SimpleDate.d.ts +6 -0
  5. package/dist/components/Date/SimpleDate.js +25 -0
  6. package/dist/components/Date/index.d.ts +6 -0
  7. package/dist/components/Date/index.js +39 -0
  8. package/dist/components/DrawerFooter/index.d.ts +1 -0
  9. package/dist/components/DrawerFooter/index.js +19 -0
  10. package/dist/components/DrawerHeader/index.d.ts +6 -0
  11. package/dist/components/DrawerHeader/index.js +20 -0
  12. package/dist/components/DrawerInsurance/index.d.ts +1 -0
  13. package/dist/components/DrawerInsurance/index.js +19 -0
  14. package/dist/components/Loading/index.js +1 -1
  15. package/dist/components/Modal/index.js +2 -3
  16. package/dist/components/Package/index.d.ts +10 -0
  17. package/dist/components/Package/index.js +57 -0
  18. package/dist/components/PackageEvents/index.d.ts +15 -0
  19. package/dist/components/PackageEvents/index.js +131 -0
  20. package/dist/components/Pill/index.d.ts +8 -0
  21. package/dist/components/Pill/index.js +20 -0
  22. package/dist/components/ShipToFrom/index.d.ts +7 -0
  23. package/dist/components/ShipToFrom/index.js +29 -0
  24. package/dist/components/ShipmentException/icons/ExceptionIcon.d.ts +7 -0
  25. package/dist/components/ShipmentException/icons/ExceptionIcon.js +18 -0
  26. package/dist/components/ShipmentException/icons/HexagonAlertBase.d.ts +4 -0
  27. package/dist/components/ShipmentException/icons/HexagonAlertBase.js +20 -0
  28. package/dist/components/ShipmentException/icons/HexagonPauseBase.d.ts +4 -0
  29. package/dist/components/ShipmentException/icons/HexagonPauseBase.js +20 -0
  30. package/dist/components/ShipmentException/icons/HexagonStopBase.d.ts +4 -0
  31. package/dist/components/ShipmentException/icons/HexagonStopBase.js +20 -0
  32. package/dist/components/ShipmentException/index.d.ts +8 -0
  33. package/dist/components/ShipmentException/index.js +97 -0
  34. package/dist/components/Summary/index.d.ts +7 -0
  35. package/dist/components/Summary/index.js +20 -0
  36. package/dist/components/Timeline/CheckedStep.d.ts +8 -0
  37. package/dist/components/Timeline/CheckedStep.js +26 -0
  38. package/dist/components/Timeline/CheckedSteps.d.ts +4 -0
  39. package/dist/components/Timeline/CheckedSteps.js +20 -0
  40. package/dist/components/Timeline/EmptyStep.d.ts +3 -0
  41. package/dist/components/Timeline/EmptyStep.js +20 -0
  42. package/dist/components/Timeline/SecondaryStep.d.ts +4 -0
  43. package/dist/components/Timeline/SecondaryStep.js +20 -0
  44. package/dist/components/Timeline/SecondarySteps.d.ts +4 -0
  45. package/dist/components/Timeline/SecondarySteps.js +20 -0
  46. package/dist/components/Timeline/TimelineDefault.d.ts +2 -0
  47. package/dist/components/Timeline/TimelineDefault.js +44 -0
  48. package/dist/components/Timeline/TimlineMinimal.d.ts +2 -0
  49. package/dist/components/Timeline/TimlineMinimal.js +45 -0
  50. package/dist/components/Timeline/defaultIcons/CancelledIcon.d.ts +4 -0
  51. package/dist/components/Timeline/defaultIcons/CancelledIcon.js +21 -0
  52. package/dist/components/Timeline/defaultIcons/CollectedIcon.d.ts +2 -0
  53. package/dist/components/Timeline/defaultIcons/CollectedIcon.js +22 -0
  54. package/dist/components/Timeline/defaultIcons/CompletedIcon.d.ts +2 -0
  55. package/dist/components/Timeline/defaultIcons/CompletedIcon.js +22 -0
  56. package/dist/components/Timeline/defaultIcons/ConfirmedIcon.d.ts +2 -0
  57. package/dist/components/Timeline/defaultIcons/ConfirmedIcon.js +22 -0
  58. package/dist/components/Timeline/defaultIcons/InTransitIcon.d.ts +2 -0
  59. package/dist/components/Timeline/defaultIcons/InTransitIcon.js +22 -0
  60. package/dist/components/Timeline/defaultIcons/PendingIcon.d.ts +4 -0
  61. package/dist/components/Timeline/defaultIcons/PendingIcon.js +21 -0
  62. package/dist/components/Timeline/icons/CancelledIconBase.d.ts +4 -0
  63. package/dist/components/Timeline/icons/CancelledIconBase.js +20 -0
  64. package/dist/components/Timeline/icons/CollectedIconBase.d.ts +4 -0
  65. package/dist/components/Timeline/icons/CollectedIconBase.js +20 -0
  66. package/dist/components/Timeline/icons/CompletedIconBase.d.ts +4 -0
  67. package/dist/components/Timeline/icons/CompletedIconBase.js +20 -0
  68. package/dist/components/Timeline/icons/ConfirmedIconBase.d.ts +4 -0
  69. package/dist/components/Timeline/icons/ConfirmedIconBase.js +20 -0
  70. package/dist/components/Timeline/icons/InTransitIconBase.d.ts +4 -0
  71. package/dist/components/Timeline/icons/InTransitIconBase.js +20 -0
  72. package/dist/components/Timeline/icons/PendingIconBase.d.ts +4 -0
  73. package/dist/components/Timeline/icons/PendingIconBase.js +20 -0
  74. package/dist/components/Timeline/index.d.ts +7 -0
  75. package/dist/components/Timeline/index.js +22 -0
  76. package/dist/components/TrackingDrawer/index.css +1088 -0
  77. package/dist/components/TrackingDrawer/index.d.ts +114 -0
  78. package/dist/components/TrackingDrawer/index.js +98 -0
  79. package/dist/components/TrackingTop/index.d.ts +7 -0
  80. package/dist/components/TrackingTop/index.js +76 -0
  81. package/dist/estimateConfig.d.ts +5 -8
  82. package/dist/estimateConfig.js +4 -27
  83. package/dist/helper.d.ts +23 -1
  84. package/dist/helper.js +50 -6
  85. package/dist/index.d.ts +4 -1
  86. package/dist/index.js +2 -0
  87. package/dist/requests.d.ts +5 -0
  88. package/dist/requests.js +75 -27
  89. package/dist/tracking.d.ts +14 -0
  90. package/dist/tracking.js +86 -0
  91. package/dist/trackingConfig.d.ts +108 -0
  92. package/dist/trackingConfig.js +138 -0
  93. package/package.json +2 -2
@@ -0,0 +1,114 @@
1
+ import { TrackingFullConfig } from '../../trackingConfig';
2
+ import './index.css';
3
+ interface TrackingDrawerProps {
4
+ shipmentId: string;
5
+ config: TrackingFullConfig;
6
+ onClose: (e: any) => void;
7
+ }
8
+ export interface ArtaLocation {
9
+ title: string;
10
+ address_line_1: string;
11
+ address_line_2: string;
12
+ address_line_3: string;
13
+ city: string;
14
+ country: string;
15
+ region: string;
16
+ postal_code: string;
17
+ }
18
+ export interface ArtaObject {
19
+ id: string;
20
+ current_packing: string;
21
+ images: string[];
22
+ internal_reference: string;
23
+ public_reference: string;
24
+ details: {
25
+ creation_date: string;
26
+ creator: string;
27
+ is_cites: boolean;
28
+ is_fragile: boolean;
29
+ materials: string;
30
+ notes: string;
31
+ title: string;
32
+ };
33
+ depth: number;
34
+ height: number;
35
+ width: number;
36
+ unit_of_measurement: string;
37
+ weight: number;
38
+ weight_unit: string;
39
+ value: number;
40
+ value_currency: string;
41
+ subtype: string;
42
+ subtype_name: string;
43
+ type: string;
44
+ }
45
+ export interface ArtaPackage {
46
+ id: number;
47
+ handle_with_care: boolean;
48
+ is_sufficiently_packed: boolean;
49
+ eta: string;
50
+ status: 'unknown' | 'pending' | 'notfound' | 'transit' | 'out_for_delivery' | 'delivered' | 'undelivered' | 'exception' | 'expired';
51
+ objects: ArtaObject[];
52
+ packing_materials: string;
53
+ depth: number;
54
+ height: number;
55
+ width: number;
56
+ unit_of_measurement: string;
57
+ weight: number;
58
+ weight_unit: string;
59
+ package_events_count: number;
60
+ }
61
+ interface Tracking {
62
+ id: number;
63
+ carrier_name: string;
64
+ package_id: number;
65
+ tracking_number: string;
66
+ url: string | null;
67
+ }
68
+ export interface ArtaShipmentException {
69
+ created_at: string;
70
+ exception_type_label: string | null;
71
+ hold_until: string | null;
72
+ id: string;
73
+ object_id: string | null;
74
+ package_id: number | null;
75
+ resolution: string | null;
76
+ source: string;
77
+ status: 'new' | 'in_progress' | 'resolved';
78
+ type: {
79
+ id: string;
80
+ name: string;
81
+ category: string;
82
+ };
83
+ updated_at: string;
84
+ }
85
+ export interface Shipment {
86
+ created_at: string;
87
+ destination: ArtaLocation | null;
88
+ hosted_session_id: string;
89
+ id: string;
90
+ internal_reference: string;
91
+ object_count: number;
92
+ origin: ArtaLocation | null;
93
+ packages: ArtaPackage[];
94
+ package_count: number;
95
+ public_reference: string;
96
+ quote_type: string;
97
+ shortcode: string;
98
+ status: 'cancelled' | 'collected' | 'completed' | 'confirmed' | 'in_transit' | 'pending';
99
+ total: number;
100
+ total_currency: string;
101
+ updated_at: string;
102
+ cancelled_at: string | null;
103
+ collected_at: string | null;
104
+ completed_at: string | null;
105
+ confirmed_at: string | null;
106
+ in_transit_at: string | null;
107
+ delivery_start: string | null;
108
+ delivery_end: string | null;
109
+ tracking: Tracking[];
110
+ shipment_exceptions: ArtaShipmentException[];
111
+ insurance_policy: 'arta_transit_insurance' | 'no_arta_insurance' | null;
112
+ }
113
+ export declare const TrackingDrawer: ({ shipmentId, config, onClose, }: TrackingDrawerProps) => import("preact").JSX.Element;
114
+ export {};
@@ -0,0 +1,98 @@
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;
24
+ return g = { next: verb(0), "throw": verb(1), "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;
43
+ }
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.TrackingDrawer = void 0;
51
+ var jsx_runtime_1 = require("preact/jsx-runtime");
52
+ var hooks_1 = require("preact/hooks");
53
+ var helper_1 = require("../../helper");
54
+ var DrawerHeader_1 = require("../DrawerHeader");
55
+ require("./index.css");
56
+ var requests_1 = require("../../requests");
57
+ var ShipToFrom_1 = require("../ShipToFrom");
58
+ var Package_1 = require("../Package");
59
+ var Timeline_1 = require("../Timeline");
60
+ var TrackingTop_1 = require("../TrackingTop");
61
+ var DrawerFooter_1 = require("../DrawerFooter");
62
+ var DrawerInsurance_1 = require("../DrawerInsurance");
63
+ var Summary_1 = require("../Summary");
64
+ var ShipmentException_1 = require("../ShipmentException");
65
+ var PackageEvents_1 = require("../PackageEvents");
66
+ var TrackingDrawer = function (_a) {
67
+ var shipmentId = _a.shipmentId, config = _a.config, onClose = _a.onClose;
68
+ var position = config.style.position;
69
+ var style = (0, helper_1.getTrackingStyle)(config);
70
+ var _b = (0, hooks_1.useState)(null), shipment = _b[0], setShipment = _b[1];
71
+ var _c = (0, hooks_1.useState)([]), packagesWithObjects = _c[0], setPackagesWithObjects = _c[1];
72
+ var _d = (0, hooks_1.useState)(null), packageId = _d[0], setPackageId = _d[1];
73
+ var hasActiveException = function (shipment) {
74
+ // TODO check with Dylan about status here
75
+ return (shipment.shipment_exceptions.some(function (ex) { return ex.status !== 'resolved'; }) &&
76
+ shipment.status !== 'completed');
77
+ };
78
+ (0, hooks_1.useEffect)(function () {
79
+ (function () { return __awaiter(void 0, void 0, void 0, function () {
80
+ var ship;
81
+ return __generator(this, function (_a) {
82
+ switch (_a.label) {
83
+ case 0: return [4 /*yield*/, (0, requests_1.loadShipment)(config, shipmentId)];
84
+ case 1:
85
+ ship = _a.sent();
86
+ setShipment(ship);
87
+ //TODO should we ship.packages.filter(pkg => pkg.objects?.length)); ??
88
+ setPackagesWithObjects(ship.packages);
89
+ return [2 /*return*/];
90
+ }
91
+ });
92
+ }); })();
93
+ }, [shipmentId]);
94
+ return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", __assign({ class: "artajs" }, { children: [config.style.backdropEnabled && (0, jsx_runtime_1.jsx)("div", { onClick: onClose, style: style, class: "artajs__drawer__backdrop" }), (0, jsx_runtime_1.jsx)("div", __assign({ style: style, class: "artajs__drawer ".concat(position === 'left'
95
+ ? 'artajs__drawer__left'
96
+ : 'artajs__drawer__right') }, { children: (0, jsx_runtime_1.jsxs)("div", __assign({ class: "artajs__tracking__out__wrapper" }, { children: [(0, jsx_runtime_1.jsx)(DrawerHeader_1.DrawerHeader, { title: config.text.header.title, onClose: onClose }), shipment != null ? (packageId ? ((0, jsx_runtime_1.jsx)(PackageEvents_1.PackageEvents, { shipment: shipment, config: config, packageId: packageId, setPackageId: setPackageId })) : ((0, jsx_runtime_1.jsxs)("div", __assign({ class: "artajs__tracking__body" }, { children: [(0, jsx_runtime_1.jsx)(Timeline_1.Timeline, { shipment: shipment, config: config }), (0, jsx_runtime_1.jsx)("div", { class: "artajs__tracking__timeline__divider" }), hasActiveException(shipment) && ((0, jsx_runtime_1.jsx)(ShipmentException_1.ShipmentException, { shipment: shipment, config: config })), (0, jsx_runtime_1.jsx)(TrackingTop_1.TrackingTop, { config: config, shipment: shipment }), (0, jsx_runtime_1.jsx)(ShipToFrom_1.ShipToFrom, { config: config, shipment: shipment }), packagesWithObjects.map(function (pkg, index) { return ((0, jsx_runtime_1.jsx)(Package_1.Package, { title: "#".concat(index + 1), pkg: pkg, shipment: shipment, config: config, setPackageId: setPackageId })); }), shipment.insurance_policy != null && (0, jsx_runtime_1.jsx)(DrawerInsurance_1.DrawerInsurance, {}), (0, jsx_runtime_1.jsx)(Summary_1.Summary, { config: config, shipment: shipment }), (0, jsx_runtime_1.jsx)(DrawerFooter_1.DrawerFooter, {})] })))) : ((0, jsx_runtime_1.jsxs)("div", __assign({ class: "artajs__tracking__body" }, { children: [(0, jsx_runtime_1.jsx)("div", { class: "artajs__drawer__loading" }), (0, jsx_runtime_1.jsx)(DrawerFooter_1.DrawerFooter, {})] })))] })) }))] })) }));
97
+ };
98
+ exports.TrackingDrawer = TrackingDrawer;
@@ -0,0 +1,7 @@
1
+ import type { TrackingConfig } from '../../trackingConfig';
2
+ import type { Shipment } from '../TrackingDrawer';
3
+ export interface TrackingTopProps {
4
+ shipment: Shipment;
5
+ config: TrackingConfig;
6
+ }
7
+ export declare const TrackingTop: ({ shipment, config }: TrackingTopProps) => import("preact").JSX.Element;
@@ -0,0 +1,76 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.TrackingTop = void 0;
15
+ var jsx_runtime_1 = require("preact/jsx-runtime");
16
+ var Date_1 = require("../Date");
17
+ var TrackingTop = function (_a) {
18
+ var shipment = _a.shipment, config = _a.config;
19
+ var getLabelAndDates = function (shipment, config) {
20
+ if (shipment.status === 'completed') {
21
+ return {
22
+ label: config.text.completedCTA,
23
+ dates: shipment.completed_at ? [new Date(shipment.completed_at)] : null,
24
+ };
25
+ }
26
+ if (shipment.status === 'cancelled') {
27
+ return {
28
+ label: config.text.cancelledMessage,
29
+ // TODO: maybe we want to check for cancelled_at here?
30
+ dates: null,
31
+ };
32
+ }
33
+ var start = shipment.delivery_start != null
34
+ ? new Date(shipment.delivery_start)
35
+ : null;
36
+ var end = shipment.delivery_end != null ? new Date(shipment.delivery_end) : null;
37
+ if (start == null && end == null) {
38
+ return {
39
+ label: config.text.checkBackLater,
40
+ dates: null,
41
+ };
42
+ }
43
+ if (start != null && end != null) {
44
+ if (start.toDateString() === end.toDateString()) {
45
+ return {
46
+ label: config.text.inTransitCTAOnLabel,
47
+ dates: [start],
48
+ };
49
+ }
50
+ return {
51
+ label: config.text.inTransitCTABetweenLabel,
52
+ dates: [start, end],
53
+ };
54
+ }
55
+ if (start == null && end != null) {
56
+ return {
57
+ label: config.text.inTransitCTABeforeLabel,
58
+ dates: [end],
59
+ };
60
+ }
61
+ if (start != null && end == null) {
62
+ return {
63
+ label: config.text.inTransitCTAAfterLabel,
64
+ dates: [start],
65
+ };
66
+ }
67
+ return {
68
+ label: config.text.checkBackLater,
69
+ dates: null,
70
+ };
71
+ };
72
+ var _b = getLabelAndDates(shipment, config), label = _b.label, dates = _b.dates;
73
+ var parsedDates = dates === null || dates === void 0 ? void 0 : dates.map(Date_1.parseStringDate);
74
+ return ((0, jsx_runtime_1.jsx)("div", __assign({ class: "artajs__tracking__top__wrapper" }, { children: (0, jsx_runtime_1.jsxs)("div", __assign({ class: "artajs__tracking__top__divider" }, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ class: "artajs__tracking__top__cta" }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ class: "artajs__tracking__top__text" }, { children: label })) })), parsedDates != null && parsedDates.length === 1 && ((0, jsx_runtime_1.jsx)("div", __assign({ class: "artajs__tracking__top__date__wrapper" }, { children: (0, jsx_runtime_1.jsxs)("div", __assign({ class: "artajs__tracking__top__date__aligner" }, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ 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", __assign({ 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", __assign({ class: "artajs__tracking__top__date__wrapper" }, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ class: "artajs__tracking__top__date__aligner" }, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ 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", __assign({ class: "artajs__tracking__top__date__day__numeric" }, { children: "".concat(parsedDates[0].day).padStart(2, '0') }))] })), (0, jsx_runtime_1.jsx)("div", __assign({ class: "artajs__tracking__top__date__aligner" }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ class: "artajas__tracking__top__date__and" }, { children: config.text.inTransitCTAAndLabel })) })), (0, jsx_runtime_1.jsxs)("div", __assign({ class: "artajs__tracking__top__date__aligner" }, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ 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", __assign({ class: "artajs__tracking__top__date__day__numeric" }, { children: "".concat(parsedDates[1].day).padStart(2, '0') }))] }))] })))] })) })));
75
+ };
76
+ exports.TrackingTop = TrackingTop;
@@ -1,7 +1,8 @@
1
1
  import { ArtaJsFullConfig } from './arta';
2
- import { DestinationTextConfig } from './components/Destination';
3
- import { DisqualifiedTextConfig } from './components/Disqualified';
4
- import { QuoteTextConfig } from './components/Quotes';
2
+ import { type DestinationTextConfig } from './components/Destination';
3
+ import { type DisqualifiedTextConfig } from './components/Disqualified';
4
+ import { type QuoteTextConfig } from './components/Quotes';
5
+ import { type DeepPartial } from './helper';
5
6
  import { AdditionalService, ArtaLocation, ArtaObject, Insurance, QuoteType, SupportedCurrency } from './MetadataTypes';
6
7
  export interface EstimateBody {
7
8
  origin: ArtaLocation;
@@ -52,12 +53,8 @@ export interface EstimateConfig {
52
53
  disqualified: DisqualifiedTextConfig;
53
54
  };
54
55
  }
55
- type DeepPartial<T> = T extends object ? {
56
- [P in keyof T]?: DeepPartial<T[P]>;
57
- } : T;
58
56
  export type PartialEstimateConfig = DeepPartial<EstimateConfig>;
59
57
  export interface EstimateFullConfig extends EstimateConfig, ArtaJsFullConfig {
60
58
  }
61
59
  export declare const defaultEstimateConfig: EstimateConfig;
62
- export declare const getFullConfig: (artaConfig: ArtaJsFullConfig, estimateConfig?: PartialEstimateConfig) => EstimateFullConfig;
63
- export {};
60
+ export declare const getFullEstimateConfig: (artaConfig: ArtaJsFullConfig, estimateConfig?: PartialEstimateConfig) => EstimateFullConfig;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFullConfig = exports.defaultEstimateConfig = void 0;
3
+ exports.getFullEstimateConfig = exports.defaultEstimateConfig = void 0;
4
4
  var Destination_1 = require("./components/Destination");
5
5
  var Disqualified_1 = require("./components/Disqualified");
6
6
  var Quotes_1 = require("./components/Quotes");
@@ -43,32 +43,9 @@ exports.defaultEstimateConfig = {
43
43
  disqualified: Disqualified_1.defaultDisqualifiedConfig,
44
44
  },
45
45
  };
46
- function nestedObjectAssign(target) {
47
- var sources = [];
48
- for (var _i = 1; _i < arguments.length; _i++) {
49
- sources[_i - 1] = arguments[_i];
50
- }
51
- sources.forEach(function (source) {
52
- if (source) {
53
- Object.keys(source).forEach(function (key) {
54
- var s_val = source[key];
55
- var t_val = target[key];
56
- target[key] =
57
- t_val &&
58
- s_val &&
59
- typeof t_val === 'object' &&
60
- typeof s_val === 'object'
61
- ? nestedObjectAssign(t_val, s_val)
62
- : s_val;
63
- });
64
- }
65
- });
66
- return target;
67
- }
68
- var getFullConfig = function (artaConfig, estimateConfig) {
69
- var defaultClone = JSON.parse(JSON.stringify(exports.defaultEstimateConfig));
70
- var finalConfig = nestedObjectAssign(defaultClone, artaConfig, estimateConfig);
46
+ var getFullEstimateConfig = function (artaConfig, estimateConfig) {
47
+ var finalConfig = (0, helper_1.nestedObjectAssign)((0, helper_1.deepClone)(exports.defaultEstimateConfig), artaConfig, estimateConfig);
71
48
  (0, helper_1.applySmallMobileStyling)(finalConfig);
72
49
  return finalConfig;
73
50
  };
74
- exports.getFullConfig = getFullConfig;
51
+ exports.getFullEstimateConfig = getFullEstimateConfig;
package/dist/helper.d.ts CHANGED
@@ -3,6 +3,7 @@ import { DisqualifiedFullTextConfig } from './components/Disqualified';
3
3
  import { QuoteFullTextConfig } from './components/Quotes';
4
4
  import { EstimateFullConfig } from './estimateConfig';
5
5
  import { ArtaLocation } from './MetadataTypes';
6
+ import { TrackingFullConfig } from './trackingConfig';
6
7
  export declare const parseEstimatedLocation: (loc: ArtaLocation) => string;
7
8
  export declare const parseErrors: (errors: {
8
9
  [key: string]: string;
@@ -10,7 +11,7 @@ export declare const parseErrors: (errors: {
10
11
  export declare const getQuoteConfig: (config: EstimateFullConfig) => QuoteFullTextConfig;
11
12
  export declare const getDisqualifiedConfig: (config: EstimateFullConfig) => DisqualifiedFullTextConfig;
12
13
  export declare const getDestinationConfig: (config: EstimateFullConfig) => DestinationFullTextConfig;
13
- export declare const getStyle: (config: EstimateFullConfig) => {
14
+ export declare const getEstimateStyle: (config: EstimateFullConfig) => {
14
15
  '--background': string;
15
16
  '--text-primary': string;
16
17
  '--text-secondary': string;
@@ -31,5 +32,26 @@ export declare const getStyle: (config: EstimateFullConfig) => {
31
32
  '--width': string;
32
33
  '--height': string;
33
34
  };
35
+ export declare const getTrackingStyle: (config: TrackingFullConfig) => {
36
+ '--background': string;
37
+ '--text-primary': string;
38
+ '--text-secondary': string;
39
+ '--border': string;
40
+ '--font-family': string;
41
+ '--font-size': string;
42
+ '--width': string;
43
+ '--default-styling': string;
44
+ '--minimal-styling': string;
45
+ '--location-direction': string;
46
+ '--location-justify': string;
47
+ '--location-align': string;
48
+ '--location-flex': string;
49
+ '--backdrop-color': string;
50
+ };
34
51
  export declare function isSmallMobile(): boolean;
35
52
  export declare function applySmallMobileStyling(finalConfig: EstimateFullConfig): void;
53
+ export type DeepPartial<T> = T extends object ? {
54
+ [P in keyof T]?: DeepPartial<T[P]>;
55
+ } : T;
56
+ export declare function nestedObjectAssign(target: any, ...sources: any[]): any;
57
+ export declare function deepClone<T>(obj: T): T;
package/dist/helper.js CHANGED
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.applySmallMobileStyling = exports.isSmallMobile = exports.getStyle = exports.getDestinationConfig = exports.getDisqualifiedConfig = exports.getQuoteConfig = exports.parseErrors = exports.parseEstimatedLocation = void 0;
14
+ exports.deepClone = exports.nestedObjectAssign = exports.applySmallMobileStyling = exports.isSmallMobile = exports.getTrackingStyle = exports.getEstimateStyle = exports.getDestinationConfig = exports.getDisqualifiedConfig = exports.getQuoteConfig = exports.parseErrors = exports.parseEstimatedLocation = void 0;
15
15
  var parseEstimatedLocation = function (loc) {
16
16
  if (!loc) {
17
17
  return '';
@@ -55,7 +55,7 @@ var getDestinationConfig = function (config) {
55
55
  return __assign(__assign({}, config.text.destination), { detailOriginLabel: config.text.detailOriginLabel, background: config.style.color.background });
56
56
  };
57
57
  exports.getDestinationConfig = getDestinationConfig;
58
- var getStyle = function (config) {
58
+ var getEstimateStyle = function (config) {
59
59
  return {
60
60
  '--background': config.style.color.background,
61
61
  '--text-primary': config.style.color.textPrimary,
@@ -78,13 +78,31 @@ var getStyle = function (config) {
78
78
  '--height': "".concat(config.style.height, "px"),
79
79
  };
80
80
  };
81
- exports.getStyle = getStyle;
81
+ exports.getEstimateStyle = getEstimateStyle;
82
+ var getTrackingStyle = function (config) {
83
+ return {
84
+ '--background': config.style.color.background,
85
+ '--text-primary': config.style.color.textPrimary,
86
+ '--text-secondary': config.style.color.textSecondary,
87
+ '--border': config.style.color.border,
88
+ '--font-family': config.style.fontFamily,
89
+ '--font-size': "".concat(config.style.fontSize, "px"),
90
+ '--width': config.style.variant === 'default' ? '540px' : '320px',
91
+ '--default-styling': config.style.variant === 'default' ? 'flex' : 'none',
92
+ '--minimal-styling': config.style.variant === 'default' ? 'none' : 'flex',
93
+ '--location-direction': config.style.variant === 'default' ? 'row' : 'column',
94
+ '--location-justify': config.style.variant === 'default' ? 'center' : 'flex-start',
95
+ '--location-align': config.style.variant === 'default' ? 'flex-start' : 'center',
96
+ '--location-flex': config.style.variant === 'default' ? '1 0 0' : '0 1 auto',
97
+ '--backdrop-color': config.style.backdropColor,
98
+ };
99
+ };
100
+ exports.getTrackingStyle = getTrackingStyle;
82
101
  var MINIMUM_RENDERING_HEIGHT = 467;
83
102
  function isSmallMobile() {
84
- return ((window.innerWidth <= 800) && (window.innerHeight <= 600));
103
+ return window.innerWidth <= 800 && window.innerHeight <= 600;
85
104
  }
86
105
  exports.isSmallMobile = isSmallMobile;
87
- ;
88
106
  function applySmallMobileStyling(finalConfig) {
89
107
  if (isSmallMobile()) {
90
108
  finalConfig.style.position = 'center';
@@ -93,4 +111,30 @@ function applySmallMobileStyling(finalConfig) {
93
111
  }
94
112
  }
95
113
  exports.applySmallMobileStyling = applySmallMobileStyling;
96
- ;
114
+ function nestedObjectAssign(target) {
115
+ var sources = [];
116
+ for (var _i = 1; _i < arguments.length; _i++) {
117
+ sources[_i - 1] = arguments[_i];
118
+ }
119
+ sources.forEach(function (source) {
120
+ if (source) {
121
+ Object.keys(source).forEach(function (key) {
122
+ var s_val = source[key];
123
+ var t_val = target[key];
124
+ target[key] =
125
+ t_val &&
126
+ s_val &&
127
+ typeof t_val === 'object' &&
128
+ typeof s_val === 'object'
129
+ ? nestedObjectAssign(t_val, s_val)
130
+ : s_val;
131
+ });
132
+ }
133
+ });
134
+ return target;
135
+ }
136
+ exports.nestedObjectAssign = nestedObjectAssign;
137
+ function deepClone(obj) {
138
+ return JSON.parse(JSON.stringify(obj));
139
+ }
140
+ exports.deepClone = deepClone;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import Arta from './arta';
2
2
  import './components/Modal/index.css';
3
+ import './components/TrackingDrawer/index.css';
3
4
  export * from './arta';
4
5
  export * from './estimate';
5
- export type { EstimateConfig, EstimateBody, PartialEstimateConfig } from './estimateConfig';
6
+ export * from './tracking';
7
+ export type { EstimateConfig, EstimateBody, PartialEstimateConfig, } from './estimateConfig';
8
+ export type { TrackingConfig, PartialTrackingConfig } from './trackingConfig';
6
9
  declare const _default: Arta;
7
10
  export default _default;
package/dist/index.js CHANGED
@@ -19,10 +19,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  var arta_1 = __importDefault(require("./arta"));
21
21
  require("./components/Modal/index.css");
22
+ require("./components/TrackingDrawer/index.css");
22
23
  var init = function () {
23
24
  window.Arta = new arta_1.default();
24
25
  };
25
26
  init();
26
27
  __exportStar(require("./arta"), exports);
27
28
  __exportStar(require("./estimate"), exports);
29
+ __exportStar(require("./tracking"), exports);
28
30
  exports.default = window.Arta;
@@ -1,4 +1,6 @@
1
1
  import { ArtaJsFullConfig } from './arta';
2
+ import { ArtaPackageEvent } from './components/PackageEvents';
3
+ import type { Shipment } from './components/TrackingDrawer';
2
4
  import { EstimateBody } from './estimateConfig';
3
5
  import { ArtaLocation, Insurance, Quote, SupportedCurrency } from './MetadataTypes';
4
6
  export interface HostedSession {
@@ -23,3 +25,6 @@ export interface ArtaError {
23
25
  export declare const loadHostedSessions: (config: ArtaJsFullConfig, estimateBody: EstimateBody) => Promise<HostedSession>;
24
26
  export declare const loadQuoteRequests: (config: ArtaJsFullConfig, hostedSession: HostedSession, estimateBody: EstimateBody) => Promise<QuoteRequest>;
25
27
  export declare const validateEstimateBody: (config: ArtaJsFullConfig, estimateBody: EstimateBody) => Promise<any>;
28
+ export declare const loadShipment: (config: ArtaJsFullConfig, shipmentId: string) => Promise<Shipment>;
29
+ export declare const validateShipment: (config: ArtaJsFullConfig, shipmentId: string) => Promise<any>;
30
+ export declare const loadPackageEvents: (config: ArtaJsFullConfig, shipmentId: string, packageId: number) => Promise<Array<ArtaPackageEvent>>;