@legalplace/wizardx-core 2.1.0-alpha.7 → 2.1.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/App.d.ts +2 -2
- package/dist/PluginLoader.js +3 -6
- package/dist/Shimmer.js +1 -1
- package/dist/ThemeLoader.d.ts +1 -1
- package/dist/components/SmartScript.d.ts +2 -2
- package/dist/components/SmartScript.js +9 -9
- package/dist/components/View.d.ts +0 -1
- package/dist/components/View.js +1 -16
- package/dist/componentsConnectors/connector/connectorSelectors.d.ts +1 -0
- package/dist/helpers/sendinblueHelper.d.ts +3 -3
- package/dist/helpers/sendinblueHelper.js +18 -10
- package/dist/libs/Eval/EvalFunctions.d.ts +21 -21
- package/dist/libs/Eval/EvalFunctions.js +141 -99
- package/dist/libs/EvalVariable.d.ts +1 -1
- package/dist/libs/EvalVariable.js +61 -49
- package/dist/redux/middlewares/smartscriptMiddleware.js +19 -1
- package/dist/redux/selectors/app.d.ts +1 -0
- package/dist/redux/selectors/app.js +1 -0
- package/dist/types/config.type.d.ts +1 -2
- package/package.json +4 -4
- package/src/App.tsx +2 -2
- package/src/PluginLoader.tsx +3 -20
- package/src/Shimmer.tsx +1 -1
- package/src/components/SmartScript.tsx +13 -12
- package/src/components/View.tsx +21 -23
- package/src/helpers/sendinblueHelper.ts +10 -8
- package/src/libs/Eval/EvalFunctions.ts +125 -72
- package/src/libs/EvalVariable.ts +13 -5
- package/src/redux/middlewares/smartscriptMiddleware.ts +40 -0
- package/src/redux/selectors/app.ts +6 -0
- package/src/types/config.type.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
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
|
+
|
|
6
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)
|
|
7
34
|
|
|
8
35
|
**Note:** Version bump only for package @legalplace/wizardx-core
|
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;
|
package/dist/PluginLoader.js
CHANGED
|
@@ -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
|
|
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(
|
|
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
|
|
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';
|
package/dist/ThemeLoader.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare const getThemeParams: () => {
|
|
|
21
21
|
email?: import("./types/config.type").SideBarType;
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
-
fonts?:
|
|
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
|
|
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:
|
|
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
|
-
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
}
|
package/dist/components/View.js
CHANGED
|
@@ -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
|
|
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;
|
|
@@ -94,5 +94,6 @@ declare const connectorSelectors: {
|
|
|
94
94
|
selectCustomizationMeta: () => Readonly<import("../..").AppCustomizationMetaType | undefined>;
|
|
95
95
|
selectCustomizationAutoDefaultType: () => Readonly<boolean | undefined>;
|
|
96
96
|
selectModelUuid: () => Readonly<string | undefined>;
|
|
97
|
+
CompletelyUnusedSelector: () => Readonly<string | undefined>;
|
|
97
98
|
};
|
|
98
99
|
export default connectorSelectors;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const getSIBExtract: () => {
|
|
1
|
+
export declare const getSIBExtract: () => Promise<{
|
|
2
2
|
[k: string]: string;
|
|
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
|
|
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>>;
|
|
@@ -1,21 +1,29 @@
|
|
|
1
|
-
|
|
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
|
+
};
|
|
2
10
|
import Extracts from '../libs/Extracts';
|
|
3
11
|
import { pardotAttributes } from '../service/pardot.service';
|
|
4
|
-
const formatMobilePhone = (phoneNumber) => {
|
|
12
|
+
const formatMobilePhone = (phoneNumber) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5
13
|
var _a;
|
|
6
|
-
const sanitizedNumber =
|
|
14
|
+
const sanitizedNumber = (yield import('awesome-phonenumber')).default(phoneNumber, 'FR');
|
|
7
15
|
return !((_a = sanitizedNumber === null || sanitizedNumber === void 0 ? void 0 : sanitizedNumber.getNumber()) === null || _a === void 0 ? void 0 : _a.length) || !sanitizedNumber.isMobile()
|
|
8
16
|
? ''
|
|
9
17
|
: sanitizedNumber.getNumber();
|
|
10
|
-
};
|
|
11
|
-
export const getSIBExtract = () => {
|
|
18
|
+
});
|
|
19
|
+
export const getSIBExtract = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
12
20
|
let sibExtract;
|
|
13
21
|
try {
|
|
14
22
|
Extracts.extractData();
|
|
15
23
|
sibExtract = Extracts.getSibExtractedData();
|
|
16
24
|
if (sibExtract.TEL) {
|
|
17
25
|
try {
|
|
18
|
-
sibExtract.SMS = formatMobilePhone(sibExtract.TEL);
|
|
26
|
+
sibExtract.SMS = yield formatMobilePhone(sibExtract.TEL);
|
|
19
27
|
}
|
|
20
28
|
catch (error) {
|
|
21
29
|
}
|
|
@@ -25,11 +33,11 @@ export const getSIBExtract = () => {
|
|
|
25
33
|
console.error('Error while extracting sendiblue data', error);
|
|
26
34
|
}
|
|
27
35
|
return sibExtract;
|
|
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 });
|
|
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 });
|
|
31
39
|
if (localStorage && localStorage.getItem('entranceUrl')) {
|
|
32
40
|
sendinblueVars.URL_ENTREE = localStorage.getItem('entranceUrl');
|
|
33
41
|
}
|
|
34
42
|
return sendinblueVars;
|
|
35
|
-
};
|
|
43
|
+
});
|
|
@@ -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
|
}
|