@kizlo/woocommerce 0.3.0 → 0.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.
package/dist/index.d.ts CHANGED
@@ -1,12 +1,18 @@
1
1
  import * as kizlo0 from "kizlo";
2
+ import { WP_CustomFields } from "kizlo";
2
3
  import { z } from "zod/v4";
3
4
 
5
+ //#region src/product/types.d.ts
6
+
7
+ /** The exact resolved custom-field shape configured for products on this WordPress site. */
8
+ type ProductCustomFields = WP_CustomFields<"postTypes.product">;
9
+ //#endregion
4
10
  //#region src/product/schema.d.ts
5
11
  declare const SWATCH_TYPES: readonly ["text", "color", "image"];
6
12
  declare const SwatchType: z.ZodEnum<{
7
13
  text: "text";
8
- image: "image";
9
14
  color: "color";
15
+ image: "image";
10
16
  }>;
11
17
  type SwatchType = z.infer<typeof SwatchType>;
12
18
  declare const PRODUCT_TYPES: readonly ["simple", "grouped", "external", "variable", "variation"];
@@ -552,6 +558,7 @@ declare const ProductRecommendations: z.ZodObject<{
552
558
  }, z.core.$strip>>;
553
559
  }, z.core.$strip>;
554
560
  type ProductRecommendations = z.infer<typeof ProductRecommendations>;
561
+ declare const ProductCustomFieldsSchema: z.ZodType<ProductCustomFields, ProductCustomFields>;
555
562
  declare const Product: z.ZodObject<{
556
563
  id: z.ZodNumber;
557
564
  name: z.ZodString;
@@ -722,7 +729,7 @@ declare const Product: z.ZodObject<{
722
729
  "@graph": z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
723
730
  }, z.core.$strip>;
724
731
  }, z.core.$strip>>;
725
- custom: z.ZodCustom<never, never>;
732
+ custom: z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>;
726
733
  recommendations: z.ZodNullable<z.ZodObject<{
727
734
  upsells: z.ZodArray<z.ZodObject<{
728
735
  id: z.ZodNumber;
@@ -1050,7 +1057,9 @@ declare const Product: z.ZodObject<{
1050
1057
  }, z.core.$strip>>;
1051
1058
  }, z.core.$strip>>;
1052
1059
  }, z.core.$strip>;
