@trindtech/utils 1.3.0 → 1.5.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.
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/mailer/index.d.ts +9 -1
- package/dist/mailer/index.d.ts.map +1 -1
- package/dist/mailer/index.js +4 -4
- package/dist/mailer/index.js.map +1 -1
- package/dist/s3/index.d.ts +13 -4
- package/dist/s3/index.d.ts.map +1 -1
- package/dist/s3/index.js +4 -4
- package/dist/s3/index.js.map +1 -1
- package/package.json +26 -1
- package/src/index.ts +0 -4
- package/src/mailer/index.ts +0 -87
- package/src/mailer/templates.ts +0 -48
- package/src/motion/components/canvas-scrub.tsx +0 -110
- package/src/motion/components/count-up.tsx +0 -51
- package/src/motion/components/horizontal-scroll.tsx +0 -58
- package/src/motion/components/logo-marquee.tsx +0 -40
- package/src/motion/components/navbar.tsx +0 -151
- package/src/motion/components/parallax-section.tsx +0 -32
- package/src/motion/components/reveal-on-scroll.tsx +0 -48
- package/src/motion/components/stacked-cards.tsx +0 -82
- package/src/motion/components/text-reveal.tsx +0 -66
- package/src/motion/components/video-scrub.tsx +0 -60
- package/src/motion/index.ts +0 -16
- package/src/motion/providers/motion-provider.tsx +0 -15
- package/src/motion/providers/smooth-scroll-provider.tsx +0 -26
- package/src/motion/types.ts +0 -2
- package/src/s3/index.ts +0 -241
- package/src/validators/countries.ts +0 -94
- package/src/validators/index.ts +0 -257
- package/tsconfig.json +0 -18
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,MAAM,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,MAAM,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,5 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./mailer"), exports);
|
|
18
18
|
__exportStar(require("./validators"), exports);
|
|
19
19
|
__exportStar(require("./s3"), exports);
|
|
20
|
-
__exportStar(require("./motion"), exports);
|
|
21
20
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,+CAA6B;AAC7B,uCAAqB
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,+CAA6B;AAC7B,uCAAqB"}
|
package/dist/mailer/index.d.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
export interface MailerCredentials {
|
|
2
2
|
accessKeyId: string;
|
|
3
3
|
secretAccessKey: string;
|
|
4
|
+
/** Preenchido só por credencial temporária (STS/assume-role). */
|
|
5
|
+
sessionToken?: string;
|
|
4
6
|
}
|
|
5
7
|
export interface MailerConfig {
|
|
6
8
|
region: string;
|
|
7
9
|
from: string;
|
|
8
10
|
appName: string;
|
|
9
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Chaves explícitas. **Omita quando rodar dentro da AWS** (ECS, Lambda,
|
|
13
|
+
* EC2): sem esse campo o SDK usa a default credential provider chain e
|
|
14
|
+
* pega a role da task/função — nenhuma chave de longa duração no
|
|
15
|
+
* ambiente. Fora da AWS (dev local, Vercel), passe as chaves.
|
|
16
|
+
*/
|
|
17
|
+
credentials?: MailerCredentials;
|
|
10
18
|
}
|
|
11
19
|
export interface SendOptions {
|
|
12
20
|
to: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mailer/index.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mailer/index.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,iBAAiB,CAAC;CACjC;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY;kCASJ,WAAW,KAAG,OAAO,CAAC,IAAI,CAAC;gCAwBhE,MAAM,QACJ,MAAM,mBACK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,KACzD,OAAO,CAAC,IAAI,CAAC;iCAaV,MAAM,YACA,MAAM,mBACC,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,KAC7D,OAAO,CAAC,IAAI,CAAC;EAajB"}
|
package/dist/mailer/index.js
CHANGED
|
@@ -4,12 +4,12 @@ exports.createMailer = createMailer;
|
|
|
4
4
|
const client_ses_1 = require("@aws-sdk/client-ses");
|
|
5
5
|
const templates_1 = require("./templates");
|
|
6
6
|
function createMailer(config) {
|
|
7
|
+
// `credentials: undefined` faz o SDK cair na default provider chain
|
|
8
|
+
// (env vars → shared config → container/task role → IMDS). Repassar o
|
|
9
|
+
// objeto inteiro em vez de remontá-lo preserva o sessionToken.
|
|
7
10
|
const client = new client_ses_1.SESClient({
|
|
8
11
|
region: config.region,
|
|
9
|
-
credentials:
|
|
10
|
-
accessKeyId: config.credentials.accessKeyId,
|
|
11
|
-
secretAccessKey: config.credentials.secretAccessKey,
|
|
12
|
-
},
|
|
12
|
+
credentials: config.credentials,
|
|
13
13
|
});
|
|
14
14
|
async function send({ to, subject, html }) {
|
|
15
15
|
const command = new client_ses_1.SendEmailCommand({
|
package/dist/mailer/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mailer/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mailer/index.ts"],"names":[],"mappings":";;AA6BA,oCAiEC;AA9FD,oDAAkE;AAClE,2CAA0E;AA4B1E,SAAgB,YAAY,CAAC,MAAoB;IAC/C,oEAAoE;IACpE,sEAAsE;IACtE,+DAA+D;IAC/D,MAAM,MAAM,GAAG,IAAI,sBAAS,CAAC;QAC3B,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,WAAW,EAAE,MAAM,CAAC,WAAW;KAChC,CAAC,CAAC;IAEH,KAAK,UAAU,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAe;QACpD,MAAM,OAAO,GAAG,IAAI,6BAAgB,CAAC;YACnC,MAAM,EAAE,MAAM,CAAC,IAAI;YACnB,WAAW,EAAE;gBACX,WAAW,EAAE,CAAC,EAAE,CAAC;aAClB;YACD,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,IAAI,EAAE,OAAO;oBACb,OAAO,EAAE,OAAO;iBACjB;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE;wBACJ,IAAI,EAAE,IAAI;wBACV,OAAO,EAAE,OAAO;qBACjB;iBACF;aACF;SACF,CAAC,CAAC;QAEH,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAED,KAAK,UAAU,qBAAqB,CAClC,EAAU,EACV,IAAY,EACZ,cAA0D;QAE1D,MAAM,IAAI,GAAG,cAAc;YACzB,CAAC,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC;YACtC,CAAC,CAAC,IAAA,gCAAoB,EAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAE/C,MAAM,IAAI,CAAC;YACT,EAAE;YACF,OAAO,EAAE,+BAA+B,MAAM,CAAC,OAAO,EAAE;YACxD,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED,KAAK,UAAU,sBAAsB,CACnC,EAAU,EACV,QAAgB,EAChB,cAA8D;QAE9D,MAAM,IAAI,GAAG,cAAc;YACzB,CAAC,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC;YAC1C,CAAC,CAAC,IAAA,iCAAqB,EAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAEpD,MAAM,IAAI,CAAC;YACT,EAAE;YACF,OAAO,EAAE,0BAA0B,MAAM,CAAC,OAAO,EAAE;YACnD,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,CAAC;AACjE,CAAC"}
|
package/dist/s3/index.d.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
export interface S3Credentials {
|
|
2
|
+
accessKeyId: string;
|
|
3
|
+
secretAccessKey: string;
|
|
4
|
+
/** Preenchido só por credencial temporária (STS/assume-role). */
|
|
5
|
+
sessionToken?: string;
|
|
6
|
+
}
|
|
1
7
|
export interface S3Config {
|
|
2
8
|
bucket: string;
|
|
3
9
|
region: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Chaves explícitas. **Omita quando rodar dentro da AWS** (ECS, Lambda,
|
|
12
|
+
* EC2): sem esse campo o SDK usa a default credential provider chain e
|
|
13
|
+
* pega a role da task/função — nenhuma chave de longa duração no
|
|
14
|
+
* ambiente. Fora da AWS (dev local, Vercel), passe as chaves.
|
|
15
|
+
*/
|
|
16
|
+
credentials?: S3Credentials;
|
|
8
17
|
}
|
|
9
18
|
export interface PresignedUploadOptions {
|
|
10
19
|
key: string;
|
package/dist/s3/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/s3/index.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/s3/index.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,WAAW,CAAC,EAAE,aAAa,CAAC;CAC7B;AAED,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAWD,eAAO,MAAM,qBAAqB,UAIjC,CAAC;AAeF;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,QAAQ;qCA8ClC,sBAAsB,KAC9B,OAAO,CAAC;QACT,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;mCAgC0C,oBAAoB,KAAG,OAAO,CAAC;QACzE,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;kBAyByB,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;kBAqBtB,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;0BA6BvB,MAAM,YAAY,MAAM,KAAG,MAAM;;EAe/D"}
|
package/dist/s3/index.js
CHANGED
|
@@ -34,12 +34,12 @@ const DEFAULT_MAX_SIZES = {
|
|
|
34
34
|
* O bucket deve ser privado — todos os acessos são feitos via presigned URLs.
|
|
35
35
|
*/
|
|
36
36
|
function createS3Client(config) {
|
|
37
|
+
// `credentials: undefined` faz o SDK cair na default provider chain
|
|
38
|
+
// (env vars → shared config → container/task role → IMDS). Repassar o
|
|
39
|
+
// objeto inteiro em vez de remontá-lo preserva o sessionToken.
|
|
37
40
|
const client = new client_s3_1.S3Client({
|
|
38
41
|
region: config.region,
|
|
39
|
-
credentials:
|
|
40
|
-
accessKeyId: config.credentials.accessKeyId,
|
|
41
|
-
secretAccessKey: config.credentials.secretAccessKey,
|
|
42
|
-
},
|
|
42
|
+
credentials: config.credentials,
|
|
43
43
|
});
|
|
44
44
|
// ─── Validação ──────────────────────────────────────────────────────────────
|
|
45
45
|
function validateContentType(contentType) {
|
package/dist/s3/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/s3/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/s3/index.ts"],"names":[],"mappings":";;;AAyEA,wCAiLC;AA1PD,kDAI4B;AAC5B,kDAAwE;AACxE,wEAA6D;AAmC7D,MAAM,mBA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AG,EAAE,CAAC;QAC7B,OAAO,GAAG,MAAM,IAAI,IAAI,IAAI,SAAS,IAAI,GAAG,EAAE,CAAC;IACjD,CAAC;IAED,OAAO;QACL,qBAAqB;QACrB,mBAAmB;QACnB,MAAM;QACN,MAAM;QACN,WAAW;QACX,qBAAqB,EAArB,6BAAqB;KACtB,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trindtech/utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"default": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./motion": {
|
|
12
|
+
"types": "./dist/motion/index.d.ts",
|
|
13
|
+
"default": "./dist/motion/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./s3": {
|
|
16
|
+
"types": "./dist/s3/index.d.ts",
|
|
17
|
+
"default": "./dist/s3/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./mailer": {
|
|
20
|
+
"types": "./dist/mailer/index.d.ts",
|
|
21
|
+
"default": "./dist/mailer/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./validators": {
|
|
24
|
+
"types": "./dist/validators/index.d.ts",
|
|
25
|
+
"default": "./dist/validators/index.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
6
31
|
"publishConfig": {
|
|
7
32
|
"registry": "https://registry.npmjs.org",
|
|
8
33
|
"access": "public"
|
package/src/index.ts
DELETED
package/src/mailer/index.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { SESClient, SendEmailCommand } from "@aws-sdk/client-ses";
|
|
2
|
-
import { verificationTemplate, resetPasswordTemplate } from "./templates";
|
|
3
|
-
|
|
4
|
-
export interface MailerCredentials {
|
|
5
|
-
accessKeyId: string;
|
|
6
|
-
secretAccessKey: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface MailerConfig {
|
|
10
|
-
region: string;
|
|
11
|
-
from: string;
|
|
12
|
-
appName: string;
|
|
13
|
-
credentials: MailerCredentials;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface SendOptions {
|
|
17
|
-
to: string;
|
|
18
|
-
subject: string;
|
|
19
|
-
html: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function createMailer(config: MailerConfig) {
|
|
23
|
-
const client = new SESClient({
|
|
24
|
-
region: config.region,
|
|
25
|
-
credentials: {
|
|
26
|
-
accessKeyId: config.credentials.accessKeyId,
|
|
27
|
-
secretAccessKey: config.credentials.secretAccessKey,
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
async function send({ to, subject, html }: SendOptions): Promise<void> {
|
|
32
|
-
const command = new SendEmailCommand({
|
|
33
|
-
Source: config.from,
|
|
34
|
-
Destination: {
|
|
35
|
-
ToAddresses: [to],
|
|
36
|
-
},
|
|
37
|
-
Message: {
|
|
38
|
-
Subject: {
|
|
39
|
-
Data: subject,
|
|
40
|
-
Charset: "UTF-8",
|
|
41
|
-
},
|
|
42
|
-
Body: {
|
|
43
|
-
Html: {
|
|
44
|
-
Data: html,
|
|
45
|
-
Charset: "UTF-8",
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
await client.send(command);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async function sendVerificationEmail(
|
|
55
|
-
to: string,
|
|
56
|
-
code: string,
|
|
57
|
-
customTemplate?: (code: string, appName: string) => string
|
|
58
|
-
): Promise<void> {
|
|
59
|
-
const html = customTemplate
|
|
60
|
-
? customTemplate(code, config.appName)
|
|
61
|
-
: verificationTemplate(code, config.appName);
|
|
62
|
-
|
|
63
|
-
await send({
|
|
64
|
-
to,
|
|
65
|
-
subject: `Seu código de verificação — ${config.appName}`,
|
|
66
|
-
html,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async function sendResetPasswordEmail(
|
|
71
|
-
to: string,
|
|
72
|
-
resetUrl: string,
|
|
73
|
-
customTemplate?: (resetUrl: string, appName: string) => string
|
|
74
|
-
): Promise<void> {
|
|
75
|
-
const html = customTemplate
|
|
76
|
-
? customTemplate(resetUrl, config.appName)
|
|
77
|
-
: resetPasswordTemplate(resetUrl, config.appName);
|
|
78
|
-
|
|
79
|
-
await send({
|
|
80
|
-
to,
|
|
81
|
-
subject: `Redefinição de senha — ${config.appName}`,
|
|
82
|
-
html,
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return { send, sendVerificationEmail, sendResetPasswordEmail };
|
|
87
|
-
}
|
package/src/mailer/templates.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export function verificationTemplate(code: string, appName: string): string {
|
|
2
|
-
return `
|
|
3
|
-
<div style="font-family: sans-serif; max-width: 480px; margin: 0 auto;">
|
|
4
|
-
<h2>Verifique seu e-mail — ${appName}</h2>
|
|
5
|
-
<p>Use o código abaixo para confirmar seu cadastro:</p>
|
|
6
|
-
<div style="
|
|
7
|
-
font-size: 32px;
|
|
8
|
-
font-weight: bold;
|
|
9
|
-
letter-spacing: 8px;
|
|
10
|
-
padding: 16px;
|
|
11
|
-
background: #f4f4f4;
|
|
12
|
-
border-radius: 8px;
|
|
13
|
-
text-align: center;
|
|
14
|
-
">
|
|
15
|
-
${code}
|
|
16
|
-
</div>
|
|
17
|
-
<p style="color: #666; font-size: 13px; margin-top: 16px;">
|
|
18
|
-
Este código expira em 60 minutos. Não compartilhe com ninguém.
|
|
19
|
-
</p>
|
|
20
|
-
</div>
|
|
21
|
-
`;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function resetPasswordTemplate(
|
|
25
|
-
resetUrl: string,
|
|
26
|
-
appName: string
|
|
27
|
-
): string {
|
|
28
|
-
return `
|
|
29
|
-
<div style="font-family: sans-serif; max-width: 480px; margin: 0 auto;">
|
|
30
|
-
<h2>Redefinição de senha — ${appName}</h2>
|
|
31
|
-
<p>Clique no botão abaixo para redefinir sua senha:</p>
|
|
32
|
-
<a href="${resetUrl}" style="
|
|
33
|
-
display: inline-block;
|
|
34
|
-
padding: 12px 24px;
|
|
35
|
-
background: #000;
|
|
36
|
-
color: #fff;
|
|
37
|
-
text-decoration: none;
|
|
38
|
-
border-radius: 6px;
|
|
39
|
-
margin: 16px 0;
|
|
40
|
-
">
|
|
41
|
-
Redefinir senha
|
|
42
|
-
</a>
|
|
43
|
-
<p style="color: #666; font-size: 13px;">
|
|
44
|
-
Este link expira em 1 hora. Se você não solicitou isso, ignore este e-mail.
|
|
45
|
-
</p>
|
|
46
|
-
</div>
|
|
47
|
-
`;
|
|
48
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
import { useEffect, useRef } from "react"
|
|
3
|
-
import gsap from "gsap"
|
|
4
|
-
import { ScrollTrigger } from "gsap/ScrollTrigger"
|
|
5
|
-
|
|
6
|
-
gsap.registerPlugin(ScrollTrigger)
|
|
7
|
-
|
|
8
|
-
interface Props {
|
|
9
|
-
/** Total de frames na sequência */
|
|
10
|
-
frameCount: number
|
|
11
|
-
/** Função que retorna a URL de cada frame pelo índice */
|
|
12
|
-
getFrameUrl: (index: number) => string
|
|
13
|
-
/** Altura total de scroll para a animação — padrão: "300vh" */
|
|
14
|
-
scrollHeight?: string
|
|
15
|
-
/** Imagem de fallback para mobile e prefers-reduced-motion */
|
|
16
|
-
fallbackSrc?: string
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Scrub de sequência de imagens ao estilo Apple.
|
|
21
|
-
* No mobile e com prefers-reduced-motion, exibe fallbackSrc estático.
|
|
22
|
-
*
|
|
23
|
-
* Convenção de frames: /public/frames/frame-001.webp ... frame-NNN.webp
|
|
24
|
-
* Ferramenta para extrair frames de vídeo: https://frame-extractor.com
|
|
25
|
-
* Recomendado: 60–120 frames, 1280×720, webp, <50kb cada
|
|
26
|
-
*/
|
|
27
|
-
export function CanvasScrub({
|
|
28
|
-
frameCount,
|
|
29
|
-
getFrameUrl,
|
|
30
|
-
scrollHeight = "300vh",
|
|
31
|
-
fallbackSrc,
|
|
32
|
-
}: Props) {
|
|
33
|
-
const canvasRef = useRef<HTMLCanvasElement>(null)
|
|
34
|
-
const containerRef = useRef<HTMLDivElement>(null)
|
|
35
|
-
const frameRef = useRef({ frame: 0 })
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
const isMobile = window.innerWidth < 768
|
|
39
|
-
const prefersReduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
40
|
-
if (isMobile || prefersReduced) return
|
|
41
|
-
|
|
42
|
-
const canvas = canvasRef.current!
|
|
43
|
-
const ctx = canvas.getContext("2d")!
|
|
44
|
-
const images: HTMLImageElement[] = []
|
|
45
|
-
let loaded = 0
|
|
46
|
-
|
|
47
|
-
const resize = () => {
|
|
48
|
-
canvas.width = window.innerWidth
|
|
49
|
-
canvas.height = window.innerHeight
|
|
50
|
-
}
|
|
51
|
-
resize()
|
|
52
|
-
window.addEventListener("resize", resize)
|
|
53
|
-
|
|
54
|
-
function draw(index: number) {
|
|
55
|
-
const img = images[Math.min(Math.round(index), frameCount - 1)]
|
|
56
|
-
if (!img?.complete) return
|
|
57
|
-
const scale = Math.max(canvas.width / img.width, canvas.height / img.height)
|
|
58
|
-
const x = (canvas.width - img.width * scale) / 2
|
|
59
|
-
const y = (canvas.height - img.height * scale) / 2
|
|
60
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height)
|
|
61
|
-
ctx.drawImage(img, x, y, img.width * scale, img.height * scale)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function start() {
|
|
65
|
-
draw(0)
|
|
66
|
-
gsap.to(frameRef.current, {
|
|
67
|
-
frame: frameCount - 1,
|
|
68
|
-
snap: "frame",
|
|
69
|
-
ease: "none",
|
|
70
|
-
scrollTrigger: {
|
|
71
|
-
trigger: containerRef.current,
|
|
72
|
-
start: "top top",
|
|
73
|
-
end: "bottom bottom",
|
|
74
|
-
scrub: 1,
|
|
75
|
-
invalidateOnRefresh: true,
|
|
76
|
-
onUpdate: () => draw(frameRef.current.frame),
|
|
77
|
-
},
|
|
78
|
-
})
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
for (let i = 0; i < frameCount; i++) {
|
|
82
|
-
const img = new Image()
|
|
83
|
-
img.src = getFrameUrl(i)
|
|
84
|
-
img.onload = () => { if (++loaded === frameCount) start() }
|
|
85
|
-
images.push(img)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return () => {
|
|
89
|
-
window.removeEventListener("resize", resize)
|
|
90
|
-
ScrollTrigger.getAll().forEach((t) => t.kill())
|
|
91
|
-
}
|
|
92
|
-
}, [frameCount, getFrameUrl])
|
|
93
|
-
|
|
94
|
-
return (
|
|
95
|
-
<div ref={containerRef} style={{ height: scrollHeight }} className="relative">
|
|
96
|
-
{/* Mobile / reduced-motion fallback */}
|
|
97
|
-
{fallbackSrc && (
|
|
98
|
-
<div className="md:hidden sticky top-0 h-screen w-full">
|
|
99
|
-
<img src={fallbackSrc} alt="" className="h-full w-full object-cover" />
|
|
100
|
-
</div>
|
|
101
|
-
)}
|
|
102
|
-
{/* Desktop canvas */}
|
|
103
|
-
<canvas
|
|
104
|
-
ref={canvasRef}
|
|
105
|
-
className="hidden md:block sticky top-0 h-screen w-full"
|
|
106
|
-
aria-hidden="true"
|
|
107
|
-
/>
|
|
108
|
-
</div>
|
|
109
|
-
)
|
|
110
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
import { useEffect, useRef, useState } from "react"
|
|
3
|
-
import { useInView } from "motion/react"
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
/** Valor final */
|
|
7
|
-
end: number
|
|
8
|
-
/** Duração em ms — padrão: 2000 */
|
|
9
|
-
duration?: number
|
|
10
|
-
prefix?: string
|
|
11
|
-
suffix?: string
|
|
12
|
-
className?: string
|
|
13
|
-
/** Locale para formatação — padrão: "pt-BR" */
|
|
14
|
-
locale?: string
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/** Contador animado que dispara quando entra no viewport */
|
|
18
|
-
export function CountUp({
|
|
19
|
-
end,
|
|
20
|
-
duration = 2000,
|
|
21
|
-
prefix = "",
|
|
22
|
-
suffix = "",
|
|
23
|
-
className,
|
|
24
|
-
locale = "pt-BR",
|
|
25
|
-
}: Props) {
|
|
26
|
-
const ref = useRef<HTMLSpanElement>(null)
|
|
27
|
-
const isInView = useInView(ref, { once: true, margin: "-10% 0px" })
|
|
28
|
-
const [value, setValue] = useState(0)
|
|
29
|
-
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (!isInView) return
|
|
32
|
-
const prefersReduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
33
|
-
if (prefersReduced) { setValue(end); return }
|
|
34
|
-
|
|
35
|
-
const start = performance.now()
|
|
36
|
-
const step = (now: number) => {
|
|
37
|
-
const progress = Math.min((now - start) / duration, 1)
|
|
38
|
-
const eased = 1 - Math.pow(1 - progress, 3)
|
|
39
|
-
setValue(Math.floor(eased * end))
|
|
40
|
-
if (progress < 1) requestAnimationFrame(step)
|
|
41
|
-
else setValue(end)
|
|
42
|
-
}
|
|
43
|
-
requestAnimationFrame(step)
|
|
44
|
-
}, [isInView, end, duration])
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<span ref={ref} className={className}>
|
|
48
|
-
{prefix}{value.toLocaleString(locale)}{suffix}
|
|
49
|
-
</span>
|
|
50
|
-
)
|
|
51
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
import { useRef } from "react"
|
|
3
|
-
import gsap from "gsap"
|
|
4
|
-
import { ScrollTrigger } from "gsap/ScrollTrigger"
|
|
5
|
-
import { useGSAP } from "@gsap/react"
|
|
6
|
-
|
|
7
|
-
gsap.registerPlugin(ScrollTrigger)
|
|
8
|
-
|
|
9
|
-
interface Props {
|
|
10
|
-
children: React.ReactNode
|
|
11
|
-
className?: string
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Cards scrollam horizontalmente enquanto o usuário scrolla para baixo.
|
|
16
|
-
* Tela fica pinada até o último card passar.
|
|
17
|
-
*/
|
|
18
|
-
export function HorizontalScroll({ children, className }: Props) {
|
|
19
|
-
const containerRef = useRef<HTMLDivElement>(null)
|
|
20
|
-
const trackRef = useRef<HTMLDivElement>(null)
|
|
21
|
-
|
|
22
|
-
useGSAP(() => {
|
|
23
|
-
const prefersReduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
24
|
-
if (prefersReduced) return
|
|
25
|
-
|
|
26
|
-
const track = trackRef.current!
|
|
27
|
-
const getWidth = () => track.scrollWidth - window.innerWidth
|
|
28
|
-
|
|
29
|
-
const ctx = gsap.context(() => {
|
|
30
|
-
gsap.to(track, {
|
|
31
|
-
x: () => -getWidth(),
|
|
32
|
-
ease: "none",
|
|
33
|
-
scrollTrigger: {
|
|
34
|
-
trigger: containerRef.current,
|
|
35
|
-
start: "top top",
|
|
36
|
-
end: () => `+=${getWidth()}`,
|
|
37
|
-
scrub: 1,
|
|
38
|
-
pin: true,
|
|
39
|
-
anticipatePin: 1,
|
|
40
|
-
invalidateOnRefresh: true,
|
|
41
|
-
},
|
|
42
|
-
})
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
return () => ctx.revert()
|
|
46
|
-
}, { scope: containerRef })
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<div ref={containerRef} className={`overflow-hidden ${className ?? ""}`}>
|
|
50
|
-
<div
|
|
51
|
-
ref={trackRef}
|
|
52
|
-
className="flex w-max gap-6 px-4 md:gap-8 md:px-10"
|
|
53
|
-
>
|
|
54
|
-
{children}
|
|
55
|
-
</div>
|
|
56
|
-
</div>
|
|
57
|
-
)
|
|
58
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
interface Props {
|
|
4
|
-
children: React.ReactNode
|
|
5
|
-
speed?: "slow" | "normal" | "fast"
|
|
6
|
-
direction?: "left" | "right"
|
|
7
|
-
className?: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const speedMap = { slow: "60s", normal: "40s", fast: "20s" }
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Strip infinito de logos/itens com scroll automático.
|
|
14
|
-
* Pausa no hover.
|
|
15
|
-
*
|
|
16
|
-
* Requer no tailwind.config.ts:
|
|
17
|
-
* animation: { marquee: "marquee linear infinite" }
|
|
18
|
-
* keyframes: { marquee: { from: { transform: "translateX(0)" }, to: { transform: "translateX(-50%)" } } }
|
|
19
|
-
*/
|
|
20
|
-
export function LogoMarquee({
|
|
21
|
-
children,
|
|
22
|
-
speed = "normal",
|
|
23
|
-
direction = "left",
|
|
24
|
-
className,
|
|
25
|
-
}: Props) {
|
|
26
|
-
return (
|
|
27
|
-
<div className={`overflow-hidden ${className ?? ""}`}>
|
|
28
|
-
<div
|
|
29
|
-
className="flex w-max gap-8 animate-marquee hover:[animation-play-state:paused] md:gap-12"
|
|
30
|
-
style={{
|
|
31
|
-
animationDuration: speedMap[speed],
|
|
32
|
-
animationDirection: direction === "right" ? "reverse" : "normal",
|
|
33
|
-
}}
|
|
34
|
-
>
|
|
35
|
-
{children}
|
|
36
|
-
{children}
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
)
|
|
40
|
-
}
|