oa-componentbook 0.18.327 → 0.18.328

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.
@@ -15,31 +15,26 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
15
15
  * @param {object} address - The address object containing address details.
16
16
  */
17
17
  function AddressWidget(_ref) {
18
- var _address$additional_i, _address$additional_i2;
19
18
  let {
20
19
  address
21
20
  } = _ref;
22
- return /*#__PURE__*/_react.default.createElement(_styles.AddressContainer, null, address.heading && /*#__PURE__*/_react.default.createElement(_Typography.default, {
21
+ const {
22
+ heading,
23
+ addressLine1,
24
+ addressLine2,
25
+ landmark,
26
+ city,
27
+ pincode
28
+ } = address !== null && address !== void 0 ? address : {};
29
+ return /*#__PURE__*/_react.default.createElement(_styles.AddressContainer, null, heading && /*#__PURE__*/_react.default.createElement(_Typography.default, {
23
30
  typography: "type-b2-400"
24
- }, address.heading), /*#__PURE__*/_react.default.createElement(_styles.AddressLines, null, address.addressLine1 && /*#__PURE__*/_react.default.createElement(_Typography.default, {
31
+ }, heading), /*#__PURE__*/_react.default.createElement(_styles.AddressLines, null, addressLine1 && /*#__PURE__*/_react.default.createElement(_Typography.default, {
25
32
  color: "secondary-content",
26
33
  typography: "type-b2-400"
27
- }, address.addressLine1), address.addressLine2 && /*#__PURE__*/_react.default.createElement(_Typography.default, {
34
+ }, address.addressLine1, ","), /*#__PURE__*/_react.default.createElement(_Typography.default, {
28
35
  color: "secondary-content",
29
36
  typography: "type-b2-400"
30
- }, address.addressLine2), address.addressLine3 && /*#__PURE__*/_react.default.createElement(_Typography.default, {
31
- color: "secondary-content",
32
- typography: "type-b2-400"
33
- }, address.addressLine3), address.landmark && /*#__PURE__*/_react.default.createElement("i", null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
34
- color: "secondary-content",
35
- typography: "type-b2-400"
36
- }, "Near", ' ', address.landmark)), /*#__PURE__*/_react.default.createElement(_Typography.default, {
37
- color: "secondary-content",
38
- typography: "type-b2-400"
39
- }, address.city, ', ', address.state, address.pincode), (address === null || address === void 0 || (_address$additional_i = address.additional_info) === null || _address$additional_i === void 0 ? void 0 : _address$additional_i.lat) && (address === null || address === void 0 || (_address$additional_i2 = address.additional_info) === null || _address$additional_i2 === void 0 ? void 0 : _address$additional_i2.long) && /*#__PURE__*/_react.default.createElement(_Typography.default, {
40
- color: "secondary-content",
41
- typography: "type-b2-400"
42
- }, "Location:", ' ', address.additional_info.lat, ",", address.additional_info.long)));
37
+ }, addressLine2 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, addressLine2, ",", ' ') : null, landmark ? "".concat(landmark, ", ") : null, city ? "".concat(city, ", ") : null, pincode || null)));
43
38
  }
