@medusajs/pricing 0.1.13-snapshot-20240704130951 → 0.1.13-snapshot-20240711051411

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. package/dist/index.d.ts +6 -3
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +4 -6
  4. package/dist/joiner-config.d.ts +1 -0
  5. package/dist/joiner-config.d.ts.map +1 -0
  6. package/dist/joiner-config.js +1 -6
  7. package/dist/migrations/Migration20230929122253.d.ts +1 -0
  8. package/dist/migrations/Migration20230929122253.d.ts.map +1 -0
  9. package/dist/migrations/Migration20240322094407.d.ts +1 -0
  10. package/dist/migrations/Migration20240322094407.d.ts.map +1 -0
  11. package/dist/migrations/Migration20240322113359.d.ts +1 -0
  12. package/dist/migrations/Migration20240322113359.d.ts.map +1 -0
  13. package/dist/migrations/Migration20240322120125.d.ts +1 -0
  14. package/dist/migrations/Migration20240322120125.d.ts.map +1 -0
  15. package/dist/migrations/Migration20240626133555.d.ts +1 -0
  16. package/dist/migrations/Migration20240626133555.d.ts.map +1 -0
  17. package/dist/migrations/Migration20240704094505.d.ts +6 -0
  18. package/dist/migrations/Migration20240704094505.d.ts.map +1 -0
  19. package/dist/migrations/Migration20240704094505.js +15 -0
  20. package/dist/models/index.d.ts +2 -0
  21. package/dist/models/index.d.ts.map +1 -0
  22. package/dist/models/index.js +3 -1
  23. package/dist/models/price-list-rule.d.ts +2 -1
  24. package/dist/models/price-list-rule.d.ts.map +1 -0
  25. package/dist/models/price-list.d.ts +2 -1
  26. package/dist/models/price-list.d.ts.map +1 -0
  27. package/dist/models/price-preference.d.ts +13 -0
  28. package/dist/models/price-preference.d.ts.map +1 -0
  29. package/dist/models/price-preference.js +95 -0
  30. package/dist/models/price-rule.d.ts +2 -1
  31. package/dist/models/price-rule.d.ts.map +1 -0
  32. package/dist/models/price-set.d.ts +1 -0
  33. package/dist/models/price-set.d.ts.map +1 -0
  34. package/dist/models/price.d.ts +2 -1
  35. package/dist/models/price.d.ts.map +1 -0
  36. package/dist/repositories/index.d.ts +1 -0
  37. package/dist/repositories/index.d.ts.map +1 -0
  38. package/dist/repositories/pricing.d.ts +1 -0
  39. package/dist/repositories/pricing.d.ts.map +1 -0
  40. package/dist/repositories/pricing.js +0 -5
  41. package/dist/schema/index.d.ts +1 -0
  42. package/dist/schema/index.d.ts.map +1 -0
  43. package/dist/services/index.d.ts +1 -0
  44. package/dist/services/index.d.ts.map +1 -0
  45. package/dist/services/pricing-module.d.ts +15 -3
  46. package/dist/services/pricing-module.d.ts.map +1 -0
  47. package/dist/services/pricing-module.js +109 -10
  48. package/dist/types/index.d.ts +1 -0
  49. package/dist/types/index.d.ts.map +1 -0
  50. package/dist/types/services/index.d.ts +30 -3
  51. package/dist/types/services/index.d.ts.map +1 -0
  52. package/dist/types/services/index.js +0 -17
  53. package/dist/utils/events.d.ts +1 -0
  54. package/dist/utils/events.d.ts.map +1 -0
  55. package/dist/utils/index.d.ts +1 -0
  56. package/dist/utils/index.d.ts.map +1 -0
  57. package/dist/utils/validate-price-list-dates.d.ts +1 -0
  58. package/dist/utils/validate-price-list-dates.d.ts.map +1 -0
  59. package/package.json +5 -8
  60. package/dist/types/services/price-list.d.ts +0 -18
  61. package/dist/types/services/price-list.js +0 -2
  62. package/dist/types/services/price-set.d.ts +0 -4
  63. package/dist/types/services/price-set.js +0 -2
  64. package/dist/types/services/price.d.ts +0 -6
  65. package/dist/types/services/price.js +0 -2
package/dist/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
- import { ModuleExports } from "@medusajs/types";
2
- export declare const moduleDefinition: ModuleExports;
3
- export default moduleDefinition;
1
+ import { PricingModuleService } from "./services";
2
+ declare const _default: import("@medusajs/types").ModuleExports<typeof PricingModuleService> & {
3
+ linkable: Record<string, any>;
4
+ };
5
+ export default _default;
4
6
  export * from "./types";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;;;;AAEhD,wBAEE;AAEF,cAAc,SAAS,CAAA"}
package/dist/index.js CHANGED
@@ -14,11 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.moduleDefinition = void 0;
17
+ const utils_1 = require("@medusajs/utils");
18
18
  const _services_1 = require("./services");
19
- const service = _services_1.PricingModuleService;
20
- exports.moduleDefinition = {
21
- service,
22
- };
23
- exports.default = exports.moduleDefinition;
19
+ exports.default = (0, utils_1.Module)(utils_1.Modules.PRICING, {
20
+ service: _services_1.PricingModuleService,
21
+ });
24
22
  __exportStar(require("./types"), exports);
@@ -1 +1,2 @@
1
1
  export declare const joinerConfig: Omit<import("@medusajs/types").ModuleJoinerConfig, "serviceName" | "primaryKeys" | "alias" | "linkableKeys"> & Required<Pick<import("@medusajs/types").ModuleJoinerConfig, "serviceName" | "primaryKeys" | "alias" | "linkableKeys">>;
2
+ //# sourceMappingURL=joiner-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"joiner-config.d.ts","sourceRoot":"","sources":["../src/joiner-config.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,uOAEvB,CAAA"}
@@ -4,10 +4,5 @@ exports.joinerConfig = void 0;
4
4
  const utils_1 = require("@medusajs/utils");
5
5
  const _models_1 = require("./models");
6
6
  exports.joinerConfig = (0, utils_1.defineJoinerConfig)(utils_1.Modules.PRICING, {
7
- models: [_models_1.PriceSet, _models_1.PriceList, _models_1.Price],
8
- linkableKeys: {
9
- price_set_id: _models_1.PriceSet.name,
10
- price_list_id: _models_1.PriceList.name,
11
- price_id: _models_1.Price.name,
12
- },
7
+ models: [_models_1.PriceSet, _models_1.PriceList, _models_1.Price, _models_1.PricePreference],
13
8
  });
