@ecomweb/sdk 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -244,7 +244,7 @@ var emailBrandingShape = {
244
244
  var emailBrandingSchema = z3.object(emailBrandingShape);
245
245
 
246
246
  // src/types/store.ts
247
- import { z as z6 } from "zod";
247
+ import { z as z5 } from "zod";
248
248
 
249
249
  // src/types/embedded-script.ts
250
250
  import { z as z4 } from "zod";
@@ -268,247 +268,25 @@ var createEmbeddedScriptSchema = embeddedScriptSchema.pick({
268
268
  });
269
269
  var updateEmbeddedScriptSchema = createEmbeddedScriptSchema.partial();
270
270
 
271
- // src/types/storefront-builder.ts
272
- import { z as z5 } from "zod";
273
- var sectionTypeSchema = z5.enum([
274
- "hero_banner",
275
- "category_grid",
276
- "collection_grid",
277
- "featured_products",
278
- "text_with_image",
279
- "rich_text",
280
- "newsletter_signup"
281
- ]);
282
- var sectionStyleSchema = z5.object({
283
- background_color: z5.string().optional(),
284
- text_color: z5.string().optional(),
285
- padding_top: z5.string().optional(),
286
- padding_right: z5.string().optional(),
287
- padding_bottom: z5.string().optional(),
288
- padding_left: z5.string().optional(),
289
- margin_top: z5.string().optional(),
290
- margin_right: z5.string().optional(),
291
- margin_bottom: z5.string().optional(),
292
- margin_left: z5.string().optional(),
293
- text_align: z5.enum(["left", "center", "right", "justify"]).optional(),
294
- max_width: z5.enum(["full", "xl", "lg", "md"]).optional()
295
- });
296
- var heroBannerItemSchema = z5.object({
297
- id: z5.string(),
298
- title: z5.string().optional(),
299
- subtitle: z5.string().optional(),
300
- image_url: z5.string().min(1),
301
- link_url: z5.string().optional(),
302
- button_text: z5.string().optional()
303
- });
304
- var heroBannerConfigSchema = z5.object({
305
- banners: z5.array(heroBannerItemSchema).default([]),
306
- autoplay: z5.boolean().default(true),
307
- autoplay_interval: z5.number().min(1e3).max(3e4).default(5e3)
308
- });
309
- var categoryGridConfigSchema = z5.object({
310
- category_ids: z5.array(z5.number()).default([]),
311
- columns: z5.union([z5.literal(2), z5.literal(3), z5.literal(4), z5.literal(6)]).default(4),
312
- show_names: z5.boolean().default(true),
313
- show_count: z5.boolean().default(false),
314
- title: z5.string().optional()
315
- });
316
- var collectionGridConfigSchema = z5.object({
317
- collection_ids: z5.array(z5.number()).default([]),
318
- columns: z5.union([z5.literal(2), z5.literal(3), z5.literal(4), z5.literal(6)]).default(4),
319
- show_names: z5.boolean().default(true),
320
- show_count: z5.boolean().default(false),
321
- title: z5.string().optional()
322
- });
323
- var featuredProductsConfigSchema = z5.object({
324
- collection_slug: z5.string().optional(),
325
- product_ids: z5.array(z5.number()).optional(),
326
- limit: z5.number().min(1).max(48).default(12),
327
- columns: z5.union([z5.literal(2), z5.literal(3), z5.literal(4), z5.literal(6)]).default(4),
328
- title: z5.string().optional()
329
- });
330
- var textWithImageConfigSchema = z5.object({
331
- content: z5.string().default(""),
332
- image_url: z5.string().default(""),
333
- image_position: z5.enum(["left", "right"]).default("right")
334
- });
335
- var richTextConfigSchema = z5.object({
336
- content: z5.string().default("")
337
- });
338
- var newsletterSignupConfigSchema = z5.object({
339
- title: z5.string().optional(),
340
- description: z5.string().optional(),
341
- button_text: z5.string().optional()
342
- });
343
- var sectionConfigSchema = z5.union([
344
- heroBannerConfigSchema,
345
- categoryGridConfigSchema,
346
- collectionGridConfigSchema,
347
- featuredProductsConfigSchema,
348
- textWithImageConfigSchema,
349
- richTextConfigSchema,
350
- newsletterSignupConfigSchema
351
- ]);
352
- var builderSectionSchema = z5.object({
353
- id: z5.string(),
354
- type: sectionTypeSchema,
355
- title: z5.string().optional(),
356
- is_visible: z5.boolean().default(true),
357
- content: z5.record(z5.string(), z5.any()).default({}),
358
- style: sectionStyleSchema.default({})
359
- });
360
- var SECTION_CONFIG_SCHEMAS = {
361
- hero_banner: heroBannerConfigSchema,
362
- category_grid: categoryGridConfigSchema,
363
- collection_grid: collectionGridConfigSchema,
364
- featured_products: featuredProductsConfigSchema,
365
- text_with_image: textWithImageConfigSchema,
366
- rich_text: richTextConfigSchema,
367
- newsletter_signup: newsletterSignupConfigSchema
368
- };
369
- function parseSectionContent(type, content) {
370
- return SECTION_CONFIG_SCHEMAS[type].parse(content);
371
- }
372
- var WIDGET_REGISTRY = {
373
- hero_banner: {
374
- type: "hero_banner",
375
- name: "section_types.hero_banner",
376
- icon: "Image",
377
- description: "type_descriptions.hero_banner",
378
- category: "media",
379
- defaultContent: { banners: [], autoplay: true, autoplay_interval: 5e3 },
380
- defaultStyle: { padding_top: "0", padding_bottom: "0" }
381
- },
382
- category_grid: {
383
- type: "category_grid",
384
- name: "section_types.category_grid",
385
- icon: "Grid3X3",
386
- description: "type_descriptions.category_grid",
387
- category: "commerce",
388
- defaultContent: { category_ids: [], columns: 4, show_names: true, show_count: false, title: "" },
389
- defaultStyle: { padding_top: "2rem", padding_bottom: "2rem" }
390
- },
391
- collection_grid: {
392
- type: "collection_grid",
393
- name: "section_types.collection_grid",
394
- icon: "Grid3X3",
395
- description: "type_descriptions.collection_grid",
396
- category: "commerce",
397
- defaultContent: {
398
- collection_ids: [],
399
- columns: 4,
400
- show_names: true,
401
- show_count: false,
402
- title: ""
403
- },
404
- defaultStyle: { padding_top: "2rem", padding_bottom: "2rem" }
405
- },
406
- featured_products: {
407
- type: "featured_products",
408
- name: "section_types.featured_products",
409
- icon: "Package",
410
- description: "type_descriptions.featured_products",
411
- category: "commerce",
412
- defaultContent: { collection_slug: "", limit: 12, columns: 4, title: "" },
413
- defaultStyle: { padding_top: "2rem", padding_bottom: "2rem" }
414
- },
415
- text_with_image: {
416
- type: "text_with_image",
417
- name: "section_types.text_with_image",
418
- icon: "LayoutList",
419
- description: "type_descriptions.text_with_image",
420
- category: "content",
421
- defaultContent: { content: "", image_url: "", image_position: "right" },
422
- defaultStyle: { padding_top: "2rem", padding_bottom: "2rem" }
423
- },
424
- rich_text: {
425
- type: "rich_text",
426
- name: "section_types.rich_text",
427
- icon: "Type",
428
- description: "type_descriptions.rich_text",
429
- category: "content",
430
- defaultContent: { content: "" },
431
- defaultStyle: { padding_top: "2rem", padding_bottom: "2rem", max_width: "lg" }
432
- },
433
- newsletter_signup: {
434
- type: "newsletter_signup",
435
- name: "section_types.newsletter_signup",
436
- icon: "Mail",
437
- description: "type_descriptions.newsletter_signup",
438
- category: "engagement",
439
- defaultContent: { title: "", description: "", button_text: "" },
440
- defaultStyle: { padding_top: "2rem", padding_bottom: "2rem", max_width: "lg" }
441
- }
442
- };
443
- var headerConfigSchema = z5.object({
444
- show_logo: z5.boolean().default(true),
445
- show_search: z5.boolean().default(true),
446
- show_cart: z5.boolean().default(true),
447
- show_auth: z5.boolean().default(true),
448
- main_menu_ref: z5.string().optional(),
449
- background_color: z5.string().optional(),
450
- text_color: z5.string().optional(),
451
- // Topbar (announcement bar above header)
452
- topbar_message: z5.string().optional(),
453
- topbar_container_class: z5.string().optional()
454
- });
455
- var footerConfigSchema = z5.object({
456
- show_logo: z5.boolean().default(true),
457
- show_social_links: z5.boolean().default(true),
458
- customer_support_menu_ref: z5.string().optional(),
459
- about_us_menu_ref: z5.string().optional(),
460
- copyright_text: z5.string().optional(),
461
- background_color: z5.string().optional(),
462
- text_color: z5.string().optional()
463
- });
464
- var builderThemeConfigSchema = z5.object({
465
- // Legacy fields (preserved for backward compat)
466
- menu: z5.object({
467
- main_menu: z5.string().optional(),
468
- customer_support_menu: z5.string().optional(),
469
- about_us_menu: z5.string().optional()
470
- }).optional(),
471
- topbar: z5.object({
472
- message: z5.string().optional(),
473
- container_class: z5.string().optional()
474
- }).optional(),
475
- homepage: z5.object({
476
- collection_slug: z5.string().optional()
477
- }).optional(),
478
- checkout: z5.object({
479
- term_link: z5.string().optional(),
480
- policy_link: z5.string().optional()
481
- }).optional(),
482
- // Builder fields
483
- sections: z5.array(builderSectionSchema).optional(),
484
- header: headerConfigSchema.optional(),
485
- footer: footerConfigSchema.optional()
486
- }).passthrough();
487
- var themeVersionSchema = z5.object({
488
- id: z5.number(),
489
- name: z5.string(),
490
- theme_config_snapshot: builderThemeConfigSchema,
491
- created_by: z5.string(),
492
- created_at: z5.string(),
493
- updated_at: z5.string()
494
- });
495
-
496
271
  // src/types/store.ts
497
- var storeSchema = z6.object({
272
+ var storeSchema = z5.object({
498
273
  id: idSchema,
499
274
  user_id: uuidSchema,
500
- name: z6.string().min(1),
501
- description: z6.string().optional().nullable(),
275
+ name: z5.string().min(1),
276
+ description: z5.string().optional().nullable(),
502
277
  status: storeStatusSchema.default("pending")
503
278
  }).extend(timestampSchema.shape).extend(deletedAtSchema.shape);
504
- var storeConfigSchema = z6.object({
279
+ var storeConfigSchema = z5.object({
505
280
  id: idSchema,
506
281
  store_id: idSchema,
507
- subdomain: z6.string().optional().nullable(),
508
- custom_domain: z6.string().optional().nullable()
282
+ subdomain: z5.string().optional().nullable(),
283
+ custom_domain: z5.string().optional().nullable()
509
284
  }).extend(timestampSchema.shape);
510
- var themeConfigSchema = builderThemeConfigSchema.optional().nullable();
511
- var storeSettingsSchema = z6.object({
285
+ var legalLinksSchema = z5.object({
286
+ terms: z5.string().optional().nullable(),
287
+ privacy: z5.string().optional().nullable()
288
+ }).optional().nullable();
289
+ var storeSettingsSchema = z5.object({
512
290
  id: idSchema,
513
291
  store_id: idSchema,
514
292
  logo_url: urlSchema,
@@ -518,21 +296,21 @@ var storeSettingsSchema = z6.object({
518
296
  shopee_link: urlSchema,
519
297
  facebook_link: urlSchema,
520
298
  instagram_link: urlSchema,
521
- google_analytics_key: z6.string().optional().nullable(),
522
- shop_introduction: z6.string().optional().nullable(),
523
- tagline: z6.string().optional().nullable(),
524
- blog_title: z6.string().optional().nullable(),
525
- is_blog_enabled: z6.boolean().optional().nullable(),
526
- currency_code: z6.string().min(3).max(3).default("VND").optional().nullable(),
527
- review_requests_enabled: z6.boolean().optional().nullable(),
299
+ google_analytics_key: z5.string().optional().nullable(),
300
+ shop_introduction: z5.string().optional().nullable(),
301
+ tagline: z5.string().optional().nullable(),
302
+ blog_title: z5.string().optional().nullable(),
303
+ is_blog_enabled: z5.boolean().optional().nullable(),
304
+ currency_code: z5.string().min(3).max(3).default("VND").optional().nullable(),
305
+ review_requests_enabled: z5.boolean().optional().nullable(),
528
306
  /**
529
307
  * Wrap the order sequence to form Order.order_code. A null prefix means
530
308
  * the store never configured one and takes the default "#"; an empty
531
309
  * string means the merchant deliberately cleared it.
532
310
  */
533
- order_number_prefix: z6.string().optional().nullable(),
534
- order_number_suffix: z6.string().optional().nullable(),
535
- theme_config: themeConfigSchema
311
+ order_number_prefix: z5.string().optional().nullable(),
312
+ order_number_suffix: z5.string().optional().nullable(),
313
+ legal_links: legalLinksSchema
536
314
  }).extend(emailBrandingShape).extend(optionalTimestampSchema.shape);
537
315
  var createStoreSchema = storeSchema.omit({
538
316
  id: true,
@@ -560,52 +338,51 @@ var updateStoreSettingsSchema = createStoreSettingsSchema.partial().omit({
560
338
  var storeWithRelationsSchema = storeSchema.extend({
561
339
  store_config: storeConfigSchema.optional().nullable(),
562
340
  store_settings: storeSettingsSchema.optional().nullable(),
563
- theme_config: themeConfigSchema,
564
- embedded_scripts: z6.array(embeddedScriptSchema).optional()
341
+ embedded_scripts: z5.array(embeddedScriptSchema).optional()
565
342
  });
566
343
 
567
344
  // src/types/product.ts
568
- import { z as z9 } from "zod";
345
+ import { z as z8 } from "zod";
569
346
 
570
347
  // src/types/product-review.ts
571
- import { z as z8 } from "zod";
348
+ import { z as z7 } from "zod";
572
349
 
573
350
  // src/types/pagination.ts
574
- import { z as z7 } from "zod";
575
- var paginationMetaSchema = z7.object({
576
- total: z7.uint32(),
577
- limit: z7.int32().positive(),
578
- offset: z7.uint32(),
579
- page: z7.int32().positive(),
580
- totalPages: z7.uint32(),
581
- hasNext: z7.boolean(),
582
- hasPrev: z7.boolean()
583
- });
584
- var paginatedResponseSchema = (itemSchema2) => z7.object({
585
- data: z7.array(itemSchema2),
351
+ import { z as z6 } from "zod";
352
+ var paginationMetaSchema = z6.object({
353
+ total: z6.uint32(),
354
+ limit: z6.int32().positive(),
355
+ offset: z6.uint32(),
356
+ page: z6.int32().positive(),
357
+ totalPages: z6.uint32(),
358
+ hasNext: z6.boolean(),
359
+ hasPrev: z6.boolean()
360
+ });
361
+ var paginatedResponseSchema = (itemSchema2) => z6.object({
362
+ data: z6.array(itemSchema2),
586
363
  meta: paginationMetaSchema
587
364
  });
588
- var baseQueryParamsSchema = z7.object({
589
- limit: z7.int32().min(1).max(100).optional(),
590
- offset: z7.uint32().optional(),
591
- search: z7.string().optional(),
592
- sort_by: z7.string().optional(),
365
+ var baseQueryParamsSchema = z6.object({
366
+ limit: z6.int32().min(1).max(100).optional(),
367
+ offset: z6.uint32().optional(),
368
+ search: z6.string().optional(),
369
+ sort_by: z6.string().optional(),
593
370
  sort_order: sortOrderSchema.optional(),
594
371
  created_after: timestampSchema.optional(),
595
372
  created_before: timestampSchema.optional(),
596
373
  updated_after: timestampSchema.optional(),
597
374
  updated_before: timestampSchema.optional()
598
375
  });
599
- var baseDeleteOptionsSchema = z7.object({
600
- soft_delete: z7.boolean().optional(),
601
- reason: z7.string().optional(),
602
- force: z7.boolean().optional()
376
+ var baseDeleteOptionsSchema = z6.object({
377
+ soft_delete: z6.boolean().optional(),
378
+ reason: z6.string().optional(),
379
+ force: z6.boolean().optional()
603
380
  });
604
- var baseDeleteResultSchema = z7.object({
605
- success: z7.boolean(),
606
- type: z7.enum(["soft", "hard"]),
607
- message: z7.string(),
608
- entity_id: z7.union([z7.number(), z7.string()]),
381
+ var baseDeleteResultSchema = z6.object({
382
+ success: z6.boolean(),
383
+ type: z6.enum(["soft", "hard"]),
384
+ message: z6.string(),
385
+ entity_id: z6.union([z6.number(), z6.string()]),
609
386
  deleted_at: timestampSchema.optional()
610
387
  });
611
388
  var PAGINATION_DEFAULTS = {
@@ -619,8 +396,8 @@ var validatePaginationMeta = (data) => {
619
396
  try {
620
397
  return paginationMetaSchema.parse(data);
621
398
  } catch (error) {
622
- if (error instanceof z7.ZodError) {
623
- throw new Error(z7.prettifyError(error));
399
+ if (error instanceof z6.ZodError) {
400
+ throw new Error(z6.prettifyError(error));
624
401
  }
625
402
  throw error;
626
403
  }
@@ -629,19 +406,19 @@ var safeParsePaginationMeta = (data) => paginationMetaSchema.safeParse(data);
629
406
  var safeParseBaseQueryParams = (data) => baseQueryParamsSchema.safeParse(data);
630
407
 
631
408
  // src/types/product-review.ts
632
- var reviewStatusSchema = z8.enum([
409
+ var reviewStatusSchema = z7.enum([
633
410
  "PENDING",
634
411
  "APPROVED",
635
412
  "REJECTED",
636
413
  "HIDDEN"
637
414
  ]);
638
- var productReviewReplySchema = z8.object({
415
+ var productReviewReplySchema = z7.object({
639
416
  id: uuidSchema,
640
417
  review_id: uuidSchema,
641
- content: z8.string().min(1),
418
+ content: z7.string().min(1),
642
419
  author_id: uuidSchema,
643
- author_name: z8.string().min(1),
644
- is_visible: z8.boolean().default(true)
420
+ author_name: z7.string().min(1),
421
+ is_visible: z7.boolean().default(true)
645
422
  }).extend(timestampSchema.shape).extend(deletedAtSchema.shape);
646
423
  var createProductReviewReplySchema = productReviewReplySchema.omit({
647
424
  id: true,
@@ -650,34 +427,34 @@ var createProductReviewReplySchema = productReviewReplySchema.omit({
650
427
  deleted_at: true
651
428
  });
652
429
  var updateProductReviewReplySchema = productReviewReplySchema.partial().omit({ id: true, review_id: true, created_at: true });
653
- var productReviewSchema = z8.object({
430
+ var productReviewSchema = z7.object({
654
431
  id: uuidSchema,
655
- product_id: z8.bigint(),
656
- product_name: z8.string().min(1),
657
- variant_id: z8.bigint().optional().nullable(),
658
- variant_name: z8.string().optional().nullable(),
659
- order_id: z8.bigint().optional().nullable(),
660
- order_number: z8.bigint().optional().nullable(),
432
+ product_id: z7.bigint(),
433
+ product_name: z7.string().min(1),
434
+ variant_id: z7.bigint().optional().nullable(),
435
+ variant_name: z7.string().optional().nullable(),
436
+ order_id: z7.bigint().optional().nullable(),
437
+ order_number: z7.bigint().optional().nullable(),
661
438
  user_id: uuidSchema.optional().nullable(),
662
- reviewer_name: z8.string().min(1),
439
+ reviewer_name: z7.string().min(1),
663
440
  reviewer_email: emailSchema,
664
- reviewer_avatar: z8.string().url().optional().nullable(),
665
- is_verified_buyer: z8.boolean().default(false),
666
- rating: z8.int32().min(1).max(5),
667
- title: z8.string().max(200).optional().nullable(),
668
- content: z8.string().min(1),
669
- pros: z8.array(z8.string()).default([]),
670
- cons: z8.array(z8.string()).default([]),
671
- media: z8.array(z8.any()).default([]),
441
+ reviewer_avatar: z7.string().url().optional().nullable(),
442
+ is_verified_buyer: z7.boolean().default(false),
443
+ rating: z7.int32().min(1).max(5),
444
+ title: z7.string().max(200).optional().nullable(),
445
+ content: z7.string().min(1),
446
+ pros: z7.array(z7.string()).default([]),
447
+ cons: z7.array(z7.string()).default([]),
448
+ media: z7.array(z7.any()).default([]),
672
449
  status: reviewStatusSchema.default("PENDING"),
673
- moderation_notes: z8.string().optional().nullable(),
450
+ moderation_notes: z7.string().optional().nullable(),
674
451
  approved_by: uuidSchema.optional().nullable(),
675
- approved_at: z8.iso.datetime().optional().nullable(),
676
- rejected_reason: z8.string().optional().nullable(),
677
- is_featured: z8.boolean().default(false),
678
- is_pinned: z8.boolean().default(false),
679
- display_order: z8.int32().optional().nullable(),
680
- review_date: z8.iso.datetime().optional().nullable()
452
+ approved_at: z7.iso.datetime().optional().nullable(),
453
+ rejected_reason: z7.string().optional().nullable(),
454
+ is_featured: z7.boolean().default(false),
455
+ is_pinned: z7.boolean().default(false),
456
+ display_order: z7.int32().optional().nullable(),
457
+ review_date: z7.iso.datetime().optional().nullable()
681
458
  }).extend(timestampSchema.shape).extend(deletedAtSchema.shape);
682
459
  var createProductReviewSchema = productReviewSchema.omit({
683
460
  id: true,
@@ -687,43 +464,43 @@ var createProductReviewSchema = productReviewSchema.omit({
687
464
  });
688
465
  var updateProductReviewSchema = productReviewSchema.partial().omit({ id: true, created_at: true });
689
466
  var productReviewWithRepliesSchema = productReviewSchema.extend({
690
- review_replies: z8.array(productReviewReplySchema).optional()
467
+ review_replies: z7.array(productReviewReplySchema).optional()
691
468
  });
692
- var productReviewStatsSchema = z8.object({
469
+ var productReviewStatsSchema = z7.object({
693
470
  id: idSchema,
694
- product_id: z8.bigint(),
695
- total_reviews: z8.int32().default(0),
696
- verified_reviews: z8.int32().default(0),
697
- reviews_with_media: z8.int32().default(0),
698
- reviews_with_reply: z8.int32().default(0),
699
- average_rating: z8.float64().default(0),
700
- rating_1_count: z8.int32().default(0),
701
- rating_2_count: z8.int32().default(0),
702
- rating_3_count: z8.int32().default(0),
703
- rating_4_count: z8.int32().default(0),
704
- rating_5_count: z8.int32().default(0),
705
- last_review_at: z8.iso.datetime().optional().nullable(),
706
- last_calculated_at: z8.iso.datetime(),
707
- updated_at: z8.iso.datetime()
471
+ product_id: z7.bigint(),
472
+ total_reviews: z7.int32().default(0),
473
+ verified_reviews: z7.int32().default(0),
474
+ reviews_with_media: z7.int32().default(0),
475
+ reviews_with_reply: z7.int32().default(0),
476
+ average_rating: z7.float64().default(0),
477
+ rating_1_count: z7.int32().default(0),
478
+ rating_2_count: z7.int32().default(0),
479
+ rating_3_count: z7.int32().default(0),
480
+ rating_4_count: z7.int32().default(0),
481
+ rating_5_count: z7.int32().default(0),
482
+ last_review_at: z7.iso.datetime().optional().nullable(),
483
+ last_calculated_at: z7.iso.datetime(),
484
+ updated_at: z7.iso.datetime()
708
485
  });
709
486
  var productReviewFiltersSchema = baseQueryParamsSchema.extend({
710
487
  id: uuidSchema.optional(),
711
- product_id: z8.bigint().optional(),
488
+ product_id: z7.bigint().optional(),
712
489
  user_id: uuidSchema.optional(),
713
- rating: z8.int32().min(1).max(5).optional(),
714
- min_rating: z8.int32().min(1).max(5).optional(),
715
- max_rating: z8.int32().min(1).max(5).optional(),
490
+ rating: z7.int32().min(1).max(5).optional(),
491
+ min_rating: z7.int32().min(1).max(5).optional(),
492
+ max_rating: z7.int32().min(1).max(5).optional(),
716
493
  status: reviewStatusSchema.optional(),
717
- is_verified_buyer: z8.boolean().optional(),
494
+ is_verified_buyer: z7.boolean().optional(),
718
495
  reviewer_email: emailSchema.optional(),
719
- reviewer_name: z8.string().optional(),
720
- has_media: z8.boolean().optional(),
721
- include_replies: z8.boolean().optional()
496
+ reviewer_name: z7.string().optional(),
497
+ has_media: z7.boolean().optional(),
498
+ include_replies: z7.boolean().optional()
722
499
  });
723
500
  var productReviewReplyFiltersSchema = baseQueryParamsSchema.extend({
724
501
  id: uuidSchema.optional(),
725
502
  review_id: uuidSchema.optional(),
726
- is_visible: z8.boolean().optional(),
503
+ is_visible: z7.boolean().optional(),
727
504
  author_id: uuidSchema.optional()
728
505
  });
729
506
 
@@ -808,60 +585,60 @@ function unavailable(level) {
808
585
  }
809
586
 
810
587
  // src/types/product.ts
811
- var productSchema = z9.object({
588
+ var productSchema = z8.object({
812
589
  id: idSchema,
813
- name: z9.string().min(1),
814
- slug: z9.string().max(255).optional().nullable(),
815
- description: z9.string().optional().nullable(),
590
+ name: z8.string().min(1),
591
+ slug: z8.string().max(255).optional().nullable(),
592
+ description: z8.string().optional().nullable(),
816
593
  status: productStatusSchema.default("active"),
817
594
  category_id: idSchema.optional().nullable(),
818
- is_featured: z9.boolean().default(false),
595
+ is_featured: z8.boolean().default(false),
819
596
  min_price: moneySchema.optional().nullable(),
820
597
  max_price: moneySchema.optional().nullable(),
821
- variant_mode: z9.string(),
822
- external_id: z9.string().optional().nullable(),
598
+ variant_mode: z8.string(),
599
+ external_id: z8.string().optional().nullable(),
823
600
  images: jsonSchema
824
601
  // Array of image objects
825
602
  }).extend(timestampSchema.shape);
826
- var productVariantSchema = z9.object({
603
+ var productVariantSchema = z8.object({
827
604
  id: idSchema,
828
605
  product_id: idSchema,
829
606
  sku_id: idSchema,
830
- seller_sku: z9.string().optional().nullable(),
831
- external_id: z9.string().optional().nullable(),
607
+ seller_sku: z8.string().optional().nullable(),
608
+ external_id: z8.string().optional().nullable(),
832
609
  price: moneySchema,
833
- inventory: z9.int32().default(0),
834
- track_inventory: z9.boolean().default(true),
835
- inventory_policy: z9.enum(INVENTORY_POLICIES).default("deny"),
610
+ inventory: z8.int32().default(0),
611
+ track_inventory: z8.boolean().default(true),
612
+ inventory_policy: z8.enum(INVENTORY_POLICIES).default("deny"),
836
613
  // z.number(), not moneySchema: unit costs carry up to 4 decimals, and
837
614
  // moneySchema (2 decimals) would reject a valid cost.
838
- cost_per_item: z9.number().nonnegative().nullable().optional(),
615
+ cost_per_item: z8.number().nonnegative().nullable().optional(),
839
616
  weight: decimalSchema.optional().nullable(),
840
617
  dimensions: dimensionsSchema,
841
- is_default: z9.boolean().default(false),
618
+ is_default: z8.boolean().default(false),
842
619
  status: variantStatusSchema.default("active")
843
620
  }).extend(timestampSchema.shape);
844
- var variantOptionSchema = z9.object({
621
+ var variantOptionSchema = z8.object({
845
622
  id: idSchema,
846
- name: z9.string().min(1),
623
+ name: z8.string().min(1),
847
624
  sort_order: positionOrderSchema
848
625
  }).extend(timestampSchema.shape);
849
- var variantOptionValueSchema = z9.object({
626
+ var variantOptionValueSchema = z8.object({
850
627
  id: idSchema,
851
628
  option_id: idSchema,
852
- value: z9.string().min(1),
853
- display_value: z9.string().min(1),
854
- image_url: z9.string().default(""),
629
+ value: z8.string().min(1),
630
+ display_value: z8.string().min(1),
631
+ image_url: z8.string().default(""),
855
632
  sort_order: positionOrderSchema,
856
- swatch_type: z9.enum(["none", "color", "image"]).default("none"),
857
- swatch_value: z9.string().default("")
633
+ swatch_type: z8.enum(["none", "color", "image"]).default("none"),
634
+ swatch_value: z8.string().default("")
858
635
  }).extend(timestampSchema.shape);
859
- var productVariantCombinationSchema = z9.object({
636
+ var productVariantCombinationSchema = z8.object({
860
637
  id: idSchema,
861
638
  variant_id: idSchema,
862
639
  option_id: idSchema,
863
640
  option_value_id: idSchema,
864
- created_at: z9.iso.datetime()
641
+ created_at: z8.iso.datetime()
865
642
  });
866
643
  var createProductSchema = productSchema.omit({
867
644
  id: true,
@@ -909,35 +686,35 @@ var updateVariantOptionValueSchema = variantOptionValueSchema.omit({
909
686
  }).partial().omit({
910
687
  option_id: true
911
688
  });
912
- var productVariantCombinationEntrySchema = z9.object({
689
+ var productVariantCombinationEntrySchema = z8.object({
913
690
  attributes: variantOptionSchema,
914
691
  attribute_values: variantOptionValueSchema
915
692
  });
916
693
  var productVariantWithCombinationsSchema = productVariantSchema.extend(
917
694
  {
918
- combinations: z9.array(productVariantCombinationEntrySchema).optional()
695
+ combinations: z8.array(productVariantCombinationEntrySchema).optional()
919
696
  }
920
697
  );
921
- var attributeLinkValueSchema = z9.object({
922
- key: z9.string(),
923
- display: z9.string(),
924
- swatch_type: z9.enum(["none", "color", "image"]),
925
- swatch_value: z9.string(),
926
- attribute_value_id: z9.number().nullable()
927
- });
928
- var attributeLinkSchema = z9.object({
929
- id: z9.number(),
930
- position: z9.number(),
931
- group: z9.string().nullable(),
932
- is_visible: z9.boolean(),
933
- is_variation: z9.boolean(),
934
- attribute_id: z9.number().nullable(),
935
- custom_name: z9.string().nullable(),
936
- name: z9.string(),
937
- values: z9.array(attributeLinkValueSchema)
698
+ var attributeLinkValueSchema = z8.object({
699
+ key: z8.string(),
700
+ display: z8.string(),
701
+ swatch_type: z8.enum(["none", "color", "image"]),
702
+ swatch_value: z8.string(),
703
+ attribute_value_id: z8.number().nullable()
704
+ });
705
+ var attributeLinkSchema = z8.object({
706
+ id: z8.number(),
707
+ position: z8.number(),
708
+ group: z8.string().nullable(),
709
+ is_visible: z8.boolean(),
710
+ is_variation: z8.boolean(),
711
+ attribute_id: z8.number().nullable(),
712
+ custom_name: z8.string().nullable(),
713
+ name: z8.string(),
714
+ values: z8.array(attributeLinkValueSchema)
938
715
  });
939
716
  var productWithVariantsSchema = productSchema.extend({
940
- variants: z9.array(productVariantWithCombinationsSchema).optional()
717
+ variants: z8.array(productVariantWithCombinationsSchema).optional()
941
718
  });
942
719
  var productWithReviewStatsSchema = productSchema.extend({
943
720
  review_stats: productReviewStatsSchema.optional().nullable()
@@ -947,17 +724,17 @@ var productWithVariantsAndReviewStatsSchema = productWithVariantsSchema.extend({
947
724
  });
948
725
 
949
726
  // src/types/category.ts
950
- import { z as z10 } from "zod";
951
- var categorySchema = z10.object({
727
+ import { z as z9 } from "zod";
728
+ var categorySchema = z9.object({
952
729
  id: idSchema,
953
- name: z10.string().min(1),
954
- slug: z10.string().optional().nullable(),
955
- description: z10.string().optional().nullable(),
730
+ name: z9.string().min(1),
731
+ slug: z9.string().optional().nullable(),
732
+ description: z9.string().optional().nullable(),
956
733
  image_url: urlSchema,
957
734
  parent_id: idSchema.optional().nullable(),
958
735
  sort_order: positionOrderSchema,
959
- is_active: z10.boolean().default(true),
960
- external_cat_id: z10.string().optional().nullable()
736
+ is_active: z9.boolean().default(true),
737
+ external_cat_id: z9.string().optional().nullable()
961
738
  }).extend(optionalTimestampSchema.shape);
962
739
  var createCategorySchema = categorySchema.omit({
963
740
  id: true,
@@ -966,47 +743,47 @@ var createCategorySchema = categorySchema.omit({
966
743
  });
967
744
  var updateCategorySchema = createCategorySchema.partial();
968
745
  var categoryWithChildrenSchema = categorySchema.extend({
969
- children: z10.array(z10.lazy(() => categoryWithChildrenSchema)).optional()
746
+ children: z9.array(z9.lazy(() => categoryWithChildrenSchema)).optional()
970
747
  });
971
- var categoryTreeSchema = z10.array(
748
+ var categoryTreeSchema = z9.array(
972
749
  categoryWithChildrenSchema
973
750
  );
974
751
 
975
752
  // src/types/order.ts
976
- import { z as z11 } from "zod";
753
+ import { z as z10 } from "zod";
977
754
  var ORDER_SOURCES = ["online", "pos", "phone", "admin"];
978
755
  var ADMIN_ORDER_SOURCES = ["pos", "phone", "admin"];
979
- var appliedPromotionSchema = z11.object({
756
+ var appliedPromotionSchema = z10.object({
980
757
  promotion_id: idSchema,
981
- promotion_name: z11.string().optional().nullable(),
758
+ promotion_name: z10.string().optional().nullable(),
982
759
  discount_amount: moneySchema.optional().nullable(),
983
760
  shipping_discount: moneySchema.optional().nullable()
984
761
  });
985
- var orderItemSchema = z11.object({
762
+ var orderItemSchema = z10.object({
986
763
  id: idSchema,
987
764
  order_id: idSchema.optional().nullable(),
988
765
  product_id: idSchema.optional().nullable(),
989
- product_name: z11.string().min(1),
990
- product_image: z11.string().optional().nullable(),
991
- quantity: z11.int32().min(1).default(1),
766
+ product_name: z10.string().min(1),
767
+ product_image: z10.string().optional().nullable(),
768
+ quantity: z10.int32().min(1).default(1),
992
769
  price: moneySchema,
993
770
  original_price: moneySchema.optional().nullable(),
994
771
  total: moneySchema,
995
772
  discount: moneySchema.optional().nullable(),
996
- applied_promotions: z11.array(appliedPromotionSchema).optional(),
773
+ applied_promotions: z10.array(appliedPromotionSchema).optional(),
997
774
  variant_id: idSchema.optional().nullable(),
998
- variant_name: z11.string().optional().nullable(),
999
- created_at: z11.iso.datetime().optional().nullable()
775
+ variant_name: z10.string().optional().nullable(),
776
+ created_at: z10.iso.datetime().optional().nullable()
1000
777
  });
1001
- var orderSchema = z11.object({
778
+ var orderSchema = z10.object({
1002
779
  id: idSchema,
1003
780
  user_id: uuidSchema.optional().nullable(),
1004
- customer_name: z11.string().min(1),
781
+ customer_name: z10.string().min(1),
1005
782
  customer_email: emailSchema.nullable(),
1006
783
  customer_phone: phoneSchema,
1007
- customer_avatar: z11.string().optional().nullable(),
784
+ customer_avatar: z10.string().optional().nullable(),
1008
785
  // DEPRECATED: Legacy status field for backward compatibility
1009
- status: z11.string().optional().nullable(),
786
+ status: z10.string().optional().nullable(),
1010
787
  // NEW: Separate status fields managed by state machines
1011
788
  order_status: orderStatusSchema,
1012
789
  fulfillment_status: fulfillmentStatusSchema,
@@ -1021,25 +798,25 @@ var orderSchema = z11.object({
1021
798
  tax: moneySchema.default(0),
1022
799
  discount: moneySchema.default(0),
1023
800
  total: moneySchema.default(0),
1024
- shipping_street: z11.string().min(1),
1025
- shipping_city: z11.string().min(1),
1026
- shipping_district: z11.string().optional().nullable(),
1027
- shipping_ward: z11.string().optional().nullable(),
1028
- shipping_postal_code: z11.string().optional().nullable(),
1029
- tracking_number: z11.string().optional().nullable(),
1030
- notes: z11.string().optional().nullable(),
801
+ shipping_street: z10.string().min(1),
802
+ shipping_city: z10.string().min(1),
803
+ shipping_district: z10.string().optional().nullable(),
804
+ shipping_ward: z10.string().optional().nullable(),
805
+ shipping_postal_code: z10.string().optional().nullable(),
806
+ tracking_number: z10.string().optional().nullable(),
807
+ notes: z10.string().optional().nullable(),
1031
808
  order_number: idSchema,
1032
- order_code: z11.string(),
1033
- items: z11.array(orderItemSchema).optional(),
1034
- applied_promotions: z11.array(appliedPromotionSchema).optional(),
1035
- shipping_method_name: z11.string().optional().nullable(),
1036
- shipping_city_name: z11.string().optional().nullable(),
1037
- shipping_ward_name: z11.string().optional().nullable(),
1038
- source: z11.enum(ORDER_SOURCES).default("online"),
1039
- created_by: z11.object({
809
+ order_code: z10.string(),
810
+ items: z10.array(orderItemSchema).optional(),
811
+ applied_promotions: z10.array(appliedPromotionSchema).optional(),
812
+ shipping_method_name: z10.string().optional().nullable(),
813
+ shipping_city_name: z10.string().optional().nullable(),
814
+ shipping_ward_name: z10.string().optional().nullable(),
815
+ source: z10.enum(ORDER_SOURCES).default("online"),
816
+ created_by: z10.object({
1040
817
  id: uuidSchema,
1041
- name: z11.string().nullable(),
1042
- email: z11.string().nullable()
818
+ name: z10.string().nullable(),
819
+ email: z10.string().nullable()
1043
820
  }).nullable().optional()
1044
821
  }).extend(optionalTimestampSchema.shape);
1045
822
  var createOrderSchema = orderSchema.omit({
@@ -1091,14 +868,14 @@ var updateOrderItemSchema = orderItemSchema.omit({
1091
868
  order_id: true
1092
869
  });
1093
870
  var orderWithItemsSchema = orderSchema.extend({
1094
- items: z11.array(orderItemSchema).optional()
871
+ items: z10.array(orderItemSchema).optional()
1095
872
  });
1096
- var customerOrderSummarySchema = z11.object({
873
+ var customerOrderSummarySchema = z10.object({
1097
874
  customer_email: emailSchema,
1098
- customer_name: z11.string(),
1099
- total_orders: z11.int32(),
875
+ customer_name: z10.string(),
876
+ total_orders: z10.int32(),
1100
877
  total_spent: moneySchema,
1101
- last_order_date: z11.iso.datetime().optional().nullable()
878
+ last_order_date: z10.iso.datetime().optional().nullable()
1102
879
  });
1103
880
 
1104
881
  // src/types/order-timeline.ts
@@ -1119,23 +896,23 @@ var ORDER_ACTOR_TYPES = [
1119
896
  ];
1120
897
 
1121
898
  // src/types/promotion.ts
1122
- import { z as z12 } from "zod";
1123
- var PromotionModeSchema = z12.enum(["DISCOUNT_CODE", "AUTOMATIC"]);
1124
- var PromotionTypeSchema = z12.enum([
899
+ import { z as z11 } from "zod";
900
+ var PromotionModeSchema = z11.enum(["DISCOUNT_CODE", "AUTOMATIC"]);
901
+ var PromotionTypeSchema = z11.enum([
1125
902
  "PRODUCT_DISCOUNT",
1126
903
  "CART_DISCOUNT",
1127
904
  "FREE_SHIPPING",
1128
905
  "FIXED_PRICE",
1129
906
  "GIFT"
1130
907
  ]);
1131
- var DiscountMethodSchema = z12.enum(["PERCENTAGE", "FIXED_AMOUNT"]);
1132
- var ConditionTypeSchema = z12.enum([
908
+ var DiscountMethodSchema = z11.enum(["PERCENTAGE", "FIXED_AMOUNT"]);
909
+ var ConditionTypeSchema = z11.enum([
1133
910
  "PRODUCT",
1134
911
  "CATEGORY",
1135
912
  "VARIANT",
1136
913
  "NONE"
1137
914
  ]);
1138
- var PromotionStatusSchema = z12.enum([
915
+ var PromotionStatusSchema = z11.enum([
1139
916
  "DRAFT",
1140
917
  "ACTIVE",
1141
918
  "EXPIRED",
@@ -1168,87 +945,87 @@ var PromotionStatus = {
1168
945
  EXPIRED: "EXPIRED",
1169
946
  DISABLED: "DISABLED"
1170
947
  };
1171
- var PromotionSchema = z12.object({
1172
- id: z12.number().int().positive(),
1173
- name: z12.string().min(1).max(255),
948
+ var PromotionSchema = z11.object({
949
+ id: z11.number().int().positive(),
950
+ name: z11.string().min(1).max(255),
1174
951
  mode: PromotionModeSchema,
1175
- code: z12.string().min(1).max(50).optional(),
1176
- description: z12.string().max(1e3).optional(),
1177
- start_at: z12.string().datetime(),
1178
- end_at: z12.string().datetime().optional(),
952
+ code: z11.string().min(1).max(50).optional(),
953
+ description: z11.string().max(1e3).optional(),
954
+ start_at: z11.string().datetime(),
955
+ end_at: z11.string().datetime().optional(),
1179
956
  status: PromotionStatusSchema,
1180
957
  type: PromotionTypeSchema,
1181
958
  condition_type: ConditionTypeSchema,
1182
- target_ids: z12.array(z12.string().uuid()).optional(),
1183
- min_amount: z12.number().positive().optional(),
1184
- min_quantity: z12.number().int().positive().optional(),
959
+ target_ids: z11.array(z11.string().uuid()).optional(),
960
+ min_amount: z11.number().positive().optional(),
961
+ min_quantity: z11.number().int().positive().optional(),
1185
962
  discount_method: DiscountMethodSchema.optional(),
1186
- discount_value: z12.number().nonnegative().optional(),
1187
- max_discount_amount: z12.number().nonnegative().optional(),
1188
- fixed_price: z12.number().nonnegative().optional(),
1189
- gift_product_ids: z12.array(z12.string().uuid()),
1190
- gift_quantity: z12.number().int().positive().optional(),
1191
- usage_limit: z12.number().int().positive().optional(),
1192
- usage_limit_per_user: z12.number().int().positive().optional(),
1193
- checkout_suggestion_enabled: z12.boolean().optional(),
1194
- created_at: z12.string().datetime(),
1195
- updated_at: z12.string().datetime(),
1196
- created_by: z12.string().uuid().optional(),
1197
- updated_by: z12.string().uuid().optional()
1198
- });
1199
- var CreatePromotionSchema = z12.object({
1200
- name: z12.string().min(1, "T\xEAn khuy\u1EBFn m\xE3i l\xE0 b\u1EAFt bu\u1ED9c").max(255),
963
+ discount_value: z11.number().nonnegative().optional(),
964
+ max_discount_amount: z11.number().nonnegative().optional(),
965
+ fixed_price: z11.number().nonnegative().optional(),
966
+ gift_product_ids: z11.array(z11.string().uuid()),
967
+ gift_quantity: z11.number().int().positive().optional(),
968
+ usage_limit: z11.number().int().positive().optional(),
969
+ usage_limit_per_user: z11.number().int().positive().optional(),
970
+ checkout_suggestion_enabled: z11.boolean().optional(),
971
+ created_at: z11.string().datetime(),
972
+ updated_at: z11.string().datetime(),
973
+ created_by: z11.string().uuid().optional(),
974
+ updated_by: z11.string().uuid().optional()
975
+ });
976
+ var CreatePromotionSchema = z11.object({
977
+ name: z11.string().min(1, "T\xEAn khuy\u1EBFn m\xE3i l\xE0 b\u1EAFt bu\u1ED9c").max(255),
1201
978
  mode: PromotionModeSchema,
1202
- code: z12.string().min(1).max(50).optional(),
1203
- description: z12.string().max(1e3).optional(),
1204
- start_at: z12.iso.datetime(),
1205
- end_at: z12.iso.datetime().optional(),
979
+ code: z11.string().min(1).max(50).optional(),
980
+ description: z11.string().max(1e3).optional(),
981
+ start_at: z11.iso.datetime(),
982
+ end_at: z11.iso.datetime().optional(),
1206
983
  type: PromotionTypeSchema,
1207
984
  condition_type: ConditionTypeSchema,
1208
- target_ids: z12.array(z12.uuid()).optional().superRefine((ids, ctx) => {
985
+ target_ids: z11.array(z11.uuid()).optional().superRefine((ids, ctx) => {
1209
986
  const conditionType = ctx.parent?.condition_type;
1210
987
  if (conditionType === "NONE") {
1211
988
  return true;
1212
989
  }
1213
990
  return ids && ids.length > 0;
1214
991
  }),
1215
- min_amount: z12.number().positive().optional(),
1216
- min_quantity: z12.number().int().positive().optional(),
992
+ min_amount: z11.number().positive().optional(),
993
+ min_quantity: z11.number().int().positive().optional(),
1217
994
  discount_method: DiscountMethodSchema.optional(),
1218
- discount_value: z12.number().nonnegative().optional(),
1219
- max_discount_amount: z12.number().nonnegative().optional(),
1220
- fixed_price: z12.number().nonnegative().optional(),
1221
- gift_product_ids: z12.array(z12.uuid()).optional(),
1222
- gift_quantity: z12.number().int().positive().optional(),
1223
- usage_limit: z12.number().int().positive().optional(),
1224
- usage_limit_per_user: z12.number().int().positive().optional(),
1225
- checkout_suggestion_enabled: z12.boolean().optional()
995
+ discount_value: z11.number().nonnegative().optional(),
996
+ max_discount_amount: z11.number().nonnegative().optional(),
997
+ fixed_price: z11.number().nonnegative().optional(),
998
+ gift_product_ids: z11.array(z11.uuid()).optional(),
999
+ gift_quantity: z11.number().int().positive().optional(),
1000
+ usage_limit: z11.number().int().positive().optional(),
1001
+ usage_limit_per_user: z11.number().int().positive().optional(),
1002
+ checkout_suggestion_enabled: z11.boolean().optional()
1226
1003
  });
1227
1004
  var UpdatePromotionSchema = CreatePromotionSchema.partial().extend({
1228
1005
  status: PromotionStatusSchema.optional()
1229
1006
  });
1230
1007
  var PromotionWithDiscountSchema = PromotionSchema.extend({
1231
- discount_amount: z12.number().optional()
1232
- });
1233
- var PromotionStatisticsSchema = z12.object({
1234
- total_promotions: z12.number().int().nonnegative(),
1235
- active_promotions: z12.number().int().nonnegative(),
1236
- draft_promotions: z12.number().int().nonnegative(),
1237
- expired_promotions: z12.number().int().nonnegative(),
1238
- disabled_promotions: z12.number().int().nonnegative(),
1239
- total_usage: z12.number().int().nonnegative(),
1240
- total_discount_amount: z12.number().nonnegative(),
1241
- top_promotions: z12.array(PromotionSchema)
1242
- });
1243
- var PaginatedPromotionsResponseSchema = z12.object({
1244
- data: z12.array(PromotionSchema),
1008
+ discount_amount: z11.number().optional()
1009
+ });
1010
+ var PromotionStatisticsSchema = z11.object({
1011
+ total_promotions: z11.number().int().nonnegative(),
1012
+ active_promotions: z11.number().int().nonnegative(),
1013
+ draft_promotions: z11.number().int().nonnegative(),
1014
+ expired_promotions: z11.number().int().nonnegative(),
1015
+ disabled_promotions: z11.number().int().nonnegative(),
1016
+ total_usage: z11.number().int().nonnegative(),
1017
+ total_discount_amount: z11.number().nonnegative(),
1018
+ top_promotions: z11.array(PromotionSchema)
1019
+ });
1020
+ var PaginatedPromotionsResponseSchema = z11.object({
1021
+ data: z11.array(PromotionSchema),
1245
1022
  meta: paginationMetaSchema
1246
1023
  });
1247
- var PromotionQueryParamsSchema = z12.object({
1248
- limit: z12.number().int().positive().optional(),
1249
- offset: z12.number().int().nonnegative().optional(),
1250
- order: z12.enum(["asc", "desc"]).optional(),
1251
- sort: z12.enum([
1024
+ var PromotionQueryParamsSchema = z11.object({
1025
+ limit: z11.number().int().positive().optional(),
1026
+ offset: z11.number().int().nonnegative().optional(),
1027
+ order: z11.enum(["asc", "desc"]).optional(),
1028
+ sort: z11.enum([
1252
1029
  "name",
1253
1030
  "start_at",
1254
1031
  "end_at",
@@ -1257,10 +1034,10 @@ var PromotionQueryParamsSchema = z12.object({
1257
1034
  "created_at",
1258
1035
  "updated_at"
1259
1036
  ]).optional(),
1260
- search: z12.string().max(255).optional(),
1261
- status: z12.union([PromotionStatusSchema, z12.literal("all")]).optional(),
1262
- type: z12.union([PromotionTypeSchema, z12.literal("all")]).optional(),
1263
- mode: z12.union([PromotionModeSchema, z12.literal("all")]).optional()
1037
+ search: z11.string().max(255).optional(),
1038
+ status: z11.union([PromotionStatusSchema, z11.literal("all")]).optional(),
1039
+ type: z11.union([PromotionTypeSchema, z11.literal("all")]).optional(),
1040
+ mode: z11.union([PromotionModeSchema, z11.literal("all")]).optional()
1264
1041
  });
1265
1042
  var PROMOTION_MODE_LABELS = {
1266
1043
  DISCOUNT_CODE: "M\xE3 gi\u1EA3m gi\xE1",
@@ -1308,71 +1085,71 @@ var PROMOTION_MODE_COLORS = {
1308
1085
  };
1309
1086
 
1310
1087
  // src/types/blog.ts
1311
- import { z as z13 } from "zod";
1312
- var tocItemSchema = z13.object({
1313
- id: z13.string(),
1314
- level: z13.number().int().min(1).max(6),
1315
- textContent: z13.string(),
1316
- pos: z13.number().int()
1088
+ import { z as z12 } from "zod";
1089
+ var tocItemSchema = z12.object({
1090
+ id: z12.string(),
1091
+ level: z12.number().int().min(1).max(6),
1092
+ textContent: z12.string(),
1093
+ pos: z12.number().int()
1317
1094
  });
1318
- var blogCategorySchema = z13.object({
1095
+ var blogCategorySchema = z12.object({
1319
1096
  id: idSchema,
1320
- name: z13.string().min(1).max(100),
1097
+ name: z12.string().min(1).max(100),
1321
1098
  slug: slugSchema.max(100),
1322
- description: z13.string().optional().nullable(),
1099
+ description: z12.string().optional().nullable(),
1323
1100
  color: colorSchema,
1324
1101
  sort_order: positionOrderSchema
1325
1102
  }).extend(optionalTimestampSchema.shape);
1326
- var blogTagSchema = z13.object({
1103
+ var blogTagSchema = z12.object({
1327
1104
  id: idSchema,
1328
- name: z13.string().min(1).max(50),
1105
+ name: z12.string().min(1).max(50),
1329
1106
  slug: slugSchema.max(50)
1330
1107
  }).extend(optionalTimestampSchema.shape);
1331
- var blogPostSchema = z13.object({
1108
+ var blogPostSchema = z12.object({
1332
1109
  id: idSchema,
1333
- title: z13.string().min(1).max(255),
1110
+ title: z12.string().min(1).max(255),
1334
1111
  slug: slugSchema.max(255),
1335
- content: z13.string().optional().nullable(),
1336
- toc: z13.array(tocItemSchema).optional().nullable(),
1337
- excerpt: z13.string().optional().nullable(),
1112
+ content: z12.string().optional().nullable(),
1113
+ toc: z12.array(tocItemSchema).optional().nullable(),
1114
+ excerpt: z12.string().optional().nullable(),
1338
1115
  featured_image_url: urlSchema,
1339
1116
  status: blogPostStatusSchema.default("draft"),
1340
- is_featured: z13.boolean().default(false),
1341
- scheduled_at: z13.iso.datetime().optional().nullable(),
1342
- published_at: z13.iso.datetime().optional().nullable(),
1117
+ is_featured: z12.boolean().default(false),
1118
+ scheduled_at: z12.iso.datetime().optional().nullable(),
1119
+ published_at: z12.iso.datetime().optional().nullable(),
1343
1120
  author_id: uuidSchema.optional().nullable(),
1344
- view_count: z13.int32().default(0),
1345
- reading_time: z13.int32().default(0)
1121
+ view_count: z12.int32().default(0),
1122
+ reading_time: z12.int32().default(0)
1346
1123
  }).extend(optionalTimestampSchema.shape);
1347
- var blogCommentSchema = z13.object({
1124
+ var blogCommentSchema = z12.object({
1348
1125
  id: idSchema,
1349
1126
  blog_post_id: idSchema.optional().nullable(),
1350
1127
  parent_comment_id: idSchema.optional().nullable(),
1351
- author_name: z13.string().min(1).max(100),
1128
+ author_name: z12.string().min(1).max(100),
1352
1129
  author_email: emailSchema,
1353
- author_website: z13.url().max(255).optional().nullable(),
1354
- content: z13.string().min(1),
1355
- is_approved: z13.boolean().default(false),
1356
- created_at: z13.iso.datetime().optional().nullable()
1130
+ author_website: z12.url().max(255).optional().nullable(),
1131
+ content: z12.string().min(1),
1132
+ is_approved: z12.boolean().default(false),
1133
+ created_at: z12.iso.datetime().optional().nullable()
1357
1134
  });
1358
- var blogSettingsSchema = z13.object({
1135
+ var blogSettingsSchema = z12.object({
1359
1136
  id: idSchema,
1360
- is_enabled: z13.boolean().default(true),
1361
- blog_title: z13.string().max(255).default("Blog"),
1362
- blog_description: z13.string().optional().nullable(),
1363
- posts_per_page: z13.int32().default(10),
1364
- allow_comments: z13.boolean().default(true),
1365
- moderate_comments: z13.boolean().default(true),
1366
- show_author: z13.boolean().default(true),
1367
- show_reading_time: z13.boolean().default(true),
1368
- enable_rss: z13.boolean().default(true),
1369
- custom_css: z13.string().optional().nullable()
1137
+ is_enabled: z12.boolean().default(true),
1138
+ blog_title: z12.string().max(255).default("Blog"),
1139
+ blog_description: z12.string().optional().nullable(),
1140
+ posts_per_page: z12.int32().default(10),
1141
+ allow_comments: z12.boolean().default(true),
1142
+ moderate_comments: z12.boolean().default(true),
1143
+ show_author: z12.boolean().default(true),
1144
+ show_reading_time: z12.boolean().default(true),
1145
+ enable_rss: z12.boolean().default(true),
1146
+ custom_css: z12.string().optional().nullable()
1370
1147
  }).extend(optionalTimestampSchema.shape);
1371
- var blogPostCategorySchema = z13.object({
1148
+ var blogPostCategorySchema = z12.object({
1372
1149
  blog_post_id: idSchema,
1373
1150
  blog_category_id: idSchema
1374
1151
  });
1375
- var blogPostTagSchema = z13.object({
1152
+ var blogPostTagSchema = z12.object({
1376
1153
  blog_post_id: idSchema,
1377
1154
  blog_tag_id: idSchema
1378
1155
  });
@@ -1409,29 +1186,29 @@ var updateBlogCommentSchema = createBlogCommentSchema.partial().omit({
1409
1186
  });
1410
1187
  var updateBlogSettingsSchema = createBlogSettingsSchema.partial();
1411
1188
  var blogPostWithRelationsSchema = blogPostSchema.extend({
1412
- blog_categories: z13.array(blogCategorySchema).optional(),
1413
- blog_tags: z13.array(blogTagSchema).optional(),
1414
- blog_comments: z13.array(blogCommentSchema).optional()
1189
+ blog_categories: z12.array(blogCategorySchema).optional(),
1190
+ blog_tags: z12.array(blogTagSchema).optional(),
1191
+ blog_comments: z12.array(blogCommentSchema).optional()
1415
1192
  });
1416
- var blogCommentWithRepliesSchemaInner = z13.lazy(
1193
+ var blogCommentWithRepliesSchemaInner = z12.lazy(
1417
1194
  () => blogCommentSchema.extend({
1418
- replies: z13.array(blogCommentWithRepliesSchemaInner).optional()
1195
+ replies: z12.array(blogCommentWithRepliesSchemaInner).optional()
1419
1196
  })
1420
1197
  );
1421
1198
  var blogCommentWithRepliesSchema = blogCommentWithRepliesSchemaInner;
1422
1199
 
1423
1200
  // src/types/banner.ts
1424
- import { z as z14 } from "zod";
1425
- var bannerSchema = z14.object({
1201
+ import { z as z13 } from "zod";
1202
+ var bannerSchema = z13.object({
1426
1203
  id: idSchema,
1427
- title: z14.string().min(1),
1428
- subtitle: z14.string().optional().nullable(),
1204
+ title: z13.string().min(1),
1205
+ subtitle: z13.string().optional().nullable(),
1429
1206
  image_url: strictUrlSchema,
1430
1207
  link_url: urlSchema,
1431
- button_text: z14.string().optional().nullable(),
1208
+ button_text: z13.string().optional().nullable(),
1432
1209
  position: positionOrderSchema,
1433
- is_active: z14.boolean().default(true),
1434
- metadata: z14.any()
1210
+ is_active: z13.boolean().default(true),
1211
+ metadata: z13.any()
1435
1212
  }).extend(optionalTimestampSchema.shape);
1436
1213
  var createBannerSchema = bannerSchema.omit({
1437
1214
  id: true,
@@ -1439,19 +1216,19 @@ var createBannerSchema = bannerSchema.omit({
1439
1216
  updated_at: true
1440
1217
  });
1441
1218
  var updateBannerSchema = createBannerSchema.partial();
1442
- var updateBannerPositionSchema = z14.object({
1219
+ var updateBannerPositionSchema = z13.object({
1443
1220
  id: idSchema,
1444
- position: z14.int32()
1221
+ position: z13.int32()
1445
1222
  });
1446
1223
 
1447
1224
  // src/types/content.ts
1448
- import { z as z15 } from "zod";
1449
- var contentPageSchema = z15.object({
1225
+ import { z as z14 } from "zod";
1226
+ var contentPageSchema = z14.object({
1450
1227
  id: idSchema,
1451
- title: z15.string().min(1),
1452
- content: z15.string().optional().nullable(),
1453
- is_published: z15.boolean().default(false),
1454
- page_type: z15.string().optional().nullable(),
1228
+ title: z14.string().min(1),
1229
+ content: z14.string().optional().nullable(),
1230
+ is_published: z14.boolean().default(false),
1231
+ page_type: z14.string().optional().nullable(),
1455
1232
  sort_order: positionOrderSchema,
1456
1233
  slug: slugSchema.max(255)
1457
1234
  }).extend(timestampSchema.shape);
@@ -1467,87 +1244,87 @@ var updateContentPageSchema = contentPageSchema.omit({
1467
1244
  }).partial();
1468
1245
 
1469
1246
  // src/types/theme-schema.ts
1470
- import { z as z16 } from "zod";
1247
+ import { z as z15 } from "zod";
1471
1248
  var THEME_HEX_COLOR = /^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;
1472
1249
  var SETTING_ID = /^[a-z][a-z0-9_]*$/;
1473
- var primitive = z16.union([z16.string(), z16.number(), z16.boolean()]);
1474
- var visibleIfSchema = z16.object({
1475
- setting: z16.string().regex(SETTING_ID),
1250
+ var primitive = z15.union([z15.string(), z15.number(), z15.boolean()]);
1251
+ var visibleIfSchema = z15.object({
1252
+ setting: z15.string().regex(SETTING_ID),
1476
1253
  equals: primitive.optional(),
1477
1254
  not_equals: primitive.optional(),
1478
- is_set: z16.boolean().optional()
1255
+ is_set: z15.boolean().optional()
1479
1256
  }).refine(
1480
1257
  (v) => [v.equals, v.not_equals, v.is_set].filter((x) => x !== void 0).length === 1,
1481
1258
  { message: "visible_if needs exactly one of equals, not_equals, is_set" }
1482
1259
  );
1483
1260
  var base = {
1484
- id: z16.string().regex(SETTING_ID, "setting ids are snake_case"),
1485
- label: z16.string().min(1),
1486
- info: z16.string().optional(),
1261
+ id: z15.string().regex(SETTING_ID, "setting ids are snake_case"),
1262
+ label: z15.string().min(1),
1263
+ info: z15.string().optional(),
1487
1264
  visible_if: visibleIfSchema.optional()
1488
1265
  };
1489
- var itemSchema = z16.discriminatedUnion("type", [
1490
- z16.object({
1266
+ var itemSchema = z15.discriminatedUnion("type", [
1267
+ z15.object({
1491
1268
  ...base,
1492
- type: z16.literal("text"),
1493
- default: z16.string().optional(),
1494
- placeholder: z16.string().optional()
1269
+ type: z15.literal("text"),
1270
+ default: z15.string().optional(),
1271
+ placeholder: z15.string().optional()
1495
1272
  }),
1496
- z16.object({
1273
+ z15.object({
1497
1274
  ...base,
1498
- type: z16.literal("textarea"),
1499
- default: z16.string().optional(),
1500
- placeholder: z16.string().optional()
1275
+ type: z15.literal("textarea"),
1276
+ default: z15.string().optional(),
1277
+ placeholder: z15.string().optional()
1501
1278
  }),
1502
- z16.object({
1279
+ z15.object({
1503
1280
  ...base,
1504
- type: z16.literal("richtext"),
1505
- default: z16.string().optional()
1281
+ type: z15.literal("richtext"),
1282
+ default: z15.string().optional()
1506
1283
  }),
1507
- z16.object({ ...base, type: z16.literal("url"), default: z16.string().optional() }),
1508
- z16.object({
1284
+ z15.object({ ...base, type: z15.literal("url"), default: z15.string().optional() }),
1285
+ z15.object({
1509
1286
  ...base,
1510
- type: z16.literal("color"),
1511
- default: z16.string().regex(THEME_HEX_COLOR).optional()
1287
+ type: z15.literal("color"),
1288
+ default: z15.string().regex(THEME_HEX_COLOR).optional()
1512
1289
  }),
1513
- z16.object({
1290
+ z15.object({
1514
1291
  ...base,
1515
- type: z16.literal("menu"),
1516
- default: z16.string().optional()
1292
+ type: z15.literal("menu"),
1293
+ default: z15.string().optional()
1517
1294
  }),
1518
- z16.object({ ...base, type: z16.literal("image_picker") }),
1519
- z16.object({ ...base, type: z16.literal("collection") }),
1520
- z16.object({
1295
+ z15.object({ ...base, type: z15.literal("image_picker") }),
1296
+ z15.object({ ...base, type: z15.literal("collection") }),
1297
+ z15.object({
1521
1298
  ...base,
1522
- type: z16.literal("checkbox"),
1523
- default: z16.boolean().optional()
1299
+ type: z15.literal("checkbox"),
1300
+ default: z15.boolean().optional()
1524
1301
  }),
1525
- z16.object({
1302
+ z15.object({
1526
1303
  ...base,
1527
- type: z16.literal("number"),
1528
- default: z16.number().optional(),
1529
- min: z16.number().optional(),
1530
- max: z16.number().optional()
1304
+ type: z15.literal("number"),
1305
+ default: z15.number().optional(),
1306
+ min: z15.number().optional(),
1307
+ max: z15.number().optional()
1531
1308
  }),
1532
- z16.object({
1309
+ z15.object({
1533
1310
  ...base,
1534
- type: z16.literal("range"),
1535
- min: z16.number(),
1536
- max: z16.number(),
1537
- step: z16.number().positive(),
1538
- unit: z16.string().optional(),
1539
- default: z16.number()
1311
+ type: z15.literal("range"),
1312
+ min: z15.number(),
1313
+ max: z15.number(),
1314
+ step: z15.number().positive(),
1315
+ unit: z15.string().optional(),
1316
+ default: z15.number()
1540
1317
  }),
1541
- z16.object({
1318
+ z15.object({
1542
1319
  ...base,
1543
- type: z16.literal("select"),
1544
- options: z16.array(z16.object({ value: z16.string(), label: z16.string().min(1) })).min(1),
1545
- default: z16.string().optional()
1320
+ type: z15.literal("select"),
1321
+ options: z15.array(z15.object({ value: z15.string(), label: z15.string().min(1) })).min(1),
1322
+ default: z15.string().optional()
1546
1323
  }),
1547
- z16.object({ type: z16.literal("header"), content: z16.string().min(1) }),
1548
- z16.object({ type: z16.literal("paragraph"), content: z16.string().min(1) })
1324
+ z15.object({ type: z15.literal("header"), content: z15.string().min(1) }),
1325
+ z15.object({ type: z15.literal("paragraph"), content: z15.string().min(1) })
1549
1326
  ]);
1550
- var themeSchemaSchema = z16.array(z16.object({ name: z16.string().min(1), settings: z16.array(itemSchema) })).superRefine((groups, ctx) => {
1327
+ var themeSchemaSchema = z15.array(z15.object({ name: z15.string().min(1), settings: z15.array(itemSchema) })).superRefine((groups, ctx) => {
1551
1328
  const settings = groups.flatMap((g) => g.settings).filter(isSetting);
1552
1329
  const ids = /* @__PURE__ */ new Set();
1553
1330
  for (const s of settings) {
@@ -1609,7 +1386,7 @@ function parseThemeSchema(input) {
1609
1386
  const result = themeSchemaSchema.safeParse(input);
1610
1387
  if (!result.success) {
1611
1388
  throw new Error(`Invalid theme schema:
1612
- ${z16.prettifyError(result.error)}`);
1389
+ ${z15.prettifyError(result.error)}`);
1613
1390
  }
1614
1391
  return result.data;
1615
1392
  }
@@ -2827,7 +2604,6 @@ export {
2827
2604
  RULE_FIELDS,
2828
2605
  RedirectsApi,
2829
2606
  ReviewsApi,
2830
- SECTION_CONFIG_SCHEMAS,
2831
2607
  SHIPPING_CONDITION_TYPES,
2832
2608
  SHIPPING_DELIVERY_TYPES,
2833
2609
  SHIPPING_RATE_TYPES,
@@ -2838,7 +2614,6 @@ export {
2838
2614
  ThemesApi,
2839
2615
  UNAVAILABLE_STATES,
2840
2616
  UpdatePromotionSchema,
2841
- WIDGET_REGISTRY,
2842
2617
  allowedValuesFor,
2843
2618
  appliedPromotionSchema,
2844
2619
  assetBaseUrl,
@@ -2859,13 +2634,9 @@ export {
2859
2634
  blogSettingsSchema,
2860
2635
  blogTagSchema,
2861
2636
  buildTransformQuery,
2862
- builderSectionSchema,
2863
- builderThemeConfigSchema,
2864
- categoryGridConfigSchema,
2865
2637
  categorySchema,
2866
2638
  categoryTreeSchema,
2867
2639
  categoryWithChildrenSchema,
2868
- collectionGridConfigSchema,
2869
2640
  colorSchema,
2870
2641
  contentPageSchema,
2871
2642
  createAuthAwareHttpClient,
@@ -2900,13 +2671,8 @@ export {
2900
2671
  embeddedScriptPlacementSchema,
2901
2672
  embeddedScriptSchema,
2902
2673
  ensureSuccess,
2903
- featuredProductsConfigSchema,
2904
- footerConfigSchema,
2905
2674
  fromObjectPublicUrlToRender,
2906
2675
  fulfillmentStatusSchema,
2907
- headerConfigSchema,
2908
- heroBannerConfigSchema,
2909
- heroBannerItemSchema,
2910
2676
  idSchema,
2911
2677
  integrationStatusSchema,
2912
2678
  inventoryStatusSchema,
@@ -2918,9 +2684,9 @@ export {
2918
2684
  jsonSchema,
2919
2685
  legacyOrderStatusSchema,
2920
2686
  legacyProductStatusSchema,
2687
+ legalLinksSchema,
2921
2688
  messageOutboxStatusSchema,
2922
2689
  moneySchema,
2923
- newsletterSignupConfigSchema,
2924
2690
  onHand,
2925
2691
  operatorsForField,
2926
2692
  optionalTimestampSchema,
@@ -2932,7 +2698,6 @@ export {
2932
2698
  paginatedResponseSchema,
2933
2699
  paginationMetaSchema,
2934
2700
  paginationSchema,
2935
- parseSectionContent,
2936
2701
  parseStorageUrl,
2937
2702
  parseThemeSchema,
2938
2703
  paymentMethodSchema,
@@ -2958,12 +2723,8 @@ export {
2958
2723
  resolveThemeSettings,
2959
2724
  reviewStatusSchema,
2960
2725
  rewriteSupabaseUrl,
2961
- richTextConfigSchema,
2962
2726
  safeParseBaseQueryParams,
2963
2727
  safeParsePaginationMeta,
2964
- sectionConfigSchema,
2965
- sectionStyleSchema,
2966
- sectionTypeSchema,
2967
2728
  shippingStatusSchema,
2968
2729
  slugSchema,
2969
2730
  sortOrderSchema,
@@ -2974,12 +2735,9 @@ export {
2974
2735
  storeStatusSchema,
2975
2736
  storeWithRelationsSchema,
2976
2737
  strictUrlSchema,
2977
- textWithImageConfigSchema,
2978
- themeConfigSchema,
2979
2738
  themeDefaults,
2980
2739
  themeSchemaSchema,
2981
2740
  themeSettings,
2982
- themeVersionSchema,
2983
2741
  timestampSchema,
2984
2742
  toObjectUrl,
2985
2743
  toRenderUrl,