@encorekit/web-sdk 2.0.2 → 2.0.4
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 +102 -4
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/umd/encore.min.js +1 -1
- package/dist/umd/encore.min.js.map +1 -1
- package/package.json +2 -1
- package/types/analytics/DiagnosticsOutbox.d.ts +22 -0
- package/types/analytics/DiagnosticsOutbox.d.ts.map +1 -0
- package/types/analytics/ReliableOutbox.d.ts +40 -0
- package/types/analytics/ReliableOutbox.d.ts.map +1 -0
- package/types/analytics/events.d.ts +120 -3
- package/types/analytics/events.d.ts.map +1 -1
- package/types/analytics/placementResolved.d.ts +150 -0
- package/types/analytics/placementResolved.d.ts.map +1 -0
- package/types/api/APIClient.d.ts +7 -1
- package/types/api/APIClient.d.ts.map +1 -1
- package/types/api/generated/types.d.ts +6 -1
- package/types/api/generated/types.d.ts.map +1 -1
- package/types/core/Configuration.d.ts +5 -0
- package/types/core/Configuration.d.ts.map +1 -1
- package/types/core/Encore.d.ts +40 -1
- package/types/core/Encore.d.ts.map +1 -1
- package/types/core/OfferManager.d.ts +29 -3
- package/types/core/OfferManager.d.ts.map +1 -1
- package/types/core/PlacementBuilder.d.ts +12 -0
- package/types/core/PlacementBuilder.d.ts.map +1 -1
- package/types/core/StrictUnlock.d.ts +20 -0
- package/types/core/StrictUnlock.d.ts.map +1 -0
- package/types/core/StrictUnlockReconciler.d.ts +94 -0
- package/types/core/StrictUnlockReconciler.d.ts.map +1 -0
- package/types/core/useCase.d.ts +21 -0
- package/types/core/useCase.d.ts.map +1 -1
- package/types/core/version.d.ts +1 -1
- package/types/experiments/ExposureOutbox.d.ts +4 -28
- package/types/experiments/ExposureOutbox.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/types.d.ts +92 -3
- package/types/types.d.ts.map +1 -1
- package/types/ui/OfferCard.d.ts +3 -1
- package/types/ui/OfferCard.d.ts.map +1 -1
- package/types/ui/OfferCarousel.d.ts +13 -0
- package/types/ui/OfferCarousel.d.ts.map +1 -1
- package/types/ui/OfferModal.d.ts +25 -1
- package/types/ui/OfferModal.d.ts.map +1 -1
- package/types/ui/RewardActions.d.ts +24 -0
- package/types/ui/RewardActions.d.ts.map +1 -1
- package/types/ui/RewardLayout.d.ts +16 -0
- package/types/ui/RewardLayout.d.ts.map +1 -1
- package/types/ui/appearance.d.ts +168 -0
- package/types/ui/appearance.d.ts.map +1 -0
- package/types/ui/cssSafe.d.ts +34 -0
- package/types/ui/cssSafe.d.ts.map +1 -0
- package/types/ui/styles.d.ts +21 -1
- package/types/ui/styles.d.ts.map +1 -1
- package/types/utils/text.d.ts +14 -0
- package/types/utils/text.d.ts.map +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reliable delivery for the `show()` choke-point diagnostics: `sdk_show_entered`,
|
|
3
|
+
* `sdk_show_aborted`, and the terminal `sdk_placement_resolved`.
|
|
4
|
+
*
|
|
5
|
+
* ONE outbox for all three, matching iOS, where every diagnostic goes through
|
|
6
|
+
* `Encore.shared.services.outbox` (`OfferSheetCoordinator.enqueueDiagnostic`).
|
|
7
|
+
* They share a delivery guarantee for the same reason: each one is the only
|
|
8
|
+
* evidence of an exit that produces no other event, so a row that only sometimes
|
|
9
|
+
* survives the tab closing is worse than none — the loss is invisible *and*
|
|
10
|
+
* biased toward the exits that close the page.
|
|
11
|
+
*
|
|
12
|
+
* Sharing one queue also means one set of page-lifecycle listeners for the whole
|
|
13
|
+
* diagnostic family rather than one per event type.
|
|
14
|
+
*
|
|
15
|
+
* See `ReliableOutbox` for the mechanism.
|
|
16
|
+
*/
|
|
17
|
+
import { ReliableOutbox } from './ReliableOutbox';
|
|
18
|
+
import type { StorageManager } from '../core/StorageManager';
|
|
19
|
+
export declare class DiagnosticsOutbox extends ReliableOutbox {
|
|
20
|
+
constructor(apiKey: string, analyticsBaseURL: string, storage: StorageManager);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=DiagnosticsOutbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DiagnosticsOutbox.d.ts","sourceRoot":"","sources":["../../src/analytics/DiagnosticsOutbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAI7D,qBAAa,iBAAkB,SAAQ,cAAc;gBACvC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc;CAG9E"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reliable delivery for analytics events that must survive tab-close — unlike
|
|
3
|
+
* the fire-and-forget AnalyticsClient, this path is storage-backed and retried.
|
|
4
|
+
*
|
|
5
|
+
* Delivery primitive: `fetch(url, { keepalive: true })` — NOT `navigator.sendBeacon`.
|
|
6
|
+
* The ingest endpoint authenticates on the `X-Analytics-Key` request header, and
|
|
7
|
+
* sendBeacon cannot set headers (a beacon would arrive unauthenticated). keepalive
|
|
8
|
+
* fetch survives document unload like a beacon AND carries the auth header.
|
|
9
|
+
*
|
|
10
|
+
* Reliability model:
|
|
11
|
+
* - enqueue: persist the envelope, then keepalive-POST; remove on 2xx.
|
|
12
|
+
* - flush: replay every persisted envelope (on SDK init + on pagehide /
|
|
13
|
+
* visibilitychange:hidden) so a send that died with the tab retries.
|
|
14
|
+
* - envelopes carry a STABLE event_id → retries are idempotent backend-side.
|
|
15
|
+
* - an in-memory in-flight set avoids duplicate concurrent sends.
|
|
16
|
+
* - all storage / window / document access is SSR- and failure-guarded (fail-open).
|
|
17
|
+
*
|
|
18
|
+
* Extracted from ExposureOutbox, which was the first consumer of this pattern:
|
|
19
|
+
* every consumer gets its own instance (and its own storage key), so multiple
|
|
20
|
+
* ReliableOutbox instances bind independent lifecycle listeners — harmless
|
|
21
|
+
* duplication, not worth a shared coordinator for a small number of consumers.
|
|
22
|
+
*/
|
|
23
|
+
import type { AnalyticsEvent } from './models';
|
|
24
|
+
import type { StorageManager } from '../core/StorageManager';
|
|
25
|
+
export declare class ReliableOutbox {
|
|
26
|
+
#private;
|
|
27
|
+
constructor(apiKey: string, analyticsBaseURL: string, storage: StorageManager, storageKey: string);
|
|
28
|
+
/**
|
|
29
|
+
* Persist an event and attempt delivery. `eventId` must be stable for a given
|
|
30
|
+
* (user, epoch) so retries de-duplicate backend-side. Returns whether the
|
|
31
|
+
* envelope durably landed in the configured storage tier: a quota-driven
|
|
32
|
+
* fallback-to-memory write is invisible to a fresh read, so the caller can avoid
|
|
33
|
+
* marking the epoch logged (and re-enqueue on the next trigger) instead of
|
|
34
|
+
* silently dropping the event.
|
|
35
|
+
*/
|
|
36
|
+
enqueue(event: AnalyticsEvent, eventId: string): boolean;
|
|
37
|
+
/** Replay every persisted envelope (init recovery + unload flush). */
|
|
38
|
+
flush(): void;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=ReliableOutbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReliableOutbox.d.ts","sourceRoot":"","sources":["../../src/analytics/ReliableOutbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,UAAU,CAAC;AAE9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,qBAAa,cAAc;;gBAOb,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM;IAQjG;;;;;;;OAOG;IACH,OAAO,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAaxD,sEAAsE;IACtE,KAAK,IAAI,IAAI;CAoDd"}
|
|
@@ -59,9 +59,9 @@ export declare const ClaimFailureReason: {
|
|
|
59
59
|
export declare function declineReasonWireValue(reason: string | undefined): string | undefined;
|
|
60
60
|
export declare function sdkInitialized(distinctId: string, sdkVersion: string, appBundleId: string): AnalyticsEvent;
|
|
61
61
|
export declare function userIdentified(distinctId: string, userId: string, appBundleId: string, attributes?: Record<string, unknown>): AnalyticsEvent;
|
|
62
|
-
export declare function offerPresentationTriggered(distinctId: string, presentationId: string, variantId?: string, useCase?: UseCase): AnalyticsEvent;
|
|
63
|
-
export declare function offerPresentationFailed(distinctId: string, reason: string, presentationId: string, variantId?: string, useCase?: UseCase): AnalyticsEvent;
|
|
64
|
-
export declare function offerPresentationSuccess(distinctId: string, presentationId: string, offerCount: number, variantId?: string, useCase?: UseCase): AnalyticsEvent;
|
|
62
|
+
export declare function offerPresentationTriggered(distinctId: string, presentationId: string, variantId?: string, useCase?: UseCase, placementId?: string): AnalyticsEvent;
|
|
63
|
+
export declare function offerPresentationFailed(distinctId: string, reason: string, presentationId: string, variantId?: string, useCase?: UseCase, placementId?: string): AnalyticsEvent;
|
|
64
|
+
export declare function offerPresentationSuccess(distinctId: string, presentationId: string, offerCount: number, variantId?: string, useCase?: UseCase, placementId?: string): AnalyticsEvent;
|
|
65
65
|
export declare function offerPresented(distinctId: string, params: {
|
|
66
66
|
campaignId: string;
|
|
67
67
|
creativeId: string;
|
|
@@ -73,6 +73,7 @@ export declare function offerPresented(distinctId: string, params: {
|
|
|
73
73
|
presentationId: string;
|
|
74
74
|
variantId?: string;
|
|
75
75
|
useCase?: UseCase;
|
|
76
|
+
placementId?: string;
|
|
76
77
|
}): AnalyticsEvent;
|
|
77
78
|
export declare function offerClaimed(distinctId: string, params: {
|
|
78
79
|
campaignId: string;
|
|
@@ -85,6 +86,7 @@ export declare function offerClaimed(distinctId: string, params: {
|
|
|
85
86
|
presentationId: string;
|
|
86
87
|
variantId?: string;
|
|
87
88
|
useCase?: UseCase;
|
|
89
|
+
placementId?: string;
|
|
88
90
|
}): AnalyticsEvent;
|
|
89
91
|
export declare function offerDeclined(distinctId: string, params: {
|
|
90
92
|
campaignId: string;
|
|
@@ -97,6 +99,7 @@ export declare function offerDeclined(distinctId: string, params: {
|
|
|
97
99
|
presentationId: string;
|
|
98
100
|
variantId?: string;
|
|
99
101
|
useCase?: UseCase;
|
|
102
|
+
placementId?: string;
|
|
100
103
|
}): AnalyticsEvent;
|
|
101
104
|
export declare function offerSheetDismissed(distinctId: string, params: {
|
|
102
105
|
presentationId: string;
|
|
@@ -106,6 +109,7 @@ export declare function offerSheetDismissed(distinctId: string, params: {
|
|
|
106
109
|
declineReason?: string;
|
|
107
110
|
variantId?: string;
|
|
108
111
|
useCase?: UseCase;
|
|
112
|
+
placementId?: string;
|
|
109
113
|
}): AnalyticsEvent;
|
|
110
114
|
export declare function offerTimeSpent(distinctId: string, params: {
|
|
111
115
|
campaignId: string;
|
|
@@ -116,6 +120,7 @@ export declare function offerTimeSpent(distinctId: string, params: {
|
|
|
116
120
|
presentationId: string;
|
|
117
121
|
variantId?: string;
|
|
118
122
|
useCase?: UseCase;
|
|
123
|
+
placementId?: string;
|
|
119
124
|
}): AnalyticsEvent;
|
|
120
125
|
/**
|
|
121
126
|
* The offer identity every claim-funnel and advertiser-handoff event carries —
|
|
@@ -141,6 +146,8 @@ export interface OfferEventContext {
|
|
|
141
146
|
presentationId?: string;
|
|
142
147
|
variantId?: string;
|
|
143
148
|
useCase?: UseCase;
|
|
149
|
+
/** The publisher's placement label, when they supplied one. See `placementProperty`. */
|
|
150
|
+
placementId?: string;
|
|
144
151
|
}
|
|
145
152
|
/**
|
|
146
153
|
* The claim TAP, emitted before any guard can fail — the advertiser funnel's
|
|
@@ -208,6 +215,106 @@ export declare function offerWebviewLoadFailed(distinctId: string, ctx: OfferEve
|
|
|
208
215
|
export declare function offerWebviewDismissed(distinctId: string, ctx: OfferEventContext, params: {
|
|
209
216
|
timeSpentSeconds: number;
|
|
210
217
|
}): AnalyticsEvent;
|
|
218
|
+
/**
|
|
219
|
+
* A strict-unlock claim confirmed by the advertiser's postback. Mirrors iOS
|
|
220
|
+
* `OfferVerifiedEvent`, including its two shapes: with the presentation context
|
|
221
|
+
* when the claim verified inside the session that made it, and with the
|
|
222
|
+
* transaction id ALONE when a later page load reconciled it.
|
|
223
|
+
*
|
|
224
|
+
* The context is optional for exactly that second case, and absent fields stay
|
|
225
|
+
* absent rather than being reconstructed — the same rule `OfferEventContext`
|
|
226
|
+
* states above. A reconciled claim genuinely has no impression or presentation in
|
|
227
|
+
* scope (the page that held them is gone), and `impression_id` is the warehouse's
|
|
228
|
+
* primary claim↔completion join key: a fabricated one joins against nothing while
|
|
229
|
+
* looking like coverage, where an absent one falls through to the documented
|
|
230
|
+
* `transaction_id` fallback and joins correctly.
|
|
231
|
+
*
|
|
232
|
+
* 🔴 `use_case` and `placement_id` are the exception, and they are NOT
|
|
233
|
+
* presentation-scoped. They describe the claim, which is the thing being verified, so
|
|
234
|
+
* they survive the page that made it — persisted on the pending record precisely so
|
|
235
|
+
* the reconciled shape can still carry them (`StrictUnlockReconciler.PendingClaim`,
|
|
236
|
+
* mirroring swift#123). Without them a strict-mode verification is the one conversion
|
|
237
|
+
* signal that falls outside every per-use-case and per-placement split, which is the
|
|
238
|
+
* comparison strict mode exists to be judged on. The bare shape is bare of
|
|
239
|
+
* PRESENTATION identity — `impression_id`, `presentation_id`, `variant_id` — not of
|
|
240
|
+
* every dimension.
|
|
241
|
+
*
|
|
242
|
+
* Only ever emitted in `unlockMode: 'strict'` — optimistic mode does no
|
|
243
|
+
* verification, so it has nothing to report.
|
|
244
|
+
*/
|
|
245
|
+
export declare function offerVerified(distinctId: string, params: {
|
|
246
|
+
transactionId: string;
|
|
247
|
+
useCase?: UseCase;
|
|
248
|
+
placementId?: string;
|
|
249
|
+
}, ctx?: OfferEventContext): AnalyticsEvent;
|
|
250
|
+
/**
|
|
251
|
+
* Why a `show()` exited before `sdk_offer_presentation_triggered` fired.
|
|
252
|
+
*
|
|
253
|
+
* The cross-SDK vocabulary, matching iOS's `ShowAbortReason` — not extended with
|
|
254
|
+
* web-only members. Two of web's pre-trigger exits (an invalid `useCase` value, a
|
|
255
|
+
* use case with no resolved copy) have no member here and therefore emit no
|
|
256
|
+
* `sdk_show_aborted`; both are fully described by `sdk_placement_resolved`'s
|
|
257
|
+
* `not_presented_reason`. Adding values to a frozen cross-SDK vocabulary is a
|
|
258
|
+
* cross-SDK decision, not a web one.
|
|
259
|
+
*
|
|
260
|
+
* `unsupported_os` exists on iOS and can never occur here — a browser that runs
|
|
261
|
+
* this bundle can render the sheet.
|
|
262
|
+
*/
|
|
263
|
+
export declare const ShowAbortReason: {
|
|
264
|
+
readonly NOT_CONFIGURED: "not_configured";
|
|
265
|
+
readonly ALREADY_PRESENTING: "already_presenting";
|
|
266
|
+
readonly EXPERIMENT_CONTROL: "experiment_control";
|
|
267
|
+
};
|
|
268
|
+
export type ShowAbortReasonValue = (typeof ShowAbortReason)[keyof typeof ShowAbortReason];
|
|
269
|
+
/**
|
|
270
|
+
* `show()` was called — emitted at the very top, before any gate.
|
|
271
|
+
*
|
|
272
|
+
* The only evidence the SDK was reached at all on an attempt that then exits
|
|
273
|
+
* somewhere with nothing else to say. `sdk_placement_resolved` covers every exit
|
|
274
|
+
* *after* configuration; this one is what makes "the host called `show()`"
|
|
275
|
+
* observable independently of what happened next.
|
|
276
|
+
*
|
|
277
|
+
* `layer` distinguishes the SDK that emitted it, since the React Native and
|
|
278
|
+
* Flutter bridges sit on top of this one and emit their own.
|
|
279
|
+
*
|
|
280
|
+
* No `variant_id`: at this point the SDK has not resolved which variant this
|
|
281
|
+
* attempt will render, and stamping the paywall's variant on what turns out to be
|
|
282
|
+
* a reward presentation is precisely the mis-attribution the per-use-case variant
|
|
283
|
+
* resolution exists to prevent.
|
|
284
|
+
*
|
|
285
|
+
* `use_case` IS known, however, because the caller asked for it, and it is stamped
|
|
286
|
+
* from the base property set rather than through the conditional `useCaseProperty`
|
|
287
|
+
* the offer-funnel events use. Required in the params type for the same reason: this
|
|
288
|
+
* dimension partitions a backend alarm (see `showAborted`), and a property that can
|
|
289
|
+
* be omitted eventually is.
|
|
290
|
+
*/
|
|
291
|
+
export declare function showEntered(distinctId: string, params: {
|
|
292
|
+
presentationId: string;
|
|
293
|
+
useCase: UseCase;
|
|
294
|
+
placementId?: string;
|
|
295
|
+
}): AnalyticsEvent;
|
|
296
|
+
/**
|
|
297
|
+
* A `show()` that exited at a pre-trigger gate. The taxonomy iOS draws and this
|
|
298
|
+
* mirrors: `sdk_show_aborted` means the attempt never entered the presentation
|
|
299
|
+
* funnel, `sdk_offer_presentation_failed` means it entered and did not reach
|
|
300
|
+
* presented.
|
|
301
|
+
*
|
|
302
|
+
* 🔴 `use_case` is REQUIRED and stamped from the base property set, never through the
|
|
303
|
+
* conditional `useCaseProperty`. Backend #443 counts `control_suppressions` off this
|
|
304
|
+
* event PARTITIONED BY use case, as the input to the D-6 bypass alarm — so a row
|
|
305
|
+
* without the dimension is not merely a thinner row, it is a suppression that lands
|
|
306
|
+
* in a NULL bucket and goes uncounted by the alarm it was supposed to feed. A
|
|
307
|
+
* conditional spread would make that the behaviour of whichever abort reason happened
|
|
308
|
+
* to be missing a use case; required-and-unconditional makes it unreachable. iOS
|
|
309
|
+
* (swift#123) and Android (android#55) stamp it the same way, off a non-optional enum.
|
|
310
|
+
*/
|
|
311
|
+
export declare function showAborted(distinctId: string, params: {
|
|
312
|
+
reason: ShowAbortReasonValue;
|
|
313
|
+
presentationId: string;
|
|
314
|
+
useCase: UseCase;
|
|
315
|
+
placementId?: string;
|
|
316
|
+
variantId?: string;
|
|
317
|
+
}): AnalyticsEvent;
|
|
211
318
|
/**
|
|
212
319
|
* The server-assigned variant landed and the sheet will render it.
|
|
213
320
|
*
|
|
@@ -221,6 +328,12 @@ export declare function offerWebviewDismissed(distinctId: string, ctx: OfferEven
|
|
|
221
328
|
* `'remote'` (config resolved) or `'fallback'` (it did not, and the bundled copy
|
|
222
329
|
* rendered). It never reports `'cache'` — web persists no variant/template pair,
|
|
223
330
|
* so claiming a cache tier would describe a mechanism this SDK does not have.
|
|
331
|
+
*
|
|
332
|
+
* Deliberately carries NEITHER `use_case` NOR `placement_id`, unlike the other two
|
|
333
|
+
* `sdk_sdui_*` events. This one fires at CONFIG-FETCH time, not inside a presentation:
|
|
334
|
+
* there is no placement yet, and the fetch covers every use case at once. Stamping
|
|
335
|
+
* either would be inventing a value, which is the one thing the placement dimension
|
|
336
|
+
* must never contain.
|
|
224
337
|
*/
|
|
225
338
|
export declare function sduiConfigLoaded(distinctId: string, params: {
|
|
226
339
|
variantId?: string;
|
|
@@ -237,6 +350,8 @@ export declare function sduiButtonTapped(distinctId: string, params: {
|
|
|
237
350
|
actionType: 'close' | 'claimOffer' | 'openUrl' | 'next' | 'previous';
|
|
238
351
|
presentationId: string;
|
|
239
352
|
currentState: string;
|
|
353
|
+
useCase?: UseCase;
|
|
354
|
+
placementId?: string;
|
|
240
355
|
}): AnalyticsEvent;
|
|
241
356
|
/**
|
|
242
357
|
* The user moved through the offer carousel. `scrollAxis` is genuinely
|
|
@@ -248,6 +363,8 @@ export declare function sduiScroll(distinctId: string, params: {
|
|
|
248
363
|
scrollAxis: 'horizontal' | 'vertical';
|
|
249
364
|
scrollPosition: number;
|
|
250
365
|
presentationId: string;
|
|
366
|
+
useCase?: UseCase;
|
|
367
|
+
placementId?: string;
|
|
251
368
|
}): AnalyticsEvent;
|
|
252
369
|
/**
|
|
253
370
|
* Exposure at the offer trigger — logged for BOTH treatment and control to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/analytics/events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,K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150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `sdk_placement_resolved` — the terminal record for one `show()` attempt, in
|
|
3
|
+
* iOS/Android's frozen outcome vocabulary (`PresentationResult.swift`).
|
|
4
|
+
*
|
|
5
|
+
* Exactly one row per attempt, whatever happened: not configured, use case not
|
|
6
|
+
* enabled, control cohort, no offers, claimed, dismissed, or blown up. That is the
|
|
7
|
+
* whole point of it — every OTHER event in the funnel exists only on the path that
|
|
8
|
+
* produces it, so a funnel built from them has no denominator that survives the
|
|
9
|
+
* early exits. Delivered through `DiagnosticsOutbox` (reliable, not
|
|
10
|
+
* fire-and-forget), and built from exactly one call site: `#recordPlacementResolved`
|
|
11
|
+
* in `Encore.ts`, which `show()`'s outer wrapper calls once.
|
|
12
|
+
*
|
|
13
|
+
* Two shape decisions worth stating up front, because both look like omissions:
|
|
14
|
+
*
|
|
15
|
+
* `advertiser_outcome` never carries `'verified'` on web. iOS's sheet blocks on the
|
|
16
|
+
* strict-unlock verification poll and can therefore fold the result into its terminal
|
|
17
|
+
* record; web's poll runs detached so it cannot race the modal's own close listeners
|
|
18
|
+
* (docs/architecture/platform-divergence/web.md #3). The fact is not lost — it is
|
|
19
|
+
* reported by `sdk_offer_verified`, joinable back on `presentation_id` in session or
|
|
20
|
+
* `transaction_id` across sessions. A cross-platform dashboard segmenting on
|
|
21
|
+
* `advertiser_outcome` alone will see web permanently at 0% verified; that is the
|
|
22
|
+
* documented shape, not a bug.
|
|
23
|
+
*
|
|
24
|
+
* `publisher_outcome` is REQUIRED and always `'not_attempted'`. The record reports
|
|
25
|
+
* what Encore did at the moment its flow ended, and Encore did not attempt a
|
|
26
|
+
* purchase — whether because web has no purchase controller at all, or because this
|
|
27
|
+
* particular flow did not use one, or because the use case is a reward. All three are
|
|
28
|
+
* the same observable fact here. Making it optional would smuggle in a second "does
|
|
29
|
+
* this platform even have the capability" dimension the record is not meant to carry.
|
|
30
|
+
*/
|
|
31
|
+
import type { AnalyticsEvent } from './models';
|
|
32
|
+
import type { ShowResult } from '../types';
|
|
33
|
+
import type { WireUseCase } from '../core/useCase';
|
|
34
|
+
/**
|
|
35
|
+
* NOT `'verified'` (see the file header). NOT `'cooldown'` either: the
|
|
36
|
+
* provisional-cooldown mechanism it describes is still unmerged backend-side, so a
|
|
37
|
+
* value for it would name something that cannot happen yet.
|
|
38
|
+
*/
|
|
39
|
+
export type AdvertiserOutcome = 'not_attempted' | 'claimed' | 'failed';
|
|
40
|
+
/** iOS/Android's wire values verbatim. Web emits only the first — see the header. */
|
|
41
|
+
export type PublisherOutcome = 'not_attempted' | 'purchased' | 'cancelled' | 'pending' | 'failed';
|
|
42
|
+
export type Resolution = 'not_presented' | 'presented';
|
|
43
|
+
export type NotPresentedReason =
|
|
44
|
+
/**
|
|
45
|
+
* Mapped from the `notConfigured` result, though no row can actually carry it:
|
|
46
|
+
* the outbox does not exist before configure(), so that path produces nothing to
|
|
47
|
+
* deliver. Mapped anyway so the translation is correct the day a diagnostic
|
|
48
|
+
* channel exists that early — iOS has the same blind spot, its enqueue being a
|
|
49
|
+
* no-op while services are nil.
|
|
50
|
+
*/
|
|
51
|
+
'not_configured' | 'already_presenting' | 'no_offer_available' | 'experiment_control' | 'use_case_unavailable'
|
|
52
|
+
/** `error.<ErrorCode>`, lowercased. */
|
|
53
|
+
| `error.${string}`;
|
|
54
|
+
export type Dismissal =
|
|
55
|
+
/** `userClosedModal` — the × and Escape. */
|
|
56
|
+
'close_button'
|
|
57
|
+
/**
|
|
58
|
+
* `userClickedOutside`. iOS's generic catch-all, not `swipe_dismiss`: that names a
|
|
59
|
+
* mobile gesture a browser backdrop tap is not.
|
|
60
|
+
*/
|
|
61
|
+
| 'dismissed'
|
|
62
|
+
/** `userDeclinedLastOffer`. */
|
|
63
|
+
| 'last_offer_declined'
|
|
64
|
+
/** A claim succeeded and the sheet closed itself. */
|
|
65
|
+
| 'flow_completed'
|
|
66
|
+
/** An unexpected failure after the sheet was already in play. */
|
|
67
|
+
| 'interrupted';
|
|
68
|
+
/**
|
|
69
|
+
* The three independent axes of a presented flow — iOS's
|
|
70
|
+
* `PresentationResult.Outcome` (`PresentationResult.swift:141`), field for field.
|
|
71
|
+
*
|
|
72
|
+
* All three are REQUIRED together. `'not_attempted'` is a real value meaning "the
|
|
73
|
+
* funnel was open and nothing entered it", which is a different fact from the axis
|
|
74
|
+
* being absent — and absent is not a state a presented row has. A row missing one
|
|
75
|
+
* of these is not a smaller row, it is an unreadable one: a dashboard cannot tell
|
|
76
|
+
* "nothing happened on this axis" from "the SDK forgot to say".
|
|
77
|
+
*/
|
|
78
|
+
export interface PresentedOutcome {
|
|
79
|
+
advertiserOutcome: AdvertiserOutcome;
|
|
80
|
+
/** Always `'not_attempted'` on web today — see the file header. */
|
|
81
|
+
publisherOutcome: PublisherOutcome;
|
|
82
|
+
dismissal: Dismissal;
|
|
83
|
+
}
|
|
84
|
+
/** Identity of what was claimed, carried only when the advertiser funnel got there. */
|
|
85
|
+
interface ClaimIdentity {
|
|
86
|
+
campaignId?: string;
|
|
87
|
+
offerId?: string;
|
|
88
|
+
transactionId?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The outcome half of the record, as a discriminated union rather than a bag of
|
|
92
|
+
* optionals — so the three-axis invariant is a compile error to break, not a
|
|
93
|
+
* convention to remember. Mirrors iOS's `enum PresentationResult { case
|
|
94
|
+
* notPresented(reason); case presented(Outcome) }`.
|
|
95
|
+
*
|
|
96
|
+
* The two branches share NO outcome fields: a `not_presented` row carries a reason
|
|
97
|
+
* and nothing else, exactly as iOS's wire assembly does
|
|
98
|
+
* (`OfferEvents+Outbox.swift:76-90`). Publishing `publisher_outcome:
|
|
99
|
+
* 'not_attempted'` on a row where no sheet ever appeared would be reporting on a
|
|
100
|
+
* funnel that never opened.
|
|
101
|
+
*/
|
|
102
|
+
export type PlacementOutcomeFields = {
|
|
103
|
+
resolution: 'not_presented';
|
|
104
|
+
notPresentedReason: NotPresentedReason;
|
|
105
|
+
} | ({
|
|
106
|
+
resolution: 'presented';
|
|
107
|
+
} & PresentedOutcome & ClaimIdentity);
|
|
108
|
+
/** The record's identity fields, present on every row regardless of resolution. */
|
|
109
|
+
export interface PlacementResolvedContext {
|
|
110
|
+
placementId?: string;
|
|
111
|
+
presentationId: string;
|
|
112
|
+
useCase: WireUseCase;
|
|
113
|
+
unlockMode: 'strict' | 'optimistic';
|
|
114
|
+
variantId?: string;
|
|
115
|
+
}
|
|
116
|
+
export type PlacementResolvedProperties = PlacementResolvedContext & PlacementOutcomeFields;
|
|
117
|
+
export declare function placementResolved(distinctId: string, properties: PlacementResolvedProperties): AnalyticsEvent;
|
|
118
|
+
/**
|
|
119
|
+
* What a resolving site must state explicitly, because the public `ShowResult`
|
|
120
|
+
* collapses it and no mapper can recover it:
|
|
121
|
+
*
|
|
122
|
+
* - `{status:'unavailable'}` is deliberately overloaded — no eligible offers, NCL
|
|
123
|
+
* control cohort, and use case not enabled all share it, so an integrator cannot
|
|
124
|
+
* reverse-engineer the incrementality experiment from a return value. The record
|
|
125
|
+
* still needs to tell them apart.
|
|
126
|
+
* - `UNKNOWN_ERROR` is produced by three structurally different sites: a failure
|
|
127
|
+
* before the sheet ever rendered, a rendering failure with no claim attempted, and
|
|
128
|
+
* a claim whose transaction write failed. The code alone cannot distinguish them.
|
|
129
|
+
*
|
|
130
|
+
* Every other case — a claim, a string `NotGrantedReason`, a distinctly-coded error —
|
|
131
|
+
* is fully derivable, and an override for those is unnecessary though harmless: it
|
|
132
|
+
* always wins.
|
|
133
|
+
*/
|
|
134
|
+
export interface PlacementResolutionOverride {
|
|
135
|
+
notPresentedReason?: NotPresentedReason;
|
|
136
|
+
advertiserOutcome?: AdvertiserOutcome;
|
|
137
|
+
dismissal?: Dismissal;
|
|
138
|
+
}
|
|
139
|
+
export type DerivedPlacementResolvedFields = PlacementOutcomeFields;
|
|
140
|
+
/**
|
|
141
|
+
* Pure mapper: a `ShowResult` (plus a disambiguating override where the result
|
|
142
|
+
* collapses one) to the record's outcome fields.
|
|
143
|
+
*
|
|
144
|
+
* `ShowResult`'s claimed member already carries `campaignId`/`offerId`/
|
|
145
|
+
* `transactionId` inline, so nothing else has to be threaded here to identify what
|
|
146
|
+
* was claimed.
|
|
147
|
+
*/
|
|
148
|
+
export declare function deriveResolvedFields(result: ShowResult, override?: PlacementResolutionOverride): DerivedPlacementResolvedFields;
|
|
149
|
+
export {};
|
|
150
|
+
//# sourceMappingURL=placementResolved.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placementResolved.d.ts","sourceRoot":"","sources":["../../src/analytics/placementResolved.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAA+B,UAAU,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGnD;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,eAAe,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEvE,qFAAqF;AACrF,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG,WAAW,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;AAElG,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,WAAW,CAAC;AAEvD,MAAM,MAAM,kBAAkB;AAC5B;;;;;;GAMG;AACD,gBAAgB,GAChB,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,GACpB,sBAAsB;AACxB,uCAAuC;GACrC,SAAS,MAAM,EAAE,CAAC;AAEtB,MAAM,MAAM,SAAS;AACnB,4CAA4C;AAC1C,cAAc;AAChB;;;GAGG;GACD,WAAW;AACb,+BAA+B;GAC7B,qBAAqB;AACvB,qDAAqD;GACnD,gBAAgB;AAClB,iEAAiE;GAC/D,aAAa,CAAC;AAElB;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB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HANGED
|
@@ -46,8 +46,14 @@ export declare class APIClient {
|
|
|
46
46
|
* turn this best-effort label into a hard failure of the entire offers fetch for
|
|
47
47
|
* a publisher who simply named their placement something long. Truncating keeps
|
|
48
48
|
* the analytics label degraded-but-present instead of losing the offer entirely.
|
|
49
|
+
*
|
|
50
|
+
* `maxPostbackTimeMs` is strict-unlock mode's offer filter — only campaigns whose
|
|
51
|
+
* postback latency fits the verification window. It is a fixed SDK constant
|
|
52
|
+
* (`StrictUnlock.MAX_POSTBACK_TIME_MS`), never publisher input, so unlike
|
|
53
|
+
* `placementId` there is nothing to bound here: the contract's own 1000..120000
|
|
54
|
+
* range (`offers/dto.ts`) cannot be violated by a caller.
|
|
49
55
|
*/
|
|
50
|
-
fetchOffers(userId: string, attributes: UserAttributes, placementId?: string): Promise<{
|
|
56
|
+
fetchOffers(userId: string, attributes: UserAttributes, placementId?: string, maxPostbackTimeMs?: number): Promise<{
|
|
51
57
|
offers: OfferModel[];
|
|
52
58
|
}>;
|
|
53
59
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"APIClient.d.ts","sourceRoot":"","sources":["../../src/api/APIClient.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAe,cAAc,EAAE,WAAW,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEtG,OAAO,KAAK,EAEV,wBAAwB,EAIxB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,yBAAyB,EAC1B,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"APIClient.d.ts","sourceRoot":"","sources":["../../src/api/APIClient.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAe,cAAc,EAAE,WAAW,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEtG,OAAO,KAAK,EAEV,wBAAwB,EAIxB,gBAAgB,EAChB,oBAAoB,E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M,CAAC;QAClD,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACnC,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBjB;;OAEG;IACG,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAW3D"}
|
|
@@ -317,7 +317,7 @@ export interface paths {
|
|
|
317
317
|
* @description SDUI variant ID from frontend config fetch. If provided, filters creatives by variant assignment. If not provided, no variant filtering is applied.
|
|
318
318
|
*/
|
|
319
319
|
variantId?: string;
|
|
320
|
-
/** @description Publisher-defined surface label for where the offer is shown (e.g. 'paywall', 'onboarding', 'settings'). Best-effort analytics context: when supplied it is stamped onto the sdk_offer_requested event so publisher analytics can break the funnel out by placement. Max 64 chars
|
|
320
|
+
/** @description Publisher-defined surface label for where the offer is shown (e.g. 'paywall', 'onboarding', 'settings'). Best-effort analytics context: when supplied it is stamped onto the sdk_offer_requested event so publisher analytics can break the funnel out by placement. Max 64 chars. SDKs may send their own auto-generated `placement_<8 hex>` id when the publisher supplied none — that is expected and is folded into the '(unlabeled)' bucket at read time; do NOT substitute '(unlabeled)' or an empty string yourself. */
|
|
321
321
|
placementId?: string;
|
|
322
322
|
/** @description Strict unlock mode: only include campaigns whose postback latency is less than or equal to this value (in milliseconds). Omit for no filtering. Bounded 1000..120000. */
|
|
323
323
|
maxPostbackTimeMs?: number;
|
|
@@ -2991,6 +2991,11 @@ export interface paths {
|
|
|
2991
2991
|
* @description Client-issued UUID v4 used as the conversion attribution id; substituted into the sponsor URL at email-send time.
|
|
2992
2992
|
*/
|
|
2993
2993
|
transactionId: string;
|
|
2994
|
+
/**
|
|
2995
|
+
* @description Which Encore surface the user claimed from. Persisted on the transaction this route creates, so the server-side completion — built from that row alone, with no client context — can be split by use case, along with the payout booked on it. Absent means 'churn-intervention'.
|
|
2996
|
+
* @enum {string}
|
|
2997
|
+
*/
|
|
2998
|
+
useCase?: "churn-intervention" | "post-action-reward";
|
|
2994
2999
|
};
|
|
2995
3000
|
};
|
|
2996
3001
|
};
|