zz-shopify-components 0.30.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zz-shopify-components",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "description": "Reusable Shopify components for theme projects",
5
5
  "keywords": [
6
6
  "shopify",
@@ -394,6 +394,11 @@
394
394
  `zz_cookie_consent=${value}; path=/; max-age=2592000; SameSite=Lax; Secure`;
395
395
  }
396
396
 
397
+ function showCookieBanner() {
398
+ if(!banner) return;
399
+ banner.classList.remove('!tw-hidden');
400
+ }
401
+
397
402
 
398
403
  function checkCookieConsent() {
399
404
  // 生成 “Cookie 偏好记录”,有效期1个月,有效期内同一浏览器 / 设备不再弹出。
@@ -411,8 +416,7 @@
411
416
  error => {
412
417
  console.log('Consent Tracking API loaded', error);
413
418
  if (!error) {
414
- banner.classList.remove('!tw-hidden');
415
- // Rescue error
419
+ showCookieBanner();
416
420
  }
417
421
  },
418
422
  );
@@ -421,7 +425,9 @@
421
425
  }
422
426
 
423
427
  }
424
-
428
+ window.zzCookieConsent = {
429
+ showCookieBanner
430
+ };
425
431
  document.addEventListener("DOMContentLoaded", checkCookieConsent);
426
432
  })();
427
433
  </script>