@funnelsgrove/runtime 0.11.1 → 0.11.3
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 +51 -0
- package/dist/components/ManageSubscriptionScreen.js +7 -2
- package/dist/runtime/funnel-attribution.js +34 -1
- package/dist/services/api.service.d.ts +28 -104
- package/dist/services/api.service.js +24 -519
- package/dist/services/funnel-sdk/checkout/chargeOneClickPayment.d.ts +2 -0
- package/dist/services/funnel-sdk/checkout/chargeOneClickPayment.js +17 -0
- package/dist/services/funnel-sdk/checkout/createHostedCheckoutSession.d.ts +2 -0
- package/dist/services/funnel-sdk/checkout/createHostedCheckoutSession.js +9 -0
- package/dist/services/funnel-sdk/checkout/createOneTimeCheckout.d.ts +2 -0
- package/dist/services/funnel-sdk/checkout/createOneTimeCheckout.js +18 -0
- package/dist/services/funnel-sdk/checkout/createOneTimePaymentIntent.d.ts +3 -0
- package/dist/services/funnel-sdk/checkout/createOneTimePaymentIntent.js +10 -0
- package/dist/services/funnel-sdk/checkout/createSubscriptionCheckout.d.ts +2 -0
- package/dist/services/funnel-sdk/checkout/createSubscriptionCheckout.js +19 -0
- package/dist/services/funnel-sdk/checkout/requests.d.ts +126 -0
- package/dist/services/funnel-sdk/checkout/requests.js +111 -0
- package/dist/services/funnel-sdk/checkout/types.d.ts +183 -0
- package/dist/services/funnel-sdk/checkout/types.js +1 -0
- package/dist/services/funnel-sdk/checkout/updateSubscriptionCheckoutPlan.d.ts +2 -0
- package/dist/services/funnel-sdk/checkout/updateSubscriptionCheckoutPlan.js +18 -0
- package/dist/services/funnel-sdk/checkout/verifySubscriptionCheckout.d.ts +2 -0
- package/dist/services/funnel-sdk/checkout/verifySubscriptionCheckout.js +18 -0
- package/dist/services/funnel-sdk/shared/http.d.ts +20 -0
- package/dist/services/funnel-sdk/shared/http.js +65 -0
- package/dist/services/funnel-sdk/shared/runtimeConfig.d.ts +17 -0
- package/dist/services/funnel-sdk/shared/runtimeConfig.js +42 -0
- package/dist/services/funnel-sdk/shared/types.d.ts +9 -0
- package/dist/services/funnel-sdk/shared/types.js +1 -0
- package/dist/services/funnel-sdk/subscriptions/listSubscriptions.d.ts +3 -0
- package/dist/services/funnel-sdk/subscriptions/listSubscriptions.js +17 -0
- package/dist/services/funnel-sdk/subscriptions/types.d.ts +24 -0
- package/dist/services/funnel-sdk/subscriptions/types.js +1 -0
- package/dist/services/funnel-sdk/subscriptions/updateSubscription.d.ts +2 -0
- package/dist/services/funnel-sdk/subscriptions/updateSubscription.js +33 -0
- package/dist/services/funnel-sdk/subscriptions/validator.d.ts +2 -0
- package/dist/services/funnel-sdk/subscriptions/validator.js +15 -0
- package/dist/services/funnel-sdk/uploads/preparePhotoUpload.d.ts +4 -0
- package/dist/services/funnel-sdk/uploads/preparePhotoUpload.js +19 -0
- package/dist/services/funnel-sdk/uploads/types.d.ts +32 -0
- package/dist/services/funnel-sdk/uploads/types.js +1 -0
- package/dist/services/funnel-sdk/uploads/uploadPhoto.d.ts +7 -0
- package/dist/services/funnel-sdk/uploads/uploadPhoto.js +18 -0
- package/dist/services/funnel-sdk/uploads/uploadPhotoFile.d.ts +2 -0
- package/dist/services/funnel-sdk/uploads/uploadPhotoFile.js +26 -0
- package/dist/services/funnel-sdk/users/bootstrapUser.d.ts +3 -0
- package/dist/services/funnel-sdk/users/bootstrapUser.js +15 -0
- package/dist/services/funnel-sdk/users/captureEmail.d.ts +2 -0
- package/dist/services/funnel-sdk/users/captureEmail.js +15 -0
- package/dist/services/funnel-sdk/users/claimUserSubscription.d.ts +3 -0
- package/dist/services/funnel-sdk/users/claimUserSubscription.js +7 -0
- package/dist/services/funnel-sdk/users/getCurrentUser.d.ts +3 -0
- package/dist/services/funnel-sdk/users/getCurrentUser.js +13 -0
- package/dist/services/funnel-sdk/users/getUserSubscriptionStatus.d.ts +3 -0
- package/dist/services/funnel-sdk/users/getUserSubscriptionStatus.js +14 -0
- package/dist/services/funnel-sdk/users/types.d.ts +57 -0
- package/dist/services/funnel-sdk/users/types.js +1 -0
- package/dist/services/funnel-sdk/users/updateFunnelUser.d.ts +3 -0
- package/dist/services/funnel-sdk/users/updateFunnelUser.js +18 -0
- package/dist/services/funnel-sdk.service.d.ts +26 -319
- package/dist/services/funnel-sdk.service.js +38 -456
- package/dist/services/session/bootstrap/bootstrapSession.d.ts +8 -0
- package/dist/services/session/bootstrap/bootstrapSession.js +23 -0
- package/dist/services/session/bootstrap/currentUser.d.ts +1 -0
- package/dist/services/session/bootstrap/currentUser.js +37 -0
- package/dist/services/session/bootstrap/idempotency.d.ts +9 -0
- package/dist/services/session/bootstrap/idempotency.js +97 -0
- package/dist/services/session/bootstrap/requests.d.ts +23 -0
- package/dist/services/session/bootstrap/requests.js +25 -0
- package/dist/services/session/bootstrap/responses.d.ts +3 -0
- package/dist/services/session/bootstrap/responses.js +10 -0
- package/dist/services/session/bootstrap/types.d.ts +11 -0
- package/dist/services/session/bootstrap/types.js +1 -0
- package/dist/services/session/emailCapture/captureEmail.d.ts +8 -0
- package/dist/services/session/emailCapture/captureEmail.js +13 -0
- package/dist/services/session/emailCapture/requests.d.ts +12 -0
- package/dist/services/session/emailCapture/requests.js +6 -0
- package/dist/services/session/emailCapture/responses.d.ts +3 -0
- package/dist/services/session/emailCapture/responses.js +14 -0
- package/dist/services/session/emailCapture/types.d.ts +8 -0
- package/dist/services/session/emailCapture/types.js +1 -0
- package/dist/services/session/emailCapture/validator.d.ts +16 -0
- package/dist/services/session/emailCapture/validator.js +37 -0
- package/dist/services/session/identity.d.ts +6 -0
- package/dist/services/session/identity.js +48 -0
- package/dist/services/session/ping/pingUserContext.d.ts +2 -0
- package/dist/services/session/ping/pingUserContext.js +10 -0
- package/dist/services/session/ping/transport.d.ts +2 -0
- package/dist/services/session/ping/transport.js +41 -0
- package/dist/services/session/shared/values.d.ts +6 -0
- package/dist/services/session/shared/values.js +25 -0
- package/dist/services/session/subscriptions/getManageSubscriptions.d.ts +3 -0
- package/dist/services/session/subscriptions/getManageSubscriptions.js +8 -0
- package/dist/services/session/subscriptions/identity.d.ts +3 -0
- package/dist/services/session/subscriptions/identity.js +8 -0
- package/dist/services/session/subscriptions/types.d.ts +35 -0
- package/dist/services/session/subscriptions/types.js +1 -0
- package/dist/services/session/subscriptions/updateSubscription.d.ts +10 -0
- package/dist/services/session/subscriptions/updateSubscription.js +7 -0
- package/dist/services/session/subscriptions/validator.d.ts +6 -0
- package/dist/services/session/subscriptions/validator.js +13 -0
- package/dist/services/session/uploads/localPhoto.d.ts +2 -0
- package/dist/services/session/uploads/localPhoto.js +10 -0
- package/dist/services/session/uploads/requests.d.ts +10 -0
- package/dist/services/session/uploads/requests.js +7 -0
- package/dist/services/session/uploads/types.d.ts +7 -0
- package/dist/services/session/uploads/types.js +1 -0
- package/dist/services/session/uploads/uploadTempPhoto.d.ts +6 -0
- package/dist/services/session/uploads/uploadTempPhoto.js +13 -0
- package/dist/services/session/uploads/validator.d.ts +3 -0
- package/dist/services/session/uploads/validator.js +12 -0
- package/dist/services/session/users/mappers.d.ts +13 -0
- package/dist/services/session/users/mappers.js +33 -0
- package/dist/services/session/users/requests.d.ts +15 -0
- package/dist/services/session/users/requests.js +8 -0
- package/dist/services/session/users/syncUrlUserAttributes.d.ts +10 -0
- package/dist/services/session/users/syncUrlUserAttributes.js +21 -0
- package/dist/services/session/users/types.d.ts +20 -0
- package/dist/services/session/users/types.js +1 -0
- package/dist/services/session/users/updateUser.d.ts +6 -0
- package/dist/services/session/users/updateUser.js +18 -0
- package/package.json +1 -1
- /package/dist/services/{funnel-sdk-payments.functions.d.ts → funnel-sdk/checkout/selection.d.ts} +0 -0
- /package/dist/services/{funnel-sdk-payments.functions.js → funnel-sdk/checkout/selection.js} +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FunnelUserAttribution } from '../../../runtime/funnel-attribution.js';
|
|
2
|
+
import type { AppUser } from './types.js';
|
|
3
|
+
export declare const toUserUpdateRequest: (user: AppUser, userId: string, environment: "test" | "live", attribution?: FunnelUserAttribution) => {
|
|
4
|
+
userId: string;
|
|
5
|
+
email: string | undefined;
|
|
6
|
+
fullName: string | undefined;
|
|
7
|
+
progress: {
|
|
8
|
+
attributes: import("../../../index.js").FunnelUserAnswers;
|
|
9
|
+
};
|
|
10
|
+
metadata: {
|
|
11
|
+
source: string;
|
|
12
|
+
environment: "test" | "live";
|
|
13
|
+
};
|
|
14
|
+
attribution: FunnelUserAttribution | undefined;
|
|
15
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const toUserUpdateRequest = (user, userId, environment, attribution) => ({
|
|
2
|
+
userId,
|
|
3
|
+
email: user.email || undefined,
|
|
4
|
+
fullName: user.name || undefined,
|
|
5
|
+
progress: { attributes: user.attributes || {} },
|
|
6
|
+
metadata: { source: 'funnel', environment },
|
|
7
|
+
attribution,
|
|
8
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type UrlUserAttributes } from '../../../runtime/url-user-attributes.js';
|
|
2
|
+
import type { FunnelUserAnswers } from '../../../sdk/userAnswers.js';
|
|
3
|
+
import type { FunnelUserAttribution } from '../../../runtime/funnel-attribution.js';
|
|
4
|
+
import type { AppUser, AppUserInput } from './types.js';
|
|
5
|
+
export declare function syncUrlUserAttributes(input: {
|
|
6
|
+
user: AppUserInput;
|
|
7
|
+
attributes?: FunnelUserAnswers;
|
|
8
|
+
urlAttributes?: UrlUserAttributes | null;
|
|
9
|
+
attribution?: FunnelUserAttribution;
|
|
10
|
+
}): Promise<AppUser | null>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { applyUrlUserAttributesToUser, hasUrlUserProfileAttributes } from '../../../runtime/url-user-attributes.js';
|
|
2
|
+
import { updateUser } from './updateUser.js';
|
|
3
|
+
export async function syncUrlUserAttributes(input) {
|
|
4
|
+
var _a;
|
|
5
|
+
if (!hasUrlUserProfileAttributes(input.urlAttributes)) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
const nextUser = applyUrlUserAttributesToUser({
|
|
9
|
+
user: input.user,
|
|
10
|
+
attributes: input.attributes,
|
|
11
|
+
urlAttributes: input.urlAttributes,
|
|
12
|
+
});
|
|
13
|
+
const updatedUser = await updateUser(Object.assign(Object.assign({}, nextUser), { document: (_a = nextUser.document) !== null && _a !== void 0 ? _a : {} }), {
|
|
14
|
+
attribution: input.attribution,
|
|
15
|
+
});
|
|
16
|
+
return applyUrlUserAttributesToUser({
|
|
17
|
+
user: updatedUser,
|
|
18
|
+
attributes: nextUser.attributes,
|
|
19
|
+
urlAttributes: input.urlAttributes,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FunnelUserAnswers } from '../../../sdk/userAnswers.js';
|
|
2
|
+
export type AppUser = {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
email: string;
|
|
6
|
+
attributes: FunnelUserAnswers;
|
|
7
|
+
document: Record<string, unknown>;
|
|
8
|
+
};
|
|
9
|
+
export type AppUserInput = Omit<AppUser, 'document'> & {
|
|
10
|
+
document?: Record<string, unknown>;
|
|
11
|
+
};
|
|
12
|
+
export type SdkApiUser = {
|
|
13
|
+
user_id?: unknown;
|
|
14
|
+
fullName?: unknown;
|
|
15
|
+
email?: unknown;
|
|
16
|
+
document?: unknown;
|
|
17
|
+
};
|
|
18
|
+
export type UpdateUserResponse = {
|
|
19
|
+
user?: SdkApiUser;
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FunnelUserAttribution } from '../../../runtime/funnel-attribution.js';
|
|
2
|
+
import type { AppUser } from './types.js';
|
|
3
|
+
export declare function updateUser(user: AppUser, options?: {
|
|
4
|
+
attribution?: FunnelUserAttribution;
|
|
5
|
+
persistClientIdentity?: boolean;
|
|
6
|
+
}): Promise<AppUser>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FUNNEL_ID, getFunnelSdkPublishableKey } from '../../runtime-api.config.js';
|
|
2
|
+
import { funnelSdkService } from '../../funnel-sdk.service.js';
|
|
3
|
+
import { getRuntimeMode } from '../../runtime-mode.service.js';
|
|
4
|
+
import { normalizeUserId } from '../shared/values.js';
|
|
5
|
+
import { getOrCreateClientUserId, persistUserId } from '../identity.js';
|
|
6
|
+
import { toUpdatedUser } from './mappers.js';
|
|
7
|
+
import { toUserUpdateRequest } from './requests.js';
|
|
8
|
+
export async function updateUser(user, options) {
|
|
9
|
+
const userId = normalizeUserId(user.id) || getOrCreateClientUserId();
|
|
10
|
+
const persistedUserId = (options === null || options === void 0 ? void 0 : options.persistClientIdentity) === false
|
|
11
|
+
? userId
|
|
12
|
+
: persistUserId(userId, FUNNEL_ID);
|
|
13
|
+
if (!getFunnelSdkPublishableKey()) {
|
|
14
|
+
return toUpdatedUser(user, persistedUserId, options === null || options === void 0 ? void 0 : options.attribution);
|
|
15
|
+
}
|
|
16
|
+
const payload = await funnelSdkService.updateFunnelUser(toUserUpdateRequest(user, persistedUserId, getRuntimeMode(), options === null || options === void 0 ? void 0 : options.attribution));
|
|
17
|
+
return toUpdatedUser(user, persistedUserId, options === null || options === void 0 ? void 0 : options.attribution, payload.user);
|
|
18
|
+
}
|
package/package.json
CHANGED
/package/dist/services/{funnel-sdk-payments.functions.d.ts → funnel-sdk/checkout/selection.d.ts}
RENAMED
|
File without changes
|
/package/dist/services/{funnel-sdk-payments.functions.js → funnel-sdk/checkout/selection.js}
RENAMED
|
File without changes
|