This file contains hidden or 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 { | |
flattenObjectToKeyValuePairs, | |
isPresent, | |
MedusaError, | |
MikroOrmBase, | |
PriceListStatus, | |
} from "@medusajs/framework/utils" | |
import { | |
BigNumberInput, |
This file contains hidden or 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
// src/api/admin/custom/orders/route.ts | |
import { createOrderWorkflow } from '@medusajs/core-flows'; // ℹ️ This is the worflow exposed and used inside Medusa | |
import { type MedusaRequest, type MedusaResponse } from '@medusajs/framework/http'; | |
export async function POST(req: MedusaRequest, res: MedusaResponse) { | |
// ℹ️ You can use the body of the request to have an Admin API route to handle this | |
// on top of using modules to fetch dynamically the data (region, items etc...) | |
// For the demo, we're going to keep it simple with some hardcoded values | |
const { result } = await createOrderWorkflow(req.scope) |
This file contains hidden or 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 CustomFulfillmentService from "./service" | |
import { | |
ModuleProvider, | |
Modules | |
} from "@medusajs/framework/utils" | |
export default ModuleProvider(Modules.FULFILLMENT, { | |
services: [CustomFulfillmentService], | |
}) |
This file contains hidden or 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 { registerOverriddenValidators } from '@medusajs/medusa' | |
import { type Constructor } from '@medusajs/types' | |
type DecoratorFunction = MethodDecorator | PropertyDecorator | |
type ExtensionDefinition = { | |
[key: string]: DecoratorFunction | DecoratorFunction[] | |
} | |
function extendValidator<Base extends Constructor<any>>( |
This file contains hidden or 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 type RedisCacheService from '@medusajs/cache-redis/dist/services/redis-cache'; | |
import { ProductService as MedusaProductService, Product } from '@medusajs/medusa'; | |
import { CreateProductInput, FindProductConfig, ProductSelector, UpdateProductInput } from '@medusajs/medusa/dist/types/product'; | |
import type { Redis } from 'ioredis'; | |
type InjectedDependencies = { | |
cacheService: RedisCacheService | |
redisClient: Redis | |
} |
This file contains hidden or 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 { useRef, useState, type ChangeEvent, type DragEvent } from "react"; | |
import { cn } from "~/lib/utils"; | |
type FileUploadProps = { | |
onUpload?: (_files: File[]) => void; | |
accept: string[]; | |
error?: string; | |
className?: string; | |
multiple?: boolean; | |
text?: React.ReactElement | string; |
This file contains hidden or 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
/** @type {import('tailwindcss').Config} */ | |
export default { | |
// Other values... | |
theme: { | |
extend: { | |
keyframes: { | |
svg: { | |
from: { | |
strokeDasharray: "1000", | |
strokeDashoffset: "1000", |
This file contains hidden or 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 { memo, useEffect, useRef, useState } from 'react' | |
import { useAnimate } from 'framer-motion' | |
import { cn } from '~/utils/cn' | |
/** | |
* @name AnimatedNumberDisplay | |
* @description A component that animates a number from an initial value to a new value | |
* | |
* @param {Object} props - The options for the component | |
* @param {string | number} props.initialValue - The initial value of the number |
This file contains hidden or 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
"use client"; | |
import React, { | |
Fragment, | |
createContext, | |
useContext, | |
type HTMLAttributes, | |
type ReactNode, | |
} from "react"; |
This file contains hidden or 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"; |
NewerOlder