1053
- type Product = z.infer<typeof Product>;
1060
+ type Product = Omit<z.infer<typeof Product>, "custom"> & {
1061
+ custom: ProductCustomFields;
1062
+ };
1054
1063
  declare const ProductList: z.ZodObject<{
1055
1064
  items: z.ZodArray<z.ZodObject<{
1056
1065
  id: z.ZodNumber;
@@ -1222,7 +1231,7 @@ declare const ProductList: z.ZodObject<{
1222
1231
  "@graph": z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1223
1232
  }, z.core.$strip>;
1224
1233
  }, z.core.$strip>>;
1225
- custom: z.ZodCustom<never, never>;
1234
+ custom: z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>;
1226
1235
  recommendations: z.ZodNullable<z.ZodObject<{
1227
1236
  upsells: z.ZodArray<z.ZodObject<{
1228
1237
  id: z.ZodNumber;
@@ -1560,7 +1569,9 @@ declare const ProductList: z.ZodObject<{
1560
1569
  hasPrevPage: z.ZodBoolean;
1561
1570
  }, z.core.$strip>;
1562
1571
  }, z.core.$strip>;
1563
- type ProductList = z.infer<typeof ProductList>;
1572
+ type ProductList = Omit<z.infer<typeof ProductList>, "items"> & {
1573
+ items: Product[];
1574
+ };
1564
1575
  declare const RetrieveProductInput: z.ZodObject<{
1565
1576
  identifier: z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodString]>;
1566
1577
  previewToken: z.ZodOptional<z.ZodString>;
@@ -1812,8 +1823,8 @@ declare const ProductFiltersAttributeTerm: z.ZodObject<{
1812
1823
  count: z.ZodNumber;
1813
1824
  type: z.ZodEnum<{
1814
1825
  text: "text";
1815
- image: "image";
1816
1826
  color: "color";
1827
+ image: "image";
1817
1828
  }>;
1818
1829
  swatch: z.ZodNullable<z.ZodString>;
1819
1830
  }, z.core.$strip>;
@@ -1845,8 +1856,8 @@ declare const ProductFilters: z.ZodObject<{
1845
1856
  count: z.ZodNumber;
1846
1857
  type: z.ZodEnum<{
1847
1858
  text: "text";
1848
- image: "image";
1849
1859
  color: "color";
1860
+ image: "image";
1850
1861
  }>;
1851
1862
  swatch: z.ZodNullable<z.ZodString>;
1852
1863
  }, z.core.$strip>>;
@@ -3295,511 +3306,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
3295
3306
  previewToken?: string | undefined;
3296
3307
  recommendations?: string | boolean | undefined;
3297
3308
  } | undefined;
3298
- }, {
3299
- id: number;
3300
- name: string;
3301
- slug: string;
3302
- parentId: number | null;
3303
- type: string;
3304
- variationDescription: string;
3305
- url: string | null;
3306
- sku: string | null;
3307
- shortDescription: string;
3308
- description: string;
3309
- isPasswordProtected: boolean;
3310
- isOnSale: boolean;
3311
- prices: {
3312
- price: number;
3313
- regularPrice: number;
3314
- salePrice: number | null;
3315
- priceRange: {
3316
- minAmount: number;
3317
- maxAmount: number;
3318
- } | null;
3319
- };
3320
- currencyFormat: {
3321
- currencyCode: string;
3322
- currencySymbol: string;
3323
- currencyPrefix: string;
3324
- currencySuffix: string;
3325
- currencyMinorUnit: number;
3326
- currencyDecimalSeparator: string;
3327
- currencyThousandSeparator: string;
3328
- };
3329
- priceHtml: string;
3330
- averageRating: number;
3331
- reviewCount: number;
3332
- images: {
3333
- id: number;
3334
- name: string;
3335
- src: string;
3336
- type: "image";
3337
- alt: string;
3338
- mime?: string | undefined;
3339
- width?: number | undefined;
3340
- height?: number | undefined;
3341
- variants?: {
3342
- src: string;
3343
- width: number;
3344
- height: number;
3345
- }[] | undefined;
3346
- srcset?: string | undefined;
3347
- }[];
3348
- categories: {
3349
- id: number;
3350
- name: string;
3351
- slug: string;
3352
- url: string | null;
3353
- }[];
3354
- tags: {
3355
- id: number;
3356
- name: string;
3357
- slug: string;
3358
- url: string | null;
3359
- }[];
3360
- brands: {
3361
- id: number;
3362
- name: string;
3363
- slug: string;
3364
- url: string | null;
3365
- }[];
3366
- attributes: {
3367
- id: number;
3368
- name: string;
3369
- taxonomy: string | null;
3370
- hasVariations: boolean;
3371
- terms: {
3372
- id: number;
3373
- name: string;
3374
- slug: string;
3375
- isDefault: boolean;
3376
- }[];
3377
- }[];
3378
- variations: {
3379
- id: number;
3380
- attributes: {
3381
- name: string;
3382
- value: string | null;
3383
- }[];
3384
- }[];
3385
- groupedProductIds: number[];
3386
- hasOptions: boolean;
3387
- isPurchasable: boolean;
3388
- isInStock: boolean;
3389
- isOnBackorder: boolean;
3390
- stockAvailability: {
3391
- text: string;
3392
- class: string;
3393
- };
3394
- lowStockRemaining: number | null;
3395
- isSoldIndividually: boolean;
3396
- addToCart: {
3397
- text: string;
3398
- description: string;
3399
- singleText: string;
3400
- minimum: number;
3401
- maximum: number;
3402
- multipleOf: number;
3403
- };
3404
- extensions: {
3405
- [x: string]: unknown;
3406
- };
3407
- weight: string;
3408
- dimensions: {
3409
- length: string;
3410
- width: string;
3411
- height: string;
3412
- };
3413
- formattedWeight: string;
3414
- formattedDimensions: string;
3415
- stockQuantity: number | null;
3416
- saleStartsAt: number | null;
3417
- saleEndsAt: number | null;
3418
- seo: {
3419
- head: {
3420
- title: string;
3421
- canonical: string;
3422
- robots: {
3423
- index: string;
3424
- follow: string;
3425
- maxSnippet: string;
3426
- maxImagePreview: string;
3427
- maxVideoPreview: string;
3428
- };
3429
- og: {
3430
- locale: string;
3431
- type: string;
3432
- title: string;
3433
- url: string;
3434
- siteName: string;
3435
- description: string;
3436
- image: {
3437
- url: string;
3438
- width: number | null;
3439
- height: number | null;
3440
- type: string | null;
3441
- alt: string | null;
3442
- } | null;
3443
- };
3444
- twitter: {
3445
- card: "summary" | "summary_large_image";
3446
- title: string;
3447
- site: string | null;
3448
- creator: string | null;
3449
- description: string;
3450
- image: string | null;
3451
- imageAlt: string | null;
3452
- };
3453
- article: {
3454
- publishedTime: string;
3455
- modifiedTime: string;
3456
- author: string;
3457
- authorUrl: string;
3458
- section: string;
3459
- tags: string[];
3460
- } | null;
3461
- };
3462
- schema: {
3463
- "@context": "https://schema.org";
3464
- "@graph": {
3465
- [x: string]: unknown;
3466
- }[];
3467
- };
3468
- } | null;
3469
- custom: never;
3470
- recommendations: {
3471
- upsells: {
3472
- id: number;
3473
- name: string;
3474
- slug: string;
3475
- parentId: number | null;
3476
- type: string;
3477
- variationDescription: string;
3478
- url: string | null;
3479
- sku: string | null;
3480
- shortDescription: string;
3481
- description: string;
3482
- isPasswordProtected: boolean;
3483
- isOnSale: boolean;
3484
- prices: {
3485
- price: number;
3486
- regularPrice: number;
3487
- salePrice: number | null;
3488
- priceRange: {
3489
- minAmount: number;
3490
- maxAmount: number;
3491
- } | null;
3492
- };
3493
- currencyFormat: {
3494
- currencyCode: string;
3495
- currencySymbol: string;
3496
- currencyPrefix: string;
3497
- currencySuffix: string;
3498
- currencyMinorUnit: number;
3499
- currencyDecimalSeparator: string;
3500
- currencyThousandSeparator: string;
3501
- };
3502
- priceHtml: string;
3503
- averageRating: number;
3504
- reviewCount: number;
3505
- images: {
3506
- id: number;
3507
- name: string;
3508
- src: string;
3509
- type: "image";
3510
- alt: string;
3511
- mime?: string | undefined;
3512
- width?: number | undefined;
3513
- height?: number | undefined;
3514
- variants?: {
3515
- src: string;
3516
- width: number;
3517
- height: number;
3518
- }[] | undefined;
3519
- srcset?: string | undefined;
3520
- }[];
3521
- categories: {
3522
- id: number;
3523
- name: string;
3524
- slug: string;
3525
- url: string | null;
3526
- }[];
3527
- tags: {
3528
- id: number;
3529
- name: string;
3530
- slug: string;
3531
- url: string | null;
3532
- }[];
3533
- brands: {
3534
- id: number;
3535
- name: string;
3536
- slug: string;
3537
- url: string | null;
3538
- }[];
3539
- attributes: {
3540
- id: number;
3541
- name: string;
3542
- taxonomy: string | null;
3543
- hasVariations: boolean;
3544
- terms: {
3545
- id: number;
3546
- name: string;
3547
- slug: string;
3548
- isDefault: boolean;
3549
- }[];
3550
- }[];
3551
- variations: {
3552
- id: number;
3553
- attributes: {
3554
- name: string;
3555
- value: string | null;
3556
- }[];
3557
- }[];
3558
- groupedProductIds: number[];
3559
- hasOptions: boolean;
3560
- isPurchasable: boolean;
3561
- isInStock: boolean;
3562
- isOnBackorder: boolean;
3563
- stockAvailability: {
3564
- text: string;
3565
- class: string;
3566
- };
3567
- lowStockRemaining: number | null;
3568
- isSoldIndividually: boolean;
3569
- addToCart: {
3570
- text: string;
3571
- description: string;
3572
- singleText: string;
3573
- minimum: number;
3574
- maximum: number;
3575
- multipleOf: number;
3576
- };
3577
- extensions: {
3578
- [x: string]: unknown;
3579
- };
3580
- }[];
3581
- crossSells: {
3582
- id: number;
3583
- name: string;
3584
- slug: string;
3585
- parentId: number | null;
3586
- type: string;
3587
- variationDescription: string;
3588
- url: string | null;
3589
- sku: string | null;
3590
- shortDescription: string;
3591
- description: string;
3592
- isPasswordProtected: boolean;
3593
- isOnSale: boolean;
3594
- prices: {
3595
- price: number;
3596
- regularPrice: number;
3597
- salePrice: number | null;
3598
- priceRange: {
3599
- minAmount: number;
3600
- maxAmount: number;
3601
- } | null;
3602
- };
3603
- currencyFormat: {
3604
- currencyCode: string;
3605
- currencySymbol: string;
3606
- currencyPrefix: string;
3607
- currencySuffix: string;
3608
- currencyMinorUnit: number;
3609
- currencyDecimalSeparator: string;
3610
- currencyThousandSeparator: string;
3611
- };
3612
- priceHtml: string;
3613
- averageRating: number;
3614
- reviewCount: number;
3615
- images: {
3616
- id: number;
3617
- name: string;
3618
- src: string;
3619
- type: "image";
3620
- alt: string;
3621
- mime?: string | undefined;
3622
- width?: number | undefined;
3623
- height?: number | undefined;
3624
- variants?: {
3625
- src: string;
3626
- width: number;
3627
- height: number;
3628
- }[] | undefined;
3629
- srcset?: string | undefined;
3630
- }[];
3631
- categories: {
3632
- id: number;
3633
- name: string;
3634
- slug: string;
3635
- url: string | null;
3636
- }[];
3637
- tags: {
3638
- id: number;
3639
- name: string;
3640
- slug: string;
3641
- url: string | null;
3642
- }[];
3643
- brands: {
3644
- id: number;
3645
- name: string;
3646
- slug: string;
3647
- url: string | null;
3648
- }[];
3649
- attributes: {
3650
- id: number;
3651
- name: string;
3652
- taxonomy: string | null;
3653
- hasVariations: boolean;
3654
- terms: {
3655
- id: number;
3656
- name: string;
3657
- slug: string;
3658
- isDefault: boolean;
3659
- }[];
3660
- }[];
3661
- variations: {
3662
- id: number;
3663
- attributes: {
3664
- name: string;
3665
- value: string | null;
3666
- }[];
3667
- }[];
3668
- groupedProductIds: number[];
3669
- hasOptions: boolean;
3670
- isPurchasable: boolean;
3671
- isInStock: boolean;
3672
- isOnBackorder: boolean;
3673
- stockAvailability: {
3674
- text: string;
3675
- class: string;
3676
- };
3677
- lowStockRemaining: number | null;
3678
- isSoldIndividually: boolean;
3679
- addToCart: {
3680
- text: string;
3681
- description: string;
3682
- singleText: string;
3683
- minimum: number;
3684
- maximum: number;
3685
- multipleOf: number;
3686
- };
3687
- extensions: {
3688
- [x: string]: unknown;
3689
- };
3690
- }[];
3691
- related: {
3692
- id: number;
3693
- name: string;
3694
- slug: string;
3695
- parentId: number | null;
3696
- type: string;
3697
- variationDescription: string;
3698
- url: string | null;
3699
- sku: string | null;
3700
- shortDescription: string;
3701
- description: string;
3702
- isPasswordProtected: boolean;
3703
- isOnSale: boolean;
3704
- prices: {
3705
- price: number;
3706
- regularPrice: number;
3707
- salePrice: number | null;
3708
- priceRange: {
3709
- minAmount: number;
3710
- maxAmount: number;
3711
- } | null;
3712
- };
3713
- currencyFormat: {
3714
- currencyCode: string;
3715
- currencySymbol: string;
3716
- currencyPrefix: string;
3717
- currencySuffix: string;
3718
- currencyMinorUnit: number;
3719
- currencyDecimalSeparator: string;
3720
- currencyThousandSeparator: string;
3721
- };
3722
- priceHtml: string;
3723
- averageRating: number;
3724
- reviewCount: number;
3725
- images: {
3726
- id: number;
3727
- name: string;
3728
- src: string;
3729
- type: "image";
3730
- alt: string;
3731
- mime?: string | undefined;
3732
- width?: number | undefined;
3733
- height?: number | undefined;
3734
- variants?: {
3735
- src: string;
3736
- width: number;
3737
- height: number;
3738
- }[] | undefined;
3739
- srcset?: string | undefined;
3740
- }[];
3741
- categories: {
3742
- id: number;
3743
- name: string;
3744
- slug: string;
3745
- url: string | null;
3746
- }[];
3747
- tags: {
3748
- id: number;
3749
- name: string;
3750
- slug: string;
3751
- url: string | null;
3752
- }[];
3753
- brands: {
3754
- id: number;
3755
- name: string;
3756
- slug: string;
3757
- url: string | null;
3758
- }[];
3759
- attributes: {
3760
- id: number;
3761
- name: string;
3762
- taxonomy: string | null;
3763
- hasVariations: boolean;
3764
- terms: {
3765
- id: number;
3766
- name: string;
3767
- slug: string;
3768
- isDefault: boolean;
3769
- }[];
3770
- }[];
3771
- variations: {
3772
- id: number;
3773
- attributes: {
3774
- name: string;
3775
- value: string | null;
3776
- }[];
3777
- }[];
3778
- groupedProductIds: number[];
3779
- hasOptions: boolean;
3780
- isPurchasable: boolean;
3781
- isInStock: boolean;
3782
- isOnBackorder: boolean;
3783
- stockAvailability: {
3784
- text: string;
3785
- class: string;
3786
- };
3787
- lowStockRemaining: number | null;
3788
- isSoldIndividually: boolean;
3789
- addToCart: {
3790
- text: string;
3791
- description: string;
3792
- singleText: string;
3793
- minimum: number;
3794
- maximum: number;
3795
- multipleOf: number;
3796
- };
3797
- extensions: {
3798
- [x: string]: unknown;
3799
- };
3800
- }[];
3801
- } | null;
3802
- }, {
3309
+ }, Product, {
3803
3310
  readonly PRODUCT_NOT_FOUND: {
3804
3311
  readonly status: 404;
3805
3312
  readonly message: "Product not found.";
@@ -3852,522 +3359,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
3852
3359
  operator?: "in" | "not_in" | "and" | undefined;
3853
3360
  }[] | undefined;
3854
3361
  } | undefined;
