@builder.io/sdk-react-native 3.0.5 → 3.0.6

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 (215) hide show
  1. package/lib/browser/commonjs/blocks/personalization-container/component-info.js +43 -0
  2. package/lib/browser/commonjs/blocks/personalization-container/component-info.js.map +1 -0
  3. package/lib/browser/commonjs/blocks/personalization-container/helpers/inlined-fns.js +94 -0
  4. package/lib/browser/commonjs/blocks/personalization-container/helpers/inlined-fns.js.map +1 -0
  5. package/lib/browser/commonjs/blocks/personalization-container/helpers.js +76 -0
  6. package/lib/browser/commonjs/blocks/personalization-container/helpers.js.map +1 -0
  7. package/lib/browser/commonjs/blocks/personalization-container/index.js +14 -0
  8. package/lib/browser/commonjs/blocks/personalization-container/index.js.map +1 -0
  9. package/lib/browser/commonjs/blocks/personalization-container/personalization-container.js +130 -0
  10. package/lib/browser/commonjs/blocks/personalization-container/personalization-container.js.map +1 -0
  11. package/lib/browser/commonjs/blocks/personalization-container/personalization-container.types.js +6 -0
  12. package/lib/browser/commonjs/blocks/personalization-container/personalization-container.types.js.map +1 -0
  13. package/lib/browser/commonjs/components/blocks/blocks-wrapper.js +2 -1
  14. package/lib/browser/commonjs/components/blocks/blocks-wrapper.js.map +1 -1
  15. package/lib/browser/commonjs/constants/builder-registered-components.js +21 -16
  16. package/lib/browser/commonjs/constants/builder-registered-components.js.map +1 -1
  17. package/lib/browser/commonjs/constants/sdk-version.js +1 -1
  18. package/lib/browser/commonjs/helpers/canTrack.js +6 -1
  19. package/lib/browser/commonjs/helpers/canTrack.js.map +1 -1
  20. package/lib/browser/commonjs/helpers/user-attributes.js +56 -0
  21. package/lib/browser/commonjs/helpers/user-attributes.js.map +1 -0
  22. package/lib/browser/commonjs/scripts/init-editing.js +2 -1
  23. package/lib/browser/commonjs/scripts/init-editing.js.map +1 -1
  24. package/lib/browser/module/blocks/personalization-container/component-info.js +37 -0
  25. package/lib/browser/module/blocks/personalization-container/component-info.js.map +1 -0
  26. package/lib/browser/module/blocks/personalization-container/helpers/inlined-fns.js +87 -0
  27. package/lib/browser/module/blocks/personalization-container/helpers/inlined-fns.js.map +1 -0
  28. package/lib/browser/module/blocks/personalization-container/helpers.js +62 -0
  29. package/lib/browser/module/blocks/personalization-container/helpers.js.map +1 -0
  30. package/lib/browser/module/blocks/personalization-container/index.js +2 -0
  31. package/lib/browser/module/blocks/personalization-container/index.js.map +1 -0
  32. package/lib/browser/module/blocks/personalization-container/personalization-container.js +121 -0
  33. package/lib/browser/module/blocks/personalization-container/personalization-container.js.map +1 -0
  34. package/lib/browser/module/blocks/personalization-container/personalization-container.types.js +2 -0
  35. package/lib/browser/module/blocks/personalization-container/personalization-container.types.js.map +1 -0
  36. package/lib/browser/module/components/blocks/blocks-wrapper.js +2 -1
  37. package/lib/browser/module/components/blocks/blocks-wrapper.js.map +1 -1
  38. package/lib/browser/module/constants/builder-registered-components.js +6 -1
  39. package/lib/browser/module/constants/builder-registered-components.js.map +1 -1
  40. package/lib/browser/module/constants/sdk-version.js +1 -1
  41. package/lib/browser/module/helpers/canTrack.js +6 -1
  42. package/lib/browser/module/helpers/canTrack.js.map +1 -1
  43. package/lib/browser/module/helpers/user-attributes.js +47 -0
  44. package/lib/browser/module/helpers/user-attributes.js.map +1 -0
  45. package/lib/browser/module/scripts/init-editing.js +2 -1
  46. package/lib/browser/module/scripts/init-editing.js.map +1 -1
  47. package/lib/browser/typescript/blocks/personalization-container/component-info.d.ts +3 -0
  48. package/lib/browser/typescript/blocks/personalization-container/component-info.d.ts.map +1 -0
  49. package/lib/browser/typescript/blocks/personalization-container/helpers/inlined-fns.d.ts +9 -0
  50. package/lib/browser/typescript/blocks/personalization-container/helpers/inlined-fns.d.ts.map +1 -0
  51. package/lib/browser/typescript/blocks/personalization-container/helpers.d.ts +28 -0
  52. package/lib/browser/typescript/blocks/personalization-container/helpers.d.ts.map +1 -0
  53. package/lib/browser/typescript/blocks/personalization-container/index.d.ts +2 -0
  54. package/lib/browser/typescript/blocks/personalization-container/index.d.ts.map +1 -0
  55. package/lib/browser/typescript/blocks/personalization-container/personalization-container.d.ts +5 -0
  56. package/lib/browser/typescript/blocks/personalization-container/personalization-container.d.ts.map +1 -0
  57. package/lib/browser/typescript/blocks/personalization-container/personalization-container.types.d.ts +15 -0
  58. package/lib/browser/typescript/blocks/personalization-container/personalization-container.types.d.ts.map +1 -0
  59. package/lib/browser/typescript/components/blocks/blocks-wrapper.d.ts.map +1 -1
  60. package/lib/browser/typescript/constants/builder-registered-components.d.ts.map +1 -1
  61. package/lib/browser/typescript/constants/sdk-version.d.ts +1 -1
  62. package/lib/browser/typescript/helpers/canTrack.d.ts.map +1 -1
  63. package/lib/browser/typescript/helpers/user-attributes.d.ts +18 -0
  64. package/lib/browser/typescript/helpers/user-attributes.d.ts.map +1 -0
  65. package/lib/browser/typescript/scripts/init-editing.d.ts.map +1 -1
  66. package/lib/browser/typescript/types/input.d.ts +1 -0
  67. package/lib/browser/typescript/types/input.d.ts.map +1 -1
  68. package/lib/edge/commonjs/blocks/personalization-container/component-info.js +43 -0
  69. package/lib/edge/commonjs/blocks/personalization-container/component-info.js.map +1 -0
  70. package/lib/edge/commonjs/blocks/personalization-container/helpers/inlined-fns.js +94 -0
  71. package/lib/edge/commonjs/blocks/personalization-container/helpers/inlined-fns.js.map +1 -0
  72. package/lib/edge/commonjs/blocks/personalization-container/helpers.js +76 -0
  73. package/lib/edge/commonjs/blocks/personalization-container/helpers.js.map +1 -0
  74. package/lib/edge/commonjs/blocks/personalization-container/index.js +14 -0
  75. package/lib/edge/commonjs/blocks/personalization-container/index.js.map +1 -0
  76. package/lib/edge/commonjs/blocks/personalization-container/personalization-container.js +130 -0
  77. package/lib/edge/commonjs/blocks/personalization-container/personalization-container.js.map +1 -0
  78. package/lib/edge/commonjs/blocks/personalization-container/personalization-container.types.js +6 -0
  79. package/lib/edge/commonjs/blocks/personalization-container/personalization-container.types.js.map +1 -0
  80. package/lib/edge/commonjs/components/blocks/blocks-wrapper.js +2 -1
  81. package/lib/edge/commonjs/components/blocks/blocks-wrapper.js.map +1 -1
  82. package/lib/edge/commonjs/constants/builder-registered-components.js +21 -16
  83. package/lib/edge/commonjs/constants/builder-registered-components.js.map +1 -1
  84. package/lib/edge/commonjs/constants/sdk-version.js +1 -1
  85. package/lib/edge/commonjs/helpers/canTrack.js +6 -1
  86. package/lib/edge/commonjs/helpers/canTrack.js.map +1 -1
  87. package/lib/edge/commonjs/helpers/user-attributes.js +56 -0
  88. package/lib/edge/commonjs/helpers/user-attributes.js.map +1 -0
  89. package/lib/edge/commonjs/scripts/init-editing.js +2 -1
  90. package/lib/edge/commonjs/scripts/init-editing.js.map +1 -1
  91. package/lib/edge/module/blocks/personalization-container/component-info.js +37 -0
  92. package/lib/edge/module/blocks/personalization-container/component-info.js.map +1 -0
  93. package/lib/edge/module/blocks/personalization-container/helpers/inlined-fns.js +87 -0
  94. package/lib/edge/module/blocks/personalization-container/helpers/inlined-fns.js.map +1 -0
  95. package/lib/edge/module/blocks/personalization-container/helpers.js +62 -0
  96. package/lib/edge/module/blocks/personalization-container/helpers.js.map +1 -0
  97. package/lib/edge/module/blocks/personalization-container/index.js +2 -0
  98. package/lib/edge/module/blocks/personalization-container/index.js.map +1 -0
  99. package/lib/edge/module/blocks/personalization-container/personalization-container.js +121 -0
  100. package/lib/edge/module/blocks/personalization-container/personalization-container.js.map +1 -0
  101. package/lib/edge/module/blocks/personalization-container/personalization-container.types.js +2 -0
  102. package/lib/edge/module/blocks/personalization-container/personalization-container.types.js.map +1 -0
  103. package/lib/edge/module/components/blocks/blocks-wrapper.js +2 -1
  104. package/lib/edge/module/components/blocks/blocks-wrapper.js.map +1 -1
  105. package/lib/edge/module/constants/builder-registered-components.js +6 -1
  106. package/lib/edge/module/constants/builder-registered-components.js.map +1 -1
  107. package/lib/edge/module/constants/sdk-version.js +1 -1
  108. package/lib/edge/module/helpers/canTrack.js +6 -1
  109. package/lib/edge/module/helpers/canTrack.js.map +1 -1
  110. package/lib/edge/module/helpers/user-attributes.js +47 -0
  111. package/lib/edge/module/helpers/user-attributes.js.map +1 -0
  112. package/lib/edge/module/scripts/init-editing.js +2 -1
  113. package/lib/edge/module/scripts/init-editing.js.map +1 -1
  114. package/lib/edge/typescript/blocks/personalization-container/component-info.d.ts +3 -0
  115. package/lib/edge/typescript/blocks/personalization-container/component-info.d.ts.map +1 -0
  116. package/lib/edge/typescript/blocks/personalization-container/helpers/inlined-fns.d.ts +9 -0
  117. package/lib/edge/typescript/blocks/personalization-container/helpers/inlined-fns.d.ts.map +1 -0
  118. package/lib/edge/typescript/blocks/personalization-container/helpers.d.ts +28 -0
  119. package/lib/edge/typescript/blocks/personalization-container/helpers.d.ts.map +1 -0
  120. package/lib/edge/typescript/blocks/personalization-container/index.d.ts +2 -0
  121. package/lib/edge/typescript/blocks/personalization-container/index.d.ts.map +1 -0
  122. package/lib/edge/typescript/blocks/personalization-container/personalization-container.d.ts +5 -0
  123. package/lib/edge/typescript/blocks/personalization-container/personalization-container.d.ts.map +1 -0
  124. package/lib/edge/typescript/blocks/personalization-container/personalization-container.types.d.ts +15 -0
  125. package/lib/edge/typescript/blocks/personalization-container/personalization-container.types.d.ts.map +1 -0
  126. package/lib/edge/typescript/components/blocks/blocks-wrapper.d.ts.map +1 -1
  127. package/lib/edge/typescript/constants/builder-registered-components.d.ts.map +1 -1
  128. package/lib/edge/typescript/constants/sdk-version.d.ts +1 -1
  129. package/lib/edge/typescript/helpers/canTrack.d.ts.map +1 -1
  130. package/lib/edge/typescript/helpers/user-attributes.d.ts +18 -0
  131. package/lib/edge/typescript/helpers/user-attributes.d.ts.map +1 -0
  132. package/lib/edge/typescript/scripts/init-editing.d.ts.map +1 -1
  133. package/lib/edge/typescript/types/input.d.ts +1 -0
  134. package/lib/edge/typescript/types/input.d.ts.map +1 -1
  135. package/lib/node/commonjs/blocks/personalization-container/component-info.js +43 -0
  136. package/lib/node/commonjs/blocks/personalization-container/component-info.js.map +1 -0
  137. package/lib/node/commonjs/blocks/personalization-container/helpers/inlined-fns.js +94 -0
  138. package/lib/node/commonjs/blocks/personalization-container/helpers/inlined-fns.js.map +1 -0
  139. package/lib/node/commonjs/blocks/personalization-container/helpers.js +76 -0
  140. package/lib/node/commonjs/blocks/personalization-container/helpers.js.map +1 -0
  141. package/lib/node/commonjs/blocks/personalization-container/index.js +14 -0
  142. package/lib/node/commonjs/blocks/personalization-container/index.js.map +1 -0
  143. package/lib/node/commonjs/blocks/personalization-container/personalization-container.js +130 -0
  144. package/lib/node/commonjs/blocks/personalization-container/personalization-container.js.map +1 -0
  145. package/lib/node/commonjs/blocks/personalization-container/personalization-container.types.js +6 -0
  146. package/lib/node/commonjs/blocks/personalization-container/personalization-container.types.js.map +1 -0
  147. package/lib/node/commonjs/components/blocks/blocks-wrapper.js +2 -1
  148. package/lib/node/commonjs/components/blocks/blocks-wrapper.js.map +1 -1
  149. package/lib/node/commonjs/constants/builder-registered-components.js +21 -16
  150. package/lib/node/commonjs/constants/builder-registered-components.js.map +1 -1
  151. package/lib/node/commonjs/constants/sdk-version.js +1 -1
  152. package/lib/node/commonjs/helpers/canTrack.js +6 -1
  153. package/lib/node/commonjs/helpers/canTrack.js.map +1 -1
  154. package/lib/node/commonjs/helpers/user-attributes.js +56 -0
  155. package/lib/node/commonjs/helpers/user-attributes.js.map +1 -0
  156. package/lib/node/commonjs/scripts/init-editing.js +2 -1
  157. package/lib/node/commonjs/scripts/init-editing.js.map +1 -1
  158. package/lib/node/module/blocks/personalization-container/component-info.js +37 -0
  159. package/lib/node/module/blocks/personalization-container/component-info.js.map +1 -0
  160. package/lib/node/module/blocks/personalization-container/helpers/inlined-fns.js +87 -0
  161. package/lib/node/module/blocks/personalization-container/helpers/inlined-fns.js.map +1 -0
  162. package/lib/node/module/blocks/personalization-container/helpers.js +62 -0
  163. package/lib/node/module/blocks/personalization-container/helpers.js.map +1 -0
  164. package/lib/node/module/blocks/personalization-container/index.js +2 -0
  165. package/lib/node/module/blocks/personalization-container/index.js.map +1 -0
  166. package/lib/node/module/blocks/personalization-container/personalization-container.js +121 -0
  167. package/lib/node/module/blocks/personalization-container/personalization-container.js.map +1 -0
  168. package/lib/node/module/blocks/personalization-container/personalization-container.types.js +2 -0
  169. package/lib/node/module/blocks/personalization-container/personalization-container.types.js.map +1 -0
  170. package/lib/node/module/components/blocks/blocks-wrapper.js +2 -1
  171. package/lib/node/module/components/blocks/blocks-wrapper.js.map +1 -1
  172. package/lib/node/module/constants/builder-registered-components.js +6 -1
  173. package/lib/node/module/constants/builder-registered-components.js.map +1 -1
  174. package/lib/node/module/constants/sdk-version.js +1 -1
  175. package/lib/node/module/helpers/canTrack.js +6 -1
  176. package/lib/node/module/helpers/canTrack.js.map +1 -1
  177. package/lib/node/module/helpers/user-attributes.js +47 -0
  178. package/lib/node/module/helpers/user-attributes.js.map +1 -0
  179. package/lib/node/module/scripts/init-editing.js +2 -1
  180. package/lib/node/module/scripts/init-editing.js.map +1 -1
  181. package/lib/node/typescript/blocks/personalization-container/component-info.d.ts +3 -0
  182. package/lib/node/typescript/blocks/personalization-container/component-info.d.ts.map +1 -0
  183. package/lib/node/typescript/blocks/personalization-container/helpers/inlined-fns.d.ts +9 -0
  184. package/lib/node/typescript/blocks/personalization-container/helpers/inlined-fns.d.ts.map +1 -0
  185. package/lib/node/typescript/blocks/personalization-container/helpers.d.ts +28 -0
  186. package/lib/node/typescript/blocks/personalization-container/helpers.d.ts.map +1 -0
  187. package/lib/node/typescript/blocks/personalization-container/index.d.ts +2 -0
  188. package/lib/node/typescript/blocks/personalization-container/index.d.ts.map +1 -0
  189. package/lib/node/typescript/blocks/personalization-container/personalization-container.d.ts +5 -0
  190. package/lib/node/typescript/blocks/personalization-container/personalization-container.d.ts.map +1 -0
  191. package/lib/node/typescript/blocks/personalization-container/personalization-container.types.d.ts +15 -0
  192. package/lib/node/typescript/blocks/personalization-container/personalization-container.types.d.ts.map +1 -0
  193. package/lib/node/typescript/components/blocks/blocks-wrapper.d.ts.map +1 -1
  194. package/lib/node/typescript/constants/builder-registered-components.d.ts.map +1 -1
  195. package/lib/node/typescript/constants/sdk-version.d.ts +1 -1
  196. package/lib/node/typescript/helpers/canTrack.d.ts.map +1 -1
  197. package/lib/node/typescript/helpers/user-attributes.d.ts +18 -0
  198. package/lib/node/typescript/helpers/user-attributes.d.ts.map +1 -0
  199. package/lib/node/typescript/scripts/init-editing.d.ts.map +1 -1
  200. package/lib/node/typescript/types/input.d.ts +1 -0
  201. package/lib/node/typescript/types/input.d.ts.map +1 -1
  202. package/package.json +1 -1
  203. package/src/blocks/personalization-container/component-info.ts +37 -0
  204. package/src/blocks/personalization-container/helpers/inlined-fns.ts +88 -0
  205. package/src/blocks/personalization-container/helpers.ts +84 -0
  206. package/src/blocks/personalization-container/index.ts +1 -0
  207. package/src/blocks/personalization-container/personalization-container.tsx +176 -0
  208. package/src/blocks/personalization-container/personalization-container.types.ts +14 -0
  209. package/src/components/blocks/blocks-wrapper.tsx +4 -1
  210. package/src/constants/builder-registered-components.ts +6 -1
  211. package/src/constants/sdk-version.ts +1 -1
  212. package/src/helpers/canTrack.ts +6 -1
  213. package/src/helpers/user-attributes.ts +49 -0
  214. package/src/scripts/init-editing.ts +2 -1
  215. package/src/types/input.ts +1 -0
