@medusajs/promotion 0.0.6 → 1.0.0-rc-20241001083650

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. package/dist/index.d.ts +5 -4
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +6 -20
  4. package/dist/index.js.map +1 -0
  5. package/dist/joiner-config.d.ts +1 -8
  6. package/dist/joiner-config.d.ts.map +1 -1
  7. package/dist/joiner-config.js +11 -36
  8. package/dist/joiner-config.js.map +1 -0
  9. package/dist/migrations/Migration20240227120221.d.ts.map +1 -1
  10. package/dist/migrations/Migration20240227120221.js +11 -2
  11. package/dist/migrations/Migration20240227120221.js.map +1 -0
  12. package/dist/migrations/Migration20240617102917.d.ts +6 -0
  13. package/dist/migrations/Migration20240617102917.d.ts.map +1 -0
  14. package/dist/migrations/Migration20240617102917.js +16 -0
  15. package/dist/migrations/Migration20240617102917.js.map +1 -0
  16. package/dist/migrations/Migration20240624153824.d.ts +6 -0
  17. package/dist/migrations/Migration20240624153824.d.ts.map +1 -0
  18. package/dist/migrations/Migration20240624153824.js +16 -0
  19. package/dist/migrations/Migration20240624153824.js.map +1 -0
  20. package/dist/models/application-method.d.ts +5 -7
  21. package/dist/models/application-method.d.ts.map +1 -1
  22. package/dist/models/application-method.js +18 -7
  23. package/dist/models/application-method.js.map +1 -0
  24. package/dist/models/campaign-budget.d.ts +8 -7
  25. package/dist/models/campaign-budget.d.ts.map +1 -1
  26. package/dist/models/campaign-budget.js +10 -5
  27. package/dist/models/campaign-budget.js.map +1 -0
  28. package/dist/models/campaign.d.ts +4 -5
  29. package/dist/models/campaign.d.ts.map +1 -1
  30. package/dist/models/campaign.js +12 -14
  31. package/dist/models/campaign.js.map +1 -0
  32. package/dist/models/index.js +1 -0
  33. package/dist/models/index.js.map +1 -0
  34. package/dist/models/promotion-rule-value.d.ts +2 -1
  35. package/dist/models/promotion-rule-value.d.ts.map +1 -1
  36. package/dist/models/promotion-rule-value.js +3 -2
  37. package/dist/models/promotion-rule-value.js.map +1 -0
  38. package/dist/models/promotion-rule.d.ts +2 -2
  39. package/dist/models/promotion-rule.d.ts.map +1 -1
  40. package/dist/models/promotion-rule.js +2 -1
  41. package/dist/models/promotion-rule.js.map +1 -0
  42. package/dist/models/promotion.d.ts +6 -5
  43. package/dist/models/promotion.d.ts.map +1 -1
  44. package/dist/models/promotion.js +10 -5
  45. package/dist/models/promotion.js.map +1 -0
  46. package/dist/schema/index.d.ts +3 -0
  47. package/dist/schema/index.d.ts.map +1 -0
  48. package/dist/schema/index.js +99 -0
  49. package/dist/schema/index.js.map +1 -0
  50. package/dist/services/index.js +1 -0
  51. package/dist/services/index.js.map +1 -0
  52. package/dist/services/promotion-module.d.ts +41 -26
  53. package/dist/services/promotion-module.d.ts.map +1 -1
  54. package/dist/services/promotion-module.js +293 -100
  55. package/dist/services/promotion-module.js.map +1 -0
  56. package/dist/tsconfig.tsbuildinfo +1 -0
  57. package/dist/types/application-method.d.ts +12 -10
  58. package/dist/types/application-method.d.ts.map +1 -1
  59. package/dist/types/application-method.js +1 -0
  60. package/dist/types/application-method.js.map +1 -0
  61. package/dist/types/campaign-budget.d.ts +8 -6
  62. package/dist/types/campaign-budget.d.ts.map +1 -1
  63. package/dist/types/campaign-budget.js +1 -0
  64. package/dist/types/campaign-budget.js.map +1 -0
  65. package/dist/types/campaign.d.ts +7 -9
  66. package/dist/types/campaign.d.ts.map +1 -1
  67. package/dist/types/campaign.js +1 -0
  68. package/dist/types/campaign.js.map +1 -0
  69. package/dist/types/index.d.ts +1 -1
  70. package/dist/types/index.d.ts.map +1 -1
  71. package/dist/types/index.js +1 -0
  72. package/dist/types/index.js.map +1 -0
  73. package/dist/types/promotion-rule-value.d.ts +1 -1
  74. package/dist/types/promotion-rule-value.d.ts.map +1 -1
  75. package/dist/types/promotion-rule-value.js +1 -0
  76. package/dist/types/promotion-rule-value.js.map +1 -0
  77. package/dist/types/promotion-rule.d.ts +1 -1
  78. package/dist/types/promotion-rule.d.ts.map +1 -1
  79. package/dist/types/promotion-rule.js +1 -0
  80. package/dist/types/promotion-rule.js.map +1 -0
  81. package/dist/types/promotion.d.ts +3 -3
  82. package/dist/types/promotion.d.ts.map +1 -1
  83. package/dist/types/promotion.js +1 -0
  84. package/dist/types/promotion.js.map +1 -0
  85. package/dist/utils/compute-actions/buy-get.d.ts +6 -3
  86. package/dist/utils/compute-actions/buy-get.d.ts.map +1 -1
  87. package/dist/utils/compute-actions/buy-get.js +98 -34
  88. package/dist/utils/compute-actions/buy-get.js.map +1 -0
  89. package/dist/utils/compute-actions/index.js +1 -0
  90. package/dist/utils/compute-actions/index.js.map +1 -0
  91. package/dist/utils/compute-actions/line-items.d.ts +2 -2
  92. package/dist/utils/compute-actions/line-items.d.ts.map +1 -1
  93. package/dist/utils/compute-actions/line-items.js +10 -10
  94. package/dist/utils/compute-actions/line-items.js.map +1 -0
  95. package/dist/utils/compute-actions/shipping-methods.d.ts +3 -3
  96. package/dist/utils/compute-actions/shipping-methods.d.ts.map +1 -1
  97. package/dist/utils/compute-actions/shipping-methods.js +20 -22
  98. package/dist/utils/compute-actions/shipping-methods.js.map +1 -0
  99. package/dist/utils/compute-actions/usage.d.ts +2 -3
  100. package/dist/utils/compute-actions/usage.d.ts.map +1 -1
  101. package/dist/utils/compute-actions/usage.js +6 -13
  102. package/dist/utils/compute-actions/usage.js.map +1 -0
  103. package/dist/utils/index.js +1 -0
  104. package/dist/utils/index.js.map +1 -0
  105. package/dist/utils/validations/application-method.d.ts.map +1 -1
  106. package/dist/utils/validations/application-method.js +6 -5
  107. package/dist/utils/validations/application-method.js.map +1 -0
  108. package/dist/utils/validations/index.js +1 -0
  109. package/dist/utils/validations/index.js.map +1 -0
  110. package/dist/utils/validations/promotion-rule.d.ts +2 -2
  111. package/dist/utils/validations/promotion-rule.d.ts.map +1 -1
  112. package/dist/utils/validations/promotion-rule.js +27 -7
  113. package/dist/utils/validations/promotion-rule.js.map +1 -0
  114. package/package.json +20 -21
  115. package/dist/initialize/index.d.ts +0 -5
  116. package/dist/initialize/index.d.ts.map +0 -1
  117. package/dist/initialize/index.js +0 -16
  118. package/dist/loaders/connection.d.ts +0 -5
  119. package/dist/loaders/connection.d.ts.map +0 -1
  120. package/dist/loaders/connection.js +0 -41
  121. package/dist/loaders/container.d.ts +0 -3
  122. package/dist/loaders/container.d.ts.map +0 -1
  123. package/dist/loaders/container.js +0 -34
  124. package/dist/loaders/index.d.ts +0 -3
  125. package/dist/loaders/index.d.ts.map +0 -1
  126. package/dist/loaders/index.js +0 -18
  127. package/dist/module-definition.d.ts +0 -5
  128. package/dist/module-definition.d.ts.map +0 -1
  129. package/dist/module-definition.js +0 -50
  130. package/dist/repositories/campaign.d.ts +0 -16
  131. package/dist/repositories/campaign.d.ts.map +0 -1
  132. package/dist/repositories/campaign.js +0 -90
  133. package/dist/repositories/index.d.ts +0 -3
  134. package/dist/repositories/index.d.ts.map +0 -1
  135. package/dist/repositories/index.js +0 -7
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promotion-module.js","sourceRoot":"","sources":["../../src/services/promotion-module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qDAQkC;AAClC,qDAkBkC;AAClC,qCAOgB;AAChB,mCAWe;AACf,mCAMe;AACf,oDAA+C;AAa/C,MAAqB,sBACnB,SAAQ,IAAA,qBAAa,EAOlB;IACD,SAAS,EAAT,mBAAS;IACT,iBAAiB,EAAjB,2BAAiB;IACjB,QAAQ,EAAR,kBAAQ;IACR,cAAc,EAAd,wBAAc;IACd,aAAa,EAAb,uBAAa;IACb,kBAAkB,EAAlB,4BAAkB;CACnB,CAAC;IAWF,YACE,EACE,cAAc,EACd,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EACpB,yBAAyB,EACzB,eAAe,EACf,qBAAqB,GACA,EACJ,iBAA4C;QAE/D,aAAa;QACb,KAAK,CAAC,GAAG,SAAS,CAAC,CAAA;QAHA,sBAAiB,GAAjB,iBAAiB,CAA2B;QAK/D,IAAI,CAAC,eAAe,GAAG,cAAc,CAAA;Q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oDjB;AAoCK;IADL,IAAA,qBAAa,GAAE;IAGb,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;6DAcjB;AAGe;IADf,IAAA,gCAAwB,GAAE;IAGxB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;8DAmEjB;AAGK;IADL,IAAA,qBAAa,GAAE;;;;qEAQf;AAOe;IADf,IAAA,gCAAwB,GAAE;IAGxB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;sEAgDjB;AAGK;IADL,IAAA,qBAAa,GAAE;;;;0EAQf;AAGe;IADf,IAAA,gCAAwB,GAAE;IAGxB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;2EAgCjB"}
@@ -0,0 +1 @@
1
+ {"root":["../src/index.ts","../src/joiner-config.ts","../src/migrations/migration20240227120221.ts","../src/migrations/migration20240617102917.ts","../src/migrations/migration20240624153824.ts","../src/models/application-method.ts","../src/models/campaign-budget.ts","../src/models/campaign.ts","../src/models/index.ts","../src/models/promotion-rule-value.ts","../src/models/promotion-rule.ts","../src/models/promotion.ts","../src/schema/index.ts","../src/services/index.ts","../src/services/promotion-module.ts","../src/types/application-method.ts","../src/types/campaign-budget.ts","../src/types/campaign.ts","../src/types/index.ts","../src/types/promotion-rule-value.ts","../src/types/promotion-rule.ts","../src/types/promotion.ts","../src/utils/index.ts","../src/utils/compute-actions/buy-get.ts","../src/utils/compute-actions/index.ts","../src/utils/compute-actions/line-items.ts","../src/utils/compute-actions/shipping-methods.ts","../src/utils/compute-actions/usage.ts","../src/utils/validations/application-method.ts","../src/utils/validations/index.ts","../src/utils/validations/promotion-rule.ts"],"version":"5.6.2"}
@@ -1,24 +1,26 @@
1
- import { ApplicationMethodAllocationValues, ApplicationMethodTargetTypeValues, ApplicationMethodTypeValues, PromotionDTO } from "@medusajs/types";
1
+ import { ApplicationMethodAllocationValues, ApplicationMethodTargetTypeValues, ApplicationMethodTypeValues, BigNumberInput, PromotionDTO } from "@medusajs/framework/types";
2
2
  import { Promotion } from "../models";
