@wavv/dialer 2.1.1 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  For more information, see our [documentation](https://docs.wavv.com)
4
4
 
5
+ <br />
6
+ ### Version 2.4.0
7
+
8
+ - Added `close`
9
+ - Added `endCampaign`
10
+
11
+ <br />
12
+
13
+ ### Version 2.3.0
14
+
15
+ - Added `purchaseDialer`
16
+ - Added `listVoicemails`
17
+ - Added `dropVoicemail`
18
+ - Added `recordCall`
19
+ - Added `close`
20
+
5
21
  <br />
6
22
 
7
23
  ### Version 2.1.0
package/dist/constants.js CHANGED
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DNC_TYPE_MANUAL = exports.DNC_TYPE_SMS = exports.DNC_TYPE_IVR = exports.OUTCOME_UNKNOWN = exports.OUTCOME_NO_VOICEMAIL = exports.OUTCOME_NO_CALLBACK = exports.OUTCOME_VOICEMAIL = exports.OUTCOME_CALLBACK = exports.OUTCOME_DISCONNECTED = exports.OUTCOME_BUSY = exports.OUTCOME_NO_ANSWER = exports.OUTCOME_USER_HUNG_UP = exports.OUTCOME_HUNG_UP = void 0;
4
- exports.OUTCOME_HUNG_UP = 'HUNG_UP'; // callee hung up the line
5
- exports.OUTCOME_USER_HUNG_UP = 'USER_HUNG_UP'; // user hung up the line
6
- exports.OUTCOME_NO_ANSWER = 'NO_ANSWER'; // call was not answered
7
- exports.OUTCOME_BUSY = 'BUSY'; // line was busy
8
- exports.OUTCOME_DISCONNECTED = 'DISCONNECTED'; // number was disconnected
9
- exports.OUTCOME_CALLBACK = 'CALLBACK'; // callback message was played
10
- exports.OUTCOME_VOICEMAIL = 'VOICEMAIL'; // voicemail message was played
11
- exports.OUTCOME_NO_CALLBACK = 'NO_CALLBACK'; // callback message would have been played if the user had one recorded
12
- exports.OUTCOME_NO_VOICEMAIL = 'NO_VOICEMAIL'; // voicemail message would have been played if the user had one recorded
13
- exports.OUTCOME_UNKNOWN = 'UNKNOWN'; // call ended, but no one knows why
14
- exports.DNC_TYPE_IVR = 'IVR OPT-OUT'; // recipient opted out via call
15
- exports.DNC_TYPE_SMS = 'SMS OPT-OUT'; // recipient opted out via text
16
- exports.DNC_TYPE_MANUAL = 'MANUAL'; // number was manually added
4
+ exports.OUTCOME_HUNG_UP = 'HUNG_UP';
5
+ exports.OUTCOME_USER_HUNG_UP = 'USER_HUNG_UP';
6
+ exports.OUTCOME_NO_ANSWER = 'NO_ANSWER';
7
+ exports.OUTCOME_BUSY = 'BUSY';
8
+ exports.OUTCOME_DISCONNECTED = 'DISCONNECTED';
9
+ exports.OUTCOME_CALLBACK = 'CALLBACK';
10
+ exports.OUTCOME_VOICEMAIL = 'VOICEMAIL';
11
+ exports.OUTCOME_NO_CALLBACK = 'NO_CALLBACK';
12
+ exports.OUTCOME_NO_VOICEMAIL = 'NO_VOICEMAIL';
13
+ exports.OUTCOME_UNKNOWN = 'UNKNOWN';
14
+ exports.DNC_TYPE_IVR = 'IVR OPT-OUT';
15
+ exports.DNC_TYPE_SMS = 'SMS OPT-OUT';
16
+ exports.DNC_TYPE_MANUAL = 'MANUAL';
package/dist/events.d.ts CHANGED
@@ -6,65 +6,49 @@ interface Call {
6
6
  contactId: string;
7
7
  }
8
8
  interface Line extends Call {
9
- /** Call should have focus in your app */
10
9
  focused: boolean;
11
- /** Numbers the dialer intends to skip */
12
10
  skippedNumbers: string[];
13
11
  }
14
12
  export interface CallStarted extends Call {
15
13
  }
16
14
  export interface CallAnswered extends Call {
17
- /** Call answered in the background */
18
15
  backgrounded: boolean;
19
16
  }
20
17
  export interface CallEnded extends Call {
21
- /** Seconds the call lasted */
22
- duration: number;
23
- /** Call was answered by a human */
18
+ answered: boolean;
24
19
  human: boolean;
25
- /** Outcome of the call */
20
+ duration: number;
26
21
  outcome: Outcome;
22
+ voicemailId?: string;
27
23
  }
28
24
  export interface CallRecorded extends Call {
29
- /** Call recording ID */
30
25
  recordingId: string;
31
26
  }
32
27
  export interface WaitingForContinue extends Call {
33
- /** Dialer is waiting on host app to continue */
34
28
  waiting: boolean;
35
29
  }
36
30
  export interface LinesChanged {
37
- /** Lines currently in use by the dialer */
38
31
  lines: Line[];
39
32
  }
40
33
  export interface DialerIdle {
41
- /** Dialer is idle, pending auto-disconnect */
42
34
  idle: boolean;
43
35
  }
44
36
  export interface CampaignEnded {
45
- /** All contacts in the campaign were called */
46
37
  complete: boolean;
47
- /** History of call objects for the campaign */
48
38
  history: CallEnded[];
49
39
  }
50
40
  export interface DncChanged {
51
- /** Number on the DNC list */
52
41
  number: string;
53
- /** Reason for being on DNC list */
54
42
  type: DncType;
55
- /** Number was removed (added when false) */
56
43
  removed: boolean;
57
44
  }
58
45
  export interface DialerVisible {
59
- /** Dialer is visible */
60
46
  visible: boolean;
61
47
  }
62
48
  export interface MiniDialerVisible {
63
- /** Mini dialer is visible */
64
49
  visible: boolean;
65
50
  }
66
51
  export interface OverlayVisible {
67
- /** Overlay is visible */
68
52
  visible: boolean;
69
53
  }
70
54
  export {};
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { Listener, InitOps, SetThemeOps } from '@wavv/internal';
1
+ import { Listener, InitOps, SetThemeOps, Voicemail } from './utils';
2
2
  import { CallAnswered, CallEnded, CallRecorded, CallStarted, CampaignEnded, DialerIdle, DialerVisible, DncChanged, LinesChanged, MiniDialerVisible, WaitingForContinue, OverlayVisible } from './events';
3
- import { AddDncNumberOps, AddPhoneOps, CallPhoneOps, ContinueCampaignOps, RemoveContactOps, RemoveDncNumberOps, RemovePhoneOps, StartCampaignOps } from './options';
3
+ import { AddDncNumberOps, AddPhoneOps, CallPhoneOps, ContinueCampaignOps, RemoveContactOps, RemoveDncNumberOps, RemovePhoneOps, StartCampaignOps, DropVoicemailOps, EndCampaignOps } from './options';
4
4
  export * from './constants';
5
5
  export declare const init: (options: InitOps) => Promise<any>;
6
+ export declare const close: () => Promise<any>;
6
7
  export declare const setTheme: (options: SetThemeOps) => Promise<any>;
7
8
  export declare const addDncNumber: (options: AddDncNumberOps) => Promise<void>;
8
9
  export declare const addPhone: (options: AddPhoneOps) => Promise<void>;
@@ -13,6 +14,11 @@ export declare const removeContact: (options: RemoveContactOps) => Promise<void>
13
14
  export declare const removeDncNumber: (options: RemoveDncNumberOps) => Promise<void>;
14
15
  export declare const removePhone: (options: RemovePhoneOps) => Promise<void>;
15
16
  export declare const startCampaign: (options: StartCampaignOps) => Promise<void>;
17
+ export declare const endCampaign: (options: EndCampaignOps) => Promise<void>;
18
+ export declare const purchaseDialer: () => Promise<void>;
19
+ export declare const recordCall: () => Promise<void>;
20
+ export declare const listVoicemails: () => Promise<Voicemail[]>;
21
+ export declare const dropVoicemail: (options: DropVoicemailOps) => Promise<void>;
16
22
  export declare const addCallAnsweredListener: (callback: (event: CallAnswered) => void) => Listener;
17
23
  export declare const addCallEndedListener: (callback: (event: CallEnded) => void) => Listener;
18
24
  export declare const addCallRecordedListener: (callback: (event: CallRecorded) => void) => Listener;
package/dist/index.js CHANGED
@@ -10,72 +10,71 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.addUpsellClickListener = exports.addManageSubscriptionListener = exports.addClosedListener = exports.addOverlayVisibleListener = exports.addWaitingForContinueListener = exports.addMiniDialerVisibleListener = exports.addLinesChangedListener = exports.addDncChangedListener = exports.addDialerVisibleListener = exports.addDialerIdleListener = exports.addCampaignEndedListener = exports.addCallStartedListener = exports.addCallRecordedListener = exports.addCallEndedListener = exports.addCallAnsweredListener = exports.startCampaign = exports.removePhone = exports.removeDncNumber = exports.removeContact = exports.load = exports.continueCampaign = exports.callPhone = exports.addPhone = exports.addDncNumber = exports.setTheme = exports.init = void 0;
14
- const internal_1 = require("@wavv/internal");
15
- // -----------
16
- // VERSION
17
- // -----------
13
+ exports.addUpsellClickListener = exports.addManageSubscriptionListener = exports.addClosedListener = exports.addOverlayVisibleListener = exports.addWaitingForContinueListener = exports.addMiniDialerVisibleListener = exports.addLinesChangedListener = exports.addDncChangedListener = exports.addDialerVisibleListener = exports.addDialerIdleListener = exports.addCampaignEndedListener = exports.addCallStartedListener = exports.addCallRecordedListener = exports.addCallEndedListener = exports.addCallAnsweredListener = exports.dropVoicemail = exports.listVoicemails = exports.recordCall = exports.purchaseDialer = exports.endCampaign = exports.startCampaign = exports.removePhone = exports.removeDncNumber = exports.removeContact = exports.load = exports.continueCampaign = exports.callPhone = exports.addPhone = exports.addDncNumber = exports.setTheme = exports.close = exports.init = void 0;
14
+ const utils_1 = require("./utils");
18
15
  const V = 2;
19
- // -----------
20
- // CONSTANTS
21
- // -----------
22
16
  __exportStar(require("./constants"), exports);
23
- // -----------
24
- // FUNCTIONS
25
- // -----------
26
- const init = (options) => internal_1.initialize(V, options);
17
+ const init = (options) => utils_1.initialize(V, options);
27
18
  exports.init = init;
28
- const setTheme = (options) => internal_1.execute(V, 'SET_THEME', options);
19
+ const close = () => utils_1.deinitialize(V);
20
+ exports.close = close;
21
+ const setTheme = (options) => utils_1.execute(V, 'SET_THEME', options);
29
22
  exports.setTheme = setTheme;
30
- const addDncNumber = (options) => internal_1.execute(V, 'ADD_DNC_NUMBER', options);
23
+ const addDncNumber = (options) => utils_1.execute(V, 'ADD_DNC_NUMBER', options);
31
24
  exports.addDncNumber = addDncNumber;
32
- const addPhone = (options) => internal_1.execute(V, 'ADD_PHONE', options);
25
+ const addPhone = (options) => utils_1.execute(V, 'ADD_PHONE', options);
33
26
  exports.addPhone = addPhone;
34
- // TODO: accept contact object (for additional fields)
35
- const callPhone = (options) => internal_1.execute(V, 'CALL_PHONE', options);
27
+ const callPhone = (options) => utils_1.execute(V, 'CALL_PHONE', options);
36
28
  exports.callPhone = callPhone;
37
- const continueCampaign = (options) => internal_1.execute(V, 'CONTINUE', options);
29
+ const continueCampaign = (options) => utils_1.execute(V, 'CONTINUE', options);
38
30
  exports.continueCampaign = continueCampaign;
39
- const load = () => internal_1.execute(V, 'LOAD_DIALER');
31
+ const load = () => utils_1.execute(V, 'LOAD_DIALER');
40
32
  exports.load = load;
41
- const removeContact = (options) => internal_1.execute(V, 'REMOVE_CONTACT', options);
33
+ const removeContact = (options) => utils_1.execute(V, 'REMOVE_CONTACT', options);
42
34
  exports.removeContact = removeContact;
43
- const removeDncNumber = (options) => internal_1.execute(V, 'REMOVE_DNC_NUMBER', options);
35
+ const removeDncNumber = (options) => utils_1.execute(V, 'REMOVE_DNC_NUMBER', options);
44
36
  exports.removeDncNumber = removeDncNumber;
45
- const removePhone = (options) => internal_1.execute(V, 'REMOVE_PHONE', options);
37
+ const removePhone = (options) => utils_1.execute(V, 'REMOVE_PHONE', options);
46
38
  exports.removePhone = removePhone;
47
- const startCampaign = (options) => internal_1.execute(V, 'START_CAMPAIGN', options);
39
+ const startCampaign = (options) => utils_1.execute(V, 'START_CAMPAIGN', options);
48
40
  exports.startCampaign = startCampaign;
49
- // -----------
50
- // LISTENERS
51
- // -----------
52
- const addCallAnsweredListener = (callback) => internal_1.listen(V, 'CALL_ANSWERED', callback);
41
+ const endCampaign = (options) => utils_1.execute(V, 'END_CAMPAIGN', options);
42
+ exports.endCampaign = endCampaign;
43
+ const purchaseDialer = () => utils_1.execute(V, 'PURCHASE_DIALER');
44
+ exports.purchaseDialer = purchaseDialer;
45
+ const recordCall = () => utils_1.execute(V, 'RECORD_CALL');
46
+ exports.recordCall = recordCall;
47
+ const listVoicemails = () => utils_1.execute(V, 'LIST_VOICEMAILS');
48
+ exports.listVoicemails = listVoicemails;
49
+ const dropVoicemail = (options) => utils_1.execute(V, 'DROP_VOICEMAIL');
50
+ exports.dropVoicemail = dropVoicemail;
51
+ const addCallAnsweredListener = (callback) => utils_1.listen(V, 'CALL_ANSWERED', callback);
53
52
  exports.addCallAnsweredListener = addCallAnsweredListener;
54
- const addCallEndedListener = (callback) => internal_1.listen(V, 'CALL_ENDED', callback);
53
+ const addCallEndedListener = (callback) => utils_1.listen(V, 'CALL_ENDED', callback);
55
54
  exports.addCallEndedListener = addCallEndedListener;
56
- const addCallRecordedListener = (callback) => internal_1.listen(V, 'CALL_RECORDED', callback);
55
+ const addCallRecordedListener = (callback) => utils_1.listen(V, 'CALL_RECORDED', callback);
57
56
  exports.addCallRecordedListener = addCallRecordedListener;
58
- const addCallStartedListener = (callback) => internal_1.listen(V, 'CALL_STARTED', callback);
57
+ const addCallStartedListener = (callback) => utils_1.listen(V, 'CALL_STARTED', callback);
59
58
  exports.addCallStartedListener = addCallStartedListener;
60
- const addCampaignEndedListener = (callback) => internal_1.listen(V, 'CAMPAIGN_ENDED', callback);
59
+ const addCampaignEndedListener = (callback) => utils_1.listen(V, 'CAMPAIGN_ENDED', callback);
61
60
  exports.addCampaignEndedListener = addCampaignEndedListener;
62
- const addDialerIdleListener = (callback) => internal_1.listen(V, 'DIALER_IDLE', callback);
61
+ const addDialerIdleListener = (callback) => utils_1.listen(V, 'DIALER_IDLE', callback);
63
62
  exports.addDialerIdleListener = addDialerIdleListener;
64
- const addDialerVisibleListener = (callback) => internal_1.listen(V, 'DIALER_VISIBLE', callback);
63
+ const addDialerVisibleListener = (callback) => utils_1.listen(V, 'DIALER_VISIBLE', callback);
65
64
  exports.addDialerVisibleListener = addDialerVisibleListener;
66
- const addDncChangedListener = (callback) => internal_1.listen(V, 'DNC_CHANGED', callback);
65
+ const addDncChangedListener = (callback) => utils_1.listen(V, 'DNC_CHANGED', callback);
67
66
  exports.addDncChangedListener = addDncChangedListener;
68
- const addLinesChangedListener = (callback) => internal_1.listen(V, 'LINES_CHANGED', callback);
67
+ const addLinesChangedListener = (callback) => utils_1.listen(V, 'LINES_CHANGED', callback);
69
68
  exports.addLinesChangedListener = addLinesChangedListener;
70
- const addMiniDialerVisibleListener = (callback) => internal_1.listen(V, 'DIALER_MINI_VISIBLE', callback);
69
+ const addMiniDialerVisibleListener = (callback) => utils_1.listen(V, 'DIALER_MINI_VISIBLE', callback);
71
70
  exports.addMiniDialerVisibleListener = addMiniDialerVisibleListener;
72
- const addWaitingForContinueListener = (callback) => internal_1.listen(V, 'WAITING_FOR_CONTINUE', callback);
71
+ const addWaitingForContinueListener = (callback) => utils_1.listen(V, 'WAITING_FOR_CONTINUE', callback);
73
72
  exports.addWaitingForContinueListener = addWaitingForContinueListener;
74
- const addOverlayVisibleListener = (callback) => internal_1.listen(V, 'OVERLAY_VISIBLE', callback);
73
+ const addOverlayVisibleListener = (callback) => utils_1.listen(V, 'OVERLAY_VISIBLE', callback);
75
74
  exports.addOverlayVisibleListener = addOverlayVisibleListener;
76
- const addClosedListener = (callback) => internal_1.listen(V, 'CLOSED', callback);
75
+ const addClosedListener = (callback) => utils_1.listen(V, 'CLOSED', callback);
77
76
  exports.addClosedListener = addClosedListener;
78
- const addManageSubscriptionListener = (callback) => internal_1.listen(V, 'MANAGE_SUBSCRIPTION', callback);
77
+ const addManageSubscriptionListener = (callback) => utils_1.listen(V, 'MANAGE_SUBSCRIPTION', callback);
79
78
  exports.addManageSubscriptionListener = addManageSubscriptionListener;
80
- const addUpsellClickListener = (callback) => internal_1.listen(V, 'UPSELL_CLICK', callback);
79
+ const addUpsellClickListener = (callback) => utils_1.listen(V, 'UPSELL_CLICK', callback);
81
80
  exports.addUpsellClickListener = addUpsellClickListener;
package/dist/options.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Contact } from '@wavv/internal';
1
+ import { Contact } from './utils';
2
2
  export interface AddDncNumberOps {
3
3
  number: string;
4
4
  addedBy?: string;
@@ -29,3 +29,9 @@ export interface RemovePhoneOps {
29
29
  export interface StartCampaignOps {
30
30
  contacts: Contact[];
31
31
  }
32
+ export interface EndCampaignOps {
33
+ close?: boolean;
34
+ }
35
+ export interface DropVoicemailOps {
36
+ id: string;
37
+ }
@@ -0,0 +1,42 @@
1
+ export declare const listen: (version: number, event: string, callback: Function) => {
2
+ remove(): void;
3
+ };
4
+ export declare const execute: (version: number, action: string, options?: object) => Promise<any>;
5
+ export declare const initialize: (version: number, options: object) => Promise<any>;
6
+ export declare const deinitialize: (version: number) => Promise<any>;
7
+ export interface Listener {
8
+ remove: Function;
9
+ }
10
+ export interface InitOps {
11
+ token: string;
12
+ server?: string;
13
+ }
14
+ export interface SetThemeOps {
15
+ theme: 'LIGHT' | 'DARK';
16
+ primaryColor?: string;
17
+ }
18
+ export interface MergeField {
19
+ id: string;
20
+ label: string;
21
+ }
22
+ interface MergeFieldValue extends MergeField {
23
+ value: string;
24
+ }
25
+ export interface Contact {
26
+ contactId: string;
27
+ numbers: string[];
28
+ name?: string;
29
+ firstName?: string;
30
+ lastName?: string;
31
+ address?: string;
32
+ city?: string;
33
+ avatarUrl?: string;
34
+ subheading?: string;
35
+ mergeFields?: MergeFieldValue[];
36
+ }
37
+ export interface Voicemail {
38
+ id: string;
39
+ name: string;
40
+ seconds: number;
41
+ }
42
+ export {};
package/dist/utils.js ADDED
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.deinitialize = exports.initialize = exports.execute = exports.listen = void 0;
13
+ const WINDOW_VAR = 'Storm';
14
+ const DOMAIN = 'stormapp.com';
15
+ const JS_FILE = 'storm.js';
16
+ const SUBDOMAIN = 'app';
17
+ let initializing = false;
18
+ let deinitializing = false;
19
+ let interval;
20
+ let waitingMs = 0;
21
+ const ms = 100;
22
+ const maxMs = 10000;
23
+ const buffer = [];
24
+ const win = window;
25
+ const wait = () => {
26
+ if (interval)
27
+ return;
28
+ interval = setInterval(() => {
29
+ if (win[WINDOW_VAR]) {
30
+ clearInterval(interval);
31
+ buffer.forEach(win[WINDOW_VAR].dispatch);
32
+ }
33
+ else {
34
+ if (waitingMs > maxMs) {
35
+ clearInterval(interval);
36
+ console.error('Timed out waiting for WAVV');
37
+ }
38
+ waitingMs += ms;
39
+ }
40
+ }, ms);
41
+ };
42
+ const dispatch = (type, payload, version, resolve, reject) => {
43
+ const action = {
44
+ type,
45
+ payload,
46
+ resolve,
47
+ reject,
48
+ version,
49
+ };
50
+ if (win[WINDOW_VAR]) {
51
+ win[WINDOW_VAR].dispatch(action);
52
+ }
53
+ else {
54
+ buffer.push(action);
55
+ wait();
56
+ }
57
+ };
58
+ const bootstrap = ({ server = SUBDOMAIN }, callback) => {
59
+ if (win[WINDOW_VAR])
60
+ return callback();
61
+ const url = `https://${server}.${DOMAIN}/${JS_FILE}`;
62
+ const script = document.createElement('script');
63
+ script.id = JS_FILE;
64
+ script.src = url;
65
+ script.onload = () => {
66
+ callback();
67
+ };
68
+ script.onerror = () => {
69
+ callback(`Failed to load WAVV from ${url}`);
70
+ };
71
+ document.body.appendChild(script);
72
+ };
73
+ const debootstrap = (version, callback) => __awaiter(void 0, void 0, void 0, function* () {
74
+ try {
75
+ if (win[WINDOW_VAR])
76
+ dispatch('CLOSE_STORM', {}, version);
77
+ callback(null);
78
+ }
79
+ catch (err) {
80
+ callback(err);
81
+ }
82
+ });
83
+ const listen = (version, event, callback) => {
84
+ dispatch('SET_CALLBACK', { event, callback }, version);
85
+ return {
86
+ remove() {
87
+ dispatch('REMOVE_CALLBACK', { event, callback }, version);
88
+ },
89
+ };
90
+ };
91
+ exports.listen = listen;
92
+ const execute = (version, action, options = {}) => {
93
+ return new Promise((resolve, reject) => {
94
+ dispatch(action, options, version, resolve, reject);
95
+ });
96
+ };
97
+ exports.execute = execute;
98
+ const initialize = (version, options) => {
99
+ return new Promise((resolve, reject) => {
100
+ if (initializing)
101
+ return reject('Init in progress');
102
+ initializing = true;
103
+ bootstrap(options, (err) => {
104
+ initializing = false;
105
+ if (err)
106
+ return reject(err);
107
+ dispatch('AUTH', options, version, resolve, reject);
108
+ });
109
+ });
110
+ };
111
+ exports.initialize = initialize;
112
+ const deinitialize = (version) => {
113
+ return new Promise((resolve, reject) => {
114
+ if (deinitializing)
115
+ return reject('Deinit in progress');
116
+ deinitializing = true;
117
+ debootstrap(version, (err) => {
118
+ deinitializing = false;
119
+ if (err)
120
+ reject(err);
121
+ else
122
+ resolve(true);
123
+ });
124
+ });
125
+ };
126
+ exports.deinitialize = deinitialize;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@wavv/dialer",
3
- "version": "2.1.1",
4
- "description": "",
3
+ "version": "2.4.0",
4
+ "description": "WAVV Dialer",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
- "build": "tsc",
7
+ "build": "tsc --removeComments",
8
8
  "start": "tsc -w",
9
9
  "pub": "npm publish --access public"
10
10
  },
@@ -14,14 +14,11 @@
14
14
  "keywords": [],
15
15
  "author": "WAVV Communications",
16
16
  "license": "ISC",
17
- "dependencies": {},
18
17
  "devDependencies": {
18
+ "@types/node": "^17.0.21",
19
19
  "prettier": "^2.2.1",
20
20
  "tslint": "^6.1.3",
21
21
  "tslint-config-prettier": "^1.18.0",
22
22
  "typescript": "^4.2.4"
23
- },
24
- "peerDependencies": {
25
- "@wavv/internal": "^2.1.0"
26
23
  }
27
24
  }
package/dist/models.d.ts DELETED
@@ -1,27 +0,0 @@
1
- export interface Listener {
2
- remove: Function;
3
- }
4
- export interface Response {
5
- success: boolean;
6
- }
7
- export interface MergeField {
8
- /** Field ID, e.g. "first_name" */
9
- id: string;
10
- /** Field label, e.g. "First Name" */
11
- label: string;
12
- /** Field value, e.g. "Jerry" */
13
- value: string;
14
- }
15
- export interface Contact {
16
- contactId: string;
17
- numbers: string[];
18
- name: string;
19
- address?: string;
20
- city?: string;
21
- /** Avatar image URL */
22
- avatarUrl?: string;
23
- /** Subheading, appears below name */
24
- subheading?: string;
25
- /** Additional merge field data */
26
- mergeFields?: MergeField[];
27
- }
package/dist/models.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });