react-bricks 3.2.3 → 3.2.7
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/frontend/index.js +1 -1
- package/frontend/package.json +1 -1
- package/frontend/react-bricks-frontend.esm.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/react-bricks-261610f7.js +2 -0
- package/react-bricks-37290d94.esm.js +2 -0
- package/react-bricks.d.ts +84 -27
- package/react-bricks.esm.js +1 -1
- package/react-bricks-1c8cd0cd.js +0 -2
- package/react-bricks-830473c0.esm.js +0 -2
package/package.json
CHANGED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("react"),r=e(t),n=e(require("classnames")),o=require("react-query"),a=e(require("axios")),i=require("react-icons/fi"),l=function(e,t){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},l(e,t)};function s(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}function u(e,t,r,n){return new(r||(r=Promise))((function(o,a){function i(e){try{s(n.next(e))}catch(e){a(e)}}function l(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}s((n=n.apply(e,t||[])).next())}))}function c(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function p(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function d(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}exports.__assign=function(){return exports.__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},exports.__assign.apply(this,arguments)};var g,m,f,h,v,y,x,b,E,k,T,P=t.createContext({values:{},onChange:function(){},blockId:"",parentId:"",parentType:"",handleChange:function(e){return function(){}},handleAddItem:function(e){return function(){}}});T=exports.types||(exports.types={}),(k=T.SideEditPropType||(T.SideEditPropType={})).Text="TEXT",k.Textarea="TEXTAREA",k.Number="NUMBER",k.Date="DATE",k.Range="RANGE",k.Boolean="BOOLEAN",k.Select="SELECT",k.Image="IMAGE",k.Custom="CUSTOM",(E=T.OptionsDisplay||(T.OptionsDisplay={})).Select="SELECT",E.Radio="RADIO",E.Color="COLOR",(b=T.RichTextFeatures||(T.RichTextFeatures={})).Bold="BOLD",b.Italic="ITALIC",b.Code="CODE",b.Highlight="HIGHLIGHT",b.Link="LINK",b.UnorderedList="UL",b.OrderedList="OL",b.Heading1="H1",b.Heading2="H2",b.Heading3="H3",b.Heading4="H4",b.Heading5="H5",b.Heading6="H6",b.Quote="QUOTE",(x=T.SortDirection||(T.SortDirection={})).Up="UP",x.Down="DOWN",(y=T.PageStatus||(T.PageStatus={})).Draft="DRAFT",y.Published="PUBLISHED",(v=T.DeployEnvironment||(T.DeployEnvironment={})).Staging="STAGING",v.Production="PRODUCTION",(h=T.PlaygroundSelectedItemType||(T.PlaygroundSelectedItemType={})).Block="BLOCK",h.Page="PAGE",(f=T.DeviceType||(T.DeviceType={})).Desktop="DESKTOP",f.Tablet="TABLET",f.Phone="PHONE",(m=T.Tab||(T.Tab={})).Block="BLOCK",m.Item="ITEM",m.PageSettings="PAGE-SETTINGS",m.Document="DOCUMENT",m.Stories="STORIES",(g=T.ClickToEditSide||(T.ClickToEditSide={})).BottomRight="BOTTOM-RIGHT",g.BottomLeft="BOTTOM-LEFT",g.TopRight="TOP-RIGHT",g.TopLeft="TOP-LEFT";var _=t.createContext({focused:{blockId:"",itemId:"",repeaterPropName:""},setFocused:function(){},triggerTextRefreshBlockId:"",setTriggerTextRefreshBlockId:function(){},setAddAfterBlockId:function(){},pageValues:{id:"",type:"",name:"",slug:"",meta:{},authorId:"",author:{id:"",email:"",firstName:"",lastName:""},invalidBlocksTypes:[],status:exports.types.PageStatus.Draft,isLocked:!1,tags:[],createdAt:"",publishedAt:"",language:"",translations:[]},handleChangePageValue:function(){}}),C=function(e){return function(e){var t,r;if(!1===I(e))return!1;if("function"!=typeof(t=e.constructor))return!1;if(!1===I(r=t.prototype))return!1;if(!1===r.hasOwnProperty("isPrototypeOf"))return!1;return!0}(e)&&"string"==typeof e.text};function S(e){return C(e)?e.text:e.children.map(S).join("")}function I(e){return!0==(null!=(t=e)&&"object"==typeof t&&!1===Array.isArray(t))&&"[object Object]"===Object.prototype.toString.call(e);var t}var w,L={serialize:function(e){return e.map(S).join("\n")},deserialize:function(e){return e.split("\n").map((function(e){return{type:"paragraph",children:[{text:e}]}}))},isText:C},R=function(e,r,n){if(L.isText(e))return r.filter((function(e){return"Mark"===e.type})).reduce((function(t,r){return e[r.name]?r.renderLeaf({children:t}):t}),e.text);var o=r.filter((function(e){return"List"===e.type})).find((function(t){return e.type===t.name}));if(o){var a=B(e,r);return o.renderElement({children:a.map((function(e,r){return t.createElement(t.Fragment,{key:r},o.renderItemElement({children:e}))})),element:{url:e.url}})}var i=B(e,r,n),l=r.filter((function(e){return"Block"===e.type})).find((function(t){return e.type===t.name}));return l?l.renderElement({children:i,element:{url:e.url}}):n?n({children:i,element:{type:"",children:[]},attributes:{ref:null}}):i},B=function(e,r,n){var o;return null===(o=e.children)||void 0===o?void 0:o.map((function(e,o){return t.createElement(t.Fragment,{key:o},R(e,r,n))}))},A=function(e){var r,n,o=e.renderBlock,a=e.placeholder,i=e.renderPlaceholder,l=e.propName,s=e.multiline,u=void 0!==s&&s,c=t.useContext(P).values[l];if(null===(r=A.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=A.prototype)||void 0===n?void 0:n.renderAdmin({renderBlock:o,placeholder:a,renderPlaceholder:i,propName:l,multiline:u});var p=c;return c?("string"==typeof c&&(p=L.deserialize(c)),t.createElement(t.Fragment,null,p.map((function(e,r){return t.createElement(t.Fragment,{key:r},R(e,[],o))})))):null},N=function(e){var r,n,o=e.renderBlock,a=e.placeholder,i=e.renderPlaceholder,l=e.propName,s=e.plugins,u=void 0===s?[]:s,c=e.multiline,p=void 0===c||c,d=t.useContext(P).values[l];if(null===(r=N.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=N.prototype)||void 0===n?void 0:n.renderAdmin({renderBlock:o,placeholder:a,renderPlaceholder:i,propName:l,plugins:u,multiline:p});var g=d;return d?("string"==typeof d&&(g=L.deserialize(d)),t.createElement(t.Fragment,null,g.map((function(e,r){return t.createElement(t.Fragment,{key:r},R(e,u,o))})))):null},D=t.createContext({appId:"",apiKey:"",bricks:{},pageTypes:[],logo:"",contentClassName:"",renderLocalLink:function(e){var r=e.href,n=e.children;return t.createElement("a",{href:r},n)},navigate:function(){},loginPath:"",editorPath:"",playgroundPath:"",appSettingsPath:"",useCssInJs:!1,appRootElement:"",clickToEditSide:exports.types.ClickToEditSide.BottomRight,responsiveBreakpoints:[],enableAutoSave:!0,disableSaveIfInvalidProps:!1}),O=function(e){var t,r;return(null===(t=O.prototype)||void 0===t?void 0:t.adminConstructor)?null===(r=O.prototype)||void 0===r?void 0:r.adminConstructor(e):{type:"Mark",name:e.name,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderLeaf:e.render,toggle:function(e){}}},F=O({name:"bold",hotKey:"mod+b",render:function(e){return t.createElement("strong",null,e.children)}}),H=O({name:"italic",hotKey:"mod+i",render:function(e){return t.createElement("em",null,e.children)}}),z=O({name:"code",hotKey:"mod+`",render:function(e){return t.createElement("code",{style:{margin:"0 1px",display:"inline-block",padding:"3px 6px",fontSize:"0.875rem",lineHeight:1.25,maxWidth:"100%",fontFamily:'Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',borderRadius:"3px",backgroundColor:"#F5F7F9"}},e.children)}}),j=O({name:"highlight",hotKey:"mod+h",render:function(e){return t.createElement("mark",{style:{paddingLeft:4,paddingRight:4,borderRadius:2,backgroundColor:"#ff0",color:"#0f0f05"}},e.children)}}),K=function(e){var r,n,o=e.href,a=e.children,i=e.target,l=e.className,u=s(e,["href","children","target","className"]),c=t.useContext(D).renderLocalLink;if(null===(r=K.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=K.prototype)||void 0===n?void 0:n.renderAdmin(exports.__assign({href:o,children:a,target:i,className:l},u));var p={href:o};return/^\/(?!\/)/.test(o)?c?c(exports.__assign({href:o,target:i,children:a,className:l},u)):(c||console.warn("Local path found in Link, but no renderLocalLink function was provided. Rendering <a> as fallback"),t.createElement("a",exports.__assign({},p,{target:i,className:l},u),a)):t.createElement("a",exports.__assign({},p,{target:i,className:l},u),a)},M={type:"Block",name:"link",label:"Link",isInline:!0,renderElement:function(e){var r=e.attributes,n=e.children,o=e.element;return t.createElement(K,exports.__assign({},r,{href:o.url}),n)},toggle:function(e){}},U=function(e){var t,r;return(null===(t=U.prototype)||void 0===t?void 0:t.adminConstructor)?null===(r=U.prototype)||void 0===r?void 0:r.adminConstructor(e):{type:e.itemName?"List":"Block",name:e.name,isInline:e.isInline,itemName:e.itemName,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderElement:e.render,renderItemElement:e.renderItem,toggle:function(e,t){}}},G=U({name:"h1",hotKey:"mod+shift+1",render:function(e){return t.createElement("h1",null,e.children)}}),q=U({name:"h2",hotKey:"mod+shift+2",render:function(e){return t.createElement("h2",null,e.children)}}),Q=U({name:"h3",hotKey:"mod+shift+3",render:function(e){return t.createElement("h3",null,e.children)}}),V=U({name:"h4",hotKey:"mod+shift+4",render:function(e){return t.createElement("h4",null,e.children)}}),W=U({name:"h5",hotKey:"mod+shift+5",render:function(e){return t.createElement("h5",null,e.children)}}),J=U({name:"h6",hotKey:"mod+shift+6",render:function(e){return t.createElement("h6",null,e.children)}}),X=U({name:"quote",render:function(e){return t.createElement("blockquote",null,e.children)}}),Y=U({name:"ol",label:"Number list",itemName:"li",render:function(e){return t.createElement("ol",{className:"list-decimal"},e.children)},renderItem:function(e){return t.createElement("li",null,e.children)}}),$=U({name:"ul",label:"Bullet list",itemName:"li",render:function(e){return t.createElement("ul",{className:"list-disc"},e.children)},renderItem:function(e){return t.createElement("li",null,e.children)}}),Z=Object.freeze({__proto__:null,bold:F,italic:H,code:z,highlight:j,link:M,heading1:G,heading2:q,heading3:Q,heading4:V,heading5:W,heading6:J,quote:X,orderedList:Y,unorderedList:$}),ee=((w={})[exports.types.RichTextFeatures.Bold]={newPlugin:F,renderLeaf:"renderBold"},w[exports.types.RichTextFeatures.Italic]={newPlugin:H,renderLeaf:"renderBold"},w[exports.types.RichTextFeatures.Highlight]={newPlugin:j,renderLeaf:"renderHighlight"},w[exports.types.RichTextFeatures.Code]={newPlugin:z,renderLeaf:"renderCode"},w[exports.types.RichTextFeatures.Link]={newPlugin:M,renderLink:"renderLink"},w[exports.types.RichTextFeatures.UnorderedList]={newPlugin:$,renderElement:"renderUL",renderItemElement:"renderLI"},w[exports.types.RichTextFeatures.OrderedList]={newPlugin:Y,renderElement:"renderOL",renderItemElement:"renderLI"},w[exports.types.RichTextFeatures.Heading1]={newPlugin:G,renderElement:"renderH1"},w[exports.types.RichTextFeatures.Heading2]={newPlugin:q,renderElement:"renderH2"},w[exports.types.RichTextFeatures.Heading3]={newPlugin:Q,renderElement:"renderH3"},w[exports.types.RichTextFeatures.Heading4]={newPlugin:V,renderElement:"renderH4"},w[exports.types.RichTextFeatures.Heading5]={newPlugin:W,renderElement:"renderH5"},w[exports.types.RichTextFeatures.Heading6]={newPlugin:J,renderElement:"renderH6"},w[exports.types.RichTextFeatures.Quote]={newPlugin:X,renderElement:"renderQuote"},w),te=function(e){var t,n;if(null===(t=te.prototype)||void 0===t?void 0:t.renderAdmin)return null===(n=te.prototype)||void 0===n?void 0:n.renderAdmin(e);var o=[];return e.allowedFeatures&&e.allowedFeatures.length>0&&(o=e.allowedFeatures.map((function(t){var r=ee[t],n=r.newPlugin,o=r.renderLeaf,a=r.renderElement,i=r.renderItemElement,l=r.renderLink,s={},u=e[o],c=e[a],p=e[i],d=e[l];return o&&u&&(s.renderLeaf=u),a&&c&&(s.renderElement=c),i&&p&&(s.renderItemElement=p),l&&d&&(s.renderElement=function(e){var t=e.attributes,r=e.children,n=e.element;return d({attributes:t,children:r,element:n,href:n.url})}),exports.__assign(exports.__assign({},n),s)}))),r.createElement(N,{renderBlock:e.renderBlock,placeholder:e.placeholder,propName:e.propName,plugins:o,multiline:e.multiline})},re=require("react-progressive-graceful-image").default,ne=function(e,t){if(!t)return e;var r=e.lastIndexOf(".");return e.substring(0,r)+"/"+t+e.substring(r)},oe=function(e){e.propName;var r=e.source,n=e.alt,o=e.noLazyLoad,a=void 0!==o&&o,i=e.containerClassName,l=e.containerStyle,u=void 0===l?{}:l,c=e.imageClassName,d=e.imageStyle,g=void 0===d?{}:d,m=s(e,["propName","source","alt","noLazyLoad","containerClassName","containerStyle","imageClassName","imageStyle"]),f=(null==r?void 0:r.alt)||n;if(!r)return null;var h,v,y=ne(r.src,r.seoName),x=ne(r.placeholderSrc||"",r.seoName),b=(h=r.srcSet,v=r.seoName,h?v?h.split(",").map((function(e){var t=p(e.trim().split(" "),2),r=t[0],n=t[1];return r&&n?ne(r,v)+" "+n:ne(e,v)})).join(", "):h:"");return a?t.createElement("div",{className:i,style:u},t.createElement("img",exports.__assign({src:y,srcSet:b,alt:f,className:c,style:u},m))):t.createElement("div",{className:i,style:u},t.createElement(re,{src:y,srcSetData:{srcSet:b},placeholder:""},(function(e,r,n){return r?t.createElement("img",{src:x,alt:f,className:c,style:exports.__assign({filter:"blur(8px)"},g)}):t.createElement("img",exports.__assign({src:e,srcSet:n.srcSet,alt:f,className:c,style:g},m))})))},ae=function(e){var r,n,o=t.useContext(P).values[e.propName];if(null===(r=ae.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=ae.prototype)||void 0===n?void 0:n.renderAdmin(e);e.maxWidth,e.aspectRatio;var a=s(e,["maxWidth","aspectRatio"]);return t.createElement(oe,exports.__assign({},a,{source:o}))},ie=function(e){var r,n=e.allowedExtensions,o=void 0===n?[]:n,a=e.propName,i=e.renderBlock,l=t.useContext(P).values[a];return(null===(r=ie.prototype)||void 0===r?void 0:r.renderAdmin)?ie.prototype.renderAdmin({propName:a,renderBlock:i,allowedExtensions:o}):l?i(l):null},le=function(e){var r,n,o=e.propName,a=e.itemProps,i=void 0===a?{}:a,l=e.renderWrapper,s=e.renderItemWrapper,u=t.useContext(D).bricks,c=t.useContext(P),p=c.values,d=c.parentId,g=c.parentType,m=c.handleChange,f=c.handleAddItem,h=p[o];if(t.useEffect((function(){var e,t,r=null===(t=null===(e=u[g].schema)||void 0===e?void 0:e.repeaterItems)||void 0===t?void 0:t.find((function(e){return e.name===o}));r&&r.min&&(!h||h.length<r.min)&&f&&f(d,o,r.itemType)()}),[d,o,h]),null===(r=le.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=le.prototype)||void 0===n?void 0:n.renderAdmin({propName:o,itemProps:i,renderWrapper:l,renderItemWrapper:s});if(!h||0===h.length)return null;var v=t.createElement(t.Fragment,null,h.map((function(e,r){var n=u[e.type];if(n){var a=n.schema.sideEditProps?n.schema.sideEditProps.reduce((function(t,r){var n,o;return r.groupName?o=r.props.map((function(t){var r;return(r={})[t.name]=e.props[t.name],r})).reduce((function(e,t){return exports.__assign(exports.__assign({},e),t)}),{}):((n={})[r.name]=e.props[r.name],o=n),exports.__assign(exports.__assign({},t),o)}),{}):{},l=exports.__assign(exports.__assign(exports.__assign({},a),i),{key:e.id,index:r,onClick:function(e){},onFocus:function(e){},onChange:function(){}}),c=t.createElement(P.Provider,{key:e.id,value:{onChange:m(e.id,d,o),values:e.props,blockId:e.id,parentId:d,parentType:g,handleChange:m}},t.createElement(n,exports.__assign({},l)));return s?s(c,r,h.length):c}})));return l?l(v):v},se=function(){var e,t;return(null===(e=se.prototype)||void 0===e?void 0:e.useAdmin)?null===(t=se.prototype)||void 0===t?void 0:t.useAdmin():{isAdmin:!1,previewMode:!1,currentPage:{pageId:""}}},ue=function(e){var r,n,o=t.useContext(P),a=o.values,i=o.onChange;if(null===(r=ue.prototype)||void 0===r?void 0:r.useAdmin)return null===(n=ue.prototype)||void 0===n?void 0:n.useAdmin(e);return[a[e],function(t){return i(e,t)},!0]},ce=function(){return t.createElement("div",{className:n("max-w-xl mx-auto py-6")})};ce.schema={name:"paragraph",label:"Paragraph",getDefaultProps:function(){return{text:"Lorem ipsum dolor sit amet"}}};var pe={paragraph:ce},de=[{type:exports.types.DeviceType.Phone,width:375,label:"Phone (375px)"},{type:exports.types.DeviceType.Tablet,width:768,label:"Tablet (768px)"},{type:exports.types.DeviceType.Desktop,width:"100%",label:"Desktop (100%)"}],ge=new o.QueryClient,me=[{name:"page",pluralName:"pages",defaultLocked:!1,defaultStatus:exports.types.PageStatus.Draft,defaultLanguage:"en",getDefaultContent:function(){return[]}}],fe=t.createContext({pageValues:{id:"",type:"",name:"",slug:"",meta:{},authorId:"",author:{id:"",email:"",firstName:"",lastName:""},invalidBlocksTypes:[],status:exports.types.PageStatus.Draft,isLocked:!1,tags:[],createdAt:"",publishedAt:"",language:"",translations:[]}}),he=function(){var e=t.useContext(_),r=e.pageValues,n=e.handleChangePageValue,o=t.useContext(fe).pageValues;return[r.id?r:o,n]},ve=function(e){var r=e.bricks,n=e.block;return t.createElement(t.Fragment,null,function(e){var n=r[e.type],o=p(he(),1)[0];if(n){var a=e.props;return n.schema.mapExternalDataToProps&&"function"==typeof n.schema.mapExternalDataToProps&&o.externalData&&"object"==typeof o.externalData&&(a=n.schema.mapExternalDataToProps(o.externalData,e.props)),t.createElement(P.Provider,{value:{values:a,onChange:function(){},blockId:e.id,parentId:e.id,parentType:e.type,handleChange:function(e){return function(){}},handleAddItem:function(e){return function(){}}}},t.createElement(n,exports.__assign({},a)))}}(n))},ye=function(e){var r=e.bricks,n=e.content;return t.createElement("div",null,n.map((function(e){return t.createElement(ve,{key:e.id,bricks:r,block:e})})))},xe="https://api.reactbricks.com/v2",be=function(e){var n=e.pageId,o=e.language,a=t.useContext(D),l=a.navigate,s=a.editorPath,u=a.clickToEditSide;if("undefined"==typeof localStorage)return null;var c,p=localStorage.getItem("rb_t");if(p&&p.length>10&&p.startsWith("ey")){var d={};return u===exports.types.ClickToEditSide.BottomRight&&(d.bottom=50,d.right=0,d.borderTopLeftRadius=999,d.borderBottomLeftRadius=999,d.transform="translate(8px,0)"),u===exports.types.ClickToEditSide.BottomLeft&&(d.bottom=50,d.left=0,d.borderTopRightRadius=999,d.borderBottomRightRadius=999,d.transform="translate(-8px,0)"),u===exports.types.ClickToEditSide.TopRight&&(d.top=50,d.right=0,d.borderTopLeftRadius=999,d.borderBottomLeftRadius=999,d.transform="translate(8px,0)"),u===exports.types.ClickToEditSide.TopLeft&&(d.top=50,d.left=0,d.borderTopRightRadius=999,d.borderBottomRightRadius=999,d.transform="translate(-8px,0)"),r.createElement(r.Fragment,null,r.createElement("style",null,"\n.rb-click-to-edit {\n position: fixed;\n width: 61px;\n height: 38px;\n background-color: #f65a8e;\n display: flex;\n justify-content: center;\n align-items: center;\n color: #fff;\n font-size: 20px;\n cursor: pointer;\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);\n transition: all 150ms ease;\n border: 2px solid #fff;\n}\n.rb-click-to-edit-left:hover {\n transform: translate(-2px,0)!important;\n}\n.rb-click-to-edit-right:hover {\n transform: translate(2px,0)!important;\n}\n "),r.createElement("div",{className:"rb-click-to-edit "+(c=u,c===exports.types.ClickToEditSide.TopLeft||c===exports.types.ClickToEditSide.BottomLeft?"rb-click-to-edit-left":"rb-click-to-edit-right"),style:d,onClick:function(){return l(s+"?p="+encodeURIComponent(n)+"&l="+o)}},r.createElement(i.FiEdit,null)))}return null},Ee=function(e){if("undefined"==typeof window)return null;e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(window.location.search);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))},ke=function(e,t,r){return!(r&&r.find((function(t){return t===e}))||t&&!t.find((function(t){return t===e})))},Te={id:"",type:"",slug:"",name:"",meta:{},author:{id:"",firstName:"",lastName:"",email:""},status:exports.types.PageStatus.Draft,isLocked:!1,content:[],tags:[],createdAt:"",language:"en",translations:[]},Pe=function(e,t,r,n){return t.reduce((function(t,o){var a=e[o.type];if(!a||!ke(o.type,r,n))return exports.__assign(exports.__assign({},t),{invalidBlocksTypes:d(d([],p(t.invalidBlocksTypes),!1),[o.type],!1)});var i=exports.__assign(exports.__assign({},o),{props:exports.__assign({},o.props)});return Object.keys(i.props).forEach((function(t){var r,n,o,l,s,u,c;i.props[t]&&(null===(n=null===(r=i.props[t])||void 0===r?void 0:r.document)||void 0===n?void 0:n.data)&&(null===(l=null===(o=i.props[t])||void 0===o?void 0:o.document)||void 0===l?void 0:l.nodes)&&"document"===(null===(u=null===(s=i.props[t])||void 0===s?void 0:s.document)||void 0===u?void 0:u.object)||(null===(c=a.schema.repeaterItems)||void 0===c?void 0:c.find((function(e){return e.name===t})))&&(i.props[t]=Pe(e,i.props[t]).blocks)})),exports.__assign(exports.__assign({},t),{blocks:d(d([],p(t.blocks),!1),[i],!1)})}),{blocks:[],invalidBlocksTypes:[]})},_e=function(e){return e.reduce((function(e,t){var r=[];for(var n in t.props)Array.isArray(t.props[n])&&t.props[n].length>0&&t.props[n][0].props?r.push.apply(r,d([],p(_e(t.props[n])),!1)):r.push(L.serialize(t.props[n]));return d(d([],p(e),!1),p(r),!1)}),[])};exports.API_URI=xe,exports.AUTH_TOKEN_LS_KEY="rb_t",exports.BlockContext=P,exports.ContentEditorContext=_,exports.EMPTY_PAGE=Te,exports.File=ie,exports.Image=ae,exports.Link=K,exports.PageViewer=function(e){var r=e.page;if(!r)return null;var n=t.useContext(D).bricks,o=(r.content,s(r,["content"])),a=exports.__assign({},o);return t.createElement("div",null,r&&r.content&&r.content.length>0&&t.createElement(fe.Provider,{value:{pageValues:a}},t.createElement(ye,{bricks:n,content:r.content}),t.createElement(be,{pageId:r.id,language:r.language})))},exports.Plain=L,exports.ReactBricks=function(e){var r=e.appId,n=e.apiKey,a=e.bricks,i=e.pageTypes,l=e.customFields,s=e.logo,u=void 0===s?"":s,c=e.contentClassName,p=void 0===c?"":c,d=e.renderLocalLink,g=e.navigate,m=e.loginPath,f=void 0===m?"/admin":m,h=e.editorPath,v=void 0===h?"/admin/editor":h,y=e.playgroundPath,x=void 0===y?"/admin/playground":y,b=e.appSettingsPath,E=void 0===b?"/admin/app-settings":b,k=e.isDarkColorMode,T=void 0!==k&&k,P=e.toggleColorMode,_=e.useCssInJs,C=void 0!==_&&_,S=e.appRootElement,I=e.clickToEditSide,w=void 0===I?exports.types.ClickToEditSide.BottomRight:I,L=e.responsiveBreakpoints,R=e.enableAutoSave,B=void 0===R||R,A=e.disableSaveIfInvalidProps,N=void 0!==A&&A,O=e.children,F=!1;if(a&&0!==a.length||console.warn("No bricks provided. Using default paragraph."),i||console.warn("No Page type schema provided. Using default page."),Array.isArray(a)||(console.error('"bricks" should be an array of Bricks'),F=!0),null==i||i.forEach((function(e){e.getDefaultContent&&e.getDefaultContent().length>0&&"string"!=typeof e.getDefaultContent()[0]&&console.error("A page type getDefaultContent() must return an array of bricks' names: please check the "+e.name+" page type.")})),a&&a.forEach((function(e){e.schema?(e.schema.render&&console.warn('The "render" method is depreacted on React Bricks v2 bricks. Please check the '+name+" brick."),e.schema.superType&&console.warn('The "superType" property is depreacted on React Bricks v2 bricks. Please check the '+name+" brick."),e.schema.textEditProps&&console.warn('The "textEditProps" property is depreacted on React Bricks v2 bricks. Please check the '+name+" brick.")):(console.error('Each brick component must have a "schema" property. Please check the '+name+" brick."),F=!0)})),F)return t.createElement("div",{style:{padding:"8px 16px",backgroundColor:"#fff5f5",border:"1px solid #fed7d7",borderRadius:4,color:"#c53030",margin:"50px auto",width:300}},"At least a blocking error found in schema. Check the console.");var H=null==a?void 0:a.reduce((function(e,t){var r;return exports.__assign(exports.__assign({},e),((r={})[t.schema.name]=t,r))}),{}),z=L&&L.length?L:de;return t.createElement(D.Provider,{value:{appId:r,apiKey:n,bricks:H||pe,pageTypes:i||me,customFields:l,logo:u,contentClassName:p,renderLocalLink:d,navigate:g,loginPath:f,editorPath:v,playgroundPath:x,appSettingsPath:E,isDarkColorMode:T,toggleColorMode:P,useCssInJs:C,appRootElement:S,clickToEditSide:w,responsiveBreakpoints:z,enableAutoSave:!!B,disableSaveIfInvalidProps:!!N}},t.createElement(o.QueryClientProvider,{client:ge},O))},exports.ReactBricksContext=D,exports.Repeater=le,exports.RichText=te,exports.RichTextExt=N,exports.Text=A,exports.__awaiter=u,exports.__extends=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},exports.__generator=c,exports.__read=p,exports.__rest=s,exports.__spreadArray=d,exports.__values=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},exports.blockAllowed=ke,exports.blockPluginConstructor=U,exports.cleanBlocks=Pe,exports.cleanPage=function(e,t,r){if(!e||!e.type||!e.content)return Te;var n=t.find((function(t){return t.name===e.type}));if(!n)return Te;var o=Pe(r,e.content,n.allowedBlockTypes,n.excludedBlockTypes);return exports.__assign(exports.__assign({},e),{content:o.blocks,invalidBlocksTypes:o.invalidBlocksTypes})},exports.fetchPage=function(e,t,r,n){return u(void 0,void 0,Promise,(function(){var o,i,l,s;return c(this,(function(u){switch(u.label){case 0:return o=r?"/translations/"+r:"",[4,a.get(xe+"/app/pages/"+e+o,{headers:{Authorization:"Bearer "+t}})];case 1:return i=u.sent().data,l=null,(null==(s=null==n?void 0:n.find((function(e){return e.name===i.type})))?void 0:s.getExternalData)&&"function"==typeof s.getExternalData?[4,s.getExternalData(i)]:[3,3];case 2:(l=u.sent())&&"object"==typeof l&&(i.externalData=l),u.label=3;case 3:return[2,i]}}))}))},exports.fetchPages=function(e,t){var r=void 0===t?{}:t,n=r.type,o=void 0===n?"":n,i=r.types,l=void 0===i?[]:i,s=r.tag,p=void 0===s?"":s,d=r.language,g=void 0===d?"":d,m=r.page,f=void 0===m?1:m,h=r.pageSize,v=void 0===h?100:h,y=r.sort,x=void 0===y?"":y,b=r.usePagination,E=void 0!==b&&b;return u(void 0,void 0,void 0,(function(){var t,r,n,i,s;return c(this,(function(u){switch(u.label){case 0:return v<=0&&(v=100),t="type="+o+"&types="+(null==l?void 0:l.join(","))+"&tag="+p+"&language="+g+"&page="+f+"&pageSize="+v+"&sort="+x,[4,a.get(xe+"/app/pages?"+t,{headers:{Authorization:"Bearer "+e}})];case 1:return r=u.sent(),n=r.data,i=r.headers,E?(s=i["x-total-count"]?parseInt(i["x-total-count"],10):0,[2,{items:n,pagination:{page:f,pageSize:v,totalItems:s,totalPages:Math.ceil(s/v)}}]):[2,n]}}))}))},exports.fetchTags=function(e,t,r){return void 0===t&&(t=1),void 0===r&&(r=100),u(void 0,void 0,Promise,(function(){var n,o,i,l;return c(this,(function(s){switch(s.label){case 0:return[4,a.get(xe+"/app/tags?pageSize="+r+"&page="+t,{headers:{Authorization:"Bearer "+e}})];case 1:return n=s.sent(),o=n.data,i=n.headers,l=i["x-total-count"]?parseInt(i["x-total-count"],10):0,[2,{items:o,pagination:{page:t,pageSize:r,totalItems:l,totalPages:Math.ceil(l/r)}}]}}))}))},exports.getPagePlainText=_e,exports.getUrlParameter=Ee,exports.markPluginConstructor=O,exports.plugins=Z,exports.queryClient=ge,exports.useAdminContext=se,exports.usePage=function(e,r){var n=t.useContext(D).pageTypes,i=localStorage.getItem("rb_t"),l=Ee("t");return o.useQuery(["page",{pageId:e,language:r}],(function(){return u(void 0,void 0,Promise,(function(){var t,o,s;return c(this,(function(u){switch(u.label){case 0:return[4,a.get(r?xe+"/admin/pages/"+e+"/translations/"+r:xe+"/admin/pages/"+e,{headers:{Authorization:"Bearer "+(i||l)}})];case 1:return t=u.sent().data,o=null,(null==(s=null==n?void 0:n.find((function(e){return e.name===t.type})))?void 0:s.getExternalData)&&"function"==typeof s.getExternalData?[4,s.getExternalData(t)]:[3,3];case 2:(o=u.sent())&&"object"==typeof o&&(t.externalData=o),u.label=3;case 3:return[2,t]}}))}))}),{enabled:!(!e||!i&&!l),refetchOnWindowFocus:!1})},exports.usePage$1=function(e,r){var n=t.useContext(D),i=n.apiKey,l=n.pageTypes;return o.useQuery(["pagePublic",{slug:e,language:r}],(function(){return u(void 0,void 0,Promise,(function(){var t,n,o;return c(this,(function(s){switch(s.label){case 0:return[4,a.get(r?xe+"/app/pages/"+e+"/translations/"+r:xe+"/app/pages/"+e,{headers:{Authorization:"Bearer "+i}})];case 1:return t=s.sent().data,n=null,(null==(o=null==l?void 0:l.find((function(e){return e.name===t.type})))?void 0:o.getExternalData)&&"function"==typeof o.getExternalData?[4,o.getExternalData(t)]:[3,3];case 2:(n=s.sent())&&"object"==typeof n&&(t.externalData=n),s.label=3;case 3:return[2,t]}}))}))}),{enabled:!!e})},exports.usePageValues=he,exports.usePages=function(e){var t=void 0===e?{}:e,r=t.type,n=void 0===r?"":r,i=t.types,l=void 0===i?[]:i,s=t.tag,p=void 0===s?"":s,d=t.language,g=void 0===d?"":d,m=t.page,f=void 0===m?1:m,h=t.pageSize,v=void 0===h?500:h,y=t.sort,x=void 0===y?"":y,b=t.usePagination,E=void 0!==b&&b;v<=0&&(v=500);var k=localStorage.getItem("rb_t"),T=Ee("t"),P="type="+n+"&types="+(null==l?void 0:l.join(","))+"&tag="+p+"&language="+g+"&page="+f+"&pageSize="+v+"&sort="+x;return o.useQuery(["pages",{pageType:n,pageTypes:l,tag:p,language:g,page:f,pageSize:v,sort:x}],(function(){return u(void 0,void 0,void 0,(function(){var e,t,r,n;return c(this,(function(o){switch(o.label){case 0:return[4,a.get(xe+"/admin/pages?"+P)];case 1:return e=o.sent(),t=e.data,r=e.headers,E?(n=r["x-total-count"]?parseInt(r["x-total-count"],10):0,[2,{items:t,pagination:{page:f,pageSize:v,totalItems:n,totalPages:Math.ceil(n/v)}}]):[2,t]}}))}))}),{enabled:!!k||!!T})},exports.usePagesPublic=function(e){var r=void 0===e?{}:e,n=r.type,i=void 0===n?"":n,l=r.types,s=void 0===l?[]:l,p=r.tag,d=void 0===p?"":p,g=r.language,m=void 0===g?"":g,f=r.page,h=void 0===f?1:f,v=r.pageSize,y=void 0===v?100:v,x=r.sort,b=void 0===x?"":x,E=r.usePagination,k=void 0!==E&&E,T=t.useContext(D).apiKey;y<=0&&(y=100);var P="type="+i+"&types="+(null==s?void 0:s.join(","))+"&tag="+d+"&language="+m+"&page="+h+"&pageSize="+y+"&sort="+b;return o.useQuery(["pagesPublic",{pageType:i,pageTypes:s,tag:d,page:h,pageSize:y,sort:b}],(function(){return u(void 0,void 0,void 0,(function(){var e,t,r,n;return c(this,(function(o){switch(o.label){case 0:return[4,a.get(xe+"/app/pages?"+P,{headers:{Authorization:"Bearer "+T}})];case 1:return e=o.sent(),t=e.data,r=e.headers,k?(n=r["x-total-count"]?parseInt(r["x-total-count"],10):0,[2,{items:t,pagination:{page:h,pageSize:y,totalItems:n,totalPages:Math.ceil(n/y)}}]):[2,t]}}))}))}))},exports.useReactBricksContext=function(){return t.useContext(D)},exports.useTagsPublic=function(e,r){void 0===e&&(e=1),void 0===r&&(r=100);var n=t.useContext(D).apiKey;return o.useQuery(["tagsPublic"],(function(){return u(void 0,void 0,void 0,(function(){var t,o,i,l;return c(this,(function(s){switch(s.label){case 0:return[4,a.get(xe+"/app/tags?pageSize="+r+"&page="+e,{headers:{Authorization:"Bearer "+n}})];case 1:return t=s.sent(),o=t.data,i=t.headers,l=i["x-total-count"]?parseInt(i["x-total-count"],10):0,[2,{items:o,pagination:{page:e,pageSize:r,totalItems:l,totalPages:Math.ceil(l/r)}}]}}))}))}),{staleTime:3e5})},exports.useVisualEdit=ue;
|
|
2
|
+
//# sourceMappingURL=react-bricks-261610f7.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e,{createContext as t,createElement as n,Fragment as r,useContext as a,useEffect as o}from"react";import i from"classnames";import{QueryClient as l,QueryClientProvider as u,useQuery as d}from"react-query";import s from"axios";import{FiEdit as c}from"react-icons/fi";var p=function(e,t){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},p(e,t)};function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}p(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var g=function(){return g=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},g.apply(this,arguments)};function m(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n}function h(e,t,n,r){return new(n||(n=Promise))((function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function l(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,l)}u((r=r.apply(e,t||[])).next())}))}function v(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(a=2&o[0]?r.return:o[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}}function y(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function b(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,o=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return i}function k(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}var T,x=t({values:{},onChange:function(){},blockId:"",parentId:"",parentType:"",handleChange:function(e){return function(){}},handleAddItem:function(e){return function(){}}});!function(e){!function(e){e.Text="TEXT",e.Textarea="TEXTAREA",e.Number="NUMBER",e.Date="DATE",e.Range="RANGE",e.Boolean="BOOLEAN",e.Select="SELECT",e.Image="IMAGE",e.Custom="CUSTOM"}(e.SideEditPropType||(e.SideEditPropType={})),function(e){e.Select="SELECT",e.Radio="RADIO",e.Color="COLOR"}(e.OptionsDisplay||(e.OptionsDisplay={})),function(e){e.Bold="BOLD",e.Italic="ITALIC",e.Code="CODE",e.Highlight="HIGHLIGHT",e.Link="LINK",e.UnorderedList="UL",e.OrderedList="OL",e.Heading1="H1",e.Heading2="H2",e.Heading3="H3",e.Heading4="H4",e.Heading5="H5",e.Heading6="H6",e.Quote="QUOTE"}(e.RichTextFeatures||(e.RichTextFeatures={})),function(e){e.Up="UP",e.Down="DOWN"}(e.SortDirection||(e.SortDirection={})),function(e){e.Draft="DRAFT",e.Published="PUBLISHED"}(e.PageStatus||(e.PageStatus={})),function(e){e.Staging="STAGING",e.Production="PRODUCTION"}(e.DeployEnvironment||(e.DeployEnvironment={})),function(e){e.Block="BLOCK",e.Page="PAGE"}(e.PlaygroundSelectedItemType||(e.PlaygroundSelectedItemType={})),function(e){e.Desktop="DESKTOP",e.Tablet="TABLET",e.Phone="PHONE"}(e.DeviceType||(e.DeviceType={})),function(e){e.Block="BLOCK",e.Item="ITEM",e.PageSettings="PAGE-SETTINGS",e.Document="DOCUMENT",e.Stories="STORIES"}(e.Tab||(e.Tab={})),function(e){e.BottomRight="BOTTOM-RIGHT",e.BottomLeft="BOTTOM-LEFT",e.TopRight="TOP-RIGHT",e.TopLeft="TOP-LEFT"}(e.ClickToEditSide||(e.ClickToEditSide={}))}(T||(T={}));var P=t({focused:{blockId:"",itemId:"",repeaterPropName:""},setFocused:function(){},triggerTextRefreshBlockId:"",setTriggerTextRefreshBlockId:function(){},setAddAfterBlockId:function(){},pageValues:{id:"",type:"",name:"",slug:"",meta:{},authorId:"",author:{id:"",email:"",firstName:"",lastName:""},invalidBlocksTypes:[],status:T.PageStatus.Draft,isLocked:!1,tags:[],createdAt:"",publishedAt:"",language:"",translations:[]},handleChangePageValue:function(){}}),E=function(e){return function(e){var t,n;if(!1===I(e))return!1;if("function"!=typeof(t=e.constructor))return!1;if(!1===I(n=t.prototype))return!1;if(!1===n.hasOwnProperty("isPrototypeOf"))return!1;return!0}(e)&&"string"==typeof e.text};function S(e){return E(e)?e.text:e.children.map(S).join("")}function I(e){return!0==(null!=(t=e)&&"object"==typeof t&&!1===Array.isArray(t))&&"[object Object]"===Object.prototype.toString.call(e);var t}var L,w={serialize:function(e){return e.map(S).join("\n")},deserialize:function(e){return e.split("\n").map((function(e){return{type:"paragraph",children:[{text:e}]}}))},isText:E},C=function(e,t,a){if(w.isText(e))return t.filter((function(e){return"Mark"===e.type})).reduce((function(t,n){return e[n.name]?n.renderLeaf({children:t}):t}),e.text);var o=t.filter((function(e){return"List"===e.type})).find((function(t){return e.type===t.name}));if(o){var i=N(e,t);return o.renderElement({children:i.map((function(e,t){return n(r,{key:t},o.renderItemElement({children:e}))})),element:{url:e.url}})}var l=N(e,t,a),u=t.filter((function(e){return"Block"===e.type})).find((function(t){return e.type===t.name}));return u?u.renderElement({children:l,element:{url:e.url}}):a?a({children:l,element:{type:"",children:[]},attributes:{ref:null}}):l},N=function(e,t,a){var o;return null===(o=e.children)||void 0===o?void 0:o.map((function(e,o){return n(r,{key:o},C(e,t,a))}))},B=function(e){var t,o,i=e.renderBlock,l=e.placeholder,u=e.renderPlaceholder,d=e.propName,s=e.multiline,c=void 0!==s&&s,p=a(x).values[d];if(null===(t=B.prototype)||void 0===t?void 0:t.renderAdmin)return null===(o=B.prototype)||void 0===o?void 0:o.renderAdmin({renderBlock:i,placeholder:l,renderPlaceholder:u,propName:d,multiline:c});var f=p;return p?("string"==typeof p&&(f=w.deserialize(p)),n(r,null,f.map((function(e,t){return n(r,{key:t},C(e,[],i))})))):null},R=function(e){var t,o,i=e.renderBlock,l=e.placeholder,u=e.renderPlaceholder,d=e.propName,s=e.plugins,c=void 0===s?[]:s,p=e.multiline,f=void 0===p||p,g=a(x).values[d];if(null===(t=R.prototype)||void 0===t?void 0:t.renderAdmin)return null===(o=R.prototype)||void 0===o?void 0:o.renderAdmin({renderBlock:i,placeholder:l,renderPlaceholder:u,propName:d,plugins:c,multiline:f});var m=g;return g?("string"==typeof g&&(m=w.deserialize(g)),n(r,null,m.map((function(e,t){return n(r,{key:t},C(e,c,i))})))):null},A=t({appId:"",apiKey:"",bricks:{},pageTypes:[],logo:"",contentClassName:"",renderLocalLink:function(e){var t=e.href,r=e.children;return n("a",{href:t},r)},navigate:function(){},loginPath:"",editorPath:"",playgroundPath:"",appSettingsPath:"",useCssInJs:!1,appRootElement:"",clickToEditSide:T.ClickToEditSide.BottomRight,responsiveBreakpoints:[],enableAutoSave:!0,disableSaveIfInvalidProps:!1}),D=function(e){var t,n;return(null===(t=D.prototype)||void 0===t?void 0:t.adminConstructor)?null===(n=D.prototype)||void 0===n?void 0:n.adminConstructor(e):{type:"Mark",name:e.name,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderLeaf:e.render,toggle:function(e){}}},O=D({name:"bold",hotKey:"mod+b",render:function(e){return n("strong",null,e.children)}}),H=D({name:"italic",hotKey:"mod+i",render:function(e){return n("em",null,e.children)}}),z=D({name:"code",hotKey:"mod+`",render:function(e){return n("code",{style:{margin:"0 1px",display:"inline-block",padding:"3px 6px",fontSize:"0.875rem",lineHeight:1.25,maxWidth:"100%",fontFamily:'Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',borderRadius:"3px",backgroundColor:"#F5F7F9"}},e.children)}}),F=D({name:"highlight",hotKey:"mod+h",render:function(e){return n("mark",{style:{paddingLeft:4,paddingRight:4,borderRadius:2,backgroundColor:"#ff0",color:"#0f0f05"}},e.children)}}),j=function(e){var t,r,o=e.href,i=e.children,l=e.target,u=e.className,d=m(e,["href","children","target","className"]),s=a(A).renderLocalLink;if(null===(t=j.prototype)||void 0===t?void 0:t.renderAdmin)return null===(r=j.prototype)||void 0===r?void 0:r.renderAdmin(g({href:o,children:i,target:l,className:u},d));var c={href:o};return/^\/(?!\/)/.test(o)?s?s(g({href:o,target:l,children:i,className:u},d)):(s||console.warn("Local path found in Link, but no renderLocalLink function was provided. Rendering <a> as fallback"),n("a",g({},c,{target:l,className:u},d),i)):n("a",g({},c,{target:l,className:u},d),i)},K={type:"Block",name:"link",label:"Link",isInline:!0,renderElement:function(e){var t=e.attributes,r=e.children,a=e.element;return n(j,g({},t,{href:a.url}),r)},toggle:function(e){}},M=function(e){var t,n;return(null===(t=M.prototype)||void 0===t?void 0:t.adminConstructor)?null===(n=M.prototype)||void 0===n?void 0:n.adminConstructor(e):{type:e.itemName?"List":"Block",name:e.name,isInline:e.isInline,itemName:e.itemName,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderElement:e.render,renderItemElement:e.renderItem,toggle:function(e,t){}}},U=M({name:"h1",hotKey:"mod+shift+1",render:function(e){return n("h1",null,e.children)}}),_=M({name:"h2",hotKey:"mod+shift+2",render:function(e){return n("h2",null,e.children)}}),G=M({name:"h3",hotKey:"mod+shift+3",render:function(e){return n("h3",null,e.children)}}),W=M({name:"h4",hotKey:"mod+shift+4",render:function(e){return n("h4",null,e.children)}}),V=M({name:"h5",hotKey:"mod+shift+5",render:function(e){return n("h5",null,e.children)}}),q=M({name:"h6",hotKey:"mod+shift+6",render:function(e){return n("h6",null,e.children)}}),Q=M({name:"quote",render:function(e){return n("blockquote",null,e.children)}}),J=M({name:"ol",label:"Number list",itemName:"li",render:function(e){return n("ol",{className:"list-decimal"},e.children)},renderItem:function(e){return n("li",null,e.children)}}),X=M({name:"ul",label:"Bullet list",itemName:"li",render:function(e){return n("ul",{className:"list-disc"},e.children)},renderItem:function(e){return n("li",null,e.children)}}),Y=Object.freeze({__proto__:null,bold:O,italic:H,code:z,highlight:F,link:K,heading1:U,heading2:_,heading3:G,heading4:W,heading5:V,heading6:q,quote:Q,orderedList:J,unorderedList:X}),Z=((L={})[T.RichTextFeatures.Bold]={newPlugin:O,renderLeaf:"renderBold"},L[T.RichTextFeatures.Italic]={newPlugin:H,renderLeaf:"renderBold"},L[T.RichTextFeatures.Highlight]={newPlugin:F,renderLeaf:"renderHighlight"},L[T.RichTextFeatures.Code]={newPlugin:z,renderLeaf:"renderCode"},L[T.RichTextFeatures.Link]={newPlugin:K,renderLink:"renderLink"},L[T.RichTextFeatures.UnorderedList]={newPlugin:X,renderElement:"renderUL",renderItemElement:"renderLI"},L[T.RichTextFeatures.OrderedList]={newPlugin:J,renderElement:"renderOL",renderItemElement:"renderLI"},L[T.RichTextFeatures.Heading1]={newPlugin:U,renderElement:"renderH1"},L[T.RichTextFeatures.Heading2]={newPlugin:_,renderElement:"renderH2"},L[T.RichTextFeatures.Heading3]={newPlugin:G,renderElement:"renderH3"},L[T.RichTextFeatures.Heading4]={newPlugin:W,renderElement:"renderH4"},L[T.RichTextFeatures.Heading5]={newPlugin:V,renderElement:"renderH5"},L[T.RichTextFeatures.Heading6]={newPlugin:q,renderElement:"renderH6"},L[T.RichTextFeatures.Quote]={newPlugin:Q,renderElement:"renderQuote"},L),$=function(t){var n,r;if(null===(n=$.prototype)||void 0===n?void 0:n.renderAdmin)return null===(r=$.prototype)||void 0===r?void 0:r.renderAdmin(t);var a=[];return t.allowedFeatures&&t.allowedFeatures.length>0&&(a=t.allowedFeatures.map((function(e){var n=Z[e],r=n.newPlugin,a=n.renderLeaf,o=n.renderElement,i=n.renderItemElement,l=n.renderLink,u={},d=t[a],s=t[o],c=t[i],p=t[l];return a&&d&&(u.renderLeaf=d),o&&s&&(u.renderElement=s),i&&c&&(u.renderItemElement=c),l&&p&&(u.renderElement=function(e){var t=e.attributes,n=e.children,r=e.element;return p({attributes:t,children:n,element:r,href:r.url})}),g(g({},r),u)}))),e.createElement(R,{renderBlock:t.renderBlock,placeholder:t.placeholder,propName:t.propName,plugins:a,multiline:t.multiline})},ee=require("react-progressive-graceful-image").default,te=function(e,t){if(!t)return e;var n=e.lastIndexOf(".");return e.substring(0,n)+"/"+t+e.substring(n)},ne=function(e){e.propName;var t=e.source,r=e.alt,a=e.noLazyLoad,o=void 0!==a&&a,i=e.containerClassName,l=e.containerStyle,u=void 0===l?{}:l,d=e.imageClassName,s=e.imageStyle,c=void 0===s?{}:s,p=m(e,["propName","source","alt","noLazyLoad","containerClassName","containerStyle","imageClassName","imageStyle"]),f=(null==t?void 0:t.alt)||r;if(!t)return null;var h,v,y=te(t.src,t.seoName),k=te(t.placeholderSrc||"",t.seoName),T=(h=t.srcSet,v=t.seoName,h?v?h.split(",").map((function(e){var t=b(e.trim().split(" "),2),n=t[0],r=t[1];return n&&r?te(n,v)+" "+r:te(e,v)})).join(", "):h:"");return n("div",{className:i,style:u},o?n("img",g({src:y,srcSet:T,alt:f,className:d,style:u},p)):n(ee,{src:y,srcSetData:{srcSet:T},placeholder:""},(function(e,t,r){return n("img",t?{src:k,alt:f,className:d,style:g({filter:"blur(8px)"},c)}:g({src:e,srcSet:r.srcSet,alt:f,className:d,style:c},p))})))},re=function(e){var t,r,o=a(x).values[e.propName];if(null===(t=re.prototype)||void 0===t?void 0:t.renderAdmin)return null===(r=re.prototype)||void 0===r?void 0:r.renderAdmin(e);e.maxWidth,e.aspectRatio;var i=m(e,["maxWidth","aspectRatio"]);return n(ne,g({},i,{source:o}))},ae=function(e){var t,n=e.allowedExtensions,r=void 0===n?[]:n,o=e.propName,i=e.renderBlock,l=a(x).values[o];return(null===(t=ae.prototype)||void 0===t?void 0:t.renderAdmin)?ae.prototype.renderAdmin({propName:o,renderBlock:i,allowedExtensions:r}):l?i(l):null},oe=function(e){var t,i,l=e.propName,u=e.itemProps,d=void 0===u?{}:u,s=e.renderWrapper,c=e.renderItemWrapper,p=a(A).bricks,f=a(x),m=f.values,h=f.parentId,v=f.parentType,y=f.handleChange,b=f.handleAddItem,k=m[l];if(o((function(){var e,t,n=null===(t=null===(e=p[v].schema)||void 0===e?void 0:e.repeaterItems)||void 0===t?void 0:t.find((function(e){return e.name===l}));n&&n.min&&(!k||k.length<n.min)&&b&&b(h,l,n.itemType)()}),[h,l,k]),null===(t=oe.prototype)||void 0===t?void 0:t.renderAdmin)return null===(i=oe.prototype)||void 0===i?void 0:i.renderAdmin({propName:l,itemProps:d,renderWrapper:s,renderItemWrapper:c});if(!k||0===k.length)return null;var T=n(r,null,k.map((function(e,t){var r=p[e.type];if(r){var a=r.schema.sideEditProps?r.schema.sideEditProps.reduce((function(t,n){var r,a;return n.groupName?a=n.props.map((function(t){var n;return(n={})[t.name]=e.props[t.name],n})).reduce((function(e,t){return g(g({},e),t)}),{}):((r={})[n.name]=e.props[n.name],a=r),g(g({},t),a)}),{}):{},o=g(g(g({},a),d),{key:e.id,index:t,onClick:function(e){},onFocus:function(e){},onChange:function(){}}),i=n(x.Provider,{key:e.id,value:{onChange:y(e.id,h,l),values:e.props,blockId:e.id,parentId:h,parentType:v,handleChange:y}},n(r,g({},o)));return c?c(i,t,k.length):i}})));return s?s(T):T},ie=function(){var e,t;return(null===(e=ie.prototype)||void 0===e?void 0:e.useAdmin)?null===(t=ie.prototype)||void 0===t?void 0:t.useAdmin():{isAdmin:!1,previewMode:!1,currentPage:{pageId:""}}},le=function(e){var t,n,r=a(x),o=r.values,i=r.onChange;if(null===(t=le.prototype)||void 0===t?void 0:t.useAdmin)return null===(n=le.prototype)||void 0===n?void 0:n.useAdmin(e);return[o[e],function(t){return i(e,t)},!0]},ue=function(){return n("div",{className:i("max-w-xl mx-auto py-6")})};ue.schema={name:"paragraph",label:"Paragraph",getDefaultProps:function(){return{text:"Lorem ipsum dolor sit amet"}}};var de={paragraph:ue},se=[{type:T.DeviceType.Phone,width:375,label:"Phone (375px)"},{type:T.DeviceType.Tablet,width:768,label:"Tablet (768px)"},{type:T.DeviceType.Desktop,width:"100%",label:"Desktop (100%)"}],ce=new l,pe=[{name:"page",pluralName:"pages",defaultLocked:!1,defaultStatus:T.PageStatus.Draft,defaultLanguage:"en",getDefaultContent:function(){return[]}}],fe=function(e){var t=e.appId,r=e.apiKey,a=e.bricks,o=e.pageTypes,i=e.customFields,l=e.logo,d=void 0===l?"":l,s=e.contentClassName,c=void 0===s?"":s,p=e.renderLocalLink,f=e.navigate,m=e.loginPath,h=void 0===m?"/admin":m,v=e.editorPath,y=void 0===v?"/admin/editor":v,b=e.playgroundPath,k=void 0===b?"/admin/playground":b,x=e.appSettingsPath,P=void 0===x?"/admin/app-settings":x,E=e.isDarkColorMode,S=void 0!==E&&E,I=e.toggleColorMode,L=e.useCssInJs,w=void 0!==L&&L,C=e.appRootElement,N=e.clickToEditSide,B=void 0===N?T.ClickToEditSide.BottomRight:N,R=e.responsiveBreakpoints,D=e.enableAutoSave,O=void 0===D||D,H=e.disableSaveIfInvalidProps,z=void 0!==H&&H,F=e.children,j=!1;if(a&&0!==a.length||console.warn("No bricks provided. Using default paragraph."),o||console.warn("No Page type schema provided. Using default page."),Array.isArray(a)||(console.error('"bricks" should be an array of Bricks'),j=!0),null==o||o.forEach((function(e){e.getDefaultContent&&e.getDefaultContent().length>0&&"string"!=typeof e.getDefaultContent()[0]&&console.error("A page type getDefaultContent() must return an array of bricks' names: please check the "+e.name+" page type.")})),a&&a.forEach((function(e){e.schema?(e.schema.render&&console.warn('The "render" method is depreacted on React Bricks v2 bricks. Please check the '+name+" brick."),e.schema.superType&&console.warn('The "superType" property is depreacted on React Bricks v2 bricks. Please check the '+name+" brick."),e.schema.textEditProps&&console.warn('The "textEditProps" property is depreacted on React Bricks v2 bricks. Please check the '+name+" brick.")):(console.error('Each brick component must have a "schema" property. Please check the '+name+" brick."),j=!0)})),j)return n("div",{style:{padding:"8px 16px",backgroundColor:"#fff5f5",border:"1px solid #fed7d7",borderRadius:4,color:"#c53030",margin:"50px auto",width:300}},"At least a blocking error found in schema. Check the console.");var K=null==a?void 0:a.reduce((function(e,t){var n;return g(g({},e),((n={})[t.schema.name]=t,n))}),{}),M=R&&R.length?R:se;return n(A.Provider,{value:{appId:t,apiKey:r,bricks:K||de,pageTypes:o||pe,customFields:i,logo:d,contentClassName:c,renderLocalLink:p,navigate:f,loginPath:h,editorPath:y,playgroundPath:k,appSettingsPath:P,isDarkColorMode:S,toggleColorMode:I,useCssInJs:w,appRootElement:C,clickToEditSide:B,responsiveBreakpoints:M,enableAutoSave:!!O,disableSaveIfInvalidProps:!!z}},n(u,{client:ce},F))},ge=t({pageValues:{id:"",type:"",name:"",slug:"",meta:{},authorId:"",author:{id:"",email:"",firstName:"",lastName:""},invalidBlocksTypes:[],status:T.PageStatus.Draft,isLocked:!1,tags:[],createdAt:"",publishedAt:"",language:"",translations:[]}}),me=function(){var e=a(P),t=e.pageValues,n=e.handleChangePageValue,r=a(ge).pageValues;return[t.id?t:r,n]},he=function(e){var t=e.bricks,a=e.block;return n(r,null,function(e){var r=t[e.type],a=b(me(),1)[0];if(r){var o=e.props;return r.schema.mapExternalDataToProps&&"function"==typeof r.schema.mapExternalDataToProps&&a.externalData&&"object"==typeof a.externalData&&(o=r.schema.mapExternalDataToProps(a.externalData,e.props)),n(x.Provider,{value:{values:o,onChange:function(){},blockId:e.id,parentId:e.id,parentType:e.type,handleChange:function(e){return function(){}},handleAddItem:function(e){return function(){}}}},n(r,g({},o)))}}(a))},ve=function(e){var t=e.bricks,r=e.content;return n("div",null,r.map((function(e){return n(he,{key:e.id,bricks:t,block:e})})))},ye="https://api.reactbricks.com/v2",be="rb_t",ke=function(t){var n=t.pageId,r=t.language,o=a(A),i=o.navigate,l=o.editorPath,u=o.clickToEditSide;if("undefined"==typeof localStorage)return null;var d,s=localStorage.getItem("rb_t");if(s&&s.length>10&&s.startsWith("ey")){var p={};return u===T.ClickToEditSide.BottomRight&&(p.bottom=50,p.right=0,p.borderTopLeftRadius=999,p.borderBottomLeftRadius=999,p.transform="translate(8px,0)"),u===T.ClickToEditSide.BottomLeft&&(p.bottom=50,p.left=0,p.borderTopRightRadius=999,p.borderBottomRightRadius=999,p.transform="translate(-8px,0)"),u===T.ClickToEditSide.TopRight&&(p.top=50,p.right=0,p.borderTopLeftRadius=999,p.borderBottomLeftRadius=999,p.transform="translate(8px,0)"),u===T.ClickToEditSide.TopLeft&&(p.top=50,p.left=0,p.borderTopRightRadius=999,p.borderBottomRightRadius=999,p.transform="translate(-8px,0)"),e.createElement(e.Fragment,null,e.createElement("style",null,"\n.rb-click-to-edit {\n position: fixed;\n width: 61px;\n height: 38px;\n background-color: #f65a8e;\n display: flex;\n justify-content: center;\n align-items: center;\n color: #fff;\n font-size: 20px;\n cursor: pointer;\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);\n transition: all 150ms ease;\n border: 2px solid #fff;\n}\n.rb-click-to-edit-left:hover {\n transform: translate(-2px,0)!important;\n}\n.rb-click-to-edit-right:hover {\n transform: translate(2px,0)!important;\n}\n "),e.createElement("div",{className:"rb-click-to-edit "+(d=u,d===T.ClickToEditSide.TopLeft||d===T.ClickToEditSide.BottomLeft?"rb-click-to-edit-left":"rb-click-to-edit-right"),style:p,onClick:function(){return i(l+"?p="+encodeURIComponent(n)+"&l="+r)}},e.createElement(c,null)))}return null},Te=function(e){var t=e.page;if(!t)return null;var r=a(A).bricks,o=(t.content,m(t,["content"])),i=g({},o);return n("div",null,t&&t.content&&t.content.length>0&&n(ge.Provider,{value:{pageValues:i}},n(ve,{bricks:r,content:t.content}),n(ke,{pageId:t.id,language:t.language})))},xe=function(e){if("undefined"==typeof window)return null;e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(window.location.search);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))},Pe=function(e){var t=void 0===e?{}:e,n=t.type,r=void 0===n?"":n,a=t.types,o=void 0===a?[]:a,i=t.tag,l=void 0===i?"":i,u=t.language,c=void 0===u?"":u,p=t.page,f=void 0===p?1:p,g=t.pageSize,m=void 0===g?500:g,y=t.sort,b=void 0===y?"":y,k=t.usePagination,T=void 0!==k&&k;m<=0&&(m=500);var x=localStorage.getItem("rb_t"),P=xe("t"),E="type="+r+"&types="+(null==o?void 0:o.join(","))+"&tag="+l+"&language="+c+"&page="+f+"&pageSize="+m+"&sort="+b;return d(["pages",{pageType:r,pageTypes:o,tag:l,language:c,page:f,pageSize:m,sort:b}],(function(){return h(void 0,void 0,void 0,(function(){var e,t,n,r;return v(this,(function(a){switch(a.label){case 0:return[4,s.get(ye+"/admin/pages?"+E)];case 1:return e=a.sent(),t=e.data,n=e.headers,T?(r=n["x-total-count"]?parseInt(n["x-total-count"],10):0,[2,{items:t,pagination:{page:f,pageSize:m,totalItems:r,totalPages:Math.ceil(r/m)}}]):[2,t]}}))}))}),{enabled:!!x||!!P})},Ee=function(e,t){var n=a(A).pageTypes,r=localStorage.getItem("rb_t"),o=xe("t");return d(["page",{pageId:e,language:t}],(function(){return h(void 0,void 0,Promise,(function(){var a,i,l;return v(this,(function(u){switch(u.label){case 0:return[4,s.get(t?ye+"/admin/pages/"+e+"/translations/"+t:ye+"/admin/pages/"+e,{headers:{Authorization:"Bearer "+(r||o)}})];case 1:return a=u.sent().data,i=null,(null==(l=null==n?void 0:n.find((function(e){return e.name===a.type})))?void 0:l.getExternalData)&&"function"==typeof l.getExternalData?[4,l.getExternalData(a)]:[3,3];case 2:(i=u.sent())&&"object"==typeof i&&(a.externalData=i),u.label=3;case 3:return[2,a]}}))}))}),{enabled:!(!e||!r&&!o),refetchOnWindowFocus:!1})},Se=function(e,t,n){return!(n&&n.find((function(t){return t===e}))||t&&!t.find((function(t){return t===e})))},Ie={id:"",type:"",slug:"",name:"",meta:{},author:{id:"",firstName:"",lastName:"",email:""},status:T.PageStatus.Draft,isLocked:!1,content:[],tags:[],createdAt:"",language:"en",translations:[]},Le=function(e,t,n){if(!e||!e.type||!e.content)return Ie;var r=t.find((function(t){return t.name===e.type}));if(!r)return Ie;var a=we(n,e.content,r.allowedBlockTypes,r.excludedBlockTypes);return g(g({},e),{content:a.blocks,invalidBlocksTypes:a.invalidBlocksTypes})},we=function(e,t,n,r){return t.reduce((function(t,a){var o=e[a.type];if(!o||!Se(a.type,n,r))return g(g({},t),{invalidBlocksTypes:k(k([],b(t.invalidBlocksTypes),!1),[a.type],!1)});var i=g(g({},a),{props:g({},a.props)});return Object.keys(i.props).forEach((function(t){var n,r,a,l,u,d,s;i.props[t]&&(null===(r=null===(n=i.props[t])||void 0===n?void 0:n.document)||void 0===r?void 0:r.data)&&(null===(l=null===(a=i.props[t])||void 0===a?void 0:a.document)||void 0===l?void 0:l.nodes)&&"document"===(null===(d=null===(u=i.props[t])||void 0===u?void 0:u.document)||void 0===d?void 0:d.object)||(null===(s=o.schema.repeaterItems)||void 0===s?void 0:s.find((function(e){return e.name===t})))&&(i.props[t]=we(e,i.props[t]).blocks)})),g(g({},t),{blocks:k(k([],b(t.blocks),!1),[i],!1)})}),{blocks:[],invalidBlocksTypes:[]})},Ce=function(e,t){var n=a(A),r=n.apiKey,o=n.pageTypes;return d(["pagePublic",{slug:e,language:t}],(function(){return h(void 0,void 0,Promise,(function(){var n,a,i;return v(this,(function(l){switch(l.label){case 0:return[4,s.get(t?ye+"/app/pages/"+e+"/translations/"+t:ye+"/app/pages/"+e,{headers:{Authorization:"Bearer "+r}})];case 1:return n=l.sent().data,a=null,(null==(i=null==o?void 0:o.find((function(e){return e.name===n.type})))?void 0:i.getExternalData)&&"function"==typeof i.getExternalData?[4,i.getExternalData(n)]:[3,3];case 2:(a=l.sent())&&"object"==typeof a&&(n.externalData=a),l.label=3;case 3:return[2,n]}}))}))}),{enabled:!!e})},Ne=function(e){var t=void 0===e?{}:e,n=t.type,r=void 0===n?"":n,o=t.types,i=void 0===o?[]:o,l=t.tag,u=void 0===l?"":l,c=t.language,p=void 0===c?"":c,f=t.page,g=void 0===f?1:f,m=t.pageSize,y=void 0===m?100:m,b=t.sort,k=void 0===b?"":b,T=t.usePagination,x=void 0!==T&&T,P=a(A).apiKey;y<=0&&(y=100);var E="type="+r+"&types="+(null==i?void 0:i.join(","))+"&tag="+u+"&language="+p+"&page="+g+"&pageSize="+y+"&sort="+k;return d(["pagesPublic",{pageType:r,pageTypes:i,tag:u,page:g,pageSize:y,sort:k}],(function(){return h(void 0,void 0,void 0,(function(){var e,t,n,r;return v(this,(function(a){switch(a.label){case 0:return[4,s.get(ye+"/app/pages?"+E,{headers:{Authorization:"Bearer "+P}})];case 1:return e=a.sent(),t=e.data,n=e.headers,x?(r=n["x-total-count"]?parseInt(n["x-total-count"],10):0,[2,{items:t,pagination:{page:g,pageSize:y,totalItems:r,totalPages:Math.ceil(r/y)}}]):[2,t]}}))}))}))},Be=function(e,t){void 0===e&&(e=1),void 0===t&&(t=100);var n=a(A).apiKey;return d(["tagsPublic"],(function(){return h(void 0,void 0,void 0,(function(){var r,a,o,i;return v(this,(function(l){switch(l.label){case 0:return[4,s.get(ye+"/app/tags?pageSize="+t+"&page="+e,{headers:{Authorization:"Bearer "+n}})];case 1:return r=l.sent(),a=r.data,o=r.headers,i=o["x-total-count"]?parseInt(o["x-total-count"],10):0,[2,{items:a,pagination:{page:e,pageSize:t,totalItems:i,totalPages:Math.ceil(i/t)}}]}}))}))}),{staleTime:3e5})},Re=function(){return a(A)},Ae=function(e,t,n,r){return h(void 0,void 0,Promise,(function(){var a,o,i,l;return v(this,(function(u){switch(u.label){case 0:return a=n?"/translations/"+n:"",[4,s.get(ye+"/app/pages/"+e+a,{headers:{Authorization:"Bearer "+t}})];case 1:return o=u.sent().data,i=null,(null==(l=null==r?void 0:r.find((function(e){return e.name===o.type})))?void 0:l.getExternalData)&&"function"==typeof l.getExternalData?[4,l.getExternalData(o)]:[3,3];case 2:(i=u.sent())&&"object"==typeof i&&(o.externalData=i),u.label=3;case 3:return[2,o]}}))}))},De=function(e,t){var n=void 0===t?{}:t,r=n.type,a=void 0===r?"":r,o=n.types,i=void 0===o?[]:o,l=n.tag,u=void 0===l?"":l,d=n.language,c=void 0===d?"":d,p=n.page,f=void 0===p?1:p,g=n.pageSize,m=void 0===g?100:g,y=n.sort,b=void 0===y?"":y,k=n.usePagination,T=void 0!==k&&k;return h(void 0,void 0,void 0,(function(){var t,n,r,o,l;return v(this,(function(d){switch(d.label){case 0:return m<=0&&(m=100),t="type="+a+"&types="+(null==i?void 0:i.join(","))+"&tag="+u+"&language="+c+"&page="+f+"&pageSize="+m+"&sort="+b,[4,s.get(ye+"/app/pages?"+t,{headers:{Authorization:"Bearer "+e}})];case 1:return n=d.sent(),r=n.data,o=n.headers,T?(l=o["x-total-count"]?parseInt(o["x-total-count"],10):0,[2,{items:r,pagination:{page:f,pageSize:m,totalItems:l,totalPages:Math.ceil(l/m)}}]):[2,r]}}))}))},Oe=function(e,t,n){return void 0===t&&(t=1),void 0===n&&(n=100),h(void 0,void 0,Promise,(function(){var r,a,o,i;return v(this,(function(l){switch(l.label){case 0:return[4,s.get(ye+"/app/tags?pageSize="+n+"&page="+t,{headers:{Authorization:"Bearer "+e}})];case 1:return r=l.sent(),a=r.data,o=r.headers,i=o["x-total-count"]?parseInt(o["x-total-count"],10):0,[2,{items:a,pagination:{page:t,pageSize:n,totalItems:i,totalPages:Math.ceil(i/n)}}]}}))}))},He=function(e){return e.reduce((function(e,t){var n=[];for(var r in t.props)Array.isArray(t.props[r])&&t.props[r].length>0&&t.props[r][0].props?n.push.apply(n,k([],b(He(t.props[r])),!1)):n.push(w.serialize(t.props[r]));return k(k([],b(e),!1),b(n),!1)}),[])};export{be as A,x as B,P as C,Te as D,Ie as E,ae as F,Ce as G,Ne as H,re as I,Be as J,Re as K,j as L,Ae as M,De as N,Oe as O,w as P,He as Q,A as R,B as T,b as _,g as a,m as b,y as c,h as d,v as e,f,k as g,me as h,Se as i,xe as j,Ee as k,Le as l,we as m,ye as n,$ as o,R as p,ce as q,oe as r,ie as s,T as t,Pe as u,le as v,M as w,D as x,Y as y,fe as z};
|
|
2
|
+
//# sourceMappingURL=react-bricks-37290d94.esm.js.map
|
package/react-bricks.d.ts
CHANGED
|
@@ -253,6 +253,7 @@ declare namespace types {
|
|
|
253
253
|
hideFromAddMenu?: boolean;
|
|
254
254
|
sideEditProps?: Array<ISideEditProp | ISideGroup>;
|
|
255
255
|
repeaterItems?: IRepeaterItem[];
|
|
256
|
+
newItemMenuOpen?: boolean;
|
|
256
257
|
mapExternalDataToProps?: (externalData: Props, brickProps?: Props) => Props;
|
|
257
258
|
playgroundLinkUrl?: string;
|
|
258
259
|
playgroundLinkLabel?: string;
|
|
@@ -491,7 +492,7 @@ declare namespace types {
|
|
|
491
492
|
label?: string;
|
|
492
493
|
hotKey?: string;
|
|
493
494
|
render: (props: RenderLeafProps) => JSX.Element;
|
|
494
|
-
icon
|
|
495
|
+
icon?: React.ReactElement;
|
|
495
496
|
}
|
|
496
497
|
/**
|
|
497
498
|
* Constructor for a Mark plugin
|
|
@@ -508,7 +509,7 @@ declare namespace types {
|
|
|
508
509
|
hotKey?: string;
|
|
509
510
|
render: (props: RenderElementProps) => JSX.Element;
|
|
510
511
|
renderItem?: (props: RenderElementProps) => JSX.Element;
|
|
511
|
-
icon
|
|
512
|
+
icon?: React.ReactElement;
|
|
512
513
|
}
|
|
513
514
|
/**
|
|
514
515
|
* Constructor for a Block plugin
|
|
@@ -605,6 +606,12 @@ declare const Link: FC<LinkProps>;
|
|
|
605
606
|
|
|
606
607
|
declare const useAdminContext: () => types.IReadAdminContext;
|
|
607
608
|
|
|
609
|
+
declare const useVisualEdit: (propName: string) => [any, (value: any) => void, boolean];
|
|
610
|
+
|
|
611
|
+
declare const blockPluginConstructor: types.BlockPluginConstructor;
|
|
612
|
+
|
|
613
|
+
declare const markPluginConstructor: types.MarkPluginConstructor;
|
|
614
|
+
|
|
608
615
|
declare const ReactBricks: FC<types.ReactBricksConfig>;
|
|
609
616
|
|
|
610
617
|
declare const ReactBricksContext: Context<types.IReactBricksContext>;
|
|
@@ -617,12 +624,6 @@ interface PageViewerProps {
|
|
|
617
624
|
}
|
|
618
625
|
declare const PageViewer: FC<PageViewerProps>;
|
|
619
626
|
|
|
620
|
-
declare const Editor: FC;
|
|
621
|
-
|
|
622
|
-
declare const Playground: () => JSX.Element;
|
|
623
|
-
|
|
624
|
-
declare const AppSettings: FC;
|
|
625
|
-
|
|
626
627
|
declare const usePage: (pageId: string, language?: string | undefined) => UseQueryResult<types.Page, unknown>;
|
|
627
628
|
|
|
628
629
|
declare const usePage$1: (slug: string, language?: string | undefined) => UseQueryResult<types.Page, unknown>;
|
|
@@ -681,7 +682,15 @@ interface UsePagesPublicType {
|
|
|
681
682
|
}
|
|
682
683
|
declare const usePagesPublic: UsePagesPublicType;
|
|
683
684
|
|
|
684
|
-
declare const
|
|
685
|
+
declare const useTagsPublic: (page?: number, pageSize?: number) => UseQueryResult<{
|
|
686
|
+
items: string[];
|
|
687
|
+
pagination: {
|
|
688
|
+
page: number;
|
|
689
|
+
pageSize: number;
|
|
690
|
+
totalItems: number;
|
|
691
|
+
totalPages: number;
|
|
692
|
+
};
|
|
693
|
+
}, unknown>;
|
|
685
694
|
|
|
686
695
|
declare const usePageValues: () => [types.PageValues, (pageData: types.PartialPage) => void];
|
|
687
696
|
|
|
@@ -716,33 +725,81 @@ interface FetchPagesType {
|
|
|
716
725
|
}
|
|
717
726
|
declare const fetchPages: FetchPagesType;
|
|
718
727
|
|
|
728
|
+
declare const fetchTags: (apiKey: string, page?: number, pageSize?: number) => Promise<{
|
|
729
|
+
items: string[];
|
|
730
|
+
pagination: {
|
|
731
|
+
page: number;
|
|
732
|
+
pageSize: number;
|
|
733
|
+
totalItems: number;
|
|
734
|
+
totalPages: number;
|
|
735
|
+
};
|
|
736
|
+
}>;
|
|
737
|
+
|
|
719
738
|
declare const cleanPage: (page: types.Page, pageTypes: types.IPageType[], bricks: types.Bricks) => types.Page;
|
|
720
739
|
|
|
721
740
|
declare const getPagePlainText: (blocks: types.IContentBlock[]) => string[];
|
|
722
741
|
|
|
723
742
|
declare const _default: {
|
|
724
|
-
bold: types.RichTextPlugin;
|
|
725
|
-
italic: types.RichTextPlugin;
|
|
726
|
-
code: types.RichTextPlugin;
|
|
727
|
-
highlight: types.RichTextPlugin;
|
|
728
|
-
link: types.RichTextPlugin;
|
|
729
|
-
heading1: types.RichTextPlugin;
|
|
730
|
-
heading2: types.RichTextPlugin;
|
|
731
|
-
heading3: types.RichTextPlugin;
|
|
732
|
-
heading4: types.RichTextPlugin;
|
|
733
|
-
heading5: types.RichTextPlugin;
|
|
734
|
-
heading6: types.RichTextPlugin;
|
|
735
|
-
quote: types.RichTextPlugin;
|
|
736
|
-
orderedList: types.RichTextPlugin;
|
|
737
|
-
unorderedList: types.RichTextPlugin;
|
|
738
|
-
};
|
|
739
|
-
|
|
740
|
-
declare const _default$1: {
|
|
741
743
|
serialize: (nodes: Node[]) => string;
|
|
742
744
|
deserialize: (input: string) => Descendant[];
|
|
743
745
|
isText: (value: any) => boolean;
|
|
744
746
|
};
|
|
745
747
|
|
|
748
|
+
declare const plugin: types.RichTextPlugin;
|
|
749
|
+
|
|
750
|
+
declare const plugin$1: types.RichTextPlugin;
|
|
751
|
+
|
|
752
|
+
declare const plugin$2: types.RichTextPlugin;
|
|
753
|
+
|
|
754
|
+
declare const plugin$3: types.RichTextPlugin;
|
|
755
|
+
|
|
756
|
+
declare const plugin$4: types.RichTextPlugin;
|
|
757
|
+
|
|
758
|
+
declare const plugin$5: types.RichTextPlugin;
|
|
759
|
+
|
|
760
|
+
declare const plugin$6: types.RichTextPlugin;
|
|
761
|
+
|
|
762
|
+
declare const plugin$7: types.RichTextPlugin;
|
|
763
|
+
|
|
764
|
+
declare const plugin$8: types.RichTextPlugin;
|
|
765
|
+
|
|
766
|
+
declare const plugin$9: types.RichTextPlugin;
|
|
767
|
+
|
|
768
|
+
declare const plugin$a: types.RichTextPlugin;
|
|
769
|
+
|
|
770
|
+
declare const plugin$b: types.RichTextPlugin;
|
|
771
|
+
|
|
772
|
+
declare const plugin$c: types.RichTextPlugin;
|
|
773
|
+
|
|
774
|
+
declare const plugin$d: types.RichTextPlugin;
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
declare namespace index {
|
|
779
|
+
export {
|
|
780
|
+
plugin as bold,
|
|
781
|
+
plugin$1 as italic,
|
|
782
|
+
plugin$2 as code,
|
|
783
|
+
plugin$3 as highlight,
|
|
784
|
+
plugin$4 as link,
|
|
785
|
+
plugin$5 as heading1,
|
|
786
|
+
plugin$6 as heading2,
|
|
787
|
+
plugin$7 as heading3,
|
|
788
|
+
plugin$8 as heading4,
|
|
789
|
+
plugin$9 as heading5,
|
|
790
|
+
plugin$a as heading6,
|
|
791
|
+
plugin$b as quote,
|
|
792
|
+
plugin$c as orderedList,
|
|
793
|
+
plugin$d as unorderedList,
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
declare const Editor: FC;
|
|
798
|
+
|
|
799
|
+
declare const Playground: () => JSX.Element;
|
|
800
|
+
|
|
801
|
+
declare const AppSettings: FC;
|
|
802
|
+
|
|
746
803
|
var css_248z = ".tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{background-color:#333;border-radius:4px;color:#fff;font-size:14px;line-height:1.4;outline:0;position:relative;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{border-top-color:initial;border-width:8px 8px 0;bottom:-7px;left:0;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:initial;border-width:0 8px 8px;left:0;top:-7px;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-left-color:initial;border-width:8px 0 8px 8px;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{border-right-color:initial;border-width:8px 8px 8px 0;left:-7px;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{color:#333;height:16px;width:16px}.tippy-arrow:before{border-color:transparent;border-style:solid;content:\"\";position:absolute}.tippy-content{padding:5px 9px;position:relative;z-index:1}";
|
|
747
804
|
styleInject(css_248z);
|
|
748
805
|
|
|
@@ -788,4 +845,4 @@ declare const useAuth: () => {
|
|
|
788
845
|
logoutUser: () => void;
|
|
789
846
|
};
|
|
790
847
|
|
|
791
|
-
export { Admin, AdminContext, AppSettings, Editor, File, Header, Image, Link, Login, PageViewer, _default
|
|
848
|
+
export { Admin, AdminContext, AppSettings, Editor, File, Header, Image, Link, Login, PageViewer, _default as Plain, Playground, ReactBricks, ReactBricksContext, Repeater, CompatibleRichText as RichText, RichText as RichTextExt, Text, blockPluginConstructor, cleanPage, fetchPage, fetchPages, fetchTags, getPagePlainText, markPluginConstructor, index as plugins, types, useAdminContext, useAuth, usePage, usePage$1 as usePagePublic, usePageValues, usePages, usePagesPublic, useReactBricksContext, useTagsPublic, useVisualEdit };
|