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.
- package/README.md +15 -13
- package/dist/admin/index.js +677 -0
- package/dist/admin/index.mjs +678 -0
- package/dist/server/index.js +1201 -0
- package/dist/server/index.mjs +1202 -0
- package/package.json +44 -20
- package/strapi-admin.js +3 -0
- package/strapi-server.js +3 -1
- package/dist/bootstrap.d.ts +0 -5
- package/dist/bootstrap.js +0 -6
- package/dist/config/index.d.ts +0 -5
- package/dist/config/index.js +0 -6
- package/dist/content-types/coupon/index.d.ts +0 -96
- package/dist/content-types/coupon/index.js +0 -9
- package/dist/content-types/coupon/schema.d.ts +0 -94
- package/dist/content-types/coupon/schema.js +0 -117
- package/dist/content-types/index.d.ts +0 -161
- package/dist/content-types/index.js +0 -11
- package/dist/content-types/redemption/index.d.ts +0 -64
- package/dist/content-types/redemption/index.js +0 -9
- package/dist/content-types/redemption/schema.d.ts +0 -62
- package/dist/content-types/redemption/schema.js +0 -74
- package/dist/controllers/coupon.d.ts +0 -41
- package/dist/controllers/coupon.js +0 -154
- package/dist/controllers/index.d.ts +0 -5
- package/dist/controllers/index.js +0 -9
- package/dist/destroy.d.ts +0 -5
- package/dist/destroy.js +0 -6
- package/dist/index.d.ts +0 -207
- package/dist/index.js +0 -24
- package/dist/middlewares/index.d.ts +0 -4
- package/dist/middlewares/index.js +0 -9
- package/dist/middlewares/rate-limit.d.ts +0 -6
- package/dist/middlewares/rate-limit.js +0 -42
- package/dist/register.d.ts +0 -5
- package/dist/register.js +0 -6
- package/dist/routes/content-api/index.d.ts +0 -23
- package/dist/routes/content-api/index.js +0 -76
- package/dist/routes/index.d.ts +0 -25
- package/dist/routes/index.js +0 -9
- package/dist/services/coupon.d.ts +0 -64
- package/dist/services/coupon.js +0 -432
- package/dist/services/index.d.ts +0 -5
- package/dist/services/index.js +0 -9
- package/dist/utils/validators.d.ts +0 -14
- package/dist/utils/validators.js +0 -41
package/dist/services/index.js
DELETED
|
@@ -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
|
-
};
|
package/dist/utils/validators.js
DELETED
|
@@ -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
|
-
}
|