@iblai/iblai-js 1.10.0 → 1.10.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.
@@ -21,6 +21,8 @@ export type { AgentPromptField, SkillFormValues } from './claw-sandbox-helpers';
21
21
  export { navigateToAuditLog, verifyAuditLogTableVisible, getAuditLogRowCount, verifyAuditLogEntryStructure, verifyAuditLogEmptyState, verifyAuditLogPermissionError, verifyAuditLogGenericError, verifyAuditLogLoading, waitForAuditLogDataLoaded, filterByAction, filterByActor, getAvailableActors, filterByDateRange, clearDateRangeFilter, getPaginationInfo, goToNextPage, goToPreviousPage, goToFirstPage, goToLastPage, goToPage, verifyCurrentPage, isOnLastPage, isOnFirstPage, navigateToAuditLogAndWaitForData, filterByActionAndVerify, filterByActorAndVerify, } from './audit-log-helpers';
22
22
  export { getCurrentTenantShowPaywall, creditBalanceTrigger, creditBalancePanel, creditBalancePlanBadge, expectCreditBalanceVisibilityForTenant, openCreditBalanceDropdown, waitForCreditBalanceLoaded, closeCreditBalanceDropdown, getCreditBalancePlanLabel, getCreditBalanceRemaining, expectCreditBalancePanelForFreePlan, expectCreditBalancePanelForTrialPlan, expectCreditBalancePanelForPremiumPlan, expectCreditBalanceForCurrentPlan, } from './credit-balance-helpers';
23
23
  export type { CreditBalancePlan } from './credit-balance-helpers';
24
+ export { PRIVACY_LABELS, isPrivacyTabVisible, switchToPrivacyTab, getPrivacyRouterSwitch, setPrivacyRouterEnabled, expectPrivacyRouterEnabled, expectPrivacyFieldsHidden, expectPrivacyFieldsVisible, selectPrivacyAction, setBlockMessage, getEntityChip, setEntitySelected, expectEntitySelected, getOutputFilterSwitch, setOutputFilterEnabled, expectOutputFilterEnabled, } from './privacy-tab-helpers';
25
+ export type { PrivacyAction, PrivacyEntity } from './privacy-tab-helpers';
24
26
  export { billingPlanSection, billingCreditsSection, billingAutoRechargeSection, getBillingPlanLabel, getBillingAutoRechargeStatus, waitForBillingTabReady, expectBillingPlanSection, expectBillingCreditsSection, expectBillingAutoRechargeSection, expectBillingTabForFreePlan, expectBillingTabForTrialPlan, expectBillingTabForPremiumPlan, expectBillingTabForCurrentPlan, clickBillingUpgrade, clickBillingAddCredits, clickBillingManageBilling, clickBillingManageUsage, } from './billing-tab-helpers';
25
27
  export type { BillingAutoRechargeStatus } from './billing-tab-helpers';
26
28
  export { createPlaywrightConfig, generateProjectConfig, generateBrowserSetupProjects, getBrowserKey, } from './playwright-config';