3855
- }, {
3856
- items: {
3857
- id: number;
3858
- name: string;
3859
- slug: string;
3860
- parentId: number | null;
3861
- type: string;
3862
- variationDescription: string;
3863
- url: string | null;
3864
- sku: string | null;
3865
- shortDescription: string;
3866
- description: string;
3867
- isPasswordProtected: boolean;
3868
- isOnSale: boolean;
3869
- prices: {
3870
- price: number;
3871
- regularPrice: number;
3872
- salePrice: number | null;
3873
- priceRange: {
3874
- minAmount: number;
3875
- maxAmount: number;
3876
- } | null;
3877
- };
3878
- currencyFormat: {
3879
- currencyCode: string;
3880
- currencySymbol: string;
3881
- currencyPrefix: string;
3882
- currencySuffix: string;
3883
- currencyMinorUnit: number;
3884
- currencyDecimalSeparator: string;
3885
- currencyThousandSeparator: string;
3886
- };
3887
- priceHtml: string;
3888
- averageRating: number;
3889
- reviewCount: number;
3890
- images: {
3891
- id: number;
3892
- name: string;
3893
- src: string;
3894
- type: "image";
3895
- alt: string;
3896
- mime?: string | undefined;
3897
- width?: number | undefined;
3898
- height?: number | undefined;
3899
- variants?: {
3900
- src: string;
3901
- width: number;
3902
- height: number;
3903
- }[] | undefined;
3904
- srcset?: string | undefined;
3905
- }[];
3906
- categories: {
3907
- id: number;
3908
- name: string;
3909
- slug: string;
3910
- url: string | null;
3911
- }[];
3912
- tags: {
3913
- id: number;
3914
- name: string;
3915
- slug: string;
3916
- url: string | null;
3917
- }[];
3918
- brands: {
3919
- id: number;
3920
- name: string;
3921
- slug: string;
3922
- url: string | null;
3923
- }[];
3924
- attributes: {
3925
- id: number;
3926
- name: string;
3927
- taxonomy: string | null;
3928
- hasVariations: boolean;
3929
- terms: {
3930
- id: number;
3931
- name: string;
3932
- slug: string;
3933
- isDefault: boolean;
3934
- }[];
3935
- }[];
3936
- variations: {
3937
- id: number;
3938
- attributes: {
3939
- name: string;
3940
- value: string | null;
3941
- }[];
3942
- }[];
3943
- groupedProductIds: number[];
3944
- hasOptions: boolean;
3945
- isPurchasable: boolean;
3946
- isInStock: boolean;
3947
- isOnBackorder: boolean;
3948
- stockAvailability: {
3949
- text: string;
3950
- class: string;
3951
- };
3952
- lowStockRemaining: number | null;
3953
- isSoldIndividually: boolean;
3954
- addToCart: {
3955
- text: string;
3956
- description: string;
3957
- singleText: string;
3958
- minimum: number;
3959
- maximum: number;
3960
- multipleOf: number;
3961
- };
3962
- extensions: {
3963
- [x: string]: unknown;
3964
- };
3965
- weight: string;
3966
- dimensions: {
3967
- length: string;
3968
- width: string;
3969
- height: string;
3970
- };
3971
- formattedWeight: string;
3972
- formattedDimensions: string;
3973
- stockQuantity: number | null;
3974
- saleStartsAt: number | null;
3975
- saleEndsAt: number | null;
3976
- seo: {
3977
- head: {
3978
- title: string;
3979
- canonical: string;
3980
- robots: {
3981
- index: string;
3982
- follow: string;
3983
- maxSnippet: string;
3984
- maxImagePreview: string;
3985
- maxVideoPreview: string;
3986
- };
3987
- og: {
3988
- locale: string;
3989
- type: string;
3990
- title: string;
3991
- url: string;
3992
- siteName: string;
3993
- description: string;
3994
- image: {
3995
- url: string;
3996
- width: number | null;
3997
- height: number | null;
3998
- type: string | null;
3999
- alt: string | null;
4000
- } | null;
4001
- };
4002
- twitter: {
4003
- card: "summary" | "summary_large_image";
4004
- title: string;
4005
- site: string | null;
4006
- creator: string | null;
4007
- description: string;
4008
- image: string | null;
4009
- imageAlt: string | null;
4010
- };
4011
- article: {
4012
- publishedTime: string;
4013
- modifiedTime: string;
4014
- author: string;
4015
- authorUrl: string;
4016
- section: string;
4017
- tags: string[];
4018
- } | null;
4019
- };
4020
- schema: {
4021
- "@context": "https://schema.org";
4022
- "@graph": {
4023
- [x: string]: unknown;
4024
- }[];
4025
- };
4026
- } | null;
4027
- custom: never;
4028
- recommendations: {
4029
- upsells: {
4030
- id: number;
4031
- name: string;
4032
- slug: string;
4033
- parentId: number | null;
4034
- type: string;
4035
- variationDescription: string;
4036
- url: string | null;
4037
- sku: string | null;
4038
- shortDescription: string;
4039
- description: string;
4040
- isPasswordProtected: boolean;
4041
- isOnSale: boolean;
4042
- prices: {
4043
- price: number;
4044
- regularPrice: number;
4045
- salePrice: number | null;
4046
- priceRange: {
4047
- minAmount: number;
4048
- maxAmount: number;
4049
- } | null;
4050
- };
4051
- currencyFormat: {
4052
- currencyCode: string;
4053
- currencySymbol: string;
4054
- currencyPrefix: string;
4055
- currencySuffix: string;
4056
- currencyMinorUnit: number;
4057
- currencyDecimalSeparator: string;
4058
- currencyThousandSeparator: string;
4059
- };
4060
- priceHtml: string;
4061
- averageRating: number;
4062
- reviewCount: number;
4063
- images: {
4064
- id: number;
4065
- name: string;
4066
- src: string;
4067
- type: "image";
4068
- alt: string;
4069
- mime?: string | undefined;
4070
- width?: number | undefined;
4071
- height?: number | undefined;
4072
- variants?: {
4073
- src: string;
4074
- width: number;
4075
- height: number;
4076
- }[] | undefined;
4077
- srcset?: string | undefined;
4078
- }[];
4079
- categories: {
4080
- id: number;
4081
- name: string;
4082
- slug: string;
4083
- url: string | null;
4084
- }[];
4085
- tags: {
4086
- id: number;
4087
- name: string;
4088
- slug: string;
4089
- url: string | null;
4090
- }[];
4091
- brands: {
4092
- id: number;
4093
- name: string;
4094
- slug: string;
4095
- url: string | null;
4096
- }[];
4097
- attributes: {
4098
- id: number;
4099
- name: string;
4100
- taxonomy: string | null;
4101
- hasVariations: boolean;
4102
- terms: {
4103
- id: number;
4104
- name: string;
4105
- slug: string;
4106
- isDefault: boolean;
4107
- }[];
4108
- }[];
4109
- variations: {
4110
- id: number;
4111
- attributes: {
4112
- name: string;
4113
- value: string | null;
4114
- }[];
4115
- }[];
4116
- groupedProductIds: number[];
4117
- hasOptions: boolean;
4118
- isPurchasable: boolean;
4119
- isInStock: boolean;
4120
- isOnBackorder: boolean;
4121
- stockAvailability: {
4122
- text: string;
4123
- class: string;
4124
- };
4125
- lowStockRemaining: number | null;
4126
- isSoldIndividually: boolean;
4127
- addToCart: {
4128
- text: string;
4129
- description: string;
4130
- singleText: string;
4131
- minimum: number;
4132
- maximum: number;
4133
- multipleOf: number;
4134
- };
4135
- extensions: {
4136
- [x: string]: unknown;
4137
- };
4138
- }[];
4139
- crossSells: {
4140
- id: number;
4141
- name: string;
4142
- slug: string;
4143
- parentId: number | null;
4144
- type: string;
4145
- variationDescription: string;
4146
- url: string | null;
4147
- sku: string | null;
4148
- shortDescription: string;
4149
- description: string;
4150
- isPasswordProtected: boolean;
4151
- isOnSale: boolean;
4152
- prices: {
4153
- price: number;
4154
- regularPrice: number;
4155
- salePrice: number | null;
4156
- priceRange: {
4157
- minAmount: number;
4158
- maxAmount: number;
4159
- } | null;
4160
- };
4161
- currencyFormat: {
4162
- currencyCode: string;
4163
- currencySymbol: string;
4164
- currencyPrefix: string;
4165
- currencySuffix: string;
4166
- currencyMinorUnit: number;
4167
- currencyDecimalSeparator: string;
4168
- currencyThousandSeparator: string;
4169
- };
4170
- priceHtml: string;
4171
- averageRating: number;
4172
- reviewCount: number;
4173
- images: {
4174
- id: number;
4175
- name: string;
4176
- src: string;
4177
- type: "image";
4178
- alt: string;
4179
- mime?: string | undefined;
4180
- width?: number | undefined;
4181
- height?: number | undefined;
4182
- variants?: {
4183
- src: string;
4184
- width: number;
4185
- height: number;
4186
- }[] | undefined;
4187
- srcset?: string | undefined;
4188
- }[];
4189
- categories: {
4190
- id: number;
4191
- name: string;
4192
- slug: string;
4193
- url: string | null;
4194
- }[];
4195
- tags: {
4196
- id: number;
4197
- name: string;
4198
- slug: string;
4199
- url: string | null;
4200
- }[];
4201
- brands: {
4202
- id: number;
4203
- name: string;
4204
- slug: string;
4205
- url: string | null;
4206
- }[];
4207
- attributes: {
4208
- id: number;
4209
- name: string;
4210
- taxonomy: string | null;
4211
- hasVariations: boolean;
4212
- terms: {
4213
- id: number;
4214
- name: string;
4215
- slug: string;
4216
- isDefault: boolean;
4217
- }[];
4218
- }[];
4219
- variations: {
4220
- id: number;
4221
- attributes: {
4222
- name: string;
4223
- value: string | null;
4224
- }[];
4225
- }[];
4226
- groupedProductIds: number[];
4227
- hasOptions: boolean;
4228
- isPurchasable: boolean;
4229
- isInStock: boolean;
4230
- isOnBackorder: boolean;
4231
- stockAvailability: {
4232
- text: string;
4233
- class: string;
4234
- };
4235
- lowStockRemaining: number | null;
4236
- isSoldIndividually: boolean;
4237
- addToCart: {
4238
- text: string;
4239
- description: string;
4240
- singleText: string;
4241
- minimum: number;
4242
- maximum: number;
4243
- multipleOf: number;
4244
- };
4245
- extensions: {
4246
- [x: string]: unknown;
4247
- };
4248
- }[];
4249
- related: {
4250
- id: number;
4251
- name: string;
4252
- slug: string;
4253
- parentId: number | null;
4254
- type: string;
4255
- variationDescription: string;
4256
- url: string | null;
4257
- sku: string | null;
4258
- shortDescription: string;
4259
- description: string;
4260
- isPasswordProtected: boolean;
4261
- isOnSale: boolean;
4262
- prices: {
4263
- price: number;
4264
- regularPrice: number;
4265
- salePrice: number | null;
4266
- priceRange: {
4267
- minAmount: number;
4268
- maxAmount: number;
4269
- } | null;
4270
- };
4271
- currencyFormat: {
4272
- currencyCode: string;
4273
- currencySymbol: string;
4274
- currencyPrefix: string;
4275
- currencySuffix: string;
4276
- currencyMinorUnit: number;
4277
- currencyDecimalSeparator: string;
4278
- currencyThousandSeparator: string;
4279
- };
4280
- priceHtml: string;
4281
- averageRating: number;
4282
- reviewCount: number;
4283
- images: {
4284
- id: number;
4285
- name: string;
4286
- src: string;
4287
- type: "image";
4288
- alt: string;
4289
- mime?: string | undefined;
4290
- width?: number | undefined;
4291
- height?: number | undefined;
4292
- variants?: {
4293
- src: string;
4294
- width: number;
4295
- height: number;
4296
- }[] | undefined;
4297
- srcset?: string | undefined;
4298
- }[];
4299
- categories: {
4300
- id: number;
4301
- name: string;
4302
- slug: string;
4303
- url: string | null;
4304
- }[];
4305
- tags: {
4306
- id: number;
4307
- name: string;
4308
- slug: string;
4309
- url: string | null;
4310
- }[];
4311
- brands: {
4312
- id: number;
4313
- name: string;
4314
- slug: string;
4315
- url: string | null;
4316
- }[];
4317
- attributes: {
4318
- id: number;
4319
- name: string;
4320
- taxonomy: string | null;
4321
- hasVariations: boolean;
4322
- terms: {
4323
- id: number;
4324
- name: string;
4325
- slug: string;
4326
- isDefault: boolean;
4327
- }[];
4328
- }[];
4329
- variations: {
4330
- id: number;
4331
- attributes: {
4332
- name: string;
4333
- value: string | null;
4334
- }[];
4335
- }[];
4336
- groupedProductIds: number[];
4337
- hasOptions: boolean;
4338
- isPurchasable: boolean;
4339
- isInStock: boolean;
4340
- isOnBackorder: boolean;
4341
- stockAvailability: {
4342
- text: string;
4343
- class: string;
4344
- };
4345
- lowStockRemaining: number | null;
4346
- isSoldIndividually: boolean;
4347
- addToCart: {
4348
- text: string;
4349
- description: string;
4350
- singleText: string;
4351
- minimum: number;
4352
- maximum: number;
4353
- multipleOf: number;
4354
- };
4355
- extensions: {
4356
- [x: string]: unknown;
4357
- };
4358
- }[];
4359
- } | null;
4360
- }[];
4361
- meta: {
4362
- page: number;
4363
- totalItems: number;
4364
- totalPages: number;
4365
- nextPage: number | null;
4366
- prevPage: number | null;
4367
- hasNextPage: boolean;
4368
- hasPrevPage: boolean;
4369
- };
4370
- }, {}>;
3362
+ }, ProductList, {}>;
4371
3363
  filters: kizlo0.Procedure<"api", {
4372
3364
  query?: {
4373
3365
  type?: string | undefined;
@@ -4442,7 +3434,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
4442
3434
  taxonomy: string;
4443
3435
  description: string;
4444
3436
  count: number;
4445
- type: "text" | "image" | "color";
3437
+ type: "text" | "color" | "image";
4446
3438
  swatch: string | null;
4447
3439
  }[];
4448
3440
  taxonomyTerms: {
@@ -5463,4 +4455,4 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
5463
4455
  };
5464
4456
  }>;
