@beworke/pixel 0.1.0-rc.6 → 0.1.0-rc.8

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 (166) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +71 -56
  3. package/RELEASE_CANDIDATE.md +47 -75
  4. package/dist/Pixel-CCgGk43j.d.ts +797 -0
  5. package/dist/Pixel-CqbgC_72.d.mts +797 -0
  6. package/dist/{StorageFactory-tjfzk57c.d.ts → StorageFactory-BRBsnnH7.d.ts} +2 -2
  7. package/dist/{StorageFactory-CPghDPBj.d.mts → StorageFactory-Dp19Wecr.d.mts} +2 -2
  8. package/dist/browser/index.cjs.js +3 -0
  9. package/dist/browser/index.cjs.js.map +1 -0
  10. package/dist/browser/index.d.mts +55 -0
  11. package/dist/browser/index.d.ts +55 -0
  12. package/dist/browser/index.esm.js +3 -0
  13. package/dist/browser/index.esm.js.map +1 -0
  14. package/dist/browser/pixel.global.js +4 -0
  15. package/dist/browser/pixel.global.js.map +1 -0
  16. package/dist/config/index.cjs.js +1 -1
  17. package/dist/config/index.cjs.js.map +1 -1
  18. package/dist/config/index.d.mts +16 -6
  19. package/dist/config/index.d.ts +16 -6
  20. package/dist/config/index.esm.js +1 -1
  21. package/dist/config/index.esm.js.map +1 -1
  22. package/dist/events/index.cjs.js.map +1 -1
  23. package/dist/events/index.d.mts +2 -2
  24. package/dist/events/index.d.ts +2 -2
  25. package/dist/events/index.esm.js.map +1 -1
  26. package/dist/examples/html-script/README.md +20 -76
  27. package/dist/examples/html-script/RELEASE_CANDIDATE.md +20 -21
  28. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-autocomplete.html +41 -48
  29. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-disabled.html +41 -48
  30. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-fields.html +41 -48
  31. package/dist/examples/html-script/add-payment-info/example-add-payment-info-data-track.html +41 -48
  32. package/dist/examples/html-script/add-payment-info/example-add-payment-info-dedupe.html +41 -48
  33. package/dist/examples/html-script/add-payment-info/example-add-payment-info-manual.html +41 -48
  34. package/dist/examples/html-script/add-payment-info/example-add-payment-info-rules-card.html +41 -48
  35. package/dist/examples/html-script/add-payment-info/example-add-payment-info-security.html +41 -48
  36. package/dist/examples/html-script/add-to-cart/README.md +6 -3
  37. package/dist/examples/html-script/add-to-cart/example-add-to-cart-attribute.html +43 -49
  38. package/dist/examples/html-script/add-to-cart/example-add-to-cart-auto.html +43 -49
  39. package/dist/examples/html-script/add-to-cart/example-add-to-cart-click.html +43 -49
  40. package/dist/examples/html-script/add-to-cart/example-add-to-cart-dedupe.html +43 -49
  41. package/dist/examples/html-script/add-to-cart/example-add-to-cart-link.html +590 -0
  42. package/dist/examples/html-script/add-to-cart/example-add-to-cart-manual.html +43 -49
  43. package/dist/examples/html-script/add-to-cart/example-add-to-cart-order-bump.html +43 -49
  44. package/dist/examples/html-script/add-to-cart/example-add-to-cart-text.html +43 -49
  45. package/dist/examples/html-script/behavior/example-behavior-engagement.html +5 -5
  46. package/dist/examples/html-script/behavior/example-behavior-heartbeat.html +5 -5
  47. package/dist/examples/html-script/behavior/example-behavior-runtime-intelligence.html +5 -5
  48. package/dist/examples/html-script/behavior/example-behavior-viewport.html +5 -5
  49. package/dist/examples/html-script/behavior/example-behavior.html +1 -1
  50. package/dist/examples/html-script/buygoods/example-buygoods-checkout.html +83 -0
  51. package/dist/examples/html-script/example-basic.html +1 -1
  52. package/dist/examples/html-script/example-checkout-commerce.html +32 -31
  53. package/dist/examples/html-script/example-conversion.html +42 -49
  54. package/dist/examples/html-script/example-global-factory-classic.html +45 -0
  55. package/dist/examples/html-script/example-global-factory.html +40 -0
  56. package/dist/examples/html-script/example-integration.html +40 -46
  57. package/dist/examples/html-script/example-landing-commerce.html +45 -9
  58. package/dist/examples/html-script/example-runtime-diagnostics.html +5 -5
  59. package/dist/examples/html-script/example-transport.html +65 -58
  60. package/dist/examples/html-script/full-funnel/README.md +1 -1
  61. package/dist/examples/html-script/full-funnel/checkout.html +4 -2
  62. package/dist/examples/html-script/full-funnel/downsell.html +4 -2
  63. package/dist/examples/html-script/full-funnel/landing.html +57 -3
  64. package/dist/examples/html-script/full-funnel/thank-you.html +4 -2
  65. package/dist/examples/html-script/full-funnel/upsell.html +4 -2
  66. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-attribute.html +41 -48
  67. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-auto.html +41 -48
  68. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-click.html +41 -48
  69. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-manual.html +41 -48
  70. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-snapshot.html +41 -48
  71. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-submit.html +41 -48
  72. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-text.html +41 -48
  73. package/dist/examples/html-script/lead/example-lead-trigger-attribute.html +41 -48
  74. package/dist/examples/html-script/lead/example-lead-trigger-auto.html +41 -48
  75. package/dist/examples/html-script/lead/example-lead-trigger-click.html +41 -48
  76. package/dist/examples/html-script/release-candidate.html +32 -31
  77. package/dist/examples/html-script/remove-from-cart/README.md +3 -3
  78. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-attribute.html +41 -48
  79. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-css.html +41 -48
  80. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-dedupe.html +48 -55
  81. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-manual.html +41 -48
  82. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-multi.html +41 -48
  83. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-state.html +41 -48
  84. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-text.html +41 -48
  85. package/dist/examples/html-script/search/example-search-attribute.html +41 -48
  86. package/dist/examples/html-script/search/example-search-button-sync.html +41 -48
  87. package/dist/examples/html-script/search/example-search-dedupe.html +41 -48
  88. package/dist/examples/html-script/search/example-search-input.html +41 -48
  89. package/dist/examples/html-script/search/example-search-manual.html +41 -48
  90. package/dist/examples/html-script/search/example-search-submit.html +41 -48
  91. package/dist/examples/html-script/search/example-search-text.html +41 -48
  92. package/dist/examples/html-script/url-context/example-url-context-allowed-domains.html +38 -9
  93. package/dist/examples/html-script/url-context/example-url-context-landing.html +53 -13
  94. package/dist/examples/html-script/url-context/example-url-context-upsell.html +48 -10
  95. package/dist/examples/html-script/url-context/example-url-context.html +55 -21
  96. package/dist/examples/html-script/view-content/example-view-content-attribute.html +41 -48
  97. package/dist/examples/html-script/view-content/example-view-content-css.html +41 -48
  98. package/dist/examples/html-script/view-content/example-view-content-dedupe.html +41 -48
  99. package/dist/examples/html-script/view-content/example-view-content-empty.html +41 -48
  100. package/dist/examples/html-script/view-content/example-view-content-manual.html +41 -48
  101. package/dist/examples/html-script/view-content/example-view-content-product-card.html +41 -48
  102. package/dist/examples/html-script/view-content/example-view-content-text.html +41 -48
  103. package/dist/examples/release-candidate/README.md +2 -1
  104. package/dist/examples/v2/README.md +15 -15
  105. package/dist/{index-CQAyT5Od.d.ts → index-B8u_3PGG.d.ts} +21 -2
  106. package/dist/{index-JlKPz4pp.d.mts → index-BxT2d-TK.d.mts} +21 -2
  107. package/dist/index.cjs.js +1 -1
  108. package/dist/index.cjs.js.map +1 -1
  109. package/dist/index.d.mts +21 -782
  110. package/dist/index.d.ts +21 -782
  111. package/dist/index.esm.js +1 -1
  112. package/dist/index.esm.js.map +1 -1
  113. package/dist/{pixel-CKc4OQUx.d.mts → pixel-C93c-0M2.d.mts} +234 -101
  114. package/dist/{pixel-BxZZx8l5.d.ts → pixel-DVy4rzj8.d.ts} +234 -101
  115. package/dist/pixel-default-config-BkAjriVH.d.mts +21 -0
  116. package/dist/pixel-default-config-Co69vDP3.d.ts +21 -0
  117. package/dist/pixel-settings-BhfJqA92.d.mts +40 -0
  118. package/dist/pixel-settings-C0qPFTii.d.ts +40 -0
  119. package/dist/runtime/index.cjs.js +1 -1
  120. package/dist/runtime/index.cjs.js.map +1 -1
  121. package/dist/runtime/index.d.mts +6 -6
  122. package/dist/runtime/index.d.ts +6 -6
  123. package/dist/runtime/index.esm.js +1 -1
  124. package/dist/runtime/index.esm.js.map +1 -1
  125. package/dist/services/index.cjs.js +1 -1
  126. package/dist/services/index.cjs.js.map +1 -1
  127. package/dist/services/index.d.mts +7 -7
  128. package/dist/services/index.d.ts +7 -7
  129. package/dist/services/index.esm.js +1 -1
  130. package/dist/services/index.esm.js.map +1 -1
  131. package/dist/{types-C75pQP31.d.ts → types-B2aUNHb3.d.ts} +2 -2
  132. package/dist/{types-BP8dz1gP.d.mts → types-C0J9KUQg.d.mts} +2 -2
  133. package/dist/{types-DMhzHSVC.d.mts → types-C2dsBog1.d.mts} +2 -2
  134. package/dist/{types-D_SsCur9.d.ts → types-DcaBYgVI.d.ts} +2 -2
  135. package/dist/{url-context-BjAsQoVl.d.mts → url-context-Ck2LK18V.d.mts} +4 -2
  136. package/dist/{url-context-BjAsQoVl.d.ts → url-context-Ck2LK18V.d.ts} +4 -2
  137. package/dist/v2/global.global.js +1 -1
  138. package/dist/v2/global.global.js.map +1 -1
  139. package/dist/v2/index.cjs.js +1 -1
  140. package/dist/v2/index.cjs.js.map +1 -1
  141. package/dist/v2/index.d.mts +26 -8
  142. package/dist/v2/index.d.ts +26 -8
  143. package/dist/v2/index.esm.js +1 -1
  144. package/dist/v2/index.esm.js.map +1 -1
  145. package/docs/public/README.md +20 -15
  146. package/docs/public/api/exports.md +12 -8
  147. package/docs/public/api/pixel.md +28 -7
  148. package/docs/public/configuration/commerce.md +3 -3
  149. package/docs/public/configuration/modules.md +11 -14
  150. package/docs/public/configuration/overview.md +41 -25
  151. package/docs/public/configuration/transport.md +127 -0
  152. package/docs/public/events/catalog.md +3 -1
  153. package/docs/public/getting-started/installation.md +20 -15
  154. package/docs/public/getting-started/quick-start.md +95 -30
  155. package/docs/public/getting-started/react-nextjs.md +57 -34
  156. package/docs/public/getting-started/script-tag.md +55 -32
  157. package/docs/public/guides/funnel-checkout.md +2 -2
  158. package/docs/public/guides/funnel-full.md +3 -3
  159. package/docs/public/guides/funnel-landing.md +10 -8
  160. package/docs/public/limitations.md +6 -5
  161. package/docs/public/privacy/limitations.md +6 -6
  162. package/docs/public/release-candidate/validation.md +24 -19
  163. package/docs/public/troubleshooting.md +7 -6
  164. package/package.json +15 -14
  165. package/dist/pixel-default-config-CJl-eypl.d.mts +0 -5
  166. package/dist/pixel-default-config-aAOujzwp.d.ts +0 -5
