@deliverart/sdk-js-customer 3.0.2-dev.1 → 3.0.2-dev.2

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.cjs CHANGED
@@ -180,7 +180,7 @@ var customerBusinessProfileSchema = import_zod.z.object({
180
180
  vat: import_zod.z.string(),
181
181
  taxCode: import_zod.z.string(),
182
182
  billingAddress: import_sdk_js_global_types2.addressSchema,
183
- billingData: import_sdk_js_global_types2.billingDataSchema,
183
+ billingData: import_sdk_js_global_types2.billingChannelReadSchema,
184
184
  createdAt: import_sdk_js_global_types2.datetimeSchema,
185
185
  updatedAt: import_sdk_js_global_types2.datetimeSchema
186
186
  });
@@ -194,7 +194,7 @@ var writableCreateCustomerBusinessProfileSchema = customerBusinessProfileDetails
194
194
  taxCode: true,
195
195
  billingAddress: true,
196
196
  billingData: true
197
- });
197
+ }).extend({ billingData: import_sdk_js_global_types2.billingChannelFieldsSchema });
198
198
  var writableCustomerBusinessProfileSchema = writableCreateCustomerBusinessProfileSchema.omit({
199
199
  customer: true
200
200
  });
@@ -368,7 +368,15 @@ var UpdateCustomerAddress = class extends import_sdk_js_core6.AbstractApiRequest
368
368
 
369
369
  // src/requests/customer-business-profiles/CreateCustomerBusinessProfile.ts
370
370
  var import_sdk_js_core7 = require("@deliverart/sdk-js-core");
371
- var createCustomerBusinessProfileInputSchema = writableCreateCustomerBusinessProfileSchema.required();
371
+ var createCustomerBusinessProfileInputSchema = writableCreateCustomerBusinessProfileSchema.required().superRefine((value, context) => {
372
+ if ((value.billingAddress.country || value.vat.slice(0, 2)) === "IT" && !value.billingData.sdi && !value.billingData.pec) {
373
+ context.addIssue({
374
+ code: "custom",
375
+ path: ["billingData", "sdi"],
376
+ message: "Enter SDI or PEC for Italian billing addresses."
377
+ });
378
+ }
379
+ });
372
380
  var createCustomerBusinessProfileResponseSchema = customerBusinessProfileDetailsSchema;
373
381
  var CreateCustomerBusinessProfile = class extends import_sdk_js_core7.AbstractApiRequest {
374
382
  constructor(input) {
package/dist/index.d.cts CHANGED
@@ -122,10 +122,13 @@ declare const customerBusinessProfileSchema: z.ZodObject<{
122
122
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
123
123
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
124
124
  }, z.core.$strip>;
125
- billingData: z.ZodObject<{
125
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
126
126
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
127
127
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
128
- }, z.core.$strip>;
128
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
129
+ sdi?: string | null | undefined;
130
+ pec?: string | null | undefined;
131
+ }, never[]>>]>;
129
132
  createdAt: z.ZodString;
130
133
  updatedAt: z.ZodString;
131
134
  }, z.core.$strip>;
@@ -143,10 +146,13 @@ declare const customerBusinessProfileDetailsSchema: z.ZodObject<{
143
146
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
144
147
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
145
148
  }, z.core.$strip>;
146
- billingData: z.ZodObject<{
149
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
147
150
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
148
151
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
149
- }, z.core.$strip>;
152
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
153
+ sdi?: string | null | undefined;
154
+ pec?: string | null | undefined;
155
+ }, never[]>>]>;
150
156
  createdAt: z.ZodString;
151
157
  updatedAt: z.ZodString;
152
158
  customer: z.ZodType<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown, z.core.$ZodTypeInternals<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown>>;
@@ -162,13 +168,13 @@ declare const writableCreateCustomerBusinessProfileSchema: z.ZodObject<{
162
168
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
163
169
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
164
170
  }, z.core.$strip>;
171
+ businessName: z.ZodString;
172
+ vat: z.ZodString;
173
+ taxCode: z.ZodString;
165
174
  billingData: z.ZodObject<{
166
175
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
167
176
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
168
177
  }, z.core.$strip>;
169
- businessName: z.ZodString;
170
- vat: z.ZodString;
171
- taxCode: z.ZodString;
172
178
  }, z.core.$strip>;
