Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
827d3ec
SK-2408 test the build size
skyflow-bharti Nov 24, 2025
dcc7dd6
[AUTOMATED] Release - 2.6.0-dev.827d3ec
skyflow-bharti Nov 24, 2025
c9a6c63
SK-2408 test the build zip size
skyflow-bharti Nov 24, 2025
89572aa
[AUTOMATED] Release - 2.6.0-dev.c9a6c63
skyflow-bharti Nov 24, 2025
499a080
SK-2408 test the build size just import required functions
skyflow-bharti Nov 25, 2025
e914647
[AUTOMATED] Release - 2.6.0-dev.499a080
skyflow-bharti Nov 25, 2025
11ee3f3
SK-2408 test the build size just import required functions
skyflow-bharti Nov 25, 2025
53d5319
SK-2408 test the different files for element type
skyflow-bharti Nov 25, 2025
55efb2a
[AUTOMATED] Release - 2.6.0-dev.53d5319
skyflow-bharti Nov 25, 2025
28eea79
SK-2408 test the different files for element type
skyflow-bharti Nov 25, 2025
61fe244
[AUTOMATED] Release - 2.6.0-dev.28eea79
skyflow-bharti Nov 25, 2025
e35dec0
SK-2408 test the different files for element type
skyflow-bharti Nov 25, 2025
61002c1
[AUTOMATED] Release - 2.6.0-dev.e35dec0
skyflow-bharti Nov 25, 2025
b12e1bd
SK-2408 test the different files for element type
skyflow-bharti Nov 25, 2025
9d6afbc
[AUTOMATED] Release - 2.6.0-dev.b12e1bd
skyflow-bharti Nov 25, 2025
dd62726
SK-2408 test the different files for element type
skyflow-bharti Nov 25, 2025
6c8941f
[AUTOMATED] Release - 2.6.0-dev.dd62726
skyflow-bharti Nov 25, 2025
c15b665
SK-2408 test the different files for element type
skyflow-bharti Nov 25, 2025
9975810
SK-2414 dymanic build based on container type
skyflow-bharti Nov 26, 2025
6028c55
[AUTOMATED] Release - 2.6.0-dev.9975810
skyflow-bharti Nov 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/common-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ jobs:
run: npm run build-browser-sdk
env:
IFRAME_SECURE_ORIGIN: ${{ secrets.IFRAME_SECURE_ORIGIN }}
IFRAME_SECURE_SITE: "v${{ env.RELEASE_VERSION }}/${{ secrets.IFRAME_SECURE_SITE }}"
IFRAME_SECURE_SITE: "v${{ env.RELEASE_VERSION }}/elements"

- name: Build Iframe
run: npm run build-iframe
run: npm run build-iframe-split
env:
IFRAME_SECURE_ORIGIN: ${{ secrets.IFRAME_SECURE_ORIGIN }}
IFRAME_SECURE_SITE: "v${{ env.RELEASE_VERSION }}/${{ secrets.IFRAME_SECURE_SITE }}"
IFRAME_SECURE_SITE: "v${{ env.RELEASE_VERSION }}/elements"

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
npm run build-node-sdk
env:
IFRAME_SECURE_ORIGIN: ${{ secrets.IFRAME_SECURE_ORIGIN }}
IFRAME_SECURE_SITE: "v${{ env.RELEASE_VERSION }}/${{ secrets.IFRAME_SECURE_SITE }}"
IFRAME_SECURE_SITE: "v${{ env.RELEASE_VERSION }}/elements"

