@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/auto.cjs CHANGED
@@ -406,7 +406,9 @@ var CloudStorageAdapter = class {
406
406
  const payload = params.get("vizu_auth");
407
407
  if (!payload) return null;
408
408
  try {
409
- const json = JSON.parse(atob(payload));
409
+ const bytes = Uint8Array.from(atob(payload), (c) => c.charCodeAt(0));
410
+ const decoded = new TextDecoder("utf-8").decode(bytes);
411
+ const json = JSON.parse(decoded);
410
412
  if (!json.t || !json.e || !json.u || !json.w) return null;
411
413
  if (json.w !== this.workspace) return null;
412
414
  const stored = {
@@ -3245,6 +3247,7 @@ var Vizu = class {
3245
3247
  this.opts.namespace = options.namespace ?? DEFAULTS.namespace;
3246
3248
  this.opts.accent = options.accent ?? DEFAULTS.accent;
3247
3249
  this.parsedShortcut = parseShortcut(this.opts.shortcut);
3250
+ this.user = options.user ?? null;
3248
3251
  this.storage = resolveStorage(
3249
3252
  options.storage,
3250
3253
  options.cloud,
@@ -3253,7 +3256,6 @@ var Vizu = class {
3253
3256
  if (info.user) this.setUser(info.user);
3254
3257
  }
3255
3258
  );
3256
- this.user = options.user ?? null;
3257
3259
  if (options.actions) this.actions = [...options.actions];
3258
3260
  if (options.onCommentAdded) this.bus.on("comment:added", (p) => options.onCommentAdded(p.comment));
3259
3261
  if (options.onCommentRemoved) this.bus.on("comment:removed", (p) => options.onCommentRemoved(p.id));