173
179
  declare const writableCustomerBusinessProfileSchema: z.ZodObject<{
174
180
  billingAddress: z.ZodObject<{
@@ -678,13 +684,13 @@ declare const createCustomerBusinessProfileInputSchema: z.ZodObject<{
678
684
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
679
685
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
680
686
  }, z.core.$strip>>;
687
+ businessName: z.ZodNonOptional<z.ZodString>;
688
+ vat: z.ZodNonOptional<z.ZodString>;
689
+ taxCode: z.ZodNonOptional<z.ZodString>;
681
690
  billingData: z.ZodNonOptional<z.ZodObject<{
682
691
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
683
692
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
684
693
  }, z.core.$strip>>;
685
- businessName: z.ZodNonOptional<z.ZodString>;
686
- vat: z.ZodNonOptional<z.ZodString>;
687
- taxCode: z.ZodNonOptional<z.ZodString>;
688
694
  }, z.core.$strip>;
689
695
  type CreateCustomerBusinessProfileInput = z.input<typeof createCustomerBusinessProfileInputSchema>;
690
696
  declare const createCustomerBusinessProfileResponseSchema: z.ZodObject<{
@@ -700,10 +706,13 @@ declare const createCustomerBusinessProfileResponseSchema: z.ZodObject<{
700
706
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
701
707
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
702
708
  }, z.core.$strip>;
703
- billingData: z.ZodObject<{
709
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
704
710
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
705
711
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
706
- }, z.core.$strip>;
712
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
713
+ sdi?: string | null | undefined;
714
+ pec?: string | null | undefined;
715
+ }, never[]>>]>;
707
716
  createdAt: z.ZodString;
708
717
  updatedAt: z.ZodString;
709
718
  customer: z.ZodType<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown, z.core.$ZodTypeInternals<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown>>;
@@ -723,13 +732,13 @@ declare class CreateCustomerBusinessProfile extends AbstractApiRequest<typeof cr
723
732
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
724
733
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
725
734
  }, z.core.$strip>>;
735
+ businessName: z.ZodNonOptional<z.ZodString>;
736
+ vat: z.ZodNonOptional<z.ZodString>;
737
+ taxCode: z.ZodNonOptional<z.ZodString>;
726
738
  billingData: z.ZodNonOptional<z.ZodObject<{
727
739
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
728
740
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
729
741
  }, z.core.$strip>>;
730
- businessName: z.ZodNonOptional<z.ZodString>;
731
- vat: z.ZodNonOptional<z.ZodString>;
732
- taxCode: z.ZodNonOptional<z.ZodString>;
733
742
  }, z.core.$strip>;
734
743
  readonly outputSchema: z.ZodObject<{
735
744
  id: z.ZodString;
@@ -744,10 +753,13 @@ declare class CreateCustomerBusinessProfile extends AbstractApiRequest<typeof cr
744
753
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
745
754
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
746
755
  }, z.core.$strip>;
747
- billingData: z.ZodObject<{
756
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
748
757
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
749
758
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
750
- }, z.core.$strip>;
759
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
760
+ sdi?: string | null | undefined;
761
+ pec?: string | null | undefined;
762
+ }, never[]>>]>;
751
763
  createdAt: z.ZodString;
752
764
  updatedAt: z.ZodString;
753
765
  customer: z.ZodType<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown, z.core.$ZodTypeInternals<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown>>;
@@ -788,10 +800,13 @@ declare const getCustomerBusinessProfileDetailsResponseSchema: z.ZodObject<{
788
800
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
789
801
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
790
802
  }, z.core.$strip>;
791
- billingData: z.ZodObject<{
803
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
792
804
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
793
805
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
794
- }, z.core.$strip>;
806
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
807
+ sdi?: string | null | undefined;
808
+ pec?: string | null | undefined;
809
+ }, never[]>>]>;
795
810
  createdAt: z.ZodString;
796
811
  updatedAt: z.ZodString;
797
812
  customer: z.ZodType<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown, z.core.$ZodTypeInternals<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown>>;
@@ -815,10 +830,13 @@ declare class GetCustomerBusinessProfileDetails extends AbstractApiRequest<typeo
815
830
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
816
831
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
817
832
  }, z.core.$strip>;
