add-to-calendar-button 2.6.21 → 2.7.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/CHANGELOG.md +1 -0
- package/assets/css/atcb-3d.css +13 -2
- package/assets/css/atcb-3d.min.css +1 -1
- package/assets/css/atcb-date.css +13 -2
- package/assets/css/atcb-date.min.css +1 -1
- package/assets/css/atcb-flat.css +14 -3
- package/assets/css/atcb-flat.min.css +1 -1
- package/assets/css/atcb-neumorphism.css +13 -2
- package/assets/css/atcb-neumorphism.min.css +1 -1
- package/assets/css/atcb-round.css +13 -2
- package/assets/css/atcb-round.min.css +1 -1
- package/assets/css/atcb-text.css +13 -2
- package/assets/css/atcb-text.min.css +1 -1
- package/assets/css/atcb.css +13 -2
- package/assets/css/atcb.min.css +1 -1
- package/dist/atcb-no-pro-unstyle.js +80 -63
- package/dist/atcb-no-pro.js +81 -64
- package/dist/atcb-unstyle.js +95 -79
- package/dist/atcb.js +96 -80
- package/dist/commonjs/index.js +96 -80
- package/dist/commonjs/no-pro/index.js +81 -64
- package/dist/commonjs/no-pro-unstyle/index.js +80 -63
- package/dist/commonjs/unstyle/index.js +95 -79
- package/dist/module/index.js +96 -80
- package/dist/module/no-pro/index.js +81 -64
- package/dist/module/no-pro-unstyle/index.js +80 -63
- package/dist/module/unstyle/index.js +95 -79
- package/package.json +1 -1
package/dist/atcb-unstyle.js
CHANGED
|
@@ -974,14 +974,14 @@ function tzlib_get_timezones(jsonType = false) {
|
|
|
974
974
|
* Add to Calendar Button
|
|
975
975
|
* ++++++++++++++++++++++
|
|
976
976
|
*
|
|
977
|
-
* Version: 2.
|
|
977
|
+
* Version: 2.7.0
|
|
978
978
|
* Creator: Jens Kuerschner (https://jekuer.com)
|
|
979
979
|
* Project: https://github.com/add2cal/add-to-calendar-button
|
|
980
980
|
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
|
|
981
981
|
* Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
|
|
982
982
|
*
|
|
983
983
|
*/
|
|
984
|
-
const atcbVersion = '2.
|
|
984
|
+
const atcbVersion = '2.7.0';
|
|
985
985
|
const atcbCssTemplate = {};
|
|
986
986
|
const atcbIsBrowser = () => {
|
|
987
987
|
if (typeof window === 'undefined') {
|
|
@@ -1702,19 +1702,25 @@ function atcb_decorate_data_button_status_handling(data) {
|
|
|
1702
1702
|
return data;
|
|
1703
1703
|
}
|
|
1704
1704
|
async function atcb_decorate_data_rsvp(data) {
|
|
1705
|
-
if (typeof
|
|
1705
|
+
if (typeof atcb_check_bookings !== 'function' || !data.rsvp || !data.proKey || Object.keys(data.rsvp).length === 0) return data;
|
|
1706
1706
|
data.rsvp.expired = (function () {
|
|
1707
1707
|
if (data.rsvp && data.rsvp.expires && new Date(data.rsvp.expires) < new Date()) {
|
|
1708
1708
|
return true;
|
|
1709
1709
|
}
|
|
1710
1710
|
return false;
|
|
1711
1711
|
})();
|
|
1712
|
-
data.rsvp.
|
|
1713
|
-
|
|
1714
|
-
data.
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1712
|
+
if (data.rsvp.max) {
|
|
1713
|
+
const bookings = await atcb_check_bookings(data.proKey, data.dev);
|
|
1714
|
+
data.rsvp.seatsLeft = data.rsvp.max - bookings;
|
|
1715
|
+
if (data.rsvp.seatsLeft < 1) {
|
|
1716
|
+
data.rsvp.bookedOut = true;
|
|
1717
|
+
}
|
|
1718
|
+
if (data.rsvp.expired || data.rsvp.bookedOut) {
|
|
1719
|
+
data.blockInteraction = true;
|
|
1720
|
+
}
|
|
1721
|
+
if (data.blockInteraction) {
|
|
1722
|
+
data.disabled = true;
|
|
1723
|
+
}
|
|
1718
1724
|
}
|
|
1719
1725
|
return data;
|
|
1720
1726
|
}
|
|
@@ -2453,6 +2459,9 @@ async function atcb_generate_rsvp_form(host, data, hostEl, keyboardTrigger = fal
|
|
|
2453
2459
|
' class="atcb-modal-btn atcb-modal-btn-primary atcb-modal-btn-border">' +
|
|
2454
2460
|
atcb_translate_hook('submit', data) +
|
|
2455
2461
|
'</button><span id="pro-form-submitting" class="pro-waiting"><span>.</span><span>.</span><span>.</span></span></p>';
|
|
2462
|
+
if (rsvpData.seatsLeft && rsvpData.seatsLeft > 0) {
|
|
2463
|
+
rsvpContent += '<p class="pro-form-fine">' + atcb_translate_hook('form.seatsleft', data) + ': <b>' + rsvpData.seatsLeft + '</b></p>';
|
|
2464
|
+
}
|
|
2456
2465
|
rsvpContent += '</form>';
|
|
2457
2466
|
rsvpContent += '</div></div>';
|
|
2458
2467
|
let rsvpHost = null;
|
|
@@ -2692,24 +2701,20 @@ async function atcb_generate_rsvp_button(host, data) {
|
|
|
2692
2701
|
}
|
|
2693
2702
|
return true;
|
|
2694
2703
|
}
|
|
2695
|
-
async function
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
throw new Error('Network response was not ok');
|
|
2703
|
-
}
|
|
2704
|
-
const responseJson = await response.json();
|
|
2705
|
-
if (parseInt(responseJson.total) >= data.rsvp.max) {
|
|
2706
|
-
return true;
|
|
2707
|
-
}
|
|
2708
|
-
} catch (error) {
|
|
2709
|
-
console.error('Error:', error);
|
|
2704
|
+
async function atcb_check_bookings(proKey, dev = false) {
|
|
2705
|
+
try {
|
|
2706
|
+
const response = await fetch('https://api.add-to-calendar-pro.com/dffb8bbd-ee5e-4a4f-a7ea-503af98ca468?prokey=' + proKey + (dev ? '&dev=true' : ''), {
|
|
2707
|
+
method: 'GET',
|
|
2708
|
+
});
|
|
2709
|
+
if (!response.ok) {
|
|
2710
|
+
throw new Error('Network response was not ok');
|
|
2710
2711
|
}
|
|
2712
|
+
const responseJson = await response.json();
|
|
2713
|
+
return parseInt(responseJson.total);
|
|
2714
|
+
} catch (error) {
|
|
2715
|
+
console.error('Error:', error);
|
|
2711
2716
|
}
|
|
2712
|
-
return
|
|
2717
|
+
return 0;
|
|
2713
2718
|
}
|
|
2714
2719
|
function atcb_build_form(fields, identifier = '', disabled = false) {
|
|
2715
2720
|
/*!
|
|
@@ -3829,7 +3834,7 @@ function atcb_generate_subscribe_links(host, linkType, data, keyboardTrigger) {
|
|
|
3829
3834
|
atcb_subscribe_ical(data, data.icsFile);
|
|
3830
3835
|
break;
|
|
3831
3836
|
}
|
|
3832
|
-
atcb_subscribe_ical(data, adjustedFileUrl);
|
|
3837
|
+
atcb_subscribe_ical(data, adjustedFileUrl, host, keyboardTrigger);
|
|
3833
3838
|
break;
|
|
3834
3839
|
case 'google':
|
|
3835
3840
|
atcb_subscribe_google(data, adjustedFileUrl);
|
|
@@ -3898,7 +3903,11 @@ function atcb_set_fully_successful(host, data, multiDateModal = false) {
|
|
|
3898
3903
|
atcb_toggle(host, 'close');
|
|
3899
3904
|
}
|
|
3900
3905
|
}
|
|
3901
|
-
function atcb_subscribe_ical(data, fileUrl) {
|
|
3906
|
+
function atcb_subscribe_ical(data, fileUrl, host = null, keyboardTrigger = false) {
|
|
3907
|
+
if ((atcbIsiOS() || data.fakeIOS) && !atcbIsSafari()) {
|
|
3908
|
+
atcb_ical_copy_note(host, fileUrl, data, keyboardTrigger);
|
|
3909
|
+
return;
|
|
3910
|
+
}
|
|
3902
3911
|
atcb_open_cal_url(data, 'ical', fileUrl, true);
|
|
3903
3912
|
}
|
|
3904
3913
|
function atcb_subscribe_google(data, fileUrl) {
|
|
@@ -4223,7 +4232,7 @@ function atcb_generate_ical(host, data, subEvent = 'all', keyboardTrigger = fals
|
|
|
4223
4232
|
}
|
|
4224
4233
|
return 'data:text/calendar;charset=utf-8,' + encodeURIComponent(ics_lines.join('\r\n'));
|
|
4225
4234
|
})();
|
|
4226
|
-
if ((atcbIsiOS() && !atcbIsSafari()) || (atcbIsWebView() && (atcbIsiOS() || (atcbIsAndroid() && atcbIsProblematicWebView())))) {
|
|
4235
|
+
if (((atcbIsiOS() || data.fakeIOS) && !atcbIsSafari()) || (atcbIsWebView() && (atcbIsiOS() || data.fakeIOS || ((atcbIsAndroid() || data.fakeAndroid) && atcbIsProblematicWebView())))) {
|
|
4227
4236
|
atcb_ical_copy_note(host, dataUrl, data, keyboardTrigger);
|
|
4228
4237
|
return;
|
|
4229
4238
|
}
|
|
@@ -4249,7 +4258,7 @@ function atcb_determine_ical_filename(data, subEvent) {
|
|
|
4249
4258
|
}
|
|
4250
4259
|
function atcb_ical_copy_note(host, dataUrl, data, keyboardTrigger) {
|
|
4251
4260
|
atcb_copy_to_clipboard(dataUrl);
|
|
4252
|
-
if (atcbIsiOS() && !atcbIsSafari()) {
|
|
4261
|
+
if ((atcbIsiOS() || data.fakeIOS) && !atcbIsSafari()) {
|
|
4253
4262
|
atcb_create_modal(
|
|
4254
4263
|
host,
|
|
4255
4264
|
data,
|
|
@@ -5766,27 +5775,26 @@ if (atcbIsBrowser()) {
|
|
|
5766
5775
|
}
|
|
5767
5776
|
this.proOverride = !proOverrideVal || proOverrideVal === 'true' || proOverrideVal === '' ? true : false;
|
|
5768
5777
|
}
|
|
5769
|
-
|
|
5770
|
-
if (this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') {
|
|
5771
|
-
this.
|
|
5778
|
+
try {
|
|
5779
|
+
if ((this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') || (this.hasAttribute('prokey') && this.getAttribute('prokey') !== '')) {
|
|
5780
|
+
if (this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') {
|
|
5781
|
+
this.data = await atcb_get_pro_data(this.getAttribute('proKey'), this);
|
|
5782
|
+
} else {
|
|
5783
|
+
this.data = await atcb_get_pro_data(this.getAttribute('prokey'), this);
|
|
5784
|
+
}
|
|
5785
|
+
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
5772
5786
|
} else {
|
|
5773
|
-
this.data =
|
|
5774
|
-
}
|
|
5775
|
-
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
5776
|
-
}
|
|
5777
|
-
if (!this.data.name || this.data.name === '') {
|
|
5778
|
-
this.data.proKey = '';
|
|
5779
|
-
try {
|
|
5787
|
+
this.data.proKey = '';
|
|
5780
5788
|
this.data = await atcb_process_inline_data(this, this.debug);
|
|
5781
|
-
} catch (e) {
|
|
5782
|
-
if (this.debug) {
|
|
5783
|
-
console.error(e);
|
|
5784
|
-
atcb_render_debug_msg(this.shadowRoot, e);
|
|
5785
|
-
}
|
|
5786
|
-
this.state.initializing = false;
|
|
5787
|
-
this.state.ready = true;
|
|
5788
|
-
return;
|
|
5789
5789
|
}
|
|
5790
|
+
} catch (e) {
|
|
5791
|
+
if (this.debug) {
|
|
5792
|
+
console.error(e);
|
|
5793
|
+
atcb_render_debug_msg(this.shadowRoot, e);
|
|
5794
|
+
}
|
|
5795
|
+
this.state.initializing = false;
|
|
5796
|
+
this.state.ready = true;
|
|
5797
|
+
return;
|
|
5790
5798
|
}
|
|
5791
5799
|
await this.initButton();
|
|
5792
5800
|
this.state.initializing = false;
|
|
@@ -5841,24 +5849,23 @@ if (atcbIsBrowser()) {
|
|
|
5841
5849
|
const elem = document.createElement('template');
|
|
5842
5850
|
elem.innerHTML = template;
|
|
5843
5851
|
this.shadowRoot.append(elem.content.cloneNode(true));
|
|
5844
|
-
|
|
5845
|
-
this.
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
try {
|
|
5852
|
+
try {
|
|
5853
|
+
if (this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') {
|
|
5854
|
+
this.data = await atcb_get_pro_data(this.getAttribute('proKey'), this);
|
|
5855
|
+
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
5856
|
+
} else if (this.hasAttribute('prokey') && this.getAttribute('prokey') !== '') {
|
|
5857
|
+
this.data = await atcb_get_pro_data(this.getAttribute('prokey'), this);
|
|
5858
|
+
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
5859
|
+
} else {
|
|
5853
5860
|
this.data = await atcb_process_inline_data(this, this.debug);
|
|
5854
|
-
} catch (e) {
|
|
5855
|
-
if (this.debug) {
|
|
5856
|
-
console.error(e);
|
|
5857
|
-
atcb_render_debug_msg(this.shadowRoot, e);
|
|
5858
|
-
}
|
|
5859
|
-
this.updatePending = false;
|
|
5860
|
-
return;
|
|
5861
5861
|
}
|
|
5862
|
+
} catch (e) {
|
|
5863
|
+
if (this.debug) {
|
|
5864
|
+
console.error(e);
|
|
5865
|
+
atcb_render_debug_msg(this.shadowRoot, e);
|
|
5866
|
+
}
|
|
5867
|
+
this.updatePending = false;
|
|
5868
|
+
return;
|
|
5862
5869
|
}
|
|
5863
5870
|
atcb_cleanup(this.shadowRoot, this.identifier);
|
|
5864
5871
|
await this.initButton();
|
|
@@ -6189,19 +6196,28 @@ async function atcb_action(inputData, triggerElement, keyboardTrigger = false) {
|
|
|
6189
6196
|
if (!atcbIsBrowser()) {
|
|
6190
6197
|
return;
|
|
6191
6198
|
}
|
|
6192
|
-
let data
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
cleanedInput
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
const proData = await atcb_get_pro_data(cleanedInput.proKey, null, cleanedInput);
|
|
6199
|
-
if (proData.name && proData.name != '') {
|
|
6200
|
-
return proData;
|
|
6199
|
+
let data;
|
|
6200
|
+
try {
|
|
6201
|
+
data = await (async function () {
|
|
6202
|
+
const cleanedInput = atcb_secure_content(inputData);
|
|
6203
|
+
if (cleanedInput.prokey && cleanedInput.prokey !== '') {
|
|
6204
|
+
cleanedInput.proKey = cleanedInput.prokey;
|
|
6201
6205
|
}
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6206
|
+
if (cleanedInput.proKey && cleanedInput.proKey !== '') {
|
|
6207
|
+
try {
|
|
6208
|
+
const proData = await atcb_get_pro_data(cleanedInput.proKey, null, cleanedInput);
|
|
6209
|
+
return proData;
|
|
6210
|
+
} catch (e) {
|
|
6211
|
+
throw new Error(e.message);
|
|
6212
|
+
}
|
|
6213
|
+
} else {
|
|
6214
|
+
return cleanedInput;
|
|
6215
|
+
}
|
|
6216
|
+
})();
|
|
6217
|
+
} catch (e) {
|
|
6218
|
+
console.error(e);
|
|
6219
|
+
return;
|
|
6220
|
+
}
|
|
6205
6221
|
data.debug = data.debug === 'true';
|
|
6206
6222
|
try {
|
|
6207
6223
|
await atcb_check_required(data);
|
|
@@ -6339,9 +6355,6 @@ async function atcb_get_pro_data(licenseKey, el = null, directData = {}) {
|
|
|
6339
6355
|
const response = await fetch((dataOverrides.dev ? 'https://event-dev.caldn.net/' : 'https://event.caldn.net/') + licenseKey + '/config.json');
|
|
6340
6356
|
if (response.ok) {
|
|
6341
6357
|
const data = await response.json();
|
|
6342
|
-
if (!data.name || data.name === '') {
|
|
6343
|
-
throw new Error('Not possible to read proKey config from server...');
|
|
6344
|
-
}
|
|
6345
6358
|
if (proOverride) {
|
|
6346
6359
|
atcbWcParams.forEach((key) => {
|
|
6347
6360
|
if (Object.prototype.hasOwnProperty.call(dataOverrides, key) && ['hideBranding', 'hidebranding', 'rsvp', 'ty'].indexOf(key) === -1) {
|
|
@@ -6355,13 +6368,16 @@ async function atcb_get_pro_data(licenseKey, el = null, directData = {}) {
|
|
|
6355
6368
|
}
|
|
6356
6369
|
});
|
|
6357
6370
|
}
|
|
6371
|
+
if (!data.name || data.name === '') {
|
|
6372
|
+
throw new Error('Not possible to read proKey config from server...');
|
|
6373
|
+
}
|
|
6358
6374
|
data.proKey = licenseKey;
|
|
6359
6375
|
data.identifier = licenseKey;
|
|
6360
6376
|
return data;
|
|
6361
6377
|
}
|
|
6362
6378
|
throw new Error('Not possible to read proKey config from server...');
|
|
6363
6379
|
} catch {
|
|
6364
|
-
|
|
6380
|
+
throw new Error('Add to Calendar Button proKey invalid or server not responding!');
|
|
6365
6381
|
}
|
|
6366
6382
|
}
|
|
6367
6383
|
return {};
|
package/dist/atcb.js
CHANGED
|
@@ -974,15 +974,15 @@ function tzlib_get_timezones(jsonType = false) {
|
|
|
974
974
|
* Add to Calendar Button
|
|
975
975
|
* ++++++++++++++++++++++
|
|
976
976
|
*
|
|
977
|
-
* Version: 2.
|
|
977
|
+
* Version: 2.7.0
|
|
978
978
|
* Creator: Jens Kuerschner (https://jekuer.com)
|
|
979
979
|
* Project: https://github.com/add2cal/add-to-calendar-button
|
|
980
980
|
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
|
|
981
981
|
* Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
|
|
982
982
|
*
|
|
983
983
|
*/
|
|
984
|
-
const atcbVersion = '2.
|
|
985
|
-
const atcbCssTemplate = {
|
|
984
|
+
const atcbVersion = '2.7.0';
|
|
985
|
+
const atcbCssTemplate = {
|
|
986
986
|
if (typeof window === 'undefined') {
|
|
987
987
|
return false;
|
|
988
988
|
} else {
|
|
@@ -1701,19 +1701,25 @@ function atcb_decorate_data_button_status_handling(data) {
|
|
|
1701
1701
|
return data;
|
|
1702
1702
|
}
|
|
1703
1703
|
async function atcb_decorate_data_rsvp(data) {
|
|
1704
|
-
if (typeof
|
|
1704
|
+
if (typeof atcb_check_bookings !== 'function' || !data.rsvp || !data.proKey || Object.keys(data.rsvp).length === 0) return data;
|
|
1705
1705
|
data.rsvp.expired = (function () {
|
|
1706
1706
|
if (data.rsvp && data.rsvp.expires && new Date(data.rsvp.expires) < new Date()) {
|
|
1707
1707
|
return true;
|
|
1708
1708
|
}
|
|
1709
1709
|
return false;
|
|
1710
1710
|
})();
|
|
1711
|
-
data.rsvp.
|
|
1712
|
-
|
|
1713
|
-
data.
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1711
|
+
if (data.rsvp.max) {
|
|
1712
|
+
const bookings = await atcb_check_bookings(data.proKey, data.dev);
|
|
1713
|
+
data.rsvp.seatsLeft = data.rsvp.max - bookings;
|
|
1714
|
+
if (data.rsvp.seatsLeft < 1) {
|
|
1715
|
+
data.rsvp.bookedOut = true;
|
|
1716
|
+
}
|
|
1717
|
+
if (data.rsvp.expired || data.rsvp.bookedOut) {
|
|
1718
|
+
data.blockInteraction = true;
|
|
1719
|
+
}
|
|
1720
|
+
if (data.blockInteraction) {
|
|
1721
|
+
data.disabled = true;
|
|
1722
|
+
}
|
|
1717
1723
|
}
|
|
1718
1724
|
return data;
|
|
1719
1725
|
}
|
|
@@ -2452,6 +2458,9 @@ async function atcb_generate_rsvp_form(host, data, hostEl, keyboardTrigger = fal
|
|
|
2452
2458
|
' class="atcb-modal-btn atcb-modal-btn-primary atcb-modal-btn-border">' +
|
|
2453
2459
|
atcb_translate_hook('submit', data) +
|
|
2454
2460
|
'</button><span id="pro-form-submitting" class="pro-waiting"><span>.</span><span>.</span><span>.</span></span></p>';
|
|
2461
|
+
if (rsvpData.seatsLeft && rsvpData.seatsLeft > 0) {
|
|
2462
|
+
rsvpContent += '<p class="pro-form-fine">' + atcb_translate_hook('form.seatsleft', data) + ': <b>' + rsvpData.seatsLeft + '</b></p>';
|
|
2463
|
+
}
|
|
2455
2464
|
rsvpContent += '</form>';
|
|
2456
2465
|
rsvpContent += '</div></div>';
|
|
2457
2466
|
let rsvpHost = null;
|
|
@@ -2691,24 +2700,20 @@ async function atcb_generate_rsvp_button(host, data) {
|
|
|
2691
2700
|
}
|
|
2692
2701
|
return true;
|
|
2693
2702
|
}
|
|
2694
|
-
async function
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
throw new Error('Network response was not ok');
|
|
2702
|
-
}
|
|
2703
|
-
const responseJson = await response.json();
|
|
2704
|
-
if (parseInt(responseJson.total) >= data.rsvp.max) {
|
|
2705
|
-
return true;
|
|
2706
|
-
}
|
|
2707
|
-
} catch (error) {
|
|
2708
|
-
console.error('Error:', error);
|
|
2703
|
+
async function atcb_check_bookings(proKey, dev = false) {
|
|
2704
|
+
try {
|
|
2705
|
+
const response = await fetch('https://api.add-to-calendar-pro.com/dffb8bbd-ee5e-4a4f-a7ea-503af98ca468?prokey=' + proKey + (dev ? '&dev=true' : ''), {
|
|
2706
|
+
method: 'GET',
|
|
2707
|
+
});
|
|
2708
|
+
if (!response.ok) {
|
|
2709
|
+
throw new Error('Network response was not ok');
|
|
2709
2710
|
}
|
|
2711
|
+
const responseJson = await response.json();
|
|
2712
|
+
return parseInt(responseJson.total);
|
|
2713
|
+
} catch (error) {
|
|
2714
|
+
console.error('Error:', error);
|
|
2710
2715
|
}
|
|
2711
|
-
return
|
|
2716
|
+
return 0;
|
|
2712
2717
|
}
|
|
2713
2718
|
function atcb_build_form(fields, identifier = '', disabled = false) {
|
|
2714
2719
|
/*!
|
|
@@ -3828,7 +3833,7 @@ function atcb_generate_subscribe_links(host, linkType, data, keyboardTrigger) {
|
|
|
3828
3833
|
atcb_subscribe_ical(data, data.icsFile);
|
|
3829
3834
|
break;
|
|
3830
3835
|
}
|
|
3831
|
-
atcb_subscribe_ical(data, adjustedFileUrl);
|
|
3836
|
+
atcb_subscribe_ical(data, adjustedFileUrl, host, keyboardTrigger);
|
|
3832
3837
|
break;
|
|
3833
3838
|
case 'google':
|
|
3834
3839
|
atcb_subscribe_google(data, adjustedFileUrl);
|
|
@@ -3897,7 +3902,11 @@ function atcb_set_fully_successful(host, data, multiDateModal = false) {
|
|
|
3897
3902
|
atcb_toggle(host, 'close');
|
|
3898
3903
|
}
|
|
3899
3904
|
}
|
|
3900
|
-
function atcb_subscribe_ical(data, fileUrl) {
|
|
3905
|
+
function atcb_subscribe_ical(data, fileUrl, host = null, keyboardTrigger = false) {
|
|
3906
|
+
if ((atcbIsiOS() || data.fakeIOS) && !atcbIsSafari()) {
|
|
3907
|
+
atcb_ical_copy_note(host, fileUrl, data, keyboardTrigger);
|
|
3908
|
+
return;
|
|
3909
|
+
}
|
|
3901
3910
|
atcb_open_cal_url(data, 'ical', fileUrl, true);
|
|
3902
3911
|
}
|
|
3903
3912
|
function atcb_subscribe_google(data, fileUrl) {
|
|
@@ -4222,7 +4231,7 @@ function atcb_generate_ical(host, data, subEvent = 'all', keyboardTrigger = fals
|
|
|
4222
4231
|
}
|
|
4223
4232
|
return 'data:text/calendar;charset=utf-8,' + encodeURIComponent(ics_lines.join('\r\n'));
|
|
4224
4233
|
})();
|
|
4225
|
-
if ((atcbIsiOS() && !atcbIsSafari()) || (atcbIsWebView() && (atcbIsiOS() || (atcbIsAndroid() && atcbIsProblematicWebView())))) {
|
|
4234
|
+
if (((atcbIsiOS() || data.fakeIOS) && !atcbIsSafari()) || (atcbIsWebView() && (atcbIsiOS() || data.fakeIOS || ((atcbIsAndroid() || data.fakeAndroid) && atcbIsProblematicWebView())))) {
|
|
4226
4235
|
atcb_ical_copy_note(host, dataUrl, data, keyboardTrigger);
|
|
4227
4236
|
return;
|
|
4228
4237
|
}
|
|
@@ -4248,7 +4257,7 @@ function atcb_determine_ical_filename(data, subEvent) {
|
|
|
4248
4257
|
}
|
|
4249
4258
|
function atcb_ical_copy_note(host, dataUrl, data, keyboardTrigger) {
|
|
4250
4259
|
atcb_copy_to_clipboard(dataUrl);
|
|
4251
|
-
if (atcbIsiOS() && !atcbIsSafari()) {
|
|
4260
|
+
if ((atcbIsiOS() || data.fakeIOS) && !atcbIsSafari()) {
|
|
4252
4261
|
atcb_create_modal(
|
|
4253
4262
|
host,
|
|
4254
4263
|
data,
|
|
@@ -5765,27 +5774,26 @@ if (atcbIsBrowser()) {
|
|
|
5765
5774
|
}
|
|
5766
5775
|
this.proOverride = !proOverrideVal || proOverrideVal === 'true' || proOverrideVal === '' ? true : false;
|
|
5767
5776
|
}
|
|
5768
|
-
|
|
5769
|
-
if (this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') {
|
|
5770
|
-
this.
|
|
5777
|
+
try {
|
|
5778
|
+
if ((this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') || (this.hasAttribute('prokey') && this.getAttribute('prokey') !== '')) {
|
|
5779
|
+
if (this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') {
|
|
5780
|
+
this.data = await atcb_get_pro_data(this.getAttribute('proKey'), this);
|
|
5781
|
+
} else {
|
|
5782
|
+
this.data = await atcb_get_pro_data(this.getAttribute('prokey'), this);
|
|
5783
|
+
}
|
|
5784
|
+
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
5771
5785
|
} else {
|
|
5772
|
-
this.data =
|
|
5773
|
-
}
|
|
5774
|
-
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
5775
|
-
}
|
|
5776
|
-
if (!this.data.name || this.data.name === '') {
|
|
5777
|
-
this.data.proKey = '';
|
|
5778
|
-
try {
|
|
5786
|
+
this.data.proKey = '';
|
|
5779
5787
|
this.data = await atcb_process_inline_data(this, this.debug);
|
|
5780
|
-
} catch (e) {
|
|
5781
|
-
if (this.debug) {
|
|
5782
|
-
console.error(e);
|
|
5783
|
-
atcb_render_debug_msg(this.shadowRoot, e);
|
|
5784
|
-
}
|
|
5785
|
-
this.state.initializing = false;
|
|
5786
|
-
this.state.ready = true;
|
|
5787
|
-
return;
|
|
5788
5788
|
}
|
|
5789
|
+
} catch (e) {
|
|
5790
|
+
if (this.debug) {
|
|
5791
|
+
console.error(e);
|
|
5792
|
+
atcb_render_debug_msg(this.shadowRoot, e);
|
|
5793
|
+
}
|
|
5794
|
+
this.state.initializing = false;
|
|
5795
|
+
this.state.ready = true;
|
|
5796
|
+
return;
|
|
5789
5797
|
}
|
|
5790
5798
|
await this.initButton();
|
|
5791
5799
|
this.state.initializing = false;
|
|
@@ -5840,24 +5848,23 @@ if (atcbIsBrowser()) {
|
|
|
5840
5848
|
const elem = document.createElement('template');
|
|
5841
5849
|
elem.innerHTML = template;
|
|
5842
5850
|
this.shadowRoot.append(elem.content.cloneNode(true));
|
|
5843
|
-
|
|
5844
|
-
this.
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
try {
|
|
5851
|
+
try {
|
|
5852
|
+
if (this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') {
|
|
5853
|
+
this.data = await atcb_get_pro_data(this.getAttribute('proKey'), this);
|
|
5854
|
+
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
5855
|
+
} else if (this.hasAttribute('prokey') && this.getAttribute('prokey') !== '') {
|
|
5856
|
+
this.data = await atcb_get_pro_data(this.getAttribute('prokey'), this);
|
|
5857
|
+
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
5858
|
+
} else {
|
|
5852
5859
|
this.data = await atcb_process_inline_data(this, this.debug);
|
|
5853
|
-
} catch (e) {
|
|
5854
|
-
if (this.debug) {
|
|
5855
|
-
console.error(e);
|
|
5856
|
-
atcb_render_debug_msg(this.shadowRoot, e);
|
|
5857
|
-
}
|
|
5858
|
-
this.updatePending = false;
|
|
5859
|
-
return;
|
|
5860
5860
|
}
|
|
5861
|
+
} catch (e) {
|
|
5862
|
+
if (this.debug) {
|
|
5863
|
+
console.error(e);
|
|
5864
|
+
atcb_render_debug_msg(this.shadowRoot, e);
|
|
5865
|
+
}
|
|
5866
|
+
this.updatePending = false;
|
|
5867
|
+
return;
|
|
5861
5868
|
}
|
|
5862
5869
|
atcb_cleanup(this.shadowRoot, this.identifier);
|
|
5863
5870
|
await this.initButton();
|
|
@@ -6188,19 +6195,28 @@ async function atcb_action(inputData, triggerElement, keyboardTrigger = false) {
|
|
|
6188
6195
|
if (!atcbIsBrowser()) {
|
|
6189
6196
|
return;
|
|
6190
6197
|
}
|
|
6191
|
-
let data
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
cleanedInput
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
const proData = await atcb_get_pro_data(cleanedInput.proKey, null, cleanedInput);
|
|
6198
|
-
if (proData.name && proData.name != '') {
|
|
6199
|
-
return proData;
|
|
6198
|
+
let data;
|
|
6199
|
+
try {
|
|
6200
|
+
data = await (async function () {
|
|
6201
|
+
const cleanedInput = atcb_secure_content(inputData);
|
|
6202
|
+
if (cleanedInput.prokey && cleanedInput.prokey !== '') {
|
|
6203
|
+
cleanedInput.proKey = cleanedInput.prokey;
|
|
6200
6204
|
}
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6205
|
+
if (cleanedInput.proKey && cleanedInput.proKey !== '') {
|
|
6206
|
+
try {
|
|
6207
|
+
const proData = await atcb_get_pro_data(cleanedInput.proKey, null, cleanedInput);
|
|
6208
|
+
return proData;
|
|
6209
|
+
} catch (e) {
|
|
6210
|
+
throw new Error(e.message);
|
|
6211
|
+
}
|
|
6212
|
+
} else {
|
|
6213
|
+
return cleanedInput;
|
|
6214
|
+
}
|
|
6215
|
+
})();
|
|
6216
|
+
} catch (e) {
|
|
6217
|
+
console.error(e);
|
|
6218
|
+
return;
|
|
6219
|
+
}
|
|
6204
6220
|
data.debug = data.debug === 'true';
|
|
6205
6221
|
try {
|
|
6206
6222
|
await atcb_check_required(data);
|
|
@@ -6338,9 +6354,6 @@ async function atcb_get_pro_data(licenseKey, el = null, directData = {}) {
|
|
|
6338
6354
|
const response = await fetch((dataOverrides.dev ? 'https://event-dev.caldn.net/' : 'https://event.caldn.net/') + licenseKey + '/config.json');
|
|
6339
6355
|
if (response.ok) {
|
|
6340
6356
|
const data = await response.json();
|
|
6341
|
-
if (!data.name || data.name === '') {
|
|
6342
|
-
throw new Error('Not possible to read proKey config from server...');
|
|
6343
|
-
}
|
|
6344
6357
|
if (proOverride) {
|
|
6345
6358
|
atcbWcParams.forEach((key) => {
|
|
6346
6359
|
if (Object.prototype.hasOwnProperty.call(dataOverrides, key) && ['hideBranding', 'hidebranding', 'rsvp', 'ty'].indexOf(key) === -1) {
|
|
@@ -6354,13 +6367,16 @@ async function atcb_get_pro_data(licenseKey, el = null, directData = {}) {
|
|
|
6354
6367
|
}
|
|
6355
6368
|
});
|
|
6356
6369
|
}
|
|
6370
|
+
if (!data.name || data.name === '') {
|
|
6371
|
+
throw new Error('Not possible to read proKey config from server...');
|
|
6372
|
+
}
|
|
6357
6373
|
data.proKey = licenseKey;
|
|
6358
6374
|
data.identifier = licenseKey;
|
|
6359
6375
|
return data;
|
|
6360
6376
|
}
|
|
6361
6377
|
throw new Error('Not possible to read proKey config from server...');
|
|
6362
6378
|
} catch {
|
|
6363
|
-
|
|
6379
|
+
throw new Error('Add to Calendar Button proKey invalid or server not responding!');
|
|
6364
6380
|
}
|
|
6365
6381
|
}
|
|
6366
6382
|
return {};
|