abckit 0.0.64 → 0.0.66

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.
@@ -29,10 +29,14 @@ async function getApp() {
29
29
  return _App;
30
30
  }
31
31
  function isNativePlatform() {
32
- if (typeof window === "undefined")
32
+ if (typeof window === "undefined") {
33
+ console.log("[Capacitor] isNativePlatform: window undefined");
33
34
  return false;
35
+ }
34
36
  const win = window;
35
- return win.Capacitor?.isNativePlatform?.() ?? false;
37
+ const result = win.Capacitor?.isNativePlatform?.() ?? false;
38
+ console.log("[Capacitor] isNativePlatform:", result, "Capacitor exists:", !!win.Capacitor);
39
+ return result;
36
40
  }
37
41
  let managersInitialized = false;
38
42
  async function initializeManagers() {
@@ -283,20 +287,39 @@ export function capacitorClient(opts) {
283
287
  }
284
288
  },
285
289
  async init(url, options) {
290
+ console.log("[Capacitor] init called for:", url);
286
291
  if (!isNativePlatform()) {
292
+ console.log("[Capacitor] init: not native platform, skipping");
287
293
  return { url, options };
288
294
  }
289
295
  await initializeManagers();
290
296
  const Preferences = await getPreferences();
291
297
  const normalizedCookieName = normalizeCookieName(cookieName);
292
298
  const storedCookie = (await Preferences.get({ key: normalizedCookieName }))?.value;
299
+ console.log("[Capacitor] init: storedCookie:", storedCookie);
293
300
  const cookie = getCookie(storedCookie || "{}");
301
+ console.log("[Capacitor] init: cookie header:", cookie);
294
302
  options = options || {};
295
303
  options.credentials = "omit";
304
+ const existingHeaders = {};
305
+ if (options.headers) {
306
+ if (options.headers instanceof Headers) {
307
+ options.headers.forEach((value, key) => {
308
+ existingHeaders[key] = value;
309
+ });
310
+ } else if (Array.isArray(options.headers)) {
311
+ options.headers.forEach(([key, value]) => {
312
+ existingHeaders[key] = value;
313
+ });
314
+ } else {
315
+ Object.assign(existingHeaders, options.headers);
316
+ }
317
+ }
296
318
  options.headers = {
297
- ...options.headers,
319
+ ...existingHeaders,
298
320
  cookie
299
321
  };
322
+ console.log("[Capacitor] init: headers set:", options.headers);
300
323
  if (scheme) {
301
324
  options.headers = {
302
325
  ...options.headers,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "abckit",
3
3
  "type": "module",
4
- "version": "0.0.64",
4
+ "version": "0.0.66",
5
5
  "description": "Nuxt 4 module — UI components, auth, storage, GraphQL",
6
6
  "author": "productdevbook",
7
7
  "license": "MIT",