Skip to content

Commit

Permalink
fix: queue options type
Browse files Browse the repository at this point in the history
  • Loading branch information
saikumarrs committed Dec 3, 2024
1 parent fb1ac1a commit 64ce326
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 83 deletions.
8 changes: 4 additions & 4 deletions examples/v3/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
} else {
rudderanalytics.snippetExecuted = true;
window.rudderAnalyticsBuildType = "legacy";
var sdkBaseUrl = "https://cdn.rudderlabs.com/v3";
var sdkBaseUrl = "https://cdn.rudderlabs.com/beta/events-queue-fix-opt-2/8c005fb";
var sdkName = "rsa.min.js";
var scriptLoadingMode = "async";
var methods = [ "setDefaultInstanceKey", "load", "ready", "page", "track", "identify", "alias", "group", "reset", "setAnonymousId", "startSession", "endSession", "consent" ];
Expand Down Expand Up @@ -82,7 +82,7 @@
}
}
})();
window.rudderAnalyticsAddScript("".concat(sdkBaseUrl, "/").concat(window.rudderAnalyticsBuildType, "/").concat(sdkName), "data-rsa-write-key", "__WRITE_KEY__");
window.rudderAnalyticsAddScript("".concat(sdkBaseUrl, "/").concat(window.rudderAnalyticsBuildType, "/").concat(sdkName), "data-rsa-write-key", "2L8Fl7ryPss3Zku133Pj5ox7NeP");
};
if (typeof Promise === "undefined" || typeof globalThis === "undefined") {
window.rudderAnalyticsAddScript("https://polyfill-fastly.io/v3/polyfill.min.js?version=3.111.0&features=Symbol%2CPromise&callback=rudderAnalyticsMount");
Expand All @@ -92,10 +92,10 @@
var loadOptions = {
logLevel: 'DEBUG',
configUrl: 'https://api.rudderstack.com',
destSDKBaseURL: sdkBaseUrl + '/' + window.rudderAnalyticsBuildType + '/js-integrations',
destSDKBaseURL: 'https://cdn.rudderlabs.com/v3/modern/js-integrations',
pluginsSDKBaseURL: sdkBaseUrl + '/' + window.rudderAnalyticsBuildType + '/plugins'
};
rudderanalytics.load('__WRITE_KEY__', '__DATAPLANE_URL__', loadOptions);
rudderanalytics.load('2L8Fl7ryPss3Zku133Pj5ox7NeP', 'https://rudderstacpn.dataplane.rudderstack.com', loadOptions);
}
}
})();
Expand Down
1 change: 1 addition & 0 deletions packages/analytics-js-common/src/types/LoadOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export type QueueOpts = {
batch?: BatchOpts;
// The scale factor applied to the default timer values
timerScaleFactor?: number;
debugDataUrl?: string;
};

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/analytics-js-plugins/src/xhrQueue/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ const XhrQueue = (): ExtensionPlugin => ({
maxRetryAttempts?: number,
willBeRetried?: boolean,
) => {
throw new Error('sample error');

const { data, url, headers } = getRequestInfo(
itemData as XHRRetryQueueItemData,
state,
Expand Down
156 changes: 78 additions & 78 deletions packages/analytics-js/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,93 +175,93 @@

const localRudderAnalyticsRef = window.rudderanalytics;

rudderanalytics.identify(
'customUserID',
{
name: 'John Doe',
title: 'CEO',
email: '[email protected]',
company: 'Company123',
phone: '123-456-7890',
rating: 'Hot',
city: 'Austin',
postalCode: '12345',
country: 'US',
street: 'Sample Address',
state: 'TX',
},
function (message) {
console.log('in identify call', message);
}
);
// rudderanalytics.identify(
// 'customUserID',
// {
// name: 'John Doe',
// title: 'CEO',
// email: '[email protected]',
// company: 'Company123',
// phone: '123-456-7890',
// rating: 'Hot',
// city: 'Austin',
// postalCode: '12345',
// country: 'US',
// street: 'Sample Address',
// state: 'TX',
// },
// function (message) {
// console.log('in identify call', message);
// }
// );

rudderanalytics.page(
'Home',
'Cart Viewed',
{
path: '',
referrer: '',
search: '',
title: '',
url: '',
},
function (message) {
console.log('in page call', message);
}
);
// rudderanalytics.page(
// 'Home',
// 'Cart Viewed',
// {
// path: '',
// referrer: '',
// search: '',
// title: '',
// url: '',
// },
// function (message) {
// console.log('in page call', message);
// }
// );

rudderanalytics.track(
'test track event 1',
{
revenue: 30,
currency: 'USD',
user_actual_id: 12345,
},
function (message) {
console.log('in track call 1', message);
}
);
// rudderanalytics.track(
// 'test track event 1',
// {
// revenue: 30,
// currency: 'USD',
// user_actual_id: 12345,
// },
// function (message) {
// console.log('in track call 1', message);
// }
// );

rudderanalytics.track(
'test track event 2',
{
revenue: 45,
currency: 'INR',
user_actual_id: 333,
},
function (message) {
console.log('in track call 2', message);
}
);
// rudderanalytics.track(
// 'test track event 2',
// {
// revenue: 45,
// currency: 'INR',
// user_actual_id: 333,
// },
// function (message) {
// console.log('in track call 2', message);
// }
// );

rudderanalytics.track(
'test track event 3',
{
revenue: 10003,
currency: 'EUR',
user_actual_id: 5678,
},
function (message) {
console.log('in track call 3', message);
}
);
// rudderanalytics.track(
// 'test track event 3',
// {
// revenue: 10003,
// currency: 'EUR',
// user_actual_id: 5678,
// },
// function (message) {
// console.log('in track call 3', message);
// }
// );

rudderanalytics.ready(function () {
console.log('All ready!!!');

// Once the SDK is ready, fire an event from a cached reference to
// window.rudderanalytics
localRudderAnalyticsRef.track(
'Test track event with cached RS reference',
{
revenue: 10003,
currency: 'EUR',
user_actual_id: 5678,
},
function (message) {
console.log('in track call 4', message);
}
);
// localRudderAnalyticsRef.track(
// 'Test track event with cached RS reference',
// {
// revenue: 10003,
// currency: 'EUR',
// user_actual_id: 5678,
// },
// function (message) {
// console.log('in track call 4', message);
// }
// );
});

document.addEventListener('RSA_Initialised', function (e) {
Expand Down Expand Up @@ -391,4 +391,4 @@ <h1>Test HTML file</h1>
}
</script>
</body>
</html>
</html>
2 changes: 1 addition & 1 deletion packages/analytics-js/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export function getDefaultConfig(distName) {

return {
watch: {
include: ['src/**'],
include: ['src/**', '../analytics-js-plugins/src/**', '../analytics-js-common/src/**', '../analytics-js-cookies/src/**'],
},
external: [/rudderAnalyticsRemotePlugins\/.*/, ...Object.keys(pkg.peerDependencies || {})],
onwarn(warning, warn) {
Expand Down

0 comments on commit 64ce326

Please sign in to comment.