44
39
  AddressWidget.propTypes = {
45
40
  address: _propTypes.default.shape({
@@ -15,7 +15,6 @@ var _AddressForm = _interopRequireDefault(require("./AddressForm"));
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
16
  /* eslint-disable */
17
17
 
18
- // Address Details Component
19
18
  /**
20
19
  * Address Details component.
21
20
  * This component renders the address details and edit button.
@@ -33,13 +32,15 @@ function AddressDetails(_ref) {
33
32
  geolocationData,
34
33
  pinCodeServisible,
35
34
  editLocationHandler,
36
- onFinish
35
+ onFinish,
36
+ showAddressType,
37
+ isSaveButtonDisabled
37
38
  } = _ref;
38
39
  return /*#__PURE__*/_react.default.createElement("div", {
39
40
  className: "addresBoxDiv"
40
41
  }, /*#__PURE__*/_react.default.createElement("div", {
41
42
  className: "addressEdit"
42
- }, /*#__PURE__*/_react.default.createElement("div", {
43
+ }, pinCodeServisible && /*#__PURE__*/_react.default.createElement("div", {
43
44
  className: "addressDetails"
44
45
  }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
45
46
  className: "type-t1-400",
@@ -49,12 +50,12 @@ function AddressDetails(_ref) {
49
50
  }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
50
51
  className: "type-b3-400",
51
52
  color: "secondary-content"
52
- }, (_geolocationData$addr2 = geolocationData.addressLine2) === null || _geolocationData$addr2 === void 0 ? void 0 : _geolocationData$addr2.secondaryAddress, (_geolocationData$addr3 = geolocationData.addressLine2) !== null && _geolocationData$addr3 !== void 0 && (_geolocationData$addr3 = _geolocationData$addr3.mainAddress) !== null && _geolocationData$addr3 !== void 0 && _geolocationData$addr3.includes(geolocationData.pincode) || (_geolocationData$addr4 = geolocationData.addressLine2) !== null && _geolocationData$addr4 !== void 0 && (_geolocationData$addr4 = _geolocationData$addr4.secondaryAddress) !== null && _geolocationData$addr4 !== void 0 && _geolocationData$addr4.includes(geolocationData.pincode) ? '' : ", ".concat(geolocationData.pincode)))), pinCodeServisible && /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
53
+ }, (_geolocationData$addr2 = geolocationData.addressLine2) === null || _geolocationData$addr2 === void 0 ? void 0 : _geolocationData$addr2.secondaryAddress, (_geolocationData$addr3 = geolocationData.addressLine2) !== null && _geolocationData$addr3 !== void 0 && (_geolocationData$addr3 = _geolocationData$addr3.mainAddress) !== null && _geolocationData$addr3 !== void 0 && _geolocationData$addr3.includes(geolocationData.pincode) || (_geolocationData$addr4 = geolocationData.addressLine2) !== null && _geolocationData$addr4 !== void 0 && (_geolocationData$addr4 = _geolocationData$addr4.secondaryAddress) !== null && _geolocationData$addr4 !== void 0 && _geolocationData$addr4.includes(geolocationData.pincode) ? "" : ", ".concat(geolocationData.pincode)))), pinCodeServisible && /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
53
54
  iconConfig: {
54
55
  icon: /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
55
56
  icon: _EditOutlined.default
56
57
  }),
57
- position: 'left'
58
+ position: "left"
58
59
  },
59
60
  size: "small",
60
61
  label: "Edit location",
@@ -62,7 +63,9 @@ function AddressDetails(_ref) {
62
63
  onClick: editLocationHandler
63
64
  })), pinCodeServisible ? /*#__PURE__*/_react.default.createElement(_AddressForm.default, {
64
65
  geolocationData: geolocationData,
65
- onFinish: onFinish
66
+ onFinish: onFinish,
67
+ showAddressType: showAddressType,
68
+ isSaveButtonDisabled: isSaveButtonDisabled
66
69
  }) : /*#__PURE__*/_react.default.createElement(_Typography.default, {
67
70
  color: "negative"
68
71
  }, "Pincode according to your pin on map is Non-serviceable, please move the pin to serviceable pincode."));
@@ -10,6 +10,7 @@ var _antd = require("antd");
10
10
  var _CustomInput = _interopRequireDefault(require("../../components/oa-component-input/CustomInput"));
11
11
  var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
12
12
  var _CustomButton = _interopRequireDefault(require("../../components/oa-component-button/CustomButton"));
13
+ var _CustomRadio = _interopRequireDefault(require("../../components/oa-component-radio/CustomRadio"));
13
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
15
  /* eslint-disable */
15
16
 
