@lookiero/checkout 0.6.0-beta.40 → 0.6.0-beta.41

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.
@@ -73,12 +73,22 @@ const sentryLogger = ({ publicKey, environment, release, project }) => {
73
73
  });
74
74
  return new Hub(client);
75
75
  };
76
+ /**
77
+ * BrowserClient must be initialized before wrapUseRoutes is used.
78
+ *
79
+ * ReactNativeClient cannot be initialized until actual component is rendered.
80
+ * Its initialization will trigger the native sdk setup with the provided settings,
81
+ * but by the time an event will be sent to Sentry, the host project (UAF)
82
+ * will have overrided its configuration (dsn, etc) after initializing it
83
+ * so we have to initialize it on the component mount.
84
+ */
85
+ if (Platform.OS === "web") {
86
+ currentHub = initHub();
87
+ }
76
88
  const onMount = (customerId) => {
77
- if (!currentHub) {
78
- currentHub = initHub();
79
- currentHub.setUser({ id: customerId });
80
- currentHub.startSession();
81
- }
89
+ currentHub = currentHub ?? initHub();
90
+ currentHub.setUser({ id: customerId });
91
+ currentHub.startSession();
82
92
  if (!globalHub) {
83
93
  globalHub = makeMain(currentHub);
84
94
  }
@@ -87,7 +97,6 @@ const sentryLogger = ({ publicKey, environment, release, project }) => {
87
97
  if (currentHub) {
88
98
  currentHub.setUser(null);
89
99
  currentHub.endSession();
90
- currentHub = null;
91
100
  }
92
101
  if (globalHub) {
93
102
  makeMain(globalHub);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.6.0-beta.40",
3
+ "version": "0.6.0-beta.41",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [