From 885925a6250e5295b0c50ce0dd6410358d5de197 Mon Sep 17 00:00:00 2001 From: Aman-engg-sdk Date: Wed, 27 May 2026 14:28:49 +0530 Subject: [PATCH] patch(sdk): update WebSDK integration snippet to new format [WEB-273] - Replace old IIFE loader with new version across 13 integration files - Add sdkVersion variable and versioned CDN URL path - Fix double-init guard to check both initialized/initialised spellings - Expand stub methods list with 18 new API methods - Change app_id to appId in all moe() init calls Co-Authored-By: Claude Sonnet 4.6 --- angular-sample/src/index.html | 5 +++-- chrome-extension/popup.js | 2 +- custom-serviceworker.html | 5 +++-- debug.html | 5 +++-- eu-cluster.html | 7 +++++-- index.html | 5 +++-- lg-web-os/index.html | 5 +++-- nextjs/pages/_document.js | 9 +++++---- nuxt-spa/plugins/moe.js | 5 +++-- react-sample/public/index.html | 5 +++-- samsung-tizen-os/samsungTizenOs/index.html | 5 +++-- self-handled-push.html | 5 +++-- web-personalization.html | 5 +++-- 13 files changed, 41 insertions(+), 27 deletions(-) diff --git a/angular-sample/src/index.html b/angular-sample/src/index.html index 15676d1e..dc36ae3b 100644 --- a/angular-sample/src/index.html +++ b/angular-sample/src/index.html @@ -9,11 +9,12 @@ diff --git a/nuxt-spa/plugins/moe.js b/nuxt-spa/plugins/moe.js index c29429a1..3ca309e6 100644 --- a/nuxt-spa/plugins/moe.js +++ b/nuxt-spa/plugins/moe.js @@ -2,11 +2,12 @@ export default ({ app }) => { var moeDataCenter = "{DC}"; // Replace "{DC}" with the actual Data center value from the above table var moeAppID = "{AppID}"; // Replace "{AppID}" available in the settings page of MoEngage Dashboard. + var sdkVersion = "2"; // Replace this value with the version of Web SDK that you intend to use. It is recommended to use the format x (major) - !function(e,n,i,t,a,r,o,d){if(!moeDataCenter||"{DC}"===moeDataCenter)return console.error("Data center has not been passed correctly. Please follow the SDK installation instruction carefully.");var s=e[a]=e[a]||[];if(s.invoked=0,s.initialised>0||s.invoked>0)return console.error("MoEngage Web SDK initialised multiple times. Please integrate the Web SDK only once!"),!1;e.moengage_object=a;var l={},g=function n(i){return function(){for(var n=arguments.length,t=Array(n),a=0;a1)?(console.error("MoEngage Web SDK initialised multiple times. Please integrate the Web SDK only once!"),!1):(d=arguments.length<=0?void 0:arguments[0],l)},r.addEventListener("load",function(){if(d)return e[a]=e.moe(d),e[a].initialised=e[a].initialised+1||1,!0}),r.addEventListener("error",function(){return console.error("Moengage Web SDK loading failed."),!1})}(window,document,"script","https://cdn.moengage.com/release/"+moeDataCenter+"/moe_webSdk.min.latest.js","Moengage"); + !function(e,n,i,t,a,r,o,d){if(!moeDataCenter||!moeDataCenter.match(/^dc_[0-9]+$/gm))return console.error("Data center has not been passed correctly. Please follow the SDK installation instruction carefully.");var s=e[a]=e[a]||[];if(s.initialized||s.initialised>0)return console.error("MoEngage Web SDK initialized multiple times. Please integrate the Web SDK only once!"),!1;s.invoked=0;e.moengage_object=a;var l={},g=function n(i){return function(){for(var n=arguments.length,t=Array(n),a=0;a1)?(console.error("MoEngage Web SDK initialized multiple times. Please integrate the Web SDK only once!"),!1):(d=arguments.length<=0?void 0:arguments[0],l)},r.addEventListener("load",function(){if(d)return e[a]=e.moe(d),(e[a]&&(e[a].initialised=e[a].initialised+1||1)),!0}),r.addEventListener("error",function(){return console.error("Moengage Web SDK loading failed."),!1})}(window,document,"script","https://cdn.moengage.com/release/"+moeDataCenter+"/versions/"+sdkVersion+"/moe_webSdk.min.latest.js","Moengage"); window.Moengage = moe({ - app_id: moeAppID, + appId: moeAppID, debug_logs: 0 }); }; diff --git a/react-sample/public/index.html b/react-sample/public/index.html index 4c0e0b82..fc63df27 100644 --- a/react-sample/public/index.html +++ b/react-sample/public/index.html @@ -17,11 +17,12 @@