@legalplace/wizardx-core 2.1.0-alpha.0 → 2.1.0-alpha.10

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 (70) hide show
  1. package/CHANGELOG.md +113 -0
  2. package/dist/App.d.ts +3 -2
  3. package/dist/App.js +5 -1
  4. package/dist/PluginLoader.js +3 -6
  5. package/dist/Shimmer.js +1 -1
  6. package/dist/ThemeLoader.d.ts +1 -1
  7. package/dist/components/SmartScript.d.ts +2 -2
  8. package/dist/components/SmartScript.js +9 -9
  9. package/dist/components/View.d.ts +0 -1
  10. package/dist/components/View.js +1 -16
  11. package/dist/componentsConnectors/connector/connectorSelectors.d.ts +2 -0
  12. package/dist/config.test.js +2 -2
  13. package/dist/constants/phoneValidation.d.ts +3 -0
  14. package/dist/constants/phoneValidation.js +3 -0
  15. package/dist/helpers/preloadTheme.d.ts +1 -0
  16. package/dist/helpers/preloadTheme.js +19 -0
  17. package/dist/helpers/sendinblueHelper.js +8 -5
  18. package/dist/libs/Eval/EvalFunctions.d.ts +21 -21
  19. package/dist/libs/Eval/EvalFunctions.js +141 -99
  20. package/dist/libs/EvalVariable.d.ts +1 -1
  21. package/dist/libs/EvalVariable.js +61 -49
  22. package/dist/libs/EventsTracking.d.ts +1 -0
  23. package/dist/libs/EventsTracking.js +11 -5
  24. package/dist/redux/actions/inputs.d.ts +2 -0
  25. package/dist/redux/actions/inputs.js +6 -1
  26. package/dist/redux/constants/inputs.d.ts +1 -0
  27. package/dist/redux/constants/inputs.js +1 -0
  28. package/dist/redux/middlewares/smartscriptMiddleware.js +21 -3
  29. package/dist/redux/sagas/fetchModel.js +6 -58
  30. package/dist/redux/sagas/fetchModel.test.js +2 -3
  31. package/dist/redux/sagas/initInputs.d.ts +5 -0
  32. package/dist/redux/sagas/initInputs.js +63 -0
  33. package/dist/redux/sagas/runner.js +2 -0
  34. package/dist/redux/selectors/app.d.ts +1 -0
  35. package/dist/redux/selectors/app.js +1 -0
  36. package/dist/redux/selectors/references.d.ts +1 -0
  37. package/dist/redux/selectors/references.js +1 -0
  38. package/dist/service/api.manager.d.ts +1 -1
  39. package/dist/service/api.manager.js +13 -5
  40. package/dist/types/Actions.type.d.ts +6 -1
  41. package/dist/types/config.type.d.ts +3 -5
  42. package/dist/wizard-params.js +2 -2
  43. package/jest.config.ts +1 -1
  44. package/package.json +7 -7
  45. package/setupJest.ts +8 -0
  46. package/src/App.tsx +9 -3
  47. package/src/PluginLoader.tsx +3 -20
  48. package/src/Shimmer.tsx +1 -1
  49. package/src/components/SmartScript.tsx +13 -12
  50. package/src/components/View.tsx +21 -23
  51. package/src/config.test.ts +2 -2
  52. package/src/constants/phoneValidation.ts +6 -0
  53. package/src/helpers/preloadTheme.ts +17 -0
  54. package/src/helpers/sendinblueHelper.ts +9 -4
  55. package/src/libs/Eval/EvalFunctions.ts +125 -72
  56. package/src/libs/EvalVariable.ts +13 -5
  57. package/src/libs/EventsTracking.ts +14 -0
  58. package/src/redux/actions/inputs.ts +16 -0
  59. package/src/redux/constants/inputs.ts +2 -0
  60. package/src/redux/middlewares/smartscriptMiddleware.ts +43 -2
  61. package/src/redux/sagas/fetchModel.test.ts +2 -5
  62. package/src/redux/sagas/fetchModel.ts +8 -108
  63. package/src/redux/sagas/initInputs.ts +110 -0
  64. package/src/redux/sagas/runner.ts +2 -0
  65. package/src/redux/selectors/app.ts +6 -0
  66. package/src/redux/selectors/references.ts +4 -0
  67. package/src/service/api.manager.ts +20 -7
  68. package/src/types/Actions.type.ts +8 -0
  69. package/src/types/config.type.ts +4 -5
  70. package/src/wizard-params.ts +2 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,119 @@
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.10](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.1.0-alpha.9...@legalplace/wizardx-core@2.1.0-alpha.10) (2021-11-29)
7
+
8
+ **Note:** Version bump only for package @legalplace/wizardx-core
9
+
10
+
11
+
12
+
13
+
14
+ # [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)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * fix linting api[#4480](https://git.legalplace.eu/legalplace/monorepo/issues/4480) ([e8d76f5](https://git.legalplace.eu/legalplace/monorepo/commits/e8d76f5333b2940dbb170099a77d19a37c503cba))
20
+
21
+
22
+ ### Features
23
+
24
+ * load speed optimizations api[#4480](https://git.legalplace.eu/legalplace/monorepo/issues/4480) ([5227752](https://git.legalplace.eu/legalplace/monorepo/commits/522775255c71f98d4a4052fbcd05c5ae956925a2))
25
+
26
+
27
+
28
+
29
+
30
+ # [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)
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * 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))
36
+
37
+
38
+
39
+
40
+
41
+ # [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)
42
+
43
+ **Note:** Version bump only for package @legalplace/wizardx-core
44
+
45
+
46
+
47
+
48
+
49
+ # [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)
50
+
51
+
52
+ ### Bug Fixes
53
+
54
+ * fix push api[#3338](https://git.legalplace.eu/legalplace/monorepo/issues/3338) ([1c961d5](https://git.legalplace.eu/legalplace/monorepo/commits/1c961d5a459513f791c2afb363881aa3d9214add))
55
+
56
+
57
+ ### Features
58
+
59
+ * 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))
60
+
61
+
62
+
63
+
64
+
65
+ # [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)
66
+
67
+
68
+ ### Features
69
+
70
+ * tracking X-Source cookie api[#4377](https://git.legalplace.eu/legalplace/monorepo/issues/4377) ([0b52550](https://git.legalplace.eu/legalplace/monorepo/commits/0b52550632daa141ab241183a9cf2169e8d5fb08))
71
+
72
+
73
+
74
+
75
+
76
+ # [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)
77
+
78
+ **Note:** Version bump only for package @legalplace/wizardx-core
79
+
80
+
81
+
82
+
83
+
84
+ # [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)
85
+
86
+
87
+ ### Bug Fixes
88
+
89
+ * fix config test api[#4377](https://git.legalplace.eu/legalplace/monorepo/issues/4377) ([8de0c2c](https://git.legalplace.eu/legalplace/monorepo/commits/8de0c2c8faadf18c082d372e0b9caf70d3b0d669))
90
+ * fix styled-component issues api[#4377](https://git.legalplace.eu/legalplace/monorepo/issues/4377) ([d21227c](https://git.legalplace.eu/legalplace/monorepo/commits/d21227c278d545a6aba492b5e6b33062e31a52cd))
91
+ * fix type errors api[#4377](https://git.legalplace.eu/legalplace/monorepo/issues/4377) ([c14a871](https://git.legalplace.eu/legalplace/monorepo/commits/c14a8717b53d023f89d09b329d2dff062b4890f0))
92
+
93
+
94
+
95
+
96
+
97
+ # [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)
98
+
99
+
100
+ ### Features
101
+
102
+ * 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))
103
+
104
+
105
+
106
+
107
+
108
+ # [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)
109
+
110
+
111
+ ### Features
112
+
113
+ * 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))
114
+
115
+
116
+
117
+
118
+
6
119
  # [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)
