Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use setter method when creating components to track usage of reactsdk #20

Merged
merged 6 commits into from
Aug 28, 2023

Conversation

jojo-stripe
Copy link
Contributor

@jojo-stripe jojo-stripe commented Aug 25, 2023

This will track usage of reactsdk and also the package used
Casting the connect instance as any so we don't have to surface this method to the Connect Instance interface

@jojo-stripe jojo-stripe changed the title Add sdk option to create to track usage of reactsdk Use setter method when creating components to track usage of reactsdk Aug 28, 2023
Copy link
Contributor

@jorgea-stripe jorgea-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -10,7 +10,8 @@
"removeComments": false,
"strict": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true
"esModuleInterop": true,
"resolveJsonModule": true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -13,6 +14,7 @@ export const useCreateComponent = (

React.useLayoutEffect(() => {
if (wrapperDivRef.current !== null && component === null) {
(connectInstance as any).setReactSdkAnalytics(version);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can declare an interface above if to avoid this as any i.e. as IConnectJSWithPrivateMethods. Looking at this also makes me a bit nervous, would you mind doing this in a try catch and simply logging a warning in the try catch? Trying to avoid a possible future incident.

@jojo-stripe jojo-stripe merged commit 2d58526 into master Aug 28, 2023
1 check passed
@jojo-stripe jojo-stripe deleted the jojo/metaoption branch August 28, 2023 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants