scichart 2.2.2393 → 2.2.2401

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.
@@ -124,6 +124,7 @@ export declare class SeriesSelectionModifier extends ChartModifierBase2D {
124
124
  type: string;
125
125
  options: Required<Omit<IChartModifierBaseOptions, never>>;
126
126
  };
127
+ getAllSeries(): IRenderableSeries[];
127
128
  /**
128
129
  * This function called when the user sets series.isSelected = true elsewhere in code and we want to sync the modifier
129
130
  */
@@ -270,6 +270,10 @@ var SeriesSelectionModifier = /** @class */ (function (_super) {
270
270
  Object.assign(json.options, options);
271
271
  return json;
272
272
  };
273
+ SeriesSelectionModifier.prototype.getAllSeries = function () {
274
+ // Series Selection should only operate on visible series
275
+ return _super.prototype.getAllSeries.call(this).filter(function (rs) { return rs.isVisible; });
276
+ };
273
277
  /**
274
278
  * This function called when the user sets series.isSelected = true elsewhere in code and we want to sync the modifier
275
279
  */
@@ -102,6 +102,7 @@ var SciChartRenderer = /** @class */ (function () {
102
102
  if (this.sciChartSurface.isDeleted) {
103
103
  return;
104
104
  }
105
+ // console.log("render");
105
106
  var nativeContext = renderContext.getNativeContext();
106
107
  var wasmContext = this.sciChartSurface.webAssemblyContext2D;
107
108
  var oldBlendMode = nativeContext.GetBlendMode();
@@ -110,7 +111,6 @@ var SciChartRenderer = /** @class */ (function () {
110
111
  this.validate();
111
112
  // Animation Step
112
113
  var timeElapsed = this.previousTime ? Date.now() - this.previousTime : undefined;
113
- // console.log("draw ", timeElapsed);
114
114
  this.previousTime = Date.now();
115
115
  this.sciChartSurface.onAnimate(timeElapsed);
116
116
  this.sciChartSurface.updateBackground();
@@ -665,7 +665,7 @@ var AnnotationBase = /** @class */ (function () {
665
665
  AnnotationBase.prototype.getXYCoordinatesFromValues = function (xyDataPoint) {
666
666
  var viewRect = this.parentSurface.seriesViewRect;
667
667
  var pointWithAbsoluteCoordinates = this.getAbsoluteCoordinates(xyDataPoint);
668
- var translatedPoint = (0, translate_1.translateFromSeriesViewRectToCanvas)(pointWithAbsoluteCoordinates, viewRect);
668
+ var translatedPoint = (0, translate_1.translateFromSeriesViewRectToCanvas)(pointWithAbsoluteCoordinates, viewRect, true);
669
669
  if (!translatedPoint) {
670
670
  return undefined;
671
671
  }
@@ -44,6 +44,7 @@ export declare class BoxAnnotation extends RenderContextAnnotationBase {
44
44
  private strokeThicknessProperty;
45
45
  private strokeProperty;
46
46
  private fillProperty;
47
+ private nativeDrawingProvider;
47
48
  private strokePenCache;
48
49
  private fillBrushCache;
49
50
  /**
@@ -83,6 +84,7 @@ export declare class BoxAnnotation extends RenderContextAnnotationBase {
83
84
  delete(): void;
84
85
  /** @inheritDoc */
85
86
  drawWithContext(renderContext: IRenderContext2D, xCalc: CoordinateCalculatorBase, yCalc: CoordinateCalculatorBase, viewRect: Rect): void;
87
+ private drawWithProvider;
86
88
  /** @inheritDoc */
87
89
  onAttach(scs: SciChartSurface): void;
88
90
  onDragStarted(args: ModifierMouseArgs): boolean;
@@ -16,6 +16,7 @@ var __extends = (this && this.__extends) || (function () {
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.BoxAnnotation = void 0;
19
+ var app_1 = require("../../../constants/app");
19
20
  var Deleter_1 = require("../../../Core/Deleter");
20
21
  var Guard_1 = require("../../../Core/Guard");
21
22
  var Point_1 = require("../../../Core/Point");
@@ -119,6 +120,7 @@ var BoxAnnotation = /** @class */ (function (_super) {
119
120
  BoxAnnotation.prototype.delete = function () {
120
121
  this.strokePenCache = (0, Deleter_1.deleteSafe)(this.strokePenCache);
121
122
  this.fillBrushCache = (0, Deleter_1.deleteSafe)(this.fillBrushCache);
123
+ this.nativeDrawingProvider = (0, Deleter_1.deleteSafe)(this.nativeDrawingProvider);
122
124
  };
123
125
  /** @inheritDoc */
124
126
  BoxAnnotation.prototype.drawWithContext = function (renderContext, xCalc, yCalc, viewRect) {
@@ -135,12 +137,58 @@ var BoxAnnotation = /** @class */ (function (_super) {
135
137
  var y2 = this.getY2Coordinate(xCalc, yCalc);
136
138
  this.setAnnotationBorders(x1, x2, y1, y2);
137
139
  var rect = Rect_1.Rect.createWithPoints(new Point_1.Point(x1, y1), new Point_1.Point(x2, y2));
138
- renderContext.drawRect(rect, viewRect, strokePen, fillBrush);
140
+ // Temporary HAX! drawRect is rubbish with large strokeThickness, whereas the columnDrawingProvider does a nice
141
+ // outlined rectangle, but the code is ugly. In 2.3 we will improve the native drawRect to do the outline properly.
142
+ if (!app_1.IS_TEST_ENV) {
143
+ this.drawWithProvider(renderContext, strokePen.scrtPen, fillBrush.scrtBrush, xCalc, yCalc, rect, viewRect);
144
+ }
145
+ //renderContext.drawRect(rect, viewRect, strokePen, fillBrush);
139
146
  this.updateAdornerInner();
140
147
  };
148
+ BoxAnnotation.prototype.drawWithProvider = function (renderContext, linesPen, fillBrush, xCalc, yCalc, rect, viewRect) {
149
+ var webAssemblyContext = this.parentSurface.webAssemblyContext2D;
150
+ var args = new webAssemblyContext.SCRTColumnDrawingParams();
151
+ args.forceShaderMethod = true;
152
+ args.verticalChart = this.isVerticalChart;
153
+ args.zeroLineY = this.isVerticalChart ? yCalc.getDataValue(rect.left) : yCalc.getDataValue(rect.bottom);
154
+ args.columnWidth = this.isVerticalChart ? rect.height : rect.width;
155
+ // ISSUE: If the strokeThickness property is not provided,
156
+ // the fill will be disappeared with large zoom (when the column width will be small or zero)
157
+ // if (args.columnWidth === 0 && this.strokeThickness === 0) {
158
+ // strokePenCache = this.strokePenFillColoredCache;
159
+ // }
160
+ if (linesPen) {
161
+ args.SetLinesPen(linesPen);
162
+ }
163
+ if (fillBrush) {
164
+ args.SetFillBrush(fillBrush);
165
+ }
166
+ args.viewportWidth = viewRect.width;
167
+ args.viewportHeight = viewRect.height;
168
+ var xMid = this.isVerticalChart ? (rect.top + rect.bottom) / 2 : (rect.left + rect.right) / 2;
169
+ var xVal = xCalc.getDataValue(xMid);
170
+ var xValues = new webAssemblyContext.SCRTDoubleVector();
171
+ xValues.push_back(xVal);
172
+ var yVal = this.isVerticalChart ? yCalc.getDataValue(rect.right) : yCalc.getDataValue(rect.top);
173
+ var yValues = new webAssemblyContext.SCRTDoubleVector();
174
+ yValues.push_back(yVal);
175
+ args.count = yValues.size();
176
+ var nativeContext = renderContext.getNativeContext();
177
+ nativeContext.PushMatrix();
178
+ nativeContext.PushState();
179
+ nativeContext.Translate(viewRect.x, viewRect.y);
180
+ nativeContext.SetClipRect(viewRect.x, viewRect.y, viewRect.width, viewRect.height);
181
+ this.nativeDrawingProvider.DrawPointsVec(nativeContext, xValues, yValues, xCalc.nativeCalculator, yCalc.nativeCalculator, args);
182
+ nativeContext.PopMatrix();
183
+ nativeContext.PopState();
184
+ xValues.delete();
185
+ yValues.delete();
186
+ args.delete();
187
+ };
141
188
  /** @inheritDoc */
142
189
  BoxAnnotation.prototype.onAttach = function (scs) {
143
190
  _super.prototype.onAttach.call(this, scs);
191
+ this.nativeDrawingProvider = new scs.webAssemblyContext2D.SCRTColumnSeriesDrawingProvider();
144
192
  if (!this.strokePenCache) {
145
193
  this.strokePenCache = new Pen2DCache_1.Pen2DCache(scs.webAssemblyContext2D);
146
194
  }
@@ -25,7 +25,7 @@ var DateTimeNumericAxis = /** @class */ (function (_super) {
25
25
  var _a;
26
26
  var _this = _super.call(this, webAssemblyContext, options) || this;
27
27
  _this.labelProvider = (_a = options === null || options === void 0 ? void 0 : options.labelProvider) !== null && _a !== void 0 ? _a : new SmartDateLabelProvider_1.SmartDateLabelProvider();
28
- _this.deltaCalculator = new DateTimeDeltaCalculator_1.DateTimeDeltaCalculator({
28
+ _this.deltaCalculator = new DateTimeDeltaCalculator_1.DateTimeDeltaCalculator(webAssemblyContext, {
29
29
  possibleDeltas: options === null || options === void 0 ? void 0 : options.possibleDeltas,
30
30
  minTicks: options === null || options === void 0 ? void 0 : options.minTicks
31
31
  });
@@ -1,5 +1,7 @@
1
1
  import { NumberRange } from "../../../../Core/NumberRange";
2
- import { DeltaCalculator } from "./DeltaCalculator";
2
+ import { TSciChart } from "../../../../types/TSciChart";
3
+ import { TSciChart3D } from "../../../../types/TSciChart3D";
4
+ import { NumericDeltaCalculator } from "./NumericDeltaCalculator";
3
5
  export interface IDeltaCalculatorOptions {
4
6
  possibleDeltas?: number[];
5
7
  minTicks?: number;
@@ -8,12 +10,12 @@ export interface IDeltaCalculatorOptions {
8
10
  * The DateTimeDeltaCalculator is respinsible for calculating {@link AxisCore.minorDelta} and {@link AxisCore.majorDelta} on
9
11
  * {@link NumericAxis} types.
10
12
  */
11
- export declare class DateTimeDeltaCalculator extends DeltaCalculator {
13
+ export declare class DateTimeDeltaCalculator extends NumericDeltaCalculator {
12
14
  private possibleDeltasProperty;
13
15
  private minTicksProperty;
14
16
  private prevIndex;
15
17
  private currIndex;
16
- constructor(options?: IDeltaCalculatorOptions);
18
+ constructor(webAssemblyContext: TSciChart | TSciChart3D, options?: IDeltaCalculatorOptions);
17
19
  /**
18
20
  * Gets or sets deltas array
19
21
  */
@@ -17,16 +17,16 @@ var __extends = (this && this.__extends) || (function () {
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.DateTimeDeltaCalculator = void 0;
19
19
  var NumberRange_1 = require("../../../../Core/NumberRange");
20
- var DeltaCalculator_1 = require("./DeltaCalculator");
20
+ var NumericDeltaCalculator_1 = require("./NumericDeltaCalculator");
21
21
  /**
22
22
  * The DateTimeDeltaCalculator is respinsible for calculating {@link AxisCore.minorDelta} and {@link AxisCore.majorDelta} on
23
23
  * {@link NumericAxis} types.
24
24
  */
25
25
  var DateTimeDeltaCalculator = /** @class */ (function (_super) {
26
26
  __extends(DateTimeDeltaCalculator, _super);
27
- function DateTimeDeltaCalculator(options) {
27
+ function DateTimeDeltaCalculator(webAssemblyContext, options) {
28
28
  var _a;
29
- var _this = _super.call(this) || this;
29
+ var _this = _super.call(this, webAssemblyContext) || this;
30
30
  _this.possibleDeltasProperty = [
31
31
  1,
32
32
  2,
@@ -55,7 +55,8 @@ var DateTimeDeltaCalculator = /** @class */ (function (_super) {
55
55
  2 * 30 * 24 * 60 * 60,
56
56
  4 * 30 * 24 * 60 * 60,
57
57
  6 * 30 * 24 * 60 * 60,
58
- 12 * 30 * 24 * 60 * 60
58
+ 365.25 * 24 * 60 * 60
59
+ // Years also need special handling
59
60
  ];
60
61
  _this.currIndex = 12;
61
62
  _this.possibleDeltasProperty = (_a = options === null || options === void 0 ? void 0 : options.possibleDeltas) !== null && _a !== void 0 ? _a : _this.possibleDeltasProperty;
@@ -105,11 +106,15 @@ var DateTimeDeltaCalculator = /** @class */ (function (_super) {
105
106
  _this.prevIndex = index;
106
107
  return calculateDelta(deltas, index - 1);
107
108
  }
108
- if (ticksCount > maxTicks && index < deltas.length && index !== _this.prevIndex) {
109
+ if (ticksCount > maxTicks && index < deltas.length - 1 && index !== _this.prevIndex) {
109
110
  if (!_this.prevIndex)
110
111
  _this.prevIndex = index;
111
112
  return calculateDelta(deltas, index + 1);
112
113
  }
114
+ else if (ticksCount > maxTicks && index === deltas.length - 1) {
115
+ var yearDelta = _super.prototype.getDeltaFromRange.call(_this, min / delta, max / delta, minorsPerMajor, maxTicks);
116
+ return yearDelta.max * delta;
117
+ }
113
118
  else {
114
119
  if (_this.currIndex !== index) {
115
120
  _this.currIndex = index;
@@ -121,5 +126,5 @@ var DateTimeDeltaCalculator = /** @class */ (function (_super) {
121
126
  return new NumberRange_1.NumberRange(delta / minorsPerMajor, delta);
122
127
  };
123
128
  return DateTimeDeltaCalculator;
124
- }(DeltaCalculator_1.DeltaCalculator));
129
+ }(NumericDeltaCalculator_1.NumericDeltaCalculator));
125
130
  exports.DateTimeDeltaCalculator = DateTimeDeltaCalculator;
@@ -259,7 +259,7 @@ export declare class SciChartSurface extends SciChartSurfaceBase {
259
259
  /**
260
260
  * @inheritDoc
261
261
  */
262
- delete(): void;
262
+ delete(clearHtml?: boolean): void;
263
263
  /**
264
264
  * @inheritDoc
265
265
  */
@@ -397,7 +397,7 @@ var SciChartSurface = /** @class */ (function (_super) {
397
397
  // Logger.log("SciChartSurface.isSuspended = true. Ignoring invalidateElement() call");
398
398
  return;
399
399
  }
400
- // console.log("Invalidating ", this.domChartRoot.id);
400
+ // console.trace("Invalidating ", this.domChartRoot.id);
401
401
  var canvasId = this.domCanvas2D ? this.domCanvas2D.id : "undefinedCanvasId";
402
402
  this.renderSurface.invalidateElement(canvasId);
403
403
  };
@@ -415,7 +415,8 @@ var SciChartSurface = /** @class */ (function (_super) {
415
415
  /**
416
416
  * @inheritDoc
417
417
  */
418
- SciChartSurface.prototype.delete = function () {
418
+ SciChartSurface.prototype.delete = function (clearHtml) {
419
+ if (clearHtml === void 0) { clearHtml = true; }
419
420
  _super.prototype.delete.call(this);
420
421
  this.renderableSeries.asArray().forEach(function (rs) { return rs.delete(); });
421
422
  this.renderableSeries.clear();
@@ -428,7 +429,7 @@ var SciChartSurface = /** @class */ (function (_super) {
428
429
  this.watermarkProperties = (0, Deleter_1.deleteSafe)(this.watermarkProperties);
429
430
  this.watermarkPropertyPosition = (0, Deleter_1.deleteSafe)(this.watermarkPropertyPosition);
430
431
  this.chartModifiers.asArray().forEach(function (chm) { return chm.delete(); });
431
- if (this.domChartRoot) {
432
+ if (clearHtml && this.domChartRoot) {
432
433
  var style = this.domChartRoot.style;
433
434
  if (style) {
434
435
  style.background = "";
@@ -259,7 +259,7 @@ export declare abstract class SciChartSurfaceBase implements ISciChartSurfaceBas
259
259
  /**
260
260
  * @inheritDoc
261
261
  */
262
- delete(): void;
262
+ delete(clearHtml?: boolean): void;
263
263
  addDeletable(deletable: IDeletable): void;
264
264
  /**
265
265
  * Call invalidateElement() to trigger a redraw of the {@link SciChartSurfaceBase}. SciChart's WebGL WebAssembly rendering
@@ -286,9 +286,10 @@ var SciChartSurfaceBase = /** @class */ (function () {
286
286
  /**
287
287
  * @inheritDoc
288
288
  */
289
- SciChartSurfaceBase.prototype.delete = function () {
289
+ SciChartSurfaceBase.prototype.delete = function (clearHtml) {
290
290
  var _this = this;
291
291
  var _a;
292
+ if (clearHtml === void 0) { clearHtml = true; }
292
293
  this.isDeletedProperty = true;
293
294
  var currentSurfaceIndex = (_a = this.destinations) === null || _a === void 0 ? void 0 : _a.findIndex(function (dest) { return dest.sciChartSurface === _this; });
294
295
  if (currentSurfaceIndex >= 0) {
@@ -171,7 +171,7 @@ var createMaster = function () {
171
171
  Guard_1.Guard.notNull(theme, "theme");
172
172
  var canvas2dId = sciChartInitCommon_1.default.getCanvas2dId(divElementId);
173
173
  var sameIdDestinations = exports.sciChartDestinations.filter(function (el) { return el.canvasElementId === canvas2dId; });
174
- sameIdDestinations.forEach(function (el) { return el.sciChartSurface.delete(); });
174
+ sameIdDestinations.forEach(function (el) { return el.sciChartSurface.delete(false); });
175
175
  var otherDestinations = exports.sciChartDestinations.filter(function (el) { return el.canvasElementId !== canvas2dId; });
176
176
  chartInitObj.ClearDestinations();
177
177
  while (exports.sciChartDestinations.length > 0) {
@@ -34,7 +34,7 @@ interface ILicenseCookie {
34
34
  lastValidated: Date;
35
35
  }
36
36
  export declare const getLicenseCookie: () => ILicenseCookie;
37
- export declare const applyLicense: (licenseContext: TLicenseContext) => void;
37
+ export declare const applyLicense: (licenseContext: TLicenseContext, sciChartSurface: SciChartSurfaceBase) => void;
38
38
  export declare type TLicenseContext = {
39
39
  SCRTCredentials: {
40
40
  GetLicenseType: () => SCRTLicenseType;
@@ -134,7 +134,7 @@ var setRuntimeLicenseKey = function (value) {
134
134
  runtimeLicenseKey = value;
135
135
  if (runtimeLicenseKey !== prev && runtimeLicenseKey !== "") {
136
136
  if (licenseContext2D !== undefined) {
137
- (0, exports.applyLicense)(licenseContext2D);
137
+ (0, exports.applyLicense)(licenseContext2D, sciChartSurface2D);
138
138
  }
139
139
  }
140
140
  };
@@ -161,7 +161,7 @@ var callbacks3D = {
161
161
  };
162
162
  var setCallbacks3D = function (callbacks) { return (callbacks3D = callbacks); };
163
163
  exports.setCallbacks3D = setCallbacks3D;
164
- var getlicenseFromWizard = function () { return __awaiter(void 0, void 0, void 0, function () {
164
+ var getlicenseFromWizard = function (licenseContext, sciChartSurface) { return __awaiter(void 0, void 0, void 0, function () {
165
165
  var response, keyCode, _a, requiresValidation, trialExpired, err_3;
166
166
  return __generator(this, function (_b) {
167
167
  switch (_b.label) {
@@ -179,16 +179,16 @@ var getlicenseFromWizard = function () { return __awaiter(void 0, void 0, void 0
179
179
  return [4 /*yield*/, response.text()];
180
180
  case 2:
181
181
  keyCode = _b.sent();
182
- _a = setNewLicense(keyCode), requiresValidation = _a.requiresValidation, trialExpired = _a.trialExpired;
182
+ _a = setNewLicense(keyCode, licenseContext, sciChartSurface), requiresValidation = _a.requiresValidation, trialExpired = _a.trialExpired;
183
183
  if (requiresValidation) {
184
184
  debug("Got a developer license from local license wizard. Validating...");
185
185
  checkStatus = licensingClasses_1.LicenseCheckStatus.ValidatingDeveloperLicense;
186
- dolicenseChallenge();
186
+ dolicenseChallenge(licenseContext, sciChartSurface);
187
187
  }
188
188
  else if (trialExpired) {
189
189
  checkStatus = licensingClasses_1.LicenseCheckStatus.NoLicenseInWizard;
190
190
  debug("No valid license available in licensing wizard. Trying again in ".concat(retryTime, " seconds"));
191
- wizardTimer = setTimeout(function () { return getlicenseFromWizard(); }, retryTime * 1000);
191
+ wizardTimer = setTimeout(function () { return getlicenseFromWizard(licenseContext, sciChartSurface); }, retryTime * 1000);
192
192
  }
193
193
  else {
194
194
  debug("Got a valid license from local license wizard.");
@@ -198,7 +198,7 @@ var getlicenseFromWizard = function () { return __awaiter(void 0, void 0, void 0
198
198
  case 3:
199
199
  checkStatus = licensingClasses_1.LicenseCheckStatus.NoLicenseInWizard;
200
200
  debug("No license available in licensing wizard. Trying again in ".concat(retryTime, " seconds"));
201
- wizardTimer = setTimeout(function () { return getlicenseFromWizard(); }, retryTime * 1000);
201
+ wizardTimer = setTimeout(function () { return getlicenseFromWizard(licenseContext, sciChartSurface); }, retryTime * 1000);
202
202
  _b.label = 4;
203
203
  case 4: return [3 /*break*/, 6];
204
204
  case 5:
@@ -207,7 +207,7 @@ var getlicenseFromWizard = function () { return __awaiter(void 0, void 0, void 0
207
207
  getLicenseFailCounts += 1;
208
208
  if (getLicenseFailCounts < maxretries) {
209
209
  debug("Could not find licensing wizard. Trying again in ".concat(retryTime, " seconds"));
210
- setTimeout(function () { return getlicenseFromWizard(); }, retryTime * 1000);
210
+ setTimeout(function () { return getlicenseFromWizard(licenseContext, sciChartSurface); }, retryTime * 1000);
211
211
  }
212
212
  else {
213
213
  // give up.
@@ -217,8 +217,8 @@ var getlicenseFromWizard = function () { return __awaiter(void 0, void 0, void 0
217
217
  }
218
218
  return [3 /*break*/, 6];
219
219
  case 6:
220
- if (licenseContext2D !== undefined) {
221
- (0, exports.updateLicenseDisplay)((0, exports.getLicenseInfo)(licenseContext2D), sciChartSurface2D, true, true);
220
+ if (licenseContext !== undefined) {
221
+ (0, exports.updateLicenseDisplay)((0, exports.getLicenseInfo)(licenseContext), sciChartSurface, true, true);
222
222
  }
223
223
  callbacks3D.updateLicenseDisplay3D();
224
224
  return [2 /*return*/];
@@ -247,12 +247,12 @@ var getLicenseCookie = function () {
247
247
  exports.getLicenseCookie = getLicenseCookie;
248
248
  var refreshLicense = function () {
249
249
  (0, cookie_1.deleteCookie)("scLicense");
250
- (0, exports.applyLicense)(licenseContext2D);
250
+ (0, exports.applyLicense)(licenseContext2D, sciChartSurface2D);
251
251
  };
252
- var setChallengeResponse = function (token) {
252
+ var setChallengeResponse = function (token, licenseContext) {
253
253
  var expirySeconds = -1;
254
- if (licenseContext2D !== undefined) {
255
- expirySeconds = licenseContext2D.SCRTCredentials.ApplyLicenseResponse(token);
254
+ if (licenseContext !== undefined) {
255
+ expirySeconds = licenseContext.SCRTCredentials.ApplyLicenseResponse(token);
256
256
  }
257
257
  var expirySeconds3D = callbacks3D.setChallengeResponse3D(token);
258
258
  if (expirySeconds3D !== undefined)
@@ -260,7 +260,7 @@ var setChallengeResponse = function (token) {
260
260
  return expirySeconds;
261
261
  };
262
262
  var challengeFailCounts = 0;
263
- var dolicenseChallenge = function () { return __awaiter(void 0, void 0, void 0, function () {
263
+ var dolicenseChallenge = function (licenseContext, sciChartSurface) { return __awaiter(void 0, void 0, void 0, function () {
264
264
  var server, challenge, orderId, response, queryString, url, url, token, expirySeconds, key, timeNow, timeToExpiry, err_4, expiry, msg;
265
265
  var _a;
266
266
  return __generator(this, function (_b) {
@@ -275,9 +275,9 @@ var dolicenseChallenge = function () { return __awaiter(void 0, void 0, void 0,
275
275
  debug("Attempting to validate license with ".concat(server));
276
276
  challenge = void 0;
277
277
  orderId = void 0;
278
- if (licenseContext2D !== undefined) {
279
- challenge = licenseContext2D.SCRTCredentials.GetLicenseChallenge();
280
- orderId = licenseContext2D.SCRTCredentials.GetOrderId();
278
+ if (licenseContext !== undefined) {
279
+ challenge = licenseContext.SCRTCredentials.GetLicenseChallenge();
280
+ orderId = licenseContext.SCRTCredentials.GetOrderId();
281
281
  }
282
282
  else {
283
283
  (_a = callbacks3D.getLicenseChallenge3D(), challenge = _a.challenge, orderId = _a.orderId);
@@ -308,7 +308,7 @@ var dolicenseChallenge = function () { return __awaiter(void 0, void 0, void 0,
308
308
  case 8:
309
309
  token = _b.sent();
310
310
  if (!token.startsWith("Error")) {
311
- expirySeconds = setChallengeResponse(token);
311
+ expirySeconds = setChallengeResponse(token, licenseContext);
312
312
  if (expirySeconds > 0) {
313
313
  key = (0, exports.getLicenseCookie)().key;
314
314
  timeNow = Math.floor(new Date().getTime() / 1000);
@@ -317,7 +317,7 @@ var dolicenseChallenge = function () { return __awaiter(void 0, void 0, void 0,
317
317
  checkStatus = licensingClasses_1.LicenseCheckStatus.LicenseOK;
318
318
  timeToExpiry = expirySeconds - timeNow;
319
319
  challengeFailCounts = 0;
320
- setTimeout(function () { return dolicenseChallenge(); }, Math.floor(timeToExpiry * 0.95 * 1000)); // Allow 5%
320
+ setTimeout(function () { return dolicenseChallenge(licenseContext, sciChartSurface); }, Math.floor(timeToExpiry * 0.95 * 1000)); // Allow 5%
321
321
  }
322
322
  else {
323
323
  // Something went wrong with the apply
@@ -350,9 +350,9 @@ var dolicenseChallenge = function () { return __awaiter(void 0, void 0, void 0,
350
350
  console.warn("Server license validation failed. Looking for local developer license");
351
351
  runtimeLicenseKey = "";
352
352
  checkStatus = licensingClasses_1.LicenseCheckStatus.NoLicense;
353
- licenseContext2D.SCRTCredentials.ResetRuntimeLicense();
353
+ licenseContext.SCRTCredentials.ResetRuntimeLicense();
354
354
  isRuntimeKey = false;
355
- (0, exports.applyLicense)(licenseContext2D);
355
+ (0, exports.applyLicense)(licenseContext, sciChartSurface);
356
356
  // licenseManager2dState.setIsDev(true);
357
357
  // checkStatus = LicenseCheckStatus.LookingForLicenseWizard;
358
358
  // getlicenseFromWizard();
@@ -366,7 +366,7 @@ var dolicenseChallenge = function () { return __awaiter(void 0, void 0, void 0,
366
366
  challengeFailCounts += 1;
367
367
  if (challengeFailCounts < maxretries) {
368
368
  debug("Could not find ".concat(server, "/").concat(serverLicenseEndpoint, ". Trying again in ").concat(retryTime, " seconds"));
369
- setTimeout(function () { return dolicenseChallenge(); }, retryTime * 1000);
369
+ setTimeout(function () { return dolicenseChallenge(licenseContext, sciChartSurface); }, retryTime * 1000);
370
370
  }
371
371
  else {
372
372
  expiry = (0, exports.getLicenseCookie)().expiry;
@@ -381,8 +381,8 @@ var dolicenseChallenge = function () { return __awaiter(void 0, void 0, void 0,
381
381
  }
382
382
  return [3 /*break*/, 12];
383
383
  case 12:
384
- if (licenseContext2D !== undefined) {
385
- (0, exports.updateLicenseDisplay)((0, exports.getLicenseInfo)(licenseContext2D), sciChartSurface2D, true, true);
384
+ if (licenseContext !== undefined) {
385
+ (0, exports.updateLicenseDisplay)((0, exports.getLicenseInfo)(licenseContext), sciChartSurface, true, true);
386
386
  }
387
387
  callbacks3D.updateLicenseDisplay3D();
388
388
  return [2 /*return*/];
@@ -396,10 +396,12 @@ var sciChartSurface2D;
396
396
  var isRuntimeKey = false;
397
397
  var applyLicense2D = function (licenseContext, sciChartSurface, isSingle) {
398
398
  debug("applyLicense 2D");
399
- sciChartSurface2D = sciChartSurface;
400
- if (isSingle || shouldApplyLicense2D) {
399
+ if (shouldApplyLicense2D) {
400
+ sciChartSurface2D = sciChartSurface;
401
401
  licenseContext2D = licenseContext;
402
- (0, exports.applyLicense)(licenseContext);
402
+ }
403
+ if (isSingle || shouldApplyLicense2D) {
404
+ (0, exports.applyLicense)(licenseContext, sciChartSurface);
403
405
  }
404
406
  else {
405
407
  if (checkStatus !== licensingClasses_1.LicenseCheckStatus.LicenseOK) {
@@ -409,13 +411,15 @@ var applyLicense2D = function (licenseContext, sciChartSurface, isSingle) {
409
411
  if (!isSingle)
410
412
  shouldApplyLicense2D = false;
411
413
  };
412
- var applyLicense = function (licenseContext) {
414
+ var applyLicense = function (licenseContext, sciChartSurface) {
413
415
  var _a;
414
416
  debug("applyLicense running");
415
417
  var licenseKey = "";
416
418
  var lt = licenseContext.SCRTCredentials.GetLicenseType();
417
419
  debug("Initial license status is " + licensingClasses_1.LicenseType[convertLicenseType(lt, licenseContext)]);
418
- if (window.location.hostname.includes(".csb.app") || window.location.hostname.includes(".codesandbox.io")) {
420
+ if (window.location.hostname.includes(".csb.app") ||
421
+ window.location.hostname === "codesandbox.io" ||
422
+ window.location.hostname.includes(".codesandbox.io")) {
419
423
  runtimeLicenseKey = "csb";
420
424
  }
421
425
  // Get from global store
@@ -503,7 +507,7 @@ var applyLicense = function (licenseContext) {
503
507
  }
504
508
  else if (licenseCookie.expiry > new Date() && licenseCookie.key === licenseKey) {
505
509
  debug("current token in cookie");
506
- var expirySeconds = setChallengeResponse(licenseCookie.token);
510
+ var expirySeconds = setChallengeResponse(licenseCookie.token, licenseContext);
507
511
  lt = licenseContext.SCRTCredentials.GetLicenseType();
508
512
  if (lt === licenseContext.SCRTLicenseType.LICENSE_TYPE_FULL ||
509
513
  lt === licenseContext.SCRTLicenseType.LICENSE_TYPE_TRIAL) {
@@ -519,12 +523,13 @@ var applyLicense = function (licenseContext) {
519
523
  if (secondsSinceValidated > validationInterval &&
520
524
  checkStatus !== licensingClasses_1.LicenseCheckStatus.ValidatingDeveloperLicense) {
521
525
  checkStatus = licensingClasses_1.LicenseCheckStatus.ValidatingDeveloperLicense;
522
- dolicenseChallenge();
526
+ dolicenseChallenge(licenseContext, sciChartSurface);
523
527
  }
524
528
  }
525
529
  else if (checkStatus === licensingClasses_1.LicenseCheckStatus.NoLicense) {
526
530
  checkStatus = licensingClasses_1.LicenseCheckStatus.ValidatingDeveloperLicense;
527
- dolicenseChallenge();
531
+ setLicenseCookie(licenseKey, "", 0, 0);
532
+ dolicenseChallenge(licenseContext, sciChartSurface);
528
533
  }
529
534
  }
530
535
  else {
@@ -536,11 +541,11 @@ var applyLicense = function (licenseContext) {
536
541
  if (wizardTimer === undefined) {
537
542
  checkStatus = licensingClasses_1.LicenseCheckStatus.LookingForLicenseWizard;
538
543
  licenseManager2dState_1.licenseManager2dState.setIsDev(true);
539
- getlicenseFromWizard();
544
+ getlicenseFromWizard(licenseContext, sciChartSurface);
540
545
  }
541
546
  }
542
- if (licenseContext2D !== undefined) {
543
- (0, exports.updateLicenseDisplay)((0, exports.getLicenseInfo)(licenseContext2D), sciChartSurface2D, true, false);
547
+ if (licenseContext !== undefined) {
548
+ (0, exports.updateLicenseDisplay)((0, exports.getLicenseInfo)(licenseContext), sciChartSurface, true, false);
544
549
  }
545
550
  callbacks3D.updateLicenseDisplay3D();
546
551
  };
@@ -549,7 +554,7 @@ var licenseModal;
549
554
  var openLicenseModal = function () {
550
555
  console.error("Modal not initialized");
551
556
  };
552
- var setNewLicense = function (keyCode) {
557
+ var setNewLicense = function (keyCode, licenseContext, sciChartSurface) {
553
558
  var requiresValidation = false;
554
559
  var trialExpired;
555
560
  if (licenseModal) {
@@ -557,13 +562,13 @@ var setNewLicense = function (keyCode) {
557
562
  }
558
563
  isRuntimeKey = false;
559
564
  setLicenseCookie(keyCode, null, null, null);
560
- if (licenseContext2D !== undefined) {
561
- licenseContext2D.SCRTCredentials.SetRuntimeLicenseKeyW(keyCode);
562
- requiresValidation = licenseContext2D.SCRTCredentials.RequiresValidation();
565
+ if (licenseContext !== undefined) {
566
+ licenseContext.SCRTCredentials.SetRuntimeLicenseKeyW(keyCode);
567
+ requiresValidation = licenseContext.SCRTCredentials.RequiresValidation();
563
568
  trialExpired =
564
- licenseContext2D.SCRTCredentials.GetLicenseType() ===
565
- licenseContext2D.SCRTLicenseType.LICENSE_TYPE_TRIAL_EXPIRED;
566
- (0, exports.updateLicenseDisplay)((0, exports.getLicenseInfo)(licenseContext2D), sciChartSurface2D, true, true);
569
+ licenseContext.SCRTCredentials.GetLicenseType() ===
570
+ licenseContext.SCRTLicenseType.LICENSE_TYPE_TRIAL_EXPIRED;
571
+ (0, exports.updateLicenseDisplay)((0, exports.getLicenseInfo)(licenseContext), sciChartSurface, true, true);
567
572
  }
568
573
  var result3D = callbacks3D.setNewLicense3D(keyCode);
569
574
  if (result3D !== undefined) {
@@ -32,7 +32,7 @@ var applyLicense3D = function (licenseContext, sciChartSurface, isSingle) {
32
32
  sciChartSurface3D = sciChartSurface;
33
33
  // set up callbacks
34
34
  (0, licenseManager2D_1.setCallbacks3D)(callbacks3D);
35
- (0, licenseManager2D_1.applyLicense)(licenseContext);
35
+ (0, licenseManager2D_1.applyLicense)(licenseContext, sciChartSurface3D);
36
36
  }
37
37
  else {
38
38
  (0, licenseManager2D_1.updateLicenseDisplay)((0, licenseManager2D_1.getLicenseInfo)(licenseContext), sciChartSurface, false, false);
@@ -1,4 +1,4 @@
1
1
  import { TSciChart } from "../types/TSciChart";
2
2
  import { TSciChart3D } from "../types/TSciChart3D";
3
- export declare const libraryVersion = "2.2.2393";
3
+ export declare const libraryVersion = "2.2.2401";
4
4
  export declare const checkBuildStamp: (wasmContext: TSciChart | TSciChart3D) => boolean;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkBuildStamp = exports.libraryVersion = void 0;
4
- var buildStamp = "2022-06-10T00:00:00";
4
+ var buildStamp = "2022-07-07T00:00:00";
5
5
  var result;
6
6
  // tslint:disable-next-line:no-var-requires
7
- exports.libraryVersion = "2.2.2393";
7
+ exports.libraryVersion = "2.2.2401";
8
8
  var checkBuildStamp = function (wasmContext) {
9
9
  if (result !== undefined)
10
10
  return result;