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
|
@@ -6,14 +6,14 @@ import { tzlib_get_ical_block, tzlib_get_offset, tzlib_get_timezones } from 'tim
|
|
|
6
6
|
* Add to Calendar Button
|
|
7
7
|
* ++++++++++++++++++++++
|
|
8
8
|
*
|
|
9
|
-
* Version: 2.
|
|
9
|
+
* Version: 2.7.0
|
|
10
10
|
* Creator: Jens Kuerschner (https://jekuer.com)
|
|
11
11
|
* Project: https://github.com/add2cal/add-to-calendar-button
|
|
12
12
|
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
|
|
13
13
|
* Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
|
|
14
14
|
*
|
|
15
15
|
*/
|
|
16
|
-
const atcbVersion = '2.
|
|
16
|
+
const atcbVersion = '2.7.0';
|
|
17
17
|
const atcbCssTemplate = {};
|
|
18
18
|
const atcbIsBrowser = () => {
|
|
19
19
|
if (typeof window === 'undefined') {
|
|
@@ -734,19 +734,25 @@ function atcb_decorate_data_button_status_handling(data) {
|
|
|
734
734
|
return data;
|
|
735
735
|
}
|
|
736
736
|
async function atcb_decorate_data_rsvp(data) {
|
|
737
|
-
if (typeof
|
|
737
|
+
if (typeof atcb_check_bookings !== 'function' || !data.rsvp || !data.proKey || Object.keys(data.rsvp).length === 0) return data;
|
|
738
738
|
data.rsvp.expired = (function () {
|
|
739
739
|
if (data.rsvp && data.rsvp.expires && new Date(data.rsvp.expires) < new Date()) {
|
|
740
740
|
return true;
|
|
741
741
|
}
|
|
742
742
|
return false;
|
|
743
743
|
})();
|
|
744
|
-
data.rsvp.
|
|
745
|
-
|
|
746
|
-
data.
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
744
|
+
if (data.rsvp.max) {
|
|
745
|
+
const bookings = await atcb_check_bookings(data.proKey, data.dev);
|
|
746
|
+
data.rsvp.seatsLeft = data.rsvp.max - bookings;
|
|
747
|
+
if (data.rsvp.seatsLeft < 1) {
|
|
748
|
+
data.rsvp.bookedOut = true;
|
|
749
|
+
}
|
|
750
|
+
if (data.rsvp.expired || data.rsvp.bookedOut) {
|
|
751
|
+
data.blockInteraction = true;
|
|
752
|
+
}
|
|
753
|
+
if (data.blockInteraction) {
|
|
754
|
+
data.disabled = true;
|
|
755
|
+
}
|
|
750
756
|
}
|
|
751
757
|
return data;
|
|
752
758
|
}
|
|
@@ -2140,7 +2146,7 @@ function atcb_generate_subscribe_links(host, linkType, data, keyboardTrigger) {
|
|
|
2140
2146
|
atcb_subscribe_ical(data, data.icsFile);
|
|
2141
2147
|
break;
|
|
2142
2148
|
}
|
|
2143
|
-
atcb_subscribe_ical(data, adjustedFileUrl);
|
|
2149
|
+
atcb_subscribe_ical(data, adjustedFileUrl, host, keyboardTrigger);
|
|
2144
2150
|
break;
|
|
2145
2151
|
case 'google':
|
|
2146
2152
|
atcb_subscribe_google(data, adjustedFileUrl);
|
|
@@ -2209,7 +2215,11 @@ function atcb_set_fully_successful(host, data, multiDateModal = false) {
|
|
|
2209
2215
|
atcb_toggle(host, 'close');
|
|
2210
2216
|
}
|
|
2211
2217
|
}
|
|
2212
|
-
function atcb_subscribe_ical(data, fileUrl) {
|
|
2218
|
+
function atcb_subscribe_ical(data, fileUrl, host = null, keyboardTrigger = false) {
|
|
2219
|
+
if ((atcbIsiOS() || data.fakeIOS) && !atcbIsSafari()) {
|
|
2220
|
+
atcb_ical_copy_note(host, fileUrl, data, keyboardTrigger);
|
|
2221
|
+
return;
|
|
2222
|
+
}
|
|
2213
2223
|
atcb_open_cal_url(data, 'ical', fileUrl, true);
|
|
2214
2224
|
}
|
|
2215
2225
|
function atcb_subscribe_google(data, fileUrl) {
|
|
@@ -2534,7 +2544,7 @@ function atcb_generate_ical(host, data, subEvent = 'all', keyboardTrigger = fals
|
|
|
2534
2544
|
}
|
|
2535
2545
|
return 'data:text/calendar;charset=utf-8,' + encodeURIComponent(ics_lines.join('\r\n'));
|
|
2536
2546
|
})();
|
|
2537
|
-
if ((atcbIsiOS() && !atcbIsSafari()) || (atcbIsWebView() && (atcbIsiOS() || (atcbIsAndroid() && atcbIsProblematicWebView())))) {
|
|
2547
|
+
if (((atcbIsiOS() || data.fakeIOS) && !atcbIsSafari()) || (atcbIsWebView() && (atcbIsiOS() || data.fakeIOS || ((atcbIsAndroid() || data.fakeAndroid) && atcbIsProblematicWebView())))) {
|
|
2538
2548
|
atcb_ical_copy_note(host, dataUrl, data, keyboardTrigger);
|
|
2539
2549
|
return;
|
|
2540
2550
|
}
|
|
@@ -2560,7 +2570,7 @@ function atcb_determine_ical_filename(data, subEvent) {
|
|
|
2560
2570
|
}
|
|
2561
2571
|
function atcb_ical_copy_note(host, dataUrl, data, keyboardTrigger) {
|
|
2562
2572
|
atcb_copy_to_clipboard(dataUrl);
|
|
2563
|
-
if (atcbIsiOS() && !atcbIsSafari()) {
|
|
2573
|
+
if ((atcbIsiOS() || data.fakeIOS) && !atcbIsSafari()) {
|
|
2564
2574
|
atcb_create_modal(
|
|
2565
2575
|
host,
|
|
2566
2576
|
data,
|
|
@@ -4077,27 +4087,26 @@ if (atcbIsBrowser()) {
|
|
|
4077
4087
|
}
|
|
4078
4088
|
this.proOverride = !proOverrideVal || proOverrideVal === 'true' || proOverrideVal === '' ? true : false;
|
|
4079
4089
|
}
|
|
4080
|
-
|
|
4081
|
-
if (this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') {
|
|
4082
|
-
this.
|
|
4090
|
+
try {
|
|
4091
|
+
if ((this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') || (this.hasAttribute('prokey') && this.getAttribute('prokey') !== '')) {
|
|
4092
|
+
if (this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') {
|
|
4093
|
+
this.data = await atcb_get_pro_data(this.getAttribute('proKey'), this);
|
|
4094
|
+
} else {
|
|
4095
|
+
this.data = await atcb_get_pro_data(this.getAttribute('prokey'), this);
|
|
4096
|
+
}
|
|
4097
|
+
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
4083
4098
|
} else {
|
|
4084
|
-
this.data =
|
|
4085
|
-
}
|
|
4086
|
-
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
4087
|
-
}
|
|
4088
|
-
if (!this.data.name || this.data.name === '') {
|
|
4089
|
-
this.data.proKey = '';
|
|
4090
|
-
try {
|
|
4099
|
+
this.data.proKey = '';
|
|
4091
4100
|
this.data = await atcb_process_inline_data(this, this.debug);
|
|
4092
|
-
} catch (e) {
|
|
4093
|
-
if (this.debug) {
|
|
4094
|
-
console.error(e);
|
|
4095
|
-
atcb_render_debug_msg(this.shadowRoot, e);
|
|
4096
|
-
}
|
|
4097
|
-
this.state.initializing = false;
|
|
4098
|
-
this.state.ready = true;
|
|
4099
|
-
return;
|
|
4100
4101
|
}
|
|
4102
|
+
} catch (e) {
|
|
4103
|
+
if (this.debug) {
|
|
4104
|
+
console.error(e);
|
|
4105
|
+
atcb_render_debug_msg(this.shadowRoot, e);
|
|
4106
|
+
}
|
|
4107
|
+
this.state.initializing = false;
|
|
4108
|
+
this.state.ready = true;
|
|
4109
|
+
return;
|
|
4101
4110
|
}
|
|
4102
4111
|
await this.initButton();
|
|
4103
4112
|
this.state.initializing = false;
|
|
@@ -4152,24 +4161,23 @@ if (atcbIsBrowser()) {
|
|
|
4152
4161
|
const elem = document.createElement('template');
|
|
4153
4162
|
elem.innerHTML = template;
|
|
4154
4163
|
this.shadowRoot.append(elem.content.cloneNode(true));
|
|
4155
|
-
|
|
4156
|
-
this.
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
try {
|
|
4164
|
+
try {
|
|
4165
|
+
if (this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') {
|
|
4166
|
+
this.data = await atcb_get_pro_data(this.getAttribute('proKey'), this);
|
|
4167
|
+
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
4168
|
+
} else if (this.hasAttribute('prokey') && this.getAttribute('prokey') !== '') {
|
|
4169
|
+
this.data = await atcb_get_pro_data(this.getAttribute('prokey'), this);
|
|
4170
|
+
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
4171
|
+
} else {
|
|
4164
4172
|
this.data = await atcb_process_inline_data(this, this.debug);
|
|
4165
|
-
} catch (e) {
|
|
4166
|
-
if (this.debug) {
|
|
4167
|
-
console.error(e);
|
|
4168
|
-
atcb_render_debug_msg(this.shadowRoot, e);
|
|
4169
|
-
}
|
|
4170
|
-
this.updatePending = false;
|
|
4171
|
-
return;
|
|
4172
4173
|
}
|
|
4174
|
+
} catch (e) {
|
|
4175
|
+
if (this.debug) {
|
|
4176
|
+
console.error(e);
|
|
4177
|
+
atcb_render_debug_msg(this.shadowRoot, e);
|
|
4178
|
+
}
|
|
4179
|
+
this.updatePending = false;
|
|
4180
|
+
return;
|
|
4173
4181
|
}
|
|
4174
4182
|
atcb_cleanup(this.shadowRoot, this.identifier);
|
|
4175
4183
|
await this.initButton();
|
|
@@ -4500,19 +4508,28 @@ async function atcb_action(inputData, triggerElement, keyboardTrigger = false) {
|
|
|
4500
4508
|
if (!atcbIsBrowser()) {
|
|
4501
4509
|
return;
|
|
4502
4510
|
}
|
|
4503
|
-
let data
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
cleanedInput
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
const proData = await atcb_get_pro_data(cleanedInput.proKey, null, cleanedInput);
|
|
4510
|
-
if (proData.name && proData.name != '') {
|
|
4511
|
-
return proData;
|
|
4511
|
+
let data;
|
|
4512
|
+
try {
|
|
4513
|
+
data = await (async function () {
|
|
4514
|
+
const cleanedInput = atcb_secure_content(inputData);
|
|
4515
|
+
if (cleanedInput.prokey && cleanedInput.prokey !== '') {
|
|
4516
|
+
cleanedInput.proKey = cleanedInput.prokey;
|
|
4512
4517
|
}
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4518
|
+
if (cleanedInput.proKey && cleanedInput.proKey !== '') {
|
|
4519
|
+
try {
|
|
4520
|
+
const proData = await atcb_get_pro_data(cleanedInput.proKey, null, cleanedInput);
|
|
4521
|
+
return proData;
|
|
4522
|
+
} catch (e) {
|
|
4523
|
+
throw new Error(e.message);
|
|
4524
|
+
}
|
|
4525
|
+
} else {
|
|
4526
|
+
return cleanedInput;
|
|
4527
|
+
}
|
|
4528
|
+
})();
|
|
4529
|
+
} catch (e) {
|
|
4530
|
+
console.error(e);
|
|
4531
|
+
return;
|
|
4532
|
+
}
|
|
4516
4533
|
data.debug = data.debug === 'true';
|
|
4517
4534
|
try {
|
|
4518
4535
|
await atcb_check_required(data);
|
|
@@ -4650,9 +4667,6 @@ async function atcb_get_pro_data(licenseKey, el = null, directData = {}) {
|
|
|
4650
4667
|
const response = await fetch((dataOverrides.dev ? 'https://event-dev.caldn.net/' : 'https://event.caldn.net/') + licenseKey + '/config.json');
|
|
4651
4668
|
if (response.ok) {
|
|
4652
4669
|
const data = await response.json();
|
|
4653
|
-
if (!data.name || data.name === '') {
|
|
4654
|
-
throw new Error('Not possible to read proKey config from server...');
|
|
4655
|
-
}
|
|
4656
4670
|
if (proOverride) {
|
|
4657
4671
|
atcbWcParams.forEach((key) => {
|
|
4658
4672
|
if (Object.prototype.hasOwnProperty.call(dataOverrides, key) && ['hideBranding', 'hidebranding', 'rsvp', 'ty'].indexOf(key) === -1) {
|
|
@@ -4666,13 +4680,16 @@ async function atcb_get_pro_data(licenseKey, el = null, directData = {}) {
|
|
|
4666
4680
|
}
|
|
4667
4681
|
});
|
|
4668
4682
|
}
|
|
4683
|
+
if (!data.name || data.name === '') {
|
|
4684
|
+
throw new Error('Not possible to read proKey config from server...');
|
|
4685
|
+
}
|
|
4669
4686
|
data.proKey = licenseKey;
|
|
4670
4687
|
data.identifier = licenseKey;
|
|
4671
4688
|
return data;
|
|
4672
4689
|
}
|
|
4673
4690
|
throw new Error('Not possible to read proKey config from server...');
|
|
4674
4691
|
} catch {
|
|
4675
|
-
|
|
4692
|
+
throw new Error('Add to Calendar Button proKey invalid or server not responding!');
|
|
4676
4693
|
}
|
|
4677
4694
|
}
|
|
4678
4695
|
return {};
|
|
@@ -6,14 +6,14 @@ import { tzlib_get_ical_block, tzlib_get_offset, tzlib_get_timezones } from 'tim
|
|
|
6
6
|
* Add to Calendar Button
|
|
7
7
|
* ++++++++++++++++++++++
|
|
8
8
|
*
|
|
9
|
-
* Version: 2.
|
|
9
|
+
* Version: 2.7.0
|
|
10
10
|
* Creator: Jens Kuerschner (https://jekuer.com)
|
|
11
11
|
* Project: https://github.com/add2cal/add-to-calendar-button
|
|
12
12
|
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
|
|
13
13
|
* Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
|
|
14
14
|
*
|
|
15
15
|
*/
|
|
16
|
-
const atcbVersion = '2.
|
|
16
|
+
const atcbVersion = '2.7.0';
|
|
17
17
|
const atcbCssTemplate = {};
|
|
18
18
|
const atcbIsBrowser = () => {
|
|
19
19
|
if (typeof window === 'undefined') {
|
|
@@ -734,19 +734,25 @@ function atcb_decorate_data_button_status_handling(data) {
|
|
|
734
734
|
return data;
|
|
735
735
|
}
|
|
736
736
|
async function atcb_decorate_data_rsvp(data) {
|
|
737
|
-
if (typeof
|
|
737
|
+
if (typeof atcb_check_bookings !== 'function' || !data.rsvp || !data.proKey || Object.keys(data.rsvp).length === 0) return data;
|
|
738
738
|
data.rsvp.expired = (function () {
|
|
739
739
|
if (data.rsvp && data.rsvp.expires && new Date(data.rsvp.expires) < new Date()) {
|
|
740
740
|
return true;
|
|
741
741
|
}
|
|
742
742
|
return false;
|
|
743
743
|
})();
|
|
744
|
-
data.rsvp.
|
|
745
|
-
|
|
746
|
-
data.
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
744
|
+
if (data.rsvp.max) {
|
|
745
|
+
const bookings = await atcb_check_bookings(data.proKey, data.dev);
|
|
746
|
+
data.rsvp.seatsLeft = data.rsvp.max - bookings;
|
|
747
|
+
if (data.rsvp.seatsLeft < 1) {
|
|
748
|
+
data.rsvp.bookedOut = true;
|
|
749
|
+
}
|
|
750
|
+
if (data.rsvp.expired || data.rsvp.bookedOut) {
|
|
751
|
+
data.blockInteraction = true;
|
|
752
|
+
}
|
|
753
|
+
if (data.blockInteraction) {
|
|
754
|
+
data.disabled = true;
|
|
755
|
+
}
|
|
750
756
|
}
|
|
751
757
|
return data;
|
|
752
758
|
}
|
|
@@ -1485,6 +1491,9 @@ async function atcb_generate_rsvp_form(host, data, hostEl, keyboardTrigger = fal
|
|
|
1485
1491
|
' class="atcb-modal-btn atcb-modal-btn-primary atcb-modal-btn-border">' +
|
|
1486
1492
|
atcb_translate_hook('submit', data) +
|
|
1487
1493
|
'</button><span id="pro-form-submitting" class="pro-waiting"><span>.</span><span>.</span><span>.</span></span></p>';
|
|
1494
|
+
if (rsvpData.seatsLeft && rsvpData.seatsLeft > 0) {
|
|
1495
|
+
rsvpContent += '<p class="pro-form-fine">' + atcb_translate_hook('form.seatsleft', data) + ': <b>' + rsvpData.seatsLeft + '</b></p>';
|
|
1496
|
+
}
|
|
1488
1497
|
rsvpContent += '</form>';
|
|
1489
1498
|
rsvpContent += '</div></div>';
|
|
1490
1499
|
let rsvpHost = null;
|
|
@@ -1724,24 +1733,20 @@ async function atcb_generate_rsvp_button(host, data) {
|
|
|
1724
1733
|
}
|
|
1725
1734
|
return true;
|
|
1726
1735
|
}
|
|
1727
|
-
async function
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
throw new Error('Network response was not ok');
|
|
1735
|
-
}
|
|
1736
|
-
const responseJson = await response.json();
|
|
1737
|
-
if (parseInt(responseJson.total) >= data.rsvp.max) {
|
|
1738
|
-
return true;
|
|
1739
|
-
}
|
|
1740
|
-
} catch (error) {
|
|
1741
|
-
console.error('Error:', error);
|
|
1736
|
+
async function atcb_check_bookings(proKey, dev = false) {
|
|
1737
|
+
try {
|
|
1738
|
+
const response = await fetch('https://api.add-to-calendar-pro.com/dffb8bbd-ee5e-4a4f-a7ea-503af98ca468?prokey=' + proKey + (dev ? '&dev=true' : ''), {
|
|
1739
|
+
method: 'GET',
|
|
1740
|
+
});
|
|
1741
|
+
if (!response.ok) {
|
|
1742
|
+
throw new Error('Network response was not ok');
|
|
1742
1743
|
}
|
|
1744
|
+
const responseJson = await response.json();
|
|
1745
|
+
return parseInt(responseJson.total);
|
|
1746
|
+
} catch (error) {
|
|
1747
|
+
console.error('Error:', error);
|
|
1743
1748
|
}
|
|
1744
|
-
return
|
|
1749
|
+
return 0;
|
|
1745
1750
|
}
|
|
1746
1751
|
function atcb_build_form(fields, identifier = '', disabled = false) {
|
|
1747
1752
|
/*!
|
|
@@ -2861,7 +2866,7 @@ function atcb_generate_subscribe_links(host, linkType, data, keyboardTrigger) {
|
|
|
2861
2866
|
atcb_subscribe_ical(data, data.icsFile);
|
|
2862
2867
|
break;
|
|
2863
2868
|
}
|
|
2864
|
-
atcb_subscribe_ical(data, adjustedFileUrl);
|
|
2869
|
+
atcb_subscribe_ical(data, adjustedFileUrl, host, keyboardTrigger);
|
|
2865
2870
|
break;
|
|
2866
2871
|
case 'google':
|
|
2867
2872
|
atcb_subscribe_google(data, adjustedFileUrl);
|
|
@@ -2930,7 +2935,11 @@ function atcb_set_fully_successful(host, data, multiDateModal = false) {
|
|
|
2930
2935
|
atcb_toggle(host, 'close');
|
|
2931
2936
|
}
|
|
2932
2937
|
}
|
|
2933
|
-
function atcb_subscribe_ical(data, fileUrl) {
|
|
2938
|
+
function atcb_subscribe_ical(data, fileUrl, host = null, keyboardTrigger = false) {
|
|
2939
|
+
if ((atcbIsiOS() || data.fakeIOS) && !atcbIsSafari()) {
|
|
2940
|
+
atcb_ical_copy_note(host, fileUrl, data, keyboardTrigger);
|
|
2941
|
+
return;
|
|
2942
|
+
}
|
|
2934
2943
|
atcb_open_cal_url(data, 'ical', fileUrl, true);
|
|
2935
2944
|
}
|
|
2936
2945
|
function atcb_subscribe_google(data, fileUrl) {
|
|
@@ -3255,7 +3264,7 @@ function atcb_generate_ical(host, data, subEvent = 'all', keyboardTrigger = fals
|
|
|
3255
3264
|
}
|
|
3256
3265
|
return 'data:text/calendar;charset=utf-8,' + encodeURIComponent(ics_lines.join('\r\n'));
|
|
3257
3266
|
})();
|
|
3258
|
-
if ((atcbIsiOS() && !atcbIsSafari()) || (atcbIsWebView() && (atcbIsiOS() || (atcbIsAndroid() && atcbIsProblematicWebView())))) {
|
|
3267
|
+
if (((atcbIsiOS() || data.fakeIOS) && !atcbIsSafari()) || (atcbIsWebView() && (atcbIsiOS() || data.fakeIOS || ((atcbIsAndroid() || data.fakeAndroid) && atcbIsProblematicWebView())))) {
|
|
3259
3268
|
atcb_ical_copy_note(host, dataUrl, data, keyboardTrigger);
|
|
3260
3269
|
return;
|
|
3261
3270
|
}
|
|
@@ -3281,7 +3290,7 @@ function atcb_determine_ical_filename(data, subEvent) {
|
|
|
3281
3290
|
}
|
|
3282
3291
|
function atcb_ical_copy_note(host, dataUrl, data, keyboardTrigger) {
|
|
3283
3292
|
atcb_copy_to_clipboard(dataUrl);
|
|
3284
|
-
if (atcbIsiOS() && !atcbIsSafari()) {
|
|
3293
|
+
if ((atcbIsiOS() || data.fakeIOS) && !atcbIsSafari()) {
|
|
3285
3294
|
atcb_create_modal(
|
|
3286
3295
|
host,
|
|
3287
3296
|
data,
|
|
@@ -4798,27 +4807,26 @@ if (atcbIsBrowser()) {
|
|
|
4798
4807
|
}
|
|
4799
4808
|
this.proOverride = !proOverrideVal || proOverrideVal === 'true' || proOverrideVal === '' ? true : false;
|
|
4800
4809
|
}
|
|
4801
|
-
|
|
4802
|
-
if (this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') {
|
|
4803
|
-
this.
|
|
4810
|
+
try {
|
|
4811
|
+
if ((this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') || (this.hasAttribute('prokey') && this.getAttribute('prokey') !== '')) {
|
|
4812
|
+
if (this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') {
|
|
4813
|
+
this.data = await atcb_get_pro_data(this.getAttribute('proKey'), this);
|
|
4814
|
+
} else {
|
|
4815
|
+
this.data = await atcb_get_pro_data(this.getAttribute('prokey'), this);
|
|
4816
|
+
}
|
|
4817
|
+
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
4804
4818
|
} else {
|
|
4805
|
-
this.data =
|
|
4806
|
-
}
|
|
4807
|
-
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
4808
|
-
}
|
|
4809
|
-
if (!this.data.name || this.data.name === '') {
|
|
4810
|
-
this.data.proKey = '';
|
|
4811
|
-
try {
|
|
4819
|
+
this.data.proKey = '';
|
|
4812
4820
|
this.data = await atcb_process_inline_data(this, this.debug);
|
|
4813
|
-
} catch (e) {
|
|
4814
|
-
if (this.debug) {
|
|
4815
|
-
console.error(e);
|
|
4816
|
-
atcb_render_debug_msg(this.shadowRoot, e);
|
|
4817
|
-
}
|
|
4818
|
-
this.state.initializing = false;
|
|
4819
|
-
this.state.ready = true;
|
|
4820
|
-
return;
|
|
4821
4821
|
}
|
|
4822
|
+
} catch (e) {
|
|
4823
|
+
if (this.debug) {
|
|
4824
|
+
console.error(e);
|
|
4825
|
+
atcb_render_debug_msg(this.shadowRoot, e);
|
|
4826
|
+
}
|
|
4827
|
+
this.state.initializing = false;
|
|
4828
|
+
this.state.ready = true;
|
|
4829
|
+
return;
|
|
4822
4830
|
}
|
|
4823
4831
|
await this.initButton();
|
|
4824
4832
|
this.state.initializing = false;
|
|
@@ -4873,24 +4881,23 @@ if (atcbIsBrowser()) {
|
|
|
4873
4881
|
const elem = document.createElement('template');
|
|
4874
4882
|
elem.innerHTML = template;
|
|
4875
4883
|
this.shadowRoot.append(elem.content.cloneNode(true));
|
|
4876
|
-
|
|
4877
|
-
this.
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
try {
|
|
4884
|
+
try {
|
|
4885
|
+
if (this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') {
|
|
4886
|
+
this.data = await atcb_get_pro_data(this.getAttribute('proKey'), this);
|
|
4887
|
+
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
4888
|
+
} else if (this.hasAttribute('prokey') && this.getAttribute('prokey') !== '') {
|
|
4889
|
+
this.data = await atcb_get_pro_data(this.getAttribute('prokey'), this);
|
|
4890
|
+
if (this.data.proKey) this.proKey = this.data.proKey;
|
|
4891
|
+
} else {
|
|
4885
4892
|
this.data = await atcb_process_inline_data(this, this.debug);
|
|
4886
|
-
} catch (e) {
|
|
4887
|
-
if (this.debug) {
|
|
4888
|
-
console.error(e);
|
|
4889
|
-
atcb_render_debug_msg(this.shadowRoot, e);
|
|
4890
|
-
}
|
|
4891
|
-
this.updatePending = false;
|
|
4892
|
-
return;
|
|
4893
4893
|
}
|
|
4894
|
+
} catch (e) {
|
|
4895
|
+
if (this.debug) {
|
|
4896
|
+
console.error(e);
|
|
4897
|
+
atcb_render_debug_msg(this.shadowRoot, e);
|
|
4898
|
+
}
|
|
4899
|
+
this.updatePending = false;
|
|
4900
|
+
return;
|
|
4894
4901
|
}
|
|
4895
4902
|
atcb_cleanup(this.shadowRoot, this.identifier);
|
|
4896
4903
|
await this.initButton();
|
|
@@ -5221,19 +5228,28 @@ async function atcb_action(inputData, triggerElement, keyboardTrigger = false) {
|
|
|
5221
5228
|
if (!atcbIsBrowser()) {
|
|
5222
5229
|
return;
|
|
5223
5230
|
}
|
|
5224
|
-
let data
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
cleanedInput
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
const proData = await atcb_get_pro_data(cleanedInput.proKey, null, cleanedInput);
|
|
5231
|
-
if (proData.name && proData.name != '') {
|
|
5232
|
-
return proData;
|
|
5231
|
+
let data;
|
|
5232
|
+
try {
|
|
5233
|
+
data = await (async function () {
|
|
5234
|
+
const cleanedInput = atcb_secure_content(inputData);
|
|
5235
|
+
if (cleanedInput.prokey && cleanedInput.prokey !== '') {
|
|
5236
|
+
cleanedInput.proKey = cleanedInput.prokey;
|
|
5233
5237
|
}
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5238
|
+
if (cleanedInput.proKey && cleanedInput.proKey !== '') {
|
|
5239
|
+
try {
|
|
5240
|
+
const proData = await atcb_get_pro_data(cleanedInput.proKey, null, cleanedInput);
|
|
5241
|
+
return proData;
|
|
5242
|
+
} catch (e) {
|
|
5243
|
+
throw new Error(e.message);
|
|
5244
|
+
}
|
|
5245
|
+
} else {
|
|
5246
|
+
return cleanedInput;
|
|
5247
|
+
}
|
|
5248
|
+
})();
|
|
5249
|
+
} catch (e) {
|
|
5250
|
+
console.error(e);
|
|
5251
|
+
return;
|
|
5252
|
+
}
|
|
5237
5253
|
data.debug = data.debug === 'true';
|
|
5238
5254
|
try {
|
|
5239
5255
|
await atcb_check_required(data);
|
|
@@ -5371,9 +5387,6 @@ async function atcb_get_pro_data(licenseKey, el = null, directData = {}) {
|
|
|
5371
5387
|
const response = await fetch((dataOverrides.dev ? 'https://event-dev.caldn.net/' : 'https://event.caldn.net/') + licenseKey + '/config.json');
|
|
5372
5388
|
if (response.ok) {
|
|
5373
5389
|
const data = await response.json();
|
|
5374
|
-
if (!data.name || data.name === '') {
|
|
5375
|
-
throw new Error('Not possible to read proKey config from server...');
|
|
5376
|
-
}
|
|
5377
5390
|
if (proOverride) {
|
|
5378
5391
|
atcbWcParams.forEach((key) => {
|
|
5379
5392
|
if (Object.prototype.hasOwnProperty.call(dataOverrides, key) && ['hideBranding', 'hidebranding', 'rsvp', 'ty'].indexOf(key) === -1) {
|
|
@@ -5387,13 +5400,16 @@ async function atcb_get_pro_data(licenseKey, el = null, directData = {}) {
|
|
|
5387
5400
|
}
|
|
5388
5401
|
});
|
|
5389
5402
|
}
|
|
5403
|
+
if (!data.name || data.name === '') {
|
|
5404
|
+
throw new Error('Not possible to read proKey config from server...');
|
|
5405
|
+
}
|
|
5390
5406
|
data.proKey = licenseKey;
|
|
5391
5407
|
data.identifier = licenseKey;
|
|
5392
5408
|
return data;
|
|
5393
5409
|
}
|
|
5394
5410
|
throw new Error('Not possible to read proKey config from server...');
|
|
5395
5411
|
} catch {
|
|
5396
|
-
|
|
5412
|
+
throw new Error('Add to Calendar Button proKey invalid or server not responding!');
|
|
5397
5413
|
}
|
|
5398
5414
|
}
|
|
5399
5415
|
return {};
|