@claspo/document-connector 16.8.0 → 16.9.0-nonlinear
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/BaseDocumentConnector.d.ts +0 -1
- package/BaseDocumentConnector.js +1 -1
- package/DocumentConnectorEventType.d.ts +2 -1
- package/DocumentConnectorEventType.js +1 -1
- package/StaticDocumentConnector.d.ts +0 -1
- package/StaticDocumentConnector.js +1 -1
- package/layouts/GlobalScrollBlocker.d.ts +1 -0
- package/layouts/GlobalScrollBlocker.js +1 -1
- package/package.json +3 -3
package/BaseDocumentConnector.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import CssVarsOperations from"@claspo/common/element/CssVarsOperations";import ThemeCssVars from"@claspo/common/element/ThemeCssVars";import{EditorToWidgetEventType}from"@claspo/renderer/document-model/DocumentModelService";import DefaultEventEmitter from"@claspo/common/DefaultEventEmitter";import DocumentUtils from"@claspo/common/document/DocumentUtils";
|
|
1
|
+
import CssVarsOperations from"@claspo/common/element/CssVarsOperations";import ThemeCssVars from"@claspo/common/element/ThemeCssVars";import{EditorToWidgetEventType}from"@claspo/renderer/document-model/DocumentModelService";import DefaultEventEmitter from"@claspo/common/DefaultEventEmitter";import DocumentUtils from"@claspo/common/document/DocumentUtils";export default class BaseDocumentConnector extends DefaultEventEmitter{constructor(e){super(),this.propsRequestListener=e=>{e.stopPropagation();let t=e.detail.id,o=e.detail.widgetId;if(o&&this.params.formVariantId&&this.params.formVariantId!==o)return;let i=DocumentUtils.getNodeById(this.entryModule.compositionRoot.services.documentModel.getViews(),t);i&&(e.detail.props=this.entryModule.componentFactory.constructProps(i,this.entryModule.viewRenderer.viewResourceManager))},this.params=e,this.entryModule=null,this.controllers=[],this.container=null}disconnect(){var e;null===(e=this.container)||void 0===e||e.removeEventListener("cl-props-request",this.propsRequestListener)}addPropsRequestEventListener(e){this.container=e,e.addEventListener("cl-props-request",this.propsRequestListener)}setEntryModule(e){this.entryModule=e}navigate(e){this.entryModule&&this.entryModule.viewRouter&&this.entryModule.viewRouter.navigate(e)}performAction(e,t){const o=this.entryModule.performAction(e,t);return this.controllers.forEach(o=>{switch(e){case EditorToWidgetEventType.COLOR_SCHEMA_UPDATE:CssVarsOperations.override(t,o.getConnectedElement());break;case EditorToWidgetEventType.THEME_UPDATE:ThemeCssVars.override(t.schema,o.getConnectedElement())}}),o}setEnvironment(e){this.entryModule.performAction(EditorToWidgetEventType.ENVIRONMENT_UPDATE,e)}getComponentManifests(){return this.componentResolver.getComponentManifests()}getSubmitState(){var e,t,o,i,r;return(null===(r=null===(i=null===(o=null===(t=null===(e=this.entryModule)||void 0===e?void 0:e.compositionRoot)||void 0===t?void 0:t.services)||void 0===o?void 0:o.submitState)||void 0===i?void 0:i.getState)||void 0===r?void 0:r.call(i))||"idle"}hasDirtyFormData(){var e,t,o,i,r;return!!(null===(r=null===(i=null===(o=null===(t=null===(e=this.entryModule)||void 0===e?void 0:e.compositionRoot)||void 0===t?void 0:t.services)||void 0===o?void 0:o.submitState)||void 0===i?void 0:i.hasDirtyFormData)||void 0===r?void 0:r.call(i))}waitForCurrentSubmission(){var e,t,o,i,r;const n=null===(r=null===(i=null===(o=null===(t=null===(e=this.entryModule)||void 0===e?void 0:e.compositionRoot)||void 0===t?void 0:t.services)||void 0===o?void 0:o.submitState)||void 0===i?void 0:i.waitForCurrentSubmission)||void 0===r?void 0:r.call(i);return Promise.resolve(n)}}
|
|
@@ -7,6 +7,7 @@ declare enum DocumentConnectorEventType {
|
|
|
7
7
|
CONTACT_DATA_SUBMIT = "CONTACT_DATA_SUBMIT",
|
|
8
8
|
WIDGET_CONTENT_CLICKED = "WIDGET_CONTENT_CLICKED",
|
|
9
9
|
THEME_UPDATE = "THEME_UPDATE",
|
|
10
|
-
WIDGET_CLOSE_TRY_TO_SUBMIT = "WIDGET_CLOSE_TRY_TO_SUBMIT"
|
|
10
|
+
WIDGET_CLOSE_TRY_TO_SUBMIT = "WIDGET_CLOSE_TRY_TO_SUBMIT",
|
|
11
|
+
LEAD_PROGRESS = "LEAD_PROGRESS"
|
|
11
12
|
}
|
|
12
13
|
export default DocumentConnectorEventType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var DocumentConnectorEventType;!function(E){E.CONTACT_ID_WAS_RECEIVED="CONTACT_ID_WAS_RECEIVED",E.CLOSE_WIDGET="CLOSE_WIDGET",E.SHOW_WIDGET="SHOW_WIDGET",E.CLOSE_ICON_CLICKED="CLOSE_ICON_CLICKED",E.BRANDING_ELEMENT_CLICKED="BRANDING_ELEMENT_CLICKED",E.CONTACT_DATA_SUBMIT="CONTACT_DATA_SUBMIT",E.WIDGET_CONTENT_CLICKED="WIDGET_CONTENT_CLICKED",E.THEME_UPDATE="THEME_UPDATE",E.WIDGET_CLOSE_TRY_TO_SUBMIT="WIDGET_CLOSE_TRY_TO_SUBMIT"}(DocumentConnectorEventType||(DocumentConnectorEventType={}));export default DocumentConnectorEventType;
|
|
1
|
+
var DocumentConnectorEventType;!function(E){E.CONTACT_ID_WAS_RECEIVED="CONTACT_ID_WAS_RECEIVED",E.CLOSE_WIDGET="CLOSE_WIDGET",E.SHOW_WIDGET="SHOW_WIDGET",E.CLOSE_ICON_CLICKED="CLOSE_ICON_CLICKED",E.BRANDING_ELEMENT_CLICKED="BRANDING_ELEMENT_CLICKED",E.CONTACT_DATA_SUBMIT="CONTACT_DATA_SUBMIT",E.WIDGET_CONTENT_CLICKED="WIDGET_CONTENT_CLICKED",E.THEME_UPDATE="THEME_UPDATE",E.WIDGET_CLOSE_TRY_TO_SUBMIT="WIDGET_CLOSE_TRY_TO_SUBMIT",E.LEAD_PROGRESS="LEAD_PROGRESS"}(DocumentConnectorEventType||(DocumentConnectorEventType={}));export default DocumentConnectorEventType;
|
|
@@ -9,7 +9,6 @@ export default class StaticDocumentConnector extends BaseDocumentConnector {
|
|
|
9
9
|
componentRegister: WcRegister;
|
|
10
10
|
componentResolver: WcResolver;
|
|
11
11
|
googleFontsLoader: GoogleFontsLoader | null;
|
|
12
|
-
closeSubmitPromise: Promise<boolean> | null;
|
|
13
12
|
customFontsLoader: CustomFontsLoader | null;
|
|
14
13
|
constructor(params: WidgetInitConfigI);
|
|
15
14
|
emit(eventName: string, value: any, params?: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import BaseDocumentConnector from"./BaseDocumentConnector";import DocumentConnectorEventType from"./DocumentConnectorEventType";import{getZIndexByLayoutType}from"./layouts/getZindex";import LayoutFactory from"./layouts/LayoutFactory";import StaticEntryModule from"@claspo/renderer/StaticEntryModule";import WcResolver from"@claspo/renderer/wc-renderer/WcResolver";import{RenderMode}from"@claspo/common/RenderMode";import{WcRegister}from"@claspo/renderer/wc-renderer/WcRegister";import GoogleFontsLoader from"./layouts/GoogleFontsLoader";import CustomFontsLoader from"./layouts/CustomFontsLoader";import ThemeCssVars from"@claspo/common/element/ThemeCssVars";
|
|
1
|
+
import BaseDocumentConnector from"./BaseDocumentConnector";import DocumentConnectorEventType from"./DocumentConnectorEventType";import{getZIndexByLayoutType}from"./layouts/getZindex";import LayoutFactory from"./layouts/LayoutFactory";import StaticEntryModule from"@claspo/renderer/StaticEntryModule";import WcResolver from"@claspo/renderer/wc-renderer/WcResolver";import{RenderMode}from"@claspo/common/RenderMode";import{WcRegister}from"@claspo/renderer/wc-renderer/WcRegister";import{FinishTrigger}from"@claspo/renderer/lead-capture/FinishCoordinator";import GoogleFontsLoader from"./layouts/GoogleFontsLoader";import CustomFontsLoader from"./layouts/CustomFontsLoader";import ThemeCssVars from"@claspo/common/element/ThemeCssVars";export default class StaticDocumentConnector extends BaseDocumentConnector{constructor(e){super(e),this.componentResolver=null,this.googleFontsLoader=null,this.customFontsLoader=null;const{documentModel:o,translations:t,trackingService:s,layoutType:n,bundledComponentClasses:r}=e;this.componentRegister=new WcRegister(r,e.productKeyPrefix),this.componentResolver=new WcResolver(RenderMode.STATIC,this.componentRegister,e.productKeyPrefix);const i=new StaticEntryModule(o,this.componentResolver,this.componentRegister,e,t,s,n);this.setEntryModule(i)}emit(e,o,t=null){e!==DocumentConnectorEventType.CLOSE_WIDGET?super.emit(e,o,t):this.handleCloseWidget(o)}async connect(e){this.googleFontsLoader=new GoogleFontsLoader({widgetId:this.params.widgetId,siteId:this.params.siteId}),this.customFontsLoader=new CustomFontsLoader;const o=e.getRootNode(),t=CustomFontsLoader.getUsedCustomFonts(this.params.documentModel),s=[this.customFontsLoader.load(t,o)];if(!this.params.disableGoogleFonts){const e=GoogleFontsLoader.getUsedGoogleFonts(this.params.documentModel);s.push(this.googleFontsLoader.load(e,o))}return await Promise.all(s),this._initializeRenderer(e,o)}disconnect(){var e,o;super.disconnect(),this.controllers[0]&&this.controllers[0].disconnect(()=>{this.entryModule&&this.entryModule.viewRouter&&this.entryModule.compositionRoot&&this.entryModule.destroy()}),this.controllers=[],null===(e=this.googleFontsLoader)||void 0===e||e.cleanup(),null===(o=this.customFontsLoader)||void 0===o||o.cleanup()}destroy(){this.disconnect()}on(e,o){return super.on(e,o)}async _initializeRenderer(e,o){var t,s,n,r;await this.componentResolver.loadComponentsIfNecessary(this.params.documentModel,this.params.staticResourcesUrl);const i=this.entryModule.init(o);i.style.display="flex";const{layoutFactoryClass:a=LayoutFactory,layoutType:d,documentModel:l}=this.params,c=Object.assign(Object.assign({},this.params),{zIndex:null!==(s=null===(t=null==l?void 0:l.shared)||void 0===t?void 0:t.zIndex)&&void 0!==s?s:getZIndexByLayoutType(d)}),m=a.create(Object.assign(Object.assign({},c),{layoutType:this.params.layoutType,widgetType:this.params.widgetType,viewIndex:0,renderMode:this.entryModule.renderMode}),this,this.entryModule.viewRouter,this.entryModule.compositionRoot.services.documentModel,this.entryModule.compositionRoot.services.resizeListener);return this.controllers.push(m),super.addPropsRequestEventListener(i),this.params.formVariantId?i.classList.add("cl-widget-"+this.params.formVariantId):i.classList.add("cl-widget"),this.entryModule.listenAction("*",(e,o)=>{this.emit(o,e)}),m.connect(i,e,this.entryModule),(null===(r=null===(n=l.shared)||void 0===n?void 0:n.theme)||void 0===r?void 0:r.schema)&&ThemeCssVars.override(l.shared.theme.schema,m.getConnectedElement()),m.getConnectedElement()}handleCloseWidget(e){this.trySubmitOnClose();try{super.emit(DocumentConnectorEventType.CLOSE_WIDGET,e)}finally{"function"==typeof e&&e()}}trySubmitOnClose(){var e,o,t;if(!(this.params.submitOnClose||{enabled:!1,skipValidation:!0}).enabled)return;const s=null===(o=null===(e=this.entryModule)||void 0===e?void 0:e.compositionRoot)||void 0===o?void 0:o.services;null===(t=null==s?void 0:s.finishCoordinator)||void 0===t||t.attemptCommit(FinishTrigger.CLOSE,{beforeExecute:e=>{var o,t;this.emit(DocumentConnectorEventType.WIDGET_CLOSE_TRY_TO_SUBMIT,{autoSubmitForm:e,actualForm:null===(t=null===(o=s.form)||void 0===o?void 0:o.getControlsMap)||void 0===t?void 0:t.call(o)})}})}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
class GlobalScrollBlocker{static block(){this.activeBlockersCount++;const l=document.documentElement;if(this.activeBlockersCount>1||l.scrollHeight<=l.clientHeight)return;const o=window.scrollY,t=window.scrollX,e=l.style;this.savedParams={scrollTopPosition:o,scrollLeftPosition:t,htmlElemTop:e.top||"",htmlElemLeft:e.left||"",htmlElemPosition:e.position||"",htmlElemWidth:e.width||"",htmlElemHeight:e.height||"",htmlElemOverflowY:e.overflowY||""},e.top=-o+"px",e.left=-t+"px",e.position="fixed",e.width="100%",e.height="auto",e.overflowY="scroll",l.classList.add(GlobalScrollBlocker.globalScrollBlockClass)}static restore(){if(0===this.activeBlockersCount)return;if(this.activeBlockersCount--,this.activeBlockersCount>0||!this.savedParams)return;const l=this.savedParams;this.savedParams=null;const o=document.documentElement,t=document.body,e=o.style,s=t.style,c=e.scrollBehavior||"",r=s.scrollBehavior||"";e.top=l.htmlElemTop,e.left=l.htmlElemLeft,e.position=l.htmlElemPosition,e.width=l.htmlElemWidth,e.height=l.htmlElemHeight,e.overflowY=l.htmlElemOverflowY,o.classList.remove(GlobalScrollBlocker.globalScrollBlockClass),e.scrollBehavior=s.scrollBehavior="auto",
|
|
1
|
+
class GlobalScrollBlocker{static block(){this.activeBlockersCount++;const l=document.documentElement;if(this.activeBlockersCount>1||l.scrollHeight<=l.clientHeight)return;const o=window.scrollY,t=window.scrollX,e=l.style;this.savedParams={scrollTopPosition:o,scrollLeftPosition:t,htmlElemTop:e.top||"",htmlElemLeft:e.left||"",htmlElemPosition:e.position||"",htmlElemWidth:e.width||"",htmlElemHeight:e.height||"",htmlElemOverflowY:e.overflowY||""},e.top=-o+"px",e.left=-t+"px",e.position="fixed",e.width="100%",e.height="auto",e.overflowY="scroll",l.classList.add(GlobalScrollBlocker.globalScrollBlockClass)}static restore(){if(0===this.activeBlockersCount)return;if(this.activeBlockersCount--,this.activeBlockersCount>0||!this.savedParams)return;const l=this.savedParams;this.savedParams=null;const o=document.documentElement,t=document.body,e=o.style,s=t.style,c=e.scrollBehavior||"",r=s.scrollBehavior||"";e.top=l.htmlElemTop,e.left=l.htmlElemLeft,e.position=l.htmlElemPosition,e.width=l.htmlElemWidth,e.height=l.htmlElemHeight,e.overflowY=l.htmlElemOverflowY,o.classList.remove(GlobalScrollBlocker.globalScrollBlockClass),e.scrollBehavior=s.scrollBehavior="auto",GlobalScrollBlocker.scrollWindowTo(l.scrollLeftPosition,l.scrollTopPosition),e.scrollBehavior=c,s.scrollBehavior=r}static scrollWindowTo(l,o){if("function"==typeof window.scroll)return void window.scroll(l,o);if("function"==typeof window.scrollTo)return void window.scrollTo(l,o);const t=document.documentElement;t.scrollTop=o,t.scrollLeft=l}}GlobalScrollBlocker.globalScrollBlockClass="cl-global-scroll-block",GlobalScrollBlocker.activeBlockersCount=0,GlobalScrollBlocker.savedParams=null;export default GlobalScrollBlocker;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claspo/document-connector",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.9.0-nonlinear",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"test": "jest --no-cache --coverage",
|
|
6
6
|
"build": "rm -rf out && tsc --project tsconfig.json && npm run minify",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"node": ">=18.16.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@claspo/common": "7.
|
|
18
|
-
"@claspo/renderer": "18.
|
|
17
|
+
"@claspo/common": "7.4.0-nonlinear3",
|
|
18
|
+
"@claspo/renderer": "18.8.0-nonlinear5"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@babel/core": "^7.28.5",
|