818
- billingData: z.ZodObject<{
833
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
819
834
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
820
835
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
821
- }, z.core.$strip>;
836
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
837
+ sdi?: string | null | undefined;
838
+ pec?: string | null | undefined;
839
+ }, never[]>>]>;
822
840
  createdAt: z.ZodString;
823
841
  updatedAt: z.ZodString;
824
842
  customer: z.ZodType<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown, z.core.$ZodTypeInternals<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown>>;
@@ -873,10 +891,13 @@ declare const getCustomerBusinessProfilesResponseSchema: z.ZodObject<{
873
891
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
874
892
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
875
893
  }, z.core.$strip>;
876
- billingData: z.ZodObject<{
894
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
877
895
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
878
896
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
879
- }, z.core.$strip>;
897
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
898
+ sdi?: string | null | undefined;
899
+ pec?: string | null | undefined;
900
+ }, never[]>>]>;
880
901
  createdAt: z.ZodString;
881
902
  updatedAt: z.ZodString;
882
903
  }, z.core.$strip>>;
@@ -909,10 +930,13 @@ declare class GetCustomerBusinessProfiles extends AbstractApiRequest<typeof getC
909
930
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
910
931
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
911
932
  }, z.core.$strip>;
912
- billingData: z.ZodObject<{
933
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
913
934
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
914
935
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
915
- }, z.core.$strip>;
936
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
937
+ sdi?: string | null | undefined;
938
+ pec?: string | null | undefined;
939
+ }, never[]>>]>;
916
940
  createdAt: z.ZodString;
917
941
  updatedAt: z.ZodString;
918
942
  }, z.core.$strip>>;
@@ -965,10 +989,13 @@ declare class GetCustomerBusinessProfiles extends AbstractApiRequest<typeof getC
965
989
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
966
990
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
967
991
  }, z.core.$strip>;
968
- billingData: z.ZodObject<{
992
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
969
993
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
970
994
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
971
- }, z.core.$strip>;
995
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
996
+ sdi?: string | null | undefined;
997
+ pec?: string | null | undefined;
998
+ }, never[]>>]>;
972
999
  createdAt: z.ZodString;
973
1000
  updatedAt: z.ZodString;
974
1001
  }, z.core.$strip>;
@@ -1020,10 +1047,13 @@ declare const getCustomerBusinessProfilesForCustomerResponseSchema: z.ZodArray<z
1020
1047
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1021
1048
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1022
1049
  }, z.core.$strip>;
1023
- billingData: z.ZodObject<{
1050
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
1024
1051
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
1025
1052
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
1026
- }, z.core.$strip>;
1053
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
1054
+ sdi?: string | null | undefined;
1055
+ pec?: string | null | undefined;
1056
+ }, never[]>>]>;
1027
1057
  createdAt: z.ZodString;
1028
1058
  updatedAt: z.ZodString;
1029
1059
  }, z.core.$strip>>;
@@ -1046,10 +1076,13 @@ declare class GetCustomerBusinessProfilesForCustomer extends AbstractApiRequest<
1046
1076
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1047
1077
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1048
1078
  }, z.core.$strip>;
1049
- billingData: z.ZodObject<{
1079
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
1050
1080
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
1051
1081
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
1052
- }, z.core.$strip>;
1082
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
1083
+ sdi?: string | null | undefined;
1084
+ pec?: string | null | undefined;
1085
+ }, never[]>>]>;
1053
1086
  createdAt: z.ZodString;
1054
1087
  updatedAt: z.ZodString;
1055
1088
  }, z.core.$strip>>;
@@ -1092,10 +1125,13 @@ declare class GetCustomerBusinessProfilesForCustomer extends AbstractApiRequest<
1092
1125
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1093
1126
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1094
1127
  }, z.core.$strip>;
1095
- billingData: z.ZodObject<{
1128
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
1096
1129
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
1097
1130
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
1098
- }, z.core.$strip>;
1131
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
1132
+ sdi?: string | null | undefined;
1133
+ pec?: string | null | undefined;
1134
+ }, never[]>>]>;
1099
1135
  createdAt: z.ZodString;
1100
1136
  updatedAt: z.ZodString;
1101
1137
  }, z.core.$strip>;
