"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addToCartFields = exports.customFields = exports.searchFields = exports.viewContentFields = exports.initiateCheckoutFields = exports.pageFields = exports.purchaseFields = exports.test_event_code = exports.order_id = exports.event_id = exports.event_source_url = exports.action_source = exports.event_time = exports.num_items = exports.data_processing_options_state = exports.data_processing_options_country = exports.data_processing_options = exports.contents = exports.content_type = exports.content_name = exports.content_ids = exports.content_category = exports.net_revenue = exports.value = exports.currency = exports.custom_data = exports.app_data_field = exports.user_data_field = void 0;
exports.user_data_field = {
    label: 'User Data',
    description: 'These parameters are a set of identifiers Facebook can use for targeted attribution. You must provide at least one of the following parameters in your request. More information on recommended User Data parameters in Facebook’s [Best Practices for Conversions API](https://www.facebook.com/business/help/308855623839366).',
    type: 'object',
    required: true,
    properties: {
        externalId: {
            label: 'External ID',
            description: 'Any unique ID from the advertiser, such as loyalty membership IDs, user IDs, and external cookie IDs. You can send one or more external IDs for a given event.',
            type: 'string',
            multiple: true,
            category: 'hashedPII'
        },
        email: {
            label: 'Email',
            description: 'An email address in lowercase.',
            type: 'string',
            category: 'hashedPII'
        },
        phone: {
            label: 'Phone',
            description: 'A phone number. Include only digits with country code, area code, and number. Remove symbols, letters, and any leading zeros. In addition, always include the country code, even if all of the data is from the same country, as the country code is used for matching.',
            type: 'string',
            category: 'hashedPII'
        },
        gender: {
            label: 'Gender',
            description: 'Gender in lowercase. Either f or m.',
            type: 'string',
            category: 'hashedPII'
        },
        dateOfBirth: {
            label: 'Date of Birth',
            description: 'A date of birth given as year, month, and day. Example: 19971226 for December 26, 1997.',
            type: 'string',
            category: 'hashedPII'
        },
        lastName: {
            label: 'Last Name',
            description: 'A last name in lowercase.',
            type: 'string',
            category: 'hashedPII'
        },
        firstName: {
            label: 'First Name',
            description: 'A first name in lowercase.',
            type: 'string',
            category: 'hashedPII'
        },
        city: {
            label: 'City',
            description: 'A city in lowercase without spaces or punctuation. Example: menlopark.',
            type: 'string',
            category: 'hashedPII'
        },
        state: {
            label: 'State',
            description: 'A two-letter state code in lowercase. Example: ca.',
            type: 'string',
            category: 'hashedPII'
        },
        zip: {
            label: 'Zip Code',
            description: 'A five-digit zip code for United States. For other locations, follow each country`s standards.',
            type: 'string',
            category: 'hashedPII'
        },
        country: {
            label: 'Country',
            description: 'A two-letter country code in lowercase.',
            type: 'string',
            category: 'hashedPII'
        },
        client_ip_address: {
            label: 'Client IP Address',
            description: 'The IP address of the browser corresponding to the event.',
            type: 'string'
        },
        client_user_agent: {
            label: 'Client User Agent',
            description: 'The user agent for the browser corresponding to the event. This is required if action source is “website”.',
            type: 'string'
        },
        fbc: {
            label: 'Click ID',
            description: 'The Facebook click ID value stored in the _fbc browser cookie under your domain.',
            type: 'string'
        },
        fbp: {
            label: 'Browser ID',
            description: 'The Facebook browser ID value stored in the _fbp browser cookie under your domain.',
            type: 'string'
        },
        subscriptionID: {
            label: 'Subscription ID',
            description: 'The subscription ID for the user in this transaction.',
            type: 'string'
        },
        leadID: {
            label: 'Lead ID',
            description: 'The ID associated with a lead generated by Facebook`s Lead Ads.',
            type: 'integer'
        },
        fbLoginID: {
            label: 'Facebook Login ID',
            description: 'The ID issued by Facebook when a person first logs into an instance of an app.',
            type: 'integer'
        },
        anonId: {
            label: 'Install ID (anon_id)',
            description: 'This field represents unique application installation instances. Note: This parameter is for app events only.',
            type: 'string'
        },
        madId: {
            label: 'Advertiser ID (madid)',
            description: 'Your mobile advertiser ID, the advertising ID from an Android device or the Advertising Identifier (IDFA) from an Apple device.',
            type: 'string'
        },
        partner_id: {
            label: 'Partner ID',
            description: 'The ID issued by Facebook identity partner.',
            type: 'string'
        },
        partner_name: {
            label: 'Partner Name',
            description: 'The name of the Facebook identity partner.',
            type: 'string'
        }
    },
    default: {
        externalId: {
            '@if': {
                exists: { '@path': '$.userId' },
                then: { '@path': '$.userId' },
                else: { '@path': '$.anonymousId' }
            }
        },
        email: {
            '@path': '$.context.traits.email'
        },
        phone: {
            '@path': '$.context.traits.phone'
        },
        dateOfBirth: {
            '@path': '$.context.traits.birthday'
        },
        lastName: {
            '@path': '$.context.traits.lastName'
        },
        firstName: {
            '@path': '$.context.traits.firstName'
        },
        city: {
            '@path': '$.context.traits.address.city'
        },
        state: {
            '@path': '$.context.traits.address.state'
        },
        zip: {
            '@path': '$.context.traits.address.postalCode'
        },
        client_ip_address: {
            '@path': '$.context.ip'
        },
        client_user_agent: {
            '@path': '$.context.userAgent'
        },
        fbc: {
            '@path': '$.properties.fbc'
        },
        fbp: {
            '@path': '$.properties.fbp'
        }
    }
};
exports.app_data_field = {
    label: 'App Events Fields',
    description: `These fields support sending app events to Facebook through the Conversions API. For more information about app events support in the Conversions API, see the Facebook docs [here](https://developers.facebook.com/docs/marketing-api/conversions-api/app-events).
  App events sent through the Conversions API must be associated with a dataset.
  Instructions for creating a dataset can be found [here](https://www.facebook.com/business/help/750785952855662?id=490360542427371). Once a dataset is created, the dataset ID
  can be substituted for the pixel ID in the destination settings.`,
    type: 'object',
    properties: {
        use_app_data: {
            label: 'Send App Events?',
            description: 'Segment will not send app events to Facebook by default. Enable this once you have created a dataset in Facebook and are ready to begin sending app events.',
            type: 'boolean',
            default: false
        },
        advertiser_tracking_enabled: {
            label: 'Advertiser Tracking Enabled',
            description: `*Required for app events*
            Use this field to specify ATT permission on an iOS 14.5+ device. Set to 0 for disabled or 1 for enabled.`,
            type: 'boolean'
        },
        application_tracking_enabled: {
            label: 'Application Tracking Enabled',
            type: 'boolean',
            description: `*Required for app events*
            A person can choose to enable ad tracking on an app level. Your SDK should allow an app developer to put an opt-out setting into their app. Use this field to specify the person's choice. Use 0 for disabled, 1 for enabled.`
        },
        version: {
            label: 'ExtInfo Version',
            description: `*Required for app events* Example: 'i2'.`,
            type: 'string',
            choices: [
                { label: 'iOS', value: 'i2' },
                { label: 'Android', value: 'a2' }
            ]
        },
        packageName: {
            label: 'Package Name',
            description: `Example: 'com.facebook.sdk.samples.hellofacebook'.`,
            type: 'string'
        },
        shortVersion: {
            label: 'Short Version',
            description: `Example: '1.0'.`,
            type: 'string'
        },
        longVersion: {
            label: 'Long Version',
            description: `Example: '1.0 long'.`,
            type: 'string'
        },
        osVersion: {
            label: '*Required for app events* OS Version',
            description: `Example: '13.4.1'.`,
            type: 'string'
        },
        deviceName: {
            label: 'Device Model Name',
            description: `Example: 'iPhone5,1'.`,
            type: 'string'
        },
        madId: {
            label: 'Advertiser ID (madid)',
            description: 'Your mobile advertiser ID, the advertising ID from an Android device or the Advertising Identifier (IDFA) from an Apple device.',
            type: 'string'
        },
        locale: {
            label: 'Locale',
            description: `Example: 'En_US'.`,
            type: 'string'
        },
        timezone: {
            label: 'Timezone Abbreviation',
            description: `Example: 'PST'.`,
            type: 'string'
        },
        carrier: {
            label: 'Carrier Name',
            description: `Example: 'AT&T'.`,
            type: 'string'
        },
        width: {
            label: 'Screen Width',
            description: `Example: '1080'.`,
            type: 'string'
        },
        height: {
            label: 'Screen Height',
            description: `Example: '1920'.`,
            type: 'string'
        },
        density: {
            label: 'Screen Density',
            description: `Example: '2.0'.`,
            type: 'string'
        },
        cpuCores: {
            label: 'CPU Cores',
            description: `Example: '8'.`,
            type: 'string'
        },
        storageSize: {
            label: 'Storage Size in GBs',
            description: `Example: '64'.`,
            type: 'string'
        },
        freeStorage: {
            label: 'Free Storage in GBs',
            description: `Example: '32'.`,
            type: 'string'
        },
        deviceTimezone: {
            label: 'Device Timezone',
            description: `Example: 'USA/New York'.`,
            type: 'string'
        }
    },
    default: {
        application_tracking_enabled: {
            '@path': '$.context.device.adTrackingEnabled'
        },
        packageName: {
            '@path': '$.context.app.namespace'
        },
        longVersion: {
            '@path': '$.context.app.version'
        },
        osVersion: {
            '@path': '$.context.os.version'
        },
        deviceName: {
            '@path': '$.context.device.model'
        },
        locale: {
            '@path': '$.context.locale'
        },
        carrier: {
            '@path': '$.context.network.carrier'
        },
        width: {
            '@path': '$.context.screen.width'
        },
        height: {
            '@path': '$.context.screen.height'
        },
        density: {
            '@path': '$.context.screen.density'
        },
        deviceTimezone: {
            '@path': '$.context.timezone'
        },
        madId: {
            '@path': '$.context.madId'
        }
    }
};
exports.custom_data = {
    label: 'Custom Data',
    description: 'The custom data object can be used to pass custom properties. See [Facebook documentation](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/custom-data#custom-properties) for more information.',
    type: 'object',
    defaultObjectUI: 'keyvalue'
};
exports.currency = {
    label: 'Currency',
    description: 'The currency for the value specified. Currency must be a valid ISO 4217 three-digit currency code.',
    type: 'string',
    default: {
        '@path': '$.properties.currency'
    }
};
exports.value = {
    label: 'Value',
    description: 'A numeric value associated with this event. This could be a monetary value or a value in some other metric.',
    type: 'number'
};
exports.net_revenue = {
    label: 'Net Revenue',
    description: 'The numeric net revenue value associated with the purchase event.',
    type: 'number'
};
exports.content_category = {
    label: 'Content Category',
    description: 'The category of the content associated with the event.',
    type: 'string'
};
exports.content_ids = {
    label: 'Content IDs',
    description: 'The content IDs associated with the event, such as product SKUs.',
    type: 'string',
    multiple: true
};
exports.content_name = {
    label: 'Content Name',
    description: 'The name of the page or product associated with the event.',
    type: 'string'
};
exports.content_type = {
    label: 'Content Type',
    description: 'The content type should be set to product or product_group. See [Facebook documentation](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/custom-data) for more information.',
    type: 'string'
};
exports.contents = {
    label: 'Contents',
    description: 'A list of JSON objects that contain the product IDs associated with the event plus information about the products. ID and quantity are required fields.',
    type: 'object',
    multiple: true,
    properties: {
        id: {
            label: 'ID',
            description: 'The product ID of the purchased item.',
            type: 'string'
        },
        quantity: {
            label: 'Quantity',
            description: 'The number of items purchased.',
            type: 'integer'
        },
        item_price: {
            label: 'Item Price',
            description: 'The price of the item.',
            type: 'number'
        },
        delivery_category: {
            label: 'Delivery Category',
            description: 'The type of delivery for a purchase event. Supported values are "in_store", "curbside", and "home_delivery".',
            type: 'string'
        }
    }
};
exports.data_processing_options = {
    label: 'Data Processing Options',
    description: `The Data Processing Options to send to Facebook. If set to true, Segment will send an array to Facebook indicating events should be processed with Limited Data Use (LDU) restrictions. More information can be found in [Facebook’s documentation](https://developers.facebook.com/docs/marketing-apis/data-processing-options).`,
    type: 'boolean'
};
exports.data_processing_options_country = {
    label: 'Data Processing Country',
    description: 'A country that you want to associate to the Data Processing Options. Accepted values are 1, for the United States of America, or 0, to request that Facebook geolocates the event using IP address. This is required if Data Processing Options is set to true. If nothing is provided, Segment will send 0.',
    type: 'number',
    choices: [
        { label: 'Use Facebook’s Geolocation Logic', value: 0 },
        { label: 'United States of America', value: 1 }
    ]
};
exports.data_processing_options_state = {
    label: 'Data Processing State',
    description: 'A state that you want to associate to the Data Processing Options. Accepted values are 1000, for California, or 0, to request that Facebook geolocates the event using IP address. This is required if Data Processing Options is set to true. If nothing is provided, Segment will send 0.',
    type: 'number',
    choices: [
        { label: 'Use Facebook’s Geolocation Logic', value: 0 },
        { label: 'California', value: 1000 },
        { label: 'Colorado', value: 1001 },
        { label: 'Connecticut', value: 1002 },
        { label: 'Florida', value: 1003 },
        { label: 'Oregon', value: 1004 },
        { label: 'Texas', value: 1005 },
        { label: 'Montana', value: 1006 },
        { label: 'Delaware', value: 1007 },
        { label: 'Nebraska', value: 1008 },
        { label: 'New Hampshire', value: 1009 },
        { label: 'New Jersey', value: 1010 }
    ]
};
exports.num_items = {
    label: 'Number of Items',
    description: 'The number of items when checkout was initiated.',
    type: 'integer'
};
exports.event_time = {
    label: 'Event Time',
    description: 'A Unix timestamp in seconds indicating when the actual event occurred. Facebook will automatically convert ISO 8601 timestamps to Unix.',
    type: 'string',
    default: {
        '@path': '$.timestamp'
    }
};
exports.action_source = {
    label: 'Action Source',
    description: 'This field allows you to specify where your conversions occurred. See [Facebook documentation](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/server-event) for supported values.',
    type: 'string',
    choices: [
        { label: 'EMAIL', value: 'email' },
        { label: 'WEBSITE', value: 'website' },
        { label: 'APP', value: 'app' },
        { label: 'PHONE CALL', value: 'phone_call' },
        { label: 'CHAT', value: 'chat' },
        { label: 'PHYSICAL STORE', value: 'physical_store' },
        { label: 'SYSTEM GENERATED', value: 'system_generated' },
        { label: 'OTHER', value: 'other' }
    ]
};
exports.event_source_url = {
    label: 'Event Source URL',
    description: 'The browser URL where the event happened. The URL must begin with http:// or https:// and should match the verified domain. This is required if the action source is "website."',
    type: 'string',
    default: {
        '@path': '$.context.page.url'
    }
};
exports.event_id = {
    label: 'Event ID',
    description: 'This ID can be any unique string. Event ID is used to deduplicate events sent by both Facebook Pixel and Conversions API.',
    type: 'string',
    default: {
        '@path': '$.messageId'
    }
};
exports.order_id = {
    label: 'Order ID',
    description: 'A unique identifier for the purchase event, typically the order ID or transaction ID from your ecommerce system.',
    type: 'string',
    default: {
        '@path': '$.properties.order_id'
    }
};
exports.test_event_code = {
    label: 'Test Event Code',
    type: 'string',
    description: 'Use this field to specify that events should be test events rather than actual traffic. You can find your Test Event Code in your Facebook Events Manager under the "Test events" tab. This property overrides the test event code defined in Settings. You\'ll want to remove your Test Event Code when sending real traffic through this integration.',
    required: false
};
exports.purchaseFields = {
    action_source: { ...exports.action_source, required: true },
    currency: { ...exports.currency, required: true },
    event_time: { ...exports.event_time, required: true },
    user_data: exports.user_data_field,
    app_data_field: exports.app_data_field,
    value: {
        ...exports.value,
        required: true,
        default: { '@path': '$.properties.revenue' }
    },
    net_revenue: exports.net_revenue,
    content_ids: exports.content_ids,
    content_name: exports.content_name,
    content_type: exports.content_type,
    contents: {
        ...exports.contents,
        default: {
            '@arrayPath': [
                '$.properties.products',
                {
                    id: {
                        '@path': '$.product_id'
                    },
                    quantity: {
                        '@path': '$.quantity'
                    },
                    item_price: {
                        '@path': '$.price'
                    }
                }
            ]
        }
    },
    event_id: exports.event_id,
    event_source_url: exports.event_source_url,
    num_items: exports.num_items,
    custom_data: exports.custom_data,
    data_processing_options: exports.data_processing_options,
    data_processing_options_country: exports.data_processing_options_country,
    data_processing_options_state: exports.data_processing_options_state,
    test_event_code: exports.test_event_code
};
exports.pageFields = {
    action_source: { ...exports.action_source, required: true },
    event_time: { ...exports.event_time, required: true },
    user_data: exports.user_data_field,
    app_data_field: exports.app_data_field,
    event_id: exports.event_id,
    event_source_url: exports.event_source_url,
    custom_data: exports.custom_data,
    data_processing_options: exports.data_processing_options,
    data_processing_options_country: exports.data_processing_options_country,
    data_processing_options_state: exports.data_processing_options_state,
    test_event_code: exports.test_event_code
};
exports.initiateCheckoutFields = {
    action_source: { ...exports.action_source, required: true },
    event_time: { ...exports.event_time, required: true },
    user_data: exports.user_data_field,
    app_data_field: exports.app_data_field,
    content_category: exports.content_category,
    content_ids: exports.content_ids,
    contents: {
        ...exports.contents,
        default: {
            '@arrayPath': [
                '$.properties.products',
                {
                    id: {
                        '@path': '$.product_id'
                    },
                    quantity: {
                        '@path': '$.quantity'
                    },
                    item_price: {
                        '@path': '$.price'
                    }
                }
            ]
        }
    },
    currency: exports.currency,
    event_id: exports.event_id,
    event_source_url: exports.event_source_url,
    num_items: exports.num_items,
    value: {
        ...exports.value,
        default: { '@path': '$.properties.revenue' }
    },
    custom_data: exports.custom_data,
    data_processing_options: exports.data_processing_options,
    data_processing_options_country: exports.data_processing_options_country,
    data_processing_options_state: exports.data_processing_options_state,
    test_event_code: exports.test_event_code
};
exports.viewContentFields = {
    action_source: { ...exports.action_source, required: true },
    event_time: { ...exports.event_time, required: true },
    user_data: exports.user_data_field,
    app_data_field: exports.app_data_field,
    content_category: exports.content_category,
    content_ids: { ...exports.content_ids, default: { '@path': '$.properties.product_id' } },
    content_name: exports.content_name,
    content_type: exports.content_type,
    contents: {
        ...exports.contents,
        default: {
            '@arrayPath': [
                '$.properties',
                {
                    id: {
                        '@path': '$.product_id'
                    },
                    quantity: {
                        '@path': '$.quantity'
                    },
                    item_price: {
                        '@path': '$.price'
                    }
                }
            ]
        }
    },
    currency: exports.currency,
    event_id: exports.event_id,
    event_source_url: exports.event_source_url,
    value: { ...exports.value, default: { '@path': '$.properties.price' } },
    custom_data: exports.custom_data,
    data_processing_options: exports.data_processing_options,
    data_processing_options_country: exports.data_processing_options_country,
    data_processing_options_state: exports.data_processing_options_state,
    test_event_code: exports.test_event_code
};
exports.searchFields = {
    action_source: { ...exports.action_source, required: true },
    event_time: { ...exports.event_time, required: true },
    user_data: exports.user_data_field,
    app_data_field: exports.app_data_field,
    content_category: exports.content_category,
    content_ids: exports.content_ids,
    contents: {
        ...exports.contents,
        default: {
            '@arrayPath': [
                '$.properties',
                {
                    id: {
                        '@path': '$.product_id'
                    },
                    quantity: {
                        '@path': '$.quantity'
                    },
                    item_price: {
                        '@path': '$.price'
                    }
                }
            ]
        }
    },
    currency: exports.currency,
    event_id: exports.event_id,
    event_source_url: exports.event_source_url,
    search_string: {
        label: 'Search String',
        description: 'A search query made by a user. This must be a string.',
        type: 'string',
        default: {
            '@path': '$.properties.query'
        }
    },
    value: exports.value,
    custom_data: exports.custom_data,
    data_processing_options: exports.data_processing_options,
    data_processing_options_country: exports.data_processing_options_country,
    data_processing_options_state: exports.data_processing_options_state,
    test_event_code: exports.test_event_code
};
exports.customFields = {
    action_source: { ...exports.action_source, required: true },
    event_name: {
        label: 'Event Name',
        description: 'A Facebook [standard event](https://developers.facebook.com/docs/meta-pixel/implementation/conversion-tracking#standard-events) or [custom event](https://developers.facebook.com/docs/meta-pixel/implementation/conversion-tracking#custom-events) name.',
        type: 'string',
        required: true,
        default: {
            '@path': '$.event'
        }
    },
    event_time: { ...exports.event_time, required: true },
    user_data: exports.user_data_field,
    app_data_field: exports.app_data_field,
    custom_data: exports.custom_data,
    event_id: exports.event_id,
    event_source_url: exports.event_source_url,
    data_processing_options: exports.data_processing_options,
    data_processing_options_country: exports.data_processing_options_country,
    data_processing_options_state: exports.data_processing_options_state,
    test_event_code: exports.test_event_code
};
exports.addToCartFields = {
    action_source: { ...exports.action_source, required: true },
    event_time: { ...exports.event_time, required: true },
    user_data: exports.user_data_field,
    app_data_field: exports.app_data_field,
    content_ids: exports.content_ids,
    content_name: exports.content_name,
    content_type: exports.content_type,
    contents: {
        ...exports.contents,
        default: {
            '@arrayPath': [
                '$.properties',
                {
                    id: {
                        '@path': '$.product_id'
                    },
                    quantity: {
                        '@path': '$.quantity'
                    },
                    item_price: {
                        '@path': '$.price'
                    }
                }
            ]
        }
    },
    currency: exports.currency,
    event_id: exports.event_id,
    event_source_url: exports.event_source_url,
    value: { ...exports.value, default: { '@path': '$.properties.price' } },
    custom_data: exports.custom_data,
    data_processing_options: exports.data_processing_options,
    data_processing_options_country: exports.data_processing_options_country,
    data_processing_options_state: exports.data_processing_options_state,
    test_event_code: exports.test_event_code
};
//# sourceMappingURL=fields.js.map