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
|
@@ -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
|
}
|
|
@@ -3108,7 +3114,7 @@ function atcb_generate_subscribe_links(host, linkType, data, keyboardTrigger) {
|
|
|
3108
3114
|
atcb_subscribe_ical(data, data.icsFile);
|
|
3109
3115
|
break;
|
|
3110
3116
|
}
|
|
3111
|
-
atcb_subscribe_ical(data, adjustedFileUrl);
|
|
3117
|
+
atcb_subscribe_ical(data, adjustedFileUrl, host, keyboardTrigger);
|
|
3112
3118
|
break;
|
|
3113
3119
|
case 'google':
|
|
3114
3120
|
atcb_subscribe_google(data, adjustedFileUrl);
|
|
@@ -3177,7 +3183,11 @@ function atcb_set_fully_successful(host, data, multiDateModal = false) {
|
|
|
3177
3183
|
atcb_toggle(host, 'close');
|
|
3178
3184
|
}
|
|
3179
3185
|
}
|
|
3180
|
-
function atcb_subscribe_ical(data, fileUrl) {
|
|
3186
|
+
function atcb_subscribe_ical(data, fileUrl, host = null, keyboardTrigger = false) {
|
|
3187
|
+
if ((atcbIsiOS() || data.fakeIOS) && !atcbIsSafari()) {
|
|
3188
|
+
atcb_ical_copy_note(host, fileUrl, data, keyboardTrigger);
|
|
3189
|
+
return;
|
|
3190
|
+
}
|
|
3181
3191
|
atcb_open_cal_url(data, 'ical', fileUrl, true);
|
|
3182
3192
|
}
|
|
3183
3193
|
function atcb_subscribe_google(data, fileUrl) {
|
|
@@ -3502,7 +3512,7 @@ function atcb_generate_ical(host, data, subEvent = 'all', keyboardTrigger = fals
|
|
|
3502
3512
|
}
|
|
3503
3513
|
return 'data:text/calendar;charset=utf-8,' + encodeURIComponent(ics_lines.join('\r\n'));
|
|
3504
3514
|
})();
|
|
3505
|
-
if ((atcbIsiOS() && !atcbIsSafari()) || (atcbIsWebView() && (atcbIsiOS() || (atcbIsAndroid() && atcbIsProblematicWebView())))) {
|
|
3515
|
+
if (((atcbIsiOS() || data.fakeIOS) && !atcbIsSafari()) || (atcbIsWebView() && (atcbIsiOS() || data.fakeIOS || ((atcbIsAndroid() || data.fakeAndroid) && atcbIsProblematicWebView())))) {
|
|
3506
3516
|
atcb_ical_copy_note(host, dataUrl, data, keyboardTrigger);
|
|
3507
3517
|
return;
|
|
3508
3518
|
}
|
|
@@ -3528,7 +3538,7 @@ function atcb_determine_ical_filename(data, subEvent) {
|
|
|
3528
3538
|
}
|
|
3529
3539
|
function atcb_ical_copy_note(host, dataUrl, data, keyboardTrigger) {
|
|
3530
3540
|
atcb_copy_to_clipboard(dataUrl);
|
|
3531
|
-
if (atcbIsiOS() && !atcbIsSafari()) {
|
|
3541
|
+
if ((atcbIsiOS() || data.fakeIOS) && !atcbIsSafari()) {
|
|
3532
3542
|
atcb_create_modal(
|
|
3533
3543
|
host,
|
|
3534
3544
|
data,
|
|
@@ -5045,27 +5055,26 @@ if (atcbIsBrowser()) {
|
|
|
5045
5055
|
}
|
|
5046
5056
|
this.proOverride = !proOverrideVal || proOverrideVal === 'true' || proOverrideVal === '' ? true : false;
|
|
5047
5057
|
}
|
|
5048
|
-
|
|
5049
|
-
if (this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') {
|
|
5050
|
-
this.
|
|
5058
|
+
try {
|
|
5059
|
+
if ((this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') || (this.hasAttribute('prokey') && this.getAttribute('prokey') !== '')) {
|
|
5060
|
+
if (this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') {
|
|
5061
|
+
this.data = await atcb_get_pro_data(this.getAttribute('proKey'), this);
|
|
5062
|
+
} else {
|
|
5063
|
+
this.data = await atcb_get_pro_data(this.getAttribute('prokey'), this);
|
|
5064
|
+
}
|
|
5065
|
+
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
5051
5066
|
} else {
|
|
5052
|
-
this.data =
|
|
5053
|
-
}
|
|
5054
|
-
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
5055
|
-
}
|
|
5056
|
-
if (!this.data.name || this.data.name === '') {
|
|
5057
|
-
this.data.proKey = '';
|
|
5058
|
-
try {
|
|
5067
|
+
this.data.proKey = '';
|
|
5059
5068
|
this.data = await atcb_process_inline_data(this, this.debug);
|
|
5060
|
-
} catch (e) {
|
|
5061
|
-
if (this.debug) {
|
|
5062
|
-
console.error(e);
|
|
5063
|
-
atcb_render_debug_msg(this.shadowRoot, e);
|
|
5064
|
-
}
|
|
5065
|
-
this.state.initializing = false;
|
|
5066
|
-
this.state.ready = true;
|
|
5067
|
-
return;
|
|
5068
5069
|
}
|
|
5070
|
+
} catch (e) {
|
|
5071
|
+
if (this.debug) {
|
|
5072
|
+
console.error(e);
|
|
5073
|
+
atcb_render_debug_msg(this.shadowRoot, e);
|
|
5074
|
+
}
|
|
5075
|
+
this.state.initializing = false;
|
|
5076
|
+
this.state.ready = true;
|
|
5077
|
+
return;
|
|
5069
5078
|
}
|
|
5070
5079
|
await this.initButton();
|
|
5071
5080
|
this.state.initializing = false;
|
|
@@ -5120,24 +5129,23 @@ if (atcbIsBrowser()) {
|
|
|
5120
5129
|
const elem = document.createElement('template');
|
|
5121
5130
|
elem.innerHTML = template;
|
|
5122
5131
|
this.shadowRoot.append(elem.content.cloneNode(true));
|
|
5123
|
-
|
|
5124
|
-
this.
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
try {
|
|
5132
|
+
try {
|
|
5133
|
+
if (this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') {
|
|
5134
|
+
this.data = await atcb_get_pro_data(this.getAttribute('proKey'), this);
|
|
5135
|
+
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
5136
|
+
} else if (this.hasAttribute('prokey') && this.getAttribute('prokey') !== '') {
|
|
5137
|
+
this.data = await atcb_get_pro_data(this.getAttribute('prokey'), this);
|
|
5138
|
+
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
5139
|
+
} else {
|
|
5132
5140
|
this.data = await atcb_process_inline_data(this, this.debug);
|
|
5133
|
-
} catch (e) {
|
|
5134
|
-
if (this.debug) {
|
|
5135
|
-
console.error(e);
|
|
5136
|
-
atcb_render_debug_msg(this.shadowRoot, e);
|
|
5137
|
-
}
|
|
5138
|
-
this.updatePending = false;
|
|
5139
|
-
return;
|
|
5140
5141
|
}
|
|
5142
|
+
} catch (e) {
|
|
5143
|
+
if (this.debug) {
|
|
5144
|
+
console.error(e);
|
|
5145
|
+
atcb_render_debug_msg(this.shadowRoot, e);
|
|
5146
|
+
}
|
|
5147
|
+
this.updatePending = false;
|
|
5148
|
+
return;
|
|
5141
5149
|
}
|
|
5142
5150
|
atcb_cleanup(this.shadowRoot, this.identifier);
|
|
5143
5151
|
await this.initButton();
|
|
@@ -5468,19 +5476,28 @@ async function atcb_action(inputData, triggerElement, keyboardTrigger = false) {
|
|
|
5468
5476
|
if (!atcbIsBrowser()) {
|
|
5469
5477
|
return;
|
|
5470
5478
|
}
|
|
5471
|
-
let data
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
cleanedInput
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
const proData = await atcb_get_pro_data(cleanedInput.proKey, null, cleanedInput);
|
|
5478
|
-
if (proData.name && proData.name != '') {
|
|
5479
|
-
return proData;
|
|
5479
|
+
let data;
|
|
5480
|
+
try {
|
|
5481
|
+
data = await (async function () {
|
|
5482
|
+
const cleanedInput = atcb_secure_content(inputData);
|
|
5483
|
+
if (cleanedInput.prokey && cleanedInput.prokey !== '') {
|
|
5484
|
+
cleanedInput.proKey = cleanedInput.prokey;
|
|
5480
5485
|
}
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5486
|
+
if (cleanedInput.proKey && cleanedInput.proKey !== '') {
|
|
5487
|
+
try {
|
|
5488
|
+
const proData = await atcb_get_pro_data(cleanedInput.proKey, null, cleanedInput);
|
|
5489
|
+
return proData;
|
|
5490
|
+
} catch (e) {
|
|
5491
|
+
throw new Error(e.message);
|
|
5492
|
+
}
|
|
5493
|
+
} else {
|
|
5494
|
+
return cleanedInput;
|
|
5495
|
+
}
|
|
5496
|
+
})();
|
|
5497
|
+
} catch (e) {
|
|
5498
|
+
console.error(e);
|
|
5499
|
+
return;
|
|
5500
|
+
}
|
|
5484
5501
|
data.debug = data.debug === 'true';
|
|
5485
5502
|
try {
|
|
5486
5503
|
await atcb_check_required(data);
|
|
@@ -5618,9 +5635,6 @@ async function atcb_get_pro_data(licenseKey, el = null, directData = {}) {
|
|
|
5618
5635
|
const response = await fetch((dataOverrides.dev ? 'https://event-dev.caldn.net/' : 'https://event.caldn.net/') + licenseKey + '/config.json');
|
|
5619
5636
|
if (response.ok) {
|
|
5620
5637
|
const data = await response.json();
|
|
5621
|
-
if (!data.name || data.name === '') {
|
|
5622
|
-
throw new Error('Not possible to read proKey config from server...');
|
|
5623
|
-
}
|
|
5624
5638
|
if (proOverride) {
|
|
5625
5639
|
atcbWcParams.forEach((key) => {
|
|
5626
5640
|
if (Object.prototype.hasOwnProperty.call(dataOverrides, key) && ['hideBranding', 'hidebranding', 'rsvp', 'ty'].indexOf(key) === -1) {
|
|
@@ -5634,13 +5648,16 @@ async function atcb_get_pro_data(licenseKey, el = null, directData = {}) {
|
|
|
5634
5648
|
}
|
|
5635
5649
|
});
|
|
5636
5650
|
}
|
|
5651
|
+
if (!data.name || data.name === '') {
|
|
5652
|
+
throw new Error('Not possible to read proKey config from server...');
|
|
5653
|
+
}
|
|
5637
5654
|
data.proKey = licenseKey;
|
|
5638
5655
|
data.identifier = licenseKey;
|
|
5639
5656
|
return data;
|
|
5640
5657
|
}
|
|
5641
5658
|
throw new Error('Not possible to read proKey config from server...');
|
|
5642
5659
|
} catch {
|
|
5643
|
-
|
|
5660
|
+
throw new Error('Add to Calendar Button proKey invalid or server not responding!');
|
|
5644
5661
|
}
|
|
5645
5662
|
}
|
|
5646
5663
|
return {};
|
package/dist/atcb-no-pro.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
|
}
|
|
@@ -3107,7 +3113,7 @@ function atcb_generate_subscribe_links(host, linkType, data, keyboardTrigger) {
|
|
|
3107
3113
|
atcb_subscribe_ical(data, data.icsFile);
|
|
3108
3114
|
break;
|
|
3109
3115
|
}
|
|
3110
|
-
atcb_subscribe_ical(data, adjustedFileUrl);
|
|
3116
|
+
atcb_subscribe_ical(data, adjustedFileUrl, host, keyboardTrigger);
|
|
3111
3117
|
break;
|
|
3112
3118
|
case 'google':
|
|
3113
3119
|
atcb_subscribe_google(data, adjustedFileUrl);
|
|
@@ -3176,7 +3182,11 @@ function atcb_set_fully_successful(host, data, multiDateModal = false) {
|
|
|
3176
3182
|
atcb_toggle(host, 'close');
|
|
3177
3183
|
}
|
|
3178
3184
|
}
|
|
3179
|
-
function atcb_subscribe_ical(data, fileUrl) {
|
|
3185
|
+
function atcb_subscribe_ical(data, fileUrl, host = null, keyboardTrigger = false) {
|
|
3186
|
+
if ((atcbIsiOS() || data.fakeIOS) && !atcbIsSafari()) {
|
|
3187
|
+
atcb_ical_copy_note(host, fileUrl, data, keyboardTrigger);
|
|
3188
|
+
return;
|
|
3189
|
+
}
|
|
3180
3190
|
atcb_open_cal_url(data, 'ical', fileUrl, true);
|
|
3181
3191
|
}
|
|
3182
3192
|
function atcb_subscribe_google(data, fileUrl) {
|
|
@@ -3501,7 +3511,7 @@ function atcb_generate_ical(host, data, subEvent = 'all', keyboardTrigger = fals
|
|
|
3501
3511
|
}
|
|
3502
3512
|
return 'data:text/calendar;charset=utf-8,' + encodeURIComponent(ics_lines.join('\r\n'));
|
|
3503
3513
|
})();
|
|
3504
|
-
if ((atcbIsiOS() && !atcbIsSafari()) || (atcbIsWebView() && (atcbIsiOS() || (atcbIsAndroid() && atcbIsProblematicWebView())))) {
|
|
3514
|
+
if (((atcbIsiOS() || data.fakeIOS) && !atcbIsSafari()) || (atcbIsWebView() && (atcbIsiOS() || data.fakeIOS || ((atcbIsAndroid() || data.fakeAndroid) && atcbIsProblematicWebView())))) {
|
|
3505
3515
|
atcb_ical_copy_note(host, dataUrl, data, keyboardTrigger);
|
|
3506
3516
|
return;
|
|
3507
3517
|
}
|
|
@@ -3527,7 +3537,7 @@ function atcb_determine_ical_filename(data, subEvent) {
|
|
|
3527
3537
|
}
|
|
3528
3538
|
function atcb_ical_copy_note(host, dataUrl, data, keyboardTrigger) {
|
|
3529
3539
|
atcb_copy_to_clipboard(dataUrl);
|
|
3530
|
-
if (atcbIsiOS() && !atcbIsSafari()) {
|
|
3540
|
+
if ((atcbIsiOS() || data.fakeIOS) && !atcbIsSafari()) {
|
|
3531
3541
|
atcb_create_modal(
|
|
3532
3542
|
host,
|
|
3533
3543
|
data,
|
|
@@ -5044,27 +5054,26 @@ if (atcbIsBrowser()) {
|
|
|
5044
5054
|
}
|
|
5045
5055
|
this.proOverride = !proOverrideVal || proOverrideVal === 'true' || proOverrideVal === '' ? true : false;
|
|
5046
5056
|
}
|
|
5047
|
-
|
|
5048
|
-
if (this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') {
|
|
5049
|
-
this.
|
|
5057
|
+
try {
|
|
5058
|
+
if ((this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') || (this.hasAttribute('prokey') && this.getAttribute('prokey') !== '')) {
|
|
5059
|
+
if (this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') {
|
|
5060
|
+
this.data = await atcb_get_pro_data(this.getAttribute('proKey'), this);
|
|
5061
|
+
} else {
|
|
5062
|
+
this.data = await atcb_get_pro_data(this.getAttribute('prokey'), this);
|
|
5063
|
+
}
|
|
5064
|
+
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
5050
5065
|
} else {
|
|
5051
|
-
this.data =
|
|
5052
|
-
}
|
|
5053
|
-
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
5054
|
-
}
|
|
5055
|
-
if (!this.data.name || this.data.name === '') {
|
|
5056
|
-
this.data.proKey = '';
|
|
5057
|
-
try {
|
|
5066
|
+
this.data.proKey = '';
|
|
5058
5067
|
this.data = await atcb_process_inline_data(this, this.debug);
|
|
5059
|
-
} catch (e) {
|
|
5060
|
-
if (this.debug) {
|
|
5061
|
-
console.error(e);
|
|
5062
|
-
atcb_render_debug_msg(this.shadowRoot, e);
|
|
5063
|
-
}
|
|
5064
|
-
this.state.initializing = false;
|
|
5065
|
-
this.state.ready = true;
|
|
5066
|
-
return;
|
|
5067
5068
|
}
|
|
5069
|
+
} catch (e) {
|
|
5070
|
+
if (this.debug) {
|
|
5071
|
+
console.error(e);
|
|
5072
|
+
atcb_render_debug_msg(this.shadowRoot, e);
|
|
5073
|
+
}
|
|
5074
|
+
this.state.initializing = false;
|
|
5075
|
+
this.state.ready = true;
|
|
5076
|
+
return;
|
|
5068
5077
|
}
|
|
5069
5078
|
await this.initButton();
|
|
5070
5079
|
this.state.initializing = false;
|
|
@@ -5119,24 +5128,23 @@ if (atcbIsBrowser()) {
|
|
|
5119
5128
|
const elem = document.createElement('template');
|
|
5120
5129
|
elem.innerHTML = template;
|
|
5121
5130
|
this.shadowRoot.append(elem.content.cloneNode(true));
|
|
5122
|
-
|
|
5123
|
-
this.
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
try {
|
|
5131
|
+
try {
|
|
5132
|
+
if (this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') {
|
|
5133
|
+
this.data = await atcb_get_pro_data(this.getAttribute('proKey'), this);
|
|
5134
|
+
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
5135
|
+
} else if (this.hasAttribute('prokey') && this.getAttribute('prokey') !== '') {
|
|
5136
|
+
this.data = await atcb_get_pro_data(this.getAttribute('prokey'), this);
|
|
5137
|
+
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
5138
|
+
} else {
|
|
5131
5139
|
this.data = await atcb_process_inline_data(this, this.debug);
|
|
5132
|
-
} catch (e) {
|
|
5133
|
-
if (this.debug) {
|
|
5134
|
-
console.error(e);
|
|
5135
|
-
atcb_render_debug_msg(this.shadowRoot, e);
|
|
5136
|
-
}
|
|
5137
|
-
this.updatePending = false;
|
|
5138
|
-
return;
|
|
5139
5140
|
}
|
|
5141
|
+
} catch (e) {
|
|
5142
|
+
if (this.debug) {
|
|
5143
|
+
console.error(e);
|
|
5144
|
+
atcb_render_debug_msg(this.shadowRoot, e);
|
|
5145
|
+
}
|
|
5146
|
+
this.updatePending = false;
|
|
5147
|
+
return;
|
|
5140
5148
|
}
|
|
5141
5149
|
atcb_cleanup(this.shadowRoot, this.identifier);
|
|
5142
5150
|
await this.initButton();
|
|
@@ -5467,19 +5475,28 @@ async function atcb_action(inputData, triggerElement, keyboardTrigger = false) {
|
|
|
5467
5475
|
if (!atcbIsBrowser()) {
|
|
5468
5476
|
return;
|
|
5469
5477
|
}
|
|
5470
|
-
let data
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
cleanedInput
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
const proData = await atcb_get_pro_data(cleanedInput.proKey, null, cleanedInput);
|
|
5477
|
-
if (proData.name && proData.name != '') {
|
|
5478
|
-
return proData;
|
|
5478
|
+
let data;
|
|
5479
|
+
try {
|
|
5480
|
+
data = await (async function () {
|
|
5481
|
+
const cleanedInput = atcb_secure_content(inputData);
|
|
5482
|
+
if (cleanedInput.prokey && cleanedInput.prokey !== '') {
|
|
5483
|
+
cleanedInput.proKey = cleanedInput.prokey;
|
|
5479
5484
|
}
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5485
|
+
if (cleanedInput.proKey && cleanedInput.proKey !== '') {
|
|
5486
|
+
try {
|
|
5487
|
+
const proData = await atcb_get_pro_data(cleanedInput.proKey, null, cleanedInput);
|
|
5488
|
+
return proData;
|
|
5489
|
+
} catch (e) {
|
|
5490
|
+
throw new Error(e.message);
|
|
5491
|
+
}
|
|
5492
|
+
} else {
|
|
5493
|
+
return cleanedInput;
|
|
5494
|
+
}
|
|
5495
|
+
})();
|
|
5496
|
+
} catch (e) {
|
|
5497
|
+
console.error(e);
|
|
5498
|
+
return;
|
|
5499
|
+
}
|
|
5483
5500
|
data.debug = data.debug === 'true';
|
|
5484
5501
|
try {
|
|
5485
5502
|
await atcb_check_required(data);
|
|
@@ -5617,9 +5634,6 @@ async function atcb_get_pro_data(licenseKey, el = null, directData = {}) {
|
|
|
5617
5634
|
const response = await fetch((dataOverrides.dev ? 'https://event-dev.caldn.net/' : 'https://event.caldn.net/') + licenseKey + '/config.json');
|
|
5618
5635
|
if (response.ok) {
|
|
5619
5636
|
const data = await response.json();
|
|
5620
|
-
if (!data.name || data.name === '') {
|
|
5621
|
-
throw new Error('Not possible to read proKey config from server...');
|
|
5622
|
-
}
|
|
5623
5637
|
if (proOverride) {
|
|
5624
5638
|
atcbWcParams.forEach((key) => {
|
|
5625
5639
|
if (Object.prototype.hasOwnProperty.call(dataOverrides, key) && ['hideBranding', 'hidebranding', 'rsvp', 'ty'].indexOf(key) === -1) {
|
|
@@ -5633,13 +5647,16 @@ async function atcb_get_pro_data(licenseKey, el = null, directData = {}) {
|
|
|
5633
5647
|
}
|
|
5634
5648
|
});
|
|
5635
5649
|
}
|
|
5650
|
+
if (!data.name || data.name === '') {
|
|
5651
|
+
throw new Error('Not possible to read proKey config from server...');
|
|
5652
|
+
}
|
|
5636
5653
|
data.proKey = licenseKey;
|
|
5637
5654
|
data.identifier = licenseKey;
|
|
5638
5655
|
return data;
|
|
5639
5656
|
}
|
|
5640
5657
|
throw new Error('Not possible to read proKey config from server...');
|
|
5641
5658
|
} catch {
|
|
5642
|
-
|
|
5659
|
+
throw new Error('Add to Calendar Button proKey invalid or server not responding!');
|
|
5643
5660
|
}
|
|
5644
5661
|
}
|
|
5645
5662
|
return {};
|