@@ -1138,10 +1174,13 @@ declare const updateCustomerBusinessProfileResponseSchema: z.ZodObject<{
1138
1174
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1139
1175
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1140
1176
  }, z.core.$strip>;
1141
- billingData: z.ZodObject<{
1177
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
1142
1178
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
1143
1179
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
1144
- }, z.core.$strip>;
1180
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
1181
+ sdi?: string | null | undefined;
1182
+ pec?: string | null | undefined;
1183
+ }, never[]>>]>;
1145
1184
  createdAt: z.ZodString;
1146
1185
  updatedAt: z.ZodString;
1147
1186
  customer: z.ZodType<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown, z.core.$ZodTypeInternals<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown>>;
@@ -1181,10 +1220,13 @@ declare class UpdateCustomerBusinessProfile extends AbstractApiRequest<typeof up
1181
1220
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1182
1221
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1183
1222
  }, z.core.$strip>;
1184
- billingData: z.ZodObject<{
1223
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
1185
1224
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
1186
1225
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
1187
- }, z.core.$strip>;
1226
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
1227
+ sdi?: string | null | undefined;
1228
+ pec?: string | null | undefined;
1229
+ }, never[]>>]>;
1188
1230
  createdAt: z.ZodString;
1189
1231
  updatedAt: z.ZodString;
1190
1232
  customer: z.ZodType<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown, z.core.$ZodTypeInternals<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown>>;
package/dist/index.d.ts CHANGED
@@ -122,10 +122,13 @@ declare const customerBusinessProfileSchema: z.ZodObject<{
122
122
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
123
123
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
124
124
  }, z.core.$strip>;
125
- billingData: z.ZodObject<{
125
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
126
126
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
127
127
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
128
- }, z.core.$strip>;
128
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
129
+ sdi?: string | null | undefined;
130
+ pec?: string | null | undefined;
131
+ }, never[]>>]>;
129
132
  createdAt: z.ZodString;
130
133
  updatedAt: z.ZodString;
131
134
  }, z.core.$strip>;
@@ -143,10 +146,13 @@ declare const customerBusinessProfileDetailsSchema: z.ZodObject<{
143
146
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
144
147
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
145
148
  }, z.core.$strip>;
146
- billingData: z.ZodObject<{
149
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
147
150
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
148
151
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
149
- }, z.core.$strip>;
152
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
153
+ sdi?: string | null | undefined;
154
+ pec?: string | null | undefined;
155
+ }, never[]>>]>;
150
156
  createdAt: z.ZodString;
151
157
  updatedAt: z.ZodString;
152
158
  customer: z.ZodType<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown, z.core.$ZodTypeInternals<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown>>;
@@ -162,13 +168,13 @@ declare const writableCreateCustomerBusinessProfileSchema: z.ZodObject<{
162
168
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
163
169
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
164
170
  }, z.core.$strip>;
171
+ businessName: z.ZodString;
172
+ vat: z.ZodString;
173
+ taxCode: z.ZodString;
165
174
  billingData: z.ZodObject<{
166
175
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
167
176
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
168
177
  }, z.core.$strip>;
169
- businessName: z.ZodString;
170
- vat: z.ZodString;
171
- taxCode: z.ZodString;
172
178
  }, z.core.$strip>;
173
179
  declare const writableCustomerBusinessProfileSchema: z.ZodObject<{
174
180
  billingAddress: z.ZodObject<{
@@ -678,13 +684,13 @@ declare const createCustomerBusinessProfileInputSchema: z.ZodObject<{
678
684
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
679
685
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
680
686
  }, z.core.$strip>>;
687
+ businessName: z.ZodNonOptional<z.ZodString>;
688
+ vat: z.ZodNonOptional<z.ZodString>;
689
+ taxCode: z.ZodNonOptional<z.ZodString>;
681
690
  billingData: z.ZodNonOptional<z.ZodObject<{
682
691
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
683
692
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
684
693
  }, z.core.$strip>>;
685
- businessName: z.ZodNonOptional<z.ZodString>;
686
- vat: z.ZodNonOptional<z.ZodString>;
687
- taxCode: z.ZodNonOptional<z.ZodString>;
688
694
  }, z.core.$strip>;
689
695
  type CreateCustomerBusinessProfileInput = z.input<typeof createCustomerBusinessProfileInputSchema>;
690
696
  declare const createCustomerBusinessProfileResponseSchema: z.ZodObject<{
@@ -700,10 +706,13 @@ declare const createCustomerBusinessProfileResponseSchema: z.ZodObject<{
700
706
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
701
707
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
702
708
  }, z.core.$strip>;
703
- billingData: z.ZodObject<{
709
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
704
710
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
705
711
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
706
- }, z.core.$strip>;
712
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
713
+ sdi?: string | null | undefined;
714
+ pec?: string | null | undefined;
715
+ }, never[]>>]>;
707
716
  createdAt: z.ZodString;
