@trimble-oss/trimble-id-react 0.1.0 → 0.1.1

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.
@@ -1,27 +1 @@
1
- (function(m,T){typeof exports=="object"&&typeof module<"u"?T(exports,require("@trimble-oss/trimble-id"),require("es-cookie"),require("jwt-decode"),require("react")):typeof define=="function"&&define.amd?define(["exports","@trimble-oss/trimble-id","es-cookie","jwt-decode","react"],T):(m=typeof globalThis<"u"?globalThis:m||self,T(m.ReactTID={},m.trimbleId,m.esCookie,m.jwt_decode,m.require$$0))})(this,function(m,T,L,Qe,k){"use strict";var Zt=Object.defineProperty;var qt=(m,T,L)=>T in m?Zt(m,T,{enumerable:!0,configurable:!0,writable:!0,value:L}):m[T]=L;var p=(m,T,L)=>(qt(m,typeof T!="symbol"?T+"":T,L),L);function Ze(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const n in a)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(a,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>a[n]})}}return t.default=a,Object.freeze(t)}const ie=Ze(L);class qe{constructor(){p(this,"generateCache",function(){const t={token:void 0,user:void 0};return{async getToken(){return t.token},async getUser(){return t.user},async storeToken(n){t.token=n},async storeUser(n){t.user=n},clear(){return t.token=void 0,t.user=void 0,Promise.resolve(void 0)}}}())}}class et{constructor(t){p(this,"localStorage");p(this,"cacheKey");this.localStorage=window.localStorage,this.cacheKey=t.cacheKey}async getToken(){const t=this.getAuthKey(),n=localStorage.getItem(t);return n?JSON.parse(n):void 0}async getUser(){const t=this.getUserKey(),n=localStorage.getItem(t);return n?JSON.parse(n):void 0}async storeToken(t){const n=this.getAuthKey(),o=JSON.stringify(t);localStorage.setItem(n,o)}async storeUser(t){const n=this.getUserKey(),o=JSON.stringify(t);localStorage.setItem(n,o)}getUserKey(){return this.cacheKey.getUserKey()}getAuthKey(){return this.cacheKey.getAuthKey()}clear(){return this.localStorage.removeItem(this.getAuthKey()),this.localStorage.removeItem(this.getUserKey()),Promise.resolve(void 0)}}const ae="@TID",tt=`${ae}_AUTH_KEY`,rt=`${ae}_USER_KEY`;class nt{constructor(t){p(this,"clientId");p(this,"prefix",ae);p(this,"authSuffix",tt);p(this,"userSuffix",rt);this.clientId=t.client_id}getUserKey(){return`${this.prefix}_${this.userSuffix}_${this.clientId}`}getAuthKey(){return`${this.prefix}_${this.authSuffix}_${this.clientId}`}}class it{constructor(t){p(this,"sessionStorage");p(this,"cacheKey");this.sessionStorage=window.sessionStorage,this.cacheKey=t.cacheKey}async getToken(){const t=this.getAuthKey(),n=sessionStorage.getItem(t);return n?JSON.parse(n):void 0}async getUser(){const t=this.getUserKey(),n=sessionStorage.getItem(t);return n?JSON.parse(n):void 0}async storeToken(t){const n=this.getAuthKey(),o=JSON.stringify(t);sessionStorage.setItem(n,o)}async storeUser(t){const n=this.getUserKey(),o=JSON.stringify(t);sessionStorage.setItem(n,o)}getUserKey(){return this.cacheKey.getUserKey()}getAuthKey(){return this.cacheKey.getAuthKey()}clear(){return this.sessionStorage.removeItem(this.getAuthKey()),this.sessionStorage.removeItem(this.getUserKey()),Promise.resolve(void 0)}}class at{constructor(t){p(this,"persistentStore");p(this,"cacheStorage");p(this,"cacheKey");this.persistentStore=t.persistentStore,this.cacheKey=new nt({client_id:t.clientId}),this.persistentStore==="localStorage"?this.cacheStorage=new et({cacheKey:this.cacheKey}):this.persistentStore==="sessionStorage"?this.cacheStorage=new it({cacheKey:this.cacheKey}):this.cacheStorage=new qe().generateCache}async setToken(t){await this.cacheStorage.storeToken(t)}async setUser(t){await this.cacheStorage.storeUser(t)}async getUser(){return this.cacheStorage.getUser()}async getToken(){return this.cacheStorage.getToken()}async clear(){await this.cacheStorage.clear()}}const me=5*6e4,ot=["code","state"],Ee=a=>a.split("?")[0],st=a=>a.split("?")[1],_e=a=>{let t=a;if(!a.startsWith("?"))try{t=new URL(a).search}catch{}return new URLSearchParams(t)},ct=(a=window.location.href,t)=>{if(t!=null){const o=Ee(t),c=Ee(a??"");if(o!==c)return!1}const n=_e(a);for(const o of ot)if(!n.has(o))return!1;return!0},lt=a=>({id:a.sub,name:`${a.given_name} ${a.family_name}`,given_name:a.given_name,family_name:a.family_name,picture:a.picture,email:a.email,email_verified:a.email_verified,phone_number_verified:!1}),ut="@TID_COOKIE";class ft{get(t){const n=ie.get(t);if(n==null)throw new Error("Cookie not found");return JSON.parse(n)}set(t,n,o){let c={};window.location.protocol==="https:"&&(c={secure:!0,sameSite:"none"}),o!=null&&o.expires&&(c.expires=o.expires),o!=null&&o.domain&&(c.domain=o.domain),ie.set(t,JSON.stringify(n),c)}remove(t,n){const o={};n!=null&&n.domain&&(o.domain=n.domain),ie.remove(t,o)}}class dt{constructor(t){p(this,"cookieKey");p(this,"cookiesStorage");this.cookieKey=`${ut}.${t.clientId}`,this.cookiesStorage=new ft}save(t){this.cookiesStorage.set(this.cookieKey,t,{expires:1})}get(){try{return this.cookiesStorage.get(this.cookieKey)}catch{return}}clear(){this.cookiesStorage.remove(this.cookieKey)}}class Te extends Error{}class ke extends Error{}class ht extends Error{}const A="@trimble-oss/trimble-id-react",K="0.1.0",gt={configurationEndpoint:"",clientId:"",redirectUrl:"",logoutRedirectUrl:"",scopes:[]},vt={persistentStore:"in-memory"};class Se{constructor(t){p(this,"tokenProvider");p(this,"cacheManager");p(this,"cookiesManager");p(this,"clientId");p(this,"redirectUrl");p(this,"analyticshttpclient");const{config:n=gt,persistentOptions:o=vt}=t;if(this.redirectUrl=n.redirectUrl,n.configurationEndpoint==null||n.configurationEndpoint=="")throw new Error("Configuration endpoint not defined");if(n.clientId==null||n.clientId=="")throw new Error("Consumer key is not defined");this.cookiesManager=new dt({clientId:n.clientId});const c=this.cookiesManager.get(),w=new T.OpenIdEndpointProvider(n.configurationEndpoint);let S=new T.AuthorizationCodeGrantTokenProvider(w,n.clientId,n.redirectUrl).WithScopes(n.scopes);n.logoutRedirectUrl&&(S=S.WithLogoutRedirect(n.logoutRedirectUrl)),(c==null?void 0:c.code_verifier)!=null&&(S=S.WithProofKeyForCodeExchange(c.code_verifier)),this.tokenProvider=S,this.cacheManager=new at({clientId:n.clientId,persistentStore:o.persistentStore}),this.clientId=n.clientId,this.analyticshttpclient=T.AnalyticsHttpClient,this.analyticshttpclient.sendInitEvent("TIDClient",this.clientId,A,K)}async loginWithRedirect(t){this.analyticshttpclient.sendMethodEvent(this.loginWithRedirect.name,this.clientId,A,K);const{onRedirect:n}=t||{},o=T.AuthorizationCodeGrantTokenProvider.GenerateCodeVerifier();this.cookiesManager.save({code_verifier:o}),this.tokenProvider=this.tokenProvider.WithProofKeyForCodeExchange(o);const c=await this.tokenProvider.GetOAuthRedirect("state");n!=null?n(c):window.location.assign(c)}async handleCallback(t=window.location.href){const n=this.cookiesManager.get();if(n==null||(n==null?void 0:n.code_verifier)==null)throw new ht("Code verifier not available");const o=st(t),c=_e(t),w=c.get("identity_provider")??"",S=c.get("state")??"";return await this.tokenProvider.ValidateQuery(o),await this.generateToken(w),{authState:S}}async generateToken(t){var C,f;const n=await this.tokenProvider.RetrieveToken(),o=await this.tokenProvider.RetrieveRefreshToken(),c=await this.tokenProvider.RetrieveIdToken(),w=await this.tokenProvider.RetrieveTokenExpiry(),P=new Date(w).getTime(),v=(f=(C=this.tokenProvider)==null?void 0:C._scopes)==null?void 0:f.join(" ");await this.cacheManager.setToken({scope:v,state:"",session_state:"",identity_provider:t,token_type:"bearer",access_token:n,refresh_token:o,id_token:c,expires_at:P});const x=Qe(c),R=lt(x);await this.cacheManager.setUser(R),await this.reloadCodeVerifier()}async reloadCodeVerifier(){const t=await this.tokenProvider.RetrieveCodeVerifier();this.cookiesManager.save({code_verifier:t}),this.tokenProvider=this.tokenProvider.WithProofKeyForCodeExchange(t)}async getUser(){return this.analyticshttpclient.sendMethodEvent(this.getUser.name,this.clientId,A,K),await this.cacheManager.getUser()}async getAccessTokenSilently(){this.analyticshttpclient.sendMethodEvent(this.getAccessTokenSilently.name,this.clientId,A,K);let t=await this.cacheManager.getToken();if(t==null)throw this.analyticshttpclient.sendExceptionEvent(this.getAccessTokenSilently.name,"No token available",this.clientId,A,K),new ke("No token available");const n=new Date(new Date().getTime()+me);if((t==null?void 0:t.expires_at)==null||(t==null?void 0:t.expires_at)<n.getTime()){try{await this.tokenProvider.RetrieveToken()}catch(o){throw this.analyticshttpclient.sendExceptionEvent(this.getAccessTokenSilently.name,o.message,this.clientId,A,K),new Te(o.message)}await this.generateToken((t==null?void 0:t.identity_provider)??""),t=await this.cacheManager.getToken()}return(t==null?void 0:t.access_token)||""}async getTokens(){this.analyticshttpclient.sendMethodEvent(this.getTokens.name,this.clientId,A,K);let t=await this.cacheManager.getToken();if(t==null)throw this.analyticshttpclient.sendExceptionEvent(this.getTokens.name,"No token available",this.clientId,A,K),new ke("No token available");const n=new Date(new Date().getTime()+me);if((t==null?void 0:t.expires_at)==null||(t==null?void 0:t.expires_at)<n.getTime()){try{await this.tokenProvider.RetrieveToken()}catch(o){throw this.analyticshttpclient.sendExceptionEvent(this.getTokens.name,o.message,this.clientId,A,K),new Te(o.message)}await this.generateToken((t==null?void 0:t.identity_provider)??""),t=await this.cacheManager.getToken()}return{access_token:(t==null?void 0:t.access_token)||"",expires_at:(t==null?void 0:t.expires_at)||0,id_token:(t==null?void 0:t.id_token)||""}}async logout(t){this.analyticshttpclient.sendMethodEvent(this.logout.name,this.clientId,A,K);const{onRedirect:n,disabledAutoRedirect:o}=t||{};this.cacheManager&&await this.cacheManager.clear(),this.cookiesManager&&this.cookiesManager.clear();const c=await this.tokenProvider.GetOAuthLogoutRedirect("state");if(n!=null)return n(c);o||window.location.assign(c)}async checkSession(){try{await this.getAccessTokenSilently()}catch{return!1}return!0}async loadUserSession(){await this.loadCacheSessionIntoSDK(),await this.checkSession()||await this.cacheManager.clear()}async loadCacheSessionIntoSDK(){const t=await this.cacheManager.getToken();if(t==null)return;const n=t.access_token,o=t.refresh_token||"",c=t.id_token,w=t.expires_at;this.tokenProvider=this.tokenProvider.WithAccessToken(n,w).WithRefreshToken(o).WithIdToken(c)}getBearerTokenHttpClient(t){return new T.BearerTokenHttpClientProvider(this.tokenProvider,t)}getRedirectUrl(){return this.redirectUrl}}const z=k.createContext(null),Re=()=>k.useContext(z)??{};var oe={exports:{}},Y={};/**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var we;function yt(){if(we)return Y;we=1;var a=k,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,c=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,w={key:!0,ref:!0,__self:!0,__source:!0};function S(P,v,x){var R,C={},f=null,F=null;x!==void 0&&(f=""+x),v.key!==void 0&&(f=""+v.key),v.ref!==void 0&&(F=v.ref);for(R in v)o.call(v,R)&&!w.hasOwnProperty(R)&&(C[R]=v[R]);if(P&&P.defaultProps)for(R in v=P.defaultProps,v)C[R]===void 0&&(C[R]=v[R]);return{$$typeof:t,type:P,key:f,ref:F,props:C,_owner:c.current}}return Y.Fragment=n,Y.jsx=S,Y.jsxs=S,Y}var G={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var be;function pt(){return be||(be=1,process.env.NODE_ENV!=="production"&&function(){var a=k,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),S=Symbol.for("react.provider"),P=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),C=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),F=Symbol.for("react.offscreen"),U=Symbol.iterator,H="@@iterator";function ce(e){if(e===null||typeof e!="object")return null;var r=U&&e[U]||e[H];return typeof r=="function"?r:null}var D=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function _(e){{for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];$("error",e,i)}}function $(e,r,i){{var s=D.ReactDebugCurrentFrame,d=s.getStackAddendum();d!==""&&(r+="%s",i=i.concat([d]));var h=i.map(function(u){return String(u)});h.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,h)}}var X=!1,Q=!1,le=!1,g=!1,O=!1,Z;Z=Symbol.for("react.module.reference");function wt(e){return!!(typeof e=="string"||typeof e=="function"||e===o||e===w||O||e===c||e===x||e===R||g||e===F||X||Q||le||typeof e=="object"&&e!==null&&(e.$$typeof===f||e.$$typeof===C||e.$$typeof===S||e.$$typeof===P||e.$$typeof===v||e.$$typeof===Z||e.getModuleId!==void 0))}function bt(e,r,i){var s=e.displayName;if(s)return s;var d=r.displayName||r.name||"";return d!==""?i+"("+d+")":i}function Pe(e){return e.displayName||"Context"}function M(e){if(e==null)return null;if(typeof e.tag=="number"&&_("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case o:return"Fragment";case n:return"Portal";case w:return"Profiler";case c:return"StrictMode";case x:return"Suspense";case R:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case P:var r=e;return Pe(r)+".Consumer";case S:var i=e;return Pe(i._context)+".Provider";case v:return bt(e,e.render,"ForwardRef");case C:var s=e.displayName||null;return s!==null?s:M(e.type)||"Memo";case f:{var d=e,h=d._payload,u=d._init;try{return M(u(h))}catch{return null}}}return null}var N=Object.assign,J=0,Oe,Ie,xe,Ae,Ke,Ue,De;function Me(){}Me.__reactDisabledLog=!0;function Ct(){{if(J===0){Oe=console.log,Ie=console.info,xe=console.warn,Ae=console.error,Ke=console.group,Ue=console.groupCollapsed,De=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Me,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}J++}}function Pt(){{if(J--,J===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:N({},e,{value:Oe}),info:N({},e,{value:Ie}),warn:N({},e,{value:xe}),error:N({},e,{value:Ae}),group:N({},e,{value:Ke}),groupCollapsed:N({},e,{value:Ue}),groupEnd:N({},e,{value:De})})}J<0&&_("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ue=D.ReactCurrentDispatcher,fe;function q(e,r,i){{if(fe===void 0)try{throw Error()}catch(d){var s=d.stack.trim().match(/\n( *(at )?)/);fe=s&&s[1]||""}return`
18
- `+fe+e}}var de=!1,ee;{var Ot=typeof WeakMap=="function"?WeakMap:Map;ee=new Ot}function je(e,r){if(!e||de)return"";{var i=ee.get(e);if(i!==void 0)return i}var s;de=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var h;h=ue.current,ue.current=null,Ct();try{if(r){var u=function(){throw Error()};if(Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(j){s=j}Reflect.construct(e,[],u)}else{try{u.call()}catch(j){s=j}e.call(u.prototype)}}else{try{throw Error()}catch(j){s=j}e()}}catch(j){if(j&&s&&typeof j.stack=="string"){for(var l=j.stack.split(`
19
- `),b=s.stack.split(`
20
- `),y=l.length-1,E=b.length-1;y>=1&&E>=0&&l[y]!==b[E];)E--;for(;y>=1&&E>=0;y--,E--)if(l[y]!==b[E]){if(y!==1||E!==1)do if(y--,E--,E<0||l[y]!==b[E]){var I=`
21
- `+l[y].replace(" at new "," at ");return e.displayName&&I.includes("<anonymous>")&&(I=I.replace("<anonymous>",e.displayName)),typeof e=="function"&&ee.set(e,I),I}while(y>=1&&E>=0);break}}}finally{de=!1,ue.current=h,Pt(),Error.prepareStackTrace=d}var V=e?e.displayName||e.name:"",Xe=V?q(V):"";return typeof e=="function"&&ee.set(e,Xe),Xe}function It(e,r,i){return je(e,!1)}function xt(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function te(e,r,i){if(e==null)return"";if(typeof e=="function")return je(e,xt(e));if(typeof e=="string")return q(e);switch(e){case x:return q("Suspense");case R:return q("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return It(e.render);case C:return te(e.type,r,i);case f:{var s=e,d=s._payload,h=s._init;try{return te(h(d),r,i)}catch{}}}return""}var re=Object.prototype.hasOwnProperty,Le={},Fe=D.ReactDebugCurrentFrame;function ne(e){if(e){var r=e._owner,i=te(e.type,e._source,r?r.type:null);Fe.setExtraStackFrame(i)}else Fe.setExtraStackFrame(null)}function At(e,r,i,s,d){{var h=Function.call.bind(re);for(var u in e)if(h(e,u)){var l=void 0;try{if(typeof e[u]!="function"){var b=Error((s||"React class")+": "+i+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw b.name="Invariant Violation",b}l=e[u](r,u,s,i,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(y){l=y}l&&!(l instanceof Error)&&(ne(d),_("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",s||"React class",i,u,typeof l),ne(null)),l instanceof Error&&!(l.message in Le)&&(Le[l.message]=!0,ne(d),_("Failed %s type: %s",i,l.message),ne(null))}}}var Kt=Array.isArray;function he(e){return Kt(e)}function Ut(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,i=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i}}function Dt(e){try{return Ne(e),!1}catch{return!0}}function Ne(e){return""+e}function We(e){if(Dt(e))return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ut(e)),Ne(e)}var B=D.ReactCurrentOwner,Mt={key:!0,ref:!0,__self:!0,__source:!0},Ve,Ye,ge;ge={};function jt(e){if(re.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Lt(e){if(re.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Ft(e,r){if(typeof e.ref=="string"&&B.current&&r&&B.current.stateNode!==r){var i=M(B.current.type);ge[i]||(_('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',M(B.current.type),e.ref),ge[i]=!0)}}function Nt(e,r){{var i=function(){Ve||(Ve=!0,_("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}}function Wt(e,r){{var i=function(){Ye||(Ye=!0,_("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};i.isReactWarning=!0,Object.defineProperty(e,"ref",{get:i,configurable:!0})}}var Vt=function(e,r,i,s,d,h,u){var l={$$typeof:t,type:e,key:r,ref:i,props:u,_owner:h};return l._store={},Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(l,"_self",{configurable:!1,enumerable:!1,writable:!1,value:s}),Object.defineProperty(l,"_source",{configurable:!1,enumerable:!1,writable:!1,value:d}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l};function Yt(e,r,i,s,d){{var h,u={},l=null,b=null;i!==void 0&&(We(i),l=""+i),Lt(r)&&(We(r.key),l=""+r.key),jt(r)&&(b=r.ref,Ft(r,d));for(h in r)re.call(r,h)&&!Mt.hasOwnProperty(h)&&(u[h]=r[h]);if(e&&e.defaultProps){var y=e.defaultProps;for(h in y)u[h]===void 0&&(u[h]=y[h])}if(l||b){var E=typeof e=="function"?e.displayName||e.name||"Unknown":e;l&&Nt(u,E),b&&Wt(u,E)}return Vt(e,l,b,d,s,B.current,u)}}var ve=D.ReactCurrentOwner,Ge=D.ReactDebugCurrentFrame;function W(e){if(e){var r=e._owner,i=te(e.type,e._source,r?r.type:null);Ge.setExtraStackFrame(i)}else Ge.setExtraStackFrame(null)}var ye;ye=!1;function pe(e){return typeof e=="object"&&e!==null&&e.$$typeof===t}function Je(){{if(ve.current){var e=M(ve.current.type);if(e)return`
22
-
23
- Check the render method of \``+e+"`."}return""}}function Gt(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),i=e.lineNumber;return`
24
-
25
- Check your code at `+r+":"+i+"."}return""}}var Be={};function Jt(e){{var r=Je();if(!r){var i=typeof e=="string"?e:e.displayName||e.name;i&&(r=`
26
-
27
- Check the top-level render call using <`+i+">.")}return r}}function ze(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var i=Jt(r);if(Be[i])return;Be[i]=!0;var s="";e&&e._owner&&e._owner!==ve.current&&(s=" It was passed a child from "+M(e._owner.type)+"."),W(e),_('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',i,s),W(null)}}function He(e,r){{if(typeof e!="object")return;if(he(e))for(var i=0;i<e.length;i++){var s=e[i];pe(s)&&ze(s,r)}else if(pe(e))e._store&&(e._store.validated=!0);else if(e){var d=ce(e);if(typeof d=="function"&&d!==e.entries)for(var h=d.call(e),u;!(u=h.next()).done;)pe(u.value)&&ze(u.value,r)}}}function Bt(e){{var r=e.type;if(r==null||typeof r=="string")return;var i;if(typeof r=="function")i=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===v||r.$$typeof===C))i=r.propTypes;else return;if(i){var s=M(r);At(i,e.props,"prop",s,e)}else if(r.PropTypes!==void 0&&!ye){ye=!0;var d=M(r);_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",d||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&_("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function zt(e){{for(var r=Object.keys(e.props),i=0;i<r.length;i++){var s=r[i];if(s!=="children"&&s!=="key"){W(e),_("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",s),W(null);break}}e.ref!==null&&(W(e),_("Invalid attribute `ref` supplied to `React.Fragment`."),W(null))}}function $e(e,r,i,s,d,h){{var u=wt(e);if(!u){var l="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(l+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var b=Gt(d);b?l+=b:l+=Je();var y;e===null?y="null":he(e)?y="array":e!==void 0&&e.$$typeof===t?(y="<"+(M(e.type)||"Unknown")+" />",l=" Did you accidentally export a JSX literal instead of a component?"):y=typeof e,_("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",y,l)}var E=Yt(e,r,i,d,h);if(E==null)return E;if(u){var I=r.children;if(I!==void 0)if(s)if(he(I)){for(var V=0;V<I.length;V++)He(I[V],e);Object.freeze&&Object.freeze(I)}else _("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else He(I,e)}return e===o?zt(E):Bt(E),E}}function Ht(e,r,i){return $e(e,r,i,!0)}function $t(e,r,i){return $e(e,r,i,!1)}var Xt=$t,Qt=Ht;G.Fragment=o,G.jsx=Xt,G.jsxs=Qt}()),G}process.env.NODE_ENV==="production"?oe.exports=yt():oe.exports=pt();var se=oe.exports;const mt=(a,t)=>{switch(t.type){case"INIT":return{...a,isLoading:!1,isAuthenticated:t.user!=null,user:t.user,error:void 0};case"GET_TOKENS_COMPLETE":case"HANDLE_CALLBACK_COMPLETE":case"GET_ACCESS_TOKEN_COMPLETE":return{...a,isLoading:!1,isAuthenticated:t.user!=null,user:t.user,error:void 0};case"LOGOUT":return{...a,isAuthenticated:!1,user:void 0};case"ERROR":return{...a,isLoading:!1,error:t.error}}},Et={isLoading:!0,isAuthenticated:!1},Ce=a=>{if(a==null||Object.keys(a).length<=0)return!0;const t=Object.keys(a);for(const n of t)if(a[n]!=null&&a[n]!=="")return!1;return!0},_t=a=>{const t=Ce(a.config),n=Ce(a.persistentOptions);return!t||!n},Tt=a=>{const{children:t,configurationEndpoint:n,clientId:o,redirectUrl:c,logoutRedirectUrl:w,scopes:S,persistentStore:P,onRedirectCallback:v,checkRedirectUrlMatch:x}=a;if(k.useContext(z)!=null)throw new Error("TID Provider already defined");const C={config:{configurationEndpoint:n??"",clientId:o??"",redirectUrl:c??"",logoutRedirectUrl:w??"",scopes:S??[""]},persistentOptions:{persistentStore:P??"in-memory"}},[f]=k.useState(a.tidClient??new Se(C)),[F,U]=k.useReducer(mt,Et),H=k.useRef(!1),ce=k.useMemo(()=>x?f.getRedirectUrl():void 0,[x,f]);k.useEffect(()=>{H.current||(a.tidClient!=null&&_t({config:{configurationEndpoint:n,clientId:o,redirectUrl:c,logoutRedirectUrl:w,scopes:S},persistentOptions:{persistentStore:P}})&&console.warn("When TID client is pass as prop, any client configuration property sent directly to the TID Provider component will be ignored"),H.current=!0,(async()=>{try{let g;if(ct(void 0,ce)){const{authState:O}=await f.handleCallback();g=await f.getUser(),v!=null&&v(O)}else await f.loadUserSession(),g=await f.getUser();U({type:"INIT",user:g})}catch(g){let O=g;typeof g=="string"&&(O=new Error(g)),U({type:"ERROR",error:O})}})())},[f,v]);const D=k.useCallback(async()=>{const g=await f.getAccessTokenSilently(),O=await f.getUser();return U({type:"GET_ACCESS_TOKEN_COMPLETE",user:O}),g},[f]),_=k.useCallback(async()=>{const g=await f.getTokens(),O=await f.getUser();return U({type:"GET_TOKENS_COMPLETE",user:O}),g},[f]),$=k.useCallback(async g=>{await f.loginWithRedirect(g)},[f]),X=k.useCallback(async g=>{await f.logout(g),(g==null?void 0:g.disabledAutoRedirect)!=null&&g.disabledAutoRedirect&&U({type:"LOGOUT"})},[f]),Q=k.useCallback(async g=>{const{authState:O}=await f.handleCallback(g),Z=await f.getUser();return U({type:"HANDLE_CALLBACK_COMPLETE",user:Z}),{authState:O}},[f]),le=k.useMemo(()=>({...F,getAccessTokenSilently:D,getTokens:_,loginWithRedirect:$,handleCallback:Q,logout:X}),[F,D,_,$,Q,X]);return se.jsx(z.Provider,{value:le,children:t})},kt=Re,St=Tt,Rt=({renderComponent:a,loader:t})=>{const{isAuthenticated:n,isLoading:o,loginWithRedirect:c}=Re();return k.useEffect(()=>{!o&&!n&&(async()=>await c())()},[o,n,c]),n?a:t||se.jsx(se.Fragment,{})};m.AuthenticationGuard=Rt,m.TIDClient=Se,m.TIDContext=z,m.TIDProvider=St,m.useAuth=kt,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
1
+ (function(o,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("@trimble-oss/trimble-id"),require("es-cookie"),require("jwt-decode"),require("react"),require("react/jsx-runtime")):typeof define=="function"&&define.amd?define(["exports","@trimble-oss/trimble-id","es-cookie","jwt-decode","react","react/jsx-runtime"],l):(o=typeof globalThis<"u"?globalThis:o||self,l(o.ReactTID={},o.trimbleId,o.esCookie,o.jwt_decode,o.React,o.jsxRuntime))})(this,function(o,l,k,G,h,E){"use strict";var Se=Object.defineProperty;var me=(o,l,k)=>l in o?Se(o,l,{enumerable:!0,configurable:!0,writable:!0,value:k}):o[l]=k;var c=(o,l,k)=>(me(o,typeof l!="symbol"?l+"":l,k),k);function F(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const _=F(k);class J{constructor(){c(this,"generateCache",function(){const e={token:void 0,user:void 0};return{async getToken(){return e.token},async getUser(){return e.user},async storeToken(t){e.token=t},async storeUser(t){e.user=t},clear(){return e.token=void 0,e.user=void 0,Promise.resolve(void 0)}}}())}}class z{constructor(e){c(this,"localStorage");c(this,"cacheKey");this.localStorage=window.localStorage,this.cacheKey=e.cacheKey}async getToken(){const e=this.getAuthKey(),t=localStorage.getItem(e);return t?JSON.parse(t):void 0}async getUser(){const e=this.getUserKey(),t=localStorage.getItem(e);return t?JSON.parse(t):void 0}async storeToken(e){const t=this.getAuthKey(),s=JSON.stringify(e);localStorage.setItem(t,s)}async storeUser(e){const t=this.getUserKey(),s=JSON.stringify(e);localStorage.setItem(t,s)}getUserKey(){return this.cacheKey.getUserKey()}getAuthKey(){return this.cacheKey.getAuthKey()}clear(){return this.localStorage.removeItem(this.getAuthKey()),this.localStorage.removeItem(this.getUserKey()),Promise.resolve(void 0)}}const I="@TID",H=`${I}_AUTH_KEY`,j=`${I}_USER_KEY`;class q{constructor(e){c(this,"clientId");c(this,"prefix",I);c(this,"authSuffix",H);c(this,"userSuffix",j);this.clientId=e.client_id}getUserKey(){return`${this.prefix}_${this.userSuffix}_${this.clientId}`}getAuthKey(){return`${this.prefix}_${this.authSuffix}_${this.clientId}`}}class B{constructor(e){c(this,"sessionStorage");c(this,"cacheKey");this.sessionStorage=window.sessionStorage,this.cacheKey=e.cacheKey}async getToken(){const e=this.getAuthKey(),t=sessionStorage.getItem(e);return t?JSON.parse(t):void 0}async getUser(){const e=this.getUserKey(),t=sessionStorage.getItem(e);return t?JSON.parse(t):void 0}async storeToken(e){const t=this.getAuthKey(),s=JSON.stringify(e);sessionStorage.setItem(t,s)}async storeUser(e){const t=this.getUserKey(),s=JSON.stringify(e);sessionStorage.setItem(t,s)}getUserKey(){return this.cacheKey.getUserKey()}getAuthKey(){return this.cacheKey.getAuthKey()}clear(){return this.sessionStorage.removeItem(this.getAuthKey()),this.sessionStorage.removeItem(this.getUserKey()),Promise.resolve(void 0)}}class Y{constructor(e){c(this,"persistentStore");c(this,"cacheStorage");c(this,"cacheKey");this.persistentStore=e.persistentStore,this.cacheKey=new q({client_id:e.clientId}),this.persistentStore==="localStorage"?this.cacheStorage=new z({cacheKey:this.cacheKey}):this.persistentStore==="sessionStorage"?this.cacheStorage=new B({cacheKey:this.cacheKey}):this.cacheStorage=new J().generateCache}async setToken(e){await this.cacheStorage.storeToken(e)}async setUser(e){await this.cacheStorage.storeUser(e)}async getUser(){return this.cacheStorage.getUser()}async getToken(){return this.cacheStorage.getToken()}async clear(){await this.cacheStorage.clear()}}const K=5*6e4,Q=["code","state"],C=i=>i.split("?")[0],X=i=>i.split("?")[1],P=i=>{let e=i;if(!i.startsWith("?"))try{e=new URL(i).search}catch{}return new URLSearchParams(e)},Z=(i=window.location.href,e)=>{if(e!=null){const s=C(e),n=C(i??"");if(s!==n)return!1}const t=P(i);for(const s of Q)if(!t.has(s))return!1;return!0},ee=i=>({id:i.sub,name:`${i.given_name} ${i.family_name}`,given_name:i.given_name,family_name:i.family_name,picture:i.picture,email:i.email,email_verified:i.email_verified,phone_number_verified:!1}),te="@TID_COOKIE";class ie{get(e){const t=_.get(e);if(t==null)throw new Error("Cookie not found");return JSON.parse(t)}set(e,t,s){let n={};window.location.protocol==="https:"&&(n={secure:!0,sameSite:"none"}),s!=null&&s.expires&&(n.expires=s.expires),s!=null&&s.domain&&(n.domain=s.domain),_.set(e,JSON.stringify(t),n)}remove(e,t){const s={};t!=null&&t.domain&&(s.domain=t.domain),_.remove(e,s)}}class se{constructor(e){c(this,"cookieKey");c(this,"cookiesStorage");this.cookieKey=`${te}.${e.clientId}`,this.cookiesStorage=new ie}save(e){this.cookiesStorage.set(this.cookieKey,e,{expires:1})}get(){try{return this.cookiesStorage.get(this.cookieKey)}catch{return}}clear(){this.cookiesStorage.remove(this.cookieKey)}}class U extends Error{}class A extends Error{}class ne extends Error{}const u="@trimble-oss/trimble-id-react",g="0.1.1",re={configurationEndpoint:"",clientId:"",redirectUrl:"",logoutRedirectUrl:"",scopes:[]},oe={persistentStore:"in-memory"};class R{constructor(e){c(this,"tokenProvider");c(this,"cacheManager");c(this,"cookiesManager");c(this,"clientId");c(this,"redirectUrl");c(this,"analyticshttpclient");const{config:t=re,persistentOptions:s=oe}=e;if(this.redirectUrl=t.redirectUrl,t.configurationEndpoint==null||t.configurationEndpoint=="")throw new Error("Configuration endpoint not defined");if(t.clientId==null||t.clientId=="")throw new Error("Consumer key is not defined");this.cookiesManager=new se({clientId:t.clientId});const n=this.cookiesManager.get(),y=new l.OpenIdEndpointProvider(t.configurationEndpoint);let d=new l.AuthorizationCodeGrantTokenProvider(y,t.clientId,t.redirectUrl).WithScopes(t.scopes);t.logoutRedirectUrl&&(d=d.WithLogoutRedirect(t.logoutRedirectUrl)),(n==null?void 0:n.code_verifier)!=null&&(d=d.WithProofKeyForCodeExchange(n.code_verifier)),this.tokenProvider=d,this.cacheManager=new Y({clientId:t.clientId,persistentStore:s.persistentStore}),this.clientId=t.clientId,this.analyticshttpclient=l.AnalyticsHttpClient,this.analyticshttpclient.sendInitEvent("TIDClient",this.clientId,u,g)}async loginWithRedirect(e){this.analyticshttpclient.sendMethodEvent(this.loginWithRedirect.name,this.clientId,u,g);const{onRedirect:t}=e||{},s=l.AuthorizationCodeGrantTokenProvider.GenerateCodeVerifier();this.cookiesManager.save({code_verifier:s}),this.tokenProvider=this.tokenProvider.WithProofKeyForCodeExchange(s);const n=await this.tokenProvider.GetOAuthRedirect("state");t!=null?t(n):window.location.assign(n)}async handleCallback(e=window.location.href){const t=this.cookiesManager.get();if(t==null||(t==null?void 0:t.code_verifier)==null)throw new ne("Code verifier not available");const s=X(e),n=P(e),y=n.get("identity_provider")??"",d=n.get("state")??"";return await this.tokenProvider.ValidateQuery(s),await this.generateToken(y),{authState:d}}async generateToken(e){var w,r;const t=await this.tokenProvider.RetrieveToken(),s=await this.tokenProvider.RetrieveRefreshToken(),n=await this.tokenProvider.RetrieveIdToken(),y=await this.tokenProvider.RetrieveTokenExpiry(),v=new Date(y).getTime(),m=(r=(w=this.tokenProvider)==null?void 0:w._scopes)==null?void 0:r.join(" ");await this.cacheManager.setToken({scope:m,state:"",session_state:"",identity_provider:e,token_type:"bearer",access_token:t,refresh_token:s,id_token:n,expires_at:v});const T=G(n),M=ee(T);await this.cacheManager.setUser(M),await this.reloadCodeVerifier()}async reloadCodeVerifier(){const e=await this.tokenProvider.RetrieveCodeVerifier();this.cookiesManager.save({code_verifier:e}),this.tokenProvider=this.tokenProvider.WithProofKeyForCodeExchange(e)}async getUser(){return this.analyticshttpclient.sendMethodEvent(this.getUser.name,this.clientId,u,g),await this.cacheManager.getUser()}async getAccessTokenSilently(){this.analyticshttpclient.sendMethodEvent(this.getAccessTokenSilently.name,this.clientId,u,g);let e=await this.cacheManager.getToken();if(e==null)throw this.analyticshttpclient.sendExceptionEvent(this.getAccessTokenSilently.name,"No token available",this.clientId,u,g),new A("No token available");const t=new Date(new Date().getTime()+K);if((e==null?void 0:e.expires_at)==null||(e==null?void 0:e.expires_at)<t.getTime()){try{await this.tokenProvider.RetrieveToken()}catch(s){throw this.analyticshttpclient.sendExceptionEvent(this.getAccessTokenSilently.name,s.message,this.clientId,u,g),new U(s.message)}await this.generateToken((e==null?void 0:e.identity_provider)??""),e=await this.cacheManager.getToken()}return(e==null?void 0:e.access_token)||""}async getTokens(){this.analyticshttpclient.sendMethodEvent(this.getTokens.name,this.clientId,u,g);let e=await this.cacheManager.getToken();if(e==null)throw this.analyticshttpclient.sendExceptionEvent(this.getTokens.name,"No token available",this.clientId,u,g),new A("No token available");const t=new Date(new Date().getTime()+K);if((e==null?void 0:e.expires_at)==null||(e==null?void 0:e.expires_at)<t.getTime()){try{await this.tokenProvider.RetrieveToken()}catch(s){throw this.analyticshttpclient.sendExceptionEvent(this.getTokens.name,s.message,this.clientId,u,g),new U(s.message)}await this.generateToken((e==null?void 0:e.identity_provider)??""),e=await this.cacheManager.getToken()}return{access_token:(e==null?void 0:e.access_token)||"",expires_at:(e==null?void 0:e.expires_at)||0,id_token:(e==null?void 0:e.id_token)||""}}async logout(e){this.analyticshttpclient.sendMethodEvent(this.logout.name,this.clientId,u,g);const{onRedirect:t,disabledAutoRedirect:s}=e||{};this.cacheManager&&await this.cacheManager.clear(),this.cookiesManager&&this.cookiesManager.clear();const n=await this.tokenProvider.GetOAuthLogoutRedirect("state");if(t!=null)return t(n);s||window.location.assign(n)}async checkSession(){try{await this.getAccessTokenSilently()}catch{return!1}return!0}async loadUserSession(){await this.loadCacheSessionIntoSDK(),await this.checkSession()||await this.cacheManager.clear()}async loadCacheSessionIntoSDK(){const e=await this.cacheManager.getToken();if(e==null)return;const t=e.access_token,s=e.refresh_token||"",n=e.id_token,y=e.expires_at;this.tokenProvider=this.tokenProvider.WithAccessToken(t,y).WithRefreshToken(s).WithIdToken(n)}getBearerTokenHttpClient(e){return new l.BearerTokenHttpClientProvider(this.tokenProvider,e)}getRedirectUrl(){return this.redirectUrl}}const p=h.createContext(null),O=()=>h.useContext(p)??{},ae=(i,e)=>{switch(e.type){case"INIT":return{...i,isLoading:!1,isAuthenticated:e.user!=null,user:e.user,error:void 0};case"GET_TOKENS_COMPLETE":case"HANDLE_CALLBACK_COMPLETE":case"GET_ACCESS_TOKEN_COMPLETE":return{...i,isLoading:!1,isAuthenticated:e.user!=null,user:e.user,error:void 0};case"LOGOUT":return{...i,isAuthenticated:!1,user:void 0};case"ERROR":return{...i,isLoading:!1,error:e.error}}},ce={isLoading:!0,isAuthenticated:!1},x=i=>{if(i==null||Object.keys(i).length<=0)return!0;const e=Object.keys(i);for(const t of e)if(i[t]!=null&&i[t]!=="")return!1;return!0},le=i=>{const e=x(i.config),t=x(i.persistentOptions);return!e||!t},he=i=>{const{children:e,configurationEndpoint:t,clientId:s,redirectUrl:n,logoutRedirectUrl:y,scopes:d,persistentStore:v,onRedirectCallback:m,checkRedirectUrlMatch:T}=i;if(h.useContext(p)!=null)throw new Error("TID Provider already defined");const w={config:{configurationEndpoint:t??"",clientId:s??"",redirectUrl:n??"",logoutRedirectUrl:y??"",scopes:d??[""]},persistentOptions:{persistentStore:v??"in-memory"}},[r]=h.useState(i.tidClient??new R(w)),[D,S]=h.useReducer(ae,ce),L=h.useRef(!1),ye=h.useMemo(()=>T?r.getRedirectUrl():void 0,[T,r]);h.useEffect(()=>{L.current||(i.tidClient!=null&&le({config:{configurationEndpoint:t,clientId:s,redirectUrl:n,logoutRedirectUrl:y,scopes:d},persistentOptions:{persistentStore:v}})&&console.warn("When TID client is pass as prop, any client configuration property sent directly to the TID Provider component will be ignored"),L.current=!0,(async()=>{try{let a;if(Z(void 0,ye)){const{authState:f}=await r.handleCallback();a=await r.getUser(),m!=null&&m(f)}else await r.loadUserSession(),a=await r.getUser();S({type:"INIT",user:a})}catch(a){let f=a;typeof a=="string"&&(f=new Error(a)),S({type:"ERROR",error:f})}})())},[r,m]);const b=h.useCallback(async()=>{const a=await r.getAccessTokenSilently(),f=await r.getUser();return S({type:"GET_ACCESS_TOKEN_COMPLETE",user:f}),a},[r]),N=h.useCallback(async()=>{const a=await r.getTokens(),f=await r.getUser();return S({type:"GET_TOKENS_COMPLETE",user:f}),a},[r]),W=h.useCallback(async a=>{await r.loginWithRedirect(a)},[r]),V=h.useCallback(async a=>{await r.logout(a),(a==null?void 0:a.disabledAutoRedirect)!=null&&a.disabledAutoRedirect&&S({type:"LOGOUT"})},[r]),$=h.useCallback(async a=>{const{authState:f}=await r.handleCallback(a),ke=await r.getUser();return S({type:"HANDLE_CALLBACK_COMPLETE",user:ke}),{authState:f}},[r]),fe=h.useMemo(()=>({...D,getAccessTokenSilently:b,getTokens:N,loginWithRedirect:W,handleCallback:$,logout:V}),[D,b,N,W,$,V]);return E.jsx(p.Provider,{value:fe,children:e})},de=O,ue=he,ge=({renderComponent:i,loader:e})=>{const{isAuthenticated:t,isLoading:s,loginWithRedirect:n}=O();return h.useEffect(()=>{!s&&!t&&(async()=>await n())()},[s,t,n]),t?i:e||E.jsx(E.Fragment,{})};o.AuthenticationGuard=ge,o.TIDClient=R,o.TIDContext=p,o.TIDProvider=ue,o.useAuth=de,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  {
3
3
  "name": "@trimble-oss/trimble-id-react",
4
4
  "private": false,
5
- "version": "0.1.0",
5
+ "version": "0.1.1",
6
6
  "homepage": "https://github.com/trimble-oss/trimble-id-sdk-docs-for-react",
7
7
  "author": "Trimble developers <developers@trimble.com>",
8
8
  "license": "MIT",