Skip to content

Commit cb8efbd

Browse files
authored
release: new version
- remove legacy Page Templates functionality - remove Template Cloud functionality for new users & users who weren't using the feature - we have launched a dedicated Templates Cloud plugin that offers advanced permission controls and additional features. which you can try from your Themeisle account - if you already have templates saved in the cloud, you can still use them in this plugin if you already have a license key set up
2 parents 067a173 + ce77bb0 commit cb8efbd

File tree

20 files changed

+650
-302
lines changed

20 files changed

+650
-302
lines changed

assets/src/Components/Main.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import ImportModal from './ImportModal';
99
import DemoSiteTemplatesImport from './CloudLibrary/DemoSiteTemplatesImport';
1010
import Header from './Header';
1111
import OnboardingContent from './OnboardingContent';
12-
import Settings from "./Settings/Settings";
12+
import Settings from './Settings/Settings';
13+
import NewTCNotice from './NewTCNotice';
1314

1415
const Onboarding = ( {
1516
getSites,
@@ -28,6 +29,9 @@ const Onboarding = ( {
2829
<Header />
2930
<div className="ob-body">
3031
<div className="content-container">
32+
33+
{['library', 'settings'].includes(currentTab) && <NewTCNotice/>}
34+
3135
{ migration && <Migration data={ migration } /> }
3236

3337
{ 'starterSites' === currentTab &&
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import {__} from '@wordpress/i18n';
2+
import {Button} from '@wordpress/components';
3+
import {close} from '@wordpress/icons';
4+
import {useState} from '@wordpress/element';
5+
import {ajaxAction} from '../utils/rest';
6+
7+
export default function () {
8+
const [isVisible, setIsVisible] = useState(true);
9+
10+
const {
11+
show,
12+
ajaxURL,
13+
nonce
14+
} = window.tiobDash.newTCNotice;
15+
16+
const dismissNotice = () => {
17+
ajaxAction(
18+
ajaxURL,
19+
'dismiss_new_tc_notice',
20+
nonce
21+
).then( (r) => {
22+
console.log(r);
23+
setIsVisible(false);
24+
} ).catch(e => {
25+
console.error(e);
26+
} );
27+
};
28+
29+
if (!show || ! isVisible) {
30+
return null;
31+
}
32+
33+
return (
34+
<div className="tiob-new-tc-notice">
35+
<div>
36+
<p>
37+
{__('We\'ve launched a dedicated Templates Cloud plugin that offers advanced permission controls and additional features. Try it out from your Themeisle account.', 'templates-patterns-collection')}
38+
</p>
39+
40+
<p className="description">
41+
{__('If you already have templates saved in the cloud, you can still use them in this plugin.', 'templates-patterns-collection')}
42+
</p>
43+
</div>
44+
45+
<Button
46+
size="compact"
47+
className="dismiss"
48+
icon={close}
49+
iconSize={20}
50+
label={__('Dismiss', 'templates-patterns-collection')}
51+
onClick={dismissNotice}
52+
/>
53+
</div>
54+
);
55+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.tiob-new-tc-notice {
2+
padding: 10px 20px;
3+
background: #fff;
4+
border: 1px solid #e5e5e5;
5+
display: flex;
6+
margin-top: 20px;
7+
width: 100%;
8+
gap: 20px;
9+
box-sizing: border-box;
10+
align-items: center;
11+
border-left: 5px solid var(--wp-admin-theme-color, #3858e9);
12+
13+
p {
14+
margin: 0 0 10px;
15+
font-size: 14px;
16+
}
17+
18+
.description {
19+
font-size: 12px;
20+
margin: 0;
21+
}
22+
23+
.dismiss {
24+
flex-shrink: 0;
25+
margin-left: auto;
26+
}
27+
}

assets/src/style.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
@import "scss/license";
2020
@import "scss/feedback";
2121
@import "scss/settings";
22+
@import "scss/new-tc-notice";
2223

2324
@import "scss/media-queries";

beaver/src/components/header.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ const Header = ( { closeModal, getOrder, getSearchQuery } ) => {
1212
const { setFetching, updateCurrentTab } = useDispatch( 'tpc/beaver' );
1313

1414
const TABS = {
15-
templates: window.tiTpc.library.tabs.templates,
15+
library: window.tiTpc.library.tabs.library,
16+
// Removed during PRF.
17+
// templates: window.tiTpc.library.tabs.templates,
1618
};
1719

18-
if ( parseInt( window.tiTpc.tier ) === 3 ) {
19-
TABS.library = window.tiTpc.library.tabs.library;
20-
}
21-
2220
const isFetching = useSelect( ( select ) =>
2321
select( 'tpc/beaver' ).isFetching()
2422
);
@@ -85,10 +83,7 @@ const Header = ( { closeModal, getOrder, getSearchQuery } ) => {
8583
/>
8684
) }
8785

88-
{ window.tiTpc.postTypes.includes(
89-
window.tiTpc.postType
90-
) &&
91-
parseInt( window.tiTpc.tier ) === 3 && (
86+
{ window.tiTpc.postTypes.includes(window.tiTpc.postType) && (
9287
<Button
9388
label={ window.tiTpc.library.actions.save }
9489
icon={ cloudUpload }

beaver/src/data/store/index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ import { registerStore } from '@wordpress/data';
33
const DEFAULT_STATE = {
44
isFetching: true,
55
isPreview: false,
6-
tab:
7-
parseInt( window.tiTpc ? window.tiTpc.tier : 0 ) === 3
8-
? 'library'
9-
: 'templates',
6+
tab: 'library',
107
templates: {
118
items: [],
129
currentPage: 0,

beaver/src/export.js

Lines changed: 56 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,61 @@
11
/* global FLBuilder */
22

3-
if ( parseInt( window.tiTpc.tier ) === 3 ) {
4-
const contextMenu = document.getElementById( 'tmpl-fl-row-overlay' );
5-
6-
const tpcExport = ( e ) => {
7-
const row = e.closest( '.fl-row' );
8-
const node = row.dataset.node;
9-
10-
const message = `<div class="tpc-template-cloud-export-modal">
11-
<h1>${ window.tiTpc.exporter.modalLabel }</h1>
12-
<label for="tpc-${ node }">${ window.tiTpc.exporter.textLabel }</label>
13-
<input id="tpc-${ node }" type="text" placeholder="${ window.tiTpc.exporter.textPlaceholder }" />
14-
</div>`;
15-
16-
FLBuilder.confirm( {
17-
message,
18-
ok: () => {
19-
const input = document.getElementById( `tpc-${ node }` );
20-
const title = input.value || 'Template';
21-
setTimeout( function () {
22-
FLBuilder.showAjaxLoader();
23-
FLBuilder.ajax(
24-
{
25-
action: 'ti_export_template',
26-
node,
27-
title,
28-
},
29-
( res ) => {
30-
if ( undefined !== res.success && ! res.success ) {
31-
FLBuilder.alert(
32-
`<h1>${ window.tiTpc.exporter.exportFailed }</h1> ${ res.data }`
33-
);
34-
}
35-
36-
FLBuilder.hideAjaxLoader();
3+
const contextMenu = document.getElementById( 'tmpl-fl-row-overlay' );
4+
5+
const tpcExport = ( e ) => {
6+
const row = e.closest( '.fl-row' );
7+
const node = row.dataset.node;
8+
9+
const message = `<div class="tpc-template-cloud-export-modal">
10+
<h1>${ window.tiTpc.exporter.modalLabel }</h1>
11+
<label for="tpc-${ node }">${ window.tiTpc.exporter.textLabel }</label>
12+
<input id="tpc-${ node }" type="text" placeholder="${ window.tiTpc.exporter.textPlaceholder }" />
13+
</div>`;
14+
15+
FLBuilder.confirm( {
16+
message,
17+
ok: () => {
18+
const input = document.getElementById( `tpc-${ node }` );
19+
const title = input.value || 'Template';
20+
setTimeout( function () {
21+
FLBuilder.showAjaxLoader();
22+
FLBuilder.ajax(
23+
{
24+
action: 'ti_export_template',
25+
node,
26+
title,
27+
},
28+
( res ) => {
29+
if ( undefined !== res.success && ! res.success ) {
30+
FLBuilder.alert(
31+
`<h1>${ window.tiTpc.exporter.exportFailed }</h1> ${ res.data }`
32+
);
3733
}
38-
);
39-
}, 1000 );
40-
},
41-
strings: {
42-
ok: window.tiTpc.exporter.buttonLabel,
43-
cancel: window.tiTpc.exporter.cancelLabel,
44-
},
45-
} );
46-
};
47-
48-
window.tiTpc.tpcExport = tpcExport;
49-
50-
if ( contextMenu ) {
51-
const text = contextMenu.textContent;
52-
contextMenu.textContent = text.replace(
53-
// eslint-disable-next-line prettier/prettier
54-
'<li><a class="fl-block-row-reset" href="javascript:void(0);">Reset Row Width</a></li>',
55-
// eslint-disable-next-line prettier/prettier
56-
'<li><a class="fl-block-row-reset" href="javascript:void(0);">Reset Row Width</a></li><li><a class="fl-block-row-tpc-export" onclick="window.tiTpc.tpcExport(this)" href="javascript:void(0);">Save to Templates Cloud</a></li>'
57-
);
58-
}
59-
60-
FLBuilder.addHook( 'tiTpcExport', () => {
61-
window.tiTpc.initModalExport();
34+
35+
FLBuilder.hideAjaxLoader();
36+
}
37+
);
38+
}, 1000 );
39+
},
40+
strings: {
41+
ok: window.tiTpc.exporter.buttonLabel,
42+
cancel: window.tiTpc.exporter.cancelLabel,
43+
},
6244
} );
45+
};
46+
47+
window.tiTpc.tpcExport = tpcExport;
48+
49+
if ( contextMenu ) {
50+
const text = contextMenu.textContent;
51+
contextMenu.textContent = text.replace(
52+
// eslint-disable-next-line prettier/prettier
53+
'<li><a class="fl-block-row-reset" href="javascript:void(0);">Reset Row Width</a></li>',
54+
// eslint-disable-next-line prettier/prettier
55+
'<li><a class="fl-block-row-reset" href="javascript:void(0);">Reset Row Width</a></li><li><a class="fl-block-row-tpc-export" onclick="window.tiTpc.tpcExport(this)" href="javascript:void(0);">Save to Templates Cloud</a></li>'
56+
);
6357
}
58+
59+
FLBuilder.addHook( 'tiTpcExport', () => {
60+
window.tiTpc.initModalExport();
61+
} );

editor/src/components/header.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@ const Header = ( { closeModal, getOrder, getSearchQuery } ) => {
1414
const { setFetching, updateCurrentTab } = useDispatch( 'tpc/block-editor' );
1515

1616
const TABS = {
17-
templates: __( 'Page Templates', 'templates-patterns-collection' ),
18-
// patterns: __( 'Patterns' ),
17+
library : __( 'My Library', 'templates-patterns-collection' )
18+
// Removed since PRF.
19+
// templates: __( 'Page Templates', 'templates-patterns-collection' ),
1920
};
2021

21-
if ( parseInt( tiTpc.tier ) === 3 ) {
22-
TABS.library = __( 'My Library', 'templates-patterns-collection' );
23-
}
24-
2522
const isFetching = useSelect( ( select ) =>
2623
select( 'tpc/block-editor' ).isFetching()
2724
);

editor/src/data/block-editor/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { registerStore } from '@wordpress/data';
33
const DEFAULT_STATE = {
44
isFetching: true,
55
isPreview: false,
6-
tab: parseInt( window.tiTpc.tier ) === 3 ? 'library' : 'templates',
6+
tab: 'library',
77
templates: [],
88
patterns: [],
99
library: {

editor/src/index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ if ( ! tiTpc.isSiteEditor ) {
3434
} );
3535
}
3636

37-
if ( parseInt( tiTpc.tier ) === 3 ) {
38-
registerPlugin( 'ti-tpc', {
39-
render: tiTpc.isSiteEditor ? SiteEditorExporter : Exporter,
40-
icon,
41-
} );
42-
}
37+
registerPlugin( 'ti-tpc', {
38+
render: tiTpc.isSiteEditor ? SiteEditorExporter : Exporter,
39+
icon,
40+
} );

0 commit comments

Comments
 (0)