5465
4457
  //#endregion
5466
- export { ListProductInput, ListProductInputOut, PRODUCT_ATTRIBUTE_RELATIONS, PRODUCT_CATALOG_VISIBILITIES, PRODUCT_DATE_COLUMNS, PRODUCT_RATINGS, PRODUCT_STOCK_STATUSES, PRODUCT_TYPES, Product, ProductAddToCart, ProductAttributeCount, ProductAttributeFilter, ProductAttributeRelation, ProductAttributeSummary, ProductAttributeTermSummary, ProductBrandSummary, ProductCatalogVisibility, ProductCategorySummary, ProductDateColumn, ProductDimensions, ProductExtensions, ProductFilters, ProductFiltersAttributeTerm, ProductFiltersPriceRange, ProductFiltersRatingCount, ProductFiltersStockStatus, ProductFiltersTaxonomyTerm, ProductFiltersTerm, ProductList, ProductOrderBy, ProductPriceRange, ProductPrices, ProductRating, ProductRecommendations, ProductStockAvailability, ProductStockStatus, ProductSummary, ProductTagSummary, ProductTaxonomyFilter, ProductTaxonomyOperator, ProductTermSummary, ProductType, ProductVariationAttributeSummary, ProductVariationSummary, RetrieveProductFiltersInput, RetrieveProductFiltersInputOut, RetrieveProductInput, SWATCH_TYPES, SwatchType, woocommerce };
4458
+ export { ListProductInput, ListProductInputOut, PRODUCT_ATTRIBUTE_RELATIONS, PRODUCT_CATALOG_VISIBILITIES, PRODUCT_DATE_COLUMNS, PRODUCT_RATINGS, PRODUCT_STOCK_STATUSES, PRODUCT_TYPES, Product, ProductAddToCart, ProductAttributeCount, ProductAttributeFilter, ProductAttributeRelation, ProductAttributeSummary, ProductAttributeTermSummary, ProductBrandSummary, ProductCatalogVisibility, ProductCategorySummary, ProductCustomFieldsSchema, ProductDateColumn, ProductDimensions, ProductExtensions, ProductFilters, ProductFiltersAttributeTerm, ProductFiltersPriceRange, ProductFiltersRatingCount, ProductFiltersStockStatus, ProductFiltersTaxonomyTerm, ProductFiltersTerm, ProductList, ProductOrderBy, ProductPriceRange, ProductPrices, ProductRating, ProductRecommendations, ProductStockAvailability, ProductStockStatus, ProductSummary, ProductTagSummary, ProductTaxonomyFilter, ProductTaxonomyOperator, ProductTermSummary, ProductType, ProductVariationAttributeSummary, ProductVariationSummary, RetrieveProductFiltersInput, RetrieveProductFiltersInputOut, RetrieveProductInput, SWATCH_TYPES, SwatchType, woocommerce };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { CurrencyFormat, IdentifierInput, KizloError, ListMetadata, Seo, createIntegration, createMiddleware, createProcedure, customFieldsSchema, defineErrorMap, deserializeCurrencyFormat, deserializeListMetadata, deserializeSeo } from "kizlo";
1
+ import { CurrencyFormat, IdentifierInput, KizloError, ListMetadata, Seo, createIntegration, createMiddleware, createProcedure, customFieldsSchema, defineErrorMap, deserializeCurrencyFormat, deserializeListMetadata, deserializeSeo, schemaType } from "kizlo";
2
2
  import { BooleanLike, MediaImage, Metadata, NumberLike, arrayable, normalizeArrayableValue, random, seconds, timestampFromIso, timestampFromWpGmt, timestampSec, toPublicMetadata, tryCatch } from "@kizlo/shared";