7
120
 
8
121
 
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 { StateType } from './types/State.type';
4
- import { IWizardParams } from './types/config.type';
3
+ import type { StateType } from './types/State.type';
4
+ import type { IWizardParams } from './types/config.type';
5
5
  export interface AppProps {
6
6
  historyType: 'browser' | 'memory';
7
7
  model?: ModelV3;
@@ -9,6 +9,7 @@ export interface AppProps {
9
9
  instance?: StateType.App.Instance;
10
10
  user?: StateType.User;
11
11
  wizardParams?: IWizardParams;
12
+ preloadTheme?: boolean;
12
13
  loadPlugin: (plugin: string) => Promise<any>;
13
14
  loadTheme: (theme: string) => Promise<any>;
14
15
  }
package/dist/App.js CHANGED
@@ -11,8 +11,10 @@ import ViewComponent from './components/View';
11
11
  import SmartScriptComponent from './components/SmartScript';
12
12
  import { PluginRoute } from './components/PluginRoute';
13
13
  import { clearPlugins } from './PluginLoader';
14
+ import { preloadTheme } from './helpers/preloadTheme';
14
15
  class WizardXCore extends React.Component {
15
16
  constructor(props) {
17
+ var _a;
16
18
  super(props);
17
19
  clearPlugins();
18
20
  const historyType = typeof props.historyType === 'string' ? props.historyType : 'browser';
@@ -39,6 +41,8 @@ class WizardXCore extends React.Component {
39
41
  setGlobals(params);
40
42
  if (props.wizardParams)
41
43
  updateConfig(props.wizardParams);
44
+ if (props.preloadTheme && ((_a = props.wizardParams) === null || _a === void 0 ? void 0 : _a.theme.name))
45
+ preloadTheme(props.wizardParams.theme.name);
42
46
  createAppStore(historyType);
43
47
  }
44
48
  componentDidMount() {
@@ -69,7 +73,7 @@ class WizardXCore extends React.Component {
69
73
  React.createElement(Route, { path: "/p/:path", component: PluginRoute }),
70
74
  React.createElement(Route, { path: getConfig().router.wizardInstancePath, component: ViewComponent }),
71
75
  React.createElement(Route, { path: getConfig().router.wizardPath, component: ViewComponent }),
72
- React.createElement(Route, { path: getConfig().router.smartscriptRoute ||
76
+ React.createElement(Route, { path: getConfig().router.smartscriptPath ||
73
77
  '/contrats/:permalink/smartscript/:uniqid?', component: SmartScriptComponent }),
74
78
  React.createElement(Redirect, { to: {
75
79
  pathname: getConfig().router.notFoundPath,
@@ -10,13 +10,10 @@ 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';
14
13
  import { getStore } from './redux/store';
15
14
  import { getHistory } from './redux/routerHistory';
16
15
  import { EventsTracking } from './libs/EventsTracking';
17
16
  import Globals from './Globals';
18
- import * as selectorsList from './redux/selectors';
19
- import * as connectorsList from './componentsConnectors';
20
17
  let globalAnchors = {};
21
18
  let reduxAnchors = {};
22
19
  let actionOverrideAnchor = {};
@@ -69,7 +66,7 @@ export const pluginPageAppState = (page) => {
69
66
  return false;
70
67
  };
71
68
  export const getPluginsPageAppStates = () => PluginsPageAppStates;
72
- const loadPluginFiles = (pluginsList, connectorSelectors, connectors) => __awaiter(void 0, void 0, void 0, function* () {
69
+ const loadPluginFiles = (pluginsList) => __awaiter(void 0, void 0, void 0, function* () {
73
70
  const plugins = Object.keys(pluginsList);
74
71
  const pluginModules = yield Promise.all(plugins.map((plugin) => Globals.loadPlugin(plugin)));
75
72
  plugins.forEach((plugin, index) => {
@@ -77,7 +74,7 @@ const loadPluginFiles = (pluginsList, connectorSelectors, connectors) => __await
77
74
  const anchors = pluginModule.default;
78
75
  const { loader } = pluginModule;
79
76
  if (loader !== undefined) {
80
- loader(connectorSelectors, connectors, getStore().dispatch, connectorActions, getHistory(), getConfig(), EventsTracking);
77
+ loader(getStore().dispatch, getHistory(), getConfig(), EventsTracking);
81
78
  }
82
79
  Object.keys(anchors).forEach((anchor) => {
83
80
  if (anchor === 'replace') {
@@ -128,7 +125,7 @@ export const loadPlugins = (plugins) => __awaiter(void 0, void 0, void 0, functi
128
125
  if (pluginsList === undefined) {
129
126
  pluginsList = getConfig().plugins;
130
127
  }
131
- yield loadPluginFiles(pluginsList, selectorsList, connectorsList);
128
+ yield loadPluginFiles(pluginsList);
132
129
  pluginsLoadingDone = true;
133
130
  });
134
131
  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';
3
+ import { Loader } from '@legalplace/storybook/dist/components/UI/Loader';
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?: import("@legalplace/storybook").IFonts | undefined;
24
+ fonts?: any;
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 moment from 'moment-business-days';
3
+ import type { 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: typeof moment;
25
+ moment: 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,7 +1,6 @@
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';
5
4
  import { getConfig } from '../config';
6
5
  import { SmartScriptStore } from '../libs/SmartScriptStore';
7
6
  const SmartScriptComponent = () => {
@@ -24,7 +23,6 @@ const SmartScriptComponent = () => {
24
23
  window.displayVariable = SmartScriptStore.displayVariable;
25
24
  window.hideOption = SmartScriptStore.hideOption;
26
25
  window.displayOption = SmartScriptStore.displayOption;
27
- window.moment = moment;
28
26
  const apiEndpoint = getConfig().apiEndpoint + (/\/$/.test(getConfig().apiEndpoint) ? '' : '/');
29
27
  const { permalink, uniqid } = useParams();
30
28
  const modelVersion = queryString.parse(window.location.search).version;
@@ -34,13 +32,15 @@ const SmartScriptComponent = () => {
34
32
  const scriptElement = document.createElement('script');
35
33
  scriptElement.setAttribute('src', src);
36
34
  scriptElement.onload = () => {
37
- if (typeof initTriggersCallback === 'function') {
38
- if (isNewInstance)
39
- SmartScriptStore.execOnInit();
40
- SmartScriptStore.execOnLoad();
41
- initTriggersCallback(SmartScriptStore.triggers, SmartScriptStore.grabActions());
42
- }
43
- setSmartScriptLoaded(true);
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
+ });
44
44
  };
45
45
  document.body.append(scriptElement);
46
46
  }
@@ -4,7 +4,6 @@ export declare type OwnProps = {
4
4
  goPage: (p: number) => void;
5
5
  };
6
6
  declare class ViewComponent extends React.Component<OwnProps> {
7
- componentDidMount(): void;
8
7
  shouldComponentUpdate(newProps: OwnProps): boolean;
9
8
  render(): JSX.Element;
10
9
  }
@@ -1,27 +1,12 @@
1
1
  import React from 'react';
2
2
  import { connect } from 'react-redux';
3
- import Moustrap from 'mousetrap';
4
3
  import Shimmer from '../Shimmer';
5
4
  import { loadThemeComponent } from '../ThemeLoader';
6
- import { selectCurrentAppState, selectAvailableAppStates, selectAvailableSections, } from '../redux/selectors/app';
5
+ import { selectCurrentAppState } from '../redux/selectors/app';
7
6
  import Globals from '../Globals';
8
7
  import { goPageAction } from '../redux/actions/app';
9
8
  import { loadPluginComponent, pluginsLoaded } from '../PluginLoader';
10
9
  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
- }
25
10
  shouldComponentUpdate(newProps) {
26
11
  if (this.props.currentAppState !== newProps.currentAppState) {
27
12
  return true;
@@ -15,6 +15,7 @@ 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>;
18
19
  selectOutputReference: (id: number) => Readonly<import("@legalplace/referencesparser/dist/libs/References.type").ReferencesSingleOutputType | undefined>;
19
20
  selectBoxReference: (id: number) => Readonly<import("@legalplace/referencesparser/dist/libs/References.type").ReferencesSingleBoxType>;
20
21
  isOptionMultiple: (id: number) => Readonly<boolean | undefined>;
@@ -93,5 +94,6 @@ declare const connectorSelectors: {
93
94
  selectCustomizationMeta: () => Readonly<import("../..").AppCustomizationMetaType | undefined>;
94
95
  selectCustomizationAutoDefaultType: () => Readonly<boolean | undefined>;
95
96
  selectModelUuid: () => Readonly<string | undefined>;
97
+ CompletelyUnusedSelector: () => Readonly<string | undefined>;
96
98
  };
97
99
  export default connectorSelectors;
@@ -16,12 +16,12 @@ describe('Config loader', () => {
16
16
  router: {
17
17
  wizardPath: '/contrats/:prefix?/:permalink/creer/:page?',
18
18
  wizardInstancePath: '/contrats/:prefix?/:permalink/continuer/:uniqid([0-9a-zA-Z]+)/:page?',
19
- notFoundUrl: '/contrats/conditions-generales-de-vente/creer',
19
+ notFoundPath: '/contrats/conditions-generales-de-vente/creer',
20
20
  appStatesPages: {
21
21
  termsheet: 'resume',
22
22
  email: 'email',
23
23
  },
24
- smartscriptRoute: '/contrats/:permalink/smartscript/:uniqid?',
24
+ smartscriptPath: '/contrats/:permalink/smartscript/:uniqid?',
25
25
  },
26
26
  plugins: {
27
27
  b2c_actions: '1.0.0',
@@ -0,0 +1,3 @@
1
+ export declare const phoneNumberRegX: RegExp;
2
+ export declare const phonePatternFR: RegExp;
3
+ export declare const FRENCH_OVERSEAS_NUMBERS_REGEX: RegExp;
@@ -0,0 +1,3 @@
1
+ export const phoneNumberRegX = /^[+]?[(]?[0-9]{3}[)]?[-\s.]?[0-9]{3}[-\s.]?[0-9]{4,6}$/im;
2
+ export const phonePatternFR = /^(?:(?:\+|00)33|0)\s*[1-9](?:[\s.-]*\d{2}){4}$/gim;
3
+ export const FRENCH_OVERSEAS_NUMBERS_REGEX = /\+33(?:6(?:39|9[0123467])|7(?:[0-2]\d))\d{6}/;
@@ -0,0 +1 @@
1
+ export declare const preloadTheme: (theme: string) => Promise<void>;
@@ -0,0 +1,19 @@
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
+ };
10
+ import Globals from '../Globals';
11
+ export const preloadTheme = (theme) => __awaiter(void 0, void 0, void 0, function* () {
12
+ const { default: components } = (yield Globals.loadTheme(theme));
13
+ try {
14
+ components.WizardComponent.preload();
15
+ components.TermsheetComponent.preload();
16
+ components.EmailComponent.preload();
17
+ }
18
+ catch (e) { }
19
+ });
@@ -1,12 +1,15 @@
1
1
  import PhoneNumber from 'awesome-phonenumber';
2
+ import { FRENCH_OVERSEAS_NUMBERS_REGEX } from '../constants/phoneValidation';
2
3
  import Extracts from '../libs/Extracts';
3
4
  import { pardotAttributes } from '../service/pardot.service';
4
- const formatMobilePhone = (phoneNumber) => {
5
- var _a;
6
- const sanitizedNumber = new PhoneNumber(phoneNumber, 'FR');
7
- return !((_a = sanitizedNumber === null || sanitizedNumber === void 0 ? void 0 : sanitizedNumber.getNumber()) === null || _a === void 0 ? void 0 : _a.length) || !sanitizedNumber.isMobile()
5
+ const formatMobilePhone = (number) => {
6
+ const phoneNumber = new PhoneNumber(number, 'FR');
7
+ const sanitizedNumber = phoneNumber.getNumber();
8
+ return !(sanitizedNumber === null || sanitizedNumber === void 0 ? void 0 : sanitizedNumber.length) ||
9
+ (!phoneNumber.isValid() &&
10
+ !FRENCH_OVERSEAS_NUMBERS_REGEX.test(sanitizedNumber))
8
11
  ? ''
9
- : sanitizedNumber.getNumber();
12
+ : sanitizedNumber;
10
13
  };
11
14
  export const getSIBExtract = () => {
12
15
  let sibExtract;
@@ -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) => 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;
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>;
26
26
  }