@shopfront/bridge 2.0.6 → 2.0.7
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/LISCENCE.md +2 -2
- package/lib/APIs/Database/Database.js +0 -1
- package/lib/Application.js +0 -6
- package/lib/Events/UIPipeline.d.ts +0 -5
- package/lib/Events/UIPipeline.js +0 -5
- package/lib/Mocks/MockApplication.d.ts +1 -1
- package/lib/Mocks/MockApplication.js +1 -1
- package/lib/Utilities/ActionEventRegistrar.d.ts +0 -5
- package/lib/Utilities/ActionEventRegistrar.js +0 -5
- package/lib/Utilities/SaleCreate.d.ts +0 -1
- package/lib/Utilities/SaleCreate.js +0 -2
- package/package.json +30 -7
- package/.github/workflows/npm-publish.yml +0 -40
package/LISCENCE.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
Copyright
|
|
1
|
+
Copyright 2025 Shopfront
|
|
2
2
|
|
|
3
3
|
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
4
4
|
|
|
5
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
5
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -10,7 +10,6 @@ export class Database extends BaseDatabase {
|
|
|
10
10
|
async callMethod(table, method, args) {
|
|
11
11
|
const databaseRequest = `DatabaseRequest-${Math.random()}-${Date.now()}`;
|
|
12
12
|
const promise = new Promise((res, rej) => {
|
|
13
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
14
13
|
const listener = (event, data) => {
|
|
15
14
|
if (event !== "RESPONSE_DATABASE_REQUEST") {
|
|
16
15
|
return;
|
package/lib/Application.js
CHANGED
|
@@ -238,7 +238,6 @@ export class Application extends BaseApplication {
|
|
|
238
238
|
async getCurrentSale() {
|
|
239
239
|
const saleRequest = `SaleRequest-${Date.now().toString()}`;
|
|
240
240
|
const promise = new Promise(res => {
|
|
241
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
242
241
|
const listener = (event, data) => {
|
|
243
242
|
if (event !== "RESPONSE_CURRENT_SALE") {
|
|
244
243
|
return;
|
|
@@ -277,7 +276,6 @@ export class Application extends BaseApplication {
|
|
|
277
276
|
async createSale(sale) {
|
|
278
277
|
const createSaleRequest = `CreateSaleRequest-${Date.now().toString()}`;
|
|
279
278
|
const promise = new Promise(res => {
|
|
280
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
281
279
|
const listener = (event, data) => {
|
|
282
280
|
if (event !== "RESPONSE_CREATE_SALE") {
|
|
283
281
|
return;
|
|
@@ -317,7 +315,6 @@ export class Application extends BaseApplication {
|
|
|
317
315
|
async getLocation() {
|
|
318
316
|
const locationRequest = `LocationRequest-${Date.now().toString()}`;
|
|
319
317
|
const promise = new Promise(res => {
|
|
320
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
321
318
|
const listener = (event, data) => {
|
|
322
319
|
if (event !== "RESPONSE_LOCATION") {
|
|
323
320
|
return;
|
|
@@ -383,7 +380,6 @@ export class Application extends BaseApplication {
|
|
|
383
380
|
sendAudioRequest(type, data) {
|
|
384
381
|
const request = `AudioRequest-${type}-${Date.now().toString()}`;
|
|
385
382
|
const promise = new Promise(res => {
|
|
386
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
387
383
|
const listener = (event, data) => {
|
|
388
384
|
if (event !== "RESPONSE_AUDIO_REQUEST") {
|
|
389
385
|
return;
|
|
@@ -442,7 +438,6 @@ export class Application extends BaseApplication {
|
|
|
442
438
|
async getOption(option, defaultValue) {
|
|
443
439
|
const request = `OptionRequest-${Date.now().toString()}`;
|
|
444
440
|
const promise = new Promise(res => {
|
|
445
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
446
441
|
const listener = (event, data) => {
|
|
447
442
|
if (event !== "RESPONSE_OPTION") {
|
|
448
443
|
return;
|
|
@@ -531,7 +526,6 @@ export class Application extends BaseApplication {
|
|
|
531
526
|
await this.generateSigningKey();
|
|
532
527
|
const request = `TokenRequest-${Date.now().toString()}`;
|
|
533
528
|
const promise = new Promise(res => {
|
|
534
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
535
529
|
const listener = (event, data) => {
|
|
536
530
|
if (event !== "RESPONSE_SECURE_KEY") {
|
|
537
531
|
return;
|
|
@@ -12,15 +12,10 @@ export declare class UIPipeline extends BaseEvent<UIPPipelineIncomingData, Maybe
|
|
|
12
12
|
constructor(callback: FromShopfrontCallbacks["UI_PIPELINE"]);
|
|
13
13
|
/**
|
|
14
14
|
* @inheritDoc
|
|
15
|
-
* @param data
|
|
16
|
-
* @param bridge
|
|
17
15
|
*/
|
|
18
16
|
emit(data: UIPPipelineIncomingData, bridge: Bridge): Promise<FromShopfrontReturns["UI_PIPELINE"]>;
|
|
19
17
|
/**
|
|
20
18
|
* Sends the response data to Shopfront
|
|
21
|
-
* @param bridge
|
|
22
|
-
* @param data
|
|
23
|
-
* @param id
|
|
24
19
|
*/
|
|
25
20
|
static respond(bridge: BaseBridge, data: FromShopfrontReturns["UI_PIPELINE"], id: string): Promise<void>;
|
|
26
21
|
}
|
package/lib/Events/UIPipeline.js
CHANGED
|
@@ -6,8 +6,6 @@ export class UIPipeline extends BaseEvent {
|
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* @inheritDoc
|
|
9
|
-
* @param data
|
|
10
|
-
* @param bridge
|
|
11
9
|
*/
|
|
12
10
|
async emit(data, bridge) {
|
|
13
11
|
const context = {
|
|
@@ -28,9 +26,6 @@ export class UIPipeline extends BaseEvent {
|
|
|
28
26
|
}
|
|
29
27
|
/**
|
|
30
28
|
* Sends the response data to Shopfront
|
|
31
|
-
* @param bridge
|
|
32
|
-
* @param data
|
|
33
|
-
* @param id
|
|
34
29
|
*/
|
|
35
30
|
static async respond(bridge, data, id) {
|
|
36
31
|
bridge.sendMessage(ToShopfront.RESPONSE_UI_PIPELINE, data, id);
|
|
@@ -92,7 +92,7 @@ export declare class MockApplication extends BaseApplication {
|
|
|
92
92
|
/**
|
|
93
93
|
* @inheritDoc
|
|
94
94
|
*/
|
|
95
|
-
protected sendAudioRequest(
|
|
95
|
+
protected sendAudioRequest(_type: SoundEvents, _data?: unknown, options?: AudioRequestOptions): Promise<{
|
|
96
96
|
success: boolean;
|
|
97
97
|
message?: string;
|
|
98
98
|
}>;
|
|
@@ -241,7 +241,7 @@ export class MockApplication extends BaseApplication {
|
|
|
241
241
|
/**
|
|
242
242
|
* @inheritDoc
|
|
243
243
|
*/
|
|
244
|
-
async sendAudioRequest(
|
|
244
|
+
async sendAudioRequest(_type, _data, options) {
|
|
245
245
|
if (options) {
|
|
246
246
|
if (!options.hasPermission) {
|
|
247
247
|
return {
|
|
@@ -4,19 +4,14 @@ declare class ActionEventRegistrar {
|
|
|
4
4
|
constructor();
|
|
5
5
|
/**
|
|
6
6
|
* Registers an event action listener
|
|
7
|
-
* @param id
|
|
8
|
-
* @param action
|
|
9
7
|
*/
|
|
10
8
|
add(id: string, action: BaseAction<undefined>): void;
|
|
11
9
|
/**
|
|
12
10
|
* Removes an event action listener
|
|
13
|
-
* @param id
|
|
14
11
|
*/
|
|
15
12
|
remove(id: string): void;
|
|
16
13
|
/**
|
|
17
14
|
* Invokes the registered action event listener
|
|
18
|
-
* @param id
|
|
19
|
-
* @param data
|
|
20
15
|
*/
|
|
21
16
|
fire(id: string, data: unknown): void;
|
|
22
17
|
/**
|
|
@@ -4,15 +4,12 @@ class ActionEventRegistrar {
|
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
6
|
* Registers an event action listener
|
|
7
|
-
* @param id
|
|
8
|
-
* @param action
|
|
9
7
|
*/
|
|
10
8
|
add(id, action) {
|
|
11
9
|
this.events[id] = action;
|
|
12
10
|
}
|
|
13
11
|
/**
|
|
14
12
|
* Removes an event action listener
|
|
15
|
-
* @param id
|
|
16
13
|
*/
|
|
17
14
|
remove(id) {
|
|
18
15
|
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
@@ -20,8 +17,6 @@ class ActionEventRegistrar {
|
|
|
20
17
|
}
|
|
21
18
|
/**
|
|
22
19
|
* Invokes the registered action event listener
|
|
23
|
-
* @param id
|
|
24
|
-
* @param data
|
|
25
20
|
*/
|
|
26
21
|
fire(id, data) {
|
|
27
22
|
if (typeof this.events[id] === "undefined") {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Builds a Shopfront sale product from the embedded product data
|
|
3
|
-
* @param product
|
|
4
3
|
*/
|
|
5
4
|
function buildSaleProductData(product) {
|
|
6
5
|
const price = product.getPrice();
|
|
@@ -23,7 +22,6 @@ function buildSaleProductData(product) {
|
|
|
23
22
|
}
|
|
24
23
|
/**
|
|
25
24
|
* Builds a Shopfront sale from the embedded sale data
|
|
26
|
-
* @param sale
|
|
27
25
|
*/
|
|
28
26
|
export function buildSaleData(sale) {
|
|
29
27
|
const customer = sale.getCustomer();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopfront/bridge",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"description": "The bridge used to embed your application within Shopfront",
|
|
@@ -19,18 +19,41 @@
|
|
|
19
19
|
"type": "module",
|
|
20
20
|
"private": false,
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@
|
|
22
|
+
"@auto-it/all-contributors": "^11.3.0",
|
|
23
|
+
"@auto-it/jira": "^11.3.0",
|
|
24
|
+
"@onshopfront/core": "^0.1.97",
|
|
25
|
+
"auto": "^11.3.0",
|
|
26
|
+
"husky": "^9.1.7",
|
|
23
27
|
"ts-jest-resolver": "^2.0.1",
|
|
24
|
-
"typescript": "^5.
|
|
25
|
-
"typescript-eslint": "^8.34.0"
|
|
28
|
+
"typescript": "^5.9.3"
|
|
26
29
|
},
|
|
27
30
|
"scripts": {
|
|
28
31
|
"type-check": "tsc --noEmit",
|
|
29
32
|
"type-check:watch": "npm run-script type-check --watch",
|
|
30
33
|
"build": "tsc",
|
|
31
34
|
"watch": "tsc -w",
|
|
32
|
-
"lint": "
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
+
"lint": "npx core lint .",
|
|
36
|
+
"lint:commit:run": "npx core lint-commit",
|
|
37
|
+
"lint:pr:run": "npx core lint-pr --target-branch origin/master",
|
|
38
|
+
"test": "npx @onshopfront/core test"
|
|
39
|
+
},
|
|
40
|
+
"auto": {
|
|
41
|
+
"plugins": [
|
|
42
|
+
"npm",
|
|
43
|
+
"all-contributors",
|
|
44
|
+
[
|
|
45
|
+
"jira",
|
|
46
|
+
"https://onshopfront.atlassian.net"
|
|
47
|
+
],
|
|
48
|
+
"released"
|
|
49
|
+
],
|
|
50
|
+
"author": {
|
|
51
|
+
"name": "Auto Release",
|
|
52
|
+
"email": "nick@shopfront.com.au"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"registry": "https://registry.npmjs.org",
|
|
57
|
+
"access": "public"
|
|
35
58
|
}
|
|
36
59
|
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
name: Pack and Distribute
|
|
2
|
-
on:
|
|
3
|
-
release:
|
|
4
|
-
types: [created]
|
|
5
|
-
jobs:
|
|
6
|
-
build:
|
|
7
|
-
runs-on: ubuntu-latest
|
|
8
|
-
steps:
|
|
9
|
-
- uses: actions/checkout@v4
|
|
10
|
-
- uses: actions/setup-node@v3
|
|
11
|
-
with:
|
|
12
|
-
node-version: '20.x'
|
|
13
|
-
registry-url: 'https://registry.npmjs.org/'
|
|
14
|
-
- run: |
|
|
15
|
-
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
|
|
16
|
-
- run: npm ci
|
|
17
|
-
- run: npm run-script build
|
|
18
|
-
env:
|
|
19
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
20
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
21
|
-
publish-npm:
|
|
22
|
-
needs: build
|
|
23
|
-
runs-on: ubuntu-latest
|
|
24
|
-
permissions:
|
|
25
|
-
contents: read
|
|
26
|
-
id-token: write
|
|
27
|
-
packages: read
|
|
28
|
-
steps:
|
|
29
|
-
- uses: actions/checkout@v4
|
|
30
|
-
- uses: actions/setup-node@v3
|
|
31
|
-
with:
|
|
32
|
-
node-version: '20.x'
|
|
33
|
-
registry-url: 'https://registry.npmjs.org/'
|
|
34
|
-
- run: |
|
|
35
|
-
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
|
|
36
|
-
- run: npm ci
|
|
37
|
-
- run: npm publish --provenance --access public
|
|
38
|
-
env:
|
|
39
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
40
|
-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|