surveysparrow-ionic-plugin 1.0.7-beta.19 → 1.0.7-beta.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "surveysparrow-ionic-plugin",
3
- "version": "1.0.7-beta.19",
3
+ "version": "1.0.7-beta.21",
4
4
  "description": "SurveySparrow SDK enables you to collect feedback from your mobile app. Embed the Classic, Chat & NPS surveys in your ionic application seamlessly with few lines of code.",
5
5
  "type": "module",
6
6
  "main": "dist/plugin.cjs.js",
@@ -0,0 +1,7 @@
1
+ .safe-area {
2
+ padding-top: env(safe-area-inset-top);
3
+ padding-bottom: env(safe-area-inset-bottom);
4
+ padding-left: env(safe-area-inset-left);
5
+ padding-right: env(safe-area-inset-right);
6
+ box-sizing: border-box;
7
+ }
@@ -1,4 +1,4 @@
1
- <div [ngStyle]="componentStyles.wrapperStyles">
1
+ <div [ngStyle]="componentStyles.wrapperStyles" class="safe-area">
2
2
  <div [ngStyle]="componentStyles.styles">
3
3
  <div style="position: relative; height: 100%;">
4
4
  <spotcheck-close-button />
@@ -7,12 +7,14 @@
7
7
  *ngIf="state.classicUrl && state.classicUrl.length > 0 && state.spotcheckURL.length > 0 && state.spotCheckType === 'classic'"
8
8
  [url]="state.classicUrl"
9
9
  [webviewType]="'classic'"
10
+ [isMiniCard]="state.spotChecksMode === 'miniCard'"
10
11
  />
11
12
 
12
13
  <WebViewComponent
13
14
  *ngIf="state.chatUrl && state.chatUrl.length > 0 && state.spotcheckURL.length > 0 && state.spotCheckType === 'chat'"
14
15
  [url]="state.chatUrl"
15
16
  [webviewType]="'chat'"
17
+ [isMiniCard]="state.spotChecksMode === 'miniCard'"
16
18
  />
17
19
 
18
20
  <div *ngIf="state.spotChecksMode === 'miniCard' && state.avatarEnabled">
@@ -20,11 +20,12 @@ import axios from 'axios';
20
20
  @Component({
21
21
  selector: 'WebViewComponent',
22
22
  template: `
23
- <div style="overflow: hidden; height: 100%;">
23
+ <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;">
24
24
  <iframe
25
+ allow="camera; microphone; geolocation; display-capture; autoplay; clipboard-read; clipboard-write;"
25
26
  #iframeRef
26
27
  [src]="safeUrl"
27
- style="width: 100%; height: 100%; display: block;"
28
+ style="width: 100%; height: 100%; display: block; border-radius: {{isMiniCard ? 12 : 0}}px;"
28
29
  frameborder="0"
29
30
  >
30
31
  </iframe>
@@ -36,6 +37,7 @@ import axios from 'axios';
36
37
  export class WebViewComponent implements OnInit, AfterViewInit {
37
38
  @Input() url: string = '';
38
39
  @Input() webviewType: 'classic' | 'chat' = 'classic';
40
+ @Input() isMiniCard: boolean = false;
39
41
 
40
42
  safeUrl: SafeResourceUrl | null = null;
41
43
  @ViewChild('iframeRef') iframe!: ElementRef<HTMLIFrameElement>;
@@ -210,6 +212,7 @@ export class CloseButtonComponent implements OnDestroy {
210
212
  @Component({
211
213
  selector: 'SpotCheckComponent',
212
214
  templateUrl: './SpotCheckComponent.html',
215
+ styleUrls: ['./SpotCheckComponent.css'],
213
216
  standalone: true,
214
217
  imports: [CommonModule, WebViewComponent, CloseButtonComponent],
215
218
  })
@@ -307,7 +307,7 @@ export const handleSurveyEnd = () => {
307
307
  export const getSpotcheckComponentCssStyles = (state: SpotcheckState) => {
308
308
  let styles = {}
309
309
  let wrapperStyles = {}
310
- let padding = 30;
310
+ let extraPaddingForMiniCardCloseButtonIfTopPosition = 0;
311
311
  if (state.isFullScreenMode && state.isVisible) {
312
312
  wrapperStyles = {
313
313
  display: 'flex',
@@ -323,7 +323,6 @@ export const getSpotcheckComponentCssStyles = (state: SpotcheckState) => {
323
323
 
324
324
  let height = Math.min(state.currentQuestionHeight, (state.maxHeight * window.innerHeight));
325
325
  if(state.spotChecksMode === 'miniCard') {
326
- padding = 45;
327
326
  if(state.avatarEnabled) {
328
327
  height = height - 56;
329
328
  }
@@ -353,6 +352,9 @@ export const getSpotcheckComponentCssStyles = (state: SpotcheckState) => {
353
352
  display: 'flex',
354
353
  justifyContent: 'flex-start',
355
354
  };
355
+ if(state.spotChecksMode === 'miniCard' && state.isCloseButtonEnabled) {
356
+ extraPaddingForMiniCardCloseButtonIfTopPosition = 30;
357
+ }
356
358
  break;
357
359
 
358
360
  case 'center':
@@ -382,13 +384,12 @@ export const getSpotcheckComponentCssStyles = (state: SpotcheckState) => {
382
384
  zIndex: '99999999',
383
385
  display: 'none',
384
386
  flexDirection: 'column',
385
- paddingTop: padding+'px',
386
- paddingBottom: padding+'px',
387
387
  ...wrapperStyles
388
388
  },
389
389
  styles: {
390
390
  display: 'none',
391
391
  flexDirection: 'column',
392
+ paddingTop: extraPaddingForMiniCardCloseButtonIfTopPosition+'px',
392
393
  ...styles,
393
394
  }
394
395
  };