@explorins/pers-sdk 1.1.0-beta.0 → 1.1.3

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 (239) hide show
  1. package/dist/analytics/api/analytics-api.d.ts +17 -0
  2. package/dist/analytics/api/analytics-api.d.ts.map +1 -0
  3. package/dist/analytics/index.d.ts +28 -0
  4. package/dist/analytics/index.d.ts.map +1 -0
  5. package/dist/analytics/models/index.d.ts +61 -0
  6. package/dist/analytics/models/index.d.ts.map +1 -0
  7. package/dist/analytics/services/analytics-service.d.ts +19 -0
  8. package/dist/analytics/services/analytics-service.d.ts.map +1 -0
  9. package/dist/analytics.cjs +76 -0
  10. package/dist/analytics.cjs.map +1 -0
  11. package/dist/analytics.d.ts +28 -0
  12. package/dist/analytics.js +72 -0
  13. package/dist/analytics.js.map +1 -0
  14. package/dist/auth-admin/api/auth-admin-api.d.ts +27 -0
  15. package/dist/auth-admin/api/auth-admin-api.d.ts.map +1 -0
  16. package/dist/auth-admin/index.d.ts +26 -0
  17. package/dist/auth-admin/index.d.ts.map +1 -0
  18. package/dist/auth-admin/services/auth-admin-service.d.ts +23 -0
  19. package/dist/auth-admin/services/auth-admin-service.d.ts.map +1 -0
  20. package/dist/auth-admin.cjs +96 -0
  21. package/dist/auth-admin.cjs.map +1 -0
  22. package/dist/auth-admin.d.ts +26 -0
  23. package/dist/auth-admin.js +92 -0
  24. package/dist/auth-admin.js.map +1 -0
  25. package/dist/business/api/business-api.d.ts +133 -0
  26. package/dist/business/api/business-api.d.ts.map +1 -0
  27. package/dist/business/index.d.ts +34 -0
  28. package/dist/business/index.d.ts.map +1 -0
  29. package/{src/business/models/index.ts → dist/business/models/index.d.ts} +8 -13
  30. package/dist/business/models/index.d.ts.map +1 -0
  31. package/dist/business/services/business-service.d.ts +51 -0
  32. package/dist/business/services/business-service.d.ts.map +1 -0
  33. package/dist/business.cjs +303 -0
  34. package/dist/business.cjs.map +1 -0
  35. package/dist/business.d.ts +34 -0
  36. package/dist/business.js +299 -0
  37. package/dist/business.js.map +1 -0
  38. package/dist/campaign/api/campaign-api.d.ts +213 -0
  39. package/dist/campaign/api/campaign-api.d.ts.map +1 -0
  40. package/dist/campaign/index.d.ts +44 -0
  41. package/dist/campaign/index.d.ts.map +1 -0
  42. package/dist/campaign/services/campaign-service.d.ts +88 -0
  43. package/dist/campaign/services/campaign-service.d.ts.map +1 -0
  44. package/dist/campaign.cjs +506 -0
  45. package/dist/campaign.cjs.map +1 -0
  46. package/dist/campaign.d.ts +44 -0
  47. package/dist/campaign.js +502 -0
  48. package/dist/campaign.js.map +1 -0
  49. package/dist/core/abstractions/http-client.d.ts +22 -0
  50. package/dist/core/abstractions/http-client.d.ts.map +1 -0
  51. package/dist/core/auth/auth-provider.interface.d.ts +12 -0
  52. package/dist/core/auth/auth-provider.interface.d.ts.map +1 -0
  53. package/dist/core/auth/create-auth-provider.d.ts +27 -0
  54. package/dist/core/auth/create-auth-provider.d.ts.map +1 -0
  55. package/dist/core/auth/simple-auth-config.interface.d.ts +15 -0
  56. package/dist/core/auth/simple-auth-config.interface.d.ts.map +1 -0
  57. package/dist/core/index.d.ts +13 -0
  58. package/dist/core/index.d.ts.map +1 -0
  59. package/dist/core/pers-api-client.d.ts +54 -0
  60. package/dist/core/pers-api-client.d.ts.map +1 -0
  61. package/dist/core/pers-config.d.ts +38 -0
  62. package/dist/core/pers-config.d.ts.map +1 -0
  63. package/dist/core/utils/jwt.function.d.ts +2 -0
  64. package/dist/core/utils/jwt.function.d.ts.map +1 -0
  65. package/dist/core.cjs +506 -0
  66. package/dist/core.cjs.map +1 -0
  67. package/dist/core.d.ts +13 -0
  68. package/dist/core.js +497 -0
  69. package/dist/core.js.map +1 -0
  70. package/dist/donation/api/donation-api.d.ts +18 -0
  71. package/dist/donation/api/donation-api.d.ts.map +1 -0
  72. package/dist/donation/index.d.ts +25 -0
  73. package/dist/donation/index.d.ts.map +1 -0
  74. package/dist/donation/models/index.d.ts +8 -0
  75. package/dist/donation/models/index.d.ts.map +1 -0
  76. package/dist/donation/services/donation-service.d.ts +19 -0
  77. package/dist/donation/services/donation-service.d.ts.map +1 -0
  78. package/dist/donation.cjs +78 -0
  79. package/dist/donation.cjs.map +1 -0
  80. package/dist/donation.d.ts +25 -0
  81. package/dist/donation.js +74 -0
  82. package/dist/donation.js.map +1 -0
  83. package/dist/index.cjs +4217 -0
  84. package/dist/index.cjs.map +1 -0
  85. package/dist/index.d.ts +21 -0
  86. package/dist/index.d.ts.map +1 -0
  87. package/dist/index.js +4164 -0
  88. package/dist/index.js.map +1 -0
  89. package/dist/package.json +148 -0
  90. package/dist/payment/api/payment-api.d.ts +105 -0
  91. package/dist/payment/api/payment-api.d.ts.map +1 -0
  92. package/dist/payment/index.d.ts +36 -0
  93. package/dist/payment/index.d.ts.map +1 -0
  94. package/dist/payment/models/index.d.ts +12 -0
  95. package/dist/payment/models/index.d.ts.map +1 -0
  96. package/dist/payment/services/payment-service.d.ts +40 -0
  97. package/dist/payment/services/payment-service.d.ts.map +1 -0
  98. package/dist/payment.cjs +258 -0
  99. package/dist/payment.cjs.map +1 -0
  100. package/dist/payment.d.ts +36 -0
  101. package/dist/payment.js +254 -0
  102. package/dist/payment.js.map +1 -0
  103. package/dist/pers-sdk.d.ts +29 -0
  104. package/dist/pers-sdk.d.ts.map +1 -0
  105. package/dist/redemption/api/redemption-api.d.ts +147 -0
  106. package/dist/redemption/api/redemption-api.d.ts.map +1 -0
  107. package/dist/redemption/index.d.ts +35 -0
  108. package/dist/redemption/index.d.ts.map +1 -0
  109. package/dist/redemption/models/index.d.ts +8 -0
  110. package/dist/redemption/models/index.d.ts.map +1 -0
  111. package/dist/redemption/services/redemption-service.d.ts +56 -0
  112. package/dist/redemption/services/redemption-service.d.ts.map +1 -0
  113. package/dist/redemption.cjs +333 -0
  114. package/dist/redemption.cjs.map +1 -0
  115. package/dist/redemption.d.ts +35 -0
  116. package/dist/redemption.js +329 -0
  117. package/dist/redemption.js.map +1 -0
  118. package/dist/shared/interfaces/pers-shared-lib.interfaces.d.ts +18 -0
  119. package/dist/shared/interfaces/pers-shared-lib.interfaces.d.ts.map +1 -0
  120. package/dist/tenant/api/tenant-api.d.ts +56 -0
  121. package/dist/tenant/api/tenant-api.d.ts.map +1 -0
  122. package/dist/tenant/index.d.ts +34 -0
  123. package/dist/tenant/index.d.ts.map +1 -0
  124. package/dist/tenant/models/index.d.ts +11 -0
  125. package/dist/tenant/models/index.d.ts.map +1 -0
  126. package/dist/tenant/services/tenant-service.d.ts +46 -0
  127. package/dist/tenant/services/tenant-service.d.ts.map +1 -0
  128. package/dist/tenant.cjs +177 -0
  129. package/dist/tenant.cjs.map +1 -0
  130. package/dist/tenant.d.ts +34 -0
  131. package/dist/tenant.js +173 -0
  132. package/dist/tenant.js.map +1 -0
  133. package/dist/token/api/token-api.d.ts +64 -0
  134. package/dist/token/api/token-api.d.ts.map +1 -0
  135. package/dist/token/base/base-token-service.d.ts +87 -0
  136. package/dist/token/base/base-token-service.d.ts.map +1 -0
  137. package/dist/token/index.d.ts +13 -0
  138. package/dist/token/index.d.ts.map +1 -0
  139. package/dist/token/models/index.d.ts +18 -0
  140. package/dist/token/models/index.d.ts.map +1 -0
  141. package/dist/token/services/token-service.d.ts +68 -0
  142. package/dist/token/services/token-service.d.ts.map +1 -0
  143. package/dist/token/token-sdk.d.ts +140 -0
  144. package/dist/token/token-sdk.d.ts.map +1 -0
  145. package/dist/token.cjs +537 -0
  146. package/dist/token.cjs.map +1 -0
  147. package/dist/token.d.ts +13 -0
  148. package/dist/token.js +532 -0
  149. package/dist/token.js.map +1 -0
  150. package/dist/transaction/api/transaction-api.d.ts +133 -0
  151. package/dist/transaction/api/transaction-api.d.ts.map +1 -0
  152. package/dist/transaction/index.d.ts +38 -0
  153. package/dist/transaction/index.d.ts.map +1 -0
  154. package/dist/transaction/models/index.d.ts +42 -0
  155. package/dist/transaction/models/index.d.ts.map +1 -0
  156. package/dist/transaction/services/transaction-service.d.ts +56 -0
  157. package/dist/transaction/services/transaction-service.d.ts.map +1 -0
  158. package/dist/transaction.cjs +394 -0
  159. package/dist/transaction.cjs.map +1 -0
  160. package/dist/transaction.d.ts +38 -0
  161. package/dist/transaction.js +390 -0
  162. package/dist/transaction.js.map +1 -0
  163. package/dist/user/api/user-api.d.ts +56 -0
  164. package/dist/user/api/user-api.d.ts.map +1 -0
  165. package/dist/user/index.d.ts +36 -0
  166. package/dist/user/index.d.ts.map +1 -0
  167. package/dist/user/models/index.d.ts +12 -0
  168. package/dist/user/models/index.d.ts.map +1 -0
  169. package/dist/user/services/user-service.d.ts +46 -0
  170. package/dist/user/services/user-service.d.ts.map +1 -0
  171. package/dist/user-status/api/user-status-api.d.ts +37 -0
  172. package/dist/user-status/api/user-status-api.d.ts.map +1 -0
  173. package/dist/user-status/index.d.ts +28 -0
  174. package/dist/user-status/index.d.ts.map +1 -0
  175. package/dist/user-status/models/index.d.ts +8 -0
  176. package/dist/user-status/models/index.d.ts.map +1 -0
  177. package/dist/user-status/services/user-status-service.d.ts +26 -0
  178. package/dist/user-status/services/user-status-service.d.ts.map +1 -0
  179. package/dist/user-status.cjs +147 -0
  180. package/dist/user-status.cjs.map +1 -0
  181. package/dist/user-status.d.ts +28 -0
  182. package/dist/user-status.js +143 -0
  183. package/dist/user-status.js.map +1 -0
  184. package/dist/user.cjs +188 -0
  185. package/dist/user.cjs.map +1 -0
  186. package/dist/user.d.ts +36 -0
  187. package/dist/user.js +184 -0
  188. package/dist/user.js.map +1 -0
  189. package/dist/web3/api/web3-api.d.ts +27 -0
  190. package/dist/web3/api/web3-api.d.ts.map +1 -0
  191. package/dist/web3/index.d.ts +16 -0
  192. package/dist/web3/index.d.ts.map +1 -0
  193. package/dist/web3/models/index.d.ts +92 -0
  194. package/dist/web3/models/index.d.ts.map +1 -0
  195. package/dist/web3/services/web3-service.d.ts +21 -0
  196. package/dist/web3/services/web3-service.d.ts.map +1 -0
  197. package/dist/web3-chain/api/web3-chain-api.d.ts +19 -0
  198. package/dist/web3-chain/api/web3-chain-api.d.ts.map +1 -0
  199. package/dist/web3-chain/index.d.ts +17 -0
  200. package/dist/web3-chain/index.d.ts.map +1 -0
  201. package/dist/web3-chain/models/index.d.ts +38 -0
  202. package/dist/web3-chain/models/index.d.ts.map +1 -0
  203. package/dist/web3-chain/services/getWeb3FCD.service.d.ts +8 -0
  204. package/dist/web3-chain/services/getWeb3FCD.service.d.ts.map +1 -0
  205. package/dist/web3-chain/services/provider.service.d.ts +15 -0
  206. package/dist/web3-chain/services/provider.service.d.ts.map +1 -0
  207. package/dist/web3-chain/services/public-http-provider.service.d.ts +8 -0
  208. package/dist/web3-chain/services/public-http-provider.service.d.ts.map +1 -0
  209. package/dist/web3-chain/services/web3-chain-service.d.ts +17 -0
  210. package/dist/web3-chain/services/web3-chain-service.d.ts.map +1 -0
  211. package/dist/web3-chain.cjs +316 -0
  212. package/dist/web3-chain.cjs.map +1 -0
  213. package/dist/web3-chain.d.ts +17 -0
  214. package/dist/web3-chain.js +310 -0
  215. package/dist/web3-chain.js.map +1 -0
  216. package/dist/web3.cjs +516 -0
  217. package/dist/web3.cjs.map +1 -0
  218. package/dist/web3.d.ts +16 -0
  219. package/dist/web3.js +513 -0
  220. package/dist/web3.js.map +1 -0
  221. package/package.json +105 -17
  222. package/explorins-pers-sdk-1.0.0-alpha.1.tgz +0 -0
  223. package/rollup.config.js +0 -84
  224. package/src/business/api/business-api.ts +0 -72
  225. package/src/business/business/tsconfig.json +0 -18
  226. package/src/business/index.ts +0 -52
  227. package/src/business/services/business-service.ts +0 -88
  228. package/src/core/abstractions/core-interfaces.ts +0 -56
  229. package/src/core/abstractions/http-client.ts +0 -23
  230. package/src/core/auth/auth-provider.interface.ts +0 -16
  231. package/src/core/auth/create-auth-provider.ts +0 -136
  232. package/src/core/auth/simple-auth-config.interface.ts +0 -15
  233. package/src/core/core.ts +0 -30
  234. package/src/core/pers-api-client.ts +0 -151
  235. package/src/core/pers-config.ts +0 -38
  236. package/src/core.ts +0 -30
  237. package/src/index.ts +0 -16
  238. package/src/pers-sdk.ts +0 -45
  239. package/tsconfig.json +0 -28
