@formo/analytics 1.16.18 → 1.16.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formo/analytics",
3
- "version": "1.16.18",
3
+ "version": "1.16.20",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/getformo/sdk.git"
@@ -13,6 +13,7 @@ import {
13
13
  EventManager,
14
14
  EventQueue,
15
15
  IEventManager,
16
+ initStorageManager,
16
17
  logger,
17
18
  Logger,
18
19
  } from "./lib";
@@ -96,6 +97,7 @@ export class FormoAnalytics implements IFormoAnalytics {
96
97
  writeKey: string,
97
98
  options?: Options
98
99
  ): Promise<FormoAnalytics> {
100
+ initStorageManager(writeKey);
99
101
  const analytics = new FormoAnalytics(writeKey, options);
100
102
 
101
103
  // Auto-detect wallet provider
@@ -384,7 +386,10 @@ export class FormoAnalytics implements IFormoAnalytics {
384
386
  try {
385
387
  if (!params) {
386
388
  // If no params provided, auto-identify
387
- logger.info("Auto-identifying with providers:", this._providers.map(p => p.info.name));
389
+ logger.info(
390
+ "Auto-identifying with providers:",
391
+ this._providers.map((p) => p.info.name)
392
+ );
388
393
  for (const providerDetail of this._providers) {
389
394
  const provider = providerDetail.provider;
390
395
  if (!provider) continue;
@@ -392,7 +397,12 @@ export class FormoAnalytics implements IFormoAnalytics {
392
397
  try {
393
398
  const address = await this.getAddress(provider);
394
399
  if (address) {
395
- logger.info("Auto-identifying", address, providerDetail.info.name, providerDetail.info.rdns);
400
+ logger.info(
401
+ "Auto-identifying",
402
+ address,
403
+ providerDetail.info.name,
404
+ providerDetail.info.rdns
405
+ );
396
406
  // NOTE: do not set this.currentAddress without explicit connect or identify
397
407
  await this.identify(
398
408
  {
@@ -8,7 +8,7 @@ const generateAnonymousId = (key: string): AnonymousID => {
8
8
  return storedAnonymousId as AnonymousID;
9
9
  const newAnonymousId = generateNativeUUID();
10
10
  cookie().set(key, newAnonymousId, {
11
- expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365).toISOString(), // 1 year
11
+ maxAge: Date.now() + 1000 * 60 * 60 * 24 * 365, // 1 year
12
12
  domain: getCookieDomain(),
13
13
  path: "/",
14
14
  });
@@ -4,7 +4,7 @@ import { CookieOptions } from "../type";
4
4
  class CookieStorage extends StorageBlueprint {
5
5
  public override isAvailable(): boolean {
6
6
  return (
7
- typeof document !== "undefined" && typeof document.cookie !== "undefined"
7
+ typeof document !== "undefined" && typeof document.cookie === "string"
8
8
  );
9
9
  }
10
10
 
@@ -25,8 +25,7 @@ class CookieStorage extends StorageBlueprint {
25
25
  )}`;
26
26
  if (maxAge) {
27
27
  cookie += "; max-age=" + maxAge;
28
- }
29
- if (expires) {
28
+ } else if (expires) {
30
29
  cookie += "; expires=" + expires;
31
30
  }
32
31
  if (path) {
@@ -41,7 +40,6 @@ class CookieStorage extends StorageBlueprint {
41
40
  if (secure) {
42
41
  cookie += "; secure";
43
42
  }
44
- console.log("final cookie", cookie);
45
43
  document.cookie = cookie;
46
44
  }
47
45
 
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '1.16.18';
2
+ export const version = '1.16.20';