@@ -126,14 +126,14 @@
126
126
  <div class="hint">
127
127
  Endpoint oficial de testes:
128
128
  <code>https://micro-service-pixel-production-4826.up.railway.app</code> ·
129
- Pixel ID: <code>pix_8580907</code>. Alterne entre MockSender e HttpSender,
129
+ Pixel ID: <code>pix_8580907</code>. Alterne entre TestSender e HttpSender,
130
130
  storage adapters, replay, circuit breaker, DLQ e fila persistida.
131
131
  </div>
132
132
 
133
133
  <div class="flow">
134
134
  Dispatcher → TransportEngine → Pipeline → PersistentQueue →
135
135
  OrderingManager → BackpressureManager → BatchManager → CircuitBreaker →
136
- RetryEngine → TimedSender → (MockSender | HttpSender) → API → ACK → Replay
136
+ RetryEngine → TimedSender → (TestSender | HttpSender) → API → ACK → Replay
137
137
  / DLQ
138
138
  </div>
139
139
 
@@ -142,8 +142,8 @@
142
142
  <label>
143
143
  Sender
144
144
  <select id="cfg-sender-mode">
145
- <option value="mock">Mock Sender</option>
146
- <option value="http">HTTP Sender</option>
145
+ <option value="test">Test Sender</option>
146
+ <option value="internal">Internal Sender</option>
147
147
  </select>
148
148
  </label>
149
149
  <label>
@@ -193,7 +193,7 @@
193
193
  <button id="btn-import-queue" type="button">Importar fila</button>
194
194
  <button id="btn-force-retry" type="button">Forçar retry</button>
195
195
  <button id="btn-sim-timeout" type="button">Simular timeout</button>
196
- <button id="btn-reset-sender" type="button">Reset MockSender</button>
196
+ <button id="btn-reset-sender" type="button">Reset TestSender</button>
197
197
  <button id="btn-burst" type="button">Burst (5 eventos)</button>
198
198
  </div>
199
199
 
@@ -238,7 +238,7 @@
238
238
  <pre id="compression-state">—</pre>
239
239
  </div>
240
240
  <div class="panel">
241
- <h3>HTTP Sender / API</h3>
241
+ <h3>Internal Sender / API</h3>
242
242
  <pre id="http-state">—</pre>
243
243
  </div>
244
244
  <div class="panel">
@@ -294,7 +294,12 @@
294
294
  <h2>Dispatcher Logs</h2>
295
295
  <pre id="logs"></pre>
296
296
 
297
- <script src="../../dist/v2/global.global.js"></script>
297
+ <script
298
+ data-pixel-id="213123"
299
+ data-funnel="123"
300
+ data-channel="123"
301
+ src="../../v2/global.global.js"
302
+ ></script>
298
303
  <script>
