From 8e884f8eee8eff209aab2996d552e13e47606106 Mon Sep 17 00:00:00 2001
From: lpw <812862340@qq.com>
Date: Sun, 28 Sep 2025 15:06:21 +0800
Subject: [PATCH] 提交版本 4.8.0
---
frameworks/Didomi.xcframework/ios-arm64_x86_64-simulator/Didomi.framework/web_sdk_utilities.js | 47 +++++++++++++++++++++++++++++++++++++++--------
1 files changed, 39 insertions(+), 8 deletions(-)
diff --git a/frameworks/Didomi.xcframework/ios-arm64_x86_64-simulator/Didomi.framework/web_sdk_utilities.js b/frameworks/Didomi.xcframework/ios-arm64_x86_64-simulator/Didomi.framework/web_sdk_utilities.js
index cfe1c68..b83c8ea 100644
--- a/frameworks/Didomi.xcframework/ios-arm64_x86_64-simulator/Didomi.framework/web_sdk_utilities.js
+++ b/frameworks/Didomi.xcframework/ios-arm64_x86_64-simulator/Didomi.framework/web_sdk_utilities.js
@@ -1,7 +1,9 @@
/** Script allowing to use the Web SDK from a WebView */
+// Check if SDK is still initializing and should not display the notice yet
+var initializationInProgress = true;
// Check if notice was initially displayed
-var noticeReady = false;
+var noticeDisplayed = false;
/**
* Initialize the SDK with the specified configuration
@@ -11,6 +13,10 @@
// Set the global window configuration to the config object
window.didomiConfig = prepareConfigFromMobile(config, languageCode, isUnderage);
+ // Set the location properties
+ window.didomiCountry = extractCountryFromMobileConfig(config);
+ window.didomiRegion = extractRegionFromMobileConfig(config);
+
// If app, vendors, and iab exist, set the vendorList property
if (
window.didomiConfig.app &&
@@ -63,18 +69,23 @@
* Open the notice screen
*/
function openNotice(userStatus, options) {
+ var hasDeepLink = options != null && options.deepLinkView != null
+ if (!hasDeepLink) {
+ initializationInProgress = false
+ }
handleWebSDKEvents();
window.didomiOnReady = window.didomiOnReady || [];
window.didomiOnReady.push(function (Didomi) {
Didomi.setUserStatus(userStatus);
- if (options != null && options.deepLinkView != null) {
+ if (hasDeepLink) {
+ initializationInProgress = false;
Didomi.preferences.show(
options.deepLinkView == 0 ? "purposes" : "vendors"
);
} else {
Didomi.notice.show();
}
- noticeReady = true;
+ noticeDisplayed = true;
});
}
@@ -153,7 +164,7 @@
{
event: 'notice.hidden',
listener: function () {
- if (noticeReady && !Didomi.preferences.isVisible()) {
+ if (noticeDisplayed && !Didomi.preferences.isVisible()) {
if (isIOS()) {
window.webkit.messageHandlers.noticeHidden.postMessage("");
} else {
@@ -165,7 +176,10 @@
{
event: 'notice.shown',
listener: function () {
- if (isIOS()) {
+ if (initializationInProgress) {
+ // Make sure the notice is not displayed if initialization is still in progress
+ Didomi.notice.hide();
+ } else if (isIOS()) {
window.webkit.messageHandlers.noticeShown.postMessage("");
} else {
androidInterface.onNoticeShown();
@@ -412,13 +426,12 @@
/**
* Fix unescaped quotes.
+ * Note: lookbehinds (`(?<=...)` or `(?<!...)`) are only supported from safari 17+
* @param {string} text
* @returns the sanitized text
*/
function sanitizeText(text) {
- return text
- // Escape unescaped quotes
- .replace(/(?<!\\)(['"])/g, '\$1');
+ return text.replace(/(^|[^\\])(['"])/g, '$1\$2');
}
/**
@@ -491,6 +504,24 @@
}
/**
+ * Extract the country from the mobile config.
+ * @param {*} configFromMobile
+ * @returns the country or null if not defined.
+ */
+function extractCountryFromMobileConfig(configFromMobile) {
+ return configFromMobile.user ? configFromMobile.user.country : null;
+}
+
+/**
+ * Extract the region from the mobile config.
+ * @param {*} configFromMobile
+ * @returns the region or null if not defined.
+ */
+function extractRegionFromMobileConfig(configFromMobile) {
+ return configFromMobile.user ? configFromMobile.user.region : null;
+}
+
+/**
* Prepare config file to be consumed by the Web SDK, by disabling the features already handled by Mobile SDKs.
* @param {*} configFromMobile Config provided by mobile.
* @param {string} languageCode language code to be set in the Config.
--
Gitblit v1.8.0