Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 9420718

Browse files
committed
Rebuild react-sdk
1 parent 04ad62f commit 9420718

File tree

8 files changed

+19
-44
lines changed

8 files changed

+19
-44
lines changed

packages/js-web-sdk/packages/react-sdk/dist/Provider.d.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from 'react';
22
import { OptimizelySDKWrapper } from '@optimizely/js-web-sdk';
33
interface OptimizelyProviderProps {
44
optimizely: OptimizelySDKWrapper;
5-
timeout: number;
5+
timeout?: number;
66
}
77
interface OptimizelyProviderState {
88
userId: string;
@@ -12,9 +12,6 @@ interface OptimizelyProviderState {
1212
}
1313
export declare class OptimizelyProvider extends React.Component<OptimizelyProviderProps, OptimizelyProviderState> {
1414
sdkWrapper: OptimizelySDKWrapper;
15-
static defaultProps: {
16-
timeout: number;
17-
};
1815
constructor(props: OptimizelyProviderProps);
1916
render(): JSX.Element;
2017
}

packages/js-web-sdk/packages/react-sdk/dist/react-sdk.browser.umd.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,13 +1326,12 @@
13261326
var _a = this.props, children = _a.children, timeout = _a.timeout;
13271327
var value = {
13281328
optimizely: this.sdkWrapper,
1329-
timeout: timeout,
13301329
};
1330+
if (timeout !== undefined) {
1331+
value['timeout'] = timeout;
1332+
}
13311333
return (React.createElement(OptimizelyContextProvider, { value: value }, children));
13321334
};
1333-
OptimizelyProvider.defaultProps = {
1334-
timeout: 0,
1335-
};
13361335
return OptimizelyProvider;
13371336
}(React.Component));
13381337

@@ -1344,7 +1343,7 @@
13441343
}
13451344
WithOptimizely.prototype.render = function () {
13461345
var _this = this;
1347-
return (React.createElement(OptimizelyContextConsumer, null, function (value) { return (React.createElement(Component, __assign({}, _this.props, { optimizely: value.optimizely, optimizelyReadyTimeout: value.optimizelyReadyTimeout }))); }));
1346+
return (React.createElement(OptimizelyContextConsumer, null, function (value) { return (React.createElement(Component, __assign({}, _this.props, { optimizely: value.optimizely, optimizelyReadyTimeout: value.timeout }))); }));
13481347
};
13491348
return WithOptimizely;
13501349
}(React.Component));
@@ -1402,7 +1401,7 @@
14021401
Experiment.prototype.componentDidMount = function () {
14031402
var _this = this;
14041403
var _a = this.props, experiment = _a.experiment, optimizely = _a.optimizely, optimizelyReadyTimeout = _a.optimizelyReadyTimeout;
1405-
if (optimizely === null) {
1404+
if (!optimizely) {
14061405
throw new Error('optimizely prop must be supplied');
14071406
}
14081407
optimizely.onReady({ timeout: optimizelyReadyTimeout }).then(function () {
@@ -1428,18 +1427,14 @@
14281427
// to trigger an unmount/remount
14291428
React.Children.forEach(this.props.children, function (child) {
14301429
if (match || !React.isValidElement(child)) {
1431-
console.log('found', match, !React.isValidElement(child));
14321430
return;
14331431
}
1434-
console.log('child props', child.props);
14351432
if (child.props.variation) {
1436-
console.log('child variation', child.props.variation);
14371433
if (variation === child.props.variation) {
14381434
match = child;
14391435
}
14401436
}
14411437
else if (child.props.default) {
1442-
console.log('child default', child.props.default);
14431438
match = child;
14441439
}
14451440
});

packages/js-web-sdk/packages/react-sdk/dist/react-sdk.browser.umd.min.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.

packages/js-web-sdk/packages/react-sdk/dist/react-sdk.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,12 @@ var OptimizelyProvider = /** @class */ (function (_super) {
6565
var _a = this.props, children = _a.children, timeout = _a.timeout;
6666
var value = {
6767
optimizely: this.sdkWrapper,
68-
timeout: timeout,
6968
};
69+
if (timeout !== undefined) {
70+
value['timeout'] = timeout;
71+
}
7072
return (React.createElement(OptimizelyContextProvider, { value: value }, children));
7173
};
72-
OptimizelyProvider.defaultProps = {
73-
timeout: 0,
74-
};
7574
return OptimizelyProvider;
7675
}(React.Component));
7776

@@ -83,7 +82,7 @@ function withOptimizely(Component) {
8382
}
8483
WithOptimizely.prototype.render = function () {
8584
var _this = this;
86-
return (React.createElement(OptimizelyContextConsumer, null, function (value) { return (React.createElement(Component, __assign({}, _this.props, { optimizely: value.optimizely, optimizelyReadyTimeout: value.optimizelyReadyTimeout }))); }));
85+
return (React.createElement(OptimizelyContextConsumer, null, function (value) { return (React.createElement(Component, __assign({}, _this.props, { optimizely: value.optimizely, optimizelyReadyTimeout: value.timeout }))); }));
8786
};
8887
return WithOptimizely;
8988
}(React.Component));
@@ -141,7 +140,7 @@ var Experiment = /** @class */ (function (_super) {
141140
Experiment.prototype.componentDidMount = function () {
142141
var _this = this;
143142
var _a = this.props, experiment = _a.experiment, optimizely = _a.optimizely, optimizelyReadyTimeout = _a.optimizelyReadyTimeout;
144-
if (optimizely === null) {
143+
if (!optimizely) {
145144
throw new Error('optimizely prop must be supplied');
146145
}
147146
optimizely.onReady({ timeout: optimizelyReadyTimeout }).then(function () {
@@ -167,18 +166,14 @@ var Experiment = /** @class */ (function (_super) {
167166
// to trigger an unmount/remount
168167
React.Children.forEach(this.props.children, function (child) {
169168
if (match || !React.isValidElement(child)) {
170-
console.log('found', match, !React.isValidElement(child));
171169
return;
172170
}
173-
console.log('child props', child.props);
174171
if (child.props.variation) {
175-
console.log('child variation', child.props.variation);
176172
if (variation === child.props.variation) {
177173
match = child;
178174
}
179175
}
180176
else if (child.props.default) {
181-
console.log('child default', child.props.default);
182177
match = child;
183178
}
184179
});

packages/js-web-sdk/packages/react-sdk/dist/react-sdk.mjs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,12 @@ var OptimizelyProvider = /** @class */ (function (_super) {
6161
var _a = this.props, children = _a.children, timeout = _a.timeout;
6262
var value = {
6363
optimizely: this.sdkWrapper,
64-
timeout: timeout,
6564
};
65+
if (timeout !== undefined) {
66+
value['timeout'] = timeout;
67+
}
6668
return (createElement(OptimizelyContextProvider, { value: value }, children));
6769
};
68-
OptimizelyProvider.defaultProps = {
69-
timeout: 0,
70-
};
7170
return OptimizelyProvider;
7271
}(Component));
7372

@@ -79,7 +78,7 @@ function withOptimizely(Component$$1) {
7978
}
8079
WithOptimizely.prototype.render = function () {
8180
var _this = this;
82-
return (createElement(OptimizelyContextConsumer, null, function (value) { return (createElement(Component$$1, __assign({}, _this.props, { optimizely: value.optimizely, optimizelyReadyTimeout: value.optimizelyReadyTimeout }))); }));
81+
return (createElement(OptimizelyContextConsumer, null, function (value) { return (createElement(Component$$1, __assign({}, _this.props, { optimizely: value.optimizely, optimizelyReadyTimeout: value.timeout }))); }));
8382
};
8483
return WithOptimizely;
8584
}(Component));
@@ -137,7 +136,7 @@ var Experiment = /** @class */ (function (_super) {
137136
Experiment.prototype.componentDidMount = function () {
138137
var _this = this;
139138
var _a = this.props, experiment = _a.experiment, optimizely = _a.optimizely, optimizelyReadyTimeout = _a.optimizelyReadyTimeout;
140-
if (optimizely === null) {
139+
if (!optimizely) {
141140
throw new Error('optimizely prop must be supplied');
142141
}
143142
optimizely.onReady({ timeout: optimizelyReadyTimeout }).then(function () {
@@ -163,18 +162,14 @@ var Experiment = /** @class */ (function (_super) {
163162
// to trigger an unmount/remount
164163
Children.forEach(this.props.children, function (child) {
165164
if (match || !isValidElement(child)) {
166-
console.log('found', match, !isValidElement(child));
167165
return;
168166
}
169-
console.log('child props', child.props);
170167
if (child.props.variation) {
171-
console.log('child variation', child.props.variation);
172168
if (variation === child.props.variation) {
173169
match = child;
174170
}
175171
}
176172
else if (child.props.default) {
177-
console.log('child default', child.props.default);
178173
match = child;
179174
}
180175
});

packages/js-web-sdk/packages/react-sdk/dist/reactSDK.d.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/js-web-sdk/packages/react-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"scripts": {
2020
"tsc": "rm -rf lib/ && tsc",
2121
"build": "rm -rf dist/ && node ./scripts/build.js",
22-
"test": "jest"
22+
"test": "jest --silent"
2323
},
2424
"dependencies": {
2525
"prop-types": "^15.6.2",

packages/js-web-sdk/packages/react-sdk/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"outDir": "./lib"
1010
},
1111
"include": ["./src"],
12-
"exclude": ["./node_modules"]
12+
"exclude": ["./node_modules", "./src/**/*.spec.tsx", "./src/**/*.spec.ts"]
1313
}

0 commit comments

Comments
 (0)