cabloy 5.1.140 → 5.1.142

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 (142) hide show
  1. package/.cabloy-version +1 -1
  2. package/.github/workflows/playwright-e2e.yml +2 -2
  3. package/CHANGELOG.md +32 -0
  4. package/cabloy-docs/frontend/form-guide.md +47 -0
  5. package/cabloy-docs/frontend/markdown-guide.md +50 -17
  6. package/cabloy-docs/frontend/route-alias-guide.md +20 -0
  7. package/cabloy-docs/frontend/scripts.md +9 -11
  8. package/cabloy-docs/frontend/zova-form-under-the-hood.md +25 -0
  9. package/cabloy-docs/fullstack/framework-performance.md +3 -3
  10. package/cabloy-docs/fullstack/parallel-worktree-environment.md +1 -1
  11. package/cabloy-docs/fullstack/quickstart.md +5 -4
  12. package/cabloy-docs/reference/repo-scripts.md +29 -42
  13. package/e2e/config/playwright.config.ts +34 -0
  14. package/e2e/scripts/e2e.ts +2 -27
  15. package/e2e/scripts/runE2e.ts +62 -0
  16. package/e2e/scripts/runE2eArgs.test.ts +75 -0
  17. package/e2e/scripts/runE2eArgs.ts +158 -0
  18. package/e2e/specs/{a-commerce/commerce.spec.ts → a-commerce.spec.ts} +364 -33
  19. package/e2e/specs/{cabloy-basic/account.spec.ts → account.spec.ts} +1 -2
  20. package/e2e/specs/{cabloy-basic/basic.spec.ts → cabloy-basic.spec.ts} +6 -8
  21. package/oxlint.config.ts +3 -0
  22. package/package.json +3 -9
  23. package/scripts/upgrade.ts +63 -68
  24. package/vona/packages-utils/lint/package.json +1 -1
  25. package/vona/packages-utils/lint/src/oxc/lint.ts +1 -1
  26. package/vona/packages-utils/lint/src/oxc/lintVue.ts +1 -1
  27. package/vona/pnpm-lock.yaml +100 -657
  28. package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/refundRecoveryView.tsx +7 -2
  29. package/vona/src/suite/a-commerce/modules/commerce-trade/src/service/order.ts +31 -15
  30. package/vona/src/suite/a-home/modules/home-user/package.json +1 -0
  31. package/vona/src/suite/a-home/modules/home-user/src/service/account.ts +15 -2
  32. package/vona/src/suite/a-home/modules/home-user/test/accountActivation.test.ts +34 -4
  33. package/vona/src/suite-vendor/a-cabloy/modules/a-markdown/package.json +2 -1
  34. package/vona/src/suite-vendor/a-cabloy/modules/a-markdown/src/.metadata/index.ts +26 -0
  35. package/vona/src/suite-vendor/a-cabloy/modules/a-markdown/src/bean/imageScene.markdown.ts +13 -0
  36. package/vona/src/suite-vendor/a-cabloy/package.json +2 -2
  37. package/vona/src/suite-vendor/a-pay/modules/a-pay/package.json +1 -1
  38. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/providerOperation.ts +23 -0
  39. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/refundOperation.ts +7 -0
  40. package/vona/src/suite-vendor/a-pay/modules/pay-mock/package.json +1 -1
  41. package/vona/src/suite-vendor/a-pay/modules/pay-paypal/package.json +1 -1
  42. package/vona/src/suite-vendor/a-pay/modules/pay-stripe/package.json +1 -1
  43. package/vona/src/suite-vendor/a-pay/package.json +5 -5
  44. package/zova/packages-utils/zova-jsx/package.json +2 -2
  45. package/zova/packages-zova/zova/package.json +3 -3
  46. package/zova/packages-zova/zova-core/package.json +1 -1
  47. package/zova/packages-zova/zova-core/src/bean/resource/locale/type.ts +1 -0
  48. package/zova/pnpm-lock.yaml +63 -18
  49. package/zova/src/front/config/config/config.cabloyBasicWeb.ts +3 -1
  50. package/zova/src/front/config/config/config.cabloyCommerce.ts +4 -2
  51. package/zova/src/suite/a-commerce/modules/commerce-catalog/src/api/openapi/schemas.ts +0 -11
  52. package/zova/src/suite/a-commerce/modules/commerce-catalog/src/api/openapi/types.ts +23 -170
  53. package/zova/src/suite/a-commerce/modules/commerce-member/src/api/openapi/schemas.ts +0 -11
  54. package/zova/src/suite/a-commerce/modules/commerce-member/src/api/openapi/types.ts +23 -170
  55. package/zova/src/suite/a-commerce/modules/commerce-member/src/page/address/controller.tsx +64 -63
  56. package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/schemas.ts +0 -11
  57. package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/types.ts +23 -170
  58. package/zova/src/suite/a-commerce/modules/commerce-siteadmin/src/api/openapi/schemas.ts +0 -11
  59. package/zova/src/suite/a-commerce/modules/commerce-siteadmin/src/api/openapi/types.ts +23 -170
  60. package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/schemas.ts +0 -11
  61. package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/types.ts +29 -171
  62. package/zova/src/suite/a-commerce/modules/commerce-trade/src/component/tableCellActionRefund/controller.tsx +413 -134
  63. package/zova/src/suite/a-commerce/modules/commerce-trade/src/config/locale/en-us.ts +76 -0
  64. package/zova/src/suite/a-commerce/modules/commerce-trade/src/config/locale/zh-cn.ts +67 -0
  65. package/zova/src/suite/a-commerce/modules/commerce-trade/src/model/order.ts +1 -0
  66. package/zova/src/suite/a-commerce/modules/commerce-trade/src/page/cart/controller.tsx +1 -1
  67. package/zova/src/suite/a-commerce/modules/commerce-trade/src/page/checkout/controller.tsx +7 -7
  68. package/zova/src/suite/a-commerce/modules/commerce-trade/src/page/order/controller.tsx +46 -9
  69. package/zova/src/suite/a-commerce/modules/commerce-trade/src/page/payment/controller.tsx +50 -30
  70. package/zova/src/suite/a-home/modules/home-api/src/api/openapi/schemas.ts +0 -11
  71. package/zova/src/suite/a-home/modules/home-api/src/api/openapi/types.ts +23 -170
  72. package/zova/src/suite/a-training/modules/training-student/src/api/openapi/schemas.ts +0 -11
  73. package/zova/src/suite/a-training/modules/training-student/src/api/openapi/types.ts +23 -170
  74. package/zova/src/suite/cabloy-basic/modules/basic-captcha/src/component/formFieldCaptcha/controller.tsx +6 -2
  75. package/zova/src/suite/cabloy-basic/modules/basic-file/src/api/openapi/schemas.ts +0 -11
  76. package/zova/src/suite/cabloy-basic/modules/basic-file/src/api/openapi/types.ts +23 -170
  77. package/zova/src/suite/cabloy-basic/modules/basic-image/src/api/openapi/schemas.ts +0 -11
  78. package/zova/src/suite/cabloy-basic/modules/basic-image/src/api/openapi/types.ts +23 -170
  79. package/zova/src/suite/cabloy-basic/modules/basic-image/src/component/formFieldImage/controller.tsx +9 -15
  80. package/zova/src/suite/cabloy-basic/modules/basic-markdown/package.json +10 -2
  81. package/zova/src/suite/cabloy-basic/modules/basic-markdown/src/.metadata/index.ts +11 -2
  82. package/zova/src/suite/cabloy-basic/modules/basic-markdown/src/.metadata/locales.ts +7 -0
  83. package/zova/src/suite/cabloy-basic/modules/basic-markdown/src/component/formFieldMarkdown/controller.tsx +723 -5
  84. package/zova/src/suite/cabloy-basic/modules/basic-markdown/src/component/formFieldMarkdown/render.tsx +461 -2
  85. package/zova/src/suite/cabloy-basic/modules/basic-markdown/src/config/locale/en-us.ts +59 -0
  86. package/zova/src/suite/cabloy-basic/modules/basic-markdown/src/config/locale/zh-cn.ts +59 -0
  87. package/zova/src/suite/cabloy-basic/modules/basic-markdown/src/index.ts +1 -0
  88. package/zova/src/suite/cabloy-basic/modules/basic-markdown/src/lib/codeBlockLanguages.ts +42 -0
  89. package/zova/src/suite/cabloy-basic/modules/basic-markdown/src/lib/richTextContentStyle.ts +20 -0
  90. package/zova/src/suite/cabloy-basic/modules/basic-markdown/test/lib/codeBlockLanguages.test.ts +25 -0
  91. package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/package.json +1 -1
  92. package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/model/resource.ts +1 -0
  93. package/zova/src/suite-vendor/a-cabloy/package.json +2 -2
  94. package/zova/src/suite-vendor/a-pay/modules/a-pay/package.json +1 -1
  95. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/schemas.ts +0 -11
  96. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/types.ts +23 -170
  97. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/component/paymentNextAction/controller.tsx +26 -12
  98. package/zova/src/suite-vendor/a-pay/modules/pay-mock/cli/openapi.config.ts +1 -1
  99. package/zova/src/suite-vendor/a-pay/modules/pay-mock/package.json +1 -1
  100. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/openapi/schemas.ts +0 -11
  101. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/openapi/types.ts +23 -170
  102. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/payMockMockPayment.ts +26 -0
  103. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/apiSchema/payMockMockPayment.ts +8 -1
  104. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/model/payMockPayment.ts +13 -1
  105. package/zova/src/suite-vendor/a-pay/package.json +3 -3
  106. package/zova/src/suite-vendor/a-zova/modules/a-form/package.json +1 -1
  107. package/zova/src/suite-vendor/a-zova/modules/a-form/src/component/formField/controller.tsx +2 -0
  108. package/zova/src/suite-vendor/a-zova/modules/a-form/src/types/formField.ts +7 -6
  109. package/zova/src/suite-vendor/a-zova/modules/a-ssrserver/package.json +1 -1
  110. package/zova/src/suite-vendor/a-zova/modules/a-ssrserver/src/service/ssrHandler.ts +1 -1
  111. package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +2 -2
  112. package/zova/src/suite-vendor/a-zova/package.json +4 -4
  113. package/e2e/config/playwright.basic.config.ts +0 -3
  114. package/e2e/config/playwright.commerce.config.ts +0 -3
  115. package/e2e/config/playwright.shared.config.ts +0 -38
  116. package/e2e/scripts/testE2eClean.ts +0 -56
  117. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/package.json +0 -56
  118. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/.metadata/index.ts +0 -404
  119. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/.metadata/locales.ts +0 -18
  120. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/.metadata/this.ts +0 -2
  121. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/bean/bean.paypal.ts +0 -99
  122. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/bean/event.paypalCancelOrder.ts +0 -15
  123. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/bean/event.paypalCaptureOrder.ts +0 -22
  124. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/bean/meta.version.ts +0 -24
  125. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/config/config.ts +0 -14
  126. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/config/errors.ts +0 -3
  127. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/config/locale/en-us.ts +0 -3
  128. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/config/locale/zh-cn.ts +0 -3
  129. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/controller/paypal.ts +0 -39
  130. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/dto/paypalOrderRecordOptions.tsx +0 -31
  131. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/dto/paypalOrderRecordPayload.tsx +0 -18
  132. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/entity/paypalRecord.tsx +0 -30
  133. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/index.ts +0 -3
  134. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/model/paypalRecord.ts +0 -10
  135. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/service/paypal.ts +0 -83
  136. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/types/index.ts +0 -1
  137. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/types/paypal.ts +0 -18
  138. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/tsconfig.build.json +0 -11
  139. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/tsconfig.json +0 -7
  140. package/vona/src/suite-vendor/a-paypal/package.json +0 -13
  141. package/vona/src/suite-vendor/a-paypal/tsconfig.base.json +0 -4
  142. package/vona/src/suite-vendor/a-paypal/tsconfig.json +0 -10
