@braze/web-sdk 4.10.0 → 4.10.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 (202) hide show
  1. package/index.d.ts +9 -9
  2. package/package.json +1 -1
  3. package/shared-lib/braze-shared-lib.js +1 -8
  4. package/shared-lib/encoding-utils.js +1 -12
  5. package/shared-lib/event-types.js +1 -34
  6. package/shared-lib/guid.js +1 -10
  7. package/shared-lib/indexed-db-adapter.js +1 -352
  8. package/shared-lib/logger.js +1 -38
  9. package/shared-lib/supported-options.js +1 -27
  10. package/shared-lib/types.js +1 -1
  11. package/src/Card/card-manager-factory.js +1 -14
  12. package/src/Card/card-manager.js +1 -78
  13. package/src/Card/display/card-display.js +1 -138
  14. package/src/Card/index.js +1 -6
  15. package/src/Card/log-card-click.js +1 -11
  16. package/src/Card/log-card-dismissal.js +1 -11
  17. package/src/Card/log-card-impressions.js +1 -13
  18. package/src/Card/log-content-card-click.js +1 -4
  19. package/src/Card/log-content-card-impressions.js +1 -4
  20. package/src/Card/models/banner.js +1 -31
  21. package/src/Card/models/captioned-image.js +1 -33
  22. package/src/Card/models/card.js +1 -196
  23. package/src/Card/models/classic-card.js +1 -32
  24. package/src/Card/models/control-card.js +1 -23
  25. package/src/Card/models/image-only.js +1 -32
  26. package/src/Card/models/index.js +1 -6
  27. package/src/Card/types.js +1 -1
  28. package/src/Card/util/card-factory.js +1 -104
  29. package/src/ContentCards/content-cards-provider-factory.js +1 -20
  30. package/src/ContentCards/content-cards-provider.js +1 -391
  31. package/src/ContentCards/content-cards.js +1 -24
  32. package/src/ContentCards/get-cached-content-cards.js +1 -5
  33. package/src/ContentCards/index.js +1 -8
  34. package/src/ContentCards/log-content-cards-displayed.js +1 -5
  35. package/src/ContentCards/request-content-cards-refresh.js +1 -5
  36. package/src/ContentCards/subscribe-to-content-cards-updates.js +1 -17
  37. package/src/ContentCards/types.js +1 -1
  38. package/src/ContentCards/ui/hide-content-cards.js +1 -8
  39. package/src/ContentCards/ui/show-content-cards.js +1 -77
  40. package/src/ContentCards/ui/toggle-content-cards.js +1 -8
  41. package/src/Core/add-sdk-metadata.js +1 -26
  42. package/src/Core/braze-sdk-metadata.js +1 -10
  43. package/src/Core/change-user.js +1 -17
  44. package/src/Core/destroy.js +1 -5
  45. package/src/Core/device-properties.js +1 -9
  46. package/src/Core/disable-sdk.js +1 -15
  47. package/src/Core/enable-sdk.js +1 -11
  48. package/src/Core/get-device-id.js +1 -13
  49. package/src/Core/get-user.js +1 -4
  50. package/src/Core/handle-braze-action.js +1 -87
  51. package/src/Core/index.js +1 -23
  52. package/src/Core/initialize.js +1 -4
  53. package/src/Core/is-disabled.js +1 -4
  54. package/src/Core/log-custom-event.js +1 -38
  55. package/src/Core/log-purchase.js +1 -245
  56. package/src/Core/open-session.js +1 -25
  57. package/src/Core/remove-all-subscriptions.js +1 -4
  58. package/src/Core/remove-subscription.js +1 -4
  59. package/src/Core/request-immediate-data-flush.js +1 -6
  60. package/src/Core/set-logger.js +1 -4
  61. package/src/Core/set-sdk-authentication-signature.js +1 -8
  62. package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -6
  63. package/src/Core/toggle-logging.js +1 -4
  64. package/src/Core/types.js +1 -1
  65. package/src/Core/wipe-data.js +1 -16
  66. package/src/FeatureFlags/feature-flag-factory.js +1 -24
  67. package/src/FeatureFlags/feature-flag.js +1 -64
  68. package/src/FeatureFlags/feature-flags-provider-factory.js +1 -19
  69. package/src/FeatureFlags/feature-flags-provider.js +1 -145
  70. package/src/FeatureFlags/get-all-feature-flags.js +1 -12
  71. package/src/FeatureFlags/get-feature-flag.js +1 -12
  72. package/src/FeatureFlags/index.js +1 -6
  73. package/src/FeatureFlags/log-feature-flag-impression.js +1 -23
  74. package/src/FeatureFlags/refresh-feature-flags.js +1 -9
  75. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -9
  76. package/src/FeatureFlags/types.js +1 -1
  77. package/src/Feed/feed-provider-factory.js +1 -18
  78. package/src/Feed/feed-provider.js +1 -90
  79. package/src/Feed/feed.js +1 -20
  80. package/src/Feed/get-cached-feed.js +1 -5
  81. package/src/Feed/index.js +1 -8
  82. package/src/Feed/log-feed-displayed.js +1 -7
  83. package/src/Feed/request-feed-refresh.js +1 -5
  84. package/src/Feed/subscribe-to-feed-updates.js +1 -5
  85. package/src/Feed/types.js +1 -1
  86. package/src/Feed/ui/hide-feed.js +1 -7
  87. package/src/Feed/ui/show-feed.js +1 -96
  88. package/src/Feed/ui/toggle-feed.js +1 -8
  89. package/src/InAppMessage/defer-in-app-message.js +1 -13
  90. package/src/InAppMessage/display/get-animation-effect.js +1 -19
  91. package/src/InAppMessage/display/html-message-to-html.js +1 -244
  92. package/src/InAppMessage/display/in-app-message-to-html.js +1 -188
  93. package/src/InAppMessage/display/modal-utils.js +1 -73
  94. package/src/InAppMessage/get-deferred-in-app-message.js +1 -5
  95. package/src/InAppMessage/in-app-message-factory.js +1 -166
  96. package/src/InAppMessage/in-app-message-manager-factory.js +1 -16
  97. package/src/InAppMessage/in-app-message-manager.js +1 -248
  98. package/src/InAppMessage/index.js +1 -16
  99. package/src/InAppMessage/log-in-app-message-button-click.js +1 -27
  100. package/src/InAppMessage/log-in-app-message-click.js +1 -19
  101. package/src/InAppMessage/log-in-app-message-html-click.js +1 -23
  102. package/src/InAppMessage/log-in-app-message-impression.js +1 -13
  103. package/src/InAppMessage/models/control-message.js +1 -11
  104. package/src/InAppMessage/models/full-screen-message.js +1 -105
  105. package/src/InAppMessage/models/html-message.js +1 -68
  106. package/src/InAppMessage/models/in-app-message-button.js +1 -47
  107. package/src/InAppMessage/models/in-app-message.js +1 -382
  108. package/src/InAppMessage/models/modal-message.js +1 -101
  109. package/src/InAppMessage/models/slide-up-message.js +1 -84
  110. package/src/InAppMessage/models/templated-in-app-message.js +1 -19
  111. package/src/InAppMessage/subscribe-to-in-app-message.js +1 -10
  112. package/src/InAppMessage/types.js +1 -1
  113. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +1 -15
  114. package/src/InAppMessage/ui/show-in-app-message.js +1 -181
  115. package/src/InAppMessage/utils/in-app-message-utils.js +1 -1
  116. package/src/Push/index.js +1 -5
  117. package/src/Push/is-push-blocked.js +1 -5
  118. package/src/Push/is-push-permission-granted.js +1 -5
  119. package/src/Push/is-push-supported.js +1 -5
  120. package/src/Push/push-manager-factory.js +1 -30
  121. package/src/Push/push-manager.js +1 -387
  122. package/src/Push/request-push-permission.js +1 -9
  123. package/src/Push/types.js +1 -1
  124. package/src/Push/unregister-push.js +1 -5
  125. package/src/Push/utils/push-utils.js +1 -36
  126. package/src/User/index.js +1 -1
  127. package/src/User/types.js +1 -1
  128. package/src/User/user-manager.js +1 -73
  129. package/src/User/user.js +1 -302
  130. package/src/common/base-feed.js +1 -28
  131. package/src/common/base-provider.js +1 -6
  132. package/src/common/constants.js +1 -14
  133. package/src/common/event-logger.js +1 -31
  134. package/src/common/feed-display.js +1 -210
  135. package/src/common/translations.js +1 -148
  136. package/src/common/types.js +1 -1
  137. package/src/index.js +1 -9
  138. package/src/l10n/l10n-manager-factory.js +1 -22
  139. package/src/l10n/l10n-manager.js +1 -25
  140. package/src/l10n/types.js +1 -1
  141. package/src/managers/auth-manager.js +1 -51
  142. package/src/managers/braze-instance.js +1 -331
  143. package/src/managers/device-manager.js +1 -85
  144. package/src/managers/network-manager.js +1 -256
  145. package/src/managers/server-config-manager.js +1 -108
  146. package/src/managers/session-manager.js +1 -75
  147. package/src/managers/storage-manager-factory.js +1 -42
  148. package/src/managers/storage-manager.js +1 -419
  149. package/src/managers/subscription-manager.js +1 -28
  150. package/src/managers/types.js +1 -1
  151. package/src/models/backend-errors.js +1 -8
  152. package/src/models/braze-event.js +1 -47
  153. package/src/models/braze-sdk-metadata.js +1 -10
  154. package/src/models/device.js +1 -18
  155. package/src/models/identifier.js +1 -19
  156. package/src/models/push-token.js +1 -27
  157. package/src/models/request-result.js +1 -8
  158. package/src/models/server-config.js +1 -48
  159. package/src/models/types.js +1 -1
  160. package/src/request-controller.js +1 -311
  161. package/src/triggers/models/custom-event-data.js +1 -14
  162. package/src/triggers/models/custom-event-property-data.js +1 -21
  163. package/src/triggers/models/filter-set.js +1 -55
  164. package/src/triggers/models/filter.js +1 -102
  165. package/src/triggers/models/in-app-message-click-data.js +1 -25
  166. package/src/triggers/models/purchase-data.js +1 -14
  167. package/src/triggers/models/purchase-property-data.js +1 -21
  168. package/src/triggers/models/push-click-data.js +1 -15
  169. package/src/triggers/models/trigger-condition.js +1 -105
  170. package/src/triggers/models/trigger-events.js +1 -8
  171. package/src/triggers/models/trigger.js +1 -122
  172. package/src/triggers/triggers-provider-factory.js +1 -34
  173. package/src/triggers/triggers-provider.js +1 -326
  174. package/src/triggers/types.js +1 -1
  175. package/src/types.js +1 -1
  176. package/src/ui/js/attach-css.js +1 -13
  177. package/src/ui/js/feed-css.js +1 -12
  178. package/src/ui/js/iam-css.js +1 -12
  179. package/src/ui/js/index.js +1 -3
  180. package/src/ui/js/load-font-awesome.js +1 -13
  181. package/src/util/base-device-parser.js +1 -14
  182. package/src/util/braze-actions.js +1 -84
  183. package/src/util/browser-detector.js +1 -84
  184. package/src/util/client-hints-parser.js +1 -66
  185. package/src/util/code-utils.js +1 -100
  186. package/src/util/color-utils.js +1 -29
  187. package/src/util/component-utils.js +1 -26
  188. package/src/util/date-utils.js +1 -28
  189. package/src/util/deprecation-utils.js +1 -5
  190. package/src/util/device-constants.js +1 -14
  191. package/src/util/dom-utils.js +1 -91
  192. package/src/util/error-utils.js +1 -2
  193. package/src/util/key-codes.js +1 -1
  194. package/src/util/math.js +1 -5
  195. package/src/util/net.js +1 -71
  196. package/src/util/request-header-utils.js +1 -46
  197. package/src/util/string-utils.js +1 -22
  198. package/src/util/types.js +1 -1
  199. package/src/util/url-utils.js +1 -20
  200. package/src/util/user-agent-parser.js +1 -85
  201. package/src/util/validation-utils.js +1 -217
  202. package/src/util/window-utils.js +1 -34
