docs: added customer storefront guides (#7685)
* added customer guides * fixes to sidebar * remove old customer registration guide * fix build error * generate files * run linter
This commit is contained in:
1 parent
d862d03de0
commit
c1db40b564
80 files changed
+2301
-701
No files matched your search
@@ -57,9 +57,9 @@ const modules = {
|
||||
callbackURL: process.env.GOOGLE_CALLBACK_URL,
|
||||
successRedirectUrl:
|
||||
process.env.GOOGLE_SUCCESS_REDIRECT_URL,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -36,8 +36,8 @@ const modules = {
|
||||
config: {
|
||||
emailpass: {
|
||||
// options...
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -92,4 +92,4 @@ const modules = {
|
||||
|
||||
## Related Guides
|
||||
|
||||
- [How to register a customer using email and password](../../../customer/register-customer-email/page.mdx)
|
||||
- [How to register a customer using email and password](../../../../storefront-development/customers/register/page.mdx)
|
||||
@@ -32,12 +32,12 @@ module.exports = defineConfig({
|
||||
http: {
|
||||
authMethodsPerActor: {
|
||||
user: ["google"],
|
||||
customer: ["emailpass"]
|
||||
customer: ["emailpass"],
|
||||
},
|
||||
// ...
|
||||
},
|
||||
// ...
|
||||
}
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
@@ -32,6 +32,6 @@ There are two ways the returned authentication token is useful:
|
||||
|
||||
<Note title="Example">
|
||||
|
||||
[How to register Customers using the authentication route](../../customer/register-customer-email/page.mdx).
|
||||
[How to register Customers using the authentication route](../../../storefront-development/customers/register/page.mdx).
|
||||
|
||||
</Note>
|
||||
@@ -60,10 +60,10 @@ export const workflowHighlights = [
|
||||
import {
|
||||
createWorkflow,
|
||||
createStep,
|
||||
StepResponse
|
||||
StepResponse,
|
||||
} from "@medusajs/workflows-sdk"
|
||||
import {
|
||||
setAuthAppMetadataStep
|
||||
setAuthAppMetadataStep,
|
||||
} from "@medusajs/core-flows"
|
||||
import ManagerModuleService from "../modules/manager/service"
|
||||
|
||||
@@ -86,7 +86,7 @@ type CreateManagerWorkflowOutput = {
|
||||
const createManagerStep = createStep(
|
||||
"create-manager-step",
|
||||
async ({
|
||||
manager: managerData
|
||||
manager: managerData,
|
||||
}: Pick<CreateManagerWorkflowInput, "manager">,
|
||||
{ container }) => {
|
||||
const managerModuleService: ManagerModuleService =
|
||||
@@ -106,13 +106,13 @@ const createManagerWorkflow = createWorkflow<
|
||||
"create-manager",
|
||||
function (input) {
|
||||
const manager = createManagerStep({
|
||||
manager: input.manager
|
||||
manager: input.manager,
|
||||
})
|
||||
|
||||
setAuthAppMetadataStep({
|
||||
authIdentityId: input.authIdentityId,
|
||||
actorType: "manager",
|
||||
value: manager.id
|
||||
value: manager.id,
|
||||
})
|
||||
|
||||
return manager
|
||||
@@ -146,7 +146,7 @@ export const createRouteHighlights = [
|
||||
```ts title="src/api/manager/route.ts" highlights={createRouteHighlights}
|
||||
import type {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse
|
||||
MedusaResponse,
|
||||
} from "@medusajs/medusa"
|
||||
import { MedusaError } from "@medusajs/utils"
|
||||
import createManagerWorkflow from "../../workflows/create-manager"
|
||||
@@ -174,8 +174,8 @@ export async function POST(
|
||||
.run({
|
||||
input: {
|
||||
manager: req.body,
|
||||
authIdentityId: req.auth_context.auth_identity_id
|
||||
}
|
||||
authIdentityId: req.auth_context.auth_identity_id,
|
||||
},
|
||||
})
|
||||
|
||||
res.status(200).json({ manager: result })
|
||||
@@ -213,7 +213,7 @@ export const config: MiddlewaresConfig = {
|
||||
method: "POST",
|
||||
middlewares: [
|
||||
authenticate("manager", ["session", "bearer"], {
|
||||
allowUnregistered: true
|
||||
allowUnregistered: true,
|
||||
}),
|
||||
],
|
||||
},
|
||||
@@ -239,9 +239,9 @@ For example, create the file `src/api/manager/me/route.ts` with the following co
|
||||
```ts title="src/api/manager/me/route.ts"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse
|
||||
} from "@medusajs/medusa";
|
||||
import ManagerModuleService from "../../../modules/manager/service";
|
||||
MedusaResponse,
|
||||
} from "@medusajs/medusa"
|
||||
import ManagerModuleService from "../../../modules/manager/service"
|
||||
|
||||
export async function GET(
|
||||
req: AuthenticatedMedusaRequest,
|
||||
|
||||
@@ -37,8 +37,8 @@ module.exports = defineConfig({
|
||||
config: {
|
||||
google: {
|
||||
// provider options...
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
@@ -84,11 +84,11 @@ For example:
|
||||
```ts title="src/api/store/custom/route.ts"
|
||||
import {
|
||||
MedusaRequest,
|
||||
MedusaResponse
|
||||
MedusaResponse,
|
||||
} from "@medusajs/medusa"
|
||||
import { IAuthModuleService } from "@medusajs/types"
|
||||
import {
|
||||
ModuleRegistrationName
|
||||
ModuleRegistrationName,
|
||||
} from "@medusajs/modules-sdk"
|
||||
|
||||
export async function GET(
|
||||
@@ -111,7 +111,7 @@ For example:
|
||||
import { SubscriberArgs } from "@medusajs/medusa"
|
||||
import { IAuthModuleService } from "@medusajs/types"
|
||||
import {
|
||||
ModuleRegistrationName
|
||||
ModuleRegistrationName,
|
||||
} from "@medusajs/modules-sdk"
|
||||
|
||||
export default async function subscriberHandler({
|
||||
@@ -131,7 +131,7 @@ For example:
|
||||
import { createStep } from "@medusajs/workflows-sdk"
|
||||
import { IAuthModuleService } from "@medusajs/types"
|
||||
import {
|
||||
ModuleRegistrationName
|
||||
ModuleRegistrationName,
|
||||
} from "@medusajs/modules-sdk"
|
||||
|
||||
const step1 = createStep(
|
||||
|
||||
Reference in new issue
Block a user