@lifeready/core 1.1.20 → 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/bundles/lifeready-core.umd.js +205 -38
- package/bundles/lifeready-core.umd.js.map +1 -1
- package/bundles/lifeready-core.umd.min.js +1 -1
- package/bundles/lifeready-core.umd.min.js.map +1 -1
- package/esm2015/lib/api/types/lr-graphql.types.js +8 -1
- package/esm2015/lib/plan2/plan2.gql.js +73 -0
- package/esm2015/lib/plan2/plan2.service.js +156 -0
- package/esm2015/lib/plan2/plan2.types.js +2 -0
- package/esm2015/public-api.js +3 -1
- package/fesm2015/lifeready-core.js +229 -1
- package/fesm2015/lifeready-core.js.map +1 -1
- package/lib/api/types/lr-graphql.types.d.ts +77 -1
- package/lib/plan2/plan2.gql.d.ts +51 -0
- package/lib/plan2/plan2.service.d.ts +88 -0
- package/lib/plan2/plan2.types.d.ts +11 -0
- package/lifeready-core.metadata.json +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -59,7 +59,11 @@ export interface UserNode extends Node {
|
|
|
59
59
|
userPlans?: Connection<UserPlanNode>;
|
|
60
60
|
userDelete?: UserDeleteNode;
|
|
61
61
|
features?: FeaturesNode;
|
|
62
|
-
|
|
62
|
+
featureState?: UserFeatureState;
|
|
63
|
+
sessionEncryptionKey?: string;
|
|
64
|
+
plans?: IssuedPlanNode[];
|
|
65
|
+
paymentMethods?: PaymentMethodNode[];
|
|
66
|
+
billingHistory?: BillingField[];
|
|
63
67
|
}
|
|
64
68
|
export interface UserFeatureState extends TimeStamped {
|
|
65
69
|
notificationsLastViewed?: DateTime;
|
|
@@ -615,3 +619,75 @@ export interface LockField {
|
|
|
615
619
|
export interface ServerConfig {
|
|
616
620
|
relayConnectionMaxLimit?: number;
|
|
617
621
|
}
|
|
622
|
+
export interface AvailablePlanField {
|
|
623
|
+
issuerUid?: string;
|
|
624
|
+
planUid?: string;
|
|
625
|
+
name?: string;
|
|
626
|
+
description?: string;
|
|
627
|
+
priceOptions?: PriceOptionField[];
|
|
628
|
+
trial?: TrialPeriodField;
|
|
629
|
+
}
|
|
630
|
+
export interface PriceOptionField {
|
|
631
|
+
priceId?: string;
|
|
632
|
+
name?: string;
|
|
633
|
+
description?: string;
|
|
634
|
+
amount?: number;
|
|
635
|
+
currency?: string;
|
|
636
|
+
intervalUnit?: string;
|
|
637
|
+
intervalCount?: number;
|
|
638
|
+
}
|
|
639
|
+
export interface TrialPeriodField {
|
|
640
|
+
years?: number;
|
|
641
|
+
months?: number;
|
|
642
|
+
weeks?: number;
|
|
643
|
+
days?: number;
|
|
644
|
+
}
|
|
645
|
+
export interface PaymentCaptureField {
|
|
646
|
+
stripeIntentId?: string;
|
|
647
|
+
stripeClientSecret?: string;
|
|
648
|
+
}
|
|
649
|
+
export interface PaymentMethodNode extends Node, TimeStamped {
|
|
650
|
+
card?: PaymentCardField;
|
|
651
|
+
invoice?: PaymentInvoiceField;
|
|
652
|
+
isDefault?: boolean;
|
|
653
|
+
}
|
|
654
|
+
export interface PaymentCardField {
|
|
655
|
+
brand?: string;
|
|
656
|
+
lastFourDigits?: string;
|
|
657
|
+
expiryYear?: number;
|
|
658
|
+
expiryMonth?: number;
|
|
659
|
+
}
|
|
660
|
+
export interface PaymentInvoiceField {
|
|
661
|
+
email?: string;
|
|
662
|
+
}
|
|
663
|
+
export interface PromotionalCodeField {
|
|
664
|
+
amountOff?: number;
|
|
665
|
+
currency?: string;
|
|
666
|
+
percentOff?: number;
|
|
667
|
+
name?: string;
|
|
668
|
+
}
|
|
669
|
+
export interface IssuedPlanNode extends Node, TimeStamped {
|
|
670
|
+
name: string;
|
|
671
|
+
description: string;
|
|
672
|
+
currentStates: IssuedPlanStateNode[];
|
|
673
|
+
currentPriceOption: PriceOptionField;
|
|
674
|
+
alternativePriceOptions: PriceOptionField[];
|
|
675
|
+
}
|
|
676
|
+
export interface IssuedPlanStateNode extends Node, TimeStamped {
|
|
677
|
+
periodStart?: DateTime;
|
|
678
|
+
periodEnd?: DateTime;
|
|
679
|
+
state?: PlanStateField;
|
|
680
|
+
}
|
|
681
|
+
export declare enum PlanStateField {
|
|
682
|
+
TRIALLING = "TRIALLING",
|
|
683
|
+
ACTIVE = "ACTIVE",
|
|
684
|
+
CANCELLED = "CANCELLED",
|
|
685
|
+
EXPIRED = "EXPIRED"
|
|
686
|
+
}
|
|
687
|
+
export interface BillingField {
|
|
688
|
+
invoiceNumber?: string;
|
|
689
|
+
total?: number;
|
|
690
|
+
currency?: string;
|
|
691
|
+
documentUrl?: string;
|
|
692
|
+
status?: string;
|
|
693
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ID, IssuedPlanNode, PaymentCaptureField, PaymentCardField, PaymentMethodNode } from '../api/types';
|
|
2
|
+
export interface InitiateStripePaymentMethodCaptureMutationResult {
|
|
3
|
+
initiateStripePaymentMethodCapture: {
|
|
4
|
+
paymentCapture: Required<PaymentCaptureField>;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export declare const InitiateStripePaymentMethodCaptureMutation: import("../_common/ast").TypedDocumentNode<InitiateStripePaymentMethodCaptureMutationResult>;
|
|
8
|
+
export interface CompleteStripePaymentMethodCaptureMutationResult {
|
|
9
|
+
completeStripePaymentMethodCapture: {
|
|
10
|
+
paymentMethod: Required<Omit<PaymentMethodNode, 'invoice'>> & {
|
|
11
|
+
card: Required<PaymentCardField>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare const CompleteStripePaymentMethodCaptureMutation: import("../_common/ast").TypedDocumentNode<CompleteStripePaymentMethodCaptureMutationResult>;
|
|
16
|
+
export interface RemovePaymentMethodMutationResult {
|
|
17
|
+
removePaymentMethod: {
|
|
18
|
+
id: ID;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare const RemovePaymentMethodMutation: import("../_common/ast").TypedDocumentNode<RemovePaymentMethodMutationResult>;
|
|
22
|
+
export interface SetDefaultPaymentMethodMutationResult {
|
|
23
|
+
setDefaultPaymentMethod: {
|
|
24
|
+
paymentMethod: {
|
|
25
|
+
id: ID;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export declare const SetDefaultPaymentMethodMutation: import("../_common/ast").TypedDocumentNode<SetDefaultPaymentMethodMutationResult>;
|
|
30
|
+
export interface RemoveDefaultPaymentMethodMutationResult {
|
|
31
|
+
removeDefaultPaymentMethod: {
|
|
32
|
+
paymentMethod: {
|
|
33
|
+
id: ID;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export declare const RemoveDefaultPaymentMethodMutation: import("../_common/ast").TypedDocumentNode<RemoveDefaultPaymentMethodMutationResult>;
|
|
38
|
+
export interface IssuePlanMutationResult {
|
|
39
|
+
issuePlan: {
|
|
40
|
+
plan: {
|
|
41
|
+
id: ID;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export declare const IssuePlanMutation: import("../_common/ast").TypedDocumentNode<IssuePlanMutationResult>;
|
|
46
|
+
export interface CancelPlanMutationResult {
|
|
47
|
+
cancelPlan: {
|
|
48
|
+
plan: Pick<IssuedPlanNode, 'id'>;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export declare const CancelPlanMutation: import("../_common/ast").TypedDocumentNode<CancelPlanMutationResult>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Injector, NgZone } from '@angular/core';
|
|
2
|
+
import { LrMutation, LrService } from '../api/lr-graphql';
|
|
3
|
+
import { LrRelayIdInput } from '../api/types';
|
|
4
|
+
import { CancelPlanOptions, IssuePlanOptions } from './plan2.types';
|
|
5
|
+
export declare class Plan2Service extends LrService {
|
|
6
|
+
private ngZone;
|
|
7
|
+
private injector;
|
|
8
|
+
constructor(ngZone: NgZone, injector: Injector);
|
|
9
|
+
initiateStripePaymentMethodCapture(): Promise<import("./plan2.gql").InitiateStripePaymentMethodCaptureMutationResult>;
|
|
10
|
+
/**
|
|
11
|
+
* Starts a stripe payment capture intent. On intent can only add one card.
|
|
12
|
+
* @returns Promise that resolves to a mutation
|
|
13
|
+
*/
|
|
14
|
+
initiateStripePaymentMethodCaptureMutation(): LrMutation<import("./plan2.gql").InitiateStripePaymentMethodCaptureMutationResult, {
|
|
15
|
+
input: {};
|
|
16
|
+
}>;
|
|
17
|
+
completeStripePaymentMethodCapture(stripeIntentId: string): Promise<import("./plan2.gql").CompleteStripePaymentMethodCaptureMutationResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Completes the payment capture intent. Call this after calling stripe.confirmCardSetup.
|
|
20
|
+
*
|
|
21
|
+
* The return result of this mutation can be used to update the UI. Because this is a mutation
|
|
22
|
+
* we always get the most up to date data from the BD.
|
|
23
|
+
*
|
|
24
|
+
* @returns Promise that resolves to a mutation with the just created PaymentMethodNode
|
|
25
|
+
*/
|
|
26
|
+
completeStripePaymentMethodCaptureMutation(stripeIntentId: string): LrMutation<import("./plan2.gql").CompleteStripePaymentMethodCaptureMutationResult, {
|
|
27
|
+
input: {
|
|
28
|
+
stripeIntentId: string;
|
|
29
|
+
};
|
|
30
|
+
}>;
|
|
31
|
+
setDefaultPaymentMethod(paymentMethodId: LrRelayIdInput): Promise<import("./plan2.gql").SetDefaultPaymentMethodMutationResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Mutation that sets the default payment method for the current user.
|
|
34
|
+
*
|
|
35
|
+
* @param paymentMethodId The id from PaymentMethodNode
|
|
36
|
+
* @returns Promise that resolves to a mutation
|
|
37
|
+
*/
|
|
38
|
+
setDefaultPaymentMethodMutation(paymentMethodId: LrRelayIdInput): LrMutation<import("./plan2.gql").SetDefaultPaymentMethodMutationResult, {
|
|
39
|
+
input: {
|
|
40
|
+
paymentMethodId: string;
|
|
41
|
+
};
|
|
42
|
+
}>;
|
|
43
|
+
removeDefaultPaymentMethod(): Promise<import("./plan2.gql").RemoveDefaultPaymentMethodMutationResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Mutation that removes a the default payment method
|
|
46
|
+
*
|
|
47
|
+
* @returns Promise that resolves to a mutation
|
|
48
|
+
*/
|
|
49
|
+
removeDefaultPaymentMethodMutation(): LrMutation<import("./plan2.gql").RemoveDefaultPaymentMethodMutationResult, {
|
|
50
|
+
input: {};
|
|
51
|
+
}>;
|
|
52
|
+
issuePlan(options: IssuePlanOptions): Promise<import("./plan2.gql").IssuePlanMutationResult>;
|
|
53
|
+
/**
|
|
54
|
+
* Mutation that issues a new plan for the current user.
|
|
55
|
+
*
|
|
56
|
+
* @param options.issuerUid The same issuerUid that is in the AvailablePlanField returned by queries such as availablePublicPlans
|
|
57
|
+
* @param options.planUid The same planUid that is in the AvailablePlanField returned by queries such as availablePublicPlans
|
|
58
|
+
* @param options.priceId The priceId from PriceOptionField, which is nested in side AvailablePlanField
|
|
59
|
+
* @param options.promotionalCode promotion code where applicable
|
|
60
|
+
* @returns Promise that resolves to a mutation
|
|
61
|
+
*/
|
|
62
|
+
issuePlanMutation(options: IssuePlanOptions): LrMutation<import("./plan2.gql").IssuePlanMutationResult, {
|
|
63
|
+
input: IssuePlanOptions;
|
|
64
|
+
}>;
|
|
65
|
+
removePaymentMethod(paymentMethodId: string): Promise<import("./plan2.gql").RemovePaymentMethodMutationResult>;
|
|
66
|
+
/**
|
|
67
|
+
* Mutation that removes a payment method for the current user
|
|
68
|
+
*
|
|
69
|
+
* @param paymentMethodId The id from PaymentMethodNode
|
|
70
|
+
* @returns Promise that resolves to a mutation
|
|
71
|
+
*/
|
|
72
|
+
removePaymentMethodMutation(paymentMethodId: LrRelayIdInput): LrMutation<import("./plan2.gql").RemovePaymentMethodMutationResult, {
|
|
73
|
+
input: {
|
|
74
|
+
paymentMethodId: string;
|
|
75
|
+
};
|
|
76
|
+
}>;
|
|
77
|
+
cancelPlan(options: CancelPlanOptions): Promise<import("./plan2.gql").CancelPlanMutationResult>;
|
|
78
|
+
/**
|
|
79
|
+
* Mutation that removes a payment method for the current user
|
|
80
|
+
*
|
|
81
|
+
* @param options.planId The id from IssuedPlanNode
|
|
82
|
+
* @param options.immediate If true, cancel plan effective immediately. Default false.
|
|
83
|
+
* @returns Promise that resolves to a mutation
|
|
84
|
+
*/
|
|
85
|
+
cancelPlanMutation(options: CancelPlanOptions): LrMutation<import("./plan2.gql").CancelPlanMutationResult, {
|
|
86
|
+
input: CancelPlanOptions;
|
|
87
|
+
}>;
|
|
88
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LrRelayIdInput } from '../api/types';
|
|
2
|
+
export interface IssuePlanOptions {
|
|
3
|
+
issuerUid: string;
|
|
4
|
+
planUid: string;
|
|
5
|
+
priceId: string;
|
|
6
|
+
promotionalCode?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CancelPlanOptions {
|
|
9
|
+
planId: LrRelayIdInput;
|
|
10
|
+
immediate?: boolean;
|
|
11
|
+
}
|