708
717
  updatedAt: z.ZodString;
709
718
  customer: z.ZodType<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown, z.core.$ZodTypeInternals<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown>>;
@@ -723,13 +732,13 @@ declare class CreateCustomerBusinessProfile extends AbstractApiRequest<typeof cr
723
732
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
724
733
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
725
734
  }, z.core.$strip>>;
735
+ businessName: z.ZodNonOptional<z.ZodString>;
736
+ vat: z.ZodNonOptional<z.ZodString>;
737
+ taxCode: z.ZodNonOptional<z.ZodString>;
726
738
  billingData: z.ZodNonOptional<z.ZodObject<{
727
739
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
728
740
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
729
741
  }, z.core.$strip>>;
730
- businessName: z.ZodNonOptional<z.ZodString>;
731
- vat: z.ZodNonOptional<z.ZodString>;
732
- taxCode: z.ZodNonOptional<z.ZodString>;
733
742
  }, z.core.$strip>;
734
743
  readonly outputSchema: z.ZodObject<{
735
744
  id: z.ZodString;
@@ -744,10 +753,13 @@ declare class CreateCustomerBusinessProfile extends AbstractApiRequest<typeof cr
744
753
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
745
754
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
746
755
  }, z.core.$strip>;
747
- billingData: z.ZodObject<{
756
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
748
757
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
749
758
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
750
- }, z.core.$strip>;
759
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
760
+ sdi?: string | null | undefined;
761
+ pec?: string | null | undefined;
762
+ }, never[]>>]>;
751
763
  createdAt: z.ZodString;
752
764
  updatedAt: z.ZodString;
753
765
  customer: z.ZodType<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown, z.core.$ZodTypeInternals<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown>>;
@@ -788,10 +800,13 @@ declare const getCustomerBusinessProfileDetailsResponseSchema: z.ZodObject<{
788
800
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
789
801
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
790
802
  }, z.core.$strip>;
791
- billingData: z.ZodObject<{
803
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
792
804
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
793
805
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
794
- }, z.core.$strip>;
806
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
807
+ sdi?: string | null | undefined;
808
+ pec?: string | null | undefined;
809
+ }, never[]>>]>;
795
810
  createdAt: z.ZodString;
796
811
  updatedAt: z.ZodString;
797
812
  customer: z.ZodType<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown, z.core.$ZodTypeInternals<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown>>;
@@ -815,10 +830,13 @@ declare class GetCustomerBusinessProfileDetails extends AbstractApiRequest<typeo
815
830
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
816
831
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
817
832
  }, z.core.$strip>;
818
- billingData: z.ZodObject<{
833
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
819
834
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
820
835
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
821
- }, z.core.$strip>;
836
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
837
+ sdi?: string | null | undefined;
838
+ pec?: string | null | undefined;
839
+ }, never[]>>]>;
822
840
  createdAt: z.ZodString;
823
841
  updatedAt: z.ZodString;
824
842
  customer: z.ZodType<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown, z.core.$ZodTypeInternals<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown>>;
@@ -873,10 +891,13 @@ declare const getCustomerBusinessProfilesResponseSchema: z.ZodObject<{
873
891
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
874
892
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
875
893
  }, z.core.$strip>;
876
- billingData: z.ZodObject<{
894
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
877
895
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
878
896
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
879
- }, z.core.$strip>;
897
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
898
+ sdi?: string | null | undefined;
899
+ pec?: string | null | undefined;
900
+ }, never[]>>]>;
880
901
  createdAt: z.ZodString;
881
902
  updatedAt: z.ZodString;
