react-bricks 4.5.6 → 4.6.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.
@@ -0,0 +1 @@
1
+ import{_ as e,a as r,b as n,c as t,g as o,d as a,p as i,e as s,t as c}from"./react-bricks-ufYPAS2z.esm.js";var u={isAdmin:!1,bricks:{}};var l=new(function(){function l(){return l.instance?console.warn("Constructor - instance already created"):(l.instance=this,u.pid=Math.floor(1e3*Math.random())),l.instance}return l.prototype.register=function(e){u.config&&Object.keys(u.bricks).length>0||(u.config=function(e){var r=s({logo:"",contentClassName:"",defaultTheme:"",loginPath:"/admin",editorPath:"/admin/editor",mediaLibraryPath:"/admin/media",playgroundPath:"/admin/playground",appSettingsPath:"/admin/app-settings",previewPath:"/preview",isDarkColorMode:!1,useCssInJs:!1,clickToEditSide:c.ClickToEditSide.BottomRight,enableAutoSave:!0,disableSaveIfInvalidProps:!1,enablePreview:!0,blockIconsPosition:c.BlockIconsPosition.OutsideBlock,enableUnsplash:!0,enablePreviewImage:!0,enablePreviewIcon:!1,enableDefaultEmbedBrick:!0,allowAccentsInSlugs:!1,warningIfLowBattery:!1,rtlLanguages:["ar","az","dv","fa","ff","he","ks","ku","pa","ps","ug","ur","yi"]},e);return r}(e),u.bricks=l.instance.mapConfigToBricks(e))},l.prototype.setBlock=function(e){u.currentBlock=e},l.prototype.setPage=function(e){u.currentPage=e},l.prototype.setIsAdmin=function(e){u.isAdmin=e},l.prototype.getConfig=function(){if(!u.config)throw new Error("React Bricks RSC not registered [1]");return u.config},l.prototype.getBrick=function(e){if(!u.config)throw new Error("React Bricks RSC not registered [2]");return u.bricks[e.type]?u.bricks[e.type]:null},l.prototype.getBricks=function(){if(!u.config)throw new Error("React Bricks RSC not registered [3]");return u.bricks},l.prototype.getPage=function(){return u.currentPage},l.prototype.getPageValues=function(){if(!u.currentPage)return null;var r=u.currentPage;return r.content,e(r,["content"])},l.prototype.getBlock=function(){return u.currentBlock||null},l.prototype.getBlockValue=function(e){return u.currentBlock&&u.currentBlock.props[e]?u.currentBlock.props[e]:null},l.prototype.getPageType=function(e){var r,n;return e&&(null===(r=u.config)||void 0===r?void 0:r.pageTypes)&&(null===(n=u.config)||void 0===n?void 0:n.pageTypes.find((function(r){return r.name===e.type})))},l.prototype.isAdmin=function(){return u.isAdmin},l.prototype.isRegistered=function(){return!!u.config},l.prototype.isRtlLanguage=function(e){var r=e.language;if(!u.config)throw new Error("React Bricks RSC not registered [4]");return!!u.config.rtlLanguages&&u.config.rtlLanguages.indexOf(r)>-1},l.prototype.mapConfigToBricks=function(e){var c,u=e.bricks;if(u&&0!==u.length||(console.warn("No bricks provided. Using default paragraph."),u=[]),e.pageTypes||console.warn("No Page type schema provided. Using default page."),!Array.isArray(u))throw console.error('"bricks" should be an array of Bricks or an array of Themes'),new Error('"bricks" should be an array of Bricks or an array of Themes');if(!Array.isArray(e.pageTypes))throw console.error('"pageTypes" should be an array'),new Error('"pageTypes" should be an array');r(u)?(c=n([],t(u),!1),u=o(c)):(c=a(u),u=n([],t(u),!1));var l=function(){return null};return l.schema={name:"default-embed-brick",label:"Embed Page",category:"Embed",sideEditProps:[{name:"RB_PAGE_EMBED",label:"Embed page / entity",type:"RELATIONSHIP",relationshipOptions:{references:"",multiple:!1,embedValues:!1},helperText:"Choose a page, save to view it."}]},e.enableDefaultEmbedBrick&&(null==u||u.push(l),c=i(c,l)),null==u?void 0:u.reduce((function(e,r){var n;return s(s({},e),((n={})[r.schema.name]=r,n))}),{})},l}());Object.freeze(l);export{l as r};
@@ -0,0 +1 @@
1
+ "use client";import*as e from"react";import{useContext as n}from"react";import{t as o}from"./react-bricks-ufYPAS2z.esm.js";import{r as i}from"./react-bricks-D3cMjNMP.esm.js";var t=e.createContext({version:"",appId:"",apiKey:"",bricks:{},themes:[],pageTypes:[],logo:"",loginUI:{},contentClassName:"",defaultTheme:"",renderLocalLink:function(n){var o=n.href,i=n.children;return e.createElement("a",{href:o},i)},navigate:function(){},loginPath:"",editorPath:"",mediaLibraryPath:"",playgroundPath:"",appSettingsPath:"",previewPath:"",getAdminMenu:function(e){return e.isAdmin,[]},useCssInJs:!1,appRootElement:"",clickToEditSide:o.ClickToEditSide.BottomRight,responsiveBreakpoints:[],enableAutoSave:!0,disableSaveIfInvalidProps:!1,enablePreview:!0,browserSupport:{webP:!0,lazyLoading:!0},blockIconsPosition:o.BlockIconsPosition.OutsideBlock,enableUnsplash:!0,unsplashApiKey:"",enablePreviewImage:!0,enablePreviewIcon:!1,enableDefaultEmbedBrick:!0,permissions:{},allowAccentsInSlugs:!1,warningIfLowBattery:!0,rtlLanguages:[],isRtlLanguage:function(e){return e.language,!1}}),r=function(){var e,o;return(null===(e=r.prototype)||void 0===e?void 0:e.useAdmin)?null===(o=r.prototype)||void 0===o?void 0:o.useAdmin():n(t)},a=function(){var e,n;return(null===(e=a.prototype)||void 0===e?void 0:e.useAdmin)?null===(n=a.prototype)||void 0===n?void 0:n.useAdmin():{isAdmin:!1,previewMode:!1,currentPage:{pageId:""},showRichTextModal:function(){}}},s=function(){var e,n;if(null===(e=s.prototype)||void 0===e?void 0:e.useAdmin)return null===(n=s.prototype)||void 0===n?void 0:n.useAdmin();var o=i.getPageValues();if(!o)throw Error("pageValues not found");return[o,function(){}]},u=function(e){var n,o;if(null===(n=u.prototype)||void 0===n?void 0:n.useAdmin)return null===(o=u.prototype)||void 0===o?void 0:o.useAdmin(e);return[null,function(e){},!0]};export{t as R,s as a,r as b,u as c,a as u};
package/react-bricks.d.ts CHANGED
@@ -626,6 +626,7 @@ declare namespace types {
626
626
  categories?: ICategory[];
627
627
  slugPrefix?: ISlugPrefix;
628
628
  template?: Array<TemplateSlot>;
629
+ headlessView?: boolean;
629
630
  }
