@unhingged/vizu-core 0.1.7 → 0.1.8

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/dist/index.cjs CHANGED
@@ -416,7 +416,9 @@ var CloudStorageAdapter = class {
416
416
  const payload = params.get("vizu_auth");
417
417
  if (!payload) return null;
418
418
  try {
419
- const json = JSON.parse(atob(payload));
419
+ const bytes = Uint8Array.from(atob(payload), (c) => c.charCodeAt(0));
420
+ const decoded = new TextDecoder("utf-8").decode(bytes);
421
+ const json = JSON.parse(decoded);
420
422
  if (!json.t || !json.e || !json.u || !json.w) return null;
421
423
  if (json.w !== this.workspace) return null;
422
424
  const stored = {
@@ -3255,6 +3257,7 @@ var Vizu = class {
3255
3257
  this.opts.namespace = options.namespace ?? DEFAULTS.namespace;
3256
3258
  this.opts.accent = options.accent ?? DEFAULTS.accent;
3257
3259
  this.parsedShortcut = parseShortcut(this.opts.shortcut);
3260
+ this.user = options.user ?? null;
3258
3261
  this.storage = resolveStorage(
3259
3262
  options.storage,
3260
3263
  options.cloud,
@@ -3263,7 +3266,6 @@ var Vizu = class {
3263
3266
  if (info.user) this.setUser(info.user);
3264
3267
  }
3265
3268
  );
3266
- this.user = options.user ?? null;
3267
3269
  if (options.actions) this.actions = [...options.actions];
3268
3270
  if (options.onCommentAdded) this.bus.on("comment:added", (p) => options.onCommentAdded(p.comment));
3269
3271
  if (options.onCommentRemoved) this.bus.on("comment:removed", (p) => options.onCommentRemoved(p.id));