@nibgate/sdk 0.2.21 → 0.2.22

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": "@nibgate/sdk",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
4
4
  "description": "Framework-agnostic browser and server package for creator-owned gated content, unlock events, and receipts.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -77,17 +77,41 @@ export function renderDefaultUnlockUI(container, resource, options = {}) {
77
77
  const unlockSVG = '<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;margin-right:6px"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/></svg>';
78
78
 
79
79
  card.innerHTML = `
80
- <div style="display:flex;flex-direction:column;align-items:center;text-align:center;max-width:420px;margin:0 auto;padding:24px 20px">
81
- <div data-nibgate-wallet-label class="nui-mono" style="font-size:15px;color:${theme.muted};margin-bottom:16px;min-height:24px">Connect wallet</div>
80
+ <div style="display:flex;flex-direction:column;align-items:center;text-align:center;max-width:580px;margin:0 auto;padding:40px 52px">
81
+ <div id="nibgate-lottie" style="width:165px;height:168px;margin-bottom:24px"></div>
82
+ <div style="font-size:50px;font-weight:700;letter-spacing:-.03em;color:${theme.fg};margin-bottom:12px">${esc(resource.price)} USDC</div>
83
+ <div style="font-size:21px;color:${theme.muted};margin-bottom:48px">Pay to unlock this content</div>
84
+ <div data-nibgate-wallet-label class="nui-mono" style="font-size:18px;color:${theme.muted};margin-bottom:40px;min-height:28px">Connect wallet</div>
82
85
  <div data-nibgate-unlock-wrap style="width:100%;position:relative;border-radius:10px;overflow:hidden;cursor:pointer">
83
86
  <div data-nibgate-unlock-progress style="position:absolute;inset:0;width:0%;background:${theme.accent};opacity:0.15;border-radius:10px;transition:width .05s linear;z-index:2"></div>
84
- <button type="button" data-nibgate-unlock disabled style="width:100%;padding:12px 0;font-size:16px;font-weight:500;line-height:19px;border:0;border-radius:10px;outline:none;cursor:pointer;position:relative;z-index:4;color:${theme.accent};background:rgba(124,154,109,0.08);transition:box-shadow .3s,transform .3s;font-family:inherit">${unlockSVG}Hold to pay</button></div>
85
- <div class="nui-stat" style="text-align:center;margin-top:12px" data-nibgate-status></div>
87
+ <button type="button" data-nibgate-unlock disabled style="width:100%;padding:14px 0;font-size:17px;font-weight:500;line-height:1;border:0;border-radius:10px;outline:none;cursor:pointer;position:relative;z-index:4;color:${theme.accent};background:rgba(124,154,109,0.08);transition:box-shadow .3s,transform .3s;font-family:inherit;display:flex;align-items:center;justify-content:center">${unlockSVG}Hold to pay</button></div>
88
+ <div class="nui-stat" style="text-align:center;margin-top:16px" data-nibgate-status></div>
86
89
  </div>
87
- <div data-nibgate-premium hidden style="margin-top:24px;border-top:1px solid ${theme.border};padding-top:24px">${options.premiumContentHTML || ''}</div>
90
+ <div data-nibgate-premium hidden style="margin-top:32px;border-top:1px solid ${theme.border};padding-top:32px">${options.premiumContentHTML || ''}</div>
88
91
  `;
89
92
 
90
93
  (typeof container === 'string' ? document.querySelector(container) : container)?.appendChild(card);
94
+ // Load Lottie animation
95
+ (function loadLottie() {
96
+ if (!document.getElementById('nibgate-lottie')) return;
97
+ function startAnim(data) {
98
+ var d = document.getElementById('nibgate-lottie');
99
+ if (d && window.lottie) window.lottie.loadAnimation({ container: d, animationData: data, loop: true, autoplay: true });
100
+ }
101
+ if (window.lottie) {
102
+ if (window._lottieData) startAnim(window._lottieData);
103
+ else fetch('/nibgate-unlock-key.json?t=1').then(function(r) { if (!r.ok) throw new Error(); return r.json(); }).then(function(d) { window._lottieData = d; startAnim(d); }).catch(function() {});
104
+ return;
105
+ }
106
+ if (window._lottieLoading) return;
107
+ window._lottieLoading = true;
108
+ var s = document.createElement('script');
109
+ s.src = 'https://cdnjs.cloudflare.com/ajax/libs/lottie-web/5.12.2/lottie.min.js';
110
+ s.onload = function() {
111
+ fetch('/nibgate-unlock-key.json?t=1').then(function(r) { if (!r.ok) throw new Error(); return r.json(); }).then(function(d) { window._lottieData = d; startAnim(d); }).catch(function() {});
112
+ };
113
+ document.head.appendChild(s);
114
+ })();
91
115
 
92
116
  const st = card.querySelector('[data-nibgate-status]');
93
117
  const label = card.querySelector('[data-nibgate-wallet-label]');