roboto-js 1.8.4 → 1.8.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/.last-build CHANGED
@@ -1 +1 @@
1
- 2025-10-09T21:04:42.145Z
1
+ 2025-11-03T07:10:02.529Z
@@ -95,6 +95,12 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
95
95
 
96
96
  // Use the storageAdaptor to get the authToken, if available
97
97
  this.initAuthToken(authtoken);
98
+
99
+ // Set apiKey synchronously if provided (don't wait for async initApiKey)
100
+ if (apikey) {
101
+ this.apikey = apikey;
102
+ this.axios.defaults.headers.common['apikey'] = this.apikey;
103
+ }
98
104
  this.initApiKey(apikey);
99
105
  }
100
106
 
@@ -0,0 +1,415 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
3
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
4
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
5
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
6
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
7
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
8
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
9
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
12
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
13
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
14
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
15
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
16
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
17
+ /**
18
+ * Cookie-based storage adaptor for roboto-js
19
+ * Provides a localStorage-compatible interface using cookies
20
+ * This enables server-side access to authentication tokens
21
+ */
22
+ var CookieStorageAdaptor = /*#__PURE__*/function () {
23
+ function CookieStorageAdaptor() {
24
+ var _options$secure, _options$sameSite, _options$path, _options$maxAge, _options$domain, _options$prefix, _options$serverAccess;
25
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
26
+ _classCallCheck(this, CookieStorageAdaptor);
27
+ this.options = _objectSpread({
28
+ // Security settings
29
+ secure: (_options$secure = options.secure) !== null && _options$secure !== void 0 ? _options$secure : typeof window !== 'undefined' && window.location.protocol === 'https:',
30
+ sameSite: (_options$sameSite = options.sameSite) !== null && _options$sameSite !== void 0 ? _options$sameSite : 'Lax',
31
+ httpOnly: false,
32
+ // Must be false so client-side JS can access
33
+
34
+ // Cookie settings
35
+ path: (_options$path = options.path) !== null && _options$path !== void 0 ? _options$path : '/',
36
+ maxAge: (_options$maxAge = options.maxAge) !== null && _options$maxAge !== void 0 ? _options$maxAge : 24 * 60 * 60,
37
+ // 24 hours default
38
+ domain: (_options$domain = options.domain) !== null && _options$domain !== void 0 ? _options$domain : undefined,
39
+ // Let browser determine domain
40
+
41
+ // Prefix for roboto cookies to avoid conflicts
42
+ prefix: (_options$prefix = options.prefix) !== null && _options$prefix !== void 0 ? _options$prefix : 'rbt_',
43
+ // Keys that should be stored without prefix for server-side access
44
+ serverAccessKeys: (_options$serverAccess = options.serverAccessKeys) !== null && _options$serverAccess !== void 0 ? _options$serverAccess : ['authtoken', 'accessKey', 'apikey']
45
+ }, options);
46
+ console.log('[CookieStorageAdaptor] Initialized with options:', {
47
+ secure: this.options.secure,
48
+ sameSite: this.options.sameSite,
49
+ path: this.options.path,
50
+ maxAge: this.options.maxAge,
51
+ domain: this.options.domain,
52
+ prefix: this.options.prefix,
53
+ serverAccessKeys: this.options.serverAccessKeys
54
+ });
55
+ }
56
+
57
+ /**
58
+ * Get item from cookies (localStorage-compatible interface)
59
+ */
60
+ return _createClass(CookieStorageAdaptor, [{
61
+ key: "getItem",
62
+ value: (function () {
63
+ var _getItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(key) {
64
+ var usePrefix, cookieName, name, decodedCookie, cookies, _iterator, _step, cookie, rawValue, parsedValue, _t, _t2;
65
+ return _regenerator().w(function (_context) {
66
+ while (1) switch (_context.p = _context.n) {
67
+ case 0:
68
+ if (!(typeof document === 'undefined')) {
69
+ _context.n = 1;
70
+ break;
71
+ }
72
+ console.log("[CookieStorageAdaptor] getItem(".concat(key, "): document undefined, returning null"));
73
+ return _context.a(2, null);
74
+ case 1:
75
+ // Check if this key should be stored without prefix for server access
76
+ usePrefix = !this.options.serverAccessKeys.includes(key);
77
+ cookieName = usePrefix ? this.options.prefix + key : key;
78
+ name = cookieName + '=';
79
+ decodedCookie = decodeURIComponent(document.cookie);
80
+ cookies = decodedCookie.split(';');
81
+ console.log("[CookieStorageAdaptor] getItem(".concat(key, "): looking for cookie \"").concat(cookieName, "\" ").concat(usePrefix ? '(prefixed)' : '(server-accessible)'));
82
+ console.log("[CookieStorageAdaptor] Available cookies:", cookies.map(function (c) {
83
+ return c.trim().split('=')[0];
84
+ }).join(', '));
85
+ _iterator = _createForOfIteratorHelper(cookies);
86
+ _context.p = 2;
87
+ _iterator.s();
88
+ case 3:
89
+ if ((_step = _iterator.n()).done) {
90
+ _context.n = 7;
91
+ break;
92
+ }
93
+ cookie = _step.value;
94
+ cookie = cookie.trim();
95
+ if (!(cookie.indexOf(name) === 0)) {
96
+ _context.n = 6;
97
+ break;
98
+ }
99
+ rawValue = cookie.substring(name.length, cookie.length);
100
+ console.log("[CookieStorageAdaptor] Found cookie \"".concat(cookieName, "\" with raw value:"), rawValue);
101
+
102
+ // Handle JSON values (like rbtUser)
103
+ _context.p = 4;
104
+ parsedValue = JSON.parse(rawValue);
105
+ console.log("[CookieStorageAdaptor] getItem(".concat(key, "): returning parsed JSON:"), parsedValue);
106
+ return _context.a(2, parsedValue);
107
+ case 5:
108
+ _context.p = 5;
109
+ _t = _context.v;
110
+ console.log("[CookieStorageAdaptor] getItem(".concat(key, "): returning string value:"), rawValue);
111
+ return _context.a(2, rawValue);
112
+ case 6:
113
+ _context.n = 3;
114
+ break;
115
+ case 7:
116
+ _context.n = 9;
117
+ break;
118
+ case 8:
119
+ _context.p = 8;
120
+ _t2 = _context.v;
121
+ _iterator.e(_t2);
122
+ case 9:
123
+ _context.p = 9;
124
+ _iterator.f();
125
+ return _context.f(9);
126
+ case 10:
127
+ console.log("[CookieStorageAdaptor] getItem(".concat(key, "): cookie \"").concat(cookieName, "\" not found, returning null"));
128
+ return _context.a(2, null);
129
+ }
130
+ }, _callee, this, [[4, 5], [2, 8, 9, 10]]);
131
+ }));
132
+ function getItem(_x) {
133
+ return _getItem.apply(this, arguments);
134
+ }
135
+ return getItem;
136
+ }()
137
+ /**
138
+ * Set item in cookies (localStorage-compatible interface)
139
+ */
140
+ )
141
+ }, {
142
+ key: "setItem",
143
+ value: (function () {
144
+ var _setItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(key, value) {
145
+ var usePrefix, cookieName, cookieValue, secureFlag, domainFlag, httpOnlyFlag, cookieString, verification;
146
+ return _regenerator().w(function (_context2) {
147
+ while (1) switch (_context2.n) {
148
+ case 0:
149
+ if (!(typeof document === 'undefined')) {
150
+ _context2.n = 1;
151
+ break;
152
+ }
153
+ console.log("[CookieStorageAdaptor] setItem(".concat(key, "): document undefined, skipping"));
154
+ return _context2.a(2);
155
+ case 1:
156
+ // Check if this key should be stored without prefix for server access
157
+ usePrefix = !this.options.serverAccessKeys.includes(key);
158
+ cookieName = usePrefix ? this.options.prefix + key : key; // Stringify objects/arrays like localStorage does
159
+ cookieValue = _typeof(value) === 'object' ? JSON.stringify(value) : String(value);
160
+ console.log("[CookieStorageAdaptor] setItem(".concat(key, "): storing as \"").concat(cookieName, "\" ").concat(usePrefix ? '(prefixed)' : '(server-accessible)'));
161
+ console.log("[CookieStorageAdaptor] Original value:", value);
162
+ console.log("[CookieStorageAdaptor] Cookie value:", cookieValue);
163
+
164
+ // Build cookie string with security options
165
+ secureFlag = this.options.secure ? '; Secure' : '';
166
+ domainFlag = this.options.domain ? "; Domain=".concat(this.options.domain) : '';
167
+ httpOnlyFlag = this.options.httpOnly ? '; HttpOnly' : '';
168
+ cookieString = "".concat(cookieName, "=").concat(encodeURIComponent(cookieValue), "; path=").concat(this.options.path, "; max-age=").concat(this.options.maxAge, "; SameSite=").concat(this.options.sameSite).concat(secureFlag).concat(domainFlag).concat(httpOnlyFlag);
169
+ console.log("[CookieStorageAdaptor] Full cookie string:", cookieString);
170
+ document.cookie = cookieString;
171
+
172
+ // Verify the cookie was set by immediately reading it back
173
+ _context2.n = 2;
174
+ return this.getItem(key);
175
+ case 2:
176
+ verification = _context2.v;
177
+ if (verification !== null) {
178
+ console.log("[CookieStorageAdaptor] \u2705 Successfully set and verified cookie: ".concat(cookieName));
179
+ } else {
180
+ console.error("[CookieStorageAdaptor] \u274C Failed to set cookie: ".concat(cookieName));
181
+ }
182
+ case 3:
183
+ return _context2.a(2);
184
+ }
185
+ }, _callee2, this);
186
+ }));
187
+ function setItem(_x2, _x3) {
188
+ return _setItem.apply(this, arguments);
189
+ }
190
+ return setItem;
191
+ }()
192
+ /**
193
+ * Remove item from cookies (localStorage-compatible interface)
194
+ */
195
+ )
196
+ }, {
197
+ key: "removeItem",
198
+ value: (function () {
199
+ var _removeItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(key) {
200
+ var usePrefix, cookieName, existingValue, secureFlag, domainFlag, removalString, verification;
201
+ return _regenerator().w(function (_context3) {
202
+ while (1) switch (_context3.n) {
203
+ case 0:
204
+ if (!(typeof document === 'undefined')) {
205
+ _context3.n = 1;
206
+ break;
207
+ }
208
+ console.log("[CookieStorageAdaptor] removeItem(".concat(key, "): document undefined, skipping"));
209
+ return _context3.a(2);
210
+ case 1:
211
+ // Check if this key should be stored without prefix for server access
212
+ usePrefix = !this.options.serverAccessKeys.includes(key);
213
+ cookieName = usePrefix ? this.options.prefix + key : key;
214
+ console.log("[CookieStorageAdaptor] removeItem(".concat(key, "): removing cookie \"").concat(cookieName, "\" ").concat(usePrefix ? '(prefixed)' : '(server-accessible)'));
215
+
216
+ // Check if cookie exists before removal
217
+ _context3.n = 2;
218
+ return this.getItem(key);
219
+ case 2:
220
+ existingValue = _context3.v;
221
+ if (existingValue !== null) {
222
+ console.log("[CookieStorageAdaptor] Cookie \"".concat(cookieName, "\" exists, removing..."));
223
+ } else {
224
+ console.log("[CookieStorageAdaptor] Cookie \"".concat(cookieName, "\" doesn't exist, removal not needed"));
225
+ }
226
+ secureFlag = this.options.secure ? '; Secure' : '';
227
+ domainFlag = this.options.domain ? "; Domain=".concat(this.options.domain) : '';
228
+ removalString = "".concat(cookieName, "=; path=").concat(this.options.path, "; expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=").concat(this.options.sameSite).concat(secureFlag).concat(domainFlag);
229
+ console.log("[CookieStorageAdaptor] Removal cookie string:", removalString);
230
+ document.cookie = removalString;
231
+
232
+ // Verify the cookie was removed
233
+ _context3.n = 3;
234
+ return this.getItem(key);
235
+ case 3:
236
+ verification = _context3.v;
237
+ if (verification === null) {
238
+ console.log("[CookieStorageAdaptor] \u2705 Successfully removed cookie: ".concat(cookieName));
239
+ } else {
240
+ console.error("[CookieStorageAdaptor] \u274C Failed to remove cookie: ".concat(cookieName, ", still has value:"), verification);
241
+ }
242
+ case 4:
243
+ return _context3.a(2);
244
+ }
245
+ }, _callee3, this);
246
+ }));
247
+ function removeItem(_x4) {
248
+ return _removeItem.apply(this, arguments);
249
+ }
250
+ return removeItem;
251
+ }()
252
+ /**
253
+ * Clear all roboto cookies
254
+ */
255
+ )
256
+ }, {
257
+ key: "clear",
258
+ value: (function () {
259
+ var _clear = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
260
+ var cookies, prefix, _iterator2, _step2, cookie, cookieName, key, _t3;
261
+ return _regenerator().w(function (_context4) {
262
+ while (1) switch (_context4.p = _context4.n) {
263
+ case 0:
264
+ if (!(typeof document === 'undefined')) {
265
+ _context4.n = 1;
266
+ break;
267
+ }
268
+ return _context4.a(2);
269
+ case 1:
270
+ // Get all cookies and remove ones with our prefix or server access keys
271
+ cookies = document.cookie.split(';');
272
+ prefix = this.options.prefix;
273
+ _iterator2 = _createForOfIteratorHelper(cookies);
274
+ _context4.p = 2;
275
+ _iterator2.s();
276
+ case 3:
277
+ if ((_step2 = _iterator2.n()).done) {
278
+ _context4.n = 7;
279
+ break;
280
+ }
281
+ cookie = _step2.value;
282
+ cookieName = cookie.split('=')[0].trim(); // Remove prefixed cookies
283
+ if (!cookieName.startsWith(prefix)) {
284
+ _context4.n = 5;
285
+ break;
286
+ }
287
+ key = cookieName.substring(prefix.length);
288
+ _context4.n = 4;
289
+ return this.removeItem(key);
290
+ case 4:
291
+ _context4.n = 6;
292
+ break;
293
+ case 5:
294
+ if (!this.options.serverAccessKeys.includes(cookieName)) {
295
+ _context4.n = 6;
296
+ break;
297
+ }
298
+ _context4.n = 6;
299
+ return this.removeItem(cookieName);
300
+ case 6:
301
+ _context4.n = 3;
302
+ break;
303
+ case 7:
304
+ _context4.n = 9;
305
+ break;
306
+ case 8:
307
+ _context4.p = 8;
308
+ _t3 = _context4.v;
309
+ _iterator2.e(_t3);
310
+ case 9:
311
+ _context4.p = 9;
312
+ _iterator2.f();
313
+ return _context4.f(9);
314
+ case 10:
315
+ return _context4.a(2);
316
+ }
317
+ }, _callee4, this, [[2, 8, 9, 10]]);
318
+ }));
319
+ function clear() {
320
+ return _clear.apply(this, arguments);
321
+ }
322
+ return clear;
323
+ }()
324
+ /**
325
+ * Get all keys (for debugging/compatibility)
326
+ */
327
+ )
328
+ }, {
329
+ key: "keys",
330
+ value: (function () {
331
+ var _keys = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
332
+ var cookies, prefix, keys, _iterator3, _step3, cookie, cookieName;
333
+ return _regenerator().w(function (_context5) {
334
+ while (1) switch (_context5.n) {
335
+ case 0:
336
+ if (!(typeof document === 'undefined')) {
337
+ _context5.n = 1;
338
+ break;
339
+ }
340
+ return _context5.a(2, []);
341
+ case 1:
342
+ cookies = document.cookie.split(';');
343
+ prefix = this.options.prefix;
344
+ keys = [];
345
+ _iterator3 = _createForOfIteratorHelper(cookies);
346
+ try {
347
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
348
+ cookie = _step3.value;
349
+ cookieName = cookie.split('=')[0].trim(); // Add prefixed cookies
350
+ if (cookieName.startsWith(prefix)) {
351
+ keys.push(cookieName.substring(prefix.length));
352
+ }
353
+ // Add server access keys (non-prefixed)
354
+ else if (this.options.serverAccessKeys.includes(cookieName)) {
355
+ keys.push(cookieName);
356
+ }
357
+ }
358
+ } catch (err) {
359
+ _iterator3.e(err);
360
+ } finally {
361
+ _iterator3.f();
362
+ }
363
+ return _context5.a(2, keys);
364
+ }
365
+ }, _callee5, this);
366
+ }));
367
+ function keys() {
368
+ return _keys.apply(this, arguments);
369
+ }
370
+ return keys;
371
+ }()
372
+ /**
373
+ * Debug method to log all current cookies and adapter state
374
+ */
375
+ )
376
+ }, {
377
+ key: "debugState",
378
+ value: function debugState() {
379
+ if (typeof document === 'undefined') {
380
+ console.log('[CookieStorageAdaptor] DEBUG: document undefined (server-side)');
381
+ return;
382
+ }
383
+ console.log('[CookieStorageAdaptor] DEBUG STATE:');
384
+ console.log('- Options:', this.options);
385
+ console.log('- All cookies:', document.cookie);
386
+ var cookies = document.cookie.split(';');
387
+ var robotoKeys = [];
388
+ var serverKeys = [];
389
+ var otherKeys = [];
390
+ var _iterator4 = _createForOfIteratorHelper(cookies),
391
+ _step4;
392
+ try {
393
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
394
+ var cookie = _step4.value;
395
+ var cookieName = cookie.split('=')[0].trim();
396
+ if (cookieName.startsWith(this.options.prefix)) {
397
+ robotoKeys.push(cookieName);
398
+ } else if (this.options.serverAccessKeys.includes(cookieName)) {
399
+ serverKeys.push(cookieName);
400
+ } else if (cookieName) {
401
+ otherKeys.push(cookieName);
402
+ }
403
+ }
404
+ } catch (err) {
405
+ _iterator4.e(err);
406
+ } finally {
407
+ _iterator4.f();
408
+ }
409
+ console.log('- Roboto prefixed cookies:', robotoKeys);
410
+ console.log('- Server access cookies:', serverKeys);
411
+ console.log('- Other cookies:', otherKeys);
412
+ }
413
+ }]);
414
+ }();
415
+ export { CookieStorageAdaptor as default };
@@ -54,6 +54,12 @@ export default class RbtApi {
54
54
 
55
55
  // Use the storageAdaptor to get the authToken, if available
56
56
  this.initAuthToken(authtoken);
57
+
58
+ // Set apiKey synchronously if provided (don't wait for async initApiKey)
59
+ if (apikey) {
60
+ this.apikey = apikey;
61
+ this.axios.defaults.headers.common['apikey'] = this.apikey;
62
+ }
57
63
  this.initApiKey(apikey);
58
64
  }
59
65