882
903
  }, z.core.$strip>>;
@@ -909,10 +930,13 @@ declare class GetCustomerBusinessProfiles extends AbstractApiRequest<typeof getC
909
930
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
910
931
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
911
932
  }, z.core.$strip>;
912
- billingData: z.ZodObject<{
933
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
913
934
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
914
935
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
915
- }, z.core.$strip>;
936
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
937
+ sdi?: string | null | undefined;
938
+ pec?: string | null | undefined;
939
+ }, never[]>>]>;
916
940
  createdAt: z.ZodString;
917
941
  updatedAt: z.ZodString;
918
942
  }, z.core.$strip>>;
@@ -965,10 +989,13 @@ declare class GetCustomerBusinessProfiles extends AbstractApiRequest<typeof getC
965
989
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
966
990
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
967
991
  }, z.core.$strip>;
968
- billingData: z.ZodObject<{
992
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
969
993
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
970
994
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
971
- }, z.core.$strip>;
995
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
996
+ sdi?: string | null | undefined;
997
+ pec?: string | null | undefined;
998
+ }, never[]>>]>;
972
999
  createdAt: z.ZodString;
973
1000
  updatedAt: z.ZodString;
974
1001
  }, z.core.$strip>;
@@ -1020,10 +1047,13 @@ declare const getCustomerBusinessProfilesForCustomerResponseSchema: z.ZodArray<z
1020
1047
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1021
1048
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1022
1049
  }, z.core.$strip>;
1023
- billingData: z.ZodObject<{
1050
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
1024
1051
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
1025
1052
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
1026
- }, z.core.$strip>;
1053
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
1054
+ sdi?: string | null | undefined;
1055
+ pec?: string | null | undefined;
1056
+ }, never[]>>]>;
1027
1057
  createdAt: z.ZodString;
1028
1058
  updatedAt: z.ZodString;
1029
1059
  }, z.core.$strip>>;
@@ -1046,10 +1076,13 @@ declare class GetCustomerBusinessProfilesForCustomer extends AbstractApiRequest<
1046
1076
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1047
1077
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1048
1078
  }, z.core.$strip>;
1049
- billingData: z.ZodObject<{
1079
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
1050
1080
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
1051
1081
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
1052
- }, z.core.$strip>;
1082
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
1083
+ sdi?: string | null | undefined;
1084
+ pec?: string | null | undefined;
1085
+ }, never[]>>]>;
1053
1086
  createdAt: z.ZodString;
1054
1087
  updatedAt: z.ZodString;
1055
1088
  }, z.core.$strip>>;
@@ -1092,10 +1125,13 @@ declare class GetCustomerBusinessProfilesForCustomer extends AbstractApiRequest<
1092
1125
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1093
1126
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1094
1127
  }, z.core.$strip>;
1095
- billingData: z.ZodObject<{
1128
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
1096
1129
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
1097
1130
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
1098
- }, z.core.$strip>;
1131
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
1132
+ sdi?: string | null | undefined;
1133
+ pec?: string | null | undefined;
1134
+ }, never[]>>]>;
1099
1135
  createdAt: z.ZodString;
1100
1136
  updatedAt: z.ZodString;
1101
1137
  }, z.core.$strip>;
@@ -1138,10 +1174,13 @@ declare const updateCustomerBusinessProfileResponseSchema: z.ZodObject<{
1138
1174
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1139
1175
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1140
1176
  }, z.core.$strip>;
1141
- billingData: z.ZodObject<{
1177
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
1142
1178
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
1143
1179
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
1144
- }, z.core.$strip>;
1180
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
1181
+ sdi?: string | null | undefined;
1182
+ pec?: string | null | undefined;
1183
+ }, never[]>>]>;
1145
1184
  createdAt: z.ZodString;
1146
1185
  updatedAt: z.ZodString;
1147
1186
  customer: z.ZodType<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown, z.core.$ZodTypeInternals<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown>>;
@@ -1181,10 +1220,13 @@ declare class UpdateCustomerBusinessProfile extends AbstractApiRequest<typeof up
1181
1220
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1182
1221
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1183
1222
  }, z.core.$strip>;
