@01.software/sdk 0.32.0 → 0.33.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.
Files changed (46) hide show
  1. package/README.md +43 -20
  2. package/dist/client.cjs +31 -2
  3. package/dist/client.cjs.map +1 -1
  4. package/dist/client.d.cts +6 -6
  5. package/dist/client.d.ts +6 -6
  6. package/dist/client.js +31 -2
  7. package/dist/client.js.map +1 -1
  8. package/dist/{collection-client-DPGXnhoF.d.ts → collection-client-B6SlhzIP.d.ts} +3 -3
  9. package/dist/{collection-client-CORhppPb.d.cts → collection-client-De6eKW1J.d.cts} +3 -3
  10. package/dist/{const-Brk2Ff0q.d.cts → const-DwmSDeWq.d.ts} +2 -2
  11. package/dist/{const-DcY2_z9O.d.ts → const-sPR2IkCe.d.cts} +2 -2
  12. package/dist/index.cjs +256 -90
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +7 -7
  15. package/dist/index.d.ts +7 -7
  16. package/dist/index.js +256 -90
  17. package/dist/index.js.map +1 -1
  18. package/dist/{payload-types-DVK1QCeU.d.cts → payload-types-dkeQyrDC.d.cts} +1562 -1436
  19. package/dist/{payload-types-DVK1QCeU.d.ts → payload-types-dkeQyrDC.d.ts} +1562 -1436
  20. package/dist/query.cjs.map +1 -1
  21. package/dist/query.d.cts +9 -9
  22. package/dist/query.d.ts +9 -9
  23. package/dist/query.js.map +1 -1
  24. package/dist/realtime.d.cts +2 -2
  25. package/dist/realtime.d.ts +2 -2
  26. package/dist/server.cjs +37 -6
  27. package/dist/server.cjs.map +1 -1
  28. package/dist/server.d.cts +7 -7
  29. package/dist/server.d.ts +7 -7
  30. package/dist/server.js +37 -6
  31. package/dist/server.js.map +1 -1
  32. package/dist/{types-ByMrR_Z_.d.cts → types-B3YT092I.d.cts} +1 -1
  33. package/dist/{types-CYMSBkJC.d.ts → types-BHh0YLmq.d.ts} +27 -10
  34. package/dist/{types-CAkWqIr6.d.cts → types-BZKxss8Y.d.cts} +27 -10
  35. package/dist/{types-DUPC7Xn6.d.ts → types-Cel_4L9t.d.ts} +1 -1
  36. package/dist/ui/form.d.cts +1 -1
  37. package/dist/ui/form.d.ts +1 -1
  38. package/dist/ui/video.d.cts +1 -1
  39. package/dist/ui/video.d.ts +1 -1
  40. package/dist/webhook.cjs +94 -0
  41. package/dist/webhook.cjs.map +1 -1
  42. package/dist/webhook.d.cts +82 -7
  43. package/dist/webhook.d.ts +82 -7
  44. package/dist/webhook.js +94 -0
  45. package/dist/webhook.js.map +1 -1
  46. package/package.json +1 -1
