Skip to content

Commit

Permalink
feat: create index.d.ts (#13)
Browse files Browse the repository at this point in the history
Co-authored-by: joe-pritchard <joe@joe-pritchard.uk>
  • Loading branch information
joe-pritchard committed Nov 1, 2020
1 parent 92d6167 commit eb2c9cd
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* eslint-disable camelcase */
import Vue from 'vue';

type FacebookEvent =
| 'AddPaymentInfo'
| 'AddToCart'
| 'AddToWishlist'
| 'CompleteRegistration'
| 'Contact'
| 'CustomizeProduct'
| 'Donate'
| 'InitiateCheckout'
| 'Lead'
| 'PageView'
| 'Purchase'
| 'Schedule'
| 'Search'
| 'StartTrial'
| 'SubmitApplication'
| 'Subscribe'
| 'ViewContent'
| string;

interface FacebookContentObject {
id: string;
quantity: number;
[prop: string]: string | number;
}

interface FacebookEventParameters {
content_category?: string;
content_ids?: Array<number | string>;
content_name?: string;
content_type?: 'product' | 'product_group';
contents?: FacebookContentObject[];
currency?: string; // The currency for the value specified.
num_items?: number; // Used with InitiateCheckout event. The number of items when checkout was initiated.
predicted_ltv?: number; // Predicted lifetime value of a subscriber as defined by the advertiser and expressed as an exact value.
search_string?: string; // Used with the Search event. The string entered by the user for the search.
status?: boolean; // Used with the CompleteRegistration event, to show the status of the registration.
value?: number; // The value of a user performing this event to the business.
}

interface NuxtFacebookPixel {
enable(): void;
init(): void;
track(event: null | FacebookEvent, parameters?: FacebookEventParameters): void;
query<T extends object>(key: string, value: string, parameters?: T): void;
}

declare module 'vue/types/vue' {
interface Vue {
$fb: NuxtFacebookPixel;
}
}

0 comments on commit eb2c9cd

Please sign in to comment.