@@ -0,0 +1,100 @@
1
+ import { Locator, Page } from '@playwright/test';
2
+ /**
3
+ * Privacy tab helpers — Playwright bindings for the `AgentPrivacyTab`
4
+ * component from `@iblai/web-containers`.
5
+ *
6
+ * All UI strings below mirror `AGENT_PRIVACY_TAB_LABELS` from
7
+ * `@iblai/web-containers/next`. If a consumer renames a label via the
8
+ * `labels` prop, override these constants per spec — don't edit this file.
9
+ *
10
+ * The helpers assume the Edit Mentor dialog is already open. Call
11
+ * `switchToPrivacyTab(page)` first; from then on, every helper accepts
12
+ * either the `Page` or the dialog `Locator`.
13
+ */
14
+ export declare const PRIVACY_LABELS: {
15
+ readonly tabName: "Privacy";
16
+ readonly headerTitle: "Privacy";
17
+ readonly routerLabel: "Enable Privacy Router";
18
+ readonly actionLabel: "When PII is detected";
19
+ readonly blockMessageLabel: "Block Message";
20
+ readonly entitiesLabel: "Entity Types";
21
+ readonly outputFilterLabel: "Also filter AI responses";
22
+ readonly entitiesEmptyHint: "Using defaults.";
23
+ readonly actionOptions: {
24
+ readonly redact: "Redact";
25
+ readonly mask: "Mask";
26
+ readonly block: "Block";
27
+ };
28
+ readonly entityChips: {
29
+ readonly PERSON: "Person";
30
+ readonly EMAIL_ADDRESS: "Email";
31
+ readonly PHONE_NUMBER: "Phone";
32
+ readonly US_SSN: "SSN";
33
+ readonly CREDIT_CARD: "Credit Card";
34
+ readonly LOCATION: "Location";
35
+ readonly DATE_TIME: "Date / Time";
36
+ readonly US_PASSPORT: "Passport";
37
+ readonly US_DRIVER_LICENSE: "Driver's License";
38
+ readonly IP_ADDRESS: "IP Address";
39
+ readonly IBAN_CODE: "IBAN";
40
+ readonly MEDICAL_LICENSE: "Medical License";
41
+ readonly US_BANK_NUMBER: "Bank Number";
42
+ };
43
+ };
44
+ export type PrivacyAction = keyof typeof PRIVACY_LABELS.actionOptions;
45
+ export type PrivacyEntity = keyof typeof PRIVACY_LABELS.entityChips;
46
+ /**
47
+ * Check whether the Privacy tab is currently rendered in the Edit Mentor
48
+ * dialog. Returns false instead of throwing so consumers can guard
49
+ * conditionally rendered tabs.
50
+ */
51
+ export declare function isPrivacyTabVisible(page: Page): Promise<boolean>;
52
+ /**
53
+ * Switch to the Privacy tab. Assumes the Edit Mentor dialog is open.
54
+ */
55
+ export declare function switchToPrivacyTab(page: Page): Promise<void>;
56
+ /**
57
+ * Locator for the master privacy-router switch.
58
+ */
59
+ export declare function getPrivacyRouterSwitch(scope: Page | Locator): Locator;
60
+ /**
61
+ * Click the master toggle until it matches the desired state.
62
+ */
63
+ export declare function setPrivacyRouterEnabled(scope: Page | Locator, enabled: boolean): Promise<void>;
64
+ export declare function expectPrivacyRouterEnabled(scope: Page | Locator, enabled: boolean): Promise<void>;
65
+ /**
66
+ * Assert that all dependent privacy fields are hidden — the case when the
67
+ * master toggle is off.
68
+ */
69
+ export declare function expectPrivacyFieldsHidden(scope: Page | Locator): Promise<void>;
70
+ /**
71
+ * Assert that the action selector, entities, and output filter are visible —
72
+ * the case when the master toggle is on.
73
+ */
74
+ export declare function expectPrivacyFieldsVisible(scope: Page | Locator): Promise<void>;
75
+ /**
76
+ * Pick a value in the "When PII is detected" select. The block-message
77
+ * textarea will appear / disappear automatically based on the selection.
78
+ */
79
+ export declare function selectPrivacyAction(scope: Page | Locator, action: PrivacyAction): Promise<void>;
80
+ /**
81
+ * Type a custom block message and commit it. The field saves on blur, so
82
+ * this helper blurs the textarea after typing.
83
+ */
84
+ export declare function setBlockMessage(scope: Page | Locator, text: string): Promise<void>;
85
+ /**
86
+ * Locator for a single entity chip. Chips are buttons with
87
+ * `role="checkbox"` and an `aria-label` matching the user-facing chip text.
88
+ */
89
+ export declare function getEntityChip(scope: Page | Locator, entity: PrivacyEntity): Locator;
90
+ /**
91
+ * Toggle an entity chip until it matches the desired selected state.
92
+ */
93
+ export declare function setEntitySelected(scope: Page | Locator, entity: PrivacyEntity, selected: boolean): Promise<void>;
94
+ export declare function expectEntitySelected(scope: Page | Locator, entity: PrivacyEntity, selected: boolean): Promise<void>;
95
+ /**
96
+ * Locator for the "Also filter AI responses" switch.
97
+ */
98
+ export declare function getOutputFilterSwitch(scope: Page | Locator): Locator;
99
+ export declare function setOutputFilterEnabled(scope: Page | Locator, enabled: boolean): Promise<void>;
100
+ export declare function expectOutputFilterEnabled(scope: Page | Locator, enabled: boolean): Promise<void>;
@@ -3105,6 +3105,206 @@ async function expectCreditBalanceForCurrentPlan(page, options) {
3105
3105
  return plan;
3106
3106
  }
