Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More

@fluid-topics/ft-app-context

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fluid-topics/ft-app-context - npm Package Compare versions

Comparing version 0.3.71 to 1.0.0-alpha.0

export declare const FtAppContextCssVariables: {};
export declare const styles: import("lit").CSSResult;
//# sourceMappingURL=ft-app-context.css.d.ts.map

@@ -6,2 +6,1 @@ import { css } from "lit";

`;
//# sourceMappingURL=ft-app-context.css.js.map

@@ -25,2 +25,1 @@ import { PropertyValues } from "lit";

}
//# sourceMappingURL=ft-app-context.d.ts.map

@@ -14,3 +14,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

import { FluidTopicsApiProvider } from "./services/FluidTopicsApiProvider";
export class FtAppContext extends FtLitElement {
class FtAppContext extends FtLitElement {
constructor() {

@@ -128,2 +128,2 @@ super(...arguments);

], FtAppContext.prototype, "apiProvider", void 0);
//# sourceMappingURL=ft-app-context.js.map
export { FtAppContext };
!function(t,i,s,e){const o=s.css`
`,n="ft-app-info",a=i.FtReduxStore.get({name:n,reducers:{setBaseUrl:(t,i)=>{t.baseUrl=i.payload},setApiIntegrationIdentifier:(t,i)=>{t.apiIntegrationIdentifier=i.payload},setUiLocale:(t,i)=>{t.uiLocale=i.payload},setAvailableUiLocales:(t,i)=>{t.availableUiLocales=i.payload},setEditorMode:(t,i)=>{t.editorMode=i.payload},setNoCustom:(t,i)=>{t.noCustom=i.payload},setNoCustomComponent:(t,i)=>{t.noCustomComponent=i.payload},setSession:(t,i)=>{t.session=i.payload}},initialState:{uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],editorMode:!1,noCustom:!1,noCustomComponent:!1}});class l{static build(t){const{baseUrl:i,apiIntegrationIdentifier:s}=a.getState(),e=null!=t?t:s;if(i&&e&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(i,e,!0)}static get(t){var i;return null!=t?l.build(t):null!==(i=l.API)&&void 0!==i?i:l.API=l.build()}static await(t){return new Promise((i=>{let s=l.get(t);if(s)i(s);else{const e=a.subscribe((()=>{s=l.get(t),s&&(e(),i(s))}))}}))}}var h;const r=Symbol("clearAfterUnitTest");class c{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new i.CacheRegistry,this.listeners={},this.currentUiLocale="",this[h]=()=>{this.defaultMessages={},this.cache=new i.CacheRegistry,this.listeners={}},this.currentUiLocale=a.getState().uiLocale,a.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=a.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const i=t.name.toLowerCase();this.cache.setFinal(i,t),this.notify(i)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,s){var e;if(t=t.toLowerCase(),Object.keys(s).length>0){const o={...null!==(e=this.defaultMessages[t])&&void 0!==e?e:{},...s};i.deepEqual(this.defaultMessages[t],o)||(this.defaultMessages[t]=o,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,s,...e){var o,n,a;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(n=null===(o=this.cache.getNow(t))||void 0===o?void 0:o.messages)&&void 0!==n?n:{};return new i.ParametrizedLabelResolver(null!==(a=this.defaultMessages[t])&&void 0!==a?a:{},l).resolve(s,...e)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,i){var s;return t=t.toLowerCase(),this.listeners[t]=null!==(s=this.listeners[t])&&void 0!==s?s:new Set,this.listeners[t].add(i),()=>{var s;return null===(s=this.listeners[t])||void 0===s?void 0:s.delete(i)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>i.delay(0).then((()=>t())).catch((()=>null)))))}}h=r,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new c((async(t,i)=>(await l.await()).getFluidTopicsMessageContext(t,i)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new c((async(t,i)=>(await l.await()).getCustomMessageContext(t,i))));const u=window.FluidTopicsI18nService,d=window.FluidTopicsCustomI18nService;var v=function(t,i,s,e){for(var o,n=arguments.length,a=n<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,l=t.length-1;l>=0;l--)(o=t[l])&&(a=(n<3?o(a):n>3?o(i,s,a):o(i,s))||a);return n>3&&a&&Object.defineProperty(i,s,a),a};class w extends i.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.availableUiLocales=[],this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>l.get(),this.cache=new i.CacheRegistry,this.cleanSessionDebouncer=new i.Debouncer}render(){return s.html`
`,n="ft-app-info",a=i.FtReduxStore.get({name:n,reducers:{setBaseUrl:(t,i)=>{t.baseUrl=i.payload},setApiIntegrationIdentifier:(t,i)=>{t.apiIntegrationIdentifier=i.payload},setUiLocale:(t,i)=>{t.uiLocale=i.payload},setAvailableUiLocales:(t,i)=>{t.availableUiLocales=i.payload},setEditorMode:(t,i)=>{t.editorMode=i.payload},setNoCustom:(t,i)=>{t.noCustom=i.payload},setNoCustomComponent:(t,i)=>{t.noCustomComponent=i.payload},setSession:(t,i)=>{t.session=i.payload}},initialState:{uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],editorMode:!1,noCustom:!1,noCustomComponent:!1}});class l{static build(t){const{baseUrl:i,apiIntegrationIdentifier:s}=a.getState(),e=null!=t?t:s;if(i&&e&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(i,e,!0)}static get(t){var i;return null!=t?l.build(t):null!==(i=l.API)&&void 0!==i?i:l.API=l.build()}static await(t){return new Promise((i=>{let s=l.get(t);if(s)i(s);else{const e=a.subscribe((()=>{s=l.get(t),s&&(e(),i(s))}))}}))}}var h;const r=Symbol("clearAfterUnitTest");class c{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new i.CacheRegistry,this.listeners={},this.currentUiLocale="",this[h]=()=>{this.defaultMessages={},this.cache=new i.CacheRegistry,this.listeners={}},this.currentUiLocale=a.getState().uiLocale,a.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=a.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const i=t.name.toLowerCase();this.cache.setFinal(i,t),this.notify(i)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,s){var e;if(t=t.toLowerCase(),Object.keys(s).length>0){const o={...null!==(e=this.defaultMessages[t])&&void 0!==e?e:{},...s};i.deepEqual(this.defaultMessages[t],o)||(this.defaultMessages[t]=o,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,s,...e){var o,n,a;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(n=null===(o=this.cache.getNow(t))||void 0===o?void 0:o.messages)&&void 0!==n?n:{};return new i.ParametrizedLabelResolver(null!==(a=this.defaultMessages[t])&&void 0!==a?a:{},l).resolve(s,...e)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,i){var s;return t=t.toLowerCase(),this.listeners[t]=null!==(s=this.listeners[t])&&void 0!==s?s:new Set,this.listeners[t].add(i),()=>{var s;return null===(s=this.listeners[t])||void 0===s?void 0:s.delete(i)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>i.delay(0).then((()=>t())).catch((()=>null)))))}}h=r,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new c((async(t,i)=>(await l.await()).getFluidTopicsMessageContext(t,i)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new c((async(t,i)=>(await l.await()).getCustomMessageContext(t,i))));const u=window.FluidTopicsI18nService,d=window.FluidTopicsCustomI18nService;var w=function(t,i,s,e){for(var o,n=arguments.length,a=n<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,l=t.length-1;l>=0;l--)(o=t[l])&&(a=(n<3?o(a):n>3?o(i,s,a):o(i,s))||a);return n>3&&a&&Object.defineProperty(i,s,a),a};class v extends i.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.availableUiLocales=[],this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>l.get(),this.cache=new i.CacheRegistry,this.cleanSessionDebouncer=new i.Debouncer}render(){return s.html`
<slot></slot>
`}updated(t){super.updated(t),t.has("baseUrl")&&a.actions.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&a.actions.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&a.actions.setUiLocale(this.uiLocale),t.has("noCustom")&&a.actions.setNoCustom(this.noCustom),t.has("editorMode")&&a.actions.setEditorMode(this.editorMode),t.has("noCustomComponent")&&a.actions.setNoCustomComponent(this.noCustomComponent),t.has("session")&&a.actions.setSession(this.session),t.has("availableUiLocales")&&a.actions.setAvailableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>u.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){const t=this.apiProvider();!this.withManualResources&&t&&(null==this.session&&(this.session=await this.cache.get("session",(async()=>{const i=await t.getCurrentSession();return i.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),i.idleTimeoutInMillis),i}))),null==this.availableUiLocales&&(this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>t.getAvailableUiLocales()))))}}w.elementDefinitions={},w.styles=o,v([e.property()],w.prototype,"baseUrl",void 0),v([e.property()],w.prototype,"apiIntegrationIdentifier",void 0),v([e.property()],w.prototype,"uiLocale",void 0),v([i.jsonProperty([])],w.prototype,"availableUiLocales",void 0),v([e.property({type:Boolean})],w.prototype,"editorMode",void 0),v([e.property({type:Boolean})],w.prototype,"noCustom",void 0),v([e.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],w.prototype,"noCustomComponent",void 0),v([e.property({type:Boolean})],w.prototype,"withManualResources",void 0),v([i.jsonProperty([])],w.prototype,"messageContexts",void 0),v([i.jsonProperty(void 0)],w.prototype,"session",void 0),v([e.property({type:Object})],w.prototype,"apiProvider",void 0),i.customElement("ft-app-context")(w),t.FluidTopicsApiProvider=l,t.FtAppContext=w,t.FtAppContextCssVariables={},t.FtAppInfoStoreName=n,t.FtI18nServiceInternalClass=c,t.clearAfterUnitTest=r,t.ftAppInfoStore=a,t.ftCustomI18nService=d,t.ftI18nService=u,t.styles=o,Object.defineProperty(t,"t",{value:!0})}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators);
`}updated(t){super.updated(t),t.has("baseUrl")&&a.actions.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&a.actions.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&a.actions.setUiLocale(this.uiLocale),t.has("noCustom")&&a.actions.setNoCustom(this.noCustom),t.has("editorMode")&&a.actions.setEditorMode(this.editorMode),t.has("noCustomComponent")&&a.actions.setNoCustomComponent(this.noCustomComponent),t.has("session")&&a.actions.setSession(this.session),t.has("availableUiLocales")&&a.actions.setAvailableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>u.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){const t=this.apiProvider();!this.withManualResources&&t&&(null==this.session&&(this.session=await this.cache.get("session",(async()=>{const i=await t.getCurrentSession();return i.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),i.idleTimeoutInMillis),i}))),null==this.availableUiLocales&&(this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>t.getAvailableUiLocales()))))}}v.elementDefinitions={},v.styles=o,w([e.property()],v.prototype,"baseUrl",void 0),w([e.property()],v.prototype,"apiIntegrationIdentifier",void 0),w([e.property()],v.prototype,"uiLocale",void 0),w([i.jsonProperty([])],v.prototype,"availableUiLocales",void 0),w([e.property({type:Boolean})],v.prototype,"editorMode",void 0),w([e.property({type:Boolean})],v.prototype,"noCustom",void 0),w([e.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],v.prototype,"noCustomComponent",void 0),w([e.property({type:Boolean})],v.prototype,"withManualResources",void 0),w([i.jsonProperty([])],v.prototype,"messageContexts",void 0),w([i.jsonProperty(void 0)],v.prototype,"session",void 0),w([e.property({type:Object})],v.prototype,"apiProvider",void 0),i.customElement("ft-app-context")(v),t.FluidTopicsApiProvider=l,t.FtAppContext=v,t.FtAppContextCssVariables={},t.FtAppInfoStoreName=n,t.FtI18nServiceInternalClass=c,t.clearAfterUnitTest=r,t.ftAppInfoStore=a,t.ftCustomI18nService=d,t.ftI18nService=u,t.styles=o}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators);

