@active-reach/web-sdk 1.27.3 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -15
- package/dist/aegis.min.js +1 -1
- package/dist/aegis.min.js.map +1 -1
- package/dist/{analytics-0p0p56H0.mjs → analytics-CCDZCnut.mjs} +37 -3
- package/dist/analytics-CCDZCnut.mjs.map +1 -0
- package/dist/ecommerce/index.d.ts +11 -0
- package/dist/ecommerce/index.d.ts.map +1 -1
- package/dist/inapp/renderers/carousel-cards.d.ts.map +1 -1
- package/dist/inapp/renderers/product-recommendation.d.ts.map +1 -1
- package/dist/index.js +52 -27
- package/dist/index.js.map +1 -1
- package/dist/react.js +1 -1
- package/dist/runtime/AegisMessageRuntime.d.ts +28 -0
- package/dist/runtime/AegisMessageRuntime.d.ts.map +1 -1
- package/dist/widgets/AegisWidgetManager.d.ts +9 -0
- package/dist/widgets/AegisWidgetManager.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/analytics-0p0p56H0.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -477,27 +477,38 @@ Drop an empty element wherever you want the card to appear. Its `data-aegis-slot
|
|
|
477
477
|
|
|
478
478
|
No per-slot script and no manual registration — `runtime.initialize()` scans for every `[data-aegis-slot]` element and fills it. It re-scans on each SSE/poll refresh and skips slots it has already filled.
|
|
479
479
|
|
|
480
|
-
### Cart
|
|
480
|
+
### Cart state — one store, fed the CEP-standard way
|
|
481
481
|
|
|
482
|
-
|
|
482
|
+
Every cart-reactive surface — the **free-delivery progress card**, the standalone
|
|
483
|
+
**progress bar**, cart-value **targeting rules**, and **cart-recovery** widgets —
|
|
484
|
+
reads ONE cart store. You feed it the same way you'd feed WebEngage/CleverTap: by
|
|
485
|
+
firing the **ecommerce events** you already fire. The SDK derives the live cart
|
|
486
|
+
from them; no separate cart call.
|
|
487
|
+
|
|
488
|
+
```typescript
|
|
489
|
+
// 1) Wire the ecommerce tracker into the cart store, once at boot:
|
|
490
|
+
runtime.bindEcommerce(aegis.ecommerce);
|
|
491
|
+
|
|
492
|
+
// 2) Fire ecommerce events as the shopper shops — the cart is derived from these:
|
|
493
|
+
aegis.ecommerce.addToCart({ product_id: 'p1', name: 'Cap', price: 499, quantity: 1 });
|
|
494
|
+
aegis.ecommerce.cartViewed({ value: 998, currency: 'INR', products: [/* … */] }); // authoritative snapshot
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
**Platform installs need no event wiring** — the plugin does it for you. Carts are
|
|
498
|
+
detected and fed into the same store automatically:
|
|
483
499
|
|
|
484
500
|
| Platform | Detection method | Setup |
|
|
485
501
|
|----------|-----------------|-------|
|
|
486
|
-
| **Shopify** |
|
|
487
|
-
| **WooCommerce** | `
|
|
488
|
-
| **Magento 2** | `localStorage['mage-cache-storage']` |
|
|
489
|
-
| **Custom /
|
|
502
|
+
| **Shopify** | `/cart.js` poll + `cart:updated` (plugin) | Install the Shopify app |
|
|
503
|
+
| **WooCommerce** | `aegis_cart` + WC Store API on cart events (plugin) | Install the WP plugin |
|
|
504
|
+
| **Magento 2** | `localStorage['mage-cache-storage']` | Install the extension |
|
|
505
|
+
| **Custom / headless / mobile** | Fire `aegis.ecommerce.*` (above) | `runtime.bindEcommerce(...)` |
|
|
506
|
+
|
|
507
|
+
**Escape hatch** — a headless host that doesn't emit ecommerce events can push the
|
|
508
|
+
cart directly; this writes the same one store:
|
|
490
509
|
|
|
491
510
|
```typescript
|
|
492
|
-
|
|
493
|
-
runtime.widgets.setCartData({
|
|
494
|
-
cart_id: 'cart_123',
|
|
495
|
-
cart_total: 149.99,
|
|
496
|
-
cart_currency: 'INR',
|
|
497
|
-
cart_items: [
|
|
498
|
-
{ product_id: 'prod_456', product_name: 'Premium Widget', quantity: 2, price: 74.99 }
|
|
499
|
-
],
|
|
500
|
-
});
|
|
511
|
+
runtime.setCartState({ total: 149.99, itemCount: 2, currency: 'INR' });
|
|
501
512
|
```
|
|
502
513
|
|
|
503
514
|
---
|