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.
- package/IndigitallCapacitorPlugin.podspec +1 -1
- package/README.md +28 -4
- package/android/build.gradle +3 -3
- package/android/src/main/AndroidManifest.xml +2 -2
- package/android/src/main/java/com/indigitall/capacitor/IndigitallCpPlugin.java +45 -57
- package/android/src/main/java/com/indigitall/capacitor/IndigitallInAppPlugin.java +104 -46
- package/android/src/main/java/com/indigitall/capacitor/implementations/CustomerCp.java +7 -7
- package/android/src/main/java/com/indigitall/capacitor/implementations/InAppCp.java +52 -13
- package/android/src/main/java/com/indigitall/capacitor/implementations/IndigitallCp.java +88 -23
- package/android/src/main/java/com/indigitall/capacitor/models/CpIndigitallHiddenActivity.java +3 -3
- package/android/src/main/java/com/indigitall/capacitor/models/CpPushNotification.java +12 -7
- package/android/src/main/java/com/indigitall/capacitor/services/IndigitallFirebaseMessagingService.java +3 -3
- package/android/src/main/java/com/indigitall/capacitor/utils/CpIndigitallUtils.java +4 -4
- package/android/src/main/java/com/indigitall/capacitor/utils/IndigitallInAppParse.java +49 -32
- package/android/src/main/java/com/indigitall/capacitor/utils/IndigitallParse.java +15 -82
- package/dist/docs.json +22 -2
- package/dist/esm/InApp.js +290 -85
- package/dist/esm/InApp.js.map +1 -1
- package/dist/esm/Push.js +11 -3
- package/dist/esm/Push.js.map +1 -1
- package/dist/esm/callbacks/callbacksType.d.ts +4 -1
- package/dist/esm/callbacks/callbacksType.js.map +1 -1
- package/dist/esm/definitions/customerDefinitions.d.ts +2 -2
- package/dist/esm/definitions/customerDefinitions.js.map +1 -1
- package/dist/esm/definitions/inAppDefinitions.d.ts +13 -3
- package/dist/esm/definitions/inAppDefinitions.js.map +1 -1
- package/dist/esm/definitions/pushDefinitions.d.ts +7 -3
- package/dist/esm/definitions/pushDefinitions.js.map +1 -1
- package/dist/esm/models/InInApp.d.ts +1 -1
- package/dist/esm/models/InInApp.js.map +1 -1
- package/dist/esm/models/InInbox.d.ts +1 -1
- package/dist/esm/models/InInbox.js.map +1 -1
- package/dist/esm/params/customerParams.d.ts +1 -1
- package/dist/esm/params/customerParams.js.map +1 -1
- package/dist/esm/params/pushParams.d.ts +2 -0
- package/dist/esm/params/pushParams.js.map +1 -1
- package/dist/plugin.cjs.js +300 -88
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +300 -88
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/IndigitallCpPlugin.swift +11 -1
- package/ios/Plugin/implementations/CustomerCp.swift +1 -3
- package/ios/Plugin/implementations/InAppCp.swift +7 -24
- package/ios/Plugin/implementations/InboxCp.swift +9 -9
- package/ios/Plugin/implementations/IndigitallCp.swift +25 -3
- package/ios/Plugin/utils/IndigitallParse.h +1 -2
- package/ios/Plugin/utils/IndigitallParse.m +41 -21
- 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
|
|
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: (
|
|
116
|
-
IndigitallCp.logIn({
|
|
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
|
-
|
|
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
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
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
|
-
|
|
440
|
-
|
|
441
|
-
|
|
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
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
}
|
|
470
|
-
});
|
|
471
|
-
|
|
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
|
-
|
|
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 (
|
|
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)) {
|