Skip to content

Commit

Permalink
Update Trial Panel Buy Now Links (#27575)
Browse files Browse the repository at this point in the history
Co-authored-by: Roch Nicolas <[email protected]>
Co-authored-by: Rochmar Nicolas (DevExpress) <[email protected]>
  • Loading branch information
3 people authored Jun 11, 2024
1 parent d2a09f3 commit e075fc5
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 17 deletions.
6 changes: 6 additions & 0 deletions packages/devextreme-angular/src/core/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import { isPlatformServer } from '@angular/common';

import domAdapter from 'devextreme/core/dom_adapter';
import { triggerHandler } from 'devextreme/events';
import config from 'devextreme/core/config';

import { DxTemplateDirective } from './template';
import { IDxTemplateHost, DxTemplateHost } from './template-host';
import { EmitterHelper, NgEventsStrategy } from './events-strategy';
Expand All @@ -34,6 +36,10 @@ import {
CollectionNestedOptionContainerImpl,
} from './nested-option';

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

let serverStateKey;
export const getServerStateKey = () => {
if (!serverStateKey) {
Expand Down
20 changes: 13 additions & 7 deletions packages/devextreme-react/src/core/component-base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {

import { requestAnimationFrame } from 'devextreme/animation/frame';
import { deferUpdate } from 'devextreme/core/utils/common';
import config from 'devextreme/core/config';

import { createPortal } from 'react-dom';

import { RemovalLockerContext, RestoreTreeContext } from './helpers';
Expand All @@ -26,6 +28,10 @@ import { ComponentProps } from './component';

const DX_REMOVE_EVENT = 'dxremove';

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

type ComponentBaseProps = ComponentProps & {
renderChildren?: () => Record<string, unknown>[] | null | undefined;
};
Expand Down Expand Up @@ -201,14 +207,14 @@ const ComponentBase = forwardRef<ComponentBaseRef, any>(

el = el || element.current;

const config = getConfig();
const widgetConfig = getConfig();

let options: any = {
templatesRenderAsynchronously: true,
...optionsManager.current.getInitialOptions(config),
...optionsManager.current.getInitialOptions(widgetConfig),
};

const templateOptions = optionsManager.current.getTemplateOptions(config);
const templateOptions = optionsManager.current.getTemplateOptions(widgetConfig);
const dxTemplates = createDXTemplates.current?.(templateOptions);

if (dxTemplates && Object.keys(dxTemplates).length) {
Expand All @@ -230,7 +236,7 @@ const ComponentBase = forwardRef<ComponentBaseRef, any>(
);
}

optionsManager.current.setInstance(instance.current, config, subscribableOptions, independentEvents);
optionsManager.current.setInstance(instance.current, widgetConfig, subscribableOptions, independentEvents);
instance.current.on('optionChanged', optionsManager.current.onOptionChanged);

afterCreateWidget();
Expand All @@ -257,12 +263,12 @@ const ComponentBase = forwardRef<ComponentBaseRef, any>(

updateCssClasses(prevPropsRef.current, props);

const config = getConfig();
const widgetConfig = getConfig();

const templateOptions = optionsManager.current.getTemplateOptions(config);
const templateOptions = optionsManager.current.getTemplateOptions(widgetConfig);
const dxTemplates = createDXTemplates.current?.(templateOptions) || {};

optionsManager.current.update(config, dxTemplates);
optionsManager.current.update(widgetConfig, dxTemplates);
scheduleTemplatesUpdate();

prevPropsRef.current = props;
Expand Down
21 changes: 13 additions & 8 deletions packages/devextreme-vue/src/core/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {

import CreateCallback from 'devextreme/core/utils/callbacks';
import { triggerHandler } from 'devextreme/events';
import config from 'devextreme/core/config';

import {
defaultSlots, getChildren, getComponentProps, getVModelValue, VMODEL_NAME,
Expand Down Expand Up @@ -44,6 +45,10 @@ export interface IBaseComponent extends ComponentPublicInstance, IWidgetComponen

const includeAttrs = ['id', 'class', 'style'];

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

function getAttrs(attrs) {
const attributes = {};
includeAttrs.forEach((attr) => {
Expand Down Expand Up @@ -187,26 +192,26 @@ function initBaseComponent() {
thisComponent.$_pendingOptions = {};
thisComponent.$_templatesManager = new TemplatesManager(this as ComponentPublicInstance);

const config = thisComponent.$_config;
const widgetConfig = thisComponent.$_config;

if (config.initialValues.hasOwnProperty(VMODEL_NAME)) {
config.initialValues.value = getVModelValue(config.initialValues);
if (widgetConfig.initialValues.hasOwnProperty(VMODEL_NAME)) {
widgetConfig.initialValues.value = getVModelValue(widgetConfig.initialValues);
}

const options: object = {
templatesRenderAsynchronously: thisComponent.$_hasAsyncTemplate,
...getComponentProps(thisComponent),
...config.initialValues,
...config.getNestedOptionValues(),
...widgetConfig.initialValues,
...widgetConfig.getNestedOptionValues(),
...this.$_getIntegrationOptions(),
};

const instance = new thisComponent.$_WidgetClass(element, options);
thisComponent.$_instance = instance;

instance.on('optionChanged', (args) => config.onOptionChanged(args));
setEmitOptionChangedFunc(config, thisComponent, thisComponent.$_innerChanges);
bindOptionWatchers(config, thisComponent, thisComponent.$_innerChanges);
instance.on('optionChanged', (args) => widgetConfig.onOptionChanged(args));
setEmitOptionChangedFunc(widgetConfig, thisComponent, thisComponent.$_innerChanges);
bindOptionWatchers(widgetConfig, thisComponent, thisComponent.$_innerChanges);
this.$_createEmitters(instance);
},

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import config from '@js/core/config';
import errors from '@js/core/errors';
import { fullVersion } from '@js/core/version';

Expand Down Expand Up @@ -30,7 +31,7 @@ const FORMAT = 1;
const RTM_MIN_PATCH_VERSION = 3;
const KEY_SPLITTER = '.';

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

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

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

const preview = isPreview(version.patch);
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 @@ -387,6 +387,7 @@ export type GlobalConfig = {
* @public
*/
licenseKey?: string;
buyNowLink?: string;
};

/**
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 @@ -1545,6 +1545,7 @@ declare module DevExpress.common {
* [descr:GlobalConfig.licenseKey]
*/
licenseKey?: string;
buyNowLink?: string;
};
/**
* [descr:GroupItem]
Expand Down

0 comments on commit e075fc5

Please sign in to comment.