@visitscotland/component-library 5.4.1 → 5.4.3

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.
@@ -10840,10 +10840,10 @@ const CardGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1F, [["render", _sfc_ren
10840
10840
  this.cookieManagerLoaded = !0;
10841
10841
  },
10842
10842
  cookiesUpdated() {
10843
- const e = this.requiredCookies.every(
10843
+ let e = !1;
10844
+ typeof CookieControl < "u" && (e = this.requiredCookies.every(
10844
10845
  (n) => CookieControl && CookieControl.getCategoryConsent(n) !== !1
10845
- );
10846
- this.requiredCookiesAllowed = e;
10846
+ )), this.requiredCookiesAllowed = e, typeof this.callbackOnUpdated < "u" && this.callbackOnUpdated();
10847
10847
  }
10848
10848
  },
10849
10849
  computed: {
@@ -10858,7 +10858,7 @@ const CardGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1F, [["render", _sfc_ren
10858
10858
  if (!window.dataLayerExtended && window.dataLayer) {
10859
10859
  const e = window.dataLayer.push;
10860
10860
  window.dataLayer.push = (n) => {
10861
- e.apply(this, n), n && n.event === "cookie_permission_loaded" && setTimeout(() => {
10861
+ n ? e(n) : e(), n && n.event === "cookie_permission_loaded" && setTimeout(() => {
10862
10862
  window.dispatchEvent(new Event("cookieManagerLoaded"));
10863
10863
  }), n && n.event === "cookie_permission_changed" && setTimeout(() => {
10864
10864
  window.dispatchEvent(new Event("cookiesUpdated"));
@@ -11870,6 +11870,14 @@ const VsDropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$1x, [["render", _sf
11870
11870
  extraContent: {
11871
11871
  type: String,
11872
11872
  default: ""
11873
+ },
11874
+ /**
11875
+ * A script that should only be loaded if the user accepts cookies, often necessary
11876
+ * to make the embed work.
11877
+ */
11878
+ embeddedScript: {
11879
+ type: String,
11880
+ default: ""
11873
11881
  }
11874
11882
  },
11875
11883
  data() {
@@ -11885,6 +11893,14 @@ const VsDropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$1x, [["render", _sf
11885
11893
  let e = "";
11886
11894
  return this.cookiesLoaded || (e = this.errorText), !this.cookiesAllowed && this.cookiesLoaded === !0 && (e = this.noCookieText), e;
11887
11895
  }
11896
+ },
11897
+ methods: {
11898
+ callbackOnUpdated() {
11899
+ if (this.embeddedScript && this.cookiesLoaded && this.requiredCookiesAllowed) {
11900
+ const e = document.createElement("script");
11901
+ e.src = this.embeddedScript, document.head.appendChild(e);
11902
+ }
11903
+ }
11888
11904
  }
11889
11905
  }, _hoisted_1$1a = {
11890
11906
  "data-test": "vs-embed-wrapper",