@@ -28,7 +29,9 @@ function AddressForm(props) {
28
29
  const [form] = _antd.Form.useForm();
29
30
  const {
30
31
  geolocationData,
31
- onFinish
32
+ onFinish,
33
+ showAddressType,
34
+ isSaveButtonDisabled = false
32
35
  } = props;
33
36
  return /*#__PURE__*/_react.default.createElement(_antd.Form, {
34
37
  form: form,
@@ -51,7 +54,7 @@ function AddressForm(props) {
51
54
  name: "houseNo",
52
55
  rules: [{
53
56
  required: true,
54
- message: 'Please input your House no. / Flat / Floor!'
57
+ message: "Please input your House no. / Flat / Floor!"
55
58
  }]
56
59
  }, /*#__PURE__*/_react.default.createElement(_CustomInput.default, {
57
60
  placeholder: "Type here",
@@ -67,9 +70,31 @@ function AddressForm(props) {
67
70
  name: "landmark"
68
71
  }, /*#__PURE__*/_react.default.createElement(_CustomInput.default, {
69
72
  placeholder: "Type here"
70
- })))), /*#__PURE__*/_react.default.createElement("div", {
73
+ })))), showAddressType && /*#__PURE__*/_react.default.createElement("div", {
74
+ className: "margin-top-12"
75
+ }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
76
+ color: "primary-content",
77
+ className: "type-b2-400"
78
+ }, "Address Type", /*#__PURE__*/_react.default.createElement(_Typography.default, {
79
+ color: "negative"
80
+ }, "*")), /*#__PURE__*/_react.default.createElement("div", {
81
+ className: "margin-top-4"
82
+ }, /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
83
+ name: "addressType",
84
+ rules: [{
85
+ required: true,
86
+ message: "Please select Address Type"
87
+ }]
88
+ }, /*#__PURE__*/_react.default.createElement(_CustomRadio.default.Group, null, /*#__PURE__*/_react.default.createElement(_CustomRadio.default, {
89
+ value: "RESIDENTIAL",
90
+ label: "Residential"
91
+ }), /*#__PURE__*/_react.default.createElement(_CustomRadio.default, {
92
+ value: "COMMERCIAL",
93
+ label: "Commercial"
94
+ }))))), /*#__PURE__*/_react.default.createElement("div", {
71
95
  className: "buttonBottom margin-top-24"
72
96
  }, /*#__PURE__*/_react.default.createElement(_antd.Form.Item, null, /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
97
+ disabled: isSaveButtonDisabled || false,
73
98
  type: "primary",
74
99
  size: "large",
75
100
  label: "Save and Proceed",
@@ -44,7 +44,9 @@ function MapBaseLocation(_ref) {
44
44
  form,
45
45
  onFinish,
46
46
  openLocationNotDetectedModal,
47
- setOpenLocationNotDetectedModalState
47
+ setOpenLocationNotDetectedModalState,
48
+ showAddressType,
49
+ isSaveButtonDisabled
48
50
  } = _ref;
49
51
  return /*#__PURE__*/_react.default.createElement(_styles.MapStyles, null, /*#__PURE__*/_react.default.createElement("div", {
50
52
  className: "containerMap"
@@ -58,7 +60,7 @@ function MapBaseLocation(_ref) {
58
60
  googleMapURL: googleMapURL,
59
61
  loadingElement: /*#__PURE__*/_react.default.createElement("div", {
60
62
  style: {
61
- height: '100%'
63
+ height: "100%"
62
64
  }
63
65
  }),
64
66
  containerElement: /*#__PURE__*/_react.default.createElement("div", {
@@ -66,7 +68,7 @@ function MapBaseLocation(_ref) {
66
68
  }),
67
69
  mapElement: /*#__PURE__*/_react.default.createElement("div", {
68
70
  style: {
69
- height: '100%'
71
+ height: "100%"
70
72
  }
71
73
  }),
72
74
  googleMapRef: googleMapRef,
@@ -74,6 +76,8 @@ function MapBaseLocation(_ref) {
74
76
  fetchAddressFromGoogleApi: fetchAddressFromGoogleApi,
75
77
  setOpenLocationNotDetectedModal: setOpenLocationNotDetectedModal
76
78
  }), /*#__PURE__*/_react.default.createElement(_AddressDetails.default, {
79
+ isSaveButtonDisabled: isSaveButtonDisabled,
80
+ showAddressType: showAddressType,
77
81
  geolocationData: geolocationData,
78
82
  pinCodeServisible: pinCodeServisible,
79
83
  editLocationHandler: editLocationHandler,
@@ -13,6 +13,8 @@ var _react = _interopRequireWildcard(require("react"));
13
13
  var _reactGoogleMaps = require("react-google-maps");
14
14
  var _map_pointer = _interopRequireDefault(require("../../images/map_pointer.svg"));
15
15
  var _currentLocation = _interopRequireDefault(require("../../images/current-location.svg"));
16
+ var _CustomTooltip = _interopRequireDefault(require("../../components/oa-component-tooltip/CustomTooltip"));
17
+ var _InfoBox = _interopRequireDefault(require("react-google-maps/lib/components/addons/InfoBox"));
16
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
19
  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); }
18
20
  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; }
@@ -141,7 +143,20 @@ const MapComponent = (0, _reactGoogleMaps.withScriptjs)((0, _reactGoogleMaps.wit
141
143
  draggable: false,
142
144
  icon: _map_pointer.default,
143
145
  title: "You are here"
144
- }), /*#__PURE__*/_react.default.createElement("div", {
146
+ }, /*#__PURE__*/_react.default.createElement(_InfoBox.default, {
147
+ defaultPosition: markerPosition,
148
+ options: {
149
+ pixelOffset: new window.google.maps.Size(0, -40),
150
+ // Adjust -40 to move higher
151
+ closeBoxURL: "",
152
+ enableEventPropagation: true
153
+ }
154
+ }, /*#__PURE__*/_react.default.createElement(_CustomTooltip.default, {
155
+ placement: "top",
156
+ title: "Place the pin accurately on map",
157
+ defaultOpen: true,
158
+ open: true
159
+ }))), /*#__PURE__*/_react.default.createElement("div", {
145
160
  className: "map-current-location"
146
161
  }, /*#__PURE__*/_react.default.createElement("img", {
147
162
  src: _currentLocation.default,
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isActive = exports.headerText = exports.getSingleShipmentHistory = exports.getDateString = exports.getCurrentShipmentLabel = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7
9
  function numberToOrdinal(number) {
8
10
  const suffixes = ['th', 'st', 'nd', 'rd'];
9
11
  const value = number % 100;
@@ -39,6 +41,12 @@ const getCurrentShipmentLabel = number => {
39
41
  return "".concat(ordinalNumber, " Shipment");
40
42
  };
41
43
  exports.getCurrentShipmentLabel = getCurrentShipmentLabel;
44
+ const showNewLineChar = addressDetail => {
45
+ var _splitedAddress$map;
46
+ const splitedAddress = addressDetail === null || addressDetail === void 0 ? void 0 : addressDetail.split('\n');
47
+ if ((splitedAddress === null || splitedAddress === void 0 ? void 0 : splitedAddress.length) === 1) return addressDetail;
48
+ return (_splitedAddress$map = splitedAddress.map((title, index) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, title, index === 0 && /*#__PURE__*/_react.default.createElement("br", null)))) !== null && _splitedAddress$map !== void 0 ? _splitedAddress$map : '';
49
+ };
42
50
  const isActive = time => time === null;
43
51
  exports.isActive = isActive;
44
52
  const headerText = (index, reassignmentTime, modifiedTime, status) => "".concat(getCurrentShipmentLabel(index + 1), " | ").concat(getDateString(reassignmentTime, modifiedTime)).concat(isActive(modifiedTime) ? ' - Present' : '');
@@ -52,16 +60,20 @@ const getSingleShipmentHistory = item => {
52
60
  fromAddress: {
53
61
  heading: 'From Address:',
54
62
  addressLine1: item === null || item === void 0 ? void 0 : item.origAddressFullName,
55
- addressLine2: item === null || item === void 0 ? void 0 : item.originAddressLine1,
63
+ addressLine2: showNewLineChar(item === null || item === void 0 ? void 0 : item.originAddressLine1),
56
64
  pincode: item === null || item === void 0 ? void 0 : item.originPincode,
57
- city: item === null || item === void 0 ? void 0 : item.originDistrict
65
+ city: item === null || item === void 0 ? void 0 : item.originDistrict,
66
+ landmark: item === null || item === void 0 ? void 0 : item.originLandmark,
67
+ state: item === null || item === void 0 ? void 0 : item.originState
58
68
  },
59
69
  toAddress: {
60
70
  heading: 'To Address:',
61
71
  addressLine1: item === null || item === void 0 ? void 0 : item.destAddressFullName,
62
- addressLine2: item === null || item === void 0 ? void 0 : item.destAddressLine1,
72
+ addressLine2: showNewLineChar(item === null || item === void 0 ? void 0 : item.destAddressLine1),
63
73
  pincode: item === null || item === void 0 ? void 0 : item.destPincode,
64
- city: item === null || item === void 0 ? void 0 : item.destDistrict
74
+ city: item === null || item === void 0 ? void 0 : item.destDistrict,
75
+ landmark: item === null || item === void 0 ? void 0 : item.destLandmark,
76
+ state: item === null || item === void 0 ? void 0 : item.destState
65
77
  },
66
78
  tableData: (_item$history = item === null || item === void 0 ? void 0 : item.history) !== null && _item$history !== void 0 ? _item$history : []
67
79
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oa-componentbook",
3
- "version": "0.18.327",
3
+ "version": "0.18.328",
4
4
  "private": false,
5
5
  "description": "Reusable components",
6
6
  "main": "build/index.js",