@zuplo/zudoku-plugin-monetization 0.0.6 → 0.0.7

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 (2) hide show
  1. package/dist/index.mjs +10 -6
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -949,15 +949,18 @@ const Usage = ({ subscriptionId, environmentName, currentItems }) => {
949
949
  queryKey: [`/v3/zudoku-metering/${environmentName}/subscriptions/${subscriptionId}/usage`],
950
950
  meta: { context: zudoku }
951
951
  });
952
- const meteredEntitlements = currentItems?.filter((item) => item.included.entitlement?.type === "metered") ?? [];
952
+ console.log("currentItems", currentItems);
953
953
  return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Heading, {
954
954
  level: 3,
955
955
  className: "mb-4",
956
956
  children: "Usage"
957
- }), Object.entries(usage.entitlements).filter((entry) => isMeteredEntitlement(entry[1])).map(([key, metric]) => /* @__PURE__ */ jsx(UsageItem, {
958
- meter: { ...metric },
959
- item: meteredEntitlements.find((item) => item.included.entitlement?.featureKey === key)
960
- }, key))] });
957
+ }), /* @__PURE__ */ jsx("div", {
958
+ className: "space-y-4",
959
+ children: Object.entries(usage.entitlements).filter((entry) => isMeteredEntitlement(entry[1])).map(([key, metric]) => /* @__PURE__ */ jsx(UsageItem, {
960
+ meter: { ...metric },
961
+ item: currentItems?.find((item) => item.featureKey === key)
962
+ }, key))
963
+ })] });
961
964
  };
962
965
 
963
966
  //#endregion
@@ -971,7 +974,8 @@ const SubscriptionsPage = ({ environmentName }) => {
971
974
  if (subscriptionId) return subscriptions.find((s) => s.id === subscriptionId) ?? subscriptions[0];
972
975
  return subscriptions[0];
973
976
  }, [subscriptions, subscriptionId]);
974
- const activePhase = activeSubscription.phases.find((p) => new Date(p.activeFrom) <= /* @__PURE__ */ new Date() && new Date(p.activeTo) >= /* @__PURE__ */ new Date());
977
+ const activePhase = activeSubscription?.phases.find((p) => new Date(p.activeFrom) <= /* @__PURE__ */ new Date() && (!p.activeTo || new Date(p.activeTo) >= /* @__PURE__ */ new Date()));
978
+ console.log("activePhase", activePhase);
975
979
  return /* @__PURE__ */ jsx("div", {
976
980
  className: "w-full py-12",
977
981
  children: /* @__PURE__ */ jsxs("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/zudoku-plugin-monetization",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "main": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.mts",