Skip to content

Commit

Permalink
feat(facebook): add EVENTS constant (#1510)
Browse files Browse the repository at this point in the history
* improve(facebook): added missing EVENTS

* Update index.ts

* lint
  • Loading branch information
danielsogl authored and ihadeed committed May 9, 2017
1 parent d25b2f1 commit aa9826f
Showing 1 changed file with 52 additions and 14 deletions.
66 changes: 52 additions & 14 deletions src/@ionic-native/plugins/facebook/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ export interface FacebookLoginResponse {
* .catch(e => console.log('Error logging into Facebook', e));
*
*
* this.fb.logEvent(this.fb.EVENTS.EVENT_NAME_ADDED_TO_CART);
*
* ```
*
*/
Expand All @@ -119,6 +121,41 @@ export interface FacebookLoginResponse {
@Injectable()
export class Facebook extends IonicNativePlugin {

EVENTS: {
EVENT_NAME_ACTIVATED_APP: 'fb_mobile_activate_app',
EVENT_NAME_DEACTIVATED_APP: 'fb_mobile_deactivate_app',
EVENT_NAME_SESSION_INTERRUPTIONS: 'fb_mobile_app_interruptions',
EVENT_NAME_TIME_BETWEEN_SESSIONS: 'fb_mobile_time_between_sessions',
EVENT_NAME_COMPLETED_REGISTRATION: 'fb_mobile_complete_registration',
EVENT_NAME_VIEWED_CONTENT: 'fb_mobile_content_view',
EVENT_NAME_SEARCHED: 'fb_mobile_search',
EVENT_NAME_RATED: 'fb_mobile_rate',
EVENT_NAME_COMPLETED_TUTORIAL: 'fb_mobile_tutorial_completion',
EVENT_NAME_PUSH_TOKEN_OBTAINED: 'fb_mobile_obtain_push_token',
EVENT_NAME_ADDED_TO_CART: 'fb_mobile_add_to_cart',
EVENT_NAME_ADDED_TO_WISHLIST: 'fb_mobile_add_to_wishlist',
EVENT_NAME_INITIATED_CHECKOUT: 'fb_mobile_initiated_checkout',
EVENT_NAME_ADDED_PAYMENT_INFO: 'fb_mobile_add_payment_info',
EVENT_NAME_PURCHASED: 'fb_mobile_purchase',
EVENT_NAME_ACHIEVED_LEVEL: 'fb_mobile_level_achieved',
EVENT_NAME_UNLOCKED_ACHIEVEMENT: 'fb_mobile_achievement_unlocked',
EVENT_NAME_SPENT_CREDITS: 'fb_mobile_spent_credits',
EVENT_PARAM_CURRENCY: 'fb_currency',
EVENT_PARAM_REGISTRATION_METHOD: 'fb_registration_method',
EVENT_PARAM_CONTENT_TYPE: 'fb_content_type',
EVENT_PARAM_CONTENT_ID: 'fb_content_id',
EVENT_PARAM_SEARCH_STRING: 'fb_search_string',
EVENT_PARAM_SUCCESS: 'fb_success',
EVENT_PARAM_MAX_RATING_VALUE: 'fb_max_rating_value',
EVENT_PARAM_PAYMENT_INFO_AVAILABLE: 'fb_payment_info_available',
EVENT_PARAM_NUM_ITEMS: 'fb_num_items',
EVENT_PARAM_LEVEL: 'fb_level',
EVENT_PARAM_DESCRIPTION: 'fb_description',
EVENT_PARAM_SOURCE_APPLICATION: 'fb_mobile_launch_source',
EVENT_PARAM_VALUE_YES: '1',
EVENT_PARAM_VALUE_NO: '0'
};

/**
* Browser wrapper
* @param {number} appId Your Facebook AppID from their dashboard
Expand All @@ -135,16 +172,17 @@ export class Facebook extends IonicNativePlugin {
*
* ```typescript
* {
* status: "connected",
* status: 'connected',
* authResponse: {
* session_key: true,
* accessToken: "kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn",
* accessToken: 'kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn',
* expiresIn: 5183979,
* sig: "...",
* secret: "...",
* userID: "634565435"
* sig: '...',
* secret: '...',
* userID: '634565435'
* }
* }
*
* ```
*
* @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) this app has upon logging in.
Expand Down Expand Up @@ -174,13 +212,13 @@ export class Facebook extends IonicNativePlugin {
* ```
* {
* authResponse: {
* userID: "12345678912345",
* accessToken: "kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn",
* userID: '12345678912345',
* accessToken: 'kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn',
* session_Key: true,
* expiresIn: "5183738",
* sig: "..."
* expiresIn: '5183738',
* sig: '...'
* },
* status: "connected"
* status: 'connected'
* }
* ```
*
Expand All @@ -204,10 +242,10 @@ export class Facebook extends IonicNativePlugin {
*
* ```
* {
* method: "share",
* href: "http://example.com",
* caption: "Such caption, very feed.",
* description: "Much description",
* method: 'share',
* href: 'http://example.com',
* caption: 'Such caption, very feed.',
* description: 'Much description',
* picture: 'http://example.com/image.png'
* }
* ```
Expand Down

0 comments on commit aa9826f

Please sign in to comment.