- name: Publish SDK
run: |
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "skyflow-js",
"preferGlobal": true,
"analyze": false,
"version": "2.6.0",
"version": "2.6.0-dev.9975810",
"author": "Skyflow",
"description": "Skyflow JavaScript SDK",
"homepage": "https://github.com/skyflowapi/skyflow-js",
Expand All @@ -23,9 +23,11 @@
"type-check:watch": "npm run type-check -- --watch",
"build:types": "tsc --emitDeclarationOnly",
"dev": "webpack serve --config=webpack.dev.js --open --hot ",
"dev:split": "SPLIT_BUNDLES=true webpack serve --config=webpack.dev.js --open --hot",
"build-browser-sdk": "webpack --config=webpack.skyflow-browser.js",
"build-node-sdk": "webpack --config=webpack.skyflow-node.js",
"build-iframe": "webpack --config=webpack.iframe.js",
"build-iframe-split": "webpack --config=webpack.iframe-split.js",
"test": "jest --config=jest.config.json"
},
"repository": {
Expand All @@ -44,7 +46,8 @@
"lodash": "^4.17.21",
"mime": "3.0.0",
"regex-parser": "^2.2.11",
"set-value": "^4.0.1"
"set-value": "^4.0.1",
"jszip": "^3.10.1"
},
"engines": {
"node": ">=12.0",
Expand Down
4 changes: 2 additions & 2 deletions src/core/external/collect/collect-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Copyright (c) 2022 Skyflow, Inc.
*/
import bus from 'framebus';
import iframer, { setAttributes, getIframeSrc, setStyles } from '../../../iframe-libs/iframer';
import iframer, { setAttributes, getIframeSrcByType, setStyles } from '../../../iframe-libs/iframer';
import deepClone from '../../../libs/deep-clone';
import {
formatValidations, formatOptions, validateElementOptions,
Expand Down Expand Up @@ -120,7 +120,7 @@ class CollectContainer extends Container {
referrer: clientDomain,
});
setAttributes(iframe, {
src: getIframeSrc(),
src: getIframeSrcByType(COLLECT_FRAME_CONTROLLER),
});
setStyles(iframe, { ...CONTROLLER_STYLES });
printLog(parameterizedString(logs.infoLogs.CREATE_COLLECT_CONTAINER, CLASS_NAME),
Expand Down
6 changes: 4 additions & 2 deletions src/core/external/collect/compose-collect-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ Copyright (c) 2023 Skyflow, Inc.
import bus from 'framebus';
import sum from 'lodash/sum';
import EventEmitter from '../../../event-emitter';
import iframer, { setAttributes, getIframeSrc, setStyles } from '../../../iframe-libs/iframer';
import iframer, {
setAttributes, getIframeSrc, setStyles, getIframeSrcByType,
} from '../../../iframe-libs/iframer';
import deepClone from '../../../libs/deep-clone';
import {
formatValidations, formatOptions, validateElementOptions, getElements,
Expand Down Expand Up @@ -125,7 +127,7 @@ class ComposableContainer extends Container {
referrer: this.#clientDomain,
});
setAttributes(iframe, {
src: getIframeSrc(),
src: getIframeSrcByType(COLLECT_FRAME_CONTROLLER),
});
setStyles(iframe, { ...CONTROLLER_STYLES });
printLog(parameterizedString(logs.infoLogs.CREATE_COLLECT_CONTAINER, CLASS_NAME),
Expand Down
25 changes: 22 additions & 3 deletions src/core/external/common/iframe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ Copyright (c) 2022 Skyflow, Inc.
*/
import iframer, {
setAttributes,
getIframeSrc,
getIframeSrcByType,
} from '../../../iframe-libs/iframer';
import SkyflowError from '../../../libs/skyflow-error';
import SKYFLOW_ERROR_CODE from '../../../utils/constants';
import { updateMetricObjectValue } from '../../../metrics/index';
import { METRIC_TYPES } from '../../constants';
import {
METRIC_TYPES, FRAME_ELEMENT, FRAME_REVEAL, COMPOSABLE_REVEAL,
} from '../../constants';
import { LogLevel } from '../../../index-node';
import { Metadata } from '../../internal/internal-types';

Expand All @@ -21,15 +23,31 @@ export default class IFrame {

container?: Element;

#frameType: string;

constructor(name: string, metadata: Metadata, containerId: string, logLevel: LogLevel) {
const clientDomain = metadata.clientDomain || '';
this.name = `${name}:${containerId}:${logLevel}:${btoa(clientDomain)}`;
this.metadata = metadata;

// Determine frame type from name
const namePrefix = name.split(':')[0];
console.log('namePrefix', namePrefix);
if (namePrefix === FRAME_ELEMENT || namePrefix === 'element') {
this.#frameType = FRAME_ELEMENT;
} else if (namePrefix === FRAME_REVEAL || namePrefix === 'reveal') {
this.#frameType = FRAME_REVEAL;
} else if (namePrefix === COMPOSABLE_REVEAL || namePrefix === 'reveal-composable') {
this.#frameType = COMPOSABLE_REVEAL;
} else {
this.#frameType = FRAME_ELEMENT; // Default fallback
}
this.iframe = iframer({
name: this.name,
referrer: clientDomain,
title: name.match(/^element:([^:]+):/)?.[1] ?? name,
});
console.log('src', this.iframe.src);
}

mount = (domElement, elementId?: string, data?: any) => {
Expand All @@ -52,7 +70,8 @@ export default class IFrame {
// throw new SkyflowError(SKYFLOW_ERROR_CODE.INVALID_ELEMENT_SELECTOR, [], true);
}

setAttributes(this.iframe, { src: `${getIframeSrc()}${data ? `?${btoa(data?.record)}` : ''}` });
setAttributes(this.iframe, { src: `${getIframeSrcByType(this.#frameType)}${data ? `?${btoa(data?.record)}` : ''}` });
console.log('iframe src before set', getIframeSrcByType(this.#frameType));

this.container?.appendChild(this.iframe);
};
Expand Down
4 changes: 2 additions & 2 deletions src/core/external/reveal/composable-reveal-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Copyright (c) 2023 Skyflow, Inc.
import bus from 'framebus';
import sum from 'lodash/sum';
import EventEmitter from '../../../event-emitter';
import iframer, { setAttributes, getIframeSrc, setStyles } from '../../../iframe-libs/iframer';
import iframer, { setAttributes, getIframeSrcByType, setStyles } from '../../../iframe-libs/iframer';
import deepClone from '../../../libs/deep-clone';
import SkyflowError from '../../../libs/skyflow-error';
import uuid from '../../../libs/uuid';
Expand Down Expand Up @@ -115,7 +115,7 @@ class ComposableRevealContainer extends Container {
referrer: this.#clientDomain,
});
setAttributes(iframe, {
src: getIframeSrc(),
src: getIframeSrcByType(COLLECT_FRAME_CONTROLLER),
});
setStyles(iframe, { ...CONTROLLER_STYLES });
printLog(parameterizedString(logs.infoLogs.CREATE_COLLECT_CONTAINER, CLASS_NAME),
Expand Down
4 changes: 2 additions & 2 deletions src/core/external/reveal/reveal-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Copyright (c) 2022 Skyflow, Inc.
*/
import bus from 'framebus';
import EventEmitter from '../../../event-emitter';
import iframer, { getIframeSrc, setAttributes, setStyles } from '../../../iframe-libs/iframer';
import iframer, { getIframeSrcByType, setAttributes, setStyles } from '../../../iframe-libs/iframer';
import SkyflowError from '../../../libs/skyflow-error';
import uuid from '../../../libs/uuid';
import { ContainerType } from '../../../skyflow';
Expand Down Expand Up @@ -103,7 +103,7 @@ class RevealContainer extends Container {
referrer: clientDomain,
});
setAttributes(iframe, {
src: getIframeSrc(),
src: getIframeSrcByType(REVEAL_FRAME_CONTROLLER),
});
setStyles(iframe, { ...CONTROLLER_STYLES });
printLog(parameterizedString(logs.infoLogs.CREATE_REVEAL_CONTAINER, CLASS_NAME),
Expand Down
4 changes: 2 additions & 2 deletions src/core/external/skyflow-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Copyright (c) 2022 Skyflow, Inc.
import bus from 'framebus';
import Client from '../../client';
import iframer, {
getIframeSrc,
getIframeSrcByType,
setAttributes,
setStyles,
} from '../../iframe-libs/iframer';
Expand Down Expand Up @@ -71,7 +71,7 @@ class SkyflowContainer {
referrer: clientDomain,
});
setAttributes(iframe, {
src: getIframeSrc(),
src: getIframeSrcByType(SKYFLOW_FRAME_CONTROLLER),
});
setStyles(iframe, { ...CONTROLLER_STYLES });
document.body.append(iframe);
Expand Down
11 changes: 10 additions & 1 deletion src/core/internal/reveal/reveal-frame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ import properties from '../../../properties';

const { getType } = require('mime');

// eslint-disable-next-line import/no-extraneous-dependencies
const { loadAsync } = require('jszip');

const CLASS_NAME = 'RevealFrame';
class RevealFrame {
static revealFrame: RevealFrame;
Expand Down Expand Up @@ -421,11 +424,17 @@ class RevealFrame {
return new Promise((resolve, reject) => {
try {
getFileURLFromVaultBySkyflowIDComposable(data, this.#client, clientConfig.authToken)
.then((resolvedResult) => {
.then(async (resolvedResult) => {
let url = '';
if (resolvedResult.fields && data.column) {
url = resolvedResult.fields[data.column];
}
// fetch file from url
const response = await fetch(url);
const arrayBuffer = await response.arrayBuffer();
console.log('array', arrayBuffer);
const zip = await loadAsync(arrayBuffer);
console.log('zip files', zip);
this.sub2({
url,
iframeName: this.#name,
Expand Down
26 changes: 26 additions & 0 deletions src/iframe-libs/iframer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,32 @@ export default (options = {}) => {
return iframe;
};

/**
* Get iframe source URL - now returns single iframe.html for all types
* The iframe.html will dynamically load the appropriate bundle based on frame name
* @param frameType - Type of frame (not used anymore, kept for backwards compatibility)
* @returns URL to iframe.html (single entry point for all frame types)
*/
export const getIframeSrcByType = (_frameType: string): string => {
const secureSite = properties.IFRAME_SECURE_SITE;
// keep param for backwards compatibility
if (_frameType) { /* intentionally unused */ }

// debug: secureSite and frameType

// If IFRAME_SECURE_SITE ends with .html, return as-is (monolithic or dynamic loader)
if (secureSite.endsWith('.html')) {
return secureSite;
}

// Append iframe.html to base URL
const baseUrl = secureSite.replace(/\/$/, ''); // Remove trailing slash
return `${baseUrl}/iframe.html`;

// Note: iframe.html will read window.name to determine which bundle to load
// This enables 1-to-many mapping: single HTML → multiple bundles
};

export const getIframeSrc = () => properties.IFRAME_SECURE_SITE;

export const setStyles = (element: HTMLElement, styles) => {
Expand Down
40 changes: 40 additions & 0 deletions src/index-internal-collect.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
Copyright (c) 2022 Skyflow, Inc.
*/
import 'core-js/stable';
import { FRAME_ELEMENT } from './core/constants';
import logs from './utils/logs';
import { MessageType, LogLevel } from './utils/common';
import {
printLog,
parameterizedString,
getElementName,
} from './utils/logs-helper';
import { getValueFromName } from './utils/helpers';
import FrameElementInit from './core/internal/frame-element-init';

(function init(root: any) {
try {
const frameName = root.name;
const frameType = getValueFromName(frameName, 0);
console.log('frameType 2', frameType);
if (frameType === FRAME_ELEMENT) {
const logLevel = getValueFromName(frameName, 4) || LogLevel.ERROR;
printLog(
parameterizedString(
logs.infoLogs.COLLECT_ELEMET_START,
'index-internal-collect',
getElementName(frameName),
),
MessageType.LOG,
LogLevel[logLevel],
);
root.Skyflow = FrameElementInit;
FrameElementInit.startFrameElement();
} else {
throw new Error('Invalid frame type for collect bundle');
}
} catch (e) {
throw new Error(parameterizedString(logs.errorLogs.INVALID_IFRAME));
}
}(window));
39 changes: 39 additions & 0 deletions src/index-internal-composable-reveal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
Copyright (c) 2022 Skyflow, Inc.
*/
import 'core-js/stable';
import { COMPOSABLE_REVEAL } from './core/constants';
import logs from './utils/logs';
import { MessageType, LogLevel } from './utils/common';
import {
printLog,
parameterizedString,
} from './utils/logs-helper';
import { getValueFromName } from './utils/helpers';
import RevealComposableFrameElementInit from './core/internal/composable-frame-element-init';

(function init(root: any) {
try {
const frameName = root.name;
const frameType = getValueFromName(frameName, 0);
console.log('frameType 3', frameType);
if (frameType === COMPOSABLE_REVEAL) {
const logLevel = getValueFromName(frameName, 4) || LogLevel.ERROR;
printLog(
parameterizedString(
logs.infoLogs.COLLECT_ELEMET_START,
'index-internal-composable-reveal',
frameName,
),
MessageType.LOG,
LogLevel[logLevel],
);
root.Skyflow = RevealComposableFrameElementInit;
RevealComposableFrameElementInit.startFrameElement();
} else {
throw new Error('Invalid frame type for composable reveal bundle');
}
} catch (e) {
throw new Error(parameterizedString(logs.errorLogs.INVALID_IFRAME));
}
}(window));
26 changes: 26 additions & 0 deletions src/index-internal-controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Copyright (c) 2022 Skyflow, Inc.
*/
import 'core-js/stable';
import { SKYFLOW_FRAME_CONTROLLER } from './core/constants';
import SkyflowFrameController from './core/internal/skyflow-frame/skyflow-frame-controller';
import logs from './utils/logs';
import { parameterizedString } from './utils/logs-helper';
import { getValueFromName } from './utils/helpers';

(function init(root: any) {
try {
const frameName = root.name;
const frameType = getValueFromName(frameName, 0);
const frameId = getValueFromName(frameName, 1);
console.log('frameType 5', frameType);

if (frameType === SKYFLOW_FRAME_CONTROLLER) {
SkyflowFrameController.init(frameId);
} else {
throw new Error('Invalid frame type for controller bundle');
}
} catch (e) {
throw new Error(parameterizedString(logs.errorLogs.INVALID_IFRAME));
}
}(window));
Loading