indigitall-capacitor-plugin 2.0.6 → 2.2.0

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.
Files changed (48) hide show
  1. package/IndigitallCapacitorPlugin.podspec +1 -1
  2. package/README.md +28 -4
  3. package/android/build.gradle +3 -3
  4. package/android/src/main/AndroidManifest.xml +2 -2
  5. package/android/src/main/java/com/indigitall/capacitor/IndigitallCpPlugin.java +45 -57
  6. package/android/src/main/java/com/indigitall/capacitor/IndigitallInAppPlugin.java +104 -46
  7. package/android/src/main/java/com/indigitall/capacitor/implementations/CustomerCp.java +7 -7
  8. package/android/src/main/java/com/indigitall/capacitor/implementations/InAppCp.java +52 -13
  9. package/android/src/main/java/com/indigitall/capacitor/implementations/IndigitallCp.java +88 -23
  10. package/android/src/main/java/com/indigitall/capacitor/models/CpIndigitallHiddenActivity.java +3 -3
  11. package/android/src/main/java/com/indigitall/capacitor/models/CpPushNotification.java +12 -7
  12. package/android/src/main/java/com/indigitall/capacitor/services/IndigitallFirebaseMessagingService.java +3 -3
  13. package/android/src/main/java/com/indigitall/capacitor/utils/CpIndigitallUtils.java +4 -4
  14. package/android/src/main/java/com/indigitall/capacitor/utils/IndigitallInAppParse.java +49 -32
  15. package/android/src/main/java/com/indigitall/capacitor/utils/IndigitallParse.java +15 -82
  16. package/dist/docs.json +22 -2
  17. package/dist/esm/InApp.js +290 -85
  18. package/dist/esm/InApp.js.map +1 -1
  19. package/dist/esm/Push.js +11 -3
  20. package/dist/esm/Push.js.map +1 -1
  21. package/dist/esm/callbacks/callbacksType.d.ts +4 -1
  22. package/dist/esm/callbacks/callbacksType.js.map +1 -1
  23. package/dist/esm/definitions/customerDefinitions.d.ts +2 -2
  24. package/dist/esm/definitions/customerDefinitions.js.map +1 -1
  25. package/dist/esm/definitions/inAppDefinitions.d.ts +13 -3
  26. package/dist/esm/definitions/inAppDefinitions.js.map +1 -1
  27. package/dist/esm/definitions/pushDefinitions.d.ts +7 -3
  28. package/dist/esm/definitions/pushDefinitions.js.map +1 -1
  29. package/dist/esm/models/InInApp.d.ts +1 -1
  30. package/dist/esm/models/InInApp.js.map +1 -1
  31. package/dist/esm/models/InInbox.d.ts +1 -1
  32. package/dist/esm/models/InInbox.js.map +1 -1
  33. package/dist/esm/params/customerParams.d.ts +1 -1
  34. package/dist/esm/params/customerParams.js.map +1 -1
  35. package/dist/esm/params/pushParams.d.ts +2 -0
  36. package/dist/esm/params/pushParams.js.map +1 -1
  37. package/dist/plugin.cjs.js +300 -88
  38. package/dist/plugin.cjs.js.map +1 -1
  39. package/dist/plugin.js +300 -88
  40. package/dist/plugin.js.map +1 -1
  41. package/ios/Plugin/IndigitallCpPlugin.swift +11 -1
  42. package/ios/Plugin/implementations/CustomerCp.swift +1 -3
  43. package/ios/Plugin/implementations/InAppCp.swift +7 -24
  44. package/ios/Plugin/implementations/InboxCp.swift +9 -9
  45. package/ios/Plugin/implementations/IndigitallCp.swift +25 -3
  46. package/ios/Plugin/utils/IndigitallParse.h +1 -2
  47. package/ios/Plugin/utils/IndigitallParse.m +41 -21
  48. package/package.json +1 -1
