@nibgate/sdk 0.2.20 → 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.20",
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": [
@@ -33,7 +33,6 @@ function inject() {
33
33
  const s = h('style', { id: SID }, `
34
34
  @keyframes nfade { from { opacity:0;transform:translateY(6px) } to { opacity:1;transform:translateY(0) } }
35
35
  @keyframes nscale { from { opacity:0;transform:scale(0.96) } to { opacity:1;transform:scale(1) } }
36
- @keyframes nshimmer { 0% { transform:translateX(-100%) } 100% { transform:translateX(100%) } }
37
36
 
38
37
  .nui { font-family:var(--font-content,'Kumbh Sans','ABC Favorit',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif);color:${theme.fg};line-height:1.5;-webkit-font-smoothing:antialiased;font-size:19px }
39
38
  .nui *,.nui *::before,.nui *::after { box-sizing:border-box }
@@ -75,7 +74,7 @@ export function renderDefaultUnlockUI(container, resource, options = {}) {
75
74
 
76
75
  const card = el('div', { cls: 'nui', style: { animation: 'nfade .2s ease-out' } });
77
76
 
78
- const lockSVG = '<svg width="24" height="24" viewBox="0 0 32 32" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle"><path d="M6 16v8a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-8"/><path d="M10 16v-5a6 6 0 0 1 12 0v5"/><circle cx="16" cy="21" r="2"/></svg>';
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>';
79
78
 
80
79
  card.innerHTML = `
81
80
  <div style="display:flex;flex-direction:column;align-items:center;text-align:center;max-width:580px;margin:0 auto;padding:40px 52px">
@@ -83,10 +82,9 @@ export function renderDefaultUnlockUI(container, resource, options = {}) {
83
82
  <div style="font-size:50px;font-weight:700;letter-spacing:-.03em;color:${theme.fg};margin-bottom:12px">${esc(resource.price)} USDC</div>
84
83
  <div style="font-size:21px;color:${theme.muted};margin-bottom:48px">Pay to unlock this content</div>
85
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>
86
- <div data-nibgate-unlock-wrap style="width:100%;position:relative;border-radius:12px;overflow:hidden;cursor:pointer">
87
- <div data-nibgate-unlock-progress style="position:absolute;inset:0;width:0%;background:linear-gradient(90deg,rgba(255,255,255,0.1),rgba(255,255,255,0.45));border-radius:12px;transition:width .05s linear;z-index:2"></div>
88
- <div data-nibgate-shimmer style="position:absolute;inset:0;width:100%;height:100%;background:linear-gradient(90deg,transparent,rgba(255,255,255,0.12),transparent);border-radius:12px;transform:translateX(-100%);z-index:3;pointer-events:none"></div>
89
- <button type="button" data-nibgate-unlock disabled class="nui-btn nui-btn-primary" style="width:100%;padding:24px 32px;font-size:24px;position:relative;z-index:4;background:${theme.accent};transition:transform .1s,opacity .15s;display:flex">${lockSVG}Hold to pay ${esc(resource.price)} USDC</button></div>
85
+ <div data-nibgate-unlock-wrap style="width:100%;position:relative;border-radius:10px;overflow:hidden;cursor:pointer">
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>
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>
90
88
  <div class="nui-stat" style="text-align:center;margin-top:16px" data-nibgate-status></div>
91
89
  </div>
92
90
  <div data-nibgate-premium hidden style="margin-top:32px;border-top:1px solid ${theme.border};padding-top:32px">${options.premiumContentHTML || ''}</div>
@@ -96,23 +94,15 @@ export function renderDefaultUnlockUI(container, resource, options = {}) {
96
94
  // Load Lottie animation
97
95
  (function loadLottie() {
98
96
  if (!document.getElementById('nibgate-lottie')) return;
99
-
100
97
  function startAnim(data) {
101
98
  var d = document.getElementById('nibgate-lottie');
102
- if (d && window.lottie) {
103
- window.lottie.loadAnimation({ container: d, animationData: data, loop: true, autoplay: true });
104
- }
99
+ if (d && window.lottie) window.lottie.loadAnimation({ container: d, animationData: data, loop: true, autoplay: true });
105
100
  }
106
-
107
101
  if (window.lottie) {
108
- if (window._lottieData) {
109
- startAnim(window._lottieData);
110
- } else {
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
- }
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() {});
113
104
  return;
114
105
  }
115
-
116
106
  if (window._lottieLoading) return;
117
107
  window._lottieLoading = true;
118
108
  var s = document.createElement('script');
@@ -123,12 +113,10 @@ export function renderDefaultUnlockUI(container, resource, options = {}) {
123
113
  document.head.appendChild(s);
124
114
  })();
125
115
 
126
-
127
116
  const st = card.querySelector('[data-nibgate-status]');
128
117
  const label = card.querySelector('[data-nibgate-wallet-label]');
129
118
  const wrap = card.querySelector('[data-nibgate-unlock-wrap]');
130
119
  const prog = card.querySelector('[data-nibgate-unlock-progress]');
131
- const shimmer = card.querySelector('[data-nibgate-shimmer]');
132
120
  const btn = card.querySelector('[data-nibgate-unlock]');
133
121
 
134
122
  const HOLD_MS = 1500;
@@ -169,21 +157,20 @@ export function renderDefaultUnlockUI(container, resource, options = {}) {
169
157
  label.textContent = 'Connect wallet';
170
158
  btn.disabled = true;
171
159
  btn.style.cursor = 'default';
172
- btn.innerHTML = lockSVG + 'Hold to pay ' + esc(resource.price) + ' USDC';
160
+ btn.innerHTML = unlockSVG + 'Hold to pay';
173
161
  }
174
162
  }
175
163
 
176
- function setBtnText(t) { btn.innerHTML = lockSVG + t; }
164
+ function setBtnText(t) { btn.innerHTML = unlockSVG + t; }
177
165
 
178
166
  function resetHold() {
179
167
  holdActive = false;
180
168
  holdComplete = false;
181
169
  holdTimer = null;
182
170
  btn.style.transform = 'scale(1)';
171
+ btn.style.boxShadow = '0 4px 12px rgba(0,0,0,0.08)';
183
172
  prog.style.width = '0%';
184
- shimmer.style.animation = 'none';
185
- shimmer.style.transform = 'translateX(-100%)';
186
- if (!btn.disabled) setBtnText('Hold to pay ' + esc(resource.price) + ' USDC');
173
+ if (!btn.disabled) setBtnText('Hold to pay');
187
174
  }
188
175
 
189
176
  function startHold(e) {
@@ -192,23 +179,19 @@ export function renderDefaultUnlockUI(container, resource, options = {}) {
192
179
  holdActive = true;
193
180
  holdComplete = false;
194
181
  btn.style.transform = 'scale(.97)';
182
+ btn.style.boxShadow = '0 2px 6px rgba(0,0,0,0.12)';
195
183
  prog.style.transition = 'none';
196
184
  prog.style.width = '0%';
197
- shimmer.style.animation = 'nshimmer 1s ease-in-out infinite';
198
- shimmer.style.transform = 'none';
199
185
  setBtnText('Hold\u2026');
200
186
  requestAnimationFrame(() => {
201
187
  prog.style.transition = 'width ' + HOLD_MS + 'ms linear';
202
188
  prog.style.width = '100%';
203
189
  });
204
- const t1 = setTimeout(() => { if (holdActive && !holdComplete) setBtnText('Keep holding\u2026'); }, HOLD_MS * 0.4);
205
- const t2 = setTimeout(() => { if (holdActive && !holdComplete) setBtnText('Almost there\u2026'); }, HOLD_MS * 0.75);
206
190
  holdTimer = setTimeout(() => {
207
191
  holdComplete = true;
208
192
  holdActive = false;
209
- clearTimeout(t1); clearTimeout(t2);
210
193
  btn.style.transform = 'scale(1)';
211
- shimmer.style.animation = 'none';
194
+ btn.style.boxShadow = '0 4px 12px rgba(0,0,0,0.08)';
212
195
  prog.style.transition = 'width .05s linear';
213
196
  setBtnText('Processing\u2026');
214
197
  btn.disabled = true;