diff --git a/packages/web-components/src/components/notice-choice/__stories__/README.stories.mdx b/packages/web-components/src/components/notice-choice/__stories__/README.stories.mdx index 2603df214a4..862fd807583 100644 --- a/packages/web-components/src/components/notice-choice/__stories__/README.stories.mdx +++ b/packages/web-components/src/components/notice-choice/__stories__/README.stories.mdx @@ -21,8 +21,6 @@ Here's a quick example to get you started. ### JS (via import) -Note that, please always use the latest version. - ```javascript import '@carbon/ibmdotcom-web-components/es/components/notice-choice/index.js'; ``` @@ -40,9 +38,8 @@ import '@carbon/ibmdotcom-web-components/es/components/notice-choice/index.js'; question-choices="1,2" state="CA" terms-condition-link="" - bpid-legal-text="" - enable-all-opt-in="" - default-values=""> + hide-error-message="false" + enable-all-opt-in=""> ``` @@ -60,7 +57,14 @@ document.addEventListener('cds-notice-choice-change', (event) => { ## Props - +| Name | Description | Default | +| -------------------- | ------------------------------------------------------------------------------------------- | ------- | +| question-choices | Set to "1" if Email only. Set to "1, 2" if Email and Phone | 1 | +| country | Country code based on the customer country | US | +| state | State code based on the customer state | | +| language | form based on the country and language | en | +| terms-condition-link | Terms and conditions link appended to the end of the privacy statement - should be specific | | +| hide-error-message | Hide Error Messages for PUNS statement | false | ## Stable selectors diff --git a/packages/web-components/src/components/notice-choice/__stories__/notice-choice.stories.ts b/packages/web-components/src/components/notice-choice/__stories__/notice-choice.stories.ts index 5fd5cdb6717..07e42afede7 100644 --- a/packages/web-components/src/components/notice-choice/__stories__/notice-choice.stories.ts +++ b/packages/web-components/src/components/notice-choice/__stories__/notice-choice.stories.ts @@ -49,37 +49,70 @@ const countryList = { India: 'IN', China: 'CN', Japan: 'JP', + 'Korea, Republic of': 'KR', }; const stateList = { - Unknown: '', - Alabama: 'AL', - California: 'CA', + US: { + Unknown: '', + Alabama: 'AL', + California: 'CA', + }, + IN: { + Unknown: '', + Karnataka: 'KA', + Delhi: 'DL', + }, + CN: { + Unknown: '', + 'Beijing Shi': 'BJ', + 'Hong Kong': 'HK', + }, + JP: { + Unknown: '', + Kyoto: '26', + Mie: '27', + }, + KR: { + Unknown: '', + Sejong: '50', + 'Daegu-gwangyeoksi': '27', + }, + DE: { + Unknown: '', + Hamburg: 'HU', + Sachsen: 'SN', + }, }; const hideErrorMessages = { true: 'true', false: 'false', }; -const showLegalNotices = { - true: 'true', - false: 'false', -}; const onChange = (event: CustomEvent) => { console.log(event.detail); }; -const props = () => ({ - language: select('Language', languages, 'en'), - country: select('Country', countryList, 'US'), - state: select('State', stateList, ''), - questionchoices: select('Question Choices', questionChoices, '1,2'), - termsConditionLink: text( - 'Terms & Condition Link', - 'https://www.ibm.com/legal' - ), - bpidLegalText: text('BPID Legal Text', ''), - onChange: action('c4d-notice-choice-change'), - hideErrorMessages: select('Hide Error Messages', hideErrorMessages, 'false'), - showLegalNotice: select('Show Legal Notice', showLegalNotices, 'true'), -}); +const props = () => { + const selectedCountry = select('Country', countryList, 'US'); + let availableStates = stateList[selectedCountry] || [{ Unknown: '' }]; + + return { + language: select('Language', languages, 'en'), + country: selectedCountry, + state: select('State', availableStates, ''), + questionchoices: select('Question Choices', questionChoices, '1,2'), + termsConditionLink: text( + 'Terms & Condition Link', + 'https://www.ibm.com/legal' + ), + onChange: action('c4d-notice-choice-change'), + hideErrorMessages: select( + 'Hide Error Messages', + hideErrorMessages, + 'false' + ), + }; +}; + +console.log(props); export const Default = (args) => { const { @@ -89,9 +122,7 @@ export const Default = (args) => { termsConditionLink, questionchoices, hideErrorMessages, - showLegalNotice, enableAllOptIn, - bpidLegalText, hiddenEmail, hiddenPhone, ncTeleDetail, @@ -105,9 +136,7 @@ export const Default = (args) => { state="${state}" terms-condition-link="${termsConditionLink || ''}" hide-error-message="${hideErrorMessages}" - show-legal-notice=${showLegalNotice} ?enable-all-opt-in=${enableAllOptIn} - bpid-legal-text="${bpidLegalText}" .hiddenEmail="${hiddenEmail}" .hiddenPhone="${hiddenPhone}" .nc-tele-detail="${ncTeleDetail}" diff --git a/packages/web-components/src/components/notice-choice/cc-lc-map.ts b/packages/web-components/src/components/notice-choice/cc-lc-map.ts deleted file mode 100644 index 6d6f6c9b908..00000000000 --- a/packages/web-components/src/components/notice-choice/cc-lc-map.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright IBM Corp. 2022, 2023 - * - * This source code is licensed under the Apache-2.0 license found in the - * LICENSE file in the root directory of this source tree. - */ -export const ccLcMap = { - en: { cc: 'us', lc: 'en' }, - es: { cc: 'es', lc: 'es' }, - fr: { cc: 'fr', lc: 'fr' }, - it: { cc: 'it', lc: 'it' }, - zh: { cc: 'cn', lc: 'zh' }, - pl: { cc: 'pl', lc: 'pl' }, - tr: { cc: 'tr', lc: 'tr' }, - ko: { cc: 'kr', lc: 'ko' }, - ja: { cc: 'jp', lc: 'ja' }, - pt: { cc: 'pt', lc: 'pt' }, - de: { cc: 'de', lc: 'de' }, - ru: { cc: 'ru', lc: 'ru' }, -}; diff --git a/packages/web-components/src/components/notice-choice/country-settings.ts b/packages/web-components/src/components/notice-choice/country-settings.ts deleted file mode 100644 index e92626db2ad..00000000000 --- a/packages/web-components/src/components/notice-choice/country-settings.ts +++ /dev/null @@ -1,261 +0,0 @@ -/** - * Copyright IBM Corp. 2022, 2023 - * - * This source code is licensed under the Apache-2.0 license found in the - * LICENSE file in the root directory of this source tree. - */ -const countrySettings = { - us: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - ag: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - ai: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - aw: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - bb: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - bm: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - bs: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - ca: { status: 'OPT_IN', lang: 'fr', email: 'opt-in', phone: 'opt-out' }, - gd: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - gy: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - jm: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - kn: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - ky: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - ms: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - sr: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - tc: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - tt: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - vc: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - vg: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - at: { status: 'OPT_IN', lang: 'de', email: 'opt-in', phone: 'opt-in' }, - ch: { status: 'OPT_IN', lang: 'fr', email: 'opt-in', phone: 'opt-out' }, - de: { status: 'OPT_IN', lang: 'de', email: 'opt-in', phone: 'opt-in' }, - dk: { status: 'OPT_IN', lang: 'da', email: 'opt-in', phone: 'opt-out' }, - fi: { status: 'OPT_IN', lang: 'fi', email: 'opt-in', phone: 'opt-out' }, - no: { status: 'OPT_IN', lang: 'no', email: 'opt-in', phone: 'opt-out' }, - se: { status: 'OPT_IN', lang: 'sv', email: 'opt-in', phone: 'opt-out' }, - uk: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - ie: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - be: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - nl: { status: 'OPT_IN', lang: 'nl', email: 'opt-in', phone: 'opt-out' }, - fr: { status: 'OPT_IN', lang: 'fr', email: 'opt-in', phone: 'opt-out' }, - it: { status: 'OPT_IN', lang: 'it', email: 'opt-in', phone: 'opt-in' }, - cy: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - es: { status: 'OPT_IN', lang: 'es', email: 'opt-in', phone: 'opt-in' }, - gr: { status: 'OPT_IN', lang: 'el', email: 'opt-in', phone: 'opt-out' }, - il: { status: 'OPT_IN', lang: 'he', email: 'opt-in', phone: 'opt-out' }, - pt: { status: 'OPT_IN', lang: 'pt', email: 'opt-in', phone: 'opt-in' }, - ar: { status: 'OPT_IN', lang: 'es', email: 'opt-in', phone: 'opt-out' }, - bo: { status: 'OPT_IN', lang: 'es', email: 'opt-out', phone: 'opt-out' }, - br: { status: 'OPT_IN', lang: 'pt', email: 'opt-out', phone: 'opt-out' }, - cl: { status: 'OPT_IN', lang: 'es', email: 'opt-out', phone: 'opt-out' }, - co: { status: 'OPT_IN', lang: 'es', email: 'opt-in', phone: 'opt-in' }, - do: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - ec: { status: 'OPT_IN', lang: 'es', email: 'opt-out', phone: 'opt-out' }, - mx: { status: 'OPT_IN', lang: 'es', email: 'opt-out', phone: 'opt-out' }, - pe: { status: 'OPT_IN', lang: 'es', email: 'opt-in', phone: 'opt-in' }, - py: { status: 'OPT_IN', lang: 'es', email: 'opt-out', phone: 'opt-out' }, - uy: { status: 'OPT_IN', lang: 'es', email: 'opt-out', phone: 'opt-out' }, - ve: { status: 'OPT_IN', lang: 'es', email: 'opt-out', phone: 'opt-out' }, - au: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - id: { status: 'OPT_IN', lang: 'id', email: 'opt-in', phone: 'opt-out' }, - my: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - ph: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - sg: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - th: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - vn: { status: 'OPT_IN', lang: 'vi', email: 'opt-in', phone: 'opt-in' }, - cn: { status: 'OPT_IN', lang: 'zh', email: 'opt-in', phone: 'opt-in' }, - hk: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - tw: { status: 'OPT_IN', lang: 'zh', email: 'opt-out', phone: 'opt-out' }, - bd: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - in: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - lk: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - kp: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - kr: { status: 'OPT_IN', lang: 'ko', email: 'opt-in', phone: 'opt-in' }, - ae: { status: 'OPT_IN', lang: 'ar', email: 'opt-out', phone: 'opt-out' }, - bg: { status: 'OPT_IN', lang: 'bg', email: 'opt-in', phone: 'opt-in' }, - bh: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - cz: { status: 'OPT_IN', lang: 'cs', email: 'opt-in', phone: 'opt-in' }, - dz: { status: 'OPT_IN', lang: 'fr', email: 'opt-in', phone: 'opt-out' }, - ee: { status: 'OPT_IN', lang: 'et', email: 'opt-in', phone: 'opt-out' }, - eg: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - hr: { status: 'OPT_IN', lang: 'hr', email: 'opt-in', phone: 'opt-out' }, - hu: { status: 'OPT_IN', lang: 'hu', email: 'opt-in', phone: 'opt-out' }, - jo: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - kw: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - lb: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - lt: { status: 'OPT_IN', lang: 'lt', email: 'opt-in', phone: 'opt-in' }, - lv: { status: 'OPT_IN', lang: 'lv', email: 'opt-in', phone: 'opt-in' }, - ma: { status: 'OPT_IN', lang: 'fr', email: 'opt-in', phone: 'opt-out' }, - mk: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - om: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - pk: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - pl: { status: 'OPT_IN', lang: 'pl', email: 'opt-in', phone: 'opt-in' }, - qa: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - ro: { status: 'OPT_IN', lang: 'ro', email: 'opt-in', phone: 'opt-out' }, - rs: { status: 'OPT_IN', lang: 'sr', email: 'opt-in', phone: 'opt-out' }, - me: { status: 'OPT_IN', lang: 'sr', email: 'opt-in', phone: 'opt-out' }, - ru: { status: 'OPT_IN', lang: 'ru', email: 'opt-in', phone: 'opt-in' }, - sa: { status: 'OPT_IN', lang: 'ar', email: 'opt-in', phone: 'opt-in' }, - si: { status: 'OPT_IN', lang: 'sl', email: 'opt-in', phone: 'opt-in' }, - sk: { status: 'OPT_IN', lang: 'sk', email: 'opt-in', phone: 'opt-out' }, - tn: { status: 'OPT_IN', lang: 'fr', email: 'opt-in', phone: 'opt-out' }, - tr: { status: 'OPT_IN', lang: 'tr', email: 'opt-in', phone: 'opt-in' }, - ua: { status: 'OPT_IN', lang: 'uk', email: 'opt-in', phone: 'opt-out' }, - za: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - ad: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - af: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - al: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - am: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - an: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - ao: { status: 'OPT_IN', lang: 'pt', email: 'opt-in', phone: 'opt-out' }, - as: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - ax: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - az: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - ba: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - bf: { status: 'OPT_IN', lang: 'fr', email: 'opt-in', phone: 'opt-out' }, - bi: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - bj: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - bn: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - bt: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - bv: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - bw: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - by: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - bz: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - cc: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - cd: { status: 'OPT_IN', lang: 'fr', email: 'opt-in', phone: 'opt-out' }, - cf: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - cg: { status: 'OPT_IN', lang: 'fr', email: 'opt-in', phone: 'opt-out' }, - ci: { status: 'OPT_IN', lang: 'fr', email: 'opt-out', phone: 'opt-out' }, - ck: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - cm: { status: 'OPT_IN', lang: 'fr', email: 'opt-in', phone: 'opt-out' }, - cr: { status: 'OPT_IN', lang: 'es', email: 'opt-in', phone: 'opt-in' }, - cu: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - cv: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - cx: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - dj: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - eh: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - er: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - et: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - fj: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - fk: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - fm: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - fo: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - ga: { status: 'OPT_IN', lang: 'fr', email: 'opt-in', phone: 'opt-out' }, - ge: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - gf: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - gg: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - gh: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - gi: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - gl: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - gm: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - gn: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - gp: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - gq: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - gs: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - gt: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - gu: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - gw: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - hm: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - hn: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - ht: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - im: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - io: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - iq: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - ir: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - is: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - je: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - ke: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - kg: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - kh: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - ki: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - km: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - kz: { status: 'OPT_IN', lang: 'ru', email: 'opt-in', phone: 'opt-out' }, - la: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - li: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - lr: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - ls: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - lu: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - ly: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - mc: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - md: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - mg: { status: 'OPT_IN', lang: 'fr', email: 'opt-in', phone: 'opt-out' }, - mh: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - ml: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - mm: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - mn: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - mo: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - mp: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - mq: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - mr: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - mt: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - mu: { status: 'OPT_IN', lang: 'fr', email: 'opt-out', phone: 'opt-out' }, - mv: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - mw: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - mz: { status: 'OPT_IN', lang: 'pt', email: 'opt-in', phone: 'opt-out' }, - na: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - nc: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - ne: { status: 'OPT_IN', lang: 'fr', email: 'opt-in', phone: 'opt-out' }, - nf: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - ng: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - ni: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - np: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - nr: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - nu: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - nz: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - pa: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - pf: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - pg: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - pm: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - pn: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - pr: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - ps: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - pw: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - re: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - rw: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - sb: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - sc: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - sd: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - sh: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - sj: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - sl: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - sm: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - sn: { status: 'OPT_IN', lang: 'fr', email: 'opt-in', phone: 'opt-out' }, - so: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - sp: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - st: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - sv: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - sy: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - sz: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - td: { status: 'OPT_IN', lang: 'fr', email: 'opt-in', phone: 'opt-out' }, - tf: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - tg: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - tj: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - tk: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - tl: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - tm: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - to: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - tv: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - tz: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - ug: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - uz: { status: 'OPT_IN', lang: 'ru', email: 'opt-in', phone: 'opt-out' }, - va: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - vi: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - vu: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - wf: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - ws: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - ye: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - yt: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - zm: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - zw: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - jp: { status: 'OPT_IN', lang: 'ja', email: 'opt-in', phone: 'opt-out' }, - cw: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - dm: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - lc: { status: 'OPT_IN', lang: 'en', email: 'opt-out', phone: 'opt-out' }, - gb: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-out' }, - aq: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - bl: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - bq: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - mf: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - ss: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - sx: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, - um: { status: 'OPT_IN', lang: 'en', email: 'opt-in', phone: 'opt-in' }, -}; -export default countrySettings; diff --git a/packages/web-components/src/components/notice-choice/notice-choice.ts b/packages/web-components/src/components/notice-choice/notice-choice.ts index 1269a737ce3..2dc378213a8 100644 --- a/packages/web-components/src/components/notice-choice/notice-choice.ts +++ b/packages/web-components/src/components/notice-choice/notice-choice.ts @@ -20,7 +20,6 @@ import settings from '../../internal/vendor/@carbon/ibmdotcom-utilities/utilitie import StableSelectorMixin from '../../globals/mixins/stable-selector'; import styles from './notice-choice.scss'; import { unsafeHTML } from 'lit/directives/unsafe-html.js'; -import { worldWideContent } from './world-wide-content'; import { carbonElement as customElement } from '../../internal/vendor/@carbon/web-components/globals/decorators/carbon-element'; const { prefix, stablePrefix: c4dPrefix } = settings; @@ -53,9 +52,6 @@ class NoticeChoice extends StableSelectorMixin(LitElement) { @property({ type: String, attribute: 'terms-condition-link' }) termsConditionLink = html``; - @property({ type: String, attribute: 'bpid-legal-text' }) - bpidLegalText = html``; - @property({ type: Boolean, attribute: 'enable-all-opt-in' }) enableAllOptIn; @@ -65,9 +61,6 @@ class NoticeChoice extends StableSelectorMixin(LitElement) { @property({ type: Boolean, attribute: 'hide-error-message' }) hideErrorMessage = false; - @property({ type: Boolean, attribute: 'show-legal-notice' }) - showLegalNotice = true; - @property({ type: Object, attribute: false }) checkboxes = {}; @@ -115,8 +108,8 @@ class NoticeChoice extends StableSelectorMixin(LitElement) { values = { EMAIL: false, PHONE: false, - NC_HIDDEN_EMAIL: worldWideContent.cc_default_status, - NC_HIDDEN_PHONE: worldWideContent.cc_default_status, + NC_HIDDEN_EMAIL: 'SUPPRESSION', + NC_HIDDEN_PHONE: 'SUPPRESSION', }; @property({ reflect: true }) @@ -325,10 +318,6 @@ class NoticeChoice extends StableSelectorMixin(LitElement) { break; } - case 'show-legal-notice': { - this.showLegalNotice = JSON.parse(newVal); - break; - } } } @@ -552,13 +541,6 @@ class NoticeChoice extends StableSelectorMixin(LitElement) { return html``; } } - getBpidLegalText() { - if (this.bpidLegalText) { - return html`

