bibot 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/bibot.js +171 -0
- package/dist/components/bibot.js.map +1 -0
- package/dist/config/appStateEnums.js +5 -10
- package/dist/config/endpointEnums.js +22 -27
- package/dist/config/index.js +5 -38
- package/dist/config/statusCode.js +44 -49
- package/dist/context/AppContext.js +56 -73
- package/dist/context/index.js +3 -16
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.js +4 -38
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/mobileView.js +18 -33
- package/dist/hooks/usePluginFactory.js +77 -60
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -9
- package/dist/index.js.map +1 -1
- package/dist/reducers/appReducer.js +22 -24
- package/dist/reducers/index.js +3 -16
- package/dist/services/index.js +3 -16
- package/dist/services/plugin-api.js +182 -179
- package/dist/types/coreInterfaces.d.ts +10 -1
- package/dist/types/coreInterfaces.js +2 -5
- package/dist/types/index.js +3 -16
- package/dist/utils/index.js +3 -27
- package/dist/utils/sessionManager.js +12 -16
- package/dist/utils/trimWhitespace.js +11 -15
- package/package.json +54 -50
- package/.babelrc +0 -7
- package/.vscode/settings.json +0 -5
- package/dist/bibot.js +0 -173
- package/dist/bibot.js.map +0 -1
- package/dist/hooks/useBiBotChatBot.d.ts +0 -29
- package/dist/hooks/useBiBotChatBot.js +0 -206
- package/dist/hooks/useBiBotChatBot.js.map +0 -1
- package/dist/index.css +0 -36
- package/dist/styles/RegisterPageStyle.css +0 -63
- package/dist/styles/adminPortal.css +0 -26
- package/dist/styles/appConfig.css +0 -90
- package/dist/styles/buttonStyle.css +0 -27
- package/dist/styles/chatStyle.css +0 -140
- package/dist/styles/index.css +0 -82
- package/dist/styles/predefinedStyle.css +0 -35
- package/dist/styles/themeStyle.css +0 -42
- package/dist/styles/training.css +0 -86
- package/example/README.md +0 -46
- package/example/package-lock.json +0 -18173
- package/example/package.json +0 -47
- package/example/public/favicon.ico +0 -0
- package/example/public/index.html +0 -43
- package/example/public/logo192.png +0 -0
- package/example/public/logo512.png +0 -0
- package/example/public/manifest.json +0 -25
- package/example/public/robots.txt +0 -3
- package/example/src/App.css +0 -38
- package/example/src/App.test.tsx +0 -9
- package/example/src/App.tsx +0 -28
- package/example/src/index.css +0 -13
- package/example/src/index.tsx +0 -13
- package/example/src/logo.svg +0 -1
- package/example/src/react-app-env.d.ts +0 -1
- package/example/tsconfig.json +0 -26
- package/src/bibot.tsx +0 -111
- package/src/config/appStateEnums.ts +0 -3
- package/src/config/endpointEnums.ts +0 -28
- package/src/config/index.ts +0 -5
- package/src/config/statusCode.ts +0 -49
- package/src/context/AppContext.tsx +0 -66
- package/src/context/index.ts +0 -3
- package/src/hooks/index.ts +0 -5
- package/src/hooks/mobileView.tsx +0 -17
- package/src/hooks/useBiBotChatBot.tsx +0 -107
- package/src/hooks/usePluginFactory.tsx +0 -38
- package/src/index.css +0 -36
- package/src/index.tsx +0 -3
- package/src/reducers/appReducer.ts +0 -16
- package/src/reducers/index.ts +0 -4
- package/src/services/index.ts +0 -2
- package/src/services/plugin-api.tsx +0 -120
- package/src/styles/RegisterPageStyle.css +0 -63
- package/src/styles/adminPortal.css +0 -26
- package/src/styles/appConfig.css +0 -90
- package/src/styles/buttonStyle.css +0 -27
- package/src/styles/chatStyle.css +0 -140
- package/src/styles/index.css +0 -82
- package/src/styles/predefinedStyle.css +0 -35
- package/src/styles/themeStyle.css +0 -42
- package/src/styles/training.css +0 -86
- package/src/types/coreInterfaces.ts +0 -69
- package/src/types/index.ts +0 -4
- package/src/utils/index.ts +0 -2
- package/src/utils/sessionManager.tsx +0 -15
- package/src/utils/trimWhitespace.ts +0 -11
- package/tsconfig.json +0 -25
- package/webpack.config.js +0 -19
- /package/dist/{bibot.d.ts → components/bibot.d.ts} +0 -0
@@ -1,185 +1,188 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
function
|
14
|
-
|
15
|
-
function
|
16
|
-
function
|
17
|
-
function
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
function
|
22
|
-
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
2
|
+
__assign = Object.assign || function(t) {
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
+
s = arguments[i];
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
+
t[p] = s[p];
|
7
|
+
}
|
8
|
+
return t;
|
9
|
+
};
|
10
|
+
return __assign.apply(this, arguments);
|
11
|
+
};
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
19
|
+
});
|
20
|
+
};
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
25
|
+
function step(op) {
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
30
|
+
switch (op[0]) {
|
31
|
+
case 0: case 1: t = op; break;
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
35
|
+
default:
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
40
|
+
if (t[2]) _.ops.pop();
|
41
|
+
_.trys.pop(); continue;
|
42
|
+
}
|
43
|
+
op = body.call(thisArg, _);
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
46
|
+
}
|
47
|
+
};
|
48
|
+
function askTimedOutBiBot(data) {
|
49
|
+
return __awaiter(this, void 0, void 0, function () {
|
50
|
+
return __generator(this, function (_a) {
|
51
|
+
try {
|
52
|
+
return [2 /*return*/, 'Hello'
|
53
|
+
// const path=`${domain.bibot}${resources.timedOutLocalQ}`
|
54
|
+
// const response=await pluginAxiosInstance.post<any>(path, data)
|
55
|
+
// console.log(response)
|
56
|
+
// return response.data.message
|
57
|
+
];
|
58
|
+
// const path=`${domain.bibot}${resources.timedOutLocalQ}`
|
59
|
+
// const response=await pluginAxiosInstance.post<any>(path, data)
|
60
|
+
// console.log(response)
|
61
|
+
// return response.data.message
|
62
|
+
}
|
63
|
+
catch (error) {
|
64
|
+
console.log(error.message);
|
65
|
+
return [2 /*return*/, error.message];
|
66
|
+
}
|
67
|
+
return [2 /*return*/];
|
68
|
+
});
|
69
|
+
});
|
23
70
|
}
|
24
|
-
function
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
71
|
+
function askBiBot(data) {
|
72
|
+
return __awaiter(this, void 0, void 0, function () {
|
73
|
+
var error1_1, error2_1, error3_1;
|
74
|
+
return __generator(this, function (_a) {
|
75
|
+
switch (_a.label) {
|
76
|
+
case 0:
|
77
|
+
_a.trys.push([0, 1, , 14]);
|
78
|
+
// const path=`${domain.inference}${resources.q}`
|
79
|
+
// const response=await pluginAxiosInstance.post<any>(path, data)
|
80
|
+
// console.log(response)
|
81
|
+
// return response.data.message
|
82
|
+
return [2 /*return*/, 'Hello'];
|
83
|
+
case 1:
|
84
|
+
error1_1 = _a.sent();
|
85
|
+
console.log(error1_1.message);
|
86
|
+
if (!(error1_1.code === 'ECONNABORTED' || error1_1.message.includes('Endpoint request timed out'))) return [3 /*break*/, 12];
|
87
|
+
_a.label = 2;
|
88
|
+
case 2:
|
89
|
+
_a.trys.push([2, 4, , 11]);
|
90
|
+
return [4 /*yield*/, askTimedOutBiBot(__assign(__assign({}, data), { tries: 2 }))];
|
91
|
+
case 3: return [2 /*return*/, _a.sent()];
|
92
|
+
case 4:
|
93
|
+
error2_1 = _a.sent();
|
94
|
+
if (!(error2_1.code === 'ECONNABORTED' || error2_1.message.includes('Endpoint request timed out'))) return [3 /*break*/, 9];
|
95
|
+
_a.label = 5;
|
96
|
+
case 5:
|
97
|
+
_a.trys.push([5, 7, , 8]);
|
98
|
+
return [4 /*yield*/, askTimedOutBiBot(__assign(__assign({}, data), { tries: 3 }))];
|
99
|
+
case 6: return [2 /*return*/, _a.sent()];
|
100
|
+
case 7:
|
101
|
+
error3_1 = _a.sent();
|
102
|
+
return [2 /*return*/, error3_1.message];
|
103
|
+
case 8: return [3 /*break*/, 10];
|
104
|
+
case 9: return [2 /*return*/, error2_1.message];
|
105
|
+
case 10: return [3 /*break*/, 11];
|
106
|
+
case 11: return [3 /*break*/, 13];
|
107
|
+
case 12: return [2 /*return*/, error1_1.message];
|
108
|
+
case 13: return [3 /*break*/, 14];
|
109
|
+
case 14: return [2 /*return*/];
|
110
|
+
}
|
111
|
+
});
|
112
|
+
});
|
43
113
|
}
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
function
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
break;
|
75
|
-
}
|
76
|
-
_context2.prev = 17;
|
77
|
-
_context2.next = 20;
|
78
|
-
return askTimedOutBiBot(_objectSpread(_objectSpread({}, data), {}, {
|
79
|
-
tries: 3
|
80
|
-
}));
|
81
|
-
case 20:
|
82
|
-
return _context2.abrupt("return", _context2.sent);
|
83
|
-
case 23:
|
84
|
-
_context2.prev = 23;
|
85
|
-
_context2.t2 = _context2["catch"](17);
|
86
|
-
return _context2.abrupt("return", _context2.t2.message);
|
87
|
-
case 26:
|
88
|
-
_context2.next = 29;
|
89
|
-
break;
|
90
|
-
case 28:
|
91
|
-
return _context2.abrupt("return", _context2.t1.message);
|
92
|
-
case 29:
|
93
|
-
_context2.next = 32;
|
94
|
-
break;
|
95
|
-
case 31:
|
96
|
-
return _context2.abrupt("return", _context2.t0.message);
|
97
|
-
case 32:
|
98
|
-
case "end":
|
99
|
-
return _context2.stop();
|
100
|
-
}
|
101
|
-
}, _callee2, null, [[0, 4], [8, 14], [17, 23]]);
|
102
|
-
}));
|
103
|
-
return _askBiBot.apply(this, arguments);
|
114
|
+
// TODO: Emmanuel fix the default returned values, especially the userImage to a default robot image
|
115
|
+
function getRemoteClientChatBubbleConfig(params) {
|
116
|
+
return __awaiter(this, void 0, void 0, function () {
|
117
|
+
return __generator(this, function (_a) {
|
118
|
+
try {
|
119
|
+
return [2 /*return*/, {
|
120
|
+
bgColor: 'white',
|
121
|
+
chatColor: 'blue',
|
122
|
+
title: 'ChatBot',
|
123
|
+
userImage: 'string'
|
124
|
+
}
|
125
|
+
// const path=`${domain.inference}${resources.chatBubble}`
|
126
|
+
// const response=await pluginAxiosInstance.get<any>(path, { params })
|
127
|
+
// return response.data
|
128
|
+
];
|
129
|
+
// const path=`${domain.inference}${resources.chatBubble}`
|
130
|
+
// const response=await pluginAxiosInstance.get<any>(path, { params })
|
131
|
+
// return response.data
|
132
|
+
}
|
133
|
+
catch (error) {
|
134
|
+
return [2 /*return*/, {
|
135
|
+
bgColor: 'white',
|
136
|
+
chatColor: 'blue',
|
137
|
+
title: 'ChatBot',
|
138
|
+
userImage: 'string'
|
139
|
+
}];
|
140
|
+
}
|
141
|
+
return [2 /*return*/];
|
142
|
+
});
|
143
|
+
});
|
104
144
|
}
|
105
|
-
function
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
bgColor: 'white',
|
125
|
-
chatColor: 'blue',
|
126
|
-
title: 'ChatBot',
|
127
|
-
userImage: 'string'
|
128
|
-
});
|
129
|
-
case 7:
|
130
|
-
case "end":
|
131
|
-
return _context3.stop();
|
132
|
-
}
|
133
|
-
}, _callee3, null, [[0, 4]]);
|
134
|
-
}));
|
135
|
-
return _getRemoteClientChatBubbleConfig.apply(this, arguments);
|
136
|
-
}
|
137
|
-
function getRemoteClientChatPredefinedQuestions(_x4) {
|
138
|
-
return _getRemoteClientChatPredefinedQuestions.apply(this, arguments);
|
139
|
-
}
|
140
|
-
function _getRemoteClientChatPredefinedQuestions() {
|
141
|
-
_getRemoteClientChatPredefinedQuestions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
142
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
143
|
-
while (1) switch (_context4.prev = _context4.next) {
|
144
|
-
case 0:
|
145
|
-
_context4.prev = 0;
|
146
|
-
return _context4.abrupt("return", ['Hello']);
|
147
|
-
case 4:
|
148
|
-
_context4.prev = 4;
|
149
|
-
_context4.t0 = _context4["catch"](0);
|
150
|
-
return _context4.abrupt("return", ['These are placeholders', 'They will be removed in production', 'This will be empty if there are no predefined questions', 'So hide if there are no predefined questions']);
|
151
|
-
case 7:
|
152
|
-
case "end":
|
153
|
-
return _context4.stop();
|
154
|
-
}
|
155
|
-
}, _callee4, null, [[0, 4]]);
|
156
|
-
}));
|
157
|
-
return _getRemoteClientChatPredefinedQuestions.apply(this, arguments);
|
145
|
+
function getRemoteClientChatPredefinedQuestions(params) {
|
146
|
+
return __awaiter(this, void 0, void 0, function () {
|
147
|
+
return __generator(this, function (_a) {
|
148
|
+
try {
|
149
|
+
return [2 /*return*/, ['Hello']
|
150
|
+
// const path=`${domain.inference}${resources.predefinedQ}`
|
151
|
+
// const response=await pluginAxiosInstance.get<any>(path, { params })
|
152
|
+
// return response.data.predefined_messages
|
153
|
+
];
|
154
|
+
// const path=`${domain.inference}${resources.predefinedQ}`
|
155
|
+
// const response=await pluginAxiosInstance.get<any>(path, { params })
|
156
|
+
// return response.data.predefined_messages
|
157
|
+
}
|
158
|
+
catch (error) {
|
159
|
+
return [2 /*return*/, ['These are placeholders', 'They will be removed in production', 'This will be empty if there are no predefined questions', 'So hide if there are no predefined questions']];
|
160
|
+
}
|
161
|
+
return [2 /*return*/];
|
162
|
+
});
|
163
|
+
});
|
158
164
|
}
|
159
165
|
function GetPredefinedQuestion() {
|
160
|
-
|
166
|
+
return __awaiter(this, void 0, void 0, function () {
|
167
|
+
var clientId;
|
168
|
+
return __generator(this, function (_a) {
|
169
|
+
clientId = '6c74b4bb-0395-4751-a55f-7d065d67c56b';
|
170
|
+
try {
|
171
|
+
return [2 /*return*/, [{ question: "q", answer: "a" }]
|
172
|
+
// const path = `${domain.inference}${resources.predefinedQ}?client_id=${clientId}`
|
173
|
+
// const response = await pluginAxiosInstance.get(path)
|
174
|
+
// return response.data
|
175
|
+
];
|
176
|
+
// const path = `${domain.inference}${resources.predefinedQ}?client_id=${clientId}`
|
177
|
+
// const response = await pluginAxiosInstance.get(path)
|
178
|
+
// return response.data
|
179
|
+
}
|
180
|
+
catch (error) {
|
181
|
+
console.error('Error fetching subscription:', error);
|
182
|
+
}
|
183
|
+
return [2 /*return*/];
|
184
|
+
});
|
185
|
+
});
|
161
186
|
}
|
162
|
-
|
163
|
-
|
164
|
-
var clientId;
|
165
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
166
|
-
while (1) switch (_context5.prev = _context5.next) {
|
167
|
-
case 0:
|
168
|
-
clientId = '6c74b4bb-0395-4751-a55f-7d065d67c56b';
|
169
|
-
_context5.prev = 1;
|
170
|
-
return _context5.abrupt("return", [{
|
171
|
-
question: "q",
|
172
|
-
answer: "a"
|
173
|
-
}]);
|
174
|
-
case 5:
|
175
|
-
_context5.prev = 5;
|
176
|
-
_context5.t0 = _context5["catch"](1);
|
177
|
-
console.error('Error fetching subscription:', _context5.t0);
|
178
|
-
case 8:
|
179
|
-
case "end":
|
180
|
-
return _context5.stop();
|
181
|
-
}
|
182
|
-
}, _callee5, null, [[1, 5]]);
|
183
|
-
}));
|
184
|
-
return _GetPredefinedQuestion.apply(this, arguments);
|
185
|
-
}
|
187
|
+
export { askBiBot, getRemoteClientChatBubbleConfig, getRemoteClientChatPredefinedQuestions, GetPredefinedQuestion };
|
188
|
+
//# sourceMappingURL=plugin-api.js.map
|
@@ -48,4 +48,13 @@ interface docInfoType {
|
|
48
48
|
size: number;
|
49
49
|
type: string;
|
50
50
|
}
|
51
|
-
|
51
|
+
interface UseBiBotChatBotProps {
|
52
|
+
clientId: string;
|
53
|
+
}
|
54
|
+
interface ChatBubbleConfigProps {
|
55
|
+
bgColor?: string;
|
56
|
+
color?: string;
|
57
|
+
title?: string;
|
58
|
+
logo_url?: string;
|
59
|
+
}
|
60
|
+
export type { AppStates, AppAction, AppContextProps, NOTIFICATION_DT, NotificationType, Plan, SUBSCRIPTION, AppconfigType, docInfoType, UseBiBotChatBotProps, ChatBubbleConfigProps };
|
package/dist/types/index.js
CHANGED
@@ -1,16 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
var _coreInterfaces = require("./coreInterfaces");
|
7
|
-
Object.keys(_coreInterfaces).forEach(function (key) {
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
9
|
-
if (key in exports && exports[key] === _coreInterfaces[key]) return;
|
10
|
-
Object.defineProperty(exports, key, {
|
11
|
-
enumerable: true,
|
12
|
-
get: function get() {
|
13
|
-
return _coreInterfaces[key];
|
14
|
-
}
|
15
|
-
});
|
16
|
-
});
|
1
|
+
// created from 'create-ts-index'
|
2
|
+
export * from './coreInterfaces';
|
3
|
+
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js
CHANGED
@@ -1,27 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
var _trimWhitespace = require("./trimWhitespace");
|
7
|
-
Object.keys(_trimWhitespace).forEach(function (key) {
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
9
|
-
if (key in exports && exports[key] === _trimWhitespace[key]) return;
|
10
|
-
Object.defineProperty(exports, key, {
|
11
|
-
enumerable: true,
|
12
|
-
get: function get() {
|
13
|
-
return _trimWhitespace[key];
|
14
|
-
}
|
15
|
-
});
|
16
|
-
});
|
17
|
-
var _sessionManager = require("./sessionManager");
|
18
|
-
Object.keys(_sessionManager).forEach(function (key) {
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
20
|
-
if (key in exports && exports[key] === _sessionManager[key]) return;
|
21
|
-
Object.defineProperty(exports, key, {
|
22
|
-
enumerable: true,
|
23
|
-
get: function get() {
|
24
|
-
return _sessionManager[key];
|
25
|
-
}
|
26
|
-
});
|
27
|
-
});
|
1
|
+
export * from './trimWhitespace';
|
2
|
+
export * from './sessionManager';
|
3
|
+
//# sourceMappingURL=index.js.map
|
@@ -1,17 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.getSessionId = void 0;
|
7
|
-
var _uuid = require("uuid");
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
8
2
|
var SESSION_KEY = 'bibotUserSessionId';
|
9
|
-
var getSessionId =
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
};
|
3
|
+
var getSessionId = function () {
|
4
|
+
var sessionId = localStorage.getItem(SESSION_KEY);
|
5
|
+
if (sessionId === null) {
|
6
|
+
var newSessionId = uuidv4();
|
7
|
+
localStorage.setItem(SESSION_KEY, newSessionId);
|
8
|
+
return newSessionId;
|
9
|
+
}
|
10
|
+
return sessionId;
|
11
|
+
};
|
12
|
+
export { getSessionId };
|
13
|
+
//# sourceMappingURL=sessionManager.js.map
|
@@ -1,15 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
}
|
13
|
-
// If it's not an input event, return the value as is
|
14
|
-
return e;
|
15
|
-
};
|
1
|
+
var trimWhitespace = function (e) {
|
2
|
+
// Check if the event has a target (it's an input event)
|
3
|
+
if (e === null || e === void 0 ? void 0 : e.target) {
|
4
|
+
// If it's a string, trim the whitespace; otherwise, return the value as is
|
5
|
+
return typeof e.target.value === 'string' ? e.target.value.trim() : e.target.value;
|
6
|
+
}
|
7
|
+
// If it's not an input event, return the value as is
|
8
|
+
return e;
|
9
|
+
};
|
10
|
+
export { trimWhitespace };
|
11
|
+
//# sourceMappingURL=trimWhitespace.js.map
|