3
3
  export interface CreateApplicationMethodDTO {
4
4
  type: ApplicationMethodTypeValues;
5
5
  target_type: ApplicationMethodTargetTypeValues;
6
6
  allocation?: ApplicationMethodAllocationValues;
7
- value?: number;
7
+ value?: BigNumberInput;
8
+ currency_code?: string | null;
8
9
  promotion: Promotion | string | PromotionDTO;
9
- max_quantity?: number | null;
10
- buy_rules_min_quantity?: number | null;
11
- apply_to_quantity?: number | null;
10
+ max_quantity?: BigNumberInput | null;
11
+ buy_rules_min_quantity?: BigNumberInput | null;
12
+ apply_to_quantity?: BigNumberInput | null;
12
13
  }
13
14
  export interface UpdateApplicationMethodDTO {
14
- id: string;
15
+ id?: string;
15
16
  type?: ApplicationMethodTypeValues;
16
17
  target_type?: ApplicationMethodTargetTypeValues;
17
18
  allocation?: ApplicationMethodAllocationValues;
18
- value?: number;
19
+ value?: BigNumberInput;
20
+ currency_code?: string | null;
19
21
  promotion?: Promotion | string | PromotionDTO;
20
- max_quantity?: number | null;
21
- buy_rules_min_quantity?: number | null;
22
- apply_to_quantity?: number | null;
22
+ max_quantity?: BigNumberInput | null;
23
+ buy_rules_min_quantity?: BigNumberInput | null;
24
+ apply_to_quantity?: BigNumberInput | null;
23
25
  }
