@vroskus/library-crisp 1.0.3 → 1.0.5
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/package.json +6 -3
- package/.eslintrc +0 -77
- package/src/index.ts +0 -68
- package/src/types.ts +0 -3
- package/tsconfig.json +0 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vroskus/library-crisp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Crisp",
|
|
5
5
|
"author": "Vilius Roškus <vilius@regattas.eu>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,8 +9,11 @@
|
|
|
9
9
|
"url": "git+https://github.com/vroskus/library-crisp.git"
|
|
10
10
|
},
|
|
11
11
|
"main": "dist/index.js",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/"
|
|
15
|
+
],
|
|
12
16
|
"scripts": {
|
|
13
|
-
"postinstall": "npm run build",
|
|
14
17
|
"build": "tsc",
|
|
15
18
|
"test": "npm run test:eslint && npm run test:e2e",
|
|
16
19
|
"test:eslint": "eslint src --fix",
|
|
@@ -29,6 +32,6 @@
|
|
|
29
32
|
"eslint-plugin-react": "7.32.2",
|
|
30
33
|
"eslint-plugin-sort": "2.7.1",
|
|
31
34
|
"npm-check": "6.0.1",
|
|
32
|
-
"typescript": "
|
|
35
|
+
"typescript": "5.0.4"
|
|
33
36
|
}
|
|
34
37
|
}
|
package/.eslintrc
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"root": true,
|
|
3
|
-
"parser": "@typescript-eslint/parser",
|
|
4
|
-
"parserOptions": {
|
|
5
|
-
"requireConfigFile": false,
|
|
6
|
-
"project": ["tsconfig.json"]
|
|
7
|
-
},
|
|
8
|
-
"extends": [
|
|
9
|
-
"airbnb-base",
|
|
10
|
-
"airbnb-typescript",
|
|
11
|
-
"plugin:import/recommended",
|
|
12
|
-
"plugin:@typescript-eslint/eslint-recommended",
|
|
13
|
-
"plugin:@typescript-eslint/recommended",
|
|
14
|
-
"plugin:sort/recommended"
|
|
15
|
-
],
|
|
16
|
-
"plugins": [
|
|
17
|
-
"@typescript-eslint",
|
|
18
|
-
"import",
|
|
19
|
-
"import-newlines",
|
|
20
|
-
"react",
|
|
21
|
-
"sort"
|
|
22
|
-
],
|
|
23
|
-
"rules": {
|
|
24
|
-
"complexity": ["error", 5],
|
|
25
|
-
"@typescript-eslint/ban-ts-comment": [1],
|
|
26
|
-
"@typescript-eslint/no-unused-vars": [2],
|
|
27
|
-
"curly": ["error", "all"],
|
|
28
|
-
"import/no-cycle": [0],
|
|
29
|
-
"no-await-in-loop": 0,
|
|
30
|
-
"no-console": "error",
|
|
31
|
-
"no-duplicate-imports": [0],
|
|
32
|
-
"no-loss-of-precision": [0],
|
|
33
|
-
"no-restricted-syntax": 0,
|
|
34
|
-
"no-unreachable-loop": [0],
|
|
35
|
-
"no-useless-backreference": [0],
|
|
36
|
-
"no-unused-private-class-members": [2],
|
|
37
|
-
"padding-line-between-statements": ["error", {
|
|
38
|
-
"blankLine": "always",
|
|
39
|
-
"prev": ["const", "let"],
|
|
40
|
-
"next": "*"
|
|
41
|
-
}, {
|
|
42
|
-
"blankLine": "any",
|
|
43
|
-
"prev": ["const", "let"],
|
|
44
|
-
"next": ["const", "let"]
|
|
45
|
-
}, {
|
|
46
|
-
"blankLine": "always",
|
|
47
|
-
"prev": ["if", "function", "for"],
|
|
48
|
-
"next": "*"
|
|
49
|
-
}, {
|
|
50
|
-
"blankLine": "always",
|
|
51
|
-
"prev": "*",
|
|
52
|
-
"next": "return"
|
|
53
|
-
}],
|
|
54
|
-
"object-curly-newline": ["error", {
|
|
55
|
-
"ObjectExpression": "always",
|
|
56
|
-
"ObjectPattern": "always",
|
|
57
|
-
"ImportDeclaration": "always",
|
|
58
|
-
"ExportDeclaration": "always"
|
|
59
|
-
}],
|
|
60
|
-
"function-call-argument-newline": ["error", "always"],
|
|
61
|
-
"object-property-newline": ["error", {
|
|
62
|
-
"allowMultiplePropertiesPerLine": false
|
|
63
|
-
}],
|
|
64
|
-
"import-newlines/enforce": ["error", {
|
|
65
|
-
"items": 1,
|
|
66
|
-
"forceSingleLine": false
|
|
67
|
-
}],
|
|
68
|
-
"sort/imports": [0],
|
|
69
|
-
"sort/exports": [0]
|
|
70
|
-
},
|
|
71
|
-
"env": {
|
|
72
|
-
"browser": true,
|
|
73
|
-
"node": true,
|
|
74
|
-
"jest": true,
|
|
75
|
-
"es6": true
|
|
76
|
-
}
|
|
77
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// Types
|
|
2
|
-
import type {
|
|
3
|
-
$Config as Config,
|
|
4
|
-
} from './types';
|
|
5
|
-
|
|
6
|
-
declare global {
|
|
7
|
-
interface Window {
|
|
8
|
-
$crisp: Array<Array<unknown>>;
|
|
9
|
-
CRISP_WEBSITE_ID: string | void;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
type $User = {
|
|
14
|
-
Name: string;
|
|
15
|
-
Email: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
type $Attr = {
|
|
19
|
-
key: string;
|
|
20
|
-
value: string;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export type $Config = Config;
|
|
24
|
-
|
|
25
|
-
class CrispService<C extends Config> {
|
|
26
|
-
websiteId: string;
|
|
27
|
-
|
|
28
|
-
constructor({
|
|
29
|
-
websiteId,
|
|
30
|
-
}: C) {
|
|
31
|
-
this.websiteId = websiteId || '';
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
init(): void {
|
|
35
|
-
if (window && this.websiteId !== '') {
|
|
36
|
-
window.$crisp = [];
|
|
37
|
-
window.CRISP_WEBSITE_ID = this.websiteId;
|
|
38
|
-
|
|
39
|
-
const d = document;
|
|
40
|
-
const s = d.createElement('script');
|
|
41
|
-
|
|
42
|
-
s.src = 'https://client.crisp.chat/l.js';
|
|
43
|
-
s.async = true;
|
|
44
|
-
d.getElementsByTagName('head')[0].appendChild(s);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
setUser({
|
|
49
|
-
Email,
|
|
50
|
-
Name,
|
|
51
|
-
}: $User): void {
|
|
52
|
-
if (window && this.websiteId !== '') {
|
|
53
|
-
window.$crisp.push(['set', 'user:nickname', Name]);
|
|
54
|
-
window.$crisp.push(['set', 'user:email', Email]);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
setAttr({
|
|
59
|
-
key,
|
|
60
|
-
value,
|
|
61
|
-
}: $Attr): void {
|
|
62
|
-
if (window && this.websiteId !== '') {
|
|
63
|
-
window.$crisp.push(['set', 'session:data', [[[key, value]]]]);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export default CrispService;
|
package/src/types.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"outDir": "./dist/",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"esModuleInterop": true,
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"noImplicitAny": false,
|
|
8
|
-
"removeComments": true,
|
|
9
|
-
"noLib": false,
|
|
10
|
-
"emitDecoratorMetadata": true,
|
|
11
|
-
"experimentalDecorators": true,
|
|
12
|
-
"target": "es6",
|
|
13
|
-
"sourceMap": true,
|
|
14
|
-
"lib": [
|
|
15
|
-
"dom",
|
|
16
|
-
"es6"
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
"exclude": [
|
|
20
|
-
"node_modules",
|
|
21
|
-
"./dist/**/*"
|
|
22
|
-
],
|
|
23
|
-
"include": [
|
|
24
|
-
"./src"
|
|
25
|
-
]
|
|
26
|
-
}
|