@verifiedinc-public/shared-ui-elements 7.0.4 → 7.2.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.
Files changed (35) hide show
  1. package/dist/components/chart/index.mjs +1 -1
  2. package/dist/components/index.d.ts +1 -0
  3. package/dist/components/index.mjs +1 -1
  4. package/dist/components/text-to-signup/index.d.ts +2 -0
  5. package/dist/components/text-to-signup/magic-button.d.ts +10 -0
  6. package/dist/components/text-to-signup/magic-qr-code.d.ts +9 -0
  7. package/dist/components/verified/index.d.ts +1 -0
  8. package/dist/components/verified/powered-by-verified/index.d.ts +7 -0
  9. package/dist/hooks/index.d.ts +1 -0
  10. package/dist/hooks/index.mjs +1 -1
  11. package/dist/hooks/text-to-signup/index.d.ts +4 -0
  12. package/dist/hooks/text-to-signup/magic-link.d.ts +1 -0
  13. package/dist/hooks/text-to-signup/magic-qr-code-options.d.ts +34 -0
  14. package/dist/hooks/text-to-signup/magic-qr-code.d.ts +11 -0
  15. package/dist/hooks/text-to-signup/magic-text.d.ts +11 -0
  16. package/dist/index.mjs +1 -1
  17. package/dist/shared/{SignupBigNumbers-DpIvs8zO.mjs → SignupBigNumbers-CroHWk9_.mjs} +2 -2
  18. package/dist/shared/{_baseGetTag-B6tQMIzM.mjs → _baseGetTag-CrjEuriT.mjs} +1 -1
  19. package/dist/shared/generateKeyFromString-D1AuwK4y.mjs +1 -0
  20. package/dist/shared/magic-link-J1X2QOgb.mjs +1 -0
  21. package/dist/shared/magic-qr-code-BO1wSciL.mjs +1 -0
  22. package/dist/shared/{ContentWithLoader-BZvCtG9r.mjs → magic-qr-code-CKYWgffm.mjs} +16 -16
  23. package/dist/shared/{phone-DCga5nUC.mjs → phone-PcoIqJru.mjs} +1 -1
  24. package/dist/shared/{ssn-K2aFHNWy.mjs → ssn-DDHkK5vg.mjs} +1 -1
  25. package/dist/shared/toNumber-B6a0B29A.mjs +1 -0
  26. package/dist/shared/{uuidColor-e3OxEKbO.mjs → uuidColor-DbOBO7Il.mjs} +1 -1
  27. package/dist/utils/index.mjs +1 -1
  28. package/dist/utils/phone/index.mjs +1 -1
  29. package/dist/utils/string/generateKeyFromString.d.ts +7 -0
  30. package/dist/utils/string/index.d.ts +1 -0
  31. package/dist/utils/string/index.mjs +1 -1
  32. package/package.json +3 -2
  33. package/dist/shared/toNumber-BUb3rTFh.mjs +0 -1
  34. package/dist/shared/useOnClickOutside-LHfgekbP.mjs +0 -1
  35. package/dist/shared/useStyledQRCode-BN5wt-Zb.mjs +0 -1
