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