@legalplace/wizardx-core 2.1.0-alpha.9 → 2.2.0

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 (55) hide show
  1. package/CHANGELOG.md +7 -93
  2. package/dist/App.d.ts +2 -2
  3. package/dist/PluginLoader.js +6 -3
  4. package/dist/Shimmer.js +1 -1
  5. package/dist/ThemeLoader.d.ts +1 -1
  6. package/dist/components/SmartScript.d.ts +2 -2
  7. package/dist/components/SmartScript.js +9 -9
  8. package/dist/components/View.d.ts +1 -0
  9. package/dist/components/View.js +16 -1
  10. package/dist/componentsConnectors/connector/connectorSelectors.d.ts +0 -2
  11. package/dist/helpers/sendinblueHelper.d.ts +3 -3
  12. package/dist/helpers/sendinblueHelper.js +10 -18
  13. package/dist/libs/Eval/EvalFunctions.d.ts +21 -21
  14. package/dist/libs/Eval/EvalFunctions.js +99 -141
  15. package/dist/libs/EvalVariable.d.ts +1 -1
  16. package/dist/libs/EvalVariable.js +49 -61
  17. package/dist/libs/EventsTracking.d.ts +0 -1
  18. package/dist/libs/EventsTracking.js +5 -11
  19. package/dist/redux/actions/inputs.d.ts +0 -2
  20. package/dist/redux/actions/inputs.js +1 -6
  21. package/dist/redux/constants/inputs.d.ts +0 -1
  22. package/dist/redux/constants/inputs.js +0 -1
  23. package/dist/redux/middlewares/smartscriptMiddleware.js +1 -19
  24. package/dist/redux/sagas/fetchModel.js +52 -4
  25. package/dist/redux/sagas/runner.js +0 -2
  26. package/dist/redux/selectors/app.d.ts +0 -1
  27. package/dist/redux/selectors/app.js +0 -1
  28. package/dist/redux/selectors/references.d.ts +0 -1
  29. package/dist/redux/selectors/references.js +0 -1
  30. package/dist/service/api.manager.js +0 -8
  31. package/dist/types/Actions.type.d.ts +1 -6
  32. package/dist/types/config.type.d.ts +2 -1
  33. package/package.json +6 -4
  34. package/src/App.tsx +2 -2
  35. package/src/PluginLoader.tsx +20 -3
  36. package/src/Shimmer.tsx +1 -1
  37. package/src/components/SmartScript.tsx +12 -13
  38. package/src/components/View.tsx +23 -21
  39. package/src/helpers/sendinblueHelper.ts +8 -10
  40. package/src/libs/Eval/EvalFunctions.ts +72 -125
  41. package/src/libs/EvalVariable.ts +5 -13
  42. package/src/libs/EventsTracking.ts +0 -14
  43. package/src/redux/actions/inputs.ts +0 -16
  44. package/src/redux/constants/inputs.ts +0 -2
  45. package/src/redux/middlewares/smartscriptMiddleware.ts +0 -41
  46. package/src/redux/sagas/fetchModel.ts +96 -4
  47. package/src/redux/sagas/runner.ts +0 -2
  48. package/src/redux/selectors/app.ts +0 -6
  49. package/src/redux/selectors/references.ts +0 -4
  50. package/src/service/api.manager.ts +0 -13
  51. package/src/types/Actions.type.ts +0 -8
  52. package/src/types/config.type.ts +2 -2
  53. package/dist/redux/sagas/initInputs.d.ts +0 -5
  54. package/dist/redux/sagas/initInputs.js +0 -63
  55. package/src/redux/sagas/initInputs.ts +0 -110