3
3
  import { SignJWT, jwtVerify } from "jose";
4
4
  import z$1, { z } from "zod/v4";
@@ -1389,6 +1389,7 @@ const ProductRecommendations = z.object({
1389
1389
  crossSells: z.array(ProductSummary),
1390
1390
  related: z.array(ProductSummary)
1391
1391
  });
1392
+ const ProductCustomFieldsSchema = customFieldsSchema();
1392
1393
  const Product = ProductSummary.extend({
1393
1394
  weight: z.string(),
1394
1395
  dimensions: ProductDimensions,
@@ -1398,7 +1399,7 @@ const Product = ProductSummary.extend({
1398
1399
  saleStartsAt: z.number().nullable(),
1399
1400
  saleEndsAt: z.number().nullable(),
1400
1401
  seo: Seo.nullable(),
1401
- custom: customFieldsSchema(),
1402
+ custom: ProductCustomFieldsSchema,
1402
1403
  recommendations: ProductRecommendations.nullable()
1403
1404
  });
1404
1405
  const ProductList = z.object({
@@ -1821,7 +1822,7 @@ const PRODUCT_PROCEDURES = {
1821
1822
  previewToken: true,
1822
1823
  recommendations: true
1823
1824
  }).optional(),
1824
- output: Product,
1825
+ output: schemaType(Product),
1825
1826
  errors: GET_PRODUCT_ERROR_MAP
1826
1827
  }, async ({ context, input, errors }) => {
1827
1828
  if (input.query?.previewToken) {
@@ -1866,7 +1867,7 @@ const PRODUCT_PROCEDURES = {
1866
1867
  method: "GET",
1867
1868
  path: "/products",
1868
1869
  query: ListProductInput.optional(),
1869
- output: ProductList,
1870
+ output: schemaType(ProductList),
1870
1871
  errors: LIST_PRODUCT_ERROR_MAP
1871
1872
  }, async ({ context, input, errors }) => {
1872
1873
  const searchParams = serializeProductListInput(input.query);
@@ -1948,4 +1949,4 @@ function woocommerce() {
1948
1949
  }
1949
1950
 
1950
1951
  //#endregion
1951
- export { ListProductInput, PRODUCT_ATTRIBUTE_RELATIONS, PRODUCT_CATALOG_VISIBILITIES, PRODUCT_DATE_COLUMNS, PRODUCT_RATINGS, PRODUCT_STOCK_STATUSES, PRODUCT_TYPES, Product, ProductAddToCart, ProductAttributeCount, ProductAttributeFilter, ProductAttributeRelation, ProductAttributeSummary, ProductAttributeTermSummary, ProductBrandSummary, ProductCatalogVisibility, ProductCategorySummary, ProductDateColumn, ProductDimensions, ProductExtensions, ProductFilters, ProductFiltersAttributeTerm, ProductFiltersPriceRange, ProductFiltersRatingCount, ProductFiltersStockStatus, ProductFiltersTaxonomyTerm, ProductFiltersTerm, ProductList, ProductOrderBy, ProductPriceRange, ProductPrices, ProductRating, ProductRecommendations, ProductStockAvailability, ProductStockStatus, ProductSummary, ProductTagSummary, ProductTaxonomyFilter, ProductTaxonomyOperator, ProductTermSummary, ProductType, ProductVariationAttributeSummary, ProductVariationSummary, RetrieveProductFiltersInput, RetrieveProductInput, SWATCH_TYPES, SwatchType, woocommerce };
1952
+ export { ListProductInput, PRODUCT_ATTRIBUTE_RELATIONS, PRODUCT_CATALOG_VISIBILITIES, PRODUCT_DATE_COLUMNS, PRODUCT_RATINGS, PRODUCT_STOCK_STATUSES, PRODUCT_TYPES, Product, ProductAddToCart, ProductAttributeCount, ProductAttributeFilter, ProductAttributeRelation, ProductAttributeSummary, ProductAttributeTermSummary, ProductBrandSummary, ProductCatalogVisibility, ProductCategorySummary, ProductCustomFieldsSchema, ProductDateColumn, ProductDimensions, ProductExtensions, ProductFilters, ProductFiltersAttributeTerm, ProductFiltersPriceRange, ProductFiltersRatingCount, ProductFiltersStockStatus, ProductFiltersTaxonomyTerm, ProductFiltersTerm, ProductList, ProductOrderBy, ProductPriceRange, ProductPrices, ProductRating, ProductRecommendations, ProductStockAvailability, ProductStockStatus, ProductSummary, ProductTagSummary, ProductTaxonomyFilter, ProductTaxonomyOperator, ProductTermSummary, ProductType, ProductVariationAttributeSummary, ProductVariationSummary, RetrieveProductFiltersInput, RetrieveProductInput, SWATCH_TYPES, SwatchType, woocommerce };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kizlo/woocommerce",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "WooCommerce integration for Kizlo.",