@os1-platform/dispatch-mobile 3.1.0 → 3.1.2

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 (32) hide show
  1. package/lib/commonjs/components/executiontasks/validateOTP/ValidateOtpStyles.js +0 -2
  2. package/lib/commonjs/components/executiontasks/validateOTP/ValidateOtpStyles.js.map +1 -1
  3. package/lib/commonjs/manager/dispatch/DispatchStateContainer.js +1 -1
  4. package/lib/commonjs/manager/dispatch/DispatchStateContainer.js.map +1 -1
  5. package/lib/commonjs/manager/syncmanager/events/ETEventsManager.js +6 -7
  6. package/lib/commonjs/manager/syncmanager/events/ETEventsManager.js.map +1 -1
  7. package/lib/commonjs/manager/syncmanager/events/EventsSyncManager.js +1 -0
  8. package/lib/commonjs/manager/syncmanager/events/EventsSyncManager.js.map +1 -1
  9. package/lib/commonjs/ui/screens/DropCashScreen.js +3 -2
  10. package/lib/commonjs/ui/screens/DropCashScreen.js.map +1 -1
  11. package/lib/commonjs/utils/ExecTaskUtils.js +2 -0
  12. package/lib/commonjs/utils/ExecTaskUtils.js.map +1 -1
  13. package/lib/module/components/executiontasks/validateOTP/ValidateOtpStyles.js +0 -2
  14. package/lib/module/components/executiontasks/validateOTP/ValidateOtpStyles.js.map +1 -1
  15. package/lib/module/manager/dispatch/DispatchStateContainer.js +2 -2
  16. package/lib/module/manager/dispatch/DispatchStateContainer.js.map +1 -1
  17. package/lib/module/manager/syncmanager/events/ETEventsManager.js +6 -7
  18. package/lib/module/manager/syncmanager/events/ETEventsManager.js.map +1 -1
  19. package/lib/module/manager/syncmanager/events/EventsSyncManager.js +1 -0
  20. package/lib/module/manager/syncmanager/events/EventsSyncManager.js.map +1 -1
  21. package/lib/module/ui/screens/DropCashScreen.js +3 -2
  22. package/lib/module/ui/screens/DropCashScreen.js.map +1 -1
  23. package/lib/module/utils/ExecTaskUtils.js +2 -0
  24. package/lib/module/utils/ExecTaskUtils.js.map +1 -1
  25. package/lib/typescript/components/executiontasks/validateOTP/ValidateOtpStyles.d.ts +0 -2
  26. package/package.json +4 -4
  27. package/src/components/executiontasks/validateOTP/ValidateOtpStyles.ts +0 -2
  28. package/src/manager/dispatch/DispatchStateContainer.tsx +3 -1
  29. package/src/manager/syncmanager/events/ETEventsManager.ts +6 -7
  30. package/src/manager/syncmanager/events/EventsSyncManager.ts +1 -0
  31. package/src/ui/screens/DropCashScreen.tsx +28 -29
  32. package/src/utils/ExecTaskUtils.ts +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@os1-platform/dispatch-mobile",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "Dispatch SDK React Native Package",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -132,8 +132,8 @@
132
132
  "peerDependencies": {
133
133
  "@apollo/client": "^3.5.6",
134
134
  "@expo-google-fonts/ibm-plex-sans": "*",
135
- "@react-native-async-storage/async-storage": "^1.15.14",
136
- "@react-native-community/datetimepicker": "^3.5.2",
135
+ "@react-native-async-storage/async-storage": ">=1.18.2",
136
+ "@react-native-community/datetimepicker": ">=7.2.0",
137
137
  "@react-native-community/netinfo": "^6.0.2",
138
138
  "@react-native-community/slider": "^4.1.7",
139
139
  "@react-native-firebase/analytics": "20.1.0",
@@ -167,7 +167,7 @@
167
167
  "react-native-vector-icons": "^9.0.0"
168
168
  },
