@commversion/libs 0.3.0 → 0.4.1-pre-0
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 +2 -0
- package/dist/lc-geoblocking.js +1 -0
- package/dist/lc-utm-params.js +1 -0
- package/dist/schedule-event.js +1 -6
- package/package.json +7 -5
- package/_templates/generator/help/index.ejs.t +0 -5
- package/_templates/generator/new/hello.ejs.t +0 -18
- package/_templates/generator/with-prompt/hello.ejs.t +0 -18
- package/_templates/generator/with-prompt/prompt.js +0 -14
- package/_templates/scripts/new/dev-build-scripts.ejs.t +0 -7
- package/_templates/scripts/new/readme.ejs.t +0 -14
- package/_templates/scripts/new/root-readme.ejs.t +0 -6
- package/_templates/scripts/new/src_index_html.ejs.t +0 -60
- package/_templates/scripts/new/src_main.ejs.t +0 -8
- package/_templates/scripts/new/src_script.ejs.t +0 -9
- package/_templates/scripts/new/tests_script.ejs.t +0 -9
- package/_templates/scripts/new/vite-config.ejs.t +0 -20
- package/scripts/lc-exit-intent/README.md +0 -21
- package/scripts/lc-exit-intent/src/exit-intent.js +0 -23
- package/scripts/lc-exit-intent/src/index.html +0 -52
- package/scripts/lc-exit-intent/src/main.js +0 -3
- package/scripts/lc-exit-intent/tests/exit-intent.test.js +0 -52
- package/scripts/lc-exit-intent/vite.config.js +0 -17
- package/scripts/lc-ga-tags/README.md +0 -19
- package/scripts/lc-ga-tags/src/append-ga-session.js +0 -11
- package/scripts/lc-ga-tags/src/index.html +0 -66
- package/scripts/lc-ga-tags/src/main.js +0 -3
- package/scripts/lc-ga-tags/tests/append-ga-session.test.js +0 -33
- package/scripts/lc-ga-tags/vite.config.js +0 -17
- package/scripts/lc-input-error/README.md +0 -22
- package/scripts/lc-input-error/src/index.html +0 -74
- package/scripts/lc-input-error/src/input-error.js +0 -13
- package/scripts/lc-input-error/src/main.js +0 -3
- package/scripts/lc-input-error/tests/input-error.test.js +0 -27
- package/scripts/lc-input-error/vite.config.js +0 -17
- package/scripts/lc-show-hide/README.md +0 -45
- package/scripts/lc-show-hide/src/index.html +0 -58
- package/scripts/lc-show-hide/src/main.js +0 -5
- package/scripts/lc-show-hide/src/predicate-functions.js +0 -11
- package/scripts/lc-show-hide/src/show-hide.js +0 -49
- package/scripts/lc-show-hide/tests/predicate-functions.test.js +0 -31
- package/scripts/lc-show-hide/vite.config.js +0 -17
- package/scripts/schedule-event/README.md +0 -58
- package/scripts/schedule-event/src/index.html +0 -14
- package/scripts/schedule-event/src/main.js +0 -13
- package/scripts/schedule-event/src/parse-schedule.js +0 -16
- package/scripts/schedule-event/src/schedule-event.js +0 -18
- package/scripts/schedule-event/tests/parse-schedule.test.js +0 -51
- package/scripts/schedule-event/tests/schedule-event.test.js +0 -23
- package/scripts/schedule-event/vite.config.js +0 -17
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { expect } from "@esm-bundle/chai";
|
|
2
|
-
import { fake } from "sinon";
|
|
3
|
-
import parseSchedule from "../src/parse-schedule.js";
|
|
4
|
-
|
|
5
|
-
it("should call callback when is active", () => {
|
|
6
|
-
const callback = fake();
|
|
7
|
-
const wedMorning = [3, 10, 0];
|
|
8
|
-
|
|
9
|
-
const schedule = [{ from: [3, 10, 0], to: [3, 18, 0], callback }];
|
|
10
|
-
|
|
11
|
-
expect(parseSchedule(schedule, wedMorning)).to.equal(callback);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it("should not call callback when is not active", () => {
|
|
15
|
-
const callback = fake();
|
|
16
|
-
const wedMorning = [3, 10, 0];
|
|
17
|
-
|
|
18
|
-
const schedule = [{ from: [4, 10, 0], to: [4, 18, 0], callback }];
|
|
19
|
-
|
|
20
|
-
expect(parseSchedule(schedule, wedMorning)).to.not.equal(callback);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("should support multiple cases", () => {
|
|
24
|
-
const callback = fake();
|
|
25
|
-
const callbackB = fake();
|
|
26
|
-
const wedMorning = [3, 10, 0];
|
|
27
|
-
|
|
28
|
-
const schedule = [
|
|
29
|
-
{ from: [0, 10, 0], to: [0, 18, 0], callback },
|
|
30
|
-
{ from: [1, 10, 0], to: [1, 18, 0], callback },
|
|
31
|
-
{ from: [2, 10, 0], to: [2, 18, 0], callback },
|
|
32
|
-
{ from: [3, 10, 0], to: [3, 18, 0], callback: callbackB },
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
expect(parseSchedule(schedule, wedMorning)).to.equal(callbackB);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it("in case of overlapping ranges, the first one is executed", () => {
|
|
39
|
-
const callback = fake();
|
|
40
|
-
const callbackB = fake();
|
|
41
|
-
const wedMorning = [3, 11, 0];
|
|
42
|
-
|
|
43
|
-
const schedule = [
|
|
44
|
-
{ from: [3, 10, 30], to: [3, 18, 0], callback: callbackB },
|
|
45
|
-
{ from: [3, 10, 30], to: [3, 18, 0], callback },
|
|
46
|
-
{ from: [3, 10, 30], to: [3, 18, 0], callback },
|
|
47
|
-
{ from: [3, 10, 30], to: [3, 18, 0], callback },
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
expect(parseSchedule(schedule, wedMorning)).to.equal(callbackB);
|
|
51
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { expect } from "@esm-bundle/chai";
|
|
2
|
-
import { fake } from "sinon";
|
|
3
|
-
import scheduleEvent from "../src/schedule-event.js";
|
|
4
|
-
|
|
5
|
-
it("should call the callback", async () => {
|
|
6
|
-
const callback = fake();
|
|
7
|
-
|
|
8
|
-
const schedule = [{ from: [0, 0, 0], to: [6, 23, 59], callback }];
|
|
9
|
-
|
|
10
|
-
await scheduleEvent(schedule, "Asia/Kolkata");
|
|
11
|
-
|
|
12
|
-
expect(callback.called).to.be.true;
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("should not call the callback", async () => {
|
|
16
|
-
const callback = fake();
|
|
17
|
-
|
|
18
|
-
const schedule = [{ from: [0, 0, 0], to: [0, 0, 0], callback }];
|
|
19
|
-
|
|
20
|
-
await scheduleEvent(schedule, "Asia/Kolkata");
|
|
21
|
-
|
|
22
|
-
expect(callback.called).not.to.be.true;
|
|
23
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
|
|
3
|
-
const config = {
|
|
4
|
-
build: {
|
|
5
|
-
outDir: path.resolve("dist"),
|
|
6
|
-
emptyOutDir: false,
|
|
7
|
-
target: "es2015",
|
|
8
|
-
lib: {
|
|
9
|
-
entry: path.resolve(__dirname, "src/main.js"),
|
|
10
|
-
name: "scheduleEvent",
|
|
11
|
-
fileName: () => `schedule-event.js`,
|
|
12
|
-
formats: ["iife"],
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default config;
|