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

create event interface #7

Closed
wants to merge 2 commits into from
Closed

create event interface #7

wants to merge 2 commits into from

Conversation

kennyklaviyo
Copy link
Contributor

No description provided.

@@ -108,7 +108,7 @@ dependencies {
// For < 0.71, this will be from the local maven repo
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-android:0.73.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should keep a pinned version

Copy link

Choose a reason for hiding this comment

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

Yah or maybe a range of versions?

Copy link
Contributor

@evan-masseau evan-masseau left a comment

Choose a reason for hiding this comment

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

I like it

export interface Spec extends TurboModule {
createEvent(event: IEvent): void;
}
export interface KlaviyoSpec extends TurboModule, KlaviyoEventAPI {}
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@evan-masseau evan-masseau Dec 21, 2023

Choose a reason for hiding this comment

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

This may cause a turbo modules issue. I was about to suggest we extract this interface to its own file but I happened on this first which explains some naming conventions involved in turbo modules code gen. It mentions the filename, but doesn't say whether this interface has to be called Spec.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yea here we go https://dev.to/amazonappdev/a-guide-to-turbo-modules-in-react-native-5aa3

This interface type must be named Spec for a Turbo Module.

Maybe lets leave this file as-is from the code generator, and have a IKlaviyo in a separate file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i mean sure the naming of the file can be Spec if thats required but i dont see a point in defining another interface that mirrors this spec interface

properties?: Object;
type KlaviyoEventPropertyType = EventProperty | string;

export interface KlaviyoEventAPI {
Copy link
Contributor

Choose a reason for hiding this comment

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

💯


interface IKlaviyo {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we'll wind up with IKlaviyo again for initialize, but we can add it back

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this can just implement Spec instead if thats the case, as long as its a single interface

KlaviyoReactNativeSdk.createEvent(event);
export const Klaviyo: KlaviyoSpec = {
createEvent(name: EventType, properties?: Record<any, Object>): void {
this.createCustomEvent(name, properties);
Copy link
Contributor

Choose a reason for hiding this comment

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

does this need .toString() ?

@kennyklaviyo kennyklaviyo deleted the impl-event-api branch January 16, 2024 19:50
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.

3 participants