@@ -1,31 +0,0 @@
1
- import type { TableIdentity } from 'table-identity';
2
- import type { IDecoratorDtoOptions } from 'vona-module-a-web';
3
-
4
- import { Api, v } from 'vona-module-a-openapiutils';
5
- import { Dto } from 'vona-module-a-web';
6
- import z from 'zod';
7
-
8
- import type { IPaypalOrderSceneRecord } from '../types/paypal.ts';
9
-
10
- export interface IDtoOptionsPaypalOrderRecordOptions extends IDecoratorDtoOptions {}
11
-
12
- @Dto<IDtoOptionsPaypalOrderRecordOptions>()
13
- export class DtoPaypalOrderRecordOptions {
14
- @Api.field()
15
- brandName: string;
16
-
17
- @Api.field()
18
- returnUrl: string;
19
-
20
- @Api.field()
21
- cancelUrl: string;
22
-
23
- @Api.field()
24
- returnTo: string;
25
-
26
- @Api.field(z.string())
27
- scene: keyof IPaypalOrderSceneRecord;
28
-
29
- @Api.field(v.tableIdentity())
30
- orderId: TableIdentity;
31
- }
@@ -1,18 +0,0 @@
1
- import type { IDecoratorDtoOptions } from 'vona-module-a-web';
2
-
3
- import { Api } from 'vona-module-a-openapiutils';
4
- import { Dto } from 'vona-module-a-web';
5
-
6
- export interface IDtoOptionsPaypalOrderRecordPayload extends IDecoratorDtoOptions {}
7
-
8
- @Dto<IDtoOptionsPaypalOrderRecordPayload>()
9
- export class DtoPaypalOrderRecordPayload {
10
- @Api.field()
11
- remark: string;
12
-
13
- @Api.field()
14
- total: string;
15
-
16
- @Api.field()
17
- currencyCode: string;
18
- }
@@ -1,30 +0,0 @@
1
- import type { TableIdentity } from 'table-identity';
2
- import type { IDecoratorEntityOptions } from 'vona-module-a-orm';
3
-
4
- import { Api, v } from 'vona-module-a-openapiutils';
5
- import { Entity, EntityBase } from 'vona-module-a-orm';
6
-
7
- import type { IPaypalOrderRecordOptions, IPaypalOrderRecordPayload } from '../types/paypal.ts';
8
-
9
- import { DtoPaypalOrderRecordOptions } from '../dto/paypalOrderRecordOptions.tsx';
10
- import { DtoPaypalOrderRecordPayload } from '../dto/paypalOrderRecordPayload.tsx';
11
-
12
- export interface IEntityOptionsPaypalRecord extends IDecoratorEntityOptions {}
13
-
14
- @Entity<IEntityOptionsPaypalRecord>('paypalRecord')
15
- export class EntityPaypalRecord extends EntityBase {
16
- @Api.field(v.tableIdentity())
17
- userId: TableIdentity;
18
-
19
- @Api.field(v.default(0))
20
- status: number;
21
-
22
- @Api.field()
23
- prepayId: string;
24
-
25
- @Api.field(v.object(DtoPaypalOrderRecordPayload))
26
- payload: IPaypalOrderRecordPayload;
27
-
28
- @Api.field(v.object(DtoPaypalOrderRecordOptions))
29
- options: IPaypalOrderRecordOptions;
30
- }
@@ -1,3 +0,0 @@
1
- export * from './.metadata/index.ts';
2
- export * from './.metadata/locales.ts';
3
- export * from './types/index.ts';
@@ -1,10 +0,0 @@
1
- import type { IDecoratorModelOptions } from 'vona-module-a-orm';
2
-
3
- import { BeanModelBase, Model } from 'vona-module-a-orm';
4
-
5
- import { EntityPaypalRecord } from '../entity/paypalRecord.tsx';
6
-
7
- export interface IModelOptionsPaypalRecord extends IDecoratorModelOptions<EntityPaypalRecord> {}
8
-
9
- @Model<IModelOptionsPaypalRecord>({ entity: EntityPaypalRecord })
10
- export class ModelPaypalRecord extends BeanModelBase<EntityPaypalRecord> {}
@@ -1,83 +0,0 @@
1
- import type { TableIdentity } from 'table-identity';
2
-
3
- import { OrdersController, OrderStatus } from '@cabloy/paypal-server-sdk';
4
- import { BeanBase } from 'vona';
5
- import { Service } from 'vona-module-a-bean';
6
-
7
- @Service()
8
- export class ServicePaypal extends BeanBase {
9
- async getRecord(userId: TableIdentity, recordId: TableIdentity) {
10
- // get record
11
- const record = await this.scope.model.paypalRecord.getById(recordId);
12
- // check user
13
- if (!record || record.userId !== userId) {
14
- this.app.throw(403);
15
- }
16
- return record;
17
- }
18
-
19
- async captureOrder(userId: TableIdentity, recordId: TableIdentity) {
20
- const record = await this.getRecord(userId, recordId);
21
- if (!record) this.app.throw(403);
22
- // check if handled
23
- if (record.status !== 0) this.app.throw(403);
24
- // prepayId
25
- const prepayId = record.prepayId;
26
- // process
27
- let grossAmount: number;
28
- let payFee: number;
29
- let netAmount: number;
30
- let orderResult: {} | undefined;
31
- if (this.app.meta.isTest) {
32
- grossAmount = Number.parseInt((Number.parseFloat(record.payload.total) * 100) as any);
33
- payFee = grossAmount * this.scope.config.paypal.payFeeRate;
34
- netAmount = grossAmount - payFee;
35
- orderResult = undefined;
36
- } else {
37
- // capture order
38
- const ordersController = new OrdersController(this.bean.paypal.createClient());
39
- const res = await ordersController.captureOrder({ id: prepayId });
40
- if (!res.result || res.result.status !== OrderStatus.Completed) {
41
- this.scope.error.TransactionException.throw();
42
- }
43
- // update
44
- const sellerReceivableBreakdown =
45
- res.result.purchaseUnits![0].payments!.captures![0].sellerReceivableBreakdown!;
46
- grossAmount = Number.parseInt(
47
- (Number.parseFloat(sellerReceivableBreakdown.grossAmount.value) * 100) as any,
48
- );
49
- payFee = Number.parseInt(
50
- (Number.parseFloat(sellerReceivableBreakdown.paypalFee!.value) * 100) as any,
51
- );
52
- netAmount = Number.parseInt(
53
- (Number.parseFloat(sellerReceivableBreakdown.netAmount!.value) * 100) as any,
54
- );
55
- orderResult = res.result;
56
- }
57
- // update status
58
- await this.scope.model.paypalRecord.update({ id: recordId, status: 1 });
59
- // raise event
60
- await this.scope.event.paypalCaptureOrder.emit({
61
- record,
62
- breakdown: {
63
- grossAmount,
64
- payFee,
65
- netAmount,
66
- },
67
- orderResult,
68
- });
69
- }
70
-
71
- async cancelOrder(userId: TableIdentity, recordId: TableIdentity) {
72
- const record = await this.getRecord(userId, recordId);
73
- if (!record) this.app.throw(403);
74
- // check if handled
75
- if (record.status !== 0) this.app.throw(403);
76
- // update status
77
- await this.scope.model.paypalRecord.update({ id: recordId, status: -1 });
78
- // raise event
79
- await this.scope.event.paypalCancelOrder.emit({
80
- record,
81
- });
82
- }
83
- }
@@ -1 +0,0 @@
1
- export * from './paypal.ts';
@@ -1,18 +0,0 @@
1
- import type { TableIdentity } from 'table-identity';
2
-
3
- export interface IPaypalOrderSceneRecord {}
4
-
5
- export interface IPaypalOrderRecordPayload {
6
- remark: string;
7
- total: string;
8
- currencyCode: string;
9
- }
10
-
11
- export interface IPaypalOrderRecordOptions {
12
- brandName: string;
13
- returnUrl: string;
14
- cancelUrl: string;
15
- returnTo: string;
16
- scene: keyof IPaypalOrderSceneRecord;
17
- orderId: TableIdentity;
18
- }
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base",
3
- "compilerOptions": {
4
- "rootDir": "src",
5
- "declaration": true,
6
- "declarationMap": true,
7
- "emitDeclarationOnly": true,
8
- "outDir": "dist"
9
- },
10
- "include": ["src", "src/.metadata/*.ts", "src/**/*.json"]
11
- }
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base",
3
- "compilerOptions": {
4
- "noEmit": true
5
- },
6
- "include": ["src", "src/.metadata/*.ts", "src/**/*.json", "test"]
7
- }
@@ -1,13 +0,0 @@
1
- {
2
- "name": "vona-suite-a-paypal",
3
- "version": "5.1.14",
4
- "gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
5
- "description": "",
6
- "author": "",
7
- "files": [],
8
- "type": "module",
9
- "dependencies": {
10
- "vona-module-a-paypal": "workspace:^"
11
- },
12
- "title": "a-paypal"
13
- }
@@ -1,4 +0,0 @@
1
- {
2
- "extends": "../../../tsconfig.base",
3
- "compilerOptions": {}
4
- }
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "./tsconfig.base",
3
- "compilerOptions": {},
4
- "references": [
5
- {
6
- "path": "modules/a-paypal/tsconfig.build.json"
7
- }
8
- ],
9
- "exclude": ["modules"]
10
- }