@@ -1 +1 @@
1
- "use strict";var n=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function y(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function d(t){if(t.__esModule)return t;var r=t.default;if(typeof r=="function"){var e=function o(){return this instanceof o?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};e.prototype=r.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(t).forEach(function(o){var c=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,c.get?c:{enumerable:!0,get:function(){return t[o]}})}),e}var g=typeof n=="object"&&n&&n.Object===Object&&n,u=g,j=u,v=typeof self=="object"&&self&&self.Object===Object&&self,O=j||v||Function("return this")(),i=O,h=i,w=h.Symbol,l=w,f=l,s=Object.prototype,_=s.hasOwnProperty,P=s.toString,a=f?f.toStringTag:void 0;function S(t){var r=_.call(t,a),e=t[a];try{t[a]=void 0;var o=!0}catch{}var c=P.call(t);return o&&(r?t[a]=e:delete t[a]),c}var m=S,T=Object.prototype,M=T.toString;function D(t){return M.call(t)}var E=D,p=l,N=m,R=E,k="[object Null]",x="[object Undefined]",b=p?p.toStringTag:void 0;function A(t){return t==null?t===void 0?x:k:b&&b in Object(t)?N(t):R(t)}var C=A;export{i as _,C as a,l as b,n as c,u as d,d as e,y as g};
1
+ "use strict";var n=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function y(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function d(t){if(t.__esModule)return t;var r=t.default;if(typeof r=="function"){var e=function o(){return this instanceof o?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};e.prototype=r.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(t).forEach(function(o){var c=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,c.get?c:{enumerable:!0,get:function(){return t[o]}})}),e}var g=typeof n=="object"&&n&&n.Object===Object&&n,u=g,j=u,v=typeof self=="object"&&self&&self.Object===Object&&self,O=j||v||Function("return this")(),i=O,h=i,w=h.Symbol,l=w,f=l,s=Object.prototype,_=s.hasOwnProperty,P=s.toString,a=f?f.toStringTag:void 0;function S(t){var r=_.call(t,a),e=t[a];try{t[a]=void 0;var o=!0}catch{}var c=P.call(t);return o&&(r?t[a]=e:delete t[a]),c}var m=S,T=Object.prototype,M=T.toString;function D(t){return M.call(t)}var E=D,p=l,N=m,R=E,k="[object Null]",x="[object Undefined]",b=p?p.toStringTag:void 0;function A(t){return t==null?t===void 0?x:k:b&&b in Object(t)?N(t):R(t)}var C=A;export{C as _,i as a,l as b,n as c,u as d,d as e,y as g};
@@ -0,0 +1 @@
1
+ "use strict";function n(t){let e=0;for(let r=0;r<t.length;r++)e+=t.charCodeAt(r),e+=e<<10,e^=e>>6;return e+=e<<3,e^=e>>11,e+=e<<15,String(e>>>0)}export{n as g};
@@ -0,0 +1 @@
1
+ "use strict";import{useRef as m,useInsertionEffect as A,useCallback as w,useState as d,useId as C,useEffect as g,useLayoutEffect as I,useSyncExternalStore as k,useMemo as N}from"react";import{f as S}from"./magic-qr-code-BO1wSciL.mjs";import P from"libphonenumber-js";function U(e){return{set:t=>{const o=typeof t=="string"?t:JSON.stringify(t);localStorage.setItem(e,o)},get:()=>{const t=localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch{return t}return null},remove:()=>{localStorage.removeItem(e)}}}function E(e,t=[]){const o=m(()=>{throw new Error("Cannot call an event handler while rendering.")});return A(()=>{o.current=e}),w((...r)=>{var i;return(i=o.current)==null?void 0:i.call(o,...r)},t)}function W(e={}){const{onClose:t,onOpen:o,open:r,id:i}=e,n=E(o),s=E(t),[c,u]=d(e.defaultOpen??!1),l=r??c,a=r!==void 0,p=C(),f=i??`disclosure-${p}`,h=w(()=>{a||u(!1),s?.()},[a,s]),y=w(()=>{a||u(!0),n?.()},[a,n]),b=w(()=>{l?h():y()},[l,y,h]);function T(v={}){return{...v,"aria-expanded":l,"aria-controls":f,onClick(x){var L;(L=v.onClick)==null||L.call(v,x),b()}}}function O(v={}){return{...v,hidden:!l,id:f}}return{open:l,onOpen:y,onClose:h,onToggle:b,isControlled:a,getButtonProps:T,getDisclosureProps:O}}function $(e){return new URLSearchParams(e??window.location.search)}function j(e,t={addToHead:!1,removeOnUnmount:!1,nonce:void 0}){const[o,r]=d("loading"),i=m(t);return g(()=>{let n=document.querySelector(`script[src="${e}"]`);const s=n?.getAttribute("data-status");if(s){r(s);return}if(n===null){n=document.createElement("script"),n.src=e,n.async=!0,n.setAttribute("data-status","loading"),i.current.nonce&&n.setAttribute("nonce",i.current.nonce),i.current.addToHead?document.head.appendChild(n):document.body.appendChild(n);const c=()=>{n?.setAttribute("data-status","ready"),r("ready"),l()},u=()=>{n?.setAttribute("data-status","error"),r("error"),l()},l=()=>{n?.removeEventListener("load",c),n?.removeEventListener("error",u)};n.addEventListener("load",c),n.addEventListener("error",u);const a=i.current.removeOnUnmount;return()=>{a&&(n?.remove(),l())}}else r("unknown")},[e]),o}function z(e,t=500){const[o,r]=d(e),i=m(Date.now());return g(()=>{const n=Date.now(),s=n-i.current;if(s>=t)i.current=n,r(e);else{const c=t-s,u=window.setTimeout(()=>{i.current=Date.now(),r(e)},c);return()=>{window.clearTimeout(u)}}},[e,t]),o}function D(e){const[t,o]=d(()=>typeof e=="boolean"?e:!!e),r=w(i=>{if(typeof i=="boolean"){o(i);return}o(n=>!n)},[]);return[t,r]}function H(){const[e,t]=d({x:0,y:0}),o=w((...r)=>{if(r.length===1&&typeof r[0]=="object")window.scrollTo(r[0]);else if(r.length===2)window.scrollTo(r[0],r[1]);else throw new Error("Invalid arguments passed to scrollTo. Expected either ScrollToOptions object or x,y coordinates. See https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo")},[]);return I(()=>{const r=()=>{t({x:window.scrollX,y:window.scrollY})};return r(),window.addEventListener("scroll",r),()=>{window.removeEventListener("scroll",r)}},[]),{...e,scrollTo:o}}function M(){const[e,t]=d({width:window.innerWidth,height:window.innerHeight});return I(()=>{const o=()=>{t({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o)}},[]),e}function J(e,{threshold:t=0,root:o=null,rootMargin:r="0%",freezeOnceVisible:i=!1}={}){const[n,s]=d({isIntersecting:!1,entry:null});return g(()=>{const c=e?.current;let u;if(c){if(i&&n.isIntersecting)return;const l=p=>{const[f]=p;s({isIntersecting:f.isIntersecting,entry:f})},a=new IntersectionObserver(l,{threshold:t,root:o,rootMargin:r});a.observe(c),u=()=>{a.disconnect()}}return()=>{u&&u()}},[e,t,o,r,i,n.isIntersecting]),n}function R(){return k(e=>typeof window>"u"?()=>{}:(window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",e)}),()=>typeof navigator>"u"?!0:navigator.onLine,()=>!0)}function q(e,t=500,o){const r=m(),i=N(()=>{const n=S(e,t,o),s=(...c)=>n(...c);return s.cancel=()=>{n.cancel()},s.isPending=()=>!!r.current,s.flush=()=>n.flush(),s},[e,t,o]);return g(()=>{r.current=S(e,t,o)},[e,t,o]),g(()=>()=>{r.current&&r.current.cancel()},[]),i}function B({phoneNumber:e,keyword:t,text:o="Text",signature:r="to"}){var i;return e&&(e=((i=P(e))==null?void 0:i.format("NATIONAL").replace("(","").replace(")","").replace(" ","-"))??e),{text:o,keyword:t,phoneNumber:e,signature:r}}function X(e,t){return`${e}/tts/${t}`}export{W as a,E as b,$ as c,j as d,z as e,D as f,H as g,M as h,J as i,R as j,q as k,B as l,X as m,U as u};
@@ -0,0 +1 @@
1
+ "use strict";import{a as C,g as N}from"./_baseGetTag-CrjEuriT.mjs";import{t as R,i as j}from"./toNumber-B6a0B29A.mjs";import{useMemo as g,useState as q,useEffect as y,useRef as A}from"react";import*as B from"qrcode";import W from"qr-code-styling";import{j as H}from"./jsx-runtime-Bwwz4kRH.mjs";import{g as J}from"./generateKeyFromString-D1AuwK4y.mjs";var Q=C,F=function(){return Q.Date.now()},I=F,K=j,x=I,$=R,P="Expected a function",U=Math.max,V=Math.min;function X(n,o,i){var s,e,c,d,r,u,t=0,f=!1,m=!1,p=!0;if(typeof n!="function")throw new TypeError(P);o=$(o)||0,K(i)&&(f=!!i.leading,m="maxWait"in i,c=m?U($(i.maxWait)||0,o):c,p="trailing"in i?!!i.trailing:p);function w(a){var l=s,v=e;return s=e=void 0,t=a,d=n.apply(v,l),d}function z(a){return t=a,r=setTimeout(h,o),f?w(a):d}function D(a){var l=a-u,v=a-t,T=o-l;return m?V(T,c-v):T}function L(a){var l=a-u,v=a-t;return u===void 0||l>=o||l<0||m&&v>=c}function h(){var a=x();if(L(a))return k(a);r=setTimeout(h,D(a))}function k(a){return r=void 0,p&&s?w(a):(s=e=void 0,d)}function S(){r!==void 0&&clearTimeout(r),t=0,s=u=e=r=void 0}function E(){return r===void 0?d:k(x())}function O(){var a=x(),l=L(a);if(s=arguments,e=this,u=a,l){if(r===void 0)return z(u);if(m)return clearTimeout(r),r=setTimeout(h,o),w(u)}return r===void 0&&(r=setTimeout(h,o)),d}return O.cancel=S,O.flush=E,O}var Y=X;const _=N(Y);function G(n){const o=g(()=>B.create(n.data),[n.data]).modules.data;return g(()=>{const i=n.size/Math.sqrt(o.length);let s=`<svg viewBox="0 0 ${n.size} ${n.size}" xmlns="http://www.w3.org/2000/svg">`;const e=n.imageSize,c=(n.size-e)/2,d=(n.size-e)/2;for(let r=0;r<o.length;r++){const u=r%Math.sqrt(o.length)*i,t=Math.floor(r/Math.sqrt(o.length))*i,f=i/2,m=o[r]===1,p=u+i>=c&&u<c+e&&t+i>=d&&t<d+e;!m||p||(s+=`<rect x="${u}" y="${t}" width="${i}" height="${i}" rx="${f}" ry="${f}" fill='${n.fill||"#000000"}' />`)}return s+="</svg>",s},[o,n])}function Z(n,o=250){const[i,s]=q(n);return y(()=>{const e=setTimeout(()=>{s(n)},o);return()=>{clearTimeout(e)}},[n,o]),i}function tt(n,o,i="mousedown",s={},e=null){y(()=>{const c=d=>{const r=d.target;!r||!r.isConnected||(Array.isArray(n)?n.filter(u=>!!u.current).every(u=>u.current&&!u.current.contains(r)):n.current&&!n.current.contains(r))&&o(d)};return(e??window).addEventListener(i,c,s),()=>{(e??window).removeEventListener(i,c,s)}},[s,i,o,n])}function b({options:n,className:o}){function i(t){return{width:t?.width??300,height:t?.height??300,type:t?.type??"svg",data:t?.data,image:t?.image,qrOptions:{typeNumber:0,mode:"Byte",errorCorrectionLevel:"Q",...t?.qrOptions},imageOptions:{crossOrigin:"anonymous",margin:20,...t?.imageOptions},dotsOptions:{color:"#000000",type:"square",...t?.dotsOptions},cornersSquareOptions:t?.cornersSquareOptions,cornersDotOptions:t?.cornersDotOptions,backgroundOptions:{color:"#ffffff",...t?.backgroundOptions}}}const[s]=q(i(n)),[e]=q(new W(s)),c=A(null),d=g(()=>()=>H.jsx("div",{className:o,ref:c}),[o]),r=async t=>await e.getRawData(t),u=async(t,f)=>{await e.download({name:t,extension:f})};return y(()=>{c.current&&e.append(c.current)},[e,c]),y(()=>{e&&e.update(i(n))},[e,n]),{Component:d,getRawData:r,download:u}}function M({magicLink:n,brandLogo:o}){const i=g(()=>({options:{type:"svg",shape:"square",width:1024,height:1024,data:n,qrOptions:{errorCorrectionLevel:"H"},image:o??void 0,dotsOptions:{type:"dots",color:"#000000"},cornersSquareOptions:{type:"dot",color:"#000000"},cornersDotOptions:{type:"dot",color:"#000000"},backgroundOptions:{color:"#fff"}}}),[o,n]),s=g(()=>J(JSON.stringify(i)),[i]);return{options:i,key:s}}function nt({magicLink:n,brandLogo:o}){const{options:i,key:s}=M({magicLink:n,brandLogo:o});return{qrcode:b(i),key:s}}export{Z as a,tt as b,b as c,nt as d,M as e,_ as f,G as u};