@iblai/iblai-js 2.72.0 → 2.73.0

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.
Files changed (120) hide show
  1. package/dist/data-layer/playwright/billing-tab-helpers.d.ts +61 -48
  2. package/dist/data-layer/playwright/credit-balance-helpers.d.ts +40 -18
  3. package/dist/data-layer/playwright/index.d.ts +3 -2
  4. package/dist/data-layer/playwright/plan-picker-helpers.d.ts +26 -0
  5. package/dist/data-layer/playwright/spend-limits-helpers.d.ts +5 -4
  6. package/dist/playwright/index.cjs +306 -193
  7. package/dist/playwright/index.cjs.map +1 -1
  8. package/dist/playwright/index.d.ts +133 -71
  9. package/dist/playwright/index.esm.js +293 -194
  10. package/dist/playwright/index.esm.js.map +1 -1
  11. package/dist/playwright/playwright/billing-tab-helpers.d.ts +61 -48
  12. package/dist/playwright/playwright/credit-balance-helpers.d.ts +40 -18
  13. package/dist/playwright/playwright/index.d.ts +3 -2
  14. package/dist/playwright/playwright/plan-picker-helpers.d.ts +26 -0
  15. package/dist/playwright/playwright/spend-limits-helpers.d.ts +5 -4
  16. package/dist/security/playwright/billing-tab-helpers.d.ts +61 -48
  17. package/dist/security/playwright/credit-balance-helpers.d.ts +40 -18
  18. package/dist/security/playwright/index.d.ts +3 -2
  19. package/dist/security/playwright/plan-picker-helpers.d.ts +26 -0
  20. package/dist/security/playwright/spend-limits-helpers.d.ts +5 -4
  21. package/dist/web-containers/playwright/billing-tab-helpers.d.ts +61 -48
  22. package/dist/web-containers/playwright/credit-balance-helpers.d.ts +40 -18
  23. package/dist/web-containers/playwright/index.d.ts +3 -2
  24. package/dist/web-containers/playwright/plan-picker-helpers.d.ts +26 -0
  25. package/dist/web-containers/playwright/spend-limits-helpers.d.ts +5 -4
  26. package/dist/web-containers/source/_virtual/index2.js +2 -2
  27. package/dist/web-containers/source/_virtual/index3.js +2 -2
  28. package/dist/web-containers/source/add-credits-modal.js +170 -24
  29. package/dist/web-containers/source/add-credits-modal.js.map +1 -1
  30. package/dist/web-containers/source/auto-recharge-modal.js +1 -1
  31. package/dist/web-containers/source/auto-recharge-modal.js.map +1 -1
  32. package/dist/web-containers/source/billing-credits.js +4 -4
  33. package/dist/web-containers/source/billing-credits.js.map +1 -1
  34. package/dist/web-containers/source/billing.js +60 -101
  35. package/dist/web-containers/source/billing.js.map +1 -1
  36. package/dist/web-containers/source/components/credit-balance.js +44 -72
  37. package/dist/web-containers/source/components/credit-balance.js.map +1 -1
  38. package/dist/web-containers/source/components/modals/contact-admin-modal.js +32 -0
  39. package/dist/web-containers/source/components/modals/contact-admin-modal.js.map +1 -0
  40. package/dist/web-containers/source/components/modals/upgrade-package-modal.js +281 -20
  41. package/dist/web-containers/source/components/modals/upgrade-package-modal.js.map +1 -1
  42. package/dist/web-containers/source/components/profile/add-credits-modal.js +170 -24
  43. package/dist/web-containers/source/components/profile/add-credits-modal.js.map +1 -1
  44. package/dist/web-containers/source/components/profile/auto-recharge-modal.js +1 -1
  45. package/dist/web-containers/source/components/profile/auto-recharge-modal.js.map +1 -1
  46. package/dist/web-containers/source/components/profile/billing-credits.js +4 -4
  47. package/dist/web-containers/source/components/profile/billing-credits.js.map +1 -1
  48. package/dist/web-containers/source/components/profile/billing.js +60 -101
  49. package/dist/web-containers/source/components/profile/billing.js.map +1 -1
  50. package/dist/web-containers/source/components/profile/pending-credit-top-up.js +202 -0
  51. package/dist/web-containers/source/components/profile/pending-credit-top-up.js.map +1 -0
  52. package/dist/web-containers/source/components/profile/use-complete-pending-credit-top-up.js +68 -0
  53. package/dist/web-containers/source/components/profile/use-complete-pending-credit-top-up.js.map +1 -0
  54. package/dist/web-containers/source/components/subscription-top-banner.js +119 -0
  55. package/dist/web-containers/source/components/subscription-top-banner.js.map +1 -0
  56. package/dist/web-containers/source/contact-admin-modal.js +32 -0
  57. package/dist/web-containers/source/contact-admin-modal.js.map +1 -0
  58. package/dist/web-containers/source/credit-balance.js +44 -72
  59. package/dist/web-containers/source/credit-balance.js.map +1 -1
  60. package/dist/web-containers/source/en.json.js +121 -21
  61. package/dist/web-containers/source/en.json.js.map +1 -1
  62. package/dist/web-containers/source/es.json.js +123 -23
  63. package/dist/web-containers/source/es.json.js.map +1 -1
  64. package/dist/web-containers/source/fr.json.js +121 -21
  65. package/dist/web-containers/source/fr.json.js.map +1 -1
  66. package/dist/web-containers/source/i18n/messages/en.json.js +121 -21
  67. package/dist/web-containers/source/i18n/messages/en.json.js.map +1 -1
  68. package/dist/web-containers/source/i18n/messages/es.json.js +123 -23
  69. package/dist/web-containers/source/i18n/messages/es.json.js.map +1 -1
  70. package/dist/web-containers/source/i18n/messages/fr.json.js +121 -21
  71. package/dist/web-containers/source/i18n/messages/fr.json.js.map +1 -1
  72. package/dist/web-containers/source/i18n/messages/zh.json.js +122 -22
  73. package/dist/web-containers/source/i18n/messages/zh.json.js.map +1 -1
  74. package/dist/web-containers/source/index2.js +2 -2
  75. package/dist/web-containers/source/index3.js +2 -2
  76. package/dist/web-containers/source/messages/en.json.js +121 -21
  77. package/dist/web-containers/source/messages/en.json.js.map +1 -1
  78. package/dist/web-containers/source/messages/es.json.js +123 -23
  79. package/dist/web-containers/source/messages/es.json.js.map +1 -1
  80. package/dist/web-containers/source/messages/fr.json.js +121 -21
  81. package/dist/web-containers/source/messages/fr.json.js.map +1 -1
  82. package/dist/web-containers/source/messages/zh.json.js +122 -22
  83. package/dist/web-containers/source/messages/zh.json.js.map +1 -1
  84. package/dist/web-containers/source/modals/contact-admin-modal.js +32 -0
  85. package/dist/web-containers/source/modals/contact-admin-modal.js.map +1 -0
  86. package/dist/web-containers/source/modals/upgrade-package-modal.js +281 -20
  87. package/dist/web-containers/source/modals/upgrade-package-modal.js.map +1 -1
  88. package/dist/web-containers/source/node_modules/.pnpm/css-mediaquery@0.1.2/node_modules/css-mediaquery/index.js +1 -1
  89. package/dist/web-containers/source/node_modules/.pnpm/matchmediaquery@0.4.2/node_modules/matchmediaquery/index.js +1 -1
  90. package/dist/web-containers/source/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js +1 -1
  91. package/dist/web-containers/source/pending-credit-top-up.js +202 -0
  92. package/dist/web-containers/source/pending-credit-top-up.js.map +1 -0
  93. package/dist/web-containers/source/profile/add-credits-modal.js +170 -24
  94. package/dist/web-containers/source/profile/add-credits-modal.js.map +1 -1
  95. package/dist/web-containers/source/profile/auto-recharge-modal.js +1 -1
  96. package/dist/web-containers/source/profile/auto-recharge-modal.js.map +1 -1
  97. package/dist/web-containers/source/profile/billing-credits.js +4 -4
  98. package/dist/web-containers/source/profile/billing-credits.js.map +1 -1
  99. package/dist/web-containers/source/profile/billing.js +60 -101
  100. package/dist/web-containers/source/profile/billing.js.map +1 -1
  101. package/dist/web-containers/source/profile/pending-credit-top-up.js +202 -0
  102. package/dist/web-containers/source/profile/pending-credit-top-up.js.map +1 -0
  103. package/dist/web-containers/source/profile/use-complete-pending-credit-top-up.js +68 -0
  104. package/dist/web-containers/source/profile/use-complete-pending-credit-top-up.js.map +1 -0
  105. package/dist/web-containers/source/subscription-top-banner.js +119 -0
  106. package/dist/web-containers/source/subscription-top-banner.js.map +1 -0
  107. package/dist/web-containers/source/tsconfig.build.tsbuildinfo +1 -1
  108. package/dist/web-containers/source/upgrade-package-modal.js +281 -20
  109. package/dist/web-containers/source/upgrade-package-modal.js.map +1 -1
  110. package/dist/web-containers/source/use-complete-pending-credit-top-up.js +68 -0
  111. package/dist/web-containers/source/use-complete-pending-credit-top-up.js.map +1 -0
  112. package/dist/web-containers/source/web-containers/tsconfig.build.tsbuildinfo +1 -1
  113. package/dist/web-containers/source/zh.json.js +122 -22
  114. package/dist/web-containers/source/zh.json.js.map +1 -1
  115. package/dist/web-utils/playwright/billing-tab-helpers.d.ts +61 -48
  116. package/dist/web-utils/playwright/credit-balance-helpers.d.ts +40 -18
  117. package/dist/web-utils/playwright/index.d.ts +3 -2
  118. package/dist/web-utils/playwright/plan-picker-helpers.d.ts +26 -0
  119. package/dist/web-utils/playwright/spend-limits-helpers.d.ts +5 -4
  120. package/package.json +5 -5
