1.1.13 • Published 2 years ago

apester-react-widgets v1.1.13

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Usage

npm install apester-react-widgets # or yarn add apester-react-widgets

ApesterMediaWidget

import React from 'react'
import { ApesterMediaWidget } from 'apester-react-widgets';

interface WidgetProps {
    id?: string;
    height?: string;
    className?: string;
    results?: string;
    autoCloseOnFinish?: boolean;
    autoCloseTimeout?: number;
    'data-media-id': string;
    'data-token'?: string;
    'data-campaign-id'?: string;
    'data-auto-fullscreen'?: string;
    'data-manual-top'?: string;
    'data-manual-top-desktop'?: string;
    'data-manual-top-mobile'?: string;
    'external-id'?: string;
    sandboxMode?: boolean;
    'agencyData'?: {
        agencyName: string;
        agencyImage: string;
    };
}

// Render your Apester unit
<ApesterMediaWidget data-media-id="{{apester unit id}}" />

ApesterEvent

This component injects event listener into your project.

import React, { useCallback } from 'react'
import { ApesterEvent } from 'apester-react-widgets';

interface MessageValues {
    type: 'picked_answer' | 'refresh_companion_ad' | 'finished_interaction' | 'last_slide_reached' | 'fullscreen_on' | 'fullscreen_off' | 'apester_resize_unit'| 'apester_interaction_loaded' | 'slide_loaded'
    data: {
        answerId: string
        answerText: string
        interactionId: string
        interactionIndex: number
        interactionTitle: string
        slideId: string
        slideTitle: string
        slidePosition: number
        isCorrectAnswer: boolean
    }
}

interface ApesterEventProps {
    callback: (data: MessageValues['data'], type: MessageValues['type']) => void;
    type: MessageValues['type']
}



const callback = useCallback((data, type) => {
    console.log('unit data', data);
    console.log('type', type);
}, []);

<ApesterEvent type="picked_answer" callback={callback} />
1.1.13

2 years ago

1.1.12

3 years ago

1.1.11

3 years ago

1.1.10

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago