mumz-strapi-plugin-coupon 2.0.0 → 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 (45) hide show
  1. package/dist/admin/index.js +677 -0
  2. package/dist/admin/index.mjs +678 -0
  3. package/dist/server/index.js +1201 -0
  4. package/dist/server/index.mjs +1202 -0
  5. package/package.json +42 -18
  6. package/strapi-admin.js +3 -0
  7. package/strapi-server.js +3 -1
  8. package/dist/bootstrap.d.ts +0 -5
  9. package/dist/bootstrap.js +0 -6
  10. package/dist/config/index.d.ts +0 -5
  11. package/dist/config/index.js +0 -6
  12. package/dist/content-types/coupon/index.d.ts +0 -96
  13. package/dist/content-types/coupon/index.js +0 -9
  14. package/dist/content-types/coupon/schema.d.ts +0 -94
  15. package/dist/content-types/coupon/schema.js +0 -117
  16. package/dist/content-types/index.d.ts +0 -161
  17. package/dist/content-types/index.js +0 -11
  18. package/dist/content-types/redemption/index.d.ts +0 -64
  19. package/dist/content-types/redemption/index.js +0 -9
  20. package/dist/content-types/redemption/schema.d.ts +0 -62
  21. package/dist/content-types/redemption/schema.js +0 -74
  22. package/dist/controllers/coupon.d.ts +0 -41
  23. package/dist/controllers/coupon.js +0 -154
  24. package/dist/controllers/index.d.ts +0 -5
  25. package/dist/controllers/index.js +0 -9
  26. package/dist/destroy.d.ts +0 -5
  27. package/dist/destroy.js +0 -6
  28. package/dist/index.d.ts +0 -207
  29. package/dist/index.js +0 -24
  30. package/dist/middlewares/index.d.ts +0 -4
  31. package/dist/middlewares/index.js +0 -9
  32. package/dist/middlewares/rate-limit.d.ts +0 -6
  33. package/dist/middlewares/rate-limit.js +0 -42
  34. package/dist/register.d.ts +0 -5
  35. package/dist/register.js +0 -6
  36. package/dist/routes/content-api/index.d.ts +0 -23
  37. package/dist/routes/content-api/index.js +0 -76
  38. package/dist/routes/index.d.ts +0 -25
  39. package/dist/routes/index.js +0 -9
  40. package/dist/services/coupon.d.ts +0 -64
  41. package/dist/services/coupon.js +0 -432
  42. package/dist/services/index.d.ts +0 -5
  43. package/dist/services/index.js +0 -9
  44. package/dist/utils/validators.d.ts +0 -14
  45. package/dist/utils/validators.js +0 -41
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mumz-strapi-plugin-coupon",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "Strapi plugin for centralized coupon management across multiple services",
5
5
  "strapi": {
6
6
  "name": "coupon",
@@ -13,7 +13,9 @@
13
13
  "plugin",
14
14
  "coupon",
15
15
  "discount",
16
- "promotion"
16
+ "promotion",
17
+ "csv",
18
+ "bulk-import"
17
19
  ],
18
20
  "license": "MIT",
19
21
  "author": {
@@ -31,19 +33,27 @@
31
33
  "access": "public"
32
34
  },
33
35
  "scripts": {
34
- "build": "tsc",
35
- "watch": "tsc --watch",
36
- "clean": "rimraf dist",
37
- "prepare": "npm run build",
38
- "prepublishOnly": "npm run build",
39
- "type-check": "tsc --noEmit"
36
+ "build": "strapi-plugin build",
37
+ "watch": "strapi-plugin watch",
38
+ "watch:link": "strapi-plugin watch:link",
39
+ "verify": "strapi-plugin verify",
40
+ "clean": "rimraf dist"
40
41
  },
41
42
  "main": "./strapi-server.js",
