@percy/client 1.30.9-beta.3 → 1.30.9

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 +18 -4
  2. package/package.json +5 -5
package/dist/client.js CHANGED
@@ -21,8 +21,18 @@ function validateId(type, id) {
21
21
  throw new Error(`Invalid ${type} ID`);
22
22
  }
23
23
  }
24
- function ensureElementSelector(regions) {
25
- if (!Array.isArray(regions)) return null;
24
+ function makeRegions(regions, algorithm, algorithmConfiguration) {
25
+ let regionObj;
26
+ if (algorithm) {
27
+ regionObj = {};
28
+ regionObj.algorithm = algorithm;
29
+ regionObj.configuration = algorithmConfiguration;
30
+ }
31
+ if (!Array.isArray(regions) && !regionObj) return null;
32
+ if (regionObj) {
33
+ regions || (regions = []);
34
+ regions.push(regionObj);
35
+ }
26
36
  return regions.map(region => ({
27
37
  ...region,
28
38
  elementSelector: region.elementSelector || {
@@ -417,6 +427,8 @@ export class PercyClient {
417
427
  labels,
418
428
  thTestCaseExecutionId,
419
429
  regions,
430
+ algorithm,
431
+ algorithmConfiguration,
420
432
  resources = [],
421
433
  meta
422
434
  } = {}) {
@@ -427,7 +439,7 @@ export class PercyClient {
427
439
  this.log.warn('Warning: Missing `clientInfo` and/or `environmentInfo` properties', meta);
428
440
  }
429
441
  let tagsArr = tagsList(labels);
430
- let regionsArr = ensureElementSelector(regions);
442
+ let regionsArr = makeRegions(regions, algorithm, algorithmConfiguration);
431
443
  this.log.debug(`Validating resources: ${name}...`, meta);
432
444
  for (let resource of resources) {
433
445
  if (resource.sha || resource.content || !resource.filepath) continue;
@@ -516,6 +528,8 @@ export class PercyClient {
516
528
  metadata,
517
529
  sync,
518
530
  regions,
531
+ algorithm,
532
+ algorithmConfiguration,
519
533
  meta = {}
520
534
  } = {}) {
521
535
  validateId('snapshot', snapshotId);
@@ -530,7 +544,7 @@ export class PercyClient {
530
544
  tile.content = await fs.promises.readFile(tile.filepath);
531
545
  }
532
546
  }
533
- let regionsArr = ensureElementSelector(regions);
547
+ let regionsArr = makeRegions(regions, algorithm, algorithmConfiguration);
534
548
  this.log.debug(`${tiles.length} tiles for comparision: ${tag.name}...`, meta);
535
549
  return this.post(`snapshots/${snapshotId}/comparisons`, {
536
550
  data: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/client",
3
- "version": "1.30.9-beta.3",
3
+ "version": "1.30.9",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public",
12
- "tag": "beta"
12
+ "tag": "latest"
13
13
  },
14
14
  "engines": {
15
15
  "node": ">=14"
@@ -33,10 +33,10 @@
33
33
  "test:coverage": "yarn test --coverage"
34
34
  },
35
35
  "dependencies": {
36
- "@percy/env": "1.30.9-beta.3",
37
- "@percy/logger": "1.30.9-beta.3",
36
+ "@percy/env": "1.30.9",
37
+ "@percy/logger": "1.30.9",
38
38
  "pac-proxy-agent": "^7.0.2",
39
39
  "pako": "^2.1.0"
40
40
  },
41
- "gitHead": "06ceb56e04806677d41a22eb1ccbee81a8d32c15"
41
+ "gitHead": "bb6e994542280596015cb57f884fe3359be01c22"
42
42
  }