@formo/analytics 1.17.3 → 1.17.5

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.
Files changed (73) hide show
  1. package/package.json +4 -1
  2. package/.env.example +0 -1
  3. package/.github/workflows/ci.yml +0 -50
  4. package/.github/workflows/release.yml +0 -54
  5. package/.husky/post-commit +0 -7
  6. package/.husky/pre-commit +0 -11
  7. package/.releaserc.js +0 -35
  8. package/CONTRIBUTING.md +0 -83
  9. package/scripts/generate-sri.sh +0 -52
  10. package/src/FormoAnalytics.ts +0 -1031
  11. package/src/FormoAnalyticsProvider.tsx +0 -84
  12. package/src/constants/base.ts +0 -6
  13. package/src/constants/config.ts +0 -660
  14. package/src/constants/events.ts +0 -21
  15. package/src/constants/index.ts +0 -3
  16. package/src/global.d.ts +0 -12
  17. package/src/index.ts +0 -3
  18. package/src/lib/event/EventFactory.ts +0 -519
  19. package/src/lib/event/EventManager.ts +0 -39
  20. package/src/lib/event/constants.ts +0 -4
  21. package/src/lib/event/index.ts +0 -3
  22. package/src/lib/event/type.ts +0 -9
  23. package/src/lib/event/utils.ts +0 -33
  24. package/src/lib/fetch.ts +0 -3
  25. package/src/lib/index.ts +0 -5
  26. package/src/lib/logger/Logger.ts +0 -115
  27. package/src/lib/logger/index.ts +0 -2
  28. package/src/lib/logger/type.ts +0 -14
  29. package/src/lib/queue/EventQueue.ts +0 -306
  30. package/src/lib/queue/index.ts +0 -2
  31. package/src/lib/queue/type.ts +0 -6
  32. package/src/lib/ramda/internal/_curry1.ts +0 -19
  33. package/src/lib/ramda/internal/_curry2.ts +0 -37
  34. package/src/lib/ramda/internal/_curry3.ts +0 -68
  35. package/src/lib/ramda/internal/_has.ts +0 -3
  36. package/src/lib/ramda/internal/_isObject.ts +0 -3
  37. package/src/lib/ramda/internal/_isPlaceholder.ts +0 -5
  38. package/src/lib/ramda/mergeDeepRight.ts +0 -13
  39. package/src/lib/ramda/mergeDeepWithKey.ts +0 -22
  40. package/src/lib/ramda/mergeWithKey.ts +0 -28
  41. package/src/lib/storage/StorageManager.ts +0 -51
  42. package/src/lib/storage/built-in/blueprint.ts +0 -17
  43. package/src/lib/storage/built-in/cookie.ts +0 -60
  44. package/src/lib/storage/built-in/memory.ts +0 -23
  45. package/src/lib/storage/built-in/web.ts +0 -57
  46. package/src/lib/storage/constant.ts +0 -2
  47. package/src/lib/storage/index.ts +0 -25
  48. package/src/lib/storage/type.ts +0 -21
  49. package/src/lib/version.ts +0 -2
  50. package/src/types/base.ts +0 -120
  51. package/src/types/events.ts +0 -126
  52. package/src/types/index.ts +0 -3
  53. package/src/types/provider.ts +0 -17
  54. package/src/utils/address.ts +0 -43
  55. package/src/utils/base.ts +0 -3
  56. package/src/utils/converter.ts +0 -44
  57. package/src/utils/generate.ts +0 -16
  58. package/src/utils/index.ts +0 -4
  59. package/src/utils/timestamp.ts +0 -9
  60. package/src/validators/address.ts +0 -69
  61. package/src/validators/agent.ts +0 -4
  62. package/src/validators/checks.ts +0 -160
  63. package/src/validators/index.ts +0 -7
  64. package/src/validators/network.ts +0 -34
  65. package/src/validators/object.ts +0 -4
  66. package/src/validators/string.ts +0 -4
  67. package/src/validators/uint8array.ts +0 -17
  68. package/test/lib/events.spec.ts +0 -12
  69. package/test/utils/address.spec.ts +0 -14
  70. package/test/utils/converter.spec.ts +0 -31
  71. package/test/validators/address.spec.ts +0 -15
  72. package/tsconfig.json +0 -28
  73. package/webpack.config.ts +0 -23