@@ -14,2 +14,1 @@ import { FtMessageContext, FtSession, FtUiLocale } from "@fluid-topics/public-api";

}
//# sourceMappingURL=ft-app-context.properties.d.ts.map
export {};
//# sourceMappingURL=ft-app-context.properties.js.map

@@ -7,2 +7,1 @@ export * from "./redux-stores/FtAppInfoStore";

export * from "./ft-app-context";
//# sourceMappingURL=index.d.ts.map

@@ -10,2 +10,1 @@ import { customElement } from "@fluid-topics/ft-wc-utils";

customElement("ft-app-context")(FtAppContext);
//# sourceMappingURL=index.js.map

@@ -25,6 +25,5 @@ import { FtReduxStore } from "@fluid-topics/ft-wc-utils";

};
export declare type FtAppInfoStateReducers = typeof reducers;
export declare type FtAppInfoStore = FtReduxStore<FtAppInfoState, FtAppInfoStateReducers>;
export type FtAppInfoStateReducers = typeof reducers;
export type FtAppInfoStore = FtReduxStore<FtAppInfoState, FtAppInfoStateReducers>;
export declare const ftAppInfoStore: FtAppInfoStore;
export {};
//# sourceMappingURL=FtAppInfoStore.d.ts.map

@@ -40,2 +40,1 @@ import { FtReduxStore } from "@fluid-topics/ft-wc-utils";

});
//# sourceMappingURL=FtAppInfoStore.js.map

