sinfactura-types 1.10.658 → 1.10.660

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/auth.d.ts CHANGED
@@ -894,8 +894,8 @@ declare global {
894
894
  * never arrive: a code `social-bridge-mint` issued with `purpose: 'link'` on
895
895
  * the store's slug host, and the SAME `state` that mint was sent. Single
896
896
  * use, 60 s, redeemable only from its `returnOrigin` at its own store and
897
- * for the session's store; any failure, a missing or different `state`
898
- * included, is `401 BRIDGE_CODE_INVALID` (see
897
+ * for the session's store; any failure, a missing or different `state` or a
898
+ * `sign-in` or `register` code included, is `401 BRIDGE_CODE_INVALID` (see
899
899
  * {@link SOCIAL_BRIDGE_ERROR_CODES}) and spends the code.
900
900
  */
901
901
  type CustomerLinkSignInMethodRequest = {
@@ -909,12 +909,70 @@ declare global {
909
909
  state: string;
910
910
  accessToken?: never;
911
911
  });
912
+ /**
913
+ * `POST /auth { mode: 'register-social' }` on the STOREFRONT host — create a
914
+ * CUSTOMER from a verified social identity instead of an email and password.
915
+ * Field for field what the `register-social` schema accepts as INPUT, beside
916
+ * `mode`, exactly as {@link CustomerRegisterInput} is for `mode: 'register'`.
917
+ * The tie is compile-time: `AssertCustomerSocialRegisterInputMatchesSchema`,
918
+ * declared beside that schema (`stacks/web/lambdas/auth/registerSocial.ts`).
919
+ *
920
+ * The profile is {@link CustomerRegisterInput} without `email` and `password`
921
+ * — derived from it, so the two legs cannot drift: `fullName`, `cuit` and
922
+ * `phone` are REQUIRED with the same bounds, and the optional address and
923
+ * `afip` fields are identical.
924
+ *
925
+ * The identity arrives as EXACTLY ONE of the two — both, or neither, is the
926
+ * ordinary `400` validation refusal, as on {@link CustomerLinkSignInMethodRequest}:
927
+ * - `accessToken` — a Firebase ID token, exactly as {@link Social.accessToken},
928
+ * on an origin Firebase authorises (the platform slug host).
929
+ * - `bridgeCode` + `state` — on a CUSTOM domain: a code `social-bridge-mint`
930
+ * issued with `purpose: 'register'` on the store's slug host, and the SAME
931
+ * `state` that mint was sent. A `sign-in` or `link` code, or any other
932
+ * bridge failure, is `401 BRIDGE_CODE_INVALID` (see
933
+ * {@link SOCIAL_BRIDGE_ERROR_CODES}) and spends the code — but a
934
+ * `bridgeCode` without `state` is the `400` validation refusal, unspent.
935
+ *
936
+ * ⚠️ There is NO `email` here, deliberately. The account's email is ALWAYS the
937
+ * verified token's — an `email` in the body is stripped, never compared and
938
+ * never stored. For an Apple private-relay identity that is the relay address.
939
+ * An identity whose provider has not verified its email, or that carries none,
940
+ * is `401 SIGN_IN_IDENTITY_UNVERIFIED` and creates nothing.
941
+ *
942
+ * ⚠️ There is NO `password` either: the account is created without one and
943
+ * with `emailVerified: true`, its first linked sign-in method being the
944
+ * token's provider. The way back in is `mode: 'social'` with the same
945
+ * provider.
946
+ *
947
+ * No captcha, like `mode: 'social'`. A closed shop or a foreign Origin is
948
+ * refused exactly as `mode: 'register'` refuses it — on the bridge leg,
949
+ * against the store the code was minted for. Every other refusal is in
950
+ * {@link CUSTOMER_SOCIAL_REGISTER_ERROR_CODES}. The 200 is a
951
+ * {@link CustomerRegisterResult}, the same body `mode: 'register'` answers.
952
+ */
953
+ type CustomerSocialRegisterInput = Omit<CustomerRegisterInput, 'email' | 'password'> & ({
954
+ accessToken: string;
955
+ bridgeCode?: never;
956
+ state?: never;
957
+ } | {
958
+ bridgeCode: string;
959
+ state: string;
960
+ accessToken?: never;
961
+ });
912
962
  /**
913
963
  * What a social-bridge code is FOR. A `sign-in` code redeems only through
914
964
  * `social-bridge-redeem`; a `link` code only through `link-sign-in-method`'s
915
- * `bridgeCode`. The wrong one is `401 BRIDGE_CODE_INVALID`, and spent.
965
+ * `bridgeCode`; a `register` code only through `register-social`'s
966
+ * `bridgeCode` (see {@link CustomerSocialRegisterInput}). The wrong one is
967
+ * `401 BRIDGE_CODE_INVALID`, and spent — so `social-bridge-redeem` and
968
+ * `link-sign-in-method` refuse a `register` code exactly as `register-social`
969
+ * refuses a `sign-in` or `link` one.
970
+ *
971
+ * ⚠️ `register` was added after the other two. A consumer that narrows an
972
+ * incoming value to this union must widen its own guard, or it drops a valid
973
+ * `register` flow as unknown.
916
974
  */
917
- type CustomerSocialBridgePurpose = 'sign-in' | 'link';
975
+ type CustomerSocialBridgePurpose = 'sign-in' | 'link' | 'register';
918
976
  /**
919
977
  * `POST /auth` body for `social-bridge-mint`. Public, captcha-exempt like
920
978
  * `mode: 'social'`.
@@ -927,14 +985,20 @@ declare global {
927
985
  * and requires `returnOrigin` to be exactly `https://` + the store's ACTIVE
928
986
  * canonical custom host, or its `www.` — anything else is
929
987
  * `400 BRIDGE_ORIGIN_NOT_ALLOWED`. An expired or malformed token is
930
- * `401 INVALID_ID_TOKEN`; an unverified identity is `400 USER_NOT_ENABLED`, as
931
- * on `mode: 'social'`.
988
+ * `401 INVALID_ID_TOKEN`; an unverified identity is
989
+ * `401 SIGN_IN_IDENTITY_UNVERIFIED`, as on `mode: 'social'`.
932
990
  */
933
991
  interface CustomerSocialBridgeMintRequest {
934
992
  mode: 'social-bridge-mint';
935
993
  idToken: string;
936
994
  /** A bare origin, as `location.origin` prints it: no path, no trailing slash, no port (not even `:443`). */
937
995
  returnOrigin: string;
996
+ /**
997
+ * Which mode may redeem the code — see {@link CustomerSocialBridgePurpose}.
998
+ * Mint `register` for a custom-domain `register-social`: the token's
999
+ * identity is verified here exactly as for the other two purposes, and the
1000
+ * customer is only created when the custom domain redeems the code.
1001
+ */
938
1002
  purpose: CustomerSocialBridgePurpose;
939
1003
  /**
940
1004
  * The custom-domain page's own random nonce for this flow, 16–128 of
@@ -960,8 +1024,8 @@ declare global {
960
1024
  * body, refresh cookie and session `mode: 'social'` answers with, and every
961
1025
  * other refusal of that mode (`CUSTOMER_NOT_FOUND`, `SIGN_IN_UID_MISMATCH`, …)
962
1026
  * can follow a valid code. A malformed, unknown, used or expired code, another
963
- * Origin, another store, a `link` code, or a missing or different `state` is
964
- * `401 BRIDGE_CODE_INVALID` — and the code is spent either way.
1027
+ * Origin, another store, a `link` or `register` code, or a missing or different
1028
+ * `state` is `401 BRIDGE_CODE_INVALID` — and the code is spent either way.
965
1029
  */
966
1030
  interface CustomerSocialBridgeRedeemRequest {
967
1031
  mode: 'social-bridge-redeem';
@@ -1330,12 +1394,15 @@ declare global {
1330
1394
  * UID than this verified token carries. Closes the gap where a matching email
1331
1395
  * address was enough. A security event, not a bad password.
1332
1396
  * - `SIGN_IN_IDENTITY_MISMATCH` (link) — the minted token's identity is not the
1333
- * account being linked to. ⚠️ Distinguishable here and deliberately NOT on the
1397
+ * account being linked to — including an Apple private relay that another
1398
+ * customer of the store holds as its email, which sign-in would resolve to
1399
+ * that customer and never to this one. ⚠️ Distinguishable here and deliberately NOT on the
1334
1400
  * unauthenticated sign-in path: the linking caller is cookie-authenticated and
1335
1401
  * already holds both operands, so naming the mismatch discloses nothing it did
1336
1402
  * not supply. Naming it on sign-in would enumerate the customer table.
1337
- * - `SIGN_IN_IDENTITY_UNVERIFIED` (link) — the provider asserts an identity it
1338
- * has not itself verified.
1403
+ * - `SIGN_IN_IDENTITY_UNVERIFIED` (link, `social`, `social-bridge-mint`,
1404
+ * `register-social`) — the provider asserts an identity it has not itself
1405
+ * verified. Never the disabled-account answer: that stays `USER_NOT_ENABLED`.
1339
1406
  * - `INVALID_ID_TOKEN` — the token failed verification outright: malformed,
1340
1407
  * expired, or signed by the wrong issuer. Retryable by re-authenticating.
1341
1408
  * - `SIGN_IN_PROVIDER_UNSUPPORTED` — the provider is not one this store accepts.
@@ -1370,22 +1437,69 @@ export declare const SIGN_IN_METHOD_ERROR_CODES: readonly ["SIGN_IN_METHOD_LAST_
1370
1437
  export type SignInMethodErrorCode = (typeof SIGN_IN_METHOD_ERROR_CODES)[number];
1371
1438
  /**
1372
1439
  * Refusals of the custom-domain social bridge — `social-bridge-mint`,
1373
- * `social-bridge-redeem` and `link-sign-in-method`'s `bridgeCode`.
1440
+ * `social-bridge-redeem`, and the `bridgeCode` of `link-sign-in-method` and
1441
+ * `register-social`.
1374
1442
  *
1375
1443
  * - `BRIDGE_ORIGIN_NOT_ALLOWED` · 400 (mint) — the request's Origin is not the
1376
1444
  * store's own ACTIVE slug host (or `x-store` is malformed), or `returnOrigin`
1377
1445
  * is not exactly `https://` + the store's ACTIVE canonical custom host or its
1378
1446
  * `www.`: a pending, failed or spare domain, another store's domain, `http:`,
1379
1447
  * a path, any explicit port or a trailing slash.
1380
- * - `BRIDGE_CODE_INVALID` · 401 (redeem, link) — ONE code for every failure:
1381
- * malformed, unknown, already used, older than 60 s, presented from another
1382
- * Origin or at another store, minted for the other purpose, or sent without
1448
+ * - `BRIDGE_CODE_INVALID` · 401 (redeem, link, register-social) — ONE code for
1449
+ * every failure: malformed, unknown, already used, older than 60 s, presented
1450
+ * from another Origin or at another store, minted for a different
1451
+ * {@link CustomerSocialBridgePurpose} than the redeeming mode's, or sent without
1383
1452
  * the `state` it was minted for. Deliberately
1384
1453
  * undifferentiated, so it is no oracle. Not retryable with the same code: it
1385
1454
  * is spent by the attempt. Start the bridge again.
1455
+ * ⚠️ Except a `register-social` `bridgeCode` sent WITHOUT `state`: that mode's
1456
+ * schema requires `state`, so it is `400 VALIDATION_FAILED` before any redeem,
1457
+ * and the code is NOT spent — where `social-bridge-redeem` and
1458
+ * `link-sign-in-method` answer this `401` and spend it.
1386
1459
  */
1387
1460
  export declare const SOCIAL_BRIDGE_ERROR_CODES: readonly ["BRIDGE_ORIGIN_NOT_ALLOWED", "BRIDGE_CODE_INVALID"];
1388
1461
  export type SocialBridgeErrorCode = (typeof SOCIAL_BRIDGE_ERROR_CODES)[number];
1462
+ /**
1463
+ * `body.error` codes `POST /auth { mode: 'register-social' }` can refuse with —
1464
+ * see {@link CustomerSocialRegisterInput}. Nothing is written on any of them.
1465
+ *
1466
+ * A CONST TUPLE, module-scope, for the same reason as the sign-in cohort above:
1467
+ * a consumer keys an exhaustive `Record<CustomerSocialRegisterErrorCode, string>`
1468
+ * of copy off it, and the compiler re-checks that record when a member is added.
1469
+ *
1470
+ * The status is stated per member, but ⚠️ MATCH ON `body.error`, never on the
1471
+ * status alone — the two 401s want different remedies.
1472
+ *
1473
+ * - `EMAIL_TAKEN_BY_ANOTHER_ACCOUNT` · 400 — a customer of this store already
1474
+ * holds the token's email, or (Apple) already has this private-relay identity
1475
+ * linked. Route to `mode: 'social'` sign-in, never to registering again. The
1476
+ * same answer `mode: 'register'` gives for a taken email, or for a typed
1477
+ * private-relay address already linked to a customer.
1478
+ * - `CUSTOMER_ID_ALLOCATION_EXHAUSTED` · 409 — the store's customer-id space
1479
+ * could not yield a free id. Nothing the shopper sent is wrong; retryable
1480
+ * later. Shared with `mode: 'register'`.
1481
+ * - `SIGN_IN_IDENTITY_UNVERIFIED` · 401 — the provider has not verified the
1482
+ * token's email, or the token carries none. Not retryable with this identity.
1483
+ * - `INVALID_ID_TOKEN` · 401 — the token failed verification outright:
1484
+ * malformed, expired or wrongly issued. Retryable by re-authenticating with
1485
+ * the provider.
1486
+ * - `SIGN_IN_PROVIDER_UNSUPPORTED` · 400 — a verified token from a provider
1487
+ * other than Google, Apple or Facebook. A configuration answer, not a
1488
+ * credential one.
1489
+ *
1490
+ * ⚠️ The last three are ALSO members of {@link SIGN_IN_METHOD_ERROR_CODES},
1491
+ * deliberately: the same verification failure reads the same on every mode that
1492
+ * verifies a token, so one copy entry can serve both.
1493
+ *
1494
+ * ⚠️ Not listed, because they are not this mode's own: a closed shop or a
1495
+ * foreign Origin answers `403 STOREFRONT_UNAVAILABLE` / `403
1496
+ * ORIGIN_STORE_MISMATCH` exactly as `mode: 'register'` does, and the
1497
+ * `bridgeCode` leg's `401 BRIDGE_CODE_INVALID` lives in
1498
+ * {@link SOCIAL_BRIDGE_ERROR_CODES}. An invalid `cuit` or `phone`, or a body
1499
+ * with both or neither identity, is the ordinary `400` validation refusal.
1500
+ */
1501
+ export declare const CUSTOMER_SOCIAL_REGISTER_ERROR_CODES: readonly ["EMAIL_TAKEN_BY_ANOTHER_ACCOUNT", "CUSTOMER_ID_ALLOCATION_EXHAUSTED", "SIGN_IN_IDENTITY_UNVERIFIED", "INVALID_ID_TOKEN", "SIGN_IN_PROVIDER_UNSUPPORTED"];
1502
+ export type CustomerSocialRegisterErrorCode = (typeof CUSTOMER_SOCIAL_REGISTER_ERROR_CODES)[number];
1389
1503
  /**
1390
1504
  * `body.error` codes the operator refresh/session leg can refuse with —
1391
1505
  * `POST /auth { mode: 'refresh' }` and the body-transport ingress it shares with
package/dist/auth.js CHANGED
@@ -40,12 +40,15 @@
40
40
  * UID than this verified token carries. Closes the gap where a matching email
41
41
  * address was enough. A security event, not a bad password.
42
42
  * - `SIGN_IN_IDENTITY_MISMATCH` (link) — the minted token's identity is not the
43
- * account being linked to. ⚠️ Distinguishable here and deliberately NOT on the
43
+ * account being linked to — including an Apple private relay that another
44
+ * customer of the store holds as its email, which sign-in would resolve to
45
+ * that customer and never to this one. ⚠️ Distinguishable here and deliberately NOT on the
44
46
  * unauthenticated sign-in path: the linking caller is cookie-authenticated and
45
47
  * already holds both operands, so naming the mismatch discloses nothing it did
46
48
  * not supply. Naming it on sign-in would enumerate the customer table.
47
- * - `SIGN_IN_IDENTITY_UNVERIFIED` (link) — the provider asserts an identity it
48
- * has not itself verified.
49
+ * - `SIGN_IN_IDENTITY_UNVERIFIED` (link, `social`, `social-bridge-mint`,
50
+ * `register-social`) — the provider asserts an identity it has not itself
51
+ * verified. Never the disabled-account answer: that stays `USER_NOT_ENABLED`.
49
52
  * - `INVALID_ID_TOKEN` — the token failed verification outright: malformed,
50
53
  * expired, or signed by the wrong issuer. Retryable by re-authenticating.
51
54
  * - `SIGN_IN_PROVIDER_UNSUPPORTED` — the provider is not one this store accepts.
@@ -91,21 +94,73 @@ export const SIGN_IN_METHOD_ERROR_CODES = [
91
94
  ];
92
95
  /**
93
96
  * Refusals of the custom-domain social bridge — `social-bridge-mint`,
94
- * `social-bridge-redeem` and `link-sign-in-method`'s `bridgeCode`.
97
+ * `social-bridge-redeem`, and the `bridgeCode` of `link-sign-in-method` and
98
+ * `register-social`.
95
99
  *
96
100
  * - `BRIDGE_ORIGIN_NOT_ALLOWED` · 400 (mint) — the request's Origin is not the
97
101
  * store's own ACTIVE slug host (or `x-store` is malformed), or `returnOrigin`
98
102
  * is not exactly `https://` + the store's ACTIVE canonical custom host or its
99
103
  * `www.`: a pending, failed or spare domain, another store's domain, `http:`,
100
104
  * a path, any explicit port or a trailing slash.
101
- * - `BRIDGE_CODE_INVALID` · 401 (redeem, link) — ONE code for every failure:
102
- * malformed, unknown, already used, older than 60 s, presented from another
103
- * Origin or at another store, minted for the other purpose, or sent without
105
+ * - `BRIDGE_CODE_INVALID` · 401 (redeem, link, register-social) — ONE code for
106
+ * every failure: malformed, unknown, already used, older than 60 s, presented
107
+ * from another Origin or at another store, minted for a different
108
+ * {@link CustomerSocialBridgePurpose} than the redeeming mode's, or sent without
104
109
  * the `state` it was minted for. Deliberately
105
110
  * undifferentiated, so it is no oracle. Not retryable with the same code: it
106
111
  * is spent by the attempt. Start the bridge again.
112
+ * ⚠️ Except a `register-social` `bridgeCode` sent WITHOUT `state`: that mode's
113
+ * schema requires `state`, so it is `400 VALIDATION_FAILED` before any redeem,
114
+ * and the code is NOT spent — where `social-bridge-redeem` and
115
+ * `link-sign-in-method` answer this `401` and spend it.
107
116
  */
108
117
  export const SOCIAL_BRIDGE_ERROR_CODES = ['BRIDGE_ORIGIN_NOT_ALLOWED', 'BRIDGE_CODE_INVALID'];
118
+ /**
119
+ * `body.error` codes `POST /auth { mode: 'register-social' }` can refuse with —
120
+ * see {@link CustomerSocialRegisterInput}. Nothing is written on any of them.
121
+ *
122
+ * A CONST TUPLE, module-scope, for the same reason as the sign-in cohort above:
123
+ * a consumer keys an exhaustive `Record<CustomerSocialRegisterErrorCode, string>`
124
+ * of copy off it, and the compiler re-checks that record when a member is added.
125
+ *
126
+ * The status is stated per member, but ⚠️ MATCH ON `body.error`, never on the
127
+ * status alone — the two 401s want different remedies.
128
+ *
129
+ * - `EMAIL_TAKEN_BY_ANOTHER_ACCOUNT` · 400 — a customer of this store already
130
+ * holds the token's email, or (Apple) already has this private-relay identity
131
+ * linked. Route to `mode: 'social'` sign-in, never to registering again. The
132
+ * same answer `mode: 'register'` gives for a taken email, or for a typed
133
+ * private-relay address already linked to a customer.
134
+ * - `CUSTOMER_ID_ALLOCATION_EXHAUSTED` · 409 — the store's customer-id space
135
+ * could not yield a free id. Nothing the shopper sent is wrong; retryable
136
+ * later. Shared with `mode: 'register'`.
137
+ * - `SIGN_IN_IDENTITY_UNVERIFIED` · 401 — the provider has not verified the
138
+ * token's email, or the token carries none. Not retryable with this identity.
139
+ * - `INVALID_ID_TOKEN` · 401 — the token failed verification outright:
140
+ * malformed, expired or wrongly issued. Retryable by re-authenticating with
141
+ * the provider.
142
+ * - `SIGN_IN_PROVIDER_UNSUPPORTED` · 400 — a verified token from a provider
143
+ * other than Google, Apple or Facebook. A configuration answer, not a
144
+ * credential one.
145
+ *
146
+ * ⚠️ The last three are ALSO members of {@link SIGN_IN_METHOD_ERROR_CODES},
147
+ * deliberately: the same verification failure reads the same on every mode that
148
+ * verifies a token, so one copy entry can serve both.
149
+ *
150
+ * ⚠️ Not listed, because they are not this mode's own: a closed shop or a
151
+ * foreign Origin answers `403 STOREFRONT_UNAVAILABLE` / `403
152
+ * ORIGIN_STORE_MISMATCH` exactly as `mode: 'register'` does, and the
153
+ * `bridgeCode` leg's `401 BRIDGE_CODE_INVALID` lives in
154
+ * {@link SOCIAL_BRIDGE_ERROR_CODES}. An invalid `cuit` or `phone`, or a body
155
+ * with both or neither identity, is the ordinary `400` validation refusal.
156
+ */
157
+ export const CUSTOMER_SOCIAL_REGISTER_ERROR_CODES = [
158
+ 'EMAIL_TAKEN_BY_ANOTHER_ACCOUNT',
159
+ 'CUSTOMER_ID_ALLOCATION_EXHAUSTED',
160
+ 'SIGN_IN_IDENTITY_UNVERIFIED',
161
+ 'INVALID_ID_TOKEN',
162
+ 'SIGN_IN_PROVIDER_UNSUPPORTED',
163
+ ];
109
164
  /**
110
165
  * `body.error` codes the operator refresh/session leg can refuse with —
111
166
  * `POST /auth { mode: 'refresh' }` and the body-transport ingress it shares with
package/dist/cjs/auth.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SESSION_ACTION_ERROR_CODES = exports.PASSKEY_ERROR_CODES = exports.TWO_FACTOR_MANAGEMENT_ERROR_CODES = exports.LOGIN_2FA_ERROR_CODES = exports.LOGIN_ERROR_CODES = exports.STEP_UP_ERROR_CODES = exports.REFRESH_ERROR_CODES = exports.SOCIAL_BRIDGE_ERROR_CODES = exports.SIGN_IN_METHOD_ERROR_CODES = void 0;
3
+ exports.SESSION_ACTION_ERROR_CODES = exports.PASSKEY_ERROR_CODES = exports.TWO_FACTOR_MANAGEMENT_ERROR_CODES = exports.LOGIN_2FA_ERROR_CODES = exports.LOGIN_ERROR_CODES = exports.STEP_UP_ERROR_CODES = exports.REFRESH_ERROR_CODES = exports.CUSTOMER_SOCIAL_REGISTER_ERROR_CODES = exports.SOCIAL_BRIDGE_ERROR_CODES = exports.SIGN_IN_METHOD_ERROR_CODES = void 0;
4
4
  /**
5
5
  * `body.error` codes the sign-in-method paths can refuse with.
6
6
  *
@@ -43,12 +43,15 @@ exports.SESSION_ACTION_ERROR_CODES = exports.PASSKEY_ERROR_CODES = exports.TWO_F
43
43
  * UID than this verified token carries. Closes the gap where a matching email
44
44
  * address was enough. A security event, not a bad password.
45
45
  * - `SIGN_IN_IDENTITY_MISMATCH` (link) — the minted token's identity is not the
46
- * account being linked to. ⚠️ Distinguishable here and deliberately NOT on the
46
+ * account being linked to — including an Apple private relay that another
47
+ * customer of the store holds as its email, which sign-in would resolve to
48
+ * that customer and never to this one. ⚠️ Distinguishable here and deliberately NOT on the
47
49
  * unauthenticated sign-in path: the linking caller is cookie-authenticated and
48
50
  * already holds both operands, so naming the mismatch discloses nothing it did
49
51
  * not supply. Naming it on sign-in would enumerate the customer table.
50
- * - `SIGN_IN_IDENTITY_UNVERIFIED` (link) — the provider asserts an identity it
51
- * has not itself verified.
52
+ * - `SIGN_IN_IDENTITY_UNVERIFIED` (link, `social`, `social-bridge-mint`,
53
+ * `register-social`) — the provider asserts an identity it has not itself
54
+ * verified. Never the disabled-account answer: that stays `USER_NOT_ENABLED`.
52
55
  * - `INVALID_ID_TOKEN` — the token failed verification outright: malformed,
53
56
  * expired, or signed by the wrong issuer. Retryable by re-authenticating.
54
57
  * - `SIGN_IN_PROVIDER_UNSUPPORTED` — the provider is not one this store accepts.
@@ -94,21 +97,73 @@ exports.SIGN_IN_METHOD_ERROR_CODES = [
94
97
  ];
95
98
  /**
96
99
  * Refusals of the custom-domain social bridge — `social-bridge-mint`,
97
- * `social-bridge-redeem` and `link-sign-in-method`'s `bridgeCode`.
100
+ * `social-bridge-redeem`, and the `bridgeCode` of `link-sign-in-method` and
101
+ * `register-social`.
98
102
  *
99
103
  * - `BRIDGE_ORIGIN_NOT_ALLOWED` · 400 (mint) — the request's Origin is not the
100
104
  * store's own ACTIVE slug host (or `x-store` is malformed), or `returnOrigin`
101
105
  * is not exactly `https://` + the store's ACTIVE canonical custom host or its
102
106
  * `www.`: a pending, failed or spare domain, another store's domain, `http:`,
103
107
  * a path, any explicit port or a trailing slash.
104
- * - `BRIDGE_CODE_INVALID` · 401 (redeem, link) — ONE code for every failure:
105
- * malformed, unknown, already used, older than 60 s, presented from another
106
- * Origin or at another store, minted for the other purpose, or sent without
108
+ * - `BRIDGE_CODE_INVALID` · 401 (redeem, link, register-social) — ONE code for
109
+ * every failure: malformed, unknown, already used, older than 60 s, presented
110
+ * from another Origin or at another store, minted for a different
111
+ * {@link CustomerSocialBridgePurpose} than the redeeming mode's, or sent without
107
112
  * the `state` it was minted for. Deliberately
108
113
  * undifferentiated, so it is no oracle. Not retryable with the same code: it
109
114
  * is spent by the attempt. Start the bridge again.
115
+ * ⚠️ Except a `register-social` `bridgeCode` sent WITHOUT `state`: that mode's
116
+ * schema requires `state`, so it is `400 VALIDATION_FAILED` before any redeem,
117
+ * and the code is NOT spent — where `social-bridge-redeem` and
118
+ * `link-sign-in-method` answer this `401` and spend it.
110
119
  */
111
120
  exports.SOCIAL_BRIDGE_ERROR_CODES = ['BRIDGE_ORIGIN_NOT_ALLOWED', 'BRIDGE_CODE_INVALID'];
121
+ /**
122
+ * `body.error` codes `POST /auth { mode: 'register-social' }` can refuse with —
123
+ * see {@link CustomerSocialRegisterInput}. Nothing is written on any of them.
124
+ *
125
+ * A CONST TUPLE, module-scope, for the same reason as the sign-in cohort above:
126
+ * a consumer keys an exhaustive `Record<CustomerSocialRegisterErrorCode, string>`
127
+ * of copy off it, and the compiler re-checks that record when a member is added.
128
+ *
129
+ * The status is stated per member, but ⚠️ MATCH ON `body.error`, never on the
130
+ * status alone — the two 401s want different remedies.
131
+ *
132
+ * - `EMAIL_TAKEN_BY_ANOTHER_ACCOUNT` · 400 — a customer of this store already
133
+ * holds the token's email, or (Apple) already has this private-relay identity
134
+ * linked. Route to `mode: 'social'` sign-in, never to registering again. The
135
+ * same answer `mode: 'register'` gives for a taken email, or for a typed
136
+ * private-relay address already linked to a customer.
137
+ * - `CUSTOMER_ID_ALLOCATION_EXHAUSTED` · 409 — the store's customer-id space
138
+ * could not yield a free id. Nothing the shopper sent is wrong; retryable
139
+ * later. Shared with `mode: 'register'`.
140
+ * - `SIGN_IN_IDENTITY_UNVERIFIED` · 401 — the provider has not verified the
141
+ * token's email, or the token carries none. Not retryable with this identity.
142
+ * - `INVALID_ID_TOKEN` · 401 — the token failed verification outright:
143
+ * malformed, expired or wrongly issued. Retryable by re-authenticating with
144
+ * the provider.
145
+ * - `SIGN_IN_PROVIDER_UNSUPPORTED` · 400 — a verified token from a provider
146
+ * other than Google, Apple or Facebook. A configuration answer, not a
147
+ * credential one.
148
+ *
149
+ * ⚠️ The last three are ALSO members of {@link SIGN_IN_METHOD_ERROR_CODES},
150
+ * deliberately: the same verification failure reads the same on every mode that
151
+ * verifies a token, so one copy entry can serve both.
152
+ *
153
+ * ⚠️ Not listed, because they are not this mode's own: a closed shop or a
154
+ * foreign Origin answers `403 STOREFRONT_UNAVAILABLE` / `403
155
+ * ORIGIN_STORE_MISMATCH` exactly as `mode: 'register'` does, and the
156
+ * `bridgeCode` leg's `401 BRIDGE_CODE_INVALID` lives in
157
+ * {@link SOCIAL_BRIDGE_ERROR_CODES}. An invalid `cuit` or `phone`, or a body
158
+ * with both or neither identity, is the ordinary `400` validation refusal.
159
+ */
160
+ exports.CUSTOMER_SOCIAL_REGISTER_ERROR_CODES = [
161
+ 'EMAIL_TAKEN_BY_ANOTHER_ACCOUNT',
162
+ 'CUSTOMER_ID_ALLOCATION_EXHAUSTED',
163
+ 'SIGN_IN_IDENTITY_UNVERIFIED',
164
+ 'INVALID_ID_TOKEN',
165
+ 'SIGN_IN_PROVIDER_UNSUPPORTED',
166
+ ];
112
167
  /**
113
168
  * `body.error` codes the operator refresh/session leg can refuse with —
114
169
  * `POST /auth { mode: 'refresh' }` and the body-transport ingress it shares with
@@ -262,7 +262,9 @@ declare global {
262
262
  /** Absent after erasure or the final merge flip; registration still requires an address. */
263
263
  email?: string;
264
264
  /**
265
- * Set ONLY by the customer OTP verify transaction.
265
+ * Set `true` ONLY where the address is proven: by the customer OTP verify
266
+ * transaction, or at creation by a storefront `register-social`, whose
267
+ * provider verified the email (an unverified identity creates nothing).
266
268
  *
267
269
  * ⚠️ UNDEFINED MEANS **NOT** VERIFIED — deliberately the INVERSE of
268
270
  * `User.emailVerified`, which carries a grandfather clause telling apps to
@@ -272,7 +274,10 @@ declare global {
272
274
  * verified and defeat the backfill it exists to force.
273
275
  */
274
276
  emailVerified?: boolean;
275
- /** ms-epoch of the OTP verification. Absent whenever `emailVerified` is not `true`. */
277
+ /**
278
+ * ms-epoch of the proof: the OTP verification, or — for a `register-social`
279
+ * account — the row's `createdAt`. Absent whenever `emailVerified` is not `true`.
280
+ */
276
281
  emailVerifiedAt?: number;
277
282
  /**
278
283
  * Set ONLY by the customer's own phone verification (an SMS code they ask
@@ -1539,13 +1544,16 @@ declare global {
1539
1544
  refreshToken?: string;
1540
1545
  }
1541
1546
  /**
1542
- * The storefront registration body (`POST /auth {mode:'register'}`). On
1543
- * success it is the signed-in `AuthCustomer`, exactly as a password sign-in
1544
- * answers. On the one leg where the customer row committed but the session
1545
- * could not be minted it is the created customer with no token and
1546
- * `sessionIssued: false`: the account exists and its password works, so a
1547
- * client sends the shopper to sign in — never to register again, which the
1548
- * email uniqueness constraint would now refuse.
1547
+ * The storefront registration body — `POST /auth` with `mode: 'register'`
1548
+ * or `mode: 'register-social'`, which answer the same shape. On success it
1549
+ * is the signed-in `AuthCustomer`, exactly as a sign-in answers. On the one
1550
+ * leg where the customer row committed but the session could not be minted
1551
+ * it is the created customer with no token and `sessionIssued: false`: the
1552
+ * account exists and the credential it was created with works, so a client
1553
+ * sends the shopper to sign in with THAT credential — the password on
1554
+ * `register`, `mode: 'social'` with the same provider on `register-social`
1555
+ * (that account has no password) — never to register again, which the email
1556
+ * uniqueness constraint would now refuse.
1549
1557
  */
1550
1558
  type CustomerRegisterResult = AuthCustomer | (Customer & {
1551
1559
  accessToken?: never;
@@ -113,10 +113,9 @@ declare global {
113
113
  * The sign-in twin's union minus `'passkey'` — a passkey is registered
114
114
  * from an existing session, never at sign-up.
115
115
  *
116
- * ⚠️ Only `'email'` is emitted today — registration is api-side and has
117
- * no social leg. The social members are reachable shape, not observed
118
- * data; do not read a member's presence here as evidence that path
119
- * exists.
116
+ * `'email'` is password registration (`mode: 'register'`); the social
117
+ * members are `mode: 'register-social'`, which emits the provider the
118
+ * verified token names.
120
119
  */
121
120
  method: 'email' | 'google' | 'facebook' | 'apple';
122
121
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.10.658",
3
+ "version": "1.10.660",
4
4
  "description": "Shared wire and entity contracts for the SINFACTURA platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",