@braze/web-sdk 6.7.1 → 6.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/index.d.ts +165 -38
  2. package/package.json +1 -1
  3. package/shared-lib/encoding-utils.js +2 -2
  4. package/shared-lib/event-types.js +16 -16
  5. package/shared-lib/indexed-db-adapter.js +65 -65
  6. package/shared-lib/logger.js +18 -18
  7. package/shared-lib/supported-options.js +1 -1
  8. package/src/Banner/banner-provider.js +67 -59
  9. package/src/Banner/banner.js +40 -19
  10. package/src/Banner/dismiss-banner.js +4 -0
  11. package/src/Banner/display/banner-to-html.js +10 -10
  12. package/src/Banner/display/destroy-banner-html.js +2 -2
  13. package/src/Banner/get-all-banners.js +6 -6
  14. package/src/Banner/get-banner.js +6 -6
  15. package/src/Banner/index.js +1 -0
  16. package/src/Banner/log-banner-click.js +7 -7
  17. package/src/Banner/log-banner-dismissal.js +7 -7
  18. package/src/Banner/log-banner-impressions.js +27 -18
  19. package/src/Banner/request-banners-refresh.js +8 -8
  20. package/src/Banner/subscribe-to-banners-updates.js +5 -5
  21. package/src/Banner/ui/insert-banner.js +8 -8
  22. package/src/Card/card-manager.js +31 -31
  23. package/src/Card/log-card-dismissal.js +2 -2
  24. package/src/Card/log-content-card-click.js +2 -2
  25. package/src/Card/log-content-card-impressions.js +4 -4
  26. package/src/Card/models/captioned-image.js +15 -15
  27. package/src/Card/models/card.js +89 -89
  28. package/src/Card/models/classic-card.js +16 -16
  29. package/src/Card/models/control-card.js +7 -7
  30. package/src/Card/models/image-only.js +13 -13
  31. package/src/Card/util/card-factory.js +32 -32
  32. package/src/ContentCards/content-cards-provider-factory.js +13 -11
  33. package/src/ContentCards/content-cards-provider.js +105 -105
  34. package/src/ContentCards/get-cached-content-cards.js +2 -2
  35. package/src/ContentCards/request-content-cards-refresh.js +2 -2
  36. package/src/ContentCards/subscribe-to-content-cards-updates.js +10 -10
  37. package/src/ContentCards/ui/show-content-cards.js +7 -7
  38. package/src/Core/add-sdk-metadata.js +2 -2
  39. package/src/Core/change-user.js +5 -5
  40. package/src/Core/destroy.js +2 -2
  41. package/src/Core/disable-sdk.js +4 -4
  42. package/src/Core/enable-sdk.js +4 -4
  43. package/src/Core/get-device-id.js +2 -2
  44. package/src/Core/handle-braze-action.js +5 -5
  45. package/src/Core/index.js +1 -0
  46. package/src/Core/log-custom-event.js +5 -5
  47. package/src/Core/log-ecommerce-event.js +29 -0
  48. package/src/Core/log-purchase.js +23 -198
  49. package/src/Core/open-session.js +10 -10
  50. package/src/Core/set-logger.js +2 -2
  51. package/src/Core/set-sdk-authentication-signature.js +1 -1
  52. package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -1
  53. package/src/Core/toggle-logging.js +2 -2
  54. package/src/Core/wipe-data.js +6 -6
  55. package/src/DUST/dust-connection-core.js +1 -0
  56. package/src/DUST/dust-provider-factory.js +10 -10
  57. package/src/DUST/dust-provider.js +258 -226
  58. package/src/DUST/dust-shared-worker-code.js +1 -1
  59. package/src/DUST/dust-shared-worker-impl.js +97 -103
  60. package/src/DUST/dust-worker-bridge.js +55 -40
  61. package/src/DUST/subscribe-to-dust.js +7 -7
  62. package/src/FeatureFlags/feature-flag-factory.js +8 -8
  63. package/src/FeatureFlags/feature-flag.js +3 -3
  64. package/src/FeatureFlags/feature-flags-provider.js +21 -21
  65. package/src/FeatureFlags/log-feature-flag-impression.js +5 -5
  66. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
  67. package/src/InAppMessage/constants.js +3 -3
  68. package/src/InAppMessage/defer-in-app-message.js +3 -3
  69. package/src/InAppMessage/display/html-message-to-html.js +4 -4
  70. package/src/InAppMessage/display/in-app-message-to-html.js +32 -32
  71. package/src/InAppMessage/display/modal-utils.js +2 -2
  72. package/src/InAppMessage/in-app-message-factory.js +36 -36
  73. package/src/InAppMessage/in-app-message-manager.js +35 -35
  74. package/src/InAppMessage/log-in-app-message-button-click.js +3 -3
  75. package/src/InAppMessage/log-in-app-message-click.js +3 -3
  76. package/src/InAppMessage/log-in-app-message-html-click.js +3 -3
  77. package/src/InAppMessage/log-in-app-message-impression.js +3 -3
  78. package/src/InAppMessage/models/control-message.js +4 -4
  79. package/src/InAppMessage/models/full-screen-message.js +9 -9
  80. package/src/InAppMessage/models/html-message.js +2 -2
  81. package/src/InAppMessage/models/in-app-message-button.js +4 -4
  82. package/src/InAppMessage/models/in-app-message.js +34 -34
  83. package/src/InAppMessage/models/modal-message.js +7 -7
  84. package/src/InAppMessage/models/slide-up-message.js +8 -8
  85. package/src/InAppMessage/ui/show-in-app-message.js +20 -20
  86. package/src/Push/push-manager.js +44 -44
  87. package/src/User/user-manager.js +19 -19
  88. package/src/User/user.js +17 -17
  89. package/src/common/base-provider.js +1 -1
  90. package/src/common/constants.js +1 -0
  91. package/src/common/content-cards-display.js +6 -6
  92. package/src/common/event-logger.js +3 -3
  93. package/src/common/properties-base.js +3 -3
  94. package/src/l10n/l10n-manager.js +2 -2
  95. package/src/managers/auth-manager.js +11 -11
  96. package/src/managers/braze-instance.js +59 -59
  97. package/src/managers/device-manager.js +9 -9
  98. package/src/managers/network-manager.js +65 -63
  99. package/src/managers/server-config-manager.js +110 -93
  100. package/src/managers/session-manager.js +20 -20
  101. package/src/managers/storage-manager-factory.js +9 -9
  102. package/src/managers/storage-manager.js +137 -137
  103. package/src/managers/subscription-manager.js +2 -2
  104. package/src/managers/utils.js +1 -1
  105. package/src/models/braze-event.js +2 -2
  106. package/src/models/identifier.js +5 -5
  107. package/src/models/push-token.js +8 -8
  108. package/src/models/request-result.js +1 -1
  109. package/src/models/server-config.js +46 -28
  110. package/src/request-controller.js +124 -124
  111. package/src/triggers/models/custom-event-data.js +4 -4
  112. package/src/triggers/models/custom-event-property-data.js +5 -5
  113. package/src/triggers/models/filter-set.js +2 -2
  114. package/src/triggers/models/filter.js +1 -1
  115. package/src/triggers/models/in-app-message-click-data.js +5 -5
  116. package/src/triggers/models/purchase-data.js +1 -1
  117. package/src/triggers/models/purchase-property-data.js +2 -2
  118. package/src/triggers/models/push-click-data.js +5 -5
  119. package/src/triggers/models/trigger-condition.js +45 -45
  120. package/src/triggers/models/trigger-events.js +3 -3
  121. package/src/triggers/models/trigger.js +30 -30
  122. package/src/triggers/triggers-provider.js +63 -63
  123. package/src/types.js +5 -1
  124. package/src/ui/js/attach-css.js +1 -1
  125. package/src/util/braze-actions.js +6 -6
  126. package/src/util/browser-detector.js +13 -13
  127. package/src/util/client-hints-parser.js +5 -5
  128. package/src/util/code-utils.js +2 -2
  129. package/src/util/deprecation-utils.js +2 -2
  130. package/src/util/dom-utils.js +8 -8
  131. package/src/util/ecommerce-event-validation.js +343 -0
  132. package/src/util/html-display-utils.js +11 -11
  133. package/src/util/iso-4217-currency-codes.js +176 -0
  134. package/src/util/net.js +4 -4
  135. package/src/util/request-header-utils.js +10 -10
  136. package/src/util/string-utils.js +2 -2
  137. package/src/util/user-agent-parser.js +15 -15
  138. package/src/util/validation-utils.js +14 -14
@@ -1,2 +1,2 @@
1
1
  export const DUST_SHARED_WORKER_CODE =
2
- '\n"use strict";\nconst workerSelf = self;\nlet eventSource = null;\nlet currentConfig = null;\nlet retryCount = 0;\nlet retryTimeoutId = null;\nlet connectionInProgress = false;\nconst maxRetries = 5;\nconst connectedPorts = new Map();\nlet lastSleepMs = null;\nlet currentRcs = null;\nlet ttlTimeoutId = null;\nlet leaderPortId = null;\nlet ddrTimeoutId = null;\nconst fn = {\n startConnection: null,\n handleMessage: null,\n};\nfunction broadcast(message) {\n connectedPorts.forEach((portInfo, portId) => {\n try {\n portInfo.port.postMessage(message);\n }\n catch (_a) {\n connectedPorts.delete(portId);\n }\n });\n}\nfunction randomInclusive(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}\nfunction electLeader() {\n if (leaderPortId && connectedPorts.has(leaderPortId)) {\n return;\n }\n const firstPortId = connectedPorts.keys().next().value;\n leaderPortId = firstPortId || null;\n if (leaderPortId) {\n console.log("[Braze Real-Time] Elected leader port:", leaderPortId);\n }\n}\nfunction promoteToLeader(portId) {\n if (connectedPorts.has(portId) && leaderPortId !== portId) {\n leaderPortId = portId;\n console.log("[Braze Real-Time] Promoted to leader (tab became active):", portId);\n }\n}\nfunction sendToLeader(message) {\n electLeader();\n if (!leaderPortId) {\n console.warn("[Braze Real-Time] No leader to send message to");\n return;\n }\n const leader = connectedPorts.get(leaderPortId);\n if (leader) {\n try {\n leader.port.postMessage(message);\n }\n catch (_a) {\n connectedPorts.delete(leaderPortId);\n leaderPortId = null;\n sendToLeader(message);\n }\n }\n}\nfunction closeConnection() {\n connectionInProgress = false;\n if (retryTimeoutId !== null) {\n clearTimeout(retryTimeoutId);\n retryTimeoutId = null;\n }\n if (ttlTimeoutId !== null) {\n clearTimeout(ttlTimeoutId);\n ttlTimeoutId = null;\n }\n if (ddrTimeoutId !== null) {\n clearTimeout(ddrTimeoutId);\n ddrTimeoutId = null;\n }\n if (eventSource) {\n eventSource.close();\n eventSource = null;\n broadcast({ type: "disconnected" });\n }\n}\nfunction retryWithBackoff() {\n if (!currentConfig) {\n return;\n }\n retryCount++;\n const { minSleepMs, maxSleepMs, scaleFactor } = currentConfig.backoff;\n let previousSleepMs = lastSleepMs;\n if (previousSleepMs == null || previousSleepMs < minSleepMs) {\n previousSleepMs = minSleepMs;\n }\n const backoffMs = Math.min(maxSleepMs, randomInclusive(minSleepMs, previousSleepMs * scaleFactor));\n lastSleepMs = backoffMs;\n console.log("[Braze Real-Time] Retrying in " + backoffMs + "ms (attempt " + retryCount + "/" + maxRetries + ")");\n retryTimeoutId = setTimeout(function () {\n retryTimeoutId = null;\n fn.startConnection();\n }, backoffMs);\n}\nfunction startConnection(oldEventSourceToClose) {\n if (!currentConfig) {\n return;\n }\n if (eventSource && !oldEventSourceToClose) {\n console.warn("[Braze Real-Time] Connection already exists");\n return;\n }\n if (connectionInProgress && !oldEventSourceToClose) {\n console.warn("[Braze Real-Time] Connection attempt already in progress");\n return;\n }\n connectionInProgress = true;\n const { dustHost, mite, auth } = currentConfig;\n const dustHostWithScheme = /^https?:\\/\\//i.test(dustHost) ? dustHost : "https://" + dustHost;\n let queryString = "mite=" + encodeURIComponent(mite) + "&attempts=" + retryCount;\n if (auth) {\n queryString += "&auth=" + encodeURIComponent(auth);\n }\n if (currentRcs) {\n queryString += "&rcs=" + encodeURIComponent(currentRcs);\n }\n const subscribeUrl = dustHostWithScheme + "/sse?" + queryString;\n try {\n const newEventSource = new EventSource(subscribeUrl);\n newEventSource.onopen = function () {\n if (oldEventSourceToClose) {\n console.log("[Braze Real-Time] Gapless reconnection: new connection established, closing old connection");\n oldEventSourceToClose.close();\n }\n else {\n console.log("[Braze Real-Time] Connection established");\n }\n eventSource = newEventSource;\n connectionInProgress = false;\n retryCount = 0;\n lastSleepMs = null;\n broadcast({ type: "connected" });\n };\n newEventSource.addEventListener("msg", function (event) {\n fn.handleMessage(event.data);\n });\n newEventSource.onerror = function () {\n const readyState = newEventSource ? newEventSource.readyState : -1;\n if (readyState === 0) {\n console.log("[Braze Real-Time] Failed to connect");\n }\n else {\n console.log("[Braze Real-Time] Connection lost");\n }\n if (oldEventSourceToClose && eventSource !== newEventSource) {\n console.log("[Braze Real-Time] Gapless reconnection failed, keeping old connection");\n newEventSource.close();\n connectionInProgress = false;\n if (retryCount < maxRetries) {\n retryWithBackoff();\n }\n return;\n }\n closeConnection();\n if (retryCount < maxRetries) {\n retryWithBackoff();\n }\n else {\n console.error("[Braze Real-Time] Max retries reached");\n broadcast({ type: "error", error: "Max retry attempts reached" });\n }\n };\n }\n catch (error) {\n connectionInProgress = false;\n console.error("[Braze Real-Time] Failed to create EventSource:", error);\n broadcast({ type: "error", error: String(error) });\n }\n}\nfunction handleTtlMessage(tMs, rcs) {\n if (typeof tMs !== "number") {\n return;\n }\n if (typeof rcs === "string") {\n currentRcs = rcs;\n }\n console.log("[Braze Real-Time] TTL set to " + tMs + "ms, will perform gapless reconnection when expired");\n if (ttlTimeoutId !== null) {\n clearTimeout(ttlTimeoutId);\n }\n ttlTimeoutId = setTimeout(function () {\n ttlTimeoutId = null;\n console.log("[Braze Real-Time] TTL expired, performing gapless reconnection");\n startConnection(eventSource || undefined);\n }, tMs);\n}\nfunction handleDdrMessage(rMs, reason) {\n if (typeof rMs !== "number") {\n return;\n }\n const jitter = Math.random() * rMs * 0.3;\n const waitMs = Math.round(rMs + jitter);\n const reasonStr = reason ? " (" + reason + ")" : "";\n console.log("[Braze Real-Time] Admin requested disconnect" + reasonStr + ", reconnecting in " + waitMs + "ms");\n if (ddrTimeoutId !== null) {\n clearTimeout(ddrTimeoutId);\n }\n closeConnection();\n ddrTimeoutId = setTimeout(function () {\n ddrTimeoutId = null;\n fn.startConnection();\n }, waitMs);\n}\nfunction handleMessage(data) {\n try {\n const message = JSON.parse(data);\n if (!message.type) {\n console.warn("[Braze Real-Time] Message without type:", message);\n return;\n }\n if (message.type === "ttl" && message.body) {\n handleTtlMessage(message.body.t_ms, message.body.rcs);\n return;\n }\n if (message.type === "ddr" && message.body) {\n handleDdrMessage(message.body.r_ms, message.body.e);\n return;\n }\n console.log("[Braze Real-Time] Routing \'" + message.type + "\' message to leader");\n sendToLeader({ type: "message", data: message });\n }\n catch (error) {\n console.warn("[Braze Real-Time] Failed to parse message:", error);\n }\n}\nfn.startConnection = startConnection;\nfn.handleMessage = handleMessage;\nfunction handlePortMessage(port, portId, message) {\n switch (message.type) {\n case "connect":\n if (currentConfig &&\n (currentConfig.mite !== message.config.mite || currentConfig.dustHost !== message.config.dustHost)) {\n console.log("[Braze Real-Time] Config changed, reconnecting");\n closeConnection();\n retryCount = 0;\n lastSleepMs = null;\n currentRcs = null;\n }\n currentConfig = message.config;\n electLeader();\n if (!eventSource && !connectionInProgress) {\n startConnection();\n }\n else if (eventSource) {\n port.postMessage({ type: "connected" });\n }\n break;\n case "disconnect":\n connectedPorts.delete(portId);\n if (portId === leaderPortId) {\n leaderPortId = null;\n electLeader();\n }\n if (connectedPorts.size === 0) {\n console.log("[Braze Real-Time] No more ports, closing connection");\n closeConnection();\n currentConfig = null;\n currentRcs = null;\n leaderPortId = null;\n }\n break;\n case "tab_active":\n promoteToLeader(portId);\n break;\n case "ping":\n port.postMessage({ type: "pong" });\n break;\n default:\n console.warn("[Braze Real-Time] Unknown message type:", message.type);\n }\n}\nworkerSelf.onconnect = function (event) {\n const port = event.ports[0];\n const portId = "port-" + Date.now() + "-" + Math.random().toString(36).substr(2, 9);\n connectedPorts.set(portId, { port: port });\n port.onmessage = function (messageEvent) {\n try {\n handlePortMessage(port, portId, messageEvent.data);\n }\n catch (error) {\n console.error("[Braze Real-Time] Error handling message:", error);\n }\n };\n port.onmessageerror = function () {\n console.warn("[Braze Real-Time] Message error from port:", portId);\n connectedPorts.delete(portId);\n };\n port.start();\n};\n';
2
+ '\n"use strict";\nconst workerSelf = self;\nlet eventSource = null;\nlet currentConfig = null;\nlet retryCount = 0;\nlet retryTimeoutId = null;\nlet connectionInProgress = false;\nconst maxRetries = 5;\nconst connectedPorts = new Map();\nlet lastSleepMs = null;\nlet currentRcs = null;\nlet ttlTimeoutId = null;\nlet leaderPortId = null;\nlet ddrTimeoutId = null;\nconst fn = {\n startConnection: null,\n handleMessage: null,\n};\nfunction broadcast(message) {\n connectedPorts.forEach((portInfo, portId) => {\n try {\n portInfo.port.postMessage(message);\n }\n catch (_a) {\n connectedPorts.delete(portId);\n }\n });\n}\nfunction randomInclusive(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}\nfunction electLeader() {\n if (leaderPortId && connectedPorts.has(leaderPortId)) {\n return;\n }\n const firstPortId = connectedPorts.keys().next().value;\n leaderPortId = firstPortId || null;\n if (leaderPortId) {\n console.log("[Braze Real-Time] Elected leader port:", leaderPortId);\n }\n}\nfunction promoteToLeader(portId) {\n if (connectedPorts.has(portId) && leaderPortId !== portId) {\n leaderPortId = portId;\n console.log("[Braze Real-Time] Promoted to leader (tab became active):", portId);\n }\n}\nfunction sendToLeader(message) {\n electLeader();\n if (!leaderPortId) {\n console.warn("[Braze Real-Time] No leader to send message to");\n return;\n }\n const leader = connectedPorts.get(leaderPortId);\n if (leader) {\n try {\n leader.port.postMessage(message);\n }\n catch (_a) {\n connectedPorts.delete(leaderPortId);\n leaderPortId = null;\n sendToLeader(message);\n }\n }\n}\nfunction closeConnection() {\n connectionInProgress = false;\n if (retryTimeoutId !== null) {\n clearTimeout(retryTimeoutId);\n retryTimeoutId = null;\n }\n if (ttlTimeoutId !== null) {\n clearTimeout(ttlTimeoutId);\n ttlTimeoutId = null;\n }\n if (ddrTimeoutId !== null) {\n clearTimeout(ddrTimeoutId);\n ddrTimeoutId = null;\n }\n if (eventSource) {\n eventSource.close();\n eventSource = null;\n broadcast({ type: "disconnected" });\n }\n}\nfunction retryWithBackoff() {\n if (!currentConfig) {\n return;\n }\n retryCount++;\n const { minSleepMs, maxSleepMs, scaleFactor } = currentConfig.backoff;\n let previousSleepMs = lastSleepMs;\n if (previousSleepMs == null || previousSleepMs < minSleepMs) {\n previousSleepMs = minSleepMs;\n }\n const backoffMs = Math.min(maxSleepMs, randomInclusive(minSleepMs, previousSleepMs * scaleFactor));\n lastSleepMs = backoffMs;\n console.log(`[Braze Real-Time] Retrying in ${backoffMs}ms (attempt ${retryCount}/${maxRetries})`);\n retryTimeoutId = setTimeout(function () {\n retryTimeoutId = null;\n fn.startConnection();\n }, backoffMs);\n}\nfunction startConnection(oldEventSourceToClose) {\n if (!currentConfig) {\n return;\n }\n if (eventSource && !oldEventSourceToClose) {\n console.warn("[Braze Real-Time] Connection already exists");\n return;\n }\n if (connectionInProgress && !oldEventSourceToClose) {\n console.warn("[Braze Real-Time] Connection attempt already in progress");\n return;\n }\n connectionInProgress = true;\n const { dustHost, mite, auth } = currentConfig;\n const dustHostWithScheme = /^https?:\\/\\//i.test(dustHost) ? dustHost : `https://${dustHost}`;\n let queryString = `mite=${encodeURIComponent(mite)}&attempts=${retryCount}`;\n if (auth) {\n queryString += `&auth=${encodeURIComponent(auth)}`;\n }\n if (currentRcs) {\n queryString += `&rcs=${encodeURIComponent(currentRcs)}`;\n }\n const subscribeUrl = `${dustHostWithScheme}/sse?${queryString}`;\n try {\n const newEventSource = new EventSource(subscribeUrl);\n newEventSource.onopen = function () {\n if (oldEventSourceToClose) {\n console.log("[Braze Real-Time] Gapless reconnection: new connection established, closing old connection");\n oldEventSourceToClose.close();\n }\n else {\n console.log("[Braze Real-Time] Connection established");\n }\n eventSource = newEventSource;\n connectionInProgress = false;\n retryCount = 0;\n lastSleepMs = null;\n broadcast({ type: "connected" });\n };\n newEventSource.addEventListener("msg", function (event) {\n fn.handleMessage(event.data);\n });\n newEventSource.onerror = function () {\n const readyState = newEventSource ? newEventSource.readyState : -1;\n if (readyState === 0) {\n console.log("[Braze Real-Time] Failed to connect");\n }\n else {\n console.log("[Braze Real-Time] Connection lost");\n }\n if (oldEventSourceToClose && eventSource !== newEventSource) {\n console.log("[Braze Real-Time] Gapless reconnection failed, keeping old connection");\n newEventSource.close();\n connectionInProgress = false;\n if (retryCount < maxRetries) {\n retryWithBackoff();\n }\n return;\n }\n closeConnection();\n if (retryCount < maxRetries) {\n retryWithBackoff();\n }\n else {\n console.error("[Braze Real-Time] Max retries reached");\n broadcast({ type: "error", error: "Max retry attempts reached" });\n }\n };\n }\n catch (error) {\n connectionInProgress = false;\n console.error("[Braze Real-Time] Failed to create EventSource:", error);\n broadcast({ type: "error", error: String(error) });\n }\n}\nfunction handleTtlMessage(tMs, rcs) {\n if (typeof tMs !== "number") {\n return;\n }\n if (typeof rcs === "string") {\n currentRcs = rcs;\n }\n console.log(`[Braze Real-Time] TTL set to ${tMs}ms, will perform gapless reconnection when expired`);\n if (ttlTimeoutId !== null) {\n clearTimeout(ttlTimeoutId);\n }\n ttlTimeoutId = setTimeout(function () {\n ttlTimeoutId = null;\n console.log("[Braze Real-Time] TTL expired, performing gapless reconnection");\n startConnection(eventSource || undefined);\n }, tMs);\n}\nfunction handleDdrMessage(rMs, reason) {\n if (typeof rMs !== "number") {\n return;\n }\n const backoffConfig = currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig.backoff;\n const minSleepMs = (backoffConfig === null || backoffConfig === void 0 ? void 0 : backoffConfig.minSleepMs) || 10000;\n const scaleFactor = (backoffConfig === null || backoffConfig === void 0 ? void 0 : backoffConfig.scaleFactor) || 3;\n const maxSleepMs = (backoffConfig === null || backoffConfig === void 0 ? void 0 : backoffConfig.maxSleepMs) || 300000;\n const backoffMs = Math.min(maxSleepMs, randomInclusive(minSleepMs, minSleepMs * scaleFactor));\n const waitMs = Math.round(rMs + backoffMs);\n const reasonStr = reason ? ` (${reason})` : "";\n console.log(`[Braze Real-Time] Admin requested disconnect${reasonStr}, reconnecting in ${waitMs}ms (r_ms=${rMs} + backoff=${backoffMs})`);\n if (ddrTimeoutId !== null) {\n clearTimeout(ddrTimeoutId);\n }\n closeConnection();\n ddrTimeoutId = setTimeout(function () {\n ddrTimeoutId = null;\n fn.startConnection();\n }, waitMs);\n}\nfunction handleMessage(data) {\n try {\n const message = JSON.parse(data);\n if (!message.type) {\n console.warn("[Braze Real-Time] Message without type:", message);\n return;\n }\n if (message.type === "ttl" && message.body) {\n handleTtlMessage(message.body.t_ms, message.body.rcs);\n return;\n }\n if (message.type === "ddr" && message.body) {\n handleDdrMessage(message.body.r_ms, message.body.e);\n return;\n }\n console.log(`[Braze Real-Time] Routing \'${message.type}\' message to leader`);\n sendToLeader({ type: "message", data: message });\n }\n catch (error) {\n console.warn("[Braze Real-Time] Failed to parse message:", error);\n }\n}\nfn.startConnection = startConnection;\nfn.handleMessage = handleMessage;\nfunction handlePortMessage(port, portId, message) {\n switch (message.type) {\n case "connect":\n if (currentConfig &&\n (currentConfig.mite !== message.config.mite || currentConfig.dustHost !== message.config.dustHost)) {\n console.log("[Braze Real-Time] Config changed, reconnecting");\n closeConnection();\n retryCount = 0;\n lastSleepMs = null;\n currentRcs = null;\n }\n currentConfig = message.config;\n if (!connectedPorts.has(portId)) {\n connectedPorts.set(portId, { port: port });\n }\n electLeader();\n if (!eventSource && !connectionInProgress) {\n startConnection();\n }\n else if (eventSource) {\n port.postMessage({ type: "connected" });\n }\n break;\n case "disconnect":\n connectedPorts.delete(portId);\n if (portId === leaderPortId) {\n leaderPortId = null;\n electLeader();\n }\n if (connectedPorts.size === 0) {\n console.log("[Braze Real-Time] No more ports, closing connection");\n closeConnection();\n currentConfig = null;\n currentRcs = null;\n leaderPortId = null;\n }\n break;\n case "tab_active":\n promoteToLeader(portId);\n break;\n case "ping":\n port.postMessage({ type: "pong" });\n break;\n default:\n console.warn("[Braze Real-Time] Unknown message type:", message.type);\n }\n}\nworkerSelf.onconnect = function (event) {\n const port = event.ports[0];\n const portId = `port-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;\n connectedPorts.set(portId, { port: port });\n port.onmessage = function (messageEvent) {\n try {\n handlePortMessage(port, portId, messageEvent.data);\n }\n catch (error) {\n console.error("[Braze Real-Time] Error handling message:", error);\n }\n };\n port.onmessageerror = function () {\n console.warn("[Braze Real-Time] Message error from port:", portId);\n connectedPorts.delete(portId);\n };\n port.start();\n};\n';
@@ -3,83 +3,80 @@ let te = null,
3
3
  le = null,