3107
3107
 
3108
+ /**
3109
+ * Privacy tab helpers — Playwright bindings for the `AgentPrivacyTab`
3110
+ * component from `@iblai/web-containers`.
3111
+ *
3112
+ * All UI strings below mirror `AGENT_PRIVACY_TAB_LABELS` from
3113
+ * `@iblai/web-containers/next`. If a consumer renames a label via the
3114
+ * `labels` prop, override these constants per spec — don't edit this file.
3115
+ *
3116
+ * The helpers assume the Edit Mentor dialog is already open. Call
3117
+ * `switchToPrivacyTab(page)` first; from then on, every helper accepts
3118
+ * either the `Page` or the dialog `Locator`.
3119
+ */
3120
+ const PRIVACY_LABELS = {
3121
+ tabName: 'Privacy',
3122
+ headerTitle: 'Privacy',
3123
+ routerLabel: 'Enable Privacy Router',
3124
+ actionLabel: 'When PII is detected',
3125
+ blockMessageLabel: 'Block Message',
3126
+ entitiesLabel: 'Entity Types',
3127
+ outputFilterLabel: 'Also filter AI responses',
3128
+ entitiesEmptyHint: 'Using defaults.',
3129
+ actionOptions: {
3130
+ redact: 'Redact',
3131
+ mask: 'Mask',
3132
+ block: 'Block',
3133
+ },
3134
+ entityChips: {
3135
+ PERSON: 'Person',
3136
+ EMAIL_ADDRESS: 'Email',
3137
+ PHONE_NUMBER: 'Phone',
3138
+ US_SSN: 'SSN',
3139
+ CREDIT_CARD: 'Credit Card',
3140
+ LOCATION: 'Location',
3141
+ DATE_TIME: 'Date / Time',
3142
+ US_PASSPORT: 'Passport',
3143
+ US_DRIVER_LICENSE: "Driver's License",
3144
+ IP_ADDRESS: 'IP Address',
3145
+ IBAN_CODE: 'IBAN',
3146
+ MEDICAL_LICENSE: 'Medical License',
3147
+ US_BANK_NUMBER: 'Bank Number',
3148
+ },
3149
+ };
3150
+ /**
3151
+ * Resolve a Page from either a Page or a Locator. Used when we need to
3152
+ * reach DOM that Radix renders outside the dialog subtree (popovers,
3153
+ * select options, etc.).
3154
+ */
3155
+ function asPage(scope) {
3156
+ return 'page' in scope ? scope.page() : scope;
3157
+ }
3158
+ /**
3159
+ * Check whether the Privacy tab is currently rendered in the Edit Mentor
3160
+ * dialog. Returns false instead of throwing so consumers can guard
3161
+ * conditionally rendered tabs.
3162
+ */
3163
+ async function isPrivacyTabVisible(page) {
3164
+ const tab = page.getByRole('tab', { name: PRIVACY_LABELS.tabName, exact: true });
3165
+ try {
3166
+ await test$1.expect(tab).toBeVisible({ timeout: 5000 });
3167
+ return true;
3168
+ }
3169
+ catch (_a) {
3170
+ return false;
3171
+ }
3172
+ }
3173
+ /**
3174
+ * Switch to the Privacy tab. Assumes the Edit Mentor dialog is open.
3175
+ */
3176
+ async function switchToPrivacyTab(page) {
3177
+ const tab = page.getByRole('tab', { name: PRIVACY_LABELS.tabName, exact: true });
3178
+ await test$1.expect(tab).toBeVisible({ timeout: 10000 });
3179
+ await tab.click();
3180
+ // The master toggle label is unique to the privacy tab — its presence
3181
+ // confirms we landed on the right pane.
3182
+ await test$1.expect(page.getByText(PRIVACY_LABELS.routerLabel)).toBeVisible({
3183
+ timeout: 10000,
3184
+ });
3185
+ logger.info('Switched to Privacy tab');
3186
+ }
3187
+ /**
3188
+ * Locator for the master privacy-router switch.
3189
+ */
3190
+ function getPrivacyRouterSwitch(scope) {
3191
+ return scope.getByRole('switch', { name: /Privacy router (enabled|disabled)/ });
3192
+ }
3193
+ /**
3194
+ * Click the master toggle until it matches the desired state.
3195
+ */
3196
+ async function setPrivacyRouterEnabled(scope, enabled) {
3197
+ const toggle = getPrivacyRouterSwitch(scope);
3198
+ await test$1.expect(toggle).toBeVisible({ timeout: 10000 });
3199
+ const isChecked = (await toggle.getAttribute('aria-checked')) === 'true';
3200
+ if (isChecked !== enabled) {
3201
+ await toggle.click();
3202
+ await test$1.expect(toggle).toHaveAttribute('aria-checked', String(enabled), {
3203
+ timeout: 10000,
3204
+ });
3205
+ }
3206
+ logger.info(`Privacy router set to ${enabled ? 'enabled' : 'disabled'}`);
3207
+ }
3208
+ async function expectPrivacyRouterEnabled(scope, enabled) {
3209
+ await test$1.expect(getPrivacyRouterSwitch(scope)).toHaveAttribute('aria-checked', String(enabled));
3210
+ }
3211
+ /**
3212
+ * Assert that all dependent privacy fields are hidden — the case when the
3213
+ * master toggle is off.
3214
+ */
3215
+ async function expectPrivacyFieldsHidden(scope) {
3216
+ await test$1.expect(scope.getByText(PRIVACY_LABELS.actionLabel)).toBeHidden();
3217
+ await test$1.expect(scope.getByText(PRIVACY_LABELS.entitiesLabel)).toBeHidden();
3218
+ await test$1.expect(scope.getByText(PRIVACY_LABELS.outputFilterLabel)).toBeHidden();
3219
+ }
3220
+ /**
3221
+ * Assert that the action selector, entities, and output filter are visible —
3222
+ * the case when the master toggle is on.
3223
+ */
3224
+ async function expectPrivacyFieldsVisible(scope) {
3225
+ await test$1.expect(scope.getByText(PRIVACY_LABELS.actionLabel)).toBeVisible();
3226
+ await test$1.expect(scope.getByText(PRIVACY_LABELS.entitiesLabel)).toBeVisible();
3227
+ await test$1.expect(scope.getByText(PRIVACY_LABELS.outputFilterLabel)).toBeVisible();
3228
+ }
3229
+ /**
3230
+ * Pick a value in the "When PII is detected" select. The block-message
3231
+ * textarea will appear / disappear automatically based on the selection.
3232
+ */
3233
+ async function selectPrivacyAction(scope, action) {
3234
+ const trigger = scope.getByRole('combobox', { name: PRIVACY_LABELS.actionLabel });
3235
+ await test$1.expect(trigger).toBeVisible({ timeout: 10000 });
3236
+ await trigger.click();
3237
+ // Radix Select renders options in a portal at the document root, so we
3238
+ // always look them up on the Page — never on the dialog Locator.
3239
+ const option = asPage(scope).getByRole('option', {
3240
+ name: PRIVACY_LABELS.actionOptions[action],
3241
+ });
3242
+ await test$1.expect(option).toBeVisible({ timeout: 5000 });
3243
+ await option.click();
3244
+ await test$1.expect(trigger).toHaveText(new RegExp(PRIVACY_LABELS.actionOptions[action]));
3245
+ logger.info(`Privacy action set to "${action}"`);
3246
+ }
3247
+ /**
3248
+ * Type a custom block message and commit it. The field saves on blur, so
3249
+ * this helper blurs the textarea after typing.
3250
+ */
3251
+ async function setBlockMessage(scope, text) {
3252
+ const textarea = scope.getByLabel(PRIVACY_LABELS.blockMessageLabel);
3253
+ await test$1.expect(textarea).toBeVisible({ timeout: 10000 });
3254
+ await textarea.fill(text);
3255
+ await textarea.blur();
3256
+ await test$1.expect(textarea).toHaveValue(text);
3257
+ logger.info('Block message updated');
3258
+ }
3259
+ /**
3260
+ * Locator for a single entity chip. Chips are buttons with
3261
+ * `role="checkbox"` and an `aria-label` matching the user-facing chip text.
3262
+ */
3263
+ function getEntityChip(scope, entity) {
3264
+ return scope.getByRole('checkbox', {
3265
+ name: PRIVACY_LABELS.entityChips[entity],
3266
+ exact: true,
3267
+ });
3268
+ }
3269
+ /**
3270
+ * Toggle an entity chip until it matches the desired selected state.
3271
+ */
3272
+ async function setEntitySelected(scope, entity, selected) {
3273
+ const chip = getEntityChip(scope, entity);
3274
+ await test$1.expect(chip).toBeVisible({ timeout: 10000 });
3275
+ const isSelected = (await chip.getAttribute('aria-checked')) === 'true';
3276
+ if (isSelected !== selected) {
3277
+ await chip.click();
3278
+ await test$1.expect(chip).toHaveAttribute('aria-checked', String(selected), {
3279
+ timeout: 10000,
3280
+ });
3281
+ }
3282
+ }
3283
+ async function expectEntitySelected(scope, entity, selected) {
3284
+ await test$1.expect(getEntityChip(scope, entity)).toHaveAttribute('aria-checked', String(selected));
3285
+ }
3286
+ /**
3287
+ * Locator for the "Also filter AI responses" switch.
3288
+ */
3289
+ function getOutputFilterSwitch(scope) {
3290
+ return scope.getByRole('switch', { name: /Output filter (enabled|disabled)/ });
3291
+ }
3292
+ async function setOutputFilterEnabled(scope, enabled) {
3293
+ const toggle = getOutputFilterSwitch(scope);
3294
+ await test$1.expect(toggle).toBeVisible({ timeout: 10000 });
3295
+ const isChecked = (await toggle.getAttribute('aria-checked')) === 'true';
3296
+ if (isChecked !== enabled) {
3297
+ await toggle.click();
3298
+ await test$1.expect(toggle).toHaveAttribute('aria-checked', String(enabled), {
3299
+ timeout: 10000,
3300
+ });
3301
+ }
3302
+ logger.info(`Output filter set to ${enabled ? 'enabled' : 'disabled'}`);
3303
+ }
3304
+ async function expectOutputFilterEnabled(scope, enabled) {
3305
+ await test$1.expect(getOutputFilterSwitch(scope)).toHaveAttribute('aria-checked', String(enabled));
3306
+ }
3307
+
3108
3308
  const DEFAULT_TIMEOUT = 10000;
