@adaptabletools/adaptable 13.0.0-canary.6 → 13.0.0-canary.8
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/bundle.cjs.js +126 -126
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/Api/Implementation/SystemStatusApiImpl.js +1 -2
- package/src/Utilities/Services/{LicenseService.d.ts → LicenseService/index.d.ts} +3 -3
- package/src/Utilities/Services/LicenseService/index.js +1 -0
- package/src/Utilities/Services/LicenseService/shouldLogThankYouMessage.d.ts +1 -0
- package/src/Utilities/Services/LicenseService/shouldLogThankYouMessage.js +15 -0
- package/src/View/Components/ToolPanel/AdaptableToolPanel.d.ts +4 -0
- package/src/View/Components/ToolPanel/AdaptableToolPanel.js +5 -2
- package/src/agGrid/ActionColumnRenderer.d.ts +1 -0
- package/src/agGrid/ActionColumnRenderer.js +5 -5
- package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +1 -0
- package/src/agGrid/editors/AdaptableDateEditor/index.js +3 -3
- package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +1 -0
- package/src/agGrid/editors/AdaptableNumberEditor/index.js +3 -3
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/src/Utilities/Services/LicenseService.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "13.0.0-canary.
|
|
3
|
+
"version": "13.0.0-canary.8",
|
|
4
4
|
"description": "Powerful data-agnostic HTML5 datagrid add-on that sits on top of an underlying grid component and provides all the rich functionality that advanced users expect from their DataGrids and Data Tables",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
package/publishTimestamp.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: 1663338382332;
|
|
2
2
|
export default _default;
|
package/publishTimestamp.js
CHANGED
|
@@ -7,7 +7,6 @@ const SystemRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/Sy
|
|
|
7
7
|
const ApiBase_1 = require("./ApiBase");
|
|
8
8
|
const ModuleConstants = tslib_1.__importStar(require("../../Utilities/Constants/ModuleConstants"));
|
|
9
9
|
const ObjectFactory_1 = tslib_1.__importDefault(require("../../Utilities/ObjectFactory"));
|
|
10
|
-
const react_dom_1 = require("react-dom");
|
|
11
10
|
const react_1 = require("react");
|
|
12
11
|
const UIHelper_1 = tslib_1.__importDefault(require("../../View/UIHelper"));
|
|
13
12
|
const StringExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/StringExtensions"));
|
|
@@ -57,7 +56,7 @@ class SystemStatusApiImpl extends ApiBase_1.ApiBase {
|
|
|
57
56
|
statusMessage += statusFurtherInformation;
|
|
58
57
|
}
|
|
59
58
|
const foreColor = messageType ? UIHelper_1.default.getColorByMessageType(messageType) : 'black';
|
|
60
|
-
|
|
59
|
+
this.adaptable.renderReactRoot((0, react_1.createElement)('span', { style: { color: foreColor } }, statusMessage), this.systemStatusDiv);
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
62
|
setErrorSystemStatus(statusMessage, statusFurtherInformation) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IAdaptable } from '
|
|
2
|
-
import { LicenseDetails } from '
|
|
3
|
-
import { ILicenseService } from '
|
|
1
|
+
import { IAdaptable } from '../../../AdaptableInterfaces/IAdaptable';
|
|
2
|
+
import { LicenseDetails } from '../../license/LicenseDetails';
|
|
3
|
+
import { ILicenseService } from '../Interface/ILicenseService';
|
|
4
4
|
export declare enum LicenseValidityType {
|
|
5
5
|
INVALID_LICENSE = "INVALID_LICENSE",
|
|
6
6
|
NO_LICENSE = "NO_LICENSE",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LicenseService=exports.LicenseValidityType=void 0;const e=require("tslib"),a=require("../../../Redux/ActionsReducers/SystemRedux"),s=require("../../../Redux/ActionsReducers/PopupRedux"),t=e.__importDefault(require("../../ObjectFactory")),o=require("../../Helpers/LoggingHelper"),i=e.__importDefault(require("lodash/clamp")),n=require("../../Constants/DocumentationLinkConstants"),r=require("../../license/decode"),c=require("./shouldLogThankYouMessage"),l="sales@adaptabletools.com",d=10,p=864e5;var E;!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"}(E=exports.LicenseValidityType||(exports.LicenseValidityType={}));const _=/(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g,I=/(https):\/\/\S+(\.csb\.app)/g,O=/(https):\/\/\S+(\.adaptabletools\.com)/g,u="undefined"!=typeof window?window.location.origin:"",h=()=>{const[e,a,s]=Array.from(_.exec(u)||[]);return"https"===a&&"sandpack.codesandbox.io"===s},A=()=>{const[e,a,s]=Array.from(I.exec(u)||[]);return"https"===a&&".csb.app"===s},N=()=>{const[e,a,s]=Array.from(O.exec(u)||[]);return"https"===a&&".adaptabletools.com"===s};class L{constructor(e,a,s){this.adaptable=e,this.adaptable=e;let t=null;if(a)try{t=(0,r.decode)(a)}catch(e){t=e}h()||A()||N()||this.handleLicenseValidation(t,this.getValidityType(t,s))}getValidityType(e,a){if(!e)return E.NO_LICENSE;if(e instanceof Error)return E.INVALID_LICENSE;const s=new Date(a.publishedAt),t=new Date(e.end),o=t<new Date,i=e.trial;let n=null;return n=o?t>s?i?E.NON_PRODUCTION_EXPIRED_IN_SCOPE:E.COMMERCIAL_EXPIRED_IN_SCOPE:i?E.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE:E.COMMERCIAL_EXPIRED_OUT_OF_SCOPE:i?E.NON_PRODUCTION_VALID:E.COMMERCIAL_VALID,n}handleLicenseValidation(e,a){var s;const t=new Date;t.setHours(0,0,0,0);let d=0;e instanceof Error||!(null==e?void 0:e.end)||(d=Math.floor(((null===(s=null==e?void 0:e.end)||void 0===s?void 0:s.getTime())-t.getTime())/864e5),d=(0,i.default)(d,0,1/0));let p="",E="";!e||e instanceof Error||!e.appName||e.appName==r.GENERIC_APP_NAME||(p=e.appName,E=" for application [APP_NAME]");const _=(e,a=n.LicenseDocsLink,s=l,t=d,o=p)=>e.replace("[LINK]",a).replace("[EMAIL]",s).replace("[APP_NAME]",o).replace("[DAYS]",`${t}`);switch(a){case"NO_LICENSE":case"NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE":(0,o.ConsoleLogByMessageType)(_("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":(0,o.ConsoleLogByMessageType)(_("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":(0,o.ConsoleLogByMessageType)(_("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":(0,o.ConsoleLogByMessageType)(_("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(d<=10)(0,o.ConsoleLogByMessageType)(_(`This AdapTable license${E} expires in [DAYS] days. Please contact [EMAIL] to renew (giving you access to Support and Updates)`),"Info");else try{(0,c.shouldLogThankYouMessage)()&&(0,o.ConsoleLogByMessageType)(_(`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":(0,o.ConsoleLogByMessageType)(_(`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":(0,o.ConsoleLogByMessageType)(_(`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((0,s.PopupShowAlert)({alertType:"generic",header:"License Error",message:e,alertDefinition:t.default.CreateInternalAlertDefinitionForMessages("Error")}))}showWatermark(e){this.adaptable.api.internalApi.dispatchReduxAction((0,a.SystemLicenseShowWatermark)(e))}disableStatePersistence(){this.adaptable.api.internalApi.dispatchReduxAction((0,a.SystemLicenseDisablePersistence)())}destroy(){}}exports.LicenseService=L;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function shouldLogThankYouMessage(): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shouldLogThankYouMessage = void 0;
|
|
4
|
+
function shouldLogThankYouMessage() {
|
|
5
|
+
try {
|
|
6
|
+
if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test') {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
catch (ex) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.shouldLogThankYouMessage = shouldLogThankYouMessage;
|
|
@@ -27,17 +27,21 @@ export declare const ConnectedAdaptableToolPanel: import("react-redux").Connecte
|
|
|
27
27
|
export declare const getAdaptableToolPanelAgGridComponent: (adaptable?: IAdaptable) => {
|
|
28
28
|
new (): {
|
|
29
29
|
gui: HTMLElement;
|
|
30
|
+
unmountReactRoot?: VoidFunction;
|
|
30
31
|
init(params?: IToolPanelParams): void;
|
|
31
32
|
getGui(): HTMLElement;
|
|
32
33
|
refresh(): void;
|
|
34
|
+
destroy(): void;
|
|
33
35
|
};
|
|
34
36
|
};
|
|
35
37
|
export declare const AdaptableToolPanelAgGridComponent: {
|
|
36
38
|
new (): {
|
|
37
39
|
gui: HTMLElement;
|
|
40
|
+
unmountReactRoot?: VoidFunction;
|
|
38
41
|
init(params?: IToolPanelParams): void;
|
|
39
42
|
getGui(): HTMLElement;
|
|
40
43
|
refresh(): void;
|
|
44
|
+
destroy(): void;
|
|
41
45
|
};
|
|
42
46
|
};
|
|
43
47
|
export {};
|
|
@@ -7,7 +7,6 @@ const kebabCase_1 = tslib_1.__importDefault(require("lodash/kebabCase"));
|
|
|
7
7
|
const ToolPanelRedux = tslib_1.__importStar(require("../../../Redux/ActionsReducers/ToolPanelRedux"));
|
|
8
8
|
const SystemRedux = tslib_1.__importStar(require("../../../Redux/ActionsReducers/SystemRedux"));
|
|
9
9
|
const react_redux_1 = require("react-redux");
|
|
10
|
-
const react_dom_1 = require("react-dom");
|
|
11
10
|
const rebass_1 = require("rebass");
|
|
12
11
|
const ArrayExtensions_1 = tslib_1.__importDefault(require("../../../Utilities/Extensions/ArrayExtensions"));
|
|
13
12
|
const icons_1 = require("../../../components/icons");
|
|
@@ -238,7 +237,7 @@ const getAdaptableToolPanelAgGridComponent = (adaptable) => {
|
|
|
238
237
|
this.gui.className = 'ag-adaptable-panel';
|
|
239
238
|
this.gui.style.width = '100%';
|
|
240
239
|
this.gui.style.overflow = 'auto';
|
|
241
|
-
|
|
240
|
+
this.unmountReactRoot = Adaptable.renderReactRoot((0, renderWithAdaptableContext_1.renderWithAdaptableContext)(React.createElement(exports.ConnectedAdaptableToolPanel, { api: api, teamSharingActivated: false }), Adaptable), this.gui);
|
|
242
241
|
}
|
|
243
242
|
getGui() {
|
|
244
243
|
if (!this.gui) {
|
|
@@ -249,6 +248,10 @@ const getAdaptableToolPanelAgGridComponent = (adaptable) => {
|
|
|
249
248
|
refresh() {
|
|
250
249
|
// no refresh logic needed
|
|
251
250
|
}
|
|
251
|
+
destroy() {
|
|
252
|
+
var _a;
|
|
253
|
+
(_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
254
|
+
}
|
|
252
255
|
};
|
|
253
256
|
};
|
|
254
257
|
exports.getAdaptableToolPanelAgGridComponent = getAdaptableToolPanelAgGridComponent;
|
|
@@ -6,6 +6,7 @@ interface ActionColumnCellRendererParams extends ICellRendererParams {
|
|
|
6
6
|
export declare class ActionColumnRenderer implements ICellRendererComp {
|
|
7
7
|
private eGui;
|
|
8
8
|
private eventListener;
|
|
9
|
+
private unmountReactRoot?;
|
|
9
10
|
init(params: ActionColumnCellRendererParams): void;
|
|
10
11
|
render(): void;
|
|
11
12
|
getGui(): HTMLElement;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ActionColumnRenderer = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const SimpleButton_1 = tslib_1.__importDefault(require("../components/SimpleButton"));
|
|
6
|
-
const react_dom_1 = require("react-dom");
|
|
7
6
|
const React = tslib_1.__importStar(require("react"));
|
|
8
7
|
const uuid_1 = require("../components/utils/uuid");
|
|
9
8
|
class ActionColumnRenderer {
|
|
@@ -66,9 +65,9 @@ class ActionColumnRenderer {
|
|
|
66
65
|
})));
|
|
67
66
|
};
|
|
68
67
|
const eGui = this.eGui;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
68
|
+
const doRender = () => {
|
|
69
|
+
this.unmountReactRoot = adaptable.renderReactRoot(renderActionButtons(actionButtons, adaptable.api, buttonContext), eGui);
|
|
70
|
+
};
|
|
72
71
|
this.render = doRender;
|
|
73
72
|
doRender();
|
|
74
73
|
}
|
|
@@ -88,7 +87,8 @@ class ActionColumnRenderer {
|
|
|
88
87
|
}
|
|
89
88
|
// gets called when the cell is removed from the grid
|
|
90
89
|
destroy() {
|
|
91
|
-
|
|
90
|
+
var _a;
|
|
91
|
+
(_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
92
92
|
// do cleanup, remove event listener from button
|
|
93
93
|
if (this.eGui) {
|
|
94
94
|
this.eGui.removeEventListener('click', this.eventListener);
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AdaptableDateEditor = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
|
-
const react_dom_1 = require("react-dom");
|
|
7
6
|
const renderWithAdaptableContext_1 = require("../../../View/renderWithAdaptableContext");
|
|
8
7
|
const InternalAdaptableDateEditor_1 = require("./InternalAdaptableDateEditor");
|
|
9
8
|
const core_1 = require("@ag-grid-community/core");
|
|
@@ -111,10 +110,11 @@ class AdaptableDateEditor {
|
|
|
111
110
|
this.editor = editor;
|
|
112
111
|
editor === null || editor === void 0 ? void 0 : editor.focus();
|
|
113
112
|
} }));
|
|
114
|
-
|
|
113
|
+
this.unmountReactRoot = adaptable.renderReactRoot((0, renderWithAdaptableContext_1.renderWithAdaptableContext)(editorElement, adaptable), this.el);
|
|
115
114
|
}
|
|
116
115
|
destroy() {
|
|
117
|
-
|
|
116
|
+
var _a;
|
|
117
|
+
(_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
118
118
|
}
|
|
119
119
|
shouldClearExistingValue(params) {
|
|
120
120
|
return params.eventKey === core_1.KeyCode.BACKSPACE || params.eventKey === core_1.KeyCode.DELETE;
|
|
@@ -42,6 +42,7 @@ export declare class AdaptableNumberEditor implements ICellEditorComp {
|
|
|
42
42
|
private params;
|
|
43
43
|
private editor;
|
|
44
44
|
private valueParser;
|
|
45
|
+
private unmountReactRoot?;
|
|
45
46
|
init(params: AdaptableNumberCellEditorParams): void;
|
|
46
47
|
getGui(): HTMLDivElement;
|
|
47
48
|
getValue(): any;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AdaptableNumberEditor = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
|
-
const react_dom_1 = require("react-dom");
|
|
7
6
|
const renderWithAdaptableContext_1 = require("../../../View/renderWithAdaptableContext");
|
|
8
7
|
const InternalAdaptableNumberEditor_1 = require("./InternalAdaptableNumberEditor");
|
|
9
8
|
const core_1 = require("@ag-grid-community/core");
|
|
@@ -77,7 +76,7 @@ class AdaptableNumberEditor {
|
|
|
77
76
|
this.editor = editor;
|
|
78
77
|
editor === null || editor === void 0 ? void 0 : editor.focus();
|
|
79
78
|
} }));
|
|
80
|
-
|
|
79
|
+
this.unmountReactRoot = adaptable.renderReactRoot((0, renderWithAdaptableContext_1.renderWithAdaptableContext)(editorElement, adaptable), this.el);
|
|
81
80
|
this.getGui().addEventListener('keydown', (keyDownEvent) => {
|
|
82
81
|
adaptable._emit('CellEditorKeyDown', {
|
|
83
82
|
keyDownEvent,
|
|
@@ -90,7 +89,8 @@ class AdaptableNumberEditor {
|
|
|
90
89
|
});
|
|
91
90
|
}
|
|
92
91
|
destroy() {
|
|
93
|
-
|
|
92
|
+
var _a;
|
|
93
|
+
(_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
94
94
|
}
|
|
95
95
|
getStartValue(params) {
|
|
96
96
|
if (this.shouldClearExistingValue(params)) {
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "13.0.0-canary.
|
|
1
|
+
declare const _default: "13.0.0-canary.8";
|
|
2
2
|
export default _default;
|
package/version.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = '13.0.0-canary.
|
|
3
|
+
exports.default = '13.0.0-canary.8'; // PLEASE DONT UPDATE THIS!!! - will be updated at build time with the correct version
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LicenseService=exports.LicenseValidityType=void 0;const e=require("tslib"),a=require("../../Redux/ActionsReducers/SystemRedux"),t=require("../../Redux/ActionsReducers/PopupRedux"),s=e.__importDefault(require("../ObjectFactory")),o=require("../Helpers/LoggingHelper"),i=e.__importDefault(require("lodash/clamp")),n=require("../Constants/DocumentationLinkConstants"),r=require("../license/decode"),c="sales@adaptabletools.com",l=10,d=864e5;var p;!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"}(p=exports.LicenseValidityType||(exports.LicenseValidityType={}));const E=/(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g,_=/(https):\/\/\S+(\.csb\.app)/g,I=/(https):\/\/\S+(\.adaptabletools\.com)/g,O="undefined"!=typeof window?window.location.origin:"",N=()=>{const[e,a,t]=Array.from(E.exec(O)||[]);return"https"===a&&"sandpack.codesandbox.io"===t},h=()=>{const[e,a,t]=Array.from(_.exec(O)||[]);return"https"===a&&".csb.app"===t},u=()=>{const[e,a,t]=Array.from(I.exec(O)||[]);return"https"===a&&".adaptabletools.com"===t};class A{constructor(e,a,t){this.adaptable=e,this.adaptable=e;let s=null;if(a)try{s=(0,r.decode)(a)}catch(e){s=e}N()||h()||u()||this.handleLicenseValidation(s,this.getValidityType(s,t))}getValidityType(e,a){if(!e)return p.NO_LICENSE;if(e instanceof Error)return p.INVALID_LICENSE;const t=new Date(a.publishedAt),s=new Date(e.end),o=s<new Date,i=e.trial;let n=null;return n=o?s>t?i?p.NON_PRODUCTION_EXPIRED_IN_SCOPE:p.COMMERCIAL_EXPIRED_IN_SCOPE:i?p.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE:p.COMMERCIAL_EXPIRED_OUT_OF_SCOPE:i?p.NON_PRODUCTION_VALID:p.COMMERCIAL_VALID,n}handleLicenseValidation(e,a){var t;const s=new Date;s.setHours(0,0,0,0);let l=0;e instanceof Error||!(null==e?void 0:e.end)||(l=Math.floor(((null===(t=null==e?void 0:e.end)||void 0===t?void 0:t.getTime())-s.getTime())/864e5),l=(0,i.default)(l,0,1/0));let d="",p="";!e||e instanceof Error||!e.appName||e.appName==r.GENERIC_APP_NAME||(d=e.appName,p=" for application [APP_NAME]");const E=(e,a=n.LicenseDocsLink,t=c,s=l,o=d)=>e.replace("[LINK]",a).replace("[EMAIL]",t).replace("[APP_NAME]",o).replace("[DAYS]",`${s}`);switch(a){case"NO_LICENSE":case"NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE":(0,o.ConsoleLogByMessageType)(E("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":(0,o.ConsoleLogByMessageType)(E("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":(0,o.ConsoleLogByMessageType)(E("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":(0,o.ConsoleLogByMessageType)(E("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(l<=10)(0,o.ConsoleLogByMessageType)(E(`This AdapTable license${p} expires in [DAYS] days. Please contact [EMAIL] to renew (giving you access to Support and Updates)`),"Info");else try{"development"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV||(0,o.ConsoleLogByMessageType)(E(`Thank you for using a valid AdapTable license${p}. Your license will expire in [DAYS] days.`),"Info")}catch(e){}break;case"COMMERCIAL_EXPIRED_IN_SCOPE":(0,o.ConsoleLogByMessageType)(E(`This AdapTable license${p} 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":(0,o.ConsoleLogByMessageType)(E(`This AdapTable license${p} 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((0,t.PopupShowAlert)({alertType:"generic",header:"License Error",message:e,alertDefinition:s.default.CreateInternalAlertDefinitionForMessages("Error")}))}showWatermark(e){this.adaptable.api.internalApi.dispatchReduxAction((0,a.SystemLicenseShowWatermark)(e))}disableStatePersistence(){this.adaptable.api.internalApi.dispatchReduxAction((0,a.SystemLicenseDisablePersistence)())}destroy(){}}exports.LicenseService=A;
|