@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.js
CHANGED
|
@@ -542,7 +542,7 @@ function groupAttrs(document) {
|
|
|
542
542
|
return {
|
|
543
543
|
...first ? { standardPriceCents: first.priceCents } : {},
|
|
544
544
|
foundingDiscountCents: 0,
|
|
545
|
-
stripePriceId: firstPaid
|
|
545
|
+
...firstPaid?.stripePriceId ? { stripePriceId: firstPaid.stripePriceId } : {},
|
|
546
546
|
...document.policy ?? {},
|
|
547
547
|
...document.scheduling ? { schedulingJson: document.scheduling } : {}
|
|
548
548
|
};
|
|
@@ -568,24 +568,35 @@ async function materializeSignupControl(db, envelope, previous, receivedAt) {
|
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
570
|
for (const tier of document.tiers) {
|
|
571
|
-
|
|
571
|
+
const tierRef = byPublicId("tiers", tier.id);
|
|
572
|
+
ops.push({ t: "update", ns: "tiers", id: tierRef, attrs: {
|
|
572
573
|
id: tier.id,
|
|
573
574
|
groupId: document.target.chapterId,
|
|
574
575
|
name: tier.name,
|
|
575
576
|
priceCents: tier.priceCents,
|
|
576
|
-
stripePriceId: tier.stripePriceId
|
|
577
|
-
blurb: tier.blurb
|
|
577
|
+
...tier.stripePriceId ? { stripePriceId: tier.stripePriceId } : {},
|
|
578
|
+
...tier.blurb ? { blurb: tier.blurb } : {},
|
|
578
579
|
sortOrder: tier.sortOrder,
|
|
579
580
|
active: tier.available,
|
|
580
581
|
createdAt: receivedAt
|
|
581
582
|
} });
|
|
583
|
+
const retract = [
|
|
584
|
+
...!tier.stripePriceId ? ["stripePriceId"] : [],
|
|
585
|
+
...!tier.blurb ? ["blurb"] : []
|
|
586
|
+
];
|
|
587
|
+
if (retract.length) ops.push({ t: "retract", ns: "tiers", id: tierRef, attrs: retract });
|
|
582
588
|
}
|
|
589
|
+
const groupRef = byPublicId("groups", document.target.chapterId);
|
|
590
|
+
const attrs = groupAttrs(document);
|
|
583
591
|
ops.push({
|
|
584
592
|
t: "update",
|
|
585
593
|
ns: "groups",
|
|
586
|
-
id:
|
|
587
|
-
attrs
|
|
594
|
+
id: groupRef,
|
|
595
|
+
attrs
|
|
588
596
|
});
|
|
597
|
+
if (!("stripePriceId" in attrs)) {
|
|
598
|
+
ops.push({ t: "retract", ns: "groups", id: groupRef, attrs: ["stripePriceId"] });
|
|
599
|
+
}
|
|
589
600
|
const id = `signup-control:${document.target.environment}:${document.revision}`;
|
|
590
601
|
ops.push({ t: "update", ns: "signupControls", id, attrs: {
|
|
591
602
|
id,
|