Skip to content

Add support for Ceros Flex embeds#1934

Open
DikshitaKhandke wants to merge 7 commits into
mainfrom
ATC-7328
Open

Add support for Ceros Flex embeds#1934
DikshitaKhandke wants to merge 7 commits into
mainfrom
ATC-7328

Conversation

@DikshitaKhandke

Copy link
Copy Markdown

@DikshitaKhandke DikshitaKhandke left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot-robot prerelease

@fennen529

Copy link
Copy Markdown

@copilot-robot prerelease

@copilot-robot

Copy link
Copy Markdown

Hi, @fennen529, there are no changed packages to publish.

Comment thread packages/@atjson/offset-annotations/src/annotations/ceros-embed.ts Outdated
return (
a.type === "script" &&
typeof a.attributes.src === "string" &&
/(?:^|\/)embed_v\d+\.js(?:[?#].*)?$/i.test(a.attributes.src)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test doesn't seem specific enough, especially for the open-source atjson package that might be used in any arbitrary context. It should at least have the hostname in the test

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. I tightened the Flex detection so it now checks the documented Ceros host and path (assets.ceros.site/js/embed.v*.js) instead of matching any similar filename. I also updated the fixture to use the documented script URL and added a negative test to confirm a non-Ceros host with a similar script name does not get parsed as Flex.

*/
url: string;

/**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be a union type, like

class CerosEmbed extends BlockAnnotation<
    {cerosType?: "studio"; url: string; aspectRatio: number}
  | {cerosType: "flex"; url: string; experienceUrl: string; scriptUrl: string; width: string; height: string}
>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I moved CerosEmbed to a discriminated union so Studio and Flex now have distinct shapes instead of one wide object with loosely related optional fields. I kept url as the canonical experience URL for both variants and dropped experienceUrl, since it was redundant with the renderer logic.

@tim-evans tim-evans left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some questions and would like some further information on valid values! Thanks 😄

Comment on lines +20 to +23
/**
* The script URL required to bootstrap a Flex embed.
*/
scriptUrl?: string;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script URL was previously provided by upstream clients to ensure that the creative URL and the script could be assigned separately. Is there a reason for these to be bundled together?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I separated the concerns more clearly. url is now the canonical experience URL, and scriptUrl remains a separate Flex-specific field, so they are no longer bundled conceptually in the model.

Comment on lines +14 to +18
/**
* The URL to the Flex experience when represented separately
* from the canonical `url` field.
*/
experienceUrl?: string;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing experienceUrl || url in code below indicates that this field is perhaps redundant

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I removed experienceUrl and standardized on url as the single canonical Ceros experience URL. The renderer no longer falls back between the two.

Comment on lines +137 to +138
"data-embed-width": embed.attributes.width,
"data-embed-height": embed.attributes.height,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you provide some documentation on valid values for width and height?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our upstream systems width and height cannot be auto.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I added documentation for those fields in the annotation type. Based on the Ceros Flex docs, width is typically a percentage like 100%, and height is either auto for full-height embeds or a fixed pixel value like 800px for scrolling embeds.

@tim-evans tim-evans changed the title feat(ceros): atc-7328 ceros flex support Add support for Ceros Flex embeds Apr 22, 2026
@tim-evans

Copy link
Copy Markdown
Collaborator

From the Ceros documentation:

There are different scripts used for each:

Flex Studio
https://assets.ceros.site/js/embed.v1.js https://view.ceros.com/scroll-proxy.min.js

There are notes about adding title for accessibility in flex as well. This should be added to support EAA and ADA compliance that we need to have.

Aspect ratios could still be used as a storage mechanism for this annotation, alongside a boolean that controls whether the embed full screen or scrolling, per the documentation 😄

@DikshitaKhandke

Copy link
Copy Markdown
Author

From the Ceros documentation:

There are different scripts used for each:

Flex Studio
https://assets.ceros.site/js/embed.v1.js https://view.ceros.com/scroll-proxy.min.js
There are notes about adding title for accessibility in flex as well. This should be added to support EAA and ADA compliance that we need to have.

Aspect ratios could still be used as a storage mechanism for this annotation, alongside a boolean that controls whether the embed full screen or scrolling, per the documentation 😄

Agreed on the script distinction and the accessibility point. I updated the implementation to use the documented Studio/Flex script URLs and to preserve Flex data-title for accessibility.

For the model itself, I kept this change closer to the documented embed shape by storing the explicit Flex fields rather than normalizing into aspect ratio + fullscreen/scrolling. That normalization could still be a good follow-up, but I kept this pass focused on correctness and round-tripping the documented embed format.

*/
anchorName?: string;
}> {
scriptUrl?: string;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the script url from the annotation. This should be managed upstream by any client using this to ensure that they don't include the script twice on one page, for example.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed this

* either `auto` for a full-height embed or a fixed pixel value
* such as `800px` for a scrolling embed.
*/
height?: string;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto I'm fairly sure will not be compatible with our upstream parsers.

Either verify that this works upstream as a valid value for a width or make this an enum that specifies behavior (a suggestion is full-height | scrolling)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated this as per slack comments

@DikshitaKhandke DikshitaKhandke left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @tim-evans Can you please review this PR as well.

@tim-evans tim-evans left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One requested change to the types

import { BlockAnnotation } from "@atjson/document";

export class CerosEmbed extends BlockAnnotation<{
type SharedCerosEmbedAttributes = {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please inline these as it makes types opaque to any clients using this package

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated this

@DikshitaKhandke DikshitaKhandke requested a review from tim-evans May 12, 2026 07:01

@DikshitaKhandke DikshitaKhandke left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot-robot prerelease

@tim-evans tim-evans left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adapting to our rounds of reviews 😄

@a-rena

a-rena commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

@copilot-robot prerelease

@copilot-robot

Copy link
Copy Markdown

Hi, @a-rena, there are no changed packages to publish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants