@wix/auto_sdk_ecom_subscription-contracts 1.0.112 → 1.0.114

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.
Files changed (49) hide show
  1. package/build/cjs/index.d.ts +2 -2
  2. package/build/cjs/index.js +32 -3
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +371 -5
  5. package/build/cjs/index.typings.js +27 -2
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +370 -4
  8. package/build/cjs/meta.js +26 -2
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/cjs/schemas.d.ts +394 -0
  11. package/build/cjs/schemas.js +682 -8
  12. package/build/cjs/schemas.js.map +1 -1
  13. package/build/es/index.d.mts +2 -2
  14. package/build/es/index.mjs +29 -3
  15. package/build/es/index.mjs.map +1 -1
  16. package/build/es/index.typings.d.mts +371 -5
  17. package/build/es/index.typings.mjs +24 -2
  18. package/build/es/index.typings.mjs.map +1 -1
  19. package/build/es/meta.d.mts +370 -4
  20. package/build/es/meta.mjs +23 -2
  21. package/build/es/meta.mjs.map +1 -1
  22. package/build/es/schemas.d.mts +394 -0
  23. package/build/es/schemas.mjs +682 -8
  24. package/build/es/schemas.mjs.map +1 -1
  25. package/build/internal/cjs/index.d.ts +2 -2
  26. package/build/internal/cjs/index.js +32 -3
  27. package/build/internal/cjs/index.js.map +1 -1
  28. package/build/internal/cjs/index.typings.d.ts +378 -6
  29. package/build/internal/cjs/index.typings.js +27 -2
  30. package/build/internal/cjs/index.typings.js.map +1 -1
  31. package/build/internal/cjs/meta.d.ts +370 -4
  32. package/build/internal/cjs/meta.js +26 -2
  33. package/build/internal/cjs/meta.js.map +1 -1
  34. package/build/internal/cjs/schemas.d.ts +394 -0
  35. package/build/internal/cjs/schemas.js +682 -8
  36. package/build/internal/cjs/schemas.js.map +1 -1
  37. package/build/internal/es/index.d.mts +2 -2
  38. package/build/internal/es/index.mjs +29 -3
  39. package/build/internal/es/index.mjs.map +1 -1
  40. package/build/internal/es/index.typings.d.mts +378 -6
  41. package/build/internal/es/index.typings.mjs +24 -2
  42. package/build/internal/es/index.typings.mjs.map +1 -1
  43. package/build/internal/es/meta.d.mts +370 -4
  44. package/build/internal/es/meta.mjs +23 -2
  45. package/build/internal/es/meta.mjs.map +1 -1
  46. package/build/internal/es/schemas.d.mts +394 -0
  47. package/build/internal/es/schemas.mjs +682 -8
  48. package/build/internal/es/schemas.mjs.map +1 -1
  49. package/package.json +2 -2
@@ -455,7 +455,7 @@ var GetSubscriptionContractResponse = z.object({
455
455
  ).describe("Buyer information.").optional(),
456
456
  buyerLanguage: z.string().describe(
457
457
  "Language for communication with the buyer. Defaults to the site language.\nFor a site that supports multiple languages, this is the language the buyer selected."
458
- ).optional().nullable(),
458
+ ).max(10).optional().nullable(),
459
459
  weightUnit: z.enum(["UNSPECIFIED_WEIGHT_UNIT", "KG", "LB"]).describe("Weight measurement unit - defaults to site's weight unit.").optional(),
460
460
  currency: z.string().describe(
461
461
  "Currency used for the pricing of this order in [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes) format."
@@ -848,7 +848,7 @@ var GetSubscriptionContractResponse = z.object({
848
848
  })
849
849
  ])
850
850
  )
