@carbon/ibmdotcom-web-components 1.37.0-rc.0 → 1.37.0-rc.2

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.
Files changed (271) hide show
  1. package/custom-elements.json +27 -0
  2. package/dist/20-0dd18a2a.js +1 -1
  3. package/dist/20-b13a7263.js +1 -1
  4. package/dist/20-d59d1252.js +1 -1
  5. package/dist/20-db62d123.js +1 -1
  6. package/dist/cloud-masthead.js +1 -1
  7. package/dist/cloud-masthead.min.js +1 -1
  8. package/dist/cloud-masthead.rtl.js +1 -1
  9. package/dist/cloud-masthead.rtl.min.js +1 -1
  10. package/dist/dotcom-shell.js +1 -1
  11. package/dist/dotcom-shell.min.js +1 -1
  12. package/dist/dotcom-shell.rtl.js +1 -1
  13. package/dist/dotcom-shell.rtl.min.js +1 -1
  14. package/dist/ibmdotcom-web-components-dotcom-shell.js +3 -3
  15. package/dist/ibmdotcom-web-components-dotcom-shell.min.js +3 -3
  16. package/dist/ibmdotcom-web-components-dotcom-shell.rtl.js +3 -3
  17. package/dist/ibmdotcom-web-components-dotcom-shell.rtl.min.js +3 -3
  18. package/dist/left-nav-menu-4d9029d3.js +1 -1
  19. package/dist/left-nav-menu-9c991783.js +1 -1
  20. package/dist/left-nav-menu-category-heading-c11a1c5a.js +1 -1
  21. package/dist/left-nav-menu-category-heading-c408c797.js +1 -1
  22. package/dist/left-nav-menu-category-heading-ea722d76.js +1 -1
  23. package/dist/left-nav-menu-category-heading-f30c16b2.js +1 -1
  24. package/dist/left-nav-menu-e3475c54.js +1 -1
  25. package/dist/left-nav-menu-f949a3fc.js +1 -1
  26. package/dist/left-nav-menu-item-0c593619.js +1 -1
  27. package/dist/left-nav-menu-item-28b39f86.js +1 -1
  28. package/dist/left-nav-menu-item-38c7e8e5.js +1 -1
  29. package/dist/left-nav-menu-item-7a695a3a.js +1 -1
  30. package/dist/left-nav-menu-section-2b27f90c.js +1 -1
  31. package/dist/left-nav-menu-section-70361e96.js +1 -1
  32. package/dist/left-nav-menu-section-723dabdb.js +1 -1
  33. package/dist/left-nav-menu-section-9580fed9.js +1 -1
  34. package/dist/left-nav-overlay-213a2b93.js +1 -1
  35. package/dist/left-nav-overlay-23420664.js +1 -1
  36. package/dist/left-nav-overlay-39841e5b.js +1 -1
  37. package/dist/left-nav-overlay-4369f445.js +1 -1
  38. package/dist/masthead-composite-306b9aa2.js +1 -1
  39. package/dist/masthead-composite-549e469b.js +1 -1
  40. package/dist/masthead-composite-7be5e44a.js +1 -1
  41. package/dist/masthead-composite-dfe1f02c.js +1 -1
  42. package/dist/megamenu-category-group-04d4c7b5.js +1 -1
  43. package/dist/megamenu-category-group-72763c53.js +1 -1
  44. package/dist/megamenu-category-group-copy-1734a927.js +1 -1
  45. package/dist/megamenu-category-group-copy-b2e1f3b8.js +1 -1
  46. package/dist/megamenu-category-group-copy-b388d655.js +1 -1
  47. package/dist/megamenu-category-group-copy-f1dc57da.js +1 -1
  48. package/dist/megamenu-category-group-d91eb27d.js +1 -1
  49. package/dist/megamenu-category-group-ec20f1c0.js +1 -1
  50. package/dist/megamenu-category-link-43f181fe.js +1 -1
  51. package/dist/megamenu-category-link-7cdcb4db.js +1 -1
  52. package/dist/megamenu-category-link-baa8ed55.js +1 -1
  53. package/dist/megamenu-category-link-f7b52727.js +1 -1
  54. package/dist/megamenu-left-navigation-024c2f3d.js +1 -1
  55. package/dist/megamenu-left-navigation-02cf4776.js +1 -1
  56. package/dist/megamenu-left-navigation-47ca8cc9.js +1 -1
  57. package/dist/megamenu-left-navigation-c5935038.js +1 -1
  58. package/dist/megamenu-overlay-02fda241.js +1 -1
  59. package/dist/megamenu-overlay-2065230d.js +1 -1
  60. package/dist/megamenu-overlay-915d9eae.js +1 -1
  61. package/dist/megamenu-overlay-f9f8e94a.js +1 -1
  62. package/es/component-mixins/callout/callout.d.ts +1 -1
  63. package/es/component-mixins/cta/cta.d.ts +1 -1
  64. package/es/component-mixins/cta/video.d.ts +1 -1
  65. package/es/component-mixins/media-query/media-query.d.ts +1 -1
  66. package/es/component-mixins/parent-visibility/parent-visibility.d.ts +1 -1
  67. package/es/components/back-to-top/back-to-top.d.ts +2 -2
  68. package/es/components/button/button.d.ts +2 -2
  69. package/es/components/button-group/button-group.d.ts +1 -1
  70. package/es/components/callout-quote/callout-quote.css.js +1 -1
  71. package/es/components/callout-quote/callout-quote.d.ts +1 -1
  72. package/es/components/callout-quote/callout-quote.rtl.css.js +1 -1
  73. package/es/components/callout-with-media/callout-with-media.d.ts +2 -2
  74. package/es/components/card/card-eyebrow.d.ts +1 -1
  75. package/es/components/card/card-heading.d.ts +1 -1
  76. package/es/components/card/card.d.ts +1 -1
  77. package/es/components/card-group/card-group.d.ts +1 -1
  78. package/es/components/card-in-card/card-in-card.d.ts +1 -1
  79. package/es/components/card-section-offset/card-section-offset.d.ts +1 -1
  80. package/es/components/card-section-simple/card-section-simple.d.ts +1 -1
  81. package/es/components/carousel/carousel.d.ts +2 -2
  82. package/es/components/content-block/content-block-copy.d.ts +1 -1
  83. package/es/components/content-block/content-block-heading.d.ts +1 -1
  84. package/es/components/content-block/content-block-paragraph.d.ts +1 -1
  85. package/es/components/content-block/content-block.d.ts +1 -1
  86. package/es/components/content-block-card-static/content-block-card-static.d.ts +1 -1
  87. package/es/components/content-block-cards/content-block-cards.d.ts +1 -1
  88. package/es/components/content-block-headlines/content-block-headlines-heading.d.ts +1 -1
  89. package/es/components/content-block-headlines/content-block-headlines-item.d.ts +1 -1
  90. package/es/components/content-block-headlines/content-block-headlines.d.ts +1 -1
  91. package/es/components/content-block-media/content-block-media-content.d.ts +1 -1
  92. package/es/components/content-block-segmented/content-block-segmented-item.d.ts +1 -1
  93. package/es/components/content-block-simple/content-block-simple.d.ts +1 -1
  94. package/es/components/content-group/content-group-copy.d.ts +1 -1
  95. package/es/components/content-group/content-group-heading.d.ts +1 -1
  96. package/es/components/content-group/content-group-paragraph.d.ts +1 -1
  97. package/es/components/content-group/content-group.d.ts +1 -1
  98. package/es/components/content-group-banner/content-group-banner.d.ts +1 -1
  99. package/es/components/content-group-cards/content-group-cards-item.d.ts +1 -1
  100. package/es/components/content-group-simple/content-group-simple.d.ts +1 -1
  101. package/es/components/content-item/content-item-copy.d.ts +1 -1
  102. package/es/components/content-item/content-item-heading.d.ts +1 -1
  103. package/es/components/content-item/content-item-paragraph.d.ts +1 -1
  104. package/es/components/content-item/content-item.d.ts +1 -1
  105. package/es/components/content-item-horizontal/content-item-horizontal-copy.d.ts +1 -1
  106. package/es/components/content-item-horizontal/content-item-horizontal-eyebrow.d.ts +1 -1
  107. package/es/components/content-item-horizontal/content-item-horizontal-media-copy.d.ts +1 -1
  108. package/es/components/content-item-horizontal/content-item-horizontal-media.d.ts +1 -1
  109. package/es/components/content-item-horizontal/content-item-horizontal-thumbnail-copy.d.ts +1 -1
  110. package/es/components/content-section/content-section-copy.d.ts +1 -1
  111. package/es/components/content-section/content-section-heading.d.ts +1 -1
  112. package/es/components/content-section/content-section.d.ts +1 -1
  113. package/es/components/cta/button-cta.d.ts +2 -2
  114. package/es/components/cta/card-cta-footer.d.ts +2 -2
  115. package/es/components/cta/card-cta.d.ts +2 -2
  116. package/es/components/cta/card-link-cta.d.ts +2 -2
  117. package/es/components/cta/cta.d.ts +2 -2
  118. package/es/components/cta/feature-cta-footer.d.ts +2 -2
  119. package/es/components/cta/feature-cta.d.ts +2 -2
  120. package/es/components/cta/text-cta.d.ts +2 -2
  121. package/es/components/cta/video-cta-composite.d.ts +2 -2
  122. package/es/components/cta/video-cta-container.d.ts +2 -2
  123. package/es/components/cta-block/cta-block-item-row.d.ts +2 -2
  124. package/es/components/cta-block/cta-block-item.d.ts +1 -1
  125. package/es/components/cta-block/cta-block.d.ts +1 -1
  126. package/es/components/cta-section/cta-section.d.ts +1 -1
  127. package/es/components/dotcom-shell/dotcom-shell-container.d.ts +1 -1
  128. package/es/components/dotcom-shell/dotcom-shell.css.js +1 -1
  129. package/es/components/dotcom-shell/dotcom-shell.d.ts +1 -1
  130. package/es/components/dotcom-shell/dotcom-shell.rtl.css.js +1 -1
  131. package/es/components/expressive-modal/expressive-modal-body.d.ts +1 -1
  132. package/es/components/expressive-modal/expressive-modal-close-button.d.ts +1 -1
  133. package/es/components/expressive-modal/expressive-modal-footer.d.ts +1 -1
  134. package/es/components/expressive-modal/expressive-modal-header.d.ts +1 -1
  135. package/es/components/expressive-modal/expressive-modal-heading.d.ts +1 -1
  136. package/es/components/expressive-modal/expressive-modal.d.ts +2 -2
  137. package/es/components/feature-card/feature-card.d.ts +1 -1
  138. package/es/components/feature-section/feature-section.d.ts +1 -1
  139. package/es/components/filter-panel/filter-group-item.d.ts +1 -1
  140. package/es/components/filter-panel/filter-group.d.ts +1 -1
  141. package/es/components/filter-panel/filter-modal-button.d.ts +1 -1
  142. package/es/components/filter-panel/filter-modal-footer.d.ts +1 -1
  143. package/es/components/filter-panel/filter-modal-heading.d.ts +1 -1
  144. package/es/components/filter-panel/filter-panel-checkbox.d.ts +2 -2
  145. package/es/components/filter-panel/filter-panel-composite.d.ts +2 -2
  146. package/es/components/filter-panel/filter-panel-heading.d.ts +1 -1
  147. package/es/components/filter-panel/filter-panel-input-select-item.d.ts +2 -2
  148. package/es/components/filter-panel/filter-panel-input-select.d.ts +2 -2
  149. package/es/components/filter-panel/filter-panel-modal.d.ts +2 -2
  150. package/es/components/filter-panel/filter-panel.d.ts +2 -2
  151. package/es/components/footer/footer-composite.d.ts +4 -4
  152. package/es/components/footer/footer-container.d.ts +1 -1
  153. package/es/components/footer/footer-logo.d.ts +2 -2
  154. package/es/components/footer/footer-nav-group.d.ts +2 -2
  155. package/es/components/footer/footer-nav.d.ts +1 -1
  156. package/es/components/footer/footer.css.js +1 -1
  157. package/es/components/footer/footer.d.ts +1 -1
  158. package/es/components/footer/footer.rtl.css.js +1 -1
  159. package/es/components/footer/legal-nav-cookie-preferences-placeholder.d.ts +1 -1
  160. package/es/components/footer/legal-nav.d.ts +1 -1
  161. package/es/components/footer/locale-button.d.ts +2 -2
  162. package/es/components/horizontal-rule/horizontal-rule.d.ts +1 -1
  163. package/es/components/image/image-item.d.ts +1 -1
  164. package/es/components/image/image.d.ts +3 -3
  165. package/es/components/leadspace/breadcrumb-item.d.ts +1 -1
  166. package/es/components/leadspace/breadcrumb-link.d.ts +1 -1
  167. package/es/components/leadspace/breadcrumb.d.ts +1 -1
  168. package/es/components/leadspace/leadspace-heading.d.ts +1 -1
  169. package/es/components/leadspace/leadspace-image.d.ts +1 -1
  170. package/es/components/leadspace/leadspace.d.ts +1 -1
  171. package/es/components/leadspace-block/leadspace-block-cta.d.ts +1 -1
  172. package/es/components/leadspace-block/leadspace-block-heading.d.ts +1 -1
  173. package/es/components/leadspace-block/leadspace-block-media.d.ts +1 -1
  174. package/es/components/leadspace-block/leadspace-block.d.ts +1 -1
  175. package/es/components/leadspace-with-search/leadspace-with-search-content-copy.d.ts +1 -1
  176. package/es/components/leadspace-with-search/leadspace-with-search-content-heading.d.ts +1 -1
  177. package/es/components/leadspace-with-search/leadspace-with-search-content.d.ts +1 -1
  178. package/es/components/leadspace-with-search/leadspace-with-search-heading.d.ts +1 -1
  179. package/es/components/leadspace-with-search/leadspace-with-search.d.ts +1 -1
  180. package/es/components/leaving-ibm/leaving-ibm-composite.d.ts +2 -2
  181. package/es/components/leaving-ibm/leaving-ibm-container.d.ts +1 -1
  182. package/es/components/leaving-ibm/leaving-ibm-modal-body.d.ts +1 -1
  183. package/es/components/leaving-ibm/leaving-ibm-modal-heading.d.ts +1 -1
  184. package/es/components/leaving-ibm/leaving-ibm-modal-supplemental.d.ts +1 -1
  185. package/es/components/leaving-ibm/leaving-ibm-modal.d.ts +1 -1
  186. package/es/components/lightbox-media-viewer/lightbox-media-viewer-body.d.ts +1 -1
  187. package/es/components/lightbox-media-viewer/lightbox-video-player-composite.d.ts +1 -1
  188. package/es/components/lightbox-media-viewer/lightbox-video-player-container.d.ts +2 -2
  189. package/es/components/link-list/link-list-heading.d.ts +1 -1
  190. package/es/components/link-list/link-list.d.ts +1 -1
  191. package/es/components/link-list-section/link-list-section.d.ts +1 -1
  192. package/es/components/link-with-icon/link-with-icon.d.ts +1 -1
  193. package/es/components/locale-modal/locale-modal-composite.d.ts +1 -1
  194. package/es/components/locale-modal/locale-modal-container.d.ts +1 -1
  195. package/es/components/locale-modal/locale-search.d.ts +2 -2
  196. package/es/components/locale-modal/regions.d.ts +1 -1
  197. package/es/components/logo-grid/logo-grid-item.d.ts +1 -1
  198. package/es/components/logo-grid/logo-grid-link.d.ts +1 -1
  199. package/es/components/logo-grid/logo-grid.d.ts +1 -1
  200. package/es/components/masthead/cloud/cloud-masthead-container.d.ts +1 -1
  201. package/es/components/masthead/left-nav-menu-section.d.ts +2 -2
  202. package/es/components/masthead/left-nav-menu.d.ts +1 -1
  203. package/es/components/masthead/left-nav.d.ts +1 -1
  204. package/es/components/masthead/masthead-composite.d.ts +1 -1
  205. package/es/components/masthead/masthead-container.d.ts +1 -1
  206. package/es/components/masthead/masthead-global-bar.d.ts +3 -3
  207. package/es/components/masthead/masthead-l1-name.d.ts +1 -1
  208. package/es/components/masthead/masthead-l1.d.ts +1 -1
  209. package/es/components/masthead/masthead-logo.d.ts +3 -3
  210. package/es/components/masthead/masthead-menu-button.d.ts +1 -1
  211. package/es/components/masthead/masthead-profile.d.ts +3 -3
  212. package/es/components/masthead/masthead.d.ts +1 -1
  213. package/es/components/masthead/megamenu.d.ts +1 -1
  214. package/es/components/masthead/top-nav.d.ts +2 -2
  215. package/es/components/notice-choice/country-settings.d.ts.map +1 -1
  216. package/es/components/notice-choice/country-settings.js +5 -5
  217. package/es/components/notice-choice/country-settings.js.map +1 -1
  218. package/es/components/notice-choice/notice-choice.d.ts +16 -11
  219. package/es/components/notice-choice/notice-choice.d.ts.map +1 -1
  220. package/es/components/notice-choice/notice-choice.js +108 -16
  221. package/es/components/notice-choice/notice-choice.js.map +1 -1
  222. package/es/components/notice-choice/utils.d.ts.map +1 -1
  223. package/es/components/notice-choice/utils.js +8 -1
  224. package/es/components/notice-choice/utils.js.map +1 -1
  225. package/es/components/pictogram-item/pictogram-item.d.ts +1 -1
  226. package/es/components/pricing-table/pricing-table-annotation-toggle.d.ts +1 -1
  227. package/es/components/pricing-table/pricing-table-body.d.ts +1 -1
  228. package/es/components/pricing-table/pricing-table-cell-annotation.d.ts +1 -1
  229. package/es/components/pricing-table/pricing-table-cell.d.ts +2 -2
  230. package/es/components/pricing-table/pricing-table-group.d.ts +1 -1
  231. package/es/components/pricing-table/pricing-table-head.d.ts +1 -1
  232. package/es/components/pricing-table/pricing-table-header-cell-caption.d.ts +1 -1
  233. package/es/components/pricing-table/pricing-table-header-cell-cta.d.ts +1 -1
  234. package/es/components/pricing-table/pricing-table-header-cell-description.d.ts +1 -1
  235. package/es/components/pricing-table/pricing-table-header-cell-headline.d.ts +1 -1
  236. package/es/components/pricing-table/pricing-table-header-cell-tag.d.ts +1 -1
  237. package/es/components/pricing-table/pricing-table-header-cell.d.ts +1 -1
  238. package/es/components/pricing-table/pricing-table-header-row.d.ts +1 -1
  239. package/es/components/pricing-table/pricing-table-highlight-label.d.ts +1 -1
  240. package/es/components/pricing-table/pricing-table-row.d.ts +1 -1
  241. package/es/components/pricing-table/pricing-table.d.ts +2 -2
  242. package/es/components/quote/quote.d.ts +1 -1
  243. package/es/components/scroll-animations/scroll-animations.d.ts +1 -1
  244. package/es/components/search-with-typeahead/search-with-typeahead.d.ts +2 -2
  245. package/es/components/structured-list/structured-list-group.d.ts +1 -1
  246. package/es/components/structured-list/structured-list.d.ts +1 -1
  247. package/es/components/table-of-contents/table-of-contents-cdn.css.js +1 -1
  248. package/es/components/table-of-contents/table-of-contents-cdn.rtl.css.js +1 -1
  249. package/es/components/table-of-contents/table-of-contents.d.ts +5 -3
  250. package/es/components/table-of-contents/table-of-contents.d.ts.map +1 -1
  251. package/es/components/table-of-contents/table-of-contents.js +5 -1
  252. package/es/components/table-of-contents/table-of-contents.js.map +1 -1
  253. package/es/components/tabs-extended/tab.d.ts +2 -2
  254. package/es/components/tabs-extended/tabs-extended.d.ts +2 -2
  255. package/es/components/tag-group/tag-group.d.ts +1 -1
  256. package/es/components/tag-link/tag-link.d.ts +1 -1
  257. package/es/components/universal-banner/universal-banner-copy.d.ts +1 -1
  258. package/es/components/universal-banner/universal-banner-heading.d.ts +1 -1
  259. package/es/components/universal-banner/universal-banner.d.ts +1 -1
  260. package/es/components/video-player/video-player-composite.d.ts +2 -2
  261. package/es/components/video-player/video-player-container.d.ts +3 -3
  262. package/es/components/video-player/video-player.d.ts +3 -3
  263. package/es/globals/mixins/connect.d.ts +1 -1
  264. package/es/globals/mixins/hybrid-render.d.ts +1 -1
  265. package/es/globals/mixins/modal-render.d.ts +1 -1
  266. package/es/globals/mixins/stable-selector.d.ts +1 -1
  267. package/es/globals/mixins/throttled-input.d.ts +1 -1
  268. package/package.json +4 -4
  269. package/scss/components/callout-quote/callout-quote.scss +15 -0
  270. package/scss/components/footer/footer.scss +0 -1
  271. package/scss/components/table-of-contents/table-of-contents-cdn.scss +1 -1
