@braze/web-sdk 4.0.6 → 4.2.1

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 (107) hide show
  1. package/index.d.ts +18 -3
  2. package/package.json +1 -1
  3. package/shared-lib/braze-shared-lib.js +1 -1
  4. package/shared-lib/encoding-utils.js +1 -1
  5. package/shared-lib/event-types.js +1 -1
  6. package/shared-lib/guid.js +1 -1
  7. package/shared-lib/indexed-db-adapter.js +1 -1
  8. package/shared-lib/logger.js +1 -1
  9. package/shared-lib/supported-options.js +1 -1
  10. package/src/Card/display/card-display.js +1 -1
  11. package/src/Card/index.js +1 -1
  12. package/src/Card/log-content-card-impressions.js +1 -0
  13. package/src/Card/models/captioned-image.js +1 -1
  14. package/src/Card/models/card.js +1 -1
  15. package/src/Card/models/classic-card.js +1 -1
  16. package/src/Card/models/control-card.js +1 -1
  17. package/src/Card/util/card-factory.js +1 -1
  18. package/src/ContentCards/content-cards-provider.js +1 -1
  19. package/src/ContentCards/get-cached-content-cards.js +1 -1
  20. package/src/ContentCards/log-content-cards-displayed.js +1 -1
  21. package/src/ContentCards/request-content-cards-refresh.js +1 -1
  22. package/src/ContentCards/subscribe-to-content-cards-updates.js +1 -1
  23. package/src/ContentCards/ui/show-content-cards.js +1 -1
  24. package/src/Core/add-sdk-metadata.js +1 -1
  25. package/src/Core/disable-sdk.js +1 -1
  26. package/src/Core/enable-sdk.js +1 -1
  27. package/src/Core/handle-braze-action.js +1 -1
  28. package/src/Core/is-disabled.js +1 -1
  29. package/src/Core/log-custom-event.js +1 -1
  30. package/src/Core/log-purchase.js +1 -1
  31. package/src/Core/open-session.js +1 -1
  32. package/src/Core/set-sdk-authentication-signature.js +1 -1
  33. package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -1
  34. package/src/Core/wipe-data.js +1 -1
  35. package/src/Feed/feed-provider.js +1 -1
  36. package/src/Feed/get-cached-feed.js +1 -1
  37. package/src/Feed/request-feed-refresh.js +1 -1
  38. package/src/Feed/subscribe-to-feed-updates.js +1 -1
  39. package/src/Feed/ui/show-feed.js +1 -1
  40. package/src/InAppMessage/display/html-message-to-html.js +1 -1
  41. package/src/InAppMessage/display/in-app-message-to-html.js +1 -1
  42. package/src/InAppMessage/in-app-message-manager.js +1 -1
  43. package/src/InAppMessage/log-in-app-message-button-click.js +1 -1
  44. package/src/InAppMessage/log-in-app-message-click.js +1 -1
  45. package/src/InAppMessage/log-in-app-message-html-click.js +1 -1
  46. package/src/InAppMessage/log-in-app-message-impression.js +1 -1
  47. package/src/InAppMessage/models/html-message.js +1 -1
  48. package/src/InAppMessage/models/in-app-message-button.js +1 -1
  49. package/src/InAppMessage/models/in-app-message.js +1 -1
  50. package/src/InAppMessage/models/modal-message.js +1 -1
  51. package/src/InAppMessage/models/slide-up-message.js +1 -1
  52. package/src/InAppMessage/models/templated-in-app-message.js +1 -1
  53. package/src/InAppMessage/ui/show-in-app-message.js +1 -1
  54. package/src/Push/is-push-blocked.js +1 -1
  55. package/src/Push/is-push-permission-granted.js +1 -1
  56. package/src/Push/is-push-supported.js +1 -1
  57. package/src/Push/push-manager-factory.js +1 -1
  58. package/src/Push/push-manager.js +1 -1
  59. package/src/Push/request-push-permission.js +1 -1
  60. package/src/Push/unregister-push.js +1 -1
  61. package/src/Push/utils/push-utils.js +1 -0
  62. package/src/User/user-manager.js +1 -1
  63. package/src/User/user.js +1 -1
  64. package/src/common/base-feed.js +1 -1
  65. package/src/common/base-provider.js +1 -1
  66. package/src/common/feed-display.js +1 -1
  67. package/src/l10n/l10n-manager-factory.js +1 -1
  68. package/src/managers/auth-manager.js +1 -1
  69. package/src/managers/braze-instance.js +1 -1
  70. package/src/managers/device-manager.js +1 -1
  71. package/src/managers/network-manager.js +1 -1
  72. package/src/managers/server-config-manager.js +1 -1
  73. package/src/managers/session-manager.js +1 -1
  74. package/src/managers/storage-manager-factory.js +1 -1
  75. package/src/managers/storage-manager.js +1 -1
  76. package/src/managers/subscription-manager.js +1 -1
  77. package/src/models/backend-errors.js +1 -1
  78. package/src/models/braze-event.js +1 -1
  79. package/src/models/device.js +1 -1
  80. package/src/models/identifier.js +1 -1
  81. package/src/models/push-token.js +1 -1
  82. package/src/models/server-config.js +1 -1
  83. package/src/request-controller.js +1 -1
  84. package/src/triggers/models/filter-set.js +1 -1
  85. package/src/triggers/models/filter.js +1 -1
  86. package/src/triggers/models/in-app-message-click-data.js +1 -1
  87. package/src/triggers/models/purchase-data.js +1 -1
  88. package/src/triggers/models/purchase-property-data.js +1 -1
  89. package/src/triggers/models/push-click-data.js +1 -1
  90. package/src/triggers/models/trigger-condition.js +1 -1
  91. package/src/triggers/models/trigger.js +1 -1
  92. package/src/triggers/triggers-provider-factory.js +1 -1
  93. package/src/triggers/triggers-provider.js +1 -1
  94. package/src/ui/js/attach-css.js +1 -1
  95. package/src/ui/js/feed-css.js +1 -1
  96. package/src/ui/js/iam-css.js +1 -1
  97. package/src/ui/js/load-font-awesome.js +1 -1
  98. package/src/util/base-device-parser.js +1 -1
  99. package/src/util/braze-actions.js +1 -1
  100. package/src/util/browser-detector.js +1 -1
  101. package/src/util/client-hints-parser.js +1 -1
  102. package/src/util/dom-utils.js +1 -1
  103. package/src/util/key-codes.js +1 -1
  104. package/src/util/net.js +1 -1
  105. package/src/util/user-agent-parser.js +1 -1
  106. package/src/util/validation-utils.js +1 -1
  107. package/src/util/window-utils.js +1 -1
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Type definitions for @braze/web-sdk v4.0.6
2
+ * Type definitions for @braze/web-sdk v4.2.1
3
3
  * Project: https://github.com/braze-inc/braze-web-sdk
4
4
  * (c) Braze, Inc. 2022 - http://braze.com
5
5
  * License available at https://github.com/braze-inc/braze-web-sdk/blob/master/LICENSE
@@ -1768,6 +1768,21 @@
1768
1768
  forContentCards?: boolean
1769
1769
  ): boolean;
1770
1770
 
1771
+ /**
1772
+ * A convenience method to log that the user saw the given Content Cards. This method is equivalent to
1773
+ * calling [`logCardImpressions` method with `forContentCards` param set to true.
1774
+ * This is done automatically when you use Braze's display module and should only be called
1775
+ * if you're bypassing that and manually building the DOM for displaying content cards in
1776
+ * your own code.
1777
+ *
1778
+ * @param contentCards - array of `Card` objects that received impressions
1779
+ *
1780
+ * @returns Whether or not the event was successfully logged (to be flushed later).
1781
+ */
1782
+ export function logContentCardImpressions(
1783
+ contentCards: Card[],
1784
+ ): boolean;
1785
+
1771
1786
  /**
1772
1787
  * @deprecated This method has been deprecated and is currently a no-op.
1773
1788
  */
@@ -1905,7 +1920,7 @@
1905
1920
  * - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
1906
1921
  *
1907
1922
  * ```
1908
- * self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.0/service-worker.js');
1923
+ * self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.2/service-worker.js');
1909
1924
  * ```
1910
1925
  *
