@lifeready/core 1.1.20 → 1.1.22

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.
@@ -1,9 +1,9 @@
1
1
  import { Connection, DateTime, GenericScalar, ID, JSONObject, JSONString, LrEmail, Node, TimeStamped } from './graphql.types';
2
2
  export declare function mapEdges<T>(connection: Connection<T>): T[];
3
3
  export interface FeaturesNode {
4
- myVault: string[];
5
- tpVault: string[];
6
- shareVault: string[];
4
+ myVault?: string[];
5
+ tpVault?: string[];
6
+ shareVault?: string[];
7
7
  }
8
8
  export declare enum UserDeleteState {
9
9
  REQUESTED = "REQUESTED"
@@ -59,7 +59,11 @@ export interface UserNode extends Node {
59
59
  userPlans?: Connection<UserPlanNode>;
60
60
  userDelete?: UserDeleteNode;
61
61
  features?: FeaturesNode;
62
- userFeatureState?: UserFeatureState;
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;
@@ -206,6 +210,7 @@ export interface ContactCardSharedCipherData {
206
210
  }
207
211
  /**
208
212
  * The contents of the one-time key cipher
213
+ * These fields are not optional because they are not within the user's control to select in a gql query.
209
214
  */
210
215
  export interface OtKeyCipherClearJson2 {
211
216
  nonce: string;
@@ -567,7 +572,7 @@ export interface SharedScenarioClaimNode extends Node, TimeStamped {
567
572
  sharedScenario?: SharedScenarioNode;
568
573
  isClaimant?: boolean;
569
574
  asClaimReceiver?: SharedScenarioClaimReceiverNode;
570
- claim: SharedTpClaimNode;
575
+ claim?: SharedTpClaimNode;
571
576
  }
572
577
  export interface SharedScenarioClaimApproverNode extends Node, TimeStamped {
573
578
  receivers?: Connection<SharedScenarioReceiverNode>;
@@ -615,3 +620,80 @@ export interface LockField {
615
620
  export interface ServerConfig {
616
621
  relayConnectionMaxLimit?: number;
617
622
  }
623
+ export interface AvailablePlanField {
624
+ issuerUid?: string;
625
+ planUid?: string;
626
+ name?: string;
627
+ description?: string;
628
+ priceOptions?: PriceOptionField[];
629
+ trial?: TrialPeriodField;
630
+ }
631
+ export interface PriceOptionField {
632
+ priceId?: string;
633
+ name?: string;
634
+ description?: string;
635
+ amount?: number;
636
+ currency?: string;
637
+ intervalUnit?: string;
638
+ intervalCount?: number;
639
+ }
640
+ export interface TrialPeriodField {
641
+ years?: number;
642
+ months?: number;
643
+ weeks?: number;
644
+ days?: number;
645
+ }
646
+ export interface PaymentCaptureField {
647
+ stripeIntentId?: string;
648
+ stripeClientSecret?: string;
649
+ }
650
+ export interface PaymentMethodNode extends Node, TimeStamped {
651
+ card?: PaymentCardField;
652
+ invoice?: PaymentInvoiceField;
653
+ isDefault?: boolean;
654
+ }
655
+ export interface PaymentCardField {
656
+ brand?: string;
657
+ lastFourDigits?: string;
658
+ expiryYear?: number;
659
+ expiryMonth?: number;
660
+ }
661
+ export interface PaymentInvoiceField {
662
+ email?: string;
663
+ }
664
+ export interface PromotionalCodeField {
665
+ amountOff?: number;
666
+ currency?: string;
667
+ percentOff?: number;
668
+ name?: string;
669
+ }
670
+ export interface PeriodField {
671
+ start?: DateTime;
672
+ end?: DateTime;
673
+ }
674
+ export interface IssuedPlanNode extends Node, TimeStamped {
675
+ name?: string;
676
+ description?: string;
677
+ currentStates?: IssuedPlanStateNode[];
678
+ currentPeriod?: PeriodField;
679
+ currentPriceOption?: PriceOptionField;
680
+ alternativePriceOptions?: PriceOptionField[];
681
+ }
682
+ export interface IssuedPlanStateNode extends Node, TimeStamped {
683
+ periodStart?: DateTime;
684
+ periodEnd?: DateTime;
685
+ state?: PlanStateField;
686
+ }
687
+ export declare enum PlanStateField {
688
+ TRIALLING = "TRIALLING",
689
+ ACTIVE = "ACTIVE",
690
+ CANCELLED = "CANCELLED",
691
+ EXPIRED = "EXPIRED"
692
+ }
693
+ export interface BillingField {
694
+ invoiceNumber?: string;
695
+ total?: number;
696
+ currency?: string;
697
+ documentUrl?: string;
698
+ status?: string;
699
+ }
@@ -0,0 +1,66 @@
1
+ import { ID, IssuedPlanNode, IssuedPlanStateNode, PaymentCaptureField, PaymentCardField, PaymentMethodNode, PriceOptionField } from '../api/types';
2
+ export declare type PlanFieldsResult = Required<IssuedPlanNode> & {
3
+ currentStates: Required<IssuedPlanStateNode>[];
4
+ currentPriceOption: Required<PriceOptionField>;
5
+ alternativePriceOptions: Required<PriceOptionField>;
6
+ };
7
+ export interface InitiateStripePaymentMethodCaptureMutationResult {
8
+ initiateStripePaymentMethodCapture: {
9
+ paymentCapture: Required<PaymentCaptureField>;
10
+ };
11
+ }
12
+ export declare const InitiateStripePaymentMethodCaptureMutation: import("../_common/ast").TypedDocumentNode<InitiateStripePaymentMethodCaptureMutationResult>;
13
+ export interface CompleteStripePaymentMethodCaptureMutationResult {
14
+ completeStripePaymentMethodCapture: {
15
+ paymentMethod: Required<Omit<PaymentMethodNode, 'invoice'>> & {
16
+ card: Required<PaymentCardField>;
17
+ };
18
+ };
19
+ }
20
+ export declare const CompleteStripePaymentMethodCaptureMutation: import("../_common/ast").TypedDocumentNode<CompleteStripePaymentMethodCaptureMutationResult>;
21
+ export interface RemovePaymentMethodMutationResult {
22
+ removePaymentMethod: {
23
+ id: ID;
24
+ };
25
+ }
26
+ export declare const RemovePaymentMethodMutation: import("../_common/ast").TypedDocumentNode<RemovePaymentMethodMutationResult>;
27
+ export interface SetDefaultPaymentMethodMutationResult {
28
+ setDefaultPaymentMethod: {
29
+ paymentMethod: {
30
+ id: ID;
31
+ };
32
+ };
33
+ }
34
+ export declare const SetDefaultPaymentMethodMutation: import("../_common/ast").TypedDocumentNode<SetDefaultPaymentMethodMutationResult>;
35
+ export interface RemoveDefaultPaymentMethodMutationResult {
36
+ removeDefaultPaymentMethod: {
37
+ paymentMethod: {
38
+ id: ID;
39
+ };
40
+ };
41
+ }
42
+ export declare const RemoveDefaultPaymentMethodMutation: import("../_common/ast").TypedDocumentNode<RemoveDefaultPaymentMethodMutationResult>;
43
+ export interface IssuePlanMutationResult {
44
+ issuePlan: {
45
+ plan: PlanFieldsResult;
46
+ };
47
+ }
48
+ export declare const IssuePlanMutation: import("../_common/ast").TypedDocumentNode<IssuePlanMutationResult>;
49
+ export interface CancelPlanMutationResult {
50
+ cancelPlan: {
51
+ plan: PlanFieldsResult;
52
+ };
53
+ }
54
+ export declare const CancelPlanMutation: import("../_common/ast").TypedDocumentNode<CancelPlanMutationResult>;
55
+ export interface ChangePriceOptionMutationResult {
56
+ changePriceOption: {
57
+ plan: PlanFieldsResult;
58
+ };
59
+ }
60
+ export declare const ChangePriceOptionMutation: import("../_common/ast").TypedDocumentNode<ChangePriceOptionMutationResult>;
61
+ export interface ReactivatePlanMutationResult {
62
+ reactivatePlan: {
63
+ plan: PlanFieldsResult;
64
+ };
65
+ }
66
+ export declare const ReactivatePlanMutation: import("../_common/ast").TypedDocumentNode<ReactivatePlanMutationResult>;
@@ -0,0 +1,111 @@
1
+ import { Injector, NgZone } from '@angular/core';
2
+ import { LrMutation, LrService } from '../api/lr-graphql';
3
+ import { LrRelayIdInput } from '../api/types';
4
+ import { CancelPlanOptions, ChangePriceOptionOptions, 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 (eg. inside 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
+ changePriceOption(options: ChangePriceOptionOptions): Promise<import("./plan2.gql").ChangePriceOptionMutationResult>;
89
+ /**
90
+ * Change the price option for a plan.
91
+ *
92
+ * @param options.planId The id from IssuedPlanNode
93
+ * @param options.priceId The priceId from PriceOptionField (eg. inside AvailablePlanField)
94
+ * @returns Promise that resolves to a mutation
95
+ */
96
+ changePriceOptionMutation(options: ChangePriceOptionOptions): LrMutation<import("./plan2.gql").ChangePriceOptionMutationResult, {
97
+ input: ChangePriceOptionOptions;
98
+ }>;
99
+ reactivatePlan(planId: LrRelayIdInput): Promise<import("./plan2.gql").ReactivatePlanMutationResult>;
100
+ /**
101
+ * Reactivate a cancelled plan with a specified price option.
102
+ *
103
+ * @param options.planId The id from IssuedPlanNode
104
+ * @returns Promise that resolves to a mutation
105
+ */
106
+ reactivatePlanMutation(planId: LrRelayIdInput): LrMutation<import("./plan2.gql").ReactivatePlanMutationResult, {
107
+ input: {
108
+ planId: string;
109
+ };
110
+ }>;
111
+ }
@@ -0,0 +1,15 @@
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
+ }
12
+ export interface ChangePriceOptionOptions {
13
+ planId: LrRelayIdInput;
14
+ priceId: string;
15
+ }