@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.js CHANGED
@@ -380,7 +380,9 @@ var CloudStorageAdapter = class {
380
380
  const payload = params.get("vizu_auth");
381
381
  if (!payload) return null;
382
382
  try {
383
- const json = JSON.parse(atob(payload));
383
+ const bytes = Uint8Array.from(atob(payload), (c) => c.charCodeAt(0));
384
+ const decoded = new TextDecoder("utf-8").decode(bytes);
385
+ const json = JSON.parse(decoded);
384
386
  if (!json.t || !json.e || !json.u || !json.w) return null;
385
387
  if (json.w !== this.workspace) return null;
386
388
  const stored = {
@@ -3219,6 +3221,7 @@ var Vizu = class {
3219
3221
  this.opts.namespace = options.namespace ?? DEFAULTS.namespace;
3220
3222
  this.opts.accent = options.accent ?? DEFAULTS.accent;
3221
3223
  this.parsedShortcut = parseShortcut(this.opts.shortcut);
3224
+ this.user = options.user ?? null;
3222
3225
  this.storage = resolveStorage(
3223
3226
  options.storage,
3224
3227
  options.cloud,
@@ -3227,7 +3230,6 @@ var Vizu = class {
3227
3230
  if (info.user) this.setUser(info.user);
3228
3231
  }
3229
3232
  );
3230
- this.user = options.user ?? null;
3231
3233
  if (options.actions) this.actions = [...options.actions];
3232
3234
  if (options.onCommentAdded) this.bus.on("comment:added", (p) => options.onCommentAdded(p.comment));
3233
3235
  if (options.onCommentRemoved) this.bus.on("comment:removed", (p) => options.onCommentRemoved(p.id));