Version Description
Download this release
Release Info
Developer | themeisle |
Plugin | Cloud Templates & Patterns collection |
Version | 1.1.26 |
Comparing to | |
See all releases |
Code changes from version 1.1.25 to 1.1.26
- CHANGELOG.md +6 -0
- README.md +9 -0
- assets/build/app.asset.php +1 -1
- assets/build/app.js +3 -3
- assets/src/Components/CloudLibrary/Library.js +3 -4
- assets/src/Components/StarterSiteCard.js +1 -1
- editor/build/index.asset.php +1 -1
- editor/build/index.js +1 -1
- editor/src/extension.js +18 -2
- includes/Admin.php +5 -4
- includes/Main.php +1 -1
- includes/Sites_Listing.php +1 -1
- languages/templates-patterns-collection.pot +39 -39
- readme.txt +9 -0
- templates-patterns-collection.php +1 -1
- vendor/autoload.php +1 -1
- vendor/codeinwp/themeisle-sdk/CHANGELOG.md +24 -0
- vendor/codeinwp/themeisle-sdk/assets/images/animation.jpg +0 -0
- vendor/codeinwp/themeisle-sdk/assets/images/conditions.jpg +0 -0
- vendor/codeinwp/themeisle-sdk/assets/images/css.jpg +0 -0
- vendor/codeinwp/themeisle-sdk/assets/js/build/index.asset.php +1 -0
- vendor/codeinwp/themeisle-sdk/assets/js/build/index.js +1 -0
- vendor/codeinwp/themeisle-sdk/load.php +103 -1
- vendor/codeinwp/themeisle-sdk/src/Loader.php +2 -1
- vendor/codeinwp/themeisle-sdk/src/Modules/Compatibilities.php +236 -0
- vendor/codeinwp/themeisle-sdk/src/Modules/Dashboard_widget.php +2 -1
- vendor/codeinwp/themeisle-sdk/src/Modules/Licenser.php +116 -10
- vendor/codeinwp/themeisle-sdk/src/Modules/Promotions.php +254 -0
- vendor/codeinwp/themeisle-sdk/src/Modules/Rollback.php +17 -1
- vendor/codeinwp/themeisle-sdk/src/Modules/Uninstall_feedback.php +8 -6
- vendor/codeinwp/themeisle-sdk/src/Product.php +34 -1
- vendor/codeinwp/themeisle-sdk/start.php +2 -1
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_static.php +4 -4
- vendor/composer/installed.json +7 -7
- vendor/composer/installed.php +7 -7
CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
##### [Version 1.1.25](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.24...v1.1.25) (2022-07-28)
|
2 |
|
3 |
- Improvements to Workflow
|
1 |
+
##### [Version 1.1.26](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.25...v1.1.26) (2022-09-13)
|
2 |
+
|
3 |
+
- Fix warding on toast message when saving empty templates
|
4 |
+
- Fix UTM URLs
|
5 |
+
- Fix Restricted Content plugin mapping
|
6 |
+
|
7 |
##### [Version 1.1.25](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.24...v1.1.25) (2022-07-28)
|
8 |
|
9 |
- Improvements to Workflow
|
README.md
CHANGED
@@ -39,6 +39,15 @@ Yes, you can. You can either chose to import one template or the entire starter
|
|
39 |
|
40 |
## Changelog ##
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
##### [Version 1.1.25](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.24...v1.1.25) (2022-07-28)
|
43 |
|
44 |
- Improvements to Workflow
|
39 |
|
40 |
## Changelog ##
|
41 |
|
42 |
+
##### [Version 1.1.26](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.25...v1.1.26) (2022-09-13)
|
43 |
+
|
44 |
+
- Fix warding on toast message when saving empty templates
|
45 |
+
- Fix UTM URLs
|
46 |
+
- Fix Restricted Content plugin mapping
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
|
51 |
##### [Version 1.1.25](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.24...v1.1.25) (2022-07-28)
|
52 |
|
53 |
- Improvements to Workflow
|
assets/build/app.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-polyfill', 'wp-primitives'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-polyfill', 'wp-primitives'), 'version' => '07acaa66a6d834d1a087149c823316ef');
|
assets/build/app.js
CHANGED
@@ -5,7 +5,7 @@ Object(_.__)("Import the %s template","templates-patterns-collection"):
|
|
5 |
/* translators: name of template */
|
6 |
Object(_.__)("Import all templates from %s","templates-patterns-collection"),L?t[0].template_name:a.title)),Object(r.createElement)("p",{className:"description"},(Object(r.createElement)("strong",null,Object(_.__)("does not")),L?Object(_.sprintf)(
|
7 |
/* translators: %s the name of the template */
|
8 |
-
Object(_.__)("The %s template will be imported as a page into your site. This import will install & activate the page builder plugin if not already installed.","templates-patterns-collection"),t[0].template_name):Object(_.__)("All the templates that are included in this starter site, will be imported as pages. This import will install & activate the page builder plugin if not already installed.","templates-patterns-collection"))))),Object(r.createElement)("div",{className:"modal-footer"},!u&&Object(r.createElement)(E.Button,{className:"import-templates",isLink:!0,disabled:S,onClick:U},Object(_.__)("I want to import the entire site","templates-patterns-collection")),Object(r.createElement)(E.Button,{isPrimary:!0,className:"import",disabled:S,onClick:z},S?Object(_.__)("Importing")+"...":L?Object(_.__)("Import"):Object(_.__)("Import All Pages"))))}),null))})),We=function(){return Object(r.createElement)(W.SVG,{width:"100",height:"100",viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"ob-logo"},Object(r.createElement)(W.Path,{d:"M95.0264 100H4.97356C2.22797 100 0 97.772 0 95.0264V4.97356C0 2.22797 2.22797 0 4.97356 0H95.0264C97.772 0 100 2.22797 100 4.97356V95.0264C100 97.772 97.772 100 95.0264 100Z",fill:"#0366D6"}),Object(r.createElement)(W.Path,{d:"M82.6941 86.7448V30.8205V18.4653H70.3502H14.4146L26.7584 30.8205H70.3502V74.401L82.6941 86.7448Z",fill:"white"}),Object(r.createElement)(W.Path,{d:"M42.2416 58.9291L42.2528 71.183L53.2352 82.1653L53.1902 47.9806L18.9941 47.9355L29.9765 58.9066L42.2416 58.9291Z",fill:"white"}))};function qe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Qe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qe(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ye=Object(v.compose)(Object(h.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setInstallModalStatus,r=t.setTemplateModal,a=t.setPreviewStatus;return{setPreview:function(e){return a(e)},setInstallModal:function(e){return n(e)},setTemplateModal:r}})),Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getTemplateModal,r=t.getThemeAction,a=t.getCurrentEditor,c=t.getCurrentTab,o=t.getUserStatus;return{templateModal:n(),themeData:r()||!1,editor:a(),currentTab:c(),userStatus:o()}})))((function(e){var t=e.isGeneral,n=e.setPreview,a=e.setTemplateModal,o=e.templateModal,i=e.currentTab,s=e.userStatus,l=e.themeData,u=Object(r.useState)({gutenberg:[],elementor:[]}),m=y()(u,2),p=m[0],d=m[1],b=Object(r.useState)("gutenberg"),f=y()(b,2),h=f[0],g=f[1],v=Object(r.useState)([]),j=y()(v,2),w=j[0],k=j[1],N=Object(r.useState)(t),T=y()(N,2),x=T[0],P=T[1],M=Object(r.useState)(""),D=y()(M,2),I=D[0],L=D[1],A=Object(r.useState)({gutenberg:0,elementor:0,beaver:0}),B=y()(A,2),R=B[0],F=B[1],U=Object(r.useState)({gutenberg:0,elementor:0,beaver:0}),z=y()(U,2),V=z[0],H=z[1],W=Object(r.useState)(!1),J=y()(W,2),K=J[0],Z=J[1],X=Object(r.useState)(!1),ee=y()(X,2),te=ee[0],ne=ee[1],re=Object(r.useState)(!1),ae=y()(re,2),ce=ae[0],oe=ae[1],ie=Object(r.useState)(""),le=y()(ie,2),ue=le[0],me=le[1],pe=Object(r.useState)({templates:{order:"DESC",orderby:"date"},library:{order:"DESC",orderby:"date"}}),de=y()(pe,2),be=de[0],fe=de[1];Object(r.useEffect)((function(){Z(!0),L(""),F({gutenberg:0,elementor:0,beaver:0}),H({gutenberg:0,elementor:0,beaver:0}),ge()}),[t,h]);var he={gutenberg:{label:Object(_.__)("Gutenberg"),icon:"gutenberg.jpg"},elementor:{label:Object(_.__)("Elementor"),icon:"elementor.jpg"},beaver:{label:Object(_.__)("Beaver"),icon:"beaver.jpg"}},ge=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Qe({page:R[h],per_page:12,type:h},e);t&&(n.template_site_slug="general",n.premade=!0),I&&(n.search=I),se(t,n).then((function(e){d(Qe(Qe({},p),{},c()({},h,e.templates))),H(Qe(Qe({},V),{},c()({},h,e.total))),Z(!1)}))},Oe=function(){var e=C()(S.a.mark((function e(){var n,r,a=arguments;return S.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>0&&void 0!==a[0]?a[0]:R[h]+1,oe(!0),F(Qe(Qe({},R),{},c()({},h,n))),r={page:n,per_page:12,type:h},t&&(r.template_site_slug="general",r.premade=!0),I&&(r.search=I),e.next=8,se(t,r).then((function(e){d(Qe(Qe({},p),{},c()({},h,[].concat($()(p[h]),$()(e.templates))))),H(Qe(Qe({},V),{},c()({},h,e.total)))}));case 8:oe(!1);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ve=function(e){me(e),n(!0)},Ee=function(e){k([e]),a(!0)},_e=p[h]&&p[h].findIndex((function(e){return e.link===ue})),we=p[h]&&p[h].find((function(e){return ue===e.link})),Se=O()("cloud-items",{"is-grid":x||!s&&!t,"is-dummy":!s&&!t||!1!==l}),ke=function(){return t?be.templates:be.library},Ce=function(){var e=C()(S.a.mark((function e(n){var r;return S.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Z(!0),r=Qe({search:I,type:h},n),t&&(r.template_site_slug="general",r.premade=!0),se(t,r).then((function(e){d(Qe(Qe({},p),{},c()({},h,$()(e.templates)))),H(Qe(Qe({},V),{},c()({},h,e.total))),Z(!1)}));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ne=function(e){var t=e.title,n=e.description,a=e.showUpgradeBtn,c=void 0===a||a;return Object(r.createElement)("div",{className:Se},Object(r.createElement)("div",{className:"table"},$()(Array(12)).map((function(e,t){return Object(r.createElement)(je,{sortingOrder:ke(),onPreview:ve,userTemplate:!1,key:t,item:{},grid:!0})}))),Object(r.createElement)("div",{className:"upsell-modal-overlay"},Object(r.createElement)("div",{className:"upsell-modal"},Object(r.createElement)("div",{className:"upsell-modal-content"},Object(r.createElement)("div",{className:"info"},Object(r.createElement)("h3",null,t),Object(r.createElement)("p",{dangerouslySetInnerHTML:{__html:n}}),c&&Object(r.createElement)(E.Button,{variant:"primary",isPrimary:!0,href:"https://themeisle.com/themes/neve/upgrade/?utm_medium=
|
9 |
-
Object(_.__)("Right now this feature is not available with your current setup. if you want to use it, you need to install %1$s theme and %2$s plugin","template-patterns-collection"),'<a href="'.concat("https://wordpress.org/themes/neve/",'" target="_blank" rel="noreferrer">Neve</a>'),'<a href="'.concat("https://themeisle.com/themes/neve/upgrade/?utm_medium=nevedashboard&utm_source=neve&utm_campaign=templatecloud&utm_content=upgradetoprobtn and https://themeisle.com/themes/neve/neve-upgrade-new/?utm_medium=nevedashboard&utm_source=neve&utm_campaign=templatecloud&utm_content=changeplanbtn",'" target="_blank" rel="noreferrer">Neve Pro Addon</a>')),showUpgradeBtn:!1}):s||t?Object(r.createElement)("div",{className:Se},Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"editor-tabs"},Object.keys(he).map((function(e){return Object(r.createElement)("a",{key:e,href:"#",onClick:function(){g(e),ne(!1)},className:O()("tab",{active:h===e})},Object(r.createElement)("span",{className:"icon-wrap"},Object(r.createElement)("img",{className:"editor-icon",src:window.tiobDash.assets+"img/"+he[e].icon,alt:he[e].label})),Object(r.createElement)("span",{className:"editor"},he[e].label))}))),Object(r.createElement)(Pe,{currentTab:i,isGrid:x,setGrid:P,isSearch:te,searchQuery:I,setSearchQuery:L,onSearch:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:I;Z(!0),ne(!!e);var n=Qe({search:e,type:h},ke());t&&(n.template_site_slug="general",n.premade=!0),se(t,n).then((function(e){d(Qe(Qe({},p),{},c()({},h,$()(e.templates)))),H(Qe(Qe({},V),{},c()({},h,e.total))),Z(!1)}))},sortingOrder:ke(),setSortingOrder:function(e){return fe(Qe(Qe({},be),{},t?{templates:e}:{library:e}))},changeOrder:Ce}),K&&Object(r.createElement)(ye,{isGrid:x}),!K&&(p[h]&&p[h].length>0?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"table"},p[h].map((function(e){return Object(r.createElement)(je,{sortingOrder:ke(),onPreview:ve,userTemplate:!t,key:e.template_id,item:e,loadTemplates:ge,onImport:function(){return Ee(e)},grid:x})}))),Object(r.createElement)(G.a,{onChange:function(e){if(!e)return!1;Number(V[h])>R[h]&&Oe()}},Object(r.createElement)("span",{style:{height:10,width:10,display:"block"}})),ce&&Object(r.createElement)("div",{className:"fetching-loader"},Object(r.createElement)(E.Spinner,null))):Object(r.createElement)("div",{className:"empty-information"},Object(r.createElement)("img",{src:window.tiobDash.assets+"/img/layout.jpg",alt:Object(_.__)("No Templates Found")}),Object(r.createElement)("h3",null,Object(_.__)("There are no templates yet")),Object(r.createElement)("p",null,Object(_.__)("You can add a page or post to the cloud by accessing it with the WordPress or Elementor/Beaver editor. Learn more about this in our docs.")),Object(r.createElement)(E.Button,{variant:"secondary",isSecondary:!0,href:"https://docs.themeisle.com/article/1354-neve-template-cloud-library?utm_medium=nevedashboard&utm_source=templatecloud&utm_campaign=neve&utm_content=learnmore",target:"_blank"},Object(_.__)("Learn more")))),ue&&Object(r.createElement)(Me,{previewUrl:ue,rightButtons:Object(r.createElement)(E.Button,{isPrimary:!0,onClick:function(){return Ee(we)}},Object(_.__)("Import Template")),heading:we.template_name,leftButtons:Object(r.createElement)(r.Fragment,null,Object(r.createElement)(E.Button,{icon:q,onClick:function(){me(""),n(!1)}}),p[h].length>1&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(E.Button,{icon:Object(_.isRTL)()?Q:Y,onClick:function(){var e=_e-1;0===_e&&(e=p[h].length-1),me(p[h][e].link)}}),Object(r.createElement)(E.Button,{icon:Object(_.isRTL)()?Y:Q,onClick:function(){var e=_e+1;_e===p[h].length-1&&(e=0),me(p[h][e].link)}})))})),o&&w&&!K&&w.length>0&&Object(r.createElement)(Ge,{generalTemplates:!0,isUserTemplate:!t,templatesData:w})):Object(r.createElement)(Ne,{title:Object(_.__)("Templates Cloud is a PRO Feature"),description:Object(_.__)("Unlock the Templates Cloud features and save your pages or posts in the cloud.")})})),Je=[Object(_.__)("Business","templates-patterns-collection"),Object(_.__)("Ecommerce","templates-patterns-collection"),Object(_.__)("Fashion","templates-patterns-collection"),Object(_.__)("Blogging","templates-patterns-collection"),Object(_.__)("Photography","templates-patterns-collection")],Ke={all:Object(_.__)("All Categories"),free:Object(_.__)("Free"),business:Object(_.__)("Business"),portfolio:Object(_.__)("Portfolio"),woocommerce:Object(_.__)("WooCommerce"),blog:Object(_.__)("Blog"),personal:Object(_.__)("Personal"),other:Object(_.__)("Other")},Ze={gutenberg:{icon:"gutenberg.jpg",niceName:"Gutenberg"},elementor:{icon:"elementor.jpg",niceName:"Elementor"}},Xe=(Object(r.createElement)(r.Fragment,null,"Beaver ",Object(r.createElement)("span",{className:"long-name"},"Builder")),Object(r.createElement)(r.Fragment,null,"Thrive ",Object(r.createElement)("span",{className:"long-name"},"Architect")),function(e){var t=e.currentStep,n=e.progress,a=e.willDo,c={cleanup:{label:Object(_.__)("Cleanup previous Import","templates-patterns-collection"),status:n.cleanup,willDo:a.cleanup},theme_install:{label:Object(_.__)("Installing and Activating the Theme","templates-patterns-collection"),status:n.theme_install,willDo:a.theme_install},plugins:{label:Object(_.__)("Installing Plugins","templates-patterns-collection"),status:n.plugins,willDo:!0},content:{label:Object(_.__)("Importing Content","templates-patterns-collection"),status:n.content,willDo:a.content},customizer:{label:Object(_.__)("Importing Customizer Settings","templates-patterns-collection"),status:n.customizer,willDo:a.customizer},widgets:{label:Object(_.__)("Importing Widgets","templates-patterns-collection"),status:n.widgets,willDo:a.widgets}};return Object(r.createElement)("ul",{className:"stepper"},Object.keys(c).map((function(e,n){var a=c[e],o=a.label,i=a.status;if(!a.willDo)return null;var s=O()(["icon",{loading:t===e,warning:t===e,success:"done"===i,error:"error"===i,skip:"skip"===i}]),l="clock";return t===e&&(l="update"),"done"===i&&(l="yes"),"error"===i&&(l="no-alt"),Object(r.createElement)("li",{key:n},Object(r.createElement)("span",{className:s},Object(r.createElement)(E.Dashicon,{icon:l,className:t===e?"loading":""})),Object(r.createElement)("span",null,o))})))}),et=n(19),tt=n.n(et),nt=function(e){return tt()(e),Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"modal-body"},Object(r.createElement)("div",{className:"header"},Object(r.createElement)("span",{className:"title is-loading",style:{height:35,marginBottom:20}}),Object(r.createElement)("p",{className:"description is-loading",style:{height:20}}),Object(r.createElement)("p",{className:"description is-loading",style:{height:20,marginBottom:20}})),Object(r.createElement)("div",{className:"well is-loading"},Object(r.createElement)("span",{className:"title is-loading",style:{height:20}}),Object(r.createElement)("ol",null,Object(r.createElement)("li",null),Object(r.createElement)("li",null),Object(r.createElement)("li",null))),Object(r.createElement)("div",{className:"modal-toggles components-panel"},[1,2].map((function(e){return Object(r.createElement)("div",{key:e,className:"components-panel__body options general is-opened"},Object(r.createElement)("span",{className:"title is-loading"}),Object(r.createElement)("ul",null,[1,2,3].map((function(e){return Object(r.createElement)("li",{className:"option-row",key:e},Object(r.createElement)("div",{className:"mock-icon is-loading"}),Object(r.createElement)("span",{className:"is-loading"}),Object(r.createElement)("div",{className:"toggle is-loading"}))}))))})))),Object(r.createElement)("div",{className:"modal-footer"},Object(r.createElement)("span",{className:"link is-loading"}),Object(r.createElement)(E.Button,{isPrimary:!0,className:"import is-loading"})))},rt=Object(r.createElement)(W.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(W.Path,{d:"M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"})),at=function(e){var t=e.children,n=e.className,a=O()([n,"tiob-tooltip-wrap"]);return Object(r.createElement)("div",{className:a},Object(r.createElement)(E.Button,{onClick:function(e){e.preventDefault()},className:"tiob-tooltip-toggle",icon:rt,isLink:!0,isSmall:!0}),Object(r.createElement)("div",{className:"tiob-tooltip-content"},t))};function ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ot(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ct(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ct(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var it=Object(v.compose)(Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getCurrentSite,a=t.getThemeAction;return{editor:n(),siteData:r(),themeData:a()||!1}})),Object(h.withDispatch)((function(e,t){var n=t.siteData,r=e("neve-onboarding"),a=r.setTemplateModal,c=r.setSingleTemplateImport,o=r.setImportModalStatus,i=r.setThemeAction;return{setModal:function(e){return o(e)},setThemeAction:function(e){return i(e)},runTemplateImport:function(){c(n.slug),a(!0),o(!1)}}})))((function(e){var t=e.setModal,n=e.setThemeAction,a=e.editor,o=e.siteData,i=e.themeData,s=e.runTemplateImport,l=Object(r.useState)({content:!0,customizer:!0,widgets:!0,cleanup:!1,theme_install:!1!==i}),u=y()(l,2),m=u[0],p=u[1],d=Object(r.useState)(!1),b=y()(d,2),f=b[0],h=b[1],g=Object(r.useState)(!1),v=y()(g,2),j=v[0],w=v[1],S=Object(r.useState)(!1),k=y()(S,2),C=k[0],x=k[1],P=Object(r.useState)(!1),M=y()(P,2),D=M[0],A=M[1],z=Object(r.useState)(!1),V=y()(z,2),$=V[0],H=V[1],G=Object(r.useState)(!1),W=y()(G,2),q=W[0],Q=W[1],Y=Object(r.useState)(null),J=y()(Y,2),K=J[0],Z=J[1],X=Object(r.useState)(null),ee=y()(X,2),te=ee[0],ne=ee[1],re=Object(r.useState)(!1),ae=y()(re,2),ce=ae[0],oe=ae[1],ie=Object(r.useState)(null),se=y()(ie,2),le=se[0],ue=se[1],me=Object(r.useState)(null),pe=y()(me,2),de=pe[0],be=pe[1],fe=Object(r.useState)(null),he=y()(fe,2),ge=he[0],Oe=he[1],ve=Object(r.useState)(!0),je=y()(ve,2),ye=je[0],Ee=je[1],_e=Object(r.useState)(!0),we=y()(_e,2),Se=we[0],ke=we[1],Ce=Object(r.useState)(!0),Ne=y()(Ce,2),Te=Ne[0],xe=Ne[1],Pe=Object(r.useState)(!0),Me=y()(Pe,2),De=Me[0],Ie=Me[1],Le=tiobDash,Ae=Le.license,Be=Le.cleanupAllowed,Re=Object(r.useState)(Be),Fe=y()(Re,2),Ue=Fe[0],ze=Fe[1];function Ve(){R(i,(function(){console.log("[D] Theme Activate."),h("done"),n(!1),He()}),(function(){Ye(Object(_.__)("Could not activate theme.","templates-patterns-collection"),"theme_install")}))}function $e(){return i?"install"===i.action?(ne("theme_install"),console.log("[P] Theme Install."),B("neve",(function(){n(ot(ot({},i),{},{action:"activate"})),console.log("[D] Theme Install."),Ve()}),(function(e){n(ot(ot({},i),{},{action:"activate"})),Ye(e.errorMessage||Object(_.__)("Could not install theme.","templates-patterns-collection"),"theme_install")})),!1):(ne("theme_install"),console.log("[P] Theme Activate."),void Ve()):(console.log("[S] Theme."),He(),!1)}function He(){if(!le)return console.log("[S] Plugins."),Ge(),!1;ne("plugins"),console.log("[P] Plugins."),L(le).then((function(e){if(!e.success)return Ye(e,"plugins"),!1;console.log("[D] Plugins."),x("done"),Ge()})).catch((function(e){return Ye(e,"plugins")}))}function Ge(){if(!m.content)return console.log("[S] Content."),We(),!1;var e;ne("content"),console.log("[P] Content."),(e={contentFile:ge.content_file,source:"remote",frontPage:ge.front_page,shopPages:ge.shop_pages,demoSlug:ge.slug,editor:a},N(I.root+"/import_content",e)).then((function(e){if(!e.success)return Ye(e,"content"),!1;console.log("[D] Content."),e.frontpage_id&&Z(e.frontpage_id),A("done"),We()})).catch((function(e){return Ye(e,"content")}))}function We(){if(!m.customizer)return console.log("[S] Customizer."),qe(),!1;var e;ne("customizer"),console.log("[P] Customizer."),(e={source_url:ge.url,theme_mods:ge.theme_mods,wp_options:ge.wp_options},N(I.root+"/import_theme_mods",e)).then((function(e){if(!e.success)return Ye(e,"customizer"),!1;console.log("[D] Customizer."),H("done"),qe()})).catch((function(e){return Ye(e,"customizer")}))}function qe(){if(!m.widgets)return console.log("[S] Widgets."),Qe(),!1;var e;ne("widgets"),console.log("[P] Widgets."),(e=ge.widgets,N(I.root+"/import_widgets",e)).then((function(e){if(!e.success)return Ye(e,"widgets"),!1;console.log("[D] Widgets."),Q("done"),Qe()})).catch((function(e){return Ye(e,"widgets")}))}function Qe(){ne("done"),ze("yes"),tiobDash.cleanupAllowed="yes",oe(!1)}function Ye(e,t){oe(!1),ne(null),"cleanup"===t&&x("skip"),"plugins"===t&&A("skip"),["content","plugins"].includes(t)&&H("skip"),["content","plugins","customizer"].includes(t)&&Q("skip");var n={cleanup:Object(_.__)("Something went wrong while cleaning the previous import.","templates-patterns-collection"),plugins:Object(_.__)("Something went wrong while installing the necessary plugins.","templates-patterns-collection"),content:Object(_.__)("Something went wrong while importing the website content.","templates-patterns-collection"),customizer:Object(_.__)("Something went wrong while updating the customizer settings.","templates-patterns-collection"),widgets:Object(_.__)("Something went wrong while importing the widgets.","templates-patterns-collection")};switch(t){case"cleanup":w("error");break;case"plugins":x("error");break;case"content":A("error");break;case"customizer":H("error");break;case"widgets":Q("error")}be(e.data?{message:n[t],code:e.data}:{message:n[t]})}Object(r.useEffect)((function(){var e=o.remote_url||o.url,t=new URL("".concat(function(e){return e.replace(/\/$/,"")}(e)+"/","wp-json/ti-demo-data/data"));t.searchParams.append("license",Ae?Ae.key:"free"),T(t,!0,!1).then((function(e){e.ok||(be({message:Object(_.__)("Something went wrong while loading the site data. Please refresh the page and try again.","templates-patterns-collection"),code:"ti__ob_failed_fetch_response"}),Ee(!1)),e.json().then((function(e){Oe(ot(ot({},e),o));var t=ot({},e.mandatory_plugins||{}),n=ot({},e.recommended_plugins||{}),r=e.default_off_recommended_plugins||[];Object.keys(t).forEach((function(e){t[e]=!0})),Object.keys(n).forEach((function(e){n[e]=!r.includes(e)})),ue(ot(ot({},n),t)),Ee(!1)}))})).catch((function(){be({message:Object(_.__)("Something went wrong while loading the site data. Please refresh the page and try again.","templates-patterns-collection"),code:"ti__ob_failed_fetch_catch"}),Ee(!1)}))}),[]);var Je=function(){if(ce)return!1;t(!1)},Ke=!o.external_plugins||o.external_plugins.every((function(e){return!0===e.active})),Ze=Object.keys(m).every((function(e){return!1===m[e]})),et={elementor:"".concat(tiobDash.onboarding.homeUrl,"/wp-admin/post.php?post=").concat(K,"&action=elementor"),brizy:"".concat(tiobDash.onboarding.homeUrl,"/?brizy-edit"),"beaver builder":"".concat(tiobDash.onboarding.homeUrl,"/?fl_builder"),"thrive architect":"".concat(tiobDash.onboarding.homeUrl,"/wp-admin/post.php?post=").concat(K,"&action=architect&tve=true"),"divi builder":"".concat(tiobDash.onboarding.homeUrl,"/?et_fb=1&PageSpeed=off"),gutenberg:"".concat(tiobDash.onboarding.homeUrl,"/wp-admin/post.php?post=").concat(K,"&action=edit")}[a];return Object(r.createElement)(E.Modal,{className:O()(["ob-import-modal",{fetching:ye}]),onRequestClose:Je,shouldCloseOnClickOutside:!ce&&!ye,isDismissible:!ce&&!ye},ye?Object(r.createElement)(nt,null):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"modal-body"},ce||"done"===te||de?Object(r.createElement)(r.Fragment,null,de&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(U,{message:de.message||null,code:de.code||null}),Object(r.createElement)("hr",null)),null!==te&&Object(r.createElement)(Xe,{progress:{theme_install:f,cleanup:j,plugins:C,content:D,customizer:$,widgets:q},currentStep:te,willDo:m}),"done"===te&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("hr",null),Object(r.createElement)("p",{className:"import-result"},Object(_.__)("Content was successfully imported. Enjoy your new site!","templates-patterns-collection")),Object(r.createElement)("hr",null))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)((function(){return Object(r.createElement)("div",{className:"header"},Object(r.createElement)("h1",null,Object(_.sprintf)(
|
10 |
/* translators: name of starter site */
|
11 |
-
Object(_.__)("Import %s as a complete site","templates-patterns-collection"),ge.title)),Object(r.createElement)("p",{className:"description"},Object(_.__)("Import the entire site including customizer options, pages, content and plugins.","templates-patterns-collection")))}),null),Object(r.createElement)((function(){return Object(r.createElement)(F,{data:ge,externalInstalled:Ke})}),null),Object(r.createElement)(E.Panel,{className:"modal-toggles"},!1!==i&&Object(r.createElement)((function(){var e=O()("option-row","active"),t={icon:"admin-appearance",title:Object(_.__)("Neve","templates-patterns-collection"),tooltip:Object(_.__)("In order to import the starter site, Neve theme has to be installed and activated.","templates-patterns-collection")},n=t.icon,a=t.title,c=t.tooltip;return Object(r.createElement)(E.PanelBody,{onToggle:function(){Ie(!De)},opened:De,className:"options general",title:Object(_.__)("Install required theme","templates-patterns-collection")},Object(r.createElement)(E.PanelRow,{className:e},Object(r.createElement)(E.Icon,{icon:n}),Object(r.createElement)("span",null,a),c&&Object(r.createElement)(at,null,c)))}),null),Object(r.createElement)((function(){var e={content:{title:Object(_.__)("Content","templates-patterns-collection"),icon:"admin-post",tooltip:Object(_.__)("We recommend you backup your website content before attempting a full site import.","templates-patterns-collection")},customizer:{title:Object(_.__)("Customizer","templates-patterns-collection"),icon:"admin-customizer"},widgets:{title:Object(_.__)("Widgets","templates-patterns-collection"),icon:"admin-generic",tooltip:Object(_.__)("Widgets will be moved to the Inactive Widgets sidebar and can be retrieved from there.","templates-patterns-collection")}};return"yes"===Ue&&(e=ot({cleanup:{icon:"trash",title:Object(_.__)("Cleanup previous import","templates-patterns-collection"),tooltip:Object(_.__)("This will remove any plugins, images, customizer options, widgets posts and pages added by the previous demo import","templates-patterns-collection")}},e)),Object(r.createElement)(E.PanelBody,{onToggle:function(){xe(!Te)},opened:Te,className:"options general",title:Object(_.__)("Import settings","templates-patterns-collection")},Object.keys(e).map((function(t,n){var a=O()("option-row",{active:m[t]}),o=e[t],i=o.icon,s=o.title,l=o.tooltip;return Object(r.createElement)(E.PanelRow,{className:a,key:n},Object(r.createElement)(E.Icon,{icon:i}),Object(r.createElement)("span",null,s),l&&Object(r.createElement)(at,null,l),"theme_install"!==t&&Object(r.createElement)("div",{className:"toggle-wrapper"},Object(r.createElement)(E.ToggleControl,{checked:m[t],onChange:function(){p(ot(ot({},m),{},c()({},t,!m[t])))}})))})))}),null),Object(r.createElement)((function(){if(ye)return null;var e=ot(ot({},ge.recommended_plugins||{}),ge.mandatory_plugins||{});return Object(r.createElement)(E.PanelBody,{onToggle:function(){ke(!Se)},opened:Se,className:"options plugins",title:Object(_.__)("Plugins","templates-patterns-collection")},Object.keys(e).map((function(t,n){var a=O()("option-row",{active:le[t]});return Object(r.createElement)(E.PanelRow,{className:a,key:n},Object(r.createElement)(E.Icon,{icon:"admin-plugins"}),Object(r.createElement)("span",{dangerouslySetInnerHTML:{__html:e[t]}}),t in ge.recommended_plugins&&Object(r.createElement)("div",{className:"toggle-wrapper"},Object(r.createElement)(E.ToggleControl,{checked:le[t],onChange:function(){ue(ot(ot({},le),{},c()({},t,!le[t])))}})))})))}),null)))),!ce&&Object(r.createElement)("div",{className:"modal-footer"},"done"!==te?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(E.Button,{className:"import-templates",isLink:!0,onClick:s},Object(_.__)("I want to import just the templates","templates-patterns-collection")),!de&&Object(r.createElement)(E.Button,{className:"import",isPrimary:!0,disabled:Ze||!Ke,onClick:function(){oe(!0),function(){if(console.clear(),!m.cleanup)return console.log("[S] Cleanup."),$e(),!1;var e;ne("cleanup"),console.log("[P] Cleanup."),(e={},N(I.root+"/cleanup",e)).then((function(e){if(!e.success)return Ye(e,"cleanup"),!1;console.log("[D] Cleanup."),w("done"),$e()})).catch((function(e){return Ye(e,"cleanup")}))}()}},Object(_.__)("Import entire site","templates-patterns-collection"))):Object(r.createElement)("div",{className:"import-done-actions"},Object(r.createElement)(E.Button,{isLink:!0,className:"close",onClick:Je},Object(_.__)("Back to Sites Library","templates-patterns-collection")),Object(r.createElement)(E.Button,{isSecondary:!0,href:tiobDash.onboarding.homeUrl},Object(_.__)("View Website","templates-patterns-collection")),Object(r.createElement)(E.Button,{isPrimary:!0,className:"import",href:et},Object(_.__)("Add your own content","templates-patterns-collection"))))))})),st=Object(v.compose)(Object(h.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setSingleTemplateImport,r=t.setImportModalStatus;return{cancel:function(){n(null)},setModal:function(e){return r(e)},setTemplateModal:t.setTemplateModal}})),Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getTemplateModal,r=t.getCurrentSite,a=t.getCurrentEditor;return{templateModal:n(),site:r(),editor:a()}})))((function(e){var t=e.slug,n=e.cancel,a=e.setModal,c=e.site,o=e.editor,i=e.setTemplateModal,s=e.templateModal,l=Object(r.useState)([]),u=y()(l,2),m=u[0],p=u[1],d=Object(r.useState)(!0),b=y()(d,2),f=b[0],h=b[1],g=Object(r.useState)(""),O=y()(g,2),v=O[0],j=O[1],w=Object(r.useState)([]),S=y()(w,2),k=S[0],C=S[1],N=c.title,T=c.upsell,x=c.utmOutboundLink;Object(r.useEffect)((function(){P()}),[]);var P=function(){se(!0,{per_page:100,template_site_slug:t,premade:!0,type:o}).then((function(e){p(e.templates||[]),h(!1)}))},M=function(e){j(e)},D=function(e){C(e),i(!0)},I=function(e){D([e])},L=function(e){e.preventDefault(),a(!0)},A=m.findIndex((function(e){return e.link===v})),B=m.find((function(e){return e.link===v}));return Object(r.createElement)("div",{className:"single-templates-wrapper"},Object(r.createElement)("div",{className:"top"},Object(r.createElement)("div",{className:"breadcrumb"},Object(r.createElement)(E.Button,{isTertiary:!0,onClick:n},Object(r.createElement)(E.Icon,{icon:Y}),Object(_.__)("Back to Starter Sites"))),Object(r.createElement)("div",{className:"header"},Object(r.createElement)("div",{className:"text"},Object(r.createElement)("h1",null,N||"",T&&Object(r.createElement)("span",{className:"pro-badge"},Object(r.createElement)(E.Icon,{icon:"lock"}),Object(r.createElement)("span",null,Object(_.__)("Premium","templates-patterns-collection")))),Object(r.createElement)("p",{className:"description"},Object(_.__)("You can import individual pages or bulk-import all of them."))),Object(r.createElement)("div",{className:"actions"},!T&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(E.Button,{isSecondary:!0,onClick:L},Object(_.__)("Import Starter Site")),Object(r.createElement)(E.Button,{isPrimary:!0,disabled:m.length<1,onClick:function(e){e.preventDefault(),D(m)}},Object(_.__)("Import All Pages"))),T&&Object(r.createElement)(E.Button,{href:x||tiobDash.upgradeURL,isSecondary:!0},Object(_.__)("Upgrade"))))),Object(r.createElement)((function(){return f?Object(r.createElement)(E.Spinner,null):m.length<1?Object(_.__)("No templates for this starter site."):Object(r.createElement)("div",{className:"cloud-items is-grid"},Object(r.createElement)("div",{className:"table"},m.map((function(e){return Object(r.createElement)(je,{upsell:T,onPreview:M,userTemplate:!1,key:e.template_id,item:e,loadTemplates:P,onImport:function(){return I(e)},grid:!0})}))))}),null),v&&Object(r.createElement)(Me,{heading:B.template_name||null,previewUrl:v,leftButtons:Object(r.createElement)(r.Fragment,null,Object(r.createElement)(E.Button,{icon:q,onClick:function(){return j("")},label:Object(_.__)("Close","templates-patterns-collection")}),m.length>1&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(E.Button,{icon:Object(_.isRTL)()?Q:Y,onClick:function(){var e=A-1;0===A&&(e=m.length-1),j(m[e].link)}}),Object(r.createElement)(E.Button,{icon:Object(_.isRTL)()?Y:Q,onClick:function(){var e=A+1;A===m.length-1&&(e=0),j(m[e].link)}}))),rightButtons:Object(r.createElement)(r.Fragment,null,!T&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(E.Button,{isSecondary:!0,onClick:L},Object(_.__)("Import Starter Site")),Object(r.createElement)(E.Button,{isPrimary:!0,disabled:m.length<1,onClick:function(){return I(B)}},Object(_.__)("Import Page"))),T&&Object(r.createElement)(E.Button,{href:x||tiobDash.upgradeURL,isSecondary:!0},Object(_.__)("Upgrade")))}),s&&k&&!f&&k.length>0&&Object(r.createElement)(Ge,{templatesData:k}))})),lt=function(e){var t=e.setCurrentTab,n=e.currentTab,a=e.isFetching,c={starterSites:Object(_.__)("Starter Sites","templates-patterns-collection"),pageTemplates:Object(_.__)("Page Templates","templates-patterns-collection"),library:Object(_.__)("My Library","templates-patterns-collection")},o=Object(r.useState)(!1),i=y()(o,2),s=i[0],l=i[1],u=function(){var e=function(e){var t=window.location.hash;return"string"!=typeof window.location.hash?null:(t=t.substring(1),Object.keys(e).includes(t)?t:null)}(c);if(null!==e){var n=document.getElementById("menu-appearance"),r=n.querySelector('a[href="themes.php?page=tiob-starter-sites#library"]'),a=n.querySelector('a[href="themes.php?page=tiob-starter-sites"]');if(r&&a){var o=r.parentElement,i=a.parentElement;n.querySelector(".current").classList.remove("current"),o.classList.remove("current"),"library"===e?o.classList.add("current"):i.classList.add("current")}t(e)}};return Object(r.useEffect)((function(){u(),window.addEventListener("hashchange",u)}),[]),Object(r.createElement)("div",{className:"header-nav"},Object.keys(c).map((function(e){return Object(r.createElement)(E.Button,{href:"#"+e,key:e,isTertiary:!0,isPressed:e===n,onClick:function(n){var r;n.preventDefault(),t(e),r=e,window.location.hash=r}},c[e])})),"starterSites"!==n&&Object(r.createElement)(E.Button,{icon:de,onClick:function(){l(!0),localStorage.setItem("tpcCacheBuster",ce());var e=n;t(null),setTimeout((function(){t(e),l(!1)}),100)},label:Object(_.__)("Re-sync Library"),className:O()("is-sync",{"is-loading":s}),disabled:a||s,"data-content":Object(_.__)("Sync")}))},ut=Object(v.compose)(Object(h.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setOnboardingState;return{cancelOnboarding:function(){n(!1)},setCurrentTab:t.setCurrentTab,setFetching:t.setFetching}})),Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getOnboardingStatus,r=t.getCurrentTab,a=t.getFetching;return{isOnboarding:n(),currentTab:r(),isFetching:a()}})))((function(e){var t=e.isOnboarding,n=e.cancelOnboarding,a=e.setCurrentTab,c=e.currentTab;return Object(r.createElement)("div",{className:"ob-head"},!t&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"header-container"},Object(r.createElement)("h2",null,!tiobDash.brandedTheme&&Object(r.createElement)(E.Icon,{icon:We}),Object(r.createElement)("span",null,Object(_.__)("Templates Cloud","templates-patterns-collection"))),Object(r.createElement)(lt,{setCurrentTab:a,currentTab:c}))),t&&Object(r.createElement)(E.Button,{className:"close-onboarding",isLink:!0,icon:"no-alt",onClick:n}))})),mt=n(20),pt=n.n(mt),dt=Object(v.compose)(Object(h.withDispatch)((function(e,t){var n=t.data,r=n.slug,a=e("neve-onboarding"),c=a.setCurrentSite,o=a.setPreviewStatus,i=a.setImportModalStatus,s=a.setSingleTemplateImport;return{setSite:function(){return c(n)},setPreview:function(e){return o(e)},setModal:function(e){return i(e)},setImportingPages:function(){return s(r)}}})))((function(e){var t=e.data,n=e.setSite,a=e.setPreview,c=e.setModal,o=e.setImportingPages,i=t.upsell,s=t.screenshot,l=t.title,u=t.has_templates,m=t.isNew,p=Object(r.useState)(""),d=y()(p,2),b=d[0],f=d[1],h=O()("card starter-site-card",{"has-templates":u});return Object(r.createElement)("div",{onMouseEnter:function(){f("visible")},onMouseLeave:function(){f("")},className:h},m&&Object(r.createElement)("span",{className:"new-badge"},Object(_.__)("New","templates-patterns-collection").toUpperCase()),Object(r.createElement)("div",{className:"top"},Object(r.createElement)("div",{className:"actions "+b},Object(r.createElement)(E.Button,{isSecondary:!0,onClick:function(e){e.preventDefault(),n(),a(!0)}},Object(_.__)("Preview","templates-patterns-collection")),!i&&Object(r.createElement)(E.Button,{isPrimary:!0,className:"import",onClick:function(e){e.preventDefault(),n(),c(!0)}},Object(_.__)("Import","templates-patterns-collection")),!u&&i&&Object(r.createElement)(E.Button,{isLink:!0,className:"templates",target:"_blank",href:"https://themeisle.com/themes/neve/upgrade/?utm_medium=nevedashboard&utm_source=neve&utm_campaign=templatecloud&utm_content=unlockprobtn"},Object(_.__)("Unlock access with Business plan","templates-patterns-collection")),u&&Object(r.createElement)(E.Button,{isLink:!0,className:"templates",onClick:function(e){e.preventDefault(),n(),o()}},Object(_.__)("View Pages","templates-patterns-collection"))),s&&Object(r.createElement)("div",{className:"image",style:{backgroundImage:'url("'.concat(s,'")')}})),Object(r.createElement)("div",{className:"bottom"},Object(r.createElement)("p",{className:"title"},l),i&&Object(r.createElement)("span",{className:"pro-badge"},Object(r.createElement)(E.Dashicon,{icon:"lock",size:15}),Object(r.createElement)("span",null,Object(_.__)("Premium","templates-patterns-collection")))))})),bt=Object(v.compose)(Object(h.withSelect)((function(e){return{siteData:(0,e("neve-onboarding").getCurrentSite)()}})),Object(h.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setCurrentSite,r=t.setPreviewStatus,a=t.setImportModalStatus;return{setSite:function(e){return n(e)},setPreview:function(e){return r(e)},setModal:function(e){return a(e)}}})))((function(e){var t=e.next,n=e.prev,a=e.siteData,c=e.setSite,o=e.setPreview,i=e.setModal;return Object(r.createElement)("div",{className:"ob-preview"},Object(r.createElement)("div",{className:"preview"},Object(r.createElement)("iframe",{src:a.url,frameBorder:"0"}),Object(r.createElement)("div",{className:"loading"},Object(r.createElement)(E.Dashicon,{icon:"update",size:50}))),Object(r.createElement)("div",{className:"bottom-bar"},Object(r.createElement)("div",{className:"navigator"},Object(r.createElement)(E.Button,{onClick:function(e){e.preventDefault(),o(!1),c(null)},className:"close",label:Object(_.__)("Close","templates-patterns-collection"),icon:q}),n&&Object(r.createElement)(E.Button,{onClick:function(e){e.preventDefault(),c(n)},className:"prev",label:Object(_.__)("Previous","templates-patterns-collection"),icon:Object(_.isRTL)()?Q:Y}),t&&Object(r.createElement)(E.Button,{onClick:function(e){e.preventDefault(),c(t)},className:"next",label:Object(_.__)("Next","templates-patterns-collection"),icon:Object(_.isRTL)()?Y:Q})),Object(r.createElement)("div",{className:"actions"},a.upsell?Object(r.createElement)(E.Button,{className:"upgrade",isPrimary:!0,href:a.utmOutboundLink||tiobDash.upgradeURL},Object(_.__)("Upgrade and Import","templates-patterns-collection")):Object(r.createElement)(E.Button,{className:"import",isPrimary:!0,onClick:function(e){e.preventDefault(),i(!0)}},Object(_.__)("Import","templates-patterns-collection")))))})),ft=function(e){var t=e.editor,n=e.data,a=n.text,c=n.cta,o=n.url;return Object(r.createElement)((function(){return Object(r.createElement)("div",{className:"notification"},Object(r.createElement)("p",null,a),o&&c&&Object(r.createElement)(E.Button,{target:"_blank",isSecondary:!0,href:o.replace("<builder_name>",t).replace(" ","")},c))}),null)},ht=Object(v.compose)(Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentCategory,r=t.getCurrentEditor,a=t.getSearchQuery;return{editor:r(),category:n(),query:a()}})),Object(h.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setCurrentCategory,r=t.setCurrentEditor,a=t.setSearchQuery;return{setCurrentCategory:function(e){return n(e)},setCurrentEditor:function(e){return r(e)},onSearch:function(e){return a(e)}}})))((function(e){var t=e.count,n=(e.categories,e.editors),a=e.onSearch,c=(e.category,e.editor),o=e.onlyProSites,i=(e.setCurrentCategory,e.setCurrentEditor),s=e.query,l=e.className,u=e.showCount,m=void 0!==u&&u,p=Object(r.useState)(!1),d=y()(p,2),b=d[0],f=d[1],h=function(){return f(!b)},g=O()(l,"header-form");return Object(r.createElement)("div",{className:g},Object(r.createElement)("div",{className:"search"},Object(r.createElement)("img",{src:tiobDash.assets+"/img/search.svg",alt:Object(_.__)("Search Icon")}),Object(r.createElement)("input",{onChange:function(e){a(e.target.value)},type:"search",value:s,placeholder:Object(_.__)("Search for a starter site","templates-patterns-collection")+"..."}),!1,Object(r.createElement)((function(){return Object(r.createElement)("div",{className:"ob-dropdown categories-selector"},Object(r.createElement)(E.Button,{onClick:h,className:"select ob-dropdown"},Object(r.createElement)("span",{className:"label-editor"},Object(r.createElement)("span",{className:"icon-wrap"},Object(r.createElement)("img",{className:"editor-icon",src:tiobDash.assets+"img/"+n[c].icon,alt:Object(_.__)("Builder Logo","templates-patterns-collection")})),o.includes(c)&&Object(r.createElement)(E.Dashicon,{icon:"lock",style:{fontSize:"16px",width:"16px",height:"16px",marginLeft:"0"}}),n[c].niceName),Object(r.createElement)(E.Dashicon,{size:14,icon:b?"arrow-up-alt2":"arrow-down-alt2"}),b&&Object(r.createElement)(E.Popover,{position:"bottom center",onClose:h,noArrow:!0},b&&Object(r.createElement)("ul",{className:"options"},Object.keys(n).map((function(e,a){return e===c?null:Object(r.createElement)("li",{key:a},Object(r.createElement)("a",{href:"#",onClick:function(t){t.preventDefault(),i(e),f(!1)}},Object(r.createElement)("span",{className:"label-editor"},Object(r.createElement)("span",{className:"icon-wrap"},Object(r.createElement)("img",{className:"editor-icon",src:tiobDash.assets+"img/"+n[e].icon,alt:Object(_.__)("Builder Logo","templates-patterns-collection")})),o.includes(e)&&Object(r.createElement)(E.Dashicon,{icon:"lock",style:{fontSize:"16px",width:"16px",height:"16px"}}),n[e].niceName),m&&Object(r.createElement)("span",{className:"count"},t[e])))}))))))}),null)))})),gt=(Object(v.compose)(Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getSites;return{editor:n(),sites:r().sites}})),Object(h.withDispatch)((function(e){var t=e("neve-onboarding").setCurrentEditor;return{setCurrentEditor:function(e){return t(e)}}})))((function(e){var t=e.EDITOR_MAP,n=e.count,a=e.editor,c=e.setCurrentEditor,o=e.sites,i=e.isSmall,s=Object(r.useState)(!1),l=y()(s,2),u=l[0],m=l[1],p=Object.keys(o),d=function(){return m(!u)},b=O()(["ob-dropdown","editor-selector",{small:i}]);return Object(r.createElement)("div",{className:b},Object(r.createElement)(E.Button,{onClick:d,className:"select ob-dropdown"},Object(r.createElement)("img",{className:"editor-icon",src:tiobDash.assets+"img/"+t[a].icon,alt:Object(_.__)("Builder Logo","templates-patterns-collection")}),!i&&Object(r.createElement)("span",null,t[a].niceName),Object(r.createElement)("span",{className:"count"},n[a]),Object(r.createElement)(E.Dashicon,{size:14,icon:u?"arrow-up-alt2":"arrow-down-alt2"}),u&&Object(r.createElement)(E.Popover,{position:"bottom center",onClose:d,noArrow:!0},u&&Object(r.createElement)("ul",{className:"options"},p.map((function(e,o){return e===a?null:Object(r.createElement)("li",{key:o},Object(r.createElement)("a",{href:"#",onClick:function(t){t.preventDefault(),c(e),m(!1)}},Object(r.createElement)("img",{className:"editor-icon",src:tiobDash.assets+"img/"+t[e].icon,alt:Object(_.__)("Builder Logo","templates-patterns-collection")}),Object(r.createElement)("span",null,t[e].niceName),Object(r.createElement)("span",{className:"count"},n[e])))}))))))})),Object(v.compose)(Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getSites;return{editor:n(),sites:r().sites}})),Object(h.withDispatch)((function(e){var t=e("neve-onboarding").setCurrentEditor;return{setCurrentEditor:function(e){return t(e)}}})))((function(e){var t=e.EDITOR_MAP,n=e.count,a=e.onlyProSites,c=e.editor,o=e.setCurrentEditor,i=e.sites,s=Object.keys(i);return Object(r.createElement)("div",{className:"editor-tabs"},s.map((function(e,i){var s=O()(["tab",e,{active:e===c}]);return Object(r.createElement)("a",{key:i,href:"#",className:s,onClick:function(t){t.preventDefault(),o(e)}},Object(r.createElement)("span",{className:"icon-wrap"},Object(r.createElement)("img",{className:"editor-icon",src:tiobDash.assets+"img/"+t[e].icon,alt:Object(_.__)("Builder Logo","templates-patterns-collection")})),Object(r.createElement)("span",{className:"editor"},a.includes(e)&&Object(r.createElement)(E.Dashicon,{icon:"lock",style:{fontSize:"16px",width:"16px",height:"16px"}}),t[e].niceName),Object(r.createElement)("span",{className:"count"},n[e]))})))})),Object(v.compose)(Object(h.withSelect)((function(e){return{category:(0,e("neve-onboarding").getCurrentCategory)()}})),Object(h.withDispatch)((function(e){var t=e("neve-onboarding").setCurrentCategory;return{setCurrentCategory:function(e){return t(e)}}})))((function(e){var t=e.categories,n=e.count,a=e.category,c=e.setCurrentCategory,o=e.showCount,i=void 0!==o&&o;return Object(r.createElement)("div",{className:"editor-tabs"},Object.keys(t).map((function(e,o){if(1>n[e])return null;if(tiobDash&&"1"===tiobDash.isValidLicense&&"free"===e)return null;var s=O()(["tab",e,{active:e===a}]);return Object(r.createElement)("a",{key:o,href:"#",className:s,onClick:function(t){t.preventDefault(),c(e)}},Object(r.createElement)("span",{className:"editor"},t[e]),i&&Object(r.createElement)("span",{className:"count"},n[e]))})))}))),Ot=Object(v.compose)(Object(h.withSelect)((function(e){return{category:(0,e("neve-onboarding").getCurrentCategory)()}})),Object(h.withDispatch)((function(e){var t=e("neve-onboarding").setCurrentCategory;return{setCurrentCategory:function(e){return t(e)}}})))((function(e){var t=e.categories,n=e.count,a=e.category,c=e.setCurrentCategory,o=e.showCount,i=void 0!==o&&o,s=Object(r.useState)(!1),l=y()(s,2),u=l[0],m=l[1],p=function(){return m(!u)},d=O()(["ob-dropdown","editor-selector",{small:!0}]);return Object(r.createElement)("div",{className:d},Object(r.createElement)(E.Button,{onClick:p,className:"select ob-dropdown"},Object(r.createElement)("span",null,t[a]),Object(r.createElement)("span",{className:"count"},i?n[a]:""),Object(r.createElement)(E.Dashicon,{size:14,icon:u?"arrow-up-alt2":"arrow-down-alt2"}),u&&Object(r.createElement)(E.Popover,{position:"bottom center",onClose:p,noArrow:!0},u&&Object(r.createElement)("ul",{className:"options"},Object.keys(t).map((function(e,o){return e===a||tiobDash&&"1"===tiobDash.isValidLicense&&"free"===e||1>n[e]?null:Object(r.createElement)("li",{key:o},Object(r.createElement)("a",{href:"#",onClick:function(t){t.preventDefault(),c(e),m(!1)}},Object(r.createElement)("span",null,t[e]),i&&Object(r.createElement)("span",{className:"count"},n[e])))}))))))})),vt=Object(v.compose)(Object(h.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setOnboardingState,r=t.setCurrentCategory;return{cancelOnboarding:function(){n(!1)},resetCategory:function(){r("all")},setCurrentTab:t.setCurrentTab}})),Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getCurrentCategory,a=t.getOnboardingStatus,c=t.getSites;return{editor:n(),category:r(),isOnboarding:a(),getSites:c()}})))((function(e){var t,n=e.filterByCategory,a=e.filterBySearch,c=e.getSitesForBuilder,o=e.isOnboarding,i=e.getSites,s=e.category,l=e.editor,u=Object(r.useState)(!1),m=y()(u,2),p=m[0],d=m[1],b=i.sites,f=void 0===b?{}:b,h=i.migration,g={top:p?0:"-100%"},O=Object.keys(f),v=O.filter((function(e){return Object.keys(f[e]).filter((function(t){return!0===f[e][t].upsell})).length===Object.keys(f[e]).length})),j=(t={builders:{},categories:{}},O.forEach((function(e){var r=c(e);r=n(r,s),r=a(r),t.builders[e]=r?r.length:0})),Object.keys(Ke).forEach((function(e){var r=c(l);r=n(r,e),r=a(r),t.categories[e]=r?r.length:0})),t),_=50<=c(l).length;return Object(r.createElement)(r.Fragment,null,!o&&!h&&Object(r.createElement)("div",{className:"sticky-nav",style:g},Object(r.createElement)("div",{className:"container sticky-nav-content"},!tiobDash.brandedTheme&&Object(r.createElement)(E.Icon,{icon:We,size:32}),Object(r.createElement)(ht,{className:"in-sticky",count:j.builders,categories:Ke,editors:Ze,onlyProSites:v,showCount:_}),!1,Object(r.createElement)(Ot,{count:j.categories,categories:Ke,showCount:_}))),Object(r.createElement)(G.a,{onChange:function(e){d(!e)}},Object(r.createElement)("div",null,!o&&Object(r.createElement)("p",{className:"instructions"},tiobDash.strings.starterSitesTabDescription),!1,Object(r.createElement)(Ot,{count:j.categories,categories:Ke,showCount:_}),Object(r.createElement)(ht,{count:j.builders,categories:Ke,editors:Ze,onlyProSites:v,showCount:_}),!1,Object(r.createElement)(gt,{categories:Ke,count:j.categories,showCount:_}),!tiobDash.isValidLicense&&Object(r.createElement)(ft,{data:tiobDash.upsellNotifications.upsell_1,editor:l}))))})),jt=Object(v.compose)(Object(h.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setOnboardingState,r=t.setCurrentCategory;return{cancelOnboarding:function(){n(!1)},resetCategory:function(){r("all")},setCurrentTab:t.setCurrentTab,setSearchQuery:t.setSearchQuery}})),Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getCurrentCategory,a=t.getPreviewStatus,c=t.getCurrentSite,o=t.getImportModalStatus,i=t.getOnboardingStatus,s=t.getSites,l=t.getInstallModalStatus,u=t.getCurrentTab,m=t.getSearchQuery;return{editor:n(),category:r(),previewOpen:a(),currentSiteData:c(),importModal:o(),installModal:l(),isOnboarding:i(),getSites:s(),currentTab:u(),searchQuery:m()}})))((function(e){var t=e.getSites,n=e.category,a=e.resetCategory,c=e.editor,o=e.previewOpen,i=e.currentSiteData,s=e.isOnboarding,l=e.cancelOnboarding,u=e.setSearchQuery,m=e.searchQuery,p=t.sites,d=void 0===p?{}:p,b=function(){var e={};return g().forEach((function(t){var n=d&&d[t]?d[t]:{};e[t]=$()(Object.values(n))})),e},f=function(e,t){return"free"===t?e.filter((function(e){return!e.upsell})):"all"!==t?e.filter((function(e){return e.keywords.includes(t)})):e},h=function(e){return m?new pt.a(e,{includeScore:!0,keys:["title","slug","keywords"]}).search(m).map((function(e){return e.item})):e},g=function(){return Object.keys(d)},O=function(){var e=b()[c];return e=h(e),f(e,n)},v=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null===i)return null;var t=b()[c],n=t.indexOf(i);return-1===n||1===t.length?null:e&&0===n?t[t.length-1]:e||n!==t.length-1?t[e?n-1:n+1]:t[0]};return 1>d.length?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("p",null,Object(_.__)("Starter sites could not be loaded. Please refresh and try again.","templates-patterns-collection"),s&&Object(r.createElement)(E.Button,{style:{display:"block",margin:"20px auto"},isPrimary:!0,onClick:l},Object(_.__)("Close","templates-patterns-collection")))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(vt,{getSitesForBuilder:function(e){return b()[e]},filterBySearch:h,filterByCategory:f}),0===O().length&&Object(r.createElement)("div",{className:"no-results"},Object(r.createElement)("p",null,Object(_.__)("No results found.","templates-patterns-collection")," ",Object(_.__)("You can try a different search or use one of the categories below.","templates-patterns-collection")),Object(r.createElement)("div",{className:"tags"},Je.map((function(e,t){return Object(r.createElement)(E.Button,{key:t,isPrimary:!0,className:"tag",onClick:function(t){t.preventDefault(),u(e),a()}},e)})))),Object(r.createElement)((function(){var e=Object(r.useState)(9),t=y()(e,2),n=t[0],a=t[1],c=O();return Object(r.createElement)("div",{className:"ob-sites is-grid"},c.slice(0,n).map((function(e,t){return Object(r.createElement)(dt,{key:t,data:e})})),Object(r.createElement)(G.a,{onChange:function(e){if(!e)return!1;a(n+9)}},Object(r.createElement)("span",{style:{height:10,width:10,display:"block"}})))}),null),o&&i&&Object(r.createElement)(bt,{next:v(),prev:v(!0)}))})),yt=Object(v.compose)(Object(h.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setOnboardingState,r=t.setCurrentCategory;return{cancelOnboarding:function(){n(!1)},resetCategory:function(){r("all")},setCurrentTab:t.setCurrentTab}})),Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getCurrentCategory,a=t.getPreviewStatus,c=t.getCurrentSite,o=t.getImportModalStatus,i=t.getOnboardingStatus,s=t.getSites,l=t.getInstallModalStatus,u=t.getCurrentTab,m=t.getSingleImport;return{editor:n(),category:r(),previewOpen:a(),currentSiteData:c(),importModal:o(),installModal:l(),isOnboarding:i(),getSites:s(),currentTab:u(),singleImport:m()}})))((function(e){var t=e.getSites,n=(e.installModal,e.currentTab),a=e.singleImport,c=e.importModal,o=e.currentSiteData,i=(e.isOnboarding,t.migration);return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"ob"},Object(r.createElement)(ut,null),Object(r.createElement)("div",{className:"ob-body"},Object(r.createElement)("div",{className:"content-container"},i&&Object(r.createElement)(z,{data:i}),"starterSites"===n&&(a?Object(r.createElement)(st,{slug:a}):Object(r.createElement)(jt,null)),"library"===n&&Object(r.createElement)(Ye,null),"pageTemplates"===n&&Object(r.createElement)(Ye,{isGeneral:!0})))),c&&o&&Object(r.createElement)(it,null))})),Et=Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getOnboardingStatus,r=t.getUserStatus;return{onboarding:n(),userStatus:r()}}))((function(e){var t=e.onboarding,n=e.userStatus,a=O()(["content-wrap","starter-sites",{"is-onboarding":t,"is-free":!n}]);return Object(r.createElement)("div",{className:"tiob-wrap"},Object(r.createElement)("div",{className:a},Object(r.createElement)("div",{className:"container content"},Object(r.createElement)("div",{className:"main"},Object(r.createElement)("div",{className:"tab-content columns starter-sites"},Object(r.createElement)(yt,null))))))}));Object(h.registerStore)("neve-onboarding",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"REFRESH_SITES":var n=t.payload.sites;return i(i({},e),{},{sites:n});case"SET_CURRENT_EDITOR":var r=t.payload.editor;return localStorage.setItem("neve-onboarding-editor",r),i(i({},e),{},{editor:r});case"SET_CURRENT_CATEGORY":var a=t.payload.category;return i(i({},e),{},{category:a});case"SET_FOCUSED_SITE":var c=t.payload.siteData;return i(i({},e),{},{currentSite:c});case"SET_PREVIEW_STATUS":var o=t.payload.previewStatus;return i(i({},e),{},{previewStatus:o});case"SET_IMPORT_MODAL_STATUS":var s=t.payload.importModalStatus;return i(i({},e),{},{importModalStatus:s});case"SET_INSTALL_MODAL_STATUS":var l=t.payload.installModalStatus;return i(i({},e),{},{installModalStatus:l});case"SET_ONBOARDING":var u=t.payload.status;return i(i({},e),{},{isOnboarding:u});case"SET_THEME_ACTIONS":var m=t.payload.themeActions;return i(i({},e),{},{themeAction:m});case"SET_CURRENT_TAB":var p=t.payload.currentTab;return i(i({},e),{},{singleTemplateImport:null,currentTab:p});case"SET_FETCHING":var b=t.payload.fetching;return i(i({},e),{},{fetching:b});case"SET_SINGLE_TEMPLATE_IMPORT":var f=t.payload.slug;return i(i({},e),{},{singleTemplateImport:f});case"SET_TEMPLATE_MODAL":var h=t.payload.data;return i(i({},e),{},{templateModal:h});case"SET_SEARCH_QUERY":var g=t.payload.query;return i(i({},e),{},{searchQuery:g})}return e},actions:b,selectors:f}),Object(r.render)(Object(r.createElement)(Et,null),document.getElementById("tpc-app"))}]);
|
5 |
/* translators: name of template */
|
6 |
Object(_.__)("Import all templates from %s","templates-patterns-collection"),L?t[0].template_name:a.title)),Object(r.createElement)("p",{className:"description"},(Object(r.createElement)("strong",null,Object(_.__)("does not")),L?Object(_.sprintf)(
|
7 |
/* translators: %s the name of the template */
|
8 |
+
Object(_.__)("The %s template will be imported as a page into your site. This import will install & activate the page builder plugin if not already installed.","templates-patterns-collection"),t[0].template_name):Object(_.__)("All the templates that are included in this starter site, will be imported as pages. This import will install & activate the page builder plugin if not already installed.","templates-patterns-collection"))))),Object(r.createElement)("div",{className:"modal-footer"},!u&&Object(r.createElement)(E.Button,{className:"import-templates",isLink:!0,disabled:S,onClick:U},Object(_.__)("I want to import the entire site","templates-patterns-collection")),Object(r.createElement)(E.Button,{isPrimary:!0,className:"import",disabled:S,onClick:z},S?Object(_.__)("Importing")+"...":L?Object(_.__)("Import"):Object(_.__)("Import All Pages"))))}),null))})),We=function(){return Object(r.createElement)(W.SVG,{width:"100",height:"100",viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"ob-logo"},Object(r.createElement)(W.Path,{d:"M95.0264 100H4.97356C2.22797 100 0 97.772 0 95.0264V4.97356C0 2.22797 2.22797 0 4.97356 0H95.0264C97.772 0 100 2.22797 100 4.97356V95.0264C100 97.772 97.772 100 95.0264 100Z",fill:"#0366D6"}),Object(r.createElement)(W.Path,{d:"M82.6941 86.7448V30.8205V18.4653H70.3502H14.4146L26.7584 30.8205H70.3502V74.401L82.6941 86.7448Z",fill:"white"}),Object(r.createElement)(W.Path,{d:"M42.2416 58.9291L42.2528 71.183L53.2352 82.1653L53.1902 47.9806L18.9941 47.9355L29.9765 58.9066L42.2416 58.9291Z",fill:"white"}))};function qe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Qe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qe(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ye=Object(v.compose)(Object(h.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setInstallModalStatus,r=t.setTemplateModal,a=t.setPreviewStatus;return{setPreview:function(e){return a(e)},setInstallModal:function(e){return n(e)},setTemplateModal:r}})),Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getTemplateModal,r=t.getThemeAction,a=t.getCurrentEditor,c=t.getCurrentTab,o=t.getUserStatus;return{templateModal:n(),themeData:r()||!1,editor:a(),currentTab:c(),userStatus:o()}})))((function(e){var t=e.isGeneral,n=e.setPreview,a=e.setTemplateModal,o=e.templateModal,i=e.currentTab,s=e.userStatus,l=e.themeData,u=Object(r.useState)({gutenberg:[],elementor:[]}),m=y()(u,2),p=m[0],d=m[1],b=Object(r.useState)("gutenberg"),f=y()(b,2),h=f[0],g=f[1],v=Object(r.useState)([]),j=y()(v,2),w=j[0],k=j[1],N=Object(r.useState)(t),T=y()(N,2),x=T[0],P=T[1],M=Object(r.useState)(""),D=y()(M,2),I=D[0],L=D[1],A=Object(r.useState)({gutenberg:0,elementor:0,beaver:0}),B=y()(A,2),R=B[0],F=B[1],U=Object(r.useState)({gutenberg:0,elementor:0,beaver:0}),z=y()(U,2),V=z[0],H=z[1],W=Object(r.useState)(!1),J=y()(W,2),K=J[0],Z=J[1],X=Object(r.useState)(!1),ee=y()(X,2),te=ee[0],ne=ee[1],re=Object(r.useState)(!1),ae=y()(re,2),ce=ae[0],oe=ae[1],ie=Object(r.useState)(""),le=y()(ie,2),ue=le[0],me=le[1],pe=Object(r.useState)({templates:{order:"DESC",orderby:"date"},library:{order:"DESC",orderby:"date"}}),de=y()(pe,2),be=de[0],fe=de[1];Object(r.useEffect)((function(){Z(!0),L(""),F({gutenberg:0,elementor:0,beaver:0}),H({gutenberg:0,elementor:0,beaver:0}),ge()}),[t,h]);var he={gutenberg:{label:Object(_.__)("Gutenberg"),icon:"gutenberg.jpg"},elementor:{label:Object(_.__)("Elementor"),icon:"elementor.jpg"},beaver:{label:Object(_.__)("Beaver"),icon:"beaver.jpg"}},ge=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Qe({page:R[h],per_page:12,type:h},e);t&&(n.template_site_slug="general",n.premade=!0),I&&(n.search=I),se(t,n).then((function(e){d(Qe(Qe({},p),{},c()({},h,e.templates))),H(Qe(Qe({},V),{},c()({},h,e.total))),Z(!1)}))},Oe=function(){var e=C()(S.a.mark((function e(){var n,r,a=arguments;return S.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>0&&void 0!==a[0]?a[0]:R[h]+1,oe(!0),F(Qe(Qe({},R),{},c()({},h,n))),r={page:n,per_page:12,type:h},t&&(r.template_site_slug="general",r.premade=!0),I&&(r.search=I),e.next=8,se(t,r).then((function(e){d(Qe(Qe({},p),{},c()({},h,[].concat($()(p[h]),$()(e.templates))))),H(Qe(Qe({},V),{},c()({},h,e.total)))}));case 8:oe(!1);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ve=function(e){me(e),n(!0)},Ee=function(e){k([e]),a(!0)},_e=p[h]&&p[h].findIndex((function(e){return e.link===ue})),we=p[h]&&p[h].find((function(e){return ue===e.link})),Se=O()("cloud-items",{"is-grid":x||!s&&!t,"is-dummy":!s&&!t||!1!==l}),ke=function(){return t?be.templates:be.library},Ce=function(){var e=C()(S.a.mark((function e(n){var r;return S.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Z(!0),r=Qe({search:I,type:h},n),t&&(r.template_site_slug="general",r.premade=!0),se(t,r).then((function(e){d(Qe(Qe({},p),{},c()({},h,$()(e.templates)))),H(Qe(Qe({},V),{},c()({},h,e.total))),Z(!1)}));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ne=function(e){var t=e.title,n=e.description,a=e.showUpgradeBtn,c=void 0===a||a;return Object(r.createElement)("div",{className:Se},Object(r.createElement)("div",{className:"table"},$()(Array(12)).map((function(e,t){return Object(r.createElement)(je,{sortingOrder:ke(),onPreview:ve,userTemplate:!1,key:t,item:{},grid:!0})}))),Object(r.createElement)("div",{className:"upsell-modal-overlay"},Object(r.createElement)("div",{className:"upsell-modal"},Object(r.createElement)("div",{className:"upsell-modal-content"},Object(r.createElement)("div",{className:"info"},Object(r.createElement)("h3",null,t),Object(r.createElement)("p",{dangerouslySetInnerHTML:{__html:n}}),c&&Object(r.createElement)(E.Button,{variant:"primary",isPrimary:!0,href:"https://themeisle.com/themes/neve/upgrade/?utm_medium=templatecloud&utm_source=wpadmin&utm_campaign=upgradetoprobtn&utm_content=neve",target:"_blank"},Object(_.__)("Upgrade to PRO"))),Object(r.createElement)("div",{className:"icon"},Object(r.createElement)(E.Icon,{icon:We}))))))};return!1!==l?Object(r.createElement)(Ne,{title:Object(_.__)("Coming soon"),description:Object(_.sprintf)(// translators: %1$s: Theme Name %2$s Plugin Name.
|
9 |
+
Object(_.__)("Right now this feature is not available with your current setup. if you want to use it, you need to install %1$s theme and %2$s plugin","template-patterns-collection"),'<a href="'.concat("https://wordpress.org/themes/neve/",'" target="_blank" rel="noreferrer">Neve</a>'),'<a href="'.concat("https://themeisle.com/themes/neve/upgrade/?utm_medium=nevedashboard&utm_source=wpadmin&utm_campaign=templatecloud&utm_content=neve",'" target="_blank" rel="noreferrer">Neve Pro Addon</a>')),showUpgradeBtn:!1}):s||t?Object(r.createElement)("div",{className:Se},Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"editor-tabs"},Object.keys(he).map((function(e){return Object(r.createElement)("a",{key:e,href:"#",onClick:function(){g(e),ne(!1)},className:O()("tab",{active:h===e})},Object(r.createElement)("span",{className:"icon-wrap"},Object(r.createElement)("img",{className:"editor-icon",src:window.tiobDash.assets+"img/"+he[e].icon,alt:he[e].label})),Object(r.createElement)("span",{className:"editor"},he[e].label))}))),Object(r.createElement)(Pe,{currentTab:i,isGrid:x,setGrid:P,isSearch:te,searchQuery:I,setSearchQuery:L,onSearch:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:I;Z(!0),ne(!!e);var n=Qe({search:e,type:h},ke());t&&(n.template_site_slug="general",n.premade=!0),se(t,n).then((function(e){d(Qe(Qe({},p),{},c()({},h,$()(e.templates)))),H(Qe(Qe({},V),{},c()({},h,e.total))),Z(!1)}))},sortingOrder:ke(),setSortingOrder:function(e){return fe(Qe(Qe({},be),{},t?{templates:e}:{library:e}))},changeOrder:Ce}),K&&Object(r.createElement)(ye,{isGrid:x}),!K&&(p[h]&&p[h].length>0?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"table"},p[h].map((function(e){return Object(r.createElement)(je,{sortingOrder:ke(),onPreview:ve,userTemplate:!t,key:e.template_id,item:e,loadTemplates:ge,onImport:function(){return Ee(e)},grid:x})}))),Object(r.createElement)(G.a,{onChange:function(e){if(!e)return!1;Number(V[h])>R[h]&&Oe()}},Object(r.createElement)("span",{style:{height:10,width:10,display:"block"}})),ce&&Object(r.createElement)("div",{className:"fetching-loader"},Object(r.createElement)(E.Spinner,null))):Object(r.createElement)("div",{className:"empty-information"},Object(r.createElement)("img",{src:window.tiobDash.assets+"/img/layout.jpg",alt:Object(_.__)("No Templates Found")}),Object(r.createElement)("h3",null,Object(_.__)("There are no templates yet")),Object(r.createElement)("p",null,Object(_.__)("You can add a page or post to the cloud by accessing it with the WordPress or Elementor/Beaver editor. Learn more about this in our docs.")),Object(r.createElement)(E.Button,{variant:"secondary",isSecondary:!0,href:"https://docs.themeisle.com/article/1354-neve-template-cloud-library?utm_medium=nevedashboard&utm_source=wpadmin&utm_campaign=templatescloud&utm_content=neve",target:"_blank"},Object(_.__)("Learn more")))),ue&&Object(r.createElement)(Me,{previewUrl:ue,rightButtons:Object(r.createElement)(E.Button,{isPrimary:!0,onClick:function(){return Ee(we)}},Object(_.__)("Import Template")),heading:we.template_name,leftButtons:Object(r.createElement)(r.Fragment,null,Object(r.createElement)(E.Button,{icon:q,onClick:function(){me(""),n(!1)}}),p[h].length>1&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(E.Button,{icon:Object(_.isRTL)()?Q:Y,onClick:function(){var e=_e-1;0===_e&&(e=p[h].length-1),me(p[h][e].link)}}),Object(r.createElement)(E.Button,{icon:Object(_.isRTL)()?Y:Q,onClick:function(){var e=_e+1;_e===p[h].length-1&&(e=0),me(p[h][e].link)}})))})),o&&w&&!K&&w.length>0&&Object(r.createElement)(Ge,{generalTemplates:!0,isUserTemplate:!t,templatesData:w})):Object(r.createElement)(Ne,{title:Object(_.__)("Templates Cloud is a PRO Feature"),description:Object(_.__)("Unlock the Templates Cloud features and save your pages or posts in the cloud.")})})),Je=[Object(_.__)("Business","templates-patterns-collection"),Object(_.__)("Ecommerce","templates-patterns-collection"),Object(_.__)("Fashion","templates-patterns-collection"),Object(_.__)("Blogging","templates-patterns-collection"),Object(_.__)("Photography","templates-patterns-collection")],Ke={all:Object(_.__)("All Categories"),free:Object(_.__)("Free"),business:Object(_.__)("Business"),portfolio:Object(_.__)("Portfolio"),woocommerce:Object(_.__)("WooCommerce"),blog:Object(_.__)("Blog"),personal:Object(_.__)("Personal"),other:Object(_.__)("Other")},Ze={gutenberg:{icon:"gutenberg.jpg",niceName:"Gutenberg"},elementor:{icon:"elementor.jpg",niceName:"Elementor"}},Xe=(Object(r.createElement)(r.Fragment,null,"Beaver ",Object(r.createElement)("span",{className:"long-name"},"Builder")),Object(r.createElement)(r.Fragment,null,"Thrive ",Object(r.createElement)("span",{className:"long-name"},"Architect")),function(e){var t=e.currentStep,n=e.progress,a=e.willDo,c={cleanup:{label:Object(_.__)("Cleanup previous Import","templates-patterns-collection"),status:n.cleanup,willDo:a.cleanup},theme_install:{label:Object(_.__)("Installing and Activating the Theme","templates-patterns-collection"),status:n.theme_install,willDo:a.theme_install},plugins:{label:Object(_.__)("Installing Plugins","templates-patterns-collection"),status:n.plugins,willDo:!0},content:{label:Object(_.__)("Importing Content","templates-patterns-collection"),status:n.content,willDo:a.content},customizer:{label:Object(_.__)("Importing Customizer Settings","templates-patterns-collection"),status:n.customizer,willDo:a.customizer},widgets:{label:Object(_.__)("Importing Widgets","templates-patterns-collection"),status:n.widgets,willDo:a.widgets}};return Object(r.createElement)("ul",{className:"stepper"},Object.keys(c).map((function(e,n){var a=c[e],o=a.label,i=a.status;if(!a.willDo)return null;var s=O()(["icon",{loading:t===e,warning:t===e,success:"done"===i,error:"error"===i,skip:"skip"===i}]),l="clock";return t===e&&(l="update"),"done"===i&&(l="yes"),"error"===i&&(l="no-alt"),Object(r.createElement)("li",{key:n},Object(r.createElement)("span",{className:s},Object(r.createElement)(E.Dashicon,{icon:l,className:t===e?"loading":""})),Object(r.createElement)("span",null,o))})))}),et=n(19),tt=n.n(et),nt=function(e){return tt()(e),Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"modal-body"},Object(r.createElement)("div",{className:"header"},Object(r.createElement)("span",{className:"title is-loading",style:{height:35,marginBottom:20}}),Object(r.createElement)("p",{className:"description is-loading",style:{height:20}}),Object(r.createElement)("p",{className:"description is-loading",style:{height:20,marginBottom:20}})),Object(r.createElement)("div",{className:"well is-loading"},Object(r.createElement)("span",{className:"title is-loading",style:{height:20}}),Object(r.createElement)("ol",null,Object(r.createElement)("li",null),Object(r.createElement)("li",null),Object(r.createElement)("li",null))),Object(r.createElement)("div",{className:"modal-toggles components-panel"},[1,2].map((function(e){return Object(r.createElement)("div",{key:e,className:"components-panel__body options general is-opened"},Object(r.createElement)("span",{className:"title is-loading"}),Object(r.createElement)("ul",null,[1,2,3].map((function(e){return Object(r.createElement)("li",{className:"option-row",key:e},Object(r.createElement)("div",{className:"mock-icon is-loading"}),Object(r.createElement)("span",{className:"is-loading"}),Object(r.createElement)("div",{className:"toggle is-loading"}))}))))})))),Object(r.createElement)("div",{className:"modal-footer"},Object(r.createElement)("span",{className:"link is-loading"}),Object(r.createElement)(E.Button,{isPrimary:!0,className:"import is-loading"})))},rt=Object(r.createElement)(W.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(W.Path,{d:"M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"})),at=function(e){var t=e.children,n=e.className,a=O()([n,"tiob-tooltip-wrap"]);return Object(r.createElement)("div",{className:a},Object(r.createElement)(E.Button,{onClick:function(e){e.preventDefault()},className:"tiob-tooltip-toggle",icon:rt,isLink:!0,isSmall:!0}),Object(r.createElement)("div",{className:"tiob-tooltip-content"},t))};function ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ot(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ct(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ct(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var it=Object(v.compose)(Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getCurrentSite,a=t.getThemeAction;return{editor:n(),siteData:r(),themeData:a()||!1}})),Object(h.withDispatch)((function(e,t){var n=t.siteData,r=e("neve-onboarding"),a=r.setTemplateModal,c=r.setSingleTemplateImport,o=r.setImportModalStatus,i=r.setThemeAction;return{setModal:function(e){return o(e)},setThemeAction:function(e){return i(e)},runTemplateImport:function(){c(n.slug),a(!0),o(!1)}}})))((function(e){var t=e.setModal,n=e.setThemeAction,a=e.editor,o=e.siteData,i=e.themeData,s=e.runTemplateImport,l=Object(r.useState)({content:!0,customizer:!0,widgets:!0,cleanup:!1,theme_install:!1!==i}),u=y()(l,2),m=u[0],p=u[1],d=Object(r.useState)(!1),b=y()(d,2),f=b[0],h=b[1],g=Object(r.useState)(!1),v=y()(g,2),j=v[0],w=v[1],S=Object(r.useState)(!1),k=y()(S,2),C=k[0],x=k[1],P=Object(r.useState)(!1),M=y()(P,2),D=M[0],A=M[1],z=Object(r.useState)(!1),V=y()(z,2),$=V[0],H=V[1],G=Object(r.useState)(!1),W=y()(G,2),q=W[0],Q=W[1],Y=Object(r.useState)(null),J=y()(Y,2),K=J[0],Z=J[1],X=Object(r.useState)(null),ee=y()(X,2),te=ee[0],ne=ee[1],re=Object(r.useState)(!1),ae=y()(re,2),ce=ae[0],oe=ae[1],ie=Object(r.useState)(null),se=y()(ie,2),le=se[0],ue=se[1],me=Object(r.useState)(null),pe=y()(me,2),de=pe[0],be=pe[1],fe=Object(r.useState)(null),he=y()(fe,2),ge=he[0],Oe=he[1],ve=Object(r.useState)(!0),je=y()(ve,2),ye=je[0],Ee=je[1],_e=Object(r.useState)(!0),we=y()(_e,2),Se=we[0],ke=we[1],Ce=Object(r.useState)(!0),Ne=y()(Ce,2),Te=Ne[0],xe=Ne[1],Pe=Object(r.useState)(!0),Me=y()(Pe,2),De=Me[0],Ie=Me[1],Le=tiobDash,Ae=Le.license,Be=Le.cleanupAllowed,Re=Object(r.useState)(Be),Fe=y()(Re,2),Ue=Fe[0],ze=Fe[1];function Ve(){R(i,(function(){console.log("[D] Theme Activate."),h("done"),n(!1),He()}),(function(){Ye(Object(_.__)("Could not activate theme.","templates-patterns-collection"),"theme_install")}))}function $e(){return i?"install"===i.action?(ne("theme_install"),console.log("[P] Theme Install."),B("neve",(function(){n(ot(ot({},i),{},{action:"activate"})),console.log("[D] Theme Install."),Ve()}),(function(e){n(ot(ot({},i),{},{action:"activate"})),Ye(e.errorMessage||Object(_.__)("Could not install theme.","templates-patterns-collection"),"theme_install")})),!1):(ne("theme_install"),console.log("[P] Theme Activate."),void Ve()):(console.log("[S] Theme."),He(),!1)}function He(){if(!le)return console.log("[S] Plugins."),Ge(),!1;ne("plugins"),console.log("[P] Plugins."),L(le).then((function(e){if(!e.success)return Ye(e,"plugins"),!1;console.log("[D] Plugins."),x("done"),Ge()})).catch((function(e){return Ye(e,"plugins")}))}function Ge(){if(!m.content)return console.log("[S] Content."),We(),!1;var e;ne("content"),console.log("[P] Content."),(e={contentFile:ge.content_file,source:"remote",frontPage:ge.front_page,shopPages:ge.shop_pages,demoSlug:ge.slug,editor:a},N(I.root+"/import_content",e)).then((function(e){if(!e.success)return Ye(e,"content"),!1;console.log("[D] Content."),e.frontpage_id&&Z(e.frontpage_id),A("done"),We()})).catch((function(e){return Ye(e,"content")}))}function We(){if(!m.customizer)return console.log("[S] Customizer."),qe(),!1;var e;ne("customizer"),console.log("[P] Customizer."),(e={source_url:ge.url,theme_mods:ge.theme_mods,wp_options:ge.wp_options},N(I.root+"/import_theme_mods",e)).then((function(e){if(!e.success)return Ye(e,"customizer"),!1;console.log("[D] Customizer."),H("done"),qe()})).catch((function(e){return Ye(e,"customizer")}))}function qe(){if(!m.widgets)return console.log("[S] Widgets."),Qe(),!1;var e;ne("widgets"),console.log("[P] Widgets."),(e=ge.widgets,N(I.root+"/import_widgets",e)).then((function(e){if(!e.success)return Ye(e,"widgets"),!1;console.log("[D] Widgets."),Q("done"),Qe()})).catch((function(e){return Ye(e,"widgets")}))}function Qe(){ne("done"),ze("yes"),tiobDash.cleanupAllowed="yes",oe(!1)}function Ye(e,t){oe(!1),ne(null),"cleanup"===t&&x("skip"),"plugins"===t&&A("skip"),["content","plugins"].includes(t)&&H("skip"),["content","plugins","customizer"].includes(t)&&Q("skip");var n={cleanup:Object(_.__)("Something went wrong while cleaning the previous import.","templates-patterns-collection"),plugins:Object(_.__)("Something went wrong while installing the necessary plugins.","templates-patterns-collection"),content:Object(_.__)("Something went wrong while importing the website content.","templates-patterns-collection"),customizer:Object(_.__)("Something went wrong while updating the customizer settings.","templates-patterns-collection"),widgets:Object(_.__)("Something went wrong while importing the widgets.","templates-patterns-collection")};switch(t){case"cleanup":w("error");break;case"plugins":x("error");break;case"content":A("error");break;case"customizer":H("error");break;case"widgets":Q("error")}be(e.data?{message:n[t],code:e.data}:{message:n[t]})}Object(r.useEffect)((function(){var e=o.remote_url||o.url,t=new URL("".concat(function(e){return e.replace(/\/$/,"")}(e)+"/","wp-json/ti-demo-data/data"));t.searchParams.append("license",Ae?Ae.key:"free"),T(t,!0,!1).then((function(e){e.ok||(be({message:Object(_.__)("Something went wrong while loading the site data. Please refresh the page and try again.","templates-patterns-collection"),code:"ti__ob_failed_fetch_response"}),Ee(!1)),e.json().then((function(e){Oe(ot(ot({},e),o));var t=ot({},e.mandatory_plugins||{}),n=ot({},e.recommended_plugins||{}),r=e.default_off_recommended_plugins||[];Object.keys(t).forEach((function(e){t[e]=!0})),Object.keys(n).forEach((function(e){n[e]=!r.includes(e)})),ue(ot(ot({},n),t)),Ee(!1)}))})).catch((function(){be({message:Object(_.__)("Something went wrong while loading the site data. Please refresh the page and try again.","templates-patterns-collection"),code:"ti__ob_failed_fetch_catch"}),Ee(!1)}))}),[]);var Je=function(){if(ce)return!1;t(!1)},Ke=!o.external_plugins||o.external_plugins.every((function(e){return!0===e.active})),Ze=Object.keys(m).every((function(e){return!1===m[e]})),et={elementor:"".concat(tiobDash.onboarding.homeUrl,"/wp-admin/post.php?post=").concat(K,"&action=elementor"),brizy:"".concat(tiobDash.onboarding.homeUrl,"/?brizy-edit"),"beaver builder":"".concat(tiobDash.onboarding.homeUrl,"/?fl_builder"),"thrive architect":"".concat(tiobDash.onboarding.homeUrl,"/wp-admin/post.php?post=").concat(K,"&action=architect&tve=true"),"divi builder":"".concat(tiobDash.onboarding.homeUrl,"/?et_fb=1&PageSpeed=off"),gutenberg:"".concat(tiobDash.onboarding.homeUrl,"/wp-admin/post.php?post=").concat(K,"&action=edit")}[a];return Object(r.createElement)(E.Modal,{className:O()(["ob-import-modal",{fetching:ye}]),onRequestClose:Je,shouldCloseOnClickOutside:!ce&&!ye,isDismissible:!ce&&!ye},ye?Object(r.createElement)(nt,null):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"modal-body"},ce||"done"===te||de?Object(r.createElement)(r.Fragment,null,de&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(U,{message:de.message||null,code:de.code||null}),Object(r.createElement)("hr",null)),null!==te&&Object(r.createElement)(Xe,{progress:{theme_install:f,cleanup:j,plugins:C,content:D,customizer:$,widgets:q},currentStep:te,willDo:m}),"done"===te&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("hr",null),Object(r.createElement)("p",{className:"import-result"},Object(_.__)("Content was successfully imported. Enjoy your new site!","templates-patterns-collection")),Object(r.createElement)("hr",null))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)((function(){return Object(r.createElement)("div",{className:"header"},Object(r.createElement)("h1",null,Object(_.sprintf)(
|
10 |
/* translators: name of starter site */
|
11 |
+
Object(_.__)("Import %s as a complete site","templates-patterns-collection"),ge.title)),Object(r.createElement)("p",{className:"description"},Object(_.__)("Import the entire site including customizer options, pages, content and plugins.","templates-patterns-collection")))}),null),Object(r.createElement)((function(){return Object(r.createElement)(F,{data:ge,externalInstalled:Ke})}),null),Object(r.createElement)(E.Panel,{className:"modal-toggles"},!1!==i&&Object(r.createElement)((function(){var e=O()("option-row","active"),t={icon:"admin-appearance",title:Object(_.__)("Neve","templates-patterns-collection"),tooltip:Object(_.__)("In order to import the starter site, Neve theme has to be installed and activated.","templates-patterns-collection")},n=t.icon,a=t.title,c=t.tooltip;return Object(r.createElement)(E.PanelBody,{onToggle:function(){Ie(!De)},opened:De,className:"options general",title:Object(_.__)("Install required theme","templates-patterns-collection")},Object(r.createElement)(E.PanelRow,{className:e},Object(r.createElement)(E.Icon,{icon:n}),Object(r.createElement)("span",null,a),c&&Object(r.createElement)(at,null,c)))}),null),Object(r.createElement)((function(){var e={content:{title:Object(_.__)("Content","templates-patterns-collection"),icon:"admin-post",tooltip:Object(_.__)("We recommend you backup your website content before attempting a full site import.","templates-patterns-collection")},customizer:{title:Object(_.__)("Customizer","templates-patterns-collection"),icon:"admin-customizer"},widgets:{title:Object(_.__)("Widgets","templates-patterns-collection"),icon:"admin-generic",tooltip:Object(_.__)("Widgets will be moved to the Inactive Widgets sidebar and can be retrieved from there.","templates-patterns-collection")}};return"yes"===Ue&&(e=ot({cleanup:{icon:"trash",title:Object(_.__)("Cleanup previous import","templates-patterns-collection"),tooltip:Object(_.__)("This will remove any plugins, images, customizer options, widgets posts and pages added by the previous demo import","templates-patterns-collection")}},e)),Object(r.createElement)(E.PanelBody,{onToggle:function(){xe(!Te)},opened:Te,className:"options general",title:Object(_.__)("Import settings","templates-patterns-collection")},Object.keys(e).map((function(t,n){var a=O()("option-row",{active:m[t]}),o=e[t],i=o.icon,s=o.title,l=o.tooltip;return Object(r.createElement)(E.PanelRow,{className:a,key:n},Object(r.createElement)(E.Icon,{icon:i}),Object(r.createElement)("span",null,s),l&&Object(r.createElement)(at,null,l),"theme_install"!==t&&Object(r.createElement)("div",{className:"toggle-wrapper"},Object(r.createElement)(E.ToggleControl,{checked:m[t],onChange:function(){p(ot(ot({},m),{},c()({},t,!m[t])))}})))})))}),null),Object(r.createElement)((function(){if(ye)return null;var e=ot(ot({},ge.recommended_plugins||{}),ge.mandatory_plugins||{});return Object(r.createElement)(E.PanelBody,{onToggle:function(){ke(!Se)},opened:Se,className:"options plugins",title:Object(_.__)("Plugins","templates-patterns-collection")},Object.keys(e).map((function(t,n){var a=O()("option-row",{active:le[t]});return Object(r.createElement)(E.PanelRow,{className:a,key:n},Object(r.createElement)(E.Icon,{icon:"admin-plugins"}),Object(r.createElement)("span",{dangerouslySetInnerHTML:{__html:e[t]}}),t in ge.recommended_plugins&&Object(r.createElement)("div",{className:"toggle-wrapper"},Object(r.createElement)(E.ToggleControl,{checked:le[t],onChange:function(){ue(ot(ot({},le),{},c()({},t,!le[t])))}})))})))}),null)))),!ce&&Object(r.createElement)("div",{className:"modal-footer"},"done"!==te?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(E.Button,{className:"import-templates",isLink:!0,onClick:s},Object(_.__)("I want to import just the templates","templates-patterns-collection")),!de&&Object(r.createElement)(E.Button,{className:"import",isPrimary:!0,disabled:Ze||!Ke,onClick:function(){oe(!0),function(){if(console.clear(),!m.cleanup)return console.log("[S] Cleanup."),$e(),!1;var e;ne("cleanup"),console.log("[P] Cleanup."),(e={},N(I.root+"/cleanup",e)).then((function(e){if(!e.success)return Ye(e,"cleanup"),!1;console.log("[D] Cleanup."),w("done"),$e()})).catch((function(e){return Ye(e,"cleanup")}))}()}},Object(_.__)("Import entire site","templates-patterns-collection"))):Object(r.createElement)("div",{className:"import-done-actions"},Object(r.createElement)(E.Button,{isLink:!0,className:"close",onClick:Je},Object(_.__)("Back to Sites Library","templates-patterns-collection")),Object(r.createElement)(E.Button,{isSecondary:!0,href:tiobDash.onboarding.homeUrl},Object(_.__)("View Website","templates-patterns-collection")),Object(r.createElement)(E.Button,{isPrimary:!0,className:"import",href:et},Object(_.__)("Add your own content","templates-patterns-collection"))))))})),st=Object(v.compose)(Object(h.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setSingleTemplateImport,r=t.setImportModalStatus;return{cancel:function(){n(null)},setModal:function(e){return r(e)},setTemplateModal:t.setTemplateModal}})),Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getTemplateModal,r=t.getCurrentSite,a=t.getCurrentEditor;return{templateModal:n(),site:r(),editor:a()}})))((function(e){var t=e.slug,n=e.cancel,a=e.setModal,c=e.site,o=e.editor,i=e.setTemplateModal,s=e.templateModal,l=Object(r.useState)([]),u=y()(l,2),m=u[0],p=u[1],d=Object(r.useState)(!0),b=y()(d,2),f=b[0],h=b[1],g=Object(r.useState)(""),O=y()(g,2),v=O[0],j=O[1],w=Object(r.useState)([]),S=y()(w,2),k=S[0],C=S[1],N=c.title,T=c.upsell,x=c.utmOutboundLink;Object(r.useEffect)((function(){P()}),[]);var P=function(){se(!0,{per_page:100,template_site_slug:t,premade:!0,type:o}).then((function(e){p(e.templates||[]),h(!1)}))},M=function(e){j(e)},D=function(e){C(e),i(!0)},I=function(e){D([e])},L=function(e){e.preventDefault(),a(!0)},A=m.findIndex((function(e){return e.link===v})),B=m.find((function(e){return e.link===v}));return Object(r.createElement)("div",{className:"single-templates-wrapper"},Object(r.createElement)("div",{className:"top"},Object(r.createElement)("div",{className:"breadcrumb"},Object(r.createElement)(E.Button,{isTertiary:!0,onClick:n},Object(r.createElement)(E.Icon,{icon:Y}),Object(_.__)("Back to Starter Sites"))),Object(r.createElement)("div",{className:"header"},Object(r.createElement)("div",{className:"text"},Object(r.createElement)("h1",null,N||"",T&&Object(r.createElement)("span",{className:"pro-badge"},Object(r.createElement)(E.Icon,{icon:"lock"}),Object(r.createElement)("span",null,Object(_.__)("Premium","templates-patterns-collection")))),Object(r.createElement)("p",{className:"description"},Object(_.__)("You can import individual pages or bulk-import all of them."))),Object(r.createElement)("div",{className:"actions"},!T&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(E.Button,{isSecondary:!0,onClick:L},Object(_.__)("Import Starter Site")),Object(r.createElement)(E.Button,{isPrimary:!0,disabled:m.length<1,onClick:function(e){e.preventDefault(),D(m)}},Object(_.__)("Import All Pages"))),T&&Object(r.createElement)(E.Button,{href:x||tiobDash.upgradeURL,isSecondary:!0},Object(_.__)("Upgrade"))))),Object(r.createElement)((function(){return f?Object(r.createElement)(E.Spinner,null):m.length<1?Object(_.__)("No templates for this starter site."):Object(r.createElement)("div",{className:"cloud-items is-grid"},Object(r.createElement)("div",{className:"table"},m.map((function(e){return Object(r.createElement)(je,{upsell:T,onPreview:M,userTemplate:!1,key:e.template_id,item:e,loadTemplates:P,onImport:function(){return I(e)},grid:!0})}))))}),null),v&&Object(r.createElement)(Me,{heading:B.template_name||null,previewUrl:v,leftButtons:Object(r.createElement)(r.Fragment,null,Object(r.createElement)(E.Button,{icon:q,onClick:function(){return j("")},label:Object(_.__)("Close","templates-patterns-collection")}),m.length>1&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(E.Button,{icon:Object(_.isRTL)()?Q:Y,onClick:function(){var e=A-1;0===A&&(e=m.length-1),j(m[e].link)}}),Object(r.createElement)(E.Button,{icon:Object(_.isRTL)()?Y:Q,onClick:function(){var e=A+1;A===m.length-1&&(e=0),j(m[e].link)}}))),rightButtons:Object(r.createElement)(r.Fragment,null,!T&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(E.Button,{isSecondary:!0,onClick:L},Object(_.__)("Import Starter Site")),Object(r.createElement)(E.Button,{isPrimary:!0,disabled:m.length<1,onClick:function(){return I(B)}},Object(_.__)("Import Page"))),T&&Object(r.createElement)(E.Button,{href:x||tiobDash.upgradeURL,isSecondary:!0},Object(_.__)("Upgrade")))}),s&&k&&!f&&k.length>0&&Object(r.createElement)(Ge,{templatesData:k}))})),lt=function(e){var t=e.setCurrentTab,n=e.currentTab,a=e.isFetching,c={starterSites:Object(_.__)("Starter Sites","templates-patterns-collection"),pageTemplates:Object(_.__)("Page Templates","templates-patterns-collection"),library:Object(_.__)("My Library","templates-patterns-collection")},o=Object(r.useState)(!1),i=y()(o,2),s=i[0],l=i[1],u=function(){var e=function(e){var t=window.location.hash;return"string"!=typeof window.location.hash?null:(t=t.substring(1),Object.keys(e).includes(t)?t:null)}(c);if(null!==e){var n=document.getElementById("menu-appearance"),r=n.querySelector('a[href="themes.php?page=tiob-starter-sites#library"]'),a=n.querySelector('a[href="themes.php?page=tiob-starter-sites"]');if(r&&a){var o=r.parentElement,i=a.parentElement;n.querySelector(".current").classList.remove("current"),o.classList.remove("current"),"library"===e?o.classList.add("current"):i.classList.add("current")}t(e)}};return Object(r.useEffect)((function(){u(),window.addEventListener("hashchange",u)}),[]),Object(r.createElement)("div",{className:"header-nav"},Object.keys(c).map((function(e){return Object(r.createElement)(E.Button,{href:"#"+e,key:e,isTertiary:!0,isPressed:e===n,onClick:function(n){var r;n.preventDefault(),t(e),r=e,window.location.hash=r}},c[e])})),"starterSites"!==n&&Object(r.createElement)(E.Button,{icon:de,onClick:function(){l(!0),localStorage.setItem("tpcCacheBuster",ce());var e=n;t(null),setTimeout((function(){t(e),l(!1)}),100)},label:Object(_.__)("Re-sync Library"),className:O()("is-sync",{"is-loading":s}),disabled:a||s,"data-content":Object(_.__)("Sync")}))},ut=Object(v.compose)(Object(h.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setOnboardingState;return{cancelOnboarding:function(){n(!1)},setCurrentTab:t.setCurrentTab,setFetching:t.setFetching}})),Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getOnboardingStatus,r=t.getCurrentTab,a=t.getFetching;return{isOnboarding:n(),currentTab:r(),isFetching:a()}})))((function(e){var t=e.isOnboarding,n=e.cancelOnboarding,a=e.setCurrentTab,c=e.currentTab;return Object(r.createElement)("div",{className:"ob-head"},!t&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"header-container"},Object(r.createElement)("h2",null,!tiobDash.brandedTheme&&Object(r.createElement)(E.Icon,{icon:We}),Object(r.createElement)("span",null,Object(_.__)("Templates Cloud","templates-patterns-collection"))),Object(r.createElement)(lt,{setCurrentTab:a,currentTab:c}))),t&&Object(r.createElement)(E.Button,{className:"close-onboarding",isLink:!0,icon:"no-alt",onClick:n}))})),mt=n(20),pt=n.n(mt),dt=Object(v.compose)(Object(h.withDispatch)((function(e,t){var n=t.data,r=n.slug,a=e("neve-onboarding"),c=a.setCurrentSite,o=a.setPreviewStatus,i=a.setImportModalStatus,s=a.setSingleTemplateImport;return{setSite:function(){return c(n)},setPreview:function(e){return o(e)},setModal:function(e){return i(e)},setImportingPages:function(){return s(r)}}})))((function(e){var t=e.data,n=e.setSite,a=e.setPreview,c=e.setModal,o=e.setImportingPages,i=t.upsell,s=t.screenshot,l=t.title,u=t.has_templates,m=t.isNew,p=Object(r.useState)(""),d=y()(p,2),b=d[0],f=d[1],h=O()("card starter-site-card",{"has-templates":u});return Object(r.createElement)("div",{onMouseEnter:function(){f("visible")},onMouseLeave:function(){f("")},className:h},m&&Object(r.createElement)("span",{className:"new-badge"},Object(_.__)("New","templates-patterns-collection").toUpperCase()),Object(r.createElement)("div",{className:"top"},Object(r.createElement)("div",{className:"actions "+b},Object(r.createElement)(E.Button,{isSecondary:!0,onClick:function(e){e.preventDefault(),n(),a(!0)}},Object(_.__)("Preview","templates-patterns-collection")),!i&&Object(r.createElement)(E.Button,{isPrimary:!0,className:"import",onClick:function(e){e.preventDefault(),n(),c(!0)}},Object(_.__)("Import","templates-patterns-collection")),!u&&i&&Object(r.createElement)(E.Button,{isLink:!0,className:"templates",target:"_blank",href:"https://themeisle.com/themes/neve/upgrade/?utm_medium=nevedashboard&utm_source=wpadmin&utm_campaign=templatecloud&utm_content=neve"},Object(_.__)("Unlock access with Business plan","templates-patterns-collection")),u&&Object(r.createElement)(E.Button,{isLink:!0,className:"templates",onClick:function(e){e.preventDefault(),n(),o()}},Object(_.__)("View Pages","templates-patterns-collection"))),s&&Object(r.createElement)("div",{className:"image",style:{backgroundImage:'url("'.concat(s,'")')}})),Object(r.createElement)("div",{className:"bottom"},Object(r.createElement)("p",{className:"title"},l),i&&Object(r.createElement)("span",{className:"pro-badge"},Object(r.createElement)(E.Dashicon,{icon:"lock",size:15}),Object(r.createElement)("span",null,Object(_.__)("Premium","templates-patterns-collection")))))})),bt=Object(v.compose)(Object(h.withSelect)((function(e){return{siteData:(0,e("neve-onboarding").getCurrentSite)()}})),Object(h.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setCurrentSite,r=t.setPreviewStatus,a=t.setImportModalStatus;return{setSite:function(e){return n(e)},setPreview:function(e){return r(e)},setModal:function(e){return a(e)}}})))((function(e){var t=e.next,n=e.prev,a=e.siteData,c=e.setSite,o=e.setPreview,i=e.setModal;return Object(r.createElement)("div",{className:"ob-preview"},Object(r.createElement)("div",{className:"preview"},Object(r.createElement)("iframe",{src:a.url,frameBorder:"0"}),Object(r.createElement)("div",{className:"loading"},Object(r.createElement)(E.Dashicon,{icon:"update",size:50}))),Object(r.createElement)("div",{className:"bottom-bar"},Object(r.createElement)("div",{className:"navigator"},Object(r.createElement)(E.Button,{onClick:function(e){e.preventDefault(),o(!1),c(null)},className:"close",label:Object(_.__)("Close","templates-patterns-collection"),icon:q}),n&&Object(r.createElement)(E.Button,{onClick:function(e){e.preventDefault(),c(n)},className:"prev",label:Object(_.__)("Previous","templates-patterns-collection"),icon:Object(_.isRTL)()?Q:Y}),t&&Object(r.createElement)(E.Button,{onClick:function(e){e.preventDefault(),c(t)},className:"next",label:Object(_.__)("Next","templates-patterns-collection"),icon:Object(_.isRTL)()?Y:Q})),Object(r.createElement)("div",{className:"actions"},a.upsell?Object(r.createElement)(E.Button,{className:"upgrade",isPrimary:!0,href:a.utmOutboundLink||tiobDash.upgradeURL},Object(_.__)("Upgrade and Import","templates-patterns-collection")):Object(r.createElement)(E.Button,{className:"import",isPrimary:!0,onClick:function(e){e.preventDefault(),i(!0)}},Object(_.__)("Import","templates-patterns-collection")))))})),ft=function(e){var t=e.editor,n=e.data,a=n.text,c=n.cta,o=n.url;return Object(r.createElement)((function(){return Object(r.createElement)("div",{className:"notification"},Object(r.createElement)("p",null,a),o&&c&&Object(r.createElement)(E.Button,{target:"_blank",isSecondary:!0,href:o.replace("<builder_name>",t).replace(" ","")},c))}),null)},ht=Object(v.compose)(Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentCategory,r=t.getCurrentEditor,a=t.getSearchQuery;return{editor:r(),category:n(),query:a()}})),Object(h.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setCurrentCategory,r=t.setCurrentEditor,a=t.setSearchQuery;return{setCurrentCategory:function(e){return n(e)},setCurrentEditor:function(e){return r(e)},onSearch:function(e){return a(e)}}})))((function(e){var t=e.count,n=(e.categories,e.editors),a=e.onSearch,c=(e.category,e.editor),o=e.onlyProSites,i=(e.setCurrentCategory,e.setCurrentEditor),s=e.query,l=e.className,u=e.showCount,m=void 0!==u&&u,p=Object(r.useState)(!1),d=y()(p,2),b=d[0],f=d[1],h=function(){return f(!b)},g=O()(l,"header-form");return Object(r.createElement)("div",{className:g},Object(r.createElement)("div",{className:"search"},Object(r.createElement)("img",{src:tiobDash.assets+"/img/search.svg",alt:Object(_.__)("Search Icon")}),Object(r.createElement)("input",{onChange:function(e){a(e.target.value)},type:"search",value:s,placeholder:Object(_.__)("Search for a starter site","templates-patterns-collection")+"..."}),!1,Object(r.createElement)((function(){return Object(r.createElement)("div",{className:"ob-dropdown categories-selector"},Object(r.createElement)(E.Button,{onClick:h,className:"select ob-dropdown"},Object(r.createElement)("span",{className:"label-editor"},Object(r.createElement)("span",{className:"icon-wrap"},Object(r.createElement)("img",{className:"editor-icon",src:tiobDash.assets+"img/"+n[c].icon,alt:Object(_.__)("Builder Logo","templates-patterns-collection")})),o.includes(c)&&Object(r.createElement)(E.Dashicon,{icon:"lock",style:{fontSize:"16px",width:"16px",height:"16px",marginLeft:"0"}}),n[c].niceName),Object(r.createElement)(E.Dashicon,{size:14,icon:b?"arrow-up-alt2":"arrow-down-alt2"}),b&&Object(r.createElement)(E.Popover,{position:"bottom center",onClose:h,noArrow:!0},b&&Object(r.createElement)("ul",{className:"options"},Object.keys(n).map((function(e,a){return e===c?null:Object(r.createElement)("li",{key:a},Object(r.createElement)("a",{href:"#",onClick:function(t){t.preventDefault(),i(e),f(!1)}},Object(r.createElement)("span",{className:"label-editor"},Object(r.createElement)("span",{className:"icon-wrap"},Object(r.createElement)("img",{className:"editor-icon",src:tiobDash.assets+"img/"+n[e].icon,alt:Object(_.__)("Builder Logo","templates-patterns-collection")})),o.includes(e)&&Object(r.createElement)(E.Dashicon,{icon:"lock",style:{fontSize:"16px",width:"16px",height:"16px"}}),n[e].niceName),m&&Object(r.createElement)("span",{className:"count"},t[e])))}))))))}),null)))})),gt=(Object(v.compose)(Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getSites;return{editor:n(),sites:r().sites}})),Object(h.withDispatch)((function(e){var t=e("neve-onboarding").setCurrentEditor;return{setCurrentEditor:function(e){return t(e)}}})))((function(e){var t=e.EDITOR_MAP,n=e.count,a=e.editor,c=e.setCurrentEditor,o=e.sites,i=e.isSmall,s=Object(r.useState)(!1),l=y()(s,2),u=l[0],m=l[1],p=Object.keys(o),d=function(){return m(!u)},b=O()(["ob-dropdown","editor-selector",{small:i}]);return Object(r.createElement)("div",{className:b},Object(r.createElement)(E.Button,{onClick:d,className:"select ob-dropdown"},Object(r.createElement)("img",{className:"editor-icon",src:tiobDash.assets+"img/"+t[a].icon,alt:Object(_.__)("Builder Logo","templates-patterns-collection")}),!i&&Object(r.createElement)("span",null,t[a].niceName),Object(r.createElement)("span",{className:"count"},n[a]),Object(r.createElement)(E.Dashicon,{size:14,icon:u?"arrow-up-alt2":"arrow-down-alt2"}),u&&Object(r.createElement)(E.Popover,{position:"bottom center",onClose:d,noArrow:!0},u&&Object(r.createElement)("ul",{className:"options"},p.map((function(e,o){return e===a?null:Object(r.createElement)("li",{key:o},Object(r.createElement)("a",{href:"#",onClick:function(t){t.preventDefault(),c(e),m(!1)}},Object(r.createElement)("img",{className:"editor-icon",src:tiobDash.assets+"img/"+t[e].icon,alt:Object(_.__)("Builder Logo","templates-patterns-collection")}),Object(r.createElement)("span",null,t[e].niceName),Object(r.createElement)("span",{className:"count"},n[e])))}))))))})),Object(v.compose)(Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getSites;return{editor:n(),sites:r().sites}})),Object(h.withDispatch)((function(e){var t=e("neve-onboarding").setCurrentEditor;return{setCurrentEditor:function(e){return t(e)}}})))((function(e){var t=e.EDITOR_MAP,n=e.count,a=e.onlyProSites,c=e.editor,o=e.setCurrentEditor,i=e.sites,s=Object.keys(i);return Object(r.createElement)("div",{className:"editor-tabs"},s.map((function(e,i){var s=O()(["tab",e,{active:e===c}]);return Object(r.createElement)("a",{key:i,href:"#",className:s,onClick:function(t){t.preventDefault(),o(e)}},Object(r.createElement)("span",{className:"icon-wrap"},Object(r.createElement)("img",{className:"editor-icon",src:tiobDash.assets+"img/"+t[e].icon,alt:Object(_.__)("Builder Logo","templates-patterns-collection")})),Object(r.createElement)("span",{className:"editor"},a.includes(e)&&Object(r.createElement)(E.Dashicon,{icon:"lock",style:{fontSize:"16px",width:"16px",height:"16px"}}),t[e].niceName),Object(r.createElement)("span",{className:"count"},n[e]))})))})),Object(v.compose)(Object(h.withSelect)((function(e){return{category:(0,e("neve-onboarding").getCurrentCategory)()}})),Object(h.withDispatch)((function(e){var t=e("neve-onboarding").setCurrentCategory;return{setCurrentCategory:function(e){return t(e)}}})))((function(e){var t=e.categories,n=e.count,a=e.category,c=e.setCurrentCategory,o=e.showCount,i=void 0!==o&&o;return Object(r.createElement)("div",{className:"editor-tabs"},Object.keys(t).map((function(e,o){if(1>n[e])return null;if(tiobDash&&"1"===tiobDash.isValidLicense&&"free"===e)return null;var s=O()(["tab",e,{active:e===a}]);return Object(r.createElement)("a",{key:o,href:"#",className:s,onClick:function(t){t.preventDefault(),c(e)}},Object(r.createElement)("span",{className:"editor"},t[e]),i&&Object(r.createElement)("span",{className:"count"},n[e]))})))}))),Ot=Object(v.compose)(Object(h.withSelect)((function(e){return{category:(0,e("neve-onboarding").getCurrentCategory)()}})),Object(h.withDispatch)((function(e){var t=e("neve-onboarding").setCurrentCategory;return{setCurrentCategory:function(e){return t(e)}}})))((function(e){var t=e.categories,n=e.count,a=e.category,c=e.setCurrentCategory,o=e.showCount,i=void 0!==o&&o,s=Object(r.useState)(!1),l=y()(s,2),u=l[0],m=l[1],p=function(){return m(!u)},d=O()(["ob-dropdown","editor-selector",{small:!0}]);return Object(r.createElement)("div",{className:d},Object(r.createElement)(E.Button,{onClick:p,className:"select ob-dropdown"},Object(r.createElement)("span",null,t[a]),Object(r.createElement)("span",{className:"count"},i?n[a]:""),Object(r.createElement)(E.Dashicon,{size:14,icon:u?"arrow-up-alt2":"arrow-down-alt2"}),u&&Object(r.createElement)(E.Popover,{position:"bottom center",onClose:p,noArrow:!0},u&&Object(r.createElement)("ul",{className:"options"},Object.keys(t).map((function(e,o){return e===a||tiobDash&&"1"===tiobDash.isValidLicense&&"free"===e||1>n[e]?null:Object(r.createElement)("li",{key:o},Object(r.createElement)("a",{href:"#",onClick:function(t){t.preventDefault(),c(e),m(!1)}},Object(r.createElement)("span",null,t[e]),i&&Object(r.createElement)("span",{className:"count"},n[e])))}))))))})),vt=Object(v.compose)(Object(h.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setOnboardingState,r=t.setCurrentCategory;return{cancelOnboarding:function(){n(!1)},resetCategory:function(){r("all")},setCurrentTab:t.setCurrentTab}})),Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getCurrentCategory,a=t.getOnboardingStatus,c=t.getSites;return{editor:n(),category:r(),isOnboarding:a(),getSites:c()}})))((function(e){var t,n=e.filterByCategory,a=e.filterBySearch,c=e.getSitesForBuilder,o=e.isOnboarding,i=e.getSites,s=e.category,l=e.editor,u=Object(r.useState)(!1),m=y()(u,2),p=m[0],d=m[1],b=i.sites,f=void 0===b?{}:b,h=i.migration,g={top:p?0:"-100%"},O=Object.keys(f),v=O.filter((function(e){return Object.keys(f[e]).filter((function(t){return!0===f[e][t].upsell})).length===Object.keys(f[e]).length})),j=(t={builders:{},categories:{}},O.forEach((function(e){var r=c(e);r=n(r,s),r=a(r),t.builders[e]=r?r.length:0})),Object.keys(Ke).forEach((function(e){var r=c(l);r=n(r,e),r=a(r),t.categories[e]=r?r.length:0})),t),_=50<=c(l).length;return Object(r.createElement)(r.Fragment,null,!o&&!h&&Object(r.createElement)("div",{className:"sticky-nav",style:g},Object(r.createElement)("div",{className:"container sticky-nav-content"},!tiobDash.brandedTheme&&Object(r.createElement)(E.Icon,{icon:We,size:32}),Object(r.createElement)(ht,{className:"in-sticky",count:j.builders,categories:Ke,editors:Ze,onlyProSites:v,showCount:_}),!1,Object(r.createElement)(Ot,{count:j.categories,categories:Ke,showCount:_}))),Object(r.createElement)(G.a,{onChange:function(e){d(!e)}},Object(r.createElement)("div",null,!o&&Object(r.createElement)("p",{className:"instructions"},tiobDash.strings.starterSitesTabDescription),!1,Object(r.createElement)(Ot,{count:j.categories,categories:Ke,showCount:_}),Object(r.createElement)(ht,{count:j.builders,categories:Ke,editors:Ze,onlyProSites:v,showCount:_}),!1,Object(r.createElement)(gt,{categories:Ke,count:j.categories,showCount:_}),!tiobDash.isValidLicense&&Object(r.createElement)(ft,{data:tiobDash.upsellNotifications.upsell_1,editor:l}))))})),jt=Object(v.compose)(Object(h.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setOnboardingState,r=t.setCurrentCategory;return{cancelOnboarding:function(){n(!1)},resetCategory:function(){r("all")},setCurrentTab:t.setCurrentTab,setSearchQuery:t.setSearchQuery}})),Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getCurrentCategory,a=t.getPreviewStatus,c=t.getCurrentSite,o=t.getImportModalStatus,i=t.getOnboardingStatus,s=t.getSites,l=t.getInstallModalStatus,u=t.getCurrentTab,m=t.getSearchQuery;return{editor:n(),category:r(),previewOpen:a(),currentSiteData:c(),importModal:o(),installModal:l(),isOnboarding:i(),getSites:s(),currentTab:u(),searchQuery:m()}})))((function(e){var t=e.getSites,n=e.category,a=e.resetCategory,c=e.editor,o=e.previewOpen,i=e.currentSiteData,s=e.isOnboarding,l=e.cancelOnboarding,u=e.setSearchQuery,m=e.searchQuery,p=t.sites,d=void 0===p?{}:p,b=function(){var e={};return g().forEach((function(t){var n=d&&d[t]?d[t]:{};e[t]=$()(Object.values(n))})),e},f=function(e,t){return"free"===t?e.filter((function(e){return!e.upsell})):"all"!==t?e.filter((function(e){return e.keywords.includes(t)})):e},h=function(e){return m?new pt.a(e,{includeScore:!0,keys:["title","slug","keywords"]}).search(m).map((function(e){return e.item})):e},g=function(){return Object.keys(d)},O=function(){var e=b()[c];return e=h(e),f(e,n)},v=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null===i)return null;var t=b()[c],n=t.indexOf(i);return-1===n||1===t.length?null:e&&0===n?t[t.length-1]:e||n!==t.length-1?t[e?n-1:n+1]:t[0]};return 1>d.length?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("p",null,Object(_.__)("Starter sites could not be loaded. Please refresh and try again.","templates-patterns-collection"),s&&Object(r.createElement)(E.Button,{style:{display:"block",margin:"20px auto"},isPrimary:!0,onClick:l},Object(_.__)("Close","templates-patterns-collection")))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(vt,{getSitesForBuilder:function(e){return b()[e]},filterBySearch:h,filterByCategory:f}),0===O().length&&Object(r.createElement)("div",{className:"no-results"},Object(r.createElement)("p",null,Object(_.__)("No results found.","templates-patterns-collection")," ",Object(_.__)("You can try a different search or use one of the categories below.","templates-patterns-collection")),Object(r.createElement)("div",{className:"tags"},Je.map((function(e,t){return Object(r.createElement)(E.Button,{key:t,isPrimary:!0,className:"tag",onClick:function(t){t.preventDefault(),u(e),a()}},e)})))),Object(r.createElement)((function(){var e=Object(r.useState)(9),t=y()(e,2),n=t[0],a=t[1],c=O();return Object(r.createElement)("div",{className:"ob-sites is-grid"},c.slice(0,n).map((function(e,t){return Object(r.createElement)(dt,{key:t,data:e})})),Object(r.createElement)(G.a,{onChange:function(e){if(!e)return!1;a(n+9)}},Object(r.createElement)("span",{style:{height:10,width:10,display:"block"}})))}),null),o&&i&&Object(r.createElement)(bt,{next:v(),prev:v(!0)}))})),yt=Object(v.compose)(Object(h.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setOnboardingState,r=t.setCurrentCategory;return{cancelOnboarding:function(){n(!1)},resetCategory:function(){r("all")},setCurrentTab:t.setCurrentTab}})),Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getCurrentCategory,a=t.getPreviewStatus,c=t.getCurrentSite,o=t.getImportModalStatus,i=t.getOnboardingStatus,s=t.getSites,l=t.getInstallModalStatus,u=t.getCurrentTab,m=t.getSingleImport;return{editor:n(),category:r(),previewOpen:a(),currentSiteData:c(),importModal:o(),installModal:l(),isOnboarding:i(),getSites:s(),currentTab:u(),singleImport:m()}})))((function(e){var t=e.getSites,n=(e.installModal,e.currentTab),a=e.singleImport,c=e.importModal,o=e.currentSiteData,i=(e.isOnboarding,t.migration);return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"ob"},Object(r.createElement)(ut,null),Object(r.createElement)("div",{className:"ob-body"},Object(r.createElement)("div",{className:"content-container"},i&&Object(r.createElement)(z,{data:i}),"starterSites"===n&&(a?Object(r.createElement)(st,{slug:a}):Object(r.createElement)(jt,null)),"library"===n&&Object(r.createElement)(Ye,null),"pageTemplates"===n&&Object(r.createElement)(Ye,{isGeneral:!0})))),c&&o&&Object(r.createElement)(it,null))})),Et=Object(h.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getOnboardingStatus,r=t.getUserStatus;return{onboarding:n(),userStatus:r()}}))((function(e){var t=e.onboarding,n=e.userStatus,a=O()(["content-wrap","starter-sites",{"is-onboarding":t,"is-free":!n}]);return Object(r.createElement)("div",{className:"tiob-wrap"},Object(r.createElement)("div",{className:a},Object(r.createElement)("div",{className:"container content"},Object(r.createElement)("div",{className:"main"},Object(r.createElement)("div",{className:"tab-content columns starter-sites"},Object(r.createElement)(yt,null))))))}));Object(h.registerStore)("neve-onboarding",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"REFRESH_SITES":var n=t.payload.sites;return i(i({},e),{},{sites:n});case"SET_CURRENT_EDITOR":var r=t.payload.editor;return localStorage.setItem("neve-onboarding-editor",r),i(i({},e),{},{editor:r});case"SET_CURRENT_CATEGORY":var a=t.payload.category;return i(i({},e),{},{category:a});case"SET_FOCUSED_SITE":var c=t.payload.siteData;return i(i({},e),{},{currentSite:c});case"SET_PREVIEW_STATUS":var o=t.payload.previewStatus;return i(i({},e),{},{previewStatus:o});case"SET_IMPORT_MODAL_STATUS":var s=t.payload.importModalStatus;return i(i({},e),{},{importModalStatus:s});case"SET_INSTALL_MODAL_STATUS":var l=t.payload.installModalStatus;return i(i({},e),{},{installModalStatus:l});case"SET_ONBOARDING":var u=t.payload.status;return i(i({},e),{},{isOnboarding:u});case"SET_THEME_ACTIONS":var m=t.payload.themeActions;return i(i({},e),{},{themeAction:m});case"SET_CURRENT_TAB":var p=t.payload.currentTab;return i(i({},e),{},{singleTemplateImport:null,currentTab:p});case"SET_FETCHING":var b=t.payload.fetching;return i(i({},e),{},{fetching:b});case"SET_SINGLE_TEMPLATE_IMPORT":var f=t.payload.slug;return i(i({},e),{},{singleTemplateImport:f});case"SET_TEMPLATE_MODAL":var h=t.payload.data;return i(i({},e),{},{templateModal:h});case"SET_SEARCH_QUERY":var g=t.payload.query;return i(i({},e),{},{searchQuery:g})}return e},actions:b,selectors:f}),Object(r.render)(Object(r.createElement)(Et,null),document.getElementById("tpc-app"))}]);
|
assets/src/Components/CloudLibrary/Library.js
CHANGED
@@ -283,7 +283,7 @@ const Library = ( {
|
|
283 |
|
284 |
const themeURL = 'https://wordpress.org/themes/neve/';
|
285 |
const upgradeURL =
|
286 |
-
'https://themeisle.com/themes/neve/upgrade/?utm_medium=nevedashboard&utm_source=
|
287 |
|
288 |
const UpsellModal = ( { title, description, showUpgradeBtn = true } ) => {
|
289 |
return (
|
@@ -317,8 +317,7 @@ const Library = ( {
|
|
317 |
<Button
|
318 |
variant="primary"
|
319 |
isPrimary
|
320 |
-
href="https://themeisle.com/themes/neve/upgrade/?utm_medium=
|
321 |
-
https://themeisle.com/themes/neve/neve-upgrade-new/?utm_medium=nevedashboard&utm_source=neve&utm_campaign=templatecloud&utm_content=changeplanbtn"
|
322 |
target="_blank"
|
323 |
>
|
324 |
{ __( 'Upgrade to PRO' ) }
|
@@ -475,7 +474,7 @@ const Library = ( {
|
|
475 |
<Button
|
476 |
variant="secondary"
|
477 |
isSecondary
|
478 |
-
href="https://docs.themeisle.com/article/1354-neve-template-cloud-library?utm_medium=nevedashboard&utm_source=
|
479 |
target="_blank"
|
480 |
>
|
481 |
{ __( 'Learn more' ) }
|
283 |
|
284 |
const themeURL = 'https://wordpress.org/themes/neve/';
|
285 |
const upgradeURL =
|
286 |
+
'https://themeisle.com/themes/neve/upgrade/?utm_medium=nevedashboard&utm_source=wpadmin&utm_campaign=templatecloud&utm_content=neve';
|
287 |
|
288 |
const UpsellModal = ( { title, description, showUpgradeBtn = true } ) => {
|
289 |
return (
|
317 |
<Button
|
318 |
variant="primary"
|
319 |
isPrimary
|
320 |
+
href="https://themeisle.com/themes/neve/upgrade/?utm_medium=templatecloud&utm_source=wpadmin&utm_campaign=upgradetoprobtn&utm_content=neve"
|
|
|
321 |
target="_blank"
|
322 |
>
|
323 |
{ __( 'Upgrade to PRO' ) }
|
474 |
<Button
|
475 |
variant="secondary"
|
476 |
isSecondary
|
477 |
+
href="https://docs.themeisle.com/article/1354-neve-template-cloud-library?utm_medium=nevedashboard&utm_source=wpadmin&utm_campaign=templatescloud&utm_content=neve"
|
478 |
target="_blank"
|
479 |
>
|
480 |
{ __( 'Learn more' ) }
|
assets/src/Components/StarterSiteCard.js
CHANGED
@@ -74,7 +74,7 @@ const StarterSiteCard = ( {
|
|
74 |
isLink
|
75 |
className="templates"
|
76 |
target="_blank"
|
77 |
-
href="https://themeisle.com/themes/neve/upgrade/?utm_medium=nevedashboard&utm_source=
|
78 |
>
|
79 |
{ __(
|
80 |
'Unlock access with Business plan',
|
74 |
isLink
|
75 |
className="templates"
|
76 |
target="_blank"
|
77 |
+
href="https://themeisle.com/themes/neve/upgrade/?utm_medium=nevedashboard&utm_source=wpadmin&utm_campaign=templatecloud&utm_content=neve"
|
78 |
>
|
79 |
{ __(
|
80 |
'Unlock access with Business plan',
|
editor/build/index.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-plugins', 'wp-polyfill', 'wp-primitives'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-plugins', 'wp-polyfill', 'wp-primitives'), 'version' => 'c1dba3b78ab945c5e09c4e790adb08cc');
|
editor/build/index.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var c=t[n]={i:n,l:!1,exports:{}};return e[n].call(c.exports,c,c.exports,r),c.l=!0,c.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)r.d(n,c,function(t){return e[t]}.bind(null,c));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=30)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=window.regeneratorRuntime},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.primitives},function(e,t){function r(e,t,r,n,c,a,i){try{var o=e[a](i),s=o.value}catch(e){return void r(e)}o.done?t(s):Promise.resolve(s).then(n,c)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(c,a){var i=e.apply(t,n);function o(e){r(i,c,a,o,s,"next",e)}function s(e){r(i,c,a,o,s,"throw",e)}o(void 0)}))}}},function(e,t,r){var n=r(22),c=r(23),a=r(24),i=r(26);e.exports=function(e,t){return n(e)||c(e,t)||a(e,t)||i()}},function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function c(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)&&n.length){var i=c.apply(null,n);i&&e.push(i)}else if("object"===a)for(var o in n)r.call(n,o)&&n[o]&&e.push(o)}}return e.join(" ")}e.exports?(c.default=c,e.exports=c):void 0===(n=function(){return c}.apply(t,[]))||(e.exports=n)}()},function(e,t,r){"use strict";const n=r(27),c=r(28),a=r(29);function i(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function o(e,t){return t.encode?t.strict?n(e):encodeURIComponent(e):e}function s(e,t){return t.decode?c(e):e}function l(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function u(e){const t=(e=l(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function p(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function m(e,t){i((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{const c="string"==typeof r&&r.includes(e.arrayFormatSeparator),a="string"==typeof r&&!c&&s(r,e).includes(e.arrayFormatSeparator);r=a?s(r,e):r;const i=c||a?r.split(e.arrayFormatSeparator).map(t=>s(t,e)):null===r?r:s(r,e);n[t]=i};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),n=Object.create(null);if("string"!=typeof e)return n;if(!(e=e.trim().replace(/^[?#&]/,"")))return n;for(const c of e.split("&")){let[e,i]=a(t.decode?c.replace(/\+/g," "):c,"=");i=void 0===i?null:["comma","separator"].includes(t.arrayFormat)?i:s(i,t),r(s(e,t),i,n)}for(const e of Object.keys(n)){const r=n[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=p(r[e],t);else n[e]=p(r,t)}return!1===t.sort?n:(!0===t.sort?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce((e,t)=>{const r=n[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(r):e[t]=r,e},Object.create(null))}t.extract=u,t.parse=m,t.stringify=(e,t)=>{if(!e)return"";i((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const c=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[o(t,e),"[",c,"]"].join("")]:[...r,[o(t,e),"[",o(c,e),"]=",o(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[o(t,e),"[]"].join("")]:[...r,[o(t,e),"[]=",o(n,e)].join("")];case"comma":case"separator":return t=>(r,n)=>null==n||0===n.length?r:0===r.length?[[o(t,e),"=",o(n,e)].join("")]:[[r,o(n,e)].join(e.arrayFormatSeparator)];default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,o(t,e)]:[...r,[o(t,e),"=",o(n,e)].join("")]}}(t),c={};for(const t of Object.keys(e))r(t)||(c[t]=e[t]);const a=Object.keys(c);return!1!==t.sort&&a.sort(t.sort),a.map(r=>{const c=e[r];return void 0===c?"":null===c?o(r,t):Array.isArray(c)?c.reduce(n(r),[]).join("&"):o(r,t)+"="+o(c,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,n]=a(e,"#");return Object.assign({url:r.split("?")[0]||"",query:m(u(e),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:s(n,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0},r);const n=l(e.url).split("?")[0]||"",c=t.extract(e.url),a=t.parse(c,{sort:!1}),i=Object.assign(a,e.query);let s=t.stringify(i,r);s&&(s="?"+s);let u=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(u="#"+o(e.fragmentIdentifier,r)),`${n}${s}${u}`}},function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t){e.exports=window.wp.apiFetch},function(e,t){e.exports=window.wp.blocks},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.editPost},,,function(e,t){e.exports=window.wp.plugins},function(e,t){function r(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=r=function(e){return typeof e}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(t)}e.exports=r},function(e,t){e.exports=window.wp.blockEditor},function(e,t){e.exports=window.wp.keycodes},function(e,t,r){},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,c=!1,a=void 0;try{for(var i,o=e[Symbol.iterator]();!(n=(i=o.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){c=!0,a=e}finally{try{n||null==o.return||o.return()}finally{if(c)throw a}}return r}}},function(e,t,r){var n=r(25);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,r){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())},function(e,t,r){"use strict";var n=new RegExp("%[a-f0-9]{2}","gi"),c=new RegExp("(%[a-f0-9]{2})+","gi");function a(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],a(r),a(n))}function i(e){try{return decodeURIComponent(e)}catch(c){for(var t=e.match(n),r=1;r<t.length;r++)t=(e=a(t,r).join("")).match(n);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},r=c.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0])}catch(e){var n=i(r[0]);n!==r[0]&&(t[r[0]]=n)}r=c.exec(e)}t["%C2"]="�";for(var a=Object.keys(t),o=0;o<a.length;o++){var s=a[o];e=e.replace(new RegExp(s,"g"),t[s])}return e}(e)}}},function(e,t,r){"use strict";e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]}},function(e,t,r){"use strict";r.r(t);var n=r(1),c=r(17),a=r(12),i=(r(21),r(10)),o=r.n(i),s=r(4);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var p={isFetching:!0,isPreview:!1,tab:3===parseInt(window.tiTpc.tier)?"library":"templates",templates:[],patterns:[],library:{items:[],currentPage:0,totalPages:0},preview:{type:"templates",item:{}}};Object(s.registerStore)("tpc/block-editor",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,t=arguments.length>1?arguments[1]:void 0;return"SET_FETCHING"===t.type?u(u({},e),{},{isFetching:t.isFetching}):"TOGGLE_PREVIEW"===t.type?u(u({},e),{},{isPreview:!e.isPreview}):"UPDATE_CURRENT_TAB"===t.type?u(u({},e),{},{tab:t.tab,isPreview:!1}):"UPDATE_TEMPLATES"===t.type?u(u({},e),{},{templates:{items:t.items,currentPage:Number(t.currentPage),totalPages:Number(t.totalPages)}}):"UPDATE_PATTERNS"===t.type?u(u({},e),{},{patterns:t.items}):"UPDATE_LIBRARY"===t.type?u(u({},e),{},{library:{items:t.items,currentPage:Number(t.currentPage),totalPages:Number(t.totalPages)}}):"SET_PREVIEW_DATA"===t.type?u(u({},e),{},{preview:t.preview}):e},selectors:{isFetching:function(e){return e.isFetching},isPreview:function(e){return e.isPreview},getCurrentTab:function(e){return e.tab},getTemplates:function(e){return e.templates},getPatterns:function(e){return e.patterns},getLibrary:function(e){return e.library},getPreview:function(e){return e.preview}},actions:{setFetching:function(e){return{type:"SET_FETCHING",isFetching:e}},togglePreview:function(e){return{type:"TOGGLE_PREVIEW",isPreview:e}},updateCurrentTab:function(e){return{type:"UPDATE_CURRENT_TAB",tab:e}},updateTemplates:function(e,t,r){return{type:"UPDATE_TEMPLATES",items:e,currentPage:t,totalPages:r}},updatePatterns:function(e){return{type:"UPDATE_PATTERNS",items:e}},updateLibrary:function(e,t,r){return{type:"UPDATE_LIBRARY",items:e,currentPage:t,totalPages:r}},setPreviewData:function(e){return{type:"SET_PREVIEW_DATA",preview:e}}}});var m,b=r(0),f=r(8),d=r.n(f),g=wp.primitives,O=g.Path,j=g.SVG,y=function(e){var t=e.className;return Object(b.createElement)(j,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:d()(["tpc-icon",t])},Object(b.createElement)(O,{d:"M22.8063 24H1.19365C0.534714 24 0 23.4653 0 22.8063V1.19365C0 0.534714 0.534714 0 1.19365 0H22.8063C23.4653 0 24 0.534714 24 1.19365V22.8063C24 23.4653 23.4653 24 22.8063 24Z",fill:"#14171C"}),Object(b.createElement)(O,{d:"M19.8466 20.8187V7.39687V4.43164H16.884H3.45947L6.422 7.39687H16.884V17.8562L19.8466 20.8187Z",fill:"white"}),Object(b.createElement)(O,{d:"M10.138 14.1429L10.1407 17.0838L12.7764 19.7195L12.7656 11.5152L4.55859 11.5044L7.19435 14.1375L10.138 14.1429Z",fill:"white"}))},h=function(){return Object(b.createElement)(j,{width:"100",height:"100",viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"tpc-template-cloud-icon"},Object(b.createElement)(O,{d:"M95.0264 100H4.97356C2.22797 100 0 97.772 0 95.0264V4.97356C0 2.22797 2.22797 0 4.97356 0H95.0264C97.772 0 100 2.22797 100 4.97356V95.0264C100 97.772 97.772 100 95.0264 100Z",fill:"#0366D6"}),Object(b.createElement)(O,{d:"M82.6941 86.7448V30.8205V18.4653H70.3502H14.4146L26.7584 30.8205H70.3502V74.401L82.6941 86.7448Z",fill:"white"}),Object(b.createElement)(O,{d:"M42.2416 58.9291L42.2528 71.183L53.2352 82.1653L53.1902 47.9806L18.9941 47.9355L29.9765 58.9066L42.2416 58.9291Z",fill:"white"}))},v=r(3),w=r.n(v),_=r(6),E=r.n(_),k=r(7),P=r.n(k),x=r(11),S=r.n(x),T=r(2),C=r(14),N=r(9),B=new Uint8Array(16);function D(){if(!m&&!(m="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return m(B)}for(var I=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,A=function(e){return"string"==typeof e&&I.test(e)},F=[],L=0;L<256;++L)F.push((L+256).toString(16).substr(1));var V=function(e,t,r){var n=(e=e||{}).random||(e.rng||D)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var c=0;c<16;++c)t[r+c]=n[c];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(F[e[t+0]]+F[e[t+1]]+F[e[t+2]]+F[e[t+3]]+"-"+F[e[t+4]]+F[e[t+5]]+"-"+F[e[t+6]]+F[e[t+7]]+"-"+F[e[t+8]]+F[e[t+9]]+"-"+F[e[t+10]]+F[e[t+11]]+F[e[t+12]]+F[e[t+13]]+F[e[t+14]]+F[e[t+15]]).toLowerCase();if(!A(r))throw TypeError("Stringified UUID is invalid");return r}(n)};function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function M(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?U(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var R=lodash.omit,z=Object(s.dispatch)("tpc/block-editor"),H=z.updateLibrary,G=z.updateTemplates,Q=Object(s.dispatch)("core/notices").createNotice,q=function(e){Q("warning",e,{context:"themeisle-blocks/notices/templates-cloud",isDismissible:!0})},$=function(){var e=E()(w.a.mark((function e(){var t,r,n,c,a,i,o,s=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:{},r=M(M({cache:localStorage.getItem("tpcCacheBuster")},R(tiTpc.params,"meta")),{},{per_page:12,page:0,premade:!0,template_site_slug:"general"},t),n=Object(N.stringifyUrl)({url:tiTpc.endpoint+"page-templates",query:r}),e.prev=3,e.next=6,S()({url:n,method:"GET",parse:!1});case 6:if(!(c=e.sent).ok){e.next=16;break}return e.next=10,c.json();case 10:if(!(a=e.sent).message){e.next=13;break}return e.abrupt("return",q(a.message));case 13:i=c.headers.get("x-wp-totalpages"),o=r.page,G(a,o,i);case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(3),e.t0.message&&q(e.t0.message);case 21:case"end":return e.stop()}}),e,null,[[3,18]])})));return function(){return e.apply(this,arguments)}}(),W=function(){var e=E()(w.a.mark((function e(){var t,r,n,c,a,i,o,s=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:{},r=M({per_page:12,page:0},t),n=Object(N.stringifyUrl)({url:tiTpc.endpoint+"templates",query:M(M({cache:localStorage.getItem("tpcCacheBuster")},R(tiTpc.params,"meta")),r)}),e.prev=3,e.next=6,S()({url:n,method:"GET",parse:!1});case 6:if(!(c=e.sent).ok){e.next=16;break}return e.next=10,c.json();case 10:if(!(a=e.sent).message){e.next=13;break}return e.abrupt("return",q(a.message));case 13:i=c.headers.get("x-wp-totalpages"),o=r.page,H(a,o,i);case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(3),e.t0.message&&q(e.t0.message);case 21:case"end":return e.stop()}}),e,null,[[3,18]])})));return function(){return e.apply(this,arguments)}}(),Z=function(){var e=E()(w.a.mark((function e(t){var r,n,c;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(N.stringifyUrl)({url:"".concat(tiTpc.endpoint,"templates/").concat(t.template_id),query:M(M({cache:localStorage.getItem("tpcCacheBuster")},R(tiTpc.params,"meta")),{},{meta:JSON.stringify(tiTpc.params.meta)},t)}),e.prev=1,e.next=4,S()({url:r,method:"POST",parse:!1});case 4:if(!(n=e.sent).ok){e.next=11;break}return e.next=8,n.json();case 8:if(!(c=e.sent).message){e.next=11;break}return e.abrupt("return",q(c.message));case 11:return localStorage.setItem("tpcCacheBuster",V()),e.next=14,$();case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(1),e.t0.message&&q(e.t0.message);case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t){return e.apply(this,arguments)}}(),J=function(){var e=E()(w.a.mark((function e(t){var r,n,c;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(N.stringifyUrl)({url:"".concat(window.tiTpc.endpoint,"templates/").concat(t),query:M({cache:localStorage.getItem("tpcCacheBuster")},R(tiTpc.params,"meta"))}),e.prev=1,e.next=4,S()({url:r,method:"GET",parse:!1});case 4:if(!(n=e.sent).ok){e.next=12;break}return e.next=8,n.json();case 8:if(!(c=e.sent).message){e.next=11;break}return e.abrupt("return",!1);case 11:return e.abrupt("return",c);case 12:e.next=17;break;case 14:return e.prev=14,e.t0=e.catch(1),e.abrupt("return",!1);case 17:case"end":return e.stop()}}),e,null,[[1,14]])})));return function(t){return e.apply(this,arguments)}}(),K=function(){var e=E()(w.a.mark((function e(t){var r,n,c;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(N.stringifyUrl)({url:"".concat(tiTpc.endpoint,"templates/").concat(t,"/import"),query:M({cache:localStorage.getItem("tpcCacheBuster")},R(tiTpc.params,"meta"))}),n={},e.prev=2,e.next=5,S()({url:r,method:"GET",parse:!1});case 5:if(!(c=e.sent).ok){e.next=12;break}return e.next=9,c.json();case 9:if(!(n=e.sent).message){e.next=12;break}return e.abrupt("return",q(n.message));case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(2),e.t0.message&&q(e.t0.message);case 17:return e.abrupt("return",n);case 18:case"end":return e.stop()}}),e,null,[[2,14]])})));return function(t){return e.apply(this,arguments)}}(),Y=function(){var e=E()(w.a.mark((function e(t,r){var n,c,a;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Object(N.stringifyUrl)({url:"".concat(tiTpc.endpoint,"templates/").concat(t),query:M({cache:localStorage.getItem("tpcCacheBuster"),_method:"DELETE"},R(tiTpc.params,"meta"))}),e.prev=1,e.next=4,S()({url:n,method:"POST"});case 4:if(!(c=e.sent).ok){e.next=11;break}return e.next=8,c.json();case 8:if(!(a=e.sent).message){e.next=11;break}return e.abrupt("return",q(a.message));case 11:return localStorage.setItem("tpcCacheBuster",V()),e.next=14,W(r);case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(1),e.t0.message&&q(e.t0.message);case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t,r){return e.apply(this,arguments)}}(),X=function(){var e=E()(w.a.mark((function e(t,r,n,c,a){var i,o,s;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Object(N.stringifyUrl)({url:"".concat(tiTpc.endpoint,"templates/").concat(t,"/publish"),query:M({cache:localStorage.getItem("tpcCacheBuster"),method:"POST",template_site_slug:r,template_thumbnail:n,premade:c?"yes":"no",link:a},R(tiTpc.params,"meta"))}),e.prev=1,e.next=4,S()({url:i,method:"POST",headers:{Authorization:"Bearer ".concat(tiTpc.bearer||""," ")}});case 4:if(!(o=e.sent).ok){e.next=14;break}return e.next=8,o.json();case 8:if(!(s=e.sent).message){e.next=12;break}return q(s.message),e.abrupt("return",{success:!1});case 12:e.next=17;break;case 14:if(!o.message){e.next=17;break}return q(o.message),e.abrupt("return",{success:!1});case 17:return localStorage.setItem("tpcCacheBuster",V()),e.abrupt("return",{success:!0});case 21:if(e.prev=21,e.t0=e.catch(1),!e.t0.message){e.next=26;break}return q(e.t0.message),e.abrupt("return",{success:!1});case 26:case"end":return e.stop()}}),e,null,[[1,21]])})));return function(t,r,n,c,a){return e.apply(this,arguments)}}(),ee=function(){var e=Object(s.useSelect)((function(e){return e("core/notices").getNotices("themeisle-blocks/notices/templates-cloud")})),t=Object(s.useDispatch)("core/notices").removeNotice;return Object(b.createElement)("div",{className:"notices"},e.map((function(e){return Object(b.createElement)(T.Notice,{key:e.id,status:e.status,isDismissible:e.isDismissible,onRemove:function(){return t(e.id,"themeisle-blocks/notices/templates-cloud")},actions:e.actions},e.content)})))};function te(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function re(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?te(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):te(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ne=lodash.omit,ce=r(18),ae=r.n(ce),ie=r(13),oe=r(5),se=Object(b.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(b.createElement)(oe.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"})),le=Object(b.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(b.createElement)(oe.Path,{d:"M10.2 3.28c3.53 0 6.43 2.61 6.92 6h2.08l-3.5 4-3.5-4h2.32c-.45-1.97-2.21-3.45-4.32-3.45-1.45 0-2.73.71-3.54 1.78L4.95 5.66C6.23 4.2 8.11 3.28 10.2 3.28zm-.4 13.44c-3.52 0-6.43-2.61-6.92-6H.8l3.5-4c1.17 1.33 2.33 2.67 3.5 4H5.48c.45 1.97 2.21 3.45 4.32 3.45 1.45 0 2.73-.71 3.54-1.78l1.71 1.95c-1.28 1.46-3.15 2.38-5.25 2.38z"})),ue=Object(b.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(b.createElement)(oe.Path,{d:"M13 11.9l3.3-3.4-1.1-1-3.2 3.3-3.2-3.3-1.1 1 3.3 3.4-3.5 3.6 1 1L12 13l3.5 3.5 1-1z"}));function pe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function me(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?pe(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var be=function(e){var t=e.closeModal,r=e.getOrder,c=e.getSearchQuery,a=Object(s.useDispatch)("tpc/block-editor"),i=a.setFetching,o=a.updateCurrentTab,l={templates:Object(n.__)("Page Templates")};3===parseInt(tiTpc.tier)&&(l.library=Object(n.__)("My Library"));var u=Object(s.useSelect)((function(e){return e("tpc/block-editor").isFetching()})),p=Object(s.useSelect)((function(e){return e("tpc/block-editor").isPreview()})),m=Object(s.useSelect)((function(e){return e("tpc/block-editor").getCurrentTab()})),f=function(){var e=E()(w.a.mark((function e(){var t;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return window.localStorage.setItem("tpcCacheBuster",V()),i(!0),t=r(),e.next=5,$(me({search:c()},t));case 5:return e.next=7,W(me({search:c()},t));case 7:i(!1);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(b.createElement)("div",{className:"modal-header"},Object(b.createElement)("div",{className:"left"},Object(b.createElement)(T.Icon,{icon:h})),Object(b.createElement)("div",{className:"center"},Object.keys(l).map((function(e){return Object(b.createElement)(T.Button,{key:e,onClick:function(){return o(e)},className:d()("tabs",{"is-active":e===m})},l[e])}))),Object(b.createElement)("div",{className:"right"},"library"===m&&!p&&Object(b.createElement)(T.ButtonGroup,null,Object(b.createElement)(T.Button,{label:Object(n.__)("Re-sync Library"),icon:le,disabled:u,className:d()("is-sync",{"is-loading":u}),onClick:f})),Object(b.createElement)(T.Button,{label:Object(n.__)("Close Modal"),icon:ue,onClick:t})))},fe=r(19),de=function(e){var t=e.isFetching,r=e.importBlocks,c=Object(ie.useViewportMatch)("large",">="),i=Object(ie.useViewportMatch)("large","<="),o=Object(ie.useViewportMatch)("small",">="),l=Object(ie.useViewportMatch)("small","<="),u=1400;c||i||!o||l?!(c||i||o||l)&&(u=600):u=960;var p=Object(s.useDispatch)("tpc/block-editor"),m=p.setFetching,f=p.togglePreview,d=Object(s.useSelect)((function(e){return e("tpc/block-editor").getPreview()})).item;Object(b.useEffect)((function(){h()}),[]);var g=Object(b.useState)(""),O=P()(g,2),j=O[0],y=O[1],h=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return m(!0),e.next=3,v();case 3:m(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),v=function(){var e=E()(w.a.mark((function e(){var t;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return m(!0),e.next=3,K(d.template_id);case 3:(t=e.sent).__file&&t.content&&"wp_export"===t.__file&&y(t.content),m(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(b.createElement)("div",{className:"tpc-modal-content"},Object(b.createElement)("div",{className:"preview-header"},Object(b.createElement)("div",{className:"left"},d.template_name||Object(n.__)("Template")),Object(b.createElement)("div",{className:"right"},Object(b.createElement)(T.Button,{isSecondary:!0,onClick:f},Object(n.__)("Close Preview")),Object(b.createElement)(T.Button,{isPrimary:!0,isBusy:t,disabled:t,onClick:function(){f(),r(j,d.meta||[])}},Object(n.__)("Import")))),t?Object(b.createElement)(T.Placeholder,null,Object(b.createElement)(T.Spinner,null)):Object(b.createElement)("div",{className:"preview-content"},Object(b.createElement)(fe.BlockPreview,{blocks:Object(a.parse)(j),viewportWidth:u})))},ge=Object(b.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(b.createElement)(oe.Path,{d:"M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"})),Oe=Object(b.createElement)(oe.SVG,{xmlns:"https://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(b.createElement)(oe.Path,{d:"M3 15h18v-2H3v2zm0 4h18v-2H3v2zm0-8h18V9H3v2zm0-6v2h18V5H3z"})),je=Object(b.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(b.createElement)(oe.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7.8 16.5H5c-.3 0-.5-.2-.5-.5v-6.2h6.8v6.7zm0-8.3H4.5V5c0-.3.2-.5.5-.5h6.2v6.7zm8.3 7.8c0 .3-.2.5-.5.5h-6.2v-6.8h6.8V19zm0-7.8h-6.8V4.5H19c.3 0 .5.2.5.5v6.2z",fillRule:"evenodd",clipRule:"evenodd"})),ye=r(20);function he(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ve(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?he(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):he(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var we={date:Object(n.__)("Date"),template_name:Object(n.__)("Name"),modified:Object(n.__)("Last Modified")},_e=function(e){var t=e.layout,r=e.sortingOrder,c=e.setLayout,a=e.isSearch,i=e.searchQuery,o=e.onSearch,s=e.setSearchQuery,l=e.setSortingOrder,u=e.changeOrder;return Object(b.createElement)("div",{className:"filters"},Object(b.createElement)("div",{className:"display-sorting"},Object(b.createElement)("div",{className:"sorting-label"},Object(n.__)("Sort by")),Object(b.createElement)("div",{className:"sorting-filter"},Object.keys(we).map((function(e){return Object(b.createElement)(T.Button,{key:e,className:d()({"is-selected":e===r.orderby,"is-asc":"ASC"===r.order}),onClick:function(){var t={order:"DESC",orderby:e};e===r.orderby&&"DESC"===r.order&&(t.order="ASC"),l(ve({},t)),u(ve({},t))}},we[e])})))),Object(b.createElement)("div",{className:"view-filters"},Object(b.createElement)("div",{className:"search-filters"},Object(b.createElement)("input",{placeholder:Object(n.__)("Search for a template…"),className:"filter-search",value:i,onChange:function(e){return s(e.target.value)},onKeyDown:function(e){e.keyCode===ye.ENTER&&o()}}),a?Object(b.createElement)(T.Button,{label:Object(n.__)("Clear search query"),icon:ue,onClick:function(){s(""),o("")}}):Object(b.createElement)(T.Button,{label:Object(n.__)("Search"),icon:ge,onClick:function(){return o()}})),Object(b.createElement)(T.Button,{label:Object(n.__)("List View"),icon:Oe,onClick:function(){return c("list")},isPressed:"list"===t}),Object(b.createElement)(T.Button,{label:Object(n.__)("Grid View"),icon:je,onClick:function(){return c("grid")},isPressed:"grid"===t})))},Ee=Object(b.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(b.createElement)(oe.Path,{d:"M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"})),ke=Object(b.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(b.createElement)(oe.Path,{d:"M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"})),Pe=Object(b.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(b.createElement)(oe.Path,{d:"M12 4h3c.6 0 1 .4 1 1v1H3V5c0-.6.5-1 1-1h3c.2-1.1 1.3-2 2.5-2s2.3.9 2.5 2zM8 4h3c-.2-.6-.9-1-1.5-1S8.2 3.4 8 4zM4 7h11l-.9 10.1c0 .5-.5.9-1 .9H5.9c-.5 0-.9-.4-1-.9L4 7z"})),xe=Object(b.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(b.createElement)(oe.Path,{d:"M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z"})),Se=function(e){var t=e.sortingOrder,r=e.layout,c=e.item,a=e.importBlocks,i=e.deletable,o=Object(s.useDispatch)("tpc/block-editor"),l=o.togglePreview,u=o.setPreviewData,p=Object(b.useState)(!1),m=P()(p,2),f=m[0],g=m[1],O=Object(b.useState)(!1),j=P()(O,2),y=j[0],h=j[1],v=Object(b.useState)(c.template_name),_=P()(v,2),k=_[0],x=_[1],S=function(){var e=E()(w.a.mark((function e(){var t;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return g("importing"),e.next=3,K(c.template_id);case 3:(t=e.sent).__file&&t.content&&"wp_export"===t.__file&&a(t.content,c.meta||[]),g(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),C=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return g("updating"),e.next=3,Z({template_id:c.template_id,template_name:k||c.template_name},t);case 3:return e.next=5,W(t);case 5:g(!1),h(!y);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),N=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.confirm(Object(n.__)("Are you sure you want to delete this template?"))){e.next=2;break}return e.abrupt("return",!1);case 2:return g("deleting"),e.next=5,Y(c.template_id,t);case 5:g(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),B=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l(),u({type:"library",item:c});case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();if("grid"===r){var D={backgroundImage:"url(".concat(c.template_thumbnail,")")};return Object(b.createElement)("div",{key:c.template_id,className:"table-grid"},Object(b.createElement)("div",{style:D,className:d()("grid-preview",{"is-loading":y||!1!==f})},Object(b.createElement)("div",{className:"preview-actions"},Object(b.createElement)(T.Button,{isSecondary:!0,disabled:!1!==f,onClick:B},Object(n.__)("Preview")),Object(b.createElement)(T.Button,{isPrimary:!0,isBusy:"importing"===f,disabled:!1!==f,onClick:S},Object(n.__)("Import")),i&&Object(b.createElement)("div",{className:"preview-controls"},!c.link&&Object(b.createElement)(T.Button,{label:Object(n.__)("Edit"),icon:"updating"===f?le:Ee,disabled:y||!1!==f,className:d()({"is-loading":"updating"===f}),onClick:function(){return h(!y)}},y&&Object(b.createElement)(T.Popover,{onFocusOutside:function(){return h(!y)},className:"controls-popover"},Object(b.createElement)("div",{className:"popover-content"},Object(b.createElement)(T.TextControl,{label:Object(n.__)("Template Name"),value:k,onChange:x}),Object(b.createElement)(T.Button,{label:Object(n.__)("Update"),icon:"updating"===f?le:ke,disabled:!1!==f,className:d()({"is-loading":"updating"===f}),onClick:C})))),Object(b.createElement)(T.Button,{label:Object(n.__)("Delete"),icon:"deleting"===f?le:Pe,disabled:!1!==f,className:d()({"is-loading":"deleting"===f}),onClick:N})))),Object(b.createElement)("div",{className:"card-footer"},Object(b.createElement)("p",null,c.template_name)))}var I=d()("actions",{"no-controls":!i});return Object(b.createElement)("div",{key:c.template_id,className:"table-row"},Object(b.createElement)("div",{className:"row-title"},Object(b.createElement)(T.Icon,{icon:xe}),y?Object(b.createElement)(T.TextControl,{label:Object(n.__)("Template Name"),hideLabelFromVision:!0,value:k,onChange:x}):c.template_name),i&&Object(b.createElement)("div",{className:"row-controls"},c.link?Object(b.createElement)(T.Tooltip,{text:Object(n.__)("This template is synced to a page.")},Object(b.createElement)(T.Button,{label:Object(n.__)("Edit"),icon:Ee,disabled:!0},Object(n.__)("Edit"))):Object(b.createElement)(T.Button,{label:y?Object(n.__)("Update"):Object(n.__)("Edit"),icon:y?"updating"===f?le:ke:Ee,disabled:!1!==f,className:d()({"is-loading":"updating"===f}),onClick:y?C:function(){return h(!y)}},y?Object(n.__)("Update"):Object(n.__)("Edit")),Object(b.createElement)(T.Button,{label:Object(n.__)("Delete"),icon:"deleting"===f?le:Pe,disabled:!1!==f,className:d()({"is-loading":"deleting"===f}),onClick:N},"deleting"===f?Object(n.__)("Deleting")+"...":Object(n.__)("Delete"))),Object(b.createElement)("div",{className:I},Object(b.createElement)(T.Button,{isSecondary:!0,disabled:!1!==f,onClick:B},Object(n.__)("Preview")),Object(b.createElement)(T.Button,{isPrimary:!0,isBusy:"importing"===f,disabled:!1!==f,onClick:S},Object(n.__)("Import"))))},Te=function(e){var t=e.total,r=e.current,n=e.onChange;if(t<2)return null;for(var c=[],a=function(e){var t=e===r;c.push(Object(b.createElement)(T.Button,{key:"page-".concat(e),isPrimary:t,disabled:t,onClick:function(){return n(e)}},e+1))},i=0;i<t;i++)a(i);return Object(b.createElement)(T.ButtonGroup,{className:"pagination"},c)};function Ce(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ne(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ce(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Be=Object(s.withSelect)((function(e,t){var r=t.isGeneral?e("tpc/block-editor").getTemplates():e("tpc/block-editor").getLibrary(),n=r.items;return{items:void 0===n?[]:n,currentPage:r.currentPage,totalPages:r.totalPages}}))((function(e){var t=e.importBlocks,r=e.isGeneral,c=void 0!==r&&r,a=e.isFetching,i=e.items,o=e.currentPage,l=e.totalPages,u=e.getOrder,p=e.setQuery,m=e.getSearchQuery,f=e.setSorting,g=Object(s.useDispatch)("tpc/block-editor").setFetching,O=Object(b.useState)("grid"),j=P()(O,2),y=j[0],h=j[1],v=Object(b.useState)({templates:!1,library:!1}),_=P()(v,2),k=_[0],x=_[1],S=function(e){return x(Ne(Ne({},k),{},c?{templates:e}:{library:e}))},C=function(){return c?k.templates:k.library},N=function(){var e=E()(w.a.mark((function e(){var t;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g(!0),t=u(),!c){e.next=7;break}return e.next=5,$(Ne({search:m()},t));case 5:e.next=9;break;case 7:return e.next=9,W(Ne({search:m()},t));case 9:g(!1);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();Object(b.useEffect)((function(){i&&i.length>0||N()}),[c]);var B=function(){var e=E()(w.a.mark((function e(t){var r;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g(!0),r=u(),!c){e.next=7;break}return e.next=5,$(Ne({search:m(),page:t},r));case 5:e.next=9;break;case 7:return e.next=9,W(Ne({search:m(),page:t},r));case 9:g(!1);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),D=function(){var e=E()(w.a.mark((function e(){var t,r,n=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>0&&void 0!==n[0]?n[0]:m(),g(!0),S(!!t),r=u(),!c){e.next=9;break}return e.next=7,$(Ne({search:t},r));case 7:e.next=11;break;case 9:return e.next=11,W(Ne({search:t},r));case 11:g(!1);case 12:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),I=function(){var e=E()(w.a.mark((function e(t){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g(!0),!c){e.next=6;break}return e.next=4,$(Ne(Ne({},t),{},{search:m()}));case 4:e.next=8;break;case 6:return e.next=8,W(Ne(Ne({},t),{},{search:m()}));case 8:g(!1);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();if(a)return Object(b.createElement)(b.Fragment,null,Object(b.createElement)(_e,{layout:y,sortingOrder:u(),setLayout:h,isSearch:C(),searchQuery:m(),onSearch:D,setSearchQuery:p,setSortingOrder:f,changeOrder:I}),Object(b.createElement)(T.Placeholder,null,Object(b.createElement)(T.Spinner,null)));if(!Boolean(i.length))return Object(b.createElement)("div",{className:"table-content"},Object(b.createElement)(_e,{layout:y,sortingOrder:u(),setLayout:h,isSearch:C(),searchQuery:m(),onSearch:D,setSearchQuery:p,setSortingOrder:f,changeOrder:I}),Object(n.__)("No templates available. Add a new one?"));var A=d()("table-content",{"is-grid":"grid"===y});return Object(b.createElement)(b.Fragment,null,Object(b.createElement)(_e,{layout:y,sortingOrder:u(),setLayout:h,isSearch:C(),searchQuery:m(),onSearch:D,setSearchQuery:p,setSortingOrder:f,changeOrder:I}),Object(b.createElement)("div",{className:A},i.map((function(e){return Object(b.createElement)(Se,{sortingOrder:u(),deletable:!c,key:e.template_id,layout:y,item:e,importBlocks:t})}))),Object(b.createElement)(Te,{onChange:B,current:o,total:l}))})),De=Object(s.withSelect)((function(e){var t=e("tpc/block-editor"),r=t.isPreview,n=t.isFetching,c=t.getCurrentTab;return{isPreview:r(),isFetching:n(),currentTab:c()}}))((function(e){var t=e.importBlocks,r=e.getOrder,c=e.setQuery,a=e.getSearchQuery,i=e.setSorting,o=e.isPreview,s=e.currentTab,l=e.isFetching;return o&&"library"===s?Object(b.createElement)(de,{isFetching:l,importBlocks:t}):Object(b.createElement)("div",{className:"tpc-modal-content"},Object(b.createElement)(ee,null),["templates","library"].includes(s)&&Object(b.createElement)(Be,{isFetching:l,isGeneral:"templates"===s,importBlocks:t,getOrder:r,setQuery:c,getSearchQuery:a,setSorting:i}),"patterns"===s&&Object(n.__)("We are still working on this. Please check back later. Thank you!"))})),Ie=function(e){var t=e.title,r=e.leftButtons,c=e.rightButtons,a=e.heading,i=e.previewUrl,o=Object(N.stringifyUrl)({url:i,query:{tpcpreview:"yes"}}),s=t||Object(n.__)("Preview");return Object(b.createElement)("div",{className:"ob-preview single-templates"},Object(b.createElement)("div",{className:"preview"},Object(b.createElement)("iframe",{title:s,src:o,frameBorder:"0"}),Object(b.createElement)("div",{className:"loading"},Object(b.createElement)(T.Dashicon,{icon:"update",size:50}))),Object(b.createElement)("div",{className:"bottom-bar"},r&&Object(b.createElement)("div",{className:"navigator"},r),a&&Object(b.createElement)("h2",{className:"heading"},a),c&&Object(b.createElement)("div",{className:"actions"},c)))};function Ae(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Fe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ae(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ae(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Le=lodash.omit,Ve=Object(ie.compose)(Object(s.withSelect)((function(e){var t=e("tpc/block-editor"),r=t.isPreview,n=t.getPreview,c=t.getCurrentTab;return{isPreview:r(),currentTab:c(),previewData:n().item}})),Object(s.withDispatch)((function(e){var t=e("core/block-editor"),r=t.removeBlock,n=t.replaceBlocks,c=e("tpc/block-editor").togglePreview;return{removeBlock:r,replaceBlocks:n,closePreview:function(){return c(!1)}}})))((function(e){var t=e.clientId,r=e.isPreview,c=e.previewData,i=e.currentTab,o=e.removeBlock,l=e.replaceBlocks,u=e.closePreview,p=Object(s.useSelect)((function(e){return{type:e("core/editor").getEditedPostAttribute("type")}})).type,m=Object(s.useDispatch)("core/notices").createErrorNotice,f=Object(s.useDispatch)("core/editor").editPost,d=Object(s.useDispatch)("tpc/block-editor"),g=d.updateLibrary,O=d.updateTemplates,j=Object(b.useState)(!1),y=P()(j,2),h=y[0],v=y[1],_=Object(b.useState)(!1),k=P()(_,2),x=k[0],S=k[1],C=Object(b.useState)({templates:"",library:""}),N=P()(C,2),B=N[0],D=N[1],I=Object(b.useState)({templates:{order:"DESC",orderby:"date"},library:{order:"DESC",orderby:"date"}}),A=P()(I,2),F=A[0],L=A[1],V="templates"===i,U=function(){return V?B.templates:B.library},M=function(){return V?F.templates:F.library},R=function(e){try{var t=JSON.parse(e);if(t&&"object"===ae()(t))return t}catch(e){}return!1},z=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(g([]),O([]),0<Object.keys(R(r)||{}).length&&["post","page"].includes(p)){var n=JSON.parse(r),c=Fe({},Le(Fe({},n),"_wp_page_template"));f({meta:c}),"page"===p&&n._wp_page_template&&f({template:n._wp_page_template})}l(t,Object(a.parse)(e))},H=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return S(!0),e.next=3,K(c.template_id).then((function(e){if(e.__file&&e.content&&"wp_export"===e.__file)return u(),S(!1),z(e.content,c.meta||[]),!1;m(Object(n.__)("Something went wrong while importing. Please try again."),{type:"snackbar"}),S(!1),o(t)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),G=function(){v(!1),S(!1),o(t)};return Object(b.useEffect)((function(){setTimeout((function(){v(!0)}),100)}),[]),h?Object(b.createElement)(b.Fragment,null,Object(b.createElement)(T.Modal,{onRequestClose:G,shouldCloseOnEsc:!1,shouldCloseOnClickOutside:!r||"templates"!==i,isDismissible:!1,overlayClassName:"tpc-template-cloud-modal"},Object(b.createElement)(be,{closeModal:G,getOrder:M,getSearchQuery:U}),Object(b.createElement)(De,{importBlocks:z,getOrder:M,setQuery:function(e){return D(Fe(Fe({},B),{},V?{templates:e}:{library:e}))},getSearchQuery:U,setSorting:function(e){return L(Fe(Fe({},F),{},V?{templates:e}:{library:e}))}}),Object(b.createElement)((function(){if(!r||"templates"!==i)return null;var e=c.link,t=c.template_name;return Object(b.createElement)(T.Modal,{isDismissible:!1,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,className:"tpc-preview-wrap-modal"},Object(b.createElement)(Ie,{previewUrl:e,heading:t,leftButtons:Object(b.createElement)(b.Fragment,null,Object(b.createElement)(T.Button,{disabled:x,icon:se,onClick:u})),rightButtons:Object(b.createElement)(T.Button,{disabled:x,isPrimary:!0,onClick:H},x?Object(n.__)("Importing")+"...":Object(n.__)("Import"))}),";")}),null))):null}));Object(a.registerBlockType)("ti-tpc/templates-cloud",{title:Object(n.__)("Templates Cloud"),description:Object(n.__)("A cloud based templates library which enables you to create ready-made website in no time."),icon:y,category:"design",keywords:["templates cloud","patterns","template library"],supports:{html:!1},edit:Ve,save:function(){return null}}),3===parseInt(tiTpc.tier)&&Object(c.registerPlugin)("ti-tpc",{render:function(){var e=Object(b.useState)(!1),t=P()(e,2),r=t[0],c=t[1],i=Object(b.useState)(!1),o=P()(i,2),l=o[0],u=o[1],p=Object(b.useState)(""),m=P()(p,2),f=m[0],g=m[1],O=window.tiTpc.canPredefine,j=Object(s.useDispatch)("core/notices"),h=j.createErrorNotice,v=j.createSuccessNotice,_=Object(s.useDispatch)("core/editor").editPost,k=Object(s.useSelect)((function(e){var t=e("core/block-editor"),r=t.getSelectedBlockCount,n=t.getSelectedBlock,c=t.getMultiSelectedBlocks,i=1===r()?n():c();return Object(a.serialize)(i)}),[]),x=Object(s.useSelect)((function(e){var t=(0,e("core/block-editor").getBlocks)();return Object(a.serialize)(t)}),[]),B=Object(s.useSelect)((function(e){return(0,e("core/editor").getEditedPostAttribute)("meta")}),[]),D=Object(s.useSelect)((function(e){return(0,e("core/editor").getEditedPostAttribute)("template")}),[]);Object(b.useEffect)((function(){var e=window.tiTpc.metaKeys;window.tiTpc.params.meta=Object.fromEntries(Object.entries(B||{}).filter((function(t){var r=P()(t,1)[0];return e.includes(r)}))),D?window.tiTpc.params.meta._wp_page_template=D:""===D&&window.tiTpc.params.meta._wp_page_template&&delete window.tiTpc.params.meta._wp_page_template}),[B,D]);var I=Object(s.useSelect)((function(e){return{meta:e("core/editor").getEditedPostAttribute("meta")||{},postId:e("core/editor").getEditedPostAttribute("id"),type:e("core/editor").getEditedPostAttribute("type"),link:e("core/editor").getEditedPostAttribute("link"),postTitle:e("core/editor").getEditedPostAttribute("title")||Object(n.__)("Template")}})),A=I.meta,F=I.postTitle,L=I.postId,U=I.type,M=I.link,R=I.meta,z=R._ti_tpc_template_sync,H=R._ti_tpc_template_id,G=R._ti_tpc_screenshot_url,Q=R._ti_tpc_site_slug,q=R._ti_tpc_published,$=Object(s.useSelect)((function(e,t){var r=t.forceIsSaving,n=e("core/editor"),c=n.isSavingPost,a=n.isPublishingPost,i=n.isAutosavingPost,o=r||c(),s=i();return(a()||o)&&!s})),W=Object(b.useState)(z),Z=P()(W,2),K=Z[0],Y=Z[1],te=Object(b.useState)(H),ce=P()(te,2),ae=ce[0],ie=ce[1],oe=Object(b.useState)(Q),se=P()(oe,2),le=se[0],ue=se[1],pe=Object(b.useState)(q),me=P()(pe,2),be=me[0],fe=me[1],de=Object(b.useState)(G),ge=P()(de,2),Oe=ge[0],je=ge[1];Object(b.useEffect)((function(){_({meta:re(re({},A),{},{_ti_tpc_template_sync:K,_ti_tpc_template_id:ae,_ti_tpc_screenshot_url:Oe,_ti_tpc_site_slug:le,_ti_tpc_published:be})})}),[K,ae,Oe,le,be]),Object(b.useEffect)((function(){$&&K&&he()}),[$,K]);var ye=function(){var e=E()(w.a.mark((function e(){var t,r,a,i;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u(!0),t={__file:"wp_export",version:2,content:k},r=Object(N.stringifyUrl)({url:window.tiTpc.endpoint+"templates",query:re(re({},ne(tiTpc.params,"meta")),{},{template_name:f,template_type:"gutenberg"})}),e.prev=3,e.next=6,S()({url:r,method:"POST",data:t,parse:!1});case 6:if(!(a=e.sent).ok){e.next=12;break}return e.next=10,a.json();case 10:(i=e.sent).message?h(i.message,{type:"snackbar"}):(window.localStorage.setItem("tpcCacheBuster",V()),v(Object(n.__)("Template saved."),{type:"snackbar"}));case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(3),e.t0.message&&h(e.t0.message,{type:"snackbar"});case 17:u(!1),c(!1),g("");case 20:case"end":return e.stop()}}),e,null,[[3,14]])})));return function(){return e.apply(this,arguments)}}(),he=function(){var e=E()(w.a.mark((function e(){var t,r,c,a,i;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u(!0),t={__file:"wp_export",version:2,content:x},c=!1,!ae){e.next=7;break}return e.next=6,J(ae);case 6:c=e.sent;case 7:if(!1===c||"gutenberg"===c.template_type){e.next=9;break}return e.abrupt("return");case 9:return r=c?Object(N.stringifyUrl)({url:window.tiTpc.endpoint+"templates/"+ae,query:re(re({},ne(tiTpc.params,"meta")),{},{meta:JSON.stringify(tiTpc.params.meta),template_name:F,link:M})}):Object(N.stringifyUrl)({url:window.tiTpc.endpoint+"templates",query:re(re({},ne(tiTpc.params,"meta")),{},{meta:JSON.stringify(tiTpc.params.meta),template_name:F,template_type:"gutenberg",template_site_slug:Q||"",template_thumbnail:G||"",link:M})}),e.prev=10,e.next=13,S()({url:r,method:"POST",data:t,parse:!1});case 13:if(!(a=e.sent).ok){e.next=19;break}return e.next=17,a.json();case 17:(i=e.sent).message?h(i.message,{type:"snackbar"}):(window.localStorage.setItem("tpcCacheBuster",V()),v(Object(n.__)("Template saved."),{type:"snackbar"}),i.template_id?(ie(i.template_id),ve(i.template_id)):ve());case 19:e.next=24;break;case 21:e.prev=21,e.t0=e.catch(10),e.t0.message&&h(e.t0.message,{type:"snackbar"});case 24:u(!1);case 25:case"end":return e.stop()}}),e,null,[[10,21]])})));return function(){return e.apply(this,arguments)}}(),ve=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ae,t=null;return"post"===U?t=new wp.api.models.Post({id:L}):"page"===U&&(t=new wp.api.models.Page({id:L})),t.set("meta",{_ti_tpc_template_id:e,_ti_tpc_template_sync:K,_ti_tpc_screenshot_url:Oe,_ti_tpc_site_slug:le,_ti_tpc_published:!be}),t.save()};return["post","page"].includes(U)?Object(b.createElement)(b.Fragment,null,Object(b.createElement)(C.PluginBlockSettingsMenuItem,{label:Object(n.__)("Save to Neve Cloud"),icon:"none",onClick:function(){return c(!0)}}),Object(b.createElement)(C.PluginSidebarMoreMenuItem,{icon:Object(b.createElement)(T.Icon,{icon:y}),target:"ti-tpc"},Object(n.__)("Templates Cloud")),Object(b.createElement)(C.PluginSidebar,{name:"ti-tpc",title:Object(n.__)("Templates Cloud"),className:"ti-tpc-components-panel"},Object(b.createElement)(T.PanelBody,null,Object(n.__)("Save this page as a template in your Templates Cloud library."),Object(b.createElement)(T.Button,{isPrimary:!0,isBusy:l,disabled:l,onClick:he},Object(n.__)("Save Page to Neve Cloud")),Object(b.createElement)(T.ToggleControl,{label:Object(n.__)("Automatically sync to the cloud"),checked:K,onChange:function(){return Y(!K)}})),O&&Object(b.createElement)(T.PanelBody,null,Object(b.createElement)("h4",null,Object(n.__)("Publish Settings")),Object(b.createElement)(T.TextControl,{label:Object(n.__)("Screenshot URL"),value:Oe,type:"url",onChange:je}),Object(b.createElement)(T.TextControl,{label:Object(n.__)("Site Slug"),value:le,help:Object(n.__)("Use `general` to publish this as a global template. Otherwise use the starter site slug to make it available as a single page for the starter site."),type:"url",onChange:ue}),Object(b.createElement)((function(){if(!O)return null;var e=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u("publishing"),e.next=3,X(H,Q,G,!q,M).then((function(e){e.success&&(fe(!be),ve(),v(be?Object(n.__)("Template Unpublished."):Object(n.__)("Template Published."),{type:"snackbar"}))}));case 3:u(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(b.createElement)(T.Button,{isSecondary:!0,onClick:e,disabled:!1!==l,className:d()({"is-loading":"publishing"===l})},be&&("publishing"===l?Object(n.__)("Unpublishing"):Object(n.__)("Unpublish")),!be&&("publishing"===l?Object(n.__)("Publishing"):Object(n.__)("Publish")))}),null),Object(b.createElement)(ee,null))),r&&Object(b.createElement)(T.Modal,{title:Object(n.__)("Save Template"),onRequestClose:function(){return c(!1)}},Object(b.createElement)(T.TextControl,{label:Object(n.__)("Template Name"),value:f,onChange:g}),Object(b.createElement)(T.Button,{isPrimary:!0,isBusy:l,disabled:l,onClick:ye},Object(n.__)("Save")))):null},icon:y})}]);
|
1 |
+
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var c=t[n]={i:n,l:!1,exports:{}};return e[n].call(c.exports,c,c.exports,r),c.l=!0,c.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)r.d(n,c,function(t){return e[t]}.bind(null,c));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=30)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=window.regeneratorRuntime},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.primitives},function(e,t){function r(e,t,r,n,c,a,o){try{var i=e[a](o),s=i.value}catch(e){return void r(e)}i.done?t(s):Promise.resolve(s).then(n,c)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(c,a){var o=e.apply(t,n);function i(e){r(o,c,a,i,s,"next",e)}function s(e){r(o,c,a,i,s,"throw",e)}i(void 0)}))}}},function(e,t,r){var n=r(22),c=r(23),a=r(24),o=r(26);e.exports=function(e,t){return n(e)||c(e,t)||a(e,t)||o()}},function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function c(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)&&n.length){var o=c.apply(null,n);o&&e.push(o)}else if("object"===a)for(var i in n)r.call(n,i)&&n[i]&&e.push(i)}}return e.join(" ")}e.exports?(c.default=c,e.exports=c):void 0===(n=function(){return c}.apply(t,[]))||(e.exports=n)}()},function(e,t,r){"use strict";const n=r(27),c=r(28),a=r(29);function o(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function i(e,t){return t.encode?t.strict?n(e):encodeURIComponent(e):e}function s(e,t){return t.decode?c(e):e}function l(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function u(e){const t=(e=l(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function p(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function m(e,t){o((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{const c="string"==typeof r&&r.includes(e.arrayFormatSeparator),a="string"==typeof r&&!c&&s(r,e).includes(e.arrayFormatSeparator);r=a?s(r,e):r;const o=c||a?r.split(e.arrayFormatSeparator).map(t=>s(t,e)):null===r?r:s(r,e);n[t]=o};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),n=Object.create(null);if("string"!=typeof e)return n;if(!(e=e.trim().replace(/^[?#&]/,"")))return n;for(const c of e.split("&")){let[e,o]=a(t.decode?c.replace(/\+/g," "):c,"=");o=void 0===o?null:["comma","separator"].includes(t.arrayFormat)?o:s(o,t),r(s(e,t),o,n)}for(const e of Object.keys(n)){const r=n[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=p(r[e],t);else n[e]=p(r,t)}return!1===t.sort?n:(!0===t.sort?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce((e,t)=>{const r=n[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(r):e[t]=r,e},Object.create(null))}t.extract=u,t.parse=m,t.stringify=(e,t)=>{if(!e)return"";o((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const c=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[i(t,e),"[",c,"]"].join("")]:[...r,[i(t,e),"[",i(c,e),"]=",i(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[i(t,e),"[]"].join("")]:[...r,[i(t,e),"[]=",i(n,e)].join("")];case"comma":case"separator":return t=>(r,n)=>null==n||0===n.length?r:0===r.length?[[i(t,e),"=",i(n,e)].join("")]:[[r,i(n,e)].join(e.arrayFormatSeparator)];default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,i(t,e)]:[...r,[i(t,e),"=",i(n,e)].join("")]}}(t),c={};for(const t of Object.keys(e))r(t)||(c[t]=e[t]);const a=Object.keys(c);return!1!==t.sort&&a.sort(t.sort),a.map(r=>{const c=e[r];return void 0===c?"":null===c?i(r,t):Array.isArray(c)?c.reduce(n(r),[]).join("&"):i(r,t)+"="+i(c,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,n]=a(e,"#");return Object.assign({url:r.split("?")[0]||"",query:m(u(e),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:s(n,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0},r);const n=l(e.url).split("?")[0]||"",c=t.extract(e.url),a=t.parse(c,{sort:!1}),o=Object.assign(a,e.query);let s=t.stringify(o,r);s&&(s="?"+s);let u=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(u="#"+i(e.fragmentIdentifier,r)),`${n}${s}${u}`}},function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t){e.exports=window.wp.apiFetch},function(e,t){e.exports=window.wp.blocks},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.editPost},,,function(e,t){e.exports=window.wp.plugins},function(e,t){function r(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=r=function(e){return typeof e}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(t)}e.exports=r},function(e,t){e.exports=window.wp.blockEditor},function(e,t){e.exports=window.wp.keycodes},function(e,t,r){},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,c=!1,a=void 0;try{for(var o,i=e[Symbol.iterator]();!(n=(o=i.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){c=!0,a=e}finally{try{n||null==i.return||i.return()}finally{if(c)throw a}}return r}}},function(e,t,r){var n=r(25);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,r){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())},function(e,t,r){"use strict";var n=new RegExp("%[a-f0-9]{2}","gi"),c=new RegExp("(%[a-f0-9]{2})+","gi");function a(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],a(r),a(n))}function o(e){try{return decodeURIComponent(e)}catch(c){for(var t=e.match(n),r=1;r<t.length;r++)t=(e=a(t,r).join("")).match(n);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},r=c.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0])}catch(e){var n=o(r[0]);n!==r[0]&&(t[r[0]]=n)}r=c.exec(e)}t["%C2"]="�";for(var a=Object.keys(t),i=0;i<a.length;i++){var s=a[i];e=e.replace(new RegExp(s,"g"),t[s])}return e}(e)}}},function(e,t,r){"use strict";e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]}},function(e,t,r){"use strict";r.r(t);var n=r(1),c=r(17),a=r(12),o=(r(21),r(10)),i=r.n(o),s=r(4);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){i()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var p={isFetching:!0,isPreview:!1,tab:3===parseInt(window.tiTpc.tier)?"library":"templates",templates:[],patterns:[],library:{items:[],currentPage:0,totalPages:0},preview:{type:"templates",item:{}}};Object(s.registerStore)("tpc/block-editor",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,t=arguments.length>1?arguments[1]:void 0;return"SET_FETCHING"===t.type?u(u({},e),{},{isFetching:t.isFetching}):"TOGGLE_PREVIEW"===t.type?u(u({},e),{},{isPreview:!e.isPreview}):"UPDATE_CURRENT_TAB"===t.type?u(u({},e),{},{tab:t.tab,isPreview:!1}):"UPDATE_TEMPLATES"===t.type?u(u({},e),{},{templates:{items:t.items,currentPage:Number(t.currentPage),totalPages:Number(t.totalPages)}}):"UPDATE_PATTERNS"===t.type?u(u({},e),{},{patterns:t.items}):"UPDATE_LIBRARY"===t.type?u(u({},e),{},{library:{items:t.items,currentPage:Number(t.currentPage),totalPages:Number(t.totalPages)}}):"SET_PREVIEW_DATA"===t.type?u(u({},e),{},{preview:t.preview}):e},selectors:{isFetching:function(e){return e.isFetching},isPreview:function(e){return e.isPreview},getCurrentTab:function(e){return e.tab},getTemplates:function(e){return e.templates},getPatterns:function(e){return e.patterns},getLibrary:function(e){return e.library},getPreview:function(e){return e.preview}},actions:{setFetching:function(e){return{type:"SET_FETCHING",isFetching:e}},togglePreview:function(e){return{type:"TOGGLE_PREVIEW",isPreview:e}},updateCurrentTab:function(e){return{type:"UPDATE_CURRENT_TAB",tab:e}},updateTemplates:function(e,t,r){return{type:"UPDATE_TEMPLATES",items:e,currentPage:t,totalPages:r}},updatePatterns:function(e){return{type:"UPDATE_PATTERNS",items:e}},updateLibrary:function(e,t,r){return{type:"UPDATE_LIBRARY",items:e,currentPage:t,totalPages:r}},setPreviewData:function(e){return{type:"SET_PREVIEW_DATA",preview:e}}}});var m,b=r(0),f=r(8),d=r.n(f),O=wp.primitives,g=O.Path,j=O.SVG,y=function(e){var t=e.className;return Object(b.createElement)(j,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:d()(["tpc-icon",t])},Object(b.createElement)(g,{d:"M22.8063 24H1.19365C0.534714 24 0 23.4653 0 22.8063V1.19365C0 0.534714 0.534714 0 1.19365 0H22.8063C23.4653 0 24 0.534714 24 1.19365V22.8063C24 23.4653 23.4653 24 22.8063 24Z",fill:"#14171C"}),Object(b.createElement)(g,{d:"M19.8466 20.8187V7.39687V4.43164H16.884H3.45947L6.422 7.39687H16.884V17.8562L19.8466 20.8187Z",fill:"white"}),Object(b.createElement)(g,{d:"M10.138 14.1429L10.1407 17.0838L12.7764 19.7195L12.7656 11.5152L4.55859 11.5044L7.19435 14.1375L10.138 14.1429Z",fill:"white"}))},h=function(){return Object(b.createElement)(j,{width:"100",height:"100",viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"tpc-template-cloud-icon"},Object(b.createElement)(g,{d:"M95.0264 100H4.97356C2.22797 100 0 97.772 0 95.0264V4.97356C0 2.22797 2.22797 0 4.97356 0H95.0264C97.772 0 100 2.22797 100 4.97356V95.0264C100 97.772 97.772 100 95.0264 100Z",fill:"#0366D6"}),Object(b.createElement)(g,{d:"M82.6941 86.7448V30.8205V18.4653H70.3502H14.4146L26.7584 30.8205H70.3502V74.401L82.6941 86.7448Z",fill:"white"}),Object(b.createElement)(g,{d:"M42.2416 58.9291L42.2528 71.183L53.2352 82.1653L53.1902 47.9806L18.9941 47.9355L29.9765 58.9066L42.2416 58.9291Z",fill:"white"}))},v=r(3),w=r.n(v),_=r(6),E=r.n(_),k=r(7),P=r.n(k),x=r(11),S=r.n(x),T=r(2),C=r(14),N=r(9),B=new Uint8Array(16);function D(){if(!m&&!(m="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return m(B)}for(var I=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,A=function(e){return"string"==typeof e&&I.test(e)},F=[],L=0;L<256;++L)F.push((L+256).toString(16).substr(1));var V=function(e,t,r){var n=(e=e||{}).random||(e.rng||D)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var c=0;c<16;++c)t[r+c]=n[c];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(F[e[t+0]]+F[e[t+1]]+F[e[t+2]]+F[e[t+3]]+"-"+F[e[t+4]]+F[e[t+5]]+"-"+F[e[t+6]]+F[e[t+7]]+"-"+F[e[t+8]]+F[e[t+9]]+"-"+F[e[t+10]]+F[e[t+11]]+F[e[t+12]]+F[e[t+13]]+F[e[t+14]]+F[e[t+15]]).toLowerCase();if(!A(r))throw TypeError("Stringified UUID is invalid");return r}(n)};function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function M(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?U(Object(r),!0).forEach((function(t){i()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var R=lodash.omit,z=Object(s.dispatch)("tpc/block-editor"),H=z.updateLibrary,G=z.updateTemplates,Q=Object(s.dispatch)("core/notices").createNotice,q=function(e){Q("warning",e,{context:"themeisle-blocks/notices/templates-cloud",isDismissible:!0})},$=function(){var e=E()(w.a.mark((function e(){var t,r,n,c,a,o,i,s=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:{},r=M(M({cache:localStorage.getItem("tpcCacheBuster")},R(tiTpc.params,"meta")),{},{per_page:12,page:0,premade:!0,template_site_slug:"general"},t),n=Object(N.stringifyUrl)({url:tiTpc.endpoint+"page-templates",query:r}),e.prev=3,e.next=6,S()({url:n,method:"GET",parse:!1});case 6:if(!(c=e.sent).ok){e.next=16;break}return e.next=10,c.json();case 10:if(!(a=e.sent).message){e.next=13;break}return e.abrupt("return",q(a.message));case 13:o=c.headers.get("x-wp-totalpages"),i=r.page,G(a,i,o);case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(3),e.t0.message&&q(e.t0.message);case 21:case"end":return e.stop()}}),e,null,[[3,18]])})));return function(){return e.apply(this,arguments)}}(),W=function(){var e=E()(w.a.mark((function e(){var t,r,n,c,a,o,i,s=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:{},r=M({per_page:12,page:0},t),n=Object(N.stringifyUrl)({url:tiTpc.endpoint+"templates",query:M(M({cache:localStorage.getItem("tpcCacheBuster")},R(tiTpc.params,"meta")),r)}),e.prev=3,e.next=6,S()({url:n,method:"GET",parse:!1});case 6:if(!(c=e.sent).ok){e.next=16;break}return e.next=10,c.json();case 10:if(!(a=e.sent).message){e.next=13;break}return e.abrupt("return",q(a.message));case 13:o=c.headers.get("x-wp-totalpages"),i=r.page,H(a,i,o);case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(3),e.t0.message&&q(e.t0.message);case 21:case"end":return e.stop()}}),e,null,[[3,18]])})));return function(){return e.apply(this,arguments)}}(),Z=function(){var e=E()(w.a.mark((function e(t){var r,n,c;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(N.stringifyUrl)({url:"".concat(tiTpc.endpoint,"templates/").concat(t.template_id),query:M(M({cache:localStorage.getItem("tpcCacheBuster")},R(tiTpc.params,"meta")),{},{meta:JSON.stringify(tiTpc.params.meta)},t)}),e.prev=1,e.next=4,S()({url:r,method:"POST",parse:!1});case 4:if(!(n=e.sent).ok){e.next=11;break}return e.next=8,n.json();case 8:if(!(c=e.sent).message){e.next=11;break}return e.abrupt("return",q(c.message));case 11:return localStorage.setItem("tpcCacheBuster",V()),e.next=14,$();case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(1),e.t0.message&&q(e.t0.message);case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t){return e.apply(this,arguments)}}(),J=function(){var e=E()(w.a.mark((function e(t){var r,n,c;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(N.stringifyUrl)({url:"".concat(window.tiTpc.endpoint,"templates/").concat(t),query:M({cache:localStorage.getItem("tpcCacheBuster")},R(tiTpc.params,"meta"))}),e.prev=1,e.next=4,S()({url:r,method:"GET",parse:!1});case 4:if(!(n=e.sent).ok){e.next=12;break}return e.next=8,n.json();case 8:if(!(c=e.sent).message){e.next=11;break}return e.abrupt("return",!1);case 11:return e.abrupt("return",c);case 12:e.next=17;break;case 14:return e.prev=14,e.t0=e.catch(1),e.abrupt("return",!1);case 17:case"end":return e.stop()}}),e,null,[[1,14]])})));return function(t){return e.apply(this,arguments)}}(),K=function(){var e=E()(w.a.mark((function e(t){var r,n,c;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(N.stringifyUrl)({url:"".concat(tiTpc.endpoint,"templates/").concat(t,"/import"),query:M({cache:localStorage.getItem("tpcCacheBuster")},R(tiTpc.params,"meta"))}),n={},e.prev=2,e.next=5,S()({url:r,method:"GET",parse:!1});case 5:if(!(c=e.sent).ok){e.next=12;break}return e.next=9,c.json();case 9:if(!(n=e.sent).message){e.next=12;break}return e.abrupt("return",q(n.message));case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(2),e.t0.message&&q(e.t0.message);case 17:return e.abrupt("return",n);case 18:case"end":return e.stop()}}),e,null,[[2,14]])})));return function(t){return e.apply(this,arguments)}}(),Y=function(){var e=E()(w.a.mark((function e(t,r){var n,c,a;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Object(N.stringifyUrl)({url:"".concat(tiTpc.endpoint,"templates/").concat(t),query:M({cache:localStorage.getItem("tpcCacheBuster"),_method:"DELETE"},R(tiTpc.params,"meta"))}),e.prev=1,e.next=4,S()({url:n,method:"POST"});case 4:if(!(c=e.sent).ok){e.next=11;break}return e.next=8,c.json();case 8:if(!(a=e.sent).message){e.next=11;break}return e.abrupt("return",q(a.message));case 11:return localStorage.setItem("tpcCacheBuster",V()),e.next=14,W(r);case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(1),e.t0.message&&q(e.t0.message);case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t,r){return e.apply(this,arguments)}}(),X=function(){var e=E()(w.a.mark((function e(t,r,n,c,a){var o,i,s;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=Object(N.stringifyUrl)({url:"".concat(tiTpc.endpoint,"templates/").concat(t,"/publish"),query:M({cache:localStorage.getItem("tpcCacheBuster"),method:"POST",template_site_slug:r,template_thumbnail:n,premade:c?"yes":"no",link:a},R(tiTpc.params,"meta"))}),e.prev=1,e.next=4,S()({url:o,method:"POST",headers:{Authorization:"Bearer ".concat(tiTpc.bearer||""," ")}});case 4:if(!(i=e.sent).ok){e.next=14;break}return e.next=8,i.json();case 8:if(!(s=e.sent).message){e.next=12;break}return q(s.message),e.abrupt("return",{success:!1});case 12:e.next=17;break;case 14:if(!i.message){e.next=17;break}return q(i.message),e.abrupt("return",{success:!1});case 17:return localStorage.setItem("tpcCacheBuster",V()),e.abrupt("return",{success:!0});case 21:if(e.prev=21,e.t0=e.catch(1),!e.t0.message){e.next=26;break}return q(e.t0.message),e.abrupt("return",{success:!1});case 26:case"end":return e.stop()}}),e,null,[[1,21]])})));return function(t,r,n,c,a){return e.apply(this,arguments)}}(),ee=function(){var e=Object(s.useSelect)((function(e){return e("core/notices").getNotices("themeisle-blocks/notices/templates-cloud")})),t=Object(s.useDispatch)("core/notices").removeNotice;return Object(b.createElement)("div",{className:"notices"},e.map((function(e){return Object(b.createElement)(T.Notice,{key:e.id,status:e.status,isDismissible:e.isDismissible,onRemove:function(){return t(e.id,"themeisle-blocks/notices/templates-cloud")},actions:e.actions},e.content)})))};function te(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function re(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?te(Object(r),!0).forEach((function(t){i()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):te(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ne=lodash.omit,ce=r(18),ae=r.n(ce),oe=r(13),ie=r(5),se=Object(b.createElement)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(b.createElement)(ie.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"})),le=Object(b.createElement)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(b.createElement)(ie.Path,{d:"M10.2 3.28c3.53 0 6.43 2.61 6.92 6h2.08l-3.5 4-3.5-4h2.32c-.45-1.97-2.21-3.45-4.32-3.45-1.45 0-2.73.71-3.54 1.78L4.95 5.66C6.23 4.2 8.11 3.28 10.2 3.28zm-.4 13.44c-3.52 0-6.43-2.61-6.92-6H.8l3.5-4c1.17 1.33 2.33 2.67 3.5 4H5.48c.45 1.97 2.21 3.45 4.32 3.45 1.45 0 2.73-.71 3.54-1.78l1.71 1.95c-1.28 1.46-3.15 2.38-5.25 2.38z"})),ue=Object(b.createElement)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(b.createElement)(ie.Path,{d:"M13 11.9l3.3-3.4-1.1-1-3.2 3.3-3.2-3.3-1.1 1 3.3 3.4-3.5 3.6 1 1L12 13l3.5 3.5 1-1z"}));function pe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function me(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?pe(Object(r),!0).forEach((function(t){i()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var be=function(e){var t=e.closeModal,r=e.getOrder,c=e.getSearchQuery,a=Object(s.useDispatch)("tpc/block-editor"),o=a.setFetching,i=a.updateCurrentTab,l={templates:Object(n.__)("Page Templates")};3===parseInt(tiTpc.tier)&&(l.library=Object(n.__)("My Library"));var u=Object(s.useSelect)((function(e){return e("tpc/block-editor").isFetching()})),p=Object(s.useSelect)((function(e){return e("tpc/block-editor").isPreview()})),m=Object(s.useSelect)((function(e){return e("tpc/block-editor").getCurrentTab()})),f=function(){var e=E()(w.a.mark((function e(){var t;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return window.localStorage.setItem("tpcCacheBuster",V()),o(!0),t=r(),e.next=5,$(me({search:c()},t));case 5:return e.next=7,W(me({search:c()},t));case 7:o(!1);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(b.createElement)("div",{className:"modal-header"},Object(b.createElement)("div",{className:"left"},Object(b.createElement)(T.Icon,{icon:h})),Object(b.createElement)("div",{className:"center"},Object.keys(l).map((function(e){return Object(b.createElement)(T.Button,{key:e,onClick:function(){return i(e)},className:d()("tabs",{"is-active":e===m})},l[e])}))),Object(b.createElement)("div",{className:"right"},"library"===m&&!p&&Object(b.createElement)(T.ButtonGroup,null,Object(b.createElement)(T.Button,{label:Object(n.__)("Re-sync Library"),icon:le,disabled:u,className:d()("is-sync",{"is-loading":u}),onClick:f})),Object(b.createElement)(T.Button,{label:Object(n.__)("Close Modal"),icon:ue,onClick:t})))},fe=r(19),de=function(e){var t=e.isFetching,r=e.importBlocks,c=Object(oe.useViewportMatch)("large",">="),o=Object(oe.useViewportMatch)("large","<="),i=Object(oe.useViewportMatch)("small",">="),l=Object(oe.useViewportMatch)("small","<="),u=1400;c||o||!i||l?!(c||o||i||l)&&(u=600):u=960;var p=Object(s.useDispatch)("tpc/block-editor"),m=p.setFetching,f=p.togglePreview,d=Object(s.useSelect)((function(e){return e("tpc/block-editor").getPreview()})).item;Object(b.useEffect)((function(){h()}),[]);var O=Object(b.useState)(""),g=P()(O,2),j=g[0],y=g[1],h=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return m(!0),e.next=3,v();case 3:m(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),v=function(){var e=E()(w.a.mark((function e(){var t;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return m(!0),e.next=3,K(d.template_id);case 3:(t=e.sent).__file&&t.content&&"wp_export"===t.__file&&y(t.content),m(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(b.createElement)("div",{className:"tpc-modal-content"},Object(b.createElement)("div",{className:"preview-header"},Object(b.createElement)("div",{className:"left"},d.template_name||Object(n.__)("Template")),Object(b.createElement)("div",{className:"right"},Object(b.createElement)(T.Button,{isSecondary:!0,onClick:f},Object(n.__)("Close Preview")),Object(b.createElement)(T.Button,{isPrimary:!0,isBusy:t,disabled:t,onClick:function(){f(),r(j,d.meta||[])}},Object(n.__)("Import")))),t?Object(b.createElement)(T.Placeholder,null,Object(b.createElement)(T.Spinner,null)):Object(b.createElement)("div",{className:"preview-content"},Object(b.createElement)(fe.BlockPreview,{blocks:Object(a.parse)(j),viewportWidth:u})))},Oe=Object(b.createElement)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(b.createElement)(ie.Path,{d:"M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"})),ge=Object(b.createElement)(ie.SVG,{xmlns:"https://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(b.createElement)(ie.Path,{d:"M3 15h18v-2H3v2zm0 4h18v-2H3v2zm0-8h18V9H3v2zm0-6v2h18V5H3z"})),je=Object(b.createElement)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(b.createElement)(ie.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7.8 16.5H5c-.3 0-.5-.2-.5-.5v-6.2h6.8v6.7zm0-8.3H4.5V5c0-.3.2-.5.5-.5h6.2v6.7zm8.3 7.8c0 .3-.2.5-.5.5h-6.2v-6.8h6.8V19zm0-7.8h-6.8V4.5H19c.3 0 .5.2.5.5v6.2z",fillRule:"evenodd",clipRule:"evenodd"})),ye=r(20);function he(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ve(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?he(Object(r),!0).forEach((function(t){i()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):he(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var we={date:Object(n.__)("Date"),template_name:Object(n.__)("Name"),modified:Object(n.__)("Last Modified")},_e=function(e){var t=e.layout,r=e.sortingOrder,c=e.setLayout,a=e.isSearch,o=e.searchQuery,i=e.onSearch,s=e.setSearchQuery,l=e.setSortingOrder,u=e.changeOrder;return Object(b.createElement)("div",{className:"filters"},Object(b.createElement)("div",{className:"display-sorting"},Object(b.createElement)("div",{className:"sorting-label"},Object(n.__)("Sort by")),Object(b.createElement)("div",{className:"sorting-filter"},Object.keys(we).map((function(e){return Object(b.createElement)(T.Button,{key:e,className:d()({"is-selected":e===r.orderby,"is-asc":"ASC"===r.order}),onClick:function(){var t={order:"DESC",orderby:e};e===r.orderby&&"DESC"===r.order&&(t.order="ASC"),l(ve({},t)),u(ve({},t))}},we[e])})))),Object(b.createElement)("div",{className:"view-filters"},Object(b.createElement)("div",{className:"search-filters"},Object(b.createElement)("input",{placeholder:Object(n.__)("Search for a template…"),className:"filter-search",value:o,onChange:function(e){return s(e.target.value)},onKeyDown:function(e){e.keyCode===ye.ENTER&&i()}}),a?Object(b.createElement)(T.Button,{label:Object(n.__)("Clear search query"),icon:ue,onClick:function(){s(""),i("")}}):Object(b.createElement)(T.Button,{label:Object(n.__)("Search"),icon:Oe,onClick:function(){return i()}})),Object(b.createElement)(T.Button,{label:Object(n.__)("List View"),icon:ge,onClick:function(){return c("list")},isPressed:"list"===t}),Object(b.createElement)(T.Button,{label:Object(n.__)("Grid View"),icon:je,onClick:function(){return c("grid")},isPressed:"grid"===t})))},Ee=Object(b.createElement)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(b.createElement)(ie.Path,{d:"M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"})),ke=Object(b.createElement)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(b.createElement)(ie.Path,{d:"M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"})),Pe=Object(b.createElement)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(b.createElement)(ie.Path,{d:"M12 4h3c.6 0 1 .4 1 1v1H3V5c0-.6.5-1 1-1h3c.2-1.1 1.3-2 2.5-2s2.3.9 2.5 2zM8 4h3c-.2-.6-.9-1-1.5-1S8.2 3.4 8 4zM4 7h11l-.9 10.1c0 .5-.5.9-1 .9H5.9c-.5 0-.9-.4-1-.9L4 7z"})),xe=Object(b.createElement)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(b.createElement)(ie.Path,{d:"M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z"})),Se=function(e){var t=e.sortingOrder,r=e.layout,c=e.item,a=e.importBlocks,o=e.deletable,i=Object(s.useDispatch)("tpc/block-editor"),l=i.togglePreview,u=i.setPreviewData,p=Object(b.useState)(!1),m=P()(p,2),f=m[0],O=m[1],g=Object(b.useState)(!1),j=P()(g,2),y=j[0],h=j[1],v=Object(b.useState)(c.template_name),_=P()(v,2),k=_[0],x=_[1],S=function(){var e=E()(w.a.mark((function e(){var t;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return O("importing"),e.next=3,K(c.template_id);case 3:(t=e.sent).__file&&t.content&&"wp_export"===t.__file&&a(t.content,c.meta||[]),O(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),C=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return O("updating"),e.next=3,Z({template_id:c.template_id,template_name:k||c.template_name},t);case 3:return e.next=5,W(t);case 5:O(!1),h(!y);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),N=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.confirm(Object(n.__)("Are you sure you want to delete this template?"))){e.next=2;break}return e.abrupt("return",!1);case 2:return O("deleting"),e.next=5,Y(c.template_id,t);case 5:O(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),B=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l(),u({type:"library",item:c});case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();if("grid"===r){var D={backgroundImage:"url(".concat(c.template_thumbnail,")")};return Object(b.createElement)("div",{key:c.template_id,className:"table-grid"},Object(b.createElement)("div",{style:D,className:d()("grid-preview",{"is-loading":y||!1!==f})},Object(b.createElement)("div",{className:"preview-actions"},Object(b.createElement)(T.Button,{isSecondary:!0,disabled:!1!==f,onClick:B},Object(n.__)("Preview")),Object(b.createElement)(T.Button,{isPrimary:!0,isBusy:"importing"===f,disabled:!1!==f,onClick:S},Object(n.__)("Import")),o&&Object(b.createElement)("div",{className:"preview-controls"},!c.link&&Object(b.createElement)(T.Button,{label:Object(n.__)("Edit"),icon:"updating"===f?le:Ee,disabled:y||!1!==f,className:d()({"is-loading":"updating"===f}),onClick:function(){return h(!y)}},y&&Object(b.createElement)(T.Popover,{onFocusOutside:function(){return h(!y)},className:"controls-popover"},Object(b.createElement)("div",{className:"popover-content"},Object(b.createElement)(T.TextControl,{label:Object(n.__)("Template Name"),value:k,onChange:x}),Object(b.createElement)(T.Button,{label:Object(n.__)("Update"),icon:"updating"===f?le:ke,disabled:!1!==f,className:d()({"is-loading":"updating"===f}),onClick:C})))),Object(b.createElement)(T.Button,{label:Object(n.__)("Delete"),icon:"deleting"===f?le:Pe,disabled:!1!==f,className:d()({"is-loading":"deleting"===f}),onClick:N})))),Object(b.createElement)("div",{className:"card-footer"},Object(b.createElement)("p",null,c.template_name)))}var I=d()("actions",{"no-controls":!o});return Object(b.createElement)("div",{key:c.template_id,className:"table-row"},Object(b.createElement)("div",{className:"row-title"},Object(b.createElement)(T.Icon,{icon:xe}),y?Object(b.createElement)(T.TextControl,{label:Object(n.__)("Template Name"),hideLabelFromVision:!0,value:k,onChange:x}):c.template_name),o&&Object(b.createElement)("div",{className:"row-controls"},c.link?Object(b.createElement)(T.Tooltip,{text:Object(n.__)("This template is synced to a page.")},Object(b.createElement)(T.Button,{label:Object(n.__)("Edit"),icon:Ee,disabled:!0},Object(n.__)("Edit"))):Object(b.createElement)(T.Button,{label:y?Object(n.__)("Update"):Object(n.__)("Edit"),icon:y?"updating"===f?le:ke:Ee,disabled:!1!==f,className:d()({"is-loading":"updating"===f}),onClick:y?C:function(){return h(!y)}},y?Object(n.__)("Update"):Object(n.__)("Edit")),Object(b.createElement)(T.Button,{label:Object(n.__)("Delete"),icon:"deleting"===f?le:Pe,disabled:!1!==f,className:d()({"is-loading":"deleting"===f}),onClick:N},"deleting"===f?Object(n.__)("Deleting")+"...":Object(n.__)("Delete"))),Object(b.createElement)("div",{className:I},Object(b.createElement)(T.Button,{isSecondary:!0,disabled:!1!==f,onClick:B},Object(n.__)("Preview")),Object(b.createElement)(T.Button,{isPrimary:!0,isBusy:"importing"===f,disabled:!1!==f,onClick:S},Object(n.__)("Import"))))},Te=function(e){var t=e.total,r=e.current,n=e.onChange;if(t<2)return null;for(var c=[],a=function(e){var t=e===r;c.push(Object(b.createElement)(T.Button,{key:"page-".concat(e),isPrimary:t,disabled:t,onClick:function(){return n(e)}},e+1))},o=0;o<t;o++)a(o);return Object(b.createElement)(T.ButtonGroup,{className:"pagination"},c)};function Ce(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ne(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(r),!0).forEach((function(t){i()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ce(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Be=Object(s.withSelect)((function(e,t){var r=t.isGeneral?e("tpc/block-editor").getTemplates():e("tpc/block-editor").getLibrary(),n=r.items;return{items:void 0===n?[]:n,currentPage:r.currentPage,totalPages:r.totalPages}}))((function(e){var t=e.importBlocks,r=e.isGeneral,c=void 0!==r&&r,a=e.isFetching,o=e.items,i=e.currentPage,l=e.totalPages,u=e.getOrder,p=e.setQuery,m=e.getSearchQuery,f=e.setSorting,O=Object(s.useDispatch)("tpc/block-editor").setFetching,g=Object(b.useState)("grid"),j=P()(g,2),y=j[0],h=j[1],v=Object(b.useState)({templates:!1,library:!1}),_=P()(v,2),k=_[0],x=_[1],S=function(e){return x(Ne(Ne({},k),{},c?{templates:e}:{library:e}))},C=function(){return c?k.templates:k.library},N=function(){var e=E()(w.a.mark((function e(){var t;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(O(!0),t=u(),!c){e.next=7;break}return e.next=5,$(Ne({search:m()},t));case 5:e.next=9;break;case 7:return e.next=9,W(Ne({search:m()},t));case 9:O(!1);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();Object(b.useEffect)((function(){o&&o.length>0||N()}),[c]);var B=function(){var e=E()(w.a.mark((function e(t){var r;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(O(!0),r=u(),!c){e.next=7;break}return e.next=5,$(Ne({search:m(),page:t},r));case 5:e.next=9;break;case 7:return e.next=9,W(Ne({search:m(),page:t},r));case 9:O(!1);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),D=function(){var e=E()(w.a.mark((function e(){var t,r,n=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>0&&void 0!==n[0]?n[0]:m(),O(!0),S(!!t),r=u(),!c){e.next=9;break}return e.next=7,$(Ne({search:t},r));case 7:e.next=11;break;case 9:return e.next=11,W(Ne({search:t},r));case 11:O(!1);case 12:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),I=function(){var e=E()(w.a.mark((function e(t){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(O(!0),!c){e.next=6;break}return e.next=4,$(Ne(Ne({},t),{},{search:m()}));case 4:e.next=8;break;case 6:return e.next=8,W(Ne(Ne({},t),{},{search:m()}));case 8:O(!1);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();if(a)return Object(b.createElement)(b.Fragment,null,Object(b.createElement)(_e,{layout:y,sortingOrder:u(),setLayout:h,isSearch:C(),searchQuery:m(),onSearch:D,setSearchQuery:p,setSortingOrder:f,changeOrder:I}),Object(b.createElement)(T.Placeholder,null,Object(b.createElement)(T.Spinner,null)));if(!Boolean(o.length))return Object(b.createElement)("div",{className:"table-content"},Object(b.createElement)(_e,{layout:y,sortingOrder:u(),setLayout:h,isSearch:C(),searchQuery:m(),onSearch:D,setSearchQuery:p,setSortingOrder:f,changeOrder:I}),Object(n.__)("No templates available. Add a new one?"));var A=d()("table-content",{"is-grid":"grid"===y});return Object(b.createElement)(b.Fragment,null,Object(b.createElement)(_e,{layout:y,sortingOrder:u(),setLayout:h,isSearch:C(),searchQuery:m(),onSearch:D,setSearchQuery:p,setSortingOrder:f,changeOrder:I}),Object(b.createElement)("div",{className:A},o.map((function(e){return Object(b.createElement)(Se,{sortingOrder:u(),deletable:!c,key:e.template_id,layout:y,item:e,importBlocks:t})}))),Object(b.createElement)(Te,{onChange:B,current:i,total:l}))})),De=Object(s.withSelect)((function(e){var t=e("tpc/block-editor"),r=t.isPreview,n=t.isFetching,c=t.getCurrentTab;return{isPreview:r(),isFetching:n(),currentTab:c()}}))((function(e){var t=e.importBlocks,r=e.getOrder,c=e.setQuery,a=e.getSearchQuery,o=e.setSorting,i=e.isPreview,s=e.currentTab,l=e.isFetching;return i&&"library"===s?Object(b.createElement)(de,{isFetching:l,importBlocks:t}):Object(b.createElement)("div",{className:"tpc-modal-content"},Object(b.createElement)(ee,null),["templates","library"].includes(s)&&Object(b.createElement)(Be,{isFetching:l,isGeneral:"templates"===s,importBlocks:t,getOrder:r,setQuery:c,getSearchQuery:a,setSorting:o}),"patterns"===s&&Object(n.__)("We are still working on this. Please check back later. Thank you!"))})),Ie=function(e){var t=e.title,r=e.leftButtons,c=e.rightButtons,a=e.heading,o=e.previewUrl,i=Object(N.stringifyUrl)({url:o,query:{tpcpreview:"yes"}}),s=t||Object(n.__)("Preview");return Object(b.createElement)("div",{className:"ob-preview single-templates"},Object(b.createElement)("div",{className:"preview"},Object(b.createElement)("iframe",{title:s,src:i,frameBorder:"0"}),Object(b.createElement)("div",{className:"loading"},Object(b.createElement)(T.Dashicon,{icon:"update",size:50}))),Object(b.createElement)("div",{className:"bottom-bar"},r&&Object(b.createElement)("div",{className:"navigator"},r),a&&Object(b.createElement)("h2",{className:"heading"},a),c&&Object(b.createElement)("div",{className:"actions"},c)))};function Ae(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Fe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ae(Object(r),!0).forEach((function(t){i()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ae(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Le=lodash.omit,Ve=Object(oe.compose)(Object(s.withSelect)((function(e){var t=e("tpc/block-editor"),r=t.isPreview,n=t.getPreview,c=t.getCurrentTab;return{isPreview:r(),currentTab:c(),previewData:n().item}})),Object(s.withDispatch)((function(e){var t=e("core/block-editor"),r=t.removeBlock,n=t.replaceBlocks,c=e("tpc/block-editor").togglePreview;return{removeBlock:r,replaceBlocks:n,closePreview:function(){return c(!1)}}})))((function(e){var t=e.clientId,r=e.isPreview,c=e.previewData,o=e.currentTab,i=e.removeBlock,l=e.replaceBlocks,u=e.closePreview,p=Object(s.useSelect)((function(e){return{type:e("core/editor").getEditedPostAttribute("type")}})).type,m=Object(s.useDispatch)("core/notices").createErrorNotice,f=Object(s.useDispatch)("core/editor").editPost,d=Object(s.useDispatch)("tpc/block-editor"),O=d.updateLibrary,g=d.updateTemplates,j=Object(b.useState)(!1),y=P()(j,2),h=y[0],v=y[1],_=Object(b.useState)(!1),k=P()(_,2),x=k[0],S=k[1],C=Object(b.useState)({templates:"",library:""}),N=P()(C,2),B=N[0],D=N[1],I=Object(b.useState)({templates:{order:"DESC",orderby:"date"},library:{order:"DESC",orderby:"date"}}),A=P()(I,2),F=A[0],L=A[1],V="templates"===o,U=function(){return V?B.templates:B.library},M=function(){return V?F.templates:F.library},R=function(e){try{var t=JSON.parse(e);if(t&&"object"===ae()(t))return t}catch(e){}return!1},z=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(O([]),g([]),0<Object.keys(R(r)||{}).length&&["post","page"].includes(p)){var n=JSON.parse(r),c=Fe({},Le(Fe({},n),"_wp_page_template"));f({meta:c}),"page"===p&&n._wp_page_template&&f({template:n._wp_page_template})}l(t,Object(a.parse)(e))},H=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return S(!0),e.next=3,K(c.template_id).then((function(e){if(e.__file&&e.content&&"wp_export"===e.__file)return u(),S(!1),z(e.content,c.meta||[]),!1;m(Object(n.__)("Something went wrong while importing. Please try again."),{type:"snackbar"}),S(!1),i(t)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),G=function(){v(!1),S(!1),i(t)};return Object(b.useEffect)((function(){setTimeout((function(){v(!0)}),100)}),[]),h?Object(b.createElement)(b.Fragment,null,Object(b.createElement)(T.Modal,{onRequestClose:G,shouldCloseOnEsc:!1,shouldCloseOnClickOutside:!r||"templates"!==o,isDismissible:!1,overlayClassName:"tpc-template-cloud-modal"},Object(b.createElement)(be,{closeModal:G,getOrder:M,getSearchQuery:U}),Object(b.createElement)(De,{importBlocks:z,getOrder:M,setQuery:function(e){return D(Fe(Fe({},B),{},V?{templates:e}:{library:e}))},getSearchQuery:U,setSorting:function(e){return L(Fe(Fe({},F),{},V?{templates:e}:{library:e}))}}),Object(b.createElement)((function(){if(!r||"templates"!==o)return null;var e=c.link,t=c.template_name;return Object(b.createElement)(T.Modal,{isDismissible:!1,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,className:"tpc-preview-wrap-modal"},Object(b.createElement)(Ie,{previewUrl:e,heading:t,leftButtons:Object(b.createElement)(b.Fragment,null,Object(b.createElement)(T.Button,{disabled:x,icon:se,onClick:u})),rightButtons:Object(b.createElement)(T.Button,{disabled:x,isPrimary:!0,onClick:H},x?Object(n.__)("Importing")+"...":Object(n.__)("Import"))}),";")}),null))):null}));Object(a.registerBlockType)("ti-tpc/templates-cloud",{title:Object(n.__)("Templates Cloud"),description:Object(n.__)("A cloud based templates library which enables you to create ready-made website in no time."),icon:y,category:"design",keywords:["templates cloud","patterns","template library"],supports:{html:!1},edit:Ve,save:function(){return null}}),3===parseInt(tiTpc.tier)&&Object(c.registerPlugin)("ti-tpc",{render:function(){var e=Object(b.useState)(!1),t=P()(e,2),r=t[0],c=t[1],o=Object(b.useState)(!1),i=P()(o,2),l=i[0],u=i[1],p=Object(b.useState)(""),m=P()(p,2),f=m[0],O=m[1],g=window.tiTpc.canPredefine,j=Object(s.useDispatch)("core/notices"),h=j.createErrorNotice,v=j.createSuccessNotice,_=Object(s.useDispatch)("core/editor").editPost,k=Object(s.useSelect)((function(e){var t=e("core/block-editor"),r=t.getSelectedBlockCount,n=t.getSelectedBlock,c=t.getMultiSelectedBlocks,o=1===r()?n():c();return Object(a.serialize)(o)}),[]),x=Object(s.useSelect)((function(e){var t=(0,e("core/block-editor").getBlocks)();return Object(a.serialize)(t)}),[]),B=Object(s.useSelect)((function(e){return(0,e("core/editor").getEditedPostAttribute)("meta")}),[]),D=Object(s.useSelect)((function(e){return(0,e("core/editor").getEditedPostAttribute)("template")}),[]);Object(b.useEffect)((function(){var e=window.tiTpc.metaKeys;window.tiTpc.params.meta=Object.fromEntries(Object.entries(B||{}).filter((function(t){var r=P()(t,1)[0];return e.includes(r)}))),D?window.tiTpc.params.meta._wp_page_template=D:""===D&&window.tiTpc.params.meta._wp_page_template&&delete window.tiTpc.params.meta._wp_page_template}),[B,D]);var I=Object(s.useSelect)((function(e){return{meta:e("core/editor").getEditedPostAttribute("meta")||{},postId:e("core/editor").getEditedPostAttribute("id"),type:e("core/editor").getEditedPostAttribute("type"),link:e("core/editor").getEditedPostAttribute("link"),postTitle:e("core/editor").getEditedPostAttribute("title")||Object(n.__)("Template")}})),A=I.meta,F=I.postTitle,L=I.postId,U=I.type,M=I.link,R=I.meta,z=R._ti_tpc_template_sync,H=R._ti_tpc_template_id,G=R._ti_tpc_screenshot_url,Q=R._ti_tpc_site_slug,q=R._ti_tpc_published,$=Object(s.useSelect)((function(e,t){var r=t.forceIsSaving,n=e("core/editor"),c=n.isSavingPost,a=n.isPublishingPost,o=n.isAutosavingPost,i=r||c(),s=o();return(a()||i)&&!s})),W=Object(b.useState)(z),Z=P()(W,2),K=Z[0],Y=Z[1],te=Object(b.useState)(H),ce=P()(te,2),ae=ce[0],oe=ce[1],ie=Object(b.useState)(Q),se=P()(ie,2),le=se[0],ue=se[1],pe=Object(b.useState)(q),me=P()(pe,2),be=me[0],fe=me[1],de=Object(b.useState)(G),Oe=P()(de,2),ge=Oe[0],je=Oe[1];Object(b.useEffect)((function(){_({meta:re(re({},A),{},{_ti_tpc_template_sync:K,_ti_tpc_template_id:ae,_ti_tpc_screenshot_url:ge,_ti_tpc_site_slug:le,_ti_tpc_published:be})})}),[K,ae,ge,le,be]),Object(b.useEffect)((function(){$&&K&&he()}),[$,K]);var ye=function(){var e=E()(w.a.mark((function e(){var t,r,a,o,i;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u(!0),t={__file:"wp_export",version:2,content:k},r=Object(N.stringifyUrl)({url:window.tiTpc.endpoint+"templates",query:re(re({},ne(tiTpc.params,"meta")),{},{template_name:f,template_type:"gutenberg"})}),e.prev=3,e.next=6,S()({url:r,method:"POST",data:t,parse:!1});case 6:if(!(a=e.sent).ok){e.next=12;break}return e.next=10,a.json();case 10:(o=e.sent).message?("Sorry, you are not allowed to do that."===(i=o.message)&&(i=Object(n.__)("Could not save template, check that the template is not empty.")),h(i,{type:"snackbar"})):(window.localStorage.setItem("tpcCacheBuster",V()),v(Object(n.__)("Template saved."),{type:"snackbar"}));case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(3),e.t0.message&&h(e.t0.message,{type:"snackbar"});case 17:u(!1),c(!1),O("");case 20:case"end":return e.stop()}}),e,null,[[3,14]])})));return function(){return e.apply(this,arguments)}}(),he=function(){var e=E()(w.a.mark((function e(){var t,r,c,a,o,i;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u(!0),t={__file:"wp_export",version:2,content:x},c=!1,!ae){e.next=7;break}return e.next=6,J(ae);case 6:c=e.sent;case 7:if(!1===c||"gutenberg"===c.template_type){e.next=9;break}return e.abrupt("return");case 9:return r=c?Object(N.stringifyUrl)({url:window.tiTpc.endpoint+"templates/"+ae,query:re(re({},ne(tiTpc.params,"meta")),{},{meta:JSON.stringify(tiTpc.params.meta),template_name:F,link:M})}):Object(N.stringifyUrl)({url:window.tiTpc.endpoint+"templates",query:re(re({},ne(tiTpc.params,"meta")),{},{meta:JSON.stringify(tiTpc.params.meta),template_name:F,template_type:"gutenberg",template_site_slug:Q||"",template_thumbnail:G||"",link:M})}),e.prev=10,e.next=13,S()({url:r,method:"POST",data:t,parse:!1});case 13:if(!(a=e.sent).ok){e.next=19;break}return e.next=17,a.json();case 17:(o=e.sent).message?("Sorry, you are not allowed to do that."===(i=o.message)&&(i=Object(n.__)("Could not save template, check that the template is not empty.")),h(i,{type:"snackbar"})):(window.localStorage.setItem("tpcCacheBuster",V()),v(Object(n.__)("Template saved."),{type:"snackbar"}),o.template_id?(oe(o.template_id),ve(o.template_id)):ve());case 19:e.next=24;break;case 21:e.prev=21,e.t0=e.catch(10),e.t0.message&&h(e.t0.message,{type:"snackbar"});case 24:u(!1);case 25:case"end":return e.stop()}}),e,null,[[10,21]])})));return function(){return e.apply(this,arguments)}}(),ve=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ae,t=null;return"post"===U?t=new wp.api.models.Post({id:L}):"page"===U&&(t=new wp.api.models.Page({id:L})),t.set("meta",{_ti_tpc_template_id:e,_ti_tpc_template_sync:K,_ti_tpc_screenshot_url:ge,_ti_tpc_site_slug:le,_ti_tpc_published:!be}),t.save()};return["post","page"].includes(U)?Object(b.createElement)(b.Fragment,null,Object(b.createElement)(C.PluginBlockSettingsMenuItem,{label:Object(n.__)("Save to Neve Cloud"),icon:"none",onClick:function(){return c(!0)}}),Object(b.createElement)(C.PluginSidebarMoreMenuItem,{icon:Object(b.createElement)(T.Icon,{icon:y}),target:"ti-tpc"},Object(n.__)("Templates Cloud")),Object(b.createElement)(C.PluginSidebar,{name:"ti-tpc",title:Object(n.__)("Templates Cloud"),className:"ti-tpc-components-panel"},Object(b.createElement)(T.PanelBody,null,Object(n.__)("Save this page as a template in your Templates Cloud library."),Object(b.createElement)(T.Button,{isPrimary:!0,isBusy:l,disabled:l,onClick:he},Object(n.__)("Save Page to Neve Cloud")),Object(b.createElement)(T.ToggleControl,{label:Object(n.__)("Automatically sync to the cloud"),checked:K,onChange:function(){return Y(!K)}})),g&&Object(b.createElement)(T.PanelBody,null,Object(b.createElement)("h4",null,Object(n.__)("Publish Settings")),Object(b.createElement)(T.TextControl,{label:Object(n.__)("Screenshot URL"),value:ge,type:"url",onChange:je}),Object(b.createElement)(T.TextControl,{label:Object(n.__)("Site Slug"),value:le,help:Object(n.__)("Use `general` to publish this as a global template. Otherwise use the starter site slug to make it available as a single page for the starter site."),type:"url",onChange:ue}),Object(b.createElement)((function(){if(!g)return null;var e=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u("publishing"),e.next=3,X(H,Q,G,!q,M).then((function(e){e.success&&(fe(!be),ve(),v(be?Object(n.__)("Template Unpublished."):Object(n.__)("Template Published."),{type:"snackbar"}))}));case 3:u(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(b.createElement)(T.Button,{isSecondary:!0,onClick:e,disabled:!1!==l,className:d()({"is-loading":"publishing"===l})},be&&("publishing"===l?Object(n.__)("Unpublishing"):Object(n.__)("Unpublish")),!be&&("publishing"===l?Object(n.__)("Publishing"):Object(n.__)("Publish")))}),null),Object(b.createElement)(ee,null))),r&&Object(b.createElement)(T.Modal,{title:Object(n.__)("Save Template"),onRequestClose:function(){return c(!1)}},Object(b.createElement)(T.TextControl,{label:Object(n.__)("Template Name"),value:f,onChange:O}),Object(b.createElement)(T.Button,{isPrimary:!0,isBusy:l,disabled:l,onClick:ye},Object(n.__)("Save")))):null},icon:y})}]);
|
editor/src/extension.js
CHANGED
@@ -182,7 +182,15 @@ const Exporter = () => {
|
|
182 |
const res = await response.json();
|
183 |
|
184 |
if ( res.message ) {
|
185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
type: 'snackbar',
|
187 |
} );
|
188 |
} else {
|
@@ -263,7 +271,15 @@ const Exporter = () => {
|
|
263 |
const res = await response.json();
|
264 |
|
265 |
if ( res.message ) {
|
266 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
type: 'snackbar',
|
268 |
} );
|
269 |
} else {
|
182 |
const res = await response.json();
|
183 |
|
184 |
if ( res.message ) {
|
185 |
+
let message = res.message;
|
186 |
+
if (
|
187 |
+
message === 'Sorry, you are not allowed to do that.'
|
188 |
+
) {
|
189 |
+
message = __(
|
190 |
+
'Could not save template, check that the template is not empty.'
|
191 |
+
);
|
192 |
+
}
|
193 |
+
createErrorNotice( message, {
|
194 |
type: 'snackbar',
|
195 |
} );
|
196 |
} else {
|
271 |
const res = await response.json();
|
272 |
|
273 |
if ( res.message ) {
|
274 |
+
let message = res.message;
|
275 |
+
if (
|
276 |
+
message === 'Sorry, you are not allowed to do that.'
|
277 |
+
) {
|
278 |
+
message = __(
|
279 |
+
'Could not save template, check that the template is not empty.'
|
280 |
+
);
|
281 |
+
}
|
282 |
+
createErrorNotice( message, {
|
283 |
type: 'snackbar',
|
284 |
} );
|
285 |
} else {
|
includes/Admin.php
CHANGED
@@ -177,7 +177,7 @@ class Admin {
|
|
177 |
return array(
|
178 |
'nonce' => wp_create_nonce( 'wp_rest' ),
|
179 |
'assets' => TIOB_URL . '/assets/',
|
180 |
-
'upgradeURL' =>
|
181 |
'strings' => array(
|
182 |
/* translators: %s - Theme name */
|
183 |
'starterSitesTabDescription' => __( 'Choose from multiple unique demos, specially designed for you, that can be installed with a single click. You just need to choose your favorite, and we will take care of everything else.', 'templates-patterns-collection' ),
|
@@ -208,7 +208,7 @@ class Admin {
|
|
208 |
// We use these strings in Neve already so lets reuse the translations here.
|
209 |
'text' => esc_html__( 'Purchase the Business plan or higher to get instant access to all Premium Starter Site Templates — including Expert Sites — and much more.', 'neve' ), //phpcs:ignore WordPress.WP.I18n.TextDomainMismatch
|
210 |
'cta' => __( 'Get Neve Business', 'neve' ), //phpcs:ignore WordPress.WP.I18n.TextDomainMismatch
|
211 |
-
'url' => 'https://themeisle.com/themes/neve/upgrade
|
212 |
);
|
213 |
|
214 |
return $notifications;
|
@@ -340,8 +340,9 @@ class Admin {
|
|
340 |
'ti_onboarding_outbound_query_args',
|
341 |
array(
|
342 |
'utm_medium' => 'about-' . get_template(),
|
343 |
-
'utm_source' =>
|
344 |
-
'
|
|
|
345 |
)
|
346 |
),
|
347 |
$theme_support['pro_link']
|
177 |
return array(
|
178 |
'nonce' => wp_create_nonce( 'wp_rest' ),
|
179 |
'assets' => TIOB_URL . '/assets/',
|
180 |
+
'upgradeURL' => apply_filters( 'neve_upgrade_link_from_child_theme_filter', tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'freevspro' ) ),
|
181 |
'strings' => array(
|
182 |
/* translators: %s - Theme name */
|
183 |
'starterSitesTabDescription' => __( 'Choose from multiple unique demos, specially designed for you, that can be installed with a single click. You just need to choose your favorite, and we will take care of everything else.', 'templates-patterns-collection' ),
|
208 |
// We use these strings in Neve already so lets reuse the translations here.
|
209 |
'text' => esc_html__( 'Purchase the Business plan or higher to get instant access to all Premium Starter Site Templates — including Expert Sites — and much more.', 'neve' ), //phpcs:ignore WordPress.WP.I18n.TextDomainMismatch
|
210 |
'cta' => __( 'Get Neve Business', 'neve' ), //phpcs:ignore WordPress.WP.I18n.TextDomainMismatch
|
211 |
+
'url' => tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', '<builder_name>notice', 'nevedashboard' ),
|
212 |
);
|
213 |
|
214 |
return $notifications;
|
340 |
'ti_onboarding_outbound_query_args',
|
341 |
array(
|
342 |
'utm_medium' => 'about-' . get_template(),
|
343 |
+
'utm_source' => 'wpadmin',
|
344 |
+
'utm_content' => 'neve',
|
345 |
+
'utm_campaign' => $slug,
|
346 |
)
|
347 |
),
|
348 |
$theme_support['pro_link']
|
includes/Main.php
CHANGED
@@ -19,7 +19,7 @@ class Main {
|
|
19 |
*
|
20 |
* @var string Version string.
|
21 |
*/
|
22 |
-
const VERSION = '1.1.
|
23 |
/**
|
24 |
* Sites Library API URL.
|
25 |
*
|
19 |
*
|
20 |
* @var string Version string.
|
21 |
*/
|
22 |
+
const VERSION = '1.1.26';
|
23 |
/**
|
24 |
* Sites Library API URL.
|
25 |
*
|
includes/Sites_Listing.php
CHANGED
@@ -60,7 +60,7 @@ class Sites_Listing {
|
|
60 |
),
|
61 |
),
|
62 |
),
|
63 |
-
'pro_link' => 'https://themeisle.com/themes/neve/upgrade/',
|
64 |
);
|
65 |
$this->add_sites_library_support();
|
66 |
}
|
60 |
),
|
61 |
),
|
62 |
),
|
63 |
+
'pro_link' => tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'onboarding' ),
|
64 |
);
|
65 |
$this->add_sites_library_support();
|
66 |
}
|
languages/templates-patterns-collection.pot
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
# This file is distributed under the GPLv3.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Templates Patterns Collection 1.1.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/templates-patterns-collection\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"POT-Creation-Date: 2022-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.6.0\n"
|
15 |
"X-Domain: templates-patterns-collection\n"
|
@@ -56,174 +56,174 @@ msgstr ""
|
|
56 |
msgid "Open %s"
|
57 |
msgstr ""
|
58 |
|
59 |
-
#: includes/Admin.php:
|
60 |
msgid "Hi! We've noticed you were using a child theme of Zelle before. To make your transition easier, we can help you keep the same homepage settings you had before but in original Zelle's style, by converting it into an Elementor template."
|
61 |
msgstr ""
|
62 |
|
63 |
-
#: includes/Admin.php:
|
64 |
#: includes/TI_Beaver.php:412
|
65 |
#: assets/src/Components/StarterSiteCard.js:61
|
66 |
msgid "Preview"
|
67 |
msgstr ""
|
68 |
|
69 |
-
#: includes/Admin.php:
|
70 |
#: includes/TI_Beaver.php:413
|
71 |
#: assets/src/Components/PreviewFrame.js:95
|
72 |
#: assets/src/Components/StarterSiteCard.js:69
|
73 |
msgid "Import"
|
74 |
msgstr ""
|
75 |
|
76 |
-
#: includes/Admin.php:
|
77 |
msgid "Get the PRO version!"
|
78 |
msgstr ""
|
79 |
|
80 |
-
#: includes/Admin.php:
|
81 |
msgid "Importing"
|
82 |
msgstr ""
|
83 |
|
84 |
-
#: includes/Admin.php:
|
85 |
#: includes/Elementor.php:81
|
86 |
#: includes/TI_Beaver.php:391
|
87 |
#: assets/src/Components/Migration.js:165
|
88 |
msgid "Cancel"
|
89 |
msgstr ""
|
90 |
|
91 |
-
#: includes/Admin.php:
|
92 |
msgid "Loading"
|
93 |
msgstr ""
|
94 |
|
95 |
-
#: includes/Admin.php:
|
96 |
#: assets/src/Components/ImportModal.js:733
|
97 |
#: assets/src/Components/Migration.js:198
|
98 |
msgid "View Website"
|
99 |
msgstr ""
|
100 |
|
101 |
-
#: includes/Admin.php:
|
102 |
#: assets/src/Components/ImportModal.js:743
|
103 |
msgid "Add your own content"
|
104 |
msgstr ""
|
105 |
|
106 |
-
#: includes/Admin.php:
|
107 |
#: assets/src/Components/ImportModal.js:724
|
108 |
msgid "Back to Sites Library"
|
109 |
msgstr ""
|
110 |
|
111 |
-
#: includes/Admin.php:
|
112 |
msgid "Note"
|
113 |
msgstr ""
|
114 |
|
115 |
-
#: includes/Admin.php:
|
116 |
msgid "Advanced Options"
|
117 |
msgstr ""
|
118 |
|
119 |
-
#: includes/Admin.php:
|
120 |
#: assets/src/Components/ImportModal.js:297
|
121 |
msgid "Plugins"
|
122 |
msgstr ""
|
123 |
|
124 |
-
#: includes/Admin.php:
|
125 |
msgid "General"
|
126 |
msgstr ""
|
127 |
|
128 |
-
#: includes/Admin.php:
|
129 |
msgid "Keep current layout"
|
130 |
msgstr ""
|
131 |
|
132 |
-
#: includes/Admin.php:
|
133 |
#: includes/Elementor.php:96
|
134 |
#: includes/TI_Beaver.php:425
|
135 |
msgid "Search"
|
136 |
msgstr ""
|
137 |
|
138 |
-
#: includes/Admin.php:
|
139 |
#: assets/src/Components/ImportModal.js:195
|
140 |
msgid "Content"
|
141 |
msgstr ""
|
142 |
|
143 |
-
#: includes/Admin.php:
|
144 |
#: assets/src/Components/ImportModal.js:203
|
145 |
msgid "Customizer"
|
146 |
msgstr ""
|
147 |
|
148 |
-
#: includes/Admin.php:
|
149 |
#: assets/src/Components/ImportModal.js:207
|
150 |
msgid "Widgets"
|
151 |
msgstr ""
|
152 |
|
153 |
-
#: includes/Admin.php:
|
154 |
#: assets/src/Components/ImportModal.js:197
|
155 |
msgid "We recommend you backup your website content before attempting a full site import."
|
156 |
msgstr ""
|
157 |
|
158 |
-
#: includes/Admin.php:
|
159 |
msgid "Due to copyright issues, some of the demo images will not be imported and will be replaced by placeholder images."
|
160 |
msgstr ""
|
161 |
|
162 |
-
#: includes/Admin.php:
|
163 |
msgid "Some of the demo images will not be imported and will be replaced by placeholder images."
|
164 |
msgstr ""
|
165 |
|
166 |
-
#: includes/Admin.php:
|
167 |
msgid "Here is our own collection of related images you can use for your site."
|
168 |
msgstr ""
|
169 |
|
170 |
-
#: includes/Admin.php:
|
171 |
#: assets/src/Components/ImportModal.js:672
|
172 |
#: assets/src/Components/Migration.js:131
|
173 |
msgid "Content was successfully imported. Enjoy your new site!"
|
174 |
msgstr ""
|
175 |
|
176 |
-
#: includes/Admin.php:
|
177 |
msgid "Available in the PRO version"
|
178 |
msgstr ""
|
179 |
|
180 |
-
#: includes/Admin.php:
|
181 |
msgid "Copy error code"
|
182 |
msgstr ""
|
183 |
|
184 |
-
#: includes/Admin.php:
|
185 |
msgid "Download error log"
|
186 |
msgstr ""
|
187 |
|
188 |
-
#: includes/Admin.php:
|
189 |
msgid "To import this demo you have to install the following plugins:"
|
190 |
msgstr ""
|
191 |
|
192 |
#. translators: 1 - 'here'.
|
193 |
-
#: includes/Admin.php:
|
194 |
msgid "It seems that Rest API is not working properly on your website. Read about how you can fix it %1$s."
|
195 |
msgstr ""
|
196 |
|
197 |
-
#: includes/Admin.php:
|
198 |
msgid "here"
|
199 |
msgstr ""
|
200 |
|
201 |
#. translators: 1 - 'get in touch'.
|
202 |
-
#: includes/Admin.php:
|
203 |
msgid "Hi! It seems there is a configuration issue with your server that's causing the import to fail. Please %1$s with us with the error code below, so we can help you fix this."
|
204 |
msgstr ""
|
205 |
|
206 |
-
#: includes/Admin.php:
|
207 |
-
#: includes/Admin.php:
|
208 |
msgid "get in touch"
|
209 |
msgstr ""
|
210 |
|
211 |
#. translators: 1 - 'troubleshooting guide'.
|
212 |
-
#: includes/Admin.php:
|
213 |
msgid "Hi! It seems there is a configuration issue with your server that's causing the import to fail. Take a look at our %1$s to see if any of the proposed solutions work."
|
214 |
msgstr ""
|
215 |
|
216 |
-
#: includes/Admin.php:
|
217 |
msgid "troubleshooting guide"
|
218 |
msgstr ""
|
219 |
|
220 |
#. translators: 1 - 'get in touch'.
|
221 |
-
#: includes/Admin.php:
|
222 |
msgid "If none of the solutions in the guide work, please %1$s with us with the error code below, so we can help you fix this."
|
223 |
msgstr ""
|
224 |
|
225 |
#. translators: %s - 'WP_Filesystem'.
|
226 |
-
#: includes/Admin.php:
|
227 |
msgid "It seems that %s is not available. You can contact your site administrator or hosting provider to help you enable it."
|
228 |
msgstr ""
|
229 |
|
2 |
# This file is distributed under the GPLv3.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Templates Patterns Collection 1.1.26\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/templates-patterns-collection\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"POT-Creation-Date: 2022-09-13T14:36:11+00:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.6.0\n"
|
15 |
"X-Domain: templates-patterns-collection\n"
|
56 |
msgid "Open %s"
|
57 |
msgstr ""
|
58 |
|
59 |
+
#: includes/Admin.php:409
|
60 |
msgid "Hi! We've noticed you were using a child theme of Zelle before. To make your transition easier, we can help you keep the same homepage settings you had before but in original Zelle's style, by converting it into an Elementor template."
|
61 |
msgstr ""
|
62 |
|
63 |
+
#: includes/Admin.php:439
|
64 |
#: includes/TI_Beaver.php:412
|
65 |
#: assets/src/Components/StarterSiteCard.js:61
|
66 |
msgid "Preview"
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: includes/Admin.php:440
|
70 |
#: includes/TI_Beaver.php:413
|
71 |
#: assets/src/Components/PreviewFrame.js:95
|
72 |
#: assets/src/Components/StarterSiteCard.js:69
|
73 |
msgid "Import"
|
74 |
msgstr ""
|
75 |
|
76 |
+
#: includes/Admin.php:441
|
77 |
msgid "Get the PRO version!"
|
78 |
msgstr ""
|
79 |
|
80 |
+
#: includes/Admin.php:442
|
81 |
msgid "Importing"
|
82 |
msgstr ""
|
83 |
|
84 |
+
#: includes/Admin.php:443
|
85 |
#: includes/Elementor.php:81
|
86 |
#: includes/TI_Beaver.php:391
|
87 |
#: assets/src/Components/Migration.js:165
|
88 |
msgid "Cancel"
|
89 |
msgstr ""
|
90 |
|
91 |
+
#: includes/Admin.php:444
|
92 |
msgid "Loading"
|
93 |
msgstr ""
|
94 |
|
95 |
+
#: includes/Admin.php:445
|
96 |
#: assets/src/Components/ImportModal.js:733
|
97 |
#: assets/src/Components/Migration.js:198
|
98 |
msgid "View Website"
|
99 |
msgstr ""
|
100 |
|
101 |
+
#: includes/Admin.php:446
|
102 |
#: assets/src/Components/ImportModal.js:743
|
103 |
msgid "Add your own content"
|
104 |
msgstr ""
|
105 |
|
106 |
+
#: includes/Admin.php:447
|
107 |
#: assets/src/Components/ImportModal.js:724
|
108 |
msgid "Back to Sites Library"
|
109 |
msgstr ""
|
110 |
|
111 |
+
#: includes/Admin.php:448
|
112 |
msgid "Note"
|
113 |
msgstr ""
|
114 |
|
115 |
+
#: includes/Admin.php:449
|
116 |
msgid "Advanced Options"
|
117 |
msgstr ""
|
118 |
|
119 |
+
#: includes/Admin.php:450
|
120 |
#: assets/src/Components/ImportModal.js:297
|
121 |
msgid "Plugins"
|
122 |
msgstr ""
|
123 |
|
124 |
+
#: includes/Admin.php:451
|
125 |
msgid "General"
|
126 |
msgstr ""
|
127 |
|
128 |
+
#: includes/Admin.php:452
|
129 |
msgid "Keep current layout"
|
130 |
msgstr ""
|
131 |
|
132 |
+
#: includes/Admin.php:453
|
133 |
#: includes/Elementor.php:96
|
134 |
#: includes/TI_Beaver.php:425
|
135 |
msgid "Search"
|
136 |
msgstr ""
|
137 |
|
138 |
+
#: includes/Admin.php:454
|
139 |
#: assets/src/Components/ImportModal.js:195
|
140 |
msgid "Content"
|
141 |
msgstr ""
|
142 |
|
143 |
+
#: includes/Admin.php:455
|
144 |
#: assets/src/Components/ImportModal.js:203
|
145 |
msgid "Customizer"
|
146 |
msgstr ""
|
147 |
|
148 |
+
#: includes/Admin.php:456
|
149 |
#: assets/src/Components/ImportModal.js:207
|
150 |
msgid "Widgets"
|
151 |
msgstr ""
|
152 |
|
153 |
+
#: includes/Admin.php:457
|
154 |
#: assets/src/Components/ImportModal.js:197
|
155 |
msgid "We recommend you backup your website content before attempting a full site import."
|
156 |
msgstr ""
|
157 |
|
158 |
+
#: includes/Admin.php:458
|
159 |
msgid "Due to copyright issues, some of the demo images will not be imported and will be replaced by placeholder images."
|
160 |
msgstr ""
|
161 |
|
162 |
+
#: includes/Admin.php:459
|
163 |
msgid "Some of the demo images will not be imported and will be replaced by placeholder images."
|
164 |
msgstr ""
|
165 |
|
166 |
+
#: includes/Admin.php:460
|
167 |
msgid "Here is our own collection of related images you can use for your site."
|
168 |
msgstr ""
|
169 |
|
170 |
+
#: includes/Admin.php:461
|
171 |
#: assets/src/Components/ImportModal.js:672
|
172 |
#: assets/src/Components/Migration.js:131
|
173 |
msgid "Content was successfully imported. Enjoy your new site!"
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: includes/Admin.php:462
|
177 |
msgid "Available in the PRO version"
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: includes/Admin.php:463
|
181 |
msgid "Copy error code"
|
182 |
msgstr ""
|
183 |
|
184 |
+
#: includes/Admin.php:464
|
185 |
msgid "Download error log"
|
186 |
msgstr ""
|
187 |
|
188 |
+
#: includes/Admin.php:465
|
189 |
msgid "To import this demo you have to install the following plugins:"
|
190 |
msgstr ""
|
191 |
|
192 |
#. translators: 1 - 'here'.
|
193 |
+
#: includes/Admin.php:468
|
194 |
msgid "It seems that Rest API is not working properly on your website. Read about how you can fix it %1$s."
|
195 |
msgstr ""
|
196 |
|
197 |
+
#: includes/Admin.php:469
|
198 |
msgid "here"
|
199 |
msgstr ""
|
200 |
|
201 |
#. translators: 1 - 'get in touch'.
|
202 |
+
#: includes/Admin.php:473
|
203 |
msgid "Hi! It seems there is a configuration issue with your server that's causing the import to fail. Please %1$s with us with the error code below, so we can help you fix this."
|
204 |
msgstr ""
|
205 |
|
206 |
+
#: includes/Admin.php:474
|
207 |
+
#: includes/Admin.php:484
|
208 |
msgid "get in touch"
|
209 |
msgstr ""
|
210 |
|
211 |
#. translators: 1 - 'troubleshooting guide'.
|
212 |
+
#: includes/Admin.php:478
|
213 |
msgid "Hi! It seems there is a configuration issue with your server that's causing the import to fail. Take a look at our %1$s to see if any of the proposed solutions work."
|
214 |
msgstr ""
|
215 |
|
216 |
+
#: includes/Admin.php:479
|
217 |
msgid "troubleshooting guide"
|
218 |
msgstr ""
|
219 |
|
220 |
#. translators: 1 - 'get in touch'.
|
221 |
+
#: includes/Admin.php:483
|
222 |
msgid "If none of the solutions in the guide work, please %1$s with us with the error code below, so we can help you fix this."
|
223 |
msgstr ""
|
224 |
|
225 |
#. translators: %s - 'WP_Filesystem'.
|
226 |
+
#: includes/Admin.php:488
|
227 |
msgid "It seems that %s is not available. You can contact your site administrator or hosting provider to help you enable it."
|
228 |
msgstr ""
|
229 |
|
readme.txt
CHANGED
@@ -39,6 +39,15 @@ Yes, you can. You can either chose to import one template or the entire starter
|
|
39 |
|
40 |
== Changelog ==
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
##### [Version 1.1.25](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.24...v1.1.25) (2022-07-28)
|
43 |
|
44 |
- Improvements to Workflow
|
39 |
|
40 |
== Changelog ==
|
41 |
|
42 |
+
##### [Version 1.1.26](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.25...v1.1.26) (2022-09-13)
|
43 |
+
|
44 |
+
- Fix warding on toast message when saving empty templates
|
45 |
+
- Fix UTM URLs
|
46 |
+
- Fix Restricted Content plugin mapping
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
|
51 |
##### [Version 1.1.25](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.24...v1.1.25) (2022-07-28)
|
52 |
|
53 |
- Improvements to Workflow
|
templates-patterns-collection.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Templates Patterns Collection
|
4 |
* Description: This plugin is an add-on to Neve WordPress theme which offers access to Templates and Block Patterns library service to be used with the theme.
|
5 |
-
* Version: 1.1.
|
6 |
* Author: ThemeIsle
|
7 |
* Author URI: https://themeisle.com
|
8 |
* License: GPLv3
|
2 |
/**
|
3 |
* Plugin Name: Templates Patterns Collection
|
4 |
* Description: This plugin is an add-on to Neve WordPress theme which offers access to Templates and Block Patterns library service to be used with the theme.
|
5 |
+
* Version: 1.1.26
|
6 |
* Author: ThemeIsle
|
7 |
* Author URI: https://themeisle.com
|
8 |
* License: GPLv3
|
vendor/autoload.php
CHANGED
@@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
|
|
9 |
|
10 |
require_once __DIR__ . '/composer/autoload_real.php';
|
11 |
|
12 |
-
return
|
9 |
|
10 |
require_once __DIR__ . '/composer/autoload_real.php';
|
11 |
|
12 |
+
return ComposerAutoloaderInit4c83b32e0d1a231b07094383699cccb6::getLoader();
|
vendor/codeinwp/themeisle-sdk/CHANGELOG.md
CHANGED
@@ -1,3 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
##### [Version 3.2.24](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.23...v3.2.24) (2022-02-09)
|
2 |
|
3 |
Fix edge case issue on dismiss
|
1 |
+
##### [Version 3.2.29](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.28...v3.2.29) (2022-09-08)
|
2 |
+
|
3 |
+
* Adds compatibility mechanism
|
4 |
+
* Adds content utms
|
5 |
+
* Adds usage time on uninstall feedback
|
6 |
+
|
7 |
+
##### [Version 3.2.28](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.27...v3.2.28) (2022-08-30)
|
8 |
+
|
9 |
+
* Adds utm handler
|
10 |
+
* Improve promotions
|
11 |
+
|
12 |
+
##### [Version 3.2.27](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.26...v3.2.27) (2022-08-23)
|
13 |
+
|
14 |
+
- Add Promotion Module
|
15 |
+
Add the Promotion module for free plugins
|
16 |
+
|
17 |
+
##### [Version 3.2.26](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.25...v3.2.26) (2022-05-12)
|
18 |
+
|
19 |
+
- [Fix] Solve rollback sometimes not available
|
20 |
+
|
21 |
+
##### [Version 3.2.25](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.24...v3.2.25) (2022-03-28)
|
22 |
+
|
23 |
+
- Force update request after rollback
|
24 |
+
|
25 |
##### [Version 3.2.24](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.23...v3.2.24) (2022-02-09)
|
26 |
|
27 |
Fix edge case issue on dismiss
|
vendor/codeinwp/themeisle-sdk/assets/images/animation.jpg
ADDED
Binary file
|
vendor/codeinwp/themeisle-sdk/assets/images/conditions.jpg
ADDED
Binary file
|
vendor/codeinwp/themeisle-sdk/assets/images/css.jpg
ADDED
Binary file
|
vendor/codeinwp/themeisle-sdk/assets/js/build/index.asset.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php return array('dependencies' => array('wp-api', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '73443c6739f6cbdbb5fd');
|
vendor/codeinwp/themeisle-sdk/assets/js/build/index.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
(()=>{"use strict";var e={n:t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.element,o=window.wp.i18n,n=window.wp.blockEditor,s=window.wp.components,i=window.wp.compose,r=window.wp.data,l=window.wp.hooks,a=window.wp.api;var c=e.n(a);const d={button:{display:"flex",justifyContent:"center",width:"100%"},image:{padding:"20px 0"},skip:{container:{display:"flex",flexDirection:"column",alignItems:"center"},button:{fontSize:"9px"},poweredby:{fontSize:"9px",textTransform:"uppercase"}}},m={"blocks-css":{title:(0,o.__)("Custom CSS","textdomain"),description:(0,o.__)("Enable Otter Blocks to add Custom CSS for this block."),image:"css.jpg"},"blocks-animation":{title:(0,o.__)("Animations","textdomain"),description:(0,o.__)("Enable Otter Blocks to add Animations for this block."),image:"animation.jpg"},"blocks-conditions":{title:(0,o.__)("Visibility Conditions","textdomain"),description:(0,o.__)("Enable Otter Blocks to add Visibility Conditions for this block."),image:"conditions.jpg"}},w=e=>{let{onClick:n}=e;return(0,t.createElement)("div",{style:d.skip.container},(0,t.createElement)(s.Button,{style:d.skip.button,variant:"tertiary",onClick:n},(0,o.__)("Skip for now")),(0,t.createElement)("span",{style:d.skip.poweredby},(0,o.__)("Recommended by ")+window.themeisleSDKPromotions.product))},p=(0,i.createHigherOrderComponent)((e=>i=>{if(i.isSelected&&Boolean(window.themeisleSDKPromotions.showPromotion)){const[l,a]=(0,t.useState)(!1),[p,u]=(0,t.useState)("default"),[_,k]=(0,t.useState)(!1),[h,b,g]=(()=>{const{createNotice:e}=(0,r.dispatch)("core/notices"),[n,s]=(0,t.useState)({}),[i,l]=(0,t.useState)("loading"),a=()=>{c().loadPromise.then((async()=>{try{const e=new(c().models.Settings),t=await e.fetch();s(t)}catch(e){l("error")}finally{l("loaded")}}))};return(0,t.useEffect)((()=>{a()}),[]),[e=>null==n?void 0:n[e],function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,o.__)("Settings saved.","textdomain");l("saving");const i=new(c().models.Settings)({[t]:n}).save();i.success(((t,n)=>{"success"===n&&(l("loaded"),e("success",s,{isDismissible:!0,type:"snackbar"})),"error"===n&&(l("error"),e("error",(0,o.__)("An unknown error occurred.","textdomain"),{isDismissible:!0,type:"snackbar"})),a()})),i.error((t=>{l("error"),e("error",t.responseJSON.message?t.responseJSON.message:(0,o.__)("An unknown error occurred.","textdomain"),{isDismissible:!0,type:"snackbar"})}))},i]})(),y=async()=>{var e;a(!0),await("otter-blocks",new Promise((e=>{wp.updates.ajax("install-plugin",{slug:"otter-blocks",success:()=>{e({success:!0})},error:t=>{e({success:!1,code:t.errorCode})}})}))),b("themeisle_sdk_promotions_otter_installed",!Boolean(h("themeisle_sdk_promotions_otter_installed"))),await(e=window.themeisleSDKPromotions.activationUrl,new Promise((t=>{jQuery.get(e).done((()=>{t({success:!0})})).fail((()=>{t({success:!1})}))}))),a(!1),u("installed")},S=()=>"installed"===p?(0,t.createElement)("p",null,(0,t.createElement)("strong",null,(0,o.__)("Awesome! Refresh the page to see Otter Blocks in action."))):(0,t.createElement)(s.Button,{variant:"secondary",onClick:y,isBusy:l,style:d.button},(0,o.__)("Install & Activate Otter Blocks")),f=()=>{const e=JSON.parse(window.themeisleSDKPromotions.promotions_otter);e[window.themeisleSDKPromotions.showPromotion]=(new Date).getTime()/1e3|0,b("themeisle_sdk_promotions_otter",JSON.stringify(e)),window.themeisleSDKPromotions.showPromotion=!1};return(0,t.useEffect)((()=>{_&&f()}),[_]),_?(0,t.createElement)(e,i):(0,t.createElement)(t.Fragment,null,(0,t.createElement)(e,i),(0,t.createElement)(n.InspectorControls,null,Object.keys(m).map((e=>{if(e===window.themeisleSDKPromotions.showPromotion){const o=m[e];return(0,t.createElement)(s.PanelBody,{title:o.title,initialOpen:!1},(0,t.createElement)("p",null,o.description),(0,t.createElement)(S,null),(0,t.createElement)("img",{style:d.image,src:window.themeisleSDKPromotions.assets+o.image}),(0,t.createElement)(w,{onClick:()=>k(!0)}))}}))))}return(0,t.createElement)(e,i)}),"withInspectorControl");(0,r.select)("core/edit-site")||(0,l.addFilter)("editor.BlockEdit","themeisle-sdk/with-inspector-controls",p)})();
|
vendor/codeinwp/themeisle-sdk/load.php
CHANGED
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
14 |
return;
|
15 |
}
|
16 |
// Current SDK version and path.
|
17 |
-
$themeisle_sdk_version = '3.2.
|
18 |
$themeisle_sdk_path = dirname( __FILE__ );
|
19 |
|
20 |
global $themeisle_sdk_max_version;
|
@@ -71,3 +71,105 @@ if ( ! function_exists( 'themeisle_sdk_load_latest' ) ) :
|
|
71 |
}
|
72 |
endif;
|
73 |
add_action( 'init', 'themeisle_sdk_load_latest' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
return;
|
15 |
}
|
16 |
// Current SDK version and path.
|
17 |
+
$themeisle_sdk_version = '3.2.29';
|
18 |
$themeisle_sdk_path = dirname( __FILE__ );
|
19 |
|
20 |
global $themeisle_sdk_max_version;
|
71 |
}
|
72 |
endif;
|
73 |
add_action( 'init', 'themeisle_sdk_load_latest' );
|
74 |
+
|
75 |
+
if ( ! function_exists( 'tsdk_utmify' ) ) {
|
76 |
+
/**
|
77 |
+
* Utmify a link.
|
78 |
+
*
|
79 |
+
* @param string $url URL to add utms.
|
80 |
+
* @param string $area Area in page where this is used ( CTA, image, section name).
|
81 |
+
* @param string $location Location, such as customizer, about page.
|
82 |
+
*
|
83 |
+
* @return string
|
84 |
+
*/
|
85 |
+
function tsdk_utmify( $url, $area, $location = null ) {
|
86 |
+
static $current_page = null;
|
87 |
+
if ( $location === null && $current_page === null ) {
|
88 |
+
global $pagenow;
|
89 |
+
$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : $pagenow;
|
90 |
+
$current_page = isset( $screen->id ) ? $screen->id : ( ( $screen === null ) ? 'non-admin' : $screen );
|
91 |
+
$current_page = sanitize_key( str_replace( '.php', '', $current_page ) );
|
92 |
+
}
|
93 |
+
$location = $location === null ? $current_page : $location;
|
94 |
+
$content = sanitize_key(
|
95 |
+
trim(
|
96 |
+
str_replace(
|
97 |
+
[
|
98 |
+
'https://',
|
99 |
+
'themeisle.com',
|
100 |
+
'/themes/',
|
101 |
+
'/plugins/',
|
102 |
+
'/upgrade',
|
103 |
+
],
|
104 |
+
'',
|
105 |
+
$url
|
106 |
+
),
|
107 |
+
'/'
|
108 |
+
)
|
109 |
+
);
|
110 |
+
return esc_url_raw(
|
111 |
+
add_query_arg(
|
112 |
+
[
|
113 |
+
'utm_source' => 'wpadmin',
|
114 |
+
'utm_medium' => $location,
|
115 |
+
'utm_campaign' => $area,
|
116 |
+
'utm_content' => $content,
|
117 |
+
],
|
118 |
+
$url
|
119 |
+
)
|
120 |
+
);
|
121 |
+
}
|
122 |
+
|
123 |
+
add_filter( 'tsdk_utmify', 'tsdk_utmify', 10, 3 );
|
124 |
+
}
|
125 |
+
|
126 |
+
|
127 |
+
if ( ! function_exists( 'tsdk_lstatus' ) ) {
|
128 |
+
/**
|
129 |
+
* Check license status.
|
130 |
+
*
|
131 |
+
* @param string $file Product basefile.
|
132 |
+
*
|
133 |
+
* @return string Status.
|
134 |
+
*/
|
135 |
+
function tsdk_lstatus( $file ) {
|
136 |
+
return \ThemeisleSDK\Modules\Licenser::status( $file );
|
137 |
+
}
|
138 |
+
}
|
139 |
+
if ( ! function_exists( 'tsdk_lis_valid' ) ) {
|
140 |
+
/**
|
141 |
+
* Check if license is valid.
|
142 |
+
*
|
143 |
+
* @param string $file Product basefile.
|
144 |
+
*
|
145 |
+
* @return bool Validness.
|
146 |
+
*/
|
147 |
+
function tsdk_lis_valid( $file ) {
|
148 |
+
return \ThemeisleSDK\Modules\Licenser::is_valid( $file );
|
149 |
+
}
|
150 |
+
}
|
151 |
+
if ( ! function_exists( 'tsdk_lplan' ) ) {
|
152 |
+
/**
|
153 |
+
* Get license plan.
|
154 |
+
*
|
155 |
+
* @param string $file Product basefile.
|
156 |
+
*
|
157 |
+
* @return string Plan.
|
158 |
+
*/
|
159 |
+
function tsdk_lplan( $file ) {
|
160 |
+
return \ThemeisleSDK\Modules\Licenser::plan( $file );
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
if ( ! function_exists( 'tsdk_lkey' ) ) {
|
165 |
+
/**
|
166 |
+
* Get license key.
|
167 |
+
*
|
168 |
+
* @param string $file Product basefile.
|
169 |
+
*
|
170 |
+
* @return string Key.
|
171 |
+
*/
|
172 |
+
function tsdk_lkey( $file ) {
|
173 |
+
return \ThemeisleSDK\Modules\Licenser::key( $file );
|
174 |
+
}
|
175 |
+
}
|
vendor/codeinwp/themeisle-sdk/src/Loader.php
CHANGED
@@ -55,7 +55,8 @@ final class Loader {
|
|
55 |
'review',
|
56 |
'recommendation',
|
57 |
'notification',
|
58 |
-
|
|
|
59 |
];
|
60 |
|
61 |
/**
|
55 |
'review',
|
56 |
'recommendation',
|
57 |
'notification',
|
58 |
+
'promotions',
|
59 |
+
'compatibilities',
|
60 |
];
|
61 |
|
62 |
/**
|
vendor/codeinwp/themeisle-sdk/src/Modules/Compatibilities.php
ADDED
@@ -0,0 +1,236 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The compatibilities model class for ThemeIsle SDK
|
4 |
+
*
|
5 |
+
* @package ThemeIsleSDK
|
6 |
+
* @subpackage Modules
|
7 |
+
* @copyright Copyright (c) 2017, Marius Cristea
|
8 |
+
* @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
|
9 |
+
* @since 1.0.0
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace ThemeisleSDK\Modules;
|
13 |
+
|
14 |
+
use ThemeisleSDK\Common\Abstract_Module;
|
15 |
+
use ThemeisleSDK\Product;
|
16 |
+
|
17 |
+
// Exit if accessed directly.
|
18 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
19 |
+
exit;
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Promotions module for ThemeIsle SDK.
|
24 |
+
*/
|
25 |
+
class Compatibilities extends Abstract_Module {
|
26 |
+
const REQUIRED = 'required';
|
27 |
+
const TESTED_UP = 'tested_up';
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Should we load this module.
|
31 |
+
*
|
32 |
+
* @param Product $product Product object.
|
33 |
+
*
|
34 |
+
* @return bool
|
35 |
+
*/
|
36 |
+
public function can_load( $product ) {
|
37 |
+
if ( $this->is_from_partner( $product ) ) {
|
38 |
+
return false;
|
39 |
+
}
|
40 |
+
if ( $product->is_theme() && ! current_user_can( 'switch_themes' ) ) {
|
41 |
+
return false;
|
42 |
+
}
|
43 |
+
|
44 |
+
if ( $product->is_plugin() && ! current_user_can( 'install_plugins' ) ) {
|
45 |
+
return false;
|
46 |
+
}
|
47 |
+
|
48 |
+
return true;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Registers the hooks.
|
53 |
+
*
|
54 |
+
* @param Product $product Product to load.
|
55 |
+
*
|
56 |
+
* @throws \Exception If the configuration is invalid.
|
57 |
+
*
|
58 |
+
* @return Compatibilities Module instance.
|
59 |
+
*/
|
60 |
+
public function load( $product ) {
|
61 |
+
|
62 |
+
|
63 |
+
$this->product = $product;
|
64 |
+
|
65 |
+
$compatibilities = apply_filters( 'themeisle_sdk_compatibilities/' . $this->product->get_slug(), [] );
|
66 |
+
if ( empty( $compatibilities ) ) {
|
67 |
+
return $this;
|
68 |
+
}
|
69 |
+
$requirement = null;
|
70 |
+
$check_type = null;
|
71 |
+
foreach ( $compatibilities as $compatibility ) {
|
72 |
+
|
73 |
+
if ( empty( $compatibility['basefile'] ) ) {
|
74 |
+
return $this;
|
75 |
+
}
|
76 |
+
$requirement = new Product( $compatibility['basefile'] );
|
77 |
+
$tested_up = isset( $compatibility[ self::TESTED_UP ] ) ? $compatibility[ self::TESTED_UP ] : '999';
|
78 |
+
$required = $compatibility[ self::REQUIRED ];
|
79 |
+
if ( ! version_compare( $required, $tested_up, '<' ) ) {
|
80 |
+
throw new \Exception( sprintf( 'Invalid required/tested_up configuration. Required version %s should be lower than tested_up %s.', $required, $tested_up ) );
|
81 |
+
}
|
82 |
+
$check_type = self::REQUIRED;
|
83 |
+
if ( ! version_compare( $requirement->get_version(), $required, '<' ) ) {
|
84 |
+
$check_type = self::TESTED_UP;
|
85 |
+
if ( version_compare( $requirement->get_version(), $tested_up . '.9999', '<' ) ) {
|
86 |
+
return $this;
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
break;
|
91 |
+
}
|
92 |
+
if ( empty( $requirement ) ) {
|
93 |
+
return $this;
|
94 |
+
}
|
95 |
+
if ( $check_type === self::REQUIRED ) {
|
96 |
+
$this->mark_required( $product, $requirement );
|
97 |
+
}
|
98 |
+
if ( $check_type === self::TESTED_UP ) {
|
99 |
+
$this->mark_testedup( $product, $requirement );
|
100 |
+
}
|
101 |
+
|
102 |
+
return $this;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Mark the product tested up.
|
107 |
+
*
|
108 |
+
* @param Product $product Product object.
|
109 |
+
* @param Product $requirement Requirement object.
|
110 |
+
*
|
111 |
+
* @return void
|
112 |
+
*/
|
113 |
+
public function mark_testedup( $product, $requirement ) {
|
114 |
+
add_action(
|
115 |
+
'admin_head',
|
116 |
+
function () use ( $product, $requirement ) {
|
117 |
+
$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : '';
|
118 |
+
|
119 |
+
if ( empty( $screen ) || ! isset( $screen->id ) ) {
|
120 |
+
return;
|
121 |
+
}
|
122 |
+
if ( $requirement->is_theme() && $screen->id === 'themes' ) {
|
123 |
+
?>
|
124 |
+
<script type="text/javascript">
|
125 |
+
jQuery(document).ready(function ($) {
|
126 |
+
setInterval(checkTheme, 500);
|
127 |
+
function checkTheme() {
|
128 |
+
var theme = jQuery( '.theme.active[data-slug="<?php echo esc_attr( $requirement->get_slug() ); ?>"]' );
|
129 |
+
var notice_id = 'testedup<?php echo esc_attr( $requirement->get_slug() . $product->get_slug() ); ?>';
|
130 |
+
var product_name = '<?php echo esc_attr( $product->get_friendly_name() ); ?>';
|
131 |
+
if (theme.length > 0 && jQuery('#' + notice_id).length === 0) {
|
132 |
+
theme.find('.theme-id-container').prepend('<div style="bottom:100%;top:auto;" id="'+notice_id+'" class="notice notice-warning"><strong>Warning:</strong> This theme has not been tested with your current version of <strong>' + product_name +'</strong>. Please update '+product_name+' plugin.</div>');
|
133 |
+
}
|
134 |
+
if (theme.length > 0 && jQuery('#' + notice_id + 'overlay').length === 0) {
|
135 |
+
jQuery('.theme-overlay.active .theme-author').after('<div style="bottom:100%;top:auto;" id="'+notice_id+'overlay" class="notice notice-warning"><p><strong>Warning:</strong> This theme has not been tested with your current version of <strong>' + product_name +'</strong>. Please update '+product_name+' plugin.</p></div>');
|
136 |
+
}
|
137 |
+
}
|
138 |
+
})
|
139 |
+
|
140 |
+
</script>
|
141 |
+
<?php
|
142 |
+
}
|
143 |
+
if ( $requirement->is_plugin() && $screen->id === 'plugins' ) {
|
144 |
+
?>
|
145 |
+
<script type="text/javascript">
|
146 |
+
jQuery(document).ready(function ($) {
|
147 |
+
setInterval(checkPlugin, 500);
|
148 |
+
function checkPlugin() {
|
149 |
+
var plugin = jQuery( '.plugins .active[data-slug="<?php echo esc_attr( $requirement->get_slug() ); ?>"]' );
|
150 |
+
var notice_id = 'testedup<?php echo esc_attr( $requirement->get_slug() . $product->get_slug() ); ?>';
|
151 |
+
var product_name = '<?php echo esc_attr( $product->get_friendly_name() ); ?>';
|
152 |
+
var product_type = '<?php echo ( $product->is_plugin() ? 'plugin' : 'theme' ); ?>';
|
153 |
+
if (plugin.length > 0 && jQuery('#' + notice_id).length === 0) {
|
154 |
+
plugin.find('.column-description').append('<div style="bottom:100%;top:auto;" id="'+notice_id+'" class="notice notice-warning notice-alt notice-inline"><strong>Warning:</strong> This plugin has not been tested with your current version of <strong>' + product_name +'</strong>. Please update '+product_name+' '+product_type+'.</div>');
|
155 |
+
}
|
156 |
+
}
|
157 |
+
})
|
158 |
+
|
159 |
+
</script>
|
160 |
+
<?php
|
161 |
+
}
|
162 |
+
}
|
163 |
+
);
|
164 |
+
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Mark the product requirements.
|
169 |
+
*
|
170 |
+
* @param Product $product Product object.
|
171 |
+
* @param Product $requirement Requirement object.
|
172 |
+
*
|
173 |
+
* @return void
|
174 |
+
*/
|
175 |
+
public function mark_required( $product, $requirement ) {
|
176 |
+
add_filter(
|
177 |
+
'upgrader_pre_download',
|
178 |
+
function ( $return, $package, $upgrader ) use ( $product, $requirement ) {
|
179 |
+
/**
|
180 |
+
* Upgrader object.
|
181 |
+
*
|
182 |
+
* @var \WP_Upgrader $upgrader Upgrader object.
|
183 |
+
*/
|
184 |
+
$should_block = false;
|
185 |
+
if ( $product->is_theme()
|
186 |
+
&& property_exists( $upgrader, 'skin' )
|
187 |
+
&& property_exists( $upgrader->skin, 'theme_info' )
|
188 |
+
&& $upgrader->skin->theme_info->template === $product->get_slug() ) {
|
189 |
+
$should_block = true;
|
190 |
+
|
191 |
+
}
|
192 |
+
if ( ! $should_block && $product->is_plugin()
|
193 |
+
&& property_exists( $upgrader, 'skin' )
|
194 |
+
&& property_exists( $upgrader->skin, 'plugin_info' )
|
195 |
+
&& $upgrader->skin->plugin_info['Name'] === $product->get_name() ) {
|
196 |
+
$should_block = true;
|
197 |
+
}
|
198 |
+
if ( $should_block ) {
|
199 |
+
echo( sprintf(
|
200 |
+
'%s update requires a newer version of %s. Please %supdate%s %s %s.',
|
201 |
+
esc_attr( $product->get_friendly_name() ),
|
202 |
+
esc_attr( $requirement->get_friendly_name() ),
|
203 |
+
'<a href="' . esc_url( admin_url( $requirement->is_theme() ? 'themes.php' : 'plugins.php' ) ) . '">',
|
204 |
+
'</a>',
|
205 |
+
esc_attr( $requirement->get_friendly_name() ),
|
206 |
+
esc_attr( $requirement->is_theme() ? 'theme' : 'plugin' )
|
207 |
+
) );
|
208 |
+
$upgrader->maintenance_mode( false );
|
209 |
+
die();
|
210 |
+
}
|
211 |
+
|
212 |
+
return $return;
|
213 |
+
},
|
214 |
+
10,
|
215 |
+
3
|
216 |
+
);
|
217 |
+
|
218 |
+
add_action(
|
219 |
+
'admin_notices',
|
220 |
+
function () use ( $product, $requirement ) {
|
221 |
+
echo '<div class="notice notice-error "><p>';
|
222 |
+
echo( sprintf(
|
223 |
+
'%s requires a newer version of %s. Please %supdate%s %s %s to the latest version.',
|
224 |
+
'<strong>' . esc_attr( $product->get_friendly_name() ) . '</strong>',
|
225 |
+
'<strong>' . esc_attr( $requirement->get_friendly_name() ) . '</strong>',
|
226 |
+
'<a href="' . esc_url( admin_url( $requirement->is_theme() ? 'themes.php' : 'plugins.php' ) ) . '">',
|
227 |
+
'</a>',
|
228 |
+
'<strong>' . esc_attr( $requirement->get_friendly_name() ) . '</strong>',
|
229 |
+
esc_attr( $requirement->is_theme() ? 'theme' : 'plugin' )
|
230 |
+
) );
|
231 |
+
echo '</p></div>';
|
232 |
+
}
|
233 |
+
);
|
234 |
+
|
235 |
+
}
|
236 |
+
}
|
vendor/codeinwp/themeisle-sdk/src/Modules/Dashboard_widget.php
CHANGED
@@ -131,8 +131,9 @@ class Dashboard_Widget extends Abstract_Module {
|
|
131 |
#themeisle h2.hndle {
|
132 |
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABbCAMAAADncTNAAAAAtFBMVEVHcEyAgIB/f3+xsbGgoaGBgYGCgoKKioqAgIC1tbW5ubnFx8iAgIDU1taBgYGCgoKAgIC0tLXW19jW2NiAgIC3uLiBgYHLzMy4uLhycnLW19d/f3/T1NW0tLTX19mVlZWvr6+BgYHl5eWKiottbW5JSUnW2Nm5ubnh4eHT1NWVlZVjY2N4eHh9fX6pqqq+v79PT0/39/fu7u7Nzc7Z2ttYWFgBAQHDw8P////JysoZGRk0NTZqJc/sAAAAIXRSTlMA0FL7/oEnEPL6eibivm9gwJya76/enFq2CXI+2lFAyM8GATmPAAADj0lEQVR4Xu2YaW/iOhSGAwRCWDosnXa6znjJvm8svf//f12TuARyhiR2pfnUR6gSEnr0+uT4xK7yRb755pvhHePli5K7Bfpkuhoq8ozRJdMH+WWha6Z3sqYparCSLRJqspjImVbANJU03cNMMpofAwQZCGsmpQYyFvVM0Q00OQ9koMl5IPcCoro+RA1Dt2Ea9n9eZ0+YHJLkgIlkDywQx00wCTyaReiKH8LbNU9ybJOdkchV6QFxyCFLbVvdfaREqgUWg/tx2UbqIcK2Hex2TdGLwFTjIj3XP3YfCZFsb23KRZn/3263oymSFI0/a5S4PqUBjoBIJBDjeEhCN0wxQSRybIxtJ3K5SGzuE/vAwIQc8ZmMMJFAIM4oikZItfEFtorGgoE43FObwqHU68OtPCnOz8KZ2Jbl5LgkSW0Tc7YyIz/EFWmS4jMbiZU5mJOmKRaJpKGGyLZtDJh3iyaNUu/3+xyKnrtFL71EG+FTiMpENhQtxUQ8kSOXCIr2tnCNhg/gTX0SHYFp0t7TCwQZ7U841yoHrW6rtGroUwTWVnLMssxx+H4bgZcSOFf5MYx0Ae8FghomMDyC2EBNImBywPkNTDNqGLQpIg2TjUNU8tBy9DQMo0DAZF16rAi7vJAtFTIYFAHUc6hIRW6OuOhJgaCSwmDEAYK4oa7ro+qIEyJU/US7KTJKPNSFT9tFgVFBu0SF1y7yjX4masRA9Da7EFGj28R/BkQz6xGIOurkx38T/bKs9Uk8aIiMwm/Jw0VP1yLrJwt13xAxvABBgsK4KWLov35DkRF7ZaqgzuZ7MQ8MOntmVYyAqKTwaICKqvSUFnVccMN5sziEP/5+xGDTahbH5Q3ZB76zr8fI+nJtvUUU3t3ml5GKviK/npCg3CGodnuJ4JVkfRFJYGVDBZrqKnn9RLf+CzDTS5PaN5J38+auzX4ykU4Qoj0rdKfcYs5ijfo9OL/uRUgZyQr7NCWtWwiUSLc4arfJa7lpszTA1OJZAQ8w8dXFrR5YHzCWSnS3pZ18tOi4Ps4vl/c7i/6qomjRecN+UubrPyPGn/VEMU3T0UFHkaPzpgjxmJsnjmrtionlMDZiog0TsY/DPtn8SXtlBvbtxKtwopy7lqW3smQO+yoGE1Uu55GJ3pmI8ygoejZNnqj0vnIRCyTKfLstRdtStGQi09myUsvwvlkuzSUXbV+Xz5ryBebV33fln/A/moud69FZiEYAAAAASUVORK5CYII=');
|
133 |
background-repeat: no-repeat;
|
134 |
-
background-position:
|
135 |
background-size: 25px;
|
|
|
136 |
}
|
137 |
|
138 |
#themeisle .inside {
|
131 |
#themeisle h2.hndle {
|
132 |
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABbCAMAAADncTNAAAAAtFBMVEVHcEyAgIB/f3+xsbGgoaGBgYGCgoKKioqAgIC1tbW5ubnFx8iAgIDU1taBgYGCgoKAgIC0tLXW19jW2NiAgIC3uLiBgYHLzMy4uLhycnLW19d/f3/T1NW0tLTX19mVlZWvr6+BgYHl5eWKiottbW5JSUnW2Nm5ubnh4eHT1NWVlZVjY2N4eHh9fX6pqqq+v79PT0/39/fu7u7Nzc7Z2ttYWFgBAQHDw8P////JysoZGRk0NTZqJc/sAAAAIXRSTlMA0FL7/oEnEPL6eibivm9gwJya76/enFq2CXI+2lFAyM8GATmPAAADj0lEQVR4Xu2YaW/iOhSGAwRCWDosnXa6znjJvm8svf//f12TuARyhiR2pfnUR6gSEnr0+uT4xK7yRb755pvhHePli5K7Bfpkuhoq8ozRJdMH+WWha6Z3sqYparCSLRJqspjImVbANJU03cNMMpofAwQZCGsmpQYyFvVM0Q00OQ9koMl5IPcCoro+RA1Dt2Ea9n9eZ0+YHJLkgIlkDywQx00wCTyaReiKH8LbNU9ybJOdkchV6QFxyCFLbVvdfaREqgUWg/tx2UbqIcK2Hex2TdGLwFTjIj3XP3YfCZFsb23KRZn/3263oymSFI0/a5S4PqUBjoBIJBDjeEhCN0wxQSRybIxtJ3K5SGzuE/vAwIQc8ZmMMJFAIM4oikZItfEFtorGgoE43FObwqHU68OtPCnOz8KZ2Jbl5LgkSW0Tc7YyIz/EFWmS4jMbiZU5mJOmKRaJpKGGyLZtDJh3iyaNUu/3+xyKnrtFL71EG+FTiMpENhQtxUQ8kSOXCIr2tnCNhg/gTX0SHYFp0t7TCwQZ7U841yoHrW6rtGroUwTWVnLMssxx+H4bgZcSOFf5MYx0Ae8FghomMDyC2EBNImBywPkNTDNqGLQpIg2TjUNU8tBy9DQMo0DAZF16rAi7vJAtFTIYFAHUc6hIRW6OuOhJgaCSwmDEAYK4oa7ro+qIEyJU/US7KTJKPNSFT9tFgVFBu0SF1y7yjX4masRA9Da7EFGj28R/BkQz6xGIOurkx38T/bKs9Uk8aIiMwm/Jw0VP1yLrJwt13xAxvABBgsK4KWLov35DkRF7ZaqgzuZ7MQ8MOntmVYyAqKTwaICKqvSUFnVccMN5sziEP/5+xGDTahbH5Q3ZB76zr8fI+nJtvUUU3t3ml5GKviK/npCg3CGodnuJ4JVkfRFJYGVDBZrqKnn9RLf+CzDTS5PaN5J38+auzX4ykU4Qoj0rdKfcYs5ijfo9OL/uRUgZyQr7NCWtWwiUSLc4arfJa7lpszTA1OJZAQ8w8dXFrR5YHzCWSnS3pZ18tOi4Ps4vl/c7i/6qomjRecN+UubrPyPGn/VEMU3T0UFHkaPzpgjxmJsnjmrtionlMDZiog0TsY/DPtn8SXtlBvbtxKtwopy7lqW3smQO+yoGE1Uu55GJ3pmI8ygoejZNnqj0vnIRCyTKfLstRdtStGQi09myUsvwvlkuzSUXbV+Xz5ryBebV33fln/A/moud69FZiEYAAAAASUVORK5CYII=');
|
133 |
background-repeat: no-repeat;
|
134 |
+
background-position: 2% 50%;
|
135 |
background-size: 25px;
|
136 |
+
padding-left: 39px;
|
137 |
}
|
138 |
|
139 |
#themeisle .inside {
|
vendor/codeinwp/themeisle-sdk/src/Modules/Licenser.php
CHANGED
@@ -24,13 +24,30 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
24 |
* Licenser module for ThemeIsle SDK.
|
25 |
*/
|
26 |
class Licenser extends Abstract_Module {
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
/**
|
29 |
* Number of max failed checks before showing the license message.
|
30 |
*
|
31 |
* @var int $max_failed Maximum failed checks allowed before show the notice
|
32 |
*/
|
33 |
-
private static $max_failed =
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
/**
|
35 |
* License key string.
|
36 |
*
|
@@ -215,6 +232,76 @@ class Licenser extends Abstract_Module {
|
|
215 |
return ( 'valid' === $status && isset( $license_data->is_expired ) && 'yes' === $license_data->is_expired ) ? 'active_expired' : $status;
|
216 |
}
|
217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
/**
|
219 |
* Return the last error message.
|
220 |
*
|
@@ -256,12 +343,7 @@ class Licenser extends Abstract_Module {
|
|
256 |
* @return int License plan.
|
257 |
*/
|
258 |
public function get_plan() {
|
259 |
-
|
260 |
-
if ( ! isset( $license_data->price_id ) ) {
|
261 |
-
return - 1;
|
262 |
-
}
|
263 |
-
|
264 |
-
return (int) $license_data->price_id;
|
265 |
}
|
266 |
|
267 |
/**
|
@@ -379,7 +461,7 @@ class Licenser extends Abstract_Module {
|
|
379 |
return $this->get_api_url();
|
380 |
}
|
381 |
|
382 |
-
return $this->get_api_url() . '/checkout/?edd_license_key=' . $license_data->key . '&download_id=' . $license_data->download_id;
|
383 |
}
|
384 |
|
385 |
/**
|
@@ -522,6 +604,10 @@ class Licenser extends Abstract_Module {
|
|
522 |
return new \WP_Error( 'themeisle-license-invalid', 'ERROR: Invalid license provided.' );
|
523 |
}
|
524 |
|
|
|
|
|
|
|
|
|
525 |
return true;
|
526 |
}
|
527 |
|
@@ -849,7 +935,13 @@ class Licenser extends Abstract_Module {
|
|
849 |
$this->failed_checks = intval( get_option( $this->product->get_key() . '_failed_checks', 0 ) );
|
850 |
$this->register_license_hooks();
|
851 |
}
|
852 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
853 |
$namespace = apply_filters( 'themesle_sdk_namespace_' . md5( $product->get_basefile() ), false );
|
854 |
|
855 |
if ( false !== $namespace ) {
|
@@ -876,6 +968,20 @@ class Licenser extends Abstract_Module {
|
|
876 |
);
|
877 |
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
|
878 |
add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 ); //phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_args
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
879 |
|
880 |
return $this;
|
881 |
}
|
24 |
* Licenser module for ThemeIsle SDK.
|
25 |
*/
|
26 |
class Licenser extends Abstract_Module {
|
27 |
+
/**
|
28 |
+
* License VALID status string.
|
29 |
+
*/
|
30 |
+
const STATUS_VALID = 'valid';
|
31 |
+
/**
|
32 |
+
* License NOT_ACTIVE status string.
|
33 |
+
*/
|
34 |
+
const STATUS_NOT_ACTIVE = 'not_active';
|
35 |
+
/**
|
36 |
+
* License active expired status string.
|
37 |
+
*/
|
38 |
+
const STATUS_ACTIVE_EXPIRED = 'active_expired';
|
39 |
/**
|
40 |
* Number of max failed checks before showing the license message.
|
41 |
*
|
42 |
* @var int $max_failed Maximum failed checks allowed before show the notice
|
43 |
*/
|
44 |
+
private static $max_failed = 1;
|
45 |
+
/**
|
46 |
+
* Flag to check if the global actions were loaded.
|
47 |
+
*
|
48 |
+
* @var bool If the globals actions were loaded.
|
49 |
+
*/
|
50 |
+
private static $globals_loaded = false;
|
51 |
/**
|
52 |
* License key string.
|
53 |
*
|
232 |
return ( 'valid' === $status && isset( $license_data->is_expired ) && 'yes' === $license_data->is_expired ) ? 'active_expired' : $status;
|
233 |
}
|
234 |
|
235 |
+
/**
|
236 |
+
* Check status.
|
237 |
+
*
|
238 |
+
* @param string $product_file Product basefile.
|
239 |
+
*
|
240 |
+
* @return string Status license.
|
241 |
+
*/
|
242 |
+
public static function status( $product_file ) {
|
243 |
+
$product = Product::get( $product_file );
|
244 |
+
if ( ! $product->requires_license() ) {
|
245 |
+
return self::STATUS_VALID;
|
246 |
+
}
|
247 |
+
$license_data = self::get_license_data( $product->get_key() );
|
248 |
+
|
249 |
+
$status = isset( $license_data->license ) ? $license_data->license : self::STATUS_NOT_ACTIVE;
|
250 |
+
|
251 |
+
return ( 'valid' === $status && isset( $license_data->is_expired ) && 'yes' === $license_data->is_expired ) ? 'active_expired' : $status;
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Product license data.
|
256 |
+
*
|
257 |
+
* @param string $key Product key.
|
258 |
+
*
|
259 |
+
* @return false|mixed|null
|
260 |
+
*/
|
261 |
+
private static function get_license_data( $key ) {
|
262 |
+
$license_data = get_option( $key . '_license_data', '' );
|
263 |
+
|
264 |
+
return isset( $license_data->license ) ? $license_data : false;
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Check if license is valid.
|
269 |
+
*
|
270 |
+
* @param string $product_file Product basefile.
|
271 |
+
*
|
272 |
+
* @return bool Is valid?
|
273 |
+
*/
|
274 |
+
public static function is_valid( $product_file ) {
|
275 |
+
return self::status( $product_file ) === self::STATUS_VALID;
|
276 |
+
}
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Get product plan.
|
280 |
+
*
|
281 |
+
* @param string $product_file Product file.
|
282 |
+
*
|
283 |
+
* @return int Plan id.
|
284 |
+
*/
|
285 |
+
public static function plan( $product_file ) {
|
286 |
+
$product = Product::get( $product_file );
|
287 |
+
$data = self::get_license_data( $product->get_key() );
|
288 |
+
|
289 |
+
return isset( $data->price_id ) ? (int) $data->price_id : - 1;
|
290 |
+
}
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Get product license key.
|
294 |
+
*
|
295 |
+
* @param string $product_file Product file.
|
296 |
+
*
|
297 |
+
* @return string
|
298 |
+
*/
|
299 |
+
public static function key( $product_file ) {
|
300 |
+
$product = Product::get( $product_file );
|
301 |
+
|
302 |
+
return $product->get_license();
|
303 |
+
}
|
304 |
+
|
305 |
/**
|
306 |
* Return the last error message.
|
307 |
*
|
343 |
* @return int License plan.
|
344 |
*/
|
345 |
public function get_plan() {
|
346 |
+
return self::plan( $this->product->get_basefile() );
|
|
|
|
|
|
|
|
|
|
|
347 |
}
|
348 |
|
349 |
/**
|
461 |
return $this->get_api_url();
|
462 |
}
|
463 |
|
464 |
+
return trim( $this->get_api_url(), '/' ) . '/checkout/?edd_license_key=' . $license_data->key . '&download_id=' . $license_data->download_id;
|
465 |
}
|
466 |
|
467 |
/**
|
604 |
return new \WP_Error( 'themeisle-license-invalid', 'ERROR: Invalid license provided.' );
|
605 |
}
|
606 |
|
607 |
+
// Remove the versions transient upon activation so that newer version for rollback can be acquired.
|
608 |
+
$versions_cache = $this->product->get_cache_key();
|
609 |
+
delete_transient( $versions_cache );
|
610 |
+
|
611 |
return true;
|
612 |
}
|
613 |
|
935 |
$this->failed_checks = intval( get_option( $this->product->get_key() . '_failed_checks', 0 ) );
|
936 |
$this->register_license_hooks();
|
937 |
}
|
938 |
+
if ( ! self::$globals_loaded ) {
|
939 |
+
add_filter( 'themeisle_sdk_license/status', [ __CLASS__, 'status' ], 999, 1 );
|
940 |
+
add_filter( 'themeisle_sdk_license/is-valid', [ __CLASS__, 'is_valid' ], 999, 1 );
|
941 |
+
add_filter( 'themeisle_sdk_license/plan', [ __CLASS__, 'plan' ], 999, 1 );
|
942 |
+
add_filter( 'themeisle_sdk_license/key', [ __CLASS__, 'key' ], 999, 1 );
|
943 |
+
$globals_loaded = true;
|
944 |
+
}
|
945 |
$namespace = apply_filters( 'themesle_sdk_namespace_' . md5( $product->get_basefile() ), false );
|
946 |
|
947 |
if ( false !== $namespace ) {
|
968 |
);
|
969 |
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
|
970 |
add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 ); //phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_args
|
971 |
+
if ( ! self::is_valid( $product->get_basefile() ) ) {
|
972 |
+
add_filter(
|
973 |
+
'plugin_action_links_' . plugin_basename( $product->get_basefile() ),
|
974 |
+
function ( $actions ) {
|
975 |
+
if ( $this->get_license_status( true ) !== self::STATUS_ACTIVE_EXPIRED ) {
|
976 |
+
return $actions;
|
977 |
+
}
|
978 |
+
$new_actions['deactivate'] = $actions['deactivate'];
|
979 |
+
$new_actions['renew_link'] = '<a style="color:#d63638" href="' . esc_url( $this->renew_url() ) . '" target="_blank" rel="external noopener noreferrer">Renew license to update</a>';
|
980 |
+
|
981 |
+
return $new_actions;
|
982 |
+
}
|
983 |
+
);
|
984 |
+
}
|
985 |
|
986 |
return $this;
|
987 |
}
|
vendor/codeinwp/themeisle-sdk/src/Modules/Promotions.php
ADDED
@@ -0,0 +1,254 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The promotions model class for ThemeIsle SDK
|
4 |
+
*
|
5 |
+
* Here's how to hook it in your plugin: add_filter( 'menu_icons_load_promotions', function() { return array( 'otter' ); } );
|
6 |
+
*
|
7 |
+
* @package ThemeIsleSDK
|
8 |
+
* @subpackage Modules
|
9 |
+
* @copyright Copyright (c) 2017, Marius Cristea
|
10 |
+
* @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
|
11 |
+
* @since 1.0.0
|
12 |
+
*/
|
13 |
+
|
14 |
+
namespace ThemeisleSDK\Modules;
|
15 |
+
|
16 |
+
use ThemeisleSDK\Common\Abstract_Module;
|
17 |
+
use ThemeisleSDK\Product;
|
18 |
+
|
19 |
+
// Exit if accessed directly.
|
20 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
21 |
+
exit;
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Promotions module for ThemeIsle SDK.
|
26 |
+
*/
|
27 |
+
class Promotions extends Abstract_Module {
|
28 |
+
/**
|
29 |
+
* Fetched feeds items.
|
30 |
+
*
|
31 |
+
* @var array Feed items.
|
32 |
+
*/
|
33 |
+
private $promotions_to_load = array();
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Should we load this module.
|
37 |
+
*
|
38 |
+
* @param Product $product Product object.
|
39 |
+
*
|
40 |
+
* @return bool
|
41 |
+
*/
|
42 |
+
public function can_load( $product ) {
|
43 |
+
if ( $this->is_from_partner( $product ) ) {
|
44 |
+
return false;
|
45 |
+
}
|
46 |
+
|
47 |
+
$this->promotions_to_load = apply_filters( $product->get_key() . '_load_promotions', array() );
|
48 |
+
|
49 |
+
if ( 0 === count( $this->promotions_to_load ) ) {
|
50 |
+
return false;
|
51 |
+
}
|
52 |
+
|
53 |
+
return true;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Registers the hooks.
|
58 |
+
*
|
59 |
+
* @param Product $product Product to load.
|
60 |
+
*
|
61 |
+
* @return Promotions Module instance.
|
62 |
+
*/
|
63 |
+
public function load( $product ) {
|
64 |
+
if ( 0 === count( $this->promotions_to_load ) ) {
|
65 |
+
return;
|
66 |
+
}
|
67 |
+
|
68 |
+
if ( ! $this->is_writeable() || ! current_user_can( 'install_plugins' ) ) {
|
69 |
+
return;
|
70 |
+
}
|
71 |
+
|
72 |
+
$this->product = $product;
|
73 |
+
|
74 |
+
add_action( 'init', array( $this, 'register_settings' ), 99 );
|
75 |
+
add_action( 'admin_init', array( $this, 'register_reference' ), 99 );
|
76 |
+
|
77 |
+
if ( in_array( 'otter', $this->promotions_to_load )
|
78 |
+
&& false === apply_filters( 'themeisle_sdk_load_promotions_otter', false )
|
79 |
+
&& ! ( defined( 'OTTER_BLOCKS_VERSION' )
|
80 |
+
|| $this->is_plugin_installed( 'otter-blocks' ) )
|
81 |
+
&& version_compare( get_bloginfo( 'version' ), '5.8', '>=' ) ) {
|
82 |
+
add_filter( 'themeisle_sdk_load_promotions_otter', '__return_true' );
|
83 |
+
|
84 |
+
if ( false !== $this->show_otter_promotion() ) {
|
85 |
+
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_editor_assets' ) );
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
return $this;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Register plugin reference.
|
94 |
+
*
|
95 |
+
* @return void
|
96 |
+
*/
|
97 |
+
public function register_reference() {
|
98 |
+
|
99 |
+
$reference_key = ! isset( $_GET['reference_key'] ) ? '' : sanitize_key( $_GET['reference_key'] );
|
100 |
+
if ( empty( $reference_key ) ) {
|
101 |
+
return;
|
102 |
+
}
|
103 |
+
if ( get_option( 'otter_reference_key', false ) !== false ) {
|
104 |
+
return;
|
105 |
+
}
|
106 |
+
update_option( 'otter_reference_key', $reference_key );
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Register Settings
|
111 |
+
*
|
112 |
+
* @since 1.2.0
|
113 |
+
* @access public
|
114 |
+
*/
|
115 |
+
public function register_settings() {
|
116 |
+
register_setting(
|
117 |
+
'themeisle_sdk_settings',
|
118 |
+
'themeisle_sdk_promotions_otter',
|
119 |
+
array(
|
120 |
+
'type' => 'string',
|
121 |
+
'sanitize_callback' => 'sanitize_text_field',
|
122 |
+
'show_in_rest' => true,
|
123 |
+
'default' => '{}',
|
124 |
+
)
|
125 |
+
);
|
126 |
+
|
127 |
+
register_setting(
|
128 |
+
'themeisle_sdk_settings',
|
129 |
+
'themeisle_sdk_promotions_otter_installed',
|
130 |
+
array(
|
131 |
+
'type' => 'boolean',
|
132 |
+
'sanitize_callback' => 'rest_sanitize_boolean',
|
133 |
+
'show_in_rest' => true,
|
134 |
+
'default' => false,
|
135 |
+
)
|
136 |
+
);
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Get the Otter Blocks plugin status.
|
141 |
+
*
|
142 |
+
* @param string $plugin Plugin slug.
|
143 |
+
*
|
144 |
+
* @return string
|
145 |
+
*/
|
146 |
+
private function is_plugin_installed( $plugin ) {
|
147 |
+
static $allowed_keys = [ 'otter-blocks' => 'otter-blocks/otter-blocks.php' ];
|
148 |
+
if ( ! isset( $allowed_keys[ $plugin ] ) ) {
|
149 |
+
return false;
|
150 |
+
}
|
151 |
+
if ( file_exists( WP_CONTENT_DIR . '/plugins/' . $allowed_keys[ $plugin ] ) ) {
|
152 |
+
return true;
|
153 |
+
}
|
154 |
+
|
155 |
+
return false;
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Get status of Otter promotion message.
|
160 |
+
*
|
161 |
+
* @return mixed
|
162 |
+
*/
|
163 |
+
public function show_otter_promotion() {
|
164 |
+
$promotions = array(
|
165 |
+
'blocks_css',
|
166 |
+
'blocks_animation',
|
167 |
+
'blocks_conditions',
|
168 |
+
);
|
169 |
+
|
170 |
+
$option = json_decode( get_option( 'themeisle_sdk_promotions_otter', '{}' ), true );
|
171 |
+
|
172 |
+
if ( 0 === count( $option ) ) {
|
173 |
+
return 'blocks-css';
|
174 |
+
}
|
175 |
+
|
176 |
+
if ( isset( $option['blocks-css'] ) && ! isset( $option['blocks-animation'] ) && $option['blocks-css'] < strtotime( '-7 days' ) ) {
|
177 |
+
return 'blocks-animation';
|
178 |
+
}
|
179 |
+
|
180 |
+
if ( isset( $option['blocks-animation'] ) && ! isset( $option['blocks-conditions'] ) && $option['blocks-animation'] < strtotime( '-7 days' ) ) {
|
181 |
+
return 'blocks-conditions';
|
182 |
+
}
|
183 |
+
|
184 |
+
return false;
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Check if the path is writable.
|
189 |
+
*
|
190 |
+
* @return boolean
|
191 |
+
* @access public
|
192 |
+
*/
|
193 |
+
public function is_writeable() {
|
194 |
+
global $wp_filesystem;
|
195 |
+
include_once ABSPATH . 'wp-admin/includes/file.php';
|
196 |
+
WP_Filesystem();
|
197 |
+
|
198 |
+
if ( ! function_exists( 'WP_Filesystem' ) ) {
|
199 |
+
return false;
|
200 |
+
}
|
201 |
+
|
202 |
+
$writable = WP_Filesystem( false, ABSPATH . 'wp-content' );
|
203 |
+
|
204 |
+
return $writable && 'direct' === $wp_filesystem->method;
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Load Gutenberg editor assets.
|
209 |
+
*
|
210 |
+
* @access public
|
211 |
+
*/
|
212 |
+
public function enqueue_editor_assets() {
|
213 |
+
global $themeisle_sdk_max_path;
|
214 |
+
|
215 |
+
$themeisle_sdk_path = dirname( $themeisle_sdk_max_path );
|
216 |
+
$themeisle_sdk_src = plugins_url( '/', $themeisle_sdk_max_path );
|
217 |
+
|
218 |
+
$asset_file = include $themeisle_sdk_path . '/themeisle-sdk/assets/js/build/index.asset.php';
|
219 |
+
|
220 |
+
wp_enqueue_script(
|
221 |
+
'themeisle-sdk-otter-promotions',
|
222 |
+
$themeisle_sdk_src . 'themeisle-sdk/assets/js/build/index.js',
|
223 |
+
array_merge( $asset_file['dependencies'], [ 'updates' ] ),
|
224 |
+
$asset_file['version'],
|
225 |
+
true
|
226 |
+
);
|
227 |
+
|
228 |
+
$option = get_option( 'themeisle_sdk_promotions_otter', '{}' );
|
229 |
+
|
230 |
+
wp_localize_script(
|
231 |
+
'themeisle-sdk-otter-promotions',
|
232 |
+
'themeisleSDKPromotions',
|
233 |
+
array(
|
234 |
+
'product' => $this->product->get_name(),
|
235 |
+
'assets' => $themeisle_sdk_src . 'themeisle-sdk/assets/images/',
|
236 |
+
'showPromotion' => $this->show_otter_promotion(),
|
237 |
+
'promotions_otter' => $option,
|
238 |
+
'activationUrl' => esc_url(
|
239 |
+
add_query_arg(
|
240 |
+
array(
|
241 |
+
'plugin_status' => 'all',
|
242 |
+
'paged' => '1',
|
243 |
+
'action' => 'activate',
|
244 |
+
'reference_key' => $this->product->get_key(),
|
245 |
+
'plugin' => rawurlencode( 'otter-blocks/otter-blocks.php' ),
|
246 |
+
'_wpnonce' => wp_create_nonce( 'activate-plugin_otter-blocks/otter-blocks.php' ),
|
247 |
+
),
|
248 |
+
admin_url( 'plugins.php' )
|
249 |
+
)
|
250 |
+
),
|
251 |
+
)
|
252 |
+
);
|
253 |
+
}
|
254 |
+
}
|
vendor/codeinwp/themeisle-sdk/src/Modules/Rollback.php
CHANGED
@@ -98,7 +98,7 @@ class Rollback extends Abstract_Module {
|
|
98 |
*/
|
99 |
private function get_api_versions() {
|
100 |
|
101 |
-
$cache_key = $this->product->
|
102 |
$cache_versions = get_transient( $cache_key );
|
103 |
if ( false === $cache_versions ) {
|
104 |
$versions = $this->get_remote_versions();
|
@@ -374,11 +374,27 @@ class Rollback extends Abstract_Module {
|
|
374 |
);
|
375 |
}
|
376 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
/**
|
378 |
* Set the rollback hook. Strangely, this does not work if placed in the ThemeIsle_SDK_Rollback class, so it is being called from there instead.
|
379 |
*/
|
380 |
public function add_hooks() {
|
381 |
add_action( 'admin_post_' . $this->product->get_key() . '_rollback', array( $this, 'start_rollback' ) );
|
382 |
add_action( 'admin_footer', array( $this, 'add_footer' ) );
|
|
|
|
|
|
|
|
|
383 |
}
|
384 |
}
|
98 |
*/
|
99 |
private function get_api_versions() {
|
100 |
|
101 |
+
$cache_key = $this->product->get_cache_key();
|
102 |
$cache_versions = get_transient( $cache_key );
|
103 |
if ( false === $cache_versions ) {
|
104 |
$versions = $this->get_remote_versions();
|
374 |
);
|
375 |
}
|
376 |
|
377 |
+
/**
|
378 |
+
* Fires after the option has been updated.
|
379 |
+
*
|
380 |
+
* @param mixed $old_value The old option value.
|
381 |
+
* @param mixed $value The new option value.
|
382 |
+
* @param string $option Option name.
|
383 |
+
*/
|
384 |
+
public function update_active_plugins_action( $old_value, $value, $option ) {
|
385 |
+
delete_site_transient( 'update_plugins' );
|
386 |
+
wp_cache_delete( 'plugins', 'plugins' );
|
387 |
+
}
|
388 |
+
|
389 |
/**
|
390 |
* Set the rollback hook. Strangely, this does not work if placed in the ThemeIsle_SDK_Rollback class, so it is being called from there instead.
|
391 |
*/
|
392 |
public function add_hooks() {
|
393 |
add_action( 'admin_post_' . $this->product->get_key() . '_rollback', array( $this, 'start_rollback' ) );
|
394 |
add_action( 'admin_footer', array( $this, 'add_footer' ) );
|
395 |
+
|
396 |
+
// This hook will be invoked after the plugin activation.
|
397 |
+
// We use this to force an update of the cache so that Update is present immediate after a rollback.
|
398 |
+
add_action( 'update_option_active_plugins', array( $this, 'update_active_plugins_action' ), 10, 3 );
|
399 |
}
|
400 |
}
|
vendor/codeinwp/themeisle-sdk/src/Modules/Uninstall_feedback.php
CHANGED
@@ -701,10 +701,11 @@ class Uninstall_Feedback extends Abstract_Module {
|
|
701 |
$disclosure_new_labels = apply_filters( $this->product->get_slug() . '_themeisle_sdk_disclosure_content_labels', [], $this->product );
|
702 |
$disclosure_labels = array_merge(
|
703 |
[
|
704 |
-
'title' => 'Below is a detailed view of all data that ThemeIsle will receive if you fill in this survey. No
|
705 |
'items' => [
|
706 |
sprintf( '%s %s version %s %s %s %s', '<strong>', ucwords( $this->product->get_type() ), '</strong>', '<code>', $this->product->get_version(), '</code>' ),
|
707 |
sprintf( '%sCurrent website:%s %s %s %s', '<strong>', '</strong>', '<code>', get_site_url(), '</code>' ),
|
|
|
708 |
sprintf( '%s Uninstall reason %s %s Selected reason from the above survey %s ', '<strong>', '</strong>', '<i>', '</i>' ),
|
709 |
],
|
710 |
],
|
@@ -785,11 +786,12 @@ class Uninstall_Feedback extends Abstract_Module {
|
|
785 |
* @return bool Is the request succesfull?
|
786 |
*/
|
787 |
protected function call_api( $attributes ) {
|
788 |
-
$slug
|
789 |
-
$version
|
790 |
-
$attributes['slug']
|
791 |
-
$attributes['version']
|
792 |
-
$attributes['url']
|
|
|
793 |
|
794 |
$response = wp_remote_post(
|
795 |
self::FEEDBACK_ENDPOINT,
|
701 |
$disclosure_new_labels = apply_filters( $this->product->get_slug() . '_themeisle_sdk_disclosure_content_labels', [], $this->product );
|
702 |
$disclosure_labels = array_merge(
|
703 |
[
|
704 |
+
'title' => 'Below is a detailed view of all data that ThemeIsle will receive if you fill in this survey. No email address or IP addresses are transmitted after you submit the survey.',
|
705 |
'items' => [
|
706 |
sprintf( '%s %s version %s %s %s %s', '<strong>', ucwords( $this->product->get_type() ), '</strong>', '<code>', $this->product->get_version(), '</code>' ),
|
707 |
sprintf( '%sCurrent website:%s %s %s %s', '<strong>', '</strong>', '<code>', get_site_url(), '</code>' ),
|
708 |
+
sprintf( '%sUsage time:%s %s %s%s', '<strong>', '</strong>', '<code>', ( time() - $this->product->get_install_time() ), 's</code>' ),
|
709 |
sprintf( '%s Uninstall reason %s %s Selected reason from the above survey %s ', '<strong>', '</strong>', '<i>', '</i>' ),
|
710 |
],
|
711 |
],
|
786 |
* @return bool Is the request succesfull?
|
787 |
*/
|
788 |
protected function call_api( $attributes ) {
|
789 |
+
$slug = $this->product->get_slug();
|
790 |
+
$version = $this->product->get_version();
|
791 |
+
$attributes['slug'] = $slug;
|
792 |
+
$attributes['version'] = $version;
|
793 |
+
$attributes['url'] = get_site_url();
|
794 |
+
$attributes['active_time'] = ( time() - $this->product->get_install_time() );
|
795 |
|
796 |
$response = wp_remote_post(
|
797 |
self::FEEDBACK_ENDPOINT,
|
vendor/codeinwp/themeisle-sdk/src/Product.php
CHANGED
@@ -106,10 +106,17 @@ class Product {
|
|
106 |
* @var string $version The product version.
|
107 |
*/
|
108 |
private $version;
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
/**
|
110 |
* Root api endpoint.
|
111 |
*/
|
112 |
const API_URL = 'https://api.themeisle.com/';
|
|
|
113 |
/**
|
114 |
* ThemeIsle_SDK_Product constructor.
|
115 |
*
|
@@ -128,8 +135,25 @@ class Product {
|
|
128 |
$install = time();
|
129 |
update_option( $this->get_key() . '_install', time() );
|
130 |
}
|
131 |
-
$this->install
|
|
|
|
|
132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
}
|
134 |
|
135 |
/**
|
@@ -322,6 +346,15 @@ class Product {
|
|
322 |
return $name;
|
323 |
}
|
324 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
325 |
/**
|
326 |
* Getter for product name.
|
327 |
*
|
106 |
* @var string $version The product version.
|
107 |
*/
|
108 |
private $version;
|
109 |
+
/**
|
110 |
+
* Holds a map of loaded products objects.
|
111 |
+
*
|
112 |
+
* @var array Array of loaded products.
|
113 |
+
*/
|
114 |
+
private static $cached_products = [];
|
115 |
/**
|
116 |
* Root api endpoint.
|
117 |
*/
|
118 |
const API_URL = 'https://api.themeisle.com/';
|
119 |
+
|
120 |
/**
|
121 |
* ThemeIsle_SDK_Product constructor.
|
122 |
*
|
135 |
$install = time();
|
136 |
update_option( $this->get_key() . '_install', time() );
|
137 |
}
|
138 |
+
$this->install = $install;
|
139 |
+
self::$cached_products[ crc32( $basefile ) ] = $this;
|
140 |
+
}
|
141 |
|
142 |
+
/**
|
143 |
+
* Return a product.
|
144 |
+
*
|
145 |
+
* @param string $basefile Product basefile.
|
146 |
+
*
|
147 |
+
* @return Product Product Object.
|
148 |
+
*/
|
149 |
+
public static function get( $basefile ) {
|
150 |
+
$key = crc32( $basefile );
|
151 |
+
if ( isset( self::$cached_products[ $key ] ) ) {
|
152 |
+
return self::$cached_products[ $key ];
|
153 |
+
}
|
154 |
+
self::$cached_products[ $key ] = new Product( $basefile );
|
155 |
+
|
156 |
+
return self::$cached_products[ $key ];
|
157 |
}
|
158 |
|
159 |
/**
|
346 |
return $name;
|
347 |
}
|
348 |
|
349 |
+
/**
|
350 |
+
* Return the product version cache key.
|
351 |
+
*
|
352 |
+
* @return string The product version cache key.
|
353 |
+
*/
|
354 |
+
public function get_cache_key() {
|
355 |
+
return $this->get_key() . '_' . preg_replace( '/[^0-9a-zA-Z ]/m', '', $this->get_version() ) . 'versions';
|
356 |
+
}
|
357 |
+
|
358 |
/**
|
359 |
* Getter for product name.
|
360 |
*
|
vendor/codeinwp/themeisle-sdk/start.php
CHANGED
@@ -32,6 +32,8 @@ $files_to_load = [
|
|
32 |
$themeisle_library_path . '/src/Modules/Translate.php',
|
33 |
$themeisle_library_path . '/src/Modules/Review.php',
|
34 |
$themeisle_library_path . '/src/Modules/Recommendation.php',
|
|
|
|
|
35 |
];
|
36 |
|
37 |
$files_to_load = array_merge( $files_to_load, apply_filters( 'themeisle_sdk_required_files', [] ) );
|
@@ -41,7 +43,6 @@ foreach ( $files_to_load as $file ) {
|
|
41 |
require_once $file;
|
42 |
}
|
43 |
}
|
44 |
-
|
45 |
Loader::init();
|
46 |
|
47 |
foreach ( $products as $product ) {
|
32 |
$themeisle_library_path . '/src/Modules/Translate.php',
|
33 |
$themeisle_library_path . '/src/Modules/Review.php',
|
34 |
$themeisle_library_path . '/src/Modules/Recommendation.php',
|
35 |
+
$themeisle_library_path . '/src/Modules/Promotions.php',
|
36 |
+
$themeisle_library_path . '/src/Modules/Compatibilities.php',
|
37 |
];
|
38 |
|
39 |
$files_to_load = array_merge( $files_to_load, apply_filters( 'themeisle_sdk_required_files', [] ) );
|
43 |
require_once $file;
|
44 |
}
|
45 |
}
|
|
|
46 |
Loader::init();
|
47 |
|
48 |
foreach ( $products as $product ) {
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -22,18 +22,18 @@ class ComposerAutoloaderInit6017a87d4b8f42d859867326c4f06837
|
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
-
spl_autoload_register(array('
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
27 |
-
spl_autoload_unregister(array('
|
28 |
|
29 |
require __DIR__ . '/autoload_static.php';
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
|
32 |
$loader->register(true);
|
33 |
|
34 |
-
$includeFiles = \Composer\Autoload\
|
35 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
36 |
-
|
37 |
}
|
38 |
|
39 |
return $loader;
|
@@ -45,7 +45,7 @@ class ComposerAutoloaderInit6017a87d4b8f42d859867326c4f06837
|
|
45 |
* @param string $file
|
46 |
* @return void
|
47 |
*/
|
48 |
-
function
|
49 |
{
|
50 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
51 |
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit4c83b32e0d1a231b07094383699cccb6
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
+
spl_autoload_register(array('ComposerAutoloaderInit4c83b32e0d1a231b07094383699cccb6', 'loadClassLoader'), true, true);
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
27 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit4c83b32e0d1a231b07094383699cccb6', 'loadClassLoader'));
|
28 |
|
29 |
require __DIR__ . '/autoload_static.php';
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit4c83b32e0d1a231b07094383699cccb6::getInitializer($loader));
|
31 |
|
32 |
$loader->register(true);
|
33 |
|
34 |
+
$includeFiles = \Composer\Autoload\ComposerStaticInit4c83b32e0d1a231b07094383699cccb6::$files;
|
35 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
36 |
+
composerRequire4c83b32e0d1a231b07094383699cccb6($fileIdentifier, $file);
|
37 |
}
|
38 |
|
39 |
return $loader;
|
45 |
* @param string $file
|
46 |
* @return void
|
47 |
*/
|
48 |
+
function composerRequire4c83b32e0d1a231b07094383699cccb6($fileIdentifier, $file)
|
49 |
{
|
50 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
51 |
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'50f1a0479b2a5847c529d784c54cebe2' => __DIR__ . '/..' . '/codeinwp/themeisle-sdk/load.php',
|
@@ -58,9 +58,9 @@ class ComposerStaticInit6017a87d4b8f42d859867326c4f06837
|
|
58 |
public static function getInitializer(ClassLoader $loader)
|
59 |
{
|
60 |
return \Closure::bind(function () use ($loader) {
|
61 |
-
$loader->prefixLengthsPsr4 =
|
62 |
-
$loader->prefixDirsPsr4 =
|
63 |
-
$loader->classMap =
|
64 |
|
65 |
}, null, ClassLoader::class);
|
66 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit4c83b32e0d1a231b07094383699cccb6
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'50f1a0479b2a5847c529d784c54cebe2' => __DIR__ . '/..' . '/codeinwp/themeisle-sdk/load.php',
|
58 |
public static function getInitializer(ClassLoader $loader)
|
59 |
{
|
60 |
return \Closure::bind(function () use ($loader) {
|
61 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit4c83b32e0d1a231b07094383699cccb6::$prefixLengthsPsr4;
|
62 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit4c83b32e0d1a231b07094383699cccb6::$prefixDirsPsr4;
|
63 |
+
$loader->classMap = ComposerStaticInit4c83b32e0d1a231b07094383699cccb6::$classMap;
|
64 |
|
65 |
}, null, ClassLoader::class);
|
66 |
}
|
vendor/composer/installed.json
CHANGED
@@ -2,23 +2,23 @@
|
|
2 |
"packages": [
|
3 |
{
|
4 |
"name": "codeinwp/themeisle-sdk",
|
5 |
-
"version": "3.2.
|
6 |
-
"version_normalized": "3.2.
|
7 |
"source": {
|
8 |
"type": "git",
|
9 |
"url": "https://github.com/Codeinwp/themeisle-sdk.git",
|
10 |
-
"reference": "
|
11 |
},
|
12 |
"dist": {
|
13 |
"type": "zip",
|
14 |
-
"url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/
|
15 |
-
"reference": "
|
16 |
"shasum": ""
|
17 |
},
|
18 |
"require-dev": {
|
19 |
"codeinwp/phpcs-ruleset": "dev-main"
|
20 |
},
|
21 |
-
"time": "2022-
|
22 |
"type": "library",
|
23 |
"installation-source": "dist",
|
24 |
"notification-url": "https://packagist.org/downloads/",
|
@@ -39,7 +39,7 @@
|
|
39 |
],
|
40 |
"support": {
|
41 |
"issues": "https://github.com/Codeinwp/themeisle-sdk/issues",
|
42 |
-
"source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.2.
|
43 |
},
|
44 |
"install-path": "../codeinwp/themeisle-sdk"
|
45 |
}
|
2 |
"packages": [
|
3 |
{
|
4 |
"name": "codeinwp/themeisle-sdk",
|
5 |
+
"version": "3.2.29",
|
6 |
+
"version_normalized": "3.2.29.0",
|
7 |
"source": {
|
8 |
"type": "git",
|
9 |
"url": "https://github.com/Codeinwp/themeisle-sdk.git",
|
10 |
+
"reference": "9456fb0944ec69c3975de04aaf56233ddc2f828c"
|
11 |
},
|
12 |
"dist": {
|
13 |
"type": "zip",
|
14 |
+
"url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/9456fb0944ec69c3975de04aaf56233ddc2f828c",
|
15 |
+
"reference": "9456fb0944ec69c3975de04aaf56233ddc2f828c",
|
16 |
"shasum": ""
|
17 |
},
|
18 |
"require-dev": {
|
19 |
"codeinwp/phpcs-ruleset": "dev-main"
|
20 |
},
|
21 |
+
"time": "2022-09-08T15:34:21+00:00",
|
22 |
"type": "library",
|
23 |
"installation-source": "dist",
|
24 |
"notification-url": "https://packagist.org/downloads/",
|
39 |
],
|
40 |
"support": {
|
41 |
"issues": "https://github.com/Codeinwp/themeisle-sdk/issues",
|
42 |
+
"source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.2.29"
|
43 |
},
|
44 |
"install-path": "../codeinwp/themeisle-sdk"
|
45 |
}
|
vendor/composer/installed.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php return array(
|
2 |
'root' => array(
|
3 |
'name' => 'codeinwp/templates-patterns-collection',
|
4 |
-
'pretty_version' => '1.1.
|
5 |
-
'version' => '1.1.
|
6 |
'reference' => NULL,
|
7 |
'type' => 'library',
|
8 |
'install_path' => __DIR__ . '/../../',
|
@@ -11,8 +11,8 @@
|
|
11 |
),
|
12 |
'versions' => array(
|
13 |
'codeinwp/templates-patterns-collection' => array(
|
14 |
-
'pretty_version' => '1.1.
|
15 |
-
'version' => '1.1.
|
16 |
'reference' => NULL,
|
17 |
'type' => 'library',
|
18 |
'install_path' => __DIR__ . '/../../',
|
@@ -20,9 +20,9 @@
|
|
20 |
'dev_requirement' => false,
|
21 |
),
|
22 |
'codeinwp/themeisle-sdk' => array(
|
23 |
-
'pretty_version' => '3.2.
|
24 |
-
'version' => '3.2.
|
25 |
-
'reference' => '
|
26 |
'type' => 'library',
|
27 |
'install_path' => __DIR__ . '/../codeinwp/themeisle-sdk',
|
28 |
'aliases' => array(),
|
1 |
<?php return array(
|
2 |
'root' => array(
|
3 |
'name' => 'codeinwp/templates-patterns-collection',
|
4 |
+
'pretty_version' => '1.1.26',
|
5 |
+
'version' => '1.1.26.0',
|
6 |
'reference' => NULL,
|
7 |
'type' => 'library',
|
8 |
'install_path' => __DIR__ . '/../../',
|
11 |
),
|
12 |
'versions' => array(
|
13 |
'codeinwp/templates-patterns-collection' => array(
|
14 |
+
'pretty_version' => '1.1.26',
|
15 |
+
'version' => '1.1.26.0',
|
16 |
'reference' => NULL,
|
17 |
'type' => 'library',
|
18 |
'install_path' => __DIR__ . '/../../',
|
20 |
'dev_requirement' => false,
|
21 |
),
|
22 |
'codeinwp/themeisle-sdk' => array(
|
23 |
+
'pretty_version' => '3.2.29',
|
24 |
+
'version' => '3.2.29.0',
|
25 |
+
'reference' => '9456fb0944ec69c3975de04aaf56233ddc2f828c',
|
26 |
'type' => 'library',
|
27 |
'install_path' => __DIR__ . '/../codeinwp/themeisle-sdk',
|
28 |
'aliases' => array(),
|