Skip to content

Commit

Permalink
include types and esm
Browse files Browse the repository at this point in the history
  • Loading branch information
rohenaz committed Dec 22, 2021
1 parent 028b43e commit fdbf56c
Show file tree
Hide file tree
Showing 12 changed files with 4,504 additions and 14,635 deletions.
30 changes: 30 additions & 0 deletions dist/esm/config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export default class Config {
environmentLocal: string;
environmentStaging: string;
environmentProduction: string;
apiUrl: string;
apiUrlLocal: string;
apiUrlStaging: string;
apiUrlProduction: string;
eventsUrl: string;
eventsUrlLocal: string;
eventsUrlStaging: string;
eventsUrlProduction: string;
customEnvironmentAttribute: string;
environment: string;
environments: string[];
maxSessionDays: number;
challengeParameterName: string;
sessionParameterName: string;
version: string;
widgetDivClass: string;
widgetIdAttribute: string;
hostUrlLocal: string;
hostUrlStaging: string;
hostUrlProduction: string;
hostUrl: string;
fbAppId: string;
constructor();
isEnvironmentValid: (environment: string) => boolean;
setEnvironment: (environment: string) => void;
}
15 changes: 15 additions & 0 deletions dist/esm/events.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Config from './config';
export default class Events {
sessionId: string;
start: number;
interactionSent: boolean;
config: Config;
challengeGuid: string;
constructor(sessionId: string | undefined, challengeGuid: string | undefined, config: Config);
sendPing: () => void;
detectWidgetClick: () => void;
detectBounce: () => void;
sendChallengeResponse: () => void;
detectInteraction: () => void;
sendEvent: (eventName: string, data: string) => Promise<void>;
}
42 changes: 42 additions & 0 deletions dist/esm/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import Config from './config';
import Events from './events';
import Storage from './storage';
import TPow from './types';
declare enum Platform {
LinkedIn = "linkedin",
PowPing = "powping",
Twitter = "twitter",
Twetch = "twetch",
Facebook = "facebook"
}
export default class TonicPow {
config: Config;
storage: Storage;
events: Events | undefined;
widgets: Map<string, TPow.Widget | null>;
options: TPow.TonicPowOptions | undefined;
buttonViewsInitialized: boolean;
shareButtons: Map<string, TPow.ShareButtonOptions>;
nrOfButtons: number;
constructor(options?: TPow.TonicPowOptions);
setOreo: (name: string, value: string, days: number) => void;
captureVisitorSession: (customSessionId?: string, customChallengeGuid?: string) => TPow.Capture;
getVisitorSession: () => string | null;
loadDivs: () => Promise<void>;
private getDataAttributes;
private initializeButton;
shareButton: (id: string, options: TPow.ShareButtonOptions) => void;
private initializeButtonViews;
private static showPopup;
shareOnPlatform: (shortlink: TPow.ShortLink, platform: Platform) => void;
copyText: (text: string) => void;
closePopup: () => void;
private initializeBanner;
load: () => Promise<void>;
}
declare global {
interface Window {
TonicPow: any;
}
}
export {};
5 changes: 5 additions & 0 deletions dist/esm/storage.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default class Storage {
removeStorage: (name: string) => boolean;
getStorage: (key: string) => string | null;
setStorage: (key: string, value: string, expires?: number | null) => boolean;
}
2 changes: 1 addition & 1 deletion dist/tonicpow.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/widget.js

Large diffs are not rendered by default.

Loading

0 comments on commit fdbf56c

Please sign in to comment.