4
4
  ce = 0,
5
5
  ae = null,
6
- re = !1;
7
- const ie = new Map();
8
- let se = null,
9
- ue = null,
6
+ ie = !1;
7
+ const se = new Map();
8
+ let ue = null,
10
9
  me = null,
11
10
  de = null,
11
+ fe = null,
12
12
  pe = null;
13
- const fe = { Tn: null, Ge: null };
14
- function Te(e) {
15
- ie.forEach((n, o) => {
13
+ const Te = { Tn: null, qe: null };
14
+ function Re(e) {
15
+ se.forEach((n, o) => {
16
16
  try {
17
17
  n.port.postMessage(e);
18
18
  } catch (e) {
19
- ie.delete(o);
19
+ se.delete(o);
20
20
  }
21
21
  });
22
22
  }
23
- function Re() {
24
- if (de && ie.has(de)) return;
25
- const e = ie.keys().next().value;
26
- (de = e || null),
27
- de && console.log("[Braze Real-Time] Elected leader port:", de);
23
+ function a(e, n) {
24
+ return Math.floor(Math.random() * (n - e + 1)) + e;
28
25
  }
29
- function ge(e) {
30
- if ((Re(), !de))
26
+ function ge() {
27
+ if (fe && se.has(fe)) return;
28
+ const e = se.keys().next().value;
29
+ (fe = e || null),
30
+ fe && console.log("[Braze Real-Time] Elected leader port:", fe);
31
+ }
32
+ function he(e) {
33
+ if ((ge(), !fe))
31
34
  return void console.warn("[Braze Real-Time] No leader to send message to");
32
- const n = ie.get(de);
35
+ const n = se.get(fe);
33
36
  if (n)
34
37
  try {
35
38
  n.port.postMessage(e);
36
39
  } catch (n) {
37
- ie.delete(de), (de = null), ge(e);
40
+ se.delete(fe), (fe = null), he(e);
38
41
  }
39
42
  }
40
- function he() {
41
- (re = !1),
43
+ function ze() {
44
+ (ie = !1),
42
45
  null !== ae && (clearTimeout(ae), (ae = null)),
43
- null !== me && (clearTimeout(me), (me = null)),
46
+ null !== de && (clearTimeout(de), (de = null)),
44
47
  null !== pe && (clearTimeout(pe), (pe = null)),
45
- te && (te.close(), (te = null), Te({ type: "disconnected" }));
48
+ te && (te.close(), (te = null), Re({ type: "disconnected" }));
46
49
  }
47
- function ze() {
50
+ function Be() {
48
51
  if (!le) return;
49
52
  ce++;
50
- const { yn: e, $n: n, Rn: o } = le.kn;
51
- let t = se;
53
+ const { Rn: e, zn: n, Bn: o } = le.Mn;
54
+ let t = ue;
52
55
  (null == t || t < e) && (t = e);
53
- const l = Math.min(
54
- n,
55
- ((c = e), (a = t * o), Math.floor(Math.random() * (a - c + 1)) + c),
56
- );
57
- var c, a;
58
- (se = l),
59
- console.log(
60
- "[Braze Real-Time] Retrying in " + l + "ms (attempt " + ce + "/5)",
61
- ),
56
+ const l = Math.min(n, a(e, t * o));
57
+ (ue = l),
58
+ console.log(`[Braze Real-Time] Retrying in ${l}ms (attempt ${ce}/5)`),
62
59
  (ae = setTimeout(function () {
63
- (ae = null), fe.Tn();
60
+ (ae = null), Te.Tn();
64
61
  }, l));
65
62
  }
66
- function Be(e) {
63
+ function ye(e) {
67
64
  if (!le) return;
68
65
  if (te && !e)
69
66
  return void console.warn("[Braze Real-Time] Connection already exists");
70
- if (re && !e)
67
+ if (ie && !e)
71
68
  return void console.warn(
72
69
  "[Braze Real-Time] Connection attempt already in progress",
73
70
  );
74
- re = !0;
71
+ ie = !0;
75
72
  const { Wi: n, mite: o, auth: t } = le,
76
- l = /^https?:\/\//i.test(n) ? n : "https://" + n;
77
- let c = "mite=" + encodeURIComponent(o) + "&attempts=" + ce;
78
- t && (c += "&auth=" + encodeURIComponent(t)),
79
- ue && (c += "&rcs=" + encodeURIComponent(ue));
80
- const a = l + "/sse?" + c;
73
+ l = /^https?:\/\//i.test(n) ? n : `https://${n}`;
74
+ let c = `mite=${encodeURIComponent(o)}&attempts=${ce}`;
75
+ t && (c += `&auth=${encodeURIComponent(t)}`),
76
+ me && (c += `&rcs=${encodeURIComponent(me)}`);
77
+ const r = `${l}/sse?${c}`;
81
78
  try {
82
- const n = new EventSource(a);
79
+ const n = new EventSource(r);
83
80
  (n.onopen = function () {
84
81
  e
85
82
  ? (console.log(
@@ -88,13 +85,13 @@ function Be(e) {
88
85
  e.close())
89
86
  : console.log("[Braze Real-Time] Connection established"),
90
87
  (te = n),
91
- (re = !1),
88
+ (ie = !1),
92
89
  (ce = 0),
93
- (se = null),
94
- Te({ type: "connected" });
90
+ (ue = null),
91
+ Re({ type: "connected" });
95
92
  }),
96
93
  n.addEventListener("msg", function (e) {
97
- fe.Ge(e.data);
94
+ Te.qe(e.data);
98
95
  }),
99
96
  (n.onerror = function () {
100
97
  if (
@@ -108,50 +105,51 @@ function Be(e) {
108
105
  "[Braze Real-Time] Gapless reconnection failed, keeping old connection",
109
106
  ),
110
107
  n.close(),
111
- (re = !1),
112
- void (ce < 5 && ze())
108
+ (ie = !1),
109
+ void (ce < 5 && Be())
113
110
  );
114
- he(),
111
+ ze(),
115
112
  ce < 5
116
- ? ze()
113
+ ? Be()
117
114
  : (console.error("[Braze Real-Time] Max retries reached"),
118
- Te({ type: "error", error: "Max retry attempts reached" }));
115
+ Re({ type: "error", error: "Max retry attempts reached" }));
119
116
  });
120
117
  } catch (e) {
121
- (re = !1),
118
+ (ie = !1),
122
119
  console.error("[Braze Real-Time] Failed to create EventSource:", e),
123
- Te({ type: "error", error: String(e) });
120
+ Re({ type: "error", error: String(e) });
124
121
  }
125
122
  }
126
- function ye(e, n, o) {
123
+ function $e(e, n, o) {
127
124
  switch (o.type) {
128
125
  case "connect":
129
126
  !le ||
130
- (le.mite === o.zn.mite && le.Wi === o.zn.Wi) ||
127
+ (le.mite === o.Cn.mite && le.Wi === o.Cn.Wi) ||
131
128
  (console.log("[Braze Real-Time] Config changed, reconnecting"),
132
- he(),
129
+ ze(),
133
130
  (ce = 0),
134
- (se = null),
135
- (ue = null)),
136
- (le = o.zn),
137
- Re(),
138
- te || re ? te && e.postMessage({ type: "connected" }) : Be();
131
+ (ue = null),
132
+ (me = null)),
133
+ (le = o.Cn),
134
+ se.has(n) || se.set(n, { port: e }),
135
+ ge(),
136
+ te || ie ? te && e.postMessage({ type: "connected" }) : ye();
139
137
  break;
140
138
  case "disconnect":
141
- ie.delete(n),
142
- n === de && ((de = null), Re()),
143
- 0 === ie.size &&
139
+ se.delete(n),
140
+ n === fe && ((fe = null), ge()),
141
+ 0 === se.size &&
144
142
  (console.log("[Braze Real-Time] No more ports, closing connection"),
145
- he(),
143
+ ze(),
146
144
  (le = null),
147
- (ue = null),
148
- (de = null));
145
+ (me = null),
146
+ (fe = null));
149
147
  break;
150
148
  case "tab_active":
151
149
  !(function (e) {
152
- ie.has(e) &&
153
- de !== e &&
154
- ((de = e),
150
+ se.has(e) &&
151
+ fe !== e &&
152
+ ((fe = e),
155
153
  console.log(
156
154
  "[Braze Real-Time] Promoted to leader (tab became active):",
157
155
  e,
@@ -165,57 +163,53 @@ function ye(e, n, o) {
165
163
  console.warn("[Braze Real-Time] Unknown message type:", o.type);
166
164
  }
167
165
  }
168
- (fe.Tn = Be),
169
- (fe.Ge = function (e) {
166
+ (Te.Tn = ye),
167
+ (Te.qe = function (e) {
170
168
  try {
171
169
  const t = JSON.parse(e);
172
170
  if (!t.type)
173
171
  return void console.warn("[Braze Real-Time] Message without type:", t);
174
172
  if ("ttl" === t.type && t.body)
175
173
  return (
176
- (n = t.body.on),
177
- (o = t.body.hn),
174
+ (n = t.body.t_ms),
175
+ (o = t.body.rcs),
178
176
  void (
179
177
  "number" == typeof n &&
180
- ("string" == typeof o && (ue = o),
178
+ ("string" == typeof o && (me = o),
181
179
  console.log(
182
- "[Braze Real-Time] TTL set to " +
183
- n +
184
- "ms, will perform gapless reconnection when expired",
180
+ `[Braze Real-Time] TTL set to ${n}ms, will perform gapless reconnection when expired`,
185
181
  ),
186
- null !== me && clearTimeout(me),
187
- (me = setTimeout(function () {
188
- (me = null),
182
+ null !== de && clearTimeout(de),
183
+ (de = setTimeout(function () {
184
+ (de = null),
189
185
  console.log(
190
186
  "[Braze Real-Time] TTL expired, performing gapless reconnection",
191
187
  ),
192
- Be(te || void 0);
188
+ ye(te || void 0);
193
189
  }, n)))
194
190
  )
195
191
  );
196
192
  if ("ddr" === t.type && t.body)
197
193
  return void (function (e, n) {
198
194
  if ("number" != typeof e) return;
199
- const o = Math.random() * e * 0.3,
200
- t = Math.round(e + o),
201
- l = n ? " (" + n + ")" : "";
195
+ const o = null == le ? void 0 : le.Mn,
196
+ t = (null == o ? void 0 : o.Rn) || 1e4,
197
+ l = (null == o ? void 0 : o.Bn) || 3,
198
+ c = (null == o ? void 0 : o.zn) || 3e5,
199
+ r = Math.min(c, a(t, t * l)),
200
+ i = Math.round(e + r),
201
+ s = n ? ` (${n})` : "";
202
202
  console.log(
203
- "[Braze Real-Time] Admin requested disconnect" +
204
- l +
205
- ", reconnecting in " +
206
- t +
207
- "ms",
203
+ `[Braze Real-Time] Admin requested disconnect${s}, reconnecting in ${i}ms (r_ms=${e} + backoff=${r})`,
208
204
  ),
209
205
  null !== pe && clearTimeout(pe),
210
- he(),
206
+ ze(),
211
207
  (pe = setTimeout(function () {
212
- (pe = null), fe.Tn();
213
- }, t));
214
- })(t.body._e, t.body.e);
215
- console.log(
216
- "[Braze Real-Time] Routing '" + t.type + "' message to leader",
217
- ),
218
- ge({ type: "message", data: t });
208
+ (pe = null), Te.Tn();
209
+ }, i));
210
+ })(t.body.r_ms, t.body.e);
211
+ console.log(`[Braze Real-Time] Routing '${t.type}' message to leader`),
212
+ he({ type: "message", data: t });
219
213
  } catch (e) {
220
214
  console.warn("[Braze Real-Time] Failed to parse message:", e);
221
215
  }
@@ -223,18 +217,18 @@ function ye(e, n, o) {
223
217
  }),
224
218
  (oe.onconnect = function (e) {
225
219
  const n = e.ports[0],
226
- o = "port-" + Date.now() + "-" + Math.random().toString(36).substr(2, 9);
227
- ie.set(o, { port: n }),
220
+ o = `port-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
221
+ se.set(o, { port: n }),
228
222
  (n.onmessage = function (e) {
229
223
  try {
230
- ye(n, o, e.data);
224
+ $e(n, o, e.data);
231
225
  } catch (e) {
232
226
  console.error("[Braze Real-Time] Error handling message:", e);
233
227
  }
234
228
  }),
235
229
  (n.onmessageerror = function () {
236
230
  console.warn("[Braze Real-Time] Message error from port:", o),
237
- ie.delete(o);
231
+ se.delete(o);
238
232
  }),
239
233
  n.start();
240
234
  });
@@ -1,4 +1,4 @@
1
- import { logger as E } from "../../shared-lib/index.js";
1
+ import { logger as b } from "../../shared-lib/index.js";
2
2
  import { DUST_SHARED_WORKER_CODE as ri } from "./dust-shared-worker-code.js";
3
3
  export function isSharedWorkerSupported() {
4
4
  return "undefined" != typeof SharedWorker;
@@ -6,49 +6,49 @@ export function isSharedWorkerSupported() {
6
6
  export class DustWorkerBridge {
7
7
  constructor(i) {
8
8
  (this.Wr = null),
9
- (this.Lr = null),
9
+ (this.Rr = null),
10
10
  (this.isConnected = !1),
11
- (this.Ir = null),
12
11
  (this.Mr = null),
13
- (this.Be = i.Be),
12
+ (this.Lr = null),
14
13
  (this.Pe = i.Pe),
15
14
  (this.He = i.He),
16
- (this.Je = i.Je);
15
+ (this.Le = i.Le),
16
+ (this.Oe = i.Oe);
17
17
  }
18
18
  initialize() {
19
19
  if (!isSharedWorkerSupported())
20
20
  return (
21
- E.info("SharedWorker not supported, will use direct connection"), !1
21
+ b.info("SharedWorker not supported, will use direct connection"), !1
22
22
  );
23
23
  try {
24
24
  const i = new Blob([ri], { type: "application/javascript" });
25
25
  return (
26
- (this.Lr = URL.createObjectURL(i)),
27
- (this.Wr = new SharedWorker(this.Lr, { name: "braze-dust-worker" })),
26
+ (this.Rr = URL.createObjectURL(i)),
27
+ (this.Wr = new SharedWorker(this.Rr, { name: "braze-dust-worker" })),
28
28
  (this.Wr.port.onmessage = (i) => {
29
- this.Ur(i.data);
29
+ this.Ir(i.data);
30
30
  }),
31
31
  (this.Wr.port.onmessageerror = () => {
32
- E.warn("Message error from real-time messaging worker");
32
+ b.warn("Message error from real-time messaging worker");
33
33
  }),
34
34
  (this.Wr.onerror = (i) => {
35
35
  var e;
36
- E.error(
36
+ b.error(
37
37
  `Real-time messaging worker error: ${i.message || "unknown error"}`,
38
38
  ),
39
- null === (e = this.Je) ||
39
+ null === (e = this.Oe) ||
40
40
  void 0 === e ||
41
41
  e.call(this, "SharedWorker error");
42
42
  }),
43
43
  this.Wr.port.start(),
44
+ this.Ur(),
44
45
  this.Vr(),
45
- this.Er(),
46
- E.info("Real-time messaging worker initialized"),
46
+ b.info("Real-time messaging worker initialized"),
47
47
  !0
48
48
  );
49
49
  } catch (i) {
50
50
  return (
51
- E.error(
51
+ b.error(
52
52
  `Failed to create real-time messaging worker: ${
53
53
  i instanceof Error ? i.message : String(i)
54
54
  }`,
@@ -58,64 +58,79 @@ export class DustWorkerBridge {
58
58
  );
59
59
  }
60
60
  }
61
- Ur(i) {
61
+ Ir(i) {
62
62
  var e, t, s;
63
63
  switch (i.type) {
64
64
  case "connected":
65
- E.info("Real-time messaging connection established via SharedWorker"),
65
+ b.info("Real-time messaging connection established via SharedWorker"),
66
66
  (this.isConnected = !0),
67
- null === (e = this.Pe) || void 0 === e || e.call(this);
67
+ null === (e = this.He) || void 0 === e || e.call(this);
68
68
  break;
69
69
  case "disconnected":
70
- E.info("Real-time messaging connection closed via SharedWorker"),
70
+ b.info("Real-time messaging connection closed via SharedWorker"),
71
71
  (this.isConnected = !1),
72
- null === (t = this.He) || void 0 === t || t.call(this);
72
+ null === (t = this.Le) || void 0 === t || t.call(this);
73
73
  break;
74
- case "message":
75
- this.Be(i.data);
74
+ case "message": {
75
+ const e = i.data,
76
+ t = { type: e.type };
77
+ null != e.body && (t.body = e.body), this.Pe(t);
76
78
  break;
79
+ }
77
80
  case "error":
78
- E.error(`Real-time messaging error: ${i.error}`),
79
- null === (s = this.Je) || void 0 === s || s.call(this, i.error);
81
+ b.error(`Real-time messaging error: ${i.error}`),
82
+ null === (s = this.Oe) || void 0 === s || s.call(this, i.error);
80
83
  }
81
84
  }
82
- Vr() {
83
- this.Ir = window.setInterval(() => {
85
+ Ur() {
86
+ this.Mr = window.setInterval(() => {
84
87
  this.Wr && this.Gr({ type: "ping" });
85
88
  }, 3e4);
86
89
  }
87
90
  Jr() {
88
- null !== this.Ir && (window.clearInterval(this.Ir), (this.Ir = null));
91
+ null !== this.Mr && (window.clearInterval(this.Mr), (this.Mr = null));
89
92
  }
90
- Er() {
91
- (this.Mr = () => {
93
+ Vr() {
94
+ (this.Lr = () => {
92
95
  "visible" === document.visibilityState &&
93
96
  this.Wr &&
94
97
  this.Gr({ type: "tab_active" });
95
98
  }),
96
- document.addEventListener("visibilitychange", this.Mr);
99
+ document.addEventListener("visibilitychange", this.Lr);
97
100
  }
98
101
  Kr() {
99
- this.Mr &&
100
- (document.removeEventListener("visibilitychange", this.Mr),
101
- (this.Mr = null));
102
+ this.Lr &&
103
+ (document.removeEventListener("visibilitychange", this.Lr),
104
+ (this.Lr = null));
102
105
  }
103
106
  Gr(i) {
104
107
  this.Wr && this.Wr.port.postMessage(i);
105
108
  }
106
109
  connect(i) {
107
110
  this.Wr
108
- ? (this.Gr({ type: "connect", zn: i }),
109
- E.info("Connecting to real-time messaging"))
110
- : E.error("Cannot connect: real-time messaging worker not initialized");
111
+ ? (this.Gr({
112
+ type: "connect",
113
+ config: {
114
+ mite: i.mite,
115
+ dustHost: i.dustHost,
116
+ auth: i.auth,
117
+ backoff: {
118
+ minSleepMs: i.backoff.minSleepMs,
119
+ maxSleepMs: i.backoff.maxSleepMs,
120
+ scaleFactor: i.backoff.scaleFactor,
121
+ },
122
+ },
123
+ }),
124
+ b.info("Connecting to real-time messaging"))
125
+ : b.error("Cannot connect: real-time messaging worker not initialized");
111
126
  }
112
127
  disconnect() {
113
128
  this.Wr &&
114
129
  (this.Gr({ type: "disconnect" }),
115
130
  (this.isConnected = !1),
116
- E.info("Disconnecting from real-time messaging"));
131
+ b.info("Disconnecting from real-time messaging"));
117
132
  }
118
- cn() {
133
+ Ke() {
119
134
  return this.isConnected;
120
135
  }
121
136
  isInitialized() {
@@ -125,12 +140,12 @@ export class DustWorkerBridge {
125
140
  this.Jr(),
126
141
  this.Kr(),
127
142
  this.Wr && (this.Wr.port.close(), (this.Wr = null)),
128
- this.Lr && (URL.revokeObjectURL(this.Lr), (this.Lr = null)),
143
+ this.Rr && (URL.revokeObjectURL(this.Rr), (this.Rr = null)),
129
144
  (this.isConnected = !1);
130
145
  }
131
146
  destroy() {
132
147
  this.disconnect(),
133
148
  this._r(),
134
- E.info("Real-time messaging worker destroyed");
149
+ b.info("Real-time messaging worker destroyed");
135
150
  }
136
151
  }
@@ -1,23 +1,23 @@
1
1
  import r from "../managers/braze-instance.js";
2
- import sr from "./dust-provider-factory.js";
2
+ import dr from "./dust-provider-factory.js";
3
3
  export function subscribeToDust() {
4
4
  const t = r.l(),
5
5
  n = r.nn();
6
6
  if (!t || !n) return null;
7
- const o = sr.o(),
7
+ const o = dr.o(),
8
8
  s = () => {
9
- if (!o.Lt()) {
10
- o.ln();
9
+ if (!o.Et()) {
10
+ o.cn();
11
11
  const r = n.rn(() => {
12
12
  t.fn() && o.mn();
13
13
  });
14
- return r && o.$t(r), o.un() && o.en(), r;
14
+ return r && o.Lt(r), o.un() && o.an(), r;
15
15
  }
16
- return o.Lt();
16
+ return o.Et();
17
17
  };
18
18
  return (
19
19
  t.Tr(() => {
20
- r.ao() && (t.fn() ? (o.mn(), s()) : (o.sn(), o.un() && o.Ye()));
20
+ r.ao() && (t.fn() ? (o.mn(), s()) : (o.hn(), o.un() && o.en()));
21
21
  }),
22
22
  t.fn() ? s() : null
23
23
  );
@@ -1,14 +1,14 @@
1
- import { logger as E } from "../../shared-lib/index.js";
1
+ import { logger as b } from "../../shared-lib/index.js";
2
2
  import FeatureFlag from "./feature-flag.js";
3
3
  export function newFeatureFlagFromJson(e) {
4
- if (e[FeatureFlag.ui.qs] && "boolean" == typeof e[FeatureFlag.ui.Nr])
4
+ if (e[FeatureFlag.ei.qs] && "boolean" == typeof e[FeatureFlag.ei.Nr])
5
5
  return new FeatureFlag(
6
- e[FeatureFlag.ui.qs],
7
- e[FeatureFlag.ui.Nr],
8
- e[FeatureFlag.ui.Or],
9
- e[FeatureFlag.ui.Qr],
6
+ e[FeatureFlag.ei.qs],
7
+ e[FeatureFlag.ei.Nr],
8
+ e[FeatureFlag.ei.Or],
9
+ e[FeatureFlag.ei.Qr],
10
10
  );
11
- E.info(`Unable to create feature flag from ${JSON.stringify(e, null, 2)}`);
11
+ b.info(`Unable to create feature flag from ${JSON.stringify(e, null, 2)}`);
12
12
  }
13
13
  export function newFeatureFlagFromSerializedValue(e) {
14
14
  if (e[FeatureFlag.bs.qs] && "boolean" == typeof e[FeatureFlag.bs.Nr])
@@ -18,7 +18,7 @@ export function newFeatureFlagFromSerializedValue(e) {
18
18
  e[FeatureFlag.bs.Or],
19
19
  e[FeatureFlag.bs.Qr],
20
20
  );
21
- E.info(
21
+ b.info(
22
22
  `Unable to deserialize feature flag from ${JSON.stringify(e, null, 2)}`,
23
23
  );
24
24
  }
@@ -1,5 +1,5 @@
1
- import { PropertiesBase as x } from "../common/properties-base.js";
2
- export default class FeatureFlag extends x {
1
+ import { PropertiesBase as D } from "../common/properties-base.js";
2
+ export default class FeatureFlag extends D {
3
3
  constructor(s, t = !1, i = {}, e) {
4
4
  super(i),
5
5
  (this.id = s),
@@ -21,4 +21,4 @@ export default class FeatureFlag extends x {
21
21
  }
22
22
  }
23
23
  (FeatureFlag.bs = { qs: "id", Nr: "e", Or: "pr", Qr: "fts" }),
24
- (FeatureFlag.ui = { qs: "id", Nr: "enabled", Or: "properties", Qr: "fts" });
24
+ (FeatureFlag.ei = { qs: "id", Nr: "enabled", Or: "properties", Qr: "fts" });