42
43
  "exports": {
43
44
  "./strapi-server": {
44
- "types": "./dist/index.d.ts",
45
- "require": "./dist/index.js",
46
- "default": "./dist/index.js"
45
+ "types": "./dist/server/src/index.d.ts",
46
+ "source": "./server/src/index.ts",
47
+ "import": "./dist/server/index.mjs",
48
+ "require": "./dist/server/index.js",
49
+ "default": "./dist/server/index.js"
50
+ },
51
+ "./strapi-admin": {
52
+ "types": "./dist/admin/src/index.d.ts",
53
+ "source": "./admin/src/index.ts",
54
+ "import": "./dist/admin/index.mjs",
55
+ "require": "./dist/admin/index.js",
56
+ "default": "./dist/admin/index.mjs"
47
57
  },
48
58
  "./package.json": "./package.json"
49
59
  },
@@ -52,20 +62,34 @@
52
62
  "strapi-admin.js",
53
63
  "strapi-server.js"
54
64
  ],
55
- "dependencies": {
56
- "typescript": "^5.0.0",
57
- "rimraf": "^5.0.0"
58
- },
65
+ "dependencies": {},
59
66
  "devDependencies": {
67
+ "@strapi/content-manager": "^5.0.0",
68
+ "@strapi/design-system": "^2.0.0-rc.14",
69
+ "@strapi/icons": "^2.0.0-rc.14",
70
+ "@strapi/sdk-plugin": "^5.0.0",
60
71
  "@strapi/strapi": "^5.0.0",
61
72
  "@strapi/typescript-utils": "^5.0.0",
62
- "@types/node": "^20.0.0"
73
+ "@types/node": "^20.0.0",
74
+ "@types/react": "^18.0.0",
75
+ "@types/react-dom": "^18.0.0",
76
+ "react": "^18.0.0",
77
+ "react-dom": "^18.0.0",
78
+ "rimraf": "^5.0.0",
79
+ "styled-components": "^6.0.0",
80
+ "typescript": "^5.0.0"
63
81
  },
64
82
  "peerDependencies": {
65
- "@strapi/strapi": "^5.0.0"
83
+ "@strapi/content-manager": "^5.0.0",
84
+ "@strapi/design-system": "^2.0.0-rc.14",
85
+ "@strapi/icons": "^2.0.0-rc.14",
86
+ "@strapi/strapi": "^5.0.0",
87
+ "react": "^18.0.0",
88
+ "react-dom": "^18.0.0",
89
+ "styled-components": "^6.0.0"
66
90
  },
67
91
  "engines": {
68
92
  "node": ">=18.0.0",
69
93
  "npm": ">=6.0.0"
70
94
  }
