@schematichq/schematic-components 2.3.1 → 2.4.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.
@@ -17,6 +17,15 @@ import { RuleSet } from 'styled-components';
17
17
  import type { Stripe } from '@stripe/stripe-js';
18
18
  import { Substitute } from 'styled-components/dist/types';
19
19
 
20
+ export declare const AddOns: ({ addOns, toggle, isLoading, period }: AddOnsProps) => JSX.Element;
21
+
22
+ declare interface AddOnsProps {
23
+ addOns: SelectedPlan[];
24
+ toggle: (id: string) => void;
25
+ isLoading: boolean;
26
+ period: string;
27
+ }
28
+
20
29
  declare interface AvailablePlanOptions {
21
30
  useSelectedPeriod?: boolean;
22
31
  }
@@ -740,10 +749,10 @@ declare interface BillingPriceResponseData {
740
749
  priceDecimal?: string | null;
741
750
  /**
742
751
  *
743
- * @type {string}
752
+ * @type {BillingPriceScheme}
744
753
  * @memberof BillingPriceResponseData
745
754
  */
746
- scheme: string;
755
+ scheme: BillingPriceScheme;
747
756
  }
748
757
 
749
758
  /**
@@ -790,12 +799,34 @@ declare interface BillingPriceResponseData_2 {
790
799
  priceDecimal?: string | null;
791
800
  /**
792
801
  *
793
- * @type {string}
802
+ * @type {BillingPriceScheme}
794
803
  * @memberof BillingPriceResponseData
795
804
  */
796
- scheme: string;
805
+ scheme: BillingPriceScheme_2;
797
806
  }
798
807
 
808
+ /**
809
+ *
810
+ * @export
811
+ */
812
+ declare const BillingPriceScheme: {
813
+ readonly PerUnit: "per_unit";
814
+ readonly Tiered: "tiered";
815
+ };
816
+
817
+ declare type BillingPriceScheme = (typeof BillingPriceScheme)[keyof typeof BillingPriceScheme];
818
+
819
+ /**
820
+ *
821
+ * @export
822
+ */
823
+ declare const BillingPriceScheme_2: {
824
+ readonly PerUnit: "per_unit";
825
+ readonly Tiered: "tiered";
826
+ };
827
+
828
+ declare type BillingPriceScheme_2 = (typeof BillingPriceScheme_2)[keyof typeof BillingPriceScheme_2];
829
+
799
830
  /**
800
831
  *
801
832
  * @export
@@ -807,6 +838,17 @@ declare const BillingPriceUsageType: {
807
838
 
808
839
  declare type BillingPriceUsageType = (typeof BillingPriceUsageType)[keyof typeof BillingPriceUsageType];
809
840
 
841
+ /**
842
+ *
843
+ * @export
844
+ */
845
+ declare const BillingPriceUsageType_2: {
846
+ readonly Licensed: "licensed";
847
+ readonly Metered: "metered";
848
+ };
849
+
850
+ declare type BillingPriceUsageType_2 = (typeof BillingPriceUsageType_2)[keyof typeof BillingPriceUsageType_2];
851
+
810
852
  /**
811
853
  *
812
854
  * @export
@@ -815,10 +857,10 @@ declare type BillingPriceUsageType = (typeof BillingPriceUsageType)[keyof typeof
815
857
  declare interface BillingPriceView {
816
858
  /**
817
859
  *
818
- * @type {string}
860
+ * @type {BillingPriceScheme}
819
861
  * @memberof BillingPriceView
820
862
  */
821
- billingScheme: string;
863
+ billingScheme: BillingPriceScheme;
822
864
  /**
823
865
  *
824
866
  * @type {Date}
@@ -935,10 +977,10 @@ declare interface BillingPriceView {
935
977
  updatedAt: Date;
936
978
  /**
937
979
  *
938
- * @type {string}
980
+ * @type {BillingPriceUsageType}
939
981
  * @memberof BillingPriceView
940
982
  */