@@ -1,84 +0,0 @@
1
- import { createContext, useContext, useEffect, useRef, useState } from "react";
2
- import { FormoAnalytics } from "./FormoAnalytics";
3
- import { initStorageManager, logger } from "./lib";
4
- import { FormoAnalyticsProviderProps, IFormoAnalytics } from "./types";
5
-
6
- const defaultContext: IFormoAnalytics = {
7
- chain: () => Promise.resolve(),
8
- page: () => Promise.resolve(),
9
- reset: () => Promise.resolve(),
10
- detect: () => Promise.resolve(),
11
- connect: () => Promise.resolve(),
12
- disconnect: () => Promise.resolve(),
13
- signature: () => Promise.resolve(),
14
- transaction: () => Promise.resolve(),
15
- identify: () => Promise.resolve(),
16
- track: () => Promise.resolve(),
17
- };
18
-
19
- export const FormoAnalyticsContext =
20
- createContext<IFormoAnalytics>(defaultContext);
21
-
22
- export const FormoAnalyticsProvider = (props: FormoAnalyticsProviderProps) => {
23
- const { writeKey, disabled = false, children } = props;
24
-
25
- // Keep the app running without analytics if no Write Key is provided or disabled
26
- if (!writeKey) {
27
- console.error("FormoAnalyticsProvider: No Write Key provided");
28
- return children;
29
- }
30
-
31
- if (disabled) {
32
- console.warn("FormoAnalytics is disabled");
33
- return children;
34
- }
35
-
36
- return <InitializedAnalytics {...props} />;
37
- };
38
-
39
- const InitializedAnalytics = ({
40
- writeKey,
41
- options,
42
- children,
43
- }: FormoAnalyticsProviderProps) => {
44
- const [sdk, setSdk] = useState<IFormoAnalytics>(defaultContext);
45
- const initializedStartedRef = useRef(false);
46
- initStorageManager(writeKey);
47
-
48
- const initializeFormoAnalytics = async (writeKey: string, options: any) => {
49
- try {
50
- const sdkInstance = await FormoAnalytics.init(writeKey, options);
51
- setSdk(sdkInstance);
52
- console.log("FormoAnalytics SDK initialized successfully");
53
- } catch (error) {
54
- console.error("Failed to initialize FormoAnalytics SDK", error);
55
- }
56
- };
57
-
58
- useEffect(() => {
59
- const initialize = async () => {
60
- if (initializedStartedRef.current) return;
61
- initializedStartedRef.current = true;
62
-
63
- await initializeFormoAnalytics(writeKey!, options);
64
- };
65
-
66
- initialize();
67
- }, [writeKey, options]);
68
-
69
- return (
70
- <FormoAnalyticsContext.Provider value={sdk}>
71
- {children}
72
- </FormoAnalyticsContext.Provider>
73
- );
74
- };
75
-
76
- export const useFormo = () => {
77
- const context = useContext(FormoAnalyticsContext);
78
-
79
- if (!context) {
80
- logger.warn("useFormo called without a valid context");
81
- }
82
-
83
- return context; // Return undefined if SDK is not initialized, handle accordingly in consumer
84
- };
@@ -1,6 +0,0 @@
1
- export const SESSION_TRAFFIC_SOURCE_KEY = "traffic-source";
2
- export const SESSION_WALLET_DETECTED_KEY = "wallet-detected";
3
- export const SESSION_CURRENT_URL_KEY = "analytics-current-url";
4
- export const SESSION_USER_ID_KEY = "user-id";
5
-
6
- export const LOCAL_ANONYMOUS_ID_KEY = "anonymous-id";