@schematichq/schematic-components 2.23.0 → 2.24.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.
@@ -5959,7 +5959,7 @@ var i;
5959
5959
  var c = "undefined" != typeof process && void 0 !== process.env && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled";
5960
5960
  var a = "active";
5961
5961
  var l = "data-styled-version";
5962
- var u = "6.5.0";
5962
+ var u = "6.5.3";
5963
5963
  var h = "/*!sc*/\n";
5964
5964
  var d = "undefined" != typeof window && "undefined" != typeof document;
5965
5965
  function p(e2) {
@@ -6553,23 +6553,20 @@ function ut(o, s, r2) {
6553
6553
  return r4 === n3;
6554
6554
  })(n2[0], s3, n2[4])) y3 = n2[5], g3 = n2[6];
6555
6555
  else {
6556
- y3 = (function(e3, t3, n4) {
6557
- const o4 = Object.assign(Object.assign({}, t3), { className: void 0, theme: n4 }), s4 = e3.length > 1;
6558
- for (let n5 = 0; n5 < e3.length; n5++) {
6559
- const r4 = e3[n5], i4 = re(r4) ? r4(s4 ? Object.assign({}, o4) : o4) : r4;
6560
- for (const e4 in i4) "className" === e4 ? o4.className = ae(o4.className, i4[e4]) : "style" === e4 ? o4.style = Object.assign(Object.assign({}, o4.style), i4[e4]) : e4 in t3 && void 0 === t3[e4] || (o4[e4] = i4[e4]);
6556
+ y3 = (function(e3, t4, n3) {
6557
+ const o4 = Object.assign(Object.assign({}, t4), { className: void 0, theme: n3 }), s4 = e3.length > 1;
6558
+ for (let n4 = 0; n4 < e3.length; n4++) {
6559
+ const r4 = e3[n4], i4 = re(r4) ? r4(s4 ? Object.assign({}, o4) : o4) : r4;
6560
+ for (const e4 in i4) "className" === e4 ? o4.className = ae(o4.className, i4[e4]) : "style" === e4 ? o4.style = Object.assign(Object.assign({}, o4.style), i4[e4]) : e4 in t4 && void 0 === t4[e4] || (o4[e4] = i4[e4]);
6561
6561
  }
6562
- return "className" in t3 && "string" == typeof t3.className && (o4.className = ae(o4.className, t3.className)), o4;
6563
- })(i3, s3, m3), g3 = (function(e3, n4, o4, s4) {
6564
- const r4 = e3.generateAndInjectStyles(n4, o4, s4);
6565
- return import_react13.default.useDebugValue && import_react13.default.useDebugValue(r4), r4;
6566
- })(c3, y3, p3.styleSheet, p3.stylis);
6567
- let n3 = 0;
6568
- for (const e3 in s3) it.call(s3, e3) && n3++;
6569
- e2.current = [s3, m3, p3.styleSheet, p3.stylis, n3, y3, g3, c3];
6562
+ return "className" in t4 && "string" == typeof t4.className && (o4.className = ae(o4.className, t4.className)), o4;
6563
+ })(i3, s3, m3), g3 = c3.generateAndInjectStyles(y3, p3.styleSheet, p3.stylis);
6564
+ let t3 = 0;
6565
+ for (const e3 in s3) it.call(s3, e3) && t3++;
6566
+ e2.current = [s3, m3, p3.styleSheet, p3.stylis, t3, y3, g3, c3];
6570
6567
  }
6571
6568
  }
