@axelor/aos-mobile-core 8.1.2 → 8.1.4

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 (91) hide show
  1. package/lib/apiProviders/Action/ActionApiProvider.d.ts +1 -1
  2. package/lib/apiProviders/Action/GatewayActionApi.d.ts +1 -1
  3. package/lib/apiProviders/Action/GatewayActionApi.js +2 -2
  4. package/lib/apiProviders/Action/GatewayActionApi.js.map +1 -1
  5. package/lib/apiProviders/utils.js +5 -2
  6. package/lib/apiProviders/utils.js.map +1 -1
  7. package/lib/app/ContextsProvider.js +4 -1
  8. package/lib/app/ContextsProvider.js.map +1 -1
  9. package/lib/auth/hooks/use-auth-headers.js +40 -2
  10. package/lib/auth/hooks/use-auth-headers.js.map +1 -1
  11. package/lib/auth/screens/SettingsScreen.js +4 -1
  12. package/lib/auth/screens/SettingsScreen.js.map +1 -1
  13. package/lib/components/external/PlanningView/AgendaItemDisplay.d.ts +8 -0
  14. package/lib/components/external/PlanningView/AgendaItemDisplay.js +77 -0
  15. package/lib/components/external/PlanningView/AgendaItemDisplay.js.map +1 -0
  16. package/lib/components/external/PlanningView/DayDisplay.d.ts +5 -0
  17. package/lib/components/external/PlanningView/DayDisplay.js +59 -0
  18. package/lib/components/external/PlanningView/DayDisplay.js.map +1 -0
  19. package/lib/components/external/PlanningView/MonthDisplay.d.ts +6 -0
  20. package/lib/components/external/PlanningView/MonthDisplay.js +46 -0
  21. package/lib/components/external/PlanningView/MonthDisplay.js.map +1 -0
  22. package/lib/components/external/PlanningView/NavigationButton.d.ts +7 -0
  23. package/lib/components/external/PlanningView/NavigationButton.js +35 -0
  24. package/lib/components/external/PlanningView/NavigationButton.js.map +1 -0
  25. package/lib/components/external/PlanningView/PlanningView.js +39 -106
  26. package/lib/components/external/PlanningView/PlanningView.js.map +1 -1
  27. package/lib/components/external/PlanningView/agenda.helpers.d.ts +7 -2
  28. package/lib/components/external/PlanningView/agenda.helpers.js +60 -8
  29. package/lib/components/external/PlanningView/agenda.helpers.js.map +1 -1
  30. package/lib/components/organisms/SignatureInput/SignatureInput.d.ts +8 -2
  31. package/lib/components/organisms/SignatureInput/SignatureInput.js +49 -23
  32. package/lib/components/organisms/SignatureInput/SignatureInput.js.map +1 -1
  33. package/lib/features/mailMessageSlice.d.ts +1 -1
  34. package/lib/features/mailMessageSlice.js +7 -30
  35. package/lib/features/mailMessageSlice.js.map +1 -1
  36. package/lib/forms/studio/display.helpers.js +3 -0
  37. package/lib/forms/studio/display.helpers.js.map +1 -1
  38. package/lib/i18n/translations/en.json +26 -0
  39. package/lib/i18n/translations/fr.json +26 -0
  40. package/lib/index.d.ts +1 -0
  41. package/lib/index.js +1 -0
  42. package/lib/index.js.map +1 -1
  43. package/lib/loader/ProcessProvider.d.ts +30 -0
  44. package/lib/loader/ProcessProvider.js +211 -0
  45. package/lib/loader/ProcessProvider.js.map +1 -0
  46. package/lib/loader/ProcessStorage.d.ts +18 -0
  47. package/lib/loader/ProcessStorage.js +95 -0
  48. package/lib/loader/ProcessStorage.js.map +1 -0
  49. package/lib/loader/components/atoms/ProcessCard/ProcessCard.d.ts +15 -0
  50. package/lib/loader/components/atoms/ProcessCard/ProcessCard.js +69 -0
  51. package/lib/loader/components/atoms/ProcessCard/ProcessCard.js.map +1 -0
  52. package/lib/loader/components/atoms/index.d.ts +1 -0
  53. package/lib/loader/components/atoms/index.js +19 -0
  54. package/lib/loader/components/atoms/index.js.map +1 -0
  55. package/lib/loader/components/index.d.ts +2 -0
  56. package/lib/loader/components/index.js +20 -0
  57. package/lib/loader/components/index.js.map +1 -0
  58. package/lib/loader/components/organisms/LoaderPopup/LoaderPopup.d.ts +13 -0
  59. package/lib/loader/components/organisms/LoaderPopup/LoaderPopup.js +104 -0
  60. package/lib/loader/components/organisms/LoaderPopup/LoaderPopup.js.map +1 -0
  61. package/lib/loader/components/organisms/index.d.ts +1 -0
  62. package/lib/loader/components/organisms/index.js +19 -0
  63. package/lib/loader/components/organisms/index.js.map +1 -0
  64. package/lib/loader/helpers.d.ts +5 -0
  65. package/lib/loader/helpers.js +59 -0
  66. package/lib/loader/helpers.js.map +1 -0
  67. package/lib/loader/hooks.d.ts +6 -0
  68. package/lib/loader/hooks.js +50 -0
  69. package/lib/loader/hooks.js.map +1 -0
  70. package/lib/loader/index.d.ts +6 -0
  71. package/lib/loader/index.js +24 -0
  72. package/lib/loader/index.js.map +1 -0
  73. package/lib/loader/types.d.ts +26 -0
  74. package/lib/loader/types.js +24 -0
  75. package/lib/loader/types.js.map +1 -0
  76. package/lib/screens/ProcessListScreen.d.ts +3 -0
  77. package/lib/screens/ProcessListScreen.js +75 -0
  78. package/lib/screens/ProcessListScreen.js.map +1 -0
  79. package/lib/screens/index.d.ts +11 -0
  80. package/lib/screens/index.js +8 -0
  81. package/lib/screens/index.js.map +1 -1
  82. package/lib/utils/agenda.d.ts +7 -1
  83. package/lib/utils/agenda.js +12 -7
  84. package/lib/utils/agenda.js.map +1 -1
  85. package/lib/utils/date.d.ts +1 -0
  86. package/lib/utils/date.js +9 -4
  87. package/lib/utils/date.js.map +1 -1
  88. package/lib/utils/index.d.ts +1 -1
  89. package/lib/utils/index.js +1 -1
  90. package/lib/utils/index.js.map +1 -1
  91. package/package.json +3 -3
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { ProcessStatus } from '../../../types';
3
+ interface ProcessCardProps {
4
+ style?: any;
5
+ processKey: string;
6
+ name: string;
7
+ status: ProcessStatus;
8
+ executed: boolean;
9
+ startedDate: string;
10
+ endDate: string;
11
+ onSuccess: () => void;
12
+ onError: () => void;
13
+ }
14
+ declare const ProcessCard: ({ style, processKey, name, status, executed, startedDate, endDate, onSuccess, onError, }: ProcessCardProps) => React.JSX.Element;
15
+ export default ProcessCard;
@@ -0,0 +1,69 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2024 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import React, { useCallback, useMemo } from 'react';
19
+ import { StyleSheet } from 'react-native';
20
+ import { ObjectCard, useThemeColor } from '@axelor/aos-mobile-ui';
21
+ import { formatDateTime } from '../../../../utils';
22
+ import { useTranslator } from '../../../../i18n';
23
+ import { processProvider } from '../../../ProcessProvider';
24
+ import { getProcessStatusColor } from '../../../helpers';
25
+ import { ProcessStatus } from '../../../types';
26
+ const ProcessCard = ({ style, processKey, name, status, executed, startedDate, endDate, onSuccess, onError, }) => {
27
+ const I18n = useTranslator();
28
+ const Colors = useThemeColor();
29
+ const styles = useMemo(() => getStyles(getProcessStatusColor(status, Colors)?.background), [Colors, status]);
30
+ const isSuccess = useMemo(() => status === ProcessStatus.Success, [status]);
31
+ const isTouchable = useMemo(() => {
32
+ const isCompleted = isSuccess || status === ProcessStatus.Failed;
33
+ return (isCompleted &&
34
+ !executed &&
35
+ typeof onSuccess === 'function' &&
36
+ typeof onError === 'function');
37
+ }, [executed, isSuccess, onError, onSuccess, status]);
38
+ const handleOnPress = useCallback(() => {
39
+ status === ProcessStatus.Success ? onSuccess() : onError();
40
+ processProvider.resolveProcess(processKey);
41
+ }, [status, onSuccess, onError, processKey]);
42
+ return (<ObjectCard style={[styles.card, style]} showArrow={isTouchable} touchable={isTouchable} onPress={handleOnPress} upperTexts={{
43
+ items: [
44
+ { isTitle: true, displayText: name },
45
+ {
46
+ iconName: 'calendar-event',
47
+ indicatorText: I18n.t('Base_StartedOn'),
48
+ displayText: formatDateTime(startedDate, I18n.t('Base_DateTimeFormat')),
49
+ hideIf: startedDate == null,
50
+ },
51
+ {
52
+ iconName: isSuccess ? 'calendar-check' : 'calendar-x',
53
+ indicatorText: I18n.t(isSuccess ? 'Base_CompletedOn' : 'Base_FaildedOn'),
54
+ displayText: formatDateTime(endDate, I18n.t('Base_DateTimeFormat')),
55
+ hideIf: endDate == null,
56
+ },
57
+ ],
58
+ }}/>);
59
+ };
60
+ const getStyles = (color) => StyleSheet.create({
61
+ card: {
62
+ marginHorizontal: 12,
63
+ marginVertical: 4,
64
+ borderLeftWidth: 7,
65
+ borderLeftColor: color,
66
+ },
67
+ });
68
+ export default ProcessCard;
69
+ //# sourceMappingURL=ProcessCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProcessCard.js","sourceRoot":"","sources":["../../../../../src/loader/components/atoms/ProcessCard/ProcessCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AAClD,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,eAAe,EAAC,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAC,qBAAqB,EAAC,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAc7C,MAAM,WAAW,GAAG,CAAC,EACnB,KAAK,EACL,UAAU,EACV,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,WAAW,EACX,OAAO,EACP,SAAS,EACT,OAAO,GACU,EAAE,EAAE;IACrB,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IA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BACE,QAAQ,EAAE,gBAAgB;oBAC1B,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC;oBACvC,WAAW,EAAE,cAAc,CACzB,WAAW,EACX,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAC9B;oBACD,MAAM,EAAE,WAAW,IAAI,IAAI;iBAC5B;gBACD;oBACE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,YAAY;oBACrD,aAAa,EAAE,IAAI,CAAC,CAAC,CACnB,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,gBAAgB,CAClD;oBACD,WAAW,EAAE,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC;oBACnE,MAAM,EAAE,OAAO,IAAI,IAAI;iBACxB;aACF;SACF,CAAC,EACF,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,EAAE,CAClC,UAAU,CAAC,MAAM,CAAC;IAChB,IAAI,EAAE;QACJ,gBAAgB,EAAE,EAAE;QACpB,cAAc,EAAE,CAAC;QACjB,eAAe,EAAE,CAAC;QAClB,eAAe,EAAE,KAAK;KACvB;CACF,CAAC,CAAC;AAEL,eAAe,WAAW,CAAC"}
@@ -0,0 +1 @@
1
+ export { default as ProcessCard } from './ProcessCard/ProcessCard';
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2024 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ export { default as ProcessCard } from './ProcessCard/ProcessCard';
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/loader/components/atoms/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './atoms';
2
+ export * from './organisms';
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2024 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ export * from './atoms';
19
+ export * from './organisms';
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/loader/components/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ interface LoaderPopupProps {
3
+ start?: boolean;
4
+ autoLeave?: boolean;
5
+ timeout?: number;
6
+ name: string;
7
+ disabled?: boolean;
8
+ process: () => Promise<any>;
9
+ onSuccess: () => void;
10
+ onError: () => void;
11
+ }
12
+ declare const LoaderPopup: ({ start, autoLeave, timeout, name, disabled, process, onSuccess, onError, }: LoaderPopupProps) => React.JSX.Element;
13
+ export default LoaderPopup;
@@ -0,0 +1,104 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2024 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
19
+ import { ActivityIndicator, StyleSheet, View } from 'react-native';
20
+ import { Alert, Button, Label, Text, useConfig, useThemeColor, } from '@axelor/aos-mobile-ui';
21
+ import { useNavigation } from '../../../../hooks/use-navigation';
22
+ import { useTranslator } from '../../../../i18n';
23
+ import { processProvider } from '../../../ProcessProvider';
24
+ import { ProcessStatus } from '../../../types';
25
+ const LoaderPopup = ({ start = false, autoLeave = false, timeout = 1000, name, disabled = false, process, onSuccess, onError, }) => {
26
+ const I18n = useTranslator();
27
+ const Colors = useThemeColor();
28
+ const navigation = useNavigation();
29
+ const { setActivityIndicator } = useConfig();
30
+ const [loading, setLoading] = useState(false);
31
+ const [showPopup, setShowPopup] = useState(false);
32
+ const [processItem, setProcessItem] = useState();
33
+ const timeoutRef = useRef(null);
34
+ const processOptions = useMemo(() => ({
35
+ name,
36
+ disabled,
37
+ process,
38
+ onSuccess,
39
+ onError,
40
+ }), [name, disabled, process, onSuccess, onError]);
41
+ const onEndProcess = useCallback(() => {
42
+ setLoading(false);
43
+ setShowPopup(false);
44
+ }, []);
45
+ const handleNotifyMe = useCallback(() => {
46
+ setShowPopup(false);
47
+ setActivityIndicator(false);
48
+ processProvider.notifyMe(processItem.key);
49
+ navigation.goBack();
50
+ }, [navigation, processItem, setActivityIndicator]);
51
+ useEffect(() => {
52
+ if (start) {
53
+ const processKey = new Date().getTime().toString();
54
+ const _process = processProvider.registerProcess(processKey, processOptions);
55
+ setProcessItem(_process);
56
+ processProvider.on(processKey, ProcessStatus.InProgress, () => setLoading(true));
57
+ processProvider.on(processKey, ProcessStatus.Success, () => onEndProcess());
58
+ processProvider.on(processKey, ProcessStatus.Failed, () => onEndProcess());
59
+ processProvider.runProcess(processKey, I18n);
60
+ }
61
+ }, [I18n, onEndProcess, processOptions, start]);
62
+ useEffect(() => {
63
+ if (loading) {
64
+ setActivityIndicator(true);
65
+ timeoutRef.current = setTimeout(() => {
66
+ setActivityIndicator(false);
67
+ autoLeave ? handleNotifyMe() : setShowPopup(true);
68
+ }, timeout);
69
+ }
70
+ return () => {
71
+ setActivityIndicator(false);
72
+ clearTimeout(timeoutRef.current);
73
+ };
74
+ }, [
75
+ autoLeave,
76
+ handleNotifyMe,
77
+ loading,
78
+ setActivityIndicator,
79
+ setShowPopup,
80
+ timeout,
81
+ ]);
82
+ return (<Alert visible={showPopup}>
83
+ <Label type="danger" message={I18n.t('Base_Loader_DoNotCloseTheApp')} iconName="exclamation-triangle-fill"/>
84
+ <View style={styles.loadingContainer}>
85
+ <ActivityIndicator size="large" color={Colors.primaryColor.background}/>
86
+ <Text style={styles.marginLeft} writingType="title">
87
+ {I18n.t('Base_Loader_LoadingInProgress')}
88
+ </Text>
89
+ </View>
90
+ <Button iconName="check-lg" title={I18n.t('Base_Loader_NotifyMe')} onPress={handleNotifyMe}/>
91
+ </Alert>);
92
+ };
93
+ const styles = StyleSheet.create({
94
+ loadingContainer: {
95
+ flexDirection: 'row',
96
+ alignItems: 'center',
97
+ marginVertical: 15,
98
+ },
99
+ marginLeft: {
100
+ marginLeft: 10,
101
+ },
102
+ });
103
+ export default LoaderPopup;
104
+ //# sourceMappingURL=LoaderPopup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoaderPopup.js","sourceRoot":"","sources":["../../../../../src/loader/components/organisms/LoaderPopup/LoaderPopup.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAC,iBAAiB,EAAE,UAAU,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,KAAK,EACL,MAAM,EACN,KAAK,EACL,IAAI,EACJ,SAAS,EACT,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,aAAa,EAAC,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,eAAe,EAAC,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAc,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAa1D,MAAM,WAAW,GAAG,CAAC,EACnB,KAAK,GAAG,KAAK,EACb,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,IAAI,EACd,IAAI,EACJ,QAAQ,GAAG,KAAK,EAChB,OAAO,EACP,SAAS,EACT,OAAO,GACU,EAAE,EAAE;IACrB,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,MAAM,EAAC,oBAAoB,EAAC,GAAG,SAAS,EAAE,CAAC;IAE3C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACvD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAC3D,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,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C,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,OAAO,CACjD;UAAA,CAAC,IAAI,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAC1C;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,IAAI,CACN;MAAA,CAAC,MAAM,CACL,QAAQ,CAAC,UAAU,CACnB,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CACtC,OAAO,CAAC,CAAC,cAAc,CAAC,EAE5B;IAAA,EAAE,KAAK,CAAC,CACT,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,gBAAgB,EAAE;QAChB,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,EAAE;KACnB;IACD,UAAU,EAAE;QACV,UAAU,EAAE,EAAE;KACf;CACF,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC"}
@@ -0,0 +1 @@
1
+ export { default as LoaderPopup } from './LoaderPopup/LoaderPopup';
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2024 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ export { default as LoaderPopup } from './LoaderPopup/LoaderPopup';
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/loader/components/organisms/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Color, ThemeColors } from '@axelor/aos-mobile-ui';
2
+ import { ProcessItem, ProcessStatus } from './types';
3
+ export declare const serialize: (list: ProcessItem[]) => string;
4
+ export declare const deserialize: (data: string) => any[];
5
+ export declare const getProcessStatusColor: (status: ProcessStatus, Colors: ThemeColors) => Color;
@@ -0,0 +1,59 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2024 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import { ProcessStatus } from './types';
19
+ const serializeItem = (p) => {
20
+ return JSON.stringify(p);
21
+ };
22
+ const deserializeItem = (data) => {
23
+ return JSON.parse(data);
24
+ };
25
+ export const serialize = (list) => {
26
+ if (!Array.isArray(list) || list.length === 0) {
27
+ return '[]';
28
+ }
29
+ return JSON.stringify(list.map(p => serializeItem(p)));
30
+ };
31
+ export const deserialize = (data) => {
32
+ if (data == null || data.length === 0) {
33
+ return [];
34
+ }
35
+ try {
36
+ if (!Array.isArray(data)) {
37
+ return [];
38
+ }
39
+ return data.map(i => deserializeItem(i));
40
+ }
41
+ catch (e) {
42
+ console.error('Deserialization error:', e);
43
+ return [];
44
+ }
45
+ };
46
+ export const getProcessStatusColor = (status, Colors) => {
47
+ switch (status) {
48
+ case ProcessStatus.InProgress:
49
+ return Colors.progressColor;
50
+ case ProcessStatus.Success:
51
+ return Colors.successColor;
52
+ case ProcessStatus.Failed:
53
+ return Colors.errorColor;
54
+ default:
55
+ console.warn(`Status provided with value ${status} is not supported by Process.`);
56
+ return null;
57
+ }
58
+ };
59
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/loader/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAc,aAAa,EAAC,MAAM,SAAS,CAAC;AAEnD,MAAM,aAAa,GAAG,CAAC,CAAc,EAAE,EAAE;IACvC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,EAAE;IACvC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAmB,EAAU,EAAE;IACvD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7C,OAAO,IAAI,CAAC;KACb;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE;IAC1C,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrC,OAAO,EAAE,CAAC;KACX;IAED,IAAI;QACF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACxB,OAAO,EAAE,CAAC;SACX;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;KAC1C;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,CAAC,CAAC,CAAC;QAC3C,OAAO,EAAE,CAAC;KACX;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,MAAqB,EACrB,MAAmB,EACZ,EAAE;IACT,QAAQ,MAAM,EAAE;QACd,KAAK,aAAa,CAAC,UAAU;YAC3B,OAAO,MAAM,CAAC,aAAa,CAAC;QAC9B,KAAK,aAAa,CAAC,OAAO;YACxB,OAAO,MAAM,CAAC,YAAY,CAAC;QAC7B,KAAK,aAAa,CAAC,MAAM;YACvB,OAAO,MAAM,CAAC,UAAU,CAAC;QAC3B;YACE,OAAO,CAAC,IAAI,CACV,8BAA8B,MAAM,+BAA+B,CACpE,CAAC;YACF,OAAO,IAAI,CAAC;KACf;AACH,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { ProcessItem } from './types';
2
+ export declare const useLoaderListener: () => {
3
+ numberRunningProcesses: number;
4
+ numberUnreadProcess: number;
5
+ processList: ProcessItem[];
6
+ };
@@ -0,0 +1,50 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2024 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import { useCallback, useEffect, useMemo, useState } from 'react';
19
+ import { processProvider } from './ProcessProvider';
20
+ import { processStorage } from './ProcessStorage';
21
+ export const useLoaderListener = () => {
22
+ const [numberRunningProcesses, setNumberRunningProcesses] = useState(0);
23
+ const [numberUnreadProcess, setNumberUnreadProcess] = useState(0);
24
+ const [processList, setProcessList] = useState([]);
25
+ useEffect(() => {
26
+ setNumberRunningProcesses(processProvider.getNumberRunningProcess());
27
+ const handleProcessChange = newNumber => {
28
+ setNumberRunningProcesses(newNumber);
29
+ };
30
+ processProvider.subscribeNRProcess(handleProcessChange);
31
+ return () => {
32
+ processProvider.unsubscribeNRProcess(handleProcessChange);
33
+ };
34
+ }, []);
35
+ const refreshData = useCallback(({ numberUnreadProcess: _numberUnreadProcess, processList: _processList, }) => {
36
+ setNumberUnreadProcess(_numberUnreadProcess);
37
+ setProcessList(_processList);
38
+ }, []);
39
+ useEffect(() => {
40
+ processStorage.register(refreshData);
41
+ }, [refreshData]);
42
+ return useMemo(() => {
43
+ return {
44
+ numberRunningProcesses,
45
+ numberUnreadProcess,
46
+ processList,
47
+ };
48
+ }, [numberRunningProcesses, numberUnreadProcess, processList]);
49
+ };
50
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/loader/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAChE,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAGhD,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,GACvD,QAAQ,CAAS,CAAC,CAAC,CAAC;IACtB,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GAAG,QAAQ,CAAS,CAAC,CAAC,CAAC;IAC1E,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAgB,EAAE,CAAC,CAAC;IAElE,SAAS,CAAC,GAAG,EAAE;QACb,yBAAyB,CAAC,eAAe,CAAC,uBAAuB,EAAE,CAAC,CAAC;QAErE,MAAM,mBAAmB,GAAG,SAAS,CAAC,EAAE;YACtC,yBAAyB,CAAC,SAAS,CAAC,CAAC;QACvC,CAAC,CAAC;QAEF,eAAe,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;QAExD,OAAO,GAAG,EAAE;YACV,eAAe,CAAC,oBAAoB,CAAC,mBAAmB,CAAC,CAAC;QAC5D,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,EACC,mBAAmB,EAAE,oBAAoB,EACzC,WAAW,EAAE,YAAY,GAC1B,EAAE,EAAE;QACH,sBAAsB,CAAC,oBAAoB,CAAC,CAAC;QAC7C,cAAc,CAAC,YAAY,CAAC,CAAC;IAC/B,CAAC,EACD,EAAE,CACH,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,OAAO;YACL,sBAAsB;YACtB,mBAAmB;YACnB,WAAW;SACZ,CAAC;IACJ,CAAC,EAAE,CAAC,sBAAsB,EAAE,mBAAmB,EAAE,WAAW,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './components';
2
+ export { processProvider } from './ProcessProvider';
3
+ export { processStorage } from './ProcessStorage';
4
+ export { ProcessStatus } from './types';
5
+ export { getProcessStatusColor } from './helpers';
6
+ export { useLoaderListener } from './hooks';
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2024 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ export * from './components';
19
+ export { processProvider } from './ProcessProvider';
20
+ export { processStorage } from './ProcessStorage';
21
+ export { ProcessStatus } from './types';
22
+ export { getProcessStatusColor } from './helpers';
23
+ export { useLoaderListener } from './hooks';
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/loader/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,EAAC,qBAAqB,EAAC,MAAM,WAAW,CAAC;AAChD,OAAO,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAC"}
@@ -0,0 +1,26 @@
1
+ export type ProcessOption = {
2
+ name: string;
3
+ disabled: boolean;
4
+ process: () => Promise<any>;
5
+ onSuccess: (response?: any) => void;
6
+ onError: (error?: any) => void;
7
+ };
8
+ export declare enum ProcessStatus {
9
+ InProgress = 0,
10
+ Success = 1,
11
+ Failed = 2
12
+ }
13
+ export type CallBack = (...args: any[]) => void;
14
+ export type Event = {
15
+ [e in ProcessStatus]: CallBack[];
16
+ };
17
+ export type ProcessItem = ProcessOption & {
18
+ key: string;
19
+ loading: boolean;
20
+ notifyMe: boolean;
21
+ response: string;
22
+ status: number;
23
+ executed: boolean;
24
+ startedDate: string;
25
+ endDate: string;
26
+ };
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2024 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ export var ProcessStatus;
19
+ (function (ProcessStatus) {
20
+ ProcessStatus[ProcessStatus["InProgress"] = 0] = "InProgress";
21
+ ProcessStatus[ProcessStatus["Success"] = 1] = "Success";
22
+ ProcessStatus[ProcessStatus["Failed"] = 2] = "Failed";
23
+ })(ProcessStatus || (ProcessStatus = {}));
24
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/loader/types.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAUH,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,6DAAc,CAAA;IACd,uDAAW,CAAA;IACX,qDAAU,CAAA;AACZ,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const ProcessListScreen: () => React.JSX.Element;
3
+ export default ProcessListScreen;
@@ -0,0 +1,75 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2024 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import React, { useCallback, useEffect, useState } from 'react';
19
+ import { ChipSelect, HeaderContainer, Screen, ScrollList, ToggleSwitch, useThemeColor, } from '@axelor/aos-mobile-ui';
20
+ import { filterChip, isToday } from '../utils';
21
+ import { useTranslator } from '../i18n';
22
+ import { getProcessStatusColor, ProcessCard, processProvider, ProcessStatus, useLoaderListener, } from '../loader';
23
+ const ProcessListScreen = () => {
24
+ const I18n = useTranslator();
25
+ const Colors = useThemeColor();
26
+ const { processList } = useLoaderListener();
27
+ const [filteredList, setFilteredList] = useState(processList);
28
+ const [isTodayProcess, setIsTodayProcess] = useState(true);
29
+ const [selectedStatus, setSelectedStatus] = useState([]);
30
+ const filterOnDate = useCallback(list => {
31
+ if (!Array.isArray(list) || list.length === 0) {
32
+ return [];
33
+ }
34
+ else {
35
+ let _list = list;
36
+ if (isTodayProcess) {
37
+ _list = list?.filter(item => isToday(item.startedDate) ||
38
+ item.status === ProcessStatus.InProgress);
39
+ }
40
+ return _list.sort((a, b) => new Date(b.startedDate).getTime() -
41
+ new Date(a.startedDate).getTime());
42
+ }
43
+ }, [isTodayProcess]);
44
+ const filterOnStatus = useCallback(list => {
45
+ return filterChip(list, selectedStatus, 'status');
46
+ }, [selectedStatus]);
47
+ useEffect(() => {
48
+ setFilteredList(filterOnStatus(filterOnDate(processList)));
49
+ }, [filterOnDate, filterOnStatus, processList]);
50
+ useEffect(() => {
51
+ processProvider.setNumberUnreadProcess(0);
52
+ }, []);
53
+ return (<Screen removeSpaceOnTop={true}>
54
+ <HeaderContainer fixedItems={<ToggleSwitch leftTitle={I18n.t('Base_Loader_Today')} rightTitle={I18n.t('Base_All')} onSwitch={() => setIsTodayProcess(!isTodayProcess)}/>} chipComponent={<ChipSelect mode="multi" onChangeValue={setSelectedStatus} selectionItems={[
55
+ {
56
+ title: I18n.t('Base_Loader_Status_InProgress'),
57
+ color: getProcessStatusColor(ProcessStatus.InProgress, Colors),
58
+ key: ProcessStatus.InProgress,
59
+ },
60
+ {
61
+ title: I18n.t('Base_Loader_Status_Success'),
62
+ color: getProcessStatusColor(ProcessStatus.Success, Colors),
63
+ key: ProcessStatus.Success,
64
+ },
65
+ {
66
+ title: I18n.t('Base_Loader_Status_Failed'),
67
+ color: getProcessStatusColor(ProcessStatus.Failed, Colors),
68
+ key: ProcessStatus.Failed,
69
+ },
70
+ ]}/>} expandableFilter={false}/>
71
+ <ScrollList loadingList={false} data={filteredList} renderItem={({ item }) => (<ProcessCard processKey={item.key} name={item.name} status={item.status} executed={item.executed} startedDate={item.startedDate} endDate={item.endDate} onSuccess={item.onSuccess} onError={item.onError}/>)} fetchData={() => { }} moreLoading={false} isListEnd={true} translator={I18n.t}/>
72
+ </Screen>);
73
+ };
74
+ export default ProcessListScreen;
75
+ //# sourceMappingURL=ProcessListScreen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProcessListScreen.js","sourceRoot":"","sources":["../../src/screens/ProcessListScreen.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC9D,OAAO,EACL,UAAU,EACV,eAAe,EACf,MAAM,EACN,UAAU,EACV,YAAY,EACZ,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,UAAU,EAAE,OAAO,EAAC,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,EACL,qBAAqB,EACrB,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