@xiaohhhh1/canvas-agent 0.4.17 → 0.4.18

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.
@@ -8,6 +8,8 @@ const FASTMOSS_HOME = "https://www.fastmoss.com/";
8
8
  const FASTMOSS_SALES_RANK = "https://www.fastmoss.com/e-commerce/saleslist";
9
9
  const MEMBERSHIP_RECHECK_MS = 5 * 60_000;
10
10
  const PRODUCT_TABLE_TIMEOUT_MS = 45_000;
11
+ const PRODUCT_RANK_PAGE_SIZE = 10;
12
+ const PRODUCT_RANK_MAX_PAGES = 50;
11
13
  export class FastMossIntegration {
12
14
  context = null;
13
15
  page = null;
@@ -171,7 +173,7 @@ export class FastMossIntegration {
171
173
  const collected = new Map();
172
174
  const pages = [];
173
175
  let previousSignature = "";
174
- for (let pageNumber = 1; pageNumber <= 30; pageNumber += 1) {
176
+ for (let pageNumber = 1; pageNumber <= PRODUCT_RANK_MAX_PAGES; pageNumber += 1) {
175
177
  const snapshot = await readVisibleTableSnapshot(this.page);
176
178
  if (!snapshot.tables[0]?.rows.length || snapshot.signature === previousSignature)
177
179
  break;
@@ -279,6 +281,8 @@ export class FastMossIntegration {
279
281
  export function fastMossSalesRankUrl(market) {
280
282
  const url = new URL(FASTMOSS_SALES_RANK);
281
283
  url.searchParams.set("region", normalizeMarket(market));
284
+ url.searchParams.set("page", "1");
285
+ url.searchParams.set("pagesize", String(PRODUCT_RANK_PAGE_SIZE));
282
286
  return url.toString();
283
287
  }
284
288
  function normalizeMarket(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiaohhhh1/canvas-agent",
3
- "version": "0.4.17",
3
+ "version": "0.4.18",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",