@reblu/site-blocks 0.26.0 → 0.27.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @reblu/site-blocks
2
2
 
3
+ ## 0.27.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3f76060: `CoursePurchaseTerms` shows the consent box that the course's modality calls for (REB-1240). It reads `AcademyCourseDetail.withdrawalConsent`:
8
+ - Digital content: the withdrawal waiver. It keeps `data-slot="course-purchase-terms-withdrawal-waiver"`, as in REB-1199.
9
+ - A training service: the express request to start, which does not say the withdrawal right is lost. It uses the new `data-slot="course-purchase-terms-service-start-request"`.
10
+ - A course in person or by webinar: no box.
11
+
12
+ Both items carry `data-kind`. Against an API that predates `withdrawalConsent`, the block still reads `withdrawalWaiverRequired`.
13
+
14
+ **Visible change:** each box is now followed by the tenant's exact text, «Texto de la casilla: «…»». Replace it, or hide it with an empty node, through the new `consentText` label. `serviceStartRequest` is also a new label.
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [143cef1]
19
+ - @reblu/site-contracts@1.27.0
20
+
3
21
  ## 0.26.0
4
22
 
5
23
  ### Minor Changes
package/README.md CHANGED
@@ -25,7 +25,7 @@ colour on the red background. See `docs/theming/theming.md`.
25
25
  | `sanitizeHtml` | `.` | Sanitises an HTML string before `dangerouslySetInnerHTML` — the **HTML boundary**. See "Security boundaries" below. |
26
26
  | `MarkdownRenderer` | `.` | Canonical Blog renderer: `marked` → **hast-util-sanitize** (XSS) → component map, with a YouTube-domain allowlist. RSC-safe. |
27
27
  | `CourseDescription` | `.` | Drop-in for the rich-text course `description` (`client.academy.bySlug()`). Server Component. See "Rich-text descriptions". |
28
- | `CoursePurchaseTerms`, `DEFAULT_COURSE_PURCHASE_TERMS_LABELS` | `.` | What the buyer sees before paying: withdrawal waiver, access duration, refund guarantee. Server Component. See "Course purchase terms". |
28
+ | `CoursePurchaseTerms`, `DEFAULT_COURSE_PURCHASE_TERMS_LABELS` | `.` | What the buyer sees before paying: consent box by course modality, access duration, refund guarantee. Server Component. See "Course purchase terms". |
29
29
  | `LessonPreview`, `DEFAULT_LESSON_PREVIEW_LABELS` | `.` | A public free-preview lesson: hosted video player + sanitised body (`getLessonPreview()`). Server Component. See "Free-preview lesson". |
30
30
  | `Treatment`, `ParentPage`, `ProfileCard`, `ProductCard` | `.` | Presentational organisms over the SITE API contracts. RSC-safe. `Specialty`: deprecated alias, see below. |
31
31
  | `ProfessionalFields` | `.` | The tenant's own professional fields (`professional.fields`) on a team card or profile. RSC-safe. See below. |
