mumz-strapi-plugin-coupon 1.1.1 → 3.0.0

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.
Files changed (46) hide show
  1. package/README.md +15 -13
  2. package/dist/admin/index.js +677 -0
  3. package/dist/admin/index.mjs +678 -0
  4. package/dist/server/index.js +1201 -0
  5. package/dist/server/index.mjs +1202 -0
  6. package/package.json +44 -20
  7. package/strapi-admin.js +3 -0
  8. package/strapi-server.js +3 -1
  9. package/dist/bootstrap.d.ts +0 -5
  10. package/dist/bootstrap.js +0 -6
  11. package/dist/config/index.d.ts +0 -5
  12. package/dist/config/index.js +0 -6
  13. package/dist/content-types/coupon/index.d.ts +0 -96
  14. package/dist/content-types/coupon/index.js +0 -9
  15. package/dist/content-types/coupon/schema.d.ts +0 -94
  16. package/dist/content-types/coupon/schema.js +0 -117
  17. package/dist/content-types/index.d.ts +0 -161
  18. package/dist/content-types/index.js +0 -11
  19. package/dist/content-types/redemption/index.d.ts +0 -64
  20. package/dist/content-types/redemption/index.js +0 -9
  21. package/dist/content-types/redemption/schema.d.ts +0 -62
  22. package/dist/content-types/redemption/schema.js +0 -74
  23. package/dist/controllers/coupon.d.ts +0 -41
  24. package/dist/controllers/coupon.js +0 -154
  25. package/dist/controllers/index.d.ts +0 -5
  26. package/dist/controllers/index.js +0 -9
  27. package/dist/destroy.d.ts +0 -5
  28. package/dist/destroy.js +0 -6
  29. package/dist/index.d.ts +0 -207
  30. package/dist/index.js +0 -24
  31. package/dist/middlewares/index.d.ts +0 -4
  32. package/dist/middlewares/index.js +0 -9
  33. package/dist/middlewares/rate-limit.d.ts +0 -6
  34. package/dist/middlewares/rate-limit.js +0 -42
  35. package/dist/register.d.ts +0 -5
  36. package/dist/register.js +0 -6
  37. package/dist/routes/content-api/index.d.ts +0 -23
  38. package/dist/routes/content-api/index.js +0 -76
  39. package/dist/routes/index.d.ts +0 -25
  40. package/dist/routes/index.js +0 -9
  41. package/dist/services/coupon.d.ts +0 -64
  42. package/dist/services/coupon.js +0 -432
  43. package/dist/services/index.d.ts +0 -5
  44. package/dist/services/index.js +0 -9
  45. package/dist/utils/validators.d.ts +0 -14
  46. package/dist/utils/validators.js +0 -41
@@ -1,9 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const coupon_1 = __importDefault(require("./coupon"));
7
- exports.default = {
8
- coupon: coupon_1.default,
9
- };
@@ -1,14 +0,0 @@
1
- export declare const PHONE_REGEX: RegExp;
2
- export declare const ORDER_ID_REGEX: RegExp;
3
- export declare const COUPON_CODE_REGEX: RegExp;
4
- export declare function validatePhoneNumber(phone: string): boolean;
5
- export declare function validateOrderId(orderId: string): boolean;
6
- export declare function validateCouponCode(code: string): boolean;
7
- export declare function validateDiscountValue(discountType: string, discountValue: number): {
8
- valid: boolean;
9
- error?: string;
10
- };
11
- export declare function validateDateRange(validFrom: string, validTo: string): {
12
- valid: boolean;
13
- error?: string;
14
- };
@@ -1,41 +0,0 @@
1
- "use strict";
2
- // Input validation utilities
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.COUPON_CODE_REGEX = exports.ORDER_ID_REGEX = exports.PHONE_REGEX = void 0;
5
- exports.validatePhoneNumber = validatePhoneNumber;
6
- exports.validateOrderId = validateOrderId;
7
- exports.validateCouponCode = validateCouponCode;
8
- exports.validateDiscountValue = validateDiscountValue;
9
- exports.validateDateRange = validateDateRange;
10
- exports.PHONE_REGEX = /^\+?[1-9]\d{1,14}$/; // E.164 format
11
- exports.ORDER_ID_REGEX = /^[a-zA-Z0-9_-]{1,100}$/;
12
- exports.COUPON_CODE_REGEX = /^[A-Z0-9]{3,50}$/;
13
- function validatePhoneNumber(phone) {
14
- return typeof phone === 'string' && phone.length >= 10 && phone.length <= 15 && exports.PHONE_REGEX.test(phone);
15
- }
16
- function validateOrderId(orderId) {
17
- return typeof orderId === 'string' && orderId.length >= 1 && orderId.length <= 100 && exports.ORDER_ID_REGEX.test(orderId);
18
- }
19
- function validateCouponCode(code) {
20
- return typeof code === 'string' && code.length >= 3 && code.length <= 50 && exports.COUPON_CODE_REGEX.test(code);
21
- }
22
- function validateDiscountValue(discountType, discountValue) {
23
- if (typeof discountValue !== 'number' || discountValue <= 0) {
24
- return { valid: false, error: 'Discount value must be greater than 0' };
25
- }
26
- if (discountType === 'percentage' && discountValue > 100) {
27
- return { valid: false, error: 'Percentage discount cannot exceed 100%' };
28
- }
29
- return { valid: true };
30
- }
31
- function validateDateRange(validFrom, validTo) {
32
- const validFromDate = new Date(validFrom);
33
- const validToDate = new Date(validTo);
34
- if (isNaN(validFromDate.getTime()) || isNaN(validToDate.getTime())) {
35
- return { valid: false, error: 'Invalid date format' };
36
- }
37
- if (validFromDate >= validToDate) {
38
- return { valid: false, error: 'validFrom must be before validTo' };
39
- }
40
- return { valid: true };
41
- }