@@ -3673,6 +3673,90 @@ async function filterByActorAndVerify(page, actorName) {
3673
3673
  return count;
3674
3674
  }
3675
3675
 
3676
+ const DEFAULT_TIMEOUT$2 = 15000;
3677
+ /** The plan picker dialog a free-trial user gets from "Upgrade" (title "Choose Your Plan"). */
3678
+ function planPickerDialog(page) {
3679
+ return page
3680
+ .getByRole('dialog')
3681
+ .filter({ has: page.getByRole('heading', { name: 'Choose Your Plan' }) });
3682
+ }
3683
+ /** One plan card in the picker, by plan key (`free`, `premium`, `max`, `ultra`, ...). */
3684
+ function planCard(page, planKey) {
3685
+ return planPickerDialog(page).getByTestId(`plan-card-${planKey}`);
3686
+ }
3687
+ /**
3688
+ * Waits until the picker is open and shows its plans. Fails here, not later,
3689
+ * when the plans could not load ("Try again") or there are none.
3690
+ */
3691
+ async function waitForPlanPicker(page) {
3692
+ const dialog = planPickerDialog(page);
3693
+ await test$1.expect(dialog).toBeVisible({ timeout: DEFAULT_TIMEOUT$2 });
3694
+ await test$1.expect(dialog.locator('[aria-busy="true"]')).toHaveCount(0, { timeout: DEFAULT_TIMEOUT$2 });
3695
+ await test$1.expect(dialog.locator('[data-testid^="plan-card-"]').first()).toBeVisible({
3696
+ timeout: DEFAULT_TIMEOUT$2,
3697
+ });
3698
+ logger.info('Plan picker is open');
3699
+ return dialog;
3700
+ }
3701
+ /** The plan keys the picker currently shows, in order. */
3702
+ async function getPlanPickerKeys(page) {
3703
+ const cards = planPickerDialog(page).locator('[data-testid^="plan-card-"]');
3704
+ const ids = await cards.evaluateAll((els) => els.map((el) => el.getAttribute('data-testid') || ''));
3705
+ return ids.map((id) => id.replace(/^plan-card-/, ''));
3706
+ }
3707
+ /**
3708
+ * Asserts the picker shows the given plans (by key, in order) and that each
3709
+ * card offers a "Choose <name>" button. `names` maps a key to the heading it
3710
+ * must carry (Free, Pro, Max, Ultra by default for the known keys).
3711
+ */
3712
+ async function expectPlanPicker(page, planKeys, names = { free: 'Free', premium: 'Pro', max: 'Max', ultra: 'Ultra' }) {
3713
+ await waitForPlanPicker(page);
3714
+ await test$1.expect.poll(() => getPlanPickerKeys(page)).toEqual(planKeys);
3715
+ for (const key of planKeys) {
3716
+ const card = planCard(page, key);
3717
+ const name = names[key];
3718
+ if (name) {
3719
+ await test$1.expect(card.getByRole('heading', { name, exact: true })).toBeVisible();
3720
+ await test$1.expect(card.getByRole('button', { name: `Choose ${name}` })).toBeVisible();
3721
+ }
3722
+ else {
3723
+ await test$1.expect(card.getByRole('button', { name: /^Choose / })).toBeVisible();
3724
+ }
3725
+ }
3726
+ logger.info(`Verified plan picker with plans: ${planKeys.join(', ')}`);
3727
+ }
3728
+ /**
3729
+ * Clicks the "Choose <name>" button of a plan and returns once the browser has
3730
+ * left for Stripe (the URL no longer belongs to the app's origin). Pass the
3731
+ * plan's key ("premium") or its heading ("Pro").
3732
+ */
3733
+ async function choosePlan(page, planKeyOrName) {
3734
+ const dialog = await waitForPlanPicker(page);
3735
+ const byKey = dialog.getByTestId(`plan-card-${planKeyOrName}`);
3736
+ const card = (await byKey.count()) > 0
3737
+ ? byKey
3738
+ : dialog
3739
+ .locator('[data-testid^="plan-card-"]')
3740
+ .filter({ has: page.getByRole('heading', { name: planKeyOrName, exact: true }) });
3741
+ const button = card.getByRole('button', { name: /^Choose / });
3742
+ await test$1.expect(button).toBeVisible({ timeout: DEFAULT_TIMEOUT$2 });
3743
+ const appOrigin = new URL(page.url()).origin;
3744
+ await button.click();
3745
+ // Leaving the app is enough; Stripe's page need not finish loading.
3746
+ await page.waitForURL((url) => url.origin !== appOrigin, {
3747
+ timeout: 30000,
3748
+ waitUntil: 'commit',
3749
+ });
3750
+ logger.info(`Chose plan ${planKeyOrName}; now at ${page.url()}`);
3751
+ return page.url();
3752
+ }
3753
+ /** Closes the plan picker with its Close button. */
3754
+ async function closePlanPicker(page) {
3755
+ const dialog = planPickerDialog(page);
3756
+ await dialog.getByRole('button', { name: /close/i }).click();
3757
+ await test$1.expect(dialog).toHaveCount(0, { timeout: DEFAULT_TIMEOUT$2 });
3758
+ }
3759
+
3676
3760
  const DEFAULT_TIMEOUT$1 = 10000;
