@remnawave/backend-contract 2.3.42 → 2.3.43
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/build/backend/api/controllers/index.d.ts +1 -0
- package/build/backend/api/controllers/index.d.ts.map +1 -1
- package/build/backend/api/controllers/index.js +1 -0
- package/build/backend/api/controllers/subscription-page-configs.d.ts +12 -0
- package/build/backend/api/controllers/subscription-page-configs.d.ts.map +1 -0
- package/build/backend/api/controllers/subscription-page-configs.js +15 -0
- package/build/backend/api/controllers-info.d.ts +4 -0
- package/build/backend/api/controllers-info.d.ts.map +1 -1
- package/build/backend/api/controllers-info.js +4 -0
- package/build/backend/api/routes.d.ts +10 -0
- package/build/backend/api/routes.d.ts.map +1 -1
- package/build/backend/api/routes.js +10 -0
- package/build/backend/commands/index.d.ts +1 -0
- package/build/backend/commands/index.d.ts.map +1 -1
- package/build/backend/commands/index.js +1 -0
- package/build/backend/commands/subscription-page-configs/actions/index.d.ts +2 -0
- package/build/backend/commands/subscription-page-configs/actions/index.d.ts.map +1 -0
- package/build/backend/commands/subscription-page-configs/actions/index.js +17 -0
- package/build/backend/commands/subscription-page-configs/actions/reorder.command.d.ts +90 -0
- package/build/backend/commands/subscription-page-configs/actions/reorder.command.d.ts.map +1 -0
- package/build/backend/commands/subscription-page-configs/actions/reorder.command.js +25 -0
- package/build/backend/commands/subscription-page-configs/create-subpage-config.command.d.ts +48 -0
- package/build/backend/commands/subscription-page-configs/create-subpage-config.command.d.ts.map +1 -0
- package/build/backend/commands/subscription-page-configs/create-subpage-config.command.js +23 -0
- package/build/backend/commands/subscription-page-configs/delete-subpage-config.command.d.ts +33 -0
- package/build/backend/commands/subscription-page-configs/delete-subpage-config.command.d.ts.map +1 -0
- package/build/backend/commands/subscription-page-configs/delete-subpage-config.command.js +20 -0
- package/build/backend/commands/subscription-page-configs/get-subpage-config.command.d.ts +48 -0
- package/build/backend/commands/subscription-page-configs/get-subpage-config.command.d.ts.map +1 -0
- package/build/backend/commands/subscription-page-configs/get-subpage-config.command.js +19 -0
- package/build/backend/commands/subscription-page-configs/get-subpage-configs.command.d.ts +65 -0
- package/build/backend/commands/subscription-page-configs/get-subpage-configs.command.d.ts.map +1 -0
- package/build/backend/commands/subscription-page-configs/get-subpage-configs.command.js +19 -0
- package/build/backend/commands/subscription-page-configs/index.d.ts +7 -0
- package/build/backend/commands/subscription-page-configs/index.d.ts.map +1 -0
- package/build/backend/commands/subscription-page-configs/index.js +22 -0
- package/build/backend/commands/subscription-page-configs/update-subpage-config.command.d.ts +54 -0
- package/build/backend/commands/subscription-page-configs/update-subpage-config.command.d.ts.map +1 -0
- package/build/backend/commands/subscription-page-configs/update-subpage-config.command.js +26 -0
- package/build/backend/constants/errors/errors.d.ts +45 -0
- package/build/backend/constants/errors/errors.d.ts.map +1 -1
- package/build/backend/constants/errors/errors.js +45 -0
- package/build/backend/constants/index.d.ts +1 -0
- package/build/backend/constants/index.d.ts.map +1 -1
- package/build/backend/constants/index.js +1 -0
- package/build/backend/constants/subscription-page-config/index.d.ts +2 -0
- package/build/backend/constants/subscription-page-config/index.d.ts.map +1 -0
- package/build/backend/constants/subscription-page-config/index.js +17 -0
- package/build/backend/constants/subscription-page-config/subscription-page-config.contants.d.ts +15 -0
- package/build/backend/constants/subscription-page-config/subscription-page-config.contants.d.ts.map +1 -0
- package/build/backend/constants/subscription-page-config/subscription-page-config.contants.js +16 -0
- package/build/backend/models/index.d.ts +1 -0
- package/build/backend/models/index.d.ts.map +1 -1
- package/build/backend/models/index.js +1 -0
- package/build/backend/models/subscripion-page-config.schema.d.ts +18 -0
- package/build/backend/models/subscripion-page-config.schema.d.ts.map +1 -0
- package/build/backend/models/subscripion-page-config.schema.js +13 -0
- package/build/backend/models/subscription-page-config/subscription-page-config.schema.d.ts +644 -0
- package/build/backend/models/subscription-page-config/subscription-page-config.schema.d.ts.map +1 -0
- package/build/backend/models/subscription-page-config/subscription-page-config.schema.js +57 -0
- package/build/backend/models/subscription-page-config/subscription-page-config.validator.d.ts +4 -0
- package/build/backend/models/subscription-page-config/subscription-page-config.validator.d.ts.map +1 -0
- package/build/backend/models/subscription-page-config/subscription-page-config.validator.js +32 -0
- package/build/frontend/api/controllers/index.js +1 -0
- package/build/frontend/api/controllers/subscription-page-configs.js +15 -0
- package/build/frontend/api/controllers-info.js +4 -0
- package/build/frontend/api/routes.js +10 -0
- package/build/frontend/commands/index.js +1 -0
- package/build/frontend/commands/subscription-page-configs/actions/index.js +17 -0
- package/build/frontend/commands/subscription-page-configs/actions/reorder.command.js +25 -0
- package/build/frontend/commands/subscription-page-configs/create-subpage-config.command.js +23 -0
- package/build/frontend/commands/subscription-page-configs/delete-subpage-config.command.js +20 -0
- package/build/frontend/commands/subscription-page-configs/get-subpage-config.command.js +19 -0
- package/build/frontend/commands/subscription-page-configs/get-subpage-configs.command.js +19 -0
- package/build/frontend/commands/subscription-page-configs/index.js +22 -0
- package/build/frontend/commands/subscription-page-configs/update-subpage-config.command.js +26 -0
- package/build/frontend/constants/errors/errors.js +45 -0
- package/build/frontend/constants/index.js +1 -0
- package/build/frontend/constants/subscription-page-config/index.js +17 -0
- package/build/frontend/constants/subscription-page-config/subscription-page-config.contants.js +16 -0
- package/build/frontend/models/index.js +1 -0
- package/build/frontend/models/subscripion-page-config.schema.js +13 -0
- package/build/frontend/models/subscription-page-config/subscription-page-config.schema.js +57 -0
- package/build/frontend/models/subscription-page-config/subscription-page-config.validator.js +32 -0
- package/package.json +1 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TSubscriptionPageConfigAdditionalLocales } from '../../constants';
|
|
3
|
+
export declare const validateLocalizedTexts: (obj: unknown, requiredLocales: TSubscriptionPageConfigAdditionalLocales[], path: string, ctx: z.RefinementCtx) => void;
|
|
4
|
+
//# sourceMappingURL=subscription-page-config.validator.d.ts.map
|
package/build/backend/models/subscription-page-config/subscription-page-config.validator.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription-page-config.validator.d.ts","sourceRoot":"","sources":["../../../../models/subscription-page-config/subscription-page-config.validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,wCAAwC,EAAE,MAAM,iBAAiB,CAAC;AAG3E,eAAO,MAAM,sBAAsB,GAC/B,KAAK,OAAO,EACZ,iBAAiB,wCAAwC,EAAE,EAC3D,MAAM,MAAM,EACZ,KAAK,CAAC,CAAC,aAAa,KACrB,IA0BF,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateLocalizedTexts = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const validateLocalizedTexts = (obj, requiredLocales, path, ctx) => {
|
|
6
|
+
if (obj === null || typeof obj !== 'object')
|
|
7
|
+
return;
|
|
8
|
+
if ('en' in obj && typeof obj.en === 'string') {
|
|
9
|
+
for (const locale of requiredLocales) {
|
|
10
|
+
const value = obj[locale];
|
|
11
|
+
if (!value || value.trim() === '') {
|
|
12
|
+
ctx.addIssue({
|
|
13
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
14
|
+
message: `Missing required locale '${locale}' at ${path}`,
|
|
15
|
+
path: [path, locale],
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
22
|
+
if (Array.isArray(value)) {
|
|
23
|
+
value.forEach((item, index) => {
|
|
24
|
+
(0, exports.validateLocalizedTexts)(item, requiredLocales, `${path}.${key}[${index}]`, ctx);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
else if (typeof value === 'object' && value !== null) {
|
|
28
|
+
(0, exports.validateLocalizedTexts)(value, requiredLocales, `${path}.${key}`, ctx);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.validateLocalizedTexts = validateLocalizedTexts;
|
|
@@ -28,6 +28,7 @@ __exportStar(require("./passkeys"), exports);
|
|
|
28
28
|
__exportStar(require("./remnawave-settings"), exports);
|
|
29
29
|
__exportStar(require("./snippets"), exports);
|
|
30
30
|
__exportStar(require("./subscription"), exports);
|
|
31
|
+
__exportStar(require("./subscription-page-configs"), exports);
|
|
31
32
|
__exportStar(require("./subscription-request-history"), exports);
|
|
32
33
|
__exportStar(require("./subscription-settings"), exports);
|
|
33
34
|
__exportStar(require("./subscription-template"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SUBSCRIPTION_PAGE_CONFIGS_ROUTES = exports.SUBSCRIPTION_PAGE_CONFIGS_CONTROLLER = void 0;
|
|
4
|
+
exports.SUBSCRIPTION_PAGE_CONFIGS_CONTROLLER = 'subscription-page-configs';
|
|
5
|
+
const ACTIONS_ROUTE = 'actions';
|
|
6
|
+
exports.SUBSCRIPTION_PAGE_CONFIGS_ROUTES = {
|
|
7
|
+
GET_ALL: '', // get
|
|
8
|
+
GET: (uuid) => `${uuid}`, // get
|
|
9
|
+
UPDATE: '', // patch
|
|
10
|
+
DELETE: (uuid) => `${uuid}`, // delete
|
|
11
|
+
CREATE: '', // post
|
|
12
|
+
ACTIONS: {
|
|
13
|
+
REORDER: `${ACTIONS_ROUTE}/reorder`,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
@@ -282,4 +282,14 @@ exports.REST_API = {
|
|
|
282
282
|
GET: `${exports.ROOT}/${CONTROLLERS.REMNAAWAVE_SETTINGS_CONTROLLER}/${CONTROLLERS.REMNAAWAVE_SETTINGS_ROUTES.GET}`,
|
|
283
283
|
UPDATE: `${exports.ROOT}/${CONTROLLERS.REMNAAWAVE_SETTINGS_CONTROLLER}/${CONTROLLERS.REMNAAWAVE_SETTINGS_ROUTES.UPDATE}`,
|
|
284
284
|
},
|
|
285
|
+
SUBSCRIPTION_PAGE_CONFIGS: {
|
|
286
|
+
GET: (uuid) => `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PAGE_CONFIGS_CONTROLLER}/${CONTROLLERS.SUBSCRIPTION_PAGE_CONFIGS_ROUTES.GET(uuid)}`,
|
|
287
|
+
GET_ALL: `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PAGE_CONFIGS_CONTROLLER}/${CONTROLLERS.SUBSCRIPTION_PAGE_CONFIGS_ROUTES.GET_ALL}`,
|
|
288
|
+
UPDATE: `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PAGE_CONFIGS_CONTROLLER}/${CONTROLLERS.SUBSCRIPTION_PAGE_CONFIGS_ROUTES.UPDATE}`,
|
|
289
|
+
DELETE: (uuid) => `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PAGE_CONFIGS_CONTROLLER}/${CONTROLLERS.SUBSCRIPTION_PAGE_CONFIGS_ROUTES.DELETE(uuid)}`,
|
|
290
|
+
CREATE: `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PAGE_CONFIGS_CONTROLLER}/${CONTROLLERS.SUBSCRIPTION_PAGE_CONFIGS_ROUTES.CREATE}`,
|
|
291
|
+
ACTIONS: {
|
|
292
|
+
REORDER: `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PAGE_CONFIGS_CONTROLLER}/${CONTROLLERS.SUBSCRIPTION_PAGE_CONFIGS_ROUTES.ACTIONS.REORDER}`,
|
|
293
|
+
},
|
|
294
|
+
},
|
|
285
295
|
};
|
|
@@ -28,6 +28,7 @@ __exportStar(require("./passkeys"), exports);
|
|
|
28
28
|
__exportStar(require("./remnawave-settings"), exports);
|
|
29
29
|
__exportStar(require("./snippets"), exports);
|
|
30
30
|
__exportStar(require("./subscription"), exports);
|
|
31
|
+
__exportStar(require("./subscription-page-configs"), exports);
|
|
31
32
|
__exportStar(require("./subscription-request-history"), exports);
|
|
32
33
|
__exportStar(require("./subscription-settings"), exports);
|
|
33
34
|
__exportStar(require("./subscription-template"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./reorder.command"), exports);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReorderSubscriptionPageConfigsCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const api_1 = require("../../../api");
|
|
6
|
+
const models_1 = require("../../../models");
|
|
7
|
+
const constants_1 = require("../../../constants");
|
|
8
|
+
var ReorderSubscriptionPageConfigsCommand;
|
|
9
|
+
(function (ReorderSubscriptionPageConfigsCommand) {
|
|
10
|
+
ReorderSubscriptionPageConfigsCommand.url = api_1.REST_API.SUBSCRIPTION_PAGE_CONFIGS.ACTIONS.REORDER;
|
|
11
|
+
ReorderSubscriptionPageConfigsCommand.TSQ_url = ReorderSubscriptionPageConfigsCommand.url;
|
|
12
|
+
ReorderSubscriptionPageConfigsCommand.endpointDetails = (0, constants_1.getEndpointDetails)(api_1.SUBSCRIPTION_PAGE_CONFIGS_ROUTES.ACTIONS.REORDER, 'post', 'Reorder subscription page configs');
|
|
13
|
+
ReorderSubscriptionPageConfigsCommand.RequestSchema = zod_1.z.object({
|
|
14
|
+
items: zod_1.z.array(models_1.SubscriptionPageConfigSchema.pick({
|
|
15
|
+
viewPosition: true,
|
|
16
|
+
uuid: true,
|
|
17
|
+
})),
|
|
18
|
+
});
|
|
19
|
+
ReorderSubscriptionPageConfigsCommand.ResponseSchema = zod_1.z.object({
|
|
20
|
+
response: zod_1.z.object({
|
|
21
|
+
total: zod_1.z.number(),
|
|
22
|
+
configs: zod_1.z.array(models_1.SubscriptionPageConfigSchema),
|
|
23
|
+
}),
|
|
24
|
+
});
|
|
25
|
+
})(ReorderSubscriptionPageConfigsCommand || (exports.ReorderSubscriptionPageConfigsCommand = ReorderSubscriptionPageConfigsCommand = {}));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateSubscriptionPageConfigCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const api_1 = require("../../api");
|
|
6
|
+
const models_1 = require("../../models");
|
|
7
|
+
const constants_1 = require("../../constants");
|
|
8
|
+
var CreateSubscriptionPageConfigCommand;
|
|
9
|
+
(function (CreateSubscriptionPageConfigCommand) {
|
|
10
|
+
CreateSubscriptionPageConfigCommand.url = api_1.REST_API.SUBSCRIPTION_PAGE_CONFIGS.CREATE;
|
|
11
|
+
CreateSubscriptionPageConfigCommand.TSQ_url = CreateSubscriptionPageConfigCommand.url;
|
|
12
|
+
CreateSubscriptionPageConfigCommand.endpointDetails = (0, constants_1.getEndpointDetails)(api_1.SUBSCRIPTION_PAGE_CONFIGS_ROUTES.CREATE, 'post', 'Create subscription page config');
|
|
13
|
+
CreateSubscriptionPageConfigCommand.RequestSchema = zod_1.z.object({
|
|
14
|
+
name: zod_1.z
|
|
15
|
+
.string()
|
|
16
|
+
.min(2, 'Name must be at least 2 characters')
|
|
17
|
+
.max(30, 'Name must be less than 30 characters')
|
|
18
|
+
.regex(/^[A-Za-z0-9_\s-]+$/, 'Name can only contain letters, numbers, underscores, dashes and spaces'),
|
|
19
|
+
});
|
|
20
|
+
CreateSubscriptionPageConfigCommand.ResponseSchema = zod_1.z.object({
|
|
21
|
+
response: models_1.SubscriptionPageConfigSchema,
|
|
22
|
+
});
|
|
23
|
+
})(CreateSubscriptionPageConfigCommand || (exports.CreateSubscriptionPageConfigCommand = CreateSubscriptionPageConfigCommand = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteSubscriptionPageConfigCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const api_1 = require("../../api");
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
7
|
+
var DeleteSubscriptionPageConfigCommand;
|
|
8
|
+
(function (DeleteSubscriptionPageConfigCommand) {
|
|
9
|
+
DeleteSubscriptionPageConfigCommand.url = api_1.REST_API.SUBSCRIPTION_PAGE_CONFIGS.DELETE;
|
|
10
|
+
DeleteSubscriptionPageConfigCommand.TSQ_url = DeleteSubscriptionPageConfigCommand.url(':uuid');
|
|
11
|
+
DeleteSubscriptionPageConfigCommand.endpointDetails = (0, constants_1.getEndpointDetails)(api_1.SUBSCRIPTION_PAGE_CONFIGS_ROUTES.DELETE(':uuid'), 'delete', 'Delete subscription page config');
|
|
12
|
+
DeleteSubscriptionPageConfigCommand.RequestSchema = zod_1.z.object({
|
|
13
|
+
uuid: zod_1.z.string().uuid(),
|
|
14
|
+
});
|
|
15
|
+
DeleteSubscriptionPageConfigCommand.ResponseSchema = zod_1.z.object({
|
|
16
|
+
response: zod_1.z.object({
|
|
17
|
+
isDeleted: zod_1.z.boolean(),
|
|
18
|
+
}),
|
|
19
|
+
});
|
|
20
|
+
})(DeleteSubscriptionPageConfigCommand || (exports.DeleteSubscriptionPageConfigCommand = DeleteSubscriptionPageConfigCommand = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetSubscriptionPageConfigCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const api_1 = require("../../api");
|
|
6
|
+
const models_1 = require("../../models");
|
|
7
|
+
const constants_1 = require("../../constants");
|
|
8
|
+
var GetSubscriptionPageConfigCommand;
|
|
9
|
+
(function (GetSubscriptionPageConfigCommand) {
|
|
10
|
+
GetSubscriptionPageConfigCommand.url = api_1.REST_API.SUBSCRIPTION_PAGE_CONFIGS.GET;
|
|
11
|
+
GetSubscriptionPageConfigCommand.TSQ_url = GetSubscriptionPageConfigCommand.url(':uuid');
|
|
12
|
+
GetSubscriptionPageConfigCommand.endpointDetails = (0, constants_1.getEndpointDetails)(api_1.SUBSCRIPTION_PAGE_CONFIGS_ROUTES.GET(':uuid'), 'get', 'Get subscription page config by uuid');
|
|
13
|
+
GetSubscriptionPageConfigCommand.RequestSchema = zod_1.z.object({
|
|
14
|
+
uuid: zod_1.z.string().uuid(),
|
|
15
|
+
});
|
|
16
|
+
GetSubscriptionPageConfigCommand.ResponseSchema = zod_1.z.object({
|
|
17
|
+
response: models_1.SubscriptionPageConfigSchema,
|
|
18
|
+
});
|
|
19
|
+
})(GetSubscriptionPageConfigCommand || (exports.GetSubscriptionPageConfigCommand = GetSubscriptionPageConfigCommand = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetSubscriptionPageConfigsCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const api_1 = require("../../api");
|
|
6
|
+
const models_1 = require("../../models");
|
|
7
|
+
const constants_1 = require("../../constants");
|
|
8
|
+
var GetSubscriptionPageConfigsCommand;
|
|
9
|
+
(function (GetSubscriptionPageConfigsCommand) {
|
|
10
|
+
GetSubscriptionPageConfigsCommand.url = api_1.REST_API.SUBSCRIPTION_PAGE_CONFIGS.GET_ALL;
|
|
11
|
+
GetSubscriptionPageConfigsCommand.TSQ_url = GetSubscriptionPageConfigsCommand.url;
|
|
12
|
+
GetSubscriptionPageConfigsCommand.endpointDetails = (0, constants_1.getEndpointDetails)(api_1.SUBSCRIPTION_PAGE_CONFIGS_ROUTES.GET_ALL, 'get', 'Get all subscription page configs');
|
|
13
|
+
GetSubscriptionPageConfigsCommand.ResponseSchema = zod_1.z.object({
|
|
14
|
+
response: zod_1.z.object({
|
|
15
|
+
total: zod_1.z.number(),
|
|
16
|
+
configs: zod_1.z.array(models_1.SubscriptionPageConfigSchema),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
})(GetSubscriptionPageConfigsCommand || (exports.GetSubscriptionPageConfigsCommand = GetSubscriptionPageConfigsCommand = {}));
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./actions"), exports);
|
|
18
|
+
__exportStar(require("./create-subpage-config.command"), exports);
|
|
19
|
+
__exportStar(require("./delete-subpage-config.command"), exports);
|
|
20
|
+
__exportStar(require("./get-subpage-config.command"), exports);
|
|
21
|
+
__exportStar(require("./get-subpage-configs.command"), exports);
|
|
22
|
+
__exportStar(require("./update-subpage-config.command"), exports);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateSubscriptionPageConfigCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const api_1 = require("../../api");
|
|
6
|
+
const models_1 = require("../../models");
|
|
7
|
+
const constants_1 = require("../../constants");
|
|
8
|
+
var UpdateSubscriptionPageConfigCommand;
|
|
9
|
+
(function (UpdateSubscriptionPageConfigCommand) {
|
|
10
|
+
UpdateSubscriptionPageConfigCommand.url = api_1.REST_API.SUBSCRIPTION_PAGE_CONFIGS.UPDATE;
|
|
11
|
+
UpdateSubscriptionPageConfigCommand.TSQ_url = UpdateSubscriptionPageConfigCommand.url;
|
|
12
|
+
UpdateSubscriptionPageConfigCommand.endpointDetails = (0, constants_1.getEndpointDetails)(api_1.SUBSCRIPTION_PAGE_CONFIGS_ROUTES.UPDATE, 'patch', 'Update subscription page config');
|
|
13
|
+
UpdateSubscriptionPageConfigCommand.RequestSchema = zod_1.z.object({
|
|
14
|
+
uuid: zod_1.z.string().uuid(),
|
|
15
|
+
name: zod_1.z
|
|
16
|
+
.string()
|
|
17
|
+
.min(2, 'Name must be at least 2 characters')
|
|
18
|
+
.max(30, 'Name must be less than 30 characters')
|
|
19
|
+
.regex(/^[A-Za-z0-9_\s-]+$/, 'Name can only contain letters, numbers, underscores, dashes and spaces')
|
|
20
|
+
.optional(),
|
|
21
|
+
encodedConfig: zod_1.z.optional(zod_1.z.string()),
|
|
22
|
+
});
|
|
23
|
+
UpdateSubscriptionPageConfigCommand.ResponseSchema = zod_1.z.object({
|
|
24
|
+
response: models_1.SubscriptionPageConfigSchema,
|
|
25
|
+
});
|
|
26
|
+
})(UpdateSubscriptionPageConfigCommand || (exports.UpdateSubscriptionPageConfigCommand = UpdateSubscriptionPageConfigCommand = {}));
|
|
@@ -1035,4 +1035,49 @@ exports.ERRORS = {
|
|
|
1035
1035
|
message: 'Bulk extend expiration date error',
|
|
1036
1036
|
httpCode: 500,
|
|
1037
1037
|
},
|
|
1038
|
+
SUBSCRIPTION_PAGE_CONFIG_NOT_FOUND: {
|
|
1039
|
+
code: 'A206',
|
|
1040
|
+
message: 'Subscription page config not found',
|
|
1041
|
+
httpCode: 404,
|
|
1042
|
+
},
|
|
1043
|
+
GET_SUBSCRIPTION_PAGE_CONFIG_BY_UUID_ERROR: {
|
|
1044
|
+
code: 'A207',
|
|
1045
|
+
message: 'Get subscription page config by UUID error',
|
|
1046
|
+
httpCode: 500,
|
|
1047
|
+
},
|
|
1048
|
+
GET_ALL_SUBSCRIPTION_PAGE_CONFIGS_ERROR: {
|
|
1049
|
+
code: 'A208',
|
|
1050
|
+
message: 'Get all subscription page configs error',
|
|
1051
|
+
httpCode: 500,
|
|
1052
|
+
},
|
|
1053
|
+
RESERVED_CONFIG_NAME: {
|
|
1054
|
+
code: 'A209',
|
|
1055
|
+
message: 'Reserved config name',
|
|
1056
|
+
httpCode: 400,
|
|
1057
|
+
},
|
|
1058
|
+
CONFIG_NAME_ALREADY_EXISTS: {
|
|
1059
|
+
code: 'A210',
|
|
1060
|
+
message: 'Config name already exists',
|
|
1061
|
+
httpCode: 400,
|
|
1062
|
+
},
|
|
1063
|
+
UPDATE_SUBSCRIPTION_PAGE_CONFIG_ERROR: {
|
|
1064
|
+
code: 'A211',
|
|
1065
|
+
message: 'Update subscription page config error',
|
|
1066
|
+
httpCode: 500,
|
|
1067
|
+
},
|
|
1068
|
+
RESERVED_SUBPAGE_CONFIG_CANT_BE_DELETED: {
|
|
1069
|
+
code: 'A212',
|
|
1070
|
+
message: 'Reserved subpage config cannot be deleted',
|
|
1071
|
+
httpCode: 400,
|
|
1072
|
+
},
|
|
1073
|
+
DELETE_SUBSCRIPTION_PAGE_CONFIG_ERROR: {
|
|
1074
|
+
code: 'A213',
|
|
1075
|
+
message: 'Delete subscription page config error',
|
|
1076
|
+
httpCode: 500,
|
|
1077
|
+
},
|
|
1078
|
+
CREATE_SUBSCRIPTION_PAGE_CONFIG_ERROR: {
|
|
1079
|
+
code: 'A214',
|
|
1080
|
+
message: 'Create subscription page config error',
|
|
1081
|
+
httpCode: 500,
|
|
1082
|
+
},
|
|
1038
1083
|
};
|
|
@@ -25,6 +25,7 @@ __exportStar(require("./nodes"), exports);
|
|
|
25
25
|
__exportStar(require("./oauth2"), exports);
|
|
26
26
|
__exportStar(require("./response-rules"), exports);
|
|
27
27
|
__exportStar(require("./roles"), exports);
|
|
28
|
+
__exportStar(require("./subscription-page-config"), exports);
|
|
28
29
|
__exportStar(require("./subscription-template"), exports);
|
|
29
30
|
__exportStar(require("./templates"), exports);
|
|
30
31
|
__exportStar(require("./users"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./subscription-page-config.contants"), exports);
|
package/build/frontend/constants/subscription-page-config/subscription-page-config.contants.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SUBSCRIPTION_PAGE_CONFIG_PLATFORM_TYPES = exports.SUBSCRIPTION_PAGE_CONFIG_ADDITIONAL_LOCALES = exports.SUBSCRIPTION_PAGE_CONFIG_VERSION = void 0;
|
|
4
|
+
exports.SUBSCRIPTION_PAGE_CONFIG_VERSION = {
|
|
5
|
+
1: '1',
|
|
6
|
+
};
|
|
7
|
+
exports.SUBSCRIPTION_PAGE_CONFIG_ADDITIONAL_LOCALES = ['ru', 'zh', 'fa', 'fr'];
|
|
8
|
+
exports.SUBSCRIPTION_PAGE_CONFIG_PLATFORM_TYPES = {
|
|
9
|
+
IOS: 'ios',
|
|
10
|
+
ANDROID: 'android',
|
|
11
|
+
LINUX: 'linux',
|
|
12
|
+
MACOS: 'macos',
|
|
13
|
+
WINDOWS: 'windows',
|
|
14
|
+
ANDROID_TV: 'androidTV',
|
|
15
|
+
APPLE_TV: 'appleTV',
|
|
16
|
+
};
|
|
@@ -35,6 +35,7 @@ __exportStar(require("./nodes.schema"), exports);
|
|
|
35
35
|
__exportStar(require("./remnawave-settings"), exports);
|
|
36
36
|
__exportStar(require("./response-rules"), exports);
|
|
37
37
|
__exportStar(require("./snippets.schema"), exports);
|
|
38
|
+
__exportStar(require("./subscripion-page-config.schema"), exports);
|
|
38
39
|
__exportStar(require("./subscription-info.schema"), exports);
|
|
39
40
|
__exportStar(require("./subscription-request-history.schema"), exports);
|
|
40
41
|
__exportStar(require("./subscription-settings"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
exports.SubscriptionPageConfigSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
exports.SubscriptionPageConfigSchema = zod_1.default.object({
|
|
9
|
+
uuid: zod_1.default.string().uuid(),
|
|
10
|
+
viewPosition: zod_1.default.number().int(),
|
|
11
|
+
name: zod_1.default.string(),
|
|
12
|
+
encodedConfig: zod_1.default.nullable(zod_1.default.string()),
|
|
13
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubscriptionPageRawConfigSchema = exports.LocalizedTextSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
const subscription_page_config_validator_1 = require("./subscription-page-config.validator");
|
|
7
|
+
exports.LocalizedTextSchema = zod_1.z.object({
|
|
8
|
+
en: zod_1.z.string(),
|
|
9
|
+
ru: zod_1.z.string().optional(),
|
|
10
|
+
zh: zod_1.z.string().optional(),
|
|
11
|
+
fa: zod_1.z.string().optional(),
|
|
12
|
+
fr: zod_1.z.string().optional(),
|
|
13
|
+
});
|
|
14
|
+
const ButtonSchema = zod_1.z.object({
|
|
15
|
+
link: zod_1.z.string(),
|
|
16
|
+
type: zod_1.z.enum(['external', 'subscriptionLink']),
|
|
17
|
+
text: exports.LocalizedTextSchema,
|
|
18
|
+
svgIcon: zod_1.z.string(),
|
|
19
|
+
});
|
|
20
|
+
const BlockSchema = zod_1.z.object({
|
|
21
|
+
svgIcon: zod_1.z.string(),
|
|
22
|
+
title: exports.LocalizedTextSchema,
|
|
23
|
+
description: exports.LocalizedTextSchema,
|
|
24
|
+
buttons: zod_1.z.array(ButtonSchema),
|
|
25
|
+
});
|
|
26
|
+
const PlatformAppSchema = zod_1.z.object({
|
|
27
|
+
id: zod_1.z.string(),
|
|
28
|
+
appSettings: zod_1.z.object({
|
|
29
|
+
name: zod_1.z.string(),
|
|
30
|
+
featured: zod_1.z.boolean(),
|
|
31
|
+
}),
|
|
32
|
+
subscriptionLinkSettings: zod_1.z.object({
|
|
33
|
+
encodeBase64: zod_1.z.boolean(),
|
|
34
|
+
urlScheme: zod_1.z.string(),
|
|
35
|
+
}),
|
|
36
|
+
blocks: zod_1.z.array(BlockSchema),
|
|
37
|
+
});
|
|
38
|
+
const PlatformSchema = zod_1.z.object({
|
|
39
|
+
displayName: exports.LocalizedTextSchema,
|
|
40
|
+
svgIcon: zod_1.z.string(),
|
|
41
|
+
apps: zod_1.z.array(PlatformAppSchema),
|
|
42
|
+
});
|
|
43
|
+
const BrandingSettingsSchema = zod_1.z.object({
|
|
44
|
+
title: zod_1.z.string(),
|
|
45
|
+
logoUrl: zod_1.z.string(),
|
|
46
|
+
supportUrl: zod_1.z.string().url(),
|
|
47
|
+
});
|
|
48
|
+
exports.SubscriptionPageRawConfigSchema = zod_1.z
|
|
49
|
+
.object({
|
|
50
|
+
version: zod_1.z.nativeEnum(constants_1.SUBSCRIPTION_PAGE_CONFIG_VERSION),
|
|
51
|
+
additionalLocales: zod_1.z.array(zod_1.z.enum(constants_1.SUBSCRIPTION_PAGE_CONFIG_ADDITIONAL_LOCALES)),
|
|
52
|
+
brandingSettings: BrandingSettingsSchema,
|
|
53
|
+
platforms: zod_1.z.record(zod_1.z.nativeEnum(constants_1.SUBSCRIPTION_PAGE_CONFIG_PLATFORM_TYPES), PlatformSchema),
|
|
54
|
+
})
|
|
55
|
+
.superRefine((data, ctx) => {
|
|
56
|
+
(0, subscription_page_config_validator_1.validateLocalizedTexts)(data.platforms, data.additionalLocales, 'platforms', ctx);
|
|
57
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateLocalizedTexts = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const validateLocalizedTexts = (obj, requiredLocales, path, ctx) => {
|
|
6
|
+
if (obj === null || typeof obj !== 'object')
|
|
7
|
+
return;
|
|
8
|
+
if ('en' in obj && typeof obj.en === 'string') {
|
|
9
|
+
for (const locale of requiredLocales) {
|
|
10
|
+
const value = obj[locale];
|
|
11
|
+
if (!value || value.trim() === '') {
|
|
12
|
+
ctx.addIssue({
|
|
13
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
14
|
+
message: `Missing required locale '${locale}' at ${path}`,
|
|
15
|
+
path: [path, locale],
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
22
|
+
if (Array.isArray(value)) {
|
|
23
|
+
value.forEach((item, index) => {
|
|
24
|
+
(0, exports.validateLocalizedTexts)(item, requiredLocales, `${path}.${key}[${index}]`, ctx);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
else if (typeof value === 'object' && value !== null) {
|
|
28
|
+
(0, exports.validateLocalizedTexts)(value, requiredLocales, `${path}.${key}`, ctx);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.validateLocalizedTexts = validateLocalizedTexts;
|