@@ -43,7 +43,8 @@ export const setupBrowserForEditing = (options = {}) => {
43
43
  // Supports builder-model="..." attribute which is needed to
44
44
  // scope our '+ add block' button styling
45
45
  supportsAddBlockScoping: true,
46
- supportsCustomBreakpoints: true
46
+ supportsCustomBreakpoints: true,
47
+ blockLevelPersonalization: true
47
48
  }
48
49
  }, '*');
49
50
  (_window$parent2 = window.parent) === null || _window$parent2 === void 0 || _window$parent2.postMessage({
@@ -1 +1 @@
1
- {"version":3,"names":["SDK_VERSION","TARGET","isBrowser","isFromTrustedHost","register","registerInsertMenu","name","default","items","isSetupForEditing","setupBrowserForEditing","options","_window$parent","_window$parent2","window","parent","postMessage","type","data","target","version","supportsPatchUpdates","supportsAddBlockScoping","supportsCustomBreakpoints","addEventListener","event","trustedHosts","text","args","arguments","id","fn","Function","result","error","apply","err","_window$parent3","message","then","finalResult","_window$parent4","catch","console","_window$parent5"],"sourceRoot":"../../../../src","sources":["scripts/init-editing.ts"],"mappings":"AAAA,SAASA,WAAW;AACpB,SAASC,MAAM;AACf,SAASC,SAAS;AAClB,SAASC,iBAAiB;AAC1B,SAASC,QAAQ;AACjB,OAAO,MAAMC,kBAAkB,GAAGA,CAAA,KAAM;EACtCD,QAAQ,CAAC,YAAY,EAAE;IACrBE,IAAI,EAAE,UAAU;IAChBC,OAAO,EAAE,IAAI;IACbC,KAAK,EAAE,CAAC;MACNF,IAAI,EAAE;IACR,CAAC,EAAE;MACDA,IAAI,EAAE;IACR,CAAC,EAAE;MACDA,IAAI,EAAE;IACR,CAAC,EAAE;MACDA,IAAI,EAAE;IACR,CAAC,EAAE,IAAIL,MAAM,KAAK,aAAa,GAAG,EAAE,GAAG,CAAC;MACtCK,IAAI,EAAE;IACR,CAAC,EAAE;MACDA,IAAI,EAAE;IACR,CAAC,EAAE;MACDA,IAAI,EAAE;IACR,CAAC,EAAE;MACDA,IAAI,EAAE;IACR,CAAC,CAAC,CAAC;EACL,CAAC,CAAC;AACJ,CAAC;AACD,IAAIG,iBAAiB,GAAG,KAAK;AAC7B,OAAO,MAAMC,sBAAsB,GAAGA,CAACC,OAKtC,GAAG,CAAC,CAAC,KAAK;EACT,IAAIF,iBAAiB,EAAE;IACrB;EACF;EACAA,iBAAiB,GAAG,IAAI;EACxB,IAAIP,SAAS,CAAC,CAAC,EAAE;IAAA,IAAAU,cAAA,EAAAC,eAAA;IACf,CAAAD,cAAA,GAAAE,MAAM,CAACC,MAAM,cAAAH,cAAA,eAAbA,cAAA,CAAeI,WAAW,CAAC;MACzBC,IAAI,EAAE,iBAAiB;MACvBC,IAAI,EAAE;QACJC,MAAM,EAAElB,MAAM;QACdmB,OAAO,EAAEpB,WAAW;QACpBqB,oBAAoB,EAAE,KAAK;QAC3B;QACA;QACAC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kBACFI,KAAK,EAAEA,KAAK,CAACI;gBACf;cACF,CAAC,EAAE,GAAG,CAAC;YACT,CAAC,MAAM;cACL,IAAIL,MAAM,IAAI,OAAOA,MAAM,CAACM,IAAI,KAAK,UAAU,EAAE;gBAC9CN,MAAM,CAAkBM,IAAI,CAACC,WAAW,IAAI;kBAAA,IAAAC,eAAA;kBAC3C,CAAAA,eAAA,GAAA3B,MAAM,CAACC,MAAM,cAAA0B,eAAA,eAAbA,eAAA,CAAezB,WAAW,CAAC;oBACzBC,IAAI,EAAE,wBAAwB;oBAC9BC,IAAI,EAAE;sBACJY,EAAE;sBACFG,MAAM,EAAEO;oBACV;kBACF,CAAC,EAAE,GAAG,CAAC;gBACT,CAAC,CAAC,CAACE,KAAK,CAACC,OAAO,CAACT,KAAK,CAAC;cACzB,CAAC,MAAM;gBAAA,IAAAU,eAAA;gBACL,CAAAA,eAAA,GAAA9B,MAAM,CAACC,MAAM,cAAA6B,eAAA,eAAbA,eAAA,CAAe5B,WAAW,CAAC;kBACzBC,IAAI,EAAE,wBAAwB;kBAC9BC,IAAI,EAAE;oBACJe,MAAM;oBACNH;kBACF;gBACF,CAAC,EAAE,GAAG,CAAC;cACT;YACF;YACA;UACF;MACJ;IACF,CAAC,CAAC;EACJ;AACF,CAAC"}
1
+ {"version":3,"names":["SDK_VERSION","TARGET","isBrowser","isFromTrustedHost","register","registerInsertMenu","name","default","items","isSetupForEditing","setupBrowserForEditing","options","_window$parent","_window$parent2","window","parent","postMessage","type","data","target","version","supportsPatchUpdates","supportsAddBlockScoping","supportsCustomBreakpoints","blockLevelPersonalization","addEventListener","event","trustedHosts","text","args","arguments","id","fn","Function","result","error","apply","err","_window$parent3","message","then","finalResult","_window$parent4","catch","console","_window$parent5"],"sourceRoot":"../../../../src","sources":["scripts/init-editing.ts"],"mappings":"AAAA,SAASA,WAAW;AACpB,SAASC,MAAM;AACf,SAASC,SAAS;AAClB,SAASC,iBAAiB;AAC1B,SAASC,QAAQ;AACjB,OAAO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kBAC3C,CAAAA,eAAA,GAAA5B,MAAM,CAACC,MAAM,cAAA2B,eAAA,eAAbA,eAAA,CAAe1B,WAAW,CAAC;oBACzBC,IAAI,EAAE,wBAAwB;oBAC9BC,IAAI,EAAE;sBACJa,EAAE;sBACFG,MAAM,EAAEO;oBACV;kBACF,CAAC,EAAE,GAAG,CAAC;gBACT,CAAC,CAAC,CAACE,KAAK,CAACC,OAAO,CAACT,KAAK,CAAC;cACzB,CAAC,MAAM;gBAAA,IAAAU,eAAA;gBACL,CAAAA,eAAA,GAAA/B,MAAM,CAACC,MAAM,cAAA8B,eAAA,eAAbA,eAAA,CAAe7B,WAAW,CAAC;kBACzBC,IAAI,EAAE,wBAAwB;kBAC9BC,IAAI,EAAE;oBACJgB,MAAM;oBACNH;kBACF;gBACF,CAAC,EAAE,GAAG,CAAC;cACT;YACF;YACA;UACF;MACJ;IACF,CAAC,CAAC;EACJ;AACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ComponentInfo } from '../../types/components';
2
+ export declare const componentInfo: ComponentInfo;
3
+ //# sourceMappingURL=component-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-info.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/personalization-container/component-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,eAAO,MAAM,aAAa,EAAE,aAmC3B,CAAA"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * WARNING: This file contains functions that get stringified and inlined into the HTML at build-time.
3
+ * They cannot import anything.
4
+ */
5
+ import type { Query, UserAttributes } from '../helpers';
6
+ export declare function filterWithCustomTargeting(userAttributes: UserAttributes, query: Query[], startDate?: string, endDate?: string): boolean;
7
+ export declare const PERSONALIZATION_SCRIPT = "function getPersonalizedVariant(variants, blockId, locale) {\n if (!navigator.cookieEnabled) {\n return;\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) == ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n function removeVariants() {\n variants?.forEach(function (_, index) {\n document.querySelector('template[data-variant-id=\"' + blockId + '-' + index + '\"]')?.remove();\n });\n document.querySelector('script[data-id=\"variants-script-' + blockId + '\"]')?.remove();\n document.querySelector('style[data-id=\"variants-styles-' + blockId + '\"]')?.remove();\n }\n const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');\n if (locale) {\n attributes.locale = locale;\n }\n const winningVariantIndex = variants?.findIndex(function (variant) {\n return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);\n });\n const isDebug = location.href.includes('builder.debug=true');\n if (isDebug) {\n console.debug('PersonalizationContainer', {\n attributes,\n variants,\n winningVariantIndex\n });\n }\n if (winningVariantIndex !== -1) {\n const winningVariant = document.querySelector('template[data-variant-id=\"' + blockId + '-' + winningVariantIndex + '\"]');\n if (winningVariant) {\n const parentNode = winningVariant.parentNode;\n if (parentNode) {\n const newParent = parentNode.cloneNode(false);\n newParent.appendChild(winningVariant.content.firstChild);\n newParent.appendChild(winningVariant.content.lastChild);\n parentNode.parentNode?.replaceChild(newParent, parentNode);\n }\n if (isDebug) {\n console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);\n }\n }\n } else if (variants && variants.length > 0) {\n removeVariants();\n }\n}";
8
+ export declare const FILTER_WITH_CUSTOM_TARGETING_SCRIPT = "function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {\n function isString(val) {\n return typeof val === 'string';\n }\n function isNumber(val) {\n return typeof val === 'number';\n }\n function objectMatchesQuery(userattr, query) {\n const result = (() => {\n const property = query.property;\n const operator = query.operator;\n let testValue = query.value;\n if (query && query.property === 'urlPath' && query.value && typeof query.value === 'string' && query.value !== '/' && query.value.endsWith('/')) {\n testValue = query.value.slice(0, -1);\n }\n if (!(property && operator)) {\n return true;\n }\n if (Array.isArray(testValue)) {\n if (operator === 'isNot') {\n return testValue.every(val => objectMatchesQuery(userattr, {\n property,\n operator,\n value: val\n }));\n }\n return !!testValue.find(val => objectMatchesQuery(userattr, {\n property,\n operator,\n value: val\n }));\n }\n const value = userattr[property];\n if (Array.isArray(value)) {\n return value.includes(testValue);\n }\n switch (operator) {\n case 'is':\n return value === testValue;\n case 'isNot':\n return value !== testValue;\n case 'contains':\n return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));\n case 'startsWith':\n return isString(value) && value.startsWith(String(testValue));\n case 'endsWith':\n return isString(value) && value.endsWith(String(testValue));\n case 'greaterThan':\n return isNumber(value) && isNumber(testValue) && value > testValue;\n case 'lessThan':\n return isNumber(value) && isNumber(testValue) && value < testValue;\n case 'greaterThanOrEqualTo':\n return isNumber(value) && isNumber(testValue) && value >= testValue;\n case 'lessThanOrEqualTo':\n return isNumber(value) && isNumber(testValue) && value <= testValue;\n default:\n return false;\n }\n })();\n return result;\n }\n const item = {\n query,\n startDate,\n endDate\n };\n const now = userAttributes.date && new Date(userAttributes.date) || new Date();\n if (item.startDate && new Date(item.startDate) > now) {\n return false;\n } else if (item.endDate && new Date(item.endDate) < now) {\n return false;\n }\n if (!item.query || !item.query.length) {\n return true;\n }\n return item.query.every(filter => {\n return objectMatchesQuery(userAttributes, filter);\n });\n}";
9
+ //# sourceMappingURL=inlined-fns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inlined-fns.d.ts","sourceRoot":"","sources":["../../../../../../src/blocks/personalization-container/helpers/inlined-fns.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAExD,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,WA8E7H;AACD,eAAO,MAAM,sBAAsB,ykEAAykE,CAAC;AAC7mE,eAAO,MAAM,mCAAmC,+pFAA+pF,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { BuilderBlock } from '../../types/builder-block';
2
+ import type { PersonalizationContainerProps } from './personalization-container.types';
3
+ export type UserAttributes = {
4
+ date?: string | Date;
5
+ urlPath?: string;
6
+ [key: string]: any;
7
+ };
8
+ type QueryOperator = 'is' | 'isNot' | 'contains' | 'startsWith' | 'endsWith' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqualTo' | 'lessThanOrEqualTo';
9
+ type QueryValue = string | number | boolean | Array<string | number | boolean>;
10
+ export type Query = {
11
+ property: string;
12
+ operator: QueryOperator;
13
+ value: QueryValue;
14
+ };
15
+ export declare function checkShouldRenderVariants(variants: PersonalizationContainerProps['variants'], canTrack: boolean): boolean;
16
+ export declare function getBlocksToRender({ variants, previewingIndex, isHydrated, filteredVariants, fallbackBlocks }: {
17
+ variants: PersonalizationContainerProps['variants'];
18
+ previewingIndex?: number | null;
19
+ isHydrated: boolean;
20
+ filteredVariants: PersonalizationContainerProps['variants'];
21
+ fallbackBlocks?: BuilderBlock[];
22
+ }): {
23
+ blocks: BuilderBlock[];
24
+ path: string | undefined;
25
+ };
26
+ export declare const getPersonalizationScript: (variants: PersonalizationContainerProps['variants'], blockId: string, locale?: string) => string;
27
+ export { filterWithCustomTargeting } from './helpers/inlined-fns';
28
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/personalization-container/helpers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AACvF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC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d.ts","sourceRoot":"","sources":["../../../../../src/blocks/personalization-container/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA"}
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ import type { PersonalizationContainerProps } from "./personalization-container.types";
3
+ declare function PersonalizationContainer(props: PersonalizationContainerProps): React.JSX.Element;
4
+ export default PersonalizationContainer;
5
+ //# sourceMappingURL=personalization-container.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personalization-container.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/personalization-container/personalization-container.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA4B/B,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAEvF,iBAAS,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,qBA+IrE;AAED,eAAe,wBAAwB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { BuilderBlock } from '../../types/builder-block';
2
+ import type { BuilderDataProps } from '../../types/builder-props';
3
+ import type { Query } from './helpers';
4
+ export type PersonalizationContainerProps = {
5
+ children?: any;
6
+ attributes?: any;
7
+ previewingIndex?: number | null;
8
+ variants?: Array<{
9
+ blocks: BuilderBlock[];
10
+ query: Query[];
11
+ startDate?: string;
12
+ endDate?: string;
13
+ }>;
14
+ } & BuilderDataProps;
15
+ //# sourceMappingURL=personalization-container.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personalization-container.types.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/personalization-container/personalization-container.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACvC,MAAM,MAAM,6BAA6B,GAAG;IAC1C,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,EAAE,KAAK,CAAC;QACf,MAAM,EAAE,YAAY,EAAE,CAAC;QACvB,KAAK,EAAE,KAAK,EAAE,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ,GAAG,gBAAgB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"blocks-wrapper.d.ts","sourceRoot":"","sources":["../../../../../src/components/blocks/blocks-wrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,YAAY,EAAE,GAAG,SAAS,CAAC;IACnC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;IAC3C;;OAEG;IACH,aAAa,EAAE,GAAG,CAAC;IACnB;;OAEG;IACH,kBAAkB,EAAE,GAAG,CAAC;IACxB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,iBAAS,aAAa,CAAC,KAAK,EAAE,kBAAkB,qBA4F/C;AAMD,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"blocks-wrapper.d.ts","sourceRoot":"","sources":["../../../../../src/components/blocks/blocks-wrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,YAAY,EAAE,GAAG,SAAS,CAAC;IACnC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;IAC3C;;OAEG;IACH,aAAa,EAAE,GAAG,CAAC;IACnB;;OAEG;IACH,kBAAkB,EAAE,GAAG,CAAC;IACxB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,iBAAS,aAAa,CAAC,KAAK,EAAE,kBAAkB,qBA+F/C;AAMD,eAAe,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"builder-registered-components.d.ts","sourceRoot":"","sources":["../../../../src/constants/builder-registered-components.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAI5D;;;GAGG;AACH,eAAO,MAAM,8BAA8B,EAAE,MAAM,mBAAmB,EA8BzC,CAAA"}
1
+ {"version":3,"file":"builder-registered-components.d.ts","sourceRoot":"","sources":["../../../../src/constants/builder-registered-components.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAI5D;;;GAGG;AACH,eAAO,MAAM,8BAA8B,EAAE,MAAM,mBAAmB,EAiCzC,CAAA"}
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "3.0.5";
1
+ export declare const SDK_VERSION = "3.0.6";
2
2
  //# sourceMappingURL=sdk-version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"canTrack.d.ts","sourceRoot":"","sources":["../../../../src/helpers/canTrack.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB,cAAe,OAAO,YAA+C,CAAA"}
1
+ {"version":3,"file":"canTrack.d.ts","sourceRoot":"","sources":["../../../../src/helpers/canTrack.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,cAAe,OAAO,YAIpD,CAAA"}
@@ -0,0 +1,18 @@
1
+ export interface UserAttributes {
2
+ [key: string]: any;
3
+ }
4
+ export declare const USER_ATTRIBUTES_COOKIE_NAME = "builder.userAttributes";
5
+ export declare function createUserAttributesService(): {
6
+ setUserAttributes(newAttrs: UserAttributes): void;
7
+ getUserAttributes(): any;
8
+ subscribeOnUserAttributesChange(callback: (attrs: UserAttributes) => void): () => void;
9
+ setCanTrack(value: boolean): void;
10
+ };
11
+ export declare const userAttributesService: {
12
+ setUserAttributes(newAttrs: UserAttributes): void;
13
+ getUserAttributes(): any;
14
+ subscribeOnUserAttributesChange(callback: (attrs: UserAttributes) => void): () => void;
15
+ setCanTrack(value: boolean): void;
16
+ };
17
+ export declare const setClientUserAttributes: (attributes: UserAttributes) => void;
18
+ //# sourceMappingURL=user-attributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-attributes.d.ts","sourceRoot":"","sources":["../../../../src/helpers/user-attributes.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AACD,eAAO,MAAM,2BAA2B,2BAA2B,CAAC;AACpE,wBAAgB,2BAA2B;gCAIX,cAAc;;sDAwBQ,cAAc,KAAK,IAAI;uBAMtD,OAAO;EAI7B;AACD,eAAO,MAAM,qBAAqB;gCAnCF,cAAc;;sDAwBQ,cAAc,KAAK,IAAI;uBAMtD,OAAO;CAKoC,CAAC;AACnE,eAAO,MAAM,uBAAuB,eAAgB,cAAc,SAEjE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"init-editing.d.ts","sourceRoot":"","sources":["../../../../src/scripts/init-editing.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB,YAsB9B,CAAC;AAEF,eAAO,MAAM,sBAAsB,aAAa;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB,SAoFA,CAAA"}
1
+ {"version":3,"file":"init-editing.d.ts","sourceRoot":"","sources":["../../../../src/scripts/init-editing.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB,YAsB9B,CAAC;AAEF,eAAO,MAAM,sBAAsB,aAAa;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB,SAqFA,CAAA"}
@@ -124,6 +124,7 @@ export interface Input {
124
124
  * Use optionally with inputs of type `reference`. Restricts the content entry picker to a specific model by name.
125
125
  */
126
126
  model?: string;
127
+ behavior?: string;
127
128
  valueType?: {
128
129
  type?: string;
129
130
  };
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../src/types/input.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,gGAAgG;IAChG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH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C,EAAE,OAAO,CAAC;IACf,cAAc;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc;IACd,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,GAAG,MAAM,CAAC;IAC3D,cAAc;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE;QACV,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,QAAQ,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC;IAC9G,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.componentInfo = void 0;
7
+ const componentInfo = exports.componentInfo = {
8
+ name: 'PersonalizationContainer',
9
+ shouldReceiveBuilderProps: {
10
+ builderBlock: true,
11
+ builderContext: true
12
+ },
13
+ noWrap: true,
14
+ image: 'https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a',
15
+ canHaveChildren: true,
16
+ inputs: [{
17
+ name: 'variants',
18
+ defaultValue: [],
19
+ behavior: 'personalizationVariantList',
20
+ type: 'list',
21
+ subFields: [{
22
+ name: 'name',
23
+ type: 'text'
24
+ }, {
25
+ name: 'query',
26
+ friendlyName: 'Targeting rules',
27
+ type: 'BuilderQuery',
28
+ defaultValue: []
29
+ }, {
30
+ name: 'startDate',
31
+ type: 'date'
32
+ }, {
33
+ name: 'endDate',
34
+ type: 'date'
35
+ }, {
36
+ name: 'blocks',
37
+ type: 'uiBlocks',
38
+ hideFromUI: true,
39
+ defaultValue: []
40
+ }]
41
+ }]
42
+ };
43
+ //# sourceMappingURL=component-info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["componentInfo","exports","name","shouldReceiveBuilderProps","builderBlock","builderContext","noWrap","image","canHaveChildren","inputs","defaultValue","behavior","type","subFields","friendlyName","hideFromUI"],"sourceRoot":"../../../../../src","sources":["blocks/personalization-container/component-info.ts"],"mappings":";;;;;;AACO,MAAMA,aAA4B,GAAAC,OAAA,CAAAD,aAAA,GAAG;EAC1CE,IAAI,EAAE,0BAA0B;EAChCC,yBAAyB,EAAE;IACzBC,YAAY,EAAE,IAAI;IAClBC,cAAc,EAAE;EAClB,CAAC;EACDC,MAAM,EAAE,IAAI;EACZC,KAAK,EAAE,sGAAsG;EAC7GC,eAAe,EAAE,IAAI;EACrBC,MAAM,EAAE,CAAC;IACPP,IAAI,EAAE,UAAU;IAChBQ,YAAY,EAAE,EAAE;IAChBC,QAAQ,EAAE,4BAA4B;IACtCC,IAAI,EAAE,MAAM;IACZC,SAAS,EAAE,CAAC;MACVX,IAAI,EAAE,MAAM;MACZU,IAAI,EAAE;IACR,CAAC,EAAE;MACDV,IAAI,EAAE,OAAO;MACbY,YAAY,EAAE,iBAAiB;MAC/BF,IAAI,EAAE,cAAc;MACpBF,YAAY,EAAE;IAChB,CAAC,EAAE;MACDR,IAAI,EAAE,WAAW;MACjBU,IAAI,EAAE;IACR,CAAC,EAAE;MACDV,IAAI,EAAE,SAAS;MACfU,IAAI,EAAE;IACR,CAAC,EAAE;MACDV,IAAI,EAAE,QAAQ;MACdU,IAAI,EAAE,UAAU;MAChBG,UAAU,EAAE,IAAI;MAChBL,YAAY,EAAE;IAChB,CAAC;EACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PERSONALIZATION_SCRIPT = exports.FILTER_WITH_CUSTOM_TARGETING_SCRIPT = void 0;
7
+ exports.filterWithCustomTargeting = filterWithCustomTargeting;
8
+ /**
9
+ * WARNING: This file contains functions that get stringified and inlined into the HTML at build-time.
10
+ * They cannot import anything.
11
+ */
12
+
13
+ function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
14
+ function isString(val) {
15
+ return typeof val === 'string';
16
+ }
17
+ function isNumber(val) {
18
+ return typeof val === 'number';
19
+ }
20
+ function objectMatchesQuery(userattr, query) {
21
+ const result = (() => {
22
+ const property = query.property;
23
+ const operator = query.operator;
24
+ let testValue = query.value;
25
+ if (query && query.property === 'urlPath' && query.value && typeof query.value === 'string' && query.value !== '/' && query.value.endsWith('/')) {
26
+ testValue = query.value.slice(0, -1);
27
+ }
28
+ if (!(property && operator)) {
29
+ return true;
30
+ }
31
+ if (Array.isArray(testValue)) {
32
+ if (operator === 'isNot') {
33
+ return testValue.every(val => objectMatchesQuery(userattr, {
34
+ property,
35
+ operator,
36
+ value: val
37
+ }));
38
+ }
39
+ return !!testValue.find(val => objectMatchesQuery(userattr, {
40
+ property,
41
+ operator,
42
+ value: val
43
+ }));
44
+ }
45
+ const value = userattr[property];
46
+ if (Array.isArray(value)) {
47
+ return value.includes(testValue);
48
+ }
49
+ switch (operator) {
50
+ case 'is':
51
+ return value === testValue;
52
+ case 'isNot':
53
+ return value !== testValue;
54
+ case 'contains':
55
+ return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
56
+ case 'startsWith':
57
+ return isString(value) && value.startsWith(String(testValue));
58
+ case 'endsWith':
59
+ return isString(value) && value.endsWith(String(testValue));
60
+ case 'greaterThan':
61
+ return isNumber(value) && isNumber(testValue) && value > testValue;
62
+ case 'lessThan':
63
+ return isNumber(value) && isNumber(testValue) && value < testValue;
64
+ case 'greaterThanOrEqualTo':
65
+ return isNumber(value) && isNumber(testValue) && value >= testValue;
66
+ case 'lessThanOrEqualTo':
67
+ return isNumber(value) && isNumber(testValue) && value <= testValue;
68
+ default:
69
+ return false;
70
+ }
71
+ })();
72
+ return result;
73
+ }
74
+ const item = {
75
+ query,
76
+ startDate,
77
+ endDate
78
+ };
79
+ const now = userAttributes.date && new Date(userAttributes.date) || new Date();
80
+ if (item.startDate && new Date(item.startDate) > now) {
81
+ return false;
82
+ } else if (item.endDate && new Date(item.endDate) < now) {
83
+ return false;
84
+ }
85
+ if (!item.query || !item.query.length) {
86
+ return true;
87
+ }
88
+ return item.query.every(filter => {
89
+ return objectMatchesQuery(userAttributes, filter);
90
+ });
91
+ }
92
+ const PERSONALIZATION_SCRIPT = exports.PERSONALIZATION_SCRIPT = "function getPersonalizedVariant(variants, blockId, locale) {\n if (!navigator.cookieEnabled) {\n return;\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) == ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n function removeVariants() {\n variants?.forEach(function (_, index) {\n document.querySelector('template[data-variant-id=\"' + blockId + '-' + index + '\"]')?.remove();\n });\n document.querySelector('script[data-id=\"variants-script-' + blockId + '\"]')?.remove();\n document.querySelector('style[data-id=\"variants-styles-' + blockId + '\"]')?.remove();\n }\n const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');\n if (locale) {\n attributes.locale = locale;\n }\n const winningVariantIndex = variants?.findIndex(function (variant) {\n return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);\n });\n const isDebug = location.href.includes('builder.debug=true');\n if (isDebug) {\n console.debug('PersonalizationContainer', {\n attributes,\n variants,\n winningVariantIndex\n });\n }\n if (winningVariantIndex !== -1) {\n const winningVariant = document.querySelector('template[data-variant-id=\"' + blockId + '-' + winningVariantIndex + '\"]');\n if (winningVariant) {\n const parentNode = winningVariant.parentNode;\n if (parentNode) {\n const newParent = parentNode.cloneNode(false);\n newParent.appendChild(winningVariant.content.firstChild);\n newParent.appendChild(winningVariant.content.lastChild);\n parentNode.parentNode?.replaceChild(newParent, parentNode);\n }\n if (isDebug) {\n console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);\n }\n }\n } else if (variants && variants.length > 0) {\n removeVariants();\n }\n}";
93
+ const FILTER_WITH_CUSTOM_TARGETING_SCRIPT = exports.FILTER_WITH_CUSTOM_TARGETING_SCRIPT = "function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {\n function isString(val) {\n return typeof val === 'string';\n }\n function isNumber(val) {\n return typeof val === 'number';\n }\n function objectMatchesQuery(userattr, query) {\n const result = (() => {\n const property = query.property;\n const operator = query.operator;\n let testValue = query.value;\n if (query && query.property === 'urlPath' && query.value && typeof query.value === 'string' && query.value !== '/' && query.value.endsWith('/')) {\n testValue = query.value.slice(0, -1);\n }\n if (!(property && operator)) {\n return true;\n }\n if (Array.isArray(testValue)) {\n if (operator === 'isNot') {\n return testValue.every(val => objectMatchesQuery(userattr, {\n property,\n operator,\n value: val\n }));\n }\n return !!testValue.find(val => objectMatchesQuery(userattr, {\n property,\n operator,\n value: val\n }));\n }\n const value = userattr[property];\n if (Array.isArray(value)) {\n return value.includes(testValue);\n }\n switch (operator) {\n case 'is':\n return value === testValue;\n case 'isNot':\n return value !== testValue;\n case 'contains':\n return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));\n case 'startsWith':\n return isString(value) && value.startsWith(String(testValue));\n case 'endsWith':\n return isString(value) && value.endsWith(String(testValue));\n case 'greaterThan':\n return isNumber(value) && isNumber(testValue) && value > testValue;\n case 'lessThan':\n return isNumber(value) && isNumber(testValue) && value < testValue;\n case 'greaterThanOrEqualTo':\n return isNumber(value) && isNumber(testValue) && value >= testValue;\n case 'lessThanOrEqualTo':\n return isNumber(value) && isNumber(testValue) && value <= testValue;\n default:\n return false;\n }\n })();\n return result;\n }\n const item = {\n query,\n startDate,\n endDate\n };\n const now = userAttributes.date && new Date(userAttributes.date) || new Date();\n if (item.startDate && new Date(item.startDate) > now) {\n return false;\n } else if (item.endDate && new Date(item.endDate) < now) {\n return false;\n }\n if (!item.query || !item.query.length) {\n return true;\n }\n return item.query.every(filter => {\n return objectMatchesQuery(userAttributes, filter);\n });\n}";
94
+ //# sourceMappingURL=inlined-fns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["filterWithCustomTargeting","userAttributes","query","startDate","endDate","isString","val","isNumber","objectMatchesQuery","userattr","result","property","operator","testValue","value","endsWith","slice","Array","isArray","every","find","includes","String","startsWith","item","now","date","Date","length","filter","PERSONALIZATION_SCRIPT","exports","FILTER_WITH_CUSTOM_TARGETING_SCRIPT"],"sourceRoot":"../../../../../../src","sources":["blocks/personalization-container/helpers/inlined-fns.ts"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;;AAIO,SAASA,yBAAyBA,CAACC,cAA8B,EAAEC,KAAc,EAAEC,SAAkB,EAAEC,OAAgB,EAAE;EAC9H,SAASC,QAAQA,CAACC,GAAY,EAAiB;IAC7C,OAAO,OAAOA,GAAG,KAAK,QAAQ;EAChC;EACA,SAASC,QAAQA,CAACD,GAAY,EAAiB;IAC7C,OAAO,OAAOA,GAAG,KAAK,QAAQ;EAChC;EACA,SAASE,kBAAkBA,CAACC,QAAwB,EAAEP,KAAY,EAAW;IAC3E,MAAMQ,MAAM,GAAG,CAAC,MAAM;MACpB,MAAMC,QAAQ,GAAGT,KAAK,CAACS,QAAQ;MAC/B,MAAMC,QAAQ,GAAGV,KAAK,CAACU,QAAQ;MAC/B,IAAIC,SAAS,GAAGX,KAAK,CAACY,KAAK;MAC3B,IAAIZ,KAAK,IAAIA,KAAK,CAACS,QAAQ,KAAK,SAAS,IAAIT,KAAK,CAACY,KAAK,IAAI,OAAOZ,KAAK,CAACY,KAAK,KAAK,QAAQ,IAAIZ,KAAK,CAACY,KAAK,KAAK,GAAG,IAA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AACiB,KAAK,CAAEU,MAAa,IAAK;IACzC,OAAOrB,kBAAkB,CAACP,cAAc,EAAE4B,MAAM,CAAC;EACnD,CAAC,CAAC;AACJ;AACO,MAAMC,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,skEAAskE;AACrmE,MAAME,mCAAmC,GAAAD,OAAA,CAAAC,mCAAA,GAAG,4pFAA4pF"}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.checkShouldRenderVariants = checkShouldRenderVariants;
7
+ Object.defineProperty(exports, "filterWithCustomTargeting", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _inlinedFns.filterWithCustomTargeting;
11
+ }
12
+ });
13
+ exports.getBlocksToRender = getBlocksToRender;
14
+ exports.getPersonalizationScript = void 0;
15
+ var _target = require("../../constants/target");
16
+ var _isBrowser = require("../../functions/is-browser");
17
+ var _isEditing = require("../../functions/is-editing");
18
+ var _inlinedFns = require("./helpers/inlined-fns");
19
+ function checkShouldRenderVariants(variants, canTrack) {
20
+ const hasVariants = variants && variants.length > 0;
21
+ if (_target.TARGET === 'reactNative') return false;
22
+ if (!hasVariants) return false;
23
+ if (!canTrack) return false;
24
+ if (_target.TARGET === 'vue' || _target.TARGET === 'svelte') return true;
25
+ if ((0, _isBrowser.isBrowser)()) return false;
26
+ return true;
27
+ }
28
+ function getBlocksToRender({
29
+ variants,
30
+ previewingIndex,
31
+ isHydrated,
32
+ filteredVariants,
33
+ fallbackBlocks
34
+ }) {
35
+ const fallback = {
36
+ blocks: fallbackBlocks ?? [],
37
+ path: 'this.children'
38
+ };
39
+ if (isHydrated && (0, _isEditing.isEditing)()) {
40
+ // If editing a specific variant
41
+ if (typeof previewingIndex === 'number' && previewingIndex < ((variants === null || variants === void 0 ? void 0 : variants.length) ?? 0)) {
42
+ const variant = variants[previewingIndex];
43
+ return {
44
+ blocks: variant.blocks,
45
+ path: `component.options.variants.${previewingIndex}.blocks`
46
+ };
47
+ }
48
+ // Otherwise we're editing the default variant
49
+ return fallback;
50
+ }
51
+
52
+ // If we're on the browser, check if there's a winning variant
53
+ if ((0, _isBrowser.isBrowser)()) {
54
+ const winningVariant = filteredVariants === null || filteredVariants === void 0 ? void 0 : filteredVariants[0];
55
+ if (winningVariant) {
56
+ return {
57
+ blocks: winningVariant.blocks,
58
+ path: `component.options.variants.${variants === null || variants === void 0 ? void 0 : variants.indexOf(winningVariant)}.blocks`
59
+ };
60
+ }
61
+ }
62
+
63
+ // If no winning variant or we are on the server, return the default variant
64
+ return fallback;
65
+ }
66
+ const getPersonalizationScript = (variants, blockId, locale) => {
67
+ return `
68
+ (function() {
69
+ ${_inlinedFns.FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
70
+ ${_inlinedFns.PERSONALIZATION_SCRIPT}
71
+ getPersonalizedVariant(${JSON.stringify(variants)}, "${blockId}"${locale ? `, "${locale}"` : ''})
72
+ })();
73
+ `;
74
+ };
75
+ exports.getPersonalizationScript = getPersonalizationScript;
76
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_target","require","_isBrowser","_isEditing","_inlinedFns","checkShouldRenderVariants","variants","canTrack","hasVariants","length","TARGET","isBrowser","getBlocksToRender","previewingIndex","isHydrated","filteredVariants","fallbackBlocks","fallback","blocks","path","isEditing","variant","winningVariant","indexOf","getPersonalizationScript","blockId","locale","FILTER_WITH_CUSTOM_TARGETING_SCRIPT","PERSONALIZATION_SCRIPT","JSON","stringify","exports"],"sourceRoot":"../../../../../src","sources":["blocks/personalization-container/helpers.ts"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AAcO,SAASI,yBAAyBA,CAACC,QAAmD,EAAEC,QAAiB,EAAE;EAChH,MAAMC,WAAW,GAAGF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c,CAAE;MACxE,CAAC;IACH;EACF;;EAEA;EACA,OAAOL,QAAQ;AACjB;AACO,MAAMO,wBAAwB,GAAGA,CAAClB,QAAmD,EAAEmB,OAAe,EAAEC,MAAe,KAAK;EACjI,OAAQ;AACV;AACA,MAAMC,+CAAoC;AAC1C,MAAMC,kCAAuB;AAC7B,6BAA6BC,IAAI,CAACC,SAAS,CAACxB,QAAQ,CAAE,MAAKmB,OAAQ,IAAGC,MAAM,GAAI,MAAKA,MAAO,GAAE,GAAG,EAAG;AACpG;AACA,GAAG;AACH,CAAC;AAACK,OAAA,CAAAP,wBAAA,GAAAA,wBAAA"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "default", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _personalizationContainer.default;
10
+ }
11
+ });
12
+ var _personalizationContainer = _interopRequireDefault(require("./personalization-container"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_personalizationContainer","_interopRequireDefault","require","obj","__esModule","default"],"sourceRoot":"../../../../../src","sources":["blocks/personalization-container/index.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,yBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAqD,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var React = _react;
9
+ var _reactNative = require("react-native");
10
+ var _blocks = _interopRequireDefault(require("../../components/blocks/blocks"));
11
+ var _inlinedScript = _interopRequireDefault(require("../../components/inlined-script"));
12
+ var _inlinedStyles = _interopRequireDefault(require("../../components/inlined-styles"));
13
+ var _isEditing = require("../../functions/is-editing");
14
+ var _isPreviewing = require("../../functions/is-previewing");
15
+ var _canTrack = require("../../helpers/canTrack");
16
+ var _userAttributes = require("../../helpers/user-attributes");
17
+ var _helpers = require("./helpers");
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
20
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
22
+ function PersonalizationContainer(props) {
23
+ var _props$variants, _props$builderContext7, _props$builderBlock6, _props$builderContext8, _props$builderBlock7, _props$builderBlock8;
24
+ const rootRef = (0, _react.useRef)(null);
25
+ const [userAttributes, setUserAttributes] = (0, _react.useState)(() => _userAttributes.userAttributesService.getUserAttributes());
26
+ const [scriptStr, setScriptStr] = (0, _react.useState)(() => {
27
+ var _props$builderBlock, _props$builderContext;
28
+ return (0, _helpers.getPersonalizationScript)(props.variants, ((_props$builderBlock = props.builderBlock) === null || _props$builderBlock === void 0 ? void 0 : _props$builderBlock.id) || "none", (_props$builderContext = props.builderContext) === null || _props$builderContext === void 0 || (_props$builderContext = _props$builderContext.rootState) === null || _props$builderContext === void 0 ? void 0 : _props$builderContext.locale);
29
+ });
30
+ const [unsubscribers, setUnsubscribers] = (0, _react.useState)(() => []);
31
+ const [shouldRenderVariants, setShouldRenderVariants] = (0, _react.useState)(() => {
32
+ var _props$builderContext2;
33
+ return (0, _helpers.checkShouldRenderVariants)(props.variants, (0, _canTrack.getDefaultCanTrack)((_props$builderContext2 = props.builderContext) === null || _props$builderContext2 === void 0 ? void 0 : _props$builderContext2.canTrack));
34
+ });
35
+ const [isHydrated, setIsHydrated] = (0, _react.useState)(() => false);
36
+ function filteredVariants() {
37
+ return (props.variants || []).filter(variant => {
38
+ var _props$builderContext3, _props$builderContext4;
39
+ return (0, _helpers.filterWithCustomTargeting)({
40
+ ...((_props$builderContext3 = props.builderContext) !== null && _props$builderContext3 !== void 0 && (_props$builderContext3 = _props$builderContext3.rootState) !== null && _props$builderContext3 !== void 0 && _props$builderContext3.locale ? {
41
+ locale: (_props$builderContext4 = props.builderContext) === null || _props$builderContext4 === void 0 || (_props$builderContext4 = _props$builderContext4.rootState) === null || _props$builderContext4 === void 0 ? void 0 : _props$builderContext4.locale
42
+ } : {}),
43
+ ...userAttributes
44
+ }, variant.query, variant.startDate, variant.endDate);
45
+ });
46
+ }
47
+ function blocksToRender() {
48
+ var _props$builderBlock2;
49
+ return (0, _helpers.getBlocksToRender)({
50
+ variants: props.variants,
51
+ fallbackBlocks: (_props$builderBlock2 = props.builderBlock) === null || _props$builderBlock2 === void 0 ? void 0 : _props$builderBlock2.children,
52
+ isHydrated: isHydrated,
53
+ filteredVariants: filteredVariants(),
54
+ previewingIndex: props.previewingIndex
55
+ });
56
+ }
57
+ function hideVariantsStyleString() {
58
+ return (props.variants || []).map((_, index) => {
59
+ var _props$builderBlock3;
60
+ return `[data-variant-id="${(_props$builderBlock3 = props.builderBlock) === null || _props$builderBlock3 === void 0 ? void 0 : _props$builderBlock3.id}-${index}"] { display: none; } `;
61
+ }).join("");
62
+ }
63
+ (0, _react.useEffect)(() => {
64
+ setIsHydrated(true);
65
+ const unsub = _userAttributes.userAttributesService.subscribeOnUserAttributesChange(attrs => {
66
+ setUserAttributes(attrs);
67
+ });
68
+ if (!((0, _isEditing.isEditing)() || (0, _isPreviewing.isPreviewing)())) {
69
+ const variant = filteredVariants()[0];
70
+ if (rootRef.current) {
71
+ var _props$builderContext5;
72
+ rootRef.current.dispatchEvent(new CustomEvent("builder.variantLoaded", {
73
+ detail: {
74
+ variant: variant || "default",
75
+ content: (_props$builderContext5 = props.builderContext) === null || _props$builderContext5 === void 0 ? void 0 : _props$builderContext5.content
76
+ },
77
+ bubbles: true
78
+ }));
79
+ const observer = new IntersectionObserver(entries => {
80
+ entries.forEach(entry => {
81
+ if (entry.isIntersecting && rootRef.current) {
82
+ var _props$builderContext6;
83
+ rootRef.current.dispatchEvent(new CustomEvent("builder.variantDisplayed", {
84
+ detail: {
85
+ variant: variant || "default",
86
+ content: (_props$builderContext6 = props.builderContext) === null || _props$builderContext6 === void 0 ? void 0 : _props$builderContext6.content
87
+ },
88
+ bubbles: true
89
+ }));
90
+ }
91
+ });
92
+ });
93
+ observer.observe(rootRef.current);
94
+ }
95
+ }
96
+ unsubscribers.push(unsub);
97
+ }, []);
98
+ (0, _react.useEffect)(() => {
99
+ return () => {
100
+ unsubscribers.forEach(unsub => unsub());
101
+ };
102
+ }, []);
103
+ return /*#__PURE__*/React.createElement(_reactNative.View, _extends({
104
+ ref: rootRef
105
+ }, props.attributes), shouldRenderVariants ? /*#__PURE__*/React.createElement(React.Fragment, null, (_props$variants = props.variants) === null || _props$variants === void 0 ? void 0 : _props$variants.map((variant, index) => {
106
+ var _props$builderBlock4, _props$builderBlock5;
107
+ return /*#__PURE__*/React.createElement(_reactNative.View, {
108
+ key: index,
109
+ "data-variant-id": `${(_props$builderBlock4 = props.builderBlock) === null || _props$builderBlock4 === void 0 ? void 0 : _props$builderBlock4.id}-${index}`
110
+ }, /*#__PURE__*/React.createElement(_blocks.default, {
111
+ blocks: variant.blocks,
112
+ parent: (_props$builderBlock5 = props.builderBlock) === null || _props$builderBlock5 === void 0 ? void 0 : _props$builderBlock5.id,
113
+ path: `component.options.variants.${index}.blocks`
114
+ }));
115
+ }), /*#__PURE__*/React.createElement(_inlinedStyles.default, {
116
+ nonce: ((_props$builderContext7 = props.builderContext) === null || _props$builderContext7 === void 0 ? void 0 : _props$builderContext7.nonce) || "",
117
+ styles: hideVariantsStyleString(),
118
+ id: `variants-styles-${(_props$builderBlock6 = props.builderBlock) === null || _props$builderBlock6 === void 0 ? void 0 : _props$builderBlock6.id}`
119
+ }), /*#__PURE__*/React.createElement(_inlinedScript.default, {
120
+ nonce: ((_props$builderContext8 = props.builderContext) === null || _props$builderContext8 === void 0 ? void 0 : _props$builderContext8.nonce) || "",
121
+ scriptStr: scriptStr,
122
+ id: `variants-script-${(_props$builderBlock7 = props.builderBlock) === null || _props$builderBlock7 === void 0 ? void 0 : _props$builderBlock7.id}`
123
+ })) : null, /*#__PURE__*/React.createElement(_blocks.default, {
124
+ blocks: blocksToRender().blocks,
125
+ parent: (_props$builderBlock8 = props.builderBlock) === null || _props$builderBlock8 === void 0 ? void 0 : _props$builderBlock8.id,
126
+ path: blocksToRender().path
127
+ }));
128
+ }
129
+ var _default = exports.default = PersonalizationContainer;
130
+ //# sourceMappingURL=personalization-container.js.map