851
- ).optional(),
851
+ ).max(100).optional(),
852
852
  channelInfo: z.object({
853
853
  type: z.enum([
854
854
  "UNSPECIFIED",
@@ -885,7 +885,7 @@ var GetSubscriptionContractResponse = z.object({
885
885
  title: z.string().describe("Custom field title.").min(1).max(500).optional(),
886
886
  translatedTitle: z.string().describe("Translated custom field title.").min(1).max(500).optional().nullable()
887
887
  })
888
- ).optional(),
888
+ ).max(100).optional(),
889
889
  recipientInfo: z.object({
890
890
  address: z.object({
891
891
  streetAddress: z.object({
@@ -1025,7 +1025,340 @@ var GetSubscriptionContractResponse = z.object({
1025
1025
  lineItemIds: z.array(z.string()).optional(),
1026
1026
  source: z.enum(["SERVICE_PLUGIN", "ITEM", "MANUAL", "SHIPPING", "PLATFORM"]).describe("Specifies the entity that added the additional fee.").optional()
1027
1027
  })
1028
- ).max(100).optional()
1028
+ ).max(100).optional(),
1029
+ activities: z.array(
1030
+ z.intersection(
1031
+ z.object({
1032
+ _id: z.string().describe("Activity ID.").regex(
1033
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1034
+ "Must be a valid GUID"
1035
+ ).optional(),
1036
+ _createdDate: z.date().describe("When the activity occurred.").optional().nullable(),
1037
+ author: z.intersection(
1038
+ z.object({}),
1039
+ z.xor([
1040
+ z.object({
1041
+ userId: z.never().optional(),
1042
+ appId: z.never().optional()
1043
+ }),
1044
+ z.object({
1045
+ appId: z.never().optional(),
1046
+ userId: z.string().describe(
1047
+ "User ID. When the draft order was created by a Wix user."
1048
+ ).regex(
1049
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1050
+ "Must be a valid GUID"
1051
+ )
1052
+ }),
1053
+ z.object({
1054
+ userId: z.never().optional(),
1055
+ appId: z.string().describe(
1056
+ "App ID. When the draft order was created by an app."
1057
+ ).regex(
1058
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1059
+ "Must be a valid GUID"
1060
+ )
1061
+ })
1062
+ ])
1063
+ ).describe("Identity of the draft order's initiator.").optional(),
1064
+ activityType: z.enum(["UNKNOWN_ACTIVITY_TYPE", "CHANGES_APPLIED"]).describe("Activity type.").optional()
1065
+ }),
1066
+ z.intersection(
1067
+ z.xor([
1068
+ z.object({ contractTarget: z.never().optional() }),
1069
+ z.object({
1070
+ contractTarget: z.object({
1071
+ nextCycleNumber: z.number().int().describe(
1072
+ "Cycle number of the next billing cycle (1-based). Set by the caller; returned by the server on read."
1073
+ ).optional().nullable()
1074
+ }).describe(
1075
+ "Scopes the draft to the contract level, applying to all future cycles."
1076
+ )
1077
+ })
1078
+ ]),
1079
+ z.xor([
1080
+ z.object({ changesApplied: z.never().optional() }),
1081
+ z.object({
1082
+ changesApplied: z.intersection(
1083
+ z.object({
1084
+ draftSubscriptionContractId: z.string().describe(
1085
+ "ID of the DraftSubscriptionContract that was committed."
1086
+ ).regex(
1087
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1088
+ "Must be a valid GUID"
1089
+ ).optional(),
1090
+ changes: z.array(
1091
+ z.intersection(
1092
+ z.object({}),
1093
+ z.xor([
1094
+ z.object({
1095
+ lineItemChanged: z.never().optional(),
1096
+ lineItemAdded: z.never().optional(),
1097
+ lineItemRemoved: z.never().optional(),
1098
+ discountAdded: z.never().optional(),
1099
+ discountRemoved: z.never().optional(),
1100
+ additionalFeeAdded: z.never().optional(),
1101
+ additionalFeeRemoved: z.never().optional(),
1102
+ totalPriceChanged: z.never().optional()
1103
+ }),
1104
+ z.object({
1105
+ lineItemAdded: z.never().optional(),
1106
+ lineItemRemoved: z.never().optional(),
1107
+ discountAdded: z.never().optional(),
1108
+ discountRemoved: z.never().optional(),
1109
+ additionalFeeAdded: z.never().optional(),
1110
+ additionalFeeRemoved: z.never().optional(),
1111
+ totalPriceChanged: z.never().optional(),
1112
+ lineItemChanged: z.object({
1113
+ _id: z.string().describe("Line item ID.").regex(
1114
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1115
+ "Must be a valid GUID"
1116
+ ).optional(),
1117
+ name: z.object({
1118
+ original: z.string().describe(
1119
+ "__Required.__ Item name in the site's default language as defined in the [request envelope](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/self-hosting/supported-extensions/backend-extensions/add-self-hosted-service-plugin-extensions#request-envelope).\n\nMin: 1 character.\nMax: 200 characters."
1120
+ ).min(1).max(200).optional(),
1121
+ translated: z.string().describe(
1122
+ "Item name translated into the buyer's language.\n\nMin: 1 character.\nMax: 400 characters.\nDefault: Same as `original`."
1123
+ ).min(1).max(400).optional().nullable()
1124
+ }).describe("Item name after change.").optional(),
1125
+ quantity: z.object({
1126
+ originalQuantity: z.number().int().describe(
1127
+ "Original item quantity before the change."
1128
+ ).min(0).max(1e6).optional(),
1129
+ newQuantity: z.number().int().describe(
1130
+ "New item quantity after the change."
1131
+ ).min(0).max(1e6).optional(),
1132
+ diff: z.number().int().describe(
1133
+ "Difference between new and original quantities."
1134
+ ).min(1).max(1e6).optional(),
1135
+ deltaType: z.enum([
1136
+ "QUANTITY_INCREASED",
1137
+ "QUANTITY_DECREASED"
1138
+ ]).describe(
1139
+ "Direction of the quantity change."
1140
+ ).optional()
1141
+ }).describe("Item quantity change.").optional()
1142
+ }).describe("Line item was modified.")
1143
+ }),
1144
+ z.object({
1145
+ lineItemChanged: z.never().optional(),
1146
+ lineItemRemoved: z.never().optional(),
1147
+ discountAdded: z.never().optional(),
1148
+ discountRemoved: z.never().optional(),
1149
+ additionalFeeAdded: z.never().optional(),
1150
+ additionalFeeRemoved: z.never().optional(),
1151
+ totalPriceChanged: z.never().optional(),
1152
+ lineItemAdded: z.object({
1153
+ _id: z.string().describe("Line item ID.").regex(
1154
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1155
+ "Must be a valid GUID"
1156
+ ).optional(),
1157
+ name: z.object({
1158
+ original: z.string().describe(
1159
+ "__Required.__ Item name in the site's default language as defined in the [request envelope](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/self-hosting/supported-extensions/backend-extensions/add-self-hosted-service-plugin-extensions#request-envelope).\n\nMin: 1 character.\nMax: 200 characters."
1160
+ ).min(1).max(200).optional(),
1161
+ translated: z.string().describe(
1162
+ "Item name translated into the buyer's language.\n\nMin: 1 character.\nMax: 400 characters.\nDefault: Same as `original`."
1163
+ ).min(1).max(400).optional().nullable()
1164
+ }).describe("Item name.").optional(),
1165
+ quantity: z.number().int().describe("Added or removed item quantity.").min(1).max(1e6).optional()
1166
+ }).describe(
1167
+ "Line item was added to the contract."
1168
+ )
1169
+ }),
1170
+ z.object({
1171
+ lineItemChanged: z.never().optional(),
1172
+ lineItemAdded: z.never().optional(),
1173
+ discountAdded: z.never().optional(),
1174
+ discountRemoved: z.never().optional(),
1175
+ additionalFeeAdded: z.never().optional(),
1176
+ additionalFeeRemoved: z.never().optional(),
1177
+ totalPriceChanged: z.never().optional(),
1178
+ lineItemRemoved: z.object({
1179
+ _id: z.string().describe("Line item ID.").regex(
1180
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1181
+ "Must be a valid GUID"
1182
+ ).optional(),
1183
+ name: z.object({
1184
+ original: z.string().describe(
1185
+ "__Required.__ Item name in the site's default language as defined in the [request envelope](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/self-hosting/supported-extensions/backend-extensions/add-self-hosted-service-plugin-extensions#request-envelope).\n\nMin: 1 character.\nMax: 200 characters."
1186
+ ).min(1).max(200).optional(),
1187
+ translated: z.string().describe(
1188
+ "Item name translated into the buyer's language.\n\nMin: 1 character.\nMax: 400 characters.\nDefault: Same as `original`."
1189
+ ).min(1).max(400).optional().nullable()
1190
+ }).describe("Item name.").optional(),
1191
+ quantity: z.number().int().describe("Added or removed item quantity.").min(1).max(1e6).optional()
1192
+ }).describe(
1193
+ "Line item was removed from the contract."
1194
+ )
1195
+ }),
1196
+ z.object({
1197
+ lineItemChanged: z.never().optional(),
1198
+ lineItemAdded: z.never().optional(),
1199
+ lineItemRemoved: z.never().optional(),
1200
+ discountRemoved: z.never().optional(),
1201
+ additionalFeeAdded: z.never().optional(),
1202
+ additionalFeeRemoved: z.never().optional(),
1203
+ totalPriceChanged: z.never().optional(),
1204
+ discountAdded: z.object({
1205
+ _id: z.string().describe("Discount ID.").regex(
1206
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1207
+ "Must be a valid GUID"
1208
+ ).optional(),
1209
+ name: z.object({
1210
+ original: z.string().describe(
1211
+ "Value in site default language."
1212
+ ).min(1).optional(),
1213
+ translated: z.string().describe("Translated value.").min(1).optional().nullable()
1214
+ }).describe("Discount name.").optional(),
1215
+ totalAmount: z.object({
1216
+ amount: z.string().describe("Amount.").optional(),
1217
+ formattedAmount: z.string().describe(
1218
+ "Amount formatted with currency symbol."
1219
+ ).optional()
1220
+ }).describe("Discount amount.").optional()
1221
+ }).describe(
1222
+ "Discount was added to the contract."
1223
+ )
1224
+ }),
1225
+ z.object({
1226
+ lineItemChanged: z.never().optional(),
1227
+ lineItemAdded: z.never().optional(),
1228
+ lineItemRemoved: z.never().optional(),
1229
+ discountAdded: z.never().optional(),
1230
+ additionalFeeAdded: z.never().optional(),
1231
+ additionalFeeRemoved: z.never().optional(),
1232
+ totalPriceChanged: z.never().optional(),
1233
+ discountRemoved: z.object({
1234
+ _id: z.string().describe("Discount ID.").regex(
1235
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1236
+ "Must be a valid GUID"
1237
+ ).optional(),
1238
+ name: z.object({
1239
+ original: z.string().describe(
1240
+ "Value in site default language."
1241
+ ).min(1).optional(),
1242
+ translated: z.string().describe("Translated value.").min(1).optional().nullable()
1243
+ }).describe("Discount name.").optional(),
1244
+ totalAmount: z.object({
1245
+ amount: z.string().describe("Amount.").optional(),
1246
+ formattedAmount: z.string().describe(
1247
+ "Amount formatted with currency symbol."
1248
+ ).optional()
1249
+ }).describe("Discount amount.").optional()
1250
+ }).describe(
1251
+ "Discount was removed from the contract."
1252
+ )
1253
+ }),
1254
+ z.object({
1255
+ lineItemChanged: z.never().optional(),
1256
+ lineItemAdded: z.never().optional(),
1257
+ lineItemRemoved: z.never().optional(),
1258
+ discountAdded: z.never().optional(),
1259
+ discountRemoved: z.never().optional(),
1260
+ additionalFeeRemoved: z.never().optional(),
1261
+ totalPriceChanged: z.never().optional(),
1262
+ additionalFeeAdded: z.object({
1263
+ _id: z.string().describe("Additional fee ID.").regex(
1264
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1265
+ "Must be a valid GUID"
1266
+ ).optional(),
1267
+ name: z.object({
1268
+ original: z.string().describe(
1269
+ "Value in site default language."
1270
+ ).min(1).optional(),
1271
+ translated: z.string().describe("Translated value.").min(1).optional().nullable()
1272
+ }).describe("Additional fee name.").optional(),
1273
+ totalAmount: z.object({
1274
+ amount: z.string().describe("Amount.").optional(),
1275
+ formattedAmount: z.string().describe(
1276
+ "Amount formatted with currency symbol."
1277
+ ).optional()
1278
+ }).describe("Additional fee amount.").optional()
1279
+ }).describe(
1280
+ "Additional fee was added to the contract."
1281
+ )
1282
+ }),
1283
+ z.object({
1284
+ lineItemChanged: z.never().optional(),
1285
+ lineItemAdded: z.never().optional(),
1286
+ lineItemRemoved: z.never().optional(),
1287
+ discountAdded: z.never().optional(),
1288
+ discountRemoved: z.never().optional(),
1289
+ additionalFeeAdded: z.never().optional(),
1290
+ totalPriceChanged: z.never().optional(),
1291
+ additionalFeeRemoved: z.object({
1292
+ _id: z.string().describe("Additional fee ID.").regex(
1293
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1294
+ "Must be a valid GUID"
1295
+ ).optional(),
1296
+ name: z.object({
1297
+ original: z.string().describe(
1298
+ "Value in site default language."
1299
+ ).min(1).optional(),
1300
+ translated: z.string().describe("Translated value.").min(1).optional().nullable()
1301
+ }).describe("Additional fee name.").optional(),
1302
+ totalAmount: z.object({
1303
+ amount: z.string().describe("Amount.").optional(),
1304
+ formattedAmount: z.string().describe(
1305
+ "Amount formatted with currency symbol."
1306
+ ).optional()
1307
+ }).describe("Additional fee amount.").optional()
1308
+ }).describe(
1309
+ "Additional fee was removed from the contract."
1310
+ )
1311
+ }),
1312
+ z.object({
1313
+ lineItemChanged: z.never().optional(),
1314
+ lineItemAdded: z.never().optional(),
1315
+ lineItemRemoved: z.never().optional(),
1316
+ discountAdded: z.never().optional(),
1317
+ discountRemoved: z.never().optional(),
1318
+ additionalFeeAdded: z.never().optional(),
1319
+ additionalFeeRemoved: z.never().optional(),
1320
+ totalPriceChanged: z.object({
1321
+ originalTotal: z.object({
1322
+ amount: z.string().describe("Amount.").optional(),
1323
+ formattedAmount: z.string().describe(
1324
+ "Amount formatted with currency symbol."
1325
+ ).optional()
1326
+ }).describe("Total price before the commit.").optional(),
1327
+ newTotal: z.object({
1328
+ amount: z.string().describe("Amount.").optional(),
1329
+ formattedAmount: z.string().describe(
1330
+ "Amount formatted with currency symbol."
1331
+ ).optional()
1332
+ }).describe("Total price after the commit.").optional()
1333
+ }).describe("Total price changed.")
1334
+ })
1335
+ ])
1336
+ )
1337
+ ).max(100).optional(),
1338
+ reason: z.string().describe(
1339
+ "Reason for the edit, provided by the merchant (optional)."
1340
+ ).max(200).optional().nullable()
1341
+ }),
1342
+ z.xor([
1343
+ z.object({ contractTarget: z.never().optional() }),
1344
+ z.object({
1345
+ contractTarget: z.object({
1346
+ nextCycleNumber: z.number().int().describe(
1347
+ "Cycle number of the next billing cycle (1-based). Set by the caller; returned by the server on read."
1348
+ ).optional().nullable()
1349
+ }).describe(
1350
+ "Scopes the draft to the contract level, applying to all future cycles."
1351
+ )
1352
+ })
1353
+ ])
1354
+ ).describe(
1355
+ "Changes committed from a DraftSubscriptionContract."
1356
+ )
1357
+ })
1358
+ ])
1359
+ )
1360
+ )
1361
+ ).max(500).optional()
1029
1362
  });
1030
1363
  var QuerySubscriptionContractsRequest = z.object({
1031
1364
  query: z.intersection(
@@ -1530,7 +1863,7 @@ var QuerySubscriptionContractsResponse = z.object({
1530
1863
  ).describe("Buyer information.").optional(),
1531
1864
  buyerLanguage: z.string().describe(
1532
1865
  "Language for communication with the buyer. Defaults to the site language.\nFor a site that supports multiple languages, this is the language the buyer selected."
1533
- ).optional().nullable(),
1866
+ ).max(10).optional().nullable(),
1534
1867
  weightUnit: z.enum(["UNSPECIFIED_WEIGHT_UNIT", "KG", "LB"]).describe("Weight measurement unit - defaults to site's weight unit.").optional(),
1535
1868
  currency: z.string().describe(
1536
1869
  "Currency used for the pricing of this order in [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes) format."
@@ -1951,7 +2284,7 @@ var QuerySubscriptionContractsResponse = z.object({
1951
2284
  })
1952
2285
  ])
1953
2286
  )
1954
- ).optional(),
2287
+ ).max(100).optional(),
1955
2288
  channelInfo: z.object({
1956
2289
  type: z.enum([
1957
2290
  "UNSPECIFIED",
@@ -1990,7 +2323,7 @@ var QuerySubscriptionContractsResponse = z.object({
1990
2323
  title: z.string().describe("Custom field title.").min(1).max(500).optional(),
1991
2324
  translatedTitle: z.string().describe("Translated custom field title.").min(1).max(500).optional().nullable()
1992
2325
  })
1993
- ).optional(),
2326
+ ).max(100).optional(),
1994
2327
  recipientInfo: z.object({
1995
2328
  address: z.object({
1996
2329
  streetAddress: z.object({
@@ -2148,7 +2481,348 @@ var QuerySubscriptionContractsResponse = z.object({
2148
2481
  "PLATFORM"
2149
2482
  ]).describe("Specifies the entity that added the additional fee.").optional()
2150
2483
  })
2151
- ).max(100).optional()
2484
+ ).max(100).optional(),
2485
+ activities: z.array(
2486
+ z.intersection(
2487
+ z.object({
2488
+ _id: z.string().describe("Activity ID.").regex(
2489
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2490
+ "Must be a valid GUID"
2491
+ ).optional(),
2492
+ _createdDate: z.date().describe("When the activity occurred.").optional().nullable(),
2493
+ author: z.intersection(
2494
+ z.object({}),
2495
+ z.xor([
2496
+ z.object({
2497
+ userId: z.never().optional(),
2498
+ appId: z.never().optional()
2499
+ }),
2500
+ z.object({
2501
+ appId: z.never().optional(),
2502
+ userId: z.string().describe(
2503
+ "User ID. When the draft order was created by a Wix user."
2504
+ ).regex(
2505
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2506
+ "Must be a valid GUID"
2507
+ )
2508
+ }),
2509
+ z.object({
2510
+ userId: z.never().optional(),
2511
+ appId: z.string().describe(
2512
+ "App ID. When the draft order was created by an app."
2513
+ ).regex(
2514
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2515
+ "Must be a valid GUID"
2516
+ )
2517
+ })
2518
+ ])
2519
+ ).describe("Identity of the draft order's initiator.").optional(),
2520
+ activityType: z.enum(["UNKNOWN_ACTIVITY_TYPE", "CHANGES_APPLIED"]).describe("Activity type.").optional()
2521
+ }),
2522
+ z.intersection(
2523
+ z.xor([
2524
+ z.object({ contractTarget: z.never().optional() }),
2525
+ z.object({
2526
+ contractTarget: z.object({
2527
+ nextCycleNumber: z.number().int().describe(
2528
+ "Cycle number of the next billing cycle (1-based). Set by the caller; returned by the server on read."
2529
+ ).optional().nullable()
2530
+ }).describe(
2531
+ "Scopes the draft to the contract level, applying to all future cycles."
2532
+ )
2533
+ })
2534
+ ]),
2535
+ z.xor([
2536
+ z.object({ changesApplied: z.never().optional() }),
2537
+ z.object({
2538
+ changesApplied: z.intersection(
2539
+ z.object({
2540
+ draftSubscriptionContractId: z.string().describe(
2541
+ "ID of the DraftSubscriptionContract that was committed."
2542
+ ).regex(
2543
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2544
+ "Must be a valid GUID"
2545
+ ).optional(),
2546
+ changes: z.array(
2547
+ z.intersection(
2548
+ z.object({}),
2549
+ z.xor([
2550
+ z.object({
2551
+ lineItemChanged: z.never().optional(),
2552
+ lineItemAdded: z.never().optional(),
2553
+ lineItemRemoved: z.never().optional(),
2554
+ discountAdded: z.never().optional(),
2555
+ discountRemoved: z.never().optional(),
2556
+ additionalFeeAdded: z.never().optional(),
2557
+ additionalFeeRemoved: z.never().optional(),
2558
+ totalPriceChanged: z.never().optional()
2559
+ }),
2560
+ z.object({
2561
+ lineItemAdded: z.never().optional(),
2562
+ lineItemRemoved: z.never().optional(),
2563
+ discountAdded: z.never().optional(),
2564
+ discountRemoved: z.never().optional(),
2565
+ additionalFeeAdded: z.never().optional(),
2566
+ additionalFeeRemoved: z.never().optional(),
2567
+ totalPriceChanged: z.never().optional(),
2568
+ lineItemChanged: z.object({
2569
+ _id: z.string().describe("Line item ID.").regex(
2570
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2571
+ "Must be a valid GUID"
2572
+ ).optional(),
2573
+ name: z.object({
2574
+ original: z.string().describe(
2575
+ "__Required.__ Item name in the site's default language as defined in the [request envelope](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/self-hosting/supported-extensions/backend-extensions/add-self-hosted-service-plugin-extensions#request-envelope).\n\nMin: 1 character.\nMax: 200 characters."
2576
+ ).min(1).max(200).optional(),
2577
+ translated: z.string().describe(
2578
+ "Item name translated into the buyer's language.\n\nMin: 1 character.\nMax: 400 characters.\nDefault: Same as `original`."
2579
+ ).min(1).max(400).optional().nullable()
2580
+ }).describe("Item name after change.").optional(),
2581
+ quantity: z.object({
2582
+ originalQuantity: z.number().int().describe(
2583
+ "Original item quantity before the change."
2584
+ ).min(0).max(1e6).optional(),
2585
+ newQuantity: z.number().int().describe(
2586
+ "New item quantity after the change."
2587
+ ).min(0).max(1e6).optional(),
2588
+ diff: z.number().int().describe(
2589
+ "Difference between new and original quantities."
2590
+ ).min(1).max(1e6).optional(),
2591
+ deltaType: z.enum([
2592
+ "QUANTITY_INCREASED",
2593
+ "QUANTITY_DECREASED"
2594
+ ]).describe(
2595
+ "Direction of the quantity change."
2596
+ ).optional()
2597
+ }).describe("Item quantity change.").optional()
2598
+ }).describe("Line item was modified.")
2599
+ }),
2600
+ z.object({
2601
+ lineItemChanged: z.never().optional(),
2602
+ lineItemRemoved: z.never().optional(),
2603
+ discountAdded: z.never().optional(),
2604
+ discountRemoved: z.never().optional(),
2605
+ additionalFeeAdded: z.never().optional(),
2606
+ additionalFeeRemoved: z.never().optional(),
2607
+ totalPriceChanged: z.never().optional(),
2608
+ lineItemAdded: z.object({
2609
+ _id: z.string().describe("Line item ID.").regex(
2610
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2611
+ "Must be a valid GUID"
2612
+ ).optional(),
2613
+ name: z.object({
2614
+ original: z.string().describe(
2615
+ "__Required.__ Item name in the site's default language as defined in the [request envelope](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/self-hosting/supported-extensions/backend-extensions/add-self-hosted-service-plugin-extensions#request-envelope).\n\nMin: 1 character.\nMax: 200 characters."
2616
+ ).min(1).max(200).optional(),
2617
+ translated: z.string().describe(
2618
+ "Item name translated into the buyer's language.\n\nMin: 1 character.\nMax: 400 characters.\nDefault: Same as `original`."
2619
+ ).min(1).max(400).optional().nullable()
2620
+ }).describe("Item name.").optional(),
2621
+ quantity: z.number().int().describe(
2622
+ "Added or removed item quantity."
2623
+ ).min(1).max(1e6).optional()
2624
+ }).describe(
2625
+ "Line item was added to the contract."
2626
+ )
2627
+ }),
2628
+ z.object({
2629
+ lineItemChanged: z.never().optional(),
2630
+ lineItemAdded: z.never().optional(),
2631
+ discountAdded: z.never().optional(),
2632
+ discountRemoved: z.never().optional(),
2633
+ additionalFeeAdded: z.never().optional(),
2634
+ additionalFeeRemoved: z.never().optional(),
2635
+ totalPriceChanged: z.never().optional(),
2636
+ lineItemRemoved: z.object({
2637
+ _id: z.string().describe("Line item ID.").regex(
2638
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2639
+ "Must be a valid GUID"
2640
+ ).optional(),
2641
+ name: z.object({
2642
+ original: z.string().describe(
2643
+ "__Required.__ Item name in the site's default language as defined in the [request envelope](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/self-hosting/supported-extensions/backend-extensions/add-self-hosted-service-plugin-extensions#request-envelope).\n\nMin: 1 character.\nMax: 200 characters."
2644
+ ).min(1).max(200).optional(),
2645
+ translated: z.string().describe(
2646
+ "Item name translated into the buyer's language.\n\nMin: 1 character.\nMax: 400 characters.\nDefault: Same as `original`."
2647
+ ).min(1).max(400).optional().nullable()
2648
+ }).describe("Item name.").optional(),
2649
+ quantity: z.number().int().describe(
2650
+ "Added or removed item quantity."
2651
+ ).min(1).max(1e6).optional()
2652
+ }).describe(
2653
+ "Line item was removed from the contract."
2654
+ )
2655
+ }),
2656
+ z.object({
2657
+ lineItemChanged: z.never().optional(),
2658
+ lineItemAdded: z.never().optional(),
2659
+ lineItemRemoved: z.never().optional(),
2660
+ discountRemoved: z.never().optional(),
2661
+ additionalFeeAdded: z.never().optional(),
2662
+ additionalFeeRemoved: z.never().optional(),
2663
+ totalPriceChanged: z.never().optional(),
2664
+ discountAdded: z.object({
2665
+ _id: z.string().describe("Discount ID.").regex(
2666
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2667
+ "Must be a valid GUID"
2668
+ ).optional(),
2669
+ name: z.object({
2670
+ original: z.string().describe(
2671
+ "Value in site default language."
2672
+ ).min(1).optional(),
2673
+ translated: z.string().describe("Translated value.").min(1).optional().nullable()
2674
+ }).describe("Discount name.").optional(),
2675
+ totalAmount: z.object({
2676
+ amount: z.string().describe("Amount.").optional(),
2677
+ formattedAmount: z.string().describe(
2678
+ "Amount formatted with currency symbol."
2679
+ ).optional()
2680
+ }).describe("Discount amount.").optional()
2681
+ }).describe(
2682
+ "Discount was added to the contract."
2683
+ )
2684
+ }),
2685
+ z.object({
2686
+ lineItemChanged: z.never().optional(),
2687
+ lineItemAdded: z.never().optional(),
2688
+ lineItemRemoved: z.never().optional(),
2689
+ discountAdded: z.never().optional(),
2690
+ additionalFeeAdded: z.never().optional(),
2691
+ additionalFeeRemoved: z.never().optional(),
2692
+ totalPriceChanged: z.never().optional(),
2693
+ discountRemoved: z.object({
2694
+ _id: z.string().describe("Discount ID.").regex(
2695
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2696
+ "Must be a valid GUID"
2697
+ ).optional(),
2698
+ name: z.object({
2699
+ original: z.string().describe(
2700
+ "Value in site default language."
2701
+ ).min(1).optional(),
2702
+ translated: z.string().describe("Translated value.").min(1).optional().nullable()
2703
+ }).describe("Discount name.").optional(),
2704
+ totalAmount: z.object({
2705
+ amount: z.string().describe("Amount.").optional(),
2706
+ formattedAmount: z.string().describe(
2707
+ "Amount formatted with currency symbol."
2708
+ ).optional()
2709
+ }).describe("Discount amount.").optional()
2710
+ }).describe(
2711
+ "Discount was removed from the contract."
2712
+ )
2713
+ }),
2714
+ z.object({
2715
+ lineItemChanged: z.never().optional(),
2716
+ lineItemAdded: z.never().optional(),
2717
+ lineItemRemoved: z.never().optional(),
2718
+ discountAdded: z.never().optional(),
2719
+ discountRemoved: z.never().optional(),
2720
+ additionalFeeRemoved: z.never().optional(),
2721
+ totalPriceChanged: z.never().optional(),
2722
+ additionalFeeAdded: z.object({
2723
+ _id: z.string().describe("Additional fee ID.").regex(
2724
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2725
+ "Must be a valid GUID"
2726
+ ).optional(),
2727
+ name: z.object({
2728
+ original: z.string().describe(
2729
+ "Value in site default language."
2730
+ ).min(1).optional(),
2731
+ translated: z.string().describe("Translated value.").min(1).optional().nullable()
2732
+ }).describe("Additional fee name.").optional(),
2733
+ totalAmount: z.object({
2734
+ amount: z.string().describe("Amount.").optional(),
2735
+ formattedAmount: z.string().describe(
2736
+ "Amount formatted with currency symbol."
2737
+ ).optional()
2738
+ }).describe("Additional fee amount.").optional()
2739
+ }).describe(
2740
+ "Additional fee was added to the contract."
2741
+ )
2742
+ }),
2743
+ z.object({
2744
+ lineItemChanged: z.never().optional(),
2745
+ lineItemAdded: z.never().optional(),
2746
+ lineItemRemoved: z.never().optional(),
2747
+ discountAdded: z.never().optional(),
2748
+ discountRemoved: z.never().optional(),
2749
+ additionalFeeAdded: z.never().optional(),
2750
+ totalPriceChanged: z.never().optional(),
2751
+ additionalFeeRemoved: z.object({
2752
+ _id: z.string().describe("Additional fee ID.").regex(
2753
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2754
+ "Must be a valid GUID"
2755
+ ).optional(),
2756
+ name: z.object({
2757
+ original: z.string().describe(
2758
+ "Value in site default language."
2759
+ ).min(1).optional(),
2760
+ translated: z.string().describe("Translated value.").min(1).optional().nullable()
2761
+ }).describe("Additional fee name.").optional(),
2762
+ totalAmount: z.object({
2763
+ amount: z.string().describe("Amount.").optional(),
2764
+ formattedAmount: z.string().describe(
2765
+ "Amount formatted with currency symbol."
2766
+ ).optional()
2767
+ }).describe("Additional fee amount.").optional()
2768
+ }).describe(
2769
+ "Additional fee was removed from the contract."
2770
+ )
2771
+ }),
2772
+ z.object({
2773
+ lineItemChanged: z.never().optional(),
2774
+ lineItemAdded: z.never().optional(),
2775
+ lineItemRemoved: z.never().optional(),
2776
+ discountAdded: z.never().optional(),
2777
+ discountRemoved: z.never().optional(),
2778
+ additionalFeeAdded: z.never().optional(),
2779
+ additionalFeeRemoved: z.never().optional(),
2780
+ totalPriceChanged: z.object({
2781
+ originalTotal: z.object({
2782
+ amount: z.string().describe("Amount.").optional(),
2783
+ formattedAmount: z.string().describe(
2784
+ "Amount formatted with currency symbol."
2785
+ ).optional()
2786
+ }).describe(
2787
+ "Total price before the commit."
2788
+ ).optional(),
2789
+ newTotal: z.object({
2790
+ amount: z.string().describe("Amount.").optional(),
2791
+ formattedAmount: z.string().describe(
2792
+ "Amount formatted with currency symbol."
2793
+ ).optional()
2794
+ }).describe(
2795
+ "Total price after the commit."
2796
+ ).optional()
2797
+ }).describe("Total price changed.")
2798
+ })
2799
+ ])
2800
+ )
2801
+ ).max(100).optional(),
2802
+ reason: z.string().describe(
2803
+ "Reason for the edit, provided by the merchant (optional)."
2804
+ ).max(200).optional().nullable()
2805
+ }),
2806
+ z.xor([
2807
+ z.object({ contractTarget: z.never().optional() }),
2808
+ z.object({
2809
+ contractTarget: z.object({
2810
+ nextCycleNumber: z.number().int().describe(
2811
+ "Cycle number of the next billing cycle (1-based). Set by the caller; returned by the server on read."
2812
+ ).optional().nullable()
2813
+ }).describe(
2814
+ "Scopes the draft to the contract level, applying to all future cycles."
2815
+ )
2816
+ })
2817
+ ])
2818
+ ).describe(
2819
+ "Changes committed from a DraftSubscriptionContract."
2820
+ )
2821
+ })
2822
+ ])
2823
+ )
2824
+ )
2825
+ ).max(500).optional()
2152
2826
  })
2153
2827
  ).optional(),
2154
2828
  pagingMetadata: z.object({