Skip to content

Commit ec30a93

Browse files
committed
fix: small fixes from PR review and feedback
- revert small change to ping-protect package.json - fix e2e tests - conditionally add "agent" properties on callback only when present
1 parent 0642258 commit ec30a93

File tree

9 files changed

+107
-42
lines changed

9 files changed

+107
-42
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@forgerock/javascript-sdk': patch
3+
'@forgerock/ping-protect': patch
4+
---
5+
6+
This aligns ping-protect and protect initialize callbacks to the new Journey Nodes

e2e/autoscript-suites/playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as os from 'os';
2-
import { PlaywrightTestConfig } from '@playwright/test';
2+
import type { PlaywrightTestConfig } from '@playwright/test';
33
import { nxE2EPreset } from '@nx/playwright/preset';
44
import { workspaceRoot } from '@nx/devkit';
55
import { fileURLToPath } from 'url';

e2e/autoscript-suites/src/suites/authn-protect.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ test.describe('Test basic login flow with Ping Protect', () => {
3535
expect(configObj.disableTags).toBe(false);
3636
expect(configObj.disableHub).toBe(false);
3737

38-
expect(messageArray.includes('[SignalsSDK] Starting Signals SDK...')).toBe(true);
39-
expect(messageArray.includes('[SignalsSDK] calculated device attributes.')).toBe(true);
4038
expect(messageArray.includes('getPauseBehavioralData: true')).toBe(true);
4139
expect(messageArray.includes('Basic login with Protect successful')).toBe(true);
4240
expect(messageArray.includes('Test script complete')).toBe(true);
@@ -46,8 +44,7 @@ test.describe('Test basic login flow with Ping Protect', () => {
4644
const { messageArray } = await setupAndGo(page, browserName, 'authn-protect/', {
4745
pauseBehaviorData: 'false',
4846
});
49-
expect(messageArray.includes('[SignalsSDK] Starting Signals SDK...')).toBe(true);
50-
expect(messageArray.includes('[SignalsSDK] calculated device attributes.')).toBe(true);
47+
5148
expect(messageArray.includes('getPauseBehavioralData: false')).toBe(true);
5249
expect(messageArray.includes('Basic login with Protect successful')).toBe(true);
5350
});

e2e/token-vault-suites/playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PlaywrightTestConfig } from '@playwright/test';
1+
import type { PlaywrightTestConfig } from '@playwright/test';
22
import { nxE2EPreset } from '@nx/playwright/preset';
33
import { workspaceRoot } from '@nx/devkit';
44
import { fileURLToPath } from 'url';

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"@nx/vite": "20.3.3",
5757
"@nx/web": "20.3.3",
5858
"@nx/workspace": "20.3.3",
59-
"@playwright/test": "^1.47.2",
59+
"@playwright/test": "1.47.2",
6060
"@swc-node/register": "1.9.2",
6161
"@swc/core": "1.5.7",
6262
"@swc/helpers": "0.5.12",
@@ -94,7 +94,7 @@
9494
"npm-cli-login": "^1.0.0",
9595
"nx": "20.3.3",
9696
"pkg-pr-new": "^0.0.60",
97-
"playwright": "^1.47.2",
97+
"playwright": "1.47.2",
9898
"prettier": "^3.2.5",
9999
"pretty-quick": "^4.0.0",
100100
"sass": "^1.71.1",

packages/javascript-sdk/src/fr-auth/callbacks/ping-protect-initialize-callback.test.ts

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,85 @@ describe('PingOneProtectInitializeCallback', () => {
1616
it('should exist', () => {
1717
expect(PingOneProtectInitializeCallback).toBeDefined();
1818
});
19-
it('should test the getConfig method', () => {
19+
20+
it('should test the getConfig method with no "agent" parameters', () => {
21+
const callback = new PingOneProtectInitializeCallback({
22+
type: 'PingOneProtectInitializeCallback' as CallbackType,
23+
input: [
24+
{
25+
name: 'IDToken1signals',
26+
value: '',
27+
},
28+
{
29+
name: 'IDToken1clientError',
30+
value: '',
31+
},
32+
],
33+
output: [
34+
{
35+
name: 'envId',
36+
value: '02fb4743-189a-4bc7-9d6c-a919edfe6447',
37+
},
38+
{
39+
name: 'consoleLogEnabled',
40+
value: false,
41+
},
42+
{
43+
name: 'deviceAttributesToIgnore',
44+
value: [],
45+
},
46+
{
47+
name: 'customHost',
48+
value: '',
49+
},
50+
{
51+
name: 'lazyMetadata',
52+
value: false,
53+
},
54+
{
55+
name: 'behavioralDataCollection',
56+
value: true,
57+
},
58+
{
59+
name: 'deviceKeyRsyncIntervals',
60+
value: 14,
61+
},
62+
{
63+
name: 'enableTrust',
64+
value: false,
65+
},
66+
{
67+
name: 'disableTags',
68+
value: false,
69+
},
70+
{
71+
name: 'disableHub',
72+
value: false,
73+
},
74+
{
75+
name: 'universalDeviceIdentification',
76+
value: false,
77+
},
78+
],
79+
});
80+
const mock = vi.spyOn(callback, 'getConfig');
81+
const config = callback.getConfig();
82+
expect(mock).toHaveBeenCalled();
83+
expect(config).toMatchObject({
84+
envId: '02fb4743-189a-4bc7-9d6c-a919edfe6447',
85+
consoleLogEnabled: false,
86+
deviceAttributesToIgnore: [],
87+
customHost: '',
88+
lazyMetadata: false,
89+
behavioralDataCollection: true,
90+
deviceKeyRsyncIntervals: 14,
91+
enableTrust: false,
92+
disableTags: false,
93+
disableHub: false,
94+
});
95+
});
96+
97+
it('should test the getConfig method with "agent" parameters', () => {
2098
const callback = new PingOneProtectInitializeCallback({
2199
type: 'PingOneProtectInitializeCallback' as CallbackType,
22100
input: [
@@ -107,6 +185,7 @@ describe('PingOneProtectInitializeCallback', () => {
107185
disableHub: false,
108186
});
109187
});
188+
110189
it('should test the setClientError method', () => {
111190
const callback = new PingOneProtectInitializeCallback({
112191
type: 'PingOneProtectInitializeCallback' as CallbackType,

packages/javascript-sdk/src/fr-auth/callbacks/ping-protect-initialize-callback.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,21 @@ class PingOneProtectInitializeCallback extends FRCallback {
2626
* Get callback's initialization config settings
2727
*/
2828
public getConfig() {
29+
const agentIdentification = this.getOutputByName<boolean | undefined>(
30+
'agentIdentification',
31+
undefined,
32+
);
33+
const agentTimeout = this.getOutputByName<number | undefined>('agentTimeout', undefined);
34+
const agentPort = this.getOutputByName<number | undefined>('agentPort', undefined);
35+
2936
const config = {
3037
// Required parameter
3138
envId: this.getOutputByName<string>('envId', ''),
3239

3340
// Optional parameters
34-
agentIdentification: this.getOutputByName<boolean>('agentIdentification', false),
35-
agentTimeout: this.getOutputByName<number>('agentTimeout', 0),
36-
agentPort: this.getOutputByName<number>('agentPort', 0),
41+
...(agentIdentification !== undefined ? { agentIdentification } : {}),
42+
...(agentTimeout !== undefined ? { agentTimeout } : {}),
43+
...(agentPort !== undefined ? { agentPort } : {}),
3744
behavioralDataCollection: this.getOutputByName<boolean>('behavioralDataCollection', true),
3845
disableTags: this.getOutputByName<boolean>('disableTags', false),
3946
universalDeviceIdentification: this.getOutputByName<boolean>(

packages/ping-protect/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@forgerock/ping-protect",
3-
"version": "4.6.0-beta.1",
3+
"version": "4.6.0",
44
"private": false,
55
"type": "module",
66
"files": ["./dist/*"],
@@ -20,6 +20,6 @@
2020
},
2121
"types": "./dist/index.ts.d.ts",
2222
"dependencies": {
23-
"@forgerock/javascript-sdk": "^4.8.2"
23+
"@forgerock/javascript-sdk": "workspace:^"
2424
}
2525
}

pnpm-lock.yaml

Lines changed: 4 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)