@iblai/iblai-js 1.5.4 → 1.6.1

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.
@@ -0,0 +1,88 @@
1
+ import { Locator, Page } from '@playwright/test';
2
+ import type { CreditBalancePlan } from './credit-balance-helpers';
3
+ export type BillingAutoRechargeStatus = 'Enabled' | 'Disabled';
4
+ /** Locator for the Plan section card on the BillingTab. */
5
+ export declare function billingPlanSection(page: Page): Locator;
6
+ /** Locator for the Credits section card on the BillingTab. */
7
+ export declare function billingCreditsSection(page: Page): Locator;
8
+ /** Locator for the Auto Recharge section card on the BillingTab.
9
+ * This section is only rendered for non-Free plans with a payment method on file.
10
+ */
11
+ export declare function billingAutoRechargeSection(page: Page): Locator;
12
+ /** Reads the plan label (Free / Trial / Premium) from the Plan section. */
13
+ export declare function getBillingPlanLabel(page: Page): Promise<CreditBalancePlan | null>;
14
+ /** Reads the auto-recharge status badge (Enabled / Disabled) when the section is rendered. */
15
+ export declare function getBillingAutoRechargeStatus(page: Page): Promise<BillingAutoRechargeStatus | null>;
16
+ /** Waits for the BillingTab loading skeletons to clear by waiting for the Plan
17
+ * section card to mount. */
18
+ export declare function waitForBillingTabReady(page: Page): Promise<void>;
19
+ /**
20
+ * Asserts the Plan section state for a given plan. Verifies:
21
+ * - The plan label text matches `options.plan`
22
+ * - The "Current" pill is visible
23
+ * - The Upgrade button is visible iff the plan is not Premium
24
+ */
25
+ export declare function expectBillingPlanSection(page: Page, options: {
26
+ plan: CreditBalancePlan;
27
+ }): Promise<void>;
28
+ /**
29
+ * Asserts the Credits section state. Always verifies the "Available" stat row.
30
+ * The action button rule mirrors the component:
31
+ * - Free plan → no Add Credits / Manage Billing button
32
+ * - Non-Free + hasPaymentMethod=true → "Add Credits" visible, "Manage Billing" absent
33
+ * - Non-Free + hasPaymentMethod=false → "Manage Billing" visible, "Add Credits" absent
34
+ * - Non-Free with hasPaymentMethod omitted → only the "Available" row is asserted
35
+ */
36
+ export declare function expectBillingCreditsSection(page: Page, options: {
37
+ plan: CreditBalancePlan;
38
+ hasPaymentMethod?: boolean;
39
+ }): Promise<void>;
40
+ /**
41
+ * Asserts the Auto Recharge section visibility. Section is rendered only when
42
+ * `hasPaymentMethod && !isFreePlan` in the component. Pass `expectVisible: false`
43
+ * to assert the section is absent. When visible and `status` is provided, also
44
+ * asserts the Enabled/Disabled badge text.
45
+ */
46
+ export declare function expectBillingAutoRechargeSection(page: Page, options: {
47
+ expectVisible: boolean;
48
+ status?: BillingAutoRechargeStatus;
49
+ }): Promise<void>;
50
+ /**
51
+ * Free plan: Plan="Free" with Upgrade visible; Credits section has no action;
52
+ * Auto Recharge section is hidden entirely (regardless of has_payment_method).
53
+ */
54
+ export declare function expectBillingTabForFreePlan(page: Page): Promise<void>;
55
+ /**
56
+ * Trial plan: Plan="Trial" with Upgrade visible; Credits action depends on
57
+ * `hasPaymentMethod` (Add Credits when true, Manage Billing when false);
58
+ * Auto Recharge section is rendered iff `hasPaymentMethod` is true.
59
+ */
60
+ export declare function expectBillingTabForTrialPlan(page: Page, options: {
61
+ hasPaymentMethod: boolean;
62
+ }): Promise<void>;
63
+ /**
64
+ * Premium plan: Plan="Premium" with Upgrade hidden; Credits action depends on
65
+ * `hasPaymentMethod` (Add Credits when true, Manage Billing when false);
66
+ * Auto Recharge section is rendered iff `hasPaymentMethod` is true.
67
+ */
68
+ export declare function expectBillingTabForPremiumPlan(page: Page, options: {
69
+ hasPaymentMethod: boolean;
70
+ }): Promise<void>;
71
+ /**
72
+ * Convenience: detects the active plan from the Plan section badge and runs
73
+ * the matching state assertions. Returns the detected plan.
74
+ *
75
+ * For non-Free plans, pass `hasPaymentMethod` to assert the Credits/Auto Recharge
76
+ * sub-states; if omitted, only the Plan section + base Credits row is verified.
77
+ */
78
+ export declare function expectBillingTabForCurrentPlan(page: Page, options?: {
79
+ hasPaymentMethod?: boolean;
80
+ }): Promise<CreditBalancePlan>;
81
+ /** Clicks the Upgrade button in the Plan section (visible only on non-Premium plans). */
82
+ export declare function clickBillingUpgrade(page: Page): Promise<void>;
83
+ /** Clicks the Add Credits button in the Credits section (non-Free + has payment method). */
84
+ export declare function clickBillingAddCredits(page: Page): Promise<void>;
85
+ /** Clicks the Manage Billing button in the Credits section (non-Free + no payment method). */
86
+ export declare function clickBillingManageBilling(page: Page): Promise<void>;
87
+ /** Clicks the Manage Usage button in the Auto Recharge section. */
88
+ export declare function clickBillingManageUsage(page: Page): Promise<void>;
@@ -0,0 +1,73 @@
1
+ import { Locator, Page } from '@playwright/test';
2
+ export type CreditBalancePlan = 'Free' | 'Trial' | 'Premium';
3
+ /**
4
+ * Reads `current_tenant` from localStorage and returns its `show_paywall` flag.
5
+ * Returns false if the entry is missing, malformed, or the flag is unset.
6
+ */
7
+ export declare function getCurrentTenantShowPaywall(page: Page): Promise<boolean>;
8
+ /** Locator for the credit-balance trigger button (icon in the nav). */
9
+ export declare function creditBalanceTrigger(page: Page): Locator;
10
+ /** Locator for the credit-balance dropdown panel (rendered in a Radix portal). */
11
+ export declare function creditBalancePanel(page: Page): Locator;
12
+ /** Locator for the plan badge (Free / Trial / Premium) inside the open panel. */
13
+ export declare function creditBalancePlanBadge(page: Page): Locator;
14
+ /**
15
+ * Asserts the credit-balance trigger is visible iff the current tenant has
16
+ * `show_paywall=true`. Returns the resolved expectation so callers can branch.
17
+ */
18
+ export declare function expectCreditBalanceVisibilityForTenant(page: Page): Promise<{
19
+ shouldBeVisible: boolean;
20
+ }>;
21
+ /**
22
+ * Opens the credit-balance dropdown if not already open, waits for the panel
23
+ * to be visible, and waits for the initial "Loading credits..." placeholder to
24
+ * clear so callers can immediately read content. Idempotent — safe to call
25
+ * when the panel is already up.
26
+ */
27
+ export declare function openCreditBalanceDropdown(page: Page): Promise<Locator>;
28
+ /**
29
+ * Waits for the "Loading credits..." placeholder to disappear from the open
30
+ * panel. Resolves in the success path (real content rendered) or the error
31
+ * path ("Unable to load credit balance." rendered) — both replace the loading
32
+ * row. Returns immediately if the placeholder was never present.
33
+ */
34
+ export declare function waitForCreditBalanceLoaded(page: Page): Promise<void>;
35
+ /** Closes the credit-balance dropdown via Escape and waits for it to detach. */
36
+ export declare function closeCreditBalanceDropdown(page: Page): Promise<void>;
37
+ /**
38
+ * Reads the plan label text from the open panel. Returns null if the badge is
39
+ * not rendered (e.g. billing data still loading or errored).
40
+ */
41
+ export declare function getCreditBalancePlanLabel(page: Page): Promise<CreditBalancePlan | null>;
42
+ /**
43
+ * Reads the "Remaining" credits value from the open panel ("X,XXX Credits").
44
+ * Returns null when the row is not rendered or unparseable.
45
+ */
46
+ export declare function getCreditBalanceRemaining(page: Page): Promise<number | null>;
47
+ /**
48
+ * Free plan UI: Upgrade Plan only. No payment buttons. No auto-recharge section.
49
+ */
50
+ export declare function expectCreditBalancePanelForFreePlan(page: Page): Promise<void>;
51
+ /**
52
+ * Trial plan UI: Upgrade Plan only. No Manage Usage / Add Credits / Manage Billing.
53
+ */
54
+ export declare function expectCreditBalancePanelForTrialPlan(page: Page): Promise<void>;
55
+ /**
56
+ * Premium plan UI: Upgrade Plan must NOT appear.
57
+ * - With payment method: Manage Usage + Add Credits both visible; Manage Billing hidden.
58
+ * - Without payment method: Manage Billing visible; Manage Usage + Add Credits hidden.
59
+ */
60
+ export declare function expectCreditBalancePanelForPremiumPlan(page: Page, options: {
61
+ hasPaymentMethod: boolean;
62
+ }): Promise<void>;
63
+ /**
64
+ * Convenience: opens the dropdown, detects the active plan from the badge,
65
+ * and runs the matching state assertions on the already-open panel. Returns
66
+ * the detected plan label.
67
+ *
68
+ * For Premium plans you may pass `hasPaymentMethod` to assert the specific
69
+ * sub-state; if omitted on Premium, only the "no Upgrade Plan button" check runs.
70
+ */
71
+ export declare function expectCreditBalanceForCurrentPlan(page: Page, options?: {
72
+ hasPaymentMethod?: boolean;
73
+ }): Promise<CreditBalancePlan>;
@@ -17,5 +17,9 @@ export { buildReportUrl, parseReportUrlParams, navigateToReportDownload, verifyP
17
17
  export type { ReportDownloadOptions } from './report-download';
18
18
  export { isMemoryTabVisible, switchToMemoryTab, verifyMemoryTabSettings, verifyMemoryTabMemoriesList, openAddMemoryDialog, toggleMemorySwitch, addMemory, deleteFirstMemory, deleteMemoryByContent, archiveFirstMemory, archiveMemoryByContent, getMemoryCount, verifyMemoryExists, verifyMemoryNotExists, } from './memory-test-helpers';
19
19
  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';
20
+ export { getCurrentTenantShowPaywall, creditBalanceTrigger, creditBalancePanel, creditBalancePlanBadge, expectCreditBalanceVisibilityForTenant, openCreditBalanceDropdown, waitForCreditBalanceLoaded, closeCreditBalanceDropdown, getCreditBalancePlanLabel, getCreditBalanceRemaining, expectCreditBalancePanelForFreePlan, expectCreditBalancePanelForTrialPlan, expectCreditBalancePanelForPremiumPlan, expectCreditBalanceForCurrentPlan, } from './credit-balance-helpers';
21
+ export type { CreditBalancePlan } from './credit-balance-helpers';
22
+ export { billingPlanSection, billingCreditsSection, billingAutoRechargeSection, getBillingPlanLabel, getBillingAutoRechargeStatus, waitForBillingTabReady, expectBillingPlanSection, expectBillingCreditsSection, expectBillingAutoRechargeSection, expectBillingTabForFreePlan, expectBillingTabForTrialPlan, expectBillingTabForPremiumPlan, expectBillingTabForCurrentPlan, clickBillingUpgrade, clickBillingAddCredits, clickBillingManageBilling, clickBillingManageUsage, } from './billing-tab-helpers';
23
+ export type { BillingAutoRechargeStatus } from './billing-tab-helpers';
20
24
  export { createPlaywrightConfig, generateProjectConfig, generateBrowserSetupProjects, getBrowserKey, } from './playwright-config';
21
25
  export type { PlatformConfig, CreatePlaywrightConfigOptions } from './playwright-config';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iblai/iblai-js",
3
- "version": "1.5.4",
3
+ "version": "1.6.1",
4
4
  "description": "Unified JavaScript SDK for IBL.ai — re-exports data-layer, web-containers, and web-utils under a single package",
5
5
  "type": "module",
6
6
  "engines": {
@@ -61,10 +61,10 @@
61
61
  "axios": "1.13.6",
62
62
  "dotenv": "16.6.1",
63
63
  "winston": "3.19.0",
64
- "@iblai/data-layer": "1.3.11",
65
- "@iblai/mcp": "1.3.4",
66
- "@iblai/web-utils": "1.3.2",
67
- "@iblai/web-containers": "1.3.17"
64
+ "@iblai/data-layer": "1.4.0",
65
+ "@iblai/web-containers": "1.4.1",
66
+ "@iblai/mcp": "1.4.1",
67
+ "@iblai/web-utils": "1.4.0"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "@iblai/iblai-api": "4.166.0-ai",