oa-componentbook 1.0.1-stage.5 → 1.0.1-stage.51

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 (35) hide show
  1. package/build/components/oa-component-accordion/Accordion.js +16 -5
  2. package/build/components/oa-component-feedback-form/FeedbackForm.js +75 -0
  3. package/build/components/oa-component-feedback-tooltip/FeedbackTooltip.js +69 -0
  4. package/build/components/oa-component-info/CustomInfo.js +9 -4
  5. package/build/components/oa-component-info/styles.js +3 -3
  6. package/build/global-css/GlobalCss.js +2 -1
  7. package/build/global-css/GridLayout.js +1 -1
  8. package/build/global-css/commonStyles.js +11 -0
  9. package/build/images/oaChat.svg +5 -0
  10. package/build/index.js +28 -0
  11. package/build/layout/paymentAndConsent/CancelScreen.js +46 -0
  12. package/build/layout/paymentAndConsent/ConsentCard.js +68 -0
  13. package/build/layout/paymentAndConsent/DetailsCard.js +75 -0
  14. package/build/layout/paymentAndConsent/DetailsList.js +38 -0
  15. package/build/layout/paymentAndConsent/Header.js +33 -0
  16. package/build/layout/paymentAndConsent/InProgressScreen.js +46 -0
  17. package/build/layout/paymentAndConsent/Loader.js +21 -0
  18. package/build/layout/paymentAndConsent/Modal.js +28 -0
  19. package/build/layout/paymentAndConsent/PaymentAndConsent.js +22 -0
  20. package/build/layout/paymentAndConsent/PaymentCard.js +83 -0
  21. package/build/layout/paymentAndConsent/Section.js +34 -0
  22. package/build/layout/paymentAndConsent/SuccessScreen.js +46 -0
  23. package/build/layout/paymentAndConsent/TimeLineCard.js +28 -0
  24. package/build/layout/paymentAndConsent/TncList.js +32 -0
  25. package/build/layout/paymentAndConsent/style.js +12 -0
  26. package/build/widgets/oa-widget-add-spare-part/AddSparePartCollapseWidget.js +10 -9
  27. package/build/widgets/oa-widget-document-upload/DocUploadWidget.js +28 -28
  28. package/build/widgets/oa-widget-feedback/FeedbackWidget.js +83 -0
  29. package/build/widgets/oa-widget-feedback/styles.js +13 -0
  30. package/build/widgets/oa-widget-image-carousel/ImageCarouselWidget.js +257 -0
  31. package/build/widgets/oa-widget-image-carousel/styles.js +23 -0
  32. package/build/widgets/oa-widget-track-shipment/TrackShipmentWidget.js +4 -2
  33. package/build/widgets/oa-widget-track-shipment-list/TrackShipmentWidgetList.js +82 -84
  34. package/build/widgets/oa-widget-track-shipment-list/fn.js +32 -4
  35. package/package.json +5 -2
@@ -1,105 +1,103 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.weak-map.js");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.default = void 0;
8
- require("core-js/modules/web.dom-collections.iterator.js");
9
- require("core-js/modules/es.promise.js");
10
- var _react = _interopRequireWildcard(require("react"));
11
- var _antd = require("antd");
7
+ var _react = _interopRequireDefault(require("react"));
12
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
9
  var _fn = require("./fn");
14
10
  var _TrackShipmentWidget = _interopRequireDefault(require("../oa-widget-track-shipment/TrackShipmentWidget"));
