@szymonpiatek/nextwordpress 0.0.4 → 0.0.6
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/dist/hooks/index.cjs +371 -11
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +92 -2
- package/dist/hooks/index.d.ts +92 -2
- package/dist/hooks/index.js +365 -12
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +217 -115
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -168
- package/dist/index.d.ts +46 -168
- package/dist/index.js +215 -116
- package/dist/index.js.map +1 -1
- package/dist/{types-EjYH-eZp.d.cts → types-soq-mA1E.d.cts} +158 -1
- package/dist/{types-EjYH-eZp.d.ts → types-soq-mA1E.d.ts} +158 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
import { N as NextWordpressConfig, W as WordPressResponse, T as Taxonomy,
|
|
2
|
-
export { B as BlockType, E as EditorBlock,
|
|
1
|
+
import { N as NextWordpressConfig, J as JwtAuthCredentials, k as JwtAuthResponse, a as WooCommerceConfig, d as WooCommerceResponse, W as WordPressResponse, T as Taxonomy, l as WPEntity, R as RenderedTitle, m as RenderedContent, P as Post, A as Author, F as FeaturedMedia, n as WCImage, o as WCProductVariation, b as WCProduct, g as WCCustomer, p as WCAddress, U as UpdateCustomerInput, e as WCCreateOrderInput, f as WCOrder, c as WCProductFilterParams, h as WPGraphQLConfig, j as GQLConnection, i as GQLPostFilter, G as GQLPost } from './types-soq-mA1E.cjs';
|
|
2
|
+
export { q as AuthenticationError, B as BlockType, E as EditorBlock, r as EmbeddedAuthor, s as EmbeddedTerm, t as GQLError, u as GQLPageInfo, M as MediaDetails, v as MediaSize, w as PostEmbedded, S as SearchResult, x as TemplatePart, y as WCDimensions, z as WCOrderLineItem, C as WCProductAttribute, D as WCProductDefaultAttribute, H as WCShippingLine, I as WPGraphQLError, K as WooCommercePaginationHeaders } from './types-soq-mA1E.cjs';
|
|
3
|
+
|
|
4
|
+
declare function createApplicationPasswordToken(username: string, appPassword: string): string;
|
|
3
5
|
|
|
4
6
|
declare function resolveBaseUrl(config: NextWordpressConfig): string;
|
|
5
7
|
|
|
8
|
+
declare function authenticateJwt(config: NextWordpressConfig, credentials: JwtAuthCredentials): Promise<JwtAuthResponse>;
|
|
9
|
+
declare function validateJwtToken(config: NextWordpressConfig, token: string): Promise<boolean>;
|
|
10
|
+
|
|
11
|
+
declare function createWooCommerceFetcher(config: WooCommerceConfig): {
|
|
12
|
+
wcFetch: <T>(path: string, query?: Record<string, unknown>, tags?: string[], options?: RequestInit) => Promise<T>;
|
|
13
|
+
wcFetchGraceful: <T>(path: string, fallback: T, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
|
|
14
|
+
wcFetchPaginated: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<WooCommerceResponse<T[]>>;
|
|
15
|
+
wcFetchPaginatedGraceful: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<WooCommerceResponse<T[]>>;
|
|
16
|
+
wcMutate: <T>(path: string, body: unknown, method?: "POST" | "PUT" | "PATCH" | "DELETE") => Promise<T>;
|
|
17
|
+
};
|
|
18
|
+
type WooCommerceFetcher = ReturnType<typeof createWooCommerceFetcher>;
|
|
19
|
+
|
|
6
20
|
declare function createFetcher(config: NextWordpressConfig): {
|
|
7
21
|
wpFetch: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
|
|
8
22
|
wpFetchGraceful: <T>(path: string, fallback: T, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
|
|
@@ -112,6 +126,22 @@ interface CreateCommentInput {
|
|
|
112
126
|
parent?: number;
|
|
113
127
|
}
|
|
114
128
|
|
|
129
|
+
type CF7SubmissionStatus = 'mail_sent' | 'mail_failed' | 'validation_failed' | 'spam' | 'aborted';
|
|
130
|
+
interface CF7ValidationError {
|
|
131
|
+
field: string;
|
|
132
|
+
message: string;
|
|
133
|
+
idref: string | null;
|
|
134
|
+
}
|
|
135
|
+
interface CF7SubmissionResponse {
|
|
136
|
+
status: CF7SubmissionStatus;
|
|
137
|
+
message: string;
|
|
138
|
+
invalid_fields?: CF7ValidationError[];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
declare function createCF7Queries(config: NextWordpressConfig): {
|
|
142
|
+
submitForm: (formId: number, data: Record<string, string>) => Promise<CF7SubmissionResponse>;
|
|
143
|
+
};
|
|
144
|
+
|
|
115
145
|
type RestPostStatus = 'publish' | 'draft' | 'pending' | 'private' | 'future';
|
|
116
146
|
interface CreatePostInput {
|
|
117
147
|
title: string;
|
|
@@ -430,15 +460,6 @@ declare function createWordPressClient(config: NextWordpressConfig): {
|
|
|
430
460
|
}[]>;
|
|
431
461
|
};
|
|
432
462
|
|
|
433
|
-
declare function createWooCommerceFetcher(config: WooCommerceConfig): {
|
|
434
|
-
wcFetch: <T>(path: string, query?: Record<string, unknown>, tags?: string[], options?: RequestInit) => Promise<T>;
|
|
435
|
-
wcFetchGraceful: <T>(path: string, fallback: T, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
|
|
436
|
-
wcFetchPaginated: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<WooCommerceResponse<T[]>>;
|
|
437
|
-
wcFetchPaginatedGraceful: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<WooCommerceResponse<T[]>>;
|
|
438
|
-
wcMutate: <T>(path: string, body: unknown, method?: "POST" | "PUT" | "PATCH" | "DELETE") => Promise<T>;
|
|
439
|
-
};
|
|
440
|
-
type WooCommerceFetcher = ReturnType<typeof createWooCommerceFetcher>;
|
|
441
|
-
|
|
442
463
|
interface WCProductCategory {
|
|
443
464
|
id: number;
|
|
444
465
|
name: string;
|
|
@@ -519,110 +540,6 @@ interface CreateProductTagInput {
|
|
|
519
540
|
}
|
|
520
541
|
type UpdateProductTagInput = Partial<CreateProductTagInput>;
|
|
521
542
|
|
|
522
|
-
interface WCOrderLineItem {
|
|
523
|
-
id: number;
|
|
524
|
-
name: string;
|
|
525
|
-
product_id: number;
|
|
526
|
-
variation_id: number;
|
|
527
|
-
quantity: number;
|
|
528
|
-
sku: string;
|
|
529
|
-
price: number;
|
|
530
|
-
subtotal: string;
|
|
531
|
-
subtotal_tax: string;
|
|
532
|
-
total: string;
|
|
533
|
-
total_tax: string;
|
|
534
|
-
taxes: Array<{
|
|
535
|
-
id: number;
|
|
536
|
-
total: string;
|
|
537
|
-
subtotal: string;
|
|
538
|
-
}>;
|
|
539
|
-
meta_data: Array<{
|
|
540
|
-
id: number;
|
|
541
|
-
key: string;
|
|
542
|
-
value: unknown;
|
|
543
|
-
display_key: string;
|
|
544
|
-
display_value: string;
|
|
545
|
-
}>;
|
|
546
|
-
image: {
|
|
547
|
-
id: string;
|
|
548
|
-
src: string;
|
|
549
|
-
} | null;
|
|
550
|
-
}
|
|
551
|
-
interface WCShippingLine {
|
|
552
|
-
id: number;
|
|
553
|
-
method_title: string;
|
|
554
|
-
method_id: string;
|
|
555
|
-
instance_id: string;
|
|
556
|
-
total: string;
|
|
557
|
-
total_tax: string;
|
|
558
|
-
taxes: Array<{
|
|
559
|
-
id: number;
|
|
560
|
-
total: string;
|
|
561
|
-
}>;
|
|
562
|
-
meta_data: Array<{
|
|
563
|
-
id: number;
|
|
564
|
-
key: string;
|
|
565
|
-
value: unknown;
|
|
566
|
-
}>;
|
|
567
|
-
}
|
|
568
|
-
interface WCOrder {
|
|
569
|
-
id: number;
|
|
570
|
-
parent_id: number;
|
|
571
|
-
status: 'pending' | 'processing' | 'on-hold' | 'completed' | 'cancelled' | 'refunded' | 'failed' | 'trash';
|
|
572
|
-
currency: string;
|
|
573
|
-
date_created: string;
|
|
574
|
-
date_modified: string;
|
|
575
|
-
discount_total: string;
|
|
576
|
-
discount_tax: string;
|
|
577
|
-
shipping_total: string;
|
|
578
|
-
shipping_tax: string;
|
|
579
|
-
cart_tax: string;
|
|
580
|
-
total: string;
|
|
581
|
-
total_tax: string;
|
|
582
|
-
customer_id: number;
|
|
583
|
-
order_key: string;
|
|
584
|
-
billing: WCAddress;
|
|
585
|
-
shipping: WCAddress;
|
|
586
|
-
payment_method: string;
|
|
587
|
-
payment_method_title: string;
|
|
588
|
-
transaction_id: string;
|
|
589
|
-
customer_note: string;
|
|
590
|
-
line_items: WCOrderLineItem[];
|
|
591
|
-
shipping_lines: WCShippingLine[];
|
|
592
|
-
meta_data: Array<{
|
|
593
|
-
id: number;
|
|
594
|
-
key: string;
|
|
595
|
-
value: unknown;
|
|
596
|
-
}>;
|
|
597
|
-
}
|
|
598
|
-
interface WCCreateOrderInput {
|
|
599
|
-
status?: WCOrder['status'];
|
|
600
|
-
payment_method?: string;
|
|
601
|
-
payment_method_title?: string;
|
|
602
|
-
customer_id?: number;
|
|
603
|
-
customer_note?: string;
|
|
604
|
-
billing?: Partial<WCAddress>;
|
|
605
|
-
shipping?: Partial<WCAddress>;
|
|
606
|
-
line_items: Array<{
|
|
607
|
-
product_id: number;
|
|
608
|
-
variation_id?: number;
|
|
609
|
-
quantity: number;
|
|
610
|
-
}>;
|
|
611
|
-
coupon_lines?: Array<{
|
|
612
|
-
code: string;
|
|
613
|
-
}>;
|
|
614
|
-
shipping_lines?: Array<{
|
|
615
|
-
method_id: string;
|
|
616
|
-
method_title: string;
|
|
617
|
-
total: string;
|
|
618
|
-
}>;
|
|
619
|
-
meta_data?: Array<{
|
|
620
|
-
key: string;
|
|
621
|
-
value: unknown;
|
|
622
|
-
}>;
|
|
623
|
-
set_paid?: boolean;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
543
|
interface WCCoupon {
|
|
627
544
|
id: number;
|
|
628
545
|
code: string;
|
|
@@ -658,42 +575,6 @@ interface CreateCouponInput {
|
|
|
658
575
|
}
|
|
659
576
|
type UpdateCouponInput = Partial<CreateCouponInput>;
|
|
660
577
|
|
|
661
|
-
interface WCCustomer {
|
|
662
|
-
id: number;
|
|
663
|
-
date_created: string;
|
|
664
|
-
date_modified: string;
|
|
665
|
-
email: string;
|
|
666
|
-
first_name: string;
|
|
667
|
-
last_name: string;
|
|
668
|
-
role: string;
|
|
669
|
-
username: string;
|
|
670
|
-
billing: WCAddress;
|
|
671
|
-
shipping: Omit<WCAddress, 'email' | 'phone'>;
|
|
672
|
-
is_paying_customer: boolean;
|
|
673
|
-
avatar_url: string;
|
|
674
|
-
orders_count: number;
|
|
675
|
-
total_spent: string;
|
|
676
|
-
meta_data: Array<{
|
|
677
|
-
id: number;
|
|
678
|
-
key: string;
|
|
679
|
-
value: unknown;
|
|
680
|
-
}>;
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
interface UpdateCustomerInput {
|
|
684
|
-
email?: string;
|
|
685
|
-
first_name?: string;
|
|
686
|
-
last_name?: string;
|
|
687
|
-
username?: string;
|
|
688
|
-
password?: string;
|
|
689
|
-
billing?: Partial<WCAddress>;
|
|
690
|
-
shipping?: Partial<Omit<WCAddress, 'email' | 'phone'>>;
|
|
691
|
-
meta_data?: {
|
|
692
|
-
key: string;
|
|
693
|
-
value: unknown;
|
|
694
|
-
}[];
|
|
695
|
-
}
|
|
696
|
-
|
|
697
578
|
interface OmnibusPriceEntry {
|
|
698
579
|
price: string;
|
|
699
580
|
date: string;
|
|
@@ -1535,24 +1416,21 @@ interface RevalidationResult {
|
|
|
1535
1416
|
}
|
|
1536
1417
|
declare function createRevalidationHandler(config: RevalidationConfig, revalidateTag: (tag: string) => void): (request: Request) => Promise<Response>;
|
|
1537
1418
|
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
password: string;
|
|
1419
|
+
interface FaustConfig {
|
|
1420
|
+
wpUrl: string;
|
|
1421
|
+
secretKey: string;
|
|
1422
|
+
cookieName?: string;
|
|
1543
1423
|
}
|
|
1544
|
-
interface
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
user_display_name: string;
|
|
1424
|
+
interface FaustPreviewConfig {
|
|
1425
|
+
wpUrl: string;
|
|
1426
|
+
secretKey: string;
|
|
1427
|
+
previewPath?: string;
|
|
1549
1428
|
}
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1429
|
+
interface FaustPreviewDeps {
|
|
1430
|
+
enableDraftMode: () => Promise<void>;
|
|
1431
|
+
redirect: (url: string) => never;
|
|
1553
1432
|
}
|
|
1433
|
+
declare function createFaustAuthHandler(config: FaustConfig): (request: Request, routePath: string) => Promise<Response>;
|
|
1434
|
+
declare function createPreviewHandler(config: FaustPreviewConfig, deps: FaustPreviewDeps): (request: Request) => Promise<Response>;
|
|
1554
1435
|
|
|
1555
|
-
|
|
1556
|
-
declare function validateJwtToken(config: NextWordpressConfig, token: string): Promise<boolean>;
|
|
1557
|
-
|
|
1558
|
-
export { AuthenticationError, Author, type Category, type Comment, type CommentAuthorAvatar, type CreateAuthorInput, type CreateCategoryInput, type CreateCommentInput, type CreateCouponInput, type CreateMenuInput, type CreateMenuItemInput, type CreatePageInput, type CreatePostInput, type CreateProductCategoryInput, type CreateProductInput, type CreateProductTagInput, type CreateTagInput, FeaturedMedia, type GQLACFFieldGroup, type GQLAuthor, type GQLCPTNode, type GQLCategory, GQLConnection, type GQLCreateCommentInput, type GQLCreateCommentResult, type GQLCreatePostInput, type GQLCustomer, type GQLDeletePostResult, type GQLLineItem, type GQLMutatedComment, type GQLMutatedPost, type GQLOrder, type GQLOrderAddress, type GQLPage, type GQLPageWithSEO, GQLPost, GQLPostFilter, type GQLPostStatus, type GQLPostWithSEO, type GQLProduct, type GQLProductFilter, type GQLProductVariation, type GQLTag, type GQLUpdatePostInput, type GQLYoastSEO, type JwtAuthCredentials, type JwtAuthResponse, type Menu, type MenuItem, type MenuLocation, type MenuWithItems, NextWordpressConfig, type OmnibusPriceEntry, type OmnibusProductData, type Page, Post, RenderedContent, RenderedTitle, type RestPageStatus, type RestPostStatus, type RevalidationConfig, type RevalidationPayload, type RevalidationResult, type Tag, Taxonomy, type UpdateAuthorInput, type UpdateCategoryInput, type UpdateCommentInput, type UpdateCouponInput, type UpdateCustomerInput, type UpdateMediaInput, type UpdateMenuInput, type UpdateMenuItemInput, type UpdatePageInput, type UpdatePostInput, type UpdateProductCategoryInput, type UpdateProductInput, type UpdateProductTagInput, type UpdateTagInput, type UploadMediaInput, WCAddress, type WCCoupon, type WCCreateOrderInput, type WCCustomer, WCImage, type WCOrder, type WCOrderLineItem, WCProduct, type WCProductCategory, WCProductFilterParams, type WCProductStatus, type WCProductTag, WCProductVariation, type WCProductVariationWithOmnibus, type WCProductWithOmnibus, type WCShippingLine, WPEntity, WPGraphQLConfig, type WPGraphQLFetcher, WooCommerceConfig, type WooCommerceFetcher, WooCommerceResponse, authenticateJwt, buildACFFragment, buildPageWithACFQuery, buildPostWithACFQuery, buildPostsWithACFQuery, createApplicationPasswordToken, createAuthorsMutations, createCPTQueries, createCategoriesMutations, createCommentsMutations, createMediaMutations, createMenusMutations, createPagesMutations, createPostsMutations, createRevalidationHandler, createTagsMutations, createWPGraphQLCoreClient as createWPGraphQLClient, createWPGraphQLCoreClient, createWPGraphQLFetcher, createWPGraphQLMutationsClient, createWPGraphQLWooCommerceClient, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createWordPressMutationsClient, createYoastQueries, extractOmnibusData, resolveBaseUrl, validateJwtToken, withOmnibus, withOmnibusVariation };
|
|
1436
|
+
export { Author, type CF7SubmissionResponse, type CF7SubmissionStatus, type CF7ValidationError, type Category, type Comment, type CommentAuthorAvatar, type CreateAuthorInput, type CreateCategoryInput, type CreateCommentInput, type CreateCouponInput, type CreateMenuInput, type CreateMenuItemInput, type CreatePageInput, type CreatePostInput, type CreateProductCategoryInput, type CreateProductInput, type CreateProductTagInput, type CreateTagInput, type FaustConfig, type FaustPreviewConfig, type FaustPreviewDeps, FeaturedMedia, type GQLACFFieldGroup, type GQLAuthor, type GQLCPTNode, type GQLCategory, GQLConnection, type GQLCreateCommentInput, type GQLCreateCommentResult, type GQLCreatePostInput, type GQLCustomer, type GQLDeletePostResult, type GQLLineItem, type GQLMutatedComment, type GQLMutatedPost, type GQLOrder, type GQLOrderAddress, type GQLPage, type GQLPageWithSEO, GQLPost, GQLPostFilter, type GQLPostStatus, type GQLPostWithSEO, type GQLProduct, type GQLProductFilter, type GQLProductVariation, type GQLTag, type GQLUpdatePostInput, type GQLYoastSEO, JwtAuthCredentials, JwtAuthResponse, type Menu, type MenuItem, type MenuLocation, type MenuWithItems, NextWordpressConfig, type OmnibusPriceEntry, type OmnibusProductData, type Page, Post, RenderedContent, RenderedTitle, type RestPageStatus, type RestPostStatus, type RevalidationConfig, type RevalidationPayload, type RevalidationResult, type Tag, Taxonomy, type UpdateAuthorInput, type UpdateCategoryInput, type UpdateCommentInput, type UpdateCouponInput, UpdateCustomerInput, type UpdateMediaInput, type UpdateMenuInput, type UpdateMenuItemInput, type UpdatePageInput, type UpdatePostInput, type UpdateProductCategoryInput, type UpdateProductInput, type UpdateProductTagInput, type UpdateTagInput, type UploadMediaInput, WCAddress, type WCCoupon, WCCreateOrderInput, WCCustomer, WCImage, WCOrder, WCProduct, type WCProductCategory, WCProductFilterParams, type WCProductStatus, type WCProductTag, WCProductVariation, type WCProductVariationWithOmnibus, type WCProductWithOmnibus, WPEntity, WPGraphQLConfig, type WPGraphQLFetcher, WooCommerceConfig, type WooCommerceFetcher, WooCommerceResponse, authenticateJwt, buildACFFragment, buildPageWithACFQuery, buildPostWithACFQuery, buildPostsWithACFQuery, createApplicationPasswordToken, createAuthorsMutations, createCF7Queries, createCPTQueries, createCategoriesMutations, createCommentsMutations, createFaustAuthHandler, createMediaMutations, createMenusMutations, createPagesMutations, createPostsMutations, createPreviewHandler, createRevalidationHandler, createTagsMutations, createWPGraphQLCoreClient as createWPGraphQLClient, createWPGraphQLCoreClient, createWPGraphQLFetcher, createWPGraphQLMutationsClient, createWPGraphQLWooCommerceClient, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createWordPressMutationsClient, createYoastQueries, extractOmnibusData, resolveBaseUrl, validateJwtToken, withOmnibus, withOmnibusVariation };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
import { N as NextWordpressConfig, W as WordPressResponse, T as Taxonomy,
|
|
2
|
-
export { B as BlockType, E as EditorBlock,
|
|
1
|
+
import { N as NextWordpressConfig, J as JwtAuthCredentials, k as JwtAuthResponse, a as WooCommerceConfig, d as WooCommerceResponse, W as WordPressResponse, T as Taxonomy, l as WPEntity, R as RenderedTitle, m as RenderedContent, P as Post, A as Author, F as FeaturedMedia, n as WCImage, o as WCProductVariation, b as WCProduct, g as WCCustomer, p as WCAddress, U as UpdateCustomerInput, e as WCCreateOrderInput, f as WCOrder, c as WCProductFilterParams, h as WPGraphQLConfig, j as GQLConnection, i as GQLPostFilter, G as GQLPost } from './types-soq-mA1E.js';
|
|
2
|
+
export { q as AuthenticationError, B as BlockType, E as EditorBlock, r as EmbeddedAuthor, s as EmbeddedTerm, t as GQLError, u as GQLPageInfo, M as MediaDetails, v as MediaSize, w as PostEmbedded, S as SearchResult, x as TemplatePart, y as WCDimensions, z as WCOrderLineItem, C as WCProductAttribute, D as WCProductDefaultAttribute, H as WCShippingLine, I as WPGraphQLError, K as WooCommercePaginationHeaders } from './types-soq-mA1E.js';
|
|
3
|
+
|
|
4
|
+
declare function createApplicationPasswordToken(username: string, appPassword: string): string;
|
|
3
5
|
|
|
4
6
|
declare function resolveBaseUrl(config: NextWordpressConfig): string;
|
|
5
7
|
|
|
8
|
+
declare function authenticateJwt(config: NextWordpressConfig, credentials: JwtAuthCredentials): Promise<JwtAuthResponse>;
|
|
9
|
+
declare function validateJwtToken(config: NextWordpressConfig, token: string): Promise<boolean>;
|
|
10
|
+
|
|
11
|
+
declare function createWooCommerceFetcher(config: WooCommerceConfig): {
|
|
12
|
+
wcFetch: <T>(path: string, query?: Record<string, unknown>, tags?: string[], options?: RequestInit) => Promise<T>;
|
|
13
|
+
wcFetchGraceful: <T>(path: string, fallback: T, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
|
|
14
|
+
wcFetchPaginated: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<WooCommerceResponse<T[]>>;
|
|
15
|
+
wcFetchPaginatedGraceful: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<WooCommerceResponse<T[]>>;
|
|
16
|
+
wcMutate: <T>(path: string, body: unknown, method?: "POST" | "PUT" | "PATCH" | "DELETE") => Promise<T>;
|
|
17
|
+
};
|
|
18
|
+
type WooCommerceFetcher = ReturnType<typeof createWooCommerceFetcher>;
|
|
19
|
+
|
|
6
20
|
declare function createFetcher(config: NextWordpressConfig): {
|
|
7
21
|
wpFetch: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
|
|
8
22
|
wpFetchGraceful: <T>(path: string, fallback: T, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
|
|
@@ -112,6 +126,22 @@ interface CreateCommentInput {
|
|
|
112
126
|
parent?: number;
|
|
113
127
|
}
|
|
114
128
|
|
|
129
|
+
type CF7SubmissionStatus = 'mail_sent' | 'mail_failed' | 'validation_failed' | 'spam' | 'aborted';
|
|
130
|
+
interface CF7ValidationError {
|
|
131
|
+
field: string;
|
|
132
|
+
message: string;
|
|
133
|
+
idref: string | null;
|
|
134
|
+
}
|
|
135
|
+
interface CF7SubmissionResponse {
|
|
136
|
+
status: CF7SubmissionStatus;
|
|
137
|
+
message: string;
|
|
138
|
+
invalid_fields?: CF7ValidationError[];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
declare function createCF7Queries(config: NextWordpressConfig): {
|
|
142
|
+
submitForm: (formId: number, data: Record<string, string>) => Promise<CF7SubmissionResponse>;
|
|
143
|
+
};
|
|
144
|
+
|
|
115
145
|
type RestPostStatus = 'publish' | 'draft' | 'pending' | 'private' | 'future';
|
|
116
146
|
interface CreatePostInput {
|
|
117
147
|
title: string;
|
|
@@ -430,15 +460,6 @@ declare function createWordPressClient(config: NextWordpressConfig): {
|
|
|
430
460
|
}[]>;
|
|
431
461
|
};
|
|
432
462
|
|
|
433
|
-
declare function createWooCommerceFetcher(config: WooCommerceConfig): {
|
|
434
|
-
wcFetch: <T>(path: string, query?: Record<string, unknown>, tags?: string[], options?: RequestInit) => Promise<T>;
|
|
435
|
-
wcFetchGraceful: <T>(path: string, fallback: T, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
|
|
436
|
-
wcFetchPaginated: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<WooCommerceResponse<T[]>>;
|
|
437
|
-
wcFetchPaginatedGraceful: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<WooCommerceResponse<T[]>>;
|
|
438
|
-
wcMutate: <T>(path: string, body: unknown, method?: "POST" | "PUT" | "PATCH" | "DELETE") => Promise<T>;
|
|
439
|
-
};
|
|
440
|
-
type WooCommerceFetcher = ReturnType<typeof createWooCommerceFetcher>;
|
|
441
|
-
|
|
442
463
|
interface WCProductCategory {
|
|
443
464
|
id: number;
|
|
444
465
|
name: string;
|
|
@@ -519,110 +540,6 @@ interface CreateProductTagInput {
|
|
|
519
540
|
}
|
|
520
541
|
type UpdateProductTagInput = Partial<CreateProductTagInput>;
|
|
521
542
|
|
|
522
|
-
interface WCOrderLineItem {
|
|
523
|
-
id: number;
|
|
524
|
-
name: string;
|
|
525
|
-
product_id: number;
|
|
526
|
-
variation_id: number;
|
|
527
|
-
quantity: number;
|
|
528
|
-
sku: string;
|
|
529
|
-
price: number;
|
|
530
|
-
subtotal: string;
|
|
531
|
-
subtotal_tax: string;
|
|
532
|
-
total: string;
|
|
533
|
-
total_tax: string;
|
|
534
|
-
taxes: Array<{
|
|
535
|
-
id: number;
|
|
536
|
-
total: string;
|
|
537
|
-
subtotal: string;
|
|
538
|
-
}>;
|
|
539
|
-
meta_data: Array<{
|
|
540
|
-
id: number;
|
|
541
|
-
key: string;
|
|
542
|
-
value: unknown;
|
|
543
|
-
display_key: string;
|
|
544
|
-
display_value: string;
|
|
545
|
-
}>;
|
|
546
|
-
image: {
|
|
547
|
-
id: string;
|
|
548
|
-
src: string;
|
|
549
|
-
} | null;
|
|
550
|
-
}
|
|
551
|
-
interface WCShippingLine {
|
|
552
|
-
id: number;
|
|
553
|
-
method_title: string;
|
|
554
|
-
method_id: string;
|
|
555
|
-
instance_id: string;
|
|
556
|
-
total: string;
|
|
557
|
-
total_tax: string;
|
|
558
|
-
taxes: Array<{
|
|
559
|
-
id: number;
|
|
560
|
-
total: string;
|
|
561
|
-
}>;
|
|
562
|
-
meta_data: Array<{
|
|
563
|
-
id: number;
|
|
564
|
-
key: string;
|
|
565
|
-
value: unknown;
|
|
566
|
-
}>;
|
|
567
|
-
}
|
|
568
|
-
interface WCOrder {
|
|
569
|
-
id: number;
|
|
570
|
-
parent_id: number;
|
|
571
|
-
status: 'pending' | 'processing' | 'on-hold' | 'completed' | 'cancelled' | 'refunded' | 'failed' | 'trash';
|
|
572
|
-
currency: string;
|
|
573
|
-
date_created: string;
|
|
574
|
-
date_modified: string;
|
|
575
|
-
discount_total: string;
|
|
576
|
-
discount_tax: string;
|
|
577
|
-
shipping_total: string;
|
|
578
|
-
shipping_tax: string;
|
|
579
|
-
cart_tax: string;
|
|
580
|
-
total: string;
|
|
581
|
-
total_tax: string;
|
|
582
|
-
customer_id: number;
|
|
583
|
-
order_key: string;
|
|
584
|
-
billing: WCAddress;
|
|
585
|
-
shipping: WCAddress;
|
|
586
|
-
payment_method: string;
|
|
587
|
-
payment_method_title: string;
|
|
588
|
-
transaction_id: string;
|
|
589
|
-
customer_note: string;
|
|
590
|
-
line_items: WCOrderLineItem[];
|
|
591
|
-
shipping_lines: WCShippingLine[];
|
|
592
|
-
meta_data: Array<{
|
|
593
|
-
id: number;
|
|
594
|
-
key: string;
|
|
595
|
-
value: unknown;
|
|
596
|
-
}>;
|
|
597
|
-
}
|
|
598
|
-
interface WCCreateOrderInput {
|
|
599
|
-
status?: WCOrder['status'];
|
|
600
|
-
payment_method?: string;
|
|
601
|
-
payment_method_title?: string;
|
|
602
|
-
customer_id?: number;
|
|
603
|
-
customer_note?: string;
|
|
604
|
-
billing?: Partial<WCAddress>;
|
|
605
|
-
shipping?: Partial<WCAddress>;
|
|
606
|
-
line_items: Array<{
|
|
607
|
-
product_id: number;
|
|
608
|
-
variation_id?: number;
|
|
609
|
-
quantity: number;
|
|
610
|
-
}>;
|
|
611
|
-
coupon_lines?: Array<{
|
|
612
|
-
code: string;
|
|
613
|
-
}>;
|
|
614
|
-
shipping_lines?: Array<{
|
|
615
|
-
method_id: string;
|
|
616
|
-
method_title: string;
|
|
617
|
-
total: string;
|
|
618
|
-
}>;
|
|
619
|
-
meta_data?: Array<{
|
|
620
|
-
key: string;
|
|
621
|
-
value: unknown;
|
|
622
|
-
}>;
|
|
623
|
-
set_paid?: boolean;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
543
|
interface WCCoupon {
|
|
627
544
|
id: number;
|
|
628
545
|
code: string;
|
|
@@ -658,42 +575,6 @@ interface CreateCouponInput {
|
|
|
658
575
|
}
|
|
659
576
|
type UpdateCouponInput = Partial<CreateCouponInput>;
|
|
660
577
|
|
|
661
|
-
interface WCCustomer {
|
|
662
|
-
id: number;
|
|
663
|
-
date_created: string;
|
|
664
|
-
date_modified: string;
|
|
665
|
-
email: string;
|
|
666
|
-
first_name: string;
|
|
667
|
-
last_name: string;
|
|
668
|
-
role: string;
|
|
669
|
-
username: string;
|
|
670
|
-
billing: WCAddress;
|
|
671
|
-
shipping: Omit<WCAddress, 'email' | 'phone'>;
|
|
672
|
-
is_paying_customer: boolean;
|
|
673
|
-
avatar_url: string;
|
|
674
|
-
orders_count: number;
|
|
675
|
-
total_spent: string;
|
|
676
|
-
meta_data: Array<{
|
|
677
|
-
id: number;
|
|
678
|
-
key: string;
|
|
679
|
-
value: unknown;
|
|
680
|
-
}>;
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
interface UpdateCustomerInput {
|
|
684
|
-
email?: string;
|
|
685
|
-
first_name?: string;
|
|
686
|
-
last_name?: string;
|
|
687
|
-
username?: string;
|
|
688
|
-
password?: string;
|
|
689
|
-
billing?: Partial<WCAddress>;
|
|
690
|
-
shipping?: Partial<Omit<WCAddress, 'email' | 'phone'>>;
|
|
691
|
-
meta_data?: {
|
|
692
|
-
key: string;
|
|
693
|
-
value: unknown;
|
|
694
|
-
}[];
|
|
695
|
-
}
|
|
696
|
-
|
|
697
578
|
interface OmnibusPriceEntry {
|
|
698
579
|
price: string;
|
|
699
580
|
date: string;
|
|
@@ -1535,24 +1416,21 @@ interface RevalidationResult {
|
|
|
1535
1416
|
}
|
|
1536
1417
|
declare function createRevalidationHandler(config: RevalidationConfig, revalidateTag: (tag: string) => void): (request: Request) => Promise<Response>;
|
|
1537
1418
|
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
password: string;
|
|
1419
|
+
interface FaustConfig {
|
|
1420
|
+
wpUrl: string;
|
|
1421
|
+
secretKey: string;
|
|
1422
|
+
cookieName?: string;
|
|
1543
1423
|
}
|
|
1544
|
-
interface
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
user_display_name: string;
|
|
1424
|
+
interface FaustPreviewConfig {
|
|
1425
|
+
wpUrl: string;
|
|
1426
|
+
secretKey: string;
|
|
1427
|
+
previewPath?: string;
|
|
1549
1428
|
}
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1429
|
+
interface FaustPreviewDeps {
|
|
1430
|
+
enableDraftMode: () => Promise<void>;
|
|
1431
|
+
redirect: (url: string) => never;
|
|
1553
1432
|
}
|
|
1433
|
+
declare function createFaustAuthHandler(config: FaustConfig): (request: Request, routePath: string) => Promise<Response>;
|
|
1434
|
+
declare function createPreviewHandler(config: FaustPreviewConfig, deps: FaustPreviewDeps): (request: Request) => Promise<Response>;
|
|
1554
1435
|
|
|
1555
|
-
|
|
1556
|
-
declare function validateJwtToken(config: NextWordpressConfig, token: string): Promise<boolean>;
|
|
1557
|
-
|
|
1558
|
-
export { AuthenticationError, Author, type Category, type Comment, type CommentAuthorAvatar, type CreateAuthorInput, type CreateCategoryInput, type CreateCommentInput, type CreateCouponInput, type CreateMenuInput, type CreateMenuItemInput, type CreatePageInput, type CreatePostInput, type CreateProductCategoryInput, type CreateProductInput, type CreateProductTagInput, type CreateTagInput, FeaturedMedia, type GQLACFFieldGroup, type GQLAuthor, type GQLCPTNode, type GQLCategory, GQLConnection, type GQLCreateCommentInput, type GQLCreateCommentResult, type GQLCreatePostInput, type GQLCustomer, type GQLDeletePostResult, type GQLLineItem, type GQLMutatedComment, type GQLMutatedPost, type GQLOrder, type GQLOrderAddress, type GQLPage, type GQLPageWithSEO, GQLPost, GQLPostFilter, type GQLPostStatus, type GQLPostWithSEO, type GQLProduct, type GQLProductFilter, type GQLProductVariation, type GQLTag, type GQLUpdatePostInput, type GQLYoastSEO, type JwtAuthCredentials, type JwtAuthResponse, type Menu, type MenuItem, type MenuLocation, type MenuWithItems, NextWordpressConfig, type OmnibusPriceEntry, type OmnibusProductData, type Page, Post, RenderedContent, RenderedTitle, type RestPageStatus, type RestPostStatus, type RevalidationConfig, type RevalidationPayload, type RevalidationResult, type Tag, Taxonomy, type UpdateAuthorInput, type UpdateCategoryInput, type UpdateCommentInput, type UpdateCouponInput, type UpdateCustomerInput, type UpdateMediaInput, type UpdateMenuInput, type UpdateMenuItemInput, type UpdatePageInput, type UpdatePostInput, type UpdateProductCategoryInput, type UpdateProductInput, type UpdateProductTagInput, type UpdateTagInput, type UploadMediaInput, WCAddress, type WCCoupon, type WCCreateOrderInput, type WCCustomer, WCImage, type WCOrder, type WCOrderLineItem, WCProduct, type WCProductCategory, WCProductFilterParams, type WCProductStatus, type WCProductTag, WCProductVariation, type WCProductVariationWithOmnibus, type WCProductWithOmnibus, type WCShippingLine, WPEntity, WPGraphQLConfig, type WPGraphQLFetcher, WooCommerceConfig, type WooCommerceFetcher, WooCommerceResponse, authenticateJwt, buildACFFragment, buildPageWithACFQuery, buildPostWithACFQuery, buildPostsWithACFQuery, createApplicationPasswordToken, createAuthorsMutations, createCPTQueries, createCategoriesMutations, createCommentsMutations, createMediaMutations, createMenusMutations, createPagesMutations, createPostsMutations, createRevalidationHandler, createTagsMutations, createWPGraphQLCoreClient as createWPGraphQLClient, createWPGraphQLCoreClient, createWPGraphQLFetcher, createWPGraphQLMutationsClient, createWPGraphQLWooCommerceClient, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createWordPressMutationsClient, createYoastQueries, extractOmnibusData, resolveBaseUrl, validateJwtToken, withOmnibus, withOmnibusVariation };
|
|
1436
|
+
export { Author, type CF7SubmissionResponse, type CF7SubmissionStatus, type CF7ValidationError, type Category, type Comment, type CommentAuthorAvatar, type CreateAuthorInput, type CreateCategoryInput, type CreateCommentInput, type CreateCouponInput, type CreateMenuInput, type CreateMenuItemInput, type CreatePageInput, type CreatePostInput, type CreateProductCategoryInput, type CreateProductInput, type CreateProductTagInput, type CreateTagInput, type FaustConfig, type FaustPreviewConfig, type FaustPreviewDeps, FeaturedMedia, type GQLACFFieldGroup, type GQLAuthor, type GQLCPTNode, type GQLCategory, GQLConnection, type GQLCreateCommentInput, type GQLCreateCommentResult, type GQLCreatePostInput, type GQLCustomer, type GQLDeletePostResult, type GQLLineItem, type GQLMutatedComment, type GQLMutatedPost, type GQLOrder, type GQLOrderAddress, type GQLPage, type GQLPageWithSEO, GQLPost, GQLPostFilter, type GQLPostStatus, type GQLPostWithSEO, type GQLProduct, type GQLProductFilter, type GQLProductVariation, type GQLTag, type GQLUpdatePostInput, type GQLYoastSEO, JwtAuthCredentials, JwtAuthResponse, type Menu, type MenuItem, type MenuLocation, type MenuWithItems, NextWordpressConfig, type OmnibusPriceEntry, type OmnibusProductData, type Page, Post, RenderedContent, RenderedTitle, type RestPageStatus, type RestPostStatus, type RevalidationConfig, type RevalidationPayload, type RevalidationResult, type Tag, Taxonomy, type UpdateAuthorInput, type UpdateCategoryInput, type UpdateCommentInput, type UpdateCouponInput, UpdateCustomerInput, type UpdateMediaInput, type UpdateMenuInput, type UpdateMenuItemInput, type UpdatePageInput, type UpdatePostInput, type UpdateProductCategoryInput, type UpdateProductInput, type UpdateProductTagInput, type UpdateTagInput, type UploadMediaInput, WCAddress, type WCCoupon, WCCreateOrderInput, WCCustomer, WCImage, WCOrder, WCProduct, type WCProductCategory, WCProductFilterParams, type WCProductStatus, type WCProductTag, WCProductVariation, type WCProductVariationWithOmnibus, type WCProductWithOmnibus, WPEntity, WPGraphQLConfig, type WPGraphQLFetcher, WooCommerceConfig, type WooCommerceFetcher, WooCommerceResponse, authenticateJwt, buildACFFragment, buildPageWithACFQuery, buildPostWithACFQuery, buildPostsWithACFQuery, createApplicationPasswordToken, createAuthorsMutations, createCF7Queries, createCPTQueries, createCategoriesMutations, createCommentsMutations, createFaustAuthHandler, createMediaMutations, createMenusMutations, createPagesMutations, createPostsMutations, createPreviewHandler, createRevalidationHandler, createTagsMutations, createWPGraphQLCoreClient as createWPGraphQLClient, createWPGraphQLCoreClient, createWPGraphQLFetcher, createWPGraphQLMutationsClient, createWPGraphQLWooCommerceClient, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createWordPressMutationsClient, createYoastQueries, extractOmnibusData, resolveBaseUrl, validateJwtToken, withOmnibus, withOmnibusVariation };
|