@bprotsyk/aso-core 1.2.18 → 1.2.21

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.
@@ -224,7 +224,7 @@ export interface ILocalization {
224
224
  export interface IColoredString {
225
225
  text: string;
226
226
  colors: IColoredSpan[];
227
- mappingName: string;
227
+ mappingName?: string;
228
228
  }
229
229
  export interface IColoredSpan {
230
230
  from: number;
@@ -0,0 +1,13 @@
1
+ import { IOfferWallAuthLocalization } from "aso/offerwall/auth/offerwall-auth-localization";
2
+ import { IShape } from "../../../shared/shape";
3
+ export interface IOfferWallAuthConfig {
4
+ includedCountries: string;
5
+ excludedCountries: string;
6
+ registerButtonShape: IShape;
7
+ phoneInputShape: IShape;
8
+ offerwallItemShape: IShape;
9
+ backgroundUrl: string;
10
+ owBackgroundUrl?: string;
11
+ fontUrl?: string;
12
+ authLocalization: IOfferWallAuthLocalization;
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { IColoredString } from "aso/config/aso-config-v0";
2
+ export interface IOfferWallAuthLocalization {
3
+ title: IColoredString;
4
+ subtitle: IColoredString;
5
+ privacyPolicyTopText: string;
6
+ privacyPolicyBottomText: IColoredString;
7
+ registerButtonText: string;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface IOfferWallAuthSubmitRequest {
2
+ phone: string;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface IOfferWallAuthSubmitResponse {
2
+ ok: boolean;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -4,4 +4,5 @@ export interface IOfferWallOffer {
4
4
  backgroundUrl: string;
5
5
  emojiIcon?: string;
6
6
  emojiCaption?: string;
7
+ caption: string;
7
8
  }
@@ -51,10 +51,10 @@ export interface IAppGenerationOptions {
51
51
  keyPassword: string;
52
52
  }
53
53
  export declare const FlashAppSchema: Schema<any, Model<any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
54
+ email: string;
54
55
  id: number;
55
56
  bundle: string;
56
57
  trackingUrl: string;
57
- email: string;
58
58
  pastebinUrl: string;
59
59
  onesignalAppId: string;
60
60
  onesignalRestApiKey: string;
package/lib/index.d.ts CHANGED
@@ -22,3 +22,9 @@ export * as ASOConfigFetch from "./aso/usage-logs/aso-config-fetch-entry";
22
22
  export { IPanelUser, PanelUserAccessScope, PanelUserSchema } from "./panel/user";
23
23
  export { IAuthToken } from "./panel/auth";
24
24
  export { IUpsertFlashAppRequest, IUpsertFlashAppResponse } from "./panel/flash/create-flash-app-request";
25
+ export { IGradient, IStroke, IShape, ShapeDiv } from "./shared/shape";
26
+ export { ColoredText, IColoredTextProps } from "./shared/colored-text";
27
+ export { IOfferWallAuthConfig } from "./aso/offerwall/auth/offerwall-auth-config";
28
+ export { IOfferWallAuthLocalization } from "./aso/offerwall/auth/offerwall-auth-localization";
29
+ export { IOfferWallAuthSubmitRequest } from "./aso/offerwall/auth/offerwall-auth-submit-request";
30
+ export { IOfferWallAuthSubmitResponse } from "./aso/offerwall/auth/offerwall-auth-submit-response";
package/lib/index.js CHANGED
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.PanelUserSchema = exports.PanelUserAccessScope = exports.ASOConfigFetch = exports.FlashAppSchema = exports.ASO_v5 = exports.ASO_v4 = exports.ASO_v3 = exports.ASO_v2 = exports.ASO_v1 = exports.ASO_v0 = void 0;
26
+ exports.ColoredText = exports.ShapeDiv = exports.PanelUserSchema = exports.PanelUserAccessScope = exports.ASOConfigFetch = exports.FlashAppSchema = exports.ASO_v5 = exports.ASO_v4 = exports.ASO_v3 = exports.ASO_v2 = exports.ASO_v1 = exports.ASO_v0 = void 0;
27
27
  exports.ASO_v0 = __importStar(require("./aso/config/aso-config-v0"));
28
28
  exports.ASO_v1 = __importStar(require("./aso/config/aso-config-v1"));
29
29
  exports.ASO_v2 = __importStar(require("./aso/config/aso-config-v2"));
@@ -36,3 +36,7 @@ exports.ASOConfigFetch = __importStar(require("./aso/usage-logs/aso-config-fetch
36
36
  var user_1 = require("./panel/user");
37
37
  Object.defineProperty(exports, "PanelUserAccessScope", { enumerable: true, get: function () { return user_1.PanelUserAccessScope; } });
38
38
  Object.defineProperty(exports, "PanelUserSchema", { enumerable: true, get: function () { return user_1.PanelUserSchema; } });
39
+ var shape_1 = require("./shared/shape");
40
+ Object.defineProperty(exports, "ShapeDiv", { enumerable: true, get: function () { return shape_1.ShapeDiv; } });
41
+ var colored_text_1 = require("./shared/colored-text");
42
+ Object.defineProperty(exports, "ColoredText", { enumerable: true, get: function () { return colored_text_1.ColoredText; } });
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { IColoredString } from 'aso/config/aso-config-v0';
3
+ export interface IColoredTextProps {
4
+ coloredText: IColoredString;
5
+ }
6
+ export declare function ColoredText({ coloredText }: IColoredTextProps): JSX.Element;
7
+ export default ColoredText;
@@ -0,0 +1,27 @@
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.ColoredText = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const styled_components_1 = __importDefault(require("styled-components"));
9
+ const StyledColoredSpan = styled_components_1.default.span `
10
+ color: ${(props) => props.color};
11
+ `;
12
+ function ColoredText({ coloredText }) {
13
+ const { text, colors } = coloredText;
14
+ let startIndex = 0;
15
+ const spans = [];
16
+ for (const { from, to, color } of colors) {
17
+ spans.push((0, jsx_runtime_1.jsx)("span", { children: text.slice(startIndex, from) }, `text_${startIndex}`));
18
+ spans.push((0, jsx_runtime_1.jsx)(StyledColoredSpan, { color: color, children: text.slice(from, to) }, `text_${from}`));
19
+ startIndex = to;
20
+ }
21
+ if (startIndex < text.length) {
22
+ spans.push((0, jsx_runtime_1.jsx)("span", { children: text.slice(startIndex) }, `text_${startIndex}`));
23
+ }
24
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: spans });
25
+ }
26
+ exports.ColoredText = ColoredText;
27
+ exports.default = ColoredText;
@@ -0,0 +1,18 @@
1
+ export interface IGradient {
2
+ startColor: string;
3
+ centerColor?: string;
4
+ endColor: string;
5
+ angle?: number;
6
+ }
7
+ export interface IStroke {
8
+ width: number;
9
+ color: string;
10
+ }
11
+ export interface IShape {
12
+ backgroundColor: IGradient | string;
13
+ stroke?: IStroke;
14
+ textColor?: string;
15
+ fontUrl?: string;
16
+ cornerRadius?: number;
17
+ }
18
+ export declare const ShapeDiv: import("styled-components").StyledComponent<"div", any, IShape, never>;
@@ -0,0 +1,36 @@
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.ShapeDiv = void 0;
7
+ const styled_components_1 = __importDefault(require("styled-components"));
8
+ exports.ShapeDiv = styled_components_1.default.div `
9
+ background: ${props => typeof props.backgroundColor === 'string'
10
+ ? props.backgroundColor
11
+ : props.backgroundColor.angle
12
+ ? `linear-gradient(${props.backgroundColor.angle}deg, ${props.backgroundColor.startColor} 0%, ${props.backgroundColor.centerColor || props.backgroundColor.startColor} 50%, ${props.backgroundColor.endColor} 100%)`
13
+ : `radial-gradient(circle, ${props.backgroundColor.startColor} 0%, ${props.backgroundColor.endColor} 100%)`};
14
+
15
+ ${props => props.stroke &&
16
+ `
17
+ border: ${props.stroke.width}px solid ${props.stroke.color};
18
+ box-sizing: border-box;
19
+ `};
20
+
21
+ ${props => props.cornerRadius &&
22
+ `
23
+ border-radius: ${props.cornerRadius}px;
24
+ `}
25
+
26
+ color: ${props => props.textColor || "white"};
27
+
28
+ ${props => props.fontUrl &&
29
+ `
30
+ @font-face {
31
+ font-family: 'custom';
32
+ src: url(${props.fontUrl});
33
+ }
34
+ font-family: 'custom', sans-serif;
35
+ `};
36
+ `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bprotsyk/aso-core",
3
- "version": "1.2.18",
3
+ "version": "1.2.21",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
@@ -23,9 +23,11 @@
23
23
  "@types/module-alias": "^2.0.1",
24
24
  "@types/mongoose": "^5.11.97",
25
25
  "module-alias": "^2.2.2",
26
- "mongoose": "^6.8.3"
26
+ "mongoose": "^6.8.3",
27
+ "styled-components": "^5.3.9"
27
28
  },
28
29
  "devDependencies": {
30
+ "@types/styled-components": "^5.1.26",
29
31
  "typescript": "^4.8.0-dev.20220623"
30
32
  }
31
33
  }
@@ -254,7 +254,7 @@ export interface ILocalization {
254
254
  export interface IColoredString {
255
255
  text: string,
256
256
  colors: IColoredSpan[]
257
- mappingName: string
257
+ mappingName?: string
258
258
  }
259
259
 
260
260
  export interface IColoredSpan {
@@ -0,0 +1,16 @@
1
+ import { IOfferWallAuthLocalization } from "aso/offerwall/auth/offerwall-auth-localization";
2
+ import { IShape } from "../../../shared/shape";
3
+
4
+ export interface IOfferWallAuthConfig {
5
+ includedCountries: string,
6
+ excludedCountries: string,
7
+ registerButtonShape: IShape,
8
+ phoneInputShape: IShape,
9
+ offerwallItemShape: IShape,
10
+ backgroundUrl: string,
11
+
12
+ owBackgroundUrl?: string,
13
+ fontUrl?: string,
14
+
15
+ authLocalization: IOfferWallAuthLocalization
16
+ }
@@ -0,0 +1,9 @@
1
+ import { IColoredString } from "aso/config/aso-config-v0";
2
+
3
+ export interface IOfferWallAuthLocalization {
4
+ title: IColoredString,
5
+ subtitle: IColoredString,
6
+ privacyPolicyTopText: string,
7
+ privacyPolicyBottomText: IColoredString,
8
+ registerButtonText: string,
9
+ }
@@ -0,0 +1,3 @@
1
+ export interface IOfferWallAuthSubmitRequest {
2
+ phone: string
3
+ }
@@ -0,0 +1,3 @@
1
+ export interface IOfferWallAuthSubmitResponse {
2
+ ok: boolean
3
+ }
@@ -4,5 +4,6 @@ export interface IOfferWallOffer {
4
4
  backgroundUrl: string;
5
5
  emojiIcon?: string;
6
6
  emojiCaption?: string;
7
+ caption: string;
7
8
  }
8
9
 
package/src/index.ts CHANGED
@@ -26,4 +26,11 @@ export * as ASOConfigFetch from "./aso/usage-logs/aso-config-fetch-entry"
26
26
 
27
27
  export { IPanelUser, PanelUserAccessScope, PanelUserSchema } from "./panel/user"
28
28
  export { IAuthToken } from "./panel/auth"
29
- export { IUpsertFlashAppRequest, IUpsertFlashAppResponse } from "./panel/flash/create-flash-app-request"
29
+ export { IUpsertFlashAppRequest, IUpsertFlashAppResponse } from "./panel/flash/create-flash-app-request"
30
+
31
+ export {IGradient, IStroke, IShape, ShapeDiv} from "./shared/shape"
32
+ export {ColoredText, IColoredTextProps} from "./shared/colored-text"
33
+ export {IOfferWallAuthConfig} from "./aso/offerwall/auth/offerwall-auth-config"
34
+ export {IOfferWallAuthLocalization} from "./aso/offerwall/auth/offerwall-auth-localization"
35
+ export {IOfferWallAuthSubmitRequest} from "./aso/offerwall/auth/offerwall-auth-submit-request"
36
+ export {IOfferWallAuthSubmitResponse} from "./aso/offerwall/auth/offerwall-auth-submit-response"
@@ -0,0 +1,36 @@
1
+ import { IColoredString } from 'aso/config/aso-config-v0';
2
+ import React from 'react';
3
+ import styled from 'styled-components';
4
+
5
+ export interface IColoredTextProps {
6
+ coloredText: IColoredString;
7
+ }
8
+
9
+ const StyledColoredSpan = styled.span<{ color: string }>`
10
+ color: ${(props) => props.color};
11
+ `;
12
+
13
+ export function ColoredText({ coloredText }: IColoredTextProps) {
14
+ const { text, colors } = coloredText;
15
+
16
+ let startIndex = 0;
17
+ const spans = [];
18
+
19
+ for (const { from, to, color } of colors) {
20
+ spans.push(<span key={`text_${startIndex}`}>{text.slice(startIndex, from)}</span>);
21
+ spans.push(
22
+ <StyledColoredSpan key={`text_${from}`} color={color}>
23
+ {text.slice(from, to)}
24
+ </StyledColoredSpan>
25
+ );
26
+ startIndex = to;
27
+ }
28
+
29
+ if (startIndex < text.length) {
30
+ spans.push(<span key={`text_${startIndex}`}>{text.slice(startIndex)}</span>);
31
+ }
32
+
33
+ return <>{spans}</>;
34
+ }
35
+
36
+ export default ColoredText;
@@ -0,0 +1,55 @@
1
+ import styled from 'styled-components';
2
+
3
+ export interface IGradient {
4
+ startColor: string;
5
+ centerColor?: string;
6
+ endColor: string;
7
+ angle?: number;
8
+ }
9
+
10
+ export interface IStroke {
11
+ width: number;
12
+ color: string;
13
+ }
14
+
15
+ export interface IShape {
16
+ backgroundColor: IGradient | string;
17
+ stroke?: IStroke;
18
+ textColor?: string;
19
+ fontUrl?: string;
20
+ cornerRadius?: number;
21
+ }
22
+
23
+ export const ShapeDiv = styled.div<IShape>`
24
+ background: ${props =>
25
+ typeof props.backgroundColor === 'string'
26
+ ? props.backgroundColor
27
+ : props.backgroundColor.angle
28
+ ? `linear-gradient(${props.backgroundColor.angle}deg, ${props.backgroundColor.startColor} 0%, ${props.backgroundColor.centerColor || props.backgroundColor.startColor} 50%, ${props.backgroundColor.endColor} 100%)`
29
+ : `radial-gradient(circle, ${props.backgroundColor.startColor} 0%, ${props.backgroundColor.endColor} 100%)`};
30
+
31
+ ${props =>
32
+ props.stroke &&
33
+ `
34
+ border: ${props.stroke.width}px solid ${props.stroke.color};
35
+ box-sizing: border-box;
36
+ `};
37
+
38
+ ${props =>
39
+ props.cornerRadius &&
40
+ `
41
+ border-radius: ${props.cornerRadius}px;
42
+ `}
43
+
44
+ color: ${props => props.textColor || "white"};
45
+
46
+ ${props =>
47
+ props.fontUrl &&
48
+ `
49
+ @font-face {
50
+ font-family: 'custom';
51
+ src: url(${props.fontUrl});
52
+ }
53
+ font-family: 'custom', sans-serif;
54
+ `};
55
+ `;
package/tsconfig.json CHANGED
@@ -7,6 +7,7 @@
7
7
  "outDir": "./lib",
8
8
  "baseUrl": "./src",
9
9
  "rootDir": "src",
10
+ "jsx": "react-jsx",
10
11
  "strict": true,
11
12
  "moduleResolution": "nodenext"
12
13
  },