@telia-ace/alliance-internal-client-utilities 4.0.0-next.4 → 4.0.0-next.6
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/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
var b=(i=>(i[i.AlreadyInitialized=1e3]="AlreadyInitialized",i[i.NoAppName=1001]="NoAppName",i[i.MissingAppController=1002]="MissingAppController",i[i.MissingCapabilityOnApp=1003]="MissingCapabilityOnApp",i[i.MissingManagedObjectProvider=1004]="MissingManagedObjectProvider",i[i.NoManifest=1005]="NoManifest",i[i.NoRootElement=1006]="NoRootElement",i[i.NoView=1007]="NoView",i[i.CookieKeyNotDefined=1008]="CookieKeyNotDefined",i[i.CookieCategoryNotAllowed=1009]="CookieCategoryNotAllowed",i[i.StorageKeyNotDefined=1010]="StorageKeyNotDefined",i[i.StorageCategoryNotAllowed=1011]="StorageCategoryNotAllowed",i[i.LocalizationTemplateNotDefined=1012]="LocalizationTemplateNotDefined",i[i.NonViewOperation=1013]="NonViewOperation",i))(b||{}),y=(o=>(o[o.CurrentUserMissingProvider=2e3]="CurrentUserMissingProvider",o[o.CurrentUserGatewayNotStarted=2001]="CurrentUserGatewayNotStarted",o[o.CurrentUserMissingBackend=2002]="CurrentUserMissingBackend",o[o.CurrentUserMissingInDatabase=2003]="CurrentUserMissingInDatabase",o))(y||{});function C(e,t){return Object.entries(t).reduce((n,[r,o])=>n.replaceAll(`{{${r}}}`,o),e)}var w={1e3:"The runtime has already been initialized",1001:"App name is not defined on global scope",1002:"No app controller registered for app '{{app}}'",1003:"No capability '{{capability}}' enabled for app '{{app}}'",1004:"No managed object provider registered for object '{{object}}'",1005:"The current apps manifest is not defined on global scope",1006:"Could not find the root element in the DOM",1007:"Could not find view with id '{{id}}' on view controller for app '{{app}}'",1008:"Cookie key '{{key}}' not present in manifest, cookie has not been set",1009:"Cookies categorized as '{{category}}' are not allowed by the user, cookie '{{key}}' has not been set",1010:"Storage key '{{key}}' not present in manifest, item has not been stored",1011:"Storage categorized as '{{category}}' is not allowed by the user, item '{{key}}' has not been stored",1012:"The translation template, referred by the key '{{key}}' is being used in app, but is not defined in the manifest.",1013:"The capability '{{capability}}', requested by an alliance-view element, did not return a View Operation.",2e3:"No managed object provider registered for object 'currentUser'",2001:"Could not access the gateway when querying 'currentUser'",2002:"Could not access the required backend when querying 'currentUser'",2003:"Could not locate the authenticated user in the Alliance database"},h="AllianceError",g=class extends Error{constructor(n,r={}){let o=C(w[n],r),s=`https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${n}`;super(o);this.code=n;this.name=h,this.stack=`[${n}] - ${o}
|
|
2
|
-
${s}`}};function O(e){return!!e.code&&e.name===h}import d from"
|
|
2
|
+
${s}`}};function O(e){return!!e.code&&e.name===h}import d from"crypto";function l(e){if(!u(e))throw new Error("Parameter was not an error")}function u(e){return!!e&&typeof e=="object"&&_(e)==="[object Error]"||e instanceof Error}function _(e){return Object.prototype.toString.call(e)}var U="Layerr",M=U;function m(){return M}function N(e){let t,n="";if(e.length===0)t={};else if(u(e[0]))t={cause:e[0]},n=e.slice(1).join(" ")||"";else if(e[0]&&typeof e[0]=="object")t=Object.assign({},e[0]),n=e.slice(1).join(" ")||"";else if(typeof e[0]=="string")t={},n=n=e.join(" ")||"";else throw new Error("Invalid arguments passed to Layerr");return{options:t,shortMessage:n}}var c=class e extends Error{constructor(t,n){let r=[...arguments],{options:o,shortMessage:s}=N(r),a=s;if(o.cause&&(a=`${a}: ${o.cause.message}`),super(a),this.message=a,o.name&&typeof o.name=="string"?this.name=o.name:this.name=m(),o.cause&&Object.defineProperty(this,"_cause",{value:o.cause}),Object.defineProperty(this,"_info",{value:{}}),o.info&&typeof o.info=="object"&&Object.assign(this._info,o.info),Error.captureStackTrace){let A=o.constructorOpt||this.constructor;Error.captureStackTrace(this,A)}}static cause(t){return l(t),t._cause&&u(t._cause)?t._cause:null}static fullStack(t){l(t);let n=e.cause(t);return n?`${t.stack}
|
|
3
3
|
caused by: ${e.fullStack(n)}`:t.stack??""}static info(t){l(t);let n={},r=e.cause(t);return r&&Object.assign(n,e.info(r)),t._info&&Object.assign(n,t._info),n}toString(){let t=this.name||this.constructor.name||this.constructor.prototype.name;return this.message&&(t=`${t}: ${this.message}`),t}};var E="0123456789ABCDEFGHJKMNPQRSTVWXYZ",p=32,I=0xffffffffffff,R=10,j=16,f=Object.freeze({source:"ulid"});function D(e){let t=e||$(),n=t&&(t.crypto||t.msCrypto)||(typeof d<"u"?d:null);if(typeof n?.getRandomValues=="function")return()=>{let r=new Uint8Array(1);return n.getRandomValues(r),r[0]/255};if(typeof n?.randomBytes=="function")return()=>n.randomBytes(1).readUInt8()/255;if(d?.randomBytes)return()=>d.randomBytes(1).readUInt8()/255;throw new c({info:{code:"PRNG_DETECT",...f}},"Failed to find a reliable PRNG")}function $(){return S()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function v(e,t){let n="";for(;e>0;e--)n=k(t)+n;return n}function L(e,t){if(isNaN(e))throw new c({info:{code:"ENC_TIME_NAN",...f}},`Time must be a number: ${e}`);if(e>I)throw new c({info:{code:"ENC_TIME_SIZE_EXCEED",...f}},`Cannot encode a time larger than ${I}: ${e}`);if(e<0)throw new c({info:{code:"ENC_TIME_NEG",...f}},`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new c({info:{code:"ENC_TIME_TYPE",...f}},`Time must be an integer: ${e}`);let n,r="";for(let o=t;o>0;o--)n=e%p,r=E.charAt(n)+r,e=(e-n)/p;return r}function S(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function k(e){let t=Math.floor(e()*p);return t===p&&(t=p-1),E.charAt(t)}function T(e,t){let n=t||D(),r=isNaN(e)?Date.now():e;return L(r,R)+v(j,n)}function ae(){return T().toLowerCase()}function Z(e){let n=Object.entries(e).reduce((r,o)=>{let[s,a]=o;return typeof a>"u"||(typeof a=="object"&&a!==null?r[s]=JSON.stringify(a):r[s]=a),r},{});return Object.keys(n).length?`?${new URLSearchParams(n)}`:""}function V(){let e=x(),{href:t,search:n}=window.location;return t.replace(e,"").replace(n,"")}function ue(e="",t="",n={}){let r=x().replace(location.origin,""),o=Z(n);return e?t?`${r}/${e}/${t}${o}`:`${r}/${e}${o}`:`${r}${o}`}function le(){let e=V(),[t="",n=""]=e.split("/").filter(r=>!!r);return{app:t,capability:n}}function x(){return globalThis.__ALLIANCE_RUNTIME_ROOT_URL?globalThis.__ALLIANCE_RUNTIME_ROOT_URL:window.origin}function pe(e,t){return P(Object.values(e),({name:n})=>({label:n,value:n,selected:t===n}))}function de(e,t){return Object.values(e).find(r=>r.name===t)}function P(e,t,n){return e.reduce((r,o)=>{let s=t(o);return!s.label||!s.value||r.push({disabled:!1,selected:!1,...s}),r},n?[{label:n,value:"",disabled:!0,selected:!0}]:[])}function ge(e){return t=>{t.key==="Enter"&&e(t)}}function me(e,t="all"){let{email:n,firstName:r,lastName:o}=e;if(r&&o)switch(t){case"all":return`${r} ${o} (${n})`;case"single":return`${r} ${o}`}return n}function be(e){let{email:t,firstName:n,lastName:r}=e;return n&&r?`${n[0]}${r[0]}`.toUpperCase():n?n[0].toUpperCase():t[0].toUpperCase()}function ye(...e){return e.filter(t=>!!t).join(" ")}function he(e){return Object.entries(e).reduce((t,[n,r])=>(typeof r!="object"&&typeof r!="function"&&(t[n]=r),t),{})}function Ne(e,t=750){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>{clearTimeout(n),e(r)},t)}}export{g as AllianceError,b as FrameworkErrorCodes,y as UtilitiesErrorCodes,ye as classNames,ue as createCapabilityPath,Ne as debounce,me as friendlyUserName,le as getCurrentLocationInfo,x as getRuntimeRootUrl,de as getVocaIcon,O as isAllianceError,P as mapToVocaOptions,ge as onEnter,he as props,ae as ulid,be as userInitials,pe as vocaIconsToOptions};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/alliance-internal-client-utilities",
|
|
3
|
-
"version": "4.0.0-next.
|
|
3
|
+
"version": "4.0.0-next.6",
|
|
4
4
|
"description": "Utilities used internally by packages developed by team Alliance.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Telia Company AB",
|