@medusajs/types 1.8.8 → 1.8.9

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.
@@ -0,0 +1,6 @@
1
+ import { DomainKey, HookPointKey, LoadedWidget, WidgetsConfig } from "./widget";
2
+ export declare type InjectionZone = `${DomainKey}.${HookPointKey}`;
3
+ export declare type InjectionZones = Map<InjectionZone, LoadedWidget[]>;
4
+ export interface Application {
5
+ registerWidgets(identifier: string, config: WidgetsConfig): void;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=application.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.js","sourceRoot":"","sources":["../../src/admin/application.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ export interface IBaseExtension {
3
+ /**
4
+ * The name of the extension, used to identify it in the admin panel and improve debugging.
5
+ */
6
+ name: string;
7
+ /**
8
+ * The component to render in the admin panel.
9
+ */
10
+ Component: React.ComponentType<any>;
11
+ }
12
+ export interface IBaseLoadedExtension extends IBaseExtension {
13
+ origin: string;
14
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/admin/common.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { Application } from "./application";
2
+ import { WidgetsConfig } from "./widget";
3
+ export declare type ExtensionConfig = {
4
+ /**
5
+ * A unique identifier for the customization configuration, used to differentiate it from other customization sources.
6
+ * It is recommended to use the name of the package where the customization configuration is defined, for example, `my-medusa-plugin`.
7
+ */
8
+ identifier: string;
9
+ /**
10
+ * The configuration for custom widgets in the admin panel.
11
+ * Define your own widgets here to use in the admin panel.
12
+ */
13
+ widgets?: WidgetsConfig;
14
+ };
15
+ export declare type Extension = {
16
+ setup(app: Application): void;
17
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/admin/config.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import type { NavigateFunction } from "react-router-dom";
2
+ declare type NotificationFunction = (title: string, message: string) => void;
3
+ export declare type Notify = {
4
+ error: NotificationFunction;
5
+ success: NotificationFunction;
6
+ info: NotificationFunction;
7
+ warning: NotificationFunction;
8
+ };
9
+ export declare type Navigate = NavigateFunction;
10
+ export declare type FeatureFlagHelpers = {
11
+ isFeatureEnabled: (flag: string) => boolean;
12
+ featureToggleList: Record<string, boolean>;
13
+ };
14
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/admin/helpers.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export * from "./application";
2
+ export * from "./common";
3
+ export * from "./config";
4
+ export * from "./widget";
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./application"), exports);
18
+ __exportStar(require("./common"), exports);
19
+ __exportStar(require("./config"), exports);
20
+ __exportStar(require("./widget"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B;AAC7B,2CAAwB;AACxB,2CAAwB;AACxB,2CAAwB"}
@@ -0,0 +1,20 @@
1
+ import { IBaseExtension, IBaseLoadedExtension } from "./common";
2
+ import { FeatureFlagHelpers, Navigate, Notify } from "./helpers";
3
+ export interface Widget extends IBaseExtension {
4
+ }
5
+ export declare type DomainKey = "product" | "product_collection" | "order" | "customer";
6
+ export declare type HookPointKey = "details";
7
+ declare type HookPoint = {
8
+ [key in HookPointKey]?: Widget[];
9
+ };
10
+ export declare type WidgetsConfig = {
11
+ [key in DomainKey]?: HookPoint;
12
+ };
13
+ export interface LoadedWidget extends Widget, IBaseLoadedExtension {
14
+ }
15
+ export interface WidgetProps {
16
+ notify: Notify;
17
+ navigate: Navigate;
18
+ featureFlags: FeatureFlagHelpers;
19
+ }
20
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=widget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget.js","sourceRoot":"","sources":["../../src/admin/widget.ts"],"names":[],"mappings":""}
@@ -2,10 +2,10 @@ import { FilterableProductCategoryProps, FilterableProductCollectionProps, Filte
2
2
  import { FindConfig } from "../common";
3
3
  import { SharedContext } from "../shared-context";
4
4
  export interface IProductModuleService<TProduct = any, TProductVariant = any, TProductTag = any, TProductCollection = any, TProductCategory = any> {
5
- list(filter: FilterableProductProps, config?: FindConfig<ProductDTO>, context?: SharedContext): Promise<ProductDTO[]>;
6
- listAndCount(filter: FilterableProductProps, config?: FindConfig<ProductDTO>, context?: SharedContext): Promise<[ProductDTO[], number]>;
7
- listTags(filter: FilterableProductTagProps, config?: FindConfig<ProductTagDTO>, context?: SharedContext): Promise<ProductTagDTO[]>;
8
- listVariants(filter: FilterableProductVariantProps, config?: FindConfig<ProductVariantDTO>, context?: SharedContext): Promise<ProductVariantDTO[]>;
9
- listCollections(filter: FilterableProductCollectionProps, config?: FindConfig<ProductCollectionDTO>, context?: SharedContext): Promise<ProductCollectionDTO[]>;
10
- listCategories(filters: FilterableProductCategoryProps, config?: FindConfig<ProductCategoryDTO>, sharedContext?: SharedContext): Promise<ProductCategoryDTO[]>;
5
+ list(filters?: FilterableProductProps, config?: FindConfig<ProductDTO>, sharedContext?: SharedContext): Promise<ProductDTO[]>;
6
+ listAndCount(filters?: FilterableProductProps, config?: FindConfig<ProductDTO>, sharedContext?: SharedContext): Promise<[ProductDTO[], number]>;
7
+ listTags(filters?: FilterableProductTagProps, config?: FindConfig<ProductTagDTO>, sharedContext?: SharedContext): Promise<ProductTagDTO[]>;
8
+ listVariants(filters?: FilterableProductVariantProps, config?: FindConfig<ProductVariantDTO>, sharedContext?: SharedContext): Promise<ProductVariantDTO[]>;
9
+ listCollections(filters?: FilterableProductCollectionProps, config?: FindConfig<ProductCollectionDTO>, sharedContext?: SharedContext): Promise<ProductCollectionDTO[]>;
10
+ listCategories(filters?: FilterableProductCategoryProps, config?: FindConfig<ProductCategoryDTO>, sharedContext?: SharedContext): Promise<ProductCategoryDTO[]>;
11
11
  }
@@ -0,0 +1,20 @@
1
+ /** The amount of a gift card allocated to a line item */
2
+ export declare type GiftCardAllocation = {
3
+ amount: number;
4
+ unit_amount: number;
5
+ };
6
+ /** The amount of a discount allocated to a line item */
7
+ export declare type DiscountAllocation = {
8
+ amount: number;
9
+ unit_amount: number;
10
+ };
11
+ /**
12
+ * A map of line item ids and its corresponding gift card and discount
13
+ * allocations
14
+ */
15
+ export declare type LineAllocationsMap = {
16
+ [K: string]: {
17
+ gift_card?: GiftCardAllocation;
18
+ discount?: DiscountAllocation;
19
+ };
20
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/tax/common.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from "./common";
2
+ export * from "./tax-calculation-strategy";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./common"), exports);
18
+ __exportStar(require("./tax-calculation-strategy"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tax/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,6DAA0C"}
@@ -0,0 +1,23 @@
1
+ import { LineAllocationsMap } from "./common";
2
+ export declare type TaxCalculationContext = {
3
+ shipping_address: any;
4
+ customer: any;
5
+ region: any;
6
+ is_return: boolean;
7
+ shipping_methods: any;
8
+ allocation_map: LineAllocationsMap;
9
+ tax_calculation_strategy: ITaxCalculationStrategy;
10
+ };
11
+ export interface ITaxCalculationStrategy {
12
+ /**
13
+ * Calculates the tax amount for a given set of line items under applicable
14
+ * tax conditions and calculation contexts.
15
+ * @param items - the line items to calculate the tax total for
16
+ * @param taxLines - the tax lines that applies to the calculation
17
+ * @param calculationContext - other details relevant for the calculation
18
+ * @return the tax total
19
+ */
20
+ calculate(items: any, // LineItem[],
21
+ taxLines: any[], calculationContext: TaxCalculationContext): Promise<number>;
22
+ }
23
+ export declare function isTaxCalculationStrategy(object: any): object is ITaxCalculationStrategy;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isTaxCalculationStrategy = void 0;
4
+ function isTaxCalculationStrategy(
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ object) {
7
+ return typeof object.calculate === "function";
8
+ }
9
+ exports.isTaxCalculationStrategy = isTaxCalculationStrategy;
10
+ //# sourceMappingURL=tax-calculation-strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tax-calculation-strategy.js","sourceRoot":"","sources":["../../src/tax/tax-calculation-strategy.ts"],"names":[],"mappings":";;;AAsCA,SAAgB,wBAAwB;AACtC,8DAA8D;AAC9D,MAAW;IAEX,OAAO,OAAO,MAAM,CAAC,SAAS,KAAK,UAAU,CAAA;AAC/C,CAAC;AALD,4DAKC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/types",
3
- "version": "1.8.8",
3
+ "version": "1.8.9",
4
4
  "description": "Medusa Types definition",
5
5
  "main": "dist/index.js",
6
6
  "repository": {