import { defaultValues } from '@segment/actions-core';
import { browserDestination } from '../../runtime/shim';
import identifyUser from './identifyUser';
import trackEvent from './trackEvent';
export const destination = {
    name: 'PlayerZero Web',
    slug: 'actions-playerzero-web',
    mode: 'device',
    settings: {
        projectId: {
            label: 'PlayerZero Project ID',
            description: 'The Project ID where you want to send data. You can find this ID on the [Project Data Collection](https://go.playerzero.app/setting/data) page.',
            type: 'string',
            required: true
        }
    },
    presets: [
        {
            name: 'Track Event',
            subscribe: 'type = "track"',
            partnerAction: 'trackEvent',
            mapping: defaultValues(trackEvent.fields)
        },
        {
            name: 'Identify User',
            subscribe: 'type = "identify"',
            partnerAction: 'identifyUser',
            mapping: defaultValues(identifyUser.fields)
        }
    ],
    initialize: async ({ settings }, deps) => {
        await deps.loadScript(`https://go.playerzero.app/record/${settings.projectId}`);
        await deps.resolveWhen(() => Object.prototype.hasOwnProperty.call(window, 'playerzero'), 250);
        return window.playerzero;
    },
    actions: {
        trackEvent,
        identifyUser
    }
};
export default browserDestination(destination);
//# sourceMappingURL=index.js.map