🧙♂️
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { User as MedusaUser } from "@medusajs/medusa/dist"; | |
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm"; | |
import { Entity as MedusaEntity } from "medusa-extender"; | |
import { Store } from "../../store/entities/store.entity"; | |
@MedusaEntity({ override: MedusaUser }) | |
@Entity() | |
export class User extends MedusaUser { | |
@Index() | |
@Column({ nullable: true, type: "text" }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { UserRepository as MedusaUserRepository } from "@medusajs/medusa/dist/repositories/user"; | |
import { Repository as MedusaRepository, Utils } from "medusa-extender"; | |
import { EntityRepository } from "typeorm"; | |
import { User } from "../entities/user.entity"; | |
@MedusaRepository({ override: MedusaUserRepository }) | |
@EntityRepository(User) | |
export default class UserRepository extends Utils.repositoryMixin< | |
User, | |
MedusaUserRepository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Migration } from "medusa-extender"; | |
import { MigrationInterface, QueryRunner } from "typeorm"; | |
@Migration() | |
export default class addStoreIdToUser1672134240438 | |
implements MigrationInterface | |
{ | |
name = "addStoreIdToUser1672134240438"; | |
public async up(queryRunner: QueryRunner): Promise<void> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Service } from "medusa-extender"; | |
import { EntityManager, FindConditions } from "typeorm"; | |
import EventBusService from "@medusajs/medusa/dist/services/event-bus"; | |
import { FindConfig } from "@medusajs/medusa/dist/types/common"; | |
import { | |
AnalyticsConfigService, | |
UserService as MedusaUserService, | |
} from "@medusajs/medusa/dist/services"; | |
import { User } from "../entities/user.entity"; | |
import UserRepository from "../repositories/user.repository"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Store as MedusaStore } from "@medusajs/medusa/dist"; | |
import { Column, Entity, JoinColumn, OneToMany } from "typeorm"; | |
import { Entity as MedusaEntity } from "medusa-extender"; | |
import { User } from "../../user/entities/user.entity"; | |
import { ProductVariant } from "../../product-variant/entities/product-variant.entity"; | |
@MedusaEntity({ override: MedusaStore }) | |
@Entity() | |
export class Store extends MedusaStore { | |
@OneToMany(() => User, (user) => user.store) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { User, UserRoles } from '@medusajs/medusa' | |
import { CreateUserInput } from '@medusajs/medusa/dist/types/user' | |
import { validateEmail } from '@medusajs/medusa/dist/utils/is-email' | |
import arg from 'arg' | |
import Scrypt from 'scrypt-kdf' | |
import { getConnection, Repository } from 'typeorm' | |
type ArgOption = { | |
createUser?: boolean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"Add React className": { | |
"scope": "javascript,javascriptreact,typescriptreact", | |
"prefix": "cn", | |
"body": [ | |
"className='${1}'" | |
], | |
"description": "Quickly add a React className attribute" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isDev = process.env.NODE_ENV === "development"; | |
const DevIndicator = () => { | |
if (!isDev) { | |
return null; | |
} | |
return ( | |
<> | |
<div className="w-full h-full fixed ring-4 opacity-80 ring-orange-300 ring-inset z-[9999]"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Link from "next/link"; | |
import { useSearchParams } from "next/navigation"; | |
import type { ComponentProps, MouseEvent } from "react"; | |
type Props = ComponentProps<typeof Link> & { | |
message?: string; | |
}; | |
const LinkWithBeforeUnload = (props: Props) => { | |
const searchParams = useSearchParams(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import clsx from "clsx"; | |
import { | |
useEffect, | |
useRef, | |
useState, | |
type HTMLAttributes, | |
type ReactNode, | |
type RefObject, | |
} from "react"; |
OlderNewer