@coframe/sdk 1.1.1 → 1.1.2

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.
@@ -45,12 +45,15 @@ async function fetchProjectFromEdge(projectId, currentUrl, signal, userContext,
45
45
  }
46
46
  }
47
47
 
48
- async function fetchAntiflickerFromEdge(projectId, currentUrl, userContext, headers) {
48
+ async function fetchAntiflickerFromEdge(projectId, currentUrl, userContext, enableElementAntiFlicker, headers) {
49
49
  try {
50
50
  const payload = { projectId, currentUrl };
51
51
  if (userContext) {
52
52
  payload.userContext = userContext;
53
53
  }
54
+ if (enableElementAntiFlicker) {
55
+ payload.enableElementAntiFlicker = enableElementAntiFlicker;
56
+ }
54
57
  const config = encodeURIComponent(JSON.stringify(payload));
55
58
  const edgeUrl = new URL(`${"https://edge.cofra.me"}/cf.css`);
56
59
  edgeUrl.searchParams.set('config', config);
@@ -73,7 +76,7 @@ async function getProjectData(options) {
73
76
  ? fetchProjectFromEdge(options.projectId, options.currentUrl, undefined, options.userContext, options.headers)
74
77
  : Promise.resolve(null),
75
78
  includeCSS
76
- ? fetchAntiflickerFromEdge(options.projectId, options.currentUrl, options.userContext, options.headers)
79
+ ? fetchAntiflickerFromEdge(options.projectId, options.currentUrl, options.userContext, options.enableElementAntiFlicker, options.headers)
77
80
  : Promise.resolve(null),
78
81
  ]);
79
82
  const config = {};
@@ -43,12 +43,15 @@ async function fetchProjectFromEdge(projectId, currentUrl, signal, userContext,
43
43
  }
44
44
  }
45
45
 
46
- async function fetchAntiflickerFromEdge(projectId, currentUrl, userContext, headers) {
46
+ async function fetchAntiflickerFromEdge(projectId, currentUrl, userContext, enableElementAntiFlicker, headers) {
47
47
  try {
48
48
  const payload = { projectId, currentUrl };
49
49
  if (userContext) {
50
50
  payload.userContext = userContext;
51
51
  }
52
+ if (enableElementAntiFlicker) {
53
+ payload.enableElementAntiFlicker = enableElementAntiFlicker;
54
+ }
52
55
  const config = encodeURIComponent(JSON.stringify(payload));
53
56
  const edgeUrl = new URL(`${"https://edge.cofra.me"}/cf.css`);
54
57
  edgeUrl.searchParams.set('config', config);
@@ -71,7 +74,7 @@ async function getProjectData(options) {
71
74
  ? fetchProjectFromEdge(options.projectId, options.currentUrl, undefined, options.userContext, options.headers)
72
75
  : Promise.resolve(null),
73
76
  includeCSS
74
- ? fetchAntiflickerFromEdge(options.projectId, options.currentUrl, options.userContext, options.headers)
77
+ ? fetchAntiflickerFromEdge(options.projectId, options.currentUrl, options.userContext, options.enableElementAntiFlicker, options.headers)
75
78
  : Promise.resolve(null),
76
79
  ]);
77
80
  const config = {};
@@ -234,6 +234,7 @@ type CoframeConfig = {
234
234
  projectId: string;
235
235
  trackingOnly?: boolean;
236
236
  enableAntiFlickering?: boolean;
237
+ enableElementAntiFlicker?: boolean;
237
238
  waitForHydration?: boolean;
238
239
  waitForCookiesEnabled?: boolean;
239
240
  waitForFeatureFlag?: boolean;
@@ -237,6 +237,7 @@ type CoframeConfig = {
237
237
  projectId: string;
238
238
  trackingOnly?: boolean;
239
239
  enableAntiFlickering?: boolean;
240
+ enableElementAntiFlicker?: boolean;
240
241
  waitForHydration?: boolean;
241
242
  waitForCookiesEnabled?: boolean;
242
243
  waitForFeatureFlag?: boolean;
@@ -215,6 +215,7 @@ interface GetProjectDataOptions {
215
215
  currentUrl: string;
216
216
  userContext?: Record<string, unknown>;
217
217
  headers: Headers | Record<string, string>;
218
+ enableElementAntiFlicker?: boolean;
218
219
  includeProject?: boolean;
219
220
  includeCSS?: boolean;
220
221
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coframe/sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Coframe optimizes your website using generative AI to deliver maximum impact to your audience and allow your site to improve itself as you sleep. Learn more at coframe.com.",
5
5
  "main": "dist/pkg/cf.cjs.js",
6
6
  "module": "dist/pkg/cf.esm.mjs",