sinfactura-types 1.10.351 → 1.10.352
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/marketing.js +38 -1
- package/dist/marketing.d.ts +90 -0
- package/dist/marketing.js +37 -0
- package/package.json +1 -1
package/dist/cjs/marketing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ABANDONED_CART_SNAPSHOT_NAME_MAX = exports.ABANDONED_CART_SNAPSHOT_MAX_LINES = exports.CART_APPLICABLE_PROMOTION_TYPES = exports.PROMOTION_TYPES = exports.AUTOMATION_RULE_STATUSES = exports.AUTOMATION_SEND_STATUSES = exports.ATTRIBUTION_WINDOW_HOURS = exports.RFM_SEGMENT_LABELS = exports.AUTOMATION_TRIGGERS = void 0;
|
|
3
|
+
exports.MARKETING_COPY_VARIANTS_MAX = exports.MARKETING_COPY_VARIANTS_MIN = exports.MARKETING_COPY_FACT_MAX_CHARS = exports.MARKETING_COPY_FACTS_MAX = exports.MARKETING_COPY_FACTS_MIN = exports.MARKETING_COPY_GOAL_MAX_CHARS = exports.ABANDONED_CART_SNAPSHOT_NAME_MAX = exports.ABANDONED_CART_SNAPSHOT_MAX_LINES = exports.CART_APPLICABLE_PROMOTION_TYPES = exports.PROMOTION_TYPES = exports.AUTOMATION_RULE_STATUSES = exports.AUTOMATION_SEND_STATUSES = exports.ATTRIBUTION_WINDOW_HOURS = exports.RFM_SEGMENT_LABELS = exports.AUTOMATION_TRIGGERS = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* The {@link AutomationTrigger} vocabulary as a RUNTIME value, so the api's Zod
|
|
6
6
|
* enum, the configuration screen's picker and the published union all derive
|
|
@@ -123,3 +123,40 @@ exports.ABANDONED_CART_SNAPSHOT_MAX_LINES = 5;
|
|
|
123
123
|
* stored, not of what one renderer happens to do with it.
|
|
124
124
|
*/
|
|
125
125
|
exports.ABANDONED_CART_SNAPSHOT_NAME_MAX = 80;
|
|
126
|
+
/*
|
|
127
|
+
* The `POST /marketing/copy` REQUEST bounds — published so the api's Zod schema,
|
|
128
|
+
* the operator surface's own form validation and this package's
|
|
129
|
+
* {@link MarketingCopyRequest} docblock all read ONE number. The api imports
|
|
130
|
+
* these and derives its `.min()`/`.max()` from them; a surface that restated
|
|
131
|
+
* them would drift, and the tell is a form that accepts a request the endpoint
|
|
132
|
+
* 400s with nothing on screen explaining which bound was crossed.
|
|
133
|
+
*
|
|
134
|
+
* ⚠️ These bound the REQUEST. The generated copy's own caps — how long a
|
|
135
|
+
* subject or a body may be — are a different decision and stay under
|
|
136
|
+
* `stacks/lambdas/marketingCopy/`, unpublished, because no client sends them
|
|
137
|
+
* and nothing on the wire is measured against them.
|
|
138
|
+
*/
|
|
139
|
+
/** Longest `goal` a request may carry. Non-empty is the other half of the bound. */
|
|
140
|
+
exports.MARKETING_COPY_GOAL_MAX_CHARS = 200;
|
|
141
|
+
/**
|
|
142
|
+
* Fewest grounding facts a request may carry.
|
|
143
|
+
*
|
|
144
|
+
* ⚠️ ONE, not zero, and the minimum is load-bearing: a claim must appear
|
|
145
|
+
* VERBATIM in these facts to survive the output belt, so a request with none
|
|
146
|
+
* can only produce copy that asserts nothing.
|
|
147
|
+
*/
|
|
148
|
+
exports.MARKETING_COPY_FACTS_MIN = 1;
|
|
149
|
+
/** Most grounding facts a request may carry. */
|
|
150
|
+
exports.MARKETING_COPY_FACTS_MAX = 10;
|
|
151
|
+
/** Longest ONE fact may be. Non-empty is the other half of the bound. */
|
|
152
|
+
exports.MARKETING_COPY_FACT_MAX_CHARS = 200;
|
|
153
|
+
/** Fewest variants a request may ask for. */
|
|
154
|
+
exports.MARKETING_COPY_VARIANTS_MIN = 1;
|
|
155
|
+
/**
|
|
156
|
+
* Most variants a request may ask for.
|
|
157
|
+
*
|
|
158
|
+
* ⚠️ NOT a cost bound — every variant rides the same single model call, so
|
|
159
|
+
* raising it does not buy more calls. It bounds how much the one call is asked
|
|
160
|
+
* to produce at once, which is a quality question.
|
|
161
|
+
*/
|
|
162
|
+
exports.MARKETING_COPY_VARIANTS_MAX = 3;
|
package/dist/marketing.d.ts
CHANGED
|
@@ -882,6 +882,72 @@ declare global {
|
|
|
882
882
|
type MarketingCopyChannel = 'email';
|
|
883
883
|
/** Register of the generated copy. es-AR voseo regardless of tone. */
|
|
884
884
|
type MarketingCopyTone = 'neutral' | 'friendly' | 'urgent';
|
|
885
|
+
/**
|
|
886
|
+
* The body `POST /marketing/copy` accepts — what a CLIENT may SEND, which is
|
|
887
|
+
* why three of its six fields are optional: each carries a SERVER-side default
|
|
888
|
+
* (`tone` → `'neutral'`, `variants` → `2`, `regenerate` → `false`), so the
|
|
889
|
+
* parsed request the handler reads has all six and this shape does not.
|
|
890
|
+
*
|
|
891
|
+
* ⚠️ **The endpoint is `.strict()`, and that IS the PII boundary** (Ley
|
|
892
|
+
* 25.326). There is no field here that could carry a customer name, address,
|
|
893
|
+
* mail or phone, and the strict object is what makes adding one a 400 rather
|
|
894
|
+
* than a silent pass-through into a prompt. A consumer must not send an extra
|
|
895
|
+
* key "for later" — it is refused, not ignored.
|
|
896
|
+
*
|
|
897
|
+
* ⚠️ Every bound below is one of the `MARKETING_COPY_*` constants in this
|
|
898
|
+
* module, and the api's Zod schema DERIVES its `.min()`/`.max()` from those
|
|
899
|
+
* same constants rather than restating the numbers — so a client that
|
|
900
|
+
* validates against them cannot be refused by a bound it could not see.
|
|
901
|
+
*
|
|
902
|
+
* ⚠️ The tie to that schema is the compile-time
|
|
903
|
+
* `AssertMarketingCopyRequestMatchesSchema` beside it
|
|
904
|
+
* (`stacks/lambdas/marketingCopy/schema.ts`) — the same pattern
|
|
905
|
+
* `TenantRegisterInput` uses, and the reason a field added to one side cannot
|
|
906
|
+
* quietly go missing from the other.
|
|
907
|
+
*/
|
|
908
|
+
interface MarketingCopyRequest {
|
|
909
|
+
channel: MarketingCopyChannel;
|
|
910
|
+
/** Absent means `'neutral'`. */
|
|
911
|
+
tone?: MarketingCopyTone;
|
|
912
|
+
/**
|
|
913
|
+
* What the campaign is FOR, in the tenant's own words — INSTRUCTIONS, never
|
|
914
|
+
* facts. Non-empty, at most {@link MARKETING_COPY_GOAL_MAX_CHARS} characters.
|
|
915
|
+
*
|
|
916
|
+
* ⚠️ Nothing here is citable evidence: a claim the copy makes has to come
|
|
917
|
+
* from {@link MarketingCopyRequest.facts}, so a discount written only into
|
|
918
|
+
* the goal is dropped from the output rather than asserted.
|
|
919
|
+
*/
|
|
920
|
+
goal: string;
|
|
921
|
+
/**
|
|
922
|
+
* The grounding source: the promo facts the copy MAY assert, each of which
|
|
923
|
+
* the claim belt then requires VERBATIM. Between
|
|
924
|
+
* {@link MARKETING_COPY_FACTS_MIN} and {@link MARKETING_COPY_FACTS_MAX}
|
|
925
|
+
* entries, each non-empty and at most
|
|
926
|
+
* {@link MARKETING_COPY_FACT_MAX_CHARS} characters.
|
|
927
|
+
*
|
|
928
|
+
* ⚠️ At least one is REQUIRED, and that is the anti-hallucination posture
|
|
929
|
+
* rather than a formality: with no facts there is nothing the copy may
|
|
930
|
+
* truthfully assert, so every claim would be dropped.
|
|
931
|
+
*/
|
|
932
|
+
facts: string[];
|
|
933
|
+
/**
|
|
934
|
+
* How many alternatives to generate — an integer between
|
|
935
|
+
* {@link MARKETING_COPY_VARIANTS_MIN} and
|
|
936
|
+
* {@link MARKETING_COPY_VARIANTS_MAX}. Absent means 2.
|
|
937
|
+
*
|
|
938
|
+
* ⚠️ Variants ride ONE model call, so asking for more never buys more calls
|
|
939
|
+
* — which is why the cap is a quality bound rather than a cost one.
|
|
940
|
+
*/
|
|
941
|
+
variants?: number;
|
|
942
|
+
/**
|
|
943
|
+
* Always bypasses the response-cache LOOKUP; the write still happens, so the
|
|
944
|
+
* next ordinary request hits. Absent means `false`.
|
|
945
|
+
*
|
|
946
|
+
* ⚠️ It is what makes a request SPEND — a cache hit costs nothing at all, so
|
|
947
|
+
* a surface that sets this on every call bills the tenant for every click.
|
|
948
|
+
*/
|
|
949
|
+
regenerate?: boolean;
|
|
950
|
+
}
|
|
885
951
|
interface MarketingCopySuggestion {
|
|
886
952
|
/**
|
|
887
953
|
* SEGMENT-WIDE copy, never personalised text — and never a placeholder
|
|
@@ -1019,4 +1085,28 @@ export declare const ABANDONED_CART_SNAPSHOT_MAX_LINES = 5;
|
|
|
1019
1085
|
* stored, not of what one renderer happens to do with it.
|
|
1020
1086
|
*/
|
|
1021
1087
|
export declare const ABANDONED_CART_SNAPSHOT_NAME_MAX = 80;
|
|
1088
|
+
/** Longest `goal` a request may carry. Non-empty is the other half of the bound. */
|
|
1089
|
+
export declare const MARKETING_COPY_GOAL_MAX_CHARS = 200;
|
|
1090
|
+
/**
|
|
1091
|
+
* Fewest grounding facts a request may carry.
|
|
1092
|
+
*
|
|
1093
|
+
* ⚠️ ONE, not zero, and the minimum is load-bearing: a claim must appear
|
|
1094
|
+
* VERBATIM in these facts to survive the output belt, so a request with none
|
|
1095
|
+
* can only produce copy that asserts nothing.
|
|
1096
|
+
*/
|
|
1097
|
+
export declare const MARKETING_COPY_FACTS_MIN = 1;
|
|
1098
|
+
/** Most grounding facts a request may carry. */
|
|
1099
|
+
export declare const MARKETING_COPY_FACTS_MAX = 10;
|
|
1100
|
+
/** Longest ONE fact may be. Non-empty is the other half of the bound. */
|
|
1101
|
+
export declare const MARKETING_COPY_FACT_MAX_CHARS = 200;
|
|
1102
|
+
/** Fewest variants a request may ask for. */
|
|
1103
|
+
export declare const MARKETING_COPY_VARIANTS_MIN = 1;
|
|
1104
|
+
/**
|
|
1105
|
+
* Most variants a request may ask for.
|
|
1106
|
+
*
|
|
1107
|
+
* ⚠️ NOT a cost bound — every variant rides the same single model call, so
|
|
1108
|
+
* raising it does not buy more calls. It bounds how much the one call is asked
|
|
1109
|
+
* to produce at once, which is a quality question.
|
|
1110
|
+
*/
|
|
1111
|
+
export declare const MARKETING_COPY_VARIANTS_MAX = 3;
|
|
1022
1112
|
export {};
|
package/dist/marketing.js
CHANGED
|
@@ -120,3 +120,40 @@ export const ABANDONED_CART_SNAPSHOT_MAX_LINES = 5;
|
|
|
120
120
|
* stored, not of what one renderer happens to do with it.
|
|
121
121
|
*/
|
|
122
122
|
export const ABANDONED_CART_SNAPSHOT_NAME_MAX = 80;
|
|
123
|
+
/*
|
|
124
|
+
* The `POST /marketing/copy` REQUEST bounds — published so the api's Zod schema,
|
|
125
|
+
* the operator surface's own form validation and this package's
|
|
126
|
+
* {@link MarketingCopyRequest} docblock all read ONE number. The api imports
|
|
127
|
+
* these and derives its `.min()`/`.max()` from them; a surface that restated
|
|
128
|
+
* them would drift, and the tell is a form that accepts a request the endpoint
|
|
129
|
+
* 400s with nothing on screen explaining which bound was crossed.
|
|
130
|
+
*
|
|
131
|
+
* ⚠️ These bound the REQUEST. The generated copy's own caps — how long a
|
|
132
|
+
* subject or a body may be — are a different decision and stay under
|
|
133
|
+
* `stacks/lambdas/marketingCopy/`, unpublished, because no client sends them
|
|
134
|
+
* and nothing on the wire is measured against them.
|
|
135
|
+
*/
|
|
136
|
+
/** Longest `goal` a request may carry. Non-empty is the other half of the bound. */
|
|
137
|
+
export const MARKETING_COPY_GOAL_MAX_CHARS = 200;
|
|
138
|
+
/**
|
|
139
|
+
* Fewest grounding facts a request may carry.
|
|
140
|
+
*
|
|
141
|
+
* ⚠️ ONE, not zero, and the minimum is load-bearing: a claim must appear
|
|
142
|
+
* VERBATIM in these facts to survive the output belt, so a request with none
|
|
143
|
+
* can only produce copy that asserts nothing.
|
|
144
|
+
*/
|
|
145
|
+
export const MARKETING_COPY_FACTS_MIN = 1;
|
|
146
|
+
/** Most grounding facts a request may carry. */
|
|
147
|
+
export const MARKETING_COPY_FACTS_MAX = 10;
|
|
148
|
+
/** Longest ONE fact may be. Non-empty is the other half of the bound. */
|
|
149
|
+
export const MARKETING_COPY_FACT_MAX_CHARS = 200;
|
|
150
|
+
/** Fewest variants a request may ask for. */
|
|
151
|
+
export const MARKETING_COPY_VARIANTS_MIN = 1;
|
|
152
|
+
/**
|
|
153
|
+
* Most variants a request may ask for.
|
|
154
|
+
*
|
|
155
|
+
* ⚠️ NOT a cost bound — every variant rides the same single model call, so
|
|
156
|
+
* raising it does not buy more calls. It bounds how much the one call is asked
|
|
157
|
+
* to produce at once, which is a quality question.
|
|
158
|
+
*/
|
|
159
|
+
export const MARKETING_COPY_VARIANTS_MAX = 3;
|