169
169
  "dependencies": {
170
- "@os1-platform/platform-coreos-execution-engine-sdk": "1.1.0",
170
+ "@os1-platform/platform-coreos-execution-engine-sdk": "1.1.1",
171
171
  "@rjsf/core": "^2.0.0",
172
172
  "apollo-link-timeout": "^4.0.0",
173
173
  "decompress": "^4.2.1",
@@ -262,9 +262,7 @@ const styles = StyleSheet.create({
262
262
  },
263
263
  mainBtnStyles: {
264
264
  display: 'flex',
265
- flexDirection: 'row',
266
265
  justifyContent: 'center',
267
- alignItems: 'center',
268
266
  flex: 1,
269
267
  borderRadius: 8,
270
268
  width: '100%',
@@ -32,7 +32,7 @@ import { RouteParams } from '../../ui/uiConfig/RouteParams';
32
32
  import { debounce } from 'lodash';
33
33
  import dispatchEvent from '../../events/EventDispatcher';
34
34
  import EventCodeContainer from '../dispatchCodes/EventCodeContainer';
35
- import { GO_BACK_EVENT_CODE, REASON_NOT_USED } from '../../constants/constants';
35
+ import { GO_BACK_EVENT_CODE, REASON_NOT_USED, RETRY_LIMIT_REACHED_CODE } from '../../constants/constants';
36
36
  import AppSyncManager from '../syncmanager/AppSyncManager';
37
37
  import { DispatchExecutor } from '@os1-platform/platform-coreos-execution-engine-sdk';
38
38
 
@@ -555,6 +555,8 @@ export default class DispatchStateContainer {
555
555
  navigation.replace(CustomScreens.REMARK_SCREEN, rParams);
556
556
  } else {
557
557
  if (_eventCode === GO_BACK_EVENT_CODE) failureCodes = [];
558
+ else if (etOutput.reasonCode === RETRY_LIMIT_REACHED_CODE)
559
+ failureCodes = [];
558
560
  else
559
561
  failureCodes = await reasonsContainer.getReasonCodes(
560
562
  route.params[RouteParams.NEXT_STATES].input.applicableReasons
@@ -638,11 +638,10 @@ export default class ETEventsManager {
638
638
  async getRowToSync(id: string, dispatchId: string): Promise<EventRow[]> {
639
639
  const sqlResult = await Database.executeQuery(
640
640
  `SELECT * from ${EVENTS_TABLE}\
641
- WHERE ${EVENTS_COLUMNS.ID} = ? and \
642
- ${EVENTS_COLUMNS.DISPATCH_ID} = ? and \
641
+ WHERE ${EVENTS_COLUMNS.DISPATCH_ID} = ? and \
643
642
  ${EVENTS_COLUMNS.SYNCED} = 0 \
644
643
  ORDER BY ${EVENTS_COLUMNS.ID} ASC;`,
645
- [id, dispatchId]
644
+ [dispatchId]
646
645
  );
647
646
  return sqlResult.rows._array;
648
647
  }
@@ -654,11 +653,11 @@ export default class ETEventsManager {
654
653
  (SELECT *, \
655
654
  (SELECT SUM(${EVENTS_COLUMNS.DATA_LENGTH}) \
656
655
  FROM ${EVENTS_TABLE} \
657
- WHERE id <= t.id and ${EVENTS_COLUMNS.ID} > ${id} and ${EVENTS_COLUMNS.DISPATCH_ID} \ = '${dispatchId}' and ${EVENTS_COLUMNS.DATA_LENGTH} > 0 and ${EVENTS_COLUMNS.SYNCED} = 0 \
656
+ WHERE ${EVENTS_COLUMNS.DISPATCH_ID} \ = '${dispatchId}' and ${EVENTS_COLUMNS.DATA_LENGTH} > 0 and ${EVENTS_COLUMNS.SYNCED} = 0 \
658
657
  ) total \
659
658
  FROM ${EVENTS_TABLE} t \
660
659
  ) q \
661
- WHERE total <= ${BULK_DATA_LIMIT} \
660
+ WHERE ${EVENTS_COLUMNS.DISPATCH_ID} \ = '${dispatchId}' and ${EVENTS_COLUMNS.DATA_LENGTH} > 0 and ${EVENTS_COLUMNS.SYNCED} = 0 and total <= ${BULK_DATA_LIMIT} \
662
661
  ORDER BY ${EVENTS_COLUMNS.ID};`;
663
662
 
664
663
  const sqlResult = await Database.executeQuery(query, []);
@@ -668,11 +667,11 @@ export default class ETEventsManager {
668
667
  (SELECT *, \
669
668
  (SELECT SUM(${EVENTS_COLUMNS.DATA_LENGTH}) \
670
669
  FROM ${EVENTS_TABLE} \
671
- WHERE id <= t.id and ${EVENTS_COLUMNS.ID} > ${id} and ${EVENTS_COLUMNS.DISPATCH_ID} \ = '${dispatchId}' and ${EVENTS_COLUMNS.DATA_LENGTH} > 0 and ${EVENTS_COLUMNS.SYNCED} = 0 and ${EVENTS_COLUMNS.ATTEMPT_COUNT} < ${MAX_RETRY_COUNT} \
670
+ WHERE ${EVENTS_COLUMNS.DISPATCH_ID} \ = '${dispatchId}' and ${EVENTS_COLUMNS.DATA_LENGTH} > 0 and ${EVENTS_COLUMNS.SYNCED} = 0 and ${EVENTS_COLUMNS.ATTEMPT_COUNT} < ${MAX_RETRY_COUNT} \
672
671
  ) total \
673
672
  FROM ${EVENTS_TABLE} t \
674
673
  ) q \
675
- WHERE total <= ${BULK_DATA_LIMIT} \
674
+ WHERE ${EVENTS_COLUMNS.DISPATCH_ID} \ = '${dispatchId}' and ${EVENTS_COLUMNS.DATA_LENGTH} > 0 and ${EVENTS_COLUMNS.SYNCED} = 0 and ${EVENTS_COLUMNS.ATTEMPT_COUNT} < ${MAX_RETRY_COUNT} and total <= ${BULK_DATA_LIMIT} \
676
675
  ORDER BY ${EVENTS_COLUMNS.ID};`;
677
676
 
678
677
  const sqlResult = await Database.executeQuery(query, []);
@@ -289,6 +289,7 @@ export default class EventsSyncManager {
289
289
  if (!this.eventsManager)
290
290
  this.eventsManager = await ETEventsManager.getInstance();
291
291
  this._retries = 0;
292
+ this.inProgress = false;
292
293
  await this.startSync();
293
294
  }
294
295
 
@@ -59,7 +59,7 @@ const DropCashScreen = ({
59
59
  useEffect(() => {
60
60
  (async () => {
61
61
  //fire sentry event
62
- fireEventWithScreenName({severityLevel:SeverityLevelValue.LOG, eventName:SentryEventNameSdkConstants.RETURN_CASH_ET_OPENED, screenName:ScreenNameSdkConstants.RETURN_CASH_ET_SCREEN});
62
+ fireEventWithScreenName({ severityLevel: SeverityLevelValue.LOG, eventName: SentryEventNameSdkConstants.RETURN_CASH_ET_OPENED, screenName: ScreenNameSdkConstants.RETURN_CASH_ET_SCREEN });
63
63
  //
64
64
  onTaskStart(
65
65
  nextState,
@@ -72,8 +72,8 @@ const DropCashScreen = ({
72
72
 
73
73
  useEffect(() => {
74
74
  (async () => {
75
- console.log("expectedAmount:",expectedAmount);
76
- if(expectedAmount.value === 0){
75
+ console.log("expectedAmount:", expectedAmount);
76
+ if (expectedAmount.value === 0) {
77
77
  // setLoading(true);
78
78
  let dropCashETOutput = {
79
79
  amount: {
@@ -103,17 +103,16 @@ const DropCashScreen = ({
103
103
  });
104
104
  }
105
105
  // setLoading(false);
106
- }
106
+ }
107
107
  })();
108
108
  }, [expectedAmount.value])
109
109
 
110
110
 
111
111
 
112
112
  const getTotalExpected = async () => {
113
- const totalAmount: number = await DispatchExecutor.getTotalAmountMWI(
114
- mergedObjectiveId
115
- );
116
- setExpectedAmount({ ...expectedAmount, value: totalAmount });
113
+ const totalAmountArr: any[] = await DispatchExecutor.getTotalAmountMWI(mergedObjectiveId);
114
+ let finalValue = totalAmountArr.map(Number).reduce((sum, num) => sum + num, 0).toFixed(2);
115
+ setExpectedAmount({ ...expectedAmount, value: Number(finalValue) });
117
116
  };
118
117
 
119
118
  const getSelfLoopBool = async () => {
@@ -144,30 +143,30 @@ const DropCashScreen = ({
144
143
  },
145
144
  [baseETProps, navigation, route]
146
145
  );
147
-
146
+
148
147
  return (
149
148
  <View style={{ flex: 1 }}>
150
- { expectedAmount.value === 0 ? <View><ProgressDialog visible={loading} label={'Please wait...'} /></View> :
151
- <SLDropCash
152
- {...input}
153
- expectedAmount={expectedAmount}
154
- isSelfLoop={isSelfLoopTrue}
155
- navigation={navigation}
156
- mergedObjectiveId={mergedObjectiveId}
157
- taskMeta={taskMeta}
158
- onSubmitET={async (etOutput) => {
159
- if (etOutput.success || etOutput.eventCode == GO_BACK_EVENT_CODE) {
160
- await submitOutput(etOutput);
161
- } else {
162
- setResponse((_prevState: any) => {
163
- setShowAlert(true);
164
- return etOutput;
165
- });
166
- }
167
- }}
168
- />
149
+ {expectedAmount.value === 0 ? <View><ProgressDialog visible={loading} label={'Please wait...'} /></View> :
150
+ <SLDropCash
151
+ {...input}
152
+ expectedAmount={expectedAmount}
153
+ isSelfLoop={isSelfLoopTrue}
154
+ navigation={navigation}
155
+ mergedObjectiveId={mergedObjectiveId}
156
+ taskMeta={taskMeta}
157
+ onSubmitET={async (etOutput) => {
158
+ if (etOutput.success || etOutput.eventCode == GO_BACK_EVENT_CODE) {
159
+ await submitOutput(etOutput);
160
+ } else {
161
+ setResponse((_prevState: any) => {
162
+ setShowAlert(true);
163
+ return etOutput;
164
+ });
165
+ }
166
+ }}
167
+ />
169
168
  }
170
-
169
+
171
170
  <CancelOrderDialog
172
171
  visible={showAlert}
173
172
  onSubmit={async (value) => {
@@ -118,6 +118,8 @@ export function getEntityCodeByET(etId: string): string {
118
118
  return EntityCode.PROCESS_PAYMENT;
119
119
  case ExecutionTaskID.COMPLETE_PAYMENT:
120
120
  return EntityCode.COMPLETE_PAYMENT;
121
+ case ExecutionTaskID.COLLECT_PAYMENT_ET:
122
+ return EntityCode.COLLECT_PAYMENT_ET;
121
123
  case ExecutionTaskID.DELIVER_CASH:
122
124
  return EntityCode.DELIVER_CASH;
123
125
  case ExecutionTaskID.VERIFY_INPUT: