@percy/client 1.27.3-beta.0 → 1.27.4-beta.0

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.
Files changed (2) hide show
  1. package/dist/client.js +8 -1
  2. package/package.json +4 -4
package/dist/client.js CHANGED
@@ -42,11 +42,13 @@ export class PercyClient {
42
42
  // initial user agent info
43
43
  clientInfo,
44
44
  environmentInfo,
45
+ config,
45
46
  // versioned api url
46
47
  apiUrl = PERCY_CLIENT_API_URL
47
48
  } = {}) {
48
49
  Object.assign(this, {
49
50
  token,
51
+ config: config || {},
50
52
  apiUrl
51
53
  });
52
54
  this.addClientInfo(clientInfo);
@@ -75,8 +77,13 @@ export class PercyClient {
75
77
  }
76
78
 
77
79
  // Checks for a Percy token and returns it.
80
+ // Priority order is
81
+ // 1. passed token to constructor
82
+ // 2. PERCY_TOKEN env var [ from env package ]
83
+ // 3. token from percy config
78
84
  getToken(raiseIfMissing = true) {
79
- let token = this.token || this.env.token;
85
+ var _this$config$percy;
86
+ let token = this.token || this.env.token || ((_this$config$percy = this.config.percy) === null || _this$config$percy === void 0 ? void 0 : _this$config$percy.token);
80
87
  if (!token && raiseIfMissing) throw new Error('Missing Percy token');
81
88
  return token;
82
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/client",
3
- "version": "1.27.3-beta.0",
3
+ "version": "1.27.4-beta.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,8 +32,8 @@
32
32
  "test:coverage": "yarn test --coverage"
33
33
  },
34
34
  "dependencies": {
35
- "@percy/env": "1.27.3-beta.0",
36
- "@percy/logger": "1.27.3-beta.0"
35
+ "@percy/env": "1.27.4-beta.0",
36
+ "@percy/logger": "1.27.4-beta.0"
37
37
  },
38
- "gitHead": "a9b7ebc7005ee50761373f49ce3454449f38f227"
38
+ "gitHead": "d83228ad59736923285426854572f9e1f80ad48f"
39
39
  }