630
631
  /**
631
632
  * Structure returned by the cleanBlocks function
@@ -703,6 +704,7 @@ declare namespace types {
703
704
  permissions?: Permissions;
704
705
  allowAccentsInSlugs?: boolean;
705
706
  warningIfLowBattery?: boolean;
707
+ rtlLanguages?: Array<string>;
706
708
  }
707
709
  /**
708
710
  * The ReactBricks context
@@ -753,6 +755,10 @@ declare namespace types {
753
755
  permissions?: Permissions;
754
756
  allowAccentsInSlugs: boolean;
755
757
  warningIfLowBattery: boolean;
758
+ isRtlLanguage: ({ language }: {
759
+ language: string;
760
+ }) => boolean;
761
+ rtlLanguages: string[];
756
762
  }
757
763
  /**
758
764
  * The current page in Admin
@@ -1484,10 +1490,10 @@ declare const Login: React.FC;
1484
1490
 
1485
1491
  declare const SsoLogin: React.FC;
1486
1492
 
1487
- declare const SsoLoginSuccess: React__default.FC;
1488
-
1489
1493
  declare const SsoLoginFailure: React__default.FC;
1490
1494
 
1495
+ declare const SsoLoginSuccess: React__default.FC;
1496
+
1491
1497
  type EmailPasswordLoginUserCredentials = {
1492
1498
  email: string;
1493
1499
  password: string;