71
- }
95
+ }
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ module.exports = require('./dist/admin');
package/strapi-server.js CHANGED
@@ -1 +1,3 @@
1
- module.exports = require('./dist').default;
1
+ 'use strict';
2
+
3
+ module.exports = require('./dist/server').default;
@@ -1,5 +0,0 @@
1
- import type { Core } from '@strapi/strapi';
2
- declare const _default: ({ strapi }: {
3
- strapi: Core.Strapi;
4
- }) => void;
5
- export default _default;
package/dist/bootstrap.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = ({ strapi }) => {
4
- // Bootstrap plugin logic here
5
- strapi.log.info('Coupon plugin bootstrapped');
6
- };
@@ -1,5 +0,0 @@
1
- declare const _default: {
2
- default: {};
3
- validator(): void;
4
- };
5
- export default _default;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = {
4
- default: {},
5
- validator() { },
6
- };
@@ -1,96 +0,0 @@
1
- declare const _default: {
2
- schema: {
3
- kind: string;
4
- collectionName: string;
5
- info: {
6
- singularName: string;
7
- pluralName: string;
8
- displayName: string;
9
- description: string;
10
- };
11
- options: {
12
- draftAndPublish: boolean;
13
- };
14
- pluginOptions: {
15
- 'content-manager': {
16
- visible: boolean;
17
- };
18
- 'content-type-builder': {
19
- visible: boolean;
20
- };
21
- };
22
- layouts: {
23
- list: string[];
24
- edit: {
25
- name: string;
26
- size: number;
27
- }[][];
28
- };
29
- attributes: {
30
- code: {
31
- type: string;
32
- required: boolean;
33
- unique: boolean;
34
- configurable: boolean;
35
- };
36
- discountType: {
37
- type: string;
38
- enum: string[];
39
- required: boolean;
40
- default: string;
41
- };
42
- discountValue: {
43
- type: string;
44
- required: boolean;
45
- min: number;
46
- };
47
- maxUsage: {
48
- type: string;
49
- required: boolean;
50
- min: number;
51
- default: null;
52
- };
53
- maxUsagePerUser: {
54
- type: string;
55
- required: boolean;
56
- min: number;
57
- default: null;
58
- };
59
- currentUsage: {
60
- type: string;
61
- required: boolean;
62
- default: number;
63
- min: number;
64
- };
65
- validFrom: {
66
- type: string;
67
- required: boolean;
68
- };
69
- validTo: {
70
- type: string;
71
- required: boolean;
72
- };
73
- isActive: {
74
- type: string;
75
- default: boolean;
76
- required: boolean;
77
- };
78
- description: {
79
- type: string;
80
- required: boolean;
81
- };
82
- userRestrictions: {
83
- type: string;
84
- required: boolean;
85
- default: null;
86
- };
87
- redemptions: {
88
- type: string;
89
- relation: string;
90
- target: string;
91
- mappedBy: string;
92
- };
93
- };
94
- };
95
- };
96
- export default _default;
@@ -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 schema_1 = __importDefault(require("./schema"));
7
- exports.default = {
8
- schema: schema_1.default,
9
- };
@@ -1,94 +0,0 @@
1
- declare const _default: {
2
- kind: string;
3
- collectionName: string;
4
- info: {
5
- singularName: string;
6
- pluralName: string;
7
- displayName: string;
8
- description: string;
9
- };
10
- options: {
11
- draftAndPublish: boolean;
12
- };
13
- pluginOptions: {
14
- 'content-manager': {
15
- visible: boolean;
16
- };
17
- 'content-type-builder': {
18
- visible: boolean;
19
- };
20
- };
21
- layouts: {
22
- list: string[];
23
- edit: {
24
- name: string;
25
- size: number;
26
- }[][];
27
- };
28
- attributes: {
29
- code: {
30
- type: string;
31
- required: boolean;
32
- unique: boolean;
33
- configurable: boolean;
34
- };
35
- discountType: {
36
- type: string;
37
- enum: string[];
38
- required: boolean;
39
- default: string;
40
- };
41
- discountValue: {
42
- type: string;
43
- required: boolean;
44
- min: number;
45
- };
46
- maxUsage: {
47
- type: string;
48
- required: boolean;
49
- min: number;
50
- default: null;
51
- };
52
- maxUsagePerUser: {
53
- type: string;
54
- required: boolean;
55
- min: number;
56
- default: null;
57
- };
58
- currentUsage: {
59
- type: string;
60
- required: boolean;
61
- default: number;
62
- min: number;
63
- };
64
- validFrom: {
65
- type: string;
66
- required: boolean;
67
- };
68
- validTo: {
69
- type: string;
70
- required: boolean;
71
- };
72
- isActive: {
73
- type: string;
74
- default: boolean;
75
- required: boolean;
76
- };
77
- description: {
78
- type: string;
79
- required: boolean;
80
- };
81
- userRestrictions: {
82
- type: string;
83
- required: boolean;
84
- default: null;
85
- };
86
- redemptions: {
87
- type: string;
88
- relation: string;
89
- target: string;
90
- mappedBy: string;
91
- };
92
- };
93
- };
94
- export default _default;
@@ -1,117 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = {
4
- kind: 'collectionType',
5
- collectionName: 'coupons',
6
- info: {
7
- singularName: 'coupon',
8
- pluralName: 'coupons',
9
- displayName: 'Coupon',
10
- description: 'Coupon management for discounts and promotions',
11
- },
12
- options: {
13
- draftAndPublish: false,
14
- },
15
- pluginOptions: {
16
- 'content-manager': {
17
- visible: true,
18
- },
19
- 'content-type-builder': {
20
- visible: true,
21
- },
22
- },
23
- layouts: {
24
- list: ['code', 'discountType', 'discountValue', 'currentUsage', 'maxUsage', 'maxUsagePerUser', 'isActive', 'validFrom', 'validTo'],
25
- edit: [
26
- // -- Coupon Info --
27
- [
28
- { name: 'code', size: 6 },
29
- { name: 'isActive', size: 6 },
30
- ],
31
- [
32
- { name: 'discountType', size: 6 },
33
- { name: 'discountValue', size: 6 },
34
- ],
35
- // -- Usage Limits --
36
- [
37
- { name: 'maxUsage', size: 4 },
38
- { name: 'maxUsagePerUser', size: 4 },
39
- { name: 'currentUsage', size: 4 },
40
- ],
41
- // -- Validity Period --
42
- [
43
- { name: 'validFrom', size: 6 },
44
- { name: 'validTo', size: 6 },
45
- ],
46
- // -- Additional Info --
47
- [{ name: 'description', size: 12 }],
48
- // -- Restrictions --
49
- [{ name: 'userRestrictions', size: 12 }],
50
- ],
51
- },
52
- attributes: {
53
- code: {
54
- type: 'string',
55
- required: true,
56
- unique: true,
57
- configurable: false,
58
- },
59
- discountType: {
60
- type: 'enumeration',
61
- enum: ['percentage', 'flat'],
62
- required: true,
63
- default: 'percentage',
64
- },
65
- discountValue: {
66
- type: 'decimal',
67
- required: true,
68
- min: 0,
69
- },
70
- maxUsage: {
71
- type: 'integer',
72
- required: false,
73
- min: 0,
74
- default: null,
75
- },
76
- maxUsagePerUser: {
77
- type: 'integer',
78
- required: false,
79
- min: 0,
80
- default: null,
81
- },
82
- currentUsage: {
83
- type: 'integer',
84
- required: true,
85
- default: 0,
86
- min: 0,
87
- },
88
- validFrom: {
89
- type: 'datetime',
90
- required: true,
91
- },
92
- validTo: {
93
- type: 'datetime',
94
- required: true,
95
- },
96
- isActive: {
97
- type: 'boolean',
98
- default: true,
99
- required: true,
100
- },
101
- description: {
102
- type: 'text',
103
- required: false,
104
- },
105
- userRestrictions: {
106
- type: 'json',
107
- required: false,
108
- default: null,
109
- },
110
- redemptions: {
111
- type: 'relation',
112
- relation: 'oneToMany',
113
- target: 'plugin::coupon.redemption',
114
- mappedBy: 'coupon',
115
- },
116
- },
117
- };
@@ -1,161 +0,0 @@
1
- declare const _default: {
2
- coupon: {
3
- schema: {
4
- kind: string;
5
- collectionName: string;
6
- info: {
7
- singularName: string;
8
- pluralName: string;
9
- displayName: string;
10
- description: string;
11
- };
12
- options: {
13
- draftAndPublish: boolean;
14
- };
15
- pluginOptions: {
16
- 'content-manager': {
17
- visible: boolean;
18
- };
19
- 'content-type-builder': {
20
- visible: boolean;
21
- };
22
- };
23
- layouts: {
24
- list: string[];
25
- edit: {
26
- name: string;
27
- size: number;
28
- }[][];
29
- };
30
- attributes: {
31
- code: {
32
- type: string;
33
- required: boolean;
34
- unique: boolean;
35
- configurable: boolean;
36
- };
37
- discountType: {
38
- type: string;
39
- enum: string[];
40
- required: boolean;
41
- default: string;
42
- };
43
- discountValue: {
44
- type: string;
45
- required: boolean;
46
- min: number;
47
- };
48
- maxUsage: {
49
- type: string;
50
- required: boolean;
51
- min: number;
52
- default: null;
53
- };
54
- maxUsagePerUser: {
55
- type: string;
56
- required: boolean;
57
- min: number;
58
- default: null;
59
- };
60
- currentUsage: {
61
- type: string;
62
- required: boolean;
63
- default: number;
64
- min: number;
65
- };
66
- validFrom: {
67
- type: string;
68
- required: boolean;
69
- };
70
- validTo: {
71
- type: string;
72
- required: boolean;
73
- };
74
- isActive: {
75
- type: string;
76
- default: boolean;
77
- required: boolean;
78
- };
79
- description: {
80
- type: string;
81
- required: boolean;
82
- };
83
- userRestrictions: {
84
- type: string;
85
- required: boolean;
86
- default: null;
87
- };
88
- redemptions: {
89
- type: string;
90
- relation: string;
91
- target: string;
92
- mappedBy: string;
93
- };
94
- };
95
- };
96
- };
97
- redemption: {
98
- schema: {
99
- kind: string;
100
- collectionName: string;
101
- info: {
102
- singularName: string;
103
- pluralName: string;
104
- displayName: string;
105
- description: string;
106
- };
107
- options: {
108
- draftAndPublish: boolean;
109
- };
110
- pluginOptions: {
111
- 'content-manager': {
112
- visible: boolean;
113
- };
114
- 'content-type-builder': {
115
- visible: boolean;
116
- };
117
- };
118
- layouts: {
119
- list: string[];
120
- edit: {
121
- name: string;
122
- size: number;
123
- }[][];
124
- };
125
- attributes: {
126
- coupon: {
127
- type: string;
128
- relation: string;
129
- target: string;
130
- inversedBy: string;
131
- };
132
- orderId: {
133
- type: string;
134
- required: boolean;
135
- };
136
- phoneNumber: {
137
- type: string;
138
- required: boolean;
139
- };
140
- redemptionDate: {
141
- type: string;
142
- required: boolean;
143
- };
144
- discountType: {
145
- type: string;
146
- required: boolean;
147
- };
148
- discountValue: {
149
- type: string;
150
- required: boolean;
151
- };
152
- metadata: {
153
- type: string;
154
- required: boolean;
155
- default: null;
156
- };
157
- };
158
- };
159
- };
160
- };
161
- export default _default;
@@ -1,11 +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
- const redemption_1 = __importDefault(require("./redemption"));
8
- exports.default = {
9
- coupon: coupon_1.default,
10
- redemption: redemption_1.default,
11
- };
@@ -1,64 +0,0 @@
1
- declare const _default: {
2
- schema: {
3
- kind: string;
4
- collectionName: string;
5
- info: {
6
- singularName: string;
7
- pluralName: string;
8
- displayName: string;
9
- description: string;
10
- };
11
- options: {
12
- draftAndPublish: boolean;
13
- };
14
- pluginOptions: {
15
- 'content-manager': {
16
- visible: boolean;
17
- };
18
- 'content-type-builder': {
19
- visible: boolean;
20
- };
21
- };
22
- layouts: {
23
- list: string[];
24
- edit: {
25
- name: string;
26
- size: number;
27
- }[][];
28
- };
29
- attributes: {
30
- coupon: {
31
- type: string;
32
- relation: string;
33
- target: string;
34
- inversedBy: string;
35
- };
36
- orderId: {
37
- type: string;
38
- required: boolean;
39
- };
40
- phoneNumber: {
41
- type: string;
42
- required: boolean;
43
- };
44
- redemptionDate: {
45
- type: string;
46
- required: boolean;
47
- };
48
- discountType: {
49
- type: string;
50
- required: boolean;
51
- };
52
- discountValue: {
53
- type: string;
54
- required: boolean;
55
- };
56
- metadata: {
57
- type: string;
58
- required: boolean;
59
- default: null;
60
- };
61
- };
62
- };
63
- };
64
- export default _default;