3109
3309
  /** Locator for the Plan section card on the BillingTab. */
3110
3310
  function billingPlanSection(page) {
@@ -3432,6 +3632,7 @@ Object.defineProperty(exports, "expect", {
3432
3632
  exports.AuthFlowBuilder = AuthFlowBuilder;
3433
3633
  exports.CustomReporter = CustomReporter;
3434
3634
  exports.MailsacClient = MailsacClient;
3635
+ exports.PRIVACY_LABELS = PRIVACY_LABELS;
3435
3636
  exports.addMemory = addMemory;
3436
3637
  exports.archiveFirstMemory = archiveFirstMemory;
3437
3638
  exports.archiveMemoryByContent = archiveMemoryByContent;
@@ -3487,8 +3688,13 @@ exports.expectCreditBalancePanelForFreePlan = expectCreditBalancePanelForFreePla
3487
3688
  exports.expectCreditBalancePanelForPremiumPlan = expectCreditBalancePanelForPremiumPlan;
3488
3689
  exports.expectCreditBalancePanelForTrialPlan = expectCreditBalancePanelForTrialPlan;
3489
3690
  exports.expectCreditBalanceVisibilityForTenant = expectCreditBalanceVisibilityForTenant;
3691
+ exports.expectEntitySelected = expectEntitySelected;
3490
3692
  exports.expectNoAccessibilityViolations = expectNoAccessibilityViolations;
3491
3693
  exports.expectNoAccessibilityViolationsOnDialogs = expectNoAccessibilityViolationsOnDialogs;
3694
+ exports.expectOutputFilterEnabled = expectOutputFilterEnabled;
3695
+ exports.expectPrivacyFieldsHidden = expectPrivacyFieldsHidden;
3696
+ exports.expectPrivacyFieldsVisible = expectPrivacyFieldsVisible;
3697
+ exports.expectPrivacyRouterEnabled = expectPrivacyRouterEnabled;
3492
3698
  exports.filterByAction = filterByAction;
3493
3699
  exports.filterByActionAndVerify = filterByActionAndVerify;
3494
3700
  exports.filterByActor = filterByActor;
@@ -3505,12 +3711,15 @@ exports.getCreditBalancePlanLabel = getCreditBalancePlanLabel;
3505
3711
  exports.getCreditBalanceRemaining = getCreditBalanceRemaining;
3506
3712
  exports.getCurrentModel = getCurrentModel;
3507
3713
  exports.getCurrentTenantShowPaywall = getCurrentTenantShowPaywall;
3714
+ exports.getEntityChip = getEntityChip;
3508
3715
  exports.getInstanceHealthLabel = getInstanceHealthLabel;
3509
3716
  exports.getInstanceRowCount = getInstanceRowCount;
3510
3717
  exports.getInstanceStatusLabel = getInstanceStatusLabel;
3511
3718
  exports.getMemoryCount = getMemoryCount;
3512
3719
  exports.getMentorIdFromUrl = getMentorIdFromUrl;
3720
+ exports.getOutputFilterSwitch = getOutputFilterSwitch;
3513
3721
  exports.getPaginationInfo = getPaginationInfo;
3722
+ exports.getPrivacyRouterSwitch = getPrivacyRouterSwitch;
3514
3723
  exports.getSkillRowCount = getSkillRowCount;
3515
3724
  exports.goToFirstPage = goToFirstPage;
3516
3725
  exports.goToLastPage = goToLastPage;
@@ -3523,6 +3732,7 @@ exports.isJSON = isJSON;
3523
3732
  exports.isMemoryTabVisible = isMemoryTabVisible;
3524
3733
  exports.isOnFirstPage = isOnFirstPage;
3525
3734
  exports.isOnLastPage = isOnLastPage;
3735
+ exports.isPrivacyTabVisible = isPrivacyTabVisible;
3526
3736
  exports.isSandboxTabVisible = isSandboxTabVisible;
3527
3737
  exports.isSkillEnabled = isSkillEnabled;
3528
3738
  exports.logger = logger;
@@ -3554,6 +3764,11 @@ exports.safeWaitForURL = safeWaitForURL;
3554
3764
  exports.searchInstances = searchInstances;
3555
3765
  exports.selectDateFromCalendar = selectDateFromCalendar;
3556
3766
  exports.selectLLMModel = selectLLMModel;
3767
+ exports.selectPrivacyAction = selectPrivacyAction;
3768
+ exports.setBlockMessage = setBlockMessage;
3769
+ exports.setEntitySelected = setEntitySelected;
3770
+ exports.setOutputFilterEnabled = setOutputFilterEnabled;
3771
+ exports.setPrivacyRouterEnabled = setPrivacyRouterEnabled;
3557
3772
  exports.setupSandboxInstance = setupSandboxInstance;
3558
3773
  exports.shouldAddNewRowWhenClickingAddRowButton = shouldAddNewRowWhenClickingAddRowButton;
3559
3774
  exports.shouldAllowEditingCellValuesInCSVEditor = shouldAllowEditingCellValuesInCSVEditor;
@@ -3573,6 +3788,7 @@ exports.shouldShowCombiningReportsDialog = shouldShowCombiningReportsDialog;
3573
3788
  exports.shouldVerifyCSVEditorDialogAccessibility = shouldVerifyCSVEditorDialogAccessibility;
3574
3789
  exports.signUpWithEmailAndPassword = signUpWithEmailAndPassword;
3575
3790
  exports.switchToMemoryTab = switchToMemoryTab;
3791
+ exports.switchToPrivacyTab = switchToPrivacyTab;
3576
3792
  exports.switchToSandboxTab = switchToSandboxTab;
3577
3793
  exports.switchToSkillsTab = switchToSkillsTab;
3578
3794
  exports.teardownSandboxInstance = teardownSandboxInstance;