@encorekit/web-sdk 1.1.19 → 1.1.21
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 +63 -3
- 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/embed/README.md +1 -1
- package/examples/angular/src/app/app.component.ts +0 -1
- package/examples/angular/src/app/encore.service.ts +1 -2
- package/examples/ios-webview/EncoreWebViewBridge.swift +3 -10
- package/examples/ios-webview/README.md +0 -20
- package/examples/react/.env +1 -0
- package/examples/react/src/App.tsx +1 -1
- package/examples/svelte/src/App.svelte +0 -2
- package/examples/vanilla-js/index.html +0 -2
- package/examples/vue/src/App.vue +0 -2
- package/package.json +10 -8
- package/types/analytics/AnalyticsClient.d.ts +11 -3
- package/types/analytics/AnalyticsClient.d.ts.map +1 -1
- package/types/analytics/events.d.ts +30 -1
- package/types/analytics/events.d.ts.map +1 -1
- package/types/analytics/models.d.ts +11 -8
- package/types/analytics/models.d.ts.map +1 -1
- package/types/analytics/transport.d.ts +23 -0
- package/types/analytics/transport.d.ts.map +1 -0
- package/types/api/APIClient.d.ts +1 -1
- package/types/api/APIClient.d.ts.map +1 -1
- package/types/api/contract.d.ts +32 -0
- package/types/api/contract.d.ts.map +1 -0
- package/types/api/generated/types.d.ts +4519 -0
- package/types/api/generated/types.d.ts.map +1 -0
- package/types/api/models.d.ts +45 -128
- package/types/api/models.d.ts.map +1 -1
- package/types/core/Configuration.d.ts +2 -2
- package/types/core/Configuration.d.ts.map +1 -1
- package/types/core/DisplayResolver.d.ts +121 -0
- package/types/core/DisplayResolver.d.ts.map +1 -0
- package/types/core/Encore.d.ts +77 -4
- package/types/core/Encore.d.ts.map +1 -1
- package/types/core/PlacementBuilder.d.ts +14 -9
- package/types/core/PlacementBuilder.d.ts.map +1 -1
- package/types/core/TransactionStore.d.ts +35 -0
- package/types/core/TransactionStore.d.ts.map +1 -0
- package/types/core/version.d.ts +1 -1
- package/types/experiments/ExperimentManager.d.ts +43 -0
- package/types/experiments/ExperimentManager.d.ts.map +1 -0
- package/types/experiments/ExposureOutbox.d.ts +37 -0
- package/types/experiments/ExposureOutbox.d.ts.map +1 -0
- package/types/experiments/bucketing.d.ts +33 -0
- package/types/experiments/bucketing.d.ts.map +1 -0
- package/types/experiments/types.d.ts +60 -0
- package/types/experiments/types.d.ts.map +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/react.d.ts +1 -3
- package/types/react.d.ts.map +1 -1
- package/types/types.d.ts +284 -18
- package/types/types.d.ts.map +1 -1
- package/types/ui/OfferCard.d.ts.map +1 -1
- package/types/ui/OfferCarousel.d.ts +14 -3
- package/types/ui/OfferCarousel.d.ts.map +1 -1
- package/types/ui/OfferModal.d.ts +6 -0
- package/types/ui/OfferModal.d.ts.map +1 -1
- package/types/ui/PrimerScreen.d.ts +34 -0
- package/types/ui/PrimerScreen.d.ts.map +1 -0
- package/types/ui/RedemptionScreen.d.ts +57 -0
- package/types/ui/RedemptionScreen.d.ts.map +1 -0
- package/types/ui/ThankYouLayout.d.ts +35 -0
- package/types/ui/ThankYouLayout.d.ts.map +1 -0
- package/types/ui/brandComponents.d.ts +45 -0
- package/types/ui/brandComponents.d.ts.map +1 -0
- package/types/ui/safeImageSrc.d.ts +15 -0
- package/types/ui/safeImageSrc.d.ts.map +1 -0
- package/types/ui/styles.d.ts.map +1 -1
- package/examples/react/.env.local +0 -1
- package/types/__tests__/PlacementBuilder.test.d.ts +0 -2
- package/types/__tests__/PlacementBuilder.test.d.ts.map +0 -1
- package/types/__tests__/SuccessScreen.test.d.ts +0 -2
- package/types/__tests__/SuccessScreen.test.d.ts.map +0 -1
- package/types/__tests__/react.test.d.ts +0 -2
- package/types/__tests__/react.test.d.ts.map +0 -1
- package/types/__tests__/styles.test.d.ts +0 -2
- package/types/__tests__/styles.test.d.ts.map +0 -1
- package/types/ui/SuccessScreen.d.ts +0 -35
- package/types/ui/SuccessScreen.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@encorekit/web-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Encore SDK for web applications - display targeted offers and manage user entitlements",
|
|
6
6
|
"main": "./dist/cjs/index.cjs",
|
|
@@ -34,25 +34,24 @@
|
|
|
34
34
|
],
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "npm run build:types && npm run build:bundle && npm run build:embed",
|
|
37
|
-
"build:types": "tsc --emitDeclarationOnly
|
|
37
|
+
"build:types": "tsc -p tsconfig.types.json --emitDeclarationOnly",
|
|
38
38
|
"build:bundle": "rollup -c",
|
|
39
39
|
"build:embed": "rollup -c --config-embed",
|
|
40
40
|
"build:watch": "rollup -c -w",
|
|
41
41
|
"test": "vitest run",
|
|
42
42
|
"test:watch": "vitest",
|
|
43
|
+
"typecheck": "tsc --noEmit -p tsconfig.build.json",
|
|
43
44
|
"lint": "eslint src --ext .ts,.tsx",
|
|
44
45
|
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
45
46
|
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
|
|
46
47
|
"format:check": "prettier --check \"src/**/*.{ts,tsx}\"",
|
|
47
|
-
"demo:
|
|
48
|
+
"demo:frontend": "http-server -p 3000 -c-1 -o demo/index.html",
|
|
48
49
|
"demo:backend": "ENV_FILE=.env.local node demo/backend.js",
|
|
49
|
-
"demo:backend:
|
|
50
|
-
"demo:full": "npm run build && concurrently \"npm run demo:backend\" \"http-server -p 3000\"",
|
|
51
|
-
"demo:full:prod": "npm run build && concurrently \"npm run demo:backend:prod\" \"http-server -p 3000\"",
|
|
50
|
+
"demo:dev": "concurrently -n watch,backend,frontend -c blue,magenta,green \"npm run build:watch\" \"npm run demo:backend\" \"npm run demo:frontend\"",
|
|
52
51
|
"dev:example": "bash scripts/dev-example.sh",
|
|
53
52
|
"embed:serve": "http-server -p 3001 -o embed/index.html",
|
|
54
53
|
"clean:examples": "bash scripts/clean-examples.sh",
|
|
55
|
-
"prepublishOnly": "npm run build && npm run clean:examples",
|
|
54
|
+
"prepublishOnly": "npm test && npm run build && npm run clean:examples",
|
|
56
55
|
"pack:local": "npm run build && npm run clean:examples && npm pack"
|
|
57
56
|
},
|
|
58
57
|
"keywords": [
|
|
@@ -91,6 +90,8 @@
|
|
|
91
90
|
"express": "^5.1.0",
|
|
92
91
|
"http-server": "^14.1.1",
|
|
93
92
|
"jsdom": "^25.0.0",
|
|
93
|
+
"openapi-typescript": "^7.13.0",
|
|
94
|
+
"openapi-zod-client": "^1.18.3",
|
|
94
95
|
"prettier": "^3.6.2",
|
|
95
96
|
"react": "^19.0.0",
|
|
96
97
|
"react-dom": "^19.0.0",
|
|
@@ -98,7 +99,8 @@
|
|
|
98
99
|
"tslib": "^2.8.1",
|
|
99
100
|
"typescript": "^5.9.3",
|
|
100
101
|
"typescript-eslint": "^8.46.1",
|
|
101
|
-
"vitest": "^3.0.0"
|
|
102
|
+
"vitest": "^3.0.0",
|
|
103
|
+
"zod": "^3.25.76"
|
|
102
104
|
},
|
|
103
105
|
"license": "UNLICENSED"
|
|
104
106
|
}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Analytics Client
|
|
3
|
-
* Fire-and-forget event dispatch to the analytics API
|
|
3
|
+
* Fire-and-forget event dispatch to the analytics API.
|
|
4
|
+
*
|
|
5
|
+
* Includes ingest-side dedup for noisy lifecycle/identity events: a 30-day
|
|
6
|
+
* audit showed `user_identified` was emitting per-session and consuming a
|
|
7
|
+
* disproportionate share of the analytics pipe. We throttle to one emit
|
|
8
|
+
* per distinct_id per 24h on the SDK side so the noise never leaves the
|
|
9
|
+
* client.
|
|
4
10
|
*/
|
|
5
11
|
import type { AnalyticsEvent } from './models';
|
|
12
|
+
import type { StorageManager } from '../core/StorageManager';
|
|
6
13
|
export declare class AnalyticsClient {
|
|
7
14
|
#private;
|
|
8
|
-
constructor(apiKey: string, analyticsBaseURL: string);
|
|
15
|
+
constructor(apiKey: string, analyticsBaseURL: string, storage?: StorageManager);
|
|
9
16
|
/**
|
|
10
|
-
* Track an analytics event (fire-and-forget)
|
|
17
|
+
* Track an analytics event (fire-and-forget).
|
|
18
|
+
* Throttles dedup-eligible events; silently drops UX never blocks on this.
|
|
11
19
|
*/
|
|
12
20
|
track(event: AnalyticsEvent): void;
|
|
13
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsClient.d.ts","sourceRoot":"","sources":["../../src/analytics/AnalyticsClient.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"AnalyticsClient.d.ts","sourceRoot":"","sources":["../../src/analytics/AnalyticsClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAgB7D,qBAAa,eAAe;;gBAKd,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc;IAM9E;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;CA6CnC"}
|
|
@@ -49,6 +49,24 @@ export declare function offerSheetDismissed(distinctId: string, params: {
|
|
|
49
49
|
declineReason?: string;
|
|
50
50
|
variantId?: string;
|
|
51
51
|
}): AnalyticsEvent;
|
|
52
|
+
/**
|
|
53
|
+
* Primer-screen (post-claim activation handoff) outcomes. The two events are what
|
|
54
|
+
* distinguish the two 'claimed' exits — the ShowResult is 'claimed' either way.
|
|
55
|
+
* Payloads are ID-ONLY by contract: resolved display strings and the host `detail`
|
|
56
|
+
* line never ride analytics (publishers may template user data into them).
|
|
57
|
+
*/
|
|
58
|
+
export declare function offerActivationContinue(distinctId: string, params: {
|
|
59
|
+
transactionId: string;
|
|
60
|
+
campaignId: string;
|
|
61
|
+
presentationId: string;
|
|
62
|
+
variantId?: string;
|
|
63
|
+
}): AnalyticsEvent;
|
|
64
|
+
export declare function offerActivationDismissed(distinctId: string, params: {
|
|
65
|
+
transactionId: string;
|
|
66
|
+
campaignId: string;
|
|
67
|
+
presentationId: string;
|
|
68
|
+
variantId?: string;
|
|
69
|
+
}): AnalyticsEvent;
|
|
52
70
|
export declare function offerTimeSpent(distinctId: string, params: {
|
|
53
71
|
campaignId: string;
|
|
54
72
|
offerIndex: number;
|
|
@@ -58,6 +76,17 @@ export declare function offerTimeSpent(distinctId: string, params: {
|
|
|
58
76
|
presentationId: string;
|
|
59
77
|
variantId?: string;
|
|
60
78
|
}): AnalyticsEvent;
|
|
61
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Exposure at the offer trigger — logged for BOTH treatment and control to
|
|
81
|
+
* establish the NCL A/B denominator. Cross-platform contract: event name and
|
|
82
|
+
* property keys match iOS `Experiment+Outbox.swift` / Android
|
|
83
|
+
* `ExperimentExposureEvent` verbatim (BigQuery joins on these literals). The
|
|
84
|
+
* envelope adds platform/sdk_version/app_bundle_id; distinct_id == appAccountId.
|
|
85
|
+
*/
|
|
86
|
+
export declare function experimentExposure(appAccountId: string, params: {
|
|
87
|
+
experiment: string;
|
|
88
|
+
cohort: string;
|
|
89
|
+
assignmentVersion: number;
|
|
90
|
+
}): AnalyticsEvent;
|
|
62
91
|
export declare function sdkError(distinctId: string, errorType: string, errorDescription: string, context?: string): AnalyticsEvent;
|
|
63
92
|
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/analytics/events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAA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EAAE,MAAM,EAClB,MAAM,EAAE;IACN,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACA,cAAc,CAMhB;AAED,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE;IACN,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACA,cAAc,CAMhB;AAMD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,GACxE,cAAc,CAWhB;AAMD,wBAAgB,QAAQ,CACtB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,MAAM,EACxB,OAAO,CAAC,EAAE,MAAM,GACf,cAAc,CAMhB"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Analytics Types
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* `EventEnvelope` is the on-the-wire analytics ingest shape and is now DERIVED
|
|
5
|
+
* from the backend contract (POST /v1/events request, single-event form) via
|
|
6
|
+
* `./../api/contract`. This is the shape whose `event_id: uuid` requirement the
|
|
7
|
+
* `sdk_experiment_exposure` bug violated — see AnalyticsEventEnvelopeSchema for
|
|
8
|
+
* the runtime validator that now guards it at the boundary.
|
|
9
|
+
*
|
|
10
|
+
* `AnalyticsEvent` is the SDK-internal event shape (pre-envelope) — not a
|
|
11
|
+
* contract type.
|
|
4
12
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
event_name: string;
|
|
8
|
-
event_timestamp: string;
|
|
9
|
-
distinct_id: string;
|
|
10
|
-
properties: Record<string, unknown>;
|
|
11
|
-
}
|
|
13
|
+
import type { AnalyticsEventEnvelope } from '../api/contract';
|
|
14
|
+
export type EventEnvelope = AnalyticsEventEnvelope;
|
|
12
15
|
export interface AnalyticsEvent {
|
|
13
16
|
name: string;
|
|
14
17
|
distinctId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/analytics/models.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/analytics/models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAEnD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared analytics wire transport: the single source of truth for the event
|
|
3
|
+
* envelope shape and the POST /events request (endpoint + auth headers).
|
|
4
|
+
*
|
|
5
|
+
* Both the fire-and-forget `AnalyticsClient` and the reliable `ExposureOutbox`
|
|
6
|
+
* build on these so the wire contract (metadata fields + auth) lives in one place.
|
|
7
|
+
*/
|
|
8
|
+
import type { AnalyticsEvent, EventEnvelope } from './models';
|
|
9
|
+
/**
|
|
10
|
+
* Wrap an event in the analytics wire envelope, injecting the shared web metadata
|
|
11
|
+
* (platform, sdk_version, app_bundle_id). `eventId` defaults to a fresh UUID;
|
|
12
|
+
* callers needing idempotent retries pass a stable id.
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildEnvelope(event: AnalyticsEvent, eventId?: string): EventEnvelope;
|
|
15
|
+
/**
|
|
16
|
+
* POST an envelope to the analytics ingest endpoint. Returns the fetch promise so
|
|
17
|
+
* callers choose their own delivery policy (fire-and-forget vs. await + retry).
|
|
18
|
+
* `keepalive` lets the request outlive document unload (used for exposure flush).
|
|
19
|
+
*/
|
|
20
|
+
export declare function postEvent(baseURL: string, apiKey: string, envelope: EventEnvelope, options?: {
|
|
21
|
+
keepalive?: boolean;
|
|
22
|
+
}): Promise<Response>;
|
|
23
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/analytics/transport.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAI9D;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,GAAE,MAAuB,GAAG,aAAa,CAcpG;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,aAAa,EACvB,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GAChC,OAAO,CAAC,QAAQ,CAAC,CAWnB"}
|
package/types/api/APIClient.d.ts
CHANGED
|
@@ -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,MAAM,UAAU,CAAC;AAE7F,OAAO,KAAK,EAEV,wBAAwB,EAIxB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,y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BjB;;OAEG;IACG,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAW3D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract type barrel — the single seam between the SDK and the backend contract.
|
|
3
|
+
*
|
|
4
|
+
* Friendly-named, declaration-safe TYPES sourced from the generated
|
|
5
|
+
* `./generated/types.ts` (openapi-typescript over the merged + drift-gated
|
|
6
|
+
* OpenAPI). Import contract TYPES from HERE so a schema rename in the generator
|
|
7
|
+
* surfaces as one compile error in this file.
|
|
8
|
+
*
|
|
9
|
+
* Two generated artifacts, one contract (both produced by `make sync-contract`):
|
|
10
|
+
* - `./generated/types.ts` — concrete TS types (this file re-exports them).
|
|
11
|
+
* Declaration-safe, so they ship in the SDK's public `.d.ts`.
|
|
12
|
+
* - `./generated/schemas.ts` — runtime zod validators, used by tests to
|
|
13
|
+
* `.parse()` fixtures at the boundary (the link-B guarantee). Kept OUT of the
|
|
14
|
+
* declaration graph: giant zod schemas cannot serialize into `.d.ts` (TS7056),
|
|
15
|
+
* so ONLY tests / runtime validators import them, never production sources.
|
|
16
|
+
*/
|
|
17
|
+
import type { components } from './generated/types';
|
|
18
|
+
type Schema = components['schemas'];
|
|
19
|
+
export type AnalyticsEventEnvelope = Schema['AnalyticsEventEnvelope'];
|
|
20
|
+
export type ConfigResponse = Schema['ConfigResponse'];
|
|
21
|
+
export type OffersSearchResponse = Schema['OffersSearchResponse'];
|
|
22
|
+
export type Campaign = Schema['Campaign'];
|
|
23
|
+
export type Creative = Schema['Creative'];
|
|
24
|
+
export type Organization = Schema['Organization'];
|
|
25
|
+
export type TransactionResponse = Schema['TransactionResponse'];
|
|
26
|
+
export type SignalResponse = Schema['SignalResponse'];
|
|
27
|
+
export type EntitlementsResponse = Schema['EntitlementsResponse'];
|
|
28
|
+
export type VerificationStatusResponse = Schema['VerificationStatusResponse'];
|
|
29
|
+
export type InitUserResponse = Schema['InitUserResponse'];
|
|
30
|
+
export type IdentifyUserResponse = Schema['IdentifyUserResponse'];
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/api/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,KAAK,MAAM,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;AAEpC,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC;AACtE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACtD,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAClE,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAC1C,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAC1C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAClD,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACtD,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAClE,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAC;AAC9E,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAC1D,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC"}
|