${this.bpidLegalText}

`; - } else { - return ``; - } - } render() { if ( this.isMandatoryCheckboxDisplayed.isDisplayed && @@ -577,9 +559,7 @@ class NoticeChoice extends StableSelectorMixin(LitElement) { this._onChange(mrsField, 'countyBasedCheckedNo'); } return html`
-

${ - this.showLegalNotice ? this.countryBasedLegalNotice() : '' - } ${this.preTextTemplate()}

+

${this.countryBasedLegalNotice()} ${this.preTextTemplate()}

${ Object.keys(this.checkboxes).length !== 0 @@ -633,7 +613,6 @@ class NoticeChoice extends StableSelectorMixin(LitElement) { this.preventFormSubmission } />
- ${this.getBpidLegalText()}
`; } diff --git a/packages/web-components/src/components/notice-choice/utils.ts b/packages/web-components/src/components/notice-choice/utils.ts index 506ea962188..b29e554ee8c 100644 --- a/packages/web-components/src/components/notice-choice/utils.ts +++ b/packages/web-components/src/components/notice-choice/utils.ts @@ -4,11 +4,6 @@ * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ -import { ccLcMap } from './cc-lc-map'; -import { worldWideContent } from './world-wide-content'; - -export const emailRegExp = - /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; declare global { interface Window { @@ -16,28 +11,12 @@ declare global { } } -export function getMappedValue(locale) { - let ccLcValue = { - cc: 'us', - lc: 'en', - }; - if (Object.prototype.isPrototypeOf.call(ccLcMap, locale)) { - ccLcValue = ccLcMap[locale]; - } else if (locale.indexOf('-') > -1) { - const splitValue = locale.split('-', 2); - ccLcValue = { - cc: splitValue[0], - lc: splitValue[1], - }; - } - return ccLcValue; -} export function getNcContentFromWindow() { let content: any; try { content = window.NoticeChoice.Content; } catch (e) { - content = worldWideContent; + content = {}; } return content; } @@ -45,7 +24,6 @@ export function resetToWorldWideContent() { try { window.NoticeChoice = window.NoticeChoice || {}; window.NoticeChoice = window.NoticeChoice || {}; - window.NoticeChoice.content = worldWideContent; } catch (e) { console.log('unable to set worldWideContent', e); } diff --git a/packages/web-components/src/components/notice-choice/world-wide-content.ts b/packages/web-components/src/components/notice-choice/world-wide-content.ts deleted file mode 100644 index 12c0c9a1cef..00000000000 --- a/packages/web-components/src/components/notice-choice/world-wide-content.ts +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright IBM Corp. 2022, 2023 - * - * This source code is licensed under the Apache-2.0 license found in the - * LICENSE file in the root directory of this source tree. - */ - -export const worldWideContent = { - cc_name: 'zz', - cc_lang: 'en', - cc_default_status: 'OPT_IN', - OptInContent: { - preText: - 'IBM may use my contact data to keep me informed of products, services and offerings:', - oneQuestionApp: [ - { - id: '0', - optionTextPre: '', - checked: 'false', - optionTextPost: - 'IBM may use my contact data to keep me informed by email of products, services and offerings', - }, - ], - twoQuestionApp: [ - { - id: '0', - optionTextPre: '', - checked: 'false', - optionTextPost: 'by email', - }, - { - id: '4', - optionTextPre: '', - checked: 'true', - optionTextPost: 'by telephone or postal mail.', - }, - ], - fourQuestionApp: [ - { - id: '0', - optionTextPre: '', - checked: 'false', - optionTextPost: 'by email.', - }, - { - id: '1', - optionTextPre: '', - checked: 'false', - optionTextPost: 'by telephone.', - }, - { - id: '2', - optionTextPre: '', - checked: 'true', - optionTextPost: 'by postal mail.', - }, - { - id: '3', - optionTextPre: '', - checked: 'hidden', - optionTextPost: '', - }, - ], - postText: - '

You can withdraw your marketing consent at any time by submitting an opt-out request. Also you may unsubscribe from receiving marketing emails by clicking the unsubscribe link in each email.

More information on our processing can be found in the IBM Privacy Statement. By submitting this form, I acknowledge that I have read and understand the IBM Privacy Statement.

', - }, - - GranularPreference: { - GranularEmailText: - 'Please keep me informed by email of products, services and offerings from IBM companies worldwide. Check the boxes below to receive more information about:', - GranularText: - 'Please keep me informed of products, services and offerings from IBM companies worldwide. Check the boxes below to receive more information about:', - EnglishGranularText: '', - }, - OtherPreferences: { - allIBMNotice: - 'I would also like to receive information about other IBM products.', - englishNoticeText: '', - allIBMNoticeChecked: 'false', - noMediaErrorTextt: - 'You have selected a product category, please select your preferred media choice.', - mediaChoice: 'Please tell us how you would like to be contacted.', - trailPrivacyText: - '

You can withdraw your marketing consent at any time by submitting an opt-out request. Also you may unsubscribe from receiving marketing emails by clicking the unsubscribe link in each email.

More information on our processing can be found in the IBM Privacy Statement. By submitting this form, I acknowledge that I have read and understand the IBM Privacy Statement.

I accept the product Terms and Conditions of this registration form.

', - }, -};