package/CHANGELOG.md CHANGED
@@ -3,77 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- # [2.1.0-alpha.9](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.1.0-alpha.8...@legalplace/wizardx-core@2.1.0-alpha.9) (2021-11-28)
7
-
8
-
9
- ### Bug Fixes
10
-
11
- * fix linting api[#4480](https://git.legalplace.eu/legalplace/monorepo/issues/4480) ([e8d76f5](https://git.legalplace.eu/legalplace/monorepo/commits/e8d76f5333b2940dbb170099a77d19a37c503cba))
12
-
13
-
14
- ### Features
15
-
16
- * load speed optimizations api[#4480](https://git.legalplace.eu/legalplace/monorepo/issues/4480) ([5227752](https://git.legalplace.eu/legalplace/monorepo/commits/522775255c71f98d4a4052fbcd05c5ae956925a2))
17
-
18
-
19
-
20
-
21
-
22
- # [2.1.0-alpha.8](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.1.0-alpha.7...@legalplace/wizardx-core@2.1.0-alpha.8) (2021-11-24)
23
-
24
-
25
- ### Bug Fixes
26
-
27
- * fixing issue with smartscript not getting executed after init_inputs api[#3338](https://git.legalplace.eu/legalplace/monorepo/issues/3338) ([2c96fd6](https://git.legalplace.eu/legalplace/monorepo/commits/2c96fd63a6d2e7685e75ee9125a4759831548139))
28
-
29
-
30
-
31
-
32
-
33
- # [2.1.0-alpha.7](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.1.0-alpha.6...@legalplace/wizardx-core@2.1.0-alpha.7) (2021-11-24)
34
-
35
- **Note:** Version bump only for package @legalplace/wizardx-core
36
-
37
-
38
-
39
-
40
-
41
- # [2.1.0-alpha.6](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.1.0-alpha.5...@legalplace/wizardx-core@2.1.0-alpha.6) (2021-11-23)
42
-
43
-
44
- ### Bug Fixes
45
-
46
- * fix push api[#3338](https://git.legalplace.eu/legalplace/monorepo/issues/3338) ([1c961d5](https://git.legalplace.eu/legalplace/monorepo/commits/1c961d5a459513f791c2afb363881aa3d9214add))
47
-
48
-
49
- ### Features
50
-
51
- * Adding possibility to clone instance and improving UX on kanoon softSocial modal api[#3338](https://git.legalplace.eu/legalplace/monorepo/issues/3338) ([cec91b7](https://git.legalplace.eu/legalplace/monorepo/commits/cec91b79a512de1699e75fbb0e1bf95359f43376))
52
-
53
-
54
-
55
-
56
-
57
- # [2.1.0-alpha.5](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.1.0-alpha.4...@legalplace/wizardx-core@2.1.0-alpha.5) (2021-11-15)
58
-
59
-
60
- ### Features
61
-
62
- * tracking X-Source cookie api[#4377](https://git.legalplace.eu/legalplace/monorepo/issues/4377) ([0b52550](https://git.legalplace.eu/legalplace/monorepo/commits/0b52550632daa141ab241183a9cf2169e8d5fb08))
63
-
64
-
65
-
66
-
67
-
68
- # [2.1.0-alpha.4](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.1.0-alpha.3...@legalplace/wizardx-core@2.1.0-alpha.4) (2021-11-08)
69
-
70
- **Note:** Version bump only for package @legalplace/wizardx-core
71
-
72
-
73
-
74
-
75
-
76
- # [2.1.0-alpha.3](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.1.0-alpha.2...@legalplace/wizardx-core@2.1.0-alpha.3) (2021-11-04)
6
+ # [2.2.0](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.1.0...@legalplace/wizardx-core@2.2.0) (2021-11-10)
77
7
 
78
8
 
79
9
  ### Bug Fixes
@@ -83,12 +13,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
83
13
  * fix type errors api[#4377](https://git.legalplace.eu/legalplace/monorepo/issues/4377) ([c14a871](https://git.legalplace.eu/legalplace/monorepo/commits/c14a8717b53d023f89d09b329d2dff062b4890f0))
84
14
 
85
15
 
86
-
87
-
88
-
89
- # [2.1.0-alpha.2](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.1.0...@legalplace/wizardx-core@2.1.0-alpha.2) (2021-11-04)
90
-
91
-
92
16
  ### Features
93
17
 
94
18
  * upgrading wizardx-app to support wizard-params throught props and fixing notFoundUrl api[#4377](https://git.legalplace.eu/legalplace/monorepo/issues/4377) ([72709a3](https://git.legalplace.eu/legalplace/monorepo/commits/72709a374e5037ed5eb743679159459e3b7d5483))
@@ -97,18 +21,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
97
21
 
98
22
 
99
23
 
100
- # [2.1.0-alpha.1](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.1.0-alpha.0...@legalplace/wizardx-core@2.1.0-alpha.1) (2021-11-03)
101
-
102
-
103
- ### Features
104
-
105
- * supporting theme preloading for wizardx-core & preloading theme on kanoon-app api[#4363](https://git.legalplace.eu/legalplace/monorepo/issues/4363) ([01f258e](https://git.legalplace.eu/legalplace/monorepo/commits/01f258e4e2266ae6a8978fa4035289b50e0366bc))
106
-
107
-
108
-
109
-
110
-
111
- # [2.1.0-alpha.0](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.0.0...@legalplace/wizardx-core@2.1.0-alpha.0) (2021-11-03)
24
+ # [2.1.0](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.0.0...@legalplace/wizardx-core@2.1.0) (2021-11-04)
112
25
 
113
26
 
114
27
  ### Bug Fixes
@@ -121,13 +34,14 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
121
34
  ### Features
122
35
 
123
36
  * poc intégration wizardx kanoon-app api[#4363](https://git.legalplace.eu/legalplace/monorepo/issues/4363) ([13f5637](https://git.legalplace.eu/legalplace/monorepo/commits/13f563752d48a94575a77fcf9924cb6569547bd6))
37
+ * supporting theme preloading for wizardx-core & preloading theme on kanoon-app api[#4363](https://git.legalplace.eu/legalplace/monorepo/issues/4363) ([01f258e](https://git.legalplace.eu/legalplace/monorepo/commits/01f258e4e2266ae6a8978fa4035289b50e0366bc))
124
38
  * testing merge prepare script api[#4375](https://git.legalplace.eu/legalplace/monorepo/issues/4375) ([936f4e9](https://git.legalplace.eu/legalplace/monorepo/commits/936f4e9cfaaa6c346c87f4f4de5f5b651f02cd41))
125
39
 
126
40
 
127
41
 
128
42
 
129
43
 
130
- # [1.1.0-alpha.2](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@1.1.0-alpha.1...@legalplace/wizardx-core@1.1.0-alpha.2) (2021-10-29)
44
+ ## [1.1.2](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@1.1.1...@legalplace/wizardx-core@1.1.2) (2021-10-29)
131
45
 
132
46
 
133
47
  ### Bug Fixes
@@ -138,7 +52,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
138
52
 
139
53
 
140
54
 
141
- # [1.1.0-alpha.1](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@1.1.0...@legalplace/wizardx-core@1.1.0-alpha.1) (2021-10-29)
55
+ ## [1.1.1](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@1.1.0...@legalplace/wizardx-core@1.1.1) (2021-10-29)
142
56
 
143
57
 
144
58
  ### Bug Fixes
@@ -149,7 +63,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
149
63
 
150
64
 
151
65
 
152
- # [1.1.0-alpha.0](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@1.0.1-alpha.0...@legalplace/wizardx-core@1.1.0-alpha.0) (2021-10-27)
66
+ # [1.1.0](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@1.0.1...@legalplace/wizardx-core@1.1.0) (2021-10-28)
153
67
 
154
68
 
155
69
  ### Bug Fixes
@@ -166,7 +80,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
166
80
 
167
81
 
168
82
 
169
- ## [1.0.1-alpha.0](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@0.0.1...@legalplace/wizardx-core@1.0.1-alpha.0) (2021-10-27)
83
+ ## [1.0.1](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@0.0.1...@legalplace/wizardx-core@1.0.1) (2021-10-27)
170
84
 
171
85
 
172
86
  ### Bug Fixes
package/dist/App.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { ModelV3 } from '@legalplace/models-v3-types';
3
- import type { StateType } from './types/State.type';
4
- import type { IWizardParams } from './types/config.type';
3
+ import { StateType } from './types/State.type';
4
+ import { IWizardParams } from './types/config.type';
5
5
  export interface AppProps {
6
6
  historyType: 'browser' | 'memory';
7
7
  model?: ModelV3;
@@ -10,10 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import React from 'react';
11
11
  import PropTypes from 'prop-types';
12
12
  import { getConfig } from './config';
13
+ import * as connectorActions from './redux/actions';
13
14
  import { getStore } from './redux/store';
14
15
  import { getHistory } from './redux/routerHistory';
15
16
  import { EventsTracking } from './libs/EventsTracking';
16
17
  import Globals from './Globals';
18
+ import * as selectorsList from './redux/selectors';
19
+ import * as connectorsList from './componentsConnectors';
17
20
  let globalAnchors = {};
18
21
  let reduxAnchors = {};
19
22
  let actionOverrideAnchor = {};
@@ -66,7 +69,7 @@ export const pluginPageAppState = (page) => {
66
69
  return false;
67
70
  };
68
71
  export const getPluginsPageAppStates = () => PluginsPageAppStates;
69
- const loadPluginFiles = (pluginsList) => __awaiter(void 0, void 0, void 0, function* () {
72
+ const loadPluginFiles = (pluginsList, connectorSelectors, connectors) => __awaiter(void 0, void 0, void 0, function* () {
70
73
  const plugins = Object.keys(pluginsList);
71
74
  const pluginModules = yield Promise.all(plugins.map((plugin) => Globals.loadPlugin(plugin)));
72
75
  plugins.forEach((plugin, index) => {
@@ -74,7 +77,7 @@ const loadPluginFiles = (pluginsList) => __awaiter(void 0, void 0, void 0, funct
74
77
  const anchors = pluginModule.default;
75
78
  const { loader } = pluginModule;
76
79
  if (loader !== undefined) {
77
- loader(getStore().dispatch, getHistory(), getConfig(), EventsTracking);
80
+ loader(connectorSelectors, connectors, getStore().dispatch, connectorActions, getHistory(), getConfig(), EventsTracking);
78
81
  }
79
82
  Object.keys(anchors).forEach((anchor) => {
80
83
  if (anchor === 'replace') {
@@ -125,7 +128,7 @@ export const loadPlugins = (plugins) => __awaiter(void 0, void 0, void 0, functi
125
128
  if (pluginsList === undefined) {
126
129
  pluginsList = getConfig().plugins;
127
130
  }
128
- yield loadPluginFiles(pluginsList);
131
+ yield loadPluginFiles(pluginsList, selectorsList, connectorsList);
129
132
  pluginsLoadingDone = true;
130
133
  });
131
134
  export const pluginsLoaded = () => pluginsLoadingDone;
package/dist/Shimmer.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { connect } from 'react-redux';
3
- import { Loader } from '@legalplace/storybook/dist/components/UI/Loader';
3
+ import { Loader } from '@legalplace/storybook';
4
4
  import { getThemeShimmer } from './ThemeLoader';
5
5
  import { PluginLoader } from './PluginLoader';
6
6
  import UserLockedComponent from './components/UserLocked/UserLockedComponent';
@@ -21,7 +21,7 @@ export declare const getThemeParams: () => {
21
21
  email?: import("./types/config.type").SideBarType;
22
22
  };
23
23
  };
24
- fonts?: any;
24
+ fonts?: import("@legalplace/storybook").IFonts | undefined;
25
25
  style?: Record<string, any> | undefined;
26
26
  };
27
27
  export declare const loadThemeComponent: (name: string) => LoadableComponent<any>;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { Action } from 'redux';
3
- import type { Moment } from 'moment-business-days';
3
+ import moment from 'moment-business-days';
4
4
  import { SmartScriptStore } from '../libs/SmartScriptStore';
5
5
  import { StateType } from '../types/State.type';
6
6
  export declare type TInitTriggersCallback = (triggers: StateType.SmartScript['triggers'], actions: Action[]) => void;
@@ -22,7 +22,7 @@ declare global {
22
22
  displayOption: typeof SmartScriptStore.displayOption;
23
23
  hideVariable: typeof SmartScriptStore.hideVariable;
24
24
  displayVariable: typeof SmartScriptStore.displayVariable;
25
- moment: Moment;
25
+ moment: typeof moment;
26
26
  triggerListeners: (type: 'option' | 'variable', id: number, inputs: StateType.Inputs) => Action[];
27
27
  initTriggers: (callback: TInitTriggersCallback, inputs: StateType.Inputs, newInstance: boolean) => void;
28
28
  }
@@ -1,6 +1,7 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { useParams } from 'react-router-dom';
3
3
  import queryString from 'query-string';
4
+ import moment from 'moment-business-days';
4
5
  import { getConfig } from '../config';
5
6
  import { SmartScriptStore } from '../libs/SmartScriptStore';
6
7
  const SmartScriptComponent = () => {
@@ -23,6 +24,7 @@ const SmartScriptComponent = () => {
23
24
  window.displayVariable = SmartScriptStore.displayVariable;
24
25
  window.hideOption = SmartScriptStore.hideOption;
25
26
  window.displayOption = SmartScriptStore.displayOption;
27
+ window.moment = moment;
26
28
  const apiEndpoint = getConfig().apiEndpoint + (/\/$/.test(getConfig().apiEndpoint) ? '' : '/');
27
29
  const { permalink, uniqid } = useParams();
28
30
  const modelVersion = queryString.parse(window.location.search).version;
@@ -32,15 +34,13 @@ const SmartScriptComponent = () => {
32
34
  const scriptElement = document.createElement('script');
33
35
  scriptElement.setAttribute('src', src);
34
36
  scriptElement.onload = () => {
35
- import('moment-business-days').then(() => {
36
- if (typeof initTriggersCallback === 'function') {
37
- if (isNewInstance)
38
- SmartScriptStore.execOnInit();
39
- SmartScriptStore.execOnLoad();
40
- initTriggersCallback(SmartScriptStore.triggers, SmartScriptStore.grabActions());
41
- }
42
- setSmartScriptLoaded(true);
43
- });
37
+ if (typeof initTriggersCallback === 'function') {
38
+ if (isNewInstance)
39
+ SmartScriptStore.execOnInit();
40
+ SmartScriptStore.execOnLoad();
41
+ initTriggersCallback(SmartScriptStore.triggers, SmartScriptStore.grabActions());
42
+ }
43
+ setSmartScriptLoaded(true);
44
44
  };
45
45
  document.body.append(scriptElement);
46
46
  }
@@ -4,6 +4,7 @@ export declare type OwnProps = {
4
4
  goPage: (p: number) => void;
5
5
  };
6
6
  declare class ViewComponent extends React.Component<OwnProps> {
7
+ componentDidMount(): void;
7
8
  shouldComponentUpdate(newProps: OwnProps): boolean;
8
9
  render(): JSX.Element;
9
10
  }
@@ -1,12 +1,27 @@
1
1
  import React from 'react';
2
2
  import { connect } from 'react-redux';
3
+ import Moustrap from 'mousetrap';
3
4
  import Shimmer from '../Shimmer';
4
5
  import { loadThemeComponent } from '../ThemeLoader';
5
- import { selectCurrentAppState } from '../redux/selectors/app';
6
+ import { selectCurrentAppState, selectAvailableAppStates, selectAvailableSections, } from '../redux/selectors/app';
6
7
  import Globals from '../Globals';
7
8
  import { goPageAction } from '../redux/actions/app';
8
9
  import { loadPluginComponent, pluginsLoaded } from '../PluginLoader';
9
10
  class ViewComponent extends React.Component {
11
+ componentDidMount() {
12
+ Moustrap.bind('g o d l d', () => {
13
+ const currentAppState = selectCurrentAppState();
14
+ if (currentAppState === 'email') {
15
+ return;
16
+ }
17
+ const totalSections = selectAvailableSections().length;
18
+ const availableAppStates = selectAvailableAppStates();
19
+ const emailIndex = availableAppStates.indexOf('email');
20
+ const wizardIndex = availableAppStates.indexOf('wizard');
21
+ const emailPage = totalSections + (emailIndex - wizardIndex);
22
+ this.props.goPage(emailPage);
23
+ });
24
+ }
10
25
  shouldComponentUpdate(newProps) {
11
26
  if (this.props.currentAppState !== newProps.currentAppState) {
12
27
  return true;
@@ -15,7 +15,6 @@ declare const connectorSelectors: {
15
15
  selectUserValidToken: () => Readonly<boolean>;
16
16
  selectUserEmail: () => string;
17
17
  isLevelAccessibleForUser: (level: "ADMIN" | "MANAGER" | "USER" | "GUEST" | "SUPER") => Readonly<boolean>;
18
- selectReferences: () => Readonly<import("@legalplace/referencesparser/dist/libs/References.type").ReferencesType>;
19
18
  selectOutputReference: (id: number) => Readonly<import("@legalplace/referencesparser/dist/libs/References.type").ReferencesSingleOutputType | undefined>;
20
19
  selectBoxReference: (id: number) => Readonly<import("@legalplace/referencesparser/dist/libs/References.type").ReferencesSingleBoxType>;
21
20
  isOptionMultiple: (id: number) => Readonly<boolean | undefined>;
@@ -94,6 +93,5 @@ declare const connectorSelectors: {
94
93
  selectCustomizationMeta: () => Readonly<import("../..").AppCustomizationMetaType | undefined>;
95
94
  selectCustomizationAutoDefaultType: () => Readonly<boolean | undefined>;
96
95
  selectModelUuid: () => Readonly<string | undefined>;
97
- CompletelyUnusedSelector: () => Readonly<string | undefined>;
98
96
  };
99
97
  export default connectorSelectors;
@@ -1,4 +1,4 @@
1
- export declare const getSIBExtract: () => Promise<{
1
+ export declare const getSIBExtract: () => {
2
2
  [k: string]: string;
3
- } | undefined>;
4
- export declare const getSendinblueIdentifyAttributes: (uniqid: string, documentTitle: string, nbFilledVars: number, VALIDATION_Q2?: boolean, domain?: string) => Promise<Record<string, string | number | undefined | boolean | null>>;
3
+ } | undefined;
4
+ export declare const getSendinblueIdentifyAttributes: (uniqid: string, documentTitle: string, nbFilledVars: number, VALIDATION_Q2?: boolean, domain?: string) => Record<string, string | number | undefined | boolean | null>;
@@ -1,29 +1,21 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
1
+ import PhoneNumber from 'awesome-phonenumber';
10
2
  import Extracts from '../libs/Extracts';
11
3
  import { pardotAttributes } from '../service/pardot.service';
12
- const formatMobilePhone = (phoneNumber) => __awaiter(void 0, void 0, void 0, function* () {
4
+ const formatMobilePhone = (phoneNumber) => {
13
5
  var _a;
14
- const sanitizedNumber = (yield import('awesome-phonenumber')).default(phoneNumber, 'FR');
6
+ const sanitizedNumber = new PhoneNumber(phoneNumber, 'FR');
15
7
  return !((_a = sanitizedNumber === null || sanitizedNumber === void 0 ? void 0 : sanitizedNumber.getNumber()) === null || _a === void 0 ? void 0 : _a.length) || !sanitizedNumber.isMobile()
16
8
  ? ''
17
9
  : sanitizedNumber.getNumber();
18
- });
19
- export const getSIBExtract = () => __awaiter(void 0, void 0, void 0, function* () {
10
+ };
11
+ export const getSIBExtract = () => {
20
12
  let sibExtract;
21
13
  try {
22
14
  Extracts.extractData();
23
15
  sibExtract = Extracts.getSibExtractedData();
24
16
  if (sibExtract.TEL) {
25
17
  try {
26
- sibExtract.SMS = yield formatMobilePhone(sibExtract.TEL);
18
+ sibExtract.SMS = formatMobilePhone(sibExtract.TEL);
27
19
  }
28
20
  catch (error) {
29
21
  }
@@ -33,11 +25,11 @@ export const getSIBExtract = () => __awaiter(void 0, void 0, void 0, function* (
33
25
  console.error('Error while extracting sendiblue data', error);
34
26
  }
35
27
  return sibExtract;
36
- });
37
- export const getSendinblueIdentifyAttributes = (uniqid, documentTitle, nbFilledVars, VALIDATION_Q2 = false, domain = 'www.legalplace.fr') => __awaiter(void 0, void 0, void 0, function* () {
38
- const sendinblueVars = Object.assign(Object.assign(Object.assign({ UNIQID: uniqid, AB: Math.floor(Math.random() * 2), TELECHARGEMENT: `${domain}/rt/${uniqid}`, DOCUMENT: documentTitle, WIZZARD_FILLED_FIELDS: nbFilledVars }, (yield getSIBExtract())), pardotAttributes()), { VALIDATION_Q2 });
28
+ };
29
+ export const getSendinblueIdentifyAttributes = (uniqid, documentTitle, nbFilledVars, VALIDATION_Q2 = false, domain = 'www.legalplace.fr') => {
30
+ const sendinblueVars = Object.assign(Object.assign(Object.assign({ UNIQID: uniqid, AB: Math.floor(Math.random() * 2), TELECHARGEMENT: `${domain}/rt/${uniqid}`, DOCUMENT: documentTitle, WIZZARD_FILLED_FIELDS: nbFilledVars }, getSIBExtract()), pardotAttributes()), { VALIDATION_Q2 });
39
31
  if (localStorage && localStorage.getItem('entranceUrl')) {
40
32
  sendinblueVars.URL_ENTREE = localStorage.getItem('entranceUrl');
41
33
  }
42
34
  return sendinblueVars;
43
- });
35
+ };
@@ -2,25 +2,25 @@ import { EvalBase } from './EvalBase';
2
2
  export declare class EvalFunctions extends EvalBase {
3
3
  holidays: string[];
4
4
  private parseVariableArgumentDate;
5
- afficherDate: (varRef: string) => Promise<string>;
6
- afficherAnnee: (varRef: string) => Promise<string>;
7
- date: (varRef: string) => Promise<number>;
8
- jourOuvre: (varRef: string) => Promise<string>;
9
- jourOuvrable: (varRef: string) => Promise<string>;
10
- ajouterJoursOuvres: (varRef: string, businessDaysRef: string) => Promise<string>;
11
- ajouterJoursOuvrables: (varRef: string, businessDaysRef: string) => Promise<string>;
12
- ajouterJours: (varRef: string, daysRef: string) => Promise<string>;
13
- ajouterMois: (varRef: string, monthsRef: string) => Promise<string>;
14
- ajouterAnnees: (varRef: string, yearsRef: string) => Promise<string>;
15
- enleverJoursOuvrables: (varRef: string, businessDaysRef: string) => Promise<string>;
16
- enleverJoursOuvres: (varRef: string, businessDaysRef: string) => Promise<string>;
17
- enleverJours: (varRef: string, daysRef: string) => Promise<string>;
18
- enleverMois: (varRef: string, monthsRef: string) => Promise<string>;
19
- enleverAnnees: (varRef: string, yearsRef: string) => Promise<string>;
20
- dureeJours: (varRefA: string, varRefB: string) => Promise<number>;
21
- dureeMois: (varRefA: string, varRefB: string) => Promise<number>;
22
- dureeAnnees: (varRefA: string, varRefB: string) => Promise<number>;
23
- today: () => Promise<string>;
24
- somme: (varRef: string) => Promise<number>;
25
- lettres: (varRef: string) => Promise<string>;
5
+ afficherDate: (varRef: string) => string;
6
+ afficherAnnee: (varRef: string) => string;
7
+ date: (varRef: string) => number;
8
+ jourOuvre: (varRef: string) => string;
9
+ jourOuvrable: (varRef: string) => string;
10
+ ajouterJoursOuvres: (varRef: string, businessDaysRef: string) => string;
11
+ ajouterJoursOuvrables: (varRef: string, businessDaysRef: string) => string;
12
+ ajouterJours: (varRef: string, daysRef: string) => string;
13
+ ajouterMois: (varRef: string, monthsRef: string) => string;
14
+ ajouterAnnees: (varRef: string, yearsRef: string) => string;
15
+ enleverJoursOuvrables: (varRef: string, businessDaysRef: string) => string;
16
+ enleverJoursOuvres: (varRef: string, businessDaysRef: string) => string;
17
+ enleverJours: (varRef: string, daysRef: string) => string;
18
+ enleverMois: (varRef: string, monthsRef: string) => string;
19
+ enleverAnnees: (varRef: string, yearsRef: string) => string;
20
+ dureeJours: (varRefA: string, varRefB: string) => number;
21
+ dureeMois: (varRefA: string, varRefB: string) => number;
22
+ dureeAnnees: (varRefA: string, varRefB: string) => number;
23
+ today: () => string;
24
+ somme: (varRef: string) => number;
25
+ lettres: (varRef: string) => string;
26
26
  }