941
- usageType: string;
983
+ usageType: BillingPriceUsageType;
942
984
  }
943
985
 
944
986
  /**
@@ -949,10 +991,10 @@ declare interface BillingPriceView {
949
991
  declare interface BillingPriceView_2 {
950
992
  /**
951
993
  *
952
- * @type {string}
994
+ * @type {BillingPriceScheme}
953
995
  * @memberof BillingPriceView
954
996
  */
955
- billingScheme: string;
997
+ billingScheme: BillingPriceScheme_2;
956
998
  /**
957
999
  *
958
1000
  * @type {Date}
@@ -1069,10 +1111,10 @@ declare interface BillingPriceView_2 {
1069
1111
  updatedAt: Date;
1070
1112
  /**
1071
1113
  *
1072
- * @type {string}
1114
+ * @type {BillingPriceUsageType}
1073
1115
  * @memberof BillingPriceView
1074
1116
  */
1075
- usageType: string;
1117
+ usageType: BillingPriceUsageType_2;
1076
1118
  }
1077
1119
 
1078
1120
  /**
@@ -1269,10 +1311,10 @@ declare interface BillingProductDetailResponseData_2 {
1269
1311
  declare interface BillingProductForSubscriptionResponseData {
1270
1312
  /**
1271
1313
  *
1272
- * @type {string}
1314
+ * @type {BillingPriceScheme}
1273
1315
  * @memberof BillingProductForSubscriptionResponseData
1274
1316
  */
1275
- billingScheme: string;
1317
+ billingScheme: BillingPriceScheme;
1276
1318
  /**
1277
1319
  *
1278
1320
  * @type {number}
@@ -1429,10 +1471,10 @@ declare type BillingProductPriceInterval_2 = (typeof BillingProductPriceInterval
1429
1471
  declare interface BillingProductPriceResponseData {
1430
1472
  /**
1431
1473
  *
1432
- * @type {string}
1474
+ * @type {BillingPriceScheme}
1433
1475
  * @memberof BillingProductPriceResponseData
1434
1476
  */
1435
- billingScheme: string;
1477
+ billingScheme: BillingPriceScheme;
1436
1478
  /**
1437
1479
  *
1438
1480
  * @type {Date}
@@ -1513,10 +1555,10 @@ declare interface BillingProductPriceResponseData {
1513
1555
  updatedAt: Date;
1514
1556
  /**
1515
1557
  *
1516
- * @type {string}
1558
+ * @type {BillingPriceUsageType}
1517
1559
  * @memberof BillingProductPriceResponseData
1518
1560
  */
1519
- usageType: string;
1561
+ usageType: BillingPriceUsageType;
1520
1562
  }
1521
1563
 
