@letscooee/web-sdk 0.0.5 → 0.0.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 +22 -0
- package/README.md +2 -2
- package/dist/constants.js +7 -3
- package/dist/init/visibility-listener.js +2 -2
- package/dist/models/trigger/action/click-action-executor.js +14 -6
- package/dist/models/trigger/blocks/border.js +2 -0
- package/dist/models/trigger/elements/base-element.js +2 -0
- package/dist/models/trigger/elements/text-element.js +2 -0
- package/dist/models/trigger/embedded-trigger.js +26 -0
- package/dist/models/trigger/inapp/container.js +81 -1
- package/dist/models/trigger/trigger-data.js +2 -2
- package/dist/models/trigger/trigger-helper.js +52 -0
- package/dist/renderer/block-processor.js +11 -14
- package/dist/renderer/container-renderer.js +7 -5
- package/dist/renderer/iFrame-renderer.js +2 -5
- package/dist/renderer/image-renderer.js +2 -2
- package/dist/renderer/in-app-renderer.js +14 -6
- package/dist/renderer/index.js +9 -5
- package/dist/renderer/renderer.js +22 -10
- package/dist/renderer/root-container-renderer.js +19 -10
- package/dist/renderer/text-renderer.js +2 -1
- package/dist/sdk-preview.min.js +1 -1
- package/dist/sdk.min.js +1 -1
- package/dist/services/http-api.service.js +28 -8
- package/dist/services/user-auth.service.js +7 -7
- package/dist/session/new-session-executor.js +2 -2
- package/dist/session/session-manager.js +1 -0
- package/dist/utils/local-storage-helper.js +22 -0
- package/dist/utils/log.js +14 -10
- package/package.json +7 -6
- package/dist/models/trigger/blocks/colour.js +0 -1
- package/dist/models/trigger/blocks/flex.js +0 -1
- package/dist/models/trigger/blocks/position.js +0 -1
- package/dist/models/trigger/elements/base-text-element.js +0 -1
- package/dist/models/trigger/elements/group-element.js +0 -1
- package/dist/renderer/block-renderer.js +0 -44
- package/dist/renderer/group-renderer.js +0 -44
|
@@ -67,6 +67,28 @@ var LocalStorageHelper = /** @class */ (function () {
|
|
|
67
67
|
LocalStorageHelper.setBoolean = function (key, value) {
|
|
68
68
|
LocalStorageHelper.setString(key, JSON.stringify(value));
|
|
69
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* Get value from local storage.
|
|
72
|
+
*
|
|
73
|
+
* @param {string} key key provided for the stored value.
|
|
74
|
+
* @return {any} value stored.
|
|
75
|
+
*/
|
|
76
|
+
LocalStorageHelper.getObject = function (key) {
|
|
77
|
+
try {
|
|
78
|
+
return JSON.parse(LocalStorageHelper.getString(key, ''));
|
|
79
|
+
}
|
|
80
|
+
catch (ignored) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Set value in local storage as json string.
|
|
86
|
+
* @param {string} key key provided for the storing value.
|
|
87
|
+
* @param {any} value value stored.
|
|
88
|
+
*/
|
|
89
|
+
LocalStorageHelper.setObject = function (key, value) {
|
|
90
|
+
LocalStorageHelper.setString(key, JSON.stringify(value));
|
|
91
|
+
};
|
|
70
92
|
/**
|
|
71
93
|
* Remove the specified key from storage.
|
|
72
94
|
*
|
package/dist/utils/log.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
2
|
-
for (var i = 0,
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
+
if (ar || !(i in from)) {
|
|
4
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
+
ar[i] = from[i];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
5
9
|
};
|
|
6
10
|
import { Constants } from '../constants';
|
|
7
11
|
/**
|
|
@@ -18,36 +22,36 @@ var Log = /** @class */ (function () {
|
|
|
18
22
|
*
|
|
19
23
|
* @param {any} messages
|
|
20
24
|
*/
|
|
21
|
-
Log.
|
|
25
|
+
Log.log = function () {
|
|
22
26
|
var messages = [];
|
|
23
27
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
24
28
|
messages[_i] = arguments[_i];
|
|
25
29
|
}
|
|
26
|
-
console.log.apply(console, __spreadArray([Constants.LOG_PREFIX, ':'], messages));
|
|
30
|
+
console.log.apply(console, __spreadArray([Constants.LOG_PREFIX, ':'], messages, false));
|
|
27
31
|
};
|
|
28
32
|
/**
|
|
29
33
|
* Log error messages.
|
|
30
34
|
*
|
|
31
35
|
* @param {any} messages
|
|
32
36
|
*/
|
|
33
|
-
Log.
|
|
37
|
+
Log.error = function () {
|
|
34
38
|
var messages = [];
|
|
35
39
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
36
40
|
messages[_i] = arguments[_i];
|
|
37
41
|
}
|
|
38
|
-
console.error.apply(console, __spreadArray([Constants.LOG_PREFIX, ':'], messages));
|
|
42
|
+
console.error.apply(console, __spreadArray([Constants.LOG_PREFIX, ':'], messages, false));
|
|
39
43
|
};
|
|
40
44
|
/**
|
|
41
45
|
* Log warning messages.
|
|
42
46
|
*
|
|
43
47
|
* @param {any} messages
|
|
44
48
|
*/
|
|
45
|
-
Log.
|
|
49
|
+
Log.warning = function () {
|
|
46
50
|
var messages = [];
|
|
47
51
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
48
52
|
messages[_i] = arguments[_i];
|
|
49
53
|
}
|
|
50
|
-
console.warn.apply(console, __spreadArray([Constants.LOG_PREFIX, ':'], messages));
|
|
54
|
+
console.warn.apply(console, __spreadArray([Constants.LOG_PREFIX, ':'], messages, false));
|
|
51
55
|
};
|
|
52
56
|
return Log;
|
|
53
57
|
}());
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@letscooee/web-sdk",
|
|
3
3
|
"description": "Hyperpersonalised Mobile/Web App Re-Engagement via Machine Learning",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.9",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "eslint 'src/**'",
|
|
7
7
|
"prepare": "npm run build",
|
|
8
8
|
"build": "tsc",
|
|
9
9
|
"build:production": "webpack && webpack --config ./webpack-preview.config.js",
|
|
10
|
-
"serve
|
|
10
|
+
"serve": "webpack serve",
|
|
11
|
+
"serve:preview": "webpack serve --config ./webpack-preview.config.js",
|
|
11
12
|
"preversion": "git add CHANGELOG.md src/constants.ts",
|
|
12
13
|
"version": "npm run build:production",
|
|
13
14
|
"postversion": "git push && git push --tags"
|
|
@@ -31,12 +32,12 @@
|
|
|
31
32
|
"homepage": "https://github.com/letscooee/cooee-web-sdk#readme",
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@types/ua-parser-js": "^0.7.36",
|
|
34
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
35
|
-
"@typescript-eslint/parser": "^
|
|
36
|
-
"eslint": "^7.
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
|
36
|
+
"@typescript-eslint/parser": "^5.10.0",
|
|
37
|
+
"eslint": "^8.7.0",
|
|
37
38
|
"eslint-config-google": "^0.14.0",
|
|
38
39
|
"ts-loader": "^9.2.4",
|
|
39
|
-
"typescript": "^4.
|
|
40
|
+
"typescript": "^4.4.4",
|
|
40
41
|
"webpack": "^5.47.1",
|
|
41
42
|
"webpack-cli": "^4.7.2",
|
|
42
43
|
"webpack-dev-server": "^4.1.1"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
|
-
import { BlockProcessor } from './block-processor';
|
|
17
|
-
/**
|
|
18
|
-
* Base class for rendering any block from in-app.
|
|
19
|
-
*
|
|
20
|
-
* @author Abhishek Taparia
|
|
21
|
-
* @version 0.0.5
|
|
22
|
-
*/
|
|
23
|
-
var BlockRenderer = /** @class */ (function (_super) {
|
|
24
|
-
__extends(BlockRenderer, _super);
|
|
25
|
-
/**
|
|
26
|
-
* Public constructor
|
|
27
|
-
*/
|
|
28
|
-
function BlockRenderer() {
|
|
29
|
-
return _super.call(this) || this;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Process all the common block in in-app.
|
|
33
|
-
* @param {HTMLElement} element element to be processed
|
|
34
|
-
* @param {BaseElement} baseElement style and attributes data of the element
|
|
35
|
-
*/
|
|
36
|
-
BlockRenderer.prototype.commonRenderingFunction = function (element, baseElement) {
|
|
37
|
-
this.processCommonBlocks(element, baseElement);
|
|
38
|
-
if (baseElement.type) {
|
|
39
|
-
element.classList.add(baseElement.type);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
return BlockRenderer;
|
|
43
|
-
}(BlockProcessor));
|
|
44
|
-
export { BlockRenderer };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
|
-
import { BlockRenderer } from './block-renderer';
|
|
17
|
-
/**
|
|
18
|
-
* Renders group element present in in-app layer block.
|
|
19
|
-
*
|
|
20
|
-
* @author Abhishek Taparia
|
|
21
|
-
* @version 0.0.5
|
|
22
|
-
*/
|
|
23
|
-
var GroupRenderer = /** @class */ (function (_super) {
|
|
24
|
-
__extends(GroupRenderer, _super);
|
|
25
|
-
function GroupRenderer() {
|
|
26
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Render group element from layers list in {@link InAppTrigger} block.
|
|
30
|
-
* @param {HTMLElement} parent
|
|
31
|
-
* @param {GroupElement} elementData style and attributes data of the group element
|
|
32
|
-
* @return {HTMLElement} rendered group element
|
|
33
|
-
*/
|
|
34
|
-
GroupRenderer.prototype.render = function (parent, elementData) {
|
|
35
|
-
var newElement = this.renderer.createElement('div');
|
|
36
|
-
// By default the parents will be relative
|
|
37
|
-
this.renderer.setStyle(newElement, 'position', 'relative');
|
|
38
|
-
this.commonRenderingFunction(newElement, elementData);
|
|
39
|
-
this.renderer.appendChild(parent, newElement);
|
|
40
|
-
return newElement;
|
|
41
|
-
};
|
|
42
|
-
return GroupRenderer;
|
|
43
|
-
}(BlockRenderer));
|
|
44
|
-
export { GroupRenderer };
|