Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {
IGUser,
InstagramInsightsResult,
AppData,
ExtendedDeviceInfo
ExtendedDeviceInfo,
AbstractCrudObject
} from 'facebook-nodejs-business-sdk';
import { FacebookRequestError } from 'facebook-nodejs-business-sdk/src/exceptions';
import TEventRequest from "facebook-nodejs-business-sdk/src/objects/serverside/event-request";
Expand Down Expand Up @@ -103,18 +104,18 @@ async function checkType() {
}

async function testConversionEvent(): Promise<TEventRequest> {
const userData = (new UserData('[email protected]','','','','','','','','','','','','','','','','','','','','','','','','',''))
const userData = (new UserData())
.setEmails(['[email protected]'])
.setPhones(['12345678901', '14251234567']);

const content = new Content('product123',5,2,'','','','','');
const content = new Content();

const customData = (new CustomData(2,'','','',[],[],'','',0,0,'','','','',{}))
const customData = (new CustomData())
.setContents([content]);
const extendedDeviceInfo = new ExtendedDeviceInfo('','','','','','','','','',0,0,'',0,0,0,'');
const appData = new AppData(false, false, '',false, extendedDeviceInfo, false, false, '', '', '', '', '');
const extendedDeviceInfo = new ExtendedDeviceInfo();
const appData = new AppData();

const serverEvent = (new ServerEvent('',0,'',userData,customData,appData,'',false,'',[],0,0,'',false,''))
const serverEvent = (new ServerEvent())
.setEventName('Purchase')
.setEventTime(123)
.setUserData(userData)
Expand All @@ -132,3 +133,8 @@ async function checkStaticFields() {
const fields = [IGUser.Fields.biography, IGUser.Fields.follows_count];
const metrics = [InstagramInsightsResult.Metric.reach, InstagramInsightsResult.Metric.shares];
}

export function testAbstractCrudObjectClassConstructor () {
const abstractCrudObject = new AbstractCrudObject();
const abstractCrudObject2 = new AbstractCrudObject('some-id');
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class AbstractCrudObject extends AbstractObject {
* @param {String} parentId
* @param {FacebookAdApi} [api]
*/
constructor(id: number | (string | null | undefined), data: Record<string, any>, parentId: string | null | undefined, api: FacebookAdsApi | null | undefined);
constructor(id?: number |string | null, data?: Record<string, any>, parentId?: string | null , api?: FacebookAdsApi | null );
/**
* Define data getter and setter recording changes
* @param {String} field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class AppData {
_receipt_data: string;
_url_schemes: string;
_windows_attribution_id: string;
constructor(application_tracking_enabled: boolean, advertiser_tracking_enabled: boolean, campaign_ids: string, consider_views: boolean, extinfo: ExtendedDeviceInfo, include_dwell_data: boolean, include_video_data: boolean, install_referrer: string, installer_package: string, receipt_data: string, url_schemes: string, windows_attribution_id: string);
constructor(application_tracking_enabled?: boolean, advertiser_tracking_enabled?: boolean, campaign_ids?: string, consider_views?: boolean, extinfo?: ExtendedDeviceInfo, include_dwell_data?: boolean, include_video_data?: boolean, install_referrer?: string, installer_package?: string, receipt_data?: string, url_schemes?: string, windows_attribution_id?: string);
get application_tracking_enabled(): boolean;
set application_tracking_enabled(application_tracking_enabled: boolean);
setApplicationTrackingEnabled(application_tracking_enabled: boolean): AppData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class Content {
* @param {String} category Category of the Item.
* @param {String} delivery_category The type of delivery for a purchase event
*/
constructor(id: string, quantity: number, item_price: number, title: string, description: string, brand: string, category: string, delivery_category: string);
constructor(id?: string, quantity?: number, item_price?: number, title?: string, description?: string, brand?: string, category?: string, delivery_category?: string);
/**
* Gets the Product Id of the Item.
* A string representing the unique Id for the product.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class CustomData {
* @param {String} delivery_category The type of delivery for a purchase event
* @param {Object} custom_properties Custom Properties to be added to the Custom Data
*/
constructor(value: number, currency: string, content_name: string, content_category: string, content_ids: string[], contents: Content[], content_type: string, order_id: string, predicted_ltv: number, num_items: number, search_string: string, status: string, item_number: string, delivery_category: string, custom_properties: Record<string, any>);
constructor(value?: number, currency?: string, content_name?: string, content_category?: string, content_ids?: string[], contents?: Content[], content_type?: string, order_id?: string, predicted_ltv?: number, num_items?: number, search_string?: string, status?: string, item_number?: string, delivery_category?: string, custom_properties?: Record<string, any>);
/**
* Gets the value of the custom data.
* A numeric value associated with this event. This could be a monetary value or a value in some other metric.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class ExtendedDeviceInfo {
_total_disk_space_gb: number;
_free_disk_space_gb: number;
_device_time_zone: string;
constructor(ext_info_version: string, app_package_name: string, short_version: string, long_version: string, os_version: string, device_model_name: string, locale: string, timezone_abbreviation: string, carrier: string, screen_width: number, screen_height: number, screen_density: string, cpu_core_count: number, total_disk_space_gb: number, free_disk_space_gb: number, device_time_zone: string);
constructor(ext_info_version?: string, app_package_name?: string, short_version?: string, long_version?: string, os_version?: string, device_model_name?: string, locale?: string, timezone_abbreviation?: string, carrier?: string, screen_width?: number, screen_height?: number, screen_density?: string, cpu_core_count?: number, total_disk_space_gb?: number, free_disk_space_gb?: number, device_time_zone?: string);
get ext_info_version(): string;
set ext_info_version(ext_info_version: string);
setExtInfoVersion(ext_info_version: string): ExtendedDeviceInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class ServerEvent {
* @param {Boolean} advertiser_tracking_enabled A boolean that indicates whether the user has opted into/out of advertiser tracker on apps.
* @param {String} messaging_channel Indicates which channel was used to send the message.
*/
constructor(event_name: string, event_time: number, event_source_url: string, user_data: UserData, custom_data: CustomData, app_data: AppData, event_id: string, opt_out: boolean, action_source: string, data_processing_options: string[], data_processing_options_country: number, data_processing_options_state: number, advanced_measurement_table: string, advertiser_tracking_enabled: boolean, messaging_channel: string);
constructor(event_name?: string, event_time?: number, event_source_url?: string, user_data?: UserData, custom_data?: CustomData, app_data?: AppData, event_id?: string, opt_out?: boolean, action_source?: string, data_processing_options?: string[], data_processing_options_country?: number, data_processing_options_state?: number, advanced_measurement_table?: string, advertiser_tracking_enabled?: boolean, messaging_channel?: string);
/**
* Gets the Event Name for the current Event.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default class UserData {
* @param {String} ctwa_clid ID of a conversation that was started on WhatsApp
* @param {String} page_id ID of the page that the ad is associated with
*/
constructor(email: string, phone: string, gender: string, first_name: string, last_name: string, date_of_birth: string, city: string, state: string, zip: string, country: string, external_id: string, client_ip_address: string, client_user_agent: string, fbp: string, fbc: string, subscription_id: string, fb_login_id: string, lead_id: string, dobd: string, dobm: string, doby: string, madid: string, anon_id: string, app_user_id: string, ctwa_clid: string, page_id: string);
constructor(email?: string, phone?: string, gender?: string, first_name?: string, last_name?: string, date_of_birth?: string, city?: string, state?: string, zip?: string, country?: string, external_id?: string, client_ip_address?: string, client_user_agent?: string, fbp?: string, fbc?: string, subscription_id?: string, fb_login_id?: string, lead_id?: string, dobd?: string, dobm?: string, doby?: string, madid?: string, anon_id?: string, app_user_id?: string, ctwa_clid?: string, page_id?: string);
static get Gender(): Record<string, any>;
/**
* Gets the email address for the user data field.
Expand Down