@adaptabletools/adaptable 18.0.0-canary.10 → 18.0.0-canary.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/Utilities/Services/LicenseService/index.js +1 -193
- package/src/Utilities/license/decode.js +1 -65
- package/src/Utilities/license/hashing.js +1 -43
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.d.ts +1 -1
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +2 -2
- package/src/View/GridFilter/GridFilterViewPanel.js +1 -1
- package/src/View/License/LicenseWatermark.js +1 -61
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.js +1 -9426
- package/tsconfig.esm.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "18.0.0-canary.
|
|
3
|
+
"version": "18.0.0-canary.11",
|
|
4
4
|
"description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -1,193 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { PopupShowAlert } from '../../../Redux/ActionsReducers/PopupRedux';
|
|
3
|
-
import ObjectFactory from '../../ObjectFactory';
|
|
4
|
-
import clamp from 'lodash/clamp';
|
|
5
|
-
import { LicenseDocsLink } from '../../Constants/DocumentationLinkConstants';
|
|
6
|
-
import { decode as decodeLicense, GENERIC_APP_NAME } from '../../license/decode';
|
|
7
|
-
import { shouldLogThankYouMessage } from './shouldLogThankYouMessage';
|
|
8
|
-
const EMAIL = 'sales@adaptabletools.com';
|
|
9
|
-
const COMMERCIAL_LICENSE_SHOW_INFO_DAYS_BEFORE_EXPIRE = 10;
|
|
10
|
-
const DAY_IN_MS = 1000 * 60 * 60 * 24;
|
|
11
|
-
export var LicenseValidityType;
|
|
12
|
-
(function (LicenseValidityType) {
|
|
13
|
-
LicenseValidityType["INVALID_LICENSE"] = "INVALID_LICENSE";
|
|
14
|
-
LicenseValidityType["NO_LICENSE"] = "NO_LICENSE";
|
|
15
|
-
LicenseValidityType["NON_PRODUCTION_VALID"] = "NON_PRODUCTION_VALID";
|
|
16
|
-
LicenseValidityType["NON_PRODUCTION_EXPIRED_IN_SCOPE"] = "NON_PRODUCTION_EXPIRED_IN_SCOPE";
|
|
17
|
-
LicenseValidityType["NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE"] = "NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE";
|
|
18
|
-
LicenseValidityType["COMMERCIAL_VALID"] = "COMMERCIAL_VALID";
|
|
19
|
-
LicenseValidityType["COMMERCIAL_EXPIRED_IN_SCOPE"] = "COMMERCIAL_EXPIRED_IN_SCOPE";
|
|
20
|
-
LicenseValidityType["COMMERCIAL_EXPIRED_OUT_OF_SCOPE"] = "COMMERCIAL_EXPIRED_OUT_OF_SCOPE";
|
|
21
|
-
})(LicenseValidityType || (LicenseValidityType = {}));
|
|
22
|
-
const SANDPACK_REGEX = /(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g;
|
|
23
|
-
const SANDBOX_REGEX = /(https):\/\/\S+(\.csb\.app)/g;
|
|
24
|
-
const DEMO_REGEX = /(https):\/\/\S+(\.adaptabletools\.com)/g;
|
|
25
|
-
const getOrigin = () => {
|
|
26
|
-
return typeof window !== 'undefined' ? window.location.origin : '';
|
|
27
|
-
};
|
|
28
|
-
const isInsideSandpack = () => {
|
|
29
|
-
const [_fullUrl, protocol, sandpackUrl] = Array.from(SANDPACK_REGEX.exec(getOrigin()) || []);
|
|
30
|
-
return protocol === 'https' && sandpackUrl === 'sandpack.codesandbox.io';
|
|
31
|
-
};
|
|
32
|
-
const isInsideSandbox = () => {
|
|
33
|
-
const [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(getOrigin()) || []);
|
|
34
|
-
return protocol === 'https' && sandboxUrl === '.csb.app';
|
|
35
|
-
};
|
|
36
|
-
const isDemoApp = () => {
|
|
37
|
-
const [_fullUrl, protocol, demoAppUrl] = Array.from(DEMO_REGEX.exec(getOrigin()) || []);
|
|
38
|
-
return protocol === 'https' && demoAppUrl === '.adaptabletools.com';
|
|
39
|
-
};
|
|
40
|
-
export class LicenseService {
|
|
41
|
-
constructor(adaptable, licenseKey, packageDetails) {
|
|
42
|
-
this.adaptable = adaptable;
|
|
43
|
-
this.licenseKey = licenseKey;
|
|
44
|
-
this.packageDetails = packageDetails;
|
|
45
|
-
this.adaptable = adaptable;
|
|
46
|
-
this.adaptable.api.eventApi.on('AdaptableReady', () => {
|
|
47
|
-
requestAnimationFrame(() => {
|
|
48
|
-
// using a rAF because we want to make sure that the window.location.origin is available (Master/Detail is fidgity sometimes)
|
|
49
|
-
this.init();
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
init() {
|
|
54
|
-
let details = null;
|
|
55
|
-
if (this.licenseKey) {
|
|
56
|
-
try {
|
|
57
|
-
details = decodeLicense(this.licenseKey);
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
details = error;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (!isInsideSandpack() && !isInsideSandbox() && !isDemoApp()) {
|
|
64
|
-
this.handleLicenseValidation(details, this.getValidityType(details, this.packageDetails));
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
getValidityType(details, packageDetails) {
|
|
68
|
-
if (!details) {
|
|
69
|
-
return LicenseValidityType.NO_LICENSE;
|
|
70
|
-
}
|
|
71
|
-
if (details instanceof Error) {
|
|
72
|
-
return LicenseValidityType.INVALID_LICENSE;
|
|
73
|
-
}
|
|
74
|
-
const currentVersionReleaseDate = new Date(packageDetails.publishedAt);
|
|
75
|
-
const licenseEndDate = new Date(details.end);
|
|
76
|
-
const currentDate = new Date();
|
|
77
|
-
const isExpired = licenseEndDate < currentDate;
|
|
78
|
-
const isTrial = details.trial;
|
|
79
|
-
const isScope = licenseEndDate > currentVersionReleaseDate;
|
|
80
|
-
let validityType = null;
|
|
81
|
-
if (isExpired) {
|
|
82
|
-
if (isScope) {
|
|
83
|
-
if (isTrial) {
|
|
84
|
-
validityType = LicenseValidityType.NON_PRODUCTION_EXPIRED_IN_SCOPE;
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
validityType = LicenseValidityType.COMMERCIAL_EXPIRED_IN_SCOPE;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
if (isTrial) {
|
|
92
|
-
validityType = LicenseValidityType.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE;
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
validityType = LicenseValidityType.COMMERCIAL_EXPIRED_OUT_OF_SCOPE;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
if (isTrial) {
|
|
101
|
-
validityType = LicenseValidityType.NON_PRODUCTION_VALID;
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
validityType = LicenseValidityType.COMMERCIAL_VALID;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return validityType;
|
|
108
|
-
}
|
|
109
|
-
handleLicenseValidation(details, validityType) {
|
|
110
|
-
var _a;
|
|
111
|
-
const nowAtMidnight = new Date();
|
|
112
|
-
nowAtMidnight.setHours(0, 0, 0, 0);
|
|
113
|
-
let daysLeft = 0;
|
|
114
|
-
if (!(details instanceof Error) && (details === null || details === void 0 ? void 0 : details.end)) {
|
|
115
|
-
daysLeft = Math.floor((((_a = details === null || details === void 0 ? void 0 : details.end) === null || _a === void 0 ? void 0 : _a.getTime()) - nowAtMidnight.getTime()) / DAY_IN_MS);
|
|
116
|
-
daysLeft = clamp(daysLeft, 0, Infinity);
|
|
117
|
-
}
|
|
118
|
-
let APP_NAME = '';
|
|
119
|
-
let forApp = '';
|
|
120
|
-
if (details &&
|
|
121
|
-
!(details instanceof Error) &&
|
|
122
|
-
details.appName &&
|
|
123
|
-
details.appName != GENERIC_APP_NAME) {
|
|
124
|
-
APP_NAME = details.appName;
|
|
125
|
-
forApp = ` for application [APP_NAME]`;
|
|
126
|
-
}
|
|
127
|
-
const annotateMessage = (message, link = LicenseDocsLink, email = EMAIL, days = daysLeft, appName = APP_NAME) => {
|
|
128
|
-
return message
|
|
129
|
-
.replace('[LINK]', link)
|
|
130
|
-
.replace('[EMAIL]', email)
|
|
131
|
-
.replace('[APP_NAME]', appName)
|
|
132
|
-
.replace('[DAYS]', `${days}`);
|
|
133
|
-
};
|
|
134
|
-
switch (validityType) {
|
|
135
|
-
case 'NO_LICENSE':
|
|
136
|
-
case 'NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE':
|
|
137
|
-
this.adaptable.logger.consoleLogByMessageType(annotateMessage('This instance of AdapTable does not have a license, and some functionality has therefore been removed. In order to use a fully-featured version of AdapTable, please contact [EMAIL]. You can learn more about the different AdapTable license options at [LINK].'), 'Error');
|
|
138
|
-
this.showNotification('No AdapTable License found.');
|
|
139
|
-
this.showWatermark('This instance of AdapTable does not have a license, and some functionality has therefore been removed.');
|
|
140
|
-
this.disableStatePersistence();
|
|
141
|
-
break;
|
|
142
|
-
case 'INVALID_LICENSE':
|
|
143
|
-
this.adaptable.logger.consoleLogByMessageType(annotateMessage('This instance of AdapTable seems to use a corrupted License, and some functionality has therefore been removed. In order to use a fully-featured version of AdapTable, please contact [EMAIL]. You can learn more about the different AdapTable license options at [LINK].'), 'Error');
|
|
144
|
-
this.showNotification('Corrupted AdapTable License found.');
|
|
145
|
-
this.showWatermark(`This instance of AdapTable has a corrupted License, and some functionality has therefore been removed.`);
|
|
146
|
-
this.disableStatePersistence();
|
|
147
|
-
break;
|
|
148
|
-
case 'NON_PRODUCTION_VALID':
|
|
149
|
-
this.adaptable.logger.consoleLogByMessageType(annotateMessage('This AdapTable trial license expires in [DAYS] days. Please contact [EMAIL] to upgrade to a commercial version of AdapTable. You can learn more about the different AdapTable license options at [LINK].'), 'Info');
|
|
150
|
-
break;
|
|
151
|
-
case 'NON_PRODUCTION_EXPIRED_IN_SCOPE':
|
|
152
|
-
this.adaptable.logger.consoleLogByMessageType(annotateMessage('This AdapTable trial license has now expired. Please contact [EMAIL] to upgrade to a commercial version of AdapTable. You can learn more about the different AdapTable license options at [LINK].'), 'Warning');
|
|
153
|
-
this.showWatermark('AdapTable License has expired');
|
|
154
|
-
break;
|
|
155
|
-
case 'COMMERCIAL_VALID':
|
|
156
|
-
if (daysLeft <= COMMERCIAL_LICENSE_SHOW_INFO_DAYS_BEFORE_EXPIRE) {
|
|
157
|
-
this.adaptable.logger.consoleLogByMessageType(annotateMessage(`This AdapTable license${forApp} expires in [DAYS] days. Please contact [EMAIL] to renew (giving you access to Support and Updates)`), 'Info');
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
try {
|
|
161
|
-
if (shouldLogThankYouMessage()) {
|
|
162
|
-
this.adaptable.logger.consoleLogByMessageType(annotateMessage(`Thank you for using a valid AdapTable license${forApp}. Your license will expire in [DAYS] days.`), 'Info');
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
catch (ex) { }
|
|
166
|
-
}
|
|
167
|
-
break;
|
|
168
|
-
case 'COMMERCIAL_EXPIRED_IN_SCOPE':
|
|
169
|
-
this.adaptable.logger.consoleLogByMessageType(annotateMessage(`This AdapTable license${forApp} has expired. Please contact [EMAIL] if you wish to renew (giving you access to Support and Updates)`), 'Warning');
|
|
170
|
-
break;
|
|
171
|
-
case 'COMMERCIAL_EXPIRED_OUT_OF_SCOPE':
|
|
172
|
-
this.adaptable.logger.consoleLogByMessageType(annotateMessage(`This AdapTable license${forApp} has expired. Adaptable version was published after the license expired. Please contact [EMAIL] if you wish to renew your license.`), 'Error');
|
|
173
|
-
this.showNotification('Adaptable License has expired');
|
|
174
|
-
this.showWatermark('Adaptable License has expired');
|
|
175
|
-
break;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
showNotification(text) {
|
|
179
|
-
this.adaptable.api.internalApi.dispatchReduxAction(PopupShowAlert({
|
|
180
|
-
alertType: 'generic',
|
|
181
|
-
header: 'License Error',
|
|
182
|
-
message: text,
|
|
183
|
-
alertDefinition: ObjectFactory.CreateInternalAlertDefinitionForMessages('Error'),
|
|
184
|
-
}));
|
|
185
|
-
}
|
|
186
|
-
showWatermark(text) {
|
|
187
|
-
this.adaptable.api.internalApi.dispatchReduxAction(SystemLicenseShowWatermark(text));
|
|
188
|
-
}
|
|
189
|
-
disableStatePersistence() {
|
|
190
|
-
this.adaptable.api.internalApi.dispatchReduxAction(SystemLicenseDisablePersistence());
|
|
191
|
-
}
|
|
192
|
-
destroy() { }
|
|
193
|
-
}
|
|
1
|
+
import{SystemLicenseDisablePersistence as e,SystemLicenseShowWatermark as a}from"../../../Redux/ActionsReducers/SystemRedux";import{PopupShowAlert as t}from"../../../Redux/ActionsReducers/PopupRedux";import i from"../../ObjectFactory";import s from"lodash/clamp";import{LicenseDocsLink as o}from"../../Constants/DocumentationLinkConstants";import{decode as n,GENERIC_APP_NAME as r}from"../../license/decode";import{shouldLogThankYouMessage as l}from"./shouldLogThankYouMessage";const c="sales@adaptabletools.com",d=10,p=864e5;export var LicenseValidityType;!function(e){e.INVALID_LICENSE="INVALID_LICENSE",e.NO_LICENSE="NO_LICENSE",e.NON_PRODUCTION_VALID="NON_PRODUCTION_VALID",e.NON_PRODUCTION_EXPIRED_IN_SCOPE="NON_PRODUCTION_EXPIRED_IN_SCOPE",e.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE="NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE",e.COMMERCIAL_VALID="COMMERCIAL_VALID",e.COMMERCIAL_EXPIRED_IN_SCOPE="COMMERCIAL_EXPIRED_IN_SCOPE",e.COMMERCIAL_EXPIRED_OUT_OF_SCOPE="COMMERCIAL_EXPIRED_OUT_OF_SCOPE"}(LicenseValidityType||(LicenseValidityType={}));const h=/(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g,E=/(https):\/\/\S+(\.csb\.app)/g,I=/(https):\/\/\S+(\.adaptabletools\.com)/g,_=()=>"undefined"!=typeof window?window.location.origin:"",O=()=>{const[e,a,t]=Array.from(h.exec(_())||[]);return"https"===a&&"sandpack.codesandbox.io"===t},A=()=>{const[e,a,t]=Array.from(E.exec(_())||[]);return"https"===a&&".csb.app"===t},L=()=>{const[e,a,t]=Array.from(I.exec(_())||[]);return"https"===a&&".adaptabletools.com"===t};export class LicenseService{constructor(e,a,t){this.adaptable=e,this.licenseKey=a,this.packageDetails=t,this.adaptable=e,this.adaptable.api.eventApi.on("AdaptableReady",(()=>{requestAnimationFrame((()=>{this.init()}))}))}init(){let e=null;if(this.licenseKey)try{e=n(this.licenseKey)}catch(a){e=a}O()||A()||L()||this.handleLicenseValidation(e,this.getValidityType(e,this.packageDetails))}getValidityType(e,a){if(!e)return LicenseValidityType.NO_LICENSE;if(e instanceof Error)return LicenseValidityType.INVALID_LICENSE;const t=new Date(a.publishedAt),i=new Date(e.end),s=i<new Date,o=e.trial;let n=null;return n=s?i>t?o?LicenseValidityType.NON_PRODUCTION_EXPIRED_IN_SCOPE:LicenseValidityType.COMMERCIAL_EXPIRED_IN_SCOPE:o?LicenseValidityType.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE:LicenseValidityType.COMMERCIAL_EXPIRED_OUT_OF_SCOPE:o?LicenseValidityType.NON_PRODUCTION_VALID:LicenseValidityType.COMMERCIAL_VALID,n}handleLicenseValidation(e,a){var t;const i=new Date;i.setHours(0,0,0,0);let n=0;e instanceof Error||!(null==e?void 0:e.end)||(n=Math.floor(((null===(t=null==e?void 0:e.end)||void 0===t?void 0:t.getTime())-i.getTime())/p),n=s(n,0,1/0));let h="",E="";!e||e instanceof Error||!e.appName||e.appName==r||(h=e.appName,E=" for application [APP_NAME]");const I=(e,a=o,t=c,i=n,s=h)=>e.replace("[LINK]",a).replace("[EMAIL]",t).replace("[APP_NAME]",s).replace("[DAYS]",`${i}`);switch(a){case"NO_LICENSE":case"NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE":this.adaptable.logger.consoleLogByMessageType(I("This instance of AdapTable does not have a license, and some functionality has therefore been removed. In order to use a fully-featured version of AdapTable, please contact [EMAIL]. You can learn more about the different AdapTable license options at [LINK]."),"Error"),this.showNotification("No AdapTable License found."),this.showWatermark("This instance of AdapTable does not have a license, and some functionality has therefore been removed."),this.disableStatePersistence();break;case"INVALID_LICENSE":this.adaptable.logger.consoleLogByMessageType(I("This instance of AdapTable seems to use a corrupted License, and some functionality has therefore been removed. In order to use a fully-featured version of AdapTable, please contact [EMAIL]. You can learn more about the different AdapTable license options at [LINK]."),"Error"),this.showNotification("Corrupted AdapTable License found."),this.showWatermark("This instance of AdapTable has a corrupted License, and some functionality has therefore been removed."),this.disableStatePersistence();break;case"NON_PRODUCTION_VALID":this.adaptable.logger.consoleLogByMessageType(I("This AdapTable trial license expires in [DAYS] days. Please contact [EMAIL] to upgrade to a commercial version of AdapTable. You can learn more about the different AdapTable license options at [LINK]."),"Info");break;case"NON_PRODUCTION_EXPIRED_IN_SCOPE":this.adaptable.logger.consoleLogByMessageType(I("This AdapTable trial license has now expired. Please contact [EMAIL] to upgrade to a commercial version of AdapTable. You can learn more about the different AdapTable license options at [LINK]."),"Warning"),this.showWatermark("AdapTable License has expired");break;case"COMMERCIAL_VALID":if(n<=d)this.adaptable.logger.consoleLogByMessageType(I(`This AdapTable license${E} expires in [DAYS] days. Please contact [EMAIL] to renew (giving you access to Support and Updates)`),"Info");else try{l()&&this.adaptable.logger.consoleLogByMessageType(I(`Thank you for using a valid AdapTable license${E}. Your license will expire in [DAYS] days.`),"Info")}catch(e){}break;case"COMMERCIAL_EXPIRED_IN_SCOPE":this.adaptable.logger.consoleLogByMessageType(I(`This AdapTable license${E} has expired. Please contact [EMAIL] if you wish to renew (giving you access to Support and Updates)`),"Warning");break;case"COMMERCIAL_EXPIRED_OUT_OF_SCOPE":this.adaptable.logger.consoleLogByMessageType(I(`This AdapTable license${E} has expired. Adaptable version was published after the license expired. Please contact [EMAIL] if you wish to renew your license.`),"Error"),this.showNotification("Adaptable License has expired"),this.showWatermark("Adaptable License has expired")}}showNotification(e){this.adaptable.api.internalApi.dispatchReduxAction(t({alertType:"generic",header:"License Error",message:e,alertDefinition:i.CreateInternalAlertDefinitionForMessages("Error")}))}showWatermark(e){this.adaptable.api.internalApi.dispatchReduxAction(a(e))}disableStatePersistence(){this.adaptable.api.internalApi.dispatchReduxAction(e())}destroy(){}}
|
|
@@ -1,65 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
const getGenericError = () => new Error('Invalid License');
|
|
3
|
-
export const GENERIC_APP_NAME = 'GenericAdaptableApp';
|
|
4
|
-
export const fieldsToLicenseDetails = (fields) => {
|
|
5
|
-
var _a;
|
|
6
|
-
const fieldsMap = fields.reduce((acc, field) => {
|
|
7
|
-
acc.set(field.name, field.value);
|
|
8
|
-
return acc;
|
|
9
|
-
}, new Map());
|
|
10
|
-
const details = {
|
|
11
|
-
start: new Date(fieldsMap.get('StartDate')),
|
|
12
|
-
end: new Date(fieldsMap.get('EndDate')),
|
|
13
|
-
owner: fieldsMap.get('Owner'),
|
|
14
|
-
appName: fieldsMap.get('AppName') || GENERIC_APP_NAME,
|
|
15
|
-
timestamp: fieldsMap.get('TS') ? Number(fieldsMap.get('TS')) : 0,
|
|
16
|
-
trial: fieldsMap.get('Trial') === 'true' ? true : false,
|
|
17
|
-
ref: (_a = fieldsMap.get('Ref')) !== null && _a !== void 0 ? _a : '',
|
|
18
|
-
};
|
|
19
|
-
if (!details.start ||
|
|
20
|
-
!details.end ||
|
|
21
|
-
!details.owner ||
|
|
22
|
-
typeof details.trial !== 'boolean' ||
|
|
23
|
-
!details.ref) {
|
|
24
|
-
throw getGenericError();
|
|
25
|
-
}
|
|
26
|
-
return details;
|
|
27
|
-
};
|
|
28
|
-
export const decode = (licenseKey) => {
|
|
29
|
-
let crc = '';
|
|
30
|
-
let fields = licenseKey.split('|').map((part) => {
|
|
31
|
-
let [name, value] = part.split('=');
|
|
32
|
-
if (name === 'C') {
|
|
33
|
-
crc = value;
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
name,
|
|
37
|
-
value,
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
if (!crc) {
|
|
41
|
-
throw getGenericError();
|
|
42
|
-
}
|
|
43
|
-
const crcParts = crc.split(',').reverse();
|
|
44
|
-
const overallCrc = crcParts.pop();
|
|
45
|
-
crcParts.forEach((fieldCrc, index) => {
|
|
46
|
-
const field = fields[index];
|
|
47
|
-
if (compute_string(field.value) !== fieldCrc) {
|
|
48
|
-
throw getGenericError();
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
const fieldsWithoutC = [...fields];
|
|
52
|
-
fieldsWithoutC.pop();
|
|
53
|
-
const fieldsWithoutCString = fieldsWithoutC
|
|
54
|
-
.map((field) => {
|
|
55
|
-
return `${field.name}=${field.value}`;
|
|
56
|
-
})
|
|
57
|
-
.join('|');
|
|
58
|
-
if (compute_string(fieldsWithoutCString) !== overallCrc) {
|
|
59
|
-
throw getGenericError();
|
|
60
|
-
}
|
|
61
|
-
fields = fields.map((f) => {
|
|
62
|
-
return Object.assign(Object.assign({}, f), { value: decodeURI(f.value) });
|
|
63
|
-
});
|
|
64
|
-
return fieldsToLicenseDetails(fields);
|
|
65
|
-
};
|
|
1
|
+
import{compute_string as e}from"./hashing";const t=()=>new Error("Invalid License");export const GENERIC_APP_NAME="GenericAdaptableApp";export const fieldsToLicenseDetails=e=>{var a;const r=e.reduce(((e,t)=>(e.set(t.name,t.value),e)),new Map),n={start:new Date(r.get("StartDate")),end:new Date(r.get("EndDate")),owner:r.get("Owner"),appName:r.get("AppName")||GENERIC_APP_NAME,timestamp:r.get("TS")?Number(r.get("TS")):0,trial:"true"===r.get("Trial"),ref:null!==(a=r.get("Ref"))&&void 0!==a?a:""};if(!(n.start&&n.end&&n.owner&&"boolean"==typeof n.trial&&n.ref))throw t();return n};export const decode=a=>{let r="",n=a.split("|").map((e=>{let[t,a]=e.split("=");return"C"===t&&(r=a),{name:t,value:a}}));if(!r)throw t();const o=r.split(",").reverse(),s=o.pop();o.forEach(((a,r)=>{const o=n[r];if(e(o.value)!==a)throw t()}));const i=[...n];i.pop();const p=i.map((e=>`${e.name}=${e.value}`)).join("|");if(e(p)!==s)throw t();return n=n.map((e=>Object.assign(Object.assign({},e),{value:decodeURI(e.value)}))),fieldsToLicenseDetails(n)};
|
|
@@ -1,43 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
/*
|
|
3
|
-
* CRC-32 implementation
|
|
4
|
-
*/
|
|
5
|
-
function generate(reversedPolynomial = DEFAULT_ReversedPolynomial) {
|
|
6
|
-
var table = new Array();
|
|
7
|
-
var i, j, n;
|
|
8
|
-
for (i = 0; i < 256; i++) {
|
|
9
|
-
n = i;
|
|
10
|
-
for (j = 8; j > 0; j--) {
|
|
11
|
-
if ((n & 1) == 1) {
|
|
12
|
-
n = (n >>> 1) ^ reversedPolynomial;
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
n = n >>> 1;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
table[i] = n;
|
|
19
|
-
}
|
|
20
|
-
return table;
|
|
21
|
-
}
|
|
22
|
-
function crc32_initial() {
|
|
23
|
-
return 0xffffffff;
|
|
24
|
-
}
|
|
25
|
-
function crc32_add_byte(table, crc, byte) {
|
|
26
|
-
crc = (crc >>> 8) ^ table[byte ^ (crc & 0x000000ff)];
|
|
27
|
-
return crc;
|
|
28
|
-
}
|
|
29
|
-
function crc32_final(crc) {
|
|
30
|
-
crc = ~crc;
|
|
31
|
-
crc = crc < 0 ? 0xffffffff + crc + 1 : crc;
|
|
32
|
-
return crc;
|
|
33
|
-
}
|
|
34
|
-
export function compute_string(str, reversedPolynomial = DEFAULT_ReversedPolynomial) {
|
|
35
|
-
var table = generate(reversedPolynomial);
|
|
36
|
-
var crc = 0;
|
|
37
|
-
var i;
|
|
38
|
-
crc = crc32_initial();
|
|
39
|
-
for (i = 0; i < str.length; i++)
|
|
40
|
-
crc = crc32_add_byte(table, crc, str.charCodeAt(i));
|
|
41
|
-
crc = crc32_final(crc);
|
|
42
|
-
return `${crc}`;
|
|
43
|
-
}
|
|
1
|
+
const r=3988292384;function n(n=r){var t,o,u,e=new Array;for(t=0;t<256;t++){for(u=t,o=8;o>0;o--)1&~u?u>>>=1:u=u>>>1^n;e[t]=u}return e}function t(){return 4294967295}function o(r,n,t){return n=n>>>8^r[t^255&n]}function u(r){return r=(r=~r)<0?4294967295+r+1:r}export function compute_string(e,c=r){var f,i=n(c),a=0;for(a=t(),f=0;f<e.length;f++)a=o(i,a,e.charCodeAt(f));return`${a=u(a)}`}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { CalculatedColumn } from '../../../types';
|
|
3
3
|
import { AdaptableOnePageWizardProps } from '../../Wizard/Interface/IAdaptableWizard';
|
|
4
4
|
export declare const calculatedColumnTypes: readonly ["ScalarExpression", "AggregatedScalarExpression", "CumulativeAggregatedExpression", "QuantileAggregatedExpression"];
|
|
5
|
-
export type ExpressionType = typeof calculatedColumnTypes[number];
|
|
5
|
+
export type ExpressionType = (typeof calculatedColumnTypes)[number];
|
|
6
6
|
export interface CalculatedColumnWizardProps extends AdaptableOnePageWizardProps<CalculatedColumn> {
|
|
7
7
|
}
|
|
8
8
|
export declare const CalculatedColumnWizard: (props: CalculatedColumnWizardProps) => JSX.Element;
|
|
@@ -33,7 +33,7 @@ export const CalculatedColumnWizard = (props) => {
|
|
|
33
33
|
if ((_a = props.popupParams) === null || _a === void 0 ? void 0 : _a.column) {
|
|
34
34
|
const calculatedColumn = allCalculatedColumns.find((calculatedColumn) => calculatedColumn.ColumnId === props.popupParams.column.columnId);
|
|
35
35
|
if (calculatedColumn) {
|
|
36
|
-
return calculatedColumn;
|
|
36
|
+
return cloneObject(calculatedColumn);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
return ObjectFactory.CreateEmptyCalculatedColumn();
|
|
@@ -51,7 +51,7 @@ export const CalculatedColumnWizard = (props) => {
|
|
|
51
51
|
};
|
|
52
52
|
const [expressionType, setExpressionType] = useState(() => {
|
|
53
53
|
var _a;
|
|
54
|
-
return (_a = getExpressionType(
|
|
54
|
+
return (_a = getExpressionType(calculatedColumn, adaptable.api)) !== null && _a !== void 0 ? _a : 'ScalarExpression';
|
|
55
55
|
});
|
|
56
56
|
const handleExpressionTypeChange = (type) => {
|
|
57
57
|
setExpressionType(type);
|
|
@@ -79,7 +79,7 @@ const QueryViewPanelComponent = (props) => {
|
|
|
79
79
|
};
|
|
80
80
|
const saveButton = (React.createElement(ButtonSave, { onClick: () => saveQuery(), tooltip: "Save as Named Query", accessLevel: namedQueryModuleAccessLevel, disabled: disabled || !isExpressionValid || isExpressionNamedQuery || expression == '', variant: "text", tone: "neutral", marginRight: 1 }));
|
|
81
81
|
const suspendButton = (React.createElement(ButtonPause, { onClick: () => suspendGridFilter(), tooltip: "Suspend Grid Filter", accessLevel: gridFilterAccessLevel, disabled: disabled || !isExpressionValid, variant: "text", tone: "neutral", marginRight: 1 }));
|
|
82
|
-
const unSuspendButton = (React.createElement(ButtonUnsuspend, { onClick: () => unSuspendGridFilter(), tooltip: "Unsuspend Grid Filter", accessLevel: gridFilterAccessLevel, disabled:
|
|
82
|
+
const unSuspendButton = (React.createElement(ButtonUnsuspend, { onClick: () => unSuspendGridFilter(), tooltip: "Unsuspend Grid Filter", accessLevel: gridFilterAccessLevel, disabled: !isExpressionValid, variant: "text", tone: "neutral", marginRight: 1 }));
|
|
83
83
|
const namedQuerySelector = (React.createElement(NamedQuerySelector, { namedQueries: namedQueries, cachedQueries: cachedQueries, currentQuery: gridFilter === null || gridFilter === void 0 ? void 0 : gridFilter.Expression, onSelect: (query) => runQuery(query), setGridFilterExpression: (query) => setGridFilterExpression(query) }));
|
|
84
84
|
const columnsDropdown = (React.createElement(DropdownButton, { disabled: disabled, accessLevel: gridFilterAccessLevel, variant: "text", items: availableColumns, marginRight: 1, tooltip: "Pick Columns" },
|
|
85
85
|
React.createElement(Icon, { name: 'list' })));
|
|
@@ -1,61 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Logo } from '../../components/Logo';
|
|
3
|
-
import { Flex } from 'rebass';
|
|
4
|
-
const style = {
|
|
5
|
-
border: '1px solid var(--ab-color-error)',
|
|
6
|
-
padding: '5px',
|
|
7
|
-
fontWeight: 600,
|
|
8
|
-
margin: '5px',
|
|
9
|
-
fontSize: '14px',
|
|
10
|
-
alignItems: 'center',
|
|
11
|
-
color: 'var(--ab-color-text-on-defaultbackground)',
|
|
12
|
-
background: 'var(--ab-color-defaultbackground)',
|
|
13
|
-
};
|
|
14
|
-
const isStyleValid = (element) => {
|
|
15
|
-
const notAllowedProperties = [
|
|
16
|
-
['display', 'none'],
|
|
17
|
-
['opacity', '0'],
|
|
18
|
-
['position', 'absolute'],
|
|
19
|
-
['position', 'fixed'],
|
|
20
|
-
['position', 'relative'],
|
|
21
|
-
['visibility', 'hidden'],
|
|
22
|
-
];
|
|
23
|
-
for (const [prop, value] of notAllowedProperties) {
|
|
24
|
-
if (element.style[prop] === value) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return true;
|
|
29
|
-
};
|
|
30
|
-
export const LicenseWatermark = (props) => {
|
|
31
|
-
const ref = React.useRef(null);
|
|
32
|
-
React.useEffect(() => {
|
|
33
|
-
const checkWatermark = () => {
|
|
34
|
-
var _a, _b;
|
|
35
|
-
if (!((_a = ref.current) === null || _a === void 0 ? void 0 : _a.isConnected)) {
|
|
36
|
-
alert('It is not allowed to remove the Adaptable watermark.');
|
|
37
|
-
}
|
|
38
|
-
if (!isStyleValid(ref.current)) {
|
|
39
|
-
alert('It is not allowed to modify the Adaptable watermark.');
|
|
40
|
-
}
|
|
41
|
-
if ((_b = ref === null || ref === void 0 ? void 0 : ref.current) === null || _b === void 0 ? void 0 : _b.style) {
|
|
42
|
-
ref.current.style.border = style.border;
|
|
43
|
-
ref.current.style.padding = style.padding;
|
|
44
|
-
ref.current.style.fontWeight = `${style.fontWeight}`;
|
|
45
|
-
ref.current.style.margin = style.margin;
|
|
46
|
-
ref.current.style.fontSize = style.fontSize;
|
|
47
|
-
ref.current.style.color = style.color;
|
|
48
|
-
ref.current.style.background = style.background;
|
|
49
|
-
ref.current.style.display = 'flex';
|
|
50
|
-
ref.current.style.position = 'static';
|
|
51
|
-
ref.current.style.opacity = '1';
|
|
52
|
-
ref.current.style.visibility = 'visible';
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
const timerId = setInterval(checkWatermark, 5000);
|
|
56
|
-
return () => clearTimeout(timerId);
|
|
57
|
-
}, []);
|
|
58
|
-
return (React.createElement(Flex, { style: style, ref: ref },
|
|
59
|
-
React.createElement(Logo, { style: { marginRight: 10 } }),
|
|
60
|
-
React.createElement("div", null, props.children)));
|
|
61
|
-
};
|
|
1
|
+
import*as e from"react";import{Logo as t}from"../../components/Logo";import{Flex as r}from"rebass";const o={border:"1px solid var(--ab-color-error)",padding:"5px",fontWeight:600,margin:"5px",fontSize:"14px",alignItems:"center",color:"var(--ab-color-text-on-defaultbackground)",background:"var(--ab-color-defaultbackground)"},n=e=>{const t=[["display","none"],["opacity","0"],["position","absolute"],["position","fixed"],["position","relative"],["visibility","hidden"]];for(const[r,o]of t)if(e.style[r]===o)return!1;return!0};export const LicenseWatermark=i=>{const l=e.useRef(null);return e.useEffect((()=>{const e=setInterval((()=>{var e,t;(null===(e=l.current)||void 0===e?void 0:e.isConnected)||alert("It is not allowed to remove the Adaptable watermark."),n(l.current)||alert("It is not allowed to modify the Adaptable watermark."),(null===(t=null==l?void 0:l.current)||void 0===t?void 0:t.style)&&(l.current.style.border=o.border,l.current.style.padding=o.padding,l.current.style.fontWeight=`${o.fontWeight}`,l.current.style.margin=o.margin,l.current.style.fontSize=o.fontSize,l.current.style.color=o.color,l.current.style.background=o.background,l.current.style.display="flex",l.current.style.position="static",l.current.style.opacity="1",l.current.style.visibility="visible")}),5e3);return()=>clearTimeout(e)}),[]),e.createElement(r,{style:o,ref:l},e.createElement(t,{style:{marginRight:10}}),e.createElement("div",null,i.children))};
|
package/src/env.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
|
|
3
|
-
PUBLISH_TIMESTAMP:
|
|
4
|
-
VERSION: "18.0.0-canary.
|
|
3
|
+
PUBLISH_TIMESTAMP: 1710949344156 || Date.now(),
|
|
4
|
+
VERSION: "18.0.0-canary.11" || '--current-version--',
|
|
5
5
|
};
|