Skip to content

Commit

Permalink
only one of the category fields should nbe set
Browse files Browse the repository at this point in the history
  • Loading branch information
anonvt committed Jun 26, 2024
1 parent 6b70908 commit b0e41fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,15 @@ Directly from unpkg.com
| width | Number | Banner width |
| height | Number | Banner height |
| id | String | The slot ID for this banner |
| category-id | Optional String | The category ID of the current page |
| category-ids | Optional String | Comma (,) separated list of category IDs, the item must match all |
| category-disjunctions | Optional String | Comma (,) separated list of category IDs, the item must match any |
| category-id* | Optional String | The category ID of the current page |
| category-ids* | Optional String | Comma (,) separated list of category IDs, the item must match all |
| category-disjunctions* | Optional String | Comma (,) separated list of category IDs, the item must match any |
| search-query | Optional String | The search query of the current page |
| location | Optional String | The location for geotargeting |

\* Only one of `[category-id, category-ids, category-disjunctions]` must be set.
If multiple are set, only the first will be considered, in that order.

# Banner Behaviors

| Function Name | Arg type | Return Type | Description |
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@ export class TopsortBanner extends LitElement {
};
} else if (this.categoryIds) {
auction.category = {
ids: this.categoryIds.split(","),
ids: this.categoryIds.split(",").map((item) => item.trim()),
};
} else if (this.categoryDisjunctions) {
auction.category = {
disjunctions: this.categoryDisjunctions.split(","),
disjunctions: this.categoryDisjunctions.split(",").map((item) => item.trim()),
};
} else if (this.searchQuery) {
auction.searchQuery = this.searchQuery;
Expand Down

0 comments on commit b0e41fe

Please sign in to comment.