@odla-ai/chapter 0.52.0 → 0.53.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 +25 -0
- package/dist/{chunk-A6W53GVM.js → chunk-4M2PN5K3.js} +4 -2
- package/dist/chunk-4M2PN5K3.js.map +1 -0
- package/dist/{chunk-7N4VDWM5.js → chunk-PTC43J7F.js} +40 -6
- package/dist/{chunk-7N4VDWM5.js.map → chunk-PTC43J7F.js.map} +1 -1
- package/dist/{chunk-7RIT2UN5.js → chunk-TEHCORNC.js} +31 -12
- package/dist/chunk-TEHCORNC.js.map +1 -0
- package/dist/{copy-context-CYLlPzAc.d.ts → copy-context-qvFo6eA7.d.ts} +1 -1
- package/dist/index.cjs +11 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +11 -8
- package/dist/index.js.map +1 -1
- package/dist/ui/admin/index.d.ts +6 -5
- package/dist/ui/admin/index.js +2 -2
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +3 -3
- package/dist/ui/member/index.d.ts +20 -14
- package/dist/ui/member/index.js +2 -2
- package/dist/worker/index.cjs +299 -84
- package/dist/worker/index.cjs.map +1 -1
- package/dist/worker/index.d.cts +34 -2
- package/dist/worker/index.d.ts +34 -2
- package/dist/worker/index.js +292 -77
- package/dist/worker/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-7RIT2UN5.js.map +0 -1
- package/dist/chunk-A6W53GVM.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -155,6 +155,7 @@ __export(src_exports, {
|
|
|
155
155
|
membershipAuthorityEntities: () => membershipAuthorityEntities,
|
|
156
156
|
membershipAuthorityRules: () => membershipAuthorityRules,
|
|
157
157
|
membershipCheckoutBindingId: () => membershipCheckoutBindingId,
|
|
158
|
+
membershipDiscountCouponId: () => membershipDiscountCouponId,
|
|
158
159
|
membershipDiscountPolicyVersion: () => membershipDiscountPolicyVersion,
|
|
159
160
|
membershipOfferEntities: () => membershipOfferEntities,
|
|
160
161
|
membershipOfferIdForRequest: () => membershipOfferIdForRequest,
|
|
@@ -1838,7 +1839,9 @@ var DEFAULT_JOIN_COPY = {
|
|
|
1838
1839
|
incomplete: "The payment did not complete. Please try again.",
|
|
1839
1840
|
consent: "I have read and agree to the pricing and refund policy above.",
|
|
1840
1841
|
foundingMember: "Founding member rate",
|
|
1841
|
-
foundingDiscount: "Founding discount"
|
|
1842
|
+
foundingDiscount: "Founding discount",
|
|
1843
|
+
standardRate: "Standard rate",
|
|
1844
|
+
yourRate: "Your rate"
|
|
1842
1845
|
},
|
|
1843
1846
|
done: {
|
|
1844
1847
|
label: "You're booked",
|
|
@@ -3692,7 +3695,7 @@ async function hash(value) {
|
|
|
3692
3695
|
const bytes = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(JSON.stringify(value)));
|
|
3693
3696
|
return [...new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
3694
3697
|
}
|
|
3695
|
-
async function
|
|
3698
|
+
async function membershipDiscountCouponId(input, policyId) {
|
|
3696
3699
|
return policyId ? `odla_m_${await hash([input.appId, input.chapterId, input.environment, input.runtime, input.skuId, policyId])}` : void 0;
|
|
3697
3700
|
}
|
|
3698
3701
|
async function load(db, ns, id10) {
|
|
@@ -3718,7 +3721,7 @@ async function restore(row2, input) {
|
|
|
3718
3721
|
discountPolicy: contract.discountPolicy,
|
|
3719
3722
|
approvedFoundingCount: Number(row2.approvedFoundingCount),
|
|
3720
3723
|
now: Number(row2.issuedAt),
|
|
3721
|
-
couponId: await
|
|
3724
|
+
couponId: await membershipDiscountCouponId(input, contract.discountPolicy?.id)
|
|
3722
3725
|
});
|
|
3723
3726
|
if (expected.offering.chapterId !== input.chapterId || expected.offering.baseSkuId !== input.skuId) reject("invalid_offer_snapshot");
|
|
3724
3727
|
const result = {
|
|
@@ -3749,7 +3752,7 @@ async function previewMembershipCommercialOffer(db, input) {
|
|
|
3749
3752
|
discountPolicy: policy,
|
|
3750
3753
|
approvedFoundingCount: Number(approvedFoundingCount),
|
|
3751
3754
|
now: input.now,
|
|
3752
|
-
couponId: await
|
|
3755
|
+
couponId: await membershipDiscountCouponId(input, policy?.id)
|
|
3753
3756
|
});
|
|
3754
3757
|
const discount = contract.billingTerms.discount;
|
|
3755
3758
|
return {
|
|
@@ -3799,7 +3802,7 @@ async function issueMembershipCommercialOffer(db, input) {
|
|
|
3799
3802
|
discountPolicy: policy,
|
|
3800
3803
|
approvedFoundingCount: Number(approvedFoundingCount),
|
|
3801
3804
|
now: input.now,
|
|
3802
|
-
couponId: await
|
|
3805
|
+
couponId: await membershipDiscountCouponId(input, policy?.id)
|
|
3803
3806
|
});
|
|
3804
3807
|
const value = {
|
|
3805
3808
|
id: input.offerId,
|
|
@@ -4847,9 +4850,9 @@ async function subscriptionForSeat(sk, seat) {
|
|
|
4847
4850
|
if (!Array.isArray(discounts) || discounts.length > 5) reject3();
|
|
4848
4851
|
for (const discount of discounts) {
|
|
4849
4852
|
const couponRef = discount.source?.coupon ?? discount.coupon;
|
|
4850
|
-
const
|
|
4851
|
-
if (!
|
|
4852
|
-
const coupon = await read(sk, `/v1/coupons/${encodeURIComponent(
|
|
4853
|
+
const couponId = typeof couponRef === "string" ? couponRef : couponRef?.id;
|
|
4854
|
+
if (!couponId || typeof couponId !== "string") reject3();
|
|
4855
|
+
const coupon = await read(sk, `/v1/coupons/${encodeURIComponent(couponId)}`, { "expand[0]": "applies_to" });
|
|
4853
4856
|
if (coupon.livemode !== (seat.environment === "prod") || !Array.isArray(coupon.applies_to?.products) || coupon.applies_to.products.length !== 1 || coupon.applies_to.products[0] !== primary.price.product) reject3();
|
|
4854
4857
|
}
|
|
4855
4858
|
return sub;
|