299
304
  const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
300
305
 
@@ -325,7 +330,7 @@
325
330
 
326
331
  function transportConfig() {
327
332
  const cfg = readConfigInputs();
328
- const useHttp = cfg.senderMode === 'http';
333
+ const useInternal = cfg.senderMode === 'internal';
329
334
 
330
335
  return {
331
336
  ...DEFAULT_PIXEL_CONFIG,
@@ -333,8 +338,47 @@
333
338
  identity: { pixelId: PIXEL_ID },
334
339
  transport: {
335
340
  ...DEFAULT_PIXEL_CONFIG.transport,
336
- apiEndpoint: API_ENDPOINT,
337
- timeoutMs: cfg.timeoutMs,
341
+ enabled: true,
342
+ sender: useInternal
343
+ ? { mode: 'internal', baseUrl: API_ENDPOINT }
344
+ : { mode: 'test', capture: true },
345
+ persistence: { enabled: true },
346
+ replay: { enabled: true },
347
+ ordering: { enabled: true },
348
+ coordination: { enabled: true },
349
+ circuitBreaker: {
350
+ enabled: true,
351
+ failureThreshold: 5,
352
+ resetTimeoutMs: 30000,
353
+ halfOpenMaxAttempts: 2,
354
+ },
355
+ backpressure: {
356
+ enabled: true,
357
+ maxQueueSize: 500,
358
+ policy: 'drop_oldest',
359
+ sampleRate: 0.5,
360
+ },
361
+ deadLetter: { enabled: true, maxEntries: 200 },
362
+ compression: { enabled: true, strategy: 'identity' },
363
+ retry: {
364
+ enabled: true,
365
+ maxAttempts: cfg.maxAttempts,
366
+ baseDelayMs: 500,
367
+ maxDelayMs: 4000,
368
+ multiplier: 2,
369
+ },
370
+ batch: {
371
+ enabled: true,
372
+ batchSize: cfg.batchSize,
373
+ maxWaitMs: 5000,
374
+ },
375
+ timeout: { enabled: true, timeoutMs: cfg.timeoutMs },
376
+ offline: { enabled: true },
377
+ flush: {
378
+ enabled: true,
379
+ flushOnDestroy: true,
380
+ prepareUnloadHooks: true,
381
+ },
338
382
  },
339
383
  storage: {
340
384
  ...DEFAULT_PIXEL_CONFIG.storage,
@@ -374,50 +418,6 @@
374
418
  enabled: false,
375
419
  },
376
420
  },
377
- transport: {
378
- enabled: true,
379
- mockSender: { enabled: !useHttp },
380
- sender: { mode: useHttp ? 'http' : 'mock' },
381
- persistence: { enabled: true },
382
- replay: { enabled: true },
383
- ordering: { enabled: true },
384
- coordination: { enabled: true },
385
- circuitBreaker: {
386
- enabled: true,
387
- failureThreshold: 5,
388
- resetTimeoutMs: 30000,
389
- halfOpenMaxAttempts: 2,
390
- },
391
- backpressure: {
392
- enabled: true,
393
- maxQueueSize: 500,
394
- policy: 'drop_oldest',
395
- sampleRate: 0.5,
396
- },
397
- deadLetter: { enabled: true, maxEntries: 200 },
398
- compression: { enabled: true, strategy: 'identity' },
399
- retry: {
400
- enabled: true,
401
- maxAttempts: cfg.maxAttempts,
402
- baseDelayMs: 500,
403
- maxDelayMs: 4000,
404
- multiplier: 2,
405
- },
406
- batch: {
407
- enabled: true,
408
- batchSize: cfg.batchSize,
409
- flushIntervalMs: 2000,
410
- maxWaitMs: 5000,
411
- },
412
- timeout: { enabled: true, timeoutMs: cfg.timeoutMs },
413
- offline: { enabled: true },
414
- flush: {
415
- enabled: true,
416
- flushIntervalMs: 2000,
417
- flushOnDestroy: true,
418
- prepareUnloadHooks: true,
419
- },
420
- },
421
421
  },
422
422
  };
423
423
  }
@@ -548,6 +548,13 @@
548
548
 
549
549
  pixel = new Pixel(transportConfig());
550
550
  await pixel.init();
551
+ if (readConfigInputs().senderMode === 'test') {
552
+ pixel.configureTransportTestSender({
553
+ capture: true,
554
+ response: 'success',
555
+ delayMs: 0,
556
+ });
557
+ }
551
558
  initCount += 1;
552
559
 
553
560
  const services = pixel.getDebugServices();
@@ -676,7 +683,7 @@
676
683
  document
677
684
  .getElementById('btn-force-retry')
