@encorekit/web-sdk 2.1.4 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +20 -0
  2. package/dist/cjs/index.cjs +1 -1
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/esm/index.js +1 -1
  5. package/dist/esm/index.js.map +1 -1
  6. package/dist/umd/encore.min.js +1 -1
  7. package/dist/umd/encore.min.js.map +1 -1
  8. package/package.json +1 -1
  9. package/types/analytics/events.d.ts +54 -2
  10. package/types/analytics/events.d.ts.map +1 -1
  11. package/types/api/APIClient.d.ts +15 -1
  12. package/types/api/APIClient.d.ts.map +1 -1
  13. package/types/api/generated/types.d.ts +94 -7
  14. package/types/api/generated/types.d.ts.map +1 -1
  15. package/types/api/models.d.ts +7 -0
  16. package/types/api/models.d.ts.map +1 -1
  17. package/types/core/Configuration.d.ts +2 -0
  18. package/types/core/Configuration.d.ts.map +1 -1
  19. package/types/core/Encore.d.ts.map +1 -1
  20. package/types/core/giftVariant.d.ts +11 -6
  21. package/types/core/giftVariant.d.ts.map +1 -1
  22. package/types/core/share.d.ts +58 -0
  23. package/types/core/share.d.ts.map +1 -0
  24. package/types/core/unlockCode.d.ts +25 -0
  25. package/types/core/unlockCode.d.ts.map +1 -0
  26. package/types/core/version.d.ts +1 -1
  27. package/types/types.d.ts +61 -8
  28. package/types/types.d.ts.map +1 -1
  29. package/types/ui/CodeUnlock.d.ts +151 -0
  30. package/types/ui/CodeUnlock.d.ts.map +1 -0
  31. package/types/ui/GiftSheet.d.ts +47 -3
  32. package/types/ui/GiftSheet.d.ts.map +1 -1
  33. package/types/ui/GiftUnwrap.d.ts +70 -0
  34. package/types/ui/GiftUnwrap.d.ts.map +1 -1
  35. package/types/ui/OfferModal.d.ts +30 -0
  36. package/types/ui/OfferModal.d.ts.map +1 -1
  37. package/types/ui/giftUnwrapArt.d.ts +6 -0
  38. package/types/ui/giftUnwrapArt.d.ts.map +1 -1
  39. package/types/ui/giftUnwrapCopy.d.ts +20 -0
  40. package/types/ui/giftUnwrapCopy.d.ts.map +1 -1
  41. package/types/ui/styles.d.ts.map +1 -1
package/README.md CHANGED
@@ -334,6 +334,26 @@ round trip.
334
334
  > thing that blocks serving, and it is deliberate — it is how a live surface is
335
335
  > stopped without a deploy. A switched-off surface no-ops exactly as below.
336
336
 
337
+ ### Per-placement reward variants (opt-in)
338
+
339
+ Encore can serve a different reward variant per placement label, for example a
340
+ code screen for `'email_code'` and the plain gift picker for `'email'`. The
341
+ variant prefetched at `configure()` cannot carry that choice, so ask for it:
342
+
343
+ ```typescript
344
+ Encore.configure({ apiKey: 'your-api-key-here', resolveVariantsByPlacement: true });
345
+
346
+ // One GET /config?useCase=post-action-reward&placementId=email_code before the
347
+ // sheet renders; the variant it names is presented and reported.
348
+ await Encore.placement('email_code', { useCase: 'rewardUsers' }).show();
349
+ ```
350
+
351
+ A settled answer is reused for that label for the rest of the session (until
352
+ `reset()`), while a failed or discarded request is retried on the next
353
+ presentation. A failed or slow request falls back to what the SDK does with the option off (the
354
+ prefetched variant, or the on-demand fetch when there is none); it never blocks
355
+ or breaks the presentation. Off (the default), the SDK's requests are unchanged.
356
+
337
357
  ### When nothing presents
338
358
 
339
359
  A use case that cannot be served resolves `{ status: 'unavailable' }`, reports