@kizlo/woocommerce 0.9.0 → 0.10.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/README.md CHANGED
@@ -42,6 +42,18 @@ pnpm add @kizlo/woocommerce
42
42
 
43
43
  See the [docs](https://kizlo.io/docs) for setup and usage.
44
44
 
45
+ ## Billing Tax IDs
46
+
47
+ Billing addresses expose `taxId` on customers, carts, checkout responses, and orders. The field is always a string on output and defaults to `""` when it has not been set. Billing address inputs accept an optional `taxId`; shipping addresses never expose or persist one.
48
+
49
+ ```ts
50
+ await kizlo.woocommerce.cart.update.call({
51
+ body: { billingAddress: { taxId: "GB123456789" } },
52
+ })
53
+ ```
54
+
55
+ Store administrators can make the field mandatory from **WooCommerce → Settings → Accounts & Privacy → Checkout → Require Tax ID at checkout**. It remains optional by default.
56
+
45
57
  ## License
46
58
 
47
- [Apache 2.0](./LICENSE) © Kizlo
59
+ [Apache 2.0](./LICENSE) © Kizlo
package/dist/index.d.ts CHANGED
@@ -29,6 +29,7 @@ declare const CartShippingAddress: z$1.ZodObject<{
29
29
  type CartShippingAddress = z$1.infer<typeof CartShippingAddress>;
30
30
  declare const CartBillingAddress: z$1.ZodObject<{
31
31
  email: z$1.ZodString;
32
+ taxId: z$1.ZodDefault<z$1.ZodString>;
32
33
  firstName: z$1.ZodString;
33
34
  lastName: z$1.ZodString;
34
35
  company: z$1.ZodString;
@@ -344,6 +345,7 @@ declare const Cart: z$1.ZodObject<{
344
345
  itemsWeight: z$1.ZodNumber;
345
346
  billingAddress: z$1.ZodObject<{
346
347
  email: z$1.ZodString;
348
+ taxId: z$1.ZodDefault<z$1.ZodString>;
347
349
  firstName: z$1.ZodString;
348
350
  lastName: z$1.ZodString;
349
351
  company: z$1.ZodString;
@@ -619,6 +621,7 @@ declare const UpdateCartInput: z$1.ZodObject<{
619
621
  }, z$1.core.$strip>>;
620
622
  billingAddress: z$1.ZodOptional<z$1.ZodObject<{
621
623
  email: z$1.ZodOptional<z$1.ZodString>;
624
+ taxId: z$1.ZodOptional<z$1.ZodDefault<z$1.ZodString>>;
622
625
  firstName: z$1.ZodOptional<z$1.ZodString>;
623
626
  lastName: z$1.ZodOptional<z$1.ZodString>;
624
627
  company: z$1.ZodOptional<z$1.ZodString>;
@@ -663,6 +666,7 @@ declare const Checkout: z$2.ZodObject<{
663
666
  customerNote: z$2.ZodString;
664
667
  billingAddress: z$2.ZodObject<{
665
668
  email: z$2.ZodString;
669
+ taxId: z$2.ZodDefault<z$2.ZodString>;
666
670
  firstName: z$2.ZodString;
667
671
  lastName: z$2.ZodString;
668
672
  company: z$2.ZodString;
@@ -770,6 +774,7 @@ declare const Checkout: z$2.ZodObject<{
770
774
  itemsWeight: z$2.ZodNumber;
771
775
  billingAddress: z$2.ZodObject<{
772
776
  email: z$2.ZodString;
777
+ taxId: z$2.ZodDefault<z$2.ZodString>;
773
778
  firstName: z$2.ZodString;
774
779
  lastName: z$2.ZodString;
775
780
  company: z$2.ZodString;
@@ -1008,6 +1013,7 @@ type UpdateCheckoutInput = z$2.input<typeof UpdateCheckoutInput>;
1008
1013
  declare const ConfirmCheckoutInput: z$2.ZodObject<{
1009
1014
  billingAddress: z$2.ZodObject<{
1010
1015
  email: z$2.ZodString;
1016
+ taxId: z$2.ZodDefault<z$2.ZodString>;
1011
1017
  firstName: z$2.ZodString;
1012
1018
  lastName: z$2.ZodString;
1013
1019
  company: z$2.ZodString;
@@ -1054,6 +1060,7 @@ declare const RetryCheckoutInput: z$2.ZodObject<{
1054
1060
  billingEmail: z$2.ZodOptional<z$2.ZodEmail>;
1055
1061
  billingAddress: z$2.ZodObject<{
1056
1062
  email: z$2.ZodString;
1063
+ taxId: z$2.ZodDefault<z$2.ZodString>;
1057
1064
  firstName: z$2.ZodString;
1058
1065
  lastName: z$2.ZodString;
1059
1066
  company: z$2.ZodString;
@@ -1132,6 +1139,7 @@ declare const OrderItem: z.ZodObject<{
1132
1139
  id: z.ZodNumber;
1133
1140
  productId: z.ZodNullable<z.ZodNumber>;
1134
1141
  variationId: z.ZodNullable<z.ZodNumber>;
1142
+ hsCode: z.ZodNullable<z.ZodString>;
1135
1143
  name: z.ZodString;
1136
1144
  quantity: z.ZodNumber;
1137
1145
  selectedAttributes: z.ZodArray<z.ZodObject<{
@@ -1225,6 +1233,7 @@ declare const Order: z.ZodObject<{
1225
1233
  id: z.ZodNumber;
1226
1234
  productId: z.ZodNullable<z.ZodNumber>;
1227
1235
  variationId: z.ZodNullable<z.ZodNumber>;
1236
+ hsCode: z.ZodNullable<z.ZodString>;
1228
1237
  name: z.ZodString;
1229
1238
  quantity: z.ZodNumber;
1230
1239
  selectedAttributes: z.ZodArray<z.ZodObject<{
@@ -1296,6 +1305,7 @@ declare const Order: z.ZodObject<{
1296
1305
  }, z.core.$strip>>;
1297
1306
  billingAddress: z.ZodObject<{
1298
1307
  email: z.ZodString;
1308
+ taxId: z.ZodDefault<z.ZodString>;
1299
1309
  firstName: z.ZodString;
1300
1310
  lastName: z.ZodString;
1301
1311
  company: z.ZodString;
@@ -2035,6 +2045,7 @@ declare const Product: z.ZodObject<{
2035
2045
  formattedWeight: z.ZodString;
2036
2046
  formattedDimensions: z.ZodString;
2037
2047
  stockQuantity: z.ZodNullable<z.ZodNumber>;
2048
+ hsCode: z.ZodNullable<z.ZodString>;
2038
2049
  saleStartsAt: z.ZodNullable<z.ZodNumber>;
2039
2050
  saleEndsAt: z.ZodNullable<z.ZodNumber>;
2040
2051
  seo: z.ZodNullable<z.ZodObject<{
@@ -2537,6 +2548,7 @@ declare const ProductList: z.ZodObject<{
2537
2548
  formattedWeight: z.ZodString;
2538
2549
  formattedDimensions: z.ZodString;
2539
2550
  stockQuantity: z.ZodNullable<z.ZodNumber>;
2551
+ hsCode: z.ZodNullable<z.ZodString>;
2540
2552
  saleStartsAt: z.ZodNullable<z.ZodNumber>;
2541
2553
  saleEndsAt: z.ZodNullable<z.ZodNumber>;
2542
2554
  seo: z.ZodNullable<z.ZodObject<{
@@ -3459,6 +3471,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
3459
3471
  itemsWeight: number;
3460
3472
  billingAddress: {
3461
3473
  email: string;
3474
+ taxId: string;
3462
3475
  firstName: string;
3463
3476
  lastName: string;
3464
3477
  company: string;
@@ -3708,6 +3721,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
3708
3721
  } | undefined;
3709
3722
  billingAddress?: {
3710
3723
  email?: string | undefined;
3724
+ taxId?: string | undefined;
3711
3725
  firstName?: string | undefined;
3712
3726
  lastName?: string | undefined;
3713
3727
  company?: string | undefined;
@@ -3797,6 +3811,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
3797
3811
  itemsWeight: number;
3798
3812
  billingAddress: {
3799
3813
  email: string;
3814
+ taxId: string;
3800
3815
  firstName: string;
3801
3816
  lastName: string;
3802
3817
  company: string;
@@ -4115,6 +4130,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
4115
4130
  itemsWeight: number;
4116
4131
  billingAddress: {
4117
4132
  email: string;
4133
+ taxId: string;
4118
4134
  firstName: string;
4119
4135
  lastName: string;
4120
4136
  company: string;
@@ -4443,6 +4459,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
4443
4459
  itemsWeight: number;
4444
4460
  billingAddress: {
4445
4461
  email: string;
4462
+ taxId: string;
4446
4463
  firstName: string;
4447
4464
  lastName: string;
4448
4465
  company: string;
@@ -4787,6 +4804,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
4787
4804
  itemsWeight: number;
4788
4805
  billingAddress: {
4789
4806
  email: string;
4807
+ taxId: string;
4790
4808
  firstName: string;
4791
4809
  lastName: string;
4792
4810
  company: string;
@@ -5120,6 +5138,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
5120
5138
  itemsWeight: number;
5121
5139
  billingAddress: {
5122
5140
  email: string;
5141
+ taxId: string;
5123
5142
  firstName: string;
5124
5143
  lastName: string;
5125
5144
  company: string;
@@ -5439,6 +5458,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
5439
5458
  itemsWeight: number;
5440
5459
  billingAddress: {
5441
5460
  email: string;
5461
+ taxId: string;
5442
5462
  firstName: string;
5443
5463
  lastName: string;
5444
5464
  company: string;
@@ -5760,6 +5780,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
5760
5780
  itemsWeight: number;
5761
5781
  billingAddress: {
5762
5782
  email: string;
5783
+ taxId: string;
5763
5784
  firstName: string;
5764
5785
  lastName: string;
5765
5786
  company: string;
@@ -6194,6 +6215,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
6194
6215
  customerNote: string;
6195
6216
  billingAddress: {
6196
6217
  email: string;
6218
+ taxId: string;
6197
6219
  firstName: string;
6198
6220
  lastName: string;
6199
6221
  company: string;
@@ -6311,6 +6333,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
6311
6333
  itemsWeight: number;
6312
6334
  billingAddress: {
6313
6335
  email: string;
6336
+ taxId: string;
6314
6337
  firstName: string;
6315
6338
  lastName: string;
6316
6339
  company: string;
@@ -6570,6 +6593,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
6570
6593
  customerNote: string;
6571
6594
  billingAddress: {
6572
6595
  email: string;
6596
+ taxId: string;
6573
6597
  firstName: string;
6574
6598
  lastName: string;
6575
6599
  company: string;
@@ -6687,6 +6711,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
6687
6711
  itemsWeight: number;
6688
6712
  billingAddress: {
6689
6713
  email: string;
6714
+ taxId: string;
6690
6715
  firstName: string;
6691
6716
  lastName: string;
6692
6717
  company: string;
@@ -7018,6 +7043,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
7018
7043
  itemsWeight: zod0.ZodNumber;
7019
7044
  billingAddress: zod0.ZodObject<{
7020
7045
  email: zod0.ZodString;
7046
+ taxId: zod0.ZodDefault<zod0.ZodString>;
7021
7047
  firstName: zod0.ZodString;
7022
7048
  lastName: zod0.ZodString;
7023
7049
  company: zod0.ZodString;
@@ -7320,6 +7346,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
7320
7346
  itemsWeight: zod0.ZodNumber;
7321
7347
  billingAddress: zod0.ZodObject<{
7322
7348
  email: zod0.ZodString;
7349
+ taxId: zod0.ZodDefault<zod0.ZodString>;
7323
7350
  firstName: zod0.ZodString;
7324
7351
  lastName: zod0.ZodString;
7325
7352
  company: zod0.ZodString;
@@ -7622,6 +7649,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
7622
7649
  itemsWeight: zod0.ZodNumber;
7623
7650
  billingAddress: zod0.ZodObject<{
7624
7651
  email: zod0.ZodString;
7652
+ taxId: zod0.ZodDefault<zod0.ZodString>;
7625
7653
  firstName: zod0.ZodString;
7626
7654
  lastName: zod0.ZodString;
7627
7655
  company: zod0.ZodString;
@@ -7924,6 +7952,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
7924
7952
  itemsWeight: zod0.ZodNumber;
7925
7953
  billingAddress: zod0.ZodObject<{
7926
7954
  email: zod0.ZodString;
7955
+ taxId: zod0.ZodDefault<zod0.ZodString>;
7927
7956
  firstName: zod0.ZodString;
7928
7957
  lastName: zod0.ZodString;
7929
7958
  company: zod0.ZodString;
@@ -8226,6 +8255,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
8226
8255
  itemsWeight: zod0.ZodNumber;
8227
8256
  billingAddress: zod0.ZodObject<{
8228
8257
  email: zod0.ZodString;
8258
+ taxId: zod0.ZodDefault<zod0.ZodString>;
8229
8259
  firstName: zod0.ZodString;
8230
8260
  lastName: zod0.ZodString;
8231
8261
  company: zod0.ZodString;
@@ -8470,6 +8500,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
8470
8500
  additionalFields: {
8471
8501
  [x: string]: string | boolean;
8472
8502
  };
8503
+ taxId?: string | undefined;
8473
8504
  };
8474
8505
  paymentMethod: string;
8475
8506
  shippingAddress?: {
@@ -8507,6 +8538,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
8507
8538
  customerNote: string;
8508
8539
  billingAddress: {
8509
8540
  email: string;
8541
+ taxId: string;
8510
8542
  firstName: string;
8511
8543
  lastName: string;
8512
8544
  company: string;
@@ -8624,6 +8656,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
8624
8656
  itemsWeight: number;
8625
8657
  billingAddress: {
8626
8658
  email: string;
8659
+ taxId: string;
8627
8660
  firstName: string;
8628
8661
  lastName: string;
8629
8662
  company: string;
@@ -8999,6 +9032,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
8999
9032
  itemsWeight: zod0.ZodNumber;
9000
9033
  billingAddress: zod0.ZodObject<{
9001
9034
  email: zod0.ZodString;
9035
+ taxId: zod0.ZodDefault<zod0.ZodString>;
9002
9036
  firstName: zod0.ZodString;
9003
9037
  lastName: zod0.ZodString;
9004
9038
  company: zod0.ZodString;
@@ -9301,6 +9335,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
9301
9335
  itemsWeight: zod0.ZodNumber;
9302
9336
  billingAddress: zod0.ZodObject<{
9303
9337
  email: zod0.ZodString;
9338
+ taxId: zod0.ZodDefault<zod0.ZodString>;
9304
9339
  firstName: zod0.ZodString;
9305
9340
  lastName: zod0.ZodString;
9306
9341
  company: zod0.ZodString;
@@ -9603,6 +9638,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
9603
9638
  itemsWeight: zod0.ZodNumber;
9604
9639
  billingAddress: zod0.ZodObject<{
9605
9640
  email: zod0.ZodString;
9641
+ taxId: zod0.ZodDefault<zod0.ZodString>;
9606
9642
  firstName: zod0.ZodString;
9607
9643
  lastName: zod0.ZodString;
9608
9644
  company: zod0.ZodString;
@@ -9905,6 +9941,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
9905
9941
  itemsWeight: zod0.ZodNumber;
9906
9942
  billingAddress: zod0.ZodObject<{
9907
9943
  email: zod0.ZodString;
9944
+ taxId: zod0.ZodDefault<zod0.ZodString>;
9908
9945
  firstName: zod0.ZodString;
9909
9946
  lastName: zod0.ZodString;
9910
9947
  company: zod0.ZodString;
@@ -10207,6 +10244,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
10207
10244
  itemsWeight: zod0.ZodNumber;
10208
10245
  billingAddress: zod0.ZodObject<{
10209
10246
  email: zod0.ZodString;
10247
+ taxId: zod0.ZodDefault<zod0.ZodString>;
10210
10248
  firstName: zod0.ZodString;
10211
10249
  lastName: zod0.ZodString;
10212
10250
  company: zod0.ZodString;
@@ -10509,6 +10547,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
10509
10547
  itemsWeight: zod0.ZodNumber;
10510
10548
  billingAddress: zod0.ZodObject<{
10511
10549
  email: zod0.ZodString;
10550
+ taxId: zod0.ZodDefault<zod0.ZodString>;
10512
10551
  firstName: zod0.ZodString;
10513
10552
  lastName: zod0.ZodString;
10514
10553
  company: zod0.ZodString;
@@ -10811,6 +10850,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
10811
10850
  itemsWeight: zod0.ZodNumber;
10812
10851
  billingAddress: zod0.ZodObject<{
10813
10852
  email: zod0.ZodString;
10853
+ taxId: zod0.ZodDefault<zod0.ZodString>;
10814
10854
  firstName: zod0.ZodString;
10815
10855
  lastName: zod0.ZodString;
10816
10856
  company: zod0.ZodString;
@@ -11055,6 +11095,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
11055
11095
  additionalFields: {
11056
11096
  [x: string]: string | boolean;
11057
11097
  };
11098
+ taxId?: string | undefined;
11058
11099
  };
11059
11100
  key: string;
11060
11101
  paymentMethod: string;
@@ -11095,6 +11136,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
11095
11136
  customerNote: string;
11096
11137
  billingAddress: {
11097
11138
  email: string;
11139
+ taxId: string;
11098
11140
  firstName: string;
11099
11141
  lastName: string;
11100
11142
  company: string;
@@ -11212,6 +11254,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
11212
11254
  itemsWeight: number;
11213
11255
  billingAddress: {
11214
11256
  email: string;
11257
+ taxId: string;
11215
11258
  firstName: string;
11216
11259
  lastName: string;
11217
11260
  company: string;
@@ -11507,6 +11550,7 @@ declare function woocommerce(): kizlo0.Integration<"woocommerce", {
11507
11550
  state: string;
11508
11551
  country: string;
11509
11552
  email: string;
11553
+ taxId: string;
11510
11554
  company?: string | undefined;
11511
11555
  address2?: string | undefined;
11512
11556
  };
package/dist/index.js CHANGED
@@ -314,6 +314,7 @@ const Product = ProductSummary.extend({
314
314
  formattedWeight: z.string(),
315
315
  formattedDimensions: z.string(),
316
316
  stockQuantity: z.number().nullable(),
317
+ hsCode: z.string().nullable(),
317
318
  saleStartsAt: z.number().nullable(),
318
319
  saleEndsAt: z.number().nullable(),
319
320
  seo: Seo.nullable(),
@@ -501,7 +502,8 @@ const CartAddressFields = {
501
502
  const CartShippingAddress = z$1.object(CartAddressFields);
502
503
  const CartBillingAddress = z$1.object({
503
504
  ...CartAddressFields,
504
- email: z$1.string()
505
+ email: z$1.string(),
506
+ taxId: z$1.string().default("")
505
507
  });
506
508
  const CartShippingDestination = z$1.object({
507
509
  address1: z$1.string(),
@@ -675,10 +677,7 @@ const SelectCartShippingRateInput = z$1.object({
675
677
  packageId: z$1.union([z$1.number(), z$1.string()]).nullable().optional()
676
678
  });
677
679
  const CartShippingAddressInput = z$1.object(CartAddressFields).partial();
678
- const CartBillingAddressInput = z$1.object({
679
- ...CartAddressFields,
680
- email: z$1.string()
681
- }).partial();
680
+ const CartBillingAddressInput = CartBillingAddress.partial();
682
681
  const UpdateCartInput = z$1.object({
683
682
  shippingAddress: CartShippingAddressInput.optional(),
684
683
  billingAddress: CartBillingAddressInput.optional()
@@ -701,6 +700,7 @@ function deserializeStoreProduct(data, recommendations) {
701
700
  formattedWeight: data.formatted_weight,
702
701
  formattedDimensions: data.formatted_dimensions,
703
702
  stockQuantity: nullableNumber(kizlo.stock),
703
+ hsCode: typeof kizlo.hs_code === "string" && kizlo.hs_code !== "" ? kizlo.hs_code : null,
704
704
  saleStartsAt: timestampFromIso(typeof kizlo.on_sale_from === "string" ? kizlo.on_sale_from : null),
705
705
  saleEndsAt: timestampFromIso(typeof kizlo.on_sale_to === "string" ? kizlo.on_sale_to : null),
706
706
  seo: isRecord$1(kizlo.seo) ? deserializeSeo(kizlo.seo) : null,
@@ -931,6 +931,7 @@ function nullableNumber(value) {
931
931
 
932
932
  //#endregion
933
933
  //#region src/cart/utils.ts
934
+ const TAX_ID_KEY = "kizlo/tax-id";
934
935
  function assertNoMissing$2() {}
935
936
  assertNoMissing$2();
936
937
  assertNoMissing$2();
@@ -1139,6 +1140,7 @@ function deserializeCartBillingAddress(address) {
1139
1140
  return {
1140
1141
  ...deserializeCartShippingAddress(address),
1141
1142
  email: address.email,
1143
+ taxId: taxId(address),
1142
1144
  additionalFields: additionalAddressFields(address, BILLING_ADDRESS_KEYS)
1143
1145
  };
1144
1146
  }
@@ -1152,12 +1154,16 @@ const SHIPPING_ADDRESS_KEYS = new Set([
1152
1154
  "state",
1153
1155
  "postcode",
1154
1156
  "country",
1155
- "phone"
1157
+ "phone",
1158
+ TAX_ID_KEY
1156
1159
  ]);
1157
1160
  const BILLING_ADDRESS_KEYS = new Set([...SHIPPING_ADDRESS_KEYS, "email"]);
1158
1161
  function additionalAddressFields(address, standardKeys) {
1159
1162
  return Object.fromEntries(Object.entries(address).filter((entry) => !standardKeys.has(entry[0]) && (typeof entry[1] === "string" || typeof entry[1] === "boolean")));
1160
1163
  }
1164
+ function taxId(address) {
1165
+ return typeof address[TAX_ID_KEY] === "string" ? address[TAX_ID_KEY] : "";
1166
+ }
1161
1167
  function serializeCartUpdateInput(input) {
1162
1168
  return {
1163
1169
  ...input.billingAddress !== void 0 && { billing_address: serializeCartBillingAddress(input.billingAddress) },
@@ -1166,7 +1172,7 @@ function serializeCartUpdateInput(input) {
1166
1172
  }
1167
1173
  function serializeCartShippingAddress(address) {
1168
1174
  return compactAddress({
1169
- ...address.additionalFields,
1175
+ ...Object.fromEntries(Object.entries(address.additionalFields ?? {}).filter(([key]) => key !== TAX_ID_KEY)),
1170
1176
  first_name: address.firstName,
1171
1177
  last_name: address.lastName,
1172
1178
  company: address.company,
@@ -1182,7 +1188,8 @@ function serializeCartShippingAddress(address) {
1182
1188
  function serializeCartBillingAddress(address) {
1183
1189
  return compactAddress({
1184
1190
  ...serializeCartShippingAddress(address),
1185
- email: address.email
1191
+ email: address.email,
1192
+ [TAX_ID_KEY]: address.taxId
1186
1193
  });
1187
1194
  }
1188
1195
  function compactAddress(address) {
@@ -1960,7 +1967,10 @@ const ShippingAddress = z$1.object({
1960
1967
  state: z$1.string(),
1961
1968
  country: z$1.string()
1962
1969
  });
1963
- const BillingAddress = ShippingAddress.extend({ email: z$1.string() });
1970
+ const BillingAddress = ShippingAddress.extend({
1971
+ email: z$1.string(),
1972
+ taxId: z$1.string().default("")
1973
+ });
1964
1974
 
1965
1975
  //#endregion
1966
1976
  //#region src/customer/schema.ts
@@ -1982,21 +1992,23 @@ const Customer = z$2.object({
1982
1992
  //#endregion
1983
1993
  //#region src/customer/utils.ts
1984
1994
  function deserializeCustomer(data) {
1995
+ const billing = data.billing;
1985
1996
  return {
1986
1997
  id: data.id,
1987
1998
  avatarUrl: data.avatar_url.length ? data.avatar_url : null,
1988
1999
  billing: {
1989
- firstName: data.billing.first_name,
1990
- lastName: data.billing.last_name,
1991
- address1: data.billing.address_1,
1992
- city: data.billing.city,
1993
- country: data.billing.country,
1994
- email: data.billing.email,
1995
- phone: data.billing.phone,
1996
- postcode: data.billing.postcode,
1997
- state: data.billing.state,
1998
- address2: data.billing.address_2,
1999
- company: data.billing.company
2000
+ firstName: billing.first_name,
2001
+ lastName: billing.last_name,
2002
+ address1: billing.address_1,
2003
+ city: billing.city,
2004
+ country: billing.country,
2005
+ email: billing.email,
2006
+ phone: billing.phone,
2007
+ postcode: billing.postcode,
2008
+ state: billing.state,
2009
+ address2: billing.address_2,
2010
+ company: billing.company,
2011
+ taxId: typeof billing.tax_id === "string" ? billing.tax_id : ""
2000
2012
  },
2001
2013
  shipping: {
2002
2014
  firstName: data.shipping.first_name,
@@ -2078,6 +2090,7 @@ const OrderItem = z.object({
2078
2090
  id: z.number(),
2079
2091
  productId: z.number().nullable(),
2080
2092
  variationId: z.number().nullable(),
2093
+ hsCode: z.string().nullable(),
2081
2094
  name: z.string(),
2082
2095
  quantity: z.number(),
2083
2096
  selectedAttributes: z.array(CartSelectedAttribute),
@@ -2209,6 +2222,7 @@ function deserializeOrderItem(item) {
2209
2222
  id: item.id,
2210
2223
  productId,
2211
2224
  variationId,
2225
+ hsCode: typeof kizlo.hs_code === "string" && kizlo.hs_code !== "" ? kizlo.hs_code : null,
2212
2226
  name: item.name,
2213
2227
  quantity: item.quantity,
2214
2228
  selectedAttributes: item.variation.map((attribute) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kizlo/woocommerce",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "WooCommerce integration for Kizlo.",