@@ -16,6 +16,7 @@ interface Config {
16
16
  'system-media': SystemMedia;
17
17
  audiences: Audience;
18
18
  'email-logs': EmailLog;
19
+ 'commerce-notification-intents': CommerceNotificationIntent;
19
20
  'api-keys': ApiKey;
20
21
  'personal-access-tokens': PersonalAccessToken;
21
22
  'audit-logs': AuditLog;
@@ -183,6 +184,7 @@ interface Config {
183
184
  'system-media': SystemMediaSelect<false> | SystemMediaSelect<true>;
184
185
  audiences: AudiencesSelect<false> | AudiencesSelect<true>;
185
186
  'email-logs': EmailLogsSelect<false> | EmailLogsSelect<true>;
187
+ 'commerce-notification-intents': CommerceNotificationIntentsSelect<false> | CommerceNotificationIntentsSelect<true>;
186
188
  'api-keys': ApiKeysSelect<false> | ApiKeysSelect<true>;
187
189
  'personal-access-tokens': PersonalAccessTokensSelect<false> | PersonalAccessTokensSelect<true>;
188
190
  'audit-logs': AuditLogsSelect<false> | AuditLogsSelect<true>;
@@ -539,6 +541,31 @@ interface Tenant {
539
541
  origin: string;
540
542
  id?: string | null;
541
543
  }[] | null;
544
+ /**
545
+ * Commerce customer email notification settings. All v1 events are disabled by default.
546
+ */
547
+ commerceNotifications?: {
548
+ /**
549
+ * Allow customer email sends for this event.
550
+ */
551
+ orderPaid?: boolean | null;
552
+ /**
553
+ * Allow customer email sends for this event.
554
+ */
555
+ fulfillmentShipped?: boolean | null;
556
+ /**
557
+ * Allow customer email sends for this event.
558
+ */
559
+ orderDelivered?: boolean | null;
560
+ /**
561
+ * Allow customer email sends for this event.
562
+ */
563
+ returnRequested?: boolean | null;
564
+ /**
565
+ * Allow customer email sends for this event.
566
+ */
567
+ returnCompleted?: boolean | null;
568
+ };
542
569
  /**
543
570
  * Users connected to this tenant
544
571
  */
@@ -733,7 +760,7 @@ interface EmailLog {
733
760
  /**
734
761
  * Email purpose and consent category. Used for verification, password reset, marketing, and audit review.
735
762
  */
736
- type: 'usage-alert' | 'verification' | 'password-reset' | 'newsletter' | 'other' | 'oauth-login' | 'account-link';
763
+ type: 'usage-alert' | 'verification' | 'password-reset' | 'newsletter' | 'other' | 'oauth-login' | 'account-link' | 'commerce';
737
764
  status: 'sent' | 'failed';
738
765
  sentAt: string;
739
766
  error?: string | null;
@@ -748,924 +775,511 @@ interface EmailLog {
748
775
  * Consent category for compliance audit
749
776
  */
750
777
  recipientConsent?: ('marketing' | 'transactional' | 'service_notice') | null;
751
- updatedAt: string;
752
- createdAt: string;
753
- }
754
- /**
755
- * This interface was referenced by `Config`'s JSON-Schema
756
- * via the `definition` "api-keys".
757
- */
758
- interface ApiKey {
759
- id: string;
760
- tenant: string | Tenant;
761
- name: string;
762
- secretHash: string;
763
- /**
764
- * Key prefix (e.g. sk01_ab12cd3)
765
- */
766
- displayPrefix: string;
767
- /**
768
- * Trailing characters used to identify the key. The raw secret key is not stored or displayed.
769
- */
770
- displaySuffix: string;
771
- /**
772
- * Capability scopes. Default is read+write; webhook dispatch requires webhook, analytics writes require analytics.
773
- */
774
- scopes?: ('read' | 'write' | 'webhook' | 'analytics' | 'super-admin')[] | null;
775
- /**
776
- * User who issued the key. Read-only provenance for issuance audit.
777
- */
778
- createdBy?: (string | null) | User;
779
- /**
780
- * IP address of the key creation request. Privacy-bearing security audit metadata.
781
- */
782
- createdByIp?: string | null;
783
- lastUsedAt?: string | null;
784
- /**
785
- * Last IP address that used the key. Privacy-bearing audit value for abuse investigation.
786
- */
787
- lastUsedIp?: string | null;
788
- revokedAt?: string | null;
789
- /**
790
- * User who revoked the key. Read-only provenance for revocation audit.
791
- */
792
- revokedBy?: (string | null) | User;
793
778
  /**
794
- * Optional expiration. Empty = never expires.
779
+ * Commerce notification send audit metadata. Consent classification remains owned by recipientConsent.
795
780
  */
796
- expiresAt?: string | null;
781
+ commerceNotification?: {
782
+ event?: ('orderPaid' | 'fulfillmentShipped' | 'orderDelivered' | 'returnRequested' | 'returnCompleted') | null;
783
+ intent?: (string | null) | CommerceNotificationIntent;
784
+ dedupeKey?: string | null;
785
+ order?: (string | null) | Order;
786
+ fulfillment?: (string | null) | Fulfillment;
787
+ return?: (string | null) | Return;
788
+ customer?: (string | null) | Customer;
789
+ };
797
790
  updatedAt: string;
798
791
  createdAt: string;
799
- deletedAt?: string | null;
800
792
  }
801
793
  /**
802
794
  * This interface was referenced by `Config`'s JSON-Schema
803
- * via the `definition` "personal-access-tokens".
795
+ * via the `definition` "commerce-notification-intents".
804
796
  */
805
- interface PersonalAccessToken {
797
+ interface CommerceNotificationIntent {
806
798
  id: string;
807
- user: string | User;
808
- /**
809
- * e.g. "CLI: MacBook Pro (darwin)", "GitHub Actions"
810
- */
811
- name: string;
812
- secretHash: string;
813
- /**
814
- * PAT prefix. Display-only token type marker, not the raw token.
815
- */
816
- displayPrefix: string;
817
- /**
818
- * Trailing characters used to identify the PAT. The raw token is not shown again.
819
- */
820
- displaySuffix: string;
799
+ tenant?: (string | null) | Tenant;
821
800
  /**
822
- * Default tenant ID for CLI operations. Set via `01 tenant use <name>`.
801
+ * Stable key that prevents duplicate notification intents within a tenant.
823
802
  */
824
- defaultTenant?: string | null;
803
+ dedupeKey: string;
804
+ event: 'orderPaid' | 'fulfillmentShipped' | 'orderDelivered' | 'returnRequested' | 'returnCompleted';
805
+ status: 'queued' | 'processing' | 'sent' | 'failed' | 'canceled';
825
806
  /**
826
- * IP address of the PAT creation request. Privacy-bearing security audit metadata.
807
+ * Customer email address targeted by this notification.
827
808
  */
828
- createdByIp?: string | null;
829
- lastUsedAt?: string | null;
809
+ recipientEmail: string;
830
810
  /**
831
- * Last IP address that used the PAT. Privacy-bearing audit value for abuse investigation.
811
+ * Locale hint for template rendering.
832
812
  */
833
- lastUsedIp?: string | null;
834
- revokedAt?: string | null;
813
+ locale?: string | null;
835
814
  /**
836
- * User who revoked the PAT. Read-only provenance for revocation audit.
815
+ * Secret-free event snapshot for processor template rendering.
837
816
  */
838
- revokedBy?: (string | null) | User;
817
+ payload?: {
818
+ [k: string]: unknown;
819
+ } | unknown[] | string | number | boolean | null;
820
+ order?: (string | null) | Order;
821
+ fulfillment?: (string | null) | Fulfillment;
822
+ return?: (string | null) | Return;
823
+ customer?: (string | null) | Customer;
839
824
  /**
840
- * PATs expire after 90 days by default.
825
+ * Email audit log produced from this intent.
841
826
  */
842
- expiresAt?: string | null;
827
+ emailLog?: (string | null) | EmailLog;
828
+ attempts: number;
829
+ nextAttemptAt?: string | null;
830
+ lockedAt?: string | null;
831
+ processedAt?: string | null;
832
+ lastError?: string | null;
843
833
  updatedAt: string;
844
834
  createdAt: string;
845
- deletedAt?: string | null;
846
835
  }
847
836
  /**
848
837
  * This interface was referenced by `Config`'s JSON-Schema
849
- * via the `definition` "audit-logs".
838
+ * via the `definition` "orders".
850
839
  */
851
- interface AuditLog {
840
+ interface Order {
852
841
  id: string;
853
842
  tenant?: (string | null) | Tenant;
843
+ orderNumber: string;
844
+ cartToken?: string | null;
845
+ status: 'pending' | 'paid' | 'failed' | 'canceled' | 'refunded' | 'preparing' | 'shipped' | 'delivered' | 'confirmed' | 'return_requested' | 'return_processing' | 'returned';
846
+ totalAmount?: number | null;
847
+ discountCode?: string | null;
848
+ discountAmount?: number | null;
854
849
  /**
855
- * Event type
850
+ * Cumulative refunded amount
856
851
  */
857
- eventType: string;
852
+ refundedAmount?: number | null;
858
853
  /**
859
- * Actor ID. May refer to a user or service, and can be empty for system actions.
854
+ * Shipping amount at time of order
860
855
  */
861
- actorId?: string | null;
856
+ shippingAmount?: number | null;
862
857
  /**
863
- * Detailed audit event payload. May contain sensitive security, billing, or provider context.
858
+ * Item subtotal (excl. shipping & discount)
864
859
  */
865
- payload?: {
866
- [k: string]: unknown;
867
- } | unknown[] | string | number | boolean | null;
868
- updatedAt: string;
869
- createdAt: string;
870
- }
871
- /**
872
- * This interface was referenced by `Config`'s JSON-Schema
873
- * via the `definition` "webhook-events".
874
- */
875
- interface WebhookEvent {
876
- id: string;
877
- tenant?: (string | null) | Tenant;
860
+ subtotalAmount?: number | null;
861
+ taxAmount?: number | null;
862
+ source?: ('web' | 'app' | 'manual') | null;
863
+ currency?: string | null;
878
864
  /**
879
- * Provider
865
+ * Internal admin notes (not visible to customers)
880
866
  */
881
- provider: string;
867
+ adminNotes?: string | null;
868
+ cancelReason?: string | null;
869
+ canceledAt?: string | null;
870
+ completedAt?: string | null;
882
871
  /**
883
- * Provider-supplied event ID. Used with provider as the idempotency key for duplicate prevention.
872
+ * Note left by customer at checkout
884
873
  */
885
- eventId: string;
886
- receivedAt?: string | null;
874
+ customerNote?: string | null;
875
+ customer?: (string | null) | Customer;
887
876
  /**
888
- * Raw provider event body. May contain sensitive security or payment context.
877
+ * Customer info at the time of order
889
878
  */
890
- payload?: {
879
+ customerSnapshot?: {
880
+ name?: string | null;
881
+ email?: string | null;
882
+ phone?: string | null;
883
+ };
884
+ shippingAddress?: {
885
+ recipientName?: string | null;
886
+ phone?: string | null;
887
+ postalCode?: string | null;
888
+ address?: string | null;
889
+ detailAddress?: string | null;
890
+ deliveryMessage?: string | null;
891
+ };
892
+ billingAddress?: {
893
+ recipientName?: string | null;
894
+ businessRegistrationNumber?: string | null;
895
+ email?: string | null;
896
+ phone?: string | null;
897
+ address?: string | null;
898
+ };
899
+ items?: {
900
+ docs?: (string | OrderItem)[];
901
+ hasNextPage?: boolean;
902
+ totalDocs?: number;
903
+ };
904
+ transactions?: {
905
+ docs?: (string | Transaction)[];
906
+ hasNextPage?: boolean;
907
+ totalDocs?: number;
908
+ };
909
+ fulfillments?: {
910
+ docs?: (string | Fulfillment)[];
911
+ hasNextPage?: boolean;
912
+ totalDocs?: number;
913
+ };
914
+ returns?: {
915
+ docs?: (string | Return)[];
916
+ hasNextPage?: boolean;
917
+ totalDocs?: number;
918
+ };
919
+ metadata?: {
891
920
  [k: string]: unknown;
892
921
  } | unknown[] | string | number | boolean | null;
922
+ nextRefundSeq?: number | null;
923
+ nextCaptureSeq?: number | null;
924
+ nextVoidSeq?: number | null;
893
925
  updatedAt: string;
894
926
  createdAt: string;
927
+ deletedAt?: string | null;
895
928
  }
896
929
  /**
897
930
  * This interface was referenced by `Config`'s JSON-Schema
898
- * via the `definition` "webhook-deliveries".
931
+ * via the `definition` "customers".
899
932
  */
900
- interface WebhookDelivery {
933
+ interface Customer {
901
934
  id: string;
935
+ _customers_customers_order?: string | null;
936
+ _order?: string | null;
902
937
  tenant?: (string | null) | Tenant;
938
+ name: string;
939
+ email?: string | null;
940
+ phone?: string | null;
941
+ groups?: (string | CustomerGroup)[] | null;
903
942
  /**
904
- * Active webhook endpoint used for this delivery attempt.
943
+ * Internal notes (not visible to customers)
905
944
  */
906
- webhookId?: (string | null) | Webhook;
945
+ note?: string | null;
946
+ birthDate?: string | null;
947
+ gender?: ('male' | 'female' | 'other' | 'prefer_not_to_say') | null;
948
+ isGuest?: boolean | null;
907
949
  /**
908
- * Value sent to receivers as x-webhook-delivery-id.
950
+ * Authentication provider used at signup. Immutable account provenance after creation.
909
951
  */
910
- deliveryId?: string | null;
911
- attempt: number;
952
+ authProvider?: ('local' | 'google' | 'apple' | 'kakao' | 'naver') | null;
912
953
  /**
913
- * Webhook delivery state. Updated by dispatcher and retry handling paths.
954
+ * External provider user ID. Paired with authProvider to identify the linked account and not edited after creation.
914
955
  */
915
- status: 'queued' | 'success' | 'failed' | 'dead';
956
+ providerUserId?: string | null;
957
+ lastLoginAt?: string | null;
916
958
  /**
917
- * Destination host with query string removed. Full URLs are not stored.
959
+ * Last password change timestamp (used for JWT revocation)
918
960
  */
919
- endpointHost?: string | null;
961
+ passwordChangedAt?: string | null;
962
+ orders?: {
963
+ docs?: (string | Order)[];
964
+ hasNextPage?: boolean;
965
+ totalDocs?: number;
966
+ };
967
+ addresses?: {
968
+ docs?: (string | CustomerAddress)[];
969
+ hasNextPage?: boolean;
970
+ totalDocs?: number;
971
+ };
972
+ defaultShippingAddress?: (string | null) | CustomerAddress;
973
+ defaultBillingAddress?: (string | null) | CustomerAddress;
920
974
  /**
921
- * HMAC hash of the endpoint URL with query string removed.
975
+ * Read-only counter maintained by order hooks for this customer's completed orders.
922
976
  */
923
- endpointUrlHash?: string | null;
977
+ totalOrderCount?: number | null;
978
+ lifetimeValue?: number | null;
979
+ firstOrderAt?: string | null;
980
+ lastOrderAt?: string | null;
981
+ profile?: {
982
+ docs?: (string | CustomerProfile)[];
983
+ hasNextPage?: boolean;
984
+ totalDocs?: number;
985
+ };
924
986
  /**
925
- * Collection that produced this delivery attempt.
987
+ * Read-only counter maintained by hooks for community posts authored by this customer.
926
988
  */
927
- collection?: string | null;
989
+ postCount?: number | null;
928
990
  /**
929
- * Operation that produced this delivery attempt.
991
+ * Read-only counter maintained by hooks for community comments authored by this customer.
930
992
  */
931
- operation?: string | null;
993
+ commentCount?: number | null;
932
994
  /**
933
- * Path that produced the delivery attempt.
995
+ * Read-only counter maintained by hooks for community reactions made by this customer.
934
996
  */
935
- source?: ('registry' | 'retry_queue' | 'dlq_retry' | 'password_reset') | null;
997
+ reactionCount?: number | null;
936
998
  /**
937
- * HTTP status returned by the receiver.
999
+ * Marks a minor customer. When enabled, guardian consent fields are managed as compliance evidence.
938
1000
  */
939
- statusCode?: number | null;
1001
+ isMinor?: boolean | null;
1002
+ marketingConsent?: {
1003
+ email?: {
1004
+ isConsented?: boolean | null;
1005
+ consentedAt?: string | null;
1006
+ expiresAt?: string | null;
1007
+ unsubscribedAt?: string | null;
1008
+ };
1009
+ sms?: {
1010
+ isConsented?: boolean | null;
1011
+ consentedAt?: string | null;
1012
+ expiresAt?: string | null;
1013
+ unsubscribedAt?: string | null;
1014
+ };
1015
+ push?: {
1016
+ isConsented?: boolean | null;
1017
+ consentedAt?: string | null;
1018
+ expiresAt?: string | null;
1019
+ unsubscribedAt?: string | null;
1020
+ };
1021
+ /**
1022
+ * Channel through which consent was obtained (e.g. signup, checkout, import)
1023
+ */
1024
+ consentSource?: string | null;
1025
+ };
940
1026
  /**
941
- * Delivery failure kind. Sensitive request body or headers are not stored.
1027
+ * Guardian consent evidence for a minor customer. May contain guardian PII.
942
1028
  */
943
- errorKind?: string | null;
1029
+ guardianConsent?: {
1030
+ /**
1031
+ * Whether guardian consent has been collected. Internal compliance marker for minor-customer handling.
1032
+ */
1033
+ hasGuardianConsent?: boolean | null;
1034
+ /**
1035
+ * Guardian name. Treat as guardian PII.
1036
+ */
1037
+ guardianName?: string | null;
1038
+ /**
1039
+ * Guardian phone number. Treat as guardian PII.
1040
+ */
1041
+ guardianPhone?: string | null;
1042
+ /**
1043
+ * Timestamp when guardian consent was recorded. Read-only audit evidence.
1044
+ */
1045
+ guardianConsentedAt?: string | null;
1046
+ };
1047
+ acceptsTos?: boolean | null;
1048
+ tosVersion?: string | null;
944
1049
  /**
945
- * Truncated error message. Sensitive request body or headers are not stored.
1050
+ * Withdrawal reason (internal)
946
1051
  */
947
- errorMessage?: string | null;
1052
+ withdrawReason?: string | null;
1053
+ withdrawnAt?: string | null;
948
1054
  /**
949
- * Delivery attempt duration in milliseconds.
1055
+ * Legal retention deadline. Retention cleanup or manual hard-delete paths may purge after this date.
950
1056
  */
951
- durationMs?: number | null;
1057
+ retainUntil?: string | null;
1058
+ anonymizedAt?: string | null;
1059
+ hashedPassword?: string | null;
1060
+ salt?: string | null;
1061
+ resetPasswordToken?: string | null;
1062
+ resetPasswordExpiresAt?: string | null;
1063
+ loginAttemptCount?: number | null;
1064
+ lockedUntil?: string | null;
952
1065
  /**
953
- * Next scheduled retry time for a failed delivery.
1066
+ * Account suspension flag. Used with password/JWT revocation paths to block sessions.
954
1067
  */
955
- nextRetryAt?: string | null;
1068
+ isSuspended?: boolean | null;
1069
+ metadata?: {
1070
+ [k: string]: unknown;
1071
+ } | unknown[] | string | number | boolean | null;
1072
+ updatedAt: string;
1073
+ createdAt: string;
1074
+ deletedAt?: string | null;
1075
+ collection: 'customers';
1076
+ }
1077
+ /**
1078
+ * This interface was referenced by `Config`'s JSON-Schema
1079
+ * via the `definition` "customer-groups".
1080
+ */
1081
+ interface CustomerGroup {
1082
+ id: string;
1083
+ _order?: string | null;
1084
+ tenant?: (string | null) | Tenant;
1085
+ title?: string | null;
956
1086
  /**
957
- * Marks attempts produced by Redis retry or DLQ replay paths.
1087
+ * When enabled, the slug will auto-generate from the title field on save and autosave.
958
1088
  */
959
- redelivery?: boolean | null;
1089
+ generateSlug?: boolean | null;
1090
+ slug?: string | null;
960
1091
  /**
961
- * Timestamp when the webhook request was dispatched to the endpoint.
1092
+ * Short summary for listing/cards
962
1093
  */
963
- dispatchedAt?: string | null;
1094
+ description?: string | null;
1095
+ /**
1096
+ * Optional #RRGGBB display color for Admin surfaces.
1097
+ */
1098
+ color?: string | null;
1099
+ image?: (string | null) | Image;
1100
+ isActive?: boolean | null;
1101
+ /**
1102
+ * Show this group as a customer-facing membership badge. The group collection itself remains private.
1103
+ */
1104
+ customerVisible?: boolean | null;
1105
+ /**
1106
+ * Customer-facing label. Falls back to title when empty.
1107
+ */
1108
+ publicTitle?: string | null;
1109
+ publicDescription?: string | null;
1110
+ publicBenefits?: {
1111
+ title?: string | null;
1112
+ description?: string | null;
1113
+ id?: string | null;
1114
+ }[] | null;
1115
+ /**
1116
+ * Customer-facing badge color. Example: #2563eb
1117
+ */
1118
+ badgeColor?: string | null;
1119
+ badgeImage?: (string | null) | Image;
1120
+ /**
1121
+ * Customer membership display order. Lower values appear first.
1122
+ */
1123
+ displayOrder?: number | null;
1124
+ metadata?: {
1125
+ [k: string]: unknown;
1126
+ } | unknown[] | string | number | boolean | null;
1127
+ customers?: {
1128
+ docs?: (string | Customer)[];
1129
+ hasNextPage?: boolean;
1130
+ totalDocs?: number;
1131
+ };
964
1132
  updatedAt: string;
965
1133
  createdAt: string;
1134
+ deletedAt?: string | null;
966
1135
  }
967
1136
  /**
968
1137
  * This interface was referenced by `Config`'s JSON-Schema
969
- * via the `definition` "webhooks".
1138
+ * via the `definition` "customer-addresses".
970
1139
  */
971
- interface Webhook {
1140
+ interface CustomerAddress {
972
1141
  id: string;
973
1142
  tenant?: (string | null) | Tenant;
1143
+ customer: string | Customer;
1144
+ label?: string | null;
1145
+ recipientName?: string | null;
1146
+ phone?: string | null;
1147
+ postalCode?: string | null;
974
1148
  /**
975
- * Webhook name
1149
+ * Road-name address (returned by Daum/Naver postal code pickers)
976
1150
  */
977
- name: string;
1151
+ address1?: string | null;
978
1152
  /**
979
- * Webhook endpoint HTTPS URL. Treat this endpoint as a recipient of sensitive workspace events.
1153
+ * Detail address (unit / floor / building name)
980
1154
  */
981
- url: string;
1155
+ address2?: string | null;
982
1156
  /**
983
- * HMAC signing secret (immutable once set)
1157
+ * Jibun lot-based address. Stored alongside the road-name `address1` so we can fall back when 도로명 is missing or for delivery providers that require 지번.
984
1158
  */
985
- secret: string;
1159
+ jibunAddress?: string | null;
986
1160
  /**
987
- * Collections to subscribe to. Leave empty to receive every supported collection event.
1161
+ * City (KR: 시/군 — e.g. "Seoul", "Busan"; non-KR: city/town).
988
1162
  */
989
- subscriptions?: {
990
- /**
991
- * Receives create/update events for this collection.
992
- */
993
- collection: 'tenant-metadata' | 'tenant-logos' | 'images' | 'products' | 'product-variants' | 'product-options' | 'product-option-values' | 'product-categories' | 'product-tags' | 'product-collections' | 'brands' | 'brand-logos' | 'orders' | 'order-items' | 'transactions' | 'fulfillments' | 'fulfillment-items' | 'returns' | 'return-items' | 'carts' | 'cart-items' | 'discounts' | 'shipping-policies' | 'shipping-zones' | 'customers' | 'customer-profiles' | 'customer-addresses' | 'playlists' | 'playlist-categories' | 'playlist-tags' | 'tracks' | 'track-categories' | 'track-tags' | 'galleries' | 'gallery-items' | 'gallery-categories' | 'gallery-tags' | 'links' | 'link-categories' | 'link-tags' | 'forms' | 'form-submissions' | 'articles' | 'article-authors' | 'article-categories' | 'article-tags' | 'documents' | 'document-categories' | 'document-types' | 'canvases' | 'canvas-node-types' | 'canvas-edge-types' | 'canvas-categories' | 'canvas-tags' | 'canvas-nodes' | 'canvas-edges' | 'videos' | 'video-categories' | 'video-tags' | 'live-streams' | 'posts' | 'comments' | 'reactions' | 'reaction-types' | 'bookmarks' | 'post-categories' | 'customer-profile-lists' | 'event-calendars' | 'events' | 'event-categories' | 'event-occurrences' | 'event-tags';
994
- id?: string | null;
995
- }[] | null;
996
- isActive?: boolean | null;
997
- lastDispatchedAt?: string | null;
1163
+ city?: string | null;
1164
+ /**
1165
+ * Administrative area (KR: 시/도 — usually folded into `city`; non-KR: state / province / region).
1166
+ */
1167
+ administrativeArea?: string | null;
1168
+ /**
1169
+ * Which address form to print on the shipping label (default: road).
1170
+ */
1171
+ addressType?: ('road' | 'jibun') | null;
1172
+ /**
1173
+ * ISO 3166-1 alpha-2 country code
1174
+ */
1175
+ country?: string | null;
1176
+ isDefault?: boolean | null;
1177
+ /**
1178
+ * Delivery request preset. Pick "Other" to switch to a free-form deliveryNote.
1179
+ */
1180
+ deliveryRequest?: ('security_office' | 'handoff_in_person' | 'call_before' | 'leave_at_door' | 'other') | null;
1181
+ /**
1182
+ * Free-form delivery note. Prefer the deliveryRequest preset when one of the choices fits; reserve this for actually-custom instructions.
1183
+ */
1184
+ deliveryNote?: string | null;
998
1185
  updatedAt: string;
999
1186
  createdAt: string;
1000
1187
  deletedAt?: string | null;
1001
1188
  }
1002
1189
  /**
1003
1190
  * This interface was referenced by `Config`'s JSON-Schema
1004
- * via the `definition` "tenant-metadata".
1191
+ * via the `definition` "customer-profiles".
1005
1192
  */
1006
- interface TenantMetadatum {
1193
+ interface CustomerProfile {
1007
1194
  id: string;
1008
1195
  tenant?: (string | null) | Tenant;
1009
- siteInfo?: {
1010
- /**
1011
- * Site title (used in browser tab and SEO)
1012
- */
1013
- title?: string | null;
1014
- /**
1015
- * Site description (used for SEO and social media)
1016
- */
1017
- description?: string | null;
1018
- /**
1019
- * Comma-separated keywords for SEO
1020
- */
1021
- keywords?: string | null;
1022
- /**
1023
- * Site author or company name
1024
- */
1025
- author?: string | null;
1026
- /**
1027
- * Full site URL (e.g., https://example.com)
1028
- */
1029
- url?: string | null;
1030
- };
1196
+ customer: string | Customer;
1031
1197
  /**
1032
- * Required by Korean e-commerce law
1198
+ * Public username shown like @01works. Store 3-30 characters without @, using lowercase ASCII letters, numbers, hyphens, or underscores, and keep it unique within the tenant.
1033
1199
  */
1034
- businessInfo?: {
1035
- businessRegistrationNumber?: string | null;
1036
- businessName?: string | null;
1037
- ceoName?: string | null;
1038
- businessAddress?: string | null;
1039
- businessEmail?: string | null;
1040
- onlineSalesRegistrationNumber?: string | null;
1041
- };
1042
- branding?: {
1043
- /**
1044
- * Primary logo
1045
- */
1046
- logo?: (string | null) | TenantLogo;
1047
- /**
1048
- * Logo for dark mode (optional)
1049
- */
1050
- logoDark?: (string | null) | TenantLogo;
1051
- /**
1052
- * Logo mark / Icon (optional)
1053
- */
1054
- logomark?: (string | null) | TenantLogo;
1055
- /**
1056
- * Favicon (will be resized automatically)
1057
- */
1058
- favicon?: (string | null) | TenantLogo;
1059
- /**
1060
- * Theme color for mobile browsers (hex color)
1061
- */
1062
- themeColor?: string | null;
1063
- };
1064
- seo?: {
1065
- /**
1066
- * Robots meta tag (e.g., "index, follow" or "noindex, nofollow")
1067
- */
1068
- robots?: string | null;
1069
- /**
1070
- * Google Site Verification code
1071
- */
1072
- googleSiteVerification?: string | null;
1073
- /**
1074
- * Bing Site Verification code
1075
- */
1076
- bingSiteVerification?: string | null;
1077
- /**
1078
- * Naver Site Verification code
1079
- */
1080
- naverSiteVerification?: string | null;
1081
- /**
1082
- * Canonical URL (if different from site URL)
1083
- */
1084
- canonicalUrl?: string | null;
1085
- };
1086
- analytics?: {
1087
- /**
1088
- * Google Analytics ID (e.g., G-XXXXXXXXXX)
1089
- */
1090
- googleAnalyticsId?: string | null;
1091
- /**
1092
- * Google Tag Manager ID (e.g., GTM-XXXXXXX)
1093
- */
1094
- googleTagManagerId?: string | null;
1095
- /**
1096
- * Facebook Pixel ID
1097
- */
1098
- facebookPixelId?: string | null;
1099
- /**
1100
- * LinkedIn Partner ID
1101
- */
1102
- linkedInPartnerId?: string | null;
1103
- };
1104
- openGraph?: {
1105
- /**
1106
- * Open Graph title (falls back to site title)
1107
- */
1108
- ogTitle?: string | null;
1109
- /**
1110
- * Open Graph description (falls back to site description)
1111
- */
1112
- ogDescription?: string | null;
1113
- /**
1114
- * Open Graph image (1200x630 recommended)
1115
- */
1116
- ogImage?: (string | null) | Image;
1117
- /**
1118
- * Open Graph type
1119
- */
1120
- ogType?: ('website' | 'article' | 'product' | 'profile') | null;
1121
- /**
1122
- * Open Graph locale (e.g., ko_KR, en_US)
1123
- */
1124
- ogLocale?: string | null;
1125
- };
1126
- twitter?: {
1127
- /**
1128
- * Twitter card type
1129
- */
1130
- twitterCard?: ('summary' | 'summary_large_image' | 'app' | 'player') | null;
1131
- /**
1132
- * Twitter username for the site (e.g., @yoursite)
1133
- */
1134
- twitterSite?: string | null;
1135
- /**
1136
- * Twitter username for the content creator (e.g., @author)
1137
- */
1138
- twitterCreator?: string | null;
1139
- /**
1140
- * Twitter title (falls back to OG title or site title)
1141
- */
1142
- twitterTitle?: string | null;
1143
- /**
1144
- * Twitter description (falls back to OG or site description)
1145
- */
1146
- twitterDescription?: string | null;
1147
- /**
1148
- * Twitter card image (falls back to OG image)
1149
- */
1150
- twitterImage?: (string | null) | Image;
1151
- };
1152
- pwa?: {
1153
- /**
1154
- * Short name for PWA (12 characters max)
1155
- */
1156
- shortName?: string | null;
1157
- /**
1158
- * Background color for PWA splash screen
1159
- */
1160
- backgroundColor?: string | null;
1161
- /**
1162
- * PWA display mode
1163
- */
1164
- display?: ('fullscreen' | 'standalone' | 'minimal-ui' | 'browser') | null;
1165
- };
1166
- updatedAt: string;
1167
- createdAt: string;
1168
- deletedAt?: string | null;
1169
- }
1170
- /**
1171
- * This interface was referenced by `Config`'s JSON-Schema
1172
- * via the `definition` "tenant-logos".
1173
- */
1174
- interface TenantLogo {
1175
- id: string;
1176
- tenant?: (string | null) | Tenant;
1177
- /**
1178
- * Describe the image. Used for users who cannot see it, screen readers, and search/share previews.
1179
- */
1180
- alt?: string | null;
1181
- /**
1182
- * Low quality image placeholder
1183
- */
1184
- lqip?: string | null;
1185
- palette?: {
1186
- vibrant?: string | null;
1187
- muted?: string | null;
1188
- darkVibrant?: string | null;
1189
- darkMuted?: string | null;
1190
- lightVibrant?: string | null;
1191
- lightMuted?: string | null;
1192
- };
1193
- prefix?: string | null;
1194
- updatedAt: string;
1195
- createdAt: string;
1196
- deletedAt?: string | null;
1197
- url?: string | null;
1198
- thumbnailURL?: string | null;
1199
- filename?: string | null;
1200
- mimeType?: string | null;
1201
- filesize?: number | null;
1202
- width?: number | null;
1203
- height?: number | null;
1204
- focalX?: number | null;
1205
- focalY?: number | null;
1206
- sizes?: {
1207
- '16'?: {
1208
- url?: string | null;
1209
- width?: number | null;
1210
- height?: number | null;
1211
- mimeType?: string | null;
1212
- filesize?: number | null;
1213
- filename?: string | null;
1214
- };
1215
- '32'?: {
1216
- url?: string | null;
1217
- width?: number | null;
1218
- height?: number | null;
1219
- mimeType?: string | null;
1220
- filesize?: number | null;
1221
- filename?: string | null;
1222
- };
1223
- '64'?: {
1224
- url?: string | null;
1225
- width?: number | null;
1226
- height?: number | null;
1227
- mimeType?: string | null;
1228
- filesize?: number | null;
1229
- filename?: string | null;
1230
- };
1231
- '128'?: {
1232
- url?: string | null;
1233
- width?: number | null;
1234
- height?: number | null;
1235
- mimeType?: string | null;
1236
- filesize?: number | null;
1237
- filename?: string | null;
1238
- };
1239
- '180'?: {
1240
- url?: string | null;
1241
- width?: number | null;
1242
- height?: number | null;
1243
- mimeType?: string | null;
1244
- filesize?: number | null;
1245
- filename?: string | null;
1246
- };
1247
- '192'?: {
1248
- url?: string | null;
1249
- width?: number | null;
1250
- height?: number | null;
1251
- mimeType?: string | null;
1252
- filesize?: number | null;
1253
- filename?: string | null;
1254
- };
1255
- '512'?: {
1256
- url?: string | null;
1257
- width?: number | null;
1258
- height?: number | null;
1259
- mimeType?: string | null;
1260
- filesize?: number | null;
1261
- filename?: string | null;
1200
+ handle?: string | null;
1201
+ displayName?: string | null;
1202
+ avatar?: (string | null) | Image;
1203
+ bio?: string | null;
1204
+ bioRichText?: {
1205
+ root: {
1206
+ type: string;
1207
+ children: {
1208
+ type: any;
1209
+ version: number;
1210
+ [k: string]: unknown;
1211
+ }[];
1212
+ direction: ('ltr' | 'rtl') | null;
1213
+ format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
1214
+ indent: number;
1215
+ version: number;
1262
1216
  };
1263
- };
1264
- }
1265
- /**
1266
- * This interface was referenced by `Config`'s JSON-Schema
1267
- * via the `definition` "tenant-entitlements".
1268
- */
1269
- interface TenantEntitlement {
1270
- id: string;
1271
- tenant: string | Tenant;
1272
- plan: 'free' | 'starter' | 'basic' | 'pro' | 'enterprise';
1273
- /**
1274
- * Lifecycle status for the entitlement. Only active rows participate in current plan resolution.
1275
- */
1276
- status: 'active' | 'scheduled' | 'expired' | 'revoked';
1277
- sourceType: 'subscription' | 'manual' | 'support' | 'promo' | 'trial' | 'enterprise_contract';
1278
- sourceSubscription?: (string | null) | Subscription;
1279
- /**
1280
- * Tie-breaker for overlapping entitlements. Higher values win within the same source precedence.
1281
- */
1282
- priority: number;
1283
- startsAt: string;
1284
- /**
1285
- * Entitlement end date. Required by hook validation for promo / trial sources and excluded from current plan resolution after expiry.
1286
- */
1287
- endsAt?: string | null;
1288
- reason?: string | null;
1289
- grantedBy?: (string | null) | User;
1290
- revokedAt?: string | null;
1291
- revokedBy?: (string | null) | User;
1292
- updatedAt: string;
1293
- createdAt: string;
1294
- deletedAt?: string | null;
1295
- }
1296
- /**
1297
- * This interface was referenced by `Config`'s JSON-Schema
1298
- * via the `definition` "subscriptions".
1299
- */
1300
- interface Subscription {
1301
- id: string;
1302
- tenant: string | Tenant;
1303
- plan: 'starter' | 'basic' | 'pro';
1304
- billingCycle: 'monthly' | 'yearly';
1305
- /**
1306
- * Payment amount (KRW)
1307
- */
1308
- amount: number;
1309
- status: 'active' | 'past_due' | 'canceled' | 'expired' | 'suspended';
1310
- currency: 'KRW' | 'USD';
1311
- provider: 'toss';
1312
- currentPeriodStart?: string | null;
1313
- currentPeriodEnd?: string | null;
1314
- trialStartAt?: string | null;
1315
- trialEndAt?: string | null;
1316
- endedAt?: string | null;
1317
- pastDueAt?: string | null;
1318
- /**
1319
- * Toss billing key (AES-256-GCM encrypted)
1320
- */
1321
- billingKey?: string | null;
1322
- /**
1323
- * Toss customer key (UUID)
1324
- */
1325
- customerKey?: string | null;
1326
- /**
1327
- * Registered card info
1328
- */
1329
- cardInfo?: {
1330
- issuerCode?: string | null;
1331
- /**
1332
- * Masked card number
1333
- */
1334
- number?: string | null;
1335
- cardType?: string | null;
1336
- };
1337
- /**
1338
- * Provider-owned diagnostic and audit metadata returned by the billing provider. Not a general manual-edit field.
1339
- */
1340
- providerMetadata?: {
1341
1217
  [k: string]: unknown;
1342
- } | unknown[] | string | number | boolean | null;
1343
- cancelAtPeriodEnd?: boolean | null;
1344
- canceledAt?: string | null;
1345
- cancelReason?: string | null;
1346
- retryCount?: number | null;
1347
- graceDeadline?: string | null;
1348
- lastPaymentError?: string | null;
1349
- pendingPlanChange?: {
1350
- targetPlan?: ('starter' | 'basic' | 'pro') | null;
1351
- targetAmount?: number | null;
1352
- effectiveAt?: string | null;
1353
- };
1354
- updatedAt: string;
1355
- createdAt: string;
1356
- deletedAt?: string | null;
1357
- }
1358
- /**
1359
- * This interface was referenced by `Config`'s JSON-Schema
1360
- * via the `definition` "tenant-purge-jobs".
1361
- */
1362
- interface TenantPurgeJob {
1363
- id: string;
1364
- tenantId: string;
1365
- status: 'pending' | 'running' | 'failed' | 'ready-to-delete';
1366
- currentCollection?: string | null;
1367
- deletedCount?: number | null;
1368
- failure?: string | null;
1369
- completedAt?: string | null;
1370
- updatedAt: string;
1371
- createdAt: string;
1372
- }
1373
- /**
1374
- * This interface was referenced by `Config`'s JSON-Schema
1375
- * via the `definition` "billing-history".
1376
- */
1377
- interface BillingHistory {
1378
- id: string;
1379
- tenant: string | Tenant;
1380
- subscription?: (string | null) | Subscription;
1381
- type: 'payment' | 'refund' | 'plan_change';
1382
- status: 'success' | 'failed' | 'refunded' | 'partial_refund';
1383
- /**
1384
- * Amount (KRW)
1385
- */
1386
- amount: number;
1387
- /**
1388
- * Plan at time of payment
1389
- */
1390
- plan: 'starter' | 'basic' | 'pro';
1391
- provider: 'toss';
1392
- currency: 'KRW' | 'USD';
1393
- billingCycle?: ('monthly' | 'yearly') | null;
1394
- periodStart?: string | null;
1395
- periodEnd?: string | null;
1396
- /**
1397
- * Unique order number
1398
- */
1399
- invoiceNumber: string;
1400
- orderName?: string | null;
1401
- /**
1402
- * Toss payment key
1403
- */
1404
- paymentKey?: string | null;
1405
- /**
1406
- * Full Toss API response
1407
- */
1408
- tossResponse?: {
1218
+ } | null;
1219
+ joinedAt?: string | null;
1220
+ isPublic?: boolean | null;
1221
+ anonymizedAt?: string | null;
1222
+ metadata?: {
1409
1223
  [k: string]: unknown;
1410
1224
  } | unknown[] | string | number | boolean | null;
1411
- errorMessage?: string | null;
1412
- /**
1413
- * Original billing record for retry
1414
- */
1415
- retryOf?: (string | null) | BillingHistory;
1416
- updatedAt: string;
1417
- createdAt: string;
1418
- deletedAt?: string | null;
1419
1225
  }
1420
1226
  /**
1421
1227
  * This interface was referenced by `Config`'s JSON-Schema
1422
- * via the `definition` "plans".
1228
+ * via the `definition` "order-items".
1423
1229
  */
1424
- interface Plan {
1230
+ interface OrderItem {
1425
1231
  id: string;
1232
+ tenant?: (string | null) | Tenant;
1233
+ order: string | Order;
1426
1234
  /**
1427
- * Plan identifier (free, starter, basic, pro, enterprise)
1235
+ * Quantity snapshot at order time. Used for payment and inventory calculations and not edited directly.
1428
1236
  */
1429
- key: string;
1237
+ product: string | Product;
1238
+ variant?: (string | null) | ProductVariant;
1239
+ quantity: number;
1430
1240
  /**
1431
- * Plan display name
1241
+ * Unit-price snapshot at order time. Later product price changes do not rewrite it.
1432
1242
  */
1433
- name: string;
1243
+ unitPrice: number;
1244
+ variantTitle?: string | null;
1245
+ sku?: string | null;
1246
+ compareAtPrice?: number | null;
1247
+ weight?: number | null;
1248
+ requiresShipping?: boolean | null;
1434
1249
  /**
1435
- * Reference-only feature list; enforced elsewhere.
1250
+ * Total-price snapshot at order time, preserved from unitPrice × quantity.
1436
1251
  */
1437
- featuresAllowed?: ('ecommerce' | 'customers' | 'playlists' | 'galleries' | 'links' | 'forms' | 'articles' | 'documents' | 'canvas' | 'videos' | 'live-streaming' | 'community' | 'events')[] | null;
1252
+ totalPrice: number;
1253
+ productTitle?: string | null;
1438
1254
  /**
1439
- * Reference-only quotas such as storageBytes; enforced by entitlement and usage policy elsewhere.
1255
+ * Option combination snapshot at order time. Later variant/option changes do not rewrite it.
1440
1256
  */
1441
- quotas?: {
1257
+ optionSelection?: {
1442
1258
  [k: string]: unknown;
1443
1259
  } | unknown[] | string | number | boolean | null;
1444
- updatedAt: string;
1445
- createdAt: string;
1446
- deletedAt?: string | null;
1447
- }
1448
- /**
1449
- * This interface was referenced by `Config`'s JSON-Schema
1450
- * via the `definition` "tenant-web-analytics-config".
1451
- */
1452
- interface TenantWebAnalyticsConfig {
1453
- id: string;
1454
- tenant?: (string | null) | Tenant;
1455
- enabled?: boolean | null;
1456
- /**
1457
- * Domains allowed to send analytics events. If empty, browser analytics is blocked.
1458
- */
1459
- allowedOrigins?: {
1460
- origin: string;
1461
- id?: string | null;
1462
- }[] | null;
1463
- /**
1464
- * Timezone used to group daily analytics. Once data starts coming in, this is locked and cannot be changed.
1465
- */
1466
- timezone: string;
1467
- /**
1468
- * Automatically locked once the first analytics record is saved. Contact support to unlock.
1469
- */
1470
- tzLocked?: boolean | null;
1471
- updatedAt: string;
1472
- createdAt: string;
1473
- deletedAt?: string | null;
1474
- }
1475
- /**
1476
- * This interface was referenced by `Config`'s JSON-Schema
1477
- * via the `definition` "tenant-analytics-daily".
1478
- */
1479
- interface TenantAnalyticsDaily {
1480
- id: string;
1481
- tenant?: (string | null) | Tenant;
1482
- /**
1483
- * YYYY-MM-DD (UTC)
1484
- */
1485
- date: string;
1486
- pageviews: number;
1487
- /**
1488
- * Estimated via HyperLogLog (±0.81%)
1489
- */
1490
- visitors: number;
1491
- topPages?: {
1492
- pathname: string;
1493
- views: number;
1494
- id?: string | null;
1495
- }[] | null;
1496
- topReferrers?: {
1497
- source: string;
1498
- views: number;
1499
- id?: string | null;
1500
- }[] | null;
1501
- topEvents?: {
1502
- name: string;
1503
- count: number;
1504
- id?: string | null;
1505
- }[] | null;
1506
- eventsDropped?: {
1507
- cardinality?: number | null;
1508
- schema?: number | null;
1509
- late?: number | null;
1510
- origin?: number | null;
1511
- key?: number | null;
1512
- rate?: number | null;
1513
- disabled?: number | null;
1514
- };
1515
- snapshottedAt?: string | null;
1516
- /**
1517
- * Tenant timezone used to bucket this snapshot's date.
1518
- */
1519
- bucketTz: string;
1520
- /**
1521
- * Deterministic aggregate schema shape hash for mismatch detection.
1522
- */
1523
- schemaShape: string;
1524
- /**
1525
- * Per-event dimension/page/referrer aggregates. Populated by snapshot cron when registered events have Redis data.
1526
- */
1527
- eventDetails?: {
1528
- eventName: string;
1529
- count?: number | null;
1530
- /**
1531
- * Deterministic schema shape hash for this event detail row.
1532
- */
1533
- schemaShape?: string | null;
1534
- dimensions?: {
1535
- dimension: string;
1536
- values?: {
1537
- value: string;
1538
- count: number;
1539
- id?: string | null;
1540
- }[] | null;
1541
- id?: string | null;
1542
- }[] | null;
1543
- pages?: {
1544
- pathname: string;
1545
- count: number;
1546
- id?: string | null;
1547
- }[] | null;
1548
- referrers?: {
1549
- source: string;
1550
- count: number;
1551
- id?: string | null;
1552
- }[] | null;
1553
- id?: string | null;
1554
- }[] | null;
1555
- /**
1556
- * MCP tool usage aggregate. Populated by snapshot cron from daily Redis keys.
1557
- */
1558
- mcpUsage?: {
1559
- toolCalls?: number | null;
1560
- sessions?: number | null;
1561
- convertedSessions?: number | null;
1562
- conversionRate?: number | null;
1563
- successfulWrites?: number | null;
1564
- isPartial?: boolean | null;
1565
- topTools?: {
1566
- name: string;
1567
- count: number;
1568
- readOnly?: boolean | null;
1569
- id?: string | null;
1570
- }[] | null;
1571
- transports?: {
1572
- name: string;
1573
- count: number;
1574
- id?: string | null;
1575
- }[] | null;
1576
- httpDurationMs?: {
1577
- p50?: number | null;
1578
- p99?: number | null;
1579
- buckets?: {
1580
- bucket: string;
1581
- label: string;
1582
- count: number;
1583
- id?: string | null;
1584
- }[] | null;
1585
- };
1586
- };
1587
- updatedAt: string;
1588
- createdAt: string;
1589
- }
1590
- /**
1591
- * This interface was referenced by `Config`'s JSON-Schema
1592
- * via the `definition` "analytics-event-schemas".
1593
- */
1594
- interface AnalyticsEventSchema {
1595
- id: string;
1596
- tenant?: (string | null) | Tenant;
1597
1260
  /**
1598
- * Valid event name pattern.
1599
- */
1600
- eventName: string;
1601
- enabled: boolean;
1602
- dimensions?: {
1603
- key: string;
1604
- type: 'enum' | 'boolean';
1605
- /**
1606
- * Comma-separated values. Required when type=enum, optional otherwise. Boolean auto-derives {true,false}. Max 20 per key.
1607
- */
1608
- allowedValues?: string | null;
1609
- description?: string | null;
1610
- id?: string | null;
1611
- }[] | null;
1612
- createdBy?: (string | null) | User;
1613
- updatedBy?: (string | null) | User;
1614
- updatedAt: string;
1615
- createdAt: string;
1616
- deletedAt?: string | null;
1617
- }
1618
- /**
1619
- * This interface was referenced by `Config`'s JSON-Schema
1620
- * via the `definition` "api-usage".
1621
- */
1622
- interface ApiUsage {
1623
- id: string;
1624
- tenant?: (string | null) | Tenant;
1625
- /**
1626
- * YYYY-MM format
1627
- */
1628
- month: string;
1629
- apiCallCount: number;
1630
- plan: 'free' | 'starter' | 'basic' | 'pro' | 'enterprise';
1631
- /**
1632
- * -1 means unlimited
1633
- */
1634
- apiCallLimit: number;
1635
- /**
1636
- * Storage usage in bytes
1637
- */
1638
- storageUsedBytes?: number | null;
1639
- /**
1640
- * Storage limit in bytes (-1 means unlimited)
1641
- */
1642
- storageLimitBytes?: number | null;
1643
- /**
1644
- * Total document count across all tenant-scoped collections
1645
- */
1646
- documentCount?: number | null;
1647
- /**
1648
- * Number of video documents
1261
+ * Tax rate at time of order (%)
1649
1262
  */
1650
- videoCount?: number | null;
1263
+ taxRate?: number | null;
1651
1264
  /**
1652
- * Weighted video minutes used (duration × quality multiplier)
1265
+ * Currency at time of order (ISO-4217)
1653
1266
  */
1654
- videoMinutesUsed?: number | null;
1267
+ currency?: string | null;
1655
1268
  /**
1656
- * Monthly viewer watch time from Mux Data
1269
+ * Snapshot of the discount amount allocated to this line at order time (minor units).
1657
1270
  */
1658
- deliveryMinutesUsed?: number | null;
1271
+ discountAllocation?: number | null;
1659
1272
  /**
1660
- * AI generation count
1273
+ * Per-unit price snapshot after discount allocation. round(discountedTotalPrice / quantity).
1661
1274
  */
1662
- aiGenerationCount?: number | null;
1275
+ discountedUnitPrice?: number | null;
1663
1276
  /**
1664
- * Timestamp when the usage snapshot cron calculated this monthly aggregate.
1277
+ * Line total snapshot after discount allocation at order time (totalPrice - discountAllocation).
1665
1278
  */
1666
- snapshottedAt?: string | null;
1279
+ discountedTotalPrice?: number | null;
1667
1280
  updatedAt: string;
1668
1281
  createdAt: string;
1282
+ deletedAt?: string | null;
1669
1283
  }
1670
1284
  /**
1671
1285
  * This interface was referenced by `Config`'s JSON-Schema
@@ -1685,7 +1299,7 @@ interface Product {
1685
1299
  */
1686
1300
  description?: string | null;
1687
1301
  /**
1688
- * Product detail gallery images. When thumbnail and listing.primaryImage are empty, the first gallery image can appear as the product list thumbnail. Add alt text when uploading new images and order images in storefront display order.
1302
+ * Product detail gallery images. Order them in storefront display order.
1689
1303
  */
1690
1304
  images?: (string | Image)[] | null;
1691
1305
  /**
@@ -1693,7 +1307,7 @@ interface Product {
1693
1307
  */
1694
1308
  videos?: (string | Video)[] | null;
1695
1309
  /**
1696
- * Product detail body content. Supports image uploads and Iframe/Player/Carousel embed blocks. The article editor Code block and AI assist are not shown in this product profile.
1310
+ * Product detail body content. Supports images and Iframe/Player/Carousel embed blocks.
1697
1311
  */
1698
1312
  content?: {
1699
1313
  root: {
@@ -1727,7 +1341,7 @@ interface Product {
1727
1341
  */
1728
1342
  brand?: (string | null) | Brand;
1729
1343
  /**
1730
- * Shipping fee, free-shipping threshold, and estimated delivery policy for this product. When empty on a new product, the tenant default shipping policy is applied automatically.
1344
+ * Shipping policy for this product. When empty on create, the default policy is applied.
1731
1345
  */
1732
1346
  shippingPolicy?: (string | null) | ShippingPolicy;
1733
1347
  /**
@@ -1824,7 +1438,7 @@ interface Product {
1824
1438
  };
1825
1439
  };
1826
1440
  /**
1827
- * Preferred product list thumbnail. When empty, the list falls back to listing primary image, then the first gallery image. Add alt text when uploading new images.
1441
+ * Preferred thumbnail for product lists. When empty, list media or the first gallery image is used.
1828
1442
  */
1829
1443
  thumbnail?: (string | null) | Image;
1830
1444
  /**
@@ -1836,7 +1450,7 @@ interface Product {
1836
1450
  */
1837
1451
  slug?: string | null;
1838
1452
  /**
1839
- * Draft products are hidden from the storefront. Only Published products are exposed through public APIs. Archived hides without deleting. Deleting a product also deletes variants and options. The last 50 saved versions can be restored from the Versions tab.
1453
+ * Draft is hidden, Published is public, and Archived hides without deleting.
1840
1454
  */
1841
1455
  status?: ('draft' | 'published' | 'archived') | null;
1842
1456
  /**
@@ -2385,9 +1999,265 @@ interface Brand {
2385
1999
  */
2386
2000
  logomark?: (string | null) | BrandLogo;
2387
2001
  /**
2388
- * Brand official website URL
2002
+ * Brand official website URL
2003
+ */
2004
+ website?: string | null;
2005
+ seo?: {
2006
+ /**
2007
+ * Search result title (falls back to document title)
2008
+ */
2009
+ title?: string | null;
2010
+ /**
2011
+ * Search result description
2012
+ */
2013
+ description?: string | null;
2014
+ /**
2015
+ * Block search engine indexing
2016
+ */
2017
+ noIndex?: boolean | null;
2018
+ /**
2019
+ * Canonical URL (prevents duplicate content)
2020
+ */
2021
+ canonical?: string | null;
2022
+ openGraph?: {
2023
+ /**
2024
+ * OG title (falls back to seo.title)
2025
+ */
2026
+ title?: string | null;
2027
+ /**
2028
+ * OG description (falls back to seo.description)
2029
+ */
2030
+ description?: string | null;
2031
+ /**
2032
+ * OG / Twitter Card image (1200×630 recommended). Leaving this empty does not set it automatically from collection media.
2033
+ */
2034
+ image?: (string | null) | BrandLogo;
2035
+ };
2036
+ };
2037
+ /**
2038
+ * When enabled, the slug will auto-generate from the title field on save and autosave.
2039
+ */
2040
+ generateSlug?: boolean | null;
2041
+ slug?: string | null;
2042
+ status?: ('draft' | 'published' | 'archived') | null;
2043
+ isFeatured?: boolean | null;
2044
+ publishedAt?: string | null;
2045
+ metadata?: {
2046
+ [k: string]: unknown;
2047
+ } | unknown[] | string | number | boolean | null;
2048
+ updatedAt: string;
2049
+ createdAt: string;
2050
+ deletedAt?: string | null;
2051
+ }
2052
+ /**
2053
+ * This interface was referenced by `Config`'s JSON-Schema
2054
+ * via the `definition` "brand-logos".
2055
+ */
2056
+ interface BrandLogo {
2057
+ id: string;
2058
+ tenant?: (string | null) | Tenant;
2059
+ /**
2060
+ * Describe the image. Used for users who cannot see it, screen readers, and search/share previews.
2061
+ */
2062
+ alt?: string | null;
2063
+ /**
2064
+ * Low quality image placeholder
2065
+ */
2066
+ lqip?: string | null;
2067
+ palette?: {
2068
+ vibrant?: string | null;
2069
+ muted?: string | null;
2070
+ darkVibrant?: string | null;
2071
+ darkMuted?: string | null;
2072
+ lightVibrant?: string | null;
2073
+ lightMuted?: string | null;
2074
+ };
2075
+ prefix?: string | null;
2076
+ updatedAt: string;
2077
+ createdAt: string;
2078
+ deletedAt?: string | null;
2079
+ url?: string | null;
2080
+ thumbnailURL?: string | null;
2081
+ filename?: string | null;
2082
+ mimeType?: string | null;
2083
+ filesize?: number | null;
2084
+ width?: number | null;
2085
+ height?: number | null;
2086
+ focalX?: number | null;
2087
+ focalY?: number | null;
2088
+ sizes?: {
2089
+ '16'?: {
2090
+ url?: string | null;
2091
+ width?: number | null;
2092
+ height?: number | null;
2093
+ mimeType?: string | null;
2094
+ filesize?: number | null;
2095
+ filename?: string | null;
2096
+ };
2097
+ '32'?: {
2098
+ url?: string | null;
2099
+ width?: number | null;
2100
+ height?: number | null;
2101
+ mimeType?: string | null;
2102
+ filesize?: number | null;
2103
+ filename?: string | null;
2104
+ };
2105
+ '64'?: {
2106
+ url?: string | null;
2107
+ width?: number | null;
2108
+ height?: number | null;
2109
+ mimeType?: string | null;
2110
+ filesize?: number | null;
2111
+ filename?: string | null;
2112
+ };
2113
+ '128'?: {
2114
+ url?: string | null;
2115
+ width?: number | null;
2116
+ height?: number | null;
2117
+ mimeType?: string | null;
2118
+ filesize?: number | null;
2119
+ filename?: string | null;
2120
+ };
2121
+ '180'?: {
2122
+ url?: string | null;
2123
+ width?: number | null;
2124
+ height?: number | null;
2125
+ mimeType?: string | null;
2126
+ filesize?: number | null;
2127
+ filename?: string | null;
2128
+ };
2129
+ '192'?: {
2130
+ url?: string | null;
2131
+ width?: number | null;
2132
+ height?: number | null;
2133
+ mimeType?: string | null;
2134
+ filesize?: number | null;
2135
+ filename?: string | null;
2136
+ };
2137
+ '512'?: {
2138
+ url?: string | null;
2139
+ width?: number | null;
2140
+ height?: number | null;
2141
+ mimeType?: string | null;
2142
+ filesize?: number | null;
2143
+ filename?: string | null;
2144
+ };
2145
+ };
2146
+ }
2147
+ /**
2148
+ * This interface was referenced by `Config`'s JSON-Schema
2149
+ * via the `definition` "shipping-policies".
2150
+ */
2151
+ interface ShippingPolicy {
2152
+ id: string;
2153
+ _order?: string | null;
2154
+ tenant?: (string | null) | Tenant;
2155
+ displayLabel?: string | null;
2156
+ /**
2157
+ * e.g. Standard shipping, Large items
2158
+ */
2159
+ title?: string | null;
2160
+ /**
2161
+ * Amount in KRW (won)
2162
+ */
2163
+ baseAmount?: number | null;
2164
+ /**
2165
+ * Amount in KRW (won)
2166
+ */
2167
+ freeShippingMinAmount?: number | null;
2168
+ /**
2169
+ * Amount in KRW (won)
2170
+ */
2171
+ jejuExtraAmount?: number | null;
2172
+ /**
2173
+ * Amount in KRW (won)
2174
+ */
2175
+ remoteAreaExtraAmount?: number | null;
2176
+ /**
2177
+ * Short summary for listing/cards
2178
+ */
2179
+ description?: string | null;
2180
+ /**
2181
+ * When enabled, the slug will auto-generate from the title field on save and autosave.
2182
+ */
2183
+ generateSlug?: boolean | null;
2184
+ slug?: string | null;
2185
+ /**
2186
+ * Estimated delivery days
2187
+ */
2188
+ estimatedDays?: number | null;
2189
+ isActive?: boolean | null;
2190
+ isDefault?: boolean | null;
2191
+ metadata?: {
2192
+ [k: string]: unknown;
2193
+ } | unknown[] | string | number | boolean | null;
2194
+ updatedAt: string;
2195
+ createdAt: string;
2196
+ deletedAt?: string | null;
2197
+ }
2198
+ /**
2199
+ * This interface was referenced by `Config`'s JSON-Schema
2200
+ * via the `definition` "product-collection-items".
2201
+ */
2202
+ interface ProductCollectionItem {
2203
+ id: string;
2204
+ '_product-collection-items_items_order'?: string | null;
2205
+ _order?: string | null;
2206
+ tenant?: (string | null) | Tenant;
2207
+ /**
2208
+ * Product collection for this membership. It cannot be moved to another collection after creation.
2209
+ */
2210
+ collection: string | ProductCollection;
2211
+ /**
2212
+ * Product shown in this collection. Its display order inside the collection is managed by dragging this membership row.
2213
+ */
2214
+ product: string | Product;
2215
+ updatedAt: string;
2216
+ createdAt: string;
2217
+ }
2218
+ /**
2219
+ * Curated product grouping for campaigns, recommendations, and merchandising.
2220
+ *
2221
+ * This interface was referenced by `Config`'s JSON-Schema
2222
+ * via the `definition` "product-collections".
2223
+ */
2224
+ interface ProductCollection {
2225
+ id: string;
2226
+ _order?: string | null;
2227
+ tenant?: (string | null) | Tenant;
2228
+ title?: string | null;
2229
+ /**
2230
+ * Secondary display line shown in cards, listings, and detail headers.
2231
+ */
2232
+ subtitle?: string | null;
2233
+ /**
2234
+ * Short summary for listing/cards
2235
+ */
2236
+ description?: string | null;
2237
+ content?: {
2238
+ root: {
2239
+ type: string;
2240
+ children: {
2241
+ type: any;
2242
+ version: number;
2243
+ [k: string]: unknown;
2244
+ }[];
2245
+ direction: ('ltr' | 'rtl') | null;
2246
+ format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
2247
+ indent: number;
2248
+ version: number;
2249
+ };
2250
+ [k: string]: unknown;
2251
+ } | null;
2252
+ images?: (string | Image)[] | null;
2253
+ /**
2254
+ * Collection item memberships. Public collections include only published products, and display order follows the dragged membership row order.
2389
2255
  */
2390
- website?: string | null;
2256
+ items?: {
2257
+ docs?: (string | ProductCollectionItem)[];
2258
+ hasNextPage?: boolean;
2259
+ totalDocs?: number;
2260
+ };
2391
2261
  seo?: {
2392
2262
  /**
2393
2263
  * Search result title (falls back to document title)
@@ -2417,9 +2287,10 @@ interface Brand {
2417
2287
  /**
2418
2288
  * OG / Twitter Card image (1200×630 recommended). Leaving this empty does not set it automatically from collection media.
2419
2289
  */
2420
- image?: (string | null) | BrandLogo;
2290
+ image?: (string | null) | Image;
2421
2291
  };
2422
2292
  };
2293
+ thumbnail?: (string | null) | Image;
2423
2294
  /**
2424
2295
  * When enabled, the slug will auto-generate from the title field on save and autosave.
2425
2296
  */
@@ -2437,904 +2308,1118 @@ interface Brand {
2437
2308
  }
2438
2309
  /**
2439
2310
  * This interface was referenced by `Config`'s JSON-Schema
2440
- * via the `definition` "brand-logos".
2311
+ * via the `definition` "transactions".
2441
2312
  */
2442
- interface BrandLogo {
2313
+ interface Transaction {
2443
2314
  id: string;
2444
2315
  tenant?: (string | null) | Tenant;
2316
+ _title?: string | null;
2317
+ type: 'payment' | 'refund';
2318
+ status: 'pending' | 'paid' | 'failed' | 'canceled' | 'refunded';
2319
+ order: string | Order;
2320
+ amount?: number | null;
2445
2321
  /**
2446
- * Describe the image. Used for users who cannot see it, screen readers, and search/share previews.
2322
+ * Payment method snapshot returned by the provider. Not edited directly.
2447
2323
  */
2448
- alt?: string | null;
2324
+ paymentMethod?: string | null;
2449
2325
  /**
2450
- * Low quality image placeholder
2326
+ * Installment months (0 = lump sum)
2451
2327
  */
2452
- lqip?: string | null;
2453
- palette?: {
2454
- vibrant?: string | null;
2455
- muted?: string | null;
2456
- darkVibrant?: string | null;
2457
- darkMuted?: string | null;
2458
- lightVibrant?: string | null;
2459
- lightMuted?: string | null;
2328
+ installmentMonths?: number | null;
2329
+ approvedAt?: string | null;
2330
+ receiptUrl?: string | null;
2331
+ pgPaymentId?: string | null;
2332
+ pgOrderId?: string | null;
2333
+ providerEventId?: string | null;
2334
+ providerStatus?: string | null;
2335
+ confirmedAmount?: number | null;
2336
+ confirmedCurrency?: string | null;
2337
+ confirmedAt?: string | null;
2338
+ confirmationSource?: ('provider_webhook' | 'provider_lookup' | 'provider_api_confirm' | 'manual_server') | null;
2339
+ cashReceipt?: {
2340
+ issuanceType?: ('none' | 'personal' | 'business') | null;
2341
+ /**
2342
+ * Personal: phone or cash receipt card number / Business: business registration number
2343
+ */
2344
+ registrationNumber?: string | null;
2345
+ issueNumber?: string | null;
2346
+ issuedAt?: string | null;
2460
2347
  };
2461
- prefix?: string | null;
2348
+ cardInfo?: {
2349
+ brand?: string | null;
2350
+ last4?: string | null;
2351
+ expMonth?: number | null;
2352
+ expYear?: number | null;
2353
+ issuerCode?: string | null;
2354
+ type?: ('credit' | 'debit' | 'gift') | null;
2355
+ owner?: string | null;
2356
+ };
2357
+ failureCode?: string | null;
2358
+ failureMessage?: string | null;
2359
+ /**
2360
+ * Payment gateway (e.g. toss, stripe)
2361
+ */
2362
+ pgProvider?: string | null;
2363
+ /**
2364
+ * Legal retention deadline (5 years, Electronic Financial Transactions Act)
2365
+ */
2366
+ retainUntil?: string | null;
2367
+ metadata?: {
2368
+ [k: string]: unknown;
2369
+ } | unknown[] | string | number | boolean | null;
2462
2370
  updatedAt: string;
2463
2371
  createdAt: string;
2464
2372
  deletedAt?: string | null;
2465
- url?: string | null;
2466
- thumbnailURL?: string | null;
2467
- filename?: string | null;
2468
- mimeType?: string | null;
2469
- filesize?: number | null;
2470
- width?: number | null;
2471
- height?: number | null;
2472
- focalX?: number | null;
2473
- focalY?: number | null;
2474
- sizes?: {
2475
- '16'?: {
2476
- url?: string | null;
2477
- width?: number | null;
2478
- height?: number | null;
2479
- mimeType?: string | null;
2480
- filesize?: number | null;
2481
- filename?: string | null;
2482
- };
2483
- '32'?: {
2484
- url?: string | null;
2485
- width?: number | null;
2486
- height?: number | null;
2487
- mimeType?: string | null;
2488
- filesize?: number | null;
2489
- filename?: string | null;
2490
- };
2491
- '64'?: {
2492
- url?: string | null;
2493
- width?: number | null;
2494
- height?: number | null;
2495
- mimeType?: string | null;
2496
- filesize?: number | null;
2497
- filename?: string | null;
2498
- };
2499
- '128'?: {
2500
- url?: string | null;
2501
- width?: number | null;
2502
- height?: number | null;
2503
- mimeType?: string | null;
2504
- filesize?: number | null;
2505
- filename?: string | null;
2506
- };
2507
- '180'?: {
2508
- url?: string | null;
2509
- width?: number | null;
2510
- height?: number | null;
2511
- mimeType?: string | null;
2512
- filesize?: number | null;
2513
- filename?: string | null;
2514
- };
2515
- '192'?: {
2516
- url?: string | null;
2517
- width?: number | null;
2518
- height?: number | null;
2519
- mimeType?: string | null;
2520
- filesize?: number | null;
2521
- filename?: string | null;
2522
- };
2523
- '512'?: {
2524
- url?: string | null;
2525
- width?: number | null;
2526
- height?: number | null;
2527
- mimeType?: string | null;
2528
- filesize?: number | null;
2529
- filename?: string | null;
2530
- };
2373
+ }
2374
+ /**
2375
+ * This interface was referenced by `Config`'s JSON-Schema
2376
+ * via the `definition` "fulfillments".
2377
+ */
2378
+ interface Fulfillment {
2379
+ id: string;
2380
+ tenant?: (string | null) | Tenant;
2381
+ order: string | Order;
2382
+ status: 'pending' | 'packed' | 'shipped' | 'delivered' | 'failed';
2383
+ /**
2384
+ * Carrier name (e.g. CJ Logistics, FedEx)
2385
+ */
2386
+ carrier?: string | null;
2387
+ /**
2388
+ * Carrier tracking number. Used as input for the derived trackingUrl.
2389
+ */
2390
+ trackingNumber?: string | null;
2391
+ /**
2392
+ * Tracking URL (auto-derived from carrier + trackingNumber)
2393
+ */
2394
+ trackingUrl?: string | null;
2395
+ packedAt?: string | null;
2396
+ shippedAt?: string | null;
2397
+ deliveredAt?: string | null;
2398
+ items?: {
2399
+ docs?: (string | FulfillmentItem)[];
2400
+ hasNextPage?: boolean;
2401
+ totalDocs?: number;
2402
+ };
2403
+ /**
2404
+ * Internal fulfillment note. Not shown directly to customers.
2405
+ */
2406
+ adminNotes?: string | null;
2407
+ metadata?: {
2408
+ [k: string]: unknown;
2409
+ } | unknown[] | string | number | boolean | null;
2410
+ updatedAt: string;
2411
+ createdAt: string;
2412
+ deletedAt?: string | null;
2413
+ }
2414
+ /**
2415
+ * This interface was referenced by `Config`'s JSON-Schema
2416
+ * via the `definition` "fulfillment-items".
2417
+ */
2418
+ interface FulfillmentItem {
2419
+ id: string;
2420
+ tenant?: (string | null) | Tenant;
2421
+ fulfillment: string | Fulfillment;
2422
+ orderItem: string | OrderItem;
2423
+ quantity: number;
2424
+ updatedAt: string;
2425
+ createdAt: string;
2426
+ deletedAt?: string | null;
2427
+ }
2428
+ /**
2429
+ * This interface was referenced by `Config`'s JSON-Schema
2430
+ * via the `definition` "returns".
2431
+ */
2432
+ interface Return {
2433
+ id: string;
2434
+ tenant?: (string | null) | Tenant;
2435
+ returnNumber?: string | null;
2436
+ order: string | Order;
2437
+ type: 'refund' | 'exchange';
2438
+ /**
2439
+ * New order created for exchange
2440
+ */
2441
+ exchangeOrder?: (string | null) | Order;
2442
+ status: 'requested' | 'processing' | 'approved' | 'rejected' | 'completed';
2443
+ /**
2444
+ * Reason category for the return or refund request. Used for reporting and operations.
2445
+ */
2446
+ reason?: ('change_of_mind' | 'defective' | 'wrong_delivery' | 'damaged' | 'other') | null;
2447
+ /**
2448
+ * Detailed return reason
2449
+ */
2450
+ reasonDetail?: string | null;
2451
+ items?: {
2452
+ docs?: (string | ReturnItem)[];
2453
+ hasNextPage?: boolean;
2454
+ totalDocs?: number;
2531
2455
  };
2456
+ /**
2457
+ * Internal return-processing note. Not shown directly to customers.
2458
+ */
2459
+ adminNotes?: string | null;
2460
+ completedAt?: string | null;
2461
+ /**
2462
+ * Refund receipt URL
2463
+ */
2464
+ refundReceiptUrl?: string | null;
2465
+ refundAmount: number;
2466
+ /**
2467
+ * Return shipping fee deducted from refundAmount
2468
+ */
2469
+ returnShippingFee?: number | null;
2470
+ /**
2471
+ * Exchange balance (positive: extra charge, negative: extra refund)
2472
+ */
2473
+ exchangeDifference?: number | null;
2474
+ metadata?: {
2475
+ [k: string]: unknown;
2476
+ } | unknown[] | string | number | boolean | null;
2477
+ updatedAt: string;
2478
+ createdAt: string;
2479
+ deletedAt?: string | null;
2480
+ }
2481
+ /**
2482
+ * This interface was referenced by `Config`'s JSON-Schema
2483
+ * via the `definition` "return-items".
2484
+ */
2485
+ interface ReturnItem {
2486
+ id: string;
2487
+ tenant?: (string | null) | Tenant;
2488
+ return: string | Return;
2489
+ order: string | Order;
2490
+ status: 'requested' | 'processing' | 'approved' | 'rejected' | 'completed';
2491
+ orderItem: string | OrderItem;
2492
+ product: string | Product;
2493
+ variant?: (string | null) | ProductVariant;
2494
+ /**
2495
+ * Quantity fixed when the return item is created. It cannot be edited after create to protect refund/restock calculations.
2496
+ */
2497
+ quantity: number;
2498
+ restockAction: 'return_to_stock' | 'discard';
2499
+ /**
2500
+ * Restocking fee for this line (deducted from line refund)
2501
+ */
2502
+ restockingFee?: number | null;
2503
+ productTitle?: string | null;
2504
+ updatedAt: string;
2505
+ createdAt: string;
2506
+ deletedAt?: string | null;
2532
2507
  }
2533
2508
  /**
2534
2509
  * This interface was referenced by `Config`'s JSON-Schema
2535
- * via the `definition` "shipping-policies".
2510
+ * via the `definition` "api-keys".
2536
2511
  */
2537
- interface ShippingPolicy {
2512
+ interface ApiKey {
2538
2513
  id: string;
2539
- _order?: string | null;
2540
- tenant?: (string | null) | Tenant;
2541
- displayLabel?: string | null;
2514
+ tenant: string | Tenant;
2515
+ name: string;
2516
+ secretHash: string;
2542
2517
  /**
2543
- * e.g. Standard shipping, Large items
2518
+ * Key prefix (e.g. sk01_ab12cd3)
2544
2519
  */
2545
- title?: string | null;
2520
+ displayPrefix: string;
2546
2521
  /**
2547
- * Amount in KRW (won)
2522
+ * Trailing characters used to identify the key. The raw secret key is not stored or displayed.
2548
2523
  */
2549
- baseAmount?: number | null;
2524
+ displaySuffix: string;
2550
2525
  /**
2551
- * Amount in KRW (won)
2526
+ * Capability scopes. Default is read+write; webhook dispatch requires webhook, analytics writes require analytics.
2552
2527
  */
2553
- freeShippingMinAmount?: number | null;
2528
+ scopes?: ('read' | 'write' | 'webhook' | 'analytics' | 'super-admin')[] | null;
2554
2529
  /**
2555
- * Amount in KRW (won)
2530
+ * User who issued the key. Read-only provenance for issuance audit.
2556
2531
  */
2557
- jejuExtraAmount?: number | null;
2532
+ createdBy?: (string | null) | User;
2558
2533
  /**
2559
- * Amount in KRW (won)
2534
+ * IP address of the key creation request. Privacy-bearing security audit metadata.
2560
2535
  */
2561
- remoteAreaExtraAmount?: number | null;
2536
+ createdByIp?: string | null;
2537
+ lastUsedAt?: string | null;
2562
2538
  /**
2563
- * Short summary for listing/cards
2539
+ * Last IP address that used the key. Privacy-bearing audit value for abuse investigation.
2564
2540
  */
2565
- description?: string | null;
2541
+ lastUsedIp?: string | null;
2542
+ revokedAt?: string | null;
2566
2543
  /**
2567
- * When enabled, the slug will auto-generate from the title field on save and autosave.
2544
+ * User who revoked the key. Read-only provenance for revocation audit.
2568
2545
  */
2569
- generateSlug?: boolean | null;
2570
- slug?: string | null;
2546
+ revokedBy?: (string | null) | User;
2571
2547
  /**
2572
- * Estimated delivery days
2548
+ * Optional expiration. Empty = never expires.
2573
2549
  */
2574
- estimatedDays?: number | null;
2575
- isActive?: boolean | null;
2576
- isDefault?: boolean | null;
2577
- metadata?: {
2578
- [k: string]: unknown;
2579
- } | unknown[] | string | number | boolean | null;
2550
+ expiresAt?: string | null;
2580
2551
  updatedAt: string;
2581
2552
  createdAt: string;
2582
2553
  deletedAt?: string | null;
2583
2554
  }
2584
2555
  /**
2585
2556
  * This interface was referenced by `Config`'s JSON-Schema
2586
- * via the `definition` "product-collection-items".
2557
+ * via the `definition` "personal-access-tokens".
2587
2558
  */
2588
- interface ProductCollectionItem {
2559
+ interface PersonalAccessToken {
2589
2560
  id: string;
2590
- '_product-collection-items_items_order'?: string | null;
2591
- _order?: string | null;
2592
- tenant?: (string | null) | Tenant;
2561
+ user: string | User;
2593
2562
  /**
2594
- * Product collection for this membership. It cannot be moved to another collection after creation.
2563
+ * e.g. "CLI: MacBook Pro (darwin)", "GitHub Actions"
2595
2564
  */
2596
- collection: string | ProductCollection;
2565
+ name: string;
2566
+ secretHash: string;
2597
2567
  /**
2598
- * Product shown in this collection. Its display order inside the collection is managed by dragging this membership row.
2568
+ * PAT prefix. Display-only token type marker, not the raw token.
2599
2569
  */
2600
- product: string | Product;
2570
+ displayPrefix: string;
2571
+ /**
2572
+ * Trailing characters used to identify the PAT. The raw token is not shown again.
2573
+ */
2574
+ displaySuffix: string;
2575
+ /**
2576
+ * Default tenant ID for CLI operations. Set via `01 tenant use <name>`.
2577
+ */
2578
+ defaultTenant?: string | null;
2579
+ /**
2580
+ * IP address of the PAT creation request. Privacy-bearing security audit metadata.
2581
+ */
2582
+ createdByIp?: string | null;
2583
+ lastUsedAt?: string | null;
2584
+ /**
2585
+ * Last IP address that used the PAT. Privacy-bearing audit value for abuse investigation.
2586
+ */
2587
+ lastUsedIp?: string | null;
2588
+ revokedAt?: string | null;
2589
+ /**
2590
+ * User who revoked the PAT. Read-only provenance for revocation audit.
2591
+ */
2592
+ revokedBy?: (string | null) | User;
2593
+ /**
2594
+ * PATs expire after 90 days by default.
2595
+ */
2596
+ expiresAt?: string | null;
2601
2597
  updatedAt: string;
2602
2598
  createdAt: string;
2599
+ deletedAt?: string | null;
2603
2600
  }
2604
2601
  /**
2605
- * Curated product grouping for campaigns, recommendations, and merchandising.
2606
- *
2607
2602
  * This interface was referenced by `Config`'s JSON-Schema
2608
- * via the `definition` "product-collections".
2603
+ * via the `definition` "audit-logs".
2609
2604
  */
2610
- interface ProductCollection {
2605
+ interface AuditLog {
2611
2606
  id: string;
2612
- _order?: string | null;
2613
2607
  tenant?: (string | null) | Tenant;
2614
- title?: string | null;
2615
2608
  /**
2616
- * Secondary display line shown in cards, listings, and detail headers.
2609
+ * Event type
2617
2610
  */
2618
- subtitle?: string | null;
2611
+ eventType: string;
2619
2612
  /**
2620
- * Short summary for listing/cards
2613
+ * Actor ID. May refer to a user or service, and can be empty for system actions.
2621
2614
  */
2622
- description?: string | null;
2623
- content?: {
2624
- root: {
2625
- type: string;
2626
- children: {
2627
- type: any;
2628
- version: number;
2629
- [k: string]: unknown;
2630
- }[];
2631
- direction: ('ltr' | 'rtl') | null;
2632
- format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
2633
- indent: number;
2634
- version: number;
2635
- };
2615
+ actorId?: string | null;
2616
+ /**
2617
+ * Detailed audit event payload. May contain sensitive security, billing, or provider context.
2618
+ */
2619
+ payload?: {
2636
2620
  [k: string]: unknown;
2637
- } | null;
2638
- images?: (string | Image)[] | null;
2621
+ } | unknown[] | string | number | boolean | null;
2622
+ updatedAt: string;
2623
+ createdAt: string;
2624
+ }
2625
+ /**
2626
+ * This interface was referenced by `Config`'s JSON-Schema
2627
+ * via the `definition` "webhook-events".
2628
+ */
2629
+ interface WebhookEvent {
2630
+ id: string;
2631
+ tenant?: (string | null) | Tenant;
2639
2632
  /**
2640
- * Collection item memberships. Public collections include only published products, and display order follows the dragged membership row order.
2633
+ * Provider
2641
2634
  */
2642
- items?: {
2643
- docs?: (string | ProductCollectionItem)[];
2644
- hasNextPage?: boolean;
2645
- totalDocs?: number;
2646
- };
2647
- seo?: {
2648
- /**
2649
- * Search result title (falls back to document title)
2650
- */
2651
- title?: string | null;
2652
- /**
2653
- * Search result description
2654
- */
2655
- description?: string | null;
2656
- /**
2657
- * Block search engine indexing
2658
- */
2659
- noIndex?: boolean | null;
2660
- /**
2661
- * Canonical URL (prevents duplicate content)
2662
- */
2663
- canonical?: string | null;
2664
- openGraph?: {
2665
- /**
2666
- * OG title (falls back to seo.title)
2667
- */
2668
- title?: string | null;
2669
- /**
2670
- * OG description (falls back to seo.description)
2671
- */
2672
- description?: string | null;
2673
- /**
2674
- * OG / Twitter Card image (1200×630 recommended). Leaving this empty does not set it automatically from collection media.
2675
- */
2676
- image?: (string | null) | Image;
2677
- };
2678
- };
2679
- thumbnail?: (string | null) | Image;
2635
+ provider: string;
2680
2636
  /**
2681
- * When enabled, the slug will auto-generate from the title field on save and autosave.
2637
+ * Provider-supplied event ID. Used with provider as the idempotency key for duplicate prevention.
2682
2638
  */
2683
- generateSlug?: boolean | null;
2684
- slug?: string | null;
2685
- status?: ('draft' | 'published' | 'archived') | null;
2686
- isFeatured?: boolean | null;
2687
- publishedAt?: string | null;
2688
- metadata?: {
2639
+ eventId: string;
2640
+ receivedAt?: string | null;
2641
+ /**
2642
+ * Raw provider event body. May contain sensitive security or payment context.
2643
+ */
2644
+ payload?: {
2689
2645
  [k: string]: unknown;
2690
2646
  } | unknown[] | string | number | boolean | null;
2691
2647
  updatedAt: string;
2692
2648
  createdAt: string;
2693
- deletedAt?: string | null;
2694
2649
  }
2695
2650
  /**
2696
2651
  * This interface was referenced by `Config`'s JSON-Schema
2697
- * via the `definition` "orders".
2652
+ * via the `definition` "webhook-deliveries".
2698
2653
  */
2699
- interface Order {
2654
+ interface WebhookDelivery {
2700
2655
  id: string;
2701
2656
  tenant?: (string | null) | Tenant;
2702
- orderNumber: string;
2703
- cartToken?: string | null;
2704
- status: 'pending' | 'paid' | 'failed' | 'canceled' | 'refunded' | 'preparing' | 'shipped' | 'delivered' | 'confirmed' | 'return_requested' | 'return_processing' | 'returned';
2705
- totalAmount?: number | null;
2706
- discountCode?: string | null;
2707
- discountAmount?: number | null;
2708
2657
  /**
2709
- * Cumulative refunded amount
2658
+ * Active webhook endpoint used for this delivery attempt.
2659
+ */
2660
+ webhookId?: (string | null) | Webhook;
2661
+ /**
2662
+ * Value sent to receivers as x-webhook-delivery-id.
2663
+ */
2664
+ deliveryId?: string | null;
2665
+ attempt: number;
2666
+ /**
2667
+ * Webhook delivery state. Updated by dispatcher and retry handling paths.
2668
+ */
2669
+ status: 'queued' | 'success' | 'failed' | 'dead';
2670
+ /**
2671
+ * Destination host with query string removed. Full URLs are not stored.
2672
+ */
2673
+ endpointHost?: string | null;
2674
+ /**
2675
+ * HMAC hash of the endpoint URL with query string removed.
2676
+ */
2677
+ endpointUrlHash?: string | null;
2678
+ /**
2679
+ * Collection that produced this delivery attempt.
2680
+ */
2681
+ collection?: string | null;
2682
+ /**
2683
+ * Operation that produced this delivery attempt.
2684
+ */
2685
+ operation?: string | null;
2686
+ /**
2687
+ * Path that produced the delivery attempt.
2710
2688
  */
2711
- refundedAmount?: number | null;
2689
+ source?: ('registry' | 'retry_queue' | 'dlq_retry' | 'password_reset') | null;
2712
2690
  /**
2713
- * Shipping amount at time of order
2691
+ * HTTP status returned by the receiver.
2714
2692
  */
2715
- shippingAmount?: number | null;
2693
+ statusCode?: number | null;
2716
2694
  /**
2717
- * Item subtotal (excl. shipping & discount)
2695
+ * Delivery failure kind. Sensitive request body or headers are not stored.
2718
2696
  */
2719
- subtotalAmount?: number | null;
2720
- taxAmount?: number | null;
2721
- source?: ('web' | 'app' | 'manual') | null;
2722
- currency?: string | null;
2697
+ errorKind?: string | null;
2723
2698
  /**
2724
- * Internal admin notes (not visible to customers)
2699
+ * Truncated error message. Sensitive request body or headers are not stored.
2725
2700
  */
2726
- adminNotes?: string | null;
2727
- cancelReason?: string | null;
2728
- canceledAt?: string | null;
2729
- completedAt?: string | null;
2701
+ errorMessage?: string | null;
2730
2702
  /**
2731
- * Note left by customer at checkout
2703
+ * Delivery attempt duration in milliseconds.
2732
2704
  */
2733
- customerNote?: string | null;
2734
- customer?: (string | null) | Customer;
2705
+ durationMs?: number | null;
2735
2706
  /**
2736
- * Customer info at the time of order
2707
+ * Next scheduled retry time for a failed delivery.
2737
2708
  */
2738
- customerSnapshot?: {
2739
- name?: string | null;
2740
- email?: string | null;
2741
- phone?: string | null;
2742
- };
2743
- shippingAddress?: {
2744
- recipientName?: string | null;
2745
- phone?: string | null;
2746
- postalCode?: string | null;
2747
- address?: string | null;
2748
- detailAddress?: string | null;
2749
- deliveryMessage?: string | null;
2750
- };
2751
- billingAddress?: {
2752
- recipientName?: string | null;
2753
- businessRegistrationNumber?: string | null;
2754
- email?: string | null;
2755
- phone?: string | null;
2756
- address?: string | null;
2757
- };
2758
- items?: {
2759
- docs?: (string | OrderItem)[];
2760
- hasNextPage?: boolean;
2761
- totalDocs?: number;
2762
- };
2763
- transactions?: {
2764
- docs?: (string | Transaction)[];
2765
- hasNextPage?: boolean;
2766
- totalDocs?: number;
2767
- };
2768
- fulfillments?: {
2769
- docs?: (string | Fulfillment)[];
2770
- hasNextPage?: boolean;
2771
- totalDocs?: number;
2772
- };
2773
- returns?: {
2774
- docs?: (string | Return)[];
2775
- hasNextPage?: boolean;
2776
- totalDocs?: number;
2777
- };
2778
- metadata?: {
2779
- [k: string]: unknown;
2780
- } | unknown[] | string | number | boolean | null;
2781
- nextRefundSeq?: number | null;
2782
- nextCaptureSeq?: number | null;
2783
- nextVoidSeq?: number | null;
2709
+ nextRetryAt?: string | null;
2710
+ /**
2711
+ * Marks attempts produced by Redis retry or DLQ replay paths.
2712
+ */
2713
+ redelivery?: boolean | null;
2714
+ /**
2715
+ * Timestamp when the webhook request was dispatched to the endpoint.
2716
+ */
2717
+ dispatchedAt?: string | null;
2784
2718
  updatedAt: string;
2785
2719
  createdAt: string;
2786
- deletedAt?: string | null;
2787
2720
  }
2788
2721
  /**
2789
2722
  * This interface was referenced by `Config`'s JSON-Schema
2790
- * via the `definition` "customers".
2723
+ * via the `definition` "webhooks".
2791
2724
  */
2792
- interface Customer {
2725
+ interface Webhook {
2793
2726
  id: string;
2794
- _customers_customers_order?: string | null;
2795
- _order?: string | null;
2796
2727
  tenant?: (string | null) | Tenant;
2797
- name: string;
2798
- email?: string | null;
2799
- phone?: string | null;
2800
- groups?: (string | CustomerGroup)[] | null;
2801
2728
  /**
2802
- * Internal notes (not visible to customers)
2729
+ * Webhook name
2803
2730
  */
2804
- note?: string | null;
2805
- birthDate?: string | null;
2806
- gender?: ('male' | 'female' | 'other' | 'prefer_not_to_say') | null;
2807
- isGuest?: boolean | null;
2731
+ name: string;
2808
2732
  /**
2809
- * Authentication provider used at signup. Immutable account provenance after creation.
2733
+ * Webhook endpoint HTTPS URL. Treat this endpoint as a recipient of sensitive workspace events.
2810
2734
  */
2811
- authProvider?: ('local' | 'google' | 'apple' | 'kakao' | 'naver') | null;
2735
+ url: string;
2812
2736
  /**
2813
- * External provider user ID. Paired with authProvider to identify the linked account and not edited after creation.
2737
+ * HMAC signing secret (immutable once set)
2814
2738
  */
2815
- providerUserId?: string | null;
2816
- lastLoginAt?: string | null;
2739
+ secret: string;
2817
2740
  /**
2818
- * Last password change timestamp (used for JWT revocation)
2741
+ * Collections to subscribe to. Leave empty to receive every supported collection event.
2819
2742
  */
2820
- passwordChangedAt?: string | null;
2821
- orders?: {
2822
- docs?: (string | Order)[];
2823
- hasNextPage?: boolean;
2824
- totalDocs?: number;
2825
- };
2826
- addresses?: {
2827
- docs?: (string | CustomerAddress)[];
2828
- hasNextPage?: boolean;
2829
- totalDocs?: number;
2743
+ subscriptions?: {
2744
+ /**
2745
+ * Receives create/update events for this collection.
2746
+ */
2747
+ collection: 'tenant-metadata' | 'tenant-logos' | 'images' | 'products' | 'product-variants' | 'product-options' | 'product-option-values' | 'product-categories' | 'product-tags' | 'product-collections' | 'brands' | 'brand-logos' | 'orders' | 'order-items' | 'transactions' | 'fulfillments' | 'fulfillment-items' | 'returns' | 'return-items' | 'carts' | 'cart-items' | 'discounts' | 'shipping-policies' | 'shipping-zones' | 'customers' | 'customer-profiles' | 'customer-addresses' | 'playlists' | 'playlist-categories' | 'playlist-tags' | 'tracks' | 'track-categories' | 'track-tags' | 'galleries' | 'gallery-items' | 'gallery-categories' | 'gallery-tags' | 'links' | 'link-categories' | 'link-tags' | 'forms' | 'form-submissions' | 'articles' | 'article-authors' | 'article-categories' | 'article-tags' | 'documents' | 'document-categories' | 'document-types' | 'canvases' | 'canvas-node-types' | 'canvas-edge-types' | 'canvas-categories' | 'canvas-tags' | 'canvas-nodes' | 'canvas-edges' | 'videos' | 'video-categories' | 'video-tags' | 'live-streams' | 'posts' | 'comments' | 'reactions' | 'reaction-types' | 'bookmarks' | 'post-categories' | 'customer-profile-lists' | 'event-calendars' | 'events' | 'event-categories' | 'event-occurrences' | 'event-tags';
2748
+ id?: string | null;
2749
+ }[] | null;
2750
+ isActive?: boolean | null;
2751
+ lastDispatchedAt?: string | null;
2752
+ updatedAt: string;
2753
+ createdAt: string;
2754
+ deletedAt?: string | null;
2755
+ }
2756
+ /**
2757
+ * This interface was referenced by `Config`'s JSON-Schema
2758
+ * via the `definition` "tenant-metadata".
2759
+ */
2760
+ interface TenantMetadatum {
2761
+ id: string;
2762
+ tenant?: (string | null) | Tenant;
2763
+ siteInfo?: {
2764
+ /**
2765
+ * Site title (used in browser tab and SEO)
2766
+ */
2767
+ title?: string | null;
2768
+ /**
2769
+ * Site description (used for SEO and social media)
2770
+ */
2771
+ description?: string | null;
2772
+ /**
2773
+ * Comma-separated keywords for SEO
2774
+ */
2775
+ keywords?: string | null;
2776
+ /**
2777
+ * Site author or company name
2778
+ */
2779
+ author?: string | null;
2780
+ /**
2781
+ * Full site URL (e.g., https://example.com)
2782
+ */
2783
+ url?: string | null;
2830
2784
  };
2831
- defaultShippingAddress?: (string | null) | CustomerAddress;
2832
- defaultBillingAddress?: (string | null) | CustomerAddress;
2833
2785
  /**
2834
- * Read-only counter maintained by order hooks for this customer's completed orders.
2786
+ * Required by Korean e-commerce law
2835
2787
  */
2836
- totalOrderCount?: number | null;
2837
- lifetimeValue?: number | null;
2838
- firstOrderAt?: string | null;
2839
- lastOrderAt?: string | null;
2840
- profile?: {
2841
- docs?: (string | CustomerProfile)[];
2842
- hasNextPage?: boolean;
2843
- totalDocs?: number;
2788
+ businessInfo?: {
2789
+ businessRegistrationNumber?: string | null;
2790
+ businessName?: string | null;
2791
+ ceoName?: string | null;
2792
+ businessAddress?: string | null;
2793
+ businessEmail?: string | null;
2794
+ onlineSalesRegistrationNumber?: string | null;
2844
2795
  };
2845
- /**
2846
- * Read-only counter maintained by hooks for community posts authored by this customer.
2847
- */
2848
- postCount?: number | null;
2849
- /**
2850
- * Read-only counter maintained by hooks for community comments authored by this customer.
2851
- */
2852
- commentCount?: number | null;
2853
- /**
2854
- * Read-only counter maintained by hooks for community reactions made by this customer.
2855
- */
2856
- reactionCount?: number | null;
2857
- /**
2858
- * Marks a minor customer. When enabled, guardian consent fields are managed as compliance evidence.
2859
- */
2860
- isMinor?: boolean | null;
2861
- marketingConsent?: {
2862
- email?: {
2863
- isConsented?: boolean | null;
2864
- consentedAt?: string | null;
2865
- expiresAt?: string | null;
2866
- unsubscribedAt?: string | null;
2867
- };
2868
- sms?: {
2869
- isConsented?: boolean | null;
2870
- consentedAt?: string | null;
2871
- expiresAt?: string | null;
2872
- unsubscribedAt?: string | null;
2873
- };
2874
- push?: {
2875
- isConsented?: boolean | null;
2876
- consentedAt?: string | null;
2877
- expiresAt?: string | null;
2878
- unsubscribedAt?: string | null;
2879
- };
2796
+ branding?: {
2797
+ /**
2798
+ * Primary logo
2799
+ */
2800
+ logo?: (string | null) | TenantLogo;
2801
+ /**
2802
+ * Logo for dark mode (optional)
2803
+ */
2804
+ logoDark?: (string | null) | TenantLogo;
2805
+ /**
2806
+ * Logo mark / Icon (optional)
2807
+ */
2808
+ logomark?: (string | null) | TenantLogo;
2809
+ /**
2810
+ * Favicon (will be resized automatically)
2811
+ */
2812
+ favicon?: (string | null) | TenantLogo;
2813
+ /**
2814
+ * Theme color for mobile browsers (hex color)
2815
+ */
2816
+ themeColor?: string | null;
2817
+ };
2818
+ seo?: {
2819
+ /**
2820
+ * Robots meta tag (e.g., "index, follow" or "noindex, nofollow")
2821
+ */
2822
+ robots?: string | null;
2823
+ /**
2824
+ * Google Site Verification code
2825
+ */
2826
+ googleSiteVerification?: string | null;
2827
+ /**
2828
+ * Bing Site Verification code
2829
+ */
2830
+ bingSiteVerification?: string | null;
2831
+ /**
2832
+ * Naver Site Verification code
2833
+ */
2834
+ naverSiteVerification?: string | null;
2880
2835
  /**
2881
- * Channel through which consent was obtained (e.g. signup, checkout, import)
2836
+ * Canonical URL (if different from site URL)
2882
2837
  */
2883
- consentSource?: string | null;
2838
+ canonicalUrl?: string | null;
2884
2839
  };
2885
- /**
2886
- * Guardian consent evidence for a minor customer. May contain guardian PII.
2887
- */
2888
- guardianConsent?: {
2840
+ analytics?: {
2889
2841
  /**
2890
- * Whether guardian consent has been collected. Internal compliance marker for minor-customer handling.
2842
+ * Google Analytics ID (e.g., G-XXXXXXXXXX)
2891
2843
  */
2892
- hasGuardianConsent?: boolean | null;
2844
+ googleAnalyticsId?: string | null;
2893
2845
  /**
2894
- * Guardian name. Treat as guardian PII.
2846
+ * Google Tag Manager ID (e.g., GTM-XXXXXXX)
2895
2847
  */
2896
- guardianName?: string | null;
2848
+ googleTagManagerId?: string | null;
2897
2849
  /**
2898
- * Guardian phone number. Treat as guardian PII.
2850
+ * Facebook Pixel ID
2899
2851
  */
2900
- guardianPhone?: string | null;
2852
+ facebookPixelId?: string | null;
2901
2853
  /**
2902
- * Timestamp when guardian consent was recorded. Read-only audit evidence.
2854
+ * LinkedIn Partner ID
2903
2855
  */
2904
- guardianConsentedAt?: string | null;
2856
+ linkedInPartnerId?: string | null;
2857
+ };
2858
+ openGraph?: {
2859
+ /**
2860
+ * Open Graph title (falls back to site title)
2861
+ */
2862
+ ogTitle?: string | null;
2863
+ /**
2864
+ * Open Graph description (falls back to site description)
2865
+ */
2866
+ ogDescription?: string | null;
2867
+ /**
2868
+ * Open Graph image (1200x630 recommended)
2869
+ */
2870
+ ogImage?: (string | null) | Image;
2871
+ /**
2872
+ * Open Graph type
2873
+ */
2874
+ ogType?: ('website' | 'article' | 'product' | 'profile') | null;
2875
+ /**
2876
+ * Open Graph locale (e.g., ko_KR, en_US)
2877
+ */
2878
+ ogLocale?: string | null;
2879
+ };
2880
+ twitter?: {
2881
+ /**
2882
+ * Twitter card type
2883
+ */
2884
+ twitterCard?: ('summary' | 'summary_large_image' | 'app' | 'player') | null;
2885
+ /**
2886
+ * Twitter username for the site (e.g., @yoursite)
2887
+ */
2888
+ twitterSite?: string | null;
2889
+ /**
2890
+ * Twitter username for the content creator (e.g., @author)
2891
+ */
2892
+ twitterCreator?: string | null;
2893
+ /**
2894
+ * Twitter title (falls back to OG title or site title)
2895
+ */
2896
+ twitterTitle?: string | null;
2897
+ /**
2898
+ * Twitter description (falls back to OG or site description)
2899
+ */
2900
+ twitterDescription?: string | null;
2901
+ /**
2902
+ * Twitter card image (falls back to OG image)
2903
+ */
2904
+ twitterImage?: (string | null) | Image;
2905
+ };
2906
+ pwa?: {
2907
+ /**
2908
+ * Short name for PWA (12 characters max)
2909
+ */
2910
+ shortName?: string | null;
2911
+ /**
2912
+ * Background color for PWA splash screen
2913
+ */
2914
+ backgroundColor?: string | null;
2915
+ /**
2916
+ * PWA display mode
2917
+ */
2918
+ display?: ('fullscreen' | 'standalone' | 'minimal-ui' | 'browser') | null;
2905
2919
  };
2906
- acceptsTos?: boolean | null;
2907
- tosVersion?: string | null;
2908
- /**
2909
- * Withdrawal reason (internal)
2910
- */
2911
- withdrawReason?: string | null;
2912
- withdrawnAt?: string | null;
2913
- /**
2914
- * Legal retention deadline. Retention cleanup or manual hard-delete paths may purge after this date.
2915
- */
2916
- retainUntil?: string | null;
2917
- anonymizedAt?: string | null;
2918
- hashedPassword?: string | null;
2919
- salt?: string | null;
2920
- resetPasswordToken?: string | null;
2921
- resetPasswordExpiresAt?: string | null;
2922
- loginAttemptCount?: number | null;
2923
- lockedUntil?: string | null;
2924
- /**
2925
- * Account suspension flag. Used with password/JWT revocation paths to block sessions.
2926
- */
2927
- isSuspended?: boolean | null;
2928
- metadata?: {
2929
- [k: string]: unknown;
2930
- } | unknown[] | string | number | boolean | null;
2931
2920
  updatedAt: string;
2932
2921
  createdAt: string;
2933
2922
  deletedAt?: string | null;
2934
- collection: 'customers';
2935
2923
  }
2936
2924
  /**
2937
2925
  * This interface was referenced by `Config`'s JSON-Schema
2938
- * via the `definition` "customer-groups".
2926
+ * via the `definition` "tenant-logos".
2939
2927
  */
2940
- interface CustomerGroup {
2928
+ interface TenantLogo {
2941
2929
  id: string;
2942
- _order?: string | null;
2943
2930
  tenant?: (string | null) | Tenant;
2944
- title?: string | null;
2945
- /**
2946
- * When enabled, the slug will auto-generate from the title field on save and autosave.
2947
- */
2948
- generateSlug?: boolean | null;
2949
- slug?: string | null;
2950
- /**
2951
- * Short summary for listing/cards
2952
- */
2953
- description?: string | null;
2954
2931
  /**
2955
- * Optional #RRGGBB display color for Admin surfaces.
2932
+ * Describe the image. Used for users who cannot see it, screen readers, and search/share previews.
2956
2933
  */
2957
- color?: string | null;
2958
- image?: (string | null) | Image;
2959
- isActive?: boolean | null;
2934
+ alt?: string | null;
2960
2935
  /**
2961
- * Show this group as a customer-facing membership badge. The group collection itself remains private.
2936
+ * Low quality image placeholder
2962
2937
  */
2963
- customerVisible?: boolean | null;
2938
+ lqip?: string | null;
2939
+ palette?: {
2940
+ vibrant?: string | null;
2941
+ muted?: string | null;
2942
+ darkVibrant?: string | null;
2943
+ darkMuted?: string | null;
2944
+ lightVibrant?: string | null;
2945
+ lightMuted?: string | null;
2946
+ };
2947
+ prefix?: string | null;
2948
+ updatedAt: string;
2949
+ createdAt: string;
2950
+ deletedAt?: string | null;
2951
+ url?: string | null;
2952
+ thumbnailURL?: string | null;
2953
+ filename?: string | null;
2954
+ mimeType?: string | null;
2955
+ filesize?: number | null;
2956
+ width?: number | null;
2957
+ height?: number | null;
2958
+ focalX?: number | null;
2959
+ focalY?: number | null;
2960
+ sizes?: {
2961
+ '16'?: {
2962
+ url?: string | null;
2963
+ width?: number | null;
2964
+ height?: number | null;
2965
+ mimeType?: string | null;
2966
+ filesize?: number | null;
2967
+ filename?: string | null;
2968
+ };
2969
+ '32'?: {
2970
+ url?: string | null;
2971
+ width?: number | null;
2972
+ height?: number | null;
2973
+ mimeType?: string | null;
2974
+ filesize?: number | null;
2975
+ filename?: string | null;
2976
+ };
2977
+ '64'?: {
2978
+ url?: string | null;
2979
+ width?: number | null;
2980
+ height?: number | null;
2981
+ mimeType?: string | null;
2982
+ filesize?: number | null;
2983
+ filename?: string | null;
2984
+ };
2985
+ '128'?: {
2986
+ url?: string | null;
2987
+ width?: number | null;
2988
+ height?: number | null;
2989
+ mimeType?: string | null;
2990
+ filesize?: number | null;
2991
+ filename?: string | null;
2992
+ };
2993
+ '180'?: {
2994
+ url?: string | null;
2995
+ width?: number | null;
2996
+ height?: number | null;
2997
+ mimeType?: string | null;
2998
+ filesize?: number | null;
2999
+ filename?: string | null;
3000
+ };
3001
+ '192'?: {
3002
+ url?: string | null;
3003
+ width?: number | null;
3004
+ height?: number | null;
3005
+ mimeType?: string | null;
3006
+ filesize?: number | null;
3007
+ filename?: string | null;
3008
+ };
3009
+ '512'?: {
3010
+ url?: string | null;
3011
+ width?: number | null;
3012
+ height?: number | null;
3013
+ mimeType?: string | null;
3014
+ filesize?: number | null;
3015
+ filename?: string | null;
3016
+ };
3017
+ };
3018
+ }
3019
+ /**
3020
+ * This interface was referenced by `Config`'s JSON-Schema
3021
+ * via the `definition` "tenant-entitlements".
3022
+ */
3023
+ interface TenantEntitlement {
3024
+ id: string;
3025
+ tenant: string | Tenant;
3026
+ plan: 'free' | 'starter' | 'basic' | 'pro' | 'enterprise';
2964
3027
  /**
2965
- * Customer-facing label. Falls back to title when empty.
3028
+ * Lifecycle status for the entitlement. Only active rows participate in current plan resolution.
2966
3029
  */
2967
- publicTitle?: string | null;
2968
- publicDescription?: string | null;
2969
- publicBenefits?: {
2970
- title?: string | null;
2971
- description?: string | null;
2972
- id?: string | null;
2973
- }[] | null;
3030
+ status: 'active' | 'scheduled' | 'expired' | 'revoked';
3031
+ sourceType: 'subscription' | 'manual' | 'support' | 'promo' | 'trial' | 'enterprise_contract';
3032
+ sourceSubscription?: (string | null) | Subscription;
2974
3033
  /**
2975
- * Customer-facing badge color. Example: #2563eb
3034
+ * Tie-breaker for overlapping entitlements. Higher values win within the same source precedence.
2976
3035
  */
2977
- badgeColor?: string | null;
2978
- badgeImage?: (string | null) | Image;
3036
+ priority: number;
3037
+ startsAt: string;
2979
3038
  /**
2980
- * Customer membership display order. Lower values appear first.
2981
- */
2982
- displayOrder?: number | null;
2983
- metadata?: {
2984
- [k: string]: unknown;
2985
- } | unknown[] | string | number | boolean | null;
2986
- customers?: {
2987
- docs?: (string | Customer)[];
2988
- hasNextPage?: boolean;
2989
- totalDocs?: number;
2990
- };
3039
+ * Entitlement end date. Required by hook validation for promo / trial sources and excluded from current plan resolution after expiry.
3040
+ */
3041
+ endsAt?: string | null;
3042
+ reason?: string | null;
3043
+ grantedBy?: (string | null) | User;
3044
+ revokedAt?: string | null;
3045
+ revokedBy?: (string | null) | User;
2991
3046
  updatedAt: string;
2992
3047
  createdAt: string;
2993
3048
  deletedAt?: string | null;
2994
3049
  }
2995
3050
  /**
2996
3051
  * This interface was referenced by `Config`'s JSON-Schema
2997
- * via the `definition` "customer-addresses".
3052
+ * via the `definition` "subscriptions".
2998
3053
  */
2999
- interface CustomerAddress {
3054
+ interface Subscription {
3000
3055
  id: string;
3001
- tenant?: (string | null) | Tenant;
3002
- customer: string | Customer;
3003
- label?: string | null;
3004
- recipientName?: string | null;
3005
- phone?: string | null;
3006
- postalCode?: string | null;
3007
- /**
3008
- * Road-name address (returned by Daum/Naver postal code pickers)
3009
- */
3010
- address1?: string | null;
3011
- /**
3012
- * Detail address (unit / floor / building name)
3013
- */
3014
- address2?: string | null;
3015
- /**
3016
- * Jibun lot-based address. Stored alongside the road-name `address1` so we can fall back when 도로명 is missing or for delivery providers that require 지번.
3017
- */
3018
- jibunAddress?: string | null;
3019
- /**
3020
- * City (KR: 시/군 — e.g. "Seoul", "Busan"; non-KR: city/town).
3021
- */
3022
- city?: string | null;
3056
+ tenant: string | Tenant;
3057
+ plan: 'starter' | 'basic' | 'pro';
3058
+ billingCycle: 'monthly' | 'yearly';
3023
3059
  /**
3024
- * Administrative area (KR: 시/도 — usually folded into `city`; non-KR: state / province / region).
3060
+ * Payment amount (KRW)
3025
3061
  */
3026
- administrativeArea?: string | null;
3062
+ amount: number;
3063
+ status: 'active' | 'past_due' | 'canceled' | 'expired' | 'suspended';
3064
+ currency: 'KRW' | 'USD';
3065
+ provider: 'toss';
3066
+ currentPeriodStart?: string | null;
3067
+ currentPeriodEnd?: string | null;
3068
+ trialStartAt?: string | null;
3069
+ trialEndAt?: string | null;
3070
+ endedAt?: string | null;
3071
+ pastDueAt?: string | null;
3027
3072
  /**
3028
- * Which address form to print on the shipping label (default: road).
3073
+ * Toss billing key (AES-256-GCM encrypted)
3029
3074
  */
3030
- addressType?: ('road' | 'jibun') | null;
3075
+ billingKey?: string | null;
3031
3076
  /**
3032
- * ISO 3166-1 alpha-2 country code
3077
+ * Toss customer key (UUID)
3033
3078
  */
3034
- country?: string | null;
3035
- isDefault?: boolean | null;
3079
+ customerKey?: string | null;
3036
3080
  /**
3037
- * Delivery request preset. Pick "Other" to switch to a free-form deliveryNote.
3081
+ * Registered card info
3038
3082
  */
3039
- deliveryRequest?: ('security_office' | 'handoff_in_person' | 'call_before' | 'leave_at_door' | 'other') | null;
3083
+ cardInfo?: {
3084
+ issuerCode?: string | null;
3085
+ /**
3086
+ * Masked card number
3087
+ */
3088
+ number?: string | null;
3089
+ cardType?: string | null;
3090
+ };
3040
3091
  /**
3041
- * Free-form delivery note. Prefer the deliveryRequest preset when one of the choices fits; reserve this for actually-custom instructions.
3092
+ * Provider-owned diagnostic and audit metadata returned by the billing provider. Not a general manual-edit field.
3042
3093
  */
3043
- deliveryNote?: string | null;
3094
+ providerMetadata?: {
3095
+ [k: string]: unknown;
3096
+ } | unknown[] | string | number | boolean | null;
3097
+ cancelAtPeriodEnd?: boolean | null;
3098
+ canceledAt?: string | null;
3099
+ cancelReason?: string | null;
3100
+ retryCount?: number | null;
3101
+ graceDeadline?: string | null;
3102
+ lastPaymentError?: string | null;
3103
+ pendingPlanChange?: {
3104
+ targetPlan?: ('starter' | 'basic' | 'pro') | null;
3105
+ targetAmount?: number | null;
3106
+ effectiveAt?: string | null;
3107
+ };
3044
3108
  updatedAt: string;
3045
3109
  createdAt: string;
3046
3110
  deletedAt?: string | null;
3047
3111
  }
3048
3112
  /**
3049
3113
  * This interface was referenced by `Config`'s JSON-Schema
3050
- * via the `definition` "customer-profiles".
3114
+ * via the `definition` "tenant-purge-jobs".
3051
3115
  */
3052
- interface CustomerProfile {
3116
+ interface TenantPurgeJob {
3053
3117
  id: string;
3054
- tenant?: (string | null) | Tenant;
3055
- customer: string | Customer;
3056
- /**
3057
- * Public username shown like @01works. Store 3-30 characters without @, using lowercase ASCII letters, numbers, hyphens, or underscores, and keep it unique within the tenant.
3058
- */
3059
- handle?: string | null;
3060
- displayName?: string | null;
3061
- avatar?: (string | null) | Image;
3062
- bio?: string | null;
3063
- bioRichText?: {
3064
- root: {
3065
- type: string;
3066
- children: {
3067
- type: any;
3068
- version: number;
3069
- [k: string]: unknown;
3070
- }[];
3071
- direction: ('ltr' | 'rtl') | null;
3072
- format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
3073
- indent: number;
3074
- version: number;
3075
- };
3076
- [k: string]: unknown;
3077
- } | null;
3078
- joinedAt?: string | null;
3079
- isPublic?: boolean | null;
3080
- anonymizedAt?: string | null;
3081
- metadata?: {
3082
- [k: string]: unknown;
3083
- } | unknown[] | string | number | boolean | null;
3118
+ tenantId: string;
3119
+ status: 'pending' | 'running' | 'failed' | 'ready-to-delete';
3120
+ currentCollection?: string | null;
3121
+ deletedCount?: number | null;
3122
+ failure?: string | null;
3123
+ completedAt?: string | null;
3124
+ updatedAt: string;
3125
+ createdAt: string;
3084
3126
  }
3085
3127
  /**
3086
3128
  * This interface was referenced by `Config`'s JSON-Schema
3087
- * via the `definition` "order-items".
3129
+ * via the `definition` "billing-history".
3088
3130
  */
3089
- interface OrderItem {
3131
+ interface BillingHistory {
3090
3132
  id: string;
3091
- tenant?: (string | null) | Tenant;
3092
- order: string | Order;
3133
+ tenant: string | Tenant;
3134
+ subscription?: (string | null) | Subscription;
3135
+ type: 'payment' | 'refund' | 'plan_change';
3136
+ status: 'success' | 'failed' | 'refunded' | 'partial_refund';
3093
3137
  /**
3094
- * Quantity snapshot at order time. Used for payment and inventory calculations and not edited directly.
3138
+ * Amount (KRW)
3095
3139
  */
3096
- product: string | Product;
3097
- variant?: (string | null) | ProductVariant;
3098
- quantity: number;
3140
+ amount: number;
3099
3141
  /**
3100
- * Unit-price snapshot at order time. Later product price changes do not rewrite it.
3142
+ * Plan at time of payment
3101
3143
  */
3102
- unitPrice: number;
3103
- variantTitle?: string | null;
3104
- sku?: string | null;
3105
- compareAtPrice?: number | null;
3106
- weight?: number | null;
3107
- requiresShipping?: boolean | null;
3144
+ plan: 'starter' | 'basic' | 'pro';
3145
+ provider: 'toss';
3146
+ currency: 'KRW' | 'USD';
3147
+ billingCycle?: ('monthly' | 'yearly') | null;
3148
+ periodStart?: string | null;
3149
+ periodEnd?: string | null;
3108
3150
  /**
3109
- * Total-price snapshot at order time, preserved from unitPrice × quantity.
3151
+ * Unique order number
3110
3152
  */
3111
- totalPrice: number;
3112
- productTitle?: string | null;
3153
+ invoiceNumber: string;
3154
+ orderName?: string | null;
3113
3155
  /**
3114
- * Option combination snapshot at order time. Later variant/option changes do not rewrite it.
3156
+ * Toss payment key
3115
3157
  */
3116
- optionSelection?: {
3158
+ paymentKey?: string | null;
3159
+ /**
3160
+ * Full Toss API response
3161
+ */
3162
+ tossResponse?: {
3117
3163
  [k: string]: unknown;
3118
3164
  } | unknown[] | string | number | boolean | null;
3165
+ errorMessage?: string | null;
3119
3166
  /**
3120
- * Tax rate at time of order (%)
3167
+ * Original billing record for retry
3121
3168
  */
3122
- taxRate?: number | null;
3169
+ retryOf?: (string | null) | BillingHistory;
3170
+ updatedAt: string;
3171
+ createdAt: string;
3172
+ deletedAt?: string | null;
3173
+ }
3174
+ /**
3175
+ * This interface was referenced by `Config`'s JSON-Schema
3176
+ * via the `definition` "plans".
3177
+ */
3178
+ interface Plan {
3179
+ id: string;
3123
3180
  /**
3124
- * Currency at time of order (ISO-4217)
3181
+ * Plan identifier (free, starter, basic, pro, enterprise)
3125
3182
  */
3126
- currency?: string | null;
3183
+ key: string;
3127
3184
  /**
3128
- * Snapshot of the discount amount allocated to this line at order time (minor units).
3185
+ * Plan display name
3129
3186
  */
3130
- discountAllocation?: number | null;
3187
+ name: string;
3131
3188
  /**
3132
- * Per-unit price snapshot after discount allocation. round(discountedTotalPrice / quantity).
3189
+ * Reference-only feature list; enforced elsewhere.
3133
3190
  */
3134
- discountedUnitPrice?: number | null;
3191
+ featuresAllowed?: ('ecommerce' | 'customers' | 'playlists' | 'galleries' | 'links' | 'forms' | 'articles' | 'documents' | 'canvas' | 'videos' | 'live-streaming' | 'community' | 'events')[] | null;
3135
3192
  /**
3136
- * Line total snapshot after discount allocation at order time (totalPrice - discountAllocation).
3193
+ * Reference-only quotas such as storageBytes; enforced by entitlement and usage policy elsewhere.
3137
3194
  */
3138
- discountedTotalPrice?: number | null;
3195
+ quotas?: {
3196
+ [k: string]: unknown;
3197
+ } | unknown[] | string | number | boolean | null;
3139
3198
  updatedAt: string;
3140
3199
  createdAt: string;
3141
3200
  deletedAt?: string | null;
3142
3201
  }
3143
3202
  /**
3144
3203
  * This interface was referenced by `Config`'s JSON-Schema
3145
- * via the `definition` "transactions".
3204
+ * via the `definition` "tenant-web-analytics-config".
3146
3205
  */
3147
- interface Transaction {
3206
+ interface TenantWebAnalyticsConfig {
3148
3207
  id: string;
3149
3208
  tenant?: (string | null) | Tenant;
3150
- _title?: string | null;
3151
- type: 'payment' | 'refund';
3152
- status: 'pending' | 'paid' | 'failed' | 'canceled' | 'refunded';
3153
- order: string | Order;
3154
- amount?: number | null;
3155
- /**
3156
- * Payment method snapshot returned by the provider. Not edited directly.
3157
- */
3158
- paymentMethod?: string | null;
3209
+ enabled?: boolean | null;
3159
3210
  /**
3160
- * Installment months (0 = lump sum)
3211
+ * Domains allowed to send analytics events. If empty, browser analytics is blocked.
3161
3212
  */
3162
- installmentMonths?: number | null;
3163
- approvedAt?: string | null;
3164
- receiptUrl?: string | null;
3165
- pgPaymentId?: string | null;
3166
- pgOrderId?: string | null;
3167
- providerEventId?: string | null;
3168
- providerStatus?: string | null;
3169
- confirmedAmount?: number | null;
3170
- confirmedCurrency?: string | null;
3171
- confirmedAt?: string | null;
3172
- confirmationSource?: ('provider_webhook' | 'provider_lookup' | 'provider_api_confirm' | 'manual_server') | null;
3173
- cashReceipt?: {
3174
- issuanceType?: ('none' | 'personal' | 'business') | null;
3175
- /**
3176
- * Personal: phone or cash receipt card number / Business: business registration number
3177
- */
3178
- registrationNumber?: string | null;
3179
- issueNumber?: string | null;
3180
- issuedAt?: string | null;
3181
- };
3182
- cardInfo?: {
3183
- brand?: string | null;
3184
- last4?: string | null;
3185
- expMonth?: number | null;
3186
- expYear?: number | null;
3187
- issuerCode?: string | null;
3188
- type?: ('credit' | 'debit' | 'gift') | null;
3189
- owner?: string | null;
3190
- };
3191
- failureCode?: string | null;
3192
- failureMessage?: string | null;
3213
+ allowedOrigins?: {
3214
+ origin: string;
3215
+ id?: string | null;
3216
+ }[] | null;
3193
3217
  /**
3194
- * Payment gateway (e.g. toss, stripe)
3218
+ * Timezone used to group daily analytics. Once data starts coming in, this is locked and cannot be changed.
3195
3219
  */
3196
- pgProvider?: string | null;
3220
+ timezone: string;
3197
3221
  /**
3198
- * Legal retention deadline (5 years, Electronic Financial Transactions Act)
3222
+ * Automatically locked once the first analytics record is saved. Contact support to unlock.
3199
3223
  */
3200
- retainUntil?: string | null;
3201
- metadata?: {
3202
- [k: string]: unknown;
3203
- } | unknown[] | string | number | boolean | null;
3224
+ tzLocked?: boolean | null;
3204
3225
  updatedAt: string;
3205
3226
  createdAt: string;
3206
3227
  deletedAt?: string | null;
3207
3228
  }
3208
3229
  /**
3209
3230
  * This interface was referenced by `Config`'s JSON-Schema
3210
- * via the `definition` "fulfillments".
3231
+ * via the `definition` "tenant-analytics-daily".
3211
3232
  */
3212
- interface Fulfillment {
3233
+ interface TenantAnalyticsDaily {
3213
3234
  id: string;
3214
3235
  tenant?: (string | null) | Tenant;
3215
- order: string | Order;
3216
- status: 'pending' | 'packed' | 'shipped' | 'delivered' | 'failed';
3217
3236
  /**
3218
- * Carrier name (e.g. CJ Logistics, FedEx)
3237
+ * YYYY-MM-DD (UTC)
3219
3238
  */
3220
- carrier?: string | null;
3239
+ date: string;
3240
+ pageviews: number;
3221
3241
  /**
3222
- * Carrier tracking number. Used as input for the derived trackingUrl.
3242
+ * Estimated via HyperLogLog (±0.81%)
3223
3243
  */
3224
- trackingNumber?: string | null;
3244
+ visitors: number;
3245
+ topPages?: {
3246
+ pathname: string;
3247
+ views: number;
3248
+ id?: string | null;
3249
+ }[] | null;
3250
+ topReferrers?: {
3251
+ source: string;
3252
+ views: number;
3253
+ id?: string | null;
3254
+ }[] | null;
3255
+ topEvents?: {
3256
+ name: string;
3257
+ count: number;
3258
+ id?: string | null;
3259
+ }[] | null;
3260
+ eventsDropped?: {
3261
+ cardinality?: number | null;
3262
+ schema?: number | null;
3263
+ late?: number | null;
3264
+ origin?: number | null;
3265
+ key?: number | null;
3266
+ rate?: number | null;
3267
+ disabled?: number | null;
3268
+ };
3269
+ snapshottedAt?: string | null;
3225
3270
  /**
3226
- * Tracking URL (auto-derived from carrier + trackingNumber)
3271
+ * Tenant timezone used to bucket this snapshot's date.
3227
3272
  */
3228
- trackingUrl?: string | null;
3229
- packedAt?: string | null;
3230
- shippedAt?: string | null;
3231
- deliveredAt?: string | null;
3232
- items?: {
3233
- docs?: (string | FulfillmentItem)[];
3234
- hasNextPage?: boolean;
3235
- totalDocs?: number;
3236
- };
3273
+ bucketTz: string;
3237
3274
  /**
3238
- * Internal fulfillment note. Not shown directly to customers.
3275
+ * Deterministic aggregate schema shape hash for mismatch detection.
3239
3276
  */
3240
- adminNotes?: string | null;
3241
- metadata?: {
3242
- [k: string]: unknown;
3243
- } | unknown[] | string | number | boolean | null;
3277
+ schemaShape: string;
3278
+ /**
3279
+ * Per-event dimension/page/referrer aggregates. Populated by snapshot cron when registered events have Redis data.
3280
+ */
3281
+ eventDetails?: {
3282
+ eventName: string;
3283
+ count?: number | null;
3284
+ /**
3285
+ * Deterministic schema shape hash for this event detail row.
3286
+ */
3287
+ schemaShape?: string | null;
3288
+ dimensions?: {
3289
+ dimension: string;
3290
+ values?: {
3291
+ value: string;
3292
+ count: number;
3293
+ id?: string | null;
3294
+ }[] | null;
3295
+ id?: string | null;
3296
+ }[] | null;
3297
+ pages?: {
3298
+ pathname: string;
3299
+ count: number;
3300
+ id?: string | null;
3301
+ }[] | null;
3302
+ referrers?: {
3303
+ source: string;
3304
+ count: number;
3305
+ id?: string | null;
3306
+ }[] | null;
3307
+ id?: string | null;
3308
+ }[] | null;
3309
+ /**
3310
+ * MCP tool usage aggregate. Populated by snapshot cron from daily Redis keys.
3311
+ */
3312
+ mcpUsage?: {
3313
+ toolCalls?: number | null;
3314
+ sessions?: number | null;
3315
+ convertedSessions?: number | null;
3316
+ conversionRate?: number | null;
3317
+ successfulWrites?: number | null;
3318
+ isPartial?: boolean | null;
3319
+ topTools?: {
3320
+ name: string;
3321
+ count: number;
3322
+ readOnly?: boolean | null;
3323
+ id?: string | null;
3324
+ }[] | null;
3325
+ transports?: {
3326
+ name: string;
3327
+ count: number;
3328
+ id?: string | null;
3329
+ }[] | null;
3330
+ httpDurationMs?: {
3331
+ p50?: number | null;
3332
+ p99?: number | null;
3333
+ buckets?: {
3334
+ bucket: string;
3335
+ label: string;
3336
+ count: number;
3337
+ id?: string | null;
3338
+ }[] | null;
3339
+ };
3340
+ };
3244
3341
  updatedAt: string;
3245
3342
  createdAt: string;
3246
- deletedAt?: string | null;
3247
3343
  }
3248
3344
  /**
3249
3345
  * This interface was referenced by `Config`'s JSON-Schema
3250
- * via the `definition` "fulfillment-items".
3346
+ * via the `definition` "analytics-event-schemas".
3251
3347
  */
3252
- interface FulfillmentItem {
3348
+ interface AnalyticsEventSchema {
3253
3349
  id: string;
3254
3350
  tenant?: (string | null) | Tenant;
3255
- fulfillment: string | Fulfillment;
3256
- orderItem: string | OrderItem;
3257
- quantity: number;
3351
+ /**
3352
+ * Valid event name pattern.
3353
+ */
3354
+ eventName: string;
3355
+ enabled: boolean;
3356
+ dimensions?: {
3357
+ key: string;
3358
+ type: 'enum' | 'boolean';
3359
+ /**
3360
+ * Comma-separated values. Required when type=enum, optional otherwise. Boolean auto-derives {true,false}. Max 20 per key.
3361
+ */
3362
+ allowedValues?: string | null;
3363
+ description?: string | null;
3364
+ id?: string | null;
3365
+ }[] | null;
3366
+ createdBy?: (string | null) | User;
3367
+ updatedBy?: (string | null) | User;
3258
3368
  updatedAt: string;
3259
3369
  createdAt: string;
3260
3370
  deletedAt?: string | null;
3261
3371
  }
3262
3372
  /**
3263
3373
  * This interface was referenced by `Config`'s JSON-Schema
3264
- * via the `definition` "returns".
3374
+ * via the `definition` "api-usage".
3265
3375
  */
3266
- interface Return {
3376
+ interface ApiUsage {
3267
3377
  id: string;
3268
3378
  tenant?: (string | null) | Tenant;
3269
- returnNumber?: string | null;
3270
- order: string | Order;
3271
- type: 'refund' | 'exchange';
3272
3379
  /**
3273
- * New order created for exchange
3380
+ * YYYY-MM format
3274
3381
  */
3275
- exchangeOrder?: (string | null) | Order;
3276
- status: 'requested' | 'processing' | 'approved' | 'rejected' | 'completed';
3382
+ month: string;
3383
+ apiCallCount: number;
3384
+ plan: 'free' | 'starter' | 'basic' | 'pro' | 'enterprise';
3277
3385
  /**
3278
- * Reason category for the return or refund request. Used for reporting and operations.
3386
+ * -1 means unlimited
3279
3387
  */
3280
- reason?: ('change_of_mind' | 'defective' | 'wrong_delivery' | 'damaged' | 'other') | null;
3388
+ apiCallLimit: number;
3281
3389
  /**
3282
- * Detailed return reason
3390
+ * Storage usage in bytes
3283
3391
  */
3284
- reasonDetail?: string | null;
3285
- items?: {
3286
- docs?: (string | ReturnItem)[];
3287
- hasNextPage?: boolean;
3288
- totalDocs?: number;
3289
- };
3392
+ storageUsedBytes?: number | null;
3290
3393
  /**
3291
- * Internal return-processing note. Not shown directly to customers.
3394
+ * Storage limit in bytes (-1 means unlimited)
3292
3395
  */
3293
- adminNotes?: string | null;
3294
- completedAt?: string | null;
3396
+ storageLimitBytes?: number | null;
3295
3397
  /**
3296
- * Refund receipt URL
3398
+ * Total document count across all tenant-scoped collections
3297
3399
  */
3298
- refundReceiptUrl?: string | null;
3299
- refundAmount: number;
3400
+ documentCount?: number | null;
3300
3401
  /**
3301
- * Return shipping fee deducted from refundAmount
3402
+ * Number of video documents
3302
3403
  */
3303
- returnShippingFee?: number | null;
3404
+ videoCount?: number | null;
3304
3405
  /**
3305
- * Exchange balance (positive: extra charge, negative: extra refund)
3406
+ * Weighted video minutes used (duration × quality multiplier)
3306
3407
  */
3307
- exchangeDifference?: number | null;
3308
- metadata?: {
3309
- [k: string]: unknown;
3310
- } | unknown[] | string | number | boolean | null;
3311
- updatedAt: string;
3312
- createdAt: string;
3313
- deletedAt?: string | null;
3314
- }
3315
- /**
3316
- * This interface was referenced by `Config`'s JSON-Schema
3317
- * via the `definition` "return-items".
3318
- */
3319
- interface ReturnItem {
3320
- id: string;
3321
- tenant?: (string | null) | Tenant;
3322
- return: string | Return;
3323
- order: string | Order;
3324
- status: 'requested' | 'processing' | 'approved' | 'rejected' | 'completed';
3325
- orderItem: string | OrderItem;
3326
- product: string | Product;
3327
- variant?: (string | null) | ProductVariant;
3328
- quantity: number;
3329
- restockAction: 'return_to_stock' | 'discard';
3408
+ videoMinutesUsed?: number | null;
3330
3409
  /**
3331
- * Restocking fee for this line (deducted from line refund)
3410
+ * Monthly viewer watch time from Mux Data
3332
3411
  */
3333
- restockingFee?: number | null;
3334
- productTitle?: string | null;
3412
+ deliveryMinutesUsed?: number | null;
3413
+ /**
3414
+ * AI generation count
3415
+ */
3416
+ aiGenerationCount?: number | null;
3417
+ /**
3418
+ * Timestamp when the usage snapshot cron calculated this monthly aggregate.
3419
+ */
3420
+ snapshottedAt?: string | null;
3335
3421
  updatedAt: string;
3336
3422
  createdAt: string;
3337
- deletedAt?: string | null;
3338
3423
  }
3339
3424
  /**
3340
3425
  * This interface was referenced by `Config`'s JSON-Schema
@@ -6176,6 +6261,40 @@ interface EmailLogsSelect<T extends boolean = true> {
6176
6261
  clickedAt?: T;
6177
6262
  bouncedAt?: T;
6178
6263
  recipientConsent?: T;
6264
+ commerceNotification?: T | {
6265
+ event?: T;
6266
+ intent?: T;
6267
+ dedupeKey?: T;
6268
+ order?: T;
6269
+ fulfillment?: T;
6270
+ return?: T;
6271
+ customer?: T;
6272
+ };
6273
+ updatedAt?: T;
6274
+ createdAt?: T;
6275
+ }
6276
+ /**
6277
+ * This interface was referenced by `Config`'s JSON-Schema
6278
+ * via the `definition` "commerce-notification-intents_select".
6279
+ */
6280
+ interface CommerceNotificationIntentsSelect<T extends boolean = true> {
6281
+ tenant?: T;
6282
+ dedupeKey?: T;
6283
+ event?: T;
6284
+ status?: T;
6285
+ recipientEmail?: T;
6286
+ locale?: T;
6287
+ payload?: T;
6288
+ order?: T;
6289
+ fulfillment?: T;
6290
+ return?: T;
6291
+ customer?: T;
6292
+ emailLog?: T;
6293
+ attempts?: T;
6294
+ nextAttemptAt?: T;
6295
+ lockedAt?: T;
6296
+ processedAt?: T;
6297
+ lastError?: T;
6179
6298
  updatedAt?: T;
6180
6299
  createdAt?: T;
6181
6300
  }
@@ -6296,6 +6415,13 @@ interface TenantsSelect<T extends boolean = true> {
6296
6415
  origin?: T;
6297
6416
  id?: T;
6298
6417
  };
6418
+ commerceNotifications?: T | {
6419
+ orderPaid?: T;
6420
+ fulfillmentShipped?: T;
6421
+ orderDelivered?: T;
6422
+ returnRequested?: T;
6423
+ returnCompleted?: T;
6424
+ };
6299
6425
  members?: T;
6300
6426
  updatedAt?: T;
6301
6427
  createdAt?: T;