create-gramstax 0.8.23 → 0.8.24

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.
@@ -38,7 +38,7 @@
38
38
  "test:all": "bun test test/ e2e/"
39
39
  },
40
40
  "dependencies": {
41
- "gramstax": "^0.8.22",
41
+ "gramstax": "^0.8.23",
42
42
  "dayjs": "^1.11.13"
43
43
  },
44
44
  "peerDependencies": {
@@ -12,8 +12,8 @@ export class BotCore extends Gramstax {
12
12
  return true
13
13
  }
14
14
 
15
- async hookErrorPage(ctx: CtxCore, listenerName: string, error: any, isEdit: boolean) {
16
- await new GeneralStatusPage(ctx).showError(`${listenerName}:hookErrorPage`, error, isEdit)
15
+ async hookErrorPage(ctx: CtxCore, data: Parameters<NonNullable<Gramstax[`hookErrorPage`]>>[1]) {
16
+ await new GeneralStatusPage(ctx).showError(`${data.listenerName}:hookErrorPage`, data.error, data.isEdit)
17
17
  }
18
18
 
19
19
  async hookErrorInputNotFoundPage(ctx: CtxCore) {
@@ -14,7 +14,7 @@ class Helper {
14
14
  }
15
15
  }
16
16
 
17
- class Alert {
17
+ class Main {
18
18
  static async showError(ctx: GeneralStatusPage, funcName: string, error: any, edit = true) {
19
19
  LogHe.errorMake(error, ctx.constructorName, funcName)
20
20
 
@@ -45,12 +45,12 @@ export class GeneralStatusPage extends PageBase {
45
45
  this.constructorName = p?.constructor?.name
46
46
  }
47
47
 
48
- async showError(...args: Parameters<typeof Alert.showError> extends [any, ...infer R] ? R : []) {
49
- await Alert.showError(this, ...args)
48
+ async showError(...args: Parameters<typeof Main.showError> extends [any, ...infer R] ? R : []) {
49
+ await Main.showError(this, ...args)
50
50
  }
51
51
 
52
52
  async showErrorInputNotFound() {
53
- await Alert.showErrorInputNotFound(this)
53
+ await Main.showErrorInputNotFound(this)
54
54
  }
55
55
 
56
56
  static template = `
@@ -17,16 +17,6 @@ class Helper {
17
17
  }
18
18
  }
19
19
 
20
- class Alert {
21
- static async showSuccess(ctx: SumNumberPage, left: number, right: number) {
22
- await ctx.clearSession()
23
- const bi = Base.success
24
- const kb = Helper.kb(ctx, bi)
25
- const da = {result: left! + right}
26
- await ctx.reply(kb, da, bi)
27
- }
28
- }
29
-
30
20
  class Main {
31
21
  static async showStep1Form(ctx: SumNumberPage, edit: boolean) {
32
22
  const bi = Base.step1
@@ -62,9 +52,17 @@ class Main {
62
52
  } else if (!Number.isFinite(right ?? NaN)) {
63
53
  await Main.showStep1Form(ctx, false)
64
54
  } else {
65
- await Alert.showSuccess(ctx, left, right)
55
+ await Main.showSuccess(ctx, left, right)
66
56
  }
67
57
  }
58
+
59
+ static async showSuccess(ctx: SumNumberPage, left: number, right: number) {
60
+ await ctx.clearSession()
61
+ const bi = Base.success
62
+ const kb = Helper.kb(ctx, bi)
63
+ const da = {result: left! + right}
64
+ await ctx.reply(kb, da, bi)
65
+ }
68
66
  }
69
67
 
70
68
  export class SumNumberPage extends PageBase {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-gramstax",
3
- "version": "0.8.23",
3
+ "version": "0.8.24",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public",