6572
- o3.warnTooManyClasses && o3.warnTooManyClasses(g3);
6569
+ import_react13.default.useDebugValue && import_react13.default.useDebugValue(g3), o3.warnTooManyClasses && o3.warnTooManyClasses(g3);
6573
6570
  const v2 = y3.as || h3, S2 = (function(t3, n2, o4, s4) {
6574
6571
  const r4 = {};
6575
6572
  for (const i4 in t3) void 0 === t3[i4] || "$" === i4[0] || "as" === i4 || "theme" === i4 && t3.theme === o4 || ("forwardedAs" === i4 ? r4.as = t3.forwardedAs : s4 && !s4(i4, n2) || (r4[i4] = t3[i4], s4 || false || isPropValid(i4) || (lt || (lt = /* @__PURE__ */ new Set())).has(i4) || !L(n2) || n2.includes("-") || (lt.add(i4), console.warn(`styled-components: it looks like an unknown prop "${i4}" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via \`<StyleSheetManager shouldForwardProp={...}>\` (connect an API like \`@emotion/is-prop-valid\`) or consider using transient props (\`$\` prefix for automatic filtering.)`))));
@@ -13186,30 +13183,29 @@ function isAutoTopupOff(grant) {
13186
13183
  function isSelfServiceAutoTopupAvailable(grant) {
13187
13184
  return !!grant?.billingCreditAutoTopupSelfService && !isAutoTopupOff(grant);
13188
13185
  }
13189
- function isBundlePurchaseOff(grant) {
13190
- return grant?.billingCreditCanBuyBundles === false;
13191
- }
13192
- function getBundleOffCreditIds(grants) {
13193
- const ids = /* @__PURE__ */ new Set();
13194
- (grants ?? []).forEach((grant) => {
13195
- if (isBundlePurchaseOff(grant)) {
13196
- ids.add(grant.creditId);
13197
- }
13198
- });
13199
- return ids;
13186
+ function isBundleCompatibleWithPlan(bundle, planId) {
13187
+ const compatiblePlanIds = bundle.compatiblePlanIds ?? [];
13188
+ if (compatiblePlanIds.length === 0) {
13189
+ return true;
13190
+ }
13191
+ return !!planId && compatiblePlanIds.includes(planId);
13200
13192
  }
13201
- function filterCreditBundles(grants, bundles) {
13202
- const bundleOffCreditIds = getBundleOffCreditIds(grants);
13193
+ function filterCreditBundles(bundles, planId) {
13203
13194
  return (bundles ?? []).filter(
13204
- (bundle) => !bundleOffCreditIds.has(bundle.creditId)
13195
+ (bundle) => isBundleCompatibleWithPlan(bundle, planId)
13205
13196
  );
13206
13197
  }
13207
- function deriveCreditBundles(grants, bundles, counts) {
13208
- return filterCreditBundles(grants, bundles).map((bundle) => ({
13198
+ function deriveCreditBundles(bundles, planId, counts) {
13199
+ return filterCreditBundles(bundles, planId).map((bundle) => ({
13209
13200
  ...bundle,
13210
13201
  count: counts[bundle.id] ?? 0
13211
13202
  }));
13212
13203
  }
13204
+ function getPurchasableCreditIds(bundles, planId) {
13205
+ return new Set(
13206
+ filterCreditBundles(bundles, planId).map((bundle) => bundle.creditId)
13207
+ );
13208
+ }
13213
13209
  function getAutoTopupThresholdCredits(grant) {
13214
13210
  return grant?.companyAutoTopupThresholdCredits ?? grant?.billingCreditAutoTopupThresholdCredits;
13215
13211
  }
@@ -14532,7 +14528,7 @@ var reducer = (state, action) => {
14532
14528
  // src/context/EmbedProvider.tsx
14533
14529
  var import_jsx_runtime3 = require("react/jsx-runtime");
14534
14530
  var getCustomHeaders = (sessionId) => ({
14535
- "X-Schematic-Components-Version": "2.23.0",
14531
+ "X-Schematic-Components-Version": "2.24.0",
14536
14532
  "X-Schematic-Session-ID": sessionId
14537
14533
  });
14538
14534
  var normalizeCurrencyFilter = (filter2) => {
@@ -18903,14 +18899,14 @@ var CheckoutDialog = ({ top }) => {
18903
18899
  const isIndividualBundlePurchase = data?.checkoutSettings.bundlePurchaseBehavior === CheckoutBundlePurchaseBehavior.Individual;
18904
18900
  const [bundleCounts, setBundleCounts] = (0, import_react39.useState)({});
18905
18901
  const bundleCountsRef = (0, import_react39.useRef)(bundleCounts);
18906
- const bundleGatingGrants = selectedPlan?.includedCreditGrants ?? data?.company?.plan?.includedCreditGrants;
18902
+ const bundleGatingPlanId = selectedPlan?.id ?? data?.company?.plan?.id;
18907
18903
  const creditBundles = (0, import_react39.useMemo)(() => {
18908
18904
  return deriveCreditBundles(
18909
- bundleGatingGrants,
18910
18905
  data?.creditBundles,
18906
+ bundleGatingPlanId,
18911
18907
  bundleCounts
18912
18908
  );
18913
- }, [bundleGatingGrants, data?.creditBundles, bundleCounts]);
18909
+ }, [bundleGatingPlanId, data?.creditBundles, bundleCounts]);
18914
18910
  const selectedPlanPriceId = (0, import_react39.useMemo)(() => {
18915
18911
  if (!selectedPlan) {
18916
18912
  return void 0;
@@ -19241,8 +19237,8 @@ var CheckoutDialog = ({ top }) => {
19241
19237
  const code = typeof updates.promoCode !== "undefined" ? updates.promoCode : promoCode;
19242
19238
  const skipTrial = !(updates.shouldTrial ?? shouldTrial);
19243
19239
  const resolvedCreditBundles = filterCreditBundles(
19244
- plan?.includedCreditGrants ?? data?.company?.plan?.includedCreditGrants,
19245
- updates.creditBundles || creditBundles
19240
+ updates.creditBundles || creditBundles,
19241
+ plan?.id ?? data?.company?.plan?.id
19246
19242
  );
19247
19243
  const isCreditOnly = !data?.company?.billingSubscription && !planPriceId && resolvedCreditBundles.some((bundle) => bundle.count > 0) && !(updates.addOns || addOns).some(
19248
19244
  (addOn) => addOn.isSelected && !!getAddOnPrice(addOn, period, resolvedCurrency)?.id
@@ -19384,6 +19380,7 @@ var CheckoutDialog = ({ top }) => {
19384
19380
  [
19385
19381
  t3,
19386
19382
  addOnCompatibilityLookup,
19383
+ data?.company?.plan?.id,
19387
19384
  data?.company?.plan?.includedCreditGrants,
19388
19385
  data?.company?.billingSubscription,
19389
19386
  previewCheckout,
@@ -19667,13 +19664,13 @@ var CheckoutDialog = ({ top }) => {
19667
19664
  setBundleCounts(nextCounts);
19668
19665
  debouncedPreviewCheckout({
19669
19666
  creditBundles: deriveCreditBundles(
19670
- bundleGatingGrants,
19671
19667
  data?.creditBundles,
19668
+ bundleGatingPlanId,
19672
19669
  nextCounts
19673
19670
  )
19674
19671
  });
19675
19672
  },
19676
- [bundleGatingGrants, data?.creditBundles, debouncedPreviewCheckout]
19673
+ [bundleGatingPlanId, data?.creditBundles, debouncedPreviewCheckout]
19677
19674
  );
19678
19675
  const toggleCreditBundle = (0, import_react39.useCallback)(
19679
19676
  (id) => {
@@ -19687,13 +19684,13 @@ var CheckoutDialog = ({ top }) => {
19687
19684
  setBundleCounts(nextCounts);
19688
19685
  handlePreviewCheckout({
19689
19686
  creditBundles: deriveCreditBundles(
19690
- bundleGatingGrants,
19691
19687
  data?.creditBundles,
19688
+ bundleGatingPlanId,
19692
19689
  nextCounts
19693
19690
  )
19694
19691
  });
19695
19692
  },
19696
- [bundleGatingGrants, data?.creditBundles, handlePreviewCheckout]
19693
+ [bundleGatingPlanId, data?.creditBundles, handlePreviewCheckout]
19697
19694
  );
19698
19695
  const updateAddOnEntitlementQuantity = (0, import_react39.useCallback)(
19699
19696
  (id, updatedQuantity) => {
@@ -24221,9 +24218,9 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
24221
24218
  },
24222
24219
  [data?.featureUsage?.features]
24223
24220
  );
24224
- const bundleOffCreditIds = (0, import_react55.useMemo)(
24225
- () => getBundleOffCreditIds(data?.company?.plan?.includedCreditGrants),
24226
- [data?.company?.plan?.includedCreditGrants]
24221
+ const purchasableCreditIds = (0, import_react55.useMemo)(
24222
+ () => getPurchasableCreditIds(data?.creditBundles, data?.company?.plan?.id),
24223
+ [data?.creditBundles, data?.company?.plan?.id]
24227
24224
  );
24228
24225
  const [expandedCreditIds, setExpandedCreditIds] = (0, import_react55.useState)(
24229
24226
  () => /* @__PURE__ */ new Set()
@@ -24401,7 +24398,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
24401
24398
  )]
24402
24399
  }
24403
24400
  ),
24404
- canCheckout && !bundleOffCreditIds.has(credit.id) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
24401
+ canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
24405
24402
  Button,
24406
24403
  {
24407
24404
  type: "button",
@@ -24967,7 +24964,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
24967
24964
  }
24968
24965
  stripe._registerWrapper({
24969
24966
  name: "stripe-js",
24970
- version: "9.12.1",
24967
+ version: "9.13.0",
24971
24968
  startTime
24972
24969
  });
24973
24970
  };
@@ -25045,7 +25042,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
25045
25042
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
25046
25043
  var expectedVersion = RELEASE_TRAIN;
25047
25044
  if (isTestKey && version !== expectedVersion) {
25048
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.12.1", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
25045
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.13.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
25049
25046
  }
25050
25047
  var stripe = maybeStripe.apply(void 0, args);
25051
25048
  registerWrapper(stripe, startTime);
@@ -5868,7 +5868,7 @@ var i;
5868
5868
  var c = "undefined" != typeof process && void 0 !== process.env && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled";
5869
5869
  var a = "active";
5870
5870
  var l = "data-styled-version";
5871
- var u = "6.5.0";
5871
+ var u = "6.5.3";
5872
5872
  var h = "/*!sc*/\n";
5873
5873
  var d = "undefined" != typeof window && "undefined" != typeof document;
5874
5874
  function p(e2) {
@@ -6462,23 +6462,20 @@ function ut(o, s, r2) {
6462
6462
  return r4 === n3;
6463
6463
  })(n2[0], s3, n2[4])) y3 = n2[5], g3 = n2[6];
6464
6464
  else {
6465
- y3 = (function(e3, t3, n4) {
6466
- const o4 = Object.assign(Object.assign({}, t3), { className: void 0, theme: n4 }), s4 = e3.length > 1;
6467
- for (let n5 = 0; n5 < e3.length; n5++) {
6468
- const r4 = e3[n5], i4 = re(r4) ? r4(s4 ? Object.assign({}, o4) : o4) : r4;
6469
- for (const e4 in i4) "className" === e4 ? o4.className = ae(o4.className, i4[e4]) : "style" === e4 ? o4.style = Object.assign(Object.assign({}, o4.style), i4[e4]) : e4 in t3 && void 0 === t3[e4] || (o4[e4] = i4[e4]);
6465
+ y3 = (function(e3, t4, n3) {
6466
+ const o4 = Object.assign(Object.assign({}, t4), { className: void 0, theme: n3 }), s4 = e3.length > 1;
6467
+ for (let n4 = 0; n4 < e3.length; n4++) {
6468
+ const r4 = e3[n4], i4 = re(r4) ? r4(s4 ? Object.assign({}, o4) : o4) : r4;
6469
+ for (const e4 in i4) "className" === e4 ? o4.className = ae(o4.className, i4[e4]) : "style" === e4 ? o4.style = Object.assign(Object.assign({}, o4.style), i4[e4]) : e4 in t4 && void 0 === t4[e4] || (o4[e4] = i4[e4]);
6470
6470
  }
6471
- return "className" in t3 && "string" == typeof t3.className && (o4.className = ae(o4.className, t3.className)), o4;
6472
- })(i3, s3, m3), g3 = (function(e3, n4, o4, s4) {
6473
- const r4 = e3.generateAndInjectStyles(n4, o4, s4);
6474
- return t2.useDebugValue && t2.useDebugValue(r4), r4;
6475
- })(c3, y3, p3.styleSheet, p3.stylis);
6476
- let n3 = 0;
6477
- for (const e3 in s3) it.call(s3, e3) && n3++;
6478
- e2.current = [s3, m3, p3.styleSheet, p3.stylis, n3, y3, g3, c3];
6471
+ return "className" in t4 && "string" == typeof t4.className && (o4.className = ae(o4.className, t4.className)), o4;
6472
+ })(i3, s3, m3), g3 = c3.generateAndInjectStyles(y3, p3.styleSheet, p3.stylis);
6473
+ let t3 = 0;
6474
+ for (const e3 in s3) it.call(s3, e3) && t3++;
6475
+ e2.current = [s3, m3, p3.styleSheet, p3.stylis, t3, y3, g3, c3];
6479
6476
  }
6480
6477
  }
6481
- o3.warnTooManyClasses && o3.warnTooManyClasses(g3);
6478
+ t2.useDebugValue && t2.useDebugValue(g3), o3.warnTooManyClasses && o3.warnTooManyClasses(g3);
6482
6479
  const v2 = y3.as || h3, S2 = (function(t3, n2, o4, s4) {
6483
6480
  const r4 = {};
6484
6481
  for (const i4 in t3) void 0 === t3[i4] || "$" === i4[0] || "as" === i4 || "theme" === i4 && t3.theme === o4 || ("forwardedAs" === i4 ? r4.as = t3.forwardedAs : s4 && !s4(i4, n2) || (r4[i4] = t3[i4], s4 || false || isPropValid(i4) || (lt || (lt = /* @__PURE__ */ new Set())).has(i4) || !L(n2) || n2.includes("-") || (lt.add(i4), console.warn(`styled-components: it looks like an unknown prop "${i4}" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via \`<StyleSheetManager shouldForwardProp={...}>\` (connect an API like \`@emotion/is-prop-valid\`) or consider using transient props (\`$\` prefix for automatic filtering.)`))));
@@ -13095,30 +13092,29 @@ function isAutoTopupOff(grant) {
13095
13092
  function isSelfServiceAutoTopupAvailable(grant) {
13096
13093
  return !!grant?.billingCreditAutoTopupSelfService && !isAutoTopupOff(grant);
13097
13094
  }
13098
- function isBundlePurchaseOff(grant) {
13099
- return grant?.billingCreditCanBuyBundles === false;
13100
- }
13101
- function getBundleOffCreditIds(grants) {
13102
- const ids = /* @__PURE__ */ new Set();
13103
- (grants ?? []).forEach((grant) => {
13104
- if (isBundlePurchaseOff(grant)) {
13105
- ids.add(grant.creditId);
13106
- }
13107
- });
13108
- return ids;
13095
+ function isBundleCompatibleWithPlan(bundle, planId) {
13096
+ const compatiblePlanIds = bundle.compatiblePlanIds ?? [];
13097
+ if (compatiblePlanIds.length === 0) {
13098
+ return true;
13099
+ }
13100
+ return !!planId && compatiblePlanIds.includes(planId);
13109
13101
  }
13110
- function filterCreditBundles(grants, bundles) {
13111
- const bundleOffCreditIds = getBundleOffCreditIds(grants);
13102
+ function filterCreditBundles(bundles, planId) {
13112
13103
  return (bundles ?? []).filter(
13113
- (bundle) => !bundleOffCreditIds.has(bundle.creditId)
13104
+ (bundle) => isBundleCompatibleWithPlan(bundle, planId)
13114
13105
  );
13115
13106
  }
13116
- function deriveCreditBundles(grants, bundles, counts) {
13117
- return filterCreditBundles(grants, bundles).map((bundle) => ({
13107
+ function deriveCreditBundles(bundles, planId, counts) {
13108
+ return filterCreditBundles(bundles, planId).map((bundle) => ({
13118
13109
  ...bundle,
13119
13110
  count: counts[bundle.id] ?? 0
13120
13111
  }));
13121
13112
  }
13113
+ function getPurchasableCreditIds(bundles, planId) {
13114
+ return new Set(
13115
+ filterCreditBundles(bundles, planId).map((bundle) => bundle.creditId)
13116
+ );
13117
+ }
13122
13118
  function getAutoTopupThresholdCredits(grant) {
13123
13119
  return grant?.companyAutoTopupThresholdCredits ?? grant?.billingCreditAutoTopupThresholdCredits;
13124
13120
  }
@@ -14441,7 +14437,7 @@ var reducer = (state, action) => {
14441
14437
  // src/context/EmbedProvider.tsx
14442
14438
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
14443
14439
  var getCustomHeaders = (sessionId) => ({
14444
- "X-Schematic-Components-Version": "2.23.0",
14440
+ "X-Schematic-Components-Version": "2.24.0",
14445
14441
  "X-Schematic-Session-ID": sessionId
14446
14442
  });
14447
14443
  var normalizeCurrencyFilter = (filter2) => {
@@ -18831,14 +18827,14 @@ var CheckoutDialog = ({ top }) => {
18831
18827
  const isIndividualBundlePurchase = data?.checkoutSettings.bundlePurchaseBehavior === CheckoutBundlePurchaseBehavior.Individual;
18832
18828
  const [bundleCounts, setBundleCounts] = useState9({});
18833
18829
  const bundleCountsRef = useRef6(bundleCounts);
18834
- const bundleGatingGrants = selectedPlan?.includedCreditGrants ?? data?.company?.plan?.includedCreditGrants;
18830
+ const bundleGatingPlanId = selectedPlan?.id ?? data?.company?.plan?.id;
18835
18831
  const creditBundles = useMemo15(() => {
18836
18832
  return deriveCreditBundles(
18837
- bundleGatingGrants,
18838
18833
  data?.creditBundles,
18834
+ bundleGatingPlanId,
18839
18835
  bundleCounts
18840
18836
  );
18841
- }, [bundleGatingGrants, data?.creditBundles, bundleCounts]);
18837
+ }, [bundleGatingPlanId, data?.creditBundles, bundleCounts]);
18842
18838
  const selectedPlanPriceId = useMemo15(() => {
18843
18839
  if (!selectedPlan) {
18844
18840
  return void 0;
@@ -19169,8 +19165,8 @@ var CheckoutDialog = ({ top }) => {
19169
19165
  const code = typeof updates.promoCode !== "undefined" ? updates.promoCode : promoCode;
19170
19166
  const skipTrial = !(updates.shouldTrial ?? shouldTrial);
19171
19167
  const resolvedCreditBundles = filterCreditBundles(
19172
- plan?.includedCreditGrants ?? data?.company?.plan?.includedCreditGrants,
19173
- updates.creditBundles || creditBundles
19168
+ updates.creditBundles || creditBundles,
19169
+ plan?.id ?? data?.company?.plan?.id
19174
19170
  );
19175
19171
  const isCreditOnly = !data?.company?.billingSubscription && !planPriceId && resolvedCreditBundles.some((bundle) => bundle.count > 0) && !(updates.addOns || addOns).some(
19176
19172
  (addOn) => addOn.isSelected && !!getAddOnPrice(addOn, period, resolvedCurrency)?.id
@@ -19312,6 +19308,7 @@ var CheckoutDialog = ({ top }) => {
19312
19308
  [
19313
19309
  t3,
19314
19310
  addOnCompatibilityLookup,
19311
+ data?.company?.plan?.id,
19315
19312
  data?.company?.plan?.includedCreditGrants,
19316
19313
  data?.company?.billingSubscription,
19317
19314
  previewCheckout,
@@ -19595,13 +19592,13 @@ var CheckoutDialog = ({ top }) => {
19595
19592
  setBundleCounts(nextCounts);
19596
19593
  debouncedPreviewCheckout({
19597
19594
  creditBundles: deriveCreditBundles(
19598
- bundleGatingGrants,
19599
19595
  data?.creditBundles,
19596
+ bundleGatingPlanId,
19600
19597
  nextCounts
19601
19598
  )
19602
19599
  });
19603
19600
  },
19604
- [bundleGatingGrants, data?.creditBundles, debouncedPreviewCheckout]
19601
+ [bundleGatingPlanId, data?.creditBundles, debouncedPreviewCheckout]
19605
19602
  );
19606
19603
  const toggleCreditBundle = useCallback8(
19607
19604
  (id) => {
@@ -19615,13 +19612,13 @@ var CheckoutDialog = ({ top }) => {
19615
19612
  setBundleCounts(nextCounts);
19616
19613
  handlePreviewCheckout({
19617
19614
  creditBundles: deriveCreditBundles(
19618
- bundleGatingGrants,
19619
19615
  data?.creditBundles,
19616
+ bundleGatingPlanId,
19620
19617
  nextCounts
19621
19618
  )
19622
19619
  });
19623
19620
  },
19624
- [bundleGatingGrants, data?.creditBundles, handlePreviewCheckout]
19621
+ [bundleGatingPlanId, data?.creditBundles, handlePreviewCheckout]
19625
19622
  );
19626
19623
  const updateAddOnEntitlementQuantity = useCallback8(
19627
19624
  (id, updatedQuantity) => {
@@ -24161,9 +24158,9 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
24161
24158
  },
24162
24159
  [data?.featureUsage?.features]
24163
24160
  );
24164
- const bundleOffCreditIds = useMemo27(
24165
- () => getBundleOffCreditIds(data?.company?.plan?.includedCreditGrants),
24166
- [data?.company?.plan?.includedCreditGrants]
24161
+ const purchasableCreditIds = useMemo27(
24162
+ () => getPurchasableCreditIds(data?.creditBundles, data?.company?.plan?.id),
24163
+ [data?.creditBundles, data?.company?.plan?.id]
24167
24164
  );
24168
24165
  const [expandedCreditIds, setExpandedCreditIds] = useState18(
24169
24166
  () => /* @__PURE__ */ new Set()
@@ -24341,7 +24338,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
24341
24338
  )]
24342
24339
  }
24343
24340
  ),
24344
- canCheckout && !bundleOffCreditIds.has(credit.id) && /* @__PURE__ */ jsx55(
24341
+ canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */ jsx55(
24345
24342
  Button,
24346
24343
  {
24347
24344
  type: "button",
@@ -24907,7 +24904,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
24907
24904
  }
24908
24905
  stripe._registerWrapper({
24909
24906
  name: "stripe-js",
24910
- version: "9.12.1",
24907
+ version: "9.13.0",
24911
24908
  startTime
24912
24909
  });
24913
24910
  };
@@ -24985,7 +24982,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
24985
24982
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
24986
24983
  var expectedVersion = RELEASE_TRAIN;
24987
24984
  if (isTestKey && version !== expectedVersion) {
24988
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.12.1", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
24985
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.13.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
24989
24986
  }
24990
24987
  var stripe = maybeStripe.apply(void 0, args);
24991
24988
  registerWrapper(stripe, startTime);
@@ -778,7 +778,7 @@ var require_styled_components_cjs = __commonJS({
778
778
  var u = "undefined" != typeof process && void 0 !== process.env && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled";
779
779
  var d = "active";
780
780
  var h = "data-styled-version";
781
- var p = "6.5.0";
781
+ var p = "6.5.3";
782
782
  var f = "/*!sc*/\n";
783
783
  var m = "undefined" != typeof window && "undefined" != typeof document;
784
784
  var y = void 0 === a.default.createContext;
@@ -1450,10 +1450,7 @@ See https://styled-components.com/docs/basics#define-styled-components-outside-o
1450
1450
  for (const e7 in i4) "className" === e7 ? o4.className = he(o4.className, i4[e7]) : "style" === e7 ? o4.style = Object.assign(Object.assign({}, o4.style), i4[e7]) : e7 in t3 && void 0 === t3[e7] || (o4[e7] = i4[e7]);
1451
1451
  }
1452
1452
  return "className" in t3 && "string" == typeof t3.className && (o4.className = he(o4.className, t3.className)), o4;
1453
- })(s3, n4, v3), b3 = (function(e6, t3, n5, o4) {
1454
- const s4 = e6.generateAndInjectStyles(t3, n5, o4);
1455
- return a.default.useDebugValue && a.default.useDebugValue(s4), s4;
1456
- })(r3, S3, m3.styleSheet, m3.stylis), e5.warnTooManyClasses && e5.warnTooManyClasses(b3);
1453
+ })(s3, n4, v3), b3 = r3.generateAndInjectStyles(S3, m3.styleSheet, m3.stylis), a.default.useDebugValue && a.default.useDebugValue(b3), e5.warnTooManyClasses && e5.warnTooManyClasses(b3);
1457
1454
  const w2 = S3.as || h3, C2 = (function(e6, t3, n5, o4) {
1458
1455
  const s4 = {};
1459
1456
  for (const r4 in e6) void 0 === e6[r4] || "$" === r4[0] || "as" === r4 || "theme" === r4 && e6.theme === n5 || ("forwardedAs" === r4 ? s4.as = e6.forwardedAs : o4 && !o4(r4, t3) || (s4[r4] = e6[r4], o4 || false || l.default(r4) || (Pt || (Pt = /* @__PURE__ */ new Set())).has(r4) || !U(t3) || t3.includes("-") || (Pt.add(r4), console.warn(`styled-components: it looks like an unknown prop "${r4}" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via \`<StyleSheetManager shouldForwardProp={...}>\` (connect an API like \`@emotion/is-prop-valid\`) or consider using transient props (\`$\` prefix for automatic filtering.)`))));
@@ -13542,30 +13539,29 @@ function isAutoTopupOff(grant) {
13542
13539
  function isSelfServiceAutoTopupAvailable(grant) {
13543
13540
  return !!grant?.billingCreditAutoTopupSelfService && !isAutoTopupOff(grant);
13544
13541
  }
13545
- function isBundlePurchaseOff(grant) {
13546
- return grant?.billingCreditCanBuyBundles === false;
13547
- }
13548
- function getBundleOffCreditIds(grants) {
13549
- const ids = /* @__PURE__ */ new Set();
13550
- (grants ?? []).forEach((grant) => {
13551
- if (isBundlePurchaseOff(grant)) {
13552
- ids.add(grant.creditId);
13553
- }
13554
- });
13555
- return ids;
13542
+ function isBundleCompatibleWithPlan(bundle, planId) {
13543
+ const compatiblePlanIds = bundle.compatiblePlanIds ?? [];
13544
+ if (compatiblePlanIds.length === 0) {
13545
+ return true;
13546
+ }
13547
+ return !!planId && compatiblePlanIds.includes(planId);
13556
13548
  }
13557
- function filterCreditBundles(grants, bundles) {
13558
- const bundleOffCreditIds = getBundleOffCreditIds(grants);
13549
+ function filterCreditBundles(bundles, planId) {
13559
13550
  return (bundles ?? []).filter(
13560
- (bundle) => !bundleOffCreditIds.has(bundle.creditId)
13551
+ (bundle) => isBundleCompatibleWithPlan(bundle, planId)
13561
13552
  );
13562
13553
  }
13563
- function deriveCreditBundles(grants, bundles, counts) {
13564
- return filterCreditBundles(grants, bundles).map((bundle) => ({
13554
+ function deriveCreditBundles(bundles, planId, counts) {
13555
+ return filterCreditBundles(bundles, planId).map((bundle) => ({
13565
13556
  ...bundle,
13566
13557
  count: counts[bundle.id] ?? 0
13567
13558
  }));
13568
13559
  }
13560
+ function getPurchasableCreditIds(bundles, planId) {
13561
+ return new Set(
13562
+ filterCreditBundles(bundles, planId).map((bundle) => bundle.creditId)
13563
+ );
13564
+ }
13569
13565
  function getAutoTopupThresholdCredits(grant) {
13570
13566
  return grant?.companyAutoTopupThresholdCredits ?? grant?.billingCreditAutoTopupThresholdCredits;
13571
13567
  }
@@ -14889,7 +14885,7 @@ var reducer = (state, action) => {
14889
14885
  // src/context/EmbedProvider.tsx
14890
14886
  var import_jsx_runtime3 = require("react/jsx-runtime");
14891
14887
  var getCustomHeaders = (sessionId) => ({
14892
- "X-Schematic-Components-Version": "2.23.0",
14888
+ "X-Schematic-Components-Version": "2.24.0",
14893
14889
  "X-Schematic-Session-ID": sessionId
14894
14890
  });
14895
14891
  var normalizeCurrencyFilter = (filter) => {
@@ -19279,14 +19275,14 @@ var CheckoutDialog = ({ top }) => {
19279
19275
  const isIndividualBundlePurchase = data?.checkoutSettings.bundlePurchaseBehavior === CheckoutBundlePurchaseBehavior.Individual;
19280
19276
  const [bundleCounts, setBundleCounts] = (0, import_react38.useState)({});
19281
19277
  const bundleCountsRef = (0, import_react38.useRef)(bundleCounts);
19282
- const bundleGatingGrants = selectedPlan?.includedCreditGrants ?? data?.company?.plan?.includedCreditGrants;
19278
+ const bundleGatingPlanId = selectedPlan?.id ?? data?.company?.plan?.id;
19283
19279
  const creditBundles = (0, import_react38.useMemo)(() => {
19284
19280
  return deriveCreditBundles(
19285
- bundleGatingGrants,
19286
19281
  data?.creditBundles,
19282
+ bundleGatingPlanId,
19287
19283
  bundleCounts
19288
19284
  );
19289
- }, [bundleGatingGrants, data?.creditBundles, bundleCounts]);
19285
+ }, [bundleGatingPlanId, data?.creditBundles, bundleCounts]);
19290
19286
  const selectedPlanPriceId = (0, import_react38.useMemo)(() => {
19291
19287
  if (!selectedPlan) {
19292
19288
  return void 0;
@@ -19617,8 +19613,8 @@ var CheckoutDialog = ({ top }) => {
19617
19613
  const code = typeof updates.promoCode !== "undefined" ? updates.promoCode : promoCode;
19618
19614
  const skipTrial = !(updates.shouldTrial ?? shouldTrial);
19619
19615
  const resolvedCreditBundles = filterCreditBundles(
19620
- plan?.includedCreditGrants ?? data?.company?.plan?.includedCreditGrants,
19621
- updates.creditBundles || creditBundles
19616
+ updates.creditBundles || creditBundles,
19617
+ plan?.id ?? data?.company?.plan?.id
19622
19618
  );
19623
19619
  const isCreditOnly = !data?.company?.billingSubscription && !planPriceId && resolvedCreditBundles.some((bundle) => bundle.count > 0) && !(updates.addOns || addOns).some(
19624
19620
  (addOn) => addOn.isSelected && !!getAddOnPrice(addOn, period, resolvedCurrency)?.id
@@ -19760,6 +19756,7 @@ var CheckoutDialog = ({ top }) => {
19760
19756
  [
19761
19757
  t2,
19762
19758
  addOnCompatibilityLookup,
19759
+ data?.company?.plan?.id,
19763
19760
  data?.company?.plan?.includedCreditGrants,
19764
19761
  data?.company?.billingSubscription,
19765
19762
  previewCheckout,
@@ -20043,13 +20040,13 @@ var CheckoutDialog = ({ top }) => {
20043
20040
  setBundleCounts(nextCounts);
20044
20041
  debouncedPreviewCheckout({
20045
20042
  creditBundles: deriveCreditBundles(
20046
- bundleGatingGrants,
20047
20043
  data?.creditBundles,
20044
+ bundleGatingPlanId,
20048
20045
  nextCounts
20049
20046
  )
20050
20047
  });
20051
20048
  },
20052
- [bundleGatingGrants, data?.creditBundles, debouncedPreviewCheckout]
20049
+ [bundleGatingPlanId, data?.creditBundles, debouncedPreviewCheckout]
20053
20050
  );
20054
20051
  const toggleCreditBundle = (0, import_react38.useCallback)(
20055
20052
  (id) => {
@@ -20063,13 +20060,13 @@ var CheckoutDialog = ({ top }) => {
20063
20060
  setBundleCounts(nextCounts);
20064
20061
  handlePreviewCheckout({
20065
20062
  creditBundles: deriveCreditBundles(
20066
- bundleGatingGrants,
20067
20063
  data?.creditBundles,
20064
+ bundleGatingPlanId,
20068
20065
  nextCounts
20069
20066
  )
20070
20067
  });
20071
20068
  },
20072
- [bundleGatingGrants, data?.creditBundles, handlePreviewCheckout]
20069
+ [bundleGatingPlanId, data?.creditBundles, handlePreviewCheckout]
20073
20070
  );
20074
20071
  const updateAddOnEntitlementQuantity = (0, import_react38.useCallback)(
20075
20072
  (id, updatedQuantity) => {
@@ -24599,9 +24596,9 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
24599
24596
  },
24600
24597
  [data?.featureUsage?.features]
24601
24598
  );
24602
- const bundleOffCreditIds = (0, import_react54.useMemo)(
24603
- () => getBundleOffCreditIds(data?.company?.plan?.includedCreditGrants),
24604
- [data?.company?.plan?.includedCreditGrants]
24599
+ const purchasableCreditIds = (0, import_react54.useMemo)(
24600
+ () => getPurchasableCreditIds(data?.creditBundles, data?.company?.plan?.id),
24601
+ [data?.creditBundles, data?.company?.plan?.id]
24605
24602
  );
24606
24603
  const [expandedCreditIds, setExpandedCreditIds] = (0, import_react54.useState)(
24607
24604
  () => /* @__PURE__ */ new Set()
@@ -24779,7 +24776,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
24779
24776
  )]
24780
24777
  }
24781
24778
  ),
24782
- canCheckout && !bundleOffCreditIds.has(credit.id) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
24779
+ canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
24783
24780
  Button,
24784
24781
  {
24785
24782
  type: "button",
@@ -25345,7 +25342,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
25345
25342
  }
25346
25343
  stripe._registerWrapper({
25347
25344
  name: "stripe-js",
25348
- version: "9.12.1",
25345
+ version: "9.13.0",
25349
25346
  startTime
25350
25347
  });
25351
25348
  };
@@ -25423,7 +25420,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
25423
25420
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
25424
25421
  var expectedVersion = RELEASE_TRAIN;
25425
25422
  if (isTestKey && version !== expectedVersion) {
25426
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.12.1", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
25423
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.13.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
25427
25424
  }
25428
25425
  var stripe = maybeStripe.apply(void 0, args);
25429
25426
  registerWrapper(stripe, startTime);