1184
- billingData: z.ZodObject<{
1223
+ billingData: z.ZodUnion<readonly [z.ZodObject<{
1185
1224
  sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
1186
1225
  pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
1187
- }, z.core.$strip>;
1226
+ }, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodNever>, z.ZodTransform<{
1227
+ sdi?: string | null | undefined;
1228
+ pec?: string | null | undefined;
1229
+ }, never[]>>]>;
1188
1230
  createdAt: z.ZodString;
1189
1231
  updatedAt: z.ZodString;
1190
1232
  customer: z.ZodType<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown, z.core.$ZodTypeInternals<_deliverart_sdk_js_global_types.IriObject<"/customers/:id">, unknown>>;
package/dist/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  // src/models.ts
2
2
  import {
3
3
  addressSchema,
4
- billingDataSchema,
4
+ billingChannelFieldsSchema,
5
+ billingChannelReadSchema,
5
6
  booleanSchema,
6
7
  datetimeSchema,
7
8
  locationSchema,
@@ -81,7 +82,7 @@ var customerBusinessProfileSchema = z.object({
81
82
  vat: z.string(),
82
83
  taxCode: z.string(),
83
84
  billingAddress: addressSchema,
84
- billingData: billingDataSchema,
85
+ billingData: billingChannelReadSchema,
85
86
  createdAt: datetimeSchema,
86
87
  updatedAt: datetimeSchema
87
88
  });
@@ -95,7 +96,7 @@ var writableCreateCustomerBusinessProfileSchema = customerBusinessProfileDetails
95
96
  taxCode: true,
96
97
  billingAddress: true,
97
98
  billingData: true
98
- });
99
+ }).extend({ billingData: billingChannelFieldsSchema });
99
100
  var writableCustomerBusinessProfileSchema = writableCreateCustomerBusinessProfileSchema.omit({
100
101
  customer: true
101
102
  });
@@ -273,7 +274,15 @@ var UpdateCustomerAddress = class extends AbstractApiRequest6 {
273
274
 
274
275
  // src/requests/customer-business-profiles/CreateCustomerBusinessProfile.ts
275
276
  import { AbstractApiRequest as AbstractApiRequest7 } from "@deliverart/sdk-js-core";
276
- var createCustomerBusinessProfileInputSchema = writableCreateCustomerBusinessProfileSchema.required();
277
+ var createCustomerBusinessProfileInputSchema = writableCreateCustomerBusinessProfileSchema.required().superRefine((value, context) => {
278
+ if ((value.billingAddress.country || value.vat.slice(0, 2)) === "IT" && !value.billingData.sdi && !value.billingData.pec) {
279
+ context.addIssue({
280
+ code: "custom",
281
+ path: ["billingData", "sdi"],
282
+ message: "Enter SDI or PEC for Italian billing addresses."
283
+ });
284
+ }
285
+ });
277
286
  var createCustomerBusinessProfileResponseSchema = customerBusinessProfileDetailsSchema;
278
287
  var CreateCustomerBusinessProfile = class extends AbstractApiRequest7 {
279
288
  constructor(input) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deliverart/sdk-js-customer",
3
3
  "description": "Deliverart JavaScript SDK for Customer and CustomerAddress Management",
4
- "version": "3.0.2-dev.1",
4
+ "version": "3.0.2-dev.2",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -19,15 +19,16 @@
19
19
  ],
20
20
  "dependencies": {
21
21
  "zod": "4.6.6",
22
- "@deliverart/sdk-js-point-of-sale": "3.0.2-dev.1",
23
- "@deliverart/sdk-js-user": "3.0.2-dev.1",
24
- "@deliverart/sdk-js-global-types": "3.0.2-dev.1",
25
- "@deliverart/sdk-js-core": "3.0.2-dev.1"
22
+ "@deliverart/sdk-js-global-types": "3.0.2-dev.2",
23
+ "@deliverart/sdk-js-core": "3.0.2-dev.2",
24
+ "@deliverart/sdk-js-point-of-sale": "3.0.2-dev.2",
25
+ "@deliverart/sdk-js-user": "3.0.2-dev.2"
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
30
  "scripts": {
31
+ "test": "node --test src/*.test.mjs",
31
32
  "build": "tsup src/index.ts --dts --format esm,cjs",
32
33
  "dev": "tsup src/index.ts --dts --watch",
33
34
  "clean": "rm -rf dist"