24
26
  //# sourceMappingURL=application-method.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"application-method.d.ts","sourceRoot":"","sources":["../../src/types/application-method.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,iCAAiC,EACjC,2BAA2B,EAC3B,YAAY,EACb,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,2BAA2B,CAAA;IACjC,WAAW,EAAE,iCAAiC,CAAA;IAC9C,UAAU,CAAC,EAAE,iCAAiC,CAAA;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,YAAY,CAAA;IAC5C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1C;AAED,MAAM,WAAW,0BAA0B;IACzC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,2BAA2B,CAAA;IAClC,WAAW,CAAC,EAAE,iCAAiC,CAAA;IAC/C,UAAU,CAAC,EAAE,iCAAiC,CAAA;IAC9C,KAAK,CAAC,EAAE,cAAc,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,SAAS,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,YAAY,CAAA;IAC7C,YAAY,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IACpC,sBAAsB,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IAC9C,iBAAiB,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;CAC1C"}
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=application-method.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application-method.js","sourceRoot":"","sources":["../../src/types/application-method.ts"],"names":[],"mappings":""}
@@ -1,15 +1,17 @@
1
- import { CampaignBudgetTypeValues } from "@medusajs/types";
1
+ import { BigNumberInput, CampaignBudgetTypeValues } from "@medusajs/framework/types";
2
2
  import { Campaign } from "../models";
3
3
  export interface CreateCampaignBudgetDTO {
4
- type: CampaignBudgetTypeValues;
5
- limit: number | null;
6
- used?: number;
4
+ type?: CampaignBudgetTypeValues;
5
+ limit?: BigNumberInput | null;
6
+ currency_code?: string | null;
7
+ used?: BigNumberInput;
7
8
  campaign?: Campaign | string;
8
9
  }
9
10
  export interface UpdateCampaignBudgetDTO {
10
11
  id: string;
11
12
  type?: CampaignBudgetTypeValues;
12
- limit?: number | null;
13
- used?: number;
13
+ limit?: BigNumberInput | null;
14
+ currency_code?: string | null;
15
+ used?: BigNumberInput;
14
16
  }
15
17
  //# sourceMappingURL=campaign-budget.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"campaign-budget.d.ts","sourceRoot":"","sources":["../../src/types/campaign-budget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAElC,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,wBAAwB,CAAA;IAC9B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAA;CAC7B;AAED,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,wBAAwB,CAAA;IAC/B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd"}