1522
1564
  /**
@@ -2290,12 +2332,32 @@ declare const ChargeType_2: {
2290
2332
 
2291
2333
  declare type ChargeType_2 = (typeof ChargeType_2)[keyof typeof ChargeType_2];
2292
2334
 
2335
+ export declare const Checkout: ({ isPaymentMethodRequired, setPaymentMethodId, updatePromoCode, confirmPaymentIntentProps, financeData, onPaymentMethodSaved, }: CheckoutProps) => JSX.Element | null;
2336
+
2293
2337
  export declare const CheckoutDialog: ({ top }: CheckoutDialogProps) => JSX.Element;
2294
2338
 
2295
2339
  declare interface CheckoutDialogProps {
2296
2340
  top?: number;
2297
2341
  }
2298
2342
 
2343
+ declare interface CheckoutProps {
2344
+ isPaymentMethodRequired: boolean;
2345
+ setPaymentMethodId: (id: string) => void;
2346
+ updatePromoCode: (code: string) => void;
2347
+ confirmPaymentIntentProps?: ConfirmPaymentIntentProps_2 | null | undefined;
2348
+ financeData?: PreviewSubscriptionFinanceResponseData | null;
2349
+ onPaymentMethodSaved?: (updates: {
2350
+ period?: string;
2351
+ plan?: SelectedPlan;
2352
+ shouldTrial?: boolean;
2353
+ addOns?: SelectedPlan[];
2354
+ payInAdvanceEntitlements?: UsageBasedEntitlement[];
2355
+ addOnPayInAdvanceEntitlements?: UsageBasedEntitlement[];
2356
+ creditBundles?: CreditBundle[];
2357
+ promoCode?: string | null;
2358
+ }) => void;
2359
+ }
2360
+
2299
2361
  /**
2300
2362
  *
2301
2363
  * @export
@@ -3068,10 +3130,10 @@ declare interface CompanyPlanDetailResponseData {
3068
3130
  includedCreditGrants: Array<PlanCreditGrantView>;
3069
3131
  /**
3070
3132
  *
3071
- * @type {string}
3133
+ * @type {CompanyPlanInvalidReason}
3072
3134
  * @memberof CompanyPlanDetailResponseData
3073
3135
  */
3074
- invalidReason?: CompanyPlanDetailResponseDataInvalidReasonEnum | null;
3136
+ invalidReason?: CompanyPlanInvalidReason | null;
3075
3137
  /**
3076
3138
  *
3077
3139
  * @type {boolean}
@@ -3154,14 +3216,15 @@ declare interface CompanyPlanDetailResponseData {
3154
3216
  }
3155
3217
 
3156
3218
  /**
3219
+ *
3157
3220
  * @export
3158
3221
  */
