surveysparrow-ionic-plugin 2.0.1 → 2.0.2-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/esm2022/spotchecks/SpotCheckComponent.mjs +51 -3
- package/dist/angular-ui/esm2022/spotchecks/SpotcheckStateService.mjs +3 -1
- package/dist/angular-ui/esm2022/spotchecks/api.mjs +3 -3
- package/dist/angular-ui/esm2022/spotchecks/helpers.mjs +16 -9
- package/dist/angular-ui/esm2022/spotchecks/types.mjs +1 -1
- package/dist/angular-ui/fesm2022/angular-ui.mjs +69 -12
- package/dist/angular-ui/fesm2022/angular-ui.mjs.map +1 -1
- package/dist/angular-ui/spotchecks/SpotCheckComponent.d.ts +1 -0
- package/dist/angular-ui/spotchecks/helpers.d.ts +2 -1
- package/dist/angular-ui/spotchecks/types.d.ts +2 -0
- package/dist/esm/angular-ui/lib/spotchecks/SpotCheckComponent.d.ts +1 -0
- package/dist/esm/angular-ui/lib/spotchecks/SpotCheckComponent.js +48 -1
- package/dist/esm/angular-ui/lib/spotchecks/SpotCheckComponent.js.map +1 -1
- package/dist/esm/angular-ui/lib/spotchecks/SpotcheckStateService.js +2 -0
- package/dist/esm/angular-ui/lib/spotchecks/SpotcheckStateService.js.map +1 -1
- package/dist/esm/angular-ui/lib/spotchecks/api.js +4 -3
- package/dist/esm/angular-ui/lib/spotchecks/api.js.map +1 -1
- package/dist/esm/angular-ui/lib/spotchecks/helpers.d.ts +2 -1
- package/dist/esm/angular-ui/lib/spotchecks/helpers.js +16 -10
- package/dist/esm/angular-ui/lib/spotchecks/helpers.js.map +1 -1
- package/dist/esm/angular-ui/lib/spotchecks/types.d.ts +2 -0
- package/dist/esm/angular-ui/lib/spotchecks/types.js.map +1 -1
- package/dist/plugin.cjs.js +73 -14
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +73 -14
- package/dist/plugin.js.map +1 -1
- package/package.json +1 -1
- package/src/angular-ui/lib/spotchecks/SpotCheckComponent.ts +54 -1
- package/src/angular-ui/lib/spotchecks/SpotcheckStateService.ts +2 -0
- package/src/angular-ui/lib/spotchecks/api.ts +2 -2
- package/src/angular-ui/lib/spotchecks/helpers.ts +19 -8
- package/src/angular-ui/lib/spotchecks/types.ts +2 -0
package/dist/plugin.js
CHANGED
|
@@ -51098,6 +51098,8 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51098
51098
|
traceId: '',
|
|
51099
51099
|
isClassicLoading: true,
|
|
51100
51100
|
isChatLoading: true,
|
|
51101
|
+
isClassicLoadEventReceived: false,
|
|
51102
|
+
isChatLoadEventReceived: false,
|
|
51101
51103
|
classicUrl: '',
|
|
51102
51104
|
chatUrl: '',
|
|
51103
51105
|
classicWebViewRef: null,
|
|
@@ -51133,6 +51135,7 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51133
51135
|
], SpotcheckStateService);
|
|
51134
51136
|
|
|
51135
51137
|
let globalSpotcheckStateService;
|
|
51138
|
+
let globalOS = null;
|
|
51136
51139
|
const getSpotcheckStateService = () => {
|
|
51137
51140
|
if (!globalSpotcheckStateService) {
|
|
51138
51141
|
globalSpotcheckStateService = new SpotcheckStateService();
|
|
@@ -51152,10 +51155,11 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51152
51155
|
};
|
|
51153
51156
|
const getOS = async () => {
|
|
51154
51157
|
const info = await device.Device.getInfo();
|
|
51155
|
-
|
|
51158
|
+
globalOS = info.operatingSystem;
|
|
51159
|
+
return globalOS;
|
|
51156
51160
|
};
|
|
51157
51161
|
const setAppearance = async (responseJson, screen, domainName, traceId, variables) => {
|
|
51158
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
51162
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
51159
51163
|
try {
|
|
51160
51164
|
const spotcheckStateService = getSpotcheckStateService();
|
|
51161
51165
|
let state = spotcheckStateService.getState();
|
|
@@ -51202,11 +51206,11 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51202
51206
|
spotcheckStateService.setState(updatedState);
|
|
51203
51207
|
try {
|
|
51204
51208
|
const response = await axios.get(fullSpotcheckURL);
|
|
51205
|
-
const themeInfo = response.data.config.generatedCSS;
|
|
51209
|
+
const themeInfo = (_p = (_o = response.data) === null || _o === void 0 ? void 0 : _o.config) === null || _p === void 0 ? void 0 : _p.generatedCSS;
|
|
51206
51210
|
const theme_payload = { type: 'THEME_UPDATE_SPOTCHECK', themeInfo };
|
|
51207
51211
|
state = spotcheckStateService.getState();
|
|
51208
51212
|
let webViewRef = chat ? state.chatWebViewRef : state.classicWebViewRef;
|
|
51209
|
-
let isLoading = chat ? state.isChatLoading : state.isClassicLoading;
|
|
51213
|
+
let isLoading = chat ? state.isChatLoading || !state.isChatLoadEventReceived : state.isClassicLoading || !state.isClassicLoadEventReceived;
|
|
51210
51214
|
const resetStateData = {
|
|
51211
51215
|
type: 'RESET_STATE',
|
|
51212
51216
|
state: Object.assign(Object.assign({}, (response.data || {})), { skip: true, spotCheckAppearance: Object.assign(Object.assign({}, (appearance || {})), { targetType: 'MOBILE' }), spotcheckUrl: screen, traceId, elementBuilderParams: Object.assign({}, (variables || {})) }),
|
|
@@ -51237,8 +51241,8 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51237
51241
|
else {
|
|
51238
51242
|
// todo: recheck this
|
|
51239
51243
|
const unsubscribe = spotcheckStateService.state$.subscribe((currentState) => {
|
|
51240
|
-
const { isChatLoading, isClassicLoading, chatWebViewRef, classicWebViewRef, } = currentState;
|
|
51241
|
-
if ((!isChatLoading && chat) || (!isClassicLoading && !chat)) {
|
|
51244
|
+
const { isChatLoading, isClassicLoading, chatWebViewRef, classicWebViewRef, isClassicLoadEventReceived, isChatLoadEventReceived, } = currentState;
|
|
51245
|
+
if ((!isChatLoading && chat && isChatLoadEventReceived) || (!isClassicLoading && !chat && isClassicLoadEventReceived)) {
|
|
51242
51246
|
unsubscribe.unsubscribe();
|
|
51243
51247
|
const activeWebViewRef = chat
|
|
51244
51248
|
? chatWebViewRef
|
|
@@ -51261,8 +51265,8 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51261
51265
|
? currentState.chatWebViewRef
|
|
51262
51266
|
: currentState.classicWebViewRef;
|
|
51263
51267
|
const updatedIsLoading = chat
|
|
51264
|
-
? currentState.isChatLoading
|
|
51265
|
-
: currentState.isClassicLoading;
|
|
51268
|
+
? currentState.isChatLoading || !currentState.isChatLoadEventReceived
|
|
51269
|
+
: currentState.isClassicLoading || !currentState.isClassicLoadEventReceived;
|
|
51266
51270
|
if (updatedWebViewRef) {
|
|
51267
51271
|
if (!updatedIsLoading) {
|
|
51268
51272
|
unsubscribeWebView.unsubscribe();
|
|
@@ -51365,11 +51369,15 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51365
51369
|
height: '100%',
|
|
51366
51370
|
};
|
|
51367
51371
|
}
|
|
51372
|
+
let marginBottom = globalOS !== 'ios' ? 18 : 0;
|
|
51368
51373
|
if (state.isVisible && state.isMounted) {
|
|
51369
51374
|
let height = Math.min(state.currentQuestionHeight, (state.maxHeight * window.innerHeight));
|
|
51370
51375
|
if (state.spotChecksMode === 'miniCard') {
|
|
51371
51376
|
if (state.avatarEnabled) {
|
|
51372
51377
|
height = height - 56;
|
|
51378
|
+
if (state.spotcheckPosition === 'bottom') {
|
|
51379
|
+
marginBottom += 56;
|
|
51380
|
+
}
|
|
51373
51381
|
}
|
|
51374
51382
|
if (state.isCloseButtonEnabled) {
|
|
51375
51383
|
height = height - 40;
|
|
@@ -51412,8 +51420,8 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51412
51420
|
}
|
|
51413
51421
|
}
|
|
51414
51422
|
return {
|
|
51415
|
-
wrapperStyles: Object.assign({ position: 'fixed', width: '100%', height: '100%', top: '0', left: '0', backgroundColor: 'rgba(0, 0, 0, 0.3)', zIndex: '
|
|
51416
|
-
styles: Object.assign({ display: 'none', flexDirection: 'column', paddingTop: extraPaddingForMiniCardCloseButtonIfTopPosition + 'px' }, styles)
|
|
51423
|
+
wrapperStyles: Object.assign({ position: 'fixed', width: '100%', height: '100%', top: '0', left: '0', backgroundColor: 'rgba(0, 0, 0, 0.3)', zIndex: '100001', display: 'none', flexDirection: 'column' }, wrapperStyles),
|
|
51424
|
+
styles: Object.assign({ display: 'none', flexDirection: 'column', paddingTop: extraPaddingForMiniCardCloseButtonIfTopPosition + 'px', marginBottom: marginBottom + 'px' }, styles)
|
|
51417
51425
|
};
|
|
51418
51426
|
};
|
|
51419
51427
|
const closeSpotCheckAndHandleSurveyEnd = async () => {
|
|
@@ -51463,6 +51471,7 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51463
51471
|
setupIframeLoadListener() {
|
|
51464
51472
|
const iframe = this.iframe.nativeElement;
|
|
51465
51473
|
iframe.addEventListener('load', () => {
|
|
51474
|
+
this.injectNativeBridgeAdapters(iframe);
|
|
51466
51475
|
const stateService = getSpotcheckStateService();
|
|
51467
51476
|
if (this.webviewType === 'classic') {
|
|
51468
51477
|
stateService.setState({ isClassicLoading: false });
|
|
@@ -51472,6 +51481,45 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51472
51481
|
}
|
|
51473
51482
|
});
|
|
51474
51483
|
}
|
|
51484
|
+
injectNativeBridgeAdapters(iframe) {
|
|
51485
|
+
if (iframe && iframe.contentWindow) {
|
|
51486
|
+
try {
|
|
51487
|
+
const iframeWindow = iframe.contentWindow;
|
|
51488
|
+
if (!iframeWindow.SsAndroidSdk) {
|
|
51489
|
+
iframeWindow.SsAndroidSdk = {
|
|
51490
|
+
shareData: function () { },
|
|
51491
|
+
sendPartialSubmissionData: function () { }
|
|
51492
|
+
};
|
|
51493
|
+
}
|
|
51494
|
+
if (!iframeWindow.Android) {
|
|
51495
|
+
iframeWindow.Android = {
|
|
51496
|
+
onMessageReceive: function () { }
|
|
51497
|
+
};
|
|
51498
|
+
}
|
|
51499
|
+
if (!iframeWindow.webkit) {
|
|
51500
|
+
iframeWindow.webkit = {
|
|
51501
|
+
messageHandlers: {
|
|
51502
|
+
surveyResponse: {
|
|
51503
|
+
postMessage: function () { }
|
|
51504
|
+
},
|
|
51505
|
+
spotCheckData: {
|
|
51506
|
+
postMessage: function () { }
|
|
51507
|
+
},
|
|
51508
|
+
flutterSpotCheckData: {
|
|
51509
|
+
postMessage: function () { }
|
|
51510
|
+
}
|
|
51511
|
+
}
|
|
51512
|
+
};
|
|
51513
|
+
}
|
|
51514
|
+
if (!iframeWindow.flutterSpotCheckData) {
|
|
51515
|
+
iframeWindow.flutterSpotCheckData = {
|
|
51516
|
+
postMessage: function () { }
|
|
51517
|
+
};
|
|
51518
|
+
}
|
|
51519
|
+
}
|
|
51520
|
+
catch (error) { }
|
|
51521
|
+
}
|
|
51522
|
+
}
|
|
51475
51523
|
onMessage(event) {
|
|
51476
51524
|
const stateService = getSpotcheckStateService();
|
|
51477
51525
|
const { data } = event;
|
|
@@ -51497,6 +51545,15 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51497
51545
|
closeSpotCheckAndHandleSurveyEnd();
|
|
51498
51546
|
// spotchecksListener.emitSurveyCompleted(data.response);
|
|
51499
51547
|
break;
|
|
51548
|
+
case 'surveyLoadStarted':
|
|
51549
|
+
// spotchecksListener.emitSurveyLoadStarted(data.surveyDetails);
|
|
51550
|
+
break;
|
|
51551
|
+
case 'classicLoadEvent':
|
|
51552
|
+
stateService.setState({ isClassicLoadEventReceived: true });
|
|
51553
|
+
break;
|
|
51554
|
+
case 'chatLoadEvent':
|
|
51555
|
+
stateService.setState({ isChatLoadEventReceived: true });
|
|
51556
|
+
break;
|
|
51500
51557
|
}
|
|
51501
51558
|
}
|
|
51502
51559
|
};
|
|
@@ -51528,7 +51585,8 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51528
51585
|
template: `
|
|
51529
51586
|
<div style="overflow: hidden; height: 100%; border-radius: {{isMiniCard ? 12 : 0}}px; padding-left: {{isMiniCard ? 12 : 0}}px; padding-right: {{isMiniCard ? 12 : 0}}px; box-sizing: border-box;">
|
|
51530
51587
|
<iframe
|
|
51531
|
-
allow="camera; microphone; geolocation; display-capture; autoplay; clipboard-read; clipboard-write;"
|
|
51588
|
+
allow="camera; microphone; geolocation; display-capture; autoplay; clipboard-read; clipboard-write; fullscreen"
|
|
51589
|
+
allowfullscreen
|
|
51532
51590
|
#iframeRef
|
|
51533
51591
|
[src]="safeUrl"
|
|
51534
51592
|
style="width: 100%; height: 100%; display: block; border-radius: {{isMiniCard ? 12 : 0}}px;"
|
|
@@ -51744,6 +51802,7 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51744
51802
|
};
|
|
51745
51803
|
|
|
51746
51804
|
const sendTrackScreenRequest = async ({ screen, options, }) => {
|
|
51805
|
+
var _a, _b;
|
|
51747
51806
|
try {
|
|
51748
51807
|
const spotcheckStateService = getSpotcheckStateService();
|
|
51749
51808
|
const oldState = spotcheckStateService.getState();
|
|
@@ -51862,7 +51921,7 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51862
51921
|
}
|
|
51863
51922
|
}
|
|
51864
51923
|
}
|
|
51865
|
-
throw new Error(responseJson === null || responseJson === void 0 ? void 0 : responseJson.reason.toString());
|
|
51924
|
+
throw new Error((_b = (_a = responseJson === null || responseJson === void 0 ? void 0 : responseJson.reason) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : 'Spotcheck conditions not met');
|
|
51866
51925
|
}
|
|
51867
51926
|
else {
|
|
51868
51927
|
throw new Error(`Received status code ${response.status}`);
|
|
@@ -51873,7 +51932,7 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51873
51932
|
}
|
|
51874
51933
|
};
|
|
51875
51934
|
const sendTrackEventRequest = async ({ screen, event }) => {
|
|
51876
|
-
var _a, _b, _c, _d, _e, _f;
|
|
51935
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
51877
51936
|
try {
|
|
51878
51937
|
const intMax = Number.POSITIVE_INFINITY;
|
|
51879
51938
|
const state = getSpotcheckStateService().getState();
|
|
@@ -51946,7 +52005,7 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51946
52005
|
return { valid: true };
|
|
51947
52006
|
}
|
|
51948
52007
|
}
|
|
51949
|
-
throw new Error(responseJson === null || responseJson === void 0 ? void 0 : responseJson.reason.toString());
|
|
52008
|
+
throw new Error((_h = (_g = responseJson === null || responseJson === void 0 ? void 0 : responseJson.reason) === null || _g === void 0 ? void 0 : _g.toString()) !== null && _h !== void 0 ? _h : 'Event conditions not met');
|
|
51950
52009
|
}
|
|
51951
52010
|
else {
|
|
51952
52011
|
throw new Error(`Received status code ${response.status}`);
|