@rovenue/react-native-sdk 0.26.0 → 0.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/android/src/main/java/dev/rovenue/sdkrn/FunnelCheckRequests.kt +78 -0
- package/android/src/main/java/dev/rovenue/sdkrn/RovenueFunnelExpoView.kt +22 -1
- package/android/src/main/java/dev/rovenue/sdkrn/RovenueModule.kt +36 -6
- package/dist/chunk-LGHW24EC.js +7 -0
- package/dist/{chunk-BORMJJTI.js.map → chunk-LGHW24EC.js.map} +1 -1
- package/dist/index.cjs +75 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +105 -1
- package/dist/index.d.ts +105 -1
- package/dist/index.js +74 -7
- package/dist/index.js.map +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.mts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/ios/RovenueFunnelExpoView.swift +22 -1
- package/ios/RovenueModule.swift +114 -8
- package/package.json +1 -1
- package/dist/chunk-BORMJJTI.js +0 -7
package/dist/index.d.mts
CHANGED
|
@@ -504,6 +504,69 @@ declare function restorePurchases(): Promise<PurchaseResult>;
|
|
|
504
504
|
declare function preloadPlacement(placementId: string, locale?: string): Promise<void>;
|
|
505
505
|
declare function setFallbackPlacements(json: string): Promise<number>;
|
|
506
506
|
|
|
507
|
+
/**
|
|
508
|
+
* The photo a `photo_upload` question was answered with — normalised and
|
|
509
|
+
* stored on the device (an upright JPEG with no metadata). Rovenue never
|
|
510
|
+
* receives it. Call {@link releasePhoto} once you are done with the file;
|
|
511
|
+
* an unreleased one is deleted 7 days after it was picked.
|
|
512
|
+
*/
|
|
513
|
+
interface FunnelPhotoRef {
|
|
514
|
+
/** The file, a `file://` URI. Valid until {@link releasePhoto} or for 7 days. */
|
|
515
|
+
localUri: string;
|
|
516
|
+
/** Pixel width, after normalisation. */
|
|
517
|
+
width: number;
|
|
518
|
+
/** Pixel height, after normalisation. */
|
|
519
|
+
height: number;
|
|
520
|
+
/** The file's size in bytes. */
|
|
521
|
+
byteSize: number;
|
|
522
|
+
/** Always `image/jpeg`. */
|
|
523
|
+
mimeType: string;
|
|
524
|
+
}
|
|
525
|
+
/** What the SDK asks your photo checker (`onCheck`). */
|
|
526
|
+
interface FunnelCheckRequest {
|
|
527
|
+
/** The check block's answer key. */
|
|
528
|
+
checkKey: string;
|
|
529
|
+
/** The checker's step ids, in order. */
|
|
530
|
+
steps: string[];
|
|
531
|
+
/** The photo to judge, on the device. */
|
|
532
|
+
photo: FunnelPhotoRef;
|
|
533
|
+
/** The funnel's content locale (BCP-47), for any copy the checker returns. */
|
|
534
|
+
locale: string;
|
|
535
|
+
/** 1-based: completed checks for this block so far, plus one. */
|
|
536
|
+
attempt: number;
|
|
537
|
+
}
|
|
538
|
+
/** Your checker's final answer for a photo check. */
|
|
539
|
+
interface FunnelCheckOutcome {
|
|
540
|
+
/** `pass` or `fail`. */
|
|
541
|
+
result: "pass" | "fail";
|
|
542
|
+
/** Plain text the funnel can show (`{{<checkKey>}}`). */
|
|
543
|
+
label?: string;
|
|
544
|
+
/** Why it failed, in plain text (`{{<checkKey>.reason}}`). */
|
|
545
|
+
reason?: string;
|
|
546
|
+
/** Each step id's final status (`pass` | `fail`). */
|
|
547
|
+
steps?: Record<string, string>;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Your photo checker. Resolve the outcome; resolving `null` / `undefined`,
|
|
551
|
+
* or rejecting, applies the check's `whenUnavailable`. The native SDK bounds
|
|
552
|
+
* it by the check's `timeoutMs` (then the result is `timeout` and a late
|
|
553
|
+
* answer is ignored).
|
|
554
|
+
*
|
|
555
|
+
* On Android a presented funnel (`presentFunnel`) is its own activity, and
|
|
556
|
+
* React Native pauses JS timers while the app's activity is covered: a
|
|
557
|
+
* `setTimeout` inside the handler fires only after the funnel closes. Network
|
|
558
|
+
* calls (`fetch`) and promises run as usual — call your checker service
|
|
559
|
+
* directly rather than through a timer.
|
|
560
|
+
*/
|
|
561
|
+
type FunnelCheckHandler = (request: FunnelCheckRequest) => Promise<FunnelCheckOutcome | null | undefined> | FunnelCheckOutcome | null | undefined;
|
|
562
|
+
/**
|
|
563
|
+
* Deletes a photo a funnel stored on the device, once you are done with it:
|
|
564
|
+
* the `localUri` of a {@link FunnelPhotoRef} from `onPhotoSelected` or a
|
|
565
|
+
* presentation's `photos`. Anything outside the SDK's photo store is
|
|
566
|
+
* ignored. Resolves whether a stored photo was deleted.
|
|
567
|
+
*/
|
|
568
|
+
declare function releasePhoto(localUri: string): Promise<boolean>;
|
|
569
|
+
|
|
507
570
|
/** How a presented funnel covers the app. */
|
|
508
571
|
type FunnelPresentationStyle = "fullScreen" | "modal" | "sheet";
|
|
509
572
|
/** How a full-screen funnel enters; Reduce Motion / animations off make each a fade. */
|
|
@@ -555,6 +618,17 @@ interface PresentFunnelOptions {
|
|
|
555
618
|
actionId: string;
|
|
556
619
|
paramsJson: string;
|
|
557
620
|
}) => void;
|
|
621
|
+
/**
|
|
622
|
+
* Values for the funnel's declared externals (an ad's scene, a campaign):
|
|
623
|
+
* trimmed, 512 characters at most, undeclared names dropped. A fresh value
|
|
624
|
+
* overrides a restored one and preselects a `defaultFrom` question. Never
|
|
625
|
+
* pass personal data: values are written to the on-device session state.
|
|
626
|
+
*/
|
|
627
|
+
values?: Record<string, string>;
|
|
628
|
+
/** A `photo_upload` question was answered: its key and the photo on the device. */
|
|
629
|
+
onPhotoSelected?: (questionKey: string, photo: FunnelPhotoRef) => void;
|
|
630
|
+
/** Your photo checker; without it a check applies its `whenUnavailable`. */
|
|
631
|
+
onCheck?: FunnelCheckHandler;
|
|
558
632
|
}
|
|
559
633
|
/** What `presentFunnel` resolves with. */
|
|
560
634
|
interface FunnelPresentResult {
|
|
@@ -568,6 +642,12 @@ interface FunnelPresentResult {
|
|
|
568
642
|
lastError?: RovenueError;
|
|
569
643
|
/** Why nothing was presented: `alreadyPresented`, `noPresenter`, or the placement's unavailable reason. */
|
|
570
644
|
reason?: string;
|
|
645
|
+
/**
|
|
646
|
+
* The photos the visitor answered `photo_upload` questions with, by
|
|
647
|
+
* question key — files on the device, kept until `releasePhoto` or 7
|
|
648
|
+
* days. Empty when there were none.
|
|
649
|
+
*/
|
|
650
|
+
photos: Record<string, FunnelPhotoRef>;
|
|
571
651
|
}
|
|
572
652
|
/**
|
|
573
653
|
* Present the funnel a placement serves — natively, the way the funnel's
|
|
@@ -581,6 +661,10 @@ interface FunnelPresentResult {
|
|
|
581
661
|
* a time: a second call while one is up resolves `unavailable` with reason
|
|
582
662
|
* `alreadyPresented`.
|
|
583
663
|
*
|
|
664
|
+
* A funnel with a photo check calls `onCheck` and waits for its answer, up
|
|
665
|
+
* to the check's timeout; the photos the visitor gave come back in
|
|
666
|
+
* `photos` — call `releasePhoto` with each once you are done with it.
|
|
667
|
+
*
|
|
584
668
|
* @example
|
|
585
669
|
* const { result, purchased } = await presentFunnel({ placement: "paywall" });
|
|
586
670
|
*/
|
|
@@ -685,6 +769,13 @@ declare function setLogHandler(fn: ((entry: LogEntry) => void) | null): void;
|
|
|
685
769
|
interface FunnelClaimResult {
|
|
686
770
|
subscriberId: string;
|
|
687
771
|
funnelAnswers: Record<string, unknown>;
|
|
772
|
+
/**
|
|
773
|
+
* The question keys an app value preselected and the visitor left
|
|
774
|
+
* unchanged (the claim's `funnel_preselected`), so a default can be told
|
|
775
|
+
* from a choice. Empty when nothing was preselected or the server
|
|
776
|
+
* predates the field.
|
|
777
|
+
*/
|
|
778
|
+
funnelPreselected: string[];
|
|
688
779
|
}
|
|
689
780
|
interface ClaimInstallParams {
|
|
690
781
|
platform: "ios" | "android";
|
|
@@ -828,6 +919,18 @@ type RovenueFunnelViewProps = {
|
|
|
828
919
|
onPurchase?: (packageIdentifier: string) => void;
|
|
829
920
|
/** The funnel asked for purchases to be restored. */
|
|
830
921
|
onRestore?: () => void;
|
|
922
|
+
/** Values for the funnel's declared externals (an ad's scene, a
|
|
923
|
+
* campaign): trimmed, 512 characters at most, undeclared names dropped.
|
|
924
|
+
* A fresh value overrides a restored one and preselects a `defaultFrom`
|
|
925
|
+
* question. A changed value resolves again. Never pass personal data:
|
|
926
|
+
* values are written to the on-device session state. */
|
|
927
|
+
values?: Record<string, string>;
|
|
928
|
+
/** A `photo_upload` question was answered: its key and the photo on the
|
|
929
|
+
* device. Call `releasePhoto` once you are done with the file. */
|
|
930
|
+
onPhotoSelected?: (questionKey: string, photo: FunnelPhotoRef) => void;
|
|
931
|
+
/** Your photo checker; without it a check applies its `whenUnavailable`.
|
|
932
|
+
* Presence is decided when the funnel resolves. */
|
|
933
|
+
onCheck?: FunnelCheckHandler;
|
|
831
934
|
};
|
|
832
935
|
/**
|
|
833
936
|
* Hosts the platform's native funnel renderer for a placement.
|
|
@@ -860,6 +963,7 @@ declare const Rovenue: {
|
|
|
860
963
|
readonly setFallbackPlacements: typeof setFallbackPlacements;
|
|
861
964
|
readonly preloadPlacement: typeof preloadPlacement;
|
|
862
965
|
readonly presentFunnel: typeof presentFunnel;
|
|
966
|
+
readonly releasePhoto: typeof releasePhoto;
|
|
863
967
|
readonly track: typeof track;
|
|
864
968
|
readonly refreshRemoteConfig: typeof refreshRemoteConfig;
|
|
865
969
|
readonly getRemoteConfig: typeof getRemoteConfig;
|
|
@@ -899,4 +1003,4 @@ declare const Rovenue: {
|
|
|
899
1003
|
readonly addChangeListener: (cb: (event: ChangeEvent) => void) => (() => void);
|
|
900
1004
|
};
|
|
901
1005
|
|
|
902
|
-
export { type AttributionProvider, type ChangeEvent, type ClaimInstallParams, ERROR_KINDS, EVENT_WIRE_VERSION, type Entitlement, type ErrorExtras, type ErrorKind, type EventEnvelope, type ExperimentAssignment, type FunnelClaimResult, type FunnelCustomAction, type FunnelDraftIssue, type FunnelLoadedEvent, type FunnelPresentResult, type FunnelPresentationEnter, type FunnelPresentationOverride, type FunnelPresentationStyle, type FunnelScreenEvent, type FunnelSheetDetent, type FunnelUnavailableEvent, type FunnelUnavailableReason, type IdentityContext, type LogEntry, type Offering, type Offerings, type Package, type PresentFunnelOptions, type ProductType, type PurchaseResult, type RemoteConfig, Rovenue, type RovenueConfig, RovenueError, RovenueFunnelView, type RovenueFunnelViewProps, type StoreProduct, type TrackParams, type User, type VirtualCurrencyGrant, extractFunnelToken, mapNativeError, presentFunnel, serializeEnvelope, stripUndefined, useCurrentUser, useEntitlement, useEntitlements, useExperiment, useFlag, useRemoteConfig, useVirtualCurrencies, useVirtualCurrency };
|
|
1006
|
+
export { type AttributionProvider, type ChangeEvent, type ClaimInstallParams, ERROR_KINDS, EVENT_WIRE_VERSION, type Entitlement, type ErrorExtras, type ErrorKind, type EventEnvelope, type ExperimentAssignment, type FunnelCheckHandler, type FunnelCheckOutcome, type FunnelCheckRequest, type FunnelClaimResult, type FunnelCustomAction, type FunnelDraftIssue, type FunnelLoadedEvent, type FunnelPhotoRef, type FunnelPresentResult, type FunnelPresentationEnter, type FunnelPresentationOverride, type FunnelPresentationStyle, type FunnelScreenEvent, type FunnelSheetDetent, type FunnelUnavailableEvent, type FunnelUnavailableReason, type IdentityContext, type LogEntry, type Offering, type Offerings, type Package, type PresentFunnelOptions, type ProductType, type PurchaseResult, type RemoteConfig, Rovenue, type RovenueConfig, RovenueError, RovenueFunnelView, type RovenueFunnelViewProps, type StoreProduct, type TrackParams, type User, type VirtualCurrencyGrant, extractFunnelToken, mapNativeError, presentFunnel, releasePhoto, serializeEnvelope, stripUndefined, useCurrentUser, useEntitlement, useEntitlements, useExperiment, useFlag, useRemoteConfig, useVirtualCurrencies, useVirtualCurrency };
|
package/dist/index.d.ts
CHANGED
|
@@ -504,6 +504,69 @@ declare function restorePurchases(): Promise<PurchaseResult>;
|
|
|
504
504
|
declare function preloadPlacement(placementId: string, locale?: string): Promise<void>;
|
|
505
505
|
declare function setFallbackPlacements(json: string): Promise<number>;
|
|
506
506
|
|
|
507
|
+
/**
|
|
508
|
+
* The photo a `photo_upload` question was answered with — normalised and
|
|
509
|
+
* stored on the device (an upright JPEG with no metadata). Rovenue never
|
|
510
|
+
* receives it. Call {@link releasePhoto} once you are done with the file;
|
|
511
|
+
* an unreleased one is deleted 7 days after it was picked.
|
|
512
|
+
*/
|
|
513
|
+
interface FunnelPhotoRef {
|
|
514
|
+
/** The file, a `file://` URI. Valid until {@link releasePhoto} or for 7 days. */
|
|
515
|
+
localUri: string;
|
|
516
|
+
/** Pixel width, after normalisation. */
|
|
517
|
+
width: number;
|
|
518
|
+
/** Pixel height, after normalisation. */
|
|
519
|
+
height: number;
|
|
520
|
+
/** The file's size in bytes. */
|
|
521
|
+
byteSize: number;
|
|
522
|
+
/** Always `image/jpeg`. */
|
|
523
|
+
mimeType: string;
|
|
524
|
+
}
|
|
525
|
+
/** What the SDK asks your photo checker (`onCheck`). */
|
|
526
|
+
interface FunnelCheckRequest {
|
|
527
|
+
/** The check block's answer key. */
|
|
528
|
+
checkKey: string;
|
|
529
|
+
/** The checker's step ids, in order. */
|
|
530
|
+
steps: string[];
|
|
531
|
+
/** The photo to judge, on the device. */
|
|
532
|
+
photo: FunnelPhotoRef;
|
|
533
|
+
/** The funnel's content locale (BCP-47), for any copy the checker returns. */
|
|
534
|
+
locale: string;
|
|
535
|
+
/** 1-based: completed checks for this block so far, plus one. */
|
|
536
|
+
attempt: number;
|
|
537
|
+
}
|
|
538
|
+
/** Your checker's final answer for a photo check. */
|
|
539
|
+
interface FunnelCheckOutcome {
|
|
540
|
+
/** `pass` or `fail`. */
|
|
541
|
+
result: "pass" | "fail";
|
|
542
|
+
/** Plain text the funnel can show (`{{<checkKey>}}`). */
|
|
543
|
+
label?: string;
|
|
544
|
+
/** Why it failed, in plain text (`{{<checkKey>.reason}}`). */
|
|
545
|
+
reason?: string;
|
|
546
|
+
/** Each step id's final status (`pass` | `fail`). */
|
|
547
|
+
steps?: Record<string, string>;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Your photo checker. Resolve the outcome; resolving `null` / `undefined`,
|
|
551
|
+
* or rejecting, applies the check's `whenUnavailable`. The native SDK bounds
|
|
552
|
+
* it by the check's `timeoutMs` (then the result is `timeout` and a late
|
|
553
|
+
* answer is ignored).
|
|
554
|
+
*
|
|
555
|
+
* On Android a presented funnel (`presentFunnel`) is its own activity, and
|
|
556
|
+
* React Native pauses JS timers while the app's activity is covered: a
|
|
557
|
+
* `setTimeout` inside the handler fires only after the funnel closes. Network
|
|
558
|
+
* calls (`fetch`) and promises run as usual — call your checker service
|
|
559
|
+
* directly rather than through a timer.
|
|
560
|
+
*/
|
|
561
|
+
type FunnelCheckHandler = (request: FunnelCheckRequest) => Promise<FunnelCheckOutcome | null | undefined> | FunnelCheckOutcome | null | undefined;
|
|
562
|
+
/**
|
|
563
|
+
* Deletes a photo a funnel stored on the device, once you are done with it:
|
|
564
|
+
* the `localUri` of a {@link FunnelPhotoRef} from `onPhotoSelected` or a
|
|
565
|
+
* presentation's `photos`. Anything outside the SDK's photo store is
|
|
566
|
+
* ignored. Resolves whether a stored photo was deleted.
|
|
567
|
+
*/
|
|
568
|
+
declare function releasePhoto(localUri: string): Promise<boolean>;
|
|
569
|
+
|
|
507
570
|
/** How a presented funnel covers the app. */
|
|
508
571
|
type FunnelPresentationStyle = "fullScreen" | "modal" | "sheet";
|
|
509
572
|
/** How a full-screen funnel enters; Reduce Motion / animations off make each a fade. */
|
|
@@ -555,6 +618,17 @@ interface PresentFunnelOptions {
|
|
|
555
618
|
actionId: string;
|
|
556
619
|
paramsJson: string;
|
|
557
620
|
}) => void;
|
|
621
|
+
/**
|
|
622
|
+
* Values for the funnel's declared externals (an ad's scene, a campaign):
|
|
623
|
+
* trimmed, 512 characters at most, undeclared names dropped. A fresh value
|
|
624
|
+
* overrides a restored one and preselects a `defaultFrom` question. Never
|
|
625
|
+
* pass personal data: values are written to the on-device session state.
|
|
626
|
+
*/
|
|
627
|
+
values?: Record<string, string>;
|
|
628
|
+
/** A `photo_upload` question was answered: its key and the photo on the device. */
|
|
629
|
+
onPhotoSelected?: (questionKey: string, photo: FunnelPhotoRef) => void;
|
|
630
|
+
/** Your photo checker; without it a check applies its `whenUnavailable`. */
|
|
631
|
+
onCheck?: FunnelCheckHandler;
|
|
558
632
|
}
|
|
559
633
|
/** What `presentFunnel` resolves with. */
|
|
560
634
|
interface FunnelPresentResult {
|
|
@@ -568,6 +642,12 @@ interface FunnelPresentResult {
|
|
|
568
642
|
lastError?: RovenueError;
|
|
569
643
|
/** Why nothing was presented: `alreadyPresented`, `noPresenter`, or the placement's unavailable reason. */
|
|
570
644
|
reason?: string;
|
|
645
|
+
/**
|
|
646
|
+
* The photos the visitor answered `photo_upload` questions with, by
|
|
647
|
+
* question key — files on the device, kept until `releasePhoto` or 7
|
|
648
|
+
* days. Empty when there were none.
|
|
649
|
+
*/
|
|
650
|
+
photos: Record<string, FunnelPhotoRef>;
|
|
571
651
|
}
|
|
572
652
|
/**
|
|
573
653
|
* Present the funnel a placement serves — natively, the way the funnel's
|
|
@@ -581,6 +661,10 @@ interface FunnelPresentResult {
|
|
|
581
661
|
* a time: a second call while one is up resolves `unavailable` with reason
|
|
582
662
|
* `alreadyPresented`.
|
|
583
663
|
*
|
|
664
|
+
* A funnel with a photo check calls `onCheck` and waits for its answer, up
|
|
665
|
+
* to the check's timeout; the photos the visitor gave come back in
|
|
666
|
+
* `photos` — call `releasePhoto` with each once you are done with it.
|
|
667
|
+
*
|
|
584
668
|
* @example
|
|
585
669
|
* const { result, purchased } = await presentFunnel({ placement: "paywall" });
|
|
586
670
|
*/
|
|
@@ -685,6 +769,13 @@ declare function setLogHandler(fn: ((entry: LogEntry) => void) | null): void;
|
|
|
685
769
|
interface FunnelClaimResult {
|
|
686
770
|
subscriberId: string;
|
|
687
771
|
funnelAnswers: Record<string, unknown>;
|
|
772
|
+
/**
|
|
773
|
+
* The question keys an app value preselected and the visitor left
|
|
774
|
+
* unchanged (the claim's `funnel_preselected`), so a default can be told
|
|
775
|
+
* from a choice. Empty when nothing was preselected or the server
|
|
776
|
+
* predates the field.
|
|
777
|
+
*/
|
|
778
|
+
funnelPreselected: string[];
|
|
688
779
|
}
|
|
689
780
|
interface ClaimInstallParams {
|
|
690
781
|
platform: "ios" | "android";
|
|
@@ -828,6 +919,18 @@ type RovenueFunnelViewProps = {
|
|
|
828
919
|
onPurchase?: (packageIdentifier: string) => void;
|
|
829
920
|
/** The funnel asked for purchases to be restored. */
|
|
830
921
|
onRestore?: () => void;
|
|
922
|
+
/** Values for the funnel's declared externals (an ad's scene, a
|
|
923
|
+
* campaign): trimmed, 512 characters at most, undeclared names dropped.
|
|
924
|
+
* A fresh value overrides a restored one and preselects a `defaultFrom`
|
|
925
|
+
* question. A changed value resolves again. Never pass personal data:
|
|
926
|
+
* values are written to the on-device session state. */
|
|
927
|
+
values?: Record<string, string>;
|
|
928
|
+
/** A `photo_upload` question was answered: its key and the photo on the
|
|
929
|
+
* device. Call `releasePhoto` once you are done with the file. */
|
|
930
|
+
onPhotoSelected?: (questionKey: string, photo: FunnelPhotoRef) => void;
|
|
931
|
+
/** Your photo checker; without it a check applies its `whenUnavailable`.
|
|
932
|
+
* Presence is decided when the funnel resolves. */
|
|
933
|
+
onCheck?: FunnelCheckHandler;
|
|
831
934
|
};
|
|
832
935
|
/**
|
|
833
936
|
* Hosts the platform's native funnel renderer for a placement.
|
|
@@ -860,6 +963,7 @@ declare const Rovenue: {
|
|
|
860
963
|
readonly setFallbackPlacements: typeof setFallbackPlacements;
|
|
861
964
|
readonly preloadPlacement: typeof preloadPlacement;
|
|
862
965
|
readonly presentFunnel: typeof presentFunnel;
|
|
966
|
+
readonly releasePhoto: typeof releasePhoto;
|
|
863
967
|
readonly track: typeof track;
|
|
864
968
|
readonly refreshRemoteConfig: typeof refreshRemoteConfig;
|
|
865
969
|
readonly getRemoteConfig: typeof getRemoteConfig;
|
|
@@ -899,4 +1003,4 @@ declare const Rovenue: {
|
|
|
899
1003
|
readonly addChangeListener: (cb: (event: ChangeEvent) => void) => (() => void);
|
|
900
1004
|
};
|
|
901
1005
|
|
|
902
|
-
export { type AttributionProvider, type ChangeEvent, type ClaimInstallParams, ERROR_KINDS, EVENT_WIRE_VERSION, type Entitlement, type ErrorExtras, type ErrorKind, type EventEnvelope, type ExperimentAssignment, type FunnelClaimResult, type FunnelCustomAction, type FunnelDraftIssue, type FunnelLoadedEvent, type FunnelPresentResult, type FunnelPresentationEnter, type FunnelPresentationOverride, type FunnelPresentationStyle, type FunnelScreenEvent, type FunnelSheetDetent, type FunnelUnavailableEvent, type FunnelUnavailableReason, type IdentityContext, type LogEntry, type Offering, type Offerings, type Package, type PresentFunnelOptions, type ProductType, type PurchaseResult, type RemoteConfig, Rovenue, type RovenueConfig, RovenueError, RovenueFunnelView, type RovenueFunnelViewProps, type StoreProduct, type TrackParams, type User, type VirtualCurrencyGrant, extractFunnelToken, mapNativeError, presentFunnel, serializeEnvelope, stripUndefined, useCurrentUser, useEntitlement, useEntitlements, useExperiment, useFlag, useRemoteConfig, useVirtualCurrencies, useVirtualCurrency };
|
|
1006
|
+
export { type AttributionProvider, type ChangeEvent, type ClaimInstallParams, ERROR_KINDS, EVENT_WIRE_VERSION, type Entitlement, type ErrorExtras, type ErrorKind, type EventEnvelope, type ExperimentAssignment, type FunnelCheckHandler, type FunnelCheckOutcome, type FunnelCheckRequest, type FunnelClaimResult, type FunnelCustomAction, type FunnelDraftIssue, type FunnelLoadedEvent, type FunnelPhotoRef, type FunnelPresentResult, type FunnelPresentationEnter, type FunnelPresentationOverride, type FunnelPresentationStyle, type FunnelScreenEvent, type FunnelSheetDetent, type FunnelUnavailableEvent, type FunnelUnavailableReason, type IdentityContext, type LogEntry, type Offering, type Offerings, type Package, type PresentFunnelOptions, type ProductType, type PurchaseResult, type RemoteConfig, Rovenue, type RovenueConfig, RovenueError, RovenueFunnelView, type RovenueFunnelViewProps, type StoreProduct, type TrackParams, type User, type VirtualCurrencyGrant, extractFunnelToken, mapNativeError, presentFunnel, releasePhoto, serializeEnvelope, stripUndefined, useCurrentUser, useEntitlement, useEntitlements, useExperiment, useFlag, useRemoteConfig, useVirtualCurrencies, useVirtualCurrency };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SDK_VERSION
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LGHW24EC.js";
|
|
4
4
|
|
|
5
5
|
// src/events.ts
|
|
6
6
|
var EVENT_WIRE_VERSION = 1;
|
|
@@ -681,6 +681,47 @@ async function setFallbackPlacements(json) {
|
|
|
681
681
|
return call6(() => getNative().setFallbackPlacements(json));
|
|
682
682
|
}
|
|
683
683
|
|
|
684
|
+
// src/api/funnel-photos.ts
|
|
685
|
+
async function releasePhoto(localUri) {
|
|
686
|
+
return getNative().releasePhoto(localUri);
|
|
687
|
+
}
|
|
688
|
+
function photoFrom(dto) {
|
|
689
|
+
return {
|
|
690
|
+
localUri: dto.localUri,
|
|
691
|
+
width: Number(dto.width),
|
|
692
|
+
height: Number(dto.height),
|
|
693
|
+
byteSize: Number(dto.byteSize),
|
|
694
|
+
mimeType: dto.mimeType
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
function photosFrom(dto) {
|
|
698
|
+
const out = {};
|
|
699
|
+
for (const [key, photo] of Object.entries(dto ?? {})) out[key] = photoFrom(photo);
|
|
700
|
+
return out;
|
|
701
|
+
}
|
|
702
|
+
function outcomeJson(outcome) {
|
|
703
|
+
if (typeof outcome !== "object" || outcome === null) return null;
|
|
704
|
+
const o = outcome;
|
|
705
|
+
if (typeof o.result !== "string") return null;
|
|
706
|
+
const steps = {};
|
|
707
|
+
if (typeof o.steps === "object" && o.steps !== null) {
|
|
708
|
+
for (const [id, status] of Object.entries(o.steps)) {
|
|
709
|
+
if (typeof status === "string") steps[id] = status;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
return JSON.stringify({
|
|
713
|
+
result: o.result,
|
|
714
|
+
...typeof o.label === "string" ? { label: o.label } : {},
|
|
715
|
+
...typeof o.reason === "string" ? { reason: o.reason } : {},
|
|
716
|
+
steps
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
function answerCheckRequest(requestId, request, handler) {
|
|
720
|
+
const native = getNative();
|
|
721
|
+
const run = async () => handler ? handler({ ...request, photo: photoFrom(request.photo), attempt: Number(request.attempt) }) : null;
|
|
722
|
+
run().then((outcome) => native.resolveFunnelCheckRequest(requestId, outcomeJson(outcome))).catch(() => native.resolveFunnelCheckRequest(requestId, null));
|
|
723
|
+
}
|
|
724
|
+
|
|
684
725
|
// src/api/present-funnel.ts
|
|
685
726
|
var FUNNEL_PRESENT_EVENT = "onFunnelPresentEvent";
|
|
686
727
|
var presentationSerial = 0;
|
|
@@ -717,6 +758,12 @@ async function presentFunnel(options) {
|
|
|
717
758
|
case "customAction":
|
|
718
759
|
options.onCustomAction?.({ actionId: event.actionId, paramsJson: event.paramsJson });
|
|
719
760
|
break;
|
|
761
|
+
case "photoSelected":
|
|
762
|
+
options.onPhotoSelected?.(event.questionKey, photoFrom(event.photo));
|
|
763
|
+
break;
|
|
764
|
+
case "checkRequest":
|
|
765
|
+
answerCheckRequest(event.requestId, event.request, options.onCheck);
|
|
766
|
+
break;
|
|
720
767
|
}
|
|
721
768
|
});
|
|
722
769
|
try {
|
|
@@ -729,15 +776,19 @@ async function presentFunnel(options) {
|
|
|
729
776
|
onPurchase: Boolean(options.onPurchase),
|
|
730
777
|
onRestore: Boolean(options.onRestore),
|
|
731
778
|
onUrl: Boolean(options.onUrl),
|
|
732
|
-
onCustomAction: Boolean(options.onCustomAction)
|
|
733
|
-
|
|
779
|
+
onCustomAction: Boolean(options.onCustomAction),
|
|
780
|
+
onPhotoSelected: Boolean(options.onPhotoSelected),
|
|
781
|
+
onCheck: Boolean(options.onCheck)
|
|
782
|
+
},
|
|
783
|
+
options.values ?? {}
|
|
734
784
|
);
|
|
735
785
|
return {
|
|
736
786
|
result: dto.result,
|
|
737
787
|
purchased: dto.purchased,
|
|
738
788
|
...dto.customerInfo ? { customerInfo: dto.customerInfo } : {},
|
|
739
789
|
...dto.lastError ? { lastError: toError(dto.lastError) } : {},
|
|
740
|
-
...dto.reason ? { reason: dto.reason } : {}
|
|
790
|
+
...dto.reason ? { reason: dto.reason } : {},
|
|
791
|
+
photos: photosFrom(dto.photos)
|
|
741
792
|
};
|
|
742
793
|
} catch (e) {
|
|
743
794
|
throw fromNativeError(e);
|
|
@@ -854,7 +905,13 @@ function parse(n) {
|
|
|
854
905
|
funnelAnswers = JSON.parse(n.funnelAnswersJson);
|
|
855
906
|
} catch {
|
|
856
907
|
}
|
|
857
|
-
|
|
908
|
+
let funnelPreselected = [];
|
|
909
|
+
try {
|
|
910
|
+
const keys = JSON.parse(n.funnelPreselectedJson ?? "[]");
|
|
911
|
+
if (Array.isArray(keys)) funnelPreselected = keys.filter((k) => typeof k === "string");
|
|
912
|
+
} catch {
|
|
913
|
+
}
|
|
914
|
+
return { subscriberId: n.subscriberId, funnelAnswers, funnelPreselected };
|
|
858
915
|
}
|
|
859
916
|
async function claimFunnelToken(token) {
|
|
860
917
|
return call10(async () => parse(await getNative().claimFunnelToken(token)));
|
|
@@ -950,6 +1007,7 @@ var NativeFunnelView = requireNativeViewManager(MODULE_NAME, VIEW_NAME);
|
|
|
950
1007
|
// src/funnel-view/RovenueFunnelView.tsx
|
|
951
1008
|
import { jsx } from "react/jsx-runtime";
|
|
952
1009
|
var styles = StyleSheet.create({ fill: { flex: 1 } });
|
|
1010
|
+
var EMPTY_VALUES = {};
|
|
953
1011
|
function parseParams(json) {
|
|
954
1012
|
try {
|
|
955
1013
|
const parsed = JSON.parse(json);
|
|
@@ -998,7 +1056,10 @@ function RovenueFunnelView(props) {
|
|
|
998
1056
|
onUrl,
|
|
999
1057
|
onCustomAction,
|
|
1000
1058
|
onPurchase,
|
|
1001
|
-
onRestore
|
|
1059
|
+
onRestore,
|
|
1060
|
+
values,
|
|
1061
|
+
onPhotoSelected,
|
|
1062
|
+
onCheck
|
|
1002
1063
|
} = props;
|
|
1003
1064
|
return /* @__PURE__ */ jsx(
|
|
1004
1065
|
NativeFunnelView,
|
|
@@ -1007,6 +1068,8 @@ function RovenueFunnelView(props) {
|
|
|
1007
1068
|
funnelIdentifier: placementIdentifier,
|
|
1008
1069
|
locale,
|
|
1009
1070
|
hasUrlHandler: onUrl !== void 0,
|
|
1071
|
+
hasCheckHandler: onCheck !== void 0,
|
|
1072
|
+
values: values ?? EMPTY_VALUES,
|
|
1010
1073
|
onFunnelLoaded: (e) => onLoaded?.(loadedFrom(e.nativeEvent)),
|
|
1011
1074
|
onFunnelUnavailable: (e) => onUnavailable?.(unavailableFrom(e.nativeEvent)),
|
|
1012
1075
|
onFunnelFailed: (e) => onError?.(mapNativeError(e.nativeEvent.code, e.nativeEvent.message)),
|
|
@@ -1019,7 +1082,9 @@ function RovenueFunnelView(props) {
|
|
|
1019
1082
|
params: parseParams(e.nativeEvent.params)
|
|
1020
1083
|
}),
|
|
1021
1084
|
onPurchaseRequested: (e) => onPurchase?.(e.nativeEvent.packageId),
|
|
1022
|
-
onRestoreRequested: () => onRestore?.()
|
|
1085
|
+
onRestoreRequested: () => onRestore?.(),
|
|
1086
|
+
onPhotoSelectedEvent: (e) => onPhotoSelected?.(e.nativeEvent.questionKey, photoFrom(e.nativeEvent.photo)),
|
|
1087
|
+
onCheckRequested: (e) => answerCheckRequest(e.nativeEvent.requestId, e.nativeEvent.request, onCheck)
|
|
1023
1088
|
}
|
|
1024
1089
|
);
|
|
1025
1090
|
}
|
|
@@ -1046,6 +1111,7 @@ var Rovenue = {
|
|
|
1046
1111
|
setFallbackPlacements,
|
|
1047
1112
|
preloadPlacement,
|
|
1048
1113
|
presentFunnel,
|
|
1114
|
+
releasePhoto,
|
|
1049
1115
|
track,
|
|
1050
1116
|
refreshRemoteConfig,
|
|
1051
1117
|
getRemoteConfig,
|
|
@@ -1099,6 +1165,7 @@ export {
|
|
|
1099
1165
|
extractFunnelToken,
|
|
1100
1166
|
mapNativeError,
|
|
1101
1167
|
presentFunnel,
|
|
1168
|
+
releasePhoto,
|
|
1102
1169
|
serializeEnvelope,
|
|
1103
1170
|
stripUndefined,
|
|
1104
1171
|
useCurrentUser,
|