Skip to content

Commit

Permalink
Update Trial Panel texts (#28407) (#28505)
Browse files Browse the repository at this point in the history
Co-authored-by: Mikhail Preyskurantov <[email protected]>
  • Loading branch information
AlisherAmonulloev and mpreyskurantov authored Dec 5, 2024
1 parent cb42040 commit bd502db
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/core/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {

config({
buyNowLink: 'https://go.devexpress.com/Licensing_Installer_Watermark_DevExtremeAngular.aspx',
licensingDocLink: 'https://go.devexpress.com/Licensing_Documentation_DevExtremeAngular.aspx',
});

let serverStateKey;
Expand Down
4 changes: 4 additions & 0 deletions packages/devextreme-angular/tests/src/core/component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ describe('DevExtreme Angular widget', () => {
expect(config().buyNowLink).toBe('https://go.devexpress.com/Licensing_Installer_Watermark_DevExtremeAngular.aspx');
});

it('correctly sets the help link', () => {
expect(config().licensingDocLink).toBe('https://go.devexpress.com/Licensing_Documentation_DevExtremeAngular.aspx');
});

it('should be disposed', () => {
let testSpy = spyOn(TestContainerComponent.prototype, 'testMethod');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ describe('rendering', () => {
it('correctly sets the buy now link', () => {
expect(config().buyNowLink).toBe('https://go.devexpress.com/Licensing_Installer_Watermark_DevExtremeReact.aspx');
});

it('correctly sets the help link', () => {
expect(config().licensingDocLink).toBe('https://go.devexpress.com/Licensing_Documentation_DevExtremeReact.aspx');
});
});

describe('nested full components', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-react/src/core/component-base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const DX_REMOVE_EVENT = 'dxremove';

config({
buyNowLink: 'https://go.devexpress.com/Licensing_Installer_Watermark_DevExtremeReact.aspx',
licensingDocLink: 'https://go.devexpress.com/Licensing_Documentation_DevExtremeReact.aspx',
});

type ComponentBaseProps = ComponentProps & {
Expand Down
4 changes: 4 additions & 0 deletions packages/devextreme-vue/src/core/__tests__/component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ describe('component rendering', () => {
expect(config().buyNowLink).toBe('https://go.devexpress.com/Licensing_Installer_Watermark_DevExtremeVue.aspx');
});

it('correctly sets the help link', () => {
expect(config().licensingDocLink).toBe('https://go.devexpress.com/Licensing_Documentation_DevExtremeVue.aspx');
});

describe('options', () => {
it('watch prop changing to undefined', (done) => {
const wrapper = mount(TestComponent, {
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-vue/src/core/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const includeAttrs = ['id', 'class', 'style'];

config({
buyNowLink: 'https://go.devexpress.com/Licensing_Installer_Watermark_DevExtremeVue.aspx',
licensingDocLink: 'https://go.devexpress.com/Licensing_Documentation_DevExtremeVue.aspx',
});

function getAttrs(attrs, dxClasses: string[]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const RTM_MIN_PATCH_VERSION = 3;
const KEY_SPLITTER = '.';

const BUY_NOW_LINK = 'https://go.devexpress.com/Licensing_Installer_Watermark_DevExtremeJQuery.aspx';
const LICENSING_DOC_LINK = 'https://go.devexpress.com/Licensing_Documentation_DevExtremeJQuery.aspx';

const GENERAL_ERROR: Token = { kind: TokenKind.corrupted, error: 'general' };
const VERIFICATION_ERROR: Token = { kind: TokenKind.corrupted, error: 'verification' };
Expand Down Expand Up @@ -177,7 +178,9 @@ export function validateLicense(licenseKey: string, versionStr: string = fullVer
}

if (error && !internal) {
showTrialPanel(config().buyNowLink ?? BUY_NOW_LINK, fullVersion);
const buyNowLink = config().buyNowLink ?? BUY_NOW_LINK;
const licensingDocLink = config().licensingDocLink ?? LICENSING_DOC_LINK;
showTrialPanel(buyNowLink, licensingDocLink, fullVersion);
}

const preview = isPreview(version.patch);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const componentNames = {
};
const attributeNames = {
buyNow: 'buy-now',
licensingDoc: 'licensing-doc',
version: 'version',
};
const commonStyles = {
Expand Down Expand Up @@ -186,7 +187,9 @@ class DxLicense extends SafeHTMLElement {
contentContainer.style.cssText = this._contentStyles;
contentContainer.append(
this._createSpan('For evaluation purposes only. Redistribution prohibited. Please '),
this._createLink('purchase a license', this.getAttribute(attributeNames.buyNow) as string),
this._createLink('register', this.getAttribute(attributeNames.licensingDoc) as string),
this._createSpan(' an existing license or '),
this._createLink('purchase a new license', this.getAttribute(attributeNames.buyNow) as string),
this._createSpan(` to continue use of DevExpress product libraries (v${this.getAttribute(attributeNames.version)}).`),
);
return contentContainer;
Expand Down Expand Up @@ -254,6 +257,11 @@ class DxLicenseTrigger extends SafeHTMLElement {
this.getAttribute(attributeNames.buyNow) as string,
);

license.setAttribute(
attributeNames.licensingDoc,
this.getAttribute(attributeNames.licensingDoc) as string,
);

license.setAttribute(DATA_PERMANENT_ATTRIBUTE, 'true');

document.body.prepend(license);
Expand All @@ -277,6 +285,7 @@ export function registerCustomComponents(customStyles?: CustomTrialPanelStyles):

export function renderTrialPanel(
buyNowUrl: string,
licensingDocUrl: string,
version: string,
customStyles?: CustomTrialPanelStyles,
): void {
Expand All @@ -285,6 +294,7 @@ export function renderTrialPanel(
const trialPanelTrigger = document.createElement(componentNames.trigger);

trialPanelTrigger.setAttribute(attributeNames.buyNow, buyNowUrl);
trialPanelTrigger.setAttribute(attributeNames.licensingDoc, licensingDocUrl);
trialPanelTrigger.setAttribute(attributeNames.version, version);

document.body.appendChild(trialPanelTrigger);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import {

export function showTrialPanel(
buyNowUrl: string,
licensingDocUrl: string,
version: string,
customStyles?: CustomTrialPanelStyles,
): void {
if (isClient()) {
renderTrialPanel(buyNowUrl, version, customStyles);
renderTrialPanel(buyNowUrl, licensingDocUrl, version, customStyles);
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/devextreme/js/common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ export type GlobalConfig = {
*/
licenseKey?: string;
buyNowLink?: string;
licensingDocLink?: string;
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ $.each(DevExpress.ui, function(componentName) {
if(newDomElements.length === originalDomElements.length) {
assert.ok(true, 'After a component is disposed, additional DOM elements must be removed');
} else {
if(newDomElements.length - originalDomElements.length <= 9) {
if(newDomElements.length - originalDomElements.length <= 11) {
// viz widgets create extra style node that can not be deleted
ignorePatterns = {
'style': /behavior:\surl\(#default#VML\)/gi,
Expand All @@ -47,8 +47,8 @@ $.each(DevExpress.ui, function(componentName) {
'svg': /13.4 12.7 8.7 8 13.4 3.4 12.6 2.6 8 7.3 3.4 2.6 2.6 3.4 7.3 8 2.6 12.6 3.4 13.4 8 8.7 12.7 13.4 13.4 12.7/,
'polygon': /$/,
'div': /For evaluation purposes only. Redistribution prohibited.|to continue use of DevExpress product libraries|points="13.4 12.7 8.7 8 13.4 3.4 12.6 2.6 8 7.3 3.4 2.6 2.6 3.4 7.3 8 2.6 12.6 3.4 13.4 8 8.7 12.7 13.4 13.4 12.7/,
'span': /For evaluation purposes only. Redistribution prohibited.|to continue use of DevExpress product libraries/,
'a': /purchase a license/,
'span': /For evaluation purposes only. Redistribution prohibited.|an existing license|to continue use of DevExpress product libraries/,
'a': /purchase a new license|register/,
};
}
errorMessage = memoryLeaksHelper.compareDomElements(originalDomElements, newDomElements, ignorePatterns);
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme/ts/dx.all.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,7 @@ declare module DevExpress.common {
*/
licenseKey?: string;
buyNowLink?: string;
licensingDocLink?: string;
};
/**
* [descr:GroupItem]
Expand Down

0 comments on commit bd502db

Please sign in to comment.