@carbon/ibmdotcom-web-components 2.35.0 → 2.37.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/custom-elements.json +39 -2
- package/dist/dotcom-shell.js +2 -2
- package/dist/dotcom-shell.min.js +6 -6
- package/dist/ibmdotcom-web-components-dotcom-shell.js +2 -2
- package/dist/ibmdotcom-web-components-dotcom-shell.min.js +6 -6
- package/dist/{index-4046820a.js → index-101ff4ff.js} +12 -7
- package/dist/{index-ccf47ae7.js → index-2da0cc10.js} +11 -11
- package/dist/{left-nav-menu-1778be74.js → left-nav-menu-059f3af6.js} +6 -6
- package/dist/{left-nav-menu-eceb36da.js → left-nav-menu-b2f279ad.js} +2 -2
- package/dist/{left-nav-menu-category-heading-b23d7129.js → left-nav-menu-category-heading-bbfe009a.js} +2 -2
- package/dist/{left-nav-menu-category-heading-9939b780.js → left-nav-menu-category-heading-cf9ef07e.js} +6 -6
- package/dist/{left-nav-menu-item-a5470d1f.js → left-nav-menu-item-370599e1.js} +6 -6
- package/dist/{left-nav-menu-item-0f079ba8.js → left-nav-menu-item-b0a3ffe3.js} +2 -2
- package/dist/{left-nav-menu-section-e142e371.js → left-nav-menu-section-5c3ef339.js} +6 -6
- package/dist/{left-nav-menu-section-721d4f30.js → left-nav-menu-section-bce62276.js} +2 -2
- package/dist/{left-nav-overlay-6e6a4779.js → left-nav-overlay-085cef80.js} +6 -6
- package/dist/{left-nav-overlay-14c5100d.js → left-nav-overlay-43d30c63.js} +2 -2
- package/dist/{megamenu-category-group-4dbf5c33.js → megamenu-category-group-7e1d5b50.js} +6 -6
- package/dist/{megamenu-category-group-copy-8951122b.js → megamenu-category-group-copy-02002b03.js} +2 -2
- package/dist/{megamenu-category-group-copy-849df575.js → megamenu-category-group-copy-9f4f3d0e.js} +6 -6
- package/dist/{megamenu-category-group-5221cc32.js → megamenu-category-group-d512f668.js} +2 -2
- package/dist/{megamenu-category-heading-a1268cb2.js → megamenu-category-heading-4b0206af.js} +2 -2
- package/dist/{megamenu-category-heading-b2fe8c9d.js → megamenu-category-heading-5dc7ff0d.js} +6 -6
- package/dist/{megamenu-category-link-356bdb9e.js → megamenu-category-link-25ce7627.js} +10 -10
- package/dist/{megamenu-category-link-bfc83216.js → megamenu-category-link-d22be130.js} +2 -2
- package/dist/{megamenu-category-link-group-1b78b889.js → megamenu-category-link-group-5cf9cfa0.js} +6 -6
- package/dist/{megamenu-category-link-group-378d3822.js → megamenu-category-link-group-eda19d19.js} +2 -2
- package/dist/{megamenu-left-navigation-0570753a.js → megamenu-left-navigation-3627e4a7.js} +2 -2
- package/dist/{megamenu-left-navigation-9b9eb85d.js → megamenu-left-navigation-858ca04c.js} +6 -6
- package/dist/{megamenu-overlay-6696988b.js → megamenu-overlay-1005eee4.js} +6 -6
- package/dist/{megamenu-overlay-ea82d047.js → megamenu-overlay-26c4d654.js} +2 -2
- package/dist/{megamenu-tab-d7b95e9c.js → megamenu-tab-85782854.js} +2 -2
- package/dist/{megamenu-tab-f1e08b5e.js → megamenu-tab-e03e6e58.js} +6 -6
- package/es/components/leadspace/leadspace.css.js +1 -1
- package/es/components/masthead/masthead-menu-button.js +1 -1
- package/es/components/masthead/masthead-menu-button.js.map +1 -1
- package/es/components/masthead/masthead.css.js +1 -1
- package/es/components/notice-choice/notice-choice.d.ts +23 -17
- package/es/components/notice-choice/notice-choice.js +335 -203
- package/es/components/notice-choice/notice-choice.js.map +1 -1
- package/es/components/notice-choice/utils.d.ts +6 -0
- package/es/components/notice-choice/utils.js +33 -0
- package/es/components/notice-choice/utils.js.map +1 -1
- package/es/components/pricing-table/pricing-table.d.ts +1 -1
- package/es/components/pricing-table/pricing-table.js +4 -9
- package/es/components/pricing-table/pricing-table.js.map +1 -1
- package/es/internal/vendor/@carbon/ibmdotcom-services/services/Translation/Translation.js +5 -0
- package/es/internal/vendor/@carbon/ibmdotcom-utilities/utilities/settings/settings.js +2 -2
- package/lib/internal/vendor/@carbon/ibmdotcom-services/services/Translation/Translation.js +5 -0
- package/lib/internal/vendor/@carbon/ibmdotcom-utilities/utilities/settings/settings.js +2 -2
- package/package.json +5 -5
- package/scss/components/masthead/masthead.scss +52 -0
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
2
2
|
import _decorate from "@babel/runtime/helpers/esm/decorate";
|
|
3
3
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
4
4
|
import _get from "@babel/runtime/helpers/esm/get";
|
|
5
|
-
let
|
|
5
|
+
let _2 = t => t,
|
|
6
6
|
_t,
|
|
7
7
|
_t2,
|
|
8
8
|
_t3,
|
|
@@ -26,25 +26,18 @@ function _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prot
|
|
|
26
26
|
*
|
|
27
27
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
28
28
|
* LICENSE file in the root directory of this source tree.
|
|
29
|
-
*/
|
|
30
|
-
* @license
|
|
31
|
-
*
|
|
32
|
-
* Copyright IBM Corp. 2020, 2024
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
35
|
-
* LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/
|
|
29
|
+
*/
|
|
37
30
|
|
|
38
|
-
import { loadContent, loadSettings, checkEmailStatus } from "./services.js";
|
|
39
31
|
import { html, LitElement } from 'lit';
|
|
40
32
|
import { property } from 'lit/decorators.js';
|
|
41
|
-
import { pwsValueMap, resetToWorldWideContent } from "./utils.js";
|
|
42
|
-
import settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';
|
|
43
33
|
import StableSelectorMixin from "../../globals/mixins/stable-selector.js";
|
|
44
|
-
import styles from "././notice-choice.css.js";
|
|
45
|
-
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
46
34
|
import { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';
|
|
47
35
|
import '@carbon/web-components/es/components/skeleton-text/index.js';
|
|
36
|
+
import settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';
|
|
37
|
+
import { pwsValueMap, processCustomText, resetToWorldWideContent } from "./utils.js";
|
|
38
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
39
|
+
import { loadContent, loadSettings, checkEmailStatus } from "./services.js";
|
|
40
|
+
import styles from "././notice-choice.css.js";
|
|
48
41
|
const {
|
|
49
42
|
prefix,
|
|
50
43
|
stablePrefix: c4dPrefix
|
|
@@ -134,7 +127,7 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
134
127
|
})],
|
|
135
128
|
key: "termsConditionLink",
|
|
136
129
|
value() {
|
|
137
|
-
return html(_t || (_t =
|
|
130
|
+
return html(_t || (_t = _2``));
|
|
138
131
|
}
|
|
139
132
|
}, {
|
|
140
133
|
kind: "field",
|
|
@@ -166,6 +159,26 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
166
159
|
value() {
|
|
167
160
|
return 'prod';
|
|
168
161
|
}
|
|
162
|
+
}, {
|
|
163
|
+
kind: "field",
|
|
164
|
+
decorators: [property({
|
|
165
|
+
type: String,
|
|
166
|
+
attribute: 'show-custom-notice-text'
|
|
167
|
+
})],
|
|
168
|
+
key: "showCustomNotice",
|
|
169
|
+
value() {
|
|
170
|
+
return 'false';
|
|
171
|
+
}
|
|
172
|
+
}, {
|
|
173
|
+
kind: "field",
|
|
174
|
+
decorators: [property({
|
|
175
|
+
type: String,
|
|
176
|
+
attribute: 'custom-notice-text'
|
|
177
|
+
})],
|
|
178
|
+
key: "customNoticeText",
|
|
179
|
+
value() {
|
|
180
|
+
return '';
|
|
181
|
+
}
|
|
169
182
|
}, {
|
|
170
183
|
kind: "field",
|
|
171
184
|
decorators: [property({
|
|
@@ -330,7 +343,7 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
330
343
|
})],
|
|
331
344
|
key: "preText",
|
|
332
345
|
value() {
|
|
333
|
-
return html(_t2 || (_t2 =
|
|
346
|
+
return html(_t2 || (_t2 = _2``));
|
|
334
347
|
}
|
|
335
348
|
}, {
|
|
336
349
|
kind: "field",
|
|
@@ -340,7 +353,27 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
340
353
|
})],
|
|
341
354
|
key: "defaultPreText",
|
|
342
355
|
value() {
|
|
343
|
-
return html(_t3 || (_t3 =
|
|
356
|
+
return html(_t3 || (_t3 = _2``));
|
|
357
|
+
}
|
|
358
|
+
}, {
|
|
359
|
+
kind: "field",
|
|
360
|
+
decorators: [property({
|
|
361
|
+
type: Array,
|
|
362
|
+
attribute: false
|
|
363
|
+
})],
|
|
364
|
+
key: "doubleOptInCountries",
|
|
365
|
+
value() {
|
|
366
|
+
return [];
|
|
367
|
+
}
|
|
368
|
+
}, {
|
|
369
|
+
kind: "field",
|
|
370
|
+
decorators: [property({
|
|
371
|
+
type: Boolean,
|
|
372
|
+
attribute: false
|
|
373
|
+
})],
|
|
374
|
+
key: "isOriginalTextChanged",
|
|
375
|
+
value() {
|
|
376
|
+
return false;
|
|
344
377
|
}
|
|
345
378
|
}, {
|
|
346
379
|
kind: "field",
|
|
@@ -400,6 +433,24 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
400
433
|
value() {
|
|
401
434
|
return {};
|
|
402
435
|
}
|
|
436
|
+
}, {
|
|
437
|
+
kind: "field",
|
|
438
|
+
decorators: [property({
|
|
439
|
+
type: Object,
|
|
440
|
+
attribute: false
|
|
441
|
+
})],
|
|
442
|
+
key: "customNoticeTextValue",
|
|
443
|
+
value() {
|
|
444
|
+
return {
|
|
445
|
+
text: ''
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
}, {
|
|
449
|
+
kind: "field",
|
|
450
|
+
key: "pwsFieldsMap",
|
|
451
|
+
value() {
|
|
452
|
+
return new Map([['NC_HIDDEN_EMAIL', 'permission_email'], ['NC_HIDDEN_PHONE', 'permission_phone'], ['preventFormSubmission', 'preventFormSubmission'], ['Q_CHINA_PIPL', 'Q_CHINA_PIPL'], ['Q_COUNTRY_TRANSFER', 'Q_COUNTRY_TRANSFER'], ['NC_HIDDEN_EMAIL_VALUE', 'NC_HIDDEN_EMAIL'], ['NC_HIDDEN_PHONE_VALUE', 'NC_HIDDEN_PHONE'], ['EMAIL_CU', 'EMAIL_CU'], ['EMAIL_CC', 'EMAIL_CC'], ['EMAIL_UC', 'EMAIL_UC'], ['EMAIL_UU', 'EMAIL_UU'], ['PHONE_CU', 'PHONE_CU'], ['PHONE_CC', 'PHONE_CC'], ['PHONE_UC', 'PHONE_UC'], ['PHONE_UU', 'PHONE_UU'], ['EMAIL_NOTICE_ONLY', 'EMAIL_NOTICE_ONLY'], ['PHONE_NOTICE_ONLY', 'PHONE_NOTICE_ONLY'], ['NC_HIDDEN_PHONE_NONE', 'NC_HIDDEN_PHONE_NONE']]);
|
|
453
|
+
}
|
|
403
454
|
}, {
|
|
404
455
|
kind: "method",
|
|
405
456
|
key: "connectedCallback",
|
|
@@ -441,55 +492,16 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
441
492
|
changedProps.forEach((oldValue, propName) => {
|
|
442
493
|
const newValue = this[propName];
|
|
443
494
|
const hasValue = newValue !== undefined && newValue !== null;
|
|
495
|
+
console.log('updated', propName, newValue, hasValue, oldValue);
|
|
444
496
|
this._dispatchChange(propName, newValue, hasValue, oldValue);
|
|
445
497
|
});
|
|
446
498
|
}
|
|
447
499
|
}, {
|
|
448
500
|
kind: "method",
|
|
449
|
-
key: "
|
|
450
|
-
value: function
|
|
451
|
-
|
|
452
|
-
this.
|
|
453
|
-
if (hasValue && typeof value === 'string' && value.trim() && oldValue !== value && emailRegex.test(value.trim())) {
|
|
454
|
-
this.email = value.trim();
|
|
455
|
-
this.onEmailChange();
|
|
456
|
-
} else {
|
|
457
|
-
this.showCheckBox = false;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
}, {
|
|
461
|
-
kind: "method",
|
|
462
|
-
key: "loadContentWithFallback",
|
|
463
|
-
value: function loadContentWithFallback(lang) {
|
|
464
|
-
loadContent(lang, this.environment, ncData => {
|
|
465
|
-
this.isLoading = false;
|
|
466
|
-
this.ncData = ncData;
|
|
467
|
-
this.prepareCheckboxes();
|
|
468
|
-
}, () => this.defaultLoadContent());
|
|
469
|
-
}
|
|
470
|
-
}, {
|
|
471
|
-
kind: "method",
|
|
472
|
-
key: "handleLanguageOrEnvironmentChange",
|
|
473
|
-
value: function handleLanguageOrEnvironmentChange(value) {
|
|
474
|
-
var _this$language;
|
|
475
|
-
if (['stage', 'prod'].includes(value)) {
|
|
476
|
-
this.environment = value;
|
|
477
|
-
} else {
|
|
478
|
-
this.language = value;
|
|
479
|
-
}
|
|
480
|
-
const langPart = (_this$language = this.language) === null || _this$language === void 0 ? void 0 : _this$language.split(/[-_]/)[0];
|
|
481
|
-
this.isLoading = true;
|
|
482
|
-
loadSettings(this.environment, settings => {
|
|
483
|
-
var _this$language2;
|
|
484
|
-
this.countrySettings = settings.preferences;
|
|
485
|
-
this.noticeOnly = settings.noticeOnly || ['us'];
|
|
486
|
-
this.supportedLanguages = settings.supportedLanguages || {};
|
|
487
|
-
const supportedLang = this.supportedLanguages[((_this$language2 = this.language) === null || _this$language2 === void 0 ? void 0 : _this$language2.toLowerCase()) || ''] || langPart && this.supportedLanguages[langPart.toLowerCase()] || 'en';
|
|
488
|
-
this.loadContentWithFallback(supportedLang);
|
|
489
|
-
}, err => {
|
|
490
|
-
console.error('Error loading settings', err);
|
|
491
|
-
this.loadContentWithFallback('en');
|
|
492
|
-
});
|
|
501
|
+
key: "countryChanged",
|
|
502
|
+
value: function countryChanged() {
|
|
503
|
+
resetToWorldWideContent();
|
|
504
|
+
this.countryChangeAction();
|
|
493
505
|
}
|
|
494
506
|
}, {
|
|
495
507
|
kind: "method",
|
|
@@ -526,10 +538,81 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
526
538
|
case 'email':
|
|
527
539
|
this.handleEmailChange(value, oldValue, hasValue);
|
|
528
540
|
return;
|
|
541
|
+
case 'customNoticeText':
|
|
542
|
+
{
|
|
543
|
+
if (oldValue === value) {
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
console.log(value, typeof value);
|
|
547
|
+
this.customNoticeTextValue = this.parseCustomNoticeText(value);
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
case 'showCustomNotice':
|
|
551
|
+
if (oldValue !== value && typeof value === 'string') {
|
|
552
|
+
this.showCustomNotice = JSON.parse(value) || false;
|
|
553
|
+
}
|
|
554
|
+
return;
|
|
529
555
|
default:
|
|
530
556
|
return;
|
|
531
557
|
}
|
|
532
558
|
}
|
|
559
|
+
}, {
|
|
560
|
+
kind: "method",
|
|
561
|
+
key: "htmlDecode",
|
|
562
|
+
value: function htmlDecode(text) {
|
|
563
|
+
const textarea = document.createElement('textarea');
|
|
564
|
+
textarea.innerHTML = text;
|
|
565
|
+
return textarea.value;
|
|
566
|
+
}
|
|
567
|
+
}, {
|
|
568
|
+
kind: "method",
|
|
569
|
+
key: "tryParseJson",
|
|
570
|
+
value: function tryParseJson(text) {
|
|
571
|
+
return JSON.parse(text);
|
|
572
|
+
}
|
|
573
|
+
}, {
|
|
574
|
+
kind: "method",
|
|
575
|
+
key: "normalizeObjectLiteral",
|
|
576
|
+
value: function normalizeObjectLiteral(input) {
|
|
577
|
+
let normalized = input;
|
|
578
|
+
normalized = normalized.replace(/`([^`]*)`/g, (_, content) => `"${content}"`);
|
|
579
|
+
normalized = normalized.replace(/'([^']*)'/g, (_, content) => `"${content}"`);
|
|
580
|
+
normalized = normalized.replace(/([{,]\s*)([a-zA-Z0-9_]+)\s*:/g, '$1"$2":');
|
|
581
|
+
normalized = normalized.replace(/,(\s*[}\]])/g, '$1');
|
|
582
|
+
return normalized;
|
|
583
|
+
}
|
|
584
|
+
}, {
|
|
585
|
+
kind: "method",
|
|
586
|
+
key: "parseCustomNoticeText",
|
|
587
|
+
value: function parseCustomNoticeText(rawValue) {
|
|
588
|
+
if (typeof rawValue !== 'string') {
|
|
589
|
+
return rawValue;
|
|
590
|
+
}
|
|
591
|
+
const decodedText = this.htmlDecode(rawValue).trim();
|
|
592
|
+
const jsonDirect = this.tryParseJson(decodedText);
|
|
593
|
+
if (jsonDirect !== null) {
|
|
594
|
+
return jsonDirect;
|
|
595
|
+
}
|
|
596
|
+
const normalized = this.normalizeObjectLiteral(decodedText);
|
|
597
|
+
const jsonNormalized = this.tryParseJson(normalized);
|
|
598
|
+
if (jsonNormalized !== null) {
|
|
599
|
+
return jsonNormalized;
|
|
600
|
+
}
|
|
601
|
+
return {
|
|
602
|
+
text: decodedText
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
}, {
|
|
606
|
+
kind: "method",
|
|
607
|
+
key: "_handleEmailCheckFailure",
|
|
608
|
+
value: function _handleEmailCheckFailure(responseData, expired) {
|
|
609
|
+
this.isAnnualPeriodExpired = expired;
|
|
610
|
+
this.showCheckBox = true;
|
|
611
|
+
this.renderCombinedEmailPhoneSection();
|
|
612
|
+
this._onEmailStatusChanged('emailStats', _objectSpread(_objectSpread({}, responseData), {}, {
|
|
613
|
+
isAnnualPeriodExpired: expired
|
|
614
|
+
}));
|
|
615
|
+
}
|
|
533
616
|
}, {
|
|
534
617
|
kind: "method",
|
|
535
618
|
key: "onEmailChange",
|
|
@@ -568,44 +651,89 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
568
651
|
this._handleEmailCheckFailure(error, true);
|
|
569
652
|
});
|
|
570
653
|
}
|
|
571
|
-
|
|
572
|
-
/**
|
|
573
|
-
* Centralized handler for failed or invalid responses.
|
|
574
|
-
*/
|
|
575
654
|
}, {
|
|
576
655
|
kind: "method",
|
|
577
|
-
key: "
|
|
578
|
-
value: function
|
|
579
|
-
|
|
580
|
-
this.
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
}
|
|
656
|
+
key: "handleEmailChange",
|
|
657
|
+
value: function handleEmailChange(value, oldValue, hasValue) {
|
|
658
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
659
|
+
this.emailValid = false;
|
|
660
|
+
if (hasValue && typeof value === 'string' && value.trim() && oldValue !== value && emailRegex.test(value.trim())) {
|
|
661
|
+
this.email = value.trim();
|
|
662
|
+
this.onEmailChange();
|
|
663
|
+
} else {
|
|
664
|
+
this.showCheckBox = false;
|
|
665
|
+
}
|
|
585
666
|
}
|
|
586
667
|
}, {
|
|
587
668
|
kind: "method",
|
|
588
|
-
key: "
|
|
589
|
-
value: function
|
|
590
|
-
|
|
591
|
-
|
|
669
|
+
key: "loadContentWithFallback",
|
|
670
|
+
value: function loadContentWithFallback(lang) {
|
|
671
|
+
loadContent(lang, this.environment, ncData => {
|
|
672
|
+
this.isLoading = false;
|
|
673
|
+
this.ncData = ncData;
|
|
674
|
+
this.prepareCheckboxes();
|
|
675
|
+
}, () => this.defaultLoadContent());
|
|
676
|
+
}
|
|
677
|
+
}, {
|
|
678
|
+
kind: "method",
|
|
679
|
+
key: "handleLanguageOrEnvironmentChange",
|
|
680
|
+
value: function handleLanguageOrEnvironmentChange(value) {
|
|
681
|
+
var _this$language;
|
|
682
|
+
if (['stage', 'prod'].includes(value)) {
|
|
683
|
+
this.environment = value;
|
|
684
|
+
} else {
|
|
685
|
+
this.language = value;
|
|
686
|
+
}
|
|
687
|
+
const langPart = (_this$language = this.language) === null || _this$language === void 0 ? void 0 : _this$language.split(/[-_]/)[0];
|
|
688
|
+
this.isLoading = true;
|
|
592
689
|
loadSettings(this.environment, settings => {
|
|
690
|
+
var _this$language2;
|
|
593
691
|
this.countrySettings = settings.preferences;
|
|
594
692
|
this.noticeOnly = settings.noticeOnly || ['us'];
|
|
595
693
|
this.supportedLanguages = settings.supportedLanguages || {};
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
this.
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
694
|
+
this.isOriginalTextChanged = true;
|
|
695
|
+
const supportedLang = this.supportedLanguages[((_this$language2 = this.language) === null || _this$language2 === void 0 ? void 0 : _this$language2.toLowerCase()) || ''] || langPart && this.supportedLanguages[langPart.toLowerCase()] || 'en';
|
|
696
|
+
this.loadContentWithFallback(supportedLang);
|
|
697
|
+
}, err => {
|
|
698
|
+
console.error('Error loading settings', err);
|
|
699
|
+
this.loadContentWithFallback('en');
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
}, {
|
|
703
|
+
kind: "method",
|
|
704
|
+
key: "setDefaultSelections",
|
|
705
|
+
value: function setDefaultSelections() {
|
|
706
|
+
var _this$country, _this$countrySettings2, _this$countrySettings3;
|
|
707
|
+
if (this.enableAllOptIn || !this.checkboxes) {
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
const countryCode = (_this$country = this.country) === null || _this$country === void 0 ? void 0 : _this$country.toLowerCase();
|
|
711
|
+
const countryStatus = (_this$countrySettings2 = (_this$countrySettings3 = this.countrySettings) === null || _this$countrySettings3 === void 0 ? void 0 : _this$countrySettings3[countryCode]) !== null && _this$countrySettings2 !== void 0 ? _this$countrySettings2 : {
|
|
712
|
+
email: 'opt-in',
|
|
713
|
+
phone: 'opt-in'
|
|
714
|
+
};
|
|
715
|
+
const newValues = _objectSpread({}, this.values);
|
|
716
|
+
for (const key of Object.keys(this.checkboxes)) {
|
|
717
|
+
const isOptOut = countryStatus[key.toLowerCase()] === 'opt-out';
|
|
718
|
+
newValues[key] = isOptOut;
|
|
719
|
+
const hiddenFieldName = `NC_HIDDEN_${key}`;
|
|
720
|
+
newValues[hiddenFieldName] = isOptOut ? 'OPT_OUT' : 'OPT_IN';
|
|
721
|
+
if (Object.prototype.hasOwnProperty.call(this.defaultValues, key)) {
|
|
722
|
+
newValues[key] = this.defaultValues[key];
|
|
723
|
+
}
|
|
724
|
+
this._onChange(hiddenFieldName, newValues[key] ? 'OPT_IN' : 'OPT_OUT');
|
|
725
|
+
}
|
|
726
|
+
const changed = Object.keys(newValues).some(field => newValues[field] !== this.values[field]);
|
|
727
|
+
if (changed) {
|
|
728
|
+
this.values = newValues;
|
|
729
|
+
}
|
|
602
730
|
}
|
|
603
731
|
}, {
|
|
604
732
|
kind: "method",
|
|
605
733
|
key: "countryChangeAction",
|
|
606
734
|
value: function countryChangeAction() {
|
|
607
|
-
var _this$
|
|
608
|
-
const countryCode = (_this$
|
|
735
|
+
var _this$country2, _this$ncData;
|
|
736
|
+
const countryCode = (_this$country2 = this.country) === null || _this$country2 === void 0 ? void 0 : _this$country2.toLowerCase();
|
|
609
737
|
this.preventFormSubmission = false;
|
|
610
738
|
const mandatory = (_this$ncData = this.ncData) === null || _this$ncData === void 0 || (_this$ncData = _this$ncData.mandatoryCheckbox) === null || _this$ncData === void 0 ? void 0 : _this$ncData[countryCode];
|
|
611
739
|
this.setDefaultSelections();
|
|
@@ -628,67 +756,48 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
628
756
|
}
|
|
629
757
|
}, {
|
|
630
758
|
kind: "method",
|
|
631
|
-
key: "
|
|
632
|
-
value: function
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
const matchedValue = originalValue.match(/<tc>.*<\/tc>/g);
|
|
642
|
-
if (matchedValue) {
|
|
643
|
-
const anrTagHtml = matchedValue[0].replace(/<tc>|<\/tc>/g, '');
|
|
644
|
-
const link = `<a href='${this.termsConditionLink}' target='_blank' class='ibm-tooltip' part="tooltip-link">${anrTagHtml}</a>`;
|
|
645
|
-
const reg = new RegExp('<tc>' + anrTagHtml + '</tc>', 'g');
|
|
646
|
-
postText = postText + originalValue.replace(reg, link).replace(/<p>/g, '<p part="nc-trial-text" id="nc-trial-text">');
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
if (postText !== '') {
|
|
650
|
-
postText = "<div part='ncPostTextContainer' id='ncPostTextContainer'>" + postText + '</div>';
|
|
651
|
-
}
|
|
652
|
-
return html(_t4 || (_t4 = _`${0}`), unsafeHTML(postText));
|
|
653
|
-
} else {
|
|
654
|
-
return html(_t5 || (_t5 = _``));
|
|
655
|
-
}
|
|
759
|
+
key: "defaultLoadSettings",
|
|
760
|
+
value: function defaultLoadSettings() {
|
|
761
|
+
loadSettings(this.environment, countryPreferencesSettings => {
|
|
762
|
+
this.countrySettings = countryPreferencesSettings.preferences;
|
|
763
|
+
this.noticeOnly = countryPreferencesSettings.noticeOnly || ['us'];
|
|
764
|
+
this.supportedLanguages = settings.supportedLanguages || {};
|
|
765
|
+
this.isOriginalTextChanged = true;
|
|
766
|
+
}, error => {
|
|
767
|
+
console.error('error loading content', error);
|
|
768
|
+
});
|
|
656
769
|
}
|
|
657
770
|
}, {
|
|
658
771
|
kind: "method",
|
|
659
|
-
key: "
|
|
660
|
-
value: function
|
|
661
|
-
|
|
662
|
-
this.
|
|
772
|
+
key: "_initSettingsAndContent",
|
|
773
|
+
value: function _initSettingsAndContent(language) {
|
|
774
|
+
const [lang] = language.split(/[-_]/);
|
|
775
|
+
const defaultLang = this.supportedLanguages[language === null || language === void 0 ? void 0 : language.toLocaleLowerCase()] || this.supportedLanguages[lang === null || lang === void 0 ? void 0 : lang.toLocaleLowerCase()] || 'en';
|
|
776
|
+
loadSettings(this.environment, settings => {
|
|
777
|
+
this.countrySettings = settings.preferences;
|
|
778
|
+
this.noticeOnly = settings.noticeOnly || ['us'];
|
|
779
|
+
this.supportedLanguages = settings.supportedLanguages || {};
|
|
780
|
+
this.doubleOptInCountries = settings.doubleOptInCountries || [];
|
|
781
|
+
this.isOriginalTextChanged = true;
|
|
782
|
+
}, () => this.defaultLoadSettings());
|
|
783
|
+
loadContent(defaultLang, this.environment, ncData => {
|
|
784
|
+
this.ncData = ncData;
|
|
785
|
+
this.prepareCheckboxes();
|
|
786
|
+
this.countryChanged();
|
|
787
|
+
}, () => this.defaultLoadContent());
|
|
663
788
|
}
|
|
664
789
|
}, {
|
|
665
790
|
kind: "method",
|
|
666
|
-
key: "
|
|
667
|
-
value: function
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
};
|
|
677
|
-
const newValues = _objectSpread({}, this.values);
|
|
678
|
-
for (const key of Object.keys(this.checkboxes)) {
|
|
679
|
-
const isOptOut = countryStatus[key.toLowerCase()] === 'opt-out';
|
|
680
|
-
newValues[key] = isOptOut;
|
|
681
|
-
const hiddenFieldName = `NC_HIDDEN_${key}`;
|
|
682
|
-
newValues[hiddenFieldName] = isOptOut ? 'OPT_OUT' : 'OPT_IN';
|
|
683
|
-
if (Object.prototype.hasOwnProperty.call(this.defaultValues, key)) {
|
|
684
|
-
newValues[key] = this.defaultValues[key];
|
|
685
|
-
}
|
|
686
|
-
this._onChange(hiddenFieldName, newValues[key] ? 'OPT_IN' : 'OPT_OUT');
|
|
687
|
-
}
|
|
688
|
-
const changed = Object.keys(newValues).some(field => newValues[field] !== this.values[field]);
|
|
689
|
-
if (changed) {
|
|
690
|
-
this.values = newValues;
|
|
691
|
-
}
|
|
791
|
+
key: "defaultLoadContent",
|
|
792
|
+
value: function defaultLoadContent() {
|
|
793
|
+
loadContent('en', this.environment, ncData => {
|
|
794
|
+
this.ncData = ncData;
|
|
795
|
+
this.prepareCheckboxes();
|
|
796
|
+
this.countryChanged();
|
|
797
|
+
}, error => {
|
|
798
|
+
this.isLoading = false;
|
|
799
|
+
console.error('error loading content', error);
|
|
800
|
+
});
|
|
692
801
|
}
|
|
693
802
|
}, {
|
|
694
803
|
kind: "method",
|
|
@@ -728,31 +837,6 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
728
837
|
this.performUpdate();
|
|
729
838
|
}
|
|
730
839
|
}
|
|
731
|
-
}, {
|
|
732
|
-
kind: "method",
|
|
733
|
-
key: "defaultLoadContent",
|
|
734
|
-
value: function defaultLoadContent() {
|
|
735
|
-
loadContent('en', this.environment, ncData => {
|
|
736
|
-
this.ncData = ncData;
|
|
737
|
-
this.prepareCheckboxes();
|
|
738
|
-
this.countryChanged();
|
|
739
|
-
}, error => {
|
|
740
|
-
this.isLoading = false;
|
|
741
|
-
console.error('error loading content', error);
|
|
742
|
-
});
|
|
743
|
-
}
|
|
744
|
-
}, {
|
|
745
|
-
kind: "method",
|
|
746
|
-
key: "defaultLoadSettings",
|
|
747
|
-
value: function defaultLoadSettings() {
|
|
748
|
-
loadSettings(this.environment, countryPreferencesSettings => {
|
|
749
|
-
this.countrySettings = countryPreferencesSettings.preferences;
|
|
750
|
-
this.noticeOnly = countryPreferencesSettings.noticeOnly || ['us'];
|
|
751
|
-
this.supportedLanguages = settings.supportedLanguages || {};
|
|
752
|
-
}, error => {
|
|
753
|
-
console.error('error loading content', error);
|
|
754
|
-
});
|
|
755
|
-
}
|
|
756
840
|
}, {
|
|
757
841
|
kind: "method",
|
|
758
842
|
key: "checkCombineEmailPhoneBoxChange",
|
|
@@ -783,7 +867,7 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
783
867
|
key: "renderCheckbox",
|
|
784
868
|
value: function renderCheckbox(preText, checked) {
|
|
785
869
|
const checkboxId = 'EMAIL_PHONE_CHECKBOX';
|
|
786
|
-
return html(
|
|
870
|
+
return html(_t4 || (_t4 = _2`
|
|
787
871
|
<span part="container">
|
|
788
872
|
<div
|
|
789
873
|
class="${0}--form-item cds--checkbox-wrapper"
|
|
@@ -815,9 +899,9 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
815
899
|
kind: "method",
|
|
816
900
|
key: "combinedPreTextTemplate",
|
|
817
901
|
value: function combinedPreTextTemplate() {
|
|
818
|
-
var _this$country3, _this$state, _content$state, _content$country;
|
|
902
|
+
var _this$country3, _this$state, _content$state, _content$country, _this$values, _this$doubleOptInCoun, _this$noticeOnly;
|
|
819
903
|
if (!this.ncData) {
|
|
820
|
-
return html(
|
|
904
|
+
return html(_t5 || (_t5 = _2``));
|
|
821
905
|
}
|
|
822
906
|
const content = this.ncData;
|
|
823
907
|
const country = ((_this$country3 = this.country) === null || _this$country3 === void 0 ? void 0 : _this$country3.toLowerCase()) || '';
|
|
@@ -852,17 +936,40 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
852
936
|
if (countryContent) {
|
|
853
937
|
preText = !this.emailValid ? content.annualDefaultText : this.isAnnualPeriodExpired ? countryContent.combinedConsent : countryContent.annualText;
|
|
854
938
|
}
|
|
939
|
+
const hasEmail = Boolean((_this$values = this.values) === null || _this$values === void 0 ? void 0 : _this$values.EMAIL);
|
|
940
|
+
const inDoubleOptIn = (_this$doubleOptInCoun = this.doubleOptInCountries) === null || _this$doubleOptInCoun === void 0 ? void 0 : _this$doubleOptInCoun.includes(country);
|
|
941
|
+
const inNoticeOnly = (_this$noticeOnly = this.noticeOnly) === null || _this$noticeOnly === void 0 ? void 0 : _this$noticeOnly.includes(country);
|
|
942
|
+
if (this.isOriginalTextChanged) {
|
|
943
|
+
this._onNoticeTextChange('noticeTextChange', preText);
|
|
944
|
+
this.isOriginalTextChanged = false;
|
|
945
|
+
}
|
|
946
|
+
if (this.showCustomNotice) {
|
|
947
|
+
var _this$customNoticeTex;
|
|
948
|
+
if (this.customNoticeTextValue && (_this$customNoticeTex = this.customNoticeTextValue.text) !== null && _this$customNoticeTex !== void 0 && _this$customNoticeTex.trim()) {
|
|
949
|
+
preText = processCustomText(this.customNoticeTextValue);
|
|
950
|
+
} else {
|
|
951
|
+
preText = content.thirdPartyCombinedConsent;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
// Call only if changed
|
|
955
|
+
|
|
956
|
+
// 4. Add double opt-in text if applicable
|
|
957
|
+
if (hasEmail && inDoubleOptIn) {
|
|
958
|
+
var _content$mkDoubleOptI;
|
|
959
|
+
const text = content === null || content === void 0 || (_content$mkDoubleOptI = content.mkDoubleOptInText) === null || _content$mkDoubleOptI === void 0 ? void 0 : _content$mkDoubleOptI.trim();
|
|
960
|
+
if (text) {
|
|
961
|
+
preText += ` <span part="double-opt-in-text">${text}</span>`;
|
|
962
|
+
}
|
|
963
|
+
}
|
|
855
964
|
|
|
856
|
-
//
|
|
857
|
-
if (!
|
|
858
|
-
|
|
859
|
-
isPermission = this.values.EMAIL;
|
|
860
|
-
const checked = isPermission;
|
|
965
|
+
// 5. permission/suppression logic
|
|
966
|
+
if (!inNoticeOnly) {
|
|
967
|
+
const checked = hasEmail;
|
|
861
968
|
if (this.showCheckBox) {
|
|
862
969
|
return this.renderCheckbox(preText, checked);
|
|
863
970
|
}
|
|
864
971
|
}
|
|
865
|
-
return html(
|
|
972
|
+
return html(_t6 || (_t6 = _2`${0}`), unsafeHTML(preText));
|
|
866
973
|
}
|
|
867
974
|
}, {
|
|
868
975
|
kind: "method",
|
|
@@ -902,19 +1009,20 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
902
1009
|
value: function countryBasedLegalNotice() {
|
|
903
1010
|
var _this$ncData5;
|
|
904
1011
|
const countryCode = this.country.toLowerCase();
|
|
1012
|
+
this.isOriginalTextChanged = true;
|
|
905
1013
|
const mandatoryCheckboxes = (_this$ncData5 = this.ncData) === null || _this$ncData5 === void 0 || (_this$ncData5 = _this$ncData5.mandatoryCheckbox) === null || _this$ncData5 === void 0 ? void 0 : _this$ncData5[countryCode];
|
|
906
1014
|
if (!mandatoryCheckboxes) {
|
|
907
1015
|
return [];
|
|
908
1016
|
}
|
|
909
1017
|
return Object.entries(mandatoryCheckboxes).map(([key, checkbox]) => {
|
|
910
1018
|
const legalTextName = key.replace(/([A-Z]+)/g, '-$1').toLowerCase();
|
|
911
|
-
const errorTemplate = !this.hideErrorMessage && this.preventFormSubmission ? html(
|
|
1019
|
+
const errorTemplate = !this.hideErrorMessage && this.preventFormSubmission ? html(_t7 || (_t7 = _2`<span
|
|
912
1020
|
class="nc-error"
|
|
913
1021
|
part="error"
|
|
914
1022
|
style="color:#da1e28;font-size:.75rem">
|
|
915
1023
|
${0}
|
|
916
1024
|
</span>`), checkbox.error) : null;
|
|
917
|
-
return html(
|
|
1025
|
+
return html(_t8 || (_t8 = _2`
|
|
918
1026
|
<span>
|
|
919
1027
|
<div
|
|
920
1028
|
class="${0}--form-item bx--checkbox-wrapper"
|
|
@@ -945,6 +1053,34 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
945
1053
|
`), prefix, legalTextName, legalTextName, prefix, checkbox.mrs_field, checkbox.mrs_field, this.checkBoxLegalChange, checkbox.mrs_field, prefix, prefix, checkbox.mrs_field, prefix, checkbox.text, errorTemplate);
|
|
946
1054
|
});
|
|
947
1055
|
}
|
|
1056
|
+
}, {
|
|
1057
|
+
kind: "method",
|
|
1058
|
+
key: "postTextTemplate",
|
|
1059
|
+
value: function postTextTemplate() {
|
|
1060
|
+
if (this.ncData) {
|
|
1061
|
+
const OtherPreferences = this.ncData.trialPrivacyText;
|
|
1062
|
+
let postText = this.ncData.postText;
|
|
1063
|
+
if (postText) {
|
|
1064
|
+
postText = '<p part="ncPostText">' + postText + '</p>';
|
|
1065
|
+
}
|
|
1066
|
+
if (!this.termsConditionLink.strings && this.termsConditionLink) {
|
|
1067
|
+
const originalValue = OtherPreferences;
|
|
1068
|
+
const matchedValue = originalValue.match(/<tc>.*<\/tc>/g);
|
|
1069
|
+
if (matchedValue) {
|
|
1070
|
+
const anrTagHtml = matchedValue[0].replace(/<tc>|<\/tc>/g, '');
|
|
1071
|
+
const link = `<a href='${this.termsConditionLink}' target='_blank' class='ibm-tooltip' part="tooltip-link">${anrTagHtml}</a>`;
|
|
1072
|
+
const reg = new RegExp('<tc>' + anrTagHtml + '</tc>', 'g');
|
|
1073
|
+
postText = postText + originalValue.replace(reg, link).replace(/<p>/g, '<p part="nc-trial-text" id="nc-trial-text">');
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
if (postText !== '') {
|
|
1077
|
+
postText = "<div part='ncPostTextContainer' id='ncPostTextContainer'>" + postText + '</div>';
|
|
1078
|
+
}
|
|
1079
|
+
return html(_t9 || (_t9 = _2`${0}`), unsafeHTML(postText));
|
|
1080
|
+
} else {
|
|
1081
|
+
return html(_t10 || (_t10 = _2``));
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
948
1084
|
}, {
|
|
949
1085
|
kind: "method",
|
|
950
1086
|
key: "renderCombinedEmailPhoneSection",
|
|
@@ -968,7 +1104,7 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
968
1104
|
}
|
|
969
1105
|
return ((_this$valuesForEmailP2 = this.valuesForEmailPhone[key]) === null || _this$valuesForEmailP2 === void 0 ? void 0 : _this$valuesForEmailP2.punsStatus) || (checked ? 'CC' : 'UU');
|
|
970
1106
|
};
|
|
971
|
-
const createHiddenInput = (id, value) => html(_t11 || (_t11 =
|
|
1107
|
+
const createHiddenInput = (id, value) => html(_t11 || (_t11 = _2`
|
|
972
1108
|
<input type="hidden" id=${0} name=${0} value=${0} />
|
|
973
1109
|
`), id, id, value);
|
|
974
1110
|
const hiddenInputs = Object.keys(this.checkboxes).map(key => {
|
|
@@ -990,7 +1126,7 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
990
1126
|
}
|
|
991
1127
|
return createHiddenInput(hiddenBoxId, hiddenValue);
|
|
992
1128
|
});
|
|
993
|
-
return html(_t12 || (_t12 =
|
|
1129
|
+
return html(_t12 || (_t12 = _2`
|
|
994
1130
|
<section class="${0}--nc" part="section">
|
|
995
1131
|
<p part="ncHeading" id="ncHeading" class="${0}--nc__pre-text">
|
|
996
1132
|
${0} ${0}
|
|
@@ -1004,19 +1140,30 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
1004
1140
|
`), prefix, c4dPrefix, this.countryBasedLegalNotice(), this.combinedPreTextTemplate(), hiddenInputs, prefix, prefix, this.postTextTemplate(), createHiddenInput('preventFormSubmission', String(this.preventFormSubmission)));
|
|
1005
1141
|
}
|
|
1006
1142
|
}, {
|
|
1007
|
-
kind: "
|
|
1008
|
-
key: "
|
|
1009
|
-
value() {
|
|
1010
|
-
|
|
1143
|
+
kind: "method",
|
|
1144
|
+
key: "_onChange",
|
|
1145
|
+
value: function _onChange(field, value) {
|
|
1146
|
+
var _this$pwsFieldsMap$ge, _this$pwsFieldsMap, _pwsValueMap;
|
|
1147
|
+
const mappedField = (_this$pwsFieldsMap$ge = (_this$pwsFieldsMap = this.pwsFieldsMap) === null || _this$pwsFieldsMap === void 0 ? void 0 : _this$pwsFieldsMap.get(field)) !== null && _this$pwsFieldsMap$ge !== void 0 ? _this$pwsFieldsMap$ge : field;
|
|
1148
|
+
const mappedValue = (_pwsValueMap = pwsValueMap === null || pwsValueMap === void 0 ? void 0 : pwsValueMap(value)) !== null && _pwsValueMap !== void 0 ? _pwsValueMap : value;
|
|
1149
|
+
this.dispatchCustomEvent(`${c4dPrefix}-notice-choice-change`, mappedField, mappedValue);
|
|
1150
|
+
}
|
|
1151
|
+
}, {
|
|
1152
|
+
kind: "method",
|
|
1153
|
+
key: "_onNoticeTextChange",
|
|
1154
|
+
value: function _onNoticeTextChange(field, value) {
|
|
1155
|
+
this.dispatchCustomEvent(`${c4dPrefix}-notice-choice-text-change`, field, value);
|
|
1156
|
+
}
|
|
1157
|
+
}, {
|
|
1158
|
+
kind: "method",
|
|
1159
|
+
key: "_onEmailStatusChanged",
|
|
1160
|
+
value: function _onEmailStatusChanged(field, value) {
|
|
1161
|
+
this.dispatchCustomEvent(`${c4dPrefix}-notice-choice-email-status-changed`, field, value);
|
|
1011
1162
|
}
|
|
1012
1163
|
}, {
|
|
1013
1164
|
kind: "method",
|
|
1014
1165
|
key: "dispatchCustomEvent",
|
|
1015
|
-
value:
|
|
1016
|
-
/**
|
|
1017
|
-
* Dispatch field change event to parent form
|
|
1018
|
-
*/
|
|
1019
|
-
function dispatchCustomEvent(eventName, field, value) {
|
|
1166
|
+
value: function dispatchCustomEvent(eventName, field, value) {
|
|
1020
1167
|
try {
|
|
1021
1168
|
const eventDetail = {
|
|
1022
1169
|
bubbles: true,
|
|
@@ -1030,27 +1177,12 @@ let NoticeChoice = _decorate([customElement(`c4d-notice-choice`)], function (_in
|
|
|
1030
1177
|
console.error(`[${eventName}] dispatch failed:`, error);
|
|
1031
1178
|
}
|
|
1032
1179
|
}
|
|
1033
|
-
}, {
|
|
1034
|
-
kind: "method",
|
|
1035
|
-
key: "_onChange",
|
|
1036
|
-
value: function _onChange(field, value) {
|
|
1037
|
-
var _this$pwsFieldsMap$ge, _this$pwsFieldsMap, _pwsValueMap;
|
|
1038
|
-
const mappedField = (_this$pwsFieldsMap$ge = (_this$pwsFieldsMap = this.pwsFieldsMap) === null || _this$pwsFieldsMap === void 0 ? void 0 : _this$pwsFieldsMap.get(field)) !== null && _this$pwsFieldsMap$ge !== void 0 ? _this$pwsFieldsMap$ge : field;
|
|
1039
|
-
const mappedValue = (_pwsValueMap = pwsValueMap === null || pwsValueMap === void 0 ? void 0 : pwsValueMap(value)) !== null && _pwsValueMap !== void 0 ? _pwsValueMap : value;
|
|
1040
|
-
this.dispatchCustomEvent(`${c4dPrefix}-notice-choice-change`, mappedField, mappedValue);
|
|
1041
|
-
}
|
|
1042
|
-
}, {
|
|
1043
|
-
kind: "method",
|
|
1044
|
-
key: "_onEmailStatusChanged",
|
|
1045
|
-
value: function _onEmailStatusChanged(field, value) {
|
|
1046
|
-
this.dispatchCustomEvent(`${c4dPrefix}-notice-choice-email-status-changed`, field, value);
|
|
1047
|
-
}
|
|
1048
1180
|
}, {
|
|
1049
1181
|
kind: "method",
|
|
1050
1182
|
key: "render",
|
|
1051
1183
|
value: function render() {
|
|
1052
1184
|
if (this.isLoading) {
|
|
1053
|
-
return html(_t13 || (_t13 =
|
|
1185
|
+
return html(_t13 || (_t13 = _2`<div part="skeleton-notice-choice">
|
|
1054
1186
|
<cds-skeleton-text
|
|
1055
1187
|
linecount="3"
|
|
1056
1188
|
width="100%"
|