at-builder 1.0.11 → 1.1.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/README.md +104 -1
- package/bin/index.js +0 -13
- package/package.json +1 -1
- package/puppeteer.js +1 -1
- package/webpack.config.js +27 -5
- package/.babelrc +0 -11
- package/.env +0 -6
- package/.eslintrc +0 -525
- package/.globals/css/abstract/color.scss +0 -28
- package/.globals/css/abstract/mixin.scss +0 -76
- package/.globals/css/base/common.scss +0 -184
- package/.globals/css/components/spinner.scss +0 -95
- package/.globals/services/analyticsHelper/index.ts +0 -82
- package/.globals/services/analyticsHelper/types.ts +0 -31
- package/.globals/services/domHandler.js +0 -36
- package/.globals/services/logger.js +0 -55
- package/.globals/services/observer.js +0 -46
- package/.globals/services/prebuiltEventHandler.js +0 -24
- package/.globals/services/utility.js +0 -207
- package/.globals/services/xmlhttp.interceptor.ts +0 -112
- package/.plop/constants/index.js +0 -11
- package/.plop/generators/actions.js +0 -82
- package/.plop/generators/components.js +0 -8
- package/.plop/generators/prompts.js +0 -31
- package/.plop/index.js +0 -5
- package/.plop/templates/analytics.hbs +0 -23
- package/.plop/templates/build-template.hbs +0 -7
- package/.plop/templates/component.cb.hbs +0 -34
- package/.plop/templates/constants.hbs +0 -7
- package/.plop/templates/index.hbs +0 -10
- package/.plop/templates/observer.hbs +0 -18
- package/.plop/templates/style.hbs +0 -3
- package/.plop/utils/index.js +0 -10
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Method to tag shipping container parent
|
|
3
|
-
*/
|
|
4
|
-
export const tagServiceContainer = () => {
|
|
5
|
-
// To disable continue button in guided flow
|
|
6
|
-
const pickupServicePage = document.getElementById(
|
|
7
|
-
"nbsPickupServicePageShipmentServices"
|
|
8
|
-
);
|
|
9
|
-
if (
|
|
10
|
-
pickupServicePage &&
|
|
11
|
-
!pickupServicePage.parentElement.classList.contains("shipping-container")
|
|
12
|
-
) {
|
|
13
|
-
pickupServicePage.parentElement.classList.add("shipping-container");
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Method to tag body
|
|
19
|
-
*/
|
|
20
|
-
export const tagBodyContainer = () => {
|
|
21
|
-
const bodyContainer = document.querySelector("body");
|
|
22
|
-
if (bodyContainer && !bodyContainer.classList.contains("shipping-body-container")) {
|
|
23
|
-
bodyContainer.classList.add("body-shipping-container");
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Method to tag simple rate when active
|
|
30
|
-
*/
|
|
31
|
-
export const tagShippingConf = () => {
|
|
32
|
-
const isSimpleRate = document.getElementById("nbsConfirmationShipmentOverviewTrackingNumber");
|
|
33
|
-
if (isSimpleRate) {
|
|
34
|
-
if (!document.body.classList.contains("trans_conf_wrap")) {
|
|
35
|
-
document.body.classList.add("trans_conf_wrap");
|
|
36
|
-
}
|
|
37
|
-
} else {
|
|
38
|
-
if (document.body.classList.contains("trans_conf_wrap")) {
|
|
39
|
-
document.body.classList.remove("trans_conf_wrap");
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Method to tag simple rate when active
|
|
47
|
-
*/
|
|
48
|
-
export const tagSimpleRate = () => {
|
|
49
|
-
const isSimpleRate = document.getElementById("ewsSimpleRateCancelBannerText");
|
|
50
|
-
if (isSimpleRate) {
|
|
51
|
-
if (!document.body.classList.contains("simple-rate")) {
|
|
52
|
-
document.body.classList.add("simple-rate");
|
|
53
|
-
}
|
|
54
|
-
} else {
|
|
55
|
-
if (document.body.classList.contains("simple-rate")) {
|
|
56
|
-
document.body.classList.remove("simple-rate");
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return isSimpleRate;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
*
|
|
64
|
-
* @param {*} linkName to pass link name (evar61)
|
|
65
|
-
*/
|
|
66
|
-
export const triggerAnalytics = (linkName) => {
|
|
67
|
-
try {
|
|
68
|
-
//eslint-disable-next-line
|
|
69
|
-
utag.link({
|
|
70
|
-
link_name: linkName,
|
|
71
|
-
//eslint-disable-next-line
|
|
72
|
-
link_page_name: utag.data["new_page_name"],
|
|
73
|
-
});
|
|
74
|
-
} catch (e) { }
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Method to trigger prefferred when loaded on page
|
|
79
|
-
*/
|
|
80
|
-
export const triggerPreferred = () => {
|
|
81
|
-
if (!window.hasPreferredDispatched) {
|
|
82
|
-
const targetEle = document.querySelector(".ups-shipping_schedule_row #Preferred");
|
|
83
|
-
if (targetEle) {
|
|
84
|
-
window.hasPreferredDispatched = true;
|
|
85
|
-
//eslint-disable-next-line
|
|
86
|
-
utag.link({
|
|
87
|
-
"adobe_event_flag": 'preferred',
|
|
88
|
-
"link_name": "Service level preference available",
|
|
89
|
-
//eslint-disable-next-line
|
|
90
|
-
"link_page_name": utag.data["new_page_name"],
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
*
|
|
98
|
-
* @param {*} text
|
|
99
|
-
* @returns
|
|
100
|
-
*/
|
|
101
|
-
export const replaceWhiteSpace = (text) => {
|
|
102
|
-
if (text && typeof text === "string") {
|
|
103
|
-
return text.trim().replace(/[\W]+/g, "_").toLowerCase();
|
|
104
|
-
}
|
|
105
|
-
return "";
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Method to check if current user is a loggedIn user
|
|
110
|
-
* @returns true || false
|
|
111
|
-
*/
|
|
112
|
-
export const getLoginStatus = () => {
|
|
113
|
-
var header = document.getElementById("ups-navigation-container");
|
|
114
|
-
if (header) {
|
|
115
|
-
var loginLink = header.querySelector("li.ups-loginsignup a");
|
|
116
|
-
if (loginLink) {
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
return true;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Method to check if current user is a guest user
|
|
125
|
-
* @returns true || false
|
|
126
|
-
*/
|
|
127
|
-
export const isGuestUser = () => {
|
|
128
|
-
try {
|
|
129
|
-
return utag_data?.user_login_state === 'guest'
|
|
130
|
-
} catch (error) {
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Method to trim value safely (expected input as string)
|
|
137
|
-
* @param val value to be trimmed
|
|
138
|
-
*/
|
|
139
|
-
export const trim = (val = "") => {
|
|
140
|
-
if (val) {
|
|
141
|
-
return val.trim();
|
|
142
|
-
}
|
|
143
|
-
return '';
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
*
|
|
149
|
-
* @param type is type of event you want to create
|
|
150
|
-
* @returns new Event class instance
|
|
151
|
-
*/
|
|
152
|
-
export const createEvent = (type, config = {}) => {
|
|
153
|
-
var ua = window.navigator.userAgent;
|
|
154
|
-
var msie = ua.indexOf("MSIE ");
|
|
155
|
-
|
|
156
|
-
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
|
|
157
|
-
var ev = document.createEvent("Event");
|
|
158
|
-
ev.initEvent(type, false, true);
|
|
159
|
-
return ev;
|
|
160
|
-
} else {
|
|
161
|
-
return new Event(type, config);
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
export const debounce = (func, timeout = 300) => {
|
|
167
|
-
let timer;
|
|
168
|
-
return (...args) => {
|
|
169
|
-
clearTimeout(timer);
|
|
170
|
-
timer = setTimeout(() => { func.apply(this, args); }, timeout);
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
export const throttle = (func, delay) => {
|
|
176
|
-
// Previously called time of the function
|
|
177
|
-
let prev = 0; return (...args) => {
|
|
178
|
-
// Current called time of the function
|
|
179
|
-
let now = new Date().getTime();
|
|
180
|
-
// If difference is greater than delay call
|
|
181
|
-
// the function again.
|
|
182
|
-
if (now - prev > delay) {
|
|
183
|
-
prev = now;
|
|
184
|
-
// "..." is the spread operator here
|
|
185
|
-
// returning the function with the
|
|
186
|
-
// array of arguments
|
|
187
|
-
return func(...args);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
*
|
|
195
|
-
* @param {size of new random string} length
|
|
196
|
-
* @returns newly generated random string
|
|
197
|
-
*/
|
|
198
|
-
export const GenerateUniqueId = (length) => {
|
|
199
|
-
var result = '';
|
|
200
|
-
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
201
|
-
var charactersLength = characters.length;
|
|
202
|
-
for (var i = 0; i < length; i++) {
|
|
203
|
-
result += characters.charAt(Math.floor(Math.random() *
|
|
204
|
-
charactersLength));
|
|
205
|
-
}
|
|
206
|
-
return result;
|
|
207
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { GenerateUniqueId } from "./utility";
|
|
3
|
-
|
|
4
|
-
interface RegisterUrl {
|
|
5
|
-
[key: string]: Array<Function>
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
class XMLHandler {
|
|
9
|
-
registeredUrls: RegisterUrl = {};
|
|
10
|
-
constructor() {
|
|
11
|
-
let oldXHROpen = window.XMLHttpRequest.prototype.open;
|
|
12
|
-
let that = this;
|
|
13
|
-
window.XMLHttpRequest.prototype.open = function (method: string, url: string | URL | any) {
|
|
14
|
-
try {
|
|
15
|
-
if (that.registeredUrls[url] && that.registeredUrls[url].length) {
|
|
16
|
-
let callbacks = that.registeredUrls[url];
|
|
17
|
-
// console.log("Open: API Intercepted");
|
|
18
|
-
this.intercepted = callbacks;
|
|
19
|
-
this.addEventListener('load', function () {
|
|
20
|
-
try {
|
|
21
|
-
// console.log("RESPONSE TEXT:", this.responseText);
|
|
22
|
-
callbacks.forEach(callback => {
|
|
23
|
-
callback(JSON.parse(this.responseText));
|
|
24
|
-
});
|
|
25
|
-
} catch (e) {
|
|
26
|
-
console.error("error", e);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
} catch (error) {
|
|
31
|
-
console.error(error);
|
|
32
|
-
}
|
|
33
|
-
return oldXHROpen.apply(this, arguments);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
let oldXHRSend = window.XMLHttpRequest.prototype.send;
|
|
37
|
-
window.XMLHttpRequest.prototype.send = function (data: any) {
|
|
38
|
-
try {
|
|
39
|
-
let callbacks: any = this.intercepted;
|
|
40
|
-
if (this.intercepted) {
|
|
41
|
-
callbacks.forEach((callback: Function) => {
|
|
42
|
-
callback(JSON.parse(data), true);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
} catch (error) {
|
|
46
|
-
console.error(error);
|
|
47
|
-
}
|
|
48
|
-
return oldXHRSend.apply(this, arguments);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
registerUrl(url: string, callback: Function) {
|
|
53
|
-
if (!this.registeredUrls[url]) {
|
|
54
|
-
this.registeredUrls[url] = [];
|
|
55
|
-
}
|
|
56
|
-
this.registeredUrls[url].push(callback);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
unregisterUrl(url: string, callback: Function) {
|
|
60
|
-
this.registeredUrls[url] = this.registeredUrls[url].filter((_callback) => {
|
|
61
|
-
if (_callback === callback) {
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
static init() {
|
|
68
|
-
let xmlIns: null | XMLHandler = null;
|
|
69
|
-
const get = (): XMLHandler => {
|
|
70
|
-
if (xmlIns === null) {
|
|
71
|
-
xmlIns = new XMLHandler();
|
|
72
|
-
}
|
|
73
|
-
return xmlIns;
|
|
74
|
-
}
|
|
75
|
-
return {
|
|
76
|
-
get
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export class XMLHttpInterceptor {
|
|
82
|
-
private subscribers: any = {};
|
|
83
|
-
private url: string;
|
|
84
|
-
private xmlHandler: XMLHandler;
|
|
85
|
-
|
|
86
|
-
constructor(url: string) {
|
|
87
|
-
this.url = url;
|
|
88
|
-
this.xmlHandler = XMLHandler.init().get();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
subscribe(callback: Function, interceptRequestOnly: boolean) {
|
|
92
|
-
// let eventName = GenerateUniqueId(5);
|
|
93
|
-
const _callback = (_: any, isPayload: any) => {
|
|
94
|
-
if (interceptRequestOnly && isPayload) {
|
|
95
|
-
callback(_);
|
|
96
|
-
}
|
|
97
|
-
if (!interceptRequestOnly && !isPayload) {
|
|
98
|
-
callback(_);
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
// this.subscribers[eventName] = _callback
|
|
102
|
-
this.xmlHandler.registerUrl(this.url, _callback);
|
|
103
|
-
const _self = this;
|
|
104
|
-
// subscribed callbacks to be removed when they are no longer necessary.
|
|
105
|
-
return {
|
|
106
|
-
unsubscribe() {
|
|
107
|
-
_self.xmlHandler.unregisterUrl(_self.url, _callback);
|
|
108
|
-
// delete _self.subscribers[eventName];
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
package/.plop/constants/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
exports.path = require('path');
|
|
2
|
-
exports.PATTERN_CLASS_BASED = 'Class-Based Component';
|
|
3
|
-
exports.PATTERN_FUNCTIONAL = 'Functional Component';
|
|
4
|
-
exports.TEMPLATE_DIR = '.plop/templates';
|
|
5
|
-
exports.TEMPLATE_TYPE_SUFFIX_CLASS_BASED = 'cb';
|
|
6
|
-
exports.TEMPLATE_TYPE_SUFFIX_FUNCTIONAL = 'func';
|
|
7
|
-
exports.PROMPT_TYPE_LIST = 'list';
|
|
8
|
-
exports.PROMPT_TYPE_INPUT = 'input';
|
|
9
|
-
exports.ACTION_ADD = 'add';
|
|
10
|
-
exports.type_script = 'script';
|
|
11
|
-
exports.type_style = 'style';
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
const { template } = require("lodash");
|
|
2
|
-
const { ACTION_ADD, PATTERN_CLASS_BASED, PATTERN_FUNCTIONAL, TEMPLATE_DIR, TEMPLATE_TYPE_SUFFIX_CLASS_BASED, TEMPLATE_TYPE_SUFFIX_FUNCTIONAL } = require("../constants");
|
|
3
|
-
const { toCamelCase, toPascalCase } = require("../utils");
|
|
4
|
-
const path = require('path');
|
|
5
|
-
|
|
6
|
-
const fs = require('fs');
|
|
7
|
-
|
|
8
|
-
exports.actionHandler = (data) => {
|
|
9
|
-
let { executionPath } = process.env;
|
|
10
|
-
let actions = [];
|
|
11
|
-
let fileName = '';
|
|
12
|
-
let componentType = '';
|
|
13
|
-
let folderName = '';
|
|
14
|
-
let testPath = '';
|
|
15
|
-
let numberOfVariations;
|
|
16
|
-
let { trackName, testName, variationName, name } = data;
|
|
17
|
-
trackName = executionPath + "/Activities";
|
|
18
|
-
// trackName = path.join(fs.readFileSync(path.join(process.cwd(), 'sample.txt'), { flag: 'r' }).toString(), 'Activities');
|
|
19
|
-
console.log("trackName", trackName);
|
|
20
|
-
console.log("process.cwd()", process.cwd());
|
|
21
|
-
fileName = toCamelCase(name);
|
|
22
|
-
let i = 1;
|
|
23
|
-
let constantMappingFile = [];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
numberOfVariations = parseInt(variationName);
|
|
27
|
-
|
|
28
|
-
if (trackName && testName && variationName) {
|
|
29
|
-
let year = new Date().getFullYear();
|
|
30
|
-
// testPath = trackName + `/${year}/` + testName;
|
|
31
|
-
testPath = trackName + `/${testName}`;
|
|
32
|
-
constantMappingFile = assignconstants();
|
|
33
|
-
fileName = toPascalCase(name);
|
|
34
|
-
componentType = TEMPLATE_TYPE_SUFFIX_CLASS_BASED;
|
|
35
|
-
}
|
|
36
|
-
createActionObject(true);
|
|
37
|
-
do {
|
|
38
|
-
let variation = "Variation-" + i;
|
|
39
|
-
folderName = testPath + "/" + variation;
|
|
40
|
-
constantMappingFile = assignconstants(variation);
|
|
41
|
-
createActionObject(false);
|
|
42
|
-
i++;
|
|
43
|
-
}
|
|
44
|
-
while (i <= numberOfVariations);
|
|
45
|
-
|
|
46
|
-
function createActionObject(isGlobalFile) {
|
|
47
|
-
constantMappingFile.forEach(item => {
|
|
48
|
-
if ((!item.global && !isGlobalFile) || (item.global && isGlobalFile)) {
|
|
49
|
-
let actionObj = {
|
|
50
|
-
type: `${ACTION_ADD}`,
|
|
51
|
-
path: item.path,
|
|
52
|
-
data: {
|
|
53
|
-
componentName: toPascalCase(name),
|
|
54
|
-
variation: item.variation,
|
|
55
|
-
fileName: fileName,
|
|
56
|
-
windowFlagName: toPascalCase(testName)
|
|
57
|
-
},
|
|
58
|
-
skipIfExists: true,
|
|
59
|
-
abortOnFail: true
|
|
60
|
-
};
|
|
61
|
-
if (item['templateFile']) {
|
|
62
|
-
actionObj['templateFile'] = item['templateFile'];
|
|
63
|
-
} else {
|
|
64
|
-
actionObj['template'] = item['template'];
|
|
65
|
-
}
|
|
66
|
-
actions.push(actionObj);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function assignconstants(variation) {
|
|
72
|
-
return [{ 'global': false, 'path': `${folderName}/index.js`, 'templateFile': `${TEMPLATE_DIR}/index.hbs`, variation },
|
|
73
|
-
{ 'global': true, 'path': `${testPath}/Vanalytics/analytics.js`, 'templateFile': `${TEMPLATE_DIR}/analytics.hbs`, variation },
|
|
74
|
-
{ 'global': false, 'path': `${folderName}/constants/index.js`, 'templateFile': `${TEMPLATE_DIR}/constants.hbs`, variation },
|
|
75
|
-
{ 'global': false, 'path': `${folderName}/scripts/app.js`, 'templateFile': `${TEMPLATE_DIR}/component.cb.hbs`, variation },
|
|
76
|
-
{ 'global': false, 'path': `${folderName}/css/style.scss`, 'templateFile': `${TEMPLATE_DIR}/style.hbs`, variation }
|
|
77
|
-
];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return actions;
|
|
81
|
-
}
|
|
82
|
-
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const { PROMPT_TYPE_INPUT } = require("../constants");
|
|
2
|
-
|
|
3
|
-
function promptToChooseTrack(inquirer, answers = {}) {
|
|
4
|
-
|
|
5
|
-
const prompts = inquirer.prompt([
|
|
6
|
-
{
|
|
7
|
-
type: PROMPT_TYPE_INPUT,
|
|
8
|
-
name: 'testName',
|
|
9
|
-
message: "Enter the test name"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
type: PROMPT_TYPE_INPUT,
|
|
13
|
-
name: 'variationName',
|
|
14
|
-
message: "How many variations you want?"
|
|
15
|
-
}
|
|
16
|
-
]);
|
|
17
|
-
prompts.then((newAnswers) => {
|
|
18
|
-
Object.assign(newAnswers, answers);
|
|
19
|
-
});
|
|
20
|
-
return prompts;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const prompts = function (inquirer) {
|
|
25
|
-
const basePrompt = promptToChooseTrack(inquirer);
|
|
26
|
-
return basePrompt.then((answers) => {
|
|
27
|
-
return basePrompt;
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
module.exports = prompts;
|
package/.plop/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
(function () {
|
|
2
|
-
try {
|
|
3
|
-
if (!window.{{windowFlagName}}){
|
|
4
|
-
/**
|
|
5
|
-
* Mutation observer initialize
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
var observer = new MutationObserver(function (mutations) {
|
|
9
|
-
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
// observing now
|
|
13
|
-
observer.observe(document.querySelector("body"), {
|
|
14
|
-
attributes: true,
|
|
15
|
-
subtree: true,
|
|
16
|
-
childList: true
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
window.{{windowFlagName}} = true;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
catch(err){}
|
|
23
|
-
}());
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{{!-- import { Observer } from '../../../../.globals/services/observer';
|
|
2
|
-
import { logger } from '../../../../.globals/services/logger';
|
|
3
|
-
import { GetDOMElement } from '../../../../.globals/services/domHandler'; --}}
|
|
4
|
-
{{!-- import * as CONSTANTS from '../constants'; --}}
|
|
5
|
-
|
|
6
|
-
export class App {
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @param define constructor properties
|
|
10
|
-
*/
|
|
11
|
-
constructor(){
|
|
12
|
-
{{!-- this.domHandler = GetDOMElement;
|
|
13
|
-
this.loggerService = logger; --}}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Executes on load of the test , observer is initialised
|
|
18
|
-
*/
|
|
19
|
-
init = () => {
|
|
20
|
-
{{!-- this.observer = new Observer();
|
|
21
|
-
this.observer.setObserver(this.callback); --}}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Disconnet mutation observer , clear any window variable or perform cleanup activity
|
|
26
|
-
*/
|
|
27
|
-
destroy(){};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Mutation Observer Callback
|
|
31
|
-
*/
|
|
32
|
-
callback = () => {
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export class Observer {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.config = {
|
|
4
|
-
childlist: true,
|
|
5
|
-
subtree: true,
|
|
6
|
-
attributes: true
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
setObserver(cb) {
|
|
11
|
-
const mt = new MutationObserver(cb);
|
|
12
|
-
if (window.NodeList && !NodeList.prototype.forEach) {
|
|
13
|
-
NodeList.prototype.forEach = Array.prototype.forEach;
|
|
14
|
-
}
|
|
15
|
-
mt.observe(document.body, this.config);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
}
|
package/.plop/utils/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const _camelCase = require('lodash/camelCase');
|
|
2
|
-
const _startCase = require('lodash/startCase');
|
|
3
|
-
|
|
4
|
-
exports.toCamelCase = str => {
|
|
5
|
-
return _camelCase(str);
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
exports.toPascalCase = str => {
|
|
9
|
-
return _startCase(_camelCase(str)).replace(/ /g, '');
|
|
10
|
-
};
|