11
+ var _Accordion = _interopRequireDefault(require("../../components/oa-component-accordion/Accordion"));
15
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
17
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
13
  function TrackShipmentWidgetList(_ref) {
19
- var _shipmentData$map;
14
+ var _assignments$map;
20
15
  let {
21
- shipmentData
16
+ shipmentData,
17
+ onChange
22
18
  } = _ref;
23
- const [historyData, setHistoryData] = (0, _react.useState)({});
24
- const [loading, setLoading] = (0, _react.useState)({});
25
- const fetchStatusXData = async reassignmentId => {};
26
- const getSingleShipmentHistory = item => {
27
- var _item$stages;
28
- return {
29
- awbNumber: item === null || item === void 0 ? void 0 : item.awb,
30
- partnerName: item === null || item === void 0 ? void 0 : item.partnerName,
31
- fromAddress: {
32
- heading: 'From Address:',
33
- addressLine1: item === null || item === void 0 ? void 0 : item.origAddressFullName,
34
- addressLine2: item === null || item === void 0 ? void 0 : item.originAddressLine1,
35
- pincode: item === null || item === void 0 ? void 0 : item.originPincode,
36
- city: item === null || item === void 0 ? void 0 : item.originDistrict
37
- },
38
- toAddress: {
39
- heading: 'To Address:',
40
- addressLine1: item === null || item === void 0 ? void 0 : item.destAddressFullName,
41
- addressLine2: item === null || item === void 0 ? void 0 : item.destAddressLine1,
42
- pincode: item === null || item === void 0 ? void 0 : item.destPincode,
43
- city: item === null || item === void 0 ? void 0 : item.destDistrict
44
- },
45
- tableData: (_item$stages = item === null || item === void 0 ? void 0 : item.stages) !== null && _item$stages !== void 0 ? _item$stages : []
46
- };
47
- };
48
- if (!shipmentData || shipmentData.length === 0) {
49
- return /*#__PURE__*/_react.default.createElement("p", null, "No shipment data available.");
19
+ const assignments = (shipmentData === null || shipmentData === void 0 ? void 0 : shipmentData.assignments) || [];
20
+ if (assignments.length === 0) {
21
+ return /*#__PURE__*/_react.default.createElement(_TrackShipmentWidget.default, (0, _fn.getSingleShipmentHistory)(shipmentData));
50
22
  }
51
- if (shipmentData.length === 1) {
52
- return /*#__PURE__*/_react.default.createElement(_TrackShipmentWidget.default, getSingleShipmentHistory(shipmentData[0]));
23
+ if (assignments.length === 1) {
24
+ return /*#__PURE__*/_react.default.createElement(_TrackShipmentWidget.default, (0, _fn.getSingleShipmentHistory)(assignments[0]));
53
25
  }
54
- return shipmentData === null || shipmentData === void 0 || (_shipmentData$map = shipmentData.map) === null || _shipmentData$map === void 0 ? void 0 : _shipmentData$map.call(shipmentData, (item, index) => {
55
- if ((item === null || item === void 0 ? void 0 : item.status) === 'X') {
56
- var _historyData$reassign;
57
- const reassignmentId = item === null || item === void 0 ? void 0 : item.reassignmentId;
58
- return /*#__PURE__*/_react.default.createElement(_antd.Collapse, {
59
- key: reassignmentId,
60
- onChange: keys => {
61
- console.log('keys:', keys);
62
- if (keys.length > 0) {
63
- fetchStatusXData(reassignmentId);
64
- }
65
- },
66
- items: [{
67
- key: reassignmentId,
68
- label: "".concat((0, _fn.getCurrentShipmentLabel)(index + 1), " | ").concat((0, _fn.getDateString)(item === null || item === void 0 ? void 0 : item.reassignmentTime, item === null || item === void 0 ? void 0 : item.modifiedTime)),
69
- children: loading[reassignmentId] ? /*#__PURE__*/_react.default.createElement(_antd.Spin, null) : /*#__PURE__*/_react.default.createElement("p", null, ((_historyData$reassign = historyData[reassignmentId]) === null || _historyData$reassign === void 0 ? void 0 : _historyData$reassign.details) || 'No details available')
70
- }]
71
- });
72
- }
73
- if ((item === null || item === void 0 ? void 0 : item.status) === 'A') {
74
- console.log('item:', item);
75
- return /*#__PURE__*/_react.default.createElement(_antd.Collapse, {
76
- key: item === null || item === void 0 ? void 0 : item.reassignmentId,
77
- items: [{
78
- key: item === null || item === void 0 ? void 0 : item.reassignmentId,
79
- label: "".concat((0, _fn.getCurrentShipmentLabel)(index + 1), " | ").concat((0, _fn.getDateString)(item === null || item === void 0 ? void 0 : item.reassignmentTime, item === null || item === void 0 ? void 0 : item.modifiedTime), "-Present"),
80
- children: /*#__PURE__*/_react.default.createElement(_TrackShipmentWidget.default, getSingleShipmentHistory(item))
81
- }]
82
- });
83
- }
84
- return null;
26
+ const lastReassignmentId = assignments && assignments.length > 0 ? assignments[assignments.length - 1].assignmentId || 0 : 0;
27
+ return assignments === null || assignments === void 0 || (_assignments$map = assignments.map) === null || _assignments$map === void 0 ? void 0 : _assignments$map.call(assignments, (item, index) => {
28
+ const {
29
+ assignmentId,
30
+ assignmentDate,
31
+ assignmentClosedTime,
32
+ status
33
+ } = item !== null && item !== void 0 ? item : {};
34
+ return /*#__PURE__*/_react.default.createElement("div", {
35
+ className: "margin-bottom-16",
36
+ key: assignmentId
37
+ }, /*#__PURE__*/_react.default.createElement(_Accordion.default, {
38
+ defaultActiveKey: lastReassignmentId,
39
+ activeKey: assignmentId,
40
+ body: /*#__PURE__*/_react.default.createElement(_TrackShipmentWidget.default, (0, _fn.getSingleShipmentHistory)(item)),
41
+ headerText: (0, _fn.headerText)(index, assignmentDate, assignmentClosedTime, status)
42
+ }));
85
43
  });
86
44
  }
45
+ const HistoryPropType = _propTypes.default.shape({
46
+ shipmentStatus: _propTypes.default.string.isRequired,
47
+ fromDate: _propTypes.default.string.isRequired,
48
+ toDate: _propTypes.default.string.isRequired,
49
+ partnerStatus: _propTypes.default.string,
50
+ customerDisplayStatus: _propTypes.default.string.isRequired,
51
+ oneassistDisplayStatus: _propTypes.default.string.isRequired,
52
+ stageConsistent: _propTypes.default.bool.isRequired
53
+ });
54
+ const AssignmentPropType = _propTypes.default.shape({
55
+ assignmentDate: _propTypes.default.number.isRequired,
56
+ assignmentClosedTime: _propTypes.default.number.isRequired,
57
+ logisticPartnerName: _propTypes.default.string.isRequired,
58
+ assignmentId: _propTypes.default.number.isRequired,
59
+ logisticPartnerRefNum: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
60
+ originAddressLine1: _propTypes.default.string.isRequired,
61
+ originDistrict: _propTypes.default.string.isRequired,
62
+ originPincode: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
63
+ destAddressLine1: _propTypes.default.string.isRequired,
64
+ destDistrict: _propTypes.default.string,
65
+ destPincode: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
66
+ history: _propTypes.default.arrayOf(HistoryPropType).isRequired,
67
+ origAddressFullName: _propTypes.default.string.isRequired,
68
+ destAddressFullName: _propTypes.default.string.isRequired,
69
+ assignments: _propTypes.default.arrayOf(_propTypes.default.shape({
70
+ logisticPartnerRefNum: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
71
+ originAddressLine1: _propTypes.default.string.isRequired,
72
+ originDistrict: _propTypes.default.string.isRequired,
73
+ originPincode: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
74
+ destAddressLine1: _propTypes.default.string.isRequired,
75
+ destDistrict: _propTypes.default.string,
76
+ destPincode: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
77
+ history: _propTypes.default.arrayOf(HistoryPropType).isRequired,
78
+ origAddressFullName: _propTypes.default.string.isRequired,
79
+ destAddressFullName: _propTypes.default.string.isRequired,
80
+ assignments: _propTypes.default.array // Placeholder to break recursion
81
+ }))
82
+ });
87
83
  TrackShipmentWidgetList.propTypes = {
88
- shipmentData: _propTypes.default.arrayOf(_propTypes.default.shape({
89
- reassignmentId: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
90
- status: _propTypes.default.string.isRequired,
91
- awb: _propTypes.default.string,
92
- origAddressFullName: _propTypes.default.string,
93
- originAddressLine1: _propTypes.default.string,
94
- originPincode: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
95
- originDistrict: _propTypes.default.string,
96
- destAddressFullName: _propTypes.default.string,
97
- destAddressLine1: _propTypes.default.string,
98
- destPincode: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
84
+ shipmentData: _propTypes.default.shape({
85
+ logisticPartnerRefNum: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
86
+ originAddressLine1: _propTypes.default.string.isRequired,
87
+ originDistrict: _propTypes.default.string.isRequired,
88
+ originPincode: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
89
+ destAddressLine1: _propTypes.default.string.isRequired,
99
90
  destDistrict: _propTypes.default.string,
100
- reassignmentTime: _propTypes.default.string,
101
- modifiedTime: _propTypes.default.string,
102
- stages: _propTypes.default.array
103
- })).isRequired
91
+ destPincode: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
92
+ history: _propTypes.default.arrayOf(HistoryPropType).isRequired,
93
+ origAddressFullName: _propTypes.default.string.isRequired,
94
+ destAddressFullName: _propTypes.default.string.isRequired,
95
+ assignments: _propTypes.default.arrayOf(AssignmentPropType)
96
+ }),
97
+ onChange: _propTypes.default.func
98
+ };
99
+ TrackShipmentWidgetList.defaultProps = {
100
+ shipmentData: {},
101
+ onChange: () => {}
104
102
  };
105
103
  var _default = exports.default = TrackShipmentWidgetList;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getDateString = exports.getCurrentShipmentLabel = void 0;
6
+ exports.isActive = exports.headerText = exports.getSingleShipmentHistory = exports.getDateString = exports.getCurrentShipmentLabel = void 0;
7
7
  function numberToOrdinal(number) {
8
8
  const suffixes = ['th', 'st', 'nd', 'rd'];
9
9
  const value = number % 100;
@@ -15,7 +15,7 @@ const getDateFromEpoch = date => {
15
15
  if (!date) {
16
16
  return '';
17
17
  }
18
- const dateObj = new Date(date * 1000);
18
+ const dateObj = new Date(date);
19
19
  const day = dateObj.getDate();
20
20
  const month = dateObj.getMonth();
21
21
  const year = dateObj.getFullYear();
@@ -36,6 +36,34 @@ const getDateString = (startTime, endTime) => {
36
36
  exports.getDateString = getDateString;
37
37
  const getCurrentShipmentLabel = number => {
38
38
  const ordinalNumber = numberToOrdinal(number);
39
- return "Shipment ".concat(ordinalNumber);
39
+ return "".concat(ordinalNumber, " Shipment");
40
40
  };
41
- exports.getCurrentShipmentLabel = getCurrentShipmentLabel;
41
+ exports.getCurrentShipmentLabel = getCurrentShipmentLabel;
42
+ const isActive = time => time === null;
43
+ exports.isActive = isActive;
44
+ const headerText = (index, reassignmentTime, modifiedTime, status) => "".concat(getCurrentShipmentLabel(index + 1), " | ").concat(getDateString(reassignmentTime, modifiedTime)).concat(isActive(modifiedTime) ? ' - Present' : '');
45
+ exports.headerText = headerText;
46
+ const getSingleShipmentHistory = item => {
47
+ var _item$history;
48
+ return {
49
+ partnerName: item === null || item === void 0 ? void 0 : item.logisticPartnerName,
50
+ errorReason: item === null || item === void 0 ? void 0 : item.failureReason,
51
+ awbNumber: item === null || item === void 0 ? void 0 : item.logisticPartnerRefNum,
52
+ fromAddress: {
53
+ heading: 'From Address:',
54
+ addressLine1: item === null || item === void 0 ? void 0 : item.origAddressFullName,
55
+ addressLine2: item === null || item === void 0 ? void 0 : item.originAddressLine1,
56
+ pincode: item === null || item === void 0 ? void 0 : item.originPincode,
57
+ city: item === null || item === void 0 ? void 0 : item.originDistrict
58
+ },
59
+ toAddress: {
60
+ heading: 'To Address:',
61
+ addressLine1: item === null || item === void 0 ? void 0 : item.destAddressFullName,
62
+ addressLine2: item === null || item === void 0 ? void 0 : item.destAddressLine1,
63
+ pincode: item === null || item === void 0 ? void 0 : item.destPincode,
64
+ city: item === null || item === void 0 ? void 0 : item.destDistrict
65
+ },
66
+ tableData: (_item$history = item === null || item === void 0 ? void 0 : item.history) !== null && _item$history !== void 0 ? _item$history : []
67
+ };
68
+ };
69
+ exports.getSingleShipmentHistory = getSingleShipmentHistory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oa-componentbook",
3
- "version": "1.0.1-stage.5",
3
+ "version": "1.0.1-stage.51",
4
4
  "private": false,
5
5
  "description": "Reusable components",
6
6
  "main": "build/index.js",
@@ -27,7 +27,7 @@
27
27
  "react-markdown": "^8.0.7",
28
28
  "react-pattern-lock": "^12.0.12",
29
29
  "react-pdf": "^5.3.0",
30
- "react-zoom-pan-pinch": "^3.4.4"
30
+ "react-zoom-pan-pinch": "^3.7.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@babel/cli": "^7.22.9",
@@ -47,6 +47,7 @@
47
47
  "babel-plugin-named-exports-order": "^0.0.2",
48
48
  "eslint-config-airbnb": "^19.0.4",
49
49
  "eslint-plugin-storybook": "^0.6.15",
50
+ "onchange": "^6.1.0",
50
51
  "pre-commit": "^1.2.2",
51
52
  "react-scripts": "^5.0.1",
52
53
  "storybook": "^7.6.3",
@@ -66,6 +67,8 @@
66
67
  "scripts": {
67
68
  "start": "react-scripts start",
68
69
  "build": "rm -rf build && NODE_ENV=production babel src/lib --out-dir build --copy-files",
70
+ "publish:local": "npm run build && yalc push --force",
71
+ "watch:publish": "onchange 'src/lib/**/*' -- npm run publish:local",
69
72
  "storybook": "storybook dev -p 6006",
70
73
  "build-storybook": "storybook build",
71
74
  "update-package-lock": "npm i --package-lock-only",