3677
3761
  /**
3678
3762
  * Reads `current_tenant` from localStorage and returns its `show_paywall` flag.
@@ -3700,7 +3784,7 @@ function creditBalanceTrigger(page) {
3700
3784
  function creditBalancePanel(page) {
3701
3785
  return page.getByTestId('credit-balance-panel');
3702
3786
  }
3703
- /** Locator for the plan badge (Free / Trial / Premium) inside the open panel. */
3787
+ /** Locator for the plan badge (Trial, Free or the plan's name) inside the open panel. */
3704
3788
  function creditBalancePlanBadge(page) {
3705
3789
  return creditBalancePanel(page).getByTestId('credit-balance-plan-badge');
3706
3790
  }
@@ -3729,9 +3813,11 @@ async function expectCreditBalanceVisibilityForTenant(page) {
3729
3813
  */
3730
3814
  async function openCreditBalanceDropdown(page) {
3731
3815
  const panel = creditBalancePanel(page);
3732
- if (!(await panel.isVisible().catch(() => false))) {
3733
- const trigger = creditBalanceTrigger(page);
3734
- await test$1.expect(trigger).toBeVisible({ timeout: DEFAULT_TIMEOUT$1 });
3816
+ const trigger = creditBalanceTrigger(page);
3817
+ await test$1.expect(trigger).toBeVisible({ timeout: DEFAULT_TIMEOUT$1 });
3818
+ // The trigger's state flips at once, while a closing panel can still be
3819
+ // visible for a moment.
3820
+ if ((await trigger.getAttribute('aria-expanded')) !== 'true') {
3735
3821
  await trigger.click();
3736
3822
  }
3737
3823
  await test$1.expect(panel).toBeVisible({ timeout: DEFAULT_TIMEOUT$1 });
@@ -3754,98 +3840,99 @@ async function closeCreditBalanceDropdown(page) {
3754
3840
  await test$1.expect(creditBalancePanel(page)).toHaveCount(0);
3755
3841
  }
3756
3842
  /**
3757
- * Reads the plan label text from the open panel. Returns null if the badge is
3758
- * not rendered (e.g. billing data still loading or errored).
3843
+ * Reads the billing state from the open panel's badge: `'Trial'` on the free
3844
+ * trial, `'Free'` for an account on any plan (the badge then shows "Free" or
3845
+ * the plan's name). Returns null if the badge is not rendered (e.g. billing
3846
+ * data still loading or errored).
3759
3847
  */
3760
3848
  async function getCreditBalancePlanLabel(page) {
3761
3849
  const badge = creditBalancePlanBadge(page);
3762
3850
  if ((await badge.count()) === 0)
3763
3851
  return null;
3764
- const text = (await badge.innerText()).trim();
3765
- if (text === 'Free' || text === 'Trial' || text === 'Premium')
3766
- return text;
3767
- return null;
3852
+ return (await badge.innerText()).trim() === 'Trial' ? 'Trial' : 'Free';
3768
3853
  }
3769
3854
  /**
3770
3855
  * Reads the "Remaining" credits value from the open panel ("X,XXX Credits").
3771
- * Returns null when the row is not rendered or unparseable.
3856
+ * Returns null when the row is not rendered or unparseable. The panel shows
3857
+ * cached data while it refetches, so after a top-up read it through
3858
+ * `expect.poll(() => getCreditBalanceRemaining(page))`.
3772
3859
  */
3773
3860
  async function getCreditBalanceRemaining(page) {
3774
- const panel = creditBalancePanel(page);
3775
- const row = panel.locator('div', { has: page.getByText(/^Remaining$/) }).first();
3776
- if ((await row.count()) === 0)
3861
+ const value = creditBalancePanel(page).getByTestId('credit-balance-remaining');
3862
+ if ((await value.count()) === 0)
3777
3863
  return null;
3778
- const text = await row.innerText().catch(() => '');
3864
+ const text = await value.innerText().catch(() => '');
3779
3865
  const match = text.match(/([0-9][0-9,]*)\s*Credits/i);
3780
3866
  if (!match)
3781
3867
  return null;
3782
3868
  return parseInt(match[1].replace(/,/g, ''), 10);
3783
3869
  }
3784
- function panelButtons(panel, page) {
3870
+ function panelButtons(panel) {
3785
3871
  return {
3786
- upgradePlan: panel.getByRole('button', { name: /^Upgrade Plan$/ }),
3872
+ upgrade: panel.getByRole('button', { name: /^Upgrade$/ }),
3787
3873
  manageUsage: panel.getByRole('button', { name: /^Manage Usage$/ }),
3788
3874
  addCredits: panel.getByRole('button', { name: /^Add Credits$/ }),
3789
- manageBilling: panel.getByRole('button', { name: /^Manage Billing$/ }),
3790
3875
  autoRechargeHeading: panel.getByText(/^Auto Recharge$/),
3791
3876
  };
3792
3877
  }
3793
- /**
3794
- * Free plan UI: Upgrade Plan only. No payment buttons. No auto-recharge section.
3795
- */
3796
- async function expectCreditBalancePanelForFreePlan(page) {
3797
- const panel = await openCreditBalanceDropdown(page);
3798
- await test$1.expect(creditBalancePlanBadge(page)).toHaveText('Free');
3799
- const btn = panelButtons(panel);
3878
+ async function expectStandardPlanButtons(btn, options) {
3879
+ await test$1.expect(btn.upgrade).toHaveCount(0);
3880
+ await test$1.expect(btn.addCredits).toBeVisible();
3881
+ if ((options === null || options === void 0 ? void 0 : options.hasPaymentMethod) === true) {
3882
+ await test$1.expect(btn.autoRechargeHeading).toBeVisible();
3883
+ await test$1.expect(btn.manageUsage).toBeVisible();
3884
+ }
3885
+ else if ((options === null || options === void 0 ? void 0 : options.hasPaymentMethod) === false) {
3886
+ await test$1.expect(btn.autoRechargeHeading).toHaveCount(0);
3887
+ await test$1.expect(btn.manageUsage).toHaveCount(0);
3888
+ }
3889
+ }
3890
+ async function expectTrialButtons(btn) {
3891
+ await test$1.expect(btn.upgrade).toBeVisible();
3800
3892
  await test$1.expect(btn.autoRechargeHeading).toHaveCount(0);
3801
- await test$1.expect(btn.upgradePlan).toBeVisible();
3802
3893
  await test$1.expect(btn.manageUsage).toHaveCount(0);
3803
3894
  await test$1.expect(btn.addCredits).toHaveCount(0);
3804
- await test$1.expect(btn.manageBilling).toHaveCount(0);
3805
- logger.info('Verified credit balance panel for Free plan');
3806
3895
  }
3807
3896
  /**
3808
- * Trial plan UI: Upgrade Plan only. No Manage Usage / Add Credits / Manage Billing.
3897
+ * UI for an account on a plan: never an "Upgrade" button; "Add Credits" always.
3898
+ * - With a payment method: Manage Usage + Add Credits and the Auto Recharge section.
3899
+ * - Without one: Add Credits alone (the dialog collects a card on Stripe first),
3900
+ * no Manage Usage, no Auto Recharge section.
3901
+ * - `hasPaymentMethod` omitted: only the badge, Add Credits and the absence of
3902
+ * Upgrade are checked.
3903
+ * - `planName`: the exact badge text ("Free", "Max"); omitted, any plan but
3904
+ * the trial passes.
3809
3905
  */
3810
- async function expectCreditBalancePanelForTrialPlan(page) {
3906
+ async function expectCreditBalancePanelForStandardPlan(page, options) {
3811
3907
  const panel = await openCreditBalanceDropdown(page);
3812
- await test$1.expect(creditBalancePlanBadge(page)).toHaveText('Trial');
3813
- const btn = panelButtons(panel);
3814
- await test$1.expect(btn.upgradePlan).toBeVisible();
3815
- await test$1.expect(btn.manageUsage).toHaveCount(0);
3816
- await test$1.expect(btn.addCredits).toHaveCount(0);
3817
- await test$1.expect(btn.manageBilling).toHaveCount(0);
3818
- logger.info('Verified credit balance panel for Trial plan');
3908
+ const badge = creditBalancePlanBadge(page);
3909
+ if (options === null || options === void 0 ? void 0 : options.planName) {
3910
+ await test$1.expect(badge).toHaveText(options.planName);
3911
+ }
3912
+ else {
3913
+ await test$1.expect(badge).toBeVisible();
3914
+ await test$1.expect(badge).not.toHaveText('Trial');
3915
+ }
3916
+ await expectStandardPlanButtons(panelButtons(panel), options);
3917
+ logger.info(`Verified credit balance panel for Free plan (hasPaymentMethod=${options === null || options === void 0 ? void 0 : options.hasPaymentMethod})`);
3819
3918
  }
3820
3919
  /**
3821
- * Premium plan UI: Upgrade Plan must NOT appear.
3822
- * - With payment method: Manage Usage + Add Credits both visible; Manage Billing hidden.
3823
- * - Without payment method: Manage Billing visible; Manage Usage + Add Credits hidden.
3920
+ * Trial UI: "Upgrade" only (it opens the plan picker). No Manage Usage /
3921
+ * Add Credits, and no Auto Recharge section.
3824
3922
  */
3825
- async function expectCreditBalancePanelForPremiumPlan(page, options) {
3923
+ async function expectCreditBalancePanelForTrialPlan(page) {
3826
3924
  const panel = await openCreditBalanceDropdown(page);
3827
- await test$1.expect(creditBalancePlanBadge(page)).toHaveText('Premium');
3828
- const btn = panelButtons(panel);
3829
- await test$1.expect(btn.upgradePlan).toHaveCount(0);
3830
- if (options.hasPaymentMethod) {
3831
- await test$1.expect(btn.manageUsage).toBeVisible();
3832
- await test$1.expect(btn.addCredits).toBeVisible();
3833
- await test$1.expect(btn.manageBilling).toHaveCount(0);
3834
- }
3835
- else {
3836
- await test$1.expect(btn.manageBilling).toBeVisible();
3837
- await test$1.expect(btn.manageUsage).toHaveCount(0);
3838
- await test$1.expect(btn.addCredits).toHaveCount(0);
3839
- }
3840
- logger.info(`Verified credit balance panel for Premium plan (hasPaymentMethod=${options.hasPaymentMethod})`);
3925
+ await test$1.expect(creditBalancePlanBadge(page)).toHaveText('Trial');
3926
+ await expectTrialButtons(panelButtons(panel));
3927
+ logger.info('Verified credit balance panel for Trial plan');
3841
3928
  }
3842
3929
  /**
3843
3930
  * Convenience: opens the dropdown, detects the active plan from the badge,
3844
3931
  * and runs the matching state assertions on the already-open panel. Returns
3845
3932
  * the detected plan label.
3846
3933
  *
3847
- * For Premium plans you may pass `hasPaymentMethod` to assert the specific
3848
- * sub-state; if omitted on Premium, only the "no Upgrade Plan button" check runs.
3934
+ * On the Free plan you may pass `hasPaymentMethod` to assert the specific
3935
+ * sub-state; if omitted, only the absence of "Upgrade" is checked.
3849
3936
  */
3850
3937
  async function expectCreditBalanceForCurrentPlan(page, options) {
3851
3938
  const panel = await openCreditBalanceDropdown(page);
@@ -3854,36 +3941,32 @@ async function expectCreditBalanceForCurrentPlan(page, options) {
3854
3941
  throw new Error('Credit balance plan badge was not found in the dropdown panel');
3855
3942
  }
3856
3943
  const btn = panelButtons(panel);
3857
- if (plan === 'Free') {
3858
- await test$1.expect(btn.autoRechargeHeading).toHaveCount(0);
3859
- await test$1.expect(btn.upgradePlan).toBeVisible();
3860
- await test$1.expect(btn.manageUsage).toHaveCount(0);
3861
- await test$1.expect(btn.addCredits).toHaveCount(0);
3862
- await test$1.expect(btn.manageBilling).toHaveCount(0);
3863
- }
3864
- else if (plan === 'Trial') {
3865
- await test$1.expect(btn.upgradePlan).toBeVisible();
3866
- await test$1.expect(btn.manageUsage).toHaveCount(0);
3867
- await test$1.expect(btn.addCredits).toHaveCount(0);
3868
- await test$1.expect(btn.manageBilling).toHaveCount(0);
3944
+ if (plan === 'Trial') {
3945
+ await expectTrialButtons(btn);
3869
3946
  }
3870
3947
  else {
3871
- // Premium
3872
- await test$1.expect(btn.upgradePlan).toHaveCount(0);
3873
- if ((options === null || options === void 0 ? void 0 : options.hasPaymentMethod) === true) {
3874
- await test$1.expect(btn.manageUsage).toBeVisible();
3875
- await test$1.expect(btn.addCredits).toBeVisible();
3876
- await test$1.expect(btn.manageBilling).toHaveCount(0);
3877
- }
3878
- else if ((options === null || options === void 0 ? void 0 : options.hasPaymentMethod) === false) {
3879
- await test$1.expect(btn.manageBilling).toBeVisible();
3880
- await test$1.expect(btn.manageUsage).toHaveCount(0);
3881
- await test$1.expect(btn.addCredits).toHaveCount(0);
3882
- }
3948
+ await expectStandardPlanButtons(btn, options);
3883
3949
  }
3884
3950
  logger.info(`Verified credit balance UI for plan="${plan}"`);
3885
3951
  return plan;
3886
3952
  }
3953
+ /**
3954
+ * Clicks "Upgrade" in the credit balance dropdown (free trial only) and waits
3955
+ * for the plan picker to show its plans.
3956
+ */
3957
+ async function openPlanPickerFromCreditBalance(page) {
3958
+ const panel = await openCreditBalanceDropdown(page);
3959
+ const btn = panelButtons(panel).upgrade;
3960
+ await test$1.expect(btn).toBeVisible();
3961
+ await btn.click();
3962
+ return waitForPlanPicker(page);
3963
+ }
3964
+ // Names from before the credits-only revamp, kept so existing suites still
3965
+ // import. Each points at the helper that covers the same state today.
3966
+ /** @deprecated The Free plan is now the free trial; use `expectCreditBalancePanelForTrialPlan`. */
3967
+ const expectCreditBalancePanelForFreePlan = expectCreditBalancePanelForTrialPlan;
3968
+ /** @deprecated The Premium plan is now the Free plan; use `expectCreditBalancePanelForStandardPlan`. */
3969
+ const expectCreditBalancePanelForPremiumPlan = expectCreditBalancePanelForStandardPlan;
3887
3970
 
3888
3971
  /**
3889
3972
  * Best-effort switch to the Edit Agent modal's category pill (Setup /
@@ -5353,29 +5436,28 @@ async function clearGradeResultOverride(page, email) {
5353
5436
  }
5354
5437
 
5355
5438
  const DEFAULT_TIMEOUT = 10000;
5356
- /** Locator for the Plan section card on the BillingTab. */
5357
- function billingPlanSection(page) {
5358
- return page.getByTestId('billing-plan-section');
5359
- }
5360
- /** Locator for the Credits section card on the BillingTab. */
5439
+ /** Locator for the Credits section card on the BillingTab (there is no Plan card). */
5361
5440
  function billingCreditsSection(page) {
5362
5441
  return page.getByTestId('billing-credits-section');
5363
5442
  }
5364
5443
  /** Locator for the Auto Recharge section card on the BillingTab.
5365
- * This section is only rendered for non-Free plans with a payment method on file.
5444
+ * Rendered whenever a payment method is on file (never on the free trial).
5366
5445
  */
5367
5446
  function billingAutoRechargeSection(page) {
5368
5447
  return page.getByTestId('billing-auto-recharge-section');
5369
5448
  }
5370
- /** Reads the plan label (Free / Trial / Premium) from the Plan section. */
5449
+ function billingUpgradeButton(page) {
5450
+ return billingCreditsSection(page).getByRole('button', { name: /^Upgrade$/ });
5451
+ }
5452
+ /**
5453
+ * Detects the billing state from the Credits section: "Trial" when it offers
5454
+ * "Upgrade" (the plan picker), "Free" otherwise. Returns null while the
5455
+ * section is not rendered (loading skeletons).
5456
+ */
5371
5457
  async function getBillingPlanLabel(page) {
5372
- const label = billingPlanSection(page).getByTestId('billing-plan-label');
5373
- if ((await label.count()) === 0)
5458
+ if ((await billingCreditsSection(page).count()) === 0)
5374
5459
  return null;
5375
- const text = (await label.innerText()).trim();
5376
- if (text === 'Free' || text === 'Trial' || text === 'Premium')
5377
- return text;
5378
- return null;
5460
+ return (await billingUpgradeButton(page).count()) > 0 ? 'Trial' : 'Free';
5379
5461
  }
5380
5462
  /** Reads the auto-recharge status badge (Enabled / Disabled) when the section is rendered. */
5381
5463
  async function getBillingAutoRechargeStatus(page) {
@@ -5387,62 +5469,39 @@ async function getBillingAutoRechargeStatus(page) {
5387
5469
  return text;
5388
5470
  return null;
5389
5471
  }
5390
- /** Waits for the BillingTab loading skeletons to clear by waiting for the Plan
5391
- * section card to mount. */
5472
+ /** Waits for the BillingTab loading skeletons to clear by waiting for the
5473
+ * Credits section card to mount. */
5392
5474
  async function waitForBillingTabReady(page) {
5393
- await test$1.expect(billingPlanSection(page)).toBeVisible({ timeout: 15000 });
5394
- }
5395
- /**
5396
- * Asserts the Plan section state for a given plan. Verifies:
5397
- * - The plan label text matches `options.plan`
5398
- * - The "Current" pill is visible
5399
- * - The Upgrade button is visible iff the plan is not Premium
5400
- */
5401
- async function expectBillingPlanSection(page, options) {
5402
- const section = billingPlanSection(page);
5403
- await test$1.expect(section).toBeVisible({ timeout: DEFAULT_TIMEOUT });
5404
- await test$1.expect(section.getByTestId('billing-plan-label')).toHaveText(options.plan);
5405
- await test$1.expect(section.getByText(/^Current$/)).toBeVisible();
5406
- const upgradeBtn = section.getByRole('button', { name: /^Upgrade$/ });
5407
- if (options.plan === 'Premium') {
5408
- await test$1.expect(upgradeBtn).toHaveCount(0);
5409
- }
5410
- else {
5411
- await test$1.expect(upgradeBtn).toBeVisible();
5412
- }
5475
+ await test$1.expect(billingCreditsSection(page)).toBeVisible({ timeout: 15000 });
5413
5476
  }
5414
5477
  /**
5415
5478
  * Asserts the Credits section state. Always verifies the "Available" stat row.
5416
5479
  * The action button rule mirrors the component:
5417
- * - Free plan → no Add Credits / Manage Billing button
5418
- * - Non-Free + hasPaymentMethod=true → "Add Credits" visible, "Manage Billing" absent
5419
- * - Non-Free + hasPaymentMethod=false → "Manage Billing" visible, "Add Credits" absent
5420
- * - Non-Free with hasPaymentMethod omitted → only the "Available" row is asserted
5480
+ * - Trial → "Upgrade" visible; no Add Credits
5481
+ * - Free → "Add Credits" visible whether or not a card is on file (the
5482
+ * dialog collects one on Stripe first when there is none); never
5483
+ * "Upgrade". `hasPaymentMethod` only matters to the Auto
5484
+ * Recharge section (see `expectBillingAutoRechargeSection`).
5421
5485
  */
5422
5486
  async function expectBillingCreditsSection(page, options) {
5423
5487
  const section = billingCreditsSection(page);
5424
5488
  await test$1.expect(section).toBeVisible({ timeout: DEFAULT_TIMEOUT });
5425
5489
  await test$1.expect(section.getByText(/^Available$/)).toBeVisible();
5490
+ const upgradeBtn = billingUpgradeButton(page);
5426
5491
  const addCreditsBtn = section.getByRole('button', { name: /^Add Credits$/ });
5427
- const manageBillingBtn = section.getByRole('button', { name: /^Manage Billing$/ });
5428
- if (options.plan === 'Free') {
5429
- await test$1.expect(addCreditsBtn).toHaveCount(0);
5430
- await test$1.expect(manageBillingBtn).toHaveCount(0);
5431
- }
5432
- else if (options.hasPaymentMethod === true) {
5433
- await test$1.expect(addCreditsBtn).toBeVisible();
5434
- await test$1.expect(manageBillingBtn).toHaveCount(0);
5435
- }
5436
- else if (options.hasPaymentMethod === false) {
5437
- await test$1.expect(manageBillingBtn).toBeVisible();
5492
+ if (options.plan === 'Trial') {
5493
+ await test$1.expect(upgradeBtn).toBeVisible();
5438
5494
  await test$1.expect(addCreditsBtn).toHaveCount(0);
5495
+ return;
5439
5496
  }
5497
+ await test$1.expect(upgradeBtn).toHaveCount(0);
5498
+ await test$1.expect(addCreditsBtn).toBeVisible();
5440
5499
  }
5441
5500
  /**
5442
- * Asserts the Auto Recharge section visibility. Section is rendered only when
5443
- * `hasPaymentMethod && !isFreePlan` in the component. Pass `expectVisible: false`
5444
- * to assert the section is absent. When visible and `status` is provided, also
5445
- * asserts the Enabled/Disabled badge text.
5501
+ * Asserts the Auto Recharge section visibility. The component renders it when
5502
+ * a payment method is on file and the account is not on the free trial. Pass
5503
+ * `expectVisible: false` to assert the section is absent. When visible and
5504
+ * `status` is provided, also asserts the Enabled/Disabled badge text.
5446
5505
  */
5447
5506
  async function expectBillingAutoRechargeSection(page, options) {
5448
5507
  const section = billingAutoRechargeSection(page);
@@ -5457,88 +5516,110 @@ async function expectBillingAutoRechargeSection(page, options) {
5457
5516
  }
5458
5517
  }
5459
5518
  /**
5460
- * Free plan: Plan="Free" with Upgrade visible; Credits section has no action;
5461
- * Auto Recharge section is hidden entirely (regardless of has_payment_method).
5462
- */
5463
- async function expectBillingTabForFreePlan(page) {
5464
- await expectBillingPlanSection(page, { plan: 'Free' });
5465
- await expectBillingCreditsSection(page, { plan: 'Free' });
5466
- await expectBillingAutoRechargeSection(page, { expectVisible: false });
5467
- logger.info('Verified billing tab for Free plan');
5468
- }
5469
- /**
5470
- * Trial plan: Plan="Trial" with Upgrade visible; Credits action depends on
5471
- * `hasPaymentMethod` (Add Credits when true, Manage Billing when false);
5472
- * Auto Recharge section is rendered iff `hasPaymentMethod` is true.
5519
+ * Free plan: no "Upgrade", "Add Credits" always; the Auto Recharge section
5520
+ * follows `hasPaymentMethod` (shown when true, absent when false). With
5521
+ * `hasPaymentMethod` omitted only the Credits card is verified.
5473
5522
  */
5474
- async function expectBillingTabForTrialPlan(page, options) {
5475
- await expectBillingPlanSection(page, { plan: 'Trial' });
5523
+ async function expectBillingTabForStandardPlan(page, options) {
5476
5524
  await expectBillingCreditsSection(page, {
5477
- plan: 'Trial',
5478
- hasPaymentMethod: options.hasPaymentMethod,
5525
+ plan: 'Free',
5526
+ hasPaymentMethod: options === null || options === void 0 ? void 0 : options.hasPaymentMethod,
5479
5527
  });
5480
- await expectBillingAutoRechargeSection(page, { expectVisible: options.hasPaymentMethod });
5481
- logger.info(`Verified billing tab for Trial plan (hasPaymentMethod=${options.hasPaymentMethod})`);
5528
+ if ((options === null || options === void 0 ? void 0 : options.hasPaymentMethod) !== undefined) {
5529
+ await expectBillingAutoRechargeSection(page, { expectVisible: options.hasPaymentMethod });
5530
+ }
5531
+ logger.info(`Verified billing tab for Free plan (hasPaymentMethod=${options === null || options === void 0 ? void 0 : options.hasPaymentMethod})`);
5482
5532
  }
5483
5533
  /**
5484
- * Premium plan: Plan="Premium" with Upgrade hidden; Credits action depends on
5485
- * `hasPaymentMethod` (Add Credits when true, Manage Billing when false);
5486
- * Auto Recharge section is rendered iff `hasPaymentMethod` is true.
5534
+ * Trial: "Upgrade" (opens the plan picker) is the only Credits action and the
5535
+ * Auto Recharge section is hidden entirely (regardless of has_payment_method).
5487
5536
  */
5488
- async function expectBillingTabForPremiumPlan(page, options) {
5489
- await expectBillingPlanSection(page, { plan: 'Premium' });
5490
- await expectBillingCreditsSection(page, {
5491
- plan: 'Premium',
5492
- hasPaymentMethod: options.hasPaymentMethod,
5493
- });
5494
- await expectBillingAutoRechargeSection(page, { expectVisible: options.hasPaymentMethod });
5495
- logger.info(`Verified billing tab for Premium plan (hasPaymentMethod=${options.hasPaymentMethod})`);
5537
+ async function expectBillingTabForTrialPlan(page) {
5538
+ await expectBillingCreditsSection(page, { plan: 'Trial' });
5539
+ await expectBillingAutoRechargeSection(page, { expectVisible: false });
5540
+ logger.info('Verified billing tab for Trial plan');
5496
5541
  }
5497
5542
  /**
5498
- * Convenience: detects the active plan from the Plan section badge and runs
5499
- * the matching state assertions. Returns the detected plan.
5543
+ * Convenience: detects the billing state from the Credits section and runs
5544
+ * the matching assertions. Returns the detected plan.
5500
5545
  *
5501
- * For non-Free plans, pass `hasPaymentMethod` to assert the Credits/Auto Recharge
5502
- * sub-states; if omitted, only the Plan section + base Credits row is verified.
5546
+ * On the Free plan, pass `hasPaymentMethod` to assert the Credits/Auto Recharge
5547
+ * sub-states; if omitted, only the base Credits row is verified.
5503
5548
  */
5504
5549
  async function expectBillingTabForCurrentPlan(page, options) {
5505
5550
  await waitForBillingTabReady(page);
5506
5551
  const plan = await getBillingPlanLabel(page);
5507
5552
  if (!plan) {
5508
- throw new Error('Could not detect plan label in BillingTab Plan section');
5509
- }
5510
- if (plan === 'Free') {
5511
- await expectBillingTabForFreePlan(page);
5553
+ throw new Error('Could not detect the billing state from the BillingTab Credits section');
5512
5554
  }
5513
- else if (plan === 'Trial') {
5514
- await expectBillingTabForTrialPlan(page, {
5515
- hasPaymentMethod: Boolean(options === null || options === void 0 ? void 0 : options.hasPaymentMethod),
5516
- });
5555
+ if (plan === 'Trial') {
5556
+ await expectBillingTabForTrialPlan(page);
5517
5557
  }
5518
5558
  else {
5519
- await expectBillingTabForPremiumPlan(page, {
5520
- hasPaymentMethod: Boolean(options === null || options === void 0 ? void 0 : options.hasPaymentMethod),
5521
- });
5559
+ await expectBillingTabForStandardPlan(page, options);
5522
5560
  }
5523
5561
  return plan;
5524
5562
  }
5525
- /** Clicks the Upgrade button in the Plan section (visible only on non-Premium plans). */
5563
+ /** Clicks the Upgrade button in the Credits section (free trial only); it opens the plan picker. */
5526
5564
  async function clickBillingUpgrade(page) {
5527
- const btn = billingPlanSection(page).getByRole('button', { name: /^Upgrade$/ });
5565
+ const btn = billingUpgradeButton(page);
5528
5566
  await test$1.expect(btn).toBeVisible({ timeout: DEFAULT_TIMEOUT });
5529
5567
  await btn.click();
5530
5568
  }
5531
- /** Clicks the Add Credits button in the Credits section (non-Free + has payment method). */
5569
+ /** Clicks Upgrade in the Credits section and waits for the plan picker to show its plans. */
5570
+ async function openPlanPickerFromBilling(page) {
5571
+ await clickBillingUpgrade(page);
5572
+ return waitForPlanPicker(page);
5573
+ }
5574
+ /** Clicks the Add Credits button in the Credits section (Free plan, with or without a card). */
5532
5575
  async function clickBillingAddCredits(page) {
5533
5576
  const btn = billingCreditsSection(page).getByRole('button', { name: /^Add Credits$/ });
5534
5577
  await test$1.expect(btn).toBeVisible({ timeout: DEFAULT_TIMEOUT });
5535
5578
  await btn.click();
5536
5579
  }
5537
- /** Clicks the Manage Billing button in the Credits section (non-Free + no payment method). */
5538
- async function clickBillingManageBilling(page) {
5539
- const btn = billingCreditsSection(page).getByRole('button', { name: /^Manage Billing$/ });
5580
+ /** Locator for the Add Credits dialog (opened from the Billing tab or the credit dropdown). */
5581
+ function addCreditsDialog(page) {
5582
+ return page.getByRole('dialog', { name: /^Add Credits$/ });
5583
+ }
5584
+ /**
5585
+ * Types a USD amount into the open Add Credits dialog and submits it. With a
5586
+ * payment method on file the submit button reads "Add Credits" and the charge
5587
+ * runs at once; without one it reads "Continue" and the page navigates to the
5588
+ * Stripe customer portal to save a card (the charge runs when Stripe returns
5589
+ * to the app). Returns once that finished (the dialog closed after the
5590
+ * charge, or the browser left for Stripe), with which of the two buttons was
5591
+ * pressed. A refused charge keeps the dialog open, so this then times out.
5592
+ */
5593
+ async function submitAddCreditsAmount(page, amountUsd) {
5594
+ const dialog = addCreditsDialog(page);
5595
+ await test$1.expect(dialog).toBeVisible({ timeout: DEFAULT_TIMEOUT });
5596
+ // $20 / $50 / $100 are boxes; any other amount goes through the "Other
5597
+ // amount" link, which reveals the "Amount (USD)" field.
5598
+ const preset = dialog.getByRole('button', { name: `$${amountUsd}`, exact: true });
5599
+ if ((await preset.count()) > 0) {
5600
+ await preset.click();
5601
+ }
5602
+ else {
5603
+ await dialog.getByRole('button', { name: /^Other amount$/ }).click();
5604
+ await dialog.getByLabel(/^Amount \(USD\)$/).fill(String(amountUsd));
5605
+ }
5606
+ const addCredits = dialog.getByRole('button', { name: /^Add Credits$/ });
5607
+ const label = (await addCredits.count()) > 0 ? 'Add Credits' : 'Continue';
5608
+ const btn = label === 'Add Credits' ? addCredits : dialog.getByRole('button', { name: /^Continue$/ });
5540
5609
  await test$1.expect(btn).toBeVisible({ timeout: DEFAULT_TIMEOUT });
5610
+ const appOrigin = new URL(page.url()).origin;
5541
5611
  await btn.click();
5612
+ if (label === 'Add Credits') {
5613
+ // The dialog closes only once the charge went through.
5614
+ await test$1.expect(dialog).toBeHidden({ timeout: 30000 });
5615
+ }
5616
+ else {
5617
+ await page.waitForURL((url) => url.origin !== appOrigin, {
5618
+ timeout: 30000,
5619
+ waitUntil: 'commit',
5620
+ });
5621
+ }
5622
+ return label;
5542
5623
  }
5543
5624
  /** Clicks the Manage Usage button in the Auto Recharge section. */
5544
5625
  async function clickBillingManageUsage(page) {
@@ -5546,6 +5627,23 @@ async function clickBillingManageUsage(page) {
5546
5627
  await test$1.expect(btn).toBeVisible({ timeout: DEFAULT_TIMEOUT });
5547
5628
  await btn.click();
5548
5629
  }
5630
+ // Names from before the credits-only revamp, kept so existing suites still
5631
+ // import. Each points at the helper that covers the same step today.
5632
+ /** @deprecated There is no Plan card any more; use `billingCreditsSection`. */
5633
+ const billingPlanSection = billingCreditsSection;
5634
+ /** @deprecated The plan now shows in the Credits card; use `expectBillingCreditsSection`. */
5635
+ const expectBillingPlanSection = expectBillingCreditsSection;
5636
+ /** @deprecated The Free plan is now the free trial; use `expectBillingTabForTrialPlan`. */
5637
+ const expectBillingTabForFreePlan = expectBillingTabForTrialPlan;
5638
+ /** @deprecated The Premium plan is now the Free plan; use `expectBillingTabForStandardPlan`. */
5639
+ const expectBillingTabForPremiumPlan = expectBillingTabForStandardPlan;
5640
+ /** @deprecated The trial button reads "Upgrade" and opens the plan picker; use `clickBillingUpgrade`. */
5641
+ const clickBillingUpgradeToStandard = clickBillingUpgrade;
5642
+ /**
5643
+ * @deprecated Manage Billing is gone; Add Credits collects a card when none is on file. Use
5644
+ * `clickBillingAddCredits`. Note it opens the Add Credits dialog and no longer leaves for Stripe.
5645
+ */
5646
+ const clickBillingManageBilling = clickBillingAddCredits;
5549
5647
 
5550
5648
  /**
5551
5649
  * Spend limits ("Billing") helpers — Playwright bindings for the LLM
@@ -5555,7 +5653,7 @@ async function clickBillingManageUsage(page) {
5555
5653
  * "This Agent" / "Per User" sub-tabs, the per-user table with a
5556
5654
  * three-dots row menu, and the add/edit user-limit modal (email-based
5557
5655
  * user picker), and
5558
- * - the **tenant settings Billing tab** with its "Plan & Credits" /
5656
+ * - the **tenant settings Billing tab** with its "Credits" /
5559
5657
  * "Spend Limits" / "Agent Limits" / "User Limits" tabs: the workspace-wide
5560
5658
  * limit section (`SpendLimitsSection`), the agent caps table
5561
5659
  * (`AgentLimitsSection`), and the per-user caps across all agents plus the
@@ -5590,7 +5688,7 @@ const SPEND_LIMITS_LABELS = {
5590
5688
  users: 'Per User',
5591
5689
  },
5592
5690
  tenantTabs: {
5593
- planAndCredits: 'Plan & Credits',
5691
+ planAndCredits: 'Credits',
5594
5692
  spendLimits: 'Spend Limits',
5595
5693
  agentLimits: 'Agent Limits',
5596
5694
  userLimits: 'User Limits',
@@ -5920,7 +6018,7 @@ async function deleteUserSpendLimit(page, username, scope) {
5920
6018
  logger.info(`Deleted user spend limit for "${username}"`);
5921
6019
  }
5922
6020
  // ---------------------------------------------------------------------------
5923
- // Tenant settings — Billing tab ("Plan & Credits" / "Spend Limits")
6021
+ // Tenant settings — Billing tab ("Credits" / "Spend Limits")
5924
6022
  // ---------------------------------------------------------------------------
5925
6023
  /** The tenant Billing tab's tablist (scoped by its aria-label). */
5926
6024
  function tenantBillingTablist(page) {
@@ -5946,8 +6044,9 @@ async function switchToWorkspaceSpendLimits(page) {
5946
6044
  logger.info('Switched to tenant Spend Limits tab');
5947
6045
  }
5948
6046
  /**
5949
- * Switch the tenant Billing tab back to "Plan & Credits". Completion is
5950
- * gated on the Plan section rendering.
6047
+ * Switch the tenant Billing tab back to "Credits" (the first sub-tab, which
6048
+ * used to be "Plan & Credits"). Completion is gated on the Credits section
6049
+ * rendering.
5951
6050
  */
5952
6051
  async function switchToPlanAndCredits(page) {
5953
6052
  const tab = tenantBillingTablist(page).getByRole('tab', {
@@ -5956,8 +6055,8 @@ async function switchToPlanAndCredits(page) {
5956
6055
  });
5957
6056
  await test$1.expect(tab).toBeVisible({ timeout: UI_TIMEOUT });
5958
6057
  await tab.click();
5959
- await test$1.expect(page.getByTestId('billing-plan-section')).toBeVisible({ timeout: UI_TIMEOUT });
5960
- logger.info('Switched to tenant Plan & Credits tab');
6058
+ await test$1.expect(page.getByTestId('billing-credits-section')).toBeVisible({ timeout: UI_TIMEOUT });
6059
+ logger.info('Switched to tenant Credits tab');
5961
6060
  }
5962
6061
  /**
5963
6062
  * Create or update the workspace-wide spend limit (switches to the Spend
@@ -9059,6 +9158,7 @@ exports.SUPPORT_LABELS = SUPPORT_LABELS;
9059
9158
  exports.TASKS_LABELS = TASKS_LABELS;
9060
9159
  exports.VOICE_LABELS = VOICE_LABELS;
9061
9160
  exports.addAgentMemoryFromPopup = addAgentMemoryFromPopup;
9161
+ exports.addCreditsDialog = addCreditsDialog;
9062
9162
  exports.addGraderCriterion = addGraderCriterion;
9063
9163
  exports.addManualScore = addManualScore;
9064
9164
  exports.addMemory = addMemory;
@@ -9090,6 +9190,7 @@ exports.cancelNewInstanceDialog = cancelNewInstanceDialog;
9090
9190
  exports.cancelStartEvaluation = cancelStartEvaluation;
9091
9191
  exports.checkAdminStatus = checkAdminStatus;
9092
9192
  exports.checkRunStatus = checkRunStatus;
9193
+ exports.choosePlan = choosePlan;
9093
9194
  exports.clearAgentLimitsFilter = clearAgentLimitsFilter;
9094
9195
  exports.clearAgentMemoriesFilter = clearAgentMemoriesFilter;
9095
9196
  exports.clearDateRangeFilter = clearDateRangeFilter;
@@ -9103,6 +9204,7 @@ exports.clickBillingAddCredits = clickBillingAddCredits;
9103
9204
  exports.clickBillingManageBilling = clickBillingManageBilling;
9104
9205
  exports.clickBillingManageUsage = clickBillingManageUsage;
9105
9206
  exports.clickBillingUpgrade = clickBillingUpgrade;
9207
+ exports.clickBillingUpgradeToStandard = clickBillingUpgradeToStandard;
9106
9208
  exports.clickChatPrivacyToggle = clickChatPrivacyToggle;
9107
9209
  exports.clickDownloadAgain = clickDownloadAgain;
9108
9210
  exports.clickManualDownloadLink = clickManualDownloadLink;
@@ -9115,6 +9217,7 @@ exports.closeCreditBalanceDropdown = closeCreditBalanceDropdown;
9115
9217
  exports.closeEvaluationDetailDialog = closeEvaluationDetailDialog;
9116
9218
  exports.closeKeyDetail = closeKeyDetail;
9117
9219
  exports.closeManageBenchmarksDialog = closeManageBenchmarksDialog;
9220
+ exports.closePlanPicker = closePlanPicker;
9118
9221
  exports.closeUserMemoriesPopup = closeUserMemoriesPopup;
9119
9222
  exports.closeWithEsc = closeWithEsc;
9120
9223
  exports.confirmEnableChatPrivacyMidSession = confirmEnableChatPrivacyMidSession;
@@ -9179,6 +9282,7 @@ exports.expectBillingPlanSection = expectBillingPlanSection;
9179
9282
  exports.expectBillingTabForCurrentPlan = expectBillingTabForCurrentPlan;
9180
9283
  exports.expectBillingTabForFreePlan = expectBillingTabForFreePlan;
9181
9284
  exports.expectBillingTabForPremiumPlan = expectBillingTabForPremiumPlan;
9285
+ exports.expectBillingTabForStandardPlan = expectBillingTabForStandardPlan;
9182
9286
  exports.expectBillingTabForTrialPlan = expectBillingTabForTrialPlan;
9183
9287
  exports.expectCallConfigVisible = expectCallConfigVisible;
9184
9288
  exports.expectCallConfigVoiceTriggerShows = expectCallConfigVoiceTriggerShows;
@@ -9191,6 +9295,7 @@ exports.expectCompletedTasks = expectCompletedTasks;
9191
9295
  exports.expectCreditBalanceForCurrentPlan = expectCreditBalanceForCurrentPlan;
9192
9296
  exports.expectCreditBalancePanelForFreePlan = expectCreditBalancePanelForFreePlan;
9193
9297
  exports.expectCreditBalancePanelForPremiumPlan = expectCreditBalancePanelForPremiumPlan;
9298
+ exports.expectCreditBalancePanelForStandardPlan = expectCreditBalancePanelForStandardPlan;
9194
9299
  exports.expectCreditBalancePanelForTrialPlan = expectCreditBalancePanelForTrialPlan;
9195
9300
  exports.expectCreditBalanceVisibilityForTenant = expectCreditBalanceVisibilityForTenant;
9196
9301
  exports.expectDetailWaitingForTraces = expectDetailWaitingForTraces;
@@ -9223,6 +9328,7 @@ exports.expectNoLogsForSelectedTask = expectNoLogsForSelectedTask;
9223
9328
  exports.expectNoRepliesYet = expectNoRepliesYet;
9224
9329
  exports.expectNoTickets = expectNoTickets;
9225
9330
  exports.expectOutputFilterEnabled = expectOutputFilterEnabled;
9331
+ exports.expectPlanPicker = expectPlanPicker;
9226
9332
  exports.expectPrivacyFieldsHidden = expectPrivacyFieldsHidden;
9227
9333
  exports.expectPrivacyFieldsVisible = expectPrivacyFieldsVisible;
9228
9334
  exports.expectPrivateModeSelected = expectPrivateModeSelected;
@@ -9346,6 +9452,7 @@ exports.getMentorIdFromUrl = getMentorIdFromUrl;
9346
9452
  exports.getNewEvaluationButton = getNewEvaluationButton;
9347
9453
  exports.getOutputFilterSwitch = getOutputFilterSwitch;
9348
9454
  exports.getPaginationInfo = getPaginationInfo;
9455
+ exports.getPlanPickerKeys = getPlanPickerKeys;
9349
9456
  exports.getPrivateModeCard = getPrivateModeCard;
9350
9457
  exports.getProfileDialog = getProfileDialog;
9351
9458
  exports.getReplyComposer = getReplyComposer;
@@ -9448,6 +9555,8 @@ exports.openNewInstanceDialog = openNewInstanceDialog;
9448
9555
  exports.openNewReviewForRun = openNewReviewForRun;
9449
9556
  exports.openNewReviewFromDetail = openNewReviewFromDetail;
9450
9557
  exports.openNewSkillDialog = openNewSkillDialog;
9558
+ exports.openPlanPickerFromBilling = openPlanPickerFromBilling;
9559
+ exports.openPlanPickerFromCreditBalance = openPlanPickerFromCreditBalance;
9451
9560
  exports.openRunActionsMenu = openRunActionsMenu;
9452
9561
  exports.openRunResults = openRunResults;
9453
9562
  exports.openScheduleTaskDialog = openScheduleTaskDialog;
@@ -9460,6 +9569,8 @@ exports.openUserMemoriesPopup = openUserMemoriesPopup;
9460
9569
  exports.openVoiceInstructionsEditor = openVoiceInstructionsEditor;
9461
9570
  exports.overrideGradeResult = overrideGradeResult;
9462
9571
  exports.parseReportUrlParams = parseReportUrlParams;
9572
+ exports.planCard = planCard;
9573
+ exports.planPickerDialog = planPickerDialog;
9463
9574
  exports.previewCallConfigVoiceInline = previewCallConfigVoiceInline;
9464
9575
  exports.previewMentorVoiceInline = previewMentorVoiceInline;
9465
9576
  exports.previewVoice = previewVoice;
@@ -9552,6 +9663,7 @@ exports.signUpWithEmailAndPassword = signUpWithEmailAndPassword;
9552
9663
  exports.spendLimitsTabBody = spendLimitsTabBody;
9553
9664
  exports.startEvaluation = startEvaluation;
9554
9665
  exports.startHistoryExport = startHistoryExport;
9666
+ exports.submitAddCreditsAmount = submitAddCreditsAmount;
9555
9667
  exports.submitLinkModal = submitLinkModal;
9556
9668
  exports.submitLlmJudge = submitLlmJudge;
9557
9669
  exports.submitToolModal = submitToolModal;
@@ -9636,6 +9748,7 @@ exports.waitForElementStable = waitForElementStable;
9636
9748
  exports.waitForLinkReady = waitForLinkReady;
9637
9749
  exports.waitForPageLoad = waitForPageLoad;
9638
9750
  exports.waitForPageReady = waitForPageReady;
9751
+ exports.waitForPlanPicker = waitForPlanPicker;
9639
9752
  exports.waitForReportDownload = waitForReportDownload;
9640
9753
  exports.waitForTicketInList = waitForTicketInList;
9641
9754
  exports.workspaceSpendLimitSection = workspaceSpendLimitSection;