@@ -2,3 +2,4 @@ import { Migration } from "@mikro-orm/migrations";
2
2
  export declare class Migration20230929122253 extends Migration {
3
3
  up(): Promise<void>;
4
4
  }
5
+ //# sourceMappingURL=Migration20230929122253.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20230929122253.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20230929122253.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,SAAS;IAC9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;CAkO1B"}
@@ -3,3 +3,4 @@ export declare class Migration20240322094407 extends Migration {
3
3
  up(): Promise<void>;
4
4
  down(): Promise<void>;
5
5
  }
6
+ //# sourceMappingURL=Migration20240322094407.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240322094407.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20240322094407.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,qBAAa,uBAAwB,SAAQ,SAAS;IAE9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAInB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAM5B"}
@@ -3,3 +3,4 @@ export declare class Migration20240322113359 extends Migration {
3
3
  up(): Promise<void>;
4
4
  down(): Promise<void>;
5
5
  }
6
+ //# sourceMappingURL=Migration20240322113359.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240322113359.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20240322113359.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,SAAS;IAC9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAcnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAa5B"}
@@ -3,3 +3,4 @@ export declare class Migration20240322120125 extends Migration {
3
3
  up(): Promise<void>;
4
4
  down(): Promise<void>;
5
5
  }
6
+ //# sourceMappingURL=Migration20240322120125.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240322120125.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20240322120125.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,SAAS;IAC9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAOnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ5B"}
@@ -2,3 +2,4 @@ import { Migration } from "@mikro-orm/migrations";
2
2
  export declare class Migration20240626133555 extends Migration {
3
3
  up(): Promise<void>;
4
4
  }
