@mseva/digit-ui-module-ptr 1.1.24 → 1.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8923,6 +8923,17 @@ function _catch(body, recover) {
8923
8923
  }
8924
8924
  return result;
8925
8925
  }
8926
+ function _finallyRethrows(body, finalizer) {
8927
+ try {
8928
+ var result = body();
8929
+ } catch (e) {
8930
+ return finalizer(true, e);
8931
+ }
8932
+ if (result && result.then) {
8933
+ return result.then(finalizer.bind(null, false), finalizer.bind(null, true));
8934
+ }
8935
+ return finalizer(false, result);
8936
+ }
8926
8937
 
8927
8938
  const PTRDocumentUpload = _ref => {
8928
8939
  var _formData$documents, _data$PetService;
@@ -18713,17 +18724,30 @@ const PTRWFApplicationTimeline = props => {
18713
18724
  }
18714
18725
  };
18715
18726
  React.useEffect(() => {
18716
- let WorkflowService = null;
18717
- try {
18718
- setLoader(true);
18719
- return Promise.resolve(Digit.WorkflowService.init(tenantId, "ptr")).then(function (_Digit$WorkflowServic) {
18720
- var _WorkflowService, _WorkflowService$Busi, _WorkflowService$Busi2;
18721
- WorkflowService = _Digit$WorkflowServic;
18722
- setLoader(false);
18723
- setWorkflowService((_WorkflowService = WorkflowService) === null || _WorkflowService === void 0 ? void 0 : (_WorkflowService$Busi = _WorkflowService.BusinessServices) === null || _WorkflowService$Busi === void 0 ? void 0 : (_WorkflowService$Busi2 = _WorkflowService$Busi[0]) === null || _WorkflowService$Busi2 === void 0 ? void 0 : _WorkflowService$Busi2.states);
18724
- });
18725
- } catch (e) {
18726
- Promise.reject(e);
18727
+ const fetchWorkflowService = function () {
18728
+ try {
18729
+ const _temp2 = _finallyRethrows(function () {
18730
+ return _catch(function () {
18731
+ setLoader(true);
18732
+ return Promise.resolve(Digit.WorkflowService.init(tenantId, "ptr")).then(function (WorkflowService) {
18733
+ var _WorkflowService$Busi, _WorkflowService$Busi2;
18734
+ setWorkflowService((WorkflowService === null || WorkflowService === void 0 ? void 0 : (_WorkflowService$Busi = WorkflowService.BusinessServices) === null || _WorkflowService$Busi === void 0 ? void 0 : (_WorkflowService$Busi2 = _WorkflowService$Busi[0]) === null || _WorkflowService$Busi2 === void 0 ? void 0 : _WorkflowService$Busi2.states) || []);
18735
+ });
18736
+ }, function (error) {
18737
+ console.error("Error fetching workflow service:", error);
18738
+ });
18739
+ }, function (_wasThrown, _result) {
18740
+ setLoader(false);
18741
+ if (_wasThrown) throw _result;
18742
+ return _result;
18743
+ });
18744
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
18745
+ } catch (e) {
18746
+ return Promise.reject(e);
18747
+ }
18748
+ };
18749
+ if (tenantId) {
18750
+ fetchWorkflowService();
18727
18751
  }
18728
18752
  }, [tenantId]);
18729
18753
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(React.Fragment, null, (workflowDetails === null || workflowDetails === void 0 ? void 0 : (_workflowDetails$data1 = workflowDetails.data) === null || _workflowDetails$data1 === void 0 ? void 0 : (_workflowDetails$data10 = _workflowDetails$data1.timeline) === null || _workflowDetails$data10 === void 0 ? void 0 : _workflowDetails$data10.length) > 0 && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardSectionHeader, {
@@ -18777,7 +18801,7 @@ const PTRWFApplicationTimeline = props => {
18777
18801
  label: error,
18778
18802
  isDleteBtn: true,
18779
18803
  onClose: closeToast
18780
- }), ( getLoader) && /*#__PURE__*/React__default.createElement(Loader, {
18804
+ }), getLoader && /*#__PURE__*/React__default.createElement(Loader, {
18781
18805
  page: true
18782
18806
  }));
18783
18807
  };
@@ -19190,6 +19214,7 @@ const PetApplication = _ref => {
19190
19214
  }]);
19191
19215
  const checkRenewTime = data === null || data === void 0 ? void 0 : (_data$PetService = data.PetService) === null || _data$PetService === void 0 ? void 0 : (_data$PetService$Appl = _data$PetService.ApplicationType) === null || _data$PetService$Appl === void 0 ? void 0 : _data$PetService$Appl.filter(item => item.code == "RENEWAPPLICATION");
19192
19216
  const checkTimeRenew = checkRenewTime === null || checkRenewTime === void 0 ? void 0 : (_checkRenewTime$ = checkRenewTime[0]) === null || _checkRenewTime$ === void 0 ? void 0 : _checkRenewTime$.renewalPeriod;
19217
+ console.log("checkTimeRenew", checkTimeRenew);
19193
19218
  const parseDate = rawDate => {
19194
19219
  if (!rawDate) return null;
19195
19220
  if (!isNaN(rawDate)) {
@@ -19199,11 +19224,15 @@ const PetApplication = _ref => {
19199
19224
  return new Date(rawDate);
19200
19225
  }
19201
19226
  };
19227
+ console.log("application", application === null || application === void 0 ? void 0 : application.validityDate);
19202
19228
  const validToObj = parseDate(application === null || application === void 0 ? void 0 : application.validityDate);
19203
19229
  const currentDateObj = new Date();
19204
19230
  const duration = validToObj && currentDateObj ? validToObj.getTime() - currentDateObj.getTime() : null;
19231
+ console.log("duration", duration);
19205
19232
  const checkDuration = duration !== null && duration <= checkTimeRenew;
19206
19233
  const checkRenewal = (application === null || application === void 0 ? void 0 : application.status) == "APPROVED" || (application === null || application === void 0 ? void 0 : application.status) == "EXPIRED";
19234
+ console.log("checkRenewal", checkRenewal);
19235
+ console.log("checkDuration", checkDuration);
19207
19236
  return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.KeyNote, {
19208
19237
  keyValue: t("PDF_STATIC_LABEL_APPLICATION_NUMBER_LABEL"),
19209
19238
  note: application === null || application === void 0 ? void 0 : application.applicationNumber