@@ -15,2 +15,1 @@ import type { FluidTopicsApi } from "@fluid-topics/public-api";

}
//# sourceMappingURL=FluidTopicsApiProvider.d.ts.map

@@ -36,2 +36,1 @@ import { ftAppInfoStore } from "../redux-stores/FtAppInfoStore";

}
//# sourceMappingURL=FluidTopicsApiProvider.js.map

@@ -8,3 +8,3 @@ import type { FtMessageContext } from "@fluid-topics/public-api";

}
export declare type Unsubscribe = () => void;
export type Unsubscribe = () => void;
export declare const clearAfterUnitTest: unique symbol;

@@ -29,5 +29,4 @@ export declare class FtI18nServiceInternalClass {

}
export declare type FtI18nService = FtI18nServiceInternalClass;
export type FtI18nService = FtI18nServiceInternalClass;
export declare const ftI18nService: FtI18nService;
export declare const ftCustomI18nService: FtI18nService;
//# sourceMappingURL=FtI18nService.d.ts.map

@@ -96,2 +96,1 @@ var _a;

export const ftCustomI18nService = window.FluidTopicsCustomI18nService;
//# sourceMappingURL=FtI18nService.js.map
{
"name": "@fluid-topics/ft-app-context",
"version": "0.3.71",
"version": "1.0.0-alpha.0",
"description": "Global application context for Fluid Topics integrations",

@@ -22,4 +22,4 @@ "keywords": [

"dependencies": {
"@fluid-topics/ft-wc-utils": "0.3.71",
"lit": "2.2.8"
"@fluid-topics/ft-wc-utils": "1.0.0-alpha.0",
"lit": "2.7.2"
},

@@ -32,3 +32,3 @@ "devDependencies": {

},
"gitHead": "aeaa883cc0e3596e6cc75d282aa99de3c603f6a2"
"gitHead": "e20baae36b79d721b948090d552affaf92c4f12f"
}

Sorry, the diff of this file is too big to display