3159
- declare const CompanyPlanDetailResponseDataInvalidReasonEnum: {
3160
- readonly FeatureUsageExceeded: "feature_usage_exceeded";
3222
+ declare const CompanyPlanInvalidReason: {
3161
3223
  readonly DowngradeNotPermitted: "downgrade_not_permitted";
3224
+ readonly FeatureUsageExceeded: "feature_usage_exceeded";
3162
3225
  };
3163
3226
 
3164
- declare type CompanyPlanDetailResponseDataInvalidReasonEnum = (typeof CompanyPlanDetailResponseDataInvalidReasonEnum)[keyof typeof CompanyPlanDetailResponseDataInvalidReasonEnum];
3227
+ declare type CompanyPlanInvalidReason = (typeof CompanyPlanInvalidReason)[keyof typeof CompanyPlanInvalidReason];
3165
3228
 
3166
3229
  /**
3167
3230
  *
@@ -3490,6 +3553,92 @@ declare interface ComponentCheckoutSettings {
3490
3553
  taxCollectionEnabled: boolean;
3491
3554
  }
3492
3555
 
3556
+ /**
3557
+ * Schematic API
3558
+ * Schematic API
3559
+ *
3560
+ * The version of the OpenAPI document: 0.1
3561
+ *
3562
+ *
3563
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
3564
+ * https://openapi-generator.tech
3565
+ * Do not edit the class manually.
3566
+ */
3567
+ /**
3568
+ *
3569
+ * @export
3570
+ * @interface ComponentDisplaySettings
3571
+ */
3572
+ declare interface ComponentDisplaySettings {
3573
+ /**
3574
+ *
3575
+ * @type {boolean}
3576
+ * @memberof ComponentDisplaySettings
3577
+ */
3578
+ showAsMonthlyPrices: boolean;
3579
+ /**
3580
+ *
3581
+ * @type {boolean}
3582
+ * @memberof ComponentDisplaySettings
3583
+ */
3584
+ showCredits: boolean;
3585
+ /**
3586
+ *
3587
+ * @type {boolean}
3588
+ * @memberof ComponentDisplaySettings
3589
+ */
3590
+ showPeriodToggle: boolean;
3591
+ /**
3592
+ *
3593
+ * @type {boolean}
3594
+ * @memberof ComponentDisplaySettings
3595
+ */
3596
+ showZeroPriceAsFree: boolean;
3597
+ }
3598
+
3599
+ /**
3600
+ * Schematic API
3601
+ * Schematic API
3602
+ *
3603
+ * The version of the OpenAPI document: 0.1
3604
+ *
3605
+ *
3606
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
3607
+ * https://openapi-generator.tech
3608
+ * Do not edit the class manually.
3609
+ */
3610
+ /**
3611
+ *
3612
+ * @export
3613
+ * @interface ComponentDisplaySettings
3614
+ */
3615
+ declare interface ComponentDisplaySettings_2 {
3616
+ /**
3617
+ *
3618
+ * @type {boolean}
3619
+ * @memberof ComponentDisplaySettings
3620
+ */
3621
+ showAsMonthlyPrices: boolean;
3622
+ /**
3623
+ *
3624
+ * @type {boolean}
3625
+ * @memberof ComponentDisplaySettings
3626
+ */
3627
+ showCredits: boolean;
3628
+ /**
3629
+ *
3630
+ * @type {boolean}
3631
+ * @memberof ComponentDisplaySettings
3632
+ */
3633
+ showPeriodToggle: boolean;
3634
+ /**
3635
+ *
3636
+ * @type {boolean}
3637
+ * @memberof ComponentDisplaySettings
3638
+ */
3639
+ showZeroPriceAsFree: boolean;
3640
+ }
3641
+
3493
3642
  /**
3494
3643
  *
3495
3644
  * @export
@@ -3573,6 +3722,12 @@ declare interface ComponentHydrateResponseData {
3573
3722
  * @memberof ComponentHydrateResponseData
3574
3723
  */
3575
3724
  defaultPlan?: PlanDetailResponseData;
3725
+ /**
3726
+ *
3727
+ * @type {ComponentDisplaySettings}
3728
+ * @memberof ComponentHydrateResponseData
3729
+ */
3730
+ displaySettings: ComponentDisplaySettings;
3576
3731
  /**
3577
3732
  *
3578
3733
  * @type {FeatureUsageDetailResponseData}
@@ -3607,18 +3762,28 @@ declare interface ComponentHydrateResponseData {
3607
3762
  *
3608
3763
  * @type {boolean}
3609
3764
  * @memberof ComponentHydrateResponseData
3765
+ * @deprecated
3766
+ */
3767
+ showAsMonthlyPrices: boolean;
3768
+ /**
3769
+ *
3770
+ * @type {boolean}
3771
+ * @memberof ComponentHydrateResponseData
3772
+ * @deprecated
3610
3773
  */
3611
3774
  showCredits: boolean;
3612
3775
  /**
3613
3776
  *
3614
3777
  * @type {boolean}
3615
3778
  * @memberof ComponentHydrateResponseData
3779
+ * @deprecated
3616
3780
  */
3617
3781
  showPeriodToggle: boolean;
3618
3782
  /**
3619
3783
  *
3620
3784
  * @type {boolean}
3621
3785
  * @memberof ComponentHydrateResponseData
3786
+ * @deprecated
3622
3787
  */
3623
3788
  showZeroPriceAsFree: boolean;
3624
3789
  /**
@@ -3901,6 +4066,11 @@ declare interface ConfirmPaymentIntentProps {
3901
4066
  callback: (confirmed: boolean) => void;
3902
4067
  }
3903
4068
 
4069
+ declare interface ConfirmPaymentIntentProps_2 {
4070
+ clientSecret: string;
4071
+ callback: (confirmed: boolean) => void;
4072
+ }
4073
+
3904
4074
  export declare const Container: IStyledComponentBase<"web", FastOmit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3905
4075
 
3906
4076
  export declare const createActiveUsageBasedEntitlementsReducer: (entitlements: FeatureUsageResponseData[], period: string) => (acc: UsageBasedEntitlement[], entitlement: PlanEntitlementResponseData) => UsageBasedEntitlement[];
@@ -3963,6 +4133,12 @@ declare interface CreditCompanyGrantView {
3963
4133
  * @memberof CreditCompanyGrantView
3964
4134
  */
3965
4135
  creditName: string;
4136
+ /**
4137
+ *
4138
+ * @type {Date}
4139
+ * @memberof CreditCompanyGrantView
4140
+ */
4141
+ exhaustedAt?: Date | null;
3966
4142
  /**
3967
4143
  *
3968
4144
  * @type {Date}
@@ -4111,6 +4287,14 @@ declare interface CreditGrantDetail {
4111
4287
  quantity: number;
4112
4288
  }
4113
4289
 
4290
+ export declare const Credits: ({ bundles, updateCount }: CreditsProps) => JSX.Element;
4291
+
4292
+ declare interface CreditsProps {
4293
+ isLoading: boolean;
4294
+ bundles: CreditBundle[];
4295
+ updateCount: (id: string, count: number) => void;
4296
+ }
4297
+
4114
4298
  /**
4115
4299
  * Schematic API
4116
4300
  * Schematic API
@@ -4508,6 +4692,7 @@ export declare interface EmbedContextProps extends EmbedState {
4508
4692
  setError: (error: Error) => void;
4509
4693
  setLayout: (layout: EmbedLayout) => void;
4510
4694
  setCheckoutState: (state: CheckoutState) => void;
4695
+ clearCheckoutState: () => void;
4511
4696
  initializeWithPlan: (config: string | BypassConfig) => void;
4512
4697
  setData: (data: HydrateDataWithCompanyContext) => void;
4513
4698
  updateSettings: (settings: DeepPartial<EmbedSettings>, options?: {
@@ -6068,6 +6253,7 @@ export declare const initialContext: {
6068
6253
  setAccessToken: () => never;
6069
6254
  setLayout: () => never;
6070
6255
  setCheckoutState: () => never;
6256
+ clearCheckoutState: () => never;
6071
6257
  initializeWithPlan: () => never;
6072
6258
  setData: () => never;
6073
6259
  updateSettings: () => never;
@@ -6473,7 +6659,9 @@ declare interface PaymentMethodResponseData {
6473
6659
  updatedAt: Date;
6474
6660
  }
6475
6661
 
6476
- declare type Plan = CompanyPlanDetailResponseData;
6662
+ export declare const Plan: ({ isLoading, plans, selectedPlan, period, selectPlan, shouldTrial, }: PlanProps) => JSX.Element;
6663
+
6664
+ declare type Plan_2 = CompanyPlanDetailResponseData;
6477
6665
 
6478
6666
  /**
6479
6667
  *
@@ -7271,6 +7459,19 @@ portal?: HTMLElement | null;
7271
7459
 
7272
7460
  export declare type PlanManagerProps = DesignProps_6;
7273
7461
 
7462
+ declare interface PlanProps {
7463
+ isLoading: boolean;
7464
+ plans: SelectedPlan[];
7465
+ selectedPlan?: SelectedPlan;
7466
+ period: string;
7467
+ selectPlan: (updates: {
7468
+ plan: SelectedPlan;
7469
+ period?: string;
7470
+ shouldTrial?: boolean;
7471
+ }) => void;
7472
+ shouldTrial: boolean;
7473
+ }
7474
+
7274
7475
  /**
7275
7476
  *
7276
7477
  * @export
@@ -7915,6 +8116,12 @@ declare interface PreviewSubscriptionFinanceResponseData {
7915
8116
  * @memberof PreviewSubscriptionFinanceResponseData
7916
8117
  */
7917
8118
  taxRequireBillingDetails: boolean;
8119
+ /**
8120
+ *
8121
+ * @type {number}
8122
+ * @memberof PreviewSubscriptionFinanceResponseData
8123
+ */
8124
+ totalPerBillingPeriod: number;
7918
8125
  /**
7919
8126
  *
7920
8127
  * @type {Date}
@@ -8030,22 +8237,38 @@ declare interface PublicPlansResponseData {
8030
8237
  * @memberof PublicPlansResponseData
8031
8238
  */
8032
8239
  capabilities?: ComponentCapabilities_2;
8240
+ /**
8241
+ *
8242
+ * @type {ComponentDisplaySettings}
8243
+ * @memberof PublicPlansResponseData
8244
+ */
8245
+ displaySettings: ComponentDisplaySettings_2;
8033
8246
  /**
8034
8247
  *
8035
8248
  * @type {boolean}
8036
8249
  * @memberof PublicPlansResponseData
8250
+ * @deprecated
8251
+ */
8252
+ showAsMonthlyPrices: boolean;
8253
+ /**
8254
+ *
8255
+ * @type {boolean}
8256
+ * @memberof PublicPlansResponseData
8257
+ * @deprecated
8037
8258
  */
8038
8259
  showCredits: boolean;
8039
8260
  /**
8040
8261
  *
8041
8262
  * @type {boolean}
8042
8263
  * @memberof PublicPlansResponseData
8264
+ * @deprecated
8043
8265
  */
8044
8266
  showPeriodToggle: boolean;
8045
8267
  /**
8046
8268
  *
8047
8269
  * @type {boolean}
8048
8270
  * @memberof PublicPlansResponseData
8271
+ * @deprecated
8049
8272
  */
8050
8273
  showZeroPriceAsFree: boolean;
8051
8274
  }
