@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 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;
@@ -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;
@@ -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
- import PhoneNumber from 'awesome-phonenumber';
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 = new PhoneNumber(phoneNumber, 'FR');
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
  }