Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
07e67c8
fix(poool-access): fix audit sendEvent return Type
maximedasilva Jan 17, 2024
c97e51b
Merge branch 'DefinitelyTyped:master' into master
maximedasilva Mar 7, 2024
9b97556
feat(poool-access): add externalLinkClick and add Access/Audit to glo…
maximedasilva Mar 7, 2024
d5a8d69
feat(poool-access): format files
maximedasilva Mar 7, 2024
67450af
Merge branch 'master' of https://github.com/p3ol/DefinitelyTyped
maximedasilva Mar 7, 2024
9887a79
Merge branch 'master' of https://github.com/p3ol/DefinitelyTyped
maximedasilva Jun 26, 2024
75873b8
feat(poool-engage): add poool engage types
maximedasilva Jun 26, 2024
57151f7
feat(poool-engage): rename namespace
maximedasilva Jun 26, 2024
7bf2c36
Merge branch 'DefinitelyTyped:master' into master
maximedasilva Jun 26, 2024
9d4dab5
fix(poool-engage): remove useless deepency
maximedasilva Jun 26, 2024
100702c
Merge branch 'master' of https://github.com/p3ol/DefinitelyTyped
maximedasilva Jun 26, 2024
26c17db
feat(poool-engage): add type tests
maximedasilva Jun 27, 2024
a98792a
Merge branch 'DefinitelyTyped:master' into master
maximedasilva Jun 27, 2024
fdf92e3
feat(poool-engage): add type tests
maximedasilva Jun 27, 2024
6d36071
Merge branch 'master' of https://github.com/p3ol/DefinitelyTyped
maximedasilva Jun 27, 2024
3ed06b5
feat(poool-engage): fix wordings
maximedasilva Jun 27, 2024
745b543
feat(poool-engage): format files
maximedasilva Jun 27, 2024
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
5 changes: 5 additions & 0 deletions types/poool-engage/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!**/*.d.ts
!**/*.d.cts
!**/*.d.mts
!**/*.d.*.ts
308 changes: 308 additions & 0 deletions types/poool-engage/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,308 @@
declare global {
var Engage: PooolEngage.Engage;
/**
* Use PooolEngage just if you have done `Engage.noConflict()` before
*/
var PooolEngage: PooolEngage.Engage;

interface Window {
Engage: PooolEngage.Engage;
/**
* Use PooolEngage just if you have done `Engage.noConflict()` before
*/
PooolEngage: PooolEngage.Engage;
}
}
export namespace PooolEngage {
interface EngageConfigOptions {
/**
* When debug mode is enabled, Engage.js will log everything it does in the browser console.
*
* default: `false`
*
* More infos: https://www.poool.dev/docs/engage/javascript/configuration#debug
*/
debug?: boolean;

/**
* When autoPageViews is enabled, Engage.js will automatically increment the page views counter on every page load (front-end applications using virtual routing should commit pageviews using .commitPageView()).
*
* default: `true`
*
* More infos: https://www.poool.dev/docs/engage/javascript/configuration#autopageviews
*/
autoPageViews?: boolean;

/**
* Used to enable Stripe credit card form fields inside elements.
*
* default: `null`
*
* More infos: https://www.poool.dev/docs/engage/javascript/configuration#stripepublickey
*/
stripePublicKey?: string;

/**
* The locale used by default texts inside elements.
*
* default: `en`
*
* More infos: https://www.poool.dev/docs/engage/javascript/configuration#locale
*/
locale?: "fr" | "en";

/**
* Enable/disable automatic Piano tracking for particular events.
⚠️ Piano SDK integration required, i.e using pa() tracking method.
*
* default: `false`
*
* More infos: https://www.poool.dev/docs/engage/javascript/configuration#pianoautotrackingenabled
*/
pianoAutoTrackingEnabled?: boolean;

/**
* Enable/disable automatic Google Analytics 4 tracking (Google Analytics 4 tag required) for particular events.
⚠️ Google Analytics 4 integration required, i.e using gtag() tracking method
*
* default: `false`
*
* More infos: https://www.poool.dev/docs/engage/javascript/configuration#gtagautotrackingenabled
*/
gtagAutoTrackingEnabled?: boolean;
}

interface EngageConfig {
/**
* While the default configuration works for most use cases, you might want to configure some of Engage.js behaviors.
*
* ℹ️ Your Dashboard configuration will override these configuration values unless they have been set with a read-only mode.
*
* @param config - the configuration object
* @param [readonly=false] - if true, the configuration will be read-only and cannot be overridden by the Dashboard
*
* More infos: https://www.poool.dev/docs/engage/javascript/configuration
*/
(config: EngageConfigOptions, readonly?: boolean): Engage;
/**
* While the default configuration works for most use cases, you might want to configure some of Engage.js behaviors.
*
* ℹ️ Your Dashboard configuration will override these configuration values unless they have been set with a read-only mode.
*
* @param optionName The configuration option name
* @param optionValue The configuration option value
* @param [readonly=false] - if true, the configuration will be read-only and cannot be overridden by the Dashboard
*
* More infos: https://www.poool.dev/docs/engage/javascript/configuration
*/
(optionName: string, optionValue: any, readonly?: boolean): Engage;
}

interface EngageVariables {
/**
* Some texts inside elements benefit from predefined & automatically integrated variables, such as {app_name}.
The .variable function allows you to define custom variables, which can be used in all element texts.
*
* The `.variable` function allows you to define custom variables, which can be used inside some textkeys.
*
* @param keyName - the variable key name
* @param value - the variable value
*
* More infos: https://www.poool.dev/docs/engage/javascript/variables
*/
(keyName: string, value: string | number | boolean): Engage;
/**
* Some texts inside elements benefit from predefined & automatically integrated variables, such as {app_name}.
The variable function allows you to define custom variables, which can be used in all element texts.
*
* The `.variable` function allows you to define custom variables, which can be used inside some textkeys.
*
* @param variables - the variables object
*
* More infos: https://www.poool.dev/docs/engage/javascript/variables
*/
(variables: { [key: string]: string | number | boolean }): Engage;
}

type EngageEventsList =
| "ready"
| "seen"
| "click"
| "formSubmit"
| "destroy"
| "error";

type EngageTextsType =
| "form_optional"
| "form_no_options"
| "form_error"
| "form_error_required_field"
| "form_error_invalid_field"
| "form_error_invalid_email_field"
| "form_error_invalid_phone_field"
| "form_error_invalid_date_field"
| "form_error_invalid_credit_card_field"
| "form_error_non_existent_email";

type EngageDisplayConditionsType =
| "target"
| "delay"
| "scroll"
| "views"
| "viewsPerDay"
| "visits"
| "device"
| "geoloc"
| "url"
| "referrer"
| "date"
| "time"
| "customFilter"
| "priority"
| "and"
| "or";

interface EngageDisplayConditions {
id: string;
type: EngageDisplayConditionsType;
value: string | number | boolean | EngageDisplayConditions[];
}

interface EngageElement {
slug: string;
name: string;
conditions: EngageDisplayConditions[];
/**
* Destroys the element
*
* @returns Promise<void>
*/
destroy: () => void;
}

interface EngageTexts {
/**
* You may need to override the default text displayed to your visitors, either to change the wording, or to add a new locale.
*
* Each text key modified using the .texts function is added to the default locale (if no locale has been defined in the general configuration options, or passed in the .texts function).
*
* ℹ️ These configuration values are overridden by your Dashboard configuration.
*
* @param keyName - the text key name
* @param value - the text value
* @param [readonly=false] - if true, the configuration will be read-only and cannot be overridden by the Dashboard
* @param [locale] - the locale to use
*
* More infos: https://www.poool.dev/docs/engage/javascript/texts
*/
(keyName: EngageTextsType | string, value: string, readonly?: boolean, locale?: string): Engage;
/**
* You may need to override the default text displayed to your visitors, either to change the wording, or to add a new locale.
*
* Each text key modified using the .texts function is added to the default locale (if no locale has been defined in the general configuration options, or passed in the .texts function).
*
* ℹ️ These configuration values are overridden by your Dashboard configuration.
*
* @param texts - the texts object
* @param [readonly=false] - if true, the configuration will be read-only and cannot be overridden by the Dashboard
* @param [locale] - the locale to use
*
* More infos: https://www.poool.dev/docs/engage/javascript/texts
*/
(texts: { [key: EngageTextsType | string]: string }, readonly?: boolean, locale?: string): Engage;
}

interface Engage {
/**
* Creates a new Engage instance (required to display Engage elements) using your app ID.
*
* @param key - Your poool app ID
* @returns The Engage instance.
*
* More infos: https://www.poool.dev/fr/docs/engage/javascript/methods#init
*/
init(key: string): Engage;

/**
* If an Engage object already exists in the global object of the current page, the Engage.js library will be renamed to PooolEngage and the original Engage object will be restored.
*
* @returns the Engage instance
*
* More infos: https://www.poool.dev/fr/docs/engage/javascript/methods#noconflict
*/
noConflict(): Engage;

/**
* Allows to set some configuration options.
*
* @returns a promise that resolves with the Element instance
* More Infos: https://www.poool.dev/docs/engage/javascript/methods#config
*/
config: EngageConfig;

/**
* Allows to set custom variables to be replaced inside some text keys
*
* @returns a promise that resolves with the Element instance
* More infos: https://www.poool.dev/docs/engage/javascript/methods#variables
*/
variables: EngageVariables;

/**
* Allows to override some hard coded texts.
*
* @returns a promise that resolves with the Element instance
*
* More infos: https://www.poool.dev/docs/engage/javascript/methods#texts
*/
texts: EngageTexts;

/**
* @param event the event name
* @param callback the event callback
* @returns the Engage instance
*
* More infos: https://www.poool.dev/docs/engage/javascript/methods#on
*/
on(event: EngageEventsList, callback: (...props: any) => any): Engage;

/**
* @param event the event name
* @param callback the event callback
* @returns the Engage instance
*
* More infos: https://www.poool.dev/docs/engage/javascript/methods#off
*/
off(event: EngageEventsList, callback: (...props: any) => any): Engage;

/**
*Creates a new Element instance.

* @param slug the element slug
* @param target the target element or selector
* @returns a promise that resolves with the Element instance
*
* More infos: https://www.poool.dev/docs/engage/javascript/methods#createelement
*/
createElement(slug: string, target: string | Element): Promise<EngageElement>;

/**
* Creates all elements matching multiple conditions like device, country, custom filters, etc.
*
* @param opts the filtering options
* @returns a promise that resolves with an array of Element instances
*
* More infos: https://www.poool.dev/docs/engage/javascript/methods#autocreate
*/
autoCreate(opts?: { filters?: string[] }): Promise<EngageElement[]>;

/**
* Increment the page view counter in the browser's localStorage for elements with a page view count limit.
*
* @returns the Engage instance
*
* More infos: https://www.poool.dev/docs/engage/javascript/methods#commitpageview
*/
commitPageView(): Engage;
}
}
27 changes: 27 additions & 0 deletions types/poool-engage/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"private": true,
"name": "@types/poool-engage",
"version": "2.1.9999",
"nonNpm": true,
"nonNpmDescription": "poool-engage",
"projects": [
"https://poool.dev/fr/docs/engage/javascript"
],
"devDependencies": {
"@types/poool-engage": "workspace:."
},
"owners": [
{
"name": "Maxime Da Silva",
"githubUsername": "maximedasilva"
},
{
"name": "Ugo Stephant",
"githubUsername": "dackmin"
},
{
"name": "Antoine Chassagne",
"githubUsername": "antoinechassagne"
}
]
}
Loading