surveysparrow-ionic-plugin 2.0.3 → 2.0.4-beta.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/dist/angular-ui/fesm2022/angular-ui.mjs +1203 -998
- package/dist/angular-ui/fesm2022/angular-ui.mjs.map +1 -1
- package/dist/angular-ui/index.d.ts +119 -5
- package/dist/docs.json +13 -5
- package/dist/esm/angular-ui/lib/public-api.js.map +1 -1
- package/dist/esm/angular-ui/lib/spotcheck.component.d.ts +30 -1
- package/dist/esm/angular-ui/lib/spotcheck.component.js +194 -4
- package/dist/esm/angular-ui/lib/spotcheck.component.js.map +1 -1
- package/dist/esm/angular-ui/lib/spotchecks/components/builder.component.d.ts +57 -0
- package/dist/esm/angular-ui/lib/spotchecks/components/builder.component.js +284 -0
- package/dist/esm/angular-ui/lib/spotchecks/components/builder.component.js.map +1 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/binding.d.ts +25 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/binding.js +107 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/binding.js.map +1 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/device.d.ts +11 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/device.js +48 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/device.js.map +1 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/executables.d.ts +4 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/executables.js +113 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/executables.js.map +1 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/listener.d.ts +9 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/listener.js +55 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/listener.js.map +1 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/render.d.ts +5 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/render.js +43 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/render.js.map +1 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/sentry.d.ts +7 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/sentry.js +115 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/sentry.js.map +1 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/storage.d.ts +3 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/storage.js +40 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/storage.js.map +1 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/survey-page.d.ts +22 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/survey-page.js +128 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/survey-page.js.map +1 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/version.d.ts +2 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/version.js +4 -0
- package/dist/esm/angular-ui/lib/spotchecks/helpers/version.js.map +1 -0
- package/dist/esm/angular-ui/lib/spotchecks/index.d.ts +4 -3
- package/dist/esm/angular-ui/lib/spotchecks/index.js +2 -2
- package/dist/esm/angular-ui/lib/spotchecks/index.js.map +1 -1
- package/dist/esm/angular-ui/lib/spotchecks/spotcheck.d.ts +8 -0
- package/dist/esm/angular-ui/lib/spotchecks/spotcheck.js +147 -0
- package/dist/esm/angular-ui/lib/spotchecks/spotcheck.js.map +1 -0
- package/dist/esm/angular-ui/lib/spotchecks/state/store.d.ts +14 -0
- package/dist/esm/angular-ui/lib/spotchecks/state/store.js +109 -0
- package/dist/esm/angular-ui/lib/spotchecks/state/store.js.map +1 -0
- package/dist/esm/angular-ui/lib/spotchecks/types.d.ts +22 -58
- package/dist/esm/angular-ui/lib/spotchecks/types.js.map +1 -1
- package/dist/plugin.cjs.js +1211 -51762
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +1209 -51761
- package/dist/plugin.js.map +1 -1
- package/package.json +4 -8
- package/src/angular-ui/lib/public-api.ts +1 -1
- package/src/angular-ui/lib/spotcheck.component.ts +202 -5
- package/src/angular-ui/lib/spotchecks/components/builder.component.ts +254 -0
- package/src/angular-ui/lib/spotchecks/helpers/binding.ts +126 -0
- package/src/angular-ui/lib/spotchecks/helpers/device.ts +51 -0
- package/src/angular-ui/lib/spotchecks/helpers/executables.ts +124 -0
- package/src/angular-ui/lib/spotchecks/helpers/listener.ts +61 -0
- package/src/angular-ui/lib/spotchecks/helpers/render.ts +44 -0
- package/src/angular-ui/lib/spotchecks/helpers/sentry.ts +127 -0
- package/src/angular-ui/lib/spotchecks/helpers/storage.ts +37 -0
- package/src/angular-ui/lib/spotchecks/helpers/survey-page.ts +120 -0
- package/src/angular-ui/lib/spotchecks/helpers/version.ts +3 -0
- package/src/angular-ui/lib/spotchecks/index.ts +11 -3
- package/src/angular-ui/lib/spotchecks/spotcheck.ts +150 -0
- package/src/angular-ui/lib/spotchecks/state/store.ts +126 -0
- package/src/angular-ui/lib/spotchecks/types.ts +26 -59
- package/src/angular-ui/ng-package.json +9 -12
- package/src/angular-ui/package.json +9 -8
- package/dist/angular-ui/esm2022/angular-ui.mjs +0 -5
- package/dist/angular-ui/esm2022/public-api.mjs +0 -3
- package/dist/angular-ui/esm2022/spotcheck.component.mjs +0 -17
- package/dist/angular-ui/esm2022/spotchecks/SpotCheck.mjs +0 -51
- package/dist/angular-ui/esm2022/spotchecks/SpotCheckComponent.mjs +0 -410
- package/dist/angular-ui/esm2022/spotchecks/SpotCheckEventListener.mjs +0 -26
- package/dist/angular-ui/esm2022/spotchecks/SpotcheckStateService.mjs +0 -67
- package/dist/angular-ui/esm2022/spotchecks/api.mjs +0 -230
- package/dist/angular-ui/esm2022/spotchecks/helpers.mjs +0 -338
- package/dist/angular-ui/esm2022/spotchecks/index.mjs +0 -3
- package/dist/angular-ui/esm2022/spotchecks/storage.mjs +0 -7
- package/dist/angular-ui/esm2022/spotchecks/types.mjs +0 -2
- package/dist/angular-ui/public-api.d.ts +0 -2
- package/dist/angular-ui/spotcheck.component.d.ts +0 -5
- package/dist/angular-ui/spotchecks/SpotCheck.d.ts +0 -4
- package/dist/angular-ui/spotchecks/SpotCheckComponent.d.ts +0 -65
- package/dist/angular-ui/spotchecks/SpotCheckEventListener.d.ts +0 -16
- package/dist/angular-ui/spotchecks/SpotcheckStateService.d.ts +0 -12
- package/dist/angular-ui/spotchecks/api.d.ts +0 -15
- package/dist/angular-ui/spotchecks/helpers.d.ts +0 -30
- package/dist/angular-ui/spotchecks/index.d.ts +0 -3
- package/dist/angular-ui/spotchecks/storage.d.ts +0 -2
- package/dist/angular-ui/spotchecks/types.d.ts +0 -80
- package/dist/esm/angular-ui/lib/spotchecks/SpotCheck.d.ts +0 -4
- package/dist/esm/angular-ui/lib/spotchecks/SpotCheck.js +0 -51
- package/dist/esm/angular-ui/lib/spotchecks/SpotCheck.js.map +0 -1
- package/dist/esm/angular-ui/lib/spotchecks/SpotCheckComponent.d.ts +0 -56
- package/dist/esm/angular-ui/lib/spotchecks/SpotCheckComponent.js +0 -397
- package/dist/esm/angular-ui/lib/spotchecks/SpotCheckComponent.js.map +0 -1
- package/dist/esm/angular-ui/lib/spotchecks/SpotCheckEventListener.d.ts +0 -16
- package/dist/esm/angular-ui/lib/spotchecks/SpotCheckEventListener.js +0 -28
- package/dist/esm/angular-ui/lib/spotchecks/SpotCheckEventListener.js.map +0 -1
- package/dist/esm/angular-ui/lib/spotchecks/SpotcheckStateService.d.ts +0 -9
- package/dist/esm/angular-ui/lib/spotchecks/SpotcheckStateService.js +0 -72
- package/dist/esm/angular-ui/lib/spotchecks/SpotcheckStateService.js.map +0 -1
- package/dist/esm/angular-ui/lib/spotchecks/api.d.ts +0 -15
- package/dist/esm/angular-ui/lib/spotchecks/api.js +0 -232
- package/dist/esm/angular-ui/lib/spotchecks/api.js.map +0 -1
- package/dist/esm/angular-ui/lib/spotchecks/helpers.d.ts +0 -30
- package/dist/esm/angular-ui/lib/spotchecks/helpers.js +0 -304
- package/dist/esm/angular-ui/lib/spotchecks/helpers.js.map +0 -1
- package/dist/esm/angular-ui/lib/spotchecks/storage.d.ts +0 -2
- package/dist/esm/angular-ui/lib/spotchecks/storage.js +0 -7
- package/dist/esm/angular-ui/lib/spotchecks/storage.js.map +0 -1
- package/src/angular-ui/lib/spotchecks/SpotCheck.ts +0 -54
- package/src/angular-ui/lib/spotchecks/SpotCheckComponent.css +0 -7
- package/src/angular-ui/lib/spotchecks/SpotCheckComponent.html +0 -27
- package/src/angular-ui/lib/spotchecks/SpotCheckComponent.ts +0 -389
- package/src/angular-ui/lib/spotchecks/SpotCheckEventListener.ts +0 -50
- package/src/angular-ui/lib/spotchecks/SpotcheckStateService.ts +0 -66
- package/src/angular-ui/lib/spotchecks/api.ts +0 -286
- package/src/angular-ui/lib/spotchecks/helpers.ts +0 -414
- package/src/angular-ui/lib/spotchecks/storage.ts +0 -7
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { componentStore, functionStore, spotcheckStore } from './state/store';
|
|
2
|
+
import { execute, markInitialized } from './helpers/executables';
|
|
3
|
+
import { setListener } from './helpers/listener';
|
|
4
|
+
import { getDeviceFacts, getVisitorInfo, loadDeviceInfo } from './helpers/device';
|
|
5
|
+
import { addBreadcrumb, captureP0Error } from './helpers/sentry';
|
|
6
|
+
import { FRAMEWORK } from './helpers/version';
|
|
7
|
+
import type {
|
|
8
|
+
SpotcheckProps,
|
|
9
|
+
TrackEventProps,
|
|
10
|
+
TrackScreenOptions,
|
|
11
|
+
TrackScreenProps,
|
|
12
|
+
} from './types';
|
|
13
|
+
|
|
14
|
+
export { SDK_VERSION } from './helpers/version';
|
|
15
|
+
|
|
16
|
+
const INIT_TIMEOUT_MS = 15000;
|
|
17
|
+
|
|
18
|
+
// Backend functions, schemas and page script for this SDK (framework=ionic).
|
|
19
|
+
const getAllSpotcheckFunctions = async (domainName: string) => {
|
|
20
|
+
const controller = typeof AbortController !== 'undefined' ? new AbortController() : null;
|
|
21
|
+
const timer = setTimeout(() => controller?.abort(), INIT_TIMEOUT_MS);
|
|
22
|
+
try {
|
|
23
|
+
const response = await fetch(
|
|
24
|
+
`https://${domainName}/api/internal/spotcheck/mobile/init?framework=${FRAMEWORK}`,
|
|
25
|
+
{ signal: controller?.signal, cache: 'no-store' },
|
|
26
|
+
);
|
|
27
|
+
if (!response.ok) throw new Error(`mobile/init failed with status ${response.status}`);
|
|
28
|
+
const data = await response.json().catch(() => null);
|
|
29
|
+
// A non-JSON 200 (e.g. captive portal) counts as a failed init.
|
|
30
|
+
if (!data || typeof data !== 'object' || typeof data.initializeSpotcheckComponent !== 'string') {
|
|
31
|
+
throw new Error('Invalid mobile/init response');
|
|
32
|
+
}
|
|
33
|
+
const { componentSchemas, config, ...functions } = data;
|
|
34
|
+
functionStore.dispatch({ ...functions, isLoaded: true });
|
|
35
|
+
componentStore.dispatch({ schemas: componentSchemas || {}, config: config || {}, isLoaded: Boolean(componentSchemas) });
|
|
36
|
+
return data;
|
|
37
|
+
} catch (error: any) {
|
|
38
|
+
captureP0Error(error, 'SPOTCHECK_INITIALIZATION', {
|
|
39
|
+
component: 'getAllSpotcheckFunctions',
|
|
40
|
+
action: 'fetchFunctions',
|
|
41
|
+
domainName,
|
|
42
|
+
errorMessage: error?.message,
|
|
43
|
+
});
|
|
44
|
+
console.error('Error fetching spotcheck functions:', error);
|
|
45
|
+
throw error;
|
|
46
|
+
} finally {
|
|
47
|
+
clearTimeout(timer);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// Synchronous: trackScreen must reach execute in the same tick as a following trackEvent.
|
|
52
|
+
const refreshVisitor = () => {
|
|
53
|
+
try {
|
|
54
|
+
spotcheckStore.dispatch({ params: { visitor: getVisitorInfo() } });
|
|
55
|
+
} catch {}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Init retry: a failed init (e.g. offline at launch) is retried on the next track call.
|
|
59
|
+
const INIT_RETRY_GAP_MS = 10000;
|
|
60
|
+
let lastInitParams: SpotcheckProps | null = null;
|
|
61
|
+
let initStatus: 'idle' | 'running' | 'done' | 'failed' = 'idle';
|
|
62
|
+
let lastInitAttempt = 0;
|
|
63
|
+
|
|
64
|
+
const retryInitIfFailed = () => {
|
|
65
|
+
if (initStatus !== 'failed' || !lastInitParams) return;
|
|
66
|
+
if (Date.now() - lastInitAttempt < INIT_RETRY_GAP_MS) return;
|
|
67
|
+
initializeSpotChecks(lastInitParams).catch(() => {});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const initializeSpotChecks = async (params: SpotcheckProps): Promise<void> => {
|
|
71
|
+
lastInitParams = params;
|
|
72
|
+
initStatus = 'running';
|
|
73
|
+
lastInitAttempt = Date.now();
|
|
74
|
+
try {
|
|
75
|
+
setListener(params?.listener);
|
|
76
|
+
if (params?.domainName) spotcheckStore.dispatch({ params: { domainName: params.domainName } });
|
|
77
|
+
await loadDeviceInfo();
|
|
78
|
+
refreshVisitor();
|
|
79
|
+
const device = await getDeviceFacts();
|
|
80
|
+
await getAllSpotcheckFunctions(params.domainName);
|
|
81
|
+
const { listener, ...initParams } = params;
|
|
82
|
+
await execute('initializeSpotcheckComponent', { ...initParams, framework: FRAMEWORK, device });
|
|
83
|
+
await markInitialized();
|
|
84
|
+
initStatus = 'done';
|
|
85
|
+
} catch (error: any) {
|
|
86
|
+
// Legacy never threw into the host app; failures go to the backend and the console.
|
|
87
|
+
console.error('Error initializing spotchecks:', error);
|
|
88
|
+
initStatus = 'failed';
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const resolveTrackOptions = (input?: TrackScreenOptions) => ({
|
|
93
|
+
variables: input?.variables ?? {},
|
|
94
|
+
customProperties: input?.customProperties ?? {},
|
|
95
|
+
userDetails: input?.userDetails ?? {},
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
export async function trackScreen(screen: string, options?: TrackScreenOptions): Promise<void>;
|
|
99
|
+
export async function trackScreen(props: TrackScreenProps): Promise<void>;
|
|
100
|
+
export async function trackScreen(screenOrProps: string | TrackScreenProps, optionsArg?: TrackScreenOptions) {
|
|
101
|
+
const screen = typeof screenOrProps === 'string' ? screenOrProps : screenOrProps?.screen;
|
|
102
|
+
const options = resolveTrackOptions(typeof screenOrProps === 'string' ? optionsArg : screenOrProps?.options);
|
|
103
|
+
if (!screen) {
|
|
104
|
+
console.error('trackScreen: `screen` is required');
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
addBreadcrumb('trackScreen', { screen });
|
|
108
|
+
retryInitIfFailed();
|
|
109
|
+
try {
|
|
110
|
+
refreshVisitor();
|
|
111
|
+
await execute('trackScreen', { screen, options });
|
|
112
|
+
} catch (error) {
|
|
113
|
+
// Legacy only logged; never throw into the host app.
|
|
114
|
+
console.error('Error tracking screen:', error);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export async function trackEvent(screen: string, event: Record<string, any>, options?: TrackScreenOptions): Promise<void>;
|
|
119
|
+
export async function trackEvent(props: TrackEventProps): Promise<void>;
|
|
120
|
+
export async function trackEvent(
|
|
121
|
+
screenOrProps: string | TrackEventProps,
|
|
122
|
+
eventArg?: Record<string, any>,
|
|
123
|
+
optionsArg?: TrackScreenOptions,
|
|
124
|
+
) {
|
|
125
|
+
const isString = typeof screenOrProps === 'string';
|
|
126
|
+
const screen = isString ? screenOrProps : screenOrProps?.screen;
|
|
127
|
+
const event = isString ? eventArg : screenOrProps?.event;
|
|
128
|
+
if (!screen) {
|
|
129
|
+
console.error('trackEvent: `screen` is required');
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (event == null) {
|
|
133
|
+
console.error('trackEvent: `event` is required');
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const options = resolveTrackOptions(isString ? optionsArg : screenOrProps.options);
|
|
137
|
+
addBreadcrumb('trackEvent', { screen, event: Object.keys(event || {}).join(',') });
|
|
138
|
+
retryInitIfFailed();
|
|
139
|
+
try {
|
|
140
|
+
await execute('trackEvent', { screen, event, options });
|
|
141
|
+
} catch (error) {
|
|
142
|
+
console.error('Error tracking event:', error);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Closes any open spotcheck and its button (screen changes the SDK can't detect).
|
|
147
|
+
export async function closeSpotChecks(): Promise<void> {
|
|
148
|
+
addBreadcrumb('closeSpotChecks', {});
|
|
149
|
+
await execute('handleNavigationChange', { reason: 'close' });
|
|
150
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
type Listener = () => void;
|
|
2
|
+
|
|
3
|
+
// Minimal observable store; components re-render on every change.
|
|
4
|
+
export class Store<T> {
|
|
5
|
+
private listeners = new Set<Listener>();
|
|
6
|
+
|
|
7
|
+
constructor(private state: T, private reducer: (state: T, update: any) => T) {}
|
|
8
|
+
|
|
9
|
+
getState(): T {
|
|
10
|
+
return this.state;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
dispatch(update: any): void {
|
|
14
|
+
this.state = this.reducer(this.state, update);
|
|
15
|
+
this.listeners.forEach((listener) => {
|
|
16
|
+
try {
|
|
17
|
+
listener();
|
|
18
|
+
} catch (error) {
|
|
19
|
+
console.error('[SpotCheck] store listener failed', error);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
subscribe(listener: Listener): () => void {
|
|
25
|
+
this.listeners.add(listener);
|
|
26
|
+
return () => {
|
|
27
|
+
this.listeners.delete(listener);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Same shape and merge rules as the other SDKs (backend functions read state.SpotCheckState).
|
|
33
|
+
const initialSpotcheckState: any = {
|
|
34
|
+
allSpotChecksInToken: [],
|
|
35
|
+
customEventsSpotChecks: [],
|
|
36
|
+
filteredSpotChecks: [],
|
|
37
|
+
showSpotCheck: false,
|
|
38
|
+
|
|
39
|
+
currentSpotcheck: {
|
|
40
|
+
spotcheckURL: '',
|
|
41
|
+
spotcheckID: 0,
|
|
42
|
+
spotcheckContactID: 0,
|
|
43
|
+
triggerToken: '',
|
|
44
|
+
screenName: '',
|
|
45
|
+
afterDelay: 0,
|
|
46
|
+
isChat: false,
|
|
47
|
+
appearance: {},
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
params: {
|
|
51
|
+
targetToken: '',
|
|
52
|
+
domainName: '',
|
|
53
|
+
userDetails: {},
|
|
54
|
+
variables: {},
|
|
55
|
+
customProperties: {},
|
|
56
|
+
visitor: {},
|
|
57
|
+
framework: 'ionic',
|
|
58
|
+
userAgent: '',
|
|
59
|
+
traceId: '',
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
spotCheckDetails: {
|
|
63
|
+
keyBoardHeight: 0,
|
|
64
|
+
textPosition: 0,
|
|
65
|
+
isMounted: false,
|
|
66
|
+
isVisible: false,
|
|
67
|
+
isExiting: false,
|
|
68
|
+
currentQuestionHeight: 0,
|
|
69
|
+
miniCardHeight: 0,
|
|
70
|
+
sideTabButtonWidth: 0,
|
|
71
|
+
isFullScreenMode: false,
|
|
72
|
+
spotCheckType: null,
|
|
73
|
+
position: 'bottom',
|
|
74
|
+
mode: '',
|
|
75
|
+
closeButton: {
|
|
76
|
+
isEnabled: false,
|
|
77
|
+
color: '#000000',
|
|
78
|
+
isMiniCard: false,
|
|
79
|
+
},
|
|
80
|
+
isSpotCheckButton: false,
|
|
81
|
+
spotCheckButtonConfig: {},
|
|
82
|
+
showSurveyContent: true,
|
|
83
|
+
avatarEnabled: false,
|
|
84
|
+
avatarUrl: '',
|
|
85
|
+
isRTLLanguage: false,
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
webViewDetails: {
|
|
89
|
+
isChatEnabled: false,
|
|
90
|
+
isClassicEnabled: false,
|
|
91
|
+
isClassicLoading: true,
|
|
92
|
+
isChatLoading: true,
|
|
93
|
+
chatUrl: null,
|
|
94
|
+
classicUrl: null,
|
|
95
|
+
isCurrentSpotcheckChat: null,
|
|
96
|
+
canShowClassic: false,
|
|
97
|
+
canShowChat: false,
|
|
98
|
+
webViewInjectionData: null,
|
|
99
|
+
chatWebViewRef: null,
|
|
100
|
+
classicWebViewRef: null,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const NESTED_KEYS = ['currentSpotcheck', 'spotCheckDetails', 'webViewDetails', 'params'];
|
|
105
|
+
|
|
106
|
+
const spotcheckReducer = (state: any, update: any) => {
|
|
107
|
+
const payload = update || {};
|
|
108
|
+
const sc = state.SpotCheckState;
|
|
109
|
+
const next: any = { ...sc, ...payload };
|
|
110
|
+
NESTED_KEYS.forEach((key) => {
|
|
111
|
+
next[key] = { ...sc[key], ...(payload[key] || {}) };
|
|
112
|
+
});
|
|
113
|
+
return { SpotCheckState: next };
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export const spotcheckStore = new Store<any>({ SpotCheckState: initialSpotcheckState }, spotcheckReducer);
|
|
117
|
+
|
|
118
|
+
export const functionStore = new Store<any>(
|
|
119
|
+
{ functionState: { isLoaded: false } },
|
|
120
|
+
(state, update) => ({ functionState: { ...state.functionState, ...(update || {}) } }),
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
export const componentStore = new Store<any>(
|
|
124
|
+
{ componentState: { isLoaded: false, schemas: {} } },
|
|
125
|
+
(state, update) => ({ componentState: { ...state.componentState, ...(update || {}) } }),
|
|
126
|
+
);
|
|
@@ -1,44 +1,8 @@
|
|
|
1
|
-
export interface
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
spotcheckContactID: number;
|
|
7
|
-
afterDelay: number;
|
|
8
|
-
maxHeight: number;
|
|
9
|
-
currentQuestionHeight: number;
|
|
10
|
-
isFullScreenMode: boolean;
|
|
11
|
-
isBannerImageOn: boolean;
|
|
12
|
-
triggerToken: string;
|
|
13
|
-
closeButtonStyle: Record<string, string>;
|
|
14
|
-
isCloseButtonEnabled: boolean;
|
|
15
|
-
isSpotPassed: boolean;
|
|
16
|
-
isChecksPassed: boolean;
|
|
17
|
-
customEventsSpotChecks: Record<string, any>[];
|
|
18
|
-
targetToken: string;
|
|
19
|
-
domainName: string;
|
|
20
|
-
userDetails: UserDetails;
|
|
21
|
-
variables: Variables;
|
|
22
|
-
customProperties: CustomProperties;
|
|
23
|
-
traceId: string;
|
|
24
|
-
isClassicLoading: boolean;
|
|
25
|
-
isChatLoading: boolean;
|
|
26
|
-
isClassicLoadEventReceived: boolean;
|
|
27
|
-
isChatLoadEventReceived: boolean;
|
|
28
|
-
classicUrl: string;
|
|
29
|
-
chatUrl: string;
|
|
30
|
-
classicWebViewRef: any | null;
|
|
31
|
-
chatWebViewRef: any | null;
|
|
32
|
-
filteredSpotChecks: Record<string, any>[];
|
|
33
|
-
spotCheckType: String;
|
|
34
|
-
isMounted: boolean;
|
|
35
|
-
textPosition: number;
|
|
36
|
-
screenHeight: number;
|
|
37
|
-
keyBoardHeight: number;
|
|
38
|
-
spotChecksMode: string;
|
|
39
|
-
avatarEnabled: boolean;
|
|
40
|
-
avatarUrl: string;
|
|
41
|
-
screenwiseUserDetails: Record<string, UserDetails | undefined>;
|
|
1
|
+
export interface SsSpotcheckListener {
|
|
2
|
+
onSurveyLoaded?: (response: Record<string, any>) => void | Promise<void>;
|
|
3
|
+
onSurveyResponse?: (response: Record<string, any>) => void | Promise<void>;
|
|
4
|
+
onPartialSubmission?: (response: Record<string, any>) => void | Promise<void>;
|
|
5
|
+
onCloseButtonTap?: () => void | Promise<void>;
|
|
42
6
|
}
|
|
43
7
|
|
|
44
8
|
export interface UserDetails {
|
|
@@ -59,28 +23,31 @@ export interface CustomProperties {
|
|
|
59
23
|
[key: string]: any;
|
|
60
24
|
}
|
|
61
25
|
|
|
26
|
+
export interface SpotcheckProps {
|
|
27
|
+
domainName: string;
|
|
28
|
+
targetToken: string;
|
|
29
|
+
userDetails?: UserDetails;
|
|
30
|
+
variables?: Variables;
|
|
31
|
+
customProperties?: CustomProperties;
|
|
32
|
+
listener?: SsSpotcheckListener;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Legacy name for the init options.
|
|
36
|
+
export type InitializeSpotChecksProps = SpotcheckProps;
|
|
37
|
+
|
|
38
|
+
export interface TrackScreenOptions {
|
|
39
|
+
variables?: Variables;
|
|
40
|
+
customProperties?: CustomProperties;
|
|
41
|
+
userDetails?: UserDetails;
|
|
42
|
+
}
|
|
43
|
+
|
|
62
44
|
export interface TrackScreenProps {
|
|
63
45
|
screen: string;
|
|
64
|
-
options?:
|
|
65
|
-
variables?: Variables;
|
|
66
|
-
customProperties?: CustomProperties;
|
|
67
|
-
userDetails?: UserDetails;
|
|
68
|
-
};
|
|
46
|
+
options?: TrackScreenOptions;
|
|
69
47
|
}
|
|
70
48
|
|
|
71
49
|
export interface TrackEventProps {
|
|
72
50
|
screen: string;
|
|
73
|
-
event:
|
|
74
|
-
|
|
75
|
-
[key: string]: string;
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface InitializeSpotChecksProps {
|
|
81
|
-
domainName: string;
|
|
82
|
-
targetToken: string;
|
|
83
|
-
userDetails?: UserDetails;
|
|
84
|
-
variables?: Variables;
|
|
85
|
-
customProperties?: CustomProperties;
|
|
51
|
+
event: Record<string, any>;
|
|
52
|
+
options?: TrackScreenOptions;
|
|
86
53
|
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
]
|
|
12
|
-
}
|
|
13
|
-
|
|
2
|
+
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
|
3
|
+
"dest": "../../dist/angular-ui",
|
|
4
|
+
"lib": {
|
|
5
|
+
"entryFile": "lib/public-api.ts"
|
|
6
|
+
},
|
|
7
|
+
"allowedNonPeerDependencies": [
|
|
8
|
+
"@capacitor/device"
|
|
9
|
+
]
|
|
10
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
"name": "angular-ui",
|
|
3
|
+
"version": "1.0.7-beta.15",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/core": ">=16.0.0",
|
|
6
|
+
"@angular/common": ">=16.0.0",
|
|
7
|
+
"@angular/router": ">=16.0.0",
|
|
8
|
+
"@capacitor/core": ">=7.0.0",
|
|
9
|
+
"rxjs": ">=7.0.0"
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
+
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated bundle index. Do not edit.
|
|
3
|
-
*/
|
|
4
|
-
export * from './public-api';
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5ndWxhci11aS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hbmd1bGFyLXVpL2xpYi9hbmd1bGFyLXVpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vcHVibGljLWFwaSc7XG4iXX0=
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export * from './spotcheck.component';
|
|
2
|
-
export * from './spotchecks';
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hbmd1bGFyLXVpL2xpYi9wdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsdUJBQXVCLENBQUM7QUFDdEMsY0FBYyxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL3Nwb3RjaGVjay5jb21wb25lbnQnO1xuZXhwb3J0ICogZnJvbSAnLi9zcG90Y2hlY2tzJzsiXX0=
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Component } from '@angular/core';
|
|
2
|
-
import { SpotCheckComponent } from './spotchecks/SpotCheckComponent';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export class SpotCheck {
|
|
5
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: SpotCheck, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
6
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.3", type: SpotCheck, isStandalone: true, selector: "SpotCheck", ngImport: i0, template: `<SpotCheckComponent />`, isInline: true, dependencies: [{ kind: "component", type: SpotCheckComponent, selector: "SpotCheckComponent" }] });
|
|
7
|
-
}
|
|
8
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: SpotCheck, decorators: [{
|
|
9
|
-
type: Component,
|
|
10
|
-
args: [{
|
|
11
|
-
selector: 'SpotCheck',
|
|
12
|
-
template: `<SpotCheckComponent />`,
|
|
13
|
-
standalone: true,
|
|
14
|
-
imports: [SpotCheckComponent],
|
|
15
|
-
}]
|
|
16
|
-
}] });
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3BvdGNoZWNrLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hbmd1bGFyLXVpL2xpYi9zcG90Y2hlY2suY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDMUMsT0FBTyxFQUFFLGtCQUFrQixFQUFFLE1BQU0saUNBQWlDLENBQUM7O0FBUXJFLE1BQU0sT0FBTyxTQUFTO3VHQUFULFNBQVM7MkZBQVQsU0FBUyxxRUFKVix3QkFBd0IsNERBRXhCLGtCQUFrQjs7MkZBRWpCLFNBQVM7a0JBTnJCLFNBQVM7bUJBQUM7b0JBQ1QsUUFBUSxFQUFFLFdBQVc7b0JBQ3JCLFFBQVEsRUFBRSx3QkFBd0I7b0JBQ2xDLFVBQVUsRUFBRSxJQUFJO29CQUNoQixPQUFPLEVBQUUsQ0FBQyxrQkFBa0IsQ0FBQztpQkFDOUIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBDb21wb25lbnQgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcbmltcG9ydCB7IFNwb3RDaGVja0NvbXBvbmVudCB9IGZyb20gJy4vc3BvdGNoZWNrcy9TcG90Q2hlY2tDb21wb25lbnQnO1xuXG5AQ29tcG9uZW50KHtcbiAgc2VsZWN0b3I6ICdTcG90Q2hlY2snLFxuICB0ZW1wbGF0ZTogYDxTcG90Q2hlY2tDb21wb25lbnQgLz5gLFxuICBzdGFuZGFsb25lOiB0cnVlLFxuICBpbXBvcnRzOiBbU3BvdENoZWNrQ29tcG9uZW50XSxcbn0pXG5leHBvcnQgY2xhc3MgU3BvdENoZWNrIHt9XG4iXX0=
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { sendTrackScreenRequest, sendTrackEventRequest } from './api';
|
|
2
|
-
import { getSpotcheckStateService } from './helpers';
|
|
3
|
-
export const initializeSpotChecks = ({ domainName, targetToken, userDetails = {}, variables = {}, customProperties = {}, }) => {
|
|
4
|
-
const spotcheckStateService = getSpotcheckStateService();
|
|
5
|
-
spotcheckStateService.setState({
|
|
6
|
-
domainName,
|
|
7
|
-
targetToken,
|
|
8
|
-
userDetails,
|
|
9
|
-
variables,
|
|
10
|
-
customProperties,
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
export const trackScreen = async ({ screen, options }) => {
|
|
14
|
-
try {
|
|
15
|
-
const response = await sendTrackScreenRequest({ screen, options });
|
|
16
|
-
if (response.valid) {
|
|
17
|
-
console.log('Screen Tracking succeeded.');
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
if ('error' in response) {
|
|
21
|
-
throw new Error(response.error.toString());
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
throw new Error('Tracking failed without an explicit error.');
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
console.log(`Screen Tracking Failed. ${error.message}`);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
export const trackEvent = async ({ screen, event }) => {
|
|
33
|
-
try {
|
|
34
|
-
const response = await sendTrackEventRequest({ screen, event });
|
|
35
|
-
if (response.valid) {
|
|
36
|
-
console.log('TrackEvent succeeded.');
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
if ('error' in response) {
|
|
40
|
-
throw new Error(response.error.toString());
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
throw new Error('Tracking failed without an explicit error.');
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
console.log(`Event Tracking Failed. ${error.message}`);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU3BvdENoZWNrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2FuZ3VsYXItdWkvbGliL3Nwb3RjaG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