@sprig-technologies/sprig-browser 2.14.8 → 2.15.1
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/index.d.ts +30 -7
- package/index.js +697 -181
- package/package.json +1 -1
- package/LICENSE +0 -22
- package/controller/controller.d.ts +0 -13
- package/controller/controller.d.ts.map +0 -1
- package/controller/controller.js +0 -1061
- package/controller/encodedViewJs.d.ts +0 -3
- package/controller/encodedViewJs.d.ts.map +0 -1
- package/controller/encodedViewJs.js +0 -1
- package/controller/iframe.d.ts +0 -9
- package/controller/iframe.d.ts.map +0 -1
- package/controller/iframe.js +0 -184
- package/controller/index.js +0 -3
- package/controller/queue.d.ts +0 -2
- package/controller/queue.d.ts.map +0 -1
- package/controller/queue.js +0 -95
- package/index.d.ts.map +0 -1
- package/shared/conflicting_widgets/index.d.ts +0 -5
- package/shared/conflicting_widgets/index.d.ts.map +0 -1
- package/shared/conflicting_widgets/index.js +0 -13
- package/shared/conflicting_widgets/intercom.d.ts +0 -3
- package/shared/conflicting_widgets/intercom.d.ts.map +0 -1
- package/shared/conflicting_widgets/intercom.js +0 -28
- package/shared/constants.d.ts +0 -49
- package/shared/constants.d.ts.map +0 -1
- package/shared/constants.js +0 -65
- package/shared/deferred.d.ts +0 -10
- package/shared/deferred.d.ts.map +0 -1
- package/shared/deferred.js +0 -15
- package/shared/eventEmitter.d.ts +0 -10
- package/shared/eventEmitter.d.ts.map +0 -1
- package/shared/eventEmitter.js +0 -52
- package/shared/network.d.ts +0 -8
- package/shared/network.d.ts.map +0 -1
- package/shared/network.js +0 -130
- package/shared/networkHelper.d.ts +0 -5
- package/shared/networkHelper.d.ts.map +0 -1
- package/shared/networkHelper.js +0 -9
- package/shared/shouldDirectEmbed.d.ts +0 -7
- package/shared/shouldDirectEmbed.d.ts.map +0 -1
- package/shared/shouldDirectEmbed.js +0 -8
- package/shared/tool.d.ts +0 -3
- package/shared/tool.d.ts.map +0 -1
- package/shared/tool.js +0 -19
- package/shared/ulEvents.d.ts +0 -33
- package/shared/ulEvents.d.ts.map +0 -1
- package/shared/ulEvents.js +0 -45
package/controller/iframe.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export function createContainer(): void;
|
|
2
|
-
export function removeContainer(initiator: any): void;
|
|
3
|
-
export function removeContainerOnClose(): void;
|
|
4
|
-
/**
|
|
5
|
-
* Create iframe
|
|
6
|
-
* @return {Object}
|
|
7
|
-
*/
|
|
8
|
-
export function createFrame(productConfig: any, useMobileStyling: any): any;
|
|
9
|
-
//# sourceMappingURL=iframe.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"iframe.d.ts","sourceRoot":"","sources":["../../../sprig-browser/controller/iframe.js"],"names":[],"mappings":"AA0BA,wCAKC;AACD,sDAYC;AAED,+CAIC;AAED;;;GAGG;AACH,4EA+HC"}
|
package/controller/iframe.js
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
/* globals window, UserLeap, document */
|
|
2
|
-
|
|
3
|
-
import eventEmitter from '../shared/eventEmitter';
|
|
4
|
-
import { ulEvents } from '../shared/ulEvents';
|
|
5
|
-
|
|
6
|
-
if (window.UserLeap && window.Sprig) {
|
|
7
|
-
if (window.Sprig._gtm) {
|
|
8
|
-
// if sdk installation snippet references UserLeap, but Google Tag Manager (GTM) references Sprig,
|
|
9
|
-
// overwrite Sprig by assigning it the value of UserLeap to make sure Sprig receives the full functionality without losing any configuration
|
|
10
|
-
window.Sprig = window.UserLeap;
|
|
11
|
-
} else {
|
|
12
|
-
// if sdk installation snippet references Sprig, but Google Tag Manager (GTM) references UserLeap,
|
|
13
|
-
// overwrite UserLeap by assigning it the value of Sprig to make sure Sprig receives the full functionality without losing any configuration
|
|
14
|
-
window.UserLeap = window.Sprig;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
// for an all-new GTM or snippet-based installation referencing Sprig,
|
|
18
|
-
// assign Sprig to UserLeap so that when functionality is defined on UserLeap, it's accessible on Sprig.
|
|
19
|
-
if (!window.UserLeap) window.UserLeap = window.Sprig;
|
|
20
|
-
// for a legacy GTM or snippet-based installation referencing UserLeap,
|
|
21
|
-
// assign UserLeap to Sprig so that the functionality is accessible on Sprig, too.
|
|
22
|
-
if (!window.Sprig) window.Sprig = window.UserLeap;
|
|
23
|
-
|
|
24
|
-
const LIGHT_OVERLAY_BACKGROUND_COLOR = 'rgba(255,255,255, 0.95)';
|
|
25
|
-
const DARK_OVERLAY_BACKGROUND_COLOR = 'rgba(0,0,0,0.9)';
|
|
26
|
-
|
|
27
|
-
export function createContainer() {
|
|
28
|
-
// Create home container
|
|
29
|
-
UserLeap.container = document.createElement('div');
|
|
30
|
-
UserLeap.container.className = 'ul-container';
|
|
31
|
-
document.body.appendChild(UserLeap.container);
|
|
32
|
-
}
|
|
33
|
-
export function removeContainer(initiator) {
|
|
34
|
-
const container = UserLeap.container;
|
|
35
|
-
if (!container) return;
|
|
36
|
-
try {
|
|
37
|
-
document.body.removeChild(container);
|
|
38
|
-
UserLeap.container = null;
|
|
39
|
-
eventEmitter.emit(ulEvents.SURVEY_LIFE_CYCLE, { state: 'dismissed' });
|
|
40
|
-
eventEmitter.emit(ulEvents.SURVEY_CLOSED, { name: ulEvents.SURVEY_CLOSED, initiator });
|
|
41
|
-
} catch (err) {
|
|
42
|
-
console.warn(`[UserLeap] (ERR-412) Error removing UserLeap container by ${initiator} ` + container);
|
|
43
|
-
UserLeap.reportError('dismissActiveSurvey', err);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function removeContainerOnClose() {
|
|
48
|
-
eventEmitter.subscribe(ulEvents.SURVEY_WILL_CLOSE, ({ initiator }) => {
|
|
49
|
-
removeContainer(initiator);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Create iframe
|
|
55
|
-
* @return {Object}
|
|
56
|
-
*/
|
|
57
|
-
export function createFrame(productConfig, useMobileStyling) {
|
|
58
|
-
const WIDTH = '360px';
|
|
59
|
-
const MARGIN = '0px';
|
|
60
|
-
const frameId = 'ul-frame';
|
|
61
|
-
|
|
62
|
-
createContainer();
|
|
63
|
-
// Create iframe for application
|
|
64
|
-
const iframe = document.createElement('iframe');
|
|
65
|
-
iframe.id = frameId;
|
|
66
|
-
iframe.setAttribute('title', 'Sprig User Feedback Dialog');
|
|
67
|
-
const hasOverlay = configureFrame(iframe, productConfig, useMobileStyling);
|
|
68
|
-
eventEmitter.subscribe(ulEvents.SURVEY_FADING_OUT, () => {
|
|
69
|
-
Object.assign(UserLeap.container.style, { 'background-color': 'rgba(0,0,0,0)' });
|
|
70
|
-
});
|
|
71
|
-
removeContainerOnClose();
|
|
72
|
-
|
|
73
|
-
function configureOverlayContainer(styleConfig, useMobileStyling) {
|
|
74
|
-
const defaultContainerStyle = {
|
|
75
|
-
position: 'fixed',
|
|
76
|
-
overflow: 'auto',
|
|
77
|
-
top: '0px',
|
|
78
|
-
left: '0px',
|
|
79
|
-
display: 'none', // overwritten after view is loaded, to prevent blocking website until we can display the survey.
|
|
80
|
-
height: '100%',
|
|
81
|
-
width: '100%',
|
|
82
|
-
transition: 'background-color 0.3s ease-out',
|
|
83
|
-
zIndex: 2147483646,
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const containerStyle = { ...defaultContainerStyle };
|
|
87
|
-
const overlayStyleConfig = useMobileStyling ? styleConfig.overlayStyleMobile : styleConfig.overlayStyle;
|
|
88
|
-
containerStyle['background-color'] =
|
|
89
|
-
overlayStyleConfig === 'light' ? LIGHT_OVERLAY_BACKGROUND_COLOR : DARK_OVERLAY_BACKGROUND_COLOR;
|
|
90
|
-
|
|
91
|
-
if (!useMobileStyling) containerStyle.margin = 'auto';
|
|
92
|
-
Object.assign(UserLeap.container.style, containerStyle);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function configureFrame(iframe, productConfig, useMobileStyling) {
|
|
96
|
-
const defaultFrameStyle = {
|
|
97
|
-
position: 'fixed',
|
|
98
|
-
bottom: '0px',
|
|
99
|
-
right: MARGIN,
|
|
100
|
-
border: 0,
|
|
101
|
-
backgroundColor: 'rgba(0,0,0,0)',
|
|
102
|
-
zIndex: 2147483646,
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const styleConfig = Object.assign({}, productConfig, UserLeap);
|
|
106
|
-
let framePositionStyle;
|
|
107
|
-
let hasOverlay = false;
|
|
108
|
-
|
|
109
|
-
if (useMobileStyling) {
|
|
110
|
-
if (UserLeap.windowDimensions && UserLeap.windowDimensions.width) {
|
|
111
|
-
defaultFrameStyle.width = `${UserLeap.windowDimensions.width}px`;
|
|
112
|
-
} else {
|
|
113
|
-
defaultFrameStyle.width = '100%';
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (UserLeap.windowDimensions && UserLeap.windowDimensions.height) {
|
|
117
|
-
defaultFrameStyle.maxHeight = `${UserLeap.windowDimensions.height - 20}px`;
|
|
118
|
-
} else if (UserLeap.maxHeight) {
|
|
119
|
-
defaultFrameStyle.maxHeight = UserLeap.maxHeight;
|
|
120
|
-
} else {
|
|
121
|
-
defaultFrameStyle.maxHeight = `${document.body.clientHeight - 20}px`;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (['light', 'dark'].includes(styleConfig.overlayStyleMobile)) {
|
|
125
|
-
hasOverlay = true;
|
|
126
|
-
}
|
|
127
|
-
} else {
|
|
128
|
-
defaultFrameStyle.width = WIDTH;
|
|
129
|
-
defaultFrameStyle.maxHeight = UserLeap.maxHeight || '66vh';
|
|
130
|
-
if (styleConfig.framePosition === 'bottomLeft') {
|
|
131
|
-
framePositionStyle = { left: MARGIN };
|
|
132
|
-
} else if (styleConfig.framePosition === 'topLeft') {
|
|
133
|
-
framePositionStyle = { left: MARGIN, top: '0px' };
|
|
134
|
-
} else if (styleConfig.framePosition === 'topRight') {
|
|
135
|
-
framePositionStyle = { top: '0px' };
|
|
136
|
-
} else if (styleConfig.framePosition === 'center') {
|
|
137
|
-
hasOverlay = true;
|
|
138
|
-
framePositionStyle = { margin: 'auto', position: 'static' };
|
|
139
|
-
defaultFrameStyle.maxHeight = null;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (hasOverlay) configureOverlayContainer(styleConfig, useMobileStyling);
|
|
144
|
-
Object.assign(iframe.style, defaultFrameStyle, framePositionStyle);
|
|
145
|
-
return hasOverlay;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Set iframe height
|
|
149
|
-
* @param {Number} height
|
|
150
|
-
*/
|
|
151
|
-
iframe.setHeight = (height) => {
|
|
152
|
-
if (parseInt(iframe.style.height) != height) {
|
|
153
|
-
iframe.style.height = `${height}px`;
|
|
154
|
-
eventEmitter.emit(ulEvents.SURVEY_HEIGHT, {
|
|
155
|
-
name: ulEvents.SURVEY_HEIGHT,
|
|
156
|
-
contentFrameHeight: iframe.clientHeight,
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
UserLeap.container.appendChild(iframe);
|
|
162
|
-
if (productConfig && (useMobileStyling ? productConfig.exitOnOverlayClickMobile : productConfig.exitOnOverlayClick)) {
|
|
163
|
-
UserLeap.container.onclick = () => {
|
|
164
|
-
eventEmitter.emit(ulEvents.CLOSE_SURVEY_ON_OVERLAY_CLICK);
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
eventEmitter.emit(ulEvents.SURVEY_LIFE_CYCLE, { state: 'presented' });
|
|
168
|
-
eventEmitter.emit(ulEvents.SURVEY_PRESENTED, { name: ulEvents.SURVEY_PRESENTED });
|
|
169
|
-
|
|
170
|
-
// Inject the application frame
|
|
171
|
-
const contentWinDoc = iframe.contentWindow.document;
|
|
172
|
-
contentWinDoc.open('text/html', 'replace'),
|
|
173
|
-
contentWinDoc.write('<!doctype html><head></head><body style="background-color: rgba(0,0,0,0)"></body></html>'),
|
|
174
|
-
contentWinDoc.close();
|
|
175
|
-
|
|
176
|
-
const contentWinDocHead = contentWinDoc.head;
|
|
177
|
-
|
|
178
|
-
return {
|
|
179
|
-
frameId,
|
|
180
|
-
contentWinDocHead,
|
|
181
|
-
contentWindow: iframe.contentWindow,
|
|
182
|
-
hasOverlay,
|
|
183
|
-
};
|
|
184
|
-
}
|
package/controller/index.js
DELETED
package/controller/queue.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../../sprig-browser/controller/queue.js"],"names":[],"mappings":""}
|
package/controller/queue.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import 'core-js';
|
|
2
|
-
|
|
3
|
-
// Queue is an intermediatator for calls from developers
|
|
4
|
-
// integrating the userleap. Before the library loads,
|
|
5
|
-
// the snippet stores calls in a simple array.
|
|
6
|
-
// Once the library is initialized, the simple array
|
|
7
|
-
// is replaced by a Queue. All stored actions are processed,
|
|
8
|
-
// and subsequent actions are processed immediately.
|
|
9
|
-
//
|
|
10
|
-
// Pause functionality is used internally to enable UI actions
|
|
11
|
-
// to be delayed while Userleap is 'muted'
|
|
12
|
-
export const UserLeapQueue = class {
|
|
13
|
-
constructor(ul, queue) {
|
|
14
|
-
this.ul = ul;
|
|
15
|
-
this.paused = false;
|
|
16
|
-
this.queue = [];
|
|
17
|
-
this.flush(queue);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
flush(queue) {
|
|
21
|
-
const length = queue.length;
|
|
22
|
-
if (length) {
|
|
23
|
-
for (let i = 0; i < length; i++) {
|
|
24
|
-
this.push(queue[i]);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
isPaused() {
|
|
30
|
-
return this.paused;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
pause() {
|
|
34
|
-
this.paused = true;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
unpause() {
|
|
38
|
-
this.paused = false;
|
|
39
|
-
const queue = this.queue.slice(); //copies
|
|
40
|
-
this.empty();
|
|
41
|
-
this.flush(queue);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// push methods meant to make queue a drop-in
|
|
45
|
-
// replacement for the Array that's used pre-init.
|
|
46
|
-
push(action) {
|
|
47
|
-
if (!this.paused) {
|
|
48
|
-
// Queue is not paused. Perform the specified action
|
|
49
|
-
if (action instanceof Function) {
|
|
50
|
-
// Action is a closure
|
|
51
|
-
action();
|
|
52
|
-
} else {
|
|
53
|
-
// Action is an array
|
|
54
|
-
const args = Array.prototype.slice.call(action, 1);
|
|
55
|
-
const actionName = action[0];
|
|
56
|
-
const actionFunc = this.ul[actionName];
|
|
57
|
-
if (actionFunc && actionFunc instanceof Function) {
|
|
58
|
-
this.ul[actionName].apply(this.ul, args);
|
|
59
|
-
} else {
|
|
60
|
-
if (actionName) {
|
|
61
|
-
console.warn('[UserLeap] (ERR-100) No valid UserLeap action called', actionName);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
// Queue is paused. Store the action in the queue
|
|
67
|
-
this.queue.push(action);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Enqueue a closure to be performed by the queue
|
|
72
|
-
// This is primarily designed to be used to enable
|
|
73
|
-
// internal behaviors to be paused when the library
|
|
74
|
-
// is muted, and resume correctly when the mute is over
|
|
75
|
-
perform(func) {
|
|
76
|
-
if (!this.paused) {
|
|
77
|
-
return func();
|
|
78
|
-
} else {
|
|
79
|
-
let a;
|
|
80
|
-
const p = new Promise(function(resolve) {
|
|
81
|
-
a = function() {
|
|
82
|
-
resolve(func());
|
|
83
|
-
};
|
|
84
|
-
});
|
|
85
|
-
this.queue.push(a);
|
|
86
|
-
return p;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Removes all queued items
|
|
91
|
-
*/
|
|
92
|
-
empty() {
|
|
93
|
-
this.queue.length = 0;
|
|
94
|
-
}
|
|
95
|
-
};
|
package/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../sprig-browser/index.js"],"names":[],"mappings":";IA2La,0CAmBV;;;AAzMH;IACE;;;;OAIG;IACH,sCAEC;IAED;;;OAGG;IACH,8CAEC;IAED;;;OAGG;IACH,qCAEC;IAED;;OAEG;IACH,aAEC;IAED;;OAEG;IACH,eAEC;IAED;;OAEG;IACH,4BAEC;IAED;;;;OAIG;IACH,qDAEC;IAED;;;OAGG;IACH,qCAEC;IAED;;;;;;OAMG;IACH;QAJ2B,UAAU;QACV,MAAM;QACN,WAAW;aAIrC;IAED;;;OAGG;IACH,wCAEC;IAED;;;;OAIG;IACH,qDAEC;IAED;;;;OAIG;IACH,wDAEC;IAED;;OAEG;IACH,2BAEC;IAED;;OAEG;IACH,2BAEC;IAED;;OAEG;IACH,6BAEC;IAED;;OAEG;IACH,qDAEC;IAED;;;;;OAKG;IACH,+CAEC;IAED;;;;;;;;OAQG;IACH;QAN2B,SAAS;QACV,QAAQ;QACP,MAAM;QACN,WAAW;aAKrC;IAED;;OAEG;IACH,uCAEC;IAED;;;;MAIE;IACF,yDAEC;IAED;;OAEG;IACH,iBAEC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../sprig-browser/shared/conflicting_widgets/index.js"],"names":[],"mappings":"AAIA;IACE,uBAEC;IAED,sBAEC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intercom.d.ts","sourceRoot":"","sources":["../../../../sprig-browser/shared/conflicting_widgets/intercom.js"],"names":[],"mappings":"AAOO,+BASN;AAEM,gCASN"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/* global window, document */
|
|
2
|
-
const getIntercom = () => {
|
|
3
|
-
try {
|
|
4
|
-
return window.parent.Intercom;
|
|
5
|
-
} catch (err) {}
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const enable = () => {
|
|
9
|
-
const Intercom = getIntercom();
|
|
10
|
-
if (!Intercom) return;
|
|
11
|
-
|
|
12
|
-
if (Intercom.ul_wasVisible) {
|
|
13
|
-
Intercom('update', { hide_default_launcher: false });
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
delete Intercom.ul_wasVisible;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const disable = () => {
|
|
20
|
-
const Intercom = getIntercom();
|
|
21
|
-
if (!Intercom) return;
|
|
22
|
-
|
|
23
|
-
Intercom.ul_wasVisible = !!document.querySelector('iframe.intercom-launcher-frame');
|
|
24
|
-
|
|
25
|
-
if (Intercom.ul_wasVisible) {
|
|
26
|
-
Intercom('update', { hide_default_launcher: true });
|
|
27
|
-
}
|
|
28
|
-
};
|
package/shared/constants.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Various modes that the app can be in. For now test is the
|
|
3
|
-
* only one that matters
|
|
4
|
-
* @type {Object}
|
|
5
|
-
*/
|
|
6
|
-
export const APP_MODES: any;
|
|
7
|
-
export const PAGE_URL_EVENT_NAME: "pageUrl";
|
|
8
|
-
export namespace HEADERS {
|
|
9
|
-
const ENVIRONMENT_ID: string;
|
|
10
|
-
const PARTNER_ANONYMOUS_ID: string;
|
|
11
|
-
const USER_ID: string;
|
|
12
|
-
const VISITOR_ID: string;
|
|
13
|
-
const INSTALLATION_METHOD: string;
|
|
14
|
-
}
|
|
15
|
-
export namespace INSTALLATION_METHOD {
|
|
16
|
-
const NPM: string;
|
|
17
|
-
const GTM: string;
|
|
18
|
-
const SEGMENT: string;
|
|
19
|
-
const SNIPPET: string;
|
|
20
|
-
}
|
|
21
|
-
export namespace CSS_CONSTANTS {
|
|
22
|
-
const CUSTOM_STYLE_TAG_ID: string;
|
|
23
|
-
const CARD_CONTAINER_CLASS: string;
|
|
24
|
-
const VIDEO_CARD_CLASS: string;
|
|
25
|
-
const CLOSE_CONTAINER_CLASS: string;
|
|
26
|
-
const CLOSE_BUTTON_CLASS: string;
|
|
27
|
-
const LIKERT_NUMBER_CLASS: string;
|
|
28
|
-
const NPS_NUMBER_CLASS: string;
|
|
29
|
-
const CHOICE_CLASS: string;
|
|
30
|
-
const CHOICE_LABEL_CLASS: string;
|
|
31
|
-
const CHOICE_CHECKBOX_CLASS: string;
|
|
32
|
-
const CHOICE_RADIO_CLASS: string;
|
|
33
|
-
const CHOICE_GROUP_CLASS: string;
|
|
34
|
-
const OPEN_TEXT_INPUT: string;
|
|
35
|
-
const DESKTOP_SUFFIX: string;
|
|
36
|
-
const MOBILE_SUFFIX: string;
|
|
37
|
-
const QUESTION_HEADER_CLASS: string;
|
|
38
|
-
const CAPTION_CLASS: string;
|
|
39
|
-
const FADE_IN_CLASS: string;
|
|
40
|
-
const CARD_MAIN_CONTENT: string;
|
|
41
|
-
}
|
|
42
|
-
export namespace EXPERIMENT_FLAGS {
|
|
43
|
-
const SURVEY_MOBILE_STYLING: string;
|
|
44
|
-
}
|
|
45
|
-
export const MOBILE_MAX_WIDTH: 500;
|
|
46
|
-
export function getClasses(baseClass: any, useMobileStyling: any): any[];
|
|
47
|
-
export function getPlatformClass(baseClass: any, platform: any): any[];
|
|
48
|
-
export const MOBILE_PLATFORM_HEADERS: string[];
|
|
49
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../sprig-browser/shared/constants.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,4BAEE;AAEF,4CAA6C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2C7C,mCAAoC;AAE7B,yEAIN;AAEM,uEAEN;AAED,+CAA0D"}
|
package/shared/constants.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Various modes that the app can be in. For now test is the
|
|
3
|
-
* only one that matters
|
|
4
|
-
* @type {Object}
|
|
5
|
-
*/
|
|
6
|
-
export const APP_MODES = {
|
|
7
|
-
test: 'test',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const PAGE_URL_EVENT_NAME = 'pageUrl';
|
|
11
|
-
|
|
12
|
-
export const HEADERS = {
|
|
13
|
-
ENVIRONMENT_ID: 'x-ul-environment-id',
|
|
14
|
-
PARTNER_ANONYMOUS_ID: 'x-ul-anonymous-id',
|
|
15
|
-
USER_ID: 'x-ul-user-id',
|
|
16
|
-
VISITOR_ID: 'x-ul-visitor-id',
|
|
17
|
-
INSTALLATION_METHOD: 'x-ul-installation-method',
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const INSTALLATION_METHOD = {
|
|
21
|
-
NPM: 'web-npm',
|
|
22
|
-
GTM: 'web-gtm',
|
|
23
|
-
SEGMENT: 'web-segment',
|
|
24
|
-
SNIPPET: 'web-snippet',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const CSS_CONSTANTS = {
|
|
28
|
-
CUSTOM_STYLE_TAG_ID: 'ul-custom-style',
|
|
29
|
-
CARD_CONTAINER_CLASS: 'ul-card__container',
|
|
30
|
-
VIDEO_CARD_CLASS: 'ul-card--video',
|
|
31
|
-
CLOSE_CONTAINER_CLASS: 'close-container',
|
|
32
|
-
CLOSE_BUTTON_CLASS: 'close-btn',
|
|
33
|
-
LIKERT_NUMBER_CLASS: 'likert-number',
|
|
34
|
-
NPS_NUMBER_CLASS: 'nps-number',
|
|
35
|
-
CHOICE_CLASS: 'choice',
|
|
36
|
-
CHOICE_LABEL_CLASS: 'select-label',
|
|
37
|
-
CHOICE_CHECKBOX_CLASS: 'select-checkbox',
|
|
38
|
-
CHOICE_RADIO_CLASS: 'select-radio',
|
|
39
|
-
CHOICE_GROUP_CLASS: 'ul-card__choices',
|
|
40
|
-
OPEN_TEXT_INPUT: 'ul-card-text__input',
|
|
41
|
-
DESKTOP_SUFFIX: '--desktop',
|
|
42
|
-
MOBILE_SUFFIX: '--mobile',
|
|
43
|
-
QUESTION_HEADER_CLASS: 'ul-question',
|
|
44
|
-
CAPTION_CLASS: 'ul-caption',
|
|
45
|
-
FADE_IN_CLASS: 'fade-in-transition',
|
|
46
|
-
CARD_MAIN_CONTENT: 'ul-card-main-content',
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const EXPERIMENT_FLAGS = {
|
|
50
|
-
SURVEY_MOBILE_STYLING: 'survey-mobile-styling',
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const MOBILE_MAX_WIDTH = 500;
|
|
54
|
-
|
|
55
|
-
export const getClasses = (baseClass, useMobileStyling) => {
|
|
56
|
-
const suffix = useMobileStyling ? CSS_CONSTANTS.MOBILE_SUFFIX : CSS_CONSTANTS.DESKTOP_SUFFIX;
|
|
57
|
-
|
|
58
|
-
return [baseClass + suffix, baseClass];
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const getPlatformClass = (baseClass, platform) => {
|
|
62
|
-
return [baseClass, `${baseClass}__${platform}`];
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export const MOBILE_PLATFORM_HEADERS = ['ios', 'android'];
|
package/shared/deferred.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default Deferred;
|
|
2
|
-
declare class Deferred {
|
|
3
|
-
constructor(payload: any);
|
|
4
|
-
promise: Promise<any>;
|
|
5
|
-
payload: any;
|
|
6
|
-
reject: (reason?: any) => void;
|
|
7
|
-
resolve: (value: any) => void;
|
|
8
|
-
resolveRequest(result: any): void;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=deferred.d.ts.map
|
package/shared/deferred.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deferred.d.ts","sourceRoot":"","sources":["../../../sprig-browser/shared/deferred.js"],"names":[],"mappings":";AAAA;IACE,0BAMC;IALC,sBAIE;IAHA,aAAsB;IACtB,+BAAoB;IACpB,8BAAsB;IAI1B,kCAEC;CACF"}
|
package/shared/deferred.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
class Deferred {
|
|
2
|
-
constructor(payload) {
|
|
3
|
-
this.promise = new Promise((resolve, reject) => {
|
|
4
|
-
this.payload = payload;
|
|
5
|
-
this.reject = reject;
|
|
6
|
-
this.resolve = resolve;
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
resolveRequest(result) {
|
|
11
|
-
this.resolve(result);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default Deferred;
|
package/shared/eventEmitter.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default instance;
|
|
2
|
-
declare const instance: ULEventEmitter;
|
|
3
|
-
declare class ULEventEmitter {
|
|
4
|
-
_events: {};
|
|
5
|
-
subscribe(name: any, listener: any): void;
|
|
6
|
-
removeListener(name: any, listenerToRemove: any): void;
|
|
7
|
-
removeAllListeners(): void;
|
|
8
|
-
emit(name: any, data: any): void;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=eventEmitter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eventEmitter.d.ts","sourceRoot":"","sources":["../../../sprig-browser/shared/eventEmitter.js"],"names":[],"mappings":";AAgDA,uCAAsC;AA7CtC;IAGM,YAAiB;IAOrB,0CAIC;IAED,uDAQC;IACD,2BAIC;IAED,iCAWC;CACF"}
|
package/shared/eventEmitter.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/*global UserLeap*/
|
|
2
|
-
// singleton event emitter instance for UserLeap web events
|
|
3
|
-
// provides basic functionality such as subcribing to and emitting events
|
|
4
|
-
class ULEventEmitter {
|
|
5
|
-
constructor() {
|
|
6
|
-
if (!ULEventEmitter.instance) {
|
|
7
|
-
this._events = {};
|
|
8
|
-
ULEventEmitter.instance = this;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return ULEventEmitter.instance;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
subscribe(name, listener) {
|
|
15
|
-
if (!name || !listener) return;
|
|
16
|
-
if (!this._events[name]) this._events[name] = [];
|
|
17
|
-
this._events[name].push(listener);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
removeListener(name, listenerToRemove) {
|
|
21
|
-
if (!name || !listenerToRemove) return;
|
|
22
|
-
if (!this._events[name]) {
|
|
23
|
-
if (UserLeap.debugMode) console.log(`[DEBUG] ULEventEmitter: Can't remove a listener. Event "${name}" doesn't exist.`);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const filterListeners = (listener) => listener !== listenerToRemove;
|
|
27
|
-
this._events[name] = this._events[name].filter(filterListeners);
|
|
28
|
-
}
|
|
29
|
-
removeAllListeners() {
|
|
30
|
-
Object.keys(this._events).map((key) => {
|
|
31
|
-
this._events[key] = [];
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
emit(name, data) {
|
|
36
|
-
if (!this._events[name] || this._events[name].length == 0) {
|
|
37
|
-
if (UserLeap.debugMode) console.log(`[DEBUG] ULEventEmitter: No listener registered for event "${name}".`, data);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const fireCallbacks = (callback) => {
|
|
42
|
-
callback(data);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
this._events[name].forEach(fireCallbacks);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const instance = new ULEventEmitter();
|
|
50
|
-
Object.freeze(instance);
|
|
51
|
-
|
|
52
|
-
export default instance;
|
package/shared/network.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export function killNetworkRequests(reason: any): void;
|
|
2
|
-
export function getHttpHeaders(Sprig?: {}): {
|
|
3
|
-
'Content-Type': string;
|
|
4
|
-
'userleap-platform': string;
|
|
5
|
-
'x-ul-sdk-version': string;
|
|
6
|
-
};
|
|
7
|
-
export function ulFetch(url: any, options: any, attempt?: number, shouldDropOnRateLimit?: boolean, shouldRetryRequest?: boolean): any;
|
|
8
|
-
//# sourceMappingURL=network.d.ts.map
|
package/shared/network.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../../sprig-browser/shared/network.js"],"names":[],"mappings":"AAkBA,uDAGC;AAED;;;;EAmBC;AAYD,sIA2EC"}
|