@salesforce/webapp-template-app-react-template-b2x-experimental 1.45.1 → 1.46.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/dist/CHANGELOG.md +16 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/lib/data-sdk.ts +21 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/ChangePassword.tsx +10 -5
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/ForgotPassword.tsx +10 -5
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/Login.tsx +12 -7
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/Register.tsx +15 -7
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/ResetPassword.tsx +10 -5
- package/dist/package.json +1 -1
- package/package.json +2 -2
package/dist/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.46.1](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.46.0...v1.46.1) (2026-02-20)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @salesforce/webapp-template-base-sfdx-project-experimental
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [1.46.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.45.1...v1.46.0) (2026-02-20)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @salesforce/webapp-template-base-sfdx-project-experimental
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [1.45.1](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.45.0...v1.45.1) (2026-02-20)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @salesforce/webapp-template-base-sfdx-project-experimental
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createDataSDK, type DataSDK } from "@salesforce/sdk-data";
|
|
2
|
+
|
|
3
|
+
type FetchableSDK = DataSDK & { fetch: typeof fetch };
|
|
4
|
+
|
|
5
|
+
let sdkPromise: Promise<FetchableSDK> | null = null;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns a singleton DataSDK instance with a guaranteed fetch method.
|
|
9
|
+
* Lazily initialized on first call; subsequent calls return the same instance.
|
|
10
|
+
*/
|
|
11
|
+
export function getDataSDK(): Promise<FetchableSDK> {
|
|
12
|
+
if (!sdkPromise) {
|
|
13
|
+
sdkPromise = createDataSDK().then((sdk) => {
|
|
14
|
+
if (!sdk.fetch) {
|
|
15
|
+
throw new Error("DataSDK fetch is not available on this surface.");
|
|
16
|
+
}
|
|
17
|
+
return sdk as FetchableSDK;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return sdkPromise;
|
|
21
|
+
}
|
package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/ChangePassword.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
import { Link } from "react-router";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { uiApiClient } from "@salesforce/webapp-experimental/api";
|
|
5
4
|
import { CenteredPageLayout } from "../components/layout/centered-page-layout";
|
|
6
5
|
import { AuthForm } from "../components/forms/auth-form";
|
|
7
6
|
import { useAppForm } from "../hooks/form";
|
|
7
|
+
import { getDataSDK } from "../lib/data-sdk";
|
|
8
8
|
import { ROUTES, AUTH_PLACEHOLDERS } from "../components/auth/authenticationConfig";
|
|
9
9
|
import { newPasswordSchema } from "../components/auth/authHelpers";
|
|
10
10
|
import { handleApiResponse, getErrorMessage } from "../utils/helpers";
|
|
@@ -28,13 +28,18 @@ export default function ChangePassword() {
|
|
|
28
28
|
try {
|
|
29
29
|
// [Dev Note] Custom Apex Endpoint: /auth/change-password
|
|
30
30
|
// You must ensure this Apex class exists in your org
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const sdk = await getDataSDK();
|
|
32
|
+
const response = await sdk.fetch("/sfdcapi/services/apexrest/auth/change-password", {
|
|
33
|
+
method: "POST",
|
|
34
|
+
body: JSON.stringify({
|
|
34
35
|
currentPassword: formFieldValues.currentPassword,
|
|
35
36
|
newPassword: formFieldValues.newPassword,
|
|
37
|
+
}),
|
|
38
|
+
headers: {
|
|
39
|
+
"Content-Type": "application/json",
|
|
40
|
+
Accept: "application/json",
|
|
36
41
|
},
|
|
37
|
-
);
|
|
42
|
+
});
|
|
38
43
|
await handleApiResponse(response, "Password change failed");
|
|
39
44
|
setSuccess(true);
|
|
40
45
|
form.reset();
|
package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/ForgotPassword.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { uiApiClient } from "@salesforce/webapp-experimental/api";
|
|
4
3
|
import { CenteredPageLayout } from "../components/layout/centered-page-layout";
|
|
5
4
|
import { AuthForm } from "../components/forms/auth-form";
|
|
6
5
|
import { useAppForm } from "../hooks/form";
|
|
6
|
+
import { getDataSDK } from "../lib/data-sdk";
|
|
7
7
|
import { ROUTES, AUTH_PLACEHOLDERS } from "../components/auth/authenticationConfig";
|
|
8
8
|
import { handleApiResponse, getErrorMessage } from "../utils/helpers";
|
|
9
9
|
|
|
@@ -24,10 +24,15 @@ export default function ForgotPassword() {
|
|
|
24
24
|
try {
|
|
25
25
|
// [Dev Note] Custom Apex Endpoint: /auth/forgot-password
|
|
26
26
|
// You must ensure this Apex class exists in your org
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
const sdk = await getDataSDK();
|
|
28
|
+
const response = await sdk.fetch("/sfdcapi/services/apexrest/auth/forgot-password", {
|
|
29
|
+
method: "POST",
|
|
30
|
+
body: JSON.stringify({ username: value.username.trim() }),
|
|
31
|
+
headers: {
|
|
32
|
+
"Content-Type": "application/json",
|
|
33
|
+
Accept: "application/json",
|
|
34
|
+
},
|
|
35
|
+
});
|
|
31
36
|
await handleApiResponse(response, "Failed to send reset link");
|
|
32
37
|
setSuccess(true);
|
|
33
38
|
} catch (err) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
import { useNavigate, useSearchParams, Link } from "react-router";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { uiApiClient } from "@salesforce/webapp-experimental/api";
|
|
5
4
|
import { CenteredPageLayout } from "../components/layout/centered-page-layout";
|
|
6
5
|
import { AuthForm } from "../components/forms/auth-form";
|
|
7
6
|
import { useAppForm } from "../hooks/form";
|
|
7
|
+
import { getDataSDK } from "../lib/data-sdk";
|
|
8
8
|
import { ROUTES } from "../components/auth/authenticationConfig";
|
|
9
9
|
import { emailSchema, getStartUrl, type AuthResponse } from "../components/auth/authHelpers";
|
|
10
10
|
import { handleApiResponse, getErrorMessage } from "../utils/helpers";
|
|
@@ -26,18 +26,23 @@ export default function Login() {
|
|
|
26
26
|
setSubmitError(null);
|
|
27
27
|
try {
|
|
28
28
|
// [Dev Note] Salesforce Integration:
|
|
29
|
-
// We use
|
|
30
|
-
// "/sfdcapi/services/apexrest/auth/login" refers to a custom Apex
|
|
29
|
+
// We use the Data SDK fetch to make an authenticated (or guest) call to Salesforce.
|
|
30
|
+
// "/sfdcapi/services/apexrest/auth/login" refers to a custom Apex REST resource.
|
|
31
31
|
// You must ensure this Apex class exists in your org and handles the login logic
|
|
32
32
|
// (e.g., creating a session or returning a token).
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
const sdk = await getDataSDK();
|
|
34
|
+
const response = await sdk.fetch("/sfdcapi/services/apexrest/auth/login", {
|
|
35
|
+
method: "POST",
|
|
36
|
+
body: JSON.stringify({
|
|
36
37
|
email: value.email.trim().toLowerCase(),
|
|
37
38
|
password: value.password,
|
|
38
39
|
startUrl: getStartUrl(searchParams),
|
|
40
|
+
}),
|
|
41
|
+
headers: {
|
|
42
|
+
"Content-Type": "application/json",
|
|
43
|
+
Accept: "application/json",
|
|
39
44
|
},
|
|
40
|
-
);
|
|
45
|
+
});
|
|
41
46
|
const result = await handleApiResponse<AuthResponse>(response, "Login failed");
|
|
42
47
|
if (result?.redirectUrl) {
|
|
43
48
|
// Hard navigate to the URL which establishes the server session cookie
|
package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/Register.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
import { useNavigate, useSearchParams } from "react-router";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { uiApiClient } from "@salesforce/webapp-experimental/api";
|
|
5
4
|
import { CenteredPageLayout } from "../components/layout/centered-page-layout";
|
|
6
5
|
import { AuthForm } from "../components/forms/auth-form";
|
|
7
6
|
import { useAppForm } from "../hooks/form";
|
|
7
|
+
import { getDataSDK } from "../lib/data-sdk";
|
|
8
8
|
import { ROUTES, AUTH_PLACEHOLDERS } from "../components/auth/authenticationConfig";
|
|
9
9
|
import {
|
|
10
10
|
emailSchema,
|
|
@@ -46,13 +46,21 @@ export default function Register() {
|
|
|
46
46
|
onSubmit: async ({ value: formFieldValues }) => {
|
|
47
47
|
setSubmitError(null);
|
|
48
48
|
try {
|
|
49
|
-
// [Dev Note]
|
|
50
|
-
//
|
|
49
|
+
// [Dev Note] Salesforce Integration:
|
|
50
|
+
// We use the Data SDK fetch to make an authenticated (or guest) call to Salesforce.
|
|
51
|
+
// "/sfdcapi/services/apexrest/auth/register" refers to a custom Apex Class exposed as a REST resource.
|
|
52
|
+
// You must ensure this Apex class exists in your org and handles registration
|
|
53
|
+
// (e.g., duplicate checks and user creation such as Site.createExternalUser).
|
|
51
54
|
const { confirmPassword, ...request } = formFieldValues;
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
const sdk = await getDataSDK();
|
|
56
|
+
const response = await sdk.fetch("/sfdcapi/services/apexrest/auth/register", {
|
|
57
|
+
method: "POST",
|
|
58
|
+
body: JSON.stringify({ request }),
|
|
59
|
+
headers: {
|
|
60
|
+
"Content-Type": "application/json",
|
|
61
|
+
Accept: "application/json",
|
|
62
|
+
},
|
|
63
|
+
});
|
|
56
64
|
const result = await handleApiResponse<AuthResponse>(response, "Registration failed");
|
|
57
65
|
if (result?.redirectUrl) {
|
|
58
66
|
// Hard navigate to the URL which logs the new user in
|
package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/ResetPassword.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
import { Link, useSearchParams } from "react-router";
|
|
3
|
-
import { uiApiClient } from "@salesforce/webapp-experimental/api";
|
|
4
3
|
import { CardLayout } from "../components/layout/card-layout";
|
|
5
4
|
import { CenteredPageLayout } from "../components/layout/centered-page-layout";
|
|
6
5
|
import { AuthForm } from "../components/forms/auth-form";
|
|
7
6
|
import { StatusAlert } from "../components/alerts/status-alert";
|
|
8
7
|
import { useAppForm } from "../hooks/form";
|
|
8
|
+
import { getDataSDK } from "../lib/data-sdk";
|
|
9
9
|
import { ROUTES, AUTH_PLACEHOLDERS } from "../components/auth/authenticationConfig";
|
|
10
10
|
import { newPasswordSchema } from "../components/auth/authHelpers";
|
|
11
11
|
import { handleApiResponse, getErrorMessage } from "../utils/helpers";
|
|
@@ -25,10 +25,15 @@ export default function ResetPassword() {
|
|
|
25
25
|
try {
|
|
26
26
|
// [Dev Note] Custom Apex Endpoint: /auth/reset-password
|
|
27
27
|
// You must ensure this Apex class exists in your org
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
const sdk = await getDataSDK();
|
|
29
|
+
const response = await sdk.fetch("/sfdcapi/services/apexrest/auth/reset-password", {
|
|
30
|
+
method: "POST",
|
|
31
|
+
body: JSON.stringify({ token, newPassword: value.newPassword }),
|
|
32
|
+
headers: {
|
|
33
|
+
"Content-Type": "application/json",
|
|
34
|
+
Accept: "application/json",
|
|
35
|
+
},
|
|
36
|
+
});
|
|
32
37
|
await handleApiResponse(response, "Password reset failed");
|
|
33
38
|
setSuccess(true);
|
|
34
39
|
// Scroll to top of page after successful submission so user sees it
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/webapp-template-app-react-template-b2x-experimental",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.46.1",
|
|
4
4
|
"description": "Base reference app template",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "9d00ba69ff791509b15fdf2f36c10700d612ca5b"
|
|
41
41
|
}
|