Skip to content

Commit b9638a2

Browse files
committed
Merge remote-tracking branch 'powerbi/master'
2 parents 5e5455a + 906174e commit b9638a2

10 files changed

Lines changed: 144 additions & 30 deletions

File tree

‎demo/v2-demo/scripts/guid.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ function generateNewGuid() {
77
d += performance.now();
88
}
99
return 'xxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
10-
// Generate a random number, scaled from 0 to 16.
11-
// Bitwise-and by 15 since we only care about the last 4 bits.
12-
const r = (d + Math.random() * 16) & 15 | 0;
10+
11+
// Generate a random number, scaled from 0 to 15.
12+
const r = (getRandomValue() % 16);
1313

1414
// Shift 4 times to divide by 16
1515
d >>= 4;

‎demo/v2-demo/scripts/telemetry.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const TelemetrySectionName = {
2626
Showcase: "Showcase"
2727
};
2828

29-
function trackEvent(name, properties, flush = false) {
29+
function trackEvent(name, properties, flush) {
3030
if (!_session[SessionKeys.IsTelemetryEnabled]) {
3131
return;
3232
}
@@ -36,7 +36,7 @@ function trackEvent(name, properties, flush = false) {
3636
getAppInsightsInstance().then(function(ai) {
3737
// Normally, the SDK sends data at fixed intervals (typically 30 secs) or whenever buffer is full (typically 500 items).
3838
// https://docs.microsoft.com/en-us/azure/azure-monitor/app/api-custom-events-metrics#flushing-data
39-
ai.trackEvent({ name, properties });
39+
ai.trackEvent({ name: name, properties: properties });
4040
if (flush) {
4141
ai.flush();
4242
}

‎demo/v2-demo/scripts/utils.js‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,4 +230,14 @@ function removeArgFromUrl(url, arg) {
230230
}
231231

232232
return url;
233+
}
234+
235+
function getRandomValue() {
236+
237+
// window.msCrypto for IE
238+
var cryptoObj = window.crypto || window.msCrypto;
239+
var randomValueArray = new Uint32Array(1);
240+
cryptoObj.getRandomValues(randomValueArray);
241+
242+
return randomValueArray[0];
233243
}

‎demo/v2-demo/syntaxHighlighter/syntaxhighlighter.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/powerbi-client.d.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
/*! powerbi-client v2.10.1 | (c) 2016 Microsoft Corporation MIT */
1+
/*! powerbi-client v2.10.2 | (c) 2016 Microsoft Corporation MIT */
22
declare module "util" {
33
import { HttpPostMessage } from 'http-post-message';
4+
global {
5+
interface Window {
6+
msCrypto: Crypto;
7+
}
8+
}
49
/**
510
* Raises a custom event with event data on the specified HTML element.
611
*
@@ -40,7 +45,7 @@ declare module "util" {
4045
*/
4146
export function assign(...args: any[]): any;
4247
/**
43-
* Generates a random 7 character string.
48+
* Generates a random 5 to 6 character string.
4449
*
4550
* @export
4651
* @returns {string}
@@ -81,6 +86,10 @@ declare module "util" {
8186
* @returns {boolean}
8287
*/
8388
export function isRDLEmbed(embedUrl: string): boolean;
89+
/**
90+
* Returns random number
91+
*/
92+
export function getRandomValue(): number;
8493
}
8594
declare module "config" {
8695
const config: {

‎dist/powerbi.js‎

Lines changed: 88 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/powerbi.min.js‎

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "powerbi-client",
3-
"version": "2.10.1",
3+
"version": "2.10.2",
44
"description": "JavaScript library for embedding Power BI into your apps. Provides service which makes it easy to embed different types of components and an object model which allows easy interaction with these components such as changing pages, applying filters, and responding to data selection.",
55
"main": "dist/powerbi.js",
66
"typings": "dist/powerbi-client.d.ts",

‎src/config.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const config = {
2-
version: '2.10.1',
2+
version: '2.10.2',
33
type: 'js'
44
};
55

‎src/util.ts‎

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
import { HttpPostMessage } from 'http-post-message';
2+
declare global {
3+
interface Window {
4+
msCrypto: Crypto;
5+
}
6+
}
27

38
/**
49
* Raises a custom event with event data on the specified HTML element.
@@ -100,13 +105,13 @@ export function assign(...args) {
100105
}
101106

102107
/**
103-
* Generates a random 7 character string.
108+
* Generates a random 5 to 6 character string.
104109
*
105110
* @export
106111
* @returns {string}
107112
*/
108113
export function createRandomString(): string {
109-
return (Math.random() + 1).toString(36).substring(7);
114+
return getRandomValue().toString(36).substring(1);
110115
}
111116

112117
/**
@@ -120,10 +125,9 @@ export function generateUUID(): string {
120125
if (typeof performance !== 'undefined' && typeof performance.now === 'function') {
121126
d += performance.now();
122127
}
123-
return 'xxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
124-
// Generate a random number, scaled from 0 to 16.
125-
// Bitwise-and by 15 since we only care about the last 4 bits.
126-
const r = (d + Math.random() * 16) & 15 | 0;
128+
return 'xxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
129+
// Generate a random number, scaled from 0 to 15.
130+
const r = (getRandomValue() % 16);
127131

128132
// Shift 4 times to divide by 16
129133
d >>= 4;
@@ -174,4 +178,15 @@ export function isRDLEmbed(embedUrl: string): boolean {
174178
return embedUrl.toLowerCase().indexOf("/rdlembed?") >= 0;
175179
}
176180

181+
/**
182+
* Returns random number
183+
*/
184+
export function getRandomValue() {
185+
186+
// window.msCrypto for IE
187+
var cryptoObj = window.crypto || window.msCrypto;
188+
var randomValueArray = new Uint32Array(1);
189+
cryptoObj.getRandomValues(randomValueArray);
177190

191+
return randomValueArray[0];
192+
}

0 commit comments

Comments
 (0)