@schematichq/schematic-components 2.22.0-rc.1 → 2.22.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14384,7 +14384,7 @@ var reducer = (state, action) => {
14384
14384
  // src/context/EmbedProvider.tsx
14385
14385
  var import_jsx_runtime3 = require("react/jsx-runtime");
14386
14386
  var getCustomHeaders = (sessionId) => ({
14387
- "X-Schematic-Components-Version": "2.22.0-rc.1",
14387
+ "X-Schematic-Components-Version": "2.22.0-rc.2",
14388
14388
  "X-Schematic-Session-ID": sessionId
14389
14389
  });
14390
14390
  var normalizeCurrencyFilter = (filter2) => {
@@ -21368,6 +21368,7 @@ var SubscriptionSidebar = (0, import_react45.forwardRef)(
21368
21368
  ]);
21369
21369
  const {
21370
21370
  amountOff,
21371
+ discountAmount,
21371
21372
  dueNow,
21372
21373
  newCharges,
21373
21374
  percentOff,
@@ -21379,6 +21380,8 @@ var SubscriptionSidebar = (0, import_react45.forwardRef)(
21379
21380
  } = (0, import_react45.useMemo)(() => {
21380
21381
  return {
21381
21382
  amountOff: charges?.amountOff ?? 0,
21383
+ // Read loosely until the prod OpenAPI spec includes discount_amount.
21384
+ discountAmount: charges?.discountAmount ?? 0,
21382
21385
  dueNow: charges?.dueNow ?? 0,
21383
21386
  newCharges: charges?.newCharges ?? 0,
21384
21387
  percentOff: charges?.percentOff ?? 0,
@@ -22172,7 +22175,9 @@ var SubscriptionSidebar = (0, import_react45.forwardRef)(
22172
22175
  children: [
22173
22176
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { $opacity: "0.625", $lineHeight: 1.15, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text, { children: t3("X% off", { percent: percentOff }) }) }),
22174
22177
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text, { children: formatCurrency(
22175
- newCharges / 100 * percentOff,
22178
+ // Prefer the discount Stripe applied; derive from
22179
+ // `percentOff` only for API responses that predate it.
22180
+ discountAmount > 0 ? discountAmount : newCharges / 100 * percentOff,
22176
22181
  selectedPlanCurrency
22177
22182
  ) }) })
22178
22183
  ]
@@ -14294,7 +14294,7 @@ var reducer = (state, action) => {
14294
14294
  // src/context/EmbedProvider.tsx
14295
14295
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
14296
14296
  var getCustomHeaders = (sessionId) => ({
14297
- "X-Schematic-Components-Version": "2.22.0-rc.1",
14297
+ "X-Schematic-Components-Version": "2.22.0-rc.2",
14298
14298
  "X-Schematic-Session-ID": sessionId
14299
14299
  });
14300
14300
  var normalizeCurrencyFilter = (filter2) => {
@@ -21309,6 +21309,7 @@ var SubscriptionSidebar = forwardRef7(
21309
21309
  ]);
21310
21310
  const {
21311
21311
  amountOff,
21312
+ discountAmount,
21312
21313
  dueNow,
21313
21314
  newCharges,
21314
21315
  percentOff,
@@ -21320,6 +21321,8 @@ var SubscriptionSidebar = forwardRef7(
21320
21321
  } = useMemo19(() => {
21321
21322
  return {
21322
21323
  amountOff: charges?.amountOff ?? 0,
21324
+ // Read loosely until the prod OpenAPI spec includes discount_amount.
21325
+ discountAmount: charges?.discountAmount ?? 0,
21323
21326
  dueNow: charges?.dueNow ?? 0,
21324
21327
  newCharges: charges?.newCharges ?? 0,
21325
21328
  percentOff: charges?.percentOff ?? 0,
@@ -22113,7 +22116,9 @@ var SubscriptionSidebar = forwardRef7(
22113
22116
  children: [
22114
22117
  /* @__PURE__ */ jsx41(Box, { $opacity: "0.625", $lineHeight: 1.15, children: /* @__PURE__ */ jsx41(Text, { children: t3("X% off", { percent: percentOff }) }) }),
22115
22118
  /* @__PURE__ */ jsx41(Box, { children: /* @__PURE__ */ jsx41(Text, { children: formatCurrency(
22116
- newCharges / 100 * percentOff,
22119
+ // Prefer the discount Stripe applied; derive from
22120
+ // `percentOff` only for API responses that predate it.
22121
+ discountAmount > 0 ? discountAmount : newCharges / 100 * percentOff,
22117
22122
  selectedPlanCurrency
22118
22123
  ) }) })
22119
22124
  ]
@@ -14741,7 +14741,7 @@ var reducer = (state, action) => {
14741
14741
  // src/context/EmbedProvider.tsx
14742
14742
  var import_jsx_runtime3 = require("react/jsx-runtime");
14743
14743
  var getCustomHeaders = (sessionId) => ({
14744
- "X-Schematic-Components-Version": "2.22.0-rc.1",
14744
+ "X-Schematic-Components-Version": "2.22.0-rc.2",
14745
14745
  "X-Schematic-Session-ID": sessionId
14746
14746
  });
14747
14747
  var normalizeCurrencyFilter = (filter) => {
@@ -21744,6 +21744,7 @@ var SubscriptionSidebar = (0, import_react44.forwardRef)(
21744
21744
  ]);
21745
21745
  const {
21746
21746
  amountOff,
21747
+ discountAmount,
21747
21748
  dueNow,
21748
21749
  newCharges,
21749
21750
  percentOff,
@@ -21755,6 +21756,8 @@ var SubscriptionSidebar = (0, import_react44.forwardRef)(
21755
21756
  } = (0, import_react44.useMemo)(() => {
21756
21757
  return {
21757
21758
  amountOff: charges?.amountOff ?? 0,
21759
+ // Read loosely until the prod OpenAPI spec includes discount_amount.
21760
+ discountAmount: charges?.discountAmount ?? 0,
21758
21761
  dueNow: charges?.dueNow ?? 0,
21759
21762
  newCharges: charges?.newCharges ?? 0,
21760
21763
  percentOff: charges?.percentOff ?? 0,
@@ -22548,7 +22551,9 @@ var SubscriptionSidebar = (0, import_react44.forwardRef)(
22548
22551
  children: [
22549
22552
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { $opacity: "0.625", $lineHeight: 1.15, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text, { children: t2("X% off", { percent: percentOff }) }) }),
22550
22553
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text, { children: formatCurrency(
22551
- newCharges / 100 * percentOff,
22554
+ // Prefer the discount Stripe applied; derive from
22555
+ // `percentOff` only for API responses that predate it.
22556
+ discountAmount > 0 ? discountAmount : newCharges / 100 * percentOff,
22552
22557
  selectedPlanCurrency
22553
22558
  ) }) })
22554
22559
  ]
@@ -14419,7 +14419,7 @@ var reducer = (state, action) => {
14419
14419
  // src/context/EmbedProvider.tsx
14420
14420
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
14421
14421
  var getCustomHeaders = (sessionId) => ({
14422
- "X-Schematic-Components-Version": "2.22.0-rc.1",
14422
+ "X-Schematic-Components-Version": "2.22.0-rc.2",
14423
14423
  "X-Schematic-Session-ID": sessionId
14424
14424
  });
14425
14425
  var normalizeCurrencyFilter = (filter2) => {
@@ -21434,6 +21434,7 @@ var SubscriptionSidebar = forwardRef7(
21434
21434
  ]);
21435
21435
  const {
21436
21436
  amountOff,
21437
+ discountAmount,
21437
21438
  dueNow,
21438
21439
  newCharges,
21439
21440
  percentOff,
@@ -21445,6 +21446,8 @@ var SubscriptionSidebar = forwardRef7(
21445
21446
  } = useMemo19(() => {
21446
21447
  return {
21447
21448
  amountOff: charges?.amountOff ?? 0,
21449
+ // Read loosely until the prod OpenAPI spec includes discount_amount.
21450
+ discountAmount: charges?.discountAmount ?? 0,
21448
21451
  dueNow: charges?.dueNow ?? 0,
21449
21452
  newCharges: charges?.newCharges ?? 0,
21450
21453
  percentOff: charges?.percentOff ?? 0,
@@ -22238,7 +22241,9 @@ var SubscriptionSidebar = forwardRef7(
22238
22241
  children: [
22239
22242
  /* @__PURE__ */ jsx41(Box, { $opacity: "0.625", $lineHeight: 1.15, children: /* @__PURE__ */ jsx41(Text, { children: t3("X% off", { percent: percentOff }) }) }),
22240
22243
  /* @__PURE__ */ jsx41(Box, { children: /* @__PURE__ */ jsx41(Text, { children: formatCurrency(
22241
- newCharges / 100 * percentOff,
22244
+ // Prefer the discount Stripe applied; derive from
22245
+ // `percentOff` only for API responses that predate it.
22246
+ discountAmount > 0 ? discountAmount : newCharges / 100 * percentOff,
22242
22247
  selectedPlanCurrency
22243
22248
  ) }) })
22244
22249
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematichq/schematic-components",
3
- "version": "2.22.0-rc.1",
3
+ "version": "2.22.0-rc.2",
4
4
  "main": "dist/schematic-components.cjs.js",
5
5
  "module": "dist/schematic-components.esm.js",
6
6
  "types": "dist/schematic-components.d.ts",