package/package.json CHANGED
@@ -1,27 +1,117 @@
1
1
  {
2
2
  "name": "@explorins/pers-sdk",
3
- "version": "1.1.0-beta.0",
4
- "description": "Platform-agnostic SDK for PERS (Phygital Experience Rewards System)",
3
+ "version": "1.1.3",
4
+ "description": "Platform-agnostic SDK for PERS (Phygital Experience Rewards System) - Production Defaults",
5
5
  "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "files": [
10
+ "dist/**/*"
11
+ ],
6
12
  "exports": {
7
13
  ".": {
8
- "types": "./index.d.ts",
9
- "import": "./index.esm.js",
10
- "require": "./index.js"
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js",
16
+ "require": "./dist/index.cjs"
11
17
  },
12
- "./core": {
13
- "types": "./core.d.ts",
14
- "import": "./core.esm.js",
15
- "require": "./core.js"
18
+ "./analytics": {
19
+ "types": "./dist/analytics.d.ts",
20
+ "import": "./dist/analytics.js",
21
+ "require": "./dist/analytics.cjs"
22
+ },
23
+ "./auth-admin": {
24
+ "types": "./dist/auth-admin.d.ts",
25
+ "import": "./dist/auth-admin.js",
26
+ "require": "./dist/auth-admin.cjs"
16
27
  },
17
28
  "./business": {
18
- "types": "./business/index.d.ts",
19
- "import": "./business.esm.js",
20
- "require": "./business.js"
29
+ "types": "./dist/business.d.ts",
30
+ "import": "./dist/business.js",
31
+ "require": "./dist/business.cjs"
32
+ },
33
+ "./campaign": {
34
+ "types": "./dist/campaign.d.ts",
35
+ "import": "./dist/campaign.js",
36
+ "require": "./dist/campaign.cjs"
37
+ },
38
+ "./core": {
39
+ "types": "./dist/core.d.ts",
40
+ "import": "./dist/core.js",
41
+ "require": "./dist/core.cjs"
42
+ },
43
+ "./donation": {
44
+ "types": "./dist/donation.d.ts",
45
+ "import": "./dist/donation.js",
46
+ "require": "./dist/donation.cjs"
47
+ },
48
+ "./payment": {
49
+ "types": "./dist/payment.d.ts",
50
+ "import": "./dist/payment.js",
51
+ "require": "./dist/payment.cjs"
52
+ },
53
+ "./redemption": {
54
+ "types": "./dist/redemption.d.ts",
55
+ "import": "./dist/redemption.js",
56
+ "require": "./dist/redemption.cjs"
57
+ },
58
+ "./tenant": {
59
+ "types": "./dist/tenant.d.ts",
60
+ "import": "./dist/tenant.js",
61
+ "require": "./dist/tenant.cjs"
62
+ },
63
+ "./token": {
64
+ "types": "./dist/token.d.ts",
65
+ "import": "./dist/token.js",
66
+ "require": "./dist/token.cjs"
67
+ },
68
+ "./transaction": {
69
+ "types": "./dist/transaction.d.ts",
70
+ "import": "./dist/transaction.js",
71
+ "require": "./dist/transaction.cjs"
72
+ },
73
+ "./user": {
74
+ "types": "./dist/user.d.ts",
75
+ "import": "./dist/user.js",
76
+ "require": "./dist/user.cjs"
77
+ },
78
+ "./user-status": {
79
+ "types": "./dist/user-status.d.ts",
80
+ "import": "./dist/user-status.js",
81
+ "require": "./dist/user-status.cjs"
82
+ },
83
+ "./web3-chain": {
84
+ "types": "./dist/web3-chain.d.ts",
85
+ "import": "./dist/web3-chain.js",
86
+ "require": "./dist/web3-chain.cjs"
87
+ },
88
+ "./web3": {
89
+ "types": "./dist/web3.d.ts",
90
+ "import": "./dist/web3.js",
91
+ "require": "./dist/web3.cjs"
92
+ }
93
+ },
94
+ "typesVersions": {
95
+ "*": {
96
+ "analytics": ["./dist/analytics.d.ts"],
97
+ "auth-admin": ["./dist/auth-admin.d.ts"],
98
+ "business": ["./dist/business.d.ts"],
99
+ "campaign": ["./dist/campaign.d.ts"],
100
+ "core": ["./dist/core.d.ts"],
101
+ "donation": ["./dist/donation.d.ts"],
102
+ "payment": ["./dist/payment.d.ts"],
103
+ "redemption": ["./dist/redemption.d.ts"],
104
+ "tenant": ["./dist/tenant.d.ts"],
105
+ "token": ["./dist/token.d.ts"],
106
+ "transaction": ["./dist/transaction.d.ts"],
107
+ "user": ["./dist/user.d.ts"],
108
+ "user-status": ["./dist/user-status.d.ts"],
109
+ "web3-chain": ["./dist/web3-chain.d.ts"],
110
+ "web3": ["./dist/web3.d.ts"]
21
111
  }
22
112
  },
23
113
  "scripts": {
24
- "build": "rollup -c",
114
+ "build": "rollup -c && node scripts/copy-declarations.js",
25
115
  "build:watch": "rollup -c --watch",
26
116
  "clean": "rimraf dist",
27
117
  "test": "jest",
@@ -30,9 +120,6 @@
30
120
  "prepublishOnly": "npm run clean && npm run build",
31
121
  "publish": "npm publish"
32
122
  },
33
- "dependencies": {
34
- "@explorins/pers-shared": "*"
35
- },
36
123
  "devDependencies": {
37
124
  "@rollup/plugin-typescript": "^11.1.6",
38
125
  "@types/jest": "^29.5.12",
@@ -43,7 +130,8 @@
43
130
  "typescript": "^5.4.5"
44
131
  },
45
132
  "peerDependencies": {
46
- "@explorins/pers-shared": "*"
133
+ "@explorins/pers-shared": "*",
134
+ "jwt-decode": "^3.0.0 || ^4.0.0"
47
135
  },
48
136
  "publishConfig": {
49
137
  "access": "public",
package/rollup.config.js DELETED
@@ -1,84 +0,0 @@
1
- import typescript from '@rollup/plugin-typescript';
2
- import copy from 'rollup-plugin-copy';
3
-
4
- export default [
5
- // Core entry point
6
- {
7
- input: 'src/core/core.ts',
8
- output: [
9
- {
10
- file: 'dist/core.js',
11
- format: 'cjs',
12
- sourcemap: true
13
- },
14
- {
15
- file: 'dist/core.esm.js',
16
- format: 'esm',
17
- sourcemap: true
18
- }
19
- ],
20
- plugins: [
21
- typescript({
22
- tsconfig: './tsconfig.json',
23
- declaration: true,
24
- declarationDir: './dist'
25
- })
26
- ],
27
- external: ['rxjs', 'rxjs/operators']
28
- },
29
-
30
- // Business domain entry point
31
- {
32
- input: 'src/business/index.ts',
33
- output: [
34
- {
35
- file: 'dist/business.js',
36
- format: 'cjs',
37
- sourcemap: true
38
- },
39
- {
40
- file: 'dist/business.esm.js',
41
- format: 'esm',
42
- sourcemap: true
43
- }
44
- ],
45
- plugins: [
46
- typescript({
47
- tsconfig: './tsconfig.json',
48
- declaration: true,
49
- declarationDir: './dist'
50
- })
51
- ],
52
- external: ['@explorins/pers-shared', 'rxjs', 'rxjs/operators']
53
- },
54
-
55
- // Main entry point (everything)
56
- {
57
- input: 'src/index.ts',
58
- output: [
59
- {
60
- file: 'dist/index.js',
61
- format: 'cjs',
62
- sourcemap: true
63
- },
64
- {
65
- file: 'dist/index.esm.js',
66
- format: 'esm',
67
- sourcemap: true
68
- }
69
- ],
70
- plugins: [
71
- typescript({
72
- tsconfig: './tsconfig.json',
73
- declaration: true,
74
- declarationDir: './dist'
75
- }),
76
- copy({
77
- targets: [
78
- { src: 'package.json', dest: 'dist' }
79
- ]
80
- })
81
- ],
82
- external: ['@explorins/pers-shared', 'rxjs', 'rxjs/operators']
83
- }
84
- ];
@@ -1,72 +0,0 @@
1
- import { PersApiClient } from '../../core/pers-api-client';
2
- import { BusinessDTO, BusinessTypeDTO, BusinessUpdateRequestDTO } from '@explorins/pers-shared';
3
-
4
- /**
5
- * Platform-Agnostic Business API Client
6
- *
7
- * Focuses on non-admin business operations using the PERS backend.
8
- * Uses @explorins/pers-shared DTOs for consistency with backend.
9
- */
10
- export class BusinessApi {
11
- constructor(private apiClient: PersApiClient) {}
12
-
13
- /**
14
- * Get all active businesses (public endpoint)
15
- */
16
- async getActiveBusinesses(): Promise<BusinessDTO[]> {
17
- return this.apiClient.get<BusinessDTO[]>('/business');
18
- }
19
-
20
- /**
21
- * Get all business types (public endpoint)
22
- */
23
- async getAllBusinessTypes(): Promise<BusinessTypeDTO[]> {
24
- return this.apiClient.get<BusinessTypeDTO[]>('/business/type');
25
- }
26
-
27
- /**
28
- * Get business by ID
29
- */
30
- async getBusinessById(businessId: string): Promise<BusinessDTO> {
31
- return this.apiClient.get<BusinessDTO>(`/business/${businessId}`);
32
- }
33
-
34
- /**
35
- * Get business by account address
36
- */
37
- async getBusinessByAccount(accountAddress: string): Promise<BusinessDTO> {
38
- return this.apiClient.get<BusinessDTO>(`/business/account/${accountAddress}`);
39
- }
40
-
41
- // ==========================================
42
- // ADMIN OPERATIONS
43
- // ==========================================
44
-
45
- /**
46
- * ADMIN: Get all businesses (active and inactive)
47
- */
48
- async getAllBusinesses(): Promise<BusinessDTO[]> {
49
- return this.apiClient.get<BusinessDTO[]>('/business/admin');
50
- }
51
-
52
- /**
53
- * ADMIN: Create business by display name
54
- */
55
- async createBusinessByDisplayName(displayName: string): Promise<BusinessDTO> {
56
- return this.apiClient.post<BusinessDTO>('/business/admin/', { displayName });
57
- }
58
-
59
- /**
60
- * ADMIN: Update business
61
- */
62
- async updateBusiness(id: string, businessData: BusinessUpdateRequestDTO): Promise<BusinessDTO> {
63
- return this.apiClient.put<BusinessDTO>(`/business/admin/${id}`, businessData);
64
- }
65
-
66
- /**
67
- * ADMIN: Toggle business active status
68
- */
69
- async toggleBusinessActive(id: string, isActive: boolean): Promise<BusinessDTO> {
70
- return this.apiClient.put<BusinessDTO>(`/business/admin/activate/${id}`, { isActive });
71
- }
72
- }
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ESNext",
5
- "moduleResolution": "node",
6
- "esModuleInterop": true,
7
- "allowSyntheticDefaultImports": true,
8
- "strict": true,
9
- "declaration": true,
10
- "outDir": "dist",
11
- "rootDir": "src",
12
- "skipLibCheck": true,
13
- "forceConsistentCasingInFileNames": true,
14
- "lib": ["ES2022", "DOM"]
15
- },
16
- "include": ["src/**/*"],
17
- "exclude": ["node_modules", "dist", "**/*.spec.ts", "**/*.test.ts"]
18
- }
@@ -1,52 +0,0 @@
1
- /**
2
- * @explorins/pers-sdk-business
3
- *
4
- * Platform-agnostic Business Domain SDK for PERS ecosystem
5
- * Focuses on non-admin business operations
6
- */
7
-
8
- // API Layer
9
- export { BusinessApi } from './api/business-api';
10
-
11
- // Service Layer
12
- export { BusinessService } from './services/business-service';
13
-
14
- // Models & Types
15
- export * from './models';
16
-
17
- // Factory function for creating business SDK instance
18
- import { PersApiClient } from '../core/pers-api-client';
19
- import { BusinessApi } from './api/business-api';
20
- import { BusinessService } from './services/business-service';
21
-
22
- /**
23
- * Create a complete Business SDK instance
24
- *
25
- * @param apiClient - Configured PERS API client
26
- * @returns Business SDK with flattened structure for better DX
27
- */
28
- export function createBusinessSDK(apiClient: PersApiClient) {
29
- const businessApi = new BusinessApi(apiClient);
30
- const businessService = new BusinessService(businessApi);
31
-
32
- return {
33
- // Direct access to service methods (primary interface)
34
- getActiveBusinesses: () => businessService.getActiveBusinesses(),
35
- getAllBusinessTypes: () => businessService.getAllBusinessTypes(),
36
- getBusinessById: (businessId: string) => businessService.getBusinessById(businessId),
37
- getBusinessByAccount: (accountAddress: string) => businessService.getBusinessByAccount(accountAddress),
38
- getBusinessesByType: (typeId: string) => businessService.getBusinessesByType(typeId),
39
-
40
- // Admin methods
41
- getAllBusinesses: () => businessService.getAllBusinesses(),
42
- createBusinessByDisplayName: (displayName: string) => businessService.createBusinessByDisplayName(displayName),
43
- updateBusiness: (id: string, businessData: any) => businessService.updateBusiness(id, businessData),
44
- toggleBusinessActive: (id: string, isActive: boolean) => businessService.toggleBusinessActive(id, isActive),
45
-
46
- // Advanced access for edge cases
47
- api: businessApi,
48
- service: businessService
49
- };
50
- }
51
-
52
- export type BusinessSDK = ReturnType<typeof createBusinessSDK>;
@@ -1,88 +0,0 @@
1
- import { BusinessApi } from '../api/business-api';
2
- import {
3
- BusinessDTO,
4
- BusinessTypeDTO,
5
- BusinessUpdateRequestDTO
6
- } from '../models';
7
-
8
- /**
9
- * Platform-Agnostic Business Service
10
- *
11
- * Contains business logic and operations that work across platforms.
12
- * No framework dependencies - pure TypeScript business logic.
13
- *
14
- * Focuses only on actual backend capabilities.
15
- */
16
- export class BusinessService {
17
- constructor(private businessApi: BusinessApi) {}
18
-
19
- /**
20
- * Get all active businesses
21
- */
22
- async getActiveBusinesses(): Promise<BusinessDTO[]> {
23
- return this.businessApi.getActiveBusinesses();
24
- }
25
-
26
- /**
27
- * Get all business types
28
- */
29
- async getAllBusinessTypes(): Promise<BusinessTypeDTO[]> {
30
- return this.businessApi.getAllBusinessTypes();
31
- }
32
-
33
- /**
34
- * Get business by ID
35
- */
36
- async getBusinessById(businessId: string): Promise<BusinessDTO> {
37
- return this.businessApi.getBusinessById(businessId);
38
- }
39
-
40
- /**
41
- * Get business by account address
42
- */
43
- async getBusinessByAccount(accountAddress: string): Promise<BusinessDTO> {
44
- return this.businessApi.getBusinessByAccount(accountAddress);
45
- }
46
-
47
- /**
48
- * Get businesses by type (client-side filtering)
49
- */
50
- async getBusinessesByType(typeId: string): Promise<BusinessDTO[]> {
51
- const businesses = await this.getActiveBusinesses();
52
- return businesses.filter(business =>
53
- business.businessType && business.businessType.id === parseInt(typeId)
54
- );
55
- }
56
-
57
- // ==========================================
58
- // ADMIN OPERATIONS
59
- // ==========================================
60
-
61
- /**
62
- * ADMIN: Get all businesses (active and inactive)
63
- */
64
- async getAllBusinesses(): Promise<BusinessDTO[]> {
65
- return this.businessApi.getAllBusinesses();
66
- }
67
-
68
- /**
69
- * ADMIN: Create business by display name
70
- */
71
- async createBusinessByDisplayName(displayName: string): Promise<BusinessDTO> {
72
- return this.businessApi.createBusinessByDisplayName(displayName);
73
- }
74
-
75
- /**
76
- * ADMIN: Update business
77
- */
78
- async updateBusiness(id: string, businessData: BusinessUpdateRequestDTO): Promise<BusinessDTO> {
79
- return this.businessApi.updateBusiness(id, businessData);
80
- }
81
-
82
- /**
83
- * ADMIN: Toggle business active status
84
- */
85
- async toggleBusinessActive(id: string, isActive: boolean): Promise<BusinessDTO> {
86
- return this.businessApi.toggleBusinessActive(id, isActive);
87
- }
88
- }
@@ -1,56 +0,0 @@
1
- /**
2
- * Core SDK interfaces based on actual PERS Tourism Loyalty App patterns
3
- * These interfaces reflect the real DDD architecture with Lazy Facade pattern
4
- */
5
-
6
- // Core HTTP abstractions matching the app's ApiService patterns
7
- export interface CoreHttpClient {
8
- get<T>(url: string, options?: any): Observable<T>;
9
- post<T>(url: string, body: any, options?: any): Observable<T>;
10
- put<T>(url: string, body: any, options?: any): Observable<T>;
11
- delete<T>(url: string, options?: any): Observable<T>;
12
- }
13
-
14
- // Base facade interface reflecting the app's LazyClass pattern
15
- export interface CoreFacade {
16
- [key: string]: any;
17
- }
18
-
19
- // Environment configuration interface based on LoyaltyEnvironment
20
- export interface CoreEnvironment {
21
- production: boolean;
22
- version: string;
23
- apiVersion: string
24
- apiRoot: string;
25
- apiProjectKey?: string;
26
- }
27
-
28
- // State management interface reflecting the app's Signal-based patterns
29
- export interface CoreStateManager<T> {
30
- state$: Observable<T>;
31
- updateState(partialState: Partial<T>): void;
32
- resetState(): void;
33
- }
34
-
35
- // Event system interface for cross-platform communication
36
- export interface CoreEventEmitter<T = any> {
37
- emit(eventName: string, data?: T): void;
38
- on(eventName: string, callback: (data?: T) => void): void;
39
- off(eventName: string, callback?: (data?: T) => void): void;
40
- }
41
-
42
- // Service factory interface for platform-specific implementations
43
- export interface CoreServiceFactory {
44
- createHttpClient(): CoreHttpClient;
45
- createStateManager<T>(initialState: T): CoreStateManager<T>;
46
- createEventEmitter<T>(): CoreEventEmitter<T>;
47
- }
48
-
49
- // Observable type for platform-agnostic reactive programming
50
- export interface Observable<T> {
51
- subscribe(observer: {
52
- next?: (value: T) => void;
53
- error?: (error: any) => void;
54
- complete?: () => void;
55
- }): { unsubscribe(): void };
56
- }
@@ -1,23 +0,0 @@
1
- /**
2
- * Platform-agnostic HTTP client interface
3
- * To be implemented by platform-specific adapters (Angular, React Native, etc.)
4
- */
5
-
6
- export interface HttpClient {
7
- get<T>(url: string, options?: RequestOptions): Promise<T>;
8
- post<T>(url: string, body: any, options?: RequestOptions): Promise<T>;
9
- put<T>(url: string, body: any, options?: RequestOptions): Promise<T>;
10
- delete<T>(url: string, options?: RequestOptions): Promise<T>;
11
- }
12
-
13
- export interface RequestOptions {
14
- headers?: Record<string, string>;
15
- params?: Record<string, string>;
16
- timeout?: number;
17
- }
18
-
19
- export interface HttpResponse<T> {
20
- data: T;
21
- status: number;
22
- headers: Record<string, string>;
23
- }
@@ -1,16 +0,0 @@
1
- export interface AuthProvider {
2
- getToken(): Promise<string | null>;
3
- getProjectKey(): Promise<string | null>;
4
- authType: 'admin' | 'user' | 'firebase';
5
- onTokenExpired?: () => Promise<void>;
6
- }
7
-
8
- export interface RequestOptions {
9
- headers?: Record<string, string>;
10
- }
11
-
12
- // Export simple auth config for dev-friendly usage
13
- export * from './simple-auth-config.interface';
14
-
15
- // Export auth provider factory and helpers
16
- export * from './create-auth-provider';