@@ -8677,7 +8900,7 @@ declare type RuleRuleTypeEnum = (typeof RuleRuleTypeEnum)[keyof typeof RuleRuleT
8677
8900
 
8678
8901
  export declare const SchematicEmbed: ({ id, accessToken }: EmbedProps) => JSX.Element;
8679
8902
 
8680
- declare type SelectedPlan = Plan & {
8903
+ declare type SelectedPlan = Plan_2 & {
8681
8904
  isSelected: boolean;
8682
8905
  };
8683
8906
 
@@ -9053,6 +9276,8 @@ declare interface UpdatePaymentMethodResponse {
9053
9276
  params: object;
9054
9277
  }
9055
9278
 
9279
+ export declare const Usage: ({ entitlements, updateQuantity, period }: UsageProps) => JSX.Element;
9280
+
9056
9281
  declare interface UsageBasedEntitlement extends PlanEntitlementResponseData {
9057
9282
  allocation: number;
9058
9283
  usage: number;
@@ -9139,6 +9364,14 @@ declare interface UsageBasedEntitlementResponseData {
9139
9364
  yearlyUsageBasedPrice?: BillingPriceView;
9140
9365
  }
9141
9366
 
9367
+ declare interface UsageProps {
9368
+ isLoading: boolean;
9369
+ period: string;
9370
+ selectedPlan?: SelectedPlan;
9371
+ entitlements: UsageBasedEntitlement[];
9372
+ updateQuantity: (id: string, quantity: number) => void;
9373
+ }
9374
+
9142
9375
  export declare function useAvailablePlans(activePeriod: string, options?: AvailablePlanOptions): {
9143
9376
  plans: SelectedPlan[];
9144
9377
  addOns: SelectedPlan[];
@@ -9173,7 +9406,8 @@ export declare function useRequest<TData>(fn: () => Promise<{
9173
9406
 
9174
9407
  export declare function useTrialEnd(): {
9175
9408
  endDate: Date | undefined;
9176
- formatted: string | undefined;
9409
+ amount: number | undefined;
9410
+ units: string | undefined;
9177
9411
  };
9178
9412
 
9179
9413
  export declare function useWrapChildren(ref: React.RefObject<HTMLElement[]>): boolean;