1
+ {"version":3,"file":"campaign-budget.d.ts","sourceRoot":"","sources":["../../src/types/campaign-budget.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,wBAAwB,EACzB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAElC,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,wBAAwB,CAAA;IAC/B,KAAK,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IAC7B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAA;CAC7B;AAED,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,wBAAwB,CAAA;IAC/B,KAAK,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IAC7B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,IAAI,CAAC,EAAE,cAAc,CAAA;CACtB"}
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=campaign-budget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"campaign-budget.js","sourceRoot":"","sources":["../../src/types/campaign-budget.ts"],"names":[],"mappings":""}
@@ -1,22 +1,20 @@
1
- import { PromotionDTO } from "@medusajs/types";
1
+ import { PromotionDTO } from "@medusajs/framework/types";
2
2
  import { Promotion } from "../models";
3
3
  export interface CreateCampaignDTO {
4
4
  name: string;
5
- description?: string;
6
- currency?: string;
5
+ description?: string | null;
7
6
  campaign_identifier: string;
8
- starts_at: Date;
9
- ends_at: Date;
7
+ starts_at?: Date | null;
8
+ ends_at?: Date | null;
10
9
  promotions?: (PromotionDTO | Promotion)[];
11
10
  }
12
11
  export interface UpdateCampaignDTO {
13
12
  id: string;
14
13
  name?: string;
15
- description?: string;
16
- currency?: string;
14
+ description?: string | null;
17
15
  campaign_identifier?: string;
18
- starts_at?: Date;
19
- ends_at?: Date;
16
+ starts_at?: Date | null;
17
+ ends_at?: Date | null;
20
18
  promotions?: (PromotionDTO | Promotion)[];
21
19
  }
22
20
  //# sourceMappingURL=campaign.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"campaign.d.ts","sourceRoot":"","sources":["../../src/types/campaign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,SAAS,EAAE,IAAI,CAAA;IACf,OAAO,EAAE,IAAI,CAAA;IACb,UAAU,CAAC,EAAE,CAAC,YAAY,GAAG,SAAS,CAAC,EAAE,CAAA;CAC1C;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,SAAS,CAAC,EAAE,IAAI,CAAA;IAChB,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,UAAU,CAAC,EAAE,CAAC,YAAY,GAAG,SAAS,CAAC,EAAE,CAAA;CAC1C"}
