@adobe/mysticat-shared-seo-client 1.2.2 → 1.2.3

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [@adobe/mysticat-shared-seo-client-v1.2.3](https://github.com/adobe/spacecat-shared/compare/@adobe/mysticat-shared-seo-client-v1.2.2...@adobe/mysticat-shared-seo-client-v1.2.3) (2026-04-15)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **seo-client:** omit display_date to avoid 5x historical pricing ([#1537](https://github.com/adobe/spacecat-shared/issues/1537)) ([4ffc683](https://github.com/adobe/spacecat-shared/commit/4ffc683db492d10414c2bc5c23804ec42d88b2c5))
6
+
1
7
  ## [@adobe/mysticat-shared-seo-client-v1.2.2](https://github.com/adobe/spacecat-shared/compare/@adobe/mysticat-shared-seo-client-v1.2.1...@adobe/mysticat-shared-seo-client-v1.2.2) (2026-04-14)
2
8
 
3
9
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/mysticat-shared-seo-client",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Shared modules of the SpaceCat Services - SEO Client",
5
5
  "type": "module",
6
6
  "engines": {
package/src/client.js CHANGED
@@ -15,7 +15,7 @@ import { context as h2, h1 } from '@adobe/fetch';
15
15
 
16
16
  import { ENDPOINTS } from './endpoints.js';
17
17
  import {
18
- parseCsvResponse, coerceValue, getLimit, toApiDate, fromApiDate, lastMonthISO, buildFilter,
18
+ parseCsvResponse, coerceValue, getLimit, toApiDate, fromApiDate, buildFilter,
19
19
  extractBrand, INTENT_CODES,
20
20
  } from './utils.js';
21
21
 
@@ -344,7 +344,7 @@ export default class SeoClient {
344
344
  if (typeof opts !== 'object' || opts === null) {
345
345
  throw new Error('Second argument must be an options object, not a positional value');
346
346
  }
347
- const { date = lastMonthISO(), limit = 200, region } = opts;
347
+ const { date, limit = 200, region } = opts;
348
348
  if (!hasText(url)) {
349
349
  throw new Error(`Invalid URL: ${url}`);
350
350
  }
@@ -358,15 +358,23 @@ export default class SeoClient {
358
358
  // Capped at MAX_PAID_KEYWORDS_FETCH to bound cost.
359
359
  const fetchLimit = Math.min(effectiveLimit * 10, MAX_PAID_KEYWORDS_FETCH);
360
360
 
361
- const dbResults = await this.fanOut(databases, (db) => this.sendRawRequest({
362
- type: ep.type,
363
- domain: url,
364
- database: db,
365
- display_date: toApiDate(date),
366
- display_limit: fetchLimit,
367
- export_columns: ep.columns,
368
- ...ep.defaultParams,
369
- }, ep.path), 'getPaidPages');
361
+ const dbResults = await this.fanOut(databases, (db) => {
362
+ const params = {
363
+ type: ep.type,
364
+ domain: url,
365
+ database: db,
366
+ display_limit: fetchLimit,
367
+ export_columns: ep.columns,
368
+ ...ep.defaultParams,
369
+ };
370
+ // Omitting display_date returns the provider's latest snapshot at live pricing
371
+ // (5x cheaper). The returned data may differ slightly from a pinned monthly
372
+ // snapshot, which is acceptable for our use case.
373
+ if (date) {
374
+ params.display_date = toApiDate(date);
375
+ }
376
+ return this.sendRawRequest(params, ep.path);
377
+ }, 'getPaidPages');
370
378
 
371
379
  // Group keywords by URL across all databases
372
380
  const pageMap = new Map();
@@ -425,7 +433,7 @@ export default class SeoClient {
425
433
  if (typeof opts !== 'object' || opts === null) {
426
434
  throw new Error('Second argument must be an options object, not a positional value');
427
435
  }
428
- const { date = lastMonthISO(), region } = opts;
436
+ const { date, region } = opts;
429
437
  if (!hasText(url)) {
430
438
  throw new Error(`Invalid URL: ${url}`);
431
439
  }
@@ -433,14 +441,22 @@ export default class SeoClient {
433
441
  const ep = ENDPOINTS.metrics;
434
442
  const databases = getDatabases(region);
435
443
 
436
- const dbResults = await this.fanOut(databases, (db) => this.sendRawRequest({
437
- type: ep.type,
438
- domain: url,
439
- database: db,
440
- display_date: toApiDate(date),
441
- export_columns: ep.columns,
442
- ...ep.defaultParams,
443
- }, ep.path), 'getMetrics');
444
+ const dbResults = await this.fanOut(databases, (db) => {
445
+ const params = {
446
+ type: ep.type,
447
+ domain: url,
448
+ database: db,
449
+ export_columns: ep.columns,
450
+ ...ep.defaultParams,
451
+ };
452
+ // Omitting display_date returns the provider's latest snapshot at live pricing
453
+ // (5x cheaper). The returned data may differ slightly from a pinned monthly
454
+ // snapshot, which is acceptable for our use case.
455
+ if (date) {
456
+ params.display_date = toApiDate(date);
457
+ }
458
+ return this.sendRawRequest(params, ep.path);
459
+ }, 'getMetrics');
444
460
 
445
461
  const metrics = {
446
462
  org_keywords: 0,
@@ -758,7 +774,7 @@ export default class SeoClient {
758
774
  }
759
775
 
760
776
  // eslint-disable-next-line no-unused-vars, class-methods-use-this
761
- async getMetricsByCountry(url, date = lastMonthISO()) {
777
+ async getMetricsByCountry(url, date) {
762
778
  return STUB_RESPONSE;
763
779
  }
764
780
  }