qiscus-sdk-core 2.12.4 → 2.12.6-logger

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.
@@ -1,23 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
-
16
11
  var _lodash = _interopRequireDefault(require("lodash.throttle"));
17
-
18
12
  var _urlBuilder = _interopRequireDefault(require("../url-builder"));
19
-
20
- var User = /*#__PURE__*/function () {
13
+ var User = exports["default"] = /*#__PURE__*/function () {
21
14
  /**
22
15
  * Params used in this class
23
16
  * @method constructor
@@ -26,25 +19,21 @@ var User = /*#__PURE__*/function () {
26
19
  */
27
20
  function User(HTTPAdapter) {
28
21
  var _this = this;
29
-
30
22
  (0, _classCallCheck2["default"])(this, User);
31
23
  (0, _defineProperty2["default"])(this, "updateCommentStatus", (0, _lodash["default"])(function (roomId, lastReadCommentId, lastReceivedCommentId) {
32
24
  var body = {
33
25
  room_id: roomId
34
26
  };
35
27
  if (lastReadCommentId) body.last_comment_read_id = lastReadCommentId;
36
-
37
28
  if (lastReceivedCommentId) {
38
29
  body.last_comment_received_id = lastReceivedCommentId;
39
30
  }
40
-
41
31
  return _this.HTTPAdapter.post('api/v2/sdk/update_comment_status', body);
42
32
  }, 500));
43
33
  this.HTTPAdapter = HTTPAdapter;
44
34
  this.token = HTTPAdapter.token;
45
35
  }
46
-
47
- (0, _createClass2["default"])(User, [{
36
+ return (0, _createClass2["default"])(User, [{
48
37
  key: "postComment",
49
38
  value: function postComment(topicId, commentMessage, uniqueId, type, payload, extras) {
50
39
  return this.HTTPAdapter.post_json("api/v2/sdk/post_comment", {
@@ -63,7 +52,6 @@ var User = /*#__PURE__*/function () {
63
52
  key: "loadRoomList",
64
53
  value: function loadRoomList() {
65
54
  var _params$room_type;
66
-
67
55
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
68
56
  var url = (0, _urlBuilder["default"])('api/v2/sdk/user_rooms').param('page', params.page).param('show_participants', params.show_participants || true).param('limit', params.limit).param('show_empty', params.show_empty).param('room_type', (_params$room_type = params.room_type) !== null && _params$room_type !== void 0 ? _params$room_type : 'default').build();
69
57
  return this.HTTPAdapter.get(url).then(function (res) {
@@ -134,15 +122,12 @@ var User = /*#__PURE__*/function () {
134
122
  value: function deleteComment(roomId, commentUniqueIds) {
135
123
  var isForEveryone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
136
124
  var isHard = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
137
-
138
125
  if (isForEveryone === false) {
139
126
  console.warn('Deprecated: delete comment for me will be removed on next release');
140
127
  }
141
-
142
128
  if (isHard === false) {
143
129
  console.warn('Deprecated: soft delete will be removed on next release');
144
130
  }
145
-
146
131
  var body = {
147
132
  unique_ids: commentUniqueIds,
148
133
  is_delete_for_everyone: isForEveryone,
@@ -237,8 +222,5 @@ var User = /*#__PURE__*/function () {
237
222
  });
238
223
  }
239
224
  }]);
240
- return User;
241
225
  }();
242
-
243
- exports["default"] = User;
244
226
  module.exports = exports.default;
package/lib/lib/match.js CHANGED
@@ -1,114 +1,86 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.match = match;
9
8
  exports.when = when;
10
-
11
9
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
12
-
13
10
  // Taken from https://github.com/FGRibreau/match-when/blob/master/match.js
14
- var _catchAllSymbol = String('match.pattern.catchAll');
15
11
 
12
+ var _catchAllSymbol = String('match.pattern.catchAll');
16
13
  var _patternOR = String('match.pattern.OR');
17
-
18
14
  var _patternORStr = _patternOR.toString(); // dirty hack
19
-
20
-
21
15
  var _patternAND = String('match.pattern.AND');
22
-
23
16
  var _patternANDStr = _patternAND.toString(); // dirty hack
24
-
25
-
26
17
  var _patternRANGE = String('match.pattern.RANGE');
27
-
28
18
  var _patternRANGEStr = _patternRANGE.toString(); // dirty hack
29
19
 
30
-
31
20
  var _patternREGEXP = String('match.pattern.REGEXP');
32
-
33
21
  var _patternREGEXPStr = _patternREGEXP.toString(); // dirty hack
34
-
35
-
36
22
  var EXTRACT_PATTERN_AND_FLAGS = /\/(.*)\/(.*)/;
37
-
38
23
  function MissingCatchAllPattern() {
39
24
  Error.call(this, 'Missing when() catch-all pattern as last match argument, add [when()]: void 0');
40
-
41
25
  if (!('stack' in this)) {
42
26
  this.stack = new Error().stack;
43
27
  }
44
28
  }
45
-
46
29
  MissingCatchAllPattern.prototype = Object.create(Error.prototype);
47
-
48
30
  function match() {
49
31
  var _ref;
32
+ var obj = (_ref = arguments.length - 1, _ref < 0 || arguments.length <= _ref ? undefined : arguments[_ref]);
50
33
 
51
- var obj = (_ref = arguments.length - 1, _ref < 0 || arguments.length <= _ref ? undefined : arguments[_ref]); // pre-compute matchers
52
-
34
+ // pre-compute matchers
53
35
  var matchers = [];
54
-
55
36
  for (var key in obj) {
56
37
  matchers.push(when.unserialize(key, obj[key]));
57
- } // since JS objects are unordered we need to reorder what for..in give us even if the order was already right
58
- // because it depends on the JS engine implementation. See #2
59
-
38
+ }
60
39
 
40
+ // since JS objects are unordered we need to reorder what for..in give us even if the order was already right
41
+ // because it depends on the JS engine implementation. See #2
61
42
  matchers.sort(function (a, b) {
62
43
  return a.position < b.position ? -1 : 1;
63
44
  });
64
-
65
45
  if (Object.getOwnPropertySymbols(obj).indexOf(_catchAllSymbol) !== -1) {
66
46
  matchers.push(when.unserialize(_catchAllSymbol, obj[_catchAllSymbol]));
67
47
  }
68
-
69
48
  var calculateResult = function calculateResult(input) {
70
49
  var matched = matchers.find(function (matcher) {
71
50
  return matcher.match(input);
72
51
  });
73
-
74
52
  if (!matched) {
75
53
  throw new MissingCatchAllPattern();
76
54
  }
77
-
78
55
  return typeof matched.result === 'function' ? matched.result(input) : matched.result;
79
56
  };
80
-
81
57
  return arguments.length === 2 ? calculateResult(arguments.length <= 0 ? undefined : arguments[0]) : calculateResult;
82
58
  }
83
-
84
59
  function when(props) {
85
60
  if (props === undefined) {
86
61
  return _catchAllSymbol;
87
62
  }
88
-
89
63
  if (props instanceof RegExp) {
90
64
  return _serialize([_patternREGEXP.toString(), props.toString()]);
91
65
  }
92
-
93
66
  return _serialize(props);
94
67
  }
68
+ when.__uid = 0;
95
69
 
96
- when.__uid = 0; // Any -> String
97
-
70
+ // Any -> String
98
71
  function _serialize(mixed) {
99
72
  return JSON.stringify([when.__uid++, mixed]);
100
- } // String -> [Number, Any]
101
-
73
+ }
102
74
 
75
+ // String -> [Number, Any]
103
76
  function _unserialize(str) {
104
77
  return JSON.parse(str);
105
78
  }
106
-
107
79
  function _true() {
108
80
  return true;
109
- } // Any -> String
110
-
81
+ }
111
82
 
83
+ // Any -> String
112
84
  function _match(props) {
113
85
  if (Array.isArray(props)) {
114
86
  if (props[0] === _patternORStr) {
@@ -119,7 +91,6 @@ function _match(props) {
119
91
  });
120
92
  };
121
93
  }
122
-
123
94
  if (props[0] === _patternANDStr) {
124
95
  props.shift();
125
96
  return function (input) {
@@ -128,72 +99,60 @@ function _match(props) {
128
99
  });
129
100
  };
130
101
  }
131
-
132
102
  if (props[0] === _patternRANGEStr) {
133
103
  props.shift();
134
104
  return function (input) {
135
105
  return props[0] <= input && input <= props[1];
136
106
  };
137
107
  }
138
-
139
108
  if (props[0] === _patternREGEXPStr) {
140
109
  var res = EXTRACT_PATTERN_AND_FLAGS.exec(props[1]);
141
110
  return _matching.bind(null, new RegExp(res[1], res[2]));
142
111
  }
143
112
  }
144
-
145
113
  function _matching(props, input) {
146
114
  // implement array matching
147
115
  if (Array.isArray(input)) {
148
116
  // @todo yes this is a quick and dirty way, optimize this
149
117
  return JSON.stringify(props) === JSON.stringify(input);
150
118
  }
151
-
152
119
  if (props instanceof RegExp) {
153
120
  return props.test(input);
154
121
  }
155
-
156
122
  if ((0, _typeof2["default"])(input) === 'object') {
157
123
  for (var prop in props) {
158
124
  if (input[prop] !== props[prop]) {
159
125
  return false;
160
126
  }
161
127
  }
162
-
163
128
  return true;
164
129
  }
165
-
166
130
  return props === input;
167
131
  }
168
-
169
132
  return function (input) {
170
133
  return _matching(props, input);
171
134
  };
172
- } // mixed -> String
173
-
135
+ }
174
136
 
137
+ // mixed -> String
175
138
  when.or = function () {
176
139
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
177
140
  args[_key] = arguments[_key];
178
141
  }
179
-
180
142
  return _serialize([_patternOR.toString(), args]);
181
- }; // mixed -> String
182
- // upcoming...
183
-
143
+ };
184
144
 
145
+ // mixed -> String
146
+ // upcoming...
185
147
  when.and = function () {
186
148
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
187
149
  args[_key2] = arguments[_key2];
188
150
  }
189
-
190
151
  return _serialize([_patternAND.toString(), args]);
191
152
  };
192
-
193
153
  when.range = function (start, end) {
194
154
  return _serialize([_patternRANGE.toString(), start, end]);
195
155
  };
196
-
197
156
  when.unserialize = function (serializedKey, value) {
198
157
  if (serializedKey === _catchAllSymbol) {
199
158
  return {
@@ -201,11 +160,10 @@ when.unserialize = function (serializedKey, value) {
201
160
  result: value,
202
161
  position: Infinity
203
162
  };
204
- } // const {position, matcherConfiguration} = _unserialize(serializedKey);
205
-
163
+ }
206
164
 
165
+ // const {position, matcherConfiguration} = _unserialize(serializedKey);
207
166
  var deserialized = _unserialize(serializedKey);
208
-
209
167
  var matcherConfiguration = deserialized[1];
210
168
  var position = deserialized[0];
211
169
  return {
@@ -4,14 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = UrlBuilder;
7
-
8
7
  function UrlBuilder(basePath) {
9
8
  var params = {};
10
-
11
9
  var getQuery = function getQuery(key, value) {
12
10
  return "".concat(key, "=").concat(value);
13
11
  };
14
-
15
12
  return {
16
13
  param: function param(key, value) {
17
14
  params[key] = value;
@@ -26,12 +23,10 @@ function UrlBuilder(basePath) {
26
23
  return getQuery("".concat(key, "[]"), value);
27
24
  }).join("&");
28
25
  }
29
-
30
26
  return getQuery(key, params[key]);
31
27
  }).join("&");
32
28
  return [basePath].concat(query).join("?");
33
29
  }
34
30
  };
35
31
  }
36
-
37
32
  module.exports = exports.default;
package/lib/lib/util.js CHANGED
@@ -3,9 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.sleep = exports.wrapP = exports.tryCatch = void 0;
7
-
8
- var tryCatch = function tryCatch(fn, default_, onError, onSuccess) {
6
+ exports.wrapP = exports.tryCatch = exports.sleep = void 0;
7
+ var tryCatch = exports.tryCatch = function tryCatch(fn, default_, onError, onSuccess) {
9
8
  try {
10
9
  var resp = fn();
11
10
  if (onSuccess != null) onSuccess(resp);
@@ -15,24 +14,16 @@ var tryCatch = function tryCatch(fn, default_, onError, onSuccess) {
15
14
  return default_;
16
15
  }
17
16
  };
18
-
19
- exports.tryCatch = tryCatch;
20
-
21
- var wrapP = function wrapP(promise) {
17
+ var wrapP = exports.wrapP = function wrapP(promise) {
22
18
  return promise.then(function (res) {
23
19
  return [res, null];
24
20
  })["catch"](function (err) {
25
21
  return [null, err];
26
22
  });
27
23
  };
28
-
29
- exports.wrapP = wrapP;
30
-
31
- var sleep = function sleep() {
24
+ var sleep = exports.sleep = function sleep() {
32
25
  var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1000;
33
26
  return new Promise(function (r) {
34
27
  return setTimeout(r, time);
35
28
  });
36
- };
37
-
38
- exports.sleep = sleep;
29
+ };
package/lib/lib/utils.js CHANGED
@@ -1,30 +1,24 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
- exports.searchAndReplace = searchAndReplace;
7
+ exports.GroupChatBuilder = void 0;
9
8
  exports.escapeHTML = escapeHTML;
10
9
  exports.scrollToBottom = scrollToBottom;
11
- exports.GroupChatBuilder = void 0;
12
-
10
+ exports.searchAndReplace = searchAndReplace;
13
11
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
14
-
15
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
16
-
17
13
  function searchAndReplace(str, find, replace) {
18
14
  return str.split(find).join(replace);
19
15
  }
20
-
21
16
  function escapeHTML(str) {
22
17
  return str.replace(/<[^>]*\/?>([\s\S]*)?<\/.*?>/gi, function (match) {
23
18
  return match.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;');
24
19
  });
25
20
  }
26
-
27
- var GroupChatBuilder = /*#__PURE__*/function () {
21
+ var GroupChatBuilder = exports.GroupChatBuilder = /*#__PURE__*/function () {
28
22
  /**
29
23
  * Create a group chat room builder.
30
24
  * @constructs
@@ -38,31 +32,31 @@ var GroupChatBuilder = /*#__PURE__*/function () {
38
32
  this.emails = [];
39
33
  this.options = {};
40
34
  }
35
+
41
36
  /**
42
37
  * Set the room name
43
38
  * @param {string} name - Room name
44
39
  * @returns {GroupChatBuilder}
45
40
  */
46
-
47
-
48
- (0, _createClass2["default"])(GroupChatBuilder, [{
41
+ return (0, _createClass2["default"])(GroupChatBuilder, [{
49
42
  key: "withName",
50
43
  value: function withName(name) {
51
44
  this.name = name;
52
45
  return this;
53
46
  }
47
+
54
48
  /**
55
49
  * Add an options to this room.
56
50
  * @param {object} options - Any data that is `JSON.stringify` able
57
51
  * @returns {GroupChatBuilder}
58
52
  */
59
-
60
53
  }, {
61
54
  key: "withOptions",
62
55
  value: function withOptions(options) {
63
56
  this.options = options;
64
57
  return this;
65
58
  }
59
+
66
60
  /**
67
61
  * Add more participants to the room.
68
62
  * This method use javascript rest operator, which mean you can add as many as
@@ -70,26 +64,23 @@ var GroupChatBuilder = /*#__PURE__*/function () {
70
64
  * eg: addParticipants('email1@gg.com', 'email2@gg.com')
71
65
  * @param {string} emails - Email of participant to be added.
72
66
  */
73
-
74
67
  }, {
75
68
  key: "addParticipants",
76
69
  value: function addParticipants() {
77
70
  var _this$emails$filter;
78
-
79
71
  for (var _len = arguments.length, emails = new Array(_len), _key = 0; _key < _len; _key++) {
80
72
  emails[_key] = arguments[_key];
81
73
  }
82
-
83
74
  this.emails = (_this$emails$filter = this.emails.filter(function (email) {
84
75
  return emails.indexOf(email) === -1;
85
76
  })).concat.apply(_this$emails$filter, emails);
86
77
  return this;
87
78
  }
79
+
88
80
  /**
89
81
  * Real create group chat room by calling the backend API.
90
82
  * @returns {Promise.<Room, Error>}
91
83
  */
92
-
93
84
  }, {
94
85
  key: "create",
95
86
  value: function create() {
@@ -101,11 +92,7 @@ var GroupChatBuilder = /*#__PURE__*/function () {
101
92
  }, options);
102
93
  }
103
94
  }]);
104
- return GroupChatBuilder;
105
95
  }();
106
-
107
- exports.GroupChatBuilder = GroupChatBuilder;
108
-
109
96
  function scrollToBottom(latestCommentId) {
110
97
  requestAnimationFrame(function () {
111
98
  if (latestCommentId > 0) {
@@ -115,9 +102,8 @@ function scrollToBottom(latestCommentId) {
115
102
  block: 'end',
116
103
  behavior: 'smooth'
117
104
  });
118
- } // on entering the room, wait for data processed then focus on comment form
119
-
120
-
105
+ }
106
+ // on entering the room, wait for data processed then focus on comment form
121
107
  document.getElementsByClassName('qcw-comment-form').item(0).getElementsByTagName('textarea').item(0).focus();
122
108
  });
123
109
  }
package/lib/logger.js ADDED
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.Logger = void 0;
8
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+ // @ts-check
12
+ var Logger = exports.Logger = /*#__PURE__*/function () {
13
+ /**
14
+ * Creates an instance of Logger.
15
+ * @param {string} name - The name of the logger.
16
+ * @param {Logger|undefined} [parent] - Optional parent logger for hierarchical logging.
17
+ * @param {(level:string, message:string, ...data: any[]) => void} [onLog] - Optional function to handle logging.
18
+ * If not provided, a default logging function will be used that logs to the console.
19
+ * The default function logs messages in the format: [LEVEL] loggerName: message with data.
20
+ * And also the default function will log to the console only if `getIsLogEnabled` returns true
21
+ * or `debugMode` inside `QiscusSDK` is true.
22
+ *
23
+ * @param {() => boolean} [getIsLogEnabled]
24
+ */
25
+ function Logger(name, parent, onLog, getIsLogEnabled) {
26
+ (0, _classCallCheck2["default"])(this, Logger);
27
+ /**
28
+ * @type {string}
29
+ * The name of the logger.
30
+ * This is used to identify the logger in logs.
31
+ * It can be a simple string or a hierarchical name (e.g., "app.module").
32
+ */
33
+ (0, _defineProperty2["default"])(this, "name", void 0);
34
+ /**
35
+ * @type {Logger|undefined}
36
+ * The parent logger for hierarchical logging.
37
+ * If defined, logs will be propagated to the parent logger.
38
+ */
39
+ (0, _defineProperty2["default"])(this, "parent", void 0);
40
+ /**
41
+ * @type {(level:string, message:string, ...data: any[]) => void}
42
+ * A function that handles the logging.
43
+ * It takes the log level, message, and additional data as arguments.
44
+ */
45
+ (0, _defineProperty2["default"])(this, "onLog", void 0);
46
+ /**
47
+ * @type {(() => boolean) | undefined}
48
+ * A function that returns a boolean indicating whether logging is enabled.
49
+ * This can be used to conditionally log messages based on the application's logging configuration.
50
+ */
51
+ (0, _defineProperty2["default"])(this, "getIsLogEnabled", void 0);
52
+ this.name = name;
53
+ this.parent = parent;
54
+ this.getIsLogEnabled = getIsLogEnabled;
55
+
56
+ /**
57
+ * @param {string} level
58
+ * @param {string} message
59
+ * @param {any[]} data
60
+ */
61
+ function _defaultOnLog(level, message) {
62
+ if (getIsLogEnabled !== null && getIsLogEnabled !== void 0 && getIsLogEnabled()) {
63
+ for (var _len = arguments.length, data = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
64
+ data[_key - 2] = arguments[_key];
65
+ }
66
+ console[level]("[".concat(level.toUpperCase(), "] ").concat(this.name, ": ").concat(message), JSON.stringify(data));
67
+ }
68
+ }
69
+ this.onLog = parent != null ? parent.onLog : onLog !== null && onLog !== void 0 ? onLog : _defaultOnLog;
70
+ }
71
+
72
+ /**
73
+ * Creates a child logger with a specific name.
74
+ * @param {string} name - The name of the child logger.
75
+ * @returns {Logger} A new Logger instance with the specified name.
76
+ */
77
+ return (0, _createClass2["default"])(Logger, [{
78
+ key: "child",
79
+ value: function child(name) {
80
+ return new Logger("".concat(this.name, ".").concat(name), this);
81
+ }
82
+
83
+ /**
84
+ * Logs a debug message.
85
+ * @param {string} message - The debug message to log.
86
+ * @param {any[]} data - Additional data to log.
87
+ */
88
+ }, {
89
+ key: "debug",
90
+ value: function debug(message) {
91
+ for (var _len2 = arguments.length, data = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
92
+ data[_key2 - 1] = arguments[_key2];
93
+ }
94
+ this.onLog.apply(this, ['debug', message].concat(data));
95
+ }
96
+
97
+ /**
98
+ * Logs an info message.
99
+ * @param {string} message - The info message to log.
100
+ * @param {any[]} data - Additional data to log.
101
+ */
102
+ }, {
103
+ key: "info",
104
+ value: function info(message) {
105
+ for (var _len3 = arguments.length, data = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
106
+ data[_key3 - 1] = arguments[_key3];
107
+ }
108
+ this.onLog.apply(this, ['info', message].concat(data));
109
+ }
110
+
111
+ /**
112
+ * Logs an error message.
113
+ * @param {string} message - The error message to log.
114
+ * @param {any[]} data - Additional data to log.
115
+ */
116
+ }, {
117
+ key: "error",
118
+ value: function error(message) {
119
+ for (var _len4 = arguments.length, data = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
120
+ data[_key4 - 1] = arguments[_key4];
121
+ }
122
+ this.onLog.apply(this, ['error', message].concat(data));
123
+ }
124
+ }]);
125
+ }();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qiscus-sdk-core",
3
- "version": "2.12.4",
3
+ "version": "2.12.6-logger",
4
4
  "description": "Qiscus Web SDK Core",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -56,6 +56,7 @@
56
56
  "mocha": "^5.2.0",
57
57
  "np": "^8.0.4",
58
58
  "npm-run-all": "^4.1.5",
59
+ "prettier": "^3.5.3",
59
60
  "rimraf": "^2.7.1",
60
61
  "serve": "^12.0.0",
61
62
  "webpack": "^4.44.1",
@@ -95,6 +96,7 @@
95
96
  "trailingComma": "es5"
96
97
  },
97
98
  "engines": {
98
- "node": "v18.16"
99
- }
99
+ "node": ">=20.0.0"
100
+ },
101
+ "packageManager": "pnpm@10.11.1+sha512.e519b9f7639869dc8d5c3c5dfef73b3f091094b0a006d7317353c72b124e80e1afd429732e28705ad6bfa1ee879c1fce46c128ccebd3192101f43dd67c667912"
100
102
  }