@legalplace/wizardx-core 2.9.0 → 2.10.1
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 +26 -0
- package/dist/Globals.d.ts +0 -5
- package/dist/PluginLoader.js +1 -2
- package/dist/libs/index.d.ts +0 -1
- package/dist/libs/index.js +0 -1
- package/dist/redux/selectors/library.d.ts +2 -2
- package/dist/redux/selectors/user.d.ts +2 -2
- package/dist/redux/selectors/user.js +2 -2
- package/dist/redux/selectors/user.test.js +1 -0
- package/dist/types/State.type.d.ts +1 -1
- package/package.json +2 -2
- package/dist/libs/EventsTracking.d.ts +0 -22
- package/dist/libs/EventsTracking.js +0 -177
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,32 @@
|
|
|
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.10.1](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.10.0...@legalplace/wizardx-core@2.10.1) (2022-04-14)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @legalplace/wizardx-core
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [2.10.0](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.9.0...@legalplace/wizardx-core@2.10.0) (2022-04-11)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* fixed failed test ([4ffb37b](https://git.legalplace.eu/legalplace/monorepo/commits/4ffb37b7b4cdd47b410949a99dc21723ce47fb0a)), closes [api#5253](https://git.legalplace.eu/legalplace/monorepo/issues/5253)
|
|
20
|
+
* fixed order enum role user ([33d9c72](https://git.legalplace.eu/legalplace/monorepo/commits/33d9c727f029347ac1fce94b47feb7637bfc8973)), closes [api#5253](https://git.legalplace.eu/legalplace/monorepo/issues/5253)
|
|
21
|
+
* organize order role user ([78c4a37](https://git.legalplace.eu/legalplace/monorepo/commits/78c4a37104d234eaeae3ae080c8a737c4f3b1d8f)), closes [api#5253](https://git.legalplace.eu/legalplace/monorepo/issues/5253)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* added role OPS ([2578040](https://git.legalplace.eu/legalplace/monorepo/commits/2578040d296abaf5f6740ae5d555c2947b357b82)), closes [api#5253](https://git.legalplace.eu/legalplace/monorepo/issues/5253)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
6
32
|
# [2.9.0](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.8.0...@legalplace/wizardx-core@2.9.0) (2022-04-06)
|
|
7
33
|
|
|
8
34
|
|
package/dist/Globals.d.ts
CHANGED
package/dist/PluginLoader.js
CHANGED
|
@@ -13,7 +13,6 @@ import PropTypes from "prop-types";
|
|
|
13
13
|
import { getConfig } from "./config";
|
|
14
14
|
import { getStore } from "./redux/store";
|
|
15
15
|
import { getHistory } from "./redux/routerHistory";
|
|
16
|
-
import { EventsTracking } from "./libs/EventsTracking";
|
|
17
16
|
import Globals from "./Globals";
|
|
18
17
|
import { INIT_PLUGINS } from "./redux/constants/app";
|
|
19
18
|
let globalAnchors = {};
|
|
@@ -78,7 +77,7 @@ const loadPluginFiles = (pluginsList) => __awaiter(void 0, void 0, void 0, funct
|
|
|
78
77
|
const anchors = pluginModule.default;
|
|
79
78
|
const { loader } = pluginModule;
|
|
80
79
|
if (loader !== undefined) {
|
|
81
|
-
loader(getStore().dispatch, getHistory(), getConfig()
|
|
80
|
+
loader(getStore().dispatch, getHistory(), getConfig());
|
|
82
81
|
}
|
|
83
82
|
Object.keys(anchors).forEach((anchor) => {
|
|
84
83
|
if (anchor === "replace") {
|
package/dist/libs/index.d.ts
CHANGED
package/dist/libs/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as inputs from "./inputs";
|
|
2
2
|
export declare const selectorsLibrary: {
|
|
3
|
-
selectCurrentUserLevel: () => Readonly<"ADMIN" | "MANAGER" | "USER" | "GUEST" | "SUPER" | undefined>;
|
|
3
|
+
selectCurrentUserLevel: () => Readonly<"ADMIN" | "MANAGER" | "USER" | "GUEST" | "SUPER" | "OPS" | undefined>;
|
|
4
4
|
selectUserStatus: () => Readonly<"failed" | "authenticated" | "unauthenticated" | "inprogress">;
|
|
5
5
|
selectUserValidToken: () => Readonly<boolean>;
|
|
6
6
|
selectUserEmail: () => string;
|
|
7
|
-
isLevelAccessibleForUser: (level: "ADMIN" | "MANAGER" | "USER" | "GUEST" | "SUPER") => Readonly<boolean>;
|
|
7
|
+
isLevelAccessibleForUser: (level: "ADMIN" | "MANAGER" | "USER" | "GUEST" | "SUPER" | "OPS") => Readonly<boolean>;
|
|
8
8
|
selectIsSmartscriptOptionIndexHidden: (id: number, index: number) => Readonly<boolean>;
|
|
9
9
|
selectIsSmartscriptVariableIndexHidden: (id: number, index: number) => Readonly<boolean>;
|
|
10
10
|
selectReferences: () => Readonly<import("@legalplace/referencesparser/dist/libs/References.type").ReferencesType>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const selectCurrentUserLevel: () => Readonly<"ADMIN" | "MANAGER" | "USER" | "GUEST" | "SUPER" | undefined>;
|
|
1
|
+
export declare const selectCurrentUserLevel: () => Readonly<"ADMIN" | "MANAGER" | "USER" | "GUEST" | "SUPER" | "OPS" | undefined>;
|
|
2
2
|
export declare const selectUserStatus: () => Readonly<"failed" | "authenticated" | "unauthenticated" | "inprogress">;
|
|
3
3
|
export declare const selectUserValidToken: () => Readonly<boolean>;
|
|
4
4
|
export declare const selectUserEmail: () => string;
|
|
5
|
-
export declare const isLevelAccessibleForUser: (level: "ADMIN" | "MANAGER" | "USER" | "GUEST" | "SUPER") => Readonly<boolean>;
|
|
5
|
+
export declare const isLevelAccessibleForUser: (level: "ADMIN" | "MANAGER" | "USER" | "GUEST" | "SUPER" | "OPS") => Readonly<boolean>;
|
|
@@ -9,6 +9,6 @@ export const selectUserEmail = createSelector((state) => state.user && state.use
|
|
|
9
9
|
: false);
|
|
10
10
|
export const isLevelAccessibleForUser = createSelector((state, level) => {
|
|
11
11
|
const currentUserLevel = state.user ? state.user.level : "GUEST";
|
|
12
|
-
const levelEnum = ["GUEST", "USER", "MANAGER", "ADMIN", "SUPER"];
|
|
12
|
+
const levelEnum = ["GUEST", "USER", "MANAGER", "OPS", "ADMIN", "SUPER"];
|
|
13
13
|
return levelEnum.indexOf(level) <= levelEnum.indexOf(currentUserLevel);
|
|
14
|
-
}, (state, level) => state.user ? `${state.user.level}-${level}` : false);
|
|
14
|
+
}, (state, level) => (state.user ? `${state.user.level}-${level}` : false));
|
|
@@ -22,6 +22,7 @@ describe('User selectors test suit', () => {
|
|
|
22
22
|
expect(isLevelAccessibleForUser('GUEST')).toBeTruthy();
|
|
23
23
|
expect(isLevelAccessibleForUser('USER')).toBeTruthy();
|
|
24
24
|
expect(isLevelAccessibleForUser('MANAGER')).toBeTruthy();
|
|
25
|
+
expect(isLevelAccessibleForUser('OPS')).toBeFalsy();
|
|
25
26
|
expect(isLevelAccessibleForUser('ADMIN')).toBeFalsy();
|
|
26
27
|
expect(isLevelAccessibleForUser('SUPER')).toBeFalsy();
|
|
27
28
|
});
|
|
@@ -191,7 +191,7 @@ export interface UserType {
|
|
|
191
191
|
status: "authenticated" | "unauthenticated" | "inprogress" | "failed";
|
|
192
192
|
email: string;
|
|
193
193
|
displayName: string;
|
|
194
|
-
level: "ADMIN" | "
|
|
194
|
+
level: "SUPER" | "ADMIN" | "OPS" | "MANAGER" | "USER" | "GUEST";
|
|
195
195
|
validToken?: boolean;
|
|
196
196
|
}
|
|
197
197
|
export interface InputsType {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/wizardx-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.1",
|
|
4
4
|
"author": "Moncef Hammou (moncef@legalplace.fr)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"*.test.ts",
|
|
93
93
|
"*.test.tsx"
|
|
94
94
|
],
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "74f45fb5a2fcf15cadc6a4744af8bf75d8400954"
|
|
96
96
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare type EventsPropsType = Record<string, string | number | boolean | Record<string, string | number | boolean>>;
|
|
2
|
-
declare class _EventsTracking {
|
|
3
|
-
private initiated;
|
|
4
|
-
private queue;
|
|
5
|
-
private queueTimer;
|
|
6
|
-
track(eventName: string, eventProps?: EventsPropsType): void;
|
|
7
|
-
register(props: EventsPropsType): void;
|
|
8
|
-
trigger(name: string): void;
|
|
9
|
-
private init;
|
|
10
|
-
private getXSource;
|
|
11
|
-
private getXAbTests;
|
|
12
|
-
private executeQueue;
|
|
13
|
-
private queueTimeout;
|
|
14
|
-
trackMix(eventName: string, eventProps?: EventsPropsType, doNotPushToQueue?: boolean): boolean;
|
|
15
|
-
private trackFB;
|
|
16
|
-
private trackGA;
|
|
17
|
-
private registerMix;
|
|
18
|
-
private registerFB;
|
|
19
|
-
private triggerHj;
|
|
20
|
-
}
|
|
21
|
-
export declare const EventsTracking: _EventsTracking;
|
|
22
|
-
export {};
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import Cookies from "universal-cookie";
|
|
2
|
-
import Globals from "../Globals";
|
|
3
|
-
const cookie = new Cookies();
|
|
4
|
-
class _EventsTracking {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.initiated = false;
|
|
7
|
-
this.queue = [];
|
|
8
|
-
this.queueTimer = null;
|
|
9
|
-
}
|
|
10
|
-
track(eventName, eventProps) {
|
|
11
|
-
if (!this.initiated)
|
|
12
|
-
this.init();
|
|
13
|
-
this.trackMix(eventName, Object.assign({}, eventProps));
|
|
14
|
-
this.trackFB(eventName, Object.assign({}, eventProps));
|
|
15
|
-
this.trackGA(eventName, Object.assign({}, eventProps));
|
|
16
|
-
}
|
|
17
|
-
register(props) {
|
|
18
|
-
if (!this.initiated)
|
|
19
|
-
this.init();
|
|
20
|
-
this.registerMix(props);
|
|
21
|
-
this.registerFB(props);
|
|
22
|
-
}
|
|
23
|
-
trigger(name) {
|
|
24
|
-
if (!this.initiated)
|
|
25
|
-
this.init();
|
|
26
|
-
this.triggerHj(name);
|
|
27
|
-
}
|
|
28
|
-
init() {
|
|
29
|
-
this.initiated = true;
|
|
30
|
-
this.register(Object.assign(Object.assign({ "WizardX Build Commit": process.env.REACT_APP_COMMIT || "Unkown build commit", Environement: Globals.appEnv, "Powered By": "WizardX" }, this.getXSource()), this.getXAbTests()));
|
|
31
|
-
this.trigger("wizardx");
|
|
32
|
-
}
|
|
33
|
-
getXSource() {
|
|
34
|
-
const xSource = cookie.get("X-Source");
|
|
35
|
-
return typeof xSource === "string" && xSource.trim().length > 0
|
|
36
|
-
? {
|
|
37
|
-
"X-Source": xSource,
|
|
38
|
-
}
|
|
39
|
-
: {};
|
|
40
|
-
}
|
|
41
|
-
getXAbTests() {
|
|
42
|
-
const xAbTests = cookie.get("X-AbTests");
|
|
43
|
-
if (typeof xAbTests === "object") {
|
|
44
|
-
const xAbTestsFlattened = {};
|
|
45
|
-
Object.keys(xAbTests).forEach((abTestName) => {
|
|
46
|
-
xAbTestsFlattened[`X-AbTests[${abTestName}]`] = xAbTests[abTestName];
|
|
47
|
-
});
|
|
48
|
-
return xAbTestsFlattened;
|
|
49
|
-
}
|
|
50
|
-
return typeof xAbTests === "string" && xAbTests.trim().length > 0
|
|
51
|
-
? {
|
|
52
|
-
"X-AbTests": xAbTests,
|
|
53
|
-
}
|
|
54
|
-
: {};
|
|
55
|
-
}
|
|
56
|
-
executeQueue() {
|
|
57
|
-
for (let i = 0; i < this.queue.length; i += 1) {
|
|
58
|
-
const currentEvent = this.queue[i];
|
|
59
|
-
const args = [];
|
|
60
|
-
const [fnName] = currentEvent;
|
|
61
|
-
if (currentEvent.length > 1) {
|
|
62
|
-
for (let x = 0; x < currentEvent[1].length; x += 1)
|
|
63
|
-
args.push(currentEvent[1][x]);
|
|
64
|
-
args.push(true);
|
|
65
|
-
let fn;
|
|
66
|
-
switch (fnName) {
|
|
67
|
-
case "trackMix":
|
|
68
|
-
fn = this.trackMix.bind(this);
|
|
69
|
-
break;
|
|
70
|
-
case "trackFB":
|
|
71
|
-
fn = this.trackFB.bind(this);
|
|
72
|
-
break;
|
|
73
|
-
case "trackGA":
|
|
74
|
-
fn = this.trackGA.bind(this);
|
|
75
|
-
break;
|
|
76
|
-
case "registerMix":
|
|
77
|
-
fn = this.registerMix.bind(this);
|
|
78
|
-
break;
|
|
79
|
-
case "registerFB":
|
|
80
|
-
fn = this.registerFB.bind(this);
|
|
81
|
-
break;
|
|
82
|
-
case "triggerHj":
|
|
83
|
-
fn = this.triggerHj.bind(this);
|
|
84
|
-
break;
|
|
85
|
-
default:
|
|
86
|
-
throw new Error(`Unkown function "${fnName}" found on events tracking queue`);
|
|
87
|
-
}
|
|
88
|
-
const result = fn(...args);
|
|
89
|
-
if (result === true) {
|
|
90
|
-
this.queue.splice(i, 1);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
queueTimeout() {
|
|
96
|
-
if (this.queueTimer !== null)
|
|
97
|
-
clearTimeout(this.queueTimer);
|
|
98
|
-
this.queueTimer = setTimeout(() => {
|
|
99
|
-
this.executeQueue();
|
|
100
|
-
}, 50);
|
|
101
|
-
}
|
|
102
|
-
trackMix(eventName, eventProps, doNotPushToQueue = false) {
|
|
103
|
-
if (!this.initiated)
|
|
104
|
-
this.init();
|
|
105
|
-
if (typeof window.mixpanel !== "undefined") {
|
|
106
|
-
if (this.queue.length > 0 && !doNotPushToQueue)
|
|
107
|
-
this.executeQueue();
|
|
108
|
-
window.mixpanel.track(eventName, eventProps);
|
|
109
|
-
return true;
|
|
110
|
-
}
|
|
111
|
-
if (doNotPushToQueue === false)
|
|
112
|
-
this.queue.push(["trackMix", [eventName, eventProps]]);
|
|
113
|
-
this.queueTimeout();
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
trackFB(eventName, eventProps, doNotPushToQueue = false) {
|
|
117
|
-
if (typeof window.fbq !== "undefined") {
|
|
118
|
-
if (this.queue.length > 0 && !doNotPushToQueue)
|
|
119
|
-
this.executeQueue();
|
|
120
|
-
window.fbq("trackCustom", eventName, eventProps);
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
if (doNotPushToQueue === false)
|
|
124
|
-
this.queue.push(["trackFB", [eventName, eventProps]]);
|
|
125
|
-
this.queueTimeout();
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
trackGA(eventName, eventProps, doNotPushToQueue = false) {
|
|
129
|
-
if (typeof window.ga !== "undefined") {
|
|
130
|
-
if (this.queue.length > 0 && !doNotPushToQueue)
|
|
131
|
-
this.executeQueue();
|
|
132
|
-
window.ga("send", "event", "lpTracking", "track", eventName, 1, eventProps);
|
|
133
|
-
return true;
|
|
134
|
-
}
|
|
135
|
-
if (doNotPushToQueue === false)
|
|
136
|
-
this.queue.push(["trackGA", [eventName, eventProps]]);
|
|
137
|
-
this.queueTimeout();
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
registerMix(props, doNotPushToQueue = false) {
|
|
141
|
-
if (typeof window.mixpanel !== "undefined") {
|
|
142
|
-
if (this.queue.length > 0 && !doNotPushToQueue)
|
|
143
|
-
this.executeQueue();
|
|
144
|
-
window.mixpanel.register(props);
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
if (doNotPushToQueue === false)
|
|
148
|
-
this.queue.push(["registerMix", [props]]);
|
|
149
|
-
this.queueTimeout();
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
registerFB(props, doNotPushToQueue = false) {
|
|
153
|
-
if (typeof window.fbq !== "undefined") {
|
|
154
|
-
if (this.queue.length > 0 && !doNotPushToQueue)
|
|
155
|
-
this.executeQueue();
|
|
156
|
-
window.fbq("trackCustom", "GeneralProps", props);
|
|
157
|
-
return true;
|
|
158
|
-
}
|
|
159
|
-
if (doNotPushToQueue === false)
|
|
160
|
-
this.queue.push(["registerFB", [props]]);
|
|
161
|
-
this.queueTimeout();
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
triggerHj(name, doNotPushToQueue = false) {
|
|
165
|
-
if (typeof window.hj !== "undefined") {
|
|
166
|
-
if (this.queue.length > 0 && !doNotPushToQueue)
|
|
167
|
-
this.executeQueue();
|
|
168
|
-
window.hj("trigger", name);
|
|
169
|
-
return true;
|
|
170
|
-
}
|
|
171
|
-
if (doNotPushToQueue === false)
|
|
172
|
-
this.queue.push(["triggerHj", [name]]);
|
|
173
|
-
this.queueTimeout();
|
|
174
|
-
return false;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
export const EventsTracking = new _EventsTracking();
|