@hartl-services/medusa-contracts 1.2.0 → 1.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.
@@ -1 +1 @@
1
- export type { AdminAffiliateCouponCode, AdminAffiliateCouponCodeResponse, Affiliate, AffiliateCouponLifecycleStatus, AffiliateCouponOrigin, AffiliateCouponProvisioningStatus, AffiliateCouponWireStatus, AffiliateCustomerAssignmentMode, AffiliateOrderAttribution, AffiliateReferralOverwritePolicy, AdminConsignmentReportResponse, AffiliateApplicationCompanyVerification, AffiliateCustomerSummary, AffiliateApplicationResponse, AffiliateDistributionReportsResponse, AffiliateDistributionReportRequest, AffiliateDistributionResponse, AffiliateProgramSettingsResponse, AffiliateReportDetailResponse, AffiliateReportEntry, AffiliateReportOverviewItem, AffiliateReportOverviewResponse, AffiliateReportTotals, AffiliateResponse, AffiliateSlugResponse, AppliedAffiliateCouponSnapshot, ApproveAffiliateApplicationRequest, ApproveAffiliateApplicationResponse, ApproveConsignmentReportRequest, ApproveConsignmentReportResponse, ConsignmentTransferResponse, CorrectConsignmentReportRequest, CorrectConsignmentReportResponse, CreateAdminAffiliateCouponCodeRequest, CreateAffiliateRequest, CreateAffiliateSlugRequest, CustomerAffiliateAssignmentResponse, CustomerAffiliateAssignment, EnableAffiliateDistributionRequest, ListAdminConsignmentReportsResponse, ListAdminAffiliateCouponCodesQuery, ListAdminAffiliateCouponCodesRequest, ListAdminAffiliateCouponCodesResponse, ListAffiliateApplicationsRequest, ListAffiliateApplicationsResponse, ListAffiliatesRequest, ListAffiliatesResponse, ListAffiliateSlugsResponse, OrderAffiliateAttributionResponse, PersistedAffiliateCustomerAssignmentMode, ListConsignmentReportsRequest, RejectAffiliateApplicationRequest, RejectConsignmentReportRequest, RejectConsignmentReportResponse, ReconcileAdminAffiliateCouponCodeResponse, ReportDateRangeRequest, ReportDetailRequest, RotateAdminAffiliateCouponCodeRequest, RotateAdminAffiliateCouponCodeResponse, RequestConsignmentReminder, RequestConsignmentReminderRequest, RequestConsignmentReminderResponse, SetCustomerAffiliateAssignmentRequest, SetOrderAffiliateAttributionRequest, TransferConsignmentStockRequest, UpdateAffiliateProgramSettingsRequest, UpdateAffiliateRequest, UpdateAffiliateSlugRequest, } from "./types";
1
+ export type { AdminAffiliateCouponCode, AdminAffiliateCouponCodeResponse, Affiliate, AffiliateCouponLifecycleStatus, AffiliateCouponOrigin, AffiliateCouponProvisioningStatus, AffiliateCouponWireStatus, AffiliateCustomerAssignmentMode, AffiliateOrderAttribution, AffiliateReferralOverwritePolicy, AdminConsignmentReportResponse, AffiliateApplicationCompanyVerification, AffiliateCustomerSummary, AffiliateApplicationResponse, AffiliateDistributionReportsResponse, AffiliateDistributionReportRequest, AffiliateDistributionResponse, AffiliateProgramSettingsResponse, AffiliateReportDetailResponse, AffiliateReportEntry, AffiliateReportOverviewItem, AffiliateReportOverviewResponse, AffiliateReportTotals, AffiliateResponse, AffiliateSlugResponse, AppliedAffiliateCouponSnapshot, ApproveAffiliateApplicationRequest, ApproveAffiliateApplicationResponse, ApproveConsignmentReportRequest, ConsignmentNonSaleQuantity, ApproveConsignmentReportResponse, ConsignmentTransferResponse, CorrectConsignmentReportRequest, CorrectConsignmentReportResponse, CreateAdminAffiliateCouponCodeRequest, CreateAffiliateRequest, CreateAffiliateSlugRequest, CustomerAffiliateAssignmentResponse, CustomerAffiliateAssignment, EnableAffiliateDistributionRequest, ListAdminConsignmentReportsResponse, ListAdminAffiliateCouponCodesQuery, ListAdminAffiliateCouponCodesRequest, ListAdminAffiliateCouponCodesResponse, ListAffiliateApplicationsRequest, ListAffiliateApplicationsResponse, ListAffiliatesRequest, ListAffiliatesResponse, ListAffiliateSlugsResponse, OrderAffiliateAttributionResponse, PersistedAffiliateCustomerAssignmentMode, ListConsignmentReportsRequest, RejectAffiliateApplicationRequest, RejectConsignmentReportRequest, RejectConsignmentReportResponse, ReconcileAdminAffiliateCouponCodeResponse, ReportDateRangeRequest, ReportDetailRequest, RotateAdminAffiliateCouponCodeRequest, RotateAdminAffiliateCouponCodeResponse, RequestConsignmentReminder, RequestConsignmentReminderRequest, RequestConsignmentReminderResponse, SetCustomerAffiliateAssignmentRequest, SetOrderAffiliateAttributionRequest, TransferConsignmentStockRequest, UpdateAffiliateProgramSettingsRequest, UpdateAffiliateRequest, UpdateAffiliateSlugRequest, } from "./types";
@@ -370,10 +370,25 @@ export declare const GetOwnOrderDiscountResponseSchema: z.ZodObject<{
370
370
  export declare const ApplyOwnOrderPromotionResponseSchema: z.ZodObject<{
371
371
  applied: z.ZodBoolean;
372
372
  }, z.core.$strip>;
373
+ /**
374
+ * Display labels of a consignment line, resolved when the response is built.
375
+ * Every field is null when the product or batch can no longer be resolved;
376
+ * the ids stay the fallback.
377
+ */
378
+ export declare const ConsignmentLineLabelsSchema: z.ZodObject<{
379
+ product_title: z.ZodNullable<z.ZodString>;
380
+ variant_title: z.ZodNullable<z.ZodString>;
381
+ batch_name: z.ZodNullable<z.ZodString>;
382
+ batch_expiry_date: z.ZodNullable<z.ZodString>;
383
+ }, z.core.$strip>;
373
384
  export declare const StoreConsignmentInventoryLineSchema: z.ZodObject<{
374
385
  inventory_item_id: z.ZodString;
375
386
  batch_id: z.ZodNullable<z.ZodString>;
376
387
  expected_quantity: z.ZodNumber;
388
+ product_title: z.ZodNullable<z.ZodString>;
389
+ variant_title: z.ZodNullable<z.ZodString>;
390
+ batch_name: z.ZodNullable<z.ZodString>;
391
+ batch_expiry_date: z.ZodNullable<z.ZodString>;
377
392
  }, z.core.$strip>;
378
393
  export declare const GetConsignmentInventoryResponseSchema: z.ZodObject<{
379
394
  period_start: z.ZodString;
@@ -381,6 +396,10 @@ export declare const GetConsignmentInventoryResponseSchema: z.ZodObject<{
381
396
  inventory_item_id: z.ZodString;
382
397
  batch_id: z.ZodNullable<z.ZodString>;
383
398
  expected_quantity: z.ZodNumber;
399
+ product_title: z.ZodNullable<z.ZodString>;
400
+ variant_title: z.ZodNullable<z.ZodString>;
401
+ batch_name: z.ZodNullable<z.ZodString>;
402
+ batch_expiry_date: z.ZodNullable<z.ZodString>;
384
403
  }, z.core.$strip>>;
385
404
  }, z.core.$strip>;
386
405
  export declare const StoreConsignmentReportLineSchema: z.ZodObject<{
@@ -396,6 +415,10 @@ export declare const StoreConsignmentReportLineSchema: z.ZodObject<{
396
415
  resolved_unit_price: z.ZodNullable<z.ZodNumber>;
397
416
  discounted_line_total: z.ZodNullable<z.ZodNumber>;
398
417
  currency_code: z.ZodNullable<z.ZodString>;
418
+ product_title: z.ZodNullable<z.ZodString>;
419
+ variant_title: z.ZodNullable<z.ZodString>;
420
+ batch_name: z.ZodNullable<z.ZodString>;
421
+ batch_expiry_date: z.ZodNullable<z.ZodString>;
399
422
  }, z.core.$strip>;
400
423
  export declare const StoreConsignmentReportSchema: z.ZodObject<{
401
424
  id: z.ZodString;
@@ -424,6 +447,10 @@ export declare const StoreConsignmentReportSchema: z.ZodObject<{
424
447
  resolved_unit_price: z.ZodNullable<z.ZodNumber>;
425
448
  discounted_line_total: z.ZodNullable<z.ZodNumber>;
426
449
  currency_code: z.ZodNullable<z.ZodString>;
450
+ product_title: z.ZodNullable<z.ZodString>;
451
+ variant_title: z.ZodNullable<z.ZodString>;
452
+ batch_name: z.ZodNullable<z.ZodString>;
453
+ batch_expiry_date: z.ZodNullable<z.ZodString>;
427
454
  }, z.core.$strip>>;
428
455
  }, z.core.$strip>;
429
456
  export declare const SubmitConsignmentReportResponseSchema: z.ZodObject<{
@@ -454,6 +481,10 @@ export declare const SubmitConsignmentReportResponseSchema: z.ZodObject<{
454
481
  resolved_unit_price: z.ZodNullable<z.ZodNumber>;
455
482
  discounted_line_total: z.ZodNullable<z.ZodNumber>;
456
483
  currency_code: z.ZodNullable<z.ZodString>;
484
+ product_title: z.ZodNullable<z.ZodString>;
485
+ variant_title: z.ZodNullable<z.ZodString>;
486
+ batch_name: z.ZodNullable<z.ZodString>;
487
+ batch_expiry_date: z.ZodNullable<z.ZodString>;
457
488
  }, z.core.$strip>>;
458
489
  }, z.core.$strip>;
459
490
  draft_order: z.ZodNullable<z.ZodObject<{
@@ -488,6 +519,10 @@ export declare const ListConsignmentReportsResponseSchema: z.ZodObject<{
488
519
  resolved_unit_price: z.ZodNullable<z.ZodNumber>;
489
520
  discounted_line_total: z.ZodNullable<z.ZodNumber>;
490
521
  currency_code: z.ZodNullable<z.ZodString>;
522
+ product_title: z.ZodNullable<z.ZodString>;
523
+ variant_title: z.ZodNullable<z.ZodString>;
524
+ batch_name: z.ZodNullable<z.ZodString>;
525
+ batch_expiry_date: z.ZodNullable<z.ZodString>;
491
526
  }, z.core.$strip>>;
492
527
  }, z.core.$strip>>;
493
528
  }, z.core.$strip>;
@@ -828,11 +863,30 @@ export declare const ConsignmentNonSaleReasonSchema: z.ZodEnum<{
828
863
  returned: "returned";
829
864
  correction: "correction";
830
865
  }>;
866
+ /** A part of a line's not-sold shortage with its reason. */
867
+ export declare const ConsignmentNonSaleQuantitySchema: z.ZodObject<{
868
+ reason: z.ZodEnum<{
869
+ expired: "expired";
870
+ damaged: "damaged";
871
+ returned: "returned";
872
+ correction: "correction";
873
+ }>;
874
+ quantity: z.ZodNumber;
875
+ }, z.core.$strip>;
831
876
  export declare const ApproveConsignmentReportSchema: z.ZodObject<{
832
877
  expected_version: z.ZodOptional<z.ZodNumber>;
833
878
  confirmed_lines: z.ZodOptional<z.ZodArray<z.ZodObject<{
834
879
  report_line_id: z.ZodString;
835
880
  confirmed_sale_quantity: z.ZodNumber;
881
+ non_sale_quantities: z.ZodOptional<z.ZodArray<z.ZodObject<{
882
+ reason: z.ZodEnum<{
883
+ expired: "expired";
884
+ damaged: "damaged";
885
+ returned: "returned";
886
+ correction: "correction";
887
+ }>;
888
+ quantity: z.ZodNumber;
889
+ }, z.core.$strip>>>;
836
890
  non_sale_reason: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
837
891
  expired: "expired";
838
892
  damaged: "damaged";
@@ -2498,6 +2552,15 @@ export declare const AdminConsignmentReportLineSchema: z.ZodObject<{
2498
2552
  confirmed_sale_quantity: z.ZodNumber;
2499
2553
  requires_admin_clarification: z.ZodBoolean;
2500
2554
  non_sale_reason: z.ZodNullable<z.ZodString>;
2555
+ non_sale_quantities: z.ZodArray<z.ZodObject<{
2556
+ reason: z.ZodEnum<{
2557
+ expired: "expired";
2558
+ damaged: "damaged";
2559
+ returned: "returned";
2560
+ correction: "correction";
2561
+ }>;
2562
+ quantity: z.ZodNumber;
2563
+ }, z.core.$strip>>;
2501
2564
  correction_reason: z.ZodNullable<z.ZodString>;
2502
2565
  unit_price_snapshot: z.ZodNullable<z.ZodNumber>;
2503
2566
  discounted_line_total: z.ZodNullable<z.ZodNumber>;
@@ -2549,6 +2612,7 @@ export declare const AdminConsignmentReportSchema: z.ZodObject<{
2549
2612
  draft_order_id: z.ZodNullable<z.ZodString>;
2550
2613
  order_id: z.ZodNullable<z.ZodString>;
2551
2614
  order_display_id: z.ZodNullable<z.ZodNumber>;
2615
+ draft_order_display_id: z.ZodNullable<z.ZodNumber>;
2552
2616
  fulfillment_id: z.ZodNullable<z.ZodString>;
2553
2617
  submitted_at: z.ZodNullable<z.ZodString>;
2554
2618
  approved_at: z.ZodNullable<z.ZodString>;
@@ -2563,6 +2627,15 @@ export declare const AdminConsignmentReportSchema: z.ZodObject<{
2563
2627
  confirmed_sale_quantity: z.ZodNumber;
2564
2628
  requires_admin_clarification: z.ZodBoolean;
2565
2629
  non_sale_reason: z.ZodNullable<z.ZodString>;
2630
+ non_sale_quantities: z.ZodArray<z.ZodObject<{
2631
+ reason: z.ZodEnum<{
2632
+ expired: "expired";
2633
+ damaged: "damaged";
2634
+ returned: "returned";
2635
+ correction: "correction";
2636
+ }>;
2637
+ quantity: z.ZodNumber;
2638
+ }, z.core.$strip>>;
2566
2639
  correction_reason: z.ZodNullable<z.ZodString>;
2567
2640
  unit_price_snapshot: z.ZodNullable<z.ZodNumber>;
2568
2641
  discounted_line_total: z.ZodNullable<z.ZodNumber>;
@@ -2609,6 +2682,7 @@ export declare const ListAdminConsignmentReportsResponseSchema: z.ZodObject<{
2609
2682
  draft_order_id: z.ZodNullable<z.ZodString>;
2610
2683
  order_id: z.ZodNullable<z.ZodString>;
2611
2684
  order_display_id: z.ZodNullable<z.ZodNumber>;
2685
+ draft_order_display_id: z.ZodNullable<z.ZodNumber>;
2612
2686
  fulfillment_id: z.ZodNullable<z.ZodString>;
2613
2687
  submitted_at: z.ZodNullable<z.ZodString>;
2614
2688
  approved_at: z.ZodNullable<z.ZodString>;
@@ -2623,6 +2697,15 @@ export declare const ListAdminConsignmentReportsResponseSchema: z.ZodObject<{
2623
2697
  confirmed_sale_quantity: z.ZodNumber;
2624
2698
  requires_admin_clarification: z.ZodBoolean;
2625
2699
  non_sale_reason: z.ZodNullable<z.ZodString>;
2700
+ non_sale_quantities: z.ZodArray<z.ZodObject<{
2701
+ reason: z.ZodEnum<{
2702
+ expired: "expired";
2703
+ damaged: "damaged";
2704
+ returned: "returned";
2705
+ correction: "correction";
2706
+ }>;
2707
+ quantity: z.ZodNumber;
2708
+ }, z.core.$strip>>;
2626
2709
  correction_reason: z.ZodNullable<z.ZodString>;
2627
2710
  unit_price_snapshot: z.ZodNullable<z.ZodNumber>;
2628
2711
  discounted_line_total: z.ZodNullable<z.ZodNumber>;
@@ -2673,6 +2756,7 @@ export declare const AdminConsignmentReportResponseSchema: z.ZodObject<{
2673
2756
  draft_order_id: z.ZodNullable<z.ZodString>;
2674
2757
  order_id: z.ZodNullable<z.ZodString>;
2675
2758
  order_display_id: z.ZodNullable<z.ZodNumber>;
2759
+ draft_order_display_id: z.ZodNullable<z.ZodNumber>;
2676
2760
  fulfillment_id: z.ZodNullable<z.ZodString>;
2677
2761
  submitted_at: z.ZodNullable<z.ZodString>;
2678
2762
  approved_at: z.ZodNullable<z.ZodString>;
@@ -2687,6 +2771,15 @@ export declare const AdminConsignmentReportResponseSchema: z.ZodObject<{
2687
2771
  confirmed_sale_quantity: z.ZodNumber;
2688
2772
  requires_admin_clarification: z.ZodBoolean;
2689
2773
  non_sale_reason: z.ZodNullable<z.ZodString>;
2774
+ non_sale_quantities: z.ZodArray<z.ZodObject<{
2775
+ reason: z.ZodEnum<{
2776
+ expired: "expired";
2777
+ damaged: "damaged";
2778
+ returned: "returned";
2779
+ correction: "correction";
2780
+ }>;
2781
+ quantity: z.ZodNumber;
2782
+ }, z.core.$strip>>;
2690
2783
  correction_reason: z.ZodNullable<z.ZodString>;
2691
2784
  unit_price_snapshot: z.ZodNullable<z.ZodNumber>;
2692
2785
  discounted_line_total: z.ZodNullable<z.ZodNumber>;
@@ -2711,6 +2804,7 @@ export declare const AdminConsignmentReportResponseSchema: z.ZodObject<{
2711
2804
  }, z.core.$strip>>;
2712
2805
  }, z.core.$strip>;
2713
2806
  }, z.core.$strip>;
2807
+ /** Order, fulfillment and reservations are null/empty for a report approved without any sale. */
2714
2808
  export declare const ApproveConsignmentReportResponseSchema: z.ZodObject<{
2715
2809
  report: z.ZodObject<{
2716
2810
  id: z.ZodString;
@@ -2734,6 +2828,7 @@ export declare const ApproveConsignmentReportResponseSchema: z.ZodObject<{
2734
2828
  draft_order_id: z.ZodNullable<z.ZodString>;
2735
2829
  order_id: z.ZodNullable<z.ZodString>;
2736
2830
  order_display_id: z.ZodNullable<z.ZodNumber>;
2831
+ draft_order_display_id: z.ZodNullable<z.ZodNumber>;
2737
2832
  fulfillment_id: z.ZodNullable<z.ZodString>;
2738
2833
  submitted_at: z.ZodNullable<z.ZodString>;
2739
2834
  approved_at: z.ZodNullable<z.ZodString>;
@@ -2748,6 +2843,15 @@ export declare const ApproveConsignmentReportResponseSchema: z.ZodObject<{
2748
2843
  confirmed_sale_quantity: z.ZodNumber;
2749
2844
  requires_admin_clarification: z.ZodBoolean;
2750
2845
  non_sale_reason: z.ZodNullable<z.ZodString>;
2846
+ non_sale_quantities: z.ZodArray<z.ZodObject<{
2847
+ reason: z.ZodEnum<{
2848
+ expired: "expired";
2849
+ damaged: "damaged";
2850
+ returned: "returned";
2851
+ correction: "correction";
2852
+ }>;
2853
+ quantity: z.ZodNumber;
2854
+ }, z.core.$strip>>;
2751
2855
  correction_reason: z.ZodNullable<z.ZodString>;
2752
2856
  unit_price_snapshot: z.ZodNullable<z.ZodNumber>;
2753
2857
  discounted_line_total: z.ZodNullable<z.ZodNumber>;
@@ -2771,12 +2875,12 @@ export declare const ApproveConsignmentReportResponseSchema: z.ZodObject<{
2771
2875
  }, z.core.$strip>>;
2772
2876
  }, z.core.$strip>>;
2773
2877
  }, z.core.$strip>;
2774
- order_id: z.ZodString;
2775
- fulfillment_id: z.ZodString;
2776
- order: z.ZodObject<{
2878
+ order_id: z.ZodNullable<z.ZodString>;
2879
+ fulfillment_id: z.ZodNullable<z.ZodString>;
2880
+ order: z.ZodNullable<z.ZodObject<{
2777
2881
  id: z.ZodString;
2778
2882
  is_draft_order: z.ZodBoolean;
2779
- }, z.core.$strip>;
2883
+ }, z.core.$strip>>;
2780
2884
  reservations: z.ZodArray<z.ZodObject<{
2781
2885
  id: z.ZodString;
2782
2886
  inventory_item_id: z.ZodString;
@@ -2784,14 +2888,14 @@ export declare const ApproveConsignmentReportResponseSchema: z.ZodObject<{
2784
2888
  line_item_id: z.ZodNullable<z.ZodString>;
2785
2889
  quantity: z.ZodNumber;
2786
2890
  }, z.core.$strip>>;
2787
- fulfillment: z.ZodObject<{
2891
+ fulfillment: z.ZodNullable<z.ZodObject<{
2788
2892
  id: z.ZodString;
2789
2893
  location_id: z.ZodString;
2790
2894
  items: z.ZodArray<z.ZodObject<{
2791
2895
  line_item_id: z.ZodString;
2792
2896
  quantity: z.ZodNumber;
2793
2897
  }, z.core.$strip>>;
2794
- }, z.core.$strip>;
2898
+ }, z.core.$strip>>;
2795
2899
  batch_inventory: z.ZodOptional<z.ZodArray<z.ZodObject<{
2796
2900
  id: z.ZodString;
2797
2901
  quantity: z.ZodNumber;
@@ -2822,6 +2926,7 @@ export declare const RejectConsignmentReportResponseSchema: z.ZodObject<{
2822
2926
  draft_order_id: z.ZodNullable<z.ZodString>;
2823
2927
  order_id: z.ZodNullable<z.ZodString>;
2824
2928
  order_display_id: z.ZodNullable<z.ZodNumber>;
2929
+ draft_order_display_id: z.ZodNullable<z.ZodNumber>;
2825
2930
  fulfillment_id: z.ZodNullable<z.ZodString>;
2826
2931
  submitted_at: z.ZodNullable<z.ZodString>;
2827
2932
  approved_at: z.ZodNullable<z.ZodString>;
@@ -2836,6 +2941,15 @@ export declare const RejectConsignmentReportResponseSchema: z.ZodObject<{
2836
2941
  confirmed_sale_quantity: z.ZodNumber;
2837
2942
  requires_admin_clarification: z.ZodBoolean;
2838
2943
  non_sale_reason: z.ZodNullable<z.ZodString>;
2944
+ non_sale_quantities: z.ZodArray<z.ZodObject<{
2945
+ reason: z.ZodEnum<{
2946
+ expired: "expired";
2947
+ damaged: "damaged";
2948
+ returned: "returned";
2949
+ correction: "correction";
2950
+ }>;
2951
+ quantity: z.ZodNumber;
2952
+ }, z.core.$strip>>;
2839
2953
  correction_reason: z.ZodNullable<z.ZodString>;
2840
2954
  unit_price_snapshot: z.ZodNullable<z.ZodNumber>;
2841
2955
  discounted_line_total: z.ZodNullable<z.ZodNumber>;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ListConsignmentReportsResponseSchema = exports.SubmitConsignmentReportResponseSchema = exports.StoreConsignmentReportSchema = exports.StoreConsignmentReportLineSchema = exports.GetConsignmentInventoryResponseSchema = exports.StoreConsignmentInventoryLineSchema = exports.ApplyOwnOrderPromotionResponseSchema = exports.GetOwnOrderDiscountResponseSchema = exports.GetAffiliateCartReferralResponseSchema = exports.ApplyAffiliateCouponResponseSchema = exports.CaptureAffiliateReferralResponseSchema = exports.StoreAffiliateReferralSchema = exports.ResolveAffiliateReferralResponseSchema = exports.SubmitAffiliateApplicationResponseSchema = exports.StoreAffiliateApplicationSchema = exports.StoreAffiliateSlugSchema = exports.StoreAffiliateSchema = exports.UpdatePartnerPortalSlugSchema = exports.CreatePartnerPortalSlugSchema = exports.PartnerPortalEmptyQuerySchema = exports.PartnerPortalCommissionsQuerySchema = exports.PartnerPortalDateRangeQuerySchema = exports.createPartnerPortalDateRangeQuerySchema = exports.SubmitExistingConsignmentReportSchema = exports.SubmitConsignmentReportSchema = exports.AffiliateCouponLabelsResponseSchema = exports.AffiliateCouponLabelSchema = exports.ResolveAffiliateCouponLabelsPayloadSchema = exports.ApplyAffiliateCouponSchema = exports.CaptureAffiliateReferralSchema = exports.ApplyOwnOrderPromotionSchema = exports.ResolveReferralQuerySchema = exports.SubmitAffiliateApplicationSchema = exports.CalendarMonthSchema = exports.CalendarDateSchema = exports.CommissionEntryTypeSchema = exports.AffiliateReferralResultStatusSchema = exports.AffiliateCartReferralRecordStatusSchema = exports.AffiliateCouponOriginSchema = exports.AffiliateCouponWireStatusSchema = exports.AffiliateCouponProvisioningStatusSchema = exports.AffiliateCouponLifecycleStatusSchema = exports.AffiliateReferralSignalSourceSchema = exports.AffiliateReferralOverwritePolicySchema = exports.PersistedAffiliateCustomerAssignmentModeSchema = exports.AffiliateCustomerAssignmentModeSchema = exports.AssignmentSourceSchema = exports.AffiliateApplicationStatusSchema = exports.AffiliateStatusSchema = exports.WireDateSchema = void 0;
4
- exports.AffiliateApplicationResponseSchema = exports.ListAffiliateApplicationsResponseSchema = exports.CommissionEntrySchema = exports.CustomerAffiliateAssignmentSchema = exports.AffiliateApplicationSchema = exports.AffiliateApplicationCompanyVerificationSchema = exports.AffiliateSchema = exports.AffiliateCustomerSummarySchema = exports.AffiliateSlugSchema = exports.ListConsignmentReportsQuerySchema = exports.AffiliateDistributionReportQuerySchema = exports.UpdateAffiliateProgramSettingsSchema = exports.ReportDetailQuerySchema = exports.ReportDateRangeQuerySchema = exports.RequestConsignmentReminderSchema = exports.CorrectConsignmentReportSchema = exports.RejectConsignmentReportSchema = exports.ApproveConsignmentReportSchema = exports.ConsignmentNonSaleReasonSchema = exports.TransferConsignmentStockSchema = exports.EnableAffiliateDistributionSchema = exports.SetCustomerAffiliateAssignmentSchema = exports.SetOrderAffiliateAttributionSchema = exports.UpdateAffiliateSlugSchema = exports.CreateAffiliateSlugSchema = exports.UpdateAffiliateSchema = exports.CreateAffiliateSchema = exports.ListAffiliatesQuerySchema = exports.RejectAffiliateApplicationSchema = exports.ApproveAffiliateApplicationSchema = exports.ListAffiliateApplicationsQuerySchema = exports.OwnOrderDiscountQuerySchema = exports.PaginationQuerySchema = exports.RotateAdminAffiliateCouponCodeSchema = exports.CreateAdminAffiliateCouponCodeSchema = exports.ListAdminAffiliateCouponCodesQuerySchema = exports.RotateStoreAffiliateCouponCodeSchema = exports.CreateStoreAffiliateCouponCodeSchema = exports.ListStoreAffiliateCouponCodesQuerySchema = exports.GetAffiliatePortalCommissionsResponseSchema = exports.StoreAffiliatePortalCommissionSchema = exports.GetAffiliatePortalDashboardResponseSchema = exports.PortalCurrencyTotalsSchema = exports.UpdatePartnerPortalSlugResponseSchema = exports.CreatePartnerPortalSlugResponseSchema = exports.ListPartnerPortalSlugsResponseSchema = exports.StoreAffiliatePortalContextResponseSchema = exports.StoreAffiliatePortalSlugSchema = exports.StoreAffiliatePortalAffiliateSchema = exports.StoreAffiliatePortalApplicationSchema = void 0;
5
- exports.CorrectConsignmentReportResponseSchema = exports.RejectConsignmentReportResponseSchema = exports.ApproveConsignmentReportResponseSchema = exports.AdminConsignmentReportResponseSchema = exports.ListAdminConsignmentReportsResponseSchema = exports.AdminConsignmentReportSchema = exports.AdminConsignmentReportCorrectionSchema = exports.AdminConsignmentReportLineSchema = exports.RequestConsignmentReminderResponseSchema = exports.ConsignmentTransferResponseSchema = exports.ConsignmentTransferSchema = exports.AffiliateDistributionResponseSchema = exports.AffiliateDistributionSettingsSchema = exports.AffiliateDistributionReportsResponseSchema = exports.AffiliateDistributionReportItemSchema = exports.AffiliateDistributionCurrencyTotalSchema = exports.AffiliateProgramSettingsResponseSchema = exports.AffiliateProgramSettingsSchema = exports.AffiliateReportDetailResponseSchema = exports.AffiliateReportEntrySchema = exports.AffiliateReportTotalsSchema = exports.AffiliateReportOverviewResponseSchema = exports.AffiliateReportOverviewItemSchema = exports.OrderAffiliateAttributionResponseSchema = exports.AffiliateOrderAttributionSchema = exports.CustomerAffiliateAssignmentResponseSchema = exports.ReconcileAdminAffiliateCouponCodeResponseSchema = exports.RotateAdminAffiliateCouponCodeResponseSchema = exports.AdminAffiliateCouponCodeResponseSchema = exports.ListAdminAffiliateCouponCodesResponseSchema = exports.RotateStoreAffiliateCouponCodeResponseSchema = exports.StoreAffiliateCouponCodeResponseSchema = exports.ListStoreAffiliateCouponCodesResponseSchema = exports.AppliedAffiliateCouponSnapshotSchema = exports.AdminAffiliateCouponCodeSchema = exports.StoreAffiliateCouponCodeSchema = exports.ListAffiliateSlugsResponseSchema = exports.AffiliateSlugResponseSchema = exports.AffiliateResponseSchema = exports.ListAffiliatesResponseSchema = exports.ApproveAffiliateApplicationResponseSchema = void 0;
3
+ exports.SubmitConsignmentReportResponseSchema = exports.StoreConsignmentReportSchema = exports.StoreConsignmentReportLineSchema = exports.GetConsignmentInventoryResponseSchema = exports.StoreConsignmentInventoryLineSchema = exports.ConsignmentLineLabelsSchema = exports.ApplyOwnOrderPromotionResponseSchema = exports.GetOwnOrderDiscountResponseSchema = exports.GetAffiliateCartReferralResponseSchema = exports.ApplyAffiliateCouponResponseSchema = exports.CaptureAffiliateReferralResponseSchema = exports.StoreAffiliateReferralSchema = exports.ResolveAffiliateReferralResponseSchema = exports.SubmitAffiliateApplicationResponseSchema = exports.StoreAffiliateApplicationSchema = exports.StoreAffiliateSlugSchema = exports.StoreAffiliateSchema = exports.UpdatePartnerPortalSlugSchema = exports.CreatePartnerPortalSlugSchema = exports.PartnerPortalEmptyQuerySchema = exports.PartnerPortalCommissionsQuerySchema = exports.PartnerPortalDateRangeQuerySchema = exports.createPartnerPortalDateRangeQuerySchema = exports.SubmitExistingConsignmentReportSchema = exports.SubmitConsignmentReportSchema = exports.AffiliateCouponLabelsResponseSchema = exports.AffiliateCouponLabelSchema = exports.ResolveAffiliateCouponLabelsPayloadSchema = exports.ApplyAffiliateCouponSchema = exports.CaptureAffiliateReferralSchema = exports.ApplyOwnOrderPromotionSchema = exports.ResolveReferralQuerySchema = exports.SubmitAffiliateApplicationSchema = exports.CalendarMonthSchema = exports.CalendarDateSchema = exports.CommissionEntryTypeSchema = exports.AffiliateReferralResultStatusSchema = exports.AffiliateCartReferralRecordStatusSchema = exports.AffiliateCouponOriginSchema = exports.AffiliateCouponWireStatusSchema = exports.AffiliateCouponProvisioningStatusSchema = exports.AffiliateCouponLifecycleStatusSchema = exports.AffiliateReferralSignalSourceSchema = exports.AffiliateReferralOverwritePolicySchema = exports.PersistedAffiliateCustomerAssignmentModeSchema = exports.AffiliateCustomerAssignmentModeSchema = exports.AssignmentSourceSchema = exports.AffiliateApplicationStatusSchema = exports.AffiliateStatusSchema = exports.WireDateSchema = void 0;
4
+ exports.CommissionEntrySchema = exports.CustomerAffiliateAssignmentSchema = exports.AffiliateApplicationSchema = exports.AffiliateApplicationCompanyVerificationSchema = exports.AffiliateSchema = exports.AffiliateCustomerSummarySchema = exports.AffiliateSlugSchema = exports.ListConsignmentReportsQuerySchema = exports.AffiliateDistributionReportQuerySchema = exports.UpdateAffiliateProgramSettingsSchema = exports.ReportDetailQuerySchema = exports.ReportDateRangeQuerySchema = exports.RequestConsignmentReminderSchema = exports.CorrectConsignmentReportSchema = exports.RejectConsignmentReportSchema = exports.ApproveConsignmentReportSchema = exports.ConsignmentNonSaleQuantitySchema = exports.ConsignmentNonSaleReasonSchema = exports.TransferConsignmentStockSchema = exports.EnableAffiliateDistributionSchema = exports.SetCustomerAffiliateAssignmentSchema = exports.SetOrderAffiliateAttributionSchema = exports.UpdateAffiliateSlugSchema = exports.CreateAffiliateSlugSchema = exports.UpdateAffiliateSchema = exports.CreateAffiliateSchema = exports.ListAffiliatesQuerySchema = exports.RejectAffiliateApplicationSchema = exports.ApproveAffiliateApplicationSchema = exports.ListAffiliateApplicationsQuerySchema = exports.OwnOrderDiscountQuerySchema = exports.PaginationQuerySchema = exports.RotateAdminAffiliateCouponCodeSchema = exports.CreateAdminAffiliateCouponCodeSchema = exports.ListAdminAffiliateCouponCodesQuerySchema = exports.RotateStoreAffiliateCouponCodeSchema = exports.CreateStoreAffiliateCouponCodeSchema = exports.ListStoreAffiliateCouponCodesQuerySchema = exports.GetAffiliatePortalCommissionsResponseSchema = exports.StoreAffiliatePortalCommissionSchema = exports.GetAffiliatePortalDashboardResponseSchema = exports.PortalCurrencyTotalsSchema = exports.UpdatePartnerPortalSlugResponseSchema = exports.CreatePartnerPortalSlugResponseSchema = exports.ListPartnerPortalSlugsResponseSchema = exports.StoreAffiliatePortalContextResponseSchema = exports.StoreAffiliatePortalSlugSchema = exports.StoreAffiliatePortalAffiliateSchema = exports.StoreAffiliatePortalApplicationSchema = exports.ListConsignmentReportsResponseSchema = void 0;
5
+ exports.CorrectConsignmentReportResponseSchema = exports.RejectConsignmentReportResponseSchema = exports.ApproveConsignmentReportResponseSchema = exports.AdminConsignmentReportResponseSchema = exports.ListAdminConsignmentReportsResponseSchema = exports.AdminConsignmentReportSchema = exports.AdminConsignmentReportCorrectionSchema = exports.AdminConsignmentReportLineSchema = exports.RequestConsignmentReminderResponseSchema = exports.ConsignmentTransferResponseSchema = exports.ConsignmentTransferSchema = exports.AffiliateDistributionResponseSchema = exports.AffiliateDistributionSettingsSchema = exports.AffiliateDistributionReportsResponseSchema = exports.AffiliateDistributionReportItemSchema = exports.AffiliateDistributionCurrencyTotalSchema = exports.AffiliateProgramSettingsResponseSchema = exports.AffiliateProgramSettingsSchema = exports.AffiliateReportDetailResponseSchema = exports.AffiliateReportEntrySchema = exports.AffiliateReportTotalsSchema = exports.AffiliateReportOverviewResponseSchema = exports.AffiliateReportOverviewItemSchema = exports.OrderAffiliateAttributionResponseSchema = exports.AffiliateOrderAttributionSchema = exports.CustomerAffiliateAssignmentResponseSchema = exports.ReconcileAdminAffiliateCouponCodeResponseSchema = exports.RotateAdminAffiliateCouponCodeResponseSchema = exports.AdminAffiliateCouponCodeResponseSchema = exports.ListAdminAffiliateCouponCodesResponseSchema = exports.RotateStoreAffiliateCouponCodeResponseSchema = exports.StoreAffiliateCouponCodeResponseSchema = exports.ListStoreAffiliateCouponCodesResponseSchema = exports.AppliedAffiliateCouponSnapshotSchema = exports.AdminAffiliateCouponCodeSchema = exports.StoreAffiliateCouponCodeSchema = exports.ListAffiliateSlugsResponseSchema = exports.AffiliateSlugResponseSchema = exports.AffiliateResponseSchema = exports.ListAffiliatesResponseSchema = exports.ApproveAffiliateApplicationResponseSchema = exports.AffiliateApplicationResponseSchema = exports.ListAffiliateApplicationsResponseSchema = void 0;
6
6
  const zod_1 = require("@medusajs/framework/zod");
7
7
  const primitives_1 = require("../shared/primitives");
8
8
  Object.defineProperty(exports, "WireDateSchema", { enumerable: true, get: function () { return primitives_1.WireDateSchema; } });
@@ -306,16 +306,30 @@ exports.GetOwnOrderDiscountResponseSchema = zod_1.z.object({
306
306
  exports.ApplyOwnOrderPromotionResponseSchema = zod_1.z.object({
307
307
  applied: zod_1.z.boolean(),
308
308
  });
309
- exports.StoreConsignmentInventoryLineSchema = zod_1.z.object({
309
+ /**
310
+ * Display labels of a consignment line, resolved when the response is built.
311
+ * Every field is null when the product or batch can no longer be resolved;
312
+ * the ids stay the fallback.
313
+ */
314
+ exports.ConsignmentLineLabelsSchema = zod_1.z.object({
315
+ product_title: zod_1.z.string().nullable(),
316
+ variant_title: zod_1.z.string().nullable(),
317
+ batch_name: zod_1.z.string().nullable(),
318
+ batch_expiry_date: exports.CalendarDateSchema.nullable(),
319
+ });
320
+ exports.StoreConsignmentInventoryLineSchema = zod_1.z
321
+ .object({
310
322
  inventory_item_id: zod_1.z.string().trim().min(1),
311
323
  batch_id: zod_1.z.string().trim().min(1).nullable(),
312
324
  expected_quantity: zod_1.z.number(),
313
- });
325
+ })
326
+ .extend(exports.ConsignmentLineLabelsSchema.shape);
314
327
  exports.GetConsignmentInventoryResponseSchema = zod_1.z.object({
315
328
  period_start: exports.CalendarMonthSchema,
316
329
  inventory: zod_1.z.array(exports.StoreConsignmentInventoryLineSchema),
317
330
  });
318
- exports.StoreConsignmentReportLineSchema = zod_1.z.object({
331
+ exports.StoreConsignmentReportLineSchema = zod_1.z
332
+ .object({
319
333
  id: zod_1.z.string().trim().min(1),
320
334
  inventory_item_id: zod_1.z.string().trim().min(1),
321
335
  batch_id: zod_1.z.string().trim().min(1).nullable(),
@@ -328,7 +342,8 @@ exports.StoreConsignmentReportLineSchema = zod_1.z.object({
328
342
  resolved_unit_price: zod_1.z.number().nullable(),
329
343
  discounted_line_total: zod_1.z.number().nullable(),
330
344
  currency_code: zod_1.z.string().nullable(),
331
- });
345
+ })
346
+ .extend(exports.ConsignmentLineLabelsSchema.shape);
332
347
  exports.StoreConsignmentReportSchema = zod_1.z.object({
333
348
  id: zod_1.z.string().trim().min(1),
334
349
  affiliate_id: zod_1.z.string().trim().min(1),
@@ -618,12 +633,27 @@ exports.ConsignmentNonSaleReasonSchema = zod_1.z.enum([
618
633
  "returned",
619
634
  "correction",
620
635
  ]);
636
+ /** A part of a line's not-sold shortage with its reason. */
637
+ exports.ConsignmentNonSaleQuantitySchema = zod_1.z.object({
638
+ reason: exports.ConsignmentNonSaleReasonSchema,
639
+ quantity: zod_1.z.number().int().positive(),
640
+ });
621
641
  exports.ApproveConsignmentReportSchema = zod_1.z.object({
622
642
  expected_version: zod_1.z.number().int().positive().optional(),
623
643
  confirmed_lines: zod_1.z
624
644
  .array(zod_1.z.object({
625
645
  report_line_id: zod_1.z.string().trim().min(1),
626
646
  confirmed_sale_quantity: zod_1.z.number().int().min(0),
647
+ /**
648
+ * Split of the not-sold shortage (shortage minus confirmed sale) by
649
+ * reason; the quantities must add up to it. Takes precedence over
650
+ * `non_sale_reason`.
651
+ */
652
+ non_sale_quantities: zod_1.z
653
+ .array(exports.ConsignmentNonSaleQuantitySchema)
654
+ .max(20)
655
+ .optional(),
656
+ /** Legacy: one reason for the whole not-sold shortage. */
627
657
  non_sale_reason: exports.ConsignmentNonSaleReasonSchema.optional().nullable(),
628
658
  }))
629
659
  .max(500)
@@ -1071,7 +1101,10 @@ exports.AdminConsignmentReportLineSchema = zod_1.z.object({
1071
1101
  proposed_sale_quantity: zod_1.z.number(),
1072
1102
  confirmed_sale_quantity: zod_1.z.number(),
1073
1103
  requires_admin_clarification: zod_1.z.boolean(),
1104
+ /** The single reason, null with several reasons or none. */
1074
1105
  non_sale_reason: zod_1.z.string().nullable(),
1106
+ /** Not-sold shortage by reason; empty when everything missing was sold. */
1107
+ non_sale_quantities: zod_1.z.array(exports.ConsignmentNonSaleQuantitySchema),
1075
1108
  correction_reason: zod_1.z.string().nullable(),
1076
1109
  unit_price_snapshot: zod_1.z.number().nullable(),
1077
1110
  discounted_line_total: zod_1.z.number().nullable(),
@@ -1115,6 +1148,8 @@ exports.AdminConsignmentReportSchema = zod_1.z.object({
1115
1148
  order_id: zod_1.z.string().nullable(),
1116
1149
  /** Customer-facing display id of `order_id`; null without an order. */
1117
1150
  order_display_id: zod_1.z.number().int().nullable(),
1151
+ /** Display id of `draft_order_id`; null without a draft order. */
1152
+ draft_order_display_id: zod_1.z.number().int().nullable(),
1118
1153
  fulfillment_id: zod_1.z.string().nullable(),
1119
1154
  submitted_at: primitives_1.WireDateSchema.nullable(),
1120
1155
  approved_at: primitives_1.WireDateSchema.nullable(),
@@ -1148,13 +1183,14 @@ const ConsignmentFulfillmentSchema = zod_1.z.object({
1148
1183
  location_id: zod_1.z.string(),
1149
1184
  items: zod_1.z.array(zod_1.z.object({ line_item_id: zod_1.z.string(), quantity: zod_1.z.number() })),
1150
1185
  });
1186
+ /** Order, fulfillment and reservations are null/empty for a report approved without any sale. */
1151
1187
  exports.ApproveConsignmentReportResponseSchema = zod_1.z.object({
1152
1188
  report: exports.AdminConsignmentReportSchema,
1153
- order_id: zod_1.z.string(),
1154
- fulfillment_id: zod_1.z.string(),
1155
- order: zod_1.z.object({ id: zod_1.z.string(), is_draft_order: zod_1.z.boolean() }),
1189
+ order_id: zod_1.z.string().nullable(),
1190
+ fulfillment_id: zod_1.z.string().nullable(),
1191
+ order: zod_1.z.object({ id: zod_1.z.string(), is_draft_order: zod_1.z.boolean() }).nullable(),
1156
1192
  reservations: zod_1.z.array(ConsignmentReservationSchema),
1157
- fulfillment: ConsignmentFulfillmentSchema,
1193
+ fulfillment: ConsignmentFulfillmentSchema.nullable(),
1158
1194
  batch_inventory: zod_1.z
1159
1195
  .array(zod_1.z.object({ id: zod_1.z.string(), quantity: zod_1.z.number() }))
1160
1196
  .optional(),
@@ -1 +1 @@
1
- export type { AffiliateCartReferralRecordStatus, AffiliateCouponLifecycleStatus, AffiliateCouponOrigin, AffiliateCouponWireStatus, AffiliateCustomerAssignmentMode, AffiliateReferralOverwritePolicy, AffiliateReferralResultStatus, AffiliateReferralSignalSource, AffiliateCouponLabel, AffiliateCouponLabelsResponse, ApplyAffiliateCouponRequest, ApplyAffiliateCouponResponse, ApplyOwnOrderPromotionRequest, ApplyOwnOrderPromotionResponse, CaptureAffiliateReferralRequest, CaptureAffiliateReferralResponse, CreateStoreAffiliateCouponCodeRequest, CreatePartnerPortalSlugRequest, CreatePartnerPortalSlugResponse, GetAffiliatePortalCommissionsResponse, GetAffiliatePortalDashboardResponse, GetAffiliateCartReferralResponse, GetConsignmentInventoryResponse, GetOwnOrderDiscountResponse, ListConsignmentReportsResponse, ListPartnerPortalSlugsResponse, ListStoreAffiliateCouponCodesQuery, ListStoreAffiliateCouponCodesRequest, ListStoreAffiliateCouponCodesResponse, PartnerPortalCommissionsQuery, PartnerPortalCommissionsRequest, PartnerPortalDateRangeQuery, PartnerPortalDateRangeRequest, PortalCurrencyTotals, ResolveAffiliateCouponLabelsPayload, ResolveAffiliateReferralRequest, ResolveAffiliateReferralResponse, RotateStoreAffiliateCouponCodeRequest, RotateStoreAffiliateCouponCodeResponse, StoreAffiliateApplication, StoreAffiliateCouponCode, StoreAffiliateCouponCodeResponse, StoreAffiliateReferral, StoreAffiliatePortalAffiliate, StoreAffiliatePortalApplication, StoreAffiliatePortalCommission, StoreAffiliatePortalContextResponse, StoreAffiliatePortalSlug, StoreConsignmentInventoryLine, StoreConsignmentReport, SubmitAffiliateApplicationRequest, SubmitAffiliateApplicationResponse, SubmitConsignmentReportRequest, SubmitConsignmentReportResponse, SubmitExistingConsignmentReportRequest, UpdatePartnerPortalSlugRequest, UpdatePartnerPortalSlugResponse, } from "./types";
1
+ export type { AffiliateCartReferralRecordStatus, AffiliateCouponLifecycleStatus, AffiliateCouponOrigin, AffiliateCouponWireStatus, AffiliateCustomerAssignmentMode, AffiliateReferralOverwritePolicy, AffiliateReferralResultStatus, AffiliateReferralSignalSource, AffiliateCouponLabel, AffiliateCouponLabelsResponse, ApplyAffiliateCouponRequest, ApplyAffiliateCouponResponse, ApplyOwnOrderPromotionRequest, ApplyOwnOrderPromotionResponse, CaptureAffiliateReferralRequest, CaptureAffiliateReferralResponse, CreateStoreAffiliateCouponCodeRequest, CreatePartnerPortalSlugRequest, CreatePartnerPortalSlugResponse, GetAffiliatePortalCommissionsResponse, GetAffiliatePortalDashboardResponse, GetAffiliateCartReferralResponse, GetConsignmentInventoryResponse, GetOwnOrderDiscountResponse, ListConsignmentReportsResponse, ListPartnerPortalSlugsResponse, ListStoreAffiliateCouponCodesQuery, ListStoreAffiliateCouponCodesRequest, ListStoreAffiliateCouponCodesResponse, PartnerPortalCommissionsQuery, PartnerPortalCommissionsRequest, PartnerPortalDateRangeQuery, PartnerPortalDateRangeRequest, PortalCurrencyTotals, ResolveAffiliateCouponLabelsPayload, ResolveAffiliateReferralRequest, ResolveAffiliateReferralResponse, RotateStoreAffiliateCouponCodeRequest, RotateStoreAffiliateCouponCodeResponse, StoreAffiliateApplication, StoreAffiliateCouponCode, StoreAffiliateCouponCodeResponse, StoreAffiliateReferral, StoreAffiliatePortalAffiliate, StoreAffiliatePortalApplication, StoreAffiliatePortalCommission, StoreAffiliatePortalContextResponse, StoreAffiliatePortalSlug, ConsignmentLineLabels, StoreConsignmentInventoryLine, StoreConsignmentReport, StoreConsignmentReportLine, SubmitAffiliateApplicationRequest, SubmitAffiliateApplicationResponse, SubmitConsignmentReportRequest, SubmitConsignmentReportResponse, SubmitExistingConsignmentReportRequest, UpdatePartnerPortalSlugRequest, UpdatePartnerPortalSlugResponse, } from "./types";
@@ -1,5 +1,5 @@
1
1
  import type { z } from "@medusajs/framework/zod";
2
- import type { AdminAffiliateCouponCodeResponseSchema, AdminAffiliateCouponCodeSchema, AdminConsignmentReportResponseSchema, AdminConsignmentReportSchema, AffiliateCartReferralRecordStatusSchema, AffiliateCouponLifecycleStatusSchema, AffiliateCouponOriginSchema, AffiliateCouponProvisioningStatusSchema, AffiliateCouponWireStatusSchema, AffiliateCustomerAssignmentModeSchema, AffiliateOrderAttributionSchema, AffiliateReferralOverwritePolicySchema, AffiliateReferralResultStatusSchema, AffiliateReferralSignalSourceSchema, AffiliateApplicationCompanyVerificationSchema, AffiliateCustomerSummarySchema, AffiliateApplicationResponseSchema, AffiliateDistributionReportsResponseSchema, AffiliateDistributionReportQuerySchema, AffiliateDistributionResponseSchema, AffiliateProgramSettingsResponseSchema, AffiliateReportDetailResponseSchema, AffiliateReportEntrySchema, AffiliateReportOverviewItemSchema, AffiliateReportOverviewResponseSchema, AffiliateReportTotalsSchema, AffiliateResponseSchema, AffiliateSchema, AffiliateSlugResponseSchema, ApplyOwnOrderPromotionResponseSchema, ApplyOwnOrderPromotionSchema, ApplyAffiliateCouponResponseSchema, ApplyAffiliateCouponSchema, AppliedAffiliateCouponSnapshotSchema, AffiliateCouponLabelSchema, AffiliateCouponLabelsResponseSchema, ResolveAffiliateCouponLabelsPayloadSchema, ApproveAffiliateApplicationResponseSchema, ApproveAffiliateApplicationSchema, ApproveConsignmentReportResponseSchema, ApproveConsignmentReportSchema, CaptureAffiliateReferralResponseSchema, CaptureAffiliateReferralSchema, ConsignmentTransferResponseSchema, CorrectConsignmentReportResponseSchema, CorrectConsignmentReportSchema, CreateAdminAffiliateCouponCodeSchema, CreateAffiliateSchema, CreateAffiliateSlugSchema, CreatePartnerPortalSlugResponseSchema, CreatePartnerPortalSlugSchema, CreateStoreAffiliateCouponCodeSchema, CustomerAffiliateAssignmentResponseSchema, CustomerAffiliateAssignmentSchema, EnableAffiliateDistributionSchema, GetAffiliatePortalCommissionsResponseSchema, GetAffiliatePortalDashboardResponseSchema, GetAffiliateCartReferralResponseSchema, GetConsignmentInventoryResponseSchema, GetOwnOrderDiscountResponseSchema, ListAdminConsignmentReportsResponseSchema, ListAdminAffiliateCouponCodesQuerySchema, ListAdminAffiliateCouponCodesResponseSchema, ListAffiliateApplicationsQuerySchema, ListAffiliateApplicationsResponseSchema, ListAffiliatesQuerySchema, ListAffiliatesResponseSchema, ListAffiliateSlugsResponseSchema, ListConsignmentReportsQuerySchema, ListConsignmentReportsResponseSchema, ListPartnerPortalSlugsResponseSchema, ListStoreAffiliateCouponCodesQuerySchema, ListStoreAffiliateCouponCodesResponseSchema, PartnerPortalCommissionsQuerySchema, PartnerPortalDateRangeQuerySchema, OrderAffiliateAttributionResponseSchema, PortalCurrencyTotalsSchema, PersistedAffiliateCustomerAssignmentModeSchema, RejectAffiliateApplicationSchema, RejectConsignmentReportResponseSchema, RejectConsignmentReportSchema, ReconcileAdminAffiliateCouponCodeResponseSchema, ReportDateRangeQuerySchema, ReportDetailQuerySchema, ResolveAffiliateReferralResponseSchema, ResolveReferralQuerySchema, RotateAdminAffiliateCouponCodeResponseSchema, RotateAdminAffiliateCouponCodeSchema, RotateStoreAffiliateCouponCodeResponseSchema, RotateStoreAffiliateCouponCodeSchema, RequestConsignmentReminderResponseSchema, RequestConsignmentReminderSchema, SetCustomerAffiliateAssignmentSchema, SetOrderAffiliateAttributionSchema, StoreAffiliateApplicationSchema, StoreAffiliateCouponCodeResponseSchema, StoreAffiliateCouponCodeSchema, StoreAffiliateReferralSchema, StoreAffiliatePortalAffiliateSchema, StoreAffiliatePortalApplicationSchema, StoreAffiliatePortalCommissionSchema, StoreAffiliatePortalContextResponseSchema, StoreAffiliatePortalSlugSchema, StoreConsignmentInventoryLineSchema, StoreConsignmentReportSchema, SubmitAffiliateApplicationResponseSchema, SubmitAffiliateApplicationSchema, SubmitConsignmentReportResponseSchema, SubmitConsignmentReportSchema, SubmitExistingConsignmentReportSchema, TransferConsignmentStockSchema, UpdateAffiliateProgramSettingsSchema, UpdateAffiliateSchema, UpdateAffiliateSlugSchema, UpdatePartnerPortalSlugResponseSchema, UpdatePartnerPortalSlugSchema } from "./schemas";
2
+ import type { AdminAffiliateCouponCodeResponseSchema, AdminAffiliateCouponCodeSchema, AdminConsignmentReportResponseSchema, AdminConsignmentReportSchema, AffiliateCartReferralRecordStatusSchema, AffiliateCouponLifecycleStatusSchema, AffiliateCouponOriginSchema, AffiliateCouponProvisioningStatusSchema, AffiliateCouponWireStatusSchema, AffiliateCustomerAssignmentModeSchema, AffiliateOrderAttributionSchema, AffiliateReferralOverwritePolicySchema, AffiliateReferralResultStatusSchema, AffiliateReferralSignalSourceSchema, AffiliateApplicationCompanyVerificationSchema, AffiliateCustomerSummarySchema, AffiliateApplicationResponseSchema, AffiliateDistributionReportsResponseSchema, AffiliateDistributionReportQuerySchema, AffiliateDistributionResponseSchema, AffiliateProgramSettingsResponseSchema, AffiliateReportDetailResponseSchema, AffiliateReportEntrySchema, AffiliateReportOverviewItemSchema, AffiliateReportOverviewResponseSchema, AffiliateReportTotalsSchema, AffiliateResponseSchema, AffiliateSchema, AffiliateSlugResponseSchema, ApplyOwnOrderPromotionResponseSchema, ApplyOwnOrderPromotionSchema, ApplyAffiliateCouponResponseSchema, ApplyAffiliateCouponSchema, AppliedAffiliateCouponSnapshotSchema, AffiliateCouponLabelSchema, AffiliateCouponLabelsResponseSchema, ResolveAffiliateCouponLabelsPayloadSchema, ApproveAffiliateApplicationResponseSchema, ApproveAffiliateApplicationSchema, ApproveConsignmentReportResponseSchema, ApproveConsignmentReportSchema, CaptureAffiliateReferralResponseSchema, CaptureAffiliateReferralSchema, ConsignmentTransferResponseSchema, CorrectConsignmentReportResponseSchema, CorrectConsignmentReportSchema, CreateAdminAffiliateCouponCodeSchema, CreateAffiliateSchema, CreateAffiliateSlugSchema, CreatePartnerPortalSlugResponseSchema, CreatePartnerPortalSlugSchema, CreateStoreAffiliateCouponCodeSchema, CustomerAffiliateAssignmentResponseSchema, CustomerAffiliateAssignmentSchema, EnableAffiliateDistributionSchema, GetAffiliatePortalCommissionsResponseSchema, GetAffiliatePortalDashboardResponseSchema, GetAffiliateCartReferralResponseSchema, GetConsignmentInventoryResponseSchema, GetOwnOrderDiscountResponseSchema, ListAdminConsignmentReportsResponseSchema, ListAdminAffiliateCouponCodesQuerySchema, ListAdminAffiliateCouponCodesResponseSchema, ListAffiliateApplicationsQuerySchema, ListAffiliateApplicationsResponseSchema, ListAffiliatesQuerySchema, ListAffiliatesResponseSchema, ListAffiliateSlugsResponseSchema, ListConsignmentReportsQuerySchema, ListConsignmentReportsResponseSchema, ListPartnerPortalSlugsResponseSchema, ListStoreAffiliateCouponCodesQuerySchema, ListStoreAffiliateCouponCodesResponseSchema, PartnerPortalCommissionsQuerySchema, PartnerPortalDateRangeQuerySchema, OrderAffiliateAttributionResponseSchema, PortalCurrencyTotalsSchema, PersistedAffiliateCustomerAssignmentModeSchema, RejectAffiliateApplicationSchema, RejectConsignmentReportResponseSchema, RejectConsignmentReportSchema, ReconcileAdminAffiliateCouponCodeResponseSchema, ReportDateRangeQuerySchema, ReportDetailQuerySchema, ResolveAffiliateReferralResponseSchema, ResolveReferralQuerySchema, RotateAdminAffiliateCouponCodeResponseSchema, RotateAdminAffiliateCouponCodeSchema, RotateStoreAffiliateCouponCodeResponseSchema, RotateStoreAffiliateCouponCodeSchema, RequestConsignmentReminderResponseSchema, RequestConsignmentReminderSchema, SetCustomerAffiliateAssignmentSchema, SetOrderAffiliateAttributionSchema, StoreAffiliateApplicationSchema, StoreAffiliateCouponCodeResponseSchema, StoreAffiliateCouponCodeSchema, StoreAffiliateReferralSchema, StoreAffiliatePortalAffiliateSchema, StoreAffiliatePortalApplicationSchema, StoreAffiliatePortalCommissionSchema, StoreAffiliatePortalContextResponseSchema, StoreAffiliatePortalSlugSchema, StoreConsignmentInventoryLineSchema, StoreConsignmentReportLineSchema, StoreConsignmentReportSchema, ConsignmentLineLabelsSchema, ConsignmentNonSaleQuantitySchema, SubmitAffiliateApplicationResponseSchema, SubmitAffiliateApplicationSchema, SubmitConsignmentReportResponseSchema, SubmitConsignmentReportSchema, SubmitExistingConsignmentReportSchema, TransferConsignmentStockSchema, UpdateAffiliateProgramSettingsSchema, UpdateAffiliateSchema, UpdateAffiliateSlugSchema, UpdatePartnerPortalSlugResponseSchema, UpdatePartnerPortalSlugSchema } from "./schemas";
3
3
  export type AffiliateCouponLifecycleStatus = z.infer<typeof AffiliateCouponLifecycleStatusSchema>;
4
4
  export type AffiliateCouponProvisioningStatus = z.infer<typeof AffiliateCouponProvisioningStatusSchema>;
5
5
  export type AffiliateCouponWireStatus = z.infer<typeof AffiliateCouponWireStatusSchema>;
@@ -48,6 +48,9 @@ export type ApplyOwnOrderPromotionRequest = z.input<typeof ApplyOwnOrderPromotio
48
48
  export type ApplyOwnOrderPromotionResponse = z.infer<typeof ApplyOwnOrderPromotionResponseSchema>;
49
49
  export type GetOwnOrderDiscountResponse = z.infer<typeof GetOwnOrderDiscountResponseSchema>;
50
50
  export type StoreConsignmentInventoryLine = z.infer<typeof StoreConsignmentInventoryLineSchema>;
51
+ export type StoreConsignmentReportLine = z.infer<typeof StoreConsignmentReportLineSchema>;
52
+ export type ConsignmentLineLabels = z.infer<typeof ConsignmentLineLabelsSchema>;
53
+ export type ConsignmentNonSaleQuantity = z.infer<typeof ConsignmentNonSaleQuantitySchema>;
51
54
  export type GetConsignmentInventoryResponse = z.infer<typeof GetConsignmentInventoryResponseSchema>;
52
55
  export type SubmitConsignmentReportRequest = z.input<typeof SubmitConsignmentReportSchema>;
53
56
  export type SubmitExistingConsignmentReportRequest = z.input<typeof SubmitExistingConsignmentReportSchema>;
@@ -300,16 +300,30 @@ export const GetOwnOrderDiscountResponseSchema = z.object({
300
300
  export const ApplyOwnOrderPromotionResponseSchema = z.object({
301
301
  applied: z.boolean(),
302
302
  });
303
- export const StoreConsignmentInventoryLineSchema = z.object({
303
+ /**
304
+ * Display labels of a consignment line, resolved when the response is built.
305
+ * Every field is null when the product or batch can no longer be resolved;
306
+ * the ids stay the fallback.
307
+ */
308
+ export const ConsignmentLineLabelsSchema = z.object({
309
+ product_title: z.string().nullable(),
310
+ variant_title: z.string().nullable(),
311
+ batch_name: z.string().nullable(),
312
+ batch_expiry_date: CalendarDateSchema.nullable(),
313
+ });
314
+ export const StoreConsignmentInventoryLineSchema = z
315
+ .object({
304
316
  inventory_item_id: z.string().trim().min(1),
305
317
  batch_id: z.string().trim().min(1).nullable(),
306
318
  expected_quantity: z.number(),
307
- });
319
+ })
320
+ .extend(ConsignmentLineLabelsSchema.shape);
308
321
  export const GetConsignmentInventoryResponseSchema = z.object({
309
322
  period_start: CalendarMonthSchema,
310
323
  inventory: z.array(StoreConsignmentInventoryLineSchema),
311
324
  });
312
- export const StoreConsignmentReportLineSchema = z.object({
325
+ export const StoreConsignmentReportLineSchema = z
326
+ .object({
313
327
  id: z.string().trim().min(1),
314
328
  inventory_item_id: z.string().trim().min(1),
315
329
  batch_id: z.string().trim().min(1).nullable(),
@@ -322,7 +336,8 @@ export const StoreConsignmentReportLineSchema = z.object({
322
336
  resolved_unit_price: z.number().nullable(),
323
337
  discounted_line_total: z.number().nullable(),
324
338
  currency_code: z.string().nullable(),
325
- });
339
+ })
340
+ .extend(ConsignmentLineLabelsSchema.shape);
326
341
  export const StoreConsignmentReportSchema = z.object({
327
342
  id: z.string().trim().min(1),
328
343
  affiliate_id: z.string().trim().min(1),
@@ -612,12 +627,27 @@ export const ConsignmentNonSaleReasonSchema = z.enum([
612
627
  "returned",
613
628
  "correction",
614
629
  ]);
630
+ /** A part of a line's not-sold shortage with its reason. */
631
+ export const ConsignmentNonSaleQuantitySchema = z.object({
632
+ reason: ConsignmentNonSaleReasonSchema,
633
+ quantity: z.number().int().positive(),
634
+ });
615
635
  export const ApproveConsignmentReportSchema = z.object({
616
636
  expected_version: z.number().int().positive().optional(),
617
637
  confirmed_lines: z
618
638
  .array(z.object({
619
639
  report_line_id: z.string().trim().min(1),
620
640
  confirmed_sale_quantity: z.number().int().min(0),
641
+ /**
642
+ * Split of the not-sold shortage (shortage minus confirmed sale) by
643
+ * reason; the quantities must add up to it. Takes precedence over
644
+ * `non_sale_reason`.
645
+ */
646
+ non_sale_quantities: z
647
+ .array(ConsignmentNonSaleQuantitySchema)
648
+ .max(20)
649
+ .optional(),
650
+ /** Legacy: one reason for the whole not-sold shortage. */
621
651
  non_sale_reason: ConsignmentNonSaleReasonSchema.optional().nullable(),
622
652
  }))
623
653
  .max(500)
@@ -1065,7 +1095,10 @@ export const AdminConsignmentReportLineSchema = z.object({
1065
1095
  proposed_sale_quantity: z.number(),
1066
1096
  confirmed_sale_quantity: z.number(),
1067
1097
  requires_admin_clarification: z.boolean(),
1098
+ /** The single reason, null with several reasons or none. */
1068
1099
  non_sale_reason: z.string().nullable(),
1100
+ /** Not-sold shortage by reason; empty when everything missing was sold. */
1101
+ non_sale_quantities: z.array(ConsignmentNonSaleQuantitySchema),
1069
1102
  correction_reason: z.string().nullable(),
1070
1103
  unit_price_snapshot: z.number().nullable(),
1071
1104
  discounted_line_total: z.number().nullable(),
@@ -1109,6 +1142,8 @@ export const AdminConsignmentReportSchema = z.object({
1109
1142
  order_id: z.string().nullable(),
1110
1143
  /** Customer-facing display id of `order_id`; null without an order. */
1111
1144
  order_display_id: z.number().int().nullable(),
1145
+ /** Display id of `draft_order_id`; null without a draft order. */
1146
+ draft_order_display_id: z.number().int().nullable(),
1112
1147
  fulfillment_id: z.string().nullable(),
1113
1148
  submitted_at: WireDateSchema.nullable(),
1114
1149
  approved_at: WireDateSchema.nullable(),
@@ -1142,13 +1177,14 @@ const ConsignmentFulfillmentSchema = z.object({
1142
1177
  location_id: z.string(),
1143
1178
  items: z.array(z.object({ line_item_id: z.string(), quantity: z.number() })),
1144
1179
  });
1180
+ /** Order, fulfillment and reservations are null/empty for a report approved without any sale. */
1145
1181
  export const ApproveConsignmentReportResponseSchema = z.object({
1146
1182
  report: AdminConsignmentReportSchema,
1147
- order_id: z.string(),
1148
- fulfillment_id: z.string(),
1149
- order: z.object({ id: z.string(), is_draft_order: z.boolean() }),
1183
+ order_id: z.string().nullable(),
1184
+ fulfillment_id: z.string().nullable(),
1185
+ order: z.object({ id: z.string(), is_draft_order: z.boolean() }).nullable(),
1150
1186
  reservations: z.array(ConsignmentReservationSchema),
1151
- fulfillment: ConsignmentFulfillmentSchema,
1187
+ fulfillment: ConsignmentFulfillmentSchema.nullable(),
1152
1188
  batch_inventory: z
1153
1189
  .array(z.object({ id: z.string(), quantity: z.number() }))
1154
1190
  .optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hartl-services/medusa-contracts",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "files": [