@simitgroup/simpleapp-generator 1.6.7-h-alpha → 1.6.7-j-alpha
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/ReleaseNote.md +12 -0
- package/dist/generate.js +2 -0
- package/dist/generate.js.map +1 -1
- package/package.json +1 -1
- package/src/generate.ts +2 -0
- package/templates/basic/miniApi/resource.controller.ts.eta +122 -52
- package/templates/basic/miniApi/resource.service.ts.eta +61 -25
- package/templates/basic/nest/apischema.ts.eta +21 -6
- package/templates/basic/nest/controller.ts.eta +37 -16
- package/templates/basic/nuxt/resource-bridge.service.ts.eta +3 -2
- package/templates/miniApi/src/constants/api-scopes.ts.eta +22 -4
- package/templates/miniApi/src/constants/available-custom-field.ts.eta +22 -0
- package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +34 -14
- package/templates/nest/src/simpleapp/generate/commons/robotuser.service.ts.eta +4 -8
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +154 -17
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +125 -441
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +62 -66
- package/templates/nuxt/plugins/19.simpleapp-mini-app-store.ts.eta +240 -203
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +1 -1
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppFeatureCustomField.vue.eta +34 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppFeatureCustomPage.vue.eta +68 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppFeatureScope.vue.eta +53 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppIcon.vue.eta +49 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppMenuButton.vue.eta +6 -4
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppPageIframe.vue.eta +9 -3
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppPermissionWrapper.vue.eta +4 -4
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppRestrictedWarning.vue.eta +3 -3
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppSettingLayout.vue.eta +3 -3
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppSettingPage.vue.eta +2 -2
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppWrapper.vue.eta +2 -32
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/integration/MiniAppIntegrationItem.vue.eta +6 -5
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/integration/MiniAppIntegrationItemBadge.vue.eta +15 -9
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/integration/MiniAppIntegrationItemGroup.vue.eta +4 -4
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/integration/MiniAppIntegrationPage.vue.eta +135 -22
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/types/miniApp.ts.eta +7 -7
- package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/services/bridge-resource-accessor.service.ts.eta +3 -1
- package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/services/bridge.service.ts.eta +3 -0
|
@@ -7,25 +7,32 @@
|
|
|
7
7
|
class="p-8 max-w-4xl mx-auto mb-10 space-y-4"
|
|
8
8
|
>
|
|
9
9
|
<div class="flex items-start">
|
|
10
|
-
<img :src="miniApp.logo" class="size-16 mr-8 object-contain" />
|
|
10
|
+
<!-- <img :src="miniApp.logo" class="size-16 mr-8 object-contain" /> -->
|
|
11
|
+
|
|
12
|
+
<MiniAppIcon
|
|
13
|
+
:image="miniApp.logo"
|
|
14
|
+
:label="miniApp.name"
|
|
15
|
+
size="lg"
|
|
16
|
+
class="mr-8"
|
|
17
|
+
/>
|
|
11
18
|
|
|
12
19
|
<div class="space-y-1">
|
|
13
20
|
<h1 class="text-3xl font-bold mb-1">{{ miniApp.name }}</h1>
|
|
14
21
|
<div class="text-gray-400 text-sm flex items-center gap-2">
|
|
15
22
|
<div class="flex items-center gap-2">
|
|
16
23
|
<i class="pi pi-user" />
|
|
17
|
-
<span>{{ miniApp.author }}</span>
|
|
24
|
+
<span>{{ miniApp.author.team ?? miniApp.author.name }}</span>
|
|
18
25
|
</div>
|
|
19
26
|
<span>|</span>
|
|
20
27
|
<div>v {{ miniApp.version }}</div>
|
|
21
28
|
|
|
22
29
|
<div
|
|
23
|
-
v-if="!_.isEmpty(miniApp.requiredPlans)"
|
|
30
|
+
v-if="!_.isEmpty(miniApp.access.requiredPlans)"
|
|
24
31
|
class="flex items-center gap-2"
|
|
25
32
|
>
|
|
26
33
|
<span>|</span>
|
|
27
34
|
<span
|
|
28
|
-
v-for="permission in miniApp.requiredPlans ?? []"
|
|
35
|
+
v-for="permission in miniApp.access.requiredPlans ?? []"
|
|
29
36
|
class="px-3 py-0.5 bg-slate-100 text-surface-500 font-semibold text-xs rounded uppercase"
|
|
30
37
|
>
|
|
31
38
|
{{ permission }}
|
|
@@ -42,6 +49,22 @@
|
|
|
42
49
|
</div>
|
|
43
50
|
</div>
|
|
44
51
|
<p class="text-gray-600">{{ miniApp.intro.description }}</p>
|
|
52
|
+
|
|
53
|
+
<div class="flex items-center gap-1">
|
|
54
|
+
<template
|
|
55
|
+
v-for="[feature, enabled] in Object.entries(
|
|
56
|
+
miniApp.integration.enabled,
|
|
57
|
+
)"
|
|
58
|
+
>
|
|
59
|
+
<span
|
|
60
|
+
v-if="enabled"
|
|
61
|
+
class="px-3 py-0.5 bg-primary-50 text-primary-500 font-semibold text-xs rounded uppercase cursor-pointer"
|
|
62
|
+
@click="() => handleOpenFeatureDialog(feature, enabled)"
|
|
63
|
+
>
|
|
64
|
+
{{ t(`miniAppLang.integrationFeature.${feature}`) }}
|
|
65
|
+
</span>
|
|
66
|
+
</template>
|
|
67
|
+
</div>
|
|
45
68
|
</div>
|
|
46
69
|
</div>
|
|
47
70
|
|
|
@@ -53,13 +76,13 @@
|
|
|
53
76
|
</template>
|
|
54
77
|
<MiniAppPermissionWrapper
|
|
55
78
|
v-else
|
|
56
|
-
:
|
|
79
|
+
:validation="$miniAppStore.validation('miniAppFeature')"
|
|
57
80
|
>
|
|
58
81
|
<div class="flex items-center space-x-2">
|
|
59
82
|
<template v-if="$miniAppStore.isMiniAppInstalled(miniApp.code)">
|
|
60
83
|
<!-- Installed -->
|
|
61
84
|
<MiniAppPermissionWrapper
|
|
62
|
-
:
|
|
85
|
+
:validation="$miniAppStore.validation('uninstall')"
|
|
63
86
|
class="!mt-0"
|
|
64
87
|
>
|
|
65
88
|
<ButtonDefault
|
|
@@ -71,11 +94,8 @@
|
|
|
71
94
|
</MiniAppPermissionWrapper>
|
|
72
95
|
|
|
73
96
|
<MiniAppPermissionWrapper
|
|
74
|
-
v-if="
|
|
75
|
-
|
|
76
|
-
!_.isEmpty(miniApp.integration.settings)
|
|
77
|
-
"
|
|
78
|
-
:permission="$miniAppStore.checkCanUpdateSetting(miniApp)"
|
|
97
|
+
v-if="$miniAppStore.hasSettingPage(miniApp)"
|
|
98
|
+
:validation="$miniAppStore.validation('updateSetting')"
|
|
79
99
|
class="!mt-0"
|
|
80
100
|
>
|
|
81
101
|
<ButtonSecondary
|
|
@@ -89,7 +109,7 @@
|
|
|
89
109
|
<template v-else>
|
|
90
110
|
<!-- Not yet install -->
|
|
91
111
|
<MiniAppPermissionWrapper
|
|
92
|
-
:
|
|
112
|
+
:validation="$miniAppStore.validation('install')"
|
|
93
113
|
class="!mt-0"
|
|
94
114
|
>
|
|
95
115
|
<ButtonPrimary
|
|
@@ -105,19 +125,49 @@
|
|
|
105
125
|
|
|
106
126
|
<div v-if="miniApp.intro.previewImages.length > 0">
|
|
107
127
|
<h2 class="text-xl font-semibold mb-2">Overview:</h2>
|
|
108
|
-
<div class="card flex justify-center py-4">
|
|
128
|
+
<div class="card flex justify-center py-4 h-96 bg-slate-100 rounded-xl">
|
|
109
129
|
<Galleria
|
|
110
130
|
:value="miniApp.intro.previewImages"
|
|
111
131
|
:numVisible="5"
|
|
112
|
-
containerStyle="max-width: 640px"
|
|
113
132
|
:showThumbnails="false"
|
|
114
133
|
:showIndicators="true"
|
|
134
|
+
:showItemNavigators="true"
|
|
135
|
+
:pt="{
|
|
136
|
+
root: {
|
|
137
|
+
class: '!grow !h-full',
|
|
138
|
+
},
|
|
139
|
+
content: {
|
|
140
|
+
class: '!h-full',
|
|
141
|
+
},
|
|
142
|
+
itemsContainer: {
|
|
143
|
+
class: '!h-full',
|
|
144
|
+
},
|
|
145
|
+
items: {
|
|
146
|
+
class: '!grow',
|
|
147
|
+
},
|
|
148
|
+
item: {
|
|
149
|
+
class: '!grow',
|
|
150
|
+
},
|
|
151
|
+
prevButton: {
|
|
152
|
+
class: '!bg-slate-200 cursor-pointer',
|
|
153
|
+
},
|
|
154
|
+
prevIcon: {
|
|
155
|
+
class: 'text-black',
|
|
156
|
+
},
|
|
157
|
+
nextButton: {
|
|
158
|
+
class: '!bg-slate-200 cursor-pointer',
|
|
159
|
+
},
|
|
160
|
+
nextIcon: {
|
|
161
|
+
class: 'text-black',
|
|
162
|
+
},
|
|
163
|
+
}"
|
|
115
164
|
>
|
|
116
165
|
<template #item="slotProps">
|
|
117
166
|
<img
|
|
118
167
|
:src="slotProps.item"
|
|
119
168
|
:alt="miniApp.name"
|
|
120
|
-
style="
|
|
169
|
+
style="display: block"
|
|
170
|
+
class="h-80 rounded-xl shadow-md"
|
|
121
171
|
/>
|
|
122
172
|
</template>
|
|
123
173
|
</Galleria>
|
|
@@ -132,10 +182,12 @@
|
|
|
132
182
|
:key="feature.title"
|
|
133
183
|
class="flex space-x-2"
|
|
134
184
|
>
|
|
135
|
-
<div
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
<span class="font-semibold">{{ feature.title }}</span>
|
|
185
|
+
<div class="flex flex-col">
|
|
186
|
+
<div class="flex items-center gap-2">
|
|
187
|
+
<i class="pi pi-check-circle text-primary" />
|
|
188
|
+
<span class="font-semibold">{{ feature.title }}</span>
|
|
189
|
+
</div>
|
|
190
|
+
<div class="pl-6 text-slate-400 text-sm">
|
|
139
191
|
{{ feature.description }}
|
|
140
192
|
</div>
|
|
141
193
|
</div>
|
|
@@ -143,18 +195,59 @@
|
|
|
143
195
|
</div>
|
|
144
196
|
</div>
|
|
145
197
|
</div>
|
|
198
|
+
|
|
199
|
+
<Dialog
|
|
200
|
+
v-model:visible="isShowApiAccessFeature"
|
|
201
|
+
:modal="true"
|
|
202
|
+
maximizable
|
|
203
|
+
:header="t('scopes')"
|
|
204
|
+
class="!w-1/2 !h-2/3"
|
|
205
|
+
>
|
|
206
|
+
<MiniAppFeatureScope :miniApp="miniApp" />
|
|
207
|
+
</Dialog>
|
|
208
|
+
|
|
209
|
+
<Dialog
|
|
210
|
+
v-model:visible="isShowCustomPageFeature"
|
|
211
|
+
:modal="true"
|
|
212
|
+
maximizable
|
|
213
|
+
:header="t('customPage')"
|
|
214
|
+
class="!w-1/2 !h-2/3"
|
|
215
|
+
>
|
|
216
|
+
<MiniAppFeatureCustomPage :miniApp="miniApp" />
|
|
217
|
+
</Dialog>
|
|
218
|
+
|
|
219
|
+
<Dialog
|
|
220
|
+
v-model:visible="isShowCustomFieldFeature"
|
|
221
|
+
:modal="true"
|
|
222
|
+
maximizable
|
|
223
|
+
:header="t('customField')"
|
|
224
|
+
class="!w-1/2 !h-2/3"
|
|
225
|
+
>
|
|
226
|
+
<MiniAppFeatureCustomField :miniApp="miniApp" />
|
|
227
|
+
</Dialog>
|
|
146
228
|
</div>
|
|
147
229
|
<div v-else>
|
|
148
|
-
<template v-if="!isFetching">
|
|
230
|
+
<template v-if="!isFetching">
|
|
231
|
+
<NodataLarge
|
|
232
|
+
:label="t('noDataFound')"
|
|
233
|
+
:icon="UndrawNodata"
|
|
234
|
+
class="my-24"
|
|
235
|
+
/>
|
|
236
|
+
</template>
|
|
149
237
|
</div>
|
|
150
238
|
</template>
|
|
151
239
|
|
|
152
240
|
<script setup lang="ts">
|
|
153
|
-
import _ from "lodash";
|
|
241
|
+
import _, { min } from "lodash";
|
|
154
242
|
import { MiniAppDetail } from "~/simpleapp/generate/openapi";
|
|
155
243
|
import MiniAppPermissionWrapper from "../MiniAppPermissionWrapper.vue";
|
|
244
|
+
import UndrawNodata from "~/components/icon/UndrawNodata.vue";
|
|
245
|
+
import MiniAppIcon from "../MiniAppIcon.vue";
|
|
246
|
+
import MiniAppFeatureCustomPage from "../MiniAppFeatureCustomPage.vue";
|
|
247
|
+
import MiniAppFeatureCustomField from "../MiniAppFeatureCustomField.vue";
|
|
248
|
+
import MiniAppFeatureScope from "../MiniAppFeatureScope.vue";
|
|
156
249
|
|
|
157
|
-
defineProps<{
|
|
250
|
+
const props = defineProps<{
|
|
158
251
|
miniApp?: MiniAppDetail;
|
|
159
252
|
isFetching: boolean;
|
|
160
253
|
isAppInstallationInProgress: boolean;
|
|
@@ -167,6 +260,10 @@ const emits = defineEmits<{
|
|
|
167
260
|
(e: "upgradePlan"): void;
|
|
168
261
|
}>();
|
|
169
262
|
|
|
263
|
+
const isShowApiAccessFeature = ref(false);
|
|
264
|
+
const isShowCustomPageFeature = ref(false);
|
|
265
|
+
const isShowCustomFieldFeature = ref(false);
|
|
266
|
+
|
|
170
267
|
function handleInstallApp() {
|
|
171
268
|
emits("installApp");
|
|
172
269
|
}
|
|
@@ -178,4 +275,20 @@ function handleUninstallApp() {
|
|
|
178
275
|
function handleOpenSetting() {
|
|
179
276
|
emits("openSetting");
|
|
180
277
|
}
|
|
278
|
+
|
|
279
|
+
function handleOpenFeatureDialog(feature: string, enabled: boolean) {
|
|
280
|
+
if (enabled) {
|
|
281
|
+
switch (feature) {
|
|
282
|
+
case "miniApi":
|
|
283
|
+
isShowApiAccessFeature.value = true;
|
|
284
|
+
break;
|
|
285
|
+
case "customField":
|
|
286
|
+
isShowCustomFieldFeature.value = true;
|
|
287
|
+
break;
|
|
288
|
+
case "customPage":
|
|
289
|
+
isShowCustomPageFeature.value = true;
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
181
294
|
</script>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
MiniAppDetail,
|
|
3
|
-
|
|
4
|
-
MiniappIntegrationPages,
|
|
3
|
+
MiniappIntegrationCustomFieldFields,
|
|
5
4
|
} from "~/simpleapp/generate/openapi";
|
|
6
5
|
|
|
7
6
|
export enum MiniAppFrameworkCompatibility {
|
|
@@ -10,11 +9,7 @@ export enum MiniAppFrameworkCompatibility {
|
|
|
10
9
|
"DEPRECATED" = "DEPRECATED",
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
export type
|
|
14
|
-
miniAppCode: string;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type MiniAppFormWithMiniAppCode = MiniappIntegrationForms & {
|
|
12
|
+
export type MiniAppFormWithMiniAppCode = MiniappIntegrationCustomFieldFields & {
|
|
18
13
|
miniAppCode: string;
|
|
19
14
|
};
|
|
20
15
|
|
|
@@ -28,3 +23,8 @@ export type MiniAppPermissionResult = {
|
|
|
28
23
|
status: boolean;
|
|
29
24
|
reason?: string;
|
|
30
25
|
};
|
|
26
|
+
|
|
27
|
+
export type MiniAppValidationResp = {
|
|
28
|
+
valid: boolean;
|
|
29
|
+
type: string;
|
|
30
|
+
};
|
|
@@ -41,6 +41,8 @@ export class MiniAppBridgeResourceAccessor {
|
|
|
41
41
|
|
|
42
42
|
protected miniAppCode: string = "";
|
|
43
43
|
|
|
44
|
+
protected developerPortalAppId: string = "";
|
|
45
|
+
|
|
44
46
|
<% for (let i = 0; i < it.modules.length; i++) { %>
|
|
45
47
|
<%
|
|
46
48
|
const { resourceName, pascalName, kebabName, hasMiniAppWhitelistedApi } = getMiniAppInfo(it.modules[i]);
|
|
@@ -48,7 +50,7 @@ export class MiniAppBridgeResourceAccessor {
|
|
|
48
50
|
<% if(hasMiniAppWhitelistedApi) { %>
|
|
49
51
|
get <%= resourceName %>() {
|
|
50
52
|
if (!this.instances.<%= resourceName %>) {
|
|
51
|
-
this.instances.<%= resourceName %> = new MiniApp<%= pascalName %>BridgeEditableService(this.miniAppCode);
|
|
53
|
+
this.instances.<%= resourceName %> = new MiniApp<%= pascalName %>BridgeEditableService(this.miniAppCode, this.developerPortalAppId);
|
|
52
54
|
}
|
|
53
55
|
return this.instances.<%= resourceName %>;
|
|
54
56
|
}
|
package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/services/bridge.service.ts.eta
CHANGED
|
@@ -64,10 +64,13 @@ export class MiniAppBridgeService extends MiniAppBridgeResourceAccessor {
|
|
|
64
64
|
messageEvent: MessageEvent,
|
|
65
65
|
message: MiniAppBridgeMessageApi<any>,
|
|
66
66
|
miniAppCode: string,
|
|
67
|
+
developerPortalAppId: string,
|
|
67
68
|
) {
|
|
68
69
|
try {
|
|
69
70
|
this.miniAppCode = miniAppCode;
|
|
70
71
|
|
|
72
|
+
this.developerPortalAppId = developerPortalAppId;
|
|
73
|
+
|
|
71
74
|
const data = await this.handleBridgeCallApi(message);
|
|
72
75
|
|
|
73
76
|
messageEvent.source?.postMessage(
|