@@ -1,104 +1 @@
1
- import {
2
- Card,
3
- CaptionedImage,
4
- ClassicCard,
5
- ControlCard,
6
- ImageOnly,
7
- } from "../index.js";
8
- import {
9
- dateFromUnixTimestamp as l,
10
- rehydrateDateAfterJsonization as w,
11
- } from "../../util/date-utils.js";
12
- import r from "../../../shared-lib/braze-shared-lib.js";
13
- export function newCard(e, n, t, o, i, l, u, d, a, s, w, f, m, C, p, c, x, F) {
14
- let b;
15
- if (n === Card.es.ct || n === Card.es.St)
16
- b = new ClassicCard(e, t, o, i, l, u, d, a, s, w, f, m, C, p, c, x);
17
- else if (n === Card.es.tt)
18
- b = new CaptionedImage(e, t, o, i, l, u, d, a, s, w, f, m, C, p, c, x);
19
- else if (n === Card.es.rs)
20
- b = new ImageOnly(e, t, i, u, d, a, s, w, f, m, C, p, c, x);
21
- else {
22
- if (n !== Card.es.At)
23
- return r.j.error("Ignoring card with unknown type " + n), null;
24
- b = new ControlCard(e, t, d, s, C, p);
25
- }
26
- return F && (b.test = F), b;
27
- }
28
- export function newCardFromContentCardsJson(e) {
29
- if (e[Card.Tt.It]) return null;
30
- const n = e[Card.Tt.ns],
31
- r = e[Card.Tt.ts],
32
- t = e[Card.Tt.ls],
33
- o = e[Card.Tt.st],
34
- i = e[Card.Tt.os],
35
- u = e[Card.Tt.it],
36
- d = l(e[Card.Tt.us]),
37
- a = d;
38
- let s;
39
- s = e[Card.Tt.ds] === Card.Nt ? null : l(e[Card.Tt.ds]);
40
- return newCard(
41
- n,
42
- r,
43
- t,
44
- o,
45
- i,
46
- u,
47
- a,
48
- d,
49
- null,
50
- s,
51
- e[Card.Tt.URL],
52
- e[Card.Tt.ps],
53
- e[Card.Tt.fs],
54
- e[Card.Tt.xs],
55
- e[Card.Tt.gs],
56
- e[Card.Tt.js],
57
- e[Card.Tt.ys],
58
- e[Card.Tt.zs] || !1,
59
- );
60
- }
61
- export function newCardFromFeedJson(e) {
62
- return newCard(
63
- e.id,
64
- e.type,
65
- e.viewed,
66
- e.title,
67
- e.image,
68
- e.description,
69
- l(e.created),
70
- l(e.updated),
71
- e.categories,
72
- l(e.expires_at),
73
- e.url,
74
- e.domain,
75
- e.aspect_ratio,
76
- e.extras,
77
- !1,
78
- !1,
79
- );
80
- }
81
- export function newCardFromSerializedValue(e) {
82
- return (
83
- newCard(
84
- e[Card.hs.ns],
85
- e[Card.hs.ts],
86
- e[Card.hs.ls],
87
- e[Card.hs.st],
88
- e[Card.hs.os],
89
- e[Card.hs.it],
90
- w(e[Card.hs.cs]),
91
- w(e[Card.hs.us]),
92
- e[Card.hs.bs],
93
- w(e[Card.hs.ds]),
94
- e[Card.hs.URL],
95
- e[Card.hs.ps],
96
- e[Card.hs.fs],
97
- e[Card.hs.xs],
98
- e[Card.hs.gs],
99
- e[Card.hs.js],
100
- e[Card.hs.ys],
101
- e[Card.hs.zs] || !1,
102
- ) || void 0
103
- );
104
- }
1
+ import{Card,CaptionedImage,ClassicCard,ControlCard,ImageOnly}from"../index.js";import{dateFromUnixTimestamp as l,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.St)b=new ClassicCard(e,t,o,i,l,u,d,a,s,w,f,m,C,p,c,x);else if(n===Card.es.tt)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 ImageOnly(e,t,i,u,d,a,s,w,f,m,C,p,c,x);else{if(n!==Card.es.At)return r.j.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.Tt.It])return null;const n=e[Card.Tt.ns],r=e[Card.Tt.ts],t=e[Card.Tt.ls],o=e[Card.Tt.st],i=e[Card.Tt.os],u=e[Card.Tt.it],d=l(e[Card.Tt.us]),a=d;let s;s=e[Card.Tt.ds]===Card.Nt?null:l(e[Card.Tt.ds]);return newCard(n,r,t,o,i,u,a,d,null,s,e[Card.Tt.URL],e[Card.Tt.ps],e[Card.Tt.fs],e[Card.Tt.xs],e[Card.Tt.gs],e[Card.Tt.js],e[Card.Tt.ys],e[Card.Tt.zs]||!1)}export function newCardFromFeedJson(e){return newCard(e.id,e.type,e.viewed,e.title,e.image,e.description,l(e.created),l(e.updated),e.categories,l(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.st],e[Card.hs.os],e[Card.hs.it],w(e[Card.hs.cs]),w(e[Card.hs.us]),e[Card.hs.bs],w(e[Card.hs.ds]),e[Card.hs.URL],e[Card.hs.ps],e[Card.hs.fs],e[Card.hs.xs],e[Card.hs.gs],e[Card.hs.js],e[Card.hs.ys],e[Card.hs.zs]||!1)||void 0}
@@ -1,20 +1 @@
1
- import e from "../managers/braze-instance.js";
2
- import v from "./content-cards-provider.js";
3
- const g = {
4
- t: !1,
5
- provider: null,
6
- er: () => (
7
- g.o(),
8
- g.provider ||
9
- ((g.provider = new v(e.ir(), e.l(), e.tr(), e.nr(), e.ar())),
10
- e.dr(g.provider)),
11
- g.provider
12
- ),
13
- o: () => {
14
- g.t || (e.g(g), (g.t = !0));
15
- },
16
- destroy: () => {
17
- (g.provider = null), (g.t = !1);
18
- },
19
- };
20
- export default g;
1
+ import e from"../managers/braze-instance.js";import v from"./content-cards-provider.js";const g={t:!1,provider:null,er:()=>(g.o(),g.provider||(g.provider=new v(e.ir(),e.l(),e.tr(),e.nr(),e.ar()),e.dr(g.provider)),g.provider),o:()=>{g.t||(e.g(g),g.t=!0)},destroy:()=>{g.provider=null,g.t=!1}};export default g;
@@ -1,391 +1 @@
1
- import C, { readResponseHeaders as b } from "../util/net.js";
2
- import y from "../common/base-provider.js";
3
- import e from "../managers/braze-instance.js";
4
- import ContentCards from "./content-cards.js";
5
- import { dateFromUnixTimestamp as l } from "../util/date-utils.js";
6
- import { isURIJavascriptOrData as N } from "../util/url-utils.js";
7
- import {
8
- newCardFromContentCardsJson as j,
9
- newCardFromSerializedValue as R,
10
- } from "../Card/util/card-factory.js";
11
- import r from "../../shared-lib/braze-shared-lib.js";
12
- import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
13
- import E from "../managers/subscription-manager.js";
14
- import s from "../common/event-logger.js";
15
- import T from "../util/request-header-utils.js";
16
- import { randomInclusive as D } from "../util/math.js";
17
- import { MAX_ERROR_RETRIES_CONTENT_CARDS as S } from "../common/constants.js";
18
- export default class v extends y {
19
- constructor(t, s, i, h, n) {
20
- super(),
21
- (this.ft = t),
22
- (this.u = s),
23
- (this.wt = i),
24
- (this.vt = h),
25
- (this.gt = n),
26
- (this.ft = t),
27
- (this.u = s),
28
- (this.wt = i),
29
- (this.vt = h),
30
- (this.gt = n),
31
- (this.yt = new E()),
32
- e.jt(this.yt),
33
- (this.kt = 0),
34
- (this.Ut = 0),
35
- (this.cards = []),
36
- this.Lt();
37
- const o = r.zt.Ft;
38
- new r.xt(o, r.j).Mt(o.Jt.qt, (t) => {
39
- this.Pt(t);
40
- }),
41
- (this.$t = null),
42
- (this._t = null),
43
- (this.Bt = null),
44
- (this.Gt = null),
45
- (this.Ht = null),
46
- (this.Kt = 10),
47
- (this.Ot = 0);
48
- }
49
- Qt() {
50
- return this.$t;
51
- }
52
- Vt(t) {
53
- this.$t = t;
54
- }
55
- Wt() {
56
- return this._t;
57
- }
58
- Xt(t) {
59
- this._t = t;
60
- }
61
- Lt() {
62
- if (!this.u) return;
63
- const t = this.u.v(i.k.Yt) || [],
64
- s = [];
65
- for (let i = 0; i < t.length; i++) {
66
- const e = R(t[i]);
67
- null != e && s.push(e);
68
- }
69
- (this.cards = this.Zt(this.Cs(s, !1))),
70
- (this.kt = this.u.v(i.k.ws) || this.kt),
71
- (this.Ut = this.u.v(i.k.vs) || this.Ut);
72
- }
73
- Ns(t, s = !1, e = 0, h = 0) {
74
- let r;
75
- if (s) {
76
- r = [];
77
- for (const t of this.cards) t.test && r.push(t);
78
- } else r = this.cards.slice();
79
- for (let i = 0; i < t.length; i++) {
80
- const e = t[i];
81
- let h = null;
82
- for (let t = 0; t < this.cards.length; t++)
83
- if (e.id === this.cards[t].id) {
84
- h = this.cards[t];
85
- break;
86
- }
87
- if (s) {
88
- const t = j(e);
89
- null != h && h.viewed && t && (t.viewed = !0), null != t && r.push(t);
90
- } else if (null == h) {
91
- const t = j(e);
92
- null != t && r.push(t);
93
- } else {
94
- if (!h.ot(e))
95
- for (let t = 0; t < r.length; t++)
96
- if (e.id === r[t].id) {
97
- r.splice(t, 1);
98
- break;
99
- }
100
- }
101
- }
102
- (this.cards = this.Zt(this.Cs(r, s))),
103
- this.Rs(),
104
- (this.kt = e),
105
- (this.Ut = h),
106
- this.u && (this.u.D(i.k.ws, this.kt), this.u.D(i.k.vs, this.Ut));
107
- }
108
- Ts(t) {
109
- if (this.Ds() && null != t && t.cards) {
110
- this.u && this.u.D(i.k.Ss, e.ks());
111
- const s = t.full_sync;
112
- s || this.Lt(),
113
- this.Ns(t.cards, s, t.last_full_sync_at, t.last_card_updated_at),
114
- this.yt.Et(this.Us(!0));
115
- }
116
- }
117
- As(t) {
118
- this.u && this.u.D(i.k.Ls, t);
119
- }
120
- Fs(t, e, h) {
121
- const n = () => {
122
- this.Ms(e, h, !0);
123
- },
124
- o = t ? b(t) : null;
125
- let l;
126
- if ((this.Es(), !o || !o["retry-after"])) return void this.As(0);
127
- const a = o["retry-after"];
128
- if (isNaN(a) && !isNaN(Date.parse(a)))
129
- (l = Date.parse(a) - new Date().getTime()), l < 0 && n();
130
- else {
131
- if (isNaN(parseFloat(a.toString()))) {
132
- const t =
133
- "Received unexpected value for retry-after header in /sync response";
134
- return s.N(r.q.qs, { e: t + ": " + a }), void this.As(0);
135
- }
136
- l = 1e3 * parseFloat(a.toString());
137
- }
138
- this.Bt = window.setTimeout(() => {
139
- n();
140
- }, l);
141
- let u = 0;
142
- this.u && (u = this.u.v(i.k.Ls)),
143
- (null == u || isNaN(parseInt(u.toString()))) && (u = 0),
144
- this.As(parseInt(u.toString()) + 1);
145
- }
146
- Pt(t) {
147
- if (!this.Ds()) return;
148
- this.Lt();
149
- const s = this.cards.slice();
150
- let i = null;
151
- this.ft && (i = this.ft.getUserId());
152
- for (let e = 0; e < t.length; e++)
153
- if (i === t[e].userId || (null == i && null == t[e].userId)) {
154
- const i = t[e].card;
155
- let h = null;
156
- for (let t = 0; t < this.cards.length; t++)
157
- if (i.id === this.cards[t].id) {
158
- h = this.cards[t];
159
- break;
160
- }
161
- if (null == h) {
162
- const t = j(i);
163
- null != t && s.push(t);
164
- } else {
165
- if (!h.ot(i))
166
- for (let t = 0; t < s.length; t++)
167
- if (i.id === s[t].id) {
168
- s.splice(t, 1);
169
- break;
170
- }
171
- }
172
- }
173
- (this.cards = this.Zt(this.Cs(s, !1))), this.Rs(), this.yt.Et(this.Us(!0));
174
- }
175
- Cs(t, s) {
176
- let e = {},
177
- h = {},
178
- r = {};
179
- this.u &&
180
- ((e = this.u.v(i.k.C) || {}),
181
- (h = this.u.v(i.k.K) || {}),
182
- (r = this.u.v(i.k.G) || {}));
183
- const n = {},
184
- o = {},
185
- l = {};
186
- for (let s = 0; s < t.length; s++) {
187
- const i = t[s].id;
188
- i &&
189
- (e[i] && ((t[s].clicked = !0), (n[i] = !0)),
190
- h[i] && ((t[s].viewed = !0), (o[i] = !0)),
191
- r[i] && ((t[s].dismissed = !0), (l[i] = !0)));
192
- }
193
- return (
194
- s &&
195
- this.u &&
196
- (this.u.D(i.k.C, n), this.u.D(i.k.K, o), this.u.D(i.k.G, l)),
197
- t
198
- );
199
- }
200
- Zt(t) {
201
- const s = [],
202
- e = new Date();
203
- let h = {};
204
- this.u && (h = this.u.v(i.k.G) || {});
205
- let n = !1;
206
- for (let i = 0; i < t.length; i++) {
207
- const o = t[i].url;
208
- if (!this.vt && o && N(o)) {
209
- r.j.error(
210
- `Card with url ${o} will not be displayed because Javascript URLs are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable this card.`,
211
- );
212
- continue;
213
- }
214
- const l = t[i].expiresAt;
215
- let a = !0;
216
- if ((null != l && (a = l >= e), (a = a && !t[i].dismissed), a))
217
- s.push(t[i]);
218
- else {
219
- const s = t[i].id;
220
- s && (h[s] = !0), (n = !0);
221
- }
222
- }
223
- return n && this.u && this.u.D(i.k.G, h), s;
224
- }
225
- Rs() {
226
- if (!this.u) return;
227
- const t = [];
228
- for (let s = 0; s < this.cards.length; s++) t.push(this.cards[s].ss());
229
- this.u.D(i.k.Yt, t);
230
- }
231
- Es() {
232
- this.Bt && (clearTimeout(this.Bt), (this.Bt = null));
233
- }
234
- Is() {
235
- null != this.Gt && (clearTimeout(this.Gt), (this.Gt = null));
236
- }
237
- Js(t = 1e3 * this.Kt, s, i) {
238
- this.Is(),
239
- (this.Gt = window.setTimeout(() => {
240
- this.Ms(s, i, !0);
241
- }, t)),
242
- (this.Ht = t);
243
- }
244
- Ms(t, s, h = !1, n = !0) {
245
- var o;
246
- const l = this.gt,
247
- a = this.u;
248
- if (!l || !a) return void ("function" == typeof s && s());
249
- const u = !h;
250
- if ((u && (this.Es(), this.As(0)), !this.Ds()))
251
- return void (
252
- this.wt &&
253
- this.wt.Ps(() => {
254
- this.Ms(t, s);
255
- })
256
- );
257
- let c = !0;
258
- if (
259
- (u &&
260
- (null === (o = this.wt) || void 0 === o ? void 0 : o.$s()) &&
261
- (c = this._s()),
262
- !c)
263
- )
264
- return void r.j.info("Content card sync being throttled.");
265
- n && this.Is();
266
- const f = l.Bs({}, !0);
267
- a.v(i.k.Ss) !== e.ks() && this.Gs(),
268
- (f.last_full_sync_at = this.kt),
269
- (f.last_card_updated_at = this.Ut);
270
- const d = l.Hs(f, T.Os.Ks, h);
271
- let m = !1;
272
- l.Qs(f, () => {
273
- if (this.u) {
274
- const t = new Date().valueOf();
275
- u && this.u.D(i.k.Vs, t), T.Ws(this.u, T.Os.Ks, t);
276
- }
277
- C.Xs({
278
- url: l.Ys() + "/content_cards/sync",
279
- data: f,
280
- headers: d,
281
- O: (i, e) => {
282
- if (!l.Zs(f, i, d))
283
- return (m = !0), void ("function" == typeof s && s());
284
- l.ti(),
285
- this.Fs(e, t, s),
286
- this.Ts(i),
287
- (m = !1),
288
- T.si(this.u, T.Os.Ks, 1),
289
- "function" == typeof t && t();
290
- },
291
- error: (t) => {
292
- l.ii(t, "retrieving content cards"),
293
- (m = !0),
294
- "function" == typeof s && s();
295
- },
296
- ei: () => {
297
- if (m && n && !this.Gt && this.Ot + 1 < S) {
298
- T.hi(this.u, T.Os.Ks);
299
- let i = this.Ht;
300
- (null == i || i < 1e3 * this.Kt) && (i = 1e3 * this.Kt),
301
- this.Js(Math.min(3e5, D(1e3 * this.Kt, 3 * i)), t, s),
302
- (this.Ot = this.Ot + 1);
303
- }
304
- },
305
- });
306
- });
307
- }
308
- Us(t) {
309
- t || this.Lt();
310
- const s = this.Zt(this.cards);
311
- s.sort((t, s) =>
312
- t.pinned && !s.pinned
313
- ? -1
314
- : s.pinned && !t.pinned
315
- ? 1
316
- : t.updated && s.updated && t.updated > s.updated
317
- ? -1
318
- : t.updated && s.updated && s.updated > t.updated
319
- ? 1
320
- : 0,
321
- );
322
- let e = Math.max(this.Ut || 0, this.kt || 0);
323
- return (
324
- 0 === e && (e = void 0),
325
- this.u && this.u.v(i.k.vs) === this.Ut && void 0 === e && (e = this.Ut),
326
- new ContentCards(s, l(e))
327
- );
328
- }
329
- ri(t) {
330
- return this.yt.lt(t);
331
- }
332
- Gs() {
333
- (this.kt = 0),
334
- (this.Ut = 0),
335
- this.u && (this.u.ni(i.k.ws), this.u.ni(i.k.vs));
336
- }
337
- changeUser(t) {
338
- t ||
339
- ((this.cards = []),
340
- this.yt.Et(new ContentCards(this.cards.slice(), null)),
341
- this.u &&
342
- (this.u.ni(i.k.Yt),
343
- this.u.ni(i.k.C),
344
- this.u.ni(i.k.K),
345
- this.u.ni(i.k.G))),
346
- this.Gs();
347
- }
348
- clearData(t) {
349
- (this.kt = 0),
350
- (this.Ut = 0),
351
- (this.cards = []),
352
- this.yt.Et(new ContentCards(this.cards.slice(), null)),
353
- t &&
354
- this.u &&
355
- (this.u.ni(i.k.Yt),
356
- this.u.ni(i.k.C),
357
- this.u.ni(i.k.K),
358
- this.u.ni(i.k.G),
359
- this.u.ni(i.k.ws),
360
- this.u.ni(i.k.vs));
361
- }
362
- Ds() {
363
- return !(this.wt && !this.wt.oi()) || (0 !== this.wt.li() && this.ai(), !1);
364
- }
365
- ui(t) {
366
- this.u && this.u.D(i.k.ci, t);
367
- }
368
- fi() {
369
- return this.u ? this.u.v(i.k.ci) : null;
370
- }
371
- _s() {
372
- const t = this.u,
373
- s = this.wt;
374
- if (!t || !s) return !0;
375
- const e = t.v(i.k.Vs);
376
- if (null == e || isNaN(e)) return !0;
377
- const h = s.di(),
378
- r = s.mi();
379
- if (-1 === h || -1 === r) return !0;
380
- let n = this.fi();
381
- (null == n || isNaN(n)) && (n = h);
382
- const o = (new Date().valueOf() - e) / 1e3;
383
- return (
384
- (n = Math.min(n + o / r, h)),
385
- !(n < 1) && ((n = Math.trunc(n) - 1), this.ui(n), !0)
386
- );
387
- }
388
- ai() {
389
- this.yt.Et(new ContentCards([], new Date())), this.u && this.u.ni(i.k.Yt);
390
- }
391
- }
1
+ import C,{readResponseHeaders as b}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 l}from"../util/date-utils.js";import{isURIJavascriptOrData as N}from"../util/url-utils.js";import{newCardFromContentCardsJson as j,newCardFromSerializedValue as R}from"../Card/util/card-factory.js";import r from"../../shared-lib/braze-shared-lib.js";import{STORAGE_KEYS as i}from"../managers/storage-manager.js";import E from"../managers/subscription-manager.js";import s from"../common/event-logger.js";import T from"../util/request-header-utils.js";import{randomInclusive as D}from"../util/math.js";import{MAX_ERROR_RETRIES_CONTENT_CARDS as S}from"../common/constants.js";export default class v extends y{constructor(t,s,i,h,n){super(),this.ft=t,this.u=s,this.wt=i,this.vt=h,this.gt=n,this.ft=t,this.u=s,this.wt=i,this.vt=h,this.gt=n,this.yt=new E,e.jt(this.yt),this.kt=0,this.Ut=0,this.cards=[],this.Lt();const o=r.zt.Ft;new r.xt(o,r.j).Mt(o.Jt.qt,(t=>{this.Pt(t)})),this.$t=null,this._t=null,this.Bt=null,this.Gt=null,this.Ht=null,this.Kt=10,this.Ot=0}Qt(){return this.$t}Vt(t){this.$t=t}Wt(){return this._t}Xt(t){this._t=t}Lt(){if(!this.u)return;const t=this.u.v(i.k.Yt)||[],s=[];for(let i=0;i<t.length;i++){const e=R(t[i]);null!=e&&s.push(e)}this.cards=this.Zt(this.Cs(s,!1)),this.kt=this.u.v(i.k.ws)||this.kt,this.Ut=this.u.v(i.k.vs)||this.Ut}Ns(t,s=!1,e=0,h=0){let r;if(s){r=[];for(const t of this.cards)t.test&&r.push(t)}else r=this.cards.slice();for(let i=0;i<t.length;i++){const e=t[i];let h=null;for(let t=0;t<this.cards.length;t++)if(e.id===this.cards[t].id){h=this.cards[t];break}if(s){const t=j(e);null!=h&&h.viewed&&t&&(t.viewed=!0),null!=t&&r.push(t)}else if(null==h){const t=j(e);null!=t&&r.push(t)}else{if(!h.ot(e))for(let t=0;t<r.length;t++)if(e.id===r[t].id){r.splice(t,1);break}}}this.cards=this.Zt(this.Cs(r,s)),this.Rs(),this.kt=e,this.Ut=h,this.u&&(this.u.D(i.k.ws,this.kt),this.u.D(i.k.vs,this.Ut))}Ts(t){if(this.Ds()&&null!=t&&t.cards){this.u&&this.u.D(i.k.Ss,e.ks());const s=t.full_sync;s||this.Lt(),this.Ns(t.cards,s,t.last_full_sync_at,t.last_card_updated_at),this.yt.Et(this.Us(!0))}}As(t){this.u&&this.u.D(i.k.Ls,t)}Fs(t,e,h){const n=()=>{this.Ms(e,h,!0)},o=t?b(t):null;let l;if(this.Es(),!o||!o["retry-after"])return void this.As(0);const a=o["retry-after"];if(isNaN(a)&&!isNaN(Date.parse(a)))l=Date.parse(a)-(new Date).getTime(),l<0&&n();else{if(isNaN(parseFloat(a.toString()))){const t="Received unexpected value for retry-after header in /sync response";return s.N(r.q.qs,{e:t+": "+a}),void this.As(0)}l=1e3*parseFloat(a.toString())}this.Bt=window.setTimeout((()=>{n()}),l);let u=0;this.u&&(u=this.u.v(i.k.Ls)),(null==u||isNaN(parseInt(u.toString())))&&(u=0),this.As(parseInt(u.toString())+1)}Pt(t){if(!this.Ds())return;this.Lt();const s=this.cards.slice();let i=null;this.ft&&(i=this.ft.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.cards.length;t++)if(i.id===this.cards[t].id){h=this.cards[t];break}if(null==h){const t=j(i);null!=t&&s.push(t)}else{if(!h.ot(i))for(let t=0;t<s.length;t++)if(i.id===s[t].id){s.splice(t,1);break}}}this.cards=this.Zt(this.Cs(s,!1)),this.Rs(),this.yt.Et(this.Us(!0))}Cs(t,s){let e={},h={},r={};this.u&&(e=this.u.v(i.k.C)||{},h=this.u.v(i.k.K)||{},r=this.u.v(i.k.G)||{});const n={},o={},l={};for(let s=0;s<t.length;s++){const i=t[s].id;i&&(e[i]&&(t[s].clicked=!0,n[i]=!0),h[i]&&(t[s].viewed=!0,o[i]=!0),r[i]&&(t[s].dismissed=!0,l[i]=!0))}return s&&this.u&&(this.u.D(i.k.C,n),this.u.D(i.k.K,o),this.u.D(i.k.G,l)),t}Zt(t){const s=[],e=new Date;let h={};this.u&&(h=this.u.v(i.k.G)||{});let n=!1;for(let i=0;i<t.length;i++){const o=t[i].url;if(!this.vt&&o&&N(o)){r.j.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.`);continue}const l=t[i].expiresAt;let a=!0;if(null!=l&&(a=l>=e),a=a&&!t[i].dismissed,a)s.push(t[i]);else{const s=t[i].id;s&&(h[s]=!0),n=!0}}return n&&this.u&&this.u.D(i.k.G,h),s}Rs(){if(!this.u)return;const t=[];for(let s=0;s<this.cards.length;s++)t.push(this.cards[s].ss());this.u.D(i.k.Yt,t)}Es(){this.Bt&&(clearTimeout(this.Bt),this.Bt=null)}Is(){null!=this.Gt&&(clearTimeout(this.Gt),this.Gt=null)}Js(t=1e3*this.Kt,s,i){this.Is(),this.Gt=window.setTimeout((()=>{this.Ms(s,i,!0)}),t),this.Ht=t}Ms(t,s,h=!1,n=!0){var o;const l=this.gt,a=this.u;if(!l||!a)return void("function"==typeof s&&s());const u=!h;if(u&&(this.Es(),this.As(0)),!this.Ds())return void(this.wt&&this.wt.Ps((()=>{this.Ms(t,s)})));let c=!0;if(u&&(null===(o=this.wt)||void 0===o?void 0:o.$s())&&(c=this._s()),!c)return void r.j.info("Content card sync being throttled.");n&&this.Is();const f=l.Bs({},!0);a.v(i.k.Ss)!==e.ks()&&this.Gs(),f.last_full_sync_at=this.kt,f.last_card_updated_at=this.Ut;const d=l.Hs(f,T.Os.Ks,h);let m=!1;l.Qs(f,(()=>{if(this.u){const t=(new Date).valueOf();u&&this.u.D(i.k.Vs,t),T.Ws(this.u,T.Os.Ks,t)}C.Xs({url:l.Ys()+"/content_cards/sync",data:f,headers:d,O:(i,e)=>{if(!l.Zs(f,i,d))return m=!0,void("function"==typeof s&&s());l.ti(),this.Fs(e,t,s),this.Ts(i),m=!1,T.si(this.u,T.Os.Ks,1),"function"==typeof t&&t()},error:t=>{l.ii(t,"retrieving content cards"),m=!0,"function"==typeof s&&s()},ei:()=>{if(m&&n&&!this.Gt&&this.Ot+1<S){T.hi(this.u,T.Os.Ks);let i=this.Ht;(null==i||i<1e3*this.Kt)&&(i=1e3*this.Kt),this.Js(Math.min(3e5,D(1e3*this.Kt,3*i)),t,s),this.Ot=this.Ot+1}}})}))}Us(t){t||this.Lt();const s=this.Zt(this.cards);s.sort(((t,s)=>t.pinned&&!s.pinned?-1:s.pinned&&!t.pinned?1:t.updated&&s.updated&&t.updated>s.updated?-1:t.updated&&s.updated&&s.updated>t.updated?1:0));let e=Math.max(this.Ut||0,this.kt||0);return 0===e&&(e=void 0),this.u&&this.u.v(i.k.vs)===this.Ut&&void 0===e&&(e=this.Ut),new ContentCards(s,l(e))}ri(t){return this.yt.lt(t)}Gs(){this.kt=0,this.Ut=0,this.u&&(this.u.ni(i.k.ws),this.u.ni(i.k.vs))}changeUser(t){t||(this.cards=[],this.yt.Et(new ContentCards(this.cards.slice(),null)),this.u&&(this.u.ni(i.k.Yt),this.u.ni(i.k.C),this.u.ni(i.k.K),this.u.ni(i.k.G))),this.Gs()}clearData(t){this.kt=0,this.Ut=0,this.cards=[],this.yt.Et(new ContentCards(this.cards.slice(),null)),t&&this.u&&(this.u.ni(i.k.Yt),this.u.ni(i.k.C),this.u.ni(i.k.K),this.u.ni(i.k.G),this.u.ni(i.k.ws),this.u.ni(i.k.vs))}Ds(){return!(this.wt&&!this.wt.oi())||(0!==this.wt.li()&&this.ai(),!1)}ui(t){this.u&&this.u.D(i.k.ci,t)}fi(){return this.u?this.u.v(i.k.ci):null}_s(){const t=this.u,s=this.wt;if(!t||!s)return!0;const e=t.v(i.k.Vs);if(null==e||isNaN(e))return!0;const h=s.di(),r=s.mi();if(-1===h||-1===r)return!0;let n=this.fi();(null==n||isNaN(n))&&(n=h);const o=((new Date).valueOf()-e)/1e3;return n=Math.min(n+o/r,h),!(n<1)&&(n=Math.trunc(n)-1,this.ui(n),!0)}ai(){this.yt.Et(new ContentCards([],new Date)),this.u&&this.u.ni(i.k.Yt)}}
@@ -1,24 +1 @@
1
- import x from "../common/base-feed.js";
2
- import { logCardClick, logCardImpressions } from "../Card/index.js";
3
- import { requestContentCardsRefresh } from "./request-content-cards-refresh.js";
4
- export default class ContentCards extends x {
5
- constructor(r, e) {
6
- super(r, e);
7
- }
8
- getUnviewedCardCount() {
9
- return super.getUnreadCardCount();
10
- }
11
- logCardImpressions(r) {
12
- logCardImpressions(r, !0);
13
- }
14
- logCardClick(r) {
15
- return logCardClick(r, !0);
16
- }
17
- sr() {
18
- requestContentCardsRefresh();
19
- }
20
- ur() {
21
- return !0;
22
- }
23
- }
24
- ContentCards.mr = 6e4;
1
+ import x from"../common/base-feed.js";import{logCardClick,logCardImpressions}from"../Card/index.js";import{requestContentCardsRefresh}from"./request-content-cards-refresh.js";export default class ContentCards extends x{constructor(r,e){super(r,e)}getUnviewedCardCount(){return super.getUnreadCardCount()}logCardImpressions(r){logCardImpressions(r,!0)}logCardClick(r){return logCardClick(r,!0)}sr(){requestContentCardsRefresh()}ur(){return!0}}ContentCards.mr=6e4;
@@ -1,5 +1 @@
1
- import g from "./content-cards-provider-factory.js";
2
- import e from "../managers/braze-instance.js";
3
- export function getCachedContentCards() {
4
- if (e.rr()) return g.er().Us(!1);
5
- }
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,8 +1 @@
1
- export { default as ContentCards } from "./content-cards.js";
2
- export { getCachedContentCards } from "./get-cached-content-cards.js";
3
- export { hideContentCards } from "./ui/hide-content-cards.js";
4
- export { logContentCardsDisplayed } from "./log-content-cards-displayed.js";
5
- export { requestContentCardsRefresh } from "./request-content-cards-refresh.js";
6
- export { showContentCards } from "./ui/show-content-cards.js";
7
- export { subscribeToContentCardsUpdates } from "./subscribe-to-content-cards-updates.js";
8
- export { toggleContentCards } from "./ui/toggle-content-cards.js";
1
+ export{default as ContentCards}from"./content-cards.js";export{getCachedContentCards}from"./get-cached-content-cards.js";export{hideContentCards}from"./ui/hide-content-cards.js";export{logContentCardsDisplayed}from"./log-content-cards-displayed.js";export{requestContentCardsRefresh}from"./request-content-cards-refresh.js";export{showContentCards}from"./ui/show-content-cards.js";export{subscribeToContentCardsUpdates}from"./subscribe-to-content-cards-updates.js";export{toggleContentCards}from"./ui/toggle-content-cards.js";
@@ -1,5 +1 @@
1
- import e from "../managers/braze-instance.js";
2
- import { logDeprecationWarning as z } from "../util/deprecation-utils.js";
3
- export function logContentCardsDisplayed() {
4
- if (e.rr()) return z("logContentCardsDisplayed", "method"), !0;
5
- }
1
+ import e from"../managers/braze-instance.js";import{logDeprecationWarning as z}from"../util/deprecation-utils.js";export function logContentCardsDisplayed(){if(e.rr())return z("logContentCardsDisplayed","method"),!0}
@@ -1,5 +1 @@
1
- import e from "../managers/braze-instance.js";
2
- import g from "./content-cards-provider-factory.js";
3
- export function requestContentCardsRefresh(r, t) {
4
- if (e.rr()) return g.er().Ms(r, t);
5
- }
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().Ms(r,t)}
@@ -1,17 +1 @@
1
- import e from "../managers/braze-instance.js";
2
- import g from "./content-cards-provider-factory.js";
3
- export function subscribeToContentCardsUpdates(r) {
4
- if (!e.rr()) return;
5
- const t = g.er(),
6
- n = t.ri(r);
7
- if (!t.Wt()) {
8
- const r = e.cr();
9
- if (r) {
10
- const n = r.pr(() => {
11
- t.Ms();
12
- });
13
- n && t.Xt(n);
14
- }
15
- }
16
- return n;
17
- }
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.ri(r);if(!t.Wt()){const r=e.cr();if(r){const n=r.pr((()=>{t.Ms()}));n&&t.Xt(n)}}return n}
@@ -1 +1 @@
1
- export {};
1
+ export{};
@@ -1,8 +1 @@
1
- import e from "../../managers/braze-instance.js";
2
- import { destroyFeedHtml as k } from "../../common/feed-display.js";
3
- export function hideContentCards(n) {
4
- if (!e.rr()) return;
5
- const o = document.querySelectorAll(".ab-feed");
6
- for (let e = 0; e < o.length; e++)
7
- (null == n || (null != n && o[e].parentNode === n)) && k(o[e]);
8
- }
1
+ import e from"../../managers/braze-instance.js";import{destroyFeedHtml as k}from"../../common/feed-display.js";export function hideContentCards(n){if(!e.rr())return;const o=document.querySelectorAll(".ab-feed");for(let e=0;e<o.length;e++)(null==n||null!=n&&o[e].parentNode===n)&&k(o[e])}