package/dist/plugin.js CHANGED
@@ -7,7 +7,7 @@ var capacitorIndigitallCp = (function (exports, core) {
7
7
  const Indigitall = {
8
8
  init: (config, onIndigitallInitializedType, onError) => {
9
9
  Object.assign(config, {
10
- productVersion: '2.0.6',
10
+ productVersion: '2.2.0',
11
11
  productName: 'capacitor',
12
12
  });
13
13
  IndigitallCp.initialize({ config }).then(onInit => {
@@ -112,8 +112,8 @@ var capacitorIndigitallCp = (function (exports, core) {
112
112
  onError(error);
113
113
  });
114
114
  },
115
- logIn: (externalId, onSuccess, onError) => {
116
- IndigitallCp.logIn({ externalId }).then(response => {
115
+ logIn: (externalCode, onSuccess, onError) => {
116
+ IndigitallCp.logIn({ externalCode }).then(response => {
117
117
  if (onSuccess)
118
118
  onSuccess(response.device);
119
119
  }).catch(error => {
@@ -130,6 +130,14 @@ var capacitorIndigitallCp = (function (exports, core) {
130
130
  onError(error);
131
131
  });
132
132
  },
133
+ requestPushPermission: () => {
134
+ IndigitallCp.requestPushPermission();
135
+ },
136
+ getPushPermissionStatus: (onSuccess) => {
137
+ IndigitallCp.getPushPermissionStatus().then(response => {
138
+ onSuccess(response);
139
+ });
140
+ }
133
141
  };
134
142
 
135
143
  exports.Channel = void 0;
@@ -262,6 +270,7 @@ var capacitorIndigitallCp = (function (exports, core) {
262
270
  }
263
271
  };
264
272
 
273
+ /* eslint-disable no-useless-escape */
265
274
  const InAppCp = core.registerPlugin('InAppCp', {});
266
275
  let packageName = '';
267
276
  const IndigitallInApp = {
@@ -295,40 +304,10 @@ var capacitorIndigitallCp = (function (exports, core) {
295
304
  onSuccess();
296
305
  });
297
306
  },
298
- showInApp: (inAppParams, onShowTimeFinished, didExpired, didShowManyTimes, didClickOut, onSuccess, onError) => {
299
- InAppCp.getPackageName().then((response) => {
300
- packageName = response.packageName;
301
- });
302
- const viewId = inAppParams.viewId;
303
- InAppCp.inAppWasShown({ params: inAppParams }).then((response) => {
304
- drawInApp(response.inApp, viewId, () => {
305
- if (onShowTimeFinished)
306
- onShowTimeFinished(response.inApp.showTime);
307
- }, (inApp) => {
308
- InAppCp.eventPrintInAppRequest({ inApp });
309
- if (onSuccess)
310
- onSuccess(inApp);
311
- }, onError);
312
- }, (errorJson) => {
313
- if (errorJson.errorCode == 2101) {
314
- if (didExpired)
315
- didExpired(errorJson.errorMessage);
316
- }
317
- else if (errorJson.errorCode == 2102) {
318
- if (didShowManyTimes)
319
- didShowManyTimes(errorJson.errorMessage);
320
- }
321
- else if (errorJson.errorCode == 2103) {
322
- if (didClickOut)
323
- didClickOut(errorJson.errorMessage);
324
- }
325
- else {
326
- if (onError)
327
- onError(errorJson.errorMessage);
328
- }
329
- });
307
+ showInApp: (inAppParams, onShowTimeFinished, didExpired, didShowManyTimes, didClickOut, dismissForever, didClicked, didFormSubmit, didFormError, onSuccess, onError) => {
308
+ showInAppAndPopUp(inAppParams, onShowTimeFinished, didExpired, didShowManyTimes, didClickOut, dismissForever, didClicked, didFormSubmit, didFormError, onSuccess, onError);
330
309
  },
331
- showMultipleInApp: (inAppParams, onShowTimeFinished, didExpired, didShowManyTimes, didClickOut, onSuccess, onError) => {
310
+ showMultipleInApp: (inAppParams, onShowTimeFinished, didExpired, didShowManyTimes, didClickOut, dismissForever, didClicked, didFormSubmit, didFormError, onSuccess, onError) => {
332
311
  InAppCp.getPackageName().then((response) => {
333
312
  packageName = response.packageName;
334
313
  });
@@ -336,40 +315,12 @@ var capacitorIndigitallCp = (function (exports, core) {
336
315
  const viewIds = inAppParams.viewIdList;
337
316
  for (let i = 0; i < viewIds.length; i++) {
338
317
  const inAppSchemaCode = inAppSchemaCodes[i];
339
- InAppCp.inAppWasShown({
340
- params: {
341
- appKey: inAppParams.appKey,
342
- domainInApp: inAppParams.domainInApp,
343
- inAppSchemaCode: inAppSchemaCode,
344
- viewId: viewIds[i]
345
- }
346
- }).then((response) => {
347
- drawInApp(response.inApp, viewIds[i], () => {
348
- if (onShowTimeFinished)
349
- onShowTimeFinished(response.inApp.showTime);
350
- }, (inApp) => {
351
- InAppCp.eventPrintInAppRequest({ inApp });
352
- if (onSuccess)
353
- onSuccess(inApp);
354
- }, onError);
355
- }, (errorJson) => {
356
- if (errorJson.errorCode == 2101) {
357
- if (didExpired)
358
- didExpired(errorJson.errorMessage);
359
- }
360
- else if (errorJson.errorCode == 2102) {
361
- if (didShowManyTimes)
362
- didShowManyTimes(errorJson.errorMessage);
363
- }
364
- else if (errorJson.errorCode == 2103) {
365
- if (didClickOut)
366
- didClickOut(errorJson.errorMessage);
367
- }
368
- else {
369
- if (onError)
370
- onError(errorJson.errorMessage);
371
- }
372
- });
318
+ showInAppAndPopUp({
319
+ appKey: inAppParams.appKey,
320
+ domainInApp: inAppParams.domainInApp,
321
+ inAppSchemaCode: inAppSchemaCode,
322
+ viewId: viewIds[i]
323
+ }, onShowTimeFinished, didExpired, didShowManyTimes, didClickOut, dismissForever, didClicked, didFormSubmit, didFormError, onSuccess, onError);
373
324
  }
374
325
  },
375
326
  showPopUp: (params, didCancel, didClicked, didDisimissed, onShowTimeFinished, didExpired, didShowManyTimes, didClickOut, didDismissForever, onSuccess, onError) => {
@@ -434,11 +385,70 @@ var capacitorIndigitallCp = (function (exports, core) {
434
385
  if (onSuccess)
435
386
  onSuccess();
436
387
  });
388
+ },
389
+ topicsList: (onSuccess, onError) => {
390
+ InAppCp.topicsList().then(response => {
391
+ if (onSuccess)
392
+ onSuccess(response.topics);
393
+ }).catch(error => {
394
+ if (onError)
395
+ onError(error);
396
+ });
397
+ },
398
+ topicsSubscribe: (topics, onSuccess, onError) => {
399
+ InAppCp.topicsSubscribe({ topics }).then(response => {
400
+ if (onSuccess)
401
+ onSuccess(response);
402
+ }).catch(error => {
403
+ if (onError)
404
+ onError(error);
405
+ });
406
+ },
407
+ topicsUnsubscribe: (topics, onSuccess, onError) => {
408
+ InAppCp.topicsUnsubscribe({ topics }).then(response => {
409
+ if (onSuccess)
410
+ onSuccess(response);
411
+ }).catch(error => {
412
+ if (onError)
413
+ onError(error);
414
+ });
437
415
  }
438
416
  };
439
- const script = "<script> let slideIndex = 1;showSlides(slideIndex);let timeSlide = 10000;const slider = document.querySelector('.slider-container-actions');let sliderTotal = document.getElementsByClassName(\"slideshow-item\").length;let slides = document.getElementsByClassName(\"slideshow-item\");var interval = setInterval(() => { newSlide();}, timeSlide);var startMove = null;slider.addEventListener('touchstart', handleStart, false);slider.addEventListener('touchend', handleEnd, false);slider.addEventListener('mousedown', mouseStart);slider.addEventListener('mouseup', mouseEnd);function mouseStart(evt) { evt.preventDefault(); startMove = evt.clientX;}function mouseEnd(evt) { evt.preventDefault(); var endMove = evt.clientX; setEndMove(endMove);}function handleStart(evt) { evt.preventDefault(); startMove = evt.touches[0].clientX;}function handleEnd(evt) { evt.preventDefault(); var endMove = evt.changedTouches[0].pageX; setEndMove(endMove);}function setEndMove(endMove) { if (startMove != null) { if (startMove > endMove) { slideIndex++; if (slideIndex > sliderTotal) { slideIndex = 1; } } else { if (slideIndex == 0) { slideIndex = sliderTotal; } else { slideIndex--; } } showSlides(slideIndex ); setNewInterval(); } } function plusSlides(n) { showSlides(slideIndex += n); setNewInterval();}function currentSlide(n) { showSlides(slideIndex = n); }function setNewInterval() { clearInterval(interval); interval = setInterval(() => { newSlide(); }, timeSlide);}function newSlide(){ slideIndex++; if (slideIndex > sliderTotal) { slideIndex = 1; } showSlides(slideIndex);}function showSlides(n) { let i; let slides = document.getElementsByClassName(\"slideshow-item\"); let dots = document.getElementsByClassName(\"dot\"); if (n > slides.length) {slideIndex = 1;} if (n < 1) {slideIndex = slides.length;} for (i = 0; i < slides.length; i++) { slides[i].style.display = \"none\"; } for (i = 0; i < dots.length; i++) { dots[i].className = dots[i].className.replace(\" active\", \"\"); } slides[slideIndex-1].style.display = \"block\"; dots[slideIndex-1].className += \" active\";}</script>";
440
- async function drawInApp(inApp, viewId, onShowTimeFinished, onSuccess, onError) {
441
- var _a, _b, _c;
417
+ async function showInAppAndPopUp(inAppParams, onShowTimeFinished, didExpired, didShowManyTimes, didClickOut, dismissForever, didClicked, didFormSubmit, didFormError, onSuccess, onError) {
418
+ InAppCp.getPackageName().then((response) => {
419
+ packageName = response.packageName;
420
+ });
421
+ InAppCp.inAppWasShown({ params: inAppParams }).then((response) => {
422
+ drawInApp(response.inApp, inAppParams.viewId, onShowTimeFinished, didClicked, didFormSubmit, didFormError, (inApp) => {
423
+ InAppCp.eventPrintInAppRequest({ inApp });
424
+ if (onSuccess)
425
+ onSuccess(inApp);
426
+ }, onError);
427
+ }, (errorJson) => {
428
+ if (errorJson.errorCode == 2101) {
429
+ if (didExpired)
430
+ didExpired(errorJson.errorMessage);
431
+ }
432
+ else if (errorJson.errorCode == 2102) {
433
+ if (didShowManyTimes)
434
+ didShowManyTimes(errorJson.errorMessage);
435
+ }
436
+ else if (errorJson.errorCode == 2103) {
437
+ if (didClickOut)
438
+ didClickOut(errorJson.errorMessage);
439
+ }
440
+ else if (errorJson.errorCode == 2304) {
441
+ if (dismissForever)
442
+ dismissForever(errorJson.errorMessage);
443
+ }
444
+ else {
445
+ if (onError)
446
+ onError(errorJson.errorMessage);
447
+ }
448
+ });
449
+ }
450
+ async function drawInApp(inApp, viewId, onShowTimeFinished, didClicked, didFormSubmit, didFormError, onSuccess, onError) {
451
+ var _a;
442
452
  if ((_a = inApp === null || inApp === void 0 ? void 0 : inApp.properties) === null || _a === void 0 ? void 0 : _a.contentUrl) {
443
453
  const divClient = document.getElementById(viewId);
444
454
  if (divClient) {
@@ -459,32 +469,42 @@ var capacitorIndigitallCp = (function (exports, core) {
459
469
  };
460
470
  const response = await fetch(inApp.properties.contentUrl, options);
461
471
  const stringHtml = await response.text();
462
- divClient.innerHTML = stringHtml.concat(' ', script);
463
- const divsOnClick = divClient.querySelectorAll('[onclick]');
464
- divsOnClick.forEach((value, _index, _array) => {
465
- var _a;
466
- if ((_a = value === null || value === void 0 ? void 0 : value.getAttribute('onclick')) === null || _a === void 0 ? void 0 : _a.includes('InAppIndigitall')) {
467
- const onClickContent = value.getAttribute('onclick');
468
- value.setAttribute('onclick', `IndigitallInApp.onClick("${inApp}", ${onClickContent === null || onClickContent === void 0 ? void 0 : onClickContent.replace('InAppIndigitall.onClick(', '')}`);
469
- }
470
- });
471
- if ((_b = inApp === null || inApp === void 0 ? void 0 : inApp.properties) === null || _b === void 0 ? void 0 : _b.showTime) {
472
+ let customDataHtml = stringHtml;
473
+ if (inApp.customData != null) {
474
+ Object.keys(inApp.customData).forEach(function (key) {
475
+ customDataHtml = stringHtml.replace(key, inApp.customData[key]);
476
+ });
477
+ }
478
+ if (inApp.version)
479
+ customDataHtml = customDataHtml.replace('\'inappVersion\':\'{{version}}\'', '\'inappVersion\':' + inApp.version + '');
480
+ const viewIdEdited = viewId.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, '');
481
+ const finalHtml = editingFormHtml(customDataHtml, viewIdEdited);
482
+ divClient.innerHTML = finalHtml;
483
+ if (!document.getElementById(`script_${viewIdEdited}`) || document.getElementById(`script_${viewIdEdited}`) === null) {
484
+ const script = document.createElement('script');
485
+ script.id = `script_${viewIdEdited}`;
486
+ script.type = 'text/javascript';
487
+ script.innerHTML = getInAppScript(viewId, viewIdEdited, JSON.stringify(inApp), didClicked, didFormSubmit, didFormError);
488
+ divClient.appendChild(script);
489
+ }
490
+ if (inApp.properties.showTime) {
472
491
  let counter = 0;
473
- const interval = setInterval(function () {
492
+ var interval = setInterval(function () {
474
493
  counter++;
475
- if (counter == inApp.properties.showTime) {
494
+ if (counter == parseInt(inApp.properties.showTime)) {
476
495
  clearInterval(interval);
477
496
  if (onShowTimeFinished)
478
- onShowTimeFinished();
497
+ onShowTimeFinished(inApp);
479
498
  }
480
499
  }, 1000);
481
500
  }
482
- if (((_c = inApp === null || inApp === void 0 ? void 0 : inApp.properties) === null || _c === void 0 ? void 0 : _c.layout) && inApp.properties.layout.borderRadius) {
501
+ if (inApp.properties.borderRadius) {
483
502
  const borderRadius = `${parseInt(inApp.properties.layout.borderRadius)}px`;
484
503
  divClient.style.borderRadius = borderRadius;
485
504
  }
486
- if (onSuccess)
505
+ if (onSuccess) {
487
506
  onSuccess(inApp);
507
+ }
488
508
  }
489
509
  else {
490
510
  const message = "div element not found";
@@ -493,6 +513,198 @@ var capacitorIndigitallCp = (function (exports, core) {
493
513
  }
494
514
  }
495
515
  }
516
+ function editingFormHtml(html, viewId) {
517
+ const htmlWithoutOnClick = html.replace('InAppIndigitall.onClick', `inAppIndigitallOnClick_${viewId}`);
518
+ const htmlWithoutOnSubmit = htmlWithoutOnClick.replace('InAppIndigitall.submit', 'inAppIndigitallSubmit');
519
+ const htmlEditMethodNames = htmlWithoutOnSubmit
520
+ .replace('plusSlides', `plusSlides_${viewId}`)
521
+ .replace('currentSlide', `currentSlide_${viewId}`)
522
+ .replace('setNewInterval', `setNewInterval_${viewId}`)
523
+ .replace('newSlide', `newSlide_${viewId}`)
524
+ .replace('showSlides', `showSlides_${viewId}`);
525
+ return htmlEditMethodNames;
526
+ }
527
+ function getInAppScript(viewId, viewIdEdited, inAppModel, didClicked, didFormSubmit, didFormError) {
528
+ return `
529
+ var slideIndex_${viewIdEdited} = 1;
530
+ var delta_${viewIdEdited} = 6;
531
+ var startMove_${viewIdEdited} = null;
532
+ var startMoveY_${viewIdEdited} = null;
533
+ var diffX_${viewIdEdited};
534
+ var diffY_${viewIdEdited};
535
+ var timeSlide_${viewIdEdited} = 10000;
536
+
537
+ var slider_${viewIdEdited} = document.getElementById("${viewId}").querySelector('.ind_slider-container-actions');
538
+ var sliderTotal_${viewIdEdited} = document.getElementById("${viewId}").getElementsByClassName("ind_slideshow-item").length;
539
+
540
+ showSlides_${viewIdEdited}(slideIndex_${viewIdEdited});
541
+
542
+ var interval_${viewIdEdited} = setInterval(() => {
543
+ newSlide_${viewIdEdited}();
544
+ }, timeSlide_${viewIdEdited});
545
+
546
+ if (slider_${viewIdEdited}){
547
+ slider_${viewIdEdited}.addEventListener('touchstart', handleStart_${viewIdEdited}, false);
548
+ slider_${viewIdEdited}.addEventListener('touchend', handleEnd_${viewIdEdited}, false);
549
+ slider_${viewIdEdited}.addEventListener('mousedown', mouseStart_${viewIdEdited});
550
+ slider_${viewIdEdited}.addEventListener('mouseup', mouseEnd_${viewIdEdited});
551
+ }
552
+
553
+
554
+ function mouseStart_${viewIdEdited}(evt) {
555
+ evt.preventDefault();
556
+ startMove_${viewIdEdited} = evt.clientX;
557
+ startMoveY_${viewIdEdited} = evt.clientY;
558
+ }
559
+
560
+ function mouseEnd_${viewIdEdited}(evt) {
561
+ evt.preventDefault();
562
+ var endMove = evt.clientX;
563
+ var endMoveY = evt.clientY;
564
+ setEndMove_${viewIdEdited}(endMove, endMoveY);
565
+ }
566
+
567
+ function handleStart_${viewIdEdited}(evt) {
568
+ evt.preventDefault();
569
+ startMove_${viewIdEdited} = evt.touches[0].clientX;
570
+ startMoveY_${viewIdEdited} = evt.touches[0].clientY;
571
+ }
572
+ function handleEnd_${viewIdEdited}(evt) {
573
+ evt.preventDefault();
574
+ var endMove = evt.changedTouches[0].pageX;
575
+ var endMoveY = evt.changedTouches[0].pageY;
576
+ setEndMove_${viewIdEdited}(endMove, endMoveY);
577
+ }
578
+
579
+ function setEndMove_${viewIdEdited}(endMove, endMoveY) {
580
+ diffX_${viewIdEdited} = Math.abs(endMove - startMove_${viewIdEdited});
581
+ diffY_${viewIdEdited} = Math.abs(endMoveY - startMoveY_${viewIdEdited});
582
+ if (startMove_${viewIdEdited} != null) {
583
+ if (startMove_${viewIdEdited} > endMove) {
584
+ slideIndex_${viewIdEdited}++;
585
+ if (slideIndex_${viewIdEdited} > sliderTotal_${viewIdEdited}) {
586
+ slideIndex_${viewIdEdited} = 1;
587
+ }
588
+ } else {
589
+ if (slideIndex_${viewIdEdited} == 0) {
590
+ slideIndex_${viewIdEdited} = sliderTotal_${viewIdEdited};
591
+ } else {
592
+ slideIndex_${viewIdEdited}--;
593
+ }
594
+ }
595
+ showSlides_${viewIdEdited}(slideIndex_${viewIdEdited});
596
+ setNewInterval_${viewIdEdited}();
597
+ }
598
+ }
599
+
600
+ function plusSlides_${viewIdEdited}(n) {
601
+ showSlides_${viewIdEdited}(slideIndex_${viewIdEdited} += n);
602
+ setNewInterval_${viewIdEdited}();
603
+ }
604
+
605
+ function currentSlide_${viewIdEdited}(n) {
606
+ showSlides_${viewIdEdited}(slideIndex_${viewIdEdited} = n);
607
+ }
608
+
609
+ function setNewInterval_${viewIdEdited}() {
610
+ clearInterval(interval_${viewIdEdited});
611
+ interval_${viewIdEdited} = setInterval(() => {
612
+ newSlide_${viewIdEdited}();
613
+ }, timeSlide_${viewIdEdited});
614
+ }
615
+
616
+ function newSlide_${viewIdEdited}(){
617
+ slideIndex_${viewIdEdited}++;
618
+ if (slideIndex_${viewIdEdited} > sliderTotal_${viewIdEdited}) {
619
+ slideIndex_${viewIdEdited} = 1;
620
+ }
621
+ showSlides_${viewIdEdited}(slideIndex_${viewIdEdited});
622
+ }
623
+
624
+ function showSlides_${viewIdEdited}(n) {
625
+ let view = document.getElementById("${viewId}");
626
+ if (view) {
627
+ let slides = view.getElementsByClassName("ind_slideshow-item");
628
+ let i;
629
+ let dots = view.getElementsByClassName("ind_dot");
630
+ if (n > slides.length) {slideIndex_${viewIdEdited} = 1;}
631
+ if (n < 1) {slideIndex_${viewIdEdited} = slides.length;}
632
+ for (i = 0; i < slides.length; i++) {
633
+ slides[i].style.display = "none";
634
+ }
635
+ for (i = 0; i < dots.length; i++) {
636
+ dots[i].className = dots[i].className.replace(" active", "");
637
+ }
638
+ if (slides[slideIndex_${viewIdEdited}-1]) {
639
+ slides[slideIndex_${viewIdEdited}-1].style.display = "block";
640
+ }
641
+ if (dots[slideIndex_${viewIdEdited}-1]) dots[slideIndex_${viewIdEdited}-1].className += " active";
642
+ }
643
+ }
644
+
645
+
646
+ function inAppIndigitallOnClick_${viewIdEdited}(action) {
647
+ if (diffX_${viewIdEdited} && diffY_${viewIdEdited}) {
648
+ if (diffX_${viewIdEdited} < delta_${viewIdEdited} && diffY_${viewIdEdited} < delta_${viewIdEdited}) {
649
+ window.plugins.indigitallInApp.onClick(${inAppModel}, action, ${didClicked});
650
+ }
651
+ } else {
652
+ window.plugins.indigitallInApp.onClick(${inAppModel}, action, ${didClicked});
653
+ }
654
+ }
655
+
656
+ function inAppIndigitallSubmit(formOptions) {
657
+ const jsonForm = {}
658
+ const jsonCustomer = {}
659
+ const form = document.querySelector('[id="'+formOptions.formId+'"]');
660
+ if (form) {
661
+ formOptions.inputs.forEach((el) => {
662
+ if (el.id !== 'undefined') {
663
+ let value;
664
+ if (el.type === 'text' || el.type === 'number') {
665
+ if (form && form.querySelector('input[id^="'+el.id+'"]') && form.querySelector('input[id^="'+el.id+'"]').value !== 'undefined') {
666
+ value = form.querySelector('input[id^="'+el.id+'"]').value;
667
+ }
668
+ }
669
+ if (el.type === 'checkbox') {
670
+ if (form && form.querySelectorAll('input[id^="'+el.id +'"]')) {
671
+ let values = form.querySelectorAll('input[id^="'+el.id +'"]');
672
+ var valuesChecked = [];
673
+ for (var i = 0; i < values.length; i++) {
674
+ if (values[i].checked && values[i].value !== 'undefined') {
675
+ valuesChecked.push(values[i].value);
676
+ }
677
+ }
678
+ value = valuesChecked;
679
+ }
680
+ }
681
+ if (el.type === 'radio') {
682
+ if (form && form.querySelectorAll('input[id^="'+el.id +'"]')) {
683
+ let values = form.querySelectorAll('input[id^="'+el.id +'"]');
684
+ var valuesChecked;
685
+ for (var i = 0; i < values.length; i++) {
686
+ if (values[i].checked && values[i].value !== 'undefined') {
687
+ valuesChecked = values[i].value;
688
+ }
689
+ }
690
+ value = valuesChecked;
691
+ }
692
+ }
693
+ if (el.type === 'select') {
694
+ if (form && form.querySelector('select[id^="'+el.id+'"]') && form.querySelector('select[id^="'+el.id+'"]').value !== 'undefined') {
695
+ value = form.querySelector('select[id^="'+el.id+'"]').value;
696
+ }
697
+ }
698
+ if (value) jsonForm[el.id] = value;
699
+ if (el.sendToCustomer) jsonCustomer[el.id] = value;
700
+ }
701
+ });
702
+ }
703
+ window.plugins.indigitallInApp.formSubmit({"form": [${inAppModel}, JSON.stringify(formOptions), JSON.stringify(jsonForm), JSON.stringify(jsonCustomer)], ${didFormSubmit}, ${didFormError}});
704
+
705
+ }
706
+ `;
707
+ }
496
708
  function returnPlatform() {
497
709
  const agent = navigator.userAgent;
498
710
  if ((agent.indexOf("Android") > 0)) {