1911
1926
  * For more details, see [Our Product Documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
@@ -2219,7 +2234,7 @@
2219
2234
  * lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
2220
2235
  * option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
2221
2236
  * `requestPushPermission`, and ensure that it contains Braze's service worker code, either with
2222
- * `self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.0/service-worker.js');` or by including the content
2237
+ * `self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.2/service-worker.js');` or by including the content
2223
2238
  * of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
2224
2239
  */
2225
2240
  manageServiceWorkerExternally?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@braze/web-sdk",
3
- "version": "4.0.6",
3
+ "version": "4.2.1",
4
4
  "description": "Braze SDK for web sites and other JS platforms.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1 +1 @@
1
- import je from"./encoding-utils.js";import{EventTypes as ve,InternalEventTypes as De}from"./event-types.js";import Be from"./guid.js";import Ae from"./indexed-db-adapter.js";import Ge from"./logger.js";import Oe from"./supported-options.js";const r={Nn:je,A:ve,qr:De,nt:Be,qt:Ae,Ft:Ae.ep,D:Ge,Uo:Oe};export default r;
1
+ import je from"./encoding-utils.js";import{EventTypes as ve,InternalEventTypes as De}from"./event-types.js";import Be from"./guid.js";import Ae from"./indexed-db-adapter.js";import Ge from"./logger.js";import Oe from"./supported-options.js";const r={bn:je,A:ve,qr:De,it:Be,qt:Ae,xt:Ae.ep,D:Ge,zo:Oe};export default r;
@@ -1 +1 @@
1
- const je={_n:function(t){const r=(t+"=".repeat((4-t.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(r),o=new Uint8Array(n.length);for(let t=0;t<n.length;++t)o[t]=n.charCodeAt(t);return o}};export default je;
1
+ const je={pn:function(t){const r=(t+"=".repeat((4-t.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(r),o=new Uint8Array(n.length);for(let t=0;t<n.length;++t)o[t]=n.charCodeAt(t);return o}};export default je;
@@ -1 +1 @@
1
- const ve={CustomEvent:"ce",Pr:"p",Sl:"pc",oc:"ca",Ra:"i",ha:"ie",T:"cci",W:"ccic",_:"ccc",L:"ccd",Wh:"ss",bh:"se",Je:"si",Re:"sc",He:"sbc",Pe:"sfe",ro:"iec",vl:"lr",yl:"uae",U:"ci",F:"cc",Al:"lcaa",$l:"lcar",Qr:"inc",Wr:"add",Yr:"rem",Vr:"set",Cl:"sgu"},De={Fr:"feed_displayed",cc:"content_cards_displayed"};export{ve as EventTypes,De as InternalEventTypes};
1
+ const ve={CustomEvent:"ce",Pr:"p",Sl:"pc",oc:"ca",Ra:"i",qs:"ie",T:"cci",W:"ccic",_:"ccc",L:"ccd",Wh:"ss",bh:"se",Je:"si",Re:"sc",He:"sbc",Pe:"sfe",ro:"iec",vl:"lr",yl:"uae",U:"ci",F:"cc",Al:"lcaa",$l:"lcar",En:"inc",An:"add",Un:"rem",Sn:"set",Cl:"sgu"},De={Fr:"feed_displayed",ac:"content_cards_displayed"};export{ve as EventTypes,De as InternalEventTypes};
@@ -1 +1 @@
1
- const Be={et:()=>{const t=t=>{const e=(Math.random().toString(16)+"000000000").substr(2,8);return t?"-"+e.substr(0,4)+"-"+e.substr(4,4):e};return t()+t(!0)+t(!0)+t()}};export default Be;
1
+ const Be={nt:()=>{const t=t=>{const e=(Math.random().toString(16)+"000000000").substr(2,8);return t?"-"+e.substr(0,4)+"-"+e.substr(4,4):e};return t()+t(!0)+t(!0)+t()}};export default Be;
@@ -1 +1 @@
1
- export default class Ae{constructor(t,e){this.td="undefined"==typeof window?self:window,this.ed=t,this.nd=e}od(){if("indexedDB"in this.td)return this.td.indexedDB}rd(){try{if(null==this.od())return!1;if(this.od().open("Braze IndexedDB Support Test"),"undefined"!=typeof window){const t=window.chrome||window.browser||window.msBrowser;if(t&&t.runtime&&t.runtime.id)return this.nd.info("Not using IndexedDB for storage because we are running inside an extension"),!1}return!0}catch(t){return this.nd.info("Not using IndexedDB for storage due to following error: "+t),!1}}dd(t,e){const n=this.od().open(this.ed.sd,this.ed.VERSION);if(null==n)return"function"==typeof e&&e(),!1;const o=this;return n.onupgradeneeded=t=>{o.nd.info("Upgrading indexedDB "+o.ed.sd+" to v"+o.ed.VERSION+"...");const e=t.target.result;for(const t in o.ed.Pt)o.ed.Pt.hasOwnProperty(t)&&!e.objectStoreNames.contains(o.ed.Pt[t])&&e.createObjectStore(o.ed.Pt[t])},n.onsuccess=n=>{const i=n.target.result;i.onversionchange=()=>{i.close(),"function"==typeof e&&e(),o.nd.error("Needed to close the database unexpectedly because of an upgrade in another tab")},t(i)},n.onerror=t=>(o.nd.info("Could not open indexedDB "+o.ed.sd+" v"+o.ed.VERSION+": "+t.target.errorCode),"function"==typeof e&&e(),!0),!0}setItem(t,e,n,o,i){if(!this.rd())return"function"==typeof i&&i(),!1;const r=this;return this.dd((d=>{if(!d.objectStoreNames.contains(t))return r.nd.error("Could not store object "+e+" in "+t+" on indexedDB "+r.ed.sd+" - "+t+" is not a valid objectStore"),void("function"==typeof i&&i());const s=d.transaction([t],"readwrite").objectStore(t).put(n,e);s.onerror=()=>{r.nd.error("Could not store object "+e+" in "+t+" on indexedDB "+r.ed.sd),"function"==typeof i&&i()},s.onsuccess=()=>{"function"==typeof o&&o()}}),i)}getItem(t,e,n){if(!this.rd())return!1;const o=this;return this.dd((i=>{if(!i.objectStoreNames.contains(t))return void o.nd.error("Could not retrieve object "+e+" in "+t+" on indexedDB "+o.ed.sd+" - "+t+" is not a valid objectStore");const r=i.transaction([t],"readonly").objectStore(t).get(e);r.onerror=()=>{o.nd.error("Could not retrieve object "+e+" in "+t+" on indexedDB "+o.ed.sd)},r.onsuccess=t=>{const e=t.target.result;null!=e&&n(e)}}))}hr(t,e,n){if(!this.rd())return"function"==typeof n&&n(),!1;const o=this;return this.dd((i=>{if(!i.objectStoreNames.contains(t))return o.nd.error("Could not retrieve last record from "+t+" on indexedDB "+o.ed.sd+" - "+t+" is not a valid objectStore"),void("function"==typeof n&&n());const r=i.transaction([t],"readonly").objectStore(t).openCursor(null,"prev");r.onerror=()=>{o.nd.error("Could not open cursor for "+t+" on indexedDB "+o.ed.sd),"function"==typeof n&&n()},r.onsuccess=t=>{const o=t.target.result;null!=o&&null!=o.value&&null!=o.key?e(o.key,o.value):"function"==typeof n&&n()}}),n)}br(t,e){if(!this.rd())return!1;const n=this;return this.dd((o=>{if(!o.objectStoreNames.contains(t))return void n.nd.error("Could not delete record "+e+" from "+t+" on indexedDB "+n.ed.sd+" - "+t+" is not a valid objectStore");o.transaction([t],"readwrite").objectStore(t).delete(e).onerror=()=>{n.nd.error("Could not delete record "+e+" from "+t+" on indexedDB "+n.ed.sd)}}))}Jt(t,e){if(!this.rd())return!1;const n=this;return this.dd((o=>{if(!o.objectStoreNames.contains(t))return void n.nd.error("Could not retrieve objects from "+t+" on indexedDB "+n.ed.sd+" - "+t+" is not a valid objectStore");const i=o.transaction([t],"readwrite").objectStore(t),r=i.openCursor(),d=[];r.onerror=()=>{d.length>0?(n.nd.info("Cursor closed midway through for "+t+" on indexedDB "+n.ed.sd),e(d)):n.nd.error("Could not open cursor for "+t+" on indexedDB "+n.ed.sd)},r.onsuccess=t=>{const n=t.target.result;if(null!=n){if(null!=n.value&&null!=n.key){i.delete(n.key).onsuccess=()=>{d.push(n.value)}}n.continue()}else d.length>0&&e(d)}}))}clearData(){if(!this.rd())return!1;const t=[];for(const e in this.ed.Pt)this.ed.Pt.hasOwnProperty(e)&&this.ed.Pt[e]!==this.ed.Pt.oe&&t.push(this.ed.Pt[e]);const e=this;return this.dd((function(n){const o=n.transaction(t,"readwrite");for(let n=0;n<t.length;n++){const i=t[n];o.objectStore(i).clear().onerror=function(){e.nd.error("Could not clear "+this.source.name+" on indexedDB "+e.ed.sd)}}o.onerror=function(){e.nd.error("Could not clear object stores on indexedDB "+e.ed.sd)}}))}}Ae.ep={xt:{sd:"AppboyServiceWorkerAsyncStorage",VERSION:6,Pt:{jl:"data",jr:"pushClicks",Mr:"pushSubscribed",ud:"fallbackDevice",Mt:"cardUpdates",oe:"optOut",$r:"pendingData",Kn:"sdkAuthenticationSignature"},se:1}};
1
+ export default class Ae{constructor(t,e){this.td="undefined"==typeof window?self:window,this.ed=t,this.nd=e}od(){if("indexedDB"in this.td)return this.td.indexedDB}rd(){try{if(null==this.od())return!1;if(this.od().open("Braze IndexedDB Support Test"),"undefined"!=typeof window){const t=window.chrome||window.browser||window.msBrowser;if(t&&t.runtime&&t.runtime.id)return this.nd.info("Not using IndexedDB for storage because we are running inside an extension"),!1}return!0}catch(t){return this.nd.info("Not using IndexedDB for storage due to following error: "+t),!1}}dd(t,e){const n=this.od().open(this.ed.sd,this.ed.VERSION);if(null==n)return"function"==typeof e&&e(),!1;const o=this;return n.onupgradeneeded=t=>{o.nd.info("Upgrading indexedDB "+o.ed.sd+" to v"+o.ed.VERSION+"...");const e=t.target.result;for(const t in o.ed.$t)o.ed.$t.hasOwnProperty(t)&&!e.objectStoreNames.contains(o.ed.$t[t])&&e.createObjectStore(o.ed.$t[t])},n.onsuccess=n=>{const i=n.target.result;i.onversionchange=()=>{i.close(),"function"==typeof e&&e(),o.nd.error("Needed to close the database unexpectedly because of an upgrade in another tab")},t(i)},n.onerror=t=>(o.nd.info("Could not open indexedDB "+o.ed.sd+" v"+o.ed.VERSION+": "+t.target.errorCode),"function"==typeof e&&e(),!0),!0}setItem(t,e,n,o,i){if(!this.rd())return"function"==typeof i&&i(),!1;const r=this;return this.dd((d=>{if(!d.objectStoreNames.contains(t))return r.nd.error("Could not store object "+e+" in "+t+" on indexedDB "+r.ed.sd+" - "+t+" is not a valid objectStore"),void("function"==typeof i&&i());const s=d.transaction([t],"readwrite").objectStore(t).put(n,e);s.onerror=()=>{r.nd.error("Could not store object "+e+" in "+t+" on indexedDB "+r.ed.sd),"function"==typeof i&&i()},s.onsuccess=()=>{"function"==typeof o&&o()}}),i)}getItem(t,e,n){if(!this.rd())return!1;const o=this;return this.dd((i=>{if(!i.objectStoreNames.contains(t))return void o.nd.error("Could not retrieve object "+e+" in "+t+" on indexedDB "+o.ed.sd+" - "+t+" is not a valid objectStore");const r=i.transaction([t],"readonly").objectStore(t).get(e);r.onerror=()=>{o.nd.error("Could not retrieve object "+e+" in "+t+" on indexedDB "+o.ed.sd)},r.onsuccess=t=>{const e=t.target.result;null!=e&&n(e)}}))}hr(t,e,n){if(!this.rd())return"function"==typeof n&&n(),!1;const o=this;return this.dd((i=>{if(!i.objectStoreNames.contains(t))return o.nd.error("Could not retrieve last record from "+t+" on indexedDB "+o.ed.sd+" - "+t+" is not a valid objectStore"),void("function"==typeof n&&n());const r=i.transaction([t],"readonly").objectStore(t).openCursor(null,"prev");r.onerror=()=>{o.nd.error("Could not open cursor for "+t+" on indexedDB "+o.ed.sd),"function"==typeof n&&n()},r.onsuccess=t=>{const o=t.target.result;null!=o&&null!=o.value&&null!=o.key?e(o.key,o.value):"function"==typeof n&&n()}}),n)}br(t,e){if(!this.rd())return!1;const n=this;return this.dd((o=>{if(!o.objectStoreNames.contains(t))return void n.nd.error("Could not delete record "+e+" from "+t+" on indexedDB "+n.ed.sd+" - "+t+" is not a valid objectStore");o.transaction([t],"readwrite").objectStore(t).delete(e).onerror=()=>{n.nd.error("Could not delete record "+e+" from "+t+" on indexedDB "+n.ed.sd)}}))}Jt(t,e){if(!this.rd())return!1;const n=this;return this.dd((o=>{if(!o.objectStoreNames.contains(t))return void n.nd.error("Could not retrieve objects from "+t+" on indexedDB "+n.ed.sd+" - "+t+" is not a valid objectStore");const i=o.transaction([t],"readwrite").objectStore(t),r=i.openCursor(),d=[];r.onerror=()=>{d.length>0?(n.nd.info("Cursor closed midway through for "+t+" on indexedDB "+n.ed.sd),e(d)):n.nd.error("Could not open cursor for "+t+" on indexedDB "+n.ed.sd)},r.onsuccess=t=>{const n=t.target.result;if(null!=n){if(null!=n.value&&null!=n.key){i.delete(n.key).onsuccess=()=>{d.push(n.value)}}n.continue()}else d.length>0&&e(d)}}))}clearData(){if(!this.rd())return!1;const t=[];for(const e in this.ed.$t)this.ed.$t.hasOwnProperty(e)&&this.ed.$t[e]!==this.ed.$t.oe&&t.push(this.ed.$t[e]);const e=this;return this.dd((function(n){const o=n.transaction(t,"readwrite");for(let n=0;n<t.length;n++){const i=t[n];o.objectStore(i).clear().onerror=function(){e.nd.error("Could not clear "+this.source.name+" on indexedDB "+e.ed.sd)}}o.onerror=function(){e.nd.error("Could not clear object stores on indexedDB "+e.ed.sd)}}))}}Ae.ep={Ft:{sd:"AppboyServiceWorkerAsyncStorage",VERSION:6,$t:{jl:"data",jr:"pushClicks",pu:"pushSubscribed",ud:"fallbackDevice",Mt:"cardUpdates",oe:"optOut",$r:"pendingData",Kn:"sdkAuthenticationSignature"},se:1}};
@@ -1 +1 @@
1
- const Ge={init:function(n){void 0===n&&void 0!==Ge.zg||(Ge.zg=!!n),Ge.Dg||(Ge.Dg=!0)},destroy:function(){Ge.Dg=!1,Ge.zg=void 0,Ge.nd=void 0},setLogger:function(n){"function"==typeof n?(Ge.init(),Ge.nd=n):Ge.info("Ignoring setLogger call since logger is not a function")},toggleLogging:function(){Ge.init(),Ge.zg?(console.log("Disabling Braze logging"),Ge.zg=!1):(console.log("Enabled Braze logging"),Ge.zg=!0)},info:function(n){if(Ge.zg){const o="Braze: "+n;null!=Ge.nd?Ge.nd(o):console.log(o)}},warn:function(n){if(Ge.zg){const o="Braze SDK Warning: "+n+" (v4.0.6)";null!=Ge.nd?Ge.nd(o):console.warn(o)}},error:function(n){if(Ge.zg){const o="Braze SDK Error: "+n+" (v4.0.6)";null!=Ge.nd?Ge.nd(o):console.error(o)}}};export default Ge;
1
+ const Ge={init:function(n){void 0===n&&void 0!==Ge.zg||(Ge.zg=!!n),Ge.Dg||(Ge.Dg=!0)},destroy:function(){Ge.Dg=!1,Ge.zg=void 0,Ge.nd=void 0},setLogger:function(n){"function"==typeof n?(Ge.init(),Ge.nd=n):Ge.info("Ignoring setLogger call since logger is not a function")},toggleLogging:function(){Ge.init(),Ge.zg?(console.log("Disabling Braze logging"),Ge.zg=!1):(console.log("Enabled Braze logging"),Ge.zg=!0)},info:function(n){if(Ge.zg){const o="Braze: "+n;null!=Ge.nd?Ge.nd(o):console.log(o)}},warn:function(n){if(Ge.zg){const o="Braze SDK Warning: "+n+" (v4.2.1)";null!=Ge.nd?Ge.nd(o):console.warn(o)}},error:function(n){if(Ge.zg){const o="Braze SDK Error: "+n+" (v4.2.1)";null!=Ge.nd?Ge.nd(o):console.error(o)}}};export default Ge;
@@ -1 +1 @@
1
- export default{Vn:"allowCrawlerActivity",$n:"baseUrl",Yn:"noCookies",Xn:"devicePropertyAllowlist",ra:"disablePushTokenMaintenance",Zn:"enableLogging",ho:"enableSdkAuthentication",ta:"manageServiceWorkerExternally",po:"minimumIntervalBetweenTriggerActionsInSeconds",Eo:"sessionTimeoutInSeconds",_o:"appVersion",ea:"serviceWorkerLocation",na:"safariWebsitePushId",zn:"localization",ao:"contentSecurityNonce",Io:"enableHtmlInAppMessages",Ao:"allowUserSuppliedJavascript",no:"inAppMessageZIndex",lo:"openInAppMessagesInNewTab",en:"openNewsFeedCardsInNewTab",bi:"requireExplicitInAppMessageDismissal",So:"doNotLoadFontAwesome",No:"sdkFlavor",tn:"openCardsInNewTab"};
1
+ export default{Rn:"allowCrawlerActivity",Wn:"baseUrl",Vn:"noCookies",Yn:"devicePropertyAllowlist",ta:"disablePushTokenMaintenance",Xn:"enableLogging",Zn:"enableSdkAuthentication",ia:"manageServiceWorkerExternally",ho:"minimumIntervalBetweenTriggerActionsInSeconds",po:"sessionTimeoutInSeconds",Eo:"appVersion",na:"serviceWorkerLocation",ra:"safariWebsitePushId",jn:"localization",ao:"contentSecurityNonce",_o:"enableHtmlInAppMessages",Io:"allowUserSuppliedJavascript",no:"inAppMessageZIndex",lo:"openInAppMessagesInNewTab",en:"openNewsFeedCardsInNewTab",Ui:"requireExplicitInAppMessageDismissal",Ao:"doNotLoadFontAwesome",So:"sdkFlavor",tn:"openCardsInNewTab"};
@@ -1 +1 @@
1
- import{createCloseButton as i}from"../../util/component-utils.js";import{detectSwipe as d,DIRECTIONS as c}from"../../util/dom-utils.js";import{_handleBrazeAction as m}from"../../Core/handle-braze-action.js";import{logCardDismissal}from"../index.js";import r from"../../../shared-lib/braze-shared-lib.js";export const TOP_IMPRESSION_DATA_ATTRIBUTE="data-ab-had-top-impression";export const BOTTOM_IMPRESSION_DATA_ATTRIBUTE="data-ab-had-bottom-impression";export function topHadImpression(t){return null!=t&&!!t.getAttribute("data-ab-had-top-impression")}export function impressOnTop(t){null!=t&&t.setAttribute("data-ab-had-top-impression",!0)}export function bottomHadImpression(t){return null!=t&&!!t.getAttribute("data-ab-had-bottom-impression")}export function impressOnBottom(t){null!=t&&t.setAttribute("data-ab-had-bottom-impression",!0)}export function markCardAsRead(t){if(null!=t){const o=t.querySelectorAll(".ab-unread-indicator")[0];null!=o&&(o.className+=" read")}}export function getCardId(t){return t.getAttribute("data-ab-card-id")}export function _setImageAltText(t,o){let a="";t.title||t.description||(a="Feed Image"),o.setAttribute("alt",a)}export function setCardHeight(t,o){const a=o.querySelectorAll(".ab-image-area");let e,n=0;a.length>0&&(n=a[0].offsetWidth);for(const o of t)if(e=o.X,e&&o.imageUrl&&!isNaN(o.aspectRatio)){const t=n/o.aspectRatio;t&&(e.style.height=`${t}px`)}}export function cardToHtml(t,logCardClick,o){const a=document.createElement("div");a.className="ab-card ab-effect-card "+t.Y,a.setAttribute("data-ab-card-id",t.id),a.setAttribute("role","article"),a.setAttribute("tabindex","0");const e=t.url&&""!==t.url,n=n=>(markCardAsRead(a),e&&(logCardClick(t),m(t.url,n,o)),!1);if(t.pinned){const t=document.createElement("div");t.className="ab-pinned-indicator";const o=document.createElement("i");o.className="fa fa-star",t.appendChild(o),a.appendChild(t)}if(t.imageUrl&&""!==t.imageUrl){const o=document.createElement("div");o.className="ab-image-area";const i=document.createElement("img");if(i.setAttribute("src",t.imageUrl),i.onload=()=>{a.style.height="auto"},_setImageAltText(t,i),o.appendChild(i),a.className+=" with-image",e&&!t.Z){const e=document.createElement("a");e.setAttribute("href",t.url),e.onclick=n,e.appendChild(o),a.appendChild(e)}else a.appendChild(o)}const s=document.createElement("div");if(s.className="ab-card-body",t.dismissible){t.tt=()=>logCardDismissal(t);const o=i("Dismiss Card",void 0,t.dismissCard.bind(t));a.appendChild(o),d(s,c.ot,(t=>{a.className+=" ab-swiped-left",o.onclick(t)})),d(s,c.at,(t=>{a.className+=" ab-swiped-right",o.onclick(t)}))}const u=t.title&&""!==t.title;if(u){const o=document.createElement("h1");if(o.className="ab-title",o.id=r.nt.et(),a.setAttribute("aria-labelledby",o.id),e){const a=document.createElement("a");a.setAttribute("href",t.url),a.onclick=n,a.appendChild(document.createTextNode(t.title)),o.appendChild(a)}else o.appendChild(document.createTextNode(t.title));s.appendChild(o)}const p=document.createElement("div");if(p.className=u?"ab-description":"ab-description ab-no-title",p.id=r.nt.et(),a.setAttribute("aria-describedby",p.id),p.appendChild(document.createTextNode(t.description)),e){const o=document.createElement("div");o.className="ab-url-area";const a=document.createElement("a");a.setAttribute("href",t.url),a.appendChild(document.createTextNode(t.linkText)),a.onclick=n,o.appendChild(a),p.appendChild(o)}s.appendChild(p),a.appendChild(s);const b=document.createElement("div");return b.className="ab-unread-indicator",t.viewed&&(b.className+=" read"),a.appendChild(b),t.X=a,a}
1
+ import{createCloseButton as i}from"../../util/component-utils.js";import{detectSwipe as d,DIRECTIONS as c}from"../../util/dom-utils.js";import{_handleBrazeAction as m}from"../../Core/handle-braze-action.js";import{logCardDismissal}from"../index.js";import r from"../../../shared-lib/braze-shared-lib.js";export const TOP_IMPRESSION_DATA_ATTRIBUTE="data-ab-had-top-impression";export const BOTTOM_IMPRESSION_DATA_ATTRIBUTE="data-ab-had-bottom-impression";export function topHadImpression(t){return null!=t&&!!t.getAttribute("data-ab-had-top-impression")}export function impressOnTop(t){null!=t&&t.setAttribute("data-ab-had-top-impression",!0)}export function bottomHadImpression(t){return null!=t&&!!t.getAttribute("data-ab-had-bottom-impression")}export function impressOnBottom(t){null!=t&&t.setAttribute("data-ab-had-bottom-impression",!0)}export function markCardAsRead(t){if(null!=t){const o=t.querySelectorAll(".ab-unread-indicator")[0];null!=o&&(o.className+=" read")}}export function getCardId(t){return t.getAttribute("data-ab-card-id")}export function _setImageAltText(t,o){let a="";t.title||t.description||(a="Feed Image"),o.setAttribute("alt",a)}export function setCardHeight(t,o){const a=o.querySelectorAll(".ab-image-area");let e,n=0;a.length>0&&(n=a[0].offsetWidth);for(const o of t)if(e=o.X,e&&o.imageUrl&&!isNaN(o.aspectRatio)){const t=n/o.aspectRatio;t&&(e.style.height=`${t}px`)}}export function cardToHtml(t,logCardClick,o){const a=document.createElement("div");a.className="ab-card ab-effect-card "+t.Y,a.setAttribute("data-ab-card-id",t.id),a.setAttribute("role","article"),a.setAttribute("tabindex","0");const e=t.url&&""!==t.url,n=n=>(markCardAsRead(a),e&&(logCardClick(t),m(t.url,n,o)),!1);if(t.pinned){const t=document.createElement("div");t.className="ab-pinned-indicator";const o=document.createElement("i");o.className="fa fa-star",t.appendChild(o),a.appendChild(t)}if(t.imageUrl&&""!==t.imageUrl){const o=document.createElement("div");o.className="ab-image-area";const i=document.createElement("img");if(i.setAttribute("src",t.imageUrl),i.onload=()=>{a.style.height="auto"},_setImageAltText(t,i),o.appendChild(i),a.className+=" with-image",e&&!t.Z){const e=document.createElement("a");e.setAttribute("href",t.url),e.onclick=n,e.appendChild(o),a.appendChild(e)}else a.appendChild(o)}const s=document.createElement("div");if(s.className="ab-card-body",t.dismissible){t.tt=()=>logCardDismissal(t);const o=i("Dismiss Card",void 0,t.dismissCard.bind(t));a.appendChild(o),d(s,c.ot,(t=>{a.className+=" ab-swiped-left",o.onclick(t)})),d(s,c.et,(t=>{a.className+=" ab-swiped-right",o.onclick(t)}))}const u=t.title&&""!==t.title;if(u){const o=document.createElement("h1");if(o.className="ab-title",o.id=r.it.nt(),a.setAttribute("aria-labelledby",o.id),e){const a=document.createElement("a");a.setAttribute("href",t.url),a.onclick=n,a.appendChild(document.createTextNode(t.title)),o.appendChild(a)}else o.appendChild(document.createTextNode(t.title));s.appendChild(o)}const p=document.createElement("div");if(p.className=u?"ab-description":"ab-description ab-no-title",p.id=r.it.nt(),a.setAttribute("aria-describedby",p.id),p.appendChild(document.createTextNode(t.description)),e){const o=document.createElement("div");o.className="ab-url-area";const a=document.createElement("a");a.setAttribute("href",t.url),a.appendChild(document.createTextNode(t.linkText)),a.onclick=n,o.appendChild(a),p.appendChild(o)}s.appendChild(p),a.appendChild(s);const b=document.createElement("div");return b.className="ab-unread-indicator",t.viewed&&(b.className+=" read"),a.appendChild(b),t.X=a,a}
package/src/Card/index.js CHANGED
@@ -1 +1 @@
1
- export*from"./models/index.js";export{logCardClick}from"./log-card-click.js";export{logCardDismissal}from"./log-card-dismissal.js";export{logCardImpressions}from"./log-card-impressions.js";
1
+ export*from"./models/index.js";export{logCardClick}from"./log-card-click.js";export{logCardDismissal}from"./log-card-dismissal.js";export{logCardImpressions}from"./log-card-impressions.js";export{logContentCardImpressions}from"./log-content-card-impressions.js";
@@ -0,0 +1 @@
1
+ import{logCardImpressions}from"./log-card-impressions.js";export function logContentCardImpressions(o){return logCardImpressions(o,!0)}
@@ -1 +1 @@
1
- import Card from"./card.js";export default class CaptionedImage extends Card{constructor(t,s,i,h,e,r,a,o,c,n,d,p,u,l,m,f){super(t,s,i,h,e,r,a,o,c,n,d,p,u,l,m,f),this.Y="ab-captioned-image",this.Z=!0}ss(){const t={};return t[Card.hs.ts]=Card.es.st,t[Card.hs.ns]=this.id,t[Card.hs.ls]=this.viewed,t[Card.hs.it]=this.title,t[Card.hs.os]=this.imageUrl,t[Card.hs.ht]=this.description,t[Card.hs.us]=this.updated,t[Card.hs.cs]=this.created,t[Card.hs.ds]=this.categories,t[Card.hs.ps]=this.expiresAt,t[Card.hs.URL]=this.url,t[Card.hs.bs]=this.linkText,t[Card.hs.fs]=this.aspectRatio,t[Card.hs.xs]=this.extras,t[Card.hs.js]=this.pinned,t[Card.hs.zs]=this.dismissible,t[Card.hs.gs]=this.clicked,t[Card.hs.ks]=this.test,t}}
1
+ import Card from"./card.js";export default class CaptionedImage extends Card{constructor(t,s,i,h,e,r,a,o,c,n,d,p,u,l,m,f){super(t,s,i,h,e,r,a,o,c,n,d,p,u,l,m,f),this.Y="ab-captioned-image",this.Z=!0}ss(){const t={};return t[Card.hs.ts]=Card.es.st,t[Card.hs.ns]=this.id,t[Card.hs.ls]=this.viewed,t[Card.hs.ht]=this.title,t[Card.hs.os]=this.imageUrl,t[Card.hs.rt]=this.description,t[Card.hs.us]=this.updated,t[Card.hs.cs]=this.created,t[Card.hs.ds]=this.categories,t[Card.hs.ps]=this.expiresAt,t[Card.hs.URL]=this.url,t[Card.hs.bs]=this.linkText,t[Card.hs.fs]=this.aspectRatio,t[Card.hs.xs]=this.extras,t[Card.hs.js]=this.pinned,t[Card.hs.zs]=this.dismissible,t[Card.hs.gs]=this.clicked,t[Card.hs.ks]=this.test,t}}
@@ -1 +1 @@
1
- import{convertMsToSeconds as l,dateFromUnixTimestamp as h}from"../../util/date-utils.js";import{FEED_ANIMATION_DURATION as E}from"../../common/constants.js";import u from"../../managers/subscription-manager.js";export default class Card{constructor(t,i,s,n,l,h,e,r,E,u,T,o,I,a,N,S){this.id=t,this.viewed=i||!1,this.title=s||"",this.imageUrl=n,this.description=l||"",this.created=h||null,this.updated=e||null,this.categories=r||[],this.expiresAt=E||null,this.url=u,this.linkText=T,o=parseFloat(o),this.aspectRatio=isNaN(o)?null:o,this.extras=I,this.pinned=a||!1,this.dismissible=N||!1,this.dismissed=!1,this.clicked=S||!1,this.test=!1,this.lt=null,this.rt=null}subscribeToClickedEvent(t){return this.ut().Et(t)}subscribeToDismissedEvent(t){return this.Tt().Et(t)}removeSubscription(t){this.ut().removeSubscription(t),this.Tt().removeSubscription(t)}removeAllSubscriptions(){this.ut().removeAllSubscriptions(),this.Tt().removeAllSubscriptions()}dismissCard(){if(this.dismissible&&!this.dismissed){this.tt&&this.tt(this);var t=this.X;t&&(t.style.height=t.offsetHeight+"px",t.className=t.className+" ab-hide",setTimeout((function(){t&&t.parentNode&&(t.style.height="0",t.style.margin="0",setTimeout((function(){t&&t.parentNode&&t.parentNode.removeChild(t)}),Card.It))}),E))}}ut(){return null==this.lt&&(this.lt=new u),this.lt}Tt(){return null==this.rt&&(this.rt=new u),this.rt}R(){this.viewed=!0}k(){this.viewed=!0,this.clicked=!0,this.ut().Nt()}J(){return!(!this.dismissible||this.dismissed)&&(this.dismissed=!0,this.Tt().Nt(),!0)}St(t){if(null==t||t[Card.ct.ns]!==this.id)return!0;if(t[Card.ct.At])return!1;if(null!=t[Card.ct.us]&&null!=this.updated&&t[Card.ct.us]<l(this.updated.valueOf()))return!0;if(t[Card.ct.ls]&&!this.viewed&&(this.viewed=!0),t[Card.ct.gs]&&!this.clicked&&(this.clicked=t[Card.ct.gs]),null!=t[Card.ct.it]&&(this.title=t[Card.ct.it]),null!=t[Card.ct.os]&&(this.imageUrl=t[Card.ct.os]),null!=t[Card.ct.ht]&&(this.description=t[Card.ct.ht]),null!=t[Card.ct.us]){const i=h(t[Card.ct.us]);null!=i&&(this.updated=i)}if(null!=t[Card.ct.ps]){let i;i=t[Card.ct.ps]===Card.Dt?null:h(t[Card.ct.ps]),this.expiresAt=i}if(null!=t[Card.ct.URL]&&(this.url=t[Card.ct.URL]),null!=t[Card.ct.bs]&&(this.linkText=t[Card.ct.bs]),null!=t[Card.ct.fs]){const i=parseFloat(t[Card.ct.fs]);this.aspectRatio=isNaN(i)?null:i}return null!=t[Card.ct.xs]&&(this.extras=t[Card.ct.xs]),null!=t[Card.ct.js]&&(this.pinned=t[Card.ct.js]),null!=t[Card.ct.zs]&&(this.dismissible=t[Card.ct.zs]),null!=t[Card.ct.ks]&&(this.test=t[Card.ct.ks]),!0}}Card.Dt=-1,Card.es={st:"captioned_image",Ct:"text_announcement",dt:"short_news",rs:"banner_image",Rt:"control"},Card.ct={ns:"id",ls:"v",zs:"db",At:"r",us:"ca",js:"p",ps:"ea",xs:"e",ts:"tp",os:"i",it:"tt",ht:"ds",URL:"u",bs:"dm",fs:"ar",gs:"cl",ks:"t"},Card.hs={ns:"id",ls:"v",zs:"db",cs:"cr",us:"ca",js:"p",ds:"t",ps:"ea",xs:"e",ts:"tp",os:"i",it:"tt",ht:"ds",URL:"u",bs:"dm",fs:"ar",gs:"cl",ks:"s"},Card._t={Lt:"ADVERTISING",Ot:"ANNOUNCEMENTS",bt:"NEWS",ft:"SOCIAL"},Card.It=400;
1
+ import{convertMsToSeconds as l,dateFromUnixTimestamp as h}from"../../util/date-utils.js";import{FEED_ANIMATION_DURATION as E}from"../../common/constants.js";import u from"../../managers/subscription-manager.js";export default class Card{constructor(t,i,s,n,l,h,e,r,E,u,T,o,I,a,N,S){this.id=t,this.viewed=i||!1,this.title=s||"",this.imageUrl=n,this.description=l||"",this.created=h||null,this.updated=e||null,this.categories=r||[],this.expiresAt=E||null,this.url=u,this.linkText=T,o=parseFloat(o),this.aspectRatio=isNaN(o)?null:o,this.extras=I,this.pinned=a||!1,this.dismissible=N||!1,this.dismissed=!1,this.clicked=S||!1,this.test=!1,this.lt=null,this.Et=null}subscribeToClickedEvent(t){return this.Tt().ut(t)}subscribeToDismissedEvent(t){return this.It().ut(t)}removeSubscription(t){this.Tt().removeSubscription(t),this.It().removeSubscription(t)}removeAllSubscriptions(){this.Tt().removeAllSubscriptions(),this.It().removeAllSubscriptions()}dismissCard(){if(this.dismissible&&!this.dismissed){this.tt&&this.tt(this);var t=this.X;t&&(t.style.height=t.offsetHeight+"px",t.className=t.className+" ab-hide",setTimeout((function(){t&&t.parentNode&&(t.style.height="0",t.style.margin="0",setTimeout((function(){t&&t.parentNode&&t.parentNode.removeChild(t)}),Card.Nt))}),E))}}Tt(){return null==this.lt&&(this.lt=new u),this.lt}It(){return null==this.Et&&(this.Et=new u),this.Et}R(){this.viewed=!0}k(){this.viewed=!0,this.clicked=!0,this.Tt().St()}J(){return!(!this.dismissible||this.dismissed)&&(this.dismissed=!0,this.It().St(),!0)}ct(t){if(null==t||t[Card.At.ns]!==this.id)return!0;if(t[Card.At.Dt])return!1;if(null!=t[Card.At.us]&&null!=this.updated&&t[Card.At.us]<l(this.updated.valueOf()))return!0;if(t[Card.At.ls]&&!this.viewed&&(this.viewed=!0),t[Card.At.gs]&&!this.clicked&&(this.clicked=t[Card.At.gs]),null!=t[Card.At.ht]&&(this.title=t[Card.At.ht]),null!=t[Card.At.os]&&(this.imageUrl=t[Card.At.os]),null!=t[Card.At.rt]&&(this.description=t[Card.At.rt]),null!=t[Card.At.us]){const i=h(t[Card.At.us]);null!=i&&(this.updated=i)}if(null!=t[Card.At.ps]){let i;i=t[Card.At.ps]===Card.Ct?null:h(t[Card.At.ps]),this.expiresAt=i}if(null!=t[Card.At.URL]&&(this.url=t[Card.At.URL]),null!=t[Card.At.bs]&&(this.linkText=t[Card.At.bs]),null!=t[Card.At.fs]){const i=parseFloat(t[Card.At.fs]);this.aspectRatio=isNaN(i)?null:i}return null!=t[Card.At.xs]&&(this.extras=t[Card.At.xs]),null!=t[Card.At.js]&&(this.pinned=t[Card.At.js]),null!=t[Card.At.zs]&&(this.dismissible=t[Card.At.zs]),null!=t[Card.At.ks]&&(this.test=t[Card.At.ks]),!0}}Card.Ct=-1,Card.es={st:"captioned_image",dt:"text_announcement",Rt:"short_news",rs:"banner_image",_t:"control"},Card.At={ns:"id",ls:"v",zs:"db",Dt:"r",us:"ca",js:"p",ps:"ea",xs:"e",ts:"tp",os:"i",ht:"tt",rt:"ds",URL:"u",bs:"dm",fs:"ar",gs:"cl",ks:"t"},Card.hs={ns:"id",ls:"v",zs:"db",cs:"cr",us:"ca",js:"p",ds:"t",ps:"ea",xs:"e",ts:"tp",os:"i",ht:"tt",rt:"ds",URL:"u",bs:"dm",fs:"ar",gs:"cl",ks:"s"},Card.Lt={Ot:"ADVERTISING",bt:"ANNOUNCEMENTS",ft:"NEWS",Pt:"SOCIAL"},Card.Nt=400;
@@ -1 +1 @@
1
- import Card from"./card.js";export default class ClassicCard extends Card{constructor(s,t,i,h,r,c,e,a,o,d,l,n,u,p,f,m){super(s,t,i,h,r,c,e,a,o,d,l,n,u,p,f,m),this.Y="ab-classic-card",this.Z=!0}ss(){const s={};return s[Card.hs.ts]=Card.es.dt,s[Card.hs.ns]=this.id,s[Card.hs.ls]=this.viewed,s[Card.hs.it]=this.title,s[Card.hs.os]=this.imageUrl,s[Card.hs.ht]=this.description,s[Card.hs.us]=this.updated,s[Card.hs.cs]=this.created,s[Card.hs.ds]=this.categories,s[Card.hs.ps]=this.expiresAt,s[Card.hs.URL]=this.url,s[Card.hs.bs]=this.linkText,s[Card.hs.fs]=this.aspectRatio,s[Card.hs.xs]=this.extras,s[Card.hs.js]=this.pinned,s[Card.hs.zs]=this.dismissible,s[Card.hs.gs]=this.clicked,s[Card.hs.ks]=this.test,s}}
1
+ import Card from"./card.js";export default class ClassicCard extends Card{constructor(s,t,i,h,r,c,e,a,o,d,l,n,u,p,f,m){super(s,t,i,h,r,c,e,a,o,d,l,n,u,p,f,m),this.Y="ab-classic-card",this.Z=!0}ss(){const s={};return s[Card.hs.ts]=Card.es.Rt,s[Card.hs.ns]=this.id,s[Card.hs.ls]=this.viewed,s[Card.hs.ht]=this.title,s[Card.hs.os]=this.imageUrl,s[Card.hs.rt]=this.description,s[Card.hs.us]=this.updated,s[Card.hs.cs]=this.created,s[Card.hs.ds]=this.categories,s[Card.hs.ps]=this.expiresAt,s[Card.hs.URL]=this.url,s[Card.hs.bs]=this.linkText,s[Card.hs.fs]=this.aspectRatio,s[Card.hs.xs]=this.extras,s[Card.hs.js]=this.pinned,s[Card.hs.zs]=this.dismissible,s[Card.hs.gs]=this.clicked,s[Card.hs.ks]=this.test,s}}
@@ -1 +1 @@
1
- import Card from"./card.js";export default class ControlCard extends Card{constructor(l,t,s,n,u,i){super(l,t,null,null,null,null,s,null,n,null,null,null,u,i,null),this.Y="ab-control-card",this.Z=!1}ss(){const l={};return l[Card.hs.ts]=Card.es.Rt,l[Card.hs.ns]=this.id,l[Card.hs.ls]=this.viewed,l[Card.hs.us]=this.updated,l[Card.hs.ps]=this.expiresAt,l[Card.hs.xs]=this.extras,l[Card.hs.js]=this.pinned,l[Card.hs.ks]=this.test,l}}
1
+ import Card from"./card.js";export default class ControlCard extends Card{constructor(l,t,s,n,u,i){super(l,t,null,null,null,null,s,null,n,null,null,null,u,i,null),this.Y="ab-control-card",this.Z=!1}ss(){const l={};return l[Card.hs.ts]=Card.es._t,l[Card.hs.ns]=this.id,l[Card.hs.ls]=this.viewed,l[Card.hs.us]=this.updated,l[Card.hs.ps]=this.expiresAt,l[Card.hs.xs]=this.extras,l[Card.hs.js]=this.pinned,l[Card.hs.ks]=this.test,l}}
@@ -1 +1 @@
1
- import{Card,Banner,CaptionedImage,ClassicCard,ControlCard}from"../index.js";import{dateFromUnixTimestamp as h,rehydrateDateAfterJsonization as w}from"../../util/date-utils.js";import r from"../../../shared-lib/braze-shared-lib.js";export function newCard(e,n,t,o,i,l,u,d,a,s,w,f,m,C,p,c,x,F){let b;if(n===Card.es.Ct||n===Card.es.dt)b=new ClassicCard(e,t,o,i,l,u,d,a,s,w,f,m,C,p,c,x);else if(n===Card.es.st)b=new CaptionedImage(e,t,o,i,l,u,d,a,s,w,f,m,C,p,c,x);else if(n===Card.es.rs)b=new Banner(e,t,i,u,d,a,s,w,f,m,C,p,c,x);else{if(n!==Card.es.Rt)return r.D.error("Ignoring card with unknown type "+n),null;b=new ControlCard(e,t,d,s,C,p)}return F&&(b.test=F),b}export function newCardFromContentCardsJson(e){if(e[Card.ct.At])return null;const n=e[Card.ct.ns],r=e[Card.ct.ts],t=e[Card.ct.ls],o=e[Card.ct.it],i=e[Card.ct.os],l=e[Card.ct.ht],u=h(e[Card.ct.us]),d=u;let a;a=e[Card.ct.ps]===Card.Dt?null:h(e[Card.ct.ps]);return newCard(n,r,t,o,i,l,d,u,null,a,e[Card.ct.URL],e[Card.ct.bs],e[Card.ct.fs],e[Card.ct.xs],e[Card.ct.js],e[Card.ct.zs],e[Card.ct.gs],e[Card.ct.ks]||!1)}export function newCardFromFeedJson(e){return newCard(e.id,e.type,e.viewed,e.title,e.image,e.description,h(e.created),h(e.updated),e.categories,h(e.expires_at),e.url,e.domain,e.aspect_ratio,e.extras,!1,!1)}export function newCardFromSerializedValue(e){return newCard(e[Card.hs.ns],e[Card.hs.ts],e[Card.hs.ls],e[Card.hs.it],e[Card.hs.os],e[Card.hs.ht],w(e[Card.hs.cs]),w(e[Card.hs.us]),e[Card.hs.ds],w(e[Card.hs.ps]),e[Card.hs.URL],e[Card.hs.bs],e[Card.hs.fs],e[Card.hs.xs],e[Card.hs.js],e[Card.hs.zs],e[Card.hs.gs],e[Card.hs.ks]||!1)||void 0}
1
+ import{Card,Banner,CaptionedImage,ClassicCard,ControlCard}from"../index.js";import{dateFromUnixTimestamp as h,rehydrateDateAfterJsonization as w}from"../../util/date-utils.js";import r from"../../../shared-lib/braze-shared-lib.js";export function newCard(e,n,t,o,i,l,u,d,a,s,w,f,m,C,p,c,x,F){let b;if(n===Card.es.dt||n===Card.es.Rt)b=new ClassicCard(e,t,o,i,l,u,d,a,s,w,f,m,C,p,c,x);else if(n===Card.es.st)b=new CaptionedImage(e,t,o,i,l,u,d,a,s,w,f,m,C,p,c,x);else if(n===Card.es.rs)b=new Banner(e,t,i,u,d,a,s,w,f,m,C,p,c,x);else{if(n!==Card.es._t)return r.D.error("Ignoring card with unknown type "+n),null;b=new ControlCard(e,t,d,s,C,p)}return F&&(b.test=F),b}export function newCardFromContentCardsJson(e){if(e[Card.At.Dt])return null;const n=e[Card.At.ns],r=e[Card.At.ts],t=e[Card.At.ls],o=e[Card.At.ht],i=e[Card.At.os],l=e[Card.At.rt],u=h(e[Card.At.us]),d=u;let a;a=e[Card.At.ps]===Card.Ct?null:h(e[Card.At.ps]);return newCard(n,r,t,o,i,l,d,u,null,a,e[Card.At.URL],e[Card.At.bs],e[Card.At.fs],e[Card.At.xs],e[Card.At.js],e[Card.At.zs],e[Card.At.gs],e[Card.At.ks]||!1)}export function newCardFromFeedJson(e){return newCard(e.id,e.type,e.viewed,e.title,e.image,e.description,h(e.created),h(e.updated),e.categories,h(e.expires_at),e.url,e.domain,e.aspect_ratio,e.extras,!1,!1)}export function newCardFromSerializedValue(e){return newCard(e[Card.hs.ns],e[Card.hs.ts],e[Card.hs.ls],e[Card.hs.ht],e[Card.hs.os],e[Card.hs.rt],w(e[Card.hs.cs]),w(e[Card.hs.us]),e[Card.hs.ds],w(e[Card.hs.ps]),e[Card.hs.URL],e[Card.hs.bs],e[Card.hs.fs],e[Card.hs.xs],e[Card.hs.js],e[Card.hs.zs],e[Card.hs.gs],e[Card.hs.ks]||!1)||void 0}
@@ -1 +1 @@
1
- import b from"../util/net.js";import C from"../common/base-provider.js";import e from"../managers/braze-instance.js";import ContentCards from"./content-cards.js";import{dateFromUnixTimestamp as h}from"../util/date-utils.js";import{isURIJavascriptOrData as j}from"../util/url-utils.js";import{newCardFromContentCardsJson as S,newCardFromSerializedValue as _}from"../Card/util/card-factory.js";import r from"../../shared-lib/braze-shared-lib.js";import{STORAGE_KEYS as o}from"../managers/storage-manager.js";import u from"../managers/subscription-manager.js";export default class v extends C{constructor(t,s,i,h,n){super(),this.v=t,this.h=s,this.wt=i,this.gt=h,this.jt=n,this.vt=new u,e.Ut(this.vt),this.yt=0,this.kt=0,this.zt();const o=r.Ft.xt;new r.qt(o,r.D).Jt(o.Pt.Mt,(t=>{this.$t(t)}))}Bt(){return this.Gt}Ht(t){this.Gt=t}Kt(){return this.Qt}Vt(t){this.Qt=t}zt(){const t=this.h.I(o.q.Wt)||[],s=[];for(let i=0;i<t.length;i++){const e=_(t[i]);null!=e&&s.push(e)}this.Xt=this.Yt(this.Zt(s,!1)),this.yt=this.h.I(o.q.Cs)||this.yt,this.kt=this.h.I(o.q.ws)||this.kt}vs(t,s,i,e){let h;if(s){h=[];for(const t of this.Xt)t.test&&h.push(t)}else h=this.Xt.slice();for(let i=0;i<t.length;i++){const e=t[i];let r=null;for(let t=0;t<this.Xt.length;t++)if(e.id===this.Xt[t].id){r=this.Xt[t];break}if(s){const t=S(e);null!=r&&r.viewed&&(t.viewed=!0),null!=t&&h.push(t)}else if(null==r){const t=S(e);null!=t&&h.push(t)}else{if(!r.St(e))for(let t=0;t<h.length;t++)if(e.id===h[t].id){h.splice(t,1);break}}}this.Xt=this.Yt(this.Zt(h,s)),this.Ss(),this.yt=i||0,this.h.B(o.q.Cs,this.yt),this.kt=e||0,this.h.B(o.q.ws,this.kt)}_s(t){if(this.Us()&&null!=t&&t.cards){const s=t.full_sync;s||this.zt(),this.vs(t.cards,s,t.last_full_sync_at,t.last_card_updated_at),this.vt.Nt(this.ys(!0))}}$t(t){if(!this.Us())return;this.zt();const s=this.Xt.slice(),i=this.v.getUserId();for(let e=0;e<t.length;e++)if(i===t[e].userId||null==i&&null==t[e].userId){const i=t[e].card;let h=null;for(let t=0;t<this.Xt.length;t++)if(i.id===this.Xt[t].id){h=this.Xt[t];break}if(null==h){const t=S(i);null!=t&&s.push(t)}else{if(!h.St(i))for(let t=0;t<s.length;t++)if(i.id===s[t].id){s.splice(t,1);break}}}this.Xt=this.Yt(this.Zt(s,!1)),this.Ss(),this.vt.Nt(this.ys(!0))}Zt(t,s){const i=this.h.I(o.q.$)||{},e=this.h.I(o.q.O)||{},h=this.h.I(o.q.K)||{},r={},n={},a={};for(let s=0;s<t.length;s++)i[t[s].id]&&(t[s].clicked=!0,r[t[s].id]=!0),e[t[s].id]&&(t[s].viewed=!0,n[t[s].id]=!0),h[t[s].id]&&(t[s].dismissed=!0,a[t[s].id]=!0);return s&&(this.h.B(o.q.$,r),this.h.B(o.q.O,n),this.h.B(o.q.K,a)),t}Yt(t){const s=[],i=new Date,e=this.h.I(o.q.K)||{};let h=!1;for(let n=0;n<t.length;n++){const o=t[n].url;!this.gt&&o&&j(o)?r.D.error(`Card with url ${o} will not be displayed because Javascript URLs are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable this card.`):(null==t[n].expiresAt||t[n].expiresAt>=i)&&!t[n].dismissed?s.push(t[n]):(e[t[n].id]=!0,h=!0)}return h&&this.h.B(o.q.K,e),s}Ss(){const t=[];for(let s=0;s<this.Xt.length;s++)t.push(this.Xt[s].ss());this.h.B(o.q.Wt,t)}Ts(t,s){if(!this.Us())return void(this.Ds||(this.Ds=this.wt.Rs((()=>{this.Ts(t,s)}))));const i=this.jt.Ls({},!0);i.last_full_sync_at=this.yt,i.last_card_updated_at=this.kt;const e=this.jt.Ns(i,!0);this.jt.As(i,(()=>{b.Fs({url:this.jt.Js()+"/content_cards/sync",data:i,headers:e,S:h=>{this.jt.qs(i,h,e)?(this.jt.Es(),this._s(h),"function"==typeof t&&t()):"function"==typeof s&&s()},error:t=>{this.jt.Ms(t,"retrieving content cards"),"function"==typeof s&&s()}})}))}ys(t){t||this.zt();const s=this.Yt(this.Xt);s.sort(((t,s)=>t.pinned&&!s.pinned?-1:s.pinned&&!t.pinned?1:t.updated>s.updated?-1:s.updated>t.updated?1:0));let i=Math.max(this.kt||0,this.yt||0);return 0===i&&(i=void 0),this.h.I(o.q.ws)===this.kt&&void 0===i&&(i=this.kt),new ContentCards(s,h(i))}Ps(t){return this.vt.Et(t)}changeUser(t){t||(this.Xt=[],this.vt.Nt(new ContentCards(this.Xt.slice(),null)),this.h.$s(o.q.Wt),this.h.$s(o.q.$),this.h.$s(o.q.O),this.h.$s(o.q.K)),this.yt=0,this.kt=0,this.h.$s(o.q.Cs),this.h.$s(o.q.ws)}clearData(t){this.yt=0,this.kt=0,this.Xt=[],this.vt.Nt(new ContentCards(this.Xt.slice(),null)),t&&(this.h.$s(o.q.Wt),this.h.$s(o.q.$),this.h.$s(o.q.O),this.h.$s(o.q.K),this.h.$s(o.q.Cs),this.h.$s(o.q.ws))}Us(){return!!this.wt.Bs()||(0!==this.wt.Gs()&&this.Hs(),!1)}Hs(){this.vt.Nt(new ContentCards([],(new Date).valueOf())),this.h.$s(o.q.Wt)}}
1
+ import b,{readResponseHeaders as C}from"../util/net.js";import y from"../common/base-provider.js";import e from"../managers/braze-instance.js";import ContentCards from"./content-cards.js";import{dateFromUnixTimestamp as h}from"../util/date-utils.js";import{isURIJavascriptOrData as j}from"../util/url-utils.js";import{newCardFromContentCardsJson as N,newCardFromSerializedValue as S}from"../Card/util/card-factory.js";import r from"../../shared-lib/braze-shared-lib.js";import{STORAGE_KEYS as o}from"../managers/storage-manager.js";import u from"../managers/subscription-manager.js";import s from"../common/event-logger.js";export default class v extends y{constructor(t,s,i,h,n){super(),this.v=t,this.h=s,this.gt=i,this.wt=h,this.vt=n,this.yt=new u,e.jt(this.yt),this.Ut=0,this.kt=0,this.zt();const o=r.xt.Ft;new r.qt(o,r.D).Jt(o.$t.Mt,(t=>{this.Bt(t)})),this.Gt=null}Ht(){return this.Kt}Qt(t){this.Kt=t}Vt(){return this.Wt}Xt(t){this.Wt=t}zt(){const t=this.h.I(o.q.Yt)||[],s=[];for(let i=0;i<t.length;i++){const e=S(t[i]);null!=e&&s.push(e)}this.Zt=this.Cs(this.ws(s,!1)),this.Ut=this.h.I(o.q.vs)||this.Ut,this.kt=this.h.I(o.q.ys)||this.kt}Ns(t,s,i,e){let h;if(s){h=[];for(const t of this.Zt)t.test&&h.push(t)}else h=this.Zt.slice();for(let i=0;i<t.length;i++){const e=t[i];let r=null;for(let t=0;t<this.Zt.length;t++)if(e.id===this.Zt[t].id){r=this.Zt[t];break}if(s){const t=N(e);null!=r&&r.viewed&&(t.viewed=!0),null!=t&&h.push(t)}else if(null==r){const t=N(e);null!=t&&h.push(t)}else{if(!r.ct(e))for(let t=0;t<h.length;t++)if(e.id===h[t].id){h.splice(t,1);break}}}this.Zt=this.Cs(this.ws(h,s)),this.Ss(),this.Ut=i||0,this.h.B(o.q.vs,this.Ut),this.kt=e||0,this.h.B(o.q.ys,this.kt)}Rs(t){if(this.Ts()&&null!=t&&t.cards){this.h.B(o.q._s,e.Ds());const s=t.full_sync;s||this.zt(),this.Ns(t.cards,s,t.last_full_sync_at,t.last_card_updated_at),this.yt.St(this.Us(!0))}}Fs(t){this.h.B(o.q.As,t)}Ls(t,i,e){const h=()=>{this.Is(i,e,!0)},n=C(t);let a,l;if(this.Js(),!n["retry-after"])return void this.Fs(0);if(a=n["retry-after"],isNaN(a)&&!isNaN(Date.parse(a)))l=Date.parse(a)-(new Date).getTime(),l<0&&h();else{if(isNaN(parseFloat(a))){const t="Received unexpected value for retry-after header in /sync response";return s.G(r.A.qs,{e:t+": "+a}),void this.Fs(0)}l=1e3*a}this.Gt=setTimeout((()=>{h()}),l);let c=this.h.I(o.q.As);c&&!isNaN(parseInt(c))||(c=0),this.Fs(parseInt(c)+1)}Bt(t){if(!this.Ts())return;this.zt();const s=this.Zt.slice(),i=this.v.getUserId();for(let e=0;e<t.length;e++)if(i===t[e].userId||null==i&&null==t[e].userId){const i=t[e].card;let h=null;for(let t=0;t<this.Zt.length;t++)if(i.id===this.Zt[t].id){h=this.Zt[t];break}if(null==h){const t=N(i);null!=t&&s.push(t)}else{if(!h.ct(i))for(let t=0;t<s.length;t++)if(i.id===s[t].id){s.splice(t,1);break}}}this.Zt=this.Cs(this.ws(s,!1)),this.Ss(),this.yt.St(this.Us(!0))}ws(t,s){const i=this.h.I(o.q.$)||{},e=this.h.I(o.q.O)||{},h=this.h.I(o.q.K)||{},r={},n={},a={};for(let s=0;s<t.length;s++)i[t[s].id]&&(t[s].clicked=!0,r[t[s].id]=!0),e[t[s].id]&&(t[s].viewed=!0,n[t[s].id]=!0),h[t[s].id]&&(t[s].dismissed=!0,a[t[s].id]=!0);return s&&(this.h.B(o.q.$,r),this.h.B(o.q.O,n),this.h.B(o.q.K,a)),t}Cs(t){const s=[],i=new Date,e=this.h.I(o.q.K)||{};let h=!1;for(let n=0;n<t.length;n++){const o=t[n].url;!this.wt&&o&&j(o)?r.D.error(`Card with url ${o} will not be displayed because Javascript URLs are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable this card.`):(null==t[n].expiresAt||t[n].expiresAt>=i)&&!t[n].dismissed?s.push(t[n]):(e[t[n].id]=!0,h=!0)}return h&&this.h.B(o.q.K,e),s}Ss(){const t=[];for(let s=0;s<this.Zt.length;s++)t.push(this.Zt[s].ss());this.h.B(o.q.Yt,t)}Js(){this.Gt&&(clearTimeout(this.Gt),this.Gt=null)}Is(t,s,i){if(i||(this.Js(),this.Fs(0)),!this.Ts())return void(this.Es||(this.Es=this.gt.Ms((()=>{this.Is(t,s)}))));const h=this.vt.Ps({},!0);this.h.I(o.q._s)!==e.Ds()&&this.$s(),h.last_full_sync_at=this.Ut,h.last_card_updated_at=this.kt;const r=this.vt.Bs(h,!0,i);this.vt.Gs(h,(()=>{b.Hs({url:this.vt.Ks()+"/content_cards/sync",data:h,headers:r,S:(i,e)=>{this.vt.Os(h,i,r)?(this.vt.Qs(),this.Ls(e,t,s),this.Rs(i),"function"==typeof t&&t()):"function"==typeof s&&s()},error:t=>{this.vt.Vs(t,"retrieving content cards"),"function"==typeof s&&s()}})}))}Us(t){t||this.zt();const s=this.Cs(this.Zt);s.sort(((t,s)=>t.pinned&&!s.pinned?-1:s.pinned&&!t.pinned?1:t.updated>s.updated?-1:s.updated>t.updated?1:0));let i=Math.max(this.kt||0,this.Ut||0);return 0===i&&(i=void 0),this.h.I(o.q.ys)===this.kt&&void 0===i&&(i=this.kt),new ContentCards(s,h(i))}Ws(t){return this.yt.ut(t)}$s(){this.Ut=0,this.kt=0,this.h.Xs(o.q.vs),this.h.Xs(o.q.ys)}changeUser(t){t||(this.Zt=[],this.yt.St(new ContentCards(this.Zt.slice(),null)),this.h.Xs(o.q.Yt),this.h.Xs(o.q.$),this.h.Xs(o.q.O),this.h.Xs(o.q.K)),this.$s()}clearData(t){this.Ut=0,this.kt=0,this.Zt=[],this.yt.St(new ContentCards(this.Zt.slice(),null)),t&&(this.h.Xs(o.q.Yt),this.h.Xs(o.q.$),this.h.Xs(o.q.O),this.h.Xs(o.q.K),this.h.Xs(o.q.vs),this.h.Xs(o.q.ys))}Ts(){return!!this.gt.Ys()||(0!==this.gt.Zs()&&this.ti(),!1)}ti(){this.yt.St(new ContentCards([],(new Date).valueOf())),this.h.Xs(o.q.Yt)}}
@@ -1 +1 @@
1
- import g from"./content-cards-provider-factory.js";import e from"../managers/braze-instance.js";export function getCachedContentCards(){if(e.rr())return g.er().ys(!1)}
1
+ import g from"./content-cards-provider-factory.js";import e from"../managers/braze-instance.js";export function getCachedContentCards(){if(e.rr())return g.er().Us(!1)}
@@ -1 +1 @@
1
- import e from"../managers/braze-instance.js";import{logDeprecationWarning as y}from"../util/deprecation-utils.js";export function logContentCardsDisplayed(){if(e.rr())return y("logContentCardsDisplayed","method"),!0}
1
+ import e from"../managers/braze-instance.js";import{logDeprecationWarning as D}from"../util/deprecation-utils.js";export function logContentCardsDisplayed(){if(e.rr())return D("logContentCardsDisplayed","method"),!0}
@@ -1 +1 @@
1
- import e from"../managers/braze-instance.js";import g from"./content-cards-provider-factory.js";export function requestContentCardsRefresh(r,t){if(e.rr())return g.er().Ts(r,t)}
1
+ import e from"../managers/braze-instance.js";import g from"./content-cards-provider-factory.js";export function requestContentCardsRefresh(r,t){if(e.rr())return g.er().Is(r,t)}
@@ -1 +1 @@
1
- import e from"../managers/braze-instance.js";import g from"./content-cards-provider-factory.js";export function subscribeToContentCardsUpdates(r){if(!e.rr())return;const t=g.er(),n=t.Ps(r);if(!t.Kt()){const r=e.mr().cr((()=>{t.Ts()}));t.Vt(r)}return n}
1
+ import e from"../managers/braze-instance.js";import g from"./content-cards-provider-factory.js";export function subscribeToContentCardsUpdates(r){if(!e.rr())return;const t=g.er(),n=t.Ws(r);if(!t.Vt()){const r=e.mr().cr((()=>{t.Is()}));t.Xt(r)}return n}
@@ -1 +1 @@
1
- import e,{OPTIONS as D}from"../../managers/braze-instance.js";import{ContentCards,subscribeToContentCardsUpdates}from"../index.js";import g from"../content-cards-provider-factory.js";import{destroyFeedHtml as z,detectFeedImpressions as T,feedToHtml as N,LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE as q,refreshFeed as I,registerFeedSubscriptionId as L,updateFeedCards as M}from"../../common/feed-display.js";import{setCardHeight as $}from"../../Card/display/card-display.js";import{setupFeedUI as k}from"../../ui/js/index.js";import r from"../../../shared-lib/braze-shared-lib.js";export function showContentCards(n,t){if(!e.rr())return;k();let o=!1;null==n&&(n=document.body,o=!0);const a=e.nn(D.tn)||e.nn(D.en)||!1;let i=g.er().ys(!1);"function"==typeof t&&M(i,t(i.cards.slice()),i.lastUpdated,null,a);const s=N(i,a),f=g.er();(null==i.lastUpdated||(new Date).valueOf()-i.lastUpdated.valueOf()>ContentCards.ur)&&(null==f.Bt()||(new Date).valueOf()-f.Bt()>ContentCards.ur)&&(r.D.info(`Cached content cards were older than max TTL of ${ContentCards.ur} ms, requesting an update from the server.`),I(i,s),f.Ht((new Date).valueOf()));const l=(new Date).valueOf(),c=subscribeToContentCardsUpdates((function(n){const e=s.querySelectorAll(".ab-refresh-button")[0];if(null!=e){let n=500;const t=parseInt(s.getAttribute(q));isNaN(t)?n-=(new Date).valueOf()-l:n-=(new Date).valueOf()-t,setTimeout((function(){e.className=e.className.replace(/fa-spin/g,"")}),Math.max(n,0))}let o=n.cards;"function"==typeof t&&(o=t(o.slice())),M(i,o,n.lastUpdated,s,a)}));L(c,s);const u=function(n){const t=n.querySelectorAll(".ab-feed");let e=null;for(let o=0;o<t.length;o++)t[o].parentNode===n&&(e=t[o]);null!=e?(z(e),e.parentNode.replaceChild(s,e)):n.appendChild(s),setTimeout((function(){s.className=s.className.replace("ab-hide","ab-show")}),0),o&&s.focus(),T(i,s),$(i.cards,n)};var m;null!=n?u(n):window.onload=(m=window.onload,function(){"function"==typeof m&&m(),u(document.body)})}
1
+ import e,{OPTIONS as T}from"../../managers/braze-instance.js";import{ContentCards,subscribeToContentCardsUpdates}from"../index.js";import g from"../content-cards-provider-factory.js";import{destroyFeedHtml as z,detectFeedImpressions as q,feedToHtml as I,LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE as L,refreshFeed as M,registerFeedSubscriptionId as $,updateFeedCards as k}from"../../common/feed-display.js";import{setCardHeight as A}from"../../Card/display/card-display.js";import{setupFeedUI as B}from"../../ui/js/index.js";import r from"../../../shared-lib/braze-shared-lib.js";export function showContentCards(n,t){if(!e.rr())return;B();let o=!1;null==n&&(n=document.body,o=!0);const a=e.nn(T.tn)||e.nn(T.en)||!1;let i=g.er().Us(!1);"function"==typeof t&&k(i,t(i.cards.slice()),i.lastUpdated,null,a);const s=I(i,a),f=g.er();(null==i.lastUpdated||(new Date).valueOf()-i.lastUpdated.valueOf()>ContentCards.ur)&&(null==f.Ht()||(new Date).valueOf()-f.Ht()>ContentCards.ur)&&(r.D.info(`Cached content cards were older than max TTL of ${ContentCards.ur} ms, requesting an update from the server.`),M(i,s),f.Qt((new Date).valueOf()));const l=(new Date).valueOf(),c=subscribeToContentCardsUpdates((function(n){const e=s.querySelectorAll(".ab-refresh-button")[0];if(null!=e){let n=500;const t=parseInt(s.getAttribute(L));isNaN(t)?n-=(new Date).valueOf()-l:n-=(new Date).valueOf()-t,setTimeout((function(){e.className=e.className.replace(/fa-spin/g,"")}),Math.max(n,0))}let o=n.cards;"function"==typeof t&&(o=t(o.slice())),k(i,o,n.lastUpdated,s,a)}));$(c,s);const u=function(n){const t=n.querySelectorAll(".ab-feed");let e=null;for(let o=0;o<t.length;o++)t[o].parentNode===n&&(e=t[o]);null!=e?(z(e),e.parentNode.replaceChild(s,e)):n.appendChild(s),setTimeout((function(){s.className=s.className.replace("ab-hide","ab-show")}),0),o&&s.focus(),q(i,s),A(i.cards,n)};var m;null!=n?u(n):window.onload=(m=window.onload,function(){"function"==typeof m&&m(),u(document.body)})}
@@ -1 +1 @@
1
- import B from"../managers/braze-instance.js";import BrazeSdkMetadata from"./braze-sdk-metadata.js";import{isArray as p,validateValueIsFromEnum as K}from"../util/code-utils.js";import r from"../../shared-lib/braze-shared-lib.js";export function addSdkMetadata(a){if(B.rr()){if(!p(a))return r.D.error("Cannot set SDK metadata because metadata is not an array."),!1;for(const t of a)if(!K(BrazeSdkMetadata,t,"sdkMetadata contained an invalid value.","BrazeSdkMetadata"))return!1;return B.nr().addSdkMetadata(a),!0}}
1
+ import K from"../managers/braze-instance.js";import BrazeSdkMetadata from"./braze-sdk-metadata.js";import{isArray as p,validateValueIsFromEnum as F}from"../util/code-utils.js";import r from"../../shared-lib/braze-shared-lib.js";export function addSdkMetadata(a){if(K.rr()){if(!p(a))return r.D.error("Cannot set SDK metadata because metadata is not an array."),!1;for(const t of a)if(!F(BrazeSdkMetadata,t,"sdkMetadata contained an invalid value.","BrazeSdkMetadata"))return!1;return K.nr().addSdkMetadata(a),!0}}
@@ -1 +1 @@
1
- import e from"../managers/braze-instance.js";import r from"../../shared-lib/braze-shared-lib.js";import A,{STORAGE_KEYS as o}from"../managers/storage-manager.js";export function disableSDK(){null!=e.mr()&&e.mr().requestImmediateDataFlush();const n=new A.ne(null,!0);n.store(o.ae,"This-cookie-will-expire-in-"+n.ie());const a=r.Ft.xt;new r.qt(a,r.D).setItem(a.Pt.oe,a.se,!0),e.destroy(!1),e.le(!0)}
1
+ import e from"../managers/braze-instance.js";import r from"../../shared-lib/braze-shared-lib.js";import G,{STORAGE_KEYS as o}from"../managers/storage-manager.js";export function disableSDK(){null!=e.mr()&&e.mr().requestImmediateDataFlush();const n=new G.ne(null,!0);n.store(o.ae,"This-cookie-will-expire-in-"+n.ie());const a=r.xt.Ft;new r.qt(a,r.D).setItem(a.$t.oe,a.se,!0),e.destroy(!1),e.le(!0)}
@@ -1 +1 @@
1
- import e from"../managers/braze-instance.js";import r from"../../shared-lib/braze-shared-lib.js";import A,{STORAGE_KEYS as o}from"../managers/storage-manager.js";export function enableSDK(){new A.ne(null,!0).remove(o.ae);const a=r.Ft.xt;new r.qt(a,r.D).br(a.Pt.oe,a.se),e.destroy(!1),e.le(!1)}
1
+ import e from"../managers/braze-instance.js";import r from"../../shared-lib/braze-shared-lib.js";import G,{STORAGE_KEYS as o}from"../managers/storage-manager.js";export function enableSDK(){new G.ne(null,!0).remove(o.ae);const a=r.xt.Ft;new r.qt(a,r.D).br(a.$t.oe,a.se),e.destroy(!1),e.le(!1)}
@@ -1 +1 @@
1
- import r from"../../shared-lib/braze-shared-lib.js";import e from"../managers/braze-instance.js";import{BRAZE_ACTIONS as J,getDecodedBrazeAction as O}from"../util/braze-actions.js";import{BRAZE_ACTION_URI_REGEX as P,isValidBrazeActionJson as F}from"../util/validation-utils.js";import{WindowUtils as G}from"../util/window-utils.js";import{getUser as H}from"./get-user.js";export function _handleBrazeAction(a,s,i){if(e.rr())if(P.test(a)){const e=O(a);if(!e)return;const s=async e=>{if(!F(e))return void r.D.error(`Decoded Braze Action json is invalid: ${JSON.stringify(e,null,2)}`);const a=e[J.properties.type];if(a===J.types.ue)for(const r of e[J.properties.me])s(r);else{const s=e[J.properties.fe];let i,o;switch(a){case J.types.logCustomEvent:i=await import("./log-custom-event.js"),i.logCustomEvent.apply(null,Array.prototype.slice.call(s));break;case J.types.requestPushPermission:i=await import("../Push/request-push-permission.js"),i.requestPushPermission();break;case J.types.setEmailNotificationSubscriptionType:case J.types.setPushNotificationSubscriptionType:case J.types.setCustomUserAttribute:case J.types.addToSubscriptionGroup:case J.types.removeFromSubscriptionGroup:case J.types.addToCustomAttributeArray:case J.types.removeFromCustomAttributeArray:o=H(),o[a].apply(o,Array.prototype.slice.call(s));break;case J.types.de:case J.types.pe:G.openUri.apply(null,Array.prototype.slice.call(s));break;default:r.D.info(`Ignoring unknown Braze Action: ${a}`)}}};s(e)}else G.openUri(a,i,s)}export function handleBrazeAction(e,r){_handleBrazeAction(e,r)}
1
+ import r from"../../shared-lib/braze-shared-lib.js";import e from"../managers/braze-instance.js";import{BRAZE_ACTIONS as _,getDecodedBrazeAction as J}from"../util/braze-actions.js";import{BRAZE_ACTION_URI_REGEX as O,isValidBrazeActionJson as P}from"../util/validation-utils.js";import{WindowUtils as H}from"../util/window-utils.js";import{getUser as Q}from"./get-user.js";export function _handleBrazeAction(a,s,i){if(e.rr())if(O.test(a)){const e=J(a);if(!e)return;const s=async e=>{if(!P(e))return void r.D.error(`Decoded Braze Action json is invalid: ${JSON.stringify(e,null,2)}`);const a=e[_.properties.type];if(a===_.types.ue)for(const r of e[_.properties.me])s(r);else{const s=e[_.properties.fe];let i,o;switch(a){case _.types.logCustomEvent:i=await import("./log-custom-event.js"),i.logCustomEvent.apply(null,Array.prototype.slice.call(s));break;case _.types.requestPushPermission:i=await import("../Push/request-push-permission.js"),i.requestPushPermission();break;case _.types.setEmailNotificationSubscriptionType:case _.types.setPushNotificationSubscriptionType:case _.types.setCustomUserAttribute:case _.types.addToSubscriptionGroup:case _.types.removeFromSubscriptionGroup:case _.types.addToCustomAttributeArray:case _.types.removeFromCustomAttributeArray:o=Q(),o[a].apply(o,Array.prototype.slice.call(s));break;case _.types.de:case _.types.pe:H.openUri.apply(null,Array.prototype.slice.call(s));break;default:r.D.info(`Ignoring unknown Braze Action: ${a}`)}}};s(e)}else H.openUri(a,i,s)}export function handleBrazeAction(e,r){_handleBrazeAction(e,r)}
@@ -1 +1 @@
1
- import A,{STORAGE_KEYS as o}from"../managers/storage-manager.js";export function isDisabled(){return!!new A.ne(null,!0).lr(o.ae)}
1
+ import G,{STORAGE_KEYS as o}from"../managers/storage-manager.js";export function isDisabled(){return!!new G.ne(null,!0).lr(o.ae)}
@@ -1 +1 @@
1
- import e from"../managers/braze-instance.js";import s from"../common/event-logger.js";import r from"../../shared-lib/braze-shared-lib.js";import Q from"../triggers/models/trigger-events.js";import{TriggersProviderFactory as V}from"../triggers/triggers-provider-factory.js";import{validateCustomProperties as W,validateCustomString as X}from"../util/validation-utils.js";export function logCustomEvent(t,o){if(!e.rr())return!1;if(null==t||t.length<=0)return r.D.error(`logCustomEvent requires a non-empty eventName, got "${t}". Ignoring event.`),!1;if(!X(t,"log custom event","the event name"))return!1;const[n,i]=W(o,"logCustomEvent","eventProperties",`log custom event "${t}"`,"event");if(!n)return!1;if(e.ir().ge(t))return r.D.info(`Custom Event "${t}" is blocklisted, ignoring.`),!1;const m=s.G(r.A.CustomEvent,{n:t,p:i});if(m.S){r.D.info(`Logged custom event "${t}".`);for(const e of m.ve)V.er().je(Q.be,[t,o],e)}return m.S}
1
+ import e from"../managers/braze-instance.js";import s from"../common/event-logger.js";import r from"../../shared-lib/braze-shared-lib.js";import V from"../triggers/models/trigger-events.js";import{TriggersProviderFactory as W}from"../triggers/triggers-provider-factory.js";import{validateCustomProperties as X,validateCustomString as Y}from"../util/validation-utils.js";export function logCustomEvent(t,o){if(!e.rr())return!1;if(null==t||t.length<=0)return r.D.error(`logCustomEvent requires a non-empty eventName, got "${t}". Ignoring event.`),!1;if(!Y(t,"log custom event","the event name"))return!1;const[n,i]=X(o,"logCustomEvent","eventProperties",`log custom event "${t}"`,"event");if(!n)return!1;if(e.ir().ge(t))return r.D.info(`Custom Event "${t}" is blocklisted, ignoring.`),!1;const m=s.G(r.A.CustomEvent,{n:t,p:i});if(m.S){r.D.info(`Logged custom event "${t}".`);for(const e of m.ve)W.er().je(V.be,[t,o],e)}return m.S}
@@ -1 +1 @@
1
- import e from"../managers/braze-instance.js";import{MAX_PURCHASE_QUANTITY as Z}from"../common/constants.js";import r from"../../shared-lib/braze-shared-lib.js";import Q from"../triggers/models/trigger-events.js";import{TriggersProviderFactory as V}from"../triggers/triggers-provider-factory.js";import{validateCustomProperties as W,validateCustomString as X}from"../util/validation-utils.js";import s from"../common/event-logger.js";export function logPurchase(o,i,t,n,D){if(!e.rr())return!1;if(null==t&&(t="USD"),null==n&&(n=1),null==o||o.length<=0)return r.D.error(`logPurchase requires a non-empty productId, got "${o}", ignoring.`),!1;if(!X(o,"log purchase","the purchase name"))return!1;let a=parseFloat(i);if(isNaN(a))return r.D.error(`logPurchase requires a numeric price, got ${i}, ignoring.`),!1;a=a.toFixed(2);const g=parseInt(n);if(isNaN(g))return r.D.error(`logPurchase requires an integer quantity, got ${n}, ignoring.`),!1;if(g<1||g>Z)return r.D.error(`logPurchase requires a quantity >1 and <${Z}, got ${g}, ignoring.`),!1;t=t.toUpperCase();if(-1===["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BRL","BSD","BTC","BTN","BWP","BYR","BZD","CAD","CDF","CHF","CLF","CLP","CNY","COP","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EEK","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GGP","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","IMP","INR","IQD","IRR","ISK","JEP","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MTL","MUR","MVR","MWK","MXN","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","UYU","UZS","VEF","VND","VUV","WST","XAF","XAG","XAU","XCD","XDR","XOF","XPD","XPF","XPT","YER","ZAR","ZMK","ZMW","ZWL"].indexOf(t))return r.D.error(`logPurchase requires a valid currencyCode, got ${t}, ignoring.`),!1;const[u,P]=W(D,"logPurchase","purchaseProperties",`log purchase "${o}"`,"purchase");if(!u)return!1;if(e.ir().Dr(o))return r.D.info(`Purchase "${o}" is blocklisted, ignoring.`),!1;const R=s.G(r.A.Pr,{pid:o,c:t,p:a,q:g,pr:P});if(R.S){r.D.info(`Logged ${g} purchase${g>1?"s":""} of "${o}" for ${t} ${a}.`);for(const r of R.ve)V.er().je(Q.Rr,[o,D],r)}return R.S}
1
+ import e from"../managers/braze-instance.js";import{MAX_PURCHASE_QUANTITY as Z}from"../common/constants.js";import r from"../../shared-lib/braze-shared-lib.js";import V from"../triggers/models/trigger-events.js";import{TriggersProviderFactory as W}from"../triggers/triggers-provider-factory.js";import{validateCustomProperties as X,validateCustomString as Y}from"../util/validation-utils.js";import s from"../common/event-logger.js";export function logPurchase(o,i,t,n,D){if(!e.rr())return!1;if(null==t&&(t="USD"),null==n&&(n=1),null==o||o.length<=0)return r.D.error(`logPurchase requires a non-empty productId, got "${o}", ignoring.`),!1;if(!Y(o,"log purchase","the purchase name"))return!1;let a=parseFloat(i);if(isNaN(a))return r.D.error(`logPurchase requires a numeric price, got ${i}, ignoring.`),!1;a=a.toFixed(2);const g=parseInt(n);if(isNaN(g))return r.D.error(`logPurchase requires an integer quantity, got ${n}, ignoring.`),!1;if(g<1||g>Z)return r.D.error(`logPurchase requires a quantity >1 and <${Z}, got ${g}, ignoring.`),!1;t=t.toUpperCase();if(-1===["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BRL","BSD","BTC","BTN","BWP","BYR","BZD","CAD","CDF","CHF","CLF","CLP","CNY","COP","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EEK","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GGP","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","IMP","INR","IQD","IRR","ISK","JEP","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MTL","MUR","MVR","MWK","MXN","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","STD","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","UYU","UZS","VEF","VND","VUV","WST","XAF","XAG","XAU","XCD","XDR","XOF","XPD","XPF","XPT","YER","ZAR","ZMK","ZMW","ZWL"].indexOf(t))return r.D.error(`logPurchase requires a valid currencyCode, got ${t}, ignoring.`),!1;const[u,P]=X(D,"logPurchase","purchaseProperties",`log purchase "${o}"`,"purchase");if(!u)return!1;if(e.ir().Dr(o))return r.D.info(`Purchase "${o}" is blocklisted, ignoring.`),!1;const R=s.G(r.A.Pr,{pid:o,c:t,p:a,q:g,pr:P});if(R.S){r.D.info(`Logged ${g} purchase${g>1?"s":""} of "${o}" for ${t} ${a}.`);for(const r of R.ve)W.er().je(V.Rr,[o,D],r)}return R.S}
@@ -1 +1 @@
1
- import e from"../managers/braze-instance.js";import r from"../../shared-lib/braze-shared-lib.js";import Q from"../triggers/models/trigger-events.js";import{TriggersProviderFactory as V}from"../triggers/triggers-provider-factory.js";export function openSession(){if(!e.rr())return;e.mr().openSession();const i=r.Ft.xt,o=new r.qt(i,r.D);o.hr(i.Pt.jr,(function(t,n){const s=n.lastClick,c=n.trackingString;r.D.info(`Firing push click trigger from ${c} push click at ${s}`);const g=e.mr().kr(s,c),f=function(){V.er().je(Q.vr,[c],g)};e.mr().zr(f,f),o.br(i.Pt.jr,t)})),o.Jt(i.Pt.$r,(function(r){e.mr().wr(r)}))}
1
+ import e from"../managers/braze-instance.js";import r from"../../shared-lib/braze-shared-lib.js";import V from"../triggers/models/trigger-events.js";import{TriggersProviderFactory as W}from"../triggers/triggers-provider-factory.js";export function openSession(){if(!e.rr())return;e.mr().openSession();const i=r.xt.Ft,o=new r.qt(i,r.D);o.hr(i.$t.jr,(function(t,n){const s=n.lastClick,c=n.trackingString;r.D.info(`Firing push click trigger from ${c} push click at ${s}`);const g=e.mr().kr(s,c),f=function(){W.er().je(V.vr,[c],g)};e.mr().zr(f,f),o.br(i.$t.jr,t)})),o.Jt(i.$t.$r,(function(r){e.mr().wr(r)}))}
@@ -1 +1 @@
1
- import e from"../managers/braze-instance.js";import{validateStandardString as R}from"../util/validation-utils.js";export function setSdkAuthenticationSignature(t){return!!e.rr()&&(!(""===t||!R(t,"set signature","signature",!1))&&(e.ti().setSdkAuthenticationSignature(t),!0))}
1
+ import e from"../managers/braze-instance.js";import{validateStandardString as R}from"../util/validation-utils.js";export function setSdkAuthenticationSignature(t){return!!e.rr()&&(!(""===t||!R(t,"set signature","signature",!1))&&(e.ii().setSdkAuthenticationSignature(t),!0))}
@@ -1 +1 @@
1
- import e from"../managers/braze-instance.js";export function subscribeToSdkAuthenticationFailures(r){if(e.rr())return e.ti().subscribeToSdkAuthenticationFailures(r)}
1
+ import e from"../managers/braze-instance.js";export function subscribeToSdkAuthenticationFailures(r){if(e.rr())return e.ii().subscribeToSdkAuthenticationFailures(r)}
@@ -1 +1 @@
1
- import e from"../managers/braze-instance.js";import{keys as Y}from"../util/code-utils.js";import r from"../../shared-lib/braze-shared-lib.js";export function wipeData(){if(null==e.l())throw new Error("Braze must be initialized before calling methods.");e.l().clearData();const o=Y(r.Ft);for(let e=0;e<o.length;e++){const i=o[e],t=r.Ft[i];new r.qt(t,r.D).clearData()}if(e.rr())for(const r of e.re())r.clearData(!0)}
1
+ import e from"../managers/braze-instance.js";import{keys as rr}from"../util/code-utils.js";import r from"../../shared-lib/braze-shared-lib.js";export function wipeData(){if(null==e.l())throw new Error("Braze must be initialized before calling methods.");e.l().clearData();const o=rr(r.xt);for(let e=0;e<o.length;e++){const i=o[e],t=r.xt[i];new r.qt(t,r.D).clearData()}if(e.rr())for(const r of e.re())r.clearData(!0)}
@@ -1 +1 @@
1
- import C from"../common/base-provider.js";import e from"../managers/braze-instance.js";import Feed from"./feed.js";import{newCardFromFeedJson as tt,newCardFromSerializedValue as _}from"../Card/util/card-factory.js";import{rehydrateDateAfterJsonization as w}from"../util/date-utils.js";import{STORAGE_KEYS as o}from"../managers/storage-manager.js";import u from"../managers/subscription-manager.js";export default class ee extends C{constructor(t,s){super(),this.h=t,this.Is=s,this.vt=new u,e.Ut(this.vt),this.zt()}zt(){const t=this.h.I(o.q.Ks)||[],s=[];for(let i=0;i<t.length;i++){const e=_(t[i]);null!=e&&s.push(e)}this.Xt=s,this.Os=w(this.h.I(o.q.Qs))}Vs(t){const s=[];let i=null;const e=this.h.I(o.q.P)||{},r={};for(let h=0;h<t.length;h++){i=t[h];const o=tt(i);null!=o&&(e[o.id]&&(o.viewed=!0,r[o.id]=!0),s.push(o))}this.h.B(o.q.P,r),this.Xt=s,this.Ss(),this.Os=new Date,this.h.B(o.q.Qs,this.Os)}Ss(){const t=[];for(let s=0;s<this.Xt.length;s++)t.push(this.Xt[s].ss());this.h.B(o.q.Ks,t)}_s(t){null!=t&&t.feed&&(this.zt(),this.Vs(t.feed),this.vt.Nt(new Feed(this.Xt.slice(),this.Os)))}Ws(){this.zt();const t=[],s=new Date;for(let i=0;i<this.Xt.length;i++)(null==this.Xt[i].expiresAt||this.Xt[i].expiresAt>=s)&&t.push(this.Xt[i]);return new Feed(t,this.Os)}Ts(){this.Is.requestFeedRefresh()}Ps(t){return this.vt.Et(t)}clearData(t){null==t&&(t=!1),this.Xt=[],this.Os=null,t&&(this.h.$s(o.q.Ks),this.h.$s(o.q.Qs)),this.vt.Nt(new Feed(this.Xt.slice(),this.Os))}}
1
+ import y from"../common/base-provider.js";import e from"../managers/braze-instance.js";import Feed from"./feed.js";import{newCardFromFeedJson as tt,newCardFromSerializedValue as S}from"../Card/util/card-factory.js";import{rehydrateDateAfterJsonization as w}from"../util/date-utils.js";import{STORAGE_KEYS as o}from"../managers/storage-manager.js";import u from"../managers/subscription-manager.js";export default class ee extends y{constructor(t,s){super(),this.h=t,this.si=s,this.yt=new u,e.jt(this.yt),this.zt()}zt(){const t=this.h.I(o.q.ei)||[],s=[];for(let i=0;i<t.length;i++){const e=S(t[i]);null!=e&&s.push(e)}this.Zt=s,this.ri=w(this.h.I(o.q.hi))}oi(t){const s=[];let i=null;const e=this.h.I(o.q.P)||{},r={};for(let h=0;h<t.length;h++){i=t[h];const o=tt(i);null!=o&&(e[o.id]&&(o.viewed=!0,r[o.id]=!0),s.push(o))}this.h.B(o.q.P,r),this.Zt=s,this.Ss(),this.ri=new Date,this.h.B(o.q.hi,this.ri)}Ss(){const t=[];for(let s=0;s<this.Zt.length;s++)t.push(this.Zt[s].ss());this.h.B(o.q.ei,t)}Rs(t){null!=t&&t.feed&&(this.zt(),this.oi(t.feed),this.yt.St(new Feed(this.Zt.slice(),this.ri)))}ai(){this.zt();const t=[],s=new Date;for(let i=0;i<this.Zt.length;i++)(null==this.Zt[i].expiresAt||this.Zt[i].expiresAt>=s)&&t.push(this.Zt[i]);return new Feed(t,this.ri)}Is(){this.si.requestFeedRefresh()}Ws(t){return this.yt.ut(t)}clearData(t){null==t&&(t=!1),this.Zt=[],this.ri=null,t&&(this.h.Xs(o.q.ei),this.h.Xs(o.q.hi)),this.yt.St(new Feed(this.Zt.slice(),this.ri))}}
@@ -1 +1 @@
1
- import e from"../managers/braze-instance.js";import re from"./feed-provider-factory.js";export function getCachedFeed(){if(e.rr())return re.er().Ws()}
1
+ import e from"../managers/braze-instance.js";import re from"./feed-provider-factory.js";export function getCachedFeed(){if(e.rr())return re.er().ai()}
@@ -1 +1 @@
1
- import e from"../managers/braze-instance.js";import re from"./feed-provider-factory.js";export function requestFeedRefresh(){if(e.rr())return re.er().Ts()}
1
+ import e from"../managers/braze-instance.js";import re from"./feed-provider-factory.js";export function requestFeedRefresh(){if(e.rr())return re.er().Is()}
@@ -1 +1 @@
1
- import e from"../managers/braze-instance.js";import re from"./feed-provider-factory.js";export function subscribeToFeedUpdates(r){if(e.rr())return re.er().Ps(r)}
1
+ import e from"../managers/braze-instance.js";import re from"./feed-provider-factory.js";export function subscribeToFeedUpdates(r){if(e.rr())return re.er().Ws(r)}
@@ -1 +1 @@
1
- import e,{OPTIONS as D}from"../../managers/braze-instance.js";import{destroyFeedHtml as z,detectFeedImpressions as T,feedToHtml as N,LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE as q,refreshFeed as I,registerFeedSubscriptionId as L,updateFeedCards as M}from"../../common/feed-display.js";import{Feed,logFeedDisplayed,subscribeToFeedUpdates}from"../index.js";import re from"../feed-provider-factory.js";import{intersection as te}from"../../util/code-utils.js";import{setCardHeight as $}from"../../Card/display/card-display.js";import{setupFeedUI as k}from"../../ui/js/index.js";import r from"../../../shared-lib/braze-shared-lib.js";export function showFeed(t,n,o){if(!e.rr())return;k();const s=(e,t)=>{if(null==t)return e;const n=[];for(let e=0;e<t.length;e++)n.push(t[e].toLowerCase());const o=[];for(let t=0;t<e.length;t++){const r=[];for(let n=0;n<e[t].categories.length;n++)r.push(e[t].categories[n].toLowerCase());te(r,n).length>0&&o.push(e[t])}return o},i=e.nn(D.tn)||e.nn(D.en)||!1;let l=!1;null==t&&(t=document.body,l=!0);let a=!1,f=null;null==n?(f=re.er().Ws(),M(f,s(f.cards,o),f.lastUpdated,null,i),a=!0):f=new Feed(s(n,o),new Date);const u=N(f,i);if(a){(null==f.lastUpdated||(new Date).valueOf()-f.lastUpdated.valueOf()>Feed.ur)&&(r.D.info(`Cached feed was older than max TTL of ${Feed.ur} ms, requesting an update from the server.`),I(f,u));const e=(new Date).valueOf(),t=subscribeToFeedUpdates((function(t){const n=u.querySelectorAll(".ab-refresh-button")[0];if(null!=n){let t=500;const o=parseInt(u.getAttribute(q));isNaN(o)?t-=(new Date).valueOf()-e:t-=(new Date).valueOf()-o,setTimeout((function(){n.className=n.className.replace(/fa-spin/g,"")}),Math.max(t,0))}M(f,s(t.cards,o),t.lastUpdated,u,i)}));L(t,u)}const m=e=>{const t=e.querySelectorAll(".ab-feed");let n=null;for(let o=0;o<t.length;o++)t[o].parentNode===e&&(n=t[o]);null!=n?(z(n),n.parentNode.replaceChild(u,n)):e.appendChild(u),setTimeout((function(){u.className=u.className.replace("ab-hide","ab-show")}),0),l&&u.focus(),logFeedDisplayed(),T(f,u),$(f.cards,e)};var c;null!=t?m(t):window.onload=(c=window.onload,function(){"function"==typeof c&&c(),m(document.body)})}
1
+ import e,{OPTIONS as T}from"../../managers/braze-instance.js";import{destroyFeedHtml as z,detectFeedImpressions as q,feedToHtml as I,LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE as L,refreshFeed as M,registerFeedSubscriptionId as $,updateFeedCards as k}from"../../common/feed-display.js";import{Feed,logFeedDisplayed,subscribeToFeedUpdates}from"../index.js";import re from"../feed-provider-factory.js";import{intersection as te}from"../../util/code-utils.js";import{setCardHeight as A}from"../../Card/display/card-display.js";import{setupFeedUI as B}from"../../ui/js/index.js";import r from"../../../shared-lib/braze-shared-lib.js";export function showFeed(t,n,o){if(!e.rr())return;B();const s=(e,t)=>{if(null==t)return e;const n=[];for(let e=0;e<t.length;e++)n.push(t[e].toLowerCase());const o=[];for(let t=0;t<e.length;t++){const r=[];for(let n=0;n<e[t].categories.length;n++)r.push(e[t].categories[n].toLowerCase());te(r,n).length>0&&o.push(e[t])}return o},i=e.nn(T.tn)||e.nn(T.en)||!1;let l=!1;null==t&&(t=document.body,l=!0);let a=!1,f=null;null==n?(f=re.er().ai(),k(f,s(f.cards,o),f.lastUpdated,null,i),a=!0):f=new Feed(s(n,o),new Date);const u=I(f,i);if(a){(null==f.lastUpdated||(new Date).valueOf()-f.lastUpdated.valueOf()>Feed.ur)&&(r.D.info(`Cached feed was older than max TTL of ${Feed.ur} ms, requesting an update from the server.`),M(f,u));const e=(new Date).valueOf(),t=subscribeToFeedUpdates((function(t){const n=u.querySelectorAll(".ab-refresh-button")[0];if(null!=n){let t=500;const o=parseInt(u.getAttribute(L));isNaN(o)?t-=(new Date).valueOf()-e:t-=(new Date).valueOf()-o,setTimeout((function(){n.className=n.className.replace(/fa-spin/g,"")}),Math.max(t,0))}k(f,s(t.cards,o),t.lastUpdated,u,i)}));$(t,u)}const m=e=>{const t=e.querySelectorAll(".ab-feed");let n=null;for(let o=0;o<t.length;o++)t[o].parentNode===e&&(n=t[o]);null!=n?(z(n),n.parentNode.replaceChild(u,n)):e.appendChild(u),setTimeout((function(){u.className=u.className.replace("ab-hide","ab-show")}),0),l&&u.focus(),logFeedDisplayed(),q(f,u),A(f.cards,e)};var c;null!=t?m(t):window.onload=(c=window.onload,function(){"function"==typeof c&&c(),m(document.body)})}
@@ -1 +1 @@
1
- import{attachInAppMessageCSS as nt}from"../../ui/js/iam-css.js";import et from"../../util/browser-detector.js";import{logInAppMessageHtmlClick}from"../log-in-app-message-html-click.js";import{getUser as H}from"../../Core/get-user.js";import{InAppMessage}from"../index.js";import{keys as Y}from"../../util/code-utils.js";import{OperatingSystems as ot}from"../../util/device-constants.js";import{parseQueryStringKeyValues as st}from"../../util/url-utils.js";import{WindowUtils as G}from"../../util/window-utils.js";export default function rt(t,n,e,o,s,r){const i=document.createElement("iframe");i.setAttribute("title","Modal Message"),s&&(i.style.zIndex=s+1);const u=n=>{const e=n.getAttribute("href"),s=n.onclick;return r=>{if(null!=s&&"function"==typeof s&&!1===s())return;let u=st(e).abButtonId;if(null!=u&&""!==u||(u=n.getAttribute("id")),null!=e&&""!==e&&0!==e.indexOf("#")){const s="blank"===(n.getAttribute("target")||"").toLowerCase().replace("_",""),c=o||t.openTarget===InAppMessage.OpenTarget.BLANK||s,a=()=>{logInAppMessageHtmlClick(t,u,e),G.openUri(e,c,r)};c?a():t.on(i,a)}else logInAppMessageHtmlClick(t,u,e);return r.stopPropagation(),!1}},c=(t,n,e)=>{const o=`([\\w]+)\\s*=\\s*document.createElement\\(['"]${e}['"]\\)`,s=t.match(new RegExp(o));if(s){const e=`${s[1]}.setAttribute("nonce", "${n}")`;return`${t.slice(0,s.index+s[0].length)};${e};${t.slice(s.index+s[0].length)}`}return null};if(i.onload=()=>{let o=null;if(null!=r){o=document.createElement("html"),o.innerHTML=t.message;const n=o.getElementsByTagName("style");for(let t=0;t<n.length;t++)n[t].setAttribute("nonce",r);const e=o.getElementsByTagName("script");for(let t=0;t<e.length;t++){e[t].setAttribute("nonce",r),e[t].innerHTML=e[t].innerHTML.replace(/<style>/g,`<style nonce='${r}'>`);const n=c(e[t].innerHTML,r,"script");n&&(e[t].innerHTML=n);const o=c(e[t].innerHTML,r,"style");o&&(e[t].innerHTML=o)}}i.contentWindow.focus(),i.contentWindow.document.write(o?o.innerHTML:t.message);const s=i.contentWindow.document.getElementsByTagName("head")[0];if(null!=s){if(nt(s),t.sn()){const n=document.createElement("style");n.innerHTML=t.css,n.id=t.rn(),null!=r&&n.setAttribute("nonce",r),s.appendChild(n)}const n=i.contentWindow.document.createElement("base");n.setAttribute("target","_parent"),s.appendChild(n)}const a=i.contentWindow.document.getElementsByTagName("title");a.length>0&&i.setAttribute("title",a[0].textContent);const l={closeMessage:function(){t.on(i)},logClick:function(){const n=[t,...arguments];logInAppMessageHtmlClick.apply(t,Array.prototype.slice.call(n))},display:{},web:{}},requestPushPermission=function(){return function(){const t=arguments;import("../../Push/request-push-permission.js").then((n=>{n.requestPushPermission.apply(null,Array.prototype.slice.call(t))}))}},m={requestImmediateDataFlush:async function(){const t=arguments,n=await import("../../Core/request-immediate-data-flush.js");n.requestImmediateDataFlush.apply(null,Array.prototype.slice.call(t))},logCustomEvent:async function(){const t=arguments,n=await import("../../Core/log-custom-event.js");n.logCustomEvent.apply(null,Array.prototype.slice.call(t))},logPurchase:async function(){const t=arguments,n=await import("../../Core/log-purchase.js");n.logPurchase.apply(null,Array.prototype.slice.call(t))},unregisterPush:async function(){const t=arguments,n=await import("../../Push/unregister-push.js");n.unregisterPush.apply(null,Array.prototype.slice.call(t))},requestPushPermission:requestPushPermission()},f=function(t){return function(){m[t].apply(null,Array.prototype.slice.call(arguments))}};for(const t of Y(m))l[t]=f(t);const p=["setFirstName","setLastName","setEmail","setGender","setDateOfBirth","setCountry","setHomeCity","setEmailNotificationSubscriptionType","setLanguage","addAlias","setPushNotificationSubscriptionType","setPhoneNumber","setCustomUserAttribute","addToCustomAttributeArray","removeFromCustomAttributeArray","incrementCustomUserAttribute","setCustomLocationAttribute","addToSubscriptionGroup","removeFromSubscriptionGroup"],d=function(t){return function(){const n=H();n[t].apply(n,Array.prototype.slice.call(arguments))}},y={};for(let t=0;t<p.length;t++)y[p[t]]=d(p[t]);l.getUser=function(){return y};const b={showFeed:n},g=function(n){return function(){const e=arguments;t.on(i,(function(){b[n].apply(null,Array.prototype.slice.call(e))}))}};for(const t of Y(b))l.display[t]=g(t);const h={registerAppboyPushMessages:requestPushPermission()},A=function(t){return function(){h[t].apply(null,Array.prototype.slice.call(arguments))}};for(const t of Y(h))l.web[t]=A(t);if(i.contentWindow.appboyBridge=l,i.contentWindow.brazeBridge=l,t.un!==InAppMessage.es.cn){const t=i.contentWindow.document.getElementsByTagName("a");for(let n=0;n<t.length;n++)t[n].onclick=u(t[n]);const n=i.contentWindow.document.getElementsByTagName("button");for(let t=0;t<n.length;t++)n[t].onclick=u(n[t])}const j=i.contentWindow.document.body;if(null!=j){t.an()&&(j.id=t.htmlId);const n=document.createElement("hidden");n.onclick=l.closeMessage,n.className="ab-programmatic-close-button",j.appendChild(n)}i.contentWindow.dispatchEvent(new CustomEvent("ab.BridgeReady")),-1!==i.className.indexOf("ab-start-hidden")&&(i.className=i.className.replace("ab-start-hidden",""),e(i)),document.activeElement!==i&&i.focus()},i.className="ab-in-app-message ab-start-hidden ab-html-message ab-modal-interactions",et.OS===ot.ln){const n=document.createElement("div");return n.className="ab-ios-scroll-wrapper",n.appendChild(i),t.mn=n,n}return t.mn=i,i}
1
+ import{attachInAppMessageCSS as nt}from"../../ui/js/iam-css.js";import et from"../../util/browser-detector.js";import{logInAppMessageHtmlClick}from"../log-in-app-message-html-click.js";import{getUser as Q}from"../../Core/get-user.js";import{InAppMessage}from"../index.js";import{keys as rr}from"../../util/code-utils.js";import{OperatingSystems as ot}from"../../util/device-constants.js";import{parseQueryStringKeyValues as st}from"../../util/url-utils.js";import{WindowUtils as H}from"../../util/window-utils.js";export default function rt(t,n,e,o,s,r){const i=document.createElement("iframe");i.setAttribute("title","Modal Message"),s&&(i.style.zIndex=s+1);const u=n=>{const e=n.getAttribute("href"),s=n.onclick;return r=>{if(null!=s&&"function"==typeof s&&!1===s())return;let u=st(e).abButtonId;if(null!=u&&""!==u||(u=n.getAttribute("id")),null!=e&&""!==e&&0!==e.indexOf("#")){const s="blank"===(n.getAttribute("target")||"").toLowerCase().replace("_",""),c=o||t.openTarget===InAppMessage.OpenTarget.BLANK||s,a=()=>{logInAppMessageHtmlClick(t,u,e),H.openUri(e,c,r)};c?a():t.on(i,a)}else logInAppMessageHtmlClick(t,u,e);return r.stopPropagation(),!1}},c=(t,n,e)=>{const o=`([\\w]+)\\s*=\\s*document.createElement\\(['"]${e}['"]\\)`,s=t.match(new RegExp(o));if(s){const e=`${s[1]}.setAttribute("nonce", "${n}")`;return`${t.slice(0,s.index+s[0].length)};${e};${t.slice(s.index+s[0].length)}`}return null};if(i.onload=()=>{let o=null;if(null!=r){o=document.createElement("html"),o.innerHTML=t.message;const n=o.getElementsByTagName("style");for(let t=0;t<n.length;t++)n[t].setAttribute("nonce",r);const e=o.getElementsByTagName("script");for(let t=0;t<e.length;t++){e[t].setAttribute("nonce",r),e[t].innerHTML=e[t].innerHTML.replace(/<style>/g,`<style nonce='${r}'>`);const n=c(e[t].innerHTML,r,"script");n&&(e[t].innerHTML=n);const o=c(e[t].innerHTML,r,"style");o&&(e[t].innerHTML=o)}}i.contentWindow.focus(),i.contentWindow.document.write(o?o.innerHTML:t.message);const s=i.contentWindow.document.getElementsByTagName("head")[0];if(null!=s){if(nt(s),t.sn()){const n=document.createElement("style");n.innerHTML=t.css,n.id=t.rn(),null!=r&&n.setAttribute("nonce",r),s.appendChild(n)}const n=i.contentWindow.document.createElement("base");n.setAttribute("target","_parent"),s.appendChild(n)}const a=i.contentWindow.document.getElementsByTagName("title");a.length>0&&i.setAttribute("title",a[0].textContent);const l={closeMessage:function(){t.on(i)},logClick:function(){const n=[t,...arguments];logInAppMessageHtmlClick.apply(t,Array.prototype.slice.call(n))},display:{},web:{}},requestPushPermission=function(){return function(){const t=arguments;import("../../Push/request-push-permission.js").then((n=>{n.requestPushPermission.apply(null,Array.prototype.slice.call(t))}))}},m={requestImmediateDataFlush:async function(){const t=arguments,n=await import("../../Core/request-immediate-data-flush.js");n.requestImmediateDataFlush.apply(null,Array.prototype.slice.call(t))},logCustomEvent:async function(){const t=arguments,n=await import("../../Core/log-custom-event.js");n.logCustomEvent.apply(null,Array.prototype.slice.call(t))},logPurchase:async function(){const t=arguments,n=await import("../../Core/log-purchase.js");n.logPurchase.apply(null,Array.prototype.slice.call(t))},unregisterPush:async function(){const t=arguments,n=await import("../../Push/unregister-push.js");n.unregisterPush.apply(null,Array.prototype.slice.call(t))},requestPushPermission:requestPushPermission()},f=function(t){return function(){m[t].apply(null,Array.prototype.slice.call(arguments))}};for(const t of rr(m))l[t]=f(t);const p=["setFirstName","setLastName","setEmail","setGender","setDateOfBirth","setCountry","setHomeCity","setEmailNotificationSubscriptionType","setLanguage","addAlias","setPushNotificationSubscriptionType","setPhoneNumber","setCustomUserAttribute","addToCustomAttributeArray","removeFromCustomAttributeArray","incrementCustomUserAttribute","setCustomLocationAttribute","addToSubscriptionGroup","removeFromSubscriptionGroup"],d=function(t){return function(){const n=Q();n[t].apply(n,Array.prototype.slice.call(arguments))}},y={};for(let t=0;t<p.length;t++)y[p[t]]=d(p[t]);l.getUser=function(){return y};const b={showFeed:n},g=function(n){return function(){const e=arguments;t.on(i,(function(){b[n].apply(null,Array.prototype.slice.call(e))}))}};for(const t of rr(b))l.display[t]=g(t);const h={registerAppboyPushMessages:requestPushPermission()},A=function(t){return function(){h[t].apply(null,Array.prototype.slice.call(arguments))}};for(const t of rr(h))l.web[t]=A(t);if(i.contentWindow.appboyBridge=l,i.contentWindow.brazeBridge=l,t.un!==InAppMessage.es.cn){const t=i.contentWindow.document.getElementsByTagName("a");for(let n=0;n<t.length;n++)t[n].onclick=u(t[n]);const n=i.contentWindow.document.getElementsByTagName("button");for(let t=0;t<n.length;t++)n[t].onclick=u(n[t])}const j=i.contentWindow.document.body;if(null!=j){t.an()&&(j.id=t.htmlId);const n=document.createElement("hidden");n.onclick=l.closeMessage,n.className="ab-programmatic-close-button",j.appendChild(n)}i.contentWindow.dispatchEvent(new CustomEvent("ab.BridgeReady")),-1!==i.className.indexOf("ab-start-hidden")&&(i.className=i.className.replace("ab-start-hidden",""),e(i)),document.activeElement!==i&&i.focus()},i.className="ab-in-app-message ab-start-hidden ab-html-message ab-modal-interactions",et.OS===ot.ln){const n=document.createElement("div");return n.className="ab-ios-scroll-wrapper",n.appendChild(i),t.mn=n,n}return t.mn=i,i}
@@ -1 +1 @@
1
- import{addPassiveEventListener as oe,buildSvg as ae,detectSwipe as d,DIRECTIONS as c}from"../../util/dom-utils.js";import{createCloseButton as i}from"../../util/component-utils.js";import{isTransparent as ie,toRgba as ne}from"../../util/color-utils.js";import FullScreenMessage from"../models/full-screen-message.js";import HtmlMessage from"../models/html-message.js";import InAppMessage from"../models/in-app-message.js";import ModalMessage from"../models/modal-message.js";import SlideUpMessage from"../models/slide-up-message.js";import{logInAppMessageClick}from"../log-in-app-message-click.js";import{_handleBrazeAction as m}from"../../Core/handle-braze-action.js";import rt from"./html-message-to-html.js";import me from"./modal-utils.js";import r from"../../../shared-lib/braze-shared-lib.js";export default function ce(e,o,s,t,a,n){if(e.he=document.activeElement,e instanceof HtmlMessage)return rt(e,o,s,t,a,n);const l=function(e,o,s,t,a){const n=document.createElement("div");n.className="ab-in-app-message ab-start-hidden ab-background",a&&(n.style.zIndex=a+1),e.we()&&(n.className+=" ab-modal-interactions",n.setAttribute("tabindex","-1")),e.sn()||(n.style.color=ne(e.textColor),n.style.backgroundColor=ne(e.backgroundColor),ie(e.backgroundColor)&&(n.className+=" ab-no-shadow"));const c=()=>{-1!==n.className.indexOf("ab-start-hidden")&&(n.className=n.className.replace("ab-start-hidden",""),s(n))};e.imageStyle===InAppMessage.ImageStyle.GRAPHIC&&(n.className+=" graphic"),e.orientation===InAppMessage.Orientation.LANDSCAPE&&(n.className+=" landscape"),0===e.buttons.length&&(e.clickAction!==InAppMessage.ClickAction.NONE&&(n.className+=" ab-clickable"),n.onclick=s=>(e.on(n,(()=>{logInAppMessageClick(e),e.clickAction===InAppMessage.ClickAction.URI?m(e.uri,s,t||e.openTarget===InAppMessage.OpenTarget.BLANK):e.clickAction===InAppMessage.ClickAction.NEWS_FEED&&o()})),s.stopPropagation(),!1));const l=i("Close Message",e.sn()?void 0:ne(e.closeButtonColor),(()=>{e.on(n)}));n.appendChild(l),a&&(l.style.zIndex=a+2);const d=document.createElement("div");d.className="ab-message-text";const u=(e.messageAlignment||e.ke).toLowerCase();d.className+=" "+u+"-aligned";let b=!1;const f=document.createElement("div");if(f.className="ab-image-area",e.imageUrl){if(e.cropType===InAppMessage.CropType.CENTER_CROP){const o=document.createElement("span");o.className="ab-center-cropped-img",o.style.backgroundImage="url("+e.imageUrl+")",o.setAttribute("role","img"),o.setAttribute("aria-label","Modal Image"),e.xe(o),f.appendChild(o)}else{const o=document.createElement("img");o.setAttribute("src",e.imageUrl),e.xe(o),b=!0,o.onload=c,setTimeout(c,1e3),f.appendChild(o)}n.appendChild(f),d.className+=" ab-with-image"}else if(e.icon){f.className+=" ab-icon-area";const o=document.createElement("span");o.className="ab-icon",e.sn()||(o.style.backgroundColor=ne(e.iconBackgroundColor),o.style.color=ne(e.iconColor));const s=document.createElement("i");s.className="fa",s.appendChild(document.createTextNode(e.icon)),s.setAttribute("aria-hidden",!0),o.appendChild(s),f.appendChild(o),n.appendChild(f),d.className+=" ab-with-icon"}if(oe(d,"touchstart",(function(){})),e.header&&e.header.length>0){const o=document.createElement("h1");o.className="ab-message-header",e.ze=r.nt.et(),o.id=e.ze;const s=(e.headerAlignment||InAppMessage.TextAlignment.CENTER).toLowerCase();o.className+=" "+s+"-aligned",e.sn()||(o.style.color=ne(e.headerTextColor)),o.appendChild(document.createTextNode(e.header)),d.appendChild(o)}return d.appendChild(e.Me()),n.appendChild(d),b||c(),e.mn=n,n}(e,o,s,t,a);if(e instanceof FullScreenMessage||e instanceof ModalMessage){const s=e instanceof FullScreenMessage?"ab-fullscreen":"ab-modal";l.className+=` ${s} ab-centered`,me.Ce(e,o,l,t),me.Le(l),me.Ie(e.ze,l)}else if(e instanceof SlideUpMessage){l.className+=" ab-slideup";const o=l.getElementsByClassName("ab-close-button")[0];if(null!=o){const s=ae("0 0 11.38 19.44","M11.38 9.72l-9.33 9.72L0 17.3l7.27-7.58L0 2.14 2.05 0l9.33 9.72z",e.sn()?void 0:ne(e.closeButtonColor));s.setAttribute("class","ab-chevron"),o.appendChild(s)}let s,t;d(l,c.ot,(e=>{l.className+=" ab-swiped-left",o.onclick(e)})),d(l,c.at,(e=>{l.className+=" ab-swiped-right",o.onclick(e)})),e.slideFrom===InAppMessage.SlideFrom.TOP?(s=c.Te,t=" ab-swiped-up"):(s=c.$e,t=" ab-swiped-down"),d(l,s,(e=>{l.className+=t,o.onclick(e)}))}return l}
1
+ import{addPassiveEventListener as oe,buildSvg as ae,detectSwipe as d,DIRECTIONS as c}from"../../util/dom-utils.js";import{createCloseButton as i}from"../../util/component-utils.js";import{isTransparent as ie,toRgba as ne}from"../../util/color-utils.js";import FullScreenMessage from"../models/full-screen-message.js";import HtmlMessage from"../models/html-message.js";import InAppMessage from"../models/in-app-message.js";import ModalMessage from"../models/modal-message.js";import SlideUpMessage from"../models/slide-up-message.js";import{logInAppMessageClick}from"../log-in-app-message-click.js";import{_handleBrazeAction as m}from"../../Core/handle-braze-action.js";import rt from"./html-message-to-html.js";import me from"./modal-utils.js";import r from"../../../shared-lib/braze-shared-lib.js";export default function ce(e,o,s,t,a,n){if(e.he=document.activeElement,e instanceof HtmlMessage)return rt(e,o,s,t,a,n);const l=function(e,o,s,t,a){const n=document.createElement("div");n.className="ab-in-app-message ab-start-hidden ab-background",a&&(n.style.zIndex=a+1),e.we()&&(n.className+=" ab-modal-interactions",n.setAttribute("tabindex","-1")),e.sn()||(n.style.color=ne(e.textColor),n.style.backgroundColor=ne(e.backgroundColor),ie(e.backgroundColor)&&(n.className+=" ab-no-shadow"));const c=()=>{-1!==n.className.indexOf("ab-start-hidden")&&(n.className=n.className.replace("ab-start-hidden",""),s(n))};e.imageStyle===InAppMessage.ImageStyle.GRAPHIC&&(n.className+=" graphic"),e.orientation===InAppMessage.Orientation.LANDSCAPE&&(n.className+=" landscape"),0===e.buttons.length&&(e.clickAction!==InAppMessage.ClickAction.NONE&&(n.className+=" ab-clickable"),n.onclick=s=>(e.on(n,(()=>{logInAppMessageClick(e),e.clickAction===InAppMessage.ClickAction.URI?m(e.uri,s,t||e.openTarget===InAppMessage.OpenTarget.BLANK):e.clickAction===InAppMessage.ClickAction.NEWS_FEED&&o()})),s.stopPropagation(),!1));const l=i("Close Message",e.sn()?void 0:ne(e.closeButtonColor),(()=>{e.on(n)}));n.appendChild(l),a&&(l.style.zIndex=a+2);const d=document.createElement("div");d.className="ab-message-text";const u=(e.messageAlignment||e.ke).toLowerCase();d.className+=" "+u+"-aligned";let b=!1;const f=document.createElement("div");if(f.className="ab-image-area",e.imageUrl){if(e.cropType===InAppMessage.CropType.CENTER_CROP){const o=document.createElement("span");o.className="ab-center-cropped-img",o.style.backgroundImage="url("+e.imageUrl+")",o.setAttribute("role","img"),o.setAttribute("aria-label","Modal Image"),e.xe(o),f.appendChild(o)}else{const o=document.createElement("img");o.setAttribute("src",e.imageUrl),e.xe(o),b=!0,o.onload=c,setTimeout(c,1e3),f.appendChild(o)}n.appendChild(f),d.className+=" ab-with-image"}else if(e.icon){f.className+=" ab-icon-area";const o=document.createElement("span");o.className="ab-icon",e.sn()||(o.style.backgroundColor=ne(e.iconBackgroundColor),o.style.color=ne(e.iconColor));const s=document.createElement("i");s.className="fa",s.appendChild(document.createTextNode(e.icon)),s.setAttribute("aria-hidden",!0),o.appendChild(s),f.appendChild(o),n.appendChild(f),d.className+=" ab-with-icon"}if(oe(d,"touchstart",(function(){})),e.header&&e.header.length>0){const o=document.createElement("h1");o.className="ab-message-header",e.ze=r.it.nt(),o.id=e.ze;const s=(e.headerAlignment||InAppMessage.TextAlignment.CENTER).toLowerCase();o.className+=" "+s+"-aligned",e.sn()||(o.style.color=ne(e.headerTextColor)),o.appendChild(document.createTextNode(e.header)),d.appendChild(o)}return d.appendChild(e.Me()),n.appendChild(d),b||c(),e.mn=n,n}(e,o,s,t,a);if(e instanceof FullScreenMessage||e instanceof ModalMessage){const s=e instanceof FullScreenMessage?"ab-fullscreen":"ab-modal";l.className+=` ${s} ab-centered`,me.Ce(e,o,l,t),me.Le(l),me.Ie(e.ze,l)}else if(e instanceof SlideUpMessage){l.className+=" ab-slideup";const o=l.getElementsByClassName("ab-close-button")[0];if(null!=o){const s=ae("0 0 11.38 19.44","M11.38 9.72l-9.33 9.72L0 17.3l7.27-7.58L0 2.14 2.05 0l9.33 9.72z",e.sn()?void 0:ne(e.closeButtonColor));s.setAttribute("class","ab-chevron"),o.appendChild(s)}let s,t;d(l,c.ot,(e=>{l.className+=" ab-swiped-left",o.onclick(e)})),d(l,c.et,(e=>{l.className+=" ab-swiped-right",o.onclick(e)})),e.slideFrom===InAppMessage.SlideFrom.TOP?(s=c.Te,t=" ab-swiped-up"):(s=c.$e,t=" ab-swiped-down"),d(l,s,(e=>{l.className+=t,o.onclick(e)}))}return l}
@@ -1 +1 @@
1
- import b from"../util/net.js";import e from"../managers/braze-instance.js";import ControlMessage from"./models/control-message.js";import HtmlMessage from"./models/html-message.js";import InAppMessage from"./models/in-app-message.js";import InAppMessageButton from"./models/in-app-message-button.js";import s from"../common/event-logger.js";import{newInAppMessageFromJson as it}from"./in-app-message-factory.js";import{randomInclusive as lt}from"../util/math.js";import t from"../models/request-result.js";import r from"../../shared-lib/braze-shared-lib.js";import u from"../managers/subscription-manager.js";import ut from"../triggers/models/trigger.js";import{validateValueIsFromEnum as K}from"../util/code-utils.js";import{BRAZE_ACTION_URI_REGEX as P}from"../util/validation-utils.js";import{containsPushPrimerBrazeAction as pt,containsUnknownBrazeAction as mt,getDecodedBrazeAction as O,ineligibleBrazeActionURLErrorMessage as ct,INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as gt}from"../util/braze-actions.js";export default class ge{constructor(t,s,i,r){this.jt=t,this.j=s,this.h=i,this.v=r,this.De=new u,e.Ut(this.De),this._e=1e3,this.Se=6e4}Be(){return this.De}Ee(t){return this.De.Et(t)}Fe(){return this.Ge}Ne(t){this.Ge=t}qe(e,i){if(!K(InAppMessage.Oe,i,`${i} is not a valid in-app message display failure`,"InAppMessage.DisplayFailures"))return new t;const n={trigger_ids:[e],error_code:i};return s.G(r.A.Pe,n)}G(e,i,n,o){const a=new t;let l;if(e instanceof ControlMessage)l={trigger_ids:[e.triggerId]};else{if(i===r.A.Re||e instanceof HtmlMessage&&i===r.A.He){if(!e.k(o))return r.D.info("This in-app message has already received a click. Ignoring analytics event."),a}else if(i===r.A.Je){if(!e.R())return r.D.info("This in-app message has already received an impression. Ignoring analytics event."),a}l=this.Ke(e)}return null==l?a:(null!=n&&(l.bid=n),s.G(i,l))}Qe(e,i){const n=new t;if(!e.k())return r.D.info("This in-app message button has already received a click. Ignoring analytics event."),n;const o=this.Ke(i);return null==o?n:e.id===InAppMessageButton.Ue?(r.D.info("This in-app message button does not have a tracking id. Not logging event to Braze servers."),n):(null!=e.id&&(o.bid=e.id),s.G(r.A.He,o))}async Ve(t){if(!(t instanceof InAppMessage))return;const e=async t=>{const e=O(t);return mt(e)?ct(gt.We,"In-App Message"):pt(e)?import("../Push/push-manager-factory.js").then((t=>{const e=t.default.Xe();if(null!=e&&!e.Ye())return ct(gt.Ze,"In-App Message")})):void 0},s=t.buttons;let i;for(const t of s)if(t.clickAction===InAppMessage.ClickAction.URI&&P.test(t.uri)&&(i=await e(t.uri),i))return i;return t.clickAction===InAppMessage.ClickAction.URI&&P.test(t.uri)?e(t.uri):void 0}Xs(t,e,s,i){let n=this.jt.Ys(!1,!1);n=this.jt.Ls(n),n.template={trigger_id:t.triggerId,trigger_event_type:e},null!=s&&(n.template.data=s.Zs());const o=this.jt.Ns(n);this.jt.As(n,(()=>{b.Fs({url:`${this.jt.Js()}/template/`,data:n,headers:o,S:async e=>{if(!this.jt.qs(n,e,o))return this.qe(t.triggerId,InAppMessage.Oe.ei),void("function"==typeof t.si&&t.si());if(this.jt.Es(),null==e||null==e.templated_message)return void this.qe(t.triggerId,InAppMessage.Oe.ei);const s=e.templated_message;if(s.type!==ut.ri.ii)return void this.qe(t.triggerId,InAppMessage.Oe.ni);const i=it(s.data);if(null==i)return void this.qe(t.triggerId,InAppMessage.Oe.ni);let a=await this.Ve(i);if(a)return r.D.error(a),void("function"==typeof t.si&&t.si());"function"==typeof t.oi?t.oi(i):this.qe(t.triggerId,InAppMessage.Oe.ei)},error:r=>{let n=`getting user personalization for message ${t.triggerId}`;if((new Date).valueOf()-t.ai>t.li)this.qe(t.triggerId,InAppMessage.Oe.ei);else{const r=Math.min(t.li,this.Se),o=this._e;null==i&&(i=o);const a=Math.min(r,lt(o,3*i));n+=`. Retrying in ${a} ms`,setTimeout((()=>{this.Xs(t,e,s,a)}),a)}this.jt.Ms(r,n)}})}))}Ke(t){if(null==t.triggerId)return r.D.info("The in-app message has no analytics id. Not logging event to Braze servers."),null;const e={};return null!=t.triggerId&&(e.trigger_ids=[t.triggerId]),e}}
1
+ import b from"../util/net.js";import e from"../managers/braze-instance.js";import ControlMessage from"./models/control-message.js";import HtmlMessage from"./models/html-message.js";import InAppMessage from"./models/in-app-message.js";import InAppMessageButton from"./models/in-app-message-button.js";import s from"../common/event-logger.js";import{newInAppMessageFromJson as it}from"./in-app-message-factory.js";import{randomInclusive as lt}from"../util/math.js";import t from"../models/request-result.js";import r from"../../shared-lib/braze-shared-lib.js";import u from"../managers/subscription-manager.js";import ut from"../triggers/models/trigger.js";import{validateValueIsFromEnum as F}from"../util/code-utils.js";import{BRAZE_ACTION_URI_REGEX as O}from"../util/validation-utils.js";import{containsPushPrimerBrazeAction as pt,containsUnknownBrazeAction as mt,getDecodedBrazeAction as J,ineligibleBrazeActionURLErrorMessage as gt,INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as ct}from"../util/braze-actions.js";import ht from"../Push/utils/push-utils.js";export default class ge{constructor(t,s,i,r){this.vt=t,this.j=s,this.h=i,this.v=r,this.De=new u,e.jt(this.De),this._e=1e3,this.Se=6e4}Be(){return this.De}Ee(t){return this.De.ut(t)}Fe(){return this.Ge}Ne(t){this.Ge=t}qe(e,i){if(!F(InAppMessage.Oe,i,`${i} is not a valid in-app message display failure`,"InAppMessage.DisplayFailures"))return new t;const n={trigger_ids:[e],error_code:i};return s.G(r.A.Pe,n)}G(e,i,n,o){const a=new t;let l;if(e instanceof ControlMessage)l={trigger_ids:[e.triggerId]};else{if(i===r.A.Re||e instanceof HtmlMessage&&i===r.A.He){if(!e.k(o))return r.D.info("This in-app message has already received a click. Ignoring analytics event."),a}else if(i===r.A.Je){if(!e.R())return r.D.info("This in-app message has already received an impression. Ignoring analytics event."),a}l=this.Ke(e)}return null==l?a:(null!=n&&(l.bid=n),s.G(i,l))}Qe(e,i){const n=new t;if(!e.k())return r.D.info("This in-app message button has already received a click. Ignoring analytics event."),n;const o=this.Ke(i);return null==o?n:e.id===InAppMessageButton.Ue?(r.D.info("This in-app message button does not have a tracking id. Not logging event to Braze servers."),n):(null!=e.id&&(o.bid=e.id),s.G(r.A.He,o))}Ve(t){if(!(t instanceof InAppMessage))return;const s=t=>{const s=J(t);return mt(s)?gt(ct.We,"In-App Message"):pt(s)&&!ht.Xe()?gt(ct.Ye,"In-App Message"):void 0},e=t.buttons;let i;for(const t of e)if(t.clickAction===InAppMessage.ClickAction.URI&&O.test(t.uri)&&(i=s(t.uri),i))return i;return t.clickAction===InAppMessage.ClickAction.URI&&O.test(t.uri)?s(t.uri):void 0}Ze(t,s,e,i){let n=this.vt.ni(!1,!1);n=this.vt.Ps(n),n.template={trigger_id:t.triggerId,trigger_event_type:s},null!=e&&(n.template.data=e.li());const o=this.vt.Bs(n);this.vt.Gs(n,(()=>{b.Hs({url:`${this.vt.Ks()}/template/`,data:n,headers:o,S:async s=>{if(!this.vt.Os(n,s,o))return this.qe(t.triggerId,InAppMessage.Oe.ui),void("function"==typeof t.pi&&t.pi());if(this.vt.Qs(),null==s||null==s.templated_message)return void this.qe(t.triggerId,InAppMessage.Oe.ui);const e=s.templated_message;if(e.type!==ut.gi.mi)return void this.qe(t.triggerId,InAppMessage.Oe.ci);const i=it(e.data);if(null==i)return void this.qe(t.triggerId,InAppMessage.Oe.ci);let a=this.Ve(i);if(a)return r.D.error(a),void("function"==typeof t.pi&&t.pi());"function"==typeof t.fi?t.fi(i):this.qe(t.triggerId,InAppMessage.Oe.ui)},error:r=>{let n=`getting user personalization for message ${t.triggerId}`;if((new Date).valueOf()-t.di>t.vi)this.qe(t.triggerId,InAppMessage.Oe.ui);else{const r=Math.min(t.vi,this.Se),o=this._e;null==i&&(i=o);const a=Math.min(r,lt(o,3*i));n+=`. Retrying in ${a} ms`,setTimeout((()=>{this.Ze(t,s,e,a)}),a)}this.vt.Vs(r,n)}})}))}Ke(t){if(null==t.triggerId)return r.D.info("The in-app message has no analytics id. Not logging event to Braze servers."),null;const s={};return null!=t.triggerId&&(s.trigger_ids=[t.triggerId]),s}}
@@ -1 +1 @@
1
- import e from"../managers/braze-instance.js";import{MUST_BE_IN_APP_MESSAGE_WARNING as rr}from"../common/constants.js";import InAppMessage from"./models/in-app-message.js";import InAppMessageButton from"./models/in-app-message-button.js";import pe from"./in-app-message-manager-factory.js";import r from"../../shared-lib/braze-shared-lib.js";import Q from"../triggers/models/trigger-events.js";import{TriggersProviderFactory as V}from"../triggers/triggers-provider-factory.js";export function logInAppMessageButtonClick(t,o){if(!e.rr())return!1;if(!(t instanceof InAppMessageButton))return r.D.error("button must be an InAppMessageButton object"),!1;if(!(o instanceof InAppMessage))return r.D.error(rr),!1;const s=pe.m().Qe(t,o);if(s.S)for(let r=0;r<s.ve.length;r++)V.er().je(Q.Ar,[o.triggerId,t.id],s.ve[r]);return s.S}
1
+ import e from"../managers/braze-instance.js";import{MUST_BE_IN_APP_MESSAGE_WARNING as tr}from"../common/constants.js";import InAppMessage from"./models/in-app-message.js";import InAppMessageButton from"./models/in-app-message-button.js";import pe from"./in-app-message-manager-factory.js";import r from"../../shared-lib/braze-shared-lib.js";import V from"../triggers/models/trigger-events.js";import{TriggersProviderFactory as W}from"../triggers/triggers-provider-factory.js";export function logInAppMessageButtonClick(t,o){if(!e.rr())return!1;if(!(t instanceof InAppMessageButton))return r.D.error("button must be an InAppMessageButton object"),!1;if(!(o instanceof InAppMessage))return r.D.error(tr),!1;const s=pe.m().Qe(t,o);if(s.S)for(let r=0;r<s.ve.length;r++)W.er().je(V.Ar,[o.triggerId,t.id],s.ve[r]);return s.S}
@@ -1 +1 @@
1
- import e from"../managers/braze-instance.js";import InAppMessage from"./models/in-app-message.js";import pe from"./in-app-message-manager-factory.js";import{MUST_BE_IN_APP_MESSAGE_WARNING as rr}from"../common/constants.js";import r from"../../shared-lib/braze-shared-lib.js";import Q from"../triggers/models/trigger-events.js";import{TriggersProviderFactory as V}from"../triggers/triggers-provider-factory.js";export function logInAppMessageClick(o){if(!e.rr())return!1;if(!(o instanceof InAppMessage))return r.D.error(rr),!1;const s=pe.m().G(o,r.A.Re);if(s)for(let r=0;r<s.ve.length;r++)V.er().je(Q.Ar,[o.triggerId],s.ve[r]);return s.S}
1
+ import e from"../managers/braze-instance.js";import InAppMessage from"./models/in-app-message.js";import pe from"./in-app-message-manager-factory.js";import{MUST_BE_IN_APP_MESSAGE_WARNING as tr}from"../common/constants.js";import r from"../../shared-lib/braze-shared-lib.js";import V from"../triggers/models/trigger-events.js";import{TriggersProviderFactory as W}from"../triggers/triggers-provider-factory.js";export function logInAppMessageClick(o){if(!e.rr())return!1;if(!(o instanceof InAppMessage))return r.D.error(tr),!1;const s=pe.m().G(o,r.A.Re);if(s)for(let r=0;r<s.ve.length;r++)W.er().je(V.Ar,[o.triggerId],s.ve[r]);return s.S}
@@ -1 +1 @@
1
- import e from"../managers/braze-instance.js";import HtmlMessage from"./models/html-message.js";import pe from"./in-app-message-manager-factory.js";import r from"../../shared-lib/braze-shared-lib.js";import Q from"../triggers/models/trigger-events.js";import{TriggersProviderFactory as V}from"../triggers/triggers-provider-factory.js";export function logInAppMessageHtmlClick(s,t,o){if(!e.rr())return!1;if(!(s instanceof HtmlMessage))return r.D.error("inAppMessage argument to logInAppMessageHtmlClick must be an HtmlMessage object."),!1;let m=r.A.Re;null!=t&&(m=r.A.He);const i=pe.m().G(s,m,t,o);if(i.S)for(let r=0;r<i.ve.length;r++)V.er().je(Q.Ar,[s.triggerId,t],i.ve[r]);return i.S}
1
+ import e from"../managers/braze-instance.js";import HtmlMessage from"./models/html-message.js";import pe from"./in-app-message-manager-factory.js";import r from"../../shared-lib/braze-shared-lib.js";import V from"../triggers/models/trigger-events.js";import{TriggersProviderFactory as W}from"../triggers/triggers-provider-factory.js";export function logInAppMessageHtmlClick(s,t,o){if(!e.rr())return!1;if(!(s instanceof HtmlMessage))return r.D.error("inAppMessage argument to logInAppMessageHtmlClick must be an HtmlMessage object."),!1;let m=r.A.Re;null!=t&&(m=r.A.He);const i=pe.m().G(s,m,t,o);if(i.S)for(let r=0;r<i.ve.length;r++)W.er().je(V.Ar,[s.triggerId,t],i.ve[r]);return i.S}
@@ -1 +1 @@
1
- import e from"../managers/braze-instance.js";import ControlMessage from"./models/control-message.js";import InAppMessage from"./models/in-app-message.js";import pe from"./in-app-message-manager-factory.js";import{MUST_BE_IN_APP_MESSAGE_WARNING as rr}from"../common/constants.js";import r from"../../shared-lib/braze-shared-lib.js";export function logInAppMessageImpression(o){if(!e.rr())return!1;if(!(o instanceof InAppMessage||o instanceof ControlMessage))return r.D.error(rr),!1;const s=o instanceof ControlMessage?r.A.ro:r.A.Je;return pe.m().G(o,s).S}
1
+ import e from"../managers/braze-instance.js";import ControlMessage from"./models/control-message.js";import InAppMessage from"./models/in-app-message.js";import pe from"./in-app-message-manager-factory.js";import{MUST_BE_IN_APP_MESSAGE_WARNING as tr}from"../common/constants.js";import r from"../../shared-lib/braze-shared-lib.js";export function logInAppMessageImpression(o){if(!e.rr())return!1;if(!(o instanceof InAppMessage||o instanceof ControlMessage))return r.D.error(tr),!1;const s=o instanceof ControlMessage?r.A.ro:r.A.Je;return pe.m().G(o,s).S}
@@ -1 +1 @@
1
- import InAppMessage from"./in-app-message.js";export default class HtmlMessage extends InAppMessage{constructor(l,e,n,u,s,a,t,i,r,o,m){u=u||InAppMessage.DismissType.MANUAL,null!=l&&l.length>0&&l.indexOf('"ab-in-app-message ab-html-message ab-email-capture"')>0&&l.indexOf('"ab-in-app-message ab-show ab-modal ab-effect-modal"')>0&&(a=!0,t=!0),super(l,null,null,e,n,null,null,null,u,s,null,null,null,null,null,null,null,null,a,t,null,null,null,i,void 0,void 0,void 0,r,o),this.messageFields=m}ll(){return!1}k(l){if(this.un===InAppMessage.es.el){if(this.nl)return!1;this.nl=!0}return this.lt.Nt(l),!0}}HtmlMessage.es=InAppMessage.es.el;
1
+ import InAppMessage from"./in-app-message.js";export default class HtmlMessage extends InAppMessage{constructor(l,e,n,u,s,a,t,i,r,o,m){u=u||InAppMessage.DismissType.MANUAL,null!=l&&l.length>0&&l.indexOf('"ab-in-app-message ab-html-message ab-email-capture"')>0&&l.indexOf('"ab-in-app-message ab-show ab-modal ab-effect-modal"')>0&&(a=!0,t=!0),super(l,null,null,e,n,null,null,null,u,s,null,null,null,null,null,null,null,null,a,t,null,null,null,i,void 0,void 0,void 0,r,o),this.messageFields=m}ll(){return!1}k(l){if(this.un===InAppMessage.es.el){if(this.nl)return!1;this.nl=!0}return this.lt.St(l),!0}}HtmlMessage.es=InAppMessage.es.el;
@@ -1 +1 @@
1
- import InAppMessage from"./in-app-message.js";import u from"../../managers/subscription-manager.js";export default class InAppMessageButton{constructor(s,t,i,r,e,h,n){this.text=s||"",this.backgroundColor=t||InAppMessage.ci.hi,this.textColor=i||InAppMessage.ci.mi,this.borderColor=r||this.backgroundColor,this.clickAction=e||InAppMessage.ClickAction.NONE,this.uri=h,null==n&&(n=InAppMessageButton.Ue),this.id=n,this.nl=!1,this.lt=new u}subscribeToClickedEvent(s){return this.lt.Et(s)}removeSubscription(s){this.lt.removeSubscription(s)}removeAllSubscriptions(){this.lt.removeAllSubscriptions()}k(){return!this.nl&&(this.nl=!0,this.lt.Nt(),!0)}static fromJson(s){return new InAppMessageButton(s.text,s.bg_color,s.text_color,s.border_color,s.click_action,s.uri,s.id)}}InAppMessageButton.Ue=-1;
1
+ import InAppMessage from"./in-app-message.js";import u from"../../managers/subscription-manager.js";export default class InAppMessageButton{constructor(s,t,i,r,e,h,n){this.text=s||"",this.backgroundColor=t||InAppMessage.ji.bi,this.textColor=i||InAppMessage.ji.ki,this.borderColor=r||this.backgroundColor,this.clickAction=e||InAppMessage.ClickAction.NONE,this.uri=h,null==n&&(n=InAppMessageButton.Ue),this.id=n,this.nl=!1,this.lt=new u}subscribeToClickedEvent(s){return this.lt.ut(s)}removeSubscription(s){this.lt.removeSubscription(s)}removeAllSubscriptions(){this.lt.removeAllSubscriptions()}k(){return!this.nl&&(this.nl=!0,this.lt.St(),!0)}static fromJson(s){return new InAppMessageButton(s.text,s.bg_color,s.text_color,s.border_color,s.click_action,s.uri,s.id)}}InAppMessageButton.Ue=-1;