surveysparrow-ionic-plugin 2.0.1 → 2.0.2-beta.2
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 +80 -51
- package/dist/angular-ui/esm2022/spotchecks/SpotCheckEventListener.mjs +26 -0
- package/dist/angular-ui/esm2022/spotchecks/api.mjs +1 -1
- package/dist/angular-ui/esm2022/spotchecks/helpers.mjs +6 -3
- package/dist/angular-ui/esm2022/spotchecks/index.mjs +2 -1
- package/dist/angular-ui/fesm2022/angular-ui.mjs +109 -54
- package/dist/angular-ui/fesm2022/angular-ui.mjs.map +1 -1
- package/dist/angular-ui/spotchecks/SpotCheckComponent.d.ts +10 -4
- package/dist/angular-ui/spotchecks/SpotCheckEventListener.d.ts +16 -0
- package/dist/angular-ui/spotchecks/index.d.ts +1 -0
- package/dist/esm/angular-ui/lib/spotchecks/SpotCheckComponent.d.ts +10 -4
- package/dist/esm/angular-ui/lib/spotchecks/SpotCheckComponent.js +75 -48
- package/dist/esm/angular-ui/lib/spotchecks/SpotCheckComponent.js.map +1 -1
- package/dist/esm/angular-ui/lib/spotchecks/SpotCheckEventListener.d.ts +16 -0
- package/dist/esm/angular-ui/lib/spotchecks/SpotCheckEventListener.js +28 -0
- package/dist/esm/angular-ui/lib/spotchecks/SpotCheckEventListener.js.map +1 -0
- package/dist/esm/angular-ui/lib/spotchecks/api.js.map +1 -1
- package/dist/esm/angular-ui/lib/spotchecks/helpers.js +5 -2
- package/dist/esm/angular-ui/lib/spotchecks/helpers.js.map +1 -1
- package/dist/esm/angular-ui/lib/spotchecks/index.d.ts +1 -0
- package/dist/esm/angular-ui/lib/spotchecks/index.js +1 -0
- package/dist/esm/angular-ui/lib/spotchecks/index.js.map +1 -1
- package/dist/plugin.cjs.js +103 -44
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +103 -44
- package/dist/plugin.js.map +1 -1
- package/package.json +1 -1
- package/src/angular-ui/lib/spotchecks/SpotCheckComponent.ts +75 -44
- package/src/angular-ui/lib/spotchecks/SpotCheckEventListener.ts +50 -0
- package/src/angular-ui/lib/spotchecks/api.ts +2 -2
- package/src/angular-ui/lib/spotchecks/helpers.ts +6 -4
- package/src/angular-ui/lib/spotchecks/index.ts +3 -0
package/dist/plugin.js
CHANGED
|
@@ -51132,6 +51132,33 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51132
51132
|
})
|
|
51133
51133
|
], SpotcheckStateService);
|
|
51134
51134
|
|
|
51135
|
+
class SpotCheckEventListenerService {
|
|
51136
|
+
constructor() {
|
|
51137
|
+
this.eventSubject = new Subject();
|
|
51138
|
+
this.event$ = this.eventSubject.asObservable();
|
|
51139
|
+
}
|
|
51140
|
+
emit(type, data) {
|
|
51141
|
+
this.eventSubject.next({ type, data });
|
|
51142
|
+
}
|
|
51143
|
+
addListener(eventType, callback) {
|
|
51144
|
+
return this.event$.subscribe((event) => {
|
|
51145
|
+
if (event.type === eventType) {
|
|
51146
|
+
callback(event.data);
|
|
51147
|
+
}
|
|
51148
|
+
});
|
|
51149
|
+
}
|
|
51150
|
+
}
|
|
51151
|
+
let globalInstance;
|
|
51152
|
+
const getSpotCheckEventListener = () => {
|
|
51153
|
+
if (!globalInstance) {
|
|
51154
|
+
globalInstance = new SpotCheckEventListenerService();
|
|
51155
|
+
}
|
|
51156
|
+
return globalInstance;
|
|
51157
|
+
};
|
|
51158
|
+
const addSpotCheckListener = (eventType, callback) => {
|
|
51159
|
+
return getSpotCheckEventListener().addListener(eventType, callback);
|
|
51160
|
+
};
|
|
51161
|
+
|
|
51135
51162
|
let globalSpotcheckStateService;
|
|
51136
51163
|
const getSpotcheckStateService = () => {
|
|
51137
51164
|
if (!globalSpotcheckStateService) {
|
|
@@ -51308,7 +51335,10 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51308
51335
|
},
|
|
51309
51336
|
body: JSON.stringify(payload),
|
|
51310
51337
|
});
|
|
51311
|
-
if (response.status
|
|
51338
|
+
if (response.status == 200) {
|
|
51339
|
+
getSpotCheckEventListener().emit('surveyDismissed');
|
|
51340
|
+
}
|
|
51341
|
+
else {
|
|
51312
51342
|
console.log(`Error: ${response.status}`);
|
|
51313
51343
|
}
|
|
51314
51344
|
}
|
|
@@ -51417,7 +51447,6 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51417
51447
|
};
|
|
51418
51448
|
};
|
|
51419
51449
|
const closeSpotCheckAndHandleSurveyEnd = async () => {
|
|
51420
|
-
await closeSpotCheck();
|
|
51421
51450
|
handleSurveyEnd();
|
|
51422
51451
|
};
|
|
51423
51452
|
|
|
@@ -51431,8 +51460,10 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51431
51460
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
51432
51461
|
};
|
|
51433
51462
|
let WebViewComponent = class WebViewComponent {
|
|
51434
|
-
constructor(sanitizer) {
|
|
51463
|
+
constructor(sanitizer, ngZone, cdr) {
|
|
51435
51464
|
this.sanitizer = sanitizer;
|
|
51465
|
+
this.ngZone = ngZone;
|
|
51466
|
+
this.cdr = cdr;
|
|
51436
51467
|
this.url = '';
|
|
51437
51468
|
this.webviewType = 'classic';
|
|
51438
51469
|
this.isMiniCard = false;
|
|
@@ -51463,41 +51494,51 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51463
51494
|
setupIframeLoadListener() {
|
|
51464
51495
|
const iframe = this.iframe.nativeElement;
|
|
51465
51496
|
iframe.addEventListener('load', () => {
|
|
51466
|
-
|
|
51467
|
-
|
|
51468
|
-
|
|
51469
|
-
|
|
51470
|
-
|
|
51471
|
-
|
|
51472
|
-
|
|
51497
|
+
this.ngZone.run(() => {
|
|
51498
|
+
const stateService = getSpotcheckStateService();
|
|
51499
|
+
if (this.webviewType === 'classic') {
|
|
51500
|
+
stateService.setState({ isClassicLoading: false });
|
|
51501
|
+
}
|
|
51502
|
+
else {
|
|
51503
|
+
stateService.setState({ isChatLoading: false });
|
|
51504
|
+
}
|
|
51505
|
+
});
|
|
51473
51506
|
});
|
|
51474
51507
|
}
|
|
51475
51508
|
onMessage(event) {
|
|
51476
|
-
|
|
51477
|
-
|
|
51478
|
-
|
|
51479
|
-
|
|
51480
|
-
|
|
51481
|
-
|
|
51482
|
-
|
|
51483
|
-
|
|
51484
|
-
|
|
51485
|
-
|
|
51486
|
-
|
|
51487
|
-
|
|
51488
|
-
|
|
51489
|
-
|
|
51490
|
-
|
|
51491
|
-
|
|
51492
|
-
|
|
51509
|
+
this.ngZone.run(() => {
|
|
51510
|
+
const stateService = getSpotcheckStateService();
|
|
51511
|
+
const { data } = event;
|
|
51512
|
+
switch (data.type) {
|
|
51513
|
+
case 'slideInFrame':
|
|
51514
|
+
if (data.mounted) {
|
|
51515
|
+
stateService.setState({ isMounted: true });
|
|
51516
|
+
}
|
|
51517
|
+
break;
|
|
51518
|
+
case 'resizeWindow':
|
|
51519
|
+
if (data.size) {
|
|
51520
|
+
stateService.setState({
|
|
51521
|
+
currentQuestionHeight: data.size.height,
|
|
51522
|
+
});
|
|
51523
|
+
}
|
|
51524
|
+
else if (data.isCloseButtonEnabled) {
|
|
51525
|
+
stateService.setState({
|
|
51526
|
+
isCloseButtonEnabled: data.isCloseButtonEnabled,
|
|
51527
|
+
});
|
|
51528
|
+
}
|
|
51529
|
+
break;
|
|
51530
|
+
case 'surveyCompleted':
|
|
51531
|
+
closeSpotCheckAndHandleSurveyEnd().then(() => {
|
|
51532
|
+
getSpotCheckEventListener().emit('surveyCompleted', data.response);
|
|
51533
|
+
this.cdr.detectChanges();
|
|
51493
51534
|
});
|
|
51494
|
-
|
|
51495
|
-
|
|
51496
|
-
|
|
51497
|
-
|
|
51498
|
-
|
|
51499
|
-
|
|
51500
|
-
}
|
|
51535
|
+
break;
|
|
51536
|
+
case 'surveyLoadStarted':
|
|
51537
|
+
getSpotCheckEventListener().emit('surveyLoadStarted', data.surveyDetails);
|
|
51538
|
+
break;
|
|
51539
|
+
}
|
|
51540
|
+
this.cdr.detectChanges();
|
|
51541
|
+
});
|
|
51501
51542
|
}
|
|
51502
51543
|
};
|
|
51503
51544
|
__decorate$1([
|
|
@@ -51540,7 +51581,9 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51540
51581
|
standalone: true,
|
|
51541
51582
|
imports: [CommonModule],
|
|
51542
51583
|
}),
|
|
51543
|
-
__metadata("design:paramtypes", [DomSanitizer
|
|
51584
|
+
__metadata("design:paramtypes", [DomSanitizer,
|
|
51585
|
+
NgZone,
|
|
51586
|
+
ChangeDetectorRef])
|
|
51544
51587
|
], WebViewComponent);
|
|
51545
51588
|
let CloseSVGComponent = class CloseSVGComponent {
|
|
51546
51589
|
constructor() {
|
|
@@ -51586,7 +51629,9 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51586
51629
|
})
|
|
51587
51630
|
], CloseSVGComponent);
|
|
51588
51631
|
let CloseButtonComponent = class CloseButtonComponent {
|
|
51589
|
-
constructor() {
|
|
51632
|
+
constructor(ngZone, cdr) {
|
|
51633
|
+
this.ngZone = ngZone;
|
|
51634
|
+
this.cdr = cdr;
|
|
51590
51635
|
this.size = 30;
|
|
51591
51636
|
this.strokeWidth = 1.2;
|
|
51592
51637
|
this.isVisible = false;
|
|
@@ -51595,13 +51640,19 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51595
51640
|
this.onClick = async () => {
|
|
51596
51641
|
await closeSpotCheck();
|
|
51597
51642
|
handleSurveyEnd();
|
|
51643
|
+
this.ngZone.run(() => {
|
|
51644
|
+
this.cdr.detectChanges();
|
|
51645
|
+
});
|
|
51598
51646
|
};
|
|
51599
51647
|
this.stateService = getSpotcheckStateService();
|
|
51600
51648
|
this.state = this.stateService.getState();
|
|
51601
51649
|
this.updateComponentState();
|
|
51602
51650
|
this.stateSubscription = this.stateService.state$.subscribe((newState) => {
|
|
51603
|
-
this.
|
|
51604
|
-
|
|
51651
|
+
this.ngZone.run(() => {
|
|
51652
|
+
this.state = newState;
|
|
51653
|
+
this.updateComponentState();
|
|
51654
|
+
this.cdr.detectChanges();
|
|
51655
|
+
});
|
|
51605
51656
|
});
|
|
51606
51657
|
}
|
|
51607
51658
|
ngOnDestroy() {
|
|
@@ -51645,10 +51696,13 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51645
51696
|
standalone: true,
|
|
51646
51697
|
imports: [CommonModule, CloseSVGComponent],
|
|
51647
51698
|
}),
|
|
51648
|
-
__metadata("design:paramtypes", [
|
|
51699
|
+
__metadata("design:paramtypes", [NgZone,
|
|
51700
|
+
ChangeDetectorRef])
|
|
51649
51701
|
], CloseButtonComponent);
|
|
51650
51702
|
let SpotCheckComponent = class SpotCheckComponent {
|
|
51651
|
-
constructor() {
|
|
51703
|
+
constructor(ngZone, cdr) {
|
|
51704
|
+
this.ngZone = ngZone;
|
|
51705
|
+
this.cdr = cdr;
|
|
51652
51706
|
this.componentStyles = {};
|
|
51653
51707
|
this.avatarUrl = '';
|
|
51654
51708
|
this.initializeComponent = async () => {
|
|
@@ -51691,9 +51745,12 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51691
51745
|
this.state = this.spotcheckStateService.getState();
|
|
51692
51746
|
this.updateComponentStyles();
|
|
51693
51747
|
this.stateSubscription = this.spotcheckStateService.state$.subscribe((newState) => {
|
|
51694
|
-
this.
|
|
51695
|
-
|
|
51696
|
-
|
|
51748
|
+
this.ngZone.run(() => {
|
|
51749
|
+
this.state = newState;
|
|
51750
|
+
this.updateComponentStyles();
|
|
51751
|
+
this.avatarUrl = this.state.avatarUrl || "https://static.surveysparrow.com/application/images/profile.png";
|
|
51752
|
+
this.cdr.detectChanges();
|
|
51753
|
+
});
|
|
51697
51754
|
});
|
|
51698
51755
|
}
|
|
51699
51756
|
ngOnInit() {
|
|
@@ -51716,7 +51773,8 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
51716
51773
|
standalone: true,
|
|
51717
51774
|
imports: [CommonModule, WebViewComponent, CloseButtonComponent],
|
|
51718
51775
|
}),
|
|
51719
|
-
__metadata("design:paramtypes", [
|
|
51776
|
+
__metadata("design:paramtypes", [NgZone,
|
|
51777
|
+
ChangeDetectorRef])
|
|
51720
51778
|
], SpotCheckComponent);
|
|
51721
51779
|
|
|
51722
51780
|
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -52022,6 +52080,7 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
52022
52080
|
const SurveySparrowIonicPlugin = core.registerPlugin('SurveySparrowIonicPlugin');
|
|
52023
52081
|
|
|
52024
52082
|
exports.SurveySparrowIonicPlugin = SurveySparrowIonicPlugin;
|
|
52083
|
+
exports.addSpotCheckListener = addSpotCheckListener;
|
|
52025
52084
|
exports.initializeSpotChecks = initializeSpotChecks;
|
|
52026
52085
|
exports.trackEvent = trackEvent;
|
|
52027
52086
|
exports.trackScreen = trackScreen;
|