@@ -6,7 +6,7 @@
6
6
  * This source code is licensed under the Apache-2.0 license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- import { LitElement } from 'lit-element';
9
+ import { LitElement, TemplateResult } from 'lit-element';
10
10
  declare const NoticeChoice_base: {
11
11
  new (...args: any[]): {
12
12
  linkNode: any;
@@ -194,7 +194,7 @@ declare const NoticeChoice_base: {
194
194
  ariaValueMin: string | null;
195
195
  ariaValueNow: string | null;
196
196
  ariaValueText: string | null;
197
- animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions | undefined): Animation;
197
+ animate(keyframes: PropertyIndexedKeyframes | Keyframe[] | null, options?: number | KeyframeAnimationOptions | undefined): Animation;
198
198
  getAnimations(options?: GetAnimationsOptions | undefined): Animation[];
199
199
  after(...nodes: (string | Node)[]): void;
200
200
  before(...nodes: (string | Node)[]): void;
@@ -339,24 +339,27 @@ declare class NoticeChoice extends NoticeChoice_base {
339
339
  country: string;
340
340
  state: string;
341
341
  language: string;
342
- termsConditionLink: import("lit-element").TemplateResult;
343
- bpidLegalText: import("lit-element").TemplateResult;
342
+ termsConditionLink: TemplateResult;
343
+ bpidLegalText: TemplateResult;
344
344
  enableAllOptIn: any;
345
345
  defaultValues: {};
346
346
  email: string;
347
+ hideErrorMessage: boolean;
348
+ showLegalNotice: boolean;
347
349
  checkboxes: {};
348
350
  ncData: any;
349
351
  changed: boolean;
350
352
  fetchedPref: string;
351
353
  optInContent: {};
354
+ preventFormSubmission: boolean;
352
355
  /**
353
356
  * End properties for passed attributes.
354
357
  */
355
358
  /**
356
359
  * properties for local state state management.
357
360
  */
358
- preText: import("lit-element").TemplateResult;
359
- defaultPreText: import("lit-element").TemplateResult;
361
+ preText: TemplateResult;
362
+ defaultPreText: TemplateResult;
360
363
  values: {
361
364
  EMAIL: boolean;
362
365
  PHONE: boolean;
@@ -381,11 +384,13 @@ declare class NoticeChoice extends NoticeChoice_base {
381
384
  private checkBoxChange;
382
385
  static get stableSelector(): string;
383
386
  static styles: any;
384
- checkBoxTemplate(checkbox: any, checked: any, hiddenBox: any): import("lit-element").TemplateResult;
385
- preTextTemplate(): import("lit-element").TemplateResult;
386
- postTextTemplate(): import("lit-element").TemplateResult;
387
- getBpidLegalText(): "" | import("lit-element").TemplateResult;
388
- render(): import("lit-element").TemplateResult;
387
+ checkBoxLegalChange($event: any): void;
388
+ countryBasedLegalNotice(): TemplateResult[];
389
+ checkBoxTemplate(checkbox: any, checked: any, hiddenBox: any): TemplateResult;
390
+ preTextTemplate(): TemplateResult;
391
+ postTextTemplate(): TemplateResult;
392
+ getBpidLegalText(): TemplateResult | "";
393
+ render(): TemplateResult;
389
394
  protected emailChanged(email: any): void;
390
395
  protected _getOptionByQuestion: (question: any) => any;
391
396
  protected _buildCheckboxes(): any;
@@ -1 +1 @@
1
- {"version":3,"sources":["components/notice-choice/notice-choice.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAQ,UAAU,EAAY,MAAM,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBzD;;;;;;;GAOG;AACH,cACM,YAAa,SAAQ,iBAA+B;IACxD;;OAEG;IAEH,eAAe,SAAO;IAGtB,OAAO,SAAQ;IAGf,KAAK,SAAM;IAGX,QAAQ,SAAQ;IAGhB,kBAAkB,uCAAU;IAG5B,aAAa,uCAAU;IAGvB,cAAc,MAAC;IAGf,aAAa,KAAM;IAGnB,KAAK,SAAM;IAGX,UAAU,KAAM;IAGhB,MAAM,EAAE,GAAG,CAAC;IAGZ,OAAO,UAAS;IAGhB,WAAW,SAAM;IAGjB,YAAY,KAAM;IAElB;;OAEG;IAEH;;OAEG;IAEH,OAAO,uCAAU;IAGjB,cAAc,uCAAU;IAGxB,MAAM;;;;;MAKJ;IAGF,WAAW,SAAM;IAGjB,WAAW,SAAM;IAEjB,iBAAiB;IAUjB,kBAAkB;IAalB,iBAAiB;IAuBjB,oBAAoB;IAuBpB,mBAAmB;IAiBnB,cAAc;IAId;;;;;OAKG;IACH,wBAAwB,CAAC,IAAI,KAAA,EAAE,MAAM,KAAA,EAAE,MAAM,KAAA;IAyE7C,OAAO,CAAC,cAAc;IAiBtB,MAAM,KAAK,cAAc,WAExB;IACD,MAAM,CAAC,MAAM,MAAU;IACvB,gBAAgB,CAAC,QAAQ,KAAA,EAAE,OAAO,KAAA,EAAE,SAAS,KAAA;IAyB7C,eAAe;IA6Bf,gBAAgB;IA8BhB,gBAAgB;IAOhB,MAAM;IAiCN,SAAS,CAAC,YAAY,CAAC,KAAK,KAAA;IA6B5B,SAAS,CAAC,oBAAoB,yBAyC5B;IACF,SAAS,CAAC,gBAAgB;IAyB1B,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAqB9C;AAED,eAAe,YAAY,CAAC","file":"notice-choice.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2020, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { checkPreferencesv3, loadContent } from './services';\nimport { html, LitElement, property } from 'lit-element';\nimport {\n emailRegExp,\n pwsValueMap,\n resetToWorldWideContent,\n supportedLanguages,\n} from './utils';\nimport countrySettings from './country-settings';\nimport ddsSettings from '../../internal/vendor/@carbon/ibmdotcom-utilities/utilities/settings/settings';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport StableSelectorMixin from '../../globals/mixins/stable-selector';\nimport styles from './notice-choice.scss';\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html';\nimport { worldWideContent } from './world-wide-content';\nimport { carbonElement as customElement } from '../../internal/vendor/@carbon/web-components/globals/decorators/carbon-element';\n\nconst { stablePrefix: ddsPrefix } = ddsSettings;\nconst { prefix } = settings;\n\n/**\n * Notice Choice\n *\n * @element dds-notice-choice\n * @fires dds-notice-choice-change\n * The custom event fired when default choice loaded or user change some preferences.\n * The field and value should be taken from the detail object and send it to MRS.\n */\n@customElement(`dds-notice-choice`)\nclass NoticeChoice extends StableSelectorMixin(LitElement) {\n /**\n * properties for passed attributes.\n */\n @property({ type: String, reflect: true, attribute: 'question-choices' })\n questionchoices = '1';\n\n @property({ type: String, attribute: 'country' })\n country = 'US';\n\n @property({ type: String, attribute: 'state' })\n state = '';\n\n @property({ type: String, attribute: 'language' })\n language = 'en';\n\n @property({ type: String, attribute: 'terms-condition-link' })\n termsConditionLink = html``;\n\n @property({ type: String, attribute: 'bpid-legal-text' })\n bpidLegalText = html``;\n\n @property({ type: Boolean, attribute: 'enable-all-opt-in' })\n enableAllOptIn;\n\n @property({ attribute: 'default-values' })\n defaultValues = {};\n\n @property({ type: String, attribute: 'email' })\n email = '';\n\n @property({ type: Object, attribute: false })\n checkboxes = {};\n\n @property({ type: Object, attribute: false })\n ncData: any;\n\n @property({ type: Boolean, attribute: false })\n changed = false;\n\n @property({ type: String, attribute: false })\n fetchedPref = '';\n\n @property({ type: Object, attribute: false })\n optInContent = {};\n\n /**\n * End properties for passed attributes.\n */\n\n /**\n * properties for local state state management.\n */\n @property({ type: html, attribute: false })\n preText = html``;\n\n @property({ type: html, attribute: false })\n defaultPreText = html``;\n\n @property({ type: Object, attribute: false })\n values = {\n EMAIL: false,\n PHONE: false,\n NC_HIDDEN_EMAIL: worldWideContent.cc_default_status,\n NC_HIDDEN_PHONE: worldWideContent.cc_default_status,\n };\n\n @property({ reflect: true })\n hiddenEmail = '';\n\n @property({ reflect: true })\n hiddenPhone = '';\n\n prepareCheckboxes() {\n if (this.ncData) {\n const OptInContent = this.ncData;\n this.preText = OptInContent.preText;\n this.defaultPreText = OptInContent.preText;\n const newCheckboxes = this._buildCheckboxes();\n this.checkboxes = newCheckboxes;\n this.performUpdate();\n }\n }\n defaultLoadContent() {\n loadContent(\n 'en',\n (ncData) => {\n this.ncData = ncData;\n this.prepareCheckboxes();\n this.countryChanged();\n },\n (error) => {\n console.error('error loading content', error);\n }\n );\n }\n connectedCallback() {\n super.connectedCallback();\n const [language] = this.language.split(/[-_]/);\n\n let defaultLanguage = 'en';\n if (supportedLanguages(this.language)) {\n defaultLanguage = supportedLanguages(this.language);\n } else if (supportedLanguages(language)) {\n defaultLanguage = supportedLanguages(language);\n }\n\n loadContent(\n defaultLanguage,\n (ncData) => {\n this.ncData = ncData;\n this.prepareCheckboxes();\n this.countryChanged();\n },\n () => {\n this.defaultLoadContent();\n }\n );\n }\n setDefaultSelections() {\n if (!this.enableAllOptIn && this.checkboxes) {\n const newValues = { ...this.values };\n Object.keys(this.checkboxes).forEach((key) => {\n const option = this._getOptionByQuestion(key);\n newValues[key] = !!(\n option.checked === 'true' || option.checked === true\n );\n if (\n this.defaultValues &&\n Object.prototype.hasOwnProperty.call(this.defaultValues, key)\n ) {\n newValues[key] = this.defaultValues[key];\n }\n const hiddenFieldName = `NC_HIDDEN_${key}`;\n newValues[hiddenFieldName] = option[hiddenFieldName];\n this._onChange(hiddenFieldName, newValues[key] ? 'OPT_IN' : null);\n });\n if (JSON.stringify(this.values) !== JSON.stringify(newValues)) {\n this.values = newValues;\n }\n }\n }\n countryChangeAction() {\n const splitValue = this.language;\n if (splitValue == 'en') {\n this.preText = this.preTextTemplate();\n }\n /**\n * @description if the user already interacted with the checkboxes,\n * skip country default selection.\n */\n if (!this.changed && !this.fetchedPref) {\n /**\n * @description\n * change checkbox checked option based on new country.\n */\n this.setDefaultSelections();\n }\n }\n countryChanged() {\n resetToWorldWideContent();\n this.countryChangeAction();\n }\n /**\n *\n * @param name name of the attribute\n * @param oldVal old value of the attribute\n * @param newVal new value of the attrbute\n */\n attributeChangedCallback(name, oldVal, newVal) {\n const hasValue = newVal !== null && oldVal !== null;\n super.attributeChangedCallback(name, oldVal, newVal);\n switch (name) {\n case 'question-choices': {\n // Reload checkbox options when questionchoices changed\n if (oldVal !== newVal) {\n this.prepareCheckboxes();\n this.setDefaultSelections();\n }\n break;\n }\n case 'language': {\n // load content when locale changed.\n const [language] = newVal.split(/[-_]/);\n\n let defaultLanguage = 'en';\n if (supportedLanguages(newVal)) {\n defaultLanguage = supportedLanguages(newVal);\n } else if (supportedLanguages(language)) {\n defaultLanguage = supportedLanguages(language);\n }\n\n if (hasValue && oldVal !== newVal) {\n loadContent(\n defaultLanguage,\n (ncData) => {\n this.ncData = ncData;\n this.prepareCheckboxes();\n },\n () => {\n this.defaultLoadContent();\n }\n );\n }\n break;\n }\n case 'country': {\n /**\n * load content when country value changed.\n */\n if (\n hasValue &&\n oldVal !== newVal &&\n countrySettings[newVal.toLocaleLowerCase()]\n ) {\n this.countryChanged();\n }\n break;\n }\n case 'enable-all-opt-in':\n this.setDefaultSelections();\n break;\n case 'email': {\n if (newVal) {\n if (newVal !== this.fetchedPref) {\n // Handle throttle using debounce approach.\n if (emailRegExp.test(newVal)) {\n setTimeout(() => {\n this.emailChanged(newVal);\n }, 1000);\n }\n }\n } else {\n if (this.fetchedPref) {\n this.fetchedPref = newVal;\n }\n }\n break;\n }\n }\n }\n\n private checkBoxChange($event: any) {\n const id = $event.target.id;\n\n const checked = $event.target.checked;\n const newValues = {\n ...this.values,\n };\n newValues[id] = !!checked;\n this.values = newValues;\n\n this.changed = true;\n const hiddenFieldName = `NC_HIDDEN_${id}`;\n const hiddenFieldStatus = checked ? 'PERMISSION' : 'SUPPRESSION';\n this.values[id] = {};\n this.values[id]['checkBoxStatus'] = hiddenFieldStatus;\n this._onChange(hiddenFieldName, hiddenFieldStatus);\n }\n static get stableSelector() {\n return `${ddsPrefix}--notice-choice`;\n }\n static styles = styles; // `styles` here is a `CSSResult` generated by custom WebPack loader\n checkBoxTemplate(checkbox, checked, hiddenBox) {\n return html`<span>\n <div class=\"${prefix}--form-item bx--checkbox-wrapper\">\n <input\n type=\"checkbox\"\n class=\"${prefix}--checkbox\"\n id=\"${checkbox.id}\"\n name=\"${checkbox.id}\"\n ?checked=${checked}\n @change=\"${this.checkBoxChange}\" />\n <label\n for=\"${checkbox.id}\"\n class=\"${prefix}--checkbox-label ${prefix}--nc__checkbox-${checkbox.id}\"\n ><span class=\"${prefix}--checkbox-label-text\" dir=\"auto\"\n >${checkbox.labelText}\n </span>\n </label>\n <input\n type=\"hidden\"\n id=${hiddenBox.id}\n name=${hiddenBox.id}\n value=${hiddenBox.value} />\n </div>\n </span>`;\n }\n preTextTemplate() {\n if (this.ncData) {\n const country = this.country?.toLocaleLowerCase();\n const ecmTranslateContent = this.ncData;\n let preText = ecmTranslateContent.preText;\n\n if (ecmTranslateContent.state[country]) {\n const state = this.state.toLocaleLowerCase() || '';\n if (\n country === 'us' &&\n (state === 'ca' || state === '' || typeof state === 'undefined')\n ) {\n preText = ecmTranslateContent.state[country]['ca'].preText;\n } else {\n preText = ecmTranslateContent.state[country][state]\n ? ecmTranslateContent.state[country][state].preText\n : ecmTranslateContent.preText;\n }\n }\n\n if (ecmTranslateContent.country[country]) {\n preText = ecmTranslateContent.country[country.toLowerCase()].preText;\n }\n\n return html`${unsafeHTML(preText)}`;\n } else {\n return html``;\n }\n }\n postTextTemplate() {\n if (this.ncData) {\n const OtherPreferences = this.ncData.trialPrivacyText;\n let postText = this.ncData.postText;\n\n if (postText) {\n postText = '<p part=\"ncPostText\">' + postText + '</p>';\n }\n\n if (!this.termsConditionLink.strings && this.termsConditionLink) {\n let originalValue = OtherPreferences;\n const matchedValue = originalValue.match(/<tc>.*<\\/tc>/g);\n if (matchedValue) {\n const anrTagHtml = matchedValue[0].replace(/<tc>|<\\/tc>/g, '');\n const link = `<a href='${this.termsConditionLink}' target='_blank' class='ibm-tooltip' >${anrTagHtml}</a>`;\n const reg = new RegExp('<tc>' + anrTagHtml + '</tc>', 'g');\n postText = postText + originalValue.replace(reg, link);\n }\n }\n if (postText !== '') {\n postText =\n \"<div part='ncPostTextContainer' id='ncPostTextContainer'>\" +\n postText +\n '</div>';\n }\n return html`${unsafeHTML(postText)}`;\n } else {\n return html``;\n }\n }\n getBpidLegalText() {\n if (this.bpidLegalText) {\n return html`<p>${this.bpidLegalText}</p>`;\n } else {\n return ``;\n }\n }\n render() {\n return html`<section class=\"${prefix}--nc\">\n <p part='ncHeading' id=\"ncHeading\" class=\"${ddsPrefix}--nc__pre-text\">${this.preTextTemplate()} </p>\n <div part='${prefix}--checkbox-group' class=\"${prefix}--checkbox-group\">\n ${\n Object.keys(this.checkboxes).length !== 0\n ? Object.keys(this.checkboxes).length > 0 &&\n Object.keys(this.checkboxes).map((key) => {\n const checked = this.values[key];\n const checkbox = this.checkboxes[key];\n const hiddenBox = {\n id: 'NC_HIDDEN_' + key,\n value: this.values[key]['checkBoxStatus']\n ? this.values[key]['checkBoxStatus']\n : this.values[key]\n ? 'PERMISSION'\n : 'UNCHANGED',\n };\n key === 'EMAIL' ? (this.hiddenEmail = hiddenBox.value) : '';\n key === 'PHONE' ? (this.hiddenPhone = hiddenBox.value) : '';\n return this.checkBoxTemplate(checkbox, checked, hiddenBox);\n })\n : ''\n }\n\n </div>\n <div part='${prefix}--nc__post-text' class=\"${prefix}--nc__post-text\"\n >${this.postTextTemplate()}</div>\n \n </div>\n ${this.getBpidLegalText()}\n </section>`;\n }\n protected emailChanged(email) {\n if (this.changed === false) {\n checkPreferencesv3(email).then((response) => {\n const questionChoiceStatus =\n countrySettings[this.country.toLocaleLowerCase()];\n\n if (response === 'S' && questionChoiceStatus.email === 'opt-out') {\n this.values = {\n ...this.values,\n EMAIL: false,\n ...{ checkBoxStatus: 'UNCHANGED' },\n };\n this._onChange('NC_HIDDEN_EMAIL', null);\n } else {\n this.values = {\n ...this.values,\n EMAIL: questionChoiceStatus.email === 'opt-out' ? true : false,\n ...{\n checkBoxStatus:\n questionChoiceStatus.email === 'opt-out'\n ? 'PERMISSION'\n : 'UNCHANGED',\n },\n };\n this._onChange('NC_HIDDEN_EMAIL', null);\n }\n });\n }\n }\n protected _getOptionByQuestion = (question) => {\n const questionChoiceStatus = this.country\n ? countrySettings[this.country.toLocaleLowerCase()]\n : { email: 'opt-in', phone: 'opt-in' };\n\n let option;\n switch (question) {\n case 'EMAIL': {\n option = {\n id: '0',\n checked: questionChoiceStatus.email === 'opt-out' ? true : false,\n optionTextPost: this.ncData.email,\n NC_HIDDEN_EMAIL:\n questionChoiceStatus.email === 'opt-out' ? 'OPT_OUT' : 'OPT_IN',\n };\n break;\n }\n case 'PHONE': {\n option = {\n id: '1',\n checked: questionChoiceStatus.phone === 'opt-out' ? true : false,\n optionTextPost: this.ncData.telephone,\n NC_HIDDEN_PHONE:\n questionChoiceStatus.phone === 'opt-out' ? 'OPT_OUT' : 'OPT_IN',\n };\n break;\n }\n\n default: {\n option = {\n id: '0',\n checked: questionChoiceStatus.email === 'opt-out' ? true : false,\n optionTextPost: this.ncData.email,\n NC_HIDDEN_EMAIL:\n questionChoiceStatus.email === 'opt-out' ? 'OPT_OUT' : 'OPT_IN',\n };\n break;\n }\n }\n\n return option;\n };\n protected _buildCheckboxes() {\n const fieldElements: any = {};\n const fieldCollections = {\n EMAIL: {\n id: 'EMAIL',\n labelText: this._getOptionByQuestion('EMAIL').optionTextPost,\n },\n PHONE: {\n id: 'PHONE',\n labelText: this._getOptionByQuestion('PHONE').optionTextPost,\n },\n };\n if (this.questionchoices) {\n // by email\n if (this.questionchoices.indexOf('1') > -1) {\n fieldElements.EMAIL = fieldCollections.EMAIL;\n }\n // by Phone\n if (this.questionchoices.indexOf('2') > -1) {\n fieldElements.PHONE = fieldCollections.PHONE;\n }\n }\n return fieldElements;\n }\n\n _onChange(field: string, value: string | null) {\n const pwsFieldsMap = {\n NC_HIDDEN_EMAIL: 'permission_email',\n NC_HIDDEN_PHONE: 'permission_phone',\n };\n\n if (Object.prototype.hasOwnProperty.call(pwsFieldsMap, field)) {\n field = pwsFieldsMap[field];\n }\n\n const init = {\n bubbles: true,\n detail: {\n field,\n value: pwsValueMap(value),\n },\n };\n this.dispatchEvent(\n new CustomEvent(`${ddsPrefix}-notice-choice-change`, init)\n );\n }\n}\n\nexport default NoticeChoice;\n"]}
1
+ {"version":3,"sources":["components/notice-choice/notice-choice.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAQ,UAAU,EAAY,cAAc,EAAE,MAAM,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBzE;;;;;;;GAOG;AACH,cACM,YAAa,SAAQ,iBAA+B;IACxD;;OAEG;IAEH,eAAe,SAAO;IAGtB,OAAO,SAAQ;IAGf,KAAK,SAAM;IAGX,QAAQ,SAAQ;IAGhB,kBAAkB,iBAAU;IAG5B,aAAa,iBAAU;IAGvB,cAAc,MAAC;IAGf,aAAa,KAAM;IAGnB,KAAK,SAAM;IAGX,gBAAgB,UAAS;IAGzB,eAAe,UAAQ;IAGvB,UAAU,KAAM;IAGhB,MAAM,EAAE,GAAG,CAAC;IAGZ,OAAO,UAAS;IAGhB,WAAW,SAAM;IAGjB,YAAY,KAAM;IAGlB,qBAAqB,UAAS;IAE9B;;OAEG;IAEH;;OAEG;IAEH,OAAO,iBAAU;IAGjB,cAAc,iBAAU;IAGxB,MAAM;;;;;MAKJ;IAGF,WAAW,SAAM;IAGjB,WAAW,SAAM;IAEjB,iBAAiB;IAUjB,kBAAkB;IAalB,iBAAiB;IAuBjB,oBAAoB;IAwBpB,mBAAmB;IAsBnB,cAAc;IAId;;;;;OAKG;IACH,wBAAwB,CAAC,IAAI,KAAA,EAAE,MAAM,KAAA,EAAE,MAAM,KAAA;IAqF7C,OAAO,CAAC,cAAc;IAqBtB,MAAM,KAAK,cAAc,WAExB;IACD,MAAM,CAAC,MAAM,MAAU;IACvB,mBAAmB,CAAC,MAAM,EAAE,GAAG;IAmB/B,uBAAuB;IAkDvB,gBAAgB,CAAC,QAAQ,KAAA,EAAE,OAAO,KAAA,EAAE,SAAS,KAAA;IA0B7C,eAAe;IA6Bf,gBAAgB;IAmChB,gBAAgB;IAOhB,MAAM;IAqCN,SAAS,CAAC,YAAY,CAAC,KAAK,KAAA;IA6B5B,SAAS,CAAC,oBAAoB,yBAyC5B;IACF,SAAS,CAAC,gBAAgB;IAyB1B,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAyB9C;AAED,eAAe,YAAY,CAAC","file":"notice-choice.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2020, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { checkPreferencesv3, loadContent } from './services';\nimport { html, LitElement, property, TemplateResult } from 'lit-element';\nimport {\n emailRegExp,\n pwsValueMap,\n resetToWorldWideContent,\n supportedLanguages,\n} from './utils';\nimport countrySettings from './country-settings';\nimport ddsSettings from '../../internal/vendor/@carbon/ibmdotcom-utilities/utilities/settings/settings';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport StableSelectorMixin from '../../globals/mixins/stable-selector';\nimport styles from './notice-choice.scss';\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html';\nimport { worldWideContent } from './world-wide-content';\nimport { carbonElement as customElement } from '../../internal/vendor/@carbon/web-components/globals/decorators/carbon-element';\n\nconst { stablePrefix: ddsPrefix } = ddsSettings;\nconst { prefix } = settings;\n\n/**\n * Notice Choice\n *\n * @element dds-notice-choice\n * @fires dds-notice-choice-change\n * The custom event fired when default choice loaded or user change some preferences.\n * The field and value should be taken from the detail object and send it to MRS.\n */\n@customElement(`dds-notice-choice`)\nclass NoticeChoice extends StableSelectorMixin(LitElement) {\n /**\n * properties for passed attributes.\n */\n @property({ type: String, reflect: true, attribute: 'question-choices' })\n questionchoices = '1';\n\n @property({ type: String, attribute: 'country' })\n country = 'US';\n\n @property({ type: String, attribute: 'state' })\n state = '';\n\n @property({ type: String, attribute: 'language' })\n language = 'en';\n\n @property({ type: String, attribute: 'terms-condition-link' })\n termsConditionLink = html``;\n\n @property({ type: String, attribute: 'bpid-legal-text' })\n bpidLegalText = html``;\n\n @property({ type: Boolean, attribute: 'enable-all-opt-in' })\n enableAllOptIn;\n\n @property({ attribute: 'default-values' })\n defaultValues = {};\n\n @property({ type: String, attribute: 'email' })\n email = '';\n\n @property({ type: Boolean, attribute: 'hide-error-message' })\n hideErrorMessage = false;\n\n @property({ type: Boolean, attribute: 'show-legal-notice' })\n showLegalNotice = true;\n\n @property({ type: Object, attribute: false })\n checkboxes = {};\n\n @property({ type: Object, attribute: false })\n ncData: any;\n\n @property({ type: Boolean, attribute: false })\n changed = false;\n\n @property({ type: String, attribute: false })\n fetchedPref = '';\n\n @property({ type: Object, attribute: false })\n optInContent = {};\n\n @property({ type: Boolean, attribute: false })\n preventFormSubmission = false;\n\n /**\n * End properties for passed attributes.\n */\n\n /**\n * properties for local state state management.\n */\n @property({ type: html, attribute: false })\n preText = html``;\n\n @property({ type: html, attribute: false })\n defaultPreText = html``;\n\n @property({ type: Object, attribute: false })\n values = {\n EMAIL: false,\n PHONE: false,\n NC_HIDDEN_EMAIL: worldWideContent.cc_default_status,\n NC_HIDDEN_PHONE: worldWideContent.cc_default_status,\n };\n\n @property({ reflect: true })\n hiddenEmail = '';\n\n @property({ reflect: true })\n hiddenPhone = '';\n\n prepareCheckboxes() {\n if (this.ncData) {\n const OptInContent = this.ncData;\n this.preText = OptInContent.preText;\n this.defaultPreText = OptInContent.preText;\n const newCheckboxes = this._buildCheckboxes();\n this.checkboxes = newCheckboxes;\n this.performUpdate();\n }\n }\n defaultLoadContent() {\n loadContent(\n 'en',\n (ncData) => {\n this.ncData = ncData;\n this.prepareCheckboxes();\n this.countryChanged();\n },\n (error) => {\n console.error('error loading content', error);\n }\n );\n }\n connectedCallback() {\n super.connectedCallback();\n const [language] = this.language.split(/[-_]/);\n\n let defaultLanguage = 'en';\n if (supportedLanguages(this.language)) {\n defaultLanguage = supportedLanguages(this.language);\n } else if (supportedLanguages(language)) {\n defaultLanguage = supportedLanguages(language);\n }\n\n loadContent(\n defaultLanguage,\n (ncData) => {\n this.ncData = ncData;\n this.prepareCheckboxes();\n this.countryChanged();\n },\n () => {\n this.defaultLoadContent();\n }\n );\n }\n setDefaultSelections() {\n if (!this.enableAllOptIn && this.checkboxes) {\n const newValues = { ...this.values };\n Object.keys(this.checkboxes).forEach((key) => {\n const option = this._getOptionByQuestion(key);\n newValues[key] = !!(\n option.checked === 'true' || option.checked === true\n );\n if (\n this.defaultValues &&\n Object.prototype.hasOwnProperty.call(this.defaultValues, key)\n ) {\n newValues[key] = this.defaultValues[key];\n }\n const hiddenFieldName = `NC_HIDDEN_${key}`;\n newValues[hiddenFieldName] = option[hiddenFieldName];\n\n this._onChange(hiddenFieldName, newValues[key] ? 'OPT_IN' : 'OPT_OUT');\n });\n if (JSON.stringify(this.values) !== JSON.stringify(newValues)) {\n this.values = newValues;\n }\n }\n }\n countryChangeAction() {\n const splitValue = this.language;\n if (splitValue == 'en') {\n this.preText = this.preTextTemplate();\n }\n this.preventFormSubmission = false;\n if (this.ncData?.mandatoryCheckbox[this.country?.toLocaleLowerCase()]) {\n this.preventFormSubmission = true;\n this._onChange('preventFormSubmission', 'formSubmissionNo');\n }\n /**\n * @description if the user already interacted with the checkboxes,\n * skip country default selection.\n */\n if (!this.changed && !this.fetchedPref) {\n /**\n * @description\n * change checkbox checked option based on new country.\n */\n this.setDefaultSelections();\n }\n }\n countryChanged() {\n resetToWorldWideContent();\n this.countryChangeAction();\n }\n /**\n *\n * @param name name of the attribute\n * @param oldVal old value of the attribute\n * @param newVal new value of the attrbute\n */\n attributeChangedCallback(name, oldVal, newVal) {\n const hasValue = newVal !== null && oldVal !== null;\n super.attributeChangedCallback(name, oldVal, newVal);\n switch (name) {\n case 'question-choices': {\n // Reload checkbox options when questionchoices changed\n if (oldVal !== newVal) {\n this.prepareCheckboxes();\n this.setDefaultSelections();\n }\n break;\n }\n case 'language': {\n // load content when locale changed.\n const [language] = newVal.split(/[-_]/);\n\n let defaultLanguage = 'en';\n if (supportedLanguages(newVal)) {\n defaultLanguage = supportedLanguages(newVal);\n } else if (supportedLanguages(language)) {\n defaultLanguage = supportedLanguages(language);\n }\n\n if (hasValue && oldVal !== newVal) {\n loadContent(\n defaultLanguage,\n (ncData) => {\n this.ncData = ncData;\n this.prepareCheckboxes();\n },\n () => {\n this.defaultLoadContent();\n }\n );\n }\n break;\n }\n case 'country': {\n /**\n * load content when country value changed.\n */\n if (\n hasValue &&\n oldVal !== newVal &&\n countrySettings[newVal.toLocaleLowerCase()]\n ) {\n this.countryChanged();\n }\n break;\n }\n case 'enable-all-opt-in':\n this.setDefaultSelections();\n break;\n case 'email': {\n if (newVal) {\n if (newVal !== this.fetchedPref) {\n // Handle throttle using debounce approach.\n if (emailRegExp.test(newVal)) {\n setTimeout(() => {\n this.emailChanged(newVal);\n }, 1000);\n }\n }\n } else {\n if (this.fetchedPref) {\n this.fetchedPref = newVal;\n }\n }\n break;\n }\n case 'hide-error-message': {\n if (oldVal !== newVal) {\n this.hideErrorMessage = JSON.parse(newVal);\n this.countryBasedLegalNotice();\n }\n\n break;\n }\n case 'show-legal-notice': {\n this.showLegalNotice = JSON.parse(newVal);\n break;\n }\n }\n }\n\n private checkBoxChange($event: any) {\n const id = $event.target.id;\n\n const checked = $event.target.checked;\n const newValues = {\n ...this.values,\n };\n newValues[id] = !!checked;\n this.values = newValues;\n\n this.changed = true;\n const hiddenFieldName = `NC_HIDDEN_${id}`;\n const hiddenFieldStatus = checked ? 'PERMISSION' : 'SUPPRESSION';\n this.values[id] = {};\n this.values[id]['checkBoxStatus'] = hiddenFieldStatus;\n this._onChange(hiddenFieldName, hiddenFieldStatus);\n this._onChange(\n `${hiddenFieldName}_VALUE`,\n `NC_HIDDEN_${hiddenFieldStatus}`\n );\n }\n static get stableSelector() {\n return `${ddsPrefix}--notice-choice`;\n }\n static styles = styles; // `styles` here is a `CSSResult` generated by custom WebPack loader\n checkBoxLegalChange($event: any) {\n const legalCheckbox = $event.target;\n const isChecked = legalCheckbox.checked;\n const legalTextError = legalCheckbox.parentNode.querySelector('.nc-error');\n const qChinaPIPl = isChecked ? 'qChinaPIPlYes' : 'qChinaPIPlNo';\n\n if (legalTextError) {\n legalTextError.style.display = isChecked ? 'none' : '';\n }\n\n legalCheckbox.value = isChecked ? 1 : 0;\n this.preventFormSubmission = !isChecked;\n const preventFormSubmissionValue = isChecked\n ? 'formSubmissionYes'\n : 'formSubmissionNo';\n this._onChange('preventFormSubmission', preventFormSubmissionValue);\n this._onChange('Q_CHINA_PIPL', qChinaPIPl);\n }\n\n countryBasedLegalNotice() {\n const country = this.country.toLocaleLowerCase();\n const itemTemplates: Array<TemplateResult> = [];\n\n if (\n this.ncData?.mandatoryCheckbox &&\n this.ncData.mandatoryCheckbox[country]\n ) {\n const mandatoryCheckboxes: { [key: string]: any } =\n this.ncData.mandatoryCheckbox[country];\n\n for (const [key, mandatoryCheckbox] of Object.entries(\n mandatoryCheckboxes\n )) {\n const legalTextName = key.replace(/([A-Z]+)/g, '-$1').toLowerCase();\n let mandatoryCheckboxTemplate = html`\n <span>\n <div class=\"${prefix}--form-item bx--checkbox-wrapper\">\n <p part=${legalTextName} class=${legalTextName}>\n <input\n type=\"checkbox\"\n class=\"${prefix}--checkbox\"\n id=\"${mandatoryCheckbox.mrs_field}\"\n name=\"${mandatoryCheckbox.mrs_field}\"\n @change=\"${this.checkBoxLegalChange}\" />\n <label\n for=\"${mandatoryCheckbox.mrs_field}\"\n class=\"${prefix}--checkbox-label ${prefix}--nc__checkbox-${mandatoryCheckbox.mrs_field}\"\n ><span class=\"${prefix}--checkbox-label-text\" dir=\"auto\"\n >${mandatoryCheckbox.text}\n </span>\n </label>\n ${!this.hideErrorMessage && this.preventFormSubmission\n ? html`<span\n class=\"nc-error\"\n style=\"color:#da1e28;font-size:.75rem\"\n >${mandatoryCheckbox.error}</span\n >`\n : ''}\n </p>\n </div>\n </span>\n `;\n itemTemplates.push(mandatoryCheckboxTemplate);\n }\n }\n\n return itemTemplates;\n }\n\n checkBoxTemplate(checkbox, checked, hiddenBox) {\n this._onChange(`${hiddenBox.id}_VALUE`, `NC_HIDDEN_${hiddenBox.value}`);\n return html`<span>\n <div class=\"${prefix}--form-item bx--checkbox-wrapper\">\n <input\n type=\"checkbox\"\n class=\"${prefix}--checkbox\"\n id=\"${checkbox.id}\"\n name=\"${checkbox.id}\"\n ?checked=${checked}\n @change=\"${this.checkBoxChange}\" />\n <label\n for=\"${checkbox.id}\"\n class=\"${prefix}--checkbox-label ${prefix}--nc__checkbox-${checkbox.id}\"\n ><span class=\"${prefix}--checkbox-label-text\" dir=\"auto\"\n >${checkbox.labelText}\n </span>\n </label>\n <input\n type=\"hidden\"\n id=${hiddenBox.id}\n name=${hiddenBox.id}\n value=${hiddenBox.value} />\n </div>\n </span>`;\n }\n preTextTemplate() {\n if (this.ncData) {\n const country = this.country?.toLocaleLowerCase();\n const ecmTranslateContent = this.ncData;\n let preText = ecmTranslateContent.preText;\n\n if (ecmTranslateContent.state[country]) {\n const state = this.state.toLocaleLowerCase() || '';\n if (\n country === 'us' &&\n (state === 'ca' || state === '' || typeof state === 'undefined')\n ) {\n preText = ecmTranslateContent.state[country]['ca'].preText;\n } else {\n preText = ecmTranslateContent.state[country][state]\n ? ecmTranslateContent.state[country][state].preText\n : ecmTranslateContent.preText;\n }\n }\n\n if (ecmTranslateContent.country[country]) {\n preText = ecmTranslateContent.country[country.toLowerCase()].preText;\n }\n\n return html`${unsafeHTML(preText)}`;\n } else {\n return html``;\n }\n }\n postTextTemplate() {\n if (this.ncData) {\n const OtherPreferences = this.ncData.trialPrivacyText;\n let postText = this.ncData.postText;\n\n if (postText) {\n postText = '<p part=\"ncPostText\">' + postText + '</p>';\n }\n\n if (!this.termsConditionLink.strings && this.termsConditionLink) {\n let originalValue = OtherPreferences;\n const matchedValue = originalValue.match(/<tc>.*<\\/tc>/g);\n if (matchedValue) {\n const anrTagHtml = matchedValue[0].replace(/<tc>|<\\/tc>/g, '');\n const link = `<a href='${this.termsConditionLink}' target='_blank' class='ibm-tooltip' >${anrTagHtml}</a>`;\n const reg = new RegExp('<tc>' + anrTagHtml + '</tc>', 'g');\n\n postText =\n postText +\n originalValue\n .replace(reg, link)\n .replace(/<p>/g, '<p part=\"nc-trial-text\" id=\"nc-trial-text\">');\n }\n }\n if (postText !== '') {\n postText =\n \"<div part='ncPostTextContainer' id='ncPostTextContainer'>\" +\n postText +\n '</div>';\n }\n return html`${unsafeHTML(postText)}`;\n } else {\n return html``;\n }\n }\n getBpidLegalText() {\n if (this.bpidLegalText) {\n return html`<p>${this.bpidLegalText}</p>`;\n } else {\n return ``;\n }\n }\n render() {\n return html`<section class=\"${prefix}--nc\">\n <p part='ncHeading' id=\"ncHeading\" class=\"${ddsPrefix}--nc__pre-text\">${\n this.showLegalNotice ? this.countryBasedLegalNotice() : ''\n } ${this.preTextTemplate()} </p>\n <div part='${prefix}--checkbox-group' class=\"${prefix}--checkbox-group\">\n ${\n Object.keys(this.checkboxes).length !== 0\n ? Object.keys(this.checkboxes).length > 0 &&\n Object.keys(this.checkboxes).map((key) => {\n const checked = this.values[key];\n const checkbox = this.checkboxes[key];\n const hiddenBox = {\n id: 'NC_HIDDEN_' + key,\n value: this.values[key]['checkBoxStatus']\n ? this.values[key]['checkBoxStatus']\n : this.values[key]\n ? 'PERMISSION'\n : 'UNCHANGED',\n };\n key === 'EMAIL' ? (this.hiddenEmail = hiddenBox.value) : '';\n key === 'PHONE' ? (this.hiddenPhone = hiddenBox.value) : '';\n return this.checkBoxTemplate(checkbox, checked, hiddenBox);\n })\n : ''\n }\n\n </div>\n <div part='${prefix}--nc__post-text' class=\"${prefix}--nc__post-text\"\n >${this.postTextTemplate()}</div>\n <input type='hidden' id=\"preventFormSubmission\" name=\"preventFormSubmission\" value=${\n this.preventFormSubmission\n } />\n </div>\n ${this.getBpidLegalText()}\n </section>`;\n }\n protected emailChanged(email) {\n if (this.changed === false) {\n checkPreferencesv3(email).then((response) => {\n const questionChoiceStatus =\n countrySettings[this.country.toLocaleLowerCase()];\n\n if (response === 'S' && questionChoiceStatus.email === 'opt-out') {\n this.values = {\n ...this.values,\n EMAIL: false,\n ...{ checkBoxStatus: 'UNCHANGED' },\n };\n this._onChange('NC_HIDDEN_EMAIL', null);\n } else {\n this.values = {\n ...this.values,\n EMAIL: questionChoiceStatus.email === 'opt-out' ? true : false,\n ...{\n checkBoxStatus:\n questionChoiceStatus.email === 'opt-out'\n ? 'PERMISSION'\n : 'UNCHANGED',\n },\n };\n this._onChange('NC_HIDDEN_EMAIL', null);\n }\n });\n }\n }\n protected _getOptionByQuestion = (question) => {\n const questionChoiceStatus = this.country\n ? countrySettings[this.country.toLocaleLowerCase()]\n : { email: 'opt-in', phone: 'opt-in' };\n\n let option;\n switch (question) {\n case 'EMAIL': {\n option = {\n id: '0',\n checked: questionChoiceStatus.email === 'opt-out' ? true : false,\n optionTextPost: this.ncData.email,\n NC_HIDDEN_EMAIL:\n questionChoiceStatus.email === 'opt-out' ? 'OPT_OUT' : 'OPT_IN',\n };\n break;\n }\n case 'PHONE': {\n option = {\n id: '1',\n checked: questionChoiceStatus.phone === 'opt-out' ? true : false,\n optionTextPost: this.ncData.telephone,\n NC_HIDDEN_PHONE:\n questionChoiceStatus.phone === 'opt-out' ? 'OPT_OUT' : 'OPT_IN',\n };\n break;\n }\n\n default: {\n option = {\n id: '0',\n checked: questionChoiceStatus.email === 'opt-out' ? true : false,\n optionTextPost: this.ncData.email,\n NC_HIDDEN_EMAIL:\n questionChoiceStatus.email === 'opt-out' ? 'OPT_OUT' : 'OPT_IN',\n };\n break;\n }\n }\n\n return option;\n };\n protected _buildCheckboxes() {\n const fieldElements: any = {};\n const fieldCollections = {\n EMAIL: {\n id: 'EMAIL',\n labelText: this._getOptionByQuestion('EMAIL').optionTextPost,\n },\n PHONE: {\n id: 'PHONE',\n labelText: this._getOptionByQuestion('PHONE').optionTextPost,\n },\n };\n if (this.questionchoices) {\n // by email\n if (this.questionchoices.indexOf('1') > -1) {\n fieldElements.EMAIL = fieldCollections.EMAIL;\n }\n // by Phone\n if (this.questionchoices.indexOf('2') > -1) {\n fieldElements.PHONE = fieldCollections.PHONE;\n }\n }\n return fieldElements;\n }\n\n _onChange(field: string, value: string | null) {\n const pwsFieldsMap = {\n NC_HIDDEN_EMAIL: 'permission_email',\n NC_HIDDEN_PHONE: 'permission_phone',\n preventFormSubmission: 'preventFormSubmission',\n Q_CHINA_PIPL: 'Q_CHINA_PIPL',\n NC_HIDDEN_EMAIL_VALUE: 'NC_HIDDEN_EMAIL',\n NC_HIDDEN_PHONE_VALUE: 'NC_HIDDEN_PHONE',\n };\n\n if (Object.prototype.hasOwnProperty.call(pwsFieldsMap, field)) {\n field = pwsFieldsMap[field];\n }\n\n const init = {\n bubbles: true,\n detail: {\n field,\n value: pwsValueMap(value),\n },\n };\n this.dispatchEvent(\n new CustomEvent(`${ddsPrefix}-notice-choice-change`, init)\n );\n }\n}\n\nexport default NoticeChoice;\n"]}
@@ -27,7 +27,7 @@ var _noticeChoiceCss = _interopRequireDefault(require("././notice-choice.css.js"
27
27
  var _unsafeHtml = require("lit-html/directives/unsafe-html");
28
28
  var _worldWideContent = require("./world-wide-content.js");
29
29
  var _carbonElement = require("../../internal/vendor/@carbon/web-components/globals/decorators/carbon-element.js");
30
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
30
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
31
31
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
32
32
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
33
33
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
@@ -163,6 +163,26 @@ var NoticeChoice = (0, _decorate2["default"])([(0, _carbonElement.carbonElement)
163
163
  value: function value() {
164
164
  return '';
165
165
  }
166
+ }, {
167
+ kind: "field",
168
+ decorators: [(0, _litElement.property)({
169
+ type: Boolean,
170
+ attribute: 'hide-error-message'
171
+ })],
172
+ key: "hideErrorMessage",
173
+ value: function value() {
174
+ return false;
175
+ }
176
+ }, {
177
+ kind: "field",
178
+ decorators: [(0, _litElement.property)({
179
+ type: Boolean,
180
+ attribute: 'show-legal-notice'
181
+ })],
182
+ key: "showLegalNotice",
183
+ value: function value() {
184
+ return true;
185
+ }
166
186
  }, {
167
187
  kind: "field",
168
188
  decorators: [(0, _litElement.property)({
@@ -211,6 +231,16 @@ var NoticeChoice = (0, _decorate2["default"])([(0, _carbonElement.carbonElement)
211
231
  value: function value() {
212
232
  return {};
213
233
  }
234
+ }, {
235
+ kind: "field",
236
+ decorators: [(0, _litElement.property)({
237
+ type: Boolean,
238
+ attribute: false
239
+ })],
240
+ key: "preventFormSubmission",
241
+ value: function value() {
242
+ return false;
243
+ }
214
244
  }, {
215
245
  kind: "field",
216
246
  decorators: [(0, _litElement.property)({
@@ -339,7 +369,7 @@ var NoticeChoice = (0, _decorate2["default"])([(0, _carbonElement.carbonElement)
339
369
  }
340
370
  var hiddenFieldName = "NC_HIDDEN_".concat(key);
341
371
  newValues[hiddenFieldName] = option[hiddenFieldName];
342
- _this4._onChange(hiddenFieldName, newValues[key] ? 'OPT_IN' : null);
372
+ _this4._onChange(hiddenFieldName, newValues[key] ? 'OPT_IN' : 'OPT_OUT');
343
373
  });
344
374
  if (JSON.stringify(this.values) !== JSON.stringify(newValues)) {
345
375
  this.values = newValues;
@@ -350,10 +380,16 @@ var NoticeChoice = (0, _decorate2["default"])([(0, _carbonElement.carbonElement)
350
380
  kind: "method",
351
381
  key: "countryChangeAction",
352
382
  value: function countryChangeAction() {
383
+ var _this$ncData, _this$country;
353
384
  var splitValue = this.language;
354
385
  if (splitValue == 'en') {
355
386
  this.preText = this.preTextTemplate();
356
387
  }
388
+ this.preventFormSubmission = false;
389
+ if ((_this$ncData = this.ncData) !== null && _this$ncData !== void 0 && _this$ncData.mandatoryCheckbox[(_this$country = this.country) === null || _this$country === void 0 ? void 0 : _this$country.toLocaleLowerCase()]) {
390
+ this.preventFormSubmission = true;
391
+ this._onChange('preventFormSubmission', 'formSubmissionNo');
392
+ }
357
393
  /**
358
394
  * @description if the user already interacted with the checkboxes,
359
395
  * skip country default selection.
@@ -449,6 +485,19 @@ var NoticeChoice = (0, _decorate2["default"])([(0, _carbonElement.carbonElement)
449
485
  }
450
486
  break;
451
487
  }
488
+ case 'hide-error-message':
489
+ {
490
+ if (oldVal !== newVal) {
491
+ this.hideErrorMessage = JSON.parse(newVal);
492
+ this.countryBasedLegalNotice();
493
+ }
494
+ break;
495
+ }
496
+ case 'show-legal-notice':
497
+ {
498
+ this.showLegalNotice = JSON.parse(newVal);
499
+ break;
500
+ }
452
501
  }
453
502
  }
454
503
  }, {
@@ -466,6 +515,7 @@ var NoticeChoice = (0, _decorate2["default"])([(0, _carbonElement.carbonElement)
466
515
  this.values[id] = {};
467
516
  this.values[id]['checkBoxStatus'] = hiddenFieldStatus;
468
517
  this._onChange(hiddenFieldName, hiddenFieldStatus);
518
+ this._onChange("".concat(hiddenFieldName, "_VALUE"), "NC_HIDDEN_".concat(hiddenFieldStatus));
469
519
  }
470
520
  }, {
471
521
  kind: "get",
@@ -483,18 +533,56 @@ var NoticeChoice = (0, _decorate2["default"])([(0, _carbonElement.carbonElement)
483
533
  }
484
534
  }, {
485
535
  kind: "method",
486
- key: "checkBoxTemplate",
536
+ key: "checkBoxLegalChange",
487
537
  value: // `styles` here is a `CSSResult` generated by custom WebPack loader
488
- function checkBoxTemplate(checkbox, checked, hiddenBox) {
489
- return (0, _litElement.html)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["<span>\n <div class=\"", "--form-item bx--checkbox-wrapper\">\n <input\n type=\"checkbox\"\n class=\"", "--checkbox\"\n id=\"", "\"\n name=\"", "\"\n ?checked=", "\n @change=\"", "\" />\n <label\n for=\"", "\"\n class=\"", "--checkbox-label ", "--nc__checkbox-", "\"\n ><span class=\"", "--checkbox-label-text\" dir=\"auto\"\n >", "\n </span>\n </label>\n <input\n type=\"hidden\"\n id=", "\n name=", "\n value=", " />\n </div>\n </span>"])), prefix, prefix, checkbox.id, checkbox.id, checked, this.checkBoxChange, checkbox.id, prefix, prefix, checkbox.id, prefix, checkbox.labelText, hiddenBox.id, hiddenBox.id, hiddenBox.value);
538
+ function checkBoxLegalChange($event) {
539
+ var legalCheckbox = $event.target;
540
+ var isChecked = legalCheckbox.checked;
541
+ var legalTextError = legalCheckbox.parentNode.querySelector('.nc-error');
542
+ var qChinaPIPl = isChecked ? 'qChinaPIPlYes' : 'qChinaPIPlNo';
543
+ if (legalTextError) {
544
+ legalTextError.style.display = isChecked ? 'none' : '';
545
+ }
546
+ legalCheckbox.value = isChecked ? 1 : 0;
547
+ this.preventFormSubmission = !isChecked;
548
+ var preventFormSubmissionValue = isChecked ? 'formSubmissionYes' : 'formSubmissionNo';
549
+ this._onChange('preventFormSubmission', preventFormSubmissionValue);
550
+ this._onChange('Q_CHINA_PIPL', qChinaPIPl);
551
+ }
552
+ }, {
553
+ kind: "method",
554
+ key: "countryBasedLegalNotice",
555
+ value: function countryBasedLegalNotice() {
556
+ var _this$ncData2;
557
+ var country = this.country.toLocaleLowerCase();
558
+ var itemTemplates = [];
559
+ if ((_this$ncData2 = this.ncData) !== null && _this$ncData2 !== void 0 && _this$ncData2.mandatoryCheckbox && this.ncData.mandatoryCheckbox[country]) {
560
+ var mandatoryCheckboxes = this.ncData.mandatoryCheckbox[country];
561
+ for (var _i = 0, _Object$entries = Object.entries(mandatoryCheckboxes); _i < _Object$entries.length; _i++) {
562
+ var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2),
563
+ _key2 = _Object$entries$_i[0],
564
+ mandatoryCheckbox = _Object$entries$_i[1];
565
+ var legalTextName = _key2.replace(/([A-Z]+)/g, '-$1').toLowerCase();
566
+ var mandatoryCheckboxTemplate = (0, _litElement.html)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n <span>\n <div class=\"", "--form-item bx--checkbox-wrapper\">\n <p part=", " class=", ">\n <input\n type=\"checkbox\"\n class=\"", "--checkbox\"\n id=\"", "\"\n name=\"", "\"\n @change=\"", "\" />\n <label\n for=\"", "\"\n class=\"", "--checkbox-label ", "--nc__checkbox-", "\"\n ><span class=\"", "--checkbox-label-text\" dir=\"auto\"\n >", "\n </span>\n </label>\n ", "\n </p>\n </div>\n </span>\n "])), prefix, legalTextName, legalTextName, prefix, mandatoryCheckbox.mrs_field, mandatoryCheckbox.mrs_field, this.checkBoxLegalChange, mandatoryCheckbox.mrs_field, prefix, prefix, mandatoryCheckbox.mrs_field, prefix, mandatoryCheckbox.text, !this.hideErrorMessage && this.preventFormSubmission ? (0, _litElement.html)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["<span\n class=\"nc-error\"\n style=\"color:#da1e28;font-size:.75rem\"\n >", "</span\n >"])), mandatoryCheckbox.error) : '');
567
+ itemTemplates.push(mandatoryCheckboxTemplate);
568
+ }
569
+ }
570
+ return itemTemplates;
571
+ }
572
+ }, {
573
+ kind: "method",
574
+ key: "checkBoxTemplate",
575
+ value: function checkBoxTemplate(checkbox, checked, hiddenBox) {
576
+ this._onChange("".concat(hiddenBox.id, "_VALUE"), "NC_HIDDEN_".concat(hiddenBox.value));
577
+ return (0, _litElement.html)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["<span>\n <div class=\"", "--form-item bx--checkbox-wrapper\">\n <input\n type=\"checkbox\"\n class=\"", "--checkbox\"\n id=\"", "\"\n name=\"", "\"\n ?checked=", "\n @change=\"", "\" />\n <label\n for=\"", "\"\n class=\"", "--checkbox-label ", "--nc__checkbox-", "\"\n ><span class=\"", "--checkbox-label-text\" dir=\"auto\"\n >", "\n </span>\n </label>\n <input\n type=\"hidden\"\n id=", "\n name=", "\n value=", " />\n </div>\n </span>"])), prefix, prefix, checkbox.id, checkbox.id, checked, this.checkBoxChange, checkbox.id, prefix, prefix, checkbox.id, prefix, checkbox.labelText, hiddenBox.id, hiddenBox.id, hiddenBox.value);
490
578
  }
491
579
  }, {
492
580
  kind: "method",
493
581
  key: "preTextTemplate",
494
582
  value: function preTextTemplate() {
495
583
  if (this.ncData) {
496
- var _this$country;
497
- var country = (_this$country = this.country) === null || _this$country === void 0 ? void 0 : _this$country.toLocaleLowerCase();
584
+ var _this$country2;
585
+ var country = (_this$country2 = this.country) === null || _this$country2 === void 0 ? void 0 : _this$country2.toLocaleLowerCase();
498
586
  var ecmTranslateContent = this.ncData;
499
587
  var preText = ecmTranslateContent.preText;
500
588
  if (ecmTranslateContent.state[country]) {
@@ -508,9 +596,9 @@ var NoticeChoice = (0, _decorate2["default"])([(0, _carbonElement.carbonElement)
508
596
  if (ecmTranslateContent.country[country]) {
509
597
  preText = ecmTranslateContent.country[country.toLowerCase()].preText;
510
598
  }
511
- return (0, _litElement.html)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["", ""])), (0, _unsafeHtml.unsafeHTML)(preText));
599
+ return (0, _litElement.html)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["", ""])), (0, _unsafeHtml.unsafeHTML)(preText));
512
600
  } else {
513
- return (0, _litElement.html)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])([""])));
601
+ return (0, _litElement.html)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])([""])));
514
602
  }
515
603
  }
516
604
  }, {
@@ -530,15 +618,15 @@ var NoticeChoice = (0, _decorate2["default"])([(0, _carbonElement.carbonElement)
530
618
  var anrTagHtml = matchedValue[0].replace(/<tc>|<\/tc>/g, '');
531
619
  var link = "<a href='".concat(this.termsConditionLink, "' target='_blank' class='ibm-tooltip' >").concat(anrTagHtml, "</a>");
532
620
  var reg = new RegExp('<tc>' + anrTagHtml + '</tc>', 'g');
533
- postText = postText + originalValue.replace(reg, link);
621
+ postText = postText + originalValue.replace(reg, link).replace(/<p>/g, '<p part="nc-trial-text" id="nc-trial-text">');
534
622
  }
535
623
  }
536
624
  if (postText !== '') {
537
625
  postText = "<div part='ncPostTextContainer' id='ncPostTextContainer'>" + postText + '</div>';
538
626
  }
539
- return (0, _litElement.html)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["", ""])), (0, _unsafeHtml.unsafeHTML)(postText));
627
+ return (0, _litElement.html)(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["", ""])), (0, _unsafeHtml.unsafeHTML)(postText));
540
628
  } else {
541
- return (0, _litElement.html)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])([""])));
629
+ return (0, _litElement.html)(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])([""])));
542
630
  }
543
631
  }
544
632
  }, {
@@ -546,7 +634,7 @@ var NoticeChoice = (0, _decorate2["default"])([(0, _carbonElement.carbonElement)
546
634
  key: "getBpidLegalText",
547
635
  value: function getBpidLegalText() {
548
636
  if (this.bpidLegalText) {
549
- return (0, _litElement.html)(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["<p>", "</p>"])), this.bpidLegalText);
637
+ return (0, _litElement.html)(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["<p>", "</p>"])), this.bpidLegalText);
550
638
  } else {
551
639
  return "";
552
640
  }
@@ -556,7 +644,7 @@ var NoticeChoice = (0, _decorate2["default"])([(0, _carbonElement.carbonElement)
556
644
  key: "render",
557
645
  value: function render() {
558
646
  var _this6 = this;
559
- return (0, _litElement.html)(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["<section class=\"", "--nc\">\n <p part='ncHeading' id=\"ncHeading\" class=\"", "--nc__pre-text\">", " </p>\n <div part='", "--checkbox-group' class=\"", "--checkbox-group\">\n ", "\n\n </div>\n <div part='", "--nc__post-text' class=\"", "--nc__post-text\"\n >", "</div>\n \n </div>\n ", "\n </section>"])), prefix, ddsPrefix, this.preTextTemplate(), prefix, prefix, Object.keys(this.checkboxes).length !== 0 ? Object.keys(this.checkboxes).length > 0 && Object.keys(this.checkboxes).map(function (key) {
647
+ return (0, _litElement.html)(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["<section class=\"", "--nc\">\n <p part='ncHeading' id=\"ncHeading\" class=\"", "--nc__pre-text\">", " ", " </p>\n <div part='", "--checkbox-group' class=\"", "--checkbox-group\">\n ", "\n\n </div>\n <div part='", "--nc__post-text' class=\"", "--nc__post-text\"\n >", "</div>\n <input type='hidden' id=\"preventFormSubmission\" name=\"preventFormSubmission\" value=", " />\n </div>\n ", "\n </section>"])), prefix, ddsPrefix, this.showLegalNotice ? this.countryBasedLegalNotice() : '', this.preTextTemplate(), prefix, prefix, Object.keys(this.checkboxes).length !== 0 ? Object.keys(this.checkboxes).length > 0 && Object.keys(this.checkboxes).map(function (key) {
560
648
  var checked = _this6.values[key];
561
649
  var checkbox = _this6.checkboxes[key];
562
650
  var hiddenBox = {
@@ -566,7 +654,7 @@ var NoticeChoice = (0, _decorate2["default"])([(0, _carbonElement.carbonElement)
566
654
  key === 'EMAIL' ? _this6.hiddenEmail = hiddenBox.value : '';
567
655
  key === 'PHONE' ? _this6.hiddenPhone = hiddenBox.value : '';
568
656
  return _this6.checkBoxTemplate(checkbox, checked, hiddenBox);
569
- }) : '', prefix, prefix, this.postTextTemplate(), this.getBpidLegalText());
657
+ }) : '', prefix, prefix, this.postTextTemplate(), this.preventFormSubmission, this.getBpidLegalText());
570
658
  }
571
659
  }, {
572
660
  kind: "method",
@@ -673,7 +761,11 @@ var NoticeChoice = (0, _decorate2["default"])([(0, _carbonElement.carbonElement)
673
761
  value: function _onChange(field, value) {
674
762
  var pwsFieldsMap = {
675
763
  NC_HIDDEN_EMAIL: 'permission_email',
676
- NC_HIDDEN_PHONE: 'permission_phone'
764
+ NC_HIDDEN_PHONE: 'permission_phone',
765
+ preventFormSubmission: 'preventFormSubmission',
766
+ Q_CHINA_PIPL: 'Q_CHINA_PIPL',
767
+ NC_HIDDEN_EMAIL_VALUE: 'NC_HIDDEN_EMAIL',
768
+ NC_HIDDEN_PHONE_VALUE: 'NC_HIDDEN_PHONE'
677
769
  };
678
770
  if (Object.prototype.hasOwnProperty.call(pwsFieldsMap, field)) {
679
771
  field = pwsFieldsMap[field];