@szymonpiatek/nextwordpress 0.0.5 → 0.0.7
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 +373 -12
- 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 +367 -13
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +737 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +549 -130
- package/dist/index.d.ts +549 -130
- package/dist/index.js +737 -5
- package/dist/index.js.map +1 -1
- package/dist/{types-EjYH-eZp.d.cts → types-Be60n09c.d.cts} +159 -1
- package/dist/{types-EjYH-eZp.d.ts → types-Be60n09c.d.ts} +159 -1
- package/package.json +1 -1
|
@@ -3,6 +3,8 @@ interface NextWordpressConfig {
|
|
|
3
3
|
serverURL: string;
|
|
4
4
|
/** Used in browser / client components (e.g., public domain). */
|
|
5
5
|
clientURL: string;
|
|
6
|
+
/** Cache TTL in seconds for Next.js ISR revalidation (default: 300). */
|
|
7
|
+
cacheTTL?: number;
|
|
6
8
|
}
|
|
7
9
|
interface WPEntity {
|
|
8
10
|
id: number;
|
|
@@ -34,6 +36,21 @@ interface Taxonomy {
|
|
|
34
36
|
meta: Record<string, unknown>;
|
|
35
37
|
}
|
|
36
38
|
|
|
39
|
+
interface JwtAuthCredentials {
|
|
40
|
+
username: string;
|
|
41
|
+
password: string;
|
|
42
|
+
}
|
|
43
|
+
interface JwtAuthResponse {
|
|
44
|
+
token: string;
|
|
45
|
+
user_email: string;
|
|
46
|
+
user_nicename: string;
|
|
47
|
+
user_display_name: string;
|
|
48
|
+
}
|
|
49
|
+
declare class AuthenticationError extends Error {
|
|
50
|
+
status: number;
|
|
51
|
+
constructor(message: string, status: number);
|
|
52
|
+
}
|
|
53
|
+
|
|
37
54
|
interface MediaSize {
|
|
38
55
|
file: string;
|
|
39
56
|
width: number;
|
|
@@ -205,6 +222,7 @@ interface WordPressResponse<T> {
|
|
|
205
222
|
|
|
206
223
|
interface WooCommerceConfig {
|
|
207
224
|
serverURL: string;
|
|
225
|
+
clientURL?: string;
|
|
208
226
|
consumerKey: string;
|
|
209
227
|
consumerSecret: string;
|
|
210
228
|
cacheTTL?: number;
|
|
@@ -363,6 +381,146 @@ interface WCProductFilterParams {
|
|
|
363
381
|
type?: WCProduct['type'];
|
|
364
382
|
}
|
|
365
383
|
|
|
384
|
+
interface WCOrderLineItem {
|
|
385
|
+
id: number;
|
|
386
|
+
name: string;
|
|
387
|
+
product_id: number;
|
|
388
|
+
variation_id: number;
|
|
389
|
+
quantity: number;
|
|
390
|
+
sku: string;
|
|
391
|
+
price: number;
|
|
392
|
+
subtotal: string;
|
|
393
|
+
subtotal_tax: string;
|
|
394
|
+
total: string;
|
|
395
|
+
total_tax: string;
|
|
396
|
+
taxes: Array<{
|
|
397
|
+
id: number;
|
|
398
|
+
total: string;
|
|
399
|
+
subtotal: string;
|
|
400
|
+
}>;
|
|
401
|
+
meta_data: Array<{
|
|
402
|
+
id: number;
|
|
403
|
+
key: string;
|
|
404
|
+
value: unknown;
|
|
405
|
+
display_key: string;
|
|
406
|
+
display_value: string;
|
|
407
|
+
}>;
|
|
408
|
+
image: {
|
|
409
|
+
id: string;
|
|
410
|
+
src: string;
|
|
411
|
+
} | null;
|
|
412
|
+
}
|
|
413
|
+
interface WCShippingLine {
|
|
414
|
+
id: number;
|
|
415
|
+
method_title: string;
|
|
416
|
+
method_id: string;
|
|
417
|
+
instance_id: string;
|
|
418
|
+
total: string;
|
|
419
|
+
total_tax: string;
|
|
420
|
+
taxes: Array<{
|
|
421
|
+
id: number;
|
|
422
|
+
total: string;
|
|
423
|
+
}>;
|
|
424
|
+
meta_data: Array<{
|
|
425
|
+
id: number;
|
|
426
|
+
key: string;
|
|
427
|
+
value: unknown;
|
|
428
|
+
}>;
|
|
429
|
+
}
|
|
430
|
+
interface WCOrder {
|
|
431
|
+
id: number;
|
|
432
|
+
parent_id: number;
|
|
433
|
+
status: 'pending' | 'processing' | 'on-hold' | 'completed' | 'cancelled' | 'refunded' | 'failed' | 'trash';
|
|
434
|
+
currency: string;
|
|
435
|
+
date_created: string;
|
|
436
|
+
date_modified: string;
|
|
437
|
+
discount_total: string;
|
|
438
|
+
discount_tax: string;
|
|
439
|
+
shipping_total: string;
|
|
440
|
+
shipping_tax: string;
|
|
441
|
+
cart_tax: string;
|
|
442
|
+
total: string;
|
|
443
|
+
total_tax: string;
|
|
444
|
+
customer_id: number;
|
|
445
|
+
order_key: string;
|
|
446
|
+
billing: WCAddress;
|
|
447
|
+
shipping: WCAddress;
|
|
448
|
+
payment_method: string;
|
|
449
|
+
payment_method_title: string;
|
|
450
|
+
transaction_id: string;
|
|
451
|
+
customer_note: string;
|
|
452
|
+
line_items: WCOrderLineItem[];
|
|
453
|
+
shipping_lines: WCShippingLine[];
|
|
454
|
+
meta_data: Array<{
|
|
455
|
+
id: number;
|
|
456
|
+
key: string;
|
|
457
|
+
value: unknown;
|
|
458
|
+
}>;
|
|
459
|
+
}
|
|
460
|
+
interface WCCreateOrderInput {
|
|
461
|
+
status?: WCOrder['status'];
|
|
462
|
+
payment_method?: string;
|
|
463
|
+
payment_method_title?: string;
|
|
464
|
+
customer_id?: number;
|
|
465
|
+
customer_note?: string;
|
|
466
|
+
billing?: Partial<WCAddress>;
|
|
467
|
+
shipping?: Partial<WCAddress>;
|
|
468
|
+
line_items: Array<{
|
|
469
|
+
product_id: number;
|
|
470
|
+
variation_id?: number;
|
|
471
|
+
quantity: number;
|
|
472
|
+
}>;
|
|
473
|
+
coupon_lines?: Array<{
|
|
474
|
+
code: string;
|
|
475
|
+
}>;
|
|
476
|
+
shipping_lines?: Array<{
|
|
477
|
+
method_id: string;
|
|
478
|
+
method_title: string;
|
|
479
|
+
total: string;
|
|
480
|
+
}>;
|
|
481
|
+
meta_data?: Array<{
|
|
482
|
+
key: string;
|
|
483
|
+
value: unknown;
|
|
484
|
+
}>;
|
|
485
|
+
set_paid?: boolean;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
interface WCCustomer {
|
|
489
|
+
id: number;
|
|
490
|
+
date_created: string;
|
|
491
|
+
date_modified: string;
|
|
492
|
+
email: string;
|
|
493
|
+
first_name: string;
|
|
494
|
+
last_name: string;
|
|
495
|
+
role: string;
|
|
496
|
+
username: string;
|
|
497
|
+
billing: WCAddress;
|
|
498
|
+
shipping: Omit<WCAddress, 'email' | 'phone'>;
|
|
499
|
+
is_paying_customer: boolean;
|
|
500
|
+
avatar_url: string;
|
|
501
|
+
orders_count: number;
|
|
502
|
+
total_spent: string;
|
|
503
|
+
meta_data: Array<{
|
|
504
|
+
id: number;
|
|
505
|
+
key: string;
|
|
506
|
+
value: unknown;
|
|
507
|
+
}>;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
interface UpdateCustomerInput {
|
|
511
|
+
email?: string;
|
|
512
|
+
first_name?: string;
|
|
513
|
+
last_name?: string;
|
|
514
|
+
username?: string;
|
|
515
|
+
password?: string;
|
|
516
|
+
billing?: Partial<WCAddress>;
|
|
517
|
+
shipping?: Partial<Omit<WCAddress, 'email' | 'phone'>>;
|
|
518
|
+
meta_data?: {
|
|
519
|
+
key: string;
|
|
520
|
+
value: unknown;
|
|
521
|
+
}[];
|
|
522
|
+
}
|
|
523
|
+
|
|
366
524
|
type WPGraphQLConfig = NextWordpressConfig;
|
|
367
525
|
interface GQLPageInfo {
|
|
368
526
|
hasNextPage: boolean;
|
|
@@ -443,4 +601,4 @@ interface GQLPost {
|
|
|
443
601
|
};
|
|
444
602
|
}
|
|
445
603
|
|
|
446
|
-
export { type Author as A, type BlockType as B, type EditorBlock as E, type FeaturedMedia as F, type GQLPost as G, type MediaDetails as M, type NextWordpressConfig as N, type Post as P, type RenderedTitle as R, type SearchResult as S, type Taxonomy as T, type WordPressResponse as W, type WooCommerceConfig as a, type WCProduct as b, type WCProductFilterParams as c, type WooCommerceResponse as d, type
|
|
604
|
+
export { type Author as A, type BlockType as B, type WCProductAttribute as C, type WCProductDefaultAttribute as D, type EditorBlock as E, type FeaturedMedia as F, type GQLPost as G, type WCShippingLine as H, WPGraphQLError as I, type JwtAuthCredentials as J, type WooCommercePaginationHeaders as K, type MediaDetails as M, type NextWordpressConfig as N, type Post as P, type RenderedTitle as R, type SearchResult as S, type Taxonomy as T, type UpdateCustomerInput as U, type WordPressResponse as W, type WooCommerceConfig as a, type WCProduct as b, type WCProductFilterParams as c, type WooCommerceResponse as d, type WCCreateOrderInput as e, type WCOrder as f, type WCCustomer as g, type WPGraphQLConfig as h, type GQLPostFilter as i, type GQLConnection as j, type JwtAuthResponse as k, type WPEntity as l, type RenderedContent as m, type WCImage as n, type WCProductVariation as o, type WCAddress as p, AuthenticationError as q, type EmbeddedAuthor as r, type EmbeddedTerm as s, type GQLError as t, type GQLPageInfo as u, type MediaSize as v, type PostEmbedded as w, type TemplatePart as x, type WCDimensions as y, type WCOrderLineItem as z };
|
|
@@ -3,6 +3,8 @@ interface NextWordpressConfig {
|
|
|
3
3
|
serverURL: string;
|
|
4
4
|
/** Used in browser / client components (e.g., public domain). */
|
|
5
5
|
clientURL: string;
|
|
6
|
+
/** Cache TTL in seconds for Next.js ISR revalidation (default: 300). */
|
|
7
|
+
cacheTTL?: number;
|
|
6
8
|
}
|
|
7
9
|
interface WPEntity {
|
|
8
10
|
id: number;
|
|
@@ -34,6 +36,21 @@ interface Taxonomy {
|
|
|
34
36
|
meta: Record<string, unknown>;
|
|
35
37
|
}
|
|
36
38
|
|
|
39
|
+
interface JwtAuthCredentials {
|
|
40
|
+
username: string;
|
|
41
|
+
password: string;
|
|
42
|
+
}
|
|
43
|
+
interface JwtAuthResponse {
|
|
44
|
+
token: string;
|
|
45
|
+
user_email: string;
|
|
46
|
+
user_nicename: string;
|
|
47
|
+
user_display_name: string;
|
|
48
|
+
}
|
|
49
|
+
declare class AuthenticationError extends Error {
|
|
50
|
+
status: number;
|
|
51
|
+
constructor(message: string, status: number);
|
|
52
|
+
}
|
|
53
|
+
|
|
37
54
|
interface MediaSize {
|
|
38
55
|
file: string;
|
|
39
56
|
width: number;
|
|
@@ -205,6 +222,7 @@ interface WordPressResponse<T> {
|
|
|
205
222
|
|
|
206
223
|
interface WooCommerceConfig {
|
|
207
224
|
serverURL: string;
|
|
225
|
+
clientURL?: string;
|
|
208
226
|
consumerKey: string;
|
|
209
227
|
consumerSecret: string;
|
|
210
228
|
cacheTTL?: number;
|
|
@@ -363,6 +381,146 @@ interface WCProductFilterParams {
|
|
|
363
381
|
type?: WCProduct['type'];
|
|
364
382
|
}
|
|
365
383
|
|
|
384
|
+
interface WCOrderLineItem {
|
|
385
|
+
id: number;
|
|
386
|
+
name: string;
|
|
387
|
+
product_id: number;
|
|
388
|
+
variation_id: number;
|
|
389
|
+
quantity: number;
|
|
390
|
+
sku: string;
|
|
391
|
+
price: number;
|
|
392
|
+
subtotal: string;
|
|
393
|
+
subtotal_tax: string;
|
|
394
|
+
total: string;
|
|
395
|
+
total_tax: string;
|
|
396
|
+
taxes: Array<{
|
|
397
|
+
id: number;
|
|
398
|
+
total: string;
|
|
399
|
+
subtotal: string;
|
|
400
|
+
}>;
|
|
401
|
+
meta_data: Array<{
|
|
402
|
+
id: number;
|
|
403
|
+
key: string;
|
|
404
|
+
value: unknown;
|
|
405
|
+
display_key: string;
|
|
406
|
+
display_value: string;
|
|
407
|
+
}>;
|
|
408
|
+
image: {
|
|
409
|
+
id: string;
|
|
410
|
+
src: string;
|
|
411
|
+
} | null;
|
|
412
|
+
}
|
|
413
|
+
interface WCShippingLine {
|
|
414
|
+
id: number;
|
|
415
|
+
method_title: string;
|
|
416
|
+
method_id: string;
|
|
417
|
+
instance_id: string;
|
|
418
|
+
total: string;
|
|
419
|
+
total_tax: string;
|
|
420
|
+
taxes: Array<{
|
|
421
|
+
id: number;
|
|
422
|
+
total: string;
|
|
423
|
+
}>;
|
|
424
|
+
meta_data: Array<{
|
|
425
|
+
id: number;
|
|
426
|
+
key: string;
|
|
427
|
+
value: unknown;
|
|
428
|
+
}>;
|
|
429
|
+
}
|
|
430
|
+
interface WCOrder {
|
|
431
|
+
id: number;
|
|
432
|
+
parent_id: number;
|
|
433
|
+
status: 'pending' | 'processing' | 'on-hold' | 'completed' | 'cancelled' | 'refunded' | 'failed' | 'trash';
|
|
434
|
+
currency: string;
|
|
435
|
+
date_created: string;
|
|
436
|
+
date_modified: string;
|
|
437
|
+
discount_total: string;
|
|
438
|
+
discount_tax: string;
|
|
439
|
+
shipping_total: string;
|
|
440
|
+
shipping_tax: string;
|
|
441
|
+
cart_tax: string;
|
|
442
|
+
total: string;
|
|
443
|
+
total_tax: string;
|
|
444
|
+
customer_id: number;
|
|
445
|
+
order_key: string;
|
|
446
|
+
billing: WCAddress;
|
|
447
|
+
shipping: WCAddress;
|
|
448
|
+
payment_method: string;
|
|
449
|
+
payment_method_title: string;
|
|
450
|
+
transaction_id: string;
|
|
451
|
+
customer_note: string;
|
|
452
|
+
line_items: WCOrderLineItem[];
|
|
453
|
+
shipping_lines: WCShippingLine[];
|
|
454
|
+
meta_data: Array<{
|
|
455
|
+
id: number;
|
|
456
|
+
key: string;
|
|
457
|
+
value: unknown;
|
|
458
|
+
}>;
|
|
459
|
+
}
|
|
460
|
+
interface WCCreateOrderInput {
|
|
461
|
+
status?: WCOrder['status'];
|
|
462
|
+
payment_method?: string;
|
|
463
|
+
payment_method_title?: string;
|
|
464
|
+
customer_id?: number;
|
|
465
|
+
customer_note?: string;
|
|
466
|
+
billing?: Partial<WCAddress>;
|
|
467
|
+
shipping?: Partial<WCAddress>;
|
|
468
|
+
line_items: Array<{
|
|
469
|
+
product_id: number;
|
|
470
|
+
variation_id?: number;
|
|
471
|
+
quantity: number;
|
|
472
|
+
}>;
|
|
473
|
+
coupon_lines?: Array<{
|
|
474
|
+
code: string;
|
|
475
|
+
}>;
|
|
476
|
+
shipping_lines?: Array<{
|
|
477
|
+
method_id: string;
|
|
478
|
+
method_title: string;
|
|
479
|
+
total: string;
|
|
480
|
+
}>;
|
|
481
|
+
meta_data?: Array<{
|
|
482
|
+
key: string;
|
|
483
|
+
value: unknown;
|
|
484
|
+
}>;
|
|
485
|
+
set_paid?: boolean;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
interface WCCustomer {
|
|
489
|
+
id: number;
|
|
490
|
+
date_created: string;
|
|
491
|
+
date_modified: string;
|
|
492
|
+
email: string;
|
|
493
|
+
first_name: string;
|
|
494
|
+
last_name: string;
|
|
495
|
+
role: string;
|
|
496
|
+
username: string;
|
|
497
|
+
billing: WCAddress;
|
|
498
|
+
shipping: Omit<WCAddress, 'email' | 'phone'>;
|
|
499
|
+
is_paying_customer: boolean;
|
|
500
|
+
avatar_url: string;
|
|
501
|
+
orders_count: number;
|
|
502
|
+
total_spent: string;
|
|
503
|
+
meta_data: Array<{
|
|
504
|
+
id: number;
|
|
505
|
+
key: string;
|
|
506
|
+
value: unknown;
|
|
507
|
+
}>;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
interface UpdateCustomerInput {
|
|
511
|
+
email?: string;
|
|
512
|
+
first_name?: string;
|
|
513
|
+
last_name?: string;
|
|
514
|
+
username?: string;
|
|
515
|
+
password?: string;
|
|
516
|
+
billing?: Partial<WCAddress>;
|
|
517
|
+
shipping?: Partial<Omit<WCAddress, 'email' | 'phone'>>;
|
|
518
|
+
meta_data?: {
|
|
519
|
+
key: string;
|
|
520
|
+
value: unknown;
|
|
521
|
+
}[];
|
|
522
|
+
}
|
|
523
|
+
|
|
366
524
|
type WPGraphQLConfig = NextWordpressConfig;
|
|
367
525
|
interface GQLPageInfo {
|
|
368
526
|
hasNextPage: boolean;
|
|
@@ -443,4 +601,4 @@ interface GQLPost {
|
|
|
443
601
|
};
|
|
444
602
|
}
|
|
445
603
|
|
|
446
|
-
export { type Author as A, type BlockType as B, type EditorBlock as E, type FeaturedMedia as F, type GQLPost as G, type MediaDetails as M, type NextWordpressConfig as N, type Post as P, type RenderedTitle as R, type SearchResult as S, type Taxonomy as T, type WordPressResponse as W, type WooCommerceConfig as a, type WCProduct as b, type WCProductFilterParams as c, type WooCommerceResponse as d, type
|
|
604
|
+
export { type Author as A, type BlockType as B, type WCProductAttribute as C, type WCProductDefaultAttribute as D, type EditorBlock as E, type FeaturedMedia as F, type GQLPost as G, type WCShippingLine as H, WPGraphQLError as I, type JwtAuthCredentials as J, type WooCommercePaginationHeaders as K, type MediaDetails as M, type NextWordpressConfig as N, type Post as P, type RenderedTitle as R, type SearchResult as S, type Taxonomy as T, type UpdateCustomerInput as U, type WordPressResponse as W, type WooCommerceConfig as a, type WCProduct as b, type WCProductFilterParams as c, type WooCommerceResponse as d, type WCCreateOrderInput as e, type WCOrder as f, type WCCustomer as g, type WPGraphQLConfig as h, type GQLPostFilter as i, type GQLConnection as j, type JwtAuthResponse as k, type WPEntity as l, type RenderedContent as m, type WCImage as n, type WCProductVariation as o, type WCAddress as p, AuthenticationError as q, type EmbeddedAuthor as r, type EmbeddedTerm as s, type GQLError as t, type GQLPageInfo as u, type MediaSize as v, type PostEmbedded as w, type TemplatePart as x, type WCDimensions as y, type WCOrderLineItem as z };
|