1
+ {"version":3,"file":"campaign.d.ts","sourceRoot":"","sources":["../../src/types/campaign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IACvB,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IACrB,UAAU,CAAC,EAAE,CAAC,YAAY,GAAG,SAAS,CAAC,EAAE,CAAA;CAC1C;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IACvB,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IACrB,UAAU,CAAC,EAAE,CAAC,YAAY,GAAG,SAAS,CAAC,EAAE,CAAA;CAC1C"}
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=campaign.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"campaign.js","sourceRoot":"","sources":["../../src/types/campaign.ts"],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { Logger } from "@medusajs/types";
1
+ import { Logger } from "@medusajs/framework/types";
2
2
  export type InitializeModuleInjectableDependencies = {
3
3
  logger?: Logger;
4
4
  };
@@ -1 +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,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,MAAM,MAAM,sCAAsC,GAAG;IACnD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA"}
@@ -20,3 +20,4 @@ __exportStar(require("./campaign-budget"), exports);
20
20
  __exportStar(require("./promotion"), exports);
21
21
  __exportStar(require("./promotion-rule"), exports);
22
22
  __exportStar(require("./promotion-rule-value"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAMA,uDAAoC;AACpC,6CAA0B;AAC1B,oDAAiC;AACjC,8CAA2B;AAC3B,mDAAgC;AAChC,yDAAsC"}
@@ -1,4 +1,4 @@
1
- import { PromotionRuleDTO } from "@medusajs/types";
1
+ import { PromotionRuleDTO } from "@medusajs/framework/types";
2
2
  import { PromotionRule } from "../models";
3
3
  export interface CreatePromotionRuleValueDTO {
4
4
  value: any;
@@ -1 +1 @@
1
- {"version":3,"file":"promotion-rule-value.d.ts","sourceRoot":"","sources":["../../src/types/promotion-rule-value.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,GAAG,CAAA;IACV,cAAc,EAAE,MAAM,GAAG,gBAAgB,GAAG,aAAa,CAAA;CAC1D;AAED,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,GAAG,CAAA;IACV,cAAc,EAAE,MAAM,GAAG,gBAAgB,GAAG,aAAa,CAAA;CAC1D"}
1
+ {"version":3,"file":"promotion-rule-value.d.ts","sourceRoot":"","sources":["../../src/types/promotion-rule-value.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,GAAG,CAAA;IACV,cAAc,EAAE,MAAM,GAAG,gBAAgB,GAAG,aAAa,CAAA;CAC1D;AAED,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,GAAG,CAAA;IACV,cAAc,EAAE,MAAM,GAAG,gBAAgB,GAAG,aAAa,CAAA;CAC1D"}
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=promotion-rule-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promotion-rule-value.js","sourceRoot":"","sources":["../../src/types/promotion-rule-value.ts"],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { PromotionRuleOperatorValues } from "@medusajs/types";
1
+ import { PromotionRuleOperatorValues } from "@medusajs/framework/types";
2
2
  export interface CreatePromotionRuleDTO {
3
3
  description?: string | null;
4
4
  attribute: string;
@@ -1 +1 @@
1
- {"version":3,"file":"promotion-rule.d.ts","sourceRoot":"","sources":["../../src/types/promotion-rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAA;AAE7D,MAAM,WAAW,sBAAsB;IACrC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,2BAA2B,CAAA;CACtC;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAA;CACX;AAED,oBAAY,0BAA0B;IACpC,YAAY,iBAAiB;IAC7B,SAAS,cAAc;CACxB"}
1
+ {"version":3,"file":"promotion-rule.d.ts","sourceRoot":"","sources":["../../src/types/promotion-rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAA;AAEvE,MAAM,WAAW,sBAAsB;IACrC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,2BAA2B,CAAA;CACtC;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAA;CACX;AAED,oBAAY,0BAA0B;IACpC,YAAY,iBAAiB;IAC7B,SAAS,cAAc;CACxB"}
@@ -6,3 +6,4 @@ var ApplicationMethodRuleTypes;
6
6
  ApplicationMethodRuleTypes["TARGET_RULES"] = "target_rules";
7
7
  ApplicationMethodRuleTypes["BUY_RULES"] = "buy_rules";
8
8
  })(ApplicationMethodRuleTypes || (exports.ApplicationMethodRuleTypes = ApplicationMethodRuleTypes = {}));
9
+ //# sourceMappingURL=promotion-rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promotion-rule.js","sourceRoot":"","sources":["../../src/types/promotion-rule.ts"],"names":[],"mappings":";;;AAYA,IAAY,0BAGX;AAHD,WAAY,0BAA0B;IACpC,2DAA6B,CAAA;IAC7B,qDAAuB,CAAA;AACzB,CAAC,EAHW,0BAA0B,0CAA1B,0BAA0B,QAGrC"}
@@ -1,15 +1,15 @@
1
- import { PromotionTypeValues } from "@medusajs/types";
1
+ import { PromotionTypeValues } from "@medusajs/framework/types";
2
2
  export interface CreatePromotionDTO {
3
3
  code: string;
4
4
  type: PromotionTypeValues;
5
5
  is_automatic?: boolean;
6
- campaign?: string;
6
+ campaign_id?: string | null;
7
7
  }
8
8
  export interface UpdatePromotionDTO {
9
9
  id: string;
10
10
  code?: string;
11
11
  type?: PromotionTypeValues;
12
12
  is_automatic?: boolean;
13
- campaign?: string;
13
+ campaign_id?: string | null;
14
14
  }
15
15
  //# sourceMappingURL=promotion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"promotion.d.ts","sourceRoot":"","sources":["../../src/types/promotion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,mBAAmB,CAAA;IACzB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,mBAAmB,CAAA;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB"}
1
+ {"version":3,"file":"promotion.d.ts","sourceRoot":"","sources":["../../src/types/promotion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAE/D,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,mBAAmB,CAAA;IACzB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,mBAAmB,CAAA;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B"}
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=promotion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promotion.js","sourceRoot":"","sources":["../../src/types/promotion.ts"],"names":[],"mappings":""}
@@ -1,5 +1,8 @@
1
- import { PromotionTypes } from "@medusajs/types";
2
- import { ApplicationMethodTargetType } from "@medusajs/utils";
3
- export declare function getComputedActionsForBuyGet(promotion: PromotionTypes.PromotionDTO, itemsContext: PromotionTypes.ComputeActionContext[ApplicationMethodTargetType.ITEMS], methodIdPromoValueMap: Map<string, number>): PromotionTypes.ComputeActions[];
1
+ import { BigNumberInput, ComputeActionItemLine, PromotionTypes } from "@medusajs/framework/types";
2
+ export type EligibleItem = {
3
+ item_id: string;
4
+ quantity: BigNumberInput;
5
+ };
6
+ export declare function getComputedActionsForBuyGet(promotion: PromotionTypes.PromotionDTO, itemsContext: ComputeActionItemLine[], methodIdPromoValueMap: Map<string, BigNumberInput>, eligibleBuyItemMap: Map<string, EligibleItem[]>, eligibleTargetItemMap: Map<string, EligibleItem[]>): PromotionTypes.ComputeActions[];
4
7
  export declare function sortByBuyGetType(a: any, b: any): 0 | 1 | -1;
5
8
  //# sourceMappingURL=buy-get.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buy-get.d.ts","sourceRoot":"","sources":["../../../src/utils/compute-actions/buy-get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EACL,2BAA2B,EAK5B,MAAM,iBAAiB,CAAA;AAKxB,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,cAAc,CAAC,YAAY,EACtC,YAAY,EAAE,cAAc,CAAC,oBAAoB,CAAC,2BAA2B,CAAC,KAAK,CAAC,EACpF,qBAAqB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACzC,cAAc,CAAC,cAAc,EAAE,CA6EjC;AAED,wBAAgB,gBAAgB,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA,cAWpC"}
1
+ {"version":3,"file":"buy-get.d.ts","sourceRoot":"","sources":["../../../src/utils/compute-actions/buy-get.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,cAAc,EACf,MAAM,2BAA2B,CAAA;AAWlC,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,cAAc,CAAA;CACzB,CAAA;AAyBD,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,cAAc,CAAC,YAAY,EACtC,YAAY,EAAE,qBAAqB,EAAE,EACrC,qBAAqB,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,EAClD,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,EAC/C,qBAAqB,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,GACjD,cAAc,CAAC,cAAc,EAAE,CA+LjC;AAED,wBAAgB,gBAAgB,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA,cAWpC"}
@@ -1,45 +1,110 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sortByBuyGetType = exports.getComputedActionsForBuyGet = void 0;
4
- const utils_1 = require("@medusajs/utils");
3
+ exports.getComputedActionsForBuyGet = getComputedActionsForBuyGet;
4
+ exports.sortByBuyGetType = sortByBuyGetType;
5
+ const utils_1 = require("@medusajs/framework/utils");
5
6
  const validations_1 = require("../validations");
6
7
  const usage_1 = require("./usage");
7
- // TODO: calculations should eventually move to a totals util outside of the module
8
- function getComputedActionsForBuyGet(promotion, itemsContext, methodIdPromoValueMap) {
9
- const buyRulesMinQuantity = promotion.application_method?.buy_rules_min_quantity;
10
- const applyToQuantity = promotion.application_method?.apply_to_quantity;
11
- const buyRules = promotion.application_method?.buy_rules;
12
- const targetRules = promotion.application_method?.target_rules;
8
+ function sortByPrice(a, b) {
9
+ return utils_1.MathBN.lt(a.subtotal, b.subtotal) ? 1 : -1;
10
+ }
11
+ /*
12
+ Grabs all the items in the context where the rules apply
13
+ We then sort by price to prioritize most valuable item
14
+ */
15
+ function filterItemsByPromotionRules(itemsContext, rules) {
16
+ return itemsContext
17
+ .filter((item) => (0, validations_1.areRulesValidForContext)(rules || [], item, utils_1.ApplicationMethodTargetType.ITEMS))
18
+ .sort(sortByPrice);
19
+ }
20
+ function getComputedActionsForBuyGet(promotion, itemsContext, methodIdPromoValueMap, eligibleBuyItemMap, eligibleTargetItemMap) {
13
21
  const computedActions = [];
22
+ const minimumBuyQuantity = utils_1.MathBN.convert(promotion.application_method?.buy_rules_min_quantity ?? 0);
23
+ const itemsMap = new Map(itemsContext.map((i) => [i.id, i]));
14
24
  if (!itemsContext) {
15
25
  throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `"items" should be present as an array in the context to compute actions`);
16
26
  }
17
- if (!Array.isArray(buyRules) || !Array.isArray(targetRules)) {
27
+ const eligibleBuyItems = filterItemsByPromotionRules(itemsContext, promotion.application_method?.buy_rules);
28
+ const eligibleBuyItemQuantity = utils_1.MathBN.sum(...eligibleBuyItems.map((item) => item.quantity));
29
+ /*
30
+ Get the total quantity of items where buy rules apply. If the total sum of eligible items
31
+ does not match up to the minimum buy quantity set on the promotion, return early.
32
+ */
33
+ if (utils_1.MathBN.gt(minimumBuyQuantity, eligibleBuyItemQuantity)) {
18
34
  return [];
19
35
  }
20
- const validQuantity = itemsContext
21
- .filter((item) => (0, validations_1.areRulesValidForContext)(buyRules, item))
22
- .reduce((acc, next) => acc + next.quantity, 0);
23
- if (!buyRulesMinQuantity ||
24
- !applyToQuantity ||
25
- buyRulesMinQuantity > validQuantity) {
36
+ /*
37
+ Eligibility of a BuyGet promotion can span across line items. Once an item has been chosen
38
+ as eligible, we can't use this item or its partial remaining quantity when we apply the promotion on
39
+ the target item.
40
+
41
+ We build the map here to use when we apply promotions on the target items.
42
+ */
43
+ for (const eligibleBuyItem of eligibleBuyItems) {
44
+ const eligibleItemsByPromotion = eligibleBuyItemMap.get(promotion.code) || [];
45
+ const accumulatedQuantity = eligibleItemsByPromotion.reduce((acc, item) => utils_1.MathBN.sum(acc, item.quantity), utils_1.MathBN.convert(0));
46
+ // If we have reached the minimum buy quantity from the eligible items for this promotion,
47
+ // we can break early and continue to applying the target items
48
+ if (utils_1.MathBN.gte(accumulatedQuantity, minimumBuyQuantity)) {
49
+ break;
50
+ }
51
+ const eligibleQuantity = utils_1.MathBN.sum(...eligibleItemsByPromotion
52
+ .filter((buy) => buy.item_id === eligibleBuyItem.id)
53
+ .map((b) => b.quantity));
54
+ const reservableQuantity = utils_1.MathBN.min(eligibleBuyItem.quantity, utils_1.MathBN.sub(minimumBuyQuantity, eligibleQuantity));
55
+ // If we have reached the required minimum quantity, we break the loop early
56
+ if (utils_1.MathBN.lte(reservableQuantity, 0)) {
57
+ break;
58
+ }
59
+ eligibleItemsByPromotion.push({
60
+ item_id: eligibleBuyItem.id,
61
+ quantity: utils_1.MathBN.min(eligibleBuyItem.quantity, reservableQuantity).toNumber(),
62
+ });
63
+ eligibleBuyItemMap.set(promotion.code, eligibleItemsByPromotion);
64
+ }
65
+ const eligibleTargetItems = filterItemsByPromotionRules(itemsContext, promotion.application_method?.target_rules);
66
+ const targetQuantity = utils_1.MathBN.convert(promotion.application_method?.apply_to_quantity ?? 0);
67
+ /*
68
+ In this loop, we build a map of eligible target items and quantity applicable to these items.
69
+
70
+ Here we remove the quantity we used previously to identify eligible buy items
71
+ from the eligible target items.
72
+
73
+ This is done to prevent applying promotion to the same item we use to qualify the buy rules.
74
+ */
75
+ for (const eligibleTargetItem of eligibleTargetItems) {
76
+ const inapplicableQuantity = utils_1.MathBN.sum(...Array.from(eligibleBuyItemMap.values())
77
+ .flat(1)
78
+ .filter((buy) => buy.item_id === eligibleTargetItem.id)
79
+ .map((b) => b.quantity));
80
+ const applicableQuantity = utils_1.MathBN.sub(eligibleTargetItem.quantity, inapplicableQuantity);
81
+ const fulfillableQuantity = utils_1.MathBN.min(targetQuantity, applicableQuantity);
82
+ // If we have reached the required quantity to target from this item, we
83
+ // move on to the next item
84
+ if (utils_1.MathBN.lte(fulfillableQuantity, 0)) {
85
+ continue;
86
+ }
87
+ const targetItemsByPromotion = eligibleTargetItemMap.get(promotion.code) || [];
88
+ targetItemsByPromotion.push({
89
+ item_id: eligibleTargetItem.id,
90
+ quantity: utils_1.MathBN.min(fulfillableQuantity, targetQuantity).toNumber(),
91
+ });
92
+ eligibleTargetItemMap.set(promotion.code, targetItemsByPromotion);
93
+ }
94
+ const targetItemsByPromotion = eligibleTargetItemMap.get(promotion.code) || [];
95
+ const targettableQuantity = targetItemsByPromotion.reduce((sum, item) => utils_1.MathBN.sum(sum, item.quantity), utils_1.MathBN.convert(0));
96
+ // If we were able to match the target requirements across all line items, we return early.
97
+ if (utils_1.MathBN.lt(targettableQuantity, targetQuantity)) {
26
98
  return [];
27
99
  }
28
- const validItemsForTargetRules = itemsContext
29
- .filter((item) => (0, validations_1.areRulesValidForContext)(targetRules, item))
30
- .filter((item) => (0, utils_1.isPresent)(item.subtotal) && (0, utils_1.isPresent)(item.quantity))
31
- .sort((a, b) => {
32
- const aPrice = a.subtotal / a.quantity;
33
- const bPrice = b.subtotal / b.quantity;
34
- return bPrice - aPrice;
35
- });
36
- let remainingQtyToApply = applyToQuantity;
37
- for (const method of validItemsForTargetRules) {
38
- const appliedPromoValue = methodIdPromoValueMap.get(method.id) ?? 0;
39
- const multiplier = Math.min(method.quantity, remainingQtyToApply);
40
- const amount = (method.subtotal / method.quantity) * multiplier;
41
- const newRemainingQtyToApply = remainingQtyToApply - multiplier;
42
- if (newRemainingQtyToApply < 0 || amount <= 0) {
100
+ let remainingQtyToApply = utils_1.MathBN.convert(targetQuantity);
101
+ for (const targetItem of targetItemsByPromotion) {
102
+ const item = itemsMap.get(targetItem.item_id);
103
+ const appliedPromoValue = methodIdPromoValueMap.get(item.id) ?? utils_1.MathBN.convert(0);
104
+ const multiplier = utils_1.MathBN.min(targetItem.quantity, remainingQtyToApply);
105
+ const amount = utils_1.MathBN.mult(utils_1.MathBN.div(item.subtotal, item.quantity), multiplier);
106
+ const newRemainingQtyToApply = utils_1.MathBN.sub(remainingQtyToApply, multiplier);
107
+ if (utils_1.MathBN.lt(newRemainingQtyToApply, 0) || utils_1.MathBN.lte(amount, 0)) {
43
108
  break;
44
109
  }
45
110
  else {
@@ -50,17 +115,16 @@ function getComputedActionsForBuyGet(promotion, itemsContext, methodIdPromoValue
50
115
  computedActions.push(budgetExceededAction);
51
116
  continue;
52
117
  }
53
- methodIdPromoValueMap.set(method.id, appliedPromoValue + amount);
118
+ methodIdPromoValueMap.set(item.id, utils_1.MathBN.add(appliedPromoValue, amount).toNumber());
54
119
  computedActions.push({
55
120
  action: utils_1.ComputedActions.ADD_ITEM_ADJUSTMENT,
56
- item_id: method.id,
121
+ item_id: item.id,
57
122
  amount,
58
123
  code: promotion.code,
59
124
  });
60
125
  }
61
126
  return computedActions;
62
127
  }
63
- exports.getComputedActionsForBuyGet = getComputedActionsForBuyGet;
64
128
  function sortByBuyGetType(a, b) {
65
129
  if (a.type === utils_1.PromotionType.BUYGET && b.type !== utils_1.PromotionType.BUYGET) {
66
130
  return -1;
@@ -73,4 +137,4 @@ function sortByBuyGetType(a, b) {
73
137
  return 0;
74
138
  }
75
139
  }
76
- exports.sortByBuyGetType = sortByBuyGetType;
140
+ //# sourceMappingURL=buy-get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buy-get.js","sourceRoot":"","sources":["../../../src/utils/compute-actions/buy-get.ts"],"names":[],"mappings":";;AA2CA,kEAqMC;AAED,4CAWC;AAxPD,qDAMkC;AAClC,gDAAwD;AACxD,mCAAwD;AAOxD,SAAS,WAAW,CAAC,CAAwB,EAAE,CAAwB;IACrE,OAAO,cAAM,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACnD,CAAC;AAED;;;EAGE;AACF,SAAS,2BAA2B,CAClC,YAAqC,EACrC,KAAyC;IAEzC,OAAO,YAAY;SAChB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CACf,IAAA,qCAAuB,EACrB,KAAK,IAAI,EAAE,EACX,IAAI,EACJ,mCAA2B,CAAC,KAAK,CAClC,CACF;SACA,IAAI,CAAC,WAAW,CAAC,CAAA;AACtB,CAAC;AAED,SAAgB,2BAA2B,CACzC,SAAsC,EACtC,YAAqC,EACrC,qBAAkD,EAClD,kBAA+C,EAC/C,qBAAkD;IAElD,MAAM,eAAe,GAAoC,EAAE,CAAA;IAE3D,MAAM,kBAAkB,GAAG,cAAM,CAAC,OAAO,CACvC,SAAS,CAAC,kBAAkB,EAAE,sBAAsB,IAAI,CAAC,CAC1D,CAAA;IAED,MAAM,QAAQ,GAAG,IAAI,GAAG,CACtB,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,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OAAO,eAAe,CAAA;AACxB,CAAC;AAED,SAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC;IACnC,IAAI,CAAC,CAAC,IAAI,KAAK,qBAAa,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,KAAK,qBAAa,CAAC,MAAM,EAAE,CAAC;QACvE,OAAO,CAAC,CAAC,CAAA;IACX,CAAC;SAAM,IACL,CAAC,CAAC,IAAI,KAAK,qBAAa,CAAC,MAAM;QAC/B,CAAC,CAAC,IAAI,KAAK,qBAAa,CAAC,MAAM,EAC/B,CAAC;QACD,OAAO,CAAC,CAAA;IACV,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,CAAA;IACV,CAAC;AACH,CAAC"}
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./buy-get"), exports);
18
18
  __exportStar(require("./line-items"), exports);
19
19
  __exportStar(require("./usage"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/compute-actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,+CAA4B;AAC5B,0CAAuB"}
@@ -1,5 +1,5 @@
1
- import { ApplicationMethodAllocationValues, PromotionTypes } from "@medusajs/types";
2
- import { ApplicationMethodTargetType as TargetType } from "@medusajs/utils";
1
+ import { ApplicationMethodAllocationValues, PromotionTypes } from "@medusajs/framework/types";
2
+ import { ApplicationMethodTargetType as TargetType } from "@medusajs/framework/utils";
3
3
  export declare function getComputedActionsForItems(promotion: PromotionTypes.PromotionDTO, items: PromotionTypes.ComputeActionContext[TargetType.ITEMS], appliedPromotionsMap: Map<string, number>, allocationOverride?: ApplicationMethodAllocationValues): PromotionTypes.ComputeActions[];
4
4
  export declare function getComputedActionsForShippingMethods(promotion: PromotionTypes.PromotionDTO, shippingMethods: PromotionTypes.ComputeActionContext[TargetType.SHIPPING_METHODS], appliedPromotionsMap: Map<string, number>): PromotionTypes.ComputeActions[];
5
5
  export declare function getComputedActionsForOrder(promotion: PromotionTypes.PromotionDTO, itemApplicationContext: PromotionTypes.ComputeActionContext, methodIdPromoValueMap: Map<string, number>): PromotionTypes.ComputeActions[];
@@ -1 +1 @@
1
- {"version":3,"file":"line-items.d.ts","sourceRoot":"","sources":["../../../src/utils/compute-actions/line-items.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,cAAc,EACf,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAIL,2BAA2B,IAAI,UAAU,EAE1C,MAAM,iBAAiB,CAAA;AAgBxB,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,cAAc,CAAC,YAAY,EACtC,KAAK,EAAE,cAAc,CAAC,oBAAoB,CAAC,UAAU,CAAC,KAAK,CAAC,EAC5D,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACzC,kBAAkB,CAAC,EAAE,iCAAiC,GACrD,cAAc,CAAC,cAAc,EAAE,CASjC;AAED,wBAAgB,oCAAoC,CAClD,SAAS,EAAE,cAAc,CAAC,YAAY,EACtC,eAAe,EAAE,cAAc,CAAC,oBAAoB,CAAC,UAAU,CAAC,gBAAgB,CAAC,EACjF,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACxC,cAAc,CAAC,cAAc,EAAE,CAIjC;AAED,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,cAAc,CAAC,YAAY,EACtC,sBAAsB,EAAE,cAAc,CAAC,oBAAoB,EAC3D,qBAAqB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACzC,cAAc,CAAC,cAAc,EAAE,CAOjC"}
1
+ {"version":3,"file":"line-items.d.ts","sourceRoot":"","sources":["../../../src/utils/compute-actions/line-items.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EAEjC,cAAc,EACf,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAML,2BAA2B,I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