Overview
2.x reduces the public API to a single dimension: why a placement presents. The composition, the copy slots, and the claim flow all follow from that, or are gone. Coming from 1.x, four things change:- Redemption is immediate, and that is the only flow. Claiming opens the advertiser in
a new tab inside the claim gesture.
redeem()and the whole two-phase claim then redeem sequence are removed. PlacementOptionsis one flat shape.headlineandsubheadlinereplace the nestedheaderobject.layoutis gone, along with the'thankYou'composition and everything that dressed it. A newuseCaseoption selects the composition instead.show()takes no arguments, and a claimed result now carriesofferId,campaignId,advertiserName, andtransactionId.
Step 1: Update the package
Install the current 2.x release:Check what you resolved to (
npm view @encorekit/web-sdk version) before pinning. The 2.x
line began with a release that predates this API, so pin to the version you actually
installed rather than to 2.0.0.Step 2: Drop the deferred flow
redeem(), placement(id).redeem(), getPendingTransaction(), RedeemOptions, and
RedeemResult are removed, along with the redemption screen and the primer screen they
rendered. There is no pending transaction, so there is nothing to redeem.
Claiming now hands the user off immediately, and the claimed result is the whole signal:
redeem() after your own conversion step, that call must be
deleted: the offer is redeemed the moment the user claims it, and the SDK renders nothing
afterward. Treat { status: 'claimed' } as the complete outcome.
Two rules that the deferred flow required no longer apply. You do not need to call anything
from inside a click handler, because the advertiser tab now opens within the user’s tap on
Claim inside the SDK’s own sheet. And there is no pending state surviving a reload for your
code to reconcile.
Remove redemptionMode from both configure()
and any placement options. getConfiguration() no longer returns it either.
Step 3: Flatten the placement options
The nestedheader object is replaced by flat fields:
.onNotGranted() and .onLoadingStateChange() on the builder are unchanged.
Step 4: Replace the retired compositions
layout is removed. The new useCase option
selects the composition instead, and it defaults to 'reduceChurn', which renders the offer
carousel your 1.x 'list' placements already showed.
A placement that named no layout needs no change here. Drop the layout: 'list' option
if you passed it explicitly; the default covers you.
The 'thankYou' composition is retired, and with it the payment-status sheet a
post-purchase surface could compose. If you presented one, the closest equivalent is the
'rewardUsers' composition:
Because
display is gone, so is the display pre-flight that could resolve a deferred
show() to dismissed with a CONFIGURATION_ERROR before anything rendered.
Step 5: Read the new claim result
A claimed result is no longer bare:transactionId is what carries attribution: it is how a completion landing days later is
traced back to this user and app. Persist it when it is present. 1.x had no way to obtain
one at all: the claimed result was bare, and the id lived only on the persisted transaction
record reachable through the now-removed getPendingTransaction().
It is optional because the transaction write can fail while the claim genuinely happened, in
which case the SDK logs a warning rather than fabricating a placeholder id, and the result
still resolves claimed.
dismissed and unavailable are unchanged. show() still never rejects.
New in 2.x: reward a user, not just save one
1.x could only intervene when a user was about to leave. 2.x adds a second use case for the opposite moment, a user who just accomplished something:useCase unset keeps every placement on
'reduceChurn', which is the behavior your 1.x integration already had. See
Post-Purchase Placements for the full
walkthrough.
The values you type (
'reduceChurn', 'rewardUsers') match the native SDKs. The values
Encore sends and stores over the wire are separate frozen labels, so anything you have built
on the use_case analytics property is unaffected.Removed APIs at a glance
Verify the migration
- Your project type-checks, or (in JavaScript) no call site still references
redeem(),redemptionMode,layout,header,offerContext,footer,receipt, ordisplay. - A claim opens the advertiser tab with no second call from your code.
- Your
claimedbranch reads and persiststransactionId. - Your analytics still report against the same use-case values they always did, because the wire did not change.
Related
- The Claim Flow: the single-step flow in full.
placement(): the currentPlacementOptionscontract.show(): the currentShowResultcontract.configure(): the currentEncoreConfigcontract.