@schematichq/schematic-react 0.2.0-rc.2 → 0.2.0-rc.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,6 +28,56 @@ import { Stripe } from '@stripe/stripe-js';
28
28
  import { Substitute } from 'styled-components/dist/types';
29
29
  import { Traits } from '@schematichq/schematic-js';
30
30
 
31
+ declare interface ApiResponse<T> {
32
+ raw: Response;
33
+ value(): Promise<T>;
34
+ }
35
+
36
+ /**
37
+ * Schematic API
38
+ * Schematic API
39
+ *
40
+ * The version of the OpenAPI document: 0.1
41
+ *
42
+ *
43
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
44
+ * https://openapi-generator.tech
45
+ * Do not edit the class manually.
46
+ */
47
+ declare const BASE_PATH: string;
48
+
49
+ /**
50
+ * This is the base class for all generated API classes.
51
+ */
52
+ declare class BaseAPI {
53
+ protected configuration: Configuration;
54
+ private static readonly jsonRegex;
55
+ private middleware;
56
+ constructor(configuration?: Configuration);
57
+ withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]): T;
58
+ withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware["pre"]>): T;
59
+ withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware["post"]>): T;
60
+ /**
61
+ * Check if the given MIME is a JSON MIME.
62
+ * JSON MIME examples:
63
+ * application/json
64
+ * application/json; charset=UTF8
65
+ * APPLICATION/JSON
66
+ * application/vnd.company+json
67
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
68
+ * @return True if the given MIME is JSON, false otherwise.
69
+ */
70
+ protected isJsonMime(mime: string | null | undefined): boolean;
71
+ protected request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise<Response>;
72
+ private createFetchParams;
73
+ private fetchApi;
74
+ /**
75
+ * Create a shallow clone of `this` by constructing a new instance
76
+ * and then shallow cloning data members.
77
+ */
78
+ private clone;
79
+ }
80
+
31
81
  declare type BaseSchematicProviderProps = Omit<SchematicJS.SchematicOptions, "client" | "publishableKey"> & {
32
82
  children: React.ReactNode;
33
83
  };
@@ -295,6 +345,55 @@ declare interface BillingProductForSubscriptionResponseData {
295
345
  updatedAt: Date;
296
346
  }
297
347
 
348
+ /**
349
+ * Schematic API
350
+ * Schematic API
351
+ *
352
+ * The version of the OpenAPI document: 0.1
353
+ *
354
+ *
355
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
356
+ * https://openapi-generator.tech
357
+ * Do not edit the class manually.
358
+ */
359
+ /**
360
+ * The created resource
361
+ * @export
362
+ * @interface BillingSubscriptionResponseData
363
+ */
364
+ declare interface BillingSubscriptionResponseData {
365
+ /**
366
+ *
367
+ * @type {Date}
368
+ * @memberof BillingSubscriptionResponseData
369
+ */
370
+ expiredAt?: Date | null;
371
+ /**
372
+ *
373
+ * @type {string}
374
+ * @memberof BillingSubscriptionResponseData
375
+ */
376
+ externalId: string;
377
+ /**
378
+ *
379
+ * @type {number}
380
+ * @memberof BillingSubscriptionResponseData
381
+ */
382
+ id: number;
383
+ /**
384
+ *
385
+ * @type {Date}
386
+ * @memberof BillingSubscriptionResponseData
387
+ */
388
+ updatedAt: Date;
389
+ }
390
+
391
+ declare class BlobApiResponse {
392
+ raw: Response;
393
+ constructor(raw: Response);
394
+ value(): Promise<Blob>;
395
+ }
396
+
298
397
  export declare const Box: IStyledComponentBase<"web", Substitute<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ComponentProps>> & string;
299
398
 
300
399
  export declare type BoxProps = ComponentProps;
@@ -313,6 +412,8 @@ export declare type ButtonStyleTypes = "blue" | "white" | "red" | "black";
313
412
 
314
413
  export declare type ButtonVariantTypes = "solid" | "outline" | "ghost" | "link";
315
414
 
415
+ declare function canConsumeForm(consumes: Consume[]): boolean;
416
+
316
417
  export declare const Card: ForwardRefExoticComponent<CardProps & RefAttributes<HTMLDivElement | null>>;
