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

[Types] Made a simple type file #16

Open
MylesWardell opened this issue Jan 7, 2025 · 1 comment
Open

[Types] Made a simple type file #16

MylesWardell opened this issue Jan 7, 2025 · 1 comment

Comments

@MylesWardell
Copy link

MylesWardell commented Jan 7, 2025

I have not searched the documentation and did not check the work too closely

and I did this more as a hacky fix to having untyped functions called in our repo. Would be great if an official TS type file was added.

For context we are only using configure and click.

everflow.d.ts

declare module '@everflow/everflow-sdk' {
  class EverflowSDK {
    configure(options: {
      tracking_domain: string
      tld?: string // Top level TLD without http(s)
      organic?: {
        offer_id: number
        affiliate_id: number
      }
    }): void
    getAdvertiserTransactionId(advertiserId): string
    getTransactionId(offerId): string
    impression(options: {
      offer_id: number // Required. The offer id
      affiliate_id: number //Required. The affiliate id

      // Optional. Sub placement values.
      sub1?: string
      sub2?: string
      sub3?: string
      sub4?: string
      sub5?: string
      source_id?: string

      fbclid?: string // Facebook unique click ID
      gclid?: string // Google unique click ID
    }): Promise<string>

    click(options: {
      offer_id: number // Required. The offer id
      affiliate_id: number //Required. The affiliate id

      uid?: number // Optional : Offer URL Id
      creative_id?: number // Optional : Offer Creative ID
      tracking_domain?: string

      // Optional. Sub placement values.
      sub1?: string
      sub2?: string
      sub3?: string
      sub4?: string
      sub5?: string
      source_id?: string
      coupon_code?: string // Optional Coupon Code at the click level
      fbclid?: string // Facebook unique click ID
      gclid?: string // Google unique click ID
      ttclid?: string // TikTok unique click ID
    }): Promise<string>

    conversion(options: {
      offer_id?: number // The offer id. Required if aid is not provided
      aid?: number // The advertiser id. Required if offer_id is not provided
      transaction_id?: string // Optional. The Everflow unique transaction id

      amount?: number // Optional. Sale Amount -- relevant for RPS offers

      event_id?: number // Optional. The event id
      coupon_code?: string // Optional. Coupon code

      adv_event_id?: number // Optional. If you use global advertiser events

      order_id?: string // Optional
      user_id?: string // Optional. User tracking

      verification_token?: string // Required if the advertiser is configured to use verification tokens
      email?: string // Optional

      // Optional. Adv placement values.
      adv1?: string
      adv2?: string
      adv3?: string
      adv4?: string
      adv5?: string
    }): Promise<{ transaction_id: string; conversion_id: string }>
    urlParameter(): string | null
  }

  export default new EverflowSDK()
}
@jonathanbl
Copy link
Contributor

Thank you for the feedback @MylesWardell. Without confirming we will be supporting TS, we do plan to update our SDK in the upcoming months. That being said, please reach out to [email protected] if you need specific help installing / hosting our SDK.

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

No branches or pull requests

2 participants