5
+ //# sourceMappingURL=Migration20240626133555.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240626133555.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20240626133555.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,SAAS;IAC9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;CAoE1B"}
@@ -0,0 +1,6 @@
1
+ import { Migration } from '@mikro-orm/migrations';
2
+ export declare class Migration20240704094505 extends Migration {
3
+ up(): Promise<void>;
4
+ down(): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=Migration20240704094505.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240704094505.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20240704094505.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,qBAAa,uBAAwB,SAAQ,SAAS;IAE9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAMnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAI5B"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Migration20240704094505 = void 0;
4
+ const migrations_1 = require("@mikro-orm/migrations");
5
+ class Migration20240704094505 extends migrations_1.Migration {
6
+ async up() {
7
+ this.addSql('create table if not exists "price_preference" ("id" text not null, "attribute" text not null, "value" text null, "is_tax_inclusive" boolean not null default false, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "price_preference_pkey" primary key ("id"));');
8
+ this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_preference_deleted_at" ON "price_preference" (deleted_at) WHERE deleted_at IS NOT NULL;');
9
+ this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_price_preference_attribute_value" ON "price_preference" (attribute, value) WHERE deleted_at IS NULL;');
10
+ }
11
+ async down() {
12
+ this.addSql('drop table if exists "price_preference" cascade;');
13
+ }
14
+ }
15
+ exports.Migration20240704094505 = Migration20240704094505;
@@ -3,3 +3,5 @@ export { default as PriceList } from "./price-list";
3
3
  export { default as PriceListRule } from "./price-list-rule";
4
4
  export { default as PriceRule } from "./price-rule";
5
5
  export { default as PriceSet } from "./price-set";
6
+ export { default as PricePreference } from "./price-preference";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAA"}
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PriceSet = exports.PriceRule = exports.PriceListRule = exports.PriceList = exports.Price = void 0;
6
+ exports.PricePreference = exports.PriceSet = exports.PriceRule = exports.PriceListRule = exports.PriceList = exports.Price = void 0;
7
7
  var price_1 = require("./price");
8
8
  Object.defineProperty(exports, "Price", { enumerable: true, get: function () { return __importDefault(price_1).default; } });
9
9
  var price_list_1 = require("./price-list");
@@ -14,3 +14,5 @@ var price_rule_1 = require("./price-rule");
14
14
  Object.defineProperty(exports, "PriceRule", { enumerable: true, get: function () { return __importDefault(price_rule_1).default; } });
15
15
  var price_set_1 = require("./price-set");
16
16
  Object.defineProperty(exports, "PriceSet", { enumerable: true, get: function () { return __importDefault(price_set_1).default; } });
17
+ var price_preference_1 = require("./price-preference");
18
+ Object.defineProperty(exports, "PricePreference", { enumerable: true, get: function () { return __importDefault(price_preference_1).default; } });
@@ -1,7 +1,7 @@
1
1
  import { DAL } from "@medusajs/types";
2
2
  import { OptionalProps, Rel } from "@mikro-orm/core";
3
3
  import PriceList from "./price-list";
4
- type OptionalFields = DAL.SoftDeletableEntityDateColumns;
4
+ type OptionalFields = DAL.SoftDeletableModelDateColumns;
5
5
  export default class PriceListRule {
6
6
  [OptionalProps]: OptionalFields;
7
7
  id: string;
@@ -16,3 +16,4 @@ export default class PriceListRule {
16
16
  onInit(): void;
17
17
  }
18
18
  export {};
19
+ //# sourceMappingURL=price-list-rule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-list-rule.d.ts","sourceRoot":"","sources":["../../src/models/price-list-rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAMrC,OAAO,EAML,aAAa,EAGb,GAAG,EACJ,MAAM,iBAAiB,CAAA;AACxB,OAAO,SAAS,MAAM,cAAc,CAAA;AAEpC,KAAK,cAAc,GAAG,GAAG,CAAC,6BAA6B,CAAA;AAiBvD,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,CAAC,aAAa,CAAC,EAAE,cAAc,CAAA;IAG/B,EAAE,EAAG,MAAM,CAAA;IAGX,SAAS,EAAE,MAAM,CAAA;IAGjB,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAO;IAStC,aAAa,EAAE,MAAM,CAAA;IAGrB,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,CAAA;IAO1B,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAIhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,YAAY;IAMZ,MAAM;CAIP"}
@@ -3,7 +3,7 @@ import { PriceListStatus, PriceListType } from "@medusajs/utils";
3
3
  import { Collection, OptionalProps } from "@mikro-orm/core";
4
4
  import Price from "./price";
5
5
  import PriceListRule from "./price-list-rule";
6
- type OptionalFields = "starts_at" | "ends_at" | DAL.SoftDeletableEntityDateColumns;
6
+ type OptionalFields = "starts_at" | "ends_at" | DAL.SoftDeletableModelDateColumns;
7
7
  export declare const PriceListIdPrefix = "plist";
8
8
  export default class PriceList {
9
9
  [OptionalProps]: OptionalFields;
@@ -24,3 +24,4 @@ export default class PriceList {
24
24
  onInit(): void;
25
25
  }
26
26
  export {};
27
+ //# sourceMappingURL=price-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-list.d.ts","sourceRoot":"","sources":["../../src/models/price-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AACrC,OAAO,EAIL,eAAe,EACf,aAAa,EAEd,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAGL,UAAU,EAMV,aAAa,EAId,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,MAAM,SAAS,CAAA;AAC3B,OAAO,aAAa,MAAM,mBAAmB,CAAA;AAE7C,KAAK,cAAc,GACf,WAAW,GACX,SAAS,GACT,GAAG,CAAC,6BAA6B,CAAA;AASrC,eAAO,MAAM,iBAAiB,UAAU,CAAA;AAIxC,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B,CAAC,aAAa,CAAC,EAAE,cAAc,CAAA;IAG/B,EAAE,EAAG,MAAM,CAAA;IAIX,KAAK,EAAE,MAAM,CAAA;IAIb,WAAW,EAAE,MAAM,CAAA;IAGnB,MAAM,EAAE,eAAe,CAAA;IAGvB,IAAI,EAAE,aAAa,CAAA;IAMnB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAO;IAM7B,OAAO,EAAE,IAAI,GAAG,IAAI,CAAO;IAK3B,MAAM,4BAAmC;IAKzC,gBAAgB,oCAA2C;IAG3D,WAAW,EAAE,MAAM,CAAI;IAOvB,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAIhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,QAAQ;IAKR,MAAM;CAGP"}
@@ -0,0 +1,13 @@
1
+ export declare const uniquePreferenceRuleIndexName = "IDX_price_preference_attribute_value";
2
+ export default class PricePreference {
3
+ id: string;
4
+ attribute: string;
5
+ value: string | null;
6
+ is_tax_inclusive: boolean;
7
+ created_at: Date;
8
+ updated_at: Date;
9
+ deleted_at: Date | null;
10
+ onCreate(): void;
11
+ onInit(): void;
12
+ }
13
+ //# sourceMappingURL=price-preference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-preference.d.ts","sourceRoot":"","sources":["../../src/models/price-preference.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,6BAA6B,yCACF,CAAA;AAkBxC,MAAM,CAAC,OAAO,OAAO,eAAe;IAElC,EAAE,EAAE,MAAM,CAAA;IAGV,SAAS,EAAE,MAAM,CAAA;IAGjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAO;IAG3B,gBAAgB,EAAE,OAAO,CAAA;IAOzB,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAIhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,QAAQ;IAKR,MAAM;CAGP"}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.uniquePreferenceRuleIndexName = void 0;
13
+ const utils_1 = require("@medusajs/utils");
14
+ const core_1 = require("@mikro-orm/core");
15
+ exports.uniquePreferenceRuleIndexName = "IDX_price_preference_attribute_value";
16
+ const UniquePreferenceRuleIndexStatement = (0, utils_1.createPsqlIndexStatementHelper)({
17
+ name: exports.uniquePreferenceRuleIndexName,
18
+ tableName: "price_preference",
19
+ columns: ["attribute", "value"],
20
+ unique: true,
21
+ where: "deleted_at IS NULL",
22
+ });
23
+ const DeletedAtIndex = (0, utils_1.createPsqlIndexStatementHelper)({
24
+ tableName: "price_preference",
25
+ columns: "deleted_at",
26
+ where: "deleted_at IS NOT NULL",
27
+ });
28
+ let PricePreference = class PricePreference {
29
+ constructor() {
30
+ this.value = null;
31
+ this.deleted_at = null;
32
+ }
33
+ onCreate() {
34
+ this.id = (0, utils_1.generateEntityId)(this.id, "prpref");
35
+ }
36
+ onInit() {
37
+ this.id = (0, utils_1.generateEntityId)(this.id, "prpref");
38
+ }
39
+ };
40
+ __decorate([
41
+ (0, core_1.PrimaryKey)({ columnType: "text" }),
42
+ __metadata("design:type", String)
43
+ ], PricePreference.prototype, "id", void 0);
44
+ __decorate([
45
+ (0, core_1.Property)({ columnType: "text" }),
46
+ __metadata("design:type", String)
47
+ ], PricePreference.prototype, "attribute", void 0);
48
+ __decorate([
49
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
50
+ __metadata("design:type", Object)
51
+ ], PricePreference.prototype, "value", void 0);
52
+ __decorate([
53
+ (0, core_1.Property)({ default: false }),
54
+ __metadata("design:type", Boolean)
55
+ ], PricePreference.prototype, "is_tax_inclusive", void 0);
56
+ __decorate([
57
+ (0, core_1.Property)({
58
+ onCreate: () => new Date(),
59
+ columnType: "timestamptz",
60
+ defaultRaw: "now()",
61
+ }),
62
+ __metadata("design:type", Date)
63
+ ], PricePreference.prototype, "created_at", void 0);
64
+ __decorate([
65
+ (0, core_1.Property)({
66
+ onCreate: () => new Date(),
67
+ onUpdate: () => new Date(),
68
+ columnType: "timestamptz",
69
+ defaultRaw: "now()",
70
+ }),
71
+ __metadata("design:type", Date)
72
+ ], PricePreference.prototype, "updated_at", void 0);
73
+ __decorate([
74
+ DeletedAtIndex.MikroORMIndex(),
75
+ (0, core_1.Property)({ columnType: "timestamptz", nullable: true }),
76
+ __metadata("design:type", Object)
77
+ ], PricePreference.prototype, "deleted_at", void 0);
78
+ __decorate([
79
+ (0, core_1.BeforeCreate)(),
80
+ __metadata("design:type", Function),
81
+ __metadata("design:paramtypes", []),
82
+ __metadata("design:returntype", void 0)
83
+ ], PricePreference.prototype, "onCreate", null);
84
+ __decorate([
85
+ (0, core_1.OnInit)(),
86
+ __metadata("design:type", Function),
87
+ __metadata("design:paramtypes", []),
88
+ __metadata("design:returntype", void 0)
89
+ ], PricePreference.prototype, "onInit", null);
90
+ PricePreference = __decorate([
91
+ (0, core_1.Entity)(),
92
+ (0, core_1.Filter)(utils_1.DALUtils.mikroOrmSoftDeletableFilterOptions),
93
+ UniquePreferenceRuleIndexStatement.MikroORMIndex()
94
+ ], PricePreference);
95
+ exports.default = PricePreference;
@@ -1,7 +1,7 @@
1
1
  import { DAL } from "@medusajs/types";
2
2
  import { OptionalProps, Rel } from "@mikro-orm/core";
3
3
  import Price from "./price";
4
- type OptionalFields = DAL.SoftDeletableEntityDateColumns;
4
+ type OptionalFields = DAL.SoftDeletableModelDateColumns;
5
5
  export default class PriceRule {
6
6
  [OptionalProps]?: OptionalFields;
7
7
  id: string;
@@ -17,3 +17,4 @@ export default class PriceRule {
17
17
  onInit(): void;
18
18
  }
19
19
  export {};
20
+ //# sourceMappingURL=price-rule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-rule.d.ts","sourceRoot":"","sources":["../../src/models/price-rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAMrC,OAAO,EAML,aAAa,EAGb,GAAG,EACJ,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,MAAM,SAAS,CAAA;AAE3B,KAAK,cAAc,GAAG,GAAG,CAAC,6BAA6B,CAAA;AAkBvD,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B,CAAC,aAAa,CAAC,CAAC,EAAE,cAAc,CAAA;IAGhC,EAAE,EAAG,MAAM,CAAA;IAGX,SAAS,EAAE,MAAM,CAAA;IAGjB,KAAK,EAAE,MAAM,CAAA;IAGb,QAAQ,EAAE,MAAM,CAAI;IASpB,QAAQ,EAAE,MAAM,CAAA;IAGhB,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,CAAA;IAOjB,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAIhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,YAAY;IAMZ,MAAM;CAIP"}
@@ -10,3 +10,4 @@ export default class PriceSet {
10
10
  onCreate(): void;
11
11
  onInit(): void;
12
12
  }
13
+ //# sourceMappingURL=price-set.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-set.d.ts","sourceRoot":"","sources":["../../src/models/price-set.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,UAAU,EAQX,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,MAAM,SAAS,CAAA;AAS3B,eAAO,MAAM,gBAAgB,SAAS,CAAA;AAItC,MAAM,CAAC,OAAO,OAAO,QAAQ;IAE3B,EAAE,EAAG,MAAM,CAAA;IAKX,MAAM,4BAAmC;IAOzC,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAIhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,QAAQ;IAKR,MAAM;CAGP"}
@@ -4,7 +4,7 @@ import { Collection, OptionalProps, Rel } from "@mikro-orm/core";
4
4
  import PriceList from "./price-list";
5
5
  import PriceRule from "./price-rule";
6
6
  import PriceSet from "./price-set";
7
- type OptionalFields = DAL.SoftDeletableEntityDateColumns;
7
+ type OptionalFields = DAL.SoftDeletableModelDateColumns;
8
8
  export default class Price {
9
9
  [OptionalProps]?: OptionalFields;
10
10
  id: string;
@@ -27,3 +27,4 @@ export default class Price {
27
27
  onInit(): void;
28
28
  }
29
29
  export {};
30
+ //# sourceMappingURL=price.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../src/models/price.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AACrC,OAAO,EACL,SAAS,EAKV,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAGL,UAAU,EAMV,aAAa,EAGb,GAAG,EACJ,MAAM,iBAAiB,CAAA;AACxB,OAAO,SAAS,MAAM,cAAc,CAAA;AACpC,OAAO,SAAS,MAAM,cAAc,CAAA;AACpC,OAAO,QAAQ,MAAM,aAAa,CAAA;AAElC,KAAK,cAAc,GAAG,GAAG,CAAC,6BAA6B,CAAA;AA6BvD,MAAM,CAAC,OAAO,OAAO,KAAK;IACxB,CAAC,aAAa,CAAC,CAAC,EAAE,cAAc,CAAA;IAGhC,EAAE,EAAG,MAAM,CAAA;IAGX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAO;IAI3B,aAAa,EAAE,MAAM,CAAA;IAGrB,MAAM,EAAE,SAAS,GAAG,MAAM,CAAA;IAG1B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAGnC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAO;IAGlC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAO;IASlC,YAAY,EAAE,MAAM,CAAA;IAGpB,SAAS,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAA;IAGzB,WAAW,EAAE,MAAM,CAAI;IAOvB,WAAW,gCAAuC;IAUlD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAO;IAGnC,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,GAAG,IAAI,CAAO;IAOxC,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAIhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,QAAQ;IAOR,MAAM;CAKP"}
@@ -1,2 +1,3 @@
1
1
  export { MikroOrmBaseRepository as BaseRepository } from "@medusajs/utils";
2
2
  export { PricingRepository } from "./pricing";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,IAAI,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA"}
@@ -4,3 +4,4 @@ export declare class PricingRepository extends MikroOrmBase implements PricingRe
4
4
  constructor();
5
5
  calculatePrices(pricingFilters: PricingFilters, pricingContext?: PricingContext, sharedContext?: Context): Promise<CalculatedPriceSetDTO[]>;
6
6
  }
7
+ //# sourceMappingURL=pricing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pricing.d.ts","sourceRoot":"","sources":["../../src/repositories/pricing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAmB,MAAM,iBAAiB,CAAA;AAE5E,OAAO,EACL,qBAAqB,EACrB,OAAO,EACP,cAAc,EACd,cAAc,EACd,wBAAwB,EACzB,MAAM,iBAAiB,CAAA;AAGxB,qBAAa,iBACX,SAAQ,YACR,YAAW,wBAAwB;;IAQ7B,eAAe,CACnB,cAAc,EAAE,cAAc,EAC9B,cAAc,GAAE,cAAgC,EAChD,aAAa,GAAE,OAAY,GAC1B,OAAO,CAAC,qBAAqB,EAAE,CAAC;CAmKpC"}
@@ -54,10 +54,6 @@ class PricingRepository extends utils_1.MikroOrmBase {
54
54
  this.on("pl.id", "price.price_list_id").andOn("pl.status", knex.raw("?", [utils_1.PriceListStatus.ACTIVE]));
55
55
  })
56
56
  .leftJoin("price_list_rule as plr", "plr.price_list_id", "pl.id")
57
- .orderBy([
58
- { column: "rules_count", order: "desc" },
59
- { column: "pl.rules_count", order: "desc" },
60
- ])
61
57
  .groupBy("price.id", "pl.id")
62
58
  .having(knex.raw("count(DISTINCT pr.attribute) = price.rules_count AND price.price_list_id IS NULL"))
63
59
  .orHaving(knex.raw("count(DISTINCT plr.attribute) = pl.rules_count AND price.price_list_id IS NOT NULL"));
@@ -120,7 +116,6 @@ class PricingRepository extends utils_1.MikroOrmBase {
120
116
  all_rules_count: knex.raw("COALESCE(price.rules_count, 0) + COALESCE(price.pl_rules_count, 0)"),
121
117
  })
122
118
  .join(priceSubQueryKnex.as("price"), "price.price_set_id", "ps.id")
123
- .leftJoin("price_rule as pr", "pr.price_id", "price.id")
124
119
  .whereIn("ps.id", pricingFilters.id)
125
120
  .andWhere("price.currency_code", "=", currencyCode)
126
121
  .orderBy([
@@ -1,2 +1,3 @@
1
1
  export declare const schema = "\ntype PriceSet {\n id: String!\n money_amounts: [MoneyAmount]\n}\n\ntype MoneyAmount {\n id: String!\n currency_code: String\n amount: Float\n min_quantity: Float\n max_quantity: Float\n}\n";
2
2
  export default schema;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,0MAalB,CAAA;AAED,eAAe,MAAM,CAAA"}
@@ -1 +1,2 @@
1
1
  export { default as PricingModuleService } from "./pricing-module";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,kBAAkB,CAAA"}
@@ -1,5 +1,5 @@
1
- import { AddPricesDTO, Context, CreatePriceRuleDTO, DAL, FindConfig, InternalModuleDeclaration, ModuleJoinerConfig, ModulesSdkTypes, PriceSetDTO, PricingContext, PricingFilters, PricingRepositoryService, PricingTypes, UpsertPriceSetDTO } from "@medusajs/types";
2
- import { Price, PriceList, PriceListRule, PriceRule, PriceSet } from "../models";
1
+ import { AddPricesDTO, Context, CreatePriceRuleDTO, DAL, FindConfig, InternalModuleDeclaration, ModuleJoinerConfig, ModulesSdkTypes, PricePreferenceDTO, PriceSetDTO, PricingContext, PricingFilters, PricingRepositoryService, PricingTypes, UpsertPricePreferenceDTO, UpsertPriceSetDTO } from "@medusajs/types";
2
+ import { Price, PriceList, PriceListRule, PriceRule, PriceSet, PricePreference } from "../models";
3
3
  import { ServiceTypes } from "../types";
4
4
  import { CreatePriceListDTO } from "src/types/services";
5
5
  type InjectedDependencies = {
@@ -9,6 +9,7 @@ type InjectedDependencies = {
9
9
  priceRuleService: ModulesSdkTypes.IMedusaInternalService<any>;
10
10
  priceService: ModulesSdkTypes.IMedusaInternalService<any>;
11
11
  priceListService: ModulesSdkTypes.IMedusaInternalService<any>;
12
+ pricePreferenceService: ModulesSdkTypes.IMedusaInternalService<any>;
12
13
  priceListRuleService: ModulesSdkTypes.IMedusaInternalService<any>;
13
14
  };
14
15
  declare const PricingModuleService_base: import("@medusajs/utils/dist/modules-sdk/types/medusa-service").MedusaServiceReturnType<{
@@ -29,6 +30,9 @@ declare const PricingModuleService_base: import("@medusajs/utils/dist/modules-sd
29
30
  PriceListRule: {
30
31
  dto: PricingTypes.PriceListRuleDTO;
31
32
  };
33
+ PricePreference: {
34
+ dto: any;
35
+ };
32
36
  }>;
33
37
  export default class PricingModuleService extends PricingModuleService_base implements PricingTypes.IPricingModuleService {
34
38
  protected readonly moduleDeclaration: InternalModuleDeclaration;
@@ -39,7 +43,8 @@ export default class PricingModuleService extends PricingModuleService_base impl
39
43
  protected readonly priceService_: ModulesSdkTypes.IMedusaInternalService<Price>;
40
44
  protected readonly priceListService_: ModulesSdkTypes.IMedusaInternalService<PriceList>;
41
45
  protected readonly priceListRuleService_: ModulesSdkTypes.IMedusaInternalService<PriceListRule>;
42
- constructor({ baseRepository, pricingRepository, priceSetService, priceRuleService, priceService, priceListService, priceListRuleService, }: InjectedDependencies, moduleDeclaration: InternalModuleDeclaration);
46
+ protected readonly pricePreferenceService_: ModulesSdkTypes.IMedusaInternalService<PricePreference>;
47
+ constructor({ baseRepository, pricingRepository, priceSetService, priceRuleService, priceService, pricePreferenceService, priceListService, priceListRuleService, }: InjectedDependencies, moduleDeclaration: InternalModuleDeclaration);
43
48
  __joinerConfig(): ModuleJoinerConfig;
44
49
  private setupCalculatedPriceConfig_;
45
50
  retrievePriceSet(id: string, config?: FindConfig<PriceSetDTO> | undefined, sharedContext?: Context | undefined): Promise<PriceSetDTO>;
@@ -64,6 +69,12 @@ export default class PricingModuleService extends PricingModuleService_base impl
64
69
  addPriceListPrices(data: PricingTypes.AddPriceListPricesDTO[], sharedContext?: Context): Promise<PricingTypes.PriceDTO[]>;
65
70
  setPriceListRules(data: PricingTypes.SetPriceListRulesDTO, sharedContext?: Context): Promise<PricingTypes.PriceListDTO>;
66
71
  removePriceListRules(data: PricingTypes.RemovePriceListRulesDTO, sharedContext?: Context): Promise<PricingTypes.PriceListDTO>;
72
+ createPricePreferences(data: PricingTypes.CreatePricePreferenceDTO, sharedContext?: Context): Promise<PricePreferenceDTO>;
73
+ createPricePreferences(data: PricingTypes.CreatePricePreferenceDTO[], sharedContext?: Context): Promise<PricePreferenceDTO[]>;
74
+ upsertPricePreferences(data: UpsertPricePreferenceDTO[], sharedContext?: Context): Promise<PricePreferenceDTO[]>;
75
+ upsertPricePreferences(data: UpsertPricePreferenceDTO, sharedContext?: Context): Promise<PricePreferenceDTO>;
76
+ updatePricePreferences(id: string, data: PricingTypes.UpdatePricePreferenceDTO, sharedContext?: Context): Promise<PricePreferenceDTO>;
77
+ updatePricePreferences(selector: PricingTypes.FilterablePricePreferenceProps, data: PricingTypes.UpdatePricePreferenceDTO, sharedContext?: Context): Promise<PricePreferenceDTO[]>;
67
78
  protected createPriceSets_(data: PricingTypes.CreatePriceSetDTO[], sharedContext?: Context): Promise<PriceSet[]>;
68
79
  protected addPrices_(input: AddPricesDTO[], sharedContext?: Context): Promise<Price[]>;
69
80
  protected createPriceLists_(data: PricingTypes.CreatePriceListDTO[], sharedContext?: Context): Promise<PriceList[]>;
@@ -88,3 +99,4 @@ export default class PricingModuleService extends PricingModuleService_base impl
88
99
  };
89
100
  }
90
101
  export {};
102
+ //# sourceMappingURL=pricing-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pricing-module.d.ts","sourceRoot":"","sources":["../../src/services/pricing-module.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,OAAO,EAEP,kBAAkB,EAGlB,GAAG,EACH,UAAU,EACV,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,cAAc,EACd,wBAAwB,EACxB,YAAY,E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C,IAAI,CAAC;cAKA,mBAAmB,CACjC,IAAI,EAAE,YAAY,CAAC,qBAAqB,EAAE,EAC1C,aAAa,GAAE,OAAY,GAC1B,OAAO,CAAC,KAAK,EAAE,CAAC;cAuEH,kBAAkB,CAChC,IAAI,EAAE,YAAY,CAAC,oBAAoB,EAAE,EACzC,aAAa,GAAE,OAAY,GAC1B,OAAO,CAAC,SAAS,EAAE,CAAC;cA2DP,qBAAqB,CACnC,IAAI,EAAE,YAAY,CAAC,uBAAuB,EAAE,EAC5C,aAAa,GAAE,OAAY,GAC1B,OAAO,CAAC,SAAS,EAAE,CAAC;IA4DvB,SAAS,CAAC,sBAAsB,CAC9B,IAAI,EAAE,CACF,YAAY,CAAC,kBAAkB,GAC/B,YAAY,CAAC,kBAAkB,GAC/B,kBAAkB,CACrB,EAAE;IAiBL,SAAS,CAAC,uBAAuB,CAC/B,MAAM,EAAE,UAAU,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,SAAS;;;;;;;;;;;;CAS3D"}
@@ -23,9 +23,10 @@ const generateMethodForModels = {
23
23
  PriceListRule: _models_1.PriceListRule,
24
24
  PriceRule: _models_1.PriceRule,
25
25
  Price: _models_1.Price,
26
+ PricePreference: _models_1.PricePreference,
26
27
  };
27
28
  class PricingModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateMethodForModels) {
28
- constructor({ baseRepository, pricingRepository, priceSetService, priceRuleService, priceService, priceListService, priceListRuleService, }, moduleDeclaration) {
29
+ constructor({ baseRepository, pricingRepository, priceSetService, priceRuleService, priceService, pricePreferenceService, priceListService, priceListRuleService, }, moduleDeclaration) {
29
30
  // @ts-ignore
30
31
  super(...arguments);
31
32
  this.moduleDeclaration = moduleDeclaration;
@@ -34,6 +35,7 @@ class PricingModuleService extends utils_1.ModulesSdkUtils.MedusaService(generat
34
35
  this.priceSetService_ = priceSetService;
35
36
  this.priceRuleService_ = priceRuleService;
36
37
  this.priceService_ = priceService;
38
+ this.pricePreferenceService_ = pricePreferenceService;
37
39
  this.priceListService_ = priceListService;
38
40
  this.priceListRuleService_ = priceListRuleService;
39
41
  }
@@ -98,17 +100,14 @@ class PricingModuleService extends utils_1.ModulesSdkUtils.MedusaService(generat
98
100
  async calculatePrices(pricingFilters, pricingContext = { context: {} }, sharedContext = {}) {
99
101
  const results = await this.pricingRepository_.calculatePrices(pricingFilters, pricingContext, sharedContext);
100
102
  const pricesSetPricesMap = (0, utils_1.groupBy)(results, "price_set_id");
101
- const calculatedPrices = pricingFilters.id
102
- .map((priceSetId) => {
103
- // This is where we select prices, for now we just do a first match based on the database results
104
- // which is prioritized by rules_count first for exact match and then deafult_priority of the rule_type
105
- // TODO: inject custom price selection here
106
- const prices = pricesSetPricesMap.get(priceSetId) || [];
107
- if (!prices.length) {
108
- return null;
109
- }
103
+ const priceIds = [];
104
+ pricesSetPricesMap.forEach((prices, key) => {
110
105
  const priceListPrice = prices.find((p) => p.price_list_id);
111
106
  const defaultPrice = prices?.find((p) => !p.price_list_id);
107
+ if (!prices.length || (!priceListPrice && !defaultPrice)) {
108
+ pricesSetPricesMap.delete(key);
109
+ return;
110
+ }
112
111
  let calculatedPrice = defaultPrice;
113
112
  let originalPrice = defaultPrice;
114
113
  if (priceListPrice) {
@@ -117,11 +116,40 @@ class PricingModuleService extends utils_1.ModulesSdkUtils.MedusaService(generat
117
116
  originalPrice = priceListPrice;
118
117
  }
119
118
  }
119
+ pricesSetPricesMap.set(key, { calculatedPrice, originalPrice });
120
+ priceIds.push(...(0, utils_1.deduplicate)([calculatedPrice?.id, originalPrice?.id].filter(Boolean)));
121
+ });
122
+ // We use the price rules to get the right preferences for the price
123
+ const priceRulesForPrices = await this.priceRuleService_.list({ price_id: priceIds }, { take: null });
124
+ const priceRulesPriceMap = (0, utils_1.groupBy)(priceRulesForPrices, "price_id");
125
+ // Note: For now the preferences are intentionally kept very simple and explicit - they use either the region or currency,
126
+ // so we hard-code those as the possible filters here. This can be made more flexible if needed later on.
127
+ const pricingPreferences = await this.pricePreferenceService_.list({
128
+ $or: Object.entries(pricingContext)
129
+ .filter(([key, val]) => {
130
+ return key === "region_id" || key === "currency_code";
131
+ })
132
+ .map(([key, val]) => ({
133
+ attribute: key,
134
+ value: val,
135
+ })),
136
+ }, {}, sharedContext);
137
+ const calculatedPrices = pricingFilters.id
138
+ .map((priceSetId) => {
139
+ const prices = pricesSetPricesMap.get(priceSetId);
140
+ if (!prices) {
141
+ return null;
142
+ }
143
+ const { calculatedPrice, originalPrice, } = prices;
120
144
  return {
121
145
  id: priceSetId,
122
146
  is_calculated_price_price_list: !!calculatedPrice?.price_list_id,
147
+ is_calculated_price_tax_inclusive: isTaxInclusive(priceRulesPriceMap.get(calculatedPrice.id), pricingPreferences, calculatedPrice.currency_code, pricingContext.context?.region_id),
123
148
  calculated_amount: parseInt(calculatedPrice?.amount || "") || null,
124
149
  is_original_price_price_list: !!originalPrice?.price_list_id,
150
+ is_original_price_tax_inclusive: originalPrice?.id
151
+ ? isTaxInclusive(priceRulesPriceMap.get(originalPrice.id), pricingPreferences, originalPrice.currency_code || calculatedPrice.currency_code, pricingContext.context?.region_id)
152
+ : false,
125
153
  original_amount: parseInt(originalPrice?.amount || "") || null,
126
154
  currency_code: calculatedPrice?.currency_code || null,
127
155
  calculated_price: {
@@ -291,6 +319,43 @@ class PricingModuleService extends utils_1.ModulesSdkUtils.MedusaService(generat
291
319
  const [priceList] = await this.removePriceListRules_([data], sharedContext);
292
320
  return await this.baseRepository_.serialize(priceList);
293
321
  }
322
+ async createPricePreferences(data, sharedContext = {}) {
323
+ const preferences = await this.pricePreferenceService_.create(data, sharedContext);
324
+ const serialized = await this.baseRepository_.serialize(preferences);
325
+ return Array.isArray(data) ? serialized : serialized[0];
326
+ }
327
+ async upsertPricePreferences(data, sharedContext = {}) {
328
+ const input = Array.isArray(data) ? data : [data];
329
+ const forUpdate = input.filter((pricePreference) => !!pricePreference.id);
330
+ const forCreate = input.filter((pricePreference) => !pricePreference.id);
331
+ const operations = [];
332
+ if (forCreate.length) {
333
+ operations.push(this.pricePreferenceService_.create(forCreate, sharedContext));
334
+ }
335
+ if (forUpdate.length) {
336
+ operations.push(this.pricePreferenceService_.update(forUpdate, sharedContext));
337
+ }
338
+ const result = (await (0, utils_1.promiseAll)(operations)).flat();
339
+ return await this.baseRepository_.serialize(Array.isArray(data) ? result : result[0]);
340
+ }
341
+ async updatePricePreferences(idOrSelector, data, sharedContext = {}) {
342
+ let normalizedInput = [];
343
+ if ((0, utils_1.isString)(idOrSelector)) {
344
+ // Check if the ID exists, it will throw if not.
345
+ await this.pricePreferenceService_.retrieve(idOrSelector, {}, sharedContext);
346
+ normalizedInput = [{ id: idOrSelector, ...data }];
347
+ }
348
+ else {
349
+ const pricePreferences = await this.pricePreferenceService_.list(idOrSelector, {}, sharedContext);
350
+ normalizedInput = pricePreferences.map((pricePreference) => ({
351
+ id: pricePreference.id,
352
+ ...data,
353
+ }));
354
+ }
355
+ const updateResult = await this.pricePreferenceService_.update(normalizedInput, sharedContext);
356
+ const pricePreferences = await this.baseRepository_.serialize(updateResult);
357
+ return (0, utils_1.isString)(idOrSelector) ? pricePreferences[0] : pricePreferences;
358
+ }
294
359
  async createPriceSets_(data, sharedContext = {}) {
295
360
  const input = Array.isArray(data) ? data : [data];
296
361
  const toCreate = input.map((inputData) => {
@@ -790,6 +855,28 @@ __decorate([
790
855
  __metadata("design:paramtypes", [Object, Object]),
791
856
  __metadata("design:returntype", Promise)
792
857
  ], PricingModuleService.prototype, "removePriceListRules", null);
858
+ __decorate([
859
+ (0, utils_1.InjectManager)("baseRepository_"),
860
+ (0, utils_1.EmitEvents)(),
861
+ __param(1, (0, utils_1.MedusaContext)()),
862
+ __metadata("design:type", Function),
863
+ __metadata("design:paramtypes", [Object, Object]),
864
+ __metadata("design:returntype", Promise)
865
+ ], PricingModuleService.prototype, "createPricePreferences", null);
866
+ __decorate([
867
+ (0, utils_1.InjectManager)("baseRepository_"),
868
+ __param(1, (0, utils_1.MedusaContext)()),
869
+ __metadata("design:type", Function),
870
+ __metadata("design:paramtypes", [Object, Object]),
871
+ __metadata("design:returntype", Promise)
872
+ ], PricingModuleService.prototype, "upsertPricePreferences", null);
873
+ __decorate([
874
+ (0, utils_1.InjectManager)("baseRepository_"),
875
+ __param(2, (0, utils_1.MedusaContext)()),
876
+ __metadata("design:type", Function),
877
+ __metadata("design:paramtypes", [Object, Object, Object]),
878
+ __metadata("design:returntype", Promise)
879
+ ], PricingModuleService.prototype, "updatePricePreferences", null);
793
880
  __decorate([
794
881
  (0, utils_1.InjectTransactionManager)("baseRepository_"),
795
882
  __param(1, (0, utils_1.MedusaContext)()),
@@ -848,6 +935,18 @@ __decorate([
848
935
  __metadata("design:paramtypes", [Array, Object]),
849
936
  __metadata("design:returntype", Promise)
850
937
  ], PricingModuleService.prototype, "removePriceListRules_", null);
938
+ const isTaxInclusive = (priceRules, preferences, currencyCode, regionId) => {
939
+ const regionRule = priceRules?.find((rule) => rule.attribute === "region_id" && rule.value === regionId);
940
+ const regionPreference = preferences.find((p) => p.attribute === "region_id" && p.value === regionId);
941
+ const currencyPreference = preferences.find((p) => p.attribute === "currency_code" && p.value === currencyCode);
942
+ if (regionRule && regionPreference) {
943
+ return regionPreference.is_tax_inclusive;
944
+ }
945
+ if (currencyPreference) {
946
+ return currencyPreference.is_tax_inclusive;
947
+ }
948
+ return false;
949
+ };
851
950
  const hashPrice = (price) => {
852
951
  const data = Object.entries({
853
952
  currency_code: price.currency_code,
@@ -3,3 +3,4 @@ export type InitializeModuleInjectableDependencies = {
3
3
  logger?: Logger;
4
4
  };
5
5
  export * as ServiceTypes from "./services";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAExC,MAAM,MAAM,sCAAsC,GAAG;IACnD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,OAAO,KAAK,YAAY,MAAM,YAAY,CAAA"}
@@ -1,3 +1,30 @@
1
- export * from "./price-list";
2
- export * from "./price-set";
3
- export * from "./price";
1
+ import { PriceListStatus, PricingTypes } from "@medusajs/types";
2
+ export interface CreatePriceListDTO extends PricingTypes.CreatePriceListDTO {
3
+ rules_count?: number;
4
+ price_list_rules?: {
5
+ attribute: string;
6
+ value: string;
7
+ }[];
8
+ prices?: PricingTypes.CreatePriceListPriceDTO[];
9
+ }
10
+ export interface UpdatePriceListDTO {
11
+ id: string;
12
+ title?: string;
13
+ description?: string | null;
14
+ starts_at?: string | null;
15
+ ends_at?: string | null;
16
+ status?: PriceListStatus;
17
+ number_rules?: number;
18
+ }
19
+ export interface UpdatePriceSetInput extends PricingTypes.UpdatePriceSetDTO {
20
+ id: string;
21
+ }
22
+ export interface UpsertPriceDTO extends Omit<PricingTypes.CreatePriceDTO, "rules"> {
23
+ id?: string;
24
+ price_list_id?: string;
25
+ price_rules: PricingTypes.CreatePriceRuleDTO[];
26
+ }
27
+ export interface UpdatePricePreferenceInput extends PricingTypes.UpdatePricePreferenceDTO {
28
+ id: string;
29
+ }
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE/D,MAAM,WAAW,kBAAmB,SAAQ,YAAY,CAAC,kBAAkB;IACzE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gBAAgB,CAAC,EAAE;QACjB,SAAS,EAAE,MAAM,CAAA;QACjB,KAAK,EAAE,MAAM,CAAA;KACd,EAAE,CAAA;IACH,MAAM,CAAC,EAAE,YAAY,CAAC,uBAAuB,EAAE,CAAA;CAChD;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,MAAM,CAAC,EAAE,eAAe,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,mBAAoB,SAAQ,YAAY,CAAC,iBAAiB;IACzE,EAAE,EAAE,MAAM,CAAA;CACX;AAED,MAAM,WAAW,cACf,SAAQ,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC;IAClD,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,YAAY,CAAC,kBAAkB,EAAE,CAAA;CAC/C;AAED,MAAM,WAAW,0BACf,SAAQ,YAAY,CAAC,wBAAwB;IAC7C,EAAE,EAAE,MAAM,CAAA;CACX"}
@@ -1,19 +1,2 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./price-list"), exports);
18
- __exportStar(require("./price-set"), exports);
19
- __exportStar(require("./price"), exports);
@@ -60,3 +60,4 @@ export declare const eventBuilders: {
60
60
  sharedContext: import("@medusajs/types").Context;
61
61
  }) => void;
62
62
  };
63
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DzB,CAAA"}
@@ -1,2 +1,3 @@
1
1
  export * from "./validate-price-list-dates";
2
2
  export * from "./events";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,UAAU,CAAA"}
@@ -2,3 +2,4 @@ export declare const validatePriceListDates: (priceListData: {
2
2
  starts_at?: Date | string | null;
3
3
  ends_at?: Date | string | null;
4
4
  }) => void;
5
+ //# sourceMappingURL=validate-price-list-dates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-price-list-dates.d.ts","sourceRoot":"","sources":["../../src/utils/validate-price-list-dates.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,kBAAmB;IACpD,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IAChC,OAAO,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;CAC/B,SAcA,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/pricing",
3
- "version": "0.1.13-snapshot-20240704130951",
3
+ "version": "0.1.13-snapshot-20240711051411",
4
4
  "description": "Medusa Pricing module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -34,10 +34,11 @@
34
34
  "orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear"
35
35
  },
36
36
  "devDependencies": {
37
+ "@medusajs/types": "1.12.0-snapshot-20240711051411",
37
38
  "@mikro-orm/cli": "5.9.7",
38
39
  "cross-env": "^5.2.1",
39
40
  "jest": "^29.7.0",
40
- "medusa-test-utils": "1.1.45-snapshot-20240704130951",
41
+ "medusa-test-utils": "1.1.45-snapshot-20240711051411",
41
42
  "rimraf": "^3.0.2",
42
43
  "ts-jest": "^29.1.1",
43
44
  "ts-node": "^10.9.1",
@@ -45,14 +46,10 @@
45
46
  "typescript": "^5.1.6"
46
47
  },
47
48
  "dependencies": {
48
- "@medusajs/modules-sdk": "1.13.0-snapshot-20240704130951",
49
- "@medusajs/types": "1.12.0-snapshot-20240704130951",
50
- "@medusajs/utils": "1.12.0-snapshot-20240704130951",
49
+ "@medusajs/utils": "1.12.0-snapshot-20240711051411",
51
50
  "@mikro-orm/core": "5.9.7",
52
51
  "@mikro-orm/migrations": "5.9.7",
53
52
  "@mikro-orm/postgresql": "5.9.7",
54
- "awilix": "^8.0.0",
55
- "dotenv": "^16.4.5",
56
- "knex": "2.4.2"
53
+ "awilix": "^8.0.0"
57
54
  }
58
55
  }
@@ -1,18 +0,0 @@
1
- import { PriceListStatus, PricingTypes } from "@medusajs/types";
2
- export interface CreatePriceListDTO extends PricingTypes.CreatePriceListDTO {
3
- rules_count?: number;
4
- price_list_rules?: {
5
- attribute: string;
6
- value: string;
7
- }[];
8
- prices?: PricingTypes.CreatePriceListPriceDTO[];
9
- }
10
- export interface UpdatePriceListDTO {
11
- id: string;
12
- title?: string;
13
- description?: string | null;
14
- starts_at?: string | null;
15
- ends_at?: string | null;
16
- status?: PriceListStatus;
17
- number_rules?: number;
18
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +0,0 @@
1
- import { UpdatePriceSetDTO } from "@medusajs/types";
2
- export interface UpdatePriceSetInput extends UpdatePriceSetDTO {
3
- id: string;
4
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- import { PricingTypes } from "@medusajs/types";
2
- export interface UpsertPriceDTO extends Omit<PricingTypes.CreatePriceDTO, "rules"> {
3
- id?: string;
4
- price_list_id?: string;
5
- price_rules: PricingTypes.CreatePriceRuleDTO[];
6
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });