Skip to content

Commit

Permalink
fix: rename cne-ticketing-widget to cne-event-registration
Browse files Browse the repository at this point in the history
  • Loading branch information
fedeava committed Dec 15, 2023
1 parent 0450e79 commit 067eb32
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { BlockAnnotation } from "@atjson/document";

export class CneEventRegistrationEmbed extends BlockAnnotation<{
url: string;
}> {
static vendorPrefix = "offset";
static type = "cne-event-registration-embed";
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export * from "./bold";
export * from "./caption-source";
export * from "./ceros-embed";
export * from "./cne-audio-embed";
export * from "./cne-ticketing-widget-embed";
export * from "./cne-event-registration-embed";
export * from "./code";
export * from "./code-block";
export * from "./facebook-embed";
Expand Down
4 changes: 2 additions & 2 deletions packages/@atjson/offset-annotations/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
Bold,
CerosEmbed,
CneAudioEmbed,
CneTicketingWidgetEmbed,
CneEventRegistrationEmbed,
Code,
CodeBlock,
FacebookEmbed,
Expand Down Expand Up @@ -49,7 +49,7 @@ export default class OffsetSource extends Document {
Bold,
CerosEmbed,
CneAudioEmbed,
CneTicketingWidgetEmbed,
CneEventRegistrationEmbed,
Code,
CodeBlock,
FacebookEmbed,
Expand Down
8 changes: 4 additions & 4 deletions packages/@atjson/renderer-html/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
Blockquote,
CerosEmbed,
CneAudioEmbed,
CneTicketingWidgetEmbed,
CneEventRegistrationEmbed,
CodeBlock,
Heading,
Image,
Expand Down Expand Up @@ -153,9 +153,9 @@ export default class HTMLRenderer extends Renderer {
)}></iframe></div><script type="text/javascript" src="//view.ceros.com/scroll-proxy.min.js" data-ceros-origin-domains="view.ceros.com"></script>`;
}

// CNE Ticketing Widget embed
*CneTicketingWidgetEmbed(embed: Block<CneTicketingWidgetEmbed>) {
return yield* this.$("cne-ticketing-widget", {
// CNE Event Registration embed
*CneEventRegistrationEmbed(embed: Block<CneEventRegistrationEmbed>) {
return yield* this.$("cne-event-registration", {
url: embed.attributes.url,
});
}
Expand Down
16 changes: 8 additions & 8 deletions packages/@atjson/renderer-html/test/renderer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import OffsetSource, {
Bold,
CerosEmbed,
CneAudioEmbed,
CneTicketingWidgetEmbed,
CneEventRegistrationEmbed,
Code,
CodeBlock,
Heading,
Expand Down Expand Up @@ -614,12 +614,12 @@ describe("renderer-html", () => {
);
});

describe("Cneticketingwidget", () => {
test("only baseurl", () => {
describe("Cne Event Registration", () => {
test("baseurl only", () => {
let doc = new OffsetSource({
content: "\uFFFC",
annotations: [
new CneTicketingWidgetEmbed({
new CneEventRegistrationEmbed({
start: 0,
end: 1,
attributes: {
Expand All @@ -633,18 +633,18 @@ describe("renderer-html", () => {
expect(
Renderer.render(serialize(doc, { withStableIds: true }))
).toMatchInlineSnapshot(
`"<cne-ticketing-widget url="https://baseurl"></cne-ticketing-widget>"`
`"<cne-event-registration url="https://baseurl"></cne-event-registration>"`
);
});
test("full param", () => {
let doc = new OffsetSource({
content: "\uFFFC",
annotations: [
new CneTicketingWidgetEmbed({
new CneEventRegistrationEmbed({
start: 0,
end: 1,
attributes: {
url: "https://baseurl?loggedout=loggedouturlslug&loggedin=loggedinslug&privacy=true",
url: "https://baseurl?loggedout=loggedoutslug&loggedin=loggedinslug&privacy=true",
},
}),
new ParseAnnotation({ start: 0, end: 1 }),
Expand All @@ -654,7 +654,7 @@ describe("renderer-html", () => {
expect(
Renderer.render(serialize(doc, { withStableIds: true }))
).toMatchInlineSnapshot(
`"<cne-ticketing-widget url="https://baseurl?loggedout=loggedouturlslug&amp;loggedin=loggedinslug&amp;privacy=true"></cne-ticketing-widget>"`
`"<cne-event-registration url="https://baseurl?loggedout=loggedoutslug&amp;loggedin=loggedinslug&amp;privacy=true"></cne-event-registration>"`
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import { ObjectAnnotation } from "@atjson/document";
import { GlobalAttributes } from "../global-attributes";

export class CneTicketingWidgetEmbed extends ObjectAnnotation<
export class CneEventRegistrationEmbed extends ObjectAnnotation<
GlobalAttributes & {
url: string;
}
> {
static vendorPrefix = "html";
static type = "cne-ticketing-widget";
static type = "cne-event-registration";
}
2 changes: 1 addition & 1 deletion packages/@atjson/source-html/src/annotations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export * from "./button";
export * from "./canvas";
export * from "./caption";
export * from "./cite";
export * from "./cne-ticketing-widget-embed";
export * from "./cne-event-registration-embed";
export * from "./code";
export * from "./col";
export * from "./colgroup";
Expand Down
18 changes: 14 additions & 4 deletions packages/@atjson/source-html/src/converter/third-party-embeds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
AudioEnvironments,
CerosEmbed,
CneAudioEmbed,
CneTicketingWidgetEmbed,
CneEventRegistrationEmbed,
FireworkEmbed,
} from "@atjson/offset-annotations";
import { Script } from "../annotations";
Expand Down Expand Up @@ -216,12 +216,22 @@ export default function convertThirdPartyEmbeds(doc: Document) {
);
});
/**
* CNE Ticketing Widget
* CNE Event Registration Embed:
* is used to insert an iframe tag into the HTML page with two different URLs based on the user's status. The parameter passed to the embed is a specific URL, with some specific metadata encoded in the URL
* https://baseurl?loggedout=loggedoutslug&loggedin=loggedinslug&privacy=true
*
* If the user is not logged in to the site, the iframe URL will be https://baseurl/{loggedout}
* If the user is logged in to the site the iframe url will be https://baseurl/{loggedin}
*
* The (optional) privacy parameter will be used to check the user's choices regarding privacy (default value: true)
* if privacy = false --> no control, the iframe with the relative URL is always inserted into the page;
* if privacy = true --> user does not accept privacy (profiling) a warning will be shown on the page instead of the iframe (no iframe shown);
* if privacy = true --> user accepts privacy (profiling) the iframe with the relative URL will be inserted on the page;
*/
doc.where({ type: "-html-cne-ticketing-widget" }).update((embed) => {
doc.where({ type: "-html-cne-event-registration" }).update((embed) => {
doc.replaceAnnotation(
embed,
new CneTicketingWidgetEmbed({
new CneEventRegistrationEmbed({
id: embed.id,
start: embed.start,
end: embed.end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { serialize } from "@atjson/document";
import OffsetSource from "@atjson/offset-annotations";
import HTMLSource from "../src";

describe("Cne Ticketing Widget embeds", () => {
describe("CNE Event Registration embed", () => {
test("only baseurl", () => {
let doc = HTMLSource.fromRaw(
`<cne-ticketing-widget url="https://baseurl"></cne-ticketing-widget>`
`<cne-event-registration url="https://baseurl"></cne-event-registration>`
).convertTo(OffsetSource);

expect(serialize(doc, { withStableIds: true })).toMatchInlineSnapshot(`
Expand All @@ -18,7 +18,7 @@ describe("Cne Ticketing Widget embeds", () => {
"id": "B00000000",
"parents": [],
"selfClosing": false,
"type": "cne-ticketing-widget-embed",
"type": "cne-event-registration-embed",
},
],
"marks": [],
Expand All @@ -29,20 +29,20 @@ describe("Cne Ticketing Widget embeds", () => {

test("full param", () => {
let doc = HTMLSource.fromRaw(
`<cne-ticketing-widget url="https://baseurl?loggedout=loggedouturlslug&loggedin=loggedinslug&privacy=true"></cne-ticketing-widget>`
`<cne-event-registration url="https://baseurl?loggedout=loggedoutslug&loggedin=loggedinslug&privacy=true"></cne-event-registration>`
).convertTo(OffsetSource);

expect(serialize(doc, { withStableIds: true })).toMatchInlineSnapshot(`
{
"blocks": [
{
"attributes": {
"url": "https://baseurl?loggedout=loggedouturlslug&loggedin=loggedinslug&privacy=true",
"url": "https://baseurl?loggedout=loggedoutslug&loggedin=loggedinslug&privacy=true",
},
"id": "B00000000",
"parents": [],
"selfClosing": false,
"type": "cne-ticketing-widget-embed",
"type": "cne-event-registration-embed",
},
],
"marks": [],
Expand Down

0 comments on commit 067eb32

Please sign in to comment.