@attlaz/client 1.128.0 → 1.130.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.
- package/dist/MarketPulse/Model/CatalogProductWithMatches.d.ts +3 -1
- package/dist/MarketPulse/Model/CatalogProductWithMatches.js +9 -4
- package/dist/MarketPulse/Model/MarketPositionSummary.d.ts +18 -0
- package/dist/MarketPulse/Model/MarketPositionSummary.js +29 -0
- package/dist/MarketPulse/Model/MatchedVendorProduct.d.ts +4 -0
- package/dist/MarketPulse/Model/MatchedVendorProduct.js +7 -0
- package/dist/MarketPulse/Model/PositionBucket.d.ts +6 -0
- package/dist/MarketPulse/Model/PositionBucket.js +5 -0
- package/dist/MarketPulse/Model/PriceIndexSnapshotEntry.js +1 -1
- package/dist/MarketPulse/Model/PulseCatalogProductFilters.d.ts +3 -0
- package/dist/MarketPulse/Service/PulseCatalogProductEndpoint.js +6 -0
- package/dist/MarketPulse/Service/PulseStatisticsEndpoint.d.ts +3 -0
- package/dist/MarketPulse/Service/PulseStatisticsEndpoint.js +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -25,7 +25,9 @@ export declare class CatalogProductWithMatches {
|
|
|
25
25
|
priceProposal: PriceProposal | null;
|
|
26
26
|
matches: MatchedVendorProduct[];
|
|
27
27
|
constructor(id: string);
|
|
28
|
-
/**
|
|
28
|
+
/** The matches a comparison rests on — every match except the unconfirmed suggestions. */
|
|
29
|
+
get countedMatches(): MatchedVendorProduct[];
|
|
30
|
+
/** Mean price of the counted competitor products; null when none is counted. */
|
|
29
31
|
get matchesAveragePrice(): number | null;
|
|
30
32
|
static parse(raw: ApiRecord): CatalogProductWithMatches;
|
|
31
33
|
}
|
|
@@ -20,13 +20,18 @@ export class CatalogProductWithMatches {
|
|
|
20
20
|
constructor(id) {
|
|
21
21
|
this.id = id;
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
23
|
+
/** The matches a comparison rests on — every match except the unconfirmed suggestions. */
|
|
24
|
+
get countedMatches() {
|
|
25
|
+
return this.matches.filter((match) => !match.isUnconfirmed);
|
|
26
|
+
}
|
|
27
|
+
/** Mean price of the counted competitor products; null when none is counted. */
|
|
24
28
|
get matchesAveragePrice() {
|
|
25
|
-
|
|
29
|
+
const counted = this.countedMatches;
|
|
30
|
+
if (counted.length === 0) {
|
|
26
31
|
return null;
|
|
27
32
|
}
|
|
28
|
-
const total =
|
|
29
|
-
return total /
|
|
33
|
+
const total = counted.reduce((sum, match) => sum + match.price, 0);
|
|
34
|
+
return total / counted.length;
|
|
30
35
|
}
|
|
31
36
|
static parse(raw) {
|
|
32
37
|
const product = new CatalogProductWithMatches(raw.id);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ApiRecord } from '../../Model/ApiRecord.js';
|
|
2
|
+
import { PositionBucket } from './PositionBucket.js';
|
|
3
|
+
/**
|
|
4
|
+
* The catalog against the market — `/pulse/catalogs/:catalogId/market-positions/summary`: how many
|
|
5
|
+
* products can be compared at all, where the compared ones stand, and how old the competitor prices
|
|
6
|
+
* behind it are.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MarketPositionSummary {
|
|
9
|
+
productCount: number;
|
|
10
|
+
/** Products with at least one counted competitor in the latest recompute. */
|
|
11
|
+
comparedCount: number;
|
|
12
|
+
bucketCounts: Record<PositionBucket, number>;
|
|
13
|
+
computedAt: Date | null;
|
|
14
|
+
/** When the counted competitor products were last seen by a crawl: the age of the prices compared. */
|
|
15
|
+
pricesSeenFrom: Date | null;
|
|
16
|
+
pricesSeenTo: Date | null;
|
|
17
|
+
static parse(raw: ApiRecord): MarketPositionSummary;
|
|
18
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { POSITION_BUCKETS } from './PositionBucket.js';
|
|
2
|
+
/**
|
|
3
|
+
* The catalog against the market — `/pulse/catalogs/:catalogId/market-positions/summary`: how many
|
|
4
|
+
* products can be compared at all, where the compared ones stand, and how old the competitor prices
|
|
5
|
+
* behind it are.
|
|
6
|
+
*/
|
|
7
|
+
export class MarketPositionSummary {
|
|
8
|
+
productCount = 0;
|
|
9
|
+
/** Products with at least one counted competitor in the latest recompute. */
|
|
10
|
+
comparedCount = 0;
|
|
11
|
+
bucketCounts = { very_sharp: 0, sharp: 0, market_rate: 0, expensive: 0, much_more_expensive: 0 };
|
|
12
|
+
computedAt = null;
|
|
13
|
+
/** When the counted competitor products were last seen by a crawl: the age of the prices compared. */
|
|
14
|
+
pricesSeenFrom = null;
|
|
15
|
+
pricesSeenTo = null;
|
|
16
|
+
static parse(raw) {
|
|
17
|
+
const summary = new MarketPositionSummary();
|
|
18
|
+
summary.productCount = Number(raw.product_count ?? 0);
|
|
19
|
+
summary.comparedCount = Number(raw.compared_count ?? 0);
|
|
20
|
+
const buckets = raw.bucket_counts ?? {};
|
|
21
|
+
for (const bucket of POSITION_BUCKETS) {
|
|
22
|
+
summary.bucketCounts[bucket] = Number(buckets[bucket] ?? 0);
|
|
23
|
+
}
|
|
24
|
+
summary.computedAt = raw.computed_at ? new Date(raw.computed_at) : null;
|
|
25
|
+
summary.pricesSeenFrom = raw.prices_seen_from ? new Date(raw.prices_seen_from) : null;
|
|
26
|
+
summary.pricesSeenTo = raw.prices_seen_to ? new Date(raw.prices_seen_to) : null;
|
|
27
|
+
return summary;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -14,6 +14,8 @@ export declare class MatchedVendorProduct {
|
|
|
14
14
|
/** Id of the match record joining it to your product; null for an unreviewed direct hit. */
|
|
15
15
|
matchId: string | null;
|
|
16
16
|
matchJobId: string | null;
|
|
17
|
+
/** `accepted` counts in every comparison; `pending` is an unconfirmed suggestion. Null from an API that does not send it. */
|
|
18
|
+
matchStatus: string | null;
|
|
17
19
|
vendor: Vendor | null;
|
|
18
20
|
name: string;
|
|
19
21
|
image: string | null;
|
|
@@ -31,5 +33,7 @@ export declare class MatchedVendorProduct {
|
|
|
31
33
|
properties: Record<string, unknown> | null;
|
|
32
34
|
updatedAt: Date | null;
|
|
33
35
|
constructor(id: string);
|
|
36
|
+
/** A suggestion nobody has confirmed: shown on request, never part of a comparison. */
|
|
37
|
+
get isUnconfirmed(): boolean;
|
|
34
38
|
static parse(raw: ApiRecord): MatchedVendorProduct;
|
|
35
39
|
}
|
|
@@ -13,6 +13,8 @@ export class MatchedVendorProduct {
|
|
|
13
13
|
/** Id of the match record joining it to your product; null for an unreviewed direct hit. */
|
|
14
14
|
matchId = null;
|
|
15
15
|
matchJobId = null;
|
|
16
|
+
/** `accepted` counts in every comparison; `pending` is an unconfirmed suggestion. Null from an API that does not send it. */
|
|
17
|
+
matchStatus = null;
|
|
16
18
|
vendor = null;
|
|
17
19
|
name = '';
|
|
18
20
|
image = null;
|
|
@@ -32,10 +34,15 @@ export class MatchedVendorProduct {
|
|
|
32
34
|
constructor(id) {
|
|
33
35
|
this.id = id;
|
|
34
36
|
}
|
|
37
|
+
/** A suggestion nobody has confirmed: shown on request, never part of a comparison. */
|
|
38
|
+
get isUnconfirmed() {
|
|
39
|
+
return this.matchStatus === 'pending';
|
|
40
|
+
}
|
|
35
41
|
static parse(raw) {
|
|
36
42
|
const product = new MatchedVendorProduct(raw.id);
|
|
37
43
|
product.matchId = raw.match ?? null;
|
|
38
44
|
product.matchJobId = raw.match_job ?? null;
|
|
45
|
+
product.matchStatus = raw.match_status ?? null;
|
|
39
46
|
const vendor = raw.vendor;
|
|
40
47
|
if (vendor !== null && typeof vendor === 'object') {
|
|
41
48
|
product.vendor = Vendor.parse(vendor);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A product's market position against the median price of its counted competitors, cheapest to most
|
|
3
|
+
* expensive. Mirrors apps-lib's `POSITION_BUCKETS`; the thresholds live server-side.
|
|
4
|
+
*/
|
|
5
|
+
export declare const POSITION_BUCKETS: readonly ['very_sharp', 'sharp', 'market_rate', 'expensive', 'much_more_expensive'];
|
|
6
|
+
export type PositionBucket = typeof POSITION_BUCKETS[number];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A product's market position against the median price of its counted competitors, cheapest to most
|
|
3
|
+
* expensive. Mirrors apps-lib's `POSITION_BUCKETS`; the thresholds live server-side.
|
|
4
|
+
*/
|
|
5
|
+
export const POSITION_BUCKETS = ['very_sharp', 'sharp', 'market_rate', 'expensive', 'much_more_expensive'];
|
|
@@ -15,7 +15,7 @@ export class PriceIndexSnapshotEntry {
|
|
|
15
15
|
this.competitorId = competitorId;
|
|
16
16
|
}
|
|
17
17
|
static parse(raw) {
|
|
18
|
-
const entry = new PriceIndexSnapshotEntry(raw.date, raw.
|
|
18
|
+
const entry = new PriceIndexSnapshotEntry(raw.date, raw.competitor);
|
|
19
19
|
entry.priceIndex = Number(raw.price_index ?? 0);
|
|
20
20
|
entry.matchCount = Number(raw.match_count ?? 0);
|
|
21
21
|
return entry;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PositionBucket } from './PositionBucket.js';
|
|
1
2
|
/** Simple narrowing of the product list; `tags` filters on materialised tag values. */
|
|
2
3
|
export type PulseCatalogProductFilters = {
|
|
3
4
|
brand?: string;
|
|
@@ -5,4 +6,6 @@ export type PulseCatalogProductFilters = {
|
|
|
5
6
|
search?: string;
|
|
6
7
|
productGroup?: string;
|
|
7
8
|
tags?: Record<string, string>;
|
|
9
|
+
positionBucket?: PositionBucket;
|
|
10
|
+
includePending?: boolean;
|
|
8
11
|
};
|
|
@@ -33,6 +33,12 @@ export class PulseCatalogProductEndpoint extends Endpoint {
|
|
|
33
33
|
queryString.set('tag[' + key + ']', value);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
if (filters.positionBucket) {
|
|
37
|
+
queryString.set('position_bucket', filters.positionBucket);
|
|
38
|
+
}
|
|
39
|
+
if (filters.includePending) {
|
|
40
|
+
queryString.set('include_pending', 'true');
|
|
41
|
+
}
|
|
36
42
|
if (filter !== null) {
|
|
37
43
|
queryString.set('filter', JSON.stringify(filter));
|
|
38
44
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CatalogId } from '../../Catalog/Model/CatalogId.js';
|
|
2
2
|
import { CollectionResult } from '../../Model/Result/CollectionResult.js';
|
|
3
3
|
import { Endpoint } from '../../Service/Endpoint.js';
|
|
4
|
+
import { MarketPositionSummary } from '../Model/MarketPositionSummary.js';
|
|
4
5
|
import { MarketSummaryEntry } from '../Model/MarketSummaryEntry.js';
|
|
5
6
|
import { PriceIndexSnapshotEntry } from '../Model/PriceIndexSnapshotEntry.js';
|
|
6
7
|
import { ProductSegmentType } from '../Model/ProductSegmentType.js';
|
|
@@ -11,6 +12,8 @@ import { TopCompetitor } from '../Model/TopCompetitor.js';
|
|
|
11
12
|
* These are precomputed server-side; `CatalogProductEndpoint.recomputeStatistics` refreshes them.
|
|
12
13
|
*/
|
|
13
14
|
export declare class PulseStatisticsEndpoint extends Endpoint {
|
|
15
|
+
/** The catalog against the market: coverage, where the compared products stand, and the price date. */
|
|
16
|
+
getMarketPositionSummary(catalogId: CatalogId | string): Promise<MarketPositionSummary>;
|
|
14
17
|
/** Headline figures (products tracked, matches, competitors …) against the previous period. */
|
|
15
18
|
getAccountSummary(catalogId: CatalogId | string): Promise<CollectionResult<MarketSummaryEntry>>;
|
|
16
19
|
/** Distribution of the catalog's products across price or profit segments. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { path } from '../../Http/Data/Path.js';
|
|
2
2
|
import { QueryString } from '../../Http/Data/QueryString.js';
|
|
3
3
|
import { Endpoint } from '../../Service/Endpoint.js';
|
|
4
|
+
import { MarketPositionSummary } from '../Model/MarketPositionSummary.js';
|
|
4
5
|
import { PriceIndexSnapshotEntry } from '../Model/PriceIndexSnapshotEntry.js';
|
|
5
6
|
import { TopCompetitor } from '../Model/TopCompetitor.js';
|
|
6
7
|
/**
|
|
@@ -8,6 +9,11 @@ import { TopCompetitor } from '../Model/TopCompetitor.js';
|
|
|
8
9
|
* These are precomputed server-side; `CatalogProductEndpoint.recomputeStatistics` refreshes them.
|
|
9
10
|
*/
|
|
10
11
|
export class PulseStatisticsEndpoint extends Endpoint {
|
|
12
|
+
/** The catalog against the market: coverage, where the compared products stand, and the price date. */
|
|
13
|
+
async getMarketPositionSummary(catalogId) {
|
|
14
|
+
const result = await this.requestObject(path('/pulse/catalogs/:catalogId/market-positions/summary', { catalogId: catalogId.toString() }), null, MarketPositionSummary.parse, 'GET');
|
|
15
|
+
return result.getData() ?? new MarketPositionSummary();
|
|
16
|
+
}
|
|
11
17
|
/** Headline figures (products tracked, matches, competitors …) against the previous period. */
|
|
12
18
|
async getAccountSummary(catalogId) {
|
|
13
19
|
return await this.requestCollection(path('/pulse/catalogs/:catalogId/statistics/account-summary', { catalogId: catalogId.toString() }), (raw) => ({
|
package/dist/index.d.ts
CHANGED
|
@@ -116,6 +116,8 @@ export { ReviewMatchFilters } from './MarketPulse/Model/ReviewMatchFilters.js';
|
|
|
116
116
|
export { ProductMatchEndpoint } from './MarketPulse/Service/ProductMatchEndpoint.js';
|
|
117
117
|
export { PulseCatalogProductFilterOptions } from './MarketPulse/Model/PulseCatalogProductFilterOptions.js';
|
|
118
118
|
export { PulseCatalogProductFilters } from './MarketPulse/Model/PulseCatalogProductFilters.js';
|
|
119
|
+
export { POSITION_BUCKETS, PositionBucket } from './MarketPulse/Model/PositionBucket.js';
|
|
120
|
+
export { MarketPositionSummary } from './MarketPulse/Model/MarketPositionSummary.js';
|
|
119
121
|
export { PulseCatalogProductEndpoint } from './MarketPulse/Service/PulseCatalogProductEndpoint.js';
|
|
120
122
|
export { PriceAlertConfig } from './MarketPulse/Model/PriceAlertConfig.js';
|
|
121
123
|
export { PriceAlertEvent } from './MarketPulse/Model/PriceAlertEvent.js';
|
package/dist/index.js
CHANGED
|
@@ -94,6 +94,8 @@ export { ReviewMatch } from './MarketPulse/Model/ReviewMatch.js';
|
|
|
94
94
|
export { TopCompetitor } from './MarketPulse/Model/TopCompetitor.js';
|
|
95
95
|
export { PriceIndexSnapshotEntry } from './MarketPulse/Model/PriceIndexSnapshotEntry.js';
|
|
96
96
|
export { ProductMatchEndpoint } from './MarketPulse/Service/ProductMatchEndpoint.js';
|
|
97
|
+
export { POSITION_BUCKETS } from './MarketPulse/Model/PositionBucket.js';
|
|
98
|
+
export { MarketPositionSummary } from './MarketPulse/Model/MarketPositionSummary.js';
|
|
97
99
|
export { PulseCatalogProductEndpoint } from './MarketPulse/Service/PulseCatalogProductEndpoint.js';
|
|
98
100
|
export { PriceAlertConfig } from './MarketPulse/Model/PriceAlertConfig.js';
|
|
99
101
|
export { PriceAlertEvent } from './MarketPulse/Model/PriceAlertEvent.js';
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.129.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "1.
|
|
1
|
+
export const VERSION = "1.129.0";
|