@internetarchive/ia-book-actions 1.4.1-alpha2 → 1.4.2
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/.claude/settings.local.json +16 -0
- package/.github/workflows/ci.yml +8 -7
- package/.github/workflows/pr-preview.yml +28 -5
- package/README.md +11 -2
- package/index.html +3 -3
- package/package.json +15 -11
- package/src/ia-book-actions.js +8 -6
- package/web-test-runner.config.mjs +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(yarn outdated *)",
|
|
5
|
+
"Bash(gh pr *)",
|
|
6
|
+
"Bash(git log *)",
|
|
7
|
+
"mcp__plugin_atlassian_atlassian__getAccessibleAtlassianResources",
|
|
8
|
+
"Bash(npm view *)",
|
|
9
|
+
"mcp__plugin_atlassian_atlassian__searchJiraIssuesUsingJql",
|
|
10
|
+
"Bash(xargs -I {} basename {})",
|
|
11
|
+
"Bash(npm info *)",
|
|
12
|
+
"mcp__plugin_atlassian_atlassian__getJiraIssue",
|
|
13
|
+
"mcp__plugin_atlassian_atlassian__getJiraProjectIssueTypesMetadata"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
}
|
package/.github/workflows/ci.yml
CHANGED
|
@@ -11,16 +11,17 @@ jobs:
|
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
|
|
13
13
|
steps:
|
|
14
|
-
- uses: actions/checkout@v4
|
|
15
|
-
- uses: actions/setup-node@
|
|
14
|
+
- uses: actions/checkout@v4.1.1
|
|
15
|
+
- uses: actions/setup-node@v4.0.2
|
|
16
16
|
with:
|
|
17
|
-
node-version:
|
|
17
|
+
node-version: 20.x
|
|
18
18
|
|
|
19
19
|
- name: Install dependencies
|
|
20
20
|
run: yarn install
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
- name: Run tests
|
|
23
|
+
run: yarn run test
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
- uses: codecov/codecov-action@v5
|
|
26
|
+
with:
|
|
27
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -14,24 +14,47 @@ on:
|
|
|
14
14
|
|
|
15
15
|
concurrency: preview-${{ github.ref }}
|
|
16
16
|
|
|
17
|
+
env:
|
|
18
|
+
PREVIEW_BRANCH: gh-pages
|
|
17
19
|
jobs:
|
|
18
20
|
deploy-preview:
|
|
19
|
-
runs-on: ubuntu-
|
|
21
|
+
runs-on: ubuntu-latest
|
|
20
22
|
steps:
|
|
21
23
|
- name: Checkout
|
|
22
24
|
uses: actions/checkout@v4
|
|
23
|
-
|
|
24
|
-
- uses: actions/setup-node@v3
|
|
25
|
-
with:
|
|
26
|
-
node-version: 20.x
|
|
25
|
+
- uses: actions/setup-node@v4
|
|
27
26
|
|
|
28
27
|
- name: Install and Build
|
|
29
28
|
run: |
|
|
30
29
|
yarn install
|
|
31
30
|
yarn prepare:ghpages
|
|
31
|
+
|
|
32
32
|
# Reference: https://github.com/rossjrw/pr-preview-action
|
|
33
33
|
- name: Deploy preview
|
|
34
34
|
uses: rossjrw/pr-preview-action@v1
|
|
35
|
+
id: preview-step
|
|
35
36
|
with:
|
|
36
37
|
source-dir: ./ghpages/
|
|
37
38
|
umbrella-dir: pr
|
|
39
|
+
preview-branch: ${{ env.PREVIEW_BRANCH }}
|
|
40
|
+
comment: false
|
|
41
|
+
|
|
42
|
+
- uses: marocchino/sticky-pull-request-comment@v2
|
|
43
|
+
if: steps.preview-step.outputs.deployment-action == 'deploy'
|
|
44
|
+
with:
|
|
45
|
+
header: pr-preview
|
|
46
|
+
message: |
|
|
47
|
+
[PR Preview Action](https://github.com/rossjrw/pr-preview-action) ${{ steps.preview-step.outputs.action-version }}
|
|
48
|
+
:---:
|
|
49
|
+
| <p></p> :rocket: View preview at <br> ${{ steps.preview-step.outputs.preview-url }} <br><br>
|
|
50
|
+
| <h6>Built to branch [`${{ env.PREVIEW_BRANCH }}`](${{ github.server_url }}/${{ github.repository }}/tree/${{ env.PREVIEW_BRANCH }}) at ${{ steps.preview-step.outputs.action-start-time }}. <br> Preview will be ready when the [GitHub Pages deployment](${{ github.server_url }}/${{ github.repository }}/deployments) is complete. <br><br> </h6>
|
|
51
|
+
|
|
52
|
+
- uses: marocchino/sticky-pull-request-comment@v2
|
|
53
|
+
if: steps.preview-step.outputs.deployment-action == 'remove'
|
|
54
|
+
with:
|
|
55
|
+
header: pr-preview
|
|
56
|
+
message: |
|
|
57
|
+
[PR Preview Action](https://github.com/rossjrw/pr-preview-action) ${{ steps.preview-step.outputs.action-version }}
|
|
58
|
+
:---:
|
|
59
|
+
Preview removed because the pull request was closed.
|
|
60
|
+
${{ steps.preview-step.outputs.action-start-time }}
|
package/README.md
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
# Component for lendable and embed items
|
|
2
1
|
|
|
3
|
-
|
|
2
|
+
 [](https://codecov.io/gh/internetarchive/iaux-book-actions)
|
|
3
|
+
|
|
4
|
+
# Internet Archive Book Lending Actions
|
|
5
|
+
|
|
6
|
+
This WebComponent, built using the [IA Typescript WebComponent Template](https://github.com/internetarchive/iaux-typescript-wc-template), provides support for Bookreader actions for borrowable books on Internet Archive. It extends the [Open WebComponents generator](https://open-wc.org/docs/development/generator/) with Internet Archive-specific features and developer tools.
|
|
4
7
|
|
|
5
8
|
## Installation
|
|
6
9
|
```bash
|
|
7
10
|
yarn install --save @internetarchive/ia-book-actions
|
|
8
11
|
```
|
|
9
12
|
|
|
13
|
+
## Local Demo with `web-dev-server`
|
|
14
|
+
```bash
|
|
15
|
+
yarn start
|
|
16
|
+
```
|
|
17
|
+
To run a local development server that serves the basic demo located in `index.html`
|
|
18
|
+
|
|
10
19
|
## Usage of Book Actions
|
|
11
20
|
```html
|
|
12
21
|
<!-- index.html -->
|
package/index.html
CHANGED
|
@@ -134,12 +134,12 @@
|
|
|
134
134
|
iaBookActions.bwbPurchaseUrl = '';
|
|
135
135
|
iaBookActions.modalConfig = modalConfig;
|
|
136
136
|
iaBookActions.lendingBarPostInit = lendingBarPostInit;
|
|
137
|
-
iaBookActions.tokenDelay =
|
|
138
|
-
iaBookActions.timerExecutionSeconds =
|
|
137
|
+
iaBookActions.tokenDelay = 10; // seconds
|
|
138
|
+
iaBookActions.timerExecutionSeconds = 3 // seconds
|
|
139
139
|
iaBookActions.returnUrl = '';
|
|
140
140
|
iaBookActions.localCache = localCache;
|
|
141
141
|
|
|
142
|
-
let loanTotalTime2Min = { loanTotalTime:
|
|
142
|
+
let loanTotalTime2Min = { loanTotalTime: 120, loanRenewAtLast: 110, pageChangedInLast: 30 };
|
|
143
143
|
let loanTotalTime5Min = { loanTotalTime: 300, loanRenewAtLast: 240, pageChangedInLast: 60 };
|
|
144
144
|
let loanTotalTime10Min = { loanTotalTime: 600, loanRenewAtLast: 480, pageChangedInLast: 120 };
|
|
145
145
|
let loanTotalTime30Min = { loanTotalTime: 1800, loanRenewAtLast: 1500, pageChangedInLast: 600 };
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@internetarchive/ia-book-actions",
|
|
3
|
-
"version": "1.4.1-alpha2",
|
|
4
3
|
"description": "Bookreader actions for borrowable book",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/internetarchive/iaux-account-settings.git"
|
|
7
|
+
},
|
|
5
8
|
"author": "Internet Archive",
|
|
6
9
|
"license": "AGPL-3.0-only",
|
|
10
|
+
"version": "1.4.2",
|
|
7
11
|
"main": "index.js",
|
|
8
12
|
"module": "index.js",
|
|
9
13
|
"publishConfig": {
|
|
@@ -15,28 +19,28 @@
|
|
|
15
19
|
"prepare": "rimraf dist && husky install",
|
|
16
20
|
"lint": "eslint --ext \"./src/*.js\",.html . --ignore-path .gitignore && prettier \"./src/*.js\" --check --ignore-path .gitignore",
|
|
17
21
|
"format": "eslint --ext \"./src/*.js\",.html . --fix --ignore-path .gitignore && prettier \"./src/*.js\" --write --ignore-path .gitignore",
|
|
18
|
-
"test": "yarn run lint && yarn test:fast",
|
|
19
|
-
"test:fast": "web-test-runner
|
|
22
|
+
"test": "yarn run format && yarn run lint && yarn test:fast --coverage",
|
|
23
|
+
"test:fast": "web-test-runner",
|
|
20
24
|
"test:watch": "web-test-runner --watch --playwright --browsers chromium firefox webkit",
|
|
21
25
|
"deploy": "yarn run deploy:run -e $(git branch --show-current)",
|
|
22
26
|
"deploy:run": "yarn run prepare:ghpages && touch ghpages/.nojekyll && yarn run deploy:gh",
|
|
23
27
|
"deploy:gh": "gh-pages -t -d ghpages -m \"Build for $(git log --pretty=format:\"%h %an %ai %s\" -n1) [skip ci]\""
|
|
24
28
|
},
|
|
25
29
|
"dependencies": {
|
|
26
|
-
"@internetarchive/icon-info": "1.
|
|
30
|
+
"@internetarchive/icon-info": "^1.4.1",
|
|
27
31
|
"@internetarchive/local-cache": "^0.2.1",
|
|
28
|
-
"@internetarchive/modal-manager": "2.0.0",
|
|
32
|
+
"@internetarchive/modal-manager": "^2.0.0",
|
|
29
33
|
"@internetarchive/shared-resize-observer": "^0.2.0",
|
|
30
34
|
"install-deps": "^1.1.0",
|
|
31
|
-
"lit": "^2.8.0"
|
|
35
|
+
"lit": "^2.8.0 || ^3.3.2"
|
|
32
36
|
},
|
|
33
37
|
"devDependencies": {
|
|
34
38
|
"@open-wc/eslint-config": "^4.2.0",
|
|
35
|
-
"@open-wc/testing": "^
|
|
36
|
-
"@web/dev-server": "^0.
|
|
37
|
-
"@web/dev-server-esbuild": "^0.
|
|
38
|
-
"@web/test-runner": "^0.
|
|
39
|
-
"@web/test-runner-playwright": "^0.
|
|
39
|
+
"@open-wc/testing": "^4.0.0",
|
|
40
|
+
"@web/dev-server": "^0.4.6",
|
|
41
|
+
"@web/dev-server-esbuild": "^1.0.5",
|
|
42
|
+
"@web/test-runner": "^0.20.2",
|
|
43
|
+
"@web/test-runner-playwright": "^0.11.1",
|
|
40
44
|
"eslint": "^7.32.0",
|
|
41
45
|
"eslint-config-prettier": "^6.11.0",
|
|
42
46
|
"eslint-plugin-import": "^2.22.1",
|
package/src/ia-book-actions.js
CHANGED
|
@@ -120,7 +120,12 @@ export default class IABookActions extends LitElement {
|
|
|
120
120
|
* @property {boolean} renewNow - key to determine if need to renew now
|
|
121
121
|
* @property {number} secondsLeft - seconds left in active loan
|
|
122
122
|
*/
|
|
123
|
-
this.loanRenewResult = {
|
|
123
|
+
this.loanRenewResult = {
|
|
124
|
+
texts: '',
|
|
125
|
+
renewNow: false,
|
|
126
|
+
secondsLeft: 0,
|
|
127
|
+
renewType: '',
|
|
128
|
+
};
|
|
124
129
|
}
|
|
125
130
|
|
|
126
131
|
disconnectedCallback() {
|
|
@@ -535,11 +540,8 @@ export default class IABookActions extends LitElement {
|
|
|
535
540
|
async startBrowseTimer() {
|
|
536
541
|
window?.IALendingIntervals?.clearBrowseExpireTimeout();
|
|
537
542
|
|
|
538
|
-
const {
|
|
539
|
-
|
|
540
|
-
user_has_browsed,
|
|
541
|
-
secondsLeftOnLoan,
|
|
542
|
-
} = this.lendingStatus;
|
|
543
|
+
const { browsingExpired, user_has_browsed, secondsLeftOnLoan } =
|
|
544
|
+
this.lendingStatus;
|
|
543
545
|
|
|
544
546
|
if (!user_has_browsed || browsingExpired) {
|
|
545
547
|
log('startBrowseTimer --- !user_has_browsed || browsingExpired', {
|