Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 21 additions & 0 deletions dist/Rokt-Kit.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,26 @@ IdentityHandler.prototype.onSetUserIdentity = function (
var identityHandler = IdentityHandler;

var roktLauncherScript = 'https://apps.rokt.com/wsdk/integrations/launcher.js';
var roktPreloadIframe = 'https://apps.rokt.com/wsdk/preload/index.html';

function loadRoktPreloadIframe() {
if (document.getElementById('rokt-preload-iframe')) {
return;
}

var iframe = document.createElement('iframe');
iframe.setAttribute('id', 'rokt-preload-iframe');
iframe.setAttribute('aria-hidden', 'true');
iframe.setAttribute('src', roktPreloadIframe);
iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin');

iframe.style.border = '0px';
iframe.style.width = '100%';
iframe.style.display = 'none';

document.body.appendChild(iframe);
}


var initialization = {
name: 'Rokt',
Expand Down Expand Up @@ -194,6 +214,7 @@ var initialization = {
_clientId
) {
if (!testMode) {
loadRoktPreloadIframe();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a point in time we can call this even earlier before the kit boots up?

if (!window.Rokt || !(window.Rokt && window.Rokt.currentLauncher)) {
var target = document.head || document.body;
var script = document.createElement('script');
Expand Down
21 changes: 21 additions & 0 deletions dist/Rokt-Kit.iife.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,26 @@ var RoktKit = (function (exports) {
var identityHandler = IdentityHandler;

var roktLauncherScript = 'https://apps.rokt.com/wsdk/integrations/launcher.js';
var roktPreloadIframe = 'https://apps.rokt.com/wsdk/preload/index.html';

function loadRoktPreloadIframe() {
if (document.getElementById('rokt-preload-iframe')) {
return;
}

var iframe = document.createElement('iframe');
iframe.setAttribute('id', 'rokt-preload-iframe');
iframe.setAttribute('aria-hidden', 'true');
iframe.setAttribute('src', roktPreloadIframe);
iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin');

iframe.style.border = '0px';
iframe.style.width = '100%';
iframe.style.display = 'none';

document.body.appendChild(iframe);
}


var initialization = {
name: 'Rokt',
Expand Down Expand Up @@ -193,6 +213,7 @@ var RoktKit = (function (exports) {
_clientId
) {
if (!testMode) {
loadRoktPreloadIframe();
if (!window.Rokt || !(window.Rokt && window.Rokt.currentLauncher)) {
var target = document.head || document.body;
var script = document.createElement('script');
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@mparticle/web-rokt-wsdk-kit",
"version": "0.0.2",
"main": "dist/RoktWsdk-Kit.common.js",
"version": "0.0.3",
"main": "dist/Rokt-Kit.common.js",
"files": [
"dist/RoktWsdk-Kit.common.js"
"dist/Rokt-Kit.common.js"
],
"repository": "https://github.com/mparticle-integrations/mparticle-javascript-integration-rokt",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ module.exports = {
'@semantic-release/github',
{
assets: [
'dist/RoktWsdk-Kit.common.js',
'dist/RoktWsdk-Kit.iife.js',
'dist/Rokt-Kit.common.js',
'dist/Rokt-Kit.iife.js',
],
},
],
Expand All @@ -59,4 +59,4 @@ module.exports = {
},
],
],
};
};
21 changes: 21 additions & 0 deletions src/initialization.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
var roktLauncherScript = 'https://apps.rokt.com/wsdk/integrations/launcher.js';
var roktPreloadIframe = 'https://apps.rokt.com/wsdk/preload/index.html';

function loadRoktPreloadIframe() {
if (document.getElementById('rokt-preload-iframe')) {
return;
}

var iframe = document.createElement('iframe');
iframe.setAttribute('id', 'rokt-preload-iframe');
iframe.setAttribute('aria-hidden', 'true');
iframe.setAttribute('src', roktPreloadIframe);
iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin');

iframe.style.border = '0px';
iframe.style.width = '100%';
iframe.style.display = 'none';

document.body.appendChild(iframe);
}


Check failure on line 22 in src/initialization.js

View workflow job for this annotation

GitHub Actions / Run Web Kit PR Workflow / Build and Test

Delete `⏎`
var initialization = {
name: 'Rokt',
moduleId: 181,
Expand All @@ -26,6 +46,7 @@
_clientId
) {
if (!testMode) {
loadRoktPreloadIframe();
if (!window.Rokt || !(window.Rokt && window.Rokt.currentLauncher)) {
var target = document.head || document.body;
var script = document.createElement('script');
Expand Down
2 changes: 1 addition & 1 deletion test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

</script>
<!-- change name of XYZ-Kit below to the name of your built kit-->
<script src="../dist/RoktWsdk-Kit.iife.js"></script>
<script src="../dist/Rokt-Kit.iife.js"></script>

<script>mocha.setup('bdd')</script>

Expand Down
2 changes: 1 addition & 1 deletion test/karma.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const files = [
'../node_modules/should/should.js',
'config.js',

'../dist/RoktWsdk-Kit.iife.js',
'../dist/Rokt-Kit.iife.js',

'lib/mockhttprequest.js',
'./test-bundle.js',
Expand Down
Loading