@takeal/cusfront-sdk 0.5.0 → 0.6.1
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/CHANGELOG.md +49 -2
- package/README.md +168 -3
- package/dist/analytics.cjs +28 -7
- package/dist/analytics.cjs.map +1 -1
- package/dist/analytics.js +28 -7
- package/dist/analytics.js.map +1 -1
- package/dist/{cards-Ba1wZttb.d.ts → cards-CF3-He2x.d.ts} +144 -20
- package/dist/{cards-B_aNY35J.d.cts → cards-qfHz6xZY.d.cts} +144 -20
- package/dist/{deposits-DScyT_D9.d.ts → deposits-B2LBe2k1.d.ts} +71 -8
- package/dist/{deposits-BEc8U80M.d.cts → deposits-ZjT_btgi.d.cts} +71 -8
- package/dist/index.cjs +92 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +92 -50
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +2 -8
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +2 -8
- package/dist/react/index.js.map +1 -1
- package/dist/resources/attribution.cjs.map +1 -1
- package/dist/resources/attribution.js.map +1 -1
- package/dist/resources/auth.cjs.map +1 -1
- package/dist/resources/auth.js.map +1 -1
- package/dist/resources/cards.cjs +41 -28
- package/dist/resources/cards.cjs.map +1 -1
- package/dist/resources/cards.d.cts +1 -1
- package/dist/resources/cards.d.ts +1 -1
- package/dist/resources/cards.js +41 -28
- package/dist/resources/cards.js.map +1 -1
- package/dist/resources/deposits.cjs +8 -5
- package/dist/resources/deposits.cjs.map +1 -1
- package/dist/resources/deposits.d.cts +2 -2
- package/dist/resources/deposits.d.ts +2 -2
- package/dist/resources/deposits.js +8 -5
- package/dist/resources/deposits.js.map +1 -1
- package/dist/resources/devices.cjs +3 -1
- package/dist/resources/devices.cjs.map +1 -1
- package/dist/resources/devices.js +3 -1
- package/dist/resources/devices.js.map +1 -1
- package/dist/resources/documents.cjs +3 -1
- package/dist/resources/documents.cjs.map +1 -1
- package/dist/resources/documents.js +3 -1
- package/dist/resources/documents.js.map +1 -1
- package/dist/resources/funding-options.cjs.map +1 -1
- package/dist/resources/funding-options.d.cts +2 -2
- package/dist/resources/funding-options.d.ts +2 -2
- package/dist/resources/funding-options.js.map +1 -1
- package/dist/resources/history.cjs +3 -1
- package/dist/resources/history.cjs.map +1 -1
- package/dist/resources/history.js +3 -1
- package/dist/resources/history.js.map +1 -1
- package/dist/resources/push.cjs +3 -1
- package/dist/resources/push.cjs.map +1 -1
- package/dist/resources/push.js +3 -1
- package/dist/resources/push.js.map +1 -1
- package/dist/telegram.cjs +67 -53
- package/dist/telegram.cjs.map +1 -1
- package/dist/telegram.d.cts +2 -2
- package/dist/telegram.d.ts +2 -2
- package/dist/telegram.js +67 -53
- package/dist/telegram.js.map +1 -1
- package/package.json +12 -5
package/dist/index.d.cts
CHANGED
|
@@ -2,10 +2,10 @@ import { T as TokenStore, F as FetchLike } from './http-DeANAoTs.cjs';
|
|
|
2
2
|
export { d as defaultBrowserStore, i as inMemoryStore } from './http-DeANAoTs.cjs';
|
|
3
3
|
import { AuthResource } from './resources/auth.cjs';
|
|
4
4
|
export { ChangePasswordInput, ExchangeTelegramInput, JwtIssued, LinkTelegramInput, LoginInput, LoginResponse, OtpSentResponse, RegisterInput, Session, TelegramLink, TelegramUnknown, TotpRequired, TotpSetupComplete, TotpSetupRequired, User } from './resources/auth.cjs';
|
|
5
|
-
import { a as DepositsResource, F as FundingOptionsResource } from './deposits-
|
|
6
|
-
export { C as CardLoadStatus, b as CreateDepositRefundInput, c as CreateQuoteInput, D as Deposit, d as DepositMethod, e as DepositStatus, f as DepositTarget, g as
|
|
7
|
-
import { b as CardsResource } from './cards-
|
|
8
|
-
export { A as Address, B as BillingAddress, a as Card, c as CardBalance, d as CardDesignRef, C as CardProduct,
|
|
5
|
+
import { a as DepositsResource, F as FundingOptionsResource } from './deposits-ZjT_btgi.cjs';
|
|
6
|
+
export { C as CardLoadStatus, b as CreateDepositRefundInput, c as CreateQuoteInput, D as Deposit, d as DepositMethod, e as DepositStatus, f as DepositTarget, g as FeeKind, h as FunderMode, i as FundingOption, j as FundingQuote, I as InitiateDepositInput, k as IssueCardInput, M as MethodTerms, R as Refund } from './deposits-ZjT_btgi.cjs';
|
|
7
|
+
import { b as CardsResource } from './cards-qfHz6xZY.cjs';
|
|
8
|
+
export { A as Address, B as BillingAddress, a as Card, c as CardBalance, d as CardDesignRef, e as CardForm, C as CardProduct, f as CardProductPrice, g as CardStatus, h as CardStatusSource, i as CardTopUp, j as CardTopUpStatus, k as CardTransfer, l as CardType, m as Cardholder, n as CloseBlockedReason, o as CreateCardInput, p as CustomerInfo, I as IssuanceBonus, R as RevealCardInput, q as RevealedCard, S as SetPinInput, T as TopUpInput, r as TopUpResult, s as TopUpTerms, t as TransferInput, u as TransferResult, U as UpdateCardInput } from './cards-qfHz6xZY.cjs';
|
|
9
9
|
import { BalanceResource } from './resources/balance.cjs';
|
|
10
10
|
export { Balance } from './resources/balance.cjs';
|
|
11
11
|
import { BonusResource } from './resources/bonus.cjs';
|
|
@@ -71,7 +71,7 @@ interface BrandConfig {
|
|
|
71
71
|
* Which platform versions this SDK works with, as a semver range:
|
|
72
72
|
* comparators separated by ", ". Keep this the only definition.
|
|
73
73
|
*/
|
|
74
|
-
declare const SUPPORTED_MEISTER = ">=0.
|
|
74
|
+
declare const SUPPORTED_MEISTER = ">=0.6.4, <0.7.0";
|
|
75
75
|
/** What `client.ready()` returns. */
|
|
76
76
|
interface ReadyInfo {
|
|
77
77
|
/** `true` when the platform reported a version inside `supportedMeister`. */
|
|
@@ -177,7 +177,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
|
|
|
177
177
|
* `define`. `src/version.test.ts` checks it matches `package.json`, so a
|
|
178
178
|
* release bump that forgets this file fails the test run.
|
|
179
179
|
*/
|
|
180
|
-
declare const SDK_VERSION = "0.
|
|
180
|
+
declare const SDK_VERSION = "0.6.1";
|
|
181
181
|
|
|
182
182
|
/**
|
|
183
183
|
* `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
|
package/dist/index.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import { T as TokenStore, F as FetchLike } from './http-DeANAoTs.js';
|
|
|
2
2
|
export { d as defaultBrowserStore, i as inMemoryStore } from './http-DeANAoTs.js';
|
|
3
3
|
import { AuthResource } from './resources/auth.js';
|
|
4
4
|
export { ChangePasswordInput, ExchangeTelegramInput, JwtIssued, LinkTelegramInput, LoginInput, LoginResponse, OtpSentResponse, RegisterInput, Session, TelegramLink, TelegramUnknown, TotpRequired, TotpSetupComplete, TotpSetupRequired, User } from './resources/auth.js';
|
|
5
|
-
import { a as DepositsResource, F as FundingOptionsResource } from './deposits-
|
|
6
|
-
export { C as CardLoadStatus, b as CreateDepositRefundInput, c as CreateQuoteInput, D as Deposit, d as DepositMethod, e as DepositStatus, f as DepositTarget, g as
|
|
7
|
-
import { b as CardsResource } from './cards-
|
|
8
|
-
export { A as Address, B as BillingAddress, a as Card, c as CardBalance, d as CardDesignRef, C as CardProduct,
|
|
5
|
+
import { a as DepositsResource, F as FundingOptionsResource } from './deposits-B2LBe2k1.js';
|
|
6
|
+
export { C as CardLoadStatus, b as CreateDepositRefundInput, c as CreateQuoteInput, D as Deposit, d as DepositMethod, e as DepositStatus, f as DepositTarget, g as FeeKind, h as FunderMode, i as FundingOption, j as FundingQuote, I as InitiateDepositInput, k as IssueCardInput, M as MethodTerms, R as Refund } from './deposits-B2LBe2k1.js';
|
|
7
|
+
import { b as CardsResource } from './cards-CF3-He2x.js';
|
|
8
|
+
export { A as Address, B as BillingAddress, a as Card, c as CardBalance, d as CardDesignRef, e as CardForm, C as CardProduct, f as CardProductPrice, g as CardStatus, h as CardStatusSource, i as CardTopUp, j as CardTopUpStatus, k as CardTransfer, l as CardType, m as Cardholder, n as CloseBlockedReason, o as CreateCardInput, p as CustomerInfo, I as IssuanceBonus, R as RevealCardInput, q as RevealedCard, S as SetPinInput, T as TopUpInput, r as TopUpResult, s as TopUpTerms, t as TransferInput, u as TransferResult, U as UpdateCardInput } from './cards-CF3-He2x.js';
|
|
9
9
|
import { BalanceResource } from './resources/balance.js';
|
|
10
10
|
export { Balance } from './resources/balance.js';
|
|
11
11
|
import { BonusResource } from './resources/bonus.js';
|
|
@@ -71,7 +71,7 @@ interface BrandConfig {
|
|
|
71
71
|
* Which platform versions this SDK works with, as a semver range:
|
|
72
72
|
* comparators separated by ", ". Keep this the only definition.
|
|
73
73
|
*/
|
|
74
|
-
declare const SUPPORTED_MEISTER = ">=0.
|
|
74
|
+
declare const SUPPORTED_MEISTER = ">=0.6.4, <0.7.0";
|
|
75
75
|
/** What `client.ready()` returns. */
|
|
76
76
|
interface ReadyInfo {
|
|
77
77
|
/** `true` when the platform reported a version inside `supportedMeister`. */
|
|
@@ -177,7 +177,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
|
|
|
177
177
|
* `define`. `src/version.test.ts` checks it matches `package.json`, so a
|
|
178
178
|
* release bump that forgets this file fails the test run.
|
|
179
179
|
*/
|
|
180
|
-
declare const SDK_VERSION = "0.
|
|
180
|
+
declare const SDK_VERSION = "0.6.1";
|
|
181
181
|
|
|
182
182
|
/**
|
|
183
183
|
* `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
|
package/dist/index.js
CHANGED
|
@@ -96,10 +96,7 @@ var HttpClient = class {
|
|
|
96
96
|
try {
|
|
97
97
|
resp = await this.fetchImpl(url, init);
|
|
98
98
|
} catch (e) {
|
|
99
|
-
throw new NetworkError(
|
|
100
|
-
e instanceof Error ? e.message : "network error",
|
|
101
|
-
e
|
|
102
|
-
);
|
|
99
|
+
throw new NetworkError(e instanceof Error ? e.message : "network error", e);
|
|
103
100
|
}
|
|
104
101
|
if (resp.status === 401 && !opts.skipAuth && !opts.retried && this.refresher) {
|
|
105
102
|
if (await this.refreshOnce()) {
|
|
@@ -391,9 +388,7 @@ var CardsResource = class {
|
|
|
391
388
|
}
|
|
392
389
|
/** One product from the catalog. 404 when unknown, disabled or hidden. */
|
|
393
390
|
async getProduct(id) {
|
|
394
|
-
return this.http.get(
|
|
395
|
-
`/me/card-products/${encodeURIComponent(id)}`
|
|
396
|
-
);
|
|
391
|
+
return this.http.get(`/me/card-products/${encodeURIComponent(id)}`);
|
|
397
392
|
}
|
|
398
393
|
/**
|
|
399
394
|
* The public catalog: the same products, order and default as
|
|
@@ -432,9 +427,7 @@ var CardsResource = class {
|
|
|
432
427
|
*/
|
|
433
428
|
async balance(id, currency) {
|
|
434
429
|
const q = new URLSearchParams({ currency }).toString();
|
|
435
|
-
return this.http.get(
|
|
436
|
-
`/me/cards/${encodeURIComponent(id)}/balance?${q}`
|
|
437
|
-
);
|
|
430
|
+
return this.http.get(`/me/cards/${encodeURIComponent(id)}/balance?${q}`);
|
|
438
431
|
}
|
|
439
432
|
/**
|
|
440
433
|
* What a top-up of this card can be right now: whether it is possible, the
|
|
@@ -475,21 +468,20 @@ var CardsResource = class {
|
|
|
475
468
|
*/
|
|
476
469
|
async transfer(fromCardId, input) {
|
|
477
470
|
const { toCardId, amount, idempotencyKey } = input;
|
|
478
|
-
return this.http.post(
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
);
|
|
471
|
+
return this.http.post(`/me/cards/${encodeURIComponent(fromCardId)}/transfer`, {
|
|
472
|
+
body: { to_card_id: toCardId, amount },
|
|
473
|
+
idempotencyKey
|
|
474
|
+
});
|
|
482
475
|
}
|
|
483
476
|
/**
|
|
484
|
-
* Freeze the caller's own card. Reversible via {@link unfreeze}
|
|
485
|
-
* `
|
|
486
|
-
*
|
|
477
|
+
* Freeze the caller's own card. Reversible via {@link unfreeze} while
|
|
478
|
+
* `status_source` is `holder` or `operator`. The optional `reason` is
|
|
479
|
+
* recorded on the audit trail. Resolves to the updated card. 404 if the
|
|
480
|
+
* card isn't the caller's; 409 `card_locked` when support holds it; 501 if
|
|
481
|
+
* the issuer can't freeze.
|
|
487
482
|
*/
|
|
488
483
|
async freeze(id, reason) {
|
|
489
|
-
return this.http.post(
|
|
490
|
-
`/me/cards/${encodeURIComponent(id)}/freeze`,
|
|
491
|
-
{ body: { reason } }
|
|
492
|
-
);
|
|
484
|
+
return this.http.post(`/me/cards/${encodeURIComponent(id)}/freeze`, { body: { reason } });
|
|
493
485
|
}
|
|
494
486
|
/**
|
|
495
487
|
* Reveal the FULL PAN + CVV for the caller's own card. The signed-in
|
|
@@ -501,18 +493,37 @@ var CardsResource = class {
|
|
|
501
493
|
* keep the result in volatile memory only, never write it to
|
|
502
494
|
* localStorage / logs, and clear it within `expires_in_seconds`.
|
|
503
495
|
*
|
|
504
|
-
*
|
|
505
|
-
*
|
|
496
|
+
* The result is the numbers, or `reveal_url` with empty `pan` and `cvv`
|
|
497
|
+
* when the issuer shows them on a page of its own: open that page in a
|
|
498
|
+
* frame right away, it is short-lived.
|
|
499
|
+
*
|
|
500
|
+
* 403 not your card · 409 `card_locked` · 429 rate-limited · 501 connector
|
|
501
|
+
* has no sensitive-data endpoint · 503 `provider_unavailable`.
|
|
506
502
|
*/
|
|
507
503
|
async reveal(id, _input) {
|
|
508
504
|
return this.http.post(`/me/cards/${encodeURIComponent(id)}/reveal`);
|
|
509
505
|
}
|
|
510
|
-
/**
|
|
506
|
+
/**
|
|
507
|
+
* Unfreeze a previously-frozen card. Idempotent on an already-active card.
|
|
508
|
+
* A card the issuer froze (`status_source: "provider"`) is not the
|
|
509
|
+
* holder's to unfreeze: the API answers 409 `card_locked`, so hide the
|
|
510
|
+
* button and say the freeze is lifted through the issuer's support.
|
|
511
|
+
*/
|
|
511
512
|
async unfreeze(id) {
|
|
512
|
-
return this.http.post(
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
513
|
+
return this.http.post(`/me/cards/${encodeURIComponent(id)}/unfreeze`, { body: {} });
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Set the PIN of the caller's own physical card. The session is enough; the
|
|
517
|
+
* call is rate-limited like {@link reveal} and the PIN is kept nowhere.
|
|
518
|
+
* Resolves to the card; the user also gets a notification that the PIN
|
|
519
|
+
* was set. 400 not four to six digits or the card is not active · 403 not
|
|
520
|
+
* your card · 409 `card_locked`, or `provider_refused` when the issuer did
|
|
521
|
+
* not take it · 429 too many attempts · 501 a virtual card has no PIN.
|
|
522
|
+
*/
|
|
523
|
+
async setPin(id, input) {
|
|
524
|
+
return this.http.post(`/me/cards/${encodeURIComponent(id)}/pin`, {
|
|
525
|
+
body: { pin: input.pin }
|
|
526
|
+
});
|
|
516
527
|
}
|
|
517
528
|
/**
|
|
518
529
|
* Terminate the caller's own card. **One-way** — a terminated card cannot be
|
|
@@ -520,10 +531,9 @@ var CardsResource = class {
|
|
|
520
531
|
* already-terminated card.
|
|
521
532
|
*/
|
|
522
533
|
async terminate(id, reason) {
|
|
523
|
-
return this.http.post(
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
);
|
|
534
|
+
return this.http.post(`/me/cards/${encodeURIComponent(id)}/terminate`, {
|
|
535
|
+
body: { reason }
|
|
536
|
+
});
|
|
527
537
|
}
|
|
528
538
|
};
|
|
529
539
|
|
|
@@ -544,7 +554,10 @@ var DepositsResource = class {
|
|
|
544
554
|
* API answers 400 `no_quote_needed`).
|
|
545
555
|
*/
|
|
546
556
|
async quote(input) {
|
|
547
|
-
|
|
557
|
+
const { connectorSlug, ...rest } = input;
|
|
558
|
+
const body = { ...rest };
|
|
559
|
+
if (connectorSlug !== void 0) body["connector_slug"] = connectorSlug;
|
|
560
|
+
return this.http.post("/me/deposits/quotes", { body });
|
|
548
561
|
}
|
|
549
562
|
async initiate(input) {
|
|
550
563
|
const { idempotencyKey, issue_card, ...rest } = input;
|
|
@@ -570,10 +583,10 @@ var DepositsResource = class {
|
|
|
570
583
|
*/
|
|
571
584
|
async refund(depositId, input) {
|
|
572
585
|
const { idempotencyKey, ...body } = input;
|
|
573
|
-
return this.http.post(
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
);
|
|
586
|
+
return this.http.post(`/me/deposits/${encodeURIComponent(depositId)}/refunds`, {
|
|
587
|
+
body,
|
|
588
|
+
idempotencyKey
|
|
589
|
+
});
|
|
577
590
|
}
|
|
578
591
|
};
|
|
579
592
|
|
|
@@ -768,7 +781,9 @@ var DocumentsResource = class {
|
|
|
768
781
|
}
|
|
769
782
|
/** Every saved text of a document, newest first, with the date each took effect. */
|
|
770
783
|
async versions(slug) {
|
|
771
|
-
return this.http.get(
|
|
784
|
+
return this.http.get(
|
|
785
|
+
`/documents/${encodeURIComponent(slug)}/versions`
|
|
786
|
+
);
|
|
772
787
|
}
|
|
773
788
|
/** The document as it read in one version. */
|
|
774
789
|
async version(slug, version) {
|
|
@@ -852,7 +867,9 @@ var PushResource = class {
|
|
|
852
867
|
async enable(registration) {
|
|
853
868
|
const { vapid_public_key } = await this.status();
|
|
854
869
|
if (!vapid_public_key) {
|
|
855
|
-
throw new Error(
|
|
870
|
+
throw new Error(
|
|
871
|
+
"@takeal/cusfront-sdk: push notifications are not enabled on this deployment"
|
|
872
|
+
);
|
|
856
873
|
}
|
|
857
874
|
const sub = await registration.pushManager.subscribe({
|
|
858
875
|
userVisibleOnly: true,
|
|
@@ -997,7 +1014,9 @@ var DevicesResource = class {
|
|
|
997
1014
|
async registerWebPush(registration, opts = {}) {
|
|
998
1015
|
const key = opts.vapidPublicKey ?? await this.vapidPublicKey();
|
|
999
1016
|
if (!key) {
|
|
1000
|
-
throw new Error(
|
|
1017
|
+
throw new Error(
|
|
1018
|
+
"@takeal/cusfront-sdk: push notifications are not enabled on this deployment"
|
|
1019
|
+
);
|
|
1001
1020
|
}
|
|
1002
1021
|
const sub = await registration.pushManager.subscribe({
|
|
1003
1022
|
userVisibleOnly: true,
|
|
@@ -1126,7 +1145,9 @@ var HistoryResource = class {
|
|
|
1126
1145
|
if (params.limit !== void 0) q.set("limit", String(params.limit));
|
|
1127
1146
|
if (params.lang) q.set("lang", params.lang);
|
|
1128
1147
|
const qs = q.toString();
|
|
1129
|
-
return this.http.get(`/me/history${qs ? `?${qs}` : ""}`, {
|
|
1148
|
+
return this.http.get(`/me/history${qs ? `?${qs}` : ""}`, {
|
|
1149
|
+
signal: params.signal
|
|
1150
|
+
});
|
|
1130
1151
|
}
|
|
1131
1152
|
/** Every entry, page after page, newest first. */
|
|
1132
1153
|
async *all(params = {}) {
|
|
@@ -1151,7 +1172,7 @@ var FundingOptionsResource = class {
|
|
|
1151
1172
|
};
|
|
1152
1173
|
|
|
1153
1174
|
// src/version.ts
|
|
1154
|
-
var SDK_VERSION = "0.
|
|
1175
|
+
var SDK_VERSION = "0.6.1";
|
|
1155
1176
|
|
|
1156
1177
|
// src/client-platform.ts
|
|
1157
1178
|
var CLIENT_HEADER = "X-Takeal-Client";
|
|
@@ -1226,7 +1247,7 @@ function isAbsolute(url) {
|
|
|
1226
1247
|
}
|
|
1227
1248
|
|
|
1228
1249
|
// src/compat.ts
|
|
1229
|
-
var SUPPORTED_MEISTER = ">=0.
|
|
1250
|
+
var SUPPORTED_MEISTER = ">=0.6.4, <0.7.0";
|
|
1230
1251
|
var SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
1231
1252
|
function parse(v) {
|
|
1232
1253
|
const m = SEMVER.exec(v.trim());
|
|
@@ -1391,7 +1412,15 @@ var SECRET_QUERY_WORDS = /* @__PURE__ */ new Set([
|
|
|
1391
1412
|
"cvc",
|
|
1392
1413
|
"iban"
|
|
1393
1414
|
]);
|
|
1394
|
-
var MONEY_KEYS = /* @__PURE__ */ new Set([
|
|
1415
|
+
var MONEY_KEYS = /* @__PURE__ */ new Set([
|
|
1416
|
+
"amount",
|
|
1417
|
+
"amount_minor",
|
|
1418
|
+
"currency",
|
|
1419
|
+
"value",
|
|
1420
|
+
"price",
|
|
1421
|
+
"revenue",
|
|
1422
|
+
"sum"
|
|
1423
|
+
]);
|
|
1395
1424
|
function words(key) {
|
|
1396
1425
|
return key.replace(/^\$+/, "").replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);
|
|
1397
1426
|
}
|
|
@@ -1401,7 +1430,9 @@ function personalKey(key) {
|
|
|
1401
1430
|
if (joined.includes("email") || joined.includes("phone")) return true;
|
|
1402
1431
|
if (w.some((x) => PERSONAL_WORDS.has(x)) || PERSONAL_WORDS.has(joined)) return true;
|
|
1403
1432
|
if (key.startsWith("$")) return false;
|
|
1404
|
-
return w.some(
|
|
1433
|
+
return w.some(
|
|
1434
|
+
(x, i) => x === "name" && (w.length === 1 || PERSON_NAME_QUALIFIERS.has(w[i - 1] ?? ""))
|
|
1435
|
+
);
|
|
1405
1436
|
}
|
|
1406
1437
|
function urlKey(key) {
|
|
1407
1438
|
const k = key.replace(/^\$+/, "").toLowerCase();
|
|
@@ -1438,7 +1469,9 @@ function sanitizeUrl(raw) {
|
|
|
1438
1469
|
const k = words(key);
|
|
1439
1470
|
if (k.some((w) => SECRET_QUERY_WORDS.has(w)) || personalKey(key)) return;
|
|
1440
1471
|
if (redactText(value) !== value) return;
|
|
1441
|
-
query.push(
|
|
1472
|
+
query.push(
|
|
1473
|
+
`${encodeURIComponent(key)}=${isId(value) ? PLACEHOLDER : encodeURIComponent(value)}`
|
|
1474
|
+
);
|
|
1442
1475
|
});
|
|
1443
1476
|
const search = query.length ? `?${query.join("&")}` : "";
|
|
1444
1477
|
return (absolute ? `${u.protocol}//${u.host}` : "") + path + search;
|
|
@@ -1449,13 +1482,17 @@ function cleanValue(key, v, depth) {
|
|
|
1449
1482
|
if (MONEY_KEYS.has(key.toLowerCase()) || UUID_ONLY.test(v)) return v;
|
|
1450
1483
|
if (urlKey(key) || /^https?:\/\//i.test(v)) return sanitizeUrl(v);
|
|
1451
1484
|
if (key === "$elements_chain") {
|
|
1452
|
-
return redactText(v).replace(
|
|
1485
|
+
return redactText(v).replace(
|
|
1486
|
+
/attr__href="([^"]*)"/g,
|
|
1487
|
+
(_, h) => `attr__href="${sanitizeUrl(h)}"`
|
|
1488
|
+
);
|
|
1453
1489
|
}
|
|
1454
1490
|
const r = redactText(v);
|
|
1455
1491
|
return r.replace(/\[(email|number)\]/g, "").trim() === "" && r !== v ? void 0 : r;
|
|
1456
1492
|
}
|
|
1457
1493
|
if (depth > 5) return void 0;
|
|
1458
|
-
if (Array.isArray(v))
|
|
1494
|
+
if (Array.isArray(v))
|
|
1495
|
+
return v.map((x) => cleanValue(key, x, depth + 1)).filter((x) => x !== void 0);
|
|
1459
1496
|
if (typeof v === "object") return sanitizeProperties(v, depth + 1);
|
|
1460
1497
|
return void 0;
|
|
1461
1498
|
}
|
|
@@ -1535,7 +1572,10 @@ function loadPostHogScript(o, config) {
|
|
|
1535
1572
|
return new Promise((resolve) => {
|
|
1536
1573
|
const w = win();
|
|
1537
1574
|
if (!w.document) return resolve(void 0);
|
|
1538
|
-
const placeholder = Object.assign([], {
|
|
1575
|
+
const placeholder = Object.assign([], {
|
|
1576
|
+
__SV: 1,
|
|
1577
|
+
_i: [[o.key, config, "posthog"]]
|
|
1578
|
+
});
|
|
1539
1579
|
w.posthog = placeholder;
|
|
1540
1580
|
injectScript(
|
|
1541
1581
|
`${assetsHost(o)}/static/array.js`,
|
|
@@ -1638,7 +1678,9 @@ function sinks(s) {
|
|
|
1638
1678
|
function initAnalytics(options) {
|
|
1639
1679
|
if (state() || !win().document) return;
|
|
1640
1680
|
if (options.zone !== "public" && win().ym) {
|
|
1641
|
-
console.warn(
|
|
1681
|
+
console.warn(
|
|
1682
|
+
"[analytics] Yandex Metrica is on a page outside the public zone; it must not be."
|
|
1683
|
+
);
|
|
1642
1684
|
}
|
|
1643
1685
|
const s = { options, zone: options.zone };
|
|
1644
1686
|
holder[KEY] = s;
|