@@ -1128,11 +1128,16 @@ export default async function Page({ params }) {
1128
1128
  `lesson-preview-badge`, `lesson-preview-duration`, `lesson-preview-player`,
1129
1129
  `lesson-preview-content`.
1130
1130
 
1131
- ## Course purchase terms — `CoursePurchaseTerms` (REB-1199)
1131
+ ## Course purchase terms — `CoursePurchaseTerms` (REB-1199, REB-1240)
1132
1132
 
1133
1133
  What a buyer must see before paying for a course, from `client.academy.bySlug()`:
1134
1134
 
1135
- - **Withdrawal waiver** (`withdrawalWaiverRequired`): checkout asks for a separate box in which the buyer requests immediate access and waives the 14-day withdrawal right.
1135
+ - **Consent box** (`withdrawalConsent`, REB-1240): which box checkout asks for, as set by the course's modality (`deliveryModality`), followed by the tenant's exact text:
1136
+ - `DIGITAL_CONTENT_WAIVER`, for digital content: the buyer requests immediate access and waives the 14-day withdrawal right (`labels.withdrawalWaiver`);
1137
+ - `SERVICE_START_REQUEST`, for a training service: the buyer expressly asks for the training to start within the 14 days. It does not say the right is lost (`labels.serviceStartRequest`);
1138
+ - `null`, for example in person or webinar: nothing is shown.
1139
+
1140
+ Against an API that predates `withdrawalConsent`, the block falls back to `withdrawalWaiverRequired` (waiver line only).
1136
1141
  - **Access duration** (`accessDurationMonths`): months of access after enrolment. `null` means no end date, and nothing is shown.
1137
1142
  - **Refund guarantee** (`refundGuarantee`): the course's terms. `null` means none, and nothing is shown.
1138
1143
 
@@ -1150,11 +1155,15 @@ const course = await client.academy.bySlug(slug)
1150
1155
  course={course}
1151
1156
  labels={{
1152
1157
  withdrawalWaiver: 'Immediate access: you waive the 14-day withdrawal right.',
1158
+ serviceStartRequest: 'You ask the training to start within the 14-day withdrawal period.',
1159
+ consentText: (text) => ` Box text: “${text}”`,
1153
1160
  accessDuration: (months) => `Access for ${months} months.`,
1154
1161
  }}
1155
1162
  />
1156
1163
  ```
1157
1164
 
1165
+ The waiver item keeps `data-slot='course-purchase-terms-withdrawal-waiver'` (as in REB-1199); the express request to start uses `data-slot='course-purchase-terms-service-start-request'`. Both carry `data-kind` with the kind.
1166
+
1158
1167
  ## Page blocks
1159
1168
 
1160
1169
  `PageBlocks` renders a page's registry blocks (`PageDetail.blocks` from
package/dist/index.cjs CHANGED
@@ -13548,6 +13548,8 @@ function CourseDescription({
13548
13548
  var import_jsx_runtime3 = require("react/jsx-runtime");
13549
13549
  var DEFAULT_COURSE_PURCHASE_TERMS_LABELS = {
13550
13550
  withdrawalWaiver: "El acceso empieza al comprar: al pagar pides el acceso inmediato y renuncias al derecho de desistimiento de 14 d\xEDas.",
13551
+ serviceStartRequest: "Al pagar pides expresamente que la formaci\xF3n empiece dentro del plazo de desistimiento de 14 d\xEDas.",
13552
+ consentText: (text3) => ` Texto de la casilla: \xAB${text3}\xBB`,
13551
13553
  accessDuration: (months) => `Acceso durante ${months} ${months === 1 ? "mes" : "meses"} desde la inscripci\xF3n.`,
13552
13554
  refundGuarantee: ({ basis, thresholdPercent, windowDays }) => {
13553
13555
  const period = windowDays != null ? ` durante ${windowDays} d\xEDas desde el pago` : "";
@@ -13568,7 +13570,21 @@ function CoursePurchaseTerms({
13568
13570
  }) {
13569
13571
  const text3 = { ...DEFAULT_COURSE_PURCHASE_TERMS_LABELS, ...labels };
13570
13572
  const items = [];
13571
- if (course.withdrawalWaiverRequired === true) {
13573
+ if (course.withdrawalConsent !== void 0) {
13574
+ const consent = course.withdrawalConsent;
13575
+ if (consent) {
13576
+ const line = consent.kind === "SERVICE_START_REQUEST" ? text3.serviceStartRequest : text3.withdrawalWaiver;
13577
+ items.push({
13578
+ // The waiver keeps its REB-1199 slot (existing SITE styles target it).
13579
+ key: consent.kind === "SERVICE_START_REQUEST" ? "service-start-request" : "withdrawal-waiver",
13580
+ kind: consent.kind,
13581
+ node: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
13582
+ line,
13583
+ text3.consentText(consent.text)
13584
+ ] })
13585
+ });
13586
+ }
13587
+ } else if (course.withdrawalWaiverRequired === true) {
13572
13588
  items.push({ key: "withdrawal-waiver", node: text3.withdrawalWaiver });
13573
13589
  }
13574
13590
  if (typeof course.accessDurationMonths === "number") {
@@ -13579,7 +13595,7 @@ function CoursePurchaseTerms({
13579
13595
  }
13580
13596
  if (items.length === 0) return null;
13581
13597
  const hasHeading = heading !== void 0 && heading !== null && heading !== "";
13582
- const list = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: slotClassName("list-disc space-y-1 pl-5", "text-sm text-muted-foreground", listClassName), children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { "data-slot": `course-purchase-terms-${item.key}`, children: item.node }, item.key)) });
13598
+ const list = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: slotClassName("list-disc space-y-1 pl-5", "text-sm text-muted-foreground", listClassName), children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { "data-slot": `course-purchase-terms-${item.key}`, "data-kind": item.kind, children: item.node }, item.key)) });
13583
13599
  const Tag = `h${headingLevel}`;
13584
13600
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
13585
13601
  "section",