317
418
 
318
419
  export declare interface CardProps {
@@ -320,6 +421,96 @@ export declare interface CardProps {
320
421
  className?: string;
321
422
  }
322
423
 
424
+ /**
425
+ * Schematic API
426
+ * Schematic API
427
+ *
428
+ * The version of the OpenAPI document: 0.1
429
+ *
430
+ *
431
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
432
+ * https://openapi-generator.tech
433
+ * Do not edit the class manually.
434
+ */
435
+ /**
436
+ *
437
+ * @export
438
+ * @interface ChangeSubscriptionRequestBody
439
+ */
440
+ declare interface ChangeSubscriptionRequestBody {
441
+ /**
442
+ *
443
+ * @type {string}
444
+ * @memberof ChangeSubscriptionRequestBody
445
+ */
446
+ newPlanId: string;
447
+ /**
448
+ *
449
+ * @type {string}
450
+ * @memberof ChangeSubscriptionRequestBody
451
+ */
452
+ newPriceId: string;
453
+ /**
454
+ *
455
+ * @type {string}
456
+ * @memberof ChangeSubscriptionRequestBody
457
+ */
458
+ paymentMethodId?: string | null;
459
+ }
460
+
461
+ /**
462
+ *
463
+ */
464
+ declare class CheckoutApi extends runtime.BaseAPI {
465
+ /**
466
+ * Checkout
467
+ */
468
+ checkoutRaw(requestParameters: CheckoutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CheckoutResponse>>;
469
+ /**
470
+ * Checkout
471
+ */
472
+ checkout(requestParameters: CheckoutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CheckoutResponse>;
473
+ /**
474
+ * Hydrate component
475
+ */
476
+ hydrateComponentRaw(requestParameters: HydrateComponentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<HydrateComponentResponse>>;
477
+ /**
478
+ * Hydrate component
479
+ */
480
+ hydrateComponent(requestParameters: HydrateComponentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<HydrateComponentResponse>;
481
+ }
482
+
483
+ declare interface CheckoutRequest {
484
+ changeSubscriptionRequestBody: ChangeSubscriptionRequestBody;
485
+ }
486
+
487
+ /**
488
+ *
489
+ * @export
490
+ * @interface CheckoutResponse
491
+ */
492
+ declare interface CheckoutResponse {
493
+ /**
494
+ *
495
+ * @type {BillingSubscriptionResponseData}
496
+ * @memberof CheckoutResponse
497
+ */
498
+ data: BillingSubscriptionResponseData;
499
+ /**
500
+ * Input parameters
501
+ * @type {object}
502
+ * @memberof CheckoutResponse
503
+ */
504
+ params: object;
505
+ }
506
+
507
+ declare const COLLECTION_FORMATS: {
508
+ csv: string;
509
+ ssv: string;
510
+ tsv: string;
511
+ pipes: string;
512
+ };
513
+
323
514
  export declare const Column: ForwardRefExoticComponent<Omit<ColumnProps, "ref"> & RefAttributes<HTMLDivElement | null>>;
324
515
 
325
516
  export declare interface ColumnProps extends React.HTMLProps<HTMLDivElement> {
@@ -619,6 +810,12 @@ declare interface ComponentHydrateResponseData {
619
810
  * @memberof ComponentHydrateResponseData
620
811
  */
621
812
  subscription?: CompanySubscriptionResponseData;
813
+ /**
814
+ *
815
+ * @type {InvoiceResponseData}
816
+ * @memberof ComponentHydrateResponseData
817
+ */
818
+ upcomingInvoice?: InvoiceResponseData;
622
819
  }
623
820
 
624
821
  declare interface ComponentProps extends TransientCSSProperties {
@@ -688,6 +885,22 @@ declare interface ComponentResponseData {
688
885
  updatedAt: Date;
689
886
  }
690
887
 
888
+ declare class Configuration {
889
+ private configuration;
890
+ constructor(configuration?: ConfigurationParameters);
891
+ set config(configuration: Configuration);
892
+ get basePath(): string;
893
+ get fetchApi(): FetchAPI | undefined;
894
+ get middleware(): Middleware[];
895
+ get queryParamsStringify(): (params: HTTPQuery) => string;
896
+ get username(): string | undefined;
897
+ get password(): string | undefined;
898
+ get apiKey(): ((name: string) => string | Promise<string>) | undefined;
899
+ get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined;
900
+ get headers(): HTTPHeaders | undefined;
901
+ get credentials(): RequestCredentials | undefined;
902
+ }
903
+
691
904
  declare interface ConfigurationParameters {
692
905
  basePath?: string;
693
906
  fetchApi?: FetchAPI;
@@ -701,6 +914,10 @@ declare interface ConfigurationParameters {
701
914
  credentials?: RequestCredentials;
702
915
  }
703
916
 
917
+ declare interface Consume {
918
+ contentType: string;
919
+ }
920
+
704
921
  declare const _default: {
705
922
  alarm: number;
706
923
  "arrow-curved": number;
@@ -801,6 +1018,8 @@ declare const _default: {
801
1018
  wind: number;
802
1019
  };
803
1020
 
1021
+ declare const DefaultConfig: Configuration;
1022
+
804
1023
  export declare const defaultSettings: EmbedSettings;
805
1024
 
806
1025
  export declare const defaultTheme: EmbedThemeSettings;
@@ -939,7 +1158,8 @@ declare interface ElementProps {
939
1158
  export declare const EmbedContext: Context<EmbedContextProps>;
940
1159
 
941
1160
  export declare interface EmbedContextProps {
942
- data: RecursivePartial<ComponentHydrateResponseData>;
1161
+ api: CheckoutApi | null;
1162
+ data: ComponentHydrateResponseData;
943
1163
  nodes: SerializedNodeWithChildren[];
944
1164
  settings: EmbedSettings;
945
1165
  stripe: Promise<Stripe | null> | null;
@@ -1570,6 +1790,12 @@ declare type FeatureUsageResponseDataAllocationTypeEnum = (typeof FeatureUsageRe
1570
1790
 
1571
1791
  declare type FetchAPI = WindowOrWorkerGlobalScope["fetch"];
1572
1792
 
1793
+ declare class FetchError extends Error {
1794
+ cause: Error;
1795
+ name: "FetchError";
1796
+ constructor(cause: Error, msg?: string);
1797
+ }
1798
+
1573
1799
  declare interface FetchParams {
1574
1800
  url: string;
1575
1801
  init: RequestInit;
@@ -1671,14 +1897,49 @@ ref?: ((instance: HTMLDivElement | null) => void | DO_NOT_USE_OR_YOU_WILL_BE_FIR
1671
1897
 
1672
1898
  declare type FontStyle = keyof EmbedThemeSettings["typography"];
1673
1899
 
1900
+ declare type HTTPBody = Json | FormData | URLSearchParams;
1901
+
1674
1902
  declare type HTTPHeaders = {
1675
1903
  [key: string]: string;
1676
1904
  };
1677
1905
 
1906
+ declare type HTTPMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
1907
+
1678
1908
  declare type HTTPQuery = {
1679
1909
  [key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery;
1680
1910
  };
1681
1911
 
1912
+ declare type HTTPRequestInit = {
1913
+ headers?: HTTPHeaders;
1914
+ method: HTTPMethod;
1915
+ credentials?: RequestCredentials;
1916
+ body?: HTTPBody;
1917
+ };
1918
+
1919
+ declare interface HydrateComponentRequest {
1920
+ componentId: string;
1921
+ }
1922
+
1923
+ /**
1924
+ *
1925
+ * @export
1926
+ * @interface HydrateComponentResponse
1927
+ */
1928
+ declare interface HydrateComponentResponse {
1929
+ /**
1930
+ *
1931
+ * @type {ComponentHydrateResponseData}
1932
+ * @memberof HydrateComponentResponse
1933
+ */
1934
+ data: ComponentHydrateResponseData;
1935
+ /**
1936
+ * Input parameters
1937
+ * @type {object}
1938
+ * @memberof HydrateComponentResponse
1939
+ */
1940
+ params: object;
1941
+ }
1942
+
1682
1943
  export declare const Icon: ({ name, className, ...props }: IconProps) => JSX_2.Element;
1683
1944
 
1684
1945
  export declare type IconNameTypes = keyof typeof _default;
@@ -1700,6 +1961,11 @@ export declare const IncludedFeatures: ForwardRefExoticComponent<ElementProps &
1700
1961
 
1701
1962
  export declare type IncludedFeaturesProps = DesignProps_2;
1702
1963
 
1964
+ declare type InitOverrideFunction = (requestContext: {
1965
+ init: HTTPRequestInit;
1966
+ context: RequestOpts;
1967
+ }) => Promise<RequestInit>;
1968
+
1703
1969
  /**
1704
1970
  * Schematic API
1705
1971
  * Schematic API
@@ -1813,8 +2079,19 @@ export declare const Invoices: ForwardRefExoticComponent<ElementProps & Recursiv
1813
2079
 
1814
2080
  export declare type InvoicesProps = DesignProps_6;
1815
2081
 
2082
+ declare type Json = any;
2083
+
2084
+ declare class JSONApiResponse<T> {
2085
+ raw: Response;
2086
+ private transformer;
2087
+ constructor(raw: Response, transformer?: ResponseTransformer<T>);
2088
+ value(): Promise<T>;
2089
+ }
2090
+
1816
2091
  export { Keys }
1817
2092
 
2093
+ declare function mapValues(data: any, fn: (item: any) => any): {};
2094
+
1818
2095
  export declare const MeteredFeatures: ForwardRefExoticComponent<ElementProps & RecursivePartial<DesignProps_3> & HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement | null>>;
1819
2096
 
1820
2097
  export declare type MeteredFeaturesProps = DesignProps_3;
@@ -1825,19 +2102,27 @@ declare interface Middleware {
1825
2102
  onError?(context: ErrorContext): Promise<Response | void>;
1826
2103
  }
1827
2104
 
1828
- export declare const OverlayHeader: ({ children }: {
2105
+ declare type ModelPropertyNaming = "camelCase" | "snake_case" | "PascalCase" | "original";
2106
+
2107
+ export declare const OverlayHeader: ({ children, onClose, }: {
1829
2108
  children: ReactNode;
2109
+ onClose?: () => void;
1830
2110
  }) => JSX_2.Element;
1831
2111
 
1832
- export declare const OverlaySideBar: ({ pricePeriod, setPricePeriod, setCheckoutStage, }: {
2112
+ export declare const OverlaySideBar: ({ pricePeriod, setPricePeriod, checkoutStage, setCheckoutStage, currentPlan, selectedPlan, paymentMethodId, }: {
1833
2113
  pricePeriod: "month" | "year";
1834
2114
  setPricePeriod: Dispatch<SetStateAction<"month" | "year">>;
2115
+ checkoutStage: "plan" | "checkout";
1835
2116
  setCheckoutStage: Dispatch<SetStateAction<"plan" | "checkout">>;
2117
+ currentPlan?: BillingPlan;
2118
+ selectedPlan?: CompanyPlanDetailResponseData;
2119
+ paymentMethodId?: string;
1836
2120
  }) => JSX_2.Element;
1837
2121
 
1838
- export declare const OverlayWrapper: ({ children, size, }: {
2122
+ export declare const OverlayWrapper: ({ children, size, onClose, }: {
1839
2123
  children: ReactNode;
1840
2124
  size?: "md" | "lg";
2125
+ onClose?: () => void;
1841
2126
  }) => JSX_2.Element;
1842
2127
 
1843
2128
  export declare const PaymentMethod: ForwardRefExoticComponent<ElementProps & RecursivePartial<DesignProps_5> & HTMLAttributes<HTMLDivElement> & {
@@ -2173,6 +2458,8 @@ export declare interface ProgressBarProps extends React.ComponentPropsWithoutRef
2173
2458
  barWidth?: string | number;
2174
2459
  }
2175
2460
 
2461
+ declare function querystring(params: HTTPQuery, prefix?: string): string;
2462
+
2176
2463
  declare type RecursivePartial<T> = {
2177
2464
  [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object | undefined ? RecursivePartial<T[P]> : T[P];
2178
2465
  };
@@ -2183,6 +2470,20 @@ declare interface RequestContext {
2183
2470
  init: RequestInit;
2184
2471
  }
2185
2472
 
2473
+ declare interface RequestOpts {
2474
+ path: string;
2475
+ method: HTTPMethod;
2476
+ headers: HTTPHeaders;
2477
+ query?: HTTPQuery;
2478
+ body?: HTTPBody;
2479
+ }
2480
+
2481
+ declare class RequiredError extends Error {
2482
+ field: string;
2483
+ name: "RequiredError";
2484
+ constructor(field: string, msg?: string);
2485
+ }
2486
+
2186
2487
  declare interface ResponseContext {
2187
2488
  fetch: FetchAPI;
2188
2489
  url: string;
@@ -2190,6 +2491,16 @@ declare interface ResponseContext {
2190
2491
  response: Response;
2191
2492
  }
2192
2493
 
2494
+ declare class ResponseError extends Error {
2495
+ response: Response;
2496
+ name: "ResponseError";
2497
+ constructor(response: Response, msg?: string);
2498
+ }
2499
+
2500
+ declare interface ResponseTransformer<T> {
2501
+ (json: any): T;
2502
+ }
2503
+
2193
2504
  export declare const Root: ForwardRefExoticComponent<Omit<RootProps, "ref"> & RefAttributes<HTMLDivElement | null>>;
2194
2505
 
2195
2506
  export declare interface RootProps extends React.HTMLProps<HTMLDivElement> {
@@ -2496,6 +2807,45 @@ declare interface RuleDetailResponseData {
2496
2807
  value: boolean;
2497
2808
  }
2498
2809
 
2810
+ declare namespace runtime {
2811
+ export {
2812
+ querystring,
2813
+ mapValues,
2814
+ canConsumeForm,
2815
+ BASE_PATH,
2816
+ ConfigurationParameters,
2817
+ Configuration,
2818
+ DefaultConfig,
2819
+ BaseAPI,
2820
+ ResponseError,
2821
+ FetchError,
2822
+ RequiredError,
2823
+ COLLECTION_FORMATS,
2824
+ FetchAPI,
2825
+ Json,
2826
+ HTTPMethod,
2827
+ HTTPHeaders,
2828
+ HTTPQuery,
2829
+ HTTPBody,
2830
+ HTTPRequestInit,
2831
+ ModelPropertyNaming,
2832
+ InitOverrideFunction,
2833
+ FetchParams,
2834
+ RequestOpts,
2835
+ Consume,
2836
+ RequestContext,
2837
+ ResponseContext,
2838
+ ErrorContext,
2839
+ Middleware,
2840
+ ApiResponse,
2841
+ ResponseTransformer,
2842
+ JSONApiResponse,
2843
+ VoidApiResponse,
2844
+ BlobApiResponse,
2845
+ TextApiResponse
2846
+ }
2847
+ }
2848
+
2499
2849
  export { Schematic }
2500
2850
 
2501
2851
  export { SchematicContext }
@@ -2565,11 +2915,23 @@ declare interface StripeEmbedInfo {
2565
2915
  * @memberof StripeEmbedInfo
2566
2916
  */
2567
2917
  publishableKey: string;
2918
+ /**
2919
+ *
2920
+ * @type {string}
2921
+ * @memberof StripeEmbedInfo
2922
+ */
2923
+ setupIntentClientSecret?: string | null;
2568
2924
  }
2569
2925
 
2570
2926
  declare const Text_2: IStyledComponentBase<"web", Substitute<DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, TextProps>> & string;
2571
2927
  export { Text_2 as Text }
2572
2928
 
2929
+ declare class TextApiResponse {
2930
+ raw: Response;
2931
+ constructor(raw: Response);
2932
+ value(): Promise<string>;
2933
+ }
2934
+
2573
2935
  export declare interface TextProps extends ComponentProps {
2574
2936
  $align?: ComponentProps["$textAlign"];
2575
2937
  $font?: ComponentProps["$fontFamily"];
@@ -2620,4 +2982,10 @@ export declare const Viewport: ForwardRefExoticComponent<Omit<ViewportProps, "re
2620
2982
  export declare interface ViewportProps extends React.HTMLProps<HTMLDivElement> {
2621
2983
  }
2622
2984
 
2985
+ declare class VoidApiResponse {
2986
+ raw: Response;
2987
+ constructor(raw: Response);
2988
+ value(): Promise<void>;
2989
+ }
2990
+
2623
2991
  export { }