@nevios/storefront-kit 1.5.1 → 1.6.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.
package/README.md CHANGED
@@ -99,3 +99,8 @@ pnpm add https://c.nevios.io/sdk/storefront-kit/1.5.1.tgz react react-dom
99
99
 
100
100
  The immutable kit archive resolves its tested SDK version from the same public
101
101
  distribution; see [versions and checksums](https://c.nevios.io/sdk/releases.json).
102
+
103
+ `SubscriptionManager` 1.6+ prioritizes `management().plan_options` for complete
104
+ offer switches, shows the reviewed items/dates/terms and requires consent before
105
+ committing. The plain cadence picker remains available for merchants whose
106
+ contracts only allow schedule changes.
package/dist/index.cjs CHANGED
@@ -4004,7 +4004,7 @@ function Manager({
4004
4004
  const money = (n) => formatCents(n, s.currency, loc);
4005
4005
  const scope = mode === "mix" ? "recurring" : "one_time";
4006
4006
  const selected = Object.entries(quantities).filter(([, quantity]) => quantity > 0).map(([variant_id, quantity]) => ({ variant_id, quantity }));
4007
- const changes = mode === "cadence" ? { cadence_option_id: option } : { lines: selected };
4007
+ const changes = mode === "cadence" ? s.plan_options?.length ? { plan_option_id: option } : { cadence_option_id: option } : { lines: selected };
4008
4008
  const amount = quote ? "recurring_total_cents" in quote ? quote.recurring_total_cents : quote.after.total_cents : upcoming.total_cents;
4009
4009
  const enter = (next) => {
4010
4010
  setMode(next);
@@ -4091,7 +4091,7 @@ function Manager({
4091
4091
  new Date(upcoming.edit_cutoff_at).toLocaleString(loc)
4092
4092
  ] }),
4093
4093
  !mode ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: ".5rem", flexWrap: "wrap" }, children: [
4094
- !!upcoming.capabilities.cadence_options?.length && /* @__PURE__ */ jsxRuntime.jsx(
4094
+ !!(s.plan_options?.length || upcoming.capabilities.cadence_options?.length) && /* @__PURE__ */ jsxRuntime.jsx(
4095
4095
  SubscriptionButton,
4096
4096
  {
4097
4097
  disabled: !upcoming.editable,
@@ -4223,6 +4223,7 @@ function Manager({
4223
4223
  " \xD7 ",
4224
4224
  li.quantity
4225
4225
  ] }, li.variant_id)),
4226
+ "terms_text" in quote.after && typeof quote.after.terms_text === "string" && /* @__PURE__ */ jsxRuntime.jsx("p", { children: quote.after.terms_text }),
4226
4227
  /* @__PURE__ */ jsxRuntime.jsxs("strong", { children: [
4227
4228
  t("subscriptions.reviewTotal"),
4228
4229
  ": ",
@@ -4234,12 +4235,12 @@ function Manager({
4234
4235
  role: "group",
4235
4236
  "aria-label": t("subscriptions.changeInterval"),
4236
4237
  style: { display: "flex", gap: ".5rem", flexWrap: "wrap" },
4237
- children: upcoming.capabilities.cadence_options?.map((o) => /* @__PURE__ */ jsxRuntime.jsx(
4238
+ children: (s.plan_options?.length ? s.plan_options : upcoming.capabilities.cadence_options)?.map((o) => /* @__PURE__ */ jsxRuntime.jsx(
4238
4239
  SubscriptionButton,
4239
4240
  {
4240
4241
  "aria-pressed": option === o.id,
4241
4242
  onClick: () => setOption(o.id),
4242
- children: t(`subscriptions.unit.${o.unit}`, { count: o.count })
4243
+ children: "name" in o && typeof o.name === "string" ? o.name : t(`subscriptions.unit.${o.unit}`, { count: o.count })
4243
4244
  },
4244
4245
  o.id
4245
4246
  ))