dripsender-otp-widget 1.1.9 → 1.1.10

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.
@@ -2,6 +2,6 @@
2
2
  (function(K,P){typeof exports=="object"&&typeof module<"u"?module.exports=P():typeof define=="function"&&define.amd?define(P):(K=typeof globalThis<"u"?globalThis:K||self,K.DripsenderOTP=P())})(this,function(){"use strict";var lt=Object.defineProperty;var ot=(K,P,D)=>P in K?lt(K,P,{enumerable:!0,configurable:!0,writable:!0,value:D}):K[P]=D;var ne=(K,P,D)=>(ot(K,typeof P!="symbol"?P+"":P,D),D);const K="";function P(){}function D(e){return e()}function le(){return Object.create(null)}function A(e){e.forEach(D)}function oe(e){return typeof e=="function"}function ve(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function we(e){return Object.keys(e).length===0}function a(e,t){e.appendChild(t)}function ye(e,t,n){const l=ke(e);if(!l.getElementById(t)){const r=h("style");r.id=t,r.textContent=n,xe(l,r)}}function ke(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function xe(e,t){return a(e.head||e,t),t.sheet}function S(e,t,n){e.insertBefore(t,n||null)}function E(e){e.parentNode&&e.parentNode.removeChild(e)}function Me(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function h(e){return document.createElement(e)}function J(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function z(e){return document.createTextNode(e)}function T(){return z(" ")}function Oe(){return z("")}function B(e,t,n,l){return e.addEventListener(t,n,l),()=>e.removeEventListener(t,n,l)}function s(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function Ce(e){return Array.from(e.childNodes)}function G(e,t){t=""+t,e.data!==t&&(e.data=t)}function re(e,t){e.value=t??""}function se(e,t,n,l){n==null?e.style.removeProperty(t):e.style.setProperty(t,n,l?"important":"")}let W;function X(e){W=e}function Pe(){if(!W)throw new Error("Function called outside component initialization");return W}function Ee(e){Pe().$$.on_mount.push(e)}const V=[],ie=[];let U=[];const ue=[],Se=Promise.resolve();let $=!1;function Te(){$||($=!0,Se.then(ae))}function ee(e){U.push(e)}const te=new Set;let F=0;function ae(){if(F!==0)return;const e=W;do{try{for(;F<V.length;){const t=V[F];F++,X(t),Le(t.$$)}}catch(t){throw V.length=0,F=0,t}for(X(null),V.length=0,F=0;ie.length;)ie.pop()();for(let t=0;t<U.length;t+=1){const n=U[t];te.has(n)||(te.add(n),n())}U.length=0}while(V.length);for(;ue.length;)ue.pop()();$=!1,te.clear(),X(e)}function Le(e){if(e.fragment!==null){e.update(),A(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(ee)}}function Ne(e){const t=[],n=[];U.forEach(l=>e.indexOf(l)===-1?t.push(l):n.push(l)),n.forEach(l=>l()),U=t}const Ie=new Set;function He(e,t){e&&e.i&&(Ie.delete(e),e.i(t))}function ce(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function Ke(e,t,n){const{fragment:l,after_update:r}=e.$$;l&&l.m(t,n),ee(()=>{const i=e.$$.on_mount.map(D).filter(oe);e.$$.on_destroy?e.$$.on_destroy.push(...i):A(i),e.$$.on_mount=[]}),r.forEach(ee)}function ze(e,t){const n=e.$$;n.fragment!==null&&(Ne(n.after_update),A(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Be(e,t){e.$$.dirty[0]===-1&&(V.push(e),Te(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function De(e,t,n,l,r,i,p=null,c=[-1]){const f=W;X(e);const m=e.$$={fragment:null,ctx:[],props:i,update:P,not_equal:r,bound:le(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(f?f.$$.context:[])),callbacks:le(),dirty:c,skip_bound:!1,root:t.target||f.$$.root};p&&p(m.root);let k=!1;if(m.ctx=n?n(e,t.props||{},(d,g,...u)=>{const b=u.length?u[0]:g;return m.ctx&&r(m.ctx[d],m.ctx[d]=b)&&(!m.skip_bound&&m.bound[d]&&m.bound[d](b),k&&Be(e,d)),g}):[],m.update(),k=!0,A(m.before_update),m.fragment=l?l(m.ctx):!1,t.target){if(t.hydrate){const d=Ce(t.target);m.fragment&&m.fragment.l(d),d.forEach(E)}else m.fragment&&m.fragment.c();t.intro&&He(e.$$.fragment),Ke(e,t.target,t.anchor),ae()}X(f)}class je{constructor(){ne(this,"$$");ne(this,"$$set")}$destroy(){ze(this,1),this.$destroy=P}$on(t,n){if(!oe(n))return P;const l=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return l.push(n),()=>{const r=l.indexOf(n);r!==-1&&l.splice(r,1)}}$set(t){this.$$set&&!we(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Ae="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Ae);function Re(e){ye(e,"svelte-iwfd87",`body{margin:0;font-family:'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
3
3
  Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;background-color:#f9fafb}body.no-select{user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}.secure-otp{user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}@keyframes svelte-iwfd87-shake{0%,100%{transform:translateX(0)}10%,30%,50%,70%,90%{transform:translateX(-5px)}20%,40%,60%,80%{transform:translateX(5px)}}@keyframes svelte-iwfd87-success-pulse{0%,100%{transform:scale(1);box-shadow:0 0 0 rgba(79, 209, 197, 0)}50%{transform:scale(1.03);box-shadow:0 0 20px rgba(79, 209, 197, 0.5)}}input[type="text"].svelte-iwfd87,input[type="tel"].svelte-iwfd87{transition:border-color 0.2s ease}button.svelte-iwfd87{position:relative;overflow:hidden}button.svelte-iwfd87::after{content:'';position:absolute;top:50%;left:50%;width:5px;height:5px;background:rgba(255, 255, 255, 0.5);opacity:0;border-radius:100%;transform:scale(1, 1) translate(-50%);transform-origin:50% 50%}@keyframes svelte-iwfd87-ripple{0%{transform:scale(0, 0);opacity:0.5}100%{transform:scale(20, 20);opacity:0}}button.svelte-iwfd87:focus:not(:active)::after{animation:svelte-iwfd87-ripple 1s ease-out}`)}function fe(e,t,n){const l=e.slice();return l[30]=t[n],l[32]=n,l}function de(e){let t,n,l,r,i,p,c,f,m,k,d,g,u;function b(v,w){return v[4]?Ve:Ue}let M=b(e),x=M(e),y=e[6]&&pe(e),O=e[7]&&he(e);return{c(){t=h("div"),n=h("div"),l=h("div"),r=h("div"),i=h("div"),p=h("h2"),c=z(e[0]),f=T(),m=h("div"),k=T(),x.c(),d=T(),y&&y.c(),g=T(),O&&O.c(),s(p,"class","text-2xl font-bold text-gray-800 mb-2"),s(m,"class","w-16 h-1 bg-gradient-to-r from-blue-500 to-purple-600 mx-auto rounded-full"),s(i,"class","text-center mb-8"),s(r,"class","bg-white p-8 rounded-2xl"),s(l,"class","bg-gradient-to-br from-blue-500 to-purple-600 p-1 rounded-2xl shadow-2xl"),s(n,"class",u="modal-content relative w-full max-w-md transform transition-all duration-300 ease-in-out scale-100 translate-y-0 "+(e[9]?"secure-otp":"")),s(t,"class","fixed inset-0 flex items-center justify-center z-50 backdrop-blur-sm")},m(v,w){S(v,t,w),a(t,n),a(n,l),a(l,r),a(r,i),a(i,p),a(p,c),a(i,f),a(i,m),a(r,k),x.m(r,null),a(r,d),y&&y.m(r,null),a(r,g),O&&O.m(r,null)},p(v,w){w[0]&1&&G(c,v[0]),M===(M=b(v))&&x?x.p(v,w):(x.d(1),x=M(v),x&&(x.c(),x.m(r,d))),v[6]?y?y.p(v,w):(y=pe(v),y.c(),y.m(r,g)):y&&(y.d(1),y=null),v[7]?O?O.p(v,w):(O=he(v),O.c(),O.m(r,null)):O&&(O.d(1),O=null),w[0]&512&&u!==(u="modal-content relative w-full max-w-md transform transition-all duration-300 ease-in-out scale-100 translate-y-0 "+(v[9]?"secure-otp":""))&&s(n,"class",u)},d(v){v&&E(t),x.d(),y&&y.d(),O&&O.d()}}}function Ve(e){let t,n,l,r,i,p,c,f,m,k,d,g,u,b,M,x,y,O,v=ce(e[3]),w=[];for(let _=0;_<v.length;_+=1)w[_]=me(fe(e,v,_));function q(_,N){return _[5]?We:Fe}let R=q(e),H=R(e);return{c(){t=h("div"),n=h("label"),n.textContent="Masukkan Kode OTP",l=T(),r=h("p"),i=z("Kode OTP telah dikirim ke nomor "),p=z(e[2]),c=T(),f=h("div");for(let _=0;_<w.length;_+=1)w[_].c();m=T(),k=h("div"),d=h("button"),d.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M9.707 14.707a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 1.414L7.414 9H15a1 1 0 110 2H7.414l2.293 2.293a1 1 0 010 1.414z" clip-rule="evenodd"></path></svg>
4
4
  Ubah Nomor HP`,g=T(),u=h("button"),u.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M4 2a1 1 0 011 1v2.101a7.002 7.002 0 0111.601 2.566 1 1 0 11-1.885.666A5.002 5.002 0 005.999 7H9a1 1 0 010 2H4a1 1 0 01-1-1V3a1 1 0 011-1zm.008 9.057a1 1 0 011.276.61A5.002 5.002 0 0014.001 13H11a1 1 0 110-2h5a1 1 0 011 1v5a1 1 0 11-2 0v-2.101a7.002 7.002 0 01-11.601-2.566 1 1 0 01.61-1.276z" clip-rule="evenodd"></path></svg>
5
- Kirim Ulang Kode`,b=T(),M=h("button"),H.c(),s(n,"class","block text-sm font-medium text-gray-700 mb-2"),s(r,"class","text-xs text-gray-500 mb-4"),s(f,"class","flex justify-between mb-6"),s(d,"class","text-blue-600 hover:text-blue-800 hover:underline transition-colors flex items-center svelte-iwfd87"),s(d,"aria-label","Ubah Nomor HP"),s(u,"class","text-blue-600 hover:text-blue-800 hover:underline transition-colors flex items-center svelte-iwfd87"),s(u,"aria-label","Kirim Ulang Kode"),s(k,"class","flex justify-between text-sm"),s(t,"class","mb-6"),s(t,"id","otp-container"),M.disabled=x=e[5]||e[3].some(be),s(M,"class","w-full bg-gradient-to-r from-blue-500 to-purple-600 text-white p-4 rounded-xl hover:shadow-lg focus:outline-none focus:ring-2 focus:ring-blue-300 focus:ring-offset-2 transition-all duration-200 transform hover:-translate-y-1 disabled:opacity-70 disabled:transform-none svelte-iwfd87")},m(_,N){S(_,t,N),a(t,n),a(t,l),a(t,r),a(r,i),a(r,p),a(t,c),a(t,f);for(let C=0;C<w.length;C+=1)w[C]&&w[C].m(f,null);a(t,m),a(t,k),a(k,d),a(k,g),a(k,u),S(_,b,N),S(_,M,N),H.m(M,null),y||(O=[B(d,"click",e[23]),B(u,"click",e[24]),B(M,"click",e[14])],y=!0)},p(_,N){if(N[0]&4&&G(p,_[2]),N[0]&47368){v=ce(_[3]);let C;for(C=0;C<v.length;C+=1){const Y=fe(_,v,C);w[C]?w[C].p(Y,N):(w[C]=me(Y),w[C].c(),w[C].m(f,null))}for(;C<w.length;C+=1)w[C].d(1);w.length=v.length}R!==(R=q(_))&&(H.d(1),H=R(_),H&&(H.c(),H.m(M,null))),N[0]&40&&x!==(x=_[5]||_[3].some(be))&&(M.disabled=x)},d(_){_&&(E(t),E(b),E(M)),Me(w,_),H.d(),y=!1,A(O)}}}function Ue(e){let t,n,l,r,i,p,c,f,m;function k(u,b){return u[5]?qe:Xe}let d=k(e),g=d(e);return{c(){t=h("div"),n=h("label"),n.textContent="Nomor HP",l=T(),r=h("div"),i=h("input"),p=T(),c=h("button"),g.c(),s(n,"for","phone"),s(n,"class","block text-sm font-medium text-gray-700 mb-2"),s(i,"type","tel"),s(i,"id","phone"),s(i,"placeholder","Masukkan nomor HP Anda"),s(i,"class","w-full p-4 border-2 border-gray-200 rounded-xl focus:outline-none focus:border-blue-500 transition-all duration-200 svelte-iwfd87"),se(i,"color","#111827"),s(r,"class","relative"),s(t,"class","mb-6"),s(t,"id","phone-container"),c.disabled=e[5],s(c,"class","w-full bg-gradient-to-r from-blue-500 to-purple-600 text-white p-4 rounded-xl hover:shadow-lg focus:outline-none focus:ring-2 focus:ring-blue-300 focus:ring-offset-2 transition-all duration-200 transform hover:-translate-y-1 disabled:opacity-70 disabled:transform-none svelte-iwfd87")},m(u,b){S(u,t,b),a(t,n),a(t,l),a(t,r),a(r,i),re(i,e[2]),S(u,p,b),S(u,c,b),g.m(c,null),f||(m=[B(i,"input",e[19]),B(c,"click",e[10])],f=!0)},p(u,b){b[0]&4&&re(i,u[2]),d!==(d=k(u))&&(g.d(1),g=d(u),g&&(g.c(),g.m(c,null))),b[0]&32&&(c.disabled=u[5])},d(u){u&&(E(t),E(p),E(c)),g.d(),f=!1,A(m)}}}function me(e){let t,n,l,r,i,p,c,f,m;function k(...u){return e[20](e[32],...u)}function d(...u){return e[21](e[32],...u)}function g(){return e[22](e[32])}return{c(){t=h("div"),n=h("input"),r=T(),i=h("div"),c=T(),s(n,"type","text"),s(n,"id","otp-"+e[32]),s(n,"maxlength","1"),s(n,"inputmode","numeric"),n.value=l=e[30],s(n,"class","w-12 h-14 text-center text-xl font-bold border-2 border-gray-200 rounded-lg focus:outline-none focus:border-blue-500 transition-all duration-200 svelte-iwfd87"),se(n,"color","#111827"),s(i,"class",p="absolute -bottom-2 left-1/2 transform -translate-x-1/2 w-8 h-1 rounded-full transition-all duration-200 "+(e[8]===e[32]?"bg-blue-500":"bg-transparent")),s(t,"class","relative")},m(u,b){S(u,t,b),a(t,n),a(t,r),a(t,i),a(t,c),f||(m=[B(n,"input",k),B(n,"keydown",d),B(n,"paste",e[15]),B(n,"focus",g)],f=!0)},p(u,b){e=u,b[0]&8&&l!==(l=e[30])&&n.value!==l&&(n.value=l),b[0]&256&&p!==(p="absolute -bottom-2 left-1/2 transform -translate-x-1/2 w-8 h-1 rounded-full transition-all duration-200 "+(e[8]===e[32]?"bg-blue-500":"bg-transparent"))&&s(i,"class",p)},d(u){u&&E(t),f=!1,A(m)}}}function Fe(e){let t;return{c(){t=z("Verifikasi")},m(n,l){S(n,t,l)},d(n){n&&E(t)}}}function We(e){let t;return{c(){t=h("div"),t.innerHTML=`<svg class="animate-spin -ml-1 mr-3 h-5 w-5 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg>
5
+ Kirim Ulang Kode`,b=T(),M=h("button"),H.c(),s(n,"class","block text-sm font-medium text-gray-700 mb-2"),s(r,"class","text-xs text-gray-500 mb-4"),s(f,"class","flex justify-between mb-6"),s(d,"class","text-blue-600 hover:text-blue-800 hover:underline transition-colors flex items-center svelte-iwfd87"),s(d,"aria-label","Ubah Nomor HP"),s(u,"class","text-blue-600 hover:text-blue-800 hover:underline transition-colors flex items-center svelte-iwfd87"),s(u,"aria-label","Kirim Ulang Kode"),s(k,"class","flex justify-between text-sm"),s(t,"class","mb-6"),s(t,"id","otp-container"),M.disabled=x=e[5]||e[3].some(be),s(M,"class","w-full bg-gradient-to-r from-blue-500 to-purple-600 text-white p-4 rounded-xl hover:shadow-lg focus:outline-none focus:ring-2 focus:ring-blue-300 focus:ring-offset-2 transition-all duration-200 transform hover:-translate-y-1 disabled:opacity-70 disabled:transform-none svelte-iwfd87")},m(_,N){S(_,t,N),a(t,n),a(t,l),a(t,r),a(r,i),a(r,p),a(t,c),a(t,f);for(let C=0;C<w.length;C+=1)w[C]&&w[C].m(f,null);a(t,m),a(t,k),a(k,d),a(k,g),a(k,u),S(_,b,N),S(_,M,N),H.m(M,null),y||(O=[B(d,"click",e[23]),B(u,"click",e[24]),B(M,"click",e[14])],y=!0)},p(_,N){if(N[0]&4&&G(p,_[2]),N[0]&47368){v=ce(_[3]);let C;for(C=0;C<v.length;C+=1){const Y=fe(_,v,C);w[C]?w[C].p(Y,N):(w[C]=me(Y),w[C].c(),w[C].m(f,null))}for(;C<w.length;C+=1)w[C].d(1);w.length=v.length}R!==(R=q(_))&&(H.d(1),H=R(_),H&&(H.c(),H.m(M,null))),N[0]&40&&x!==(x=_[5]||_[3].some(be))&&(M.disabled=x)},d(_){_&&(E(t),E(b),E(M)),Me(w,_),H.d(),y=!1,A(O)}}}function Ue(e){let t,n,l,r,i,p,c,f,m;function k(u,b){return u[5]?qe:Xe}let d=k(e),g=d(e);return{c(){t=h("div"),n=h("label"),n.textContent="Nomor HP",l=T(),r=h("div"),i=h("input"),p=T(),c=h("button"),g.c(),s(n,"for","phone"),s(n,"class","block text-sm font-medium text-gray-700 mb-2"),s(i,"type","tel"),s(i,"id","phone"),s(i,"placeholder","Masukkan nomor HP Anda"),s(i,"class","w-full p-4 border-2 border-gray-200 rounded-xl focus:outline-none focus:border-blue-500 transition-all duration-200 svelte-iwfd87"),se(i,"color","#111827",1),s(r,"class","relative"),s(t,"class","mb-6"),s(t,"id","phone-container"),c.disabled=e[5],s(c,"class","w-full bg-gradient-to-r from-blue-500 to-purple-600 text-white p-4 rounded-xl hover:shadow-lg focus:outline-none focus:ring-2 focus:ring-blue-300 focus:ring-offset-2 transition-all duration-200 transform hover:-translate-y-1 disabled:opacity-70 disabled:transform-none svelte-iwfd87")},m(u,b){S(u,t,b),a(t,n),a(t,l),a(t,r),a(r,i),re(i,e[2]),S(u,p,b),S(u,c,b),g.m(c,null),f||(m=[B(i,"input",e[19]),B(c,"click",e[10])],f=!0)},p(u,b){b[0]&4&&re(i,u[2]),d!==(d=k(u))&&(g.d(1),g=d(u),g&&(g.c(),g.m(c,null))),b[0]&32&&(c.disabled=u[5])},d(u){u&&(E(t),E(p),E(c)),g.d(),f=!1,A(m)}}}function me(e){let t,n,l,r,i,p,c,f,m;function k(...u){return e[20](e[32],...u)}function d(...u){return e[21](e[32],...u)}function g(){return e[22](e[32])}return{c(){t=h("div"),n=h("input"),r=T(),i=h("div"),c=T(),s(n,"type","text"),s(n,"id","otp-"+e[32]),s(n,"maxlength","1"),s(n,"inputmode","numeric"),n.value=l=e[30],s(n,"class","w-12 h-14 text-center text-xl font-bold border-2 border-gray-200 rounded-lg focus:outline-none focus:border-blue-500 transition-all duration-200 svelte-iwfd87"),se(n,"color","#111827",1),s(i,"class",p="absolute -bottom-2 left-1/2 transform -translate-x-1/2 w-8 h-1 rounded-full transition-all duration-200 "+(e[8]===e[32]?"bg-blue-500":"bg-transparent")),s(t,"class","relative")},m(u,b){S(u,t,b),a(t,n),a(t,r),a(t,i),a(t,c),f||(m=[B(n,"input",k),B(n,"keydown",d),B(n,"paste",e[15]),B(n,"focus",g)],f=!0)},p(u,b){e=u,b[0]&8&&l!==(l=e[30])&&n.value!==l&&(n.value=l),b[0]&256&&p!==(p="absolute -bottom-2 left-1/2 transform -translate-x-1/2 w-8 h-1 rounded-full transition-all duration-200 "+(e[8]===e[32]?"bg-blue-500":"bg-transparent"))&&s(i,"class",p)},d(u){u&&E(t),f=!1,A(m)}}}function Fe(e){let t;return{c(){t=z("Verifikasi")},m(n,l){S(n,t,l)},d(n){n&&E(t)}}}function We(e){let t;return{c(){t=h("div"),t.innerHTML=`<svg class="animate-spin -ml-1 mr-3 h-5 w-5 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg>
6
6
  Memverifikasi...`,s(t,"class","flex items-center justify-center")},m(n,l){S(n,t,l)},d(n){n&&E(t)}}}function Xe(e){let t;return{c(){t=z("Kirim Kode OTP")},m(n,l){S(n,t,l)},d(n){n&&E(t)}}}function qe(e){let t;return{c(){t=h("div"),t.innerHTML=`<svg class="animate-spin -ml-1 mr-3 h-5 w-5 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg>
7
7
  Mengirim...`,s(t,"class","flex items-center justify-center")},m(n,l){S(n,t,l)},d(n){n&&E(t)}}}function pe(e){let t,n,l,r,i,p;return{c(){t=h("div"),n=J("svg"),l=J("path"),r=T(),i=h("span"),p=z(e[6]),s(l,"fill-rule","evenodd"),s(l,"d","M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z"),s(l,"clip-rule","evenodd"),s(n,"xmlns","http://www.w3.org/2000/svg"),s(n,"class","h-5 w-5 mr-2 flex-shrink-0"),s(n,"viewBox","0 0 20 20"),s(n,"fill","currentColor"),s(t,"class","mt-4 p-3 bg-red-50 border-l-4 border-red-500 text-red-700 rounded-md flex items-start")},m(c,f){S(c,t,f),a(t,n),a(n,l),a(t,r),a(t,i),a(i,p)},p(c,f){f[0]&64&&G(p,c[6])},d(c){c&&E(t)}}}function he(e){let t,n,l,r,i,p;return{c(){t=h("div"),n=J("svg"),l=J("path"),r=T(),i=h("span"),p=z(e[7]),s(l,"fill-rule","evenodd"),s(l,"d","M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"),s(l,"clip-rule","evenodd"),s(n,"xmlns","http://www.w3.org/2000/svg"),s(n,"class","h-5 w-5 mr-2 flex-shrink-0"),s(n,"viewBox","0 0 20 20"),s(n,"fill","currentColor"),s(t,"class","mt-4 p-3 bg-green-50 border-l-4 border-green-500 text-green-700 rounded-md flex items-start")},m(c,f){S(c,t,f),a(t,n),a(n,l),a(t,r),a(t,i),a(i,p)},p(c,f){f[0]&128&&G(p,c[7])},d(c){c&&E(t)}}}function Je(e){let t,n=e[1]&&de(e);return{c(){n&&n.c(),t=Oe()},m(l,r){n&&n.m(l,r),S(l,t,r)},p(l,r){l[1]?n?n.p(l,r):(n=de(l),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},i:P,o:P,d(l){l&&E(t),n&&n.d(l)}}}function Q(e){const t=document.getElementById(e);t&&(t.classList.add("shake"),setTimeout(()=>{t.classList.remove("shake")},500))}const be=e=>e==="";function Ge(e,t,n){let{title:l="Verifikasi OTP"}=t,{vp_url:r=""}=t,{votp_url:i=""}=t,{notRegisteredMessage:p="Nomor HP tidak ditemukan"}=t,c="",f=["","","","",""],m=f.length,k=!1,d=!1,g="",u="",b=!0,M=0,x=!1;localStorage.getItem("savedOtp")&&localStorage.getItem("savedPhoneNumber")&&(b=!1);function y(){x&&(document.removeEventListener("contextmenu",v),document.removeEventListener("keydown",w),document.body.classList.remove("no-select"),n(9,x=!1))}function O(){x||(document.addEventListener("contextmenu",v),document.addEventListener("keydown",w),document.body.classList.add("no-select"),n(9,x=!0))}function v(o){if(b)return o.preventDefault(),!1}function w(o){if(b&&(o.ctrlKey&&o.keyCode===65||o.ctrlKey&&o.keyCode===67||o.ctrlKey&&o.shiftKey&&o.keyCode===73||o.keyCode===123||o.ctrlKey&&o.shiftKey&&o.keyCode===67||o.ctrlKey&&o.keyCode===85))return o.preventDefault(),!1}Ee(()=>(b&&O(),()=>{y()}));async function q(){if(!c){n(6,g="Silakan masukkan nomor HP"),Q("phone-container");return}n(6,g=""),n(5,d=!0),(await(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({phone:c})})).json()).exists?(n(5,d=!1),n(4,k=!0),n(7,u=`Kode OTP telah dikirim ke ${c}`),setTimeout(()=>{var L;(L=document.getElementById("otp-0"))==null||L.focus()},300)):(n(5,d=!1),n(6,g=p),Q("phone-container"))}function R(o,I){var j;const L=I.target.value;if(!/^\d*$/.test(L)){I.target.value=f[o];return}n(3,f[o]=L.slice(-1),f),L&&o<5&&((j=document.getElementById(`otp-${o+1}`))==null||j.focus(),n(8,M=o+1)),f.every(Z=>Z!=="")&&o===5&&N()}function H(o,I){var L;I.key==="Backspace"&&!f[o]&&o>0&&((L=document.getElementById(`otp-${o-1}`))==null||L.focus(),n(8,M=o-1))}function _(o){n(8,M=o)}async function N(){const o=f.join("");if(o.length!==f.length){n(6,g="Silakan masukkan kode OTP "+f.length+" digit"),Q("otp-container");return}if(n(6,g=""),n(5,d=!0),(await(await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({phone:c,otp:o})})).json()).status=="success"){n(5,d=!1),n(7,u="Verifikasi berhasil!");const j=document.querySelector(".modal-content");j&&j.classList.add("success-animation"),y(),n(1,b=!1),localStorage.setItem("savedOtp",o),localStorage.setItem("savedPhoneNumber",c)}else n(5,d=!1),n(6,g="Kode OTP tidak valid"),Q("otp-container")}function C(o){var Z;o.preventDefault();const I=o.clipboardData.getData("text");if(!/^\d+$/.test(I))return;const L=I.slice(0,m).split("");L.forEach((nt,_e)=>{_e<m&&n(3,f[_e]=nt,f)});const j=Math.min(L.length,5);(Z=document.getElementById(`otp-${j}`))==null||Z.focus(),n(8,M=j),L.length===m&&N()}function Y(){c=this.value,n(2,c)}const Ye=(o,I)=>R(o,I),Ze=(o,I)=>H(o,I),$e=o=>_(o),et=()=>{n(4,k=!1),n(7,u="")},tt=()=>{n(7,u=""),q()};return e.$$set=o=>{"title"in o&&n(0,l=o.title),"vp_url"in o&&n(16,r=o.vp_url),"votp_url"in o&&n(17,i=o.votp_url),"notRegisteredMessage"in o&&n(18,p=o.notRegisteredMessage)},e.$$.update=()=>{e.$$.dirty[0]&2&&(b?O():y())},[l,b,c,f,k,d,g,u,M,x,q,R,H,_,N,C,r,i,p,Y,Ye,Ze,$e,et,tt]}class Qe extends je{constructor(t){super(),De(this,t,Ge,Je,ve,{title:0,vp_url:16,votp_url:17,notRegisteredMessage:18},Re,[-1,-1])}}function ge(){const e=document.getElementById("otp-widget");if(!e){console.error('OTP Widget element not found. Make sure to add an element with id="otp-widget"');return}const t=e.getAttribute("reqotp"),n=e.getAttribute("verifyotp"),l=e.getAttribute("title")||"Verifikasi OTP",r=e.getAttribute("not-registered-message")||"Nomor HP tidak ditemukan";return console.log("Initializing OTP Widget",t,n),new Qe({target:e,props:{vp_url:t,votp_url:n,title:l,notRegisteredMessage:r}})}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",ge):ge(),{}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dripsender-otp-widget",
3
- "version": "1.1.9",
3
+ "version": "1.1.10",
4
4
  "type": "module",
5
5
  "description": "A customizable OTP verification widget for Dripsender",
6
6
  "main": "dist/assets/main.js",