678
685
  .addEventListener('click', function () {
679
- pixel?.configureTransportMockSender({
686
+ pixel?.configureTransportTestSender({
680
687
  failUntilAttempt: 3,
681
688
  delayMs: 0,
682
689
  });
@@ -690,7 +697,7 @@
690
697
  document
691
698
  .getElementById('btn-sim-timeout')
692
699
  .addEventListener('click', function () {
693
- pixel?.configureTransportMockSender({ delayMs: 5000 });
700
+ pixel?.configureTransportTestSender({ delayMs: 5000 });
694
701
  pixel?.purchase({
695
702
  value: 1,
696
703
  currency: 'BRL',
@@ -701,11 +708,11 @@
701
708
  document
702
709
  .getElementById('btn-reset-sender')
703
710
  .addEventListener('click', function () {
704
- pixel?.configureTransportMockSender({
711
+ pixel?.configureTransportTestSender({
705
712
  delayMs: 0,
706
713
  failUntilAttempt: undefined,
707
714
  });
708
- appendLog('MockSender reset');
715
+ appendLog('TestSender reset');
709
716
  });
710
717
  document
711
718
  .getElementById('btn-burst')
@@ -50,7 +50,7 @@ linkDecoration.allowedDomains: '*' | string[] // '*' = todos os hosts
50
50
 
51
51
  ```bash
52
52
  npm run build
53
- # servir examples/html-script ou abrir via file:// após build
53
+ # servir apps/playground-html ou abrir via file:// após build
54
54
  ```
55
55
 
56
56
  1. Abra `landing.html?utm_source=facebook&affid=aff_demo&fbclid=test_fb`.
@@ -24,7 +24,7 @@
24
24
  <a id="to-upsell" href="upsell.html">Ir ao upsell</a>
25
25
  </p>
26
26
  <pre id="out">init…</pre>
27
- <script src="../../../dist/v2/global.global.js"></script>
27
+ <script src="../../../v2/global.global.js"></script>
28
28
  <script>
29
29
  (async function () {
30
30
  var out = document.getElementById('out');
@@ -70,6 +70,9 @@
70
70
  initialItems: [{ productId: 'main_offer', quantity: 1 }],
71
71
  },
72
72
  },
73
+ transport: {
74
+ ...DEFAULT_PIXEL_CONFIG.transport,
75
+ },
73
76
  modules: {
74
77
  ...DEFAULT_PIXEL_CONFIG.modules,
75
78
  core: {
@@ -86,7 +89,6 @@
86
89
  },
87
90
  conversion: { ...DEFAULT_PIXEL_CONFIG.modules.conversion, enabled: true },
88
91
  behavior: { ...DEFAULT_PIXEL_CONFIG.modules.behavior, enabled: false },
89
- transport: { ...DEFAULT_PIXEL_CONFIG.modules.transport, enabled: false },
90
92
  integrations: { ...DEFAULT_PIXEL_CONFIG.modules.integrations, enabled: false },
91
93
  },
92
94
  });
@@ -16,7 +16,7 @@
16
16
  <p class="hint">Última oferta — contexto de URL deve continuar intacto.</p>
17
17
  <p><a id="finish" href="thank-you.html?accepted=0">Finalizar</a></p>
18
18
  <pre id="out">init…</pre>
19
- <script src="../../../dist/v2/global.global.js"></script>
19
+ <script src="../../../v2/global.global.js"></script>
20
20
  <script>
21
21
  (async function () {
22
22
  var { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
@@ -24,6 +24,9 @@
24
24
  ...DEFAULT_PIXEL_CONFIG,
25
25
  app: { ...DEFAULT_PIXEL_CONFIG.app, debug: true },
26
26
  identity: { ...DEFAULT_PIXEL_CONFIG.identity, pixelId: 'pix_ff_downsell' },
27
+ transport: {
28
+ ...DEFAULT_PIXEL_CONFIG.transport,
29
+ },
27
30
  modules: {
28
31
  ...DEFAULT_PIXEL_CONFIG.modules,
29
32
  core: {
@@ -39,7 +42,6 @@
39
42
  },
40
43
  },
41
44
  conversion: { ...DEFAULT_PIXEL_CONFIG.modules.conversion, enabled: false },
42
- transport: { ...DEFAULT_PIXEL_CONFIG.modules.transport, enabled: false },
43
45
  integrations: { ...DEFAULT_PIXEL_CONFIG.modules.integrations, enabled: false },
44
46
  behavior: { ...DEFAULT_PIXEL_CONFIG.modules.behavior, enabled: false },
45
47
  },
@@ -22,9 +22,16 @@
22
22
  <button type="button" id="btn-lead">LEAD</button>
23
23
  <button type="button" id="btn-atc">ADD_TO_CART</button>
24
24
  <a id="to-checkout" href="checkout.html#step">Ir ao checkout</a>
25
+ <a
26
+ id="ext-checkout"
27
+ data-demo-stay
28
+ data-product-id="main_offer"
29
+ href="https://checkout.example.com/pay/offer_ff?product=main_offer"
30
+ >Checkout externo (link source)</a
31
+ >
25
32
  </p>
26
33
  <pre id="out">init…</pre>
27
- <script src="../../../dist/v2/global.global.js"></script>
34
+ <script src="../../../v2/global.global.js"></script>
28
35
  <script>
29
36
  (async function () {
30
37
  var out = document.getElementById('out');
@@ -57,6 +64,9 @@
57
64
  initialItems: [{ productId: 'main_offer', quantity: 1 }],
58
65
  },
59
66
  },
67
+ transport: {
68
+ ...DEFAULT_PIXEL_CONFIG.transport,
69
+ },
60
70
  modules: {
61
71
  ...DEFAULT_PIXEL_CONFIG.modules,
62
72
  core: {
@@ -72,9 +82,40 @@
72
82
  },
73
83
  },
74
84
  },
75
- conversion: { ...DEFAULT_PIXEL_CONFIG.modules.conversion, enabled: true },
85
+ conversion: {
86
+ ...DEFAULT_PIXEL_CONFIG.modules.conversion,
87
+ enabled: true,
88
+ auto: {
89
+ ...DEFAULT_PIXEL_CONFIG.modules.conversion.auto,
90
+ enabled: true,
91
+ detectors: {
92
+ ...DEFAULT_PIXEL_CONFIG.modules.conversion.auto.detectors,
93
+ addToCart: {
94
+ enabled: true,
95
+ sources: [
96
+ {
97
+ name: 'ff-checkout-link',
98
+ type: 'link',
99
+ match: {
100
+ origins: ['https://checkout.example.com'],
101
+ path: { template: '/pay/:offerId' },
102
+ },
103
+ bindings: {
104
+ productId: {
105
+ from: [
106
+ { source: 'dataset', key: 'productId' },
107
+ { source: 'query', key: 'product' },
108
+ ],
109
+ required: true,
110
+ },
111
+ },
112
+ },
113
+ ],
114
+ },
115
+ },
116
+ },
117
+ },
76
118
  behavior: { ...DEFAULT_PIXEL_CONFIG.modules.behavior, enabled: false },
77
- transport: { ...DEFAULT_PIXEL_CONFIG.modules.transport, enabled: false },
78
119
  integrations: { ...DEFAULT_PIXEL_CONFIG.modules.integrations, enabled: false },
79
120
  },
80
121
  });
@@ -84,6 +125,9 @@
84
125
  href: location.href,
85
126
  snapshot: uc.getSnapshot(),
86
127
  checkoutHref: document.getElementById('to-checkout').getAttribute('href'),
128
+ detectors: pixel.getDebugActiveDetectors
129
+ ? pixel.getDebugActiveDetectors()
130
+ : [],
87
131
  });
88
132
  document.getElementById('btn-lead').onclick = function () {
89
133
  pixel.lead({ email: 'demo@example.com' });
@@ -93,6 +137,16 @@
93
137
  pixel.addToCart();
94
138
  log('ADD_TO_CART', uc.getSnapshot());
95
139
  };
140
+ document.querySelectorAll('[data-demo-stay]').forEach(function (el) {
141
+ el.addEventListener('click', function (event) {
142
+ event.preventDefault();
143
+ log('link-click (nav blocked)', {
144
+ detectors: pixel.getDebugActiveDetectors
145
+ ? pixel.getDebugActiveDetectors()
146
+ : [],
147
+ });
148
+ });
149
+ });
96
150
  })();
97
151
  </script>
98
152
  </body>
@@ -20,7 +20,7 @@
20
20
  <button type="button" id="btn-reinit">Reinit</button>
21
21
  </p>
22
22
  <pre id="out">init…</pre>
23
- <script src="../../../dist/v2/global.global.js"></script>
23
+ <script src="../../../v2/global.global.js"></script>
24
24
  <script>
25
25
  (async function () {
26
26
  var out = document.getElementById('out');
@@ -32,6 +32,9 @@
32
32
  ...DEFAULT_PIXEL_CONFIG,
33
33
  app: { ...DEFAULT_PIXEL_CONFIG.app, debug: true },
34
34
  identity: { ...DEFAULT_PIXEL_CONFIG.identity, pixelId: 'pix_ff_thanks' },
35
+ transport: {
36
+ ...DEFAULT_PIXEL_CONFIG.transport,
37
+ },
35
38
  modules: {
36
39
  ...DEFAULT_PIXEL_CONFIG.modules,
37
40
  core: {
@@ -39,7 +42,6 @@
39
42
  urlContext: { enabled: true },
40
43
  },
41
44
  conversion: { ...DEFAULT_PIXEL_CONFIG.modules.conversion, enabled: false },
42
- transport: { ...DEFAULT_PIXEL_CONFIG.modules.transport, enabled: false },
43
45
  integrations: { ...DEFAULT_PIXEL_CONFIG.modules.integrations, enabled: false },
44
46
  behavior: { ...DEFAULT_PIXEL_CONFIG.modules.behavior, enabled: false },
45
47
  },
@@ -20,7 +20,7 @@
20
20
  <a id="decline" class="secondary" href="downsell.html">Recusar → downsell</a>
21
21
  </p>
22
22
  <pre id="out">init…</pre>
23
- <script src="../../../dist/v2/global.global.js"></script>
23
+ <script src="../../../v2/global.global.js"></script>
24
24
  <script>
25
25
  (async function () {
26
26
  var { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
@@ -28,6 +28,9 @@
28
28
  ...DEFAULT_PIXEL_CONFIG,
29
29
  app: { ...DEFAULT_PIXEL_CONFIG.app, debug: true },
30
30
  identity: { ...DEFAULT_PIXEL_CONFIG.identity, pixelId: 'pix_ff_upsell' },
31
+ transport: {
32
+ ...DEFAULT_PIXEL_CONFIG.transport,
33
+ },
31
34
  modules: {
32
35
  ...DEFAULT_PIXEL_CONFIG.modules,
33
36
  core: {
@@ -43,7 +46,6 @@
43
46
  },
44
47
  },
45
48
  conversion: { ...DEFAULT_PIXEL_CONFIG.modules.conversion, enabled: true },
46
- transport: { ...DEFAULT_PIXEL_CONFIG.modules.transport, enabled: false },
47
49
  integrations: { ...DEFAULT_PIXEL_CONFIG.modules.integrations, enabled: false },
48
50
  behavior: { ...DEFAULT_PIXEL_CONFIG.modules.behavior, enabled: false },
49
51
  },
@@ -163,7 +163,7 @@ code { font-size: 0.85em; }
163
163
  </div>
164
164
  </div>
165
165
 
166
- <script src="../../../dist/v2/global.global.js"></script>
166
+ <script src="../../../v2/global.global.js"></script>
167
167
  <script>
168
168
  const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
169
169
  const API_ENDPOINT =
@@ -215,9 +215,46 @@ code { font-size: 0.85em; }
215
215
  debug: true,
216
216
  },
217
217
  transport: {
218
- ...DEFAULT_PIXEL_CONFIG.transport,
219
- apiEndpoint: API_ENDPOINT,
220
- timeoutMs: 10000,
218
+ ...base.transport,
219
+ enabled: true,
220
+ sender: { mode: 'internal', baseUrl: API_ENDPOINT },
221
+ persistence: { enabled: true },
222
+ replay: { enabled: true },
223
+ ordering: { enabled: true },
224
+ coordination: { enabled: true },
225
+ circuitBreaker: {
226
+ enabled: true,
227
+ failureThreshold: 5,
228
+ resetTimeoutMs: 30000,
229
+ halfOpenMaxAttempts: 2,
230
+ },
231
+ backpressure: {
232
+ enabled: true,
233
+ maxQueueSize: 500,
234
+ policy: 'drop_oldest',
235
+ sampleRate: 0.5,
236
+ },
237
+ deadLetter: { enabled: true, maxEntries: 200 },
238
+ compression: { enabled: true, strategy: 'identity' },
239
+ retry: {
240
+ enabled: true,
241
+ maxAttempts: 4,
242
+ baseDelayMs: 500,
243
+ maxDelayMs: 4000,
244
+ multiplier: 2,
245
+ },
246
+ batch: {
247
+ enabled: true,
248
+ batchSize: 10,
249
+ maxWaitMs: 5000,
250
+ },
251
+ timeout: { enabled: true, timeoutMs: 10000 },
252
+ offline: { enabled: true },
253
+ flush: {
254
+ enabled: true,
255
+ flushOnDestroy: true,
256
+ prepareUnloadHooks: true,
257
+ },
221
258
  },
222
259
  identity: { ...base.identity, pixelId: PIXEL_ID },
223
260
  commerce: {
@@ -298,50 +335,6 @@ code { font-size: 0.85em; }
298
335
  },
299
336
  behavior: { ...base.modules.behavior, enabled: false },
300
337
  privacy: { ...base.modules.privacy, enabled: false },
301
- transport: {
302
- enabled: true,
303
- mockSender: { enabled: false },
304
- sender: { mode: 'http' },
305
- persistence: { enabled: true },
306
- replay: { enabled: true },
307
- ordering: { enabled: true },
308
- coordination: { enabled: true },
309
- circuitBreaker: {
310
- enabled: true,
311
- failureThreshold: 5,
312
- resetTimeoutMs: 30000,
313
- halfOpenMaxAttempts: 2,
314
- },
315
- backpressure: {
316
- enabled: true,
317
- maxQueueSize: 500,
318
- policy: 'drop_oldest',
319
- sampleRate: 0.5,
320
- },
321
- deadLetter: { enabled: true, maxEntries: 200 },
322
- compression: { enabled: true, strategy: 'identity' },
323
- retry: {
324
- enabled: true,
325
- maxAttempts: 4,
326
- baseDelayMs: 500,
327
- maxDelayMs: 4000,
328
- multiplier: 2,
329
- },
330
- batch: {
331
- enabled: true,
332
- batchSize: 10,
333
- flushIntervalMs: 2000,
334
- maxWaitMs: 5000,
335
- },
336
- timeout: { enabled: true, timeoutMs: 10000 },
337
- offline: { enabled: true },
338
- flush: {
339
- enabled: true,
340
- flushIntervalMs: 2000,
341
- flushOnDestroy: true,
342
- prepareUnloadHooks: true,
343
- },
344
- },
345
338
  integrations: { ...base.modules.integrations, enabled: false },
346
339
  conversion: {
347
340
  enabled: true,
@@ -165,7 +165,7 @@ code { font-size: 0.85em; }
165
165
  </div>
166
166
  </div>
167
167
 
168
- <script src="../../../dist/v2/global.global.js"></script>
168
+ <script src="../../../v2/global.global.js"></script>
169
169
  <script>
170
170
  const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
171
171
  const API_ENDPOINT =
@@ -227,9 +227,46 @@ code { font-size: 0.85em; }
227
227
  debug: true,
228
228
  },
229
229
  transport: {
230
- ...DEFAULT_PIXEL_CONFIG.transport,
231
- apiEndpoint: API_ENDPOINT,
232
- timeoutMs: 10000,
230
+ ...base.transport,
231
+ enabled: true,
232
+ sender: { mode: 'internal', baseUrl: API_ENDPOINT },
233
+ persistence: { enabled: true },
234
+ replay: { enabled: true },
235
+ ordering: { enabled: true },
236
+ coordination: { enabled: true },
237
+ circuitBreaker: {
238
+ enabled: true,
239
+ failureThreshold: 5,
240
+ resetTimeoutMs: 30000,
241
+ halfOpenMaxAttempts: 2,
242
+ },
243
+ backpressure: {
244
+ enabled: true,
245
+ maxQueueSize: 500,
246
+ policy: 'drop_oldest',
247
+ sampleRate: 0.5,
248
+ },
249
+ deadLetter: { enabled: true, maxEntries: 200 },
250
+ compression: { enabled: true, strategy: 'identity' },
251
+ retry: {
252
+ enabled: true,
253
+ maxAttempts: 4,
254
+ baseDelayMs: 500,
255
+ maxDelayMs: 4000,
256
+ multiplier: 2,
257
+ },
258
+ batch: {
259
+ enabled: true,
260
+ batchSize: 10,
261
+ maxWaitMs: 5000,
262
+ },
263
+ timeout: { enabled: true, timeoutMs: 10000 },
264
+ offline: { enabled: true },
265
+ flush: {
266
+ enabled: true,
267
+ flushOnDestroy: true,
268
+ prepareUnloadHooks: true,
269
+ },
233
270
  },
234
271
  identity: { ...base.identity, pixelId: PIXEL_ID },
235
272
  commerce: {
@@ -310,50 +347,6 @@ code { font-size: 0.85em; }
310
347
  },
311
348
  behavior: { ...base.modules.behavior, enabled: false },
312
349
  privacy: { ...base.modules.privacy, enabled: false },
313
- transport: {
314
- enabled: true,
315
- mockSender: { enabled: false },
316
- sender: { mode: 'http' },
317
- persistence: { enabled: true },
318
- replay: { enabled: true },
319
- ordering: { enabled: true },
320
- coordination: { enabled: true },
321
- circuitBreaker: {
322
- enabled: true,
323
- failureThreshold: 5,
324
- resetTimeoutMs: 30000,
325
- halfOpenMaxAttempts: 2,
326
- },
327
- backpressure: {
328
- enabled: true,
329
- maxQueueSize: 500,
330
- policy: 'drop_oldest',
331
- sampleRate: 0.5,
332
- },
333
- deadLetter: { enabled: true, maxEntries: 200 },
334
- compression: { enabled: true, strategy: 'identity' },
335
- retry: {
336
- enabled: true,
337
- maxAttempts: 4,
338
- baseDelayMs: 500,
339
- maxDelayMs: 4000,
340
- multiplier: 2,
341
- },
342
- batch: {
343
- enabled: true,
344
- batchSize: 10,
345
- flushIntervalMs: 2000,
346
- maxWaitMs: 5000,
347
- },
348
- timeout: { enabled: true, timeoutMs: 10000 },
349
- offline: { enabled: true },
350
- flush: {
351
- enabled: true,
352
- flushIntervalMs: 2000,
353
- flushOnDestroy: true,
354
- prepareUnloadHooks: true,
355
- },
356
- },
357
350
  integrations: { ...base.modules.integrations, enabled: false },
358
351
  conversion: {
359
352
  enabled: true,