@odla-ai/chapter 0.33.2 → 0.34.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/dist/index.cjs +93 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -6
- package/dist/index.d.ts +27 -6
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -1
- package/dist/worker/index.cjs +17 -6
- package/dist/worker/index.cjs.map +1 -1
- package/dist/worker/index.js +17 -6
- package/dist/worker/index.js.map +1 -1
- package/package.json +2 -1
package/dist/worker/index.cjs
CHANGED
|
@@ -570,7 +570,7 @@ function groupAttrs(document) {
|
|
|
570
570
|
return {
|
|
571
571
|
...first ? { standardPriceCents: first.priceCents } : {},
|
|
572
572
|
foundingDiscountCents: 0,
|
|
573
|
-
stripePriceId: firstPaid
|
|
573
|
+
...firstPaid?.stripePriceId ? { stripePriceId: firstPaid.stripePriceId } : {},
|
|
574
574
|
...document.policy ?? {},
|
|
575
575
|
...document.scheduling ? { schedulingJson: document.scheduling } : {}
|
|
576
576
|
};
|
|
@@ -596,24 +596,35 @@ async function materializeSignupControl(db, envelope, previous, receivedAt) {
|
|
|
596
596
|
}
|
|
597
597
|
}
|
|
598
598
|
for (const tier of document.tiers) {
|
|
599
|
-
|
|
599
|
+
const tierRef = byPublicId("tiers", tier.id);
|
|
600
|
+
ops.push({ t: "update", ns: "tiers", id: tierRef, attrs: {
|
|
600
601
|
id: tier.id,
|
|
601
602
|
groupId: document.target.chapterId,
|
|
602
603
|
name: tier.name,
|
|
603
604
|
priceCents: tier.priceCents,
|
|
604
|
-
stripePriceId: tier.stripePriceId
|
|
605
|
-
blurb: tier.blurb
|
|
605
|
+
...tier.stripePriceId ? { stripePriceId: tier.stripePriceId } : {},
|
|
606
|
+
...tier.blurb ? { blurb: tier.blurb } : {},
|
|
606
607
|
sortOrder: tier.sortOrder,
|
|
607
608
|
active: tier.available,
|
|
608
609
|
createdAt: receivedAt
|
|
609
610
|
} });
|
|
611
|
+
const retract = [
|
|
612
|
+
...!tier.stripePriceId ? ["stripePriceId"] : [],
|
|
613
|
+
...!tier.blurb ? ["blurb"] : []
|
|
614
|
+
];
|
|
615
|
+
if (retract.length) ops.push({ t: "retract", ns: "tiers", id: tierRef, attrs: retract });
|
|
610
616
|
}
|
|
617
|
+
const groupRef = byPublicId("groups", document.target.chapterId);
|
|
618
|
+
const attrs = groupAttrs(document);
|
|
611
619
|
ops.push({
|
|
612
620
|
t: "update",
|
|
613
621
|
ns: "groups",
|
|
614
|
-
id:
|
|
615
|
-
attrs
|
|
622
|
+
id: groupRef,
|
|
623
|
+
attrs
|
|
616
624
|
});
|
|
625
|
+
if (!("stripePriceId" in attrs)) {
|
|
626
|
+
ops.push({ t: "retract", ns: "groups", id: groupRef, attrs: ["stripePriceId"] });
|
|
627
|
+
}
|
|
617
628
|
const id = `signup-control:${document.target.environment}:${document.revision}`;
|
|
618
629
|
ops.push({ t: "update", ns: "signupControls", id, attrs: {
|
|
619
630
|
id,
|